PromoCursed/node_modules/.cache/babel-loader/8b3c4a8ffe0e5a4c244b2b967bee26725e06523a7dbb198ca5e5774f79444423.json

1 line
14 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 toArray from \"rc-util/es/Children/toArray\";\nimport { ConfigContext } from '../config-provider';\nimport useSize from '../config-provider/hooks/useSize';\nimport useStyle from './style';\nexport const SpaceCompactItemContext = /*#__PURE__*/React.createContext(null);\nexport const useCompactItemContext = (prefixCls, direction) => {\n const compactItemContext = React.useContext(SpaceCompactItemContext);\n const compactItemClassnames = React.useMemo(() => {\n if (!compactItemContext) {\n return '';\n }\n const {\n compactDirection,\n isFirstItem,\n isLastItem\n } = compactItemContext;\n const separator = compactDirection === 'vertical' ? '-vertical-' : '-';\n return classNames(`${prefixCls}-compact${separator}item`, {\n [`${prefixCls}-compact${separator}first-item`]: isFirstItem,\n [`${prefixCls}-compact${separator}last-item`]: isLastItem,\n [`${prefixCls}-compact${separator}item-rtl`]: direction === 'rtl'\n });\n }, [prefixCls, direction, compactItemContext]);\n return {\n compactSize: compactItemContext === null || compactItemContext === void 0 ? void 0 : compactItemContext.compactSize,\n compactDirection: compactItemContext === null || compactItemContext === void 0 ? void 0 : compactItemContext.compactDirection,\n compactItemClassnames\n };\n};\nexport const NoCompactStyle = _ref => {\n let {\n children\n } = _ref;\n return /*#__PURE__*/React.createElement(SpaceCompactItemContext.Provider, {\n value: null\n }, children);\n};\nconst CompactItem = _a => {\n var {\n children\n } = _a,\n otherProps = __rest(_a, [\"children\"]);\n return /*#__PURE__*/React.createElement(SpaceCompactItemContext.Provider, {\n value: otherProps\n }, children);\n};\nconst Compact = props => {\n const {\n getPrefixCls,\n direction: directionConfig\n } = React.useContext(ConfigContext);\n const {\n size,\n direction,\n block,\n prefixCls: customizePrefixCls,\n className,\n rootClassName,\n children\n } = props,\n restProps = __rest(props, [\"size\", \"direction\", \"block\", \"prefixCls\", \"className\", \"rootClassName\", \"children\"]);\n const mergedSize = useSize(ctx => size !== null && size !== void 0 ? size : ctx);\n const prefixCls = getPrefixCls('space-compact', customizePrefixCls);\n const [wrapCSSVar, hashId] = useStyle(prefixCls);\n const clx = classNames(prefixCls, hashId, {\n [`${prefixCls}-rtl`]: directionConfig === 'rtl',\n [`${prefixCls}-block`]: block,\n [`${prefixCls}-vertical`]: direction === 'vertical'\n }, className, rootClassName);\n const compactItemContext = React.useContext(SpaceCompactItemContext);\n const childNodes = toArray(children);\n const nodes = React.useMemo(() => childNodes.map((child, i) => {\n const key = (child === null || child === void 0 ? void 0 : child.key) || `${prefixCls}-item-${i}`;\n return /*#__PURE__*/React.createElement(CompactItem, {\n key: key,\n compactSize: mergedSize,\n compactDirection: direction,\n isFirstItem: i === 0 && (!compactItemContext || (compactItemContext === null || compactItemContext === void 0 ? void 0 : compactItemContext.isFirstItem)),\n isLastItem: i === childNodes.length - 1 && (!compactItemContext || (compactItemContext === null || compactItemContext === void 0 ? void 0 : compactItemContext.isLastItem))\n }, child);\n }), [size, childNodes, compactItemContext]);\n // =========================== Render =======================