1 line
13 KiB
JSON
1 line
13 KiB
JSON
|
{"ast":null,"code":"\"use client\";\n\nvar __rest = this && this.__rest || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport * as React from 'react';\nimport CheckOutlined from \"@ant-design/icons/es/icons/CheckOutlined\";\nimport CloseOutlined from \"@ant-design/icons/es/icons/CloseOutlined\";\nimport classNames from 'classnames';\nimport RcSteps from 'rc-steps';\nimport { ConfigContext } from '../config-provider';\nimport useSize from '../config-provider/hooks/useSize';\nimport useBreakpoint from '../grid/hooks/useBreakpoint';\nimport Progress from '../progress';\nimport Tooltip from '../tooltip';\nimport useStyle from './style';\nimport useLegacyItems from './useLegacyItems';\nconst Steps = props => {\n const {\n percent,\n size: customizeSize,\n className,\n rootClassName,\n direction,\n items,\n responsive = true,\n current = 0,\n children,\n style\n } = props,\n restProps = __rest(props, [\"percent\", \"size\", \"className\", \"rootClassName\", \"direction\", \"items\", \"responsive\", \"current\", \"children\", \"style\"]);\n const {\n xs\n } = useBreakpoint(responsive);\n const {\n getPrefixCls,\n direction: rtlDirection,\n steps\n } = React.useContext(ConfigContext);\n const realDirectionValue = React.useMemo(() => responsive && xs ? 'vertical' : direction, [xs, direction]);\n const size = useSize(customizeSize);\n const prefixCls = getPrefixCls('steps', props.prefixCls);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);\n const isInline = props.type === 'inline';\n const iconPrefix = getPrefixCls('', props.iconPrefix);\n const mergedItems = useLegacyItems(items, children);\n const mergedPercent = isInline ? undefined : percent;\n const mergedStyle = Object.assign(Object.assign({}, steps === null || steps === void 0 ? void 0 : steps.style), style);\n const stepsClassName = classNames(steps === null || steps === void 0 ? void 0 : steps.className, {\n [`${prefixCls}-rtl`]: rtlDirection === 'rtl',\n [`${prefixCls}-with-progress`]: mergedPercent !== undefined\n }, className, rootClassName, hashId, cssVarCls);\n const icons = {\n finish: /*#__PURE__*/React.createElement(CheckOutlined, {\n className: `${prefixCls}-finish-icon`\n }),\n error: /*#__PURE__*/React.createElement(CloseOutlined, {\n className: `${prefixCls}-error-icon`\n })\n };\n const stepIconRender = _ref => {\n let {\n node,\n status\n } = _ref;\n if (status === 'process' && mergedPercent !== undefined) {\n // currently it's hard-coded, since we can't easily read the actually width of icon\n const progressWidth = size === 'small' ? 32 : 40;\n // iconWithProgress\n return /*#__PURE__*/React.createElement(\"div\", {\n className: `${prefixCls}-progress-icon`\n }, /*#__PURE__*/React.createElement(Progress, {\n type: \"circle\",\n percent: mergedPercent,\n size: progressWidth,\n strokeWidth: 4,\n format: () => null\n }), node);\n }\n return node;\n };\n const itemRender = (item, stepItem) => item.description ? /*#__PURE__*/React.createElement(Tooltip, {\n title: item.description\n }, stepItem) : stepItem;\n return wrapCSSVar( /*#__PURE__*/React.createElement(RcSteps, Object.assign({\n icons: icons\n }, restProps, {\n style: mergedStyle,\n current: current,\n size: size,\n items: mergedItems,\n itemRender: isInline ? itemRender : undefined,\n stepIcon: stepIconRender,\n direction: realDirectionValue,\n prefixCls: prefixCls,\n iconPrefix: iconPrefix,\n className: stepsClassName\n })));\n};\nSteps.Step = RcSteps.Step;\nif (process.env.NODE_
|