@42-central/ui-react 0.29.1 → 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/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/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,184 @@
|
|
|
1
|
+
import { act, fireEvent, render, screen } from "@testing-library/react"
|
|
2
|
+
import { createRef } from "react"
|
|
3
|
+
import { afterEach, describe, expect, it, vi } from "vitest"
|
|
4
|
+
import { ScrollArea } from "./scroll-area"
|
|
5
|
+
|
|
6
|
+
afterEach(() => {
|
|
7
|
+
document.body.innerHTML = ""
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
const content = <p>Lorem ipsum</p>
|
|
11
|
+
|
|
12
|
+
describe("ScrollArea", () => {
|
|
13
|
+
it("puts testId on the frame and suffixed ids on every part", () => {
|
|
14
|
+
render(<ScrollArea testId="list">{content}</ScrollArea>)
|
|
15
|
+
for (const id of [
|
|
16
|
+
"list",
|
|
17
|
+
"list-viewport",
|
|
18
|
+
"list-content",
|
|
19
|
+
"list-scrollbar-y",
|
|
20
|
+
"list-thumb-y",
|
|
21
|
+
"list-scrollbar-x",
|
|
22
|
+
"list-thumb-x",
|
|
23
|
+
"list-corner",
|
|
24
|
+
]) {
|
|
25
|
+
expect(screen.getByTestId(id), id).toBeTruthy()
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
/** The kit's bars replace the browser's: with both, a mouse user saw two scrollbars. */
|
|
30
|
+
it("hides the browser's own scrollbar on the viewport", () => {
|
|
31
|
+
render(<ScrollArea testId="a">{content}</ScrollArea>)
|
|
32
|
+
const viewport = screen.getByTestId("a-viewport")
|
|
33
|
+
expect(viewport.className).toContain("[scrollbar-width:none]")
|
|
34
|
+
expect(viewport.className).toContain("[&::-webkit-scrollbar]:hidden")
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
it("renders its children inside the content", () => {
|
|
38
|
+
render(<ScrollArea testId="a">{content}</ScrollArea>)
|
|
39
|
+
expect(screen.getByTestId("a-content").textContent).toBe("Lorem ipsum")
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
it("renders only the bars of the enabled axes, and clips the other one", () => {
|
|
43
|
+
const { rerender } = render(
|
|
44
|
+
<ScrollArea testId="a" scrollbars="y">
|
|
45
|
+
{content}
|
|
46
|
+
</ScrollArea>,
|
|
47
|
+
)
|
|
48
|
+
expect(screen.queryByTestId("a-scrollbar-x")).toBeNull()
|
|
49
|
+
expect(screen.queryByTestId("a-corner")).toBeNull()
|
|
50
|
+
expect(screen.getByTestId("a-scrollbar-y").dataset["orientation"]).toBe("vertical")
|
|
51
|
+
expect(screen.getByTestId("a-viewport").style.overflow).toBe("hidden auto")
|
|
52
|
+
|
|
53
|
+
rerender(
|
|
54
|
+
<ScrollArea testId="a" scrollbars="x">
|
|
55
|
+
{content}
|
|
56
|
+
</ScrollArea>,
|
|
57
|
+
)
|
|
58
|
+
expect(screen.queryByTestId("a-scrollbar-y")).toBeNull()
|
|
59
|
+
expect(screen.getByTestId("a-scrollbar-x").dataset["orientation"]).toBe("horizontal")
|
|
60
|
+
expect(screen.getByTestId("a-viewport").style.overflow).toBe("auto hidden")
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
it("forwards viewportRef to the scroller", () => {
|
|
64
|
+
const ref = createRef<HTMLDivElement>()
|
|
65
|
+
render(
|
|
66
|
+
<ScrollArea testId="a" viewportRef={ref}>
|
|
67
|
+
{content}
|
|
68
|
+
</ScrollArea>,
|
|
69
|
+
)
|
|
70
|
+
expect(ref.current).toBe(screen.getByTestId("a-viewport"))
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
it("reports the scroll position, and keeps the machine's own scroll handling", async () => {
|
|
74
|
+
const onScrollPositionChange = vi.fn()
|
|
75
|
+
render(
|
|
76
|
+
<ScrollArea testId="a" onScrollPositionChange={onScrollPositionChange}>
|
|
77
|
+
{content}
|
|
78
|
+
</ScrollArea>,
|
|
79
|
+
)
|
|
80
|
+
const viewport = screen.getByTestId("a-viewport")
|
|
81
|
+
expect(viewport.hasAttribute("data-at-top")).toBe(true)
|
|
82
|
+
viewport.scrollTop = 40
|
|
83
|
+
viewport.scrollLeft = 12
|
|
84
|
+
fireEvent.scroll(viewport)
|
|
85
|
+
// The machine applies its context update after the event.
|
|
86
|
+
await act(() => new Promise((resolve) => setTimeout(resolve, 0)))
|
|
87
|
+
expect(onScrollPositionChange).toHaveBeenCalledWith({ x: 12, y: 40 })
|
|
88
|
+
// The machine's own handler still ran: it no longer reports the top edge.
|
|
89
|
+
expect(viewport.hasAttribute("data-at-top")).toBe(false)
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
it("keeps the viewport keyboard-reachable and never presentational", () => {
|
|
93
|
+
render(<ScrollArea testId="a">{content}</ScrollArea>)
|
|
94
|
+
const viewport = screen.getByTestId("a-viewport")
|
|
95
|
+
// jsdom has no layout, so the machine's initial "overflows" state stands.
|
|
96
|
+
expect(viewport.tabIndex).toBe(0)
|
|
97
|
+
expect(viewport.getAttribute("role")).toBeNull()
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
it("lets a caller's tabIndex win, for a viewport whose widget owns focus", () => {
|
|
101
|
+
render(
|
|
102
|
+
<ScrollArea.Root>
|
|
103
|
+
<ScrollArea.Viewport testId="v" tabIndex={-1}>
|
|
104
|
+
<ScrollArea.Content>{content}</ScrollArea.Content>
|
|
105
|
+
</ScrollArea.Viewport>
|
|
106
|
+
</ScrollArea.Root>,
|
|
107
|
+
)
|
|
108
|
+
expect(screen.getByTestId("v").tabIndex).toBe(-1)
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
it("makes a named viewport a region landmark", () => {
|
|
112
|
+
render(
|
|
113
|
+
<ScrollArea testId="a" aria-label="Activity">
|
|
114
|
+
{content}
|
|
115
|
+
</ScrollArea>,
|
|
116
|
+
)
|
|
117
|
+
expect(screen.getByRole("region", { name: "Activity" })).toBe(screen.getByTestId("a-viewport"))
|
|
118
|
+
expect(screen.getByTestId("a").hasAttribute("aria-label")).toBe(false)
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
it("shows the bars per type", () => {
|
|
122
|
+
const { rerender } = render(
|
|
123
|
+
<ScrollArea testId="a" type="always">
|
|
124
|
+
{content}
|
|
125
|
+
</ScrollArea>,
|
|
126
|
+
)
|
|
127
|
+
expect(screen.getByTestId("a-scrollbar-y").dataset["state"]).toBe("visible")
|
|
128
|
+
rerender(
|
|
129
|
+
<ScrollArea testId="a" type="auto">
|
|
130
|
+
{content}
|
|
131
|
+
</ScrollArea>,
|
|
132
|
+
)
|
|
133
|
+
expect(screen.getByTestId("a-scrollbar-y").dataset["state"]).toBe("visible")
|
|
134
|
+
rerender(
|
|
135
|
+
<ScrollArea testId="a" type="scroll">
|
|
136
|
+
{content}
|
|
137
|
+
</ScrollArea>,
|
|
138
|
+
)
|
|
139
|
+
expect(screen.getByTestId("a-scrollbar-y").dataset["state"]).toBe("hidden")
|
|
140
|
+
expect(screen.getByTestId("a").dataset["type"]).toBe("scroll")
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
it("sets the scrollbar thickness from a size or pixels", () => {
|
|
144
|
+
const { rerender } = render(<ScrollArea testId="a">{content}</ScrollArea>)
|
|
145
|
+
expect(screen.getByTestId("a").style.getPropertyValue("--scroll-area-size")).toBe("10px")
|
|
146
|
+
rerender(
|
|
147
|
+
<ScrollArea testId="a" size={16}>
|
|
148
|
+
{content}
|
|
149
|
+
</ScrollArea>,
|
|
150
|
+
)
|
|
151
|
+
expect(screen.getByTestId("a").style.getPropertyValue("--scroll-area-size")).toBe("16px")
|
|
152
|
+
})
|
|
153
|
+
|
|
154
|
+
it("reserves a gutter per offsetScrollbars mode, on the inline end", () => {
|
|
155
|
+
const viewportClass = (offset: boolean | "x" | "y" | "present") => {
|
|
156
|
+
const { unmount } = render(
|
|
157
|
+
<ScrollArea testId="o" offsetScrollbars={offset}>
|
|
158
|
+
{content}
|
|
159
|
+
</ScrollArea>,
|
|
160
|
+
)
|
|
161
|
+
const { className } = screen.getByTestId("o-viewport")
|
|
162
|
+
unmount()
|
|
163
|
+
return className
|
|
164
|
+
}
|
|
165
|
+
expect(viewportClass(false)).not.toContain("(--scroll-area-size)")
|
|
166
|
+
expect(viewportClass(true)).toContain("pe-(--scroll-area-size)")
|
|
167
|
+
expect(viewportClass(true)).toContain("pb-(--scroll-area-size)")
|
|
168
|
+
expect(viewportClass("y")).not.toContain("pb-")
|
|
169
|
+
expect(viewportClass("present")).toContain("data-overflow-y:pe-(--scroll-area-size)")
|
|
170
|
+
})
|
|
171
|
+
|
|
172
|
+
it("draws the fade with pure lengths, never a percentage calc", () => {
|
|
173
|
+
render(
|
|
174
|
+
<ScrollArea testId="a" fade>
|
|
175
|
+
{content}
|
|
176
|
+
</ScrollArea>,
|
|
177
|
+
)
|
|
178
|
+
const { style } = screen.getByTestId("a-viewport")
|
|
179
|
+
const mask = style.getPropertyValue("mask-image") || style.maskImage
|
|
180
|
+
expect(mask).toContain("var(--scroll-area-overflow-y-start, 0px)")
|
|
181
|
+
expect(mask).not.toContain("calc(")
|
|
182
|
+
expect(mask).not.toContain("%")
|
|
183
|
+
})
|
|
184
|
+
})
|
|
@@ -0,0 +1,448 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { ark, type HTMLArkProps, mergeProps } from "@ark-ui/react"
|
|
4
|
+
import { useLocaleContext } from "@ark-ui/react/locale"
|
|
5
|
+
import { ScrollArea as Ark, useScrollAreaContext } from "@ark-ui/react/scroll-area"
|
|
6
|
+
import {
|
|
7
|
+
type CSSProperties,
|
|
8
|
+
createContext,
|
|
9
|
+
type ReactNode,
|
|
10
|
+
type Ref,
|
|
11
|
+
type UIEvent,
|
|
12
|
+
useContext,
|
|
13
|
+
} from "react"
|
|
14
|
+
import { match } from "ts-pattern"
|
|
15
|
+
import type { NoAsChild } from "../../lib/as-child"
|
|
16
|
+
import { cn } from "../../lib/cn"
|
|
17
|
+
import { focusStyles } from "../../lib/focus-styles"
|
|
18
|
+
import { useDirectionCheck } from "../../lib/intl"
|
|
19
|
+
import { useMergedRefs } from "../../lib/merge-refs"
|
|
20
|
+
import { props } from "../../lib/props"
|
|
21
|
+
import type { Size } from "../../lib/sizes"
|
|
22
|
+
import type { WithTestId } from "../../lib/test-id"
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* When the scrollbars show.
|
|
26
|
+
*
|
|
27
|
+
* - `auto`: whenever the content overflows on that axis, like a classic desktop scrollbar.
|
|
28
|
+
* - `hover`: while the pointer is over the area or it is scrolling (the default).
|
|
29
|
+
* - `scroll`: only while it is scrolling, like a touch device.
|
|
30
|
+
* - `always`: always, even when nothing overflows (the track stays, without a thumb).
|
|
31
|
+
*/
|
|
32
|
+
export type ScrollAreaType = "auto" | "hover" | "scroll" | "always"
|
|
33
|
+
|
|
34
|
+
/** Which axes scroll: `x` (horizontal), `y` (vertical) or both. */
|
|
35
|
+
export type ScrollAreaScrollbars = "x" | "y" | "xy"
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Which axes keep a gutter the width of their scrollbar, so content never sits under the bar.
|
|
39
|
+
* `true` follows `scrollbars`, `x`/`y` pick one axis, and `present` keeps a gutter only on an axis
|
|
40
|
+
* that currently overflows.
|
|
41
|
+
*/
|
|
42
|
+
export type ScrollAreaOffset = boolean | "x" | "y" | "present"
|
|
43
|
+
|
|
44
|
+
/** The scrollbar's thickness: a kit size or a pixel count. */
|
|
45
|
+
export type ScrollAreaSize = Size | number
|
|
46
|
+
|
|
47
|
+
export type ScrollPosition = { x: number; y: number }
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Scrollbar thickness per size, track padding included. The thumb is the track minus 4px
|
|
51
|
+
* (`p-0.5` on each side), so `md` draws a 6px thumb in a 10px hit area.
|
|
52
|
+
*/
|
|
53
|
+
const SIZE_PX: Record<Size, number> = { xs: 6, sm: 8, md: 10, lg: 12, xl: 14 }
|
|
54
|
+
|
|
55
|
+
type ScrollAreaConfig = {
|
|
56
|
+
type: ScrollAreaType
|
|
57
|
+
scrollbars: ScrollAreaScrollbars
|
|
58
|
+
offsetScrollbars: ScrollAreaOffset
|
|
59
|
+
fade: boolean
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const ScrollAreaConfigContext = createContext<ScrollAreaConfig>({
|
|
63
|
+
type: "hover",
|
|
64
|
+
scrollbars: "xy",
|
|
65
|
+
offsetScrollbars: false,
|
|
66
|
+
fade: false,
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* The viewport's `overflow`, per enabled axes. It overrides the machine's own inline
|
|
71
|
+
* `overflow: auto` through the same `style` key; a class could never beat an inline style.
|
|
72
|
+
*/
|
|
73
|
+
const OVERFLOW: Record<ScrollAreaScrollbars, CSSProperties["overflow"]> = {
|
|
74
|
+
xy: "auto",
|
|
75
|
+
x: "auto hidden",
|
|
76
|
+
y: "hidden auto",
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The gutter, per offset mode. Padding on the viewport (the scroller) rather than on the
|
|
81
|
+
* content: the bars overlay the viewport, so its padding box is what has to clear them. The
|
|
82
|
+
* vertical bar sits on the inline end in both directions, hence `pe`, not `pr`. `present` reads
|
|
83
|
+
* the machine's `data-overflow-*`, which the viewport carries, so an axis that fits keeps no gap.
|
|
84
|
+
*/
|
|
85
|
+
const OFFSET = {
|
|
86
|
+
x: "pb-(--scroll-area-size)",
|
|
87
|
+
y: "pe-(--scroll-area-size)",
|
|
88
|
+
presentX: "data-overflow-x:pb-(--scroll-area-size)",
|
|
89
|
+
presentY: "data-overflow-y:pe-(--scroll-area-size)",
|
|
90
|
+
} as const
|
|
91
|
+
|
|
92
|
+
const offsetClasses = (offset: ScrollAreaOffset, scrollbars: ScrollAreaScrollbars) => {
|
|
93
|
+
const hasX = scrollbars !== "y"
|
|
94
|
+
const hasY = scrollbars !== "x"
|
|
95
|
+
return match(offset)
|
|
96
|
+
.with(false, () => [])
|
|
97
|
+
.with(true, () => [hasX && OFFSET.x, hasY && OFFSET.y])
|
|
98
|
+
.with("x", () => [hasX && OFFSET.x])
|
|
99
|
+
.with("y", () => [hasY && OFFSET.y])
|
|
100
|
+
.with("present", () => [hasX && OFFSET.presentX, hasY && OFFSET.presentY])
|
|
101
|
+
.exhaustive()
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* One gradient per edge, intersected. Each edge fades in over the distance already scrolled
|
|
106
|
+
* from it (the machine writes those as `--scroll-area-overflow-*` lengths on the viewport),
|
|
107
|
+
* capped at `--scroll-area-fade`, so an edge you're resting against stays sharp and a fade
|
|
108
|
+
* grows in as you leave it.
|
|
109
|
+
*
|
|
110
|
+
* Every stop is a pure length: `min()` of two lengths, never `calc(100% - …)`. A
|
|
111
|
+
* percentage-plus-length `calc()` in a gradient can void the whole `mask-image` with no error,
|
|
112
|
+
* so the far edge gets its own gradient drawn from that edge (`to top`, `to left`) instead of a
|
|
113
|
+
* stop at `100% - fade`. Gradients have no logical direction, so the inline edges swap in RTL.
|
|
114
|
+
*/
|
|
115
|
+
const fadeStop = (edge: string) =>
|
|
116
|
+
`min(var(--scroll-area-overflow-${edge}, 0px), var(--scroll-area-fade, 2rem))`
|
|
117
|
+
|
|
118
|
+
const fadeMask = (dir: "ltr" | "rtl"): CSSProperties => {
|
|
119
|
+
const [inlineStart, inlineEnd] = dir === "rtl" ? ["left", "right"] : ["right", "left"]
|
|
120
|
+
const image = [
|
|
121
|
+
`linear-gradient(to bottom, transparent, #000 ${fadeStop("y-start")})`,
|
|
122
|
+
`linear-gradient(to top, transparent, #000 ${fadeStop("y-end")})`,
|
|
123
|
+
`linear-gradient(to ${inlineStart}, transparent, #000 ${fadeStop("x-start")})`,
|
|
124
|
+
`linear-gradient(to ${inlineEnd}, transparent, #000 ${fadeStop("x-end")})`,
|
|
125
|
+
].join(", ")
|
|
126
|
+
return { maskImage: image, maskComposite: "intersect" }
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export type ScrollAreaRootProps = HTMLArkProps<"div"> &
|
|
130
|
+
WithTestId & {
|
|
131
|
+
/** When the scrollbars show. @default "hover" */
|
|
132
|
+
type?: ScrollAreaType
|
|
133
|
+
/** Which axes scroll. A disabled axis clips instead. @default "xy" */
|
|
134
|
+
scrollbars?: ScrollAreaScrollbars
|
|
135
|
+
/** The scrollbar's thickness: a kit size or pixels. @default "md" */
|
|
136
|
+
size?: ScrollAreaSize
|
|
137
|
+
/** Keep a gutter the width of the scrollbar, so content never sits under it. @default false */
|
|
138
|
+
offsetScrollbars?: ScrollAreaOffset
|
|
139
|
+
/** Fade the content out at each edge that has more to scroll to. @default false */
|
|
140
|
+
fade?: boolean
|
|
141
|
+
ref?: Ref<HTMLDivElement>
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* The frame: positions the scrollbars over the viewport and holds the scroll machine. Size it
|
|
146
|
+
* here: a fixed `h-*`, or a `max-h-*` so it grows with its content up to a cap (Mantine's
|
|
147
|
+
* `ScrollArea.Autosize`). It clips (`overflow-hidden`), so as a flex or grid item it shrinks
|
|
148
|
+
* below its content without a `min-h-0` of its own.
|
|
149
|
+
*/
|
|
150
|
+
const ScrollAreaRoot = ({
|
|
151
|
+
type = "hover",
|
|
152
|
+
scrollbars = "xy",
|
|
153
|
+
size = "md",
|
|
154
|
+
offsetScrollbars = false,
|
|
155
|
+
fade = false,
|
|
156
|
+
className,
|
|
157
|
+
style,
|
|
158
|
+
testId,
|
|
159
|
+
ref,
|
|
160
|
+
...rest
|
|
161
|
+
}: ScrollAreaRootProps) => {
|
|
162
|
+
const checkDirection = useDirectionCheck()
|
|
163
|
+
const mergedRef = useMergedRefs(ref, checkDirection)
|
|
164
|
+
const px = typeof size === "number" ? size : SIZE_PX[size]
|
|
165
|
+
return (
|
|
166
|
+
<ScrollAreaConfigContext.Provider value={{ type, scrollbars, offsetScrollbars, fade }}>
|
|
167
|
+
<Ark.Root
|
|
168
|
+
ref={mergedRef}
|
|
169
|
+
data-type={type}
|
|
170
|
+
{...props({ "data-testid": testId })}
|
|
171
|
+
{...rest}
|
|
172
|
+
style={{ "--scroll-area-size": `${px}px`, ...style } as CSSProperties}
|
|
173
|
+
className={cn("flex flex-col overflow-hidden", className)}
|
|
174
|
+
/>
|
|
175
|
+
</ScrollAreaConfigContext.Provider>
|
|
176
|
+
)
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export type ScrollAreaViewportProps = NoAsChild<HTMLArkProps<"div">> &
|
|
180
|
+
WithTestId & { ref?: Ref<HTMLDivElement> }
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* The scroller. It is focusable whenever it overflows on an enabled axis, so the keyboard can
|
|
184
|
+
* scroll it (axe `scrollable-region-focusable`), and its focus ring is drawn on a non-scrolling
|
|
185
|
+
* overlay after it: a ring on the scroller itself is a box-shadow painted under its own content.
|
|
186
|
+
*
|
|
187
|
+
* Named (`aria-label` / `aria-labelledby`), it becomes a `region` landmark. Unnamed, it stays a
|
|
188
|
+
* plain focusable scroller: the machine's `role="presentation"` is dropped, because a focusable
|
|
189
|
+
* element can't be presentational.
|
|
190
|
+
*
|
|
191
|
+
* `isolate` keeps the content's own `z-index`es (a sticky header's `z-10`) inside the viewport,
|
|
192
|
+
* so the scrollbars, painted after it, always stay on top.
|
|
193
|
+
*
|
|
194
|
+
* A caller's `tabIndex` wins over the automatic one, for a viewport inside a composite widget
|
|
195
|
+
* (a listbox) whose own focus owner already scrolls it.
|
|
196
|
+
*
|
|
197
|
+
* `NoAsChild`: it renders the focus overlay beside the scroller.
|
|
198
|
+
*/
|
|
199
|
+
const ScrollAreaViewport = ({
|
|
200
|
+
asChild: _asChild,
|
|
201
|
+
className,
|
|
202
|
+
style,
|
|
203
|
+
testId,
|
|
204
|
+
ref,
|
|
205
|
+
...rest
|
|
206
|
+
}: ScrollAreaViewportProps) => {
|
|
207
|
+
const api = useScrollAreaContext()
|
|
208
|
+
const { scrollbars, offsetScrollbars, fade } = useContext(ScrollAreaConfigContext)
|
|
209
|
+
const { dir } = useLocaleContext()
|
|
210
|
+
// The machine's own viewport props, minus the two it gets wrong for us: `role`, and a
|
|
211
|
+
// `tabIndex` it only sets when *both* axes overflow.
|
|
212
|
+
const { role: _role, tabIndex: _tabIndex, ...machine } = api.getViewportProps()
|
|
213
|
+
const overflows =
|
|
214
|
+
(scrollbars !== "y" && api.hasOverflowX) || (scrollbars !== "x" && api.hasOverflowY)
|
|
215
|
+
const named = rest["aria-label"] != null || rest["aria-labelledby"] != null
|
|
216
|
+
// `mergeProps` chains the machine's `onScroll` with a caller's instead of replacing it.
|
|
217
|
+
const merged = mergeProps(machine, rest, {
|
|
218
|
+
style: { overflow: OVERFLOW[scrollbars], ...(fade ? fadeMask(dir) : {}), ...style },
|
|
219
|
+
})
|
|
220
|
+
return (
|
|
221
|
+
<>
|
|
222
|
+
<ark.div
|
|
223
|
+
{...merged}
|
|
224
|
+
{...props({ "data-testid": testId })}
|
|
225
|
+
ref={ref}
|
|
226
|
+
// A scroll region must be reachable by keyboard (axe `scrollable-region-focusable`),
|
|
227
|
+
// unless the caller says otherwise: a listbox's viewport is scrolled by the widget
|
|
228
|
+
// that owns focus (the input, the trigger), so it passes `tabIndex={-1}`.
|
|
229
|
+
tabIndex={rest.tabIndex ?? (overflows ? 0 : undefined)}
|
|
230
|
+
role={named ? "region" : undefined}
|
|
231
|
+
className={cn(
|
|
232
|
+
"peer isolate min-h-0 flex-auto rounded-[inherit] focus-visible:outline-none",
|
|
233
|
+
// The browser's own scrollbar stays hidden: the kit's bars replace it. zag only sets
|
|
234
|
+
// `overflow`, and theme.css's global `scrollbar-color` turns the native bar on in
|
|
235
|
+
// Chromium, so without this the viewport drew both. `scrollbar-width` covers Chromium,
|
|
236
|
+
// Firefox and Safari 18.2+; the WebKit pseudo-element covers older Safari.
|
|
237
|
+
"[scrollbar-width:none] [&::-webkit-scrollbar]:hidden",
|
|
238
|
+
offsetClasses(offsetScrollbars, scrollbars),
|
|
239
|
+
className,
|
|
240
|
+
)}
|
|
241
|
+
/>
|
|
242
|
+
<span
|
|
243
|
+
aria-hidden="true"
|
|
244
|
+
className={cn(
|
|
245
|
+
"pointer-events-none absolute inset-0 z-1 rounded-[inherit]",
|
|
246
|
+
focusStyles({ source: "peer-focus-visible", inset: true, offset: false }),
|
|
247
|
+
)}
|
|
248
|
+
/>
|
|
249
|
+
</>
|
|
250
|
+
)
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export type ScrollAreaContentProps = HTMLArkProps<"div"> & WithTestId
|
|
254
|
+
|
|
255
|
+
/** Wraps the scrolled content, so the machine can watch its size. */
|
|
256
|
+
const ScrollAreaContent = ({ testId, ...rest }: ScrollAreaContentProps) => (
|
|
257
|
+
<Ark.Content {...props({ "data-testid": testId })} {...rest} />
|
|
258
|
+
)
|
|
259
|
+
|
|
260
|
+
export type ScrollAreaScrollbarProps = HTMLArkProps<"div"> &
|
|
261
|
+
WithTestId & {
|
|
262
|
+
/** Which axis this bar scrolls. @default "vertical" */
|
|
263
|
+
orientation?: "vertical" | "horizontal"
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* One scrollbar track; put a `ScrollArea.Thumb` inside. The vertical bar sits on the inline
|
|
268
|
+
* end, so it moves to the left in RTL. Its visibility follows the root's `type`, through
|
|
269
|
+
* `data-state="visible" | "hidden"`; a hidden bar fades out and lets clicks through, but keeps
|
|
270
|
+
* its size, because the machine measures the track to size the thumb.
|
|
271
|
+
*/
|
|
272
|
+
const ScrollAreaScrollbar = ({
|
|
273
|
+
orientation = "vertical",
|
|
274
|
+
className,
|
|
275
|
+
testId,
|
|
276
|
+
...rest
|
|
277
|
+
}: ScrollAreaScrollbarProps) => {
|
|
278
|
+
const api = useScrollAreaContext()
|
|
279
|
+
const { type } = useContext(ScrollAreaConfigContext)
|
|
280
|
+
const { hovering, scrolling, hidden } = api.getScrollbarState({ orientation })
|
|
281
|
+
const visible = match(type)
|
|
282
|
+
.with("always", () => true)
|
|
283
|
+
.with("auto", () => !hidden)
|
|
284
|
+
.with("hover", () => !hidden && (hovering || scrolling))
|
|
285
|
+
.with("scroll", () => !hidden && scrolling)
|
|
286
|
+
.exhaustive()
|
|
287
|
+
return (
|
|
288
|
+
<Ark.Scrollbar
|
|
289
|
+
orientation={orientation}
|
|
290
|
+
data-state={visible ? "visible" : "hidden"}
|
|
291
|
+
{...props({ "data-empty": hidden, "data-testid": testId })}
|
|
292
|
+
{...rest}
|
|
293
|
+
className={cn(
|
|
294
|
+
"group/scrollbar z-2 p-0.5 transition-opacity duration-150 motion-reduce:transition-none",
|
|
295
|
+
"data-[state=hidden]:pointer-events-none data-[state=hidden]:opacity-0",
|
|
296
|
+
"data-[orientation=vertical]:w-(--scroll-area-size) data-[orientation=horizontal]:h-(--scroll-area-size)",
|
|
297
|
+
className,
|
|
298
|
+
)}
|
|
299
|
+
/>
|
|
300
|
+
)
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
export type ScrollAreaThumbProps = HTMLArkProps<"div"> & WithTestId
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* The draggable thumb. Its length is the machine's (`--thumb-height` / `--thumb-width`); it
|
|
307
|
+
* hides on a track whose axis doesn't overflow, which only `type="always"` ever shows.
|
|
308
|
+
*/
|
|
309
|
+
const ScrollAreaThumb = ({ className, testId, ...rest }: ScrollAreaThumbProps) => (
|
|
310
|
+
<Ark.Thumb
|
|
311
|
+
{...props({ "data-testid": testId })}
|
|
312
|
+
{...rest}
|
|
313
|
+
className={cn(
|
|
314
|
+
"rounded-full bg-brand-900/30 transition-colors duration-150 hover:bg-brand-900/50 data-dragging:bg-brand-900/50",
|
|
315
|
+
"dark:bg-white/35 dark:data-dragging:bg-white/55 dark:hover:bg-white/55",
|
|
316
|
+
"data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full",
|
|
317
|
+
"group-data-empty/scrollbar:invisible motion-reduce:transition-none",
|
|
318
|
+
className,
|
|
319
|
+
)}
|
|
320
|
+
/>
|
|
321
|
+
)
|
|
322
|
+
|
|
323
|
+
export type ScrollAreaCornerProps = HTMLArkProps<"div"> & WithTestId
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* The square where the two bars meet, so neither runs under the other. Transparent; it only
|
|
327
|
+
* exists while both axes overflow.
|
|
328
|
+
*/
|
|
329
|
+
const ScrollAreaCorner = ({ className, testId, ...rest }: ScrollAreaCornerProps) => (
|
|
330
|
+
<Ark.Corner
|
|
331
|
+
{...props({ "data-testid": testId })}
|
|
332
|
+
{...rest}
|
|
333
|
+
className={cn("data-[state=hidden]:hidden", className)}
|
|
334
|
+
/>
|
|
335
|
+
)
|
|
336
|
+
|
|
337
|
+
export type ScrollAreaClassNames = {
|
|
338
|
+
viewport?: string
|
|
339
|
+
content?: string
|
|
340
|
+
scrollbar?: string
|
|
341
|
+
thumb?: string
|
|
342
|
+
corner?: string
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
export type ScrollAreaProps = NoAsChild<Omit<ScrollAreaRootProps, "onScroll">> & {
|
|
346
|
+
/** A ref to the scroller, for programmatic scrolling (`scrollTo`, `scrollTop`, …). */
|
|
347
|
+
viewportRef?: Ref<HTMLDivElement>
|
|
348
|
+
/** Called on every scroll with the viewport's `scrollLeft` (`x`) and `scrollTop` (`y`). In
|
|
349
|
+
* RTL, `x` runs from 0 down to negative values, as the browser reports it. */
|
|
350
|
+
onScrollPositionChange?: (position: ScrollPosition) => void
|
|
351
|
+
/** Extra classes per part, merged with the kit's. */
|
|
352
|
+
classNames?: ScrollAreaClassNames
|
|
353
|
+
/** The scrolled content. */
|
|
354
|
+
children?: ReactNode
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* ScrollArea — a scroll container with the same thin, overlaid scrollbars on every OS, built
|
|
359
|
+
* on Ark's `scroll-area` machine.
|
|
360
|
+
*
|
|
361
|
+
* Give it a height (`h-64`) or a cap (`max-h-64`); content beyond it scrolls. The native
|
|
362
|
+
* scrollbars are hidden, and kit bars are drawn over the content on the inline end and the
|
|
363
|
+
* bottom, so the page looks the same on macOS, Windows and Linux.
|
|
364
|
+
*
|
|
365
|
+
* Accessibility: the viewport is the real scroller, so wheel, touch, keyboard (once focused)
|
|
366
|
+
* and find-in-page all work natively. It joins the tab order whenever it overflows. Pass
|
|
367
|
+
* `aria-label` or `aria-labelledby` and it becomes a named `region`; both go to the viewport,
|
|
368
|
+
* not the frame.
|
|
369
|
+
*
|
|
370
|
+
* `testId` lands on the frame; the parts take it with a suffix (`-viewport`, `-content`,
|
|
371
|
+
* `-scrollbar-x`, `-scrollbar-y`, `-thumb-x`, `-thumb-y`, `-corner`).
|
|
372
|
+
*
|
|
373
|
+
* ```tsx
|
|
374
|
+
* <ScrollArea className="h-64" type="auto" offsetScrollbars>
|
|
375
|
+
* <LongList />
|
|
376
|
+
* </ScrollArea>
|
|
377
|
+
* ```
|
|
378
|
+
*
|
|
379
|
+
* For a custom layout, compose `ScrollArea.Root`, `.Viewport`, `.Content`, `.Scrollbar`,
|
|
380
|
+
* `.Thumb` and `.Corner`. `NoAsChild`: it renders the whole anatomy; put `asChild` on
|
|
381
|
+
* `ScrollArea.Root` instead.
|
|
382
|
+
*/
|
|
383
|
+
const ScrollAreaComponent = ({
|
|
384
|
+
asChild: _asChild,
|
|
385
|
+
viewportRef,
|
|
386
|
+
onScrollPositionChange,
|
|
387
|
+
classNames,
|
|
388
|
+
children,
|
|
389
|
+
testId,
|
|
390
|
+
scrollbars = "xy",
|
|
391
|
+
"aria-label": ariaLabel,
|
|
392
|
+
"aria-labelledby": ariaLabelledBy,
|
|
393
|
+
...rest
|
|
394
|
+
}: ScrollAreaProps) => {
|
|
395
|
+
const part = (name: string) => (testId ? `${testId}-${name}` : undefined)
|
|
396
|
+
const handleScroll = onScrollPositionChange
|
|
397
|
+
? (event: UIEvent<HTMLDivElement>) =>
|
|
398
|
+
onScrollPositionChange({
|
|
399
|
+
x: event.currentTarget.scrollLeft,
|
|
400
|
+
y: event.currentTarget.scrollTop,
|
|
401
|
+
})
|
|
402
|
+
: undefined
|
|
403
|
+
return (
|
|
404
|
+
<ScrollAreaRoot testId={testId} scrollbars={scrollbars} {...rest}>
|
|
405
|
+
<ScrollAreaViewport
|
|
406
|
+
ref={viewportRef}
|
|
407
|
+
onScroll={handleScroll}
|
|
408
|
+
{...props({ "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy })}
|
|
409
|
+
testId={part("viewport")}
|
|
410
|
+
className={classNames?.viewport}
|
|
411
|
+
>
|
|
412
|
+
<ScrollAreaContent testId={part("content")} className={classNames?.content}>
|
|
413
|
+
{children}
|
|
414
|
+
</ScrollAreaContent>
|
|
415
|
+
</ScrollAreaViewport>
|
|
416
|
+
{scrollbars !== "x" && (
|
|
417
|
+
<ScrollAreaScrollbar
|
|
418
|
+
orientation="vertical"
|
|
419
|
+
testId={part("scrollbar-y")}
|
|
420
|
+
className={classNames?.scrollbar}
|
|
421
|
+
>
|
|
422
|
+
<ScrollAreaThumb testId={part("thumb-y")} className={classNames?.thumb} />
|
|
423
|
+
</ScrollAreaScrollbar>
|
|
424
|
+
)}
|
|
425
|
+
{scrollbars !== "y" && (
|
|
426
|
+
<ScrollAreaScrollbar
|
|
427
|
+
orientation="horizontal"
|
|
428
|
+
testId={part("scrollbar-x")}
|
|
429
|
+
className={classNames?.scrollbar}
|
|
430
|
+
>
|
|
431
|
+
<ScrollAreaThumb testId={part("thumb-x")} className={classNames?.thumb} />
|
|
432
|
+
</ScrollAreaScrollbar>
|
|
433
|
+
)}
|
|
434
|
+
{scrollbars === "xy" && (
|
|
435
|
+
<ScrollAreaCorner testId={part("corner")} className={classNames?.corner} />
|
|
436
|
+
)}
|
|
437
|
+
</ScrollAreaRoot>
|
|
438
|
+
)
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
export const ScrollArea = Object.assign(ScrollAreaComponent, {
|
|
442
|
+
Root: ScrollAreaRoot,
|
|
443
|
+
Viewport: ScrollAreaViewport,
|
|
444
|
+
Content: ScrollAreaContent,
|
|
445
|
+
Scrollbar: ScrollAreaScrollbar,
|
|
446
|
+
Thumb: ScrollAreaThumb,
|
|
447
|
+
Corner: ScrollAreaCorner,
|
|
448
|
+
})
|
|
@@ -12,7 +12,7 @@ import { props } from "../../lib/props"
|
|
|
12
12
|
import type { WithTestId } from "../../lib/test-id"
|
|
13
13
|
import { TEXT_COLOR_CLASSES } from "../../lib/typography-size"
|
|
14
14
|
import { useUncontrolled } from "../../lib/use-uncontrolled"
|
|
15
|
-
import { type FieldProps, FieldShell, fieldA11yProps } from "../field/field"
|
|
15
|
+
import { type FieldProps, FieldShell, fieldA11yProps, useInheritedInvalid } from "../field/field"
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* SegmentGroup — a segmented single-choice control on Ark UI's SegmentGroup
|
|
@@ -482,7 +482,7 @@ export const SegmentGroup = <const Data extends SegmentGroupData = SegmentGroupD
|
|
|
482
482
|
}: SegmentGroupProps<Data>) => {
|
|
483
483
|
// Red state is driven independently of the `Field` error slot so a form
|
|
484
484
|
// library can flip it from `fieldState.invalid` (see FormControlProps).
|
|
485
|
-
const isInvalid = invalid || error != null
|
|
485
|
+
const isInvalid = useInheritedInvalid(invalid || error != null)
|
|
486
486
|
|
|
487
487
|
// Own the value so the pill can read which item is selected (per-item color)
|
|
488
488
|
// and so the `key={orientation}` remount below preserves the selection.
|