@lobehub/ui
Version:
Lobe UI is an open-source UI component library for building AIGC web apps
1 lines • 2.57 kB
Source Map (JSON)
{"version":3,"file":"Menu.mjs","names":["Menu","AntdMenu"],"sources":["../../src/Menu/Menu.tsx"],"sourcesContent":["'use client';\n\nimport { Menu as AntdMenu, ConfigProvider } from 'antd';\nimport { cx, useTheme } from 'antd-style';\nimport { memo, useMemo } from 'react';\n\nimport { IconProvider } from '@/Icon';\nimport { mapItems } from '@/Menu/utils';\n\nimport { variants } from './style';\nimport type { MenuProps } from './type';\n\nconst Menu = memo<MenuProps>(\n ({\n compact,\n shadow,\n variant = 'borderless',\n className,\n selectable,\n iconProps,\n items,\n ref,\n ...rest\n }) => {\n const theme = useTheme();\n\n const antdItems = useMemo(() => items.map((item) => mapItems(item)), [items]);\n\n return (\n <ConfigProvider\n theme={{\n components: {\n Menu: {\n controlHeightLG: 36,\n iconMarginInlineEnd: 8,\n iconSize: 16,\n itemActiveBg: theme.isDarkMode ? theme.colorFillQuaternary : theme.colorFillSecondary,\n itemBorderRadius: theme.borderRadius,\n itemColor: theme.colorTextSecondary,\n itemHoverBg: theme.colorFillTertiary,\n itemMarginBlock: 4,\n itemMarginInline: 4,\n itemSelectedBg: theme.colorFillSecondary,\n },\n },\n }}\n >\n <IconProvider\n config={{\n size: 'small',\n ...iconProps,\n }}\n >\n <AntdMenu\n className={cx(variants({ compact, shadow, variant }), className)}\n inlineIndent={12}\n items={antdItems}\n mode=\"vertical\"\n ref={ref}\n selectable={selectable}\n {...rest}\n />\n </IconProvider>\n </ConfigProvider>\n );\n },\n);\n\nMenu.displayName = 'Menu';\n\nexport default Menu;\n"],"mappings":";;;;;;;;;;;AAYA,MAAMA,SAAO,MACV,EACC,SACA,QACA,UAAU,cACV,WACA,YACA,WACA,OACA,KACA,GAAG,WACC;CACJ,MAAM,QAAQ,UAAU;CAExB,MAAM,YAAY,cAAc,MAAM,KAAK,SAAS,SAAS,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC;AAE7E,QACE,oBAAC;EACC,OAAO,EACL,YAAY,EACV,MAAM;GACJ,iBAAiB;GACjB,qBAAqB;GACrB,UAAU;GACV,cAAc,MAAM,aAAa,MAAM,sBAAsB,MAAM;GACnE,kBAAkB,MAAM;GACxB,WAAW,MAAM;GACjB,aAAa,MAAM;GACnB,iBAAiB;GACjB,kBAAkB;GAClB,gBAAgB,MAAM;GACvB,EACF,EACF;YAED,oBAAC;GACC,QAAQ;IACN,MAAM;IACN,GAAG;IACJ;aAED,oBAACC;IACC,WAAW,GAAG,SAAS;KAAE;KAAS;KAAQ;KAAS,CAAC,EAAE,UAAU;IAChE,cAAc;IACd,OAAO;IACP,MAAK;IACA;IACO;IACZ,GAAI;KACJ;IACW;GACA;EAGtB;AAED,OAAK,cAAc;AAEnB,mBAAeD"}