@womp/kookie-ui 0.25.0 → 0.25.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 +19 -3
- package/dist/cjs/components/_internal/base-button.d.ts.map +1 -1
- package/dist/cjs/components/_internal/base-button.js +1 -1
- package/dist/cjs/components/_internal/base-button.js.map +4 -4
- 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-inspector.d.ts.map +1 -1
- 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 +6 -0
- 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-sidebar.d.ts.map +1 -1
- 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/accordion.js +1 -1
- package/dist/cjs/components/accordion.js.map +4 -4
- package/dist/cjs/components/alert-dialog.js +1 -1
- package/dist/cjs/components/alert-dialog.js.map +4 -4
- package/dist/cjs/components/avatar.js +1 -1
- package/dist/cjs/components/avatar.js.map +4 -4
- package/dist/cjs/components/button.js +1 -1
- package/dist/cjs/components/button.js.map +4 -4
- package/dist/cjs/components/card.js +1 -1
- package/dist/cjs/components/card.js.map +4 -4
- package/dist/cjs/components/chatbar.js +1 -1
- package/dist/cjs/components/chatbar.js.map +4 -4
- package/dist/cjs/components/checkbox-group.js +1 -1
- package/dist/cjs/components/checkbox-group.js.map +4 -4
- package/dist/cjs/components/checkbox.js +1 -1
- package/dist/cjs/components/checkbox.js.map +4 -4
- package/dist/cjs/components/chip.js +1 -1
- package/dist/cjs/components/chip.js.map +4 -4
- package/dist/cjs/components/combobox.js +1 -1
- package/dist/cjs/components/combobox.js.map +4 -4
- package/dist/cjs/components/context-menu.js +1 -1
- package/dist/cjs/components/context-menu.js.map +4 -4
- package/dist/cjs/components/dialog.js +1 -1
- package/dist/cjs/components/dialog.js.map +4 -4
- package/dist/cjs/components/dropdown-menu.js +1 -1
- package/dist/cjs/components/dropdown-menu.js.map +4 -4
- package/dist/cjs/components/index.js +2 -2
- package/dist/cjs/components/index.js.map +4 -4
- package/dist/cjs/components/message-scroller.js +1 -1
- package/dist/cjs/components/message-scroller.js.map +4 -4
- package/dist/cjs/components/navbar.js +1 -1
- package/dist/cjs/components/navbar.js.map +4 -4
- package/dist/cjs/components/notice.js +1 -1
- package/dist/cjs/components/notice.js.map +4 -4
- package/dist/cjs/components/popover.js +1 -1
- package/dist/cjs/components/popover.js.map +4 -4
- package/dist/cjs/components/radio-group.js +1 -1
- package/dist/cjs/components/radio-group.js.map +4 -4
- package/dist/cjs/components/radio.js +1 -1
- package/dist/cjs/components/radio.js.map +4 -4
- package/dist/cjs/components/segmented-control.js +1 -1
- package/dist/cjs/components/segmented-control.js.map +4 -4
- package/dist/cjs/components/select.js +1 -1
- package/dist/cjs/components/select.js.map +4 -4
- package/dist/cjs/components/sheet.js +1 -1
- package/dist/cjs/components/sheet.js.map +4 -4
- package/dist/cjs/components/shell.js +1 -1
- package/dist/cjs/components/shell.js.map +4 -4
- 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 +4 -4
- package/dist/cjs/components/slider.js +1 -1
- package/dist/cjs/components/slider.js.map +4 -4
- package/dist/cjs/components/switch.js +1 -1
- package/dist/cjs/components/switch.js.map +4 -4
- package/dist/cjs/components/table.js +1 -1
- package/dist/cjs/components/table.js.map +4 -4
- package/dist/cjs/components/tabs.js +1 -1
- package/dist/cjs/components/tabs.js.map +4 -4
- package/dist/cjs/components/text-area.js +1 -1
- package/dist/cjs/components/text-area.js.map +4 -4
- package/dist/cjs/components/text-field.js +2 -2
- package/dist/cjs/components/text-field.js.map +4 -4
- package/dist/cjs/components/theme.js +1 -1
- package/dist/cjs/components/theme.js.map +4 -4
- package/dist/cjs/components/toggle.js +1 -1
- package/dist/cjs/components/toggle.js.map +4 -4
- package/dist/cjs/components/toolbar.d.ts.map +1 -1
- package/dist/cjs/components/toolbar.js +1 -1
- package/dist/cjs/components/toolbar.js.map +4 -4
- package/dist/cjs/components/tooltip.js +1 -1
- package/dist/cjs/components/tooltip.js.map +4 -4
- package/dist/cjs/helpers/index.d.ts +1 -0
- package/dist/cjs/helpers/index.d.ts.map +1 -1
- package/dist/cjs/helpers/index.js +4 -4
- package/dist/cjs/helpers/index.js.map +3 -3
- package/dist/cjs/helpers/theme-size.d.ts +8 -30
- package/dist/cjs/helpers/theme-size.d.ts.map +1 -1
- package/dist/cjs/helpers/theme-size.js +1 -1
- package/dist/cjs/helpers/theme-size.js.map +3 -3
- package/dist/cjs/hooks/theme-size.d.ts +32 -0
- package/dist/cjs/hooks/theme-size.d.ts.map +1 -0
- package/dist/cjs/hooks/theme-size.js +3 -0
- package/dist/cjs/hooks/theme-size.js.map +7 -0
- package/dist/cjs/index.js +4 -4
- package/dist/cjs/index.js.map +4 -4
- package/dist/cjs/props/index.js +1 -1
- package/dist/cjs/props/index.js.map +4 -4
- package/dist/esm/chunk-3B25RLWX.js +3 -0
- package/dist/esm/chunk-3B25RLWX.js.map +7 -0
- package/dist/esm/{chunk-PF67GJ5D.js → chunk-3CY6H4TE.js} +2 -2
- package/dist/esm/chunk-3CY6H4TE.js.map +7 -0
- package/dist/esm/{chunk-2EXOL2BR.js → chunk-3L2MDOYC.js} +2 -2
- package/dist/esm/chunk-3L2MDOYC.js.map +7 -0
- package/dist/esm/{chunk-KNBSG2WA.js → chunk-5CFSNNYS.js} +2 -2
- package/dist/esm/chunk-5CFSNNYS.js.map +7 -0
- package/dist/esm/{chunk-4ABQ6CDI.js → chunk-5EBJOOXE.js} +2 -2
- package/dist/esm/chunk-5EBJOOXE.js.map +7 -0
- package/dist/esm/{chunk-E4EMG3RC.js → chunk-5L4DZ2D3.js} +2 -2
- package/dist/esm/chunk-5L4DZ2D3.js.map +7 -0
- package/dist/esm/chunk-5ON3XLRD.js +3 -0
- package/dist/esm/chunk-5ON3XLRD.js.map +7 -0
- package/dist/esm/{chunk-UZAS4PYM.js → chunk-5TJH35TF.js} +2 -2
- package/dist/esm/{chunk-GPQSC6GL.js → chunk-5XR5PTDR.js} +2 -2
- package/dist/esm/chunk-5XR5PTDR.js.map +7 -0
- package/dist/esm/{chunk-AOBY2OUZ.js → chunk-63MUJFVF.js} +2 -2
- package/dist/esm/chunk-63MUJFVF.js.map +7 -0
- package/dist/esm/chunk-6AUIIXXE.js +2 -0
- package/dist/esm/chunk-6AUIIXXE.js.map +7 -0
- package/dist/esm/{chunk-4Q5PUIDJ.js → chunk-6RJQ5LLP.js} +2 -2
- package/dist/esm/{chunk-YVZTQA2L.js → chunk-7B3XDZXZ.js} +2 -2
- package/dist/esm/chunk-7B3XDZXZ.js.map +7 -0
- package/dist/esm/{chunk-7IHBNDCE.js → chunk-7X7VWR3F.js} +2 -2
- package/dist/esm/chunk-7X7VWR3F.js.map +7 -0
- package/dist/esm/{chunk-45O3JZWQ.js → chunk-7XHE6TOA.js} +2 -2
- package/dist/esm/chunk-7XHE6TOA.js.map +7 -0
- package/dist/esm/chunk-AQ7VUGQQ.js +3 -0
- package/dist/esm/chunk-AQ7VUGQQ.js.map +7 -0
- package/dist/esm/{chunk-54HUG34P.js → chunk-BVFHJP5E.js} +2 -2
- package/dist/esm/chunk-BVFHJP5E.js.map +7 -0
- package/dist/esm/{chunk-CRCYUJMK.js → chunk-BXZSJKWA.js} +2 -2
- package/dist/esm/chunk-BXZSJKWA.js.map +7 -0
- package/dist/esm/{chunk-IQ2RMFOM.js → chunk-CQG4U5BR.js} +2 -2
- package/dist/esm/{chunk-YNCI5PY6.js → chunk-FPGBCCML.js} +2 -2
- package/dist/esm/chunk-FPGBCCML.js.map +7 -0
- package/dist/esm/{chunk-A7QRPXXB.js → chunk-HHSFAOIO.js} +2 -2
- package/dist/esm/chunk-HHSFAOIO.js.map +7 -0
- package/dist/esm/{chunk-NMQGDBLD.js → chunk-MQEWEAH5.js} +2 -2
- package/dist/esm/chunk-MQEWEAH5.js.map +7 -0
- package/dist/esm/{chunk-YIKLO2XL.js → chunk-N3QLHFHB.js} +2 -2
- package/dist/esm/chunk-N3QLHFHB.js.map +7 -0
- package/dist/esm/{chunk-LCG3JZ3C.js → chunk-N5H7C3PZ.js} +2 -2
- package/dist/esm/chunk-N5H7C3PZ.js.map +7 -0
- package/dist/esm/{chunk-N53NJCEM.js → chunk-OQWD63AI.js} +2 -2
- package/dist/esm/chunk-OQWD63AI.js.map +7 -0
- package/dist/esm/chunk-PCLO3ZZY.js +3 -0
- package/dist/esm/chunk-PCLO3ZZY.js.map +7 -0
- package/dist/esm/{chunk-2XZ7477Y.js → chunk-PZZJH2LR.js} +2 -2
- package/dist/esm/chunk-PZZJH2LR.js.map +7 -0
- package/dist/esm/chunk-QKCNGEX4.js +3 -0
- package/dist/esm/chunk-QKCNGEX4.js.map +7 -0
- package/dist/esm/{chunk-PPQ7URZL.js → chunk-R4PGFURL.js} +2 -2
- package/dist/esm/{chunk-UUQGOQ5H.js → chunk-RB5VHWAW.js} +2 -2
- package/dist/esm/chunk-RB5VHWAW.js.map +7 -0
- package/dist/esm/{chunk-AG2YETE6.js → chunk-VPRAXHLL.js} +2 -2
- package/dist/esm/chunk-VPRAXHLL.js.map +7 -0
- package/dist/esm/{chunk-7J7RPEPB.js → chunk-VRQEWMC6.js} +2 -2
- package/dist/esm/chunk-VRQEWMC6.js.map +7 -0
- package/dist/esm/{chunk-UFJGZUKK.js → chunk-W4MQ6TEK.js} +2 -2
- package/dist/esm/chunk-W4MQ6TEK.js.map +7 -0
- package/dist/esm/{chunk-3223MHQK.js → chunk-WJ4H2O2G.js} +2 -2
- package/dist/esm/chunk-WMODMXEU.js +3 -0
- package/dist/esm/chunk-WMODMXEU.js.map +7 -0
- package/dist/esm/{chunk-JZVLP2VF.js → chunk-XPVRXQSW.js} +2 -2
- package/dist/esm/chunk-XPVRXQSW.js.map +7 -0
- package/dist/esm/{chunk-BUZGRMDD.js → chunk-Y2BTPKK6.js} +2 -2
- package/dist/esm/chunk-YOSCUA6Z.js +3 -0
- package/dist/esm/chunk-YOSCUA6Z.js.map +7 -0
- package/dist/esm/{chunk-X272YV2E.js → chunk-Z563IAE3.js} +2 -2
- package/dist/esm/chunk-Z563IAE3.js.map +7 -0
- package/dist/esm/{chunk-GZ333J7L.js → chunk-ZDSY6CJL.js} +2 -2
- package/dist/esm/chunk-ZDSY6CJL.js.map +7 -0
- package/dist/esm/{chunk-ENAW44VE.js → chunk-ZYKJTNAT.js} +2 -2
- package/dist/esm/chunk-ZYKJTNAT.js.map +7 -0
- package/dist/esm/components/_internal/base-button.d.ts.map +1 -1
- package/dist/esm/components/_internal/base-button.js +1 -1
- package/dist/esm/components/_internal/shell-bottom.js +1 -1
- package/dist/esm/components/_internal/shell-inspector.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-inspector.js +1 -1
- package/dist/esm/components/_internal/shell-resizable.d.ts +6 -0
- 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-sidebar.d.ts.map +1 -1
- package/dist/esm/components/_internal/shell-sidebar.js +1 -1
- package/dist/esm/components/accordion.js +1 -1
- package/dist/esm/components/alert-dialog.js +1 -1
- package/dist/esm/components/avatar.js +1 -1
- package/dist/esm/components/button.js +1 -1
- package/dist/esm/components/card.js +1 -1
- package/dist/esm/components/chatbar.js +1 -1
- package/dist/esm/components/checkbox-group.js +1 -1
- package/dist/esm/components/checkbox.js +1 -1
- package/dist/esm/components/chip.js +1 -1
- package/dist/esm/components/combobox.js +1 -1
- package/dist/esm/components/context-menu.js +1 -1
- package/dist/esm/components/dialog.js +1 -1
- package/dist/esm/components/dropdown-menu.js +1 -1
- package/dist/esm/components/index.js +1 -1
- package/dist/esm/components/message-scroller.js +1 -1
- package/dist/esm/components/navbar.js +1 -1
- package/dist/esm/components/notice.js +1 -1
- package/dist/esm/components/popover.js +1 -1
- package/dist/esm/components/radio-group.js +1 -1
- package/dist/esm/components/radio.js +1 -1
- package/dist/esm/components/segmented-control.js +1 -1
- package/dist/esm/components/select.js +1 -1
- package/dist/esm/components/sheet.js +1 -1
- package/dist/esm/components/shell.js +1 -1
- package/dist/esm/components/sidebar.d.ts.map +1 -1
- package/dist/esm/components/sidebar.js +1 -1
- package/dist/esm/components/slider.js +1 -1
- package/dist/esm/components/switch.js +1 -1
- package/dist/esm/components/table.js +1 -1
- package/dist/esm/components/tabs.js +1 -1
- package/dist/esm/components/text-area.js +1 -1
- package/dist/esm/components/text-field.js +1 -1
- package/dist/esm/components/theme.js +1 -1
- package/dist/esm/components/toggle.js +1 -1
- package/dist/esm/components/toolbar.d.ts.map +1 -1
- package/dist/esm/components/toolbar.js +1 -1
- package/dist/esm/components/tooltip.js +1 -1
- package/dist/esm/helpers/index.d.ts +1 -0
- package/dist/esm/helpers/index.d.ts.map +1 -1
- package/dist/esm/helpers/index.js +1 -1
- package/dist/esm/helpers/index.js.map +4 -4
- package/dist/esm/helpers/theme-size.d.ts +8 -30
- package/dist/esm/helpers/theme-size.d.ts.map +1 -1
- package/dist/esm/helpers/theme-size.js +1 -1
- package/dist/esm/hooks/theme-size.d.ts +32 -0
- package/dist/esm/hooks/theme-size.d.ts.map +1 -0
- package/dist/esm/hooks/theme-size.js +3 -0
- package/dist/esm/hooks/theme-size.js.map +7 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/props/font-family.prop.js +1 -1
- package/dist/esm/props/font-family.prop.js.map +4 -4
- package/dist/esm/props/index.js +1 -1
- package/dist/esm/props/index.js.map +4 -4
- package/package.json +1 -1
- package/src/components/_internal/base-button.tsx +56 -42
- package/src/components/_internal/shell-inspector.tsx +3 -1
- package/src/components/_internal/shell-resizable.tsx +13 -0
- package/src/components/_internal/shell-sidebar.tsx +3 -1
- package/src/components/accordion.tsx +1 -1
- package/src/components/alert-dialog.tsx +1 -1
- package/src/components/avatar.tsx +1 -1
- package/src/components/card.tsx +1 -1
- package/src/components/chatbar.tsx +1 -1
- package/src/components/checkbox-group.tsx +1 -1
- package/src/components/checkbox.tsx +1 -1
- package/src/components/combobox.tsx +1 -1
- package/src/components/context-menu.tsx +1 -1
- package/src/components/dialog.tsx +1 -1
- package/src/components/dropdown-menu.tsx +1 -1
- package/src/components/navbar.tsx +1 -1
- package/src/components/notice.tsx +1 -1
- package/src/components/popover.css +4 -2
- package/src/components/popover.tsx +1 -1
- package/src/components/radio-group.tsx +1 -1
- package/src/components/radio.tsx +1 -1
- package/src/components/segmented-control.tsx +1 -1
- package/src/components/select.tsx +1 -1
- package/src/components/sheet.css +4 -2
- package/src/components/sheet.tsx +1 -1
- package/src/components/shell.css +7 -2
- package/src/components/shell.tsx +1 -1
- package/src/components/sidebar.css +10 -0
- package/src/components/sidebar.tsx +16 -1
- package/src/components/slider.tsx +1 -1
- package/src/components/switch.tsx +1 -1
- package/src/components/table.tsx +1 -1
- package/src/components/tabs.tsx +1 -1
- package/src/components/text-area.tsx +1 -1
- package/src/components/text-field.tsx +1 -1
- package/src/components/theme.tsx +1 -1
- package/src/components/toolbar.tsx +17 -8
- package/src/helpers/index.ts +3 -0
- package/src/helpers/theme-size.ts +8 -46
- package/src/hooks/theme-size.ts +50 -0
- package/src/styles/tokens/color.css +3 -0
- package/styles.css +21 -3
- package/tokens/base.css +2 -0
- package/tokens.css +2 -0
- package/dist/esm/chunk-2EXOL2BR.js.map +0 -7
- package/dist/esm/chunk-2IUGM657.js +0 -3
- package/dist/esm/chunk-2IUGM657.js.map +0 -7
- package/dist/esm/chunk-2XZ7477Y.js.map +0 -7
- package/dist/esm/chunk-3WZLXGUE.js +0 -3
- package/dist/esm/chunk-3WZLXGUE.js.map +0 -7
- package/dist/esm/chunk-3YLYGKFB.js +0 -2
- package/dist/esm/chunk-3YLYGKFB.js.map +0 -7
- package/dist/esm/chunk-45O3JZWQ.js.map +0 -7
- package/dist/esm/chunk-4ABQ6CDI.js.map +0 -7
- package/dist/esm/chunk-54HUG34P.js.map +0 -7
- package/dist/esm/chunk-7IHBNDCE.js.map +0 -7
- package/dist/esm/chunk-7J7RPEPB.js.map +0 -7
- package/dist/esm/chunk-A7QRPXXB.js.map +0 -7
- package/dist/esm/chunk-AG2YETE6.js.map +0 -7
- package/dist/esm/chunk-AOBY2OUZ.js.map +0 -7
- package/dist/esm/chunk-CRCYUJMK.js.map +0 -7
- package/dist/esm/chunk-DI7RUMLO.js +0 -3
- package/dist/esm/chunk-DI7RUMLO.js.map +0 -7
- package/dist/esm/chunk-E4EMG3RC.js.map +0 -7
- package/dist/esm/chunk-ENAW44VE.js.map +0 -7
- package/dist/esm/chunk-EVCQ6TG5.js +0 -3
- package/dist/esm/chunk-EVCQ6TG5.js.map +0 -7
- package/dist/esm/chunk-G32GSPNO.js +0 -3
- package/dist/esm/chunk-G32GSPNO.js.map +0 -7
- package/dist/esm/chunk-GPQSC6GL.js.map +0 -7
- package/dist/esm/chunk-GZ333J7L.js.map +0 -7
- package/dist/esm/chunk-JIF77MRB.js +0 -3
- package/dist/esm/chunk-JIF77MRB.js.map +0 -7
- package/dist/esm/chunk-JZVLP2VF.js.map +0 -7
- package/dist/esm/chunk-KNBSG2WA.js.map +0 -7
- package/dist/esm/chunk-LB2HB4NG.js +0 -3
- package/dist/esm/chunk-LB2HB4NG.js.map +0 -7
- package/dist/esm/chunk-LCG3JZ3C.js.map +0 -7
- package/dist/esm/chunk-N53NJCEM.js.map +0 -7
- package/dist/esm/chunk-NMQGDBLD.js.map +0 -7
- package/dist/esm/chunk-PF67GJ5D.js.map +0 -7
- package/dist/esm/chunk-UFJGZUKK.js.map +0 -7
- package/dist/esm/chunk-UUQGOQ5H.js.map +0 -7
- package/dist/esm/chunk-VCV7RACK.js +0 -2
- package/dist/esm/chunk-VCV7RACK.js.map +0 -7
- package/dist/esm/chunk-X272YV2E.js.map +0 -7
- package/dist/esm/chunk-YIKLO2XL.js.map +0 -7
- package/dist/esm/chunk-YNCI5PY6.js.map +0 -7
- package/dist/esm/chunk-YVZTQA2L.js.map +0 -7
- /package/dist/esm/{chunk-UZAS4PYM.js.map → chunk-5TJH35TF.js.map} +0 -0
- /package/dist/esm/{chunk-4Q5PUIDJ.js.map → chunk-6RJQ5LLP.js.map} +0 -0
- /package/dist/esm/{chunk-IQ2RMFOM.js.map → chunk-CQG4U5BR.js.map} +0 -0
- /package/dist/esm/{chunk-PPQ7URZL.js.map → chunk-R4PGFURL.js.map} +0 -0
- /package/dist/esm/{chunk-3223MHQK.js.map → chunk-WJ4H2O2G.js.map} +0 -0
- /package/dist/esm/{chunk-BUZGRMDD.js.map → chunk-Y2BTPKK6.js.map} +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/components/dropdown-menu.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { DropdownMenu as DropdownMenuPrimitive, Slot } from 'radix-ui';\nimport { useCallbackRef } from 'radix-ui/internal';\n\nimport { ScrollArea } from './scroll-area.js';\nimport {\n dropdownMenuContentPropDefs,\n dropdownMenuSubContentPropDefs,\n dropdownMenuItemPropDefs,\n dropdownMenuCheckboxItemPropDefs,\n dropdownMenuRadioItemPropDefs,\n} from './dropdown-menu.props.js';\nimport { Theme, useThemeContext } from './theme.js';\nimport { ChevronDownIcon, ThickCheckIcon, ThickChevronLeftIcon, ThickChevronRightIcon, ThickDotIcon } from './icons.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { useThemeSizeProps } from '../hooks/theme-size.js';\nimport {\n DrillDownLevelContext,\n DrillDownRoot,\n SubContext,\n useCreateDrillDownStore,\n useDrillDownStore,\n usePanelPosition,\n useStackEntry,\n useSubContext,\n} from './_internal/dropdown-menu-drill-down.js';\nimport {\n MenuCloseProvider,\n MenuGroupLabelProvider,\n MenuProvider,\n useMenuGroupLabelId,\n useMenuGroupLabelledBy,\n} from './_internal/menu-context.js';\nimport {\n MenuShortcut,\n getMenuAlignOffset,\n toAriaKeyShortcuts,\n useResolvedResponsiveValue,\n} from './_internal/base-menu.utils.js';\nimport { requireReactElement } from '../helpers/require-react-element.js';\n\nimport type { SubmenuBehavior } from './_internal/dropdown-menu-drill-down.js';\nimport type { IconProps } from './icons.js';\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { GetPropDefTypes, Responsive } from '../props/prop-def.js';\n\n/**\n * Open state of the menu, mirrored from Root so Content can reset drill-down\n * navigation when a force-mounted menu opens again.\n */\nconst DropdownMenuOpenContext = React.createContext(false);\n\ninterface DropdownMenuRootProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Root> {}\nconst DropdownMenuRoot: React.FC<DropdownMenuRootProps> = (props) => {\n const { open: openProp, defaultOpen = false, onOpenChange } = props;\n const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen);\n const open = openProp ?? uncontrolledOpen;\n\n const handleOpenChangeProp = useCallbackRef(onOpenChange);\n const handleOpenChange = React.useCallback(\n (next: boolean) => {\n setUncontrolledOpen(next);\n handleOpenChangeProp(next);\n },\n [handleOpenChangeProp],\n );\n\n const close = React.useCallback(() => handleOpenChange(false), [handleOpenChange]);\n\n return (\n <DropdownMenuOpenContext.Provider value={open}>\n <MenuCloseProvider value={close}>\n <DropdownMenuPrimitive.Root {...props} open={open} onOpenChange={handleOpenChange} />\n </MenuCloseProvider>\n </DropdownMenuOpenContext.Provider>\n );\n};\nDropdownMenuRoot.displayName = 'DropdownMenu.Root';\n\ntype DropdownMenuTriggerElement = React.ElementRef<typeof DropdownMenuPrimitive.Trigger>;\ninterface DropdownMenuTriggerProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Trigger, RemovedProps> {}\nconst DropdownMenuTrigger = React.forwardRef<DropdownMenuTriggerElement, DropdownMenuTriggerProps>(\n ({ children, ...props }, forwardedRef) => (\n <DropdownMenuPrimitive.Trigger {...props} ref={forwardedRef} asChild>\n {requireReactElement(children)}\n </DropdownMenuPrimitive.Trigger>\n ),\n);\nDropdownMenuTrigger.displayName = 'DropdownMenu.Trigger';\n\n/** Visual props shared by Content and SubContent. */\ntype DropdownMenuSurfaceProps = GetPropDefTypes<typeof dropdownMenuSubContentPropDefs>;\n\ntype DropdownMenuContentContextValue = {\n size?: DropdownMenuSurfaceProps['size'];\n color?: DropdownMenuSurfaceProps['color'];\n};\nconst DropdownMenuContentContext = React.createContext<DropdownMenuContentContextValue>({});\n\n/** Keys that navigate back one drill-down level, by writing direction. */\nconst BACK_KEYS = { ltr: 'ArrowLeft', rtl: 'ArrowRight' } as const;\nconst FORWARD_KEYS = { ltr: 'ArrowRight', rtl: 'ArrowLeft' } as const;\n\nfunction isTextEntryTarget(target: EventTarget | null) {\n return (\n target instanceof HTMLElement &&\n (target.isContentEditable || target.tagName === 'INPUT' || target.tagName === 'TEXTAREA')\n );\n}\n\nfunction getDirection(element: HTMLElement | null): 'ltr' | 'rtl' {\n return element?.closest('[dir]')?.getAttribute('dir') === 'rtl' ? 'rtl' : 'ltr';\n}\n\ntype DropdownMenuContentElement = React.ElementRef<typeof DropdownMenuPrimitive.Content>;\ninterface DropdownMenuContentProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Content, RemovedProps>,\n DropdownMenuSurfaceProps {\n container?: React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Portal>['container'];\n /**\n * Controls how submenus behave.\n * - `cascade`: Default cascading behavior where submenus open to the side (portal-based)\n * - `drill-down`: Mobile-friendly behavior where submenus replace the content inline\n * Supports responsive values: `{ initial: 'drill-down', md: 'cascade' }`\n */\n submenuBehavior?: Responsive<SubmenuBehavior>;\n /**\n * When true, skips the ScrollArea wrapper to allow VirtualMenu to handle its own scrolling.\n * Use this when rendering virtualized lists inside the dropdown.\n */\n virtualized?: boolean;\n}\nconst DropdownMenuContent = React.forwardRef<DropdownMenuContentElement, DropdownMenuContentProps>(\n (ownProps, forwardedRef) => {\n const props = useThemeSizeProps(ownProps, dropdownMenuContentPropDefs.size);\n const themeContext = useThemeContext();\n const {\n size = dropdownMenuContentPropDefs.size.default,\n } = props;\n const {\n className,\n children,\n color,\n container,\n forceMount,\n submenuBehavior,\n virtualized = false,\n onEscapeKeyDown,\n onKeyDown,\n ...contentProps\n } = extractProps(props, dropdownMenuContentPropDefs);\n\n const resolvedColor = color || themeContext.accentColor;\n const behavior = useResolvedResponsiveValue<SubmenuBehavior>(submenuBehavior, 'cascade');\n const isDrillDown = behavior === 'drill-down';\n const open = React.useContext(DropdownMenuOpenContext);\n const drillDownStore = useCreateDrillDownStore();\n\n // Escape goes back one drill-down level before it closes the menu.\n const handleEscapeKeyDown = (event: KeyboardEvent) => {\n onEscapeKeyDown?.(event);\n if (event.defaultPrevented || !isDrillDown || drillDownStore.getDepth() === 0) return;\n event.preventDefault();\n drillDownStore.pop('keyboard');\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event);\n if (event.defaultPrevented || !isDrillDown || drillDownStore.getDepth() === 0) return;\n if (isTextEntryTarget(event.target)) return;\n if (event.key === BACK_KEYS[getDirection(event.currentTarget)]) {\n event.preventDefault();\n drillDownStore.pop('keyboard');\n }\n };\n\n const contextValue = React.useMemo(\n () => ({ size, color: resolvedColor }),\n [size, resolvedColor],\n );\n\n const contentBody = (\n <MenuProvider size={size}>\n <DropdownMenuContentContext.Provider value={contextValue}>\n <DrillDownRoot store={drillDownStore} behavior={behavior} open={open}>\n {children}\n </DrillDownRoot>\n </DropdownMenuContentContext.Provider>\n </MenuProvider>\n );\n\n return (\n <DropdownMenuPrimitive.Portal container={container} forceMount={forceMount}>\n <Theme asChild>\n <DropdownMenuPrimitive.Content\n data-accent-color={resolvedColor}\n align=\"start\"\n sideOffset={4}\n collisionPadding={10}\n {...contentProps}\n onEscapeKeyDown={handleEscapeKeyDown}\n onKeyDown={handleKeyDown}\n asChild={false}\n ref={forwardedRef}\n className={classNames(\n 'kui-PopperContent',\n 'kui-BaseMenuContent',\n 'kui-variant-soft',\n 'kui-DropdownMenuContent',\n className,\n )}\n >\n {virtualized ? (\n <div className={classNames('kui-BaseMenuViewport', 'kui-DropdownMenuViewport', 'kui-virtualized')}>\n {contentBody}\n </div>\n ) : (\n <ScrollArea type=\"auto\" scrollbars=\"vertical\">\n <div className={classNames('kui-BaseMenuViewport', 'kui-DropdownMenuViewport')}>\n {contentBody}\n </div>\n </ScrollArea>\n )}\n </DropdownMenuPrimitive.Content>\n </Theme>\n </DropdownMenuPrimitive.Portal>\n );\n },\n);\nDropdownMenuContent.displayName = 'DropdownMenu.Content';\n\ntype DropdownMenuLabelElement = React.ElementRef<typeof DropdownMenuPrimitive.Label>;\ninterface DropdownMenuLabelProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Label, RemovedProps> {}\nconst DropdownMenuLabel = React.forwardRef<DropdownMenuLabelElement, DropdownMenuLabelProps>(\n ({ className, id: idProp, ...props }, forwardedRef) => {\n const isLevelVisible = React.useContext(DrillDownLevelContext);\n const id = useMenuGroupLabelId(idProp, isLevelVisible);\n if (!isLevelVisible) return null;\n return (\n <DropdownMenuPrimitive.Label\n {...props}\n id={id}\n asChild={false}\n ref={forwardedRef}\n className={classNames('kui-BaseMenuLabel', 'kui-DropdownMenuLabel', className)}\n />\n );\n },\n);\nDropdownMenuLabel.displayName = 'DropdownMenu.Label';\n\ntype DropdownMenuItemElement = React.ElementRef<typeof DropdownMenuPrimitive.Item>;\ntype DropdownMenuItemOwnProps = GetPropDefTypes<typeof dropdownMenuItemPropDefs>;\ninterface DropdownMenuItemProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Item, RemovedProps>,\n DropdownMenuItemOwnProps {}\nconst DropdownMenuItem = React.forwardRef<DropdownMenuItemElement, DropdownMenuItemProps>(\n (props, forwardedRef) => {\n const {\n className,\n children,\n color = dropdownMenuItemPropDefs.color.default,\n shortcut,\n ...itemProps\n } = props;\n // In drill-down mode, items of levels that are not on screen do not mount.\n if (!React.useContext(DrillDownLevelContext)) return null;\n return (\n <DropdownMenuPrimitive.Item\n data-accent-color={color}\n aria-keyshortcuts={shortcut ? toAriaKeyShortcuts(shortcut) : undefined}\n {...itemProps}\n ref={forwardedRef}\n className={classNames('kui-reset', 'kui-BaseMenuItem', 'kui-DropdownMenuItem', className)}\n >\n <Slot.Slottable>{children}</Slot.Slottable>\n {shortcut && <MenuShortcut shortcut={shortcut} className=\"kui-DropdownMenuShortcut\" />}\n </DropdownMenuPrimitive.Item>\n );\n },\n);\nDropdownMenuItem.displayName = 'DropdownMenu.Item';\n\ntype DropdownMenuGroupElement = React.ElementRef<typeof DropdownMenuPrimitive.Group>;\ninterface DropdownMenuGroupProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Group, RemovedProps> {}\nconst DropdownMenuGroup = React.forwardRef<DropdownMenuGroupElement, DropdownMenuGroupProps>(\n ({ className, 'aria-labelledby': ariaLabelledBy, ...props }, forwardedRef) => {\n const [labelledBy, setLabelId] = useMenuGroupLabelledBy(ariaLabelledBy);\n // A drill-down level that is not on screen keeps its groups only to hold the open path.\n const isLevelVisible = React.useContext(DrillDownLevelContext);\n return (\n <MenuGroupLabelProvider value={setLabelId}>\n <DropdownMenuPrimitive.Group\n {...(isLevelVisible ? { 'aria-labelledby': labelledBy } : { role: 'none' })}\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('kui-BaseMenuGroup', 'kui-DropdownMenuGroup', className)}\n />\n </MenuGroupLabelProvider>\n );\n },\n);\nDropdownMenuGroup.displayName = 'DropdownMenu.Group';\n\ntype DropdownMenuRadioGroupElement = React.ElementRef<typeof DropdownMenuPrimitive.RadioGroup>;\ninterface DropdownMenuRadioGroupProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.RadioGroup, RemovedProps> {}\nconst DropdownMenuRadioGroup = React.forwardRef<\n DropdownMenuRadioGroupElement,\n DropdownMenuRadioGroupProps\n>(({ className, 'aria-labelledby': ariaLabelledBy, ...props }, forwardedRef) => {\n const [labelledBy, setLabelId] = useMenuGroupLabelledBy(ariaLabelledBy);\n const isLevelVisible = React.useContext(DrillDownLevelContext);\n return (\n <MenuGroupLabelProvider value={setLabelId}>\n <DropdownMenuPrimitive.RadioGroup\n {...(isLevelVisible ? { 'aria-labelledby': labelledBy } : { role: 'none' })}\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('kui-BaseMenuRadioGroup', 'kui-DropdownMenuRadioGroup', className)}\n />\n </MenuGroupLabelProvider>\n );\n});\nDropdownMenuRadioGroup.displayName = 'DropdownMenu.RadioGroup';\n\ntype DropdownMenuRadioItemElement = React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>;\ntype DropdownMenuRadioItemOwnProps = GetPropDefTypes<typeof dropdownMenuRadioItemPropDefs>;\ninterface DropdownMenuRadioItemProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.RadioItem, RemovedProps>,\n DropdownMenuRadioItemOwnProps {}\nconst DropdownMenuRadioItem = React.forwardRef<\n DropdownMenuRadioItemElement,\n DropdownMenuRadioItemProps\n>((props, forwardedRef) => {\n const {\n children,\n className,\n color = dropdownMenuRadioItemPropDefs.color.default,\n ...itemProps\n } = props;\n if (!React.useContext(DrillDownLevelContext)) return null;\n return (\n <DropdownMenuPrimitive.RadioItem\n {...itemProps}\n asChild={false}\n ref={forwardedRef}\n data-accent-color={color}\n className={classNames(\n 'kui-BaseMenuItem',\n 'kui-BaseMenuRadioItem',\n 'kui-DropdownMenuItem',\n 'kui-DropdownMenuRadioItem',\n className,\n )}\n >\n <Slot.Slottable>{children}</Slot.Slottable>\n <DropdownMenuPrimitive.ItemIndicator className=\"kui-BaseMenuItemIndicator kui-DropdownMenuItemIndicator\">\n <ThickDotIcon className=\"kui-BaseMenuItemIndicatorIcon kui-DropdownMenuItemIndicatorIcon\" />\n </DropdownMenuPrimitive.ItemIndicator>\n </DropdownMenuPrimitive.RadioItem>\n );\n});\nDropdownMenuRadioItem.displayName = 'DropdownMenu.RadioItem';\n\ntype DropdownMenuCheckboxItemElement = React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>;\ntype DropdownMenuCheckboxItemOwnProps = GetPropDefTypes<typeof dropdownMenuCheckboxItemPropDefs>;\ninterface DropdownMenuCheckboxItemProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.CheckboxItem, RemovedProps>,\n DropdownMenuCheckboxItemOwnProps {}\nconst DropdownMenuCheckboxItem = React.forwardRef<\n DropdownMenuCheckboxItemElement,\n DropdownMenuCheckboxItemProps\n>((props, forwardedRef) => {\n const {\n children,\n className,\n shortcut,\n color = dropdownMenuCheckboxItemPropDefs.color.default,\n ...itemProps\n } = props;\n if (!React.useContext(DrillDownLevelContext)) return null;\n return (\n <DropdownMenuPrimitive.CheckboxItem\n aria-keyshortcuts={shortcut ? toAriaKeyShortcuts(shortcut) : undefined}\n {...itemProps}\n asChild={false}\n ref={forwardedRef}\n data-accent-color={color}\n className={classNames(\n 'kui-BaseMenuItem',\n 'kui-BaseMenuCheckboxItem',\n 'kui-DropdownMenuItem',\n 'kui-DropdownMenuCheckboxItem',\n className,\n )}\n >\n <Slot.Slottable>{children}</Slot.Slottable>\n <DropdownMenuPrimitive.ItemIndicator className=\"kui-BaseMenuItemIndicator kui-DropdownMenuItemIndicator\">\n <ThickCheckIcon className=\"kui-BaseMenuItemIndicatorIcon kui-DropdownMenuItemIndicatorIcon\" />\n </DropdownMenuPrimitive.ItemIndicator>\n {shortcut && <MenuShortcut shortcut={shortcut} className=\"kui-DropdownMenuShortcut\" />}\n </DropdownMenuPrimitive.CheckboxItem>\n );\n});\nDropdownMenuCheckboxItem.displayName = 'DropdownMenu.CheckboxItem';\n\ninterface DropdownMenuSubProps\n extends React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Sub> {\n /**\n * Label displayed in the back button when using drill-down mode.\n * If not provided, defaults to \"Back\".\n */\n label?: React.ReactNode;\n}\nconst DropdownMenuSub: React.FC<DropdownMenuSubProps> = ({\n label = 'Back',\n open,\n defaultOpen,\n onOpenChange,\n children,\n}) => {\n const drillDownStore = useDrillDownStore();\n const id = React.useId();\n const subContextValue = React.useMemo(() => ({ id, label }), [id, label]);\n const isOpenInDrillDown = usePanelPosition(drillDownStore, id) !== 'closed';\n\n const handleOpenChange = useCallbackRef(onOpenChange);\n const isControlled = open !== undefined;\n\n // Drill-down, controlled: navigating asks `onOpenChange` and leaves the stack to `open`.\n React.useLayoutEffect(() => {\n if (!drillDownStore || !isControlled) return;\n drillDownStore.setController(id, handleOpenChange);\n return () => drillDownStore.setController(id, null);\n }, [drillDownStore, isControlled, id, handleOpenChange]);\n\n React.useLayoutEffect(() => {\n if (!drillDownStore || open === undefined) return;\n if (open && !drillDownStore.isOpen(id)) drillDownStore.open(id, drillDownStore.takePendingModality(id));\n else if (!open && drillDownStore.isOpen(id)) drillDownStore.close(id, drillDownStore.takePendingModality(id));\n }, [drillDownStore, open, id]);\n\n // A `defaultOpen` push on mount is the starting state, not a change to report.\n const defaultOpenRef = React.useRef(open === undefined && Boolean(defaultOpen));\n React.useLayoutEffect(() => {\n if (drillDownStore && defaultOpenRef.current) drillDownStore.open(id);\n else defaultOpenRef.current = false;\n // Only on mount, like an uncontrolled default.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n // Uncontrolled, the stack drives `onOpenChange`. Controlled, it reports only a close\n // the `open` prop did not ask for, such as a parent level closing.\n const wasOpenRef = React.useRef(isOpenInDrillDown);\n React.useEffect(() => {\n if (!drillDownStore || wasOpenRef.current === isOpenInDrillDown) return;\n wasOpenRef.current = isOpenInDrillDown;\n if (isOpenInDrillDown && defaultOpenRef.current) {\n defaultOpenRef.current = false;\n return;\n }\n if (open !== undefined && open === isOpenInDrillDown) return;\n handleOpenChange(isOpenInDrillDown);\n }, [drillDownStore, isOpenInDrillDown, handleOpenChange, open]);\n\n // Radix Sub stays mounted in both behaviors so switching behavior does not\n // remount the subtree. It only renders context; in drill-down its trigger\n // and content are never rendered, so it reports no open changes of its own.\n return (\n <SubContext.Provider value={subContextValue}>\n <DropdownMenuPrimitive.Sub\n open={open}\n defaultOpen={defaultOpen}\n onOpenChange={drillDownStore ? undefined : onOpenChange}\n >\n {children}\n </DropdownMenuPrimitive.Sub>\n </SubContext.Provider>\n );\n};\nDropdownMenuSub.displayName = 'DropdownMenu.Sub';\n\ntype DropdownMenuSubTriggerElement = React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>;\ninterface DropdownMenuSubTriggerProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.SubTrigger, RemovedProps> {}\nconst DropdownMenuSubTrigger = React.forwardRef<\n DropdownMenuSubTriggerElement,\n DropdownMenuSubTriggerProps\n>((props, forwardedRef) => {\n const { className, children, onKeyDown, ...subTriggerProps } = props;\n const drillDownStore = useDrillDownStore();\n const subContext = useSubContext();\n const isLevelVisible = React.useContext(DrillDownLevelContext);\n\n if (drillDownStore && subContext) {\n if (!isLevelVisible) return null;\n\n const handleSelect = (event: Event) => {\n // Navigating does not close the menu.\n event.preventDefault();\n drillDownStore.push(subContext.id);\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event);\n if (event.defaultPrevented || subTriggerProps.disabled) return;\n if (event.key === FORWARD_KEYS[getDirection(event.currentTarget)]) {\n event.preventDefault();\n drillDownStore.push(subContext.id, 'keyboard');\n }\n };\n\n return (\n // The row navigates within the same menu, so it announces no popup.\n <DropdownMenuPrimitive.Item\n {...subTriggerProps}\n data-drill-down-trigger={subContext.id}\n data-drill-down-name={subTriggerProps.textValue}\n onSelect={handleSelect}\n onKeyDown={handleKeyDown}\n ref={forwardedRef}\n className={classNames(\n 'kui-reset',\n 'kui-BaseMenuItem',\n 'kui-BaseMenuSubTrigger',\n 'kui-DropdownMenuItem',\n 'kui-DropdownMenuSubTrigger',\n 'kui-DropdownMenuDrillDownSubTrigger',\n className,\n )}\n >\n {children}\n <div className=\"kui-BaseMenuShortcut kui-DropdownMenuShortcut\">\n <ThickChevronRightIcon className=\"kui-BaseMenuSubTriggerIcon kui-DropdownMenuSubTriggerIcon\" />\n </div>\n </DropdownMenuPrimitive.Item>\n );\n }\n\n return (\n <DropdownMenuPrimitive.SubTrigger\n {...subTriggerProps}\n onKeyDown={onKeyDown}\n asChild={false}\n ref={forwardedRef}\n className={classNames(\n 'kui-BaseMenuItem',\n 'kui-BaseMenuSubTrigger',\n 'kui-DropdownMenuItem',\n 'kui-DropdownMenuSubTrigger',\n className,\n )}\n >\n {children}\n <div className=\"kui-BaseMenuShortcut kui-DropdownMenuShortcut\">\n <ThickChevronRightIcon className=\"kui-BaseMenuSubTriggerIcon kui-DropdownMenuSubTriggerIcon\" />\n </div>\n </DropdownMenuPrimitive.SubTrigger>\n );\n});\nDropdownMenuSubTrigger.displayName = 'DropdownMenu.SubTrigger';\n\ntype DropdownMenuSeparatorElement = React.ElementRef<typeof DropdownMenuPrimitive.Separator>;\ninterface DropdownMenuSeparatorProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.Separator, RemovedProps> {}\nconst DropdownMenuSeparator = React.forwardRef<\n DropdownMenuSeparatorElement,\n DropdownMenuSeparatorProps\n>(({ className, ...props }, forwardedRef) => {\n if (!React.useContext(DrillDownLevelContext)) return null;\n return (\n <DropdownMenuPrimitive.Separator\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('kui-BaseMenuSeparator', 'kui-DropdownMenuSeparator', className)}\n />\n );\n});\nDropdownMenuSeparator.displayName = 'DropdownMenu.Separator';\n\n/** The row at the top of a drill-down panel that returns to the parent level. */\nfunction DrillDownBackItem({ label, name }: { label: React.ReactNode; name: string }) {\n const drillDownStore = useDrillDownStore();\n\n const handleSelect = React.useCallback(\n (event: Event) => {\n // Navigating does not close the menu.\n event.preventDefault();\n drillDownStore?.pop();\n },\n [drillDownStore],\n );\n\n // The visible label is often the submenu title, so the accessible name says\n // what the row does while still containing the visible text.\n const labelText = typeof label === 'string' ? label : name;\n const ariaLabel = labelText && labelText !== 'Back' ? `Back from ${labelText}` : undefined;\n\n return (\n <DropdownMenuPrimitive.Item\n aria-label={ariaLabel}\n textValue={labelText || 'Back'}\n onSelect={handleSelect}\n className={classNames(\n 'kui-reset',\n 'kui-BaseMenuItem',\n 'kui-DropdownMenuItem',\n 'kui-DropdownMenuDrillDownBackItem',\n )}\n >\n <ThickChevronLeftIcon className=\"kui-BaseMenuSubTriggerIcon kui-DropdownMenuDrillDownBackIcon\" />\n <span className=\"kui-DropdownMenuDrillDownBackLabel\">{label}</span>\n </DropdownMenuPrimitive.Item>\n );\n}\n\n/** Radix positioning and layer props that have no meaning for an inline drill-down panel. */\ntype PopperOnlyProps =\n | 'loop'\n | 'onEscapeKeyDown'\n | 'onPointerDownOutside'\n | 'onFocusOutside'\n | 'onInteractOutside'\n | 'sideOffset'\n | 'alignOffset'\n | 'avoidCollisions'\n | 'collisionBoundary'\n | 'collisionPadding'\n | 'arrowPadding'\n | 'sticky'\n | 'hideWhenDetached'\n | 'updatePositionStrategy';\n\nfunction omitPopperProps<T extends Record<string, unknown>>(props: T): Omit<T, PopperOnlyProps> {\n const {\n loop: _loop,\n onEscapeKeyDown: _onEscapeKeyDown,\n onPointerDownOutside: _onPointerDownOutside,\n onFocusOutside: _onFocusOutside,\n onInteractOutside: _onInteractOutside,\n sideOffset: _sideOffset,\n alignOffset: _alignOffset,\n avoidCollisions: _avoidCollisions,\n collisionBoundary: _collisionBoundary,\n collisionPadding: _collisionPadding,\n arrowPadding: _arrowPadding,\n sticky: _sticky,\n hideWhenDetached: _hideWhenDetached,\n updatePositionStrategy: _updatePositionStrategy,\n ...rest\n } = props;\n return rest;\n}\n\ntype DropdownMenuSubContentElement = React.ElementRef<typeof DropdownMenuPrimitive.SubContent>;\ninterface DropdownMenuSubContentProps\n extends ComponentPropsWithout<typeof DropdownMenuPrimitive.SubContent, RemovedProps>,\n DropdownMenuSurfaceProps {\n container?: React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Portal>['container'];\n /**\n * When true, skips the ScrollArea wrapper so a VirtualMenu can handle its own\n * scrolling. Applies to cascade submenus; a drill-down panel scrolls with the\n * root content.\n */\n virtualized?: boolean;\n}\nconst DropdownMenuSubContent = React.forwardRef<\n DropdownMenuSubContentElement,\n DropdownMenuSubContentProps\n>((props, forwardedRef) => {\n const drillDownStore = useDrillDownStore();\n const subContext = useSubContext();\n\n if (drillDownStore && subContext) {\n return (\n <DrillDownPanel {...props} ref={forwardedRef} store={drillDownStore} sub={subContext} />\n );\n }\n return <CascadeSubContent {...props} ref={forwardedRef} />;\n});\nDropdownMenuSubContent.displayName = 'DropdownMenu.SubContent';\n\nconst CascadeSubContent = React.forwardRef<DropdownMenuSubContentElement, DropdownMenuSubContentProps>(\n (props, forwardedRef) => {\n const parent = React.useContext(DropdownMenuContentContext);\n\n // A submenu inherits the parent surface, and its own props win.\n const size = props.size ?? parent.size;\n const color = props.color ?? parent.color;\n\n const {\n className,\n children,\n container,\n forceMount,\n color: _color,\n virtualized = false,\n ...subContentProps\n } = extractProps({ ...props, size }, dropdownMenuSubContentPropDefs);\n\n const scalarSize = useResolvedResponsiveValue(size, dropdownMenuSubContentPropDefs.size.default);\n\n const contextValue = React.useMemo(\n () => ({ size, color }),\n [size, color],\n );\n\n const body = (\n <MenuProvider size={size}>\n <DropdownMenuContentContext.Provider value={contextValue}>{children}</DropdownMenuContentContext.Provider>\n </MenuProvider>\n );\n\n return (\n <DropdownMenuPrimitive.Portal container={container} forceMount={forceMount}>\n <Theme asChild>\n <DropdownMenuPrimitive.SubContent\n data-accent-color={color}\n alignOffset={getMenuAlignOffset(scalarSize)}\n // Side offset accounts for the outer solid box-shadow\n sideOffset={1}\n collisionPadding={10}\n {...subContentProps}\n asChild={false}\n ref={forwardedRef}\n className={classNames(\n 'kui-PopperContent',\n 'kui-BaseMenuContent',\n 'kui-variant-soft',\n 'kui-BaseMenuSubContent',\n 'kui-DropdownMenuContent',\n 'kui-DropdownMenuSubContent',\n className,\n )}\n >\n {virtualized ? (\n <div className={classNames('kui-BaseMenuViewport', 'kui-DropdownMenuViewport', 'kui-virtualized')}>\n {body}\n </div>\n ) : (\n <ScrollArea type=\"auto\" scrollbars=\"vertical\">\n <div className={classNames('kui-BaseMenuViewport', 'kui-DropdownMenuViewport')}>{body}</div>\n </ScrollArea>\n )}\n </DropdownMenuPrimitive.SubContent>\n </Theme>\n </DropdownMenuPrimitive.Portal>\n );\n },\n);\nCascadeSubContent.displayName = 'DropdownMenu.CascadeSubContent';\n\ninterface DrillDownPanelProps extends DropdownMenuSubContentProps {\n store: NonNullable<ReturnType<typeof useDrillDownStore>>;\n sub: NonNullable<ReturnType<typeof useSubContext>>;\n}\n\n/**\n * A submenu rendered inline in drill-down mode. It mounts its children only\n * while it is on the navigation stack, and shows its own items only while it\n * is the top level; deeper panels inside it stay mounted.\n */\nconst DrillDownPanel = React.forwardRef<DropdownMenuSubContentElement, DrillDownPanelProps>(\n ({ store, sub, ...props }, forwardedRef) => {\n const position = usePanelPosition(store, sub.id);\n const entry = useStackEntry(store, sub.id);\n\n if (position === 'closed') return null;\n\n const {\n className,\n children,\n container: _container,\n forceMount: _forceMount,\n virtualized: _virtualized,\n size: _size,\n color: _color,\n ...panelProps\n } = omitPopperProps(props);\n\n const isTop = position === 'top';\n const name = entry?.name || (typeof sub.label === 'string' ? sub.label : '');\n\n return (\n <div\n role=\"group\"\n aria-label={name || undefined}\n {...panelProps}\n ref={forwardedRef}\n data-drill-down-panel={sub.id}\n data-drill-down-active={isTop ? true : undefined}\n className={classNames('kui-DropdownMenuDrillDownPanel', className)}\n >\n {isTop && (\n <>\n <DrillDownBackItem label={sub.label} name={name} />\n <DropdownMenuPrimitive.Separator className=\"kui-BaseMenuSeparator kui-DropdownMenuSeparator\" />\n </>\n )}\n <MenuGroupLabelProvider value={null}>\n <DrillDownLevelContext.Provider value={isTop}>{children}</DrillDownLevelContext.Provider>\n </MenuGroupLabelProvider>\n </div>\n );\n },\n);\nDrillDownPanel.displayName = 'DropdownMenu.DrillDownPanel';\n\ntype DropdownMenuTriggerIconElement = React.ElementRef<'svg'>;\ninterface DropdownMenuTriggerIconProps extends IconProps {}\nconst DropdownMenuTriggerIcon = React.forwardRef<\n DropdownMenuTriggerIconElement,\n DropdownMenuTriggerIconProps\n>(({ className, ...props }, forwardedRef) => (\n <ChevronDownIcon\n {...props}\n ref={forwardedRef}\n className={classNames('kui-DropdownMenuTriggerIcon', className)}\n />\n));\nDropdownMenuTriggerIcon.displayName = 'DropdownMenu.TriggerIcon';\n\nexport {\n DropdownMenuRoot as Root,\n DropdownMenuTrigger as Trigger,\n DropdownMenuTriggerIcon as TriggerIcon,\n DropdownMenuContent as Content,\n DropdownMenuLabel as Label,\n DropdownMenuItem as Item,\n DropdownMenuGroup as Group,\n DropdownMenuRadioGroup as RadioGroup,\n DropdownMenuRadioItem as RadioItem,\n DropdownMenuCheckboxItem as CheckboxItem,\n DropdownMenuSub as Sub,\n DropdownMenuSubTrigger as SubTrigger,\n DropdownMenuSubContent as SubContent,\n DropdownMenuSeparator as Separator,\n};\n\nexport type {\n DropdownMenuRootProps as RootProps,\n DropdownMenuTriggerProps as TriggerProps,\n DropdownMenuTriggerIconProps as TriggerIconProps,\n DropdownMenuContentProps as ContentProps,\n DropdownMenuLabelProps as LabelProps,\n DropdownMenuItemProps as ItemProps,\n DropdownMenuGroupProps as GroupProps,\n DropdownMenuRadioGroupProps as RadioGroupProps,\n DropdownMenuRadioItemProps as RadioItemProps,\n DropdownMenuCheckboxItemProps as CheckboxItemProps,\n DropdownMenuSubProps as SubProps,\n DropdownMenuSubTriggerProps as SubTriggerProps,\n DropdownMenuSubContentProps as SubContentProps,\n DropdownMenuSeparatorProps as SeparatorProps,\n SubmenuBehav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D+G,GAAwB,YAAc",
|
|
6
|
+
"names": ["dropdown_menu_exports", "__export", "DropdownMenuCheckboxItem", "DropdownMenuContent", "DropdownMenuGroup", "DropdownMenuItem", "DropdownMenuLabel", "DropdownMenuRadioGroup", "DropdownMenuRadioItem", "DropdownMenuRoot", "DropdownMenuSeparator", "DropdownMenuSub", "DropdownMenuSubContent", "DropdownMenuSubTrigger", "DropdownMenuTrigger", "DropdownMenuTriggerIcon", "React", "classNames", "DropdownMenuPrimitive", "Slot", "useCallbackRef", "DropdownMenuOpenContext", "DropdownMenuRoot", "props", "openProp", "defaultOpen", "onOpenChange", "uncontrolledOpen", "setUncontrolledOpen", "open", "handleOpenChangeProp", "useCallbackRef", "handleOpenChange", "next", "close", "MenuCloseProvider", "DropdownMenuPrimitive", "DropdownMenuTrigger", "children", "forwardedRef", "requireReactElement", "DropdownMenuContentContext", "BACK_KEYS", "FORWARD_KEYS", "isTextEntryTarget", "target", "getDirection", "element", "DropdownMenuContent", "ownProps", "useThemeSizeProps", "baseMenuContentPropDefs", "themeContext", "useThemeContext", "size", "className", "color", "container", "forceMount", "submenuBehavior", "virtualized", "onEscapeKeyDown", "onKeyDown", "contentProps", "extractProps", "resolvedColor", "behavior", "useResolvedResponsiveValue", "isDrillDown", "drillDownStore", "useCreateDrillDownStore", "handleEscapeKeyDown", "event", "handleKeyDown", "contextValue", "contentBody", "MenuProvider", "DrillDownRoot", "Theme", "classNames", "ScrollArea", "DropdownMenuLabel", "idProp", "isLevelVisible", "DrillDownLevelContext", "id", "useMenuGroupLabelId", "DropdownMenuItem", "baseMenuItemPropDefs", "shortcut", "itemProps", "toAriaKeyShortcuts", "Slot", "MenuShortcut", "DropdownMenuGroup", "ariaLabelledBy", "labelledBy", "setLabelId", "useMenuGroupLabelledBy", "MenuGroupLabelProvider", "DropdownMenuRadioGroup", "DropdownMenuRadioItem", "baseMenuRadioItemPropDefs", "ThickDotIcon", "DropdownMenuCheckboxItem", "baseMenuCheckboxItemPropDefs", "ThickCheckIcon", "DropdownMenuSub", "label", "useDrillDownStore", "subContextValue", "isOpenInDrillDown", "usePanelPosition", "isControlled", "defaultOpenRef", "wasOpenRef", "SubContext", "DropdownMenuSubTrigger", "subTriggerProps", "subContext", "useSubContext", "handleSelect", "ThickChevronRightIcon", "DropdownMenuSeparator", "DrillDownBackItem", "name", "labelText", "ariaLabel", "ThickChevronLeftIcon", "omitPopperProps", "_loop", "_onEscapeKeyDown", "_onPointerDownOutside", "_onFocusOutside", "_onInteractOutside", "_sideOffset", "_alignOffset", "_avoidCollisions", "_collisionBoundary", "_collisionPadding", "_arrowPadding", "_sticky", "_hideWhenDetached", "_updatePositionStrategy", "rest", "DropdownMenuSubContent", "DrillDownPanel", "CascadeSubContent", "parent", "_color", "subContentProps", "baseMenuSubContentPropDefs", "scalarSize", "body", "getMenuAlignOffset", "store", "sub", "position", "entry", "useStackEntry", "_container", "_forceMount", "_virtualized", "_size", "panelProps", "isTop", "DropdownMenuTriggerIcon", "ChevronDownIcon"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import*as r from"react";function s(e,t){if(t.includes(e))return e;let n=Number(e),i=t[0],u=1/0;for(let o=0;o<t.length;o++){let f=Math.abs(Number(t[o])-n);f<u&&(u=f,i=t[o])}return i}var m=r.createContext("2");m.displayName="ThemeSizeContext";function S(e,t){let n=r.useContext(m);return e!==void 0?e:s(n,t.values)}function h(e,t){let n=r.useContext(m);if(e.size!==void 0)return e;let i=s(n,t.values);return i===t.default?e:{...e,size:i}}export{m as a,S as b,h as c};
|
|
3
|
+
//# sourceMappingURL=chunk-5ON3XLRD.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/hooks/theme-size.ts", "../../src/helpers/theme-size.ts"],
|
|
4
|
+
"sourcesContent": ["'use client';\n\nimport * as React from 'react';\n\nimport { THEME_SIZE_DEFAULT, clampSize } from '../helpers/theme-size.js';\nimport type { ThemeSize } from '../helpers/theme-size.js';\n\n/**\n * The app-wide size index, provided by `Theme` beside `ThemeContext`.\n *\n * It is its own context, holding one string, so a component that only needs\n * the size does not re-render when the accent colour or appearance changes.\n */\nconst ThemeSizeContext = React.createContext<ThemeSize>(THEME_SIZE_DEFAULT);\nThemeSizeContext.displayName = 'ThemeSizeContext';\n\ninterface SizePropDef {\n values: readonly string[];\n default?: string;\n}\n\n/**\n * The size a component on the 1-4 index takes: what the caller said, else the\n * nearest Theme's size, mapped into the component's range.\n */\nfunction useThemeSize<V>(explicit: V | undefined, propDef: SizePropDef): V {\n const themeSize = React.useContext(ThemeSizeContext);\n if (explicit !== undefined) return explicit;\n // The clamped value is one of `propDef.values`, which is what `V` ranges over.\n return clampSize(themeSize, propDef.values) as V;\n}\n\n/**\n * Fills `size` from the nearest Theme when the caller left it unset, so the\n * result can go straight into `extractProps`. An explicit size, responsive\n * object included, wins.\n *\n * Returns the same props object when there is nothing to fill: when a size is\n * set, or when the theme size resolves to the prop def's own default (the\n * common case, a Theme with no size), so `extractProps` applies it as before.\n */\nfunction useThemeSizeProps<P extends { size?: unknown }>(props: P, propDef: SizePropDef): P {\n const themeSize = React.useContext(ThemeSizeContext);\n if (props.size !== undefined) return props;\n const size = clampSize(themeSize, propDef.values);\n if (size === propDef.default) return props;\n return { ...props, size };\n}\n\nexport { ThemeSizeContext, useThemeSize, useThemeSizeProps };\n", "/**\n * The pure half of the theme size: the type, the default and the clamp. Server-safe.\n *\n * The context and the hooks that read it live in `hooks/theme-size.ts`, a client module, so there\n * is one `ThemeSizeContext` and importing `/helpers` from a server component does not call\n * `createContext`.\n */\n\ntype ThemeSize = '1' | '2' | '3' | '4';\n\n/** The rest of the 1-4 index when no Theme states a size. */\nconst THEME_SIZE_DEFAULT: ThemeSize = '2';\n\n/**\n * Maps the theme size onto a component's own range: the value itself when the\n * component has it, otherwise the nearest end of the range (`4` on a 1-3 scale\n * is `3`, on a 1-2 scale it is `2`).\n */\nfunction clampSize(size: ThemeSize, values: readonly string[]): string {\n if (values.includes(size)) return size;\n const n = Number(size);\n let nearest = values[0];\n let distance = Infinity;\n for (let i = 0; i < values.length; i++) {\n const d = Math.abs(Number(values[i]) - n);\n if (d < distance) {\n distance = d;\n nearest = values[i];\n }\n }\n return nearest;\n}\n\nexport { THEME_SIZE_DEFAULT, clampSize };\nexport type { ThemeSize };\n"],
|
|
5
|
+
"mappings": ";AAEA,UAAYA,MAAW,QCgBvB,SAASC,EAAUC,EAAiBC,EAAmC,CACrE,GAAIA,EAAO,SAASD,CAAI,EAAG,OAAOA,EAClC,IAAM,EAAI,OAAOA,CAAI,EACjBE,EAAUD,EAAO,CAAC,EAClBE,EAAW,IACf,QAASC,EAAI,EAAGA,EAAIH,EAAO,OAAQG,IAAK,CACtC,IAAMC,EAAI,KAAK,IAAI,OAAOJ,EAAOG,CAAC,CAAC,EAAI,CAAC,EACpCC,EAAIF,IACNA,EAAWE,EACXH,EAAUD,EAAOG,CAAC,EAEtB,CACA,OAAOF,CACT,CDlBA,IAAMI,EAAyB,gBAAyB,GAAkB,EAC1EA,EAAiB,YAAc,mBAW/B,SAASC,EAAgBC,EAAyBC,EAAyB,CACzE,IAAMC,EAAkB,aAAWJ,CAAgB,EACnD,OAAIE,IAAa,OAAkBA,EAE5BG,EAAUD,EAAWD,EAAQ,MAAM,CAC5C,CAWA,SAASG,EAAgDC,EAAUJ,EAAyB,CAC1F,IAAMC,EAAkB,aAAWJ,CAAgB,EACnD,GAAIO,EAAM,OAAS,OAAW,OAAOA,EACrC,IAAMC,EAAOH,EAAUD,EAAWD,EAAQ,MAAM,EAChD,OAAIK,IAASL,EAAQ,QAAgBI,EAC9B,CAAE,GAAGA,EAAO,KAAAC,CAAK,CAC1B",
|
|
6
|
+
"names": ["React", "clampSize", "size", "values", "nearest", "distance", "i", "d", "ThemeSizeContext", "useThemeSize", "explicit", "propDef", "themeSize", "clampSize", "useThemeSizeProps", "props", "size"]
|
|
7
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{a as c}from"./chunk-Y2DBXOLT.js";import{b as p}from"./chunk-
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
import{a as c}from"./chunk-Y2DBXOLT.js";import{b as p}from"./chunk-Y2BTPKK6.js";import{a as u}from"./chunk-WMODMXEU.js";import*as t from"react";import O from"classnames";var C={loud:"solid",medium:"raised",quiet:"ghost"};function T(e){if(e["aria-label"]||e["aria-labelledby"])return;console.error("Button: an `iconOnly` button must have an accessible name. Pass `aria-label`, or `aria-labelledby` referencing a label element.")}var w=t.forwardRef(({className:e,style:a,tooltip:r,tooltipSide:d="top",tooltipAlign:m="center",tooltipDelayDuration:B,tooltipDisableHoverableContent:b,iconOnly:s=!1,emphasis:n,variant:i,...o},y)=>{let{tooltipId:f,hasTooltip:P,accessibilityProps:R}=c(r);s&&(T(o),o.fullWidth=!1);let h=n!==void 0?C[n]:i,g=o["aria-describedby"],v=R["aria-describedby"],E=[g,v].filter(Boolean).join(" ")||void 0,l=t.createElement(u,{...o,variant:h,"aria-describedby":E,ref:y,"data-icon-only":s||void 0,className:O("kui-Button",e),style:a});return P?t.createElement(p,{content:r,side:d,align:m,delayDuration:B,disableHoverableContent:b,id:f},l):l});w.displayName="Button";export{w as a};
|
|
3
|
+
//# sourceMappingURL=chunk-5TJH35TF.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{a as F}from"./chunk-TGRHRMQI.js";import{b as j,c as g}from"./chunk-
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
import{a as F}from"./chunk-TGRHRMQI.js";import{b as j,c as g}from"./chunk-N3QLHFHB.js";import{c as h,e as V,g as k,h as S,i as A}from"./chunk-CV7QQTI3.js";import{a as y}from"./chunk-RVPLXLRA.js";import{b as B,d as w,f as z}from"./chunk-GKDGNPBD.js";import{c as L}from"./chunk-5ON3XLRD.js";import{c as C,d as O,e as W,f as D}from"./chunk-I6SMGWS5.js";import{b as R,c as b,d as I,e as v}from"./chunk-XL5OHW6Z.js";import{c as f}from"./chunk-OKQAVYW4.js";import{a as ne}from"./chunk-VQPANPMI.js";var ae={};ne(ae,{CheckboxItem:()=>Y,Content:()=>K,Group:()=>J,Item:()=>H,Label:()=>U,RadioGroup:()=>Q,RadioItem:()=>X,Root:()=>_,Separator:()=>te,Sub:()=>Z,SubContent:()=>ee,SubTrigger:()=>$,Trigger:()=>q});import*as e from"react";import s from"classnames";import{ContextMenu as i,Slot as N}from"radix-ui";import{useCallbackRef as re}from"radix-ui/internal";var _=t=>{let{open:r,onOpenChange:n}=t,[a,o]=e.useState(!1),u=r??a,p=re(n),c=e.useCallback(l=>{o(l),p(l)},[p]),m=e.useCallback(()=>c(!1),[c]);return e.createElement(V,{value:m},e.createElement(i.Root,{...t,open:u,onOpenChange:c}))};_.displayName="ContextMenu.Root";var q=e.forwardRef(({children:t,...r},n)=>e.createElement(i.Trigger,{...r,ref:n,asChild:!0},F(t)));q.displayName="ContextMenu.Trigger";var T=e.createContext({}),K=e.forwardRef((t,r)=>{let n=L(t,C.size),a=j(),{size:o=C.size.default}=n,{className:u,children:p,color:c,container:m,forceMount:l,submenuBehavior:G,virtualized:d=!1,...P}=f(n,C),x=c||a.accentColor,M=R(o,C.size.default),oe=e.useMemo(()=>({size:o,color:x}),[o,x]),E=e.createElement(h,{size:o},e.createElement(T.Provider,{value:oe},p));return e.createElement(i.Portal,{container:m,forceMount:l},e.createElement(g,{asChild:!0},e.createElement(i.Content,{"data-accent-color":x,alignOffset:b(M),collisionPadding:10,...P,asChild:!1,ref:r,className:s("kui-PopperContent","kui-BaseMenuContent","kui-variant-soft","kui-ContextMenuContent",u)},d?e.createElement("div",{className:s("kui-BaseMenuViewport","kui-ContextMenuViewport","kui-virtualized")},E):e.createElement(y,{type:"auto",scrollbars:"vertical"},e.createElement("div",{className:s("kui-BaseMenuViewport","kui-ContextMenuViewport")},E)))))});K.displayName="ContextMenu.Content";var U=e.forwardRef(({className:t,id:r,...n},a)=>{let o=A(r);return e.createElement(i.Label,{...n,id:o,asChild:!1,ref:a,className:s("kui-BaseMenuLabel","kui-ContextMenuLabel",t)})});U.displayName="ContextMenu.Label";var H=e.forwardRef((t,r)=>{let{className:n,children:a,color:o=O.color.default,shortcut:u,...p}=t;return e.createElement(i.Item,{"data-accent-color":o,"aria-keyshortcuts":u?I(u):void 0,...p,ref:r,className:s("kui-reset","kui-BaseMenuItem","kui-ContextMenuItem",n)},e.createElement(N.Slottable,null,a),u&&e.createElement(v,{shortcut:u,className:"kui-ContextMenuShortcut"}))});H.displayName="ContextMenu.Item";var J=e.forwardRef(({className:t,"aria-labelledby":r,...n},a)=>{let[o,u]=S(r);return e.createElement(k,{value:u},e.createElement(i.Group,{"aria-labelledby":o,...n,asChild:!1,ref:a,className:s("kui-BaseMenuGroup","kui-ContextMenuGroup",t)}))});J.displayName="ContextMenu.Group";var Q=e.forwardRef(({className:t,"aria-labelledby":r,...n},a)=>{let[o,u]=S(r);return e.createElement(k,{value:u},e.createElement(i.RadioGroup,{"aria-labelledby":o,...n,asChild:!1,ref:a,className:s("kui-BaseMenuRadioGroup","kui-ContextMenuRadioGroup",t)}))});Q.displayName="ContextMenu.RadioGroup";var X=e.forwardRef((t,r)=>{let{children:n,className:a,color:o=D.color.default,...u}=t;return e.createElement(i.RadioItem,{...u,asChild:!1,ref:r,"data-accent-color":o,className:s("kui-BaseMenuItem","kui-BaseMenuRadioItem","kui-ContextMenuItem","kui-ContextMenuRadioItem",a)},e.createElement(N.Slottable,null,n),e.createElement(i.ItemIndicator,{className:"kui-BaseMenuItemIndicator kui-ContextMenuItemIndicator"},e.createElement(z,{className:"kui-BaseMenuItemIndicatorIcon kui-ContextMenuItemIndicatorIcon"})))});X.displayName="ContextMenu.RadioItem";var Y=e.forwardRef((t,r)=>{let{children:n,className:a,shortcut:o,color:u=W.color.default,...p}=t;return e.createElement(i.CheckboxItem,{"aria-keyshortcuts":o?I(o):void 0,...p,asChild:!1,ref:r,"data-accent-color":u,className:s("kui-BaseMenuItem","kui-BaseMenuCheckboxItem","kui-ContextMenuItem","kui-ContextMenuCheckboxItem",a)},e.createElement(N.Slottable,null,n),e.createElement(i.ItemIndicator,{className:"kui-BaseMenuItemIndicator kui-ContextMenuItemIndicator"},e.createElement(B,{className:"kui-BaseMenuItemIndicatorIcon kui-ContextMenuItemIndicatorIcon"})),o&&e.createElement(v,{shortcut:o,className:"kui-ContextMenuShortcut"}))});Y.displayName="ContextMenu.CheckboxItem";var Z=t=>e.createElement(i.Sub,{...t});Z.displayName="ContextMenu.Sub";var $=e.forwardRef((t,r)=>{let{className:n,children:a,...o}=t;return e.createElement(i.SubTrigger,{...o,asChild:!1,ref:r,className:s("kui-BaseMenuItem","kui-BaseMenuSubTrigger","kui-ContextMenuItem","kui-ContextMenuSubTrigger",n)},a,e.createElement("div",{className:"kui-BaseMenuShortcut kui-ContextMenuShortcut"},e.createElement(w,{className:"kui-BaseMenuSubTriggerIcon kui-ContextMenuSubTriggerIcon"})))});$.displayName="ContextMenu.SubTrigger";var ee=e.forwardRef((t,r)=>{let n=e.useContext(T),a=t.size??n.size,o=t.color??n.color,{className:u,children:p,container:c,forceMount:m,color:l,virtualized:G=!1,...d}=f({...t,size:a},C),P=R(a,C.size.default),x=e.useMemo(()=>({size:a,color:o}),[a,o]),M=e.createElement(h,{size:a},e.createElement(T.Provider,{value:x},p));return e.createElement(i.Portal,{container:c,forceMount:m},e.createElement(g,{asChild:!0},e.createElement(i.SubContent,{"data-accent-color":o,alignOffset:b(P),sideOffset:1,collisionPadding:10,...d,asChild:!1,ref:r,className:s("kui-PopperContent","kui-BaseMenuContent","kui-variant-soft","kui-BaseMenuSubContent","kui-ContextMenuContent","kui-ContextMenuSubContent",u)},G?e.createElement("div",{className:s("kui-BaseMenuViewport","kui-ContextMenuViewport","kui-virtualized")},M):e.createElement(y,{type:"auto",scrollbars:"vertical"},e.createElement("div",{className:s("kui-BaseMenuViewport","kui-ContextMenuViewport")},M)))))});ee.displayName="ContextMenu.SubContent";var te=e.forwardRef(({className:t,...r},n)=>e.createElement(i.Separator,{...r,asChild:!1,ref:n,className:s("kui-BaseMenuSeparator","kui-ContextMenuSeparator",t)}));te.displayName="ContextMenu.Separator";export{_ as a,q as b,K as c,U as d,H as e,J as f,Q as g,X as h,Y as i,Z as j,$ as k,ee as l,te as m,ae as n};
|
|
3
|
+
//# sourceMappingURL=chunk-5XR5PTDR.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/components/context-menu.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * Context Menu component that provides right-click menu functionality.\n * Requires client-side rendering due to event handling and portal usage.\n */\n'use client';\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { ContextMenu as ContextMenuPrimitive, Slot } from 'radix-ui';\nimport { useCallbackRef } from 'radix-ui/internal';\n\nimport { ScrollArea } from './scroll-area.js';\nimport {\n contextMenuContentPropDefs,\n contextMenuSubContentPropDefs,\n contextMenuItemPropDefs,\n contextMenuCheckboxItemPropDefs,\n contextMenuRadioItemPropDefs,\n} from './context-menu.props.js';\nimport { Theme, useThemeContext } from './theme.js';\nimport { ThickCheckIcon, ThickChevronRightIcon, ThickDotIcon } from './icons.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { useThemeSizeProps } from '../hooks/theme-size.js';\nimport { requireReactElement } from '../helpers/require-react-element.js';\nimport {\n MenuCloseProvider,\n MenuGroupLabelProvider,\n MenuProvider,\n useMenuGroupLabelId,\n useMenuGroupLabelledBy,\n} from './_internal/menu-context.js';\nimport {\n MenuShortcut,\n getMenuAlignOffset,\n toAriaKeyShortcuts,\n useResolvedResponsiveValue,\n} from './_internal/base-menu.utils.js';\n\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { GetPropDefTypes, Responsive } from '../props/prop-def.js';\n\ninterface ContextMenuRootProps\n extends React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Root> {}\nconst ContextMenuRoot: React.FC<ContextMenuRootProps> = (props) => {\n const { open: openProp, onOpenChange } = props;\n const [uncontrolledOpen, setUncontrolledOpen] = React.useState(false);\n const open = openProp ?? uncontrolledOpen;\n\n const handleOpenChangeProp = useCallbackRef(onOpenChange);\n const handleOpenChange = React.useCallback(\n (next: boolean) => {\n setUncontrolledOpen(next);\n handleOpenChangeProp(next);\n },\n [handleOpenChangeProp],\n );\n const close = React.useCallback(() => handleOpenChange(false), [handleOpenChange]);\n\n return (\n <MenuCloseProvider value={close}>\n <ContextMenuPrimitive.Root {...props} open={open} onOpenChange={handleOpenChange} />\n </MenuCloseProvider>\n );\n};\nContextMenuRoot.displayName = 'ContextMenu.Root';\n\ntype ContextMenuTriggerElement = React.ElementRef<typeof ContextMenuPrimitive.Trigger>;\ninterface ContextMenuTriggerProps\n extends ComponentPropsWithout<typeof ContextMenuPrimitive.Trigger, RemovedProps> {}\nconst ContextMenuTrigger = React.forwardRef<ContextMenuTriggerElement, ContextMenuTriggerProps>(\n ({ children, ...props }, forwardedRef) => (\n <ContextMenuPrimitive.Trigger {...props} ref={forwardedRef} asChild>\n {requireReactElement(children)}\n </ContextMenuPrimitive.Trigger>\n ),\n);\nContextMenuTrigger.displayName = 'ContextMenu.Trigger';\n\n/** Visual props shared by Content and SubContent. */\ntype ContextMenuSurfaceProps = GetPropDefTypes<typeof contextMenuContentPropDefs>;\n\ntype ContextMenuContentContextValue = {\n size?: ContextMenuSurfaceProps['size'];\n color?: ContextMenuSurfaceProps['color'];\n};\nconst ContextMenuContentContext = React.createContext<ContextMenuContentContextValue>({});\ntype ContextMenuContentElement = React.ElementRef<typeof ContextMenuPrimitive.Content>;\ninterface ContextMenuContentProps\n extends ComponentPropsWithout<typeof ContextMenuPrimitive.Content, RemovedProps>,\n ContextMenuSurfaceProps {\n container?: React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Portal>['container'];\n /**\n * When true, skips the ScrollArea wrapper to allow VirtualMenu to handle its own scrolling.\n * Use this when rendering virtualized lists inside the context menu.\n */\n virtualized?: boolean;\n /**\n * @deprecated Has no effect. ContextMenu submenus always cascade.\n */\n submenuBehavior?: Responsive<'cascade' | 'drill-down'>;\n}\nconst ContextMenuContent = React.forwardRef<ContextMenuContentElement, ContextMenuContentProps>(\n (ownProps, forwardedRef) => {\n const props = useThemeSizeProps(ownProps, contextMenuContentPropDefs.size);\n const themeContext = useThemeContext();\n const {\n size = contextMenuContentPropDefs.size.default,\n } = props;\n const {\n className,\n children,\n color,\n container,\n forceMount,\n submenuBehavior: _submenuBehavior,\n virtualized = false,\n ...contentProps\n } = extractProps(props, contextMenuContentPropDefs);\n\n const resolvedColor = color || themeContext.accentColor;\n const scalarSize = useResolvedResponsiveValue(size, contextMenuContentPropDefs.size.default);\n\n const contextValue = React.useMemo(\n () => ({ size, color: resolvedColor }),\n [size, resolvedColor],\n );\n\n const body = (\n <MenuProvider size={size}>\n <ContextMenuContentContext.Provider value={contextValue}>{children}</ContextMenuContentContext.Provider>\n </MenuProvider>\n );\n\n return (\n <ContextMenuPrimitive.Portal container={container} forceMount={forceMount}>\n <Theme asChild>\n <ContextMenuPrimitive.Content\n data-accent-color={resolvedColor}\n alignOffset={getMenuAlignOffset(scalarSize)}\n collisionPadding={10}\n {...contentProps}\n asChild={false}\n ref={forwardedRef}\n className={classNames(\n 'kui-PopperContent',\n 'kui-BaseMenuContent',\n 'kui-variant-soft',\n 'kui-ContextMenuContent',\n className,\n )}\n >\n {virtualized ? (\n <div className={classNames('kui-BaseMenuViewport', 'kui-ContextMenuViewport', 'kui-virtualized')}>\n {body}\n </div>\n ) : (\n <ScrollArea type=\"auto\" scrollbars=\"vertical\">\n <div className={classNames('kui-BaseMenuViewport', 'kui-ContextMenuViewport')}>{body}</div>\n </ScrollArea>\n )}\n </ContextMenuPrimitive.Content>\n </Theme>\n </ContextMenuPrimitive.Portal>\n );\n },\n);\nContextMenuContent.displayName = 'ContextMenu.Content';\n\ntype ContextMenuLabelElement = React.ElementRef<typeof ContextMenuPrimitive.Label>;\ninterface ContextMenuLabelProps\n extends ComponentPropsWithout<typeof ContextMenuPrimitive.Label, RemovedProps> {}\nconst ContextMenuLabel = React.forwardRef<ContextMenuLabelElement, ContextMenuLabelProps>(\n ({ className, id: idProp, ...props }, forwardedRef) => {\n const id = useMenuGroupLabelId(idProp);\n return (\n <ContextMenuPrimitive.Label\n {...props}\n id={id}\n asChild={false}\n ref={forwardedRef}\n className={classNames('kui-BaseMenuLabel', 'kui-ContextMenuLabel', className)}\n />\n );\n },\n);\nContextMenuLabel.displayName = 'ContextMenu.Label';\n\ntype ContextMenuItemElement = React.ElementRef<typeof ContextMenuPrimitive.Item>;\ntype ContextMenuItemOwnProps = GetPropDefTypes<typeof contextMenuItemPropDefs>;\ninterface ContextMenuItemProps\n extends ComponentPropsWithout<typeof ContextMenuPrimitive.Item, RemovedProps>,\n ContextMenuItemOwnProps {}\nconst ContextMenuItem = React.forwardRef<ContextMenuItemElement, ContextMenuItemProps>(\n (props, forwardedRef) => {\n const {\n className,\n children,\n color = contextMenuItemPropDefs.color.default,\n shortcut,\n ...itemProps\n } = props;\n return (\n <ContextMenuPrimitive.Item\n data-accent-color={color}\n aria-keyshortcuts={shortcut ? toAriaKeyShortcuts(shortcut) : undefined}\n {...itemProps}\n ref={forwardedRef}\n className={classNames('kui-reset', 'kui-BaseMenuItem', 'kui-ContextMenuItem', className)}\n >\n <Slot.Slottable>{children}</Slot.Slottable>\n {shortcut && <MenuShortcut shortcut={shortcut} className=\"kui-ContextMenuShortcut\" />}\n </ContextMenuPrimitive.Item>\n );\n },\n);\nContextMenuItem.displayName = 'ContextMenu.Item';\n\ntype ContextMenuGroupElement = React.ElementRef<typeof ContextMenuPrimitive.Group>;\ninterface ContextMenuGroupProps\n extends ComponentPropsWithout<typeof ContextMenuPrimitive.Group, RemovedProps> {}\nconst ContextMenuGroup = React.forwardRef<ContextMenuGroupElement, ContextMenuGroupProps>(\n ({ className, 'aria-labelledby': ariaLabelledBy, ...props }, forwardedRef) => {\n const [labelledBy, setLabelId] = useMenuGroupLabelledBy(ariaLabelledBy);\n return (\n <MenuGroupLabelProvider value={setLabelId}>\n <ContextMenuPrimitive.Group\n aria-labelledby={labelledBy}\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('kui-BaseMenuGroup', 'kui-ContextMenuGroup', className)}\n />\n </MenuGroupLabelProvider>\n );\n },\n);\nContextMenuGroup.displayName = 'ContextMenu.Group';\n\ntype ContextMenuRadioGroupElement = React.ElementRef<typeof ContextMenuPrimitive.RadioGroup>;\ninterface ContextMenuRadioGroupProps\n extends ComponentPropsWithout<typeof ContextMenuPrimitive.RadioGroup, RemovedProps> {}\nconst ContextMenuRadioGroup = React.forwardRef<\n ContextMenuRadioGroupElement,\n ContextMenuRadioGroupProps\n>(({ className, 'aria-labelledby': ariaLabelledBy, ...props }, forwardedRef) => {\n const [labelledBy, setLabelId] = useMenuGroupLabelledBy(ariaLabelledBy);\n return (\n <MenuGroupLabelProvider value={setLabelId}>\n <ContextMenuPrimitive.RadioGroup\n aria-labelledby={labelledBy}\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('kui-BaseMenuRadioGroup', 'kui-ContextMenuRadioGroup', className)}\n />\n </MenuGroupLabelProvider>\n );\n});\nContextMenuRadioGroup.displayName = 'ContextMenu.RadioGroup';\n\ntype ContextMenuRadioItemElement = React.ElementRef<typeof ContextMenuPrimitive.RadioItem>;\ntype ContextMenuRadioItemOwnProps = GetPropDefTypes<typeof contextMenuRadioItemPropDefs>;\ninterface ContextMenuRadioItemProps\n extends ComponentPropsWithout<typeof ContextMenuPrimitive.RadioItem, RemovedProps>,\n ContextMenuRadioItemOwnProps {}\nconst ContextMenuRadioItem = React.forwardRef<\n ContextMenuRadioItemElement,\n ContextMenuRadioItemProps\n>((props, forwardedRef) => {\n const {\n children,\n className,\n color = contextMenuRadioItemPropDefs.color.default,\n ...itemProps\n } = props;\n return (\n <ContextMenuPrimitive.RadioItem\n {...itemProps}\n asChild={false}\n ref={forwardedRef}\n data-accent-color={color}\n className={classNames(\n 'kui-BaseMenuItem',\n 'kui-BaseMenuRadioItem',\n 'kui-ContextMenuItem',\n 'kui-ContextMenuRadioItem',\n className,\n )}\n >\n <Slot.Slottable>{children}</Slot.Slottable>\n <ContextMenuPrimitive.ItemIndicator className=\"kui-BaseMenuItemIndicator kui-ContextMenuItemIndicator\">\n <ThickDotIcon className=\"kui-BaseMenuItemIndicatorIcon kui-ContextMenuItemIndicatorIcon\" />\n </ContextMenuPrimitive.ItemIndicator>\n </ContextMenuPrimitive.RadioItem>\n );\n});\nContextMenuRadioItem.displayName = 'ContextMenu.RadioItem';\n\ntype ContextMenuCheckboxItemElement = React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>;\ntype ContextMenuCheckboxItemOwnProps = GetPropDefTypes<typeof contextMenuCheckboxItemPropDefs>;\ninterface ContextMenuCheckboxItemProps\n extends ComponentPropsWithout<typeof ContextMenuPrimitive.CheckboxItem, RemovedProps>,\n ContextMenuCheckboxItemOwnProps {}\nconst ContextMenuCheckboxItem = React.forwardRef<\n ContextMenuCheckboxItemElement,\n ContextMenuCheckboxItemProps\n>((props, forwardedRef) => {\n const {\n children,\n className,\n shortcut,\n color = contextMenuCheckboxItemPropDefs.color.default,\n ...itemProps\n } = props;\n return (\n <ContextMenuPrimitive.CheckboxItem\n aria-keyshortcuts={shortcut ? toAriaKeyShortcuts(shortcut) : undefined}\n {...itemProps}\n asChild={false}\n ref={forwardedRef}\n data-accent-color={color}\n className={classNames(\n 'kui-BaseMenuItem',\n 'kui-BaseMenuCheckboxItem',\n 'kui-ContextMenuItem',\n 'kui-ContextMenuCheckboxItem',\n className,\n )}\n >\n <Slot.Slottable>{children}</Slot.Slottable>\n <ContextMenuPrimitive.ItemIndicator className=\"kui-BaseMenuItemIndicator kui-ContextMenuItemIndicator\">\n <ThickCheckIcon className=\"kui-BaseMenuItemIndicatorIcon kui-ContextMenuItemIndicatorIcon\" />\n </ContextMenuPrimitive.ItemIndicator>\n {shortcut && <MenuShortcut shortcut={shortcut} className=\"kui-ContextMenuShortcut\" />}\n </ContextMenuPrimitive.CheckboxItem>\n );\n});\nContextMenuCheckboxItem.displayName = 'ContextMenu.CheckboxItem';\n\ninterface ContextMenuSubProps\n extends ComponentPropsWithout<typeof ContextMenuPrimitive.Sub, RemovedProps> {}\nconst ContextMenuSub: React.FC<ContextMenuSubProps> = (props) => (\n <ContextMenuPrimitive.Sub {...props} />\n);\nContextMenuSub.displayName = 'ContextMenu.Sub';\n\ntype ContextMenuSubTriggerElement = React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>;\ninterface ContextMenuSubTriggerProps\n extends ComponentPropsWithout<typeof ContextMenuPrimitive.SubTrigger, RemovedProps> {}\nconst ContextMenuSubTrigger = React.forwardRef<\n ContextMenuSubTriggerElement,\n ContextMenuSubTriggerProps\n>((props, forwardedRef) => {\n const { className, children, ...subTriggerProps } = props;\n return (\n <ContextMenuPrimitive.SubTrigger\n {...subTriggerProps}\n asChild={false}\n ref={forwardedRef}\n className={classNames(\n 'kui-BaseMenuItem',\n 'kui-BaseMenuSubTrigger',\n 'kui-ContextMenuItem',\n 'kui-ContextMenuSubTrigger',\n className,\n )}\n >\n {children}\n <div className=\"kui-BaseMenuShortcut kui-ContextMenuShortcut\">\n <ThickChevronRightIcon className=\"kui-BaseMenuSubTriggerIcon kui-ContextMenuSubTriggerIcon\" />\n </div>\n </ContextMenuPrimitive.SubTrigger>\n );\n});\nContextMenuSubTrigger.displayName = 'ContextMenu.SubTrigger';\n\ntype ContextMenuSubContentElement = React.ElementRef<typeof ContextMenuPrimitive.SubContent>;\ninterface ContextMenuSubContentProps\n extends ComponentPropsWithout<typeof ContextMenuPrimitive.SubContent, RemovedProps>,\n ContextMenuSurfaceProps {\n container?: React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Portal>['container'];\n /**\n * When true, skips the ScrollArea wrapper to allow VirtualMenu to handle its own scrolling.\n */\n virtualized?: boolean;\n}\nconst ContextMenuSubContent = React.forwardRef<\n ContextMenuSubContentElement,\n ContextMenuSubContentProps\n>((props, forwardedRef) => {\n const parent = React.useContext(ContextMenuContentContext);\n\n // A submenu inherits the parent surface, and its own props win.\n const size = props.size ?? parent.size;\n const color = props.color ?? parent.color;\n\n const {\n className,\n children,\n container,\n forceMount,\n color: _color,\n virtualized = false,\n ...subContentProps\n } = extractProps({ ...props, size }, contextMenuSubContentPropDefs);\n\n const scalarSize = useResolvedResponsiveValue(size, contextMenuSubContentPropDefs.size.default);\n\n const contextValue = React.useMemo(\n () => ({ size, color }),\n [size, color],\n );\n\n const body = (\n <MenuProvider size={size}>\n <ContextMenuContentContext.Provider value={contextValue}>{children}</ContextMenuContentContext.Provider>\n </MenuProvider>\n );\n\n return (\n <ContextMenuPrimitive.Portal container={container} forceMount={forceMount}>\n <Theme asChild>\n <ContextMenuPrimitive.SubContent\n data-accent-color={color}\n alignOffset={getMenuAlignOffset(scalarSize)}\n // Side offset accounts for the outer solid box-shadow\n sideOffset={1}\n collisionPadding={10}\n {...subContentProps}\n asChild={false}\n ref={forwardedRef}\n className={classNames(\n 'kui-PopperContent',\n 'kui-BaseMenuContent',\n 'kui-variant-soft',\n 'kui-BaseMenuSubContent',\n 'kui-ContextMenuContent',\n 'kui-ContextMenuSubContent',\n className,\n )}\n >\n {virtualized ? (\n <div className={classNames('kui-BaseMenuViewport', 'kui-ContextMenuViewport', 'kui-virtualized')}>\n {body}\n </div>\n ) : (\n <ScrollArea type=\"auto\" scrollbars=\"vertical\">\n <div className={classNames('kui-BaseMenuViewport', 'kui-ContextMenuViewport')}>{body}</div>\n </ScrollArea>\n )}\n </ContextMenuPrimitive.SubContent>\n </Theme>\n </ContextMenuPrimitive.Portal>\n );\n});\nContextMenuSubContent.displayName = 'ContextMenu.SubContent';\n\ntype ContextMenuSeparatorElement = React.ElementRef<typeof ContextMenuPrimitive.Separator>;\ninterface ContextMenuSeparatorProps\n extends ComponentPropsWithout<typeof ContextMenuPrimitive.Separator, RemovedProps> {}\nconst ContextMenuSeparator = React.forwardRef<\n ContextMenuSeparatorElement,\n ContextMenuSeparatorProps\n>(({ className, ...props }, forwardedRef) => (\n <ContextMenuPrimitive.Separator\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('kui-BaseMenuSeparator', 'kui-ContextMenuSeparator', className)}\n />\n));\nContextMenuSeparator.displayName = 'ContextMenu.Separator';\n\nexport {\n ContextMenuRoot as Root,\n ContextMenuTrigger as Trigger,\n ContextMenuContent as Content,\n ContextMenuLabel as Label,\n ContextMenuItem as Item,\n ContextMenuGroup as Group,\n ContextMenuRadioGroup as RadioGroup,\n ContextMenuRadioItem as RadioItem,\n ContextMenuCheckboxItem as CheckboxItem,\n ContextMenuSub as Sub,\n ContextMenuSubTrigger as SubTrigger,\n ContextMenuSubContent as SubContent,\n ContextMenuSeparator as Separator,\n};\n\nexport type {\n ContextMenuRootProps as RootProps,\n ContextMenuTriggerProps as TriggerProps,\n ContextMenuContentProps as ContentProps,\n ContextMenuLabelProps as LabelProps,\n ContextMenuItemProps as ItemProps,\n ContextMenuGroupProps as GroupProps,\n ContextMenuRadioGroupProps as RadioGroupProps,\n ContextMenuRadioItemProps as RadioItemProps,\n ContextMenuCheckboxItemProps as CheckboxItemProps,\n ContextMenuSubProps as SubProps,\n ContextMenuSubTriggerProps as SubTriggerProps,\n ContextMenuSubContentProps as SubContentProps,\n ContextMenuSeparatorProps as SeparatorProps,\n};\n"],
|
|
5
|
+
"mappings": ";4eAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,kBAAAE,EAAA,YAAAC,EAAA,UAAAC,EAAA,SAAAC,EAAA,UAAAC,EAAA,eAAAC,EAAA,cAAAC,EAAA,SAAAC,EAAA,cAAAC,GAAA,QAAAC,EAAA,eAAAC,GAAA,eAAAC,EAAA,YAAAC,IAMA,UAAYC,MAAW,QACvB,OAAOC,MAAgB,a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AS,GACT,IAAKe,EACL,UAAW0B,EAAW,wBAAyB,2BAA4BhB,CAAS,EACtF,CACD,EACDkD,GAAqB,YAAc",
|
|
6
|
+
"names": ["context_menu_exports", "__export", "ContextMenuCheckboxItem", "ContextMenuContent", "ContextMenuGroup", "ContextMenuItem", "ContextMenuLabel", "ContextMenuRadioGroup", "ContextMenuRadioItem", "ContextMenuRoot", "ContextMenuSeparator", "ContextMenuSub", "ContextMenuSubContent", "ContextMenuSubTrigger", "ContextMenuTrigger", "React", "classNames", "ContextMenuPrimitive", "Slot", "useCallbackRef", "ContextMenuRoot", "props", "openProp", "onOpenChange", "uncontrolledOpen", "setUncontrolledOpen", "open", "handleOpenChangeProp", "useCallbackRef", "handleOpenChange", "next", "close", "MenuCloseProvider", "ContextMenuPrimitive", "ContextMenuTrigger", "children", "forwardedRef", "requireReactElement", "ContextMenuContentContext", "ContextMenuContent", "ownProps", "useThemeSizeProps", "baseMenuSubContentPropDefs", "themeContext", "useThemeContext", "size", "className", "color", "container", "forceMount", "_submenuBehavior", "virtualized", "contentProps", "extractProps", "resolvedColor", "scalarSize", "useResolvedResponsiveValue", "contextValue", "body", "MenuProvider", "Theme", "getMenuAlignOffset", "classNames", "ScrollArea", "ContextMenuLabel", "idProp", "id", "useMenuGroupLabelId", "ContextMenuItem", "baseMenuItemPropDefs", "shortcut", "itemProps", "toAriaKeyShortcuts", "Slot", "MenuShortcut", "ContextMenuGroup", "ariaLabelledBy", "labelledBy", "setLabelId", "useMenuGroupLabelledBy", "MenuGroupLabelProvider", "ContextMenuRadioGroup", "ContextMenuRadioItem", "baseMenuRadioItemPropDefs", "ThickDotIcon", "ContextMenuCheckboxItem", "baseMenuCheckboxItemPropDefs", "ThickCheckIcon", "ContextMenuSub", "ContextMenuSubTrigger", "subTriggerProps", "ThickChevronRightIcon", "ContextMenuSubContent", "parent", "_color", "subContentProps", "ContextMenuSeparator"]
|
|
7
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{a as e}from"./chunk-647DRBXQ.js";import{c as p}from"./chunk-
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
import{a as e}from"./chunk-647DRBXQ.js";import{c as p}from"./chunk-5ON3XLRD.js";import{c as o}from"./chunk-OKQAVYW4.js";import*as r from"react";import n from"classnames";import{Slot as c}from"radix-ui";var P=r.forwardRef((t,s)=>{let a=p(t,e.size),{asChild:m,className:d,...i}=o(a,e),f=m?c.Root:"div";return r.createElement(f,{ref:s,...i,className:n("kui-reset","kui-BaseCard","kui-Card","kui-SurfaceNest",d)})});P.displayName="Card";export{P as a};
|
|
3
|
+
//# sourceMappingURL=chunk-63MUJFVF.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/components/card.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { Slot } from 'radix-ui';\n\nimport { cardPropDefs } from './card.props.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { useThemeSizeProps } from '../hooks/theme-size.js';\n\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { GetPropDefTypes } from '../props/prop-def.js';\n\ntype CardElement = React.ElementRef<'div'>;\ntype CardOwnProps = GetPropDefTypes<typeof cardPropDefs>;\ninterface CardProps extends ComponentPropsWithout<'div', RemovedProps>, CardOwnProps {}\nconst Card = React.forwardRef<CardElement, CardProps>((ownProps, forwardedRef) => {\n const props = useThemeSizeProps(ownProps, cardPropDefs.size);\n const { asChild, className, ...cardProps } = extractProps(props, cardPropDefs);\n const Comp = asChild ? Slot.Root : 'div';\n return (\n <Comp\n ref={forwardedRef}\n {...cardProps}\n className={classNames('kui-reset', 'kui-BaseCard', 'kui-Card', 'kui-SurfaceNest', className)}\n />\n );\n});\nCard.displayName = 'Card';\n\nexport { Card };\nexport type { CardProps };\n"],
|
|
5
|
+
"mappings": ";wHAEA,UAAYA,MAAW,QACvB,OAAOC,MAAgB,aACvB,OAAS,QAAAC,MAAY,WAYrB,IAAMC,EAAa,aAAmC,CAACC,EAAUC,IAAiB,CAChF,IAAMC,EAAQC,EAAkBH,EAAUI,EAAa,IAAI,EACrD,CAAE,QAAAC,EAAS,UAAAC,EAAW,GAAGC,CAAU,EAAIC,EAAaN,EAAOE,CAAY,EACvEK,EAAOJ,EAAUK,EAAK,KAAO,MACnC,OACE,gBAACD,EAAA,CACC,IAAKR,EACJ,GAAGM,EACJ,UAAWI,EAAW,YAAa,eAAgB,WAAY,kBAAmBL,CAAS,EAC7F,CAEJ,CAAC,EACDP,EAAK,YAAc",
|
|
6
|
+
"names": ["React", "classNames", "Slot", "Card", "ownProps", "forwardedRef", "props", "useThemeSizeProps", "cardPropDefs", "asChild", "className", "cardProps", "extractProps", "Comp", "Slot", "classNames"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/helpers/theme-size.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * The pure half of the theme size: the type, the default and the clamp. Server-safe.\n *\n * The context and the hooks that read it live in `hooks/theme-size.ts`, a client module, so there\n * is one `ThemeSizeContext` and importing `/helpers` from a server component does not call\n * `createContext`.\n */\n\ntype ThemeSize = '1' | '2' | '3' | '4';\n\n/** The rest of the 1-4 index when no Theme states a size. */\nconst THEME_SIZE_DEFAULT: ThemeSize = '2';\n\n/**\n * Maps the theme size onto a component's own range: the value itself when the\n * component has it, otherwise the nearest end of the range (`4` on a 1-3 scale\n * is `3`, on a 1-2 scale it is `2`).\n */\nfunction clampSize(size: ThemeSize, values: readonly string[]): string {\n if (values.includes(size)) return size;\n const n = Number(size);\n let nearest = values[0];\n let distance = Infinity;\n for (let i = 0; i < values.length; i++) {\n const d = Math.abs(Number(values[i]) - n);\n if (d < distance) {\n distance = d;\n nearest = values[i];\n }\n }\n return nearest;\n}\n\nexport { THEME_SIZE_DEFAULT, clampSize };\nexport type { ThemeSize };\n"],
|
|
5
|
+
"mappings": "AAWA,IAAMA,EAAgC,IAOtC,SAASC,EAAUC,EAAiBC,EAAmC,CACrE,GAAIA,EAAO,SAASD,CAAI,EAAG,OAAOA,EAClC,IAAME,EAAI,OAAOF,CAAI,EACjBG,EAAUF,EAAO,CAAC,EAClBG,EAAW,IACf,QAASC,EAAI,EAAGA,EAAIJ,EAAO,OAAQI,IAAK,CACtC,IAAMC,EAAI,KAAK,IAAI,OAAOL,EAAOI,CAAC,CAAC,EAAIH,CAAC,EACpCI,EAAIF,IACNA,EAAWE,EACXH,EAAUF,EAAOI,CAAC,EAEtB,CACA,OAAOF,CACT",
|
|
6
|
+
"names": ["THEME_SIZE_DEFAULT", "clampSize", "size", "values", "n", "nearest", "distance", "i", "d"]
|
|
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-5TJH35TF.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-6RJQ5LLP.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{a as d}from"./chunk-
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
import{a as d}from"./chunk-5TJH35TF.js";import{a as R}from"./chunk-6UZT3ZLO.js";import{a as u,b as f}from"./chunk-5ON3XLRD.js";import*as e from"react";import z from"classnames";var v=e.createContext(void 0),C={values:["1","2","3","4"]},N=e.forwardRef(({kind:r,size:o="2",color:t="gray",className:c,children:a,trailing:s,leading:i,...l},n)=>e.createElement("div",{role:"status","aria-live":"polite",...l,ref:n,className:z("kui-NoticeRoot",`kui-r-size-${o}`,c),"data-kind":r,"data-accent-color":t},i?e.createElement("span",{className:"kui-NoticeIcon","aria-hidden":!0},i):null,e.createElement(R,{as:"div",size:o,className:"kui-NoticeText"},a),s));N.displayName="Strip";var g=e.forwardRef(({icon:r,action:o,onDismiss:t,dismissLabel:c="Dismiss",size:a,...s},i)=>{let l=e.useContext(v),n=f(a??l,C),p=o||t?e.createElement("span",{className:"kui-NoticeActions"},o?e.createElement(u.Provider,{value:n},o):null,t?e.createElement(d,{iconOnly:!0,size:n,variant:"ghost",color:"gray","aria-label":c,className:"kui-NoticeDismiss",onClick:t},e.createElement("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none","aria-hidden":!0},e.createElement("path",{d:"M4 4l7 7M11 4l-7 7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}))):null):null;return e.createElement(N,{...s,size:n,ref:i,kind:"notice",leading:r,trailing:p})});g.displayName="Notice";var k=e.forwardRef(({confirmLabel:r,cancelLabel:o="Not now",onConfirm:t,onCancel:c,busy:a=!1,size:s,color:i="gray",...l},n)=>{let p=e.useContext(v),m=f(s??p,C);return e.createElement(N,{...l,size:m,color:i,ref:n,kind:"confirmation",trailing:e.createElement("span",{className:"kui-NoticeActions"},e.createElement(d,{size:m,variant:"ghost",color:"gray",disabled:a,onClick:c},o),e.createElement(d,{size:m,variant:"solid",color:i,loading:a,onClick:t},r))})});k.displayName="Confirmation";export{v as a,g as b,k as c};
|
|
3
|
+
//# sourceMappingURL=chunk-7B3XDZXZ.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/components/notice.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client';\n\n/**\n * Notice and Confirmation \u2014 what the app tells the person while it is true.\n *\n * Two questions place every message: what is it about, and what made it appear.\n *\n * - **Notice** \u2014 a condition that is true now, which nobody just caused: a usage limit, a\n * connection lost, a goal that finished. It takes space in the layout and never floats, so it\n * cannot cover what it is about. At most one action, and that action FIXES the condition. A\n * dismiss button only ACKNOWLEDGES it, and the app owns that state (`onDismiss`), because a\n * component cannot remember a dismissal across a reload.\n * - **Confirmation** \u2014 a question that waits for an answer: a quiet no before a loud yes, and no\n * dismiss button, because closing a question does not answer it. It never takes focus, so a\n * person can answer in the composer instead.\n *\n * Placement is the caller's. In a chat, both go in `Chatbar.Root`'s `notices`.\n * A notice with no action and no dismiss button is just a sentence: use `Text`.\n */\n\nimport * as React from 'react';\nimport classNames from 'classnames';\n\nimport { Button } from './button.js';\nimport { Text } from './text.js';\nimport { ThemeSizeContext, useThemeSize } from '../hooks/theme-size.js';\nimport { accentColorPropDef } from '../props/color.prop.js';\n\ntype NoticeSize = '1' | '2' | '3' | '4';\n\n/** The size a notice takes when it doesn't set one. `Chatbar.Root` provides its own size here. */\nconst NoticeSizeContext = React.createContext<NoticeSize | undefined>(undefined);\n\n/** Notice's own range, the Theme's four sizes. */\nconst noticeSizePropDef = { values: ['1', '2', '3', '4'] as const };\ntype NoticeColor = (typeof accentColorPropDef)['color']['values'][number];\n\ninterface StripProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'color' | 'children'> {\n /** Padding, text and button size. Defaults to the nearest Theme's size. */\n size?: NoticeSize;\n /**\n * The category of the message, not its volume. Default `gray`. Use a colour only when it adds a\n * fact the words don't already give, such as `red` for something that stops the next step.\n */\n color?: NoticeColor;\n /** The message. */\n children: React.ReactNode;\n}\n\ninterface NoticeProps extends StripProps {\n /** An icon before the message. It is hidden from assistive technology. */\n icon?: React.ReactNode;\n /**\n * One action that fixes the condition, such as `<Button>Add credits</Button>`. A control in it\n * that sets no `size` takes the notice's size.\n */\n action?: React.ReactNode;\n /**\n * Called when the person presses the dismiss button, which shows only when this is set.\n * Dismissing hides the message; it does not fix the condition. Remove the notice and remember\n * the choice in your app.\n */\n onDismiss?: () => void;\n /** Accessible name of the dismiss button. Default \"Dismiss\". */\n dismissLabel?: string;\n}\n\ninterface ConfirmationProps extends StripProps {\n /** The yes. Name the action, such as \"Run\" or \"Allow up to $18\". */\n confirmLabel: string;\n /** The no. Default \"Not now\". */\n cancelLabel?: string;\n onConfirm: () => void;\n onCancel: () => void;\n /** The yes is running: it shows a spinner and the no is disabled. */\n busy?: boolean;\n}\n\nconst Strip = React.forwardRef<HTMLDivElement, StripProps & { kind: 'notice' | 'confirmation'; trailing: React.ReactNode; leading?: React.ReactNode }>(\n ({ kind, size = '2', color = 'gray', className, children, trailing, leading, ...props }, forwardedRef) => (\n <div\n role=\"status\"\n aria-live=\"polite\"\n {...props}\n ref={forwardedRef}\n className={classNames('kui-NoticeRoot', `kui-r-size-${size}`, className)}\n data-kind={kind}\n data-accent-color={color}\n >\n {leading ? (\n <span className=\"kui-NoticeIcon\" aria-hidden>\n {leading}\n </span>\n ) : null}\n <Text as=\"div\" size={size} className=\"kui-NoticeText\">\n {children}\n </Text>\n {trailing}\n </div>\n ),\n);\nStrip.displayName = 'Strip';\n\n/** A condition that is true now, with at most one action that fixes it. */\nconst Notice = React.forwardRef<HTMLDivElement, NoticeProps>(({ icon, action, onDismiss, dismissLabel = 'Dismiss', size: sizeProp, ...props }, forwardedRef) => {\n const contextSize = React.useContext(NoticeSizeContext);\n const size = useThemeSize(sizeProp ?? contextSize, noticeSizePropDef);\n const trailing =\n action || onDismiss ? (\n <span className=\"kui-NoticeActions\">\n {action ? <ThemeSizeContext.Provider value={size}>{action}</ThemeSizeContext.Provider> : null}\n {onDismiss ? (\n <Button iconOnly size={size} variant=\"ghost\" color=\"gray\" aria-label={dismissLabel} className=\"kui-NoticeDismiss\" onClick={onDismiss}>\n <svg width=\"15\" height=\"15\" viewBox=\"0 0 15 15\" fill=\"none\" aria-hidden>\n <path d=\"M4 4l7 7M11 4l-7 7\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" />\n </svg>\n </Button>\n ) : null}\n </span>\n ) : null;\n return <Strip {...props} size={size} ref={forwardedRef} kind=\"notice\" leading={icon} trailing={trailing} />;\n});\nNotice.displayName = 'Notice';\n\n/** A question that waits for an answer: a quiet no, a loud yes, and no dismiss button. */\nconst Confirmation = React.forwardRef<HTMLDivElement, ConfirmationProps>(\n ({ confirmLabel, cancelLabel = 'Not now', onConfirm, onCancel, busy = false, size: sizeProp, color = 'gray', ...props }, forwardedRef) => {\n const contextSize = React.useContext(NoticeSizeContext);\n const size = useThemeSize(sizeProp ?? contextSize, noticeSizePropDef);\n return (\n <Strip\n {...props}\n size={size}\n color={color}\n ref={forwardedRef}\n kind=\"confirmation\"\n trailing={\n <span className=\"kui-NoticeActions\">\n <Button size={size} variant=\"ghost\" color=\"gray\" disabled={busy} onClick={onCancel}>\n {cancelLabel}\n </Button>\n <Button size={size} variant=\"solid\" color={color} loading={busy} onClick={onConfirm}>\n {confirmLabel}\n </Button>\n </span>\n }\n />\n );\n },\n);\nConfirmation.displayName = 'Confirmation';\n\nexport { Notice, Confirmation, NoticeSizeContext };\nexport type { NoticeProps, ConfirmationProps };\n"],
|
|
5
|
+
"mappings": ";+HAoBA,UAAYA,MAAW,QACvB,OAAOC,MAAgB,aAUvB,IAAMC,EAA0B,gBAAsC,MAAS,EAGzEC,EAAoB,CAAE,OAAQ,CAAC,IAAK,IAAK,IAAK,GAAG,CAAW,EA4C5DC,EAAc,aAClB,CAAC,CAAE,KAAAC,EAAM,KAAAC,EAAO,IAAK,MAAAC,EAAQ,OAAQ,UAAAC,EAAW,SAAAC,EAAU,SAAAC,EAAU,QAAAC,EAAS,GAAGC,CAAM,EAAGC,IACvF,gBAAC,OACC,KAAK,SACL,YAAU,SACT,GAAGD,EACJ,IAAKC,EACL,UAAWC,EAAW,iBAAkB,cAAcR,CAAI,GAAIE,CAAS,EACvE,YAAWH,EACX,oBAAmBE,GAElB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,EACJ,KAAMN,EACN,MAAOC,EACP,IAAKM,EACL,KAAK,eACL,SACE,gBAAC,QAAK,UAAU,qBACd,gBAACY,EAAA,CAAO,KAAMnB,EAAM,QAAQ,QAAQ,MAAM,OAAO,SAAUyB,EAAM,QAASD,GACvEF,CACH,EACA,gBAACH,EAAA,CAAO,KAAMnB,EAAM,QAAQ,QAAQ,MAAOC,EAAO,QAASwB,EAAM,QAASF,GACvEF,CACH,CACF,EAEJ,CAEF,CACF,EACAD,EAAa,YAAc",
|
|
6
|
+
"names": ["React", "classNames", "NoticeSizeContext", "noticeSizePropDef", "Strip", "kind", "size", "color", "className", "children", "trailing", "leading", "props", "forwardedRef", "classNames", "Text", "Notice", "icon", "action", "onDismiss", "dismissLabel", "sizeProp", "contextSize", "useThemeSize", "ThemeSizeContext", "Button", "Confirmation", "confirmLabel", "cancelLabel", "onConfirm", "onCancel", "busy"]
|
|
7
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{a as p}from"./chunk-QQY4WFJL.js";import{c}from"./chunk-
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
import{a as p}from"./chunk-QQY4WFJL.js";import{c}from"./chunk-5ON3XLRD.js";import{c as l}from"./chunk-OKQAVYW4.js";import*as e from"react";import R from"classnames";var g=e.forwardRef((m,u)=>{let f=c(m,p.size),{className:x,color:y,radius:b,style:P,...r}=l(f,p),s=e.useId(),{"aria-describedby":o,"aria-labelledby":d,"aria-invalid":a}=r,i=!!r.error||a===!0||a==="true",n=e.useMemo(()=>{let t=[];return r.errorMessage&&t.push(s),o&&t.push(o),t.length>0?t.join(" "):void 0},[r.errorMessage,o,s]),A=e.useMemo(()=>({"aria-invalid":i?!0:a,"aria-describedby":n,"aria-labelledby":d}),[i,a,n,d]),{error:M,errorMessage:h,required:T,"aria-describedby":D,"aria-labelledby":N,...v}=r;return e.createElement(e.Fragment,null,e.createElement("div",{"data-accent-color":y,"data-radius":b,className:R("kui-TextAreaRoot",x,{"kui-error":i}),style:P},e.createElement("textarea",{className:"kui-reset kui-TextAreaInput",ref:u,...v,required:T||void 0,...A})),r.errorMessage&&e.createElement("div",{id:s,className:"kui-TextAreaErrorMessage",role:"alert"},r.errorMessage))});g.displayName="TextArea";export{g as a};
|
|
3
|
+
//# sourceMappingURL=chunk-7X7VWR3F.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/components/text-area.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nimport classNames from 'classnames';\n\nimport { textAreaPropDefs } from './text-area.props.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { useThemeSizeProps } from '../hooks/theme-size.js';\n\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { GetPropDefTypes } from '../props/prop-def.js';\n\ntype TextAreaElement = React.ElementRef<'textarea'>;\ntype TextAreaOwnProps = GetPropDefTypes<typeof textAreaPropDefs> & {\n defaultValue?: string;\n value?: string;\n};\ninterface TextAreaProps\n extends ComponentPropsWithout<'textarea', RemovedProps | 'size' | 'value'>,\n TextAreaOwnProps {}\n\nconst TextArea = React.forwardRef<TextAreaElement, TextAreaProps>((ownProps, forwardedRef) => {\n const props = useThemeSizeProps(ownProps, textAreaPropDefs.size);\n const { className, color, radius, style, ...textAreaProps } =\n extractProps(props, textAreaPropDefs);\n\n // Generate unique IDs for accessibility\n const errorId = React.useId();\n\n const { 'aria-describedby': ariaDescribedby, 'aria-labelledby': ariaLabelledby, 'aria-invalid': ariaInvalid } = textAreaProps;\n\n // Invalid when `error` is set or the caller passes aria-invalid; the CSS keys on aria-invalid only.\n const isInvalid = Boolean(textAreaProps.error) || ariaInvalid === true || ariaInvalid === 'true';\n\n // Build aria-describedby string\n const describedBy = React.useMemo(() => {\n const parts = [];\n if (textAreaProps.errorMessage) parts.push(errorId);\n if (ariaDescribedby) parts.push(ariaDescribedby);\n return parts.length > 0 ? parts.join(' ') : undefined;\n }, [textAreaProps.errorMessage, ariaDescribedby, errorId]);\n\n // Build aria attributes\n const ariaProps = React.useMemo(\n () => ({\n 'aria-invalid': isInvalid ? true : ariaInvalid,\n 'aria-describedby': describedBy,\n 'aria-labelledby': ariaLabelledby,\n }),\n [isInvalid, ariaInvalid, describedBy, ariaLabelledby],\n );\n\n // Filter out our custom props to avoid DOM warnings\n const {\n error,\n errorMessage,\n required,\n 'aria-describedby': _ariaDescribedby,\n 'aria-labelledby': _ariaLabelledby,\n ...nativeTextAreaProps\n } = textAreaProps;\n\n // The message is a sibling of the painted root, so it sits below the box rather than inside it.\n return (\n <>\n <div\n data-accent-color={color}\n data-radius={radius}\n className={classNames('kui-TextAreaRoot', className, {\n // Not used by the library's CSS (invalid styling keys on aria-invalid); kept as a hook for app styles.\n 'kui-error': isInvalid,\n })}\n style={style}\n >\n <textarea\n className=\"kui-reset kui-TextAreaInput\"\n ref={forwardedRef}\n {...nativeTextAreaProps}\n required={required || undefined}\n {...ariaProps}\n />\n </div>\n {textAreaProps.errorMessage && (\n <div id={errorId} className=\"kui-TextAreaErrorMessage\" role=\"alert\">\n {textAreaProps.errorMessage}\n </div>\n )}\n </>\n );\n});\n\nTextArea.displayName = 'TextArea';\n\nexport { TextArea };\nexport type { TextAreaProps };\n"],
|
|
5
|
+
"mappings": ";mHAAA,UAAYA,MAAW,QACvB,OAAOC,MAAgB,aAkBvB,IAAMC,EAAiB,aAA2C,CAACC,EAAUC,IAAiB,CAC5F,IAAMC,EAAQC,EAAkBH,EAAUI,EAAiB,IAAI,EACzD,CAAE,UAAAC,EAAW,MAAAC,EAAO,OAAAC,EAAQ,MAAAC,EAAO,GAAGC,CAAc,EACxDC,EAAaR,EAAOE,CAAgB,EAGhCO,EAAgB,QAAM,EAEtB,CAAE,mBAAoBC,EAAiB,kBAAmBC,EAAgB,eAAgBC,CAAY,EAAIL,EAG1GM,EAAY,EAAQN,EAAc,OAAUK,IAAgB,IAAQA,IAAgB,OAGpFE,EAAoB,UAAQ,IAAM,CACtC,IAAMC,EAAQ,CAAC,EACf,OAAIR,EAAc,cAAcQ,EAAM,KAAKN,CAAO,EAC9CC,GAAiBK,EAAM,KAAKL,CAAe,EACxCK,EAAM,OAAS,EAAIA,EAAM,KAAK,GAAG,EAAI,MAC9C,EAAG,CAACR,EAAc,aAAcG,EAAiBD,CAAO,CAAC,EAGnDO,EAAkB,UACtB,KAAO,CACL,eAAgBH,EAAY,GAAOD,EACnC,mBAAoBE,EACpB,kBAAmBH,CACrB,GACA,CAACE,EAAWD,EAAaE,EAAaH,CAAc,CACtD,EAGM,CACJ,MAAAM,EACA,aAAAC,EACA,SAAAC,EACA,mBAAoBC,EACpB,kBAAmBC,EACnB,GAAGC,CACL,EAAIf,EAGJ,OACE,gCACE,gBAAC,OACC,oBAAmBH,EACnB,cAAaC,EACb,UAAWkB,EAAW,mBAAoBpB,EAAW,CAEnD,YAAaU,CACf,CAAC,EACD,MAAOP,GAEP,gBAAC,YACC,UAAU,8BACV,IAAKP,EACJ,GAAGuB,EACJ,SAAUH,GAAY,OACrB,GAAGH,EACN,CACF,EACCT,EAAc,cACb,gBAAC,OAAI,GAAIE,EAAS,UAAU,2BAA2B,KAAK,SACzDF,EAAc,YACjB,CAEJ,CAEJ,CAAC,EAEDV,EAAS,YAAc",
|
|
6
|
+
"names": ["React", "classNames", "TextArea", "ownProps", "forwardedRef", "props", "useThemeSizeProps", "textAreaPropDefs", "className", "color", "radius", "style", "textAreaProps", "extractProps", "errorId", "ariaDescribedby", "ariaLabelledby", "ariaInvalid", "isInvalid", "describedBy", "parts", "ariaProps", "error", "errorMessage", "required", "_ariaDescribedby", "_ariaLabelledby", "nativeTextAreaProps", "classNames"]
|
|
7
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{a as te,b as se}from"./chunk-NBVCQQSY.js";import{c as ne}from"./chunk-
|
|
2
|
+
import{a as te,b as se}from"./chunk-NBVCQQSY.js";import{c as ne}from"./chunk-5ON3XLRD.js";import{c as ee}from"./chunk-OKQAVYW4.js";import{a as ye}from"./chunk-VQPANPMI.js";var Se={};ye(Se,{Root:()=>de,Slot:()=>pe});import*as e from"react";import*as ie from"react-dom";import ce from"classnames";import{composeEventHandlers as W,composeRefs as ae}from"radix-ui/internal";var le=e.createContext(null),ue="button, a, input, select, textarea, label, [tabindex], [contenteditable]",de=e.forwardRef((h,T)=>{let o=ne(h,te.size),m=e.useRef(null),{children:C,className:E,color:w,radius:L,style:k,...c}=ee(o,te),P=e.useId(),[I,D]=e.useState([]),N=e.useCallback(r=>(D(s=>s.includes(r)?s:[...s,r]),()=>D(s=>s.filter(a=>a!==r))),[]),j=e.useMemo(()=>({registerSlot:N}),[N]),{"aria-describedby":y,"aria-labelledby":M,"aria-invalid":b}=c,S=!!c.error||b===!0||b==="true",g=e.useMemo(()=>{let r=[];return c.errorMessage&&r.push(P),y&&r.push(y),r.push(...I),r.length>0?r.join(" "):void 0},[c.errorMessage,y,P,I]),z=e.useMemo(()=>({"aria-invalid":S?!0:b,"aria-describedby":g,"aria-labelledby":M}),[S,b,g,M]),{error:V,errorMessage:K,required:v,"aria-describedby":i,"aria-labelledby":H,...O}=c,_=e.useCallback(r=>{let s=r.target;if(s.closest(ue))return;let a=m.current;if(!a)return;let l=s.closest(`
|
|
3
3
|
.kui-TextFieldSlot[data-side='right'],
|
|
4
4
|
.kui-TextFieldSlot:not([data-side='right']) ~ .kui-TextFieldSlot:not([data-side='left'])
|
|
5
5
|
`)?a.value.length:0;r.preventDefault(),a.focus();try{a.setSelectionRange(l,l)}catch{}},[]);return e.createElement(e.Fragment,null,e.createElement("div",{"data-accent-color":w,"data-radius":L,style:k,className:ce("kui-TextFieldRoot",E,{"kui-error":S}),onMouseDown:_},e.createElement("input",{...O,required:v||void 0,...z,ref:ae(m,T),className:"kui-reset kui-TextFieldInput"}),e.createElement(le.Provider,{value:j},C)),c.errorMessage&&e.createElement("div",{id:P,className:"kui-TextFieldErrorMessage",role:"alert"},c.errorMessage))});de.displayName="TextField.Root";var x=(()=>{if(typeof navigator>"u")return!1;let h=navigator.userAgent,T=/^((?!chrome|android).)*safari/i.test(h),o=/firefox/i.test(h);return T||o})(),pe=e.forwardRef((h,T)=>{let{scrub:o,scrubValue:m,scrubStep:C=1,scrubSensitivity:E=1,scrubMin:w,scrubMax:L,scrubShiftMultiplier:k=10,scrubAltMultiplier:c=.1,onScrub:P,...I}=h,{className:D,color:N,side:j,onPointerDown:y,onPointerMove:M,onPointerUp:b,onLostPointerCapture:S,...g}=ee(I,se),z=e.useId(),V=g.id??z,K=e.useContext(le)?.registerSlot;e.useEffect(()=>K?.(V),[K,V]);let v=e.useRef(null),[i,H]=e.useState(!1),[O,_]=e.useState({x:0,y:0}),r=e.useRef(null),s=e.useRef(0),a=e.useRef(!1),R=e.useRef(0),l=e.useRef(0),p=e.useRef(0),F=e.useRef(null),q=e.useRef(0),X=e.useRef({scrubValue:m,scrubStep:C,scrubSensitivity:E,scrubMin:w,scrubMax:L,scrubShiftMultiplier:k,scrubAltMultiplier:c,onScrub:P});X.current={scrubValue:m,scrubStep:C,scrubSensitivity:E,scrubMin:w,scrubMax:L,scrubShiftMultiplier:k,scrubAltMultiplier:c,onScrub:P};let fe=e.useCallback(t=>{if(!o||t.target.closest(ue))return;t.preventDefault(),R.current=0,l.current=m??0,p.current=t.clientX,s.current=t.clientY,_({x:t.clientX,y:t.clientY});let u=v.current;u&&(x?(F.current=t.pointerId,q.current=t.clientX,u.setPointerCapture(t.pointerId),H(!0)):(a.current=!0,u.requestPointerLock()))},[o,m]);e.useEffect(()=>{if(x||!o)return;let t=()=>{if(!a.current)return;let n=document.pointerLockElement===v.current;H(n),n||(a.current=!1,X.current.onScrub?.(0,!1),R.current=0,l.current=0)};return document.addEventListener("pointerlockchange",t),()=>{document.removeEventListener("pointerlockchange",t)}},[o]);let A=e.useCallback((t,n,u,he)=>{let d=X.current,B=window.innerWidth,U=window.innerHeight;p.current+=t,p.current>B?p.current=p.current%B:p.current<0&&(p.current=B+p.current%B);let f=s.current+n;f>U?f=f%U:f<0&&(f=U+f%U),s.current=f;let G=r.current;G&&(G.style.left=`${p.current}px`,G.style.top=`${f}px`),R.current+=t;let $=R.current/d.scrubSensitivity;if(Math.abs($)>=1){let Z=1;u?Z=d.scrubShiftMultiplier:he&&(Z=d.scrubAltMultiplier);let re=Math.trunc($),J=re*d.scrubStep*Z,Q=J;if(d.scrubMin!==void 0||d.scrubMax!==void 0){let Pe=l.current+J,oe=Math.max(d.scrubMin??-1/0,Math.min(d.scrubMax??1/0,Pe));Q=oe-l.current,l.current=oe}else l.current+=J;Q!==0&&d.onScrub?.(Q,!0),R.current=($-re)*d.scrubSensitivity}},[]),Y=e.useCallback(()=>{X.current.onScrub?.(0,!1),R.current=0,l.current=0,F.current=null,H(!1)},[]),me=e.useCallback(t=>{if(!i||!x)return;let n=t.clientX-q.current;q.current=t.clientX,A(n,t.movementY,t.shiftKey,t.altKey)},[i,A]),be=e.useCallback(t=>{if(!x||F.current!==t.pointerId)return;let n=v.current;n&&F.current!==null&&n.releasePointerCapture(F.current),Y()},[Y]),Re=e.useCallback(()=>{x&&i&&Y()},[i,Y]);e.useEffect(()=>{if(!i||x)return;let t=u=>{A(u.movementX,u.movementY,u.shiftKey,u.altKey)},n=()=>{document.exitPointerLock()};return document.addEventListener("mousemove",t),document.addEventListener("mouseup",n),document.body.style.userSelect="none",()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",n),document.body.style.userSelect=""}},[i,A]),e.useEffect(()=>{if(!i||!x)return;let t=document.createElement("style");return t.textContent="* { cursor: none !important; user-select: none !important; }",document.head.appendChild(t),()=>{document.head.removeChild(t)}},[i]);let xe=i?ie.createPortal(e.createElement("img",{ref:r,className:"kui-TextFieldSlotScrubCursor",src:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='black' stroke='white' stroke-width='1' d='M0 12 L5 7 L5 10 L19 10 L19 7 L24 12 L19 17 L19 14 L5 14 L5 17 Z'/%3E%3C/svg%3E",alt:"",style:{position:"fixed",left:O.x,top:O.y,transform:"translate(-50%, -50%)",pointerEvents:"none",zIndex:99999,width:24,height:24},"aria-hidden":"true"}),document.body):null;return e.createElement("div",{"data-accent-color":N,"data-side":j,"data-scrub":o||void 0,"data-scrubbing":i||void 0,...g,id:V,ref:ae(v,T),className:ce("kui-TextFieldSlot",D),onPointerDown:o?W(y,fe):y,onPointerMove:o?W(M,me):M,onPointerUp:o?W(b,be):b,onLostPointerCapture:o?W(S,Re):S},g.children,xe)});pe.displayName="TextField.Slot";export{de as a,pe as b,Se as c};
|
|
6
|
-
//# sourceMappingURL=chunk-
|
|
6
|
+
//# sourceMappingURL=chunk-7XHE6TOA.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/components/text-field.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom';\nimport classNames from 'classnames';\nimport { composeEventHandlers, composeRefs } from 'radix-ui/internal';\n\nimport { textFieldRootPropDefs, textFieldSlotPropDefs, type TextFieldSlotScrubProps } from './text-field.props.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { useThemeSizeProps } from '../hooks/theme-size.js';\n\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\nimport type { NotInputTextualAttributes } from '../helpers/input-attributes.js';\nimport type { GetPropDefTypes } from '../props/prop-def.js';\n\ntype TextFieldRootElement = React.ElementRef<'input'>;\ntype TextFieldRootOwnProps = GetPropDefTypes<typeof textFieldRootPropDefs> & {\n defaultValue?: string | number;\n value?: string | number;\n type?: 'date' | 'datetime-local' | 'email' | 'hidden' | 'month' | 'number' | 'password' | 'search' | 'tel' | 'text' | 'time' | 'url' | 'week';\n};\ntype TextFieldInputProps = ComponentPropsWithout<'input', NotInputTextualAttributes | 'color' | 'defaultValue' | 'size' | 'type' | 'value'>;\ninterface TextFieldRootProps extends TextFieldInputProps, TextFieldRootOwnProps {}\n\n// Each Slot registers its id here, so the input can list slot content in aria-describedby.\ntype TextFieldContextValue = { registerSlot: (id: string) => () => void };\nconst TextFieldContext = React.createContext<TextFieldContextValue | null>(null);\n\n// Clicking anything a person could mean to press keeps its own press: the guard is a focusability\n// list, not a tag list. `[tabindex]` catches role-based widgets; `label` already redirects a click.\nconst FOCUSABLE_IN_SLOT = 'button, a, input, select, textarea, label, [tabindex], [contenteditable]';\n\nconst TextFieldRoot = React.forwardRef<TextFieldRootElement, TextFieldRootProps>((ownProps, forwardedRef) => {\n const props = useThemeSizeProps(ownProps, textFieldRootPropDefs.size);\n const inputRef = React.useRef<HTMLInputElement>(null);\n const { children, className, color, radius, style, ...inputProps } = extractProps(props, textFieldRootPropDefs);\n\n // Generate unique IDs for accessibility\n const errorId = React.useId();\n\n // Slot content qualifies the value, so it describes the input (as in v2), in mount order.\n const [slotIds, setSlotIds] = React.useState<string[]>([]);\n const registerSlot = React.useCallback((id: string) => {\n setSlotIds((prev) => (prev.includes(id) ? prev : [...prev, id]));\n return () => setSlotIds((prev) => prev.filter((slotId) => slotId !== id));\n }, []);\n const contextValue = React.useMemo(() => ({ registerSlot }), [registerSlot]);\n\n const { 'aria-describedby': ariaDescribedby, 'aria-labelledby': ariaLabelledby, 'aria-invalid': ariaInvalid } = inputProps;\n\n // Invalid when `error` is set or the caller passes aria-invalid; the CSS keys on aria-invalid only.\n const isInvalid = Boolean(inputProps.error) || ariaInvalid === true || ariaInvalid === 'true';\n\n // Build aria-describedby string. The caller's ids stay; ours are appended.\n const describedBy = React.useMemo(() => {\n const parts = [];\n if (inputProps.errorMessage) parts.push(errorId);\n if (ariaDescribedby) parts.push(ariaDescribedby);\n parts.push(...slotIds);\n return parts.length > 0 ? parts.join(' ') : undefined;\n }, [inputProps.errorMessage, ariaDescribedby, errorId, slotIds]);\n\n // Build aria attributes\n const ariaProps = React.useMemo(\n () => ({\n 'aria-invalid': isInvalid ? true : ariaInvalid,\n 'aria-describedby': describedBy,\n 'aria-labelledby': ariaLabelledby,\n }),\n [isInvalid, ariaInvalid, describedBy, ariaLabelledby],\n );\n\n // Filter out our custom props to avoid DOM warnings\n const { error, errorMessage, required, 'aria-describedby': _ariaDescribedby, 'aria-labelledby': _ariaLabelledby, ...nativeInputProps } = inputProps;\n\n // Clicking the padding or a passive slot focuses the input. preventDefault stops the browser\n // from moving focus to the root first, so the input is focused once, synchronously.\n const handleMouseDown = React.useCallback((event: React.MouseEvent) => {\n const target = event.target as HTMLElement;\n if (target.closest(FOCUSABLE_IN_SLOT)) return;\n\n const input = inputRef.current;\n if (!input) return;\n\n // Same selector as in the CSS to find the right slot\n const isRightSlot = target.closest(`\n .kui-TextFieldSlot[data-side='right'],\n .kui-TextFieldSlot:not([data-side='right']) ~ .kui-TextFieldSlot:not([data-side='left'])\n `);\n\n const cursorPosition = isRightSlot ? input.value.length : 0;\n\n event.preventDefault();\n input.focus();\n // Only some input types support this, browsers will throw an error if not supported\n // See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange#:~:text=Note%20that%20according,not%20support%20selection%22.\n try {\n input.setSelectionRange(cursorPosition, cursorPosition);\n } catch {}\n }, []);\n\n // The message is a sibling of the painted root, so it sits below the field rather than inside it.\n return (\n <>\n {/* A pointer-only hit-target redirect to the input; keyboard users reach the input directly. */}\n {/* eslint-disable-next-line jsx-a11y/no-static-element-interactions */}\n <div\n data-accent-color={color}\n data-radius={radius}\n style={style}\n className={classNames('kui-TextFieldRoot', className, {\n // Not used by the library's CSS (invalid styling keys on aria-invalid); kept as a hook for app styles.\n 'kui-error': isInvalid,\n })}\n onMouseDown={handleMouseDown}\n >\n <input {...nativeInputProps} required={required || undefined} {...ariaProps} ref={composeRefs(inputRef, forwardedRef)} className=\"kui-reset kui-TextFieldInput\" />\n <TextFieldContext.Provider value={contextValue}>{children}</TextFieldContext.Provider>\n </div>\n {inputProps.errorMessage && (\n <div id={errorId} className=\"kui-TextFieldErrorMessage\" role=\"alert\">\n {inputProps.errorMessage}\n </div>\n )}\n </>\n );\n});\nTextFieldRoot.displayName = 'TextField.Root';\n\ntype TextFieldSlotElement = React.ElementRef<'div'>;\ntype TextFieldSlotOwnProps = GetPropDefTypes<typeof textFieldSlotPropDefs> & TextFieldSlotScrubProps;\ninterface TextFieldSlotProps extends ComponentPropsWithout<'div', RemovedProps>, TextFieldSlotOwnProps {}\n\n// Detect if we should use pointer capture instead of pointer lock\n// Safari and Firefox show intrusive browser warnings with pointer lock\nconst usePointerCapture = (() => {\n if (typeof navigator === 'undefined') return false;\n const ua = navigator.userAgent;\n const isSafari = /^((?!chrome|android).)*safari/i.test(ua);\n const isFirefox = /firefox/i.test(ua);\n return isSafari || isFirefox;\n})();\n\nconst TextFieldSlot = React.forwardRef<TextFieldSlotElement, TextFieldSlotProps>((props, forwardedRef) => {\n // Extract scrub props first (not part of PropDef system)\n const { scrub, scrubValue, scrubStep = 1, scrubSensitivity = 1, scrubMin, scrubMax, scrubShiftMultiplier = 10, scrubAltMultiplier = 0.1, onScrub, ...restProps } = props;\n\n // Then extract styling props\n const { className, color, side, onPointerDown, onPointerMove, onPointerUp, onLostPointerCapture, ...slotProps } = extractProps(\n restProps,\n textFieldSlotPropDefs,\n );\n\n // The slot describes the input (see TextFieldRoot); a caller's own id is kept.\n const generatedId = React.useId();\n const slotId = slotProps.id ?? generatedId;\n const registerSlot = React.useContext(TextFieldContext)?.registerSlot;\n React.useEffect(() => registerSlot?.(slotId), [registerSlot, slotId]);\n\n const slotRef = React.useRef<HTMLDivElement>(null);\n const [isScrubbing, setIsScrubbing] = React.useState(false);\n // Where the virtual cursor starts. Movement is written straight to the cursor element, so a\n // scrub does not re-render the slot on every mouse move.\n const [cursorStart, setCursorStart] = React.useState({ x: 0, y: 0 });\n const cursorRef = React.useRef<HTMLImageElement>(null);\n // Virtual cursor Y, tracked beside virtualX\n const virtualY = React.useRef(0);\n // Whether this slot asked for the pointer lock, so a lock change elsewhere is not ours\n const lockedByMe = React.useRef(false);\n\n // Track accumulated sub-step movement for precision\n const accumulatedMovement = React.useRef(0);\n // Track current value for clamping (initialized to scrubValue when scrubbing starts)\n const currentValue = React.useRef(0);\n // Track virtual X position for wrap-around (separate from rendered position)\n const virtualX = React.useRef(0);\n // Track pointer ID for capture mode\n const pointerIdRef = React.useRef<number | null>(null);\n // Track last X position for capture mode (movementX calculation)\n const lastXRef = React.useRef(0);\n\n // Store scrub config in refs so document handlers can access latest values\n const scrubConfigRef = React.useRef({\n scrubValue,\n scrubStep,\n scrubSensitivity,\n scrubMin,\n scrubMax,\n scrubShiftMultiplier,\n scrubAltMultiplier,\n onScrub,\n });\n scrubConfigRef.current = {\n scrubValue,\n scrubStep,\n scrubSensitivity,\n scrubMin,\n scrubMax,\n scrubShiftMultiplier,\n scrubAltMultiplier,\n onScrub,\n };\n\n const handlePointerDown = React.useCallback(\n (event: React.PointerEvent) => {\n if (!scrub) return;\n\n // Don't start scrubbing if clicking on interactive elements\n const target = event.target as HTMLElement;\n if (target.closest(FOCUSABLE_IN_SLOT)) return;\n\n event.preventDefault();\n accumulatedMovement.current = 0;\n // Initialize to current value so min/max clamping works correctly\n currentValue.current = scrubValue ?? 0;\n\n // Initialize virtual cursor at actual mouse position\n virtualX.current = event.clientX;\n virtualY.current = event.clientY;\n setCursorStart({ x: event.clientX, y: event.clientY });\n\n const slot = slotRef.current;\n if (!slot) return;\n\n if (usePointerCapture) {\n // Safari/Firefox: Use pointer capture (no browser warning)\n pointerIdRef.current = event.pointerId;\n lastXRef.current = event.clientX;\n slot.setPointerCapture(event.pointerId);\n setIsScrubbing(true);\n } else {\n // Chrome: Use pointer lock for infinite movement\n lockedByMe.current = true;\n slot.requestPointerLock();\n }\n },\n [scrub, scrubValue],\n );\n\n // Handle pointer lock state changes (Chrome only). Only a scrub slot listens, and only a lock\n // this slot asked for starts or ends its scrub.\n React.useEffect(() => {\n if (usePointerCapture || !scrub) return;\n\n const handlePointerLockChange = () => {\n if (!lockedByMe.current) return;\n const isLocked = document.pointerLockElement === slotRef.current;\n setIsScrubbing(isLocked);\n if (!isLocked) {\n lockedByMe.current = false;\n // Fire callback with isChanging = false when scrubbing ends\n scrubConfigRef.current.onScrub?.(0, false);\n accumulatedMovement.current = 0;\n currentValue.current = 0;\n }\n };\n\n document.addEventListener('pointerlockchange', handlePointerLockChange);\n return () => {\n document.removeEventListener('pointerlockchange', handlePointerLockChange);\n };\n }, [scrub]);\n\n // Shared scrub calculation logic\n const processScrubMovement = React.useCallback((movementX: number, movementY: number, shiftKey: boolean, altKey: boolean) => {\n const config = scrubConfigRef.current;\n const viewportWidth = window.innerWidth;\n const viewportHeight = window.innerHeight;\n\n // Update virtual position with wrap-around at viewport edges\n virtualX.current += movementX;\n if (virtualX.current > viewportWidth) {\n virtualX.current = virtualX.current % viewportWidth;\n } else if (virtualX.current < 0) {\n virtualX.current = viewportWidth + (virtualX.current % viewportWidth);\n }\n\n // Also track Y with wrap-around\n let newY = virtualY.current + movementY;\n if (newY > viewportHeight) {\n newY = newY % viewportHeight;\n } else if (newY < 0) {\n newY = viewportHeight + (newY % viewportHeight);\n }\n virtualY.current = newY;\n\n const cursor = cursorRef.current;\n if (cursor) {\n cursor.style.left = `${virtualX.current}px`;\n cursor.style.top = `${newY}px`;\n }\n\n // Accumulate movement for sensitivity calculation\n accumulatedMovement.current += movementX;\n\n // Calculate how many steps we've moved\n const stepsFromMovement = accumulatedMovement.current / config.scrubSensitivity;\n\n if (Math.abs(stepsFromMovement) >= 1) {\n // Determine modifier multiplier\n let multiplier = 1;\n if (shiftKey) {\n multiplier = config.scrubShiftMultiplier;\n } else if (altKey) {\n multiplier = config.scrubAltMultiplier;\n }\n\n // Calculate delta\n const wholeSteps = Math.trunc(stepsFromMovement);\n const delta = wholeSteps * config.scrubStep * multiplier;\n\n // Apply min/max clamping if bounds are set\n let clampedDelta = delta;\n if (config.scrubMin !== undefined || config.scrubMax !== undefined) {\n const newValue = currentValue.current + delta;\n const clampedValue = Math.max(config.scrubMin ?? -Infinity, Math.min(config.scrubMax ?? Infinity, newValue));\n clampedDelta = clampedValue - currentValue.current;\n currentValue.current = clampedValue;\n } else {\n currentValue.current += delta;\n }\n\n // Fire callback with clamped delta (isChanging = true during drag)\n if (clampedDelta !== 0) {\n config.onScrub?.(clampedDelta, true);\n }\n\n // Keep the fractional remainder for smooth sub-pixel accumulation\n accumulatedMovement.current = (stepsFromMovement - wholeSteps) * config.scrubSensitivity;\n }\n }, []);\n\n // End scrubbing helper\n const endScrubbing = React.useCallback(() => {\n scrubConfigRef.current.onScrub?.(0, false);\n accumulatedMovement.current = 0;\n currentValue.current = 0;\n pointerIdRef.current = null;\n setIsScrubbing(false);\n }, []);\n\n // Handle pointer capture mode events (Safari/Firefox)\n const handlePointerMove = React.useCallback(\n (event: React.PointerEvent) => {\n if (!isScrubbing || !usePointerCapture) return;\n\n const movementX = event.clientX - lastXRef.current;\n lastXRef.current = event.clientX;\n\n processScrubMovement(movementX, event.movementY, event.shiftKey, event.altKey);\n },\n [isScrubbing, processScrubMovement],\n );\n\n const handlePointerUp = React.useCallback(\n (event: React.PointerEvent) => {\n if (!usePointerCapture || pointerIdRef.current !== event.pointerId) return;\n\n const slot = slotRef.current;\n if (slot && pointerIdRef.current !== null) {\n slot.releasePointerCapture(pointerIdRef.current);\n }\n endScrubbing();\n },\n [endScrubbing],\n );\n\n const handleLostPointerCapture = React.useCallback(() => {\n if (usePointerCapture && isScrubbing) {\n endScrubbing();\n }\n }, [isScrubbing, endScrubbing]);\n\n // Attach document-level listeners for pointer lock mode (Chrome)\n React.useEffect(() => {\n if (!isScrubbing || usePointerCapture) return;\n\n const handleMouseMove = (event: MouseEvent) => {\n processScrubMovement(event.movementX, event.movementY, event.shiftKey, event.altKey);\n };\n\n const handleMouseUp = () => {\n // Exit pointer lock to end scrubbing\n document.exitPointerLock();\n };\n\n // Use mousemove for pointer lock (pointermove doesn't work well with pointer lock)\n document.addEventListener('mousemove', handleMouseMove);\n document.addEventListener('mouseup', handleMouseUp);\n\n // Disable text selection during scrubbing\n document.body.style.userSelect = 'none';\n\n return () => {\n document.removeEventListener('mousemove', handleMouseMove);\n document.removeEventListener('mouseup', handleMouseUp);\n document.body.style.userSelect = '';\n };\n }, [isScrubbing, processScrubMovement]);\n\n // Hide native cursor and disable text selection during pointer capture scrubbing\n React.useEffect(() => {\n if (!isScrubbing || !usePointerCapture) return;\n\n // Create a style element to hide cursor globally during scrub\n const style = document.createElement('style');\n style.textContent = '* { cursor: none !important; user-select: none !important; }';\n document.head.appendChild(style);\n\n return () => {\n document.head.removeChild(style);\n };\n }, [isScrubbing]);\n\n // Render virtual cursor via portal to body so it's not clipped\n // Using a data URI of ew-resize cursor for a native look\n const virtualCursor = isScrubbing\n ? ReactDOM.createPortal(\n <img\n ref={cursorRef}\n className=\"kui-TextFieldSlotScrubCursor\"\n src=\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='black' stroke='white' stroke-width='1' d='M0 12 L5 7 L5 10 L19 10 L19 7 L24 12 L19 17 L19 14 L5 14 L5 17 Z'/%3E%3C/svg%3E\"\n alt=\"\"\n style={{\n position: 'fixed',\n left: cursorStart.x,\n top: cursorStart.y,\n transform: 'translate(-50%, -50%)',\n pointerEvents: 'none',\n zIndex: 99999,\n width: 24,\n height: 24,\n }}\n aria-hidden=\"true\"\n />,\n document.body,\n )\n : null;\n\n return (\n <div\n data-accent-color={color}\n data-side={side}\n data-scrub={scrub || undefined}\n data-scrubbing={isScrubbing || undefined}\n {...slotProps}\n id={slotId}\n ref={composeRefs(slotRef, forwardedRef)}\n className={classNames('kui-TextFieldSlot', className)}\n // The caller's handlers run first; the scrub handlers only when `scrub` is set.\n onPointerDown={scrub ? composeEventHandlers(onPointerDown, handlePointerDown) : onPointerDown}\n onPointerMove={scrub ? composeEventHandlers(onPointerMove, handlePointerMove) : onPointerMove}\n onPointerUp={scrub ? composeEventHandlers(onPointerUp, handlePointerUp) : onPointerUp}\n onLostPointerCapture={scrub ? composeEventHandlers(onLostPointerCapture, handleLostPointerCapture) : onLostPointerCapture}\n >\n {slotProps.children}\n {virtualCursor}\n </div>\n );\n});\nTextFieldSlot.displayName = 'TextField.Slot';\n\nexport { TextFieldRoot as Root, TextFieldSlot as Slot };\nexport type { TextFieldRootProps as RootProps, TextFieldSlotProps as SlotProps };\n"],
|
|
5
|
+
"mappings": ";4KAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,UAAAE,GAAA,SAAAC,KAEA,UAAYC,MAAW,QACvB,UAAYC,OAAc,YAC1B,OAAOC,OAAgB,aACvB,OAAS,wBAAAC,EAAsB,eAAAC,OAAmB,oBAqBlD,IAAMC,GAAyB,gBAA4C,IAAI,EAIzEC,GAAoB,2EAEpBC,GAAsB,aAAqD,CAACC,EAAUC,IAAiB,CAC3G,IAAMC,EAAQC,GAAkBH,EAAUI,GAAsB,IAAI,EAC9DC,EAAiB,SAAyB,IAAI,EAC9C,CAAE,SAAAC,EAAU,UAAAC,EAAW,MAAAC,EAAO,OAAAC,EAAQ,MAAAC,EAAO,GAAGC,CAAW,EAAIC,GAAaV,EAAOE,EAAqB,EAGxGS,EAAgB,QAAM,EAGtB,CAACC,EAASC,CAAU,EAAU,WAAmB,CAAC,CAAC,EACnDC,EAAqB,cAAaC,IACtCF,EAAYG,GAAUA,EAAK,SAASD,CAAE,EAAIC,EAAO,CAAC,GAAGA,EAAMD,CAAE,CAAE,EACxD,IAAMF,EAAYG,GAASA,EAAK,OAAQC,GAAWA,IAAWF,CAAE,CAAC,GACvE,CAAC,CAAC,EACCG,EAAqB,UAAQ,KAAO,CAAE,aAAAJ,CAAa,GAAI,CAACA,CAAY,CAAC,EAErE,CAAE,mBAAoBK,EAAiB,kBAAmBC,EAAgB,eAAgBC,CAAY,EAAIZ,EAG1Ga,EAAY,EAAQb,EAAW,OAAU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M/B,EAAQ,SAAS,cAAc,OAAO,EAC5C,OAAAA,EAAM,YAAc,+DACpB,SAAS,KAAK,YAAYA,CAAK,EAExB,IAAM,CACX,SAAS,KAAK,YAAYA,CAAK,CACjC,CACF,EAAG,CAACuD,CAAW,CAAC,EAIhB,IAAMwC,GAAgBxC,EACT,gBACP,gBAAC,OACC,IAAKI,EACL,UAAU,+BACV,IAAI,oPACJ,IAAI,GACJ,MAAO,CACL,SAAU,QACV,KAAMF,EAAY,EAClB,IAAKA,EAAY,EACjB,UAAW,wBACX,cAAe,OACf,OAAQ,MACR,MAAO,GACP,OAAQ,EACV,EACA,cAAY,OACd,EACA,SAAS,IACX,EACA,KAEJ,OACE,gBAAC,OACC,oBAAmB3D,EACnB,YAAWgD,EACX,aAAYV,GAAS,OACrB,iBAAgBmB,GAAe,OAC9B,GAAGJ,EACJ,GAAI1C,EACJ,IAAKqB,GAAYwB,EAAS/D,CAAY,EACtC,UAAWsC,GAAW,oBAAqBhC,CAAS,EAEpD,cAAeuC,EAAQ4D,EAAqBjD,EAAeqB,EAAiB,EAAIrB,EAChF,cAAeX,EAAQ4D,EAAqBhD,EAAe0C,EAAiB,EAAI1C,EAChF,YAAaZ,EAAQ4D,EAAqB/C,EAAa0C,EAAe,EAAI1C,EAC1E,qBAAsBb,EAAQ4D,EAAqB9C,EAAsB0C,EAAwB,EAAI1C,GAEpGC,EAAU,SACV4C,EACH,CAEJ,CAAC,EACD5D,GAAc,YAAc",
|
|
6
|
+
"names": ["text_field_exports", "__export", "TextFieldRoot", "TextFieldSlot", "React", "ReactDOM", "classNames", "composeEventHandlers", "composeRefs", "TextFieldContext", "FOCUSABLE_IN_SLOT", "TextFieldRoot", "ownProps", "forwardedRef", "props", "useThemeSizeProps", "textFieldRootPropDefs", "inputRef", "children", "className", "color", "radius", "style", "inputProps", "extractProps", "errorId", "slotIds", "setSlotIds", "registerSlot", "id", "prev", "slotId", "contextValue", "ariaDescribedby", "ariaLabelledby", "ariaInvalid", "isInvalid", "describedBy", "parts", "ariaProps", "error", "errorMessage", "required", "_ariaDescribedby", "_ariaLabelledby", "nativeInputProps", "handleMouseDown", "event", "target", "input", "cursorPosition", "classNames", "composeRefs", "usePointerCapture", "ua", "isSafari", "isFirefox", "TextFieldSlot", "scrub", "scrubValue", "scrubStep", "scrubSensitivity", "scrubMin", "scrubMax", "scrubShiftMultiplier", "scrubAltMultiplier", "onScrub", "restProps", "side", "onPointerDown", "onPointerMove", "onPointerUp", "onLostPointerCapture", "slotProps", "textFieldSlotPropDefs", "generatedId", "slotRef", "isScrubbing", "setIsScrubbing", "cursorStart", "setCursorStart", "cursorRef", "virtualY", "lockedByMe", "accumulatedMovement", "currentValue", "virtualX", "pointerIdRef", "lastXRef", "scrubConfigRef", "handlePointerDown", "slot", "handlePointerLockChange", "isLocked", "processScrubMovement", "movementX", "movementY", "shiftKey", "altKey", "config", "viewportWidth", "viewportHeight", "newY", "cursor", "stepsFromMovement", "multiplier", "wholeSteps", "delta", "clampedDelta", "newValue", "clampedValue", "endScrubbing", "handlePointerMove", "handlePointerUp", "handleLostPointerCapture", "handleMouseMove", "handleMouseUp", "virtualCursor", "composeEventHandlers"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{a as c,c as N,e as M,g as w}from"./chunk-XUCR7L4G.js";import{a as R,d}from"./chunk-3QWGSRYC.js";import{a as v,b as y,c as x}from"./chunk-VVBSYWUA.js";import{o as b}from"./chunk-GHWEXMF6.js";import{a as O,b as E,c as T}from"./chunk-QKCNGEX4.js";import{a as C}from"./chunk-WEBNIUEX.js";import{a as S}from"./chunk-G66WDIIV.js";import*as e from"react";import ie from"classnames";import{useComposedRefs as le}from"radix-ui/internal";var pe={controlled:"open",default:"defaultOpen"},de={initial:"overlay",sm:"fixed"},H=e.forwardRef((U,k)=>{let{className:A,presentation:B=de,defaultOpen:V,open:L,onOpenChange:_,expandedSize:o=320,minSize:t=200,maxSize:s=500,resizable:m=!1,collapsible:D=!0,onExpand:$,onCollapse:q,onResize:F,onResizeStart:W,onResizeEnd:j,snapPoints:r,snapTolerance:G,collapseThreshold:a,paneId:i,persistence:l,children:K,style:J,onSizeChange:Q,sizeUpdate:X,sizeUpdateMs:Y=50,size:u,defaultSize:P,inset:f,id:Z,...p}=U,{table:z,attributes:ee}=x(B,"fixed"),n=v({name:"inspector",label:"Inspector",propNames:pe,id:Z,controlled:c(L),defaultValue:c(V),presentationTable:z,builtIn:N,onChange:(re,ae)=>_?.(re!=="closed",{reason:ae}),onExpand:$,onCollapse:q,size:o});b("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),ne=le(k,n.setElement,h),oe=E({name:"inspector",elementId:n.id,elementRef:h,cssVarName:"--inspector-size",orientation:"vertical",edge:"start",growth:M,expandedSize:o,minSize:t,maxSize:s,resizable:m,collapsible:D,size:u,defaultSize:P,onSizeChange:Q,sizeUpdate:X,sizeUpdateMs:Y,onResize:F,onResizeStart:W,onResizeEnd:j,snapPoints:r,snapTolerance:G,collapseThreshold:a,paneId:i,persistence:l,overlaying:n.overlaying,overlayingNow:()=>z[S()]==="overlay",requestCollapse:()=>n.setValue("closed","toggle"),requestToggle:()=>n.toggle("toggle")}),{handles:I,content:te}=T(K,d),se=m&&n.shown!==!1&&!n.overlaying?e.createElement(C.Provider,{value:oe},I.length>0?I:e.createElement(R,null)):null,g=O(u,P,t,s);return e.createElement("div",{...w(p),role:p.role??"complementary",id:n.id,ref:ne,className:ie("kui-ShellPane","kui-ShellInspector",A),...y(n,ee),"data-inset":f||void 0,tabIndex:n.overlaying?-1:p.tabIndex,style:{...J,"--inspector-expanded-size":`${o}px`,...g?{"--inspector-size":g}:{},"--inspector-min-size":`${t}px`,"--inspector-max-size":`${s}px`}},e.createElement("div",{className:"kui-ShellInspectorContent"},te),se)});H.displayName="Shell.Inspector";H.Handle=d;export{H as a};
|
|
3
|
+
//# sourceMappingURL=chunk-AQ7VUGQQ.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/components/_internal/shell-inspector.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { useComposedRefs } from 'radix-ui/internal';\nimport { PaneResizeContext } from './shell-resize.js';\nimport { InspectorHandle, PaneHandle } from './shell-handles.js';\nimport { usePane, paneAttributes, usePresentationTable } from './shell-pane.js';\nimport { splitHandles, useInitialPaneSize, useResizablePane, type SizeChangeMeta } from './shell-resizable.js';\nimport { useInsetRegistration, warnOnce } from './shell-store.js';\nimport { detailRest, endAnchoredGrowth, toPaneValue, withoutRemovedPaneProps } from './shell-rest.js';\nimport { readBreakpoint } from '../../hooks/use-breakpoint.js';\nimport type { Breakpoint, CSSPropertiesWithVars, PaneBaseProps } from '../shell.types.js';\n\ntype InspectorOpenChangeMeta = { reason: 'init' | 'toggle' | 'responsive' | 'dismiss' };\ntype InspectorControlledProps = { open: boolean | Partial<Record<Breakpoint, boolean>>; onOpenChange?: (open: boolean, meta: InspectorOpenChangeMeta) => void; defaultOpen?: never };\ntype InspectorUncontrolledProps = { defaultOpen?: boolean | Partial<Record<Breakpoint, boolean>>; onOpenChange?: (open: boolean, meta: InspectorOpenChangeMeta) => void; open?: never };\ntype InspectorSizeControlledProps = { size: number | string; defaultSize?: never };\ntype InspectorSizeUncontrolledProps = { defaultSize?: number | string; size?: never };\ntype InspectorPublicProps = PaneBaseProps &\n (InspectorControlledProps | InspectorUncontrolledProps) &\n (InspectorSizeControlledProps | InspectorSizeUncontrolledProps) & {\n onSizeChange?: (size: number, meta: SizeChangeMeta) => void;\n sizeUpdate?: 'throttle' | 'debounce';\n sizeUpdateMs?: number;\n /** When true, adds margin and triggers the gray backdrop on the Shell. */\n inset?: boolean;\n };\n\ntype InspectorComponent = React.ForwardRefExoticComponent<InspectorPublicProps & React.RefAttributes<HTMLDivElement>> & { Handle: typeof InspectorHandle };\n\nconst INSPECTOR_PROP_NAMES = { controlled: 'open', default: 'defaultOpen' };\n\n/** Since 0.8.0 the Inspector is in the frame from 768px up, the boundary kookie-ui-v2 uses everywhere. It was 1280px. */\nconst INSPECTOR_DEFAULT_PRESENTATION = { initial: 'overlay', sm: 'fixed' } as const;\n\nexport const Inspector = React.forwardRef<HTMLDivElement, InspectorPublicProps>((props, ref) => {\n const {\n className,\n presentation = INSPECTOR_DEFAULT_PRESENTATION,\n defaultOpen,\n open,\n onOpenChange,\n expandedSize = 320,\n minSize = 200,\n maxSize = 500,\n resizable = false,\n collapsible = true,\n onExpand,\n onCollapse,\n onResize,\n onResizeStart,\n onResizeEnd,\n snapPoints,\n snapTolerance,\n collapseThreshold,\n paneId,\n persistence,\n children,\n style,\n onSizeChange,\n sizeUpdate,\n sizeUpdateMs = 50,\n size,\n defaultSize,\n inset,\n id,\n ...domProps\n } = props;\n\n const { table, attributes } = usePresentationTable(presentation, 'fixed');\n const pane = usePane({\n name: 'inspector',\n label: 'Inspector',\n propNames: INSPECTOR_PROP_NAMES,\n id,\n controlled: toPaneValue(open),\n defaultValue: toPaneValue(defaultOpen),\n presentationTable: table,\n builtIn: detailRest,\n onChange: (value, reason) => onOpenChange?.(value !== 'closed', { reason }),\n onExpand,\n onCollapse,\n size: expandedSize,\n });\n useInsetRegistration('inspector', inset);\n\n React.useEffect(() => {\n if (snapPoints !== undefined || collapseThreshold !== undefined || paneId !== undefined || persistence !== undefined) {\n warnOnce('Shell.Inspector: `snapPoints`, `collapseThreshold`, `paneId` and `persistence` are deprecated and are removed in 1.0. Keep the size in your own state with `size`/`onSizeChange`.');\n }\n }, [snapPoints, collapseThreshold, paneId, persistence]);\n\n const elementRef = React.useRef<HTMLElement | null>(null);\n const composedRef = useComposedRefs(ref, pane.setElement, elementRef);\n\n const resize = useResizablePane({\n name: 'inspector',\n elementId: pane.id,\n elementRef,\n cssVarName: '--inspector-size',\n orientation: 'vertical',\n edge: 'start',\n growth: endAnchoredGrowth,\n expandedSize,\n minSize,\n maxSize,\n resizable,\n collapsible,\n size,\n defaultSize,\n onSizeChange,\n sizeUpdate,\n sizeUpdateMs,\n onResize,\n onResizeStart,\n onResizeEnd,\n snapPoints,\n snapTolerance,\n collapseThreshold,\n paneId,\n persistence,\n overlaying: pane.overlaying,\n overlayingNow: () => table[readBreakpoint()] === 'overlay',\n requestCollapse: () => pane.setValue('closed', 'toggle'),\n requestToggle: () => pane.toggle('toggle'),\n });\n\n const { handles, content } = splitHandles(children, InspectorHandle);\n const handle = resizable && pane.shown !== false && !pane.overlaying ? <PaneResizeContext.Provider value={resize}>{handles.length > 0 ? handles : <PaneHandle />}</PaneResizeContext.Provider> : null;\n\n const initialSize = useInitialPaneSize(size, defaultSize, minSize, maxSize);\n return (\n <div\n {...withoutRemovedPaneProps(domProps)}\n role={domProps.role ?? 'complementary'}\n id={pane.id}\n ref={composedRef}\n className={classNames('kui-ShellPane', 'kui-ShellInspector', className)}\n {...paneAttributes(pane, attributes)}\n data-inset={inset || undefined}\n tabIndex={pane.overlaying ? -1 : domProps.tabIndex}\n style={\n {\n ...style,\n '--inspector-expanded-size': `${expandedSize}px`,\n ...(initialSize ? { '--inspector-size': initialSize } : {}),\n '--inspector-min-size': `${minSize}px`,\n '--inspector-max-size': `${maxSize}px`,\n } as CSSPropertiesWithVars\n }\n >\n <div className=\"kui-ShellInspectorContent\">{content}</div>\n {handle}\n </div>\n );\n}) as InspectorComponent;\n\nInspector.displayName = 'Shell.Inspector';\nInspector.Handle = InspectorHandle;\n\nexport type { InspectorPublicProps };\n"],
|
|
5
|
+
"mappings": ";2UAEA,UAAYA,MAAW,QACvB,OAAOC,OAAgB,aACvB,OAAS,mBAAAC,OAAuB,oBA2BhC,IAAMC,GAAuB,CAAE,WAAY,OAAQ,QAAS,aAAc,EAGpEC,GAAiC,CAAE,QAAS,UAAW,GAAI,OAAQ,EAE5DC,EAAkB,aAAiD,CAACC,EAAOC,I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"className", "presentation", "defaultOpen", "open", "onOpenChange", "expandedSize", "minSize", "maxSize", "resizable", "collapsible", "onExpand", "onCollapse", "onResize", "onResizeStart", "onResizeEnd", "snapPoints", "snapTolerance", "collapseThreshold", "paneId", "persistence", "children", "style", "onSizeChange", "sizeUpdate", "sizeUpdateMs", "size", "defaultSize", "inset", "id", "domProps", "table", "attributes", "usePresentationTable", "pane", "usePane", "toPaneValue", "detailRest", "value", "reason", "useInsetRegistration", "elementRef", "composedRef", "useComposedRefs", "resize", "useResizablePane", "endAnchoredGrowth", "readBreakpoint", "handles", "content", "splitHandles", "InspectorHandle", "handle", "PaneResizeContext", "PaneHandle", "initialSize", "useInitialPaneSize", "withoutRemovedPaneProps", "classNames", "paneAttributes"]
|
|
7
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{a as p,b as l,c as f,d as R,e as g}from"./chunk-DVXDFCCV.js";import{c as P}from"./chunk-GKDGNPBD.js";import{c as m}from"./chunk-5KMEUZWN.js";import{c as A}from"./chunk-
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
2
|
+
import{a as p,b as l,c as f,d as R,e as g}from"./chunk-DVXDFCCV.js";import{c as P}from"./chunk-GKDGNPBD.js";import{c as m}from"./chunk-5KMEUZWN.js";import{c as A}from"./chunk-5ON3XLRD.js";import{c as i}from"./chunk-OKQAVYW4.js";import{a as w}from"./chunk-VQPANPMI.js";var H={};w(H,{Content:()=>I,Header:()=>u,Item:()=>y,Root:()=>C,Trigger:()=>v});import*as o from"react";import s from"classnames";import{Accordion as d}from"radix-ui";var C=o.forwardRef((r,e)=>{let c=A(r,p.size),{className:t,radius:n,color:N,...T}=i(c,p),a=T;return a.type==="single"&&a.collapsible===void 0&&(a.collapsible=!0),o.createElement(d.Root,{...a,ref:e,className:s("kui-AccordionRoot",t),"data-accent-color":N,"data-radius":n})});C.displayName="Accordion.Root";var y=o.forwardRef((r,e)=>{let{className:c,...t}=i(r,l);return o.createElement(d.Item,{...t,ref:e,className:s("kui-AccordionItem",c)})});y.displayName="Accordion.Item";var u=o.forwardRef((r,e)=>{let{className:c,...t}=i(r,f);return o.createElement(d.Header,{...t,ref:e,className:s("kui-AccordionHeader",c)})});u.displayName="Accordion.Header";var v=o.forwardRef(({children:r,...e},c)=>{let{className:t,...n}=i(e,R);return o.createElement(d.Trigger,{...n,ref:c,className:s("kui-AccordionTrigger",t)},o.createElement(m,null,r),o.createElement(P,{className:"kui-AccordionChevron","aria-hidden":!0}))});v.displayName="Accordion.Trigger";var I=o.forwardRef((r,e)=>{let{className:c,children:t,...n}=i(r,g);return o.createElement(d.Content,{...n,ref:e,className:s("kui-AccordionContent",c)},o.createElement("div",{className:"kui-AccordionContentInner"},t))});I.displayName="Accordion.Content";export{C as a,y as b,u as c,v as d,I as e,H as f};
|
|
3
|
+
//# sourceMappingURL=chunk-BVFHJP5E.js.map
|