PromoCursed/node_modules/.cache/babel-loader/13802eb25f2739f0417ad423f65b7b1accb2d8babb92a3a5a69bf5b1c433dff8.json

1 line
23 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, { useContext } from 'react';\nimport classNames from 'classnames';\nimport { NotificationProvider, useNotification as useRcNotification } from 'rc-notification';\nimport { devUseWarning } from '../_util/warning';\nimport { ConfigContext } from '../config-provider';\nimport useCSSVarCls from '../config-provider/hooks/useCSSVarCls';\nimport { useToken } from '../theme/internal';\nimport { getCloseIcon, PureContent } from './PurePanel';\nimport useStyle from './style';\nimport { getMotion, getPlacementStyle } from './util';\nconst DEFAULT_OFFSET = 24;\nconst DEFAULT_DURATION = 4.5;\nconst DEFAULT_PLACEMENT = 'topRight';\nconst Wrapper = _ref => {\n let {\n children,\n prefixCls\n } = _ref;\n const rootCls = useCSSVarCls(prefixCls);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls, rootCls);\n return wrapCSSVar( /*#__PURE__*/React.createElement(NotificationProvider, {\n classNames: {\n list: classNames(hashId, cssVarCls, rootCls)\n }\n }, children));\n};\nconst renderNotifications = (node, _ref2) => {\n let {\n prefixCls,\n key\n } = _ref2;\n return /*#__PURE__*/React.createElement(Wrapper, {\n prefixCls: prefixCls,\n key: key\n }, node);\n};\nconst Holder = /*#__PURE__*/React.forwardRef((props, ref) => {\n const {\n top,\n bottom,\n prefixCls: staticPrefixCls,\n getContainer: staticGetContainer,\n maxCount,\n rtl,\n onAllRemoved,\n stack,\n duration,\n pauseOnHover = true,\n showProgress\n } = props;\n const {\n getPrefixCls,\n getPopupContainer,\n notification,\n direction\n } = useContext(ConfigContext);\n const [, token] = useToken();\n const prefixCls = staticPrefixCls || getPrefixCls('notification');\n // =============================== Style ===============================\n const getStyle = placement => getPlacementStyle(placement, top !== null && top !== void 0 ? top : DEFAULT_OFFSET, bottom !== null && bottom !== void 0 ? bottom : DEFAULT_OFFSET);\n const getClassName = () => classNames({\n [`${prefixCls}-rtl`]: rtl !== null && rtl !== void 0 ? rtl : direction === 'rtl'\n });\n // ============================== Motion ===============================\n const getNotificationMotion = () => getMotion(prefixCls);\n // ============================== Origin ===============================\n const [api, holder] = useRcNotification({\n prefixCls,\n style: getStyle,\n className: getClassName,\n motion: getNotificationMotion,\n closable: true,\n closeIcon: getCloseIcon(prefixCls),\n duration: duration !== null && duration !== void 0 ? duration : DEFAULT_DURATION,\n getContainer: () => (staticGetContainer === null || staticGetContainer === void 0 ? void 0 : staticGetContainer()) || (getPopupContainer === null || getPopupContainer === void 0 ? void 0 : getPopupContainer()) || document.body,\n maxCount,\n pauseOnHover,\n showProgress,\n onAllRemoved,\n renderNotifications,\n stack: stack === false ? false : {\n threshold: typeof stack === 'object' ? stack === null || stack === void 0 ? void 0 : stack.threshold : undefined,\n offset: 8,\n gap: token.margin\n }\n });\n // ================================ Ref ================================\n React.useImperativeHandle(ref, () => Object.assign(Object.assign({}, api), {\n prefixCls,\n notification\n }));\n return holder;\n});\n// ==============================================================================\n// == Hook ==\n// ====================