@42-central/ui-react 0.29.0 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-X6DESK37.js → chunk-2RRTT4AF.js} +17 -5
- package/dist/chunk-2RRTT4AF.js.map +1 -0
- package/dist/{chunk-TUP7WXQE.js → chunk-322I2RSV.js} +9 -6
- package/dist/chunk-322I2RSV.js.map +1 -0
- package/dist/{chunk-ISX3AM32.js → chunk-37SRSNLJ.js} +4 -4
- package/dist/{chunk-ISX3AM32.js.map → chunk-37SRSNLJ.js.map} +1 -1
- package/dist/{chunk-L5GH7LLD.js → chunk-3MFWUG5O.js} +4 -4
- package/dist/{chunk-L5GH7LLD.js.map → chunk-3MFWUG5O.js.map} +1 -1
- package/dist/{chunk-FQJNQW3G.js → chunk-3XQEOJCE.js} +8 -5
- package/dist/chunk-3XQEOJCE.js.map +1 -0
- package/dist/{chunk-JKFPRQB2.js → chunk-4LSZ5JWF.js} +3 -3
- package/dist/{chunk-JKFPRQB2.js.map → chunk-4LSZ5JWF.js.map} +1 -1
- package/dist/{chunk-V2QZG4IT.js → chunk-5HWFYYHW.js} +27 -9
- package/dist/chunk-5HWFYYHW.js.map +1 -0
- package/dist/{chunk-GEZYGBXY.js → chunk-6MVFCS46.js} +99 -42
- package/dist/chunk-6MVFCS46.js.map +1 -0
- package/dist/{chunk-NNPSBC7O.js → chunk-6WZSUS3U.js} +10 -9
- package/dist/chunk-6WZSUS3U.js.map +1 -0
- package/dist/chunk-6YRGP6PS.js +138 -0
- package/dist/chunk-6YRGP6PS.js.map +1 -0
- package/dist/{chunk-B5YHYI7E.js → chunk-ALANKV5Y.js} +23 -6
- package/dist/chunk-ALANKV5Y.js.map +1 -0
- package/dist/{chunk-IA6DCC3N.js → chunk-AUQPNDE5.js} +23 -13
- package/dist/chunk-AUQPNDE5.js.map +1 -0
- package/dist/{chunk-AKXALCUN.js → chunk-D7SW2E24.js} +4 -4
- package/dist/chunk-D7SW2E24.js.map +1 -0
- package/dist/{chunk-OXR7BXZA.js → chunk-DQIYYDFD.js} +4 -3
- package/dist/chunk-DQIYYDFD.js.map +1 -0
- package/dist/{chunk-HMNXNKDA.js → chunk-FCBYUN6F.js} +4 -4
- package/dist/{chunk-HMNXNKDA.js.map → chunk-FCBYUN6F.js.map} +1 -1
- package/dist/{chunk-2W7H43WL.js → chunk-FED6SJWM.js} +23 -14
- package/dist/chunk-FED6SJWM.js.map +1 -0
- package/dist/{chunk-7E7JNWOC.js → chunk-FEPIHXVI.js} +6 -5
- package/dist/chunk-FEPIHXVI.js.map +1 -0
- package/dist/{chunk-Y57NW6G7.js → chunk-G3YOSG3U.js} +4 -4
- package/dist/{chunk-Y57NW6G7.js.map → chunk-G3YOSG3U.js.map} +1 -1
- package/dist/chunk-GZN5CXMR.js +100 -0
- package/dist/chunk-GZN5CXMR.js.map +1 -0
- package/dist/{chunk-HCHGERDB.js → chunk-HCSZPBWV.js} +17 -115
- package/dist/chunk-HCSZPBWV.js.map +1 -0
- package/dist/{chunk-I4B3N3UX.js → chunk-HTVICHT4.js} +12 -7
- package/dist/chunk-HTVICHT4.js.map +1 -0
- package/dist/chunk-I7TC2C3I.js +163 -0
- package/dist/chunk-I7TC2C3I.js.map +1 -0
- package/dist/{chunk-7FPSQBWB.js → chunk-IBXYLO2J.js} +14 -13
- package/dist/chunk-IBXYLO2J.js.map +1 -0
- package/dist/{chunk-7KFUFAVP.js → chunk-IRYG6B5A.js} +9 -8
- package/dist/chunk-IRYG6B5A.js.map +1 -0
- package/dist/{chunk-2RQLPN4U.js → chunk-JCNEW4WJ.js} +8 -8
- package/dist/{chunk-2RQLPN4U.js.map → chunk-JCNEW4WJ.js.map} +1 -1
- package/dist/{chunk-SP6LCCTZ.js → chunk-KZDMVOL6.js} +35 -8
- package/dist/chunk-KZDMVOL6.js.map +1 -0
- package/dist/chunk-LR5U6TZZ.js +169 -0
- package/dist/chunk-LR5U6TZZ.js.map +1 -0
- package/dist/{chunk-MQHD3EJE.js → chunk-LZHZJWVM.js} +6 -4
- package/dist/chunk-LZHZJWVM.js.map +1 -0
- package/dist/{chunk-5EOMSWNO.js → chunk-MAM2X3MW.js} +5 -5
- package/dist/{chunk-5EOMSWNO.js.map → chunk-MAM2X3MW.js.map} +1 -1
- package/dist/{chunk-FSPS7TVD.js → chunk-MCMS4NMO.js} +5 -5
- package/dist/{chunk-FSPS7TVD.js.map → chunk-MCMS4NMO.js.map} +1 -1
- package/dist/{chunk-ZB5VMGKB.js → chunk-MV5DIE2T.js} +15 -4
- package/dist/chunk-MV5DIE2T.js.map +1 -0
- package/dist/chunk-NDI4HLQE.js +41 -0
- package/dist/chunk-NDI4HLQE.js.map +1 -0
- package/dist/{chunk-B4GNSSHU.js → chunk-NLJEQZQQ.js} +3 -3
- package/dist/{chunk-B4GNSSHU.js.map → chunk-NLJEQZQQ.js.map} +1 -1
- package/dist/{chunk-SBZJGFZ6.js → chunk-QHT4DCXE.js} +8 -7
- package/dist/chunk-QHT4DCXE.js.map +1 -0
- package/dist/{chunk-I4IJOLNA.js → chunk-RMUBCTEF.js} +5 -5
- package/dist/{chunk-I4IJOLNA.js.map → chunk-RMUBCTEF.js.map} +1 -1
- package/dist/{chunk-G3AD3NJG.js → chunk-RNTDM3RP.js} +9 -5
- package/dist/chunk-RNTDM3RP.js.map +1 -0
- package/dist/chunk-RPFN6ETQ.js +509 -0
- package/dist/chunk-RPFN6ETQ.js.map +1 -0
- package/dist/{chunk-HWBFRDX7.js → chunk-SI7C3W5M.js} +28 -9
- package/dist/chunk-SI7C3W5M.js.map +1 -0
- package/dist/chunk-TPOV3OCC.js +234 -0
- package/dist/chunk-TPOV3OCC.js.map +1 -0
- package/dist/{chunk-IANYMDKH.js → chunk-UBQ54W46.js} +4 -4
- package/dist/chunk-UBQ54W46.js.map +1 -0
- package/dist/{chunk-QVOBLRCM.js → chunk-UIKQ4X6W.js} +3 -3
- package/dist/{chunk-QVOBLRCM.js.map → chunk-UIKQ4X6W.js.map} +1 -1
- package/dist/chunk-UOWQH53N.js +70 -0
- package/dist/chunk-UOWQH53N.js.map +1 -0
- package/dist/{chunk-QRNQQIQM.js → chunk-WJUY6YWF.js} +52 -20
- package/dist/chunk-WJUY6YWF.js.map +1 -0
- package/dist/{chunk-3KARNPW4.js → chunk-WKIUMLRT.js} +3 -3
- package/dist/{chunk-3KARNPW4.js.map → chunk-WKIUMLRT.js.map} +1 -1
- package/dist/chunk-X6RB74JN.js +37 -0
- package/dist/chunk-X6RB74JN.js.map +1 -0
- package/dist/chunk-XQ6L2CM5.js +83 -0
- package/dist/chunk-XQ6L2CM5.js.map +1 -0
- package/dist/{chunk-RKCUXOU2.js → chunk-YUVKROMA.js} +44 -7
- package/dist/chunk-YUVKROMA.js.map +1 -0
- package/dist/components/action-icon/action-icon.d.ts +9 -2
- package/dist/components/action-icon/action-icon.d.ts.map +1 -1
- package/dist/components/action-icon/index.js +5 -1
- package/dist/components/alert/index.js +4 -4
- package/dist/components/anchor/anchor.d.ts +45 -0
- package/dist/components/anchor/anchor.d.ts.map +1 -0
- package/dist/components/anchor/index.d.ts +2 -0
- package/dist/components/anchor/index.d.ts.map +1 -0
- package/dist/components/anchor/index.js +11 -0
- package/dist/components/anchor/index.js.map +1 -0
- package/dist/components/app-shell/app-shell.d.ts +10 -6
- package/dist/components/app-shell/app-shell.d.ts.map +1 -1
- package/dist/components/app-shell/index.js +23 -24
- package/dist/components/app-shell/index.js.map +1 -1
- package/dist/components/autocomplete/autocomplete.d.ts +1 -1
- package/dist/components/autocomplete/autocomplete.d.ts.map +1 -1
- package/dist/components/autocomplete/index.js +15 -9
- package/dist/components/autocomplete/index.js.map +1 -1
- package/dist/components/avatar/index.js +1 -1
- package/dist/components/button/button.d.ts +15 -2
- package/dist/components/button/button.d.ts.map +1 -1
- package/dist/components/button/index.js +5 -1
- package/dist/components/button-multi-select/index.js +6 -4
- package/dist/components/button-multi-select/index.js.map +1 -1
- package/dist/components/button-select/button-select-control.d.ts.map +1 -1
- package/dist/components/button-select/button-select.d.ts +2 -2
- package/dist/components/button-select/button-select.d.ts.map +1 -1
- package/dist/components/button-select/index.js +6 -4
- package/dist/components/button-select/index.js.map +1 -1
- package/dist/components/calendar/aliases.d.ts +16 -0
- package/dist/components/calendar/aliases.d.ts.map +1 -0
- package/dist/components/calendar/calendar-body.d.ts +11 -1
- package/dist/components/calendar/calendar-body.d.ts.map +1 -1
- package/dist/components/calendar/calendar.d.ts +8 -4
- package/dist/components/calendar/calendar.d.ts.map +1 -1
- package/dist/components/calendar/index.d.ts +2 -1
- package/dist/components/calendar/index.d.ts.map +1 -1
- package/dist/components/calendar/index.js +15 -5
- package/dist/components/calendar/index.js.map +1 -1
- package/dist/components/calendar-heatmap/calendar-heatmap.d.ts.map +1 -1
- package/dist/components/calendar-heatmap/index.js +85 -73
- package/dist/components/calendar-heatmap/index.js.map +1 -1
- package/dist/components/camera/index.js +16 -14
- package/dist/components/carousel/index.js +3 -3
- package/dist/components/checkbox/checkbox.d.ts.map +1 -1
- package/dist/components/checkbox/index.js +2 -2
- package/dist/components/choice-card-group/index.js +2 -2
- package/dist/components/choice-card-group/index.js.map +1 -1
- package/dist/components/circular-progress/circular-progress.d.ts +22 -11
- package/dist/components/circular-progress/circular-progress.d.ts.map +1 -1
- package/dist/components/circular-progress/index.d.ts +1 -1
- package/dist/components/circular-progress/index.d.ts.map +1 -1
- package/dist/components/circular-progress/index.js +68 -49
- package/dist/components/circular-progress/index.js.map +1 -1
- package/dist/components/clipboard/index.js +7 -3
- package/dist/components/clipboard/index.js.map +1 -1
- package/dist/components/code/code.d.ts +10 -0
- package/dist/components/code/code.d.ts.map +1 -1
- package/dist/components/code/index.js +1 -0
- package/dist/components/code/index.js.map +1 -1
- package/dist/components/code-block/chrome.js +10 -6
- package/dist/components/code-block/index.js +10 -7
- package/dist/components/code-block/index.js.map +1 -1
- package/dist/components/combobox/combobox.d.ts +5 -3
- package/dist/components/combobox/combobox.d.ts.map +1 -1
- package/dist/components/combobox/index.js +12 -7
- package/dist/components/combobox-list/combobox-list.d.ts +1 -1
- package/dist/components/combobox-list/combobox-list.d.ts.map +1 -1
- package/dist/components/combobox-list/index.js +14 -9
- package/dist/components/compare/index.js +1 -1
- package/dist/components/data-list/data-list.d.ts +96 -0
- package/dist/components/data-list/data-list.d.ts.map +1 -0
- package/dist/components/data-list/index.d.ts +2 -0
- package/dist/components/data-list/index.d.ts.map +1 -0
- package/dist/components/data-list/index.js +147 -0
- package/dist/components/data-list/index.js.map +1 -0
- package/dist/components/data-table/data-table-group.d.ts.map +1 -1
- package/dist/components/data-table/data-table-placeholder.d.ts +12 -1
- package/dist/components/data-table/data-table-placeholder.d.ts.map +1 -1
- package/dist/components/data-table/data-table-stack.d.ts.map +1 -1
- package/dist/components/data-table/data-table.d.ts +5 -2
- package/dist/components/data-table/data-table.d.ts.map +1 -1
- package/dist/components/data-table/index.js +163 -168
- package/dist/components/data-table/index.js.map +1 -1
- package/dist/components/date-picker/aliases.d.ts +16 -0
- package/dist/components/date-picker/aliases.d.ts.map +1 -1
- package/dist/components/date-picker/date-picker.d.ts +22 -8
- package/dist/components/date-picker/date-picker.d.ts.map +1 -1
- package/dist/components/date-picker/index.d.ts +2 -2
- package/dist/components/date-picker/index.d.ts.map +1 -1
- package/dist/components/date-picker/index.js +34 -28
- package/dist/components/date-picker/index.js.map +1 -1
- package/dist/components/download-button/index.js +6 -2
- package/dist/components/drawer/drawer.d.ts +7 -4
- package/dist/components/drawer/drawer.d.ts.map +1 -1
- package/dist/components/drawer/index.js +11 -6
- package/dist/components/empty-state/empty-state.d.ts +57 -0
- package/dist/components/empty-state/empty-state.d.ts.map +1 -0
- package/dist/components/empty-state/index.d.ts +2 -0
- package/dist/components/empty-state/index.d.ts.map +1 -0
- package/dist/components/empty-state/index.js +8 -0
- package/dist/components/empty-state/index.js.map +1 -0
- package/dist/components/field/field.d.ts +20 -0
- package/dist/components/field/field.d.ts.map +1 -1
- package/dist/components/field/index.js +1 -1
- package/dist/components/fieldset/fieldset.d.ts +103 -0
- package/dist/components/fieldset/fieldset.d.ts.map +1 -0
- package/dist/components/fieldset/index.d.ts +2 -0
- package/dist/components/fieldset/index.d.ts.map +1 -0
- package/dist/components/fieldset/index.js +150 -0
- package/dist/components/fieldset/index.js.map +1 -0
- package/dist/components/file-item/index.js +10 -7
- package/dist/components/file-preview/file-preview.d.ts.map +1 -1
- package/dist/components/file-preview/index.js +10 -18
- package/dist/components/file-preview/index.js.map +1 -1
- package/dist/components/file-trigger/index.js +6 -2
- package/dist/components/file-upload/file-upload.d.ts.map +1 -1
- package/dist/components/file-upload/index.js +18 -14
- package/dist/components/file-upload/index.js.map +1 -1
- package/dist/components/gallery/index.js +3 -3
- package/dist/components/geodesic/a11y.d.ts +3 -3
- package/dist/components/geodesic/a11y.d.ts.map +1 -1
- package/dist/components/hover-card/hover-card.d.ts.map +1 -1
- package/dist/components/hover-card/index.js +10 -3
- package/dist/components/hover-card/index.js.map +1 -1
- package/dist/components/image/index.js +3 -3
- package/dist/components/image-cropper/index.js +9 -6
- package/dist/components/input/index.js +2 -2
- package/dist/components/input/input.d.ts.map +1 -1
- package/dist/components/kbd/index.js +3 -3
- package/dist/components/kbd/kbd.d.ts +4 -0
- package/dist/components/kbd/kbd.d.ts.map +1 -1
- package/dist/components/lightbox/index.js +13 -11
- package/dist/components/lightbox/index.js.map +1 -1
- package/dist/components/menu/index.js +9 -5
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/menu/menu.d.ts.map +1 -1
- package/dist/components/modal/index.js +11 -6
- package/dist/components/modal/modal.d.ts +10 -4
- package/dist/components/modal/modal.d.ts.map +1 -1
- package/dist/components/multi-combobox-list/index.js +13 -9
- package/dist/components/multi-combobox-list/multi-combobox-list.d.ts +1 -1
- package/dist/components/multi-combobox-list/multi-combobox-list.d.ts.map +1 -1
- package/dist/components/multi-select/index.js +13 -10
- package/dist/components/multi-select/index.js.map +1 -1
- package/dist/components/multi-select/multi-select.d.ts +1 -1
- package/dist/components/multi-select/multi-select.d.ts.map +1 -1
- package/dist/components/nav-link/index.js +4 -4
- package/dist/components/nav-link/tanstack.js +4 -4
- package/dist/components/notification/index.js +6 -6
- package/dist/components/notification/index.js.map +1 -1
- package/dist/components/number-input/index.js +11 -7
- package/dist/components/number-input/number-input.d.ts +1 -1
- package/dist/components/number-input/number-input.d.ts.map +1 -1
- package/dist/components/overlays/dialog-parts.d.ts +10 -1
- package/dist/components/overlays/dialog-parts.d.ts.map +1 -1
- package/dist/components/overlays/index.js +13 -8
- package/dist/components/overlays/index.js.map +1 -1
- package/dist/components/pagination/index.d.ts +2 -0
- package/dist/components/pagination/index.d.ts.map +1 -0
- package/dist/components/pagination/index.js +362 -0
- package/dist/components/pagination/index.js.map +1 -0
- package/dist/components/pagination/pagination.d.ts +147 -0
- package/dist/components/pagination/pagination.d.ts.map +1 -0
- package/dist/components/password-input/index.js +6 -5
- package/dist/components/password-input/index.js.map +1 -1
- package/dist/components/password-input/password-input.d.ts +1 -1
- package/dist/components/password-input/password-input.d.ts.map +1 -1
- package/dist/components/phone-input/index.js +14 -11
- package/dist/components/phone-input/index.js.map +1 -1
- package/dist/components/phone-input/phone-input.d.ts +1 -1
- package/dist/components/phone-input/phone-input.d.ts.map +1 -1
- package/dist/components/photo-capture/index.js +19 -17
- package/dist/components/photo-capture/index.js.map +1 -1
- package/dist/components/pills-input/index.js +4 -4
- package/dist/components/pills-input/pills-input.d.ts +1 -1
- package/dist/components/pills-input/pills-input.d.ts.map +1 -1
- package/dist/components/pin-input/index.js +6 -5
- package/dist/components/pin-input/index.js.map +1 -1
- package/dist/components/pin-input/pin-input.d.ts.map +1 -1
- package/dist/components/popover/index.js +7 -2
- package/dist/components/popover/popover.d.ts +41 -16
- package/dist/components/popover/popover.d.ts.map +1 -1
- package/dist/components/progress/index.d.ts +1 -1
- package/dist/components/progress/index.d.ts.map +1 -1
- package/dist/components/progress/index.js +4 -1
- package/dist/components/progress/progress.d.ts +22 -14
- package/dist/components/progress/progress.d.ts.map +1 -1
- package/dist/components/prose/index.d.ts +2 -0
- package/dist/components/prose/index.d.ts.map +1 -0
- package/dist/components/prose/index.js +17 -0
- package/dist/components/prose/index.js.map +1 -0
- package/dist/components/prose/prose.d.ts +49 -0
- package/dist/components/prose/prose.d.ts.map +1 -0
- package/dist/components/prose/styles.css +593 -0
- package/dist/components/radio-group/index.js +9 -3
- package/dist/components/radio-group/index.js.map +1 -1
- package/dist/components/radio-group/radio-group.d.ts.map +1 -1
- package/dist/components/rating/index.js +3 -2
- package/dist/components/rating/index.js.map +1 -1
- package/dist/components/rating/rating.d.ts.map +1 -1
- package/dist/components/schedule/index.js +10 -8
- package/dist/components/schedule/index.js.map +1 -1
- package/dist/components/scroll-area/index.d.ts +2 -0
- package/dist/components/scroll-area/index.d.ts.map +1 -0
- package/dist/components/scroll-area/index.js +10 -0
- package/dist/components/scroll-area/index.js.map +1 -0
- package/dist/components/scroll-area/scroll-area.d.ts +150 -0
- package/dist/components/scroll-area/scroll-area.d.ts.map +1 -0
- package/dist/components/segment-group/index.js +2 -2
- package/dist/components/segment-group/segment-group.d.ts.map +1 -1
- package/dist/components/select/index.js +12 -8
- package/dist/components/select/select.d.ts +1 -1
- package/dist/components/select/select.d.ts.map +1 -1
- package/dist/components/slider/index.js +2 -2
- package/dist/components/slider/slider.d.ts.map +1 -1
- package/dist/components/splitter/index.d.ts +2 -0
- package/dist/components/splitter/index.d.ts.map +1 -0
- package/dist/components/splitter/index.js +373 -0
- package/dist/components/splitter/index.js.map +1 -0
- package/dist/components/splitter/splitter.d.ts +159 -0
- package/dist/components/splitter/splitter.d.ts.map +1 -0
- package/dist/components/spotlight/index.js +23 -22
- package/dist/components/spotlight/index.js.map +1 -1
- package/dist/components/spotlight/spotlight.d.ts.map +1 -1
- package/dist/components/steps/index.d.ts +4 -0
- package/dist/components/steps/index.d.ts.map +1 -0
- package/dist/components/steps/index.js +478 -0
- package/dist/components/steps/index.js.map +1 -0
- package/dist/components/steps/steps-data.d.ts +78 -0
- package/dist/components/steps/steps-data.d.ts.map +1 -0
- package/dist/components/steps/steps.d.ts +183 -0
- package/dist/components/steps/steps.d.ts.map +1 -0
- package/dist/components/switch/index.js +4 -3
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/switch/switch.d.ts.map +1 -1
- package/dist/components/table-of-contents/index.d.ts +2 -0
- package/dist/components/table-of-contents/index.d.ts.map +1 -0
- package/dist/components/table-of-contents/index.js +471 -0
- package/dist/components/table-of-contents/index.js.map +1 -0
- package/dist/components/table-of-contents/table-of-contents.d.ts +173 -0
- package/dist/components/table-of-contents/table-of-contents.d.ts.map +1 -0
- package/dist/components/tags-input/index.js +12 -9
- package/dist/components/tags-input/index.js.map +1 -1
- package/dist/components/tags-input/tags-input.d.ts +1 -1
- package/dist/components/tags-input/tags-input.d.ts.map +1 -1
- package/dist/components/text-input/index.js +2 -2
- package/dist/components/textarea/index.js +8 -6
- package/dist/components/textarea/index.js.map +1 -1
- package/dist/components/textarea/textarea.d.ts.map +1 -1
- package/dist/components/time-input/index.js +11 -9
- package/dist/components/time-input/index.js.map +1 -1
- package/dist/components/timeline/index.js +8 -1
- package/dist/components/timeline/index.js.map +1 -1
- package/dist/components/timeline/timeline.d.ts.map +1 -1
- package/dist/components/tooltip/index.js +1 -1
- package/dist/components/tooltip/tooltip.d.ts +3 -8
- package/dist/components/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/tour/conditions.d.ts +83 -0
- package/dist/components/tour/conditions.d.ts.map +1 -0
- package/dist/components/tour/create-tours.d.ts +49 -0
- package/dist/components/tour/create-tours.d.ts.map +1 -0
- package/dist/components/tour/index.d.ts +6 -0
- package/dist/components/tour/index.d.ts.map +1 -0
- package/dist/components/tour/index.js +1449 -0
- package/dist/components/tour/index.js.map +1 -0
- package/dist/components/tour/runtime.d.ts +57 -0
- package/dist/components/tour/runtime.d.ts.map +1 -0
- package/dist/components/tour/storage.d.ts +14 -0
- package/dist/components/tour/storage.d.ts.map +1 -0
- package/dist/components/tour/store.d.ts +62 -0
- package/dist/components/tour/store.d.ts.map +1 -0
- package/dist/components/tour/tour.d.ts +77 -0
- package/dist/components/tour/tour.d.ts.map +1 -0
- package/dist/components/tour/types.d.ts +680 -0
- package/dist/components/tour/types.d.ts.map +1 -0
- package/dist/components/tree/index.d.ts +3 -0
- package/dist/components/tree/index.d.ts.map +1 -0
- package/dist/components/tree/index.js +457 -0
- package/dist/components/tree/index.js.map +1 -0
- package/dist/components/tree/tree-row.d.ts +72 -0
- package/dist/components/tree/tree-row.d.ts.map +1 -0
- package/dist/components/tree/tree.d.ts +193 -0
- package/dist/components/tree/tree.d.ts.map +1 -0
- package/dist/components/tree-multi-select/index.js +31 -54
- package/dist/components/tree-multi-select/index.js.map +1 -1
- package/dist/components/tree-multi-select/tree-multi-select.d.ts +16 -1
- package/dist/components/tree-multi-select/tree-multi-select.d.ts.map +1 -1
- package/dist/components/tree-select/index.js +30 -24
- package/dist/components/tree-select/index.js.map +1 -1
- package/dist/components/tree-select/tree-popover.d.ts +20 -31
- package/dist/components/tree-select/tree-popover.d.ts.map +1 -1
- package/dist/components/tree-select/tree-select.d.ts +1 -1
- package/dist/components/tree-select/tree-select.d.ts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -8
- package/dist/index.js.map +1 -1
- package/dist/lib/date-predicates.d.ts +7 -5
- package/dist/lib/date-predicates.d.ts.map +1 -1
- package/dist/lib/date-value.d.ts +20 -0
- package/dist/lib/date-value.d.ts.map +1 -1
- package/dist/lib/floating-arrow.d.ts +53 -0
- package/dist/lib/floating-arrow.d.ts.map +1 -0
- package/dist/lib/focus-return.d.ts +53 -0
- package/dist/lib/focus-return.d.ts.map +1 -0
- package/dist/lib/meter.d.ts +104 -0
- package/dist/lib/meter.d.ts.map +1 -0
- package/dist/lib/overlay-layer.d.ts +26 -8
- package/dist/lib/overlay-layer.d.ts.map +1 -1
- package/dist/lib/pressed.d.ts +92 -0
- package/dist/lib/pressed.d.ts.map +1 -0
- package/dist/lib/tree-data.d.ts +18 -2
- package/dist/lib/tree-data.d.ts.map +1 -1
- package/dist/lib/use-pagination.d.ts +102 -0
- package/dist/lib/use-pagination.d.ts.map +1 -0
- package/dist/lib/use-scroll-spy.d.ts +126 -0
- package/dist/lib/use-scroll-spy.d.ts.map +1 -0
- package/dist/theme.css +39 -3
- package/package.json +1 -1
- package/src/as-child.contract.test.tsx +283 -1
- package/src/components/action-icon/action-icon.tsx +34 -4
- package/src/components/anchor/anchor.test.tsx +232 -0
- package/src/components/anchor/anchor.tsx +187 -0
- package/src/components/anchor/index.ts +12 -0
- package/src/components/app-shell/app-shell.test.tsx +15 -7
- package/src/components/app-shell/app-shell.tsx +27 -20
- package/src/components/autocomplete/autocomplete.tsx +11 -3
- package/src/components/button/button-pressed.test.tsx +202 -0
- package/src/components/button/button.tsx +48 -6
- package/src/components/button-select/button-select-control.tsx +2 -2
- package/src/components/button-select/button-select.tsx +22 -2
- package/src/components/calendar/aliases.tsx +28 -0
- package/src/components/calendar/calendar-body.tsx +310 -210
- package/src/components/calendar/calendar.tsx +43 -12
- package/src/components/calendar/index.ts +7 -1
- package/src/components/calendar/month-year-calendar.test.tsx +106 -0
- package/src/components/calendar-heatmap/calendar-heatmap.tsx +88 -73
- package/src/components/checkbox/checkbox.tsx +7 -2
- package/src/components/choice-card-group/choice-card-group.tsx +2 -2
- package/src/components/circular-progress/circular-progress.test.tsx +35 -0
- package/src/components/circular-progress/circular-progress.tsx +116 -59
- package/src/components/circular-progress/index.ts +1 -0
- package/src/components/code/code.test.tsx +16 -0
- package/src/components/code/code.tsx +11 -0
- package/src/components/combobox/combobox.tsx +63 -28
- package/src/components/combobox-list/combobox-list.tsx +11 -3
- package/src/components/data-list/data-list.test.tsx +149 -0
- package/src/components/data-list/data-list.tsx +268 -0
- package/src/components/data-list/index.ts +9 -0
- package/src/components/data-table/data-table-group.test.tsx +16 -0
- package/src/components/data-table/data-table-group.tsx +15 -2
- package/src/components/data-table/data-table-placeholder.tsx +28 -36
- package/src/components/data-table/data-table-stack.tsx +33 -39
- package/src/components/data-table/data-table.test.tsx +31 -0
- package/src/components/data-table/data-table.tsx +41 -42
- package/src/components/date-picker/aliases.tsx +28 -0
- package/src/components/date-picker/date-picker.test.tsx +29 -0
- package/src/components/date-picker/date-picker.tsx +164 -45
- package/src/components/date-picker/index.ts +5 -1
- package/src/components/date-picker/month-year-picker.test.tsx +362 -0
- package/src/components/drawer/drawer.test.tsx +41 -0
- package/src/components/drawer/drawer.tsx +7 -1
- package/src/components/empty-state/empty-state.test.tsx +109 -0
- package/src/components/empty-state/empty-state.tsx +180 -0
- package/src/components/empty-state/index.ts +9 -0
- package/src/components/field/field.tsx +35 -1
- package/src/components/fieldset/fieldset.test.tsx +352 -0
- package/src/components/fieldset/fieldset.tsx +268 -0
- package/src/components/fieldset/index.ts +11 -0
- package/src/components/file-preview/file-preview.test.tsx +2 -1
- package/src/components/file-preview/file-preview.tsx +7 -13
- package/src/components/file-upload/file-upload.tsx +14 -5
- package/src/components/hover-card/hover-card.tsx +5 -1
- package/src/components/input/input.tsx +12 -5
- package/src/components/kbd/kbd.test.tsx +13 -0
- package/src/components/kbd/kbd.tsx +6 -0
- package/src/components/menu/menu.tsx +6 -2
- package/src/components/modal/modal.test.tsx +41 -0
- package/src/components/modal/modal.tsx +17 -9
- package/src/components/multi-combobox-list/multi-combobox-list.tsx +11 -3
- package/src/components/multi-select/multi-select.tsx +11 -3
- package/src/components/notification/create-notifier.tsx +1 -1
- package/src/components/number-input/number-input.tsx +12 -3
- package/src/components/overlays/dialog-parts.tsx +42 -5
- package/src/components/pagination/index.ts +19 -0
- package/src/components/pagination/pagination.test.tsx +187 -0
- package/src/components/pagination/pagination.tsx +563 -0
- package/src/components/password-input/password-input.tsx +12 -3
- package/src/components/phone-input/phone-input.tsx +12 -3
- package/src/components/pills-input/pills-input.tsx +7 -2
- package/src/components/pin-input/pin-input.tsx +13 -4
- package/src/components/popover/popover.tsx +87 -17
- package/src/components/progress/index.ts +1 -0
- package/src/components/progress/progress.test.tsx +102 -0
- package/src/components/progress/progress.tsx +116 -62
- package/src/components/prose/index.ts +1 -0
- package/src/components/prose/prose.test.tsx +90 -0
- package/src/components/prose/prose.tsx +60 -0
- package/src/components/prose/styles.css +593 -0
- package/src/components/radio-group/radio-group.tsx +8 -3
- package/src/components/rating/rating.tsx +5 -2
- package/src/components/scroll-area/index.ts +18 -0
- package/src/components/scroll-area/scroll-area.test.tsx +184 -0
- package/src/components/scroll-area/scroll-area.tsx +448 -0
- package/src/components/segment-group/segment-group.tsx +2 -2
- package/src/components/select/select.tsx +37 -18
- package/src/components/slider/slider.tsx +2 -2
- package/src/components/splitter/index.ts +15 -0
- package/src/components/splitter/splitter.test.tsx +244 -0
- package/src/components/splitter/splitter.tsx +625 -0
- package/src/components/spotlight/spotlight.test.tsx +34 -26
- package/src/components/spotlight/spotlight.tsx +7 -9
- package/src/components/steps/index.ts +21 -0
- package/src/components/steps/steps-data.tsx +179 -0
- package/src/components/steps/steps.test.tsx +235 -0
- package/src/components/steps/steps.tsx +686 -0
- package/src/components/switch/switch.tsx +7 -2
- package/src/components/table-of-contents/index.ts +17 -0
- package/src/components/table-of-contents/table-of-contents.test.tsx +289 -0
- package/src/components/table-of-contents/table-of-contents.tsx +708 -0
- package/src/components/tags-input/tags-input.tsx +12 -3
- package/src/components/textarea/textarea.tsx +15 -5
- package/src/components/timeline/timeline.test.tsx +22 -0
- package/src/components/timeline/timeline.tsx +10 -1
- package/src/components/tooltip/tooltip.tsx +8 -17
- package/src/components/tour/conditions.test.ts +527 -0
- package/src/components/tour/conditions.ts +445 -0
- package/src/components/tour/create-tours.tsx +150 -0
- package/src/components/tour/index.ts +86 -0
- package/src/components/tour/runtime.ts +187 -0
- package/src/components/tour/storage.test.ts +68 -0
- package/src/components/tour/storage.ts +44 -0
- package/src/components/tour/store.test.tsx +784 -0
- package/src/components/tour/store.ts +661 -0
- package/src/components/tour/tour.test.tsx +318 -0
- package/src/components/tour/tour.tsx +773 -0
- package/src/components/tour/tour.types.test.ts +185 -0
- package/src/components/tour/types.ts +904 -0
- package/src/components/tree/index.ts +24 -0
- package/src/components/tree/tree-row.tsx +179 -0
- package/src/components/tree/tree.test.tsx +296 -0
- package/src/components/tree/tree.tsx +796 -0
- package/src/components/tree-multi-select/tree-multi-select.tsx +29 -58
- package/src/components/tree-select/tree-popover.tsx +26 -107
- package/src/components/tree-select/tree-select.tsx +24 -16
- package/src/icon-stroke.test.tsx +2 -0
- package/src/index.ts +16 -0
- package/src/lib/date-predicates.test.ts +46 -0
- package/src/lib/date-predicates.ts +44 -24
- package/src/lib/date-value.test.ts +24 -1
- package/src/lib/date-value.ts +42 -1
- package/src/lib/floating-arrow.tsx +73 -0
- package/src/lib/focus-return.test.tsx +143 -0
- package/src/lib/focus-return.ts +106 -0
- package/src/lib/meter.test.ts +40 -0
- package/src/lib/meter.ts +159 -0
- package/src/lib/overlay-layer.test.tsx +47 -1
- package/src/lib/overlay-layer.tsx +65 -8
- package/src/lib/pressed.ts +130 -0
- package/src/lib/tree-data.ts +42 -2
- package/src/lib/use-pagination.test.ts +105 -0
- package/src/lib/use-pagination.ts +179 -0
- package/src/lib/use-scroll-spy.test.tsx +238 -0
- package/src/lib/use-scroll-spy.ts +336 -0
- package/src/theme.css +39 -3
- package/src/theme.test.ts +29 -1
- package/src/visually-hidden-containment.test.tsx +9 -0
- package/dist/chunk-2W7H43WL.js.map +0 -1
- package/dist/chunk-7E7JNWOC.js.map +0 -1
- package/dist/chunk-7FPSQBWB.js.map +0 -1
- package/dist/chunk-7KFUFAVP.js.map +0 -1
- package/dist/chunk-AKXALCUN.js.map +0 -1
- package/dist/chunk-B5YHYI7E.js.map +0 -1
- package/dist/chunk-FQJNQW3G.js.map +0 -1
- package/dist/chunk-G3AD3NJG.js.map +0 -1
- package/dist/chunk-GEZYGBXY.js.map +0 -1
- package/dist/chunk-HCHGERDB.js.map +0 -1
- package/dist/chunk-HWBFRDX7.js.map +0 -1
- package/dist/chunk-I4B3N3UX.js.map +0 -1
- package/dist/chunk-IA6DCC3N.js.map +0 -1
- package/dist/chunk-IANYMDKH.js.map +0 -1
- package/dist/chunk-MQHD3EJE.js.map +0 -1
- package/dist/chunk-NNPSBC7O.js.map +0 -1
- package/dist/chunk-OXR7BXZA.js.map +0 -1
- package/dist/chunk-QKSLDQM2.js +0 -120
- package/dist/chunk-QKSLDQM2.js.map +0 -1
- package/dist/chunk-QRNQQIQM.js.map +0 -1
- package/dist/chunk-RKCUXOU2.js.map +0 -1
- package/dist/chunk-S5CQRCTF.js +0 -426
- package/dist/chunk-S5CQRCTF.js.map +0 -1
- package/dist/chunk-SBZJGFZ6.js.map +0 -1
- package/dist/chunk-SP6LCCTZ.js.map +0 -1
- package/dist/chunk-TUP7WXQE.js.map +0 -1
- package/dist/chunk-V2QZG4IT.js.map +0 -1
- package/dist/chunk-X6DESK37.js.map +0 -1
- package/dist/chunk-ZB5VMGKB.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/button/button.tsx"],"names":[],"mappings":";;;;;;;;;;;AAsFA,IAAM,cAAA,GAAiB,GAAA;AAAA,EACrB;AAAA,IACE,yCAAA;AAAA,IACA,+BAAA;AAAA,IACA,qCAAA;AAAA,IACA,cAAA;AAAA,IACA,0CAAA;AAAA,IACA,0BAAA;AAAA,IACA,WAAA,EAAY;AAAA,IACZ,iFAAA;AAAA,IACA,uCAAA;AAAA,IACA,8BAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAKA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OAAA,EAAS,mBAAA;AAAA,MACT,IAAA,EAAM;AAAA,QACJ,EAAA,EAAI,+CAAA;AAAA,QACJ,EAAA,EAAI,mDAAA;AAAA,QACJ,EAAA,EAAI,+CAAA;AAAA,QACJ,EAAA,EAAI,gDAAA;AAAA,QACJ,EAAA,EAAI;AAAA;AACN,KACF;AAAA;AAA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,GAAU,EAAE,OAAA,EAAS,mBAAA,EAAoB,GAAI;AAAA,OAC/C,GACA,QAAQ,QAAQ;AAAA;AAAA,GACtB;AAEJ","file":"chunk-KZDMVOL6.js","sourcesContent":["\"use client\"\n\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport type { MouseEvent, ReactNode } from \"react\"\nimport { withAsChildContent } from \"../../lib/as-child\"\nimport { buttonColorVariants } from \"../../lib/button-colors\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { type ForbidHref, isLinkElement, type PressedProps, usePressed } from \"../../lib/pressed\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { Spinner } from \"../spinner/spinner\"\n\n/**\n * Button — interactive but stateless primitive.\n *\n * The new (variant × color) model splits visual treatment from accent palette:\n * - `variant` picks the shape (filled / light / outline / subtle / link)\n * - `color` picks the palette (brand / neutral / red / orange / …)\n *\n * Color is delivered through CSS variables: the component writes a\n * `data-color=\"…\"` attribute and the global rules in `colors.css` resolve\n * the button-only `--btn-*` slots (copied from the Figma Button set) for\n * both light and dark mode. So the cva matrix only enumerates variants, not\n * (variant × color) pairs; the per-variant classes live in\n * `lib/button-colors.ts`, shared with ActionIcon.\n * When `color` is omitted, no `data-color` attribute is rendered and the\n * slot vars cascade from `:root` — which mirrors `neutral` — so the\n * zero-config `<Button>` renders `filled` · `neutral`. Consumers retheme the\n * default for the whole app by overriding the slot vars at `:root`, no JS\n * required.\n *\n * `asChild` (inherited from `HTMLArkProps`) renders the single child element\n * with Button's styling merged in. Ark's factory clones exactly one element,\n * so only one element can survive the swap — `startSlot`/`endSlot` and the\n * `loading` spinner are folded into *that* element's own children\n * (`withAsChildContent`, `lib/as-child.ts`) rather than rendered as siblings,\n * so they keep showing up even when the child is a link. Common case:\n * `<Button asChild startSlot={<Icon />}><a ...>Go</a></Button>`.\n *\n * `loading` never changes the button's size or moves its label. Nothing\n * leaves the layout; the spinner morphs into a place that is already there:\n * - with a `startSlot`, the spinner is stacked on the icon in the same grid\n * cell and the two crossfade (`LoadingSlot`); the label and any `endSlot`\n * stay put;\n * - with only an `endSlot`, the same morph happens in the end slot;\n * - with no slot, the label stays laid out (so it still sizes the button)\n * while it fades and lifts away, and the spinner fades up into an\n * overlay centred over it (`LoadingLabel`).\n * The cell and the label keep their idle size, so the button is sized by its\n * idle content — CSS only, nothing measured. The spinner is mounted whenever\n * the `loading` prop is *passed* (true or false), so the fade has a state to\n * start from, and its rotation is paused while idle so a page of idle buttons\n * runs no animations; a button that never passes `loading` renders no\n * spinner at all. Under `motion-reduce` the swap is instant; the spinner\n * itself still turns.\n *\n * A loading button keeps full contrast — muting it would read as\n * `disabled`. `disabled` alone switches to the palette's disabled tints\n * (`not-data-loading:` scopes the `:disabled` colours off, since\n * `resolvedDisabled` sets native `disabled` for `loading` too).\n *\n * `loading` doesn't use `pointer-events-none` to block interaction — that\n * also blocks `:hover`, which would make `cursor-progress` unreachable by a\n * real mouse. Instead native `disabled` handles a real `<button>` (the\n * `disabled:pointer-events-none` rule is scoped off while loading via\n * `not-data-loading:` for the same reason as the dim), and an explicit\n * `onClick` guard (`preventWhileLoading`) handles an arbitrary `asChild`\n * element, which `disabled` doesn't affect. `cursor-progress` and the hover\n * suppression are keyed off `data-loading` rather than `:disabled`, which\n * never matches a non-form element like an `<a>`.\n *\n * `pressed` / `defaultPressed` / `onPressedChange` make it a toggle button\n * (`lib/pressed.ts`): `aria-pressed`, a click that flips the state, and the\n * look swapping from `variant` to `pressedVariant` — `ButtonSelect`'s\n * `variant` / `selectedVariant` swap, with the same `light` / `filled`\n * defaults. Nothing else changes, so a pressed button keeps every other\n * behaviour: `loading` and `disabled` still block the click (and so the\n * flip) and keep the pressed look, and under `asChild` the attribute, the\n * click and the classes all land on the child. A link child is the one\n * exception: `aria-pressed` means nothing on a link, so the pressed props are\n * ignored there with a dev warning, and `href` is typed out of Button\n * altogether (`ForbidHref`).\n */\nconst buttonVariants = cva(\n [\n \"inline-flex items-center justify-center\",\n \"whitespace-nowrap select-none\",\n \"font-medium uppercase tracking-wide\",\n \"no-underline\",\n \"rounded-button border border-transparent\",\n \"transition-colors-radius\",\n focusStyles(),\n \"disabled:not-data-loading:pointer-events-none data-disabled:pointer-events-none\",\n \"not-data-loading:hover:cursor-pointer\",\n \"data-loading:cursor-progress\",\n // Every svg rule is `[:where(&)_svg]`: zero class specificity, so a size\n // class on the icon itself (`<Star className=\"size-5\" />`) or a nested\n // component's own svg rule wins whatever the CSS order. Lucide's `size`\n // prop is only an HTML attribute and still loses. Same fix as Input (#427).\n \"[:where(&)_svg]:shrink-0 [:where(&)_svg]:pointer-events-none\",\n ],\n {\n variants: {\n variant: buttonColorVariants,\n size: {\n xs: \"h-7 px-2 text-xs [:where(&)_svg]:size-3 gap-1\",\n sm: \"h-8 px-3 text-sm [:where(&)_svg]:size-3.5 gap-1.5\",\n md: \"h-9 px-4 text-md [:where(&)_svg]:size-4 gap-2\",\n lg: \"h-10 px-4 text-lg [:where(&)_svg]:size-5 gap-3\",\n xl: \"h-12 px-5 text-xl [:where(&)_svg]:size-6 gap-3\",\n },\n },\n // Figma's link is bare text: no box, no padding, no fixed height. A\n // compound variant so it lands after (and wins over) the size classes.\n compoundVariants: [{ variant: \"link\", class: \"h-auto px-0 rounded-none border-0\" }],\n defaultVariants: {\n variant: \"filled\",\n size: \"md\",\n },\n },\n)\n\nconst startSlotVariants = cva(\"inline-flex shrink-0 items-center\", {\n variants: {\n size: {\n xs: \"-ms-0.5\",\n sm: \"-ms-1\",\n md: \"-ms-2\",\n lg: \"-ms-2.5\",\n xl: \"-ms-3\",\n },\n },\n})\nconst endSlotVariants = cva(\"inline-flex shrink-0 items-center\", {\n variants: {\n size: {\n xs: \"-me-0.5\",\n sm: \"-me-1\",\n md: \"-me-2\",\n lg: \"-me-2.5\",\n xl: \"-me-3\",\n },\n },\n})\n\nexport type ButtonVariant = NonNullable<VariantProps<typeof buttonVariants>[\"variant\"]>\nexport type ButtonSize = NonNullable<VariantProps<typeof buttonVariants>[\"size\"]>\n\nexport type ButtonProps = Omit<HTMLArkProps<\"button\">, \"color\"> &\n VariantProps<typeof buttonVariants> &\n PressedProps<ButtonVariant> &\n ForbidHref &\n WithTestId & {\n /** Accent palette. Re-exported as `Color` from `@42/ui-react`. */\n color?: Color\n /**\n * Show a spinner and mark the button as busy + non-interactive, without\n * changing its size: the spinner crossfades in place of `startSlot` (or\n * `endSlot` when there is no `startSlot`), or over the label when there\n * is no slot. Use for async submit handlers.\n */\n loading?: boolean\n /**\n * Optional element rendered at the inline-start of the children (e.g. an\n * icon) — left in LTR, right in RTL. Hidden from assistive tech via\n * `aria-hidden`.\n */\n startSlot?: ReactNode\n /**\n * Optional element rendered at the inline-end of the children — right in\n * LTR, left in RTL. `aria-hidden`.\n */\n endSlot?: ReactNode\n }\n\nconst HiddenSlot = ({ children, className }: { children: ReactNode; className?: string }) => (\n <span\n aria-hidden=\"true\"\n className={cn(\"inline-flex shrink-0 items-center justify-center\", className)}\n >\n {children}\n </span>\n)\n\n/** Both layers of a loading morph share one grid cell, so the cell is as big\n * as the larger of the two and swapping them can't move anything. */\nconst morphLayer = \"col-start-1 row-start-1 transition-morph motion-reduce:transition-none\"\n\n/** The spinner's own rotation runs only while it is showing; paused (not\n * removed) so it fades out from where it was rather than snapping back. */\nconst LoadingSpinner = ({ loading }: { loading: boolean }) => (\n <Spinner label={null} className={loading ? undefined : \"[animation-play-state:paused]\"} />\n)\n\n/**\n * A slot's icon and the spinner stacked in place: the icon shrinks and fades\n * out as the spinner grows and fades in, inside a cell that keeps its size.\n */\nconst LoadingSlot = ({ loading, children }: { loading: boolean; children: ReactNode }) => (\n <span className=\"inline-grid place-items-center\">\n <span className={cn(morphLayer, \"inline-flex\", loading && \"scale-50 opacity-0\")}>\n {children}\n </span>\n <span className={cn(morphLayer, \"inline-flex\", !loading && \"scale-50 opacity-0\")}>\n <LoadingSpinner loading={loading} />\n </span>\n </span>\n)\n\n/**\n * No slot to morph in: the label stays laid out (it still sizes the button)\n * while it fades and lifts away, and the spinner rises into an overlay over\n * the whole button — the root is `relative` for it. The label wrapper\n * inherits the root's `gap`, so children with several nodes keep their\n * spacing.\n */\nconst LoadingLabel = ({ loading, children }: { loading: boolean; children: ReactNode }) => (\n <>\n <span\n className={cn(\n morphLayer,\n \"inline-flex items-center justify-center gap-[inherit]\",\n loading && \"-translate-y-1 opacity-0\",\n )}\n >\n {children}\n </span>\n <span\n aria-hidden=\"true\"\n className={cn(\n \"pointer-events-none absolute inset-0 grid place-items-center\",\n \"transition-morph motion-reduce:transition-none\",\n !loading && \"translate-y-1 opacity-0\",\n )}\n >\n <LoadingSpinner loading={loading} />\n </span>\n </>\n)\n\n/**\n * Swallows the click while `loading`. Native `disabled` already blocks\n * interaction on a real `<button>` with or without this, but it's a no-op\n * on an arbitrary `asChild` element (e.g. an `<a>`) — that's the one case\n * this actually needs to do something. A stable module-level reference so\n * it never causes the clone below to look \"changed\" across renders.\n */\nconst preventWhileLoading = (event: MouseEvent) => {\n event.preventDefault()\n event.stopPropagation()\n}\n\nexport const Button = ({\n className,\n variant,\n size,\n color,\n loading: loadingProp,\n startSlot,\n endSlot,\n children,\n disabled,\n type,\n asChild,\n testId,\n onClick,\n pressed: pressedProp,\n defaultPressed,\n onPressedChange,\n pressedVariant,\n ...rest\n}: ButtonProps) => {\n const loading = loadingProp ?? false\n // Passing `loading` at all (even `false`) opts into the spinner layers, so\n // the first switch to `true` already has a from-state to fade from.\n const loadable = loadingProp !== undefined\n // Where the spinner morphs: the start slot, else the end slot, else over\n // the label.\n const morph = !loadable ? null : startSlot ? \"start\" : endSlot ? \"end\" : \"label\"\n const resolvedDisabled = disabled || loading\n const toggle = usePressed({\n pressed: pressedProp,\n defaultPressed,\n onPressedChange,\n disabled: resolvedDisabled,\n onClick: loading ? preventWhileLoading : onClick,\n link: Boolean(asChild) && isLinkElement(children),\n component: \"Button\",\n })\n const pressed = toggle.pressed\n // A toggle swaps between ButtonSelect's pair; a plain button keeps `variant`.\n const resolvedVariant = toggle.toggle\n ? pressed\n ? (pressedVariant ?? \"filled\")\n : (variant ?? \"light\")\n : variant\n const content = (own: ReactNode) => (\n <>\n {startSlot && (\n <HiddenSlot\n className={cn(startSlotVariants({ size }), resolvedVariant === \"link\" && \"ms-0\")}\n >\n {morph === \"start\" ? <LoadingSlot loading={loading}>{startSlot}</LoadingSlot> : startSlot}\n </HiddenSlot>\n )}\n {morph === \"label\" ? <LoadingLabel loading={loading}>{own}</LoadingLabel> : own}\n {endSlot && (\n <HiddenSlot className={cn(endSlotVariants({ size }), resolvedVariant === \"link\" && \"me-0\")}>\n {morph === \"end\" ? <LoadingSlot loading={loading}>{endSlot}</LoadingSlot> : endSlot}\n </HiddenSlot>\n )}\n </>\n )\n\n return (\n <ark.button\n asChild={asChild}\n type={asChild ? type : (type ?? \"button\")}\n disabled={resolvedDisabled}\n data-color={color}\n data-variant={resolvedVariant ?? \"filled\"}\n data-size={size ?? \"md\"}\n className={cn(\n buttonVariants({ variant: resolvedVariant, size }),\n morph === \"label\" && \"relative\",\n className,\n )}\n onClick={toggle.onClick}\n aria-pressed={toggle.toggle ? pressed : undefined}\n {...props({\n \"aria-busy\": loading,\n \"aria-disabled\": resolvedDisabled,\n \"data-loading\": loading,\n \"data-pressed\": pressed,\n \"data-testid\": testId,\n })}\n {...rest}\n >\n {asChild\n ? withAsChildContent(\n children,\n content,\n loading ? { onClick: preventWhileLoading } : undefined,\n )\n : content(children)}\n </ark.button>\n )\n}\n"]}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { controlIndicator } from './chunk-NLOBBJAA.js';
|
|
2
|
+
import { focusStyles } from './chunk-C6NVU4F7.js';
|
|
3
|
+
import { TEXT_COLOR_CLASSES } from './chunk-GIPQUKCN.js';
|
|
4
|
+
import { cn } from './chunk-4ASNIDV7.js';
|
|
5
|
+
import { cva } from 'class-variance-authority';
|
|
6
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
// src/lib/tree-data.ts
|
|
9
|
+
var isLeaf = (node) => !node.children || node.children.length === 0;
|
|
10
|
+
var buildMaps = (nodes) => {
|
|
11
|
+
const labelMap = /* @__PURE__ */ new Map();
|
|
12
|
+
const nodeMap = /* @__PURE__ */ new Map();
|
|
13
|
+
const walk = (ns) => {
|
|
14
|
+
for (const n of ns) {
|
|
15
|
+
labelMap.set(n.value, n.label);
|
|
16
|
+
nodeMap.set(n.value, n);
|
|
17
|
+
if (n.children) walk(n.children);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
walk(nodes);
|
|
21
|
+
return { labelMap, nodeMap };
|
|
22
|
+
};
|
|
23
|
+
var flattenTree = (nodes, inheritedDisabled, acc = []) => {
|
|
24
|
+
for (const n of nodes) {
|
|
25
|
+
const nodeDisabled = inheritedDisabled || !!n.disabled;
|
|
26
|
+
acc.push({ value: n.value, disabled: nodeDisabled });
|
|
27
|
+
if (n.children) flattenTree(n.children, nodeDisabled, acc);
|
|
28
|
+
}
|
|
29
|
+
return acc;
|
|
30
|
+
};
|
|
31
|
+
var filterTree = (nodes, query, matches) => {
|
|
32
|
+
if (!query.trim()) return nodes;
|
|
33
|
+
const recurse = (ns) => {
|
|
34
|
+
const out = [];
|
|
35
|
+
for (const n of ns) {
|
|
36
|
+
const selfMatch = matches(n.label, query);
|
|
37
|
+
if (isLeaf(n)) {
|
|
38
|
+
if (selfMatch) out.push(n);
|
|
39
|
+
} else if (selfMatch) {
|
|
40
|
+
out.push(n);
|
|
41
|
+
} else if (n.children) {
|
|
42
|
+
const kids = recurse(n.children);
|
|
43
|
+
if (kids.length > 0) out.push({ ...n, children: kids });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return out;
|
|
47
|
+
};
|
|
48
|
+
return recurse(nodes);
|
|
49
|
+
};
|
|
50
|
+
var getLeafValues = (node, acc = []) => {
|
|
51
|
+
if (isLeaf(node)) {
|
|
52
|
+
if (!node.disabled) acc.push(node.value);
|
|
53
|
+
return acc;
|
|
54
|
+
}
|
|
55
|
+
if (node.children) for (const child of node.children) getLeafValues(child, acc);
|
|
56
|
+
return acc;
|
|
57
|
+
};
|
|
58
|
+
var getCheckState = (node, checked) => {
|
|
59
|
+
const leaves = getLeafValues(node);
|
|
60
|
+
if (leaves.length === 0) return "unchecked";
|
|
61
|
+
const on = leaves.filter((v) => checked.has(v)).length;
|
|
62
|
+
if (on === 0) return "unchecked";
|
|
63
|
+
return on === leaves.length ? "checked" : "indeterminate";
|
|
64
|
+
};
|
|
65
|
+
var toggleChecked = (node, current) => {
|
|
66
|
+
const leaves = getLeafValues(node);
|
|
67
|
+
if (leaves.length === 0) return [...current];
|
|
68
|
+
const set = new Set(current);
|
|
69
|
+
const fullyChecked = leaves.every((v) => set.has(v));
|
|
70
|
+
for (const v of leaves) fullyChecked ? set.delete(v) : set.add(v);
|
|
71
|
+
return [...set];
|
|
72
|
+
};
|
|
73
|
+
var treeLine = "bg-brand-900/20 dark:bg-white/15";
|
|
74
|
+
var treeRow = cva(
|
|
75
|
+
["group/row relative flex w-full items-center rounded-sm ps-1.5 outline-none select-none"],
|
|
76
|
+
{
|
|
77
|
+
variants: {
|
|
78
|
+
size: {
|
|
79
|
+
xs: "min-h-7 pe-1.5 text-xs",
|
|
80
|
+
sm: "min-h-8 pe-2 text-sm",
|
|
81
|
+
md: "min-h-9 pe-2 text-md",
|
|
82
|
+
lg: "min-h-10 pe-2.5 text-lg",
|
|
83
|
+
xl: "min-h-11 pe-3 text-xl"
|
|
84
|
+
},
|
|
85
|
+
interactive: {
|
|
86
|
+
true: [
|
|
87
|
+
"cursor-pointer",
|
|
88
|
+
TEXT_COLOR_CLASSES.primary,
|
|
89
|
+
"hover:bg-black/5 dark:hover:bg-white/8",
|
|
90
|
+
"data-active:bg-black/5 dark:data-active:bg-white/8",
|
|
91
|
+
"data-disabled:pointer-events-none data-disabled:opacity-50",
|
|
92
|
+
// Palette, not brand: the focused row is also the active one, and brand-500
|
|
93
|
+
// measured 2.73:1 against that light fill. `--c-text` (the popover's
|
|
94
|
+
// `data-color`, neutral by default) clears it in both themes.
|
|
95
|
+
focusStyles({ ring: "palette", offset: false, inset: true })
|
|
96
|
+
],
|
|
97
|
+
false: ["cursor-default font-medium", TEXT_COLOR_CLASSES.secondary]
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
defaultVariants: { size: "md", interactive: true }
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
var treePositions = (count, parent) => {
|
|
104
|
+
const depth = parent ? parent.depth + 1 : 0;
|
|
105
|
+
const ancestorHasNextSibling = !parent || parent.depth === 0 ? [] : [...parent.ancestorHasNextSibling, !parent.isLast];
|
|
106
|
+
return Array.from({ length: count }, (_, i) => ({
|
|
107
|
+
depth,
|
|
108
|
+
ancestorHasNextSibling,
|
|
109
|
+
isLast: i === count - 1,
|
|
110
|
+
posinset: i + 1,
|
|
111
|
+
setsize: count
|
|
112
|
+
}));
|
|
113
|
+
};
|
|
114
|
+
var TreeRails = ({ depth, ancestorHasNextSibling, isLast }) => depth > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
115
|
+
ancestorHasNextSibling.map((hasNext, i) => (
|
|
116
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: Indentation is stable inside component, we would want to rerender anyway.
|
|
117
|
+
/* @__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)
|
|
118
|
+
)),
|
|
119
|
+
/* @__PURE__ */ jsxs("span", { "aria-hidden": true, className: "relative w-4 shrink-0 self-stretch", children: [
|
|
120
|
+
/* @__PURE__ */ jsx(
|
|
121
|
+
"span",
|
|
122
|
+
{
|
|
123
|
+
className: cn("absolute inset-s-1/2 top-0 w-px", treeLine, isLast ? "h-1/2" : "bottom-0")
|
|
124
|
+
}
|
|
125
|
+
),
|
|
126
|
+
/* @__PURE__ */ jsx("span", { className: cn("absolute inset-s-1/2 top-1/2 h-px w-1/2", treeLine) })
|
|
127
|
+
] })
|
|
128
|
+
] });
|
|
129
|
+
var TreeRow = ({
|
|
130
|
+
position,
|
|
131
|
+
size,
|
|
132
|
+
interactive = true,
|
|
133
|
+
withLines = true,
|
|
134
|
+
className,
|
|
135
|
+
children,
|
|
136
|
+
...rest
|
|
137
|
+
}) => /* @__PURE__ */ jsxs("div", { ...rest, className: cn(treeRow({ size, interactive }), className), children: [
|
|
138
|
+
withLines ? /* @__PURE__ */ jsx(TreeRails, { ...position }) : Array.from({ length: position.depth }, (_, i) => (
|
|
139
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: one blank column per level, never reordered.
|
|
140
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "w-4 shrink-0" }, i)
|
|
141
|
+
)),
|
|
142
|
+
children
|
|
143
|
+
] });
|
|
144
|
+
var treeText = "ms-1.5 min-w-0 flex-1 truncate text-start";
|
|
145
|
+
var TreeLabel = ({ className, children }) => /* @__PURE__ */ jsx("span", { className: cn(treeText, className), children });
|
|
146
|
+
var TreeCheckMark = ({
|
|
147
|
+
checked,
|
|
148
|
+
indeterminate,
|
|
149
|
+
size,
|
|
150
|
+
icons,
|
|
151
|
+
className,
|
|
152
|
+
...rest
|
|
153
|
+
}) => /* @__PURE__ */ jsxs(
|
|
154
|
+
"span",
|
|
155
|
+
{
|
|
156
|
+
"aria-hidden": true,
|
|
157
|
+
"data-state": checked ? "checked" : indeterminate ? "indeterminate" : "unchecked",
|
|
158
|
+
...rest,
|
|
159
|
+
className: cn(controlIndicator({ size, variant: "filled" }), className),
|
|
160
|
+
children: [
|
|
161
|
+
checked && icons.check,
|
|
162
|
+
indeterminate && icons.indeterminate
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
);
|
|
166
|
+
|
|
167
|
+
export { TreeCheckMark, TreeLabel, TreeRow, buildMaps, filterTree, flattenTree, getCheckState, getLeafValues, isLeaf, toggleChecked, treeLine, treePositions, treeText };
|
|
168
|
+
//# sourceMappingURL=chunk-LR5U6TZZ.js.map
|
|
169
|
+
//# sourceMappingURL=chunk-LR5U6TZZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/tree-data.ts","../src/components/tree/tree-row.tsx"],"names":[],"mappings":";;;;;;;;AA+GO,IAAM,MAAA,GAAS,CAAC,IAAA,KAAgC,CAAC,KAAK,QAAA,IAAY,IAAA,CAAK,SAAS,MAAA,KAAW;AAG3F,IAAM,SAAA,GAAY,CAAI,KAAA,KAA0C;AACrE,EAAA,MAAM,QAAA,uBAAe,GAAA,EAAoB;AACzC,EAAA,MAAM,OAAA,uBAAc,GAAA,EAA6B;AACjD,EAAA,MAAM,IAAA,GAAO,CAAC,EAAA,KAAuC;AACnD,IAAA,KAAA,MAAW,KAAK,EAAA,EAAI;AAClB,MAAA,QAAA,CAAS,GAAA,CAAI,CAAA,CAAE,KAAA,EAAO,CAAA,CAAE,KAAK,CAAA;AAC7B,MAAA,OAAA,CAAQ,GAAA,CAAI,CAAA,CAAE,KAAA,EAAO,CAAC,CAAA;AACtB,MAAA,IAAI,CAAA,CAAE,QAAA,EAAU,IAAA,CAAK,CAAA,CAAE,QAAQ,CAAA;AAAA,IACjC;AAAA,EACF,CAAA;AACA,EAAA,IAAA,CAAK,KAAK,CAAA;AACV,EAAA,OAAO,EAAE,UAAU,OAAA,EAAQ;AAC7B;AAGO,IAAM,cAAc,CACzB,KAAA,EACA,iBAAA,EACA,GAAA,GAA8C,EAAC,KACJ;AAC3C,EAAA,KAAA,MAAW,KAAK,KAAA,EAAO;AACrB,IAAA,MAAM,YAAA,GAAe,iBAAA,IAAqB,CAAC,CAAC,CAAA,CAAE,QAAA;AAC9C,IAAA,GAAA,CAAI,KAAK,EAAE,KAAA,EAAO,EAAE,KAAA,EAA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EAAE,MAAA,EAAQ,QAAA,CAAS,KAAA,EAAM,EAAG,CAAC,CAAA,EAAG,CAAA;AAAA;AAAA,wBAExC,MAAA,EAAA,EAAa,aAAA,EAAW,IAAA,EAAC,SAAA,EAAU,kBAAzB,CAAwC;AAAA,GACpD,CAAA;AAAA,EAEF;AAAA,CAAA,EACH;AAIK,IAAM,QAAA,GAAW;AAGjB,IAAM,SAAA,GAAY,CAAC,EAAE,SAAA,EAAW,QAAA,EAAS,qBAC9C,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAW,EAAA,CAAG,QAAA,EAAU,SAAS,GAAI,QAAA,EAAS;AAe/C,IAAM,gBAAgB,CAAC;AAAA,EAC5B,OAAA;AAAA,EACA,aAAA;AAAA,EACA,IAAA;AAAA,EACA,KAAA;AAAA,EACA,SAAA;AAAA,EACA,GAAG;AACL,CAAA,qBACE,IAAA;AAAA,EAAC,MAAA;AAAA,EAAA;AAAA,IACC,aAAA,EAAW,IAAA;AAAA,IACX,YAAA,EAAY,OAAA,GAAU,SAAA,GAAY,aAAA,GAAgB,eAAA,GAAkB,WAAA;AAAA,IACnE,GAAG,IAAA;AAAA,IACJ,SAAA,EAAW,GAAG,gBAAA,CAAiB,EAAE,MAAM,OAAA,EAAS,QAAA,EAAU,CAAA,EAAG,SAAS,CAAA;AAAA,IAErE,QAAA,EAAA;AAAA,MAAA,OAAA,IAAW,KAAA,CAAM,KAAA;AAAA,MACjB,iBAAiB,KAAA,CAAM;AAAA;AAAA;AAC1B","file":"chunk-LR5U6TZZ.js","sourcesContent":["/**\n * Shared tree model + pure helpers for the hierarchical components (Tree,\n * TreeSelect, TreeMultiSelect). `data` is a tree of `{ value, label, disabled?, children? }`;\n * a node with `children` is a *branch*, one without is a *leaf*. These helpers\n * are selection-agnostic — the single / multi cascade logic lives in each\n * component (mirrors `lib/select-data.ts` for the flat pickers).\n *\n * A node may carry an arbitrary, optional `payload`. Selection ignores it\n * (value / label / disabled drive everything) but it flows through to a tree\n * picker's `renderItem` as `node.payload`.\n */\n\nimport type { ReactNode } from \"react\"\nimport type { LabelSearch } from \"./select-data\"\n\nexport type TreeNodeData<P = unknown> = {\n value: string\n label: string\n disabled?: boolean\n children?: TreeNodeData<P>[]\n /** Arbitrary extra data, surfaced to `renderItem`. */\n payload?: P\n /** `data-testid` on the rendered row. Defaults to `` `item-${value}` `` —\n * set it explicitly when `value` isn't a safe/stable test selector on its\n * own. Unlike the Ark-machine-backed pickers, this tree is hand-rolled, so\n * there's no free `data-part` / `data-value` here — `testId` is the row's\n * only stable selector. */\n testId?: string\n /** `Tree` only: a branch whose children aren't in `data` yet. Expanding it calls the tree's\n * `loadChildren` once, then shows what it returns. The pickers ignore it. */\n hasChildren?: boolean\n /** `Tree` only: this node's icon, in place of the default folder / file. `null` draws none.\n * The pickers ignore it. */\n icon?: ReactNode\n}\n\n/**\n * A tree picker's `data` shape. Not generic over the node payload here (a\n * component generic over both `Data` and `P` independently defeats payload\n * inference — see `TreePayload` below); `TreeNodeData`'s own `P` still drives\n * autocomplete, extracted structurally from `Data` when needed.\n */\nexport type TreeSelectData = ReadonlyArray<TreeNodeData>\n\n/**\n * Extract the literal value union from a tree of `TreeNodeData` — the tree\n * analogue of `lib/select-data.ts`'s `SelectValue`, walking every node's\n * `value` plus its `children` (recursively) so a `const`-typed `data` prop\n * narrows `value` / `onChange` to the tree's actual node values instead of\n * plain `string`.\n */\nexport type TreeValue<Nodes extends ReadonlyArray<TreeNodeData>> = TreeNodeValue<Nodes[number]>\n\ntype TreeNodeValue<N> = N extends TreeNodeData\n ?\n | N[\"value\"]\n | (N[\"children\"] extends ReadonlyArray<TreeNodeData> ? TreeValue<N[\"children\"]> : never)\n : never\n\n/**\n * Extract the `payload` type carried by a tree — read structurally off every\n * node's own `payload` property (robust against generic-instantiation\n * inference, same approach as `lib/select-data.ts`'s `SelectPayload`),\n * recursing into `children`. Payload-less nodes contribute `never`; a\n * homogeneous payload resolves precisely, a mixed one to the union.\n */\nexport type TreePayload<Nodes extends ReadonlyArray<TreeNodeData>> = TreeNodePayload<Nodes[number]>\n\ntype TreeNodePayload<N> = N extends TreeNodeData\n ?\n | (N extends { payload: infer P } ? P : never)\n | (N[\"children\"] extends ReadonlyArray<TreeNodeData> ? TreePayload<N[\"children\"]> : never)\n : never\n\n/**\n * Live node state passed alongside the node to a tree picker's `renderItem`.\n * `depth` is 0-based (the row renders `aria-level={depth + 1}`); `leaf`\n * distinguishes selectable leaves from organizational branches.\n */\nexport type TreeSelectItemState = {\n selected: boolean\n leaf: boolean\n disabled: boolean\n depth: number\n}\n\n/** Tri-state variant for `TreeMultiSelect` — branches cascade to `indeterminate`. */\nexport type TreeMultiSelectItemState = {\n checked: boolean\n indeterminate: boolean\n leaf: boolean\n disabled: boolean\n depth: number\n}\n\n/**\n * Render a node's content yourself. The component keeps owning the row\n * (treeitem role, indent rails, roving focus, click); the callback fills the\n * content after the rails and receives the node (including its typed `payload`).\n * In an RSC tree the function must live in a `\"use client\"` module so the\n * boundary serializes it as a client reference.\n */\nexport type RenderTreeSelectItem<P = unknown> = (\n node: TreeNodeData<P>,\n state: TreeSelectItemState,\n) => ReactNode\nexport type RenderTreeMultiSelectItem<P = unknown> = (\n node: TreeNodeData<P>,\n state: TreeMultiSelectItemState,\n) => ReactNode\n\nexport const isLeaf = (node: TreeNodeData): boolean => !node.children || node.children.length === 0\n\n/** value → label (trigger display) and value → node (toggling from keyboard / filtered rows). */\nexport const buildMaps = <P>(nodes: ReadonlyArray<TreeNodeData<P>>) => {\n const labelMap = new Map<string, string>()\n const nodeMap = new Map<string, TreeNodeData<P>>()\n const walk = (ns: ReadonlyArray<TreeNodeData<P>>) => {\n for (const n of ns) {\n labelMap.set(n.value, n.label)\n nodeMap.set(n.value, n)\n if (n.children) walk(n.children)\n }\n }\n walk(nodes)\n return { labelMap, nodeMap }\n}\n\n/** Pre-order list of node values + inherited-disabled flag — drives roving focus. */\nexport const flattenTree = (\n nodes: ReadonlyArray<TreeNodeData>,\n inheritedDisabled: boolean,\n acc: { value: string; disabled: boolean }[] = [],\n): { value: string; disabled: boolean }[] => {\n for (const n of nodes) {\n const nodeDisabled = inheritedDisabled || !!n.disabled\n acc.push({ value: n.value, disabled: nodeDisabled })\n if (n.children) flattenTree(n.children, nodeDisabled, acc)\n }\n return acc\n}\n\n/**\n * Keep nodes whose label (or a descendant's) matches `query`; preserves ancestors.\n * `matches` is the pickers' shared locale-aware search (`useLabelSearch().matches`), passed in\n * because this is a plain function: accents and case fold away, Turkish keeps its i's apart.\n */\nexport const filterTree = <P>(\n nodes: ReadonlyArray<TreeNodeData<P>>,\n query: string,\n matches: LabelSearch[\"matches\"],\n): TreeNodeData<P>[] => {\n if (!query.trim()) return nodes as TreeNodeData<P>[]\n const recurse = (ns: ReadonlyArray<TreeNodeData<P>>): TreeNodeData<P>[] => {\n const out: TreeNodeData<P>[] = []\n for (const n of ns) {\n const selfMatch = matches(n.label, query)\n if (isLeaf(n)) {\n if (selfMatch) out.push(n)\n } else if (selfMatch) {\n out.push(n) // branch matches → keep its full subtree\n } else if (n.children) {\n const kids = recurse(n.children)\n if (kids.length > 0) out.push({ ...n, children: kids })\n }\n }\n return out\n }\n return recurse(nodes)\n}\n\n/** Every *enabled* leaf value under `node` (the node itself when it's a leaf). */\nexport const getLeafValues = (node: TreeNodeData, acc: string[] = []): string[] => {\n if (isLeaf(node)) {\n if (!node.disabled) acc.push(node.value)\n return acc\n }\n if (node.children) for (const child of node.children) getLeafValues(child, acc)\n return acc\n}\n\n/** A checkbox tree's tri-state per node. */\nexport type TreeCheckState = \"checked\" | \"indeterminate\" | \"unchecked\"\n\n/** Tri-state of a node, derived from the set of checked leaf values: a branch is checked when\n * all its enabled leaves are, indeterminate when some are. */\nexport const getCheckState = (node: TreeNodeData, checked: ReadonlySet<string>): TreeCheckState => {\n const leaves = getLeafValues(node)\n if (leaves.length === 0) return \"unchecked\"\n const on = leaves.filter((v) => checked.has(v)).length\n if (on === 0) return \"unchecked\"\n return on === leaves.length ? \"checked\" : \"indeterminate\"\n}\n\n/** Toggle a node in a leaf selection: a fully checked node clears its leaves, any other selects\n * them all. Disabled leaves keep their state. */\nexport const toggleChecked = (node: TreeNodeData, current: readonly string[]): string[] => {\n const leaves = getLeafValues(node)\n if (leaves.length === 0) return [...current]\n const set = new Set(current)\n const fullyChecked = leaves.every((v) => set.has(v))\n for (const v of leaves) fullyChecked ? set.delete(v) : set.add(v)\n return [...set]\n}\n","import { cva } from \"class-variance-authority\"\nimport type { ComponentProps, ReactNode } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport type { Size } from \"../../lib/sizes\"\nimport { TEXT_COLOR_CLASSES } from \"../../lib/typography-size\"\nimport { controlIndicator } from \"../checkbox/control\"\n\n/**\n * The kit's one tree row, internal: what `Tree`, `TreeSelect` and `TreeMultiSelect` all draw.\n * The row box and its surfaces, the indent rails, where a node sits among its siblings, the\n * label and the checkbox mark. Each component keeps only its own behaviour around it: `Tree`\n * spreads Ark's `tree-view` props on the row and nests its children in a `Collapse`; the\n * pickers render the tree flat, always expanded, with their own roving focus (see\n * `tree-select/tree-popover.tsx` for why they can't run on Ark's machine).\n */\n\n/** Indent guide / connector colour, shared by rails and the elbow. */\nexport const treeLine = \"bg-brand-900/20 dark:bg-white/15\"\n\n/**\n * One tree row. `interactive` rows take focus and hover/active surfaces: neutral and\n * transparent, a low-opacity black/white wash rather than an opaque gray, matching the\n * popover surface's own background-dependent tint (no Figma reference for this state yet).\n * The others are TreeSelect's branches: organizational, present for structure and levels,\n * never focused.\n */\nexport const treeRow = cva(\n [\"group/row relative flex w-full items-center rounded-sm ps-1.5 outline-none select-none\"],\n {\n variants: {\n size: {\n xs: \"min-h-7 pe-1.5 text-xs\",\n sm: \"min-h-8 pe-2 text-sm\",\n md: \"min-h-9 pe-2 text-md\",\n lg: \"min-h-10 pe-2.5 text-lg\",\n xl: \"min-h-11 pe-3 text-xl\",\n },\n interactive: {\n true: [\n \"cursor-pointer\",\n TEXT_COLOR_CLASSES.primary,\n \"hover:bg-black/5 dark:hover:bg-white/8\",\n \"data-active:bg-black/5 dark:data-active:bg-white/8\",\n \"data-disabled:pointer-events-none data-disabled:opacity-50\",\n // Palette, not brand: the focused row is also the active one, and brand-500\n // measured 2.73:1 against that light fill. `--c-text` (the popover's\n // `data-color`, neutral by default) clears it in both themes.\n focusStyles({ ring: \"palette\", offset: false, inset: true }),\n ],\n false: [\"cursor-default font-medium\", TEXT_COLOR_CLASSES.secondary],\n },\n },\n defaultVariants: { size: \"md\", interactive: true },\n },\n)\n\n/** Where a node sits in the rendered tree: what its rails and set position need. */\nexport type TreePosition = {\n /** 0-based; the row's `aria-level` is `depth + 1`. */\n depth: number\n /** Per ancestor below the top level: whether it has a sibling after it (its rail continues). */\n ancestorHasNextSibling: boolean[]\n /** Last among its siblings: the connector stops at the elbow. */\n isLast: boolean\n /** 1-based index among its siblings. */\n posinset: number\n /** Number of siblings, itself included. */\n setsize: number\n}\n\n/** The positions of `count` siblings: the top level's without a `parent`, else its children's. */\nexport const treePositions = (count: number, parent?: TreePosition): TreePosition[] => {\n const depth = parent ? parent.depth + 1 : 0\n // Top-level rows carry no rail, so their children's rails start empty.\n const ancestorHasNextSibling =\n !parent || parent.depth === 0 ? [] : [...parent.ancestorHasNextSibling, !parent.isLast]\n return Array.from({ length: count }, (_, i) => ({\n depth,\n ancestorHasNextSibling,\n isLast: i === count - 1,\n posinset: i + 1,\n setsize: count,\n }))\n}\n\n/** The indent guides before a row's content. Top-level rows sit flush. */\nconst TreeRails = ({ depth, ancestorHasNextSibling, isLast }: TreePosition) =>\n depth > 0 && (\n <>\n {/* ancestor rails: a vertical guide where that ancestor has a sibling below */}\n {ancestorHasNextSibling.map((hasNext, i) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: Indentation is stable inside component, we would want to rerender anyway.\n <span key={i} aria-hidden className=\"relative w-4 shrink-0 self-stretch\">\n {hasNext && <span className={cn(\"absolute inset-y-0 inset-s-1/2 w-px\", treeLine)} />}\n </span>\n ))}\n\n {/* connector: vertical (├ continues / └ stops) + horizontal elbow */}\n <span aria-hidden className=\"relative w-4 shrink-0 self-stretch\">\n <span\n className={cn(\"absolute inset-s-1/2 top-0 w-px\", treeLine, isLast ? \"h-1/2\" : \"bottom-0\")}\n />\n <span className={cn(\"absolute inset-s-1/2 top-1/2 h-px w-1/2\", treeLine)} />\n </span>\n </>\n )\n\nexport type TreeRowProps = ComponentProps<\"div\"> & {\n position: TreePosition\n size: Size\n /** See `treeRow`. Default `true`. */\n interactive?: boolean\n /** Draw the rails; without, each level is a blank column. Default `true`. */\n withLines?: boolean\n}\n\n/** A row: the `treeRow` box, its indent, then `children` (the row's content). The caller\n * spreads its role, ARIA, focus and handlers. */\nexport const TreeRow = ({\n position,\n size,\n interactive = true,\n withLines = true,\n className,\n children,\n ...rest\n}: TreeRowProps) => (\n <div {...rest} className={cn(treeRow({ size, interactive }), className)}>\n {withLines ? (\n <TreeRails {...position} />\n ) : (\n Array.from({ length: position.depth }, (_, i) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: one blank column per level, never reordered.\n <span key={i} aria-hidden className=\"w-4 shrink-0\" />\n ))\n )}\n {children}\n </div>\n)\n\n/** A row's label, after the indent and any marks: fills the row and truncates. */\nexport const treeText = \"ms-1.5 min-w-0 flex-1 truncate text-start\"\n\n/** A row's default label. */\nexport const TreeLabel = ({ className, children }: { className?: string; children: ReactNode }) => (\n <span className={cn(treeText, className)}>{children}</span>\n)\n\nexport type TreeCheckMarkProps = Omit<ComponentProps<\"span\">, \"children\"> & {\n checked: boolean\n indeterminate: boolean\n size: Size\n icons: { check: ReactNode; indeterminate: ReactNode }\n}\n\n/**\n * A row's checkbox, presentational: the state is the row's `aria-checked`. It borrows\n * Checkbox's own box, driven by `data-state` the way Ark drives the real one, so checked and\n * indeterminate match `Checkbox`.\n */\nexport const TreeCheckMark = ({\n checked,\n indeterminate,\n size,\n icons,\n className,\n ...rest\n}: TreeCheckMarkProps) => (\n <span\n aria-hidden\n data-state={checked ? \"checked\" : indeterminate ? \"indeterminate\" : \"unchecked\"}\n {...rest}\n className={cn(controlIndicator({ size, variant: \"filled\" }), className)}\n >\n {checked && icons.check}\n {indeterminate && icons.indeterminate}\n </span>\n)\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createDialogParts, DIALOG_PADDING, useDialogNameCheck, DialogRootProviders } from './chunk-
|
|
2
|
-
import { useLayerGuard, NestedLayer } from './chunk-
|
|
1
|
+
import { createDialogParts, DIALOG_PADDING, useDialogNameCheck, DialogRootProviders } from './chunk-5HWFYYHW.js';
|
|
2
|
+
import { useLayerGuard, NestedLayer } from './chunk-SI7C3W5M.js';
|
|
3
3
|
import { OverlayContainerProvider } from './chunk-SLUOF7XW.js';
|
|
4
4
|
import { props } from './chunk-WYCMIIRR.js';
|
|
5
5
|
import { TEXT_COLOR_CLASSES } from './chunk-GIPQUKCN.js';
|
|
@@ -207,6 +207,7 @@ var DrawerComponent = ({
|
|
|
207
207
|
"aria-label": ariaLabel,
|
|
208
208
|
"aria-labelledby": ariaLabelledby,
|
|
209
209
|
withCloseButton = true,
|
|
210
|
+
scrollable = true,
|
|
210
211
|
withGrabber = false,
|
|
211
212
|
withBackdrop = true,
|
|
212
213
|
padding = "md",
|
|
@@ -273,6 +274,7 @@ var DrawerComponent = ({
|
|
|
273
274
|
/* @__PURE__ */ jsx(
|
|
274
275
|
DrawerBody,
|
|
275
276
|
{
|
|
277
|
+
scrollable,
|
|
276
278
|
className: cn(
|
|
277
279
|
!hasHeader && !withGrabber && "pt-(--drawer-px,1.25rem)",
|
|
278
280
|
"pb-(--drawer-px,1.25rem)",
|
|
@@ -305,5 +307,5 @@ var Drawer = Object.assign(DrawerComponent, {
|
|
|
305
307
|
});
|
|
306
308
|
|
|
307
309
|
export { Drawer };
|
|
308
|
-
//# sourceMappingURL=chunk-
|
|
309
|
-
//# sourceMappingURL=chunk-
|
|
310
|
+
//# sourceMappingURL=chunk-LZHZJW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ui/react/portal\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport {\n type ComponentPropsWithoutRef,\n createContext,\n type ReactNode,\n useContext,\n useRef,\n} from \"react\"\nimport type { NoAsChild } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport { OverlayContainerProvider } from \"../../lib/overlay-container\"\nimport { NestedLayer, useLayerGuard } from \"../../lib/overlay-layer\"\nimport { props } from \"../../lib/props\"\nimport type { Size } from \"../../lib/sizes\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TEXT_COLOR_CLASSES } from \"../../lib/typography-size\"\nimport {\n createDialogParts,\n DIALOG_PADDING,\n type DialogBodyProps,\n type DialogCloseTriggerProps,\n type DialogIconSlot,\n type DialogIcons,\n DialogRootProviders,\n type DialogSectionProps,\n useDialogNameCheck,\n} from \"../overlays/dialog-parts\"\n\n/**\n * Drawer — edge-anchored panel on top of Ark UI's Drawer state machine. Ark\n * owns swipe-to-dismiss, snap points, focus-trap, scroll-lock and the\n * `data-state=\"open|closed\"` attribute; this wrapper adds an RTL-aware\n * `placement` (Ark has none). It is set once, on `Drawer.Root`, which derives\n * Ark's logical `swipeDirection` from it and shares it with the parts through\n * context; the positioner and content write it as `data-placement`. The slide\n * animation and the docked border are pure CSS keyed on `[data-placement]`\n * (see `theme.css`), so `start`/`end` flip automatically under `dir=\"rtl\"`.\n *\n * Mirrors `Modal`'s dual API: high-level `<Drawer open placement size … >` plus\n * low-level parts (`Drawer.Root`, `Drawer.Content`, …). Padding flows through\n * the `--drawer-px` CSS var.\n */\n\nexport type DrawerPlacement = \"start\" | \"end\" | \"top\" | \"bottom\"\n\n/** placement → Ark logical swipe axis (RTL handled by Ark for start/end). */\nconst PLACEMENT_TO_SWIPE = {\n start: \"start\",\n end: \"end\",\n top: \"up\",\n bottom: \"down\",\n} as const\n\n/** The root's placement, so the parts dock themselves without repeating it. */\nconst DrawerPlacementContext = createContext<DrawerPlacement>(\"end\")\n\nconst drawerBackdrop = cva([\n \"fixed inset-0 z-[calc(var(--modal-z,150)+var(--layer-index,0))] bg-black/50 backdrop-blur-lg pointer-events-auto select-none\",\n \"data-[state=open]:animate-fade-in data-[state=closed]:animate-fade-out\",\n])\n\nconst drawerPositioner = cva(\n \"fixed inset-0 z-[calc(var(--modal-z,150)+var(--layer-index,0))] flex overflow-clip\",\n {\n variants: {\n placement: {\n start: \"items-stretch justify-start\",\n end: \"items-stretch justify-end\",\n top: \"items-start justify-stretch\",\n bottom: \"items-end justify-stretch\",\n },\n },\n defaultVariants: { placement: \"end\" },\n },\n)\n\nexport type DrawerPositionerProps = NoAsChild<ComponentPropsWithoutRef<typeof Ark.Positioner>> &\n WithTestId\n\n/** Docks itself to the root's `placement`. Publishes itself as the portal\n * target for any overlay opened inside the drawer, so a Menu/Select/DatePicker\n * in a drawer body stays above the panel instead of behind it. See\n * `lib/overlay-container.tsx`. */\nconst DrawerPositioner = ({\n className,\n children,\n testId,\n asChild: _asChild,\n ...rest\n}: DrawerPositionerProps) => {\n const placement = useContext(DrawerPlacementContext)\n const positioner = useRef<HTMLDivElement>(null)\n return (\n <Ark.Positioner\n ref={positioner}\n className={cn(drawerPositioner({ placement }), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n data-placement={placement}\n >\n <OverlayContainerProvider value={positioner}>{children}</OverlayContainerProvider>\n </Ark.Positioner>\n )\n}\n\nconst drawerContent = cva(\n [\n \"relative flex flex-col overflow-hidden\",\n \"bg-brand-50 text-brand-950 shadow-2xl\",\n \"dark:bg-brand-950 dark:text-white\",\n \"focus:outline-none\",\n // border on the docked edge only — keyed by data-placement in theme.css\n \"data-[placement=start]:border-e data-[placement=end]:border-s\",\n \"data-[placement=top]:border-b data-[placement=bottom]:border-t\",\n \"border-brand-900/20 dark:border-white/15\",\n \"data-[state=open]:animate-drawer-in data-[state=closed]:animate-drawer-out\",\n ],\n {\n variants: {\n // Internal: Content reads it from the root's context.\n placement: {\n start: \"h-full max-w-[90vw]\",\n end: \"h-full max-w-[90vw]\",\n top: \"w-full max-h-[90dvh]\",\n bottom: \"w-full max-h-[90dvh]\",\n },\n // Width for inline placements, height for block ones: see compoundVariants.\n size: { xs: \"\", sm: \"\", md: \"\", lg: \"\", xl: \"\" },\n // Only the two corners away from the docked edge round: see compoundVariants.\n radius: { none: \"\", sm: \"\", md: \"\", lg: \"\", xl: \"\" },\n },\n compoundVariants: [\n { placement: [\"start\", \"end\"], size: \"xs\", class: \"w-[18rem]\" },\n { placement: [\"start\", \"end\"], size: \"sm\", class: \"w-[22rem]\" },\n { placement: [\"start\", \"end\"], size: \"md\", class: \"w-[28rem]\" },\n { placement: [\"start\", \"end\"], size: \"lg\", class: \"w-[34rem]\" },\n { placement: [\"start\", \"end\"], size: \"xl\", class: \"w-[42rem]\" },\n { placement: [\"top\", \"bottom\"], size: \"xs\", class: \"h-[30dvh]\" },\n { placement: [\"top\", \"bottom\"], size: \"sm\", class: \"h-[40dvh]\" },\n { placement: [\"top\", \"bottom\"], size: \"md\", class: \"h-[55dvh]\" },\n { placement: [\"top\", \"bottom\"], size: \"lg\", class: \"h-[70dvh]\" },\n { placement: [\"top\", \"bottom\"], size: \"xl\", class: \"h-[85dvh]\" },\n // Logical corners, so `start`/`end` mirror under RTL with the panel.\n { placement: \"start\", radius: \"sm\", class: \"rounded-e-sm\" },\n { placement: \"start\", radius: \"md\", class: \"rounded-e-md\" },\n { placement: \"start\", radius: \"lg\", class: \"rounded-e-xl\" },\n { placement: \"start\", radius: \"xl\", class: \"rounded-e-2xl\" },\n { placement: \"end\", radius: \"sm\", class: \"rounded-s-sm\" },\n { placement: \"end\", radius: \"md\", class: \"rounded-s-md\" },\n { placement: \"end\", radius: \"lg\", class: \"rounded-s-xl\" },\n { placement: \"end\", radius: \"xl\", class: \"rounded-s-2xl\" },\n { placement: \"top\", radius: \"sm\", class: \"rounded-b-sm\" },\n { placement: \"top\", radius: \"md\", class: \"rounded-b-md\" },\n { placement: \"top\", radius: \"lg\", class: \"rounded-b-xl\" },\n { placement: \"top\", radius: \"xl\", class: \"rounded-b-2xl\" },\n { placement: \"bottom\", radius: \"sm\", class: \"rounded-t-sm\" },\n { placement: \"bottom\", radius: \"md\", class: \"rounded-t-md\" },\n { placement: \"bottom\", radius: \"lg\", class: \"rounded-t-xl\" },\n { placement: \"bottom\", radius: \"xl\", class: \"rounded-t-2xl\" },\n ],\n defaultVariants: { placement: \"end\", size: \"md\", radius: \"none\" },\n },\n)\n\n// ---------------------------------------------------------------------------\n// Low-level parts\n// ---------------------------------------------------------------------------\n\nexport type DrawerIconSlot = DialogIconSlot\nexport type DrawerIcons = DialogIcons\n\nexport type DrawerRootProps = ComponentPropsWithoutRef<typeof Ark.Root> & {\n /** RTL-aware docking edge, shared with `Drawer.Positioner` and `Drawer.Content`. Also\n * sets Ark's `swipeDirection`, unless you pass one. @default \"end\" */\n placement?: DrawerPlacement\n /** Replaces the default icons: `close`. `Drawer.CloseTrigger`'s `children` win over it. */\n icons?: DrawerIcons\n}\n\n/** Ark's root, plus the nested-layer guard: while a picker opened inside the\n * drawer is open, an outside click closes the picker only, not the drawer\n * under it. It is also a layer of its own while open, so a hotkey on the page\n * (or in an enclosing overlay) yields to it. See `lib/overlay-layer.tsx`. */\nconst DrawerRoot = ({\n placement = \"end\",\n swipeDirection,\n onPointerDownOutside,\n icons,\n children,\n ...rest\n}: DrawerRootProps) => {\n const guard = useLayerGuard(onPointerDownOutside)\n return (\n <Ark.Root\n swipeDirection={swipeDirection ?? PLACEMENT_TO_SWIPE[placement]}\n onPointerDownOutside={guard.onPointerDownOutside}\n {...rest}\n >\n {/* A layer itself, registered with whatever it opened from (the page,\n or an enclosing overlay), so what's under it knows it's covered. */}\n <Ark.Context>{(api) => <NestedLayer open={api.open} modal />}</Ark.Context>\n <DrawerPlacementContext value={placement}>\n <DialogRootProviders icons={icons} layers={guard.layers}>\n {children}\n </DialogRootProviders>\n </DrawerPlacementContext>\n </Ark.Root>\n )\n}\nconst DrawerTrigger = Ark.Trigger\nconst DrawerContext = Ark.Context\n\nexport type DrawerBackdropProps = ComponentPropsWithoutRef<typeof Ark.Backdrop> & WithTestId\n\nconst DrawerBackdrop = ({ className, testId, ...rest }: DrawerBackdropProps) => (\n <Ark.Backdrop\n className={cn(drawerBackdrop(), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type DrawerTitleProps = ComponentPropsWithoutRef<typeof Ark.Title> & WithTestId\n\nconst DrawerTitle = ({ className, testId, ...rest }: DrawerTitleProps) => (\n <Ark.Title\n className={cn(\"text-xl font-semibold leading-tight\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type DrawerDescriptionProps = ComponentPropsWithoutRef<typeof Ark.Description> & WithTestId\n\nconst DrawerDescription = ({ className, testId, ...rest }: DrawerDescriptionProps) => (\n <Ark.Description\n className={cn(\"text-sm\", TEXT_COLOR_CLASSES.muted, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type DrawerSize = NonNullable<VariantProps<typeof drawerContent>[\"size\"]>\nexport type DrawerRadius = NonNullable<VariantProps<typeof drawerContent>[\"radius\"]>\n\nexport type DrawerContentProps = ComponentPropsWithoutRef<typeof Ark.Content> &\n WithTestId & {\n /** Width for `start`/`end` drawers, height for `top`/`bottom` ones. @default \"md\" */\n size?: DrawerSize\n /** Rounds the two corners away from the docked edge. @default \"none\" */\n radius?: DrawerRadius\n }\n\n/** The panel. It sizes and rounds itself for the root's `placement`, and writes\n * it as `data-placement`, which the slide animation and the docked border key on. */\nconst DrawerContent = ({ className, size, radius, testId, ...rest }: DrawerContentProps) => {\n const placement = useContext(DrawerPlacementContext)\n const nameCheck = useDialogNameCheck(\"Drawer\")\n return (\n <Ark.Content\n ref={nameCheck}\n className={cn(drawerContent({ placement, size, radius }), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n data-placement={placement}\n />\n )\n}\n\nexport type DrawerCloseTriggerProps = DialogCloseTriggerProps\nexport type DrawerHeaderProps = DialogSectionProps\nexport type DrawerBodyProps = DialogBodyProps\nexport type DrawerFooterProps = DialogSectionProps\n\nconst {\n CloseTrigger: DrawerCloseTrigger,\n Header: DrawerHeader,\n Body: DrawerBody,\n Footer: DrawerFooter,\n} = createDialogParts(\"drawer\", Ark.CloseTrigger)\n\nexport type DrawerGrabberProps = NoAsChild<ComponentPropsWithoutRef<typeof Ark.Grabber>> &\n WithTestId\n\nconst DrawerGrabber = ({ className, testId, asChild: _asChild, ...rest }: DrawerGrabberProps) => (\n <Ark.Grabber\n className={cn(\n \"flex shrink-0 cursor-grab touch-none items-center justify-center py-2\",\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n <Ark.GrabberIndicator className=\"h-1.5 w-20 rounded-full bg-brand-900/10 dark:bg-white/16\" />\n </Ark.Grabber>\n)\n\n// ---------------------------------------------------------------------------\n// High-level props-driven Drawer\n// ---------------------------------------------------------------------------\n\ntype ArkRootProps = ComponentPropsWithoutRef<typeof Ark.Root>\n\nexport type DrawerClassNames = Partial<\n Record<\n | \"backdrop\"\n | \"positioner\"\n | \"content\"\n | \"header\"\n | \"title\"\n | \"description\"\n | \"body\"\n | \"grabber\"\n | \"closeButton\",\n string\n >\n>\n\nexport type DrawerProps = Omit<\n ArkRootProps,\n \"open\" | \"defaultOpen\" | \"onOpenChange\" | \"children\" | \"swipeDirection\" | \"role\"\n> &\n WithTestId & {\n /** Controlled open state. */\n open?: boolean\n /** Uncontrolled initial open state. */\n defaultOpen?: boolean\n /** Fires with the next open state. Flattened from Ark's `{ open }`. */\n onOpenChange?: (open: boolean) => void\n /** Fires on close (any source) — Escape, backdrop click, swipe, or a controlled `onOpenChange`. */\n onClose?: () => void\n /** RTL-aware docking edge. @default \"end\" */\n placement?: DrawerPlacement\n /** Width for `start`/`end` drawers, height for `top`/`bottom` ones. @default \"md\" */\n size?: DrawerSize\n /** Rounds the two corners away from the docked edge. @default \"none\" */\n radius?: DrawerRadius\n /** Header title; also the drawer's accessible name. */\n title?: ReactNode\n description?: ReactNode\n /** Accessible name for a drawer without a `title` (a navigation panel, say). */\n \"aria-label\"?: string\n /** Id of an element inside the drawer that names it, when there is no `title`. */\n \"aria-labelledby\"?: string\n /** Render the default close button in the header. @default true */\n withCloseButton?: boolean\n /** Scroll the body (a `ScrollArea`). `false` for content that owns its own scroller; see\n * `Drawer.Body`'s `scrollable`. @default true */\n scrollable?: boolean\n /** Show the drag grabber handle. @default false */\n withGrabber?: boolean\n /**\n * Render the dimming backdrop. Set `false` when an ancestor (e.g. the modals\n * manager) draws a single shared backdrop for the whole overlay stack.\n * @default true\n */\n withBackdrop?: boolean\n /** Inner padding token; sets `--drawer-px`. @default \"md\" */\n padding?: Size\n closeOnEscape?: boolean\n /** Close on a click outside the drawer. @default true, false for an `alertdialog` */\n closeOnInteractOutside?: boolean\n /** Use `alertdialog` semantics (confirm flows). @default \"dialog\" */\n role?: \"dialog\" | \"alertdialog\"\n /** Fires after the exit animation completes — the manager unmounts on this. */\n onExitComplete?: () => void\n /** Portal target. Defaults to `document.body`. */\n container?: HTMLElement | null\n children?: ReactNode\n className?: string\n classNames?: DrawerClassNames\n /** Overrides the default close button's accessible name (`closeTriggerLabel`, default\n * `\"Close\"`). The compound `DrawerCloseTrigger` part takes a plain `aria-label` instead. */\n translations?: DrawerTranslations\n /** Replaces the default icons: `close`, the header's close button. */\n icons?: DrawerIcons\n }\n\n/** The ready-made drawer's wording — `closeTriggerLabel` follows Ark's naming for the\n * same control. */\nexport type DrawerTranslations = { closeTriggerLabel?: string }\n\nconst DrawerComponent = ({\n open,\n defaultOpen,\n onOpenChange,\n onClose,\n placement = \"end\",\n size,\n radius,\n title,\n description,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledby,\n withCloseButton = true,\n scrollable = true,\n withGrabber = false,\n withBackdrop = true,\n padding = \"md\",\n closeOnEscape,\n closeOnInteractOutside,\n role,\n onExitComplete,\n container,\n children,\n className,\n classNames,\n testId,\n translations,\n icons,\n ...rest\n}: DrawerProps) => {\n const hasHeader = title != null || description != null || withCloseButton\n\n return (\n <DrawerRoot\n open={open}\n defaultOpen={defaultOpen}\n onOpenChange={({ open: next }) => {\n onOpenChange?.(next)\n if (!next) onClose?.()\n }}\n placement={placement}\n closeOnEscape={closeOnEscape}\n // Spelled out to match Modal, whose Ark dialog derives this default from\n // `modal` (so the overlays manager's `withBackdrop={false}` would stop\n // outside clicks there). Ark's drawer defaults it to `true` for every role\n // instead, so here the one behaviour this changes is the `alertdialog`:\n // it stays sticky, as on Modal, unless the caller opts in explicitly.\n closeOnInteractOutside={closeOnInteractOutside ?? role !== \"alertdialog\"}\n role={role}\n // Unmount the whole content tree (incl. the `fixed inset-0` positioner)\n // on close — otherwise the positioner lingers as a transparent overlay\n // that swallows page clicks. `lazyMount` keeps it out of the DOM until\n // first open.\n lazyMount\n unmountOnExit\n modal={withBackdrop}\n onExitComplete={onExitComplete}\n icons={icons}\n {...rest}\n >\n <Portal container={container ? { current: container } : undefined}>\n {withBackdrop && <DrawerBackdrop className={classNames?.backdrop} />}\n <DrawerPositioner className={classNames?.positioner}>\n <DrawerContent\n size={size}\n radius={radius}\n style={{ [\"--drawer-px\" as string]: DIALOG_PADDING[padding] }}\n className={cn(className, classNames?.content)}\n testId={testId}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n >\n {withGrabber && <DrawerGrabber className={classNames?.grabber} />}\n {hasHeader && (\n <DrawerHeader className={classNames?.header}>\n <div className=\"flex flex-col gap-1\">\n {title != null && (\n <DrawerTitle className={classNames?.title}>{title}</DrawerTitle>\n )}\n {description != null && (\n <DrawerDescription className={classNames?.description}>\n {description}\n </DrawerDescription>\n )}\n </div>\n {withCloseButton && (\n <DrawerCloseTrigger\n aria-label={translations?.closeTriggerLabel}\n className={classNames?.closeButton}\n />\n )}\n </DrawerHeader>\n )}\n <DrawerBody\n scrollable={scrollable}\n className={cn(\n !hasHeader && !withGrabber && \"pt-(--drawer-px,1.25rem)\",\n \"pb-(--drawer-px,1.25rem)\",\n classNames?.body,\n )}\n >\n {children}\n </DrawerBody>\n </DrawerContent>\n </DrawerPositioner>\n </Portal>\n </DrawerRoot>\n )\n}\n\nexport const Drawer = Object.assign(DrawerComponent, {\n Root: DrawerRoot,\n Trigger: DrawerTrigger,\n Context: DrawerContext,\n Backdrop: DrawerBackdrop,\n Positioner: DrawerPositioner,\n Content: DrawerContent,\n Title: DrawerTitle,\n Description: DrawerDescription,\n CloseTrigger: DrawerCloseTrigger,\n Grabber: DrawerGrabber,\n Header: DrawerHeader,\n Body: DrawerBody,\n Footer: DrawerFooter,\n})\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Slider } from './chunk-
|
|
1
|
+
import { Slider } from './chunk-D7SW2E24.js';
|
|
2
2
|
import { cutoutMask } from './chunk-K6YASO4L.js';
|
|
3
3
|
import { MEDIA_RADIUS } from './chunk-J43LSYQO.js';
|
|
4
4
|
import { useObjectUrl } from './chunk-DTFSCR3U.js';
|
|
5
|
-
import { useMergedRefs } from './chunk-HBWV5EPU.js';
|
|
6
5
|
import { ratioToNumber } from './chunk-AHM6SGEU.js';
|
|
6
|
+
import { useMergedRefs } from './chunk-HBWV5EPU.js';
|
|
7
7
|
import { useLocale, useDirectionCheck } from './chunk-OBSZ4NE2.js';
|
|
8
|
-
import { ActionIcon } from './chunk-
|
|
8
|
+
import { ActionIcon } from './chunk-ALANKV5Y.js';
|
|
9
9
|
import { iconStroke, mergeIcons } from './chunk-XXOR34T4.js';
|
|
10
10
|
import { props } from './chunk-WYCMIIRR.js';
|
|
11
11
|
import { focusStyles } from './chunk-C6NVU4F7.js';
|
|
@@ -433,5 +433,5 @@ var ImageCropper = Object.assign(ImageCropperComponent, {
|
|
|
433
433
|
});
|
|
434
434
|
|
|
435
435
|
export { ImageCropper, useImageCropperContext };
|
|
436
|
-
//# sourceMappingURL=chunk-
|
|
437
|
-
//# sourceMappingURL=chunk-
|
|
436
|
+
//# sourceMappingURL=chunk-MAM2X3MW.js.map
|
|
437
|
+
//# sourceMappingURL=chunk-MAM2X3MW.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/image-cropper/image-cropper.tsx"],"names":["shape","Ark","useArkImageCropperContext"],"mappings":";;;;;;;;;;;;;;;;;;;AA+GO,IAAM,oBAAA,GAA2D;AAAA,EACtE,KAAA,EAAO,eAAA;AAAA,EACP,eAAA,EAAiB,eAAA;AAAA,EACjB,OAAA,EAAS,mBAAA;AAAA,EACT,OAAA,EAAS,CAAC,EAAE,IAAA,EAAM,UAAU,CAAA,EAAG,CAAA,EAAG,OAAO,MAAA,EAAO,KAC9C,QAAQ,IAAI,CAAA,UAAA,EAAa,QAAQ,CAAA,UAAA,EAAa,CAAC,wBAAwB,CAAC,CAAA,iBAAA,EAAoB,KAAK,CAAA,MAAA,EAAS,MAAM,CAAA,GAAA,CAAA;AAAA,EAClH,cAAA,EAAgB,CAAC,KAAA,KAAU,CAAA,gBAAA,EAAmB,KAAK,CAAA,CAAA,CAAA;AAAA,EACnD,wBAAA,EAA0B,WAAA;AAAA,EAC1B,qBAAA,EACE,8GAAA;AAAA,EACF,gBAAgB,CAAC,EAAE,KAAA,EAAO,CAAA,EAAG,GAAG,KAAA,EAAO,MAAA,EAAO,KAC5C,KAAA,CAAM,KAAK,CAAA,CACR,IAAA,CAAK,QAAA,EAAU,MAAM,cAAc,CAAC,CAAA,MAAA,EAAS,CAAC,CAAA,aAAA,EAAgB,KAAK,CAAA,GAAA,CAAK,CAAA,CACxE,IAAA,CAAK,WAAA,EAAa,MAAM,CAAA,WAAA,EAAc,CAAC,CAAA,MAAA,EAAS,CAAC,YAAY,KAAK,CAAA,MAAA,EAAS,MAAM,CAAA,GAAA,CAAK,EACtF,UAAA,EAAW;AAAA,EAChB,aAAA,EAAe,eAAA;AAAA,EACf,SAAA,EAAW,MAAA;AAAA,EACX,SAAA,EAAW,CAAC,OAAA,KAAY,OAAA;AAAA,EACxB,eAAA,EAAiB,aAAA;AAAA,EACjB,gBAAA,EAA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A,EAAkB,GAAA,EAAU,WAAA,EAA0B,SAAA,EAAW,YAAY,KAAA,EAAO,CAAA;AAAA,oBACrF,GAAA,CAAC,qBAAA,EAAA,EAAsB,QAAA,EAAoB,SAAA,EAAW,YAAY,SAAA,EAAW;AAAA,GAAA,EAC/E,CAAA;AAAA,EACC,YAAA,oBAAgB,GAAA,CAAC,oBAAA,EAAA,EAAqB,SAAA,EAAW,YAAY,QAAA,EAAU,CAAA;AAAA,EACvE;AAAA,CAAA,EACH,CAAA;AAGK,IAAM,YAAA,GAAe,MAAA,CAAO,MAAA,CAAO,qBAAA,EAAuB;AAAA,EAC/D,IAAA,EAAM,gBAAA;AAAA,EACN,QAAA,EAAU,oBAAA;AAAA,EACV,KAAA,EAAO,iBAAA;AAAA,EACP,SAAA,EAAW,qBAAA;AAAA,EACX,MAAA,EAAQ,kBAAA;AAAA,EACR,IAAA,EAAM,gBAAA;AAAA,EACN,QAAA,EAAU,oBAAA;AAAA,EACV,OAAA,EAAS;AACX,CAAC","file":"chunk-5EOMSWNO.js","sourcesContent":["\"use client\"\n\nimport {\n ImageCropper as Ark,\n type ImageCropperRootProps as ArkRootProps,\n type ImageCropperCropChangeDetails,\n type ImageCropperFlipState,\n type ImageCropperHandlePosition,\n type UseImageCropperContext,\n useImageCropperContext as useArkImageCropperContext,\n} from \"@ark-ui/react/image-cropper\"\nimport {\n FlipHorizontal2,\n FlipVertical2,\n RefreshCcw,\n RotateCcw,\n RotateCw,\n ZoomIn,\n ZoomOut,\n} from \"lucide-react\"\nimport {\n type ComponentPropsWithoutRef,\n createContext,\n type ReactNode,\n type Ref,\n useContext,\n useMemo,\n} from \"react\"\nimport { match } from \"ts-pattern\"\nimport type { NoAsChild } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { cutoutMask } from \"../../lib/cutout\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { type IconMap, iconStroke, mergeIcons } from \"../../lib/icons\"\nimport { useDirectionCheck, useLocale } from \"../../lib/intl\"\nimport { useMergedRefs } from \"../../lib/merge-refs\"\nimport { props } from \"../../lib/props\"\nimport { MEDIA_RADIUS, type MediaRadius } from \"../../lib/radius\"\nimport { type Ratio, ratioToNumber } from \"../../lib/ratio\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TYPOGRAPHY_SHADE_CLASSES } from \"../../lib/typography-size\"\nimport { useObjectUrl } from \"../../lib/use-object-url\"\nimport { ActionIcon } from \"../action-icon/action-icon\"\nimport { Slider } from \"../slider/slider\"\n\n/**\n * ImageCropper — pick the part of an image to keep: drag the selection, pull\n * its handles, pinch or wheel to zoom, rotate and flip, then export the crop.\n *\n * <ImageCropper src={file} ratio={1} shape=\"circle\" withControls>\n * <ImageCropper.Context>\n * {(api) => <Button onClick={() => api.getCroppedImage().then(upload)}>Save</Button>}\n * </ImageCropper.Context>\n * </ImageCropper>\n *\n * Built on Ark's image cropper (a \"preview\" component in Ark 5.39, see the\n * docs page), which owns the geometry, the gestures, the keyboard and the\n * canvas export. The kit adds the look (an outside dim, handles that survive\n * forced colors), the controls, `src` as a `Blob`, `ratio` in the media\n * components' shape, flattened callbacks and translations with\n * locale-formatted numbers.\n *\n * The result is read from `ImageCropper.Context`, not an imperative ref:\n * `getCroppedImage()` draws the crop to a canvas and resolves a `Blob` (or a\n * data URL), `getCropData()` returns the crop in the image's own pixels for a\n * server to cut.\n */\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport type ImageCropperShape = \"rectangle\" | \"circle\"\nexport type ImageCropperFlip = ImageCropperFlipState\n/** A crop rectangle, in px of the viewport. */\nexport type ImageCropperRect = ImageCropperCropChangeDetails[\"crop\"]\nexport type { ImageCropperHandlePosition }\n\n/** A crop rectangle with every number already formatted for the locale. */\nexport type ImageCropperFormattedRect = { x: string; y: string; width: string; height: string }\n\nexport type ImageCropperTranslations = {\n /** The cropper's accessible name. */\n label?: string\n /** What kind of thing the cropper is, announced with its name. */\n roleDescription?: string\n /** The cropper's description while the image loads. */\n loading?: string\n /** The cropper's description once the image is ready. `zoom` is a percent, `rotation` in degrees. */\n preview?: (details: ImageCropperFormattedRect & { zoom: string; rotation: string }) => string\n /** The selection's accessible name. */\n selectionLabel?: (shape: ImageCropperShape) => string\n /** What kind of thing the selection is. Ark's default is the APG \"2d slider\". */\n selectionRoleDescription?: string\n /** How to move it from the keyboard, read as the selection's description. */\n selectionInstructions?: string\n /** The selection's `aria-valuetext`: where it is and how big. */\n selectionValue?: (details: ImageCropperFormattedRect & { shape: ImageCropperShape }) => string\n /** Names the group of controls. */\n controlsLabel?: string\n zoomLabel?: string\n /** The zoom slider's `aria-valuetext`. `percent` is formatted (`\"150%\"`). */\n zoomValue?: (percent: string) => string\n rotateLeftLabel?: string\n rotateRightLabel?: string\n flipHorizontalLabel?: string\n flipVerticalLabel?: string\n resetLabel?: string\n}\n\nexport const DEFAULT_TRANSLATIONS: Required<ImageCropperTranslations> = {\n label: \"Image cropper\",\n roleDescription: \"image cropper\",\n loading: \"Loading the image\",\n preview: ({ zoom, rotation, x, y, width, height }) =>\n `Zoom ${zoom}, rotated ${rotation}. Crop at ${x}px from the left and ${y}px from the top, ${width}px by ${height}px.`,\n selectionLabel: (shape) => `Crop selection (${shape})`,\n selectionRoleDescription: \"2d slider\",\n selectionInstructions:\n \"Use the arrow keys to move the crop. Hold Alt with the arrow keys to resize it. Press plus or minus to zoom.\",\n selectionValue: ({ shape, x, y, width, height }) =>\n match(shape)\n .with(\"circle\", () => `Position X ${x}px, Y ${y}px. Diameter ${width}px.`)\n .with(\"rectangle\", () => `Position X ${x}px, Y ${y}px. Size ${width}px by ${height}px.`)\n .exhaustive(),\n controlsLabel: \"Crop controls\",\n zoomLabel: \"Zoom\",\n zoomValue: (percent) => percent,\n rotateLeftLabel: \"Rotate left\",\n rotateRightLabel: \"Rotate right\",\n flipHorizontalLabel: \"Flip horizontally\",\n flipVerticalLabel: \"Flip vertically\",\n resetLabel: \"Reset\",\n}\n\ntype ArkTranslations = NonNullable<ArkRootProps[\"translations\"]>\n\n/** What the Root shares with the parts Ark's context doesn't cover. */\nexport type ImageCropperIconSlot =\n | \"rotateLeft\"\n | \"rotateRight\"\n | \"flipHorizontal\"\n | \"flipVertical\"\n | \"zoomOut\"\n | \"zoomIn\"\n | \"reset\"\nexport type ImageCropperIcons = IconMap<ImageCropperIconSlot>\n\n/**\n * The default icons of `ImageCropper.Controls`, named like the\n * `translations` labels of the buttons they sit in. None of them points along\n * the inline axis (a rotation turns the same way in either direction, and the\n * zoom glyphs sit at the slider's start and end), so none mirrors under RTL.\n */\nexport const DEFAULT_ICONS: Record<ImageCropperIconSlot, ReactNode> = {\n rotateLeft: <RotateCcw className={iconStroke} />,\n rotateRight: <RotateCw className={iconStroke} />,\n flipHorizontal: <FlipHorizontal2 className={iconStroke} />,\n flipVertical: <FlipVertical2 className={iconStroke} />,\n zoomOut: <ZoomOut className={iconStroke} />,\n zoomIn: <ZoomIn className={iconStroke} />,\n reset: <RefreshCcw className={iconStroke} />,\n}\n\ntype Shared = {\n t: Required<ImageCropperTranslations>\n icons: Record<ImageCropperIconSlot, ReactNode>\n percent: (value: number) => string\n minZoom: number\n maxZoom: number\n shape: ImageCropperShape\n /** The locked width / height (1 for a circle), which the export holds to the pixel. */\n aspect: number | undefined\n}\n\nconst SharedContext = createContext<Shared>({\n t: DEFAULT_TRANSLATIONS,\n icons: DEFAULT_ICONS,\n percent: String,\n minZoom: 1,\n maxZoom: 5,\n shape: \"rectangle\",\n aspect: undefined,\n})\n\n// ---------------------------------------------------------------------------\n// Styles\n// ---------------------------------------------------------------------------\n\n/**\n * Each handle's hit box and visible mark, by position. Ark already places the\n * handle on the selection's edge (`top`/`left`/`right`/`bottom`, centered\n * with `translate`, edges at 96% of the side); this sizes the hit box and\n * shapes the mark, an `::after` centered in it, so the handle stays a bare\n * element any `asChild` child can become.\n *\n * The mark is the Slider thumb: a palette border on the page-tinted fill.\n * Corners are round thumbs, edges are pills along their side. The hit box is\n * 24px under a mouse and 44px (WCAG 2.5.8) under a finger, around the same\n * small mark.\n *\n * Physical sides, not logical ones: the crop is a rectangle in the image's own\n * space, where `e` is the image's right edge whatever the text direction, and\n * Ark positions the handles that way too.\n *\n * Corners sit above the edge bars (`z-1`), which overlap them at 96% of the\n * side, so a press near a corner resizes both ways. On a circle only the four\n * edge pills show: they're the points that touch it.\n */\nconst HANDLE: Record<ImageCropperHandlePosition, string> = {\n nw: \"z-1 size-6 pointer-coarse:size-11 after:size-3.5 in-data-[shape=circle]:after:hidden\",\n ne: \"z-1 size-6 pointer-coarse:size-11 after:size-3.5 in-data-[shape=circle]:after:hidden\",\n se: \"z-1 size-6 pointer-coarse:size-11 after:size-3.5 in-data-[shape=circle]:after:hidden\",\n sw: \"z-1 size-6 pointer-coarse:size-11 after:size-3.5 in-data-[shape=circle]:after:hidden\",\n n: \"h-6 pointer-coarse:h-11 after:h-2 after:w-6\",\n s: \"h-6 pointer-coarse:h-11 after:h-2 after:w-6\",\n e: \"w-6 pointer-coarse:w-11 after:h-6 after:w-2\",\n w: \"w-6 pointer-coarse:w-11 after:h-6 after:w-2\",\n}\n\n/** A ≥ 44px control (WCAG 2.5.8). */\nconst control = \"h-11 [&_svg]:size-5\"\n/** The zoom slider's end glyphs: decorative, the slider carries the name. */\nconst zoomIcon = \"flex shrink-0 [&_svg]:size-4\"\n\n// ---------------------------------------------------------------------------\n// Root\n// ---------------------------------------------------------------------------\n\nexport type ImageCropperRootProps = Omit<\n ArkRootProps,\n | \"aspectRatio\"\n | \"cropShape\"\n | \"translations\"\n | \"onZoomChange\"\n | \"onRotationChange\"\n | \"onFlipChange\"\n | \"onCropChange\"\n> &\n WithTestId & {\n /** Locks the selection to this width / height. Free when unset; a circle is always 1. */\n ratio?: Ratio\n /** A circle crop still exports a square: mask it where you show it. */\n shape?: ImageCropperShape\n /** Fires as the zoom changes, from 1 (fit) up. */\n onZoomChange?: (zoom: number) => void\n /** Fires as the rotation changes, in degrees. */\n onRotationChange?: (rotation: number) => void\n onFlipChange?: (flip: ImageCropperFlip) => void\n /** Fires as the selection moves or resizes, in px of the viewport. */\n onCropChange?: (crop: ImageCropperRect) => void\n translations?: ImageCropperTranslations\n /** Replaces the control icons: `rotateLeft`, `rotateRight`, `flipHorizontal`,\n * `flipVertical`, `zoomOut`, `zoomIn`, `reset`. Drawn as given, never restroked. */\n icons?: ImageCropperIcons\n /**\n * The palette of the selection's edge, handles, focus ring and zoom slider.\n * `brand` by default: on a photo, the kit's black-and-white default palette\n * would read as plain chrome rather than as a control.\n */\n color?: Color\n ref?: Ref<HTMLDivElement>\n }\n\n/** `\"16/9\"` → `1.777…`, and nothing for a ratio that can't lock a selection. */\nconst aspectRatioOf = (ratio: Ratio | undefined) => {\n const value = ratio === undefined ? Number.NaN : ratioToNumber(ratio)\n return Number.isFinite(value) && value > 0 ? value : undefined\n}\n\nconst ImageCropperRoot = ({\n ratio,\n shape,\n onZoomChange,\n onRotationChange,\n onFlipChange,\n onCropChange,\n translations,\n icons,\n minZoom = 1,\n maxZoom = 5,\n color = \"brand\",\n className,\n testId,\n ref,\n ...rest\n}: ImageCropperRootProps) => {\n const locale = useLocale()\n const direction = useDirectionCheck()\n\n const [shared, arkTranslations] = useMemo(() => {\n const t = { ...DEFAULT_TRANSLATIONS, ...translations }\n const pixels = new Intl.NumberFormat(locale, { maximumFractionDigits: 0 })\n const percent = new Intl.NumberFormat(locale, { style: \"percent\", maximumFractionDigits: 0 })\n const degrees = new Intl.NumberFormat(locale, {\n style: \"unit\",\n unit: \"degree\",\n maximumFractionDigits: 0,\n })\n const rect = ({ x, y, width, height }: ImageCropperRect): ImageCropperFormattedRect => ({\n x: pixels.format(x),\n y: pixels.format(y),\n width: pixels.format(width),\n height: pixels.format(height),\n })\n const ark: ArkTranslations = {\n rootLabel: t.label,\n rootRoleDescription: t.roleDescription,\n previewLoading: t.loading,\n previewDescription: ({ crop, zoom, rotation }) =>\n t.preview({\n ...rect(crop),\n zoom: percent.format(zoom ?? 1),\n rotation: degrees.format(rotation ?? 0),\n }),\n selectionLabel: ({ shape }) => t.selectionLabel(shape),\n selectionRoleDescription: t.selectionRoleDescription,\n selectionInstructions: t.selectionInstructions,\n selectionValueText: ({ shape, ...crop }) => t.selectionValue({ shape, ...rect(crop) }),\n }\n const value: Shared = {\n t,\n icons: mergeIcons(DEFAULT_ICONS, icons),\n percent: (n) => percent.format(n),\n minZoom,\n maxZoom,\n shape: shape ?? \"rectangle\",\n aspect: shape === \"circle\" ? 1 : aspectRatioOf(ratio),\n }\n return [value, ark] as const\n }, [translations, icons, locale, minZoom, maxZoom, shape, ratio])\n\n const rootRef = useMergedRefs(ref, direction)\n return (\n <SharedContext value={shared}>\n <Ark.Root\n ref={rootRef}\n aspectRatio={aspectRatioOf(ratio)}\n cropShape={shape}\n minZoom={minZoom}\n maxZoom={maxZoom}\n translations={arkTranslations}\n onZoomChange={onZoomChange && (({ zoom }) => onZoomChange(zoom))}\n onRotationChange={onRotationChange && (({ rotation }) => onRotationChange(rotation))}\n onFlipChange={onFlipChange && (({ flip }) => onFlipChange(flip))}\n onCropChange={onCropChange && (({ crop }) => onCropChange(crop))}\n data-color={color}\n className={cn(\"flex w-full flex-col gap-3\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n </SharedContext>\n )\n}\n\n// ---------------------------------------------------------------------------\n// Parts\n// ---------------------------------------------------------------------------\n\nexport type ImageCropperViewportProps = Ark.ViewportProps &\n WithTestId & {\n /** Corner radius, from the media scale. */\n radius?: MediaRadius\n }\n\n/** The frame the image is cropped in. Takes the pan, wheel and pinch gestures. */\nconst ImageCropperViewport = ({\n radius = \"xs\",\n className,\n testId,\n ...rest\n}: ImageCropperViewportProps) => (\n <Ark.Viewport\n className={cn(\n \"relative touch-none select-none overflow-clip bg-black/80\",\n MEDIA_RADIUS[radius],\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type ImageCropperImageProps = NoAsChild<\n Omit<Ark.ImageProps, \"src\"> &\n WithTestId & {\n /** A URL, or a `Blob` / `File`, shown through an object URL that's revoked when it changes. */\n src: string | Blob\n }\n>\n\n/**\n * The image being cropped. Decorative to assistive technology: the cropper's\n * own description says what's selected. Fades in once Ark has measured it.\n *\n * A cross-origin URL needs `crossOrigin=\"anonymous\"` (and CORS headers on the\n * server) for `getCroppedImage()`; without them the canvas is tainted and the\n * export resolves `null`.\n */\nconst ImageCropperImage = ({\n src,\n className,\n testId,\n asChild: _asChild,\n ...rest\n}: ImageCropperImageProps) => {\n const url = useObjectUrl(src)\n return (\n <Ark.Image\n src={url}\n className={cn(\n \"block h-auto w-full max-w-none opacity-0 data-ready:opacity-100\",\n \"transition-opacity duration-(--duration-normal) ease-standard motion-reduce:transition-none\",\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n )\n}\n\nexport type ImageCropperSelectionProps = NoAsChild<\n Ark.SelectionProps &\n WithTestId & {\n /** Rule-of-thirds lines inside the selection, shown while it's dragged or resized. */\n withGrid?: boolean\n }\n>\n\n/** The selection's hole in the dim: Ark sets the crop rectangle as custom properties on the root. */\nconst CROP_RECT = {\n x: \"var(--crop-x)\",\n y: \"var(--crop-y)\",\n width: \"var(--crop-width)\",\n height: \"var(--crop-height)\",\n}\n\n/**\n * The crop area: a `role=\"slider\"` that moves with the arrow keys, resizes\n * with Alt + arrows and zooms with `+`/`-`.\n *\n * Everything outside it is dimmed like a Modal backdrop by an overlay drawn\n * just before it, with the selection cut out of it (`lib/cutout.ts`): a real\n * rectangle or circle, following the crop through Ark's `--crop-*` custom\n * properties without a render. The overlay steps aside in forced colors,\n * where it would paint `Canvas` over the image; the edge and the handles,\n * borders both, are repainted instead.\n */\nconst ImageCropperSelection = ({\n withGrid = true,\n className,\n testId,\n children,\n asChild: _asChild,\n ...rest\n}: ImageCropperSelectionProps) => {\n const { shape } = useContext(SharedContext)\n return (\n <>\n <div\n aria-hidden\n data-part=\"overlay\"\n data-shape={shape}\n // The Modal backdrop's dim, with a light blur: the frame stays legible\n // around the crop without competing with it.\n className=\"pointer-events-none absolute inset-0 bg-black/50 backdrop-blur-xs forced-colors:hidden\"\n style={cutoutMask(shape, CROP_RECT)}\n />\n <Ark.Selection\n className={cn(\n \"cursor-move border border-(--c-solid) data-[shape=circle]:rounded-full\",\n // A pale halo around the 1px palette edge: two tones, so it holds on a dark photo and a bright one.\n \"shadow-[0_0_0_1px_rgb(255_255_255/0.45)]\",\n \"data-disabled:cursor-default\",\n // Inset and gap-less: the selection can sit flush with the clipping viewport.\n focusStyles({ ring: \"palette\", offset: false, inset: true }),\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {withGrid && (\n <>\n <ImageCropperGrid axis=\"horizontal\" />\n <ImageCropperGrid axis=\"vertical\" />\n </>\n )}\n {Ark.handles.map((position) => (\n <ImageCropperHandle key={position} position={position} />\n ))}\n {children}\n </Ark.Selection>\n </>\n )\n}\n\nexport type ImageCropperHandleProps = Ark.HandleProps & WithTestId\n\n/** One resize handle. `Selection` renders all eight; use it when you compose your own. */\nconst ImageCropperHandle = ({ position, className, testId, ...rest }: ImageCropperHandleProps) => (\n <Ark.Handle\n position={position}\n className={cn(\n \"after:absolute after:top-1/2 after:left-1/2 after:-translate-1/2 after:rounded-full\",\n \"after:border-2 after:border-(--c-solid) after:bg-brand-50 after:shadow-sm dark:after:bg-brand-950\",\n // Grows a touch while held, like the Slider thumb.\n \"after:transition-[scale] after:duration-(--duration-fast) after:ease-standard motion-reduce:after:transition-none\",\n \"in-data-dragging:after:scale-110\",\n \"data-disabled:hidden\",\n HANDLE[position],\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type ImageCropperGridProps = Ark.GridProps & WithTestId\n\n/** A pair of rule-of-thirds lines, along `axis`. Fades in while the crop is dragged, resized or panned. */\nconst ImageCropperGrid = ({ className, testId, ...rest }: ImageCropperGridProps) => (\n <Ark.Grid\n className={cn(\n \"border-white/50 data-[axis=horizontal]:border-y data-[axis=vertical]:border-x\",\n \"opacity-0 data-dragging:opacity-100 data-panning:opacity-100\",\n \"transition-opacity duration-(--duration-fast) ease-standard motion-reduce:transition-none\",\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type ImageCropperControlsProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\n/**\n * Zoom slider, rotate ±90°, flip and reset, wired to the nearest cropper. Each\n * is a 44px button named from `translations`; the flips are toggle buttons.\n */\nconst ImageCropperControls = ({ className, testId, ...rest }: ImageCropperControlsProps) => {\n const api = useImageCropperContext()\n const { t, icons, percent, minZoom, maxZoom } = useContext(SharedContext)\n return (\n // biome-ignore lint/a11y/useSemanticElements: a `<fieldset>` brings UA border/padding/`min-inline-size` that fight this wrapping flex row, for the same `group` semantics\n <div\n role=\"group\"\n aria-label={t.controlsLabel}\n className={cn(\"flex flex-wrap items-center gap-1\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n <ActionIcon\n variant=\"subtle\"\n color=\"neutral\"\n className={control}\n aria-label={t.rotateLeftLabel}\n onClick={() => api.rotateBy(-90)}\n >\n {icons.rotateLeft}\n </ActionIcon>\n <ActionIcon\n variant=\"subtle\"\n color=\"neutral\"\n className={control}\n aria-label={t.rotateRightLabel}\n onClick={() => api.rotateBy(90)}\n >\n {icons.rotateRight}\n </ActionIcon>\n <ActionIcon\n variant=\"subtle\"\n color=\"neutral\"\n className={control}\n aria-label={t.flipHorizontalLabel}\n aria-pressed={api.flip.horizontal}\n onClick={() => api.flipHorizontally()}\n >\n {icons.flipHorizontal}\n </ActionIcon>\n <ActionIcon\n variant=\"subtle\"\n color=\"neutral\"\n className={control}\n aria-label={t.flipVerticalLabel}\n aria-pressed={api.flip.vertical}\n onClick={() => api.flipVertically()}\n >\n {icons.flipVertical}\n </ActionIcon>\n <div\n className={cn(\n \"flex min-w-40 flex-1 items-center gap-2 px-2\",\n TYPOGRAPHY_SHADE_CLASSES.muted,\n )}\n >\n <span aria-hidden className={zoomIcon}>\n {icons.zoomOut}\n </span>\n <Slider\n min={minZoom}\n max={maxZoom}\n step={0.01}\n value={api.zoom}\n onChange={(zoom) => api.setZoom(zoom)}\n aria-label={[t.zoomLabel]}\n getAriaValueText={({ value }) => t.zoomValue(percent(value))}\n classNames={{ field: \"flex-1\" }}\n />\n <span aria-hidden className={zoomIcon}>\n {icons.zoomIn}\n </span>\n </div>\n <ActionIcon\n variant=\"subtle\"\n color=\"neutral\"\n className={control}\n aria-label={t.resetLabel}\n onClick={() => api.reset()}\n >\n {icons.reset}\n </ActionIcon>\n </div>\n )\n}\n\ntype CropExport = UseImageCropperContext[\"getCroppedImage\"]\n\n/** The size a `width × height` export should have at `aspect`: its short side stretched to match the long one. */\nconst exactSize = (width: number, height: number, aspect: number) =>\n width / height > aspect\n ? { width, height: Math.round(width / aspect) }\n : { width: Math.round(height * aspect), height }\n\n/**\n * Ark's export, held to a locked ratio. Ark sizes the canvas from the image's\n * rounded layout box, scaling each side on its own, so a 1:1 crop can come\n * out 511 × 512. When it does, the crop is exported again losslessly and\n * redrawn at the exact size, then encoded once as asked.\n */\nexport const exactExport =\n (getCroppedImage: CropExport, aspect: number | undefined): CropExport =>\n async (options) => {\n const blob = await getCroppedImage(options)\n if (aspect === undefined || !(blob instanceof Blob) || typeof createImageBitmap !== \"function\")\n return blob\n const shot = await createImageBitmap(blob)\n // Read the size before `close()`: a closed bitmap reports 0 × 0.\n const { width, height } = shot\n shot.close()\n const size = exactSize(width, height, aspect)\n if (size.width === width && size.height === height) return blob\n const lossless = await getCroppedImage({ ...options, type: \"image/png\" })\n if (!(lossless instanceof Blob)) return blob\n const source = await createImageBitmap(lossless)\n const canvas = document.createElement(\"canvas\")\n canvas.width = size.width\n canvas.height = size.height\n const context = canvas.getContext(\"2d\")\n if (!context) return blob\n context.drawImage(source, 0, 0, size.width, size.height)\n source.close()\n return new Promise<Blob | null>((resolve) =>\n canvas.toBlob(resolve, options?.type ?? \"image/png\", options?.quality ?? 1),\n )\n }\n\n/**\n * The nearest cropper's API: Ark's, with `getCroppedImage()` held to the\n * locked ratio (or the circle) to the pixel.\n */\nconst useImageCropperContext = (): UseImageCropperContext => {\n const api = useArkImageCropperContext()\n const { aspect } = useContext(SharedContext)\n return { ...api, getCroppedImage: exactExport(api.getCroppedImage, aspect) }\n}\n\nexport type ImageCropperContextProps = Ark.ContextProps\n\n/** Renders its child function with the cropper's API, for an export button. */\nconst ImageCropperContext = ({ children }: ImageCropperContextProps) =>\n children(useImageCropperContext())\n\n// ---------------------------------------------------------------------------\n// Convenience\n// ---------------------------------------------------------------------------\n\nexport type ImageCropperClassNames = {\n viewport?: string\n image?: string\n selection?: string\n controls?: string\n}\n\nexport type ImageCropperProps = NoAsChild<\n Omit<ImageCropperRootProps, \"children\"> & {\n /** The image to crop: a URL, or a `Blob` / `File` (a pick or a drop). */\n src: string | Blob\n /** Needed on a cross-origin URL for the export to read its pixels. */\n crossOrigin?: ImageCropperImageProps[\"crossOrigin\"]\n /** The viewport's corner radius, from the media scale. */\n radius?: MediaRadius\n /** Rule-of-thirds lines inside the selection, shown while it's dragged or resized. */\n withGrid?: boolean\n /** The zoom slider and the rotate, flip and reset buttons, under the image. */\n withControls?: boolean\n classNames?: ImageCropperClassNames\n /** Rendered last, inside the root: an `ImageCropper.Context` for the export. */\n children?: ReactNode\n }\n>\n\nconst ImageCropperComponent = ({\n src,\n crossOrigin,\n radius,\n withGrid,\n withControls = false,\n classNames,\n children,\n asChild: _asChild,\n ...rest\n}: ImageCropperProps) => (\n <ImageCropperRoot {...rest}>\n <ImageCropperViewport radius={radius} className={classNames?.viewport}>\n <ImageCropperImage src={src} crossOrigin={crossOrigin} className={classNames?.image} />\n <ImageCropperSelection withGrid={withGrid} className={classNames?.selection} />\n </ImageCropperViewport>\n {withControls && <ImageCropperControls className={classNames?.controls} />}\n {children}\n </ImageCropperRoot>\n)\n\nexport const ImageCropper = Object.assign(ImageCropperComponent, {\n Root: ImageCropperRoot,\n Viewport: ImageCropperViewport,\n Image: ImageCropperImage,\n Selection: ImageCropperSelection,\n Handle: ImageCropperHandle,\n Grid: ImageCropperGrid,\n Controls: ImageCropperControls,\n Context: ImageCropperContext,\n})\n\nexport { useImageCropperContext }\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/image-cropper/image-cropper.tsx"],"names":["shape","Ark","useArkImageCropperContext"],"mappings":";;;;;;;;;;;;;;;;;;;AA+GO,IAAM,oBAAA,GAA2D;AAAA,EACtE,KAAA,EAAO,eAAA;AAAA,EACP,eAAA,EAAiB,eAAA;AAAA,EACjB,OAAA,EAAS,mBAAA;AAAA,EACT,OAAA,EAAS,CAAC,EAAE,IAAA,EAAM,UAAU,CAAA,EAAG,CAAA,EAAG,OAAO,MAAA,EAAO,KAC9C,QAAQ,IAAI,CAAA,UAAA,EAAa,QAAQ,CAAA,UAAA,EAAa,CAAC,wBAAwB,CAAC,CAAA,iBAAA,EAAoB,KAAK,CAAA,MAAA,EAAS,MAAM,CAAA,GAAA,CAAA;AAAA,EAClH,cAAA,EAAgB,CAAC,KAAA,KAAU,CAAA,gBAAA,EAAmB,KAAK,CAAA,CAAA,CAAA;AAAA,EACnD,wBAAA,EAA0B,WAAA;AAAA,EAC1B,qBAAA,EACE,8GAAA;AAAA,EACF,gBAAgB,CAAC,EAAE,KAAA,EAAO,CAAA,EAAG,GAAG,KAAA,EAAO,MAAA,EAAO,KAC5C,KAAA,CAAM,KAAK,CAAA,CACR,IAAA,CAAK,QAAA,EAAU,MAAM,cAAc,CAAC,CAAA,MAAA,EAAS,CAAC,CAAA,aAAA,EAAgB,KAAK,CAAA,GAAA,CAAK,CAAA,CACxE,IAAA,CAAK,WAAA,EAAa,MAAM,CAAA,WAAA,EAAc,CAAC,CAAA,MAAA,EAAS,CAAC,YAAY,KAAK,CAAA,MAAA,EAAS,MAAM,CAAA,GAAA,CAAK,EACtF,UAAA,EAAW;AAAA,EAChB,aAAA,EAAe,eAAA;AAAA,EACf,SAAA,EAAW,MAAA;AAAA,E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,EAAgB,SAAA,EAAW,UAAA,EAAY,QAAA,EAC3D,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,iBAAA,EAAA,EAAkB,GAAA,EAAU,WAAA,EAA0B,SAAA,EAAW,YAAY,KAAA,EAAO,CAAA;AAAA,oBACrF,GAAA,CAAC,qBAAA,EAAA,EAAsB,QAAA,EAAoB,SAAA,EAAW,YAAY,SAAA,EAAW;AAAA,GAAA,EAC/E,CAAA;AAAA,EACC,YAAA,oBAAgB,GAAA,CAAC,oBAAA,EAAA,EAAqB,SAAA,EAAW,YAAY,QAAA,EAAU,CAAA;AAAA,EACvE;AAAA,CAAA,EACH,CAAA;AAGK,IAAM,YAAA,GAAe,MAAA,CAAO,MAAA,CAAO,qBAAA,EAAuB;AAAA,EAC/D,IAAA,EAAM,gBAAA;AAAA,EACN,QAAA,EAAU,oBAAA;AAAA,EACV,KAAA,EAAO,iBAAA;AAAA,EACP,SAAA,EAAW,qBAAA;AAAA,EACX,MAAA,EAAQ,kBAAA;AAAA,EACR,IAAA,EAAM,gBAAA;AAAA,EACN,QAAA,EAAU,oBAAA;AAAA,EACV,OAAA,EAAS;AACX,CAAC","file":"chunk-MAM2X3MW.js","sourcesContent":["\"use client\"\n\nimport {\n ImageCropper as Ark,\n type ImageCropperRootProps as ArkRootProps,\n type ImageCropperCropChangeDetails,\n type ImageCropperFlipState,\n type ImageCropperHandlePosition,\n type UseImageCropperContext,\n useImageCropperContext as useArkImageCropperContext,\n} from \"@ark-ui/react/image-cropper\"\nimport {\n FlipHorizontal2,\n FlipVertical2,\n RefreshCcw,\n RotateCcw,\n RotateCw,\n ZoomIn,\n ZoomOut,\n} from \"lucide-react\"\nimport {\n type ComponentPropsWithoutRef,\n createContext,\n type ReactNode,\n type Ref,\n useContext,\n useMemo,\n} from \"react\"\nimport { match } from \"ts-pattern\"\nimport type { NoAsChild } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { cutoutMask } from \"../../lib/cutout\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { type IconMap, iconStroke, mergeIcons } from \"../../lib/icons\"\nimport { useDirectionCheck, useLocale } from \"../../lib/intl\"\nimport { useMergedRefs } from \"../../lib/merge-refs\"\nimport { props } from \"../../lib/props\"\nimport { MEDIA_RADIUS, type MediaRadius } from \"../../lib/radius\"\nimport { type Ratio, ratioToNumber } from \"../../lib/ratio\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { TYPOGRAPHY_SHADE_CLASSES } from \"../../lib/typography-size\"\nimport { useObjectUrl } from \"../../lib/use-object-url\"\nimport { ActionIcon } from \"../action-icon/action-icon\"\nimport { Slider } from \"../slider/slider\"\n\n/**\n * ImageCropper — pick the part of an image to keep: drag the selection, pull\n * its handles, pinch or wheel to zoom, rotate and flip, then export the crop.\n *\n * <ImageCropper src={file} ratio={1} shape=\"circle\" withControls>\n * <ImageCropper.Context>\n * {(api) => <Button onClick={() => api.getCroppedImage().then(upload)}>Save</Button>}\n * </ImageCropper.Context>\n * </ImageCropper>\n *\n * Built on Ark's image cropper (a \"preview\" component in Ark 5.39, see the\n * docs page), which owns the geometry, the gestures, the keyboard and the\n * canvas export. The kit adds the look (an outside dim, handles that survive\n * forced colors), the controls, `src` as a `Blob`, `ratio` in the media\n * components' shape, flattened callbacks and translations with\n * locale-formatted numbers.\n *\n * The result is read from `ImageCropper.Context`, not an imperative ref:\n * `getCroppedImage()` draws the crop to a canvas and resolves a `Blob` (or a\n * data URL), `getCropData()` returns the crop in the image's own pixels for a\n * server to cut.\n */\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport type ImageCropperShape = \"rectangle\" | \"circle\"\nexport type ImageCropperFlip = ImageCropperFlipState\n/** A crop rectangle, in px of the viewport. */\nexport type ImageCropperRect = ImageCropperCropChangeDetails[\"crop\"]\nexport type { ImageCropperHandlePosition }\n\n/** A crop rectangle with every number already formatted for the locale. */\nexport type ImageCropperFormattedRect = { x: string; y: string; width: string; height: string }\n\nexport type ImageCropperTranslations = {\n /** The cropper's accessible name. */\n label?: string\n /** What kind of thing the cropper is, announced with its name. */\n roleDescription?: string\n /** The cropper's description while the image loads. */\n loading?: string\n /** The cropper's description once the image is ready. `zoom` is a percent, `rotation` in degrees. */\n preview?: (details: ImageCropperFormattedRect & { zoom: string; rotation: string }) => string\n /** The selection's accessible name. */\n selectionLabel?: (shape: ImageCropperShape) => string\n /** What kind of thing the selection is. Ark's default is the APG \"2d slider\". */\n selectionRoleDescription?: string\n /** How to move it from the keyboard, read as the selection's description. */\n selectionInstructions?: string\n /** The selection's `aria-valuetext`: where it is and how big. */\n selectionValue?: (details: ImageCropperFormattedRect & { shape: ImageCropperShape }) => string\n /** Names the group of controls. */\n controlsLabel?: string\n zoomLabel?: string\n /** The zoom slider's `aria-valuetext`. `percent` is formatted (`\"150%\"`). */\n zoomValue?: (percent: string) => string\n rotateLeftLabel?: string\n rotateRightLabel?: string\n flipHorizontalLabel?: string\n flipVerticalLabel?: string\n resetLabel?: string\n}\n\nexport const DEFAULT_TRANSLATIONS: Required<ImageCropperTranslations> = {\n label: \"Image cropper\",\n roleDescription: \"image cropper\",\n loading: \"Loading the image\",\n preview: ({ zoom, rotation, x, y, width, height }) =>\n `Zoom ${zoom}, rotated ${rotation}. Crop at ${x}px from the left and ${y}px from the top, ${width}px by ${height}px.`,\n selectionLabel: (shape) => `Crop selection (${shape})`,\n selectionRoleDescription: \"2d slider\",\n selectionInstructions:\n \"Use the arrow keys to move the crop. Hold Alt with the arrow keys to resize it. Press plus or minus to zoom.\",\n selectionValue: ({ shape, x, y, width, height }) =>\n match(shape)\n .with(\"circle\", () => `Position X ${x}px, Y ${y}px. Diameter ${width}px.`)\n .with(\"rectangle\", () => `Position X ${x}px, Y ${y}px. Size ${width}px by ${height}px.`)\n .exhaustive(),\n controlsLabel: \"Crop controls\",\n zoomLabel: \"Zoom\",\n zoomValue: (percent) => percent,\n rotateLeftLabel: \"Rotate left\",\n rotateRightLabel: \"Rotate right\",\n flipHorizontalLabel: \"Flip horizontally\",\n flipVerticalLabel: \"Flip vertically\",\n resetLabel: \"Reset\",\n}\n\ntype ArkTranslations = NonNullable<ArkRootProps[\"translations\"]>\n\n/** What the Root shares with the parts Ark's context doesn't cover. */\nexport type ImageCropperIconSlot =\n | \"rotateLeft\"\n | \"rotateRight\"\n | \"flipHorizontal\"\n | \"flipVertical\"\n | \"zoomOut\"\n | \"zoomIn\"\n | \"reset\"\nexport type ImageCropperIcons = IconMap<ImageCropperIconSlot>\n\n/**\n * The default icons of `ImageCropper.Controls`, named like the\n * `translations` labels of the buttons they sit in. None of them points along\n * the inline axis (a rotation turns the same way in either direction, and the\n * zoom glyphs sit at the slider's start and end), so none mirrors under RTL.\n */\nexport const DEFAULT_ICONS: Record<ImageCropperIconSlot, ReactNode> = {\n rotateLeft: <RotateCcw className={iconStroke} />,\n rotateRight: <RotateCw className={iconStroke} />,\n flipHorizontal: <FlipHorizontal2 className={iconStroke} />,\n flipVertical: <FlipVertical2 className={iconStroke} />,\n zoomOut: <ZoomOut className={iconStroke} />,\n zoomIn: <ZoomIn className={iconStroke} />,\n reset: <RefreshCcw className={iconStroke} />,\n}\n\ntype Shared = {\n t: Required<ImageCropperTranslations>\n icons: Record<ImageCropperIconSlot, ReactNode>\n percent: (value: number) => string\n minZoom: number\n maxZoom: number\n shape: ImageCropperShape\n /** The locked width / height (1 for a circle), which the export holds to the pixel. */\n aspect: number | undefined\n}\n\nconst SharedContext = createContext<Shared>({\n t: DEFAULT_TRANSLATIONS,\n icons: DEFAULT_ICONS,\n percent: String,\n minZoom: 1,\n maxZoom: 5,\n shape: \"rectangle\",\n aspect: undefined,\n})\n\n// ---------------------------------------------------------------------------\n// Styles\n// ---------------------------------------------------------------------------\n\n/**\n * Each handle's hit box and visible mark, by position. Ark already places the\n * handle on the selection's edge (`top`/`left`/`right`/`bottom`, centered\n * with `translate`, edges at 96% of the side); this sizes the hit box and\n * shapes the mark, an `::after` centered in it, so the handle stays a bare\n * element any `asChild` child can become.\n *\n * The mark is the Slider thumb: a palette border on the page-tinted fill.\n * Corners are round thumbs, edges are pills along their side. The hit box is\n * 24px under a mouse and 44px (WCAG 2.5.8) under a finger, around the same\n * small mark.\n *\n * Physical sides, not logical ones: the crop is a rectangle in the image's own\n * space, where `e` is the image's right edge whatever the text direction, and\n * Ark positions the handles that way too.\n *\n * Corners sit above the edge bars (`z-1`), which overlap them at 96% of the\n * side, so a press near a corner resizes both ways. On a circle only the four\n * edge pills show: they're the points that touch it.\n */\nconst HANDLE: Record<ImageCropperHandlePosition, string> = {\n nw: \"z-1 size-6 pointer-coarse:size-11 after:size-3.5 in-data-[shape=circle]:after:hidden\",\n ne: \"z-1 size-6 pointer-coarse:size-11 after:size-3.5 in-data-[shape=circle]:after:hidden\",\n se: \"z-1 size-6 pointer-coarse:size-11 after:size-3.5 in-data-[shape=circle]:after:hidden\",\n sw: \"z-1 size-6 pointer-coarse:size-11 after:size-3.5 in-data-[shape=circle]:after:hidden\",\n n: \"h-6 pointer-coarse:h-11 after:h-2 after:w-6\",\n s: \"h-6 pointer-coarse:h-11 after:h-2 after:w-6\",\n e: \"w-6 pointer-coarse:w-11 after:h-6 after:w-2\",\n w: \"w-6 pointer-coarse:w-11 after:h-6 after:w-2\",\n}\n\n/** A ≥ 44px control (WCAG 2.5.8). */\nconst control = \"h-11 [&_svg]:size-5\"\n/** The zoom slider's end glyphs: decorative, the slider carries the name. */\nconst zoomIcon = \"flex shrink-0 [&_svg]:size-4\"\n\n// ---------------------------------------------------------------------------\n// Root\n// ---------------------------------------------------------------------------\n\nexport type ImageCropperRootProps = Omit<\n ArkRootProps,\n | \"aspectRatio\"\n | \"cropShape\"\n | \"translations\"\n | \"onZoomChange\"\n | \"onRotationChange\"\n | \"onFlipChange\"\n | \"onCropChange\"\n> &\n WithTestId & {\n /** Locks the selection to this width / height. Free when unset; a circle is always 1. */\n ratio?: Ratio\n /** A circle crop still exports a square: mask it where you show it. */\n shape?: ImageCropperShape\n /** Fires as the zoom changes, from 1 (fit) up. */\n onZoomChange?: (zoom: number) => void\n /** Fires as the rotation changes, in degrees. */\n onRotationChange?: (rotation: number) => void\n onFlipChange?: (flip: ImageCropperFlip) => void\n /** Fires as the selection moves or resizes, in px of the viewport. */\n onCropChange?: (crop: ImageCropperRect) => void\n translations?: ImageCropperTranslations\n /** Replaces the control icons: `rotateLeft`, `rotateRight`, `flipHorizontal`,\n * `flipVertical`, `zoomOut`, `zoomIn`, `reset`. Drawn as given, never restroked. */\n icons?: ImageCropperIcons\n /**\n * The palette of the selection's edge, handles, focus ring and zoom slider.\n * `brand` by default: on a photo, the kit's black-and-white default palette\n * would read as plain chrome rather than as a control.\n */\n color?: Color\n ref?: Ref<HTMLDivElement>\n }\n\n/** `\"16/9\"` → `1.777…`, and nothing for a ratio that can't lock a selection. */\nconst aspectRatioOf = (ratio: Ratio | undefined) => {\n const value = ratio === undefined ? Number.NaN : ratioToNumber(ratio)\n return Number.isFinite(value) && value > 0 ? value : undefined\n}\n\nconst ImageCropperRoot = ({\n ratio,\n shape,\n onZoomChange,\n onRotationChange,\n onFlipChange,\n onCropChange,\n translations,\n icons,\n minZoom = 1,\n maxZoom = 5,\n color = \"brand\",\n className,\n testId,\n ref,\n ...rest\n}: ImageCropperRootProps) => {\n const locale = useLocale()\n const direction = useDirectionCheck()\n\n const [shared, arkTranslations] = useMemo(() => {\n const t = { ...DEFAULT_TRANSLATIONS, ...translations }\n const pixels = new Intl.NumberFormat(locale, { maximumFractionDigits: 0 })\n const percent = new Intl.NumberFormat(locale, { style: \"percent\", maximumFractionDigits: 0 })\n const degrees = new Intl.NumberFormat(locale, {\n style: \"unit\",\n unit: \"degree\",\n maximumFractionDigits: 0,\n })\n const rect = ({ x, y, width, height }: ImageCropperRect): ImageCropperFormattedRect => ({\n x: pixels.format(x),\n y: pixels.format(y),\n width: pixels.format(width),\n height: pixels.format(height),\n })\n const ark: ArkTranslations = {\n rootLabel: t.label,\n rootRoleDescription: t.roleDescription,\n previewLoading: t.loading,\n previewDescription: ({ crop, zoom, rotation }) =>\n t.preview({\n ...rect(crop),\n zoom: percent.format(zoom ?? 1),\n rotation: degrees.format(rotation ?? 0),\n }),\n selectionLabel: ({ shape }) => t.selectionLabel(shape),\n selectionRoleDescription: t.selectionRoleDescription,\n selectionInstructions: t.selectionInstructions,\n selectionValueText: ({ shape, ...crop }) => t.selectionValue({ shape, ...rect(crop) }),\n }\n const value: Shared = {\n t,\n icons: mergeIcons(DEFAULT_ICONS, icons),\n percent: (n) => percent.format(n),\n minZoom,\n maxZoom,\n shape: shape ?? \"rectangle\",\n aspect: shape === \"circle\" ? 1 : aspectRatioOf(ratio),\n }\n return [value, ark] as const\n }, [translations, icons, locale, minZoom, maxZoom, shape, ratio])\n\n const rootRef = useMergedRefs(ref, direction)\n return (\n <SharedContext value={shared}>\n <Ark.Root\n ref={rootRef}\n aspectRatio={aspectRatioOf(ratio)}\n cropShape={shape}\n minZoom={minZoom}\n maxZoom={maxZoom}\n translations={arkTranslations}\n onZoomChange={onZoomChange && (({ zoom }) => onZoomChange(zoom))}\n onRotationChange={onRotationChange && (({ rotation }) => onRotationChange(rotation))}\n onFlipChange={onFlipChange && (({ flip }) => onFlipChange(flip))}\n onCropChange={onCropChange && (({ crop }) => onCropChange(crop))}\n data-color={color}\n className={cn(\"flex w-full flex-col gap-3\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n </SharedContext>\n )\n}\n\n// ---------------------------------------------------------------------------\n// Parts\n// ---------------------------------------------------------------------------\n\nexport type ImageCropperViewportProps = Ark.ViewportProps &\n WithTestId & {\n /** Corner radius, from the media scale. */\n radius?: MediaRadius\n }\n\n/** The frame the image is cropped in. Takes the pan, wheel and pinch gestures. */\nconst ImageCropperViewport = ({\n radius = \"xs\",\n className,\n testId,\n ...rest\n}: ImageCropperViewportProps) => (\n <Ark.Viewport\n className={cn(\n \"relative touch-none select-none overflow-clip bg-black/80\",\n MEDIA_RADIUS[radius],\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type ImageCropperImageProps = NoAsChild<\n Omit<Ark.ImageProps, \"src\"> &\n WithTestId & {\n /** A URL, or a `Blob` / `File`, shown through an object URL that's revoked when it changes. */\n src: string | Blob\n }\n>\n\n/**\n * The image being cropped. Decorative to assistive technology: the cropper's\n * own description says what's selected. Fades in once Ark has measured it.\n *\n * A cross-origin URL needs `crossOrigin=\"anonymous\"` (and CORS headers on the\n * server) for `getCroppedImage()`; without them the canvas is tainted and the\n * export resolves `null`.\n */\nconst ImageCropperImage = ({\n src,\n className,\n testId,\n asChild: _asChild,\n ...rest\n}: ImageCropperImageProps) => {\n const url = useObjectUrl(src)\n return (\n <Ark.Image\n src={url}\n className={cn(\n \"block h-auto w-full max-w-none opacity-0 data-ready:opacity-100\",\n \"transition-opacity duration-(--duration-normal) ease-standard motion-reduce:transition-none\",\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n )\n}\n\nexport type ImageCropperSelectionProps = NoAsChild<\n Ark.SelectionProps &\n WithTestId & {\n /** Rule-of-thirds lines inside the selection, shown while it's dragged or resized. */\n withGrid?: boolean\n }\n>\n\n/** The selection's hole in the dim: Ark sets the crop rectangle as custom properties on the root. */\nconst CROP_RECT = {\n x: \"var(--crop-x)\",\n y: \"var(--crop-y)\",\n width: \"var(--crop-width)\",\n height: \"var(--crop-height)\",\n}\n\n/**\n * The crop area: a `role=\"slider\"` that moves with the arrow keys, resizes\n * with Alt + arrows and zooms with `+`/`-`.\n *\n * Everything outside it is dimmed like a Modal backdrop by an overlay drawn\n * just before it, with the selection cut out of it (`lib/cutout.ts`): a real\n * rectangle or circle, following the crop through Ark's `--crop-*` custom\n * properties without a render. The overlay steps aside in forced colors,\n * where it would paint `Canvas` over the image; the edge and the handles,\n * borders both, are repainted instead.\n */\nconst ImageCropperSelection = ({\n withGrid = true,\n className,\n testId,\n children,\n asChild: _asChild,\n ...rest\n}: ImageCropperSelectionProps) => {\n const { shape } = useContext(SharedContext)\n return (\n <>\n <div\n aria-hidden\n data-part=\"overlay\"\n data-shape={shape}\n // The Modal backdrop's dim, with a light blur: the frame stays legible\n // around the crop without competing with it.\n className=\"pointer-events-none absolute inset-0 bg-black/50 backdrop-blur-xs forced-colors:hidden\"\n style={cutoutMask(shape, CROP_RECT)}\n />\n <Ark.Selection\n className={cn(\n \"cursor-move border border-(--c-solid) data-[shape=circle]:rounded-full\",\n // A pale halo around the 1px palette edge: two tones, so it holds on a dark photo and a bright one.\n \"shadow-[0_0_0_1px_rgb(255_255_255/0.45)]\",\n \"data-disabled:cursor-default\",\n // Inset and gap-less: the selection can sit flush with the clipping viewport.\n focusStyles({ ring: \"palette\", offset: false, inset: true }),\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {withGrid && (\n <>\n <ImageCropperGrid axis=\"horizontal\" />\n <ImageCropperGrid axis=\"vertical\" />\n </>\n )}\n {Ark.handles.map((position) => (\n <ImageCropperHandle key={position} position={position} />\n ))}\n {children}\n </Ark.Selection>\n </>\n )\n}\n\nexport type ImageCropperHandleProps = Ark.HandleProps & WithTestId\n\n/** One resize handle. `Selection` renders all eight; use it when you compose your own. */\nconst ImageCropperHandle = ({ position, className, testId, ...rest }: ImageCropperHandleProps) => (\n <Ark.Handle\n position={position}\n className={cn(\n \"after:absolute after:top-1/2 after:left-1/2 after:-translate-1/2 after:rounded-full\",\n \"after:border-2 after:border-(--c-solid) after:bg-brand-50 after:shadow-sm dark:after:bg-brand-950\",\n // Grows a touch while held, like the Slider thumb.\n \"after:transition-[scale] after:duration-(--duration-fast) after:ease-standard motion-reduce:after:transition-none\",\n \"in-data-dragging:after:scale-110\",\n \"data-disabled:hidden\",\n HANDLE[position],\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type ImageCropperGridProps = Ark.GridProps & WithTestId\n\n/** A pair of rule-of-thirds lines, along `axis`. Fades in while the crop is dragged, resized or panned. */\nconst ImageCropperGrid = ({ className, testId, ...rest }: ImageCropperGridProps) => (\n <Ark.Grid\n className={cn(\n \"border-white/50 data-[axis=horizontal]:border-y data-[axis=vertical]:border-x\",\n \"opacity-0 data-dragging:opacity-100 data-panning:opacity-100\",\n \"transition-opacity duration-(--duration-fast) ease-standard motion-reduce:transition-none\",\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type ImageCropperControlsProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\n/**\n * Zoom slider, rotate ±90°, flip and reset, wired to the nearest cropper. Each\n * is a 44px button named from `translations`; the flips are toggle buttons.\n */\nconst ImageCropperControls = ({ className, testId, ...rest }: ImageCropperControlsProps) => {\n const api = useImageCropperContext()\n const { t, icons, percent, minZoom, maxZoom } = useContext(SharedContext)\n return (\n // biome-ignore lint/a11y/useSemanticElements: a `<fieldset>` brings UA border/padding/`min-inline-size` that fight this wrapping flex row, for the same `group` semantics\n <div\n role=\"group\"\n aria-label={t.controlsLabel}\n className={cn(\"flex flex-wrap items-center gap-1\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n <ActionIcon\n variant=\"subtle\"\n color=\"neutral\"\n className={control}\n aria-label={t.rotateLeftLabel}\n onClick={() => api.rotateBy(-90)}\n >\n {icons.rotateLeft}\n </ActionIcon>\n <ActionIcon\n variant=\"subtle\"\n color=\"neutral\"\n className={control}\n aria-label={t.rotateRightLabel}\n onClick={() => api.rotateBy(90)}\n >\n {icons.rotateRight}\n </ActionIcon>\n <ActionIcon\n variant=\"subtle\"\n color=\"neutral\"\n className={control}\n aria-label={t.flipHorizontalLabel}\n aria-pressed={api.flip.horizontal}\n onClick={() => api.flipHorizontally()}\n >\n {icons.flipHorizontal}\n </ActionIcon>\n <ActionIcon\n variant=\"subtle\"\n color=\"neutral\"\n className={control}\n aria-label={t.flipVerticalLabel}\n aria-pressed={api.flip.vertical}\n onClick={() => api.flipVertically()}\n >\n {icons.flipVertical}\n </ActionIcon>\n <div\n className={cn(\n \"flex min-w-40 flex-1 items-center gap-2 px-2\",\n TYPOGRAPHY_SHADE_CLASSES.muted,\n )}\n >\n <span aria-hidden className={zoomIcon}>\n {icons.zoomOut}\n </span>\n <Slider\n min={minZoom}\n max={maxZoom}\n step={0.01}\n value={api.zoom}\n onChange={(zoom) => api.setZoom(zoom)}\n aria-label={[t.zoomLabel]}\n getAriaValueText={({ value }) => t.zoomValue(percent(value))}\n classNames={{ field: \"flex-1\" }}\n />\n <span aria-hidden className={zoomIcon}>\n {icons.zoomIn}\n </span>\n </div>\n <ActionIcon\n variant=\"subtle\"\n color=\"neutral\"\n className={control}\n aria-label={t.resetLabel}\n onClick={() => api.reset()}\n >\n {icons.reset}\n </ActionIcon>\n </div>\n )\n}\n\ntype CropExport = UseImageCropperContext[\"getCroppedImage\"]\n\n/** The size a `width × height` export should have at `aspect`: its short side stretched to match the long one. */\nconst exactSize = (width: number, height: number, aspect: number) =>\n width / height > aspect\n ? { width, height: Math.round(width / aspect) }\n : { width: Math.round(height * aspect), height }\n\n/**\n * Ark's export, held to a locked ratio. Ark sizes the canvas from the image's\n * rounded layout box, scaling each side on its own, so a 1:1 crop can come\n * out 511 × 512. When it does, the crop is exported again losslessly and\n * redrawn at the exact size, then encoded once as asked.\n */\nexport const exactExport =\n (getCroppedImage: CropExport, aspect: number | undefined): CropExport =>\n async (options) => {\n const blob = await getCroppedImage(options)\n if (aspect === undefined || !(blob instanceof Blob) || typeof createImageBitmap !== \"function\")\n return blob\n const shot = await createImageBitmap(blob)\n // Read the size before `close()`: a closed bitmap reports 0 × 0.\n const { width, height } = shot\n shot.close()\n const size = exactSize(width, height, aspect)\n if (size.width === width && size.height === height) return blob\n const lossless = await getCroppedImage({ ...options, type: \"image/png\" })\n if (!(lossless instanceof Blob)) return blob\n const source = await createImageBitmap(lossless)\n const canvas = document.createElement(\"canvas\")\n canvas.width = size.width\n canvas.height = size.height\n const context = canvas.getContext(\"2d\")\n if (!context) return blob\n context.drawImage(source, 0, 0, size.width, size.height)\n source.close()\n return new Promise<Blob | null>((resolve) =>\n canvas.toBlob(resolve, options?.type ?? \"image/png\", options?.quality ?? 1),\n )\n }\n\n/**\n * The nearest cropper's API: Ark's, with `getCroppedImage()` held to the\n * locked ratio (or the circle) to the pixel.\n */\nconst useImageCropperContext = (): UseImageCropperContext => {\n const api = useArkImageCropperContext()\n const { aspect } = useContext(SharedContext)\n return { ...api, getCroppedImage: exactExport(api.getCroppedImage, aspect) }\n}\n\nexport type ImageCropperContextProps = Ark.ContextProps\n\n/** Renders its child function with the cropper's API, for an export button. */\nconst ImageCropperContext = ({ children }: ImageCropperContextProps) =>\n children(useImageCropperContext())\n\n// ---------------------------------------------------------------------------\n// Convenience\n// ---------------------------------------------------------------------------\n\nexport type ImageCropperClassNames = {\n viewport?: string\n image?: string\n selection?: string\n controls?: string\n}\n\nexport type ImageCropperProps = NoAsChild<\n Omit<ImageCropperRootProps, \"children\"> & {\n /** The image to crop: a URL, or a `Blob` / `File` (a pick or a drop). */\n src: string | Blob\n /** Needed on a cross-origin URL for the export to read its pixels. */\n crossOrigin?: ImageCropperImageProps[\"crossOrigin\"]\n /** The viewport's corner radius, from the media scale. */\n radius?: MediaRadius\n /** Rule-of-thirds lines inside the selection, shown while it's dragged or resized. */\n withGrid?: boolean\n /** The zoom slider and the rotate, flip and reset buttons, under the image. */\n withControls?: boolean\n classNames?: ImageCropperClassNames\n /** Rendered last, inside the root: an `ImageCropper.Context` for the export. */\n children?: ReactNode\n }\n>\n\nconst ImageCropperComponent = ({\n src,\n crossOrigin,\n radius,\n withGrid,\n withControls = false,\n classNames,\n children,\n asChild: _asChild,\n ...rest\n}: ImageCropperProps) => (\n <ImageCropperRoot {...rest}>\n <ImageCropperViewport radius={radius} className={classNames?.viewport}>\n <ImageCropperImage src={src} crossOrigin={crossOrigin} className={classNames?.image} />\n <ImageCropperSelection withGrid={withGrid} className={classNames?.selection} />\n </ImageCropperViewport>\n {withControls && <ImageCropperControls className={classNames?.controls} />}\n {children}\n </ImageCropperRoot>\n)\n\nexport const ImageCropper = Object.assign(ImageCropperComponent, {\n Root: ImageCropperRoot,\n Viewport: ImageCropperViewport,\n Image: ImageCropperImage,\n Selection: ImageCropperSelection,\n Handle: ImageCropperHandle,\n Grid: ImageCropperGrid,\n Controls: ImageCropperControls,\n Context: ImageCropperContext,\n})\n\nexport { useImageCropperContext }\n"]}
|