@womp/kookie-ui 0.4.0 → 0.6.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/components.css +783 -783
- package/dist/cjs/components/_internal/base-menu.utils.d.ts +48 -0
- package/dist/cjs/components/_internal/base-menu.utils.d.ts.map +1 -0
- package/dist/cjs/components/_internal/base-menu.utils.js +2 -0
- package/dist/cjs/components/_internal/base-menu.utils.js.map +7 -0
- package/dist/cjs/components/_internal/dropdown-menu-drill-down.d.ts +77 -59
- package/dist/cjs/components/_internal/dropdown-menu-drill-down.d.ts.map +1 -1
- package/dist/cjs/components/_internal/dropdown-menu-drill-down.js +1 -1
- package/dist/cjs/components/_internal/dropdown-menu-drill-down.js.map +4 -4
- package/dist/cjs/components/_internal/menu-context.d.ts +7 -3
- package/dist/cjs/components/_internal/menu-context.d.ts.map +1 -1
- package/dist/cjs/components/_internal/menu-context.js +1 -1
- package/dist/cjs/components/_internal/menu-context.js.map +4 -4
- package/dist/cjs/components/_internal/shell-bottom.js +1 -1
- package/dist/cjs/components/_internal/shell-bottom.js.map +2 -2
- package/dist/cjs/components/_internal/shell-inspector.js +1 -1
- package/dist/cjs/components/_internal/shell-inspector.js.map +2 -2
- package/dist/cjs/components/_internal/shell-sidebar.js +1 -1
- package/dist/cjs/components/_internal/shell-sidebar.js.map +2 -2
- package/dist/cjs/components/accordion.js +1 -1
- package/dist/cjs/components/alert-dialog.js +1 -1
- package/dist/cjs/components/alert-dialog.js.map +2 -2
- package/dist/cjs/components/badge.js +1 -1
- package/dist/cjs/components/badge.js.map +2 -2
- package/dist/cjs/components/blockquote.js +1 -1
- package/dist/cjs/components/button.js +1 -1
- package/dist/cjs/components/button.js.map +2 -2
- package/dist/cjs/components/callout.js +1 -1
- package/dist/cjs/components/callout.js.map +2 -2
- package/dist/cjs/components/card.js +1 -1
- package/dist/cjs/components/card.js.map +2 -2
- package/dist/cjs/components/chatbar.d.ts +46 -44
- package/dist/cjs/components/chatbar.d.ts.map +1 -1
- package/dist/cjs/components/chatbar.js +2 -2
- package/dist/cjs/components/chatbar.js.map +3 -3
- package/dist/cjs/components/checkbox-cards.js +1 -1
- package/dist/cjs/components/checkbox-cards.js.map +2 -2
- package/dist/cjs/components/checkbox-group.js +1 -1
- package/dist/cjs/components/checkbox.js +1 -1
- package/dist/cjs/components/combobox.d.ts +28 -15
- 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 +4 -4
- package/dist/cjs/components/combobox.props.d.ts +48 -0
- package/dist/cjs/components/combobox.props.d.ts.map +1 -1
- package/dist/cjs/components/combobox.props.js +1 -1
- package/dist/cjs/components/combobox.props.js.map +4 -4
- package/dist/cjs/components/context-menu.d.ts +18 -5
- package/dist/cjs/components/context-menu.d.ts.map +1 -1
- package/dist/cjs/components/context-menu.js +1 -1
- package/dist/cjs/components/context-menu.js.map +4 -4
- package/dist/cjs/components/context-menu.props.d.ts +1 -1
- package/dist/cjs/components/context-menu.props.d.ts.map +1 -1
- package/dist/cjs/components/context-menu.props.js +1 -1
- package/dist/cjs/components/context-menu.props.js.map +3 -3
- package/dist/cjs/components/dialog.js +1 -1
- package/dist/cjs/components/dialog.js.map +2 -2
- package/dist/cjs/components/dropdown-menu.d.ts +11 -18
- package/dist/cjs/components/dropdown-menu.d.ts.map +1 -1
- package/dist/cjs/components/dropdown-menu.js +1 -1
- package/dist/cjs/components/dropdown-menu.js.map +4 -4
- package/dist/cjs/components/heading.js +1 -1
- package/dist/cjs/components/hover-card.js +1 -1
- package/dist/cjs/components/hover-card.js.map +2 -2
- package/dist/cjs/components/icon-button.js +1 -1
- package/dist/cjs/components/icon-button.js.map +2 -2
- package/dist/cjs/components/index.js +5 -5
- package/dist/cjs/components/index.js.map +4 -4
- package/dist/cjs/components/link.js +1 -1
- package/dist/cjs/components/popover.js +1 -1
- package/dist/cjs/components/popover.js.map +2 -2
- package/dist/cjs/components/radio-cards.js +1 -1
- package/dist/cjs/components/radio-cards.js.map +2 -2
- package/dist/cjs/components/radio.js +1 -1
- package/dist/cjs/components/radio.js.map +2 -2
- package/dist/cjs/components/schemas/base-button.schema.d.ts +111 -256
- package/dist/cjs/components/schemas/base-button.schema.d.ts.map +1 -1
- package/dist/cjs/components/schemas/button.schema.d.ts +136 -557
- package/dist/cjs/components/schemas/button.schema.d.ts.map +1 -1
- package/dist/cjs/components/schemas/icon-button.schema.d.ts +123 -240
- package/dist/cjs/components/schemas/icon-button.schema.d.ts.map +1 -1
- 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 +592 -851
- 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-button.schema.d.ts +138 -1026
- package/dist/cjs/components/schemas/toggle-button.schema.d.ts.map +1 -1
- package/dist/cjs/components/schemas/toggle-icon-button.schema.d.ts +124 -465
- package/dist/cjs/components/schemas/toggle-icon-button.schema.d.ts.map +1 -1
- package/dist/cjs/components/scroll-area.js +1 -1
- package/dist/cjs/components/segmented-control.js +1 -1
- package/dist/cjs/components/select.js +1 -1
- package/dist/cjs/components/select.js.map +2 -2
- package/dist/cjs/components/sheet.js +1 -1
- package/dist/cjs/components/sheet.js.map +2 -2
- package/dist/cjs/components/shell.js +1 -1
- package/dist/cjs/components/shell.js.map +3 -3
- package/dist/cjs/components/sidebar.js +1 -1
- package/dist/cjs/components/sidebar.js.map +4 -4
- package/dist/cjs/components/slider.js +1 -1
- package/dist/cjs/components/slot.d.ts +6 -2
- package/dist/cjs/components/slot.d.ts.map +1 -1
- package/dist/cjs/components/switch.js +1 -1
- package/dist/cjs/components/tab-nav.js +1 -1
- package/dist/cjs/components/text-field.js +2 -2
- package/dist/cjs/components/text.js +1 -1
- package/dist/cjs/components/theme-panel.js +3 -3
- package/dist/cjs/components/theme-panel.js.map +2 -2
- package/dist/cjs/components/theme.js +1 -1
- package/dist/cjs/components/theme.js.map +2 -2
- package/dist/cjs/components/theme.props.d.ts +1 -1
- package/dist/cjs/components/theme.props.js +1 -1
- package/dist/cjs/components/theme.props.js.map +2 -2
- package/dist/cjs/components/toggle-button.js +1 -1
- package/dist/cjs/components/toggle-button.js.map +2 -2
- package/dist/cjs/components/toggle-icon-button.js +1 -1
- package/dist/cjs/components/toggle-icon-button.js.map +2 -2
- package/dist/cjs/components/tooltip.js +1 -1
- package/dist/cjs/components/tooltip.js.map +2 -2
- package/dist/cjs/components/user-card.js +1 -1
- package/dist/cjs/components/user-card.js.map +2 -2
- 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 +4 -4
- package/dist/cjs/helpers/extract-props.js +1 -1
- package/dist/cjs/helpers/extract-props.js.map +2 -2
- package/dist/cjs/helpers/get-margin-styles.js +1 -1
- package/dist/cjs/helpers/get-margin-styles.js.map +2 -2
- package/dist/cjs/hooks/use-breakpoint.d.ts +4 -1
- package/dist/cjs/hooks/use-breakpoint.d.ts.map +1 -1
- package/dist/cjs/hooks/use-breakpoint.js +1 -1
- package/dist/cjs/hooks/use-breakpoint.js.map +3 -3
- package/dist/cjs/index.js +5 -5
- package/dist/cjs/index.js.map +4 -4
- package/dist/cjs/props/index.js +1 -1
- package/dist/cjs/props/index.js.map +3 -3
- package/dist/esm/{chunk-P7HYVJSU.js → chunk-2TIADHPD.js} +2 -2
- package/dist/esm/chunk-37OGSEQR.js +2 -0
- package/dist/esm/chunk-37OGSEQR.js.map +7 -0
- package/dist/esm/{chunk-RMKXWYOV.js → chunk-3OBXZUFJ.js} +2 -2
- package/dist/esm/{chunk-S2HA3W3V.js → chunk-3R7XMRV5.js} +2 -2
- package/dist/esm/chunk-4SMJ7D4S.js +2 -0
- package/dist/esm/chunk-4SMJ7D4S.js.map +7 -0
- package/dist/esm/{chunk-S56YSRHP.js → chunk-56TS6OKQ.js} +2 -2
- package/dist/esm/{chunk-2FYJTSOP.js → chunk-5BYHEYO6.js} +2 -2
- package/dist/esm/{chunk-B24BDVG2.js → chunk-5MNBQROW.js} +2 -2
- package/dist/esm/{chunk-W7N7V5YD.js → chunk-7ESHXHHO.js} +2 -2
- package/dist/esm/{chunk-CRWYCLTE.js → chunk-ABSKRHVM.js} +2 -2
- package/dist/esm/chunk-ADBLURLJ.js +2 -0
- package/dist/esm/chunk-ADBLURLJ.js.map +7 -0
- package/dist/esm/{chunk-3MWWP4MW.js → chunk-BBJUB52V.js} +2 -2
- package/dist/esm/{chunk-PTLFMWCN.js → chunk-CQNPBTM5.js} +2 -2
- package/dist/esm/{chunk-GJSGKE7B.js → chunk-CTA5ODAO.js} +2 -2
- package/dist/esm/{chunk-GWXVETMF.js → chunk-DCAZPMOB.js} +2 -2
- package/dist/esm/{chunk-PLWXTEVE.js → chunk-DMJJM5IS.js} +2 -2
- package/dist/esm/{chunk-A2RZGGMY.js → chunk-DQAUX5ZL.js} +2 -2
- package/dist/esm/{chunk-6XGZPIUT.js → chunk-DX5JJYMZ.js} +2 -2
- package/dist/esm/{chunk-6XGZPIUT.js.map → chunk-DX5JJYMZ.js.map} +2 -2
- package/dist/esm/{chunk-YUP6EICB.js → chunk-DXL6V2A5.js} +2 -2
- package/dist/esm/{chunk-XMRIRFM7.js → chunk-FG7XM7KJ.js} +2 -2
- package/dist/esm/{chunk-IKSN4RNB.js → chunk-FIB3XATL.js} +3 -3
- package/dist/esm/chunk-FMBECDL4.js +2 -0
- package/dist/esm/{chunk-4XJY6FIK.js.map → chunk-FMBECDL4.js.map} +3 -3
- package/dist/esm/{chunk-374ZYJUP.js → chunk-HBR42MIX.js} +2 -2
- package/dist/esm/{chunk-2UPAYDKR.js → chunk-HIKVMKYQ.js} +2 -2
- package/dist/esm/{chunk-VX6ARMWP.js → chunk-HSAG7C53.js} +2 -2
- package/dist/esm/{chunk-OSRJRBKP.js → chunk-HW324FK3.js} +2 -2
- package/dist/esm/{chunk-DNHUQLXO.js → chunk-JBO5YOUM.js} +2 -2
- package/dist/esm/{chunk-HF5WY5YE.js → chunk-JGLAE5G7.js} +2 -2
- package/dist/esm/{chunk-4YFJWXL2.js → chunk-JJKQ7CGI.js} +2 -2
- package/dist/esm/chunk-JSW6J6RS.js +2 -0
- package/dist/esm/chunk-JSW6J6RS.js.map +7 -0
- package/dist/esm/chunk-KRDP5SQ7.js +2 -0
- package/dist/esm/chunk-KRDP5SQ7.js.map +7 -0
- package/dist/esm/{chunk-CWRNW44F.js → chunk-L6PVH3RM.js} +2 -2
- package/dist/esm/{chunk-MK2R6DAU.js → chunk-LAOMR7SE.js} +2 -2
- package/dist/esm/{chunk-FHOCUZDR.js → chunk-NIQT45PJ.js} +2 -2
- package/dist/esm/chunk-NKEJTTIL.js +2 -0
- package/dist/esm/chunk-NKEJTTIL.js.map +7 -0
- package/dist/esm/chunk-NVDXXGVW.js +2 -0
- package/dist/esm/chunk-NVDXXGVW.js.map +7 -0
- package/dist/esm/chunk-OS3FCYZY.js +2 -0
- package/dist/esm/{chunk-7QDTSBJF.js → chunk-OYF6YXH7.js} +2 -2
- package/dist/esm/{chunk-WFMYNZXZ.js → chunk-P5OSU4NX.js} +2 -2
- package/dist/esm/{chunk-QEOAXJLN.js → chunk-PTS6QYQW.js} +2 -2
- package/dist/esm/{chunk-CVWCKOHO.js → chunk-RLPKKCBL.js} +2 -2
- package/dist/esm/{chunk-LKAK5GXF.js → chunk-SPIU5JYC.js} +2 -2
- package/dist/esm/chunk-SZTZ2XLI.js +2 -0
- package/dist/esm/chunk-SZTZ2XLI.js.map +7 -0
- package/dist/esm/chunk-T2FZN7G3.js +2 -0
- package/dist/esm/chunk-T2FZN7G3.js.map +7 -0
- package/dist/esm/{chunk-4AQTUBVP.js → chunk-T4UHUQFJ.js} +2 -2
- package/dist/esm/{chunk-K6QZMNCD.js → chunk-TS623UPD.js} +2 -2
- package/dist/esm/{chunk-YV2KYHGR.js → chunk-UBOOUDS4.js} +2 -2
- package/dist/esm/{chunk-D6B7IMZU.js → chunk-UFI53QUC.js} +2 -2
- package/dist/esm/{chunk-AU3D6F42.js → chunk-UIRSGVJG.js} +2 -2
- package/dist/esm/{chunk-FXUUI6Z2.js → chunk-UUUZXUIP.js} +2 -2
- package/dist/esm/{chunk-25WZA7ZU.js → chunk-VA4CTVQL.js} +2 -2
- package/dist/esm/{chunk-TOLLPRMM.js → chunk-VNPNEJI6.js} +2 -2
- package/dist/esm/{chunk-6IGTK4JE.js → chunk-YMUGKYGW.js} +2 -2
- package/dist/esm/chunk-ZWYYPFZW.js +2 -0
- package/dist/esm/chunk-ZWYYPFZW.js.map +7 -0
- package/dist/esm/{chunk-M24UXMOQ.js → chunk-ZXZOH63L.js} +2 -2
- package/dist/esm/components/_internal/base-button.js +1 -1
- package/dist/esm/components/_internal/base-button.props.js +1 -1
- package/dist/esm/components/_internal/base-checkbox.props.js +1 -1
- package/dist/esm/components/_internal/base-menu.props.js +1 -1
- package/dist/esm/components/_internal/base-menu.utils.d.ts +48 -0
- package/dist/esm/components/_internal/base-menu.utils.d.ts.map +1 -0
- package/dist/esm/components/_internal/base-menu.utils.js +2 -0
- package/dist/esm/components/_internal/base-menu.utils.js.map +7 -0
- package/dist/esm/components/_internal/base-radio.props.js +1 -1
- package/dist/esm/components/_internal/base-tab-list.props.js +1 -1
- package/dist/esm/components/_internal/dropdown-menu-drill-down.d.ts +77 -59
- package/dist/esm/components/_internal/dropdown-menu-drill-down.d.ts.map +1 -1
- package/dist/esm/components/_internal/dropdown-menu-drill-down.js +1 -1
- package/dist/esm/components/_internal/menu-context.d.ts +7 -3
- package/dist/esm/components/_internal/menu-context.d.ts.map +1 -1
- package/dist/esm/components/_internal/menu-context.js +1 -1
- package/dist/esm/components/_internal/shell-bottom.js +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-prop-helpers.js +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/accessible-icon.js +1 -1
- package/dist/esm/components/accordion.js +1 -1
- package/dist/esm/components/accordion.props.js +1 -1
- package/dist/esm/components/alert-dialog.js +1 -1
- package/dist/esm/components/alert-dialog.props.js +1 -1
- package/dist/esm/components/aspect-ratio.js +1 -1
- package/dist/esm/components/avatar.js +1 -1
- package/dist/esm/components/avatar.props.js +1 -1
- package/dist/esm/components/badge.js +1 -1
- package/dist/esm/components/badge.props.js +1 -1
- package/dist/esm/components/blockquote.js +1 -1
- package/dist/esm/components/blockquote.props.js +1 -1
- package/dist/esm/components/box.js +1 -1
- package/dist/esm/components/box.props.js +1 -1
- package/dist/esm/components/button.js +1 -1
- package/dist/esm/components/button.props.js +1 -1
- package/dist/esm/components/callout.js +1 -1
- package/dist/esm/components/callout.props.js +1 -1
- package/dist/esm/components/card.js +1 -1
- package/dist/esm/components/card.props.js +1 -1
- package/dist/esm/components/chatbar.d.ts +46 -44
- package/dist/esm/components/chatbar.d.ts.map +1 -1
- package/dist/esm/components/chatbar.js +1 -1
- package/dist/esm/components/checkbox-cards.js +1 -1
- package/dist/esm/components/checkbox-cards.props.js +1 -1
- package/dist/esm/components/checkbox-group.js +1 -1
- package/dist/esm/components/checkbox-group.primitive.js +1 -1
- package/dist/esm/components/checkbox-group.props.js +1 -1
- package/dist/esm/components/checkbox.js +1 -1
- package/dist/esm/components/checkbox.props.js +1 -1
- package/dist/esm/components/code.js +1 -1
- package/dist/esm/components/code.props.js +1 -1
- package/dist/esm/components/combobox.d.ts +28 -15
- package/dist/esm/components/combobox.d.ts.map +1 -1
- package/dist/esm/components/combobox.js +1 -1
- package/dist/esm/components/combobox.props.d.ts +48 -0
- package/dist/esm/components/combobox.props.d.ts.map +1 -1
- package/dist/esm/components/combobox.props.js +1 -1
- package/dist/esm/components/container.js +1 -1
- package/dist/esm/components/container.props.js +1 -1
- package/dist/esm/components/context-menu.d.ts +18 -5
- package/dist/esm/components/context-menu.d.ts.map +1 -1
- package/dist/esm/components/context-menu.js +1 -1
- package/dist/esm/components/context-menu.props.d.ts +1 -1
- package/dist/esm/components/context-menu.props.d.ts.map +1 -1
- package/dist/esm/components/context-menu.props.js +1 -1
- package/dist/esm/components/data-list.js +1 -1
- package/dist/esm/components/data-list.props.js +1 -1
- package/dist/esm/components/dialog.js +1 -1
- package/dist/esm/components/dialog.props.js +1 -1
- package/dist/esm/components/dropdown-menu.d.ts +11 -18
- package/dist/esm/components/dropdown-menu.d.ts.map +1 -1
- package/dist/esm/components/dropdown-menu.js +1 -1
- package/dist/esm/components/dropdown-menu.props.js +1 -1
- package/dist/esm/components/em.js +1 -1
- package/dist/esm/components/em.props.js +1 -1
- package/dist/esm/components/flex.js +1 -1
- package/dist/esm/components/flex.props.js +1 -1
- package/dist/esm/components/grid.js +1 -1
- package/dist/esm/components/grid.props.js +1 -1
- package/dist/esm/components/heading.js +1 -1
- package/dist/esm/components/heading.props.js +1 -1
- package/dist/esm/components/hover-card.js +1 -1
- package/dist/esm/components/hover-card.props.js +1 -1
- package/dist/esm/components/icon-button.js +1 -1
- package/dist/esm/components/icon-button.props.js +1 -1
- package/dist/esm/components/icons.js +1 -1
- package/dist/esm/components/image.js +1 -1
- package/dist/esm/components/image.props.js +1 -1
- package/dist/esm/components/index.js +1 -1
- package/dist/esm/components/inset.js +1 -1
- package/dist/esm/components/inset.props.js +1 -1
- package/dist/esm/components/kbd.js +1 -1
- package/dist/esm/components/kbd.props.js +1 -1
- package/dist/esm/components/link.js +1 -1
- package/dist/esm/components/link.props.js +1 -1
- package/dist/esm/components/navbar.js +1 -1
- package/dist/esm/components/navbar.props.js +1 -1
- package/dist/esm/components/popover.js +1 -1
- package/dist/esm/components/popover.props.js +1 -1
- package/dist/esm/components/portal.js +1 -1
- package/dist/esm/components/progress.js +1 -1
- package/dist/esm/components/progress.props.js +1 -1
- package/dist/esm/components/quote.js +1 -1
- package/dist/esm/components/quote.props.js +1 -1
- package/dist/esm/components/radio-cards.js +1 -1
- package/dist/esm/components/radio-cards.props.js +1 -1
- package/dist/esm/components/radio-group.js +1 -1
- package/dist/esm/components/radio-group.props.js +1 -1
- package/dist/esm/components/radio.js +1 -1
- package/dist/esm/components/radio.props.js +1 -1
- package/dist/esm/components/reset.js +1 -1
- package/dist/esm/components/schemas/base-button.schema.d.ts +111 -256
- 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 +136 -557
- 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/icon-button.schema.d.ts +123 -240
- package/dist/esm/components/schemas/icon-button.schema.d.ts.map +1 -1
- package/dist/esm/components/schemas/icon-button.schema.js +1 -1
- package/dist/esm/components/schemas/index.js +1 -1
- package/dist/esm/components/schemas/shell.schema.d.ts +592 -851
- 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-button.schema.d.ts +138 -1026
- package/dist/esm/components/schemas/toggle-button.schema.d.ts.map +1 -1
- package/dist/esm/components/schemas/toggle-button.schema.js +1 -1
- package/dist/esm/components/schemas/toggle-icon-button.schema.d.ts +124 -465
- package/dist/esm/components/schemas/toggle-icon-button.schema.d.ts.map +1 -1
- package/dist/esm/components/schemas/toggle-icon-button.schema.js +1 -1
- package/dist/esm/components/scroll-area.js +1 -1
- package/dist/esm/components/scroll-area.props.js +1 -1
- package/dist/esm/components/section.js +1 -1
- package/dist/esm/components/section.props.js +1 -1
- package/dist/esm/components/segmented-control.js +1 -1
- package/dist/esm/components/segmented-control.props.js +1 -1
- package/dist/esm/components/select.js +1 -1
- package/dist/esm/components/select.props.js +1 -1
- package/dist/esm/components/separator.js +1 -1
- package/dist/esm/components/separator.props.js +1 -1
- package/dist/esm/components/sheet.js +1 -1
- package/dist/esm/components/shell.context.js +1 -1
- package/dist/esm/components/shell.hooks.js +1 -1
- package/dist/esm/components/shell.js +1 -1
- package/dist/esm/components/shell.types.js +1 -1
- package/dist/esm/components/sidebar.js +1 -1
- package/dist/esm/components/sidebar.props.js +1 -1
- package/dist/esm/components/skeleton.js +1 -1
- package/dist/esm/components/skeleton.props.js +1 -1
- package/dist/esm/components/slider.js +1 -1
- package/dist/esm/components/slider.props.js +1 -1
- package/dist/esm/components/slot.d.ts +6 -2
- package/dist/esm/components/slot.d.ts.map +1 -1
- package/dist/esm/components/slot.js +1 -1
- package/dist/esm/components/spinner.js +1 -1
- package/dist/esm/components/spinner.props.js +1 -1
- package/dist/esm/components/strong.js +1 -1
- package/dist/esm/components/strong.props.js +1 -1
- package/dist/esm/components/switch.js +1 -1
- package/dist/esm/components/switch.props.js +1 -1
- package/dist/esm/components/tab-nav.js +1 -1
- package/dist/esm/components/tab-nav.props.js +1 -1
- package/dist/esm/components/table.js +1 -1
- package/dist/esm/components/table.props.js +1 -1
- package/dist/esm/components/tabs.js +1 -1
- package/dist/esm/components/tabs.props.js +1 -1
- package/dist/esm/components/text-area.js +1 -1
- package/dist/esm/components/text-area.props.js +1 -1
- package/dist/esm/components/text-field.js +1 -1
- package/dist/esm/components/text-field.props.js +1 -1
- package/dist/esm/components/text.js +1 -1
- package/dist/esm/components/text.props.js +1 -1
- package/dist/esm/components/theme-panel.js +1 -1
- package/dist/esm/components/theme.js +1 -1
- package/dist/esm/components/theme.props.d.ts +1 -1
- package/dist/esm/components/theme.props.js +1 -1
- package/dist/esm/components/toggle-button.js +1 -1
- package/dist/esm/components/toggle-icon-button.js +1 -1
- package/dist/esm/components/toolbar.js +1 -1
- package/dist/esm/components/tooltip.js +1 -1
- package/dist/esm/components/tooltip.props.js +1 -1
- package/dist/esm/components/user-card.js +1 -1
- package/dist/esm/components/user-card.props.js +1 -1
- package/dist/esm/components/virtual-menu.d.ts.map +1 -1
- package/dist/esm/components/virtual-menu.js +1 -1
- package/dist/esm/components/visually-hidden.js +1 -1
- package/dist/esm/helpers/compile-prop-defs.js +1 -1
- package/dist/esm/helpers/extract-margin-props.js +1 -1
- package/dist/esm/helpers/extract-props.js +1 -1
- package/dist/esm/helpers/font-config.js +1 -1
- package/dist/esm/helpers/get-margin-styles.js +1 -1
- package/dist/esm/helpers/get-matching-gray-color.js +1 -1
- package/dist/esm/helpers/get-responsive-styles.js +1 -1
- package/dist/esm/helpers/get-subtree.js +1 -1
- package/dist/esm/helpers/has-own-property.js +1 -1
- package/dist/esm/helpers/index.js +1 -1
- package/dist/esm/helpers/inert.js +1 -1
- package/dist/esm/helpers/is-responsive-object.js +1 -1
- package/dist/esm/helpers/map-prop-values.js +1 -1
- package/dist/esm/helpers/merge-styles.js +1 -1
- package/dist/esm/helpers/normalize-to-px.js +1 -1
- package/dist/esm/helpers/require-react-element.js +1 -1
- package/dist/esm/helpers/use-deprecation-warning.js +1 -1
- package/dist/esm/hooks/index.js +1 -1
- package/dist/esm/hooks/use-body-pointer-events-cleanup.js +1 -1
- package/dist/esm/hooks/use-breakpoint.d.ts +4 -1
- package/dist/esm/hooks/use-breakpoint.d.ts.map +1 -1
- package/dist/esm/hooks/use-breakpoint.js +1 -1
- package/dist/esm/hooks/use-live-announcer.js +1 -1
- package/dist/esm/hooks/use-prop-synced-state.js +1 -1
- package/dist/esm/hooks/use-toggle-state.js +1 -1
- package/dist/esm/hooks/use-tooltip-wrapper.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/props/as-child.prop.js +1 -1
- package/dist/esm/props/color.prop.js +1 -1
- package/dist/esm/props/font-family.prop.js +1 -1
- package/dist/esm/props/gap.props.js +1 -1
- package/dist/esm/props/height.props.js +1 -1
- package/dist/esm/props/high-contrast.prop.js +1 -1
- package/dist/esm/props/index.js +1 -1
- package/dist/esm/props/layout.props.js +1 -1
- package/dist/esm/props/leading-trim.prop.js +1 -1
- package/dist/esm/props/margin.props.js +1 -1
- package/dist/esm/props/padding.props.js +1 -1
- package/dist/esm/props/prop-def.js +1 -1
- package/dist/esm/props/radius.prop.js +1 -1
- package/dist/esm/props/shadow.props.js +1 -1
- package/dist/esm/props/text-align.prop.js +1 -1
- package/dist/esm/props/text-wrap.prop.js +1 -1
- package/dist/esm/props/truncate.prop.js +1 -1
- package/dist/esm/props/weight.prop.js +1 -1
- package/dist/esm/props/width.props.js +1 -1
- package/fonts.css +2 -0
- package/package.json +36 -36
- package/schemas/base-button.json +66 -60
- package/schemas/button.json +80 -74
- package/schemas/icon-button.json +78 -72
- package/schemas/index.json +390 -360
- package/schemas/toggle-button.json +84 -78
- package/schemas/toggle-icon-button.json +82 -76
- package/src/components/_internal/base-card.css +5 -5
- package/src/components/_internal/base-checkbox.css +17 -3
- package/src/components/_internal/base-dialog.css +4 -4
- package/src/components/_internal/base-menu.css +68 -143
- package/src/components/_internal/base-menu.utils.tsx +144 -0
- package/src/components/_internal/dropdown-menu-drill-down.tsx +281 -183
- package/src/components/_internal/menu-context.tsx +24 -15
- package/src/components/accordion.css +5 -5
- package/src/components/callout.css +5 -5
- package/src/components/chatbar.css +100 -32
- package/src/components/chatbar.tsx +739 -735
- package/src/components/checkbox-cards.css +30 -0
- package/src/components/combobox.css +62 -115
- package/src/components/combobox.props.tsx +14 -0
- package/src/components/combobox.tsx +440 -212
- package/src/components/context-menu.props.tsx +4 -1
- package/src/components/context-menu.tsx +108 -62
- package/src/components/dropdown-menu.css +41 -121
- package/src/components/dropdown-menu.tsx +430 -275
- package/src/components/hover-card.css +3 -3
- package/src/components/popover.css +4 -4
- package/src/components/radio-cards.css +30 -0
- package/src/components/schemas/shell.schema.ts +11 -18
- package/src/components/scroll-area.css +2 -3
- package/src/components/select.css +2 -2
- package/src/components/shell.css +1 -1
- package/src/components/table.css +5 -5
- package/src/components/theme.props.tsx +1 -1
- package/src/components/tooltip.css +1 -1
- package/src/components/virtual-menu.tsx +12 -8
- package/src/hooks/use-breakpoint.ts +19 -3
- package/src/styles/fonts.css +6 -1
- package/src/styles/tokens/font-family.css +13 -5
- package/src/styles/tokens/radius.css +47 -4
- package/styles.css +801 -784
- package/tokens/base.css +19 -2
- package/tokens.css +19 -2
- package/dist/esm/chunk-3XT5P2HO.js +0 -2
- package/dist/esm/chunk-4XJY6FIK.js +0 -2
- package/dist/esm/chunk-4Z33XHOK.js +0 -2
- package/dist/esm/chunk-4Z33XHOK.js.map +0 -7
- package/dist/esm/chunk-E2Z5IA2P.js +0 -2
- package/dist/esm/chunk-E2Z5IA2P.js.map +0 -7
- package/dist/esm/chunk-HVWEPVBH.js +0 -2
- package/dist/esm/chunk-HVWEPVBH.js.map +0 -7
- package/dist/esm/chunk-KKBP2CRH.js +0 -2
- package/dist/esm/chunk-KKBP2CRH.js.map +0 -7
- package/dist/esm/chunk-MOR3NSXQ.js +0 -2
- package/dist/esm/chunk-MOR3NSXQ.js.map +0 -7
- package/dist/esm/chunk-QCNUTT4R.js +0 -2
- package/dist/esm/chunk-QCNUTT4R.js.map +0 -7
- package/dist/esm/chunk-UGD7Z3L4.js +0 -2
- package/dist/esm/chunk-UGD7Z3L4.js.map +0 -7
- package/dist/esm/chunk-YEB3H7QN.js +0 -2
- package/dist/esm/chunk-YEB3H7QN.js.map +0 -7
- package/dist/esm/chunk-ZY6SQWHT.js +0 -2
- package/dist/esm/chunk-ZY6SQWHT.js.map +0 -7
- /package/dist/esm/{chunk-P7HYVJSU.js.map → chunk-2TIADHPD.js.map} +0 -0
- /package/dist/esm/{chunk-RMKXWYOV.js.map → chunk-3OBXZUFJ.js.map} +0 -0
- /package/dist/esm/{chunk-S2HA3W3V.js.map → chunk-3R7XMRV5.js.map} +0 -0
- /package/dist/esm/{chunk-S56YSRHP.js.map → chunk-56TS6OKQ.js.map} +0 -0
- /package/dist/esm/{chunk-2FYJTSOP.js.map → chunk-5BYHEYO6.js.map} +0 -0
- /package/dist/esm/{chunk-B24BDVG2.js.map → chunk-5MNBQROW.js.map} +0 -0
- /package/dist/esm/{chunk-W7N7V5YD.js.map → chunk-7ESHXHHO.js.map} +0 -0
- /package/dist/esm/{chunk-CRWYCLTE.js.map → chunk-ABSKRHVM.js.map} +0 -0
- /package/dist/esm/{chunk-3MWWP4MW.js.map → chunk-BBJUB52V.js.map} +0 -0
- /package/dist/esm/{chunk-PTLFMWCN.js.map → chunk-CQNPBTM5.js.map} +0 -0
- /package/dist/esm/{chunk-GJSGKE7B.js.map → chunk-CTA5ODAO.js.map} +0 -0
- /package/dist/esm/{chunk-GWXVETMF.js.map → chunk-DCAZPMOB.js.map} +0 -0
- /package/dist/esm/{chunk-PLWXTEVE.js.map → chunk-DMJJM5IS.js.map} +0 -0
- /package/dist/esm/{chunk-A2RZGGMY.js.map → chunk-DQAUX5ZL.js.map} +0 -0
- /package/dist/esm/{chunk-YUP6EICB.js.map → chunk-DXL6V2A5.js.map} +0 -0
- /package/dist/esm/{chunk-XMRIRFM7.js.map → chunk-FG7XM7KJ.js.map} +0 -0
- /package/dist/esm/{chunk-IKSN4RNB.js.map → chunk-FIB3XATL.js.map} +0 -0
- /package/dist/esm/{chunk-374ZYJUP.js.map → chunk-HBR42MIX.js.map} +0 -0
- /package/dist/esm/{chunk-2UPAYDKR.js.map → chunk-HIKVMKYQ.js.map} +0 -0
- /package/dist/esm/{chunk-VX6ARMWP.js.map → chunk-HSAG7C53.js.map} +0 -0
- /package/dist/esm/{chunk-OSRJRBKP.js.map → chunk-HW324FK3.js.map} +0 -0
- /package/dist/esm/{chunk-DNHUQLXO.js.map → chunk-JBO5YOUM.js.map} +0 -0
- /package/dist/esm/{chunk-HF5WY5YE.js.map → chunk-JGLAE5G7.js.map} +0 -0
- /package/dist/esm/{chunk-4YFJWXL2.js.map → chunk-JJKQ7CGI.js.map} +0 -0
- /package/dist/esm/{chunk-CWRNW44F.js.map → chunk-L6PVH3RM.js.map} +0 -0
- /package/dist/esm/{chunk-MK2R6DAU.js.map → chunk-LAOMR7SE.js.map} +0 -0
- /package/dist/esm/{chunk-FHOCUZDR.js.map → chunk-NIQT45PJ.js.map} +0 -0
- /package/dist/esm/{chunk-3XT5P2HO.js.map → chunk-OS3FCYZY.js.map} +0 -0
- /package/dist/esm/{chunk-7QDTSBJF.js.map → chunk-OYF6YXH7.js.map} +0 -0
- /package/dist/esm/{chunk-WFMYNZXZ.js.map → chunk-P5OSU4NX.js.map} +0 -0
- /package/dist/esm/{chunk-QEOAXJLN.js.map → chunk-PTS6QYQW.js.map} +0 -0
- /package/dist/esm/{chunk-CVWCKOHO.js.map → chunk-RLPKKCBL.js.map} +0 -0
- /package/dist/esm/{chunk-LKAK5GXF.js.map → chunk-SPIU5JYC.js.map} +0 -0
- /package/dist/esm/{chunk-4AQTUBVP.js.map → chunk-T4UHUQFJ.js.map} +0 -0
- /package/dist/esm/{chunk-K6QZMNCD.js.map → chunk-TS623UPD.js.map} +0 -0
- /package/dist/esm/{chunk-YV2KYHGR.js.map → chunk-UBOOUDS4.js.map} +0 -0
- /package/dist/esm/{chunk-D6B7IMZU.js.map → chunk-UFI53QUC.js.map} +0 -0
- /package/dist/esm/{chunk-AU3D6F42.js.map → chunk-UIRSGVJG.js.map} +0 -0
- /package/dist/esm/{chunk-FXUUI6Z2.js.map → chunk-UUUZXUIP.js.map} +0 -0
- /package/dist/esm/{chunk-25WZA7ZU.js.map → chunk-VA4CTVQL.js.map} +0 -0
- /package/dist/esm/{chunk-TOLLPRMM.js.map → chunk-VNPNEJI6.js.map} +0 -0
- /package/dist/esm/{chunk-6IGTK4JE.js.map → chunk-YMUGKYGW.js.map} +0 -0
- /package/dist/esm/{chunk-M24UXMOQ.js.map → chunk-ZXZOH63L.js.map} +0 -0
|
@@ -1,213 +1,319 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
import type { submenuBehaviors } from './base-menu.props.js';
|
|
6
|
-
import { useBreakpoint } from '../../hooks/use-breakpoint.js';
|
|
7
6
|
|
|
8
7
|
type SubmenuBehavior = (typeof submenuBehaviors)[number];
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
/*
|
|
10
|
+
* Drill-down navigation for DropdownMenu.
|
|
11
|
+
*
|
|
12
|
+
* The stack of open submenus lives in a small external store rather than in
|
|
13
|
+
* React state, so each part subscribes only to the slice it renders from:
|
|
14
|
+
* a panel re-renders when it enters or leaves the stack, a Sub when its own
|
|
15
|
+
* open state changes, and nothing else on the path re-renders on navigation.
|
|
16
|
+
*
|
|
17
|
+
* Only the levels on the stack mount their children, and only the top level
|
|
18
|
+
* mounts its items (see `DrillDownLevelContext`). That keeps the Radix item
|
|
19
|
+
* collection limited to what is on screen, so roving focus and typeahead
|
|
20
|
+
* never land on a hidden item.
|
|
13
21
|
*/
|
|
14
|
-
function resolveResponsiveValue<T>(
|
|
15
|
-
value: T | Partial<Record<Breakpoint, T>> | undefined,
|
|
16
|
-
currentBreakpoint: Breakpoint,
|
|
17
|
-
defaultValue: T
|
|
18
|
-
): T {
|
|
19
|
-
if (value === undefined || value === null) {
|
|
20
|
-
return defaultValue;
|
|
21
|
-
}
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
type AnimationDirection = 'forward' | 'backward' | null;
|
|
24
|
+
type Modality = 'keyboard' | 'pointer';
|
|
25
|
+
|
|
26
|
+
interface StackEntry {
|
|
27
|
+
id: string;
|
|
28
|
+
/** Accessible name of the submenu, taken from its trigger text */
|
|
29
|
+
name: string;
|
|
30
|
+
/** Scroll position of the parent level when this entry was pushed */
|
|
31
|
+
scrollTop: number;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
type LastChange =
|
|
35
|
+
| { type: 'push'; id: string; modality: Modality | null }
|
|
36
|
+
| { type: 'pop'; id: string; modality: Modality | null; scrollTop: number }
|
|
37
|
+
| { type: 'reset' };
|
|
38
|
+
|
|
39
|
+
interface DrillDownState {
|
|
40
|
+
stack: StackEntry[];
|
|
41
|
+
direction: AnimationDirection;
|
|
42
|
+
lastChange: LastChange | null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const INITIAL_STATE: DrillDownState = { stack: [], direction: null, lastChange: null };
|
|
46
|
+
|
|
47
|
+
const PANEL_ITEM_SELECTOR = '[role^="menuitem"]:not([data-disabled])';
|
|
48
|
+
const BACK_ITEM_CLASS = 'rt-DropdownMenuDrillDownBackItem';
|
|
49
|
+
|
|
50
|
+
function escapeAttributeValue(value: string) {
|
|
51
|
+
return value.replace(/["\\]/g, '\\$&');
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
class DrillDownStore {
|
|
55
|
+
private state = INITIAL_STATE;
|
|
56
|
+
private listeners = new Set<() => void>();
|
|
57
|
+
private modality: Modality = 'keyboard';
|
|
58
|
+
/** The drill-down root element, set by the provider */
|
|
59
|
+
rootElement: HTMLElement | null = null;
|
|
60
|
+
|
|
61
|
+
setRootElement = (element: HTMLElement | null) => {
|
|
62
|
+
this.rootElement = element;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
getState = () => this.state;
|
|
66
|
+
|
|
67
|
+
subscribe = (listener: () => void) => {
|
|
68
|
+
this.listeners.add(listener);
|
|
69
|
+
return () => {
|
|
70
|
+
this.listeners.delete(listener);
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
private setState(next: DrillDownState) {
|
|
75
|
+
this.state = next;
|
|
76
|
+
this.listeners.forEach((listener) => listener());
|
|
26
77
|
}
|
|
27
78
|
|
|
28
|
-
|
|
79
|
+
/** Records how the user is interacting, so focus can follow the same model as Radix. */
|
|
80
|
+
setModality = (modality: Modality) => {
|
|
81
|
+
this.modality = modality;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
getModality = () => this.modality;
|
|
85
|
+
|
|
86
|
+
getDepth = () => this.state.stack.length;
|
|
87
|
+
|
|
88
|
+
isOpen = (id: string) => this.state.stack.some((entry) => entry.id === id);
|
|
29
89
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
90
|
+
private getScrollContainer() {
|
|
91
|
+
const root = this.rootElement;
|
|
92
|
+
if (!root) return null;
|
|
93
|
+
return (
|
|
94
|
+
root.closest<HTMLElement>('.rt-ScrollAreaViewport') ??
|
|
95
|
+
root.closest<HTMLElement>('.rt-BaseMenuViewport')
|
|
96
|
+
);
|
|
33
97
|
}
|
|
34
98
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
99
|
+
private getTrigger(id: string) {
|
|
100
|
+
return this.rootElement?.querySelector<HTMLElement>(
|
|
101
|
+
`[data-drill-down-trigger="${escapeAttributeValue(id)}"]`,
|
|
102
|
+
);
|
|
103
|
+
}
|
|
38
104
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
105
|
+
/**
|
|
106
|
+
* Opens a submenu. `modality` decides where focus goes: the first item for
|
|
107
|
+
* keyboard, the menu for pointer, and nowhere for a programmatic open
|
|
108
|
+
* (`null`) unless focus was lost.
|
|
109
|
+
*/
|
|
110
|
+
push = (id: string, modality: Modality | null = this.modality) => {
|
|
111
|
+
const { stack } = this.state;
|
|
112
|
+
if (stack.some((entry) => entry.id === id)) return;
|
|
113
|
+
const trigger = this.getTrigger(id);
|
|
114
|
+
const name = (trigger?.dataset.drillDownName ?? trigger?.textContent ?? '').trim();
|
|
115
|
+
const scrollTop = this.getScrollContainer()?.scrollTop ?? 0;
|
|
116
|
+
this.setState({
|
|
117
|
+
stack: [...stack, { id, name, scrollTop }],
|
|
118
|
+
direction: 'forward',
|
|
119
|
+
lastChange: { type: 'push', id, modality },
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
pop = (modality: Modality = this.modality) => {
|
|
124
|
+
const { stack } = this.state;
|
|
125
|
+
const top = stack[stack.length - 1];
|
|
126
|
+
if (!top) return;
|
|
127
|
+
this.setState({
|
|
128
|
+
stack: stack.slice(0, -1),
|
|
129
|
+
direction: 'backward',
|
|
130
|
+
lastChange: { type: 'pop', id: top.id, modality, scrollTop: top.scrollTop },
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
/** Closes a submenu and everything opened from it, without moving focus to its trigger. */
|
|
135
|
+
close = (id: string) => {
|
|
136
|
+
const { stack } = this.state;
|
|
137
|
+
const index = stack.findIndex((entry) => entry.id === id);
|
|
138
|
+
if (index === -1) return;
|
|
139
|
+
this.setState({
|
|
140
|
+
stack: stack.slice(0, index),
|
|
141
|
+
direction: 'backward',
|
|
142
|
+
lastChange: { type: 'pop', id, modality: null, scrollTop: stack[index].scrollTop },
|
|
143
|
+
});
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
reset = () => {
|
|
147
|
+
if (this.state.stack.length === 0 && this.state.direction === null) return;
|
|
148
|
+
this.setState({ stack: [], direction: null, lastChange: { type: 'reset' } });
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Moves focus and scroll after a navigation step has been committed. Runs in
|
|
153
|
+
* a layout effect, so the new level is already in the DOM and nothing paints
|
|
154
|
+
* with focus on `<body>` or at the old scroll position.
|
|
155
|
+
*/
|
|
156
|
+
applyLastChange() {
|
|
157
|
+
const change = this.state.lastChange;
|
|
158
|
+
const root = this.rootElement;
|
|
159
|
+
if (!change || !root) return;
|
|
160
|
+
this.state = { ...this.state, lastChange: null };
|
|
161
|
+
|
|
162
|
+
const content = root.closest<HTMLElement>('[role="menu"]');
|
|
163
|
+
const scroller = this.getScrollContainer();
|
|
164
|
+
const focus = (element: HTMLElement | null | undefined) => element?.focus({ preventScroll: true });
|
|
165
|
+
|
|
166
|
+
if (change.type === 'push') {
|
|
167
|
+
if (scroller) scroller.scrollTop = 0;
|
|
168
|
+
const panel = root.querySelector<HTMLElement>(
|
|
169
|
+
`[data-drill-down-panel="${escapeAttributeValue(change.id)}"]`,
|
|
170
|
+
);
|
|
171
|
+
if (change.modality === 'keyboard') {
|
|
172
|
+
// Land on the first real option; the back row stays one ArrowUp away.
|
|
173
|
+
const items = panel ? Array.from(panel.querySelectorAll<HTMLElement>(PANEL_ITEM_SELECTOR)) : [];
|
|
174
|
+
focus(items.find((item) => !item.classList.contains(BACK_ITEM_CLASS)) ?? items[0] ?? content);
|
|
175
|
+
} else if (change.modality === 'pointer' || !root.contains(document.activeElement)) {
|
|
176
|
+
// Match Radix: pointer users get focus on the menu, not a highlighted item.
|
|
177
|
+
focus(content);
|
|
178
|
+
}
|
|
179
|
+
return;
|
|
43
180
|
}
|
|
44
|
-
}
|
|
45
181
|
|
|
46
|
-
|
|
47
|
-
|
|
182
|
+
if (change.type === 'pop') {
|
|
183
|
+
if (scroller) scroller.scrollTop = change.scrollTop;
|
|
184
|
+
const trigger = this.getTrigger(change.id);
|
|
185
|
+
if (change.modality === 'keyboard') {
|
|
186
|
+
focus(trigger ?? content);
|
|
187
|
+
} else if (change.modality === 'pointer' || !root.contains(document.activeElement)) {
|
|
188
|
+
focus(content);
|
|
189
|
+
}
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
48
192
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
193
|
+
if (scroller) scroller.scrollTop = 0;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
52
196
|
|
|
53
|
-
|
|
197
|
+
const DrillDownStoreContext = React.createContext<DrillDownStore | null>(null);
|
|
54
198
|
|
|
55
199
|
/**
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* that only need to call push/pop/reset.
|
|
200
|
+
* Whether the items of the current level are on screen. The root level and
|
|
201
|
+
* every panel provide it; menu parts render nothing when it is false.
|
|
59
202
|
*/
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
pop: () => void;
|
|
65
|
-
/** Reset to root menu */
|
|
66
|
-
reset: () => void;
|
|
203
|
+
const DrillDownLevelContext = React.createContext(true);
|
|
204
|
+
|
|
205
|
+
function useDrillDownStore() {
|
|
206
|
+
return React.useContext(DrillDownStoreContext);
|
|
67
207
|
}
|
|
68
208
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
*/
|
|
73
|
-
interface DrillDownStateContextValue {
|
|
74
|
-
/** Current submenu behavior mode */
|
|
75
|
-
behavior: SubmenuBehavior;
|
|
76
|
-
/** Whether the breakpoint has been resolved (client-side only) */
|
|
77
|
-
ready: boolean;
|
|
78
|
-
/** Stack of active submenu IDs. Empty means root menu is shown. */
|
|
79
|
-
stack: string[];
|
|
80
|
-
/** Check if a specific submenu is the currently active one */
|
|
81
|
-
isActive: (id: string) => boolean;
|
|
82
|
-
/** Check if we're at root level (no submenus open) */
|
|
83
|
-
isRoot: boolean;
|
|
84
|
-
/** The currently active submenu ID (or null if at root) */
|
|
85
|
-
currentId: string | null;
|
|
86
|
-
/** Current animation direction for transitions */
|
|
87
|
-
animationDirection: AnimationDirection;
|
|
209
|
+
function useCreateDrillDownStore() {
|
|
210
|
+
const [store] = React.useState(() => new DrillDownStore());
|
|
211
|
+
return store;
|
|
88
212
|
}
|
|
89
213
|
|
|
90
|
-
const
|
|
91
|
-
const
|
|
214
|
+
const selectDepth = (state: DrillDownState) => state.stack.length;
|
|
215
|
+
const selectDirection = (state: DrillDownState) => state.direction;
|
|
216
|
+
const getServerDepth = () => 0;
|
|
217
|
+
const getServerDirection = (): AnimationDirection => null;
|
|
92
218
|
|
|
93
|
-
interface
|
|
219
|
+
interface DrillDownRootProps {
|
|
220
|
+
store: DrillDownStore;
|
|
221
|
+
behavior: SubmenuBehavior;
|
|
222
|
+
/** Open state of the menu; the stack resets every time the menu opens */
|
|
223
|
+
open: boolean;
|
|
94
224
|
children: React.ReactNode;
|
|
95
|
-
submenuBehavior: Responsive<SubmenuBehavior> | undefined;
|
|
96
225
|
}
|
|
97
226
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
// Reset stack when behavior changes from drill-down to cascade
|
|
110
|
-
const prevBehaviorRef = React.useRef(behavior);
|
|
111
|
-
React.useEffect(() => {
|
|
112
|
-
if (prevBehaviorRef.current === 'drill-down' && behavior === 'cascade') {
|
|
113
|
-
setStack([]);
|
|
114
|
-
setAnimationDirection(null);
|
|
115
|
-
}
|
|
116
|
-
prevBehaviorRef.current = behavior;
|
|
117
|
-
}, [behavior]);
|
|
118
|
-
|
|
119
|
-
// Stable action callbacks - these never change identity
|
|
120
|
-
const push = React.useCallback((id: string) => {
|
|
121
|
-
setAnimationDirection('forward');
|
|
122
|
-
setStack((prev) => [...prev, id]);
|
|
123
|
-
}, []);
|
|
124
|
-
|
|
125
|
-
const pop = React.useCallback(() => {
|
|
126
|
-
setAnimationDirection('backward');
|
|
127
|
-
setStack((prev) => prev.slice(0, -1));
|
|
128
|
-
}, []);
|
|
129
|
-
|
|
130
|
-
const reset = React.useCallback(() => {
|
|
131
|
-
setStack([]);
|
|
132
|
-
setAnimationDirection(null);
|
|
133
|
-
}, []);
|
|
134
|
-
|
|
135
|
-
// Memoize actions context value - completely stable, never changes
|
|
136
|
-
const actionsValue = React.useMemo(
|
|
137
|
-
(): DrillDownActionsContextValue => ({ push, pop, reset }),
|
|
138
|
-
[push, pop, reset]
|
|
139
|
-
);
|
|
140
|
-
|
|
141
|
-
// isActive depends on stack - this is expected to change
|
|
142
|
-
const isActive = React.useCallback(
|
|
143
|
-
(id: string) => {
|
|
144
|
-
if (stack.length === 0) return false;
|
|
145
|
-
return stack[stack.length - 1] === id;
|
|
146
|
-
},
|
|
147
|
-
[stack]
|
|
227
|
+
/**
|
|
228
|
+
* Provides the drill-down store and renders the root level. The wrapper is
|
|
229
|
+
* the same element in both behaviors, so crossing a breakpoint that switches
|
|
230
|
+
* between cascade and drill-down does not remount the items.
|
|
231
|
+
*/
|
|
232
|
+
function DrillDownRoot({ store, behavior, open, children }: DrillDownRootProps) {
|
|
233
|
+
const isDrillDown = behavior === 'drill-down';
|
|
234
|
+
const depth = React.useSyncExternalStore(
|
|
235
|
+
store.subscribe,
|
|
236
|
+
() => selectDepth(store.getState()),
|
|
237
|
+
getServerDepth,
|
|
148
238
|
);
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
behavior,
|
|
154
|
-
ready,
|
|
155
|
-
stack,
|
|
156
|
-
isActive,
|
|
157
|
-
isRoot: stack.length === 0,
|
|
158
|
-
currentId: stack.length > 0 ? stack[stack.length - 1] : null,
|
|
159
|
-
animationDirection,
|
|
160
|
-
}),
|
|
161
|
-
[behavior, ready, stack, isActive, animationDirection]
|
|
239
|
+
const direction = React.useSyncExternalStore(
|
|
240
|
+
store.subscribe,
|
|
241
|
+
() => selectDirection(store.getState()),
|
|
242
|
+
getServerDirection,
|
|
162
243
|
);
|
|
244
|
+
const isRoot = !isDrillDown || depth === 0;
|
|
245
|
+
|
|
246
|
+
// Cascade mode has no stack. A reset while switching modes keeps the next
|
|
247
|
+
// switch back to drill-down from resuming a stale level.
|
|
248
|
+
React.useLayoutEffect(() => {
|
|
249
|
+
if (!isDrillDown) store.reset();
|
|
250
|
+
}, [isDrillDown, store]);
|
|
251
|
+
|
|
252
|
+
// Start every opening at the root. Content usually remounts on open anyway;
|
|
253
|
+
// this covers `forceMount`. Resetting on open rather than on close keeps the
|
|
254
|
+
// closing animation on the level the user was looking at.
|
|
255
|
+
const wasOpenRef = React.useRef(open);
|
|
256
|
+
React.useLayoutEffect(() => {
|
|
257
|
+
if (open && !wasOpenRef.current) store.reset();
|
|
258
|
+
wasOpenRef.current = open;
|
|
259
|
+
}, [open, store]);
|
|
260
|
+
|
|
261
|
+
// Focus and scroll follow each navigation step once it is in the DOM.
|
|
262
|
+
React.useLayoutEffect(() => {
|
|
263
|
+
store.applyLastChange();
|
|
264
|
+
}, [depth, store]);
|
|
265
|
+
|
|
266
|
+
const rootRef = React.useCallback((element: HTMLDivElement | null) => store.setRootElement(element), [store]);
|
|
267
|
+
const handleKeyDownCapture = React.useCallback(() => store.setModality('keyboard'), [store]);
|
|
268
|
+
const handlePointerDownCapture = React.useCallback(() => store.setModality('pointer'), [store]);
|
|
163
269
|
|
|
164
270
|
return (
|
|
165
|
-
<
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
271
|
+
<DrillDownStoreContext.Provider value={isDrillDown ? store : null}>
|
|
272
|
+
{/* Event capture only records the input modality; it does not handle interaction. */}
|
|
273
|
+
<div
|
|
274
|
+
ref={rootRef}
|
|
275
|
+
className="rt-DropdownMenuDrillDownRoot"
|
|
276
|
+
data-submenu-behavior={behavior}
|
|
277
|
+
data-drill-down-active={isRoot ? undefined : true}
|
|
278
|
+
data-animation-direction={isDrillDown ? (direction ?? undefined) : undefined}
|
|
279
|
+
onKeyDownCapture={isDrillDown ? handleKeyDownCapture : undefined}
|
|
280
|
+
onPointerDownCapture={isDrillDown ? handlePointerDownCapture : undefined}
|
|
281
|
+
>
|
|
282
|
+
<DrillDownLevelContext.Provider value={isRoot}>{children}</DrillDownLevelContext.Provider>
|
|
283
|
+
</div>
|
|
284
|
+
</DrillDownStoreContext.Provider>
|
|
170
285
|
);
|
|
171
286
|
}
|
|
172
287
|
|
|
173
|
-
/**
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
return
|
|
288
|
+
/** Where a submenu sits in the stack: not open, open under another level, or on top. */
|
|
289
|
+
type PanelPosition = 'closed' | 'open' | 'top';
|
|
290
|
+
|
|
291
|
+
function usePanelPosition(store: DrillDownStore | null, id: string): PanelPosition {
|
|
292
|
+
const getSnapshot = React.useCallback((): PanelPosition => {
|
|
293
|
+
if (!store) return 'closed';
|
|
294
|
+
const { stack } = store.getState();
|
|
295
|
+
if (stack.length > 0 && stack[stack.length - 1].id === id) return 'top';
|
|
296
|
+
return stack.some((entry) => entry.id === id) ? 'open' : 'closed';
|
|
297
|
+
}, [store, id]);
|
|
298
|
+
return React.useSyncExternalStore(store?.subscribe ?? noopSubscribe, getSnapshot, getClosed);
|
|
184
299
|
}
|
|
185
300
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
if (!ctx) {
|
|
193
|
-
throw new Error('useDrillDownState must be used within a DropdownMenu.Content');
|
|
194
|
-
}
|
|
195
|
-
return ctx;
|
|
301
|
+
function useStackEntry(store: DrillDownStore | null, id: string): StackEntry | undefined {
|
|
302
|
+
const getSnapshot = React.useCallback(
|
|
303
|
+
() => store?.getState().stack.find((entry) => entry.id === id),
|
|
304
|
+
[store, id],
|
|
305
|
+
);
|
|
306
|
+
return React.useSyncExternalStore(store?.subscribe ?? noopSubscribe, getSnapshot, getUndefined);
|
|
196
307
|
}
|
|
197
308
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
function useDrillDownActionsOptional() {
|
|
202
|
-
return React.useContext(DrillDownActionsContext);
|
|
309
|
+
function useDrillDownDirection(store: DrillDownStore | null): AnimationDirection {
|
|
310
|
+
const getSnapshot = React.useCallback(() => store?.getState().direction ?? null, [store]);
|
|
311
|
+
return React.useSyncExternalStore(store?.subscribe ?? noopSubscribe, getSnapshot, getServerDirection);
|
|
203
312
|
}
|
|
204
313
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
function useDrillDownStateOptional() {
|
|
209
|
-
return React.useContext(DrillDownStateContext);
|
|
210
|
-
}
|
|
314
|
+
const noopSubscribe = () => () => {};
|
|
315
|
+
const getClosed = (): PanelPosition => 'closed';
|
|
316
|
+
const getUndefined = () => undefined;
|
|
211
317
|
|
|
212
318
|
// ============================================================================
|
|
213
319
|
// Sub Context (for individual submenu instances)
|
|
@@ -227,23 +333,15 @@ function useSubContext() {
|
|
|
227
333
|
}
|
|
228
334
|
|
|
229
335
|
export {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
DrillDownStateContext,
|
|
336
|
+
DrillDownRoot,
|
|
337
|
+
DrillDownLevelContext,
|
|
233
338
|
SubContext,
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
339
|
+
useCreateDrillDownStore,
|
|
340
|
+
useDrillDownStore,
|
|
341
|
+
useDrillDownDirection,
|
|
342
|
+
usePanelPosition,
|
|
343
|
+
useStackEntry,
|
|
238
344
|
useSubContext,
|
|
239
|
-
useBreakpoint,
|
|
240
|
-
resolveResponsiveValue,
|
|
241
345
|
};
|
|
242
346
|
|
|
243
|
-
export type {
|
|
244
|
-
SubmenuBehavior,
|
|
245
|
-
DrillDownActionsContextValue,
|
|
246
|
-
DrillDownStateContextValue,
|
|
247
|
-
SubContextValue,
|
|
248
|
-
AnimationDirection,
|
|
249
|
-
};
|
|
347
|
+
export type { SubmenuBehavior, DrillDownStore, PanelPosition, SubContextValue, AnimationDirection };
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
import { useThemeContext } from '../theme.js';
|
|
6
|
+
import { useResolvedResponsiveValue } from './base-menu.utils.js';
|
|
7
|
+
|
|
4
8
|
import type { Responsive } from '../../props/prop-def.js';
|
|
5
9
|
|
|
6
10
|
/**
|
|
@@ -16,8 +20,10 @@ export type MenuSize = '1' | '2';
|
|
|
16
20
|
interface MenuContextValue {
|
|
17
21
|
/** Whether we're inside a menu that owns the menu role */
|
|
18
22
|
isInsideMenu: boolean;
|
|
19
|
-
/** Menu size for
|
|
23
|
+
/** Menu size for the current breakpoint */
|
|
20
24
|
size?: MenuSize;
|
|
25
|
+
/** Item height in px for the current size and theme scaling */
|
|
26
|
+
itemHeight?: number;
|
|
21
27
|
}
|
|
22
28
|
|
|
23
29
|
const MenuContext = React.createContext<MenuContextValue>({ isInsideMenu: false });
|
|
@@ -28,26 +34,29 @@ interface MenuProviderProps {
|
|
|
28
34
|
size?: Responsive<MenuSize>;
|
|
29
35
|
}
|
|
30
36
|
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
/** Map menu size to item height in pixels at 100% scaling */
|
|
38
|
+
export const menuSizeToItemHeight: Record<MenuSize, number> = {
|
|
39
|
+
'1': 24, // --space-5
|
|
40
|
+
'2': 32, // --space-6
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/** Item height in px for a size at the given theme scaling ("100%", "110%"…). */
|
|
44
|
+
export function getMenuItemHeight(size: MenuSize, scaling: string | undefined): number {
|
|
45
|
+
const scale = scaling ? parseFloat(scaling) / 100 : 1;
|
|
46
|
+
return menuSizeToItemHeight[size] * (Number.isFinite(scale) ? scale : 1);
|
|
37
47
|
}
|
|
38
48
|
|
|
39
49
|
export function MenuProvider({ children, size }: MenuProviderProps) {
|
|
40
|
-
const resolvedSize =
|
|
41
|
-
const
|
|
50
|
+
const resolvedSize = useResolvedResponsiveValue<MenuSize | undefined>(size, undefined);
|
|
51
|
+
const { scaling } = useThemeContext();
|
|
52
|
+
const itemHeight = resolvedSize ? getMenuItemHeight(resolvedSize, scaling) : undefined;
|
|
53
|
+
const value = React.useMemo(
|
|
54
|
+
() => ({ isInsideMenu: true, size: resolvedSize, itemHeight }),
|
|
55
|
+
[resolvedSize, itemHeight],
|
|
56
|
+
);
|
|
42
57
|
return <MenuContext.Provider value={value}>{children}</MenuContext.Provider>;
|
|
43
58
|
}
|
|
44
59
|
|
|
45
60
|
export function useMenuContext() {
|
|
46
61
|
return React.useContext(MenuContext);
|
|
47
62
|
}
|
|
48
|
-
|
|
49
|
-
/** Map menu size to item height in pixels */
|
|
50
|
-
export const menuSizeToItemHeight: Record<MenuSize, number> = {
|
|
51
|
-
'1': 24, // --space-5
|
|
52
|
-
'2': 32, // --space-6
|
|
53
|
-
};
|
|
@@ -25,20 +25,20 @@
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
/* Size-specific border radius
|
|
28
|
+
/* Size-specific border radius — surface channel */
|
|
29
29
|
@breakpoints {
|
|
30
30
|
.rt-AccordionRoot {
|
|
31
31
|
&:where(.rt-r-size-1) {
|
|
32
|
-
border-radius: var(--radius-1);
|
|
32
|
+
border-radius: var(--radius-surface-1);
|
|
33
33
|
}
|
|
34
34
|
&:where(.rt-r-size-2) {
|
|
35
|
-
border-radius: var(--radius-2);
|
|
35
|
+
border-radius: var(--radius-surface-2);
|
|
36
36
|
}
|
|
37
37
|
&:where(.rt-r-size-3) {
|
|
38
|
-
border-radius: var(--radius-3);
|
|
38
|
+
border-radius: var(--radius-surface-3);
|
|
39
39
|
}
|
|
40
40
|
&:where(.rt-r-size-4) {
|
|
41
|
-
border-radius: var(--radius-4);
|
|
41
|
+
border-radius: var(--radius-surface-4);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
row-gap: var(--space-2);
|
|
91
91
|
column-gap: var(--space-2);
|
|
92
92
|
padding: var(--space-3);
|
|
93
|
-
--callout-border-radius:
|
|
93
|
+
--callout-border-radius: var(--radius-surface-1);
|
|
94
94
|
--callout-icon-height: var(--line-height-1);
|
|
95
95
|
--callout-icon-size: var(--content-icon-size-1);
|
|
96
96
|
}
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
row-gap: var(--space-2);
|
|
99
99
|
column-gap: var(--space-3);
|
|
100
100
|
padding: var(--space-4);
|
|
101
|
-
--callout-border-radius:
|
|
101
|
+
--callout-border-radius: var(--radius-surface-2);
|
|
102
102
|
--callout-icon-height: var(--line-height-2);
|
|
103
103
|
--callout-icon-size: var(--content-icon-size-2);
|
|
104
104
|
}
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
row-gap: var(--space-3);
|
|
107
107
|
column-gap: var(--space-4);
|
|
108
108
|
padding: var(--space-5);
|
|
109
|
-
--callout-border-radius:
|
|
109
|
+
--callout-border-radius: var(--radius-surface-3);
|
|
110
110
|
--callout-icon-height: var(--line-height-3);
|
|
111
111
|
--callout-icon-size: var(--content-icon-size-3);
|
|
112
112
|
}
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
row-gap: var(--space-3);
|
|
115
115
|
column-gap: var(--space-5);
|
|
116
116
|
padding: var(--space-6);
|
|
117
|
-
--callout-border-radius:
|
|
117
|
+
--callout-border-radius: var(--radius-surface-4);
|
|
118
118
|
--callout-icon-height: var(--line-height-4);
|
|
119
119
|
--callout-icon-size: var(--content-icon-size-4);
|
|
120
120
|
}
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
row-gap: var(--space-4);
|
|
123
123
|
column-gap: var(--space-6);
|
|
124
124
|
padding: var(--space-7);
|
|
125
|
-
--callout-border-radius:
|
|
125
|
+
--callout-border-radius: var(--radius-surface-5);
|
|
126
126
|
--callout-icon-height: var(--line-height-5);
|
|
127
127
|
--callout-icon-size: var(--content-icon-size-5);
|
|
128
128
|
}
|