PromoCursed/node_modules/.cache/babel-loader/76f8679a0621a222ebf00230bba888ef37497adbfa6cd608bac7d59a22eca3c4.json
2024-08-20 23:25:37 +04:00

1 line
9.1 KiB
JSON

{"ast":null,"code":"\"use client\";\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { Item } from 'rc-menu';\nimport toArray from \"rc-util/es/Children/toArray\";\nimport omit from \"rc-util/es/omit\";\nimport { cloneElement } from '../_util/reactNode';\nimport { SiderContext } from '../layout/Sider';\nimport Tooltip from '../tooltip';\nimport MenuContext from './MenuContext';\nconst MenuItem = props => {\n var _a;\n const {\n className,\n children,\n icon,\n title,\n danger\n } = props;\n const {\n prefixCls,\n firstLevel,\n direction,\n disableMenuItemTitleTooltip,\n inlineCollapsed: isInlineCollapsed\n } = React.useContext(MenuContext);\n const renderItemChildren = inlineCollapsed => {\n const wrapNode = /*#__PURE__*/React.createElement(\"span\", {\n className: `${prefixCls}-title-content`\n }, children);\n // inline-collapsed.md demo 依赖 span 来隐藏文字,有 icon 属性,则内部包裹一个 span\n // ref: https://github.com/ant-design/ant-design/pull/23456\n if (!icon || /*#__PURE__*/React.isValidElement(children) && children.type === 'span') {\n if (children && inlineCollapsed && firstLevel && typeof children === 'string') {\n return /*#__PURE__*/React.createElement(\"div\", {\n className: `${prefixCls}-inline-collapsed-noicon`\n }, children.charAt(0));\n }\n }\n return wrapNode;\n };\n const {\n siderCollapsed\n } = React.useContext(SiderContext);\n let tooltipTitle = title;\n if (typeof title === 'undefined') {\n tooltipTitle = firstLevel ? children : '';\n } else if (title === false) {\n tooltipTitle = '';\n }\n const tooltipProps = {\n title: tooltipTitle\n };\n if (!siderCollapsed && !isInlineCollapsed) {\n tooltipProps.title = null;\n // Reset `open` to fix control mode tooltip display not correct\n // ref: https://github.com/ant-design/ant-design/issues/16742\n tooltipProps.open = false;\n }\n const childrenLength = toArray(children).length;\n let returnNode = /*#__PURE__*/React.createElement(Item, Object.assign({}, omit(props, ['title', 'icon', 'danger']), {\n className: classNames({\n [`${prefixCls}-item-danger`]: danger,\n [`${prefixCls}-item-only-child`]: (icon ? childrenLength + 1 : childrenLength) === 1\n }, className),\n title: typeof title === 'string' ? title : undefined\n }), cloneElement(icon, {\n className: classNames( /*#__PURE__*/React.isValidElement(icon) ? (_a = icon.props) === null || _a === void 0 ? void 0 : _a.className : '', `${prefixCls}-item-icon`)\n }), renderItemChildren(isInlineCollapsed));\n if (!disableMenuItemTitleTooltip) {\n returnNode = /*#__PURE__*/React.createElement(Tooltip, Object.assign({}, tooltipProps, {\n placement: direction === 'rtl' ? 'left' : 'right',\n overlayClassName: `${prefixCls}-inline-collapsed-tooltip`\n }), returnNode);\n }\n return returnNode;\n};\nexport default MenuItem;","map":{"version":3,"names":["React","classNames","Item","toArray","omit","cloneElement","SiderContext","Tooltip","MenuContext","MenuItem","props","_a","className","children","icon","title","danger","prefixCls","firstLevel","direction","disableMenuItemTitleTooltip","inlineCollapsed","isInlineCollapsed","useContext","renderItemChildren","wrapNode","createElement","isValidElement","type","charAt","siderCollapsed","tooltipTitle","tooltipProps","open","childrenLength","length","returnNode","Object","assign","undefined","placement","overlayClassName"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/antd/es/menu/MenuItem.js"],"sourcesContent":["\"use client\";\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { Item } from 'rc-menu';\nimport toArray from \"rc-util/es/Children/toArray\";\nimport omit from \"rc-util/es/omit\";\nimport { cloneElement } from '../_util/reactNode';\nimport { SiderContext } from '../layout/Sider';\nimport Tooltip from '../tooltip';\nimport MenuContext from './MenuContext';\nconst MenuItem = props => {\n var _a;\n const {\n className,\n children,\n icon,\n title,\n danger\n } = props;\n const {\n prefixCls,\n firstLevel,\n direction,\n disableMenuItemTitleTooltip,\n inlineCollapsed: isInlineCollapsed\n } = React.useContext(MenuContext);\n const renderItemChildren = inlineCollapsed => {\n const wrapNode = /*#__PURE__*/React.createElement(\"span\", {\n className: `${prefixCls}-title-content`\n }, children);\n // inline-collapsed.md demo 依赖 span 来隐藏文字,有 icon 属性,则内部包裹一个 span\n // ref: https://github.com/ant-design/ant-design/pull/23456\n if (!icon || /*#__PURE__*/React.isValidElement(children) && children.type === 'span') {\n if (children && inlineCollapsed && firstLevel && typeof children === 'string') {\n return /*#__PURE__*/React.createElement(\"div\", {\n className: `${prefixCls}-inline-collapsed-noicon`\n }, children.charAt(0));\n }\n }\n return wrapNode;\n };\n const {\n siderCollapsed\n } = React.useContext(SiderContext);\n let tooltipTitle = title;\n if (typeof title === 'undefined') {\n tooltipTitle = firstLevel ? children : '';\n } else if (title === false) {\n tooltipTitle = '';\n }\n const tooltipProps = {\n title: tooltipTitle\n };\n if (!siderCollapsed && !isInlineCollapsed) {\n tooltipProps.title = null;\n // Reset `open` to fix control mode tooltip display not correct\n // ref: https://github.com/ant-design/ant-design/issues/16742\n tooltipProps.open = false;\n }\n const childrenLength = toArray(children).length;\n let returnNode = /*#__PURE__*/React.createElement(Item, Object.assign({}, omit(props, ['title', 'icon', 'danger']), {\n className: classNames({\n [`${prefixCls}-item-danger`]: danger,\n [`${prefixCls}-item-only-child`]: (icon ? childrenLength + 1 : childrenLength) === 1\n }, className),\n title: typeof title === 'string' ? title : undefined\n }), cloneElement(icon, {\n className: classNames( /*#__PURE__*/React.isValidElement(icon) ? (_a = icon.props) === null || _a === void 0 ? void 0 : _a.className : '', `${prefixCls}-item-icon`)\n }), renderItemChildren(isInlineCollapsed));\n if (!disableMenuItemTitleTooltip) {\n returnNode = /*#__PURE__*/React.createElement(Tooltip, Object.assign({}, tooltipProps, {\n placement: direction === 'rtl' ? 'left' : 'right',\n overlayClassName: `${prefixCls}-inline-collapsed-tooltip`\n }), returnNode);\n }\n return returnNode;\n};\nexport default MenuItem;"],"mappings":"AAAA,YAAY;;AAEZ,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,IAAI,QAAQ,SAAS;AAC9B,OAAOC,OAAO,MAAM,6BA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