@42-central/ui-react 0.29.0 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-X6DESK37.js → chunk-2RRTT4AF.js} +17 -5
- package/dist/chunk-2RRTT4AF.js.map +1 -0
- package/dist/{chunk-TUP7WXQE.js → chunk-322I2RSV.js} +9 -6
- package/dist/chunk-322I2RSV.js.map +1 -0
- package/dist/{chunk-ISX3AM32.js → chunk-37SRSNLJ.js} +4 -4
- package/dist/{chunk-ISX3AM32.js.map → chunk-37SRSNLJ.js.map} +1 -1
- package/dist/{chunk-L5GH7LLD.js → chunk-3MFWUG5O.js} +4 -4
- package/dist/{chunk-L5GH7LLD.js.map → chunk-3MFWUG5O.js.map} +1 -1
- package/dist/{chunk-FQJNQW3G.js → chunk-3XQEOJCE.js} +8 -5
- package/dist/chunk-3XQEOJCE.js.map +1 -0
- package/dist/{chunk-JKFPRQB2.js → chunk-4LSZ5JWF.js} +3 -3
- package/dist/{chunk-JKFPRQB2.js.map → chunk-4LSZ5JWF.js.map} +1 -1
- package/dist/{chunk-V2QZG4IT.js → chunk-5HWFYYHW.js} +27 -9
- package/dist/chunk-5HWFYYHW.js.map +1 -0
- package/dist/{chunk-GEZYGBXY.js → chunk-6MVFCS46.js} +99 -42
- package/dist/chunk-6MVFCS46.js.map +1 -0
- package/dist/{chunk-NNPSBC7O.js → chunk-6WZSUS3U.js} +10 -9
- package/dist/chunk-6WZSUS3U.js.map +1 -0
- package/dist/chunk-6YRGP6PS.js +138 -0
- package/dist/chunk-6YRGP6PS.js.map +1 -0
- package/dist/{chunk-B5YHYI7E.js → chunk-ALANKV5Y.js} +23 -6
- package/dist/chunk-ALANKV5Y.js.map +1 -0
- package/dist/{chunk-IA6DCC3N.js → chunk-AUQPNDE5.js} +23 -13
- package/dist/chunk-AUQPNDE5.js.map +1 -0
- package/dist/{chunk-AKXALCUN.js → chunk-D7SW2E24.js} +4 -4
- package/dist/chunk-D7SW2E24.js.map +1 -0
- package/dist/{chunk-OXR7BXZA.js → chunk-DQIYYDFD.js} +4 -3
- package/dist/chunk-DQIYYDFD.js.map +1 -0
- package/dist/{chunk-HMNXNKDA.js → chunk-FCBYUN6F.js} +4 -4
- package/dist/{chunk-HMNXNKDA.js.map → chunk-FCBYUN6F.js.map} +1 -1
- package/dist/{chunk-2W7H43WL.js → chunk-FED6SJWM.js} +23 -14
- package/dist/chunk-FED6SJWM.js.map +1 -0
- package/dist/{chunk-7E7JNWOC.js → chunk-FEPIHXVI.js} +6 -5
- package/dist/chunk-FEPIHXVI.js.map +1 -0
- package/dist/{chunk-Y57NW6G7.js → chunk-G3YOSG3U.js} +4 -4
- package/dist/{chunk-Y57NW6G7.js.map → chunk-G3YOSG3U.js.map} +1 -1
- package/dist/chunk-GZN5CXMR.js +100 -0
- package/dist/chunk-GZN5CXMR.js.map +1 -0
- package/dist/{chunk-HCHGERDB.js → chunk-HCSZPBWV.js} +17 -115
- package/dist/chunk-HCSZPBWV.js.map +1 -0
- package/dist/{chunk-I4B3N3UX.js → chunk-HTVICHT4.js} +12 -7
- package/dist/chunk-HTVICHT4.js.map +1 -0
- package/dist/chunk-I7TC2C3I.js +163 -0
- package/dist/chunk-I7TC2C3I.js.map +1 -0
- package/dist/{chunk-7FPSQBWB.js → chunk-IBXYLO2J.js} +14 -13
- package/dist/chunk-IBXYLO2J.js.map +1 -0
- package/dist/{chunk-7KFUFAVP.js → chunk-IRYG6B5A.js} +9 -8
- package/dist/chunk-IRYG6B5A.js.map +1 -0
- package/dist/{chunk-2RQLPN4U.js → chunk-JCNEW4WJ.js} +8 -8
- package/dist/{chunk-2RQLPN4U.js.map → chunk-JCNEW4WJ.js.map} +1 -1
- package/dist/{chunk-SP6LCCTZ.js → chunk-KZDMVOL6.js} +35 -8
- package/dist/chunk-KZDMVOL6.js.map +1 -0
- package/dist/chunk-LR5U6TZZ.js +169 -0
- package/dist/chunk-LR5U6TZZ.js.map +1 -0
- package/dist/{chunk-MQHD3EJE.js → chunk-LZHZJWVM.js} +6 -4
- package/dist/chunk-LZHZJWVM.js.map +1 -0
- package/dist/{chunk-5EOMSWNO.js → chunk-MAM2X3MW.js} +5 -5
- package/dist/{chunk-5EOMSWNO.js.map → chunk-MAM2X3MW.js.map} +1 -1
- package/dist/{chunk-FSPS7TVD.js → chunk-MCMS4NMO.js} +5 -5
- package/dist/{chunk-FSPS7TVD.js.map → chunk-MCMS4NMO.js.map} +1 -1
- package/dist/{chunk-ZB5VMGKB.js → chunk-MV5DIE2T.js} +15 -4
- package/dist/chunk-MV5DIE2T.js.map +1 -0
- package/dist/chunk-NDI4HLQE.js +41 -0
- package/dist/chunk-NDI4HLQE.js.map +1 -0
- package/dist/{chunk-B4GNSSHU.js → chunk-NLJEQZQQ.js} +3 -3
- package/dist/{chunk-B4GNSSHU.js.map → chunk-NLJEQZQQ.js.map} +1 -1
- package/dist/{chunk-SBZJGFZ6.js → chunk-QHT4DCXE.js} +8 -7
- package/dist/chunk-QHT4DCXE.js.map +1 -0
- package/dist/{chunk-I4IJOLNA.js → chunk-RMUBCTEF.js} +5 -5
- package/dist/{chunk-I4IJOLNA.js.map → chunk-RMUBCTEF.js.map} +1 -1
- package/dist/{chunk-G3AD3NJG.js → chunk-RNTDM3RP.js} +9 -5
- package/dist/chunk-RNTDM3RP.js.map +1 -0
- package/dist/chunk-RPFN6ETQ.js +509 -0
- package/dist/chunk-RPFN6ETQ.js.map +1 -0
- package/dist/{chunk-HWBFRDX7.js → chunk-SI7C3W5M.js} +28 -9
- package/dist/chunk-SI7C3W5M.js.map +1 -0
- package/dist/chunk-TPOV3OCC.js +234 -0
- package/dist/chunk-TPOV3OCC.js.map +1 -0
- package/dist/{chunk-IANYMDKH.js → chunk-UBQ54W46.js} +4 -4
- package/dist/chunk-UBQ54W46.js.map +1 -0
- package/dist/{chunk-QVOBLRCM.js → chunk-UIKQ4X6W.js} +3 -3
- package/dist/{chunk-QVOBLRCM.js.map → chunk-UIKQ4X6W.js.map} +1 -1
- package/dist/chunk-UOWQH53N.js +70 -0
- package/dist/chunk-UOWQH53N.js.map +1 -0
- package/dist/{chunk-QRNQQIQM.js → chunk-WJUY6YWF.js} +52 -20
- package/dist/chunk-WJUY6YWF.js.map +1 -0
- package/dist/{chunk-3KARNPW4.js → chunk-WKIUMLRT.js} +3 -3
- package/dist/{chunk-3KARNPW4.js.map → chunk-WKIUMLRT.js.map} +1 -1
- package/dist/chunk-X6RB74JN.js +37 -0
- package/dist/chunk-X6RB74JN.js.map +1 -0
- package/dist/chunk-XQ6L2CM5.js +83 -0
- package/dist/chunk-XQ6L2CM5.js.map +1 -0
- package/dist/{chunk-RKCUXOU2.js → chunk-YUVKROMA.js} +44 -7
- package/dist/chunk-YUVKROMA.js.map +1 -0
- package/dist/components/action-icon/action-icon.d.ts +9 -2
- package/dist/components/action-icon/action-icon.d.ts.map +1 -1
- package/dist/components/action-icon/index.js +5 -1
- package/dist/components/alert/index.js +4 -4
- package/dist/components/anchor/anchor.d.ts +45 -0
- package/dist/components/anchor/anchor.d.ts.map +1 -0
- package/dist/components/anchor/index.d.ts +2 -0
- package/dist/components/anchor/index.d.ts.map +1 -0
- package/dist/components/anchor/index.js +11 -0
- package/dist/components/anchor/index.js.map +1 -0
- package/dist/components/app-shell/app-shell.d.ts +10 -6
- package/dist/components/app-shell/app-shell.d.ts.map +1 -1
- package/dist/components/app-shell/index.js +23 -24
- package/dist/components/app-shell/index.js.map +1 -1
- package/dist/components/autocomplete/autocomplete.d.ts +1 -1
- package/dist/components/autocomplete/autocomplete.d.ts.map +1 -1
- package/dist/components/autocomplete/index.js +15 -9
- package/dist/components/autocomplete/index.js.map +1 -1
- package/dist/components/avatar/index.js +1 -1
- package/dist/components/button/button.d.ts +15 -2
- package/dist/components/button/button.d.ts.map +1 -1
- package/dist/components/button/index.js +5 -1
- package/dist/components/button-multi-select/index.js +6 -4
- package/dist/components/button-multi-select/index.js.map +1 -1
- package/dist/components/button-select/button-select-control.d.ts.map +1 -1
- package/dist/components/button-select/button-select.d.ts +2 -2
- package/dist/components/button-select/button-select.d.ts.map +1 -1
- package/dist/components/button-select/index.js +6 -4
- package/dist/components/button-select/index.js.map +1 -1
- package/dist/components/calendar/aliases.d.ts +16 -0
- package/dist/components/calendar/aliases.d.ts.map +1 -0
- package/dist/components/calendar/calendar-body.d.ts +11 -1
- package/dist/components/calendar/calendar-body.d.ts.map +1 -1
- package/dist/components/calendar/calendar.d.ts +8 -4
- package/dist/components/calendar/calendar.d.ts.map +1 -1
- package/dist/components/calendar/index.d.ts +2 -1
- package/dist/components/calendar/index.d.ts.map +1 -1
- package/dist/components/calendar/index.js +15 -5
- package/dist/components/calendar/index.js.map +1 -1
- package/dist/components/calendar-heatmap/calendar-heatmap.d.ts.map +1 -1
- package/dist/components/calendar-heatmap/index.js +85 -73
- package/dist/components/calendar-heatmap/index.js.map +1 -1
- package/dist/components/camera/index.js +16 -14
- package/dist/components/carousel/index.js +3 -3
- package/dist/components/checkbox/checkbox.d.ts.map +1 -1
- package/dist/components/checkbox/index.js +2 -2
- package/dist/components/choice-card-group/index.js +2 -2
- package/dist/components/choice-card-group/index.js.map +1 -1
- package/dist/components/circular-progress/circular-progress.d.ts +22 -11
- package/dist/components/circular-progress/circular-progress.d.ts.map +1 -1
- package/dist/components/circular-progress/index.d.ts +1 -1
- package/dist/components/circular-progress/index.d.ts.map +1 -1
- package/dist/components/circular-progress/index.js +68 -49
- package/dist/components/circular-progress/index.js.map +1 -1
- package/dist/components/clipboard/index.js +7 -3
- package/dist/components/clipboard/index.js.map +1 -1
- package/dist/components/code/code.d.ts +10 -0
- package/dist/components/code/code.d.ts.map +1 -1
- package/dist/components/code/index.js +1 -0
- package/dist/components/code/index.js.map +1 -1
- package/dist/components/code-block/chrome.js +10 -6
- package/dist/components/code-block/index.js +10 -7
- package/dist/components/code-block/index.js.map +1 -1
- package/dist/components/combobox/combobox.d.ts +5 -3
- package/dist/components/combobox/combobox.d.ts.map +1 -1
- package/dist/components/combobox/index.js +12 -7
- package/dist/components/combobox-list/combobox-list.d.ts +1 -1
- package/dist/components/combobox-list/combobox-list.d.ts.map +1 -1
- package/dist/components/combobox-list/index.js +14 -9
- package/dist/components/compare/index.js +1 -1
- package/dist/components/data-list/data-list.d.ts +96 -0
- package/dist/components/data-list/data-list.d.ts.map +1 -0
- package/dist/components/data-list/index.d.ts +2 -0
- package/dist/components/data-list/index.d.ts.map +1 -0
- package/dist/components/data-list/index.js +147 -0
- package/dist/components/data-list/index.js.map +1 -0
- package/dist/components/data-table/data-table-group.d.ts.map +1 -1
- package/dist/components/data-table/data-table-placeholder.d.ts +12 -1
- package/dist/components/data-table/data-table-placeholder.d.ts.map +1 -1
- package/dist/components/data-table/data-table-stack.d.ts.map +1 -1
- package/dist/components/data-table/data-table.d.ts +5 -2
- package/dist/components/data-table/data-table.d.ts.map +1 -1
- package/dist/components/data-table/index.js +163 -168
- package/dist/components/data-table/index.js.map +1 -1
- package/dist/components/date-picker/aliases.d.ts +16 -0
- package/dist/components/date-picker/aliases.d.ts.map +1 -1
- package/dist/components/date-picker/date-picker.d.ts +22 -8
- package/dist/components/date-picker/date-picker.d.ts.map +1 -1
- package/dist/components/date-picker/index.d.ts +2 -2
- package/dist/components/date-picker/index.d.ts.map +1 -1
- package/dist/components/date-picker/index.js +34 -28
- package/dist/components/date-picker/index.js.map +1 -1
- package/dist/components/download-button/index.js +6 -2
- package/dist/components/drawer/drawer.d.ts +7 -4
- package/dist/components/drawer/drawer.d.ts.map +1 -1
- package/dist/components/drawer/index.js +11 -6
- package/dist/components/empty-state/empty-state.d.ts +57 -0
- package/dist/components/empty-state/empty-state.d.ts.map +1 -0
- package/dist/components/empty-state/index.d.ts +2 -0
- package/dist/components/empty-state/index.d.ts.map +1 -0
- package/dist/components/empty-state/index.js +8 -0
- package/dist/components/empty-state/index.js.map +1 -0
- package/dist/components/field/field.d.ts +20 -0
- package/dist/components/field/field.d.ts.map +1 -1
- package/dist/components/field/index.js +1 -1
- package/dist/components/fieldset/fieldset.d.ts +103 -0
- package/dist/components/fieldset/fieldset.d.ts.map +1 -0
- package/dist/components/fieldset/index.d.ts +2 -0
- package/dist/components/fieldset/index.d.ts.map +1 -0
- package/dist/components/fieldset/index.js +150 -0
- package/dist/components/fieldset/index.js.map +1 -0
- package/dist/components/file-item/index.js +10 -7
- package/dist/components/file-preview/file-preview.d.ts.map +1 -1
- package/dist/components/file-preview/index.js +10 -18
- package/dist/components/file-preview/index.js.map +1 -1
- package/dist/components/file-trigger/index.js +6 -2
- package/dist/components/file-upload/file-upload.d.ts.map +1 -1
- package/dist/components/file-upload/index.js +18 -14
- package/dist/components/file-upload/index.js.map +1 -1
- package/dist/components/gallery/index.js +3 -3
- package/dist/components/geodesic/a11y.d.ts +3 -3
- package/dist/components/geodesic/a11y.d.ts.map +1 -1
- package/dist/components/hover-card/hover-card.d.ts.map +1 -1
- package/dist/components/hover-card/index.js +10 -3
- package/dist/components/hover-card/index.js.map +1 -1
- package/dist/components/image/index.js +3 -3
- package/dist/components/image-cropper/index.js +9 -6
- package/dist/components/input/index.js +2 -2
- package/dist/components/input/input.d.ts.map +1 -1
- package/dist/components/kbd/index.js +3 -3
- package/dist/components/kbd/kbd.d.ts +4 -0
- package/dist/components/kbd/kbd.d.ts.map +1 -1
- package/dist/components/lightbox/index.js +13 -11
- package/dist/components/lightbox/index.js.map +1 -1
- package/dist/components/menu/index.js +9 -5
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/menu/menu.d.ts.map +1 -1
- package/dist/components/modal/index.js +11 -6
- package/dist/components/modal/modal.d.ts +10 -4
- package/dist/components/modal/modal.d.ts.map +1 -1
- package/dist/components/multi-combobox-list/index.js +13 -9
- package/dist/components/multi-combobox-list/multi-combobox-list.d.ts +1 -1
- package/dist/components/multi-combobox-list/multi-combobox-list.d.ts.map +1 -1
- package/dist/components/multi-select/index.js +13 -10
- package/dist/components/multi-select/index.js.map +1 -1
- package/dist/components/multi-select/multi-select.d.ts +1 -1
- package/dist/components/multi-select/multi-select.d.ts.map +1 -1
- package/dist/components/nav-link/index.js +4 -4
- package/dist/components/nav-link/tanstack.js +4 -4
- package/dist/components/notification/index.js +6 -6
- package/dist/components/notification/index.js.map +1 -1
- package/dist/components/number-input/index.js +11 -7
- package/dist/components/number-input/number-input.d.ts +1 -1
- package/dist/components/number-input/number-input.d.ts.map +1 -1
- package/dist/components/overlays/dialog-parts.d.ts +10 -1
- package/dist/components/overlays/dialog-parts.d.ts.map +1 -1
- package/dist/components/overlays/index.js +13 -8
- package/dist/components/overlays/index.js.map +1 -1
- package/dist/components/pagination/index.d.ts +2 -0
- package/dist/components/pagination/index.d.ts.map +1 -0
- package/dist/components/pagination/index.js +362 -0
- package/dist/components/pagination/index.js.map +1 -0
- package/dist/components/pagination/pagination.d.ts +147 -0
- package/dist/components/pagination/pagination.d.ts.map +1 -0
- package/dist/components/password-input/index.js +6 -5
- package/dist/components/password-input/index.js.map +1 -1
- package/dist/components/password-input/password-input.d.ts +1 -1
- package/dist/components/password-input/password-input.d.ts.map +1 -1
- package/dist/components/phone-input/index.js +14 -11
- package/dist/components/phone-input/index.js.map +1 -1
- package/dist/components/phone-input/phone-input.d.ts +1 -1
- package/dist/components/phone-input/phone-input.d.ts.map +1 -1
- package/dist/components/photo-capture/index.js +19 -17
- package/dist/components/photo-capture/index.js.map +1 -1
- package/dist/components/pills-input/index.js +4 -4
- package/dist/components/pills-input/pills-input.d.ts +1 -1
- package/dist/components/pills-input/pills-input.d.ts.map +1 -1
- package/dist/components/pin-input/index.js +6 -5
- package/dist/components/pin-input/index.js.map +1 -1
- package/dist/components/pin-input/pin-input.d.ts.map +1 -1
- package/dist/components/popover/index.js +7 -2
- package/dist/components/popover/popover.d.ts +41 -16
- package/dist/components/popover/popover.d.ts.map +1 -1
- package/dist/components/progress/index.d.ts +1 -1
- package/dist/components/progress/index.d.ts.map +1 -1
- package/dist/components/progress/index.js +4 -1
- package/dist/components/progress/progress.d.ts +22 -14
- package/dist/components/progress/progress.d.ts.map +1 -1
- package/dist/components/prose/index.d.ts +2 -0
- package/dist/components/prose/index.d.ts.map +1 -0
- package/dist/components/prose/index.js +17 -0
- package/dist/components/prose/index.js.map +1 -0
- package/dist/components/prose/prose.d.ts +49 -0
- package/dist/components/prose/prose.d.ts.map +1 -0
- package/dist/components/prose/styles.css +593 -0
- package/dist/components/radio-group/index.js +9 -3
- package/dist/components/radio-group/index.js.map +1 -1
- package/dist/components/radio-group/radio-group.d.ts.map +1 -1
- package/dist/components/rating/index.js +3 -2
- package/dist/components/rating/index.js.map +1 -1
- package/dist/components/rating/rating.d.ts.map +1 -1
- package/dist/components/schedule/index.js +10 -8
- package/dist/components/schedule/index.js.map +1 -1
- package/dist/components/scroll-area/index.d.ts +2 -0
- package/dist/components/scroll-area/index.d.ts.map +1 -0
- package/dist/components/scroll-area/index.js +10 -0
- package/dist/components/scroll-area/index.js.map +1 -0
- package/dist/components/scroll-area/scroll-area.d.ts +150 -0
- package/dist/components/scroll-area/scroll-area.d.ts.map +1 -0
- package/dist/components/segment-group/index.js +2 -2
- package/dist/components/segment-group/segment-group.d.ts.map +1 -1
- package/dist/components/select/index.js +12 -8
- package/dist/components/select/select.d.ts +1 -1
- package/dist/components/select/select.d.ts.map +1 -1
- package/dist/components/slider/index.js +2 -2
- package/dist/components/slider/slider.d.ts.map +1 -1
- package/dist/components/splitter/index.d.ts +2 -0
- package/dist/components/splitter/index.d.ts.map +1 -0
- package/dist/components/splitter/index.js +373 -0
- package/dist/components/splitter/index.js.map +1 -0
- package/dist/components/splitter/splitter.d.ts +159 -0
- package/dist/components/splitter/splitter.d.ts.map +1 -0
- package/dist/components/spotlight/index.js +23 -22
- package/dist/components/spotlight/index.js.map +1 -1
- package/dist/components/spotlight/spotlight.d.ts.map +1 -1
- package/dist/components/steps/index.d.ts +4 -0
- package/dist/components/steps/index.d.ts.map +1 -0
- package/dist/components/steps/index.js +478 -0
- package/dist/components/steps/index.js.map +1 -0
- package/dist/components/steps/steps-data.d.ts +78 -0
- package/dist/components/steps/steps-data.d.ts.map +1 -0
- package/dist/components/steps/steps.d.ts +183 -0
- package/dist/components/steps/steps.d.ts.map +1 -0
- package/dist/components/switch/index.js +4 -3
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/switch/switch.d.ts.map +1 -1
- package/dist/components/table-of-contents/index.d.ts +2 -0
- package/dist/components/table-of-contents/index.d.ts.map +1 -0
- package/dist/components/table-of-contents/index.js +471 -0
- package/dist/components/table-of-contents/index.js.map +1 -0
- package/dist/components/table-of-contents/table-of-contents.d.ts +173 -0
- package/dist/components/table-of-contents/table-of-contents.d.ts.map +1 -0
- package/dist/components/tags-input/index.js +12 -9
- package/dist/components/tags-input/index.js.map +1 -1
- package/dist/components/tags-input/tags-input.d.ts +1 -1
- package/dist/components/tags-input/tags-input.d.ts.map +1 -1
- package/dist/components/text-input/index.js +2 -2
- package/dist/components/textarea/index.js +8 -6
- package/dist/components/textarea/index.js.map +1 -1
- package/dist/components/textarea/textarea.d.ts.map +1 -1
- package/dist/components/time-input/index.js +11 -9
- package/dist/components/time-input/index.js.map +1 -1
- package/dist/components/timeline/index.js +8 -1
- package/dist/components/timeline/index.js.map +1 -1
- package/dist/components/timeline/timeline.d.ts.map +1 -1
- package/dist/components/tooltip/index.js +1 -1
- package/dist/components/tooltip/tooltip.d.ts +3 -8
- package/dist/components/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/tour/conditions.d.ts +83 -0
- package/dist/components/tour/conditions.d.ts.map +1 -0
- package/dist/components/tour/create-tours.d.ts +49 -0
- package/dist/components/tour/create-tours.d.ts.map +1 -0
- package/dist/components/tour/index.d.ts +6 -0
- package/dist/components/tour/index.d.ts.map +1 -0
- package/dist/components/tour/index.js +1449 -0
- package/dist/components/tour/index.js.map +1 -0
- package/dist/components/tour/runtime.d.ts +57 -0
- package/dist/components/tour/runtime.d.ts.map +1 -0
- package/dist/components/tour/storage.d.ts +14 -0
- package/dist/components/tour/storage.d.ts.map +1 -0
- package/dist/components/tour/store.d.ts +62 -0
- package/dist/components/tour/store.d.ts.map +1 -0
- package/dist/components/tour/tour.d.ts +77 -0
- package/dist/components/tour/tour.d.ts.map +1 -0
- package/dist/components/tour/types.d.ts +680 -0
- package/dist/components/tour/types.d.ts.map +1 -0
- package/dist/components/tree/index.d.ts +3 -0
- package/dist/components/tree/index.d.ts.map +1 -0
- package/dist/components/tree/index.js +457 -0
- package/dist/components/tree/index.js.map +1 -0
- package/dist/components/tree/tree-row.d.ts +72 -0
- package/dist/components/tree/tree-row.d.ts.map +1 -0
- package/dist/components/tree/tree.d.ts +193 -0
- package/dist/components/tree/tree.d.ts.map +1 -0
- package/dist/components/tree-multi-select/index.js +31 -54
- package/dist/components/tree-multi-select/index.js.map +1 -1
- package/dist/components/tree-multi-select/tree-multi-select.d.ts +16 -1
- package/dist/components/tree-multi-select/tree-multi-select.d.ts.map +1 -1
- package/dist/components/tree-select/index.js +30 -24
- package/dist/components/tree-select/index.js.map +1 -1
- package/dist/components/tree-select/tree-popover.d.ts +20 -31
- package/dist/components/tree-select/tree-popover.d.ts.map +1 -1
- package/dist/components/tree-select/tree-select.d.ts +1 -1
- package/dist/components/tree-select/tree-select.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -8
- package/dist/index.js.map +1 -1
- package/dist/lib/date-predicates.d.ts +7 -5
- package/dist/lib/date-predicates.d.ts.map +1 -1
- package/dist/lib/date-value.d.ts +20 -0
- package/dist/lib/date-value.d.ts.map +1 -1
- package/dist/lib/floating-arrow.d.ts +53 -0
- package/dist/lib/floating-arrow.d.ts.map +1 -0
- package/dist/lib/focus-return.d.ts +53 -0
- package/dist/lib/focus-return.d.ts.map +1 -0
- package/dist/lib/meter.d.ts +104 -0
- package/dist/lib/meter.d.ts.map +1 -0
- package/dist/lib/overlay-layer.d.ts +26 -8
- package/dist/lib/overlay-layer.d.ts.map +1 -1
- package/dist/lib/pressed.d.ts +92 -0
- package/dist/lib/pressed.d.ts.map +1 -0
- package/dist/lib/tree-data.d.ts +18 -2
- package/dist/lib/tree-data.d.ts.map +1 -1
- package/dist/lib/use-pagination.d.ts +102 -0
- package/dist/lib/use-pagination.d.ts.map +1 -0
- package/dist/lib/use-scroll-spy.d.ts +126 -0
- package/dist/lib/use-scroll-spy.d.ts.map +1 -0
- package/dist/theme.css +39 -3
- package/package.json +1 -1
- package/src/as-child.contract.test.tsx +283 -1
- package/src/components/action-icon/action-icon.tsx +34 -4
- package/src/components/anchor/anchor.test.tsx +232 -0
- package/src/components/anchor/anchor.tsx +187 -0
- package/src/components/anchor/index.ts +12 -0
- package/src/components/app-shell/app-shell.test.tsx +15 -7
- package/src/components/app-shell/app-shell.tsx +27 -20
- package/src/components/autocomplete/autocomplete.tsx +11 -3
- package/src/components/button/button-pressed.test.tsx +202 -0
- package/src/components/button/button.tsx +48 -6
- package/src/components/button-select/button-select-control.tsx +2 -2
- package/src/components/button-select/button-select.tsx +22 -2
- package/src/components/calendar/aliases.tsx +28 -0
- package/src/components/calendar/calendar-body.tsx +310 -210
- package/src/components/calendar/calendar.tsx +43 -12
- package/src/components/calendar/index.ts +7 -1
- package/src/components/calendar/month-year-calendar.test.tsx +106 -0
- package/src/components/calendar-heatmap/calendar-heatmap.tsx +88 -73
- package/src/components/checkbox/checkbox.tsx +7 -2
- package/src/components/choice-card-group/choice-card-group.tsx +2 -2
- package/src/components/circular-progress/circular-progress.test.tsx +35 -0
- package/src/components/circular-progress/circular-progress.tsx +116 -59
- package/src/components/circular-progress/index.ts +1 -0
- package/src/components/code/code.test.tsx +16 -0
- package/src/components/code/code.tsx +11 -0
- package/src/components/combobox/combobox.tsx +63 -28
- package/src/components/combobox-list/combobox-list.tsx +11 -3
- package/src/components/data-list/data-list.test.tsx +149 -0
- package/src/components/data-list/data-list.tsx +268 -0
- package/src/components/data-list/index.ts +9 -0
- package/src/components/data-table/data-table-group.test.tsx +16 -0
- package/src/components/data-table/data-table-group.tsx +15 -2
- package/src/components/data-table/data-table-placeholder.tsx +28 -36
- package/src/components/data-table/data-table-stack.tsx +33 -39
- package/src/components/data-table/data-table.test.tsx +31 -0
- package/src/components/data-table/data-table.tsx +41 -42
- package/src/components/date-picker/aliases.tsx +28 -0
- package/src/components/date-picker/date-picker.test.tsx +29 -0
- package/src/components/date-picker/date-picker.tsx +164 -45
- package/src/components/date-picker/index.ts +5 -1
- package/src/components/date-picker/month-year-picker.test.tsx +362 -0
- package/src/components/drawer/drawer.test.tsx +41 -0
- package/src/components/drawer/drawer.tsx +7 -1
- package/src/components/empty-state/empty-state.test.tsx +109 -0
- package/src/components/empty-state/empty-state.tsx +180 -0
- package/src/components/empty-state/index.ts +9 -0
- package/src/components/field/field.tsx +35 -1
- package/src/components/fieldset/fieldset.test.tsx +352 -0
- package/src/components/fieldset/fieldset.tsx +268 -0
- package/src/components/fieldset/index.ts +11 -0
- package/src/components/file-preview/file-preview.test.tsx +2 -1
- package/src/components/file-preview/file-preview.tsx +7 -13
- package/src/components/file-upload/file-upload.tsx +14 -5
- package/src/components/hover-card/hover-card.tsx +5 -1
- package/src/components/input/input.tsx +12 -5
- package/src/components/kbd/kbd.test.tsx +13 -0
- package/src/components/kbd/kbd.tsx +6 -0
- package/src/components/menu/menu.tsx +6 -2
- package/src/components/modal/modal.test.tsx +41 -0
- package/src/components/modal/modal.tsx +17 -9
- package/src/components/multi-combobox-list/multi-combobox-list.tsx +11 -3
- package/src/components/multi-select/multi-select.tsx +11 -3
- package/src/components/notification/create-notifier.tsx +1 -1
- package/src/components/number-input/number-input.tsx +12 -3
- package/src/components/overlays/dialog-parts.tsx +42 -5
- package/src/components/pagination/index.ts +19 -0
- package/src/components/pagination/pagination.test.tsx +187 -0
- package/src/components/pagination/pagination.tsx +563 -0
- package/src/components/password-input/password-input.tsx +12 -3
- package/src/components/phone-input/phone-input.tsx +12 -3
- package/src/components/pills-input/pills-input.tsx +7 -2
- package/src/components/pin-input/pin-input.tsx +13 -4
- package/src/components/popover/popover.tsx +87 -17
- package/src/components/progress/index.ts +1 -0
- package/src/components/progress/progress.test.tsx +102 -0
- package/src/components/progress/progress.tsx +116 -62
- package/src/components/prose/index.ts +1 -0
- package/src/components/prose/prose.test.tsx +90 -0
- package/src/components/prose/prose.tsx +60 -0
- package/src/components/prose/styles.css +593 -0
- package/src/components/radio-group/radio-group.tsx +8 -3
- package/src/components/rating/rating.tsx +5 -2
- package/src/components/scroll-area/index.ts +18 -0
- package/src/components/scroll-area/scroll-area.test.tsx +184 -0
- package/src/components/scroll-area/scroll-area.tsx +448 -0
- package/src/components/segment-group/segment-group.tsx +2 -2
- package/src/components/select/select.tsx +37 -18
- package/src/components/slider/slider.tsx +2 -2
- package/src/components/splitter/index.ts +15 -0
- package/src/components/splitter/splitter.test.tsx +244 -0
- package/src/components/splitter/splitter.tsx +625 -0
- package/src/components/spotlight/spotlight.test.tsx +34 -26
- package/src/components/spotlight/spotlight.tsx +7 -9
- package/src/components/steps/index.ts +21 -0
- package/src/components/steps/steps-data.tsx +179 -0
- package/src/components/steps/steps.test.tsx +235 -0
- package/src/components/steps/steps.tsx +686 -0
- package/src/components/switch/switch.tsx +7 -2
- package/src/components/table-of-contents/index.ts +17 -0
- package/src/components/table-of-contents/table-of-contents.test.tsx +289 -0
- package/src/components/table-of-contents/table-of-contents.tsx +708 -0
- package/src/components/tags-input/tags-input.tsx +12 -3
- package/src/components/textarea/textarea.tsx +15 -5
- package/src/components/timeline/timeline.test.tsx +22 -0
- package/src/components/timeline/timeline.tsx +10 -1
- package/src/components/tooltip/tooltip.tsx +8 -17
- package/src/components/tour/conditions.test.ts +527 -0
- package/src/components/tour/conditions.ts +445 -0
- package/src/components/tour/create-tours.tsx +150 -0
- package/src/components/tour/index.ts +86 -0
- package/src/components/tour/runtime.ts +187 -0
- package/src/components/tour/storage.test.ts +68 -0
- package/src/components/tour/storage.ts +44 -0
- package/src/components/tour/store.test.tsx +784 -0
- package/src/components/tour/store.ts +661 -0
- package/src/components/tour/tour.test.tsx +318 -0
- package/src/components/tour/tour.tsx +773 -0
- package/src/components/tour/tour.types.test.ts +185 -0
- package/src/components/tour/types.ts +904 -0
- package/src/components/tree/index.ts +24 -0
- package/src/components/tree/tree-row.tsx +179 -0
- package/src/components/tree/tree.test.tsx +296 -0
- package/src/components/tree/tree.tsx +796 -0
- package/src/components/tree-multi-select/tree-multi-select.tsx +29 -58
- package/src/components/tree-select/tree-popover.tsx +26 -107
- package/src/components/tree-select/tree-select.tsx +24 -16
- package/src/icon-stroke.test.tsx +2 -0
- package/src/index.ts +16 -0
- package/src/lib/date-predicates.test.ts +46 -0
- package/src/lib/date-predicates.ts +44 -24
- package/src/lib/date-value.test.ts +24 -1
- package/src/lib/date-value.ts +42 -1
- package/src/lib/floating-arrow.tsx +73 -0
- package/src/lib/focus-return.test.tsx +143 -0
- package/src/lib/focus-return.ts +106 -0
- package/src/lib/meter.test.ts +40 -0
- package/src/lib/meter.ts +159 -0
- package/src/lib/overlay-layer.test.tsx +47 -1
- package/src/lib/overlay-layer.tsx +65 -8
- package/src/lib/pressed.ts +130 -0
- package/src/lib/tree-data.ts +42 -2
- package/src/lib/use-pagination.test.ts +105 -0
- package/src/lib/use-pagination.ts +179 -0
- package/src/lib/use-scroll-spy.test.tsx +238 -0
- package/src/lib/use-scroll-spy.ts +336 -0
- package/src/theme.css +39 -3
- package/src/theme.test.ts +29 -1
- package/src/visually-hidden-containment.test.tsx +9 -0
- package/dist/chunk-2W7H43WL.js.map +0 -1
- package/dist/chunk-7E7JNWOC.js.map +0 -1
- package/dist/chunk-7FPSQBWB.js.map +0 -1
- package/dist/chunk-7KFUFAVP.js.map +0 -1
- package/dist/chunk-AKXALCUN.js.map +0 -1
- package/dist/chunk-B5YHYI7E.js.map +0 -1
- package/dist/chunk-FQJNQW3G.js.map +0 -1
- package/dist/chunk-G3AD3NJG.js.map +0 -1
- package/dist/chunk-GEZYGBXY.js.map +0 -1
- package/dist/chunk-HCHGERDB.js.map +0 -1
- package/dist/chunk-HWBFRDX7.js.map +0 -1
- package/dist/chunk-I4B3N3UX.js.map +0 -1
- package/dist/chunk-IA6DCC3N.js.map +0 -1
- package/dist/chunk-IANYMDKH.js.map +0 -1
- package/dist/chunk-MQHD3EJE.js.map +0 -1
- package/dist/chunk-NNPSBC7O.js.map +0 -1
- package/dist/chunk-OXR7BXZA.js.map +0 -1
- package/dist/chunk-QKSLDQM2.js +0 -120
- package/dist/chunk-QKSLDQM2.js.map +0 -1
- package/dist/chunk-QRNQQIQM.js.map +0 -1
- package/dist/chunk-RKCUXOU2.js.map +0 -1
- package/dist/chunk-S5CQRCTF.js +0 -426
- package/dist/chunk-S5CQRCTF.js.map +0 -1
- package/dist/chunk-SBZJGFZ6.js.map +0 -1
- package/dist/chunk-SP6LCCTZ.js.map +0 -1
- package/dist/chunk-TUP7WXQE.js.map +0 -1
- package/dist/chunk-V2QZG4IT.js.map +0 -1
- package/dist/chunk-X6DESK37.js.map +0 -1
- package/dist/chunk-ZB5VMGKB.js.map +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { MEDIA_RADIUS } from './chunk-J43LSYQO.js';
|
|
2
|
-
import { useMergedRefs } from './chunk-HBWV5EPU.js';
|
|
3
2
|
import { ratioStyle } from './chunk-AHM6SGEU.js';
|
|
4
|
-
import {
|
|
3
|
+
import { useMergedRefs } from './chunk-HBWV5EPU.js';
|
|
5
4
|
import { mergeIcons, iconStroke } from './chunk-XXOR34T4.js';
|
|
5
|
+
import { useIsomorphicLayoutEffect } from './chunk-BUIHQJGE.js';
|
|
6
6
|
import { props } from './chunk-WYCMIIRR.js';
|
|
7
7
|
import { cn } from './chunk-4ASNIDV7.js';
|
|
8
8
|
import { match, P } from 'ts-pattern';
|
|
@@ -312,5 +312,5 @@ function Image({
|
|
|
312
312
|
}
|
|
313
313
|
|
|
314
314
|
export { IMAGE_WIDTHS, Image, resolveSources };
|
|
315
|
-
//# sourceMappingURL=chunk-
|
|
316
|
-
//# sourceMappingURL=chunk-
|
|
315
|
+
//# sourceMappingURL=chunk-G3YOSG3U.js.map
|
|
316
|
+
//# sourceMappingURL=chunk-G3YOSG3U.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/image/srcset.ts","../src/components/image/blur-svg.ts","../src/components/image/image.tsx"],"names":["loader","width","match","P"],"mappings":";;;;;;;;;;;;;;AAiBO,IAAM,YAAA,GAAe;AAAA,EAC1B,EAAA;AAAA,EAAI,EAAA;AAAA,EAAI,EAAA;AAAA,EAAI,EAAA;AAAA,EAAI,EAAA;AAAA,EAAI,GAAA;AAAA,EAAK,GAAA;AAAA,EAAK,GAAA;AAAA,EAAK,GAAA;AAAA,EAAK,GAAA;AAAA,EAAK,GAAA;AAAA,EAAK,IAAA;AAAA,EAAM,IAAA;AAAA,EAAM,IAAA;AAAA,EAAM,IAAA;AAAA,EAAM;AAC5E;AAyBO,SAAS,cAAA,CAAe;AAAA,EAC7B,GAAA;AAAA,EACA,MAAA;AAAA,EACA,KAAA;AAAA,EACA,KAAA;AAAA,EACA;AACF,CAAA,EAAiC;AAC/B,EAAA,OAAO,MAAM,EAAE,MAAA,EAAQ,KAAA,EAAO,KAAA,EAAO,CAAA,CAClC,IAAA,CAAK,EAAE,MAAA,EAAQ,EAAE,OAAA,EAAQ,EAAG,OAAO,EAAE,GAAA,GAAM,CAAA,CAC3C,IAAA,CAAK,EAAE,MAAA,EAAQ,EAAE,GAAA,CAAI,CAAA,CAAE,OAAO,CAAA,EAAG,KAAA,EAAO,EAAE,OAAA,EAAS,KAAA,EAAO,CAAA,CAAE,MAAA,IAAU,CAAC,EAAE,QAAAA,OAAAA,EAAQ,KAAA,EAAAC,QAAM,KAAM;AAC5F,IAAA,MAAM,EAAA,GAAK,CAAC,OAAA,KAAoBD,OAAAA,CAAO,EAAE,KAAK,KAAA,EAAOC,MAAAA,GAAQ,OAAA,EAAS,OAAA,EAAS,CAAA;AAC/E,IAAA,OAAO,EAAE,GAAA,EAAK,EAAA,CAAG,CAAC,GAAG,MAAA,EA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2DAAA;AAAA,kBACA;AAAA,iBACF;AAAA,gBAEC,QAAA,EAAA;AAAA;AAAA;AACH,cAEA;AAAA;AAAA;AAEJ;AAAA,GAEJ;AAEJ","file":"chunk-Y57NW6G7.js","sourcesContent":["import { match, P } from \"ts-pattern\"\n\n/**\n * Builds a CDN URL for one rendition of an image. The kit never resizes\n * anything itself: a loader maps `{ src, width, quality }` onto whatever query\n * string or path your image service expects.\n *\n * const unsplash: ImageLoader = ({ src, width, quality = 75 }) =>\n * `${src}?w=${width}&q=${quality}&auto=format`\n */\nexport type ImageLoader = (params: { src: string; width: number; quality?: number }) => string\n\n/**\n * Candidate widths for a `sizes`-driven srcset: next/image's small image sizes\n * followed by its device sizes, so a thumbnail and a full-bleed hero both land\n * near a real rendition.\n */\nexport const IMAGE_WIDTHS = [\n 16, 32, 48, 64, 96, 128, 256, 384, 640, 750, 828, 1080, 1200, 1920, 2048, 3840,\n] as const\n\nexport type ImageSources = { src: string; srcSet?: string; sizes?: string }\n\ntype ResolveOptions = {\n src: string\n loader?: ImageLoader\n width?: number\n sizes?: string\n quality?: number\n}\n\n/**\n * What the `<img>` (and its priority preload) should request.\n *\n * - No loader: the plain `src`. Without a service to ask, there are no other\n * renditions to choose from.\n * - Loader + `sizes`: `w` descriptors from `IMAGE_WIDTHS`, capped at twice\n * `width` when it's known (nothing gains from a rendition sharper than a 2x\n * screen needs). The browser picks one from `sizes`.\n * - Loader + `width`: a fixed-size image, so `1x` and `2x` are enough.\n * - Loader alone: treated as full-width (`sizes=\"100vw\"`).\n *\n * `src` is always the largest rendition, for browsers that ignore srcset.\n */\nexport function resolveSources({\n src,\n loader,\n width,\n sizes,\n quality,\n}: ResolveOptions): ImageSources {\n return match({ loader, width, sizes })\n .with({ loader: P.nullish }, () => ({ src }))\n .with({ loader: P.not(P.nullish), sizes: P.nullish, width: P.number }, ({ loader, width }) => {\n const at = (density: number) => loader({ src, width: width * density, quality })\n return { src: at(2), srcSet: `${at(1)} 1x, ${at(2)} 2x` }\n })\n .with({ loader: P.not(P.nullish) }, ({ loader }) => {\n const cap = width === undefined ? Number.POSITIVE_INFINITY : width * 2\n const fitting = IMAGE_WIDTHS.filter((w) => w <= cap)\n const widths = fitting.length > 0 ? fitting : [cap]\n const urls = widths.map((w) => ({ w, url: loader({ src, width: w, quality }) }))\n return {\n src: urls.at(-1)?.url ?? src,\n srcSet: urls.map(({ w, url }) => `${url} ${w}w`).join(\", \"),\n sizes: sizes ?? \"100vw\",\n }\n })\n .exhaustive()\n}\n","/**\n * A blurred version of a tiny `data:` placeholder, as a CSS `background-image`\n * value. Ported from next/image's `image-blur-svg.ts`: the thumbnail is drawn\n * into an SVG through an `feGaussianBlur`, so a 10px base64 image scales up\n * into a soft wash instead of a pixelated mosaic. No canvas, no dependency,\n * and it's plain CSS, so it's already painted in the server HTML.\n *\n * The middle of the filter (the `feColorMatrix` alpha boost, then compositing\n * the result over the source) keeps the edges opaque: a bare blur fades to\n * transparent near the border and the box would read as having a halo.\n *\n * With both dimensions known the SVG gets a matching viewBox and stretches to\n * fill (`preserveAspectRatio=\"none\"`), the way the image itself will. Without\n * them, the image inside the SVG follows `fit` instead.\n */\nconst BLUR = 20\n\ntype BlurOptions = {\n placeholder: string\n width?: number\n height?: number\n fit: \"cover\" | \"contain\" | \"fill\" | \"none\" | \"scale-down\"\n}\n\nconst ASPECT = {\n cover: \"xMidYMid slice\",\n contain: \"xMidYMid\",\n fill: \"none\",\n none: \"xMidYMid slice\",\n \"scale-down\": \"xMidYMid\",\n} as const\n\nexport function blurSvg({ placeholder, width, height, fit }: BlurOptions): string {\n const sized = width !== undefined && height !== undefined\n const viewBox = sized ? `viewBox='0 0 ${width} ${height}'` : \"\"\n const aspect = sized ? \"none\" : ASPECT[fit]\n const svg =\n `%3Csvg xmlns='http://www.w3.org/2000/svg' ${viewBox}%3E` +\n `%3Cfilter id='b' color-interpolation-filters='sRGB'%3E` +\n `%3CfeGaussianBlur stdDeviation='${BLUR}'/%3E` +\n `%3CfeColorMatrix values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1' result='s'/%3E` +\n `%3CfeFlood x='0' y='0' width='100%25' height='100%25'/%3E` +\n `%3CfeComposite operator='out' in='s'/%3E` +\n `%3CfeComposite in2='SourceGraphic'/%3E` +\n `%3CfeGaussianBlur stdDeviation='${BLUR}'/%3E` +\n `%3C/filter%3E` +\n `%3Cimage width='100%25' height='100%25' x='0' y='0' preserveAspectRatio='${aspect}' ` +\n `style='filter: url(%23b);' href='${placeholder}'/%3E` +\n `%3C/svg%3E`\n return `url(\"data:image/svg+xml;charset=utf-8,${svg}\")`\n}\n\n/** A placeholder string is a data URI (blurred) or any CSS color (painted flat). */\nexport const isDataUri = (placeholder: string): boolean => placeholder.startsWith(\"data:\")\n","\"use client\"\n\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { ImageOff } from \"lucide-react\"\nimport {\n type ComponentProps,\n type CSSProperties,\n type ReactNode,\n type SyntheticEvent,\n useEffect,\n useRef,\n useState,\n} from \"react\"\nimport { preload } from \"react-dom\"\nimport { match, P } from \"ts-pattern\"\nimport { cn } from \"../../lib/cn\"\nimport { type IconMap, iconStroke, mergeIcons } from \"../../lib/icons\"\nimport { useMergedRefs } from \"../../lib/merge-refs\"\nimport { props } from \"../../lib/props\"\nimport { MEDIA_RADIUS } from \"../../lib/radius\"\nimport { type Ratio, ratioStyle } from \"../../lib/ratio\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { useIsomorphicLayoutEffect } from \"../../lib/use-isomorphic-layout-effect\"\nimport { blurSvg, isDataUri } from \"./blur-svg\"\nimport { type ImageLoader, resolveSources } from \"./srcset\"\n\n/**\n * Image — an `<img>` that holds its box while it loads, then crossfades in.\n *\n * <Image src={photo.url} alt={photo.description} ratio=\"4/3\" placeholder={photo.blur} />\n *\n * Two elements: a root `<span>` that owns the box (aspect ratio, radius,\n * clipping) and paints the placeholder, and the `<img>` inside it, which\n * fades from transparent to opaque once it has loaded *and* decoded. The\n * placeholder is a CSS color, or a tiny `data:` URI blurred through an SVG\n * filter (`blur-svg.ts`); without one, the root pulses with Skeleton's own\n * tokens. All three are plain CSS, so they're in the server HTML. When the\n * image fails, a color or blur stays under the fallback as a hint of what\n * belonged there; the skeleton doesn't, since a shimmer reads as \"loading\".\n *\n * The fade is pure CSS keyed on `data-state`, so it only runs once React has\n * hydrated and seen the load: a non-priority image shows at hydration or at\n * load, whichever is later. `priority` opts out for the above-the-fold image\n * (the LCP candidate): it's preloaded, fetched eagerly, and never hidden.\n *\n * Loading is tracked per source, in a results map rather than a single flag\n * reset by an effect: a new `src` has no entry and so reads as `loading` on\n * its very first render, and a `fallbackSrc` that fails too is never retried,\n * so the fallback can't loop. The `<img>` is keyed by the source it shows, so\n * a late event from the previous one can't land on the next.\n *\n * Hydration-safe in the same way as next/image: an image that finished (or\n * failed) before React attached its handlers is caught in a layout effect,\n * through `complete` and `naturalWidth`.\n *\n * No `asChild`: the component is two elements, and the consumer's child could\n * only stand in for one of them.\n */\nconst imageRoot = cva(\n [\n \"relative inline-block max-w-full overflow-clip align-middle\",\n // Driven by `width` through a variable, so a consumer's `w-*` still wins.\n \"w-(--image-width)\",\n // The placeholder is dropped once the image is opaque, not when it starts\n // fading in: removing it at once would flash the page through the fade.\n // A zero-length transition with a delay is how CSS defers a discrete\n // change, and `allow-discrete` lets `background-image` take part.\n \"transition-[background] duration-0 transition-discrete\",\n // With no fade under reduced motion, there is nothing to wait for.\n \"data-[state=loaded]:delay-(--duration-normal) motion-reduce:data-[state=loaded]:delay-0\",\n ],\n {\n variants: {\n radius: MEDIA_RADIUS,\n // Skeleton's own surface, on a pseudo-element so the pulse never reaches\n // the image's opacity. Hidden on load with the same deferral as above.\n skeleton: {\n true: [\n \"before:absolute before:inset-0\",\n \"before:animate-pulse before:bg-black/15 dark:before:bg-white/8 motion-reduce:before:animate-none\",\n \"before:transition-[display] before:duration-0 before:transition-discrete\",\n \"data-[state=loaded]:before:hidden data-[state=loaded]:before:delay-(--duration-normal)\",\n \"motion-reduce:data-[state=loaded]:before:delay-0\",\n ],\n false: \"\",\n },\n },\n defaultVariants: { radius: \"xs\", skeleton: false },\n },\n)\n\nconst FIT = {\n cover: \"object-cover\",\n contain: \"object-contain\",\n fill: \"object-fill\",\n none: \"object-none\",\n \"scale-down\": \"object-scale-down\",\n} as const\n\n/** What the blurred placeholder's `background-size` mirrors, per `fit`. */\nconst BACKGROUND_SIZE = {\n cover: \"cover\",\n contain: \"contain\",\n fill: \"100% 100%\",\n none: \"cover\",\n \"scale-down\": \"contain\",\n} as const\n\n/**\n * Logical positions resolve through `--image-position`, flipped under RTL, so\n * the image and its blurred placeholder crop to the same side. A free-form\n * value is written to the same variable inline.\n */\nconst POSITION = {\n center: \"\",\n top: \"[--image-position:top]\",\n bottom: \"[--image-position:bottom]\",\n start: \"[--image-position:left] rtl:[--image-position:right]\",\n end: \"[--image-position:right] rtl:[--image-position:left]\",\n \"top-start\": \"[--image-position:left_top] rtl:[--image-position:right_top]\",\n \"top-end\": \"[--image-position:right_top] rtl:[--image-position:left_top]\",\n \"bottom-start\": \"[--image-position:left_bottom] rtl:[--image-position:right_bottom]\",\n \"bottom-end\": \"[--image-position:right_bottom] rtl:[--image-position:left_bottom]\",\n} as const\n\nconst isLogicalPosition = (position: string): position is keyof typeof POSITION =>\n Object.hasOwn(POSITION, position)\n\nexport type ImageStatus = \"empty\" | \"loading\" | \"loaded\" | \"error\"\nexport type ImageFit = keyof typeof FIT\nexport type ImagePosition = keyof typeof POSITION | (string & {})\nexport type ImageRadius = NonNullable<VariantProps<typeof imageRoot>[\"radius\"]>\nexport type { ImageLoader }\n\nexport type ImageIconSlot = \"fallback\"\nexport type ImageIcons = IconMap<ImageIconSlot>\n\nconst DEFAULT_ICONS: Record<ImageIconSlot, ReactNode> = {\n fallback: <ImageOff aria-hidden className={iconStroke} />,\n}\n\ntype ImageClassNames = {\n root?: string\n image?: string\n fallback?: string\n}\n\n/** Everything the kit decides itself, or redefines, is left out of the `<img>` passthrough. */\ntype ImgAttributes = Omit<\n ComponentProps<\"img\">,\n | \"src\"\n | \"alt\"\n | \"width\"\n | \"height\"\n | \"sizes\"\n | \"srcSet\"\n | \"loading\"\n | \"fetchPriority\"\n | \"placeholder\"\n | \"className\"\n | \"style\"\n>\n\nexport type ImageProps = ImgAttributes &\n WithTestId & {\n /** Image URL. Unset shows the fallback (`data-state=\"empty\"`). */\n src?: string\n /** Required. Describe the image, or pass `\"\"` when it's decorative. */\n alt: string\n /** Intrinsic width in px: sizes the box, and caps the srcset at 2x. */\n width?: number\n /** Intrinsic height in px: with `width`, gives the box its aspect ratio. */\n height?: number\n /** Box aspect ratio (`16 / 9` or `\"16/9\"`). Wins over `width`/`height`'s. */\n ratio?: Ratio\n /** How the image fills its box. */\n fit?: ImageFit\n /** Which part stays visible when cropped. `start`/`end` follow `dir`. */\n position?: ImagePosition\n /** Rendered width per breakpoint, for a loader's `w`-descriptor srcset. */\n sizes?: string\n /** Passed to `loader`. */\n quality?: number\n /** Maps `{ src, width, quality }` to a CDN URL; enables the srcset. */\n loader?: ImageLoader\n /** Above-the-fold image: preloaded, fetched eagerly, never hidden or faded. */\n priority?: boolean\n /** A CSS color, or a tiny `data:` URI shown blurred, also kept under the error fallback. Skeleton pulse when unset. */\n placeholder?: string\n /** Tried once, verbatim (no loader), when `src` fails. */\n fallbackSrc?: string\n /** Shown when there's nothing to load or everything failed. Wins over `icons.fallback`. */\n fallback?: ReactNode\n /**\n * Replaces the default icons: `fallback`, the broken picture shown when\n * there's nothing to load or everything failed. `null` leaves the box\n * empty: the wash, or the kept placeholder.\n */\n icons?: ImageIcons\n /** Corner radius. `\"none\"` for a square edge. */\n radius?: ImageRadius\n /** Fires on every status change after mount. */\n onStatusChange?: (status: ImageStatus) => void\n /** Applies to the root. */\n className?: string\n /** Applies to the root. */\n style?: CSSProperties\n classNames?: ImageClassNames\n }\n\ntype Result = \"loaded\" | \"error\"\n\n/** CSS custom properties alongside regular declarations, typed without a cast. */\ntype RootStyle = CSSProperties & Record<`--${string}`, string | undefined>\n\nexport function Image({\n src,\n alt,\n width,\n height,\n ratio,\n fit = \"cover\",\n position = \"center\",\n sizes,\n quality,\n loader,\n priority = false,\n placeholder,\n fallbackSrc,\n fallback,\n icons,\n radius,\n onStatusChange,\n className,\n style,\n classNames,\n testId,\n ref,\n onLoad,\n onError,\n ...rest\n}: ImageProps) {\n const [results, setResults] = useState<Record<string, Result>>({})\n const imgRef = useRef<HTMLImageElement>(null)\n\n const candidates = [...new Set([src, fallbackSrc].filter((c): c is string => Boolean(c)))]\n const current = candidates.find((c) => results[c] !== \"error\")\n const status: ImageStatus = match(current)\n .with(P.nullish, () => (candidates.length === 0 ? \"empty\" : \"error\"))\n .otherwise((c) => results[c] ?? \"loading\")\n\n // Only `src` goes through the loader: `fallbackSrc` is used verbatim, so a\n // misconfigured loader can't also take the fallback down with it.\n const sources = match(current)\n .with(P.nullish, () => undefined)\n .with(\n P.when((c) => c === src),\n (c) => resolveSources({ src: c, loader, width, sizes, quality }),\n )\n .otherwise((c) => ({ src: c }))\n\n if (priority && src && sources && current === src) {\n preload(sources.src, {\n as: \"image\",\n fetchPriority: \"high\",\n imageSrcSet: sources.srcSet,\n imageSizes: sources.sizes,\n })\n }\n\n const settle = (candidate: string, result: Result) =>\n setResults((previous) =>\n previous[candidate] === result ? previous : { ...previous, [candidate]: result },\n )\n\n /** Marks loaded once decoded, so the fade never starts on an undecoded frame. */\n const reveal = (img: HTMLImageElement, candidate: string) => {\n const decoded = typeof img.decode === \"function\" ? img.decode() : Promise.resolve()\n decoded\n .catch(() => undefined)\n .then(() => {\n if (img.isConnected) settle(candidate, \"loaded\")\n })\n }\n\n // An image that settled before hydration fired its events into the void.\n // A decoded one is revealed now; a broken one gets its `src` reassigned,\n // which makes the browser fire `error` again, this time with a listener.\n // Runs once per source: `reveal` only closes over a state setter.\n useIsomorphicLayoutEffect(() => {\n const img = imgRef.current\n if (!img || current === undefined || !img.complete) return\n const attribute = img.getAttribute(\"src\")\n if (img.naturalWidth > 0) reveal(img, current)\n else if (attribute) img.setAttribute(\"src\", attribute)\n }, [current])\n\n const reported = useRef(status)\n useEffect(() => {\n if (reported.current === status) return\n reported.current = status\n onStatusChange?.(status)\n }, [status, onStatusChange])\n\n const handleLoad = (event: SyntheticEvent<HTMLImageElement>) => {\n if (current !== undefined) reveal(event.currentTarget, current)\n onLoad?.(event)\n }\n const handleError = (event: SyntheticEvent<HTMLImageElement>) => {\n if (current !== undefined) settle(current, \"error\")\n onError?.(event)\n }\n\n // A failed image keeps its placeholder under the fallback, as a hint of what\n // should be there. The skeleton is never kept: a shimmer means \"loading\".\n const showsPlaceholder = placeholder !== undefined && (status === \"loading\" || status === \"error\")\n const keepsPlaceholder = showsPlaceholder && status === \"error\"\n const customPosition = isLogicalPosition(position) ? undefined : position\n const rootStyle: RootStyle = {\n ...(width !== undefined && { \"--image-width\": `${width}px` }),\n ...(width !== undefined && height !== undefined && { aspectRatio: `${width}/${height}` }),\n ...ratioStyle(ratio),\n ...(customPosition !== undefined && { \"--image-position\": customPosition }),\n ...(showsPlaceholder &&\n (isDataUri(placeholder)\n ? {\n backgroundImage: blurSvg({ placeholder, width, height, fit }),\n backgroundSize: BACKGROUND_SIZE[fit],\n backgroundPosition: \"var(--image-position, center)\",\n backgroundRepeat: \"no-repeat\",\n }\n : { backgroundColor: placeholder })),\n ...style,\n }\n\n const content = fallback ?? mergeIcons(DEFAULT_ICONS, icons).fallback\n const fallbackLabel = alt ? { role: \"img\", \"aria-label\": alt } : { \"aria-hidden\": true }\n\n const imageRef = useMergedRefs(imgRef, ref)\n return (\n <span\n data-part=\"root\"\n data-state={status}\n {...props({ \"data-priority\": priority, \"data-testid\": testId })}\n className={cn(\n imageRoot({\n radius,\n skeleton: placeholder === undefined && (status === \"loading\" || status === \"loaded\"),\n }),\n isLogicalPosition(position) && POSITION[position],\n classNames?.root,\n className,\n )}\n style={rootStyle}\n >\n {sources && current !== undefined ? (\n <img\n key={current}\n {...rest}\n ref={imageRef}\n data-part=\"image\"\n data-state={status}\n src={sources.src}\n srcSet={sources.srcSet}\n sizes={sources.sizes}\n alt={alt}\n width={width}\n height={height}\n loading={priority ? \"eager\" : \"lazy\"}\n fetchPriority={priority ? \"high\" : undefined}\n decoding={priority ? undefined : \"async\"}\n onLoad={handleLoad}\n onError={handleError}\n className={cn(\n // `text-transparent` hides alt text a browser paints while it waits.\n \"block size-full text-transparent object-(--image-position)\",\n FIT[fit],\n !priority && [\n \"opacity-0 data-[state=loaded]:opacity-100\",\n \"transition-opacity duration-(--duration-normal) ease-standard motion-reduce:transition-none\",\n ],\n classNames?.image,\n )}\n />\n ) : (\n <span\n data-part=\"fallback\"\n data-state={status}\n {...props({ \"data-placeholder\": keepsPlaceholder })}\n {...fallbackLabel}\n className={cn(\n \"absolute inset-0 flex items-center justify-center\",\n \"bg-black/5 text-black/50 dark:bg-white/8 dark:text-white/50\",\n // Over a kept placeholder the wash would only dull it.\n \"data-placeholder:bg-transparent\",\n // Backgrounds are dropped in forced colors; a system-colored edge keeps the box.\n \"forced-colors:border forced-colors:border-[CanvasText]\",\n // Direct child only, so the chip below sizes its own icon.\n \"[&>svg]:size-6 [&>svg]:max-h-1/2 [&>svg]:max-w-1/2\",\n classNames?.fallback,\n )}\n >\n {content != null && keepsPlaceholder ? (\n // A blur can be light or dark in either theme, so the content gets\n // a small chip of its own rather than relying on the theme's text color.\n <span\n data-part=\"fallback-chip\"\n className={cn(\n \"flex flex-col items-center gap-1 rounded-sm px-1.5 py-1\",\n \"bg-white/75 text-brand-900/70 dark:bg-black/55 dark:text-white/80\",\n \"forced-colors:bg-[Canvas] forced-colors:text-[CanvasText]\",\n \"[&_svg]:size-5\",\n )}\n >\n {content}\n </span>\n ) : (\n content\n )}\n </span>\n )}\n </span>\n )\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/image/srcset.ts","../src/components/image/blur-svg.ts","../src/components/image/image.tsx"],"names":["loader","width","match","P"],"mappings":";;;;;;;;;;;;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UACA,KAAA;AAAA,UACA,MAAA;AAAA,UACA,OAAA,EAAS,WAAW,OAAA,GAAU,MAAA;AAAA,UAC9B,aAAA,EAAe,WAAW,MAAA,GAAS,MAAA;AAAA,UACnC,QAAA,EAAU,WAAW,MAAA,GAAY,OAAA;AAAA,UACjC,MAAA,EAAQ,UAAA;AAAA,UACR,OAAA,EAAS,WAAA;AAAA,UACT,SAAA,EAAW,EAAA;AAAA;AAAA,YAET,4DAAA;AAAA,YACA,IAAI,GAAG,CAAA;AAAA,YACP,CAAC,QAAA,IAAY;AAAA,cACX,2CAAA;AAAA,cACA;AAAA,aACF;AAAA,YACA,UAAA,EAAY;AAAA;AACd,SAAA;AAAA,QAzBK;AAAA,OA0BP,mBAEA,GAAA;AAAA,QAAC,MAAA;AAAA,QAAA;AAAA,UACC,WAAA,EAAU,UAAA;AAAA,UACV,YAAA,EAAY,MAAA;AAAA,UACX,GAAG,KAAA,CAAM,EAAE,kBAAA,EAAoB,kBAAkB,CAAA;AAAA,UACjD,GAAG,aAAA;AAAA,UACJ,SAAA,EAAW,EAAA;AAAA,YACT,mDAAA;AAAA,YACA,6DAAA;AAAA;AAAA,YAEA,iCAAA;AAAA;AAAA,YAEA,wDAAA;AAAA;AAAA,YAEA,oDAAA;AAAA,YACA,UAAA,EAAY;AAAA,WACd;AAAA,UAEC,qBAAW,IAAA,IAAQ,gBAAA;AAAA;AAAA;AAAA,4BAGlB,GAAA;AAAA,cAAC,MAAA;AAAA,cAAA;AAAA,gBACC,WAAA,EAAU,eAAA;AAAA,gBACV,SAAA,EAAW,EAAA;AAAA,kBACT,yDAAA;AAAA,kBACA,mEAAA;AAAA,kBACA,2DAAA;AAAA,kBACA;AAAA,iBACF;AAAA,gBAEC,QAAA,EAAA;AAAA;AAAA;AACH,cAEA;AAAA;AAAA;AAEJ;AAAA,GAEJ;AAEJ","file":"chunk-G3YOSG3U.js","sourcesContent":["import { match, P } from \"ts-pattern\"\n\n/**\n * Builds a CDN URL for one rendition of an image. The kit never resizes\n * anything itself: a loader maps `{ src, width, quality }` onto whatever query\n * string or path your image service expects.\n *\n * const unsplash: ImageLoader = ({ src, width, quality = 75 }) =>\n * `${src}?w=${width}&q=${quality}&auto=format`\n */\nexport type ImageLoader = (params: { src: string; width: number; quality?: number }) => string\n\n/**\n * Candidate widths for a `sizes`-driven srcset: next/image's small image sizes\n * followed by its device sizes, so a thumbnail and a full-bleed hero both land\n * near a real rendition.\n */\nexport const IMAGE_WIDTHS = [\n 16, 32, 48, 64, 96, 128, 256, 384, 640, 750, 828, 1080, 1200, 1920, 2048, 3840,\n] as const\n\nexport type ImageSources = { src: string; srcSet?: string; sizes?: string }\n\ntype ResolveOptions = {\n src: string\n loader?: ImageLoader\n width?: number\n sizes?: string\n quality?: number\n}\n\n/**\n * What the `<img>` (and its priority preload) should request.\n *\n * - No loader: the plain `src`. Without a service to ask, there are no other\n * renditions to choose from.\n * - Loader + `sizes`: `w` descriptors from `IMAGE_WIDTHS`, capped at twice\n * `width` when it's known (nothing gains from a rendition sharper than a 2x\n * screen needs). The browser picks one from `sizes`.\n * - Loader + `width`: a fixed-size image, so `1x` and `2x` are enough.\n * - Loader alone: treated as full-width (`sizes=\"100vw\"`).\n *\n * `src` is always the largest rendition, for browsers that ignore srcset.\n */\nexport function resolveSources({\n src,\n loader,\n width,\n sizes,\n quality,\n}: ResolveOptions): ImageSources {\n return match({ loader, width, sizes })\n .with({ loader: P.nullish }, () => ({ src }))\n .with({ loader: P.not(P.nullish), sizes: P.nullish, width: P.number }, ({ loader, width }) => {\n const at = (density: number) => loader({ src, width: width * density, quality })\n return { src: at(2), srcSet: `${at(1)} 1x, ${at(2)} 2x` }\n })\n .with({ loader: P.not(P.nullish) }, ({ loader }) => {\n const cap = width === undefined ? Number.POSITIVE_INFINITY : width * 2\n const fitting = IMAGE_WIDTHS.filter((w) => w <= cap)\n const widths = fitting.length > 0 ? fitting : [cap]\n const urls = widths.map((w) => ({ w, url: loader({ src, width: w, quality }) }))\n return {\n src: urls.at(-1)?.url ?? src,\n srcSet: urls.map(({ w, url }) => `${url} ${w}w`).join(\", \"),\n sizes: sizes ?? \"100vw\",\n }\n })\n .exhaustive()\n}\n","/**\n * A blurred version of a tiny `data:` placeholder, as a CSS `background-image`\n * value. Ported from next/image's `image-blur-svg.ts`: the thumbnail is drawn\n * into an SVG through an `feGaussianBlur`, so a 10px base64 image scales up\n * into a soft wash instead of a pixelated mosaic. No canvas, no dependency,\n * and it's plain CSS, so it's already painted in the server HTML.\n *\n * The middle of the filter (the `feColorMatrix` alpha boost, then compositing\n * the result over the source) keeps the edges opaque: a bare blur fades to\n * transparent near the border and the box would read as having a halo.\n *\n * With both dimensions known the SVG gets a matching viewBox and stretches to\n * fill (`preserveAspectRatio=\"none\"`), the way the image itself will. Without\n * them, the image inside the SVG follows `fit` instead.\n */\nconst BLUR = 20\n\ntype BlurOptions = {\n placeholder: string\n width?: number\n height?: number\n fit: \"cover\" | \"contain\" | \"fill\" | \"none\" | \"scale-down\"\n}\n\nconst ASPECT = {\n cover: \"xMidYMid slice\",\n contain: \"xMidYMid\",\n fill: \"none\",\n none: \"xMidYMid slice\",\n \"scale-down\": \"xMidYMid\",\n} as const\n\nexport function blurSvg({ placeholder, width, height, fit }: BlurOptions): string {\n const sized = width !== undefined && height !== undefined\n const viewBox = sized ? `viewBox='0 0 ${width} ${height}'` : \"\"\n const aspect = sized ? \"none\" : ASPECT[fit]\n const svg =\n `%3Csvg xmlns='http://www.w3.org/2000/svg' ${viewBox}%3E` +\n `%3Cfilter id='b' color-interpolation-filters='sRGB'%3E` +\n `%3CfeGaussianBlur stdDeviation='${BLUR}'/%3E` +\n `%3CfeColorMatrix values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1' result='s'/%3E` +\n `%3CfeFlood x='0' y='0' width='100%25' height='100%25'/%3E` +\n `%3CfeComposite operator='out' in='s'/%3E` +\n `%3CfeComposite in2='SourceGraphic'/%3E` +\n `%3CfeGaussianBlur stdDeviation='${BLUR}'/%3E` +\n `%3C/filter%3E` +\n `%3Cimage width='100%25' height='100%25' x='0' y='0' preserveAspectRatio='${aspect}' ` +\n `style='filter: url(%23b);' href='${placeholder}'/%3E` +\n `%3C/svg%3E`\n return `url(\"data:image/svg+xml;charset=utf-8,${svg}\")`\n}\n\n/** A placeholder string is a data URI (blurred) or any CSS color (painted flat). */\nexport const isDataUri = (placeholder: string): boolean => placeholder.startsWith(\"data:\")\n","\"use client\"\n\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { ImageOff } from \"lucide-react\"\nimport {\n type ComponentProps,\n type CSSProperties,\n type ReactNode,\n type SyntheticEvent,\n useEffect,\n useRef,\n useState,\n} from \"react\"\nimport { preload } from \"react-dom\"\nimport { match, P } from \"ts-pattern\"\nimport { cn } from \"../../lib/cn\"\nimport { type IconMap, iconStroke, mergeIcons } from \"../../lib/icons\"\nimport { useMergedRefs } from \"../../lib/merge-refs\"\nimport { props } from \"../../lib/props\"\nimport { MEDIA_RADIUS } from \"../../lib/radius\"\nimport { type Ratio, ratioStyle } from \"../../lib/ratio\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { useIsomorphicLayoutEffect } from \"../../lib/use-isomorphic-layout-effect\"\nimport { blurSvg, isDataUri } from \"./blur-svg\"\nimport { type ImageLoader, resolveSources } from \"./srcset\"\n\n/**\n * Image — an `<img>` that holds its box while it loads, then crossfades in.\n *\n * <Image src={photo.url} alt={photo.description} ratio=\"4/3\" placeholder={photo.blur} />\n *\n * Two elements: a root `<span>` that owns the box (aspect ratio, radius,\n * clipping) and paints the placeholder, and the `<img>` inside it, which\n * fades from transparent to opaque once it has loaded *and* decoded. The\n * placeholder is a CSS color, or a tiny `data:` URI blurred through an SVG\n * filter (`blur-svg.ts`); without one, the root pulses with Skeleton's own\n * tokens. All three are plain CSS, so they're in the server HTML. When the\n * image fails, a color or blur stays under the fallback as a hint of what\n * belonged there; the skeleton doesn't, since a shimmer reads as \"loading\".\n *\n * The fade is pure CSS keyed on `data-state`, so it only runs once React has\n * hydrated and seen the load: a non-priority image shows at hydration or at\n * load, whichever is later. `priority` opts out for the above-the-fold image\n * (the LCP candidate): it's preloaded, fetched eagerly, and never hidden.\n *\n * Loading is tracked per source, in a results map rather than a single flag\n * reset by an effect: a new `src` has no entry and so reads as `loading` on\n * its very first render, and a `fallbackSrc` that fails too is never retried,\n * so the fallback can't loop. The `<img>` is keyed by the source it shows, so\n * a late event from the previous one can't land on the next.\n *\n * Hydration-safe in the same way as next/image: an image that finished (or\n * failed) before React attached its handlers is caught in a layout effect,\n * through `complete` and `naturalWidth`.\n *\n * No `asChild`: the component is two elements, and the consumer's child could\n * only stand in for one of them.\n */\nconst imageRoot = cva(\n [\n \"relative inline-block max-w-full overflow-clip align-middle\",\n // Driven by `width` through a variable, so a consumer's `w-*` still wins.\n \"w-(--image-width)\",\n // The placeholder is dropped once the image is opaque, not when it starts\n // fading in: removing it at once would flash the page through the fade.\n // A zero-length transition with a delay is how CSS defers a discrete\n // change, and `allow-discrete` lets `background-image` take part.\n \"transition-[background] duration-0 transition-discrete\",\n // With no fade under reduced motion, there is nothing to wait for.\n \"data-[state=loaded]:delay-(--duration-normal) motion-reduce:data-[state=loaded]:delay-0\",\n ],\n {\n variants: {\n radius: MEDIA_RADIUS,\n // Skeleton's own surface, on a pseudo-element so the pulse never reaches\n // the image's opacity. Hidden on load with the same deferral as above.\n skeleton: {\n true: [\n \"before:absolute before:inset-0\",\n \"before:animate-pulse before:bg-black/15 dark:before:bg-white/8 motion-reduce:before:animate-none\",\n \"before:transition-[display] before:duration-0 before:transition-discrete\",\n \"data-[state=loaded]:before:hidden data-[state=loaded]:before:delay-(--duration-normal)\",\n \"motion-reduce:data-[state=loaded]:before:delay-0\",\n ],\n false: \"\",\n },\n },\n defaultVariants: { radius: \"xs\", skeleton: false },\n },\n)\n\nconst FIT = {\n cover: \"object-cover\",\n contain: \"object-contain\",\n fill: \"object-fill\",\n none: \"object-none\",\n \"scale-down\": \"object-scale-down\",\n} as const\n\n/** What the blurred placeholder's `background-size` mirrors, per `fit`. */\nconst BACKGROUND_SIZE = {\n cover: \"cover\",\n contain: \"contain\",\n fill: \"100% 100%\",\n none: \"cover\",\n \"scale-down\": \"contain\",\n} as const\n\n/**\n * Logical positions resolve through `--image-position`, flipped under RTL, so\n * the image and its blurred placeholder crop to the same side. A free-form\n * value is written to the same variable inline.\n */\nconst POSITION = {\n center: \"\",\n top: \"[--image-position:top]\",\n bottom: \"[--image-position:bottom]\",\n start: \"[--image-position:left] rtl:[--image-position:right]\",\n end: \"[--image-position:right] rtl:[--image-position:left]\",\n \"top-start\": \"[--image-position:left_top] rtl:[--image-position:right_top]\",\n \"top-end\": \"[--image-position:right_top] rtl:[--image-position:left_top]\",\n \"bottom-start\": \"[--image-position:left_bottom] rtl:[--image-position:right_bottom]\",\n \"bottom-end\": \"[--image-position:right_bottom] rtl:[--image-position:left_bottom]\",\n} as const\n\nconst isLogicalPosition = (position: string): position is keyof typeof POSITION =>\n Object.hasOwn(POSITION, position)\n\nexport type ImageStatus = \"empty\" | \"loading\" | \"loaded\" | \"error\"\nexport type ImageFit = keyof typeof FIT\nexport type ImagePosition = keyof typeof POSITION | (string & {})\nexport type ImageRadius = NonNullable<VariantProps<typeof imageRoot>[\"radius\"]>\nexport type { ImageLoader }\n\nexport type ImageIconSlot = \"fallback\"\nexport type ImageIcons = IconMap<ImageIconSlot>\n\nconst DEFAULT_ICONS: Record<ImageIconSlot, ReactNode> = {\n fallback: <ImageOff aria-hidden className={iconStroke} />,\n}\n\ntype ImageClassNames = {\n root?: string\n image?: string\n fallback?: string\n}\n\n/** Everything the kit decides itself, or redefines, is left out of the `<img>` passthrough. */\ntype ImgAttributes = Omit<\n ComponentProps<\"img\">,\n | \"src\"\n | \"alt\"\n | \"width\"\n | \"height\"\n | \"sizes\"\n | \"srcSet\"\n | \"loading\"\n | \"fetchPriority\"\n | \"placeholder\"\n | \"className\"\n | \"style\"\n>\n\nexport type ImageProps = ImgAttributes &\n WithTestId & {\n /** Image URL. Unset shows the fallback (`data-state=\"empty\"`). */\n src?: string\n /** Required. Describe the image, or pass `\"\"` when it's decorative. */\n alt: string\n /** Intrinsic width in px: sizes the box, and caps the srcset at 2x. */\n width?: number\n /** Intrinsic height in px: with `width`, gives the box its aspect ratio. */\n height?: number\n /** Box aspect ratio (`16 / 9` or `\"16/9\"`). Wins over `width`/`height`'s. */\n ratio?: Ratio\n /** How the image fills its box. */\n fit?: ImageFit\n /** Which part stays visible when cropped. `start`/`end` follow `dir`. */\n position?: ImagePosition\n /** Rendered width per breakpoint, for a loader's `w`-descriptor srcset. */\n sizes?: string\n /** Passed to `loader`. */\n quality?: number\n /** Maps `{ src, width, quality }` to a CDN URL; enables the srcset. */\n loader?: ImageLoader\n /** Above-the-fold image: preloaded, fetched eagerly, never hidden or faded. */\n priority?: boolean\n /** A CSS color, or a tiny `data:` URI shown blurred, also kept under the error fallback. Skeleton pulse when unset. */\n placeholder?: string\n /** Tried once, verbatim (no loader), when `src` fails. */\n fallbackSrc?: string\n /** Shown when there's nothing to load or everything failed. Wins over `icons.fallback`. */\n fallback?: ReactNode\n /**\n * Replaces the default icons: `fallback`, the broken picture shown when\n * there's nothing to load or everything failed. `null` leaves the box\n * empty: the wash, or the kept placeholder.\n */\n icons?: ImageIcons\n /** Corner radius. `\"none\"` for a square edge. */\n radius?: ImageRadius\n /** Fires on every status change after mount. */\n onStatusChange?: (status: ImageStatus) => void\n /** Applies to the root. */\n className?: string\n /** Applies to the root. */\n style?: CSSProperties\n classNames?: ImageClassNames\n }\n\ntype Result = \"loaded\" | \"error\"\n\n/** CSS custom properties alongside regular declarations, typed without a cast. */\ntype RootStyle = CSSProperties & Record<`--${string}`, string | undefined>\n\nexport function Image({\n src,\n alt,\n width,\n height,\n ratio,\n fit = \"cover\",\n position = \"center\",\n sizes,\n quality,\n loader,\n priority = false,\n placeholder,\n fallbackSrc,\n fallback,\n icons,\n radius,\n onStatusChange,\n className,\n style,\n classNames,\n testId,\n ref,\n onLoad,\n onError,\n ...rest\n}: ImageProps) {\n const [results, setResults] = useState<Record<string, Result>>({})\n const imgRef = useRef<HTMLImageElement>(null)\n\n const candidates = [...new Set([src, fallbackSrc].filter((c): c is string => Boolean(c)))]\n const current = candidates.find((c) => results[c] !== \"error\")\n const status: ImageStatus = match(current)\n .with(P.nullish, () => (candidates.length === 0 ? \"empty\" : \"error\"))\n .otherwise((c) => results[c] ?? \"loading\")\n\n // Only `src` goes through the loader: `fallbackSrc` is used verbatim, so a\n // misconfigured loader can't also take the fallback down with it.\n const sources = match(current)\n .with(P.nullish, () => undefined)\n .with(\n P.when((c) => c === src),\n (c) => resolveSources({ src: c, loader, width, sizes, quality }),\n )\n .otherwise((c) => ({ src: c }))\n\n if (priority && src && sources && current === src) {\n preload(sources.src, {\n as: \"image\",\n fetchPriority: \"high\",\n imageSrcSet: sources.srcSet,\n imageSizes: sources.sizes,\n })\n }\n\n const settle = (candidate: string, result: Result) =>\n setResults((previous) =>\n previous[candidate] === result ? previous : { ...previous, [candidate]: result },\n )\n\n /** Marks loaded once decoded, so the fade never starts on an undecoded frame. */\n const reveal = (img: HTMLImageElement, candidate: string) => {\n const decoded = typeof img.decode === \"function\" ? img.decode() : Promise.resolve()\n decoded\n .catch(() => undefined)\n .then(() => {\n if (img.isConnected) settle(candidate, \"loaded\")\n })\n }\n\n // An image that settled before hydration fired its events into the void.\n // A decoded one is revealed now; a broken one gets its `src` reassigned,\n // which makes the browser fire `error` again, this time with a listener.\n // Runs once per source: `reveal` only closes over a state setter.\n useIsomorphicLayoutEffect(() => {\n const img = imgRef.current\n if (!img || current === undefined || !img.complete) return\n const attribute = img.getAttribute(\"src\")\n if (img.naturalWidth > 0) reveal(img, current)\n else if (attribute) img.setAttribute(\"src\", attribute)\n }, [current])\n\n const reported = useRef(status)\n useEffect(() => {\n if (reported.current === status) return\n reported.current = status\n onStatusChange?.(status)\n }, [status, onStatusChange])\n\n const handleLoad = (event: SyntheticEvent<HTMLImageElement>) => {\n if (current !== undefined) reveal(event.currentTarget, current)\n onLoad?.(event)\n }\n const handleError = (event: SyntheticEvent<HTMLImageElement>) => {\n if (current !== undefined) settle(current, \"error\")\n onError?.(event)\n }\n\n // A failed image keeps its placeholder under the fallback, as a hint of what\n // should be there. The skeleton is never kept: a shimmer means \"loading\".\n const showsPlaceholder = placeholder !== undefined && (status === \"loading\" || status === \"error\")\n const keepsPlaceholder = showsPlaceholder && status === \"error\"\n const customPosition = isLogicalPosition(position) ? undefined : position\n const rootStyle: RootStyle = {\n ...(width !== undefined && { \"--image-width\": `${width}px` }),\n ...(width !== undefined && height !== undefined && { aspectRatio: `${width}/${height}` }),\n ...ratioStyle(ratio),\n ...(customPosition !== undefined && { \"--image-position\": customPosition }),\n ...(showsPlaceholder &&\n (isDataUri(placeholder)\n ? {\n backgroundImage: blurSvg({ placeholder, width, height, fit }),\n backgroundSize: BACKGROUND_SIZE[fit],\n backgroundPosition: \"var(--image-position, center)\",\n backgroundRepeat: \"no-repeat\",\n }\n : { backgroundColor: placeholder })),\n ...style,\n }\n\n const content = fallback ?? mergeIcons(DEFAULT_ICONS, icons).fallback\n const fallbackLabel = alt ? { role: \"img\", \"aria-label\": alt } : { \"aria-hidden\": true }\n\n const imageRef = useMergedRefs(imgRef, ref)\n return (\n <span\n data-part=\"root\"\n data-state={status}\n {...props({ \"data-priority\": priority, \"data-testid\": testId })}\n className={cn(\n imageRoot({\n radius,\n skeleton: placeholder === undefined && (status === \"loading\" || status === \"loaded\"),\n }),\n isLogicalPosition(position) && POSITION[position],\n classNames?.root,\n className,\n )}\n style={rootStyle}\n >\n {sources && current !== undefined ? (\n <img\n key={current}\n {...rest}\n ref={imageRef}\n data-part=\"image\"\n data-state={status}\n src={sources.src}\n srcSet={sources.srcSet}\n sizes={sources.sizes}\n alt={alt}\n width={width}\n height={height}\n loading={priority ? \"eager\" : \"lazy\"}\n fetchPriority={priority ? \"high\" : undefined}\n decoding={priority ? undefined : \"async\"}\n onLoad={handleLoad}\n onError={handleError}\n className={cn(\n // `text-transparent` hides alt text a browser paints while it waits.\n \"block size-full text-transparent object-(--image-position)\",\n FIT[fit],\n !priority && [\n \"opacity-0 data-[state=loaded]:opacity-100\",\n \"transition-opacity duration-(--duration-normal) ease-standard motion-reduce:transition-none\",\n ],\n classNames?.image,\n )}\n />\n ) : (\n <span\n data-part=\"fallback\"\n data-state={status}\n {...props({ \"data-placeholder\": keepsPlaceholder })}\n {...fallbackLabel}\n className={cn(\n \"absolute inset-0 flex items-center justify-center\",\n \"bg-black/5 text-black/50 dark:bg-white/8 dark:text-white/50\",\n // Over a kept placeholder the wash would only dull it.\n \"data-placeholder:bg-transparent\",\n // Backgrounds are dropped in forced colors; a system-colored edge keeps the box.\n \"forced-colors:border forced-colors:border-[CanvasText]\",\n // Direct child only, so the chip below sizes its own icon.\n \"[&>svg]:size-6 [&>svg]:max-h-1/2 [&>svg]:max-w-1/2\",\n classNames?.fallback,\n )}\n >\n {content != null && keepsPlaceholder ? (\n // A blur can be light or dark in either theme, so the content gets\n // a small chip of its own rather than relying on the theme's text color.\n <span\n data-part=\"fallback-chip\"\n className={cn(\n \"flex flex-col items-center gap-1 rounded-sm px-1.5 py-1\",\n \"bg-white/75 text-brand-900/70 dark:bg-black/55 dark:text-white/80\",\n \"forced-colors:bg-[Canvas] forced-colors:text-[CanvasText]\",\n \"[&_svg]:size-5\",\n )}\n >\n {content}\n </span>\n ) : (\n content\n )}\n </span>\n )}\n </span>\n )\n}\n"]}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { useLinkComponent } from './chunk-GTKKRV5N.js';
|
|
2
|
+
import { iconStroke, mergeIcons } from './chunk-XXOR34T4.js';
|
|
3
|
+
import { composeChildren } from './chunk-R5LYFTHA.js';
|
|
4
|
+
import { props } from './chunk-WYCMIIRR.js';
|
|
5
|
+
import { focusStyles } from './chunk-C6NVU4F7.js';
|
|
6
|
+
import { TYPOGRAPHY_SIZE_CLASSES } from './chunk-GIPQUKCN.js';
|
|
7
|
+
import { cn } from './chunk-4ASNIDV7.js';
|
|
8
|
+
import { ark } from '@ark-ui/react';
|
|
9
|
+
import { cva } from 'class-variance-authority';
|
|
10
|
+
import { ArrowUpRight } from 'lucide-react';
|
|
11
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
12
|
+
|
|
13
|
+
var anchorVariants = cva(
|
|
14
|
+
[
|
|
15
|
+
"cursor-pointer rounded-xs transition-colors",
|
|
16
|
+
"underline-offset-2 decoration-from-font",
|
|
17
|
+
focusStyles()
|
|
18
|
+
],
|
|
19
|
+
{
|
|
20
|
+
variants: {
|
|
21
|
+
variant: {
|
|
22
|
+
default: "text-(--btn-link-text) hover:text-(--btn-link-hover)",
|
|
23
|
+
subtle: "text-inherit hover:text-(--btn-link-text)"
|
|
24
|
+
},
|
|
25
|
+
underline: {
|
|
26
|
+
hover: "no-underline hover:underline",
|
|
27
|
+
always: "underline",
|
|
28
|
+
never: "no-underline"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
defaultVariants: { variant: "default", underline: "always" }
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
var DEFAULT_ICONS = {
|
|
35
|
+
external: /* @__PURE__ */ jsx(ArrowUpRight, { "aria-hidden": true, className: cn(iconStroke, "rtl:-scale-x-100") })
|
|
36
|
+
};
|
|
37
|
+
var ANCHOR_DEFAULT_TRANSLATIONS = {
|
|
38
|
+
external: "(opens in a new tab)"
|
|
39
|
+
};
|
|
40
|
+
var SAFE_REL = ["noopener", "noreferrer"];
|
|
41
|
+
var safeRel = (rel) => [.../* @__PURE__ */ new Set([...rel?.split(/\s+/).filter(Boolean) ?? [], ...SAFE_REL])].join(" ");
|
|
42
|
+
var Anchor = ({
|
|
43
|
+
variant,
|
|
44
|
+
color,
|
|
45
|
+
underline,
|
|
46
|
+
size,
|
|
47
|
+
external,
|
|
48
|
+
linkComponent,
|
|
49
|
+
icons,
|
|
50
|
+
translations,
|
|
51
|
+
target,
|
|
52
|
+
rel,
|
|
53
|
+
asChild,
|
|
54
|
+
className,
|
|
55
|
+
children,
|
|
56
|
+
testId,
|
|
57
|
+
...rest
|
|
58
|
+
}) => {
|
|
59
|
+
const provided = useLinkComponent(linkComponent);
|
|
60
|
+
const resolvedTarget = target ?? (external ? "_blank" : void 0);
|
|
61
|
+
const newTab = resolvedTarget === "_blank";
|
|
62
|
+
const icon = mergeIcons(DEFAULT_ICONS, icons).external;
|
|
63
|
+
const note = { ...ANCHOR_DEFAULT_TRANSLATIONS, ...translations }.external;
|
|
64
|
+
const content = (own) => external ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
65
|
+
own,
|
|
66
|
+
icon != null && /* @__PURE__ */ jsx(
|
|
67
|
+
"span",
|
|
68
|
+
{
|
|
69
|
+
"aria-hidden": "true",
|
|
70
|
+
className: "-me-[0.1em] inline-block align-[-0.075em] [&_svg]:size-[0.85em]",
|
|
71
|
+
children: icon
|
|
72
|
+
}
|
|
73
|
+
),
|
|
74
|
+
/* @__PURE__ */ jsxs("span", { className: "sr-only", children: [
|
|
75
|
+
" ",
|
|
76
|
+
note
|
|
77
|
+
] })
|
|
78
|
+
] }) : own;
|
|
79
|
+
const shared = {
|
|
80
|
+
"data-color": color,
|
|
81
|
+
target: resolvedTarget,
|
|
82
|
+
rel: newTab ? safeRel(rel) : rel,
|
|
83
|
+
className: cn(
|
|
84
|
+
anchorVariants({ variant, underline }),
|
|
85
|
+
size && TYPOGRAPHY_SIZE_CLASSES[size],
|
|
86
|
+
className
|
|
87
|
+
),
|
|
88
|
+
...props({ "data-testid": testId, "data-external": external }),
|
|
89
|
+
...rest
|
|
90
|
+
};
|
|
91
|
+
if (asChild || external || !provided) {
|
|
92
|
+
return /* @__PURE__ */ jsx(ark.a, { asChild, ...shared, children: composeChildren(asChild, children, content) });
|
|
93
|
+
}
|
|
94
|
+
const Link = provided;
|
|
95
|
+
return /* @__PURE__ */ jsx(Link, { ...shared, children: content(children) });
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export { ANCHOR_DEFAULT_TRANSLATIONS, Anchor };
|
|
99
|
+
//# sourceMappingURL=chunk-GZN5CXMR.js.map
|
|
100
|
+
//# sourceMappingURL=chunk-GZN5CXMR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/anchor/anchor.tsx"],"names":[],"mappings":";;;;;;;;;;;;AA4CA,IAAM,cAAA,GAAiB,GAAA;AAAA,EACrB;AAAA,IACE,6CAAA;AAAA,IACA,yCAAA;AAAA,IACA,WAAA;AAAY,GACd;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OAAA,EAAS;AAAA,QACP,OAAA,EAAS,sDAAA;AAAA,QACT,MAAA,EAAQ;AAAA,OACV;AAAA,MACA,SAAA,EAAW;AAAA,QACT,KAAA,EAAO,8BAAA;AAAA,QACP,MAAA,EAAQ,WAAA;AAAA,QACR,KAAA,EAAO;AAAA;AACT,KACF;AAAA,IACA,eAAA,EAAiB,EAAE,OAAA,EAAS,SAAA,EAAW,WAAW,QAAA;AAAS;AAE/D,CAAA;AASO,IAAM,aAAA,GAAmD;AAAA,EAC9D,QAAA,sBAAW,YAAA,EAAA,EAAa,aAAA,EAAW,MAAC,SAAA,EAAW,EAAA,CAAG,UAAA,EAAY,kBAAkB,CAAA,EAAG;AACrF,CAAA;AAQO,IAAM,2BAAA,GAA4D;AAAA,EACvE,QAAA,EAAU;AACZ;AA6BA,IAAM,QAAA,GAAW,CAAC,UAAA,EAAY,YAAY,CAAA;AAG1C,IAAM,OAAA,GAAU,CAAC,GAAA,KACf,CAAC,uBAAO,GAAA,CAAI,CAAC,GAAI,GAAA,EAAK,KAAA,CAAM,KAAK,EAAE,MAAA,CAAO,OAAO,CAAA,IAAK,EAAC,EAAI,GAAG,QAAQ,CAAC,CAAC,CAAA,CAAE,IAAA,CAAK,GAAG,CAAA;AAE7E,IAAM,SAAS,CAAC;AAAA,EACrB,OAAA;AAAA,EACA,KAAA;AAAA,EACA,SAAA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,SAAA,EAAW,CAAA;AAAA,MACrC,IAAA,IAAQ,wBAAwB,IAAI,CAAA;AAAA,MACpC;AAAA,KACF;AAAA,IACA,GAAG,KAAA,CAAM,EAAE,eAAe,MAAA,EAAQ,eAAA,EAAiB,UAAU,CAAA;AAAA,IAC7D,GAAG;AAAA,GACL;AAKA,EAAA,IAAI,OAAA,IAAW,QAAA,IAAY,CAAC,QAAA,EAAU;AACpC,IAAA,uBACE,GAAA,CAAC,GAAA,CAAI,CAAA,EAAJ,EAAM,OAAA,EAAmB,GAAG,MAAA,EAC1B,QAAA,EAAA,eAAA,CAAgB,OAAA,EAAS,QAAA,EAAU,OAAO,CAAA,EAC7C,CAAA;AAAA,EAEJ;AACA,EAAA,MAAM,IAAA,GAAO,QAAA;AACb,EAAA,2BAAQ,IAAA,EAAA,EAAM,GAAG,MAAA,EAAS,QAAA,EAAA,OAAA,CAAQ,QAAQ,CAAA,EAAE,CAAA;AAC9C","file":"chunk-GZN5CXMR.js","sourcesContent":["\"use client\"\n\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport { cva } from \"class-variance-authority\"\nimport { ArrowUpRight } from \"lucide-react\"\nimport type { ElementType, ReactNode, Ref } from \"react\"\nimport { composeChildren } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { type IconMap, iconStroke, mergeIcons } from \"../../lib/icons\"\nimport { useLinkComponent } from \"../../lib/link-component\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TYPOGRAPHY_SIZE_CLASSES, type TypographySize } from \"../../lib/typography-size\"\n\n/**\n * Anchor — a themed `<a>` for links, inline in running text or standing on\n * their own.\n *\n * It renders through the kit's router-link seam, like `NavLink`: the\n * per-instance `linkComponent`, else the app-wide `<LinkComponentProvider>`,\n * else a plain `<a>`. Reading that provider is a React context read, which is\n * why Anchor is a client component (`Breadcrumb` stays a server component by\n * taking only the per-instance prop, and so ignores the provider).\n *\n * Its colours are the Figma link's, the same `--btn-link-*` slots as\n * `<Button variant=\"link\">`: with no `color`, primary text that dims on hover;\n * with a `color`, that palette's text, deepening on hover. `subtle` keeps the\n * surrounding text colour until hover, for a table of contents or a footer.\n *\n * Size and weight come from the surrounding text unless `size` is set, so a\n * link in a caption is caption-sized without anyone saying so.\n *\n * `external` is for a link that leaves the app: it opens in a new tab with\n * `rel=\"noopener noreferrer\"`, skips the router link (a router can't navigate\n * off-site), and ends with an arrow plus a visually hidden \"(opens in a new\n * tab)\", so the new tab is announced to everyone before it happens. Any\n * `target=\"_blank\"` gets the same safe `rel`.\n *\n * <Anchor href=\"/docs/colors\">the colours page</Anchor>\n * <Anchor href=\"https://42.fr\" external>42.fr</Anchor>\n * <Anchor href=\"#install\" variant=\"subtle\" underline=\"hover\">Install</Anchor>\n */\nconst anchorVariants = cva(\n [\n \"cursor-pointer rounded-xs transition-colors\",\n \"underline-offset-2 decoration-from-font\",\n focusStyles(),\n ],\n {\n variants: {\n variant: {\n default: \"text-(--btn-link-text) hover:text-(--btn-link-hover)\",\n subtle: \"text-inherit hover:text-(--btn-link-text)\",\n },\n underline: {\n hover: \"no-underline hover:underline\",\n always: \"underline\",\n never: \"no-underline\",\n },\n },\n defaultVariants: { variant: \"default\", underline: \"always\" },\n },\n)\n\nexport type AnchorVariant = \"default\" | \"subtle\"\nexport type AnchorUnderline = \"hover\" | \"always\" | \"never\"\n\nexport type AnchorIconSlot = \"external\"\nexport type AnchorIcons = IconMap<AnchorIconSlot>\n\n/** The default icons: `external`, the arrow after an external link. */\nexport const DEFAULT_ICONS: Record<AnchorIconSlot, ReactNode> = {\n external: <ArrowUpRight aria-hidden className={cn(iconStroke, \"rtl:-scale-x-100\")} />,\n}\n\n/** The external link's hidden note. */\nexport type AnchorTranslations = {\n /** Read after an `external` link's text. Default `\"(opens in a new tab)\"`. */\n external?: string\n}\n\nexport const ANCHOR_DEFAULT_TRANSLATIONS: Required<AnchorTranslations> = {\n external: \"(opens in a new tab)\",\n}\n\nexport type AnchorProps = Omit<HTMLArkProps<\"a\">, \"color\"> &\n WithTestId & {\n /** `default` paints the link in its palette; `subtle` keeps the\n * surrounding text colour until hover. @default \"default\" */\n variant?: AnchorVariant\n /** The palette. Without it, the link is primary text, like Figma's\n * link and `<Button variant=\"link\">`. */\n color?: Color\n /** When the underline shows. @default \"always\" */\n underline?: AnchorUnderline\n /** Font size from the shared Text/Title scale. Inherited from the\n * surrounding text when unset. */\n size?: TypographySize\n /** A link that leaves the app: opens in a new tab with a safe `rel`,\n * skips the router link, and ends with the `external` icon and a hidden\n * \"(opens in a new tab)\". */\n external?: boolean\n /** Overrides the `<LinkComponentProvider>` for this link only. */\n linkComponent?: ElementType\n /** Replaces the default icons: `external`, the arrow after an external\n * link. `null` draws no arrow; the hidden note stays. */\n icons?: AnchorIcons\n /** Overrides the external link's hidden note. */\n translations?: AnchorTranslations\n ref?: Ref<HTMLAnchorElement>\n }\n\nconst SAFE_REL = [\"noopener\", \"noreferrer\"]\n\n/** The caller's `rel` tokens plus `noopener noreferrer`, each once. */\nconst safeRel = (rel: string | undefined) =>\n [...new Set([...(rel?.split(/\\s+/).filter(Boolean) ?? []), ...SAFE_REL])].join(\" \")\n\nexport const Anchor = ({\n variant,\n color,\n underline,\n size,\n external,\n linkComponent,\n icons,\n translations,\n target,\n rel,\n asChild,\n className,\n children,\n testId,\n ...rest\n}: AnchorProps) => {\n const provided = useLinkComponent(linkComponent)\n const resolvedTarget = target ?? (external ? \"_blank\" : undefined)\n const newTab = resolvedTarget === \"_blank\"\n const icon = mergeIcons(DEFAULT_ICONS, icons).external\n const note = { ...ANCHOR_DEFAULT_TRANSLATIONS, ...translations }.external\n\n const content = (own: ReactNode) =>\n external ? (\n <>\n {own}\n {icon != null && (\n <span\n aria-hidden=\"true\"\n className=\"-me-[0.1em] inline-block align-[-0.075em] [&_svg]:size-[0.85em]\"\n >\n {icon}\n </span>\n )}\n <span className=\"sr-only\"> {note}</span>\n </>\n ) : (\n own\n )\n\n const shared = {\n \"data-color\": color,\n target: resolvedTarget,\n rel: newTab ? safeRel(rel) : rel,\n className: cn(\n anchorVariants({ variant, underline }),\n size && TYPOGRAPHY_SIZE_CLASSES[size],\n className,\n ),\n ...props({ \"data-testid\": testId, \"data-external\": external }),\n ...rest,\n }\n\n // An off-site link stays a plain `<a>`: a router's Link can't leave the app,\n // and some (TanStack Router's) reject an absolute URL outright. `asChild`\n // wins over both: the child is the link.\n if (asChild || external || !provided) {\n return (\n <ark.a asChild={asChild} {...shared}>\n {composeChildren(asChild, children, content)}\n </ark.a>\n )\n }\n const Link = provided\n return <Link {...shared}>{content(children)}</Link>\n}\n"]}
|
|
@@ -1,126 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { treePositions } from './chunk-LR5U6TZZ.js';
|
|
2
|
+
import { inputSlot, inputControlClasses } from './chunk-HTVICHT4.js';
|
|
3
|
+
import { fieldA11yProps } from './chunk-2RRTT4AF.js';
|
|
4
|
+
import { Popover, popoverClearTrigger, popoverChevron, popoverEmpty } from './chunk-YUVKROMA.js';
|
|
4
5
|
import { props } from './chunk-WYCMIIRR.js';
|
|
5
|
-
import { focusStyles } from './chunk-C6NVU4F7.js';
|
|
6
|
-
import { TEXT_COLOR_CLASSES } from './chunk-GIPQUKCN.js';
|
|
7
6
|
import { cn } from './chunk-4ASNIDV7.js';
|
|
8
7
|
import { useFieldContext } from '@ark-ui/react/field';
|
|
9
|
-
import { cva } from 'class-variance-authority';
|
|
10
8
|
import { Fragment, useState, useRef, useEffect } from 'react';
|
|
11
|
-
import { jsxs,
|
|
9
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if (n.children) walk(n.children);
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
walk(nodes);
|
|
26
|
-
return { labelMap, nodeMap };
|
|
27
|
-
};
|
|
28
|
-
var flattenTree = (nodes, inheritedDisabled, acc = []) => {
|
|
29
|
-
for (const n of nodes) {
|
|
30
|
-
const nodeDisabled = inheritedDisabled || !!n.disabled;
|
|
31
|
-
acc.push({ value: n.value, disabled: nodeDisabled });
|
|
32
|
-
if (n.children) flattenTree(n.children, nodeDisabled, acc);
|
|
33
|
-
}
|
|
34
|
-
return acc;
|
|
35
|
-
};
|
|
36
|
-
var filterTree = (nodes, query, matches) => {
|
|
37
|
-
if (!query.trim()) return nodes;
|
|
38
|
-
const recurse = (ns) => {
|
|
39
|
-
const out = [];
|
|
40
|
-
for (const n of ns) {
|
|
41
|
-
const selfMatch = matches(n.label, query);
|
|
42
|
-
if (isLeaf(n)) {
|
|
43
|
-
if (selfMatch) out.push(n);
|
|
44
|
-
} else if (selfMatch) {
|
|
45
|
-
out.push(n);
|
|
46
|
-
} else if (n.children) {
|
|
47
|
-
const kids = recurse(n.children);
|
|
48
|
-
if (kids.length > 0) out.push({ ...n, children: kids });
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return out;
|
|
52
|
-
};
|
|
53
|
-
return recurse(nodes);
|
|
11
|
+
var renderTree = (nodes, row, parent) => {
|
|
12
|
+
const positions = treePositions(nodes.length, parent);
|
|
13
|
+
return nodes.map((node, i) => {
|
|
14
|
+
const position = positions[i];
|
|
15
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
16
|
+
row(node, position),
|
|
17
|
+
node.children && renderTree(node.children, row, position)
|
|
18
|
+
] }, node.value);
|
|
19
|
+
});
|
|
54
20
|
};
|
|
55
|
-
var treeLine = "bg-brand-900/20 dark:bg-white/15";
|
|
56
|
-
var treeRow = cva(
|
|
57
|
-
["group/row relative flex w-full items-center rounded-sm ps-1.5 outline-none select-none"],
|
|
58
|
-
{
|
|
59
|
-
variants: {
|
|
60
|
-
size: {
|
|
61
|
-
xs: "min-h-7 pe-1.5 text-xs",
|
|
62
|
-
sm: "min-h-8 pe-2 text-sm",
|
|
63
|
-
md: "min-h-9 pe-2 text-md",
|
|
64
|
-
lg: "min-h-10 pe-2.5 text-lg",
|
|
65
|
-
xl: "min-h-11 pe-3 text-xl"
|
|
66
|
-
},
|
|
67
|
-
interactive: {
|
|
68
|
-
true: [
|
|
69
|
-
"cursor-pointer",
|
|
70
|
-
TEXT_COLOR_CLASSES.primary,
|
|
71
|
-
"hover:bg-black/5 dark:hover:bg-white/8",
|
|
72
|
-
"data-active:bg-black/5 dark:data-active:bg-white/8",
|
|
73
|
-
"data-disabled:pointer-events-none data-disabled:opacity-50",
|
|
74
|
-
// Palette, not brand: the focused row is also the active one, and brand-500
|
|
75
|
-
// measured 2.73:1 against that light fill. `--c-text` (the popover's
|
|
76
|
-
// `data-color`, neutral by default) clears it in both themes.
|
|
77
|
-
focusStyles({ ring: "palette", offset: false, inset: true })
|
|
78
|
-
],
|
|
79
|
-
false: ["cursor-default font-medium", TEXT_COLOR_CLASSES.secondary]
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
defaultVariants: { size: "md", interactive: true }
|
|
83
|
-
}
|
|
84
|
-
);
|
|
85
|
-
var renderTree = (nodes, row, depth = 0, ancestorHasNextSibling = []) => nodes.map((node, i) => {
|
|
86
|
-
const position = {
|
|
87
|
-
depth,
|
|
88
|
-
ancestorHasNextSibling,
|
|
89
|
-
isLast: i === nodes.length - 1,
|
|
90
|
-
posinset: i + 1,
|
|
91
|
-
setsize: nodes.length
|
|
92
|
-
};
|
|
93
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
94
|
-
row(node, position),
|
|
95
|
-
node.children && renderTree(
|
|
96
|
-
node.children,
|
|
97
|
-
row,
|
|
98
|
-
depth + 1,
|
|
99
|
-
depth === 0 ? [] : [...ancestorHasNextSibling, !position.isLast]
|
|
100
|
-
)
|
|
101
|
-
] }, node.value);
|
|
102
|
-
});
|
|
103
21
|
var treeItemAria = ({ depth, setsize, posinset }) => ({
|
|
104
22
|
"aria-level": depth + 1,
|
|
105
23
|
"aria-setsize": setsize,
|
|
106
24
|
"aria-posinset": posinset
|
|
107
25
|
});
|
|
108
|
-
var TreeRails = ({ depth, ancestorHasNextSibling, isLast }) => depth > 0 && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
109
|
-
ancestorHasNextSibling.map((hasNext, i) => (
|
|
110
|
-
// biome-ignore lint/suspicious/noArrayIndexKey: Indentation is stable inside component, we would want to rerender anyway.
|
|
111
|
-
/* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "relative w-4 shrink-0 self-stretch", children: hasNext && /* @__PURE__ */ jsx("span", { className: cn("absolute inset-y-0 inset-s-1/2 w-px", treeLine) }) }, i)
|
|
112
|
-
)),
|
|
113
|
-
/* @__PURE__ */ jsxs("span", { "aria-hidden": true, className: "relative w-4 shrink-0 self-stretch", children: [
|
|
114
|
-
/* @__PURE__ */ jsx(
|
|
115
|
-
"span",
|
|
116
|
-
{
|
|
117
|
-
className: cn("absolute inset-s-1/2 top-0 w-px", treeLine, isLast ? "h-1/2" : "bottom-0")
|
|
118
|
-
}
|
|
119
|
-
),
|
|
120
|
-
/* @__PURE__ */ jsx("span", { className: cn("absolute inset-s-1/2 top-1/2 h-px w-1/2", treeLine) })
|
|
121
|
-
] })
|
|
122
|
-
] });
|
|
123
|
-
var TreeLabel = ({ className, children }) => /* @__PURE__ */ jsx("span", { className: cn("ms-1.5 min-w-0 flex-1 truncate text-start", className), children });
|
|
124
26
|
var TreeTrigger = ({
|
|
125
27
|
open,
|
|
126
28
|
disabled,
|
|
@@ -340,6 +242,6 @@ var useTreeRovingFocus = ({
|
|
|
340
242
|
return { activeValue, setActiveValue, searchRef, rowProps, onTreeKeyDown, onSearchKeyDown };
|
|
341
243
|
};
|
|
342
244
|
|
|
343
|
-
export { TreeBody,
|
|
344
|
-
//# sourceMappingURL=chunk-
|
|
345
|
-
//# sourceMappingURL=chunk-
|
|
245
|
+
export { TreeBody, TreeSearch, TreeTrigger, renderTree, treeItemAria, useTreeRovingFocus };
|
|
246
|
+
//# sourceMappingURL=chunk-HCSZPBWV.js.map
|
|
247
|
+
//# sourceMappingURL=chunk-HCSZPBWV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/tree-select/tree-popover.tsx"],"names":[],"mappings":";;;;;;;;;;AAkDO,IAAM,UAAA,GAAa,CACxB,KAAA,EACA,GAAA,EACA,MAAA,KACc;AACd,EAAA,MAAM,SAAA,GAAY,aAAA,CAAc,KAAA,CAAM,MAAA,EAAQ,MAAM,CAAA;AACpD,EAAA,OAAO,KAAA,CAAM,GAAA,CAAI,CAAC,IAAA,EAAM,CAAA,KAAM;AAC5B,IAAA,MAAM,QAAA,GAAW,UAAU,CAAC,CAAA;AAC5B,IAAA,4BACG,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,MAAA,GAAA,CAAI,MAAM,QAAQ,CAAA;AAAA,MAClB,KAAK,QAAA,IAAY,UAAA,CAAW,IAAA,CAAK,QAAA,EAAU,KAAK,QAAQ;AAAA,KAAA,EAAA,EAF5C,KAAK,KAGpB,CAAA;AAAA,EAEJ,CAAC,CAAA;AACH;AAGO,IAAM,eAAe,CAAC,EAAE,KAAA,EAAO,OAAA,EAAS,UAAS,MAAqB;AAAA,EAC3E,cAAc,KAAA,GAAQ,CAAA;AAAA,EACtB,cAAA,EAAgB,OAAA;AAAA,EAChB,eAAA,EAAiB;AACnB,CAAA;AA4BO,IAAM,cAAc,CAAC;AAAA,EAC1B,IAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAA;AAAA,EACA,KAAA;AAAA,EACA,SAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA,UAAA;AAAA,EACA,gBAAA;AAAA,EACA,KAAA;AAAA,EACA,MAAA;AAAA,EACA,MAAA;AAAA,EACA,QAAA;AAAA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,CAAC,KAAA,KAA2C;AAClE,IAAA,IAAI,KAAA,CAAM,QAAQ,WAAA,EAAa;AAC7B,MAAA,KAAA,CAAM,cAAA,EAAe;AACrB,MAAA,QAAA,CAAS,MAAA,CAAO,CAAC,CAAC,CAAA;AAAA,IACpB;AAAA,EACF,CAAA;AAIA,EAAA,MAAM,QAAA,GAAW,CAAC,KAAA,MAAmB;AAAA,IACnC,GAAA,EAAK,CAAC,EAAA,KAA2B;AAC/B,MAAA,IAAI,EAAA,EAAI,OAAA,CAAQ,OAAA,CAAQ,GAAA,CAAI,OAAO,EAAE,CAAA;AAAA,WAChC,OAAA,CAAQ,OAAA,CAAQ,MAAA,CAAO,KAAK,CAAA;AAAA,IACnC,CAAA;AAAA,IACA,GAAG,KAAA,CAAM,EAAE,aAAA,EAAe,KAAA,KAAU,aAAa;AAAA,GACnD,CAAA;AAEA,EAAA,OAAO,EAAE,WAAA,EAAa,cAAA,EAAgB,SAAA,EAAW,QAAA,EAAU,eAAe,eAAA,EAAgB;AAC5F","file":"chunk-HCSZPBWV.js","sourcesContent":["\"use client\"\n\nimport { useFieldContext } from \"@ark-ui/react/field\"\nimport {\n type ComponentProps,\n Fragment,\n type KeyboardEvent,\n type ReactNode,\n type Ref,\n useEffect,\n useRef,\n useState,\n} from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { props } from \"../../lib/props\"\nimport type { ClearSectionMode } from \"../../lib/select-data\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport type { TreeNodeData } from \"../../lib/tree-data\"\nimport { fieldA11yProps } from \"../field/field\"\nimport { inputControlClasses, inputSlot } from \"../input/input\"\nimport { Popover, popoverChevron, popoverClearTrigger, popoverEmpty } from \"../popover/popover\"\nimport { type TreePosition, treePositions } from \"../tree/tree-row\"\n\n/**\n * The internals `TreeSelect` and `TreeMultiSelect` share on top of the kit's tree row\n * (`tree/tree-row.tsx`, which `Tree` draws too): the flat walk, the combobox trigger, the\n * search header, the tree body and the roving focus (arrows, Home / End, type-ahead). Each\n * picker keeps only what differs: what a row shows, and what activating one does.\n *\n * Why the pickers don't run on Ark's `tree-view` machine, like `Tree` does (checked against\n * `@zag-js/tree-view` 1.43):\n * - Its arrow keys, Home / End and type-ahead walk every visible node, branches included\n * (`collection.getNextNode` with a `skip` that only hides collapsed subtrees, not a\n * prop). TreeSelect's focus visits selectable leaves only.\n * - Enter, Space and a click on a branch send `BRANCH_NODE.CLICK`, which selects the\n * branch and, with `expandOnClick`, collapses it; ← / → collapse and expand. The pickers'\n * trees are always fully expanded: a branch is organizational (TreeSelect) or a cascade\n * checkbox (TreeMultiSelect), and ← / → do nothing.\n * - Its branch `treeitem` wraps the branch's `role=\"button\"` control and a `role=\"group\"`\n * of its children. The pickers' tree is one flat list of `treeitem`s, its hierarchy\n * carried by `aria-level`: that nesting would change their accessibility tree.\n * - Its type-ahead matches disabled nodes too (`visibleNodes`); the pickers' skips them.\n */\n\n/**\n * Walk `nodes` depth-first, rendering each through `row` with its position,\n * its subtree flattened right after it: the tree is one flat list of rows,\n * its hierarchy carried by `aria-level` and the rails.\n */\nexport const renderTree = <P,>(\n nodes: ReadonlyArray<TreeNodeData<P>>,\n row: (node: TreeNodeData<P>, position: TreePosition) => ReactNode,\n parent?: TreePosition,\n): ReactNode => {\n const positions = treePositions(nodes.length, parent)\n return nodes.map((node, i) => {\n const position = positions[i] as TreePosition\n return (\n <Fragment key={node.value}>\n {row(node, position)}\n {node.children && renderTree(node.children, row, position)}\n </Fragment>\n )\n })\n}\n\n/** A row's level and set position. The tree renders flat, so the browser can't derive them. */\nexport const treeItemAria = ({ depth, setsize, posinset }: TreePosition) => ({\n \"aria-level\": depth + 1,\n \"aria-setsize\": setsize,\n \"aria-posinset\": posinset,\n})\n\ntype TreeTriggerProps = Omit<ComponentProps<\"div\">, \"role\" | \"tabIndex\" | \"color\"> &\n WithTestId & {\n open: boolean\n disabled?: boolean\n readOnly?: boolean\n invalid: boolean\n color?: Color\n startSlot?: ReactNode\n endSlot?: ReactNode\n /** Clears the value. Omit it to hide the clear button. */\n onClear?: () => void\n clearLabel: string\n clearSectionMode: ClearSectionMode\n icons: { clear: ReactNode; chevron: ReactNode }\n /** Enter, Space or ↓ on the closed trigger. */\n onOpen: () => void\n }\n\n/**\n * The real, focusable `<div role=\"combobox\">`, with its start slot, value\n * (`children`), end slot, clear button and chevron. A component of its own so\n * it reads the `Field` context from *inside* the picker's `FieldShell`: the\n * picker renders that shell, so `useFieldContext()` at its top level would\n * run too early. `Popover.Trigger` stamps its own id on the element, so the\n * `<label for>` never reaches it: the name comes from `aria-labelledby`.\n */\nexport const TreeTrigger = ({\n open,\n disabled,\n readOnly,\n invalid,\n color,\n startSlot,\n endSlot,\n onClear,\n clearLabel,\n clearSectionMode,\n icons,\n onOpen,\n testId,\n children,\n ...rest\n}: TreeTriggerProps) => {\n const field = useFieldContext()\n return (\n <Popover.Trigger asChild>\n <div\n role=\"combobox\"\n aria-expanded={open}\n aria-haspopup=\"tree\"\n tabIndex={disabled ? -1 : 0}\n {...fieldA11yProps(field)}\n data-color={color}\n {...props({\n \"aria-invalid\": invalid,\n \"data-disabled\": disabled,\n \"data-readonly\": readOnly,\n \"data-invalid\": invalid,\n \"data-with-start-slot\": startSlot != null,\n // The trigger always ends in a chevron (and optional clear).\n \"data-with-end-slot\": true,\n // The shell IS the tabbable/focusable element here (no separate\n // inner control to route to), so `testId` lands directly on it.\n \"data-testid\": testId,\n })}\n onKeyDown={(event) => {\n if (disabled || readOnly) return\n if (event.key === \"Enter\" || event.key === \" \" || event.key === \"ArrowDown\") {\n event.preventDefault()\n onOpen()\n }\n }}\n {...rest}\n >\n {startSlot != null && (\n <span className={inputSlot} aria-hidden>\n {startSlot}\n </span>\n )}\n {children}\n {endSlot != null && <span className={inputSlot}>{endSlot}</span>}\n {onClear && (\n <button\n type=\"button\"\n aria-label={clearLabel}\n onPointerDown={(event) => {\n event.preventDefault()\n event.stopPropagation()\n }}\n onClick={(event) => {\n event.stopPropagation()\n onClear()\n }}\n className={popoverClearTrigger}\n >\n {icons.clear}\n </button>\n )}\n {(clearSectionMode === \"both\" || !onClear) && (\n <span aria-hidden data-chevron className={cn(popoverChevron, open && \"rotate-180\")}>\n {icons.chevron}\n </span>\n )}\n </div>\n </Popover.Trigger>\n )\n}\n\n/** The popover's search field, in its fixed header. */\nexport const TreeSearch = ({\n ref,\n value,\n onChange,\n onKeyDown,\n placeholder,\n label,\n className,\n}: {\n ref: Ref<HTMLInputElement>\n value: string\n onChange: (value: string) => void\n onKeyDown: (event: KeyboardEvent<HTMLInputElement>) => void\n placeholder: string\n label: string\n className?: string\n}) => (\n <Popover.Header>\n <input\n ref={ref}\n type=\"text\"\n value={value}\n onChange={(event) => onChange(event.target.value)}\n onKeyDown={onKeyDown}\n placeholder={placeholder}\n aria-label={label}\n className={cn(inputControlClasses, \"text-sm\", className)}\n />\n </Popover.Header>\n)\n\n/** The scrolling body: the `role=\"tree\"` list, or `empty` when the search matched nothing. */\nexport const TreeBody = ({\n id,\n isEmpty,\n empty,\n multiselectable,\n onKeyDown,\n children,\n}: {\n id: string\n isEmpty: boolean\n empty: ReactNode\n multiselectable?: boolean\n onKeyDown: (event: KeyboardEvent<HTMLDivElement>) => void\n children: ReactNode\n}) => (\n <Popover.Body>\n {isEmpty ? (\n <div className={popoverEmpty}>{empty}</div>\n ) : (\n <div\n id={id}\n role=\"tree\"\n {...props({ \"aria-multiselectable\": multiselectable && \"true\" })}\n aria-orientation=\"vertical\"\n onKeyDown={onKeyDown}\n className=\"flex flex-col\"\n >\n {children}\n </div>\n )}\n </Popover.Body>\n)\n\ntype UseTreeRovingFocusOptions = {\n /** The rows that take focus (enabled, and selectable), in visual order. */\n values: readonly string[]\n /** A row's label, matched by type-ahead. */\n labelOf: (value: string) => string\n open: boolean\n searchable: boolean\n /** Space / Enter on the focused row. */\n onActivate: (value: string) => void\n}\n\n/**\n * Roving focus over a flat-rendered tree. One row is active (`tabIndex=0`,\n * `data-active`); `↑` / `↓` step through `values`, `Home` / `End` jump to\n * either end, `Space` / `Enter` activate, and printable keys type-ahead to the\n * next row whose label starts with what was typed. On open, focus lands in\n * the search field when there is one, on the active row otherwise.\n */\nexport const useTreeRovingFocus = ({\n values,\n labelOf,\n open,\n searchable,\n onActivate,\n}: UseTreeRovingFocusOptions) => {\n const [activeValueState, setActiveValue] = useState<string | null>(null)\n // A row filtered out (or disabled) since it was active falls back to the first.\n const activeValue =\n activeValueState != null && values.includes(activeValueState)\n ? activeValueState\n : (values[0] ?? null)\n\n const searchRef = useRef<HTMLInputElement>(null)\n const rowRefs = useRef(new Map<string, HTMLElement>())\n const focusRow = (next: string | null | undefined) => {\n if (next == null) return\n setActiveValue(next)\n rowRefs.current.get(next)?.focus()\n }\n\n // Type-ahead: typed characters buffer briefly and jump to the next row whose\n // label starts with the buffer. Only fires while the tree itself has focus —\n // when `searchable`, keys land in the search field instead.\n const typeahead = useRef<{ query: string; timer: ReturnType<typeof setTimeout> | null }>({\n query: \"\",\n timer: null,\n })\n useEffect(\n () => () => {\n if (typeahead.current.timer) clearTimeout(typeahead.current.timer)\n },\n [],\n )\n const typeToFocus = (char: string) => {\n const state = typeahead.current\n if (state.timer) clearTimeout(state.timer)\n state.query += char\n state.timer = setTimeout(() => {\n state.query = \"\"\n }, 500)\n\n const n = values.length\n if (n === 0) return\n const q = state.query.toLowerCase()\n // A run of the same key (\"ss\") cycles through same-initial matches.\n const repeated = q.length > 1 && [...q].every((c) => c === q.charAt(0))\n const needle = repeated ? q.charAt(0) : q\n const start = activeValue ? values.indexOf(activeValue) : -1\n const base = start === -1 ? 0 : start\n // Advance past the current row for a fresh/repeated key; keep it for a\n // growing multi-char query so the current match can still satisfy it.\n const advance = start !== -1 && (q.length === 1 || repeated) ? 1 : 0\n const match = Array.from({ length: n }, (_, i) => values[(base + advance + i) % n]).find(\n (value) => value != null && labelOf(value).toLowerCase().startsWith(needle),\n )\n focusRow(match)\n }\n\n // On open, focus the search field (or the active row). Initial focus only.\n // biome-ignore lint/correctness/useExhaustiveDependencies: re-running on activeValue would steal focus while navigating the tree.\n useEffect(() => {\n if (!open) return\n const id = requestAnimationFrame(() => {\n // preventScroll: the content is portaled, so focusing it before the\n // positioner places it would otherwise warp the page to the top.\n if (searchable) searchRef.current?.focus({ preventScroll: true })\n else if (activeValue) rowRefs.current.get(activeValue)?.focus({ preventScroll: true })\n })\n return () => cancelAnimationFrame(id)\n }, [open, searchable])\n\n const moveActive = (dir: 1 | -1) => {\n if (values.length === 0) return\n const idx = activeValue ? values.indexOf(activeValue) : -1\n const next =\n idx === -1\n ? dir === 1\n ? 0\n : values.length - 1\n : Math.min(Math.max(idx + dir, 0), values.length - 1)\n focusRow(values[next])\n }\n\n const onTreeKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n switch (event.key) {\n case \"ArrowDown\":\n event.preventDefault()\n moveActive(1)\n break\n case \"ArrowUp\":\n event.preventDefault()\n moveActive(-1)\n break\n case \"Home\":\n event.preventDefault()\n focusRow(values[0])\n break\n case \"End\":\n event.preventDefault()\n focusRow(values[values.length - 1])\n break\n case \" \":\n case \"Enter\":\n event.preventDefault()\n if (activeValue != null) onActivate(activeValue)\n break\n default:\n // Single printable key (no modifier) drives type-ahead. Space never\n // reaches here — it's handled above as \"activate\".\n if (event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) {\n event.preventDefault()\n typeToFocus(event.key)\n }\n }\n }\n\n const onSearchKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === \"ArrowDown\") {\n event.preventDefault()\n focusRow(values[0])\n }\n }\n\n /** Spread on each focusable row: its ref and `data-active`. The row sets its own roving\n * `tabIndex={value === activeValue ? 0 : -1}`, where the a11y lint can see it. */\n const rowProps = (value: string) => ({\n ref: (el: HTMLElement | null) => {\n if (el) rowRefs.current.set(value, el)\n else rowRefs.current.delete(value)\n },\n ...props({ \"data-active\": value === activeValue }),\n })\n\n return { activeValue, setActiveValue, searchRef, rowProps, onTreeKeyDown, onSearchKeyDown }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { fieldA11yProps } from './chunk-
|
|
1
|
+
import { useInheritedDisabled, useInheritedInvalid, fieldA11yProps } from './chunk-2RRTT4AF.js';
|
|
2
2
|
import { props } from './chunk-WYCMIIRR.js';
|
|
3
3
|
import { TEXT_COLOR_CLASSES } from './chunk-GIPQUKCN.js';
|
|
4
4
|
import { cn } from './chunk-4ASNIDV7.js';
|
|
@@ -139,6 +139,9 @@ var InputBase = ({
|
|
|
139
139
|
// inline padding when an adornment sits there (`data-with-*-slot:`).
|
|
140
140
|
"data-with-start-slot": startSlot != null,
|
|
141
141
|
"data-with-end-slot": endSlot != null,
|
|
142
|
+
// The visible box of the control. A tour step that targets the inner
|
|
143
|
+
// input spotlights this instead (`spotlightTarget` in `tour/runtime.ts`).
|
|
144
|
+
"data-frame": true,
|
|
142
145
|
// Only meaningful when `InputBase` is used bare (no `Input`-style inner
|
|
143
146
|
// control routing its own `testId`) — a `testId` given to a control that
|
|
144
147
|
// wraps `InputBase` itself (Input, NumberInput, Select, …) always lands
|
|
@@ -169,6 +172,8 @@ var Input = ({
|
|
|
169
172
|
...rest
|
|
170
173
|
}) => {
|
|
171
174
|
const field = useFieldContext();
|
|
175
|
+
const isDisabled = useInheritedDisabled(disabled);
|
|
176
|
+
const isInvalid = useInheritedInvalid(invalid);
|
|
172
177
|
const fieldInputProps = field?.getInputProps();
|
|
173
178
|
return /* @__PURE__ */ jsx(
|
|
174
179
|
InputBase,
|
|
@@ -185,8 +190,8 @@ var Input = ({
|
|
|
185
190
|
endSlot: classNames?.endSlot
|
|
186
191
|
},
|
|
187
192
|
...props({
|
|
188
|
-
disabled:
|
|
189
|
-
invalid:
|
|
193
|
+
disabled: isDisabled,
|
|
194
|
+
invalid: isInvalid,
|
|
190
195
|
readOnly: readOnly || field?.readOnly
|
|
191
196
|
}),
|
|
192
197
|
children: /* @__PURE__ */ jsx(
|
|
@@ -195,8 +200,8 @@ var Input = ({
|
|
|
195
200
|
...fieldInputProps,
|
|
196
201
|
...fieldA11yProps(field),
|
|
197
202
|
...props({
|
|
198
|
-
disabled:
|
|
199
|
-
"aria-invalid":
|
|
203
|
+
disabled: isDisabled,
|
|
204
|
+
"aria-invalid": isInvalid,
|
|
200
205
|
readOnly: readOnly || field?.readOnly,
|
|
201
206
|
"data-testid": testId
|
|
202
207
|
}),
|
|
@@ -209,5 +214,5 @@ var Input = ({
|
|
|
209
214
|
};
|
|
210
215
|
|
|
211
216
|
export { Input, InputBase, inputControlClasses, inputShell, inputSlot, placeholderColor, shellChrome, shellGap, shellVariants };
|
|
212
|
-
//# sourceMappingURL=chunk-
|
|
213
|
-
//# sourceMappingURL=chunk-
|
|
217
|
+
//# sourceMappingURL=chunk-HTVICHT4.js.map
|
|
218
|
+
//# sourceMappingURL=chunk-HTVICHT4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/input/input.tsx"],"names":[],"mappings":";;;;;;;;;AAwCO,IAAM,mBAAA,GAAsB,EAAA;AAAA,EACjC,uEAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,6BAAA;AAAA,EACA,iCAAA;AAAA,EACA,0DAAA;AAAA,EACA;AACF;AAQO,IAAM,WAAA,GAAc;AAAA,EACzB,wDAAA;AAAA,EACA,kBAAA,CAAmB,OAAA;AAAA,EACnB,4CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,mLAAA;AAAA;AAAA;AAAA,EAGA,8KAAA;AAAA;AAAA,EAEA,2DAAA;AAAA,EACA,0BAAA;AAAA,EACA,6BAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA;AACF;AAGO,IAAM,aAAA,GAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ3B,OAAA,EAAS,CAAC,YAAA,EAAc,0CAA0C,CAAA;AAAA;AAAA;AAAA,EAGlE,QAAA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A,UACD,SAAA,EAAW,EAAA,CAAG,mBAAA,EAAqB,UAAA,EAAY,KAAK,CAAA;AAAA,UACnD,GAAG;AAAA;AAAA;AACN;AAAA,GACF;AAEJ","file":"chunk-HTVICHT4.js","sourcesContent":["\"use client\"\n\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport { useFieldContext } from \"@ark-ui/react/field\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport type { ReactNode, Ref } from \"react\"\nimport type { NoAsChild } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TEXT_COLOR_CLASSES } from \"../../lib/typography-size\"\nimport { fieldA11yProps, useInheritedDisabled, useInheritedInvalid } from \"../field/field\"\n\n/**\n * Input / InputBase — the styled input *shell* the whole form family renders\n * into (Select trigger, Combobox/Autocomplete search field, PillsInput, and\n * `TextInput`). It is deliberately the lowest layer: label / description /\n * error live in `Field`, not here — reach for `TextInput` when you want them\n * built in, which is the common case, and for `Input` when you're composing\n * the shell yourself or the control needs no accessible name of its own.\n *\n * - `InputBase` is the polymorphic shell. It draws the bordered box, the\n * focus-visible ring, the disabled / invalid states, and lays out\n * an optional `startSlot` / `endSlot` around a single control child. The\n * child can be anything — an `<input>`, a `<button>` (Select trigger), or a\n * `<div>` of pills (PillsInput). Style your control with the exported\n * `inputControlClasses` so it sits flush inside the shell.\n * - `Input` is `InputBase` wrapping a real `<input>`. Native\n * input props (`value`, `onChange`, `placeholder`, `name`, `type`, `ref`, …)\n * are forwarded straight to the element; `className` styles the shell root\n * (matching the kit's other components), and `classNames` overrides parts.\n *\n * The shell is palette-independent, so there is no `color` prop: the focus halo\n * and border are a fixed `brand-500` per the 42 UI Kit Figma (see `shellChrome`),\n * and `de33dee` removed both `color` and the `filled` variant. `invalid` swaps\n * the border / ring to red.\n */\n\n/** Inner-control reset — apply to whatever element you nest inside `InputBase`\n * (input, button, …) so it inherits the shell's font and fills the row. */\nexport const inputControlClasses = cn(\n \"w-full flex-1 min-w-0 appearance-none border-0 bg-transparent p-0 m-0\",\n // `font: inherit` is the canonical form-control reset — without it the UA\n // forces its own font-size and the shell's `size` text scale is ignored.\n // No `text-trim`: a native `<input>`'s text renders inside the UA's own\n // form-control internals, not a normal CSS line box, so `text-box-trim`\n // computes an inconsistent (content-dependent) box height there — Chrome\n // was scrolling the text vertically once its computed box stopped matching\n // the element's actual rendered height.\n \"font-[inherit] text-inherit\",\n \"outline-none focus:outline-none\",\n \"placeholder:text-black/50 dark:placeholder:text-white/50\",\n \"disabled:cursor-not-allowed\",\n)\n\n/**\n * Shared shell chrome — surface, border, focus ring, and state styling. The\n * single-line `Input` shell and the multi-line `PillsInput` shell both build on\n * these; only the layout (row vs wrap) and the sizing differ, so the visual\n * treatment (incl. the invalid red halo) lives in exactly one place.\n */\nexport const shellChrome = [\n \"group/input relative rounded-input border outline-none\",\n TEXT_COLOR_CLASSES.primary,\n \"transition-[color,box-shadow,border-color]\",\n // Fixed brand-500 focus halo + border, per the 42 UI Kit Figma — independent\n // of the instance's own `color`. The combined selector matches either shape\n // in the family: a shell wrapping a real focusable descendant (Input,\n // Select, Combobox, MultiSelect, ComboboxList, MultiComboboxList, PinInput's\n // per-cell shell) or a shell that IS the tabbable element itself (TreeSelect,\n // TreeMultiSelect). `:has()` alone only matches the former.\n \"[&:is(:focus-visible,:has(:focus-visible))]:border-brand-500 [&:is(:focus-visible,:has(:focus-visible))]:ring-[3px] [&:is(:focus-visible,:has(:focus-visible))]:ring-brand-500/15\",\n // Invalid wins over the palette: red border + red halo. Same combined\n // selector as the rule above so the two can't drift out of sync.\n \"data-invalid:border-red-500 data-invalid:[&:is(:focus-visible,:has(:focus-visible))]:border-red-500 data-invalid:[&:is(:focus-visible,:has(:focus-visible))]:ring-red-500/15\",\n // Disabled affordances on the shell.\n \"data-disabled:cursor-not-allowed data-disabled:opacity-60\",\n \"data-disabled:bg-white/8\",\n \"data-pointer:cursor-pointer\",\n // `:where()` drops every shell svg rule to zero class specificity, so it\n // sizes bare icons (the slot's own, the family's chevron / clear) while a\n // component in a slot that styles its own icons (Kbd, Badge, Spinner…), or\n // a size class on the icon itself, wins whatever the CSS order (#422).\n \"[:where(&)_svg]:pointer-events-none [:where(&)_svg]:shrink-0\",\n]\n\n/** Surface treatment per `variant`, shared across the input shells. */\nexport const shellVariants = {\n // Translucent border to go with the translucent fill: at `bg-white/4` the\n // shell has no ground of its own, so a fixed opaque hairline can vanish (on\n // a light-gray card) or over-assert (on a mid-tone host page). Same hue\n // language as Card's `default` (navy-tinted light / white-tinted dark), one\n // alpha step tighter — these render within a shade of the opaque colors\n // they replace, so the hairline keeps its weight and only gains\n // background-adaptivity.\n default: [\"bg-white/4\", \"border-brand-900/20 dark:border-white/15\"],\n // Escape hatch: strip the chrome but keep the layout (height / slots). Same\n // combined selector as `shellChrome`'s \"on\" rule so the cancel can't drift.\n unstyled: [\n \"border-transparent bg-transparent\",\n \"rounded-none [&:is(:focus-visible,:has(:focus-visible))]:ring-0\",\n ],\n}\n\n/**\n * Inline gap between the shell's slots and control, per `size`. The single\n * source for this spacing: `inputShell` applies it to the shell row, and any\n * control that lays out its *own* slots inside a nested flex (e.g. the Select\n * trigger) reuses it so adornments sit identically across the family.\n */\nexport const shellGap = {\n xs: \"gap-1.5\",\n sm: \"gap-1.5\",\n md: \"gap-2\",\n lg: \"gap-2.5\",\n xl: \"gap-3\",\n} as const\n\n/** Single-line input shell. Reused by the family's button / input controls. */\nexport const inputShell = cva([...shellChrome, \"flex w-full items-center gap-y-0.5\"], {\n variants: {\n variant: shellVariants,\n // Padding is slot-aware: the base is the tight, no-adornment inset, and each\n // side gains a step of inline padding only when `InputBase` flags an\n // adornment there (`data-with-start-slot` / `data-with-end-slot`). These are\n // self-referential `data-*` variants — the attributes live on this same\n // shell element, so a `group-*` variant (which targets descendants) wouldn't\n // match.\n size: {\n xs: [\n \"ps-1.5 pe-1.5\",\n \"data-with-start-slot:ps-2 data-with-end-slot:pe-2\",\n `min-h-7 ${shellGap.xs} text-xs [:where(&)_svg]:size-3`,\n ],\n sm: [\n \"ps-2 pe-2\",\n \"data-with-start-slot:ps-2.5 data-with-end-slot:pe-2.5\",\n `min-h-8 ${shellGap.sm} text-sm [:where(&)_svg]:size-3.5`,\n ],\n md: [\n \"ps-2 pe-2\",\n \"data-with-start-slot:ps-2.5 data-with-end-slot:pe-2.5\",\n `min-h-9 ${shellGap.md} text-md [:where(&)_svg]:size-4`,\n ],\n lg: [\n \"ps-3 pe-3\",\n \"data-with-start-slot:ps-3.5 data-with-end-slot:pe-3.5\",\n `min-h-10 ${shellGap.lg} text-lg [:where(&)_svg]:size-5`,\n ],\n xl: [\n \"ps-3.5 pe-3.5\",\n \"data-with-start-slot:ps-4 data-with-end-slot:pe-4\",\n `min-h-12 ${shellGap.xl} text-xl [:where(&)_svg]:size-6`,\n ],\n },\n },\n defaultVariants: { variant: \"default\", size: \"md\" },\n})\n\n/** Start/end adornment slot — the shared visual contract for the inline-start /\n * inline-end content the whole form family lays out (icon, chevron, clear).\n * Exported so Select / Combobox / the pills controls slot their adornments\n * identically to `InputBase` instead of re-deriving the layout. */\nexport const inputSlot = cn(\n \"inline-flex shrink-0 items-center justify-center\",\n TEXT_COLOR_CLASSES.muted,\n)\n\n/** Muted color for a component's own custom-rendered placeholder / empty-state text — a\n * `<span>` standing in for a native `::placeholder` wherever the value display isn't a real\n * `<input>` (Select's trigger, MultiSelect's non-searchable mode, TreeSelect / TreeMultiSelect's\n * trigger, DatePicker's range-mode trigger). Same color pairing as `inputControlClasses`'s native\n * `::placeholder` rule above. Kept as its own export, not folded into `inputSlot` — `inputSlot`'s\n * `inline-flex items-center justify-center shrink-0` are icon-slot layout rules; forced onto a\n * run of text they'd center it and block it from shrinking, silently breaking truncation on the\n * call sites where this color sits on the same span as `flex-1`/`truncate`. */\nexport const placeholderColor = TEXT_COLOR_CLASSES.muted\n\nexport type InputVariant = NonNullable<VariantProps<typeof inputShell>[\"variant\"]>\nexport type InputSize = NonNullable<VariantProps<typeof inputShell>[\"size\"]>\n\ntype ShellClassNames = {\n /** The shell `<div>` (also targeted by `className`). */\n root?: string\n startSlot?: string\n endSlot?: string\n}\n\n/** Props shared by the shell and the convenience `Input`. */\ntype ShellOwnProps = VariantProps<typeof inputShell> & {\n /** Red border + ring; also wires `aria-invalid` on `Input`. */\n invalid?: boolean\n /** Dims the shell and (on `Input`) disables the element. */\n disabled?: boolean\n /** Keeps full contrast but blocks edits (on `Input`). */\n readOnly?: boolean\n /** `cursor: pointer` — for button-like triggers (Select). */\n pointer?: boolean\n /** Decorative or interactive content at the inline-start of the control. */\n startSlot?: ReactNode\n /** Content at the inline-end — chevron, clear button, spinner. */\n endSlot?: ReactNode\n}\n\nexport type InputBaseProps = NoAsChild<Omit<HTMLArkProps<\"div\">, \"color\">> &\n ShellOwnProps &\n WithTestId & {\n classNames?: ShellClassNames\n }\n\nexport const InputBase = ({\n variant,\n size,\n invalid,\n disabled,\n readOnly,\n pointer,\n startSlot,\n endSlot,\n children,\n className,\n classNames,\n testId,\n asChild: _asChild,\n ...rest\n}: InputBaseProps) => (\n <ark.div\n {...props({\n \"data-invalid\": invalid,\n \"data-disabled\": disabled,\n \"data-readonly\": readOnly,\n \"data-pointer\": pointer,\n // Drive the slot-aware padding in `inputShell`: each side gains a step of\n // inline padding when an adornment sits there (`data-with-*-slot:`).\n \"data-with-start-slot\": startSlot != null,\n \"data-with-end-slot\": endSlot != null,\n // The visible box of the control. A tour step that targets the inner\n // input spotlights this instead (`spotlightTarget` in `tour/runtime.ts`).\n \"data-frame\": true,\n // Only meaningful when `InputBase` is used bare (no `Input`-style inner\n // control routing its own `testId`) — a `testId` given to a control that\n // wraps `InputBase` itself (Input, NumberInput, Select, …) always lands\n // on that control's real interactive element instead, never here.\n \"data-testid\": testId,\n })}\n className={cn(className, classNames?.root, inputShell({ variant, size }))}\n {...rest}\n >\n {startSlot != null && (\n <span className={cn(inputSlot, classNames?.startSlot)} aria-hidden>\n {startSlot}\n </span>\n )}\n {children}\n {endSlot != null && (\n <span className={cn(inputSlot, classNames?.endSlot)} aria-hidden>\n {endSlot}\n </span>\n )}\n </ark.div>\n)\n\nexport type InputProps = Omit<HTMLArkProps<\"input\">, \"size\" | \"color\"> &\n ShellOwnProps &\n WithTestId & {\n /** Lands on the underlying `<input>` for focus-on-error. Declared\n * explicitly because `HTMLArkProps` is `ComponentPropsWithoutRef`, so the\n * native prop types alone don't carry it — same as `Textarea`,\n * `PasswordInput`, and `NumberInput`. */\n ref?: Ref<HTMLInputElement>\n classNames?: ShellClassNames & {\n /** The inner `<input>` element. */\n input?: string\n }\n }\n\nexport const Input = ({\n variant,\n size,\n invalid,\n disabled,\n readOnly,\n pointer,\n startSlot,\n endSlot,\n className,\n classNames,\n testId,\n ...rest\n}: InputProps) => {\n // When nested in a `Field`, inherit its id / aria-describedby / state so the\n // label, description, and error wire up — exactly how Ark's own `Field.Input`\n // behaves. `useFieldContext` is null outside a Field, so this is a no-op then.\n const field = useFieldContext()\n // A `Fieldset` reaches the control even with no `Field` (and so no label)\n // between them: the `<fieldset>` disables the element, this dims the shell.\n const isDisabled = useInheritedDisabled(disabled)\n const isInvalid = useInheritedInvalid(invalid)\n const fieldInputProps = field?.getInputProps()\n\n return (\n <InputBase\n variant={variant}\n size={size}\n pointer={pointer}\n startSlot={startSlot}\n endSlot={endSlot}\n className={className}\n classNames={{\n root: classNames?.root,\n startSlot: classNames?.startSlot,\n endSlot: classNames?.endSlot,\n }}\n {...props({\n disabled: isDisabled,\n invalid: isInvalid,\n readOnly: readOnly || field?.readOnly,\n })}\n >\n <ark.input\n {...fieldInputProps}\n {...fieldA11yProps(field)}\n {...props({\n disabled: isDisabled,\n \"aria-invalid\": isInvalid,\n readOnly: readOnly || field?.readOnly,\n \"data-testid\": testId,\n })}\n className={cn(inputControlClasses, classNames?.input)}\n {...rest}\n />\n </InputBase>\n )\n}\n"]}
|