@mage-ui/components 1.0.41 → 1.0.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/navigations/sidebars/sidebar/Sidebar.mjs +1 -1
- package/dist/components/navigations/sidebars/sidebar/Sidebar.mjs.map +1 -1
- package/dist/components/navigations/sidebars/sidebar/SidebarNavItemButtonCollapsed.mjs +1 -1
- package/dist/components/navigations/sidebars/sidebar/SidebarNavItemButtonCollapsed.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{ScrollAreaAutosize as e}from"../../../misc/scroll-area-autosize/ScrollAreaAutosize.mjs";import{SidebarProvider as t}from"./SidebarContext.mjs";import{NavList as n}from"./SidebarNavList.mjs";import{NavGroup as r}from"./SidebarNavGroup.mjs";import{NavItem as i}from"./SidebarNavItem.mjs";import{NavItemLink as a}from"./SidebarNavItemLink.mjs";import{SubNavItem as o}from"./SidebarSubNavItem.mjs";import{cx as s}from"@mage-ui/styled-system/css";import{sidebar as c,sidebarBottomSlot as l,sidebarNavRoot as u,sidebarRoot as d,sidebarScrollAreaAutosize as f,sidebarTopSlot as p}from"@mage-ui/styled-system/recipes";import{jsx as m,jsxs as h}from"react/jsx-runtime";const g=({area:r=`sidebar`,classNames:i,isCollapsed:a=!1,expandedItems:o,topSlot:g,bottomSlot:_,children:v})=>{let y=r===`sidebar`?void 0:{"--sidebar-grid-area":r};return m(t,{isCollapsed:a,expandedItems:o,children:h(`div`,{"data-collapsed":a?`true`:`false`,className:s(i?.sidebar??c(),i?.root??d(),`group`),style:y,children:[g?m(`div`,{className:i?.topSlot??p(),children:g}):null,m(`nav`,{className:i?.nav?.root??u(),children:m(e,{mah:`100%`,scrollbars:`y`,classNames:{scrollArea:i?.nav?.scrollArea??f()},children:m(n,{classNames:i,children:v})})}),_?m(`div`,{className:i?.bottomSlot??l(),children:_}):null]})})};g.displayName=`Sidebar`,g.Item=i,g.Group=r,g.ItemLink=a,g.SubNav=o;export{g as Sidebar};
|
|
1
|
+
import{ScrollAreaAutosize as e}from"../../../misc/scroll-area-autosize/ScrollAreaAutosize.mjs";import{SidebarProvider as t}from"./SidebarContext.mjs";import{NavList as n}from"./SidebarNavList.mjs";import{NavGroup as r}from"./SidebarNavGroup.mjs";import{NavItem as i}from"./SidebarNavItem.mjs";import{NavItemLink as a}from"./SidebarNavItemLink.mjs";import{SubNavItem as o}from"./SidebarSubNavItem.mjs";import{cx as s}from"@mage-ui/styled-system/css";import{sidebar as c,sidebarBottomSlot as l,sidebarNavRoot as u,sidebarRoot as d,sidebarScrollAreaAutosize as f,sidebarTopSlot as p}from"@mage-ui/styled-system/recipes";import{jsx as m,jsxs as h}from"react/jsx-runtime";const g=({area:r=`sidebar`,classNames:i,isCollapsed:a=!1,expandedItems:o,topSlot:g,bottomSlot:_,children:v})=>{let y=r===`sidebar`?void 0:{"--sidebar-grid-area":r};return m(t,{isCollapsed:a,expandedItems:o,children:h(`div`,{"data-collapsed":a?`true`:`false`,className:s(i?.sidebar??c(),i?.root??d(),`group`),style:y,children:[g?m(`div`,{className:i?.topSlot??p(),children:g}):null,m(`nav`,{className:i?.nav?.root??u(),children:m(e,{mah:`100%`,scrollbars:`y`,type:`hover`,classNames:{scrollArea:i?.nav?.scrollArea??f()},children:m(n,{classNames:i,children:v})})}),_?m(`div`,{className:i?.bottomSlot??l(),children:_}):null]})})};g.displayName=`Sidebar`,g.Item=i,g.Group=r,g.ItemLink=a,g.SubNav=o;export{g as Sidebar};
|
|
2
2
|
//# sourceMappingURL=Sidebar.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sidebar.mjs","names":[],"sources":["../../../../../src/components/navigations/sidebars/sidebar/Sidebar.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode } from 'react';\n\nimport { cx } from '@mage-ui/styled-system/css';\nimport {\n sidebar,\n sidebarBottomSlot,\n sidebarNavRoot,\n sidebarRoot,\n sidebarScrollAreaAutosize,\n sidebarTopSlot,\n} from '@mage-ui/styled-system/recipes';\n\nimport { ScrollAreaAutosize } from '../../../misc';\nimport { SidebarProvider } from './SidebarContext';\nimport { NavGroup } from './SidebarNavGroup';\nimport { NavItem } from './SidebarNavItem';\nimport { NavItemLink } from './SidebarNavItemLink';\nimport { NavList } from './SidebarNavList';\nimport { SubNavItem } from './SidebarSubNavItem';\n\nexport type SidebarClassNames = {\n sidebar?: string;\n root?: string;\n scrollArea?: string;\n topSlot?: string;\n bottomSlot?: string;\n nav?: {\n root?: string;\n list?: string;\n scrollArea?: string;\n };\n};\n\nexport type SidebarProps = {\n area?: string;\n topSlot?: ReactNode;\n bottomSlot?: ReactNode;\n classNames?: SidebarClassNames;\n isCollapsed: boolean;\n expandedItems?: string[];\n children?: ReactNode;\n};\n\nexport const Sidebar = ({\n area = 'sidebar',\n classNames,\n isCollapsed = false,\n expandedItems,\n topSlot,\n bottomSlot,\n children,\n}: SidebarProps): ReactNode => {\n const style =\n area !== 'sidebar'\n ? ({ '--sidebar-grid-area': area } as CSSProperties &\n Record<string, string>)\n : undefined;\n\n return (\n <SidebarProvider isCollapsed={isCollapsed} expandedItems={expandedItems}>\n <div\n data-collapsed={isCollapsed ? 'true' : 'false'}\n className={cx(\n classNames?.sidebar ?? sidebar(),\n classNames?.root ?? sidebarRoot(),\n 'group',\n )}\n style={style}\n >\n {topSlot ? (\n <div className={classNames?.topSlot ?? sidebarTopSlot()}>\n {topSlot}\n </div>\n ) : null}\n\n <nav className={classNames?.nav?.root ?? sidebarNavRoot()}>\n <ScrollAreaAutosize\n mah='100%'\n scrollbars='y'\n classNames={{\n scrollArea:\n classNames?.nav?.scrollArea ?? sidebarScrollAreaAutosize(),\n }}\n >\n <NavList classNames={classNames}>{children}</NavList>\n </ScrollAreaAutosize>\n </nav>\n\n {bottomSlot ? (\n <div className={classNames?.bottomSlot ?? sidebarBottomSlot()}>\n {bottomSlot}\n </div>\n ) : null}\n </div>\n </SidebarProvider>\n );\n};\n\nSidebar.displayName = 'Sidebar';\nSidebar.Item = NavItem;\nSidebar.Group = NavGroup;\nSidebar.ItemLink = NavItemLink;\nSidebar.SubNav = SubNavItem;\n"],"mappings":"2pBA2CA,MAAa,GAAW,CACtB,OAAO,UACP,aACA,cAAc,GACd,gBACA,UACA,aACA,cAC6B,CAC7B,IAAM,EACJ,IAAS,UAGL,IAAA,GAFC,CAAE,sBAAuB,EAAM,CAItC,OACE,EAAC,EAAA,CAA6B,cAA4B,yBACxD,EAAC,MAAA,CACC,iBAAgB,EAAc,OAAS,QACvC,UAAW,EACT,GAAY,SAAW,GAAS,CAChC,GAAY,MAAQ,GAAa,CACjC,QACD,CACM,kBAEN,EACC,EAAC,MAAA,CAAI,UAAW,GAAY,SAAW,GAAgB,UACpD,GACG,CACJ,KAEJ,EAAC,MAAA,CAAI,UAAW,GAAY,KAAK,MAAQ,GAAgB,UACvD,EAAC,EAAA,CACC,IAAI,OACJ,WAAW,IACX,WAAY,CACV,WACE,GAAY,KAAK,YAAc,GAA2B,CAC7D,UAED,EAAC,EAAA,CAAoB,aAAa,YAAmB,EAClC,EACjB,CAEL,EACC,EAAC,MAAA,CAAI,UAAW,GAAY,YAAc,GAAmB,UAC1D,GACG,CACJ,OACA,EACU,EAItB,EAAQ,YAAc,UACtB,EAAQ,KAAO,EACf,EAAQ,MAAQ,EAChB,EAAQ,SAAW,EACnB,EAAQ,OAAS"}
|
|
1
|
+
{"version":3,"file":"Sidebar.mjs","names":[],"sources":["../../../../../src/components/navigations/sidebars/sidebar/Sidebar.tsx"],"sourcesContent":["import type { CSSProperties, ReactNode } from 'react';\n\nimport { cx } from '@mage-ui/styled-system/css';\nimport {\n sidebar,\n sidebarBottomSlot,\n sidebarNavRoot,\n sidebarRoot,\n sidebarScrollAreaAutosize,\n sidebarTopSlot,\n} from '@mage-ui/styled-system/recipes';\n\nimport { ScrollAreaAutosize } from '../../../misc';\nimport { SidebarProvider } from './SidebarContext';\nimport { NavGroup } from './SidebarNavGroup';\nimport { NavItem } from './SidebarNavItem';\nimport { NavItemLink } from './SidebarNavItemLink';\nimport { NavList } from './SidebarNavList';\nimport { SubNavItem } from './SidebarSubNavItem';\n\nexport type SidebarClassNames = {\n sidebar?: string;\n root?: string;\n scrollArea?: string;\n topSlot?: string;\n bottomSlot?: string;\n nav?: {\n root?: string;\n list?: string;\n scrollArea?: string;\n };\n};\n\nexport type SidebarProps = {\n area?: string;\n topSlot?: ReactNode;\n bottomSlot?: ReactNode;\n classNames?: SidebarClassNames;\n isCollapsed: boolean;\n expandedItems?: string[];\n children?: ReactNode;\n};\n\nexport const Sidebar = ({\n area = 'sidebar',\n classNames,\n isCollapsed = false,\n expandedItems,\n topSlot,\n bottomSlot,\n children,\n}: SidebarProps): ReactNode => {\n const style =\n area !== 'sidebar'\n ? ({ '--sidebar-grid-area': area } as CSSProperties &\n Record<string, string>)\n : undefined;\n\n return (\n <SidebarProvider isCollapsed={isCollapsed} expandedItems={expandedItems}>\n <div\n data-collapsed={isCollapsed ? 'true' : 'false'}\n className={cx(\n classNames?.sidebar ?? sidebar(),\n classNames?.root ?? sidebarRoot(),\n 'group',\n )}\n style={style}\n >\n {topSlot ? (\n <div className={classNames?.topSlot ?? sidebarTopSlot()}>\n {topSlot}\n </div>\n ) : null}\n\n <nav className={classNames?.nav?.root ?? sidebarNavRoot()}>\n <ScrollAreaAutosize\n mah='100%'\n scrollbars='y'\n type='hover'\n classNames={{\n scrollArea:\n classNames?.nav?.scrollArea ?? sidebarScrollAreaAutosize(),\n }}\n >\n <NavList classNames={classNames}>{children}</NavList>\n </ScrollAreaAutosize>\n </nav>\n\n {bottomSlot ? (\n <div className={classNames?.bottomSlot ?? sidebarBottomSlot()}>\n {bottomSlot}\n </div>\n ) : null}\n </div>\n </SidebarProvider>\n );\n};\n\nSidebar.displayName = 'Sidebar';\nSidebar.Item = NavItem;\nSidebar.Group = NavGroup;\nSidebar.ItemLink = NavItemLink;\nSidebar.SubNav = SubNavItem;\n"],"mappings":"2pBA2CA,MAAa,GAAW,CACtB,OAAO,UACP,aACA,cAAc,GACd,gBACA,UACA,aACA,cAC6B,CAC7B,IAAM,EACJ,IAAS,UAGL,IAAA,GAFC,CAAE,sBAAuB,EAAM,CAItC,OACE,EAAC,EAAA,CAA6B,cAA4B,yBACxD,EAAC,MAAA,CACC,iBAAgB,EAAc,OAAS,QACvC,UAAW,EACT,GAAY,SAAW,GAAS,CAChC,GAAY,MAAQ,GAAa,CACjC,QACD,CACM,kBAEN,EACC,EAAC,MAAA,CAAI,UAAW,GAAY,SAAW,GAAgB,UACpD,GACG,CACJ,KAEJ,EAAC,MAAA,CAAI,UAAW,GAAY,KAAK,MAAQ,GAAgB,UACvD,EAAC,EAAA,CACC,IAAI,OACJ,WAAW,IACX,KAAK,QACL,WAAY,CACV,WACE,GAAY,KAAK,YAAc,GAA2B,CAC7D,UAED,EAAC,EAAA,CAAoB,aAAa,YAAmB,EAClC,EACjB,CAEL,EACC,EAAC,MAAA,CAAI,UAAW,GAAY,YAAc,GAAmB,UAC1D,GACG,CACJ,OACA,EACU,EAItB,EAAQ,YAAc,UACtB,EAAQ,KAAO,EACf,EAAQ,MAAQ,EAChB,EAAQ,SAAW,EACnB,EAAQ,OAAS"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{Menu as e}from"../../menu/Menu.mjs";import{MenuModeProvider as t,useSidebarContext as
|
|
1
|
+
"use client";import{Menu as e}from"../../menu/Menu.mjs";import{MenuModeProvider as t,SubnavDepthProvider as n,useSidebarContext as r,useSubnavDepth as i}from"./SidebarContext.mjs";import{Tooltip as a}from"../../../overlays/tooltip/Tooltip.mjs";import{Subnav as o}from"./SidebarSubnav.mjs";import{cx as s}from"@mage-ui/styled-system/css";import{menuTargetButton as c,sidebar as l,sidebarNavItemButtonCollapsedRoot as u,sidebarNavItemButtonInner as d,sidebarNavItemButtonLabel as f,sidebarNavItemButtonSection as p,sidebarSubnavCollapsedRoot as m,sidebarSubnavItem as h,sidebarSubnavList as g}from"@mage-ui/styled-system/recipes";import{jsx as _}from"react/jsx-runtime";import{Children as v,isValidElement as y}from"react";const b=t=>!y(t)||t.type!==o?t:v.toArray(t.props.children).map((t,n)=>{let r=y(t)&&t.key!=null?t.key:n;return _(e.Item,{children:t},r)}),x=({itemId:o,label:v,startSlot:y,children:x,classNames:S})=>{let{toggleItem:C,isItemExpanded:w}=r(),T=i(),E=w(o);return _(a,{label:v,position:`right`,offset:4,withinPortal:!0,children:_(`span`,{children:_(e,{withinPortal:!0,opened:E,onOpenedChange:()=>C(o),target:v,classNames:{menu:S?.subnav?.list??g(),root:S?.subnav?.root??s(l(),m()),item:S?.subnav?.item??h(),target:{button:c(),root:S?.button?.root??u(),inner:S?.button?.inner??d(),label:S?.button?.label??f(),section:S?.button?.section??p()}},targetButtonProps:{type:`button`,"aria-expanded":E||void 0,"data-expanded":E||void 0,startSlot:y},position:`bottom-start`,children:_(n,{value:T+1,children:_(t,{value:!0,children:b(x)})})})})})};export{x as NavItemButtonCollapsed};
|
|
2
2
|
//# sourceMappingURL=SidebarNavItemButtonCollapsed.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SidebarNavItemButtonCollapsed.mjs","names":[],"sources":["../../../../../src/components/navigations/sidebars/sidebar/SidebarNavItemButtonCollapsed.tsx"],"sourcesContent":["'use client';\n\nimport {\n Children,\n isValidElement,\n type ReactElement,\n type ReactNode,\n} from 'react';\n\nimport { cx } from '@mage-ui/styled-system/css';\nimport {\n sidebar,\n sidebarNavItemButtonCollapsedRoot,\n sidebarNavItemButtonInner,\n sidebarNavItemButtonLabel,\n sidebarNavItemButtonSection,\n sidebarSubnavCollapsedRoot,\n sidebarSubnavItem,\n sidebarSubnavList,\n} from '@mage-ui/styled-system/recipes';\nimport { Tooltip } from '@/components/overlays';\n\nimport { Menu } from '../../menu/Menu';\nimport {
|
|
1
|
+
{"version":3,"file":"SidebarNavItemButtonCollapsed.mjs","names":[],"sources":["../../../../../src/components/navigations/sidebars/sidebar/SidebarNavItemButtonCollapsed.tsx"],"sourcesContent":["'use client';\n\nimport {\n Children,\n isValidElement,\n type ReactElement,\n type ReactNode,\n} from 'react';\n\nimport { cx } from '@mage-ui/styled-system/css';\nimport {\n menuTargetButton,\n sidebar,\n sidebarNavItemButtonCollapsedRoot,\n sidebarNavItemButtonInner,\n sidebarNavItemButtonLabel,\n sidebarNavItemButtonSection,\n sidebarSubnavCollapsedRoot,\n sidebarSubnavItem,\n sidebarSubnavList,\n} from '@mage-ui/styled-system/recipes';\nimport { Tooltip } from '@/components/overlays';\n\nimport { Menu } from '../../menu/Menu';\nimport {\n MenuModeProvider,\n SubnavDepthProvider,\n useSidebarContext,\n useSubnavDepth,\n} from './SidebarContext';\nimport { Subnav } from './SidebarSubnav';\n\ntype ElementWithChildren = ReactElement<{ children?: ReactNode }>;\n\nconst toMenuItems = (subnav: ReactNode): ReactNode => {\n if (!isValidElement(subnav) || subnav.type !== Subnav) {\n return subnav;\n }\n\n return Children.toArray((subnav as ElementWithChildren).props.children).map(\n (node, index) => {\n const key = isValidElement(node) && node.key != null ? node.key : index;\n\n return <Menu.Item key={key}>{node}</Menu.Item>;\n },\n );\n};\n\nexport type NavItemButtonCollapsedProps = {\n itemId: string;\n label?: ReactNode;\n startSlot: ReactNode;\n children?: ReactNode;\n classNames?: {\n button?: {\n root?: string;\n inner?: string;\n label?: string;\n section?: string;\n };\n subnav?: {\n root?: string;\n list?: string;\n item?: string;\n };\n };\n};\n\nexport const NavItemButtonCollapsed = ({\n itemId,\n label,\n startSlot,\n children,\n classNames,\n}: NavItemButtonCollapsedProps) => {\n const { toggleItem, isItemExpanded } = useSidebarContext();\n const depth = useSubnavDepth();\n const isExpanded = isItemExpanded(itemId);\n\n return (\n <Tooltip label={label} position='right' offset={4} withinPortal>\n <span>\n <Menu\n withinPortal\n opened={isExpanded}\n onOpenedChange={() => toggleItem(itemId)}\n target={label}\n classNames={{\n menu: classNames?.subnav?.list ?? sidebarSubnavList(),\n root:\n classNames?.subnav?.root ??\n cx(sidebar(), sidebarSubnavCollapsedRoot()),\n item: classNames?.subnav?.item ?? sidebarSubnavItem(),\n target: {\n button: menuTargetButton(),\n root:\n classNames?.button?.root ?? sidebarNavItemButtonCollapsedRoot(),\n inner: classNames?.button?.inner ?? sidebarNavItemButtonInner(),\n label: classNames?.button?.label ?? sidebarNavItemButtonLabel(),\n section:\n classNames?.button?.section ?? sidebarNavItemButtonSection(),\n },\n }}\n targetButtonProps={{\n type: 'button',\n 'aria-expanded': isExpanded || undefined,\n 'data-expanded': isExpanded || undefined,\n startSlot,\n }}\n position='bottom-start'\n >\n <SubnavDepthProvider value={depth + 1}>\n <MenuModeProvider value={true}>\n {toMenuItems(children)}\n </MenuModeProvider>\n </SubnavDepthProvider>\n </Menu>\n </span>\n </Tooltip>\n );\n};\n"],"mappings":"itBAkCA,MAAM,EAAe,GACf,CAAC,EAAe,EAAO,EAAI,EAAO,OAAS,EACtC,EAGF,EAAS,QAAS,EAA+B,MAAM,SAAS,CAAC,KACrE,EAAM,IAAU,CACf,IAAM,EAAM,EAAe,EAAK,EAAI,EAAK,KAAO,KAAO,EAAK,IAAM,EAElE,OAAO,EAAC,EAAK,KAAA,CAAA,SAAgB,EAAA,CAAN,EAAuB,EAEjD,CAuBU,GAA0B,CACrC,SACA,QACA,YACA,WACA,gBACiC,CACjC,GAAM,CAAE,aAAY,kBAAmB,GAAmB,CACpD,EAAQ,GAAgB,CACxB,EAAa,EAAe,EAAO,CAEzC,OACE,EAAC,EAAA,CAAe,QAAO,SAAS,QAAQ,OAAQ,EAAG,aAAA,YACjD,EAAC,OAAA,CAAA,SACC,EAAC,EAAA,CACC,aAAA,GACA,OAAQ,EACR,mBAAsB,EAAW,EAAO,CACxC,OAAQ,EACR,WAAY,CACV,KAAM,GAAY,QAAQ,MAAQ,GAAmB,CACrD,KACE,GAAY,QAAQ,MACpB,EAAG,GAAS,CAAE,GAA4B,CAAC,CAC7C,KAAM,GAAY,QAAQ,MAAQ,GAAmB,CACrD,OAAQ,CACN,OAAQ,GAAkB,CAC1B,KACE,GAAY,QAAQ,MAAQ,GAAmC,CACjE,MAAO,GAAY,QAAQ,OAAS,GAA2B,CAC/D,MAAO,GAAY,QAAQ,OAAS,GAA2B,CAC/D,QACE,GAAY,QAAQ,SAAW,GAA6B,CAC/D,CACF,CACD,kBAAmB,CACjB,KAAM,SACN,gBAAiB,GAAc,IAAA,GAC/B,gBAAiB,GAAc,IAAA,GAC/B,YACD,CACD,SAAS,wBAET,EAAC,EAAA,CAAoB,MAAO,EAAQ,WAClC,EAAC,EAAA,CAAiB,MAAO,YACtB,EAAY,EAAS,EACL,EACC,EACjB,CAAA,CACF,EACC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mage-ui/components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.43",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [],
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"rimraf": "^6.1.3",
|
|
26
26
|
"tsdown": "^0.20.3",
|
|
27
27
|
"typescript": "^5.9.3",
|
|
28
|
-
"@mage-ui/preset": "1.0.
|
|
28
|
+
"@mage-ui/preset": "1.0.43",
|
|
29
29
|
"@mage-ui/styled-system": "1.0.8"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|