PromoCursed/node_modules/.cache/babel-loader/47b33f3b7a3240bace54237aed7df22cc3dab28e78f707ab482e276596765424.json

1 line
15 KiB
JSON
Raw Normal View History

2024-08-20 23:25:37 +04:00
{"ast":null,"code":"\"use client\";\n\nimport * as React from 'react';\nimport RightOutlined from \"@ant-design/icons/es/icons/RightOutlined\";\nimport classNames from 'classnames';\nimport RcCollapse from 'rc-collapse';\nimport toArray from \"rc-util/es/Children/toArray\";\nimport omit from \"rc-util/es/omit\";\nimport initCollapseMotion from '../_util/motion';\nimport { cloneElement } from '../_util/reactNode';\nimport { devUseWarning } from '../_util/warning';\nimport { ConfigContext } from '../config-provider';\nimport useSize from '../config-provider/hooks/useSize';\nimport CollapsePanel from './CollapsePanel';\nimport useStyle from './style';\nconst Collapse = /*#__PURE__*/React.forwardRef((props, ref) => {\n const {\n getPrefixCls,\n direction,\n collapse\n } = React.useContext(ConfigContext);\n const {\n prefixCls: customizePrefixCls,\n className,\n rootClassName,\n style,\n bordered = true,\n ghost,\n size: customizeSize,\n expandIconPosition = 'start',\n children,\n expandIcon\n } = props;\n const mergedSize = useSize(ctx => {\n var _a;\n return (_a = customizeSize !== null && customizeSize !== void 0 ? customizeSize : ctx) !== null && _a !== void 0 ? _a : 'middle';\n });\n const prefixCls = getPrefixCls('collapse', customizePrefixCls);\n const rootPrefixCls = getPrefixCls();\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);\n if (process.env.NODE_ENV !== 'production') {\n const warning = devUseWarning('Collapse');\n // Warning if use legacy type `expandIconPosition`\n process.env.NODE_ENV !== \"production\" ? warning(expandIconPosition !== 'left' && expandIconPosition !== 'right', 'deprecated', '`expandIconPosition` with `left` or `right` is deprecated. Please use `start` or `end` instead.') : void 0;\n }\n // Align with logic position\n const mergedExpandIconPosition = React.useMemo(() => {\n if (expandIconPosition === 'left') {\n return 'start';\n }\n return expandIconPosition === 'right' ? 'end' : expandIconPosition;\n }, [expandIconPosition]);\n const mergedExpandIcon = expandIcon !== null && expandIcon !== void 0 ? expandIcon : collapse === null || collapse === void 0 ? void 0 : collapse.expandIcon;\n const renderExpandIcon = React.useCallback(function () {\n let panelProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n const icon = typeof mergedExpandIcon === 'function' ? mergedExpandIcon(panelProps) : ( /*#__PURE__*/React.createElement(RightOutlined, {\n rotate: panelProps.isActive ? 90 : undefined,\n \"aria-label\": panelProps.isActive ? 'expanded' : 'collapsed'\n }));\n return cloneElement(icon, () => {\n var _a;\n return {\n className: classNames((_a = icon === null || icon === void 0 ? void 0 : icon.props) === null || _a === void 0 ? void 0 : _a.className, `${prefixCls}-arrow`)\n };\n });\n }, [mergedExpandIcon, prefixCls]);\n const collapseClassName = classNames(`${prefixCls}-icon-position-${mergedExpandIconPosition}`, {\n [`${prefixCls}-borderless`]: !bordered,\n [`${prefixCls}-rtl`]: direction === 'rtl',\n [`${prefixCls}-ghost`]: !!ghost,\n [`${prefixCls}-${mergedSize}`]: mergedSize !== 'middle'\n }, collapse === null || collapse === void 0 ? void 0 : collapse.className, className, rootClassName, hashId, cssVarCls);\n const openMotion = Object.assign(Object.assign({}, initCollapseMotion(rootPrefixCls)), {\n motionAppear: false,\n leavedClassName: `${prefixCls}-content-hidden`\n });\n const items = React.useMemo(() => children ? toArray(children).map((child, index) => {\n var _a, _b;\n if ((_a = child.props) === null || _a === void 0 ? void 0 : _a.disabled) {\n const key = (_b = child.key) !== null && _b !== void 0 ? _b : String(index);\n const {\n disabled,\n collapsible\n } = child.props;\n const childProps = Object.assign(Object.assign({}, omit(child.props, ['disabled'])), {\n key,\n collapsible: collapsible !== null && collapsible !== void 0 ? co