@42-central/ui-react 0.18.2 → 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 +5 -2
- 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 +162 -79
- 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 +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 +60 -48
- 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 +2 -2
- 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 +26 -14
- 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 +121 -0
- package/src/components/data-table/data-table.tsx +37 -17
- 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/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 +56 -28
- package/src/components/schedule/now-cursor-line.tsx +30 -16
- 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/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 { mergeRefs } from './chunk-UVYTJQTJ.js';
|
|
2
|
-
import { InputBase, inputControlClasses, inputSlot } from './chunk-
|
|
3
|
-
import { FieldShell, fieldA11yProps } from './chunk-
|
|
4
|
-
import { popoverClearTrigger } from './chunk-
|
|
2
|
+
import { InputBase, inputControlClasses, inputSlot } from './chunk-Z6RPMRFH.js';
|
|
3
|
+
import { FieldShell, fieldA11yProps } from './chunk-TBTSEPGP.js';
|
|
4
|
+
import { popoverClearTrigger } from './chunk-LM6F6DLR.js';
|
|
5
5
|
import { CloseIcon } from './chunk-IG7FBZVM.js';
|
|
6
6
|
import { props } from './chunk-WYCMIIRR.js';
|
|
7
7
|
import { cn } from './chunk-QP4I37PA.js';
|
|
@@ -11,6 +11,11 @@ import { ChevronUp, ChevronDown } from 'lucide-react';
|
|
|
11
11
|
import { useRef } from 'react';
|
|
12
12
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
13
13
|
|
|
14
|
+
var NUMBER_INPUT_DEFAULT_TRANSLATIONS = {
|
|
15
|
+
incrementLabel: "Increment",
|
|
16
|
+
decrementLabel: "Decrement",
|
|
17
|
+
clearTriggerLabel: "Clear value"
|
|
18
|
+
};
|
|
14
19
|
var toArkValue = (value) => value === void 0 ? void 0 : value === null ? "" : String(value);
|
|
15
20
|
var wrapValue = (raw, min, max) => {
|
|
16
21
|
const span = max - min + 1;
|
|
@@ -107,8 +112,10 @@ var NumberInput = ({
|
|
|
107
112
|
onBlur,
|
|
108
113
|
className,
|
|
109
114
|
classNames,
|
|
110
|
-
testId
|
|
115
|
+
testId,
|
|
116
|
+
translations
|
|
111
117
|
}) => {
|
|
118
|
+
const resolvedTranslations = { ...NUMBER_INPUT_DEFAULT_TRANSLATIONS, ...translations };
|
|
112
119
|
const isInvalid = invalid || error != null;
|
|
113
120
|
const inputRef = useRef(null);
|
|
114
121
|
const cycle = wrap && min !== void 0 && max !== void 0 ? { min, max } : void 0;
|
|
@@ -149,6 +156,7 @@ var NumberInput = ({
|
|
|
149
156
|
name,
|
|
150
157
|
...props({ invalid: isInvalid, disabled, readOnly, required }),
|
|
151
158
|
ids: id ? { input: id } : void 0,
|
|
159
|
+
translations: resolvedTranslations,
|
|
152
160
|
className: cn("w-full", className),
|
|
153
161
|
children: /* @__PURE__ */ jsx(NumberInput$1.Context, { children: (api) => {
|
|
154
162
|
const canClear = Boolean(clearable) && !disabled && !readOnly;
|
|
@@ -184,7 +192,7 @@ var NumberInput = ({
|
|
|
184
192
|
"button",
|
|
185
193
|
{
|
|
186
194
|
type: "button",
|
|
187
|
-
"aria-label":
|
|
195
|
+
"aria-label": resolvedTranslations.clearTriggerLabel,
|
|
188
196
|
"aria-hidden": !showClear,
|
|
189
197
|
tabIndex: showClear ? 0 : -1,
|
|
190
198
|
onPointerDown: (event) => event.preventDefault(),
|
|
@@ -197,7 +205,6 @@ var NumberInput = ({
|
|
|
197
205
|
/* @__PURE__ */ jsx(
|
|
198
206
|
NumberInput$1.IncrementTrigger,
|
|
199
207
|
{
|
|
200
|
-
"aria-label": "Increment",
|
|
201
208
|
disabled: !wrap && !!(max !== void 0 && (value ?? 0) >= max),
|
|
202
209
|
...props({
|
|
203
210
|
"data-disabled": !wrap && !!(max !== void 0 && (value ?? 0) >= max)
|
|
@@ -213,7 +220,6 @@ var NumberInput = ({
|
|
|
213
220
|
/* @__PURE__ */ jsx(
|
|
214
221
|
NumberInput$1.DecrementTrigger,
|
|
215
222
|
{
|
|
216
|
-
"aria-label": "Decrement",
|
|
217
223
|
disabled: !wrap && !!(min !== void 0 && (value ?? 0) <= min),
|
|
218
224
|
...props({
|
|
219
225
|
"data-disabled": !wrap && !!(min !== void 0 && (value ?? 0) <= min)
|
|
@@ -237,6 +243,6 @@ var NumberInput = ({
|
|
|
237
243
|
);
|
|
238
244
|
};
|
|
239
245
|
|
|
240
|
-
export { NumberInput };
|
|
241
|
-
//# sourceMappingURL=chunk-
|
|
242
|
-
//# sourceMappingURL=chunk-
|
|
246
|
+
export { NUMBER_INPUT_DEFAULT_TRANSLATIONS, NumberInput };
|
|
247
|
+
//# sourceMappingURL=chunk-GCGX4FEF.js.map
|
|
248
|
+
//# sourceMappingURL=chunk-GCGX4FEF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/number-input/number-input.tsx"],"names":["Ark"],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CAAC,IAAA,IAAQ,CAAC,EAAE,GAAA,KAAQ,MAAA,IAAA,CAAc,SAAS,CAAA,KAAM,GAAA;AAAA,yBACnE,CAAA;AAAA,wBACD,SAAA,EAAW,EAAA;AAAA,0BACT,kDAAA;AAAA,0BACA,8JAAA;AAAA,0BACA;AAAA,yBACF;AAAA,wBAEA,8BAAC,SAAA,EAAA,EAAU;AAAA;AAAA,qBACb;AAAA,oCACA,GAAA;AAAA,sBAACA,aAAA,CAAI,gBAAA;AAAA,sBAAJ;AAAA,wBACC,QAAA,EAAU,CAAC,IAAA,IAAQ,CAAC,EAAE,GAAA,KAAQ,MAAA,IAAA,CAAc,SAAS,CAAA,KAAM,GAAA,CAAA;AAAA,wBAC1D,GAAG,KAAA,CAAM;AAAA,0BACR,eAAA,EAAiB,CAAC,IAAA,IAAQ,CAAC,EAAE,GAAA,KAAQ,MAAA,IAAA,CAAc,SAAS,CAAA,KAAM,GAAA;AAAA,yBACnE,CAAA;AAAA,wBACD,SAAA,EAAW,EAAA;AAAA,0BACT,kDAAA;AAAA,0BACA,8JAAA;AAAA,0BACA;AAAA,yBACF;AAAA,wBAEA,8BAAC,WAAA,EAAA,EAAY;AAAA;AAAA;AACf,mBAAA,EACF;AAAA;AAAA;AAAA,aAEJ;AAAA,UAEJ,CAAA,EACF;AAAA;AAAA;AACF;AAAA,GACF;AAEJ","file":"chunk-GCGX4FEF.js","sourcesContent":["\"use client\"\n\nimport { useFieldContext } from \"@ark-ui/react/field\"\nimport { NumberInput as Ark, useNumberInputContext } from \"@ark-ui/react/number-input\"\nimport { ChevronDown, ChevronUp } from \"lucide-react\"\nimport {\n type ComponentProps,\n type FocusEvent,\n type KeyboardEvent,\n type ReactNode,\n type Ref,\n useRef,\n} from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { mergeRefs } from \"../../lib/merge-refs\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { type FieldProps, FieldShell, fieldA11yProps } from \"../field/field\"\nimport {\n InputBase,\n type InputSize,\n type InputVariant,\n inputControlClasses,\n inputSlot,\n} from \"../input/input\"\nimport { CloseIcon } from \"../popover/icons\"\nimport { popoverClearTrigger } from \"../popover/popover\"\n\n/** Ark's own NumberInput `translations` type (`incrementLabel`, `decrementLabel`, and\n * `valueText` for `aria-valuetext`), derived structurally rather than imported from\n * `@zag-js/number-input`, plus the combobox family's `clearTriggerLabel` for the kit's own\n * clear button. */\nexport type NumberInputTranslations = NonNullable<\n ComponentProps<typeof Ark.Root>[\"translations\"]\n> & {\n clearTriggerLabel?: string\n}\n\nexport const NUMBER_INPUT_DEFAULT_TRANSLATIONS = {\n incrementLabel: \"Increment\",\n decrementLabel: \"Decrement\",\n clearTriggerLabel: \"Clear value\",\n} as const satisfies NumberInputTranslations\n\n/**\n * NumberInput — a numeric `<input>` with increment / decrement steppers on Ark\n * UI's NumberInput machine. It lives on the same shell as [`Input`](/docs/input)\n * (border, focus ring, slots, invalid / disabled states) and adds spin buttons,\n * clamping, locale-aware formatting, and the full keyboard / wheel model.\n *\n * - Value is a real `number` here (or `null` for empty): the machine speaks\n * strings internally, but `value` / `defaultValue` take a `number | null`\n * and `onChange` hands one back — `null` whenever the field has no valid\n * number (empty, or mid-edit on a partial token).\n * - Like the rest of the family it carries its own `label` / `description` /\n * `error` / `required` via [`Field`](/docs/field); `error` flips the red\n * state, or set `invalid` directly.\n * - `hideControls` drops the steppers for a plain numeric field.\n * - `clearable` adds a clear (×) button once there's a value, resetting to\n * `null` — the numeric analogue of `Select`'s `clearable`.\n *\n * Palette rides on `data-color`, matching the family — but the shell's focus\n * halo is a fixed `brand-500`, so nothing here actually tints today.\n */\n\ntype NumberInputClassNames = {\n /** The field wrapper (label / description / error). */\n field?: string\n /** The label element itself — e.g. `\"sr-only\"` to keep the accessible name\n * without showing it (pair with `suffix` for a unit hint in its place). */\n label?: string\n /** The shell `<div>` (also targeted by `className`). */\n root?: string\n /** The inner `<input>` element. */\n input?: string\n /** The stepper column wrapping the increment / decrement triggers. */\n control?: string\n}\n\nexport type NumberInputProps = Pick<FieldProps, \"label\" | \"description\" | \"error\" | \"required\"> &\n WithTestId & {\n /** Controlled value; `null` for empty. */\n value?: number | null\n /** Uncontrolled initial value; `null` for empty. */\n defaultValue?: number | null\n /** Fires with the next numeric value, or `null` when the field has no valid number. */\n onChange?: (value: number | null) => void\n /** Minimum value. */\n min?: number\n /** Maximum value. */\n max?: number\n /** Increment / decrement step. */\n step?: number\n /** Placeholder shown while the field is empty. */\n placeholder?: string\n /** Options forwarded to `Intl.NumberFormat` for display (currency, percent, …). */\n formatOptions?: Intl.NumberFormatOptions\n /** Allow the mouse wheel to change the value while focused. */\n allowMouseWheel?: boolean\n /** Clamp the value into `[min, max]` when the input blurs. */\n clampValueOnBlur?: boolean\n /** Wrap past `min` / `max` instead of clamping (23 → 0, 0 → 59, …) — for\n * cyclical fields like hours/minutes. Requires both `min` and `max`, and\n * the field to be used controlled: the wrapped value round-trips back in\n * as `value` on the next render to correct the display.\n *\n * Only *stepping* wraps (arrow keys, steppers, wheel). Typing behaves like\n * a clock segment instead: a digit that would overflow `max` (or its digit\n * count) replaces the whole field rather than being inserted, so `10` + a\n * `2` typed at the start reads `2`, not `210`. A typed value still out of\n * range (a partial `0` in a 1–12 field, a paste) isn't reported until it\n * is either completed or clamped into range on blur. */\n wrap?: boolean\n /** Hide the increment / decrement steppers for a plain numeric field. */\n hideControls?: boolean\n /** Show a clear button once there's a value, resetting to `null`. */\n clearable?: boolean\n /** Field name for native form submission. */\n name?: string\n /** Red invalid state; OR'd with `error`. */\n invalid?: boolean\n /** Dims the shell and disables the input. */\n disabled?: boolean\n /** Keeps full contrast but blocks edits. */\n readOnly?: boolean\n variant?: InputVariant\n size?: InputSize\n /** Inline-start adornment (icon, prefix). */\n startSlot?: ReactNode\n /** Non-interactive unit hint (e.g. `\"h\"`, `\"%\"`) rendered right after the\n * value, before the clear button / steppers — `aria-hidden` and\n * non-selectable, never part of the editable value. Distinct from a\n * generic end adornment: `InputBase`'s `endSlot` renders after *all*\n * content (i.e. after the steppers here), which would sit away from the\n * digits instead of glued to them. */\n suffix?: ReactNode\n /** Explicit id for label association. */\n id?: string\n /** Lands on the `<input>` for focus-on-error. */\n ref?: Ref<HTMLInputElement>\n /** Forwarded to the `<input>`; drives touched/blurred validation. */\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void\n className?: string\n classNames?: NumberInputClassNames\n /** Overrides the steppers' (`incrementLabel`, `decrementLabel`, default `\"Increment\"` /\n * `\"Decrement\"`) and the clear button's (`clearTriggerLabel`, default `\"Clear value\"`)\n * accessible names, and sets `valueText` (the input's `aria-valuetext`). A partial override\n * keeps the other defaults. */\n translations?: NumberInputTranslations\n }\n\n/** Bridge the kit's `number | null` value to the machine's string contract:\n * `undefined` stays uncontrolled, `null` is a controlled empty field. */\nconst toArkValue = (value: number | null | undefined): string | undefined =>\n value === undefined ? undefined : value === null ? \"\" : String(value)\n\n/** Wrap `raw` into `[min, max]` (inclusive), e.g. `wrapValue(24, 0, 23) === 0`. */\nconst wrapValue = (raw: number, min: number, max: number): number => {\n const span = max - min + 1\n return ((((raw - min) % span) + span) % span) + min\n}\n\n/** `wrap`'s bounds. */\ntype WrapCycle = { min: number; max: number }\n\n/** Under `wrap`, select the whole field before a digit lands if inserting it at\n * the caret would overflow `max` (by value or digit count) — the browser's own\n * insertion then replaces the field with that digit, like a clock segment. */\nconst selectOnOverflow = (event: KeyboardEvent<HTMLInputElement>, max: number) => {\n if (!/^\\d$/.test(event.key) || event.ctrlKey || event.metaKey || event.altKey) return\n const input = event.currentTarget\n const { value } = input\n const start = input.selectionStart ?? value.length\n const end = input.selectionEnd ?? value.length\n const next = value.slice(0, start) + event.key + value.slice(end)\n if (next.length > String(max).length || Number(next) > max) input.select()\n}\n\n/**\n * The real `<input>`, split out so it reads the `Field` context from *inside*\n * the wrapping `FieldShell` — `NumberInput` itself renders that shell, so\n * calling `useFieldContext()` at its own top level would run too early.\n */\nconst NumberInputField = ({\n ref,\n placeholder,\n onBlur,\n testId,\n className,\n cycle,\n}: {\n ref?: Ref<HTMLInputElement>\n placeholder?: string\n onBlur?: (event: FocusEvent<HTMLInputElement>) => void\n testId?: string\n className?: string\n cycle?: WrapCycle\n}) => {\n const field = useFieldContext()\n const api = useNumberInputContext()\n if (!cycle) {\n return (\n <Ark.Input\n ref={ref}\n placeholder={placeholder}\n onBlur={onBlur}\n data-testid={testId}\n {...fieldA11yProps(field)}\n className={className}\n />\n )\n }\n return (\n <Ark.Input\n ref={ref}\n placeholder={placeholder}\n onKeyDown={(event) => selectOnOverflow(event, cycle.max)}\n // Home/End jump to Ark's own `min`/`max`, which it never sees under `wrap` — it would land\n // on ±`MAX_SAFE_INTEGER` and wrap to an arbitrary value. Capture runs before Ark's own\n // handler; stopping propagation is what skips it (Ark's `defaultPrevented` bail-out reads\n // the synthetic event's creation-time snapshot, so `preventDefault` alone doesn't).\n onKeyDownCapture={(event) => {\n if (event.key !== \"Home\" && event.key !== \"End\") return\n if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return\n event.preventDefault()\n event.stopPropagation()\n api.setValue(event.key === \"Home\" ? cycle.min : cycle.max)\n }}\n onBlur={(event) => {\n // A typed value never wraps, so one left out of range is clamped here instead —\n // Ark's own clamp-on-blur is off under `wrap` (it never sees `min`/`max`).\n const raw = api.valueAsNumber\n if (!Number.isNaN(raw) && (raw < cycle.min || raw > cycle.max)) {\n api.setValue(Math.min(Math.max(raw, cycle.min), cycle.max))\n }\n onBlur?.(event)\n }}\n // Ark only sees `min`/`max` outside `wrap`, so restore the real range here.\n aria-valuemin={cycle.min}\n aria-valuemax={cycle.max}\n data-testid={testId}\n {...fieldA11yProps(field)}\n className={className}\n />\n )\n}\n\nexport const NumberInput = ({\n value,\n defaultValue,\n onChange,\n min,\n max,\n step,\n placeholder,\n formatOptions,\n allowMouseWheel,\n clampValueOnBlur,\n wrap,\n hideControls,\n clearable,\n name,\n invalid,\n disabled,\n readOnly,\n required,\n label,\n description,\n error,\n variant = \"default\",\n size = \"md\",\n startSlot,\n suffix,\n id,\n ref,\n onBlur,\n className,\n classNames,\n testId,\n translations,\n}: NumberInputProps) => {\n const resolvedTranslations = { ...NUMBER_INPUT_DEFAULT_TRANSLATIONS, ...translations }\n // Drive the red state independently of the `Field` error slot so a form\n // library can flip it from `fieldState.invalid` (see FormControlProps).\n const isInvalid = invalid || error != null\n const inputRef = useRef<HTMLInputElement>(null)\n const cycle: WrapCycle | undefined =\n wrap && min !== undefined && max !== undefined ? { min, max } : undefined\n\n return (\n <FieldShell\n label={label}\n description={description}\n error={error}\n required={required}\n disabled={disabled}\n size={size}\n className={classNames?.field}\n classNames={{ label: classNames?.label }}\n >\n <Ark.Root\n value={toArkValue(value)}\n defaultValue={toArkValue(defaultValue)}\n onValueChange={\n onChange\n ? (details) => {\n const raw = details.valueAsNumber\n if (Number.isNaN(raw)) {\n onChange(null)\n } else if (cycle) {\n // Only stepping wraps. A typed change is already in the `<input>` when it is\n // reported, while a stepped one (arrows, steppers, wheel) is only written to\n // the DOM on Ark's next frame — so a match means the user typed it. Typed\n // values are reported as-is when in range; an out-of-range one is held until\n // it is completed or clamped on blur (see `NumberInputField`).\n const typed = details.value === inputRef.current?.value\n if (!typed) onChange(wrapValue(raw, cycle.min, cycle.max))\n else if (raw >= cycle.min && raw <= cycle.max) onChange(raw)\n } else {\n onChange(raw)\n }\n }\n : undefined\n }\n // Wrapping fields disable Ark's own clamp so it always reports the true\n // out-of-range stepped value — `wrapValue` above normalizes it instead.\n min={wrap ? undefined : min}\n max={wrap ? undefined : max}\n step={step}\n formatOptions={formatOptions}\n allowMouseWheel={allowMouseWheel}\n clampValueOnBlur={clampValueOnBlur}\n name={name}\n {...props({ invalid: isInvalid, disabled, readOnly, required })}\n ids={id ? { input: id } : undefined}\n translations={resolvedTranslations}\n className={cn(\"w-full\", className)}\n >\n <Ark.Context>\n {(api) => {\n // `canClear` reserves the clear button's layout box (and the\n // shell's end-slot padding) for the whole time the field is\n // clearable, not just while it has a value — otherwise the\n // button mounting/unmounting shifts the input's width. `showClear`\n // only toggles its visibility/interactivity via `invisible`.\n const canClear = Boolean(clearable) && !disabled && !readOnly\n const showClear = canClear && !api.empty\n return (\n <InputBase\n variant={variant}\n size={size}\n invalid={isInvalid}\n disabled={disabled}\n readOnly={readOnly}\n startSlot={startSlot}\n // The steppers (and the clear button) are interactive — they must\n // not sit inside the `aria-hidden`, `[&_svg]:pointer-events-none`\n // end-slot span. Render them as direct children instead, and flag\n // the shell's end padding manually so the layout matches an\n // `endSlot`.\n classNames={{ root: classNames?.root }}\n className=\"pe-0! overflow-clip\"\n {...props({ \"data-with-end-slot\": !hideControls || canClear || suffix != null })}\n >\n {/* The shell's own `gap-*` (`shellGap`) is meant for *slots* — spacing the\n * control away from icons/steppers/clear button — not for the suffix, which is\n * documented (and used, e.g. `TimeRow`'s \"23h\") to sit glued right against the\n * value. Wrapping the two together in their own `gap`-less flex row keeps that\n * glued pairing regardless of `size`, while the shell's real gap still applies\n * between this pair and the next sibling (clear button / steppers). */}\n <div className=\"flex min-w-0 flex-1 items-center\">\n <NumberInputField\n ref={mergeRefs(inputRef, ref)}\n placeholder={placeholder}\n onBlur={onBlur}\n testId={testId}\n cycle={cycle}\n className={cn(inputControlClasses, classNames?.input)}\n />\n {suffix != null && (\n <span aria-hidden className={cn(inputSlot, \"select-none\")}>\n {suffix}\n </span>\n )}\n </div>\n {canClear && (\n <button\n type=\"button\"\n aria-label={resolvedTranslations.clearTriggerLabel}\n aria-hidden={!showClear}\n tabIndex={showClear ? 0 : -1}\n onPointerDown={(event) => event.preventDefault()}\n onClick={() => api.clearValue()}\n className={cn(popoverClearTrigger, !showClear && \"invisible\")}\n >\n <CloseIcon />\n </button>\n )}\n {!hideControls && (\n <Ark.Control className={cn(\"-my-1 flex flex-col\", classNames?.control)}>\n <Ark.IncrementTrigger\n disabled={!wrap && !!(max !== undefined && (value ?? 0) >= max)}\n {...props({\n \"data-disabled\": !wrap && !!(max !== undefined && (value ?? 0) >= max),\n })}\n className={cn(\n \"inline-flex shrink-0 items-center justify-center\",\n \"h-1/2 cursor-pointer w-6 dark:[&:hover:not([data-disabled])]:bg-gray-dark-800 [&:hover:not([data-disabled])]:bg-gray-light-300 transition-colors rounded-xxs\",\n \"data-disabled:cursor-not-allowed data-disabled:text-current/20\",\n )}\n >\n <ChevronUp />\n </Ark.IncrementTrigger>\n <Ark.DecrementTrigger\n disabled={!wrap && !!(min !== undefined && (value ?? 0) <= min)}\n {...props({\n \"data-disabled\": !wrap && !!(min !== undefined && (value ?? 0) <= min),\n })}\n className={cn(\n \"inline-flex shrink-0 items-center justify-center\",\n \"h-1/2 cursor-pointer w-6 dark:[&:hover:not([data-disabled])]:bg-gray-dark-800 [&:hover:not([data-disabled])]:bg-gray-light-300 transition-colors rounded-xxs\",\n \"data-disabled:cursor-not-allowed data-disabled:text-gray-light-500 dark:data-disabled:text-gray-dark-600\",\n )}\n >\n <ChevronDown />\n </Ark.DecrementTrigger>\n </Ark.Control>\n )}\n </InputBase>\n )\n }}\n </Ark.Context>\n </Ark.Root>\n </FieldShell>\n )\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { mergeRefs } from './chunk-UVYTJQTJ.js';
|
|
2
|
-
import { FieldShell, fieldA11yProps } from './chunk-
|
|
3
|
-
import { useDirectionCheck } from './chunk-
|
|
2
|
+
import { FieldShell, fieldA11yProps } from './chunk-TBTSEPGP.js';
|
|
3
|
+
import { useDirectionCheck } from './chunk-57BTVRRB.js';
|
|
4
4
|
import { useUncontrolled } from './chunk-BEL75C7N.js';
|
|
5
5
|
import { props } from './chunk-WYCMIIRR.js';
|
|
6
6
|
import { cn } from './chunk-QP4I37PA.js';
|
|
@@ -54,10 +54,13 @@ var segItemWrap = cva([
|
|
|
54
54
|
"before:absolute before:rounded-full before:bg-gray-light-300 dark:before:bg-gray-dark-600",
|
|
55
55
|
"group-data-invalid:before:bg-red-500/30",
|
|
56
56
|
"before:transition-opacity before:duration-200",
|
|
57
|
-
// Horizontal: a vertical rule centered on the leading edge, sitting in the gap.
|
|
58
|
-
|
|
59
|
-
//
|
|
60
|
-
"
|
|
57
|
+
// Horizontal: a vertical rule centered on the leading edge, sitting in the gap. Logical
|
|
58
|
+
// (`start`, `-ms-[0.5px]` to center the 1px rule), so under `dir="rtl"` the rule still lands
|
|
59
|
+
// between a segment and the one before it instead of on the far side.
|
|
60
|
+
"before:top-1/2 before:start-0 before:-ms-[0.5px] before:h-1/2 before:w-px before:-translate-y-1/2",
|
|
61
|
+
// Vertical: a horizontal rule centered on the top edge instead (`start-1/4` + `w-1/2` is
|
|
62
|
+
// centered in either direction).
|
|
63
|
+
"in-data-[orientation=vertical]:before:top-0 in-data-[orientation=vertical]:before:start-1/4 in-data-[orientation=vertical]:before:ms-0 in-data-[orientation=vertical]:before:h-px in-data-[orientation=vertical]:before:w-1/2",
|
|
61
64
|
// No separator before the first segment, or flanking the active pill.
|
|
62
65
|
"nth-2:before:hidden",
|
|
63
66
|
"data-[state=checked]:before:opacity-0 data-[state=checked]:[&+*]:before:opacity-0"
|
|
@@ -98,7 +101,7 @@ var segTray = cva(
|
|
|
98
101
|
{
|
|
99
102
|
variants: {
|
|
100
103
|
variant: {
|
|
101
|
-
filled: ["bg-
|
|
104
|
+
filled: ["bg-black/3 dark:bg-white/4", "border-transparent"],
|
|
102
105
|
light: ["bg-white/4", "border-brand-900/20 dark:border-white/15"],
|
|
103
106
|
outline: ["bg-transparent border-transparent"],
|
|
104
107
|
subtle: ["bg-transparent border-transparent"],
|
|
@@ -220,6 +223,7 @@ var SegmentGroup = ({
|
|
|
220
223
|
size,
|
|
221
224
|
className: classNames?.field,
|
|
222
225
|
classNames: { label: classNames?.label },
|
|
226
|
+
composite: true,
|
|
223
227
|
children: /* @__PURE__ */ jsxs(
|
|
224
228
|
SegmentGroupRoot,
|
|
225
229
|
{
|
|
@@ -290,5 +294,5 @@ var SegmentGroup = ({
|
|
|
290
294
|
};
|
|
291
295
|
|
|
292
296
|
export { SegmentGroup };
|
|
293
|
-
//# sourceMappingURL=chunk-
|
|
294
|
-
//# sourceMappingURL=chunk-
|
|
297
|
+
//# sourceMappingURL=chunk-HCYULRWT.js.map
|
|
298
|
+
//# sourceMappingURL=chunk-HCYULRWT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/segment-group/segment-group.tsx"],"names":["Ark"],"mappings":";;;;;;;;;;;;AAqEA,IAAM,OAAA,GAAU,GAAA;AAAA,EACd;AAAA,IACE,aAAA;AAAA,IACA,wEAAA;AAAA,IACA,6CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAKA,0GAAA;AAAA,IACA,mBAAA;AAAA,IACA,2DAAA;AAAA,IACA;AAAA,GACF;AAAA,EACA;AAAA,IACE,QAAA,EAAU;AAAA,MACR,OAAA,EAAS;AAAA,QACP,MAAA,EAAQ,0CAAA;AAAA,QACR,KAAA,EAAO,sCAAA;AAAA,QACP,OAAA,EAAS,sCAAA;AAAA,QACT,MAAA,EAAQ,sCAAA;AAAA,QACR,OAAA,EAAS;AAAA,OACX;AAAA,MACA,IAAA,EAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAMJ,EAAA,EAAI,+CAAA;AAAA,QACJ,EAAA,EAAI,iDAAA;AAAA,QACJ,EAAA,EAAI,+CAAA;AAAA,QACJ,EAAA,EAAI,+CAAA;AAAA,QACJ,EAAA,EAAI;AAAA;AACN,KACF;AAAA,IACA,eAAA,EAAiB,EAAE,OAAA,EAAS,SAAA,EAAW,MAAM,IAAA;AAAK;AAEtD,CAAA;AAWA,IAAM,cAAc,GAAA,CAAI;AAAA,EACtB,0BAAA;AAAA,EACA,2FAAA;AAAA,EACA,yCAAA;AAAA,EACA,+CAAA;AAAA;AAAA;AAAA;AAAA,EAIA,mGAAA;AAAA;AAAA;AAAA,EAGA,+NAAA;AAAA;AAAA,EAEA,qBAAA;AAAA,EACA;AACF,CAAC,CAAA;AAWD,IAAM,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AAI,CAAC,IAAA,qBACf,IAAA;AAAA,cAACA,cAAA,CAAI,IAAA;AAAA,cAAJ;AAAA,gBAEC,OAAO,IAAA,CAAK,KAAA;AAAA,gBACZ,UAAU,IAAA,CAAK,QAAA;AAAA,gBACf,eAAa,IAAA,CAAK,MAAA;AAAA,gBAClB,SAAA,EAAW,EAAA,CAAG,WAAA,EAAY,EAAG,YAAY,IAAI,CAAA;AAAA,gBAE7C,QAAA,EAAA;AAAA,kCAAA,GAAA;AAAA,oBAACA,cAAA,CAAI,QAAA;AAAA,oBAAJ;AAAA,sBACC,cAAY,IAAA,CAAK,KAAA;AAAA,sBACjB,SAAA,EAAW,GAAG,OAAA,CAAQ,EAAE,MAAM,OAAA,EAAS,CAAA,EAAG,UAAA,EAAY,QAAQ,CAAA;AAAA,sBAI7D,QAAA,EAAA,UAAA,uBACEA,cAAA,CAAI,WAAA,EAAJ,EACE,QAAA,EAAA,CAAC,GAAA,KACA,WAAW,IAAA,EAA4C;AAAA,wBACrD,SAAS,GAAA,CAAI,OAAA;AAAA,wBACb,UAAU,GAAA,CAAI;AAAA,uBACf,CAAA,EAEL,CAAA,GAEA,IAAA,CAAK;AAAA;AAAA,mBAET;AAAA,kCACA,GAAA,CAACA,cAAA,CAAI,WAAA,EAAJ,EAAgB,CAAA;AAAA,kCACjB,GAAA,CAACA,cAAA,CAAI,eAAA,EAAJ,EAAoB;AAAA;AAAA,eAAA;AAAA,cA1BhB,IAAA,CAAK;AAAA,aA4Bb;AAAA;AAAA,SAAA;AAAA,QAjFI;AAAA;AAkFP;AAAA,GACF;AAEJ","file":"chunk-HCYULRWT.js","sourcesContent":["\"use client\"\n\nimport { useFieldContext } from \"@ark-ui/react/field\"\nimport { SegmentGroup as Ark } from \"@ark-ui/react/segment-group\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { type FocusEvent, type ReactNode, type Ref, useMemo } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport type { Color } from \"../../lib/colors\"\nimport { useDirectionCheck } from \"../../lib/intl\"\nimport { mergeRefs } from \"../../lib/merge-refs\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { useUncontrolled } from \"../../lib/use-uncontrolled\"\nimport { type FieldProps, FieldShell, fieldA11yProps } from \"../field/field\"\n\n/**\n * SegmentGroup — a segmented single-choice control on Ark UI's SegmentGroup\n * machine (the radio-group model under the hood). It renders a row (or column)\n * of mutually exclusive segments with a sliding pill that animates to the\n * selected item. Use it as a compact, always-visible alternative to a `Select`\n * when the option set is small (2–5 items): view toggles, filters, billing\n * cadence, and the like.\n *\n * - Value is a single `string | null`; `onChange` hands it to you directly,\n * matching the kit's value-based `FormControlProps` contract.\n * - `data` accepts bare strings (`value === label`) or\n * `{ value, label?, disabled?, color?, payload? }` objects, mixed freely.\n * The component is generic over `data` (a `const` type parameter), so\n * `value` / `onChange` narrow to the literal value union and an item's\n * `payload` flows—typed—into `renderItem` (the same contract as `Select`).\n * - Label / description / error / required come from the built-in `Field`\n * wrapper, so a `SegmentGroup` is accessible and complete on its own.\n * - `name` renders a hidden radio input per item, so the selected value rides\n * a native `<form>` submission.\n *\n * `variant` mirrors the `Button` family (`filled` / `light` / `outline` /\n * `subtle` / `default`): the tray, the sliding pill, and the checked label all\n * adopt the variant's treatment off the shared `--c-*` slots. Palette rides on\n * `data-color`, so every kit color tints for free, `default` included — its pill\n * falls back to solid black/white with no color set, because `:root` defines\n * `--c-solid`/`--c-on-solid` as black/white (white/brand-950 under dark). A\n * per-item `color` overrides the group palette for whichever segment is\n * selected: it re-stamps `data-color` on that item and on the pill, so both\n * the fill and the checked label resolve from the same block.\n *\n * The moving pill is the Ark `Indicator`: Ark positions it absolutely via the\n * CSS vars `--left` / `--top` / `--width` / `--height` (the selected segment's\n * measured rect), so it sits *behind* the labels (`z-0`). Ark only re-measures\n * that rect on mount and on value change — not when `orientation` flips — so we\n * remount the root with `key={orientation}` to force a fresh measure on the new\n * axis. The value is held in `useUncontrolled` so the selection survives that\n * remount.\n */\n\n/**\n * Per-segment label: size sets the padding / text, `variant` sets the *checked*\n * text color so it reads against that variant's pill. The unchecked color is a\n * neutral gray applied at the call site.\n *\n * The checked label must come from the same source as the pill under it.\n * `default` and `filled` both paint `bg-(--c-solid)`, so both take\n * `--c-on-solid` — which resolves per-item, since each `ItemText` carries its\n * own `data-color`. Pairing a hard-coded neutral foreground with a `--c-solid`\n * fill is what broke `default` at any group `color` (#140): the pill moved with\n * the palette and the label stayed put, reaching 3.27:1 on brand. There is\n * deliberately no hover shift on the checked label — `Button`'s `filled` moves\n * only the background and keeps `--c-on-solid`, and no `--c-on-solid-hover`\n * slot exists in `colors.css`.\n */\nconst segItem = cva(\n [\n \"font-medium\",\n \"cursor-pointer rounded-input text-center whitespace-nowrap select-none\",\n \"text-gray-light-700 dark:text-gray-dark-300\",\n // Only unchecked segments get the hover lift — see the Tabs twin. An\n // unscoped `hover:` ties on specificity with the checked foreground and\n // won on source order in dark theme, washing the checked label to\n // near-white over a colored pill.\n \"not-data-[state=checked]:hover:text-gray-light-950 dark:not-data-[state=checked]:hover:text-gray-dark-50\",\n \"transition-colors\",\n \"data-disabled:cursor-not-allowed data-disabled:opacity-50\",\n \"group-data-invalid:text-red-500\",\n ],\n {\n variants: {\n variant: {\n filled: \"data-[state=checked]:text-(--c-on-solid)\",\n light: \"data-[state=checked]:text-(--c-text)\",\n outline: \"data-[state=checked]:text-(--c-text)\",\n subtle: \"data-[state=checked]:text-(--c-text)\",\n default: \"data-[state=checked]:text-(--c-on-solid)\",\n },\n size: {\n // No vertical padding of its own — the tray's `min-h` (below) sets the\n // box height and this item stretches to fill it (the tray's default\n // `align-items: stretch` propagates all the way down), so the label\n // just needs to center itself inside that taller box. This matches an\n // `Input` / `NumberInput`'s exact box height at the same size.\n xs: \"flex items-center justify-center px-1 text-xs\",\n sm: \"flex items-center justify-center px-1.5 text-sm\",\n md: \"flex items-center justify-center px-2 text-md\",\n lg: \"flex items-center justify-center px-3 text-lg\",\n xl: \"flex items-center justify-center px-4 text-xl\",\n },\n },\n defaultVariants: { variant: \"default\", size: \"md\" },\n },\n)\n\n/**\n * Per-segment wrapper. Beyond positioning the label above the pill (`z-1`), it\n * draws a hairline separator in the gap to its leading edge (a `::before`) so\n * inactive neighbours read as divided. That rule fades out next to the active\n * pill — on the checked segment and the one right after it — and is suppressed\n * before the first segment (the indicator is child 1, so the first segment is\n * `:nth-child(2)`). It flips from a vertical rule to a horizontal one when the\n * group is laid out vertically.\n */\nconst segItemWrap = cva([\n \"relative z-1 inline-flex\",\n \"before:absolute before:rounded-full before:bg-gray-light-300 dark:before:bg-gray-dark-600\",\n \"group-data-invalid:before:bg-red-500/30\",\n \"before:transition-opacity before:duration-200\",\n // Horizontal: a vertical rule centered on the leading edge, sitting in the gap. Logical\n // (`start`, `-ms-[0.5px]` to center the 1px rule), so under `dir=\"rtl\"` the rule still lands\n // between a segment and the one before it instead of on the far side.\n \"before:top-1/2 before:start-0 before:-ms-[0.5px] before:h-1/2 before:w-px before:-translate-y-1/2\",\n // Vertical: a horizontal rule centered on the top edge instead (`start-1/4` + `w-1/2` is\n // centered in either direction).\n \"in-data-[orientation=vertical]:before:top-0 in-data-[orientation=vertical]:before:start-1/4 in-data-[orientation=vertical]:before:ms-0 in-data-[orientation=vertical]:before:h-px in-data-[orientation=vertical]:before:w-1/2\",\n // No separator before the first segment, or flanking the active pill.\n \"nth-2:before:hidden\",\n \"data-[state=checked]:before:opacity-0 data-[state=checked]:[&+*]:before:opacity-0\",\n])\n\n/**\n * The sliding pill, mirroring each `Button` surface. Its slide + color transition\n * is driven by Ark (see the `--transition-*` overrides on the element); `default`\n * follows `--c-solid` like every other variant, which falls back to solid\n * black/white with no `data-color` set. Filled/soft-fill pills (`filled`, `light`,\n * `default`) use a tighter `rounded-xxs` than the tray's own `rounded-input`, for a\n * nested-corner look inside the tray's padding; bordered/transparent pills\n * (`outline`, `subtle`) keep `rounded-input`.\n */\nconst segIndicator = cva(\"z-0\", {\n variants: {\n variant: {\n filled: \"bg-(--c-solid) rounded-xxs\",\n light: \"bg-(--c-soft) border border-(--c-soft-hover) rounded-xxs\",\n outline: \"bg-transparent border border-(--c-solid) rounded-input\",\n subtle: \"bg-(--c-soft-hover) rounded-input\",\n default: \"bg-(--c-solid) rounded-xxs\",\n },\n },\n defaultVariants: { variant: \"default\" },\n})\n\n/**\n * The tray. Mirrors the `Button` variants: `filled` is a borderless neutral fill\n * so the colored pill pops (the kit's quiet `bg-black/3 dark:bg-white/4`; light\n * mode darkens because a bare `bg-white/4` vanishes on a near-white page), `light` / `default` frame the pill with the same\n * translucent surface as `Input`'s own `default` shell (`bg-white/4` + the\n * hairline `border-brand-900/20 dark:border-white/15`) rather than an opaque\n * gray step, so the tray reads correctly on any host background, `subtle` /\n * `outline` are chromeless.\n */\nconst segTray = cva(\n [\n \"relative inline-flex rounded-input border p-0.5 transition-colors max-w-fit group\",\n \"data-[orientation=vertical]:flex-col\",\n \"data-disabled:cursor-not-allowed data-disabled:opacity-60\",\n // Focus halo + accent border, driven by the active palette's `--c-solid`. Keyed\n // off Zag's `data-focus-visible` (set only when the focus came from the keyboard,\n // never a mouse click) via `:has()`, so the ring stays off when you click a segment.\n //\n // Deliberately NOT `focusStyles`. This is the *shell* idiom, not the ring\n // idiom: an accent border plus a soft `/15` halo on a wrapper whose focus\n // lives on a descendant, with a red invalid twin on the identical selector.\n // That is `input.tsx`'s `shellChrome`, not `Button`'s ring — folding it into\n // `focusStyles` would make that helper grow an alpha, a border half and a\n // concept of invalid, for one call site. The two shells are worth sharing\n // with each other instead; see the follow-up issue.\n \"has-data-focus-visible:border-(--c-solid) has-data-focus-visible:ring-2 has-data-focus-visible:ring-(--c-solid)/15\",\n // Invalid wins over the palette: red border + red halo.\n \"data-invalid:border-red-500 data-invalid:has-data-focus-visible:border-red-500 data-invalid:has-data-focus-visible:ring-red-500/15 data-invalid:bg-red-500/10\",\n // Disabled affordances on the shell.\n ],\n {\n variants: {\n variant: {\n filled: [\"bg-black/3 dark:bg-white/4\", \"border-transparent\"],\n light: [\"bg-white/4\", \"border-brand-900/20 dark:border-white/15\"],\n outline: [\"bg-transparent border-transparent\"],\n subtle: [\"bg-transparent border-transparent\"],\n default: [\"bg-white/4\", \"border-brand-900/20 dark:border-white/15\"],\n },\n size: {\n // The exact `min-h` `inputShell` (input.tsx) uses at the same size —\n // so a `SegmentGroup` sits flush with an `Input` / `NumberInput` of\n // the same size in a row (see `TimeRow`, which composes both).\n xs: \"gap-0 min-h-7\",\n sm: \"gap-0 min-h-8\",\n md: \"gap-0 min-h-9\",\n lg: \"gap-0 min-h-10\",\n xl: \"gap-0 min-h-12\",\n },\n },\n defaultVariants: { variant: \"default\" },\n },\n)\n\nexport type SegmentGroupSize = NonNullable<VariantProps<typeof segItem>[\"size\"]>\nexport type SegmentGroupVariant = VariantProps<typeof segTray>[\"variant\"]\n\n/**\n * A single segment: a bare value-as-label string, or a labelled object. Objects\n * may carry a `payload` of arbitrary data (the machine ignores it; it flows\n * through to `renderItem`, typed off the `data` shape — the same contract as\n * `Select`'s `SelectItem`).\n */\nexport type SegmentGroupItem<P = unknown> =\n | string\n | {\n value: string\n label?: ReactNode\n disabled?: boolean\n /** Overrides the group palette for the pill + label when this item is selected. */\n color?: Color\n /** Arbitrary extra data, surfaced to `renderItem`. */\n payload?: P\n /** `data-testid` on the rendered segment. Defaults to `` `item-${value}` ``. */\n testId?: string\n }\n\n/** The `data` array the component is generic over. */\nexport type SegmentGroupData<P = unknown> = ReadonlyArray<SegmentGroupItem<P>>\n\n/**\n * Extract the value-string union from a `SegmentGroupData` shape — bare strings\n * and item `.value`s both contribute. A `const` type parameter narrows it to the\n * literal union, so `value` / `onChange` are typed off the data (like `Select`).\n */\nexport type SegmentGroupValue<Data extends SegmentGroupData> = ItemValue<Data[number]>\ntype ItemValue<E> = E extends string ? E : E extends { value: infer V extends string } ? V : never\n\n/**\n * Extract the `payload` type carried by a `SegmentGroupData` shape, read\n * structurally off the data's `payload` property. Bare strings contribute\n * `never`; a homogeneous payload resolves precisely, a mixed one to the union.\n */\nexport type SegmentGroupPayload<Data extends SegmentGroupData> = PayloadOf<Data[number]>\ntype PayloadOf<T> = T extends string ? never : T extends { payload?: infer P } ? P : never\n\n/**\n * The segment handed to `renderItem`: `value` narrowed to the data's value union\n * and `payload` to the data's payload type, so a `const`-typed `data` yields\n * literal values and a precise payload in the callback.\n */\nexport type RenderableSegment<Data extends SegmentGroupData> = {\n value: SegmentGroupValue<Data>\n label: ReactNode\n disabled: boolean\n color: Color | undefined\n payload: SegmentGroupPayload<Data> | undefined\n}\n\n/** Live segment state passed alongside the item to `renderItem`. */\nexport type SegmentRenderState = {\n checked: boolean\n disabled: boolean\n}\n\n/**\n * Render a segment's label content yourself. Receives the (value-narrowed) item —\n * including its typed `payload` — and its live `{ checked, disabled }` state. The\n * segment keeps its sizing, pill, and selection wiring; you fill the label. In an\n * RSC tree the function must live in a `\"use client\"` module so the boundary\n * serializes it as a client reference.\n */\nexport type RenderSegment<Data extends SegmentGroupData> = (\n item: RenderableSegment<Data>,\n state: SegmentRenderState,\n) => ReactNode\n\ntype SegmentGroupClassNames = {\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 indicator?: string\n item?: string\n itemText?: string\n}\n\nexport type SegmentGroupProps<Data extends SegmentGroupData = SegmentGroupData> = Pick<\n FieldProps,\n \"label\" | \"description\" | \"error\" | \"required\"\n> &\n WithTestId & {\n /** Segments: bare strings (`value === label`) or `{ value, label?, disabled?, color?, payload? }`. */\n data: Data\n /** Controlled value. `null` clears the selection. */\n value?: SegmentGroupValue<Data> | null\n /** Uncontrolled initial value. */\n defaultValue?: SegmentGroupValue<Data> | null\n /** Fires with the selected value. */\n onChange?: (value: SegmentGroupValue<Data>) => void\n /** Render each segment's label content yourself, with its typed `payload`. */\n renderItem?: RenderSegment<Data>\n /** Lay the segments 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 interaction. */\n disabled?: boolean\n /** Keeps full contrast but blocks edits. */\n readOnly?: boolean\n /** `xs`–`xl` match the exact box height of an `Input` / `NumberInput` at\n * that size, so a `SegmentGroup` composes flush inline next to one (see\n * `TimeInput`'s AM/PM toggle). */\n size?: SegmentGroupSize\n variant?: SegmentGroupVariant\n color?: Color\n /** Wires the hidden radio inputs into native form submission. */\n name?: string\n /** Explicit id for label association. */\n id?: string\n /** Lands on the root for focus-on-error. */\n ref?: Ref<HTMLDivElement>\n /** Forwarded to the root; drives touched/blurred validation. */\n onBlur?: (event: FocusEvent<HTMLDivElement>) => void\n className?: string\n classNames?: SegmentGroupClassNames\n }\n\n/** A fully resolved segment — every field present (`label` falls back to `value`). */\ntype NormalizedItem = {\n value: string\n label: ReactNode\n disabled: boolean\n color: Color | undefined\n payload: unknown\n testId: string\n}\n\n/** Normalize a bare string / object into the resolved `NormalizedItem` form. */\nconst normalizeItem = (item: SegmentGroupItem): NormalizedItem =>\n typeof item === \"string\"\n ? {\n value: item,\n label: item,\n disabled: false,\n color: undefined,\n payload: undefined,\n testId: `item-${item}`,\n }\n : {\n value: item.value,\n label: item.label ?? item.value,\n disabled: item.disabled ?? false,\n color: item.color,\n payload: item.payload,\n testId: item.testId ?? `item-${item.value}`,\n }\n\n/**\n * The real `role=\"radiogroup\"` root (and, through it, each item's hidden\n * radio input), split out so it reads the `Field` context from *inside* the\n * wrapping `FieldShell` — `SegmentGroup` itself renders that shell, so\n * calling `useFieldContext()` at its own top level would run too early.\n * Takes plain `string` values rather than the outer component's `Data`-typed\n * union: it only forwards them, so no generic type parameter is needed here.\n */\nconst SegmentGroupRoot = ({\n value,\n onValueChange,\n disabled,\n readOnly,\n required,\n invalid,\n orientation,\n name,\n id,\n ref,\n onBlur,\n color,\n className,\n testId,\n children,\n}: {\n value: string | null\n onValueChange: (value: string | null) => void\n disabled?: boolean\n readOnly?: boolean\n required?: boolean\n invalid: boolean\n orientation: \"horizontal\" | \"vertical\"\n name?: string\n id?: string\n ref?: Ref<HTMLDivElement>\n onBlur?: (event: FocusEvent<HTMLDivElement>) => void\n color?: Color\n className?: string\n children: ReactNode\n} & WithTestId) => {\n const field = useFieldContext()\n const checkDirection = useDirectionCheck()\n const rootRef = useMemo(() => mergeRefs(ref, checkDirection), [ref, checkDirection])\n return (\n <Ark.Root\n value={value}\n onValueChange={(d) => onValueChange(d.value)}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n invalid={invalid}\n orientation={orientation}\n name={name}\n id={id}\n ref={rootRef}\n onBlur={onBlur}\n data-color={color}\n {...props({ \"data-invalid\": invalid, \"data-testid\": testId })}\n {...fieldA11yProps(field)}\n className={className}\n >\n {children}\n </Ark.Root>\n )\n}\n\nexport const SegmentGroup = <const Data extends SegmentGroupData = SegmentGroupData>({\n data,\n value,\n defaultValue,\n onChange,\n renderItem,\n orientation = \"horizontal\",\n invalid,\n disabled,\n readOnly,\n required,\n size = \"md\",\n variant = \"default\",\n color,\n name,\n id,\n ref,\n onBlur,\n label,\n description,\n error,\n className,\n classNames,\n testId,\n}: SegmentGroupProps<Data>) => {\n // Red state is driven independently of the `Field` error slot so a form\n // library can flip it from `fieldState.invalid` (see FormControlProps).\n const isInvalid = invalid || error != null\n\n // Own the value so the pill can read which item is selected (per-item color)\n // and so the `key={orientation}` remount below preserves the selection.\n const [selectedValue, setSelectedValue] = useUncontrolled<SegmentGroupValue<Data> | null>({\n value,\n defaultValue,\n finalValue: null,\n onChange: (v) => v != null && onChange?.(v),\n })\n\n const normalized = (data as SegmentGroupData).map(normalizeItem)\n const selected = normalized.find((item) => item.value === selectedValue)\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 // A radio group: nothing carries the label's `for` id; the root's `aria-labelledby` names it.\n composite\n >\n {/* `key={orientation}` remounts the root on an axis flip so Ark re-measures\n the indicator rect for the new layout (it only measures on mount + value\n change). `useUncontrolled` keeps the selection across that remount. */}\n <SegmentGroupRoot\n key={orientation}\n value={selectedValue}\n // Ark's value is typed by the collection (`string`); the runtime value\n // always originates from `data`, so narrow it back to the caller's union.\n onValueChange={(v) => setSelectedValue(v as SegmentGroupValue<Data> | null)}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n invalid={isInvalid}\n orientation={orientation}\n name={name}\n id={id}\n ref={ref}\n onBlur={onBlur}\n color={color}\n testId={testId}\n className={segTray({\n variant,\n size,\n className: [className, classNames?.root],\n })}\n >\n {/* The sliding pill. Ark sets `position: absolute` + `--left`/`--top`/\n `--width`/`--height` (the selected segment's rect) inline, so it\n sits behind the labels (`z-0`). It adopts the selected item's `color`\n (falling back to the group `color`), which is the same `data-color`\n that item's own label carries — so the fill and the `--c-on-solid`\n text on top of it always resolve from one block.\n\n We drive the slide ourselves rather than via Ark's gated transition.\n Ark sets `transition-property: none` whenever its `animateIndicator`\n flag is false — including the instant it receives the `transitionend`\n of ANY animated property. With several properties of differing\n end-times (a `left` redirected by an interrupting click vs. a color or\n width that already settled), that early end would null the transition\n and snap the pill mid-slide. Overriding the real `transition-*` props\n (our `style` wins via Ark's `mergeProps`) keeps the transition always\n on, so the flag is irrelevant and interruptions re-target smoothly. The\n first paint stays instant because Ark renders the pill `hidden` until\n its rect is measured, and `display:none` can't transition. */}\n <Ark.Indicator\n style={{\n width: \"var(--width)\",\n height: \"var(--height)\",\n transitionProperty: \"left, top, width, height, background-color, border-color\",\n transitionDuration: \"200ms\",\n transitionTimingFunction: \"cubic-bezier(0.32, 0.72, 0, 1)\",\n }}\n {...props({ \"data-color\": selected?.color ?? color })}\n className={segIndicator({ className: classNames?.indicator, variant })}\n />\n {normalized.map((item) => (\n <Ark.Item\n key={item.value}\n value={item.value}\n disabled={item.disabled}\n data-testid={item.testId}\n className={cn(segItemWrap(), classNames?.item)}\n >\n <Ark.ItemText\n data-color={item.color}\n className={cn(segItem({ size, variant }), classNames?.itemText)}\n >\n {/* `renderItem` owns the label content (with the item's typed payload);\n the ItemText keeps its sizing, checked color, and pill wiring. */}\n {renderItem ? (\n <Ark.ItemContext>\n {(ctx) =>\n renderItem(item as unknown as RenderableSegment<Data>, {\n checked: ctx.checked,\n disabled: ctx.disabled,\n })\n }\n </Ark.ItemContext>\n ) : (\n item.label\n )}\n </Ark.ItemText>\n <Ark.ItemControl />\n <Ark.ItemHiddenInput />\n </Ark.Item>\n ))}\n </SegmentGroupRoot>\n </FieldShell>\n )\n}\n"]}
|
|
@@ -15,12 +15,17 @@ var FOCUS_OFFSET = {
|
|
|
15
15
|
"focus-visible": "focus-visible:ring-offset-2 focus-visible:ring-offset-brand-50 dark:focus-visible:ring-offset-brand-950",
|
|
16
16
|
"data-focus-visible": "data-focus-visible:ring-offset-2 data-focus-visible:ring-offset-brand-50 dark:data-focus-visible:ring-offset-brand-950"
|
|
17
17
|
};
|
|
18
|
+
var FOCUS_INSET = {
|
|
19
|
+
"focus-visible": "focus-visible:ring-inset",
|
|
20
|
+
"data-focus-visible": "data-focus-visible:ring-inset"
|
|
21
|
+
};
|
|
18
22
|
var focusStyles = ({
|
|
19
23
|
source = "focus-visible",
|
|
20
24
|
ring = "brand",
|
|
21
|
-
offset = true
|
|
22
|
-
|
|
25
|
+
offset = true,
|
|
26
|
+
inset = false
|
|
27
|
+
} = {}) => cn(FOCUS_RING[source][ring], offset && FOCUS_OFFSET[source], inset && FOCUS_INSET[source]);
|
|
23
28
|
|
|
24
29
|
export { focusStyles };
|
|
25
|
-
//# sourceMappingURL=chunk-
|
|
26
|
-
//# sourceMappingURL=chunk-
|
|
30
|
+
//# sourceMappingURL=chunk-INJUILCN.js.map
|
|
31
|
+
//# sourceMappingURL=chunk-INJUILCN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/focus-styles.ts"],"names":[],"mappings":";;;AA8CA,IAAM,UAAA,GAA6D;AAAA,EACjE,eAAA,EAAiB;AAAA,IACf,KAAA,EAAO,8EAAA;AAAA,IACP,OAAA,EAAS;AAAA,GACX;AAAA,EACA,oBAAA,EAAsB;AAAA,IACpB,KAAA,EAAO,6DAAA;AAAA,IACP,OAAA,EAAS;AAAA;AAEb,CAAA;AAQA,IAAM,YAAA,GAA4C;AAAA,EAChD,eAAA,EACE,yGAAA;AAAA,EACF,oBAAA,EACE;AACJ,CAAA;AAMA,IAAM,WAAA,GAA2C;AAAA,EAC/C,eAAA,EAAiB,0BAAA;AAAA,EACjB,oBAAA,EAAsB;AACxB,CAAA;AAgFO,IAAM,cAAc,CAAC;AAAA,EAC1B,MAAA,GAAS,eAAA;AAAA,EACT,IAAA,GAAO,OAAA;AAAA,EACP,MAAA,GAAS,IAAA;AAAA,EACT,KAAA,GAAQ;AACV,CAAA,GAAwB,EAAC,KACvB,EAAA,CAAG,UAAA,CAAW,MAAM,CAAA,CAAE,IAAI,CAAA,EAAG,MAAA,IAAU,aAAa,MAAM,CAAA,EAAG,KAAA,IAAS,WAAA,CAAY,MAAM,CAAC","file":"chunk-INJUILCN.js","sourcesContent":["import { cn } from \"./cn\"\n\n/**\n * Where the focused state lives — which selector the ring hangs off.\n *\n * - `focus-visible` — the CSS pseudo-class, on the element itself. The default,\n * and what you want for any ordinary `<button>`, `<a>` or `tabIndex` element.\n * - `data-focus-visible` — Zag's attribute, mirrored onto every part of a\n * machine-driven control (`Checkbox`, `RadioGroup`, `Switch`,\n * `ChoiceCardGroup`) whose real focus target is a visually-hidden `<input>`.\n * The visible part never receives DOM focus, so `:focus-visible` can never\n * match it.\n */\nexport type FocusSource = \"focus-visible\" | \"data-focus-visible\"\n\n/**\n * Which color the ring paints in.\n *\n * - `brand` — a fixed `brand-500`, independent of the element's own `color`.\n * The right answer almost everywhere, and the default.\n * - `palette` — the active palette's `--c-text`. Only for a control that sits\n * *inside* an already-accented surface, where a brand ring would read as a\n * second, unrelated color stacked on the one the surface carries.\n *\n * `--c-text`, not `--c-solid`, and at full opacity — because it is the one\n * slot that flips with the theme (700 light, 300 dark), so it can be dark on\n * a pale surface and pale on a dark one. `--c-solid` is 500 in *both*, which\n * leaves it a mid-tone with nowhere to go against a light background, and no\n * alpha can fix that: opacity only ever composites the ring toward whatever\n * sits behind it. Measured on a Schedule chip, `--c-solid` rings at 2.69:1\n * against the grid and 1.80:1 against the chip's own border; `--c-text` rings\n * at 5.41:1 and 3.62:1, clearing the 3:1 that WCAG 2.2 SC 1.4.11 asks for.\n */\nexport type FocusRing = \"brand\" | \"palette\"\n\n/**\n * The ring itself, per source × color.\n *\n * Every entry is a complete class literal, and nothing here is assembled at\n * runtime. Tailwind v4 scans the *built* JS for whole strings, so a class that\n * only ever exists as `` `${prefix}:ring-2` `` is never generated and the ring\n * silently disappears in consumer builds. `focus-styles.test.ts` enforces it.\n *\n * The `data-focus-visible` rows carry no `outline-none`: the part they land on\n * is not focusable, so there is no native outline to suppress.\n */\nconst FOCUS_RING: Record<FocusSource, Record<FocusRing, string>> = {\n \"focus-visible\": {\n brand: \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-500\",\n palette: \"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--c-text)\",\n },\n \"data-focus-visible\": {\n brand: \"data-focus-visible:ring-2 data-focus-visible:ring-brand-500\",\n palette: \"data-focus-visible:ring-2 data-focus-visible:ring-(--c-text)\",\n },\n}\n\n/**\n * The offset gap, per source. The gap is painted in the *page* background —\n * `brand-50` light, `brand-950` dark — which is what makes it read as a gap\n * rather than as a second colored band. A neutral white / gray gap would show\n * as a thin off-ramp halo against the brand-tinted page.\n */\nconst FOCUS_OFFSET: Record<FocusSource, string> = {\n \"focus-visible\":\n \"focus-visible:ring-offset-2 focus-visible:ring-offset-brand-50 dark:focus-visible:ring-offset-brand-950\",\n \"data-focus-visible\":\n \"data-focus-visible:ring-offset-2 data-focus-visible:ring-offset-brand-50 dark:data-focus-visible:ring-offset-brand-950\",\n}\n\n/**\n * The inset modifier, per source. Kept as whole literals for the same Tailwind\n * scanning reason as `FOCUS_RING`.\n */\nconst FOCUS_INSET: Record<FocusSource, string> = {\n \"focus-visible\": \"focus-visible:ring-inset\",\n \"data-focus-visible\": \"data-focus-visible:ring-inset\",\n}\n\nexport type FocusStylesOptions = {\n /**\n * Where the focused state lives — the CSS pseudo-class (default), or Zag's\n * `data-focus-visible` attribute when you're styling a part of an Ark/Zag\n * machine whose real focus target is a visually-hidden input.\n */\n source?: FocusSource\n /**\n * Ring color: the kit's fixed `brand-500` (default), or the active palette's\n * `--c-text` for a control nested inside an accented surface.\n */\n ring?: FocusRing\n /**\n * Gap between the element and its ring, painted in the page background. Keep\n * it on (the default) so the ring stays legible against the element's own\n * fill. Turn it off for something flush inside a container — or sitting on\n * any surface that *isn't* the page background, where the gap would punch a\n * mismatched hole and you want to supply your own `ring-offset-*` colors.\n */\n offset?: boolean\n /**\n * Draw the ring *inside* the element's edge instead of around it. For rows\n * stacked flush in a scroller (`TreeSelect`'s tree): an outer ring would be\n * clipped by the scroller's edge and painted under by the next row. Pair it\n * with `offset: false` — an inset gap would sit inside the row, in the page\n * color rather than the surface's.\n */\n inset?: boolean\n}\n\n/**\n * The kit's keyboard-focus treatment — one source of truth for every focus\n * ring in the library, and the supported way for consumers to put that same\n * ring on their own elements.\n *\n * Reach for it whenever you render something focusable that isn't already a\n * kit component: a custom trigger, a bare `<button>` wrapping a display\n * component, a link styled as something else.\n *\n * ```tsx\n * import { cn, focusStyles } from \"@42/ui-react\"\n *\n * <button type=\"button\" className={cn(focusStyles(), \"rounded-full\")}>…</button>\n * ```\n *\n * Four axes, and only four. Width and alpha are deliberately *not* options:\n * the point of a single ring is that a keyboard user never has to re-learn what\n * \"focused\" looks like, so every ring the kit draws is 2px and fully opaque.\n *\n * The ring is `brand-500` by default rather than the `--c-solid` slot the rest\n * of the color system runs on. That's deliberate: focus is an accessibility\n * affordance, not decoration, so it stays the same recognisable shape no matter\n * what `color` the thing it sits on happens to use — a green badge and a red\n * button get the same ring. `ring: \"palette\"` is the exception, for a control\n * nested inside a surface that already carries the palette.\n *\n * `inset: true` moves the ring inside the element's edge, for rows stacked flush\n * in a scroller (`TreeSelect`, `TreeMultiSelect`).\n *\n * `offset: true` means *the gap is the page background*. An element on any\n * other surface — a tinted table header, a colored chip — passes\n * `offset: false` and supplies its own `ring-offset-*` pair matched to that\n * surface.\n *\n * What stays hand-written, on purpose:\n * - a ring on a **pseudo-element** rather than the element itself (`Schedule`'s\n * resize grip, `DataTable`'s column-resize handle) — it outlines the small\n * visible mark, not the oversized hit box, and has its own shape and offset;\n * - the **shell** idiom — accent border plus a soft halo on a wrapper whose\n * focus lives on a descendant (`Input`'s chrome, `SegmentGroup`'s tray);\n * - a bare `focus:outline-none` with no ring at all, on overlay surfaces that\n * receive *programmatic* focus (`Modal`, `Drawer`, `Popover`, `Tooltip`).\n *\n * Note these classes are inert until the element they land on is actually\n * focusable — `:focus-visible` never matches a plain `<span>` or `<div>`. So a\n * display component (`Badge`, `Kbd`, `ThemeIcon`) can carry them unconditionally\n * and only light up once `asChild` renders it onto a real `<button>`/`<a>`.\n */\nexport const focusStyles = ({\n source = \"focus-visible\",\n ring = \"brand\",\n offset = true,\n inset = false,\n}: FocusStylesOptions = {}): string =>\n cn(FOCUS_RING[source][ring], offset && FOCUS_OFFSET[source], inset && FOCUS_INSET[source])\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Tooltip } from './chunk-
|
|
2
|
-
import { popoverChrome } from './chunk-
|
|
1
|
+
import { Tooltip } from './chunk-2NNZHVKD.js';
|
|
2
|
+
import { popoverChrome } from './chunk-LM6F6DLR.js';
|
|
3
3
|
import { useUncontrolled } from './chunk-BEL75C7N.js';
|
|
4
4
|
import { Collapse } from './chunk-WSIVRDRB.js';
|
|
5
5
|
import { props } from './chunk-WYCMIIRR.js';
|
|
6
|
-
import { focusStyles } from './chunk-
|
|
6
|
+
import { focusStyles } from './chunk-INJUILCN.js';
|
|
7
7
|
import { cn } from './chunk-QP4I37PA.js';
|
|
8
8
|
import { ark } from '@ark-ui/react';
|
|
9
9
|
import { useClipboard } from '@ark-ui/react/clipboard';
|
|
@@ -217,5 +217,5 @@ function CodeBlockChrome({
|
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
export { CodeBlockButton, CodeBlockChrome };
|
|
220
|
-
//# sourceMappingURL=chunk-
|
|
221
|
-
//# sourceMappingURL=chunk-
|
|
220
|
+
//# sourceMappingURL=chunk-K5UWVH6P.js.map
|
|
221
|
+
//# sourceMappingURL=chunk-K5UWVH6P.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/code-block/chrome.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAsBA,IAAM,oBAAA,GAA8C;AAAA,EAClD,IAAA,EAAM,MAAA;AAAA,EACN,MAAA,EAAQ,QAAA;AAAA,EACR,MAAA,EAAQ,WAAA;AAAA,EACR,QAAA,EAAU;AACZ,CAAA;AAyBO,IAAM,kBAAkB,CAAC;AAAA,EAC9B,SAAA;AAAA,EACA,OAAA;AAAA,EACA,IAAA;AAAA,EACA,MAAA;AAAA,EACA,GAAG;AACL,CAAA,qBACE,GAAA;AAAA,EAAC,GAAA,CAAI,MAAA;AAAA,EAAJ;AAAA,IACC,OAAA;AAAA,IACA,IAAA,EAAM,OAAA,GAAU,IAAA,GAAQ,IAAA,IAAQ,QAAA;AAAA,IAC/B,GAAG,KAAA,CAAM,EAAE,aAAA,EAAe,QAAQ,CAAA;AAAA,IACnC,SAAA,EAAW,EAAA;AAAA,MACT,iEAAA;AAAA,MACA,+EAAA;AAAA,MACA,qBAAA;AAAA,MACA,WAAA,CAAY,EAAE,MAAA,EAAQ,KAAA,EAAO,CAAA;AAAA,MAC7B,kDAAA;AAAA,MACA;AAAA,KACF;AAAA,IACC,GAAG;AAAA;AACN;AAuBF,SAAS,WAAA,CAAY;AAAA,EACnB,IAAA;AAAA,EACA,MAAA;AAAA,EACA,SAAA;AAAA,EACA,WAAA;AAAA,EACA,QAAA;AAA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AAA,cACA,+DAAA;AAAA,cACA,UAAA,EAAY;AAAA,aACd;AAAA,YAEA,QAAA,EAAA;AAAA,8BAAA,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,yBAAA,EAA2B,QAAA,EAAA,KAAA,EAAM,CAAA;AAAA,cAChD;AAAA;AAAA;AAAA,SACH,GAEA,OAAA;AAAA,QAGD,WAAA;AAAA,QAEA,aAAA,oBAAiB,GAAA,CAAC,QAAA,EAAA,EAAS,IAAA,EAAM,UAAW,QAAA,EAAA,WAAA,EAAY,CAAA;AAAA,QAExD,aAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBASC,GAAA;AAAA,UAAC,KAAA;AAAA,UAAA;AAAA,YACC,aAAA,EAAW,IAAA;AAAA,YACX,SAAA,EAAW,EAAA;AAAA,cACT,oEAAA;AAAA,cACA,iCAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAOA,uEAAA;AAAA,cACA,WAAW,WAAA,GAAc;AAAA;AAC3B;AAAA;AACF;AAAA;AAAA,GAEJ;AAEJ","file":"chunk-ZDXQ64A7.js","sourcesContent":["\"use client\"\n\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport { useClipboard } from \"@ark-ui/react/clipboard\"\nimport { CheckIcon, ChevronDownIcon, ChevronUpIcon, CopyIcon } from \"lucide-react\"\nimport type { ReactNode } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { useUncontrolled } from \"../../lib/use-uncontrolled\"\nimport { Collapse } from \"../collapse/collapse\"\nimport { popoverChrome } from \"../popover/popover\"\nimport { Tooltip } from \"../tooltip/tooltip\"\n\nexport type CodeBlockTranslations = {\n copy: string\n copied: string\n expand: string\n collapse: string\n}\n\nconst DEFAULT_TRANSLATIONS: CodeBlockTranslations = {\n copy: \"Copy\",\n copied: \"Copied\",\n expand: \"Show more\",\n collapse: \"Show less\",\n}\n\nexport type CodeBlockClassNames = {\n root?: string\n title?: string\n pre?: string\n controls?: string\n copyButton?: string\n expandButton?: string\n}\n\nexport type CodeBlockButtonProps = HTMLArkProps<\"button\"> & WithTestId\n\n/**\n * `CodeBlock.Button` — the toolbar's own compact icon-button primitive.\n * `Copy`/expand use it internally, and it's exported so a consumer's own\n * `controls` button matches the exact same size/style instead of hand-\n * rolling one — same composition API as the rest of the kit (`asChild`, via\n * `HTMLArkProps`, so it wraps in a `Tooltip` exactly like the built-in\n * buttons do).\n *\n * A plain hand-rolled button, not an `ActionIcon` wrapper: this toolbar\n * needed something smaller than `ActionIcon`'s own `xs` floor, which is\n * sized for general-purpose use, not a compact floating strip over code.\n */\nexport const CodeBlockButton = ({\n className,\n asChild,\n type,\n testId,\n ...rest\n}: CodeBlockButtonProps) => (\n <ark.button\n asChild={asChild}\n type={asChild ? type : (type ?? \"button\")}\n {...props({ \"data-testid\": testId })}\n className={cn(\n \"inline-flex size-6 shrink-0 items-center justify-center rounded\",\n \"text-(--c-text) [&_svg]:size-3.5 [&_svg]:shrink-0 [&_svg]:pointer-events-none\",\n \"hover:bg-(--c-soft)\",\n focusStyles({ offset: false }),\n \"disabled:pointer-events-none disabled:opacity-50\",\n className,\n )}\n {...rest}\n />\n)\n\ntype CopyTriggerProps = {\n code: string\n onCopy?: () => void\n copyLabel: string\n copiedLabel: string\n copyIcon: ReactNode | null | undefined\n copiedIcon: ReactNode | null | undefined\n className?: string\n testId?: string\n}\n\n/**\n * Uses Ark's `useClipboard` hook directly rather than the `Clipboard.Root`/\n * `Clipboard.Indicator` components — both render their own wrapping `<div>`\n * (`data-part=\"root\"`/`\"indicator\"`), which, sitting as a direct child of the\n * toolbar's flex row, threw off its sizing/alignment next to the plain\n * `ActionIcon` the `ExpandTrigger` renders. The hook gives the same\n * `copied`/`copy` state machine with no imposed DOM structure at all — this\n * renders as a single real `<button>`, exactly like `ExpandTrigger`.\n */\nfunction CopyTrigger({\n code,\n onCopy,\n copyLabel,\n copiedLabel,\n copyIcon,\n copiedIcon,\n className,\n testId,\n}: CopyTriggerProps) {\n const { copied, copy } = useClipboard({\n value: code,\n timeout: 2000,\n onStatusChange: (details) => details.copied && onCopy?.(),\n })\n const label = copied ? copiedLabel : copyLabel\n return (\n <Tooltip label={label} asChild>\n <CodeBlockButton aria-label={label} onClick={copy} className={className} testId={testId}>\n {copied ? (\n copiedIcon === undefined ? (\n <CheckIcon />\n ) : (\n copiedIcon\n )\n ) : copyIcon === undefined ? (\n <CopyIcon />\n ) : (\n copyIcon\n )}\n </CodeBlockButton>\n </Tooltip>\n )\n}\n\ntype ExpandTriggerProps = {\n expanded: boolean\n onToggle: () => void\n expandLabel: string\n collapseLabel: string\n expandIcon: ReactNode | null | undefined\n collapseIcon: ReactNode | null | undefined\n className?: string\n testId?: string\n}\n\n/** Toolbar icon button toggling the collapsed \"tail\" seam — an\n * `aria-expanded` `ActionIcon` with a matching `Tooltip`/accessible name,\n * same shape as `CopyTrigger`. Only rendered when `isCollapsible`. */\nfunction ExpandTrigger({\n expanded,\n onToggle,\n expandLabel,\n collapseLabel,\n expandIcon,\n collapseIcon,\n className,\n testId,\n}: ExpandTriggerProps) {\n const label = expanded ? collapseLabel : expandLabel\n return (\n <Tooltip label={label} asChild>\n <CodeBlockButton\n aria-label={label}\n aria-expanded={expanded}\n onClick={onToggle}\n className={className}\n testId={testId}\n >\n {expanded ? (\n collapseIcon === undefined ? (\n <ChevronUpIcon />\n ) : (\n collapseIcon\n )\n ) : expandIcon === undefined ? (\n <ChevronDownIcon />\n ) : (\n expandIcon\n )}\n </CodeBlockButton>\n </Tooltip>\n )\n}\n\nexport type CodeBlockChromeProps = WithTestId & {\n /** Raw source, used only for the copy button's clipboard value — this\n * component never highlights anything itself. */\n code: string\n /** Whether the tail half exists at all (mirrors the caller's own\n * `collapsedLines`/line-count decision) — controls whether the expand\n * toggle and the `Collapse`-wrapped tail slot render at all. */\n isCollapsible: boolean\n /** The head half's already-rendered content (highlighted HTML, or a\n * loading fallback — this component has no opinion on which). */\n headContent: ReactNode\n /** The tail half's already-rendered content — only read when\n * `isCollapsible`. */\n tailContent?: ReactNode\n\n /** Header row above the code; hosts the toolbar when set. */\n title?: ReactNode\n\n /** @default true */\n withCopyButton?: boolean\n /** `null` hides it. @default <CopyIcon/> */\n copyIcon?: ReactNode | null\n /** `null` hides it. @default <CheckIcon/> */\n copiedIcon?: ReactNode | null\n onCopy?: () => void\n\n /** @default false */\n defaultExpanded?: boolean\n expanded?: boolean\n onExpandedChange?: (expanded: boolean) => void\n /** `null` hides it. @default <ChevronDownIcon/> */\n expandIcon?: ReactNode | null\n /** `null` hides it. @default <ChevronUpIcon/> */\n collapseIcon?: ReactNode | null\n\n controls?: ReactNode\n translations?: Partial<CodeBlockTranslations>\n className?: string\n classNames?: CodeBlockClassNames\n}\n\n/**\n * The interactive shell shared by `CodeBlock` (client, highlights via\n * `highlightCode` in an effect) and `CodeBlock.Static` (an async Server\n * Component that `await`s `highlightCode` directly during render, for a\n * fully static/SSR'd result with zero client JS spent on Shiki) — this\n * component owns the toolbar/copy/collapse-expand interactivity and\n * nothing about HOW `headContent`/`tailContent` were produced. Kept in its\n * own file specifically so `CodeBlock.Static` (no `\"use client\"`, safe to\n * import from a Server Component) can render it without pulling in\n * `code-block.tsx`'s own client-only highlighting logic.\n */\nexport function CodeBlockChrome({\n code,\n isCollapsible,\n headContent,\n tailContent,\n title,\n withCopyButton = true,\n copyIcon,\n copiedIcon,\n onCopy,\n defaultExpanded = false,\n expanded: expandedProp,\n onExpandedChange,\n expandIcon,\n collapseIcon,\n controls,\n translations,\n testId,\n className,\n classNames,\n}: CodeBlockChromeProps) {\n const t = { ...DEFAULT_TRANSLATIONS, ...translations }\n\n const [expanded, setExpanded] = useUncontrolled({\n value: expandedProp,\n defaultValue: defaultExpanded,\n finalValue: false,\n onChange: onExpandedChange,\n })\n\n // A fixed `top-2` reads fine pinned to the corner of a tall, multi-line\n // block, but on a single line there's no \"corner\" to anchor to — it just\n // looks like an arbitrarily offset button. True vertical centering (equal\n // gap above/below) is the correct treatment there instead.\n const isSingleLine = !code.includes(\"\\n\")\n\n const toolbar = (controls != null || withCopyButton || isCollapsible) && (\n <div\n className={cn(\n \"flex items-center gap-1 p-0.5\",\n // In a title header the toolbar sits in-flow at the row's end;\n // otherwise it floats over the code's top-right corner.\n title == null && \"absolute right-2 z-10\",\n title == null && (isSingleLine ? \"top-1/2 -translate-y-1/2\" : \"top-2\"),\n // Same floating-surface chrome every other overlay panel in the\n // kit uses (Popover/Menu/Select's positioner) — border-brand-900/20\n // dark:border-white/15 + bg-brand-50/90 dark:bg-brand-950/85 +\n // backdrop-blur-sm + shadow-lg — rather than an ad-hoc neutral\n // white/gray-dark tint that doesn't match the kit's own convention\n // for \"a small panel floating over content.\" Only while floating —\n // inside the title header it's part of the bar, not over content.\n title == null && popoverChrome,\n classNames?.controls,\n )}\n >\n {controls}\n {isCollapsible && (\n <ExpandTrigger\n expanded={expanded}\n onToggle={() => setExpanded((prev) => !prev)}\n expandLabel={t.expand}\n collapseLabel={t.collapse}\n expandIcon={expandIcon}\n collapseIcon={collapseIcon}\n className={classNames?.expandButton}\n testId={testId && `${testId}-expand`}\n />\n )}\n {withCopyButton && (\n <CopyTrigger\n code={code}\n onCopy={onCopy}\n copyLabel={t.copy}\n copiedLabel={t.copied}\n copyIcon={copyIcon}\n copiedIcon={copiedIcon}\n className={classNames?.copyButton}\n testId={testId && `${testId}-copy`}\n />\n )}\n </div>\n )\n\n return (\n <div\n className={cn(\n \"relative rounded-card border border-brand-900/30 dark:border-white/10 bg-white/4\",\n className,\n classNames?.root,\n )}\n {...props({ \"data-testid\": testId })}\n >\n {title != null ? (\n <div\n className={cn(\n \"flex min-h-9 items-center gap-2 border-b border-brand-900/30 dark:border-white/10 ps-4 pe-2\",\n \"text-xs font-mono text-gray-light-500 dark:text-gray-dark-400\",\n classNames?.title,\n )}\n >\n <span className=\"min-w-0 flex-1 truncate\">{title}</span>\n {toolbar}\n </div>\n ) : (\n toolbar\n )}\n\n {headContent}\n\n {isCollapsible && <Collapse open={expanded}>{tailContent}</Collapse>}\n\n {isCollapsible && (\n // Pinned to the *outer* card's own bottom edge (that div is the\n // nearest positioned ancestor), not to the code/Collapse content —\n // so it tracks the container's live height as Collapse animates\n // open/closed instead of sitting at a fixed spot relative to the\n // head/tail boundary, which \"teleported\" relative to the visibly\n // growing/shrinking content. Always mounted; only opacity toggles,\n // in sync with Collapse's own 300ms timing, so it fades together\n // with the reveal instead of popping in/out at the instant of click.\n <div\n aria-hidden\n className={cn(\n \"pointer-events-none absolute inset-x-0 bottom-0 h-8 rounded-b-card\",\n \"transition-opacity duration-300\",\n // Same brand-tinted family as this card's own border\n // (border-brand-900/30 dark:border-white/10) and the toolbar's\n // popoverChrome (bg-brand-50/90 dark:bg-brand-950/85) — a plain\n // neutral white/gray-950 fade doesn't match either, and visibly\n // seams against a brand-tinted page background (dark mode's\n // --color-fd-background is brand-950, not a neutral gray).\n \"bg-linear-to-t from-brand-50/95 to-transparent dark:from-brand-950/95\",\n expanded ? \"opacity-0\" : \"opacity-100\",\n )}\n />\n )}\n </div>\n )\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/code-block/chrome.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAsBA,IAAM,oBAAA,GAA8C;AAAA,EAClD,IAAA,EAAM,MAAA;AAAA,EACN,MAAA,EAAQ,QAAA;AAAA,EACR,MAAA,EAAQ,WAAA;AAAA,EACR,QAAA,EAAU;AACZ,CAAA;AAyBO,IAAM,kBAAkB,CAAC;AAAA,EAC9B,SAAA;AAAA,EACA,OAAA;AAAA,EACA,IAAA;AAAA,EACA,MAAA;AAAA,EACA,GAAG;AACL,CAAA,qBACE,GAAA;AAAA,EAAC,GAAA,CAAI,MAAA;AAAA,EAAJ;AAAA,IACC,OAAA;AAAA,IACA,IAAA,EAAM,OAAA,GAAU,IAAA,GAAQ,IAAA,IAAQ,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A;AAAA;AAAA;AAC7B;AAAA;AAAA,GAEJ;AAGF,EAAA,uBACE,IAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAW,EAAA;AAAA,QACT,kFAAA;AAAA,QACA,SAAA;AAAA,QACA,UAAA,EAAY;AAAA,OACd;AAAA,MACC,GAAG,KAAA,CAAM,EAAE,aAAA,EAAe,QAAQ,CAAA;AAAA,MAElC,QAAA,EAAA;AAAA,QAAA,KAAA,IAAS,IAAA,mBACR,IAAA;AAAA,UAAC,KAAA;AAAA,UAAA;AAAA,YACC,SAAA,EAAW,EAAA;AAAA,cACT,6FAAA;AAAA,cACA,+DAAA;AAAA,cACA,UAAA,EAAY;AAAA,aACd;AAAA,YAEA,QAAA,EAAA;AAAA,8BAAA,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,yBAAA,EAA2B,QAAA,EAAA,KAAA,EAAM,CAAA;AAAA,cAChD;AAAA;AAAA;AAAA,SACH,GAEA,OAAA;AAAA,QAGD,WAAA;AAAA,QAEA,aAAA,oBAAiB,GAAA,CAAC,QAAA,EAAA,EAAS,IAAA,EAAM,UAAW,QAAA,EAAA,WAAA,EAAY,CAAA;AAAA,QAExD,aAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBASC,GAAA;AAAA,UAAC,KAAA;AAAA,UAAA;AAAA,YACC,aAAA,EAAW,IAAA;AAAA,YACX,SAAA,EAAW,EAAA;AAAA,cACT,oEAAA;AAAA,cACA,iCAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAOA,uEAAA;AAAA,cACA,WAAW,WAAA,GAAc;AAAA;AAC3B;AAAA;AACF;AAAA;AAAA,GAEJ;AAEJ","file":"chunk-K5UWVH6P.js","sourcesContent":["\"use client\"\n\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport { useClipboard } from \"@ark-ui/react/clipboard\"\nimport { CheckIcon, ChevronDownIcon, ChevronUpIcon, CopyIcon } from \"lucide-react\"\nimport type { ReactNode } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { useUncontrolled } from \"../../lib/use-uncontrolled\"\nimport { Collapse } from \"../collapse/collapse\"\nimport { popoverChrome } from \"../popover/popover\"\nimport { Tooltip } from \"../tooltip/tooltip\"\n\nexport type CodeBlockTranslations = {\n copy: string\n copied: string\n expand: string\n collapse: string\n}\n\nconst DEFAULT_TRANSLATIONS: CodeBlockTranslations = {\n copy: \"Copy\",\n copied: \"Copied\",\n expand: \"Show more\",\n collapse: \"Show less\",\n}\n\nexport type CodeBlockClassNames = {\n root?: string\n title?: string\n pre?: string\n controls?: string\n copyButton?: string\n expandButton?: string\n}\n\nexport type CodeBlockButtonProps = HTMLArkProps<\"button\"> & WithTestId\n\n/**\n * `CodeBlock.Button` — the toolbar's own compact icon-button primitive.\n * `Copy`/expand use it internally, and it's exported so a consumer's own\n * `controls` button matches the exact same size/style instead of hand-\n * rolling one — same composition API as the rest of the kit (`asChild`, via\n * `HTMLArkProps`, so it wraps in a `Tooltip` exactly like the built-in\n * buttons do).\n *\n * A plain hand-rolled button, not an `ActionIcon` wrapper: this toolbar\n * needed something smaller than `ActionIcon`'s own `xs` floor, which is\n * sized for general-purpose use, not a compact floating strip over code.\n */\nexport const CodeBlockButton = ({\n className,\n asChild,\n type,\n testId,\n ...rest\n}: CodeBlockButtonProps) => (\n <ark.button\n asChild={asChild}\n type={asChild ? type : (type ?? \"button\")}\n {...props({ \"data-testid\": testId })}\n className={cn(\n \"inline-flex size-6 shrink-0 items-center justify-center rounded\",\n \"text-(--c-text) [&_svg]:size-3.5 [&_svg]:shrink-0 [&_svg]:pointer-events-none\",\n \"hover:bg-(--c-soft)\",\n focusStyles({ offset: false }),\n \"disabled:pointer-events-none disabled:opacity-50\",\n className,\n )}\n {...rest}\n />\n)\n\ntype CopyTriggerProps = {\n code: string\n onCopy?: () => void\n copyLabel: string\n copiedLabel: string\n copyIcon: ReactNode | null | undefined\n copiedIcon: ReactNode | null | undefined\n className?: string\n testId?: string\n}\n\n/**\n * Uses Ark's `useClipboard` hook directly rather than the `Clipboard.Root`/\n * `Clipboard.Indicator` components — both render their own wrapping `<div>`\n * (`data-part=\"root\"`/`\"indicator\"`), which, sitting as a direct child of the\n * toolbar's flex row, threw off its sizing/alignment next to the plain\n * `ActionIcon` the `ExpandTrigger` renders. The hook gives the same\n * `copied`/`copy` state machine with no imposed DOM structure at all — this\n * renders as a single real `<button>`, exactly like `ExpandTrigger`.\n */\nfunction CopyTrigger({\n code,\n onCopy,\n copyLabel,\n copiedLabel,\n copyIcon,\n copiedIcon,\n className,\n testId,\n}: CopyTriggerProps) {\n const { copied, copy } = useClipboard({\n value: code,\n timeout: 2000,\n onStatusChange: (details) => details.copied && onCopy?.(),\n })\n const label = copied ? copiedLabel : copyLabel\n return (\n <Tooltip label={label} asChild>\n <CodeBlockButton aria-label={label} onClick={copy} className={className} testId={testId}>\n {copied ? (\n copiedIcon === undefined ? (\n <CheckIcon />\n ) : (\n copiedIcon\n )\n ) : copyIcon === undefined ? (\n <CopyIcon />\n ) : (\n copyIcon\n )}\n </CodeBlockButton>\n </Tooltip>\n )\n}\n\ntype ExpandTriggerProps = {\n expanded: boolean\n onToggle: () => void\n expandLabel: string\n collapseLabel: string\n expandIcon: ReactNode | null | undefined\n collapseIcon: ReactNode | null | undefined\n className?: string\n testId?: string\n}\n\n/** Toolbar icon button toggling the collapsed \"tail\" seam — an\n * `aria-expanded` `ActionIcon` with a matching `Tooltip`/accessible name,\n * same shape as `CopyTrigger`. Only rendered when `isCollapsible`. */\nfunction ExpandTrigger({\n expanded,\n onToggle,\n expandLabel,\n collapseLabel,\n expandIcon,\n collapseIcon,\n className,\n testId,\n}: ExpandTriggerProps) {\n const label = expanded ? collapseLabel : expandLabel\n return (\n <Tooltip label={label} asChild>\n <CodeBlockButton\n aria-label={label}\n aria-expanded={expanded}\n onClick={onToggle}\n className={className}\n testId={testId}\n >\n {expanded ? (\n collapseIcon === undefined ? (\n <ChevronUpIcon />\n ) : (\n collapseIcon\n )\n ) : expandIcon === undefined ? (\n <ChevronDownIcon />\n ) : (\n expandIcon\n )}\n </CodeBlockButton>\n </Tooltip>\n )\n}\n\nexport type CodeBlockChromeProps = WithTestId & {\n /** Raw source, used only for the copy button's clipboard value — this\n * component never highlights anything itself. */\n code: string\n /** Whether the tail half exists at all (mirrors the caller's own\n * `collapsedLines`/line-count decision) — controls whether the expand\n * toggle and the `Collapse`-wrapped tail slot render at all. */\n isCollapsible: boolean\n /** The head half's already-rendered content (highlighted HTML, or a\n * loading fallback — this component has no opinion on which). */\n headContent: ReactNode\n /** The tail half's already-rendered content — only read when\n * `isCollapsible`. */\n tailContent?: ReactNode\n\n /** Header row above the code; hosts the toolbar when set. */\n title?: ReactNode\n\n /** @default true */\n withCopyButton?: boolean\n /** `null` hides it. @default <CopyIcon/> */\n copyIcon?: ReactNode | null\n /** `null` hides it. @default <CheckIcon/> */\n copiedIcon?: ReactNode | null\n onCopy?: () => void\n\n /** @default false */\n defaultExpanded?: boolean\n expanded?: boolean\n onExpandedChange?: (expanded: boolean) => void\n /** `null` hides it. @default <ChevronDownIcon/> */\n expandIcon?: ReactNode | null\n /** `null` hides it. @default <ChevronUpIcon/> */\n collapseIcon?: ReactNode | null\n\n controls?: ReactNode\n translations?: Partial<CodeBlockTranslations>\n className?: string\n classNames?: CodeBlockClassNames\n}\n\n/**\n * The interactive shell shared by `CodeBlock` (client, highlights via\n * `highlightCode` in an effect) and `CodeBlock.Static` (an async Server\n * Component that `await`s `highlightCode` directly during render, for a\n * fully static/SSR'd result with zero client JS spent on Shiki) — this\n * component owns the toolbar/copy/collapse-expand interactivity and\n * nothing about HOW `headContent`/`tailContent` were produced. Kept in its\n * own file specifically so `CodeBlock.Static` (no `\"use client\"`, safe to\n * import from a Server Component) can render it without pulling in\n * `code-block.tsx`'s own client-only highlighting logic.\n */\nexport function CodeBlockChrome({\n code,\n isCollapsible,\n headContent,\n tailContent,\n title,\n withCopyButton = true,\n copyIcon,\n copiedIcon,\n onCopy,\n defaultExpanded = false,\n expanded: expandedProp,\n onExpandedChange,\n expandIcon,\n collapseIcon,\n controls,\n translations,\n testId,\n className,\n classNames,\n}: CodeBlockChromeProps) {\n const t = { ...DEFAULT_TRANSLATIONS, ...translations }\n\n const [expanded, setExpanded] = useUncontrolled({\n value: expandedProp,\n defaultValue: defaultExpanded,\n finalValue: false,\n onChange: onExpandedChange,\n })\n\n // A fixed `top-2` reads fine pinned to the corner of a tall, multi-line\n // block, but on a single line there's no \"corner\" to anchor to — it just\n // looks like an arbitrarily offset button. True vertical centering (equal\n // gap above/below) is the correct treatment there instead.\n const isSingleLine = !code.includes(\"\\n\")\n\n const toolbar = (controls != null || withCopyButton || isCollapsible) && (\n <div\n className={cn(\n \"flex items-center gap-1 p-0.5\",\n // In a title header the toolbar sits in-flow at the row's end;\n // otherwise it floats over the code's top-right corner.\n title == null && \"absolute right-2 z-10\",\n title == null && (isSingleLine ? \"top-1/2 -translate-y-1/2\" : \"top-2\"),\n // Same floating-surface chrome every other overlay panel in the\n // kit uses (Popover/Menu/Select's positioner) — border-brand-900/20\n // dark:border-white/15 + bg-brand-50/90 dark:bg-brand-950/85 +\n // backdrop-blur-sm + shadow-lg — rather than an ad-hoc neutral\n // white/gray-dark tint that doesn't match the kit's own convention\n // for \"a small panel floating over content.\" Only while floating —\n // inside the title header it's part of the bar, not over content.\n title == null && popoverChrome,\n classNames?.controls,\n )}\n >\n {controls}\n {isCollapsible && (\n <ExpandTrigger\n expanded={expanded}\n onToggle={() => setExpanded((prev) => !prev)}\n expandLabel={t.expand}\n collapseLabel={t.collapse}\n expandIcon={expandIcon}\n collapseIcon={collapseIcon}\n className={classNames?.expandButton}\n testId={testId && `${testId}-expand`}\n />\n )}\n {withCopyButton && (\n <CopyTrigger\n code={code}\n onCopy={onCopy}\n copyLabel={t.copy}\n copiedLabel={t.copied}\n copyIcon={copyIcon}\n copiedIcon={copiedIcon}\n className={classNames?.copyButton}\n testId={testId && `${testId}-copy`}\n />\n )}\n </div>\n )\n\n return (\n <div\n className={cn(\n \"relative rounded-card border border-brand-900/30 dark:border-white/10 bg-white/4\",\n className,\n classNames?.root,\n )}\n {...props({ \"data-testid\": testId })}\n >\n {title != null ? (\n <div\n className={cn(\n \"flex min-h-9 items-center gap-2 border-b border-brand-900/30 dark:border-white/10 ps-4 pe-2\",\n \"text-xs font-mono text-gray-light-500 dark:text-gray-dark-400\",\n classNames?.title,\n )}\n >\n <span className=\"min-w-0 flex-1 truncate\">{title}</span>\n {toolbar}\n </div>\n ) : (\n toolbar\n )}\n\n {headContent}\n\n {isCollapsible && <Collapse open={expanded}>{tailContent}</Collapse>}\n\n {isCollapsible && (\n // Pinned to the *outer* card's own bottom edge (that div is the\n // nearest positioned ancestor), not to the code/Collapse content —\n // so it tracks the container's live height as Collapse animates\n // open/closed instead of sitting at a fixed spot relative to the\n // head/tail boundary, which \"teleported\" relative to the visibly\n // growing/shrinking content. Always mounted; only opacity toggles,\n // in sync with Collapse's own 300ms timing, so it fades together\n // with the reveal instead of popping in/out at the instant of click.\n <div\n aria-hidden\n className={cn(\n \"pointer-events-none absolute inset-x-0 bottom-0 h-8 rounded-b-card\",\n \"transition-opacity duration-300\",\n // Same brand-tinted family as this card's own border\n // (border-brand-900/30 dark:border-white/10) and the toolbar's\n // popoverChrome (bg-brand-50/90 dark:bg-brand-950/85) — a plain\n // neutral white/gray-950 fade doesn't match either, and visibly\n // seams against a brand-tinted page background (dark mode's\n // --color-fd-background is brand-950, not a neutral gray).\n \"bg-linear-to-t from-brand-50/95 to-transparent dark:from-brand-950/95\",\n expanded ? \"opacity-0\" : \"opacity-100\",\n )}\n />\n )}\n </div>\n )\n}\n"]}
|
|
@@ -65,27 +65,6 @@ var popoverOption = cva(
|
|
|
65
65
|
}
|
|
66
66
|
);
|
|
67
67
|
var popoverIndicator = "ms-auto inline-flex shrink-0 items-center text-(--c-solid) [&_svg]:size-4";
|
|
68
|
-
var popoverCheckbox = cva(
|
|
69
|
-
[
|
|
70
|
-
"inline-flex shrink-0 items-center justify-center rounded-xs border transition-colors",
|
|
71
|
-
"border-gray-light-300 dark:border-gray-dark-700",
|
|
72
|
-
"bg-gray-light-25 dark:bg-gray-dark-900",
|
|
73
|
-
"text-(--c-on-solid)",
|
|
74
|
-
"group-data-[state=checked]/item:border-(--c-solid) group-data-[state=checked]/item:bg-(--c-solid)"
|
|
75
|
-
],
|
|
76
|
-
{
|
|
77
|
-
variants: {
|
|
78
|
-
size: {
|
|
79
|
-
xs: "size-3.5 [&_svg]:size-2.5",
|
|
80
|
-
sm: "size-4 [&_svg]:size-3",
|
|
81
|
-
md: "size-4 [&_svg]:size-3",
|
|
82
|
-
lg: "size-4.5 [&_svg]:size-3.5",
|
|
83
|
-
xl: "size-5 [&_svg]:size-4"
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
defaultVariants: { size: "md" }
|
|
87
|
-
}
|
|
88
|
-
);
|
|
89
68
|
var popoverGroupLabel = "px-2 py-1.5 text-xs font-medium select-none text-gray-light-500 dark:text-gray-dark-400";
|
|
90
69
|
var popoverEmpty = "px-2 py-6 text-center text-sm select-none text-gray-light-500 dark:text-gray-dark-400";
|
|
91
70
|
var tabbableSelector = [
|
|
@@ -344,6 +323,6 @@ var Popover = {
|
|
|
344
323
|
Footer
|
|
345
324
|
};
|
|
346
325
|
|
|
347
|
-
export { Popover,
|
|
348
|
-
//# sourceMappingURL=chunk-
|
|
349
|
-
//# sourceMappingURL=chunk-
|
|
326
|
+
export { Popover, popoverChevron, popoverChrome, popoverClearTrigger, popoverContent, popoverEmpty, popoverGroupLabel, popoverIndicator, popoverList, popoverOption, popoverPanel, scrollHighlightedIntoView };
|
|
327
|
+
//# sourceMappingURL=chunk-LM6F6DLR.js.map
|
|
328
|
+
//# sourceMappingURL=chunk-LM6F6DLR.js.map
|
|
@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AA,CAAW,MAAA;AAAA,EACnB,OAAA;AAAA,EACA,MAAA;AAAA,EACA,IAAA;AAAA,EACA;AACF","file":"chunk-LM6F6DLR.js","sourcesContent":["\"use client\"\n\nimport { Popover as ArkPopover, usePopoverContext } from \"@ark-ui/react/popover\"\nimport { Portal } from \"@ark-ui/react/portal\"\nimport { cva } from \"class-variance-authority\"\nimport {\n type ComponentPropsWithoutRef,\n createContext,\n type MouseEvent,\n type PointerEvent,\n useContext,\n useEffect,\n useRef,\n useState,\n} from \"react\"\nimport type { NoAsChild } from \"../../lib/as-child\"\nimport type { UnavailableProps } from \"../../lib/available-if\"\nimport { cn } from \"../../lib/cn\"\nimport { useOverlayContainer } from \"../../lib/overlay-container\"\nimport {\n OverlayLayerProvider,\n type OverlayLayers,\n useLayerGuard,\n useNestedLayer,\n} from \"../../lib/overlay-layer\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { useUncontrolled } from \"../../lib/use-uncontrolled\"\n\n/*\n * Shared popover presentation. Co-located with the Popover component and reused\n * across the form family (Combobox / Select / TreeSelect / TagsInput); Ark's\n * Select / Combobox expose different part components, so these class generators\n * are applied to each machine's own parts — keeping every popover surface\n * visually identical and cheap to retheme.\n */\n\n/** Shared floating-panel chrome — border, surface, shadow, layering token, and\n * the open/close animation (origin follows `data-placement`). Every popover\n * surface builds on this so they stay visually identical. Exported so overlays\n * that aren't scroll-clipping listboxes (e.g. Menu) can build their own surface\n * on the exact same border/shadow/animation without drift.\n *\n * Brand-tinted surface, matching `InputBase`'s shell (`border-brand-900/20\n * dark:border-white/15`): the fill sits at the two extreme ends of the brand\n * scale (`brand-50` / `brand-950`, near-white/near-black) so floating panels\n * read as part of the same brand-derived surface family as inputs rather than\n * a neutral gray. The backdrop blur stays; only the fill/border are tinted. */\nexport const popoverChrome = cn(\n \"rounded-input border border-brand-900/20 dark:border-white/15\",\n \"bg-brand-50/90 dark:bg-brand-950/85\",\n \"backdrop-blur-sm\",\n \"shadow-lg focus:outline-none\",\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)\n\n/** Outer chrome for the machine-driven listboxes (Combobox / Select / Autocomplete\n * / MultiSelect): border, surface, shadow, and the open/close animation. It's a\n * rounded **clipping** wrapper (`overflow-hidden`), NOT the scroller — the inner\n * `popoverList` scrolls, and this clip rounds that scrollbar's corners on the\n * scrollbar side. Border + clip on one element (like `popoverPanel`) keep the\n * border whole, and `data-state` rides here so the whole box animates in/out and\n * unmounts cleanly — no eaten corner, no floating frame on close. */\nexport const popoverContent = cn(popoverChrome, \"flex w-full flex-col overflow-hidden\")\n\n/** Inner scroll region for the machine-driven listboxes — the actual scroller,\n * nested in `popoverContent`, capped at 16rem via `--available-height`. Has no\n * border/radius of its own; the parent clip rounds its scrollbar corners. Since\n * Content is `overflow-hidden`, the machines can't auto-scroll it natively, so\n * scrolling is routed here via `scrollHighlightedIntoView` (the root's\n * `scrollToIndexFn`). */\nexport const popoverList = cva(\n [\n \"flex w-full flex-col ps-1 pe-1 pb-1\",\n \"overflow-y-auto overscroll-contain\",\n \"max-h-[min(16rem,var(--available-height,16rem))]\",\n ],\n {\n variants: {\n withPaddingTop: {\n true: \"pt-1\",\n },\n },\n },\n)\n\n/** Scroll the highlighted option into view from inside the `popoverList` scroller.\n * Wired as the combobox/select root's `scrollToIndexFn` so the machine routes\n * scrolling through here instead of its native path — which early-returns unless\n * the (now `overflow-hidden`) Content is itself scrollable. Native `scrollIntoView`\n * walks to the nearest scrollable ancestor, i.e. the List. */\nexport const scrollHighlightedIntoView = ({\n getElement,\n}: {\n getElement: () => HTMLElement | null\n}) => getElement()?.scrollIntoView({ block: \"nearest\" })\n\n/** Panel chrome for the `Popover` component — NOT a scroll container: it clips\n * its children so fixed Header/Footer and the scrolling Body sit flush inside\n * the rounded border. Pair with `popoverViewport`. Its own `overflow-hidden`\n * never clips its own shadow, and the inner Body's scrollbar is rounded by this\n * panel's clip — so it doesn't need `scrollbar-soft`. */\nexport const popoverPanel = cn(popoverChrome, \"flex flex-col overflow-hidden\")\n\n/** The scroll region inside a `Popover` panel (its `Body`). Height tracks the\n * positioner's `--available-height`, capped at 24rem. */\nexport const popoverViewport = cn(\n \"flex flex-col overflow-y-auto overscroll-contain p-1\",\n \"max-h-[min(24rem,var(--available-height,24rem))]\",\n)\n\n/** Trigger chevron — base look; add rotation per machine\n * (`data-[state=open]:rotate-180`, or `open && \"rotate-180\"`). */\nexport const popoverChevron =\n \"shrink-0 text-gray-light-500 transition-transform dark:text-gray-dark-400\"\n\n/** Clear (×) button — shared by Combobox / Select / TagsInput / NumberInput clear triggers. */\nexport const popoverClearTrigger =\n \"inline-flex shrink-0 cursor-pointer items-center justify-center rounded-full text-gray-light-500 transition-colors hover:text-gray-light-700 dark:text-gray-dark-400 dark:hover:text-gray-dark-200\"\n\n/** A single option row. Highlight is `data-highlighted`, selection is\n * `data-state=checked`, both owned by the Ark machine. Highlight is neutral\n * and transparent — a low-opacity black/white wash, not an opaque gray —\n * matching the surface's own background-dependent tint (no Figma reference\n * for this specific state yet, so this is a considered default, not an\n * extracted value). */\nexport const popoverOption = cva(\n [\n \"relative flex cursor-pointer items-center gap-2 rounded-sm\",\n \"select-none outline-none\",\n \"text-gray-light-900 dark:text-gray-dark-100\",\n \"data-highlighted:bg-black/5 dark:data-highlighted:bg-white/8\",\n \"data-[state=checked]:font-medium\",\n \"data-disabled:pointer-events-none data-disabled:opacity-50\",\n ],\n {\n variants: {\n size: {\n xs: \"px-2 py-1 text-xs\",\n sm: \"px-2 py-1 text-sm\",\n md: \"px-2.5 py-1.5 text-md\",\n lg: \"px-3 py-2 text-lg\",\n xl: \"px-3.5 py-2.5 text-xl\",\n },\n },\n defaultVariants: { size: \"md\" },\n },\n)\n\n/** The check / selected indicator slot at the inline-end of an option. */\nexport const popoverIndicator =\n \"ms-auto inline-flex shrink-0 items-center text-(--c-solid) [&_svg]:size-4\"\n\n/** Group heading above a set of options. */\nexport const popoverGroupLabel =\n \"px-2 py-1.5 text-xs font-medium select-none text-gray-light-500 dark:text-gray-dark-400\"\n\n/** Empty / nothing-found message. */\nexport const popoverEmpty =\n \"px-2 py-6 text-center text-sm select-none text-gray-light-500 dark:text-gray-dark-400\"\n\n/**\n * Popover — the kit's floating panel, a styled layer over Ark UI's Popover.\n *\n * <Popover.Root open={open} onOpenChange={...}>\n * <Popover.Trigger asChild><button>…</button></Popover.Trigger>\n * <Popover.Content>\n * <Popover.Header>…</Popover.Header> // optional fixed slot\n * <Popover.Body>…</Popover.Body> // the scroll region\n * <Popover.Footer>…</Popover.Footer> // optional fixed slot\n * </Popover.Content>\n * </Popover.Root>\n *\n * It's a *panel*, not a menu: hosts (TreeSelect, custom pickers) render their own\n * rows inside `Body`. Portaled by default (escapes `overflow:hidden` ancestors),\n * width-matched to the trigger, and animated via the kit's `popover-in/out`.\n *\n * `mode=\"hover\"` adds a delayed hover preview on top of the click: hovering the\n * trigger opens the panel after `openDelay` without moving focus, and leaving\n * both the trigger and the panel closes it after `closeDelay`. A click, a tap\n * or Enter/Space on the trigger — or a press or focus inside a previewing\n * panel — *pins* it: from then on it behaves as a plain Popover (focus moves\n * in, pointer-leave is ignored, Escape / outside click / Tab out dismisses).\n * It's the interactive counterpart of `HoverCard`, whose content is a\n * mouse-only, unfocusable link preview by design (Ark's HoverCard ignores\n * touch and never takes focus).\n */\n\ntype PopoverPosition = NonNullable<NonNullable<ArkPopover.RootProps[\"positioning\"]>[\"placement\"]>\n\n/** Elements a pinned panel can move focus to — the first one wins, else the\n * panel itself (it carries `tabIndex={-1}`). Mirrors what zag's own\n * `autoFocus` picks on a fresh open, which the upgrade path can't reuse: zag\n * only runs it on entering the open state, and an upgraded preview is\n * already open. */\nconst tabbableSelector = [\n \"a[href]\",\n \"button:not(:disabled)\",\n \"input:not(:disabled):not([type=hidden])\",\n \"select:not(:disabled)\",\n \"textarea:not(:disabled)\",\n \"[contenteditable=true]\",\n \"[tabindex]:not([tabindex='-1'])\",\n].join(\",\")\n\n/** How a `mode=\"hover\"` panel was opened: `\"hover\"` is the delayed,\n * focus-free preview; `\"press\"` is the pinned, regular Popover. */\ntype HoverSource = \"hover\" | \"press\"\n\ntype PopoverHover = {\n /** Open and opened by a press (or upgraded from a preview). */\n pinned: boolean\n /** Pointer entering the trigger or the panel. */\n onPointerEnter: (event: PointerEvent) => void\n /** Pointer leaving the trigger or the panel. */\n onPointerLeave: (event: PointerEvent) => void\n /** A trigger click about to reach Ark — flags a click on an open preview,\n * so the close Ark answers it with becomes a pin instead. */\n onTriggerClickCapture: (event: MouseEvent<HTMLElement>) => void\n /** A press or focus inside the panel. */\n pin: () => void\n}\n\ntype PopoverContextValue = {\n width: \"target\" | \"auto\"\n withinPortal: boolean\n container?: HTMLElement | null\n /** Open layers nested in this popover; see `lib/overlay-layer.tsx`. */\n layers: OverlayLayers\n /** Set only in `mode=\"hover\"`. */\n hover?: PopoverHover\n}\nconst PopoverContext = createContext<PopoverContextValue>({\n width: \"target\",\n withinPortal: true,\n layers: new Set(),\n})\n\ntype PopoverHoverDelays = {\n /** Hover time in ms before the preview opens. Default `600`, like `HoverCard`. */\n openDelay?: number\n /** Time in ms after the pointer leaves the trigger and the panel before the\n * preview closes. Default `300`, like `HoverCard`. A pinned panel ignores it. */\n closeDelay?: number\n}\n\n/** `openDelay`/`closeDelay` only mean something with `mode=\"hover\"`, so a\n * click popover rejects them at compile time instead of dropping them. */\ntype PopoverModeProps =\n | ({\n /** `\"click\"` (default) opens on click/tap/Enter only. `\"hover\"` also\n * opens a delayed, focus-free preview on hover, which a click, or a\n * press or focus inside it, pins open as a regular popover. */\n mode?: \"click\"\n } & UnavailableProps<PopoverHoverDelays, 'requires mode=\"hover\"'>)\n | ({ mode: \"hover\" } & PopoverHoverDelays)\n\nexport type PopoverProps = ArkPopover.RootProps &\n PopoverModeProps & {\n /** Match the trigger's width (`\"target\"`, default) or size to content (`\"auto\"`). */\n width?: \"target\" | \"auto\"\n /** Panel placement relative to the trigger. Defaults to Ark's `\"bottom\"`. */\n position?: PopoverPosition\n /** Gap in px between the trigger and the panel. */\n gutter?: number\n /** Positionner offset */\n offset?:\n | {\n mainAxis?: number | undefined\n crossAxis?: number | undefined\n }\n | undefined\n /** Hide the panel (`visibility: hidden`, no pointer events) once the\n * trigger is fully clipped by its own scrolling ancestor, and restore it\n * once back in view — Floating UI's `hide()` middleware\n * (`strategy: \"referenceHidden\"`), already wired into Ark's positioning\n * engine, just not exposed until now. Rides the positioner's existing\n * scroll/resize listeners, so no extra observer is needed. Default `true`\n * — a panel that can't see its own trigger is never in a state worth\n * keeping visible; pass `false` to restore the old \"keep following the\n * trigger's last known position\" behavior. */\n hideWhenDetached?: boolean\n /** Ark's full positioning options (`flip`, `slide`, `overlap`, `boundary`,\n * `getAnchorElement`, …), for placements the props above can't express.\n * Applied over them, so a key set here wins. */\n positioning?: ArkPopover.RootProps[\"positioning\"]\n\n /** Render the panel 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) — Escape, outside interaction, or a controlled `onOpenChange`. */\n onClose?: () => void\n }\n\n/** A `Unavailable`-branded delay narrows back to its default. */\nconst delay = (value: unknown, fallback: number) => (typeof value === \"number\" ? value : fallback)\n\n/** Focus the first tabbable element of the panel a trigger controls, else the\n * panel itself — on the next frame, once the pin has re-rendered. */\nconst focusInto = (trigger: HTMLElement, initialFocusEl?: () => HTMLElement | null) =>\n requestAnimationFrame(() => {\n const id = trigger.getAttribute(\"aria-controls\")\n const panel = id ? trigger.ownerDocument.getElementById(id) : null\n if (!panel || panel.contains(trigger.ownerDocument.activeElement)) return\n const target = initialFocusEl?.() ?? panel.querySelector<HTMLElement>(tabbableSelector) ?? panel\n target.focus({ preventScroll: true })\n })\n\ntype UsePopoverHoverOptions = {\n open?: boolean\n defaultOpen?: boolean\n openDelay: number\n closeDelay: number\n autoFocus: boolean\n initialFocusEl?: () => HTMLElement | null\n onChange: (open: boolean) => void\n}\n\n/**\n * `mode=\"hover\"`'s state: owns `open` (still controllable through\n * `open`/`defaultOpen`/`onOpenChange`) and *how* it was opened, and drives\n * Ark's machine fully controlled. The hover path never goes through Ark —\n * zag's Popover has no hover — it just flips `open` on a timer. Everything\n * else is Ark's: its trigger click, Escape and outside-click arrive as\n * `onArkOpenChange`, and the only one rewritten is a click on an open preview,\n * which zag answers with a close and this turns into a pin.\n *\n * `source` is deliberately not reset on close: zag reads `restoreFocus` when\n * the close lands, so a preview closing must still read as `\"hover\"` there,\n * or it would yank focus to a trigger the user never focused.\n */\nconst usePopoverHover = ({\n open,\n defaultOpen,\n openDelay,\n closeDelay,\n autoFocus,\n initialFocusEl,\n onChange,\n}: UsePopoverHoverOptions) => {\n const [isOpen, setOpen] = useUncontrolled<boolean>({\n value: open,\n defaultValue: defaultOpen,\n finalValue: false,\n onChange,\n })\n const [source, setSource] = useState<HoverSource>(\"press\")\n const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined)\n // The trigger of a click that landed on an open preview, between its\n // capture phase and the close Ark answers it with.\n const upgrading = useRef<HTMLElement | null>(null)\n const clear = () => {\n clearTimeout(timer.current)\n timer.current = undefined\n }\n // Unmount only; reads the ref at cleanup time, so it needs no deps.\n useEffect(() => () => clearTimeout(timer.current), [])\n const later = (next: boolean, ms: number) => {\n clear()\n timer.current = setTimeout(() => {\n timer.current = undefined\n setOpen(next)\n }, ms)\n }\n\n const pinned = isOpen && source === \"press\"\n const hover: PopoverHover = {\n pinned,\n onPointerEnter: (event) => {\n if (event.pointerType === \"touch\" || pinned) return\n if (isOpen) return clear()\n setSource(\"hover\")\n later(true, openDelay)\n },\n onPointerLeave: (event) => {\n if (event.pointerType === \"touch\" || pinned) return\n if (isOpen) later(false, closeDelay)\n else clear()\n },\n onTriggerClickCapture: (event) => {\n upgrading.current = isOpen && source === \"hover\" ? event.currentTarget : null\n },\n pin: () => {\n clear()\n setSource(\"press\")\n },\n }\n\n const onArkOpenChange = ({ open: next }: { open: boolean }) => {\n clear()\n const trigger = upgrading.current\n upgrading.current = null\n if (!next && trigger) {\n setSource(\"press\")\n if (autoFocus) focusInto(trigger, initialFocusEl)\n return\n }\n if (next) setSource(\"press\")\n setOpen(next)\n }\n\n return { open: isOpen, press: source === \"press\", hover, onArkOpenChange }\n}\n\nconst Root = ({\n mode = \"click\",\n openDelay,\n closeDelay,\n width = \"target\",\n position,\n gutter,\n offset,\n hideWhenDetached = true,\n positioning,\n withinPortal = true,\n container,\n children,\n open,\n defaultOpen,\n autoFocus = true,\n restoreFocus = true,\n modal = false,\n onOpenChange,\n onClose,\n onPointerDownOutside,\n ...rest\n}: PopoverProps) => {\n const guard = useLayerGuard(onPointerDownOutside)\n const notify = (details: { open: boolean }) => {\n onOpenChange?.(details)\n if (!details.open) onClose?.()\n }\n const hovering = usePopoverHover({\n open,\n defaultOpen,\n openDelay: delay(openDelay, 600),\n closeDelay: delay(closeDelay, 300),\n autoFocus,\n initialFocusEl: rest.initialFocusEl,\n onChange: (next) => notify({ open: next }),\n })\n const hover = mode === \"hover\" ? hovering.hover : undefined\n // A preview is never modal and never moves or restores focus; a pinned\n // panel takes the consumer's settings. zag reads all three on entering or\n // leaving the open state, which `source` is stable across.\n const press = !hover || hovering.press\n const state = hover\n ? { open: hovering.open, onOpenChange: hovering.onArkOpenChange }\n : { open, defaultOpen, onOpenChange: notify }\n return (\n <PopoverContext.Provider\n value={{ width, withinPortal, container, layers: guard.layers, hover }}\n >\n <ArkPopover.Root\n onPointerDownOutside={guard.onPointerDownOutside}\n positioning={{\n sameWidth: width === \"target\",\n placement: position,\n gutter,\n offset,\n hideWhenDetached,\n ...positioning,\n }}\n autoFocus={press && autoFocus}\n restoreFocus={press && restoreFocus}\n modal={press && modal}\n {...state}\n {...rest}\n >\n {children}\n </ArkPopover.Root>\n </PopoverContext.Provider>\n )\n}\n\nexport type PopoverTriggerProps = ArkPopover.TriggerProps\n\n/** Ark's trigger, plus the hover handlers in `mode=\"hover\"`. Ark merges them\n * with its own, so `asChild` and the click/keyboard toggle are untouched. */\nconst Trigger = ({\n onPointerEnter,\n onPointerLeave,\n onClickCapture,\n ...rest\n}: PopoverTriggerProps) => {\n const { hover } = useContext(PopoverContext)\n return (\n <ArkPopover.Trigger\n onPointerEnter={(event) => {\n onPointerEnter?.(event)\n hover?.onPointerEnter(event)\n }}\n onPointerLeave={(event) => {\n onPointerLeave?.(event)\n hover?.onPointerLeave(event)\n }}\n onClickCapture={(event) => {\n onClickCapture?.(event)\n hover?.onTriggerClickCapture(event)\n }}\n {...rest}\n />\n )\n}\n\nexport type PopoverContentProps = NoAsChild<ArkPopover.ContentProps> & WithTestId\n\nconst Content = ({\n className,\n children,\n testId,\n onPointerEnter,\n onPointerLeave,\n onPointerDown,\n onFocus,\n asChild: _asChild,\n ...rest\n}: PopoverContentProps) => {\n const { width, withinPortal, container, layers, hover } = useContext(PopoverContext)\n const portalContainer = useOverlayContainer(container)\n // A child of the enclosing Modal/Drawer/Popover (read above this popover's\n // own provider), and the parent of whatever opens from its body.\n useNestedLayer(usePopoverContext().open)\n const panel = (\n <ArkPopover.Positioner>\n <ArkPopover.Content\n tabIndex={-1}\n // target → fill the sameWidth positioner; auto → size to content (max-content).\n className={cn(popoverPanel, width === \"target\" ? \"w-full\" : \"w-max\", className)}\n {...props({ \"data-testid\": testId })}\n // In `mode=\"hover\"`: reaching the panel keeps a preview open, and\n // pressing or focusing anything in it (a click, or Tab through\n // zag's `proxyTabFocus`) pins it.\n onPointerEnter={(event) => {\n onPointerEnter?.(event)\n hover?.onPointerEnter(event)\n }}\n onPointerLeave={(event) => {\n onPointerLeave?.(event)\n hover?.onPointerLeave(event)\n }}\n onPointerDown={(event) => {\n onPointerDown?.(event)\n hover?.pin()\n }}\n onFocus={(event) => {\n onFocus?.(event)\n hover?.pin()\n }}\n {...rest}\n >\n <OverlayLayerProvider value={layers}>{children}</OverlayLayerProvider>\n </ArkPopover.Content>\n </ArkPopover.Positioner>\n )\n if (!withinPortal) return panel\n return <Portal container={portalContainer}>{panel}</Portal>\n}\n\nconst slotEdge = \"shrink-0 px-2 py-1.5 border-brand-900/20 dark:border-white/15\"\n\nexport type PopoverHeaderProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\n/** Fixed slot above the scrolling Body — a search input, filters, etc. */\nconst Header = ({ className, testId, ...rest }: PopoverHeaderProps) => (\n <div\n className={cn(slotEdge, \"border-b\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type PopoverFooterProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\n/** Fixed slot below the scrolling Body. */\nconst Footer = ({ className, testId, ...rest }: PopoverFooterProps) => (\n <div className={cn(slotEdge, className)} {...props({ \"data-testid\": testId })} {...rest} />\n)\n\nexport type PopoverBodyProps = ComponentPropsWithoutRef<\"div\"> & WithTestId\n\n/** The scroll region; hosts render their rows (and any empty message) here. */\nconst Body = ({ className, testId, ...rest }: PopoverBodyProps) => (\n <div\n className={cn(popoverViewport, slotEdge, className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\nexport type PopoverAnchorProps = ArkPopover.AnchorProps\n\nexport const Popover = {\n Root,\n Trigger,\n /** Positions the panel without attaching any click/keyboard trigger\n * semantics — for a host that already owns its own click resolution\n * (e.g. `Schedule`'s drag-vs-click gesture) and only needs the panel to\n * float relative to a given element. */\n Anchor: ArkPopover.Anchor,\n Content,\n Header,\n Body,\n Footer,\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useDirectionCheck } from './chunk-
|
|
1
|
+
import { useDirectionCheck } from './chunk-57BTVRRB.js';
|
|
2
2
|
import { props } from './chunk-WYCMIIRR.js';
|
|
3
|
-
import { focusStyles } from './chunk-
|
|
3
|
+
import { focusStyles } from './chunk-INJUILCN.js';
|
|
4
4
|
import { cn } from './chunk-QP4I37PA.js';
|
|
5
5
|
import { Tabs as Tabs$1 } from '@ark-ui/react/tabs';
|
|
6
6
|
import { cva } from 'class-variance-authority';
|
|
@@ -15,7 +15,7 @@ var tabsList = cva(
|
|
|
15
15
|
{
|
|
16
16
|
variants: {
|
|
17
17
|
variant: {
|
|
18
|
-
filled: ["bg-
|
|
18
|
+
filled: ["bg-black/3 dark:bg-white/4", "border-transparent"],
|
|
19
19
|
light: ["bg-white/4", "border-brand-900/20 dark:border-white/15"],
|
|
20
20
|
outline: ["bg-transparent border-transparent"],
|
|
21
21
|
subtle: ["bg-transparent border-transparent"],
|
|
@@ -48,8 +48,8 @@ var tabsTrigger = cva(
|
|
|
48
48
|
"data-disabled:cursor-not-allowed data-disabled:opacity-50",
|
|
49
49
|
"before:absolute before:rounded-full before:bg-gray-light-300 dark:before:bg-gray-dark-600",
|
|
50
50
|
"before:transition-opacity before:duration-200",
|
|
51
|
-
"before:top-1/2 before:
|
|
52
|
-
"in-data-[orientation=vertical]:before:top-0 in-data-[orientation=vertical]:before:
|
|
51
|
+
"before:top-1/2 before:start-0 before:-ms-[0.5px] before:h-1/2 before:w-px before:-translate-y-1/2",
|
|
52
|
+
"in-data-[orientation=vertical]:before:top-0 in-data-[orientation=vertical]:before:start-1/4 in-data-[orientation=vertical]:before:ms-0 in-data-[orientation=vertical]:before:h-px in-data-[orientation=vertical]:before:w-1/2",
|
|
53
53
|
"nth-2:before:hidden",
|
|
54
54
|
"data-selected:before:opacity-0 data-selected:[&+*]:before:opacity-0"
|
|
55
55
|
],
|
|
@@ -219,5 +219,5 @@ var Tabs = Object.assign(TabsComponent, {
|
|
|
219
219
|
});
|
|
220
220
|
|
|
221
221
|
export { Tabs };
|
|
222
|
-
//# sourceMappingURL=chunk-
|
|
223
|
-
//# sourceMappingURL=chunk-
|
|
222
|
+
//# sourceMappingURL=chunk-MQO42HZL.js.map
|
|
223
|
+
//# sourceMappingURL=chunk-MQO42HZL.js.map
|