@42-central/ui-react 0.17.0 → 0.18.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/README.md +36 -175
- package/dist/{chunk-FD6P6PLQ.js → chunk-5JHDSVEZ.js} +3 -3
- package/dist/{chunk-FD6P6PLQ.js.map → chunk-5JHDSVEZ.js.map} +1 -1
- package/dist/{chunk-QMW7D5GU.js → chunk-5OQLFX47.js} +4 -3
- package/dist/chunk-5OQLFX47.js.map +1 -0
- package/dist/{chunk-VZ2TPU4B.js → chunk-6GDMSENK.js} +3 -2
- package/dist/chunk-6GDMSENK.js.map +1 -0
- package/dist/{chunk-TNNH3FVQ.js → chunk-6OLTJYSX.js} +24 -8
- package/dist/chunk-6OLTJYSX.js.map +1 -0
- package/dist/{chunk-POKDSVQT.js → chunk-AE7QTLJ5.js} +5 -4
- package/dist/chunk-AE7QTLJ5.js.map +1 -0
- package/dist/{chunk-44OV3PNH.js → chunk-B2YJKRNQ.js} +3 -3
- package/dist/{chunk-44OV3PNH.js.map → chunk-B2YJKRNQ.js.map} +1 -1
- package/dist/{chunk-YIQI2CF3.js → chunk-CTSO6V72.js} +3 -2
- package/dist/chunk-CTSO6V72.js.map +1 -0
- package/dist/{chunk-ACE7FBWE.js → chunk-EBREIC3L.js} +5 -4
- package/dist/chunk-EBREIC3L.js.map +1 -0
- package/dist/{chunk-UNSAA7YG.js → chunk-FHG54IT5.js} +3 -2
- package/dist/chunk-FHG54IT5.js.map +1 -0
- package/dist/{chunk-3GYOIQW7.js → chunk-FZIHZT5R.js} +5 -5
- package/dist/{chunk-3GYOIQW7.js.map → chunk-FZIHZT5R.js.map} +1 -1
- package/dist/{chunk-2H46IXW4.js → chunk-HAQJQFE6.js} +28 -8
- package/dist/chunk-HAQJQFE6.js.map +1 -0
- package/dist/{chunk-IHYFYMHJ.js → chunk-HT5JAHR3.js} +6 -6
- package/dist/{chunk-IHYFYMHJ.js.map → chunk-HT5JAHR3.js.map} +1 -1
- package/dist/chunk-I4SQQIP5.js +12 -0
- package/dist/chunk-I4SQQIP5.js.map +1 -0
- package/dist/{chunk-J3PELDH3.js → chunk-JITF6I7N.js} +22 -6
- package/dist/chunk-JITF6I7N.js.map +1 -0
- package/dist/{chunk-IFWCCAQV.js → chunk-KHMFNH3X.js} +3 -2
- package/dist/chunk-KHMFNH3X.js.map +1 -0
- package/dist/{chunk-SIG4DMNZ.js → chunk-MI2WZRK3.js} +4 -4
- package/dist/{chunk-SIG4DMNZ.js.map → chunk-MI2WZRK3.js.map} +1 -1
- package/dist/{chunk-PJL4ZL5V.js → chunk-O23Y5ML4.js} +8 -8
- package/dist/{chunk-PJL4ZL5V.js.map → chunk-O23Y5ML4.js.map} +1 -1
- package/dist/{chunk-P7A3BCAC.js → chunk-OWG4BCQR.js} +3 -3
- package/dist/{chunk-P7A3BCAC.js.map → chunk-OWG4BCQR.js.map} +1 -1
- package/dist/{chunk-FUWSTUDM.js → chunk-PH354ECN.js} +4 -4
- package/dist/{chunk-FUWSTUDM.js.map → chunk-PH354ECN.js.map} +1 -1
- package/dist/{chunk-U5GW5EBR.js → chunk-RAUOFTUH.js} +12 -20
- package/dist/chunk-RAUOFTUH.js.map +1 -0
- package/dist/{chunk-2762HZYX.js → chunk-S2HWWR2H.js} +47 -25
- package/dist/chunk-S2HWWR2H.js.map +1 -0
- package/dist/{chunk-VLUKI3HL.js → chunk-S7N4LGLZ.js} +6 -13
- package/dist/chunk-S7N4LGLZ.js.map +1 -0
- package/dist/{chunk-TMMEJKLI.js → chunk-UHNRAI6V.js} +17 -4
- package/dist/chunk-UHNRAI6V.js.map +1 -0
- package/dist/{chunk-3NZXWCGF.js → chunk-WHKKN3ZK.js} +6 -6
- package/dist/{chunk-3NZXWCGF.js.map → chunk-WHKKN3ZK.js.map} +1 -1
- package/dist/{chunk-MOI7B3KH.js → chunk-WQN64ZHG.js} +5 -5
- package/dist/{chunk-MOI7B3KH.js.map → chunk-WQN64ZHG.js.map} +1 -1
- package/dist/chunk-WSIVRDRB.js +34 -0
- package/dist/chunk-WSIVRDRB.js.map +1 -0
- package/dist/{chunk-6SWK4XG5.js → chunk-YXE4B6X3.js} +2 -2
- package/dist/chunk-YXE4B6X3.js.map +1 -0
- package/dist/{chunk-NGAQITWP.js → chunk-Z2Z5EXVT.js} +10 -7
- package/dist/chunk-Z2Z5EXVT.js.map +1 -0
- package/dist/{chunk-IXKELBJA.js → chunk-ZDXQ64A7.js} +63 -44
- package/dist/chunk-ZDXQ64A7.js.map +1 -0
- package/dist/components/accordion/accordion-data.d.ts +3 -2
- package/dist/components/accordion/accordion-data.d.ts.map +1 -1
- package/dist/components/accordion/accordion.d.ts +2 -2
- package/dist/components/accordion/accordion.d.ts.map +1 -1
- package/dist/components/accordion/index.js +20 -8
- package/dist/components/accordion/index.js.map +1 -1
- package/dist/components/action-icon/action-icon.d.ts +3 -4
- package/dist/components/action-icon/action-icon.d.ts.map +1 -1
- package/dist/components/action-icon/index.js +2 -1
- package/dist/components/alert/alert.d.ts +18 -10
- package/dist/components/alert/alert.d.ts.map +1 -1
- package/dist/components/alert/index.js +17 -5
- package/dist/components/alert/index.js.map +1 -1
- package/dist/components/app-shell/app-shell.d.ts +3 -2
- package/dist/components/app-shell/app-shell.d.ts.map +1 -1
- package/dist/components/app-shell/index.js +4 -2
- package/dist/components/app-shell/index.js.map +1 -1
- package/dist/components/autocomplete/index.js +5 -4
- package/dist/components/autocomplete/index.js.map +1 -1
- package/dist/components/breadcrumb/breadcrumb.d.ts +3 -2
- package/dist/components/breadcrumb/breadcrumb.d.ts.map +1 -1
- package/dist/components/breadcrumb/index.js +11 -5
- package/dist/components/breadcrumb/index.js.map +1 -1
- package/dist/components/button/button.d.ts +4 -4
- package/dist/components/button/button.d.ts.map +1 -1
- package/dist/components/button/index.js +2 -1
- package/dist/components/button-multi-select/index.js +4 -3
- package/dist/components/button-multi-select/index.js.map +1 -1
- package/dist/components/button-select/index.js +4 -3
- package/dist/components/button-select/index.js.map +1 -1
- package/dist/components/calendar/calendar-body.d.ts.map +1 -1
- package/dist/components/calendar/index.js +3 -2
- package/dist/components/checkbox/index.js +2 -2
- package/dist/components/choice-card-group/index.js +1 -1
- package/dist/components/circular-progress/circular-progress.d.ts +3 -2
- package/dist/components/circular-progress/circular-progress.d.ts.map +1 -1
- package/dist/components/circular-progress/index.js +1 -0
- package/dist/components/circular-progress/index.js.map +1 -1
- package/dist/components/clipboard/clipboard.d.ts +1 -1
- package/dist/components/clipboard/clipboard.d.ts.map +1 -1
- package/dist/components/clipboard/index.js +9 -5
- package/dist/components/clipboard/index.js.map +1 -1
- package/dist/components/code-block/chrome.d.ts +4 -1
- package/dist/components/code-block/chrome.d.ts.map +1 -1
- package/dist/components/code-block/chrome.js +5 -4
- package/dist/components/code-block/code-block.d.ts +7 -1
- package/dist/components/code-block/code-block.d.ts.map +1 -1
- package/dist/components/code-block/index.d.ts +1 -1
- package/dist/components/code-block/index.js +12 -10
- package/dist/components/code-block/index.js.map +1 -1
- package/dist/components/code-block/notation.d.ts +5 -2
- package/dist/components/code-block/notation.d.ts.map +1 -1
- package/dist/components/code-block/static.d.ts +4 -1
- package/dist/components/code-block/static.d.ts.map +1 -1
- package/dist/components/code-block/static.js +5 -4
- package/dist/components/code-block/static.js.map +1 -1
- package/dist/components/collapse/collapse.d.ts +7 -3
- package/dist/components/collapse/collapse.d.ts.map +1 -1
- package/dist/components/collapse/index.js +2 -1
- package/dist/components/combobox/combobox.d.ts +11 -10
- package/dist/components/combobox/combobox.d.ts.map +1 -1
- package/dist/components/combobox/index.js +5 -4
- package/dist/components/combobox-list/index.js +6 -5
- package/dist/components/data-table/index.js +20 -19
- package/dist/components/data-table/index.js.map +1 -1
- package/dist/components/date-picker/index.js +12 -11
- package/dist/components/date-picker/index.js.map +1 -1
- package/dist/components/divider/divider.d.ts +3 -2
- package/dist/components/divider/divider.d.ts.map +1 -1
- package/dist/components/divider/index.js +1 -1
- package/dist/components/drawer/drawer.d.ts +6 -5
- package/dist/components/drawer/drawer.d.ts.map +1 -1
- package/dist/components/drawer/index.js +3 -2
- package/dist/components/field/field.d.ts +7 -4
- package/dist/components/field/field.d.ts.map +1 -1
- package/dist/components/field/index.js +1 -1
- package/dist/components/file-upload/index.js +3 -2
- package/dist/components/file-upload/index.js.map +1 -1
- package/dist/components/hover-card/index.js +1 -1
- package/dist/components/input/index.js +2 -2
- package/dist/components/input/input.d.ts +3 -2
- package/dist/components/input/input.d.ts.map +1 -1
- package/dist/components/menu/index.js +3 -2
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/menu/menu-data.d.ts +6 -1
- package/dist/components/menu/menu-data.d.ts.map +1 -1
- package/dist/components/menu/menu.d.ts +5 -5
- package/dist/components/menu/menu.d.ts.map +1 -1
- package/dist/components/modal/index.js +3 -2
- package/dist/components/modal/modal.d.ts +4 -3
- package/dist/components/modal/modal.d.ts.map +1 -1
- package/dist/components/multi-combobox-list/index.js +6 -5
- package/dist/components/multi-select/index.js +7 -6
- package/dist/components/multi-select/index.js.map +1 -1
- package/dist/components/nav-link/index.js +3 -2
- package/dist/components/nav-link/tanstack.js +3 -2
- package/dist/components/nav-link/tanstack.js.map +1 -1
- package/dist/components/notification/create-notifier.d.ts.map +1 -1
- package/dist/components/notification/index.js +8 -7
- package/dist/components/notification/index.js.map +1 -1
- package/dist/components/notification/notification.d.ts +7 -6
- package/dist/components/notification/notification.d.ts.map +1 -1
- package/dist/components/number-input/index.js +4 -4
- package/dist/components/overlays/index.js +5 -4
- package/dist/components/overlays/index.js.map +1 -1
- package/dist/components/password-input/index.js +2 -2
- package/dist/components/pill/index.js +2 -1
- package/dist/components/pill/pill.d.ts +4 -2
- package/dist/components/pill/pill.d.ts.map +1 -1
- package/dist/components/pills-input/index.js +5 -4
- package/dist/components/pills-input/pills-input.d.ts +3 -2
- package/dist/components/pills-input/pills-input.d.ts.map +1 -1
- package/dist/components/pin-input/index.js +2 -2
- package/dist/components/popover/index.js +1 -1
- package/dist/components/popover/popover.d.ts +3 -2
- package/dist/components/popover/popover.d.ts.map +1 -1
- package/dist/components/progress/index.js +1 -0
- package/dist/components/progress/index.js.map +1 -1
- package/dist/components/progress/progress.d.ts +3 -2
- package/dist/components/progress/progress.d.ts.map +1 -1
- package/dist/components/radio-group/index.js +1 -1
- package/dist/components/rating/index.js +2 -1
- package/dist/components/rating/index.js.map +1 -1
- package/dist/components/rating/rating.d.ts +3 -2
- package/dist/components/rating/rating.d.ts.map +1 -1
- package/dist/components/schedule/index.d.ts +4 -4
- package/dist/components/schedule/index.js +211 -110
- package/dist/components/schedule/index.js.map +1 -1
- package/dist/components/schedule/schedule-agenda-list.d.ts +6 -7
- package/dist/components/schedule/schedule-agenda-list.d.ts.map +1 -1
- package/dist/components/schedule/schedule-agenda-view.d.ts +19 -16
- package/dist/components/schedule/schedule-agenda-view.d.ts.map +1 -1
- package/dist/components/schedule/schedule-create-draft.d.ts +3 -2
- package/dist/components/schedule/schedule-create-draft.d.ts.map +1 -1
- package/dist/components/schedule/schedule-dates.d.ts.map +1 -1
- package/dist/components/schedule/schedule-days-view.d.ts +3 -2
- package/dist/components/schedule/schedule-days-view.d.ts.map +1 -1
- package/dist/components/schedule/schedule-drag-ghost.d.ts +12 -5
- package/dist/components/schedule/schedule-drag-ghost.d.ts.map +1 -1
- package/dist/components/schedule/schedule-event-chip.d.ts.map +1 -1
- package/dist/components/schedule/schedule-geometry.d.ts +16 -0
- package/dist/components/schedule/schedule-geometry.d.ts.map +1 -1
- package/dist/components/schedule/schedule-grid-gesture.d.ts +29 -6
- package/dist/components/schedule/schedule-grid-gesture.d.ts.map +1 -1
- package/dist/components/schedule/schedule-month-view.d.ts +3 -2
- package/dist/components/schedule/schedule-month-view.d.ts.map +1 -1
- package/dist/components/schedule/schedule-next-up.d.ts +4 -3
- package/dist/components/schedule/schedule-next-up.d.ts.map +1 -1
- package/dist/components/schedule/schedule-timed-grid.d.ts.map +1 -1
- package/dist/components/schedule/schedule-toolbar.d.ts +3 -3
- package/dist/components/schedule/schedule-toolbar.d.ts.map +1 -1
- package/dist/components/schedule/schedule-types.d.ts +9 -4
- package/dist/components/schedule/schedule-types.d.ts.map +1 -1
- package/dist/components/schedule/schedule-views.d.ts +2 -2
- package/dist/components/schedule/schedule-views.d.ts.map +1 -1
- package/dist/components/schedule/schedule-year-view.d.ts +3 -2
- package/dist/components/schedule/schedule-year-view.d.ts.map +1 -1
- package/dist/components/schedule/schedule.d.ts +9 -6
- package/dist/components/schedule/schedule.d.ts.map +1 -1
- package/dist/components/schedule/use-event-create.d.ts.map +1 -1
- package/dist/components/schedule/use-event-drag.d.ts.map +1 -1
- package/dist/components/schedule/use-event-resize.d.ts.map +1 -1
- package/dist/components/segment-group/index.js +2 -2
- package/dist/components/select/index.js +4 -4
- package/dist/components/slider/index.js +2 -1
- package/dist/components/slider/index.js.map +1 -1
- package/dist/components/slider/slider.d.ts +3 -2
- package/dist/components/slider/slider.d.ts.map +1 -1
- package/dist/components/switch/index.js +1 -1
- package/dist/components/tabs/index.js +1 -1
- package/dist/components/tabs/tabs-data.d.ts +3 -2
- package/dist/components/tabs/tabs-data.d.ts.map +1 -1
- package/dist/components/tags-input/index.js +6 -5
- package/dist/components/tags-input/index.js.map +1 -1
- package/dist/components/text-input/index.js +2 -2
- package/dist/components/textarea/index.js +2 -2
- package/dist/components/time-input/index.js +6 -6
- package/dist/components/timeline/index.js +8 -5
- package/dist/components/timeline/index.js.map +1 -1
- package/dist/components/timeline/timeline.d.ts +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 +2 -1
- package/dist/components/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/tree-multi-select/index.js +6 -5
- package/dist/components/tree-multi-select/index.js.map +1 -1
- package/dist/components/tree-select/index.js +3 -3
- package/dist/lib/as-child.d.ts +104 -0
- package/dist/lib/as-child.d.ts.map +1 -0
- package/dist/theme.css +9 -3
- package/package.json +1 -1
- package/src/as-child.contract.test.tsx +809 -0
- package/src/components/accordion/accordion-data.tsx +8 -5
- package/src/components/accordion/accordion.test.tsx +40 -0
- package/src/components/accordion/accordion.tsx +23 -6
- package/src/components/action-icon/action-icon.tsx +9 -24
- package/src/components/alert/alert.test.tsx +25 -2
- package/src/components/alert/alert.tsx +39 -13
- package/src/components/app-shell/app-shell.tsx +3 -1
- package/src/components/breadcrumb/breadcrumb.test.tsx +30 -0
- package/src/components/breadcrumb/breadcrumb.tsx +21 -12
- package/src/components/button/button.tsx +21 -50
- package/src/components/calendar/calendar-body.tsx +8 -1
- package/src/components/circular-progress/circular-progress.tsx +4 -1
- package/src/components/clipboard/clipboard.test.tsx +18 -0
- package/src/components/clipboard/clipboard.tsx +8 -2
- package/src/components/code-block/chrome.tsx +60 -36
- package/src/components/code-block/code-block.test.tsx +27 -0
- package/src/components/code-block/code-block.tsx +13 -3
- package/src/components/code-block/notation.test.ts +8 -0
- package/src/components/code-block/notation.ts +6 -3
- package/src/components/code-block/static.tsx +8 -2
- package/src/components/collapse/collapse.tsx +33 -15
- package/src/components/combobox/combobox.test.tsx +38 -0
- package/src/components/combobox/combobox.tsx +24 -10
- package/src/components/divider/divider.tsx +3 -1
- package/src/components/drawer/drawer.tsx +37 -16
- package/src/components/field/field.tsx +7 -3
- package/src/components/input/input.tsx +3 -1
- package/src/components/menu/menu-data.tsx +8 -1
- package/src/components/menu/menu.test.tsx +52 -0
- package/src/components/menu/menu.tsx +83 -35
- package/src/components/modal/close-trigger.test.tsx +38 -0
- package/src/components/modal/modal.tsx +29 -13
- package/src/components/notification/create-notifier.tsx +6 -5
- package/src/components/notification/notification.test.tsx +15 -0
- package/src/components/notification/notification.tsx +8 -5
- package/src/components/pill/pill.tsx +29 -20
- package/src/components/pills-input/pills-input.tsx +3 -1
- package/src/components/popover/popover.tsx +3 -1
- package/src/components/progress/progress.tsx +4 -1
- package/src/components/rating/rating.tsx +27 -23
- package/src/components/schedule/index.ts +1 -1
- package/src/components/schedule/now-cursor-line.tsx +1 -1
- package/src/components/schedule/schedule-agenda-list.tsx +6 -7
- package/src/components/schedule/schedule-agenda-view.test.tsx +105 -28
- package/src/components/schedule/schedule-agenda-view.tsx +46 -31
- package/src/components/schedule/schedule-all-day-row.tsx +1 -1
- package/src/components/schedule/schedule-create-draft.tsx +14 -5
- package/src/components/schedule/schedule-dates.test.ts +37 -52
- package/src/components/schedule/schedule-dates.ts +25 -27
- package/src/components/schedule/schedule-days-view.tsx +9 -5
- package/src/components/schedule/schedule-drag-ghost.tsx +27 -12
- package/src/components/schedule/schedule-event-chip.tsx +9 -2
- package/src/components/schedule/schedule-event-list-popover-content.tsx +1 -1
- package/src/components/schedule/schedule-geometry.ts +21 -0
- package/src/components/schedule/schedule-grid-gesture.test.ts +83 -1
- package/src/components/schedule/schedule-grid-gesture.ts +67 -28
- package/src/components/schedule/schedule-month-view.tsx +10 -6
- package/src/components/schedule/schedule-next-up.tsx +11 -5
- package/src/components/schedule/schedule-timed-grid.tsx +41 -3
- package/src/components/schedule/schedule-toolbar.test.tsx +26 -0
- package/src/components/schedule/schedule-toolbar.tsx +35 -17
- package/src/components/schedule/schedule-types.ts +9 -4
- package/src/components/schedule/schedule-views.ts +4 -5
- package/src/components/schedule/schedule-year-view.tsx +10 -6
- package/src/components/schedule/schedule.test.tsx +198 -36
- package/src/components/schedule/schedule.tsx +28 -17
- package/src/components/schedule/use-event-create.ts +7 -6
- package/src/components/schedule/use-event-drag.ts +10 -4
- package/src/components/schedule/use-event-resize.ts +4 -2
- package/src/components/slider/slider.tsx +4 -0
- package/src/components/tabs/tabs-data.tsx +17 -14
- package/src/components/timeline/timeline.tsx +102 -95
- package/src/components/tooltip/tooltip.tsx +2 -1
- package/src/lib/as-child.test.tsx +70 -0
- package/src/lib/as-child.ts +119 -0
- package/src/theme.css +9 -3
- package/dist/chunk-2762HZYX.js.map +0 -1
- package/dist/chunk-2H46IXW4.js.map +0 -1
- package/dist/chunk-6SWK4XG5.js.map +0 -1
- package/dist/chunk-ACE7FBWE.js.map +0 -1
- package/dist/chunk-HWNPXAEN.js +0 -31
- package/dist/chunk-HWNPXAEN.js.map +0 -1
- package/dist/chunk-IFWCCAQV.js.map +0 -1
- package/dist/chunk-IXKELBJA.js.map +0 -1
- package/dist/chunk-J3PELDH3.js.map +0 -1
- package/dist/chunk-NGAQITWP.js.map +0 -1
- package/dist/chunk-POKDSVQT.js.map +0 -1
- package/dist/chunk-QMW7D5GU.js.map +0 -1
- package/dist/chunk-TMMEJKLI.js.map +0 -1
- package/dist/chunk-TNNH3FVQ.js.map +0 -1
- package/dist/chunk-U5GW5EBR.js.map +0 -1
- package/dist/chunk-UNSAA7YG.js.map +0 -1
- package/dist/chunk-VLUKI3HL.js.map +0 -1
- package/dist/chunk-VZ2TPU4B.js.map +0 -1
- package/dist/chunk-YIQI2CF3.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/number-input/number-input.tsx"],"names":["Ark"],"mappings":";;;;;;;;;;;;;AA6HA,IAAM,UAAA,GAAa,CAAC,KAAA,KAClB,KAAA,KAAU,MAAA,GAAY,SAAY,KAAA,KAAU,IAAA,GAAO,EAAA,GAAK,MAAA,CAAO,KAAK,CAAA;AAGtE,IAAM,SAAA,GAAY,CAAC,GAAA,EAAa,GAAA,EAAa,GAAA,KAAwB;AACnE,EAAA,MAAM,IAAA,GAAO,MAAM,GAAA,GAAM,CAAA;AACzB,EAAA,OAAA,CAAA,CAAW,GAAA,GAAM,GAAA,IAAO,IAAA,GAAQ,IAAA,IAAQ,IAAA,GAAQ,GAAA;AAClD,CAAA;AAQA,IAAM,gBAAA,GAAmB,CAAC,KAAA,EAAwC,GAAA,KAAgB;AAChF,EAAA,IAAI,CAAC,MAAA,CAAO,IAAA,CAAK,KAAA,CAAM,GAAG,CAAA,IAAK,KAAA,CAAM,OAAA,IAAW,KAAA,CAAM,OAAA,IAAW,KAAA,CAAM,MAAA,EAAQ;AAC/E,EAAA,MAAM,QAAQ,KAAA,CAA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F;AAEJ","file":"chunk-3GYOIQW7.js","sourcesContent":["\"use client\"\n\nimport { useFieldContext } from \"@ark-ui/react/field\"\nimport { NumberInput as Ark, useNumberInputContext } from \"@ark-ui/react/number-input\"\nimport { ChevronDown, ChevronUp } from \"lucide-react\"\nimport { type FocusEvent, type KeyboardEvent, type ReactNode, type Ref, useRef } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { mergeRefs } from \"../../lib/merge-refs\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { type FieldProps, FieldShell, fieldA11yProps } from \"../field/field\"\nimport {\n InputBase,\n type InputSize,\n type InputVariant,\n inputControlClasses,\n inputSlot,\n} from \"../input/input\"\nimport { CloseIcon } from \"../popover/icons\"\nimport { popoverClearTrigger } from \"../popover/popover\"\n\n/**\n * NumberInput — a numeric `<input>` with increment / decrement steppers on Ark\n * UI's NumberInput machine. It lives on the same shell as [`Input`](/docs/input)\n * (border, focus ring, slots, invalid / disabled states) and adds spin buttons,\n * clamping, locale-aware formatting, and the full keyboard / wheel model.\n *\n * - Value is a real `number` here (or `null` for empty): the machine speaks\n * strings internally, but `value` / `defaultValue` take a `number | null`\n * and `onChange` hands one back — `null` whenever the field has no valid\n * number (empty, or mid-edit on a partial token).\n * - Like the rest of the family it carries its own `label` / `description` /\n * `error` / `required` via [`Field`](/docs/field); `error` flips the red\n * state, or set `invalid` directly.\n * - `hideControls` drops the steppers for a plain numeric field.\n * - `clearable` adds a clear (×) button once there's a value, resetting to\n * `null` — the numeric analogue of `Select`'s `clearable`.\n *\n * Palette rides on `data-color`, matching the family — but the shell's focus\n * halo is a fixed `brand-500`, so nothing here actually tints today.\n */\n\ntype NumberInputClassNames = {\n /** The field wrapper (label / description / error). */\n field?: string\n /** The label element itself — e.g. `\"sr-only\"` to keep the accessible name\n * without showing it (pair with `suffix` for a unit hint in its place). */\n label?: string\n /** The shell `<div>` (also targeted by `className`). */\n root?: string\n /** The inner `<input>` element. */\n input?: string\n /** The stepper column wrapping the increment / decrement triggers. */\n control?: string\n}\n\nexport type NumberInputProps = Pick<FieldProps, \"label\" | \"description\" | \"error\" | \"required\"> &\n WithTestId & {\n /** Controlled value; `null` for empty. */\n value?: number | null\n /** Uncontrolled initial value; `null` for empty. */\n defaultValue?: number | null\n /** Fires with the next numeric value, or `null` when the field has no valid number. */\n onChange?: (value: number | null) => void\n /** Minimum value. */\n min?: number\n /** Maximum value. */\n max?: number\n /** Increment / decrement step. */\n step?: number\n /** Placeholder shown while the field is empty. */\n placeholder?: string\n /** Options forwarded to `Intl.NumberFormat` for display (currency, percent, …). */\n formatOptions?: Intl.NumberFormatOptions\n /** Allow the mouse wheel to change the value while focused. */\n allowMouseWheel?: boolean\n /** Clamp the value into `[min, max]` when the input blurs. */\n clampValueOnBlur?: boolean\n /** Wrap past `min` / `max` instead of clamping (23 → 0, 0 → 59, …) — for\n * cyclical fields like hours/minutes. Requires both `min` and `max`, and\n * the field to be used controlled: the wrapped value round-trips back in\n * as `value` on the next render to correct the display.\n *\n * Only *stepping* wraps (arrow keys, steppers, wheel). Typing behaves like\n * a clock segment instead: a digit that would overflow `max` (or its digit\n * count) replaces the whole field rather than being inserted, so `10` + a\n * `2` typed at the start reads `2`, not `210`. A typed value still out of\n * range (a partial `0` in a 1–12 field, a paste) isn't reported until it\n * is either completed or clamped into range on blur. */\n wrap?: boolean\n /** Hide the increment / decrement steppers for a plain numeric field. */\n hideControls?: boolean\n /** Show a clear button once there's a value, resetting to `null`. */\n clearable?: boolean\n /** Field name for native form submission. */\n name?: string\n /** Red invalid state; OR'd with `error`. */\n invalid?: boolean\n /** Dims the shell and disables the input. */\n disabled?: boolean\n /** Keeps full contrast but blocks edits. */\n readOnly?: boolean\n variant?: InputVariant\n size?: InputSize\n /** Inline-start adornment (icon, prefix). */\n startSlot?: ReactNode\n /** Non-interactive unit hint (e.g. `\"h\"`, `\"%\"`) rendered right after the\n * value, before the clear button / steppers — `aria-hidden` and\n * non-selectable, never part of the editable value. Distinct from a\n * generic end adornment: `InputBase`'s `endSlot` renders after *all*\n * content (i.e. after the steppers here), which would sit away from the\n * digits instead of glued to them. */\n suffix?: ReactNode\n /** Explicit id for label association. */\n id?: string\n /** Lands on the `<input>` for focus-on-error. */\n ref?: Ref<HTMLInputElement>\n /** Forwarded to the `<input>`; drives touched/blurred validation. */\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void\n className?: string\n classNames?: NumberInputClassNames\n }\n\n/** Bridge the kit's `number | null` value to the machine's string contract:\n * `undefined` stays uncontrolled, `null` is a controlled empty field. */\nconst toArkValue = (value: number | null | undefined): string | undefined =>\n value === undefined ? undefined : value === null ? \"\" : String(value)\n\n/** Wrap `raw` into `[min, max]` (inclusive), e.g. `wrapValue(24, 0, 23) === 0`. */\nconst wrapValue = (raw: number, min: number, max: number): number => {\n const span = max - min + 1\n return ((((raw - min) % span) + span) % span) + min\n}\n\n/** `wrap`'s bounds. */\ntype WrapCycle = { min: number; max: number }\n\n/** Under `wrap`, select the whole field before a digit lands if inserting it at\n * the caret would overflow `max` (by value or digit count) — the browser's own\n * insertion then replaces the field with that digit, like a clock segment. */\nconst selectOnOverflow = (event: KeyboardEvent<HTMLInputElement>, max: number) => {\n if (!/^\\d$/.test(event.key) || event.ctrlKey || event.metaKey || event.altKey) return\n const input = event.currentTarget\n const { value } = input\n const start = input.selectionStart ?? value.length\n const end = input.selectionEnd ?? value.length\n const next = value.slice(0, start) + event.key + value.slice(end)\n if (next.length > String(max).length || Number(next) > max) input.select()\n}\n\n/**\n * The real `<input>`, split out so it reads the `Field` context from *inside*\n * the wrapping `FieldShell` — `NumberInput` itself renders that shell, so\n * calling `useFieldContext()` at its own top level would run too early.\n */\nconst NumberInputField = ({\n ref,\n placeholder,\n onBlur,\n testId,\n className,\n cycle,\n}: {\n ref?: Ref<HTMLInputElement>\n placeholder?: string\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void\n testId?: string\n className?: string\n cycle?: WrapCycle\n}) => {\n const field = useFieldContext()\n const api = useNumberInputContext()\n if (!cycle) {\n return (\n <Ark.Input\n ref={ref}\n placeholder={placeholder}\n onBlur={onBlur}\n data-testid={testId}\n {...fieldA11yProps(field)}\n className={className}\n />\n )\n }\n return (\n <Ark.Input\n ref={ref}\n placeholder={placeholder}\n onKeyDown={(event) => selectOnOverflow(event, cycle.max)}\n // Home/End jump to Ark's own `min`/`max`, which it never sees under `wrap` — it would land\n // on ±`MAX_SAFE_INTEGER` and wrap to an arbitrary value. Capture runs before Ark's own\n // handler; stopping propagation is what skips it (Ark's `defaultPrevented` bail-out reads\n // the synthetic event's creation-time snapshot, so `preventDefault` alone doesn't).\n onKeyDownCapture={(event) => {\n if (event.key !== \"Home\" && event.key !== \"End\") return\n if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return\n event.preventDefault()\n event.stopPropagation()\n api.setValue(event.key === \"Home\" ? cycle.min : cycle.max)\n }}\n onBlur={(event) => {\n // A typed value never wraps, so one left out of range is clamped here instead —\n // Ark's own clamp-on-blur is off under `wrap` (it never sees `min`/`max`).\n const raw = api.valueAsNumber\n if (!Number.isNaN(raw) && (raw < cycle.min || raw > cycle.max)) {\n api.setValue(Math.min(Math.max(raw, cycle.min), cycle.max))\n }\n onBlur?.(event)\n }}\n // Ark only sees `min`/`max` outside `wrap`, so restore the real range here.\n aria-valuemin={cycle.min}\n aria-valuemax={cycle.max}\n data-testid={testId}\n {...fieldA11yProps(field)}\n className={className}\n />\n )\n}\n\nexport const NumberInput = ({\n value,\n defaultValue,\n onChange,\n min,\n max,\n step,\n placeholder,\n formatOptions,\n allowMouseWheel,\n clampValueOnBlur,\n wrap,\n hideControls,\n clearable,\n name,\n invalid,\n disabled,\n readOnly,\n required,\n label,\n description,\n error,\n variant = \"default\",\n size = \"md\",\n startSlot,\n suffix,\n id,\n ref,\n onBlur,\n className,\n classNames,\n testId,\n}: NumberInputProps) => {\n // Drive the red state independently of the `Field` error slot so a form\n // library can flip it from `fieldState.invalid` (see FormControlProps).\n const isInvalid = invalid || error != null\n const inputRef = useRef<HTMLInputElement>(null)\n const cycle: WrapCycle | undefined =\n wrap && min !== undefined && max !== undefined ? { min, max } : undefined\n\n return (\n <FieldShell\n label={label}\n description={description}\n error={error}\n required={required}\n disabled={disabled}\n size={size}\n className={classNames?.field}\n classNames={{ label: classNames?.label }}\n >\n <Ark.Root\n value={toArkValue(value)}\n defaultValue={toArkValue(defaultValue)}\n onValueChange={\n onChange\n ? (details) => {\n const raw = details.valueAsNumber\n if (Number.isNaN(raw)) {\n onChange(null)\n } else if (cycle) {\n // Only stepping wraps. A typed change is already in the `<input>` when it is\n // reported, while a stepped one (arrows, steppers, wheel) is only written to\n // the DOM on Ark's next frame — so a match means the user typed it. Typed\n // values are reported as-is when in range; an out-of-range one is held until\n // it is completed or clamped on blur (see `NumberInputField`).\n const typed = details.value === inputRef.current?.value\n if (!typed) onChange(wrapValue(raw, cycle.min, cycle.max))\n else if (raw >= cycle.min && raw <= cycle.max) onChange(raw)\n } else {\n onChange(raw)\n }\n }\n : undefined\n }\n // Wrapping fields disable Ark's own clamp so it always reports the true\n // out-of-range stepped value — `wrapValue` above normalizes it instead.\n min={wrap ? undefined : min}\n max={wrap ? undefined : max}\n step={step}\n formatOptions={formatOptions}\n allowMouseWheel={allowMouseWheel}\n clampValueOnBlur={clampValueOnBlur}\n name={name}\n {...props({ invalid: isInvalid, disabled, readOnly, required })}\n ids={id ? { input: id } : undefined}\n className={cn(\"w-full\", className)}\n >\n <Ark.Context>\n {(api) => {\n // `canClear` reserves the clear button's layout box (and the\n // shell's end-slot padding) for the whole time the field is\n // clearable, not just while it has a value — otherwise the\n // button mounting/unmounting shifts the input's width. `showClear`\n // only toggles its visibility/interactivity via `invisible`.\n const canClear = Boolean(clearable) && !disabled && !readOnly\n const showClear = canClear && !api.empty\n return (\n <InputBase\n variant={variant}\n size={size}\n invalid={isInvalid}\n disabled={disabled}\n readOnly={readOnly}\n startSlot={startSlot}\n // The steppers (and the clear button) are interactive — they must\n // not sit inside the `aria-hidden`, `[&_svg]:pointer-events-none`\n // end-slot span. Render them as direct children instead, and flag\n // the shell's end padding manually so the layout matches an\n // `endSlot`.\n classNames={{ root: classNames?.root }}\n className=\"pe-0! overflow-clip\"\n {...props({ \"data-with-end-slot\": !hideControls || canClear || suffix != null })}\n >\n {/* The shell's own `gap-*` (`shellGap`) is meant for *slots* — spacing the\n * control away from icons/steppers/clear button — not for the suffix, which is\n * documented (and used, e.g. `TimeRow`'s \"23h\") to sit glued right against the\n * value. Wrapping the two together in their own `gap`-less flex row keeps that\n * glued pairing regardless of `size`, while the shell's real gap still applies\n * between this pair and the next sibling (clear button / steppers). */}\n <div className=\"flex min-w-0 flex-1 items-center\">\n <NumberInputField\n ref={mergeRefs(inputRef, ref)}\n placeholder={placeholder}\n onBlur={onBlur}\n testId={testId}\n cycle={cycle}\n className={cn(inputControlClasses, classNames?.input)}\n />\n {suffix != null && (\n <span aria-hidden className={cn(inputSlot, \"select-none\")}>\n {suffix}\n </span>\n )}\n </div>\n {canClear && (\n <button\n type=\"button\"\n aria-label=\"Clear value\"\n aria-hidden={!showClear}\n tabIndex={showClear ? 0 : -1}\n onPointerDown={(event) => event.preventDefault()}\n onClick={() => api.clearValue()}\n className={cn(popoverClearTrigger, !showClear && \"invisible\")}\n >\n <CloseIcon />\n </button>\n )}\n {!hideControls && (\n <Ark.Control className={cn(\"-my-1 flex flex-col\", classNames?.control)}>\n <Ark.IncrementTrigger\n aria-label=\"Increment\"\n disabled={!wrap && !!(max !== undefined && (value ?? 0) >= max)}\n {...props({\n \"data-disabled\": !wrap && !!(max !== undefined && (value ?? 0) >= max),\n })}\n className={cn(\n \"inline-flex shrink-0 items-center justify-center\",\n \"h-1/2 cursor-pointer w-6 dark:[&:hover:not([data-disabled])]:bg-gray-dark-800 [&:hover:not([data-disabled])]:bg-gray-light-300 transition-colors rounded-xxs\",\n \"data-disabled:cursor-not-allowed data-disabled:text-current/20\",\n )}\n >\n <ChevronUp />\n </Ark.IncrementTrigger>\n <Ark.DecrementTrigger\n aria-label=\"Decrement\"\n disabled={!wrap && !!(min !== undefined && (value ?? 0) <= min)}\n {...props({\n \"data-disabled\": !wrap && !!(min !== undefined && (value ?? 0) <= min),\n })}\n className={cn(\n \"inline-flex shrink-0 items-center justify-center\",\n \"h-1/2 cursor-pointer w-6 dark:[&:hover:not([data-disabled])]:bg-gray-dark-800 [&:hover:not([data-disabled])]:bg-gray-light-300 transition-colors rounded-xxs\",\n \"data-disabled:cursor-not-allowed data-disabled:text-gray-light-500 dark:data-disabled:text-gray-dark-600\",\n )}\n >\n <ChevronDown />\n </Ark.DecrementTrigger>\n </Ark.Control>\n )}\n </InputBase>\n )\n }}\n </Ark.Context>\n </Ark.Root>\n </FieldShell>\n )\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/number-input/number-input.tsx"],"names":["Ark"],"mappings":";;;;;;;;;;;;;AA6HA,IAAM,UAAA,GAAa,CAAC,KAAA,KAClB,KAAA,KAAU,MAAA,GAAY,SAAY,KAAA,KAAU,IAAA,GAAO,EAAA,GAAK,MAAA,CAAO,KAAK,CAAA;AAGtE,IAAM,SAAA,GAAY,CAAC,GAAA,EAAa,GAAA,EAAa,GAAA,KAAwB;AACnE,EAAA,MAAM,IAAA,GAAO,MAAM,GAAA,GAAM,CAAA;AACzB,EAAA,OAAA,CAAA,CAAW,GAAA,GAAM,GAAA,IAAO,IAAA,GAAQ,IAAA,IAAQ,IAAA,GAAQ,GAAA;AAClD,CAAA;AAQA,IAAM,gBAAA,GAAmB,CAAC,KAAA,EAAwC,GAAA,KAAgB;AAChF,EAAA,IAAI,CAAC,MAAA,CAAO,IAAA,CAAK,KAAA,CAAM,GAAG,CAAA,IAAK,KAAA,CAAM,OAAA,IAAW,KAAA,CAAM,OAAA,IAAW,KAAA,CAAM,MAAA,EAAQ;AAC/E,EAAA,MAAM,QAAQ,KAAA,CAAM,aAAA;AACpB,EAAA,MAAM,EAAE,OAAM,GAAI,KAAA;AAClB,EAAA,MA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from \"@ark-ui/react/field\"\nimport { NumberInput as Ark, useNumberInputContext } from \"@ark-ui/react/number-input\"\nimport { ChevronDown, ChevronUp } from \"lucide-react\"\nimport { type FocusEvent, type KeyboardEvent, type ReactNode, type Ref, useRef } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { mergeRefs } from \"../../lib/merge-refs\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { type FieldProps, FieldShell, fieldA11yProps } from \"../field/field\"\nimport {\n InputBase,\n type InputSize,\n type InputVariant,\n inputControlClasses,\n inputSlot,\n} from \"../input/input\"\nimport { CloseIcon } from \"../popover/icons\"\nimport { popoverClearTrigger } from \"../popover/popover\"\n\n/**\n * NumberInput — a numeric `<input>` with increment / decrement steppers on Ark\n * UI's NumberInput machine. It lives on the same shell as [`Input`](/docs/input)\n * (border, focus ring, slots, invalid / disabled states) and adds spin buttons,\n * clamping, locale-aware formatting, and the full keyboard / wheel model.\n *\n * - Value is a real `number` here (or `null` for empty): the machine speaks\n * strings internally, but `value` / `defaultValue` take a `number | null`\n * and `onChange` hands one back — `null` whenever the field has no valid\n * number (empty, or mid-edit on a partial token).\n * - Like the rest of the family it carries its own `label` / `description` /\n * `error` / `required` via [`Field`](/docs/field); `error` flips the red\n * state, or set `invalid` directly.\n * - `hideControls` drops the steppers for a plain numeric field.\n * - `clearable` adds a clear (×) button once there's a value, resetting to\n * `null` — the numeric analogue of `Select`'s `clearable`.\n *\n * Palette rides on `data-color`, matching the family — but the shell's focus\n * halo is a fixed `brand-500`, so nothing here actually tints today.\n */\n\ntype NumberInputClassNames = {\n /** The field wrapper (label / description / error). */\n field?: string\n /** The label element itself — e.g. `\"sr-only\"` to keep the accessible name\n * without showing it (pair with `suffix` for a unit hint in its place). */\n label?: string\n /** The shell `<div>` (also targeted by `className`). */\n root?: string\n /** The inner `<input>` element. */\n input?: string\n /** The stepper column wrapping the increment / decrement triggers. */\n control?: string\n}\n\nexport type NumberInputProps = Pick<FieldProps, \"label\" | \"description\" | \"error\" | \"required\"> &\n WithTestId & {\n /** Controlled value; `null` for empty. */\n value?: number | null\n /** Uncontrolled initial value; `null` for empty. */\n defaultValue?: number | null\n /** Fires with the next numeric value, or `null` when the field has no valid number. */\n onChange?: (value: number | null) => void\n /** Minimum value. */\n min?: number\n /** Maximum value. */\n max?: number\n /** Increment / decrement step. */\n step?: number\n /** Placeholder shown while the field is empty. */\n placeholder?: string\n /** Options forwarded to `Intl.NumberFormat` for display (currency, percent, …). */\n formatOptions?: Intl.NumberFormatOptions\n /** Allow the mouse wheel to change the value while focused. */\n allowMouseWheel?: boolean\n /** Clamp the value into `[min, max]` when the input blurs. */\n clampValueOnBlur?: boolean\n /** Wrap past `min` / `max` instead of clamping (23 → 0, 0 → 59, …) — for\n * cyclical fields like hours/minutes. Requires both `min` and `max`, and\n * the field to be used controlled: the wrapped value round-trips back in\n * as `value` on the next render to correct the display.\n *\n * Only *stepping* wraps (arrow keys, steppers, wheel). Typing behaves like\n * a clock segment instead: a digit that would overflow `max` (or its digit\n * count) replaces the whole field rather than being inserted, so `10` + a\n * `2` typed at the start reads `2`, not `210`. A typed value still out of\n * range (a partial `0` in a 1–12 field, a paste) isn't reported until it\n * is either completed or clamped into range on blur. */\n wrap?: boolean\n /** Hide the increment / decrement steppers for a plain numeric field. */\n hideControls?: boolean\n /** Show a clear button once there's a value, resetting to `null`. */\n clearable?: boolean\n /** Field name for native form submission. */\n name?: string\n /** Red invalid state; OR'd with `error`. */\n invalid?: boolean\n /** Dims the shell and disables the input. */\n disabled?: boolean\n /** Keeps full contrast but blocks edits. */\n readOnly?: boolean\n variant?: InputVariant\n size?: InputSize\n /** Inline-start adornment (icon, prefix). */\n startSlot?: ReactNode\n /** Non-interactive unit hint (e.g. `\"h\"`, `\"%\"`) rendered right after the\n * value, before the clear button / steppers — `aria-hidden` and\n * non-selectable, never part of the editable value. Distinct from a\n * generic end adornment: `InputBase`'s `endSlot` renders after *all*\n * content (i.e. after the steppers here), which would sit away from the\n * digits instead of glued to them. */\n suffix?: ReactNode\n /** Explicit id for label association. */\n id?: string\n /** Lands on the `<input>` for focus-on-error. */\n ref?: Ref<HTMLInputElement>\n /** Forwarded to the `<input>`; drives touched/blurred validation. */\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void\n className?: string\n classNames?: NumberInputClassNames\n }\n\n/** Bridge the kit's `number | null` value to the machine's string contract:\n * `undefined` stays uncontrolled, `null` is a controlled empty field. */\nconst toArkValue = (value: number | null | undefined): string | undefined =>\n value === undefined ? undefined : value === null ? \"\" : String(value)\n\n/** Wrap `raw` into `[min, max]` (inclusive), e.g. `wrapValue(24, 0, 23) === 0`. */\nconst wrapValue = (raw: number, min: number, max: number): number => {\n const span = max - min + 1\n return ((((raw - min) % span) + span) % span) + min\n}\n\n/** `wrap`'s bounds. */\ntype WrapCycle = { min: number; max: number }\n\n/** Under `wrap`, select the whole field before a digit lands if inserting it at\n * the caret would overflow `max` (by value or digit count) — the browser's own\n * insertion then replaces the field with that digit, like a clock segment. */\nconst selectOnOverflow = (event: KeyboardEvent<HTMLInputElement>, max: number) => {\n if (!/^\\d$/.test(event.key) || event.ctrlKey || event.metaKey || event.altKey) return\n const input = event.currentTarget\n const { value } = input\n const start = input.selectionStart ?? value.length\n const end = input.selectionEnd ?? value.length\n const next = value.slice(0, start) + event.key + value.slice(end)\n if (next.length > String(max).length || Number(next) > max) input.select()\n}\n\n/**\n * The real `<input>`, split out so it reads the `Field` context from *inside*\n * the wrapping `FieldShell` — `NumberInput` itself renders that shell, so\n * calling `useFieldContext()` at its own top level would run too early.\n */\nconst NumberInputField = ({\n ref,\n placeholder,\n onBlur,\n testId,\n className,\n cycle,\n}: {\n ref?: Ref<HTMLInputElement>\n placeholder?: string\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void\n testId?: string\n className?: string\n cycle?: WrapCycle\n}) => {\n const field = useFieldContext()\n const api = useNumberInputContext()\n if (!cycle) {\n return (\n <Ark.Input\n ref={ref}\n placeholder={placeholder}\n onBlur={onBlur}\n data-testid={testId}\n {...fieldA11yProps(field)}\n className={className}\n />\n )\n }\n return (\n <Ark.Input\n ref={ref}\n placeholder={placeholder}\n onKeyDown={(event) => selectOnOverflow(event, cycle.max)}\n // Home/End jump to Ark's own `min`/`max`, which it never sees under `wrap` — it would land\n // on ±`MAX_SAFE_INTEGER` and wrap to an arbitrary value. Capture runs before Ark's own\n // handler; stopping propagation is what skips it (Ark's `defaultPrevented` bail-out reads\n // the synthetic event's creation-time snapshot, so `preventDefault` alone doesn't).\n onKeyDownCapture={(event) => {\n if (event.key !== \"Home\" && event.key !== \"End\") return\n if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return\n event.preventDefault()\n event.stopPropagation()\n api.setValue(event.key === \"Home\" ? cycle.min : cycle.max)\n }}\n onBlur={(event) => {\n // A typed value never wraps, so one left out of range is clamped here instead —\n // Ark's own clamp-on-blur is off under `wrap` (it never sees `min`/`max`).\n const raw = api.valueAsNumber\n if (!Number.isNaN(raw) && (raw < cycle.min || raw > cycle.max)) {\n api.setValue(Math.min(Math.max(raw, cycle.min), cycle.max))\n }\n onBlur?.(event)\n }}\n // Ark only sees `min`/`max` outside `wrap`, so restore the real range here.\n aria-valuemin={cycle.min}\n aria-valuemax={cycle.max}\n data-testid={testId}\n {...fieldA11yProps(field)}\n className={className}\n />\n )\n}\n\nexport const NumberInput = ({\n value,\n defaultValue,\n onChange,\n min,\n max,\n step,\n placeholder,\n formatOptions,\n allowMouseWheel,\n clampValueOnBlur,\n wrap,\n hideControls,\n clearable,\n name,\n invalid,\n disabled,\n readOnly,\n required,\n label,\n description,\n error,\n variant = \"default\",\n size = \"md\",\n startSlot,\n suffix,\n id,\n ref,\n onBlur,\n className,\n classNames,\n testId,\n}: NumberInputProps) => {\n // Drive the red state independently of the `Field` error slot so a form\n // library can flip it from `fieldState.invalid` (see FormControlProps).\n const isInvalid = invalid || error != null\n const inputRef = useRef<HTMLInputElement>(null)\n const cycle: WrapCycle | undefined =\n wrap && min !== undefined && max !== undefined ? { min, max } : undefined\n\n return (\n <FieldShell\n label={label}\n description={description}\n error={error}\n required={required}\n disabled={disabled}\n size={size}\n className={classNames?.field}\n classNames={{ label: classNames?.label }}\n >\n <Ark.Root\n value={toArkValue(value)}\n defaultValue={toArkValue(defaultValue)}\n onValueChange={\n onChange\n ? (details) => {\n const raw = details.valueAsNumber\n if (Number.isNaN(raw)) {\n onChange(null)\n } else if (cycle) {\n // Only stepping wraps. A typed change is already in the `<input>` when it is\n // reported, while a stepped one (arrows, steppers, wheel) is only written to\n // the DOM on Ark's next frame — so a match means the user typed it. Typed\n // values are reported as-is when in range; an out-of-range one is held until\n // it is completed or clamped on blur (see `NumberInputField`).\n const typed = details.value === inputRef.current?.value\n if (!typed) onChange(wrapValue(raw, cycle.min, cycle.max))\n else if (raw >= cycle.min && raw <= cycle.max) onChange(raw)\n } else {\n onChange(raw)\n }\n }\n : undefined\n }\n // Wrapping fields disable Ark's own clamp so it always reports the true\n // out-of-range stepped value — `wrapValue` above normalizes it instead.\n min={wrap ? undefined : min}\n max={wrap ? undefined : max}\n step={step}\n formatOptions={formatOptions}\n allowMouseWheel={allowMouseWheel}\n clampValueOnBlur={clampValueOnBlur}\n name={name}\n {...props({ invalid: isInvalid, disabled, readOnly, required })}\n ids={id ? { input: id } : undefined}\n className={cn(\"w-full\", className)}\n >\n <Ark.Context>\n {(api) => {\n // `canClear` reserves the clear button's layout box (and the\n // shell's end-slot padding) for the whole time the field is\n // clearable, not just while it has a value — otherwise the\n // button mounting/unmounting shifts the input's width. `showClear`\n // only toggles its visibility/interactivity via `invisible`.\n const canClear = Boolean(clearable) && !disabled && !readOnly\n const showClear = canClear && !api.empty\n return (\n <InputBase\n variant={variant}\n size={size}\n invalid={isInvalid}\n disabled={disabled}\n readOnly={readOnly}\n startSlot={startSlot}\n // The steppers (and the clear button) are interactive — they must\n // not sit inside the `aria-hidden`, `[&_svg]:pointer-events-none`\n // end-slot span. Render them as direct children instead, and flag\n // the shell's end padding manually so the layout matches an\n // `endSlot`.\n classNames={{ root: classNames?.root }}\n className=\"pe-0! overflow-clip\"\n {...props({ \"data-with-end-slot\": !hideControls || canClear || suffix != null })}\n >\n {/* The shell's own `gap-*` (`shellGap`) is meant for *slots* — spacing the\n * control away from icons/steppers/clear button — not for the suffix, which is\n * documented (and used, e.g. `TimeRow`'s \"23h\") to sit glued right against the\n * value. Wrapping the two together in their own `gap`-less flex row keeps that\n * glued pairing regardless of `size`, while the shell's real gap still applies\n * between this pair and the next sibling (clear button / steppers). */}\n <div className=\"flex min-w-0 flex-1 items-center\">\n <NumberInputField\n ref={mergeRefs(inputRef, ref)}\n placeholder={placeholder}\n onBlur={onBlur}\n testId={testId}\n cycle={cycle}\n className={cn(inputControlClasses, classNames?.input)}\n />\n {suffix != null && (\n <span aria-hidden className={cn(inputSlot, \"select-none\")}>\n {suffix}\n </span>\n )}\n </div>\n {canClear && (\n <button\n type=\"button\"\n aria-label=\"Clear value\"\n aria-hidden={!showClear}\n tabIndex={showClear ? 0 : -1}\n onPointerDown={(event) => event.preventDefault()}\n onClick={() => api.clearValue()}\n className={cn(popoverClearTrigger, !showClear && \"invisible\")}\n >\n <CloseIcon />\n </button>\n )}\n {!hideControls && (\n <Ark.Control className={cn(\"-my-1 flex flex-col\", classNames?.control)}>\n <Ark.IncrementTrigger\n aria-label=\"Increment\"\n disabled={!wrap && !!(max !== undefined && (value ?? 0) >= max)}\n {...props({\n \"data-disabled\": !wrap && !!(max !== undefined && (value ?? 0) >= max),\n })}\n className={cn(\n \"inline-flex shrink-0 items-center justify-center\",\n \"h-1/2 cursor-pointer w-6 dark:[&:hover:not([data-disabled])]:bg-gray-dark-800 [&:hover:not([data-disabled])]:bg-gray-light-300 transition-colors rounded-xxs\",\n \"data-disabled:cursor-not-allowed data-disabled:text-current/20\",\n )}\n >\n <ChevronUp />\n </Ark.IncrementTrigger>\n <Ark.DecrementTrigger\n aria-label=\"Decrement\"\n disabled={!wrap && !!(min !== undefined && (value ?? 0) <= min)}\n {...props({\n \"data-disabled\": !wrap && !!(min !== undefined && (value ?? 0) <= min),\n })}\n className={cn(\n \"inline-flex shrink-0 items-center justify-center\",\n \"h-1/2 cursor-pointer w-6 dark:[&:hover:not([data-disabled])]:bg-gray-dark-800 [&:hover:not([data-disabled])]:bg-gray-light-300 transition-colors rounded-xxs\",\n \"data-disabled:cursor-not-allowed data-disabled:text-gray-light-500 dark:data-disabled:text-gray-dark-600\",\n )}\n >\n <ChevronDown />\n </Ark.DecrementTrigger>\n </Ark.Control>\n )}\n </InputBase>\n )\n }}\n </Ark.Context>\n </Ark.Root>\n </FieldShell>\n )\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useLayerGuard, OverlayLayerProvider } from './chunk-AIQG7IIT.js';
|
|
2
2
|
import { OverlayContainerProvider } from './chunk-7P32XCEU.js';
|
|
3
|
-
import { ActionIcon } from './chunk-
|
|
3
|
+
import { ActionIcon } from './chunk-S7N4LGLZ.js';
|
|
4
4
|
import { props } from './chunk-WYCMIIRR.js';
|
|
5
5
|
import { cn } from './chunk-QP4I37PA.js';
|
|
6
6
|
import { Drawer as Drawer$1 } from '@ark-ui/react/drawer';
|
|
@@ -56,7 +56,7 @@ var drawerPositioner = cva(
|
|
|
56
56
|
defaultVariants: { placement: "end" }
|
|
57
57
|
}
|
|
58
58
|
);
|
|
59
|
-
var DrawerPositioner = ({ children, ...rest }) => {
|
|
59
|
+
var DrawerPositioner = ({ children, asChild: _asChild, ...rest }) => {
|
|
60
60
|
const positioner = useRef(null);
|
|
61
61
|
return /* @__PURE__ */ jsx(Drawer$1.Positioner, { ref: positioner, ...rest, children: /* @__PURE__ */ jsx(OverlayContainerProvider, { value: positioner, children }) });
|
|
62
62
|
};
|
|
@@ -104,22 +104,42 @@ var DrawerDescription = ({ className, testId, ...rest }) => /* @__PURE__ */ jsx(
|
|
|
104
104
|
var DrawerCloseTrigger = ({
|
|
105
105
|
children,
|
|
106
106
|
className,
|
|
107
|
-
"aria-label": ariaLabel
|
|
107
|
+
"aria-label": ariaLabel,
|
|
108
108
|
testId,
|
|
109
|
+
asChild,
|
|
109
110
|
...rest
|
|
110
|
-
}) =>
|
|
111
|
+
}) => asChild ? (
|
|
112
|
+
// The consumer's element (a "Cancel" button, say) replaces the kit's icon
|
|
113
|
+
// button outright, rather than nesting inside it.
|
|
114
|
+
/* @__PURE__ */ jsx(
|
|
115
|
+
Drawer$1.CloseTrigger,
|
|
116
|
+
{
|
|
117
|
+
asChild: true,
|
|
118
|
+
"aria-label": ariaLabel,
|
|
119
|
+
className,
|
|
120
|
+
...props({ "data-testid": testId }),
|
|
121
|
+
...rest,
|
|
122
|
+
children
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
) : /* @__PURE__ */ jsx(Drawer$1.CloseTrigger, { asChild: true, ...rest, children: /* @__PURE__ */ jsx(
|
|
111
126
|
ActionIcon,
|
|
112
127
|
{
|
|
113
128
|
variant: "subtle",
|
|
114
129
|
color: "neutral",
|
|
115
130
|
size: "sm",
|
|
116
|
-
"aria-label": ariaLabel,
|
|
131
|
+
"aria-label": ariaLabel ?? "Close",
|
|
117
132
|
className,
|
|
118
133
|
testId,
|
|
119
134
|
children: children ?? /* @__PURE__ */ jsx(X, {})
|
|
120
135
|
}
|
|
121
136
|
) });
|
|
122
|
-
var DrawerGrabber = ({
|
|
137
|
+
var DrawerGrabber = ({
|
|
138
|
+
className,
|
|
139
|
+
testId,
|
|
140
|
+
asChild: _asChild,
|
|
141
|
+
...rest
|
|
142
|
+
}) => /* @__PURE__ */ jsx(
|
|
123
143
|
Drawer$1.Grabber,
|
|
124
144
|
{
|
|
125
145
|
className: cn(
|
|
@@ -260,5 +280,5 @@ Drawer.Body = DrawerBody;
|
|
|
260
280
|
Drawer.Footer = DrawerFooter;
|
|
261
281
|
|
|
262
282
|
export { Drawer, DrawerBackdrop, DrawerBody, DrawerCloseTrigger, DrawerContext, DrawerDescription, DrawerFooter, DrawerGrabber, DrawerHeader, DrawerRoot, DrawerTitle, DrawerTrigger };
|
|
263
|
-
//# sourceMappingURL=chunk-
|
|
264
|
-
//# sourceMappingURL=chunk-
|
|
283
|
+
//# sourceMappingURL=chunk-HAQJQFE6.js.map
|
|
284
|
+
//# sourceMappingURL=chunk-HAQJQFE6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/drawer/drawer.tsx"],"names":["Ark"],"mappings":";;;;;;;;;;;;AAiCA,IAAM,kBAAA,GAAqB;AAAA,EACzB,KAAA,EAAO,OAAA;AAAA,EACP,GAAA,EAAK,KAAA;AAAA,EACL,GAAA,EAAK,IAAA;AAAA,EACL,MAAA,EAAQ;AACV,CAAA;AAEA,IAAM,QAAA,GAAW,CAAC,CAAA,KAAuB,CAAA,KAAM,WAAW,CAAA,KAAM,KAAA;AAGhE,IAAM,WAAA,GAAoC;AAAA,EACxC,EAAA,EAAI,WAAA;AAAA,EACJ,EAAA,EAAI,WAAA;AAAA,EACJ,EAAA,EAAI,WAAA;AAAA,EACJ,EAAA,EAAI,WAAA;AAAA,EACJ,EAAA,EAAI;AACN,CAAA;AACA,IAAM,UAAA,GAAmC;AAAA,EACvC,EAAA,EAAI,WAAA;AAAA,EACJ,EAAA,EAAI,WAAA;AAAA,EACJ,EAAA,EAAI,WAAA;AAAA,EACJ,EAAA,EAAI,WAAA;AAAA,EACJ,EAAA,EAAI;AACN,CAAA;AAEA,IAAM,OAAA,GAAgC;AAAA,EACpC,EAAA,EAAI,SAAA;AAAA,EACJ,EAAA,EAAI,MAAA;AAAA,EACJ,EAAA,EAAI,SAAA;AAAA,EACJ,EAAA,EAAI,QAAA;AAAA,EACJ,EAAA,EAAI;AACN,CAAA;AAEA,IAAM,iBAAiB,GAAA,CAAI;AAAA,EACzB,8FAAA;AAAA,EACA;AACF,CAAC,CAAA;AAED,IAAM,gBAAA,GAAmB,GAAA;AAAA,EACvB,sEAAA;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,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ui/react/portal\"\nimport { cva } from \"class-variance-authority\"\nimport { X } from \"lucide-react\"\nimport { type ComponentPropsWithoutRef, type ReactNode, useRef } from \"react\"\nimport type { NoAsChild } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport { OverlayContainerProvider } from \"../../lib/overlay-container\"\nimport { OverlayLayerProvider, useLayerGuard } from \"../../lib/overlay-layer\"\nimport { props } from \"../../lib/props\"\nimport type { Size } from \"../../lib/sizes\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { ActionIcon } from \"../action-icon/action-icon\"\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` prop (Ark has none) by writing `data-placement` on the positioner\n * + content and deriving Ark's logical `swipeDirection`. Docking, sizing and\n * the slide animation are pure CSS keyed on `[data-placement]` (see\n * `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\nconst isInline = (p: DrawerPlacement) => p === \"start\" || p === \"end\"\n\n/** Inline placements size on width; block placements size on height. */\nconst INLINE_SIZE: Record<Size, string> = {\n xs: \"w-[18rem]\",\n sm: \"w-[22rem]\",\n md: \"w-[28rem]\",\n lg: \"w-[34rem]\",\n xl: \"w-[42rem]\",\n}\nconst BLOCK_SIZE: Record<Size, string> = {\n xs: \"h-[30dvh]\",\n sm: \"h-[40dvh]\",\n md: \"h-[55dvh]\",\n lg: \"h-[70dvh]\",\n xl: \"h-[85dvh]\",\n}\n\nconst PADDING: Record<Size, string> = {\n xs: \"0.75rem\",\n sm: \"1rem\",\n md: \"1.25rem\",\n lg: \"1.5rem\",\n xl: \"2rem\",\n}\n\nconst drawerBackdrop = cva([\n \"fixed inset-0 z-[calc(var(--modal-z,150)+var(--layer-index,0))] bg-black/50 backdrop-blur-lg\",\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\",\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\n/** Publishes itself as the portal target for any overlay opened inside the\n * drawer, so a Menu/Select/DatePicker in a drawer body stays above the panel\n * instead of behind it. See `lib/overlay-container.tsx`. */\nconst DrawerPositioner = ({ children, asChild: _asChild, ...rest }: DrawerPositionerProps) => {\n const positioner = useRef<HTMLDivElement>(null)\n return (\n <Ark.Positioner ref={positioner} {...rest}>\n <OverlayContainerProvider value={positioner}>{children}</OverlayContainerProvider>\n </Ark.Positioner>\n )\n}\n\nconst drawerContent = cva([\n \"relative flex flex-col overflow-hidden\",\n \"bg-brand-50 text-gray-light-900 shadow-2xl\",\n \"dark:bg-brand-950 dark:text-gray-dark-25\",\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// ---------------------------------------------------------------------------\n// Low-level parts\n// ---------------------------------------------------------------------------\n\nexport type DrawerRootProps = ComponentPropsWithoutRef<typeof Ark.Root>\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. See `lib/overlay-layer.tsx`. */\nexport const DrawerRoot = ({ onPointerDownOutside, children, ...rest }: DrawerRootProps) => {\n const guard = useLayerGuard(onPointerDownOutside)\n return (\n <Ark.Root onPointerDownOutside={guard.onPointerDownOutside} {...rest}>\n <OverlayLayerProvider value={guard.layers}>{children}</OverlayLayerProvider>\n </Ark.Root>\n )\n}\nexport const DrawerTrigger = Ark.Trigger\nexport const DrawerContext = Ark.Context\n\nexport type DrawerBackdropProps = ComponentPropsWithoutRef<typeof Ark.Backdrop> & WithTestId\n\nexport const 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\nexport const DrawerTitle = ({ className, testId, ...rest }: DrawerTitleProps) => (\n <Ark.Title\n className={cn(\"text-lg font-semibold leading-tight\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type DrawerDescriptionProps = ComponentPropsWithoutRef<typeof Ark.Description> & WithTestId\n\nexport const DrawerDescription = ({ className, testId, ...rest }: DrawerDescriptionProps) => (\n <Ark.Description\n className={cn(\"text-sm text-gray-light-500 dark:text-gray-dark-400\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type DrawerCloseTriggerProps = ComponentPropsWithoutRef<typeof Ark.CloseTrigger> &\n WithTestId & {\n \"aria-label\"?: string\n }\n\nexport const DrawerCloseTrigger = ({\n children,\n className,\n \"aria-label\": ariaLabel,\n testId,\n asChild,\n ...rest\n}: DrawerCloseTriggerProps) =>\n asChild ? (\n // The consumer's element (a \"Cancel\" button, say) replaces the kit's icon\n // button outright, rather than nesting inside it.\n <Ark.CloseTrigger\n asChild\n aria-label={ariaLabel}\n className={className}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {children}\n </Ark.CloseTrigger>\n ) : (\n <Ark.CloseTrigger asChild {...rest}>\n <ActionIcon\n variant=\"subtle\"\n color=\"neutral\"\n size=\"sm\"\n aria-label={ariaLabel ?? \"Close\"}\n className={className}\n testId={testId}\n >\n {children ?? <X />}\n </ActionIcon>\n </Ark.CloseTrigger>\n )\n\nexport type DrawerGrabberProps = NoAsChild<ComponentPropsWithoutRef<typeof Ark.Grabber>> &\n WithTestId\n\nexport const DrawerGrabber = ({\n className,\n testId,\n asChild: _asChild,\n ...rest\n}: 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-gray-light-300 dark:bg-gray-dark-700\" />\n </Ark.Grabber>\n)\n\nexport type DrawerHeaderProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\nexport const DrawerHeader = ({ className, testId, ...rest }: DrawerHeaderProps) => (\n <div\n className={cn(\n \"flex items-start justify-between gap-4 px-(--drawer-px,1.25rem) pt-(--drawer-px,1.25rem) pb-3\",\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type DrawerBodyProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\nexport const DrawerBody = ({ className, testId, ...rest }: DrawerBodyProps) => (\n <div\n className={cn(\"flex-1 overflow-y-auto px-(--drawer-px,1.25rem) py-1\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type DrawerFooterProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\nexport const DrawerFooter = ({ className, testId, ...rest }: DrawerFooterProps) => (\n <div\n className={cn(\n \"flex items-center justify-end gap-2 px-(--drawer-px,1.25rem) pb-(--drawer-px,1.25rem) pt-4\",\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\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\"\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 size?: Size\n title?: ReactNode\n description?: ReactNode\n /** Render the default close button in the header. @default true */\n withCloseButton?: 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 closeOnInteractOutside?: boolean\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 }\n\nexport const Drawer = ({\n open,\n defaultOpen,\n onOpenChange,\n onClose,\n placement = \"end\",\n size = \"md\",\n title,\n description,\n withCloseButton = true,\n withGrabber = false,\n withBackdrop = true,\n padding = \"md\",\n closeOnEscape,\n closeOnInteractOutside,\n onExitComplete,\n container,\n children,\n className,\n classNames,\n testId,\n ...rest\n}: DrawerProps) => {\n const hasHeader = title != null || description != null || withCloseButton\n const sizeClass = isInline(placement)\n ? `${INLINE_SIZE[size]} h-full max-w-[90vw]`\n : `${BLOCK_SIZE[size]} w-full max-h-[90dvh]`\n\n return (\n <DrawerRoot\n open={open}\n defaultOpen={defaultOpen}\n onOpenChange={({ open: next }) => {\n onOpenChange?.(next)\n if (!next) onClose?.()\n }}\n swipeDirection={PLACEMENT_TO_SWIPE[placement]}\n closeOnEscape={closeOnEscape}\n closeOnInteractOutside={closeOnInteractOutside}\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 {...rest}\n >\n <Portal container={container ? { current: container } : undefined}>\n {withBackdrop && <DrawerBackdrop className={classNames?.backdrop} />}\n <DrawerPositioner\n data-placement={placement}\n className={cn(drawerPositioner({ placement }), classNames?.positioner)}\n >\n <Ark.Content\n data-placement={placement}\n style={{ [\"--drawer-px\" as string]: PADDING[padding] }}\n className={cn(drawerContent(), sizeClass, className, classNames?.content)}\n {...props({ \"data-testid\": testId })}\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 && <DrawerCloseTrigger className={classNames?.closeButton} />}\n </DrawerHeader>\n )}\n <DrawerBody\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 </Ark.Content>\n </DrawerPositioner>\n </Portal>\n </DrawerRoot>\n )\n}\n\nDrawer.Root = DrawerRoot\nDrawer.Trigger = DrawerTrigger\nDrawer.Context = DrawerContext\nDrawer.Backdrop = DrawerBackdrop\nDrawer.Positioner = DrawerPositioner\nDrawer.Title = DrawerTitle\nDrawer.Description = DrawerDescription\nDrawer.CloseTrigger = DrawerCloseTrigger\nDrawer.Grabber = DrawerGrabber\nDrawer.Header = DrawerHeader\nDrawer.Body = DrawerBody\nDrawer.Footer = DrawerFooter\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { normalizeSelectData, filterSelectData } from './chunk-TWGCWKRV.js';
|
|
2
|
-
import { Combobox } from './chunk-
|
|
3
|
-
import { inputSlot, inputControlClasses, inputShell } from './chunk-
|
|
4
|
-
import { FieldShell } from './chunk-
|
|
5
|
-
import { popoverClearTrigger, popoverCheckbox } from './chunk-
|
|
2
|
+
import { Combobox } from './chunk-6OLTJYSX.js';
|
|
3
|
+
import { inputSlot, inputControlClasses, inputShell } from './chunk-5OQLFX47.js';
|
|
4
|
+
import { FieldShell } from './chunk-FHG54IT5.js';
|
|
5
|
+
import { popoverClearTrigger, popoverCheckbox } from './chunk-6GDMSENK.js';
|
|
6
6
|
import { useUncontrolled } from './chunk-BEL75C7N.js';
|
|
7
7
|
import { CloseIcon, CheckIcon } from './chunk-IG7FBZVM.js';
|
|
8
8
|
import { props } from './chunk-WYCMIIRR.js';
|
|
@@ -163,5 +163,5 @@ var MultiComboboxList = ({
|
|
|
163
163
|
};
|
|
164
164
|
|
|
165
165
|
export { MultiComboboxList };
|
|
166
|
-
//# sourceMappingURL=chunk-
|
|
167
|
-
//# sourceMappingURL=chunk-
|
|
166
|
+
//# sourceMappingURL=chunk-HT5JAHR3.js.map
|
|
167
|
+
//# sourceMappingURL=chunk-HT5JAHR3.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/multi-combobox-list/multi-combobox-list.tsx"],"names":["ArkCombobox"],"mappings":";;;;;;;;;;;;;;AAgHO,IAAM,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,EAAA,KAAA,EAAM;AAAA,SAAA,EAC3C,CAAA;AAAA,QAMC,IAAA,IAAQ,IAAA,IAAQ,KAAA,CAAM,GAAA,CAAI,CAAC,CAAA,qBAAM,GAAA,CAAC,OAAA,EAAA,EAAc,IAAA,EAAK,QAAA,EAAS,IAAA,EAAY,KAAA,EAAO,CAAA,EAAA,EAApC,CAAuC,CAAE;AAAA;AAAA;AAAA,GACzF;AAGF,EAAA,uBACE,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,KAAA;AAAA,MACA,WAAA;AAAA,MACA,KAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,IAAA;AAAA,MACA,WAAW,UAAA,EAAY,KAAA;AAAA,MAEtB,QAAA,EAAA;AAAA;AAAA,GACH;AAEJ","file":"chunk-IHYFYMHJ.js","sourcesContent":["\"use client\"\n\nimport { Combobox as ArkCombobox } from \"@ark-ui/react/combobox\"\nimport { SearchIcon } from \"lucide-react\"\nimport { type FocusEvent, type ReactNode, type Ref, useMemo, useState } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { props } from \"../../lib/props\"\nimport {\n filterSelectData,\n type NormalizedItem,\n normalizeSelectData,\n type RenderableItem,\n type RenderItem,\n type SelectData,\n type SelectValue,\n} from \"../../lib/select-data\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { useUncontrolled } from \"../../lib/use-uncontrolled\"\nimport { Combobox } from \"../combobox/combobox\"\nimport { type FieldProps, FieldShell } from \"../field/field\"\nimport {\n type InputSize,\n type InputVariant,\n inputControlClasses,\n inputShell,\n inputSlot,\n} from \"../input/input\"\nimport { CheckIcon, CloseIcon } from \"../popover/icons\"\nimport { popoverCheckbox, popoverClearTrigger } from \"../popover/popover\"\n\n/**\n * MultiComboboxList — a searchable, multi-value option list with no trigger of\n * its own. Same idea as [`ComboboxList`](/docs/combobox-list) but for several\n * values at once: every option shows a checkbox instead of a single check\n * mark, and picking one doesn't close the list. It renders permanently open —\n * embed it inline inside a container you already control the visibility of\n * (a `Popover`, a `Drawer`, a custom panel).\n *\n * - `data` / `value` / `onChange` match [`MultiSelect`](/docs/multi-select)\n * exactly (`SelectValue<Data>[]`) — but options render as a checkbox list\n * rather than pills in the input, which is lighter in a compact popover.\n * - Type to filter; `clearable` clears every value at once; `maxValues` caps\n * the selection; `hidePickedOptions` drops chosen options from the list.\n * - Label / description / error come from the built-in `Field`, same as the\n * rest of the family — omit them when embedding inside your own popover.\n */\n\ntype MultiComboboxListClassNames = {\n /** The field wrapper (label / description / error). */\n field?: string\n /** The search row (also targeted by `className`). */\n search?: string\n /** The search `<input>`. */\n input?: string\n /** A single option row. */\n option?: string\n /** The checkbox indicator inside an option row. */\n checkbox?: string\n /** The scrollable option list. */\n list?: string\n}\n\nexport type MultiComboboxListProps<Data extends SelectData = SelectData> = Pick<\n FieldProps,\n \"label\" | \"description\" | \"error\" | \"required\"\n> &\n WithTestId & {\n /** Options: `string[]`, `{ value, label?, disabled? }[]`, or `{ group, items }[]`. */\n data: Data\n /** Controlled selected values. */\n value?: SelectValue<Data>[]\n /** Uncontrolled initial selection. */\n defaultValue?: SelectValue<Data>[]\n /** Fires with the full selection on every add / remove. */\n onChange?: (value: SelectValue<Data>[]) => void\n /**\n * Render each option yourself. Receives the (value-narrowed) item and its live\n * `{ selected, highlighted }` state; you own the whole row, including the\n * checkbox affordance. Omit it to render the checkbox + label.\n */\n renderItem?: RenderItem<Data>\n /** Placeholder for the search field. */\n placeholder?: string\n /** Message shown when no option matches. Pass `null` to render nothing. */\n empty?: ReactNode\n /** Show a button that clears every value at once. */\n clearable?: boolean\n /** Cap the number of selected values. */\n maxValues?: number\n /** Hide options that are already selected. */\n hidePickedOptions?: boolean\n size?: InputSize\n /**\n * Search row treatment. Defaults to `\"unstyled\"` (no border/background) since\n * this is normally embedded inside a container that already draws its own\n * chrome; pass `\"default\"` / `\"filled\"` when using it standalone.\n */\n variant?: InputVariant\n disabled?: boolean\n readOnly?: boolean\n /** Red invalid state, independent of (and OR'd with) `error`. */\n invalid?: boolean\n /** Name for native form submission (one hidden input per value). */\n name?: string\n /** Forwarded to the search input; drives touched/blurred validation. */\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void\n /** Lands on the focusable search `<input>` for focus-on-error. */\n ref?: Ref<HTMLInputElement>\n className?: string\n classNames?: MultiComboboxListClassNames\n }\n\nexport const MultiComboboxList = <const Data extends SelectData = SelectData>({\n data,\n value: valueProp,\n defaultValue,\n onChange,\n renderItem,\n placeholder = \"Search…\",\n empty = \"Nothing found\",\n clearable,\n maxValues,\n hidePickedOptions,\n size = \"md\",\n variant = \"unstyled\",\n disabled,\n readOnly,\n required,\n invalid,\n name,\n onBlur,\n ref,\n label,\n description,\n error,\n className,\n classNames,\n testId,\n}: MultiComboboxListProps<Data>) => {\n type Item = SelectValue<Data>\n\n // Red state is driven independently of the `Field` error slot so a form\n // library can flip it from `fieldState.invalid` (see FormControlProps).\n const isInvalid = invalid || error != null\n\n const [value, setSelected] = useUncontrolled<Item[]>({\n value: valueProp,\n defaultValue: defaultValue ?? [],\n onChange,\n })\n const [search, setSearch] = useState(\"\")\n\n const setValues = (next: Item[]) => {\n // Adding past the cap is rejected; removals always pass.\n if (maxValues != null && next.length > value.length && next.length > maxValues) {\n return\n }\n setSelected(next)\n }\n\n // Normalize once per `data`; only the filter re-runs as the query/selection changes.\n const normalized = useMemo(() => normalizeSelectData(data), [data])\n const { collection, items, groups } = useMemo(() => {\n const q = search.trim().toLowerCase()\n const picked = new Set<string>(value)\n return filterSelectData(\n normalized,\n (item) =>\n (!hidePickedOptions || !picked.has(item.value)) &&\n (q === \"\" || item.label.toLowerCase().includes(q)),\n )\n }, [normalized, search, hidePickedOptions, value])\n\n // `canClear` reserves the clear button's box (and the shell's end-slot\n // padding) for the whole time the field is clearable, not just while it\n // has a value — otherwise the button mounting/unmounting shifts the\n // search input's width. `showClear` only toggles visibility/interactivity.\n const canClear = Boolean(clearable) && !disabled && !readOnly\n const showClear = canClear && ((value != null && value.length > 0) || search.length > 0)\n\n const renderOption = (item: NormalizedItem) => (\n <Combobox.Item\n key={item.value}\n item={item}\n data-testid={item.testId}\n className={cn(\"group/item\", classNames?.option)}\n >\n {(state) =>\n renderItem ? (\n renderItem(item as unknown as RenderableItem<Data>, state)\n ) : (\n <>\n <span aria-hidden className={cn(popoverCheckbox({ size }), classNames?.checkbox)}>\n <ArkCombobox.ItemIndicator>\n <CheckIcon />\n </ArkCombobox.ItemIndicator>\n </span>\n <span className=\"min-w-0 flex-1 truncate\">{item.label}</span>\n </>\n )\n }\n </Combobox.Item>\n )\n\n const control = (\n <Combobox.Root<NormalizedItem>\n multiple\n collection={collection}\n value={value}\n // Ark types the values as `string[]`; they always originate from `data`,\n // so narrow them back to the caller's value union.\n onValueChange={(details) => setValues(details.value as Item[])}\n inputValue={search}\n onInputValueChange={(details) => setSearch(details.inputValue)}\n selectionBehavior=\"clear\"\n // There's no trigger to open it — the caller (e.g. a `Popover`) already\n // owns whether this mounts at all, so keep the machine permanently open.\n open\n onOpenChange={() => {}}\n // The caller's own container (Popover, Drawer, …) already owns\n // dismiss-on-outside-click; without this the always-open machine\n // registers its own (functionally inert, since `onOpenChange` is a\n // no-op) listbox dismissable layer, which logs a spurious\n // \"[@zag-js/dismissable] node is `null` or `undefined`\" warning.\n disableLayer\n closeOnSelect={false}\n autoFocus\n disabled={disabled}\n readOnly={readOnly}\n size={size}\n variant={variant}\n className={className}\n >\n <div\n {...props({ \"data-invalid\": isInvalid, \"data-with-end-slot\": canClear })}\n className={cn(\n inputShell({ size, variant }),\n \"rounded-none border-t-0 border-e-0 border-s-0 border-b border-brand-900/20 dark:border-white/15\",\n classNames?.search,\n )}\n >\n <span className={inputSlot} aria-hidden>\n <SearchIcon />\n </span>\n {/* Ark's own Input (a forwardRef) so the caller's `ref` lands on the\n real focusable `<input>` for RHF focus-on-error; the kit's\n `Combobox.Input` wrapper only adds `inputControlClasses`, replicated\n here. `name` is intentionally NOT here — it would submit the typed\n search text, not the selection (see the hidden inputs below). */}\n <ArkCombobox.Input\n placeholder={placeholder}\n onBlur={onBlur}\n ref={ref}\n aria-invalid={isInvalid || undefined}\n {...props({ \"data-testid\": testId })}\n className={cn(inputControlClasses, classNames?.input)}\n />\n {canClear && (\n <button\n type=\"button\"\n aria-label=\"Clear value\"\n aria-hidden={!showClear}\n tabIndex={showClear ? 0 : -1}\n onPointerDown={(event) => event.preventDefault()}\n onClick={() => {\n setValues([])\n setSearch(\"\")\n }}\n className={cn(popoverClearTrigger, !showClear && \"invisible\")}\n >\n <CloseIcon />\n </button>\n )}\n </div>\n\n <Combobox.Panel className={classNames?.list}>\n {groups\n ? groups.map((group) => (\n <Combobox.Group key={group.group} label={group.group}>\n {group.items.map(renderOption)}\n </Combobox.Group>\n ))\n : items.map(renderOption)}\n {empty != null && <Combobox.Empty>{empty}</Combobox.Empty>}\n </Combobox.Panel>\n\n {/* Hidden inputs carry the real selection so a native `<form>` submits\n the value array (the search input is unnamed). When controlled by a\n form library the value flows through `onChange` instead, and these\n are just submitted alongside it. */}\n {name != null && value.map((v) => <input key={v} type=\"hidden\" name={name} value={v} />)}\n </Combobox.Root>\n )\n\n return (\n <FieldShell\n label={label}\n description={description}\n error={error}\n required={required}\n disabled={disabled}\n size={size}\n className={classNames?.field}\n >\n {control}\n </FieldShell>\n )\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/multi-combobox-list/multi-combobox-list.tsx"],"names":["ArkCombobox"],"mappings":";;;;;;;;;;;;;;AAgHO,IAAM,oBAAoB,CAA6C;AAAA,EAC5E,IAAA;AAAA,EACA,KAAA,EAAO,SAAA;AAAA,EACP,YAAA;AAAA,EACA,QAAA;AAAA,EACA,UAAA;AAAA,EACA,WAAA,GAAc,cAAA;AAAA,EACd,KAAA,GAAQ,eAAA;AAAA,EACR,SAAA;AAAA,EACA,SAAA;AAAA,EACA,iBAAA;AAAA,EACA,IAAA,GAAO,IAAA;AAAA,EACP,OAAA,GAAU,UAAA;AAAA,EACV,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C,UAAA;AAAA,IAAA;AAAA,MACC,KAAA;AAAA,MACA,WAAA;AAAA,MACA,KAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,IAAA;AAAA,MACA,WAAW,UAAA,EAAY,KAAA;AAAA,MAEtB,QAAA,EAAA;AAAA;AAAA,GACH;AAEJ","file":"chunk-HT5JAHR3.js","sourcesContent":["\"use client\"\n\nimport { Combobox as ArkCombobox } from \"@ark-ui/react/combobox\"\nimport { SearchIcon } from \"lucide-react\"\nimport { type FocusEvent, type ReactNode, type Ref, useMemo, useState } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { props } from \"../../lib/props\"\nimport {\n filterSelectData,\n type NormalizedItem,\n normalizeSelectData,\n type RenderableItem,\n type RenderItem,\n type SelectData,\n type SelectValue,\n} from \"../../lib/select-data\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { useUncontrolled } from \"../../lib/use-uncontrolled\"\nimport { Combobox } from \"../combobox/combobox\"\nimport { type FieldProps, FieldShell } from \"../field/field\"\nimport {\n type InputSize,\n type InputVariant,\n inputControlClasses,\n inputShell,\n inputSlot,\n} from \"../input/input\"\nimport { CheckIcon, CloseIcon } from \"../popover/icons\"\nimport { popoverCheckbox, popoverClearTrigger } from \"../popover/popover\"\n\n/**\n * MultiComboboxList — a searchable, multi-value option list with no trigger of\n * its own. Same idea as [`ComboboxList`](/docs/combobox-list) but for several\n * values at once: every option shows a checkbox instead of a single check\n * mark, and picking one doesn't close the list. It renders permanently open —\n * embed it inline inside a container you already control the visibility of\n * (a `Popover`, a `Drawer`, a custom panel).\n *\n * - `data` / `value` / `onChange` match [`MultiSelect`](/docs/multi-select)\n * exactly (`SelectValue<Data>[]`) — but options render as a checkbox list\n * rather than pills in the input, which is lighter in a compact popover.\n * - Type to filter; `clearable` clears every value at once; `maxValues` caps\n * the selection; `hidePickedOptions` drops chosen options from the list.\n * - Label / description / error come from the built-in `Field`, same as the\n * rest of the family — omit them when embedding inside your own popover.\n */\n\ntype MultiComboboxListClassNames = {\n /** The field wrapper (label / description / error). */\n field?: string\n /** The search row (also targeted by `className`). */\n search?: string\n /** The search `<input>`. */\n input?: string\n /** A single option row. */\n option?: string\n /** The checkbox indicator inside an option row. */\n checkbox?: string\n /** The scrollable option list. */\n list?: string\n}\n\nexport type MultiComboboxListProps<Data extends SelectData = SelectData> = Pick<\n FieldProps,\n \"label\" | \"description\" | \"error\" | \"required\"\n> &\n WithTestId & {\n /** Options: `string[]`, `{ value, label?, disabled? }[]`, or `{ group, items }[]`. */\n data: Data\n /** Controlled selected values. */\n value?: SelectValue<Data>[]\n /** Uncontrolled initial selection. */\n defaultValue?: SelectValue<Data>[]\n /** Fires with the full selection on every add / remove. */\n onChange?: (value: SelectValue<Data>[]) => void\n /**\n * Render each option yourself. Receives the (value-narrowed) item and its live\n * `{ selected, highlighted }` state; you own the whole row, including the\n * checkbox affordance. Omit it to render the checkbox + label.\n */\n renderItem?: RenderItem<Data>\n /** Placeholder for the search field. */\n placeholder?: string\n /** Message shown when no option matches. Pass `null` to render nothing. */\n empty?: ReactNode\n /** Show a button that clears every value at once. */\n clearable?: boolean\n /** Cap the number of selected values. */\n maxValues?: number\n /** Hide options that are already selected. */\n hidePickedOptions?: boolean\n size?: InputSize\n /**\n * Search row treatment. Defaults to `\"unstyled\"` (no border/background) since\n * this is normally embedded inside a container that already draws its own\n * chrome; pass `\"default\"` / `\"filled\"` when using it standalone.\n */\n variant?: InputVariant\n disabled?: boolean\n readOnly?: boolean\n /** Red invalid state, independent of (and OR'd with) `error`. */\n invalid?: boolean\n /** Name for native form submission (one hidden input per value). */\n name?: string\n /** Forwarded to the search input; drives touched/blurred validation. */\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void\n /** Lands on the focusable search `<input>` for focus-on-error. */\n ref?: Ref<HTMLInputElement>\n className?: string\n classNames?: MultiComboboxListClassNames\n }\n\nexport const MultiComboboxList = <const Data extends SelectData = SelectData>({\n data,\n value: valueProp,\n defaultValue,\n onChange,\n renderItem,\n placeholder = \"Search…\",\n empty = \"Nothing found\",\n clearable,\n maxValues,\n hidePickedOptions,\n size = \"md\",\n variant = \"unstyled\",\n disabled,\n readOnly,\n required,\n invalid,\n name,\n onBlur,\n ref,\n label,\n description,\n error,\n className,\n classNames,\n testId,\n}: MultiComboboxListProps<Data>) => {\n type Item = SelectValue<Data>\n\n // Red state is driven independently of the `Field` error slot so a form\n // library can flip it from `fieldState.invalid` (see FormControlProps).\n const isInvalid = invalid || error != null\n\n const [value, setSelected] = useUncontrolled<Item[]>({\n value: valueProp,\n defaultValue: defaultValue ?? [],\n onChange,\n })\n const [search, setSearch] = useState(\"\")\n\n const setValues = (next: Item[]) => {\n // Adding past the cap is rejected; removals always pass.\n if (maxValues != null && next.length > value.length && next.length > maxValues) {\n return\n }\n setSelected(next)\n }\n\n // Normalize once per `data`; only the filter re-runs as the query/selection changes.\n const normalized = useMemo(() => normalizeSelectData(data), [data])\n const { collection, items, groups } = useMemo(() => {\n const q = search.trim().toLowerCase()\n const picked = new Set<string>(value)\n return filterSelectData(\n normalized,\n (item) =>\n (!hidePickedOptions || !picked.has(item.value)) &&\n (q === \"\" || item.label.toLowerCase().includes(q)),\n )\n }, [normalized, search, hidePickedOptions, value])\n\n // `canClear` reserves the clear button's box (and the shell's end-slot\n // padding) for the whole time the field is clearable, not just while it\n // has a value — otherwise the button mounting/unmounting shifts the\n // search input's width. `showClear` only toggles visibility/interactivity.\n const canClear = Boolean(clearable) && !disabled && !readOnly\n const showClear = canClear && ((value != null && value.length > 0) || search.length > 0)\n\n const renderOption = (item: NormalizedItem) => (\n <Combobox.Item\n key={item.value}\n item={item}\n data-testid={item.testId}\n className={cn(\"group/item\", classNames?.option)}\n >\n {(state) =>\n renderItem ? (\n renderItem(item as unknown as RenderableItem<Data>, state)\n ) : (\n <>\n <span aria-hidden className={cn(popoverCheckbox({ size }), classNames?.checkbox)}>\n <ArkCombobox.ItemIndicator>\n <CheckIcon />\n </ArkCombobox.ItemIndicator>\n </span>\n <span className=\"min-w-0 flex-1 truncate\">{item.label}</span>\n </>\n )\n }\n </Combobox.Item>\n )\n\n const control = (\n <Combobox.Root<NormalizedItem>\n multiple\n collection={collection}\n value={value}\n // Ark types the values as `string[]`; they always originate from `data`,\n // so narrow them back to the caller's value union.\n onValueChange={(details) => setValues(details.value as Item[])}\n inputValue={search}\n onInputValueChange={(details) => setSearch(details.inputValue)}\n selectionBehavior=\"clear\"\n // There's no trigger to open it — the caller (e.g. a `Popover`) already\n // owns whether this mounts at all, so keep the machine permanently open.\n open\n onOpenChange={() => {}}\n // The caller's own container (Popover, Drawer, …) already owns\n // dismiss-on-outside-click; without this the always-open machine\n // registers its own (functionally inert, since `onOpenChange` is a\n // no-op) listbox dismissable layer, which logs a spurious\n // \"[@zag-js/dismissable] node is `null` or `undefined`\" warning.\n disableLayer\n closeOnSelect={false}\n autoFocus\n disabled={disabled}\n readOnly={readOnly}\n size={size}\n variant={variant}\n className={className}\n >\n <div\n {...props({ \"data-invalid\": isInvalid, \"data-with-end-slot\": canClear })}\n className={cn(\n inputShell({ size, variant }),\n \"rounded-none border-t-0 border-e-0 border-s-0 border-b border-brand-900/20 dark:border-white/15\",\n classNames?.search,\n )}\n >\n <span className={inputSlot} aria-hidden>\n <SearchIcon />\n </span>\n {/* Ark's own Input (a forwardRef) so the caller's `ref` lands on the\n real focusable `<input>` for RHF focus-on-error; the kit's\n `Combobox.Input` wrapper only adds `inputControlClasses`, replicated\n here. `name` is intentionally NOT here — it would submit the typed\n search text, not the selection (see the hidden inputs below). */}\n <ArkCombobox.Input\n placeholder={placeholder}\n onBlur={onBlur}\n ref={ref}\n aria-invalid={isInvalid || undefined}\n {...props({ \"data-testid\": testId })}\n className={cn(inputControlClasses, classNames?.input)}\n />\n {canClear && (\n <button\n type=\"button\"\n aria-label=\"Clear value\"\n aria-hidden={!showClear}\n tabIndex={showClear ? 0 : -1}\n onPointerDown={(event) => event.preventDefault()}\n onClick={() => {\n setValues([])\n setSearch(\"\")\n }}\n className={cn(popoverClearTrigger, !showClear && \"invisible\")}\n >\n <CloseIcon />\n </button>\n )}\n </div>\n\n <Combobox.Panel className={classNames?.list}>\n {groups\n ? groups.map((group) => (\n <Combobox.Group key={group.group} label={group.group}>\n {group.items.map(renderOption)}\n </Combobox.Group>\n ))\n : items.map(renderOption)}\n {empty != null && <Combobox.Empty>{empty}</Combobox.Empty>}\n </Combobox.Panel>\n\n {/* Hidden inputs carry the real selection so a native `<form>` submits\n the value array (the search input is unnamed). When controlled by a\n form library the value flows through `onChange` instead, and these\n are just submitted alongside it. */}\n {name != null && value.map((v) => <input key={v} type=\"hidden\" name={name} value={v} />)}\n </Combobox.Root>\n )\n\n return (\n <FieldShell\n label={label}\n description={description}\n error={error}\n required={required}\n disabled={disabled}\n size={size}\n className={classNames?.field}\n >\n {control}\n </FieldShell>\n )\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { isValidElement, cloneElement } from 'react';
|
|
2
|
+
|
|
3
|
+
// src/lib/as-child.ts
|
|
4
|
+
var withAsChildContent = (child, render, extra) => {
|
|
5
|
+
if (!isValidElement(child)) return child;
|
|
6
|
+
return cloneElement(child, { ...extra, children: render(child.props.children) });
|
|
7
|
+
};
|
|
8
|
+
var composeChildren = (asChild, children, render) => asChild ? withAsChildContent(children, render) : render(children);
|
|
9
|
+
|
|
10
|
+
export { composeChildren, withAsChildContent };
|
|
11
|
+
//# sourceMappingURL=chunk-I4SQQIP5.js.map
|
|
12
|
+
//# sourceMappingURL=chunk-I4SQQIP5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/as-child.ts"],"names":[],"mappings":";;;AAwDO,IAAM,kBAAA,GAAqB,CAChC,KAAA,EACA,MAAA,EACA,KAAA,KACc;AACd,EAAA,IAAI,CAAC,cAAA,CAAyC,KAAK,CAAA,EAAG,OAAO,KAAA;AAC7D,EAAA,OAAO,YAAA,CAAa,KAAA,EAAO,EAAE,GAAG,KAAA,EAAO,QAAA,EAAU,MAAA,CAAO,KAAA,CAAM,KAAA,CAAM,QAAQ,CAAA,EAAG,CAAA;AACjF;AAcO,IAAM,eAAA,GAAkB,CAC7B,OAAA,EACA,QAAA,EACA,MAAA,KACe,OAAA,GAAU,kBAAA,CAAmB,QAAA,EAAU,MAAM,CAAA,GAAI,MAAA,CAAO,QAAQ","file":"chunk-I4SQQIP5.js","sourcesContent":["import { cloneElement, isValidElement, type ReactNode } from \"react\"\nimport type { UnavailableProps } from \"./available-if\"\n\n/**\n * The two sanctioned ways for a kit part to meet Ark's `asChild`.\n *\n * Ark's factory clones **exactly one** valid element under `asChild` and\n * renders `null` otherwise (`isValidElement(children) ? clone : null`). So a\n * part that renders anything besides a bare `{children}` — an icon, a\n * section, an indicator, a default fallback — breaks in one of two ways:\n *\n * - **It renders nothing.** Two or more JSX child expressions become an\n * array, even when some of them evaluate to `false`\n * (`{start && <Start/>}{children}{end && <End/>}`), and an array is not an\n * element.\n * - **Its own content is lost or misplaced.** Under `asChild`, `children`\n * *is* the consumer's element, so `children ?? <DefaultIcon/>` never\n * reaches the fallback, and a wrapper (`<Provider>{children}</Provider>`)\n * is what gets cloned instead of the consumer's element.\n *\n * Every such part must pick one of these:\n *\n * - **`withAsChildContent`** — the part can sensibly *become* the consumer's\n * element (a menu item rendered as a router `<Link>`, a crumb, an alert\n * that links somewhere). The kit's content is folded into the child's own\n * children, so Ark still receives a single element.\n * - **`NoAsChild`** — the part renders structure that cannot live inside an\n * arbitrary element (a slider's track and thumbs, a scheduler grid). The\n * prop becomes a compile error that says why.\n *\n * `as-child.contract.test.tsx` enforces the choice: it derives every public\n * part that accepts `asChild` from the component entries, renders each one\n * with an `<a>` child, and fails the typecheck when a part is in neither its\n * render table nor `NoAsChild`.\n */\n\n/**\n * Rebuilds the single `asChild` child's own children through `render`, so\n * kit content (sections, icons, spinners) lands *inside* the element Ark\n * clones instead of beside it. `extra` is merged onto the child too, for the\n * odd prop the kit has to own (a click guard while loading).\n *\n * A child that isn't a single element falls through unchanged, leaving\n * Ark's own handling of the misuse as it is.\n *\n * ```tsx\n * <ArkMenu.Item asChild {...rest}>\n * {withAsChildContent(children, (own) => (\n * <>\n * <StartSection>{startSection}</StartSection>\n * {own}\n * </>\n * ))}\n * </ArkMenu.Item>\n * ```\n */\nexport const withAsChildContent = (\n child: ReactNode,\n render: (own: ReactNode) => ReactNode,\n extra?: Record<string, unknown>,\n): ReactNode => {\n if (!isValidElement<{ children?: ReactNode }>(child)) return child\n return cloneElement(child, { ...extra, children: render(child.props.children) })\n}\n\n/**\n * The usual call site: `render` wraps the part's `children` with its own\n * content either way, around `children` normally and inside the consumer's\n * element under `asChild`. One `render` serves both branches, so the two\n * can't drift apart.\n *\n * ```tsx\n * <ArkMenu.Item asChild={asChild} {...rest}>\n * {composeChildren(asChild, children, (own) => <>{icon}{own}</>)}\n * </ArkMenu.Item>\n * ```\n */\nexport const composeChildren = (\n asChild: boolean | undefined,\n children: ReactNode,\n render: (own: ReactNode) => ReactNode,\n): ReactNode => (asChild ? withAsChildContent(children, render) : render(children))\n\n/** The sentence a caller reads when passing `asChild` to a `NoAsChild` part. */\nexport type NoAsChildReason =\n \"renders its own structure around its children, so asChild is not supported\"\n\n/**\n * The forbid shape on its own: `asChild` typed as a branded `Unavailable`.\n * Intersect it beside a props type (`Omit<RootProps, \"children\"> &\n * ForbidAsChild & { data }`); `NoAsChild<P>` is the same thing as a wrapper.\n *\n * Uses the brand rather than omitting the key, because omission is silent\n * on a JSX spread (`<Slider {...props} />`), which is exactly how prop bags\n * get forwarded. Either way the error names the reason:\n *\n * Type 'boolean' is not assignable to type 'Unavailable<\"renders its own\n * structure around its children, so asChild is not supported\">'\n */\nexport type ForbidAsChild = UnavailableProps<{ asChild?: boolean }, NoAsChildReason>\n\n/**\n * `P` with `asChild` forbidden: `P & ForbidAsChild`, so `asChild` resolves\n * to `(boolean & Unavailable<…>) | undefined`, which nothing but `undefined`\n * satisfies.\n *\n * An intersection, not `Omit<P, \"asChild\"> & …`. `Omit` re-maps every key of\n * a large HTML/Ark props type, and measured on the forbidden parts that cost\n * each importing file about 38k extra type instantiations (+8.6%); the\n * intersection costs nothing measurable. It also leaves a union in `P` (a\n * discriminated `type` / `color` pair, a slot-size union) and any generic\n * untouched, where `Omit` would flatten the one and hide the other from\n * inference.\n *\n * The component destructures `asChild` out before spreading the rest onto\n * its Ark part (`({ asChild: _asChild, ...rest })`), so a JS caller that\n * passes it anyway gets the normal render rather than Ark's `null`.\n */\nexport type NoAsChild<P> = P & ForbidAsChild\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useLayerGuard, OverlayLayerProvider } from './chunk-AIQG7IIT.js';
|
|
2
2
|
import { OverlayContainerProvider } from './chunk-7P32XCEU.js';
|
|
3
|
-
import { ActionIcon } from './chunk-
|
|
3
|
+
import { ActionIcon } from './chunk-S7N4LGLZ.js';
|
|
4
4
|
import { props } from './chunk-WYCMIIRR.js';
|
|
5
5
|
import { cn } from './chunk-QP4I37PA.js';
|
|
6
6
|
import { Dialog } from '@ark-ui/react/dialog';
|
|
@@ -88,6 +88,7 @@ var ModalPositioner = ({
|
|
|
88
88
|
position,
|
|
89
89
|
testId,
|
|
90
90
|
children,
|
|
91
|
+
asChild: _asChild,
|
|
91
92
|
...rest
|
|
92
93
|
}) => {
|
|
93
94
|
const positioner = useRef(null);
|
|
@@ -129,16 +130,31 @@ var ModalDescription = ({ className, testId, ...rest }) => /* @__PURE__ */ jsx(
|
|
|
129
130
|
var ModalCloseTrigger = ({
|
|
130
131
|
children,
|
|
131
132
|
className,
|
|
132
|
-
"aria-label": ariaLabel
|
|
133
|
+
"aria-label": ariaLabel,
|
|
133
134
|
testId,
|
|
135
|
+
asChild,
|
|
134
136
|
...rest
|
|
135
|
-
}) =>
|
|
137
|
+
}) => asChild ? (
|
|
138
|
+
// The consumer's element (a "Cancel" button, say) replaces the kit's icon
|
|
139
|
+
// button outright, rather than nesting inside it.
|
|
140
|
+
/* @__PURE__ */ jsx(
|
|
141
|
+
Dialog.CloseTrigger,
|
|
142
|
+
{
|
|
143
|
+
asChild: true,
|
|
144
|
+
"aria-label": ariaLabel,
|
|
145
|
+
className,
|
|
146
|
+
...props({ "data-testid": testId }),
|
|
147
|
+
...rest,
|
|
148
|
+
children
|
|
149
|
+
}
|
|
150
|
+
)
|
|
151
|
+
) : /* @__PURE__ */ jsx(Dialog.CloseTrigger, { asChild: true, ...rest, children: /* @__PURE__ */ jsx(
|
|
136
152
|
ActionIcon,
|
|
137
153
|
{
|
|
138
154
|
variant: "subtle",
|
|
139
155
|
color: "neutral",
|
|
140
156
|
size: "xs",
|
|
141
|
-
"aria-label": ariaLabel,
|
|
157
|
+
"aria-label": ariaLabel ?? "Close",
|
|
142
158
|
className,
|
|
143
159
|
testId,
|
|
144
160
|
children: children ?? /* @__PURE__ */ jsx(XIcon, {})
|
|
@@ -275,5 +291,5 @@ var Modal = Object.assign(ModalComponent, {
|
|
|
275
291
|
});
|
|
276
292
|
|
|
277
293
|
export { Modal };
|
|
278
|
-
//# sourceMappingURL=chunk-
|
|
279
|
-
//# sourceMappingURL=chunk-
|
|
294
|
+
//# sourceMappingURL=chunk-JITF6I7N.js.map
|
|
295
|
+
//# sourceMappingURL=chunk-JITF6I7N.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/modal/modal.tsx"],"names":["Ark"],"mappings":";;;;;;;;;;;;AAkCA,IAAM,gBAAgB,GAAA,CAAI;AAAA,EACxB,8HAAA;AAAA,EACA;AACF,CAAC,CAAA;AAED,IAAM,eAAA,GAAkB,GAAA;AAAA,EACtB,gHAAA;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,QAAA,EAAU;AAAA,QACR,MAAA,EAAQ,gBAAA;AAAA,QACR,GAAA,EAAK,wBAAA;AAAA,QACL,MAAA,EAAQ;AAAA;AACV,KACF;AAAA,IACA,eAAA,EAAiB,EAAE,QAAA,EAAU,QAAA;AAAS;AAE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AAAA,EACT,KAAA,EAAO,UAAA;AAAA,EACP,WAAA,EAAa,gBAAA;AAAA,EACb,YAAA,EAAc,iBAAA;AAAA,EACd,MAAA,EAAQ,WAAA;AAAA,EACR,IAAA,EAAM,SAAA;AAAA,EACN,MAAA,EAAQ;AACV,CAAC","file":"chunk-JITF6I7N.js","sourcesContent":["\"use client\"\n\nimport { Dialog as Ark } from \"@ark-ui/react/dialog\"\nimport { Portal } from \"@ark-ui/react/portal\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { XIcon } from \"lucide-react\"\nimport { type ComponentPropsWithoutRef, type ReactNode, useRef } from \"react\"\nimport type { NoAsChild } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport { OverlayContainerProvider } from \"../../lib/overlay-container\"\nimport { OverlayLayerProvider, useLayerGuard } from \"../../lib/overlay-layer\"\nimport { props } from \"../../lib/props\"\nimport type { Size } from \"../../lib/sizes\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { ActionIcon } from \"../action-icon/action-icon\"\n\n/**\n * Modal — centered overlay dialog on top of Ark UI's Dialog state machine.\n * Ark owns focus-trap, scroll-lock, RTL, the `Esc` / click-outside behaviour\n * and the `data-state=\"open|closed\"` attribute that drives our enter/exit\n * animations (keyframes live in `theme.css`). This wrapper provides the styled\n * parts and a flatter props API.\n *\n * - High-level form: `<Modal open title size … >children</Modal>` renders the\n * full Portal → Backdrop → Positioner → Content → Header + Body scaffold.\n * This is what the imperative overlays manager mounts.\n * - Low-level parts (`Modal.Root`, `Modal.Content`, `Modal.Title`, …) are\n * exposed for full control / trigger-based composition.\n *\n * Surface padding flows through the `--modal-px` CSS var set on the content, so\n * `Modal.Header` / `Modal.Body` / `Modal.Footer` stay in rhythm without prop\n * plumbing — and keep a sensible fallback when used standalone.\n */\n\nconst modalBackdrop = 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 modalPositioner = cva(\n \"fixed inset-0 z-[calc(var(--modal-z,150)+var(--layer-index,0))] flex flex-col items-center overflow-y-auto p-4\",\n {\n variants: {\n position: {\n center: \"justify-center\",\n top: \"justify-start mt-[8vh]\",\n bottom: \"justify-end mb-[8vh]\",\n },\n },\n defaultVariants: { position: \"center\" },\n },\n)\n\nconst modalContent = cva(\n [\n \"relative flex w-full flex-col\",\n \"max-h-[calc(100dvh-2rem)]\",\n \"bg-brand-50 text-gray-light-900 border border-brand-900/20 shadow-2xl\",\n \"dark:bg-brand-950 dark:text-gray-dark-25 dark:border-white/15\",\n \"focus:outline-none\",\n \"data-[state=open]:animate-modal-in data-[state=closed]:animate-modal-out\",\n ],\n {\n variants: {\n size: {\n xs: \"max-w-(--width-xs)\", // 24rem\n sm: \"max-w-(--width-sm)\", // 30rem\n md: \"max-w-(--width-md)\", // 35rem\n lg: \"max-w-(--width-lg)\", // 40rem\n xl: \"max-w-(--width-xl)\", // 48rem\n full: \"max-w-[calc(100vw-2rem)] min-h-[calc(100dvh-2rem)]\",\n },\n radius: {\n none: \"rounded-none\",\n sm: \"rounded-sm\",\n md: \"rounded-md\",\n lg: \"rounded-xl\",\n xl: \"rounded-2xl\",\n },\n },\n defaultVariants: { size: \"md\", radius: \"sm\" },\n },\n)\n\n/** px → CSS length applied as `--modal-px`; vertical rhythm derives from it. */\nconst PADDING: Record<Size, string> = {\n xs: \"0.75rem\",\n sm: \"1rem\",\n md: \"1.25rem\",\n lg: \"1.5rem\",\n xl: \"2rem\",\n}\n\n// ---------------------------------------------------------------------------\n// Low-level parts (styled Ark parts + kit conveniences)\n// ---------------------------------------------------------------------------\n\nexport type ModalRootProps = ComponentPropsWithoutRef<typeof Ark.Root>\n\n/** Ark's root, plus the nested-layer guard: while a picker opened inside the\n * dialog is open, an outside click closes the picker only, not the dialog\n * under it. See `lib/overlay-layer.tsx`. */\nconst ModalRoot = ({ onPointerDownOutside, children, ...rest }: ModalRootProps) => {\n const guard = useLayerGuard(onPointerDownOutside)\n return (\n <Ark.Root onPointerDownOutside={guard.onPointerDownOutside} {...rest}>\n <OverlayLayerProvider value={guard.layers}>{children}</OverlayLayerProvider>\n </Ark.Root>\n )\n}\nconst ModalTrigger = Ark.Trigger\nconst ModalContext = Ark.Context\n\nexport type ModalBackdropProps = ComponentPropsWithoutRef<typeof Ark.Backdrop> & WithTestId\n\nconst ModalBackdrop = ({ className, testId, ...rest }: ModalBackdropProps) => (\n <Ark.Backdrop\n className={cn(modalBackdrop(), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type ModalPosition = VariantProps<typeof modalPositioner>[\"position\"]\nexport type ModalPositionerProps = NoAsChild<ComponentPropsWithoutRef<typeof Ark.Positioner>> &\n WithTestId & {\n position?: ModalPosition\n }\n\nconst ModalPositioner = ({\n className,\n position,\n testId,\n children,\n asChild: _asChild,\n ...rest\n}: ModalPositionerProps) => {\n // A ref, not state: overlays read it when they portal, so nothing has to\n // re-render once it attaches (see `lib/overlay-container.tsx`).\n const positioner = useRef<HTMLDivElement>(null)\n return (\n <Ark.Positioner\n ref={positioner}\n className={cn(modalPositioner({ position }), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n <OverlayContainerProvider value={positioner}>{children}</OverlayContainerProvider>\n </Ark.Positioner>\n )\n}\n\nexport type ModalContentProps = ComponentPropsWithoutRef<typeof Ark.Content> &\n VariantProps<typeof modalContent> &\n WithTestId\n\nconst ModalContent = ({ className, size, radius, testId, ...rest }: ModalContentProps) => (\n <Ark.Content\n className={cn(modalContent({ size, radius }), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type ModalTitleProps = ComponentPropsWithoutRef<typeof Ark.Title> & WithTestId\n\nconst ModalTitle = ({ className, testId, ...rest }: ModalTitleProps) => (\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 ModalDescriptionProps = ComponentPropsWithoutRef<typeof Ark.Description> & WithTestId\n\nconst ModalDescription = ({ className, testId, ...rest }: ModalDescriptionProps) => (\n <Ark.Description\n className={cn(\"text-sm text-gray-light-500 dark:text-gray-dark-400\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type ModalCloseTriggerProps = ComponentPropsWithoutRef<typeof Ark.CloseTrigger> &\n WithTestId & {\n \"aria-label\"?: string\n }\n\nconst ModalCloseTrigger = ({\n children,\n className,\n \"aria-label\": ariaLabel,\n testId,\n asChild,\n ...rest\n}: ModalCloseTriggerProps) =>\n asChild ? (\n // The consumer's element (a \"Cancel\" button, say) replaces the kit's icon\n // button outright, rather than nesting inside it.\n <Ark.CloseTrigger\n asChild\n aria-label={ariaLabel}\n className={className}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {children}\n </Ark.CloseTrigger>\n ) : (\n <Ark.CloseTrigger asChild {...rest}>\n <ActionIcon\n variant=\"subtle\"\n color=\"neutral\"\n size=\"xs\"\n aria-label={ariaLabel ?? \"Close\"}\n className={className}\n testId={testId}\n >\n {children ?? <XIcon />}\n </ActionIcon>\n </Ark.CloseTrigger>\n )\n\nexport type ModalHeaderProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\nconst ModalHeader = ({ className, testId, ...rest }: ModalHeaderProps) => (\n <div\n className={cn(\n \"flex items-start min-h-15 justify-between gap-4 px-(--modal-px,1.25rem) pt-(--modal-px,1.25rem) pb-3\",\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type ModalBodyProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\nconst ModalBody = ({ className, testId, ...rest }: ModalBodyProps) => (\n <div\n className={cn(\"flex-1 overflow-y-auto px-(--modal-px,1.25rem) py-1\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type ModalFooterProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\nconst ModalFooter = ({ className, testId, ...rest }: ModalFooterProps) => (\n <div\n className={cn(\n \"flex items-center justify-end gap-2 px-(--modal-px,1.25rem) pb-(--modal-px,1.25rem) pt-4\",\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\n// ---------------------------------------------------------------------------\n// High-level props-driven Modal\n// ---------------------------------------------------------------------------\n\ntype ArkRootProps = ComponentPropsWithoutRef<typeof Ark.Root>\n\nexport type ModalSize = NonNullable<VariantProps<typeof modalContent>[\"size\"]>\nexport type ModalRadius = NonNullable<VariantProps<typeof modalContent>[\"radius\"]>\n\nexport type ModalClassNames = Partial<\n Record<\n | \"backdrop\"\n | \"positioner\"\n | \"content\"\n | \"header\"\n | \"title\"\n | \"description\"\n | \"body\"\n | \"closeButton\",\n string\n >\n>\n\nexport type ModalProps = Omit<\n ArkRootProps,\n \"open\" | \"defaultOpen\" | \"onOpenChange\" | \"children\" | \"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 /** Header title; renders the header when set. */\n title?: ReactNode\n /** Optional subtitle under the title. */\n description?: ReactNode\n size?: ModalSize\n radius?: ModalRadius\n /** Vertically center the modal (vs. anchored near the top). */\n position?: ModalPosition\n /** Render the default close button in the header. @default true */\n withCloseButton?: 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 `--modal-px`. @default \"md\" */\n padding?: Size\n closeOnEscape?: boolean\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 /** Fires on close (any source) */\n onClose?: () => void\n /** Portal target. Defaults to `document.body`. */\n container?: HTMLElement | null\n children?: ReactNode\n className?: string\n classNames?: ModalClassNames\n }\n\nconst ModalComponent = ({\n open,\n defaultOpen,\n onOpenChange,\n onClose,\n title,\n description,\n size,\n radius,\n position,\n withCloseButton = true,\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 ...rest\n}: ModalProps) => {\n const hasHeader = title != null || description != null || withCloseButton\n\n return (\n <ModalRoot\n open={open}\n defaultOpen={defaultOpen}\n onOpenChange={({ open: next }) => {\n onOpenChange?.(next)\n if (!next) onClose?.()\n }}\n closeOnEscape={closeOnEscape}\n // Decoupled from `modal` on purpose: Ark's dialog derives this default\n // from `modal` (`modal && !alertdialog`), so when the overlays manager\n // draws its own shared backdrop and passes `withBackdrop={false}` —\n // forcing `modal={false}` below — outside-click would silently stop\n // dismissing. Default to Ark's intended behaviour instead: dismiss for\n // regular dialogs, keep `alertdialog`s sticky (explicit choice required).\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. Both flow to the parts' presence via Ark's Root context.\n lazyMount\n unmountOnExit\n modal={withBackdrop}\n onExitComplete={onExitComplete}\n {...rest}\n >\n <Portal container={container ? { current: container } : undefined}>\n {withBackdrop && <ModalBackdrop className={classNames?.backdrop} />}\n <ModalPositioner\n position={position}\n className={cn(classNames?.positioner, \"overflow-clip\")}\n >\n <ModalContent\n size={size}\n radius={radius}\n style={{ [\"--modal-px\" as string]: PADDING[padding] }}\n className={cn(className, classNames?.content)}\n testId={testId}\n >\n {hasHeader && (\n <ModalHeader className={classNames?.header}>\n <div className=\"flex flex-col gap-1\">\n {title != null && <ModalTitle className={classNames?.title}>{title}</ModalTitle>}\n {description != null && (\n <ModalDescription className={classNames?.description}>\n {description}\n </ModalDescription>\n )}\n </div>\n {withCloseButton && <ModalCloseTrigger className={classNames?.closeButton} />}\n </ModalHeader>\n )}\n <ModalBody\n className={cn(\n !hasHeader && \"pt-(--modal-px,1.25rem)\",\n \"pb-(--modal-px,1.25rem)\",\n classNames?.body,\n )}\n >\n {children}\n </ModalBody>\n </ModalContent>\n </ModalPositioner>\n </Portal>\n </ModalRoot>\n )\n}\n\nexport const Modal = Object.assign(ModalComponent, {\n Root: ModalRoot,\n Trigger: ModalTrigger,\n Context: ModalContext,\n Backdrop: ModalBackdrop,\n Positioner: ModalPositioner,\n Content: ModalContent,\n Title: ModalTitle,\n Description: ModalDescription,\n CloseTrigger: ModalCloseTrigger,\n Header: ModalHeader,\n Body: ModalBody,\n Footer: ModalFooter,\n})\n"]}
|
|
@@ -174,6 +174,7 @@ var TabsComponent = ({
|
|
|
174
174
|
value,
|
|
175
175
|
defaultValue,
|
|
176
176
|
onChange,
|
|
177
|
+
asChild: _asChild,
|
|
177
178
|
...root
|
|
178
179
|
}) => /* @__PURE__ */ jsxs(
|
|
179
180
|
Root,
|
|
@@ -218,5 +219,5 @@ var Tabs = Object.assign(TabsComponent, {
|
|
|
218
219
|
});
|
|
219
220
|
|
|
220
221
|
export { Tabs };
|
|
221
|
-
//# sourceMappingURL=chunk-
|
|
222
|
-
//# sourceMappingURL=chunk-
|
|
222
|
+
//# sourceMappingURL=chunk-KHMFNH3X.js.map
|
|
223
|
+
//# sourceMappingURL=chunk-KHMFNH3X.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/tabs/tabs.tsx","../src/components/tabs/tabs-data.tsx"],"names":["Ark","jsx"],"mappings":";;;;;;;;;AA6DA,IAAM,QAAA,GAAW,GAAA;AAAA,EACf;AAAA,IACE,6EAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OAAA,EAAS;AAAA,QACP,MAAA,EAAQ,CAAC,yCAAA,E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AA,CAAK;AAAA,WAAA;AAAA,UALD,IAAA,CAAK;AAAA,SAOb;AAAA,OAAA,EACH,CAAA;AAAA,MACC,IAAA,CAAK,GAAA,CAAI,CAAC,IAAA,qBACTA,GAAAA;AAAA,QAAC,OAAA;AAAA,QAAA;AAAA,UAEC,OAAO,IAAA,CAAK,KAAA;AAAA,UACZ,QAAQ,CAAA,EAAG,IAAA,CAAK,UAAU,CAAA,IAAA,EAAO,IAAA,CAAK,KAAK,CAAA,CAAE,CAAA,MAAA,CAAA;AAAA,UAE5C,QAAA,EAAA,IAAA,CAAK;AAAA,SAAA;AAAA,QAJD,IAAA,CAAK;AAAA,OAMb;AAAA;AAAA;AACH,CAAA;AAQK,IAAM,IAAA,GAAO,MAAA,CAAO,MAAA,CAAO,aAAA,EAAe;AAAA,EAC/C,IAAA;AAAA,EACA,IAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA,SAAA;AAAA,EACA;AACF,CAAC","file":"chunk-KHMFNH3X.js","sourcesContent":["\"use client\"\n\nimport { Tabs as Ark } from \"@ark-ui/react/tabs\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { createContext, useContext } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { useDirectionCheck } from \"../../lib/intl\"\nimport { props } from \"../../lib/props\"\nimport type { Size } from \"../../lib/sizes\"\nimport type { WithTestId } from \"../../lib/test-id\"\n\n/**\n * Tabs — a navigation control on Ark UI's Tabs machine: a row (or column) of\n * triggers, each revealing its own content panel, with a pill that slides to\n * the active trigger. Visually it's `SegmentGroup`'s twin — the same\n * filled/light/outline/subtle/default variant × color system and the same\n * sliding-indicator mechanics — but built for real content panels instead of\n * a single-choice value, and with no `Field` integration (Tabs is navigation,\n * not a form control, so there's no label/description/error/name).\n *\n * Two ways to use it:\n *\n * // 1. Data-driven — the common case\n * <Tabs\n * variant=\"filled\"\n * color=\"brand\"\n * defaultValue=\"overview\"\n * data={[\n * { value: \"overview\", label: \"Overview\", content: <Overview /> },\n * { value: \"activity\", label: \"Activity\", content: <Activity /> },\n * ]}\n * />\n *\n * // 2. Compound — for anything the data array can't express\n * <Tabs.Root defaultValue=\"overview\">\n * <Tabs.List variant=\"filled\" color=\"brand\">\n * <Tabs.Indicator />\n * <Tabs.Trigger value=\"overview\">Overview</Tabs.Trigger>\n * <Tabs.Trigger value=\"activity\">Activity</Tabs.Trigger>\n * </Tabs.List>\n * <Tabs.Content value=\"overview\"><Overview /></Tabs.Content>\n * <Tabs.Content value=\"activity\"><Activity /></Tabs.Content>\n * </Tabs.Root>\n *\n * `variant`, `size` and `color` all live on `List` and apply to the tray, every\n * trigger, and the indicator — set them once on `List` rather than repeating\n * them on each `Trigger`. `color` is a `data-color` attribute, so it is scoped\n * to the strip: it deliberately does *not* sit on `Root`, which also wraps\n * every `Content` panel and would leak the palette into whatever those panels\n * render — an uncoloured `Button` inside a panel would silently adopt the\n * tab's palette (#140).\n */\n\n/** The tray. `filled` is a heavier neutral fill so the colored pill pops;\n * `light` / `default` frame the pill with the same translucent surface as\n * `Input`'s own `default` shell (`bg-white/4` + the hairline\n * `border-brand-900/20 dark:border-white/15`) rather than an opaque gray\n * step, so the tray reads correctly on any host background; `outline` /\n * `subtle` are chromeless (their cue lives on the sliding pill instead). */\nconst tabsList = cva(\n [\n \"relative inline-flex max-w-fit rounded-input border p-0.5 transition-colors\",\n \"data-[orientation=vertical]:flex-col\",\n ],\n {\n variants: {\n variant: {\n filled: [\"bg-gray-light-100 dark:bg-gray-dark-800\", \"border-transparent\"],\n light: [\"bg-white/4\", \"border-brand-900/20 dark:border-white/15\"],\n outline: [\"bg-transparent border-transparent\"],\n subtle: [\"bg-transparent border-transparent\"],\n default: [\"bg-white/4\", \"border-brand-900/20 dark:border-white/15\"],\n },\n size: {\n xs: \"gap-1\",\n sm: \"gap-1.5\",\n md: \"gap-2\",\n lg: \"gap-3\",\n xl: \"gap-4\",\n },\n },\n defaultVariants: { variant: \"default\", size: \"md\" },\n },\n)\n\n/**\n * Each trigger. Mirrors `segItem`'s checked-color treatment (per variant) and\n * `segItemWrap`'s hairline separator between neighbours — drawn directly on\n * the trigger `<button>` itself (Tabs has no separate item-wrapper the way\n * `SegmentGroup` does for its hidden radio input). The focus ring sits\n * directly on the trigger (unlike `SegmentGroup`'s container-level `:has()`\n * halo) because each trigger is a real, independently-focusable `<button>`.\n *\n * The indicator renders as `List`'s first child (see `Indicator` below), so\n * the first trigger is `:nth-child(2)` — `nth-2:before:hidden` suppresses the\n * separator before it, matching `segItemWrap`'s own comment.\n *\n * The *selected* label must come from the same source as the pill it sits on.\n * `default` and `filled` both paint `bg-(--c-solid)`, so both take\n * `--c-on-solid`; `light` / `outline` / `subtle` sit on a soft or absent fill,\n * so they take `--c-text`. Hard-coding a neutral foreground against a\n * `--c-solid` fill is what broke `default` at any `color` (#140) — the pill\n * moved with the palette and the label stayed put, reaching 3.27:1 on brand.\n * There is deliberately no hover shift on the selected label: `Button`'s\n * `filled` moves only the background (`--c-solid-hover`) and keeps\n * `--c-on-solid`, and no `--c-on-solid-hover` slot exists in `colors.css`.\n */\nconst tabsTrigger = cva(\n [\n \"relative z-1 cursor-pointer rounded-[6px] text-center font-medium whitespace-nowrap select-none\",\n \"text-gray-light-700 dark:text-gray-dark-300\",\n // Only unselected triggers get the hover lift. The selected one already has\n // its variant's foreground (`--c-on-solid` / `--c-text`), and these neutral\n // hover colors carry the same specificity, so an unscoped `hover:` wins on\n // source order alone — in dark theme it did, washing the selected label to\n // near-white over a colored pill (3.41:1 on brand). Mirrors `Button`'s own\n // `not-data-loading:hover:` scoping.\n \"not-data-selected:hover:text-gray-light-950 dark:not-data-selected:hover:text-gray-dark-50\",\n \"transition-colors\",\n focusStyles(),\n \"data-disabled:cursor-not-allowed data-disabled:opacity-50\",\n \"before:absolute before:rounded-full before:bg-gray-light-300 dark:before:bg-gray-dark-600\",\n \"before:transition-opacity before:duration-200\",\n \"before:top-1/2 before:left-0 before:h-1/2 before:w-px before:-translate-x-1/2 before:-translate-y-1/2\",\n \"in-data-[orientation=vertical]:before:top-0 in-data-[orientation=vertical]:before:left-1/2 in-data-[orientation=vertical]:before:h-px in-data-[orientation=vertical]:before:w-1/2\",\n \"nth-2:before:hidden\",\n \"data-selected:before:opacity-0 data-selected:[&+*]:before:opacity-0\",\n ],\n {\n variants: {\n variant: {\n filled: \"data-selected:text-(--c-on-solid)\",\n light: \"data-selected:text-(--c-text)\",\n outline: \"data-selected:text-(--c-text)\",\n subtle: \"data-selected:text-(--c-text)\",\n default: \"data-selected:text-(--c-on-solid)\",\n },\n size: {\n xs: \"px-2 py-0.5 text-xs\",\n sm: \"px-2.5 py-1 text-sm\",\n md: \"px-3 py-1.5 text-md\",\n lg: \"px-4 py-2 text-lg\",\n xl: \"px-5 py-2.5 text-xl\",\n },\n },\n defaultVariants: { variant: \"default\", size: \"md\" },\n },\n)\n\n/** The sliding pill, mirroring each `Button` surface (same as `segIndicator`). */\nconst tabsIndicator = cva(\"z-0\", {\n variants: {\n variant: {\n filled: \"bg-(--c-solid) rounded-xxs\",\n light: \"bg-(--c-soft) border border-(--c-soft-hover) rounded-xxs\",\n outline: \"bg-transparent border border-(--c-solid) rounded-input\",\n subtle: \"bg-(--c-soft-hover) rounded-input\",\n default: \"bg-(--c-solid) rounded-xxs\",\n },\n },\n defaultVariants: { variant: \"default\" },\n})\n\n/** The content panel. Ark makes the active panel focusable (roving from its\n * trigger), so it gets its own focus ring, matching the kit-wide convention. */\nconst tabsContent = cn(\"mt-3 rounded-xs\", focusStyles())\n\nexport type TabsVariant = NonNullable<VariantProps<typeof tabsList>[\"variant\"]>\n\n/** Shared tray configuration, set once on `List` and read by `Trigger` and\n * `Indicator` so callers don't repeat `variant` / `size` on every trigger. */\nconst TabsStyleContext = createContext<{ variant: TabsVariant; size: Size }>({\n variant: \"default\",\n size: \"md\",\n})\n\n/** `color` is deliberately omitted, not merely absent: React's `HTMLAttributes`\n * carries a legacy `color?: string`, so without the `Omit` a stale\n * `<Tabs.Root color=\"brand\">` would still compile and fall through `...rest`\n * onto the div as the deprecated HTML attribute — silently losing the palette.\n * Omitting it turns every such call site into a compile error pointing at the\n * line to change. Same convention as `Button` / `ActionIcon` (code-style.md). */\nexport type TabsRootProps = Omit<Ark.RootProps, \"color\"> & WithTestId\n\nconst Root = ({ orientation = \"horizontal\", testId, ...rest }: TabsRootProps) => {\n const checkDirection = useDirectionCheck()\n return (\n // `key={orientation}` remounts on an axis flip so Ark re-measures the\n // indicator rect for the new layout (it only measures on mount + value\n // change, mirroring the same limitation `SegmentGroup` works around) — at\n // the cost of resetting an *uncontrolled* value on that flip. Pass a\n // controlled `value` if the orientation can change at runtime and the\n // selection must survive it.\n <Ark.Root\n key={orientation}\n orientation={orientation}\n ref={checkDirection}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n )\n}\n\nexport type TabsListProps = Omit<Ark.ListProps, \"color\"> &\n WithTestId & {\n variant?: TabsVariant\n size?: Size\n /** Palette for the sliding indicator + active-trigger text. Sets `data-color`\n * on the list, so the `--c-*` slots reach the tray, the triggers and the\n * indicator without reaching the `Content` panels. */\n color?: Color\n }\n\nconst List = ({\n variant = \"default\",\n size = \"md\",\n color,\n className,\n testId,\n ...rest\n}: TabsListProps) => (\n <TabsStyleContext.Provider value={{ variant, size }}>\n <Ark.List\n className={tabsList({ variant, size, className })}\n data-color={color}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n </TabsStyleContext.Provider>\n)\n\nexport type TabsTriggerProps = Ark.TriggerProps & WithTestId\n\nconst Trigger = ({ className, testId, ...rest }: TabsTriggerProps) => {\n const { variant, size } = useContext(TabsStyleContext)\n return (\n <Ark.Trigger\n className={tabsTrigger({ variant, size, className })}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n )\n}\n\nexport type TabsContentProps = Ark.ContentProps & WithTestId\n\nconst Content = ({ className, testId, ...rest }: TabsContentProps) => (\n <Ark.Content\n className={cn(tabsContent, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type TabsIndicatorProps = Ark.IndicatorProps & WithTestId\n\n/** The sliding pill. Ark sets `position: absolute` + `--left`/`--top`/\n * `--width`/`--height` (the selected trigger's rect) inline, so it sits\n * behind the labels (`z-0`).\n *\n * We drive the slide transition ourselves rather than via Ark's gated\n * `animateIndicator` flag — the same fix `SegmentGroup` uses: Ark sets\n * `transition-property: none` whenever that flag is false, including the\n * instant it receives the `transitionend` of ANY animated property. With\n * several properties of differing end-times (a `left` redirected by an\n * interrupting click vs. a color/width that already settled), that early end\n * would null the transition and snap the pill mid-slide. Overriding the real\n * `transition-*` props (our `style` wins via Ark's `mergeProps`) keeps the\n * transition always on, so interruptions re-target smoothly. */\nconst Indicator = ({ className, style, testId, ...rest }: TabsIndicatorProps) => {\n const { variant } = useContext(TabsStyleContext)\n return (\n <Ark.Indicator\n style={{\n width: \"var(--width)\",\n height: \"var(--height)\",\n transitionProperty: \"left, top, width, height, background-color, border-color\",\n transitionDuration: \"200ms\",\n transitionTimingFunction: \"cubic-bezier(0.32, 0.72, 0, 1)\",\n ...style,\n }}\n className={tabsIndicator({ variant, className })}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n )\n}\n\nexport { Content, Indicator, List, Root, Trigger }\nexport const Context = Ark.Context\n","\"use client\"\n\nimport type { ReactNode } from \"react\"\nimport type { ForbidAsChild } from \"../../lib/as-child\"\nimport type { Color } from \"../../lib/colors\"\nimport type { Size } from \"../../lib/sizes\"\nimport {\n Content,\n Context,\n Indicator,\n List,\n Root,\n type TabsRootProps,\n type TabsVariant,\n Trigger,\n} from \"./tabs\"\n\n/**\n * Data-driven Tabs — the convenience wrapper over the composable parts, for\n * the common case of a flat list of label + panel pairs:\n *\n * <Tabs\n * data={[\n * { value: \"overview\", label: \"Overview\", content: <Overview /> },\n * { value: \"activity\", label: \"Activity\", content: <Activity /> },\n * ]}\n * />\n *\n * Generic over `const data`, so an item's `value` narrows `onChange`. The\n * first item is selected by default when neither `value` nor `defaultValue`\n * is given — the low-level `Root` part has no `data` to default from, so this\n * only happens here. Drop to `Tabs.Root` / `Tabs.List` / `Tabs.Trigger` /\n * `Tabs.Content` for anything the flat array can't express (custom trigger\n * content, interleaved non-tab elements, …).\n */\n\n/** One tab: a trigger label and its panel content. */\nexport type TabsItem = {\n value: string\n label: ReactNode\n content: ReactNode\n disabled?: boolean\n /** `data-testid` on the trigger; the matching content panel gets\n * `` `${testId}-panel` ``. Defaults to `` `tab-${value}` `` / `` `tab-${value}-panel` ``\n * when omitted. Ark's own `data-value={value}` is also always present on the\n * trigger as a complementary, zero-config selector. */\n testId?: string\n}\n\n/** The `data` array `Tabs` is generic over. */\nexport type TabsData = ReadonlyArray<TabsItem>\n\n/** Extract the value-string union from a `TabsData` shape, for a typed `onChange`. */\nexport type TabsValue<Data extends TabsData> = Data[number][\"value\"]\n\nexport type TabsProps<Data extends TabsData = TabsData> = Omit<\n TabsRootProps,\n \"children\" | \"onValueChange\" | \"onChange\" | \"asChild\"\n> &\n ForbidAsChild & {\n /** Tabs, in order. Each needs its own `content`. */\n data: Data\n /** Tray + trigger + indicator treatment, mirroring `Button`/`SegmentGroup`. */\n variant?: TabsVariant\n /** Trigger size. */\n size?: Size\n /** Palette for the sliding indicator + active-trigger text. Scoped to the\n * strip (it lands on the `List`), so it never tints the panel content. */\n color?: Color\n /** Fires with the selected value (narrowed to the data value union). */\n onChange?: (value: TabsValue<Data>) => void\n }\n\nconst TabsComponent = <const Data extends TabsData>({\n data,\n variant,\n size,\n color,\n value,\n defaultValue,\n onChange,\n asChild: _asChild,\n ...root\n}: TabsProps<Data>) => (\n <Root\n value={value}\n defaultValue={defaultValue ?? data[0]?.value}\n onValueChange={onChange ? (d) => onChange(d.value as TabsValue<Data>) : undefined}\n {...root}\n >\n <List variant={variant} size={size} color={color}>\n <Indicator />\n {data.map((item) => (\n <Trigger\n key={item.value}\n value={item.value}\n disabled={item.disabled}\n testId={item.testId ?? `tab-${item.value}`}\n >\n {item.label}\n </Trigger>\n ))}\n </List>\n {data.map((item) => (\n <Content\n key={item.value}\n value={item.value}\n testId={`${item.testId ?? `tab-${item.value}`}-panel`}\n >\n {item.content}\n </Content>\n ))}\n </Root>\n)\n\n/**\n * The public `Tabs` export — callable for the data-driven form, with the\n * composable parts attached (like `Menu`). `<Tabs data={…}>` and\n * `<Tabs.Root>…</Tabs.Root>` both work from one import.\n */\nexport const Tabs = Object.assign(TabsComponent, {\n Root,\n List,\n Trigger,\n Content,\n Indicator,\n Context,\n})\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FieldShell, fieldA11yProps } from './chunk-
|
|
2
|
-
import { Button } from './chunk-
|
|
1
|
+
import { FieldShell, fieldA11yProps } from './chunk-FHG54IT5.js';
|
|
2
|
+
import { Button } from './chunk-RAUOFTUH.js';
|
|
3
3
|
import { buttonGroupVariants } from './chunk-2SVX3MQQ.js';
|
|
4
4
|
import { useUncontrolled } from './chunk-BEL75C7N.js';
|
|
5
5
|
import { props } from './chunk-WYCMIIRR.js';
|
|
@@ -234,5 +234,5 @@ var ButtonSelectControl = ({
|
|
|
234
234
|
};
|
|
235
235
|
|
|
236
236
|
export { ButtonSelectControl, Context, Item, MultiRoot, Root };
|
|
237
|
-
//# sourceMappingURL=chunk-
|
|
238
|
-
//# sourceMappingURL=chunk-
|
|
237
|
+
//# sourceMappingURL=chunk-MI2WZRK3.js.map
|
|
238
|
+
//# sourceMappingURL=chunk-MI2WZRK3.js.map
|