@42-central/ui-react 0.18.1 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-YXE4B6X3.js → chunk-2NNZHVKD.js} +3 -3
- package/dist/{chunk-YXE4B6X3.js.map → chunk-2NNZHVKD.js.map} +1 -1
- package/dist/{chunk-5JHDSVEZ.js → chunk-4NNGTNPV.js} +10 -8
- package/dist/chunk-4NNGTNPV.js.map +1 -0
- package/dist/{chunk-7NZSTCJO.js → chunk-57BTVRRB.js} +4 -9
- package/dist/chunk-57BTVRRB.js.map +1 -0
- package/dist/{chunk-S2HWWR2H.js → chunk-64T6Z7BA.js} +3 -3
- package/dist/{chunk-S2HWWR2H.js.map → chunk-64T6Z7BA.js.map} +1 -1
- package/dist/{chunk-MI2WZRK3.js → chunk-A6MYJTJI.js} +4 -4
- package/dist/{chunk-MI2WZRK3.js.map → chunk-A6MYJTJI.js.map} +1 -1
- package/dist/{chunk-RQL7FVCS.js → chunk-BTFBBNRW.js} +11 -6
- package/dist/chunk-BTFBBNRW.js.map +1 -0
- package/dist/{chunk-OWG4BCQR.js → chunk-CYWMES5P.js} +4 -4
- package/dist/{chunk-OWG4BCQR.js.map → chunk-CYWMES5P.js.map} +1 -1
- package/dist/{chunk-YBJB7FGE.js → chunk-CZEKZ5HR.js} +6 -6
- package/dist/chunk-CZEKZ5HR.js.map +1 -0
- package/dist/{chunk-HAQJQFE6.js → chunk-DBTJEBMO.js} +11 -4
- package/dist/{chunk-HAQJQFE6.js.map → chunk-DBTJEBMO.js.map} +1 -1
- package/dist/{chunk-AE7QTLJ5.js → chunk-FAOBC4IS.js} +4 -4
- package/dist/{chunk-AE7QTLJ5.js.map → chunk-FAOBC4IS.js.map} +1 -1
- package/dist/{chunk-NF5JM2YO.js → chunk-FOMR74VE.js} +3 -3
- package/dist/{chunk-NF5JM2YO.js.map → chunk-FOMR74VE.js.map} +1 -1
- package/dist/{chunk-FZIHZT5R.js → chunk-GCGX4FEF.js} +16 -10
- package/dist/chunk-GCGX4FEF.js.map +1 -0
- package/dist/{chunk-B2YJKRNQ.js → chunk-HCYULRWT.js} +13 -9
- package/dist/chunk-HCYULRWT.js.map +1 -0
- package/dist/{chunk-B2LCHXUB.js → chunk-INJUILCN.js} +9 -4
- package/dist/chunk-INJUILCN.js.map +1 -0
- package/dist/{chunk-ZDXQ64A7.js → chunk-K5UWVH6P.js} +5 -5
- package/dist/{chunk-ZDXQ64A7.js.map → chunk-K5UWVH6P.js.map} +1 -1
- package/dist/{chunk-6GDMSENK.js → chunk-LM6F6DLR.js} +3 -24
- package/dist/chunk-LM6F6DLR.js.map +1 -0
- package/dist/{chunk-KHMFNH3X.js → chunk-MQO42HZL.js} +7 -7
- package/dist/chunk-MQO42HZL.js.map +1 -0
- package/dist/chunk-OC7I2CTA.js +8 -0
- package/dist/chunk-OC7I2CTA.js.map +1 -0
- package/dist/{chunk-O23Y5ML4.js → chunk-OGJFDNIS.js} +249 -231
- package/dist/chunk-OGJFDNIS.js.map +1 -0
- package/dist/{chunk-6OLTJYSX.js → chunk-PINENGML.js} +12 -5
- package/dist/chunk-PINENGML.js.map +1 -0
- package/dist/{chunk-NSDM3FEB.js → chunk-PS2PZFXH.js} +5 -3
- package/dist/chunk-PS2PZFXH.js.map +1 -0
- package/dist/{chunk-RAUOFTUH.js → chunk-QIDAXFKK.js} +4 -4
- package/dist/{chunk-RAUOFTUH.js.map → chunk-QIDAXFKK.js.map} +1 -1
- package/dist/{chunk-S7N4LGLZ.js → chunk-RIP5G47F.js} +4 -4
- package/dist/{chunk-S7N4LGLZ.js.map → chunk-RIP5G47F.js.map} +1 -1
- package/dist/{chunk-Z2Z5EXVT.js → chunk-RKYXG6X7.js} +3 -3
- package/dist/{chunk-Z2Z5EXVT.js.map → chunk-RKYXG6X7.js.map} +1 -1
- package/dist/{chunk-WQN64ZHG.js → chunk-SVKU3GUN.js} +10 -6
- package/dist/chunk-SVKU3GUN.js.map +1 -0
- package/dist/{chunk-FHG54IT5.js → chunk-TBTSEPGP.js} +13 -4
- package/dist/chunk-TBTSEPGP.js.map +1 -0
- package/dist/{chunk-HT5JAHR3.js → chunk-UJZIF2BA.js} +20 -9
- package/dist/chunk-UJZIF2BA.js.map +1 -0
- package/dist/{chunk-UHNRAI6V.js → chunk-VZBUQNLX.js} +68 -29
- package/dist/chunk-VZBUQNLX.js.map +1 -0
- package/dist/{chunk-JITF6I7N.js → chunk-WJOHNCYY.js} +11 -4
- package/dist/{chunk-JITF6I7N.js.map → chunk-WJOHNCYY.js.map} +1 -1
- package/dist/{chunk-EBREIC3L.js → chunk-YQHOKMSV.js} +26 -8
- package/dist/chunk-YQHOKMSV.js.map +1 -0
- package/dist/{chunk-WHKKN3ZK.js → chunk-YW6Q6ERX.js} +10 -8
- package/dist/chunk-YW6Q6ERX.js.map +1 -0
- package/dist/{chunk-PH354ECN.js → chunk-Z43YWH4R.js} +13 -4
- package/dist/chunk-Z43YWH4R.js.map +1 -0
- package/dist/{chunk-5OQLFX47.js → chunk-Z6RPMRFH.js} +3 -3
- package/dist/{chunk-5OQLFX47.js.map → chunk-Z6RPMRFH.js.map} +1 -1
- package/dist/{chunk-TCWYBVIL.js → chunk-ZB5VMGKB.js} +10 -7
- package/dist/chunk-ZB5VMGKB.js.map +1 -0
- package/dist/components/accordion/index.js +1 -1
- package/dist/components/action-icon/index.js +3 -3
- package/dist/components/alert/index.js +3 -3
- package/dist/components/app-shell/index.js +4 -4
- package/dist/components/autocomplete/autocomplete.d.ts +8 -1
- package/dist/components/autocomplete/autocomplete.d.ts.map +1 -1
- package/dist/components/autocomplete/index.d.ts +1 -1
- package/dist/components/autocomplete/index.d.ts.map +1 -1
- package/dist/components/autocomplete/index.js +10 -7
- package/dist/components/autocomplete/index.js.map +1 -1
- package/dist/components/badge/index.js +1 -1
- package/dist/components/button/index.js +3 -3
- package/dist/components/button-multi-select/index.js +5 -5
- package/dist/components/button-select/index.js +5 -5
- package/dist/components/calendar/calendar-zone-sync.d.ts +41 -0
- package/dist/components/calendar/calendar-zone-sync.d.ts.map +1 -0
- package/dist/components/calendar/calendar.d.ts +6 -5
- package/dist/components/calendar/calendar.d.ts.map +1 -1
- package/dist/components/calendar/index.js +8 -5
- package/dist/components/chart/chart.d.ts +17 -10
- package/dist/components/chart/chart.d.ts.map +1 -1
- package/dist/components/chart/index.js +50 -7
- package/dist/components/chart/index.js.map +1 -1
- package/dist/components/chart/styles.css +100 -0
- package/dist/components/checkbox/index.js +4 -4
- package/dist/components/choice-card-group/index.d.ts.map +1 -1
- package/dist/components/choice-card-group/index.js +4 -3
- package/dist/components/circular-progress/circular-progress.d.ts.map +1 -1
- package/dist/components/circular-progress/index.js.map +1 -1
- package/dist/components/clipboard/clipboard.d.ts.map +1 -1
- package/dist/components/clipboard/copy.d.ts.map +1 -1
- package/dist/components/clipboard/index.js +5 -5
- package/dist/components/clipboard/index.js.map +1 -1
- package/dist/components/code-block/chrome.js +4 -4
- package/dist/components/code-block/index.js +5 -5
- package/dist/components/combobox/combobox.d.ts +20 -1
- package/dist/components/combobox/combobox.d.ts.map +1 -1
- package/dist/components/combobox/index.d.ts +1 -1
- package/dist/components/combobox/index.d.ts.map +1 -1
- package/dist/components/combobox/index.js +4 -4
- package/dist/components/combobox-list/combobox-list.d.ts +8 -1
- package/dist/components/combobox-list/combobox-list.d.ts.map +1 -1
- package/dist/components/combobox-list/index.d.ts +1 -1
- package/dist/components/combobox-list/index.d.ts.map +1 -1
- package/dist/components/combobox-list/index.js +5 -5
- package/dist/components/data-table/data-table-filter/data-table-date-filter.d.ts.map +1 -1
- package/dist/components/data-table/data-table-filter/data-table-number-filter.d.ts +4 -1
- package/dist/components/data-table/data-table-filter/data-table-number-filter.d.ts.map +1 -1
- package/dist/components/data-table/data-table-filter/data-table-select-filter.d.ts +4 -1
- package/dist/components/data-table/data-table-filter/data-table-select-filter.d.ts.map +1 -1
- package/dist/components/data-table/data-table-filter/index.d.ts +5 -1
- package/dist/components/data-table/data-table-filter/index.d.ts.map +1 -1
- package/dist/components/data-table/data-table-header-cell.d.ts +11 -15
- package/dist/components/data-table/data-table-header-cell.d.ts.map +1 -1
- package/dist/components/data-table/data-table-meta.d.ts +2 -2
- package/dist/components/data-table/data-table-meta.d.ts.map +1 -1
- package/dist/components/data-table/data-table-pagination.d.ts +3 -0
- package/dist/components/data-table/data-table-pagination.d.ts.map +1 -1
- package/dist/components/data-table/data-table-stack.d.ts +6 -3
- package/dist/components/data-table/data-table-stack.d.ts.map +1 -1
- package/dist/components/data-table/data-table-toolbar.d.ts +3 -1
- package/dist/components/data-table/data-table-toolbar.d.ts.map +1 -1
- package/dist/components/data-table/data-table-translations.d.ts +68 -0
- package/dist/components/data-table/data-table-translations.d.ts.map +1 -0
- package/dist/components/data-table/data-table.d.ts +5 -8
- package/dist/components/data-table/data-table.d.ts.map +1 -1
- package/dist/components/data-table/index.d.ts +2 -1
- package/dist/components/data-table/index.d.ts.map +1 -1
- package/dist/components/data-table/index.js +206 -84
- package/dist/components/data-table/index.js.map +1 -1
- package/dist/components/date-picker/date-picker.d.ts +13 -9
- package/dist/components/date-picker/date-picker.d.ts.map +1 -1
- package/dist/components/date-picker/index.js +16 -15
- package/dist/components/date-picker/index.js.map +1 -1
- package/dist/components/drawer/drawer.d.ts +9 -1
- package/dist/components/drawer/drawer.d.ts.map +1 -1
- package/dist/components/drawer/index.d.ts +1 -1
- package/dist/components/drawer/index.d.ts.map +1 -1
- package/dist/components/drawer/index.js +4 -4
- package/dist/components/field/field.d.ts +9 -2
- package/dist/components/field/field.d.ts.map +1 -1
- package/dist/components/field/index.js +1 -1
- package/dist/components/file-upload/file-upload.d.ts +13 -2
- package/dist/components/file-upload/file-upload.d.ts.map +1 -1
- package/dist/components/file-upload/index.d.ts +1 -1
- package/dist/components/file-upload/index.d.ts.map +1 -1
- package/dist/components/file-upload/index.js +16 -7
- 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/kbd/index.js +30 -15
- package/dist/components/kbd/index.js.map +1 -1
- package/dist/components/kbd/kbd.d.ts.map +1 -1
- package/dist/components/menu/index.js +2 -2
- package/dist/components/modal/index.d.ts +1 -1
- package/dist/components/modal/index.d.ts.map +1 -1
- package/dist/components/modal/index.js +4 -4
- package/dist/components/modal/modal.d.ts +9 -1
- package/dist/components/modal/modal.d.ts.map +1 -1
- package/dist/components/multi-combobox-list/index.d.ts +1 -1
- package/dist/components/multi-combobox-list/index.d.ts.map +1 -1
- package/dist/components/multi-combobox-list/index.js +7 -5
- package/dist/components/multi-combobox-list/multi-combobox-list.d.ts +8 -1
- package/dist/components/multi-combobox-list/multi-combobox-list.d.ts.map +1 -1
- package/dist/components/multi-select/index.d.ts +1 -1
- package/dist/components/multi-select/index.d.ts.map +1 -1
- package/dist/components/multi-select/index.js +20 -9
- package/dist/components/multi-select/index.js.map +1 -1
- package/dist/components/multi-select/multi-select.d.ts +11 -1
- package/dist/components/multi-select/multi-select.d.ts.map +1 -1
- package/dist/components/nav-link/index.d.ts +1 -1
- package/dist/components/nav-link/index.d.ts.map +1 -1
- package/dist/components/nav-link/index.js +2 -2
- package/dist/components/nav-link/nav-link.d.ts +12 -0
- package/dist/components/nav-link/nav-link.d.ts.map +1 -1
- package/dist/components/nav-link/navigation.d.ts +3 -1
- package/dist/components/nav-link/navigation.d.ts.map +1 -1
- package/dist/components/nav-link/tanstack.js +2 -2
- package/dist/components/notification/create-notifier.d.ts +12 -1
- package/dist/components/notification/create-notifier.d.ts.map +1 -1
- package/dist/components/notification/index.d.ts +2 -2
- package/dist/components/notification/index.d.ts.map +1 -1
- package/dist/components/notification/index.js +9 -6
- package/dist/components/notification/index.js.map +1 -1
- package/dist/components/notification/notification.d.ts +14 -1
- package/dist/components/notification/notification.d.ts.map +1 -1
- package/dist/components/number-input/index.d.ts +1 -1
- package/dist/components/number-input/index.d.ts.map +1 -1
- package/dist/components/number-input/index.js +4 -4
- package/dist/components/number-input/number-input.d.ts +20 -2
- package/dist/components/number-input/number-input.d.ts.map +1 -1
- package/dist/components/overlays/index.js +6 -6
- package/dist/components/password-input/index.d.ts +1 -1
- package/dist/components/password-input/index.d.ts.map +1 -1
- package/dist/components/password-input/index.js +68 -7
- package/dist/components/password-input/index.js.map +1 -1
- package/dist/components/password-input/password-input.d.ts +45 -6
- package/dist/components/password-input/password-input.d.ts.map +1 -1
- package/dist/components/pill/index.js +2 -2
- package/dist/components/pills-input/index.js +5 -5
- package/dist/components/pin-input/index.js +2 -2
- package/dist/components/popover/index.js +1 -1
- package/dist/components/popover/popover.d.ts +0 -10
- package/dist/components/popover/popover.d.ts.map +1 -1
- package/dist/components/progress/index.js.map +1 -1
- package/dist/components/progress/progress.d.ts.map +1 -1
- package/dist/components/radio-group/index.js +3 -3
- package/dist/components/rating/index.js +2 -2
- package/dist/components/rating/index.js.map +1 -1
- package/dist/components/rating/rating.d.ts.map +1 -1
- package/dist/components/schedule/index.js +62 -49
- package/dist/components/schedule/index.js.map +1 -1
- package/dist/components/schedule/now-cursor-line.d.ts +10 -5
- package/dist/components/schedule/now-cursor-line.d.ts.map +1 -1
- package/dist/components/schedule/schedule-dates.d.ts +11 -26
- package/dist/components/schedule/schedule-dates.d.ts.map +1 -1
- package/dist/components/schedule/schedule-event-chip.d.ts +4 -1
- package/dist/components/schedule/schedule-event-chip.d.ts.map +1 -1
- package/dist/components/schedule/schedule-event-details.d.ts +3 -2
- package/dist/components/schedule/schedule-event-details.d.ts.map +1 -1
- package/dist/components/schedule/schedule-geometry.d.ts +20 -21
- package/dist/components/schedule/schedule-geometry.d.ts.map +1 -1
- package/dist/components/schedule/schedule-grid-gesture.d.ts +5 -9
- package/dist/components/schedule/schedule-grid-gesture.d.ts.map +1 -1
- package/dist/components/schedule/schedule-segments.d.ts +2 -3
- package/dist/components/schedule/schedule-segments.d.ts.map +1 -1
- package/dist/components/schedule/schedule-timed-grid.d.ts.map +1 -1
- package/dist/components/schedule/use-event-resize.d.ts.map +1 -1
- package/dist/components/segment-group/index.js +4 -3
- package/dist/components/segment-group/segment-group.d.ts +3 -2
- package/dist/components/segment-group/segment-group.d.ts.map +1 -1
- package/dist/components/select/index.d.ts +1 -1
- package/dist/components/select/index.d.ts.map +1 -1
- package/dist/components/select/index.js +6 -4
- package/dist/components/select/select.d.ts +12 -2
- package/dist/components/select/select.d.ts.map +1 -1
- package/dist/components/slider/index.js +2 -2
- package/dist/components/spinner/index.js +1 -1
- package/dist/components/spinner/spinner.d.ts.map +1 -1
- package/dist/components/switch/index.js +3 -3
- package/dist/components/switch/index.js.map +1 -1
- package/dist/components/switch/switch.d.ts +2 -0
- package/dist/components/switch/switch.d.ts.map +1 -1
- package/dist/components/table/index.js +1 -1
- package/dist/components/table/table.d.ts.map +1 -1
- package/dist/components/tabs/index.js +4 -3
- package/dist/components/tabs/tabs.d.ts +3 -1
- package/dist/components/tabs/tabs.d.ts.map +1 -1
- package/dist/components/tags-input/index.d.ts +1 -1
- package/dist/components/tags-input/index.d.ts.map +1 -1
- package/dist/components/tags-input/index.js +9 -7
- package/dist/components/tags-input/index.js.map +1 -1
- package/dist/components/tags-input/tags-input.d.ts +9 -2
- package/dist/components/tags-input/tags-input.d.ts.map +1 -1
- package/dist/components/text-input/index.js +2 -2
- package/dist/components/textarea/index.js +2 -2
- package/dist/components/theme-icon/index.js +2 -2
- package/dist/components/theme-icon/theme-icon.d.ts.map +1 -1
- package/dist/components/time-input/index.js +24 -8
- package/dist/components/time-input/index.js.map +1 -1
- package/dist/components/time-input/time-input.d.ts.map +1 -1
- package/dist/components/time-input/time-row.d.ts +16 -3
- package/dist/components/time-input/time-row.d.ts.map +1 -1
- package/dist/components/timeline/index.js +6 -3
- package/dist/components/timeline/index.js.map +1 -1
- package/dist/components/timeline/timeline.d.ts.map +1 -1
- package/dist/components/tooltip/index.js +2 -2
- package/dist/components/tree-multi-select/index.d.ts +1 -1
- package/dist/components/tree-multi-select/index.d.ts.map +1 -1
- package/dist/components/tree-multi-select/index.js +62 -44
- package/dist/components/tree-multi-select/index.js.map +1 -1
- package/dist/components/tree-multi-select/tree-multi-select.d.ts +10 -1
- package/dist/components/tree-multi-select/tree-multi-select.d.ts.map +1 -1
- package/dist/components/tree-select/index.d.ts +1 -1
- package/dist/components/tree-select/index.d.ts.map +1 -1
- package/dist/components/tree-select/index.js +45 -15
- package/dist/components/tree-select/index.js.map +1 -1
- package/dist/components/tree-select/tree-select.d.ts +10 -1
- package/dist/components/tree-select/tree-select.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/date-value.d.ts +14 -1
- package/dist/lib/date-value.d.ts.map +1 -1
- package/dist/lib/focus-styles.d.ts +13 -5
- package/dist/lib/focus-styles.d.ts.map +1 -1
- package/dist/theme.css +1 -2
- package/package.json +1 -1
- package/src/components/autocomplete/autocomplete.test.tsx +32 -0
- package/src/components/autocomplete/autocomplete.tsx +17 -5
- package/src/components/autocomplete/index.ts +5 -1
- package/src/components/button/button.test.tsx +6 -0
- package/src/components/calendar/calendar-zone-sync.tsx +79 -0
- package/src/components/calendar/calendar.test.tsx +134 -14
- package/src/components/calendar/calendar.tsx +36 -22
- package/src/components/chart/chart.test.tsx +115 -8
- package/src/components/chart/chart.tsx +115 -25
- package/src/components/chart/styles.css +100 -0
- package/src/components/choice-card-group/index.ts +2 -0
- package/src/components/circular-progress/circular-progress.tsx +2 -0
- package/src/components/clipboard/clipboard.test.tsx +54 -22
- package/src/components/clipboard/clipboard.tsx +2 -0
- package/src/components/clipboard/copy.tsx +2 -0
- package/src/components/clipboard/index.ts +3 -3
- package/src/components/combobox/combobox.test.tsx +22 -0
- package/src/components/combobox/combobox.tsx +20 -0
- package/src/components/combobox/index.ts +1 -0
- package/src/components/combobox-list/combobox-list.test.tsx +19 -0
- package/src/components/combobox-list/combobox-list.tsx +16 -2
- package/src/components/combobox-list/index.ts +5 -1
- package/src/components/data-table/data-table-filter/data-table-date-filter.tsx +5 -4
- package/src/components/data-table/data-table-filter/data-table-number-filter.tsx +16 -2
- package/src/components/data-table/data-table-filter/data-table-select-filter.tsx +9 -1
- package/src/components/data-table/data-table-filter/index.tsx +15 -1
- package/src/components/data-table/data-table-filter.test.tsx +33 -0
- package/src/components/data-table/data-table-header-cell.tsx +37 -22
- package/src/components/data-table/data-table-meta.ts +2 -2
- package/src/components/data-table/data-table-pagination.tsx +6 -0
- package/src/components/data-table/data-table-stack.tsx +31 -17
- package/src/components/data-table/data-table-toolbar.tsx +4 -1
- package/src/components/data-table/data-table-translations.ts +105 -0
- package/src/components/data-table/data-table.test.tsx +212 -0
- package/src/components/data-table/data-table.tsx +92 -23
- package/src/components/data-table/index.ts +9 -1
- package/src/components/date-picker/date-picker.test.tsx +197 -5
- package/src/components/date-picker/date-picker.tsx +42 -16
- package/src/components/drawer/drawer.tsx +14 -1
- package/src/components/drawer/index.ts +1 -0
- package/src/components/field/field.tsx +29 -3
- package/src/components/file-upload/file-upload.test.tsx +21 -0
- package/src/components/file-upload/file-upload.tsx +26 -3
- package/src/components/file-upload/index.ts +1 -1
- package/src/components/kbd/kbd.test.tsx +31 -0
- package/src/components/kbd/kbd.tsx +29 -14
- package/src/components/modal/index.ts +1 -0
- package/src/components/modal/modal-translations.test.tsx +27 -0
- package/src/components/modal/modal.tsx +14 -1
- package/src/components/multi-combobox-list/index.ts +5 -1
- package/src/components/multi-combobox-list/multi-combobox-list.test.tsx +19 -0
- package/src/components/multi-combobox-list/multi-combobox-list.tsx +26 -4
- package/src/components/multi-select/index.ts +1 -1
- package/src/components/multi-select/multi-select.test.tsx +38 -0
- package/src/components/multi-select/multi-select.tsx +28 -4
- package/src/components/nav-link/index.ts +6 -1
- package/src/components/nav-link/nav-link.test.tsx +16 -0
- package/src/components/nav-link/nav-link.tsx +19 -1
- package/src/components/nav-link/navigation.test.tsx +18 -0
- package/src/components/nav-link/navigation.tsx +8 -4
- package/src/components/notification/create-notifier.tsx +20 -4
- package/src/components/notification/index.ts +7 -1
- package/src/components/notification/notification.test.tsx +49 -0
- package/src/components/notification/notification.tsx +39 -5
- package/src/components/number-input/index.ts +1 -1
- package/src/components/number-input/number-input.test.tsx +37 -0
- package/src/components/number-input/number-input.tsx +33 -4
- package/src/components/password-input/index.ts +5 -1
- package/src/components/password-input/password-input.test.tsx +201 -4
- package/src/components/password-input/password-input.tsx +162 -13
- package/src/components/popover/popover.tsx +0 -29
- package/src/components/progress/index.ts +3 -3
- package/src/components/progress/progress.tsx +2 -0
- package/src/components/rating/rating.tsx +2 -0
- package/src/components/schedule/now-cursor-line.test.tsx +74 -27
- package/src/components/schedule/now-cursor-line.tsx +40 -17
- package/src/components/schedule/schedule-agenda-view.test.tsx +1 -1
- package/src/components/schedule/schedule-dates.test.ts +19 -0
- package/src/components/schedule/schedule-dates.ts +16 -30
- package/src/components/schedule/schedule-details-popover.test.tsx +77 -6
- package/src/components/schedule/schedule-event-chip.tsx +17 -6
- package/src/components/schedule/schedule-event-details.test.tsx +38 -0
- package/src/components/schedule/schedule-event-details.tsx +7 -5
- package/src/components/schedule/schedule-geometry.test.ts +21 -18
- package/src/components/schedule/schedule-geometry.ts +37 -24
- package/src/components/schedule/schedule-grid-gesture.ts +5 -9
- package/src/components/schedule/schedule-segments.ts +2 -3
- package/src/components/schedule/schedule-timed-grid.tsx +43 -20
- package/src/components/schedule/schedule.test.tsx +34 -11
- package/src/components/schedule/use-event-resize.ts +6 -13
- package/src/components/segment-group/segment-group.test.tsx +23 -0
- package/src/components/segment-group/segment-group.tsx +13 -7
- package/src/components/select/index.ts +1 -1
- package/src/components/select/select.test.tsx +32 -0
- package/src/components/select/select.tsx +15 -1
- package/src/components/spinner/spinner.test.tsx +26 -0
- package/src/components/spinner/spinner.tsx +4 -1
- package/src/components/switch/switch.test.tsx +12 -0
- package/src/components/switch/switch.tsx +3 -1
- package/src/components/table/table.test.tsx +13 -0
- package/src/components/table/table.tsx +9 -5
- package/src/components/tabs/tabs.test.tsx +11 -0
- package/src/components/tabs/tabs.tsx +6 -4
- package/src/components/tags-input/index.ts +1 -1
- package/src/components/tags-input/tags-input.test.tsx +28 -0
- package/src/components/tags-input/tags-input.tsx +17 -1
- package/src/components/theme-icon/theme-icon.tsx +8 -3
- package/src/components/time-input/time-input.test.tsx +75 -0
- package/src/components/time-input/time-input.tsx +27 -3
- package/src/components/time-input/time-row.tsx +27 -3
- package/src/components/timeline/timeline.tsx +6 -3
- package/src/components/tree-multi-select/index.ts +5 -1
- package/src/components/tree-multi-select/tree-multi-select.test.tsx +72 -0
- package/src/components/tree-multi-select/tree-multi-select.tsx +156 -115
- package/src/components/tree-select/index.ts +1 -1
- package/src/components/tree-select/tree-select.test.tsx +69 -0
- package/src/components/tree-select/tree-select.tsx +128 -74
- package/src/lib/date-value.test.ts +19 -0
- package/src/lib/date-value.ts +21 -5
- package/src/lib/focus-styles.test.ts +21 -2
- package/src/lib/focus-styles.ts +24 -5
- package/src/theme.css +1 -2
- package/src/use-client-barrels.test.ts +80 -0
- package/dist/chunk-5JHDSVEZ.js.map +0 -1
- package/dist/chunk-6GDMSENK.js.map +0 -1
- package/dist/chunk-6OLTJYSX.js.map +0 -1
- package/dist/chunk-7NZSTCJO.js.map +0 -1
- package/dist/chunk-B2LCHXUB.js.map +0 -1
- package/dist/chunk-B2YJKRNQ.js.map +0 -1
- package/dist/chunk-EBREIC3L.js.map +0 -1
- package/dist/chunk-FHG54IT5.js.map +0 -1
- package/dist/chunk-FZIHZT5R.js.map +0 -1
- package/dist/chunk-HT5JAHR3.js.map +0 -1
- package/dist/chunk-KHMFNH3X.js.map +0 -1
- package/dist/chunk-NSDM3FEB.js.map +0 -1
- package/dist/chunk-O23Y5ML4.js.map +0 -1
- package/dist/chunk-PH354ECN.js.map +0 -1
- package/dist/chunk-RQL7FVCS.js.map +0 -1
- package/dist/chunk-TCWYBVIL.js.map +0 -1
- package/dist/chunk-UHNRAI6V.js.map +0 -1
- package/dist/chunk-WHKKN3ZK.js.map +0 -1
- package/dist/chunk-WQN64ZHG.js.map +0 -1
- package/dist/chunk-YBJB7FGE.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { resolveLogicalPlacement } from './chunk-G52U24GR.js';
|
|
2
2
|
import { useOverlayContainer } from './chunk-7P32XCEU.js';
|
|
3
3
|
import { props } from './chunk-WYCMIIRR.js';
|
|
4
|
-
import { focusStyles } from './chunk-
|
|
4
|
+
import { focusStyles } from './chunk-INJUILCN.js';
|
|
5
5
|
import { cn } from './chunk-QP4I37PA.js';
|
|
6
6
|
import { useLocaleContext } from '@ark-ui/react/locale';
|
|
7
7
|
import { Portal } from '@ark-ui/react/portal';
|
|
@@ -124,5 +124,5 @@ var Tooltip = Object.assign(TooltipComponent, {
|
|
|
124
124
|
});
|
|
125
125
|
|
|
126
126
|
export { Tooltip };
|
|
127
|
-
//# sourceMappingURL=chunk-
|
|
128
|
-
//# sourceMappingURL=chunk-
|
|
127
|
+
//# sourceMappingURL=chunk-2NNZHVKD.js.map
|
|
128
|
+
//# sourceMappingURL=chunk-2NNZHVKD.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/tooltip/tooltip.tsx"],"names":["ArkTooltip"],"mappings":";;;;;;;;;;;;;AAoDA,IAAM,cAAA,GAAiB,EAAA;AAAA,EACrB,oCAAA;AAAA,EACA,yCAAA;AAAA,EACA,oFAAA;AAAA,EACA,8EAAA;AAAA,EACA,yEAAA;AAAA,EACA;AACF,CAAA;AAWA,IAAM,iBAAA,GAAoB,sBAAA;AAK1B,IAAM,YAAA,GAAe,EAAA,CAAG,mBAAA,EAAqB,2CAA2C,CAAA;AAKxF,IAAM,cAAA,GAAiB,GAAA;AAAA,EACrB;AAAA,IACE,gEAAA;AAAA,IACA,6BAAA;AAAA,IACA,WAAA,EAAY;AAAA,IACZ;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OAAA,EAAS;AAAA,QACP,IAAA,EAAM,4FAAA;AAAA,QACN,MAAA,EAAQ;AAAA;A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CAAA,CACf,KAAK,EAAE,OAAA,EAAS,MAAK,EAAG,0BAAOA,SAAA,CAAW,OAAA,EAAX,EAAmB,OAAA,EAAO,IAAA,EAAE,UAAS,CAAqB,CAAA,CACzF,UAAU,sBACT,GAAA;AAAA,MAACA,SAAA,CAAW,OAAA;AAAA,MAAX;AAAA,QACC,OAAA,EAAO,IAAA;AAAA,QACP,SAAA,EAAW,GAAG,cAAA,CAAe,EAAE,SAAS,CAAA,EAAG,YAAY,OAAO,CAAA;AAAA,QAG9D,8BAAC,MAAA,EAAA,EAAK,QAAA,EAAU,CAAA,EAAG,kBAAA,EAAkB,IAClC,QAAA,EACH;AAAA;AAAA,KAEH,CAAA;AAAA,yBACF,OAAA,EAAA,EAAQ,SAAA,EAAW,UAAA,EAAY,OAAA,EAAS,IAAQ,MAAA,EAC9C,QAAA,EAAA;AAAA,MAAA,SAAA,oBAAa,GAAA,CAAC,KAAA,EAAA,EAAM,SAAA,EAAW,UAAA,EAAY,KAAA,EAAO,CAAA;AAAA,MAClD;AAAA,KAAA,EACH;AAAA,GAAA,EACF,CAAA;AAEJ,CAAA;AAEO,IAAM,OAAA,GAAU,MAAA,CAAO,MAAA,CAAO,gBAAA,EAAkB;AAAA,EACrD,IAAA;AAAA,EACA,SAASA,SAAA,CAAW,OAAA;AAAA,EACpB,OAAA;AAAA,EACA;AACF,CAAC","file":"chunk-YXE4B6X3.js","sourcesContent":["\"use client\"\n\nimport { useLocaleContext } from \"@ark-ui/react/locale\"\nimport { Portal } from \"@ark-ui/react/portal\"\nimport { Tooltip as ArkTooltip } from \"@ark-ui/react/tooltip\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { createContext, type ReactNode, useContext, useId } from \"react\"\nimport { match } from \"ts-pattern\"\nimport type { NoAsChild } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { useOverlayContainer } from \"../../lib/overlay-container\"\nimport { type LogicalPosition, resolveLogicalPlacement } from \"../../lib/placement\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\n\n/**\n * Tooltip — the kit's hover/focus **hint**, a styled layer over Ark UI's\n * Tooltip. It's the lightweight counterpart to `Popover` (which is a clickable,\n * focus-trapping panel): Ark's Tooltip machine opens on hover *and* keyboard\n * focus, wires `role=\"tooltip\"` + `aria-describedby` automatically, dismisses on\n * `Esc` / scroll / pointer-down, and never traps focus.\n *\n * Two ways to use it — the convenience form drops into running text or wraps any\n * element; the compound parts mirror `Popover.Root` / `Trigger` / `Content`.\n *\n * // 1. Inline — `children` become a focusable inline trigger\n * <Tooltip label=\"A project at 42.\">norm</Tooltip>\n *\n * // 2. Wrap an element — `asChild` makes the child the trigger\n * <Tooltip label=\"Delete\" asChild>\n * <ActionIcon aria-label=\"Delete\"><Trash /></ActionIcon>\n * </Tooltip>\n *\n * // 3. Compound\n * <Tooltip.Root position=\"end\">\n * <Tooltip.Trigger asChild><Button>Hover</Button></Tooltip.Trigger>\n * <Tooltip.Content>\n * <Tooltip.Arrow />\n * Rich <strong>content</strong>\n * </Tooltip.Content>\n * </Tooltip.Root>\n *\n * Visually it reuses the Popover's open/close animation but renders as a small,\n * **inverted** bubble (dark surface in light mode, light in dark) to read as an\n * ephemeral hint rather than a panel. Add `withArrow` (convenience form) or a\n * `Tooltip.Arrow` part (compound) to point the bubble at its trigger.\n */\n\n/** Inverted compact bubble — reuses the shared `popover-in/out` animation tokens\n * (which already honour reduced-motion in `theme.css`) and the placement-origin\n * trick so it grows out of the trigger's edge. */\nconst tooltipContent = cn(\n \"max-w-[16rem] rounded-xs px-2 py-1\",\n \"text-xs leading-snug focus:outline-none\",\n \"bg-gray-light-900 text-gray-light-25 dark:bg-gray-dark-100 dark:text-gray-dark-900\",\n \"data-[state=open]:animate-popover-in data-[state=closed]:animate-popover-out\",\n \"data-[placement^=top]:origin-bottom data-[placement^=bottom]:origin-top\",\n \"data-[placement^=left]:origin-right data-[placement^=right]:origin-left\",\n)\n\n/** The bubble's shadow lives on the *positioner* (this wrapper), not on the\n * content. A `box-shadow` on the content paints as one unit *with* its\n * background, so it lands on top of the behind-arrow (`-z-1`) and smears\n * across the protruding tip. Hosting the shadow here reorders the paint to\n * shadow → arrow → content: the positioner's shadow sits at the back of its\n * stacking context (it's the `isolate` root), the arrow paints above it, and\n * the content background paints last — so the shadow never touches the arrow,\n * the arrow never covers the label, and the bubble keeps its shadow.\n * `rounded-xs` matches the content radius so the shadow's corners line up. */\nconst tooltipPositioner = \"rounded-xs shadow-md\"\n\n/** Inverted arrow matching the bubble surface. The `!` overrides are required\n * because Ark sets the arrow background via an inline style; `-z-1` tucks the\n * square behind the bubble so only the rotated corner pokes out as the tip. */\nconst tooltipArrow = cn(\"-z-1! rounded-xxs\", \"bg-gray-light-900! dark:bg-gray-dark-100!\")\n\n/** Resets the `<button>` Ark renders for the default trigger down to plain inline\n * text, so a Tooltip can sit on a word inside a `<p>` while staying keyboard-\n * focusable. `cursor-help` signals the hint; `[font:inherit]` matches the prose. */\nconst tooltipTrigger = cva(\n [\n \"inline cursor-help appearance-none border-0 bg-transparent p-0\",\n \"[font:inherit] text-inherit\",\n focusStyles(),\n \"rounded-xs\",\n ],\n {\n variants: {\n variant: {\n text: \"underline decoration-dotted underline-offset-2 text-gray-light-900 dark:text-gray-dark-100\",\n inline: \"\",\n },\n },\n defaultVariants: {\n variant: \"inline\",\n },\n },\n)\n\ntype TooltipPlacement = NonNullable<NonNullable<ArkTooltip.RootProps[\"positioning\"]>[\"placement\"]>\n\n/** `position` accepts Ark's physical placements plus the logical, RTL-aware\n * horizontal sides `start` / `end` (resolved to `left` / `right` by direction). */\nexport type TooltipPosition = LogicalPosition<TooltipPlacement>\n\ntype TooltipContextValue = {\n withinPortal: boolean\n container?: HTMLElement | null\n}\nconst TooltipContext = createContext<TooltipContextValue>({ withinPortal: true })\n\nexport type TooltipRootProps = Omit<ArkTooltip.RootProps, \"positioning\"> & {\n /** Bubble placement relative to the trigger. Prefer the logical `start` / `end`\n * sides (RTL-aware), or use any Ark placement (`top`, `bottom`, `top-start`, …).\n * Defaults to `\"top\"`. */\n position?: TooltipPosition\n /** Gap in px between the trigger and the bubble. */\n offset?: number\n /** Render the bubble in a Portal so it escapes clipping ancestors. Default `true`. */\n withinPortal?: boolean\n /** Portal target. Defaults to the enclosing `Modal`/`Drawer` when there is\n * one (so the panel stays above it), else `document.body`. */\n container?: HTMLElement | null\n /** Fires on close (any source) — pointer/focus leaving the trigger, Escape, or a controlled `onOpenChange`. */\n onClose?: () => void\n}\n\nconst Root = ({\n position = \"top\",\n offset,\n withinPortal = true,\n container,\n children,\n onOpenChange,\n onClose,\n ...rest\n}: TooltipRootProps) => {\n const { dir } = useLocaleContext()\n return (\n <TooltipContext.Provider value={{ withinPortal, container }}>\n {/* Mount the bubble only while shown (lazyMount + unmountOnExit): closed →\n nothing rendered, so an inline trigger never emits a positioner <div>\n into a host <p> on SSR. Both are overridable via `...rest`. */}\n <ArkTooltip.Root\n lazyMount\n unmountOnExit\n positioning={{ placement: resolveLogicalPlacement(position, dir), gutter: offset }}\n onOpenChange={(details) => {\n onOpenChange?.(details)\n if (!details.open) onClose?.()\n }}\n {...rest}\n >\n {children}\n </ArkTooltip.Root>\n </TooltipContext.Provider>\n )\n}\n\nexport type TooltipContentProps = ArkTooltip.ContentProps & WithTestId\n\nconst Content = ({ className, children, testId, ...rest }: TooltipContentProps) => {\n const { withinPortal, container } = useContext(TooltipContext)\n const portalContainer = useOverlayContainer(container)\n const bubble = (\n <ArkTooltip.Positioner className={tooltipPositioner}>\n <ArkTooltip.Content\n className={cn(tooltipContent, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {children}\n </ArkTooltip.Content>\n </ArkTooltip.Positioner>\n )\n if (!withinPortal) return bubble\n return <Portal container={portalContainer}>{bubble}</Portal>\n}\n\nexport type TooltipArrowProps = NoAsChild<ArkTooltip.ArrowProps> & WithTestId\n\n/** The little arrow linking the bubble to its trigger. Compose it inside a\n * `Tooltip.Content` (or let the convenience form's `withArrow` add it for you).\n * The CSS vars size the square (`--arrow-size`) and pull it back under the\n * bubble (`--arrow-offset`) so it reads as a pointer, not a detached diamond. */\nconst Arrow = ({ className, style, testId }: TooltipArrowProps) => (\n <ArkTooltip.Arrow\n style={{ [\"--arrow-size\" as string]: \"12px\", [\"--arrow-offset\" as string]: \"-8px\", ...style }}\n {...props({ \"data-testid\": testId })}\n >\n <ArkTooltip.ArrowTip className={cn(tooltipArrow, className)} />\n </ArkTooltip.Arrow>\n)\n\nexport type TooltipProps = TooltipRootProps &\n WithTestId & {\n /** The hint shown on hover and keyboard focus. Named `label` for parity with\n * the rest of the kit; wired as a description via Ark's `aria-describedby`. */\n label: ReactNode\n /** The trigger. By default it's wrapped in a focusable inline trigger (so it\n * drops into running text); with `asChild`, this element *is* the trigger. */\n children: ReactNode\n /** Render `children` as the trigger instead of wrapping them. */\n asChild?: boolean\n /** Add a small arrow pointing at the trigger. For the compound form, compose\n * `<Tooltip.Arrow />` inside `<Tooltip.Content>` instead. */\n withArrow?: boolean\n variant?: VariantProps<typeof tooltipTrigger>[\"variant\"]\n classNames?: { trigger?: string; content?: string; arrow?: string }\n }\n\n/** Convenience form: `Root` + `Trigger` + `Content` wired from `label`/`children`.\n * `testId` lands on `Content` (the rendered bubble) — `Root` has no DOM node\n * of its own. */\nconst TooltipComponent = ({\n label,\n children,\n asChild,\n classNames,\n withArrow,\n variant = \"inline\",\n testId,\n ...root\n}: TooltipProps) => {\n const id = `tooltip-${useId()}`\n\n return (\n <Root {...root}>\n {match({ asChild })\n .with({ asChild: true }, () => <ArkTooltip.Trigger asChild>{children}</ArkTooltip.Trigger>)\n .otherwise(() => (\n <ArkTooltip.Trigger\n asChild\n className={cn(tooltipTrigger({ variant }), classNames?.trigger)}\n >\n {/** biome-ignore lint/a11y/noNoninteractiveTabindex: This is for text inline display */}\n <span tabIndex={0} aria-describedby={id}>\n {children}\n </span>\n </ArkTooltip.Trigger>\n ))}\n <Content className={classNames?.content} id={id} testId={testId}>\n {withArrow && <Arrow className={classNames?.arrow} />}\n {label}\n </Content>\n </Root>\n )\n}\n\nexport const Tooltip = Object.assign(TooltipComponent, {\n Root,\n Trigger: ArkTooltip.Trigger,\n Content,\n Arrow,\n})\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/tooltip/tooltip.tsx"],"names":["ArkTooltip"],"mappings":";;;;;;;;;;;;;AAoDA,IAAM,cAAA,GAAiB,EAAA;AAAA,EACrB,oCAAA;AAAA,EACA,yCAAA;AAAA,EACA,oFAAA;AAAA,EACA,8EAAA;AAAA,EACA,yEAAA;AAAA,EACA;AACF,CAAA;AAWA,IAAM,iBAAA,GAAoB,sBAAA;AAK1B,IAAM,YAAA,GAAe,EAAA,CAAG,mBAAA,EAAqB,2CAA2C,CAAA;AAKxF,IAAM,cAAA,GAAiB,GAAA;AAAA,EACrB;AAAA,IACE,gEAAA;AAAA,IACA,6BAAA;AAAA,IACA,WAAA,EAAY;AAAA,IACZ;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OAAA,EAAS;AAAA,QACP,IAAA,EAAM,4FAAA;AAAA,QACN,MAAA,EAAQ;AAAA;AACV,KACF;AAAA,IACA,eAAA,EAAiB;AAAA,MACf,OAAA,EAAS;AAAA;AACX;AAEJ,CAAA;AAYA,IAAM,cAAA,GAAiB,aAAA,CAAmC,EAAE,YAAA,EAAc,MAAM,CAAA;AAkBhF,IAAM,OAAO,CAAC;AAAA,EACZ,QAAA,GAAW,KAAA;AAAA,EACX,MAAA;AAAA,EACA,YAAA,GAAe,IAAA;AAAA,EACf,SAAA;AAAA,EACA,QAAA;AAAA,EACA,YAAA;AAAA,EACA,OAAA;AAAA,EACA,GAAG;AACL,CAAA,KAAwB;AACtB,EAAA,MAAM,EAAE,GAAA,EAAI,GAAI,gBAAA,EAAiB;AACjC,EAAA,uBACE,GAAA,CAAC,eAAe,QAAA,EAAf,EAAwB,OAAO,EAAE,YAAA,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AAA,EAAS,IAAQ,MAAA,EAC9C,QAAA,EAAA;AAAA,MAAA,SAAA,oBAAa,GAAA,CAAC,KAAA,EAAA,EAAM,SAAA,EAAW,UAAA,EAAY,KAAA,EAAO,CAAA;AAAA,MAClD;AAAA,KAAA,EACH;AAAA,GAAA,EACF,CAAA;AAEJ,CAAA;AAEO,IAAM,OAAA,GAAU,MAAA,CAAO,MAAA,CAAO,gBAAA,EAAkB;AAAA,EACrD,IAAA;AAAA,EACA,SAASA,SAAA,CAAW,OAAA;AAAA,EACpB,OAAA;AAAA,EACA;AACF,CAAC","file":"chunk-2NNZHVKD.js","sourcesContent":["\"use client\"\n\nimport { useLocaleContext } from \"@ark-ui/react/locale\"\nimport { Portal } from \"@ark-ui/react/portal\"\nimport { Tooltip as ArkTooltip } from \"@ark-ui/react/tooltip\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { createContext, type ReactNode, useContext, useId } from \"react\"\nimport { match } from \"ts-pattern\"\nimport type { NoAsChild } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { useOverlayContainer } from \"../../lib/overlay-container\"\nimport { type LogicalPosition, resolveLogicalPlacement } from \"../../lib/placement\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\n\n/**\n * Tooltip — the kit's hover/focus **hint**, a styled layer over Ark UI's\n * Tooltip. It's the lightweight counterpart to `Popover` (which is a clickable,\n * focus-trapping panel): Ark's Tooltip machine opens on hover *and* keyboard\n * focus, wires `role=\"tooltip\"` + `aria-describedby` automatically, dismisses on\n * `Esc` / scroll / pointer-down, and never traps focus.\n *\n * Two ways to use it — the convenience form drops into running text or wraps any\n * element; the compound parts mirror `Popover.Root` / `Trigger` / `Content`.\n *\n * // 1. Inline — `children` become a focusable inline trigger\n * <Tooltip label=\"A project at 42.\">norm</Tooltip>\n *\n * // 2. Wrap an element — `asChild` makes the child the trigger\n * <Tooltip label=\"Delete\" asChild>\n * <ActionIcon aria-label=\"Delete\"><Trash /></ActionIcon>\n * </Tooltip>\n *\n * // 3. Compound\n * <Tooltip.Root position=\"end\">\n * <Tooltip.Trigger asChild><Button>Hover</Button></Tooltip.Trigger>\n * <Tooltip.Content>\n * <Tooltip.Arrow />\n * Rich <strong>content</strong>\n * </Tooltip.Content>\n * </Tooltip.Root>\n *\n * Visually it reuses the Popover's open/close animation but renders as a small,\n * **inverted** bubble (dark surface in light mode, light in dark) to read as an\n * ephemeral hint rather than a panel. Add `withArrow` (convenience form) or a\n * `Tooltip.Arrow` part (compound) to point the bubble at its trigger.\n */\n\n/** Inverted compact bubble — reuses the shared `popover-in/out` animation tokens\n * (which already honour reduced-motion in `theme.css`) and the placement-origin\n * trick so it grows out of the trigger's edge. */\nconst tooltipContent = cn(\n \"max-w-[16rem] rounded-xs px-2 py-1\",\n \"text-xs leading-snug focus:outline-none\",\n \"bg-gray-light-900 text-gray-light-25 dark:bg-gray-dark-100 dark:text-gray-dark-900\",\n \"data-[state=open]:animate-popover-in data-[state=closed]:animate-popover-out\",\n \"data-[placement^=top]:origin-bottom data-[placement^=bottom]:origin-top\",\n \"data-[placement^=left]:origin-right data-[placement^=right]:origin-left\",\n)\n\n/** The bubble's shadow lives on the *positioner* (this wrapper), not on the\n * content. A `box-shadow` on the content paints as one unit *with* its\n * background, so it lands on top of the behind-arrow (`-z-1`) and smears\n * across the protruding tip. Hosting the shadow here reorders the paint to\n * shadow → arrow → content: the positioner's shadow sits at the back of its\n * stacking context (it's the `isolate` root), the arrow paints above it, and\n * the content background paints last — so the shadow never touches the arrow,\n * the arrow never covers the label, and the bubble keeps its shadow.\n * `rounded-xs` matches the content radius so the shadow's corners line up. */\nconst tooltipPositioner = \"rounded-xs shadow-md\"\n\n/** Inverted arrow matching the bubble surface. The `!` overrides are required\n * because Ark sets the arrow background via an inline style; `-z-1` tucks the\n * square behind the bubble so only the rotated corner pokes out as the tip. */\nconst tooltipArrow = cn(\"-z-1! rounded-xxs\", \"bg-gray-light-900! dark:bg-gray-dark-100!\")\n\n/** Resets the `<button>` Ark renders for the default trigger down to plain inline\n * text, so a Tooltip can sit on a word inside a `<p>` while staying keyboard-\n * focusable. `cursor-help` signals the hint; `[font:inherit]` matches the prose. */\nconst tooltipTrigger = cva(\n [\n \"inline cursor-help appearance-none border-0 bg-transparent p-0\",\n \"[font:inherit] text-inherit\",\n focusStyles(),\n \"rounded-xs\",\n ],\n {\n variants: {\n variant: {\n text: \"underline decoration-dotted underline-offset-2 text-gray-light-900 dark:text-gray-dark-100\",\n inline: \"\",\n },\n },\n defaultVariants: {\n variant: \"inline\",\n },\n },\n)\n\ntype TooltipPlacement = NonNullable<NonNullable<ArkTooltip.RootProps[\"positioning\"]>[\"placement\"]>\n\n/** `position` accepts Ark's physical placements plus the logical, RTL-aware\n * horizontal sides `start` / `end` (resolved to `left` / `right` by direction). */\nexport type TooltipPosition = LogicalPosition<TooltipPlacement>\n\ntype TooltipContextValue = {\n withinPortal: boolean\n container?: HTMLElement | null\n}\nconst TooltipContext = createContext<TooltipContextValue>({ withinPortal: true })\n\nexport type TooltipRootProps = Omit<ArkTooltip.RootProps, \"positioning\"> & {\n /** Bubble placement relative to the trigger. Prefer the logical `start` / `end`\n * sides (RTL-aware), or use any Ark placement (`top`, `bottom`, `top-start`, …).\n * Defaults to `\"top\"`. */\n position?: TooltipPosition\n /** Gap in px between the trigger and the bubble. */\n offset?: number\n /** Render the bubble in a Portal so it escapes clipping ancestors. Default `true`. */\n withinPortal?: boolean\n /** Portal target. Defaults to the enclosing `Modal`/`Drawer` when there is\n * one (so the panel stays above it), else `document.body`. */\n container?: HTMLElement | null\n /** Fires on close (any source) — pointer/focus leaving the trigger, Escape, or a controlled `onOpenChange`. */\n onClose?: () => void\n}\n\nconst Root = ({\n position = \"top\",\n offset,\n withinPortal = true,\n container,\n children,\n onOpenChange,\n onClose,\n ...rest\n}: TooltipRootProps) => {\n const { dir } = useLocaleContext()\n return (\n <TooltipContext.Provider value={{ withinPortal, container }}>\n {/* Mount the bubble only while shown (lazyMount + unmountOnExit): closed →\n nothing rendered, so an inline trigger never emits a positioner <div>\n into a host <p> on SSR. Both are overridable via `...rest`. */}\n <ArkTooltip.Root\n lazyMount\n unmountOnExit\n positioning={{ placement: resolveLogicalPlacement(position, dir), gutter: offset }}\n onOpenChange={(details) => {\n onOpenChange?.(details)\n if (!details.open) onClose?.()\n }}\n {...rest}\n >\n {children}\n </ArkTooltip.Root>\n </TooltipContext.Provider>\n )\n}\n\nexport type TooltipContentProps = ArkTooltip.ContentProps & WithTestId\n\nconst Content = ({ className, children, testId, ...rest }: TooltipContentProps) => {\n const { withinPortal, container } = useContext(TooltipContext)\n const portalContainer = useOverlayContainer(container)\n const bubble = (\n <ArkTooltip.Positioner className={tooltipPositioner}>\n <ArkTooltip.Content\n className={cn(tooltipContent, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {children}\n </ArkTooltip.Content>\n </ArkTooltip.Positioner>\n )\n if (!withinPortal) return bubble\n return <Portal container={portalContainer}>{bubble}</Portal>\n}\n\nexport type TooltipArrowProps = NoAsChild<ArkTooltip.ArrowProps> & WithTestId\n\n/** The little arrow linking the bubble to its trigger. Compose it inside a\n * `Tooltip.Content` (or let the convenience form's `withArrow` add it for you).\n * The CSS vars size the square (`--arrow-size`) and pull it back under the\n * bubble (`--arrow-offset`) so it reads as a pointer, not a detached diamond. */\nconst Arrow = ({ className, style, testId }: TooltipArrowProps) => (\n <ArkTooltip.Arrow\n style={{ [\"--arrow-size\" as string]: \"12px\", [\"--arrow-offset\" as string]: \"-8px\", ...style }}\n {...props({ \"data-testid\": testId })}\n >\n <ArkTooltip.ArrowTip className={cn(tooltipArrow, className)} />\n </ArkTooltip.Arrow>\n)\n\nexport type TooltipProps = TooltipRootProps &\n WithTestId & {\n /** The hint shown on hover and keyboard focus. Named `label` for parity with\n * the rest of the kit; wired as a description via Ark's `aria-describedby`. */\n label: ReactNode\n /** The trigger. By default it's wrapped in a focusable inline trigger (so it\n * drops into running text); with `asChild`, this element *is* the trigger. */\n children: ReactNode\n /** Render `children` as the trigger instead of wrapping them. */\n asChild?: boolean\n /** Add a small arrow pointing at the trigger. For the compound form, compose\n * `<Tooltip.Arrow />` inside `<Tooltip.Content>` instead. */\n withArrow?: boolean\n variant?: VariantProps<typeof tooltipTrigger>[\"variant\"]\n classNames?: { trigger?: string; content?: string; arrow?: string }\n }\n\n/** Convenience form: `Root` + `Trigger` + `Content` wired from `label`/`children`.\n * `testId` lands on `Content` (the rendered bubble) — `Root` has no DOM node\n * of its own. */\nconst TooltipComponent = ({\n label,\n children,\n asChild,\n classNames,\n withArrow,\n variant = \"inline\",\n testId,\n ...root\n}: TooltipProps) => {\n const id = `tooltip-${useId()}`\n\n return (\n <Root {...root}>\n {match({ asChild })\n .with({ asChild: true }, () => <ArkTooltip.Trigger asChild>{children}</ArkTooltip.Trigger>)\n .otherwise(() => (\n <ArkTooltip.Trigger\n asChild\n className={cn(tooltipTrigger({ variant }), classNames?.trigger)}\n >\n {/** biome-ignore lint/a11y/noNoninteractiveTabindex: This is for text inline display */}\n <span tabIndex={0} aria-describedby={id}>\n {children}\n </span>\n </ArkTooltip.Trigger>\n ))}\n <Content className={classNames?.content} id={id} testId={testId}>\n {withArrow && <Arrow className={classNames?.arrow} />}\n {label}\n </Content>\n </Root>\n )\n}\n\nexport const Tooltip = Object.assign(TooltipComponent, {\n Root,\n Trigger: ArkTooltip.Trigger,\n Content,\n Arrow,\n})\n"]}
|
|
@@ -2,7 +2,7 @@ import { useLinkComponent } from './chunk-GTKKRV5N.js';
|
|
|
2
2
|
import { useUncontrolled } from './chunk-BEL75C7N.js';
|
|
3
3
|
import { ChevronIcon } from './chunk-IG7FBZVM.js';
|
|
4
4
|
import { Collapse } from './chunk-WSIVRDRB.js';
|
|
5
|
-
import { focusStyles } from './chunk-
|
|
5
|
+
import { focusStyles } from './chunk-INJUILCN.js';
|
|
6
6
|
import { cn } from './chunk-QP4I37PA.js';
|
|
7
7
|
import { cva } from 'class-variance-authority';
|
|
8
8
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
@@ -52,6 +52,7 @@ function NavLinkImpl({
|
|
|
52
52
|
linkComponent,
|
|
53
53
|
classNames,
|
|
54
54
|
className,
|
|
55
|
+
translations,
|
|
55
56
|
children
|
|
56
57
|
}) {
|
|
57
58
|
const [isOpen, setOpen] = useUncontrolled({
|
|
@@ -101,7 +102,7 @@ function NavLinkImpl({
|
|
|
101
102
|
{
|
|
102
103
|
type: "button",
|
|
103
104
|
"aria-expanded": isOpen,
|
|
104
|
-
"aria-label": isOpen ? "Collapse" : "Expand",
|
|
105
|
+
"aria-label": isOpen ? translations?.collapseLabel ?? "Collapse" : translations?.expandLabel ?? "Expand",
|
|
105
106
|
onClick: () => setOpen(!isOpen),
|
|
106
107
|
className: chevronButton,
|
|
107
108
|
children: chevron(isOpen)
|
|
@@ -123,7 +124,7 @@ function NavLinkImpl({
|
|
|
123
124
|
function NavLink(props) {
|
|
124
125
|
return /* @__PURE__ */ jsx(NavLinkImpl, { ...props });
|
|
125
126
|
}
|
|
126
|
-
var renderItem = (item, key, linkComponent) => /* @__PURE__ */ jsx(
|
|
127
|
+
var renderItem = (item, key, linkComponent, translations) => /* @__PURE__ */ jsx(
|
|
127
128
|
NavLink,
|
|
128
129
|
{
|
|
129
130
|
label: item.label,
|
|
@@ -137,17 +138,18 @@ var renderItem = (item, key, linkComponent) => /* @__PURE__ */ jsx(
|
|
|
137
138
|
linkOptions: item.linkOptions,
|
|
138
139
|
linkComponent,
|
|
139
140
|
classNames: item.classNames,
|
|
140
|
-
|
|
141
|
+
translations,
|
|
142
|
+
children: item.items && item.items.length > 0 ? item.items.map((child, i) => renderItem(child, `${key}.${i}`, linkComponent, translations)) : void 0
|
|
141
143
|
},
|
|
142
144
|
key
|
|
143
145
|
);
|
|
144
|
-
function NavigationImpl({ data, linkComponent }) {
|
|
145
|
-
return /* @__PURE__ */ jsx(Fragment, { children: data.map((item, i) => renderItem(item, `nav-${i}`, linkComponent)) });
|
|
146
|
+
function NavigationImpl({ data, linkComponent, translations }) {
|
|
147
|
+
return /* @__PURE__ */ jsx(Fragment, { children: data.map((item, i) => renderItem(item, `nav-${i}`, linkComponent, translations)) });
|
|
146
148
|
}
|
|
147
149
|
function Navigation(props) {
|
|
148
150
|
return /* @__PURE__ */ jsx(NavigationImpl, { ...props });
|
|
149
151
|
}
|
|
150
152
|
|
|
151
153
|
export { NavLink, Navigation };
|
|
152
|
-
//# sourceMappingURL=chunk-
|
|
153
|
-
//# sourceMappingURL=chunk-
|
|
154
|
+
//# sourceMappingURL=chunk-4NNGTNPV.js.map
|
|
155
|
+
//# sourceMappingURL=chunk-4NNGTNPV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/nav-link/nav-link.tsx","../src/components/nav-link/navigation.tsx"],"names":["jsx","Fragment"],"mappings":";;;;;;;;;AAsCA,IAAM,UAAA,GAAa,GAAA;AAAA,EACjB;AAAA,IACE,iGAAA;AAAA,IACA,gCAAA;AAAA,IACA,wCAAA;AAAA,IACA,WAAA,EAAY;AAAA,IACZ;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OAAA,EAAS;AAAA,QACP,IAAA,EAAM,mFAAA;AAAA,QACN,KAAA,EAAO;AAAA;AACT,KACF;AAAA,IACA,eAAA,EAAiB,EAAE,OAAA,EAAS,KAAA;AAAM;AAEtC,CAAA;AAEA,IAAM,aAAA,GAAgB,EAAA;AAAA,EACpB,+GAAA;AAAA,EACA,gEAAA;AAAA,EACA,WAAA;AACF,CAAA;AAEA,IAAM,OAAA,GAAU,CAAC,IAAA,qBACf,GAAA;AAAA,EAAC,MAAA;AAAA,EAAA;AAAA,IACC,aAAA,EAAY,MAAA;AAAA,IACZ,YAAA,EAAY,OAAO,MAAA,GAAS,QAAA;AAAA,IAC5B,SAAA,EAAU,wFAAA;AAAA,IAEV,8BAAC,WAAA,EAAA,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,CAAA;AACpC","file":"chunk-4NNGTNPV.js","sourcesContent":["\"use client\"\n\nimport { cva } from \"class-variance-authority\"\nimport type { ElementType, ReactNode } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { useLinkComponent } from \"../../lib/link-component\"\nimport { useUncontrolled } from \"../../lib/use-uncontrolled\"\nimport { Collapse } from \"../collapse/collapse\"\nimport { ChevronIcon } from \"../popover/icons\"\n\n/**\n * NavLink — a single sidebar/nav row: leading `startSlot`, `label`, trailing\n * `endSlot`, current-page treatment, and self-nesting via `children` for\n * arbitrary-depth sub-navigation (each nested `<NavLink>` renders indented,\n * revealed with `Collapse` when the parent is `open`).\n *\n * Router-agnostic: pass whatever the target link needs as `linkOptions` (a\n * plain `{ href }` for a bare `<a>`, or a framework router's own shape, e.g.\n * TanStack Router's `{ to, params }`) — it's spread verbatim onto whatever\n * renders the link. `linkComponent` picks what that is; if omitted, it falls\n * back to the app-wide `<LinkComponentProvider>` (see `lib/link-component`),\n * then to a plain `<a>`. Generic over `linkOptions`'s shape so a router's own\n * type-safety utilities can validate/autocomplete it — see\n * `nav-link/tanstack.tsx` for a TanStack Router–typed wrapper built this way.\n *\n * A row with no `linkOptions` (a pure category / toggle heading) renders as a\n * `<button>` instead of a link. A row with both `linkOptions` and nested\n * children renders the link and its expand/collapse toggle as two separate\n * controls (a link nested inside a button, or vice versa, isn't valid HTML).\n *\n * <NavLink label=\"Dashboard\" startSlot={<Home />} linkOptions={{ href: \"/dashboard\" }} />\n * <NavLink label=\"Settings\" startSlot={<Settings />} defaultOpen>\n * <NavLink label=\"Profile\" linkOptions={{ href: \"/settings/profile\" }} />\n * <NavLink label=\"Security\" linkOptions={{ href: \"/settings/security\" }} />\n * </NavLink>\n */\n\nconst navLinkRow = cva(\n [\n \"flex min-w-0 flex-1 cursor-pointer items-center gap-2 rounded-md px-2.5 py-2 text-start text-sm\",\n \"outline-none transition-colors\",\n \"hover:bg-black/5 dark:hover:bg-white/8\",\n focusStyles(),\n \"aria-disabled:pointer-events-none aria-disabled:opacity-50\",\n ],\n {\n variants: {\n current: {\n true: \"bg-black/5 font-medium text-gray-light-900 dark:bg-white/8 dark:text-gray-dark-25\",\n false: \"text-gray-light-700 dark:text-gray-dark-200\",\n },\n },\n defaultVariants: { current: false },\n },\n)\n\nconst chevronButton = cn(\n \"flex shrink-0 cursor-pointer items-center justify-center rounded-md p-2 text-gray-light-500 transition-colors\",\n \"hover:bg-black/5 dark:text-gray-dark-400 dark:hover:bg-white/8\",\n focusStyles(),\n)\n\nconst chevron = (open: boolean) => (\n <span\n aria-hidden=\"true\"\n data-state={open ? \"open\" : \"closed\"}\n className=\"ms-auto flex shrink-0 transition-transform data-[state=open]:rotate-180 [&_svg]:size-4\"\n >\n <ChevronIcon />\n </span>\n)\n\nexport type NavLinkClassNames = {\n /** The link/button row itself. */\n row?: string\n /** The indented container holding nested `<NavLink>` children. */\n items?: string\n}\n\n/** The expand/collapse chevron's accessible names — the same keys as `Notification`'s. Only\n * rendered for a row that is both a link and has children (a pure toggle row is its own\n * button, named by its label). */\nexport type NavLinkTranslations = {\n /** While the children are revealed. Default `\"Collapse\"`. */\n collapseLabel?: string\n /** While the children are hidden. Default `\"Expand\"`. */\n expandLabel?: string\n}\n\nexport type NavLinkProps<TOptions = unknown> = {\n label: ReactNode\n /** Leading slot (icon, avatar, etc). */\n startSlot?: ReactNode\n /** Trailing slot (e.g. a count or status badge). */\n endSlot?: ReactNode\n /** Marks this as the active/current page. */\n current?: boolean\n disabled?: boolean\n /** Whether nested `children` are revealed. Uncontrolled by default. */\n open?: boolean\n defaultOpen?: boolean\n onOpenChange?: (open: boolean) => void\n /** The router's own link options — e.g. `{ href: \"/x\" }` for a plain `<a>`,\n * or `{ to: \"/x\", params: {...} }` for TanStack Router. Omit for a pure\n * category/toggle row with no link of its own. */\n linkOptions?: TOptions\n /** Overrides the `<LinkComponentProvider>` for this row only. */\n linkComponent?: ElementType\n classNames?: NavLinkClassNames\n className?: string\n /** Overrides the expand/collapse chevron's accessible names. A partial override keeps the\n * other default. */\n translations?: NavLinkTranslations\n /** Nested `<NavLink>` elements, revealed when `open`. */\n children?: ReactNode\n}\n\nfunction NavLinkImpl({\n label,\n startSlot,\n endSlot,\n current,\n disabled,\n open,\n defaultOpen,\n onOpenChange,\n linkOptions,\n linkComponent,\n classNames,\n className,\n translations,\n children,\n}: NavLinkProps) {\n const [isOpen, setOpen] = useUncontrolled<boolean>({\n value: open,\n defaultValue: defaultOpen,\n finalValue: false,\n onChange: onOpenChange,\n })\n const hasChildren = children != null\n const isLink = linkOptions != null\n const Comp = useLinkComponent(linkComponent) ?? \"a\"\n\n const content = (\n <>\n {startSlot}\n <span className=\"min-w-0 flex-1 truncate\">{label}</span>\n {endSlot}\n </>\n )\n\n const rowClassName = cn(navLinkRow({ current }), classNames?.row, className)\n\n return (\n <div>\n <div className=\"flex items-stretch gap-1\">\n {isLink ? (\n <Comp\n {...linkOptions}\n aria-current={current ? \"page\" : undefined}\n aria-disabled={disabled || undefined}\n className={rowClassName}\n >\n {content}\n </Comp>\n ) : (\n <button\n type=\"button\"\n aria-current={current ? \"page\" : undefined}\n aria-disabled={disabled || undefined}\n aria-expanded={hasChildren ? isOpen : undefined}\n disabled={disabled}\n onClick={() => hasChildren && setOpen(!isOpen)}\n className={rowClassName}\n >\n {content}\n {hasChildren && chevron(isOpen)}\n </button>\n )}\n {hasChildren && isLink && (\n <button\n type=\"button\"\n aria-expanded={isOpen}\n aria-label={\n isOpen\n ? (translations?.collapseLabel ?? \"Collapse\")\n : (translations?.expandLabel ?? \"Expand\")\n }\n onClick={() => setOpen(!isOpen)}\n className={chevronButton}\n >\n {chevron(isOpen)}\n </button>\n )}\n </div>\n {hasChildren && (\n <Collapse open={isOpen}>\n <div\n className={cn(\n \"ms-4.5 space-y-0.5 border-s border-brand-900/20 ps-2 pt-0.5 dark:border-white/15\",\n classNames?.items,\n )}\n >\n {children}\n </div>\n </Collapse>\n )}\n </div>\n )\n}\n\n/**\n * `NavLink<TOptions>` — generic so a router's own type-safety utility (e.g.\n * TanStack Router's `ValidateLinkOptions`) can validate `linkOptions` when\n * explicitly parameterized. The implementation itself stays untyped/loose\n * (the generic can't be forwarded through the JSX body); see\n * TanStack Router's own documented pattern for this exact split.\n */\nexport function NavLink<TOptions = unknown>(props: NavLinkProps<TOptions>): ReactNode\nexport function NavLink(props: NavLinkProps): ReactNode {\n return <NavLinkImpl {...props} />\n}\n","\"use client\"\n\nimport type { ElementType, ReactNode } from \"react\"\nimport { NavLink, type NavLinkClassNames, type NavLinkTranslations } from \"./nav-link\"\n\n/**\n * `Navigation` — the `data`-driven convenience wrapper over `NavLink` (same\n * relationship as `menu-data.tsx` to `menu.tsx`): pass a `data` array, get a\n * fully wired, arbitrarily-nested nav tree.\n *\n * <Navigation\n * data={[\n * { label: \"Dashboard\", startSlot: <Home />, linkOptions: { href: \"/dashboard\" } },\n * { label: \"Settings\", startSlot: <Settings />, items: [\n * { label: \"Profile\", linkOptions: { href: \"/settings/profile\" } },\n * { label: \"Security\", linkOptions: { href: \"/settings/security\" } },\n * ]},\n * ]}\n * />\n *\n * Generic over the same `TOptions` as `NavLink` — parameterize it (e.g. with\n * `TanStackLinkOptions` from `nav-link/tanstack`) to get a router's own\n * type-safety utilities validating every entry's `linkOptions`.\n */\nexport type NavigationItem<TOptions = unknown> = {\n label: ReactNode\n startSlot?: ReactNode\n endSlot?: ReactNode\n current?: boolean\n disabled?: boolean\n open?: boolean\n defaultOpen?: boolean\n onOpenChange?: (open: boolean) => void\n linkOptions?: TOptions\n classNames?: NavLinkClassNames\n /** Nested entries — an item with `items` renders its children indented,\n * revealed on expand/collapse. Recursive: nests to any depth. */\n items?: readonly NavigationItem<TOptions>[]\n}\n\nexport type NavigationProps<TOptions = unknown> = {\n /** The nav entries, in order. */\n data: readonly NavigationItem<TOptions>[]\n /** Overrides the app-wide `<LinkComponentProvider>` for every generated row. */\n linkComponent?: ElementType\n /** `NavLink`'s chevron names, forwarded to every generated row. */\n translations?: NavLinkTranslations\n}\n\nconst renderItem = (\n item: NavigationItem,\n key: string,\n linkComponent: ElementType | undefined,\n translations: NavLinkTranslations | undefined,\n): ReactNode => (\n <NavLink\n key={key}\n label={item.label}\n startSlot={item.startSlot}\n endSlot={item.endSlot}\n current={item.current}\n disabled={item.disabled}\n open={item.open}\n defaultOpen={item.defaultOpen}\n onOpenChange={item.onOpenChange}\n linkOptions={item.linkOptions}\n linkComponent={linkComponent}\n classNames={item.classNames}\n translations={translations}\n >\n {item.items && item.items.length > 0\n ? item.items.map((child, i) => renderItem(child, `${key}.${i}`, linkComponent, translations))\n : undefined}\n </NavLink>\n)\n\nfunction NavigationImpl({ data, linkComponent, translations }: NavigationProps) {\n return <>{data.map((item, i) => renderItem(item, `nav-${i}`, linkComponent, translations))}</>\n}\n\n/** Generic for the same reason as `NavLink` — see its doc comment. */\nexport function Navigation<TOptions = unknown>(props: NavigationProps<TOptions>): ReactNode\nexport function Navigation(props: NavigationProps): ReactNode {\n return <NavigationImpl {...props} />\n}\n"]}
|
|
@@ -1,14 +1,9 @@
|
|
|
1
|
+
import { devWarn } from './chunk-OC7I2CTA.js';
|
|
1
2
|
import { useLocaleContext, LocaleProvider } from '@ark-ui/react/locale';
|
|
2
3
|
import { getLocalTimeZone } from '@internationalized/date';
|
|
3
4
|
import { createContext, useSyncExternalStore, useContext, useCallback } from 'react';
|
|
4
5
|
import { jsx } from 'react/jsx-runtime';
|
|
5
6
|
|
|
6
|
-
// src/lib/intl.tsx
|
|
7
|
-
|
|
8
|
-
// src/lib/dev-warn.ts
|
|
9
|
-
function devWarn(message) {
|
|
10
|
-
console.warn(message);
|
|
11
|
-
}
|
|
12
7
|
var AUTO = "auto";
|
|
13
8
|
var DEFAULT_LOCALE = "en-US";
|
|
14
9
|
var DEFAULT_TIME_ZONE = "UTC";
|
|
@@ -77,6 +72,6 @@ var IntlProvider = ({ locale, timeZone, children }) => {
|
|
|
77
72
|
return /* @__PURE__ */ jsx(LocaleProvider, { locale: resolvedLocale, children: /* @__PURE__ */ jsx(TimeZoneContext.Provider, { value: resolvedTimeZone, children }) });
|
|
78
73
|
};
|
|
79
74
|
|
|
80
|
-
export { DEFAULT_LOCALE, DEFAULT_TIME_ZONE, IntlProvider,
|
|
81
|
-
//# sourceMappingURL=chunk-
|
|
82
|
-
//# sourceMappingURL=chunk-
|
|
75
|
+
export { DEFAULT_LOCALE, DEFAULT_TIME_ZONE, IntlProvider, useDirectionCheck, useLocale, useTimeZone };
|
|
76
|
+
//# sourceMappingURL=chunk-57BTVRRB.js.map
|
|
77
|
+
//# sourceMappingURL=chunk-57BTVRRB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/intl.tsx"],"names":[],"mappings":";;;;;;AAiCA,IAAM,IAAA,GAAO,MAAA;AAQN,IAAM,cAAA,GAAiB;AAQvB,IAAM,iBAAA,GAAoB;AAcjC,SAAS,oBAAoB,aAAA,EAA2B;AACtD,EAAA,MAAA,CAAO,gBAAA,CAAiB,kBAAkB,aAAa,CAAA;AACvD,EAAA,OAAO,MAAM,MAAA,CAAO,mBAAA,CAAoB,gBAAA,EAAkB,aAAa,CAAA;AACzE;AAEA,SAAS,mBAAA,GAAsB;AAC7B,EAAA,OAAO,UAAU,QAAA,IAAY,cAAA;AAC/B;AAEA,SAAS,yBAAA,GAA4B;AACnC,EAAA,OAAO,cAAA;AACT;AAKA,IAAM,0BAA0B,MAAM;AAAC,CAAA;AAEvC,SAAS,mBAAA,GAAsB;AAC7B,EAAA,OAAO,uBAAA;AACT;AAEA,SAAS,mBAAA,GAAsB;AAI7B,EAAA,OAAO,kBAAiB,IAAK,iBAAA;AAC/B;AAEA,SAAS,yBAAA,GAA4B;AACnC,EAAA,OAAO,iBAAA;AACT;AAEA,IAAM,eAAA,GAAkB,cAAkC,MAAS,CAAA;AAU5D,IAAM,SAAA,GAAY,CAAC,QAAA,KAA8C;AACtE,EAAA,MAAM,EAAE,MAA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MAAM,CAAA;AACvC,EAAA,MAAM,gBAAA,GAAmB,YAAY,QAAQ,CAAA;AAE7C,EAAA,uBACE,GAAA,CAAC,cAAA,EAAA,EAAe,MAAA,EAAQ,cAAA,EACtB,QAAA,kBAAA,GAAA,CAAC,eAAA,CAAgB,QAAA,EAAhB,EAAyB,KAAA,EAAO,gBAAA,EAAmB,QAAA,EAAS,CAAA,EAC/D,CAAA;AAEJ","file":"chunk-57BTVRRB.js","sourcesContent":["\"use client\"\n\nimport { LocaleProvider, useLocaleContext } from \"@ark-ui/react/locale\"\nimport { getLocalTimeZone } from \"@internationalized/date\"\nimport { createContext, type ReactNode, useCallback, useContext, useSyncExternalStore } from \"react\"\nimport { devWarn } from \"./dev-warn\"\n\n/**\n * The one seam where \"which locale\" and \"which time zone\" are decided.\n *\n * Every `Intl` constructor takes a locale as its first argument and a `timeZone` as an option,\n * and both have a runtime default — `Intl.DateTimeFormat()` resolves to Node's `en-US` on a\n * server and to the visitor's locale in a browser; `getLocalTimeZone()` resolves to the server's\n * zone (UTC on most hosts) and to the visitor's. Reading either implicitly therefore makes the\n * rendered output a property of *where the code ran*, which is a hydration mismatch waiting for\n * the first visitor configured differently from the build server. So nothing in this kit reads\n * them implicitly: components resolve both through the hooks below, and the value they get is\n * either something the app stated or a documented constant.\n *\n * Locale and time zone stay **fully independent** — separate prop, separate hook, separate\n * per-instance override, no coupling. They share only this module and `IntlProvider`'s single\n * mount point, because the resolution mechanism is the whole of the fix and writing it twice is\n * how the two would drift apart.\n *\n * Locale deliberately needs no context of its own: `IntlProvider` renders Ark's own\n * `LocaleProvider`, so Ark's state machines (`Calendar`, `DatePicker`, `NumberInput`,\n * `FileUpload`) and this kit's own formatting can only ever read one value — and `dir`/RTL comes\n * along for free for the components already reading `useLocaleContext().dir` (`menu.tsx`,\n * `tooltip.tsx`, `hover-card.tsx`). An app that mounts Ark's `LocaleProvider` directly still\n * works. Only the time zone needs a new context, since Ark has no equivalent.\n */\n\n/** Follow the host runtime. Accepted anywhere a locale or zone is: provider, or a single prop. */\nconst AUTO = \"auto\"\n\n/**\n * The locale used when nothing configures one, and what `\"auto\"` reports during SSR and the\n * hydration render. Pinned to the same tag as Ark's own `useLocaleContext()` default so the two\n * halves of a `Calendar` — Ark's machine and this kit's formatting around it — cannot disagree,\n * the same \"one constant, two readers\" reasoning `lib/theme.ts` uses for the theme storage key.\n */\nexport const DEFAULT_LOCALE = \"en-US\"\n\n/**\n * What `timeZone=\"auto\"` reports during SSR and the hydration render, before the host zone is\n * readable. Note this is *not* the default for the `timeZone` prop itself — that is `\"auto\"`\n * (see `useTimeZone`), because a wrong zone is wrong data rather than merely an unfamiliar\n * format. UTC is the one zone every runtime agrees on.\n */\nexport const DEFAULT_TIME_ZONE = \"UTC\"\n\n// `\"auto\"` is resolved through `useSyncExternalStore` with a fixed `getServerSnapshot`, the same\n// shape (and for the same reason) as `use-media-query.ts`, `use-local-storage.ts` and\n// `use-now.ts`: the server and the first client render are handed a value that cannot differ, so\n// hydration always matches, and React swaps in the real one immediately afterwards. A plain\n// `useEffect` would work too, but this way the fallback is declared once next to the real read\n// instead of living in a `useState` initializer somewhere else.\n//\n// Caveat worth knowing before reaching for `\"auto\"` under SSR, carried over from `use-theme.ts`:\n// React does not specify that the post-hydration correction lands before the browser paints, and\n// empirically it does not reliably, so the default value can be visible for a frame. That is the\n// accepted cost of opting in, and precisely why `locale` does not default to `\"auto\"`.\n\nfunction subscribeToLanguage(onStoreChange: () => void) {\n window.addEventListener(\"languagechange\", onStoreChange)\n return () => window.removeEventListener(\"languagechange\", onStoreChange)\n}\n\nfunction getLanguageSnapshot() {\n return navigator.language || DEFAULT_LOCALE\n}\n\nfunction getLanguageServerSnapshot() {\n return DEFAULT_LOCALE\n}\n\n// The host zone has no change event to listen for — a machine moving zone mid-session re-resolves\n// on the next render at worst. `subscribe` still has to return an unsubscribe function, and it\n// has to be a stable reference or `useSyncExternalStore` resubscribes on every render.\nconst unsubscribeFromTimeZone = () => {}\n\nfunction subscribeToTimeZone() {\n return unsubscribeFromTimeZone\n}\n\nfunction getTimeZoneSnapshot() {\n // `getLocalTimeZone()` is `Intl.DateTimeFormat().resolvedOptions().timeZone` behind a cache.\n // This is the only call to it left in the kit, which is the point: one reader of the ambient\n // zone, wrapped in the hydration-safe store, instead of ~13 scattered prop defaults.\n return getLocalTimeZone() || DEFAULT_TIME_ZONE\n}\n\nfunction getTimeZoneServerSnapshot() {\n return DEFAULT_TIME_ZONE\n}\n\nconst TimeZoneContext = createContext<string | undefined>(undefined)\n\n/**\n * The active locale as a concrete BCP-47 tag, never `\"auto\"` and never `undefined`.\n *\n * `override` is the component's own `locale` prop, so precedence reads\n * **prop → provider → `DEFAULT_LOCALE`** — the same shape as `useLinkComponent`.\n *\n * const locale = useLocale(props.locale)\n */\nexport const useLocale = (override?: \"auto\" | (string & {})): string => {\n const { locale: provided } = useLocaleContext()\n const requested = override ?? provided\n const hostLocale = useSyncExternalStore(\n subscribeToLanguage,\n getLanguageSnapshot,\n getLanguageServerSnapshot,\n )\n return requested === AUTO ? hostLocale : requested\n}\n\n/**\n * The active time zone as a concrete IANA name, never `\"auto\"` and never `undefined`.\n *\n * `override` is the component's own `timeZone` prop, so precedence reads\n * **prop → provider → `\"auto\"`**. The default is `\"auto\"` rather than a fixed zone because a\n * wrong zone shows wrong times, not merely an unfamiliar format — and `\"auto\"` costs a\n * client-only app nothing, since `getServerSnapshot` never runs there and the first render is\n * already the true zone.\n *\n * const timeZone = useTimeZone(props.timeZone)\n */\nexport const useTimeZone = (override?: \"auto\" | (string & {})): string => {\n const provided = useContext(TimeZoneContext)\n const requested = override ?? provided ?? AUTO\n const hostTimeZone = useSyncExternalStore(\n subscribeToTimeZone,\n getTimeZoneSnapshot,\n getTimeZoneServerSnapshot,\n )\n return requested === AUTO ? hostTimeZone : requested\n}\n\n// One warning per page, however many components run the check: the fix is a single provider at\n// the app root, so repeating the message per Tabs would only bury it.\nlet warnedDirection = false\n\n/**\n * Dev-only guard for the one RTL setup that silently breaks: direction stated on the DOM\n * (`<html dir=\"rtl\">`, or an ancestor) while no locale says so. Ark derives `dir` from the\n * locale alone and stamps it on every part, so its parts render `ltr` inside an `rtl` page —\n * and its arrow-key handling runs `ltr` too, which is why the kit can't simply let the parts\n * inherit from the DOM: the direction has to be known in JS, i.e. come from `IntlProvider`.\n *\n * Returns a callback ref for an Ark root. It reads the **parent**'s direction, since the root\n * itself carries Ark's stamped `dir`. Runs on attach, so SSR and hydration never see it.\n */\nexport const useDirectionCheck = () => {\n const { dir } = useLocaleContext()\n return useCallback(\n (node: HTMLElement | null) => {\n const parent = node?.parentElement\n if (warnedDirection || !parent) return\n // Computed rather than `closest(\"[dir]\")`, so a CSS-only `direction: rtl` counts too.\n const inherited = getComputedStyle(parent).direction\n if (inherited === dir) return\n warnedDirection = true\n devWarn(\n `[@42/ui-react] This page is dir=\"${inherited}\", but the locale resolves to dir=\"${dir}\", so Ark-backed parts (Tabs, SegmentGroup, Menu…) render and navigate ${dir}. Direction comes from the locale: wrap the app in <IntlProvider locale=\"…\"> with a matching locale. See \"Text direction\" in the Internationalization docs.`,\n )\n },\n [dir],\n )\n}\n\nexport type IntlProviderProps = {\n /** A BCP-47 tag (`\"fr-FR\"`), or `\"auto\"` to follow the browser. Inherited from an outer\n * `IntlProvider` when omitted, and `\"en-US\"` when there is none. */\n locale?: \"auto\" | (string & {})\n /** An IANA zone (`\"Europe/Paris\"`), or `\"auto\"` to follow the host. Inherited from an outer\n * `IntlProvider` when omitted, and `\"auto\"` when there is none. @default \"auto\" */\n timeZone?: \"auto\" | (string & {})\n children?: ReactNode\n}\n\n/**\n * Wrap the app once to state how it formats dates, times and numbers:\n * `<IntlProvider locale=\"fr-FR\" timeZone=\"Europe/Paris\"><App /></IntlProvider>`.\n *\n * Both props are optional and independent — setting only `timeZone` leaves the locale alone, and\n * a nested provider inherits whichever value it doesn't set, so a section can override one\n * without restating the other.\n *\n * It resolves both values and publishes the results, so `\"auto\"` is subscribed to once here\n * rather than once per component, and everything downstream — Ark's machines included — reads a\n * concrete tag and zone.\n *\n * Text direction follows the locale: `locale=\"ar\"` makes every Ark part `rtl`. `<html dir=\"rtl\">`\n * alone never reaches Ark, which is what `useDirectionCheck` warns about in development.\n *\n * This provider carries the inputs to `Intl`, and nothing else. Translated microcopy stays on\n * each component's own `translations` prop by design (`code-style.md`); there is deliberately no\n * message context here.\n */\nexport const IntlProvider = ({ locale, timeZone, children }: IntlProviderProps) => {\n const resolvedLocale = useLocale(locale)\n const resolvedTimeZone = useTimeZone(timeZone)\n\n return (\n <LocaleProvider locale={resolvedLocale}>\n <TimeZoneContext.Provider value={resolvedTimeZone}>{children}</TimeZoneContext.Provider>\n </LocaleProvider>\n )\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { resolveLogicalPlacement } from './chunk-G52U24GR.js';
|
|
2
|
-
import { popoverChrome, popoverGroupLabel, popoverIndicator, popoverChevron } from './chunk-
|
|
2
|
+
import { popoverChrome, popoverGroupLabel, popoverIndicator, popoverChevron } from './chunk-LM6F6DLR.js';
|
|
3
3
|
import { useNestedLayer } from './chunk-AIQG7IIT.js';
|
|
4
4
|
import { useOverlayContainer } from './chunk-7P32XCEU.js';
|
|
5
5
|
import { CheckIcon, ChevronIcon } from './chunk-IG7FBZVM.js';
|
|
@@ -302,5 +302,5 @@ var Separator = Divider;
|
|
|
302
302
|
var SubContent = Content;
|
|
303
303
|
|
|
304
304
|
export { CheckboxItem, Content, Context, ContextTrigger, Divider, Item, ItemGroup, ItemGroupLabel, Label, RadioGroup, RadioItem, Root, Separator, Sub, SubContent, SubTrigger, Trigger };
|
|
305
|
-
//# sourceMappingURL=chunk-
|
|
306
|
-
//# sourceMappingURL=chunk-
|
|
305
|
+
//# sourceMappingURL=chunk-64T6Z7BA.js.map
|
|
306
|
+
//# sourceMappingURL=chunk-64T6Z7BA.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/menu/menu.tsx"],"names":["ArkMenu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,EAAA,MAAM,WAAW,kBAAA,EAAmB;AACpC,EAAA,MAAM,EAAE,aAAA,EAAe,mBAAA,EAAqB,GAAG,OAAA,KAAY,IAAA,CAAK,eAAA,CAAgB,EAAE,KAAA,EAAO,CAAA;AACzF,EAAA,uBACE,GAAA;AAAA,IAAC,GAAA,CAAI,MAAA;AAAA,IAAJ;AAAA,MACE,GAAG,UAAA;AAAA,QACF;AAAA,UACE,GAAG,OAAA;AAAA,UACH,eAAA,EAAiB,QAAA,CAAS,SAAA,GAAY,MAAA,GAAY,QAAQ,eAAe,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UAKzE,WAAA,EAAa,CAAC,KAAA,KAAqB,KAAA,CAAM,cAAA;AAAe,SAC1D;AAAA;AAAA;AAAA;AAAA;AAAA,QAKA,EAAE,GAAG,IAAA,EAAM,WAAW,EAAA,CAAG,aAAA,EAAe,SAAS,CAAA;AAAE,OACrD;AAAA,MACA;AAAA;AAAA,GACF;AAEJ;AAGO,IAAM,iBAAiBA,IAAA,CAAQ;AAC/B,IAAM,YAAYA,IAAA,CAAQ;AAC1B,IAAM,UAAUA,IAAA,CAAQ;AAExB,IAAM,SAAA,GAAY;AAElB,IAAM,UAAA,GAAa","file":"chunk-S2HWWR2H.js","sourcesContent":["\"use client\"\n\nimport { ark } from \"@ark-ui/react/factory\"\nimport { useLocaleContext } from \"@ark-ui/react/locale\"\nimport { Menu as ArkMenu, useMenuContext } from \"@ark-ui/react/menu\"\nimport { Portal } from \"@ark-ui/react/portal\"\nimport { usePresenceContext } from \"@ark-ui/react/presence\"\nimport { mergeProps } from \"@ark-ui/react/utils\"\nimport { cva } from \"class-variance-authority\"\nimport {\n type ComponentPropsWithoutRef,\n createContext,\n type DragEvent,\n type ReactNode,\n type Ref,\n useContext,\n useId,\n} from \"react\"\nimport { composeChildren } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { useOverlayContainer } from \"../../lib/overlay-container\"\nimport { useNestedLayer } from \"../../lib/overlay-layer\"\nimport { type LogicalPosition, resolveLogicalPlacement } from \"../../lib/placement\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { CheckIcon, ChevronIcon } from \"../popover/icons\"\nimport {\n popoverChevron,\n popoverChrome,\n popoverGroupLabel,\n popoverIndicator,\n} from \"../popover/popover\"\n\n/**\n * Menu — the kit's dropdown of actions, a styled layer over Ark UI's Menu.\n * It's the click-triggered sibling of `Popover` (a free-form panel): Ark's Menu\n * machine wires roving focus, type-ahead, `role=\"menu\"` / `menuitem`,\n * `aria-haspopup` / `aria-expanded`, submenus, and checkbox / radio selection.\n *\n * Two ways to use it — the compound parts (this file) give full control; the\n * data-driven `<Menu data={…}>` convenience (see `menu-data.tsx`) covers the\n * common action-menu case and is built on these very parts.\n *\n * <Menu.Root>\n * <Menu.Trigger asChild><Button>Open</Button></Menu.Trigger>\n * <Menu.Content>\n * <Menu.Item startSection={<User />} onClick={openProfile}>Profile</Menu.Item>\n * <Menu.Divider />\n * <Menu.Item color=\"red\" startSection={<Trash />} onClick={remove}>Delete</Menu.Item>\n * </Menu.Content>\n * </Menu.Root>\n *\n * Portaled by default (escapes `overflow:hidden` ancestors), sized to content,\n * and animated via the kit's shared `popover-in/out` tokens.\n */\n\n/** Menu surface — the shared floating chrome, sized to content and scrollable\n * when tall. Unlike the form pickers' `popoverContent` (an `overflow-hidden`\n * clip around a nested scroller) a Menu scrolls natively, so Ark needs no\n * `scrollToIndexFn` workaround. */\nconst menuContent = cn(\n popoverChrome,\n \"flex w-max min-w-40 flex-col p-1\",\n \"max-h-[min(24rem,var(--available-height,24rem))] overflow-y-auto overscroll-contain\",\n)\n\n/** A single menu row — shared by `Item`, `CheckboxItem`, `RadioItem`, and\n * `SubTrigger` so every row is visually identical. Mirrors `popoverOption`'s\n * neutral look, but the `colored` variant swaps the text + highlight tints to\n * the palette slot vars (`--c-text` / `--c-soft`) resolved from `data-color` —\n * e.g. a red \"Delete\". Highlight is `data-highlighted`, selection is\n * `data-[state=checked]`, disabled is `data-disabled`, all owned by Ark. */\nconst menuItem = cva(\n [\n \"relative flex cursor-pointer items-center gap-2 rounded-xs px-2.5 py-1.5 text-md\",\n \"select-none outline-none\",\n \"data-[state=checked]:font-medium\",\n \"data-disabled:pointer-events-none data-disabled:opacity-50\",\n ],\n {\n variants: {\n colored: {\n // Neutral highlight is transparent — a low-opacity black/white wash,\n // not an opaque gray — matching the surface's own background-dependent\n // tint (no Figma reference for this state yet).\n false: [\n \"text-gray-light-900 dark:text-gray-dark-100\",\n \"data-highlighted:bg-black/5 dark:data-highlighted:bg-white/8\",\n ],\n // Slot vars already shift by theme (colors.css), so no `dark:` needed.\n true: [\"text-(--c-text)\", \"data-highlighted:bg-(--c-soft)\"],\n },\n },\n defaultVariants: { colored: false },\n },\n)\n\n/** Hairline between groups of items. Same shade as Popover's own\n * Header/Footer/Body slotEdge dividers (brand-900/20 / white/15) — both are\n * separator lines on the identical popoverChrome panel, so they shouldn't\n * drift to different weights. */\nconst menuDivider = \"-mx-1 my-1 h-px border-0 bg-brand-900/20 dark:bg-white/15\"\n\ntype MenuPlacement = NonNullable<NonNullable<ArkMenu.RootProps[\"positioning\"]>[\"placement\"]>\n\n/** `position` accepts Ark's physical placements plus the logical, RTL-aware\n * horizontal sides `start` / `end` (resolved to `left` / `right` by direction). */\nexport type MenuPosition = LogicalPosition<MenuPlacement>\n\ntype MenuContextValue = {\n withinPortal: boolean\n container?: HTMLElement | null\n}\nconst MenuContext = createContext<MenuContextValue>({ withinPortal: true })\n\nexport type MenuRootProps = Omit<ArkMenu.RootProps, \"positioning\" | \"onOpenChange\"> & {\n /** Dropdown placement relative to the trigger. Prefer the logical `start` / `end`\n * sides (RTL-aware), or use any Ark placement (`bottom-start`, `top`, …).\n * Defaults to `\"bottom-start\"`. */\n position?: MenuPosition\n /** Gap in px between the trigger and the dropdown. */\n offset?: number\n /** Render the dropdown in a Portal so it escapes clipping ancestors. Default `true`. */\n withinPortal?: boolean\n /** Portal target. Defaults to the enclosing `Modal`/`Drawer` when there is\n * one (so the panel stays above it), else `document.body`. */\n container?: HTMLElement | null\n /** Called when the menu opens or closes (flattened from Ark's detail object). */\n onOpenChange?: (open: boolean) => void\n /** Fires on close (any source) — Escape, outside interaction, item selection, or a controlled `onOpenChange`. */\n onClose?: () => void\n}\n\n/**\n * Selects a link item (`<Menu.Item asChild><Link/></Menu.Item>`) from the\n * keyboard. zag's default `navigate` dispatches `new MouseEvent(\"click\")`,\n * which doesn't bubble, so React's delegated `onClick` never sees it and a\n * router `Link` falls back to a full page load. `node.click()` dispatches a\n * bubbling click instead, which reaches the router. Deferred like zag's own,\n * so the menu settles before the navigation starts. A `navigate` prop still\n * overrides it.\n */\nconst clickLink: NonNullable<ArkMenu.RootProps[\"navigate\"]> = ({ node }) => {\n queueMicrotask(() => node.click())\n}\n\nconst Root = ({\n position = \"bottom\",\n offset,\n withinPortal = true,\n container,\n onOpenChange,\n onClose,\n children,\n ...rest\n}: MenuRootProps) => {\n const { dir } = useLocaleContext()\n return (\n <MenuContext.Provider value={{ withinPortal, container }}>\n <ArkMenu.Root\n positioning={{ placement: resolveLogicalPlacement(position, dir), gutter: offset }}\n navigate={clickLink}\n onOpenChange={({ open }) => {\n onOpenChange?.(open)\n if (!open) onClose?.()\n }}\n {...rest}\n >\n {children}\n </ArkMenu.Root>\n </MenuContext.Provider>\n )\n}\n\nexport type MenuContentProps = ArkMenu.ContentProps & WithTestId\n\nconst Content = ({ className, children, testId, ...rest }: MenuContentProps) => {\n const { withinPortal, container } = useContext(MenuContext)\n const portalContainer = useOverlayContainer(container)\n // Holds an enclosing Modal/Drawer/Popover open while the menu is; see `lib/overlay-layer.tsx`.\n useNestedLayer(useMenuContext().open)\n const panel = (\n <ArkMenu.Positioner>\n <ArkMenu.Content\n className={cn(menuContent, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {children}\n </ArkMenu.Content>\n </ArkMenu.Positioner>\n )\n if (!withinPortal) return panel\n return <Portal container={portalContainer}>{panel}</Portal>\n}\n\n/** Shared inline-start wrapper for a `startSection`. Sizes a bare icon to 16px\n * (`size-4`, like Button `md` / Input / Accordion) so every row's label starts\n * on the same column whatever icon it carries. Scoped to this slot — not the\n * whole row — so SVGs in `children` / `endSection` and the row's own indicator\n * or chevron keep their sizes. `:where()` drops the rule to zero class\n * specificity, so a size class on the icon itself (`className=\"size-5\"`) still\n * wins; Lucide's `size` prop is only an HTML attribute and does not. */\nconst StartSection = ({ children }: { children: ReactNode }) => (\n <span className=\"inline-flex shrink-0 items-center [:where(&)_svg]:size-4\">{children}</span>\n)\n\n/** Shared inline-end wrapper for a `endSection` (pushes it to the far edge). */\nconst EndSection = ({ children }: { children: ReactNode }) => (\n <span className=\"ms-auto inline-flex shrink-0 items-center gap-2 text-gray-light-500 dark:text-gray-dark-400\">\n {children}\n </span>\n)\n\nexport type MenuItemProps = Omit<ArkMenu.ItemProps, \"value\" | \"onClick\" | \"onSelect\"> &\n WithTestId & {\n /** Unique value — used for type-ahead + the selection detail. Auto-generated\n * when omitted (Mantine-style items need no explicit value). */\n value?: string\n /** Content before the label (usually an icon — a bare SVG is sized to 16px;\n * a size class on the icon overrides it). */\n startSection?: ReactNode\n /** Content after the label, pushed to the inline-end. */\n endSection?: ReactNode\n /** Palette for the row — colors the label + highlight tint (e.g. `\"red\"` for a\n * destructive action). Resolved from `data-color` via the slot vars. */\n color?: Color\n /** Fires when the item is selected — on click *and* keyboard activation\n * (Enter / Space), not just a pointer click. Wraps Ark's `onSelect`. */\n onClick?: () => void\n }\n\nconst Item = ({\n value,\n startSection,\n endSection,\n color,\n onClick,\n className,\n children,\n testId,\n asChild,\n ...rest\n}: MenuItemProps) => {\n const autoId = useId()\n return (\n <ArkMenu.Item\n asChild={asChild}\n value={value ?? autoId}\n onSelect={onClick}\n data-color={color}\n className={cn(menuItem({ colored: color != null }), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {composeChildren(asChild, children, (own) => (\n <>\n {startSection != null && <StartSection>{startSection}</StartSection>}\n {own}\n {endSection != null && <EndSection>{endSection}</EndSection>}\n </>\n ))}\n </ArkMenu.Item>\n )\n}\n\n/** Optional decorative leader for a section heading — the code-themed `// ` from\n * `Text`'s `prefix`. Hidden from screen readers and the clipboard\n * (`aria-hidden` + `select-none`); renders nothing when unset (off by default). */\nconst HeadingPrefix = ({ prefix }: { prefix: ReactNode }) =>\n prefix === undefined ? null : (\n <span aria-hidden=\"true\" className=\"select-none\">\n {prefix}\n </span>\n )\n\nexport type MenuLabelProps = Omit<ComponentPropsWithoutRef<\"div\">, \"prefix\"> &\n WithTestId & {\n /** Decorative leader before the label (e.g. `\"// \"`). Off by default; hidden\n * from screen readers and the clipboard. */\n prefix?: ReactNode\n }\n\n/** Standalone section heading (Mantine parity). For grouped items with proper\n * ARIA wiring, prefer `Menu.ItemGroup` + `Menu.ItemGroupLabel`. */\nconst Label = ({ className, prefix, children, testId, ...rest }: MenuLabelProps) => (\n <div className={cn(popoverGroupLabel, className)} {...props({ \"data-testid\": testId })} {...rest}>\n <HeadingPrefix prefix={prefix} />\n {children}\n </div>\n)\n\nexport type MenuItemGroupLabelProps = Omit<ArkMenu.ItemGroupLabelProps, \"prefix\"> &\n WithTestId & {\n /** Decorative leader before the label (e.g. `\"// \"`). Off by default; hidden\n * from screen readers and the clipboard. */\n prefix?: ReactNode\n }\n\nconst ItemGroupLabel = ({\n className,\n prefix,\n children,\n testId,\n asChild,\n ...rest\n}: MenuItemGroupLabelProps) => (\n <ArkMenu.ItemGroupLabel\n asChild={asChild}\n className={cn(popoverGroupLabel, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {composeChildren(asChild, children, (own) => (\n <>\n <HeadingPrefix prefix={prefix} />\n {own}\n </>\n ))}\n </ArkMenu.ItemGroupLabel>\n)\n\nconst Divider = ({ className, testId, ...rest }: ArkMenu.SeparatorProps & WithTestId) => (\n <ArkMenu.Separator\n className={cn(menuDivider, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type MenuCheckboxItemProps = ArkMenu.CheckboxItemProps &\n WithTestId & {\n startSection?: ReactNode\n color?: Color\n }\n\nconst CheckboxItem = ({\n startSection,\n color,\n className,\n children,\n testId,\n asChild,\n ...rest\n}: MenuCheckboxItemProps) => (\n <ArkMenu.CheckboxItem\n asChild={asChild}\n data-color={color}\n className={cn(menuItem({ colored: color != null }), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {composeChildren(asChild, children, (own) => (\n <>\n {startSection != null && <StartSection>{startSection}</StartSection>}\n {own}\n <ArkMenu.ItemIndicator className={popoverIndicator}>\n <CheckIcon />\n </ArkMenu.ItemIndicator>\n </>\n ))}\n </ArkMenu.CheckboxItem>\n)\n\nexport type MenuRadioGroupProps = Omit<\n ArkMenu.RadioItemGroupProps,\n \"onValueChange\" | \"onChange\"\n> & {\n /** Called with the newly selected value (flattened from Ark's detail object). */\n onChange?: (value: string) => void\n}\n\nconst RadioGroup = ({ onChange, ...rest }: MenuRadioGroupProps) => (\n <ArkMenu.RadioItemGroup\n onValueChange={onChange ? ({ value }) => onChange(value) : undefined}\n {...rest}\n />\n)\n\nexport type MenuRadioItemProps = ArkMenu.RadioItemProps &\n WithTestId & {\n startSection?: ReactNode\n color?: Color\n }\n\nconst RadioItem = ({\n startSection,\n color,\n className,\n children,\n testId,\n asChild,\n ...rest\n}: MenuRadioItemProps) => (\n <ArkMenu.RadioItem\n asChild={asChild}\n data-color={color}\n className={cn(menuItem({ colored: color != null }), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {composeChildren(asChild, children, (own) => (\n <>\n {startSection != null && <StartSection>{startSection}</StartSection>}\n {own}\n <ArkMenu.ItemIndicator className={popoverIndicator}>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"lucide lucide-dot-big\"\n aria-hidden=\"true\"\n >\n <title>Dot big</title>\n <circle cx=\"12.1\" cy=\"12.1\" r=\"4\"></circle>\n </svg>\n </ArkMenu.ItemIndicator>\n </>\n ))}\n </ArkMenu.RadioItem>\n)\n\nexport type MenuSubProps = Omit<ArkMenu.RootProps, \"positioning\"> & {\n /** Gap in px between the trigger row and the submenu. Ark manages submenu\n * *placement* itself (RTL-aware `right-start` / `left-start`, flush to the\n * parent), so only this main-axis gap is adjustable. Defaults to `10`. */\n offset?: number\n}\n\n/** A submenu opens flush to its trigger row, so its first item lands one surface\n * inset *below* the trigger — the `menuContent` top border (1px) + top padding\n * (`p-1` = 4px). Nudging the submenu up by that inset lines the first sub-item\n * up with the trigger row. Cross-axis is the vertical axis for the (Ark-forced)\n * `right-start` / `left-start` placements, and Floating UI maps a negative value\n * to \"up\" in both directions — so one constant covers LTR and RTL. */\nconst SUBMENU_ALIGN_OFFSET = -5\n\n/** Submenu root — a nested Ark Menu whose triggering row is `Menu.SubTrigger`.\n * Inherits the parent's portal settings via context (see `Menu.SubContent`).\n *\n * Ark's menu machine hard-overrides a submenu's placement and `gutter` (to `0`),\n * so a `gutter`-based offset is silently dropped. It leaves `offset` untouched,\n * and Floating UI resolves the axes as `offset.mainAxis ?? gutter` (the gap) and\n * `offset.crossAxis` (the top alignment) — so the whole `offset` object is the\n * one path that survives the override. */\nconst Sub = ({ offset = 10, children, ...rest }: MenuSubProps) => (\n <ArkMenu.Root\n positioning={{ offset: { mainAxis: offset, crossAxis: SUBMENU_ALIGN_OFFSET } }}\n navigate={clickLink}\n {...rest}\n >\n {children}\n </ArkMenu.Root>\n)\n\nexport type MenuSubTriggerProps = ArkMenu.TriggerItemProps &\n WithTestId & {\n startSection?: ReactNode\n color?: Color\n }\n\nconst SubTrigger = ({\n startSection,\n color,\n className,\n children,\n testId,\n asChild,\n ...rest\n}: MenuSubTriggerProps) => (\n <ArkMenu.TriggerItem\n asChild={asChild}\n data-color={color}\n className={cn(menuItem({ colored: color != null }), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {composeChildren(asChild, children, (own) => (\n <>\n {startSection != null && <StartSection>{startSection}</StartSection>}\n {own}\n <span\n className={cn(popoverChevron, \"ms-auto -me-1 -rotate-90 rtl:rotate-90 [&_svg]:size-4\")}\n >\n <ChevronIcon />\n </span>\n </>\n ))}\n </ArkMenu.TriggerItem>\n)\n\nexport {\n CheckboxItem,\n Content,\n Divider,\n Item,\n ItemGroupLabel,\n Label,\n RadioGroup,\n RadioItem,\n Root,\n Sub,\n SubTrigger,\n}\n\nexport type MenuTriggerProps = ArkMenu.TriggerProps & { ref?: Ref<HTMLButtonElement> }\n\n/** Ark's `Menu.Trigger` minus one handler. Zag's trigger calls `preventDefault()`\n * on `pointerdown`, which cancels the browser's own mouse-down focus of the\n * button. With no pointer-initiated focus on record, Chromium treats every\n * later *programmatic* focus as keyboard-like: Zag's `focus()` on the content\n * when the menu opens, and its `focus()` back on the trigger when it closes,\n * both match `:focus-visible`, so a mouse user gets the keyboard ring on the\n * trigger after every menu interaction (#227).\n *\n * Leaving `pointerdown` alone restores the platform behaviour — the click\n * focuses the button without a ring, and the programmatic focuses that follow\n * inherit that. Keyboard users keep the ring, since a Tab/Enter/Escape still\n * marks the focus as keyboard-driven. It's also how Zag's own Popover trigger\n * behaves (it never cancels `pointerdown`). */\nexport const Trigger = ({ ref, value, className, ...rest }: MenuTriggerProps) => {\n const menu = useMenuContext()\n const presence = usePresenceContext()\n const { onPointerDown: _cancelsNativeFocus, ...trigger } = menu.getTriggerProps({ value })\n return (\n <ark.button\n {...mergeProps(\n {\n ...trigger,\n \"aria-controls\": presence.unmounted ? undefined : trigger[\"aria-controls\"],\n // The canceled `pointerdown` also blocked a native drag as a side\n // effect: an `asChild` `<a href>`, or the `<img>` of an avatar\n // trigger, would otherwise lift a drag ghost off the trigger.\n // Canceling `dragstart` instead leaves the press, and its focus, alone.\n onDragStart: (event: DragEvent) => event.preventDefault(),\n },\n // Same side effect for text: a double-click or drag on a non-button\n // trigger (`asChild` + `<span role=\"button\">`) would select its label.\n // CSS restores that. It lands on the `asChild` child too, and the\n // consumer's `className` comes last so it can override it.\n { ...rest, className: cn(\"select-none\", className) },\n )}\n ref={ref}\n />\n )\n}\n\n/** Ark parts re-exported unchanged (no styling needed). */\nexport const ContextTrigger = ArkMenu.ContextTrigger\nexport const ItemGroup = ArkMenu.ItemGroup\nexport const Context = ArkMenu.Context\n/** Alias for `Divider` (Ark's name for the same part). */\nexport const Separator = Divider\n/** Submenu dropdown — identical surface + portalling to `Menu.Content`. */\nexport const SubContent = Content\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/menu/menu.tsx"],"names":["ArkMenu"],"mappings":";;;;;;;;;;;;;;;;;;AA6DA,IAAM,WAAA,GAAc,EAAA;AAAA,EAClB,aAAA;AAAA,EACA,kCAAA;AAAA,EACA;AACF,CAAA;AAQA,IAAM,QAAA,GAAW,GAAA;AAAA,EACf;AAAA,IACE,kFAAA;AAAA,IACA,0BAAA;AAAA,IACA,kCAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OAAA,EAAS;AAAA;AAAA;AAAA;AAAA,QAIP,KAAA,EAAO;AAAA,UACL,6CAAA;AAAA,UACA;AAAA,SACF;AAAA;AAAA,QAEA,IAAA,EAAM,CAAC,iBAAA,EAAmB,gCAAgC;AAAA;AAC5D,KACF;AAAA,IACA,eAAA,EAAiB,EAAE,OAAA,EAAS,KAAA;AAAM;AAEtC,CAAA;AAMA,IAAM,WAAA,GAAc,2DAAA;AAYpB,IAAM,WAAA,GAAc,aAAA,CAAgC,EAAE,YAAA,EAAc,MAAM,CAAA;AA6B1E,IAAM,SAAA,GAAwD,CAAC,EAAE,IAAA,EAAK,KAAM;AAC1E,EAAA,cAAA,CAAe,MAAM,IAAA,CAAK,KAAA,EAAO,CAAA;AACnC,CAAA;A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Aa","file":"chunk-64T6Z7BA.js","sourcesContent":["\"use client\"\n\nimport { ark } from \"@ark-ui/react/factory\"\nimport { useLocaleContext } from \"@ark-ui/react/locale\"\nimport { Menu as ArkMenu, useMenuContext } from \"@ark-ui/react/menu\"\nimport { Portal } from \"@ark-ui/react/portal\"\nimport { usePresenceContext } from \"@ark-ui/react/presence\"\nimport { mergeProps } from \"@ark-ui/react/utils\"\nimport { cva } from \"class-variance-authority\"\nimport {\n type ComponentPropsWithoutRef,\n createContext,\n type DragEvent,\n type ReactNode,\n type Ref,\n useContext,\n useId,\n} from \"react\"\nimport { composeChildren } from \"../../lib/as-child\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { useOverlayContainer } from \"../../lib/overlay-container\"\nimport { useNestedLayer } from \"../../lib/overlay-layer\"\nimport { type LogicalPosition, resolveLogicalPlacement } from \"../../lib/placement\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { CheckIcon, ChevronIcon } from \"../popover/icons\"\nimport {\n popoverChevron,\n popoverChrome,\n popoverGroupLabel,\n popoverIndicator,\n} from \"../popover/popover\"\n\n/**\n * Menu — the kit's dropdown of actions, a styled layer over Ark UI's Menu.\n * It's the click-triggered sibling of `Popover` (a free-form panel): Ark's Menu\n * machine wires roving focus, type-ahead, `role=\"menu\"` / `menuitem`,\n * `aria-haspopup` / `aria-expanded`, submenus, and checkbox / radio selection.\n *\n * Two ways to use it — the compound parts (this file) give full control; the\n * data-driven `<Menu data={…}>` convenience (see `menu-data.tsx`) covers the\n * common action-menu case and is built on these very parts.\n *\n * <Menu.Root>\n * <Menu.Trigger asChild><Button>Open</Button></Menu.Trigger>\n * <Menu.Content>\n * <Menu.Item startSection={<User />} onClick={openProfile}>Profile</Menu.Item>\n * <Menu.Divider />\n * <Menu.Item color=\"red\" startSection={<Trash />} onClick={remove}>Delete</Menu.Item>\n * </Menu.Content>\n * </Menu.Root>\n *\n * Portaled by default (escapes `overflow:hidden` ancestors), sized to content,\n * and animated via the kit's shared `popover-in/out` tokens.\n */\n\n/** Menu surface — the shared floating chrome, sized to content and scrollable\n * when tall. Unlike the form pickers' `popoverContent` (an `overflow-hidden`\n * clip around a nested scroller) a Menu scrolls natively, so Ark needs no\n * `scrollToIndexFn` workaround. */\nconst menuContent = cn(\n popoverChrome,\n \"flex w-max min-w-40 flex-col p-1\",\n \"max-h-[min(24rem,var(--available-height,24rem))] overflow-y-auto overscroll-contain\",\n)\n\n/** A single menu row — shared by `Item`, `CheckboxItem`, `RadioItem`, and\n * `SubTrigger` so every row is visually identical. Mirrors `popoverOption`'s\n * neutral look, but the `colored` variant swaps the text + highlight tints to\n * the palette slot vars (`--c-text` / `--c-soft`) resolved from `data-color` —\n * e.g. a red \"Delete\". Highlight is `data-highlighted`, selection is\n * `data-[state=checked]`, disabled is `data-disabled`, all owned by Ark. */\nconst menuItem = cva(\n [\n \"relative flex cursor-pointer items-center gap-2 rounded-xs px-2.5 py-1.5 text-md\",\n \"select-none outline-none\",\n \"data-[state=checked]:font-medium\",\n \"data-disabled:pointer-events-none data-disabled:opacity-50\",\n ],\n {\n variants: {\n colored: {\n // Neutral highlight is transparent — a low-opacity black/white wash,\n // not an opaque gray — matching the surface's own background-dependent\n // tint (no Figma reference for this state yet).\n false: [\n \"text-gray-light-900 dark:text-gray-dark-100\",\n \"data-highlighted:bg-black/5 dark:data-highlighted:bg-white/8\",\n ],\n // Slot vars already shift by theme (colors.css), so no `dark:` needed.\n true: [\"text-(--c-text)\", \"data-highlighted:bg-(--c-soft)\"],\n },\n },\n defaultVariants: { colored: false },\n },\n)\n\n/** Hairline between groups of items. Same shade as Popover's own\n * Header/Footer/Body slotEdge dividers (brand-900/20 / white/15) — both are\n * separator lines on the identical popoverChrome panel, so they shouldn't\n * drift to different weights. */\nconst menuDivider = \"-mx-1 my-1 h-px border-0 bg-brand-900/20 dark:bg-white/15\"\n\ntype MenuPlacement = NonNullable<NonNullable<ArkMenu.RootProps[\"positioning\"]>[\"placement\"]>\n\n/** `position` accepts Ark's physical placements plus the logical, RTL-aware\n * horizontal sides `start` / `end` (resolved to `left` / `right` by direction). */\nexport type MenuPosition = LogicalPosition<MenuPlacement>\n\ntype MenuContextValue = {\n withinPortal: boolean\n container?: HTMLElement | null\n}\nconst MenuContext = createContext<MenuContextValue>({ withinPortal: true })\n\nexport type MenuRootProps = Omit<ArkMenu.RootProps, \"positioning\" | \"onOpenChange\"> & {\n /** Dropdown placement relative to the trigger. Prefer the logical `start` / `end`\n * sides (RTL-aware), or use any Ark placement (`bottom-start`, `top`, …).\n * Defaults to `\"bottom-start\"`. */\n position?: MenuPosition\n /** Gap in px between the trigger and the dropdown. */\n offset?: number\n /** Render the dropdown in a Portal so it escapes clipping ancestors. Default `true`. */\n withinPortal?: boolean\n /** Portal target. Defaults to the enclosing `Modal`/`Drawer` when there is\n * one (so the panel stays above it), else `document.body`. */\n container?: HTMLElement | null\n /** Called when the menu opens or closes (flattened from Ark's detail object). */\n onOpenChange?: (open: boolean) => void\n /** Fires on close (any source) — Escape, outside interaction, item selection, or a controlled `onOpenChange`. */\n onClose?: () => void\n}\n\n/**\n * Selects a link item (`<Menu.Item asChild><Link/></Menu.Item>`) from the\n * keyboard. zag's default `navigate` dispatches `new MouseEvent(\"click\")`,\n * which doesn't bubble, so React's delegated `onClick` never sees it and a\n * router `Link` falls back to a full page load. `node.click()` dispatches a\n * bubbling click instead, which reaches the router. Deferred like zag's own,\n * so the menu settles before the navigation starts. A `navigate` prop still\n * overrides it.\n */\nconst clickLink: NonNullable<ArkMenu.RootProps[\"navigate\"]> = ({ node }) => {\n queueMicrotask(() => node.click())\n}\n\nconst Root = ({\n position = \"bottom\",\n offset,\n withinPortal = true,\n container,\n onOpenChange,\n onClose,\n children,\n ...rest\n}: MenuRootProps) => {\n const { dir } = useLocaleContext()\n return (\n <MenuContext.Provider value={{ withinPortal, container }}>\n <ArkMenu.Root\n positioning={{ placement: resolveLogicalPlacement(position, dir), gutter: offset }}\n navigate={clickLink}\n onOpenChange={({ open }) => {\n onOpenChange?.(open)\n if (!open) onClose?.()\n }}\n {...rest}\n >\n {children}\n </ArkMenu.Root>\n </MenuContext.Provider>\n )\n}\n\nexport type MenuContentProps = ArkMenu.ContentProps & WithTestId\n\nconst Content = ({ className, children, testId, ...rest }: MenuContentProps) => {\n const { withinPortal, container } = useContext(MenuContext)\n const portalContainer = useOverlayContainer(container)\n // Holds an enclosing Modal/Drawer/Popover open while the menu is; see `lib/overlay-layer.tsx`.\n useNestedLayer(useMenuContext().open)\n const panel = (\n <ArkMenu.Positioner>\n <ArkMenu.Content\n className={cn(menuContent, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {children}\n </ArkMenu.Content>\n </ArkMenu.Positioner>\n )\n if (!withinPortal) return panel\n return <Portal container={portalContainer}>{panel}</Portal>\n}\n\n/** Shared inline-start wrapper for a `startSection`. Sizes a bare icon to 16px\n * (`size-4`, like Button `md` / Input / Accordion) so every row's label starts\n * on the same column whatever icon it carries. Scoped to this slot — not the\n * whole row — so SVGs in `children` / `endSection` and the row's own indicator\n * or chevron keep their sizes. `:where()` drops the rule to zero class\n * specificity, so a size class on the icon itself (`className=\"size-5\"`) still\n * wins; Lucide's `size` prop is only an HTML attribute and does not. */\nconst StartSection = ({ children }: { children: ReactNode }) => (\n <span className=\"inline-flex shrink-0 items-center [:where(&)_svg]:size-4\">{children}</span>\n)\n\n/** Shared inline-end wrapper for a `endSection` (pushes it to the far edge). */\nconst EndSection = ({ children }: { children: ReactNode }) => (\n <span className=\"ms-auto inline-flex shrink-0 items-center gap-2 text-gray-light-500 dark:text-gray-dark-400\">\n {children}\n </span>\n)\n\nexport type MenuItemProps = Omit<ArkMenu.ItemProps, \"value\" | \"onClick\" | \"onSelect\"> &\n WithTestId & {\n /** Unique value — used for type-ahead + the selection detail. Auto-generated\n * when omitted (Mantine-style items need no explicit value). */\n value?: string\n /** Content before the label (usually an icon — a bare SVG is sized to 16px;\n * a size class on the icon overrides it). */\n startSection?: ReactNode\n /** Content after the label, pushed to the inline-end. */\n endSection?: ReactNode\n /** Palette for the row — colors the label + highlight tint (e.g. `\"red\"` for a\n * destructive action). Resolved from `data-color` via the slot vars. */\n color?: Color\n /** Fires when the item is selected — on click *and* keyboard activation\n * (Enter / Space), not just a pointer click. Wraps Ark's `onSelect`. */\n onClick?: () => void\n }\n\nconst Item = ({\n value,\n startSection,\n endSection,\n color,\n onClick,\n className,\n children,\n testId,\n asChild,\n ...rest\n}: MenuItemProps) => {\n const autoId = useId()\n return (\n <ArkMenu.Item\n asChild={asChild}\n value={value ?? autoId}\n onSelect={onClick}\n data-color={color}\n className={cn(menuItem({ colored: color != null }), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {composeChildren(asChild, children, (own) => (\n <>\n {startSection != null && <StartSection>{startSection}</StartSection>}\n {own}\n {endSection != null && <EndSection>{endSection}</EndSection>}\n </>\n ))}\n </ArkMenu.Item>\n )\n}\n\n/** Optional decorative leader for a section heading — the code-themed `// ` from\n * `Text`'s `prefix`. Hidden from screen readers and the clipboard\n * (`aria-hidden` + `select-none`); renders nothing when unset (off by default). */\nconst HeadingPrefix = ({ prefix }: { prefix: ReactNode }) =>\n prefix === undefined ? null : (\n <span aria-hidden=\"true\" className=\"select-none\">\n {prefix}\n </span>\n )\n\nexport type MenuLabelProps = Omit<ComponentPropsWithoutRef<\"div\">, \"prefix\"> &\n WithTestId & {\n /** Decorative leader before the label (e.g. `\"// \"`). Off by default; hidden\n * from screen readers and the clipboard. */\n prefix?: ReactNode\n }\n\n/** Standalone section heading (Mantine parity). For grouped items with proper\n * ARIA wiring, prefer `Menu.ItemGroup` + `Menu.ItemGroupLabel`. */\nconst Label = ({ className, prefix, children, testId, ...rest }: MenuLabelProps) => (\n <div className={cn(popoverGroupLabel, className)} {...props({ \"data-testid\": testId })} {...rest}>\n <HeadingPrefix prefix={prefix} />\n {children}\n </div>\n)\n\nexport type MenuItemGroupLabelProps = Omit<ArkMenu.ItemGroupLabelProps, \"prefix\"> &\n WithTestId & {\n /** Decorative leader before the label (e.g. `\"// \"`). Off by default; hidden\n * from screen readers and the clipboard. */\n prefix?: ReactNode\n }\n\nconst ItemGroupLabel = ({\n className,\n prefix,\n children,\n testId,\n asChild,\n ...rest\n}: MenuItemGroupLabelProps) => (\n <ArkMenu.ItemGroupLabel\n asChild={asChild}\n className={cn(popoverGroupLabel, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {composeChildren(asChild, children, (own) => (\n <>\n <HeadingPrefix prefix={prefix} />\n {own}\n </>\n ))}\n </ArkMenu.ItemGroupLabel>\n)\n\nconst Divider = ({ className, testId, ...rest }: ArkMenu.SeparatorProps & WithTestId) => (\n <ArkMenu.Separator\n className={cn(menuDivider, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type MenuCheckboxItemProps = ArkMenu.CheckboxItemProps &\n WithTestId & {\n startSection?: ReactNode\n color?: Color\n }\n\nconst CheckboxItem = ({\n startSection,\n color,\n className,\n children,\n testId,\n asChild,\n ...rest\n}: MenuCheckboxItemProps) => (\n <ArkMenu.CheckboxItem\n asChild={asChild}\n data-color={color}\n className={cn(menuItem({ colored: color != null }), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {composeChildren(asChild, children, (own) => (\n <>\n {startSection != null && <StartSection>{startSection}</StartSection>}\n {own}\n <ArkMenu.ItemIndicator className={popoverIndicator}>\n <CheckIcon />\n </ArkMenu.ItemIndicator>\n </>\n ))}\n </ArkMenu.CheckboxItem>\n)\n\nexport type MenuRadioGroupProps = Omit<\n ArkMenu.RadioItemGroupProps,\n \"onValueChange\" | \"onChange\"\n> & {\n /** Called with the newly selected value (flattened from Ark's detail object). */\n onChange?: (value: string) => void\n}\n\nconst RadioGroup = ({ onChange, ...rest }: MenuRadioGroupProps) => (\n <ArkMenu.RadioItemGroup\n onValueChange={onChange ? ({ value }) => onChange(value) : undefined}\n {...rest}\n />\n)\n\nexport type MenuRadioItemProps = ArkMenu.RadioItemProps &\n WithTestId & {\n startSection?: ReactNode\n color?: Color\n }\n\nconst RadioItem = ({\n startSection,\n color,\n className,\n children,\n testId,\n asChild,\n ...rest\n}: MenuRadioItemProps) => (\n <ArkMenu.RadioItem\n asChild={asChild}\n data-color={color}\n className={cn(menuItem({ colored: color != null }), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {composeChildren(asChild, children, (own) => (\n <>\n {startSection != null && <StartSection>{startSection}</StartSection>}\n {own}\n <ArkMenu.ItemIndicator className={popoverIndicator}>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"lucide lucide-dot-big\"\n aria-hidden=\"true\"\n >\n <title>Dot big</title>\n <circle cx=\"12.1\" cy=\"12.1\" r=\"4\"></circle>\n </svg>\n </ArkMenu.ItemIndicator>\n </>\n ))}\n </ArkMenu.RadioItem>\n)\n\nexport type MenuSubProps = Omit<ArkMenu.RootProps, \"positioning\"> & {\n /** Gap in px between the trigger row and the submenu. Ark manages submenu\n * *placement* itself (RTL-aware `right-start` / `left-start`, flush to the\n * parent), so only this main-axis gap is adjustable. Defaults to `10`. */\n offset?: number\n}\n\n/** A submenu opens flush to its trigger row, so its first item lands one surface\n * inset *below* the trigger — the `menuContent` top border (1px) + top padding\n * (`p-1` = 4px). Nudging the submenu up by that inset lines the first sub-item\n * up with the trigger row. Cross-axis is the vertical axis for the (Ark-forced)\n * `right-start` / `left-start` placements, and Floating UI maps a negative value\n * to \"up\" in both directions — so one constant covers LTR and RTL. */\nconst SUBMENU_ALIGN_OFFSET = -5\n\n/** Submenu root — a nested Ark Menu whose triggering row is `Menu.SubTrigger`.\n * Inherits the parent's portal settings via context (see `Menu.SubContent`).\n *\n * Ark's menu machine hard-overrides a submenu's placement and `gutter` (to `0`),\n * so a `gutter`-based offset is silently dropped. It leaves `offset` untouched,\n * and Floating UI resolves the axes as `offset.mainAxis ?? gutter` (the gap) and\n * `offset.crossAxis` (the top alignment) — so the whole `offset` object is the\n * one path that survives the override. */\nconst Sub = ({ offset = 10, children, ...rest }: MenuSubProps) => (\n <ArkMenu.Root\n positioning={{ offset: { mainAxis: offset, crossAxis: SUBMENU_ALIGN_OFFSET } }}\n navigate={clickLink}\n {...rest}\n >\n {children}\n </ArkMenu.Root>\n)\n\nexport type MenuSubTriggerProps = ArkMenu.TriggerItemProps &\n WithTestId & {\n startSection?: ReactNode\n color?: Color\n }\n\nconst SubTrigger = ({\n startSection,\n color,\n className,\n children,\n testId,\n asChild,\n ...rest\n}: MenuSubTriggerProps) => (\n <ArkMenu.TriggerItem\n asChild={asChild}\n data-color={color}\n className={cn(menuItem({ colored: color != null }), className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {composeChildren(asChild, children, (own) => (\n <>\n {startSection != null && <StartSection>{startSection}</StartSection>}\n {own}\n <span\n className={cn(popoverChevron, \"ms-auto -me-1 -rotate-90 rtl:rotate-90 [&_svg]:size-4\")}\n >\n <ChevronIcon />\n </span>\n </>\n ))}\n </ArkMenu.TriggerItem>\n)\n\nexport {\n CheckboxItem,\n Content,\n Divider,\n Item,\n ItemGroupLabel,\n Label,\n RadioGroup,\n RadioItem,\n Root,\n Sub,\n SubTrigger,\n}\n\nexport type MenuTriggerProps = ArkMenu.TriggerProps & { ref?: Ref<HTMLButtonElement> }\n\n/** Ark's `Menu.Trigger` minus one handler. Zag's trigger calls `preventDefault()`\n * on `pointerdown`, which cancels the browser's own mouse-down focus of the\n * button. With no pointer-initiated focus on record, Chromium treats every\n * later *programmatic* focus as keyboard-like: Zag's `focus()` on the content\n * when the menu opens, and its `focus()` back on the trigger when it closes,\n * both match `:focus-visible`, so a mouse user gets the keyboard ring on the\n * trigger after every menu interaction (#227).\n *\n * Leaving `pointerdown` alone restores the platform behaviour — the click\n * focuses the button without a ring, and the programmatic focuses that follow\n * inherit that. Keyboard users keep the ring, since a Tab/Enter/Escape still\n * marks the focus as keyboard-driven. It's also how Zag's own Popover trigger\n * behaves (it never cancels `pointerdown`). */\nexport const Trigger = ({ ref, value, className, ...rest }: MenuTriggerProps) => {\n const menu = useMenuContext()\n const presence = usePresenceContext()\n const { onPointerDown: _cancelsNativeFocus, ...trigger } = menu.getTriggerProps({ value })\n return (\n <ark.button\n {...mergeProps(\n {\n ...trigger,\n \"aria-controls\": presence.unmounted ? undefined : trigger[\"aria-controls\"],\n // The canceled `pointerdown` also blocked a native drag as a side\n // effect: an `asChild` `<a href>`, or the `<img>` of an avatar\n // trigger, would otherwise lift a drag ghost off the trigger.\n // Canceling `dragstart` instead leaves the press, and its focus, alone.\n onDragStart: (event: DragEvent) => event.preventDefault(),\n },\n // Same side effect for text: a double-click or drag on a non-button\n // trigger (`asChild` + `<span role=\"button\">`) would select its label.\n // CSS restores that. It lands on the `asChild` child too, and the\n // consumer's `className` comes last so it can override it.\n { ...rest, className: cn(\"select-none\", className) },\n )}\n ref={ref}\n />\n )\n}\n\n/** Ark parts re-exported unchanged (no styling needed). */\nexport const ContextTrigger = ArkMenu.ContextTrigger\nexport const ItemGroup = ArkMenu.ItemGroup\nexport const Context = ArkMenu.Context\n/** Alias for `Divider` (Ark's name for the same part). */\nexport const Separator = Divider\n/** Submenu dropdown — identical surface + portalling to `Menu.Content`. */\nexport const SubContent = Content\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FieldShell, fieldA11yProps } from './chunk-
|
|
2
|
-
import { Button } from './chunk-
|
|
1
|
+
import { FieldShell, fieldA11yProps } from './chunk-TBTSEPGP.js';
|
|
2
|
+
import { Button } from './chunk-QIDAXFKK.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-A6MYJTJI.js.map
|
|
238
|
+
//# sourceMappingURL=chunk-A6MYJTJI.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/button-select/button-select.tsx","../src/components/button-select/button-select-items.ts","../src/components/button-select/button-select-control.tsx"],"names":["Ark","props","jsx"],"mappings":";;;;;;;;;;;AAqDA,IAAM,2BAA2B,aAAA,CAAiC;AAAA,EAChE,OAAA,EAAS,OAAA;AAAA,EACT,eAAA,EAAiB,QAAA;AAAA,EACjB,IAAA,EAAM;AACR,CAAC,CAAA;AAUD,IAAM,WAAA,GACJ,yKAAA;AAsBF,IAAM,aAAa,CAAC,CAAA,EAAsB,CAAA,KACxC,CAAA,CAAE,WAAW,CAAA,CAAE,MAAA,IAAU,CAAA,CAAE,KAAA,CAAM,CAAC,CAAA,EAAG,CAAA,KAAM,CAAA,KAAM,CAAA,CAAE,CAAC,CAAC,CAAA;AAYvD,IAAM,iBAAA,GAAoB,CAAC,KAAA,KAAsC;AAC/D,EAAA,IAAI,KAAA,CAAM,MAAA,KAAW,KAAA,CAAM,aAAA,EAAe;AAC1C,EAAA,MAAM,QAAA,GAAW,MAAM,aAAA,CAAc,aAAA;AAAA,IACnC;AAAA,GACF;AACA,EAAA,IAAI,CAAC,QAAA,EAAU;AACf,EAAA,KAAA,CAAM,eAAA,EAAgB;AACtB,EAAA,QAAA,CAAS,KAAA,CAAM,EAAE,aAAA,EAAe,IAAA,EAAM,CAAA;AACxC,CAAA;AAWA,IAAM,eAAA,GAAkB,CAAC,IAAA,KAAkB,CAAC,KAAA,KAAyC;AACnF,EAAA,MAAM,OAAO,KAAA,CAAM,aAAA;AACnB,E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A,KAAA,EAAO,CAAC,GAAG,KAAK,CAAA;AAAA,YAChB,aAAA;AAAA,YACA,WAAA;AAAA,YACA,QAAA;AAAA,YACA,OAAA,EAAS,SAAA;AAAA,YACT,IAAA;AAAA,YACA,OAAA;AAAA,YACA,eAAA;AAAA,YACA,KAAA;AAAA,YACA,EAAA;AAAA,YACA,GAAA;AAAA,YACA,MAAA;AAAA,YACA,MAAA;AAAA,YACA,SAAA,EAAW,EAAA,CAAG,SAAA,EAAW,UAAA,EAAY,IAAI,CAAA;AAAA,YAExC,QAAA,EAAA,KAAA,CAAM,GAAA,CAAI,CAAC,IAAA,qBACVA,GAAAA;AAAA,cAAC,IAAA;AAAA,cAAA;AAAA,gBAEC,OAAO,IAAA,CAAK,KAAA;AAAA,gBACZ,UAAU,IAAA,CAAK,QAAA;AAAA,gBACf,OAAO,IAAA,CAAK,KAAA;AAAA,gBACZ,WAAW,IAAA,CAAK,SAAA;AAAA,gBAChB,SAAS,IAAA,CAAK,OAAA;AAAA,gBACd,cAAY,IAAA,CAAK,SAAA;AAAA,gBACjB,QAAQ,IAAA,CAAK,MAAA;AAAA,gBACb,WAAW,UAAA,EAAY,IAAA;AAAA,gBAEtB,QAAA,EAAA,UAAA,GACG,WAAW,IAAA,EAAM;AAAA,kBACf,QAAA,EAAU,KAAA,CAAM,QAAA,CAAS,IAAA,CAAK,KAAK,CAAA;AAAA,kBACnC,QAAA,EAAU,OAAA,CAAQ,QAAQ,CAAA,IAAK,IAAA,CAAK;AAAA,iBACrC,IACD,IAAA,CAAK;AAAA,eAAA;AAAA,cAfJ,IAAA,CAAK;AAAA,aAiBb;AAAA;AAAA,SACH;AAAA,wBACAA,GAAAA,CAAC,YAAA,EAAA,EAAa,IAAA,EAAY,OAAc,QAAA,EAAoB;AAAA;AAAA;AAAA,GAC9D;AAEJ","file":"chunk-MI2WZRK3.js","sourcesContent":["\"use client\"\n\nimport { useFieldContext } from \"@ark-ui/react/field\"\nimport { ToggleGroup as Ark, useToggleGroupContext } from \"@ark-ui/react/toggle-group\"\nimport {\n Children,\n cloneElement,\n createContext,\n type FocusEvent,\n type KeyboardEvent,\n type ReactElement,\n type ReactNode,\n type Ref,\n useContext,\n} from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { useUncontrolled } from \"../../lib/use-uncontrolled\"\nimport { Button, type ButtonProps, type ButtonSize, type ButtonVariant } from \"../button/button\"\nimport { buttonGroupVariants } from \"../button-group/button-group\"\nimport { fieldA11yProps } from \"../field/field\"\n\n/**\n * ButtonSelect / ButtonMultiSelect — compound parts.\n *\n * A row (or column) of real `Button`s joined like `ButtonGroup`, on Ark UI's\n * ToggleGroup machine. Every item renders through `Button` itself and only its\n * `variant` changes with the selection: unselected items take `variant`, the\n * selected ones `selectedVariant`. So the item styling — every variant × color,\n * sizes, `startSlot`/`endSlot`, hover, focus ring — has exactly one source, and\n * the join (flattened inner corners, collapsed hairlines, the hover/focus z-lift\n * and the filled/subtle seams) comes from `buttonGroupVariants` rather than a copy.\n *\n * Unlike `SegmentGroup` there is no sliding pill: a pill can't follow several\n * selected items at once, and the same parts back both the single and the\n * multiple form. The machine provides the semantics — `radiogroup` / `radio` +\n * `aria-checked` for single, `group` + `aria-pressed` for multiple — plus roving\n * focus with arrow keys and Home/End.\n *\n * `variant`, `selectedVariant` and `size` travel through a small context set once\n * on `Root`, so they aren't repeated on every `Item` (the Tabs pattern). `color`\n * is a plain `data-color` on `Root`, so it cascades to every item as CSS custom\n * properties; an item's own `color` re-stamps it on that one button.\n */\n\ntype StyleContextValue = {\n variant: ButtonVariant\n selectedVariant: ButtonVariant\n size: ButtonSize\n}\n\nconst ButtonSelectStyleContext = createContext<StyleContextValue>({\n variant: \"light\",\n selectedVariant: \"filled\",\n size: \"md\",\n})\n\n/**\n * The invalid cue is a ring on the whole group rather than red item borders: the\n * borderless `filled` / `subtle` items have no border to recolor, and the group\n * seams out-specify a per-item border anyway. A `ring` (box-shadow) is used, not\n * an `outline`, because the machine writes `outline: none` inline on the root.\n * `w-fit` keeps that ring hugging the items: inside `Field`'s flex column the\n * root would otherwise stretch to the field's full width.\n */\nconst invalidRing =\n \"w-fit rounded-button data-invalid:ring-1 data-invalid:ring-red-500 data-invalid:ring-offset-2 data-invalid:ring-offset-brand-50 dark:data-invalid:ring-offset-brand-950\"\n\ntype BaseRootProps = Omit<\n Ark.RootProps,\n \"color\" | \"multiple\" | \"value\" | \"defaultValue\" | \"onValueChange\" | \"deselectable\" | \"onChange\"\n> &\n WithTestId & {\n /** Palette for every item, as a `data-color` on the group. */\n color?: Color\n /** Treatment of the unselected items. */\n variant?: ButtonVariant\n /** Treatment of the selected items. */\n selectedVariant?: ButtonVariant\n size?: ButtonSize\n /** Red invalid ring around the group. */\n invalid?: boolean\n /** Lands on the group root, which forwards focus to its active item. Ark's\n * prop types carry no `ref`, so it is declared here. */\n ref?: Ref<HTMLDivElement>\n children?: ReactNode\n }\n\nconst sameValues = (a: readonly string[], b: readonly string[]) =>\n a.length === b.length && a.every((v, i) => v === b[i])\n\n/**\n * Tab entry for a single-choice group. Every item is `tabindex=-1` while focus is\n * outside, so Tab lands on the root, and zag then forwards focus to the *first*\n * item regardless of the selection. A radio group should land on the checked\n * radio instead, so in single mode the root's own focus is caught in the capture\n * phase and sent to the selected (enabled) item. `stopPropagation` there stops\n * the native event before React's bubble listener runs, which is what keeps\n * zag's `ROOT.FOCUS` (and its deferred focus-first) from firing. With nothing\n * selected, zag's own behaviour stands.\n */\nconst focusSelectedItem = (event: FocusEvent<HTMLDivElement>) => {\n if (event.target !== event.currentTarget) return\n const selected = event.currentTarget.querySelector<HTMLElement>(\n ':scope > [data-state=\"on\"]:not([disabled])',\n )\n if (!selected) return\n event.stopPropagation()\n selected.focus({ preventScroll: true })\n}\n\n/**\n * RTL arrow keys. zag's toggle-group reads `event.key` without passing `dir` to\n * `getEventKey` (its other machines do), so in a right-to-left locale ArrowLeft\n * moves focus visually *right*. In a horizontal RTL group the two keys are\n * caught in the capture phase, before zag's handler, and focus moves to the\n * visually adjacent enabled item instead; zag then picks up the new focus\n * through the item's own `onFocus`. `dir` is read off the root, where the\n * machine writes the locale's direction.\n */\nconst mirrorRtlArrows = (loop: boolean) => (event: KeyboardEvent<HTMLDivElement>) => {\n const root = event.currentTarget\n if (root.dir !== \"rtl\" || root.getAttribute(\"data-orientation\") !== \"horizontal\") return\n if (event.key !== \"ArrowLeft\" && event.key !== \"ArrowRight\") return\n const items = Array.from(\n root.querySelectorAll<HTMLElement>(':scope > [data-part=\"item\"]:not([disabled])'),\n )\n const index = items.indexOf(event.target as HTMLElement)\n if (index === -1) return\n event.preventDefault()\n event.stopPropagation()\n // Visually left is the next item in RTL, visually right the previous one.\n const step = event.key === \"ArrowLeft\" ? 1 : -1\n const next = loop\n ? items[(index + step + items.length) % items.length]\n : items[Math.min(Math.max(index + step, 0), items.length - 1)]\n next?.focus()\n}\n\n/** The shared root behind both `ButtonSelect.Root` and `ButtonMultiSelect.Root`. */\nexport const RootBase = ({\n multiple,\n value,\n defaultValue,\n onValueChange,\n deselectable,\n orientation = \"horizontal\",\n color,\n variant = \"light\",\n selectedVariant = \"filled\",\n size = \"md\",\n invalid,\n loopFocus = true,\n className,\n testId,\n children,\n ...rest\n}: BaseRootProps & {\n multiple: boolean\n value?: string[]\n defaultValue?: string[]\n onValueChange?: (value: string[]) => void\n deselectable?: boolean\n}) => {\n const field = useFieldContext()\n // Owned here so a change can be compared with the current value: in a\n // non-deselectable single group the machine re-emits the same value when the\n // selected item is clicked again, and that is not a change.\n const [selected, setSelected] = useUncontrolled<string[]>({\n value,\n defaultValue,\n finalValue: [],\n onChange: onValueChange,\n })\n return (\n <ButtonSelectStyleContext.Provider value={{ variant, selectedVariant, size }}>\n <Ark.Root\n multiple={multiple}\n value={selected}\n onValueChange={(details) => {\n if (!sameValues(details.value, selected)) setSelected(details.value)\n }}\n deselectable={deselectable}\n orientation={orientation}\n loopFocus={loopFocus}\n onFocusCapture={multiple ? undefined : focusSelectedItem}\n onKeyDownCapture={mirrorRtlArrows(loopFocus)}\n data-color={color}\n aria-invalid={invalid || undefined}\n {...props({ \"data-invalid\": invalid, \"data-testid\": testId })}\n {...fieldA11yProps(field)}\n className={cn(buttonGroupVariants({ orientation }), invalidRing, className)}\n {...rest}\n >\n {children}\n </Ark.Root>\n </ButtonSelectStyleContext.Provider>\n )\n}\n\nexport type ButtonSelectRootProps = BaseRootProps & {\n /** Controlled value. `null` clears the selection. */\n value?: string | null\n /** Uncontrolled initial value. */\n defaultValue?: string | null\n /** Fires with the newly selected value — `null` only when `deselectable`. */\n onChange?: (value: string | null) => void\n /** Clicking the selected item clears the selection. Off by default, so the\n * group behaves like a radio group. */\n deselectable?: boolean\n}\n\nconst toArray = (value: string | null | undefined) =>\n value === undefined ? undefined : value === null ? [] : [value]\n\n/** Single-choice root: one selected item at most. */\nexport const Root = ({\n value,\n defaultValue,\n onChange,\n deselectable = false,\n ...rest\n}: ButtonSelectRootProps) => (\n <RootBase\n multiple={false}\n value={toArray(value)}\n defaultValue={toArray(defaultValue)}\n onValueChange={(next) => onChange?.(next[0] ?? null)}\n deselectable={deselectable}\n {...rest}\n />\n)\n\nexport type ButtonMultiSelectRootProps = BaseRootProps & {\n /** Controlled value. */\n value?: string[]\n /** Uncontrolled initial value. */\n defaultValue?: string[]\n /** Fires with every selected value, in selection order. */\n onChange?: (value: string[]) => void\n}\n\n/** Multiple-choice root: each item toggles independently. */\nexport const MultiRoot = ({ onChange, ...rest }: ButtonMultiSelectRootProps) => (\n <RootBase multiple onValueChange={onChange} {...rest} />\n)\n\n/** The props `Item` hands a custom control under `asChild`. */\ntype SelectableControlProps = { variant?: ButtonVariant; size?: ButtonSize }\n\nexport type ButtonSelectItemProps =\n | (Omit<ButtonProps, \"value\" | \"variant\" | \"size\" | \"loading\" | \"asChild\"> & {\n /** The value this item selects. */\n value: string\n asChild?: false\n })\n | {\n /** The value this item selects. */\n value: string\n disabled?: boolean\n /**\n * Render your own variant-aware control instead of a `Button` — e.g. an\n * `ActionIcon` for an icon-only toolbar. The single child receives the\n * selection-driven `variant` and the group `size` (its own `size` wins),\n * plus the machine's item props.\n */\n asChild: true\n children: ReactElement<SelectableControlProps>\n }\n\n/**\n * One option, rendered as a `Button`. Its `variant` follows the selection (from\n * `Root`'s `variant` / `selectedVariant`); every other `Button` prop — `color`,\n * `startSlot`, `endSlot`, `aria-label` for an icon-only item, `testId` — passes\n * through. The machine's item props land on the button via Ark's `asChild`.\n *\n * With `asChild`, the single child is rendered in place of the `Button` and\n * cloned with the same `variant` / `size`, so any control speaking the kit's\n * variant × size vocabulary (`ActionIcon`, a consumer's own) can be an item.\n */\nexport const Item = (props: ButtonSelectItemProps) => {\n const { variant, selectedVariant, size } = useContext(ButtonSelectStyleContext)\n const { value, disabled } = props\n const { pressed } = useToggleGroupContext().getItemState({ value, disabled })\n const resolvedVariant = pressed ? selectedVariant : variant\n if (props.asChild) {\n const child = Children.only(props.children)\n return (\n <Ark.Item value={value} disabled={disabled} asChild>\n {cloneElement(child, { variant: resolvedVariant, size: child.props.size ?? size })}\n </Ark.Item>\n )\n }\n const { value: _value, disabled: _disabled, asChild: _asChild, ...rest } = props\n return (\n <Ark.Item value={value} disabled={disabled} asChild>\n <Button variant={resolvedVariant} size={size} {...rest} />\n </Ark.Item>\n )\n}\n\n/**\n * One hidden input per selected value, so a native `<form>` submit carries the\n * selection under `name`. Rendered *beside* the root, never inside it: the join\n * selectors target the root's children by `:first-child` / `:last-child`, which a\n * trailing input would throw off.\n */\nexport const HiddenInputs = ({\n name,\n value,\n disabled,\n}: {\n name?: string\n value: readonly string[]\n disabled?: boolean\n}) =>\n name == null\n ? null\n : value.map((v) => <input key={v} type=\"hidden\" name={name} value={v} disabled={disabled} />)\n\nexport const Context = Ark.Context\n","import type { ReactNode } from \"react\"\nimport type { Color } from \"../../lib/colors\"\n\n/**\n * One option of a data-driven `ButtonSelect` / `ButtonMultiSelect`: a bare\n * value-as-label string, or a labelled object. `payload` is arbitrary data the\n * machine ignores; it reaches `renderItem` typed off the `data` shape — the same\n * contract as `SegmentGroup` and `Select`.\n */\nexport type ButtonSelectItem<P = unknown> =\n | string\n | {\n value: string\n label?: ReactNode\n /** Content before the label, e.g. an icon (Button's `startSlot`). */\n startSlot?: ReactNode\n /** Content after the label (Button's `endSlot`). */\n endSlot?: ReactNode\n disabled?: boolean\n /** Overrides the group palette for this item. */\n color?: Color\n /** Accessible name — required when `label` is an icon only. */\n \"aria-label\"?: string\n /** Arbitrary extra data, surfaced to `renderItem`. */\n payload?: P\n /** `data-testid` on the rendered button. Defaults to `` `item-${value}` ``. */\n testId?: string\n }\n\n/** The `data` array both components are generic over. */\nexport type ButtonSelectData<P = unknown> = ReadonlyArray<ButtonSelectItem<P>>\n\n/** The value-string union of a `ButtonSelectData` shape; a `const` type\n * parameter narrows it to the literal union. */\nexport type ButtonSelectValue<Data extends ButtonSelectData> = ItemValue<Data[number]>\ntype ItemValue<E> = E extends string ? E : E extends { value: infer V extends string } ? V : never\n\n/** The `payload` type carried by a `ButtonSelectData` shape. */\nexport type ButtonSelectPayload<Data extends ButtonSelectData> = PayloadOf<Data[number]>\ntype PayloadOf<T> = T extends string ? never : T extends { payload?: infer P } ? P : never\n\n/** The item handed to `renderItem`, narrowed to the data's value and payload. */\nexport type RenderableButtonSelectItem<Data extends ButtonSelectData> = {\n value: ButtonSelectValue<Data>\n label: ReactNode\n disabled: boolean\n color: Color | undefined\n payload: ButtonSelectPayload<Data> | undefined\n}\n\n/** Live item state passed alongside the item to `renderItem`. */\nexport type ButtonSelectItemState = {\n selected: boolean\n disabled: boolean\n}\n\n/**\n * Render an item's label yourself. The item keeps its button, sizing, variant\n * and selection wiring; you fill its content. In an RSC tree the function must\n * live in a `\"use client\"` module.\n */\nexport type RenderButtonSelectItem<Data extends ButtonSelectData> = (\n item: RenderableButtonSelectItem<Data>,\n state: ButtonSelectItemState,\n) => ReactNode\n\n/** A fully resolved item — every field present (`label` falls back to `value`). */\nexport type NormalizedButtonSelectItem = {\n value: string\n label: ReactNode\n startSlot: ReactNode\n endSlot: ReactNode\n disabled: boolean\n color: Color | undefined\n ariaLabel: string | undefined\n payload: unknown\n testId: string\n}\n\nexport const normalizeButtonSelectItem = (item: ButtonSelectItem): NormalizedButtonSelectItem =>\n typeof item === \"string\"\n ? {\n value: item,\n label: item,\n startSlot: undefined,\n endSlot: undefined,\n disabled: false,\n color: undefined,\n ariaLabel: undefined,\n payload: undefined,\n testId: `item-${item}`,\n }\n : {\n value: item.value,\n label: item.label ?? item.value,\n startSlot: item.startSlot,\n endSlot: item.endSlot,\n disabled: item.disabled ?? false,\n color: item.color,\n ariaLabel: item[\"aria-label\"],\n payload: item.payload,\n testId: item.testId ?? `item-${item.value}`,\n }\n","\"use client\"\n\nimport type { FocusEvent, Ref } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport type { ButtonSize, ButtonVariant } from \"../button/button\"\nimport { type FieldProps, FieldShell } from \"../field/field\"\nimport { HiddenInputs, Item, RootBase } from \"./button-select\"\nimport {\n type ButtonSelectData,\n normalizeButtonSelectItem,\n type RenderButtonSelectItem,\n} from \"./button-select-items\"\n\ntype ButtonSelectClassNames = {\n field?: string\n /** The label element itself — e.g. `\"sr-only\"` to keep the accessible name\n * without showing it. */\n label?: string\n root?: string\n item?: string\n}\n\n/** Props shared by the data-driven `ButtonSelect` and `ButtonMultiSelect`. */\nexport type ButtonSelectBaseProps<Data extends ButtonSelectData> = Pick<\n FieldProps,\n \"label\" | \"description\" | \"error\" | \"required\"\n> &\n WithTestId & {\n /** Items: bare strings (`value === label`) or `{ value, label?, startSlot?, … }`. */\n data: Data\n /** Render each item's content yourself, with its typed `payload`. */\n renderItem?: RenderButtonSelectItem<Data>\n /** Lay the items in a row (default) or a column. */\n orientation?: \"horizontal\" | \"vertical\"\n /** Red invalid state, independent of (and OR'd with) `error`. */\n invalid?: boolean\n /** Dims and blocks every item. */\n disabled?: boolean\n size?: ButtonSize\n /** Treatment of the unselected items. Defaults to `light`. */\n variant?: ButtonVariant\n /** Treatment of the selected items. Defaults to `filled`. */\n selectedVariant?: ButtonVariant\n color?: Color\n /** Renders a hidden input per selected value for native form submission. */\n name?: string\n /** Explicit id for the group root. */\n id?: string\n /** Lands on the group root, which forwards focus to its active item. */\n ref?: Ref<HTMLDivElement>\n /** Forwarded to the root; drives touched/blurred validation. */\n onBlur?: (event: FocusEvent<HTMLDivElement>) => void\n className?: string\n classNames?: ButtonSelectClassNames\n }\n\n/**\n * The rendering both data forms share: the `Field` wrapper, the group root, one\n * `Item` per entry and the hidden inputs. The public components only adapt their\n * value shape (`V | null` or `V[]`) onto the machine's `string[]`.\n */\nexport const ButtonSelectControl = ({\n multiple,\n deselectable,\n value,\n onValueChange,\n data,\n renderItem,\n orientation,\n invalid,\n disabled,\n required,\n size = \"md\",\n variant,\n selectedVariant,\n color,\n name,\n id,\n ref,\n onBlur,\n label,\n description,\n error,\n className,\n classNames,\n testId,\n}: ButtonSelectBaseProps<ButtonSelectData> & {\n multiple: boolean\n deselectable?: boolean\n value: readonly string[]\n onValueChange: (value: string[]) => void\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 const items = data.map(normalizeButtonSelectItem)\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 <RootBase\n multiple={multiple}\n deselectable={deselectable}\n value={[...value]}\n onValueChange={onValueChange}\n orientation={orientation}\n disabled={disabled}\n invalid={isInvalid}\n size={size}\n variant={variant}\n selectedVariant={selectedVariant}\n color={color}\n id={id}\n ref={ref}\n onBlur={onBlur}\n testId={testId}\n className={cn(className, classNames?.root)}\n >\n {items.map((item) => (\n <Item\n key={item.value}\n value={item.value}\n disabled={item.disabled}\n color={item.color}\n startSlot={item.startSlot}\n endSlot={item.endSlot}\n aria-label={item.ariaLabel}\n testId={item.testId}\n className={classNames?.item}\n >\n {renderItem\n ? renderItem(item, {\n selected: value.includes(item.value),\n disabled: Boolean(disabled) || item.disabled,\n })\n : item.label}\n </Item>\n ))}\n </RootBase>\n <HiddenInputs name={name} value={value} disabled={disabled} />\n </FieldShell>\n )\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/button-select/button-select.tsx","../src/components/button-select/button-select-items.ts","../src/components/button-select/button-select-control.tsx"],"names":["Ark","props","jsx"],"mappings":";;;;;;;;;;;AAqDA,IAAM,2BAA2B,aAAA,CAAiC;AAAA,EAChE,OAAA,EAAS,OAAA;AAAA,EACT,eAAA,EAAiB,QAAA;AAAA,EACjB,IAAA,EAAM;AACR,CAAC,CAAA;AAUD,IAAM,WAAA,GACJ,yKAAA;AAsBF,IAAM,aAAa,CAAC,CAAA,EAAsB,CAAA,KACxC,CAAA,CAAE,WAAW,CAAA,CAAE,MAAA,IAAU,CAAA,CAAE,KAAA,CAAM,CAAC,CAAA,EAAG,CAAA,KAAM,CAAA,KAAM,CAAA,CAAE,CAAC,CAAC,CAAA;AAYvD,IAAM,iBAAA,GAAoB,CAAC,KAAA,KAAsC;AAC/D,EAAA,IAAI,KAAA,CAAM,MAAA,KAAW,KAAA,CAAM,aAAA,EAAe;AAC1C,EAAA,MAAM,QAAA,GAAW,MAAM,aAAA,CAAc,aAAA;AAAA,IACnC;AAAA,GACF;AACA,EAAA,IAAI,CAAC,QAAA,EAAU;AACf,EAAA,KAAA,CAAM,eAAA,EAAgB;AACtB,EAAA,QAAA,CAAS,KAAA,CAAM,EAAE,aAAA,EAAe,IAAA,EAAM,CAAA;AACxC,CAAA;AAWA,IAAM,eAAA,GAAkB,CAAC,IAAA,KAAkB,CAAC,KAAA,KAAyC;AACnF,EAAA,MAAM,OAAO,KAAA,CAAM,aAAA;AACnB,EAAA,IAAI,KAAK,GA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,GAAG,KAAK,CAAA;AAAA,YAChB,aAAA;AAAA,YACA,WAAA;AAAA,YACA,QAAA;AAAA,YACA,OAAA,EAAS,SAAA;AAAA,YACT,IAAA;AAAA,YACA,OAAA;AAAA,YACA,eAAA;AAAA,YACA,KAAA;AAAA,YACA,EAAA;AAAA,YACA,GAAA;AAAA,YACA,MAAA;AAAA,YACA,MAAA;AAAA,YACA,SAAA,EAAW,EAAA,CAAG,SAAA,EAAW,UAAA,EAAY,IAAI,CAAA;AAAA,YAExC,QAAA,EAAA,KAAA,CAAM,GAAA,CAAI,CAAC,IAAA,qBACVA,GAAAA;AAAA,cAAC,IAAA;AAAA,cAAA;AAAA,gBAEC,OAAO,IAAA,CAAK,KAAA;AAAA,gBACZ,UAAU,IAAA,CAAK,QAAA;AAAA,gBACf,OAAO,IAAA,CAAK,KAAA;AAAA,gBACZ,WAAW,IAAA,CAAK,SAAA;AAAA,gBAChB,SAAS,IAAA,CAAK,OAAA;AAAA,gBACd,cAAY,IAAA,CAAK,SAAA;AAAA,gBACjB,QAAQ,IAAA,CAAK,MAAA;AAAA,gBACb,WAAW,UAAA,EAAY,IAAA;AAAA,gBAEtB,QAAA,EAAA,UAAA,GACG,WAAW,IAAA,EAAM;AAAA,kBACf,QAAA,EAAU,KAAA,CAAM,QAAA,CAAS,IAAA,CAAK,KAAK,CAAA;AAAA,kBACnC,QAAA,EAAU,OAAA,CAAQ,QAAQ,CAAA,IAAK,IAAA,CAAK;AAAA,iBACrC,IACD,IAAA,CAAK;AAAA,eAAA;AAAA,cAfJ,IAAA,CAAK;AAAA,aAiBb;AAAA;AAAA,SACH;AAAA,wBACAA,GAAAA,CAAC,YAAA,EAAA,EAAa,IAAA,EAAY,OAAc,QAAA,EAAoB;AAAA;AAAA;AAAA,GAC9D;AAEJ","file":"chunk-A6MYJTJI.js","sourcesContent":["\"use client\"\n\nimport { useFieldContext } from \"@ark-ui/react/field\"\nimport { ToggleGroup as Ark, useToggleGroupContext } from \"@ark-ui/react/toggle-group\"\nimport {\n Children,\n cloneElement,\n createContext,\n type FocusEvent,\n type KeyboardEvent,\n type ReactElement,\n type ReactNode,\n type Ref,\n useContext,\n} from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { useUncontrolled } from \"../../lib/use-uncontrolled\"\nimport { Button, type ButtonProps, type ButtonSize, type ButtonVariant } from \"../button/button\"\nimport { buttonGroupVariants } from \"../button-group/button-group\"\nimport { fieldA11yProps } from \"../field/field\"\n\n/**\n * ButtonSelect / ButtonMultiSelect — compound parts.\n *\n * A row (or column) of real `Button`s joined like `ButtonGroup`, on Ark UI's\n * ToggleGroup machine. Every item renders through `Button` itself and only its\n * `variant` changes with the selection: unselected items take `variant`, the\n * selected ones `selectedVariant`. So the item styling — every variant × color,\n * sizes, `startSlot`/`endSlot`, hover, focus ring — has exactly one source, and\n * the join (flattened inner corners, collapsed hairlines, the hover/focus z-lift\n * and the filled/subtle seams) comes from `buttonGroupVariants` rather than a copy.\n *\n * Unlike `SegmentGroup` there is no sliding pill: a pill can't follow several\n * selected items at once, and the same parts back both the single and the\n * multiple form. The machine provides the semantics — `radiogroup` / `radio` +\n * `aria-checked` for single, `group` + `aria-pressed` for multiple — plus roving\n * focus with arrow keys and Home/End.\n *\n * `variant`, `selectedVariant` and `size` travel through a small context set once\n * on `Root`, so they aren't repeated on every `Item` (the Tabs pattern). `color`\n * is a plain `data-color` on `Root`, so it cascades to every item as CSS custom\n * properties; an item's own `color` re-stamps it on that one button.\n */\n\ntype StyleContextValue = {\n variant: ButtonVariant\n selectedVariant: ButtonVariant\n size: ButtonSize\n}\n\nconst ButtonSelectStyleContext = createContext<StyleContextValue>({\n variant: \"light\",\n selectedVariant: \"filled\",\n size: \"md\",\n})\n\n/**\n * The invalid cue is a ring on the whole group rather than red item borders: the\n * borderless `filled` / `subtle` items have no border to recolor, and the group\n * seams out-specify a per-item border anyway. A `ring` (box-shadow) is used, not\n * an `outline`, because the machine writes `outline: none` inline on the root.\n * `w-fit` keeps that ring hugging the items: inside `Field`'s flex column the\n * root would otherwise stretch to the field's full width.\n */\nconst invalidRing =\n \"w-fit rounded-button data-invalid:ring-1 data-invalid:ring-red-500 data-invalid:ring-offset-2 data-invalid:ring-offset-brand-50 dark:data-invalid:ring-offset-brand-950\"\n\ntype BaseRootProps = Omit<\n Ark.RootProps,\n \"color\" | \"multiple\" | \"value\" | \"defaultValue\" | \"onValueChange\" | \"deselectable\" | \"onChange\"\n> &\n WithTestId & {\n /** Palette for every item, as a `data-color` on the group. */\n color?: Color\n /** Treatment of the unselected items. */\n variant?: ButtonVariant\n /** Treatment of the selected items. */\n selectedVariant?: ButtonVariant\n size?: ButtonSize\n /** Red invalid ring around the group. */\n invalid?: boolean\n /** Lands on the group root, which forwards focus to its active item. Ark's\n * prop types carry no `ref`, so it is declared here. */\n ref?: Ref<HTMLDivElement>\n children?: ReactNode\n }\n\nconst sameValues = (a: readonly string[], b: readonly string[]) =>\n a.length === b.length && a.every((v, i) => v === b[i])\n\n/**\n * Tab entry for a single-choice group. Every item is `tabindex=-1` while focus is\n * outside, so Tab lands on the root, and zag then forwards focus to the *first*\n * item regardless of the selection. A radio group should land on the checked\n * radio instead, so in single mode the root's own focus is caught in the capture\n * phase and sent to the selected (enabled) item. `stopPropagation` there stops\n * the native event before React's bubble listener runs, which is what keeps\n * zag's `ROOT.FOCUS` (and its deferred focus-first) from firing. With nothing\n * selected, zag's own behaviour stands.\n */\nconst focusSelectedItem = (event: FocusEvent<HTMLDivElement>) => {\n if (event.target !== event.currentTarget) return\n const selected = event.currentTarget.querySelector<HTMLElement>(\n ':scope > [data-state=\"on\"]:not([disabled])',\n )\n if (!selected) return\n event.stopPropagation()\n selected.focus({ preventScroll: true })\n}\n\n/**\n * RTL arrow keys. zag's toggle-group reads `event.key` without passing `dir` to\n * `getEventKey` (its other machines do), so in a right-to-left locale ArrowLeft\n * moves focus visually *right*. In a horizontal RTL group the two keys are\n * caught in the capture phase, before zag's handler, and focus moves to the\n * visually adjacent enabled item instead; zag then picks up the new focus\n * through the item's own `onFocus`. `dir` is read off the root, where the\n * machine writes the locale's direction.\n */\nconst mirrorRtlArrows = (loop: boolean) => (event: KeyboardEvent<HTMLDivElement>) => {\n const root = event.currentTarget\n if (root.dir !== \"rtl\" || root.getAttribute(\"data-orientation\") !== \"horizontal\") return\n if (event.key !== \"ArrowLeft\" && event.key !== \"ArrowRight\") return\n const items = Array.from(\n root.querySelectorAll<HTMLElement>(':scope > [data-part=\"item\"]:not([disabled])'),\n )\n const index = items.indexOf(event.target as HTMLElement)\n if (index === -1) return\n event.preventDefault()\n event.stopPropagation()\n // Visually left is the next item in RTL, visually right the previous one.\n const step = event.key === \"ArrowLeft\" ? 1 : -1\n const next = loop\n ? items[(index + step + items.length) % items.length]\n : items[Math.min(Math.max(index + step, 0), items.length - 1)]\n next?.focus()\n}\n\n/** The shared root behind both `ButtonSelect.Root` and `ButtonMultiSelect.Root`. */\nexport const RootBase = ({\n multiple,\n value,\n defaultValue,\n onValueChange,\n deselectable,\n orientation = \"horizontal\",\n color,\n variant = \"light\",\n selectedVariant = \"filled\",\n size = \"md\",\n invalid,\n loopFocus = true,\n className,\n testId,\n children,\n ...rest\n}: BaseRootProps & {\n multiple: boolean\n value?: string[]\n defaultValue?: string[]\n onValueChange?: (value: string[]) => void\n deselectable?: boolean\n}) => {\n const field = useFieldContext()\n // Owned here so a change can be compared with the current value: in a\n // non-deselectable single group the machine re-emits the same value when the\n // selected item is clicked again, and that is not a change.\n const [selected, setSelected] = useUncontrolled<string[]>({\n value,\n defaultValue,\n finalValue: [],\n onChange: onValueChange,\n })\n return (\n <ButtonSelectStyleContext.Provider value={{ variant, selectedVariant, size }}>\n <Ark.Root\n multiple={multiple}\n value={selected}\n onValueChange={(details) => {\n if (!sameValues(details.value, selected)) setSelected(details.value)\n }}\n deselectable={deselectable}\n orientation={orientation}\n loopFocus={loopFocus}\n onFocusCapture={multiple ? undefined : focusSelectedItem}\n onKeyDownCapture={mirrorRtlArrows(loopFocus)}\n data-color={color}\n aria-invalid={invalid || undefined}\n {...props({ \"data-invalid\": invalid, \"data-testid\": testId })}\n {...fieldA11yProps(field)}\n className={cn(buttonGroupVariants({ orientation }), invalidRing, className)}\n {...rest}\n >\n {children}\n </Ark.Root>\n </ButtonSelectStyleContext.Provider>\n )\n}\n\nexport type ButtonSelectRootProps = BaseRootProps & {\n /** Controlled value. `null` clears the selection. */\n value?: string | null\n /** Uncontrolled initial value. */\n defaultValue?: string | null\n /** Fires with the newly selected value — `null` only when `deselectable`. */\n onChange?: (value: string | null) => void\n /** Clicking the selected item clears the selection. Off by default, so the\n * group behaves like a radio group. */\n deselectable?: boolean\n}\n\nconst toArray = (value: string | null | undefined) =>\n value === undefined ? undefined : value === null ? [] : [value]\n\n/** Single-choice root: one selected item at most. */\nexport const Root = ({\n value,\n defaultValue,\n onChange,\n deselectable = false,\n ...rest\n}: ButtonSelectRootProps) => (\n <RootBase\n multiple={false}\n value={toArray(value)}\n defaultValue={toArray(defaultValue)}\n onValueChange={(next) => onChange?.(next[0] ?? null)}\n deselectable={deselectable}\n {...rest}\n />\n)\n\nexport type ButtonMultiSelectRootProps = BaseRootProps & {\n /** Controlled value. */\n value?: string[]\n /** Uncontrolled initial value. */\n defaultValue?: string[]\n /** Fires with every selected value, in selection order. */\n onChange?: (value: string[]) => void\n}\n\n/** Multiple-choice root: each item toggles independently. */\nexport const MultiRoot = ({ onChange, ...rest }: ButtonMultiSelectRootProps) => (\n <RootBase multiple onValueChange={onChange} {...rest} />\n)\n\n/** The props `Item` hands a custom control under `asChild`. */\ntype SelectableControlProps = { variant?: ButtonVariant; size?: ButtonSize }\n\nexport type ButtonSelectItemProps =\n | (Omit<ButtonProps, \"value\" | \"variant\" | \"size\" | \"loading\" | \"asChild\"> & {\n /** The value this item selects. */\n value: string\n asChild?: false\n })\n | {\n /** The value this item selects. */\n value: string\n disabled?: boolean\n /**\n * Render your own variant-aware control instead of a `Button` — e.g. an\n * `ActionIcon` for an icon-only toolbar. The single child receives the\n * selection-driven `variant` and the group `size` (its own `size` wins),\n * plus the machine's item props.\n */\n asChild: true\n children: ReactElement<SelectableControlProps>\n }\n\n/**\n * One option, rendered as a `Button`. Its `variant` follows the selection (from\n * `Root`'s `variant` / `selectedVariant`); every other `Button` prop — `color`,\n * `startSlot`, `endSlot`, `aria-label` for an icon-only item, `testId` — passes\n * through. The machine's item props land on the button via Ark's `asChild`.\n *\n * With `asChild`, the single child is rendered in place of the `Button` and\n * cloned with the same `variant` / `size`, so any control speaking the kit's\n * variant × size vocabulary (`ActionIcon`, a consumer's own) can be an item.\n */\nexport const Item = (props: ButtonSelectItemProps) => {\n const { variant, selectedVariant, size } = useContext(ButtonSelectStyleContext)\n const { value, disabled } = props\n const { pressed } = useToggleGroupContext().getItemState({ value, disabled })\n const resolvedVariant = pressed ? selectedVariant : variant\n if (props.asChild) {\n const child = Children.only(props.children)\n return (\n <Ark.Item value={value} disabled={disabled} asChild>\n {cloneElement(child, { variant: resolvedVariant, size: child.props.size ?? size })}\n </Ark.Item>\n )\n }\n const { value: _value, disabled: _disabled, asChild: _asChild, ...rest } = props\n return (\n <Ark.Item value={value} disabled={disabled} asChild>\n <Button variant={resolvedVariant} size={size} {...rest} />\n </Ark.Item>\n )\n}\n\n/**\n * One hidden input per selected value, so a native `<form>` submit carries the\n * selection under `name`. Rendered *beside* the root, never inside it: the join\n * selectors target the root's children by `:first-child` / `:last-child`, which a\n * trailing input would throw off.\n */\nexport const HiddenInputs = ({\n name,\n value,\n disabled,\n}: {\n name?: string\n value: readonly string[]\n disabled?: boolean\n}) =>\n name == null\n ? null\n : value.map((v) => <input key={v} type=\"hidden\" name={name} value={v} disabled={disabled} />)\n\nexport const Context = Ark.Context\n","import type { ReactNode } from \"react\"\nimport type { Color } from \"../../lib/colors\"\n\n/**\n * One option of a data-driven `ButtonSelect` / `ButtonMultiSelect`: a bare\n * value-as-label string, or a labelled object. `payload` is arbitrary data the\n * machine ignores; it reaches `renderItem` typed off the `data` shape — the same\n * contract as `SegmentGroup` and `Select`.\n */\nexport type ButtonSelectItem<P = unknown> =\n | string\n | {\n value: string\n label?: ReactNode\n /** Content before the label, e.g. an icon (Button's `startSlot`). */\n startSlot?: ReactNode\n /** Content after the label (Button's `endSlot`). */\n endSlot?: ReactNode\n disabled?: boolean\n /** Overrides the group palette for this item. */\n color?: Color\n /** Accessible name — required when `label` is an icon only. */\n \"aria-label\"?: string\n /** Arbitrary extra data, surfaced to `renderItem`. */\n payload?: P\n /** `data-testid` on the rendered button. Defaults to `` `item-${value}` ``. */\n testId?: string\n }\n\n/** The `data` array both components are generic over. */\nexport type ButtonSelectData<P = unknown> = ReadonlyArray<ButtonSelectItem<P>>\n\n/** The value-string union of a `ButtonSelectData` shape; a `const` type\n * parameter narrows it to the literal union. */\nexport type ButtonSelectValue<Data extends ButtonSelectData> = ItemValue<Data[number]>\ntype ItemValue<E> = E extends string ? E : E extends { value: infer V extends string } ? V : never\n\n/** The `payload` type carried by a `ButtonSelectData` shape. */\nexport type ButtonSelectPayload<Data extends ButtonSelectData> = PayloadOf<Data[number]>\ntype PayloadOf<T> = T extends string ? never : T extends { payload?: infer P } ? P : never\n\n/** The item handed to `renderItem`, narrowed to the data's value and payload. */\nexport type RenderableButtonSelectItem<Data extends ButtonSelectData> = {\n value: ButtonSelectValue<Data>\n label: ReactNode\n disabled: boolean\n color: Color | undefined\n payload: ButtonSelectPayload<Data> | undefined\n}\n\n/** Live item state passed alongside the item to `renderItem`. */\nexport type ButtonSelectItemState = {\n selected: boolean\n disabled: boolean\n}\n\n/**\n * Render an item's label yourself. The item keeps its button, sizing, variant\n * and selection wiring; you fill its content. In an RSC tree the function must\n * live in a `\"use client\"` module.\n */\nexport type RenderButtonSelectItem<Data extends ButtonSelectData> = (\n item: RenderableButtonSelectItem<Data>,\n state: ButtonSelectItemState,\n) => ReactNode\n\n/** A fully resolved item — every field present (`label` falls back to `value`). */\nexport type NormalizedButtonSelectItem = {\n value: string\n label: ReactNode\n startSlot: ReactNode\n endSlot: ReactNode\n disabled: boolean\n color: Color | undefined\n ariaLabel: string | undefined\n payload: unknown\n testId: string\n}\n\nexport const normalizeButtonSelectItem = (item: ButtonSelectItem): NormalizedButtonSelectItem =>\n typeof item === \"string\"\n ? {\n value: item,\n label: item,\n startSlot: undefined,\n endSlot: undefined,\n disabled: false,\n color: undefined,\n ariaLabel: undefined,\n payload: undefined,\n testId: `item-${item}`,\n }\n : {\n value: item.value,\n label: item.label ?? item.value,\n startSlot: item.startSlot,\n endSlot: item.endSlot,\n disabled: item.disabled ?? false,\n color: item.color,\n ariaLabel: item[\"aria-label\"],\n payload: item.payload,\n testId: item.testId ?? `item-${item.value}`,\n }\n","\"use client\"\n\nimport type { FocusEvent, Ref } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport type { ButtonSize, ButtonVariant } from \"../button/button\"\nimport { type FieldProps, FieldShell } from \"../field/field\"\nimport { HiddenInputs, Item, RootBase } from \"./button-select\"\nimport {\n type ButtonSelectData,\n normalizeButtonSelectItem,\n type RenderButtonSelectItem,\n} from \"./button-select-items\"\n\ntype ButtonSelectClassNames = {\n field?: string\n /** The label element itself — e.g. `\"sr-only\"` to keep the accessible name\n * without showing it. */\n label?: string\n root?: string\n item?: string\n}\n\n/** Props shared by the data-driven `ButtonSelect` and `ButtonMultiSelect`. */\nexport type ButtonSelectBaseProps<Data extends ButtonSelectData> = Pick<\n FieldProps,\n \"label\" | \"description\" | \"error\" | \"required\"\n> &\n WithTestId & {\n /** Items: bare strings (`value === label`) or `{ value, label?, startSlot?, … }`. */\n data: Data\n /** Render each item's content yourself, with its typed `payload`. */\n renderItem?: RenderButtonSelectItem<Data>\n /** Lay the items in a row (default) or a column. */\n orientation?: \"horizontal\" | \"vertical\"\n /** Red invalid state, independent of (and OR'd with) `error`. */\n invalid?: boolean\n /** Dims and blocks every item. */\n disabled?: boolean\n size?: ButtonSize\n /** Treatment of the unselected items. Defaults to `light`. */\n variant?: ButtonVariant\n /** Treatment of the selected items. Defaults to `filled`. */\n selectedVariant?: ButtonVariant\n color?: Color\n /** Renders a hidden input per selected value for native form submission. */\n name?: string\n /** Explicit id for the group root. */\n id?: string\n /** Lands on the group root, which forwards focus to its active item. */\n ref?: Ref<HTMLDivElement>\n /** Forwarded to the root; drives touched/blurred validation. */\n onBlur?: (event: FocusEvent<HTMLDivElement>) => void\n className?: string\n classNames?: ButtonSelectClassNames\n }\n\n/**\n * The rendering both data forms share: the `Field` wrapper, the group root, one\n * `Item` per entry and the hidden inputs. The public components only adapt their\n * value shape (`V | null` or `V[]`) onto the machine's `string[]`.\n */\nexport const ButtonSelectControl = ({\n multiple,\n deselectable,\n value,\n onValueChange,\n data,\n renderItem,\n orientation,\n invalid,\n disabled,\n required,\n size = \"md\",\n variant,\n selectedVariant,\n color,\n name,\n id,\n ref,\n onBlur,\n label,\n description,\n error,\n className,\n classNames,\n testId,\n}: ButtonSelectBaseProps<ButtonSelectData> & {\n multiple: boolean\n deselectable?: boolean\n value: readonly string[]\n onValueChange: (value: string[]) => void\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 const items = data.map(normalizeButtonSelectItem)\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 <RootBase\n multiple={multiple}\n deselectable={deselectable}\n value={[...value]}\n onValueChange={onValueChange}\n orientation={orientation}\n disabled={disabled}\n invalid={isInvalid}\n size={size}\n variant={variant}\n selectedVariant={selectedVariant}\n color={color}\n id={id}\n ref={ref}\n onBlur={onBlur}\n testId={testId}\n className={cn(className, classNames?.root)}\n >\n {items.map((item) => (\n <Item\n key={item.value}\n value={item.value}\n disabled={item.disabled}\n color={item.color}\n startSlot={item.startSlot}\n endSlot={item.endSlot}\n aria-label={item.ariaLabel}\n testId={item.testId}\n className={classNames?.item}\n >\n {renderItem\n ? renderItem(item, {\n selected: value.includes(item.value),\n disabled: Boolean(disabled) || item.disabled,\n })\n : item.label}\n </Item>\n ))}\n </RootBase>\n <HiddenInputs name={name} value={value} disabled={disabled} />\n </FieldShell>\n )\n}\n"]}
|