PromoCursed/node_modules/.cache/babel-loader/99276331198ac0c32c5d854030bb41ecb8ad0dd6d87d63c8f75466a944d6500e.json

1 line
18 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 React, { memo, useCallback, useContext, useEffect } from 'react';\nimport CloseOutlined from \"@ant-design/icons/es/icons/CloseOutlined\";\nimport FileTextOutlined from \"@ant-design/icons/es/icons/FileTextOutlined\";\nimport classNames from 'classnames';\nimport CSSMotion from 'rc-motion';\nimport useMergedState from \"rc-util/es/hooks/useMergedState\";\nimport { devUseWarning } from '../_util/warning';\nimport { ConfigContext } from '../config-provider';\nimport useCSSVarCls from '../config-provider/hooks/useCSSVarCls';\nimport { FloatButtonGroupProvider } from './context';\nimport FloatButton, { floatButtonPrefixCls } from './FloatButton';\nimport useStyle from './style';\nconst FloatButtonGroup = props => {\n var _a;\n const {\n prefixCls: customizePrefixCls,\n className,\n style,\n shape = 'circle',\n type = 'default',\n icon = /*#__PURE__*/React.createElement(FileTextOutlined, null),\n closeIcon,\n description,\n trigger,\n children,\n onOpenChange,\n open: customOpen\n } = props,\n floatButtonProps = __rest(props, [\"prefixCls\", \"className\", \"style\", \"shape\", \"type\", \"icon\", \"closeIcon\", \"description\", \"trigger\", \"children\", \"onOpenChange\", \"open\"]);\n const {\n direction,\n getPrefixCls,\n floatButtonGroup\n } = useContext(ConfigContext);\n const mergedCloseIcon = (_a = closeIcon !== null && closeIcon !== void 0 ? closeIcon : floatButtonGroup === null || floatButtonGroup === void 0 ? void 0 : floatButtonGroup.closeIcon) !== null && _a !== void 0 ? _a : /*#__PURE__*/React.createElement(CloseOutlined, null);\n const prefixCls = getPrefixCls(floatButtonPrefixCls, customizePrefixCls);\n const rootCls = useCSSVarCls(prefixCls);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls, rootCls);\n const groupPrefixCls = `${prefixCls}-group`;\n const groupCls = classNames(groupPrefixCls, hashId, cssVarCls, rootCls, className, {\n [`${groupPrefixCls}-rtl`]: direction === 'rtl',\n [`${groupPrefixCls}-${shape}`]: shape,\n [`${groupPrefixCls}-${shape}-shadow`]: !trigger\n });\n const wrapperCls = classNames(hashId, `${groupPrefixCls}-wrap`);\n const [open, setOpen] = useMergedState(false, {\n value: customOpen\n });\n const floatButtonGroupRef = React.useRef(null);\n const floatButtonRef = React.useRef(null);\n const hoverAction = React.useMemo(() => {\n const hoverTypeAction = {\n onMouseEnter() {\n setOpen(true);\n onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(true);\n },\n onMouseLeave() {\n setOpen(false);\n onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(false);\n }\n };\n return trigger === 'hover' ? hoverTypeAction : {};\n }, [trigger]);\n const handleOpenChange = () => {\n setOpen(prevState => {\n onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(!prevState);\n return !prevState;\n });\n };\n const onClick = useCallback(e => {\n var _a, _b;\n if ((_a = floatButtonGroupRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target)) {\n if ((_b = floatButtonRef.current) === null || _b === void 0 ? void 0 : _b.contains(e.target)) {\n handleOpenChange();\n }\n return;\n }\n setOpen(false);\n onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(false);\n }, [trigger]);\n useEffect(() => {\n if (trigger === 'click') {\n document.addEventListener('click', onClick);\n return () => {\n