PromoCursed/node_modules/.cache/babel-loader/9c2679189d5a53547c7189037ef59f6cf0e393584fdc8cebab55fdaf0ff3480b.json

1 line
14 KiB
JSON
Raw Normal View History

2024-08-20 23:25:37 +04:00
{"ast":null,"code":"\"use client\";\n\nimport _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\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 omit from \"rc-util/es/omit\";\nimport { ConfigContext } from '../config-provider';\nimport { LayoutContext } from './context';\nimport useHasSider from './hooks/useHasSider';\nimport useStyle from './style';\nfunction generator(_ref) {\n let {\n suffixCls,\n tagName,\n displayName\n } = _ref;\n return BasicComponent => {\n const Adapter = /*#__PURE__*/React.forwardRef((props, ref) => ( /*#__PURE__*/React.createElement(BasicComponent, Object.assign({\n ref: ref,\n suffixCls: suffixCls,\n tagName: tagName\n }, props))));\n if (process.env.NODE_ENV !== 'production') {\n Adapter.displayName = displayName;\n }\n return Adapter;\n };\n}\nconst Basic = /*#__PURE__*/React.forwardRef((props, ref) => {\n const {\n prefixCls: customizePrefixCls,\n suffixCls,\n className,\n tagName: TagName\n } = props,\n others = __rest(props, [\"prefixCls\", \"suffixCls\", \"className\", \"tagName\"]);\n const {\n getPrefixCls\n } = React.useContext(ConfigContext);\n const prefixCls = getPrefixCls('layout', customizePrefixCls);\n const [wrapSSR, hashId, cssVarCls] = useStyle(prefixCls);\n const prefixWithSuffixCls = suffixCls ? `${prefixCls}-${suffixCls}` : prefixCls;\n return wrapSSR( /*#__PURE__*/React.createElement(TagName, Object.assign({\n className: classNames(customizePrefixCls || prefixWithSuffixCls, className, hashId, cssVarCls),\n ref: ref\n }, others)));\n});\nconst BasicLayout = /*#__PURE__*/React.forwardRef((props, ref) => {\n const {\n direction\n } = React.useContext(ConfigContext);\n const [siders, setSiders] = React.useState([]);\n const {\n prefixCls: customizePrefixCls,\n className,\n rootClassName,\n children,\n hasSider,\n tagName: Tag,\n style\n } = props,\n others = __rest(props, [\"prefixCls\", \"className\", \"rootClassName\", \"children\", \"hasSider\", \"tagName\", \"style\"]);\n const passedProps = omit(others, ['suffixCls']);\n const {\n getPrefixCls,\n layout\n } = React.useContext(ConfigContext);\n const prefixCls = getPrefixCls('layout', customizePrefixCls);\n const mergedHasSider = useHasSider(siders, children, hasSider);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls);\n const classString = classNames(prefixCls, {\n [`${prefixCls}-has-sider`]: mergedHasSider,\n [`${prefixCls}-rtl`]: direction === 'rtl'\n }, layout === null || layout === void 0 ? void 0 : layout.className, className, rootClassName, hashId, cssVarCls);\n const contextValue = React.useMemo(() => ({\n siderHook: {\n addSider: id => {\n setSiders(prev => [].concat(_toConsumableArray(prev), [id]));\n },\n removeSider: id => {\n setSiders(prev => prev.filter(currentId => currentId !== id));\n }\n }\n }), []);\n return wrapCSSVar( /*#__PURE__*/React.createElement(LayoutContext.Provider, {\n value: contextValue\n }, /*#__PURE__*/React.createElement(Tag, Object.assign({\n ref: ref,\n className: classString,\n style: Object.assign(Object.assign({}, layout === null || layout === void 0 ? void 0 : layout.style), style)\n }, passedProps), children)));\n});\nconst Layout = generator({\n tagName: 'div',\n displayName: 'Layout'\n})(BasicLayout);\nconst Header = generator({\n suffixCls: 'header',\n tagName: 'header',\n displayName: 'Header'\n})(Basic);\nconst Footer = generator({\n suffixCls: 'footer