PromoCursed/node_modules/.cache/babel-loader/ab71d5ddde1385713a192fb3cf20ace6b516e3ea258fdd7cabf7e6d9aeea983d.json

1 line
28 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 RcDropdown from 'rc-dropdown';\nimport { useEvent } from 'rc-util';\nimport useMergedState from \"rc-util/es/hooks/useMergedState\";\nimport omit from \"rc-util/es/omit\";\nimport { useZIndex } from '../_util/hooks/useZIndex';\nimport getPlacements from '../_util/placements';\nimport genPurePanel from '../_util/PurePanel';\nimport { cloneElement } from '../_util/reactNode';\nimport { devUseWarning } from '../_util/warning';\nimport zIndexContext from '../_util/zindexContext';\nimport { ConfigContext } from '../config-provider';\nimport useCSSVarCls from '../config-provider/hooks/useCSSVarCls';\nimport Menu from '../menu';\nimport { OverrideProvider } from '../menu/OverrideContext';\nimport { useToken } from '../theme/internal';\nimport useStyle from './style';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nconst Placements = ['topLeft', 'topCenter', 'topRight', 'bottomLeft', 'bottomCenter', 'bottomRight', 'top', 'bottom'];\nconst Dropdown = props => {\n var _a;\n const {\n menu,\n arrow,\n prefixCls: customizePrefixCls,\n children,\n trigger,\n disabled,\n dropdownRender,\n getPopupContainer,\n overlayClassName,\n rootClassName,\n overlayStyle,\n open,\n onOpenChange,\n // Deprecated\n visible,\n onVisibleChange,\n mouseEnterDelay = 0.15,\n mouseLeaveDelay = 0.1,\n autoAdjustOverflow = true,\n placement = '',\n overlay,\n transitionName\n } = props;\n const {\n getPopupContainer: getContextPopupContainer,\n getPrefixCls,\n direction,\n dropdown\n } = React.useContext(ConfigContext);\n // Warning for deprecated usage\n const warning = devUseWarning('Dropdown');\n if (process.env.NODE_ENV !== 'production') {\n [['visible', 'open'], ['onVisibleChange', 'onOpenChange']].forEach(_ref => {\n let [deprecatedName, newName] = _ref;\n warning.deprecated(!(deprecatedName in props), deprecatedName, newName);\n });\n warning.deprecated(!('overlay' in props), 'overlay', 'menu');\n }\n const memoTransitionName = React.useMemo(() => {\n const rootPrefixCls = getPrefixCls();\n if (transitionName !== undefined) {\n return transitionName;\n }\n if (placement.includes('top')) {\n return `${rootPrefixCls}-slide-down`;\n }\n return `${rootPrefixCls}-slide-up`;\n }, [getPrefixCls, placement, transitionName]);\n const memoPlacement = React.useMemo(() => {\n if (!placement) {\n return direction === 'rtl' ? 'bottomRight' : 'bottomLeft';\n }\n if (placement.includes('Center')) {\n return placement.slice(0, placement.indexOf('Center'));\n }\n return placement;\n }, [placement, direction]);\n if (process.env.NODE_ENV !== 'production') {\n if (placement.includes('Center')) {\n const newPlacement = placement.slice(0, placement.indexOf('Center'));\n process.env.NODE_ENV !== \"production\" ? warning(!placement.includes('Center'), 'deprecated', `You are using '${placement}' placement in Dropdown, which is deprecated. Try to use '${newPlacement}' instead.`) : void 0;\n }\n [['visible', 'open'], ['onVisibleChange', 'onOpenChange']].forEach(_ref2 => {\n let [deprecatedName, newName] = _ref2;\n warning.deprecated(!(deprecatedName in props), deprecatedName, newName);\n });\n }\n const prefixCls = getPrefixCls('dropdown', customizePrefixCls);\n const rootCls = useCSSVarCls(prefixCls);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls, rootCls);\n const [, token] = useToken();\n const child = React.Children.only(children);\n const dropdownTrigger = cloneElement(child, {\n className: classNames(`${prefixCls}-trigger`, {\n [`${prefixCls}-rtl`]: direction === 'rtl'\n }, child.props.className),\n disabled: (_a = child.props.disabled) !== null && _a !== void 0 ? _a : disabled\n });\n const triggerActions = disabled ? [] : trigger;\n co