@womp/kookie-ui 0.25.0 → 0.25.1
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 +5 -2
- 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.tsx +1 -1
- 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 +7 -2
- 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
|
@@ -23,7 +23,7 @@ import classNames from 'classnames';
|
|
|
23
23
|
|
|
24
24
|
import { Button } from './button.js';
|
|
25
25
|
import { Text } from './text.js';
|
|
26
|
-
import { ThemeSizeContext, useThemeSize } from '../
|
|
26
|
+
import { ThemeSizeContext, useThemeSize } from '../hooks/theme-size.js';
|
|
27
27
|
import { accentColorPropDef } from '../props/color.prop.js';
|
|
28
28
|
|
|
29
29
|
type NoticeSize = '1' | '2' | '3' | '4';
|
|
@@ -35,16 +35,18 @@
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
.kui-PopoverToolbarSection {
|
|
38
|
+
/* Each section owns a column on the one row, whichever sections are present and in any order. */
|
|
39
|
+
grid-row: 1;
|
|
38
40
|
display: flex;
|
|
39
41
|
align-items: center;
|
|
40
42
|
gap: var(--space-3);
|
|
41
43
|
}
|
|
42
44
|
|
|
43
|
-
.kui-PopoverToolbarLeft { justify-self: start; }
|
|
45
|
+
.kui-PopoverToolbarLeft { grid-column: 1; justify-self: start; }
|
|
44
46
|
|
|
45
47
|
.kui-PopoverToolbarCenter { grid-column: 2; justify-self: center; min-width: 0; text-align: center; }
|
|
46
48
|
|
|
47
|
-
.kui-PopoverToolbarRight { justify-self: end; }
|
|
49
|
+
.kui-PopoverToolbarRight { grid-column: 3; justify-self: end; }
|
|
48
50
|
|
|
49
51
|
.kui-PopoverToolbarTitle {
|
|
50
52
|
display: inline-block;
|
|
@@ -3,7 +3,7 @@ import classNames from 'classnames';
|
|
|
3
3
|
import { Popover as PopoverPrimitive } from 'radix-ui';
|
|
4
4
|
|
|
5
5
|
import { extractProps } from '../helpers/extract-props.js';
|
|
6
|
-
import { useThemeSizeProps } from '../
|
|
6
|
+
import { useThemeSizeProps } from '../hooks/theme-size.js';
|
|
7
7
|
import { requireReactElement } from '../helpers/require-react-element.js';
|
|
8
8
|
import { popoverContentPropDefs } from './popover.props.js';
|
|
9
9
|
import { Theme } from './theme.js';
|
|
@@ -8,7 +8,7 @@ import { RadioGroup as RadioGroupPrimitive } from 'radix-ui';
|
|
|
8
8
|
import { radioGroupRootPropDefs } from './radio-group.props.js';
|
|
9
9
|
import { Text } from './text.js';
|
|
10
10
|
import { extractProps } from '../helpers/extract-props.js';
|
|
11
|
-
import { useThemeSize } from '../
|
|
11
|
+
import { useThemeSize } from '../hooks/theme-size.js';
|
|
12
12
|
|
|
13
13
|
import type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';
|
|
14
14
|
import type { GetPropDefTypes } from '../props/prop-def.js';
|
package/src/components/radio.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import { composeEventHandlers } from 'radix-ui/internal';
|
|
|
6
6
|
|
|
7
7
|
import { radioPropDefs } from './radio.props.js';
|
|
8
8
|
import { extractProps } from '../helpers/extract-props.js';
|
|
9
|
-
import { useThemeSizeProps } from '../
|
|
9
|
+
import { useThemeSizeProps } from '../hooks/theme-size.js';
|
|
10
10
|
|
|
11
11
|
import type { ComponentPropsWithout } from '../helpers/component-props.js';
|
|
12
12
|
import type { NotInputRadioAttributes } from '../helpers/input-attributes.js';
|
|
@@ -7,7 +7,7 @@ import { useComposedRefs, useControllableState, useLayoutEffect } from 'radix-ui
|
|
|
7
7
|
|
|
8
8
|
import { segmentedControlRootPropDefs } from './segmented-control.props.js';
|
|
9
9
|
import { extractProps } from '../helpers/extract-props.js';
|
|
10
|
-
import { useThemeSizeProps } from '../
|
|
10
|
+
import { useThemeSizeProps } from '../hooks/theme-size.js';
|
|
11
11
|
|
|
12
12
|
import type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';
|
|
13
13
|
import type { GetPropDefTypes } from '../props/prop-def.js';
|
|
@@ -5,7 +5,7 @@ import classNames from 'classnames';
|
|
|
5
5
|
import { Select as SelectPrimitive, ScrollArea as ScrollAreaPrimitive } from 'radix-ui';
|
|
6
6
|
|
|
7
7
|
import { extractProps } from '../helpers/extract-props.js';
|
|
8
|
-
import { useThemeSize } from '../
|
|
8
|
+
import { useThemeSize } from '../hooks/theme-size.js';
|
|
9
9
|
import { ChevronDownIcon, ThickCheckIcon } from './icons.js';
|
|
10
10
|
import { Spinner } from './spinner.js';
|
|
11
11
|
import {
|
package/src/components/sheet.css
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
:where(
|
|
1
|
+
/* The class sits outside :where() so the 90vw default outranks the dialog's width: 100% in
|
|
2
|
+
base-dialog.css (same weight, later in the cascade). The width prop sets --width. */
|
|
3
|
+
.kui-SheetContent {
|
|
2
4
|
position: fixed !important;
|
|
3
5
|
/* Use physical properties to integrate with width/height responsive utilities */
|
|
4
6
|
width: var(--width, 90vw);
|
|
@@ -11,7 +13,7 @@
|
|
|
11
13
|
|
|
12
14
|
/* iOS dynamic viewport height - accounts for browser chrome */
|
|
13
15
|
@supports (height: 100dvh) {
|
|
14
|
-
|
|
16
|
+
.kui-SheetContent {
|
|
15
17
|
height: 100dvh;
|
|
16
18
|
max-height: 100dvh;
|
|
17
19
|
}
|
package/src/components/sheet.tsx
CHANGED
|
@@ -42,7 +42,7 @@ import { Theme } from './theme.js';
|
|
|
42
42
|
import { Heading } from './heading.js';
|
|
43
43
|
import { Text } from './text.js';
|
|
44
44
|
import { extractProps } from '../helpers/extract-props.js';
|
|
45
|
-
import { useThemeSizeProps } from '../
|
|
45
|
+
import { useThemeSizeProps } from '../hooks/theme-size.js';
|
|
46
46
|
import { requireReactElement } from '../helpers/require-react-element.js';
|
|
47
47
|
import { useBodyPointerEventsCleanup } from '../hooks/use-body-pointer-events-cleanup.js';
|
|
48
48
|
|
package/src/components/shell.tsx
CHANGED
|
@@ -51,7 +51,7 @@ import { navigationRest, detailRest, toPaneValue, startAnchoredGrowth, withoutRe
|
|
|
51
51
|
import { useShell, useSidebarMode } from './shell.context.js';
|
|
52
52
|
import { useResponsivePresentation } from './shell.hooks.js';
|
|
53
53
|
import { readBreakpoint } from '../hooks/use-breakpoint.js';
|
|
54
|
-
import { useThemeSize } from '../
|
|
54
|
+
import { useThemeSize } from '../hooks/theme-size.js';
|
|
55
55
|
import { PaneChromeScope, PaneFooter, PaneHeader, Scroll, ShellContentContext, ShellSizeContext } from './_internal/pane-chrome.js';
|
|
56
56
|
import type { PaneSize, PaneHeaderProps, PaneFooterProps, ScrollProps } from './_internal/pane-chrome.js';
|
|
57
57
|
import type { Breakpoint, CSSPropertiesWithVars, PaneBaseProps, PaneMode, PaneName, PaneTarget, ResponsivePresentation, SidebarMode } from './shell.types.js';
|
|
@@ -333,6 +333,18 @@ function toDropdownItem(node: React.ReactNode, key: React.Key): React.ReactNode
|
|
|
333
333
|
return <DropdownMenu.Item key={key}>{node}</DropdownMenu.Item>;
|
|
334
334
|
}
|
|
335
335
|
|
|
336
|
+
// The sub-list is a <ul>, so each row needs its own <li>. A MenuButton written straight into
|
|
337
|
+
// MenuSubContent gets a MenuItem around it, rather than leaving an <a> or <button> in the list.
|
|
338
|
+
function wrapBareMenuButtons(children: React.ReactNode): React.ReactNode {
|
|
339
|
+
return React.Children.map(children, (child, index) =>
|
|
340
|
+
React.isValidElement(child) && child.type === SidebarMenuButton ? (
|
|
341
|
+
<SidebarMenuItem key={child.key ?? index}>{child}</SidebarMenuItem>
|
|
342
|
+
) : (
|
|
343
|
+
child
|
|
344
|
+
),
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
|
|
336
348
|
const SidebarMenuSubContent = React.forwardRef<React.ElementRef<typeof Accordion.Content>, SidebarMenuSubContentProps>(({ className, children, ...props }, forwardedRef) => {
|
|
337
349
|
const visual = useSidebarVisual();
|
|
338
350
|
const mode = React.useContext(SidebarSubMenuModeContext);
|
|
@@ -360,7 +372,7 @@ const SidebarMenuSubContent = React.forwardRef<React.ElementRef<typeof Accordion
|
|
|
360
372
|
|
|
361
373
|
return (
|
|
362
374
|
<Accordion.Content {...props} ref={forwardedRef} className={classNames('kui-SidebarMenuSubContent', className)}>
|
|
363
|
-
<ul className="kui-SidebarMenuSubList">{children}</ul>
|
|
375
|
+
<ul className="kui-SidebarMenuSubList">{wrapBareMenuButtons(children)}</ul>
|
|
364
376
|
</Accordion.Content>
|
|
365
377
|
);
|
|
366
378
|
});
|
|
@@ -473,6 +485,9 @@ const SidebarSearch = React.forwardRef<HTMLDivElement, SidebarSearchProps>(
|
|
|
473
485
|
// Arrow key navigation within the popover (input ↔ results)
|
|
474
486
|
const handlePopoverKeyDown = React.useCallback(
|
|
475
487
|
(e: React.KeyboardEvent<HTMLDivElement>) => {
|
|
488
|
+
// A result row already moved focus with its own arrow handling (focusAdjacentSidebarButton
|
|
489
|
+
// scopes to this popover); moving again would skip a row.
|
|
490
|
+
if (e.defaultPrevented) return;
|
|
476
491
|
const container = popoverRef.current;
|
|
477
492
|
if (!container) return;
|
|
478
493
|
|
|
@@ -4,7 +4,7 @@ import { Direction, Slider as SliderPrimitive } from 'radix-ui';
|
|
|
4
4
|
|
|
5
5
|
import { sliderPropDefs } from './slider.props.js';
|
|
6
6
|
import { extractProps } from '../helpers/extract-props.js';
|
|
7
|
-
import { useThemeSizeProps } from '../
|
|
7
|
+
import { useThemeSizeProps } from '../hooks/theme-size.js';
|
|
8
8
|
|
|
9
9
|
import type { ComponentPropsWithout } from '../helpers/component-props.js';
|
|
10
10
|
import type { GetPropDefTypes } from '../props/prop-def.js';
|
|
@@ -3,7 +3,7 @@ import classNames from 'classnames';
|
|
|
3
3
|
import { Switch as SwitchPrimitive } from 'radix-ui';
|
|
4
4
|
|
|
5
5
|
import { extractProps } from '../helpers/extract-props.js';
|
|
6
|
-
import { useThemeSizeProps } from '../
|
|
6
|
+
import { useThemeSizeProps } from '../hooks/theme-size.js';
|
|
7
7
|
import { switchPropDefs } from './switch.props.js';
|
|
8
8
|
|
|
9
9
|
import type { GetPropDefTypes } from '../props/prop-def.js';
|
package/src/components/table.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import classNames from 'classnames';
|
|
|
3
3
|
|
|
4
4
|
import { tableRootPropDefs, tableRowPropDefs, tableCellPropDefs } from './table.props.js';
|
|
5
5
|
import { extractProps } from '../helpers/extract-props.js';
|
|
6
|
-
import { useThemeSizeProps } from '../
|
|
6
|
+
import { useThemeSizeProps } from '../hooks/theme-size.js';
|
|
7
7
|
import { getResponsiveClassNames } from '../helpers/get-responsive-styles.js';
|
|
8
8
|
import { ScrollArea } from './scroll-area.js';
|
|
9
9
|
|
package/src/components/tabs.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { Tabs as TabsPrimitive } from 'radix-ui';
|
|
|
4
4
|
|
|
5
5
|
import { tabsListPropDefs } from './tabs.props.js';
|
|
6
6
|
import { extractProps } from '../helpers/extract-props.js';
|
|
7
|
-
import { useThemeSizeProps } from '../
|
|
7
|
+
import { useThemeSizeProps } from '../hooks/theme-size.js';
|
|
8
8
|
|
|
9
9
|
import type { tabsContentPropDefs, tabsRootPropDefs } from './tabs.props.js';
|
|
10
10
|
import type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';
|
|
@@ -3,7 +3,7 @@ import classNames from 'classnames';
|
|
|
3
3
|
|
|
4
4
|
import { textAreaPropDefs } from './text-area.props.js';
|
|
5
5
|
import { extractProps } from '../helpers/extract-props.js';
|
|
6
|
-
import { useThemeSizeProps } from '../
|
|
6
|
+
import { useThemeSizeProps } from '../hooks/theme-size.js';
|
|
7
7
|
|
|
8
8
|
import type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';
|
|
9
9
|
import type { GetPropDefTypes } from '../props/prop-def.js';
|
|
@@ -7,7 +7,7 @@ import { composeEventHandlers, composeRefs } from 'radix-ui/internal';
|
|
|
7
7
|
|
|
8
8
|
import { textFieldRootPropDefs, textFieldSlotPropDefs, type TextFieldSlotScrubProps } from './text-field.props.js';
|
|
9
9
|
import { extractProps } from '../helpers/extract-props.js';
|
|
10
|
-
import { useThemeSizeProps } from '../
|
|
10
|
+
import { useThemeSizeProps } from '../hooks/theme-size.js';
|
|
11
11
|
|
|
12
12
|
import type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';
|
|
13
13
|
import type { NotInputTextualAttributes } from '../helpers/input-attributes.js';
|
package/src/components/theme.tsx
CHANGED
|
@@ -5,7 +5,7 @@ import classNames from 'classnames';
|
|
|
5
5
|
import { Direction, Slot } from 'radix-ui';
|
|
6
6
|
|
|
7
7
|
import { getMatchingGrayColor } from '../helpers/get-matching-gray-color.js';
|
|
8
|
-
import { ThemeSizeContext } from '../
|
|
8
|
+
import { ThemeSizeContext } from '../hooks/theme-size.js';
|
|
9
9
|
import { usePropSyncedState } from '../hooks/use-prop-synced-state.js';
|
|
10
10
|
import { themePropDefs } from './theme.props.js';
|
|
11
11
|
|
|
@@ -10,7 +10,7 @@ import { Button } from './button.js';
|
|
|
10
10
|
import * as DropdownMenu from './dropdown-menu.js';
|
|
11
11
|
import { Text } from './text.js';
|
|
12
12
|
import { extractProps } from '../helpers/extract-props.js';
|
|
13
|
-
import { useThemeSize } from '../
|
|
13
|
+
import { useThemeSize } from '../hooks/theme-size.js';
|
|
14
14
|
import { layoutPropDefs } from '../props/layout.props.js';
|
|
15
15
|
import { usePaneBandSize } from './_internal/pane-chrome.js';
|
|
16
16
|
|
|
@@ -197,6 +197,9 @@ type ToolbarIconButtonProps = Omit<ToolbarButtonBaseProps, 'aria-label' | 'aria-
|
|
|
197
197
|
|
|
198
198
|
type ToolbarButtonProps = ToolbarTextButtonProps | ToolbarIconButtonProps;
|
|
199
199
|
|
|
200
|
+
/** The plain DOM props, besides handlers, ARIA and data attributes, a menu row takes from a ToolbarButton. */
|
|
201
|
+
const OVERFLOW_ITEM_KEYS = new Set(['id', 'className', 'style', 'title']);
|
|
202
|
+
|
|
200
203
|
function isPressed(value: React.AriaAttributes['aria-pressed']) {
|
|
201
204
|
return value === true || value === 'true';
|
|
202
205
|
}
|
|
@@ -231,15 +234,21 @@ const ToolbarButton = React.forwardRef<HTMLButtonElement, ToolbarButtonProps>((p
|
|
|
231
234
|
const off = disabled || group?.disabled || undefined;
|
|
232
235
|
|
|
233
236
|
if (overflow) {
|
|
237
|
+
// Only what a menu row means comes across: handlers, ARIA, data attributes, id, class and
|
|
238
|
+
// style. Button's box props (size, loading, tooltip, fullWidth and the rest) would land on the
|
|
239
|
+
// DOM as unknown attributes. A wrapping menu trigger hands its open handlers (onPointerDown,
|
|
240
|
+
// onKeyDown), aria-expanded/haspopup/controls and data-state in through these, so it still
|
|
241
|
+
// opens from the row.
|
|
242
|
+
const passed: Record<string, unknown> = {};
|
|
243
|
+
for (const key of Object.keys(rest)) {
|
|
244
|
+
if (/^on[A-Z]/.test(key) || key.startsWith('aria-') || key.startsWith('data-') || OVERFLOW_ITEM_KEYS.has(key)) {
|
|
245
|
+
passed[key] = (rest as Record<string, unknown>)[key];
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
if (onKeyDown) passed.onKeyDown = onKeyDown;
|
|
234
249
|
return (
|
|
235
250
|
<ToolbarOverflowItem
|
|
236
|
-
|
|
237
|
-
// tooltip, fullWidth and the rest) would land on the DOM as unknown attributes.
|
|
238
|
-
id={rest.id}
|
|
239
|
-
className={rest.className}
|
|
240
|
-
style={rest.style}
|
|
241
|
-
onClick={rest.onClick as React.MouseEventHandler<HTMLDivElement> | undefined}
|
|
242
|
-
aria-label={rest['aria-label']}
|
|
251
|
+
{...(passed as React.ComponentPropsWithoutRef<'div'>)}
|
|
243
252
|
ref={forwardedRef as unknown as React.Ref<HTMLDivElement>}
|
|
244
253
|
asChild={asChild}
|
|
245
254
|
iconOnly={iconOnly}
|
package/src/helpers/index.ts
CHANGED
|
@@ -14,3 +14,6 @@ export * from './merge-styles.js';
|
|
|
14
14
|
export * from './normalize-to-px.js';
|
|
15
15
|
export * from './require-react-element.js';
|
|
16
16
|
export * from './theme-size.js';
|
|
17
|
+
// The context and its hooks are client code. The server-safe build keeps this import external, so
|
|
18
|
+
// `/helpers` shares the one context the components read and stays loadable from a server component.
|
|
19
|
+
export { ThemeSizeContext, useThemeSize, useThemeSizeProps } from '../hooks/theme-size.js';
|
|
@@ -1,26 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The pure half of the theme size: the type, the default and the clamp. Server-safe.
|
|
3
|
+
*
|
|
4
|
+
* The context and the hooks that read it live in `hooks/theme-size.ts`, a client module, so there
|
|
5
|
+
* is one `ThemeSizeContext` and importing `/helpers` from a server component does not call
|
|
6
|
+
* `createContext`.
|
|
7
|
+
*/
|
|
4
8
|
|
|
5
9
|
type ThemeSize = '1' | '2' | '3' | '4';
|
|
6
10
|
|
|
7
11
|
/** The rest of the 1-4 index when no Theme states a size. */
|
|
8
12
|
const THEME_SIZE_DEFAULT: ThemeSize = '2';
|
|
9
13
|
|
|
10
|
-
/**
|
|
11
|
-
* The app-wide size index, provided by `Theme` beside `ThemeContext`.
|
|
12
|
-
*
|
|
13
|
-
* It is its own context, holding one string, so a component that only needs
|
|
14
|
-
* the size does not re-render when the accent colour or appearance changes.
|
|
15
|
-
*/
|
|
16
|
-
const ThemeSizeContext = React.createContext<ThemeSize>(THEME_SIZE_DEFAULT);
|
|
17
|
-
ThemeSizeContext.displayName = 'ThemeSizeContext';
|
|
18
|
-
|
|
19
|
-
interface SizePropDef {
|
|
20
|
-
values: readonly string[];
|
|
21
|
-
default?: string;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
14
|
/**
|
|
25
15
|
* Maps the theme size onto a component's own range: the value itself when the
|
|
26
16
|
* component has it, otherwise the nearest end of the range (`4` on a 1-3 scale
|
|
@@ -41,33 +31,5 @@ function clampSize(size: ThemeSize, values: readonly string[]): string {
|
|
|
41
31
|
return nearest;
|
|
42
32
|
}
|
|
43
33
|
|
|
44
|
-
|
|
45
|
-
* The size a component on the 1-4 index takes: what the caller said, else the
|
|
46
|
-
* nearest Theme's size, mapped into the component's range.
|
|
47
|
-
*/
|
|
48
|
-
function useThemeSize<V>(explicit: V | undefined, propDef: SizePropDef): V {
|
|
49
|
-
const themeSize = React.useContext(ThemeSizeContext);
|
|
50
|
-
if (explicit !== undefined) return explicit;
|
|
51
|
-
// The clamped value is one of `propDef.values`, which is what `V` ranges over.
|
|
52
|
-
return clampSize(themeSize, propDef.values) as V;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Fills `size` from the nearest Theme when the caller left it unset, so the
|
|
57
|
-
* result can go straight into `extractProps`. An explicit size, responsive
|
|
58
|
-
* object included, wins.
|
|
59
|
-
*
|
|
60
|
-
* Returns the same props object when there is nothing to fill: when a size is
|
|
61
|
-
* set, or when the theme size resolves to the prop def's own default (the
|
|
62
|
-
* common case, a Theme with no size), so `extractProps` applies it as before.
|
|
63
|
-
*/
|
|
64
|
-
function useThemeSizeProps<P extends { size?: unknown }>(props: P, propDef: SizePropDef): P {
|
|
65
|
-
const themeSize = React.useContext(ThemeSizeContext);
|
|
66
|
-
if (props.size !== undefined) return props;
|
|
67
|
-
const size = clampSize(themeSize, propDef.values);
|
|
68
|
-
if (size === propDef.default) return props;
|
|
69
|
-
return { ...props, size };
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export { ThemeSizeContext, THEME_SIZE_DEFAULT, clampSize, useThemeSize, useThemeSizeProps };
|
|
34
|
+
export { THEME_SIZE_DEFAULT, clampSize };
|
|
73
35
|
export type { ThemeSize };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
import { THEME_SIZE_DEFAULT, clampSize } from '../helpers/theme-size.js';
|
|
6
|
+
import type { ThemeSize } from '../helpers/theme-size.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The app-wide size index, provided by `Theme` beside `ThemeContext`.
|
|
10
|
+
*
|
|
11
|
+
* It is its own context, holding one string, so a component that only needs
|
|
12
|
+
* the size does not re-render when the accent colour or appearance changes.
|
|
13
|
+
*/
|
|
14
|
+
const ThemeSizeContext = React.createContext<ThemeSize>(THEME_SIZE_DEFAULT);
|
|
15
|
+
ThemeSizeContext.displayName = 'ThemeSizeContext';
|
|
16
|
+
|
|
17
|
+
interface SizePropDef {
|
|
18
|
+
values: readonly string[];
|
|
19
|
+
default?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The size a component on the 1-4 index takes: what the caller said, else the
|
|
24
|
+
* nearest Theme's size, mapped into the component's range.
|
|
25
|
+
*/
|
|
26
|
+
function useThemeSize<V>(explicit: V | undefined, propDef: SizePropDef): V {
|
|
27
|
+
const themeSize = React.useContext(ThemeSizeContext);
|
|
28
|
+
if (explicit !== undefined) return explicit;
|
|
29
|
+
// The clamped value is one of `propDef.values`, which is what `V` ranges over.
|
|
30
|
+
return clampSize(themeSize, propDef.values) as V;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Fills `size` from the nearest Theme when the caller left it unset, so the
|
|
35
|
+
* result can go straight into `extractProps`. An explicit size, responsive
|
|
36
|
+
* object included, wins.
|
|
37
|
+
*
|
|
38
|
+
* Returns the same props object when there is nothing to fill: when a size is
|
|
39
|
+
* set, or when the theme size resolves to the prop def's own default (the
|
|
40
|
+
* common case, a Theme with no size), so `extractProps` applies it as before.
|
|
41
|
+
*/
|
|
42
|
+
function useThemeSizeProps<P extends { size?: unknown }>(props: P, propDef: SizePropDef): P {
|
|
43
|
+
const themeSize = React.useContext(ThemeSizeContext);
|
|
44
|
+
if (props.size !== undefined) return props;
|
|
45
|
+
const size = clampSize(themeSize, propDef.values);
|
|
46
|
+
if (size === propDef.default) return props;
|
|
47
|
+
return { ...props, size };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export { ThemeSizeContext, useThemeSize, useThemeSizeProps };
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
--color-page: white;
|
|
9
9
|
--color-overlay: var(--black-a6);
|
|
10
10
|
--color-surface: white;
|
|
11
|
+
/* The ground a raised surface sits on: one step below it, so a white card reads as lifted. */
|
|
12
|
+
--color-ground: var(--neutral-1, var(--gray-1));
|
|
11
13
|
|
|
12
14
|
/*
|
|
13
15
|
* The neutral scale, named as in v2. It defaults to the plain gray palette; a Theme grayColor
|
|
@@ -49,6 +51,7 @@
|
|
|
49
51
|
--color-page: var(--neutral-1, var(--gray-1));
|
|
50
52
|
--color-overlay: var(--black-a8);
|
|
51
53
|
--color-surface: var(--neutral-2, var(--gray-2));
|
|
54
|
+
--color-ground: var(--neutral-1, var(--gray-1));
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
/* */
|
package/styles.css
CHANGED
|
@@ -3377,6 +3377,7 @@
|
|
|
3377
3377
|
--color-page: white;
|
|
3378
3378
|
--color-overlay: var(--black-a6);
|
|
3379
3379
|
--color-surface: white;
|
|
3380
|
+
--color-ground: var(--neutral-1, var(--gray-1));
|
|
3380
3381
|
--color-text: var(--neutral-12);
|
|
3381
3382
|
--neutral-1: var(--gray-1);
|
|
3382
3383
|
--neutral-2: var(--gray-2);
|
|
@@ -3457,6 +3458,7 @@
|
|
|
3457
3458
|
--color-page: var(--neutral-1, var(--gray-1));
|
|
3458
3459
|
--color-overlay: var(--black-a8);
|
|
3459
3460
|
--color-surface: var(--neutral-2, var(--gray-2));
|
|
3461
|
+
--color-ground: var(--neutral-1, var(--gray-1));
|
|
3460
3462
|
--solid-chroma-hover-filter: none;
|
|
3461
3463
|
--solid-chroma-active-filter: brightness(0.88) contrast(1.03);
|
|
3462
3464
|
--solid-chroma-open-filter: brightness(0.95) contrast(1.02);
|
|
@@ -12628,6 +12630,7 @@
|
|
|
12628
12630
|
background-color: var(--color-surface);
|
|
12629
12631
|
}
|
|
12630
12632
|
.kui-PopoverToolbarSection {
|
|
12633
|
+
grid-row: 1;
|
|
12631
12634
|
display: -webkit-box;
|
|
12632
12635
|
display: -ms-flexbox;
|
|
12633
12636
|
display: flex;
|
|
@@ -12637,6 +12640,7 @@
|
|
|
12637
12640
|
gap: var(--space-3);
|
|
12638
12641
|
}
|
|
12639
12642
|
.kui-PopoverToolbarLeft {
|
|
12643
|
+
grid-column: 1;
|
|
12640
12644
|
justify-self: start;
|
|
12641
12645
|
}
|
|
12642
12646
|
.kui-PopoverToolbarCenter {
|
|
@@ -12646,6 +12650,7 @@
|
|
|
12646
12650
|
text-align: center;
|
|
12647
12651
|
}
|
|
12648
12652
|
.kui-PopoverToolbarRight {
|
|
12653
|
+
grid-column: 3;
|
|
12649
12654
|
justify-self: end;
|
|
12650
12655
|
}
|
|
12651
12656
|
.kui-PopoverToolbarTitle {
|
|
@@ -13235,7 +13240,7 @@
|
|
|
13235
13240
|
background-color: GrayText;
|
|
13236
13241
|
}
|
|
13237
13242
|
}
|
|
13238
|
-
|
|
13243
|
+
.kui-SheetContent {
|
|
13239
13244
|
position: fixed !important;
|
|
13240
13245
|
width: var(--width, 90vw);
|
|
13241
13246
|
max-width: min(var(--overlay-w), 100vw);
|
|
@@ -13244,7 +13249,7 @@
|
|
|
13244
13249
|
margin: 0 !important;
|
|
13245
13250
|
}
|
|
13246
13251
|
@supports (height: 100dvh) {
|
|
13247
|
-
|
|
13252
|
+
.kui-SheetContent {
|
|
13248
13253
|
height: 100dvh;
|
|
13249
13254
|
max-height: 100dvh;
|
|
13250
13255
|
}
|
package/tokens/base.css
CHANGED
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
--color-page: white;
|
|
62
62
|
--color-overlay: var(--black-a6);
|
|
63
63
|
--color-surface: white;
|
|
64
|
+
--color-ground: var(--neutral-1, var(--gray-1));
|
|
64
65
|
--color-text: var(--neutral-12);
|
|
65
66
|
--neutral-1: var(--gray-1);
|
|
66
67
|
--neutral-2: var(--gray-2);
|
|
@@ -108,6 +109,7 @@
|
|
|
108
109
|
--color-page: var(--neutral-1, var(--gray-1));
|
|
109
110
|
--color-overlay: var(--black-a8);
|
|
110
111
|
--color-surface: var(--neutral-2, var(--gray-2));
|
|
112
|
+
--color-ground: var(--neutral-1, var(--gray-1));
|
|
111
113
|
--solid-chroma-hover-filter: none;
|
|
112
114
|
--solid-chroma-active-filter: brightness(0.88) contrast(1.03);
|
|
113
115
|
--solid-chroma-open-filter: brightness(0.95) contrast(1.02);
|
package/tokens.css
CHANGED
|
@@ -3377,6 +3377,7 @@
|
|
|
3377
3377
|
--color-page: white;
|
|
3378
3378
|
--color-overlay: var(--black-a6);
|
|
3379
3379
|
--color-surface: white;
|
|
3380
|
+
--color-ground: var(--neutral-1, var(--gray-1));
|
|
3380
3381
|
--color-text: var(--neutral-12);
|
|
3381
3382
|
--neutral-1: var(--gray-1);
|
|
3382
3383
|
--neutral-2: var(--gray-2);
|
|
@@ -3454,6 +3455,7 @@
|
|
|
3454
3455
|
--color-page: var(--neutral-1, var(--gray-1));
|
|
3455
3456
|
--color-overlay: var(--black-a8);
|
|
3456
3457
|
--color-surface: var(--neutral-2, var(--gray-2));
|
|
3458
|
+
--color-ground: var(--neutral-1, var(--gray-1));
|
|
3457
3459
|
--solid-chroma-hover-filter: none;
|
|
3458
3460
|
--solid-chroma-active-filter: brightness(0.88) contrast(1.03);
|
|
3459
3461
|
--solid-chroma-open-filter: brightness(0.95) contrast(1.02);
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/components/select.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { Select as SelectPrimitive, ScrollArea as ScrollAreaPrimitive } from 'radix-ui';\n\nimport { extractProps } from '../helpers/extract-props.js';\nimport { useThemeSize } from '../helpers/theme-size.js';\nimport { ChevronDownIcon, ThickCheckIcon } from './icons.js';\nimport { Spinner } from './spinner.js';\nimport {\n selectRootPropDefs,\n selectTriggerPropDefs,\n selectContentPropDefs,\n} from './select.props.js';\nimport { useThemeContext, Theme } from './theme.js';\nimport { useThumbSync } from '../hooks/use-thumb-sync.js';\n\nimport type { GetPropDefTypes } from '../props/prop-def.js';\nimport type { ComponentPropsWithout, RemovedProps } from '../helpers/component-props.js';\n\ntype SelectRootOwnProps = GetPropDefTypes<typeof selectRootPropDefs>;\n\n// Trigger and Content pass the size prop def as its own record. It is hoisted because\n// extractProps caches its compiled prop defs on the identity of each record it is given:\n// a literal written at the call site would be a new object, and a recompile, every render.\nconst selectSizePropDefs = { size: selectRootPropDefs.size };\n\n// Keys that open the list from the trigger, as in Radix.\nconst OPEN_KEYS = [' ', 'Enter', 'ArrowUp', 'ArrowDown'];\n\ninterface SelectContextValue extends SelectRootOwnProps {\n /** Whether the list is open. Undefined when Content is rendered outside a Kookie Select.Root. */\n open?: boolean;\n}\nconst SelectContext = React.createContext<SelectContextValue>({});\n\ninterface SelectRootProps extends SelectPrimitive.SelectProps, SelectRootOwnProps {}\nconst SelectRoot: React.FC<SelectRootProps> = (props) => {\n const {\n children,\n size: sizeProp,\n open: openProp,\n defaultOpen,\n onOpenChange,\n ...rootProps\n } = props;\n const size = useThemeSize(sizeProp, selectRootPropDefs.size);\n\n // Root owns the open state and hands Radix a controlled `open`, so Content learns of a\n // change in the same render Radix does. Radix's uncontrolled state reports changes from an\n // effect, a render late, which would mount the open list once without its wrappers.\n const [uncontrolledOpen, setUncontrolledOpen] = React.useState(defaultOpen ?? false);\n const open = openProp ?? uncontrolledOpen;\n const handleOpenChange = React.useCallback(\n (next: boolean) => {\n setUncontrolledOpen(next);\n onOpenChange?.(next);\n },\n [onOpenChange],\n );\n\n return (\n <SelectPrimitive.Root {...rootProps} open={open} onOpenChange={handleOpenChange}>\n <SelectContext.Provider value={React.useMemo(() => ({ size, open }), [size, open])}>\n {children}\n </SelectContext.Provider>\n </SelectPrimitive.Root>\n );\n};\nSelectRoot.displayName = 'Select.Root';\n\ntype SelectTriggerElement = React.ElementRef<typeof SelectPrimitive.Trigger>;\ntype SelectTriggerOwnProps = GetPropDefTypes<typeof selectTriggerPropDefs>;\ninterface SelectTriggerProps\n extends ComponentPropsWithout<typeof SelectPrimitive.Trigger, RemovedProps>,\n SelectTriggerOwnProps {}\nconst SelectTrigger = React.forwardRef<SelectTriggerElement, SelectTriggerProps>(\n (props, forwardedRef) => {\n const context = React.useContext(SelectContext);\n const {\n children,\n className,\n color,\n radius,\n placeholder,\n error,\n loading,\n disabled,\n readOnly,\n ...triggerProps\n } = extractProps(\n // Pass size value from the context to generate styles\n { size: context?.size, ...props },\n // Pass size prop def to allow it to be extracted\n selectSizePropDefs,\n selectTriggerPropDefs,\n );\n\n // The props win when set; otherwise a caller's own aria-* (a form library's aria-invalid)\n // stays, so both paths reach the accessibility tree and the CSS, as on TextField.\n const {\n 'aria-invalid': ariaInvalid,\n 'aria-busy': ariaBusy,\n 'aria-disabled': ariaDisabled,\n 'aria-readonly': ariaReadOnly,\n } = triggerProps;\n const isInvalid = Boolean(error) || ariaInvalid === true || ariaInvalid === 'true';\n const ariaProps = React.useMemo(\n () => ({\n 'aria-invalid': isInvalid ? true : ariaInvalid,\n 'aria-busy': loading || ariaBusy,\n 'aria-disabled': disabled || ariaDisabled,\n 'aria-readonly': readOnly || ariaReadOnly,\n }),\n [isInvalid, ariaInvalid, loading, ariaBusy, disabled, ariaDisabled, readOnly, ariaReadOnly],\n );\n\n // Read-only and loading triggers stay focusable but do not open or take typeahead,\n // as on Combobox. Radix skips its own handler when the event is default-prevented.\n const isBlocked = Boolean(readOnly || loading);\n const blockedHandlers = isBlocked\n ? {\n onPointerDown: (event: React.PointerEvent<HTMLButtonElement>) => event.preventDefault(),\n onClick: (event: React.MouseEvent<HTMLButtonElement>) => {\n event.preventDefault();\n event.currentTarget.focus();\n },\n onKeyDown: (event: React.KeyboardEvent<HTMLButtonElement>) => {\n const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;\n if (OPEN_KEYS.includes(event.key) || (!isModifierKey && event.key.length === 1)) {\n event.preventDefault();\n }\n },\n }\n : undefined;\n\n return (\n // `disabled` goes to Radix, which merges it with Root's and sets the native attribute.\n <SelectPrimitive.Trigger asChild disabled={disabled} {...blockedHandlers}>\n <button\n data-accent-color={color}\n data-radius={radius}\n data-error={error}\n data-loading={loading}\n {...triggerProps}\n {...ariaProps}\n ref={forwardedRef}\n className={classNames('kui-reset', 'kui-SelectTrigger', className)}\n >\n <span className=\"kui-SelectTriggerInner\">\n <SelectPrimitive.Value placeholder={placeholder}>{children}</SelectPrimitive.Value>\n </span>\n <SelectPrimitive.Icon asChild>\n {loading ? (\n <span className=\"kui-SelectIcon kui-SelectLoadingIcon\" aria-hidden=\"true\">\n <Spinner />\n </span>\n ) : (\n <ChevronDownIcon className=\"kui-SelectIcon\" />\n )}\n </SelectPrimitive.Icon>\n </button>\n </SelectPrimitive.Trigger>\n );\n },\n);\nSelectTrigger.displayName = 'Select.Trigger';\n\ntype SelectContentElement = React.ElementRef<typeof SelectPrimitive.Content>;\ntype SelectContentOwnProps = GetPropDefTypes<typeof selectContentPropDefs>;\ninterface SelectContentProps\n extends ComponentPropsWithout<typeof SelectPrimitive.Content, RemovedProps>,\n SelectContentOwnProps {\n container?: React.ComponentPropsWithoutRef<typeof SelectPrimitive.Portal>['container'];\n}\nconst SelectContent = React.forwardRef<SelectContentElement, SelectContentProps>(\n (props, forwardedRef) => {\n const context = React.useContext(SelectContext);\n const { className, children, color, container, ...contentProps } = extractProps(\n // Pass size value from the context to generate styles\n { size: context?.size, ...props },\n // Pass size prop def to allow it to be extracted\n selectSizePropDefs,\n selectContentPropDefs,\n );\n const themeContext = useThemeContext();\n\n // While closed, Radix still renders Content's children, into a detached fragment: the\n // items must exist for the trigger's value label, typeahead and the native form select.\n // Nothing in that fragment is ever shown, so the theme wrapper and the scroll area, with\n // its two resize observers, are left out until the list opens.\n if (context.open === false && !contentProps.forceMount) {\n return (\n <SelectPrimitive.Portal container={container}>\n <SelectPrimitive.Content {...contentProps} asChild={false} ref={forwardedRef}>\n {children}\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n );\n }\n\n const resolvedColor = color || themeContext.accentColor;\n return (\n <SelectPrimitive.Portal container={container}>\n <Theme asChild>\n <SelectPrimitive.Content\n data-accent-color={resolvedColor}\n sideOffset={4}\n {...contentProps}\n asChild={false}\n ref={forwardedRef}\n className={classNames(\n 'kui-PopperContent',\n 'kui-BaseMenuContent',\n 'kui-variant-soft',\n 'kui-SelectContent',\n className,\n )}\n >\n <SelectScrollArea>{children}</SelectScrollArea>\n </SelectPrimitive.Content>\n </Theme>\n </SelectPrimitive.Portal>\n );\n },\n);\nSelectContent.displayName = 'Select.Content';\n\n/** The open list's scroll area. Its own component so the thumb sync hook runs only while open. */\nfunction SelectScrollArea({ children }: { children: React.ReactNode }) {\n const setThumbViewport = useThumbSync<HTMLDivElement>();\n return (\n <ScrollAreaPrimitive.Root type=\"auto\" className=\"kui-ScrollAreaRoot\">\n <SelectPrimitive.Viewport\n asChild\n className={classNames('kui-BaseMenuViewport', 'kui-SelectViewport')}\n >\n <ScrollAreaPrimitive.Viewport\n ref={setThumbViewport}\n className=\"kui-ScrollAreaViewport\"\n style={{ overflowY: undefined }}\n >\n {children}\n </ScrollAreaPrimitive.Viewport>\n </SelectPrimitive.Viewport>\n <ScrollAreaPrimitive.Scrollbar className=\"kui-ScrollAreaScrollbar\" orientation=\"vertical\">\n <ScrollAreaPrimitive.Thumb className=\"kui-ScrollAreaThumb\" />\n </ScrollAreaPrimitive.Scrollbar>\n </ScrollAreaPrimitive.Root>\n );\n}\n\ntype SelectItemElement = React.ElementRef<typeof SelectPrimitive.Item>;\ninterface SelectItemProps\n extends ComponentPropsWithout<typeof SelectPrimitive.Item, RemovedProps> {}\nconst SelectItem = React.forwardRef<SelectItemElement, SelectItemProps>((props, forwardedRef) => {\n const { className, children, ...itemProps } = props;\n\n // Detect if this is rich content (not just a string)\n const isRichContent = typeof children !== 'string';\n\n return (\n <SelectPrimitive.Item\n {...itemProps}\n asChild={false}\n ref={forwardedRef}\n className={classNames(\n 'kui-reset',\n 'kui-BaseMenuItem',\n 'kui-SelectItem',\n { 'kui-SelectItemRich': isRichContent },\n className,\n )}\n >\n <SelectPrimitive.ItemIndicator className=\"kui-SelectItemIndicator\">\n <ThickCheckIcon className=\"kui-SelectItemIndicatorIcon\" />\n </SelectPrimitive.ItemIndicator>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n );\n});\nSelectItem.displayName = 'Select.Item';\n\ntype SelectGroupElement = React.ElementRef<typeof SelectPrimitive.Group>;\ninterface SelectGroupProps\n extends ComponentPropsWithout<typeof SelectPrimitive.Group, RemovedProps> {}\nconst SelectGroup = React.forwardRef<SelectGroupElement, SelectGroupProps>(\n ({ className, ...props }, forwardedRef) => (\n <SelectPrimitive.Group\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('kui-SelectGroup', className)}\n />\n ),\n);\nSelectGroup.displayName = 'Select.Group';\n\ntype SelectLabelElement = React.ElementRef<typeof SelectPrimitive.Label>;\ninterface SelectLabelProps\n extends ComponentPropsWithout<typeof SelectPrimitive.Label, RemovedProps> {}\nconst SelectLabel = React.forwardRef<SelectLabelElement, SelectLabelProps>(\n ({ className, ...props }, forwardedRef) => (\n <SelectPrimitive.Label\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('kui-BaseMenuLabel', 'kui-SelectLabel', className)}\n />\n ),\n);\nSelectLabel.displayName = 'Select.Label';\n\ntype SelectSeparatorElement = React.ElementRef<typeof SelectPrimitive.Separator>;\ninterface SelectSeparatorProps\n extends ComponentPropsWithout<typeof SelectPrimitive.Separator, RemovedProps> {}\nconst SelectSeparator = React.forwardRef<SelectSeparatorElement, SelectSeparatorProps>(\n ({ className, ...props }, forwardedRef) => (\n <SelectPrimitive.Separator\n {...props}\n asChild={false}\n ref={forwardedRef}\n className={classNames('kui-BaseMenuSeparator', 'kui-SelectSeparator', className)}\n />\n ),\n);\nSelectSeparator.displayName = 'Select.Separator';\n\nexport {\n SelectRoot as Root,\n SelectTrigger as Trigger,\n SelectContent as Content,\n SelectItem as Item,\n SelectGroup as Group,\n SelectLabel as Label,\n SelectSeparator as Separator,\n};\n\nexport type {\n SelectRootProps as RootProps,\n SelectTriggerProps as TriggerProps,\n SelectContentProps as ContentProps,\n SelectItemProps as ItemProps,\n SelectGroupProps as GroupProps,\n SelectLabelProps as LabelProps,\n SelectSeparatorProps as SeparatorProps,\n};\n"],
|
|
5
|
-
"mappings": "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",
|
|
6
|
-
"names": ["select_exports", "__export", "SelectContent", "SelectGroup", "SelectItem", "SelectLabel", "SelectRoot", "SelectSeparator", "SelectTrigger", "React", "classNames", "SelectPrimitive", "ScrollAreaPrimitive", "selectSizePropDefs", "selectRootPropDefs", "OPEN_KEYS", "SelectContext", "SelectRoot", "props", "children", "sizeProp", "openProp", "defaultOpen", "onOpenChange", "rootProps", "size", "useThemeSize", "uncontrolledOpen", "setUncontrolledOpen", "open", "handleOpenChange", "next", "SelectPrimitive", "SelectTrigger", "forwardedRef", "context", "className", "color", "radius", "placeholder", "error", "loading", "disabled", "readOnly", "triggerProps", "extractProps", "selectTriggerPropDefs", "ariaInvalid", "ariaBusy", "ariaDisabled", "ariaReadOnly", "isInvalid", "ariaProps", "blockedHandlers", "event", "isModifierKey", "classNames", "Spinner", "ChevronDownIcon", "SelectContent", "container", "contentProps", "selectContentPropDefs", "themeContext", "useThemeContext", "resolvedColor", "Theme", "SelectScrollArea", "setThumbViewport", "useThumbSync", "ScrollAreaPrimitive", "SelectItem", "itemProps", "isRichContent", "ThickCheckIcon", "SelectGroup", "SelectLabel", "SelectSeparator"]
|
|
7
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import*as r from"react";var a="2",u=r.createContext(a);u.displayName="ThemeSizeContext";function f(e,t){if(t.includes(e))return e;let n=Number(e),i=t[0],s=1/0;for(let o=0;o<t.length;o++){let c=Math.abs(Number(t[o])-n);c<s&&(s=c,i=t[o])}return i}function m(e,t){let n=r.useContext(u);return e!==void 0?e:f(n,t.values)}function z(e,t){let n=r.useContext(u);if(e.size!==void 0)return e;let i=f(n,t.values);return i===t.default?e:{...e,size:i}}export{u as a,m as b,z as c};
|
|
3
|
-
//# sourceMappingURL=chunk-2IUGM657.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/helpers/theme-size.ts"],
|
|
4
|
-
"sourcesContent": ["'use client';\n\nimport * as React from 'react';\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 * 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 * 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\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, THEME_SIZE_DEFAULT, clampSize, useThemeSize, useThemeSizeProps };\nexport type { ThemeSize };\n"],
|
|
5
|
-
"mappings": ";AAEA,UAAYA,MAAW,QAKvB,IAAMC,EAAgC,IAQhCC,EAAyB,gBAAyBD,CAAkB,EAC1EC,EAAiB,YAAc,mBAY/B,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,CAMA,SAASI,EAAgBC,EAAyBC,EAAyB,CACzE,IAAMC,EAAkB,aAAWX,CAAgB,EACnD,OAAIS,IAAa,OAAkBA,EAE5BR,EAAUU,EAAWD,EAAQ,MAAM,CAC5C,CAWA,SAASE,EAAgDC,EAAUH,EAAyB,CAC1F,IAAMC,EAAkB,aAAWX,CAAgB,EACnD,GAAIa,EAAM,OAAS,OAAW,OAAOA,EACrC,IAAMX,EAAOD,EAAUU,EAAWD,EAAQ,MAAM,EAChD,OAAIR,IAASQ,EAAQ,QAAgBG,EAC9B,CAAE,GAAGA,EAAO,KAAAX,CAAK,CAC1B",
|
|
6
|
-
"names": ["React", "THEME_SIZE_DEFAULT", "ThemeSizeContext", "clampSize", "size", "values", "nearest", "distance", "i", "d", "useThemeSize", "explicit", "propDef", "themeSize", "useThemeSizeProps", "props"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/components/checkbox.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client';\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { Checkbox as CheckboxPrimitive } from 'radix-ui';\nimport { useControllableState } from 'radix-ui/internal';\n\nimport { checkboxPropDefs } from './checkbox.props.js';\nimport { ThickCheckIcon, ThickDividerHorizontalIcon } from './icons.js';\nimport { extractProps } from '../helpers/extract-props.js';\nimport { useThemeSizeProps } from '../helpers/theme-size.js';\n\nimport type { ComponentPropsWithout } from '../helpers/component-props.js';\nimport type { GetPropDefTypes } from '../props/prop-def.js';\n\ntype CheckboxElement = React.ElementRef<typeof CheckboxPrimitive.Root>;\ntype CheckboxOwnProps = GetPropDefTypes<typeof checkboxPropDefs>;\ninterface CheckboxProps\n extends ComponentPropsWithout<\n typeof CheckboxPrimitive.Root,\n 'asChild' | 'color' | 'defaultValue' | 'children'\n >,\n CheckboxOwnProps {}\nconst Checkbox = React.forwardRef<CheckboxElement, CheckboxProps>((ownProps, forwardedRef) => {\n const props = useThemeSizeProps(ownProps, checkboxPropDefs.size);\n const {\n className,\n color,\n checked: checkedProp,\n defaultChecked: defaultCheckedProp,\n onCheckedChange,\n ...checkboxProps\n } = extractProps(props, checkboxPropDefs);\n\n const [checked, setChecked] = useControllableState({\n prop: checkedProp,\n defaultProp: defaultCheckedProp ?? false,\n onChange: onCheckedChange,\n });\n\n return (\n <CheckboxPrimitive.Root\n data-accent-color={color}\n {...checkboxProps}\n defaultChecked={defaultCheckedProp}\n checked={checked}\n onCheckedChange={setChecked}\n asChild={false}\n ref={forwardedRef}\n className={classNames('kui-reset', 'kui-BaseCheckboxRoot', 'kui-CheckboxRoot', className)}\n >\n <CheckboxPrimitive.Indicator\n asChild\n className=\"kui-BaseCheckboxIndicator kui-CheckboxIndicator\"\n >\n {checked === 'indeterminate' ? <ThickDividerHorizontalIcon /> : <ThickCheckIcon />}\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n );\n});\nCheckbox.displayName = 'Checkbox';\n\nexport { Checkbox };\nexport type { CheckboxProps };\n"],
|
|
5
|
-
"mappings": ";kKAEA,UAAYA,MAAW,QACvB,OAAOC,MAAgB,aACvB,OAAS,YAAYC,MAAyB,WAC9C,OAAS,wBAAAC,MAA4B,oBAkBrC,IAAMC,EAAiB,aAA2C,CAACC,EAAUC,IAAiB,CAC5F,IAAMC,EAAQC,EAAkBH,EAAUI,EAAiB,IAAI,EACzD,CACJ,UAAAC,EACA,MAAAC,EACA,QAASC,EACT,eAAgBC,EAChB,gBAAAC,EACA,GAAGC,CACL,EAAIC,EAAaT,EAAOE,CAAgB,EAElC,CAACQ,EAASC,CAAU,EAAIC,EAAqB,CACjD,KAAMP,EACN,YAAaC,GAAsB,GACnC,SAAUC,CACZ,CAAC,EAED,OACE,gBAACM,EAAkB,KAAlB,CACC,oBAAmBT,EAClB,GAAGI,EACJ,eAAgBF,EAChB,QAASI,EACT,gBAAiBC,EACjB,QAAS,GACT,IAAKZ,EACL,UAAWe,EAAW,YAAa,uBAAwB,mBAAoBX,CAAS,GAExF,gBAACU,EAAkB,UAAlB,CACC,QAAO,GACP,UAAU,mDAETH,IAAY,gBAAkB,gBAACK,EAAA,IAA2B,EAAK,gBAACC,EAAA,IAAe,CAClF,CACF,CAEJ,CAAC,EACDnB,EAAS,YAAc",
|
|
6
|
-
"names": ["React", "classNames", "CheckboxPrimitive", "useControllableState", "Checkbox", "ownProps", "forwardedRef", "props", "useThemeSizeProps", "baseCheckboxPropDefs", "className", "color", "checkedProp", "defaultCheckedProp", "onCheckedChange", "checkboxProps", "extractProps", "checked", "setChecked", "useControllableState", "CheckboxPrimitive", "classNames", "ThickDividerHorizontalIcon", "ThickCheckIcon"]
|
|
7
|
-
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import{a as v}from"./chunk-ILWS2JUE.js";import{a as O}from"./chunk-WZKSLTBH.js";import{k as H}from"./chunk-GKDGNPBD.js";import{c as I}from"./chunk-2IUGM657.js";import{a as h}from"./chunk-65KD6WS6.js";import{c as L}from"./chunk-OKQAVYW4.js";import*as e from"react";import te from"classnames";import{Slot as ne}from"radix-ui";import{useComposedRefs as oe,useLayoutEffect as ae}from"radix-ui/internal";var se=e.forwardRef((i,n)=>{let o=I(i,h.size),{className:P,children:a,asChild:s,as:f,color:F,radius:V,disabled:R,done:B=!1,...p}=L(o,h),l=!!o.loading,_=o.loading!==void 0,m=!!R||l,{onClick:T,"aria-describedby":M}=p,A=e.useCallback(t=>{if(m){t.preventDefault();return}T?.(t)},[m,T]),z=e.useMemo(()=>{let t=s&&e.isValidElement(a)?a.props.children:a,d=N(t),c=r=>e.isValidElement(r)&&(r.type==="svg"||typeof r.type!="string"&&r.type!==e.Fragment&&!re.has(k(r.type)));return{iconStart:c(d[0]),iconEnd:c(d[d.length-1])}},[s,a]),[G,W]=e.useState(null),S=e.useRef(null),X=oe(n,S);ae(()=>{let t=S.current;if(!t||l||B)return;let d=t.querySelector(":scope > .kui-BaseButtonContent")??t,c=j(d,"start"),r=j(d,"end");W(u=>u&&u.iconStart===c&&u.iconEnd===r?u:{iconStart:c,iconEnd:r})});let{iconStart:b,iconEnd:q}=G??z,D=!!p["data-icon-only"],E=e.useMemo(()=>{if(!B)return a;let t=e.createElement(H,{key:"kui-done-tick",className:"kui-BaseButtonTick","aria-hidden":!0}),d=c=>{if(D)return t;let r=N(c),u=r.findIndex(y=>!(typeof y=="string"&&!y.trim()));return b&&u!==-1?r.map((y,ee)=>ee===u?t:y):[t,...r]};if(s&&e.isValidElement(a)){let c=a;return e.cloneElement(c,void 0,d(c.props.children))}return d(a)},[B,a,D,b,s]),K=s?ne.Root:f||"button",Q=["button","input","textarea","select"],x=s?e.isValidElement(a)?a.type:void 0:f||"button",C=typeof x=="string"&&Q.includes(x),{onClickCapture:w}=p,$=e.useCallback(t=>{if(s&&m){t.preventDefault(),t.stopPropagation();return}w?.(t)},[s,m,w]),J=!s&&(!f||f==="button"),U="type"in p,Y=e.useId(),g=l?`${Y}-loading`:void 0,Z=e.useMemo(()=>l?{"aria-busy":!0,"aria-disabled":!0,"aria-describedby":[M,g].filter(Boolean).join(" ")}:R&&(!C||s)?{"aria-disabled":!0}:{},[l,g,M,R,C,s]);return e.createElement(K,{"data-accent-color":F,"data-radius":V,"data-icon-start":b||void 0,"data-icon-end":q||void 0,"data-done":B||void 0,...p,...Z,"data-disabled":m||void 0,onClick:A,onClickCapture:$,ref:X,className:te("kui-reset","kui-BaseButton",P),...C&&{disabled:R},...J&&!U?{type:"button"}:{}},s&&!l?E:e.createElement(e.Fragment,null,_?e.createElement("span",{className:"kui-BaseButtonContent","aria-hidden":l||void 0},E):E,l?e.createElement(e.Fragment,null,e.createElement("span",{className:"kui-sr-only"},e.createElement("span",{id:g,"aria-hidden":!0},"Loading"),a),e.createElement(O,{asChild:!0,align:"center",justify:"center",position:"absolute",inset:"0"},e.createElement("span",null,e.createElement(v,{"aria-hidden":"true"})))):null))});se.displayName="BaseButton";var re=new Set(["Text","Kbd","Code","Link","Em","Strong","Quote","Badge","Trans"]);function k(i){if(!i||typeof i!="function"&&typeof i!="object")return"";let n=i;return n.displayName||n.name||k(n.render)||k(n.type)}function N(i){return e.Children.toArray(i).flatMap(n=>e.isValidElement(n)&&n.type===e.Fragment?N(n.props.children):[n])}function j(i,n){let o=n==="start"?i.firstChild:i.lastChild;for(;o&&(o.nodeType===Node.COMMENT_NODE||o.nodeType===Node.TEXT_NODE&&!o.textContent?.trim());)o=n==="start"?o.nextSibling:o.previousSibling;return o?.nodeType===Node.ELEMENT_NODE&&o.localName==="svg"}export{se as a};
|
|
3
|
-
//# sourceMappingURL=chunk-3WZLXGUE.js.map
|