@42-central/ui-react 0.29.0 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-X6DESK37.js → chunk-2RRTT4AF.js} +17 -5
- package/dist/chunk-2RRTT4AF.js.map +1 -0
- package/dist/{chunk-TUP7WXQE.js → chunk-322I2RSV.js} +9 -6
- package/dist/chunk-322I2RSV.js.map +1 -0
- package/dist/{chunk-ISX3AM32.js → chunk-37SRSNLJ.js} +4 -4
- package/dist/{chunk-ISX3AM32.js.map → chunk-37SRSNLJ.js.map} +1 -1
- package/dist/{chunk-L5GH7LLD.js → chunk-3MFWUG5O.js} +4 -4
- package/dist/{chunk-L5GH7LLD.js.map → chunk-3MFWUG5O.js.map} +1 -1
- package/dist/{chunk-FQJNQW3G.js → chunk-3XQEOJCE.js} +8 -5
- package/dist/chunk-3XQEOJCE.js.map +1 -0
- package/dist/{chunk-JKFPRQB2.js → chunk-4LSZ5JWF.js} +3 -3
- package/dist/{chunk-JKFPRQB2.js.map → chunk-4LSZ5JWF.js.map} +1 -1
- package/dist/{chunk-V2QZG4IT.js → chunk-5HWFYYHW.js} +27 -9
- package/dist/chunk-5HWFYYHW.js.map +1 -0
- package/dist/{chunk-GEZYGBXY.js → chunk-6MVFCS46.js} +99 -42
- package/dist/chunk-6MVFCS46.js.map +1 -0
- package/dist/{chunk-NNPSBC7O.js → chunk-6WZSUS3U.js} +10 -9
- package/dist/chunk-6WZSUS3U.js.map +1 -0
- package/dist/chunk-6YRGP6PS.js +138 -0
- package/dist/chunk-6YRGP6PS.js.map +1 -0
- package/dist/{chunk-B5YHYI7E.js → chunk-ALANKV5Y.js} +23 -6
- package/dist/chunk-ALANKV5Y.js.map +1 -0
- package/dist/{chunk-IA6DCC3N.js → chunk-AUQPNDE5.js} +23 -13
- package/dist/chunk-AUQPNDE5.js.map +1 -0
- package/dist/{chunk-AKXALCUN.js → chunk-D7SW2E24.js} +4 -4
- package/dist/chunk-D7SW2E24.js.map +1 -0
- package/dist/{chunk-OXR7BXZA.js → chunk-DQIYYDFD.js} +4 -3
- package/dist/chunk-DQIYYDFD.js.map +1 -0
- package/dist/{chunk-HMNXNKDA.js → chunk-FCBYUN6F.js} +4 -4
- package/dist/{chunk-HMNXNKDA.js.map → chunk-FCBYUN6F.js.map} +1 -1
- package/dist/{chunk-2W7H43WL.js → chunk-FED6SJWM.js} +23 -14
- package/dist/chunk-FED6SJWM.js.map +1 -0
- package/dist/{chunk-7E7JNWOC.js → chunk-FEPIHXVI.js} +6 -5
- package/dist/chunk-FEPIHXVI.js.map +1 -0
- package/dist/{chunk-Y57NW6G7.js → chunk-G3YOSG3U.js} +4 -4
- package/dist/{chunk-Y57NW6G7.js.map → chunk-G3YOSG3U.js.map} +1 -1
- package/dist/chunk-GZN5CXMR.js +100 -0
- package/dist/chunk-GZN5CXMR.js.map +1 -0
- package/dist/{chunk-HCHGERDB.js → chunk-HCSZPBWV.js} +17 -115
- package/dist/chunk-HCSZPBWV.js.map +1 -0
- package/dist/{chunk-I4B3N3UX.js → chunk-HTVICHT4.js} +12 -7
- package/dist/chunk-HTVICHT4.js.map +1 -0
- package/dist/chunk-I7TC2C3I.js +163 -0
- package/dist/chunk-I7TC2C3I.js.map +1 -0
- package/dist/{chunk-7FPSQBWB.js → chunk-IBXYLO2J.js} +14 -13
- package/dist/chunk-IBXYLO2J.js.map +1 -0
- package/dist/{chunk-7KFUFAVP.js → chunk-IRYG6B5A.js} +9 -8
- package/dist/chunk-IRYG6B5A.js.map +1 -0
- package/dist/{chunk-2RQLPN4U.js → chunk-JCNEW4WJ.js} +8 -8
- package/dist/{chunk-2RQLPN4U.js.map → chunk-JCNEW4WJ.js.map} +1 -1
- package/dist/{chunk-SP6LCCTZ.js → chunk-KZDMVOL6.js} +35 -8
- package/dist/chunk-KZDMVOL6.js.map +1 -0
- package/dist/chunk-LR5U6TZZ.js +169 -0
- package/dist/chunk-LR5U6TZZ.js.map +1 -0
- package/dist/{chunk-MQHD3EJE.js → chunk-LZHZJWVM.js} +6 -4
- package/dist/chunk-LZHZJWVM.js.map +1 -0
- package/dist/{chunk-5EOMSWNO.js → chunk-MAM2X3MW.js} +5 -5
- package/dist/{chunk-5EOMSWNO.js.map → chunk-MAM2X3MW.js.map} +1 -1
- package/dist/{chunk-FSPS7TVD.js → chunk-MCMS4NMO.js} +5 -5
- package/dist/{chunk-FSPS7TVD.js.map → chunk-MCMS4NMO.js.map} +1 -1
- package/dist/{chunk-ZB5VMGKB.js → chunk-MV5DIE2T.js} +15 -4
- package/dist/chunk-MV5DIE2T.js.map +1 -0
- package/dist/chunk-NDI4HLQE.js +41 -0
- package/dist/chunk-NDI4HLQE.js.map +1 -0
- package/dist/{chunk-B4GNSSHU.js → chunk-NLJEQZQQ.js} +3 -3
- package/dist/{chunk-B4GNSSHU.js.map → chunk-NLJEQZQQ.js.map} +1 -1
- package/dist/{chunk-SBZJGFZ6.js → chunk-QHT4DCXE.js} +8 -7
- package/dist/chunk-QHT4DCXE.js.map +1 -0
- package/dist/{chunk-I4IJOLNA.js → chunk-RMUBCTEF.js} +5 -5
- package/dist/{chunk-I4IJOLNA.js.map → chunk-RMUBCTEF.js.map} +1 -1
- package/dist/{chunk-G3AD3NJG.js → chunk-RNTDM3RP.js} +9 -5
- package/dist/chunk-RNTDM3RP.js.map +1 -0
- package/dist/chunk-RPFN6ETQ.js +509 -0
- package/dist/chunk-RPFN6ETQ.js.map +1 -0
- package/dist/{chunk-HWBFRDX7.js → chunk-SI7C3W5M.js} +28 -9
- package/dist/chunk-SI7C3W5M.js.map +1 -0
- package/dist/chunk-TPOV3OCC.js +234 -0
- package/dist/chunk-TPOV3OCC.js.map +1 -0
- package/dist/{chunk-IANYMDKH.js → chunk-UBQ54W46.js} +4 -4
- package/dist/chunk-UBQ54W46.js.map +1 -0
- package/dist/{chunk-QVOBLRCM.js → chunk-UIKQ4X6W.js} +3 -3
- package/dist/{chunk-QVOBLRCM.js.map → chunk-UIKQ4X6W.js.map} +1 -1
- package/dist/chunk-UOWQH53N.js +70 -0
- package/dist/chunk-UOWQH53N.js.map +1 -0
- package/dist/{chunk-QRNQQIQM.js → chunk-WJUY6YWF.js} +52 -20
- package/dist/chunk-WJUY6YWF.js.map +1 -0
- package/dist/{chunk-3KARNPW4.js → chunk-WKIUMLRT.js} +3 -3
- package/dist/{chunk-3KARNPW4.js.map → chunk-WKIUMLRT.js.map} +1 -1
- package/dist/chunk-X6RB74JN.js +37 -0
- package/dist/chunk-X6RB74JN.js.map +1 -0
- package/dist/chunk-XQ6L2CM5.js +83 -0
- package/dist/chunk-XQ6L2CM5.js.map +1 -0
- package/dist/{chunk-RKCUXOU2.js → chunk-YUVKROMA.js} +44 -7
- package/dist/chunk-YUVKROMA.js.map +1 -0
- package/dist/components/action-icon/action-icon.d.ts +9 -2
- package/dist/components/action-icon/action-icon.d.ts.map +1 -1
- package/dist/components/action-icon/index.js +5 -1
- package/dist/components/alert/index.js +4 -4
- package/dist/components/anchor/anchor.d.ts +45 -0
- package/dist/components/anchor/anchor.d.ts.map +1 -0
- package/dist/components/anchor/index.d.ts +2 -0
- package/dist/components/anchor/index.d.ts.map +1 -0
- package/dist/components/anchor/index.js +11 -0
- package/dist/components/anchor/index.js.map +1 -0
- package/dist/components/app-shell/app-shell.d.ts +10 -6
- package/dist/components/app-shell/app-shell.d.ts.map +1 -1
- package/dist/components/app-shell/index.js +23 -24
- package/dist/components/app-shell/index.js.map +1 -1
- package/dist/components/autocomplete/autocomplete.d.ts +1 -1
- package/dist/components/autocomplete/autocomplete.d.ts.map +1 -1
- package/dist/components/autocomplete/index.js +15 -9
- package/dist/components/autocomplete/index.js.map +1 -1
- package/dist/components/avatar/index.js +1 -1
- package/dist/components/button/button.d.ts +15 -2
- package/dist/components/button/button.d.ts.map +1 -1
- package/dist/components/button/index.js +5 -1
- package/dist/components/button-multi-select/index.js +6 -4
- package/dist/components/button-multi-select/index.js.map +1 -1
- package/dist/components/button-select/button-select-control.d.ts.map +1 -1
- package/dist/components/button-select/button-select.d.ts +2 -2
- package/dist/components/button-select/button-select.d.ts.map +1 -1
- package/dist/components/button-select/index.js +6 -4
- package/dist/components/button-select/index.js.map +1 -1
- package/dist/components/calendar/aliases.d.ts +16 -0
- package/dist/components/calendar/aliases.d.ts.map +1 -0
- package/dist/components/calendar/calendar-body.d.ts +11 -1
- package/dist/components/calendar/calendar-body.d.ts.map +1 -1
- package/dist/components/calendar/calendar.d.ts +8 -4
- package/dist/components/calendar/calendar.d.ts.map +1 -1
- package/dist/components/calendar/index.d.ts +2 -1
- package/dist/components/calendar/index.d.ts.map +1 -1
- package/dist/components/calendar/index.js +15 -5
- package/dist/components/calendar/index.js.map +1 -1
- package/dist/components/calendar-heatmap/calendar-heatmap.d.ts.map +1 -1
- package/dist/components/calendar-heatmap/index.js +85 -73
- package/dist/components/calendar-heatmap/index.js.map +1 -1
- package/dist/components/camera/index.js +16 -14
- package/dist/components/carousel/index.js +3 -3
- package/dist/components/checkbox/checkbox.d.ts.map +1 -1
- package/dist/components/checkbox/index.js +2 -2
- package/dist/components/choice-card-group/index.js +2 -2
- package/dist/components/choice-card-group/index.js.map +1 -1
- package/dist/components/circular-progress/circular-progress.d.ts +22 -11
- package/dist/components/circular-progress/circular-progress.d.ts.map +1 -1
- package/dist/components/circular-progress/index.d.ts +1 -1
- package/dist/components/circular-progress/index.d.ts.map +1 -1
- package/dist/components/circular-progress/index.js +68 -49
- package/dist/components/circular-progress/index.js.map +1 -1
- package/dist/components/clipboard/index.js +7 -3
- package/dist/components/clipboard/index.js.map +1 -1
- package/dist/components/code/code.d.ts +10 -0
- package/dist/components/code/code.d.ts.map +1 -1
- package/dist/components/code/index.js +1 -0
- package/dist/components/code/index.js.map +1 -1
- package/dist/components/code-block/chrome.js +10 -6
- package/dist/components/code-block/index.js +10 -7
- package/dist/components/code-block/index.js.map +1 -1
- package/dist/components/combobox/combobox.d.ts +5 -3
- package/dist/components/combobox/combobox.d.ts.map +1 -1
- package/dist/components/combobox/index.js +12 -7
- package/dist/components/combobox-list/combobox-list.d.ts +1 -1
- package/dist/components/combobox-list/combobox-list.d.ts.map +1 -1
- package/dist/components/combobox-list/index.js +14 -9
- package/dist/components/compare/index.js +1 -1
- package/dist/components/data-list/data-list.d.ts +96 -0
- package/dist/components/data-list/data-list.d.ts.map +1 -0
- package/dist/components/data-list/index.d.ts +2 -0
- package/dist/components/data-list/index.d.ts.map +1 -0
- package/dist/components/data-list/index.js +147 -0
- package/dist/components/data-list/index.js.map +1 -0
- package/dist/components/data-table/data-table-group.d.ts.map +1 -1
- package/dist/components/data-table/data-table-placeholder.d.ts +12 -1
- package/dist/components/data-table/data-table-placeholder.d.ts.map +1 -1
- package/dist/components/data-table/data-table-stack.d.ts.map +1 -1
- package/dist/components/data-table/data-table.d.ts +5 -2
- package/dist/components/data-table/data-table.d.ts.map +1 -1
- package/dist/components/data-table/index.js +163 -168
- package/dist/components/data-table/index.js.map +1 -1
- package/dist/components/date-picker/aliases.d.ts +16 -0
- package/dist/components/date-picker/aliases.d.ts.map +1 -1
- package/dist/components/date-picker/date-picker.d.ts +22 -8
- package/dist/components/date-picker/date-picker.d.ts.map +1 -1
- package/dist/components/date-picker/index.d.ts +2 -2
- package/dist/components/date-picker/index.d.ts.map +1 -1
- package/dist/components/date-picker/index.js +34 -28
- package/dist/components/date-picker/index.js.map +1 -1
- package/dist/components/download-button/index.js +6 -2
- package/dist/components/drawer/drawer.d.ts +7 -4
- package/dist/components/drawer/drawer.d.ts.map +1 -1
- package/dist/components/drawer/index.js +11 -6
- package/dist/components/empty-state/empty-state.d.ts +57 -0
- package/dist/components/empty-state/empty-state.d.ts.map +1 -0
- package/dist/components/empty-state/index.d.ts +2 -0
- package/dist/components/empty-state/index.d.ts.map +1 -0
- package/dist/components/empty-state/index.js +8 -0
- package/dist/components/empty-state/index.js.map +1 -0
- package/dist/components/field/field.d.ts +20 -0
- package/dist/components/field/field.d.ts.map +1 -1
- package/dist/components/field/index.js +1 -1
- package/dist/components/fieldset/fieldset.d.ts +103 -0
- package/dist/components/fieldset/fieldset.d.ts.map +1 -0
- package/dist/components/fieldset/index.d.ts +2 -0
- package/dist/components/fieldset/index.d.ts.map +1 -0
- package/dist/components/fieldset/index.js +150 -0
- package/dist/components/fieldset/index.js.map +1 -0
- package/dist/components/file-item/index.js +10 -7
- package/dist/components/file-preview/file-preview.d.ts.map +1 -1
- package/dist/components/file-preview/index.js +10 -18
- package/dist/components/file-preview/index.js.map +1 -1
- package/dist/components/file-trigger/index.js +6 -2
- package/dist/components/file-upload/file-upload.d.ts.map +1 -1
- package/dist/components/file-upload/index.js +18 -14
- package/dist/components/file-upload/index.js.map +1 -1
- package/dist/components/gallery/index.js +3 -3
- package/dist/components/geodesic/a11y.d.ts +3 -3
- package/dist/components/geodesic/a11y.d.ts.map +1 -1
- package/dist/components/hover-card/hover-card.d.ts.map +1 -1
- package/dist/components/hover-card/index.js +10 -3
- package/dist/components/hover-card/index.js.map +1 -1
- package/dist/components/image/index.js +3 -3
- package/dist/components/image-cropper/index.js +9 -6
- package/dist/components/input/index.js +2 -2
- package/dist/components/input/input.d.ts.map +1 -1
- package/dist/components/kbd/index.js +3 -3
- package/dist/components/kbd/kbd.d.ts +4 -0
- package/dist/components/kbd/kbd.d.ts.map +1 -1
- package/dist/components/lightbox/index.js +13 -11
- package/dist/components/lightbox/index.js.map +1 -1
- package/dist/components/menu/index.js +9 -5
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/menu/menu.d.ts.map +1 -1
- package/dist/components/modal/index.js +11 -6
- package/dist/components/modal/modal.d.ts +10 -4
- package/dist/components/modal/modal.d.ts.map +1 -1
- package/dist/components/multi-combobox-list/index.js +13 -9
- package/dist/components/multi-combobox-list/multi-combobox-list.d.ts +1 -1
- package/dist/components/multi-combobox-list/multi-combobox-list.d.ts.map +1 -1
- package/dist/components/multi-select/index.js +13 -10
- package/dist/components/multi-select/index.js.map +1 -1
- package/dist/components/multi-select/multi-select.d.ts +1 -1
- package/dist/components/multi-select/multi-select.d.ts.map +1 -1
- package/dist/components/nav-link/index.js +4 -4
- package/dist/components/nav-link/tanstack.js +4 -4
- package/dist/components/notification/index.js +6 -6
- package/dist/components/notification/index.js.map +1 -1
- package/dist/components/number-input/index.js +11 -7
- package/dist/components/number-input/number-input.d.ts +1 -1
- package/dist/components/number-input/number-input.d.ts.map +1 -1
- package/dist/components/overlays/dialog-parts.d.ts +10 -1
- package/dist/components/overlays/dialog-parts.d.ts.map +1 -1
- package/dist/components/overlays/index.js +13 -8
- package/dist/components/overlays/index.js.map +1 -1
- package/dist/components/pagination/index.d.ts +2 -0
- package/dist/components/pagination/index.d.ts.map +1 -0
- package/dist/components/pagination/index.js +362 -0
- package/dist/components/pagination/index.js.map +1 -0
- package/dist/components/pagination/pagination.d.ts +147 -0
- package/dist/components/pagination/pagination.d.ts.map +1 -0
- package/dist/components/password-input/index.js +6 -5
- package/dist/components/password-input/index.js.map +1 -1
- package/dist/components/password-input/password-input.d.ts +1 -1
- package/dist/components/password-input/password-input.d.ts.map +1 -1
- package/dist/components/phone-input/index.js +14 -11
- package/dist/components/phone-input/index.js.map +1 -1
- package/dist/components/phone-input/phone-input.d.ts +1 -1
- package/dist/components/phone-input/phone-input.d.ts.map +1 -1
- package/dist/components/photo-capture/index.js +19 -17
- package/dist/components/photo-capture/index.js.map +1 -1
- package/dist/components/pills-input/index.js +4 -4
- package/dist/components/pills-input/pills-input.d.ts +1 -1
- package/dist/components/pills-input/pills-input.d.ts.map +1 -1
- package/dist/components/pin-input/index.js +6 -5
- package/dist/components/pin-input/index.js.map +1 -1
- package/dist/components/pin-input/pin-input.d.ts.map +1 -1
- package/dist/components/popover/index.js +7 -2
- package/dist/components/popover/popover.d.ts +41 -16
- package/dist/components/popover/popover.d.ts.map +1 -1
- package/dist/components/progress/index.d.ts +1 -1
- package/dist/components/progress/index.d.ts.map +1 -1
- package/dist/components/progress/index.js +4 -1
- package/dist/components/progress/progress.d.ts +22 -14
- package/dist/components/progress/progress.d.ts.map +1 -1
- package/dist/components/prose/index.d.ts +2 -0
- package/dist/components/prose/index.d.ts.map +1 -0
- package/dist/components/prose/index.js +17 -0
- package/dist/components/prose/index.js.map +1 -0
- package/dist/components/prose/prose.d.ts +49 -0
- package/dist/components/prose/prose.d.ts.map +1 -0
- package/dist/components/prose/styles.css +593 -0
- package/dist/components/radio-group/index.js +9 -3
- package/dist/components/radio-group/index.js.map +1 -1
- package/dist/components/radio-group/radio-group.d.ts.map +1 -1
- package/dist/components/rating/index.js +3 -2
- package/dist/components/rating/index.js.map +1 -1
- package/dist/components/rating/rating.d.ts.map +1 -1
- package/dist/components/schedule/index.js +10 -8
- package/dist/components/schedule/index.js.map +1 -1
- package/dist/components/scroll-area/index.d.ts +2 -0
- package/dist/components/scroll-area/index.d.ts.map +1 -0
- package/dist/components/scroll-area/index.js +10 -0
- package/dist/components/scroll-area/index.js.map +1 -0
- package/dist/components/scroll-area/scroll-area.d.ts +150 -0
- package/dist/components/scroll-area/scroll-area.d.ts.map +1 -0
- package/dist/components/segment-group/index.js +2 -2
- package/dist/components/segment-group/segment-group.d.ts.map +1 -1
- package/dist/components/select/index.js +12 -8
- package/dist/components/select/select.d.ts +1 -1
- package/dist/components/select/select.d.ts.map +1 -1
- package/dist/components/slider/index.js +2 -2
- package/dist/components/slider/slider.d.ts.map +1 -1
- package/dist/components/splitter/index.d.ts +2 -0
- package/dist/components/splitter/index.d.ts.map +1 -0
- package/dist/components/splitter/index.js +373 -0
- package/dist/components/splitter/index.js.map +1 -0
- package/dist/components/splitter/splitter.d.ts +159 -0
- package/dist/components/splitter/splitter.d.ts.map +1 -0
- package/dist/components/spotlight/index.js +23 -22
- package/dist/components/spotlight/index.js.map +1 -1
- package/dist/components/spotlight/spotlight.d.ts.map +1 -1
- package/dist/components/steps/index.d.ts +4 -0
- package/dist/components/steps/index.d.ts.map +1 -0
- package/dist/components/steps/index.js +478 -0
- package/dist/components/steps/index.js.map +1 -0
- package/dist/components/steps/steps-data.d.ts +78 -0
- package/dist/components/steps/steps-data.d.ts.map +1 -0
- package/dist/components/steps/steps.d.ts +183 -0
- package/dist/components/steps/steps.d.ts.map +1 -0
- package/dist/components/switch/index.js +4 -3
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/switch/switch.d.ts.map +1 -1
- package/dist/components/table-of-contents/index.d.ts +2 -0
- package/dist/components/table-of-contents/index.d.ts.map +1 -0
- package/dist/components/table-of-contents/index.js +471 -0
- package/dist/components/table-of-contents/index.js.map +1 -0
- package/dist/components/table-of-contents/table-of-contents.d.ts +173 -0
- package/dist/components/table-of-contents/table-of-contents.d.ts.map +1 -0
- package/dist/components/tags-input/index.js +12 -9
- package/dist/components/tags-input/index.js.map +1 -1
- package/dist/components/tags-input/tags-input.d.ts +1 -1
- package/dist/components/tags-input/tags-input.d.ts.map +1 -1
- package/dist/components/text-input/index.js +2 -2
- package/dist/components/textarea/index.js +8 -6
- package/dist/components/textarea/index.js.map +1 -1
- package/dist/components/textarea/textarea.d.ts.map +1 -1
- package/dist/components/time-input/index.js +11 -9
- package/dist/components/time-input/index.js.map +1 -1
- package/dist/components/timeline/index.js +8 -1
- package/dist/components/timeline/index.js.map +1 -1
- package/dist/components/timeline/timeline.d.ts.map +1 -1
- package/dist/components/tooltip/index.js +1 -1
- package/dist/components/tooltip/tooltip.d.ts +3 -8
- package/dist/components/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/tour/conditions.d.ts +83 -0
- package/dist/components/tour/conditions.d.ts.map +1 -0
- package/dist/components/tour/create-tours.d.ts +49 -0
- package/dist/components/tour/create-tours.d.ts.map +1 -0
- package/dist/components/tour/index.d.ts +6 -0
- package/dist/components/tour/index.d.ts.map +1 -0
- package/dist/components/tour/index.js +1449 -0
- package/dist/components/tour/index.js.map +1 -0
- package/dist/components/tour/runtime.d.ts +57 -0
- package/dist/components/tour/runtime.d.ts.map +1 -0
- package/dist/components/tour/storage.d.ts +14 -0
- package/dist/components/tour/storage.d.ts.map +1 -0
- package/dist/components/tour/store.d.ts +62 -0
- package/dist/components/tour/store.d.ts.map +1 -0
- package/dist/components/tour/tour.d.ts +77 -0
- package/dist/components/tour/tour.d.ts.map +1 -0
- package/dist/components/tour/types.d.ts +680 -0
- package/dist/components/tour/types.d.ts.map +1 -0
- package/dist/components/tree/index.d.ts +3 -0
- package/dist/components/tree/index.d.ts.map +1 -0
- package/dist/components/tree/index.js +457 -0
- package/dist/components/tree/index.js.map +1 -0
- package/dist/components/tree/tree-row.d.ts +72 -0
- package/dist/components/tree/tree-row.d.ts.map +1 -0
- package/dist/components/tree/tree.d.ts +193 -0
- package/dist/components/tree/tree.d.ts.map +1 -0
- package/dist/components/tree-multi-select/index.js +31 -54
- package/dist/components/tree-multi-select/index.js.map +1 -1
- package/dist/components/tree-multi-select/tree-multi-select.d.ts +16 -1
- package/dist/components/tree-multi-select/tree-multi-select.d.ts.map +1 -1
- package/dist/components/tree-select/index.js +30 -24
- package/dist/components/tree-select/index.js.map +1 -1
- package/dist/components/tree-select/tree-popover.d.ts +20 -31
- package/dist/components/tree-select/tree-popover.d.ts.map +1 -1
- package/dist/components/tree-select/tree-select.d.ts +1 -1
- package/dist/components/tree-select/tree-select.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -8
- package/dist/index.js.map +1 -1
- package/dist/lib/date-predicates.d.ts +7 -5
- package/dist/lib/date-predicates.d.ts.map +1 -1
- package/dist/lib/date-value.d.ts +20 -0
- package/dist/lib/date-value.d.ts.map +1 -1
- package/dist/lib/floating-arrow.d.ts +53 -0
- package/dist/lib/floating-arrow.d.ts.map +1 -0
- package/dist/lib/focus-return.d.ts +53 -0
- package/dist/lib/focus-return.d.ts.map +1 -0
- package/dist/lib/meter.d.ts +104 -0
- package/dist/lib/meter.d.ts.map +1 -0
- package/dist/lib/overlay-layer.d.ts +26 -8
- package/dist/lib/overlay-layer.d.ts.map +1 -1
- package/dist/lib/pressed.d.ts +92 -0
- package/dist/lib/pressed.d.ts.map +1 -0
- package/dist/lib/tree-data.d.ts +18 -2
- package/dist/lib/tree-data.d.ts.map +1 -1
- package/dist/lib/use-pagination.d.ts +102 -0
- package/dist/lib/use-pagination.d.ts.map +1 -0
- package/dist/lib/use-scroll-spy.d.ts +126 -0
- package/dist/lib/use-scroll-spy.d.ts.map +1 -0
- package/dist/theme.css +39 -3
- package/package.json +1 -1
- package/src/as-child.contract.test.tsx +283 -1
- package/src/components/action-icon/action-icon.tsx +34 -4
- package/src/components/anchor/anchor.test.tsx +232 -0
- package/src/components/anchor/anchor.tsx +187 -0
- package/src/components/anchor/index.ts +12 -0
- package/src/components/app-shell/app-shell.test.tsx +15 -7
- package/src/components/app-shell/app-shell.tsx +27 -20
- package/src/components/autocomplete/autocomplete.tsx +11 -3
- package/src/components/button/button-pressed.test.tsx +202 -0
- package/src/components/button/button.tsx +48 -6
- package/src/components/button-select/button-select-control.tsx +2 -2
- package/src/components/button-select/button-select.tsx +22 -2
- package/src/components/calendar/aliases.tsx +28 -0
- package/src/components/calendar/calendar-body.tsx +310 -210
- package/src/components/calendar/calendar.tsx +43 -12
- package/src/components/calendar/index.ts +7 -1
- package/src/components/calendar/month-year-calendar.test.tsx +106 -0
- package/src/components/calendar-heatmap/calendar-heatmap.tsx +88 -73
- package/src/components/checkbox/checkbox.tsx +7 -2
- package/src/components/choice-card-group/choice-card-group.tsx +2 -2
- package/src/components/circular-progress/circular-progress.test.tsx +35 -0
- package/src/components/circular-progress/circular-progress.tsx +116 -59
- package/src/components/circular-progress/index.ts +1 -0
- package/src/components/code/code.test.tsx +16 -0
- package/src/components/code/code.tsx +11 -0
- package/src/components/combobox/combobox.tsx +63 -28
- package/src/components/combobox-list/combobox-list.tsx +11 -3
- package/src/components/data-list/data-list.test.tsx +149 -0
- package/src/components/data-list/data-list.tsx +268 -0
- package/src/components/data-list/index.ts +9 -0
- package/src/components/data-table/data-table-group.test.tsx +16 -0
- package/src/components/data-table/data-table-group.tsx +15 -2
- package/src/components/data-table/data-table-placeholder.tsx +28 -36
- package/src/components/data-table/data-table-stack.tsx +33 -39
- package/src/components/data-table/data-table.test.tsx +31 -0
- package/src/components/data-table/data-table.tsx +41 -42
- package/src/components/date-picker/aliases.tsx +28 -0
- package/src/components/date-picker/date-picker.test.tsx +29 -0
- package/src/components/date-picker/date-picker.tsx +164 -45
- package/src/components/date-picker/index.ts +5 -1
- package/src/components/date-picker/month-year-picker.test.tsx +362 -0
- package/src/components/drawer/drawer.test.tsx +41 -0
- package/src/components/drawer/drawer.tsx +7 -1
- package/src/components/empty-state/empty-state.test.tsx +109 -0
- package/src/components/empty-state/empty-state.tsx +180 -0
- package/src/components/empty-state/index.ts +9 -0
- package/src/components/field/field.tsx +35 -1
- package/src/components/fieldset/fieldset.test.tsx +352 -0
- package/src/components/fieldset/fieldset.tsx +268 -0
- package/src/components/fieldset/index.ts +11 -0
- package/src/components/file-preview/file-preview.test.tsx +2 -1
- package/src/components/file-preview/file-preview.tsx +7 -13
- package/src/components/file-upload/file-upload.tsx +14 -5
- package/src/components/hover-card/hover-card.tsx +5 -1
- package/src/components/input/input.tsx +12 -5
- package/src/components/kbd/kbd.test.tsx +13 -0
- package/src/components/kbd/kbd.tsx +6 -0
- package/src/components/menu/menu.tsx +6 -2
- package/src/components/modal/modal.test.tsx +41 -0
- package/src/components/modal/modal.tsx +17 -9
- package/src/components/multi-combobox-list/multi-combobox-list.tsx +11 -3
- package/src/components/multi-select/multi-select.tsx +11 -3
- package/src/components/notification/create-notifier.tsx +1 -1
- package/src/components/number-input/number-input.tsx +12 -3
- package/src/components/overlays/dialog-parts.tsx +42 -5
- package/src/components/pagination/index.ts +19 -0
- package/src/components/pagination/pagination.test.tsx +187 -0
- package/src/components/pagination/pagination.tsx +563 -0
- package/src/components/password-input/password-input.tsx +12 -3
- package/src/components/phone-input/phone-input.tsx +12 -3
- package/src/components/pills-input/pills-input.tsx +7 -2
- package/src/components/pin-input/pin-input.tsx +13 -4
- package/src/components/popover/popover.tsx +87 -17
- package/src/components/progress/index.ts +1 -0
- package/src/components/progress/progress.test.tsx +102 -0
- package/src/components/progress/progress.tsx +116 -62
- package/src/components/prose/index.ts +1 -0
- package/src/components/prose/prose.test.tsx +90 -0
- package/src/components/prose/prose.tsx +60 -0
- package/src/components/prose/styles.css +593 -0
- package/src/components/radio-group/radio-group.tsx +8 -3
- package/src/components/rating/rating.tsx +5 -2
- package/src/components/scroll-area/index.ts +18 -0
- package/src/components/scroll-area/scroll-area.test.tsx +184 -0
- package/src/components/scroll-area/scroll-area.tsx +448 -0
- package/src/components/segment-group/segment-group.tsx +2 -2
- package/src/components/select/select.tsx +37 -18
- package/src/components/slider/slider.tsx +2 -2
- package/src/components/splitter/index.ts +15 -0
- package/src/components/splitter/splitter.test.tsx +244 -0
- package/src/components/splitter/splitter.tsx +625 -0
- package/src/components/spotlight/spotlight.test.tsx +34 -26
- package/src/components/spotlight/spotlight.tsx +7 -9
- package/src/components/steps/index.ts +21 -0
- package/src/components/steps/steps-data.tsx +179 -0
- package/src/components/steps/steps.test.tsx +235 -0
- package/src/components/steps/steps.tsx +686 -0
- package/src/components/switch/switch.tsx +7 -2
- package/src/components/table-of-contents/index.ts +17 -0
- package/src/components/table-of-contents/table-of-contents.test.tsx +289 -0
- package/src/components/table-of-contents/table-of-contents.tsx +708 -0
- package/src/components/tags-input/tags-input.tsx +12 -3
- package/src/components/textarea/textarea.tsx +15 -5
- package/src/components/timeline/timeline.test.tsx +22 -0
- package/src/components/timeline/timeline.tsx +10 -1
- package/src/components/tooltip/tooltip.tsx +8 -17
- package/src/components/tour/conditions.test.ts +527 -0
- package/src/components/tour/conditions.ts +445 -0
- package/src/components/tour/create-tours.tsx +150 -0
- package/src/components/tour/index.ts +86 -0
- package/src/components/tour/runtime.ts +187 -0
- package/src/components/tour/storage.test.ts +68 -0
- package/src/components/tour/storage.ts +44 -0
- package/src/components/tour/store.test.tsx +784 -0
- package/src/components/tour/store.ts +661 -0
- package/src/components/tour/tour.test.tsx +318 -0
- package/src/components/tour/tour.tsx +773 -0
- package/src/components/tour/tour.types.test.ts +185 -0
- package/src/components/tour/types.ts +904 -0
- package/src/components/tree/index.ts +24 -0
- package/src/components/tree/tree-row.tsx +179 -0
- package/src/components/tree/tree.test.tsx +296 -0
- package/src/components/tree/tree.tsx +796 -0
- package/src/components/tree-multi-select/tree-multi-select.tsx +29 -58
- package/src/components/tree-select/tree-popover.tsx +26 -107
- package/src/components/tree-select/tree-select.tsx +24 -16
- package/src/icon-stroke.test.tsx +2 -0
- package/src/index.ts +16 -0
- package/src/lib/date-predicates.test.ts +46 -0
- package/src/lib/date-predicates.ts +44 -24
- package/src/lib/date-value.test.ts +24 -1
- package/src/lib/date-value.ts +42 -1
- package/src/lib/floating-arrow.tsx +73 -0
- package/src/lib/focus-return.test.tsx +143 -0
- package/src/lib/focus-return.ts +106 -0
- package/src/lib/meter.test.ts +40 -0
- package/src/lib/meter.ts +159 -0
- package/src/lib/overlay-layer.test.tsx +47 -1
- package/src/lib/overlay-layer.tsx +65 -8
- package/src/lib/pressed.ts +130 -0
- package/src/lib/tree-data.ts +42 -2
- package/src/lib/use-pagination.test.ts +105 -0
- package/src/lib/use-pagination.ts +179 -0
- package/src/lib/use-scroll-spy.test.tsx +238 -0
- package/src/lib/use-scroll-spy.ts +336 -0
- package/src/theme.css +39 -3
- package/src/theme.test.ts +29 -1
- package/src/visually-hidden-containment.test.tsx +9 -0
- package/dist/chunk-2W7H43WL.js.map +0 -1
- package/dist/chunk-7E7JNWOC.js.map +0 -1
- package/dist/chunk-7FPSQBWB.js.map +0 -1
- package/dist/chunk-7KFUFAVP.js.map +0 -1
- package/dist/chunk-AKXALCUN.js.map +0 -1
- package/dist/chunk-B5YHYI7E.js.map +0 -1
- package/dist/chunk-FQJNQW3G.js.map +0 -1
- package/dist/chunk-G3AD3NJG.js.map +0 -1
- package/dist/chunk-GEZYGBXY.js.map +0 -1
- package/dist/chunk-HCHGERDB.js.map +0 -1
- package/dist/chunk-HWBFRDX7.js.map +0 -1
- package/dist/chunk-I4B3N3UX.js.map +0 -1
- package/dist/chunk-IA6DCC3N.js.map +0 -1
- package/dist/chunk-IANYMDKH.js.map +0 -1
- package/dist/chunk-MQHD3EJE.js.map +0 -1
- package/dist/chunk-NNPSBC7O.js.map +0 -1
- package/dist/chunk-OXR7BXZA.js.map +0 -1
- package/dist/chunk-QKSLDQM2.js +0 -120
- package/dist/chunk-QKSLDQM2.js.map +0 -1
- package/dist/chunk-QRNQQIQM.js.map +0 -1
- package/dist/chunk-RKCUXOU2.js.map +0 -1
- package/dist/chunk-S5CQRCTF.js +0 -426
- package/dist/chunk-S5CQRCTF.js.map +0 -1
- package/dist/chunk-SBZJGFZ6.js.map +0 -1
- package/dist/chunk-SP6LCCTZ.js.map +0 -1
- package/dist/chunk-TUP7WXQE.js.map +0 -1
- package/dist/chunk-V2QZG4IT.js.map +0 -1
- package/dist/chunk-X6DESK37.js.map +0 -1
- package/dist/chunk-ZB5VMGKB.js.map +0 -1
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { fireEvent, render, screen } from "@testing-library/react"
|
|
2
|
+
import { useState } from "react"
|
|
3
|
+
import { afterEach, describe, expect, it, vi } from "vitest"
|
|
4
|
+
import { ActionIcon } from "../action-icon/action-icon"
|
|
5
|
+
import { Button } from "./button"
|
|
6
|
+
|
|
7
|
+
afterEach(() => vi.restoreAllMocks())
|
|
8
|
+
|
|
9
|
+
describe("Button pressed (toggle)", () => {
|
|
10
|
+
it("leaves a plain button untouched", () => {
|
|
11
|
+
render(<Button>Save</Button>)
|
|
12
|
+
const button = screen.getByRole("button", { name: "Save" })
|
|
13
|
+
expect(button.hasAttribute("aria-pressed")).toBe(false)
|
|
14
|
+
expect(button.hasAttribute("data-pressed")).toBe(false)
|
|
15
|
+
expect(button.getAttribute("data-variant")).toBe("filled")
|
|
16
|
+
fireEvent.click(button)
|
|
17
|
+
expect(button.hasAttribute("aria-pressed")).toBe(false)
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
it("flips aria-pressed and the variant on click, uncontrolled", () => {
|
|
21
|
+
const onPressedChange = vi.fn()
|
|
22
|
+
render(<Button onPressedChange={onPressedChange}>Bold</Button>)
|
|
23
|
+
const button = screen.getByRole("button", { name: "Bold" })
|
|
24
|
+
expect(button.getAttribute("aria-pressed")).toBe("false")
|
|
25
|
+
expect(button.getAttribute("data-variant")).toBe("light")
|
|
26
|
+
|
|
27
|
+
fireEvent.click(button)
|
|
28
|
+
expect(button.getAttribute("aria-pressed")).toBe("true")
|
|
29
|
+
expect(button.hasAttribute("data-pressed")).toBe(true)
|
|
30
|
+
expect(button.getAttribute("data-variant")).toBe("filled")
|
|
31
|
+
expect(onPressedChange).toHaveBeenLastCalledWith(true)
|
|
32
|
+
|
|
33
|
+
fireEvent.click(button)
|
|
34
|
+
expect(button.getAttribute("aria-pressed")).toBe("false")
|
|
35
|
+
expect(onPressedChange).toHaveBeenLastCalledWith(false)
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
it("starts from defaultPressed", () => {
|
|
39
|
+
render(<Button defaultPressed>Bold</Button>)
|
|
40
|
+
expect(screen.getByRole("button").getAttribute("aria-pressed")).toBe("true")
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
it("follows `pressed` when controlled, and only reports clicks", () => {
|
|
44
|
+
const onPressedChange = vi.fn()
|
|
45
|
+
const { rerender } = render(
|
|
46
|
+
<Button pressed={false} onPressedChange={onPressedChange}>
|
|
47
|
+
Mute
|
|
48
|
+
</Button>,
|
|
49
|
+
)
|
|
50
|
+
const button = screen.getByRole("button")
|
|
51
|
+
fireEvent.click(button)
|
|
52
|
+
expect(onPressedChange).toHaveBeenCalledWith(true)
|
|
53
|
+
expect(button.getAttribute("aria-pressed")).toBe("false")
|
|
54
|
+
|
|
55
|
+
rerender(
|
|
56
|
+
<Button pressed onPressedChange={onPressedChange}>
|
|
57
|
+
Mute
|
|
58
|
+
</Button>,
|
|
59
|
+
)
|
|
60
|
+
expect(button.getAttribute("aria-pressed")).toBe("true")
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
it("works as a controlled toggle with state", () => {
|
|
64
|
+
const Controlled = () => {
|
|
65
|
+
const [muted, setMuted] = useState(false)
|
|
66
|
+
return (
|
|
67
|
+
<Button pressed={muted} onPressedChange={setMuted}>
|
|
68
|
+
{muted ? "Unmute" : "Mute"}
|
|
69
|
+
</Button>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
render(<Controlled />)
|
|
73
|
+
fireEvent.click(screen.getByRole("button", { name: "Mute" }))
|
|
74
|
+
expect(screen.getByRole("button", { name: "Unmute" }).getAttribute("aria-pressed")).toBe("true")
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
it("uses variant and pressedVariant when given", () => {
|
|
78
|
+
render(
|
|
79
|
+
<Button variant="outline" pressedVariant="light" defaultPressed={false}>
|
|
80
|
+
Archived
|
|
81
|
+
</Button>,
|
|
82
|
+
)
|
|
83
|
+
const button = screen.getByRole("button")
|
|
84
|
+
expect(button.getAttribute("data-variant")).toBe("outline")
|
|
85
|
+
fireEvent.click(button)
|
|
86
|
+
expect(button.getAttribute("data-variant")).toBe("light")
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
it("keeps the state when the consumer's onClick prevents default", () => {
|
|
90
|
+
render(
|
|
91
|
+
<Button defaultPressed={false} onClick={(event) => event.preventDefault()}>
|
|
92
|
+
Bold
|
|
93
|
+
</Button>,
|
|
94
|
+
)
|
|
95
|
+
const button = screen.getByRole("button")
|
|
96
|
+
fireEvent.click(button)
|
|
97
|
+
expect(button.getAttribute("aria-pressed")).toBe("false")
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
it("never flips while loading, and keeps the pressed look", () => {
|
|
101
|
+
const onPressedChange = vi.fn()
|
|
102
|
+
render(
|
|
103
|
+
<Button defaultPressed loading onPressedChange={onPressedChange}>
|
|
104
|
+
Bold
|
|
105
|
+
</Button>,
|
|
106
|
+
)
|
|
107
|
+
const button = screen.getByRole("button")
|
|
108
|
+
fireEvent.click(button)
|
|
109
|
+
expect(onPressedChange).not.toHaveBeenCalled()
|
|
110
|
+
expect(button.getAttribute("aria-pressed")).toBe("true")
|
|
111
|
+
expect(button.getAttribute("data-variant")).toBe("filled")
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
it("never flips while disabled, even under asChild", () => {
|
|
115
|
+
const onPressedChange = vi.fn()
|
|
116
|
+
render(
|
|
117
|
+
<Button asChild defaultPressed disabled onPressedChange={onPressedChange}>
|
|
118
|
+
<span data-testid="custom">Bold</span>
|
|
119
|
+
</Button>,
|
|
120
|
+
)
|
|
121
|
+
const button = screen.getByTestId("custom")
|
|
122
|
+
fireEvent.click(button)
|
|
123
|
+
expect(onPressedChange).not.toHaveBeenCalled()
|
|
124
|
+
expect(button.getAttribute("aria-pressed")).toBe("true")
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
it("hands the pressed state to an asChild child", () => {
|
|
128
|
+
render(
|
|
129
|
+
<Button asChild defaultPressed={false}>
|
|
130
|
+
<span data-testid="custom">Bold</span>
|
|
131
|
+
</Button>,
|
|
132
|
+
)
|
|
133
|
+
const button = screen.getByTestId("custom")
|
|
134
|
+
expect(button.tagName).toBe("SPAN")
|
|
135
|
+
expect(button.getAttribute("aria-pressed")).toBe("false")
|
|
136
|
+
fireEvent.click(button)
|
|
137
|
+
expect(button.getAttribute("aria-pressed")).toBe("true")
|
|
138
|
+
expect(button.getAttribute("data-variant")).toBe("filled")
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
it("ignores the pressed props on an asChild link, with a dev warning", () => {
|
|
142
|
+
const warn = vi.spyOn(console, "warn").mockImplementation(() => {})
|
|
143
|
+
render(
|
|
144
|
+
<Button asChild pressed>
|
|
145
|
+
<a href="/archive">Archive</a>
|
|
146
|
+
</Button>,
|
|
147
|
+
)
|
|
148
|
+
const link = screen.getByRole("link")
|
|
149
|
+
expect(link.hasAttribute("aria-pressed")).toBe(false)
|
|
150
|
+
expect(link.getAttribute("data-variant")).toBe("filled")
|
|
151
|
+
expect(warn).toHaveBeenCalledWith(expect.stringContaining("aria-pressed has no meaning"))
|
|
152
|
+
})
|
|
153
|
+
})
|
|
154
|
+
|
|
155
|
+
describe("ActionIcon pressed (toggle)", () => {
|
|
156
|
+
it("leaves a plain ActionIcon untouched", () => {
|
|
157
|
+
render(<ActionIcon aria-label="Star">*</ActionIcon>)
|
|
158
|
+
const button = screen.getByRole("button")
|
|
159
|
+
expect(button.hasAttribute("aria-pressed")).toBe(false)
|
|
160
|
+
expect(button.getAttribute("data-variant")).toBe("default")
|
|
161
|
+
})
|
|
162
|
+
|
|
163
|
+
it("toggles between light and filled by default", () => {
|
|
164
|
+
const onPressedChange = vi.fn()
|
|
165
|
+
render(
|
|
166
|
+
<ActionIcon aria-label="Bold" onPressedChange={onPressedChange}>
|
|
167
|
+
B
|
|
168
|
+
</ActionIcon>,
|
|
169
|
+
)
|
|
170
|
+
const button = screen.getByRole("button", { name: "Bold" })
|
|
171
|
+
expect(button.getAttribute("aria-pressed")).toBe("false")
|
|
172
|
+
expect(button.getAttribute("data-variant")).toBe("light")
|
|
173
|
+
fireEvent.click(button)
|
|
174
|
+
expect(button.getAttribute("aria-pressed")).toBe("true")
|
|
175
|
+
expect(button.getAttribute("data-variant")).toBe("filled")
|
|
176
|
+
expect(onPressedChange).toHaveBeenCalledWith(true)
|
|
177
|
+
})
|
|
178
|
+
|
|
179
|
+
it("never flips while loading", () => {
|
|
180
|
+
const onPressedChange = vi.fn()
|
|
181
|
+
render(
|
|
182
|
+
<ActionIcon aria-label="Bold" loading onPressedChange={onPressedChange}>
|
|
183
|
+
B
|
|
184
|
+
</ActionIcon>,
|
|
185
|
+
)
|
|
186
|
+
fireEvent.click(screen.getByRole("button"))
|
|
187
|
+
expect(onPressedChange).not.toHaveBeenCalled()
|
|
188
|
+
})
|
|
189
|
+
})
|
|
190
|
+
|
|
191
|
+
describe("pressed types", () => {
|
|
192
|
+
it("forbids href, with the reason, even through a spread", () => {
|
|
193
|
+
const linkProps = { href: "/archive" }
|
|
194
|
+
const elements = [
|
|
195
|
+
// @ts-expect-error a Button renders a <button>: aria-pressed has no meaning on a link
|
|
196
|
+
<Button key="literal" pressed href="/archive" />,
|
|
197
|
+
// @ts-expect-error the same through a spread, where an omitted key would pass silently
|
|
198
|
+
<ActionIcon key="spread" aria-label="Archive" pressed {...linkProps} />,
|
|
199
|
+
]
|
|
200
|
+
expect(elements).toHaveLength(2)
|
|
201
|
+
})
|
|
202
|
+
})
|
|
@@ -8,6 +8,7 @@ import { buttonColorVariants } from "../../lib/button-colors"
|
|
|
8
8
|
import { cn } from "../../lib/cn"
|
|
9
9
|
import type { Color } from "../../lib/colors"
|
|
10
10
|
import { focusStyles } from "../../lib/focus-styles"
|
|
11
|
+
import { type ForbidHref, isLinkElement, type PressedProps, usePressed } from "../../lib/pressed"
|
|
11
12
|
import { props } from "../../lib/props"
|
|
12
13
|
import type { WithTestId } from "../../lib/test-id"
|
|
13
14
|
import { Spinner } from "../spinner/spinner"
|
|
@@ -70,6 +71,18 @@ import { Spinner } from "../spinner/spinner"
|
|
|
70
71
|
* element, which `disabled` doesn't affect. `cursor-progress` and the hover
|
|
71
72
|
* suppression are keyed off `data-loading` rather than `:disabled`, which
|
|
72
73
|
* never matches a non-form element like an `<a>`.
|
|
74
|
+
*
|
|
75
|
+
* `pressed` / `defaultPressed` / `onPressedChange` make it a toggle button
|
|
76
|
+
* (`lib/pressed.ts`): `aria-pressed`, a click that flips the state, and the
|
|
77
|
+
* look swapping from `variant` to `pressedVariant` — `ButtonSelect`'s
|
|
78
|
+
* `variant` / `selectedVariant` swap, with the same `light` / `filled`
|
|
79
|
+
* defaults. Nothing else changes, so a pressed button keeps every other
|
|
80
|
+
* behaviour: `loading` and `disabled` still block the click (and so the
|
|
81
|
+
* flip) and keep the pressed look, and under `asChild` the attribute, the
|
|
82
|
+
* click and the classes all land on the child. A link child is the one
|
|
83
|
+
* exception: `aria-pressed` means nothing on a link, so the pressed props are
|
|
84
|
+
* ignored there with a dev warning, and `href` is typed out of Button
|
|
85
|
+
* altogether (`ForbidHref`).
|
|
73
86
|
*/
|
|
74
87
|
const buttonVariants = cva(
|
|
75
88
|
[
|
|
@@ -138,6 +151,8 @@ export type ButtonSize = NonNullable<VariantProps<typeof buttonVariants>["size"]
|
|
|
138
151
|
|
|
139
152
|
export type ButtonProps = Omit<HTMLArkProps<"button">, "color"> &
|
|
140
153
|
VariantProps<typeof buttonVariants> &
|
|
154
|
+
PressedProps<ButtonVariant> &
|
|
155
|
+
ForbidHref &
|
|
141
156
|
WithTestId & {
|
|
142
157
|
/** Accent palette. Re-exported as `Color` from `@42/ui-react`. */
|
|
143
158
|
color?: Color
|
|
@@ -252,6 +267,10 @@ export const Button = ({
|
|
|
252
267
|
asChild,
|
|
253
268
|
testId,
|
|
254
269
|
onClick,
|
|
270
|
+
pressed: pressedProp,
|
|
271
|
+
defaultPressed,
|
|
272
|
+
onPressedChange,
|
|
273
|
+
pressedVariant,
|
|
255
274
|
...rest
|
|
256
275
|
}: ButtonProps) => {
|
|
257
276
|
const loading = loadingProp ?? false
|
|
@@ -262,17 +281,34 @@ export const Button = ({
|
|
|
262
281
|
// the label.
|
|
263
282
|
const morph = !loadable ? null : startSlot ? "start" : endSlot ? "end" : "label"
|
|
264
283
|
const resolvedDisabled = disabled || loading
|
|
265
|
-
const
|
|
284
|
+
const toggle = usePressed({
|
|
285
|
+
pressed: pressedProp,
|
|
286
|
+
defaultPressed,
|
|
287
|
+
onPressedChange,
|
|
288
|
+
disabled: resolvedDisabled,
|
|
289
|
+
onClick: loading ? preventWhileLoading : onClick,
|
|
290
|
+
link: Boolean(asChild) && isLinkElement(children),
|
|
291
|
+
component: "Button",
|
|
292
|
+
})
|
|
293
|
+
const pressed = toggle.pressed
|
|
294
|
+
// A toggle swaps between ButtonSelect's pair; a plain button keeps `variant`.
|
|
295
|
+
const resolvedVariant = toggle.toggle
|
|
296
|
+
? pressed
|
|
297
|
+
? (pressedVariant ?? "filled")
|
|
298
|
+
: (variant ?? "light")
|
|
299
|
+
: variant
|
|
266
300
|
const content = (own: ReactNode) => (
|
|
267
301
|
<>
|
|
268
302
|
{startSlot && (
|
|
269
|
-
<HiddenSlot
|
|
303
|
+
<HiddenSlot
|
|
304
|
+
className={cn(startSlotVariants({ size }), resolvedVariant === "link" && "ms-0")}
|
|
305
|
+
>
|
|
270
306
|
{morph === "start" ? <LoadingSlot loading={loading}>{startSlot}</LoadingSlot> : startSlot}
|
|
271
307
|
</HiddenSlot>
|
|
272
308
|
)}
|
|
273
309
|
{morph === "label" ? <LoadingLabel loading={loading}>{own}</LoadingLabel> : own}
|
|
274
310
|
{endSlot && (
|
|
275
|
-
<HiddenSlot className={cn(endSlotVariants({ size }),
|
|
311
|
+
<HiddenSlot className={cn(endSlotVariants({ size }), resolvedVariant === "link" && "me-0")}>
|
|
276
312
|
{morph === "end" ? <LoadingSlot loading={loading}>{endSlot}</LoadingSlot> : endSlot}
|
|
277
313
|
</HiddenSlot>
|
|
278
314
|
)}
|
|
@@ -285,14 +321,20 @@ export const Button = ({
|
|
|
285
321
|
type={asChild ? type : (type ?? "button")}
|
|
286
322
|
disabled={resolvedDisabled}
|
|
287
323
|
data-color={color}
|
|
288
|
-
data-variant={
|
|
324
|
+
data-variant={resolvedVariant ?? "filled"}
|
|
289
325
|
data-size={size ?? "md"}
|
|
290
|
-
className={cn(
|
|
291
|
-
|
|
326
|
+
className={cn(
|
|
327
|
+
buttonVariants({ variant: resolvedVariant, size }),
|
|
328
|
+
morph === "label" && "relative",
|
|
329
|
+
className,
|
|
330
|
+
)}
|
|
331
|
+
onClick={toggle.onClick}
|
|
332
|
+
aria-pressed={toggle.toggle ? pressed : undefined}
|
|
292
333
|
{...props({
|
|
293
334
|
"aria-busy": loading,
|
|
294
335
|
"aria-disabled": resolvedDisabled,
|
|
295
336
|
"data-loading": loading,
|
|
337
|
+
"data-pressed": pressed,
|
|
296
338
|
"data-testid": testId,
|
|
297
339
|
})}
|
|
298
340
|
{...rest}
|
|
@@ -5,7 +5,7 @@ import { cn } from "../../lib/cn"
|
|
|
5
5
|
import type { Color } from "../../lib/colors"
|
|
6
6
|
import type { WithTestId } from "../../lib/test-id"
|
|
7
7
|
import type { ButtonSize, ButtonVariant } from "../button/button"
|
|
8
|
-
import { type FieldProps, FieldShell } from "../field/field"
|
|
8
|
+
import { type FieldProps, FieldShell, useInheritedInvalid } from "../field/field"
|
|
9
9
|
import { HiddenInputs, Item, RootBase } from "./button-select"
|
|
10
10
|
import {
|
|
11
11
|
type ButtonSelectData,
|
|
@@ -98,7 +98,7 @@ export const ButtonSelectControl = ({
|
|
|
98
98
|
}) => {
|
|
99
99
|
// Red state is driven independently of the `Field` error slot so a form
|
|
100
100
|
// library can flip it from `fieldState.invalid` (see FormControlProps).
|
|
101
|
-
const isInvalid = invalid || error != null
|
|
101
|
+
const isInvalid = useInheritedInvalid(invalid || error != null)
|
|
102
102
|
const items = data.map(normalizeButtonSelectItem)
|
|
103
103
|
|
|
104
104
|
return (
|
|
@@ -20,7 +20,7 @@ import type { WithTestId } from "../../lib/test-id"
|
|
|
20
20
|
import { useUncontrolled } from "../../lib/use-uncontrolled"
|
|
21
21
|
import { Button, type ButtonProps, type ButtonSize, type ButtonVariant } from "../button/button"
|
|
22
22
|
import { buttonGroupVariants } from "../button-group/button-group"
|
|
23
|
-
import { fieldA11yProps } from "../field/field"
|
|
23
|
+
import { fieldA11yProps, useInheritedDisabled } from "../field/field"
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* ButtonSelect / ButtonMultiSelect — compound parts.
|
|
@@ -157,6 +157,7 @@ export const RootBase = ({
|
|
|
157
157
|
selectedVariant = "filled",
|
|
158
158
|
size = "md",
|
|
159
159
|
invalid,
|
|
160
|
+
disabled,
|
|
160
161
|
grow,
|
|
161
162
|
loopFocus = true,
|
|
162
163
|
className,
|
|
@@ -171,6 +172,9 @@ export const RootBase = ({
|
|
|
171
172
|
deselectable?: boolean
|
|
172
173
|
}) => {
|
|
173
174
|
const field = useFieldContext()
|
|
175
|
+
// zag's toggle group reads neither a `Field` nor a `<fieldset>`: without this
|
|
176
|
+
// its root stays a tab stop in a disabled group.
|
|
177
|
+
const isDisabled = useInheritedDisabled(disabled)
|
|
174
178
|
// Owned here so a change can be compared with the current value: in a
|
|
175
179
|
// non-deselectable single group the machine re-emits the same value when the
|
|
176
180
|
// selected item is clicked again, and that is not a change.
|
|
@@ -184,6 +188,10 @@ export const RootBase = ({
|
|
|
184
188
|
<ButtonSelectStyleContext.Provider value={{ variant, selectedVariant, size }}>
|
|
185
189
|
<Ark.Root
|
|
186
190
|
multiple={multiple}
|
|
191
|
+
disabled={isDisabled}
|
|
192
|
+
// zag keeps the root a tab stop even when disabled, and focus parks on
|
|
193
|
+
// it with no enabled item to forward to.
|
|
194
|
+
tabIndex={isDisabled ? -1 : undefined}
|
|
187
195
|
value={selected}
|
|
188
196
|
onValueChange={(details) => {
|
|
189
197
|
if (!sameValues(details.value, selected)) setSelected(details.value)
|
|
@@ -261,7 +269,19 @@ export const MultiRoot = ({ onChange, ...rest }: ButtonMultiSelectRootProps) =>
|
|
|
261
269
|
type SelectableControlProps = { variant?: ButtonVariant; size?: ButtonSize }
|
|
262
270
|
|
|
263
271
|
export type ButtonSelectItemProps =
|
|
264
|
-
| (Omit<
|
|
272
|
+
| (Omit<
|
|
273
|
+
ButtonProps,
|
|
274
|
+
| "value"
|
|
275
|
+
| "variant"
|
|
276
|
+
| "size"
|
|
277
|
+
| "loading"
|
|
278
|
+
| "asChild"
|
|
279
|
+
// The group owns the selection: an item is never a toggle of its own.
|
|
280
|
+
| "pressed"
|
|
281
|
+
| "defaultPressed"
|
|
282
|
+
| "onPressedChange"
|
|
283
|
+
| "pressedVariant"
|
|
284
|
+
> & {
|
|
265
285
|
/** The value this item selects. */
|
|
266
286
|
value: string
|
|
267
287
|
asChild?: false
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Calendar, type CalendarProps } from "./calendar"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Named presets of `Calendar`, the inline forms of `MonthPicker` / `YearPicker` — the same split
|
|
5
|
+
* `Calendar` / `DatePicker` already have. Each pins `minView` (and `YearCalendar` its `maxView`)
|
|
6
|
+
* with no markup of its own; the value is the picked month's or year's first day.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/** The props that only mean something on a day grid. */
|
|
10
|
+
type DayOnlyProps = "minView" | "numOfMonths" | "renderDay" | "fixedWeeks" | "withWeekNumbers"
|
|
11
|
+
|
|
12
|
+
export type MonthCalendarProps<Range extends boolean = false> = Omit<
|
|
13
|
+
CalendarProps<Range>,
|
|
14
|
+
DayOnlyProps
|
|
15
|
+
>
|
|
16
|
+
/** `MonthCalendar` === `<Calendar minView="month" />`: an inline month grid whose pick is the value. */
|
|
17
|
+
export const MonthCalendar = <Range extends boolean = false>(props: MonthCalendarProps<Range>) => (
|
|
18
|
+
<Calendar<Range> {...props} minView="month" />
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
export type YearCalendarProps<Range extends boolean = false> = Omit<
|
|
22
|
+
CalendarProps<Range>,
|
|
23
|
+
DayOnlyProps | "maxView"
|
|
24
|
+
>
|
|
25
|
+
/** `YearCalendar` === `<Calendar minView="year" maxView="year" />`: an inline decade of years. */
|
|
26
|
+
export const YearCalendar = <Range extends boolean = false>(props: YearCalendarProps<Range>) => (
|
|
27
|
+
<Calendar<Range> {...props} minView="year" maxView="year" />
|
|
28
|
+
)
|