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

1 line
7.3 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 { SubMenu as RcSubMenu, useFullPath } from 'rc-menu';\nimport omit from \"rc-util/es/omit\";\nimport { useZIndex } from '../_util/hooks/useZIndex';\nimport { cloneElement } from '../_util/reactNode';\nimport MenuContext from './MenuContext';\nconst SubMenu = props => {\n var _a;\n const {\n popupClassName,\n icon,\n title,\n theme: customTheme\n } = props;\n const context = React.useContext(MenuContext);\n const {\n prefixCls,\n inlineCollapsed,\n theme: contextTheme\n } = context;\n const parentPath = useFullPath();\n let titleNode;\n if (!icon) {\n titleNode = inlineCollapsed && !parentPath.length && title && typeof title === 'string' ? ( /*#__PURE__*/React.createElement(\"div\", {\n className: `${prefixCls}-inline-collapsed-noicon`\n }, title.charAt(0))) : ( /*#__PURE__*/React.createElement(\"span\", {\n className: `${prefixCls}-title-content`\n }, title));\n } else {\n // inline-collapsed.md demo 依赖 span 来隐藏文字,有 icon 属性,则内部包裹一个 span\n // ref: https://github.com/ant-design/ant-design/pull/23456\n const titleIsSpan = /*#__PURE__*/React.isValidElement(title) && title.type === 'span';\n titleNode = /*#__PURE__*/React.createElement(React.Fragment, null, cloneElement(icon, {\n className: classNames( /*#__PURE__*/React.isValidElement(icon) ? (_a = icon.props) === null || _a === void 0 ? void 0 : _a.className : '', `${prefixCls}-item-icon`)\n }), titleIsSpan ? title : /*#__PURE__*/React.createElement(\"span\", {\n className: `${prefixCls}-title-content`\n }, title));\n }\n const contextValue = React.useMemo(() => Object.assign(Object.assign({}, context), {\n firstLevel: false\n }), [context]);\n // ============================ zIndex ============================\n const [zIndex] = useZIndex('Menu');\n return /*#__PURE__*/React.createElement(MenuContext.Provider, {\n value: contextValue\n }, /*#__PURE__*/React.createElement(RcSubMenu, Object.assign({}, omit(props, ['icon']), {\n title: titleNode,\n popupClassName: classNames(prefixCls, popupClassName, `${prefixCls}-${customTheme || contextTheme}`),\n popupStyle: {\n zIndex\n }\n })));\n};\nexport default SubMenu;","map":{"version":3,"names":["React","classNames","SubMenu","RcSubMenu","useFullPath","omit","useZIndex","cloneElement","MenuContext","props","_a","popupClassName","icon","title","theme","customTheme","context","useContext","prefixCls","inlineCollapsed","contextTheme","parentPath","titleNode","length","createElement","className","charAt","titleIsSpan","isValidElement","type","Fragment","contextValue","useMemo","Object","assign","firstLevel","zIndex","Provider","value","popupStyle"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/antd/es/menu/SubMenu.js"],"sourcesContent":["\"use client\";\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { SubMenu as RcSubMenu, useFullPath } from 'rc-menu';\nimport omit from \"rc-util/es/omit\";\nimport { useZIndex } from '../_util/hooks/useZIndex';\nimport { cloneElement } from '../_util/reactNode';\nimport MenuContext from './MenuContext';\nconst SubMenu = props => {\n var _a;\n const {\n popupClassName,\n icon,\n title,\n theme: customTheme\n } = props;\n const context = React.useContext(MenuContext);\n const {\n prefixCls,\n inlineCollapsed,\n theme: contextTheme\n } = context;\n const parentPath = useFullPath();\n let titleNode;\n if (!icon) {\n titleNode = inlineCollapsed && !parentPath.length && title && typeof title === 'string' ? ( /*#__PURE__*/React.createElement(\"div\", {\n className: `${prefixCls}-inline-collapsed-noicon`\n }, title.charAt(0))) : ( /*#__PURE__*/React.createElement(\"span\", {\n className: `${prefixCls}-title-content`\n }, title));\n } else {\n // inline-collapsed.md demo 依赖 span 来隐藏文字,有 icon 属性,则内部包裹一个 span\n