PromoCursed/node_modules/.cache/babel-loader/6ff7b4ca848b53d40ff20614e97356dfce995d2e891487c6cc5537b8ed0b4774.json

1 line
16 KiB
JSON
Raw Normal View History

2024-08-20 23:25:37 +04:00
{"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 classNames from 'classnames';\nimport { debounce } from 'throttle-debounce';\nimport { devUseWarning } from '../_util/warning';\nimport { ConfigContext } from '../config-provider';\nimport Indicator from './Indicator';\nimport useStyle from './style/index';\nimport usePercent from './usePercent';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nconst SpinSizes = ['small', 'default', 'large'];\n// Render indicator\nlet defaultIndicator;\nfunction shouldDelay(spinning, delay) {\n return !!spinning && !!delay && !isNaN(Number(delay));\n}\nconst Spin = props => {\n var _a;\n const {\n prefixCls: customizePrefixCls,\n spinning: customSpinning = true,\n delay = 0,\n className,\n rootClassName,\n size = 'default',\n tip,\n wrapperClassName,\n style,\n children,\n fullscreen = false,\n indicator,\n percent\n } = props,\n restProps = __rest(props, [\"prefixCls\", \"spinning\", \"delay\", \"className\", \"rootClassName\", \"size\", \"tip\", \"wrapperClassName\", \"style\", \"children\", \"fullscreen\", \"indicator\", \"percent\"]);\n const {\n getPrefixCls,\n direction,\n spin\n } = React.useContext(ConfigContext);\n const prefixCls = getPrefixCls('spin', customizePrefixCls);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);\n const [spinning, setSpinning] = React.useState(() => customSpinning && !shouldDelay(customSpinning, delay));\n const mergedPercent = usePercent(spinning, percent);\n React.useEffect(() => {\n if (customSpinning) {\n const showSpinning = debounce(delay, () => {\n setSpinning(true);\n });\n showSpinning();\n return () => {\n var _a;\n (_a = showSpinning === null || showSpinning === void 0 ? void 0 : showSpinning.cancel) === null || _a === void 0 ? void 0 : _a.call(showSpinning);\n };\n }\n setSpinning(false);\n }, [delay, customSpinning]);\n const isNestedPattern = React.useMemo(() => typeof children !== 'undefined' && !fullscreen, [children, fullscreen]);\n if (process.env.NODE_ENV !== 'production') {\n const warning = devUseWarning('Spin');\n process.env.NODE_ENV !== \"production\" ? warning(!tip || isNestedPattern || fullscreen, 'usage', '`tip` only work in nest or fullscreen pattern.') : void 0;\n }\n const spinClassName = classNames(prefixCls, spin === null || spin === void 0 ? void 0 : spin.className, {\n [`${prefixCls}-sm`]: size === 'small',\n [`${prefixCls}-lg`]: size === 'large',\n [`${prefixCls}-spinning`]: spinning,\n [`${prefixCls}-show-text`]: !!tip,\n [`${prefixCls}-rtl`]: direction === 'rtl'\n }, className, !fullscreen && rootClassName, hashId, cssVarCls);\n const containerClassName = classNames(`${prefixCls}-container`, {\n [`${prefixCls}-blur`]: spinning\n });\n const mergedIndicator = (_a = indicator !== null && indicator !== void 0 ? indicator : spin === null || spin === void 0 ? void 0 : spin.indicator) !== null && _a !== void 0 ? _a : defaultIndicator;\n const mergedStyle = Object.assign(Object.assign({}, spin === null || spin === void 0 ? void 0 : spin.style), style);\n const spinElement = /*#__PURE__*/React.createElement(\"div\", Object.assign({}, restProps, {\n style: mergedStyle,\n className: spinClassName,\n \"aria-live\": \"polite\",\n \"aria-busy\": spinning\n }), /*#__PURE__*/React.createElement(Indicator, {\n prefixCls: prefixCls,\n indicator: mergedIndicator,\n percent: mergedPercent\n }), tip && (isNestedPattern || fullscreen) ? ( /*#__