@womp/kookie-ui 0.34.1 → 0.34.2
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/README.md +1 -1
- package/components.css +15 -4
- package/dist/cjs/components/_internal/pane-chrome.d.ts +1 -2
- package/dist/cjs/components/_internal/pane-chrome.d.ts.map +1 -1
- package/dist/cjs/components/_internal/pane-chrome.js.map +2 -2
- package/dist/cjs/components/_internal/shell-bottom.js +1 -1
- package/dist/cjs/components/_internal/shell-bottom.js.map +3 -3
- package/dist/cjs/components/_internal/shell-handles.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-handles.js +1 -1
- package/dist/cjs/components/_internal/shell-handles.js.map +3 -3
- package/dist/cjs/components/_internal/shell-inspector.js +1 -1
- package/dist/cjs/components/_internal/shell-inspector.js.map +3 -3
- package/dist/cjs/components/_internal/shell-resizable.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-resizable.js +1 -1
- package/dist/cjs/components/_internal/shell-resizable.js.map +3 -3
- package/dist/cjs/components/_internal/shell-resize.d.ts +2 -0
- package/dist/cjs/components/_internal/shell-resize.d.ts.map +1 -1
- package/dist/cjs/components/_internal/shell-resize.js.map +2 -2
- package/dist/cjs/components/_internal/shell-sidebar.js +1 -1
- package/dist/cjs/components/_internal/shell-sidebar.js.map +3 -3
- package/dist/cjs/components/avatar.d.ts.map +1 -1
- package/dist/cjs/components/avatar.js +1 -1
- package/dist/cjs/components/avatar.js.map +2 -2
- package/dist/cjs/components/button.js +1 -1
- package/dist/cjs/components/button.js.map +3 -3
- package/dist/cjs/components/chatbar.d.ts.map +1 -1
- package/dist/cjs/components/chatbar.js +1 -1
- package/dist/cjs/components/chatbar.js.map +3 -3
- package/dist/cjs/components/combobox.d.ts +16 -0
- package/dist/cjs/components/combobox.d.ts.map +1 -1
- package/dist/cjs/components/combobox.js +1 -1
- package/dist/cjs/components/combobox.js.map +2 -2
- package/dist/cjs/components/index.js +2 -2
- package/dist/cjs/components/index.js.map +3 -3
- package/dist/cjs/components/message-scroller.js +1 -1
- package/dist/cjs/components/message-scroller.js.map +3 -3
- package/dist/cjs/components/navbar.d.ts.map +1 -1
- package/dist/cjs/components/navbar.js +1 -1
- package/dist/cjs/components/navbar.js.map +3 -3
- package/dist/cjs/components/navigator.js +1 -1
- package/dist/cjs/components/navigator.js.map +3 -3
- package/dist/cjs/components/notice.js +1 -1
- package/dist/cjs/components/notice.js.map +3 -3
- package/dist/cjs/components/schemas/base-button.schema.d.ts +7 -0
- package/dist/cjs/components/schemas/base-button.schema.d.ts.map +1 -1
- package/dist/cjs/components/schemas/base-button.schema.js +1 -1
- package/dist/cjs/components/schemas/base-button.schema.js.map +2 -2
- package/dist/cjs/components/schemas/button.schema.d.ts +14 -0
- package/dist/cjs/components/schemas/button.schema.d.ts.map +1 -1
- package/dist/cjs/components/schemas/button.schema.js +1 -1
- package/dist/cjs/components/schemas/button.schema.js.map +2 -2
- package/dist/cjs/components/schemas/index.js +1 -1
- package/dist/cjs/components/schemas/index.js.map +2 -2
- package/dist/cjs/components/schemas/shell.schema.d.ts +7 -6
- package/dist/cjs/components/schemas/shell.schema.d.ts.map +1 -1
- package/dist/cjs/components/schemas/shell.schema.js +1 -1
- package/dist/cjs/components/schemas/shell.schema.js.map +2 -2
- package/dist/cjs/components/schemas/toggle.schema.d.ts +83 -77
- package/dist/cjs/components/schemas/toggle.schema.d.ts.map +1 -1
- package/dist/cjs/components/schemas/toggle.schema.js +1 -1
- package/dist/cjs/components/schemas/toggle.schema.js.map +2 -2
- package/dist/cjs/components/segmented-control.d.ts.map +1 -1
- package/dist/cjs/components/segmented-control.js +1 -1
- package/dist/cjs/components/segmented-control.js.map +3 -3
- package/dist/cjs/components/select.js +1 -1
- package/dist/cjs/components/select.js.map +2 -2
- package/dist/cjs/components/sheet.d.ts +2 -2
- package/dist/cjs/components/sheet.js.map +1 -1
- package/dist/cjs/components/shell.context.js.map +1 -1
- package/dist/cjs/components/shell.js +1 -1
- package/dist/cjs/components/shell.js.map +3 -3
- package/dist/cjs/components/sidebar.d.ts +1 -1
- package/dist/cjs/components/sidebar.d.ts.map +1 -1
- package/dist/cjs/components/sidebar.js +1 -1
- package/dist/cjs/components/sidebar.js.map +3 -3
- package/dist/cjs/components/table.d.ts.map +1 -1
- package/dist/cjs/components/table.js +1 -1
- package/dist/cjs/components/table.js.map +3 -3
- package/dist/cjs/components/toggle.js +1 -1
- package/dist/cjs/components/toggle.js.map +3 -3
- package/dist/cjs/components/toolbar.js +1 -1
- package/dist/cjs/components/toolbar.js.map +3 -3
- package/dist/cjs/components/virtual-menu.d.ts.map +1 -1
- package/dist/cjs/components/virtual-menu.js +1 -1
- package/dist/cjs/components/virtual-menu.js.map +3 -3
- package/dist/cjs/helpers/index.js +3 -3
- package/dist/cjs/helpers/index.js.map +2 -2
- package/dist/cjs/helpers/map-prop-values.d.ts.map +1 -1
- package/dist/cjs/helpers/map-prop-values.js +1 -1
- package/dist/cjs/helpers/map-prop-values.js.map +2 -2
- package/dist/cjs/index.js +4 -4
- package/dist/cjs/index.js.map +3 -3
- package/dist/cjs/props/index.d.ts +6 -0
- package/dist/cjs/props/index.d.ts.map +1 -1
- package/dist/cjs/props/index.js +1 -1
- package/dist/cjs/props/index.js.map +4 -4
- package/dist/esm/chunk-25FNCKUM.js +2 -0
- package/dist/esm/chunk-25FNCKUM.js.map +7 -0
- package/dist/esm/{chunk-KDJM4NQQ.js → chunk-2WFN4D52.js} +2 -2
- package/dist/esm/chunk-4OJRLS5N.js +3 -0
- package/dist/esm/chunk-4OJRLS5N.js.map +7 -0
- package/dist/esm/chunk-4TTRPCGG.js +3 -0
- package/dist/esm/{chunk-QKCNGEX4.js.map → chunk-4TTRPCGG.js.map} +3 -3
- package/dist/esm/chunk-4X64QOAR.js +3 -0
- package/dist/esm/chunk-4X64QOAR.js.map +7 -0
- package/dist/esm/{chunk-L7PRLW6A.js → chunk-5APRBJRR.js} +2 -2
- package/dist/esm/{chunk-L7PRLW6A.js.map → chunk-5APRBJRR.js.map} +2 -2
- package/dist/esm/chunk-7HD5LS3M.js +3 -0
- package/dist/esm/chunk-7HD5LS3M.js.map +7 -0
- package/dist/esm/chunk-7ZOGH5NT.js +2 -0
- package/dist/esm/chunk-7ZOGH5NT.js.map +7 -0
- package/dist/esm/chunk-BJA75XKG.js +2 -0
- package/dist/esm/chunk-BJA75XKG.js.map +7 -0
- package/dist/esm/{chunk-NO2JCJWI.js → chunk-BJVXB3PN.js} +2 -2
- package/dist/esm/{chunk-BR6Z2CAE.js → chunk-C6VGCYFQ.js} +2 -2
- package/dist/esm/chunk-EZYXYLR2.js +2 -0
- package/dist/esm/chunk-EZYXYLR2.js.map +7 -0
- package/dist/esm/chunk-FTNZWAPB.js +3 -0
- package/dist/esm/{chunk-7QBNXNEN.js.map → chunk-FTNZWAPB.js.map} +3 -3
- package/dist/esm/{chunk-ZLGOZKB3.js → chunk-FYZXC7AL.js} +2 -2
- package/dist/esm/{chunk-XD676L6S.js → chunk-HQT32HQ6.js} +2 -2
- package/dist/esm/{chunk-XKYPJTRN.js → chunk-I5TPDYJO.js} +2 -2
- package/dist/esm/chunk-I77CYEBT.js +2 -0
- package/dist/esm/chunk-I77CYEBT.js.map +7 -0
- package/dist/esm/{chunk-API4DAPY.js → chunk-J7MIXG6M.js} +1 -1
- package/dist/esm/chunk-J7MIXG6M.js.map +7 -0
- package/dist/esm/{chunk-UMQOTGJC.js → chunk-M26LLCQC.js} +2 -2
- package/dist/esm/{chunk-WN3WMFAM.js → chunk-MLHS2GWL.js} +2 -2
- package/dist/esm/chunk-MPLBIPJ6.js +3 -0
- package/dist/esm/chunk-MPLBIPJ6.js.map +7 -0
- package/dist/esm/{chunk-WEBNIUEX.js → chunk-MXEOE4LA.js} +1 -1
- package/dist/esm/chunk-MXEOE4LA.js.map +7 -0
- package/dist/esm/chunk-OGVKMDO7.js +3 -0
- package/dist/esm/chunk-OGVKMDO7.js.map +7 -0
- package/dist/esm/{chunk-ODHCDJ3Y.js → chunk-PMXIQ5B4.js} +1 -1
- package/dist/esm/chunk-PMXIQ5B4.js.map +7 -0
- package/dist/esm/{chunk-LG5DPQ46.js → chunk-R4DMVTM3.js} +2 -2
- package/dist/esm/{chunk-LG5DPQ46.js.map → chunk-R4DMVTM3.js.map} +3 -3
- package/dist/esm/chunk-S6SEWECR.js +3 -0
- package/dist/esm/{chunk-5VYQDA5S.js.map → chunk-S6SEWECR.js.map} +3 -3
- package/dist/esm/{chunk-7YXHLU4C.js → chunk-TANYRHGP.js} +2 -2
- package/dist/esm/{chunk-INGT6DB6.js → chunk-TS4QCDSI.js} +1 -1
- package/dist/esm/chunk-TS4QCDSI.js.map +7 -0
- package/dist/esm/chunk-WYLIU3Q6.js +2 -0
- package/dist/esm/chunk-WYLIU3Q6.js.map +7 -0
- package/dist/esm/chunk-X4PWBFOT.js +3 -0
- package/dist/esm/chunk-X4PWBFOT.js.map +7 -0
- package/dist/esm/chunk-XFMAA4MD.js +3 -0
- package/dist/esm/chunk-XFMAA4MD.js.map +7 -0
- package/dist/esm/chunk-XGV7KNSE.js +3 -0
- package/dist/esm/chunk-XGV7KNSE.js.map +7 -0
- package/dist/esm/chunk-XOAOSRTH.js +3 -0
- package/dist/esm/chunk-XOAOSRTH.js.map +7 -0
- package/dist/esm/{chunk-YOTTLPJ3.js → chunk-Y5ITMKC6.js} +2 -2
- package/dist/esm/chunk-YLPCYCYA.js +3 -0
- package/dist/esm/chunk-YLPCYCYA.js.map +7 -0
- package/dist/esm/components/_internal/pane-chrome.d.ts +1 -2
- package/dist/esm/components/_internal/pane-chrome.d.ts.map +1 -1
- package/dist/esm/components/_internal/pane-chrome.js +1 -1
- package/dist/esm/components/_internal/shell-bottom.js +1 -1
- package/dist/esm/components/_internal/shell-handles.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-handles.js +1 -1
- package/dist/esm/components/_internal/shell-inspector.js +1 -1
- package/dist/esm/components/_internal/shell-resizable.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-resizable.js +1 -1
- package/dist/esm/components/_internal/shell-resize.d.ts +2 -0
- package/dist/esm/components/_internal/shell-resize.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-resize.js +1 -1
- package/dist/esm/components/_internal/shell-sidebar.js +1 -1
- package/dist/esm/components/accordion.props.js +1 -1
- package/dist/esm/components/accordion.props.js.map +4 -4
- package/dist/esm/components/avatar.d.ts.map +1 -1
- package/dist/esm/components/avatar.js +1 -1
- package/dist/esm/components/button.js +1 -1
- package/dist/esm/components/chatbar.d.ts.map +1 -1
- package/dist/esm/components/chatbar.js +1 -1
- package/dist/esm/components/combobox.d.ts +16 -0
- package/dist/esm/components/combobox.d.ts.map +1 -1
- package/dist/esm/components/combobox.js +1 -1
- package/dist/esm/components/combobox.props.js +1 -1
- package/dist/esm/components/combobox.props.js.map +4 -4
- package/dist/esm/components/image.props.js +1 -1
- package/dist/esm/components/image.props.js.map +4 -4
- package/dist/esm/components/index.js +1 -1
- package/dist/esm/components/message-scroller.js +1 -1
- package/dist/esm/components/navbar.d.ts.map +1 -1
- package/dist/esm/components/navbar.js +1 -1
- package/dist/esm/components/navbar.props.js +1 -1
- package/dist/esm/components/navbar.props.js.map +4 -4
- package/dist/esm/components/navigator.js +1 -1
- package/dist/esm/components/notice.js +1 -1
- package/dist/esm/components/schemas/base-button.schema.d.ts +7 -0
- package/dist/esm/components/schemas/base-button.schema.d.ts.map +1 -1
- package/dist/esm/components/schemas/base-button.schema.js +1 -1
- package/dist/esm/components/schemas/button.schema.d.ts +14 -0
- package/dist/esm/components/schemas/button.schema.d.ts.map +1 -1
- package/dist/esm/components/schemas/button.schema.js +1 -1
- package/dist/esm/components/schemas/index.js +1 -1
- package/dist/esm/components/schemas/shell.schema.d.ts +7 -6
- package/dist/esm/components/schemas/shell.schema.d.ts.map +1 -1
- package/dist/esm/components/schemas/shell.schema.js +1 -1
- package/dist/esm/components/schemas/toggle.schema.d.ts +83 -77
- package/dist/esm/components/schemas/toggle.schema.d.ts.map +1 -1
- package/dist/esm/components/schemas/toggle.schema.js +1 -1
- package/dist/esm/components/segmented-control.d.ts.map +1 -1
- package/dist/esm/components/segmented-control.js +1 -1
- package/dist/esm/components/select.js +1 -1
- package/dist/esm/components/sheet.d.ts +2 -2
- package/dist/esm/components/sheet.js +1 -1
- package/dist/esm/components/shell.context.js +1 -1
- package/dist/esm/components/shell.js +1 -1
- package/dist/esm/components/sidebar.d.ts +1 -1
- package/dist/esm/components/sidebar.d.ts.map +1 -1
- package/dist/esm/components/sidebar.js +1 -1
- package/dist/esm/components/table.d.ts.map +1 -1
- package/dist/esm/components/table.js +1 -1
- package/dist/esm/components/toggle.js +1 -1
- package/dist/esm/components/toolbar.js +1 -1
- package/dist/esm/components/toolbar.props.js +1 -1
- package/dist/esm/components/toolbar.props.js.map +4 -4
- package/dist/esm/components/virtual-menu.d.ts.map +1 -1
- package/dist/esm/components/virtual-menu.js +1 -1
- package/dist/esm/helpers/index.js +1 -1
- package/dist/esm/helpers/map-prop-values.d.ts.map +1 -1
- package/dist/esm/helpers/map-prop-values.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/props/index.d.ts +6 -0
- package/dist/esm/props/index.d.ts.map +1 -1
- package/dist/esm/props/index.js +1 -1
- package/layout/utilities.css +810 -0
- package/layout.css +810 -0
- package/package.json +3 -4
- package/schemas/base-button.json +13 -0
- package/schemas/button.json +13 -0
- package/schemas/index.json +51 -12
- package/schemas/shell-bottom.json +2 -2
- package/schemas/shell-content.json +2 -2
- package/schemas/shell-header.json +4 -0
- package/schemas/shell-inspector.json +2 -2
- package/schemas/shell-panel.json +2 -2
- package/schemas/shell-rail.json +2 -2
- package/schemas/shell-sidebar.json +2 -2
- package/schemas/toggle.json +9 -0
- package/src/components/_internal/base-dialog.css +1 -1
- package/src/components/_internal/pane-chrome.tsx +2 -3
- package/src/components/_internal/shell-handles.tsx +3 -0
- package/src/components/_internal/shell-resizable.tsx +9 -0
- package/src/components/_internal/shell-resize.tsx +2 -0
- package/src/components/avatar.tsx +3 -1
- package/src/components/button.tsx +1 -1
- package/src/components/chatbar.tsx +2 -1
- package/src/components/combobox.tsx +2 -3
- package/src/components/navbar.tsx +3 -4
- package/src/components/navigator.css +4 -4
- package/src/components/schemas/base-button.schema.ts +7 -0
- package/src/components/schemas/shell.schema.ts +3 -2
- package/src/components/schemas/toggle.schema.ts +2 -1
- package/src/components/segmented-control.css +13 -0
- package/src/components/segmented-control.tsx +10 -2
- package/src/components/select.tsx +2 -2
- package/src/components/sheet.tsx +2 -2
- package/src/components/shell.context.tsx +1 -1
- package/src/components/sidebar.tsx +1 -1
- package/src/components/table.tsx +4 -1
- package/src/components/text-field.css +2 -2
- package/src/components/virtual-menu.tsx +8 -1
- package/src/helpers/map-prop-values.ts +0 -1
- package/src/props/index.ts +6 -0
- package/src/styles/utilities/inset.css +135 -0
- package/styles.css +825 -4
- package/utilities.css +810 -0
- package/dist/esm/chunk-3QWGSRYC.js +0 -3
- package/dist/esm/chunk-3QWGSRYC.js.map +0 -7
- package/dist/esm/chunk-5KQCG7AV.js +0 -3
- package/dist/esm/chunk-5KQCG7AV.js.map +0 -7
- package/dist/esm/chunk-5VYQDA5S.js +0 -3
- package/dist/esm/chunk-7QBNXNEN.js +0 -3
- package/dist/esm/chunk-API4DAPY.js.map +0 -7
- package/dist/esm/chunk-BQOFHLDP.js +0 -3
- package/dist/esm/chunk-BQOFHLDP.js.map +0 -7
- package/dist/esm/chunk-CZ24FOFS.js +0 -3
- package/dist/esm/chunk-CZ24FOFS.js.map +0 -7
- package/dist/esm/chunk-EERKYRYI.js +0 -3
- package/dist/esm/chunk-EERKYRYI.js.map +0 -7
- package/dist/esm/chunk-HZYE46V2.js +0 -2
- package/dist/esm/chunk-HZYE46V2.js.map +0 -7
- package/dist/esm/chunk-IN2WND4B.js +0 -3
- package/dist/esm/chunk-IN2WND4B.js.map +0 -7
- package/dist/esm/chunk-INGT6DB6.js.map +0 -7
- package/dist/esm/chunk-J6B7UCZN.js +0 -3
- package/dist/esm/chunk-J6B7UCZN.js.map +0 -7
- package/dist/esm/chunk-JQMWNI62.js +0 -3
- package/dist/esm/chunk-JQMWNI62.js.map +0 -7
- package/dist/esm/chunk-ODHCDJ3Y.js.map +0 -7
- package/dist/esm/chunk-QKCNGEX4.js +0 -3
- package/dist/esm/chunk-TMINGBSQ.js +0 -3
- package/dist/esm/chunk-TMINGBSQ.js.map +0 -7
- package/dist/esm/chunk-WEBNIUEX.js.map +0 -7
- package/dist/esm/chunk-XF6Z5NKE.js +0 -3
- package/dist/esm/chunk-XF6Z5NKE.js.map +0 -7
- /package/dist/esm/{chunk-KDJM4NQQ.js.map → chunk-2WFN4D52.js.map} +0 -0
- /package/dist/esm/{chunk-NO2JCJWI.js.map → chunk-BJVXB3PN.js.map} +0 -0
- /package/dist/esm/{chunk-BR6Z2CAE.js.map → chunk-C6VGCYFQ.js.map} +0 -0
- /package/dist/esm/{chunk-ZLGOZKB3.js.map → chunk-FYZXC7AL.js.map} +0 -0
- /package/dist/esm/{chunk-XD676L6S.js.map → chunk-HQT32HQ6.js.map} +0 -0
- /package/dist/esm/{chunk-XKYPJTRN.js.map → chunk-I5TPDYJO.js.map} +0 -0
- /package/dist/esm/{chunk-UMQOTGJC.js.map → chunk-M26LLCQC.js.map} +0 -0
- /package/dist/esm/{chunk-WN3WMFAM.js.map → chunk-MLHS2GWL.js.map} +0 -0
- /package/dist/esm/{chunk-7YXHLU4C.js.map → chunk-TANYRHGP.js.map} +0 -0
- /package/dist/esm/{chunk-YOTTLPJ3.js.map → chunk-Y5ITMKC6.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/components/virtual-menu.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { useVirtualizer } from '@tanstack/react-virtual';\nimport { useLayoutEffect } from 'radix-ui/internal';\nimport { useMenuContext, useMenuClose, getMenuItemHeight } from './_internal/menu-context.js';\n\nimport type { MenuSize } from './_internal/menu-context.js';\n\n/**\n * VirtualMenu - A virtualized menu component for rendering large lists efficiently.\n *\n * Uses TanStack Virtual to render only visible items.\n * Works inside any container (DropdownMenu.Content, Popover.Content, etc.)\n *\n * @example\n * // Simple usage with itemLabel\n * <VirtualMenu\n * items={items}\n * itemLabel={(item) => item.name}\n * onSelect={handleSelect}\n * />\n *\n * @example\n * // Custom rendering with renderItem\n * const UserItem = React.memo(({ item, ...props }) => (\n * <VirtualMenu.Item {...props}>\n * <Avatar src={item.avatar} />\n * {item.name}\n * </VirtualMenu.Item>\n * ));\n *\n * <VirtualMenu items={users} renderItem={UserItem} onSelect={handleSelect} />\n */\n\n// ============================================================================\n// Types\n// ============================================================================\n\n/** Props passed to custom renderItem components */\ninterface VirtualMenuRenderItemProps<T> {\n /** The item data */\n item: T;\n /** Index in the items array */\n index: number;\n /** Whether this item is currently highlighted */\n isHighlighted: boolean;\n /** Unique ID for accessibility */\n id: string;\n /** Positioning styles - must be applied */\n style: React.CSSProperties;\n /** Tab index for focus management */\n tabIndex: number;\n /** Data attribute for CSS styling */\n 'data-highlighted': true | undefined;\n /** Data attribute for event delegation */\n 'data-index': number;\n /** Number of items in the whole list, since only some rows are mounted */\n 'aria-setsize': number;\n /** Position of this row in the whole list, from 1 */\n 'aria-posinset': number;\n /** Mouse enter handler */\n onMouseEnter: (e: React.MouseEvent<HTMLElement>) => void;\n /** Mouse leave handler */\n onMouseLeave: (e: React.MouseEvent<HTMLElement>) => void;\n /** Click handler */\n onClick: (e: React.MouseEvent<HTMLElement>) => void;\n /** Keyboard handler for Enter/Space activation */\n onKeyDown: (e: React.KeyboardEvent<HTMLElement>) => void;\n}\n\n/** How rows are drawn: one of `itemLabel` or `renderItem` is required. */\ntype VirtualMenuRowProps<T> =\n | {\n /**\n * Simple label accessor for basic text items.\n * Can be a property key or a function.\n * @example\n * itemLabel=\"name\"\n * itemLabel={(item) => item.name}\n */\n itemLabel: keyof T | ((item: T) => React.ReactNode);\n renderItem?: undefined;\n }\n | {\n itemLabel?: undefined;\n /**\n * Custom component for rendering items.\n * Must be memoized (React.memo) for optimal performance.\n * @example\n * const MyItem = React.memo(({ item, ...props }) => (\n * <VirtualMenu.Item {...props}>{item.name}</VirtualMenu.Item>\n * ));\n * <VirtualMenu items={items} renderItem={MyItem} />\n */\n renderItem: React.ComponentType<VirtualMenuRenderItemProps<T>>;\n };\n\n/** Attributes of the list element that pass through, such as `id`, `aria-labelledby` or `data-*`. */\ntype VirtualMenuDivProps = Omit<\n React.ComponentPropsWithoutRef<'div'>,\n 'children' | 'onSelect' | 'role' | 'tabIndex' | 'aria-activedescendant'\n>;\n\ntype VirtualMenuProps<T> = VirtualMenuDivProps & VirtualMenuRowProps<T> & VirtualMenuOwnProps<T>;\n\ninterface VirtualMenuOwnProps<T> {\n /** Array of items to render */\n items: T[];\n /**\n * Menu size - controls item height.\n * Automatically inherited from parent DropdownMenu.Content/ContextMenu.Content.\n * Only set manually when using VirtualMenu outside of a menu context.\n * @default '2' (or inherited from context)\n */\n size?: MenuSize;\n /**\n * Estimated height of each item in pixels.\n * Can be a number (same for all) or a function (per-item).\n * Usually not needed - height is automatically derived from size prop/context.\n * Use this only for custom item heights (e.g., variable height items).\n */\n estimatedItemSize?: number | ((index: number) => number);\n /** Number of items to render outside visible area */\n overscan?: number;\n /** Callback when an item is selected */\n onSelect?: (item: T, index: number) => void;\n}\n\n// ============================================================================\n// Internal Memoized Item Component\n// ============================================================================\n\n/**\n * Rows get a new style object every render, so style is compared by the two values the\n * list sets. Every other prop is compared shallowly, so aria-*, data-* and handlers update.\n */\nfunction areRowPropsEqual<P extends { style?: React.CSSProperties }>(prev: P, next: P) {\n if (prev.style?.height !== next.style?.height) return false;\n if (prev.style?.transform !== next.style?.transform) return false;\n const prevKeys = Object.keys(prev) as (keyof P)[];\n if (prevKeys.length !== Object.keys(next).length) return false;\n return prevKeys.every((key) => key === 'style' || Object.is(prev[key], next[key]));\n}\n\ninterface SimpleItemProps {\n label: React.ReactNode;\n isHighlighted: boolean;\n id: string;\n style: React.CSSProperties;\n tabIndex: number;\n 'data-highlighted': true | undefined;\n 'data-index': number;\n 'aria-setsize': number;\n 'aria-posinset': number;\n onMouseEnter: (e: React.MouseEvent<HTMLElement>) => void;\n onMouseLeave: (e: React.MouseEvent<HTMLElement>) => void;\n onClick: (e: React.MouseEvent<HTMLElement>) => void;\n onKeyDown: (e: React.KeyboardEvent<HTMLElement>) => void;\n}\n\nconst SimpleItem = React.memo(\n function SimpleItem({\n label,\n isHighlighted: _isHighlighted,\n id,\n style,\n tabIndex,\n 'data-highlighted': dataHighlighted,\n 'data-index': dataIndex,\n 'aria-setsize': setSize,\n 'aria-posinset': posInSet,\n onMouseEnter,\n onMouseLeave,\n onClick,\n onKeyDown,\n }: SimpleItemProps) {\n return (\n <div\n id={id}\n role=\"menuitem\"\n className={classNames('kui-reset', 'kui-BaseMenuItem', 'kui-VirtualMenuItem')}\n style={style}\n tabIndex={tabIndex}\n data-highlighted={dataHighlighted}\n data-index={dataIndex}\n aria-setsize={setSize}\n aria-posinset={posInSet}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n onClick={onClick}\n onKeyDown={onKeyDown}\n >\n {label}\n </div>\n );\n },\n areRowPropsEqual,\n);\n\n// ============================================================================\n// VirtualMenu Component\n// ============================================================================\n\n/**\n * Measures the row height the menu's CSS draws (--base-menu-item-height), so rows follow\n * the theme scale instead of the fixed 100% table. Returns undefined until measured.\n */\nfunction useMeasuredRowHeight(\n rootRef: React.RefObject<HTMLDivElement | null>,\n enabled: boolean,\n size: MenuSize | undefined,\n) {\n const [height, setHeight] = React.useState<number | undefined>(undefined);\n useLayoutEffect(() => {\n const root = rootRef.current;\n if (!enabled || !root) return;\n const probe = document.createElement('div');\n probe.className = 'kui-reset kui-BaseMenuItem kui-VirtualMenuItem';\n probe.setAttribute('aria-hidden', 'true');\n probe.style.visibility = 'hidden';\n probe.textContent = '\\u00a0';\n root.appendChild(probe);\n const measured = probe.getBoundingClientRect().height;\n probe.remove();\n setHeight(measured > 0 ? measured : undefined);\n }, [rootRef, enabled, size]);\n return enabled ? height : undefined;\n}\n\nfunction VirtualMenuRootInner<T>(\n {\n items,\n itemLabel,\n renderItem: RenderItem,\n size: sizeProp,\n estimatedItemSize: estimatedItemSizeProp,\n overscan = 5,\n onSelect,\n className,\n style,\n onKeyDown,\n onFocus,\n ...rootProps\n }: VirtualMenuProps<T>,\n forwardedRef: React.ForwardedRef<HTMLDivElement>,\n) {\n const menuId = React.useId();\n const parentRef = React.useRef<HTMLDivElement>(null);\n const [highlightedIndex, setHighlightedIndex] = React.useState<number>(-1);\n const { isInsideMenu, size: contextSize, itemHeight: contextItemHeight } = useMenuContext();\n const closeMenu = useMenuClose();\n\n const setRootRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n parentRef.current = node;\n if (typeof forwardedRef === 'function') forwardedRef(node);\n else if (forwardedRef) forwardedRef.current = node;\n },\n [forwardedRef],\n );\n\n // Inside a menu, the CSS row height is measured so it tracks the theme scale.\n const measuredItemHeight = useMeasuredRowHeight(\n parentRef,\n isInsideMenu && sizeProp == null && estimatedItemSizeProp == null,\n contextSize,\n );\n\n // Resolve item height: explicit prop > own size > measured CSS row > parent menu > default size '2'.\n const estimatedItemSize =\n estimatedItemSizeProp ??\n (sizeProp\n ? getMenuItemHeight(sizeProp)\n : (measuredItemHeight ?? contextItemHeight ?? getMenuItemHeight(contextSize ?? '2')));\n\n // Validate props\n if (!itemLabel && !RenderItem) {\n throw new Error('VirtualMenu requires either itemLabel or renderItem prop');\n }\n\n // Normalize itemLabel to a function\n const getLabel = React.useMemo(() => {\n if (!itemLabel) return null;\n if (typeof itemLabel === 'function') return itemLabel;\n return (item: T) => item[itemLabel] as React.ReactNode;\n }, [itemLabel]);\n\n // Derive safe highlighted index\n const safeHighlightedIndex = React.useMemo(() => {\n if (items.length === 0) return -1;\n if (highlightedIndex < 0) return -1;\n return Math.min(highlightedIndex, items.length - 1);\n }, [highlightedIndex, items.length]);\n\n // Normalize estimatedItemSize to a function\n const getItemSize = React.useMemo(\n () =>\n typeof estimatedItemSize === 'function'\n ? estimatedItemSize\n : () => estimatedItemSize,\n [estimatedItemSize],\n );\n\n const virtualizer = useVirtualizer({\n count: items.length,\n getScrollElement: () => parentRef.current,\n estimateSize: getItemSize,\n overscan,\n });\n\n const virtualItems = virtualizer.getVirtualItems();\n\n // Re-measure cached rows when the resolved row height changes.\n useLayoutEffect(() => {\n virtualizer.measure();\n }, [virtualizer, estimatedItemSize]);\n\n // Inside a menu, the menu focuses its own content on open (and a submenu on keyboard\n // open). Hand that focus to the list so arrow keys reach the rows.\n React.useEffect(() => {\n const root = parentRef.current;\n if (!isInsideMenu || !root) return;\n const content = root.closest<HTMLElement>('[data-radix-menu-content]');\n if (!content) return;\n const handleFocusIn = (event: FocusEvent) => {\n if (event.target === content) root.focus({ preventScroll: true });\n };\n content.addEventListener('focusin', handleFocusIn);\n if (document.activeElement === content) root.focus({ preventScroll: true });\n return () => content.removeEventListener('focusin', handleFocusIn);\n }, [isInsideMenu]);\n\n // Refs for stable handler references\n const onKeyDownRef = React.useRef(onKeyDown);\n const onFocusRef = React.useRef(onFocus);\n onKeyDownRef.current = onKeyDown;\n onFocusRef.current = onFocus;\n const itemsRef = React.useRef(items);\n const onSelectRef = React.useRef(onSelect);\n const closeMenuRef = React.useRef(closeMenu);\n itemsRef.current = items;\n onSelectRef.current = onSelect;\n closeMenuRef.current = closeMenu;\n\n // Choosing a row calls onSelect, then closes the parent menu like a menu item does.\n const selectIndex = React.useCallback((idx: number) => {\n const currentItems = itemsRef.current;\n if (idx < 0 || idx >= currentItems.length) return;\n onSelectRef.current?.(currentItems[idx], idx);\n closeMenuRef.current?.();\n }, []);\n\n const scrollToIndexRef = React.useRef(virtualizer.scrollToIndex);\n scrollToIndexRef.current = virtualizer.scrollToIndex;\n\n const highlightedIndexRef = React.useRef(safeHighlightedIndex);\n highlightedIndexRef.current = safeHighlightedIndex;\n\n // Stable event handlers\n const handleItemMouseEnter = React.useCallback((e: React.MouseEvent<HTMLElement>) => {\n const index = e.currentTarget.dataset.index;\n if (index != null) {\n setHighlightedIndex(Number(index));\n }\n }, []);\n\n const handleItemClick = React.useCallback((e: React.MouseEvent<HTMLElement>) => {\n const index = e.currentTarget.dataset.index;\n if (index != null) selectIndex(Number(index));\n }, [selectIndex]);\n\n // Leaving a row clears its highlight, as a Radix item does on pointer leave.\n const handleItemMouseLeave = React.useCallback((e: React.MouseEvent<HTMLElement>) => {\n const index = Number(e.currentTarget.dataset.index);\n setHighlightedIndex((current) => (current === index ? -1 : current));\n }, []);\n\n // Item-level keyboard handler for Enter/Space activation (satisfies a11y lint rule)\n const handleItemKeyDown = React.useCallback((e: React.KeyboardEvent<HTMLElement>) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n e.stopPropagation();\n const index = e.currentTarget.dataset.index;\n if (index != null) selectIndex(Number(index));\n }\n }, [selectIndex]);\n\n // Keyboard navigation\n const handleKeyDown = React.useCallback((e: React.KeyboardEvent<HTMLDivElement>) => {\n onKeyDownRef.current?.(e);\n if (e.defaultPrevented) return;\n const currentItems = itemsRef.current;\n const currentHighlightedIndex = highlightedIndexRef.current;\n\n switch (e.key) {\n case 'ArrowDown': {\n e.preventDefault();\n const nextIndex =\n currentHighlightedIndex < currentItems.length - 1 ? currentHighlightedIndex + 1 : 0;\n setHighlightedIndex(nextIndex);\n scrollToIndexRef.current(nextIndex, { align: 'auto' });\n break;\n }\n case 'ArrowUp': {\n e.preventDefault();\n const prevIndex =\n currentHighlightedIndex > 0 ? currentHighlightedIndex - 1 : currentItems.length - 1;\n setHighlightedIndex(prevIndex);\n scrollToIndexRef.current(prevIndex, { align: 'auto' });\n break;\n }\n case 'Home': {\n e.preventDefault();\n setHighlightedIndex(0);\n scrollToIndexRef.current(0, { align: 'start' });\n break;\n }\n case 'End': {\n e.preventDefault();\n const lastIndex = currentItems.length - 1;\n setHighlightedIndex(lastIndex);\n scrollToIndexRef.current(lastIndex, { align: 'end' });\n break;\n }\n case 'Enter':\n case ' ': {\n e.preventDefault();\n selectIndex(currentHighlightedIndex);\n break;\n }\n case 'Tab': {\n // Inside a menu, Tab does not leave it. On its own, the list is one tab stop.\n if (isInsideMenu) e.preventDefault();\n break;\n }\n case 'Escape': {\n // Inside a menu, the menu handles Escape and returns focus to its trigger.\n if (!isInsideMenu) e.currentTarget.blur();\n break;\n }\n default: {\n // The parent menu's typeahead would move focus off the list onto one of its items.\n if (isInsideMenu && e.key.length === 1 && !e.ctrlKey && !e.altKey && !e.metaKey) {\n e.stopPropagation();\n }\n }\n }\n }, [selectIndex, isInsideMenu]);\n\n // Keyboard focus on the list highlights the first row when none is highlighted.\n const handleFocus = React.useCallback((e: React.FocusEvent<HTMLDivElement>) => {\n onFocusRef.current?.(e);\n if (e.target !== e.currentTarget) return;\n if (highlightedIndexRef.current < 0 && itemsRef.current.length > 0) setHighlightedIndex(0);\n }, []);\n\n // Item ID generator\n const getItemId = React.useCallback(\n (index: number) => `${menuId}-item-${index}`,\n [menuId],\n );\n\n // Memoize styles\n const rootStyle = React.useMemo(\n () => ({\n overflow: 'auto' as const,\n position: 'relative' as const,\n ...style,\n }),\n [style],\n );\n\n const totalSize = virtualizer.getTotalSize();\n const viewportStyle = React.useMemo(\n () => ({\n height: `${totalSize}px`,\n width: '100%' as const,\n position: 'relative' as const,\n }),\n [totalSize],\n );\n\n return (\n <div\n {...rootProps}\n ref={setRootRef}\n role={isInsideMenu ? 'group' : 'menu'}\n aria-activedescendant={safeHighlightedIndex >= 0 ? getItemId(safeHighlightedIndex) : undefined}\n tabIndex={0}\n onKeyDown={handleKeyDown}\n onFocus={handleFocus}\n className={classNames(\n 'kui-VirtualMenuRoot',\n // On its own, the list draws menu rows at its own size (virtual-menu.css).\n !isInsideMenu && `kui-r-size-${sizeProp ?? '2'}`,\n className,\n )}\n style={rootStyle}\n >\n <div className=\"kui-VirtualMenuViewport\" style={viewportStyle}>\n {virtualItems.map((virtualRow) => {\n const item = items[virtualRow.index];\n const index = virtualRow.index;\n const isHighlighted = safeHighlightedIndex === index;\n\n const itemStyle: React.CSSProperties = {\n height: virtualRow.size,\n transform: `translateY(${virtualRow.start}px)`,\n };\n\n const commonProps = {\n id: getItemId(index),\n isHighlighted,\n style: itemStyle,\n // The list holds focus and points aria-activedescendant at the row, so it is the only tab stop.\n tabIndex: -1,\n 'data-highlighted': isHighlighted ? true as const : undefined,\n 'data-index': index,\n 'aria-setsize': items.length,\n 'aria-posinset': index + 1,\n onMouseEnter: handleItemMouseEnter,\n onMouseLeave: handleItemMouseLeave,\n onClick: handleItemClick,\n onKeyDown: handleItemKeyDown,\n };\n\n // Use renderItem if provided, otherwise use SimpleItem with itemLabel\n if (RenderItem) {\n return (\n <RenderItem\n key={virtualRow.key}\n item={item}\n index={index}\n {...commonProps}\n />\n );\n }\n\n return (\n <SimpleItem\n key={virtualRow.key}\n label={getLabel!(item)}\n {...commonProps}\n />\n );\n })}\n </div>\n </div>\n );\n}\n\nconst VirtualMenuRoot = React.forwardRef(VirtualMenuRootInner) as (<T>(\n props: VirtualMenuProps<T> & React.RefAttributes<HTMLDivElement>,\n) => React.ReactElement) & { displayName?: string };\nVirtualMenuRoot.displayName = 'VirtualMenu';\n\n// ============================================================================\n// VirtualMenu.Item Component (for custom renderItem usage)\n// ============================================================================\n\ninterface VirtualMenuItemProps extends React.ComponentPropsWithoutRef<'div'> {\n children: React.ReactNode;\n /** Data attribute for highlight styling */\n 'data-highlighted'?: true | undefined;\n /** Data attribute for event delegation */\n 'data-index'?: number;\n}\n\nconst VirtualMenuItemInner = React.forwardRef<HTMLDivElement, VirtualMenuItemProps>(\n ({ className, children, ...props }, forwardedRef) => {\n return (\n <div\n ref={forwardedRef}\n role=\"menuitem\"\n className={classNames('kui-reset', 'kui-BaseMenuItem', 'kui-VirtualMenuItem', className)}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nVirtualMenuItemInner.displayName = 'VirtualMenu.Item';\n\n// Style is compared by height and transform; every other prop shallowly.\nconst VirtualMenuItem = React.memo(VirtualMenuItemInner, areRowPropsEqual);\n\n// ============================================================================\n// Exports\n// ============================================================================\n\nconst VirtualMenu = Object.assign(VirtualMenuRoot, {\n Item: VirtualMenuItem,\n});\n\nexport { VirtualMenu };\nexport type { VirtualMenuProps, VirtualMenuItemProps, VirtualMenuRenderItemProps };\n"],
|
|
5
|
-
"mappings": ";sDAEA,UAAYA,MAAW,QACvB,OAAOC,MAAgB,aACvB,OAAS,kBAAAC,OAAsB,0BAC/B,OAAS,mBAAAC,MAAuB,oBAqIhC,SAASC,EAA4DC,EAASC,EAAS,CAErF,GADID,EAAK,OAAO,SAAWC,EAAK,OAAO,QACnCD,EAAK,OAAO,YAAcC,EAAK,OAAO,UAAW,MAAO,GAC5D,IAAMC,EAAW,OAAO,KAAKF,CAAI,EACjC,OAAIE,EAAS,SAAW,OAAO,KAAKD,CAAI,EAAE,OAAe,GAClDC,EAAS,MAAOC,GAAQA,IAAQ,SAAW,OAAO,GAAGH,EAAKG,CAAG,EAAGF,EAAKE,CAAG,CAAC,CAAC,CACnF,CAkBA,IAAMC,GAAmB,OACvB,SAAoB,CAClB,MAAAC,EACA,cAAeC,EACf,GAAAC,EACA,MAAAC,EACA,SAAAC,EACA,mBAAoBC,EACpB,aAAcC,EACd,eAAgBC,EAChB,gBAAiBC,EACjB,aAAAC,EACA,aAAAC,EACA,QAAAC,EACA,UAAAC,CACF,EAAoB,CAClB,OACE,gBAAC,OACC,GAAIV,EACJ,KAAK,WACL,UAAWW,EAAW,YAAa,mBAAoB,qBAAqB,EAC5E,MAAOV,EACP,SAAUC,EACV,mBAAkBC,EAClB,aAAYC,EACZ,eAAcC,EACd,gBAAeC,EACf,aAAcC,EACd,aAAcC,EACd,QAASC,EACT,UAAWC,GAEVZ,CACH,CAEJ,EACAN,CACF,EAUA,SAASoB,GACPC,EACAC,EACAC,EACA,CACA,GAAM,CAACC,EAAQ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AAA5D,EAAW,SAAA6D,EAAU,GAAGC,
|
|
6
|
-
"names": ["React", "classNames", "useVirtualizer", "useLayoutEffect", "areRowPropsEqual", "prev", "next", "prevKeys", "key", "SimpleItem", "label", "_isHighlighted", "id", "style", "tabIndex", "dataHighlighted", "dataIndex", "setSize", "posInSet", "onMouseEnter", "onMouseLeave", "onClick", "onKeyDown", "classNames", "useMeasuredRowHeight", "rootRef", "enabled", "size", "height", "setHeight", "useLayoutEffect", "root", "probe", "measured", "VirtualMenuRootInner", "items", "itemLabel", "RenderItem", "sizeProp", "estimatedItemSizeProp", "overscan", "onSelect", "className", "onFocus", "rootProps", "forwardedRef", "menuId", "parentRef", "highlightedIndex", "setHighlightedIndex", "isInsideMenu", "contextSize", "contextItemHeight", "useMenuContext", "closeMenu", "useMenuClose", "setRootRef", "node", "measuredItemHeight", "estimatedItemSize", "getMenuItemHeight", "getLabel", "item", "safeHighlightedIndex", "getItemSize", "virtualizer", "useVirtualizer", "virtualItems", "content", "handleFocusIn", "event", "onKeyDownRef", "onFocusRef", "itemsRef", "onSelectRef", "closeMenuRef", "selectIndex", "idx", "currentItems", "scrollToIndexRef", "highlightedIndexRef", "handleItemMouseEnter", "index", "handleItemClick", "handleItemMouseLeave", "current", "handleItemKeyDown", "handleKeyDown", "currentHighlightedIndex", "nextIndex", "prevIndex", "lastIndex", "handleFocus", "getItemId", "rootStyle", "totalSize", "viewportStyle", "virtualRow", "isHighlighted", "itemStyle", "commonProps", "VirtualMenuRoot", "VirtualMenuItemInner", "children", "props", "VirtualMenuItem", "VirtualMenu"]
|
|
4
|
+
"sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { useVirtualizer } from '@tanstack/react-virtual';\nimport { useLayoutEffect } from 'radix-ui/internal';\nimport { useMenuContext, useMenuClose, getMenuItemHeight } from './_internal/menu-context.js';\n\nimport type { MenuSize } from './_internal/menu-context.js';\n\n/**\n * VirtualMenu - A virtualized menu component for rendering large lists efficiently.\n *\n * Uses TanStack Virtual to render only visible items.\n * Works inside any container (DropdownMenu.Content, Popover.Content, etc.)\n *\n * @example\n * // Simple usage with itemLabel\n * <VirtualMenu\n * items={items}\n * itemLabel={(item) => item.name}\n * onSelect={handleSelect}\n * />\n *\n * @example\n * // Custom rendering with renderItem\n * const UserItem = React.memo(({ item, ...props }) => (\n * <VirtualMenu.Item {...props}>\n * <Avatar src={item.avatar} />\n * {item.name}\n * </VirtualMenu.Item>\n * ));\n *\n * <VirtualMenu items={users} renderItem={UserItem} onSelect={handleSelect} />\n */\n\n// ============================================================================\n// Types\n// ============================================================================\n\n/** Props passed to custom renderItem components */\ninterface VirtualMenuRenderItemProps<T> {\n /** The item data */\n item: T;\n /** Index in the items array */\n index: number;\n /** Whether this item is currently highlighted */\n isHighlighted: boolean;\n /** Unique ID for accessibility */\n id: string;\n /** Positioning styles - must be applied */\n style: React.CSSProperties;\n /** Tab index for focus management */\n tabIndex: number;\n /** Data attribute for CSS styling */\n 'data-highlighted': true | undefined;\n /** Data attribute for event delegation */\n 'data-index': number;\n /** Number of items in the whole list, since only some rows are mounted */\n 'aria-setsize': number;\n /** Position of this row in the whole list, from 1 */\n 'aria-posinset': number;\n /** Mouse enter handler */\n onMouseEnter: (e: React.MouseEvent<HTMLElement>) => void;\n /** Mouse leave handler */\n onMouseLeave: (e: React.MouseEvent<HTMLElement>) => void;\n /** Click handler */\n onClick: (e: React.MouseEvent<HTMLElement>) => void;\n /** Keyboard handler for Enter/Space activation */\n onKeyDown: (e: React.KeyboardEvent<HTMLElement>) => void;\n}\n\n/** How rows are drawn: one of `itemLabel` or `renderItem` is required. */\ntype VirtualMenuRowProps<T> =\n | {\n /**\n * Simple label accessor for basic text items.\n * Can be a property key or a function.\n * @example\n * itemLabel=\"name\"\n * itemLabel={(item) => item.name}\n */\n itemLabel: keyof T | ((item: T) => React.ReactNode);\n renderItem?: undefined;\n }\n | {\n itemLabel?: undefined;\n /**\n * Custom component for rendering items.\n * Must be memoized (React.memo) for optimal performance.\n * @example\n * const MyItem = React.memo(({ item, ...props }) => (\n * <VirtualMenu.Item {...props}>{item.name}</VirtualMenu.Item>\n * ));\n * <VirtualMenu items={items} renderItem={MyItem} />\n */\n renderItem: React.ComponentType<VirtualMenuRenderItemProps<T>>;\n };\n\n/** Attributes of the list element that pass through, such as `id`, `aria-labelledby` or `data-*`. */\ntype VirtualMenuDivProps = Omit<\n React.ComponentPropsWithoutRef<'div'>,\n 'children' | 'onSelect' | 'role' | 'tabIndex' | 'aria-activedescendant'\n>;\n\ntype VirtualMenuProps<T> = VirtualMenuDivProps & VirtualMenuRowProps<T> & VirtualMenuOwnProps<T>;\n\ninterface VirtualMenuOwnProps<T> {\n /** Array of items to render */\n items: T[];\n /**\n * Menu size - controls item height.\n * Automatically inherited from parent DropdownMenu.Content/ContextMenu.Content.\n * Only set manually when using VirtualMenu outside of a menu context.\n * @default '2' (or inherited from context)\n */\n size?: MenuSize;\n /**\n * Estimated height of each item in pixels.\n * Can be a number (same for all) or a function (per-item).\n * Usually not needed - height is automatically derived from size prop/context.\n * Use this only for custom item heights (e.g., variable height items).\n */\n estimatedItemSize?: number | ((index: number) => number);\n /** Number of items to render outside visible area */\n overscan?: number;\n /** Callback when an item is selected */\n onSelect?: (item: T, index: number) => void;\n}\n\n// ============================================================================\n// Internal Memoized Item Component\n// ============================================================================\n\n/**\n * Rows get a new style object every render, so style is compared by the two values the\n * list sets. Every other prop is compared shallowly, so aria-*, data-* and handlers update.\n */\nfunction areRowPropsEqual<P extends { style?: React.CSSProperties }>(prev: P, next: P) {\n if (prev.style?.height !== next.style?.height) return false;\n if (prev.style?.transform !== next.style?.transform) return false;\n const prevKeys = Object.keys(prev) as (keyof P)[];\n if (prevKeys.length !== Object.keys(next).length) return false;\n return prevKeys.every((key) => key === 'style' || Object.is(prev[key], next[key]));\n}\n\ninterface SimpleItemProps {\n label: React.ReactNode;\n isHighlighted: boolean;\n id: string;\n style: React.CSSProperties;\n tabIndex: number;\n 'data-highlighted': true | undefined;\n 'data-index': number;\n 'aria-setsize': number;\n 'aria-posinset': number;\n onMouseEnter: (e: React.MouseEvent<HTMLElement>) => void;\n onMouseLeave: (e: React.MouseEvent<HTMLElement>) => void;\n onClick: (e: React.MouseEvent<HTMLElement>) => void;\n onKeyDown: (e: React.KeyboardEvent<HTMLElement>) => void;\n}\n\nconst SimpleItem = React.memo(\n function SimpleItem({\n label,\n isHighlighted: _isHighlighted,\n id,\n style,\n tabIndex,\n 'data-highlighted': dataHighlighted,\n 'data-index': dataIndex,\n 'aria-setsize': setSize,\n 'aria-posinset': posInSet,\n onMouseEnter,\n onMouseLeave,\n onClick,\n onKeyDown,\n }: SimpleItemProps) {\n return (\n <div\n id={id}\n role=\"menuitem\"\n className={classNames('kui-reset', 'kui-BaseMenuItem', 'kui-VirtualMenuItem')}\n style={style}\n tabIndex={tabIndex}\n data-highlighted={dataHighlighted}\n data-index={dataIndex}\n aria-setsize={setSize}\n aria-posinset={posInSet}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n onClick={onClick}\n onKeyDown={onKeyDown}\n >\n {label}\n </div>\n );\n },\n areRowPropsEqual,\n);\n\n// ============================================================================\n// VirtualMenu Component\n// ============================================================================\n\n/**\n * Measures the row height the menu's CSS draws (--base-menu-item-height), so rows follow\n * the theme scale instead of the fixed 100% table. Returns undefined until measured.\n */\nfunction useMeasuredRowHeight(\n rootRef: React.RefObject<HTMLDivElement | null>,\n enabled: boolean,\n size: MenuSize | undefined,\n) {\n const [height, setHeight] = React.useState<number | undefined>(undefined);\n useLayoutEffect(() => {\n const root = rootRef.current;\n if (!enabled || !root) return;\n const probe = document.createElement('div');\n probe.className = 'kui-reset kui-BaseMenuItem kui-VirtualMenuItem';\n probe.setAttribute('aria-hidden', 'true');\n probe.style.visibility = 'hidden';\n probe.textContent = '\\u00a0';\n root.appendChild(probe);\n const measured = probe.getBoundingClientRect().height;\n probe.remove();\n setHeight(measured > 0 ? measured : undefined);\n }, [rootRef, enabled, size]);\n return enabled ? height : undefined;\n}\n\nfunction VirtualMenuRootInner<T>(\n {\n items,\n itemLabel,\n renderItem: RenderItem,\n size: sizeProp,\n estimatedItemSize: estimatedItemSizeProp,\n overscan = 5,\n onSelect,\n className,\n style,\n onKeyDown,\n onFocus,\n ...rootProps\n }: VirtualMenuProps<T>,\n forwardedRef: React.ForwardedRef<HTMLDivElement>,\n) {\n const menuId = React.useId();\n const parentRef = React.useRef<HTMLDivElement>(null);\n const [highlightedIndex, setHighlightedIndex] = React.useState<number>(-1);\n const { isInsideMenu, size: contextSize, itemHeight: contextItemHeight } = useMenuContext();\n const closeMenu = useMenuClose();\n\n const setRootRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n parentRef.current = node;\n if (typeof forwardedRef === 'function') forwardedRef(node);\n else if (forwardedRef) forwardedRef.current = node;\n },\n [forwardedRef],\n );\n\n // Inside a menu, the CSS row height is measured so it tracks the theme scale.\n const measuredItemHeight = useMeasuredRowHeight(\n parentRef,\n isInsideMenu && sizeProp == null && estimatedItemSizeProp == null,\n contextSize,\n );\n\n // Resolve item height: explicit prop > own size > measured CSS row > parent menu > default size '2'.\n const estimatedItemSize =\n estimatedItemSizeProp ??\n (sizeProp\n ? getMenuItemHeight(sizeProp)\n : (measuredItemHeight ?? contextItemHeight ?? getMenuItemHeight(contextSize ?? '2')));\n\n // Validate props\n if (!itemLabel && !RenderItem) {\n throw new Error('VirtualMenu requires either itemLabel or renderItem prop');\n }\n\n // Normalize itemLabel to a function\n const getLabel = React.useMemo(() => {\n if (!itemLabel) return null;\n if (typeof itemLabel === 'function') return itemLabel;\n return (item: T) => item[itemLabel] as React.ReactNode;\n }, [itemLabel]);\n\n // Derive safe highlighted index\n const safeHighlightedIndex = React.useMemo(() => {\n if (items.length === 0) return -1;\n if (highlightedIndex < 0) return -1;\n return Math.min(highlightedIndex, items.length - 1);\n }, [highlightedIndex, items.length]);\n\n // Normalize estimatedItemSize to a function\n const getItemSize = React.useMemo(\n () =>\n typeof estimatedItemSize === 'function'\n ? estimatedItemSize\n : () => estimatedItemSize,\n [estimatedItemSize],\n );\n\n const virtualizer = useVirtualizer({\n count: items.length,\n getScrollElement: () => parentRef.current,\n estimateSize: getItemSize,\n overscan,\n });\n\n const virtualItems = virtualizer.getVirtualItems();\n\n // Re-measure cached rows when the resolved row height changes.\n useLayoutEffect(() => {\n virtualizer.measure();\n }, [virtualizer, estimatedItemSize]);\n\n // Inside a menu, the menu focuses its own content on open (and a submenu on keyboard\n // open). Hand that focus to the list so arrow keys reach the rows.\n React.useEffect(() => {\n const root = parentRef.current;\n if (!isInsideMenu || !root) return;\n const content = root.closest<HTMLElement>('[data-radix-menu-content]');\n if (!content) return;\n const handleFocusIn = (event: FocusEvent) => {\n if (event.target === content) root.focus({ preventScroll: true });\n };\n content.addEventListener('focusin', handleFocusIn);\n if (document.activeElement === content) root.focus({ preventScroll: true });\n return () => content.removeEventListener('focusin', handleFocusIn);\n }, [isInsideMenu]);\n\n // Refs for stable handler references\n const onKeyDownRef = React.useRef(onKeyDown);\n const onFocusRef = React.useRef(onFocus);\n onKeyDownRef.current = onKeyDown;\n onFocusRef.current = onFocus;\n const itemsRef = React.useRef(items);\n const onSelectRef = React.useRef(onSelect);\n const closeMenuRef = React.useRef(closeMenu);\n itemsRef.current = items;\n onSelectRef.current = onSelect;\n closeMenuRef.current = closeMenu;\n\n // Choosing a row calls onSelect, then closes the parent menu like a menu item does.\n const selectIndex = React.useCallback((idx: number) => {\n const currentItems = itemsRef.current;\n if (idx < 0 || idx >= currentItems.length) return;\n onSelectRef.current?.(currentItems[idx], idx);\n closeMenuRef.current?.();\n }, []);\n\n const scrollToIndexRef = React.useRef(virtualizer.scrollToIndex);\n scrollToIndexRef.current = virtualizer.scrollToIndex;\n\n const highlightedIndexRef = React.useRef(safeHighlightedIndex);\n highlightedIndexRef.current = safeHighlightedIndex;\n\n // Stable event handlers\n const handleItemMouseEnter = React.useCallback((e: React.MouseEvent<HTMLElement>) => {\n const index = e.currentTarget.dataset.index;\n if (index != null) {\n setHighlightedIndex(Number(index));\n }\n }, []);\n\n const handleItemClick = React.useCallback((e: React.MouseEvent<HTMLElement>) => {\n const index = e.currentTarget.dataset.index;\n if (index != null) selectIndex(Number(index));\n }, [selectIndex]);\n\n // Leaving a row clears its highlight, as a Radix item does on pointer leave.\n const handleItemMouseLeave = React.useCallback((e: React.MouseEvent<HTMLElement>) => {\n const index = Number(e.currentTarget.dataset.index);\n setHighlightedIndex((current) => (current === index ? -1 : current));\n }, []);\n\n // Item-level keyboard handler for Enter/Space activation (satisfies a11y lint rule)\n const handleItemKeyDown = React.useCallback((e: React.KeyboardEvent<HTMLElement>) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n e.stopPropagation();\n const index = e.currentTarget.dataset.index;\n if (index != null) selectIndex(Number(index));\n }\n }, [selectIndex]);\n\n // Keyboard navigation\n const handleKeyDown = React.useCallback((e: React.KeyboardEvent<HTMLDivElement>) => {\n onKeyDownRef.current?.(e);\n if (e.defaultPrevented) return;\n const currentItems = itemsRef.current;\n const currentHighlightedIndex = highlightedIndexRef.current;\n\n switch (e.key) {\n case 'ArrowDown': {\n e.preventDefault();\n const nextIndex =\n currentHighlightedIndex < currentItems.length - 1 ? currentHighlightedIndex + 1 : 0;\n setHighlightedIndex(nextIndex);\n scrollToIndexRef.current(nextIndex, { align: 'auto' });\n break;\n }\n case 'ArrowUp': {\n e.preventDefault();\n const prevIndex =\n currentHighlightedIndex > 0 ? currentHighlightedIndex - 1 : currentItems.length - 1;\n setHighlightedIndex(prevIndex);\n scrollToIndexRef.current(prevIndex, { align: 'auto' });\n break;\n }\n case 'Home': {\n e.preventDefault();\n setHighlightedIndex(0);\n scrollToIndexRef.current(0, { align: 'start' });\n break;\n }\n case 'End': {\n e.preventDefault();\n const lastIndex = currentItems.length - 1;\n setHighlightedIndex(lastIndex);\n scrollToIndexRef.current(lastIndex, { align: 'end' });\n break;\n }\n case 'Enter':\n case ' ': {\n e.preventDefault();\n selectIndex(currentHighlightedIndex);\n break;\n }\n case 'Tab': {\n // Inside a menu, Tab does not leave it. On its own, the list is one tab stop.\n if (isInsideMenu) e.preventDefault();\n break;\n }\n case 'Escape': {\n // Inside a menu, the menu handles Escape and returns focus to its trigger.\n if (!isInsideMenu) e.currentTarget.blur();\n break;\n }\n default: {\n // The parent menu's typeahead would move focus off the list onto one of its items.\n if (isInsideMenu && e.key.length === 1 && !e.ctrlKey && !e.altKey && !e.metaKey) {\n e.stopPropagation();\n }\n }\n }\n }, [selectIndex, isInsideMenu]);\n\n // Keyboard focus on the list highlights the first row when none is highlighted.\n const handleFocus = React.useCallback((e: React.FocusEvent<HTMLDivElement>) => {\n onFocusRef.current?.(e);\n if (e.target !== e.currentTarget) return;\n if (highlightedIndexRef.current < 0 && itemsRef.current.length > 0) setHighlightedIndex(0);\n }, []);\n\n // Item ID generator\n const getItemId = React.useCallback(\n (index: number) => `${menuId}-item-${index}`,\n [menuId],\n );\n\n // Memoize styles\n const rootStyle = React.useMemo(\n () => ({\n overflow: 'auto' as const,\n position: 'relative' as const,\n ...style,\n }),\n [style],\n );\n\n const totalSize = virtualizer.getTotalSize();\n const viewportStyle = React.useMemo(\n () => ({\n height: `${totalSize}px`,\n width: '100%' as const,\n position: 'relative' as const,\n }),\n [totalSize],\n );\n\n return (\n <div\n {...rootProps}\n ref={setRootRef}\n role={isInsideMenu ? 'group' : 'menu'}\n aria-activedescendant={safeHighlightedIndex >= 0 ? getItemId(safeHighlightedIndex) : undefined}\n tabIndex={0}\n onKeyDown={handleKeyDown}\n onFocus={handleFocus}\n className={classNames(\n 'kui-VirtualMenuRoot',\n // On its own, the list draws menu rows at its own size (virtual-menu.css).\n !isInsideMenu && `kui-r-size-${sizeProp ?? '2'}`,\n className,\n )}\n style={rootStyle}\n >\n <div className=\"kui-VirtualMenuViewport\" style={viewportStyle}>\n {virtualItems.map((virtualRow) => {\n const item = items[virtualRow.index];\n const index = virtualRow.index;\n const isHighlighted = safeHighlightedIndex === index;\n\n const itemStyle: React.CSSProperties = {\n height: virtualRow.size,\n transform: `translateY(${virtualRow.start}px)`,\n };\n\n const commonProps = {\n id: getItemId(index),\n isHighlighted,\n style: itemStyle,\n // The list holds focus and points aria-activedescendant at the row, so it is the only tab stop.\n tabIndex: -1,\n 'data-highlighted': isHighlighted ? true as const : undefined,\n 'data-index': index,\n 'aria-setsize': items.length,\n 'aria-posinset': index + 1,\n onMouseEnter: handleItemMouseEnter,\n onMouseLeave: handleItemMouseLeave,\n onClick: handleItemClick,\n onKeyDown: handleItemKeyDown,\n };\n\n // Use renderItem if provided, otherwise use SimpleItem with itemLabel\n if (RenderItem) {\n return (\n <RenderItem\n key={virtualRow.key}\n item={item}\n index={index}\n {...commonProps}\n />\n );\n }\n\n return (\n <SimpleItem\n key={virtualRow.key}\n label={getLabel!(item)}\n {...commonProps}\n />\n );\n })}\n </div>\n </div>\n );\n}\n\nconst VirtualMenuRoot = React.forwardRef(VirtualMenuRootInner) as (<T>(\n props: VirtualMenuProps<T> & React.RefAttributes<HTMLDivElement>,\n) => React.ReactElement) & { displayName?: string };\nVirtualMenuRoot.displayName = 'VirtualMenu';\n\n// ============================================================================\n// VirtualMenu.Item Component (for custom renderItem usage)\n// ============================================================================\n\ninterface VirtualMenuItemProps extends React.ComponentPropsWithoutRef<'div'> {\n children: React.ReactNode;\n /** Data attribute for highlight styling */\n 'data-highlighted'?: true | undefined;\n /** Data attribute for event delegation */\n 'data-index'?: number;\n}\n\nconst VirtualMenuItemInner = React.forwardRef<HTMLDivElement, VirtualMenuItemProps>(\n ({ className, children, ...allProps }, forwardedRef) => {\n // A `renderItem` component usually spreads everything it is given onto this row. These three\n // are for the component, not the element, so they stop here.\n const { isHighlighted: _isHighlighted, index: _index, item: _item, ...props } = allProps as typeof allProps & {\n isHighlighted?: boolean;\n index?: number;\n item?: unknown;\n };\n return (\n <div\n ref={forwardedRef}\n role=\"menuitem\"\n className={classNames('kui-reset', 'kui-BaseMenuItem', 'kui-VirtualMenuItem', className)}\n {...props}\n >\n {children}\n </div>\n );\n },\n);\n\nVirtualMenuItemInner.displayName = 'VirtualMenu.Item';\n\n// Style is compared by height and transform; every other prop shallowly.\nconst VirtualMenuItem = React.memo(VirtualMenuItemInner, areRowPropsEqual);\n\n// ============================================================================\n// Exports\n// ============================================================================\n\nconst VirtualMenu = Object.assign(VirtualMenuRoot, {\n Item: VirtualMenuItem,\n});\n\nexport { VirtualMenu };\nexport type { VirtualMenuProps, VirtualMenuItemProps, VirtualMenuRenderItemProps };\n"],
|
|
5
|
+
"mappings": ";sDAEA,UAAYA,MAAW,QACvB,OAAOC,MAAgB,aACvB,OAAS,kBAAAC,OAAsB,0BAC/B,OAAS,mBAAAC,MAAuB,oBAqIhC,SAASC,EAA4DC,EAASC,EAAS,CAErF,GADID,EAAK,OAAO,SAAWC,EAAK,OAAO,QACnCD,EAAK,OAAO,YAAcC,EAAK,OAAO,UAAW,MAAO,GAC5D,IAAMC,EAAW,OAAO,KAAKF,CAAI,EACjC,OAAIE,EAAS,SAAW,OAAO,KAAKD,CAAI,EAAE,OAAe,GAClDC,EAAS,MAAOC,GAAQA,IAAQ,SAAW,OAAO,GAAGH,EAAKG,CAAG,EAAGF,EAAKE,CAAG,CAAC,CAAC,CACnF,CAkBA,IAAMC,GAAmB,OACvB,SAAoB,CAClB,MAAAC,EACA,cAAeC,EACf,GAAAC,EACA,MAAAC,EACA,SAAAC,EACA,mBAAoBC,EACpB,aAAcC,EACd,eAAgBC,EAChB,gBAAiBC,EACjB,aAAAC,EACA,aAAAC,EACA,QAAAC,EACA,UAAAC,CACF,EAAoB,CAClB,OACE,gBAAC,OACC,GAAIV,EACJ,KAAK,WACL,UAAWW,EAAW,YAAa,mBAAoB,qBAAqB,EAC5E,MAAOV,EACP,SAAUC,EACV,mBAAkBC,EAClB,aAAYC,EACZ,eAAcC,EACd,gBAAeC,EACf,aAAcC,EACd,aAAcC,EACd,QAASC,EACT,UAAWC,GAEVZ,CACH,CAEJ,EACAN,CACF,EAUA,SA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B,YAAc,cAc9B,IAAMC,EAA6B,aACjC,CAAC,CAAE,UAAA5D,EAAW,SAAA6D,EAAU,GAAGC,CAAS,EAAG3D,IAAiB,CAGtD,GAAM,CAAE,cAAelC,EAAgB,MAAO8F,EAAQ,KAAMC,EAAO,GAAGC,CAAM,EAAIH,EAKhF,OACE,gBAAC,OACC,IAAK3D,EACL,KAAK,WACL,UAAWtB,EAAW,YAAa,mBAAoB,sBAAuBmB,CAAS,EACtF,GAAGiE,GAEHJ,CACH,CAEJ,CACF,EAEAD,EAAqB,YAAc,mBAGnC,IAAMM,GAAwB,OAAKN,EAAsBlG,CAAgB,EAMnEyG,GAAc,OAAO,OAAOR,EAAiB,CACjD,KAAMO,EACR,CAAC",
|
|
6
|
+
"names": ["React", "classNames", "useVirtualizer", "useLayoutEffect", "areRowPropsEqual", "prev", "next", "prevKeys", "key", "SimpleItem", "label", "_isHighlighted", "id", "style", "tabIndex", "dataHighlighted", "dataIndex", "setSize", "posInSet", "onMouseEnter", "onMouseLeave", "onClick", "onKeyDown", "classNames", "useMeasuredRowHeight", "rootRef", "enabled", "size", "height", "setHeight", "useLayoutEffect", "root", "probe", "measured", "VirtualMenuRootInner", "items", "itemLabel", "RenderItem", "sizeProp", "estimatedItemSizeProp", "overscan", "onSelect", "className", "onFocus", "rootProps", "forwardedRef", "menuId", "parentRef", "highlightedIndex", "setHighlightedIndex", "isInsideMenu", "contextSize", "contextItemHeight", "useMenuContext", "closeMenu", "useMenuClose", "setRootRef", "node", "measuredItemHeight", "estimatedItemSize", "getMenuItemHeight", "getLabel", "item", "safeHighlightedIndex", "getItemSize", "virtualizer", "useVirtualizer", "virtualItems", "content", "handleFocusIn", "event", "onKeyDownRef", "onFocusRef", "itemsRef", "onSelectRef", "closeMenuRef", "selectIndex", "idx", "currentItems", "scrollToIndexRef", "highlightedIndexRef", "handleItemMouseEnter", "index", "handleItemClick", "handleItemMouseLeave", "current", "handleItemKeyDown", "handleKeyDown", "currentHighlightedIndex", "nextIndex", "prevIndex", "lastIndex", "handleFocus", "getItemId", "rootStyle", "totalSize", "viewportStyle", "virtualRow", "isHighlighted", "itemStyle", "commonProps", "VirtualMenuRoot", "VirtualMenuItemInner", "children", "allProps", "_index", "_item", "props", "VirtualMenuItem", "VirtualMenu"]
|
|
7
7
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{a as r}from"./chunk-
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
import{a as r}from"./chunk-YLPCYCYA.js";import*as e from"react";import d from"classnames";import{Toggle as g}from"radix-ui";var i=e.forwardRef(({pressed:o,onPressedChange:t,defaultPressed:s,children:a,className:l,...n},p)=>{delete n.done;let u=e.useRef(!1);return e.useEffect(()=>{},[o,t]),e.createElement(g.Root,{pressed:o,onPressedChange:t,defaultPressed:s,asChild:!0},e.createElement(r,{...n,ref:p,className:d("kui-Toggle",l)},a))});i.displayName="Toggle";export{i as a};
|
|
3
|
+
//# sourceMappingURL=chunk-FYZXC7AL.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{a as c,c as M,e as w,g as H}from"./chunk-XUCR7L4G.js";import{a as v,d}from"./chunk-
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
import{a as c,c as M,e as w,g as H}from"./chunk-XUCR7L4G.js";import{a as v,d}from"./chunk-4OJRLS5N.js";import{a as y,b as x,c as O}from"./chunk-KGCGT4MJ.js";import{a as E,b as T,c as N}from"./chunk-4TTRPCGG.js";import{a as R}from"./chunk-MXEOE4LA.js";import{a as S}from"./chunk-G66WDIIV.js";import{b}from"./chunk-VWRPVM5K.js";import{o as C}from"./chunk-5BXCPANF.js";import*as e from"react";import le from"classnames";import{useComposedRefs as pe}from"radix-ui/internal";var de={controlled:"open",default:"defaultOpen"},ce={initial:"overlay",sm:"fixed"},U=e.forwardRef((k,A)=>{let{className:B,presentation:V=ce,defaultOpen:L,open:_,onOpenChange:D,expandedSize:o=320,minSize:t=200,maxSize:s=500,resizable:m=!1,collapsible:F=!0,onExpand:$,onCollapse:q,onResize:W,onResizeStart:j,onResizeEnd:G,snapPoints:r,snapTolerance:K,collapseThreshold:a,paneId:i,persistence:l,children:J,style:Q,onSizeChange:X,sizeUpdate:Y,sizeUpdateMs:Z=50,size:u,defaultSize:P,flush:f=!0,id:ee,...p}=k,{table:z,attributes:ne}=O(V,"fixed"),n=y({name:"inspector",label:"Inspector",propNames:de,id:ee,controlled:c(_),defaultValue:c(L),presentationTable:z,builtIn:M,onChange:(ae,ie)=>D?.(ae!=="closed",{reason:ie}),onExpand:$,onCollapse:q,size:o});C("inspector",f),e.useEffect(()=>{(r!==void 0||a!==void 0||i!==void 0||l!==void 0)&&void 0},[r,a,i,l]);let h=e.useRef(null),oe=pe(A,n.setElement,h),te=T({name:"inspector",elementId:n.id,elementRef:h,cssVarName:"--inspector-size",orientation:"vertical",edge:"start",growth:w,expandedSize:o,minSize:t,maxSize:s,resizable:m,collapsible:F,size:u,defaultSize:P,onSizeChange:X,sizeUpdate:Y,sizeUpdateMs:Z,onResize:W,onResizeStart:j,onResizeEnd:G,snapPoints:r,snapTolerance:K,collapseThreshold:a,paneId:i,persistence:l,overlaying:n.overlaying,overlayingNow:()=>z[S()]==="overlay",requestCollapse:()=>n.setValue("closed","toggle"),requestToggle:()=>n.toggle("toggle")}),{handles:g,content:se}=N(J,d),re=m&&n.shown!==!1&&!n.overlaying?e.createElement(R.Provider,{value:te},g.length>0?g:e.createElement(v,null)):null,I=E(u,P,t,s);return e.createElement("div",{...H(p),role:p.role??"complementary",id:n.id,ref:oe,className:le("kui-ShellPane","kui-ShellInspector",B),...x(n,ne),"data-flush":f||void 0,tabIndex:n.overlaying?-1:p.tabIndex,style:{...Q,"--inspector-expanded-size":`${o}px`,...I?{"--inspector-size":I}:{},"--inspector-min-size":`${t}px`,"--inspector-max-size":`${s}px`}},e.createElement("div",{className:"kui-ShellInspectorContent"},e.createElement(b,null,se)),re)});U.displayName="Shell.Inspector";U.Handle=d;export{U as a};
|
|
3
|
+
//# sourceMappingURL=chunk-HQT32HQ6.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{d as R,i as d,j as S}from"./chunk-
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
import{d as R,i as d,j as S}from"./chunk-C6VGCYFQ.js";import{a as j}from"./chunk-65URNXF2.js";import{a as G}from"./chunk-OBSZOD5M.js";import{a as H}from"./chunk-KVVRFWGQ.js";import{a as P}from"./chunk-4KBKS3ZE.js";import{a as x,d as y,e as O}from"./chunk-VWRPVM5K.js";import{d as E,i as M,k as A}from"./chunk-PMXIQ5B4.js";import*as e from"react";import f from"classnames";var F=e.createContext(null),$=e.createContext(0),D=e.createContext(null);function X(){let t=y(),n=e.useContext(P);return t!==null&&n===null}var W=e.Activity;function Y({visible:t,children:n}){return W?e.createElement(W,{mode:t?"visible":"hidden"},n):e.createElement("div",{hidden:!t,style:{display:t?"contents":"none"}},n)}function ve({path:t,defaultPath:n,onPathChange:s,screen:i,root:c,children:u,className:b,style:l}){let v=X(),[N,g]=e.useState(n??[]),o=t??N,[p,z]=e.useState({path:o,direction:null}),m=p.direction;if(p.path.length!==o.length||p.path.some((a,r)=>!Object.is(a,o[r]))){let a=p.path;m=o.length<a.length?"pop":o.length>a.length||!Object.is(o[o.length-1],a[a.length-1])?"push":p.direction,z({path:o,direction:m})}let C=e.useRef([]),k=e.useRef([]),[K,V]=e.useState(0),T=e.useCallback(a=>{t===void 0&&g(a),s?.(a)},[t,s]),J=e.useMemo(()=>({path:o,canGoBack:o.length>0,push:a=>{k.current[o.length+1]=typeof document>"u"?null:document.activeElement,T([...o,a])},pop:()=>{o.length>0&&T(o.slice(0,-1))},popTo:a=>{a<o.length&&T(o.slice(0,Math.max(0,a)))},titles:C,openers:k,setTitle:(a,r)=>{C.current[a]!==r&&(C.current[a]=r,V(U=>U+1))},direction:m,inPane:v}),[o,T,K,m,v]),L=e.useRef(o.length);e.useEffect(()=>{let a=L.current;if(L.current=o.length,o.length<a){let r=k.current[a];k.current.length=o.length+1,r&&r.isConnected&&r.focus()}},[o.length]);let B=[c,...o.map(a=>i(a))],Q=B.length-1,w=e.createElement("div",{className:f("kui-Navigator",b),style:l},B.map((a,r)=>e.createElement(Y,{key:r===0?"root":`${r}:${String(o[r-1])}`,visible:r===Q},e.createElement($.Provider,{value:r},e.createElement("div",{className:"kui-NavigatorLevel"},a)))));return e.createElement(F.Provider,{value:J},e.createElement(D.Provider,{value:w},u??(v?e.createElement(Z,null):w)))}function Z(){return e.createElement(e.Fragment,null,e.createElement(M,null,e.createElement(S,null,e.createElement(H,{align:"center"},e.createElement(te,null),e.createElement(d,null)))),e.createElement(A,null,e.createElement(_,null)))}function _(){return e.createElement(e.Fragment,null,e.useContext(D))}function h(){let t=e.useContext(F);if(!t)throw new Error("Kookie: this part must be inside a <Navigator>.");return t}function ge(){return h()}function I(){return e.createElement("svg",{className:"kui-NavigatorBackGlyph",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0},e.createElement("path",{d:"m15 18-6-6 6-6",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round"}))}function ee(){return e.createElement("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0},e.createElement("path",{d:"M18 6 6 18M6 6l12 12",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round"}))}function q(t,n){let s=n>0?t.titles.current[n-1]:void 0;return s?`Back to ${s}`:"Back"}function te(t){let n=h();return n.canGoBack?e.createElement(R,{iconOnly:!0,"aria-label":t["aria-label"]??q(n,n.path.length),onClick:n.pop},e.createElement(I,null)):null}function pe(){let t=h();return t.inPane?e.createElement(d,null):e.createElement(d,null,t.titles.current[t.path.length])}function de({title:t,children:n,className:s}){let i=h(),c=e.useContext($),u=e.useContext(P),b=e.useContext(E),l=e.useRef(null);if(e.useEffect(()=>{i.setTitle(c,t)},[i,c,t]),e.useEffect(()=>{if(c===0||i.direction!=="push")return;let g=l.current?.querySelector(".kui-NavigatorBar .kui-ToolbarTitle, h1")??l.current;g&&(g.tabIndex=-1,g.focus({preventScroll:!0}))},[]),i.inPane&&b)return e.createElement("div",{ref:l,className:f("kui-NavigatorScreen",s)},e.createElement(j,{title:t},n));if(i.inPane)return e.createElement("div",{ref:l,className:f("kui-NavigatorScreen",s)},e.createElement(ne,{title:t}),n);let v=c===i.path.length,N=e.createElement(G,{as:"h2",size:"4",weight:"medium",truncate:!0},t);return e.createElement("div",{ref:l,className:f("kui-NavigatorScreen",s)},e.createElement("div",{className:"kui-NavigatorBar"},e.createElement(S,{"aria-label":"Navigation"},i.canGoBack&&c>0?e.createElement(R,{iconOnly:!0,"aria-label":q(i,c),onClick:i.pop},e.createElement(I,null)):null,e.createElement(d,{className:"kui-NavigatorBarTitle"},u&&v?e.createElement(u.Title,null,N):N),u?e.createElement(u.Close,null,e.createElement(R,{iconOnly:!0,"aria-label":"Close"},e.createElement(ee,null))):null)),e.createElement("div",{className:"kui-NavigatorBody"},n))}function ne({title:t}){let n=y();return O(n,t),e.useEffect(()=>{if(n)return x(n,!0),()=>x(n,!1)},[n]),null}function fe({value:t,className:n,children:s,...i}){let c=h();return e.createElement("button",{type:"button",...i,className:f("kui-reset","kui-NavigatorLink",n),onClick:()=>c.push(t)},e.createElement("span",{className:"kui-NavigatorLinkLabel"},s),e.createElement("svg",{className:"kui-NavigatorLinkGlyph",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0},e.createElement("path",{d:"m9 18 6-6-6-6",stroke:"currentColor",strokeWidth:1.75,strokeLinecap:"round",strokeLinejoin:"round"})))}export{ve as a,_ as b,ge as c,te as d,pe as e,de as f,fe as g};
|
|
3
|
+
//# sourceMappingURL=chunk-I5TPDYJO.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as s}from"./chunk-KRJTW535.js";import{c as e}from"./chunk-CUNKWFKA.js";import{a as o}from"./chunk-NZJGC6ZW.js";var r=["1","2","3","4"],i=["raised","soft","surface","outline","ghost"],p={...o,size:{type:"enum",className:"kui-r-size",values:r,default:"2",responsive:!0},variant:{type:"enum",className:"kui-variant",values:i,default:"raised"},...e,...s},c={...o},f={...o},d={...o},l={...o};export{p as a,c as b,f as c,d,l as e};
|
|
2
|
+
//# sourceMappingURL=chunk-I77CYEBT.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/components/accordion.props.tsx"],
|
|
4
|
+
"sourcesContent": ["import { asChildPropDef } from '../props/as-child.prop.js';\nimport { colorPropDef } from '../props/color.prop.js';\nimport { radiusPropDef } from '../props/radius.prop.js';\n\nimport type { PropDef } from '../props/prop-def.js';\n\nconst sizes = ['1', '2', '3', '4'] as const;\nconst variants = ['raised', 'soft', 'surface', 'outline', 'ghost'] as const;\n\nconst accordionRootPropDefs = {\n ...asChildPropDef,\n size: { type: 'enum', className: 'kui-r-size', values: sizes, default: '2', responsive: true },\n variant: { type: 'enum', className: 'kui-variant', values: variants, default: 'raised' },\n ...colorPropDef,\n ...radiusPropDef,\n} satisfies {\n size: PropDef<(typeof sizes)[number]>;\n variant: PropDef<(typeof variants)[number]>;\n};\n\nconst accordionItemPropDefs = {\n ...asChildPropDef,\n} satisfies {\n asChild: PropDef<boolean>;\n};\n\nconst accordionHeaderPropDefs = {\n ...asChildPropDef,\n} satisfies {\n asChild: PropDef<boolean>;\n};\n\nconst accordionTriggerPropDefs = {\n ...asChildPropDef,\n} satisfies {\n asChild: PropDef<boolean>;\n};\n\nconst accordionContentPropDefs = {\n ...asChildPropDef,\n} satisfies {\n asChild: PropDef<boolean>;\n};\n\nexport {\n accordionRootPropDefs,\n accordionItemPropDefs,\n accordionHeaderPropDefs,\n accordionTriggerPropDefs,\n accordionContentPropDefs,\n};\n\nexport type AccordionRootOwnProps = {\n size?: (typeof sizes)[number];\n variant?: (typeof variants)[number];\n color?: string;\n radius?: string;\n};\n\nexport type AccordionItemOwnProps = {\n asChild?: boolean;\n};\n\nexport type AccordionHeaderOwnProps = {\n asChild?: boolean;\n};\n\nexport type AccordionTriggerOwnProps = {\n asChild?: boolean;\n};\n\nexport type AccordionContentOwnProps = {\n asChild?: boolean;\n};\n"],
|
|
5
|
+
"mappings": "wHAMA,IAAMA,EAAQ,CAAC,IAAK,IAAK,IAAK,GAAG,EAC3BC,EAAW,CAAC,SAAU,OAAQ,UAAW,UAAW,OAAO,EAE3DC,EAAwB,CAC5B,GAAGC,EACH,KAAM,CAAE,KAAM,OAAQ,UAAW,aAAc,OAAQH,EAAO,QAAS,IAAK,WAAY,EAAK,EAC7F,QAAS,CAAE,KAAM,OAAQ,UAAW,cAAe,OAAQC,EAAU,QAAS,QAAS,EACvF,GAAGG,EACH,GAAGC,CACL,EAKMC,EAAwB,CAC5B,GAAGH,CACL,EAIMI,EAA0B,CAC9B,GAAGJ,CACL,EAIMK,EAA2B,CAC/B,GAAGL,CACL,EAIMM,EAA2B,CAC/B,GAAGN,CACL",
|
|
6
|
+
"names": ["sizes", "variants", "accordionRootPropDefs", "asChildPropDef", "colorPropDef", "radiusPropDef", "accordionItemPropDefs", "accordionHeaderPropDefs", "accordionTriggerPropDefs", "accordionContentPropDefs"]
|
|
7
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import{a as g}from"./chunk-FATCGZZE.js";import{a as f}from"./chunk-OBSZOD5M.js";import{a as C}from"./chunk-7VJF6EXN.js";import{a}from"./chunk-TGRHRMQI.js";import{a as d}from"./chunk-FICBVI4M.js";import{a as h}from"./chunk-HGF4CKRY.js";import{c}from"./chunk-5ON3XLRD.js";import{a as P}from"./chunk-4KBKS3ZE.js";import{c as m}from"./chunk-OKQAVYW4.js";import{a as W}from"./chunk-VQPANPMI.js";var j={};W(j,{Close:()=>E,Content:()=>y,Description:()=>T,Root:()=>S,Title:()=>D,Trigger:()=>R});import*as e from"react";import k from"classnames";import{Dialog as i}from"radix-ui";var S=t=>e.createElement(i.Root,{...t,modal:!0});S.displayName="Sheet.Root";var R=e.forwardRef(({children:t,...o},r)=>e.createElement(i.Trigger,{...o,ref:r,asChild:!0},a(t)));R.displayName="Sheet.Trigger";var{align:Y,...w}=g,u=w,B={Title:({children:t})=>e.createElement(i.Title,{asChild:!0},t),Close:({children:t})=>e.createElement(i.Close,{asChild:!0},t)},v=e.createContext(null),y=e.forwardRef((t,o)=>{let{side:r="start",forceMount:s,container:n,className:N,...x}=t,b=c(x,u.size),H={left:"start",right:"end",start:"start",end:"end",top:"top",bottom:"bottom"}[r],{className:O,...l}=m(b,u),z=e.useRef(0),M=e.useCallback(p=>{typeof o=="function"?o(p):o&&(o.current=p)},[o]);return C(),e.createElement(i.Portal,{container:n,forceMount:s},e.createElement(v.Provider,{value:z},e.createElement(h,{asChild:!0},e.createElement(i.Overlay,{className:"kui-BaseDialogOverlay kui-DialogOverlay kui-SheetOverlay"},e.createElement(i.Content,{...l,ref:M,className:k("kui-BaseDialogContent","kui-SheetContent",N,O),"data-side":H,"aria-modal":"true",children:e.createElement(P.Provider,{value:B},l.children)})))))});y.displayName="Sheet.Content";var D=e.forwardRef(({size:t="4",weight:o="medium",...r},s)=>{let n=e.useContext(v);return e.useLayoutEffect(()=>{if(n)return n.current+=1,()=>{n.current-=1}},[n]),e.createElement(i.Title,{asChild:!0},e.createElement(f,{ref:s,size:t,weight:o,...r}))});D.displayName="Sheet.Title";var T=e.forwardRef(({size:t="2",emphasis:o="medium",...r},s)=>e.createElement(i.Description,{asChild:!0},e.createElement(d,{ref:s,size:t,emphasis:o,...r})));T.displayName="Sheet.Description";var E=e.forwardRef(({children:t,...o},r)=>e.createElement(i.Close,{...o,ref:r,asChild:!0},a(t)));E.displayName="Sheet.Close";export{S as a,R as b,y as c,D as d,T as e,E as f,j as g};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-J7MIXG6M.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/components/sheet.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client';\n\n/**\n * Sheet\n *\n * A side-placed overlay built on top of Radix Dialog. It inherits accessibility,\n * focus management, overlay behavior, and sizing scales from the base dialog, and\n * adds side placement, suited for navigation panels and drawers.\n *\n * Structure mirrors Dialog:\n * - Root, Trigger, Content, Title, Description, Close\n *\n * Notes\n * - Side: set with `side` on `Sheet.Content`. Aliases: `left` \u2192 `start`, `right` \u2192 `end`.\n * - Sizing: reuses Dialog content prop defs (width/min/max/height/size). Size follows the\n * Theme size; start/end sheets cap at the size's overlay width unless maxWidth is set.\n * - A11y: provide an accessible name via `Sheet.Title` or `aria-label` on `Sheet.Content`.\n * Radix owns the focus trap, initial focus and the return of focus to the trigger.\n *\n * Example\n * <Sheet.Root>\n * <Sheet.Trigger>\n * <Button>Open</Button>\n * </Sheet.Trigger>\n * <Sheet.Content side=\"end\" width={{ initial: '280px', md: '360px' }}>\n * <Sheet.Title>Details</Sheet.Title>\n * ...\n * <Sheet.Close>\n * <Button>Close</Button>\n * </Sheet.Close>\n * </Sheet.Content>\n * </Sheet.Root>\n */\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { Dialog as DialogPrimitive } from 'radix-ui';\n\nimport { dialogContentPropDefs } from './dialog.props.js';\nimport type { DialogContentOwnProps } from './dialog.props.js';\nimport { PortalTheme } from './_internal/portal-theme.js';\nimport { NavigatorHostContext, type NavigatorHost } from './_internal/navigator-host.js';\nimport { Heading } from './heading.js';\nimport { Text } from './text.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { useThemeSizeProps } from '../hooks/theme-size.js';\nimport { requireReactElement } from '../helpers/require-react-element.js';\nimport { useBodyPointerEventsCleanup } from '../hooks/use-body-pointer-events-cleanup.js';\n\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { HeadingProps } from './heading.js';\n\n/**\n * Supported sides for the Sheet.\n * Aliases are normalized RTL-aware: `left` \u2192 `start`, `right` \u2192 `end`.\n */\ntype SheetSide = 'start' | 'end' | 'top' | 'bottom' | 'left' | 'right';\n\n/**\n * Sheet is a side-placed overlay built on the Dialog primitive.\n * It reuses Dialog's accessibility, focus, overlay, and size scales, while adding side placement.\n */\n\n// Root\n/**\n * Props for `Sheet.Root` (Radix Dialog root with `modal` forced on).\n */\ninterface SheetRootProps extends ComponentPropsWithout<typeof DialogPrimitive.Root, 'modal'> {}\nconst Root: React.FC<SheetRootProps> = (props) => <DialogPrimitive.Root {...props} modal />;\nRoot.displayName = 'Sheet.Root';\n\n// Trigger\n/** Element type for `Sheet.Trigger`. */\ntype SheetTriggerElement = React.ElementRef<typeof DialogPrimitive.Trigger>;\n/** Props for `Sheet.Trigger` (expects a single element child). */\ninterface SheetTriggerProps extends ComponentPropsWithout<typeof DialogPrimitive.Trigger, RemovedProps> {}\nconst Trigger = React.forwardRef<SheetTriggerElement, SheetTriggerProps>(({ children, ...props }, ref) => (\n <DialogPrimitive.Trigger {...props} ref={ref} asChild>\n {requireReactElement(children)}\n </DialogPrimitive.Trigger>\n));\nTrigger.displayName = 'Sheet.Trigger';\n\n// Content\n/** Element type for `Sheet.Content`. */\n// Reuse dialog content prop defs for size/width/height tokens.\n// Built once at module scope: `extractProps` memoises on the identity of the\n// prop def objects it is handed, so rebuilding these per render would recompile\n// them every time a sheet renders.\nconst { align: _alignPropDef, ...dialogPropDefsForSheet } = dialogContentPropDefs;\nconst sheetPropDefs = dialogPropDefsForSheet;\n\n/** What a Navigator screen in this panel uses: its title names the sheet, its close closes it. */\nconst sheetNavigatorHost: NavigatorHost = {\n Title: ({ children }) => <DialogPrimitive.Title asChild>{children}</DialogPrimitive.Title>,\n Close: ({ children }) => <DialogPrimitive.Close asChild>{children}</DialogPrimitive.Close>,\n};\n\n/** Counts the Sheet.Title elements mounted inside a Sheet.Content, for the dev-only name check. */\nconst SheetTitleCountContext = React.createContext<React.MutableRefObject<number> | null>(null);\n\ntype SheetContentElement = React.ElementRef<typeof DialogPrimitive.Content>;\ninterface SheetContentProps\n extends ComponentPropsWithout<typeof DialogPrimitive.Content, RemovedProps>,\n Omit<DialogContentOwnProps, 'align'> {\n /** Side where the Sheet should appear. `left`/`right` alias to `start`/`end`. */\n side?: SheetSide;\n /** Optional DOM container to portal into. Defaults to `document.body`. */\n container?: React.ComponentPropsWithoutRef<typeof DialogPrimitive.Portal>['container'];\n}\n\n/**\n * Renders the Sheet panel. Normalizes left/right to logical start/end and\n * forwards dialog sizing props. Provide an accessible name via `Sheet.Title`\n * or `aria-label`.\n */\nconst Content = React.forwardRef<SheetContentElement, SheetContentProps>((allProps, forwardedRef) => {\n const { side = 'start', forceMount, container, className, ...ownProps } = allProps;\n const restProps = useThemeSizeProps(ownProps, sheetPropDefs.size);\n const normalizedSideMap: Record<SheetSide, 'start' | 'end' | 'top' | 'bottom'> = {\n left: 'start',\n right: 'end',\n start: 'start',\n end: 'end',\n top: 'top',\n bottom: 'bottom',\n };\n const normalizedSide = normalizedSideMap[side];\n // Size/width/height class names come from the dialog defs \u2014 see `sheetPropDefs`.\n const { className: extractedClassName, ...contentProps } = extractProps(restProps, sheetPropDefs);\n\n // Dev-only a11y guard: the panel needs a name. A Sheet.Title anywhere inside counts it\n // in a layout effect, which runs before this ref is attached, so nesting doesn't matter.\n const titleCountRef = React.useRef(0);\n const combinedRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n if (typeof forwardedRef === 'function') {\n forwardedRef(node);\n } else if (forwardedRef) {\n forwardedRef.current = node;\n }\n if (process.env.NODE_ENV !== 'production' && node) {\n const hasName = titleCountRef.current > 0 || Boolean(node.getAttribute('aria-label')) || Boolean(node.getAttribute('aria-labelledby'));\n if (!hasName) {\n console.warn('Sheet.Content: Missing accessible name. Include Sheet.Title inside it or provide aria-label.');\n }\n }\n },\n [forwardedRef],\n );\n\n useBodyPointerEventsCleanup();\n\n return (\n <DialogPrimitive.Portal container={container} forceMount={forceMount}>\n <SheetTitleCountContext.Provider value={titleCountRef}>\n <PortalTheme asChild>\n <DialogPrimitive.Overlay className=\"kui-BaseDialogOverlay kui-DialogOverlay kui-SheetOverlay\">\n <DialogPrimitive.Content\n {...contentProps}\n ref={combinedRef}\n className={classNames('kui-BaseDialogContent', 'kui-SheetContent', className, extractedClassName)}\n data-side={normalizedSide}\n aria-modal=\"true\"\n children={<NavigatorHostContext.Provider value={sheetNavigatorHost}>{contentProps.children}</NavigatorHostContext.Provider>}\n />\n </DialogPrimitive.Overlay>\n </PortalTheme>\n </SheetTitleCountContext.Provider>\n </DialogPrimitive.Portal>\n );\n});\nContent.displayName = 'Sheet.Content';\n\n// Title - renders as Heading with sensible defaults\ntype SheetTitleElement = React.ElementRef<typeof Heading>;\ntype SheetTitleProps = HeadingProps;\n/** Accessible title for the Sheet. Renders as Heading with sensible defaults. */\nconst Title = React.forwardRef<SheetTitleElement, SheetTitleProps>(({ size = '4', weight = 'medium', ...props }, ref) => {\n const titleCountRef = React.useContext(SheetTitleCountContext);\n React.useLayoutEffect(() => {\n if (!titleCountRef) return;\n titleCountRef.current += 1;\n return () => {\n titleCountRef.current -= 1;\n };\n }, [titleCountRef]);\n return (\n <DialogPrimitive.Title asChild>\n <Heading ref={ref} size={size} weight={weight} {...props} />\n </DialogPrimitive.Title>\n );\n});\nTitle.displayName = 'Sheet.Title';\n\n// Description - renders as Text with sensible defaults\ntype SheetDescriptionElement = React.ElementRef<typeof Text>;\ntype SheetDescriptionProps = React.ComponentPropsWithoutRef<typeof Text>;\n/** Supplementary description text for Sheet content. Renders as Text with sensible defaults. */\nconst Description = React.forwardRef<SheetDescriptionElement, SheetDescriptionProps>(({ size = '2', emphasis = 'medium', ...rest }, ref) => (\n <DialogPrimitive.Description asChild>\n <Text ref={ref} size={size} emphasis={emphasis} {...rest} />\n </DialogPrimitive.Description>\n));\nDescription.displayName = 'Sheet.Description';\n\ntype SheetCloseElement = React.ElementRef<typeof DialogPrimitive.Close>;\ninterface SheetCloseProps extends ComponentPropsWithout<typeof DialogPrimitive.Close, RemovedProps> {}\n/** Close button for the Sheet. Expects a single element child rendered via `asChild`. */\nconst Close = React.forwardRef<SheetCloseElement, SheetCloseProps>(({ children, ...props }, ref) => (\n <DialogPrimitive.Close {...props} ref={ref} asChild>\n {requireReactElement(children)}\n </DialogPrimitive.Close>\n));\nClose.displayName = 'Sheet.Close';\n\nexport { Root, Trigger, Content, Title, Description, Close };\nexport type {\n SheetRootProps as RootProps,\n SheetTriggerProps as TriggerProps,\n SheetContentProps as ContentProps,\n SheetTitleProps as TitleProps,\n SheetDescriptionProps as DescriptionProps,\n SheetCloseProps as CloseProps,\n};\n"],
|
|
5
|
+
"mappings": ";sYAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,WAAAE,EAAA,YAAAC,EAAA,gBAAAC,EAAA,SAAAC,EAAA,UAAAC,EAAA,YAAAC,IAkCA,UAAYC,MAAW,QACvB,OAAOC,MAAgB,aACvB,OAAS,UAAUC,MAAuB,WAgC1C,IAAMC,EAAkCC,GAAU,gBAACC,EAAgB,KAAhB,CAAsB,GAAGD,EAAO,MAAK,GAAC,EACzFD,EAAK,YAAc,aAOnB,IAAMG,EAAgB,aAAmD,CAAC,CAAE,SAAAC,EAAU,GAAGH,CAAM,EAAGI,IAChG,gBAACH,EAAgB,QAAhB,CAAyB,GAAGD,EAAO,IAAKI,EAAK,QAAO,IAClDC,EAAoBF,CAAQ,CAC/B,CACD,EACDD,EAAQ,YAAc,gBAQtB,GAAM,CAAE,MAAOI,EAAe,GAAGC,CAAuB,EAAIC,EACtDC,EAAgBF,EAGhBG,EAAoC,CACxC,MAAO,CAAC,CAAE,SAAAP,CAAS,IAAM,gBAACF,EAAgB,MAAhB,CAAsB,QAAO,IAAEE,CAAS,EAClE,MAAO,CAAC,CAAE,SAAAA,CAAS,IAAM,gBAACF,EAAgB,MA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A,EAAc,SAAW,EAClB,IAAM,CACXA,EAAc,SAAW,CAC3B,CACF,EAAG,CAACA,CAAa,CAAC,EAEhB,gBAACzB,EAAgB,MAAhB,CAAsB,QAAO,IAC5B,gBAACmC,EAAA,CAAQ,IAAKhC,EAAK,KAAM8B,EAAM,OAAQC,EAAS,GAAGnC,EAAO,CAC5D,CAEJ,CAAC,EACDiC,EAAM,YAAc,cAMpB,IAAMI,EAAoB,aAA2D,CAAC,CAAE,KAAAH,EAAO,IAAK,SAAAI,EAAW,SAAU,GAAGC,CAAK,EAAGnC,IAClI,gBAACH,EAAgB,YAAhB,CAA4B,QAAO,IAClC,gBAACuC,EAAA,CAAK,IAAKpC,EAAK,KAAM8B,EAAM,SAAUI,EAAW,GAAGC,EAAM,CAC5D,CACD,EACDF,EAAY,YAAc,oBAK1B,IAAMI,EAAc,aAA+C,CAAC,CAAE,SAAAtC,EAAU,GAAGH,CAAM,EAAGI,IAC1F,gBAACH,EAAgB,MAAhB,CAAuB,GAAGD,EAAO,IAAKI,EAAK,QAAO,IAChDC,EAAoBF,CAAQ,CAC/B,CACD,EACDsC,EAAM,YAAc",
|
|
6
|
+
"names": ["sheet_exports", "__export", "Close", "Content", "Description", "Root", "Title", "Trigger", "React", "classNames", "DialogPrimitive", "Root", "props", "DialogPrimitive", "Trigger", "children", "ref", "requireReactElement", "_alignPropDef", "dialogPropDefsForSheet", "dialogContentPropDefs", "sheetPropDefs", "sheetNavigatorHost", "SheetTitleCountContext", "Content", "allProps", "forwardedRef", "side", "forceMount", "container", "className", "ownProps", "restProps", "useThemeSizeProps", "normalizedSide", "extractedClassName", "contentProps", "extractProps", "titleCountRef", "combinedRef", "node", "useBodyPointerEventsCleanup", "PortalTheme", "classNames", "NavigatorHostContext", "Title", "size", "weight", "Heading", "Description", "emphasis", "rest", "Text", "Close"]
|
|
7
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{a as m,c as E,f as H,g as N}from"./chunk-XUCR7L4G.js";import{a as R,e as p}from"./chunk-
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
import{a as m,c as E,f as H,g as N}from"./chunk-XUCR7L4G.js";import{a as R,e as p}from"./chunk-4OJRLS5N.js";import{a as y,b as x,c as O}from"./chunk-KGCGT4MJ.js";import{a as M,b as T,c as w}from"./chunk-4TTRPCGG.js";import{a as v}from"./chunk-MXEOE4LA.js";import{a as B}from"./chunk-G66WDIIV.js";import{b as S}from"./chunk-VWRPVM5K.js";import{o as C}from"./chunk-5BXCPANF.js";import*as e from"react";import re from"classnames";import{useComposedRefs as pe}from"radix-ui/internal";var me={controlled:"open",default:"defaultOpen"},U=e.forwardRef((k,I)=>{let{className:V,presentation:A="fixed",defaultOpen:L,open:$,onOpenChange:q,expandedSize:t=200,minSize:n=100,maxSize:a=400,resizable:d=!1,collapsible:D=!0,onExpand:F,onCollapse:W,onResize:_,onResizeStart:j,onResizeEnd:G,snapPoints:s,snapTolerance:K,collapseThreshold:i,paneId:l,persistence:r,children:J,style:Q,size:u,defaultSize:c,onSizeChange:X,sizeUpdate:Y,sizeUpdateMs:Z=50,flush:f=!0,id:ee,...P}=k,{table:z,attributes:oe}=O(A,"fixed"),o=y({name:"bottom",label:"Bottom",propNames:me,id:ee,controlled:m($),defaultValue:m(L),presentationTable:z,builtIn:E,onChange:(ie,le)=>q?.(ie!=="closed",{reason:le}),onExpand:F,onCollapse:W,size:t});C("bottom",f),e.useEffect(()=>{(s!==void 0||i!==void 0||l!==void 0||r!==void 0)&&void 0},[s,i,l,r]);let h=e.useRef(null),te=pe(I,o.setElement,h),ne=T({name:"bottom",elementId:o.id,elementRef:h,cssVarName:"--bottom-size",orientation:"horizontal",edge:"start",growth:H,expandedSize:t,minSize:n,maxSize:a,resizable:d,collapsible:D,size:u,defaultSize:c,onSizeChange:X,sizeUpdate:Y,sizeUpdateMs:Z,onResize:_,onResizeStart:j,onResizeEnd:G,snapPoints:s,snapTolerance:K,collapseThreshold:i,paneId:l,persistence:r,overlaying:o.overlaying,overlayingNow:()=>z[B()]==="overlay",requestCollapse:()=>o.setValue("closed","toggle"),requestToggle:()=>o.toggle("toggle")}),b=M(u,c,n,a),{handles:g,content:ae}=w(J,p),se=d&&o.shown!==!1&&!o.overlaying?e.createElement(v.Provider,{value:ne},g.length>0?g:e.createElement(R,null)):null;return e.createElement("div",{...N(P),id:o.id,ref:te,className:re("kui-ShellPane","kui-ShellBottom",V),...x(o,oe),"data-flush":f||void 0,tabIndex:o.overlaying?-1:P.tabIndex,style:{...Q,"--bottom-expanded-size":`${t}px`,...b?{"--bottom-size":b}:{},"--bottom-min-size":`${n}px`,"--bottom-max-size":`${a}px`}},e.createElement("div",{className:"kui-ShellBottomContent"},e.createElement(S,null,ae)),se)});U.displayName="Shell.Bottom";U.Handle=p;export{U as a};
|
|
3
|
+
//# sourceMappingURL=chunk-M26LLCQC.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{a as o}from"./chunk-
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
import{a as o}from"./chunk-XGV7KNSE.js";import{z as e}from"zod";var n=o.extend({tooltip:e.string().optional().describe("Content to display in the tooltip on hover/focus"),tooltipSide:e.enum(["top","right","bottom","left"]).optional().default("top").describe("Side of the button where the tooltip should appear"),emphasis:e.enum(["loud","medium","quiet"]).optional().describe("The button's rank: loud (solid), medium (raised) or quiet (ghost). Not with variant."),iconOnly:e.boolean().optional().default(!1).describe("Square button holding only an icon; needs aria-label"),fullWidth:e.boolean().optional().default(!1).describe("Expands the button to fill its container"),tooltipAlign:e.enum(["start","center","end"]).optional().default("center").describe("Alignment of the tooltip relative to the button"),tooltipDelayDuration:e.number().optional().describe("Delay before showing the tooltip (in milliseconds)"),tooltipDisableHoverableContent:e.boolean().optional().default(!1).describe("Whether to disable hoverable content behavior")}).strict(),a=n.refine(t=>!t.iconOnly||!!(t["aria-label"]||t["aria-labelledby"]),{message:"An iconOnly Button must have either 'aria-label' or 'aria-labelledby' for accessibility",path:["aria-label"]});function r(t){return t}export{n as a,a as b,r as c};
|
|
3
|
+
//# sourceMappingURL=chunk-MLHS2GWL.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{a as d}from"./chunk-OAJ5DARR.js";import{c}from"./chunk-5ON3XLRD.js";import{a as u}from"./chunk-DFQIIYLD.js";import{a as f}from"./chunk-L54FWKJE.js";import{a as b,c as r}from"./chunk-OKQAVYW4.js";import{a as x}from"./chunk-VQPANPMI.js";var A={};x(A,{Body:()=>y,Cell:()=>w,ColumnHeaderCell:()=>v,Header:()=>T,Root:()=>R,Row:()=>C,RowHeaderCell:()=>H});import*as e from"react";import t from"classnames";var B=["1","2","3","4"],g=["surface","ghost"],O=["auto","fixed"],p={size:{type:"enum",className:"kui-r-size",values:B,default:"2",responsive:!0},variant:{type:"enum",className:"kui-variant",values:g,default:"ghost"},layout:{type:"enum",className:"kui-r-tl",values:O,responsive:!0}},W=["start","center","end","baseline"],P={align:{type:"enum",className:"kui-r-va",values:W,parseValue:j,responsive:!0}};function j(a){return{baseline:"baseline",start:"top",center:"middle",end:"bottom"}[a]}var z=["start","center","end"],n={justify:{type:"enum",className:"kui-r-ta",values:z,responsive:!0},...f,...d};var{layout:M,...V}=p,R=e.forwardRef((a,o)=>{let l=c(a,p.size),{className:s,children:N,layout:h,"aria-label":m,"aria-labelledby":i,"aria-describedby":D,...E}=r(l,V),k=b({value:h,className:p.layout.className,propValues:p.layout.values});return e.createElement("div",{ref:o,className:t("kui-TableRoot",s),...E},e.createElement(u,{"aria-label":m,"aria-labelledby":i},e.createElement("table",{className:t("kui-TableRootTable",k),"aria-label":m,"aria-labelledby":i,"aria-describedby":D},N)))});R.displayName="Table.Root";var T=e.forwardRef(({className:a,...o},l)=>e.createElement("thead",{...o,ref:l,className:t("kui-TableHeader",a)}));T.displayName="Table.Header";var y=e.forwardRef(({className:a,...o},l)=>e.createElement("tbody",{...o,ref:l,className:t("kui-TableBody",a)}));y.displayName="Table.Body";var C=e.forwardRef((a,o)=>{let{className:l,...s}=r(a,P);return e.createElement("tr",{...s,ref:o,className:t("kui-TableRow",l)})});C.displayName="Table.Row";var w=e.forwardRef((a,o)=>{let{className:l,...s}=r(a,n);return e.createElement("td",{className:t("kui-TableCell",l),ref:o,...s})});w.displayName="Table.Cell";var v=e.forwardRef((a,o)=>{let{className:l,...s}=r(a,n);return e.createElement("th",{className:t("kui-TableCell","kui-TableColumnHeaderCell",l),scope:"col",ref:o,...s})});v.displayName="Table.ColumnHeaderCell";var H=e.forwardRef((a,o)=>{let{className:l,...s}=r(a,n);return e.createElement("th",{className:t("kui-TableCell","kui-TableRowHeaderCell",l),scope:"row",ref:o,...s})});H.displayName="Table.RowHeaderCell";export{R as a,T as b,y as c,C as d,w as e,v as f,H as g,A as h};
|
|
3
|
+
//# sourceMappingURL=chunk-MPLBIPJ6.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/components/table.tsx", "../../src/components/table.props.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\n\nimport { tableRootPropDefs, tableRowPropDefs, tableCellPropDefs } from './table.props.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { useThemeSizeProps } from '../hooks/theme-size.js';\nimport { getResponsiveClassNames } from '../helpers/get-responsive-styles.js';\nimport { ScrollArea } from './scroll-area.js';\n\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { GetPropDefTypes } from '../props/prop-def.js';\n\n// Built once: `extractProps` caches its compiled prop defs on the identity of this object, so\n// making it inside the component would recompile them on every render.\nconst { layout: _layoutPropDef, ...rootPropDefs } = tableRootPropDefs;\n\ntype TableRootElement = React.ElementRef<'div'>;\ntype TableRootOwnProps = GetPropDefTypes<typeof tableRootPropDefs>;\ninterface TableRootProps\n extends ComponentPropsWithout<'div', RemovedProps>,\n TableRootOwnProps {}\nconst TableRoot = React.forwardRef<TableRootElement, TableRootProps>((ownProps, forwardedRef) => {\n const props = useThemeSizeProps(ownProps, tableRootPropDefs.size);\n const {\n className,\n children,\n layout,\n // The table is what gets named, not the scroll wrapper around it.\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n ...rootProps\n } = extractProps(props, rootPropDefs);\n const tableLayoutClassNames = getResponsiveClassNames({\n value: layout,\n className: tableRootPropDefs.layout.className,\n propValues: tableRootPropDefs.layout.values,\n });\n return (\n <div ref={forwardedRef} className={classNames('kui-TableRoot', className)} {...rootProps}>\n {/* An overflowing scroller is a tab stop, so it carries the table's name and reads as a region. */}\n <ScrollArea aria-label={ariaLabel} aria-labelledby={ariaLabelledBy}>\n <table\n className={classNames('kui-TableRootTable', tableLayoutClassNames)}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n >\n {children}\n </table>\n </ScrollArea>\n </div>\n );\n});\nTableRoot.displayName = 'Table.Root';\n\ntype TableHeaderElement = React.ElementRef<'thead'>;\ninterface TableHeaderProps extends ComponentPropsWithout<'thead', RemovedProps> {}\nconst TableHeader = React.forwardRef<TableHeaderElement, TableHeaderProps>(\n ({ className, ...props }, forwardedRef) => (\n <thead {...props} ref={forwardedRef} className={classNames('kui-TableHeader', className)} />\n )\n);\nTableHeader.displayName = 'Table.Header';\n\ntype TableBodyElement = React.ElementRef<'tbody'>;\ninterface TableBodyProps extends ComponentPropsWithout<'tbody', RemovedProps> {}\nconst TableBody = React.forwardRef<TableBodyElement, TableBodyProps>(\n ({ className, ...props }, forwardedRef) => (\n <tbody {...props} ref={forwardedRef} className={classNames('kui-TableBody', className)} />\n )\n);\nTableBody.displayName = 'Table.Body';\n\ntype TableRowElement = React.ElementRef<'tr'>;\ntype TableRowOwnProps = GetPropDefTypes<typeof tableRowPropDefs>;\ninterface TableRowProps extends ComponentPropsWithout<'tr', RemovedProps>, TableRowOwnProps {}\nconst TableRow = React.forwardRef<TableRowElement, TableRowProps>((props, forwardedRef) => {\n const { className, ...rowProps } = extractProps(props, tableRowPropDefs);\n return <tr {...rowProps} ref={forwardedRef} className={classNames('kui-TableRow', className)} />;\n});\nTableRow.displayName = 'Table.Row';\n\ntype TableCellElement = React.ElementRef<'td'>;\ntype TableCellOwnProps = GetPropDefTypes<typeof tableCellPropDefs>;\ninterface TableCellProps\n extends ComponentPropsWithout<'td', RemovedProps | 'width'>,\n TableCellOwnProps {}\nconst TableCell = React.forwardRef<TableCellElement, TableCellProps>((props, forwardedRef) => {\n const { className, ...cellProps } = extractProps(props, tableCellPropDefs);\n return <td className={classNames('kui-TableCell', className)} ref={forwardedRef} {...cellProps} />;\n});\nTableCell.displayName = 'Table.Cell';\n\ntype TableColumnHeaderCellElement = React.ElementRef<'th'>;\ninterface TableColumnHeaderCellProps\n extends ComponentPropsWithout<'th', RemovedProps>,\n TableCellOwnProps {}\nconst TableColumnHeaderCell = React.forwardRef<\n TableColumnHeaderCellElement,\n TableColumnHeaderCellProps\n>((props, forwardedRef) => {\n const { className, ...cellProps } = extractProps(props, tableCellPropDefs);\n return (\n <th\n className={classNames('kui-TableCell', 'kui-TableColumnHeaderCell', className)}\n scope=\"col\"\n ref={forwardedRef}\n {...cellProps}\n />\n );\n});\nTableColumnHeaderCell.displayName = 'Table.ColumnHeaderCell';\n\ntype TableRowHeaderCellElement = React.ElementRef<'th'>;\ninterface TableRowHeaderCellProps\n extends ComponentPropsWithout<'th', RemovedProps>,\n TableCellOwnProps {}\nconst TableRowHeaderCell = React.forwardRef<TableRowHeaderCellElement, TableRowHeaderCellProps>(\n (props, forwardedRef) => {\n const { className, ...cellProps } = extractProps(props, tableCellPropDefs);\n return (\n <th\n className={classNames('kui-TableCell', 'kui-TableRowHeaderCell', className)}\n scope=\"row\"\n ref={forwardedRef}\n {...cellProps}\n />\n );\n }\n);\nTableRowHeaderCell.displayName = 'Table.RowHeaderCell';\n\nexport {\n TableRoot as Root,\n TableHeader as Header,\n TableBody as Body,\n TableRow as Row,\n TableCell as Cell,\n TableColumnHeaderCell as ColumnHeaderCell,\n TableRowHeaderCell as RowHeaderCell,\n};\n\nexport type {\n TableRootProps as RootProps,\n TableHeaderProps as HeaderProps,\n TableBodyProps as BodyProps,\n TableRowProps as RowProps,\n TableCellProps as CellProps,\n TableColumnHeaderCellProps as ColumnHeaderCellProps,\n TableRowHeaderCellProps as RowHeaderCellProps,\n};\n", "import { paddingPropDefs } from '../props/padding.props.js';\nimport { widthPropDefs } from '../props/width.props.js';\n\nimport type { PropDef } from '../props/prop-def.js';\n\nconst sizes = ['1', '2', '3', '4'] as const;\nconst variants = ['surface', 'ghost'] as const;\nconst layoutValues = ['auto', 'fixed'] as const;\n\nconst tableRootPropDefs = {\n size: {\n type: 'enum',\n className: 'kui-r-size',\n values: sizes,\n default: '2',\n responsive: true,\n },\n variant: {\n type: 'enum',\n className: 'kui-variant',\n values: variants,\n default: 'ghost',\n },\n layout: {\n type: 'enum',\n className: 'kui-r-tl',\n values: layoutValues,\n responsive: true,\n },\n} satisfies {\n size: PropDef<(typeof sizes)[number]>;\n variant: PropDef<(typeof variants)[number]>;\n layout: PropDef<(typeof layoutValues)[number]>;\n};\n\nconst rowAlign = ['start', 'center', 'end', 'baseline'] as const;\n\nconst tableRowPropDefs = {\n align: {\n type: 'enum',\n className: 'kui-r-va',\n values: rowAlign,\n parseValue: parseAlignValue,\n responsive: true,\n },\n} satisfies {\n align: PropDef<(typeof rowAlign)[number]>;\n};\n\nfunction parseAlignValue(value: string) {\n return {\n baseline: 'baseline',\n start: 'top',\n center: 'middle',\n end: 'bottom',\n }[value];\n}\n\nconst justifyValues = ['start', 'center', 'end'] as const;\n\nconst tableCellPropDefs = {\n justify: {\n type: 'enum',\n className: 'kui-r-ta',\n values: justifyValues,\n responsive: true,\n },\n ...widthPropDefs,\n ...paddingPropDefs,\n} satisfies {\n justify: PropDef<(typeof justifyVal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AC,EACDD,EAAU,YAAc,aAMxB,IAAMG,EAA8B,aAGlC,CAACtB,EAAOD,IAAiB,CACzB,GAAM,CAAE,UAAAG,EAAW,GAAGkB,CAAU,EAAIX,EAAaT,EAAOqB,CAAiB,EACzE,OACE,gBAAC,MACC,UAAWT,EAAW,gBAAiB,4BAA6BV,CAAS,EAC7E,MAAM,MACN,IAAKH,EACJ,GAAGqB,EACN,CAEJ,CAAC,EACDE,EAAsB,YAAc,yBAMpC,IAAMC,EAA2B,aAC/B,CAACvB,EAAOD,IAAiB,CACvB,GAAM,CAAE,UAAAG,EAAW,GAAGkB,CAAU,EAAIX,EAAaT,EAAOqB,CAAiB,EACzE,OACE,gBAAC,MACC,UAAWT,EAAW,gBAAiB,yBAA0BV,CAAS,EAC1E,MAAM,MACN,IAAKH,EACJ,GAAGqB,EACN,CAEJ,CACF,EACAG,EAAmB,YAAc",
|
|
6
|
+
"names": ["table_exports", "__export", "TableBody", "TableCell", "TableColumnHeaderCell", "TableHeader", "TableRoot", "TableRow", "TableRowHeaderCell", "React", "classNames", "sizes", "variants", "layoutValues", "tableRootPropDefs", "rowAlign", "tableRowPropDefs", "parseAlignValue", "value", "justifyValues", "tableCellPropDefs", "widthPropDefs", "paddingPropDefs", "_layoutPropDef", "rootPropDefs", "tableRootPropDefs", "TableRoot", "ownProps", "forwardedRef", "props", "useThemeSizeProps", "className", "children", "layout", "ariaLabel", "ariaLabelledBy", "ariaDescribedBy", "rootProps", "extractProps", "tableLayoutClassNames", "getResponsiveClassNames", "classNames", "ScrollArea", "TableHeader", "TableBody", "TableRow", "rowProps", "tableRowPropDefs", "TableCell", "cellProps", "tableCellPropDefs", "TableColumnHeaderCell", "TableRowHeaderCell"]
|
|
7
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import*as e from"react";var t=e.createContext(null);function o(){let n=e.useContext(t);if(!n)throw new Error("Shell.Handle must be used within a resizable pane");return n}export{t as a,o as b};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-MXEOE4LA.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/components/_internal/shell-resize.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport type { PaneName } from '../shell.types.js';\n\nexport interface PaneResizeContextValue {\n containerRef: React.RefObject<HTMLElement | null>;\n /** The pane the handle resizes, for `aria-controls`. */\n controls: string;\n cssVarName: string;\n minSize: number;\n maxSize: number;\n defaultSize: number;\n /** The size the pane starts at, for the handle's first `aria-valuenow`. */\n startSize: number;\n orientation: 'vertical' | 'horizontal';\n edge: 'start' | 'end';\n /**\n * +1 when moving the pointer toward the end of its axis grows the pane, -1\n * when it shrinks it. Read once when a drag starts, with the pane's\n * resolved direction, so no move pays for a style read.\n */\n growth: (isRtl: boolean) => 1 | -1;\n onResize?: (size: number) => void;\n onResizeStart?: (size: number) => void;\n onResizeEnd?: (size: number) => void;\n target: PaneName;\n collapsible: boolean;\n snapPoints?: number[];\n snapTolerance: number;\n collapseThreshold?: number;\n requestCollapse?: () => void;\n requestToggle?: () => void;\n}\n\nexport const PaneResizeContext = React.createContext<PaneResizeContextValue | null>(null);\n\nexport function usePaneResize() {\n const ctx = React.useContext(PaneResizeContext);\n if (!ctx) throw new Error('Shell.Handle must be used within a resizable pane');\n return ctx;\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,UAAYA,MAAW,QAiChB,IAAMC,EAA0B,gBAA6C,IAAI,EAEjF,SAASC,GAAgB,CAC9B,IAAMC,EAAY,aAAWF,CAAiB,EAC9C,GAAI,CAACE,EAAK,MAAM,IAAI,MAAM,mDAAmD,EAC7E,OAAOA,CACT",
|
|
6
|
+
"names": ["React", "PaneResizeContext", "usePaneResize", "ctx"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{a as z}from"./chunk-HGF4CKRY.js";import{b as O}from"./chunk-FVRVBB6O.js";import{a as N}from"./chunk-BUXK5VGR.js";import{b as E,c as w}from"./chunk-GKDGNPBD.js";import{b as x}from"./chunk-5ON3XLRD.js";import{c as g}from"./chunk-HBWBPBSA.js";import{a as L}from"./chunk-KOAWATCI.js";import{b as D}from"./chunk-XU74PNM2.js";import{c as C}from"./chunk-OKQAVYW4.js";import{a as _}from"./chunk-VQPANPMI.js";var te={};_(te,{Content:()=>H,Group:()=>K,Item:()=>W,Label:()=>j,Root:()=>B,Separator:()=>F,Trigger:()=>V});import*as e from"react";import u from"classnames";import{Select as r,ScrollArea as y}from"radix-ui";import{useComposedRefs as X,useLayoutEffect as Z}from"radix-ui/internal";var J=["1","2","3","4"],v={size:{type:"enum",className:"kui-r-size",values:J,default:"2",responsive:!0}},Q=["raised","surface","soft","outline","ghost"],G={variant:{type:"enum",className:"kui-variant",values:Q,default:"raised"},error:{type:"boolean"},loading:{type:"boolean"},disabled:{type:"boolean"},readOnly:{type:"boolean"},...g,...D,placeholder:{type:"ReactNode"}},M={...g};var A={size:v.size},$=[" ","Enter","ArrowUp","ArrowDown"],h=e.createContext({}),B=o=>{let{children:t,size:a,open:S,defaultOpen:f,onOpenChange:c,...p}=o,s=x(a,v.size),[l,i]=e.useState(f??!1),m=S??l,P=e.useCallback(d=>{i(d),c?.(d)},[c]);return e.createElement(r.Root,{...p,open:m,onOpenChange:P},e.createElement(h.Provider,{value:e.useMemo(()=>({size:s,open:m}),[s,m])},t))};B.displayName="Select.Root";var V=e.forwardRef((o,t)=>{let a=e.useContext(h),{children:S,className:f,color:c,radius:p,placeholder:s,error:l,loading:i,disabled:m,readOnly:P,...d}=C({size:a?.size,...o},A,G),{"aria-invalid":R,"aria-busy":b,"aria-disabled":T,"aria-readonly":k}=d,I=!!l||R===!0||R==="true",U=e.useMemo(()=>({"aria-invalid":I?!0:R,"aria-busy":i||b,"aria-disabled":m||T,"aria-readonly":P||k}),[I,R,i,b,m,T,P,k]),Y=!!(P||i)?{onPointerDown:n=>n.preventDefault(),onClick:n=>{n.preventDefault(),n.currentTarget.focus()},onKeyDown:n=>{let q=n.ctrlKey||n.altKey||n.metaKey;($.includes(n.key)||!q&&n.key.length===1)&&n.preventDefault()}}:void 0;return e.createElement(r.Trigger,{asChild:!0,disabled:m,...Y},e.createElement("button",{"data-accent-color":c,"data-radius":p,"data-error":l||void 0,"data-loading":i||void 0,...d,...U,ref:t,className:u("kui-reset","kui-SelectTrigger",f)},e.createElement("span",{className:"kui-SelectTriggerInner"},e.createElement(r.Value,{placeholder:s},S)),e.createElement(r.Icon,{asChild:!0},i?e.createElement("span",{className:"kui-SelectIcon kui-SelectLoadingIcon","aria-hidden":"true"},e.createElement(N,null)):e.createElement(w,{className:"kui-SelectIcon"}))))});V.displayName="Select.Trigger";var H=e.forwardRef((o,t)=>{let a=e.useContext(h),{className:S,children:f,color:c,container:p,...s}=C({size:a?.size,...o},A,M),l=O();if(a.open===!1&&!s.forceMount)return e.createElement(r.Portal,{container:p},e.createElement(r.Content,{...s,asChild:!1,ref:t},f));let i=c||l.accentColor;return e.createElement(r.Portal,{container:p},e.createElement(z,{asChild:!0},e.createElement(r.Content,{"data-accent-color":i,sideOffset:4,...s,asChild:!1,ref:t,className:u("kui-PopperContent","kui-BaseMenuContent","kui-variant-soft","kui-SelectContent",S)},e.createElement(ee,null,f))))});H.displayName="Select.Content";function ee({children:o}){let t=L();return e.createElement(y.Root,{type:"auto",className:"kui-ScrollAreaRoot"},e.createElement(r.Viewport,{asChild:!0,className:u("kui-BaseMenuViewport","kui-SelectViewport")},e.createElement(y.Viewport,{ref:t,className:"kui-ScrollAreaViewport",style:{overflowY:void 0}},o)),e.createElement(y.Scrollbar,{className:"kui-ScrollAreaScrollbar",orientation:"vertical"},e.createElement(y.Thumb,{className:"kui-ScrollAreaThumb"})))}var W=e.forwardRef((o,t)=>{let{className:a,children:S,...f}=o,c=typeof S!="string",p=e.useRef(null),s=X(t,p);return Z(()=>{let l=p.current,i=l?.querySelector(":scope > :not(.kui-SelectItemIndicator)");if(!l||!i||!c)return;let m=parseFloat(getComputedStyle(l).lineHeight);l.toggleAttribute("data-multiline",i.getBoundingClientRect().height>m*1.5)}),e.createElement(r.Item,{...f,asChild:!1,ref:s,className:u("kui-reset","kui-BaseMenuItem","kui-SelectItem",{"kui-SelectItemRich":c},a)},e.createElement(r.ItemIndicator,{className:"kui-SelectItemIndicator"},e.createElement(E,{className:"kui-SelectItemIndicatorIcon"})),e.createElement(r.ItemText,null,S))});W.displayName="Select.Item";var K=e.forwardRef(({className:o,...t},a)=>e.createElement(r.Group,{...t,asChild:!1,ref:a,className:u("kui-SelectGroup",o)}));K.displayName="Select.Group";var j=e.forwardRef(({className:o,...t},a)=>e.createElement(r.Label,{...t,asChild:!1,ref:a,className:u("kui-BaseMenuLabel","kui-SelectLabel",o)}));j.displayName="Select.Label";var F=e.forwardRef(({className:o,...t},a)=>e.createElement(r.Separator,{...t,asChild:!1,ref:a,className:u("kui-BaseMenuSeparator","kui-SelectSeparator",o)}));F.displayName="Select.Separator";export{B as a,V as b,H as c,W as d,K as e,j as f,F as g,te as h};
|
|
3
|
+
//# sourceMappingURL=chunk-OGVKMDO7.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/components/select.tsx", "../../src/components/select.props.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { Select as SelectPrimitive, ScrollArea as ScrollAreaPrimitive } from 'radix-ui';\nimport { useComposedRefs, useLayoutEffect } from 'radix-ui/internal';\n\nimport { extractProps } from '../helpers/extract-props.js';\nimport { useThemeSize } from '../hooks/theme-size.js';\nimport { ChevronDownIcon, ThickCheckIcon } from './icons.js';\nimport { Spinner } from './spinner.js';\nimport {\n selectRootPropDefs,\n selectTriggerPropDefs,\n selectContentPropDefs,\n} from './select.props.js';\nimport { useThemeContext } from './theme.js';\nimport { PortalTheme } from './_internal/portal-theme.js';\nimport { useThumbSync } from '../hooks/use-thumb-sync.js';\n\nimport type { GetPropDefTypes } from '../props/prop-def.js';\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\n\ntype SelectRootOwnProps = GetPropDefTypes<typeof selectRootPropDefs>;\n\n// Trigger and Content pass the size prop def as its own record. It is hoisted because\n// extractProps caches its compiled prop defs on the identity of each record it is given:\n// a literal written at the call site would be a new object, and a recompile, every render.\nconst selectSizePropDefs = { size: selectRootPropDefs.size };\n\n// Keys that open the list from the trigger, as in Radix.\nconst OPEN_KEYS = [' ', 'Enter', 'ArrowUp', 'ArrowDown'];\n\ninterface SelectContextValue extends SelectRootOwnProps {\n /** Whether the list is open. Undefined when Content is rendered outside a Kookie Select.Root. */\n open?: boolean;\n}\nconst SelectContext = React.createContext<SelectContextValue>({});\n\ninterface SelectRootProps extends SelectPrimitive.SelectProps, SelectRootOwnProps {}\nconst SelectRoot: React.FC<SelectRootProps> = (props) => {\n const {\n children,\n size: sizeProp,\n open: openProp,\n defaultOpen,\n onOpenChange,\n ...rootProps\n } = props;\n const size = useThemeSize(sizeProp, selectRootPropDefs.size);\n\n // Root owns the open state and hands Radix a controlled `open`, so Content learns of a\n // change in the same render Radix does. Radix's uncontrolled state reports changes from an\n // effect, a render late, which would mount the open list once without its wrappers.\n const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen ?? false);\n const open = openProp ?? uncontrolledOpen;\n const handleOpenChange = React.useCallback(\n (next: boolean) => {\n setUncontrolledOpen(next);\n onOpenChange?.(next);\n },\n [onOpenChange],\n );\n\n return (\n <SelectPrimitive.Root {...rootProps} open={open} onOpenChange={handleOpenChange}>\n <SelectContext.Provider value={React.useMemo(() => ({ size, open }), [size, open])}>\n {children}\n </SelectContext.Provider>\n </SelectPrimitive.Root>\n );\n};\nSelectRoot.displayName = 'Select.Root';\n\ntype SelectTriggerElement = React.ElementRef<typeof SelectPrimitive.Trigger>;\ntype SelectTriggerOwnProps = GetPropDefTypes<typeof selectTriggerPropDefs>;\ninterface SelectTriggerProps\n extends ComponentPropsWithout<typeof SelectPrimitive.Trigger, RemovedProps>,\n SelectTriggerOwnProps {}\nconst SelectTrigger = React.forwardRef<SelectTriggerElement, SelectTriggerProps>(\n (props, forwardedRef) => {\n const context = React.useContext(SelectContext);\n const {\n children,\n className,\n color,\n radius,\n placeholder,\n error,\n loading,\n disabled,\n readOnly,\n ...triggerProps\n } = extractProps(\n // Pass size value from the context to generate styles\n { size: context?.size, ...props },\n // Pass size prop def to allow it to be extracted\n selectSizePropDefs,\n selectTriggerPropDefs,\n );\n\n // The props win when set; otherwise a caller's own aria-* (a form library's aria-invalid)\n // stays, so both paths reach the accessibility tree and the CSS, as on TextField.\n const {\n 'aria-invalid': ariaInvalid,\n 'aria-busy': ariaBusy,\n 'aria-disabled': ariaDisabled,\n 'aria-readonly': ariaReadOnly,\n } = triggerProps;\n const isInvalid = Boolean(error) || ariaInvalid === true || ariaInvalid === 'true';\n const ariaProps = React.useMemo(\n () => ({\n 'aria-invalid': isInvalid ? true : ariaInvalid,\n 'aria-busy': loading || ariaBusy,\n 'aria-disabled': disabled || ariaDisabled,\n 'aria-readonly': readOnly || ariaReadOnly,\n }),\n [isInvalid, ariaInvalid, loading, ariaBusy, disabled, ariaDisabled, readOnly, ariaReadOnly],\n );\n\n // Read-only and loading triggers stay focusable but do not open or take typeahead,\n // as on Combobox. Radix skips its own handler when the event is default-prevented.\n const isBlocked = Boolean(readOnly || loading);\n const blockedHandlers = isBlocked\n ? {\n onPointerDown: (event: React.PointerEvent<HTMLButtonElement>) => event.preventDefault(),\n onClick: (event: React.MouseEvent<HTMLButtonElement>) => {\n event.preventDefault();\n event.currentTarget.focus();\n },\n onKeyDown: (event: React.KeyboardEvent<HTMLButtonElement>) => {\n const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;\n if (OPEN_KEYS.includes(event.key) || (!isModifierKey && event.key.length === 1)) {\n event.preventDefault();\n }\n },\n }\n : undefined;\n\n return (\n // `disabled` goes to Radix, which merges it with Root's and sets the native attribute.\n <SelectPrimitive.Trigger asChild disabled={disabled} {...blockedHandlers}>\n <button\n data-accent-color={color}\n data-radius={radius}\n data-error={error || undefined}\n data-loading={loading || undefined}\n {...triggerProps}\n {...ariaProps}\n ref={forwardedRef}\n className={classNames('kui-reset', 'kui-SelectTrigger', className)}\n >\n <span className=\"kui-SelectTriggerInner\">\n <SelectPrimitive.Value placeholder={placeholder}>{children}</SelectPrimitive.Value>\n </span>\n <SelectPrimitive.Icon asChild>\n {loading ? (\n <span className=\"kui-SelectIcon kui-SelectLoadingIcon\" aria-hidden=\"true\">\n <Spinner />\n </span>\n ) : (\n <ChevronDownIcon className=\"kui-SelectIcon\" />\n )}\n </SelectPrimitive.Icon>\n </button>\n </SelectPrimitive.Trigger>\n );\n },\n);\nSelectTrigger.displayName = 'Select.Trigger';\n\ntype SelectContentElement = React.ElementRef<typeof SelectPrimitive.Content>;\ntype SelectContentOwnProps = GetPropDefTypes<typeof selectContentPropDefs>;\ninterface SelectContentProps\n extends ComponentPropsWithout<typeof SelectPrimitive.Content, RemovedProps>,\n SelectContentOwnProps {\n container?: React.ComponentPropsWithoutRef<typeof SelectPrimitive.Portal>['container'];\n}\nconst SelectContent = React.forwardRef<SelectContentElement, SelectContentProps>(\n (props, forwardedRef) => {\n const context = React.useContext(SelectContext);\n const { className, children, color, container, ...contentProps } = extractProps(\n // Pass size value from the context to generate styles\n { size: context?.size, ...props },\n // Pass size prop def to allow it to be extracted\n selectSizePropDefs,\n selectContentPropDefs,\n );\n const themeContext = useThemeContext();\n\n // While closed, Radix still renders Content's children, into a detached fragment: the\n // items must exist for the trigger's value label, typeahead and the native form select.\n // Nothing in that fragment is ever shown, so the theme wrapper and the scroll area, with\n // its two resize observers, are left out until the list opens.\n if (context.open === false && !contentProps.forceMount) {\n return (\n <SelectPrimitive.Portal container={container}>\n <SelectPrimitive.Content {...contentProps} asChild={false} ref={forwardedRef}>\n {children}\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n );\n }\n\n const resolvedColor = color || themeContext.accentColor;\n return (\n <SelectPrimitive.Portal container={container}>\n <PortalTheme asChild>\n <SelectPrimitive.Content\n data-accent-color={resolvedColor}\n sideOffset={4}\n {...contentProps}\n asChild={false}\n ref={forwardedRef}\n className={classNames(\n 'kui-PopperContent',\n 'kui-BaseMenuContent',\n 'kui-variant-soft',\n 'kui-SelectContent',\n className,\n )}\n >\n <SelectScrollArea>{children}</SelectScrollArea>\n </SelectPrimitive.Content>\n </PortalTheme>\n </SelectPrimitive.Portal>\n );\n },\n);\nSelectContent.displayName = 'Select.Content';\n\n/** The open list's scroll area. Its own component so the thumb sync hook runs only while open. */\nfunction SelectScrollArea({ children }: { children: React.ReactNode }) {\n const setThumbViewport = useThumbSync<HTMLDivElement>();\n return (\n <ScrollAreaPrimitive.Root type=\"auto\" className=\"kui-ScrollAreaRoot\">\n <SelectPrimitive.Viewport\n asChild\n className={classNames('kui-BaseMenuViewport', 'kui-SelectViewport')}\n >\n <ScrollAreaPrimitive.Viewport\n ref={setThumbViewport}\n className=\"kui-ScrollAreaViewport\"\n style={{ overflowY: undefined }}\n >\n {children}\n </ScrollAreaPrimitive.Viewport>\n </SelectPrimitive.Viewport>\n <ScrollAreaPrimitive.Scrollbar className=\"kui-ScrollAreaScrollbar\" orientation=\"vertical\">\n <ScrollAreaPrimitive.Thumb className=\"kui-ScrollAreaThumb\" />\n </ScrollAreaPrimitive.Scrollbar>\n </ScrollAreaPrimitive.Root>\n );\n}\n\ntype SelectItemElement = React.ElementRef<typeof SelectPrimitive.Item>;\ninterface SelectItemProps\n extends ComponentPropsWithout<typeof SelectPrimitive.Item, RemovedProps> {}\nconst SelectItem = React.forwardRef<SelectItemElement, SelectItemProps>((props, forwardedRef) => {\n const { className, children, ...itemProps } = props;\n\n // Detect if this is rich content (not just a string)\n const isRichContent = typeof children !== 'string';\n\n // Rich content is not the same as several lines: an icon and a label is one line, and its mark\n // stays centred. Only content taller than one and a half lines pins the mark to the first line.\n // Written to the DOM, not state, so measuring never re-renders the list.\n const itemRef = React.useRef<HTMLDivElement>(null);\n const composedRef = useComposedRefs(forwardedRef, itemRef);\n useLayoutEffect(() => {\n const item = itemRef.current;\n const text = item?.querySelector(':scope > :not(.kui-SelectItemIndicator)');\n if (!item || !text || !isRichContent) return;\n const lineHeight = parseFloat(getComputedStyle(item).lineHeight);\n item.toggleAttribute('data-multiline', text.getBoundingClientRect().height > lineHeight * 1.5);\n });\n\n return (\n <SelectPrimitive.Item\n {...itemProps}\n asChild={false}\n ref={composedRef}\n className={classNames(\n 'kui-reset',\n 'kui-BaseMenuItem',\n 'kui-SelectItem',\n { 'kui-SelectItemRich': isRichContent },\n className,\n )}\n >\n <SelectPrimitive.ItemIndicator className=\"kui-SelectItemIndicator\">\n <ThickCheckIcon className=\"kui-SelectItemIndicatorIcon\" />\n </SelectPrimitive.ItemIndicator>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n );\n});\nSelectItem.displayName = 'Select.Item';\n\ntype SelectGroupElement = React.ElementRef<typeof SelectPrimitive.Group>;\ninterface SelectGroupProps\n extends ComponentPropsWithout<typeof SelectPrimitive.Group, RemovedProps> {}\nconst SelectGroup = React.forwardRef<SelectGroupElement, SelectGroupProps>(\n ({ className, ...props }, forwardedRef) => (\n <SelectPrimitive.Group\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('kui-SelectGroup', className)}\n />\n ),\n);\nSelectGroup.displayName = 'Select.Group';\n\ntype SelectLabelElement = React.ElementRef<typeof SelectPrimitive.Label>;\ninterface SelectLabelProps\n extends ComponentPropsWithout<typeof SelectPrimitive.Label, RemovedProps> {}\nconst SelectLabel = React.forwardRef<SelectLabelElement, SelectLabelProps>(\n ({ className, ...props }, forwardedRef) => (\n <SelectPrimitive.Label\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('kui-BaseMenuLabel', 'kui-SelectLabel', className)}\n />\n ),\n);\nSelectLabel.displayName = 'Select.Label';\n\ntype SelectSeparatorElement = React.ElementRef<typeof SelectPrimitive.Separator>;\ninterface SelectSeparatorProps\n extends ComponentPropsWithout<typeof SelectPrimitive.Separator, RemovedProps> {}\nconst SelectSeparator = React.forwardRef<SelectSeparatorElement, SelectSeparatorProps>(\n ({ className, ...props }, forwardedRef) => (\n <SelectPrimitive.Separator\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('kui-BaseMenuSeparator', 'kui-SelectSeparator', className)}\n />\n ),\n);\nSelectSeparator.displayName = 'Select.Separator';\n\nexport {\n SelectRoot as Root,\n SelectTrigger as Trigger,\n SelectContent as Content,\n SelectItem as Item,\n SelectGroup as Group,\n SelectLabel as Label,\n SelectSeparator as Separator,\n};\n\nexport type {\n SelectRootProps as RootProps,\n SelectTriggerProps as TriggerProps,\n SelectContentProps as ContentProps,\n SelectItemProps as ItemProps,\n SelectGroupProps as GroupProps,\n SelectLabelProps as LabelProps,\n SelectSeparatorProps as SeparatorProps,\n};\n", "import type React from 'react';\n\nimport { colorPropDef } from '../props/color.prop.js';\nimport { radiusPropDef } from '../props/radius.prop.js';\n\nimport type { PropDef } from '../props/prop-def.js';\n\nconst sizes = ['1', '2', '3', '4'] as const;\n\nconst selectRootPropDefs = {\n size: { type: 'enum', className: 'kui-r-size', values: sizes, default: '2', responsive: true },\n} satisfies {\n size: PropDef<(typeof sizes)[number]>;\n};\n\nconst triggerVariants = ['raised', 'surface', 'soft', 'outline', 'ghost'] as const;\n\nconst selectTriggerPropDefs = {\n variant: { type: 'enum', className: 'kui-variant', values: triggerVariants, default: 'raised' },\n error: { type: 'boolean' },\n loading: { type: 'boolean' },\n disabled: { type: 'boolean' },\n readOnly: { type: 'boolean' },\n ...colorPropDef,\n ...radiusPropDef,\n placeholder: { type: 'ReactNode' },\n} satisfies {\n variant: PropDef<(typeof triggerVariants)[number]>;\n error: PropDef<boolean>;\n loading: PropDef<boolean>;\n disabled: PropDef<boolean>;\n readOnly: PropDef<boolean>;\n placeholder: PropDef<React.ReactNode>;\n};\n\n\nconst selectContentPropDefs = {\n ...colorPropDef,\n} satisfies {\n};\n\nexport { selectRootPropDefs, selectTriggerPropDefs, selectContentPropDefs };\n"],
|
|
5
|
+
"mappings": ";uZAAA,IAAAA,GAAA,GAAAC,EAAAD,GAAA,aAAAE,EAAA,UAAAC,EAAA,SAAAC,EAAA,UAAAC,EAAA,SAAAC,EAAA,cAAAC,EAAA,YAAAC,IAEA,UAAYC,MAAW,QACvB,OAAOC,MAAgB,aACvB,OAAS,UAAUC,EAAiB,cAAcC,MAA2B,WAC7E,OAAS,mBAAAC,EAAiB,mBAAAC,MAAuB,oBCEjD,IAAMC,EAAQ,CAAC,IAAK,IAAK,IAAK,GAAG,EAE3BC,EAAqB,CACzB,KAAM,CAAE,KAAM,OAAQ,UAAW,aAAc,OAAQD,EAAO,QAAS,IAAK,WAAY,EAAK,CAC/F,EAIME,EAAkB,CAAC,SAAU,UAAW,OAAQ,UAAW,OAAO,EAElEC,EAAwB,CAC5B,QAAS,CAAE,KAAM,OAAQ,UAAW,cAAe,OAAQD,EAAiB,QAAS,QAAS,EAC9F,MAAO,CAAE,KAAM,SAAU,EACzB,QAAS,CAAE,KAAM,SAAU,EAC3B,SAAU,CAAE,KAAM,SAAU,EAC5B,SAAU,CAAE,KAAM,SAAU,EAC5B,GAAGE,EACH,GAAGC,EACH,YAAa,CAAE,KAAM,WAAY,CACnC,EAUMC,EAAwB,CAC5B,GAAGF,CACL,EDVA,IAAMG,EAAqB,CAAE,KAAMC,EAAmB,IAAK,EAGrDC,EAAY,CAAC,IAAK,QAAS,UAAW,WAAW,EAMjDC,EAAsB,gBAAkC,CAAC,CAAC,EAG1DC,EAAyCC,GAAU,CACvD,GAAM,CACJ,SAAAC,EACA,KAAMC,EACN,KAAMC,EACN,YAAAC,EACA,aAAAC,EACA,GAAGC,CACL,EAAIN,EACEO,EAAOC,EAAaN,EAAUN,EAAmB,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AS,GACT,IAAKG,EACL,UAAWnB,EACT,YACA,mBACA,iBACA,CAAE,qBAAsBiB,CAAc,EACtCrC,CACF,GAEA,gBAACJ,EAAgB,cAAhB,CAA8B,UAAU,2BACvC,gBAACiD,EAAA,CAAe,UAAU,8BAA8B,CAC1D,EACA,gBAACjD,EAAgB,SAAhB,KAA0Bb,CAAS,CACtC,CAEJ,CAAC,EACDoD,EAAW,YAAc,cAKzB,IAAMW,EAAoB,aACxB,CAAC,CAAE,UAAA9C,EAAW,GAAGlB,CAAM,EAAGgB,IACxB,gBAACF,EAAgB,MAAhB,CACE,GAAGd,EACJ,QAAS,GACT,IAAKgB,EACL,UAAWsB,EAAW,kBAAmBpB,CAAS,EACpD,CAEJ,EACA8C,EAAY,YAAc,eAK1B,IAAMC,EAAoB,aACxB,CAAC,CAAE,UAAA/C,EAAW,GAAGlB,CAAM,EAAGgB,IACxB,gBAACF,EAAgB,MAAhB,CACE,GAAGd,EACJ,QAAS,GACT,IAAKgB,EACL,UAAWsB,EAAW,oBAAqB,kBAAmBpB,CAAS,EACzE,CAEJ,EACA+C,EAAY,YAAc,eAK1B,IAAMC,EAAwB,aAC5B,CAAC,CAAE,UAAAhD,EAAW,GAAGlB,CAAM,EAAGgB,IACxB,gBAACF,EAAgB,UAAhB,CACE,GAAGd,EACJ,QAAS,GACT,IAAKgB,EACL,UAAWsB,EAAW,wBAAyB,sBAAuBpB,CAAS,EACjF,CAEJ,EACAgD,EAAgB,YAAc",
|
|
6
|
+
"names": ["select_exports", "__export", "SelectContent", "SelectGroup", "SelectItem", "SelectLabel", "SelectRoot", "SelectSeparator", "SelectTrigger", "React", "classNames", "SelectPrimitive", "ScrollAreaPrimitive", "useComposedRefs", "useLayoutEffect", "sizes", "selectRootPropDefs", "triggerVariants", "selectTriggerPropDefs", "colorPropDef", "radiusPropDef", "selectContentPropDefs", "selectSizePropDefs", "selectRootPropDefs", "OPEN_KEYS", "SelectContext", "SelectRoot", "props", "children", "sizeProp", "openProp", "defaultOpen", "onOpenChange", "rootProps", "size", "useThemeSize", "uncontrolledOpen", "setUncontrolledOpen", "open", "handleOpenChange", "next", "SelectPrimitive", "SelectTrigger", "forwardedRef", "context", "className", "color", "radius", "placeholder", "error", "loading", "disabled", "readOnly", "triggerProps", "extractProps", "selectTriggerPropDefs", "ariaInvalid", "ariaBusy", "ariaDisabled", "ariaReadOnly", "isInvalid", "ariaProps", "blockedHandlers", "event", "isModifierKey", "classNames", "Spinner", "ChevronDownIcon", "SelectContent", "container", "contentProps", "selectContentPropDefs", "themeContext", "useThemeContext", "resolvedColor", "PortalTheme", "SelectScrollArea", "setThumbViewport", "useThumbSync", "ScrollAreaPrimitive", "SelectItem", "itemProps", "isRichContent", "itemRef", "composedRef", "useComposedRefs", "useLayoutEffect", "item", "text", "lineHeight", "ThickCheckIcon", "SelectGroup", "SelectLabel", "SelectSeparator"]
|
|
7
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import{a as d}from"./chunk-DFQIIYLD.js";import{b as p}from"./chunk-QEDKL23P.js";import{j as C}from"./chunk-5BXCPANF.js";import{a as s}from"./chunk-ANQLWGFN.js";import*as e from"react";import c from"classnames";var v=e.createContext(null);function u(){return e.useContext(v)}var S=e.createContext("2"),B=e.createContext(!1),N=e.createContext(!1);function W({children:t,presentation:n}){let a=e.useContext(S),o=e.useMemo(()=>({size:a,menuVariant:"soft",presentation:n}),[a,n]);return e.createElement(v.Provider,{value:o},t)}function P(){let t=u(),n=e.useContext(S),a=t?.size??n,o=t?.menuVariant??"soft";return["kui-ShellPaneChrome",`kui-r-size-${a}`,`kui-menu-variant-${o}`]}var H={1:"2",2:"3",3:"4",4:"4"};function f(){let t=u(),n=e.useContext(S);return H[t?.size??n]}function g(){let t=e.useContext(s),n=e.useContext(C)!==null,a=f();return t!==void 0?t:n?a:null}var y=e.forwardRef(({className:t,float:n,children:a,...o},i)=>{let l=P(),r=f();return e.createElement("div",{...o,ref:i,"data-float":n||void 0,className:c("kui-ShellPaneHeader","kui-SidebarHeader","kui-SidebarHeader--container",...l,t)},e.createElement(s.Provider,{value:r},a))});y.displayName="Shell.PaneHeader";var F=e.forwardRef(({className:t,float:n,children:a,...o},i)=>{let l=P(),r=f();return e.createElement("div",{...o,ref:i,"data-float":n||void 0,className:c("kui-ShellPaneFooter","kui-SidebarFooter","kui-SidebarFooter--container",...l,t)},e.createElement(s.Provider,{value:r},a))});F.displayName="Shell.PaneFooter";var M=e.forwardRef(({className:t,style:n,dir:a,children:o,fade:i=!1,pane:l=!1,...r},m)=>{let x=P(),h=e.useContext(B),R=u(),z=h&&R===null&&!l,b=e.useContext(N),V=p();if(z){let k=r.tabIndex??(b&&V?-1:void 0);return e.createElement(d,{...r,tabIndex:k,ref:m,type:"hover",fade:i,className:"kui-ShellScroll"},e.createElement("div",{style:n,dir:a,className:c("kui-ShellScrollContent",t)},o))}return e.createElement(d,{...r,ref:m,type:"hover",fade:i,className:"kui-ShellScroll"},e.createElement("div",{style:n,dir:a,className:c("kui-BaseMenuContent","kui-SidebarContent",...x,t)},e.createElement(s.Provider,{value:null},e.createElement("div",{className:"kui-BaseMenuViewport"},o))))});M.displayName="Shell.Scroll";export{v as a,u as b,S as c,B as d,N as e,W as f,H as g,g as h,y as i,F as j,M as k};
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
//# sourceMappingURL=chunk-PMXIQ5B4.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/components/_internal/pane-chrome.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client';\n\n/**\n * A pane's own chrome: a header row, a scrolling region and a footer row.\n *\n * Shell.Sidebar and Shell.Panel render these as `Shell.PaneHeader`, `Shell.Scroll` and\n * `Shell.PaneFooter`. The pane renders anything; with these parts it is the presentation, so\n * Sidebar's menu parts work inside it. The index comes from the nearest Shell (`Shell.Root size`).\n */\n\nimport * as React from 'react';\nimport classNames from 'classnames';\n\nimport { ScrollArea } from '../scroll-area.js';\nimport { ShellStoreContext } from './shell-store.js';\nimport { PaneBandSizeContext, type BandSize } from './pane-band-context.js';\nimport { usePageScrollMedia } from './shell-page-scroll.js';\n\ntype PaneSize = '1' | '2' | '3';\n\ntype SidebarVisualContextValue = {\n size: PaneSize;\n menuVariant: 'solid' | 'soft';\n presentation?: 'thin' | 'expanded';\n color?: string;\n};\n\n/** Size, menu highlight and presentation for the Sidebar parts. Internal: not exported. */\nconst SidebarVisualContext = React.createContext<SidebarVisualContextValue | null>(null);\n\nfunction useSidebarVisual() {\n return React.useContext(SidebarVisualContext);\n}\n\n/** The Shell's index. `Shell.Root size` sets it; panes hand it to their chrome. */\nconst ShellSizeContext = React.createContext<PaneSize>('2');\n\n/**\n * True inside `Shell.Content`. `Shell.Root` sets it back to false, so a Shell nested in the\n * content gets pane chrome in its own panes. Read by `Shell.Scroll`: in the content it holds a\n * page, not a menu, so it takes none of the menu's padding, gap or layering.\n */\nconst ShellContentContext = React.createContext(false);\n\n/**\n * True inside a window Shell: one with no `contained` and no `height`, which lets the page scroll\n * on a narrow touch screen. Each `Shell.Root` sets its own, so a Shell nested in another answers\n * for itself.\n */\nconst ShellWindowContext = React.createContext(false);\n\n/**\n * Gives a Shell pane's children the Shell's index, so Sidebar parts size themselves. In a Rail\n * the rows are `thin`: icon tiles with a small label, sub-menus as dropdowns.\n */\nfunction PaneChromeScope({ children, presentation }: { children: React.ReactNode; presentation?: 'thin' }) {\n const size = React.useContext(ShellSizeContext);\n const value = React.useMemo<SidebarVisualContextValue>(() => ({ size, menuVariant: 'soft', presentation }), [size, presentation]);\n return <SidebarVisualContext.Provider value={value}>{children}</SidebarVisualContext.Provider>;\n}\n\nfunction useChromeClasses() {\n const visual = useSidebarVisual();\n // A pane with no scope (Inspector, Bottom) still takes the Shell's index.\n const shellSize = React.useContext(ShellSizeContext);\n const size = visual?.size ?? shellSize;\n const menuVariant = visual?.menuVariant ?? 'soft';\n return ['kui-ShellPaneChrome', `kui-r-size-${size}`, `kui-menu-variant-${menuVariant}`];\n}\n\n/**\n * The index a Toolbar in a pane's header or footer rests at when it states none: one step above\n * the Shell's, so the band reads as chrome over the rows (v2 BAND_STEP). 4 has no step above.\n */\nconst BAND_STEP = { '1': '2', '2': '3', '3': '4', '4': '4' } as const satisfies Record<BandSize, BandSize>;\n\nfunction useBandSize(): BandSize {\n const visual = useSidebarVisual();\n const shellSize = React.useContext(ShellSizeContext);\n return BAND_STEP[visual?.size ?? shellSize];\n}\n\n/**\n * The size a Toolbar with no `size` of its own rests at, or null for none.\n *\n * In a pane's header or footer it is that band's size. Anywhere else inside a Shell, such as\n * `Shell.Content` or a pane's body, it is the same step: one above the Shell's index, so a\n * toolbar in the content area matches the ones in the pane headers beside it (v2 sizes every\n * toolbar this way). A pane's scrolling list, and anything outside a Shell, has none.\n */\nfunction usePaneBandSize(): BandSize | null {\n const band = React.useContext(PaneBandSizeContext);\n const inShell = React.useContext(ShellStoreContext) !== null;\n const step = useBandSize();\n if (band !== undefined) return band;\n return inShell ? step : null;\n}\n\ninterface PaneHeaderProps extends React.ComponentPropsWithoutRef<'div'> {\n /**\n * Floats the row over the top of `Shell.Scroll`, so the list scrolls behind it. The list\n * starts below the row, and `Shell.Scroll fade` fades it out under the row. The row paints\n * nothing and lets clicks through between its controls; a `Toolbar backdrop` in it keeps\n * the controls readable.\n */\n float?: boolean;\n}\n\n/** A pane's header row, pinned above its scrolling region. */\nconst PaneHeader = React.forwardRef<HTMLDivElement, PaneHeaderProps>(({ className, float, children, ...props }, forwardedRef) => {\n const chrome = useChromeClasses();\n const band = useBandSize();\n return (\n <div\n {...props}\n ref={forwardedRef}\n data-float={float || undefined}\n className={classNames('kui-ShellPaneHeader', 'kui-SidebarHeader', 'kui-SidebarHeader--container', ...chrome, className)}\n >\n <PaneBandSizeContext.Provider value={band}>{children}</PaneBandSizeContext.Provider>\n </div>\n );\n});\nPaneHeader.displayName = 'Shell.PaneHeader';\n\ninterface PaneFooterProps extends React.ComponentPropsWithoutRef<'div'> {\n /** Floats the row over the bottom of `Shell.Scroll`, the way `Shell.PaneHeader float` does at the top. */\n float?: boolean;\n}\n\n/** A pane's footer row, pinned below its scrolling region. */\nconst PaneFooter = React.forwardRef<HTMLDivElement, PaneFooterProps>(({ className, float, children, ...props }, forwardedRef) => {\n const chrome = useChromeClasses();\n const band = useBandSize();\n return (\n <div\n {...props}\n ref={forwardedRef}\n data-float={float || undefined}\n className={classNames('kui-ShellPaneFooter', 'kui-SidebarFooter', 'kui-SidebarFooter--container', ...chrome, className)}\n >\n <PaneBandSizeContext.Provider value={band}>{children}</PaneBandSizeContext.Provider>\n </div>\n );\n});\nPaneFooter.displayName = 'Shell.PaneFooter';\n\ninterface ScrollProps extends React.ComponentPropsWithoutRef<'div'> {\n /** Fades the list out toward an edge with more past it, and under a floating header or footer. */\n fade?: boolean;\n /**\n * Keeps the pane's list (its menu rows) when React puts this under `Shell.Content`, as when an\n * app renders a pane's content in its page and portals it into `Shell.Panel`. In a Rail, Panel\n * or Sidebar it is already the pane's list.\n */\n pane?: boolean;\n}\n\n/**\n * The one region of a pane that scrolls; it takes the room the header and footer leave.\n * In `Shell.Content` it is the page's scroller, and a `Shell.PaneHeader float` beside it pins\n * the page's toolbar over it. The ref, events and ARIA props land on the element that scrolls;\n * `className`, `style` and `dir` apply to the content inside it. In a Rail, Panel or Sidebar the pane is\n * already a navigation landmark, so it needs no role of its own.\n */\nconst Scroll = React.forwardRef<HTMLDivElement, ScrollProps>(({ className, style, dir, children, fade = false, pane = false, ...props }, forwardedRef) => {\n const chrome = useChromeClasses();\n // Pane chrome nested inside the content (a pane portalled into it) still gets a menu.\n const contentPane = React.useContext(ShellContentContext);\n const visual = useSidebarVisual();\n const inContent = contentPane && visual === null && !pane;\n // While the page scrolls, the content's viewport scrolls nothing: as a tab stop it would take a\n // Tab, ring the whole page and move nothing. Resolved after mount; a `tabIndex` of the caller's wins.\n const windowShell = React.useContext(ShellWindowContext);\n const pageScrolls = usePageScrollMedia();\n if (inContent) {\n const tabIndex = props.tabIndex ?? (windowShell && pageScrolls ? -1 : undefined);\n return (\n <ScrollArea {...props} tabIndex={tabIndex} ref={forwardedRef} type=\"hover\" fade={fade} className=\"kui-ShellScroll\">\n <div style={style} dir={dir} className={classNames('kui-ShellScrollContent', className)}>\n {children}\n </div>\n </ScrollArea>\n );\n }\n return (\n <ScrollArea {...props} ref={forwardedRef} type=\"hover\" fade={fade} className=\"kui-ShellScroll\">\n <div style={style} dir={dir} className={classNames('kui-BaseMenuContent', 'kui-SidebarContent', ...chrome, className)}>\n {/* A header's band does not reach a Toolbar in the scrolling list. */}\n <PaneBandSizeContext.Provider value={null}>\n <div className=\"kui-BaseMenuViewport\">{children}</div>\n </PaneBandSizeContext.Provider>\n </div>\n </ScrollArea>\n );\n});\nScroll.displayName = 'Shell.Scroll';\n\nexport { SidebarVisualContext, useSidebarVisual, ShellSizeContext, ShellContentContext, ShellWindowContext, PaneChromeScope, PaneHeader, PaneFooter, Scroll, BAND_STEP, usePaneBandSize };\nexport type { SidebarVisualContextValue, PaneSize, BandSize, PaneHeaderProps, PaneFooterProps, ScrollProps };\n"],
|
|
5
|
+
"mappings": ";gKAUA,UAAYA,MAAW,QACvB,OAAOC,MAAgB,aAiBvB,IAAMC,EAA6B,gBAAgD,IAAI,EAEvF,SAASC,GAAmB,CAC1B,OAAa,aAAWD,CAAoB,CAC9C,CAGA,IAAME,EAAyB,gBAAwB,GAAG,EAOpDC,EAA4B,gBAAc,EAAK,EAO/CC,EAA2B,gBAAc,EAAK,EAMpD,SAASC,EAAgB,CAAE,SAAAC,EAAU,aAAAC,CAAa,EAAyD,CACzG,IAAMC,EAAa,aAAWN,CAAgB,EACxCO,EAAc,UAAmC,KAAO,CAAE,KAAAD,EAAM,YAAa,OAAQ,aAAAD,CAAa,GAAI,CAACC,EAAMD,CAAY,CAAC,EAChI,OAAO,gBAACP,EAAqB,SAArB,CAA8B,MAAOS,GAAQH,CAAS,C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AGD,EAAQJ,CAAS,GAEtH,gBAACL,EAAoB,SAApB,CAA6B,MAAOD,GAAOX,CAAS,CACvD,CAEJ,CAAC,EACDuB,EAAW,YAAc,mBAoBzB,IAAMC,EAAe,aAAwC,CAAC,CAAE,UAAAP,EAAW,MAAAQ,EAAO,IAAAC,EAAK,SAAA1B,EAAU,KAAA2B,EAAO,GAAO,KAAAC,EAAO,GAAO,GAAGT,CAAM,EAAGC,IAAiB,CACxJ,IAAMC,EAASjB,EAAiB,EAE1ByB,EAAoB,aAAWhC,CAAmB,EAClDQ,EAASV,EAAiB,EAC1BmC,EAAYD,GAAexB,IAAW,MAAQ,CAACuB,EAG/CG,EAAoB,aAAWjC,CAAkB,EACjDkC,EAAcC,EAAmB,EACvC,GAAIH,EAAW,CACb,IAAMI,EAAWf,EAAM,WAAaY,GAAeC,EAAc,GAAK,QACtE,OACE,gBAACG,EAAA,CAAY,GAAGhB,EAAO,SAAUe,EAAU,IAAKd,EAAc,KAAK,QAAQ,KAAMO,EAAM,UAAU,mBAC/F,gBAAC,OAAI,MAAOF,EAAO,IAAKC,EAAK,UAAWJ,EAAW,yBAA0BL,CAAS,GACnFjB,CACH,CACF,CAEJ,CACA,OACE,gBAACmC,EAAA,CAAY,GAAGhB,EAAO,IAAKC,EAAc,KAAK,QAAQ,KAAMO,EAAM,UAAU,mBAC3E,gBAAC,OAAI,MAAOF,EAAO,IAAKC,EAAK,UAAWJ,EAAW,sBAAuB,qBAAsB,GAAGD,EAAQJ,CAAS,GAElH,gBAACL,EAAoB,SAApB,CAA6B,MAAO,MACnC,gBAAC,OAAI,UAAU,wBAAwBZ,CAAS,CAClD,CACF,CACF,CAEJ,CAAC,EACDwB,EAAO,YAAc",
|
|
6
|
+
"names": ["React", "classNames", "SidebarVisualContext", "useSidebarVisual", "ShellSizeContext", "ShellContentContext", "ShellWindowContext", "PaneChromeScope", "children", "presentation", "size", "value", "useChromeClasses", "visual", "shellSize", "menuVariant", "BAND_STEP", "useBandSize", "usePaneBandSize", "band", "PaneBandSizeContext", "inShell", "ShellStoreContext", "step", "PaneHeader", "className", "float", "props", "forwardedRef", "chrome", "classNames", "PaneFooter", "Scroll", "style", "dir", "fade", "pane", "contentPane", "inContent", "windowShell", "pageScrolls", "usePageScrollMedia", "tabIndex", "ScrollArea"]
|
|
7
|
+
}
|