@42-central/ui-react 0.29.0 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-X6DESK37.js → chunk-2RRTT4AF.js} +17 -5
- package/dist/chunk-2RRTT4AF.js.map +1 -0
- package/dist/{chunk-TUP7WXQE.js → chunk-322I2RSV.js} +9 -6
- package/dist/chunk-322I2RSV.js.map +1 -0
- package/dist/{chunk-ISX3AM32.js → chunk-37SRSNLJ.js} +4 -4
- package/dist/{chunk-ISX3AM32.js.map → chunk-37SRSNLJ.js.map} +1 -1
- package/dist/{chunk-L5GH7LLD.js → chunk-3MFWUG5O.js} +4 -4
- package/dist/{chunk-L5GH7LLD.js.map → chunk-3MFWUG5O.js.map} +1 -1
- package/dist/{chunk-FQJNQW3G.js → chunk-3XQEOJCE.js} +8 -5
- package/dist/chunk-3XQEOJCE.js.map +1 -0
- package/dist/{chunk-JKFPRQB2.js → chunk-4LSZ5JWF.js} +3 -3
- package/dist/{chunk-JKFPRQB2.js.map → chunk-4LSZ5JWF.js.map} +1 -1
- package/dist/{chunk-V2QZG4IT.js → chunk-5HWFYYHW.js} +27 -9
- package/dist/chunk-5HWFYYHW.js.map +1 -0
- package/dist/{chunk-GEZYGBXY.js → chunk-6MVFCS46.js} +99 -42
- package/dist/chunk-6MVFCS46.js.map +1 -0
- package/dist/{chunk-NNPSBC7O.js → chunk-6WZSUS3U.js} +10 -9
- package/dist/chunk-6WZSUS3U.js.map +1 -0
- package/dist/chunk-6YRGP6PS.js +138 -0
- package/dist/chunk-6YRGP6PS.js.map +1 -0
- package/dist/{chunk-B5YHYI7E.js → chunk-ALANKV5Y.js} +23 -6
- package/dist/chunk-ALANKV5Y.js.map +1 -0
- package/dist/{chunk-IA6DCC3N.js → chunk-AUQPNDE5.js} +23 -13
- package/dist/chunk-AUQPNDE5.js.map +1 -0
- package/dist/{chunk-AKXALCUN.js → chunk-D7SW2E24.js} +4 -4
- package/dist/chunk-D7SW2E24.js.map +1 -0
- package/dist/{chunk-OXR7BXZA.js → chunk-DQIYYDFD.js} +4 -3
- package/dist/chunk-DQIYYDFD.js.map +1 -0
- package/dist/{chunk-HMNXNKDA.js → chunk-FCBYUN6F.js} +4 -4
- package/dist/{chunk-HMNXNKDA.js.map → chunk-FCBYUN6F.js.map} +1 -1
- package/dist/{chunk-2W7H43WL.js → chunk-FED6SJWM.js} +23 -14
- package/dist/chunk-FED6SJWM.js.map +1 -0
- package/dist/{chunk-7E7JNWOC.js → chunk-FEPIHXVI.js} +6 -5
- package/dist/chunk-FEPIHXVI.js.map +1 -0
- package/dist/{chunk-Y57NW6G7.js → chunk-G3YOSG3U.js} +4 -4
- package/dist/{chunk-Y57NW6G7.js.map → chunk-G3YOSG3U.js.map} +1 -1
- package/dist/chunk-GZN5CXMR.js +100 -0
- package/dist/chunk-GZN5CXMR.js.map +1 -0
- package/dist/{chunk-HCHGERDB.js → chunk-HCSZPBWV.js} +17 -115
- package/dist/chunk-HCSZPBWV.js.map +1 -0
- package/dist/{chunk-I4B3N3UX.js → chunk-HTVICHT4.js} +12 -7
- package/dist/chunk-HTVICHT4.js.map +1 -0
- package/dist/chunk-I7TC2C3I.js +163 -0
- package/dist/chunk-I7TC2C3I.js.map +1 -0
- package/dist/{chunk-7FPSQBWB.js → chunk-IBXYLO2J.js} +14 -13
- package/dist/chunk-IBXYLO2J.js.map +1 -0
- package/dist/{chunk-7KFUFAVP.js → chunk-IRYG6B5A.js} +9 -8
- package/dist/chunk-IRYG6B5A.js.map +1 -0
- package/dist/{chunk-2RQLPN4U.js → chunk-JCNEW4WJ.js} +8 -8
- package/dist/{chunk-2RQLPN4U.js.map → chunk-JCNEW4WJ.js.map} +1 -1
- package/dist/{chunk-SP6LCCTZ.js → chunk-KZDMVOL6.js} +35 -8
- package/dist/chunk-KZDMVOL6.js.map +1 -0
- package/dist/chunk-LR5U6TZZ.js +169 -0
- package/dist/chunk-LR5U6TZZ.js.map +1 -0
- package/dist/{chunk-MQHD3EJE.js → chunk-LZHZJWVM.js} +6 -4
- package/dist/chunk-LZHZJWVM.js.map +1 -0
- package/dist/{chunk-5EOMSWNO.js → chunk-MAM2X3MW.js} +5 -5
- package/dist/{chunk-5EOMSWNO.js.map → chunk-MAM2X3MW.js.map} +1 -1
- package/dist/{chunk-FSPS7TVD.js → chunk-MCMS4NMO.js} +5 -5
- package/dist/{chunk-FSPS7TVD.js.map → chunk-MCMS4NMO.js.map} +1 -1
- package/dist/{chunk-ZB5VMGKB.js → chunk-MV5DIE2T.js} +15 -4
- package/dist/chunk-MV5DIE2T.js.map +1 -0
- package/dist/chunk-NDI4HLQE.js +41 -0
- package/dist/chunk-NDI4HLQE.js.map +1 -0
- package/dist/{chunk-B4GNSSHU.js → chunk-NLJEQZQQ.js} +3 -3
- package/dist/{chunk-B4GNSSHU.js.map → chunk-NLJEQZQQ.js.map} +1 -1
- package/dist/{chunk-SBZJGFZ6.js → chunk-QHT4DCXE.js} +8 -7
- package/dist/chunk-QHT4DCXE.js.map +1 -0
- package/dist/{chunk-I4IJOLNA.js → chunk-RMUBCTEF.js} +5 -5
- package/dist/{chunk-I4IJOLNA.js.map → chunk-RMUBCTEF.js.map} +1 -1
- package/dist/{chunk-G3AD3NJG.js → chunk-RNTDM3RP.js} +9 -5
- package/dist/chunk-RNTDM3RP.js.map +1 -0
- package/dist/chunk-RPFN6ETQ.js +509 -0
- package/dist/chunk-RPFN6ETQ.js.map +1 -0
- package/dist/{chunk-HWBFRDX7.js → chunk-SI7C3W5M.js} +28 -9
- package/dist/chunk-SI7C3W5M.js.map +1 -0
- package/dist/chunk-TPOV3OCC.js +234 -0
- package/dist/chunk-TPOV3OCC.js.map +1 -0
- package/dist/{chunk-IANYMDKH.js → chunk-UBQ54W46.js} +4 -4
- package/dist/chunk-UBQ54W46.js.map +1 -0
- package/dist/{chunk-QVOBLRCM.js → chunk-UIKQ4X6W.js} +3 -3
- package/dist/{chunk-QVOBLRCM.js.map → chunk-UIKQ4X6W.js.map} +1 -1
- package/dist/chunk-UOWQH53N.js +70 -0
- package/dist/chunk-UOWQH53N.js.map +1 -0
- package/dist/{chunk-QRNQQIQM.js → chunk-WJUY6YWF.js} +52 -20
- package/dist/chunk-WJUY6YWF.js.map +1 -0
- package/dist/{chunk-3KARNPW4.js → chunk-WKIUMLRT.js} +3 -3
- package/dist/{chunk-3KARNPW4.js.map → chunk-WKIUMLRT.js.map} +1 -1
- package/dist/chunk-X6RB74JN.js +37 -0
- package/dist/chunk-X6RB74JN.js.map +1 -0
- package/dist/chunk-XQ6L2CM5.js +83 -0
- package/dist/chunk-XQ6L2CM5.js.map +1 -0
- package/dist/{chunk-RKCUXOU2.js → chunk-YUVKROMA.js} +44 -7
- package/dist/chunk-YUVKROMA.js.map +1 -0
- package/dist/components/action-icon/action-icon.d.ts +9 -2
- package/dist/components/action-icon/action-icon.d.ts.map +1 -1
- package/dist/components/action-icon/index.js +5 -1
- package/dist/components/alert/index.js +4 -4
- package/dist/components/anchor/anchor.d.ts +45 -0
- package/dist/components/anchor/anchor.d.ts.map +1 -0
- package/dist/components/anchor/index.d.ts +2 -0
- package/dist/components/anchor/index.d.ts.map +1 -0
- package/dist/components/anchor/index.js +11 -0
- package/dist/components/anchor/index.js.map +1 -0
- package/dist/components/app-shell/app-shell.d.ts +10 -6
- package/dist/components/app-shell/app-shell.d.ts.map +1 -1
- package/dist/components/app-shell/index.js +23 -24
- package/dist/components/app-shell/index.js.map +1 -1
- package/dist/components/autocomplete/autocomplete.d.ts +1 -1
- package/dist/components/autocomplete/autocomplete.d.ts.map +1 -1
- package/dist/components/autocomplete/index.js +15 -9
- package/dist/components/autocomplete/index.js.map +1 -1
- package/dist/components/avatar/index.js +1 -1
- package/dist/components/button/button.d.ts +15 -2
- package/dist/components/button/button.d.ts.map +1 -1
- package/dist/components/button/index.js +5 -1
- package/dist/components/button-multi-select/index.js +6 -4
- package/dist/components/button-multi-select/index.js.map +1 -1
- package/dist/components/button-select/button-select-control.d.ts.map +1 -1
- package/dist/components/button-select/button-select.d.ts +2 -2
- package/dist/components/button-select/button-select.d.ts.map +1 -1
- package/dist/components/button-select/index.js +6 -4
- package/dist/components/button-select/index.js.map +1 -1
- package/dist/components/calendar/aliases.d.ts +16 -0
- package/dist/components/calendar/aliases.d.ts.map +1 -0
- package/dist/components/calendar/calendar-body.d.ts +11 -1
- package/dist/components/calendar/calendar-body.d.ts.map +1 -1
- package/dist/components/calendar/calendar.d.ts +8 -4
- package/dist/components/calendar/calendar.d.ts.map +1 -1
- package/dist/components/calendar/index.d.ts +2 -1
- package/dist/components/calendar/index.d.ts.map +1 -1
- package/dist/components/calendar/index.js +15 -5
- package/dist/components/calendar/index.js.map +1 -1
- package/dist/components/calendar-heatmap/calendar-heatmap.d.ts.map +1 -1
- package/dist/components/calendar-heatmap/index.js +85 -73
- package/dist/components/calendar-heatmap/index.js.map +1 -1
- package/dist/components/camera/index.js +16 -14
- package/dist/components/carousel/index.js +3 -3
- package/dist/components/checkbox/checkbox.d.ts.map +1 -1
- package/dist/components/checkbox/index.js +2 -2
- package/dist/components/choice-card-group/index.js +2 -2
- package/dist/components/choice-card-group/index.js.map +1 -1
- package/dist/components/circular-progress/circular-progress.d.ts +22 -11
- package/dist/components/circular-progress/circular-progress.d.ts.map +1 -1
- package/dist/components/circular-progress/index.d.ts +1 -1
- package/dist/components/circular-progress/index.d.ts.map +1 -1
- package/dist/components/circular-progress/index.js +68 -49
- package/dist/components/circular-progress/index.js.map +1 -1
- package/dist/components/clipboard/index.js +7 -3
- package/dist/components/clipboard/index.js.map +1 -1
- package/dist/components/code/code.d.ts +10 -0
- package/dist/components/code/code.d.ts.map +1 -1
- package/dist/components/code/index.js +1 -0
- package/dist/components/code/index.js.map +1 -1
- package/dist/components/code-block/chrome.js +10 -6
- package/dist/components/code-block/index.js +10 -7
- package/dist/components/code-block/index.js.map +1 -1
- package/dist/components/combobox/combobox.d.ts +5 -3
- package/dist/components/combobox/combobox.d.ts.map +1 -1
- package/dist/components/combobox/index.js +12 -7
- package/dist/components/combobox-list/combobox-list.d.ts +1 -1
- package/dist/components/combobox-list/combobox-list.d.ts.map +1 -1
- package/dist/components/combobox-list/index.js +14 -9
- package/dist/components/compare/index.js +1 -1
- package/dist/components/data-list/data-list.d.ts +96 -0
- package/dist/components/data-list/data-list.d.ts.map +1 -0
- package/dist/components/data-list/index.d.ts +2 -0
- package/dist/components/data-list/index.d.ts.map +1 -0
- package/dist/components/data-list/index.js +147 -0
- package/dist/components/data-list/index.js.map +1 -0
- package/dist/components/data-table/data-table-group.d.ts.map +1 -1
- package/dist/components/data-table/data-table-placeholder.d.ts +12 -1
- package/dist/components/data-table/data-table-placeholder.d.ts.map +1 -1
- package/dist/components/data-table/data-table-stack.d.ts.map +1 -1
- package/dist/components/data-table/data-table.d.ts +5 -2
- package/dist/components/data-table/data-table.d.ts.map +1 -1
- package/dist/components/data-table/index.js +163 -168
- package/dist/components/data-table/index.js.map +1 -1
- package/dist/components/date-picker/aliases.d.ts +16 -0
- package/dist/components/date-picker/aliases.d.ts.map +1 -1
- package/dist/components/date-picker/date-picker.d.ts +22 -8
- package/dist/components/date-picker/date-picker.d.ts.map +1 -1
- package/dist/components/date-picker/index.d.ts +2 -2
- package/dist/components/date-picker/index.d.ts.map +1 -1
- package/dist/components/date-picker/index.js +34 -28
- package/dist/components/date-picker/index.js.map +1 -1
- package/dist/components/download-button/index.js +6 -2
- package/dist/components/drawer/drawer.d.ts +7 -4
- package/dist/components/drawer/drawer.d.ts.map +1 -1
- package/dist/components/drawer/index.js +11 -6
- package/dist/components/empty-state/empty-state.d.ts +57 -0
- package/dist/components/empty-state/empty-state.d.ts.map +1 -0
- package/dist/components/empty-state/index.d.ts +2 -0
- package/dist/components/empty-state/index.d.ts.map +1 -0
- package/dist/components/empty-state/index.js +8 -0
- package/dist/components/empty-state/index.js.map +1 -0
- package/dist/components/field/field.d.ts +20 -0
- package/dist/components/field/field.d.ts.map +1 -1
- package/dist/components/field/index.js +1 -1
- package/dist/components/fieldset/fieldset.d.ts +103 -0
- package/dist/components/fieldset/fieldset.d.ts.map +1 -0
- package/dist/components/fieldset/index.d.ts +2 -0
- package/dist/components/fieldset/index.d.ts.map +1 -0
- package/dist/components/fieldset/index.js +150 -0
- package/dist/components/fieldset/index.js.map +1 -0
- package/dist/components/file-item/index.js +10 -7
- package/dist/components/file-preview/file-preview.d.ts.map +1 -1
- package/dist/components/file-preview/index.js +10 -18
- package/dist/components/file-preview/index.js.map +1 -1
- package/dist/components/file-trigger/index.js +6 -2
- package/dist/components/file-upload/file-upload.d.ts.map +1 -1
- package/dist/components/file-upload/index.js +18 -14
- package/dist/components/file-upload/index.js.map +1 -1
- package/dist/components/gallery/index.js +3 -3
- package/dist/components/geodesic/a11y.d.ts +3 -3
- package/dist/components/geodesic/a11y.d.ts.map +1 -1
- package/dist/components/hover-card/hover-card.d.ts.map +1 -1
- package/dist/components/hover-card/index.js +10 -3
- package/dist/components/hover-card/index.js.map +1 -1
- package/dist/components/image/index.js +3 -3
- package/dist/components/image-cropper/index.js +9 -6
- package/dist/components/input/index.js +2 -2
- package/dist/components/input/input.d.ts.map +1 -1
- package/dist/components/kbd/index.js +3 -3
- package/dist/components/kbd/kbd.d.ts +4 -0
- package/dist/components/kbd/kbd.d.ts.map +1 -1
- package/dist/components/lightbox/index.js +13 -11
- package/dist/components/lightbox/index.js.map +1 -1
- package/dist/components/menu/index.js +9 -5
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/menu/menu.d.ts.map +1 -1
- package/dist/components/modal/index.js +11 -6
- package/dist/components/modal/modal.d.ts +10 -4
- package/dist/components/modal/modal.d.ts.map +1 -1
- package/dist/components/multi-combobox-list/index.js +13 -9
- package/dist/components/multi-combobox-list/multi-combobox-list.d.ts +1 -1
- package/dist/components/multi-combobox-list/multi-combobox-list.d.ts.map +1 -1
- package/dist/components/multi-select/index.js +13 -10
- package/dist/components/multi-select/index.js.map +1 -1
- package/dist/components/multi-select/multi-select.d.ts +1 -1
- package/dist/components/multi-select/multi-select.d.ts.map +1 -1
- package/dist/components/nav-link/index.js +4 -4
- package/dist/components/nav-link/tanstack.js +4 -4
- package/dist/components/notification/index.js +6 -6
- package/dist/components/notification/index.js.map +1 -1
- package/dist/components/number-input/index.js +11 -7
- package/dist/components/number-input/number-input.d.ts +1 -1
- package/dist/components/number-input/number-input.d.ts.map +1 -1
- package/dist/components/overlays/dialog-parts.d.ts +10 -1
- package/dist/components/overlays/dialog-parts.d.ts.map +1 -1
- package/dist/components/overlays/index.js +13 -8
- package/dist/components/overlays/index.js.map +1 -1
- package/dist/components/pagination/index.d.ts +2 -0
- package/dist/components/pagination/index.d.ts.map +1 -0
- package/dist/components/pagination/index.js +362 -0
- package/dist/components/pagination/index.js.map +1 -0
- package/dist/components/pagination/pagination.d.ts +147 -0
- package/dist/components/pagination/pagination.d.ts.map +1 -0
- package/dist/components/password-input/index.js +6 -5
- package/dist/components/password-input/index.js.map +1 -1
- package/dist/components/password-input/password-input.d.ts +1 -1
- package/dist/components/password-input/password-input.d.ts.map +1 -1
- package/dist/components/phone-input/index.js +14 -11
- package/dist/components/phone-input/index.js.map +1 -1
- package/dist/components/phone-input/phone-input.d.ts +1 -1
- package/dist/components/phone-input/phone-input.d.ts.map +1 -1
- package/dist/components/photo-capture/index.js +19 -17
- package/dist/components/photo-capture/index.js.map +1 -1
- package/dist/components/pills-input/index.js +4 -4
- package/dist/components/pills-input/pills-input.d.ts +1 -1
- package/dist/components/pills-input/pills-input.d.ts.map +1 -1
- package/dist/components/pin-input/index.js +6 -5
- package/dist/components/pin-input/index.js.map +1 -1
- package/dist/components/pin-input/pin-input.d.ts.map +1 -1
- package/dist/components/popover/index.js +7 -2
- package/dist/components/popover/popover.d.ts +41 -16
- package/dist/components/popover/popover.d.ts.map +1 -1
- package/dist/components/progress/index.d.ts +1 -1
- package/dist/components/progress/index.d.ts.map +1 -1
- package/dist/components/progress/index.js +4 -1
- package/dist/components/progress/progress.d.ts +22 -14
- package/dist/components/progress/progress.d.ts.map +1 -1
- package/dist/components/prose/index.d.ts +2 -0
- package/dist/components/prose/index.d.ts.map +1 -0
- package/dist/components/prose/index.js +17 -0
- package/dist/components/prose/index.js.map +1 -0
- package/dist/components/prose/prose.d.ts +49 -0
- package/dist/components/prose/prose.d.ts.map +1 -0
- package/dist/components/prose/styles.css +593 -0
- package/dist/components/radio-group/index.js +9 -3
- package/dist/components/radio-group/index.js.map +1 -1
- package/dist/components/radio-group/radio-group.d.ts.map +1 -1
- package/dist/components/rating/index.js +3 -2
- package/dist/components/rating/index.js.map +1 -1
- package/dist/components/rating/rating.d.ts.map +1 -1
- package/dist/components/schedule/index.js +10 -8
- package/dist/components/schedule/index.js.map +1 -1
- package/dist/components/scroll-area/index.d.ts +2 -0
- package/dist/components/scroll-area/index.d.ts.map +1 -0
- package/dist/components/scroll-area/index.js +10 -0
- package/dist/components/scroll-area/index.js.map +1 -0
- package/dist/components/scroll-area/scroll-area.d.ts +150 -0
- package/dist/components/scroll-area/scroll-area.d.ts.map +1 -0
- package/dist/components/segment-group/index.js +2 -2
- package/dist/components/segment-group/segment-group.d.ts.map +1 -1
- package/dist/components/select/index.js +12 -8
- package/dist/components/select/select.d.ts +1 -1
- package/dist/components/select/select.d.ts.map +1 -1
- package/dist/components/slider/index.js +2 -2
- package/dist/components/slider/slider.d.ts.map +1 -1
- package/dist/components/splitter/index.d.ts +2 -0
- package/dist/components/splitter/index.d.ts.map +1 -0
- package/dist/components/splitter/index.js +373 -0
- package/dist/components/splitter/index.js.map +1 -0
- package/dist/components/splitter/splitter.d.ts +159 -0
- package/dist/components/splitter/splitter.d.ts.map +1 -0
- package/dist/components/spotlight/index.js +23 -22
- package/dist/components/spotlight/index.js.map +1 -1
- package/dist/components/spotlight/spotlight.d.ts.map +1 -1
- package/dist/components/steps/index.d.ts +4 -0
- package/dist/components/steps/index.d.ts.map +1 -0
- package/dist/components/steps/index.js +478 -0
- package/dist/components/steps/index.js.map +1 -0
- package/dist/components/steps/steps-data.d.ts +78 -0
- package/dist/components/steps/steps-data.d.ts.map +1 -0
- package/dist/components/steps/steps.d.ts +183 -0
- package/dist/components/steps/steps.d.ts.map +1 -0
- package/dist/components/switch/index.js +4 -3
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/switch/switch.d.ts.map +1 -1
- package/dist/components/table-of-contents/index.d.ts +2 -0
- package/dist/components/table-of-contents/index.d.ts.map +1 -0
- package/dist/components/table-of-contents/index.js +471 -0
- package/dist/components/table-of-contents/index.js.map +1 -0
- package/dist/components/table-of-contents/table-of-contents.d.ts +173 -0
- package/dist/components/table-of-contents/table-of-contents.d.ts.map +1 -0
- package/dist/components/tags-input/index.js +12 -9
- package/dist/components/tags-input/index.js.map +1 -1
- package/dist/components/tags-input/tags-input.d.ts +1 -1
- package/dist/components/tags-input/tags-input.d.ts.map +1 -1
- package/dist/components/text-input/index.js +2 -2
- package/dist/components/textarea/index.js +8 -6
- package/dist/components/textarea/index.js.map +1 -1
- package/dist/components/textarea/textarea.d.ts.map +1 -1
- package/dist/components/time-input/index.js +11 -9
- package/dist/components/time-input/index.js.map +1 -1
- package/dist/components/timeline/index.js +8 -1
- package/dist/components/timeline/index.js.map +1 -1
- package/dist/components/timeline/timeline.d.ts.map +1 -1
- package/dist/components/tooltip/index.js +1 -1
- package/dist/components/tooltip/tooltip.d.ts +3 -8
- package/dist/components/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/tour/conditions.d.ts +83 -0
- package/dist/components/tour/conditions.d.ts.map +1 -0
- package/dist/components/tour/create-tours.d.ts +49 -0
- package/dist/components/tour/create-tours.d.ts.map +1 -0
- package/dist/components/tour/index.d.ts +6 -0
- package/dist/components/tour/index.d.ts.map +1 -0
- package/dist/components/tour/index.js +1449 -0
- package/dist/components/tour/index.js.map +1 -0
- package/dist/components/tour/runtime.d.ts +57 -0
- package/dist/components/tour/runtime.d.ts.map +1 -0
- package/dist/components/tour/storage.d.ts +14 -0
- package/dist/components/tour/storage.d.ts.map +1 -0
- package/dist/components/tour/store.d.ts +62 -0
- package/dist/components/tour/store.d.ts.map +1 -0
- package/dist/components/tour/tour.d.ts +77 -0
- package/dist/components/tour/tour.d.ts.map +1 -0
- package/dist/components/tour/types.d.ts +680 -0
- package/dist/components/tour/types.d.ts.map +1 -0
- package/dist/components/tree/index.d.ts +3 -0
- package/dist/components/tree/index.d.ts.map +1 -0
- package/dist/components/tree/index.js +457 -0
- package/dist/components/tree/index.js.map +1 -0
- package/dist/components/tree/tree-row.d.ts +72 -0
- package/dist/components/tree/tree-row.d.ts.map +1 -0
- package/dist/components/tree/tree.d.ts +193 -0
- package/dist/components/tree/tree.d.ts.map +1 -0
- package/dist/components/tree-multi-select/index.js +31 -54
- package/dist/components/tree-multi-select/index.js.map +1 -1
- package/dist/components/tree-multi-select/tree-multi-select.d.ts +16 -1
- package/dist/components/tree-multi-select/tree-multi-select.d.ts.map +1 -1
- package/dist/components/tree-select/index.js +30 -24
- package/dist/components/tree-select/index.js.map +1 -1
- package/dist/components/tree-select/tree-popover.d.ts +20 -31
- package/dist/components/tree-select/tree-popover.d.ts.map +1 -1
- package/dist/components/tree-select/tree-select.d.ts +1 -1
- package/dist/components/tree-select/tree-select.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -8
- package/dist/index.js.map +1 -1
- package/dist/lib/date-predicates.d.ts +7 -5
- package/dist/lib/date-predicates.d.ts.map +1 -1
- package/dist/lib/date-value.d.ts +20 -0
- package/dist/lib/date-value.d.ts.map +1 -1
- package/dist/lib/floating-arrow.d.ts +53 -0
- package/dist/lib/floating-arrow.d.ts.map +1 -0
- package/dist/lib/focus-return.d.ts +53 -0
- package/dist/lib/focus-return.d.ts.map +1 -0
- package/dist/lib/meter.d.ts +104 -0
- package/dist/lib/meter.d.ts.map +1 -0
- package/dist/lib/overlay-layer.d.ts +26 -8
- package/dist/lib/overlay-layer.d.ts.map +1 -1
- package/dist/lib/pressed.d.ts +92 -0
- package/dist/lib/pressed.d.ts.map +1 -0
- package/dist/lib/tree-data.d.ts +18 -2
- package/dist/lib/tree-data.d.ts.map +1 -1
- package/dist/lib/use-pagination.d.ts +102 -0
- package/dist/lib/use-pagination.d.ts.map +1 -0
- package/dist/lib/use-scroll-spy.d.ts +126 -0
- package/dist/lib/use-scroll-spy.d.ts.map +1 -0
- package/dist/theme.css +39 -3
- package/package.json +1 -1
- package/src/as-child.contract.test.tsx +283 -1
- package/src/components/action-icon/action-icon.tsx +34 -4
- package/src/components/anchor/anchor.test.tsx +232 -0
- package/src/components/anchor/anchor.tsx +187 -0
- package/src/components/anchor/index.ts +12 -0
- package/src/components/app-shell/app-shell.test.tsx +15 -7
- package/src/components/app-shell/app-shell.tsx +27 -20
- package/src/components/autocomplete/autocomplete.tsx +11 -3
- package/src/components/button/button-pressed.test.tsx +202 -0
- package/src/components/button/button.tsx +48 -6
- package/src/components/button-select/button-select-control.tsx +2 -2
- package/src/components/button-select/button-select.tsx +22 -2
- package/src/components/calendar/aliases.tsx +28 -0
- package/src/components/calendar/calendar-body.tsx +310 -210
- package/src/components/calendar/calendar.tsx +43 -12
- package/src/components/calendar/index.ts +7 -1
- package/src/components/calendar/month-year-calendar.test.tsx +106 -0
- package/src/components/calendar-heatmap/calendar-heatmap.tsx +88 -73
- package/src/components/checkbox/checkbox.tsx +7 -2
- package/src/components/choice-card-group/choice-card-group.tsx +2 -2
- package/src/components/circular-progress/circular-progress.test.tsx +35 -0
- package/src/components/circular-progress/circular-progress.tsx +116 -59
- package/src/components/circular-progress/index.ts +1 -0
- package/src/components/code/code.test.tsx +16 -0
- package/src/components/code/code.tsx +11 -0
- package/src/components/combobox/combobox.tsx +63 -28
- package/src/components/combobox-list/combobox-list.tsx +11 -3
- package/src/components/data-list/data-list.test.tsx +149 -0
- package/src/components/data-list/data-list.tsx +268 -0
- package/src/components/data-list/index.ts +9 -0
- package/src/components/data-table/data-table-group.test.tsx +16 -0
- package/src/components/data-table/data-table-group.tsx +15 -2
- package/src/components/data-table/data-table-placeholder.tsx +28 -36
- package/src/components/data-table/data-table-stack.tsx +33 -39
- package/src/components/data-table/data-table.test.tsx +31 -0
- package/src/components/data-table/data-table.tsx +41 -42
- package/src/components/date-picker/aliases.tsx +28 -0
- package/src/components/date-picker/date-picker.test.tsx +29 -0
- package/src/components/date-picker/date-picker.tsx +164 -45
- package/src/components/date-picker/index.ts +5 -1
- package/src/components/date-picker/month-year-picker.test.tsx +362 -0
- package/src/components/drawer/drawer.test.tsx +41 -0
- package/src/components/drawer/drawer.tsx +7 -1
- package/src/components/empty-state/empty-state.test.tsx +109 -0
- package/src/components/empty-state/empty-state.tsx +180 -0
- package/src/components/empty-state/index.ts +9 -0
- package/src/components/field/field.tsx +35 -1
- package/src/components/fieldset/fieldset.test.tsx +352 -0
- package/src/components/fieldset/fieldset.tsx +268 -0
- package/src/components/fieldset/index.ts +11 -0
- package/src/components/file-preview/file-preview.test.tsx +2 -1
- package/src/components/file-preview/file-preview.tsx +7 -13
- package/src/components/file-upload/file-upload.tsx +14 -5
- package/src/components/hover-card/hover-card.tsx +5 -1
- package/src/components/input/input.tsx +12 -5
- package/src/components/kbd/kbd.test.tsx +13 -0
- package/src/components/kbd/kbd.tsx +6 -0
- package/src/components/menu/menu.tsx +6 -2
- package/src/components/modal/modal.test.tsx +41 -0
- package/src/components/modal/modal.tsx +17 -9
- package/src/components/multi-combobox-list/multi-combobox-list.tsx +11 -3
- package/src/components/multi-select/multi-select.tsx +11 -3
- package/src/components/notification/create-notifier.tsx +1 -1
- package/src/components/number-input/number-input.tsx +12 -3
- package/src/components/overlays/dialog-parts.tsx +42 -5
- package/src/components/pagination/index.ts +19 -0
- package/src/components/pagination/pagination.test.tsx +187 -0
- package/src/components/pagination/pagination.tsx +563 -0
- package/src/components/password-input/password-input.tsx +12 -3
- package/src/components/phone-input/phone-input.tsx +12 -3
- package/src/components/pills-input/pills-input.tsx +7 -2
- package/src/components/pin-input/pin-input.tsx +13 -4
- package/src/components/popover/popover.tsx +87 -17
- package/src/components/progress/index.ts +1 -0
- package/src/components/progress/progress.test.tsx +102 -0
- package/src/components/progress/progress.tsx +116 -62
- package/src/components/prose/index.ts +1 -0
- package/src/components/prose/prose.test.tsx +90 -0
- package/src/components/prose/prose.tsx +60 -0
- package/src/components/prose/styles.css +593 -0
- package/src/components/radio-group/radio-group.tsx +8 -3
- package/src/components/rating/rating.tsx +5 -2
- package/src/components/scroll-area/index.ts +18 -0
- package/src/components/scroll-area/scroll-area.test.tsx +184 -0
- package/src/components/scroll-area/scroll-area.tsx +448 -0
- package/src/components/segment-group/segment-group.tsx +2 -2
- package/src/components/select/select.tsx +37 -18
- package/src/components/slider/slider.tsx +2 -2
- package/src/components/splitter/index.ts +15 -0
- package/src/components/splitter/splitter.test.tsx +244 -0
- package/src/components/splitter/splitter.tsx +625 -0
- package/src/components/spotlight/spotlight.test.tsx +34 -26
- package/src/components/spotlight/spotlight.tsx +7 -9
- package/src/components/steps/index.ts +21 -0
- package/src/components/steps/steps-data.tsx +179 -0
- package/src/components/steps/steps.test.tsx +235 -0
- package/src/components/steps/steps.tsx +686 -0
- package/src/components/switch/switch.tsx +7 -2
- package/src/components/table-of-contents/index.ts +17 -0
- package/src/components/table-of-contents/table-of-contents.test.tsx +289 -0
- package/src/components/table-of-contents/table-of-contents.tsx +708 -0
- package/src/components/tags-input/tags-input.tsx +12 -3
- package/src/components/textarea/textarea.tsx +15 -5
- package/src/components/timeline/timeline.test.tsx +22 -0
- package/src/components/timeline/timeline.tsx +10 -1
- package/src/components/tooltip/tooltip.tsx +8 -17
- package/src/components/tour/conditions.test.ts +527 -0
- package/src/components/tour/conditions.ts +445 -0
- package/src/components/tour/create-tours.tsx +150 -0
- package/src/components/tour/index.ts +86 -0
- package/src/components/tour/runtime.ts +187 -0
- package/src/components/tour/storage.test.ts +68 -0
- package/src/components/tour/storage.ts +44 -0
- package/src/components/tour/store.test.tsx +784 -0
- package/src/components/tour/store.ts +661 -0
- package/src/components/tour/tour.test.tsx +318 -0
- package/src/components/tour/tour.tsx +773 -0
- package/src/components/tour/tour.types.test.ts +185 -0
- package/src/components/tour/types.ts +904 -0
- package/src/components/tree/index.ts +24 -0
- package/src/components/tree/tree-row.tsx +179 -0
- package/src/components/tree/tree.test.tsx +296 -0
- package/src/components/tree/tree.tsx +796 -0
- package/src/components/tree-multi-select/tree-multi-select.tsx +29 -58
- package/src/components/tree-select/tree-popover.tsx +26 -107
- package/src/components/tree-select/tree-select.tsx +24 -16
- package/src/icon-stroke.test.tsx +2 -0
- package/src/index.ts +16 -0
- package/src/lib/date-predicates.test.ts +46 -0
- package/src/lib/date-predicates.ts +44 -24
- package/src/lib/date-value.test.ts +24 -1
- package/src/lib/date-value.ts +42 -1
- package/src/lib/floating-arrow.tsx +73 -0
- package/src/lib/focus-return.test.tsx +143 -0
- package/src/lib/focus-return.ts +106 -0
- package/src/lib/meter.test.ts +40 -0
- package/src/lib/meter.ts +159 -0
- package/src/lib/overlay-layer.test.tsx +47 -1
- package/src/lib/overlay-layer.tsx +65 -8
- package/src/lib/pressed.ts +130 -0
- package/src/lib/tree-data.ts +42 -2
- package/src/lib/use-pagination.test.ts +105 -0
- package/src/lib/use-pagination.ts +179 -0
- package/src/lib/use-scroll-spy.test.tsx +238 -0
- package/src/lib/use-scroll-spy.ts +336 -0
- package/src/theme.css +39 -3
- package/src/theme.test.ts +29 -1
- package/src/visually-hidden-containment.test.tsx +9 -0
- package/dist/chunk-2W7H43WL.js.map +0 -1
- package/dist/chunk-7E7JNWOC.js.map +0 -1
- package/dist/chunk-7FPSQBWB.js.map +0 -1
- package/dist/chunk-7KFUFAVP.js.map +0 -1
- package/dist/chunk-AKXALCUN.js.map +0 -1
- package/dist/chunk-B5YHYI7E.js.map +0 -1
- package/dist/chunk-FQJNQW3G.js.map +0 -1
- package/dist/chunk-G3AD3NJG.js.map +0 -1
- package/dist/chunk-GEZYGBXY.js.map +0 -1
- package/dist/chunk-HCHGERDB.js.map +0 -1
- package/dist/chunk-HWBFRDX7.js.map +0 -1
- package/dist/chunk-I4B3N3UX.js.map +0 -1
- package/dist/chunk-IA6DCC3N.js.map +0 -1
- package/dist/chunk-IANYMDKH.js.map +0 -1
- package/dist/chunk-MQHD3EJE.js.map +0 -1
- package/dist/chunk-NNPSBC7O.js.map +0 -1
- package/dist/chunk-OXR7BXZA.js.map +0 -1
- package/dist/chunk-QKSLDQM2.js +0 -120
- package/dist/chunk-QKSLDQM2.js.map +0 -1
- package/dist/chunk-QRNQQIQM.js.map +0 -1
- package/dist/chunk-RKCUXOU2.js.map +0 -1
- package/dist/chunk-S5CQRCTF.js +0 -426
- package/dist/chunk-S5CQRCTF.js.map +0 -1
- package/dist/chunk-SBZJGFZ6.js.map +0 -1
- package/dist/chunk-SP6LCCTZ.js.map +0 -1
- package/dist/chunk-TUP7WXQE.js.map +0 -1
- package/dist/chunk-V2QZG4IT.js.map +0 -1
- package/dist/chunk-X6DESK37.js.map +0 -1
- package/dist/chunk-ZB5VMGKB.js.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { normalizeSelectData } from './chunk-7TDHT3QD.js';
|
|
2
|
-
import { COMBOBOX_DEFAULT_TRANSLATIONS } from './chunk-
|
|
2
|
+
import { COMBOBOX_DEFAULT_TRANSLATIONS } from './chunk-WJUY6YWF.js';
|
|
3
3
|
import { controlOpenProps } from './chunk-5FDOOG4J.js';
|
|
4
|
-
import { inputSlot, placeholderColor, shellGap, inputShell } from './chunk-
|
|
5
|
-
import { FieldShell, fieldA11yProps } from './chunk-
|
|
4
|
+
import { inputSlot, placeholderColor, shellGap, inputShell } from './chunk-HTVICHT4.js';
|
|
5
|
+
import { useInheritedDisabled, useInheritedInvalid, FieldShell, fieldA11yProps } from './chunk-2RRTT4AF.js';
|
|
6
|
+
import { scrollHighlightedIntoView, popoverClearTrigger, popoverChevron, ListboxScrollArea, listboxList, popoverGroupLabel, popoverContent, popoverIndicator, popoverOption } from './chunk-YUVKROMA.js';
|
|
7
|
+
import { useTourRaised, NestedLayer } from './chunk-SI7C3W5M.js';
|
|
6
8
|
import { useMergedRefs } from './chunk-HBWV5EPU.js';
|
|
7
|
-
import { scrollHighlightedIntoView, popoverClearTrigger, popoverChevron, popoverGroupLabel, popoverList, popoverContent, popoverIndicator, popoverOption } from './chunk-RKCUXOU2.js';
|
|
8
|
-
import { NestedLayer } from './chunk-HWBFRDX7.js';
|
|
9
9
|
import { useOverlayContainer } from './chunk-SLUOF7XW.js';
|
|
10
10
|
import { CloseIcon, ChevronIcon, CheckIcon } from './chunk-6YNLRQ25.js';
|
|
11
11
|
import { props } from './chunk-WYCMIIRR.js';
|
|
@@ -54,7 +54,7 @@ var Select = ({
|
|
|
54
54
|
size = "md",
|
|
55
55
|
variant = "default",
|
|
56
56
|
color,
|
|
57
|
-
disabled,
|
|
57
|
+
disabled: disabledProp,
|
|
58
58
|
readOnly,
|
|
59
59
|
required,
|
|
60
60
|
invalid,
|
|
@@ -72,11 +72,13 @@ var Select = ({
|
|
|
72
72
|
}) => {
|
|
73
73
|
const resolvedTranslations = { ...COMBOBOX_DEFAULT_TRANSLATIONS, ...translations };
|
|
74
74
|
const portalContainer = useOverlayContainer(container);
|
|
75
|
+
const raised = useTourRaised(true);
|
|
75
76
|
const { collection, items, groups } = useMemo(() => normalizeSelectData(data), [data]);
|
|
76
77
|
const controlRef = useRef(null);
|
|
77
78
|
const triggerRef = useRef(null);
|
|
78
79
|
const mergedTriggerRef = useMergedRefs(triggerRef, ref);
|
|
79
|
-
const
|
|
80
|
+
const disabled = useInheritedDisabled(disabledProp);
|
|
81
|
+
const isInvalid = useInheritedInvalid(invalid || error != null);
|
|
80
82
|
const selected = items.find(({ value: iv }) => value === iv);
|
|
81
83
|
const renderOption = (item) => /* @__PURE__ */ jsx(
|
|
82
84
|
Select$1.Item,
|
|
@@ -192,10 +194,18 @@ var Select = ({
|
|
|
192
194
|
);
|
|
193
195
|
} }),
|
|
194
196
|
/* @__PURE__ */ jsx(Select$1.Context, { children: (api) => /* @__PURE__ */ jsx(NestedLayer, { open: api.open }) }),
|
|
195
|
-
/* @__PURE__ */ jsx(Portal, { disabled: !withinPortal, container: portalContainer, children: /* @__PURE__ */ jsx(Select$1.Positioner, { children: /* @__PURE__ */ jsx(
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
197
|
+
/* @__PURE__ */ jsx(Portal, { disabled: !withinPortal, container: portalContainer, children: /* @__PURE__ */ jsx(Select$1.Positioner, { children: /* @__PURE__ */ jsx(
|
|
198
|
+
Select$1.Content,
|
|
199
|
+
{
|
|
200
|
+
"data-color": color,
|
|
201
|
+
"data-raised": raised || void 0,
|
|
202
|
+
className: cn(popoverContent, classNames?.popover),
|
|
203
|
+
children: /* @__PURE__ */ jsx(ListboxScrollArea, { children: /* @__PURE__ */ jsx(Select$1.List, { className: listboxList, children: groups ? groups.map((group) => /* @__PURE__ */ jsxs(Select$1.ItemGroup, { children: [
|
|
204
|
+
/* @__PURE__ */ jsx(Select$1.ItemGroupLabel, { className: popoverGroupLabel, children: group.group }),
|
|
205
|
+
group.items.map(renderOption)
|
|
206
|
+
] }, group.group)) : items.map(renderOption) }) })
|
|
207
|
+
}
|
|
208
|
+
) }) }),
|
|
199
209
|
/* @__PURE__ */ jsx(Select$1.HiddenSelect, { ...selectProps })
|
|
200
210
|
]
|
|
201
211
|
}
|
|
@@ -217,5 +227,5 @@ var Select = ({
|
|
|
217
227
|
};
|
|
218
228
|
|
|
219
229
|
export { Select };
|
|
220
|
-
//# sourceMappingURL=chunk-
|
|
221
|
-
//# sourceMappingURL=chunk-
|
|
230
|
+
//# sourceMappingURL=chunk-AUQPNDE5.js.map
|
|
231
|
+
//# sourceMappingURL=chunk-AUQPNDE5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/select/select.tsx"],"names":["Ark"],"mappings":";;;;;;;;;;;;;;;;;;AAuJA,IAAM,UAAA,GAAa,CAAC,CAAA,KAClB,CAAA,KAAM,MAAA,GAAY,MAAA,GAAY,CAAA,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H;AAEJ","file":"chunk-AUQPNDE5.js","sourcesContent":["\"use client\"\n\nimport { useFieldContext } from \"@ark-ui/react/field\"\nimport { Portal } from \"@ark-ui/react/portal\"\nimport { Select as Ark } from \"@ark-ui/react/select\"\nimport {\n type ComponentProps,\n type FocusEvent,\n type ReactNode,\n type Ref,\n useMemo,\n useRef,\n} from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { controlOpenProps } from \"../../lib/control-open\"\nimport { useMergedRefs } from \"../../lib/merge-refs\"\nimport { useOverlayContainer } from \"../../lib/overlay-container\"\nimport { NestedLayer, useTourRaised } from \"../../lib/overlay-layer\"\nimport { props } from \"../../lib/props\"\nimport {\n type ClearSectionMode,\n type NormalizedItem,\n type NormalizedItemOf,\n normalizeSelectData,\n type RenderItem,\n type SelectData,\n type SelectValue,\n} from \"../../lib/select-data\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { COMBOBOX_DEFAULT_TRANSLATIONS, type ComboboxTranslations } from \"../combobox/combobox\"\nimport {\n type FieldProps,\n FieldShell,\n fieldA11yProps,\n useInheritedDisabled,\n useInheritedInvalid,\n} from \"../field/field\"\nimport {\n type InputSize,\n type InputVariant,\n inputShell,\n inputSlot,\n placeholderColor,\n shellGap,\n} from \"../input/input\"\nimport { CheckIcon, ChevronIcon, CloseIcon } from \"../popover/icons\"\nimport {\n ListboxScrollArea,\n listboxList,\n popoverChevron,\n popoverClearTrigger,\n popoverContent,\n popoverGroupLabel,\n popoverIndicator,\n popoverOption,\n scrollHighlightedIntoView,\n} from \"../popover/popover\"\n\n/**\n * Select — data-driven single-value picker on Ark UI's Select machine. Pass\n * `data` and it renders: a styled trigger, a popover of options, native form\n * submission (hidden `<select>`), typeahead, and full keyboard / RTL / ARIA from\n * Ark. For a *searchable* picker use `Autocomplete`; for multiple values use\n * `MultiSelect`.\n *\n * - `data` accepts `string[]`, `{ value, label?, disabled? }[]`, or grouped\n * `{ group, items }[]` (see `SelectData`).\n * - Value is a single `string | null`; the machine's array contract is hidden.\n * - Label / description / error come from the built-in `Field` wrapper, so a\n * `Select` is accessible and complete on its own.\n * - `clearable` swaps the chevron for a clear button once a value is set.\n *\n * Palette rides on `data-color`; the trigger reuses the shared input shell and\n * the popover the shared option styling, so Select and Combobox look identical.\n */\n\ntype SelectClassNames = {\n field?: string\n /** The label element itself — e.g. `\"sr-only\"` to keep the accessible name\n * without showing it (pair with a sibling element for a visible label\n * placed elsewhere in the layout). */\n label?: string\n control?: string\n option?: string\n popover?: string\n}\n\nexport type SelectProps<Data extends SelectData = SelectData> = Pick<\n FieldProps,\n \"label\" | \"description\" | \"error\" | \"required\"\n> &\n WithTestId & {\n /** Options: `string[]`, `{ value, label?, disabled? }[]`, or `{ group, items }[]`. */\n data: Data\n /** Controlled value. */\n value?: SelectValue<Data> | null\n /** Uncontrolled initial value. */\n defaultValue?: SelectValue<Data> | null\n /** Fires with the selected value (or `null` when cleared). */\n onChange?: (value: SelectValue<Data> | null) => void\n /**\n * Render each option yourself. Receives the (value-narrowed) item and its live\n * `{ selected, highlighted }` state; you own the whole row, including any check\n * affordance. Omit it to render the label + selected check.\n */\n renderItem?: RenderItem<Data>\n /** Placeholder shown while no value is selected. */\n placeholder?: string\n /** Show a clear button (and allow deselecting) once a value is set. */\n clearable?: boolean\n /** Whether the clear button replaces the chevron (`\"replace\"`, default) or sits beside it (`\"both\"`). */\n clearSectionMode?: ClearSectionMode\n /** Inline-start adornment (icon, label). */\n startSlot?: ReactNode\n /** Inline-end adornment — rendered before the chevron / clear button. */\n endSlot?: ReactNode\n size?: InputSize\n variant?: InputVariant\n color?: Color\n disabled?: boolean\n readOnly?: boolean\n /** Red invalid state, independent of (and OR'd with) `error`. */\n invalid?: boolean\n /** Wires the hidden `<select>` into native form submission. */\n name?: string\n /** Forwarded to the trigger; drives touched/blurred validation. */\n onBlur?: (event: FocusEvent<HTMLButtonElement>) => void\n /** Lands on the trigger `<button>` for focus-on-error. */\n ref?: Ref<HTMLButtonElement>\n /** Render the panel in a Portal so it escapes clipping ancestors.\n * Default `true`. */\n withinPortal?: boolean\n /** Portal target. Defaults to the enclosing `Modal`/`Drawer` when there is\n * one (so the panel stays above it), else `document.body`. */\n container?: HTMLElement | null\n className?: string\n classNames?: SelectClassNames\n /** Overrides the clear button's (`clearTriggerLabel`, default `\"Clear value\"`) and the\n * chevron's (`triggerLabel`, default `\"Show options\"`) accessible names — the same keys as\n * the rest of the combobox family. A partial override keeps the other default. */\n translations?: SelectTranslations\n }\n\n/** Ark's own Select `translations` type (its `clearTriggerLabel`), derived structurally rather\n * than imported from `@zag-js/select`, plus the combobox family's `triggerLabel` for the\n * kit's own chevron button. */\nexport type SelectTranslations = NonNullable<Ark.RootProps<NormalizedItem>[\"translations\"]> &\n Pick<ComboboxTranslations, \"triggerLabel\">\n\n/** Wrap a scalar value into Ark's array contract (or clear with `[]`). */\nconst toArkValue = (v: string | null | undefined): string[] | undefined =>\n v === undefined ? undefined : v === null ? [] : [v]\n\n/**\n * The real, focusable `<button role=\"combobox\">`, split out so it reads the\n * `Field` context from *inside* the wrapping `FieldShell` — `Select` itself\n * renders that shell, so calling `useFieldContext()` at its own top level\n * would run too early.\n */\nconst SelectTrigger = ({\n ref,\n onBlur,\n invalid,\n testId,\n className,\n children,\n}: {\n ref?: Ref<HTMLButtonElement>\n onBlur?: (event: FocusEvent<HTMLButtonElement>) => void\n invalid: boolean\n className?: string\n children: ReactNode\n} & WithTestId) => {\n const field = useFieldContext()\n return (\n <Ark.Trigger\n ref={ref}\n onBlur={onBlur}\n {...props({ \"aria-invalid\": invalid, \"data-testid\": testId })}\n {...fieldA11yProps(field)}\n className={className}\n >\n {children}\n </Ark.Trigger>\n )\n}\n\nexport const Select = <const Data extends SelectData = SelectData>({\n withinPortal = true,\n container,\n data,\n value,\n defaultValue,\n onChange,\n renderItem,\n placeholder = \"Pick a value\",\n clearable,\n clearSectionMode = \"replace\",\n startSlot,\n endSlot,\n size = \"md\",\n variant = \"default\",\n color,\n disabled: disabledProp,\n readOnly,\n required,\n invalid,\n name,\n onBlur,\n ref,\n label,\n description,\n error,\n className,\n classNames,\n testId,\n translations,\n ...selectProps\n}: SelectProps<Data> & Omit<ComponentProps<\"select\">, keyof SelectProps>) => {\n const resolvedTranslations = { ...COMBOBOX_DEFAULT_TRANSLATIONS, ...translations }\n const portalContainer = useOverlayContainer(container)\n // Lifted above a running tour while open; see `useTourRaised`. The list's\n // `open` only exists inside `Ark.Context`, and a closed list ignores it.\n const raised = useTourRaised(true)\n const { collection, items, groups } = useMemo(() => normalizeSelectData(data), [data])\n const controlRef = useRef<HTMLDivElement>(null)\n const triggerRef = useRef<HTMLButtonElement>(null)\n const mergedTriggerRef = useMergedRefs(triggerRef, ref)\n // With no `label` there is no `Field` to pass a `Fieldset`'s state on, so\n // read it here: the shell, the pills and the clear button all key off it.\n const disabled = useInheritedDisabled(disabledProp)\n // Red state is driven independently of the `Field` error slot so a form\n // library can flip it from `fieldState.invalid` (see FormControlProps).\n const isInvalid = useInheritedInvalid(invalid || error != null)\n const selected = items.find(({ value: iv }) => value === iv)\n\n const renderOption = (item: NormalizedItemOf<Data>) => (\n <Ark.Item\n key={item.value}\n item={item}\n data-testid={item.testId}\n className={cn(popoverOption({ size }), classNames?.option)}\n >\n {renderItem ? (\n <Ark.ItemContext>\n {(ctx) =>\n renderItem(item, {\n selected: ctx.selected,\n highlighted: ctx.highlighted,\n })\n }\n </Ark.ItemContext>\n ) : (\n <>\n <Ark.ItemText>{item.label}</Ark.ItemText>\n <Ark.ItemIndicator className={popoverIndicator}>\n <CheckIcon />\n </Ark.ItemIndicator>\n </>\n )}\n </Ark.Item>\n )\n\n const control = (\n <Ark.Root\n collection={collection}\n value={toArkValue(value)}\n defaultValue={toArkValue(defaultValue)}\n // The machine's collection is typed by value (`string`); the runtime value\n // always originates from `data`, so narrow it back to the caller's value union.\n onValueChange={\n onChange ? (d) => onChange((d.value[0] ?? null) as SelectValue<Data> | null) : undefined\n }\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n name={name}\n deselectable={clearable}\n translations={resolvedTranslations}\n // Ark anchors Select's positioner to the Trigger, which sits inside the\n // padded `inputShell` Control — so `sameWidth` would inset the panel. Anchor\n // to the full Control instead (matching Combobox), so the panel aligns with\n // and matches the trigger's width.\n positioning={{\n sameWidth: true,\n getAnchorRect: () => controlRef.current?.getBoundingClientRect() ?? null,\n }}\n // Content is an `overflow-hidden` clip wrapper, so the machine's native\n // auto-scroll (which needs Content scrollable) no-ops; route scrolling to\n // the inner List scroller instead.\n scrollToIndexFn={scrollHighlightedIntoView}\n data-color={color}\n // `relative` contains the absolutely positioned hidden input, which would\n // otherwise escape any scroller this control sits in.\n className={cn(\"relative w-full\", className)}\n >\n <Ark.Context>\n {(api) => {\n const showClear = Boolean(clearable) && api.hasSelectedItems && !disabled && !readOnly\n const showChevron = clearSectionMode === \"both\" || !showClear\n return (\n <Ark.Control\n ref={controlRef}\n {...props({\n \"data-invalid\": isInvalid,\n \"data-with-start-slot\": startSlot != null,\n // The trigger always ends in a chevron / clear control.\n \"data-with-end-slot\": true,\n })}\n // Tablet affordance: a tap on the shell's dead zones (padding) opens\n // the menu too, not just the trigger. The trigger, clear and chevron\n // are all buttons, so the helper skips them and they self-handle.\n // Inert when disabled / readOnly, so it never opens where the trigger won't.\n {...(disabled || readOnly ? {} : controlOpenProps(() => api.setOpen(true)))}\n className={cn(inputShell({ size, variant }), \"cursor-pointer\", classNames?.control)}\n >\n <SelectTrigger\n ref={mergedTriggerRef}\n onBlur={onBlur}\n invalid={isInvalid}\n testId={testId}\n className={cn(\n \"flex min-w-0 flex-1 cursor-pointer items-center bg-transparent text-start outline-none disabled:cursor-not-allowed\",\n // Slots live inside the trigger (not the shell), so re-apply the\n // shell's per-size gap here to space the icon from the value.\n shellGap[size],\n )}\n >\n {startSlot != null && (\n <span className={inputSlot} aria-hidden>\n {startSlot}\n </span>\n )}\n <span className=\"min-w-0 flex-1 truncate text-start\">\n {api.hasSelectedItems ? (\n renderItem && selected ? (\n renderItem(selected, {\n selected: false,\n highlighted: false,\n })\n ) : (\n api.valueAsString\n )\n ) : (\n <span className={placeholderColor}>{placeholder}</span>\n )}\n </span>\n {endSlot != null && <span className={inputSlot}>{endSlot}</span>}\n </SelectTrigger>\n {showClear && (\n <Ark.ClearTrigger className={popoverClearTrigger}>\n <CloseIcon />\n </Ark.ClearTrigger>\n )}\n {showChevron && (\n // A sibling toggle button (the value `Ark.Trigger` can't nest it\n // next to the clear button), so the chevron sits at the far edge\n // like the rest of the family. Focus the trigger first so keyboard\n // nav stays on the combobox; `preventDefault` stops the tap from\n // stealing focus to this button. `tabIndex=-1`: the trigger is the\n // tab stop.\n <button\n type=\"button\"\n tabIndex={-1}\n aria-label={resolvedTranslations.triggerLabel}\n data-chevron\n className={cn(\n popoverChevron,\n \"inline-flex cursor-pointer items-center justify-center rounded-sm data-disabled:cursor-not-allowed\",\n api.open && \"rotate-180\",\n )}\n {...props({\n \"data-disabled\": disabled,\n \"data-readonly\": readOnly,\n })}\n onPointerDown={(event) => event.preventDefault()}\n {...(!(disabled || readOnly) && {\n onClick: () => {\n triggerRef.current?.focus()\n api.setOpen(!api.open)\n },\n })}\n >\n <ChevronIcon />\n </button>\n )}\n </Ark.Control>\n )\n }}\n </Ark.Context>\n\n {/* Holds an enclosing Modal/Drawer/Popover open while the list is; see `lib/overlay-layer.tsx`. */}\n <Ark.Context>{(api) => <NestedLayer open={api.open} />}</Ark.Context>\n <Portal disabled={!withinPortal} container={portalContainer}>\n <Ark.Positioner>\n <Ark.Content\n data-color={color}\n data-raised={raised || undefined}\n className={cn(popoverContent, classNames?.popover)}\n >\n <ListboxScrollArea>\n <Ark.List className={listboxList}>\n {groups\n ? groups.map((group) => (\n <Ark.ItemGroup key={group.group}>\n <Ark.ItemGroupLabel className={popoverGroupLabel}>\n {group.group}\n </Ark.ItemGroupLabel>\n {group.items.map(renderOption)}\n </Ark.ItemGroup>\n ))\n : items.map(renderOption)}\n </Ark.List>\n </ListboxScrollArea>\n </Ark.Content>\n </Ark.Positioner>\n </Portal>\n\n <Ark.HiddenSelect {...selectProps} />\n </Ark.Root>\n )\n\n return (\n <FieldShell\n label={label}\n description={description}\n error={error}\n required={required}\n disabled={disabled}\n size={size}\n className={classNames?.field}\n classNames={{ label: classNames?.label }}\n >\n {control}\n </FieldShell>\n )\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FieldShell, fieldA11yProps } from './chunk-
|
|
1
|
+
import { useInheritedInvalid, FieldShell, fieldA11yProps } from './chunk-2RRTT4AF.js';
|
|
2
2
|
import { props } from './chunk-WYCMIIRR.js';
|
|
3
3
|
import { focusStyles } from './chunk-C6NVU4F7.js';
|
|
4
4
|
import { TYPOGRAPHY_SHADE_CLASSES } from './chunk-GIPQUKCN.js';
|
|
@@ -166,7 +166,7 @@ var Slider = ({
|
|
|
166
166
|
const withThumbLabel = thumbLabel != null && showThumbLabel !== "never" && showThumbLabel !== false;
|
|
167
167
|
const renderThumbLabel = (val) => typeof thumbLabel === "function" ? thumbLabel(val) : thumbLabel;
|
|
168
168
|
const showMarks = marks !== null && marks !== void 0 && marks.length > 0;
|
|
169
|
-
const isInvalid = invalid || error != null;
|
|
169
|
+
const isInvalid = useInheritedInvalid(invalid || error != null);
|
|
170
170
|
const isRange = Array.isArray(value ?? defaultValue);
|
|
171
171
|
const emit = (next) => isRange ? next : next[0] ?? 0;
|
|
172
172
|
const thumbDiameter = THUMB_DIAMETER_PX[size ?? "md"];
|
|
@@ -289,5 +289,5 @@ var Slider = ({
|
|
|
289
289
|
};
|
|
290
290
|
|
|
291
291
|
export { Slider };
|
|
292
|
-
//# sourceMappingURL=chunk-
|
|
293
|
-
//# sourceMappingURL=chunk-
|
|
292
|
+
//# sourceMappingURL=chunk-D7SW2E24.js.map
|
|
293
|
+
//# sourceMappingURL=chunk-D7SW2E24.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/slider/slider.tsx"],"names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AA,gBAEC,QAAA,EAAA,KAAA,CAAM,GAAA,CAAI,CAAC,CAAA,qBACV,GAAA;AAAA,kBAACA,QAAA,CAAI,MAAA;AAAA,kBAAJ;AAAA,oBAEC,OAAO,CAAA,CAAE,KAAA;AAAA,oBACT,SAAA,EAAW,GAAG,UAAA,CAAW,EAAE,MAAM,CAAA,EAAG,YAAY,IAAI,CAAA;AAAA,oBAEnD,QAAA,EAAA,CAAA,CAAE,UAAU,MAAA,oBACX,GAAA;AAAA,sBAAC,MAAA;AAAA,sBAAA;AAAA,wBACC,SAAA,EAAW,EAAA;AAAA,0BACT,mDAAA;AAAA,0BACA,SAAA;AAAA,0BACA,wBAAA,CAAyB,KAAA;AAAA,0BACzB,UAAA,EAAY;AAAA,yBACd;AAAA,wBAEC,QAAA,EAAA,CAAA,CAAE;AAAA;AAAA;AACL,mBAAA;AAAA,kBAdG,CAAA,CAAE;AAAA,iBAiBV;AAAA;AAAA,aACH,EACF;AAAA;AAAA;AAAA;AAEJ;AAAA,GACF;AAEJ","file":"chunk-D7SW2E24.js","sourcesContent":["\"use client\"\n\nimport { useFieldContext } from \"@ark-ui/react/field\"\nimport { Slider as Ark } from \"@ark-ui/react/slider\"\nimport { cva } from \"class-variance-authority\"\nimport type { ComponentProps, ComponentPropsWithoutRef, FocusEvent, ReactNode, Ref } from \"react\"\nimport type { ForbidAsChild } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { props } from \"../../lib/props\"\nimport type { Size } from \"../../lib/sizes\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TYPOGRAPHY_SHADE_CLASSES } from \"../../lib/typography-size\"\nimport { type FieldProps, FieldShell, fieldA11yProps, useInheritedInvalid } from \"../field/field\"\n\n/**\n * Slider — Range input on top of Ark UI's Slider state\n * machine. Ark owns keyboard nav, RTL flipping, drag math, and ARIA wiring;\n * this wrapper provides the styled parts and a flatter API.\n *\n * - Single or range. Pass a `number` for one thumb, or `[number, number]`\n * for a two-thumb range. The value shape drives everything: the callbacks\n * echo back the same shape, and a thumb (with its own label) is rendered\n * per value. The component is generic over the shape (`V`) so single-value\n * callers keep `number` types — no `number | number[]` leaking into their\n * handlers.\n * - `marks` paints filled dots on the track and an optional label below.\n * Dots between the thumbs (or up to the thumb, for a single value) read\n * as active.\n * - `label` / `description` / `error` / `required` come from the shared `Field`, like the rest\n * of the family: every thumb (`role=\"slider\"`) is named by `label` and described by\n * `description`, or by `error` once invalid.\n * - `thumbLabel` floats above each thumb; visible on hover/focus by default. Its function\n * form also becomes each thumb's `aria-valuetext`, so a screen reader hears \"40%\", not \"40\".\n * - Track/range/thumb parts can be overridden via `classNames`.\n *\n * Palette is delivered through the kit's `data-color` + slot-var system\n * (see `components.md` -> Color system). The root writes `data-color={color}`\n * and the range/thumb reference `--c-solid` — adding a new color in\n * `colors.css` works here for free, no slider edits needed.\n */\n\ntype SliderValue = number | number[]\n\n/** Wrap a scalar into Ark's array contract; pass arrays through untouched. */\nconst toValueArray = (v: SliderValue | undefined): number[] | undefined =>\n v === undefined ? undefined : Array.isArray(v) ? v : [v]\n\nconst marksWrapper = cva(\"\", {\n variants: {\n size: {\n xs: \"px-0.5\",\n sm: \"px-0.75\",\n md: \"px-1.25\",\n lg: \"px-1.5\",\n xl: \"px-1.5\",\n },\n },\n defaultVariants: { size: \"md\" },\n})\n\nconst sliderTrack = cva(\n // `overflow-x-clip overflow-y-visible` keeps the Range's rounded ends\n // clipped (so the filled bar follows the track's pill shape) while\n // letting mark labels spill below the track without being cut off.\n [\n \"relative w-full overflow-x-clip overflow-y-visible rounded-full bg-black/3 dark:bg-white/4\",\n \"cursor-pointer disabled:cursor-not-allowed data-disabled:cursor-not-allowed\",\n // Red invalid state — Ark stamps `data-invalid` on the root, so the track\n // (a descendant) reads it via `group-data-[invalid]`. Figma has no Slider error\n // variant, so it follows Field's: a `border-error-solid` outline, no red fill.\n \"group-data-[invalid]/slider:ring-1 group-data-[invalid]/slider:ring-red-500\",\n ],\n {\n variants: {\n // Padding matches half the dot width per size: the marker wrapper\n // lives inside the track as `relative`, so it occupies the track's\n // content box (padding-inset). Dot centers land at the inset edges,\n // and `-translate-x-1/2` puts the dot's outer edge flush with the\n // track's visible end. No first/last special-casing needed.\n size: {\n xs: \"h-0.5\",\n sm: \"h-1\",\n md: \"h-1.5\",\n lg: \"h-2\",\n xl: \"h-3\",\n },\n },\n defaultVariants: { size: \"md\" },\n },\n)\n\nconst sliderRange = cva(\n \"h-full bg-(--c-solid) data-disabled:bg-(--c-solid-disabled) rounded-full\",\n {\n variants: {\n size: {\n xs: \"\",\n sm: \"\",\n md: \"\",\n lg: \"\",\n xl: \"\",\n },\n },\n },\n)\n\nconst sliderThumb = cva(\n [\n \"block rounded-full border-2 bg-brand-50 dark:bg-brand-950 shadow-sm z-1\",\n \"border-(--c-solid)\",\n \"transition-transform\",\n \"cursor-pointer disabled:cursor-not-allowed data-disabled:cursor-not-allowed data-disabled:border-(--c-solid-disabled)\",\n focusStyles({ ring: \"palette\" }),\n \"data-dragging:scale-110\",\n ],\n {\n variants: {\n size: {\n xs: \"size-2.5 border-2\",\n sm: \"size-3 border-2\",\n md: \"size-4 border-3\",\n lg: \"size-5 border-4\",\n xl: \"size-6 border-4\",\n },\n },\n defaultVariants: { size: \"md\" },\n },\n)\n\nconst sliderMark = cva(\n [\n \"absolute top-1/2 -translate-y-1/2\",\n \"before:rounded-full\",\n \"before:absolute before:top-full before:-translate-y-1/2 before:-translate-x-1/2\",\n \"before:bg-brand-900/10 dark:before:bg-white/16 state-under-or-at:before:bg-(--c-solid-hover)\",\n ],\n {\n variants: {\n size: {\n xs: \"before:size-px\",\n sm: \"before:size-0.5\",\n md: \"before:size-1\",\n lg: \"before:size-1.5\",\n xl: \"before:size-2\",\n },\n },\n defaultVariants: { size: \"md\" },\n },\n)\n\n// Matches `sliderThumb`'s `size-*` variants above (border-box, so border\n// width doesn't add to the rendered box). Passed to Ark as a static\n// `thumbSize` so it skips its own runtime thumb measurement — that\n// measurement is lost (permanently, `thumbSize` collapses to 0) the first\n// time the value changes, which throws off the `thumbAlignment: \"contain\"`\n// edge-inset math used to position both the thumb and every mark.\nconst THUMB_DIAMETER_PX: Record<Size, number> = {\n xs: 10,\n sm: 12,\n md: 16,\n lg: 20,\n xl: 24,\n}\n\nexport type SliderSize = Size | null | undefined\n\ntype SliderMark = {\n value: number\n label?: ReactNode\n}\n\ntype SliderClassNames = {\n field?: string\n root?: string\n control?: string\n track?: string\n range?: string\n thumb?: string\n thumbLabel?: string\n mark?: string\n markGroup?: string\n markDot?: string\n markLabel?: string\n}\n\ntype ArkRootProps = ComponentPropsWithoutRef<typeof Ark.Root>\n\ntype ShowThumbLabel = boolean | \"hover\" | \"always\" | \"never\"\n\n/**\n * `V` is the value shape: `number` for a single thumb (the default), or\n * `number[]` (use `[number, number]`) for a two-thumb range. Inferred from\n * `value` / `defaultValue`, so callbacks echo back the same shape.\n */\nexport type SliderProps<V extends SliderValue = number> = Pick<\n FieldProps,\n \"label\" | \"description\" | \"error\" | \"required\"\n> &\n ForbidAsChild &\n Omit<\n ArkRootProps,\n | \"asChild\"\n | \"value\"\n | \"defaultValue\"\n | \"onValueChange\"\n | \"onValueChangeEnd\"\n | \"onChange\"\n | \"onBlur\"\n | \"ref\"\n | \"className\"\n > &\n WithTestId & {\n /** Controlled value. `number` for one thumb, `[number, number]` for a range. */\n value?: V\n /** Uncontrolled initial value. Its shape decides single vs. range. */\n defaultValue?: V\n /** Fires on every value change (drag, keyboard, click). */\n onChange?: (value: V) => void\n /** Fires once the interaction settles (mouseup / keyup). */\n onChangeEnd?: (value: V) => void\n /** Tick marks rendered on the track. */\n marks?: SliderMark[]\n /**\n * Floating bubble above each thumb. Pass a static node, a function that\n * receives a thumb's live value, or `null` to disable. A function returning\n * a string or number also sets each thumb's `aria-valuetext`. In an RSC tree\n * the function form must live in a `\"use client\"` module so the boundary\n * serializes it as a client reference.\n */\n thumbLabel?: ReactNode | ((value: number) => ReactNode) | null\n /**\n * When the `thumbLabel` bubble shows: `hover` (the default) on hover, focus\n * or drag; `true` / `always` all the time; `false` / `never` not at all.\n */\n showThumbLabel?: ShowThumbLabel\n /** @deprecated Renamed `showThumbLabel`, to match `thumbLabel`. */\n showLabel?: ShowThumbLabel\n size?: SliderSize\n color?: Color\n /** Red invalid state, independent of (and OR'd with) `error`. */\n invalid?: boolean\n /** Forwarded to the slider root; drives touched/blurred validation. */\n onBlur?: (event: FocusEvent<HTMLElement>) => void\n /** Lands on the first thumb (the `role=\"slider\"` element) for focus-on-error. */\n ref?: Ref<HTMLDivElement>\n className?: string\n classNames?: SliderClassNames\n }\n\n/** Ark's per-thumb `aria-label` / `aria-labelledby` arrays, as a range slider takes them. */\ntype ThumbNames = Pick<ArkRootProps, \"aria-label\" | \"aria-labelledby\">\n\n/**\n * One `role=\"slider\"` thumb, split out so it reads the `Field` context from *inside*\n * `FieldShell` — `Slider` itself renders that shell. Ark's Slider never reads a Field, so its\n * thumbs point `aria-labelledby` at their own never-rendered `Slider.Label`; this names each\n * thumb by the field's `label` instead and describes it by `description` / `error`. A caller's\n * own per-thumb `aria-label` / `aria-labelledby` (the way to tell a range's two thumbs apart)\n * still wins: Ark already puts it on the thumb, so the field's label is left out.\n */\nconst SliderThumb = ({\n index,\n names,\n ...thumbProps\n}: ComponentProps<typeof Ark.Thumb> & { names: ThumbNames }) => {\n const { \"aria-labelledby\": fieldLabel, ...described } = fieldA11yProps(useFieldContext())\n const ownName = names[\"aria-label\"]?.[index] ?? names[\"aria-labelledby\"]?.[index]\n return (\n <Ark.Thumb\n index={index}\n {...described}\n aria-labelledby={ownName == null ? fieldLabel : undefined}\n {...thumbProps}\n />\n )\n}\n\n/** A function bubble's text, as `aria-valuetext`; a node with no plain text falls back to the number. */\nconst toValueText =\n (format: (value: number) => ReactNode) =>\n ({ value }: { value: number }) => {\n const text = format(value)\n return typeof text === \"string\" || typeof text === \"number\" ? String(text) : String(value)\n }\n\nexport const Slider = <V extends SliderValue = number>({\n value,\n defaultValue,\n onChange,\n onChangeEnd,\n marks,\n label,\n thumbLabel,\n size,\n showLabel,\n showThumbLabel = showLabel ?? \"hover\",\n color,\n min = 0,\n max = 100,\n step,\n disabled,\n invalid,\n onBlur,\n ref,\n description,\n error,\n required,\n className,\n classNames,\n testId,\n asChild: _asChild,\n ...rest\n}: SliderProps<V>) => {\n const withThumbLabel =\n thumbLabel != null && showThumbLabel !== \"never\" && showThumbLabel !== false\n const renderThumbLabel = (val: number): ReactNode =>\n typeof thumbLabel === \"function\" ? thumbLabel(val) : thumbLabel\n const showMarks = marks !== null && marks !== undefined && marks.length > 0\n // Red state is driven independently of the `Field` error slot so a form\n // library can flip it from `fieldState.invalid` (see FormControlProps).\n const isInvalid = useInheritedInvalid(invalid || error != null)\n\n // The emitted shape mirrors the controlled/default value: arrays stay\n // arrays (range), scalars stay scalars (single thumb).\n const isRange = Array.isArray(value ?? defaultValue)\n const emit = (next: number[]): V => (isRange ? next : (next[0] ?? 0)) as V\n\n const thumbDiameter = THUMB_DIAMETER_PX[size ?? \"md\"]\n\n return (\n <FieldShell\n label={label}\n description={description}\n error={error}\n required={required}\n disabled={disabled}\n size={size ?? \"md\"}\n className={classNames?.field}\n // One or two thumbs: nothing carries the label's `for` id; each thumb's `aria-labelledby` names it.\n composite\n >\n <Ark.Root\n value={toValueArray(value)}\n defaultValue={toValueArray(defaultValue)}\n onValueChange={onChange ? ({ value: v }) => onChange(emit(v)) : undefined}\n onValueChangeEnd={onChangeEnd ? ({ value: v }) => onChangeEnd(emit(v)) : undefined}\n min={min}\n max={max}\n step={step}\n disabled={disabled}\n onBlur={onBlur}\n thumbSize={{ width: thumbDiameter, height: thumbDiameter }}\n getAriaValueText={typeof thumbLabel === \"function\" ? toValueText(thumbLabel) : undefined}\n data-color={color}\n {...props({ \"data-invalid\": isInvalid, \"data-testid\": testId })}\n className={cn(\n \"group/slider relative flex w-full flex-col gap-2\",\n { \"mb-4\": showMarks },\n className,\n classNames?.root,\n )}\n {...rest}\n >\n <Ark.Control\n className={cn(\n \"relative flex w-full items-center py-2\",\n marksWrapper({ size }),\n classNames?.control,\n )}\n >\n <Ark.Track className={cn(sliderTrack({ size }), classNames?.track)}>\n <Ark.Range className={cn(sliderRange({ size }), classNames?.range)} />\n </Ark.Track>\n\n <Ark.Context>\n {(api) =>\n api.value.map((val, i) => (\n <SliderThumb\n // A thumb *is* its index: keyed by value, every step\n // remounted it and dropped keyboard focus after one key press.\n // biome-ignore lint/suspicious/noArrayIndexKey: the index is the thumb's identity\n key={i}\n index={i}\n names={{\n \"aria-label\": rest[\"aria-label\"],\n \"aria-labelledby\": rest[\"aria-labelledby\"],\n }}\n // The focusable element is the thumb (role=\"slider\"), so the\n // caller's `ref` lands on the first thumb for focus-on-error.\n ref={i === 0 ? ref : undefined}\n {...props({\n \"aria-invalid\": isInvalid,\n \"data-testid\": testId && `${testId}-thumb-${i}`,\n })}\n className={cn(sliderThumb({ size }), classNames?.thumb)}\n >\n <Ark.HiddenInput />\n {withThumbLabel && (\n <span\n aria-hidden=\"true\"\n className={cn(\n \"pointer-events-none absolute -top-7 left-1/2 -translate-x-1/2 whitespace-nowrap rounded-md px-2 py-0.5 text-xs font-medium transition-opacity\",\n \"bg-brand-950 text-white dark:bg-white dark:text-brand-950\",\n showThumbLabel === \"hover\"\n ? \"opacity-0 group-hover/slider:opacity-100 group-focus-within/slider:opacity-100 group-data-dragging:opacity-100\"\n : \"opacity-100\",\n classNames?.thumbLabel,\n )}\n >\n {renderThumbLabel(val)}\n </span>\n )}\n </SliderThumb>\n ))\n }\n </Ark.Context>\n </Ark.Control>\n\n {showMarks && (\n <div className=\"absolute inset-0 h-full w-full select-none pointer-events-none \">\n <Ark.MarkerGroup\n className={cn(\n marksWrapper({ size }),\n \"w-full h-full relative\",\n classNames?.markGroup,\n )}\n >\n {marks.map((m) => (\n <Ark.Marker\n key={m.value}\n value={m.value}\n className={cn(sliderMark({ size }), classNames?.mark)}\n >\n {m.label !== undefined && (\n <span\n className={cn(\n \"absolute top-3/4 translate-y-3/4 -translate-x-1/2\",\n \"text-xs\",\n TYPOGRAPHY_SHADE_CLASSES.muted,\n classNames?.markLabel,\n )}\n >\n {m.label}\n </span>\n )}\n </Ark.Marker>\n ))}\n </Ark.MarkerGroup>\n </div>\n )}\n </Ark.Root>\n </FieldShell>\n )\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useApplePlatform, hotkeyCaps } from './chunk-
|
|
1
|
+
import { useApplePlatform, hotkeyCaps } from './chunk-4LSZ5JWF.js';
|
|
2
2
|
import { composeChildren } from './chunk-R5LYFTHA.js';
|
|
3
3
|
import { props } from './chunk-WYCMIIRR.js';
|
|
4
4
|
import { focusStyles } from './chunk-C6NVU4F7.js';
|
|
@@ -136,6 +136,7 @@ var Kbd = (allProps) => {
|
|
|
136
136
|
return /* @__PURE__ */ jsx(
|
|
137
137
|
ark.kbd,
|
|
138
138
|
{
|
|
139
|
+
dir: "ltr",
|
|
139
140
|
"data-color": color,
|
|
140
141
|
...props({ "data-testid": testId }),
|
|
141
142
|
...rest,
|
|
@@ -145,5 +146,5 @@ var Kbd = (allProps) => {
|
|
|
145
146
|
};
|
|
146
147
|
|
|
147
148
|
export { Kbd };
|
|
148
|
-
//# sourceMappingURL=chunk-
|
|
149
|
-
//# sourceMappingURL=chunk-
|
|
149
|
+
//# sourceMappingURL=chunk-DQIYYDFD.js.map
|
|
150
|
+
//# sourceMappingURL=chunk-DQIYYDFD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/kbd/kbd.tsx"],"names":[],"mappings":";;;;;;;;;AAuDA,IAAM,WAAA,GAAc,GAAA;AAAA,EAClB;AAAA,IACE,+CAAA;AAAA,IACA,+BAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAKA,oCAAA;AAAA,IACA,sCAAA;AAAA,IACA,8CAAA;AAAA;AAAA;AAAA;AAAA,IAI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AAA,EAAc,aAAA;AAAA,IACd,GAAG;AAAA,GACL,GAAI,QAAA;AACJ,EAAA,uBACE,GAAA;AAAA,IAAC,GAAA,CAAI,GAAA;AAAA,IAAJ;AAAA,MAEC,GAAA,EAAI,KAAA;AAAA,MACJ,YAAA,EAAY,KAAA;AAAA,MACX,GAAG,KAAA,CAAM,EAAE,aAAA,EAAe,QAAQ,CAAA;AAAA,MAClC,GAAG,IAAA;AAAA,MACJ,SAAA,EAAW,GAAG,WAAA,CAAY,EAAE,SAAS,IAAA,EAAM,GAAG,SAAS;AAAA;AAAA,GACzD;AAEJ","file":"chunk-DQIYYDFD.js","sourcesContent":["\"use client\"\n\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport type { ReactElement } from \"react\"\nimport { composeChildren } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { hotkeyCaps, type KbdTranslations, useApplePlatform } from \"../../lib/use-hotkey\"\n\n/**\n * Kbd — a keyboard-key / shortcut indicator (`<kbd>`).\n *\n * A client component only for `hotkey`, whose keys depend on the platform\n * (`[⌘] [K]` vs `[Ctrl] [K]`). It borrows Button's (variant × color) system so\n * a shortcut hint speaks the same accent language as the action it labels — but\n * unlike Button it is non-interactive: no hover treatment, no click handling,\n * just a key cap.\n *\n * The shape axis is the exact set Button exposes (filled / light / outline /\n * subtle / default), wired through the same `--c-*` slot vars — `color` routes\n * via a `data-color` attribute resolved in `colors.css`, so the cva matrix\n * enumerates variants only, never (variant × color) pairs. The default\n * treatment is the `default` variant: a neutral, bordered key-cap surface that\n * reads as a physical key regardless of `color` (pairing `default` with a color\n * is a no-op, mirroring Button/Badge).\n *\n * A key reads left to right as typed on an RTL page too (`⌘K`, not `K⌘`):\n * the cap carries `dir=\"ltr\"`, which sets its direction and isolates it from\n * the surrounding bidi flow (see `Code`). A caller can override it with `dir`.\n *\n * Sizing keeps single-character keys square via a per-size `min-w` equal to the\n * height, while wider labels (`Enter`, `Esc`, `⌘N`) grow horizontally. Padding\n * is symmetric, so a key reads the same in RTL.\n *\n * `asChild` (from `HTMLArkProps`) renders the single child as the root with\n * Kbd's styling merged in — e.g. `<Kbd asChild><a href=\"…\">⌘K</a></Kbd>`. The\n * kit's focus ring (`focusStyles`) comes along with it, so a Kbd composed onto\n * a real control is keyboard-visible without the caller restyling anything; on\n * a plain `<kbd>` those classes never match.\n *\n * `hotkey` draws a key combination the way the HTML spec marks one up: an\n * outer `<kbd>` for the whole combination holding one inner `<kbd>` per key,\n * with no `+` between them. The outer one is an unstyled inline-flex row;\n * each key is a full cap (`variant` / `size` / `color` apply to every cap),\n * so `\"mod+k\"` is two square caps. The rest of the props (`className`,\n * `testId`, `asChild`, `aria-*`, …) land on the outer `<kbd>`, which is the\n * element a layout positions; `color` is set there too and every cap reads\n * its slot vars from it. The words the caps show and speak (\"Ctrl\", \"Esc\",\n * \"Command\", \"Up Arrow\") are English unless `translations` replaces them, per\n * key (`KbdTranslations`); `formatHotkey` takes the same object.\n */\nconst kbdVariants = cva(\n [\n \"inline-flex items-center justify-center gap-1\",\n \"whitespace-nowrap select-none\",\n // Regular weight, not medium: the mono face (Kode Mono) has no ⌘ ⇧ ⌥ ↵\n // glyphs, so they fall back to a system font — and a 500 weight makes that\n // fallback resolve to its *bold* face (Menlo Bold), a heavy blot next to\n // the regular letters around it.\n \"font-mono font-normal leading-none\",\n \"rounded-md border border-transparent\",\n \"[&_svg]:shrink-0 [&_svg]:pointer-events-none\",\n // A 1.5px stroke at every size: the icon is sized by CSS, so a stroke in\n // viewBox units would thin out at `size-3`. `non-scaling-stroke` keeps it in\n // screen pixels (lucide's `absoluteStrokeWidth` ignores CSS sizing).\n \"[&_svg]:stroke-[1.5] [&_svg_*]:[vector-effect:non-scaling-stroke]\",\n // A lone icon is narrower than the cap is tall, but the side padding\n // would push it past `min-w`: drop the padding so the cap stays square.\n \"has-[>svg:only-child]:px-0\",\n // Inert on the default non-focusable <kbd>; applies once `asChild`\n // renders Kbd onto a real <button>/<a>. See `focusStyles`.\n focusStyles(),\n ],\n {\n variants: {\n variant: {\n filled: \"bg-(--c-solid) text-(--c-on-solid)\",\n light: \"bg-(--c-soft) text-(--c-text)\",\n // Button's outline edge: the colour at 35%.\n outline: \"bg-transparent text-(--c-text) border-(--c-solid)/35\",\n subtle: \"bg-transparent text-(--c-text)\",\n // The key cap sits on the kit's translucent surface recipe — a 3%/4%\n // overlay plus the hairline `border-brand-900/20 dark:border-white/15`,\n // the same pair `Input`'s default shell, `Card`, `Tabs` and\n // `ChoiceCardGroup` use. An opaque gray step can only ever be right on\n // the one background it was picked against, and a `Kbd` is most often\n // inlined into a Button, a Menu row or a tinted panel. Light mode\n // darkens (`bg-black/3`) because `bg-white/4` on a near-white page is\n // invisible; dark mode lightens. A 1px inset shade along the bottom\n // edge is the key-cap depth cue — the lip of a physical key — without\n // adding height. The label is the kit's secondary text, not full\n // contrast: a shortcut hint annotates the action, it is not the action.\n default: [\n \"bg-black/3 text-brand-900/70 border-brand-900/20\",\n \"shadow-[inset_0_-1px_0_0_rgb(0_0_0/0.08)]\",\n \"dark:bg-white/4 dark:text-white/80 dark:border-white/15\",\n \"dark:shadow-[inset_0_-1px_0_0_rgb(0_0_0/0.35)]\",\n ],\n },\n // Type is one Tailwind step per size (12 / 14 / 16px), the scale of\n // the text a key sits beside — a 10px label left ⌘ and ↵ unreadable.\n //\n // A single character must fit `min-w` (= height) to stay square. Kode\n // Mono advances 0.6em per glyph, so glyph + 2 × padding + 2 × 1px border:\n // sm: 7.2 + 2 × 5 + 2 = 19.2 ≤ 20 (px-1.5 gave 21.2: one px too wide)\n // md: 8.4 + 2 × 6 + 2 = 22.4 ≤ 24\n // lg: 9.6 + 2 × 8 + 2 = 27.6 ≤ 28\n // Re-check these sums after a font, type step or padding change.\n size: {\n sm: \"h-5 min-w-5 px-1.25 text-xs [&_svg]:size-3\",\n md: \"h-6 min-w-6 px-1.5 text-sm [&_svg]:size-3.5\",\n lg: \"h-7 min-w-7 px-2 text-base [&_svg]:size-4\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"md\",\n },\n },\n)\n\nexport type KbdVariant = NonNullable<VariantProps<typeof kbdVariants>[\"variant\"]>\nexport type KbdSize = NonNullable<VariantProps<typeof kbdVariants>[\"size\"]>\n\n/** The outer `<kbd>` of a `hotkey` combination: a row of caps, unstyled itself.\n * `align-middle` sits it on the text it annotates the way a lone cap does. */\nconst kbdGroup = \"inline-flex items-center gap-0.5 align-middle\"\n\n/** With `hotkey`: the key words, merged per key onto `KBD_DEFAULT_TRANSLATIONS`. */\ntype KbdHotkeyTranslations = {\n /** The words the caps read as and are spoken by, merged per key onto the English\n * `KBD_DEFAULT_TRANSLATIONS`: `{ ctrl: \"Strg\", enter: \"Eingabe\" }`. Pass the same\n * object to `formatHotkey` / `hotkeyKeys` so plain text reads the same. */\n translations?: Partial<KbdTranslations>\n}\n\ntype KbdHotkeyProps =\n | { hotkey?: undefined; translations?: undefined }\n | (KbdHotkeyTranslations & {\n /** A `useHotkey` string to draw, one cap per key, the way the visitor's\n * platform writes it: `\"mod+k\"` is `[⌘] [K]` on Apple platforms and\n * `[Ctrl] [K]` elsewhere (see `hotkeyKeys`). A key with an icon (Shift,\n * Enter, Tab, the arrows, and ⌘ ⌥ ⌃ ⌫ on Apple) is drawn as one, with a\n * spoken name; Ctrl, Alt, Esc, Space (and Backspace off Apple) stay\n * words. Server-rendered as the non-Apple caps, then corrected on\n * hydration. The caps are the content, so it takes no children. */\n hotkey: string\n asChild?: false\n children?: never\n })\n | (KbdHotkeyTranslations & {\n hotkey: string\n /** With `hotkey`: the single child becomes the outer `<kbd>` of the\n * combination, the caps rendered inside it. */\n asChild: true\n children: ReactElement\n })\n\nexport type KbdProps = HTMLArkProps<\"kbd\"> &\n VariantProps<typeof kbdVariants> &\n WithTestId & {\n /** Accent palette. Re-exported as `Color` from `@42/ui-react`. */\n color?: Color\n } & KbdHotkeyProps\n\ntype KbdComboProps = KbdProps & { hotkey: string }\n\n/** `<Kbd hotkey>`: the combination's outer `<kbd>`, one cap per key inside. */\nconst KbdCombo = ({\n className,\n variant,\n size,\n color,\n testId,\n hotkey,\n translations,\n asChild,\n children,\n ...rest\n}: KbdComboProps) => {\n const apple = useApplePlatform()\n const caps = hotkeyCaps(hotkey, apple, translations).map(({ id, label, icon: Icon, name }) => (\n // A symbol is drawn (an icon, or the glyph where there is none) and its\n // name spoken: an svg says nothing, and `⌘` alone reads inconsistently.\n // `relative` holds the absolutely positioned `sr-only` inside the cap.\n // An icon cap drops its side padding to stay square, as a lone icon does\n // (the `sr-only` name beside the svg keeps `:only-child` from matching).\n <kbd\n key={id}\n className={cn(kbdVariants({ variant, size }), name && \"relative\", Icon && \"px-0\")}\n >\n {name ? (\n <>\n {Icon ? <Icon aria-hidden /> : <span aria-hidden>{label}</span>}\n <span className=\"sr-only\">{name}</span>\n </>\n ) : (\n label\n )}\n </kbd>\n ))\n return (\n <ark.kbd\n // A combination reads left to right in either direction, like the\n // single string it replaces.\n dir=\"ltr\"\n data-color={color}\n {...props({ \"data-testid\": testId })}\n {...rest}\n asChild={asChild}\n className={cn(kbdGroup, className)}\n >\n {composeChildren(asChild, children, () => caps)}\n </ark.kbd>\n )\n}\n\nexport const Kbd = (allProps: KbdProps) => {\n if (allProps.hotkey !== undefined) return <KbdCombo {...allProps} />\n const {\n className,\n variant,\n size,\n color,\n testId,\n hotkey: _hotkey,\n translations: _translations,\n ...rest\n } = allProps\n return (\n <ark.kbd\n // Like a combination, a single key reads left to right in either direction.\n dir=\"ltr\"\n data-color={color}\n {...props({ \"data-testid\": testId })}\n {...rest}\n className={cn(kbdVariants({ variant, size }), className)}\n />\n )\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SegmentGroup } from './chunk-
|
|
2
|
-
import { NumberInput } from './chunk-
|
|
1
|
+
import { SegmentGroup } from './chunk-UBQ54W46.js';
|
|
2
|
+
import { NumberInput } from './chunk-QHT4DCXE.js';
|
|
3
3
|
import { cn } from './chunk-4ASNIDV7.js';
|
|
4
4
|
import { useLocaleContext } from '@ark-ui/react/locale';
|
|
5
5
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
@@ -246,5 +246,5 @@ var TimeRow = ({
|
|
|
246
246
|
};
|
|
247
247
|
|
|
248
248
|
export { TimeRow, dayPeriodLabels, fromDisplayHour, is12Hour, resolveHourCycle, timeRowMinWidth, toDisplayHour };
|
|
249
|
-
//# sourceMappingURL=chunk-
|
|
250
|
-
//# sourceMappingURL=chunk-
|
|
249
|
+
//# sourceMappingURL=chunk-FCBYUN6F.js.map
|
|
250
|
+
//# sourceMappingURL=chunk-FCBYUN6F.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/time-input/hour-cycle.ts","../src/components/time-input/time-row.tsx"],"names":[],"mappings":";;;;;;;AAQO,IAAM,mBAAmB,CAAC;AAAA,EAC/B,MAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA,KAIiB;AACf,EAAA,IAAI,WAAW,OAAO,SAAA;AACtB,EAAA,IAAI,MAAA,KAAW,MAAA,EAAW,OAAO,MAAA,KAAW,KAAK,KAAA,GAAQ,KAAA;AACzD,EAAA,OAAO,IAAA,CAAK,eAAe,MAAA,EAAQ,EAAE,MAAM,SAAA,EAAW,CAAA,CAAE,eAAA,EAAgB,CAAE,SAAA;AAC5E;AAGO,IAAM,QAAA,GAAW,CAAC,KAAA,KAA8B,KAAA,KAAU,SAAS,KAAA,KAAU;AAI7E,IAAM,WAAA,GAA+D;AAAA,EAC1E,GAAA,EAAK,EAAE,GAAA,EAAK,CAAA,EAAG,KAAK,EAAA,EAAG;AAAA,EACvB,GAAA,EAAK,EAAE,GAAA,EAAK,CAAA,EAAG,KAAK,EAAA,EAAG;AAAA,EACvB,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":["export type HourCycle = \"h11\" | \"h12\" | \"h23\" | \"h24\"\n\n/**\n * Resolve 12h vs 24h display (Req #6): an explicit `hourCycle` wins, then\n * `format`, else the locale's own convention via `Intl.DateTimeFormat`. Shared\n * by `TimeInput` and `DatePicker`'s embedded time panel so both pick the same\n * cycle for the same locale.\n */\nexport const resolveHourCycle = ({\n locale,\n format,\n hourCycle,\n}: {\n locale: string\n format?: 12 | 24\n hourCycle?: HourCycle\n}): HourCycle => {\n if (hourCycle) return hourCycle\n if (format !== undefined) return format === 12 ? \"h12\" : \"h23\"\n return Intl.DateTimeFormat(locale, { hour: \"numeric\" }).resolvedOptions().hourCycle as HourCycle\n}\n\n/** Whether a resolved cycle displays 12 hours + AM/PM (`h11`/`h12`) rather than all 24. */\nexport const is12Hour = (cycle: HourCycle): boolean => cycle === \"h11\" || cycle === \"h12\"\n\n/** The hours each cycle displays: `h11` 0–11, `h12` 1–12, `h23` 0–23, `h24` 1–24. In the two\n * cycles that start at 1, midnight (and, for `h12`, noon) reads as the top of the range. */\nexport const HOUR_RANGES: Record<HourCycle, { min: number; max: number }> = {\n h11: { min: 0, max: 11 },\n h12: { min: 1, max: 12 },\n h23: { min: 0, max: 23 },\n h24: { min: 1, max: 24 },\n}\n\n/** Convert a stored 24h hour (`0`–`23`) to the hour `cycle` displays, plus its period in the\n * 12-hour cycles (`null` otherwise) — e.g. midnight is `12` AM in `h12`, `0` AM in `h11`, `0` in\n * `h23` and `24` in `h24`. */\nexport const toDisplayHour = (\n hour24: number,\n cycle: HourCycle,\n): { hour: number; period: \"AM\" | \"PM\" | null } => {\n const twelveHour = is12Hour(cycle)\n const hour = twelveHour ? hour24 % 12 : hour24\n return {\n hour: hour === 0 && HOUR_RANGES[cycle].min === 1 ? HOUR_RANGES[cycle].max : hour,\n period: twelveHour ? (hour24 < 12 ? \"AM\" : \"PM\") : null,\n }\n}\n\n/** The inverse of `toDisplayHour`: a displayed hour (+ period in the 12-hour cycles) back to a\n * stored 24h hour. A missing hour reads as the start of its half of the day — midnight, or noon\n * once PM is picked — and a missing period as AM. */\nexport const fromDisplayHour = (\n hour: number | null,\n period: \"AM\" | \"PM\" | null,\n cycle: HourCycle,\n): number => {\n const offset = is12Hour(cycle) && period === \"PM\" ? 12 : 0\n if (hour === null) return offset\n return is12Hour(cycle) ? (hour % 12) + offset : hour % 24\n}\n\n/** Locale-correct AM/PM display strings (e.g. \"AM\"/\"PM\" en-US, \"午前\"/\"午後\" ja-JP), read via\n * `Intl.DateTimeFormat`'s own `dayPeriod` part rather than a hardcoded English literal. Keyed by\n * the same `\"AM\" | \"PM\"` domain value `toDisplayHour`/`fromDisplayHour` use throughout, so this only ever\n * changes what's *displayed*, never what's stored/serialized. */\nexport const dayPeriodLabels = (locale: string): Record<\"AM\" | \"PM\", string> => {\n const dayPeriod = (hour: number) =>\n new Intl.DateTimeFormat(locale, { hour: \"numeric\", hour12: true })\n .formatToParts(new Date(2000, 0, 1, hour))\n .find((part) => part.type === \"dayPeriod\")?.value ?? (hour < 12 ? \"AM\" : \"PM\")\n return { AM: dayPeriod(9), PM: dayPeriod(21) }\n}\n\n/** Locale-correct narrow unit abbreviations for the Hour/Minute/Second suffix (e.g. \"h\"/\"m\"/\"s\"\n * en-US, \"h\"/\"min\"/\"s\" fr-FR), read via `Intl.NumberFormat`'s own unit formatting rather than\n * hardcoded English literals. */\nconst UNIT_FALLBACK = { hour: \"h\", minute: \"m\", second: \"s\" } as const\n\nexport const timeUnitLabels = (\n locale: string,\n): { hour: string; minute: string; second: string } => {\n const unit = (u: \"hour\" | \"minute\" | \"second\") =>\n new Intl.NumberFormat(locale, { style: \"unit\", unit: u, unitDisplay: \"narrow\" })\n .formatToParts(1)\n .find((part) => part.type === \"unit\")?.value ?? UNIT_FALLBACK[u]\n return { hour: unit(\"hour\"), minute: unit(\"minute\"), second: unit(\"second\") }\n}\n","\"use client\"\n\nimport { useLocaleContext } from \"@ark-ui/react/locale\"\nimport type { FocusEvent, KeyboardEvent, Ref } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport type { Size } from \"../../lib/sizes\"\nimport type { InputVariant } from \"../input/input\"\nimport { NumberInput, type NumberInputTranslations } from \"../number-input/number-input\"\nimport { SegmentGroup } from \"../segment-group/segment-group\"\nimport {\n dayPeriodLabels,\n HOUR_RANGES,\n type HourCycle,\n is12Hour,\n timeUnitLabels,\n} from \"./hour-cycle\"\n\n/**\n * The HOUR/MINUTE (+ SECOND) + AM/PM row — the piece `TimeInput` wraps with\n * state, and `DatePicker`'s embedded time panel wraps with `api.setTime()`\n * (one implementation, two call sites). Operates entirely in *display* units\n * (the cycle's own hours — 0–11, 1–12, 0–23 or 1–24) — the always-24h stored `hour` conversion\n * happens at the caller's boundary, not here.\n */\n\ntype TimeRowClassNames = {\n hour?: string\n minute?: string\n second?: string\n period?: string\n}\n\n/** Overrides the sr-only accessible names for Hour/Minute/Second/Period — English by default.\n * Arbitrary microcopy with no locale-derivation path (unlike AM/PM and the unit suffixes,\n * which read from `Intl` instead). `incrementLabel`/`decrementLabel` are `NumberInput`'s own\n * keys, forwarded to each field's steppers (defaults `\"Increment\"` / `\"Decrement\"`). */\nexport type TimeRowTranslations = Pick<\n NumberInputTranslations,\n \"incrementLabel\" | \"decrementLabel\"\n> & {\n /** The whole row's group name when nothing visible labels it. Default `\"Time\"`. */\n time?: string\n hour?: string\n minute?: string\n second?: string\n period?: string\n}\n\n/** The row's English accessible names, merged once under `translations`. `NumberInput` keeps\n * its own stepper defaults. */\nconst TIME_ROW_DEFAULT_TRANSLATIONS = {\n time: \"Time\",\n hour: \"Hour\",\n minute: \"Minute\",\n second: \"Second\",\n period: \"Period\",\n} as const satisfies TimeRowTranslations\n\n/** Starting *and floor* size for the Hour/Minute/Second fields, per `size` — `flex-1`'s basis so\n * each field still grows to fill the row, plus an equal `min-width` so it never shrinks back\n * below that. Without the `min-width`, the field's inner `<input>` has `min-w-0` (needed so the\n * value can shrink instead of forcing the row to overflow when it's genuinely too narrow), which\n * otherwise lets `flex-1` starve it arbitrarily close to zero — that's exactly how the `<input>`\n * was measured shrinking to ~11px in a too-narrow `DatePicker` popover column, clipping the\n * 2-digit value. A too-narrow row now genuinely overflows (or wraps, if a wrapping ancestor\n * provides one) instead of silently clipping — the honest failure mode; `DatePicker`'s own\n * column-width fix (`timeRowMinWidth` below) is what actually prevents hitting it in practice.\n *\n * Calibrated against a real measurement, minus `shellGap`'s own per-size pixel value (6/6/8/10/12px\n * for xs/sm/md/lg/xl) — `NumberInput`'s value↔suffix pair no longer carries that gap (glued\n * together in their own nested row, see its own comment), so each field's true minimum content\n * width shrank by exactly that much. */\nexport const TIME_FIELD_BASIS_PX: Record<Size, number> = { xs: 64, sm: 72, md: 78, lg: 86, xl: 100 }\n/** The same widths as Tailwind classes, written out in full: Tailwind finds classes by scanning\n * source text (a consumer's build scans the shipped `dist`), so a class assembled from a template\n * literal is never generated. `time-row.test.ts` keeps these in step with `TIME_FIELD_BASIS_PX`. */\nexport const timeFieldBasis: Record<Size, string> = {\n xs: \"basis-[64px] min-w-[64px]\",\n sm: \"basis-[72px] min-w-[72px]\",\n md: \"basis-[78px] min-w-[78px]\",\n lg: \"basis-[86px] min-w-[86px]\",\n xl: \"basis-[100px] min-w-[100px]\",\n}\n\n/** The row's own gap between Hour/Minute/Second/Period (`gap-2` below) — flat across `size`,\n * unlike each field's *internal* value↔suffix↔steppers gap (`shellGap`, size-dependent). */\nconst ROW_GAP_PX = 8\n\n/** The AM/PM toggle's own natural (unstretched — it's `shrink-0`, not `flex-1`) rendered width\n * per `size`, measured directly rather than estimated. It wraps onto its own line below\n * Hour/Minute (the row's `flex-wrap` below) instead of forcing the whole row wider, so this\n * only matters for `timeRowMinWidth` as a floor *in case* it's ever wider than Hour+Minute\n * themselves — not as an unconditional addition to their combined width (see below). */\nconst PERIOD_WIDTH_PX: Record<Size, number> = { xs: 60, sm: 74, md: 88, lg: 110, xl: 133 }\n\n/** The row's own minimum rendered width for a given configuration. `DatePicker` uses this (see\n * its own `calendarColumnWidth` comment) to keep its popover column at least as wide as the\n * embedded time row needs, instead of only ever sizing off the calendar grid — otherwise the\n * row's `flex-1` + `min-w-0` fields silently shrink below their content size to fit.\n *\n * This is deliberately just Hour/Minute/[Second] at their basis plus the gaps *between* them —\n * not the AM/PM toggle's width added on top. The toggle wraps onto its own line (the row's\n * `flex-wrap` below) rather than forcing the row wider, so at a single narrow month it drops\n * below Hour/Minute instead of pushing the popover past the calendar's own width — the row only\n * needs to be as wide as the toggle itself in the (currently never hit — Hour+Minute together\n * are wider than the toggle at every size) case where that's the larger requirement. */\nexport const timeRowMinWidth = (\n size: Size,\n hourCycle: HourCycle,\n withSeconds: boolean | undefined,\n): number => {\n const fieldCount = 2 + (withSeconds ? 1 : 0)\n const fieldsWidth = fieldCount * TIME_FIELD_BASIS_PX[size] + (fieldCount - 1) * ROW_GAP_PX\n return is12Hour(hourCycle) ? Math.max(fieldsWidth, PERIOD_WIDTH_PX[size]) : fieldsWidth\n}\n\n/** ArrowLeft/ArrowRight at the edge of a field's text moves to the neighbouring field — caret at\n * its far side, so the motion reads as one continuous caret across the row — and from the last\n * number field \"next\" lands on the AM/PM toggle's checked (or first) radio. Inside the toggle the\n * arrows stay the radio group's own (switching AM/PM); Shift+Tab leaves it. `dir=\"rtl\"` mirrors\n * the keys, since the row's visual order is mirrored too. Anything else — a modifier, a\n * selection, a caret mid-text — keeps the native caret movement. */\nconst moveAcrossFields = (event: KeyboardEvent<HTMLDivElement>, dir: \"ltr\" | \"rtl\") => {\n if (event.key !== \"ArrowLeft\" && event.key !== \"ArrowRight\") return\n if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return\n const input = event.target\n if (!(input instanceof HTMLInputElement) || input.type !== \"text\") return\n const { selectionStart, selectionEnd, value } = input\n if (selectionStart !== selectionEnd) return\n const forward = (event.key === \"ArrowRight\") !== (dir === \"rtl\")\n if (forward ? selectionEnd !== value.length : selectionStart !== 0) return\n\n const row = event.currentTarget\n const fields = [...row.querySelectorAll<HTMLInputElement>('input[type=\"text\"]:not(:disabled)')]\n const next =\n fields[fields.indexOf(input) + (forward ? 1 : -1)] ??\n (forward\n ? (row.querySelector<HTMLInputElement>('input[type=\"radio\"]:checked:not(:disabled)') ??\n row.querySelector<HTMLInputElement>('input[type=\"radio\"]:not(:disabled)'))\n : null)\n if (!next) return\n event.preventDefault()\n next.focus()\n if (next.type === \"text\") {\n const caret = forward ? 0 : next.value.length\n next.setSelectionRange(caret, caret)\n }\n}\n\nexport type TimeRowProps = {\n hour: number | null\n minute: number | null\n second?: number | null\n onHourChange: (hour: number | null) => void\n onMinuteChange: (minute: number | null) => void\n onSecondChange?: (second: number | null) => void\n period: \"AM\" | \"PM\" | null\n onPeriodChange: (period: \"AM\" | \"PM\") => void\n hourCycle: HourCycle\n minuteStep?: number\n withSeconds?: boolean\n /** Placeholder shown in each empty Hour/Minute/Second field. Default `\"--\"`. */\n placeholder?: string\n /** Resolves the locale-correct AM/PM labels + Hour/Minute/Second unit suffixes via `Intl`.\n * Falls back to `useLocaleContext()` when omitted. */\n locale?: string\n /** Overrides the sr-only Hour/Minute/Second/Period accessible names. English by default. */\n translations?: TimeRowTranslations\n size?: Size\n variant?: InputVariant\n disabled?: boolean\n readOnly?: boolean\n invalid?: boolean\n /** Lands on the hour field's `<input>` for focus-on-error. */\n ref?: Ref<HTMLInputElement>\n /** Forwarded to the hour field's `<input>`; drives touched/blurred validation. */\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void\n /** Names the row's `role=\"group\"` directly when no visible label points at it. Defaults to\n * `translations.time` (`\"Time\"`), so the group is never anonymous. */\n \"aria-label\"?: string\n /** Names the row's `role=\"group\"` from a visible label, e.g. `TimeInput`'s field label or\n * `DatePicker`'s \"Start time\" / \"End time\". Without a name a screen reader enters the group\n * hearing only \"Hour\". */\n \"aria-labelledby\"?: string\n /** Helper / error text read after the group's name. */\n \"aria-describedby\"?: string\n className?: string\n classNames?: TimeRowClassNames\n}\n\nexport const TimeRow = ({\n hour,\n minute,\n second,\n onHourChange,\n onMinuteChange,\n onSecondChange,\n period,\n onPeriodChange,\n hourCycle,\n minuteStep = 1,\n withSeconds,\n placeholder = \"--\",\n locale,\n translations,\n size = \"md\",\n variant = \"default\",\n disabled,\n readOnly,\n invalid,\n ref,\n onBlur,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n className,\n classNames,\n}: TimeRowProps) => {\n const { locale: contextLocale, dir } = useLocaleContext()\n const resolvedLocale = locale ?? contextLocale\n const twelveHour = is12Hour(hourCycle)\n const units = timeUnitLabels(resolvedLocale)\n const periodLabels = twelveHour ? dayPeriodLabels(resolvedLocale) : null\n const t = { ...TIME_ROW_DEFAULT_TRANSLATIONS, ...translations }\n\n return (\n // `flex-wrap`: at a single narrow month under `DatePicker`, Hour/Minute/[Second] fit the\n // calendar's own width but the AM/PM toggle doesn't (see `timeRowMinWidth`'s comment) — this\n // drops it to its own line there instead of forcing the whole popover wider than the\n // calendar to fit it on the same line. No visual change wherever there's already enough\n // width (every other context) — wrapping only kicks in once it's genuinely too narrow.\n // `role=\"group\"`: Hour/Minute/[Second]/Period are the parts of one time value — and the\n // row owns keyboard behaviour across them (`moveAcrossFields`), which a bare `<div>` can't.\n // biome-ignore lint/a11y/useSemanticElements: a `<fieldset>` brings UA border/padding/`min-inline-size` that fight this wrapping flex row, for the same `group` semantics\n <div\n role=\"group\"\n aria-label={ariaLabelledBy ? undefined : (ariaLabel ?? t.time)}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n className={cn(\"flex flex-wrap items-end gap-2\", className)}\n onKeyDown={(event) => moveAcrossFields(event, dir)}\n >\n <NumberInput\n ref={ref}\n onBlur={onBlur}\n label={t.hour}\n placeholder={placeholder}\n value={hour}\n onChange={onHourChange}\n min={HOUR_RANGES[hourCycle].min}\n max={HOUR_RANGES[hourCycle].max}\n step={1}\n wrap\n formatOptions={{ minimumIntegerDigits: 2 }}\n size={size}\n variant={variant}\n disabled={disabled}\n readOnly={readOnly}\n invalid={invalid}\n // \"Hour\" stays the accessible name (sr-only keeps it in the a11y tree,\n // just visually hidden) — the unit suffix is a decorative stand-in,\n // right next to the value once it's right-aligned (`text-end`).\n translations={t}\n suffix={units.hour}\n className={classNames?.hour}\n classNames={{\n field: cn(\"flex-1\", timeFieldBasis[size]),\n label: \"sr-only\",\n input: \"text-end\",\n }}\n />\n <NumberInput\n label={t.minute}\n placeholder={placeholder}\n value={minute}\n onChange={onMinuteChange}\n min={0}\n max={59}\n step={minuteStep}\n wrap\n formatOptions={{ minimumIntegerDigits: 2 }}\n size={size}\n variant={variant}\n disabled={disabled}\n readOnly={readOnly}\n invalid={invalid}\n translations={t}\n suffix={units.minute}\n className={classNames?.minute}\n classNames={{\n field: cn(\"flex-1\", timeFieldBasis[size]),\n label: \"sr-only\",\n input: \"text-end\",\n }}\n />\n {withSeconds && (\n <NumberInput\n label={t.second}\n placeholder={placeholder}\n value={second ?? null}\n onChange={onSecondChange}\n min={0}\n max={59}\n step={1}\n wrap\n formatOptions={{ minimumIntegerDigits: 2 }}\n size={size}\n variant={variant}\n disabled={disabled}\n readOnly={readOnly}\n invalid={invalid}\n translations={t}\n suffix={units.second}\n className={classNames?.second}\n classNames={{\n field: cn(\"flex-1\", timeFieldBasis[size]),\n label: \"sr-only\",\n input: \"text-end\",\n }}\n />\n )}\n {twelveHour && periodLabels && (\n <SegmentGroup\n data={[\n { value: \"AM\", label: periodLabels.AM },\n { value: \"PM\", label: periodLabels.PM },\n ]}\n label={t.period}\n value={period}\n onChange={(value) => onPeriodChange(value as \"AM\" | \"PM\")}\n // `SegmentGroup`'s sizes match `NumberInput`'s box height exactly, so\n // the AM/PM toggle sits flush with the Hour/Minute fields.\n size={size}\n disabled={disabled}\n readOnly={readOnly}\n invalid={invalid}\n className={classNames?.period}\n // Unlike Hour/Minute/Second, the AM/PM toggle has a fixed, small set of labels — it\n // doesn't need (or look right) stretching to share the row's leftover width. `w-auto`\n // cancels the Field wrapper's own default `w-full` (which would otherwise still set its\n // flex-basis to the full row width even without `flex-1`); `shrink-0` keeps it stable.\n // \"Period\" keeps the accessible name (sr-only) but no visible label or suffix — the\n // segment control itself already shows \"AM\"/\"PM\", self-descriptive.\n classNames={{ field: \"w-auto shrink-0\", label: \"sr-only\" }}\n />\n )}\n </div>\n )\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/time-input/hour-cycle.ts","../src/components/time-input/time-row.tsx"],"names":[],"mappings":";;;;;;;AAQO,IAAM,mBAAmB,CAAC;AAAA,EAC/B,MAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA,KAIiB;AACf,EAAA,IAAI,WAAW,OAAO,SAAA;AACtB,EAAA,IAAI,MAAA,KAAW,MAAA,EAAW,OAAO,MAAA,KAAW,KAAK,KAAA,GAAQ,KAAA;AACzD,EAAA,OAAO,IAAA,CAAK,eAAe,MAAA,EAAQ,EAAE,MAAM,SAAA,EAAW,CAAA,CAAE,eAAA,EAAgB,CAAE,SAAA;AAC5E;AAGO,IAAM,QAAA,GAAW,CAAC,KAAA,KAA8B,KAAA,KAAU,SAAS,KAAA,KAAU;AAI7E,IAAM,WAAA,GAA+D;AAAA,EAC1E,GAAA,EAAK,EAAE,GAAA,EAAK,CAAA,EAAG,KAAK,EAAA,EAAG;AAAA,EACvB,GAAA,EAAK,EAAE,GAAA,EAAK,CAAA,EAAG,KAAK,EAAA,EAAG;AAAA,EACvB,GAAA,EAAK,EAAE,GAAA,EAAK,CAAA,EAAG,KAAK,EAAA,EAAG;AAAA,EACvB,GAAA,EAAK,EAAE,GAAA,EAAK,CAAA,EAAG,KAAK,EAAA;AACtB,CAAA;AAKO,IAAM,aAAA,GAAgB,CAC3B,MAAA,EACA,KAAA,KACiD;AACjD,EAAA,MAAM,UAAA,GAAa,SAAS,KAAK,CAAA;AACjC,EAAA,MAAM,IAAA,GAAO,UAAA,GAAa,MAAA,GAAS,EAAA,GAAK,MAAA;AACxC,EAAA,OAAO;AAA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AA,cACA,YAAA,EAAc,CAAA;AAAA,cACd,QAAQ,KAAA,CAAM,MAAA;AAAA,cACd,WAAW,UAAA,EAAY,MAAA;AAAA,cACvB,UAAA,EAAY;AAAA,gBACV,KAAA,EAAO,EAAA,CAAG,QAAA,EAAU,cAAA,CAAe,IAAI,CAAC,CAAA;AAAA,gBACxC,KAAA,EAAO,SAAA;AAAA,gBACP,KAAA,EAAO;AAAA;AACT;AAAA,WACF;AAAA,UAED,cAAc,YAAA,oBACb,GAAA;AAAA,YAAC,YAAA;AAAA,YAAA;AAAA,cACC,IAAA,EAAM;AAAA,gBACJ,EAAE,KAAA,EAAO,IAAA,EAAM,KAAA,EAAO,aAAa,EAAA,EAAG;AAAA,gBACtC,EAAE,KAAA,EAAO,IAAA,EAAM,KAAA,EAAO,aAAa,EAAA;AAAG,eACxC;AAAA,cACA,OAAO,CAAA,CAAE,MAAA;AAAA,cACT,KAAA,EAAO,MAAA;AAAA,cACP,QAAA,EAAU,CAAC,KAAA,KAAU,cAAA,CAAe,KAAoB,CAAA;AAAA,cAGxD,IAAA;AAAA,cACA,QAAA;AAAA,cACA,QAAA;AAAA,cACA,OAAA;AAAA,cACA,WAAW,UAAA,EAAY,MAAA;AAAA,cAOvB,UAAA,EAAY,EAAE,KAAA,EAAO,iBAAA,EAAmB,OAAO,SAAA;AAAU;AAAA;AAC3D;AAAA;AAAA;AAEJ;AAEJ","file":"chunk-FCBYUN6F.js","sourcesContent":["export type HourCycle = \"h11\" | \"h12\" | \"h23\" | \"h24\"\n\n/**\n * Resolve 12h vs 24h display (Req #6): an explicit `hourCycle` wins, then\n * `format`, else the locale's own convention via `Intl.DateTimeFormat`. Shared\n * by `TimeInput` and `DatePicker`'s embedded time panel so both pick the same\n * cycle for the same locale.\n */\nexport const resolveHourCycle = ({\n locale,\n format,\n hourCycle,\n}: {\n locale: string\n format?: 12 | 24\n hourCycle?: HourCycle\n}): HourCycle => {\n if (hourCycle) return hourCycle\n if (format !== undefined) return format === 12 ? \"h12\" : \"h23\"\n return Intl.DateTimeFormat(locale, { hour: \"numeric\" }).resolvedOptions().hourCycle as HourCycle\n}\n\n/** Whether a resolved cycle displays 12 hours + AM/PM (`h11`/`h12`) rather than all 24. */\nexport const is12Hour = (cycle: HourCycle): boolean => cycle === \"h11\" || cycle === \"h12\"\n\n/** The hours each cycle displays: `h11` 0–11, `h12` 1–12, `h23` 0–23, `h24` 1–24. In the two\n * cycles that start at 1, midnight (and, for `h12`, noon) reads as the top of the range. */\nexport const HOUR_RANGES: Record<HourCycle, { min: number; max: number }> = {\n h11: { min: 0, max: 11 },\n h12: { min: 1, max: 12 },\n h23: { min: 0, max: 23 },\n h24: { min: 1, max: 24 },\n}\n\n/** Convert a stored 24h hour (`0`–`23`) to the hour `cycle` displays, plus its period in the\n * 12-hour cycles (`null` otherwise) — e.g. midnight is `12` AM in `h12`, `0` AM in `h11`, `0` in\n * `h23` and `24` in `h24`. */\nexport const toDisplayHour = (\n hour24: number,\n cycle: HourCycle,\n): { hour: number; period: \"AM\" | \"PM\" | null } => {\n const twelveHour = is12Hour(cycle)\n const hour = twelveHour ? hour24 % 12 : hour24\n return {\n hour: hour === 0 && HOUR_RANGES[cycle].min === 1 ? HOUR_RANGES[cycle].max : hour,\n period: twelveHour ? (hour24 < 12 ? \"AM\" : \"PM\") : null,\n }\n}\n\n/** The inverse of `toDisplayHour`: a displayed hour (+ period in the 12-hour cycles) back to a\n * stored 24h hour. A missing hour reads as the start of its half of the day — midnight, or noon\n * once PM is picked — and a missing period as AM. */\nexport const fromDisplayHour = (\n hour: number | null,\n period: \"AM\" | \"PM\" | null,\n cycle: HourCycle,\n): number => {\n const offset = is12Hour(cycle) && period === \"PM\" ? 12 : 0\n if (hour === null) return offset\n return is12Hour(cycle) ? (hour % 12) + offset : hour % 24\n}\n\n/** Locale-correct AM/PM display strings (e.g. \"AM\"/\"PM\" en-US, \"午前\"/\"午後\" ja-JP), read via\n * `Intl.DateTimeFormat`'s own `dayPeriod` part rather than a hardcoded English literal. Keyed by\n * the same `\"AM\" | \"PM\"` domain value `toDisplayHour`/`fromDisplayHour` use throughout, so this only ever\n * changes what's *displayed*, never what's stored/serialized. */\nexport const dayPeriodLabels = (locale: string): Record<\"AM\" | \"PM\", string> => {\n const dayPeriod = (hour: number) =>\n new Intl.DateTimeFormat(locale, { hour: \"numeric\", hour12: true })\n .formatToParts(new Date(2000, 0, 1, hour))\n .find((part) => part.type === \"dayPeriod\")?.value ?? (hour < 12 ? \"AM\" : \"PM\")\n return { AM: dayPeriod(9), PM: dayPeriod(21) }\n}\n\n/** Locale-correct narrow unit abbreviations for the Hour/Minute/Second suffix (e.g. \"h\"/\"m\"/\"s\"\n * en-US, \"h\"/\"min\"/\"s\" fr-FR), read via `Intl.NumberFormat`'s own unit formatting rather than\n * hardcoded English literals. */\nconst UNIT_FALLBACK = { hour: \"h\", minute: \"m\", second: \"s\" } as const\n\nexport const timeUnitLabels = (\n locale: string,\n): { hour: string; minute: string; second: string } => {\n const unit = (u: \"hour\" | \"minute\" | \"second\") =>\n new Intl.NumberFormat(locale, { style: \"unit\", unit: u, unitDisplay: \"narrow\" })\n .formatToParts(1)\n .find((part) => part.type === \"unit\")?.value ?? UNIT_FALLBACK[u]\n return { hour: unit(\"hour\"), minute: unit(\"minute\"), second: unit(\"second\") }\n}\n","\"use client\"\n\nimport { useLocaleContext } from \"@ark-ui/react/locale\"\nimport type { FocusEvent, KeyboardEvent, Ref } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport type { Size } from \"../../lib/sizes\"\nimport type { InputVariant } from \"../input/input\"\nimport { NumberInput, type NumberInputTranslations } from \"../number-input/number-input\"\nimport { SegmentGroup } from \"../segment-group/segment-group\"\nimport {\n dayPeriodLabels,\n HOUR_RANGES,\n type HourCycle,\n is12Hour,\n timeUnitLabels,\n} from \"./hour-cycle\"\n\n/**\n * The HOUR/MINUTE (+ SECOND) + AM/PM row — the piece `TimeInput` wraps with\n * state, and `DatePicker`'s embedded time panel wraps with `api.setTime()`\n * (one implementation, two call sites). Operates entirely in *display* units\n * (the cycle's own hours — 0–11, 1–12, 0–23 or 1–24) — the always-24h stored `hour` conversion\n * happens at the caller's boundary, not here.\n */\n\ntype TimeRowClassNames = {\n hour?: string\n minute?: string\n second?: string\n period?: string\n}\n\n/** Overrides the sr-only accessible names for Hour/Minute/Second/Period — English by default.\n * Arbitrary microcopy with no locale-derivation path (unlike AM/PM and the unit suffixes,\n * which read from `Intl` instead). `incrementLabel`/`decrementLabel` are `NumberInput`'s own\n * keys, forwarded to each field's steppers (defaults `\"Increment\"` / `\"Decrement\"`). */\nexport type TimeRowTranslations = Pick<\n NumberInputTranslations,\n \"incrementLabel\" | \"decrementLabel\"\n> & {\n /** The whole row's group name when nothing visible labels it. Default `\"Time\"`. */\n time?: string\n hour?: string\n minute?: string\n second?: string\n period?: string\n}\n\n/** The row's English accessible names, merged once under `translations`. `NumberInput` keeps\n * its own stepper defaults. */\nconst TIME_ROW_DEFAULT_TRANSLATIONS = {\n time: \"Time\",\n hour: \"Hour\",\n minute: \"Minute\",\n second: \"Second\",\n period: \"Period\",\n} as const satisfies TimeRowTranslations\n\n/** Starting *and floor* size for the Hour/Minute/Second fields, per `size` — `flex-1`'s basis so\n * each field still grows to fill the row, plus an equal `min-width` so it never shrinks back\n * below that. Without the `min-width`, the field's inner `<input>` has `min-w-0` (needed so the\n * value can shrink instead of forcing the row to overflow when it's genuinely too narrow), which\n * otherwise lets `flex-1` starve it arbitrarily close to zero — that's exactly how the `<input>`\n * was measured shrinking to ~11px in a too-narrow `DatePicker` popover column, clipping the\n * 2-digit value. A too-narrow row now genuinely overflows (or wraps, if a wrapping ancestor\n * provides one) instead of silently clipping — the honest failure mode; `DatePicker`'s own\n * column-width fix (`timeRowMinWidth` below) is what actually prevents hitting it in practice.\n *\n * Calibrated against a real measurement, minus `shellGap`'s own per-size pixel value (6/6/8/10/12px\n * for xs/sm/md/lg/xl) — `NumberInput`'s value↔suffix pair no longer carries that gap (glued\n * together in their own nested row, see its own comment), so each field's true minimum content\n * width shrank by exactly that much. */\nexport const TIME_FIELD_BASIS_PX: Record<Size, number> = { xs: 64, sm: 72, md: 78, lg: 86, xl: 100 }\n/** The same widths as Tailwind classes, written out in full: Tailwind finds classes by scanning\n * source text (a consumer's build scans the shipped `dist`), so a class assembled from a template\n * literal is never generated. `time-row.test.ts` keeps these in step with `TIME_FIELD_BASIS_PX`. */\nexport const timeFieldBasis: Record<Size, string> = {\n xs: \"basis-[64px] min-w-[64px]\",\n sm: \"basis-[72px] min-w-[72px]\",\n md: \"basis-[78px] min-w-[78px]\",\n lg: \"basis-[86px] min-w-[86px]\",\n xl: \"basis-[100px] min-w-[100px]\",\n}\n\n/** The row's own gap between Hour/Minute/Second/Period (`gap-2` below) — flat across `size`,\n * unlike each field's *internal* value↔suffix↔steppers gap (`shellGap`, size-dependent). */\nconst ROW_GAP_PX = 8\n\n/** The AM/PM toggle's own natural (unstretched — it's `shrink-0`, not `flex-1`) rendered width\n * per `size`, measured directly rather than estimated. It wraps onto its own line below\n * Hour/Minute (the row's `flex-wrap` below) instead of forcing the whole row wider, so this\n * only matters for `timeRowMinWidth` as a floor *in case* it's ever wider than Hour+Minute\n * themselves — not as an unconditional addition to their combined width (see below). */\nconst PERIOD_WIDTH_PX: Record<Size, number> = { xs: 60, sm: 74, md: 88, lg: 110, xl: 133 }\n\n/** The row's own minimum rendered width for a given configuration. `DatePicker` uses this (see\n * its own `calendarColumnWidth` comment) to keep its popover column at least as wide as the\n * embedded time row needs, instead of only ever sizing off the calendar grid — otherwise the\n * row's `flex-1` + `min-w-0` fields silently shrink below their content size to fit.\n *\n * This is deliberately just Hour/Minute/[Second] at their basis plus the gaps *between* them —\n * not the AM/PM toggle's width added on top. The toggle wraps onto its own line (the row's\n * `flex-wrap` below) rather than forcing the row wider, so at a single narrow month it drops\n * below Hour/Minute instead of pushing the popover past the calendar's own width — the row only\n * needs to be as wide as the toggle itself in the (currently never hit — Hour+Minute together\n * are wider than the toggle at every size) case where that's the larger requirement. */\nexport const timeRowMinWidth = (\n size: Size,\n hourCycle: HourCycle,\n withSeconds: boolean | undefined,\n): number => {\n const fieldCount = 2 + (withSeconds ? 1 : 0)\n const fieldsWidth = fieldCount * TIME_FIELD_BASIS_PX[size] + (fieldCount - 1) * ROW_GAP_PX\n return is12Hour(hourCycle) ? Math.max(fieldsWidth, PERIOD_WIDTH_PX[size]) : fieldsWidth\n}\n\n/** ArrowLeft/ArrowRight at the edge of a field's text moves to the neighbouring field — caret at\n * its far side, so the motion reads as one continuous caret across the row — and from the last\n * number field \"next\" lands on the AM/PM toggle's checked (or first) radio. Inside the toggle the\n * arrows stay the radio group's own (switching AM/PM); Shift+Tab leaves it. `dir=\"rtl\"` mirrors\n * the keys, since the row's visual order is mirrored too. Anything else — a modifier, a\n * selection, a caret mid-text — keeps the native caret movement. */\nconst moveAcrossFields = (event: KeyboardEvent<HTMLDivElement>, dir: \"ltr\" | \"rtl\") => {\n if (event.key !== \"ArrowLeft\" && event.key !== \"ArrowRight\") return\n if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return\n const input = event.target\n if (!(input instanceof HTMLInputElement) || input.type !== \"text\") return\n const { selectionStart, selectionEnd, value } = input\n if (selectionStart !== selectionEnd) return\n const forward = (event.key === \"ArrowRight\") !== (dir === \"rtl\")\n if (forward ? selectionEnd !== value.length : selectionStart !== 0) return\n\n const row = event.currentTarget\n const fields = [...row.querySelectorAll<HTMLInputElement>('input[type=\"text\"]:not(:disabled)')]\n const next =\n fields[fields.indexOf(input) + (forward ? 1 : -1)] ??\n (forward\n ? (row.querySelector<HTMLInputElement>('input[type=\"radio\"]:checked:not(:disabled)') ??\n row.querySelector<HTMLInputElement>('input[type=\"radio\"]:not(:disabled)'))\n : null)\n if (!next) return\n event.preventDefault()\n next.focus()\n if (next.type === \"text\") {\n const caret = forward ? 0 : next.value.length\n next.setSelectionRange(caret, caret)\n }\n}\n\nexport type TimeRowProps = {\n hour: number | null\n minute: number | null\n second?: number | null\n onHourChange: (hour: number | null) => void\n onMinuteChange: (minute: number | null) => void\n onSecondChange?: (second: number | null) => void\n period: \"AM\" | \"PM\" | null\n onPeriodChange: (period: \"AM\" | \"PM\") => void\n hourCycle: HourCycle\n minuteStep?: number\n withSeconds?: boolean\n /** Placeholder shown in each empty Hour/Minute/Second field. Default `\"--\"`. */\n placeholder?: string\n /** Resolves the locale-correct AM/PM labels + Hour/Minute/Second unit suffixes via `Intl`.\n * Falls back to `useLocaleContext()` when omitted. */\n locale?: string\n /** Overrides the sr-only Hour/Minute/Second/Period accessible names. English by default. */\n translations?: TimeRowTranslations\n size?: Size\n variant?: InputVariant\n disabled?: boolean\n readOnly?: boolean\n invalid?: boolean\n /** Lands on the hour field's `<input>` for focus-on-error. */\n ref?: Ref<HTMLInputElement>\n /** Forwarded to the hour field's `<input>`; drives touched/blurred validation. */\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void\n /** Names the row's `role=\"group\"` directly when no visible label points at it. Defaults to\n * `translations.time` (`\"Time\"`), so the group is never anonymous. */\n \"aria-label\"?: string\n /** Names the row's `role=\"group\"` from a visible label, e.g. `TimeInput`'s field label or\n * `DatePicker`'s \"Start time\" / \"End time\". Without a name a screen reader enters the group\n * hearing only \"Hour\". */\n \"aria-labelledby\"?: string\n /** Helper / error text read after the group's name. */\n \"aria-describedby\"?: string\n className?: string\n classNames?: TimeRowClassNames\n}\n\nexport const TimeRow = ({\n hour,\n minute,\n second,\n onHourChange,\n onMinuteChange,\n onSecondChange,\n period,\n onPeriodChange,\n hourCycle,\n minuteStep = 1,\n withSeconds,\n placeholder = \"--\",\n locale,\n translations,\n size = \"md\",\n variant = \"default\",\n disabled,\n readOnly,\n invalid,\n ref,\n onBlur,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-describedby\": ariaDescribedBy,\n className,\n classNames,\n}: TimeRowProps) => {\n const { locale: contextLocale, dir } = useLocaleContext()\n const resolvedLocale = locale ?? contextLocale\n const twelveHour = is12Hour(hourCycle)\n const units = timeUnitLabels(resolvedLocale)\n const periodLabels = twelveHour ? dayPeriodLabels(resolvedLocale) : null\n const t = { ...TIME_ROW_DEFAULT_TRANSLATIONS, ...translations }\n\n return (\n // `flex-wrap`: at a single narrow month under `DatePicker`, Hour/Minute/[Second] fit the\n // calendar's own width but the AM/PM toggle doesn't (see `timeRowMinWidth`'s comment) — this\n // drops it to its own line there instead of forcing the whole popover wider than the\n // calendar to fit it on the same line. No visual change wherever there's already enough\n // width (every other context) — wrapping only kicks in once it's genuinely too narrow.\n // `role=\"group\"`: Hour/Minute/[Second]/Period are the parts of one time value — and the\n // row owns keyboard behaviour across them (`moveAcrossFields`), which a bare `<div>` can't.\n // biome-ignore lint/a11y/useSemanticElements: a `<fieldset>` brings UA border/padding/`min-inline-size` that fight this wrapping flex row, for the same `group` semantics\n <div\n role=\"group\"\n aria-label={ariaLabelledBy ? undefined : (ariaLabel ?? t.time)}\n aria-labelledby={ariaLabelledBy}\n aria-describedby={ariaDescribedBy}\n className={cn(\"flex flex-wrap items-end gap-2\", className)}\n onKeyDown={(event) => moveAcrossFields(event, dir)}\n >\n <NumberInput\n ref={ref}\n onBlur={onBlur}\n label={t.hour}\n placeholder={placeholder}\n value={hour}\n onChange={onHourChange}\n min={HOUR_RANGES[hourCycle].min}\n max={HOUR_RANGES[hourCycle].max}\n step={1}\n wrap\n formatOptions={{ minimumIntegerDigits: 2 }}\n size={size}\n variant={variant}\n disabled={disabled}\n readOnly={readOnly}\n invalid={invalid}\n // \"Hour\" stays the accessible name (sr-only keeps it in the a11y tree,\n // just visually hidden) — the unit suffix is a decorative stand-in,\n // right next to the value once it's right-aligned (`text-end`).\n translations={t}\n suffix={units.hour}\n className={classNames?.hour}\n classNames={{\n field: cn(\"flex-1\", timeFieldBasis[size]),\n label: \"sr-only\",\n input: \"text-end\",\n }}\n />\n <NumberInput\n label={t.minute}\n placeholder={placeholder}\n value={minute}\n onChange={onMinuteChange}\n min={0}\n max={59}\n step={minuteStep}\n wrap\n formatOptions={{ minimumIntegerDigits: 2 }}\n size={size}\n variant={variant}\n disabled={disabled}\n readOnly={readOnly}\n invalid={invalid}\n translations={t}\n suffix={units.minute}\n className={classNames?.minute}\n classNames={{\n field: cn(\"flex-1\", timeFieldBasis[size]),\n label: \"sr-only\",\n input: \"text-end\",\n }}\n />\n {withSeconds && (\n <NumberInput\n label={t.second}\n placeholder={placeholder}\n value={second ?? null}\n onChange={onSecondChange}\n min={0}\n max={59}\n step={1}\n wrap\n formatOptions={{ minimumIntegerDigits: 2 }}\n size={size}\n variant={variant}\n disabled={disabled}\n readOnly={readOnly}\n invalid={invalid}\n translations={t}\n suffix={units.second}\n className={classNames?.second}\n classNames={{\n field: cn(\"flex-1\", timeFieldBasis[size]),\n label: \"sr-only\",\n input: \"text-end\",\n }}\n />\n )}\n {twelveHour && periodLabels && (\n <SegmentGroup\n data={[\n { value: \"AM\", label: periodLabels.AM },\n { value: \"PM\", label: periodLabels.PM },\n ]}\n label={t.period}\n value={period}\n onChange={(value) => onPeriodChange(value as \"AM\" | \"PM\")}\n // `SegmentGroup`'s sizes match `NumberInput`'s box height exactly, so\n // the AM/PM toggle sits flush with the Hour/Minute fields.\n size={size}\n disabled={disabled}\n readOnly={readOnly}\n invalid={invalid}\n className={classNames?.period}\n // Unlike Hour/Minute/Second, the AM/PM toggle has a fixed, small set of labels — it\n // doesn't need (or look right) stretching to share the row's leftover width. `w-auto`\n // cancels the Field wrapper's own default `w-full` (which would otherwise still set its\n // flex-basis to the full row width even without `flex-1`); `shrink-0` keeps it stable.\n // \"Period\" keeps the accessible name (sr-only) but no visible label or suffix — the\n // segment control itself already shows \"AM\"/\"PM\", self-descriptive.\n classNames={{ field: \"w-auto shrink-0\", label: \"sr-only\" }}\n />\n )}\n </div>\n )\n}\n"]}
|
|
@@ -10,8 +10,25 @@ import { Tooltip as Tooltip$1 } from '@ark-ui/react/tooltip';
|
|
|
10
10
|
import { cva } from 'class-variance-authority';
|
|
11
11
|
import { createContext, useContext } from 'react';
|
|
12
12
|
import { match } from 'ts-pattern';
|
|
13
|
-
import {
|
|
13
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
14
14
|
|
|
15
|
+
var floatingArrowVars = {
|
|
16
|
+
"--arrow-size": "12px",
|
|
17
|
+
"--arrow-offset": "-8px"
|
|
18
|
+
};
|
|
19
|
+
var floatingArrowTip = "-z-1! rounded-xxs [clip-path:polygon(0_0,76%_0,0_76%)]";
|
|
20
|
+
function createFloatingArrow(ArkArrow, ArkArrowTip, surface) {
|
|
21
|
+
const tip = cn(floatingArrowTip, surface);
|
|
22
|
+
return ({ className, style, testId, asChild: _asChild, ...rest }) => /* @__PURE__ */ jsx(
|
|
23
|
+
ArkArrow,
|
|
24
|
+
{
|
|
25
|
+
...{ style: { ...floatingArrowVars, ...style } },
|
|
26
|
+
...props({ "data-testid": testId }),
|
|
27
|
+
...rest,
|
|
28
|
+
children: /* @__PURE__ */ jsx(ArkArrowTip, { className: cn(tip, className) })
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
15
32
|
var tooltipContent = cn(
|
|
16
33
|
"max-w-[16rem] rounded-xs px-2 py-1",
|
|
17
34
|
"text-xs leading-snug focus:outline-none",
|
|
@@ -21,7 +38,7 @@ var tooltipContent = cn(
|
|
|
21
38
|
"data-[placement^=left]:origin-right data-[placement^=right]:origin-left"
|
|
22
39
|
);
|
|
23
40
|
var tooltipPositioner = "rounded-xs shadow-md";
|
|
24
|
-
var
|
|
41
|
+
var tooltipArrowSurface = "bg-brand-950! dark:bg-white!";
|
|
25
42
|
var tooltipTrigger = cva(
|
|
26
43
|
[
|
|
27
44
|
"inline cursor-help appearance-none border-0 bg-transparent p-0",
|
|
@@ -83,15 +100,7 @@ var Content = ({ className, children, testId, ...rest }) => {
|
|
|
83
100
|
if (!withinPortal) return bubble;
|
|
84
101
|
return /* @__PURE__ */ jsx(Portal, { container: portalContainer, children: bubble });
|
|
85
102
|
};
|
|
86
|
-
var Arrow = (
|
|
87
|
-
Tooltip$1.Arrow,
|
|
88
|
-
{
|
|
89
|
-
style: { ["--arrow-size"]: "12px", ["--arrow-offset"]: "-8px", ...style },
|
|
90
|
-
...props({ "data-testid": testId }),
|
|
91
|
-
...rest,
|
|
92
|
-
children: /* @__PURE__ */ jsx(Tooltip$1.ArrowTip, { className: cn(tooltipArrow, className) })
|
|
93
|
-
}
|
|
94
|
-
);
|
|
103
|
+
var Arrow = createFloatingArrow(Tooltip$1.Arrow, Tooltip$1.ArrowTip, tooltipArrowSurface);
|
|
95
104
|
var TooltipComponent = ({
|
|
96
105
|
label,
|
|
97
106
|
children,
|
|
@@ -127,6 +136,6 @@ var Tooltip = Object.assign(TooltipComponent, {
|
|
|
127
136
|
Arrow
|
|
128
137
|
});
|
|
129
138
|
|
|
130
|
-
export { Tooltip };
|
|
131
|
-
//# sourceMappingURL=chunk-
|
|
132
|
-
//# sourceMappingURL=chunk-
|
|
139
|
+
export { Tooltip, createFloatingArrow };
|
|
140
|
+
//# sourceMappingURL=chunk-FED6SJWM.js.map
|
|
141
|
+
//# sourceMappingURL=chunk-FED6SJWM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/floating-arrow.tsx","../src/components/tooltip/tooltip.tsx"],"names":["jsx","ArkTooltip"],"mappings":";;;;;;;;;;;;;;AAoBO,IAAM,iBAAA,GAAoB;AAAA,EAC/B,cAAA,EAAgB,MAAA;AAAA,EAChB,gBAAA,EAAkB;AACpB,CAAA;AAYO,IAAM,gBAAA,GAAmB,wDAAA;AAsBzB,SAAS,mBAAA,CACd,QAAA,EACA,WAAA,EACA,OAAA,EAC+C;AAC/C,EAAA,MAAM,GAAA,GAAM,EAAA,CAAG,gBAAA,EAAkB,OAAO,CAAA;AACxC,EAAA,OAAO,CAAC,EAAE,SAAA,EAAW,KAAA,EAAO,QAAQ,OAAA,EAAS,QAAA,EAAU,GAAG,IAAA,EAAK,qBAC7D,GAAA;AAAA,IAAC,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["import type { ComponentType, CSSProperties, JSX, ReactNode } from \"react\"\nimport type { NoAsChild } from \"./as-child\"\nimport { cn } from \"./cn\"\nimport { props } from \"./props\"\nimport type { WithTestId } from \"./test-id\"\n\n/**\n * The kit's floating arrow: the small rotated square that points a floating\n * panel (Tooltip's bubble, a Tour step's card) at its anchor.\n *\n * Ark gives every floating machine the same two parts, `Arrow` (a sized,\n * positioned box) and `ArrowTip` (the rotated square inside it), each scoped\n * to its own machine. The recipe on top is what the kit shares: the square's\n * size, how far it tucks back under the panel, and the classes that hide all\n * but its tip. Only the surface colour differs per component, so it is the\n * one thing `createFloatingArrow` takes besides the two Ark parts.\n */\n\n/** The arrow's size, and how far it pulls back under the panel (`--arrow-offset`)\n * so it reads as a pointer, not a detached diamond. Ark reads both vars. */\nexport const floatingArrowVars = {\n \"--arrow-size\": \"12px\",\n \"--arrow-offset\": \"-8px\",\n} as CSSProperties\n\n/** `-z-1` tucks the square behind the panel's content. The `!` is required\n * because Ark positions the tip with an inline style (`z-index: inherit`).\n *\n * It is not behind the panel's own fill, though: the panel is a stacking\n * context, and a negative z-index child still paints over its root's\n * background. So the square is clipped to the corner that pokes out. With a\n * 12px square pulled back 8px, its centre sits 3px inside the panel's edge,\n * 2px below a 1px border; cutting 2px short of the diagonal (2√2 ≈ 2.83px of\n * the 12px sides, so 76%) ends a bordered tip's two edges on the border's\n * inner line, instead of running on into the panel as two stray legs. */\nexport const floatingArrowTip = \"-z-1! rounded-xxs [clip-path:polygon(0_0,76%_0,0_76%)]\"\n\n/** The props every Ark `*.Arrow` part shares that the recipe touches. */\ntype ArkArrowProps = { style?: CSSProperties; children?: ReactNode }\n\n/** Props of an arrow built by `createFloatingArrow`: the Ark part's own props\n * (no `asChild`: the part renders its tip inside itself), plus `testId`. */\nexport type FloatingArrowProps<P extends ArkArrowProps> = NoAsChild<P> &\n WithTestId & {\n /** Classes for the tip, the visible square. */\n className?: string\n }\n\n/**\n * Builds a component's arrow part from its Ark `Arrow` and `ArrowTip`.\n * `surface` paints the tip to match the panel, with `!` because Ark sets the\n * tip's background inline (`var(--arrow-background)`).\n *\n * ```tsx\n * const Arrow = createFloatingArrow(ArkTooltip.Arrow, ArkTooltip.ArrowTip, \"bg-brand-950! dark:bg-white!\")\n * ```\n */\nexport function createFloatingArrow<P extends ArkArrowProps>(\n ArkArrow: ComponentType<P>,\n ArkArrowTip: ComponentType<{ className?: string }>,\n surface: string,\n): (props: FloatingArrowProps<P>) => JSX.Element {\n const tip = cn(floatingArrowTip, surface)\n return ({ className, style, testId, asChild: _asChild, ...rest }) => (\n <ArkArrow\n {...({ style: { ...floatingArrowVars, ...style } } as P)}\n {...props({ \"data-testid\": testId })}\n {...(rest as unknown as P)}\n >\n <ArkArrowTip className={cn(tip, className)} />\n </ArkArrow>\n )\n}\n","\"use client\"\n\nimport { useLocaleContext } from \"@ark-ui/react/locale\"\nimport { Portal } from \"@ark-ui/react/portal\"\nimport { Tooltip as ArkTooltip } from \"@ark-ui/react/tooltip\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { createContext, type ReactNode, useContext } from \"react\"\nimport { match } from \"ts-pattern\"\nimport { cn } from \"../../lib/cn\"\nimport { createFloatingArrow, type FloatingArrowProps } from \"../../lib/floating-arrow\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { useOverlayContainer } from \"../../lib/overlay-container\"\nimport { type LogicalPosition, resolveLogicalPlacement } from \"../../lib/placement\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TEXT_COLOR_CLASSES } from \"../../lib/typography-size\"\n\n/**\n * Tooltip — the kit's hover/focus **hint**, a styled layer over Ark UI's\n * Tooltip. It's the lightweight counterpart to `Popover` (which is a clickable,\n * focus-trapping panel): Ark's Tooltip machine opens on hover *and* keyboard\n * focus, wires `role=\"tooltip\"` + `aria-describedby` automatically, dismisses on\n * `Esc` / scroll / pointer-down, and never traps focus.\n *\n * Two ways to use it — the convenience form drops into running text or wraps any\n * element; the compound parts mirror `Popover.Root` / `Trigger` / `Content`.\n *\n * // 1. Inline — `children` become a focusable inline trigger\n * <Tooltip label=\"A project at 42.\">norm</Tooltip>\n *\n * // 2. Wrap an element — `asChild` makes the child the trigger\n * <Tooltip label=\"Delete\" asChild>\n * <ActionIcon aria-label=\"Delete\"><Trash /></ActionIcon>\n * </Tooltip>\n *\n * // 3. Compound\n * <Tooltip.Root position=\"end\">\n * <Tooltip.Trigger asChild><Button>Hover</Button></Tooltip.Trigger>\n * <Tooltip.Content>\n * <Tooltip.Arrow />\n * Rich <strong>content</strong>\n * </Tooltip.Content>\n * </Tooltip.Root>\n *\n * Visually it reuses the Popover's open/close animation but renders as a small,\n * **inverted** bubble (dark surface in light mode, light in dark) to read as an\n * ephemeral hint rather than a panel. Add `withArrow` (convenience form) or a\n * `Tooltip.Arrow` part (compound) to point the bubble at its trigger.\n */\n\n/** Inverted compact bubble — reuses the shared `popover-in/out` animation tokens\n * (which already honour reduced-motion in `theme.css`) and the placement-origin\n * trick so it grows out of the trigger's edge. */\nconst tooltipContent = cn(\n \"max-w-[16rem] rounded-xs px-2 py-1\",\n \"text-xs leading-snug focus:outline-none\",\n \"bg-brand-950 text-white dark:bg-white dark:text-brand-950\",\n \"data-[state=open]:animate-popover-in data-[state=closed]:animate-popover-out\",\n \"data-[placement^=top]:origin-bottom data-[placement^=bottom]:origin-top\",\n \"data-[placement^=left]:origin-right data-[placement^=right]:origin-left\",\n)\n\n/** The bubble's shadow lives on the *positioner* (this wrapper), not on the\n * content. A `box-shadow` on the content paints as one unit *with* its\n * background, so it lands on top of the behind-arrow (`-z-1`) and smears\n * across the protruding tip. Hosting the shadow here reorders the paint to\n * shadow → arrow → content: the positioner's shadow sits at the back of its\n * stacking context (it's the `isolate` root), the arrow paints above it, and\n * the content background paints last — so the shadow never touches the arrow,\n * the arrow never covers the label, and the bubble keeps its shadow.\n * `rounded-xs` matches the content radius so the shadow's corners line up. */\nconst tooltipPositioner = \"rounded-xs shadow-md\"\n\n/** Inverted arrow surface, matching the bubble. The rest of the arrow recipe\n * (size, tuck, `-z-1`) is the kit's shared `createFloatingArrow`. */\nconst tooltipArrowSurface = \"bg-brand-950! dark:bg-white!\"\n\n/** Resets the `<button type=\"button\">` the default trigger renders down to plain\n * inline text, so a Tooltip can sit on a word inside a `<p>` (a `<button>` is\n * phrasing content) while staying a real, keyboard-focusable control rather\n * than a role-less `tabIndex` span. `cursor-help` signals the hint;\n * `[font:inherit]` and `text-start` undo the UA button's font and centring. */\nconst tooltipTrigger = cva(\n [\n \"inline cursor-help appearance-none border-0 bg-transparent p-0\",\n \"[font:inherit] text-inherit text-start\",\n focusStyles(),\n \"rounded-xs\",\n ],\n {\n variants: {\n variant: {\n text: cn(\"underline decoration-dotted underline-offset-2\", TEXT_COLOR_CLASSES.primary),\n inline: \"\",\n },\n },\n defaultVariants: {\n variant: \"inline\",\n },\n },\n)\n\ntype TooltipPlacement = NonNullable<NonNullable<ArkTooltip.RootProps[\"positioning\"]>[\"placement\"]>\n\n/** `position` accepts Ark's physical placements plus the logical, RTL-aware\n * horizontal sides `start` / `end` (resolved to `left` / `right` by direction). */\nexport type TooltipPosition = LogicalPosition<TooltipPlacement>\n\ntype TooltipContextValue = {\n withinPortal: boolean\n container?: HTMLElement | null\n}\nconst TooltipContext = createContext<TooltipContextValue>({ withinPortal: true })\n\nexport type TooltipRootProps = Omit<ArkTooltip.RootProps, \"positioning\"> & {\n /** Bubble placement relative to the trigger. Prefer the logical `start` / `end`\n * sides (RTL-aware), or use any Ark placement (`top`, `bottom`, `top-start`, …).\n * Defaults to `\"top\"`. */\n position?: TooltipPosition\n /** Gap in px between the trigger and the bubble. */\n offset?: number\n /** Render the bubble in a Portal so it escapes clipping ancestors. Default `true`. */\n withinPortal?: boolean\n /** Portal target. Defaults to the enclosing `Modal`/`Drawer` when there is\n * one (so the panel stays above it), else `document.body`. */\n container?: HTMLElement | null\n /** Fires on close (any source) — pointer/focus leaving the trigger, Escape, or a controlled `onOpenChange`. */\n onClose?: () => void\n}\n\nconst Root = ({\n position = \"top\",\n offset,\n withinPortal = true,\n container,\n children,\n onOpenChange,\n onClose,\n ...rest\n}: TooltipRootProps) => {\n const { dir } = useLocaleContext()\n return (\n <TooltipContext.Provider value={{ withinPortal, container }}>\n {/* Mount the bubble only while shown (lazyMount + unmountOnExit): closed →\n nothing rendered, so an inline trigger never emits a positioner <div>\n into a host <p> on SSR. Both are overridable via `...rest`. */}\n <ArkTooltip.Root\n lazyMount\n unmountOnExit\n positioning={{ placement: resolveLogicalPlacement(position, dir), gutter: offset }}\n onOpenChange={(details) => {\n onOpenChange?.(details)\n if (!details.open) onClose?.()\n }}\n {...rest}\n >\n {children}\n </ArkTooltip.Root>\n </TooltipContext.Provider>\n )\n}\n\nexport type TooltipContentProps = ArkTooltip.ContentProps & WithTestId\n\nconst Content = ({ className, children, testId, ...rest }: TooltipContentProps) => {\n const { withinPortal, container } = useContext(TooltipContext)\n const portalContainer = useOverlayContainer(container)\n const bubble = (\n <ArkTooltip.Positioner className={tooltipPositioner}>\n <ArkTooltip.Content\n className={cn(tooltipContent, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {children}\n </ArkTooltip.Content>\n </ArkTooltip.Positioner>\n )\n if (!withinPortal) return bubble\n return <Portal container={portalContainer}>{bubble}</Portal>\n}\n\nexport type TooltipArrowProps = FloatingArrowProps<ArkTooltip.ArrowProps>\n\n/** The little arrow linking the bubble to its trigger. Compose it inside a\n * `Tooltip.Content` (or let the convenience form's `withArrow` add it for you).\n * Built on the kit's shared floating arrow, so it sizes and tucks under the\n * bubble like every other floating panel's arrow. */\nconst Arrow = createFloatingArrow(ArkTooltip.Arrow, ArkTooltip.ArrowTip, tooltipArrowSurface)\n\nexport type TooltipProps = TooltipRootProps &\n WithTestId & {\n /** The hint shown on hover and keyboard focus. Named `label` for parity with\n * the rest of the kit; wired as a description via Ark's `aria-describedby`. */\n label: ReactNode\n /** The trigger. By default it's wrapped in a focusable inline trigger (so it\n * drops into running text); with `asChild`, this element *is* the trigger. */\n children: ReactNode\n /** Render `children` as the trigger instead of wrapping them. */\n asChild?: boolean\n /** Add a small arrow pointing at the trigger. For the compound form, compose\n * `<Tooltip.Arrow />` inside `<Tooltip.Content>` instead. */\n withArrow?: boolean\n variant?: VariantProps<typeof tooltipTrigger>[\"variant\"]\n classNames?: { trigger?: string; content?: string; arrow?: string }\n }\n\n/** Convenience form: `Root` + `Trigger` + `Content` wired from `label`/`children`.\n * `testId` lands on `Content` (the rendered bubble) — `Root` has no DOM node\n * of its own. */\nconst TooltipComponent = ({\n label,\n children,\n asChild,\n classNames,\n withArrow,\n variant = \"inline\",\n testId,\n ...root\n}: TooltipProps) => {\n return (\n <Root {...root}>\n {match({ asChild })\n .with({ asChild: true }, () => <ArkTooltip.Trigger asChild>{children}</ArkTooltip.Trigger>)\n .otherwise(() => (\n // Ark wires `aria-describedby` to the bubble itself, while it's shown.\n <ArkTooltip.Trigger\n type=\"button\"\n className={cn(tooltipTrigger({ variant }), classNames?.trigger)}\n >\n {children}\n </ArkTooltip.Trigger>\n ))}\n <Content className={classNames?.content} testId={testId}>\n {withArrow && <Arrow className={classNames?.arrow} />}\n {label}\n </Content>\n </Root>\n )\n}\n\nexport const Tooltip = Object.assign(TooltipComponent, {\n Root,\n Trigger: ArkTooltip.Trigger,\n Content,\n Arrow,\n})\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { controlIndicator } from './chunk-NLOBBJAA.js';
|
|
2
|
-
import { requiredMark, fieldLabel, FieldShell, fieldInlineStack, fieldA11yProps } from './chunk-
|
|
2
|
+
import { useInheritedInvalid, useInheritedDisabled, requiredMark, fieldLabel, FieldShell, fieldInlineStack, fieldA11yProps } from './chunk-2RRTT4AF.js';
|
|
3
3
|
import { CheckIcon } from './chunk-6YNLRQ25.js';
|
|
4
4
|
import { mergeIcons, iconStroke } from './chunk-XXOR34T4.js';
|
|
5
5
|
import { props } from './chunk-WYCMIIRR.js';
|
|
@@ -42,7 +42,8 @@ var Checkbox = ({
|
|
|
42
42
|
icons: iconsProp
|
|
43
43
|
}) => {
|
|
44
44
|
const icons = mergeIcons(DEFAULT_ICONS, iconsProp);
|
|
45
|
-
const isInvalid = invalid || error != null;
|
|
45
|
+
const isInvalid = useInheritedInvalid(invalid || error != null);
|
|
46
|
+
const isDisabled = useInheritedDisabled(disabled);
|
|
46
47
|
const hasStack = label != null && (description != null || error != null);
|
|
47
48
|
const labelNode = label != null && /* @__PURE__ */ jsxs(
|
|
48
49
|
Checkbox$1.Label,
|
|
@@ -61,7 +62,7 @@ var Checkbox = ({
|
|
|
61
62
|
defaultChecked,
|
|
62
63
|
onCheckedChange: onCheckedChange ? (d) => onCheckedChange(d.checked) : void 0,
|
|
63
64
|
invalid: isInvalid,
|
|
64
|
-
disabled,
|
|
65
|
+
disabled: isDisabled,
|
|
65
66
|
readOnly,
|
|
66
67
|
required,
|
|
67
68
|
name,
|
|
@@ -96,5 +97,5 @@ var Checkbox = ({
|
|
|
96
97
|
};
|
|
97
98
|
|
|
98
99
|
export { Checkbox };
|
|
99
|
-
//# sourceMappingURL=chunk-
|
|
100
|
-
//# sourceMappingURL=chunk-
|
|
100
|
+
//# sourceMappingURL=chunk-FEPIHXVI.js.map
|
|
101
|
+
//# sourceMappingURL=chunk-FEPIHXVI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/checkbox/checkbox.tsx"],"names":["Ark"],"mappings":";;;;;;;;;;;AAqDO,IAAM,aAAA,GAAqD;AAAA,EAChE,KAAA,sBAAQ,SAAA,EAAA,EAAU,CAAA;AAAA,EAClB,aAAA,kBAAe,GAAA,CAAC,KAAA,EAAA,EAAM,SAAA,EAAW,UAAA,EAAY;AAC/C,CAAA;AAyDA,IAAM,mBAAA,GAAsB,CAAC,EAAE,GAAA,EAAK,QAAO,KAA6C;AACtF,EAAA,MAAM,EAAE,mBAAmB,WAAA,EAAa,GAAG,WAAU,GAAI,cAAA,CAAe,iBAAiB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D,QAAA,kBAAA,GAAA,CAAC,mBAAA,EAAA,EAAoB,GAAA,EAAU,MAAA,EAAgB;AAAA;AAAA;AACjD;AAAA;AAAA,GACF;AAEJ","file":"chunk-FEPIHXVI.js","sourcesContent":["\"use client\"\n\nimport { Checkbox as Ark } from \"@ark-ui/react/checkbox\"\nimport { useFieldContext } from \"@ark-ui/react/field\"\nimport { Minus } from \"lucide-react\"\nimport type { FocusEvent, ReactNode, Ref } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { type IconMap, iconStroke, mergeIcons } from \"../../lib/icons\"\nimport { props } from \"../../lib/props\"\nimport type { Size } from \"../../lib/sizes\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport {\n FieldShell,\n fieldA11yProps,\n fieldInlineStack,\n fieldLabel,\n requiredMark,\n useInheritedDisabled,\n useInheritedInvalid,\n} from \"../field/field\"\nimport { CheckIcon } from \"../popover/icons\"\nimport { type ControlIndicatorVariant, controlIndicator } from \"./control\"\n\n/**\n * Checkbox — a single boolean (or tri-state) control on Ark UI's Checkbox\n * machine. The label sits inline beside the box, rendered through the\n * checkbox's own `Ark.Label` part (not `Field`'s) so it stays correctly\n * wired to the hidden input's `aria-labelledby` and — critically — carries no\n * layout footprint when it's visually hidden (e.g. `classNames.label:\n * \"sr-only\"`): an absolutely-positioned flex child isn't a flex item at all,\n * so it can't pick up the root's `gap-2`. `description` / `error` live below\n * the label via the shared `Field` scaffold, with the box centered on the\n * label line, so a `Checkbox` is accessible and complete on its own. Implements the kit's `FormControlProps` contract: the\n * `ref` and `onBlur` land on the submittable hidden `<input>`, and `name`\n * wires it into native form submission.\n *\n * - The checked state is `boolean | \"indeterminate\"`; `onCheckedChange`\n * hands you that next value directly (the indeterminate state never sets\n * itself — drive it from the parent, e.g. a \"select all\" header).\n * - `invalid` is OR'd with `error != null`, matching the rest of the family,\n * so a form library can flip the red state independently of the message.\n *\n * Two `variant`s decide the checked fill: `default` is a neutral, monochrome\n * box (palette-independent), while `filled` tints the checked fill with the\n * active palette via `data-color` + the `--c-solid` slot var. The box is\n * palette-independent at rest, and the focus ring is always the brand ring.\n */\n\nexport type CheckboxIconSlot = \"check\" | \"indeterminate\"\nexport type CheckboxIcons = IconMap<CheckboxIconSlot>\n\n/** The default marks: a check, and a dash for the indeterminate state. */\nexport const DEFAULT_ICONS: Record<CheckboxIconSlot, ReactNode> = {\n check: <CheckIcon />,\n indeterminate: <Minus className={iconStroke} />,\n}\n\nexport type CheckboxProps = WithTestId & {\n /** Controlled checked state. `\"indeterminate\"` renders the partial mark. */\n checked?: boolean | \"indeterminate\"\n /** Uncontrolled initial checked state. */\n defaultChecked?: boolean | \"indeterminate\"\n /** Fires with the next checked state (a value, not a DOM event). */\n onCheckedChange?: (checked: boolean | \"indeterminate\") => void\n /** Inline label beside the box. */\n label?: ReactNode\n /** Helper text above the control. */\n description?: ReactNode\n /** Error message below the control; its presence sets the invalid state. */\n error?: ReactNode\n /** Required flag (and, with a label, the red asterisk). */\n required?: boolean\n /** Red invalid state, OR'd with `error != null`. */\n invalid?: boolean\n /** Dims and blocks interaction. */\n disabled?: boolean\n /** Keeps full contrast but blocks edits. */\n readOnly?: boolean\n size?: Size\n /** Checked-fill treatment: `default` (monochrome) or `filled` (palette-colored). */\n variant?: ControlIndicatorVariant\n color?: Color\n /** Field name for native form submission. */\n name?: string\n /** Submitted value when checked (defaults to `\"on\"`). */\n value?: string\n /** Explicit id for label association. */\n id?: string\n /** Lands on the hidden `<input>` for focus-on-error. */\n ref?: Ref<HTMLInputElement>\n /** Forwarded to the hidden `<input>`; drives touched/blurred validation. */\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void\n /** Replaces the marks: `check` and `indeterminate`. A missing key keeps its default. */\n icons?: CheckboxIcons\n className?: string\n classNames?: {\n root?: string\n control?: string\n label?: string\n /** The description / error field, under the label. */\n field?: string\n }\n}\n\n/**\n * The real, submittable hidden `<input>`, split out so it reads the `Field` context from *inside*\n * the wrapping `FieldShell` — `Checkbox` itself renders that shell, so calling `useFieldContext()`\n * at its own top level would run too early. Same pattern as `Switch`: `fieldA11yProps` points\n * `aria-describedby` at the error once invalid (Ark's own tracking doesn't reliably catch up) and\n * adds `aria-errormessage`. Its `aria-labelledby` is left out: this `Field` never renders a label\n * (the checkbox's own `Ark.Label` names the input), so it would point at nothing.\n */\nconst CheckboxHiddenInput = ({ ref, onBlur }: Pick<CheckboxProps, \"ref\" | \"onBlur\">) => {\n const { \"aria-labelledby\": _unrendered, ...described } = fieldA11yProps(useFieldContext())\n return <Ark.HiddenInput ref={ref} onBlur={onBlur} {...described} />\n}\n\nexport const Checkbox = ({\n checked,\n defaultChecked,\n onCheckedChange,\n label,\n description,\n error,\n required,\n invalid,\n disabled,\n readOnly,\n size = \"md\",\n variant,\n color,\n name,\n value,\n id,\n ref,\n onBlur,\n className,\n classNames,\n testId,\n icons: iconsProp,\n}: CheckboxProps) => {\n const icons = mergeIcons(DEFAULT_ICONS, iconsProp)\n // Red state is driven independently of the `Field` error slot so a form\n // library can flip it from `fieldState.invalid` (see FormControlProps).\n const isInvalid = useInheritedInvalid(invalid || error != null)\n // The hidden input follows a disabled `<fieldset>` natively, but zag only\n // styles its own `disabled` prop: read the group's here so the control dims.\n const isDisabled = useInheritedDisabled(disabled)\n\n // A visible label above description/error switches the root to a grid: the\n // control centers on the label's row alone (not on the whole text stack),\n // and the field hangs under the label in the second column. Label-only\n // (incl. sr-only) stays a plain inline row.\n const hasStack = label != null && (description != null || error != null)\n\n const labelNode = label != null && (\n <Ark.Label\n className={cn(fieldLabel({ size }), !hasStack && \"min-w-0 flex-1\", classNames?.label)}\n >\n {label}\n {required && (\n <span aria-hidden=\"true\" {...requiredMark}>\n *\n </span>\n )}\n </Ark.Label>\n )\n\n return (\n <Ark.Root\n checked={checked}\n defaultChecked={defaultChecked}\n onCheckedChange={onCheckedChange ? (d) => onCheckedChange(d.checked) : undefined}\n invalid={isInvalid}\n disabled={isDisabled}\n readOnly={readOnly}\n required={required}\n name={name}\n value={value}\n id={id}\n data-color={color}\n {...props({ \"data-testid\": testId })}\n // `relative` contains the absolutely positioned hidden input, which would\n // otherwise escape any scroller this control sits in.\n className={cn(\n hasStack\n ? fieldInlineStack({ size })\n : \"relative inline-flex items-center gap-2 select-none\",\n className,\n classNames?.root,\n )}\n >\n <Ark.Control className={cn(controlIndicator({ size, variant }), classNames?.control)}>\n <Ark.Indicator>{icons.check}</Ark.Indicator>\n <Ark.Indicator indeterminate>{icons.indeterminate}</Ark.Indicator>\n </Ark.Control>\n\n {labelNode}\n <FieldShell\n description={description}\n error={error}\n size={size}\n className={cn(hasStack && \"col-start-2\", classNames?.field)}\n >\n <CheckboxHiddenInput ref={ref} onBlur={onBlur} />\n </FieldShell>\n </Ark.Root>\n )\n}\n"]}
|