PromoCursed/node_modules/.cache/babel-loader/1a4c2dbce7b19cfe346848086d44e9841a265e16f7443965539c716f1847527b.json

1 line
9.0 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 useMergedState from \"rc-util/es/hooks/useMergedState\";\nimport ConfigProvider, { ConfigContext } from '../config-provider';\nexport function withPureRenderTheme(Component) {\n return props => ( /*#__PURE__*/React.createElement(ConfigProvider, {\n theme: {\n token: {\n motion: false,\n zIndexPopupBase: 0\n }\n }\n }, /*#__PURE__*/React.createElement(Component, Object.assign({}, props))));\n}\n/* istanbul ignore next */\nconst genPurePanel = (Component, defaultPrefixCls, getDropdownCls, postProps) => {\n const PurePanel = props => {\n const {\n prefixCls: customizePrefixCls,\n style\n } = props;\n const holderRef = React.useRef(null);\n const [popupHeight, setPopupHeight] = React.useState(0);\n const [popupWidth, setPopupWidth] = React.useState(0);\n const [open, setOpen] = useMergedState(false, {\n value: props.open\n });\n const {\n getPrefixCls\n } = React.useContext(ConfigContext);\n const prefixCls = getPrefixCls(defaultPrefixCls || 'select', customizePrefixCls);\n React.useEffect(() => {\n // We do not care about ssr\n setOpen(true);\n if (typeof ResizeObserver !== 'undefined') {\n const resizeObserver = new ResizeObserver(entries => {\n const element = entries[0].target;\n setPopupHeight(element.offsetHeight + 8);\n setPopupWidth(element.offsetWidth);\n });\n const interval = setInterval(() => {\n var _a;\n const dropdownCls = getDropdownCls ? `.${getDropdownCls(prefixCls)}` : `.${prefixCls}-dropdown`;\n const popup = (_a = holderRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(dropdownCls);\n if (popup) {\n clearInterval(interval);\n resizeObserver.observe(popup);\n }\n }, 10);\n return () => {\n clearInterval(interval);\n resizeObserver.disconnect();\n };\n }\n }, []);\n let mergedProps = Object.assign(Object.assign({}, props), {\n style: Object.assign(Object.assign({}, style), {\n margin: 0\n }),\n open,\n visible: open,\n getPopupContainer: () => holderRef.current\n });\n if (postProps) {\n mergedProps = postProps(mergedProps);\n }\n const mergedStyle = {\n paddingBottom: popupHeight,\n position: 'relative',\n minWidth: popupWidth\n };\n return /*#__PURE__*/React.createElement(\"div\", {\n ref: holderRef,\n style: mergedStyle\n }, /*#__PURE__*/React.createElement(Component, Object.assign({}, mergedProps)));\n };\n return withPureRenderTheme(PurePanel);\n};\nexport default genPurePanel;","map":{"version":3,"names":["React","useMergedState","ConfigProvider","ConfigContext","withPureRenderTheme","Component","props","createElement","theme","token","motion","zIndexPopupBase","Object","assign","genPurePanel","defaultPrefixCls","getDropdownCls","postProps","PurePanel","prefixCls","customizePrefixCls","style","holderRef","useRef","popupHeight","setPopupHeight","useState","popupWidth","setPopupWidth","open","setOpen","value","getPrefixCls","useContext","useEffect","ResizeObserver","resizeObserver","entries","element","target","offsetHeight","offsetWidth","interval","setInterval","_a","dropdownCls","popup","current","querySelector","clearInterval","observe","disconnect","mergedProps","margin","visible","getPopupContainer","mergedStyle","paddingBottom","position","minWidth","ref"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/antd/es/_util/PurePanel.js"],"sourcesContent":["\"use client\";\n\nimport * as React from 'react';\nimport useMergedState from \"rc-util/es/hooks/useMergedState\";\nimport ConfigProvider, { ConfigContext } from '../config-provider';\nexport function withPureRenderTheme(Component) {\n return props => ( /*#__PURE__*/React.createElement(ConfigProvider, {\n theme: {\n token: {\n motion: false,\n zIndexPopupBase: 0\n }