@42-central/ui-react 0.18.2 → 0.19.1
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/colors.css +15 -10
- 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 +11 -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 +24 -2
- package/package.json +1 -1
- package/src/colors.css +15 -10
- 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.test.tsx +4 -1
- package/src/components/timeline/timeline.tsx +11 -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 +24 -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
|
@@ -2,6 +2,7 @@ import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/re
|
|
|
2
2
|
import { describe, expect, it, vi } from "vitest"
|
|
3
3
|
import { disableWeekends } from "../../lib/date-predicates"
|
|
4
4
|
import { type DateRangeValue, dateToCalendarValue } from "../../lib/date-value"
|
|
5
|
+
import { IntlProvider } from "../../lib/intl"
|
|
5
6
|
import { Calendar } from "./calendar"
|
|
6
7
|
|
|
7
8
|
// Ark binds trigger/cell handlers after the machine reaches its ready state; flush that
|
|
@@ -9,27 +10,23 @@ import { Calendar } from "./calendar"
|
|
|
9
10
|
// time-input.test.tsx).
|
|
10
11
|
const flush = () => new Promise((resolve) => setTimeout(resolve, 0))
|
|
11
12
|
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
// makes `data-value` selectors exact without reverse-engineering zag's internal string format.
|
|
13
|
+
// The zone the fixtures below are written in: `utc(…)` builds midnight UTC, which this zone reads
|
|
14
|
+
// as that same calendar day wherever the suite runs.
|
|
15
15
|
const TZ = "UTC"
|
|
16
16
|
|
|
17
17
|
const utc = (year: number, month: number, day: number) => new Date(Date.UTC(year, month, day))
|
|
18
18
|
|
|
19
|
-
/** The clickable day-cell trigger for a
|
|
20
|
-
* same `data-value` but has no click handler).
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
`[role="button"][data-value="${dateToCalendarValue(date, TZ).toString()}"]`,
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
/** The same trigger, addressed by the calendar day it renders *in the grid's own zone* rather
|
|
27
|
-
* than by an instant — `data-value` is the cell's `ZonedDateTime`, which always starts with that
|
|
28
|
-
* day (`2026-07-18T00:00:00+14:00[Pacific/Kiritimati]`), so a prefix match works for any zone
|
|
29
|
-
* without reconstructing zag's offset/zone suffix. */
|
|
19
|
+
/** The clickable day-cell trigger for a calendar day (not the ancestor `<td>`, which carries the
|
|
20
|
+
* same `data-value` but has no click handler). A cell's `data-value` is a zone-free
|
|
21
|
+
* `CalendarDate` or `CalendarDateTime` (`2026-07-18`, `2026-07-18T00:00:00`), so a prefix match
|
|
22
|
+
* on the day finds it whichever shape the grid derived it from. */
|
|
30
23
|
const dayTriggerOn = (container: HTMLElement, isoDay: string): HTMLElement | null =>
|
|
31
24
|
container.querySelector(`[role="button"][data-value^="${isoDay}"]`)
|
|
32
25
|
|
|
26
|
+
/** The same trigger for the day a `Date` falls on in `TZ`. */
|
|
27
|
+
const dayTrigger = (container: HTMLElement, date: Date): HTMLElement | null =>
|
|
28
|
+
dayTriggerOn(container, dateToCalendarValue(date, TZ).toString().slice(0, 10))
|
|
29
|
+
|
|
33
30
|
describe("Calendar", () => {
|
|
34
31
|
it("renders a day grid with role='grid'", () => {
|
|
35
32
|
render(<Calendar timeZone={TZ} defaultValue={utc(2026, 6, 15)} />)
|
|
@@ -276,3 +273,126 @@ describe("Calendar", () => {
|
|
|
276
273
|
expect(cell?.className).not.toContain("focus-visible:ring-(--c-solid)")
|
|
277
274
|
})
|
|
278
275
|
})
|
|
276
|
+
|
|
277
|
+
describe("Calendar — IntlProvider time zone", () => {
|
|
278
|
+
// 10:30 UTC is already the 16th in Kiritimati (UTC+14) and still the 14th in Midway (UTC−11),
|
|
279
|
+
// while every host this suite runs on (UTC in CI, Paris locally) reads the 15th — so each
|
|
280
|
+
// assertion names a day only the intended zone can produce.
|
|
281
|
+
const instant = new Date("2026-07-15T10:30:00Z")
|
|
282
|
+
const selectedDay = (container: HTMLElement) =>
|
|
283
|
+
container
|
|
284
|
+
.querySelector('[role="button"][data-selected]')
|
|
285
|
+
?.getAttribute("data-value")
|
|
286
|
+
?.slice(0, 10)
|
|
287
|
+
|
|
288
|
+
it("uses the provider's time zone when no prop is set", async () => {
|
|
289
|
+
const { container } = render(
|
|
290
|
+
<IntlProvider timeZone="Pacific/Kiritimati">
|
|
291
|
+
<Calendar defaultValue={instant} />
|
|
292
|
+
</IntlProvider>,
|
|
293
|
+
)
|
|
294
|
+
await flush()
|
|
295
|
+
expect(selectedDay(container)).toBe("2026-07-16")
|
|
296
|
+
})
|
|
297
|
+
|
|
298
|
+
it("re-reads an uncontrolled defaultValue when the zone changes after mount", async () => {
|
|
299
|
+
// What `timeZone="auto"` does under SSR: the hydration render resolves to UTC and the host
|
|
300
|
+
// zone arrives one render later. Ark only reads `defaultValue` at mount, so without the
|
|
301
|
+
// re-seed the selection would stay on the first zone's day.
|
|
302
|
+
const { container, rerender } = render(
|
|
303
|
+
<IntlProvider timeZone="Pacific/Midway">
|
|
304
|
+
<Calendar defaultValue={instant} />
|
|
305
|
+
</IntlProvider>,
|
|
306
|
+
)
|
|
307
|
+
await flush()
|
|
308
|
+
expect(selectedDay(container)).toBe("2026-07-14")
|
|
309
|
+
rerender(
|
|
310
|
+
<IntlProvider timeZone="Pacific/Kiritimati">
|
|
311
|
+
<Calendar defaultValue={instant} />
|
|
312
|
+
</IntlProvider>,
|
|
313
|
+
)
|
|
314
|
+
await flush()
|
|
315
|
+
expect(selectedDay(container)).toBe("2026-07-16")
|
|
316
|
+
})
|
|
317
|
+
|
|
318
|
+
it("keeps a picked date's instant, onChange and focus across a zone change", async () => {
|
|
319
|
+
const onChange = vi.fn()
|
|
320
|
+
const calendar = <Calendar defaultValue={instant} onChange={onChange} />
|
|
321
|
+
const { container, rerender } = render(
|
|
322
|
+
<IntlProvider timeZone="Pacific/Midway">{calendar}</IntlProvider>,
|
|
323
|
+
)
|
|
324
|
+
await flush()
|
|
325
|
+
const picked = dayTriggerOn(container, "2026-07-20") as HTMLElement
|
|
326
|
+
picked.focus()
|
|
327
|
+
fireEvent.click(picked)
|
|
328
|
+
await waitFor(() => expect(onChange).toHaveBeenCalledTimes(1))
|
|
329
|
+
// Ark keeps the selection's time of day on a new pick: the 20th at 23:30 in Midway (UTC−11).
|
|
330
|
+
expect(onChange).toHaveBeenLastCalledWith(new Date("2026-07-21T10:30:00Z"))
|
|
331
|
+
expect(document.activeElement).toBe(picked)
|
|
332
|
+
|
|
333
|
+
// That instant is the 22nd, 00:30 in Kiritimati (UTC+14), so the selection moves a day. Under
|
|
334
|
+
// the old remount it went back to `defaultValue` (the 16th) and focus dropped to <body>.
|
|
335
|
+
rerender(<IntlProvider timeZone="Pacific/Kiritimati">{calendar}</IntlProvider>)
|
|
336
|
+
await waitFor(() => expect(selectedDay(container)).toBe("2026-07-22"))
|
|
337
|
+
expect(onChange).toHaveBeenCalledTimes(1)
|
|
338
|
+
expect(document.activeElement).not.toBe(document.body)
|
|
339
|
+
expect(container.contains(document.activeElement)).toBe(true)
|
|
340
|
+
expect(document.activeElement?.getAttribute("data-value")?.slice(0, 10)).toBe("2026-07-20")
|
|
341
|
+
|
|
342
|
+
// The next pick is a real change, reported in the new zone.
|
|
343
|
+
fireEvent.click(dayTriggerOn(container, "2026-07-23") as HTMLElement)
|
|
344
|
+
await waitFor(() => expect(onChange).toHaveBeenCalledTimes(2))
|
|
345
|
+
expect(onChange).toHaveBeenLastCalledWith(new Date("2026-07-22T10:30:00Z"))
|
|
346
|
+
})
|
|
347
|
+
|
|
348
|
+
it("keeps the month the user navigated to across a zone change", async () => {
|
|
349
|
+
const { container, rerender } = render(
|
|
350
|
+
<IntlProvider timeZone="Pacific/Midway">
|
|
351
|
+
<Calendar defaultValue={instant} />
|
|
352
|
+
</IntlProvider>,
|
|
353
|
+
)
|
|
354
|
+
await flush()
|
|
355
|
+
fireEvent.click(container.querySelector('[data-part="next-trigger"]') as HTMLElement)
|
|
356
|
+
await waitFor(() => expect(dayTriggerOn(container, "2026-08-31")).not.toBeNull())
|
|
357
|
+
rerender(
|
|
358
|
+
<IntlProvider timeZone="Pacific/Kiritimati">
|
|
359
|
+
<Calendar defaultValue={instant} />
|
|
360
|
+
</IntlProvider>,
|
|
361
|
+
)
|
|
362
|
+
await flush()
|
|
363
|
+
await flush()
|
|
364
|
+
expect(dayTriggerOn(container, "2026-08-31")).not.toBeNull()
|
|
365
|
+
})
|
|
366
|
+
|
|
367
|
+
it("re-derives a controlled value in the new zone without calling onChange", async () => {
|
|
368
|
+
const onChange = vi.fn()
|
|
369
|
+
const { container, rerender } = render(
|
|
370
|
+
<IntlProvider timeZone="Pacific/Midway">
|
|
371
|
+
<Calendar value={instant} onChange={onChange} />
|
|
372
|
+
</IntlProvider>,
|
|
373
|
+
)
|
|
374
|
+
await flush()
|
|
375
|
+
expect(selectedDay(container)).toBe("2026-07-14")
|
|
376
|
+
rerender(
|
|
377
|
+
<IntlProvider timeZone="Pacific/Kiritimati">
|
|
378
|
+
<Calendar value={instant} onChange={onChange} />
|
|
379
|
+
</IntlProvider>,
|
|
380
|
+
)
|
|
381
|
+
await waitFor(() => expect(selectedDay(container)).toBe("2026-07-16"))
|
|
382
|
+
// The roving cell follows the selection to its new day.
|
|
383
|
+
expect(
|
|
384
|
+
container.querySelector('[role="button"][data-focus]')?.getAttribute("data-value"),
|
|
385
|
+
).toMatch(/^2026-07-16/)
|
|
386
|
+
expect(onChange).not.toHaveBeenCalled()
|
|
387
|
+
})
|
|
388
|
+
|
|
389
|
+
it("lets the timeZone prop override the provider", async () => {
|
|
390
|
+
const { container } = render(
|
|
391
|
+
<IntlProvider timeZone="Pacific/Kiritimati">
|
|
392
|
+
<Calendar timeZone="Pacific/Midway" defaultValue={instant} />
|
|
393
|
+
</IntlProvider>,
|
|
394
|
+
)
|
|
395
|
+
await flush()
|
|
396
|
+
expect(selectedDay(container)).toBe("2026-07-14")
|
|
397
|
+
})
|
|
398
|
+
})
|
|
@@ -2,22 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
import { DatePicker as Ark, type DatePickerDateView as DateView } from "@ark-ui/react/date-picker"
|
|
4
4
|
import { useLocaleContext } from "@ark-ui/react/locale"
|
|
5
|
-
import {
|
|
6
|
-
import type { ComponentProps, ReactNode } from "react"
|
|
5
|
+
import { type ComponentProps, type ReactNode, useRef } from "react"
|
|
7
6
|
import { cn } from "../../lib/cn"
|
|
8
7
|
import type { DatePredicate } from "../../lib/date-predicates"
|
|
9
8
|
import {
|
|
10
9
|
calendarValueToDate,
|
|
11
10
|
type DateRangeValue,
|
|
12
|
-
|
|
11
|
+
dateToArkValue,
|
|
13
12
|
fromArkValues,
|
|
14
13
|
toArkValues,
|
|
15
14
|
} from "../../lib/date-value"
|
|
16
15
|
import type { FormControlProps } from "../../lib/form-control"
|
|
16
|
+
import { useTimeZone } from "../../lib/intl"
|
|
17
17
|
import { props } from "../../lib/props"
|
|
18
18
|
import type { Size } from "../../lib/sizes"
|
|
19
19
|
import type { WithTestId } from "../../lib/test-id"
|
|
20
20
|
import { CalendarBody, type CalendarBodyClassNames } from "./calendar-body"
|
|
21
|
+
import { CalendarZoneSync, hashArkValues } from "./calendar-zone-sync"
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
24
|
* Calendar — the inline month grid (RFC §9, `docs/rfcs/date-picker.md`): Ark's `date-picker`
|
|
@@ -102,10 +103,11 @@ export type CalendarProps<Range extends boolean = false> = FormControlProps<
|
|
|
102
103
|
withWeekNumbers?: boolean
|
|
103
104
|
/** Overrides the active locale context. Drives month/day names and first-day-of-week. */
|
|
104
105
|
locale?: string
|
|
105
|
-
/** Overrides the
|
|
106
|
-
* `
|
|
107
|
-
*
|
|
108
|
-
*
|
|
106
|
+
/** Overrides the time zone for every `Date ↔ DateValue` conversion. Resolves
|
|
107
|
+
* **prop → `IntlProvider` → host zone**, through `useTimeZone` like `Schedule` — **not** Ark's
|
|
108
|
+
* own machine default (`"UTC"`), which is why the resolved zone is forwarded to `Ark.Root`
|
|
109
|
+
* explicitly rather than only used in this component's own conversions (see
|
|
110
|
+
* `lib/date-value.ts`'s module doc). Accepts `"auto"` to follow the host zone. */
|
|
109
111
|
timeZone?: string
|
|
110
112
|
/** Overrides Ark's own built-in aria-label/accessible-name strings (day cells, prev/next, the
|
|
111
113
|
* view-cycling header, week numbers) — English by default. Unlike `locale`, nothing here
|
|
@@ -148,8 +150,9 @@ export const Calendar = <Range extends boolean = false>({
|
|
|
148
150
|
}: CalendarProps<Range>) => {
|
|
149
151
|
const { locale: contextLocale } = useLocaleContext()
|
|
150
152
|
const resolvedLocale = locale ?? contextLocale
|
|
151
|
-
const resolvedTimeZone = timeZone
|
|
153
|
+
const resolvedTimeZone = useTimeZone(timeZone)
|
|
152
154
|
const isRange = Boolean(range)
|
|
155
|
+
const zoneReseed = useRef<string | null>(null)
|
|
153
156
|
|
|
154
157
|
return (
|
|
155
158
|
<Ark.Root
|
|
@@ -162,18 +165,20 @@ export const Calendar = <Range extends boolean = false>({
|
|
|
162
165
|
translations={resolveCalendarTranslations(translations)}
|
|
163
166
|
value={toArkValues(value, resolvedTimeZone)}
|
|
164
167
|
defaultValue={toArkValues(defaultValue, resolvedTimeZone)}
|
|
165
|
-
onValueChange={
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
168
|
+
onValueChange={(details) => {
|
|
169
|
+
// A zone change re-expresses the selection in the new zone; that echo is not a change.
|
|
170
|
+
if (zoneReseed.current === hashArkValues(details.value)) {
|
|
171
|
+
zoneReseed.current = null
|
|
172
|
+
return
|
|
173
|
+
}
|
|
174
|
+
// The machine's value is a plain DateValue[]; `range` is a runtime flag here, so narrow
|
|
175
|
+
// the result back to the caller's declared shape.
|
|
176
|
+
onChange?.(
|
|
177
|
+
fromArkValues(details.value, isRange, resolvedTimeZone) as Range extends true
|
|
178
|
+
? DateRangeValue
|
|
179
|
+
: Date | null,
|
|
180
|
+
)
|
|
181
|
+
}}
|
|
177
182
|
onBlur={onBlur}
|
|
178
183
|
numOfMonths={numOfMonths}
|
|
179
184
|
fixedWeeks={fixedWeeks}
|
|
@@ -186,8 +191,8 @@ export const Calendar = <Range extends boolean = false>({
|
|
|
186
191
|
isDateUnavailable(calendarValueToDate(dateValue, resolvedTimeZone), resolvedTimeZone)
|
|
187
192
|
: undefined
|
|
188
193
|
}
|
|
189
|
-
min={min ?
|
|
190
|
-
max={max ?
|
|
194
|
+
min={min ? dateToArkValue(min, resolvedTimeZone) : undefined}
|
|
195
|
+
max={max ? dateToArkValue(max, resolvedTimeZone) : undefined}
|
|
191
196
|
minView={minView}
|
|
192
197
|
maxView={maxView}
|
|
193
198
|
disabled={disabled}
|
|
@@ -205,6 +210,15 @@ export const Calendar = <Range extends boolean = false>({
|
|
|
205
210
|
* always finds nothing, so keyboard navigation updates the machine's internal focus state
|
|
206
211
|
* (visible via `data-focus`) but never moves real DOM focus. `inline` implies `open` (the
|
|
207
212
|
* machine treats it as permanently open), so `Content`'s `hidden={!open}` never hides this. */}
|
|
213
|
+
{/* Ark reads `defaultValue` once, at mount, so a zone change (`timeZone="auto"` going from
|
|
214
|
+
* the UTC hydration snapshot to the host zone, or the app's provider changing) would leave
|
|
215
|
+
* the selection on the old zone's day. This re-seeds it on the same instant in place;
|
|
216
|
+
* see `calendar-zone-sync.tsx` for why it isn't a remount. */}
|
|
217
|
+
<CalendarZoneSync
|
|
218
|
+
timeZone={resolvedTimeZone}
|
|
219
|
+
controlled={value !== undefined}
|
|
220
|
+
pendingRef={zoneReseed}
|
|
221
|
+
/>
|
|
208
222
|
<Ark.Content>
|
|
209
223
|
<CalendarBody
|
|
210
224
|
numOfMonths={numOfMonths}
|
|
@@ -19,9 +19,30 @@ const definition = defineChart({
|
|
|
19
19
|
},
|
|
20
20
|
})
|
|
21
21
|
|
|
22
|
+
const SERIES = [
|
|
23
|
+
{ category: "A", series: "x", value: 4 },
|
|
24
|
+
{ category: "A", series: "y", value: 2 },
|
|
25
|
+
{ category: "B", series: "x", value: 7 },
|
|
26
|
+
{ category: "B", series: "y", value: 3 },
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
const multiSeries = defineChart({
|
|
30
|
+
marks: [barY(SERIES, { x: "category", y: "value", color: "series" })],
|
|
31
|
+
scales: {
|
|
32
|
+
x: { scale: () => scaleBand().padding(0.18) },
|
|
33
|
+
y: { scale: scaleLinear, nice: true },
|
|
34
|
+
},
|
|
35
|
+
})
|
|
36
|
+
|
|
22
37
|
const root = (container: HTMLElement) =>
|
|
23
38
|
container.querySelector('[data-part="root"]') as HTMLElement
|
|
24
39
|
|
|
40
|
+
/** The paint of every bar TanStack drew, in document order. */
|
|
41
|
+
const barFills = (container: HTMLElement) =>
|
|
42
|
+
[...container.querySelectorAll(".ts-chart__bar rect")].map(
|
|
43
|
+
(bar) => bar.getAttribute("fill") ?? "",
|
|
44
|
+
)
|
|
45
|
+
|
|
25
46
|
describe("Chart", () => {
|
|
26
47
|
it("mounts TanStack's chart, rendering a real svg", () => {
|
|
27
48
|
const { container } = render(
|
|
@@ -42,12 +63,30 @@ describe("Chart", () => {
|
|
|
42
63
|
expect(screen.getByTestId("revenue-chart")).toBe(root(document.body))
|
|
43
64
|
})
|
|
44
65
|
|
|
45
|
-
it("routes a single color through data-color and --
|
|
66
|
+
it("routes a single color through data-color and its --chart-solid", () => {
|
|
46
67
|
const { container } = render(
|
|
47
68
|
<Chart definition={definition} ariaLabel="Sample chart" height={200} color="green" />,
|
|
48
69
|
)
|
|
49
70
|
expect(root(container).getAttribute("data-color")).toBe("green")
|
|
50
|
-
expect(root(container).style.getPropertyValue("--ts-chart-1")).toBe("var(--
|
|
71
|
+
expect(root(container).style.getPropertyValue("--ts-chart-1")).toBe("var(--chart-solid)")
|
|
72
|
+
expect(barFills(container)).toEqual(["var(--chart-solid)", "var(--chart-solid)"])
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
it("resolves neutral through data-color too — there is no neutral scale to point at", () => {
|
|
76
|
+
const { container } = render(
|
|
77
|
+
<Chart definition={definition} ariaLabel="Sample chart" height={200} color="neutral" />,
|
|
78
|
+
)
|
|
79
|
+
expect(root(container).getAttribute("data-color")).toBe("neutral")
|
|
80
|
+
expect(root(container).style.getPropertyValue("--ts-chart-1")).toBe("var(--chart-solid)")
|
|
81
|
+
expect(barFills(container)).toEqual(["var(--chart-solid)", "var(--chart-solid)"])
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
it("treats a single-entry colors like color", () => {
|
|
85
|
+
const { container } = render(
|
|
86
|
+
<Chart definition={definition} ariaLabel="Sample chart" height={200} colors={["neutral"]} />,
|
|
87
|
+
)
|
|
88
|
+
expect(root(container).getAttribute("data-color")).toBe("neutral")
|
|
89
|
+
expect(barFills(container)).toEqual(["var(--chart-solid)", "var(--chart-solid)"])
|
|
51
90
|
})
|
|
52
91
|
|
|
53
92
|
it("sets one --ts-chart-N slot per entry in colors, in order", () => {
|
|
@@ -59,18 +98,79 @@ describe("Chart", () => {
|
|
|
59
98
|
colors={["red", "blue"]}
|
|
60
99
|
/>,
|
|
61
100
|
)
|
|
62
|
-
expect(root(container).style.getPropertyValue("--ts-chart-1")).toBe("var(--
|
|
63
|
-
expect(root(container).style.getPropertyValue("--ts-chart-2")).toBe("var(--
|
|
101
|
+
expect(root(container).style.getPropertyValue("--ts-chart-1")).toBe("var(--chart-red)")
|
|
102
|
+
expect(root(container).style.getPropertyValue("--ts-chart-2")).toBe("var(--chart-blue)")
|
|
64
103
|
// A multi-entry palette doesn't collapse onto a single data-color.
|
|
65
104
|
expect(root(container).getAttribute("data-color")).toBeNull()
|
|
66
105
|
})
|
|
67
106
|
|
|
68
|
-
it("
|
|
107
|
+
it("resolves neutral inside a multi-entry colors to its chart fill", () => {
|
|
69
108
|
const { container } = render(
|
|
70
|
-
<Chart
|
|
109
|
+
<Chart
|
|
110
|
+
definition={definition}
|
|
111
|
+
ariaLabel="Sample chart"
|
|
112
|
+
height={200}
|
|
113
|
+
colors={["neutral", "blue"]}
|
|
114
|
+
/>,
|
|
115
|
+
)
|
|
116
|
+
expect(root(container).style.getPropertyValue("--ts-chart-1")).toBe("var(--chart-neutral)")
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
it("paints a single series with the inherited --chart-solid when color/colors are both omitted", () => {
|
|
120
|
+
const { container } = render(
|
|
121
|
+
<div data-color="green">
|
|
122
|
+
<Chart definition={definition} ariaLabel="Sample chart" height={200} />
|
|
123
|
+
</div>,
|
|
71
124
|
)
|
|
125
|
+
// No data-color of its own, and no palette slot: --chart-solid comes from
|
|
126
|
+
// the ancestor's data-color through the cascade.
|
|
72
127
|
expect(root(container).getAttribute("data-color")).toBeNull()
|
|
73
128
|
expect(root(container).style.getPropertyValue("--ts-chart-1")).toBe("")
|
|
129
|
+
expect(barFills(container)).toEqual(["var(--chart-solid)", "var(--chart-solid)"])
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
it("keeps TanStack's palette slots for a multi-series chart with no color props", () => {
|
|
133
|
+
const { container } = render(
|
|
134
|
+
<div data-color="green">
|
|
135
|
+
<Chart definition={multiSeries} ariaLabel="Sample chart" height={200} />
|
|
136
|
+
</div>,
|
|
137
|
+
)
|
|
138
|
+
const fills = barFills(container)
|
|
139
|
+
expect(fills).toHaveLength(4)
|
|
140
|
+
expect(fills.some((fill) => fill.includes("--chart-solid"))).toBe(false)
|
|
141
|
+
expect(new Set(fills)).toEqual(
|
|
142
|
+
new Set(["var(--ts-chart-1, #2563eb)", "var(--ts-chart-2, #f97316)"]),
|
|
143
|
+
)
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
it("leaves a definition with its own color options untouched", () => {
|
|
147
|
+
const ownColor = defineChart({
|
|
148
|
+
marks: [barY(DATA, { x: "category", y: "value" })],
|
|
149
|
+
scales: {
|
|
150
|
+
x: { scale: () => scaleBand().padding(0.18) },
|
|
151
|
+
y: { scale: scaleLinear, nice: true },
|
|
152
|
+
},
|
|
153
|
+
color: { range: ["#ff00aa"] },
|
|
154
|
+
})
|
|
155
|
+
const { container } = render(
|
|
156
|
+
<Chart definition={ownColor} ariaLabel="Sample chart" height={200} />,
|
|
157
|
+
)
|
|
158
|
+
expect(barFills(container)).toEqual(["#ff00aa", "#ff00aa"])
|
|
159
|
+
})
|
|
160
|
+
|
|
161
|
+
it("keeps a multi-entry colors on the palette slots, even for a single series", () => {
|
|
162
|
+
const { container } = render(
|
|
163
|
+
<Chart
|
|
164
|
+
definition={definition}
|
|
165
|
+
ariaLabel="Sample chart"
|
|
166
|
+
height={200}
|
|
167
|
+
colors={["red", "blue"]}
|
|
168
|
+
/>,
|
|
169
|
+
)
|
|
170
|
+
expect(barFills(container)).toEqual([
|
|
171
|
+
"var(--ts-chart-1, #2563eb)",
|
|
172
|
+
"var(--ts-chart-1, #2563eb)",
|
|
173
|
+
])
|
|
74
174
|
})
|
|
75
175
|
|
|
76
176
|
it("routes through the renderer-accepting Chart (react/core) when a renderer is given", () => {
|
|
@@ -82,8 +182,15 @@ describe("Chart", () => {
|
|
|
82
182
|
})
|
|
83
183
|
|
|
84
184
|
describe("chartColors", () => {
|
|
85
|
-
it("resolves the default CHART_PALETTE to var(--
|
|
86
|
-
expect(chartColors()).toEqual(CHART_PALETTE.map((color) => `var(--
|
|
185
|
+
it("resolves the default CHART_PALETTE to var(--chart-<name>) entries", () => {
|
|
186
|
+
expect(chartColors()).toEqual(CHART_PALETTE.map((color) => `var(--chart-${color})`))
|
|
187
|
+
})
|
|
188
|
+
|
|
189
|
+
it("resolves neutral to its own chart fill, not a --color-neutral-500 that doesn't exist", () => {
|
|
190
|
+
expect(chartColors(["neutral", "brand"])).toEqual([
|
|
191
|
+
"var(--chart-neutral)",
|
|
192
|
+
"var(--chart-brand)",
|
|
193
|
+
])
|
|
87
194
|
})
|
|
88
195
|
|
|
89
196
|
it("passes an unrecognized color through verbatim", () => {
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type {
|
|
4
|
+
ChartColorScale,
|
|
5
|
+
ChartKey,
|
|
6
|
+
ChartValue,
|
|
7
|
+
DomChartDefinition,
|
|
8
|
+
ResolvedColorScale,
|
|
9
|
+
} from "@tanstack/charts"
|
|
4
10
|
import {
|
|
5
11
|
Chart as TanStackChart,
|
|
6
12
|
type ChartProps as TanStackChartProps,
|
|
@@ -9,7 +15,7 @@ import {
|
|
|
9
15
|
Chart as TanStackRendererChart,
|
|
10
16
|
type ChartProps as TanStackRendererChartProps,
|
|
11
17
|
} from "@tanstack/charts/react/core"
|
|
12
|
-
import type
|
|
18
|
+
import { type CSSProperties, useMemo } from "react"
|
|
13
19
|
import { cn } from "../../lib/cn"
|
|
14
20
|
import { COLORS, type Color } from "../../lib/colors"
|
|
15
21
|
import { props } from "../../lib/props"
|
|
@@ -18,13 +24,80 @@ import type { WithTestId } from "../../lib/test-id"
|
|
|
18
24
|
const KNOWN_COLORS: readonly string[] = COLORS
|
|
19
25
|
|
|
20
26
|
/**
|
|
21
|
-
* Resolves a kit `Color` token to
|
|
22
|
-
* for a known palette color — the
|
|
23
|
-
*
|
|
24
|
-
*
|
|
27
|
+
* Resolves a kit `Color` token to a literal CSS value for a palette slot:
|
|
28
|
+
* `var(--chart-<name>)` for a known palette color — the theme-aware chart
|
|
29
|
+
* fill `styles.css` maps per color (600 in light, the 500 solid in dark;
|
|
30
|
+
* `neutral` black/white) — or the string verbatim for a custom color. Only
|
|
31
|
+
* multi-entry palettes (`colors`, `chartColors`) go through here — anything
|
|
32
|
+
* with a single accent (`color`, or no color at all) resolves through
|
|
33
|
+
* `INHERITED_SOLID` instead, so it follows the nearest `data-color`.
|
|
25
34
|
*/
|
|
26
35
|
const resolveChartColor = (color: Color): string =>
|
|
27
|
-
KNOWN_COLORS.includes(color) ? `var(--
|
|
36
|
+
KNOWN_COLORS.includes(color) ? `var(--chart-${color})` : color
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The chart fill of whichever `data-color` is in scope at the chart root —
|
|
40
|
+
* the chart's own (`color`), an ancestor's, or the `:root` default
|
|
41
|
+
* (`neutral`). `styles.css` sets it on every `data-color` element from the
|
|
42
|
+
* same `--chart-<name>` map the palette slots read, falling back to that
|
|
43
|
+
* element's `--c-solid` for a custom color and in dark mode.
|
|
44
|
+
*/
|
|
45
|
+
const INHERITED_SOLID = "var(--chart-solid)"
|
|
46
|
+
|
|
47
|
+
const isChartKey = (value: unknown): value is ChartKey =>
|
|
48
|
+
typeof value === "string" || typeof value === "number"
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* TanStack's own categorical color scale, unchanged, except for a chart with
|
|
52
|
+
* no color channel at all — a single series. TanStack paints that with its
|
|
53
|
+
* first palette slot, the same one a multi-series chart's first series gets,
|
|
54
|
+
* so no stylesheet can tell the two apart: this resolver is where they
|
|
55
|
+
* diverge. The single series gets `INHERITED_SOLID`; a chart that maps a
|
|
56
|
+
* field to `color` keeps the default ordinal mapping over `theme.palette`
|
|
57
|
+
* (TanStack's `--ts-chart-N` slots, i.e. `colors`), key for key.
|
|
58
|
+
*/
|
|
59
|
+
const inheritedColorScale: ChartColorScale = {
|
|
60
|
+
id: "42ui-inherited-color",
|
|
61
|
+
resolve: ({ values, domain, range, theme }): ResolvedColorScale => {
|
|
62
|
+
const keys = [...new Set((domain ?? values).filter(isChartKey))]
|
|
63
|
+
if (!keys.length) {
|
|
64
|
+
return {
|
|
65
|
+
type: "ordinal",
|
|
66
|
+
kind: "categorical",
|
|
67
|
+
domain: [],
|
|
68
|
+
range: [INHERITED_SOLID],
|
|
69
|
+
map: () => INHERITED_SOLID,
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const slots = range?.length ? range : theme.palette
|
|
73
|
+
return {
|
|
74
|
+
type: "ordinal",
|
|
75
|
+
kind: "categorical",
|
|
76
|
+
domain: keys,
|
|
77
|
+
range: slots,
|
|
78
|
+
map: (value) => {
|
|
79
|
+
if (value == null) return slots[0] ?? "currentColor"
|
|
80
|
+
let index = keys.indexOf(value)
|
|
81
|
+
if (index < 0) index = keys.push(value) - 1
|
|
82
|
+
return slots[index % slots.length] ?? "currentColor"
|
|
83
|
+
},
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Routes `definition`'s color through `inheritedColorScale` — only when the
|
|
90
|
+
* definition leaves color entirely to TanStack's defaults (no `color`
|
|
91
|
+
* options, no `theme.palette`). A definition that configures either keeps
|
|
92
|
+
* its own resolution, and a responsive one (`defineChart(fn)`) is left
|
|
93
|
+
* alone, since its color options only exist once `fn` runs.
|
|
94
|
+
*/
|
|
95
|
+
function withInheritedColor<TDatum, TXValue extends ChartValue, TYValue extends ChartValue>(
|
|
96
|
+
definition: DomChartDefinition<TDatum, TXValue, TYValue>,
|
|
97
|
+
): DomChartDefinition<TDatum, TXValue, TYValue> {
|
|
98
|
+
if ("chart" in definition || definition.color || definition.theme?.palette) return definition
|
|
99
|
+
return { ...definition, color: { resolver: inheritedColorScale } }
|
|
100
|
+
}
|
|
28
101
|
|
|
29
102
|
/**
|
|
30
103
|
* Ordered categorical palette for multi-series charts, built from `COLORS`
|
|
@@ -36,8 +109,9 @@ const resolveChartColor = (color: Color): string =>
|
|
|
36
109
|
* of this kit's own hues that clears every check in the dataviz skill's
|
|
37
110
|
* `validate_palette.js` (lightness band, CVD Delta E, and normal-vision
|
|
38
111
|
* separation, all-pairs, not just adjacent) without relying on a specific
|
|
39
|
-
* order
|
|
40
|
-
*
|
|
112
|
+
* order, as measured at the 500 step (the dark-mode fill; light mode reads
|
|
113
|
+
* one step darker, see `styles.css`). Every other pairing among the
|
|
114
|
+
* remaining five hues fails outright there — `red`/`orange` and
|
|
41
115
|
* `teal`/`green` read as near-duplicates even to normal color vision, and
|
|
42
116
|
* `purple`/`blue` and `cyan`/`pink` fail the colorblind-safety floor. Rather
|
|
43
117
|
* than drop those five hues from a consumer's options entirely, they're
|
|
@@ -78,15 +152,17 @@ export type ChartProps<
|
|
|
78
152
|
> = Omit<TanStackChartProps<TDatum, TXValue, TYValue>, "renderSvg"> &
|
|
79
153
|
WithTestId & {
|
|
80
154
|
/**
|
|
81
|
-
* Single accent for a one-series chart: sets `data-color`
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
* `
|
|
155
|
+
* Single accent for a one-series chart: sets `data-color` on the root,
|
|
156
|
+
* and the series paints with that palette's chart fill — its 600 step in
|
|
157
|
+
* light mode, its `--c-solid` in dark (also mirrored into
|
|
158
|
+
* `--ts-chart-1`). Omitted, a one-series chart inherits the nearest
|
|
159
|
+
* ancestor's `data-color` instead, like every other colored component.
|
|
160
|
+
* Ignored for the palette slots when `colors` has several entries.
|
|
85
161
|
*/
|
|
86
162
|
color?: Color
|
|
87
163
|
/**
|
|
88
164
|
* Ordered palette for a multi-series chart — see `CHART_PALETTE`/
|
|
89
|
-
* `chartColors`.
|
|
165
|
+
* `chartColors`. A single entry behaves exactly like `color`. Otherwise sets `--ts-chart-1` through `--ts-chart-N`, one per
|
|
90
166
|
* entry, for TanStack's own default categorical color scale to pick up
|
|
91
167
|
* with zero changes to how the chart's `definition` builds its scales.
|
|
92
168
|
* Beyond `--ts-chart-6`, only a custom `scaleOrdinal().range(...)` (see
|
|
@@ -128,8 +204,12 @@ export type ChartProps<
|
|
|
128
204
|
* - The DOM tooltip surface/text/shadow/border and its "active row"
|
|
129
205
|
* highlight theme through `--ts-chart-tooltip-*` / `--ts-chart-tooltip-
|
|
130
206
|
* active-row-*`, also set in `styles.css`.
|
|
131
|
-
* -
|
|
132
|
-
*
|
|
207
|
+
* - A one-series chart paints with `--chart-solid`, so it follows `color`
|
|
208
|
+
* or an inherited `data-color` (see `inheritedColorScale`); `colors`
|
|
209
|
+
* themes a multi-series palette via `--ts-chart-N`, TanStack's own
|
|
210
|
+
* default color-scale slots. Both read `styles.css`'s per-color chart
|
|
211
|
+
* fill: the 600 step in light mode, so a mark clears 3:1 against the
|
|
212
|
+
* page, and the unchanged solid in dark.
|
|
133
213
|
*
|
|
134
214
|
* Not routed through Ark's `ark.*` factory (no `asChild`): TanStack's
|
|
135
215
|
* `<Chart>` owns its entire internal DOM/SVG tree end to end, so there's no
|
|
@@ -152,19 +232,28 @@ export function Chart<
|
|
|
152
232
|
className,
|
|
153
233
|
style,
|
|
154
234
|
testId,
|
|
235
|
+
definition,
|
|
155
236
|
renderer,
|
|
156
237
|
renderSvg,
|
|
157
238
|
onRender,
|
|
158
239
|
...rest
|
|
159
240
|
}: ChartProps<TDatum, TXValue, TYValue>) {
|
|
160
|
-
const
|
|
161
|
-
const
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
const
|
|
167
|
-
|
|
241
|
+
const multiPalette = colors && colors.length > 1 ? colors : undefined
|
|
242
|
+
const dataColor = multiPalette ? color : (color ?? colors?.[0])
|
|
243
|
+
// A multi-entry `colors` fills the slots in order; a single accent fills
|
|
244
|
+
// the first with its own `data-color`'s solid, for a multi-series chart
|
|
245
|
+
// given just `color`.
|
|
246
|
+
const slots = multiPalette ? chartColors(multiPalette) : dataColor ? [INHERITED_SOLID] : []
|
|
247
|
+
const paletteStyle = Object.fromEntries(
|
|
248
|
+
slots.map((value, index) => [`--ts-chart-${index + 1}`, value]),
|
|
249
|
+
) as CSSProperties
|
|
250
|
+
// A multi-entry `colors` keeps TanStack's own resolution: a single-series
|
|
251
|
+
// chart given one still paints with `colors[0]`, as it always has.
|
|
252
|
+
const keepsOwnPalette = multiPalette !== undefined
|
|
253
|
+
const resolved = useMemo(
|
|
254
|
+
() => (keepsOwnPalette ? definition : withInheritedColor(definition)),
|
|
255
|
+
[definition, keepsOwnPalette],
|
|
256
|
+
)
|
|
168
257
|
return (
|
|
169
258
|
<div
|
|
170
259
|
data-part="root"
|
|
@@ -181,11 +270,12 @@ export function Chart<
|
|
|
181
270
|
// isn't worth it.
|
|
182
271
|
<TanStackRendererChart
|
|
183
272
|
renderer={renderer}
|
|
273
|
+
definition={resolved}
|
|
184
274
|
onRender={onRender as TanStackRendererChartProps<TDatum, TXValue, TYValue>["onRender"]}
|
|
185
275
|
{...rest}
|
|
186
276
|
/>
|
|
187
277
|
) : (
|
|
188
|
-
<TanStackChart renderSvg={renderSvg} onRender={onRender} {...rest} />
|
|
278
|
+
<TanStackChart definition={resolved} renderSvg={renderSvg} onRender={onRender} {...rest} />
|
|
189
279
|
)}
|
|
190
280
|
</div>
|
|
191
281
|
)
|