PromoCursed/node_modules/.cache/babel-loader/4175f9433e8f5fb05ca079b5525f2f35e2e788203e07b2712377afe04a594c78.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 * as React from 'react';\nimport classNames from 'classnames';\nimport toArray from \"rc-util/es/Children/toArray\";\nimport { cloneElement } from '../_util/reactNode';\nimport { devUseWarning } from '../_util/warning';\nimport { ConfigContext } from '../config-provider';\nimport useCSSVarCls from '../config-provider/hooks/useCSSVarCls';\nimport Popover from '../popover';\nimport Avatar from './avatar';\nimport AvatarContext from './AvatarContext';\nimport useStyle from './style';\nconst AvatarContextProvider = props => {\n const {\n size,\n shape\n } = React.useContext(AvatarContext);\n const avatarContextValue = React.useMemo(() => ({\n size: props.size || size,\n shape: props.shape || shape\n }), [props.size, props.shape, size, shape]);\n return /*#__PURE__*/React.createElement(AvatarContext.Provider, {\n value: avatarContextValue\n }, props.children);\n};\nconst Group = props => {\n var _a, _b, _c;\n const {\n getPrefixCls,\n direction\n } = React.useContext(ConfigContext);\n const {\n prefixCls: customizePrefixCls,\n className,\n rootClassName,\n style,\n maxCount,\n maxStyle,\n size,\n shape,\n maxPopoverPlacement,\n maxPopoverTrigger,\n children,\n max\n } = props;\n if (process.env.NODE_ENV !== 'production') {\n const warning = devUseWarning('Avatar.Group');\n warning.deprecated(!maxCount, 'maxCount', 'max={{ count: number }}');\n warning.deprecated(!maxStyle, 'maxStyle', 'max={{ style: CSSProperties }}');\n warning.deprecated(!maxPopoverPlacement, 'maxPopoverPlacement', 'max={{ popover: PopoverProps }}');\n warning.deprecated(!maxPopoverTrigger, 'maxPopoverTrigger', 'max={{ popover: PopoverProps }}');\n }\n const prefixCls = getPrefixCls('avatar', customizePrefixCls);\n const groupPrefixCls = `${prefixCls}-group`;\n const rootCls = useCSSVarCls(prefixCls);\n const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls, rootCls);\n const cls = classNames(groupPrefixCls, {\n [`${groupPrefixCls}-rtl`]: direction === 'rtl'\n }, cssVarCls, rootCls, className, rootClassName, hashId);\n const childrenWithProps = toArray(children).map((child, index) => cloneElement(child, {\n key: `avatar-key-${index}`\n }));\n const mergeCount = (max === null || max === void 0 ? void 0 : max.count) || maxCount;\n const numOfChildren = childrenWithProps.length;\n if (mergeCount && mergeCount < numOfChildren) {\n const childrenShow = childrenWithProps.slice(0, mergeCount);\n const childrenHidden = childrenWithProps.slice(mergeCount, numOfChildren);\n const mergeStyle = (max === null || max === void 0 ? void 0 : max.style) || maxStyle;\n const mergePopoverTrigger = ((_a = max === null || max === void 0 ? void 0 : max.popover) === null || _a === void 0 ? void 0 : _a.trigger) || maxPopoverTrigger || 'hover';\n const mergePopoverPlacement = ((_b = max === null || max === void 0 ? void 0 : max.popover) === null || _b === void 0 ? void 0 : _b.placement) || maxPopoverPlacement || 'top';\n const mergeProps = Object.assign(Object.assign({\n content: childrenHidden\n }, max === null || max === void 0 ? void 0 : max.popover), {\n overlayClassName: classNames(`${groupPrefixCls}-popover`, (_c = max === null || max === void 0 ? void 0 : max.popover) === null || _c === void 0 ? void 0 : _c.overlayClassName),\n placement: mergePopoverPlacement,\n trigger: mergePopoverTrigger\n });\n childrenShow.push( /*#__PURE__*/React.createElement(Popover, Object.assign({\n key: \"avatar-popover-key\",\n destroyTooltipOnHide: true\n }, mergeProps), /*#__PURE__*/React.createElement(Avatar, {\n style: mergeStyle\n }, `+${numOfChildren - mergeCount}`)));\n return wrapCSSVar( /*#__PURE__*/React.createElement(AvatarContextProvider, {\n shape: shape,\n size: size\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: cls,\n style: style\n }, childrenShow)));\n }\n return wrapCSSVar( /*#__PURE__*/React.createElement(AvatarCon