@42-central/ui-react 0.29.1 → 0.30.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/breadcrumb/breadcrumb.d.ts +5 -1
- package/dist/components/breadcrumb/breadcrumb.d.ts.map +1 -1
- package/dist/components/breadcrumb/index.js +12 -0
- package/dist/components/breadcrumb/index.js.map +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/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/breadcrumb/breadcrumb.test.tsx +24 -0
- package/src/components/breadcrumb/breadcrumb.tsx +20 -1
- 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/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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/segment-group/segment-group.tsx"],"names":["Ark"],"mappings":";;;;;;;;;;;;AAsEA,IAAM,OAAA,GAAU,GAAA;AAAA,EACd;AAAA,IACE,aAAA;AAAA,IACA,wEAAA;AAAA,IACA,kBAAA,CAAmB,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAKnB,8FAAA;AAAA,IACA,mBAAA;AAAA,IACA,2DAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OAAA,EAAS;AAAA,QACP,MAAA,EAAQ,0CAAA;AAAA,QACR,KAAA,EAAO,sCAAA;AAAA,QACP,OAAA,EAAS,sCAAA;AAAA,QACT,MAAA,EAAQ,sCAAA;AAAA,QACR,OAAA,EAAS;AAAA,OACX;AAAA,MACA,IAAA,EAAM;AAAA;AAAA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AA,CAAQ,EAAE,IAAA,EAAM,SAAS,IAAA,EAAM,CAAA,EAAG,UAAA,EAAY,QAAQ,CAAA;AAAA,sBAInE,QAAA,EAAA,UAAA,uBACEA,cAAA,CAAI,WAAA,EAAJ,EACE,QAAA,EAAA,CAAC,GAAA,KACA,WAAW,IAAA,EAA4C;AAAA,wBACrD,SAAS,GAAA,CAAI,OAAA;AAAA,wBACb,UAAU,GAAA,CAAI;AAAA,uBACf,CAAA,EAEL,CAAA,GAEA,IAAA,CAAK;AAAA;AAAA,mBAET;AAAA,kCACA,GAAA,CAACA,cAAA,CAAI,WAAA,EAAJ,EAAgB,CAAA;AAAA,kCACjB,GAAA,CAACA,cAAA,CAAI,eAAA,EAAJ,EAAoB;AAAA;AAAA,eAAA;AAAA,cA1BhB,IAAA,CAAK;AAAA,aA4Bb;AAAA;AAAA,SAAA;AAAA,QA/EI;AAAA;AAgFP;AAAA,GACF;AAEJ","file":"chunk-UBQ54W46.js","sourcesContent":["\"use client\"\n\nimport { useFieldContext } from \"@ark-ui/react/field\"\nimport { SegmentGroup as Ark } from \"@ark-ui/react/segment-group\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport type { FocusEvent, ReactNode, Ref } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { useDirectionCheck } from \"../../lib/intl\"\nimport { useMergedRefs } from \"../../lib/merge-refs\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TEXT_COLOR_CLASSES } from \"../../lib/typography-size\"\nimport { useUncontrolled } from \"../../lib/use-uncontrolled\"\nimport { type FieldProps, FieldShell, fieldA11yProps, useInheritedInvalid } from \"../field/field\"\n\n/**\n * SegmentGroup — a segmented single-choice control on Ark UI's SegmentGroup\n * machine (the radio-group model under the hood). It renders a row (or column)\n * of mutually exclusive segments with a sliding pill that animates to the\n * selected item. Use it as a compact, always-visible alternative to a `Select`\n * when the option set is small (2–5 items): view toggles, filters, billing\n * cadence, and the like.\n *\n * - Value is a single `string | null`; `onChange` hands it to you directly,\n * matching the kit's value-based `FormControlProps` contract.\n * - `data` accepts bare strings (`value === label`) or\n * `{ value, label?, disabled?, color?, payload? }` objects, mixed freely.\n * The component is generic over `data` (a `const` type parameter), so\n * `value` / `onChange` narrow to the literal value union and an item's\n * `payload` flows—typed—into `renderItem` (the same contract as `Select`).\n * - Label / description / error / required come from the built-in `Field`\n * wrapper, so a `SegmentGroup` is accessible and complete on its own.\n * - `name` renders a hidden radio input per item, so the selected value rides\n * a native `<form>` submission.\n *\n * `variant` mirrors the `Button` family (`filled` / `light` / `outline` /\n * `subtle` / `default`): the tray, the sliding pill, and the checked label all\n * adopt the variant's treatment off the shared `--c-*` slots. Palette rides on\n * `data-color`, so every kit color tints for free, `default` included — its pill\n * falls back to solid black/white with no color set, because `:root` defines\n * `--c-solid`/`--c-on-solid` as black/white (white/brand-950 under dark). A\n * per-item `color` overrides the group palette for whichever segment is\n * selected: it re-stamps `data-color` on that item and on the pill, so both\n * the fill and the checked label resolve from the same block.\n *\n * The moving pill is the Ark `Indicator`: Ark positions it absolutely via the\n * CSS vars `--left` / `--top` / `--width` / `--height` (the selected segment's\n * measured rect), so it sits *behind* the labels (`z-0`). Ark only re-measures\n * that rect on mount and on value change — not when `orientation` flips — so we\n * remount the root with `key={orientation}` to force a fresh measure on the new\n * axis. The value is held in `useUncontrolled` so the selection survives that\n * remount.\n */\n\n/**\n * Per-segment label: size sets the padding / text, `variant` sets the *checked*\n * text color so it reads against that variant's pill. The unchecked color is a\n * neutral gray applied at the call site.\n *\n * The checked label must come from the same source as the pill under it.\n * `default` and `filled` both paint `bg-(--c-solid)`, so both take\n * `--c-on-solid` — which resolves per-item, since each `ItemText` carries its\n * own `data-color`. Pairing a hard-coded neutral foreground with a `--c-solid`\n * fill is what broke `default` at any group `color` (#140): the pill moved with\n * the palette and the label stayed put, reaching 3.27:1 on brand. There is\n * deliberately no hover shift on the checked label — `Button`'s `filled` moves\n * only the background and keeps `--c-on-solid`, and no `--c-on-solid-hover`\n * slot exists in `colors.css`.\n */\nconst segItem = cva(\n [\n \"font-medium\",\n \"cursor-pointer rounded-input text-center whitespace-nowrap select-none\",\n TEXT_COLOR_CLASSES.secondary,\n // Only unchecked segments get the hover lift, as in Tabs. An\n // unscoped `hover:` ties on specificity with the checked foreground and\n // won on source order in dark theme, washing the checked label to\n // near-white over a colored pill.\n \"not-data-[state=checked]:hover:text-brand-950 dark:not-data-[state=checked]:hover:text-white\",\n \"transition-colors\",\n \"data-disabled:cursor-not-allowed data-disabled:opacity-50\",\n \"group-data-invalid:text-red-900 dark:group-data-invalid:text-red-500\",\n ],\n {\n variants: {\n variant: {\n filled: \"data-[state=checked]:text-(--c-on-solid)\",\n light: \"data-[state=checked]:text-(--c-text)\",\n outline: \"data-[state=checked]:text-(--c-text)\",\n subtle: \"data-[state=checked]:text-(--c-text)\",\n default: \"data-[state=checked]:text-(--c-on-solid)\",\n },\n size: {\n // No vertical padding of its own — the tray's `min-h` (below) sets the\n // box height and this item stretches to fill it (the tray's default\n // `align-items: stretch` propagates all the way down), so the label\n // just needs to center itself inside that taller box. This matches an\n // `Input` / `NumberInput`'s exact box height at the same size.\n xs: \"flex items-center justify-center px-1 text-xs\",\n sm: \"flex items-center justify-center px-1.5 text-sm\",\n md: \"flex items-center justify-center px-2 text-md\",\n lg: \"flex items-center justify-center px-3 text-lg\",\n xl: \"flex items-center justify-center px-4 text-xl\",\n },\n // Fill the (grown) segment so the label centers across its whole share.\n grow: { true: \"w-full\" },\n },\n defaultVariants: { variant: \"default\", size: \"md\" },\n },\n)\n\n/**\n * Per-segment wrapper. Beyond positioning the label above the pill (`z-1`), it\n * draws a hairline separator in the gap to its leading edge (a `::before`) so\n * inactive neighbours read as divided. That rule fades out next to the active\n * pill — on the checked segment and the one right after it — and is suppressed\n * before the first segment (the indicator is child 1, so the first segment is\n * `:nth-child(2)`). It flips from a vertical rule to a horizontal one when the\n * group is laid out vertically.\n */\nconst segItemWrap = cva(\n [\n \"relative z-1 inline-flex\",\n \"before:absolute before:rounded-full before:bg-brand-900/30 dark:before:bg-white/35\",\n \"group-data-invalid:before:bg-red-500/30\",\n \"before:transition-opacity before:duration-200\",\n // Horizontal: a vertical rule centered on the leading edge, sitting in the gap. Logical\n // (`start`, `-ms-[0.5px]` to center the 1px rule), so under `dir=\"rtl\"` the rule still lands\n // between a segment and the one before it instead of on the far side.\n \"before:top-1/2 before:start-0 before:-ms-[0.5px] before:h-1/2 before:w-px before:-translate-y-1/2\",\n // Vertical: a horizontal rule centered on the top edge instead (`start-1/4` + `w-1/2` is\n // centered in either direction).\n \"in-data-[orientation=vertical]:before:top-0 in-data-[orientation=vertical]:before:start-1/4 in-data-[orientation=vertical]:before:ms-0 in-data-[orientation=vertical]:before:h-px in-data-[orientation=vertical]:before:w-1/2\",\n // No separator before the first segment, or flanking the active pill.\n \"nth-2:before:hidden\",\n \"data-[state=checked]:before:opacity-0 data-[state=checked]:[&+*]:before:opacity-0\",\n ],\n {\n variants: {\n // An even share of the tray per segment, like a tab bar.\n grow: { true: \"flex-1\" },\n },\n },\n)\n\n/**\n * The sliding pill, mirroring each `Button` surface. Its slide + color transition\n * is driven by Ark (see the `--transition-*` overrides on the element); `default`\n * follows `--c-solid` like every other variant, which falls back to solid\n * black/white with no `data-color` set. Filled/soft-fill pills (`filled`, `light`,\n * `default`) use a tighter `rounded-xxs` than the tray's own `rounded-input`, for a\n * nested-corner look inside the tray's padding; bordered/transparent pills\n * (`outline`, `subtle`) keep `rounded-input`.\n */\nconst segIndicator = cva(\n [\n \"z-0\",\n // The slide's duration, read by the inline `transition-duration` (see the\n // pill below); reduced motion zeroes it, so the pill jumps instead.\n \"[--indicator-duration:var(--duration-normal)] motion-reduce:[--indicator-duration:0s]\",\n ],\n {\n variants: {\n variant: {\n filled: \"bg-(--c-solid) rounded-xxs\",\n light: \"bg-(--c-soft) border border-(--c-soft-hover) rounded-xxs\",\n outline: \"bg-transparent border border-(--c-solid) rounded-input\",\n subtle: \"bg-(--c-soft-hover) rounded-input\",\n default: \"bg-(--c-solid) rounded-xxs\",\n },\n },\n defaultVariants: { variant: \"default\" },\n },\n)\n\n/**\n * The tray. Mirrors the `Button` variants: `filled` is a borderless neutral fill\n * so the colored pill pops (the kit's quiet `bg-black/3 dark:bg-white/4`; light\n * mode darkens because a bare `bg-white/4` vanishes on a near-white page), `light` / `default` frame the pill with the same\n * translucent surface as `Input`'s own `default` shell (`bg-white/4` + the\n * hairline `border-brand-900/20 dark:border-white/15`) rather than an opaque\n * gray step, so the tray reads correctly on any host background, `subtle` /\n * `outline` are chromeless.\n */\nconst segTray = cva(\n [\n \"relative inline-flex rounded-input border p-0.5 transition-colors max-w-fit group\",\n \"data-[orientation=vertical]:flex-col\",\n \"data-disabled:cursor-not-allowed data-disabled:opacity-60\",\n // Focus halo + accent border, driven by the active palette's `--c-solid`. Keyed\n // off Zag's `data-focus-visible` (set only when the focus came from the keyboard,\n // never a mouse click) via `:has()`, so the ring stays off when you click a segment.\n //\n // Deliberately NOT `focusStyles`. This is the *shell* idiom, not the ring\n // idiom: an accent border plus a soft `/15` halo on a wrapper whose focus\n // lives on a descendant, with a red invalid twin on the identical selector.\n // That is `input.tsx`'s `shellChrome`, not `Button`'s ring — folding it into\n // `focusStyles` would make that helper grow an alpha, a border half and a\n // concept of invalid, for one call site. The two shells are worth sharing\n // with each other instead; see the follow-up issue.\n \"has-data-focus-visible:border-(--c-solid) has-data-focus-visible:ring-2 has-data-focus-visible:ring-(--c-solid)/15\",\n // Invalid wins over the palette: red border + red halo.\n \"data-invalid:border-red-500 data-invalid:has-data-focus-visible:border-red-500 data-invalid:has-data-focus-visible:ring-red-500/15\",\n // Disabled affordances on the shell.\n ],\n {\n variants: {\n variant: {\n filled: [\"bg-black/3 dark:bg-white/4\", \"border-transparent\"],\n light: [\"bg-white/4\", \"border-brand-900/20 dark:border-white/15\"],\n outline: [\"bg-transparent border-transparent\"],\n subtle: [\"bg-transparent border-transparent\"],\n default: [\"bg-white/4\", \"border-brand-900/20 dark:border-white/15\"],\n },\n size: {\n // The exact `min-h` `inputShell` (input.tsx) uses at the same size —\n // so a `SegmentGroup` sits flush with an `Input` / `NumberInput` of\n // the same size in a row (see `TimeRow`, which composes both).\n xs: \"gap-0 min-h-7\",\n sm: \"gap-0 min-h-8\",\n md: \"gap-0 min-h-9\",\n lg: \"gap-0 min-h-10\",\n xl: \"gap-0 min-h-12\",\n },\n // Span the container instead of hugging the labels.\n grow: { true: \"flex w-full max-w-none\" },\n },\n defaultVariants: { variant: \"default\" },\n },\n)\n\nexport type SegmentGroupSize = NonNullable<VariantProps<typeof segItem>[\"size\"]>\nexport type SegmentGroupVariant = VariantProps<typeof segTray>[\"variant\"]\n\n/**\n * A single segment: a bare value-as-label string, or a labelled object. Objects\n * may carry a `payload` of arbitrary data (the machine ignores it; it flows\n * through to `renderItem`, typed off the `data` shape — the same contract as\n * `Select`'s `SelectItem`).\n */\nexport type SegmentGroupItem<P = unknown> =\n | string\n | {\n value: string\n label?: ReactNode\n disabled?: boolean\n /** Overrides the group palette for the pill + label when this item is selected. */\n color?: Color\n /** Arbitrary extra data, surfaced to `renderItem`. */\n payload?: P\n /** `data-testid` on the rendered segment. Defaults to `` `item-${value}` ``. */\n testId?: string\n }\n\n/** The `data` array the component is generic over. */\nexport type SegmentGroupData<P = unknown> = ReadonlyArray<SegmentGroupItem<P>>\n\n/**\n * Extract the value-string union from a `SegmentGroupData` shape — bare strings\n * and item `.value`s both contribute. A `const` type parameter narrows it to the\n * literal union, so `value` / `onChange` are typed off the data (like `Select`).\n */\nexport type SegmentGroupValue<Data extends SegmentGroupData> = ItemValue<Data[number]>\ntype ItemValue<E> = E extends string ? E : E extends { value: infer V extends string } ? V : never\n\n/**\n * Extract the `payload` type carried by a `SegmentGroupData` shape, read\n * structurally off the data's `payload` property. Bare strings contribute\n * `never`; a homogeneous payload resolves precisely, a mixed one to the union.\n */\nexport type SegmentGroupPayload<Data extends SegmentGroupData> = PayloadOf<Data[number]>\ntype PayloadOf<T> = T extends string ? never : T extends { payload?: infer P } ? P : never\n\n/**\n * The segment handed to `renderItem`: `value` narrowed to the data's value union\n * and `payload` to the data's payload type, so a `const`-typed `data` yields\n * literal values and a precise payload in the callback.\n */\nexport type RenderableSegment<Data extends SegmentGroupData> = {\n value: SegmentGroupValue<Data>\n label: ReactNode\n disabled: boolean\n color: Color | undefined\n payload: SegmentGroupPayload<Data> | undefined\n}\n\n/** Live segment state passed alongside the item to `renderItem`. */\nexport type SegmentRenderState = {\n checked: boolean\n disabled: boolean\n}\n\n/**\n * Render a segment's label content yourself. Receives the (value-narrowed) item —\n * including its typed `payload` — and its live `{ checked, disabled }` state. The\n * segment keeps its sizing, pill, and selection wiring; you fill the label. In an\n * RSC tree the function must live in a `\"use client\"` module so the boundary\n * serializes it as a client reference.\n */\nexport type RenderSegment<Data extends SegmentGroupData> = (\n item: RenderableSegment<Data>,\n state: SegmentRenderState,\n) => ReactNode\n\ntype SegmentGroupClassNames = {\n field?: string\n /** The label element itself — e.g. `\"sr-only\"` to keep the accessible name\n * without showing it. */\n label?: string\n root?: string\n indicator?: string\n item?: string\n itemText?: string\n}\n\nexport type SegmentGroupProps<Data extends SegmentGroupData = SegmentGroupData> = Pick<\n FieldProps,\n \"label\" | \"description\" | \"error\" | \"required\"\n> &\n WithTestId & {\n /** Segments: bare strings (`value === label`) or `{ value, label?, disabled?, color?, payload? }`. */\n data: Data\n /** Controlled value. `null` clears the selection. */\n value?: SegmentGroupValue<Data> | null\n /** Uncontrolled initial value. */\n defaultValue?: SegmentGroupValue<Data> | null\n /** Fires with the selected value. */\n onChange?: (value: SegmentGroupValue<Data>) => void\n /** Render each segment's label content yourself, with its typed `payload`. */\n renderItem?: RenderSegment<Data>\n /** Lay the segments in a row (default) or a column. */\n orientation?: \"horizontal\" | \"vertical\"\n /** Red invalid state, independent of (and OR'd with) `error`. */\n invalid?: boolean\n /** Dims and blocks interaction. */\n disabled?: boolean\n /** Keeps full contrast but blocks edits. */\n readOnly?: boolean\n /** `xs`–`xl` match the exact box height of an `Input` / `NumberInput` at\n * that size, so a `SegmentGroup` composes flush inline next to one (see\n * `TimeInput`'s AM/PM toggle). */\n size?: SegmentGroupSize\n variant?: SegmentGroupVariant\n color?: Color\n /** Span the container and give every segment an even share of it, like a\n * tab bar. Without it the group hugs its labels. */\n grow?: boolean\n /** Wires the hidden radio inputs into native form submission. */\n name?: string\n /** Explicit id for label association. */\n id?: string\n /** Lands on the root for focus-on-error. */\n ref?: Ref<HTMLDivElement>\n /** Forwarded to the root; drives touched/blurred validation. */\n onBlur?: (event: FocusEvent<HTMLDivElement>) => void\n className?: string\n classNames?: SegmentGroupClassNames\n }\n\n/** A fully resolved segment — every field present (`label` falls back to `value`). */\ntype NormalizedItem = {\n value: string\n label: ReactNode\n disabled: boolean\n color: Color | undefined\n payload: unknown\n testId: string\n}\n\n/** Normalize a bare string / object into the resolved `NormalizedItem` form. */\nconst normalizeItem = (item: SegmentGroupItem): NormalizedItem =>\n typeof item === \"string\"\n ? {\n value: item,\n label: item,\n disabled: false,\n color: undefined,\n payload: undefined,\n testId: `item-${item}`,\n }\n : {\n value: item.value,\n label: item.label ?? item.value,\n disabled: item.disabled ?? false,\n color: item.color,\n payload: item.payload,\n testId: item.testId ?? `item-${item.value}`,\n }\n\n/**\n * The real `role=\"radiogroup\"` root (and, through it, each item's hidden\n * radio input), split out so it reads the `Field` context from *inside* the\n * wrapping `FieldShell` — `SegmentGroup` itself renders that shell, so\n * calling `useFieldContext()` at its own top level would run too early.\n * Takes plain `string` values rather than the outer component's `Data`-typed\n * union: it only forwards them, so no generic type parameter is needed here.\n */\nconst SegmentGroupRoot = ({\n value,\n onValueChange,\n disabled,\n readOnly,\n required,\n invalid,\n orientation,\n name,\n id,\n ref,\n onBlur,\n color,\n className,\n testId,\n children,\n}: {\n value: string | null\n onValueChange: (value: string | null) => void\n disabled?: boolean\n readOnly?: boolean\n required?: boolean\n invalid: boolean\n orientation: \"horizontal\" | \"vertical\"\n name?: string\n id?: string\n ref?: Ref<HTMLDivElement>\n onBlur?: (event: FocusEvent<HTMLDivElement>) => void\n color?: Color\n className?: string\n children: ReactNode\n} & WithTestId) => {\n const field = useFieldContext()\n const checkDirection = useDirectionCheck()\n const rootRef = useMergedRefs(ref, checkDirection)\n return (\n <Ark.Root\n value={value}\n onValueChange={(d) => onValueChange(d.value)}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n invalid={invalid}\n orientation={orientation}\n name={name}\n id={id}\n ref={rootRef}\n onBlur={onBlur}\n data-color={color}\n {...props({ \"data-invalid\": invalid, \"data-testid\": testId })}\n {...fieldA11yProps(field)}\n className={className}\n >\n {children}\n </Ark.Root>\n )\n}\n\nexport const SegmentGroup = <const Data extends SegmentGroupData = SegmentGroupData>({\n data,\n value,\n defaultValue,\n onChange,\n renderItem,\n orientation = \"horizontal\",\n invalid,\n disabled,\n readOnly,\n required,\n size = \"md\",\n variant = \"default\",\n color,\n grow,\n name,\n id,\n ref,\n onBlur,\n label,\n description,\n error,\n className,\n classNames,\n testId,\n}: SegmentGroupProps<Data>) => {\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 // Own the value so the pill can read which item is selected (per-item color)\n // and so the `key={orientation}` remount below preserves the selection.\n const [selectedValue, setSelectedValue] = useUncontrolled<SegmentGroupValue<Data> | null>({\n value,\n defaultValue,\n finalValue: null,\n onChange: (v) => v != null && onChange?.(v),\n })\n\n const normalized = (data as SegmentGroupData).map(normalizeItem)\n const selected = normalized.find((item) => item.value === selectedValue)\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 // A radio group: nothing carries the label's `for` id; the root's `aria-labelledby` names it.\n composite\n >\n {/* `key={orientation}` remounts the root on an axis flip so Ark re-measures\n the indicator rect for the new layout (it only measures on mount + value\n change). `useUncontrolled` keeps the selection across that remount. */}\n <SegmentGroupRoot\n key={orientation}\n value={selectedValue}\n // Ark's value is typed by the collection (`string`); the runtime value\n // always originates from `data`, so narrow it back to the caller's union.\n onValueChange={(v) => setSelectedValue(v as SegmentGroupValue<Data> | null)}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n invalid={isInvalid}\n orientation={orientation}\n name={name}\n id={id}\n ref={ref}\n onBlur={onBlur}\n color={color}\n testId={testId}\n className={cn(segTray({ variant, size, grow }), className, classNames?.root)}\n >\n {/* The sliding pill. Ark sets `position: absolute` + `--left`/`--top`/\n `--width`/`--height` (the selected segment's rect) inline, so it\n sits behind the labels (`z-0`). It adopts the selected item's `color`\n (falling back to the group `color`), which is the same `data-color`\n that item's own label carries — so the fill and the `--c-on-solid`\n text on top of it always resolve from one block.\n\n We drive the slide ourselves rather than via Ark's gated transition.\n Ark sets `transition-property: none` whenever its `animateIndicator`\n flag is false — including the instant it receives the `transitionend`\n of ANY animated property. With several properties of differing\n end-times (a `left` redirected by an interrupting click vs. a color or\n width that already settled), that early end would null the transition\n and snap the pill mid-slide. Overriding the real `transition-*` props\n (our `style` wins via Ark's `mergeProps`) keeps the transition always\n on, so the flag is irrelevant and interruptions re-target smoothly. The\n first paint stays instant because Ark renders the pill `hidden` until\n its rect is measured, and `display:none` can't transition. The\n duration comes from `--indicator-duration` (set by a class) rather\n than an inline value, so reduced motion can zero it. */}\n <Ark.Indicator\n style={{\n width: \"var(--width)\",\n height: \"var(--height)\",\n transitionProperty: \"left, top, width, height, background-color, border-color\",\n transitionDuration: \"var(--indicator-duration)\",\n transitionTimingFunction: \"var(--ease-emphasized)\",\n }}\n {...props({ \"data-color\": selected?.color ?? color })}\n className={cn(segIndicator({ variant }), classNames?.indicator)}\n />\n {normalized.map((item) => (\n <Ark.Item\n key={item.value}\n value={item.value}\n disabled={item.disabled}\n data-testid={item.testId}\n className={cn(segItemWrap({ grow }), classNames?.item)}\n >\n <Ark.ItemText\n data-color={item.color}\n className={cn(segItem({ size, variant, grow }), classNames?.itemText)}\n >\n {/* `renderItem` owns the label content (with the item's typed payload);\n the ItemText keeps its sizing, checked color, and pill wiring. */}\n {renderItem ? (\n <Ark.ItemContext>\n {(ctx) =>\n renderItem(item as unknown as RenderableSegment<Data>, {\n checked: ctx.checked,\n disabled: ctx.disabled,\n })\n }\n </Ark.ItemContext>\n ) : (\n item.label\n )}\n </Ark.ItemText>\n <Ark.ItemControl />\n <Ark.ItemHiddenInput />\n </Ark.Item>\n ))}\n </SegmentGroupRoot>\n </FieldShell>\n )\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { useUncontrolled } from './chunk-PMUCGFY5.js';
|
|
2
1
|
import { CloseIcon } from './chunk-6YNLRQ25.js';
|
|
3
2
|
import { Collapse } from './chunk-NKOTA5TM.js';
|
|
4
3
|
import { mergeIcons, iconStroke } from './chunk-XXOR34T4.js';
|
|
5
4
|
import { Spinner } from './chunk-W3XX7BYT.js';
|
|
5
|
+
import { useUncontrolled } from './chunk-PMUCGFY5.js';
|
|
6
6
|
import { props } from './chunk-WYCMIIRR.js';
|
|
7
7
|
import { focusStyles } from './chunk-C6NVU4F7.js';
|
|
8
8
|
import { TEXT_COLOR_CLASSES } from './chunk-GIPQUKCN.js';
|
|
@@ -238,5 +238,5 @@ var Notification = Object.assign(NotificationComponent, {
|
|
|
238
238
|
});
|
|
239
239
|
|
|
240
240
|
export { ActionTrigger, CloseTrigger, Description, Icon, NOTIFICATION_DEFAULT_TRANSLATIONS, Notification, TOAST_STATUS, Title, notificationRoot };
|
|
241
|
-
//# sourceMappingURL=chunk-
|
|
242
|
-
//# sourceMappingURL=chunk-
|
|
241
|
+
//# sourceMappingURL=chunk-UIKQ4X6W.js.map
|
|
242
|
+
//# sourceMappingURL=chunk-UIKQ4X6W.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/notification/notification.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;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AAC,WAAA,EAAA,EAAa,QAAA,EAAA,WAAA,IAAe,eAAA,CAAgB,OAAA,EAAQ,CAAA,EACvD,CAAA;AAAA,oBACA,GAAA,CAAC,QAAA,EAAA,EAAS,IAAA,EAAM,MAAA,IAAU,IAAA,IAAQ,IAAA,EAChC,QAAA,kBAAA,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,wCAAA,EAA0C,QAAA,EAAA,MAAA,IAAU,UAAA,CAAW,SAAQ,CAAA,EACxF;AAAA,GAAA,EACF,CAAA;AAEJ;AAOO,IAAM,YAAA,GAAe,MAAA,CAAO,MAAA,CAAO,qBAAA,EAAuB;AAAA,EAC/D,IAAA;AAAA,EACA,IAAA;AAAA,EACA,KAAA;AAAA,EACA,WAAA;AAAA,EACA,aAAA;AAAA,EACA,YAAA;AAAA,EACA;AACF,CAAC","file":"chunk-QVOBLRCM.js","sourcesContent":["\"use client\"\n\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport { cva } from \"class-variance-authority\"\nimport {\n AlertCircleIcon,\n CheckCircleIcon,\n ChevronDownIcon,\n InfoIcon,\n TriangleAlertIcon,\n} from \"lucide-react\"\nimport { type ComponentPropsWithoutRef, type ReactNode, type Ref, useRef } from \"react\"\nimport { match } from \"ts-pattern\"\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 { type IconMap, iconStroke, mergeIcons } from \"../../lib/icons\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TEXT_COLOR_CLASSES } from \"../../lib/typography-size\"\nimport { useUncontrolled } from \"../../lib/use-uncontrolled\"\nimport { Collapse } from \"../collapse/collapse\"\nimport { CloseIcon } from \"../popover/icons\"\nimport { Spinner } from \"../spinner/spinner\"\nimport type { ToastFields, ToastHue, ToastType } from \"./types\"\n\n/**\n * Notification — the kit's **toast**: transient, non-blocking feedback spawned\n * imperatively from anywhere (`notify.success(\"Saved\")`) via `createNotifier`.\n *\n * This module holds the *visual* compound (`Notification.Root` / `Icon` /\n * `Title` / `Description` / `ActionTrigger` / `CloseTrigger` /\n * `CollapseTrigger`) and the ready-made `Notification` card composed from a\n * toast-shaped object (`type` → hue + icon, `title` / `description` /\n * `action`). It is deliberately dumb: the toaster behavior that drives it —\n * store, presence, height measurement, swipe-to-dismiss, stacking — lives in\n * `store.ts` / `create-notifier.tsx`, so the card is equally usable on its own\n * (e.g. a page-level alert).\n *\n * The surface is a single outline recipe; `color` (a `data-color` attribute\n * resolved to the `--c-*` slot vars) is the only styling axis. Status presets\n * map a `type` onto a hue + a leading icon.\n * Enter/exit is driven by Ark Presence → `data-state` → the `toast-in/out`\n * keyframes (like modal/drawer/popover).\n */\n\n/** The outline surface. Deliberately opaque and blurred: a toast floats over\n * arbitrary content. `Alert` (the inline sibling) shares the parts but not\n * this surface — it sits on the page and takes a translucent tint instead.\n * `color` tints the border, text and icon through `--c-solid`. */\nexport const notificationSurface = [\n \"bg-brand-50/90 dark:bg-brand-950/85\",\n \"text-(--c-solid) border-(--c-solid) backdrop-blur-lg\",\n]\n\n/** The toast card. Enter/exit via `data-state` keyframes (Ark Presence sets\n * `data-state`); stacking position via the `[data-scope=notifications]` rules\n * in theme.css (driven by the `--index`/`--offset`/`--height` vars the toaster\n * sets on each card — see create-notifier). */\nexport const notificationRoot = cva([\n \"data-[state=open]:animate-toast-in data-[state=closed]:animate-toast-out\",\n \"pointer-events-auto flex flex-col w-88 max-w-[calc(100vw-2rem)]\",\n // Phones (< xs): fill the full-bleed bottom region (see createNotifier).\n \"max-xs:w-full! max-xs:max-w-none!\",\n \"rounded-card border px-3 py-3\",\n // Any-focus outline suppression, matching the other overlay surfaces\n // (Modal, Drawer, Popover, Tooltip) — the card can take programmatic focus.\n \"focus:outline-none\",\n focusStyles({ offset: false }),\n \"[&_svg]:shrink-0 [&_svg]:pointer-events-none\",\n \"shadow-2xl shadow-white dark:shadow-black/80\",\n \"overflow-clip\",\n notificationSurface,\n])\n\n/** `type` → hue + default leading icon. There are no status color *tokens* in\n * the kit — status maps onto existing hues, reusing the same `--c-*` slots as\n * Badge/Button. `loading` uses the kit Spinner. Exported so `Alert` (which\n * drops the toast-only `loading` type) resolves the same presets. */\nexport const TOAST_STATUS: Record<ToastType, { color: Color; icon: ReactNode }> = {\n success: { color: \"green\", icon: <CheckCircleIcon className={iconStroke} /> },\n error: { color: \"red\", icon: <AlertCircleIcon className={iconStroke} /> },\n warning: { color: \"orange\", icon: <TriangleAlertIcon className={iconStroke} /> },\n info: { color: \"neutral\", icon: <InfoIcon className={iconStroke} /> },\n loading: { color: \"neutral\", icon: <Spinner size=\"md\" label={null} /> },\n}\n\nexport type NotificationIconSlot = ToastType | \"close\" | \"collapse\"\n/**\n * The card's icons: one per status `type` (`success`, `error`, `warning`,\n * `info`, `loading`), the close ×, and the collapse chevron, which turns half\n * a turn while the card is folded. A toast's own `icon` still wins over its\n * status icon.\n */\nexport type NotificationIcons = IconMap<NotificationIconSlot>\n\nexport const DEFAULT_ICONS: Record<NotificationIconSlot, ReactNode> = {\n success: TOAST_STATUS.success.icon,\n error: TOAST_STATUS.error.icon,\n warning: TOAST_STATUS.warning.icon,\n info: TOAST_STATUS.info.icon,\n loading: TOAST_STATUS.loading.icon,\n close: <CloseIcon />,\n collapse: <ChevronDownIcon className={iconStroke} />,\n}\n\n/** Turns the collapse icon half a turn while the card is folded. */\nconst Turn = ({ open, children }: { open: boolean; children: ReactNode }) => (\n <span\n data-open={open}\n className=\"inline-flex transition-transform data-[open=true]:rotate-0 data-[open=false]:rotate-180\"\n >\n {children}\n </span>\n)\n\nexport type NotificationRootProps = HTMLArkProps<\"div\"> &\n WithTestId & {\n /** Accent palette. Drives the `--c-*` slot vars for the whole toast. */\n color?: Color\n /** Forwarded to the underlying element (used by Presence for enter/exit). */\n ref?: Ref<HTMLDivElement>\n }\n\nconst Root = ({ className, color, testId, ...rest }: NotificationRootProps) => (\n <ark.div\n data-color={color}\n className={cn(notificationRoot(), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\n/** Leading-glyph slot. Inherits the Root's text color (the `color` hue) and\n * sizes any child svg to match the text.\n * Exported (like the parts below) so `Alert` reuses it as-is — these are\n * width-agnostic, so nothing about them is toast-specific. */\nexport const Icon = ({\n className,\n testId,\n ...rest\n}: ComponentPropsWithoutRef<\"span\"> & WithTestId) => (\n <span\n className={cn(\"inline-flex [&_svg]:size-5\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport const Title = ({\n className,\n testId,\n ...rest\n}: ComponentPropsWithoutRef<\"div\"> & WithTestId) => (\n <div\n className={cn(\"text-sm font-bold\", TEXT_COLOR_CLASSES.primary, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport const Description = ({\n className,\n testId,\n ...rest\n}: ComponentPropsWithoutRef<\"div\"> & WithTestId) => (\n <div\n className={cn(\n \"mt-1 text-sm font-normal text-brand-900/70 opacity-90 dark:text-white/80\",\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport const ActionTrigger = ({\n className,\n type,\n testId,\n ...rest\n}: ComponentPropsWithoutRef<\"button\"> & WithTestId) => (\n <button\n type={type ?? \"button\"}\n className={cn(\n \"inline-flex h-7 cursor-pointer items-center rounded-input px-2 text-xs font-medium\",\n \"border border-current/30 hover:bg-current/10\",\n focusStyles({ ring: \"palette\", offset: false }),\n \"transition-colors\",\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\n/** The card's control names. `closeTriggerLabel` follows Ark's own Toast key. The ready-made\n * card takes them as `translations`; the compound parts (`CloseTrigger`, `CollapseTrigger`)\n * default to the same English names and take a plain `aria-label` to override. */\nexport type NotificationTranslations = {\n /** The close (×) button. Default `\"Dismiss\"`. */\n closeTriggerLabel?: string\n /** The collapse chevron while the card is open. Default `\"Collapse\"`. */\n collapseLabel?: string\n /** The collapse chevron while the card is folded. Default `\"Expand\"`. */\n expandLabel?: string\n}\n\n/** The one source of the card's English names: the compound parts' defaults, and the base the\n * ready-made card (and `Alert`, `<Notifications>`) merge a partial override onto. */\nexport const NOTIFICATION_DEFAULT_TRANSLATIONS = {\n closeTriggerLabel: \"Dismiss\",\n collapseLabel: \"Collapse\",\n expandLabel: \"Expand\",\n} as const satisfies Required<NotificationTranslations>\n\n/** The close and collapse buttons share one look: a small round control resting at 70%. */\nconst triggerClass = [\n \"ms-auto inline-flex size-5 shrink-0 cursor-pointer items-center justify-center\",\n \"rounded-full opacity-70 hover:opacity-100 [&_svg]:size-4\",\n focusStyles({ ring: \"palette\", offset: false }),\n // The button rests at 70% opacity, which would fade its ring with it.\n \"focus-visible:opacity-100\",\n \"transition-colors\",\n]\n\nexport const CloseTrigger = ({\n className,\n children,\n type,\n testId,\n ...rest\n}: ComponentPropsWithoutRef<\"button\"> & WithTestId) => (\n <button\n type={type ?? \"button\"}\n aria-label={NOTIFICATION_DEFAULT_TRANSLATIONS.closeTriggerLabel}\n className={cn(triggerClass, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {children ?? DEFAULT_ICONS.close}\n </button>\n)\n\n/**\n * The chevron that folds the card's description and action rows away — the\n * collapse counterpart to `CloseTrigger`, and what the ready-made card renders\n * for `withCollapse`.\n *\n * It is presentational only: `open` drives the label, `aria-expanded` and the\n * chevron's rotation, but the state itself belongs to the caller. The button\n * owns the layout, the opacity and any `className`; the default icon carries\n * nothing but its rotation, so passing a `className` tints or spaces the\n * control once rather than twice.\n */\nexport const CollapseTrigger = ({\n className,\n children,\n type,\n open,\n testId,\n ...rest\n}: ComponentPropsWithoutRef<\"button\"> & WithTestId & { open: boolean }) => (\n <button\n type={type ?? \"button\"}\n aria-label={\n open\n ? NOTIFICATION_DEFAULT_TRANSLATIONS.collapseLabel\n : NOTIFICATION_DEFAULT_TRANSLATIONS.expandLabel\n }\n aria-expanded={open}\n className={cn(triggerClass, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {children ?? <Turn open={open}>{DEFAULT_ICONS.collapse}</Turn>}\n </button>\n)\n\n/**\n * Props for the ready-made `Notification` card. The presentational fields it\n * shares with a spawned toast (`type` / `title` / `description` / `action` /\n * `color` / `icon` / `withCloseButton`) plus its own collapse controls;\n * the Notifier-managed plumbing (`id` / `status` / `duration`) is optional, so a\n * standalone card is just `<Notification type=\"success\" title=\"Saved\" />`.\n */\nexport type NotificationProps = Omit<NotificationRootProps, \"title\" | \"color\" | \"asChild\"> &\n ForbidAsChild &\n Omit<ToastFields, \"id\" | \"status\" | \"duration\"> &\n Partial<Pick<ToastFields, \"id\" | \"status\" | \"duration\">> &\n ToastHue & {\n /** Invoked when the close (×) button is pressed. */\n onClose?: () => void\n /** Swap the close (×) button for a chevron that folds the description and\n * action rows away. `withCloseButton` takes precedence over this. */\n withCollapse?: boolean\n /** Uncontrolled initial open state — collapsed by default when `withCollapse`,\n * open otherwise. Pair with `withCollapse`. */\n defaultOpen?: boolean\n /** Controlled open state — pair with `onOpenChange`. */\n open?: boolean\n /** Fired when the collapse toggle is pressed. */\n onOpenChange?: (open: boolean) => void\n /** Overrides the close and collapse buttons' accessible names. A partial override keeps\n * the other defaults. */\n translations?: NotificationTranslations\n /** Replaces the default icons: the status icons by `type`, `close` and `collapse`. A missing\n * key keeps its default; `icon` wins over the status icon, and `null` drops a status icon. */\n icons?: NotificationIcons\n }\n\n/**\n * The ready-made **`Notification` card** — the presentational body composed from\n * a toast-shaped object: resolves `type` → `TOAST_STATUS` (hue + leading icon), lets\n * an explicit `color`/`icon` override (`icon={null}` hides the glyph),\n * and lays out the icon/title/close row plus the independently-collapsing\n * description and action sections.\n *\n * Owns no store, presence or gesture state — the Notifier's render body drives\n * it by forwarding a `ref`, stacking style vars, pointer handlers and `onClose`\n * straight through to the `Root`. Rendered on its own it is just a status card\n * (e.g. a page-level alert). For a bespoke layout, compose the parts directly:\n * `Notification.Root`, `.Icon`, `.Title`, `.Description`, `.ActionTrigger`,\n * `.CloseTrigger`.\n *\n * **Announcements are the toaster's job, not the card's.** A toast spawned\n * through `createNotifier` is its own live region: `role=\"status\"`, or\n * `role=\"alert\"` for an `error`, set by the notifier as it renders the card.\n * A standalone card carries no role: rendered with the page it is content to\n * read, not news, and a live region there would only re-announce whatever it\n * holds on every mount. A card you insert in response to an event *is* news:\n * pass the role yourself (`role=\"status\"`, or `role=\"alert\"` for a failure)\n * and it lands on the `Root`, or mount it into a region that's already live.\n */\nfunction NotificationComponent({\n type,\n title,\n description,\n action,\n color: _color,\n icon: _icon,\n withCloseButton = true,\n withCollapse = false,\n defaultOpen,\n open: _open,\n onOpenChange,\n onClose,\n translations,\n icons: iconsProp,\n // Notifier-managed plumbing — not rendered onto the card.\n status: _status,\n duration: _duration,\n asChild: _asChild,\n ...rest\n}: NotificationProps) {\n const resolvedTranslations = { ...NOTIFICATION_DEFAULT_TRANSLATIONS, ...translations }\n const icons = mergeIcons(DEFAULT_ICONS, iconsProp)\n // `type` and `color` are exclusive (see `ToastHue`), and testing the destructured `type`\n // narrows `color` with it: no cast. The preset wins should a JS caller pass both anyway.\n const color = type === undefined ? _color : TOAST_STATUS[type].color\n // Not `??`: an explicit `icon={null}` (hide the glyph) must not fall\n // through to the preset the way an omitted (`undefined`) icon does.\n const icon = _icon === undefined ? type && icons[type] : _icon\n\n const [open, setOpen] = useUncontrolled({\n defaultValue: defaultOpen,\n value: _open,\n finalValue: match({ withCloseButton, withCollapse })\n .with({ withCloseButton: true }, () => true)\n .with({ withCollapse: true }, () => false)\n .with({ withCollapse: false }, () => true)\n .exhaustive(),\n onChange: onOpenChange,\n })\n\n // Keep the last-present description / action mounted through their collapse so\n // each reveal has content to animate *out* (removed content unmounts instantly\n // otherwise). Cached independently so the two sections animate separately.\n const lastDescription = useRef(description)\n if (description != null) lastDescription.current = description\n const lastAction = useRef(action)\n if (action != null) lastAction.current = action\n\n return (\n <Root color={color} {...rest}>\n <div className=\"flex flex-row gap-3\">\n {icon != null && <Icon>{icon}</Icon>}\n {title != null && <Title>{title}</Title>}\n {match({ withCloseButton, withCollapse })\n .with({ withCloseButton: true }, () => (\n <CloseTrigger aria-label={resolvedTranslations.closeTriggerLabel} onClick={onClose}>\n {icons.close}\n </CloseTrigger>\n ))\n .with({ withCollapse: true }, () => (\n <CollapseTrigger\n open={open}\n aria-label={\n open ? resolvedTranslations.collapseLabel : resolvedTranslations.expandLabel\n }\n onClick={() => setOpen(!open)}\n >\n <Turn open={open}>{icons.collapse}</Turn>\n </CollapseTrigger>\n ))\n .with({ withCollapse: false }, () => null)\n .exhaustive()}\n </div>\n {/* Description and action are independent Collapse sections. */}\n <Collapse open={description != null && open}>\n <Description>{description ?? lastDescription.current}</Description>\n </Collapse>\n <Collapse open={action != null && open}>\n <div className=\"mt-2 flex flex-wrap items-center gap-2\">{action ?? lastAction.current}</div>\n </Collapse>\n </Root>\n )\n}\n\n/**\n * `Notification` — the ready-made card (batteries-included), with the compound\n * parts attached for bespoke composition. Mirrors `Tooltip`/`Modal`: the bare\n * name is the convenience form; `.Root` and friends are the primitives.\n */\nexport const Notification = Object.assign(NotificationComponent, {\n Root,\n Icon,\n Title,\n Description,\n ActionTrigger,\n CloseTrigger,\n CollapseTrigger,\n})\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/notification/notification.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAmDO,IAAM,mBAAA,GAAsB;AAAA,EACjC,qCAAA;AAAA,EACA;AACF,CAAA;AAMO,IAAM,mBAAmB,GAAA,CAAI;AAAA,EAClC,0EAAA;AAAA,EACA,iEAAA;AAAA;AAAA,EAEA,mCAAA;AAAA,EACA,+BAAA;AAAA;AAAA;AAAA,EAGA,oBAAA;AAAA,EACA,WAAA,CAAY,EAAE,MAAA,EAAQ,KAAA,EAAO,CAAA;AAAA,EAC7B,8CAAA;AAAA,EACA,8CAAA;AAAA,EACA,eAAA;AAAA,EACA;AACF,CAAC;AAMM,IAAM,YAAA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AAO,MAAA,CAAO,qBAAA,EAAuB;AAAA,EAC/D,IAAA;AAAA,EACA,IAAA;AAAA,EACA,KAAA;AAAA,EACA,WAAA;AAAA,EACA,aAAA;AAAA,EACA,YAAA;AAAA,EACA;AACF,CAAC","file":"chunk-UIKQ4X6W.js","sourcesContent":["\"use client\"\n\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport { cva } from \"class-variance-authority\"\nimport {\n AlertCircleIcon,\n CheckCircleIcon,\n ChevronDownIcon,\n InfoIcon,\n TriangleAlertIcon,\n} from \"lucide-react\"\nimport { type ComponentPropsWithoutRef, type ReactNode, type Ref, useRef } from \"react\"\nimport { match } from \"ts-pattern\"\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 { type IconMap, iconStroke, mergeIcons } from \"../../lib/icons\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TEXT_COLOR_CLASSES } from \"../../lib/typography-size\"\nimport { useUncontrolled } from \"../../lib/use-uncontrolled\"\nimport { Collapse } from \"../collapse/collapse\"\nimport { CloseIcon } from \"../popover/icons\"\nimport { Spinner } from \"../spinner/spinner\"\nimport type { ToastFields, ToastHue, ToastType } from \"./types\"\n\n/**\n * Notification — the kit's **toast**: transient, non-blocking feedback spawned\n * imperatively from anywhere (`notify.success(\"Saved\")`) via `createNotifier`.\n *\n * This module holds the *visual* compound (`Notification.Root` / `Icon` /\n * `Title` / `Description` / `ActionTrigger` / `CloseTrigger` /\n * `CollapseTrigger`) and the ready-made `Notification` card composed from a\n * toast-shaped object (`type` → hue + icon, `title` / `description` /\n * `action`). It is deliberately dumb: the toaster behavior that drives it —\n * store, presence, height measurement, swipe-to-dismiss, stacking — lives in\n * `store.ts` / `create-notifier.tsx`, so the card is equally usable on its own\n * (e.g. a page-level alert).\n *\n * The surface is a single outline recipe; `color` (a `data-color` attribute\n * resolved to the `--c-*` slot vars) is the only styling axis. Status presets\n * map a `type` onto a hue + a leading icon.\n * Enter/exit is driven by Ark Presence → `data-state` → the `toast-in/out`\n * keyframes (like modal/drawer/popover).\n */\n\n/** The outline surface. Deliberately opaque and blurred: a toast floats over\n * arbitrary content. `Alert` (the inline sibling) shares the parts but not\n * this surface — it sits on the page and takes a translucent tint instead.\n * `color` tints the border, text and icon through `--c-solid`. */\nexport const notificationSurface = [\n \"bg-brand-50/90 dark:bg-brand-950/85\",\n \"text-(--c-solid) border-(--c-solid) backdrop-blur-lg\",\n]\n\n/** The toast card. Enter/exit via `data-state` keyframes (Ark Presence sets\n * `data-state`); stacking position via the `[data-scope=notifications]` rules\n * in theme.css (driven by the `--index`/`--offset`/`--height` vars the toaster\n * sets on each card — see create-notifier). */\nexport const notificationRoot = cva([\n \"data-[state=open]:animate-toast-in data-[state=closed]:animate-toast-out\",\n \"pointer-events-auto flex flex-col w-88 max-w-[calc(100vw-2rem)]\",\n // Phones (< xs): fill the full-bleed bottom region (see createNotifier).\n \"max-xs:w-full! max-xs:max-w-none!\",\n \"rounded-card border px-3 py-3\",\n // Any-focus outline suppression, matching the other overlay surfaces\n // (Modal, Drawer, Popover, Tooltip) — the card can take programmatic focus.\n \"focus:outline-none\",\n focusStyles({ offset: false }),\n \"[&_svg]:shrink-0 [&_svg]:pointer-events-none\",\n \"shadow-2xl shadow-white dark:shadow-black/80\",\n \"overflow-clip\",\n notificationSurface,\n])\n\n/** `type` → hue + default leading icon. There are no status color *tokens* in\n * the kit — status maps onto existing hues, reusing the same `--c-*` slots as\n * Badge/Button. `loading` uses the kit Spinner. Exported so `Alert` (which\n * drops the toast-only `loading` type) resolves the same presets. */\nexport const TOAST_STATUS: Record<ToastType, { color: Color; icon: ReactNode }> = {\n success: { color: \"green\", icon: <CheckCircleIcon className={iconStroke} /> },\n error: { color: \"red\", icon: <AlertCircleIcon className={iconStroke} /> },\n warning: { color: \"orange\", icon: <TriangleAlertIcon className={iconStroke} /> },\n info: { color: \"neutral\", icon: <InfoIcon className={iconStroke} /> },\n loading: { color: \"neutral\", icon: <Spinner size=\"md\" label={null} /> },\n}\n\nexport type NotificationIconSlot = ToastType | \"close\" | \"collapse\"\n/**\n * The card's icons: one per status `type` (`success`, `error`, `warning`,\n * `info`, `loading`), the close ×, and the collapse chevron, which turns half\n * a turn while the card is folded. A toast's own `icon` still wins over its\n * status icon.\n */\nexport type NotificationIcons = IconMap<NotificationIconSlot>\n\nexport const DEFAULT_ICONS: Record<NotificationIconSlot, ReactNode> = {\n success: TOAST_STATUS.success.icon,\n error: TOAST_STATUS.error.icon,\n warning: TOAST_STATUS.warning.icon,\n info: TOAST_STATUS.info.icon,\n loading: TOAST_STATUS.loading.icon,\n close: <CloseIcon />,\n collapse: <ChevronDownIcon className={iconStroke} />,\n}\n\n/** Turns the collapse icon half a turn while the card is folded. */\nconst Turn = ({ open, children }: { open: boolean; children: ReactNode }) => (\n <span\n data-open={open}\n className=\"inline-flex transition-transform data-[open=true]:rotate-0 data-[open=false]:rotate-180\"\n >\n {children}\n </span>\n)\n\nexport type NotificationRootProps = HTMLArkProps<\"div\"> &\n WithTestId & {\n /** Accent palette. Drives the `--c-*` slot vars for the whole toast. */\n color?: Color\n /** Forwarded to the underlying element (used by Presence for enter/exit). */\n ref?: Ref<HTMLDivElement>\n }\n\nconst Root = ({ className, color, testId, ...rest }: NotificationRootProps) => (\n <ark.div\n data-color={color}\n className={cn(notificationRoot(), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\n/** Leading-glyph slot. Inherits the Root's text color (the `color` hue) and\n * sizes any child svg to match the text.\n * Exported (like the parts below) so `Alert` reuses it as-is — these are\n * width-agnostic, so nothing about them is toast-specific. */\nexport const Icon = ({\n className,\n testId,\n ...rest\n}: ComponentPropsWithoutRef<\"span\"> & WithTestId) => (\n <span\n className={cn(\"inline-flex [&_svg]:size-5\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport const Title = ({\n className,\n testId,\n ...rest\n}: ComponentPropsWithoutRef<\"div\"> & WithTestId) => (\n <div\n className={cn(\"text-sm font-bold\", TEXT_COLOR_CLASSES.primary, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport const Description = ({\n className,\n testId,\n ...rest\n}: ComponentPropsWithoutRef<\"div\"> & WithTestId) => (\n <div\n className={cn(\n \"mt-1 text-sm font-normal text-brand-900/70 opacity-90 dark:text-white/80\",\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport const ActionTrigger = ({\n className,\n type,\n testId,\n ...rest\n}: ComponentPropsWithoutRef<\"button\"> & WithTestId) => (\n <button\n type={type ?? \"button\"}\n className={cn(\n \"inline-flex h-7 cursor-pointer items-center rounded-input px-2 text-xs font-medium\",\n \"border border-current/30 hover:bg-current/10\",\n focusStyles({ ring: \"palette\", offset: false }),\n \"transition-colors\",\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\n/** The card's control names. `closeTriggerLabel` follows Ark's own Toast key. The ready-made\n * card takes them as `translations`; the compound parts (`CloseTrigger`, `CollapseTrigger`)\n * default to the same English names and take a plain `aria-label` to override. */\nexport type NotificationTranslations = {\n /** The close (×) button. Default `\"Dismiss\"`. */\n closeTriggerLabel?: string\n /** The collapse chevron while the card is open. Default `\"Collapse\"`. */\n collapseLabel?: string\n /** The collapse chevron while the card is folded. Default `\"Expand\"`. */\n expandLabel?: string\n}\n\n/** The one source of the card's English names: the compound parts' defaults, and the base the\n * ready-made card (and `Alert`, `<Notifications>`) merge a partial override onto. */\nexport const NOTIFICATION_DEFAULT_TRANSLATIONS = {\n closeTriggerLabel: \"Dismiss\",\n collapseLabel: \"Collapse\",\n expandLabel: \"Expand\",\n} as const satisfies Required<NotificationTranslations>\n\n/** The close and collapse buttons share one look: a small round control resting at 70%. */\nconst triggerClass = [\n \"ms-auto inline-flex size-5 shrink-0 cursor-pointer items-center justify-center\",\n \"rounded-full opacity-70 hover:opacity-100 [&_svg]:size-4\",\n focusStyles({ ring: \"palette\", offset: false }),\n // The button rests at 70% opacity, which would fade its ring with it.\n \"focus-visible:opacity-100\",\n \"transition-colors\",\n]\n\nexport const CloseTrigger = ({\n className,\n children,\n type,\n testId,\n ...rest\n}: ComponentPropsWithoutRef<\"button\"> & WithTestId) => (\n <button\n type={type ?? \"button\"}\n aria-label={NOTIFICATION_DEFAULT_TRANSLATIONS.closeTriggerLabel}\n className={cn(triggerClass, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {children ?? DEFAULT_ICONS.close}\n </button>\n)\n\n/**\n * The chevron that folds the card's description and action rows away — the\n * collapse counterpart to `CloseTrigger`, and what the ready-made card renders\n * for `withCollapse`.\n *\n * It is presentational only: `open` drives the label, `aria-expanded` and the\n * chevron's rotation, but the state itself belongs to the caller. The button\n * owns the layout, the opacity and any `className`; the default icon carries\n * nothing but its rotation, so passing a `className` tints or spaces the\n * control once rather than twice.\n */\nexport const CollapseTrigger = ({\n className,\n children,\n type,\n open,\n testId,\n ...rest\n}: ComponentPropsWithoutRef<\"button\"> & WithTestId & { open: boolean }) => (\n <button\n type={type ?? \"button\"}\n aria-label={\n open\n ? NOTIFICATION_DEFAULT_TRANSLATIONS.collapseLabel\n : NOTIFICATION_DEFAULT_TRANSLATIONS.expandLabel\n }\n aria-expanded={open}\n className={cn(triggerClass, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {children ?? <Turn open={open}>{DEFAULT_ICONS.collapse}</Turn>}\n </button>\n)\n\n/**\n * Props for the ready-made `Notification` card. The presentational fields it\n * shares with a spawned toast (`type` / `title` / `description` / `action` /\n * `color` / `icon` / `withCloseButton`) plus its own collapse controls;\n * the Notifier-managed plumbing (`id` / `status` / `duration`) is optional, so a\n * standalone card is just `<Notification type=\"success\" title=\"Saved\" />`.\n */\nexport type NotificationProps = Omit<NotificationRootProps, \"title\" | \"color\" | \"asChild\"> &\n ForbidAsChild &\n Omit<ToastFields, \"id\" | \"status\" | \"duration\"> &\n Partial<Pick<ToastFields, \"id\" | \"status\" | \"duration\">> &\n ToastHue & {\n /** Invoked when the close (×) button is pressed. */\n onClose?: () => void\n /** Swap the close (×) button for a chevron that folds the description and\n * action rows away. `withCloseButton` takes precedence over this. */\n withCollapse?: boolean\n /** Uncontrolled initial open state — collapsed by default when `withCollapse`,\n * open otherwise. Pair with `withCollapse`. */\n defaultOpen?: boolean\n /** Controlled open state — pair with `onOpenChange`. */\n open?: boolean\n /** Fired when the collapse toggle is pressed. */\n onOpenChange?: (open: boolean) => void\n /** Overrides the close and collapse buttons' accessible names. A partial override keeps\n * the other defaults. */\n translations?: NotificationTranslations\n /** Replaces the default icons: the status icons by `type`, `close` and `collapse`. A missing\n * key keeps its default; `icon` wins over the status icon, and `null` drops a status icon. */\n icons?: NotificationIcons\n }\n\n/**\n * The ready-made **`Notification` card** — the presentational body composed from\n * a toast-shaped object: resolves `type` → `TOAST_STATUS` (hue + leading icon), lets\n * an explicit `color`/`icon` override (`icon={null}` hides the glyph),\n * and lays out the icon/title/close row plus the independently-collapsing\n * description and action sections.\n *\n * Owns no store, presence or gesture state — the Notifier's render body drives\n * it by forwarding a `ref`, stacking style vars, pointer handlers and `onClose`\n * straight through to the `Root`. Rendered on its own it is just a status card\n * (e.g. a page-level alert). For a bespoke layout, compose the parts directly:\n * `Notification.Root`, `.Icon`, `.Title`, `.Description`, `.ActionTrigger`,\n * `.CloseTrigger`.\n *\n * **Announcements are the toaster's job, not the card's.** A toast spawned\n * through `createNotifier` is its own live region: `role=\"status\"`, or\n * `role=\"alert\"` for an `error`, set by the notifier as it renders the card.\n * A standalone card carries no role: rendered with the page it is content to\n * read, not news, and a live region there would only re-announce whatever it\n * holds on every mount. A card you insert in response to an event *is* news:\n * pass the role yourself (`role=\"status\"`, or `role=\"alert\"` for a failure)\n * and it lands on the `Root`, or mount it into a region that's already live.\n */\nfunction NotificationComponent({\n type,\n title,\n description,\n action,\n color: _color,\n icon: _icon,\n withCloseButton = true,\n withCollapse = false,\n defaultOpen,\n open: _open,\n onOpenChange,\n onClose,\n translations,\n icons: iconsProp,\n // Notifier-managed plumbing — not rendered onto the card.\n status: _status,\n duration: _duration,\n asChild: _asChild,\n ...rest\n}: NotificationProps) {\n const resolvedTranslations = { ...NOTIFICATION_DEFAULT_TRANSLATIONS, ...translations }\n const icons = mergeIcons(DEFAULT_ICONS, iconsProp)\n // `type` and `color` are exclusive (see `ToastHue`), and testing the destructured `type`\n // narrows `color` with it: no cast. The preset wins should a JS caller pass both anyway.\n const color = type === undefined ? _color : TOAST_STATUS[type].color\n // Not `??`: an explicit `icon={null}` (hide the glyph) must not fall\n // through to the preset the way an omitted (`undefined`) icon does.\n const icon = _icon === undefined ? type && icons[type] : _icon\n\n const [open, setOpen] = useUncontrolled({\n defaultValue: defaultOpen,\n value: _open,\n finalValue: match({ withCloseButton, withCollapse })\n .with({ withCloseButton: true }, () => true)\n .with({ withCollapse: true }, () => false)\n .with({ withCollapse: false }, () => true)\n .exhaustive(),\n onChange: onOpenChange,\n })\n\n // Keep the last-present description / action mounted through their collapse so\n // each reveal has content to animate *out* (removed content unmounts instantly\n // otherwise). Cached independently so the two sections animate separately.\n const lastDescription = useRef(description)\n if (description != null) lastDescription.current = description\n const lastAction = useRef(action)\n if (action != null) lastAction.current = action\n\n return (\n <Root color={color} {...rest}>\n <div className=\"flex flex-row gap-3\">\n {icon != null && <Icon>{icon}</Icon>}\n {title != null && <Title>{title}</Title>}\n {match({ withCloseButton, withCollapse })\n .with({ withCloseButton: true }, () => (\n <CloseTrigger aria-label={resolvedTranslations.closeTriggerLabel} onClick={onClose}>\n {icons.close}\n </CloseTrigger>\n ))\n .with({ withCollapse: true }, () => (\n <CollapseTrigger\n open={open}\n aria-label={\n open ? resolvedTranslations.collapseLabel : resolvedTranslations.expandLabel\n }\n onClick={() => setOpen(!open)}\n >\n <Turn open={open}>{icons.collapse}</Turn>\n </CollapseTrigger>\n ))\n .with({ withCollapse: false }, () => null)\n .exhaustive()}\n </div>\n {/* Description and action are independent Collapse sections. */}\n <Collapse open={description != null && open}>\n <Description>{description ?? lastDescription.current}</Description>\n </Collapse>\n <Collapse open={action != null && open}>\n <div className=\"mt-2 flex flex-wrap items-center gap-2\">{action ?? lastAction.current}</div>\n </Collapse>\n </Root>\n )\n}\n\n/**\n * `Notification` — the ready-made card (batteries-included), with the compound\n * parts attached for bespoke composition. Mirrors `Tooltip`/`Modal`: the bare\n * name is the convenience form; `.Root` and friends are the primitives.\n */\nexport const Notification = Object.assign(NotificationComponent, {\n Root,\n Icon,\n Title,\n Description,\n ActionTrigger,\n CloseTrigger,\n CollapseTrigger,\n})\n"]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { useUncontrolled } from './chunk-PMUCGFY5.js';
|
|
2
|
+
|
|
3
|
+
// src/lib/use-pagination.ts
|
|
4
|
+
var span = (start, end) => Array.from({ length: Math.max(end - start + 1, 0) }, (_, i) => start + i);
|
|
5
|
+
var ELLIPSIS = "ellipsis";
|
|
6
|
+
var paginationRange = ({
|
|
7
|
+
page,
|
|
8
|
+
totalPages,
|
|
9
|
+
siblings = 1,
|
|
10
|
+
boundaries = 1
|
|
11
|
+
}) => {
|
|
12
|
+
const slots = siblings * 2 + boundaries * 2 + 3;
|
|
13
|
+
if (totalPages <= slots) return span(1, totalPages);
|
|
14
|
+
const left = Math.max(page - siblings, boundaries);
|
|
15
|
+
const right = Math.min(page + siblings, totalPages - boundaries);
|
|
16
|
+
const head = span(1, boundaries);
|
|
17
|
+
const tail = span(totalPages - boundaries + 1, totalPages);
|
|
18
|
+
const leftGap = left > boundaries + 2;
|
|
19
|
+
const rightGap = right < totalPages - boundaries - 1;
|
|
20
|
+
if (!leftGap) return [...span(1, siblings * 2 + boundaries + 2), ELLIPSIS, ...tail];
|
|
21
|
+
if (!rightGap) {
|
|
22
|
+
return [...head, ELLIPSIS, ...span(totalPages - siblings * 2 - boundaries - 1, totalPages)];
|
|
23
|
+
}
|
|
24
|
+
return [...head, ELLIPSIS, ...span(left, right), ELLIPSIS, ...tail];
|
|
25
|
+
};
|
|
26
|
+
var clamp = (page, totalPages) => Math.min(Math.max(Math.trunc(page), 1), Math.max(totalPages, 1));
|
|
27
|
+
function usePagination(options) {
|
|
28
|
+
const { siblings = 1, boundaries = 1 } = options;
|
|
29
|
+
const pageSize = Math.max(options.pageSize ?? 10, 1);
|
|
30
|
+
const count = options.count;
|
|
31
|
+
const totalPages = Math.max(
|
|
32
|
+
count === void 0 ? options.pages ?? 0 : Math.ceil(count / pageSize),
|
|
33
|
+
0
|
|
34
|
+
);
|
|
35
|
+
const [rawPage, setRawPage] = useUncontrolled({
|
|
36
|
+
value: options.page,
|
|
37
|
+
defaultValue: options.defaultPage,
|
|
38
|
+
finalValue: 1,
|
|
39
|
+
onChange: options.onPageChange
|
|
40
|
+
});
|
|
41
|
+
const page = clamp(rawPage, totalPages);
|
|
42
|
+
const setPage = (next) => {
|
|
43
|
+
const target = clamp(next, totalPages);
|
|
44
|
+
if (target !== page) setRawPage(target);
|
|
45
|
+
};
|
|
46
|
+
const items = paginationRange({ page, totalPages, siblings, boundaries }).map(
|
|
47
|
+
(slot, index) => slot === ELLIPSIS ? { type: "ellipsis", index } : { type: "page", value: slot }
|
|
48
|
+
);
|
|
49
|
+
const range = count === void 0 ? null : {
|
|
50
|
+
from: count === 0 ? 0 : (page - 1) * pageSize + 1,
|
|
51
|
+
to: Math.min(page * pageSize, count)
|
|
52
|
+
};
|
|
53
|
+
return {
|
|
54
|
+
page,
|
|
55
|
+
totalPages,
|
|
56
|
+
items,
|
|
57
|
+
range,
|
|
58
|
+
canPrevious: page > 1,
|
|
59
|
+
canNext: page < totalPages,
|
|
60
|
+
setPage,
|
|
61
|
+
previous: () => setPage(page - 1),
|
|
62
|
+
next: () => setPage(page + 1),
|
|
63
|
+
first: () => setPage(1),
|
|
64
|
+
last: () => setPage(totalPages)
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export { paginationRange, usePagination };
|
|
69
|
+
//# sourceMappingURL=chunk-UOWQH53N.js.map
|
|
70
|
+
//# sourceMappingURL=chunk-UOWQH53N.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/use-pagination.ts"],"names":[],"mappings":";;;AAuEA,IAAM,IAAA,GAAO,CAAC,KAAA,EAAe,GAAA,KAC3B,MAAM,IAAA,CAAK,EAAE,QAAQ,IAAA,CAAK,GAAA,CAAI,MAAM,KAAA,GAAQ,CAAA,EAAG,CAAC,CAAA,EAAE,EAAG,CAAC,CAAA,EAAG,CAAA,KAAM,QAAQ,CAAC,CAAA;AAE1E,IAAM,QAAA,GAAW,UAAA;AASV,IAAM,kBAAkB,CAAC;AAAA,EAC9B,IAAA;AAAA,EACA,UAAA;AAAA,EACA,QAAA,GAAW,CAAA;AAAA,EACX,UAAA,GAAa;AACf,CAAA,KAKoC;AAClC,EAAA,MAAM,KAAA,GAAQ,QAAA,GAAW,CAAA,GAAI,UAAA,GAAa,CAAA,GAAI,CAAA;AAC9C,EAAA,IAAI,UAAA,IAAc,KAAA,EAAO,OAAO,IAAA,CAAK,GAAG,UAAU,CAAA;AAElD,EAAA,MAAM,IAAA,GAAO,IAAA,CAAK,GAAA,CAAI,IAAA,GAAO,UAAU,UAAU,CAAA;AACjD,EAAA,MAAM,QAAQ,IAAA,CAAK,GAAA,CAAI,IAAA,GAAO,QAAA,EAAU,aAAa,UAAU,CAAA;AAC/D,EAAA,MAAM,IAAA,GAAO,IAAA,CAAK,CAAA,EAAG,UAAU,CAAA;AAC/B,EAAA,MAAM,IAAA,GAAO,IAAA,CAAK,UAAA,GAAa,UAAA,GAAa,GAAG,UAAU,CAAA;AACzD,EAAA,MAAM,OAAA,GAAU,OAAO,UAAA,GAAa,CAAA;AACpC,EAAA,MAAM,QAAA,GAAW,KAAA,GAAQ,UAAA,GAAa,UAAA,GAAa,CAAA;AAEnD,EAAA,IAAI,CAAC,OAAA,EAAS,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OAAA,CAAQ,UAAU;AAAA,GAChC;AACF","file":"chunk-UOWQH53N.js","sourcesContent":["import { useUncontrolled } from \"./use-uncontrolled\"\n\n/**\n * One slot of a pagination bar: a page number, or an ellipsis standing in for\n * the pages it hides. `index` is the slot's position in `items`, a stable key.\n */\nexport type PaginationItem = { type: \"page\"; value: number } | { type: \"ellipsis\"; index: number }\n\n/**\n * How many pages there are. Either the item total and the page size (the\n * usual case: the server tells you how many rows match), or the page count\n * itself (a CMS that already knows it has 12 pages).\n */\nexport type PaginationTotal =\n | {\n /** How many items there are in all. With `pageSize`, sets the page count. */\n count: number\n /** How many items one page holds. @default 10 */\n pageSize?: number\n pages?: never\n }\n | {\n /** How many pages there are, when you know it directly. */\n pages: number\n count?: never\n pageSize?: never\n }\n\nexport type UsePaginationOptions = PaginationTotal & {\n /** The current page, 1-based, when you control it. */\n page?: number\n /** The page to start on when uncontrolled. @default 1 */\n defaultPage?: number\n /** Called with the next page (1-based) when it changes. */\n onPageChange?: (page: number) => void\n /** How many pages stay visible on each side of the current one. @default 1 */\n siblings?: number\n /** How many pages stay visible at each end of the bar. @default 1 */\n boundaries?: number\n}\n\nexport type UsePaginationReturnValue = {\n /** The current page, 1-based, clamped to `[1, totalPages]`. `1` when there are no pages. */\n page: number\n /** How many pages there are. `0` when there is nothing to page through. */\n totalPages: number\n /** The pages to draw, with an ellipsis wherever pages are hidden. The length\n * holds steady as the page moves (`2 × siblings + 2 × boundaries + 3` once\n * there are more pages than that), so the bar never shifts under the pointer. */\n items: PaginationItem[]\n /** The items on the current page, 1-based and inclusive (`{ from: 21, to: 30 }`):\n * what a \"21–30 of 95\" line prints, and `data.slice(from - 1, to)` for a\n * list paged on the client. `null` when the total was given as `pages`. */\n range: { from: number; to: number } | null\n /** Whether there is a page before this one. */\n canPrevious: boolean\n /** Whether there is a page after this one. */\n canNext: boolean\n /** Moves to `page`, clamped to the existing pages. Does nothing for the current page. */\n setPage: (page: number) => void\n /** Moves to the previous page, if any. */\n previous: () => void\n /** Moves to the next page, if any. */\n next: () => void\n /** Moves to the first page. */\n first: () => void\n /** Moves to the last page. */\n last: () => void\n}\n\n/** `[start, start + 1, …, end]`, or `[]` when `end < start`. */\nconst span = (start: number, end: number) =>\n Array.from({ length: Math.max(end - start + 1, 0) }, (_, i) => start + i)\n\nconst ELLIPSIS = \"ellipsis\" as const\n\n/**\n * The page numbers to draw around `page`, with `\"ellipsis\"` for each run of\n * hidden pages. Always the first and last `boundaries` pages, `siblings` on\n * each side of `page`, and a constant slot count once the pages outnumber\n * the slots: an ellipsis that would hide a single page shows that page\n * instead, so the bar keeps its width as you page through it.\n */\nexport const paginationRange = ({\n page,\n totalPages,\n siblings = 1,\n boundaries = 1,\n}: {\n page: number\n totalPages: number\n siblings?: number\n boundaries?: number\n}): (number | typeof ELLIPSIS)[] => {\n const slots = siblings * 2 + boundaries * 2 + 3\n if (totalPages <= slots) return span(1, totalPages)\n\n const left = Math.max(page - siblings, boundaries)\n const right = Math.min(page + siblings, totalPages - boundaries)\n const head = span(1, boundaries)\n const tail = span(totalPages - boundaries + 1, totalPages)\n const leftGap = left > boundaries + 2\n const rightGap = right < totalPages - boundaries - 1\n\n if (!leftGap) return [...span(1, siblings * 2 + boundaries + 2), ELLIPSIS, ...tail]\n if (!rightGap) {\n return [...head, ELLIPSIS, ...span(totalPages - siblings * 2 - boundaries - 1, totalPages)]\n }\n return [...head, ELLIPSIS, ...span(left, right), ELLIPSIS, ...tail]\n}\n\nconst clamp = (page: number, totalPages: number) =>\n Math.min(Math.max(Math.trunc(page), 1), Math.max(totalPages, 1))\n\n/**\n * The page math behind a pagination bar, without the bar: the current page\n * (controlled or not), the page count, the items to draw with their\n * ellipses, the range of items on the page, and the moves between pages.\n * `Pagination` is built on it. Reach for it to draw a pager of your own, or\n * to page a list on the client:\n *\n * ```tsx\n * const { items, range, setPage } = usePagination({ count: rows.length, pageSize: 20 })\n * const visible = rows.slice(range.from - 1, range.to)\n * ```\n *\n * Pages are 1-based throughout, as they are printed.\n */\nexport function usePagination(options: UsePaginationOptions): UsePaginationReturnValue {\n const { siblings = 1, boundaries = 1 } = options\n const pageSize = Math.max(options.pageSize ?? 10, 1)\n const count = options.count\n const totalPages = Math.max(\n count === undefined ? (options.pages ?? 0) : Math.ceil(count / pageSize),\n 0,\n )\n\n const [rawPage, setRawPage] = useUncontrolled({\n value: options.page,\n defaultValue: options.defaultPage,\n finalValue: 1,\n onChange: options.onPageChange,\n })\n // A shrinking total (a filter that leaves two pages while you're on the\n // fifth) clamps what's drawn; the state itself waits for the next move.\n const page = clamp(rawPage, totalPages)\n\n const setPage = (next: number) => {\n const target = clamp(next, totalPages)\n if (target !== page) setRawPage(target)\n }\n\n const items = paginationRange({ page, totalPages, siblings, boundaries }).map(\n (slot, index): PaginationItem =>\n slot === ELLIPSIS ? { type: \"ellipsis\", index } : { type: \"page\", value: slot },\n )\n\n const range =\n count === undefined\n ? null\n : {\n from: count === 0 ? 0 : (page - 1) * pageSize + 1,\n to: Math.min(page * pageSize, count),\n }\n\n return {\n page,\n totalPages,\n items,\n range,\n canPrevious: page > 1,\n canNext: page < totalPages,\n setPage,\n previous: () => setPage(page - 1),\n next: () => setPage(page + 1),\n first: () => setPage(1),\n last: () => setPage(totalPages),\n }\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { inputSlot, inputShell, inputControlClasses } from './chunk-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { inputSlot, inputShell, inputControlClasses } from './chunk-HTVICHT4.js';
|
|
2
|
+
import { useInheritedDisabled, useInheritedInvalid } from './chunk-2RRTT4AF.js';
|
|
3
|
+
import { scrollHighlightedIntoView, popoverChevron, popoverClearTrigger, ListboxScrollArea, listboxList, popoverContent, popoverIndicator, popoverOption, popoverGroupLabel, popoverEmpty } from './chunk-YUVKROMA.js';
|
|
4
|
+
import { useNestedLayer, useTourRaised } from './chunk-SI7C3W5M.js';
|
|
4
5
|
import { useOverlayContainer } from './chunk-SLUOF7XW.js';
|
|
5
6
|
import { ChevronIcon, CloseIcon, CheckIcon } from './chunk-6YNLRQ25.js';
|
|
6
7
|
import { composeChildren } from './chunk-R5LYFTHA.js';
|
|
@@ -28,19 +29,27 @@ var Root = ({
|
|
|
28
29
|
children,
|
|
29
30
|
testId,
|
|
30
31
|
translations,
|
|
32
|
+
disabled: disabledProp,
|
|
33
|
+
invalid: invalidProp,
|
|
31
34
|
...rest
|
|
32
|
-
}) =>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
}) => {
|
|
36
|
+
const disabled = useInheritedDisabled(disabledProp);
|
|
37
|
+
const invalid = useInheritedInvalid(invalidProp);
|
|
38
|
+
return /* @__PURE__ */ jsx(ComboboxStyleContext.Provider, { value: { size, variant }, children: /* @__PURE__ */ jsx(
|
|
39
|
+
Combobox$1.Root,
|
|
40
|
+
{
|
|
41
|
+
disabled,
|
|
42
|
+
invalid,
|
|
43
|
+
positioning: { sameWidth: true, ...positioning },
|
|
44
|
+
scrollToIndexFn: scrollHighlightedIntoView,
|
|
45
|
+
className: cn("w-full", className),
|
|
46
|
+
translations: resolveComboboxTranslations(translations),
|
|
47
|
+
...props({ "data-testid": testId }),
|
|
48
|
+
...rest,
|
|
49
|
+
children
|
|
50
|
+
}
|
|
51
|
+
) });
|
|
52
|
+
};
|
|
44
53
|
var Control = ({
|
|
45
54
|
startSlot,
|
|
46
55
|
endSlot,
|
|
@@ -127,17 +136,40 @@ var Content = ({
|
|
|
127
136
|
...rest
|
|
128
137
|
}) => {
|
|
129
138
|
const portalContainer = useOverlayContainer(container);
|
|
130
|
-
|
|
131
|
-
|
|
139
|
+
const open = useComboboxContext().open;
|
|
140
|
+
useNestedLayer(open);
|
|
141
|
+
const raised = useTourRaised(open);
|
|
142
|
+
return /* @__PURE__ */ jsx(Portal, { disabled: !withinPortal, container: portalContainer, children: /* @__PURE__ */ jsx(Combobox$1.Positioner, { children: /* @__PURE__ */ jsx(
|
|
143
|
+
Combobox$1.Content,
|
|
144
|
+
{
|
|
145
|
+
className: cn(popoverContent, className),
|
|
146
|
+
"data-raised": raised || void 0,
|
|
147
|
+
...rest,
|
|
148
|
+
children: /* @__PURE__ */ jsx(ListboxScrollArea, { withPaddingTop, children: /* @__PURE__ */ jsx(Combobox$1.List, { className: listboxList, children }) })
|
|
149
|
+
}
|
|
150
|
+
) }) });
|
|
132
151
|
};
|
|
133
152
|
var Panel = ({
|
|
134
153
|
className,
|
|
135
154
|
children,
|
|
136
155
|
withPaddingTop = true,
|
|
156
|
+
viewportRef,
|
|
137
157
|
asChild: _asChild,
|
|
138
158
|
...rest
|
|
139
159
|
}) => {
|
|
140
|
-
return
|
|
160
|
+
return (
|
|
161
|
+
// A shrinkable column, so in a height-capped flex parent (Spotlight's non-scrolling
|
|
162
|
+
// modal body) the list gives way rather than pushing what follows it out of view.
|
|
163
|
+
/* @__PURE__ */ jsx(Combobox$1.Content, { ...rest, className: "flex min-h-0 flex-col", children: /* @__PURE__ */ jsx(
|
|
164
|
+
ListboxScrollArea,
|
|
165
|
+
{
|
|
166
|
+
withPaddingTop,
|
|
167
|
+
viewportRef,
|
|
168
|
+
className,
|
|
169
|
+
children: /* @__PURE__ */ jsx(Combobox$1.List, { className: listboxList, children })
|
|
170
|
+
}
|
|
171
|
+
) })
|
|
172
|
+
);
|
|
141
173
|
};
|
|
142
174
|
var Item = ({ className, children, testId, asChild: _asChild, ...rest }) => {
|
|
143
175
|
const { size } = useContext(ComboboxStyleContext);
|
|
@@ -181,5 +213,5 @@ var Combobox = {
|
|
|
181
213
|
};
|
|
182
214
|
|
|
183
215
|
export { COMBOBOX_DEFAULT_TRANSLATIONS, Combobox, resolveComboboxTranslations };
|
|
184
|
-
//# sourceMappingURL=chunk-
|
|
185
|
-
//# sourceMappingURL=chunk-
|
|
216
|
+
//# sourceMappingURL=chunk-W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AA,EAAM,CAAA;AAAA,EAE1D;AAAA,CAAA,EACH,CAAA;AAGF,IAAM,QAAQ,CAAC,EAAE,SAAA,EAAW,GAAG,MAAK,qBAClC,GAAA,CAACA,UAAA,CAAI,KAAA,EAAJ,EAAU,SAAA,EAAW,EAAA,CAAG,cAAc,SAAS,CAAA,EAAI,GAAG,IAAA,EAAM,CAAA;AAOxD,IAAM,QAAA,GAAW;AAAA,EACtB,IAAA;AAAA,EACA,OAAA;AAAA,EACA,KAAA;AAAA,EACA,OAAA;AAAA,EACA,YAAA;AAAA,EACA,OAAA;AAAA,EACA,KAAA;AAAA,EACA,IAAA;AAAA,EACA,KAAA;AAAA,EACA,KAAA;AAAA,EACA,SAASA,UAAA,CAAI;AACf","file":"chunk-WJUY6YWF.js","sourcesContent":["\"use client\"\n\nimport { Combobox as Ark, useComboboxContext } from \"@ark-ui/react/combobox\"\nimport { Portal } from \"@ark-ui/react/portal\"\nimport {\n type ComponentProps,\n type ComponentPropsWithoutRef,\n createContext,\n type ReactNode,\n type Ref,\n useContext,\n} from \"react\"\nimport { composeChildren, type NoAsChild } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport { useOverlayContainer } from \"../../lib/overlay-container\"\nimport { useNestedLayer, useTourRaised } from \"../../lib/overlay-layer\"\nimport { props } from \"../../lib/props\"\nimport type { ItemRenderState } from \"../../lib/select-data\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { useInheritedDisabled, useInheritedInvalid } from \"../field/field\"\nimport {\n type InputSize,\n type InputVariant,\n inputControlClasses,\n inputShell,\n inputSlot,\n} from \"../input/input\"\nimport { CheckIcon, ChevronIcon, CloseIcon } from \"../popover/icons\"\nimport {\n ListboxScrollArea,\n listboxList,\n popoverChevron,\n popoverClearTrigger,\n popoverContent,\n popoverEmpty,\n popoverGroupLabel,\n popoverIndicator,\n popoverOption,\n scrollHighlightedIntoView,\n} from \"../popover/popover\"\n\n/**\n * Combobox — the kit's composable search-select primitive, a thin styled layer\n * over Ark UI's Combobox parts. It's the engine `Autocomplete` and `MultiSelect`\n * build on, and the escape hatch when the data-driven components don't fit.\n *\n * Compose the parts yourself, Ark-style — pass a `collection`\n * (`createListCollection`, re-exported here), filter it on input change, and\n * render `Combobox.Item`s from it:\n *\n * const collection = createListCollection({ items });\n * <Combobox.Root collection={collection} onInputValueChange={...}>\n * <Combobox.Control>\n * <Combobox.Input />\n * <Combobox.Trigger />\n * </Combobox.Control>\n * <Combobox.Content>\n * {items.map((i) => <Combobox.Item key={i.value} item={i}>{i.label}</Combobox.Item>)}\n * <Combobox.Empty>Nothing found</Combobox.Empty>\n * </Combobox.Content>\n * </Combobox.Root>\n *\n * `Content` is the floating popover panel (Portal + Positioner + card chrome) —\n * the right choice behind a `Trigger`. For a combobox that renders permanently\n * open inside a container you already own (no trigger of its own — see\n * `ComboboxList` / `MultiComboboxList`), use `Panel` instead: same `Ark.Content`\n * + `Ark.List` wiring, no Portal/Positioner/card chrome.\n *\n * `size` / `variant` / `color` set once on `Root` flow to the control and\n * options through context. Ark owns the state machine: filtering contract,\n * keyboard nav, `multiple`, custom values, RTL, and Field wiring.\n */\n\ntype ComboboxStyle = { size: InputSize; variant: InputVariant }\nconst ComboboxStyleContext = createContext<ComboboxStyle>({\n size: \"md\",\n variant: \"default\",\n})\n\n/** The combobox family's wording — Ark's own Combobox `translations` type, derived structurally\n * rather than imported by name (`IntlTranslations` lives in `@zag-js/combobox`, a transitive\n * dependency). `triggerLabel` names the chevron toggle, `clearTriggerLabel` the clear (×)\n * button. Shared by `Combobox`, `Autocomplete`, `MultiSelect`, `ComboboxList` and\n * `MultiComboboxList`, so one translation pack covers the family. */\nexport type ComboboxTranslations = NonNullable<Ark.RootProps<Ark.CollectionItem>[\"translations\"]>\n\n/** The family's English defaults — the kit's own wording, not zag's (\"Toggle suggestions\"). */\nexport const COMBOBOX_DEFAULT_TRANSLATIONS = {\n triggerLabel: \"Show options\",\n clearTriggerLabel: \"Clear value\",\n} as const satisfies ComboboxTranslations\n\n/** Shallow per-key merge over `COMBOBOX_DEFAULT_TRANSLATIONS`. */\nexport const resolveComboboxTranslations = (overrides?: ComboboxTranslations) =>\n overrides ? { ...COMBOBOX_DEFAULT_TRANSLATIONS, ...overrides } : COMBOBOX_DEFAULT_TRANSLATIONS\n\nexport type ComboboxRootProps<T extends Ark.CollectionItem = Ark.CollectionItem> = Omit<\n Ark.RootProps<T>,\n \"color\" | \"className\"\n> &\n WithTestId & {\n /** Control + option sizing. Flows to the parts via context. */\n size?: InputSize\n /** Control shell treatment. */\n variant?: InputVariant\n /** Focus-ring accent for the control. */\n className?: string\n }\n\n// Generic over the collection item type (like Ark's Root) so a typed\n// `ListCollection<T>` flows through without widening to `unknown`.\nconst Root = <T extends Ark.CollectionItem = Ark.CollectionItem>({\n size = \"md\",\n variant = \"default\",\n positioning,\n className,\n children,\n testId,\n translations,\n disabled: disabledProp,\n invalid: invalidProp,\n ...rest\n}: ComboboxRootProps<T>) => {\n // Ark's machine reads only a `Field`; a composed combobox with no `Field`\n // takes an enclosing `Fieldset`'s state here, like the kit's own pickers.\n const disabled = useInheritedDisabled(disabledProp)\n const invalid = useInheritedInvalid(invalidProp)\n return (\n <ComboboxStyleContext.Provider value={{ size, variant }}>\n <Ark.Root\n disabled={disabled}\n invalid={invalid}\n // Match the popover width to the control by default; callers can override.\n positioning={{ sameWidth: true, ...positioning }}\n // The popover's Content is an `overflow-hidden` clip wrapper, so the\n // machine's native auto-scroll (which needs Content to be scrollable) is a\n // no-op; route scrolling to the inner List scroller instead. Callers in\n // `rest` can still override.\n scrollToIndexFn={scrollHighlightedIntoView}\n className={cn(\"w-full\", className)}\n // The kit's English wording over zag's; a partial override keeps the other key.\n translations={resolveComboboxTranslations(translations)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {children}\n </Ark.Root>\n </ComboboxStyleContext.Provider>\n )\n}\n\nexport type ComboboxControlProps = NoAsChild<ComponentPropsWithoutRef<typeof Ark.Control>> &\n WithTestId & {\n /** Inline-start adornment (icon, label). */\n startSlot?: ReactNode\n /** Inline-end adornment — rendered before the composed Trigger / ClearTrigger. */\n endSlot?: ReactNode\n }\n\nconst Control = ({\n startSlot,\n endSlot,\n className,\n children,\n testId,\n asChild: _asChild,\n ...rest\n}: ComboboxControlProps) => {\n const { size, variant } = useContext(ComboboxStyleContext)\n return (\n <Ark.Control\n {...props({\n \"data-with-start-slot\": startSlot != null,\n // The composed Trigger / ClearTrigger always sits at the end.\n \"data-with-end-slot\": true,\n \"data-testid\": testId,\n })}\n className={cn(inputShell({ size, variant }), className)}\n {...rest}\n >\n {startSlot != null && (\n <span className={inputSlot} aria-hidden>\n {startSlot}\n </span>\n )}\n {children}\n {endSlot != null && <span className={inputSlot}>{endSlot}</span>}\n </Ark.Control>\n )\n}\n\n// `ComponentProps` (not `…WithoutRef`) so a caller's `ref` reaches the underlying\n// `<input>` — it's the focus target for the form-control contract (focus-on-error).\nconst Input = ({ className, testId, ...rest }: ComponentProps<typeof Ark.Input> & WithTestId) => (\n <Ark.Input\n className={cn(inputControlClasses, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nconst Trigger = ({\n className,\n children,\n asChild,\n ...rest\n}: ComponentPropsWithoutRef<typeof Ark.Trigger>) => (\n <Ark.Trigger\n className={cn(\n popoverChevron,\n \"inline-flex cursor-pointer items-center justify-center rounded-sm\",\n \"data-[state=open]:rotate-180 disabled:cursor-not-allowed\",\n className,\n )}\n asChild={asChild}\n {...rest}\n >\n {composeChildren(asChild, children, (own) => own ?? <ChevronIcon />)}\n </Ark.Trigger>\n)\n\nconst ClearTrigger = ({\n className,\n children,\n asChild,\n ...rest\n}: ComponentPropsWithoutRef<typeof Ark.ClearTrigger>) => (\n // zag marks the combobox clear control `tabIndex={-1}`; surface it in the tab\n // order so keyboard users can reach it (matching Select's clear and the tree\n // clears). A caller can still override via `tabIndex` in `rest`.\n <Ark.ClearTrigger\n tabIndex={0}\n className={cn(popoverClearTrigger, className)}\n asChild={asChild}\n {...rest}\n >\n {composeChildren(asChild, children, (own) => own ?? <CloseIcon />)}\n </Ark.ClearTrigger>\n)\n\nconst Content = ({\n className,\n children,\n withPaddingTop = true,\n withinPortal = true,\n container,\n asChild: _asChild,\n ...rest\n}: NoAsChild<ComponentPropsWithoutRef<typeof Ark.Content>> & {\n withPaddingTop?: boolean\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}) => {\n const portalContainer = useOverlayContainer(container)\n // Holds an enclosing Modal/Drawer/Popover open while the list is; see `lib/overlay-layer.tsx`.\n const open = useComboboxContext().open\n useNestedLayer(open)\n // Lifted above a running tour; see `useTourRaised`.\n const raised = useTourRaised(open)\n return (\n <Portal disabled={!withinPortal} container={portalContainer}>\n <Ark.Positioner>\n <Ark.Content\n className={cn(popoverContent, className)}\n data-raised={raised || undefined}\n {...rest}\n >\n <ListboxScrollArea withPaddingTop={withPaddingTop}>\n <Ark.List className={listboxList}>{children}</Ark.List>\n </ListboxScrollArea>\n </Ark.Content>\n </Ark.Positioner>\n </Portal>\n )\n}\n\n/**\n * Inline alternative to `Content` — no `Portal`, no `Positioner`, no floating\n * chrome. For a combobox meant to render permanently open inside a container\n * the caller already owns (e.g. another `Popover`'s body), where the floating\n * machinery would just be dead weight and the wrong chrome (a card inside a\n * card). `getContentProps` doesn't require a Positioner to work — it's a plain\n * `hidden`-toggled element — so `Ark.Content` renders inline in normal flow.\n */\nconst Panel = ({\n className,\n children,\n withPaddingTop = true,\n viewportRef,\n asChild: _asChild,\n ...rest\n}: NoAsChild<ComponentPropsWithoutRef<typeof Ark.Content>> & {\n withPaddingTop?: boolean\n /** The scroller (the scroll area's viewport), which `className` styles. */\n viewportRef?: Ref<HTMLDivElement>\n}) => {\n return (\n // A shrinkable column, so in a height-capped flex parent (Spotlight's non-scrolling\n // modal body) the list gives way rather than pushing what follows it out of view.\n <Ark.Content {...rest} className=\"flex min-h-0 flex-col\">\n <ListboxScrollArea\n withPaddingTop={withPaddingTop}\n viewportRef={viewportRef}\n className={className}\n >\n <Ark.List className={listboxList}>{children}</Ark.List>\n </ListboxScrollArea>\n </Ark.Content>\n )\n}\n\nexport type ComboboxItemProps = NoAsChild<\n Omit<ComponentPropsWithoutRef<typeof Ark.Item>, \"children\">\n> &\n WithTestId & {\n /**\n * Option content. A plain node renders as the label (the kit adds the check\n * indicator); a function takes over the whole row, receiving the item's live\n * state so it can draw its own affordance.\n */\n children?: ReactNode | ((state: ItemRenderState) => ReactNode)\n }\n\nconst Item = ({ className, children, testId, asChild: _asChild, ...rest }: ComboboxItemProps) => {\n const { size } = useContext(ComboboxStyleContext)\n return (\n <Ark.Item\n className={cn(popoverOption({ size }), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {typeof children === \"function\" ? (\n <Ark.ItemContext>\n {(ctx) => children({ selected: ctx.selected, highlighted: ctx.highlighted })}\n </Ark.ItemContext>\n ) : (\n <>\n <Ark.ItemText>{children}</Ark.ItemText>\n <Ark.ItemIndicator className={popoverIndicator}>\n <CheckIcon />\n </Ark.ItemIndicator>\n </>\n )}\n </Ark.Item>\n )\n}\n\nexport type ComboboxGroupProps = NoAsChild<ComponentPropsWithoutRef<typeof Ark.ItemGroup>> &\n WithTestId & {\n /** Group heading rendered above the options. */\n label?: ReactNode\n }\n\nconst Group = ({\n label,\n className,\n children,\n testId,\n asChild: _asChild,\n ...rest\n}: ComboboxGroupProps) => (\n <Ark.ItemGroup className={className} {...props({ \"data-testid\": testId })} {...rest}>\n {label != null && (\n <Ark.ItemGroupLabel className={popoverGroupLabel}>{label}</Ark.ItemGroupLabel>\n )}\n {children}\n </Ark.ItemGroup>\n)\n\nconst Empty = ({ className, ...rest }: ComponentPropsWithoutRef<typeof Ark.Empty>) => (\n <Ark.Empty className={cn(popoverEmpty, className)} {...rest} />\n)\n\n/**\n * Composable parts namespace (Ark-style). `Context` is Ark's render-prop access\n * to the live machine api (e.g. to map over the filtered collection).\n */\nexport const Combobox = {\n Root,\n Control,\n Input,\n Trigger,\n ClearTrigger,\n Content,\n Panel,\n Item,\n Group,\n Empty,\n Context: Ark.Context,\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Button } from './chunk-
|
|
1
|
+
import { Button } from './chunk-KZDMVOL6.js';
|
|
2
2
|
import { props } from './chunk-WYCMIIRR.js';
|
|
3
3
|
import { ark } from '@ark-ui/react';
|
|
4
4
|
import { useRef } from 'react';
|
|
@@ -89,5 +89,5 @@ var FileTrigger = ({
|
|
|
89
89
|
};
|
|
90
90
|
|
|
91
91
|
export { FileTrigger };
|
|
92
|
-
//# sourceMappingURL=chunk-
|
|
93
|
-
//# sourceMappingURL=chunk-
|
|
92
|
+
//# sourceMappingURL=chunk-WKIUMLRT.js.map
|
|
93
|
+
//# sourceMappingURL=chunk-WKIUMLRT.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/file-trigger/file-trigger.tsx"],"names":[],"mappings":";;;;;;AA8CO,IAAM,cAAc,CAAC;AAAA,EAC1B,MAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,IAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AAAA,EACA,MAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA,IAAA;AAAA,EACA,KAAA;AAAA,EACA,OAAA;AAAA,EACA,SAAA;AAAA,EACA,OAAA;AAAA,EACA,GAAG;AACL,CAAA,KAAwB;AACtB,EAAA,MAAM,KAAA,GAAQ,OAAyB,IAAI,CAAA;AAI3C,EAAA,MAAM,IAAA,GAAO,CAAC,KAAA,KAAyC;AACrD,IAAA,OAAA,GAAU,KAAK,CAAA;AACf,IAAA,IAAI,CAAC,KAAA,CAAM,gBAAA,IAAoB,CAAC,QAAA,EAAU,KAAA,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cesContent":["\"use client\"\n\nimport { ark } from \"@ark-ui/react\"\nimport { type ChangeEvent, type MouseEvent, useRef } from \"react\"\nimport { props } from \"../../lib/props\"\nimport { Button, type ButtonProps } from \"../button/button\"\n\n/**\n * FileTrigger — a button that opens the OS file picker (or, on a phone, the\n * native camera), backed by a hidden `<input type=\"file\">`. It has no\n * dropzone and no file list: it hands the picked `File[]` to `onSelect` and\n * leaves the rest to you. Reach for `FileUpload` when you want the full\n * field.\n *\n * - Renders a kit `Button` by default, and takes every Button prop. With\n * `asChild`, any element becomes the trigger: an `ActionIcon`, a link\n * styled as a button, a `Menu.Item`. Style the child then; Button's own\n * style props (`variant`, `size`, …) only apply to the default render.\n * - `capture` asks a phone for its camera instead of the library. Desktop\n * browsers ignore it and open the file picker.\n * - The input is cleared after each pick, so choosing the same file twice\n * fires `onSelect` twice. Pass `name` and the input keeps its files\n * instead, so a native `<form>` submits them.\n * - The trigger is the only element a keyboard or a screen reader reaches;\n * the input is `hidden`, out of the tab order and out of the a11y tree.\n *\n * ```tsx\n * <FileTrigger accept=\"image/*\" onSelect={([file]) => setAvatar(file)}>\n * Choose a photo\n * </FileTrigger>\n * ```\n */\n\nexport type FileTriggerProps = Omit<ButtonProps, \"onSelect\" | \"name\" | \"type\"> & {\n /** Accepted types: MIME types, globs or extensions (`\"image/*\"`, `[\".pdf\", \".docx\"]`). */\n accept?: string | string[]\n /** Opens a phone's camera, front (`\"user\"`) or back (`\"environment\"`), instead of the library. */\n capture?: \"user\" | \"environment\"\n /** Allows picking several files at once. */\n multiple?: boolean\n /** Fires with the picked files. */\n onSelect?: (files: File[]) => void\n /** Wires the hidden input into native form submission; the input then keeps its files. */\n name?: string\n}\n\nexport const FileTrigger = ({\n accept,\n capture,\n multiple,\n onSelect,\n name,\n disabled,\n asChild,\n children,\n testId,\n onClick,\n variant,\n size,\n color,\n loading,\n startSlot,\n endSlot,\n ...rest\n}: FileTriggerProps) => {\n const input = useRef<HTMLInputElement>(null)\n\n // `onClick` runs first, so a caller can `preventDefault()` to keep the\n // picker shut (a confirm step, a quota check).\n const open = (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event)\n if (!event.defaultPrevented && !disabled) input.current?.click()\n }\n\n const select = (event: ChangeEvent<HTMLInputElement>) => {\n onSelect?.(Array.from(event.currentTarget.files ?? []))\n // A file input only fires `change` when its value changes, so picking the\n // same file again would be silent. A named input is form state, so it\n // keeps what was picked.\n if (name == null) event.currentTarget.value = \"\"\n }\n\n const trigger = {\n \"data-scope\": \"file-trigger\",\n \"data-part\": \"trigger\",\n onClick: open,\n ...props({ \"data-testid\": testId, \"data-disabled\": disabled }),\n ...rest,\n }\n\n return (\n <>\n {asChild ? (\n // Only behaviour is merged onto the child: Button's styling would\n // fight an ActionIcon's or a link's own.\n <ark.button\n asChild\n disabled={disabled}\n {...props({ \"aria-disabled\": disabled })}\n {...trigger}\n >\n {children}\n </ark.button>\n ) : (\n <Button\n variant={variant}\n size={size}\n color={color}\n loading={loading}\n startSlot={startSlot}\n endSlot={endSlot}\n disabled={disabled}\n {...trigger}\n >\n {children}\n </Button>\n )}\n <input\n ref={input}\n type=\"file\"\n hidden\n tabIndex={-1}\n aria-hidden\n accept={Array.isArray(accept) ? accept.join(\",\") : accept}\n capture={capture}\n multiple={multiple}\n name={name}\n disabled={disabled}\n onChange={select}\n data-scope=\"file-trigger\"\n data-part=\"input\"\n />\n </>\n )\n}\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { devWarnOnce } from './chunk-PQZSTI3R.js';
|
|
2
|
+
import { match, P } from 'ts-pattern';
|
|
3
|
+
|
|
4
|
+
var METER_ZONE_COLORS = {
|
|
5
|
+
good: "green",
|
|
6
|
+
warning: "orange",
|
|
7
|
+
critical: "red"
|
|
8
|
+
};
|
|
9
|
+
var arkValue = (component, meter, value, min) => {
|
|
10
|
+
if (meter && value === null) {
|
|
11
|
+
devWarnOnce(`[${component}] a meter is never indeterminate; \`null\` reads as \`min\`.`);
|
|
12
|
+
return min;
|
|
13
|
+
}
|
|
14
|
+
return value;
|
|
15
|
+
};
|
|
16
|
+
var clamp = (n, lo, hi) => Math.min(Math.max(n, lo), hi);
|
|
17
|
+
var num = (n) => typeof n === "number" ? n : void 0;
|
|
18
|
+
var meterZone = (value, { min, max, ...thresholds }) => {
|
|
19
|
+
const [rawLow, rawHigh, rawOptimum] = [thresholds.low, thresholds.high, thresholds.optimum].map(
|
|
20
|
+
num
|
|
21
|
+
);
|
|
22
|
+
if (value == null || (rawLow ?? rawHigh ?? rawOptimum) == null) return void 0;
|
|
23
|
+
const low = clamp(rawLow ?? min, min, max);
|
|
24
|
+
const high = clamp(rawHigh ?? max, low, max);
|
|
25
|
+
const optimum = clamp(rawOptimum ?? (min + max) / 2, min, max);
|
|
26
|
+
return match(optimum).with(
|
|
27
|
+
P.when((o) => o < low),
|
|
28
|
+
() => value <= low ? "good" : value <= high ? "warning" : "critical"
|
|
29
|
+
).with(
|
|
30
|
+
P.when((o) => o > high),
|
|
31
|
+
() => value >= high ? "good" : value >= low ? "warning" : "critical"
|
|
32
|
+
).otherwise(() => value >= low && value <= high ? "good" : "warning");
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export { METER_ZONE_COLORS, arkValue, meterZone };
|
|
36
|
+
//# sourceMappingURL=chunk-X6RB74JN.js.map
|
|
37
|
+
//# sourceMappingURL=chunk-X6RB74JN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/meter.ts"],"names":[],"mappings":";;;AAgCO,IAAM,iBAAA,GAA8C;AAAA,EACzD,IAAA,EAAM,OAAA;AAAA,EACN,OAAA,EAAS,QAAA;AAAA,EACT,QAAA,EAAU;AACZ;AA8EO,IAAM,QAAA,GAAW,CACtB,SAAA,EACA,KAAA,EACA,OACA,GAAA,KAC8B;AAC9B,EAAA,IAAI,KAAA,IAAS,UAAU,IAAA,EAAM;AAC3B,IAAA,WAAA,CAAY,CAAA,CAAA,EAAI,SAAS,CAAA,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A,KAAM,IAAI,IAAI,CAAA;AAAA,IACtB,MAAkB,KAAA,IAAS,IAAA,GAAO,MAAA,GAAS,KAAA,IAAS,MAAM,SAAA,GAAY;AAAA,GACxE,CACC,UAAU,MAAkB,KAAA,IAAS,OAAO,KAAA,IAAS,IAAA,GAAO,SAAS,SAAU,CAAA;AACpF","file":"chunk-X6RB74JN.js","sourcesContent":["import { match, P } from \"ts-pattern\"\nimport type { Unavailable } from \"./available-if\"\nimport type { Color } from \"./colors\"\nimport { devWarnOnce } from \"./dev-warn\"\n\n/**\n * Meter mode, shared by `Progress` and `CircularProgress`.\n *\n * A progress bar says \"a task is advancing\"; a meter says \"this is how full\n * something is\": an XP level, disk usage, a quota, a score. Both look the same,\n * so the kit draws them with the same components and flips the semantics with\n * one prop, `meter`, the way HTML has `<progress>` and `<meter>` side by side.\n *\n * Ark's Progress machine has no meter mode (it hard-codes `role=\"progressbar\"`\n * and never writes `aria-valuetext`), but it already owns everything else a\n * meter needs: the min/max/percent math, the ring geometry, the locale-aware\n * `Intl.NumberFormat` (`locale` + `formatOptions`) and the `translations.value`\n * override. So meter mode keeps the machine and only overrides the role and\n * the value text on the element Ark stamps them on.\n *\n * The thresholds follow HTML `<meter>`'s `low` / `high` / `optimum` exactly,\n * including its region algorithm (`meterZone` below), and map each region onto\n * one of the kit's palettes (`METER_ZONE_COLORS`).\n */\n\n/** Which region of the scale the value sits in, as HTML `<meter>` defines it:\n * `good` is the optimum region, `warning` the suboptimal one, `critical` the\n * \"even less good\" one. */\nexport type MeterZone = \"good\" | \"warning\" | \"critical\"\n\n/** The palette each zone paints with. Fixed palettes, not slot overrides, so a\n * consumer's own `[data-color]` blocks restyle them like any other component. */\nexport const METER_ZONE_COLORS: Record<MeterZone, Color> = {\n good: \"green\",\n warning: \"orange\",\n critical: \"red\",\n}\n\n/**\n * The `meter` flag and everything it gates, as one object type.\n *\n * `M` is the component's own type parameter, inferred from `meter` at the JSX\n * call site, and each gated prop carries its own condition on it, the same\n * per-property shape as `AvailableIf`:\n *\n * - `meter` (`M` = `true`): `value={null}` is a type error, whose message\n * carries the brand's reason.\n * - no `meter` (`M` falls to the component's default, `false`): `low` / `high`\n * / `optimum` are errors.\n * - `M` = `boolean` (a dynamic `meter={flag}`, or a generic consumer reading\n * `ProgressProps` with no argument): everything is available, and `value` is\n * plain `number | null`. The runtime guard in `arkValue` covers that case.\n *\n * Deliberately not a union of a meter and a progressbar shape. A union reaches\n * every consumer that takes the props generically (`Omit<ProgressProps, …>`\n * merges its halves; a `ComponentType<Partial<P>>` helper infers `P` from it\n * and sees the brand inside `value`), so the rule would leak out of the call\n * site it exists for. Per-key conditionals keep the object one object.\n *\n * The brand is written inline, not behind an alias: the alias name would\n * stand in for its reason in the error the caller reads.\n */\nexport type MeterProps<M extends boolean> = {\n /**\n * Announce a measurement (`role=\"meter\"`, like HTML `<meter>`) instead of a\n * task's progress (`role=\"progressbar\"`). For a level, a usage, a score or a\n * capacity. A meter is never indeterminate, so `value={null}` is a type error.\n */\n meter?: M\n /**\n * Controlled value in `min..max`. Pass `null` for the indeterminate state\n * (never with `meter`). Leave unset (with no `defaultValue`) for an\n * uncontrolled bar.\n */\n value?: [M] extends [true]\n ? number | Unavailable<\"a meter is never indeterminate: pass a number, or drop `meter`\">\n : number | null\n /** Uncontrolled initial value. Pass `null` to start indeterminate (never with `meter`). */\n defaultValue?: [M] extends [true]\n ? number | Unavailable<\"a meter is never indeterminate: pass a number, or drop `meter`\">\n : number | null\n /** Fires on every value change. A meter's value is never `null`. */\n onChange?: (value: [M] extends [true] ? number : number | null) => void\n /** Meter only. Upper bound of the low region. Defaults to `min`. Like `<meter low>`. */\n low?: [M] extends [false]\n ? Unavailable<\"thresholds need `meter`: a task's progress has no good or bad zone\"> | undefined\n : number\n /** Meter only. Lower bound of the high region. Defaults to `max`. Like `<meter high>`. */\n high?: [M] extends [false]\n ? Unavailable<\"thresholds need `meter`: a task's progress has no good or bad zone\"> | undefined\n : number\n /** Meter only. The best value: its region is `good`, the next `warning`, the\n * far one `critical`. Defaults to the midpoint. Like `<meter optimum>`. */\n optimum?: [M] extends [false]\n ? Unavailable<\"thresholds need `meter`: a task's progress has no good or bad zone\"> | undefined\n : number\n}\n\n/** The value and threshold props as the component reads them once destructured\n * (the brands are unconstructible, so only these shapes reach runtime). */\nexport type MeterRuntime = {\n meter?: boolean\n value?: unknown\n defaultValue?: unknown\n low?: unknown\n high?: unknown\n optimum?: unknown\n}\n\n/**\n * The value to hand Ark. A meter that still receives `null` (plain JS, a cast)\n * would otherwise turn indeterminate, which a meter cannot be: warn, and read\n * it as `min` instead.\n */\nexport const arkValue = (\n component: string,\n meter: boolean | undefined,\n value: unknown,\n min: number,\n): number | null | undefined => {\n if (meter && value === null) {\n devWarnOnce(`[${component}] a meter is never indeterminate; \\`null\\` reads as \\`min\\`.`)\n return min\n }\n return value as number | null | undefined\n}\n\nconst clamp = (n: number, lo: number, hi: number) => Math.min(Math.max(n, lo), hi)\nconst num = (n: unknown) => (typeof n === \"number\" ? n : undefined)\n\n/**\n * The zone `value` falls in, or `undefined` when no threshold is set (the bar\n * then keeps its `color`). This is HTML's `<meter>` algorithm as browsers ship\n * it: thresholds clamp into `min..max` (and `high` to at least `low`), then\n * the region holding `optimum` is `good`.\n */\nexport const meterZone = (\n value: number | null,\n { min, max, ...thresholds }: MeterRuntime & { min: number; max: number },\n): MeterZone | undefined => {\n const [rawLow, rawHigh, rawOptimum] = [thresholds.low, thresholds.high, thresholds.optimum].map(\n num,\n )\n if (value == null || (rawLow ?? rawHigh ?? rawOptimum) == null) return undefined\n const low = clamp(rawLow ?? min, min, max)\n const high = clamp(rawHigh ?? max, low, max)\n const optimum = clamp(rawOptimum ?? (min + max) / 2, min, max)\n\n return match(optimum)\n .with(\n P.when((o) => o < low),\n (): MeterZone => (value <= low ? \"good\" : value <= high ? \"warning\" : \"critical\"),\n )\n .with(\n P.when((o) => o > high),\n (): MeterZone => (value >= high ? \"good\" : value >= low ? \"warning\" : \"critical\"),\n )\n .otherwise((): MeterZone => (value >= low && value <= high ? \"good\" : \"warning\"))\n}\n"]}
|