@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
|
@@ -17,7 +17,7 @@ import type { UnavailableProps } from "../../lib/available-if"
|
|
|
17
17
|
import { cn } from "../../lib/cn"
|
|
18
18
|
import type { Color } from "../../lib/colors"
|
|
19
19
|
import { mergeRefs } from "../../lib/merge-refs"
|
|
20
|
-
import { Notification } from "./notification"
|
|
20
|
+
import { Notification, type NotificationTranslations } from "./notification"
|
|
21
21
|
import { createToastStore, type ToastStore } from "./store"
|
|
22
22
|
import type { ColorWithTypeReason, ToastData, ToastHue, ToastId, ToastType } from "./types"
|
|
23
23
|
|
|
@@ -150,9 +150,21 @@ export type Notify = ((input: NotifyInput) => ToastId) & {
|
|
|
150
150
|
getToasts: () => ToastData[]
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
+
/** The toast region's name (`regionLabel`, default `"Notifications"`), plus the card's own
|
|
154
|
+
* keys, forwarded to every toast it renders. */
|
|
155
|
+
export type NotificationsTranslations = NotificationTranslations & {
|
|
156
|
+
regionLabel?: string
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export type NotificationsProps = {
|
|
160
|
+
/** Overrides the region's and the toasts' accessible names. A partial override keeps the
|
|
161
|
+
* other defaults. */
|
|
162
|
+
translations?: NotificationsTranslations
|
|
163
|
+
}
|
|
164
|
+
|
|
153
165
|
export type Notifier = {
|
|
154
166
|
notify: Notify
|
|
155
|
-
Notifications: () => ReactNode
|
|
167
|
+
Notifications: (props: NotificationsProps) => ReactNode
|
|
156
168
|
}
|
|
157
169
|
|
|
158
170
|
/** A bare node (string/number/element/array) is a title; any other object is
|
|
@@ -199,6 +211,7 @@ const CLICK_SLOP = 5
|
|
|
199
211
|
|
|
200
212
|
type ToasterItemProps = {
|
|
201
213
|
toast: ToastData
|
|
214
|
+
translations?: NotificationTranslations
|
|
202
215
|
store: ToastStore
|
|
203
216
|
/** Position from the front (0 = newest). */
|
|
204
217
|
index: number
|
|
@@ -220,6 +233,7 @@ type ToasterItemProps = {
|
|
|
220
233
|
*/
|
|
221
234
|
function ToasterItem({
|
|
222
235
|
toast,
|
|
236
|
+
translations,
|
|
223
237
|
store,
|
|
224
238
|
index,
|
|
225
239
|
offset,
|
|
@@ -296,6 +310,7 @@ function ToasterItem({
|
|
|
296
310
|
{...hue}
|
|
297
311
|
{...presence.getPresenceProps()}
|
|
298
312
|
data-part="toast"
|
|
313
|
+
translations={translations}
|
|
299
314
|
onClose={() => store.dismiss(id)}
|
|
300
315
|
// `cursor-grab` lives here (not in the shared cva) so only swipeable
|
|
301
316
|
// toaster toasts show it — a standalone `Notification.Root` doesn't.
|
|
@@ -412,7 +427,7 @@ export function createNotifier(options: CreateNotifierOptions = {}): Notifier {
|
|
|
412
427
|
getToasts: () => store.getSnapshot().toasts,
|
|
413
428
|
}) as Notify
|
|
414
429
|
|
|
415
|
-
const Notifications = () => {
|
|
430
|
+
const Notifications = ({ translations }: NotificationsProps = {}) => {
|
|
416
431
|
const { toasts } = useSyncExternalStore(
|
|
417
432
|
store.subscribe,
|
|
418
433
|
store.getSnapshot,
|
|
@@ -456,7 +471,7 @@ export function createNotifier(options: CreateNotifierOptions = {}): Notifier {
|
|
|
456
471
|
|
|
457
472
|
const region = (
|
|
458
473
|
<section
|
|
459
|
-
aria-label="Notifications"
|
|
474
|
+
aria-label={translations?.regionLabel ?? "Notifications"}
|
|
460
475
|
data-scope="notifications"
|
|
461
476
|
data-placement={placement}
|
|
462
477
|
data-expand={expand ? "" : undefined}
|
|
@@ -487,6 +502,7 @@ export function createNotifier(options: CreateNotifierOptions = {}): Notifier {
|
|
|
487
502
|
<ToasterItem
|
|
488
503
|
key={toast.id}
|
|
489
504
|
toast={toast}
|
|
505
|
+
translations={translations}
|
|
490
506
|
store={store}
|
|
491
507
|
index={index}
|
|
492
508
|
offset={offset}
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
export {
|
|
4
4
|
type CreateNotifierOptions,
|
|
5
5
|
createNotifier,
|
|
6
|
+
type NotificationsProps,
|
|
7
|
+
type NotificationsTranslations,
|
|
6
8
|
type Notifier,
|
|
7
9
|
type Notify,
|
|
8
10
|
type NotifyInput,
|
|
@@ -15,6 +17,10 @@ export {
|
|
|
15
17
|
type NotifyUpdateInput,
|
|
16
18
|
type NotifyUpdateOptions,
|
|
17
19
|
} from "./create-notifier"
|
|
18
|
-
export type {
|
|
20
|
+
export type {
|
|
21
|
+
NotificationProps,
|
|
22
|
+
NotificationRootProps,
|
|
23
|
+
NotificationTranslations,
|
|
24
|
+
} from "./notification"
|
|
19
25
|
export { Notification, notificationRoot } from "./notification"
|
|
20
26
|
export type { ToastData, ToastHue, ToastId, ToastType } from "./types"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/** biome-ignore-all lint/style/noNonNullAssertion: If this crash it fails the test anyway */
|
|
2
2
|
|
|
3
|
+
import { act, fireEvent, render, screen } from "@testing-library/react"
|
|
3
4
|
import { CheckCircle2Icon } from "lucide-react"
|
|
4
5
|
import { renderToStaticMarkup } from "react-dom/server"
|
|
5
6
|
import { afterEach, describe, expect, it, vi } from "vitest"
|
|
@@ -319,3 +320,51 @@ describe("presentational", () => {
|
|
|
319
320
|
expect(markup).toContain('data-testid="collapse-toggle"')
|
|
320
321
|
})
|
|
321
322
|
})
|
|
323
|
+
|
|
324
|
+
describe("Notification translations", () => {
|
|
325
|
+
it("names the close button from translations", () => {
|
|
326
|
+
render(<Notification title="Saved" translations={{ closeTriggerLabel: "Fermer" }} />)
|
|
327
|
+
expect(screen.getByRole("button", { name: "Fermer" })).toBeTruthy()
|
|
328
|
+
})
|
|
329
|
+
|
|
330
|
+
it("names the collapse chevron from translations in both states", () => {
|
|
331
|
+
render(
|
|
332
|
+
<Notification
|
|
333
|
+
title="Saved"
|
|
334
|
+
description="Details"
|
|
335
|
+
withCloseButton={false}
|
|
336
|
+
withCollapse
|
|
337
|
+
translations={{ expandLabel: "Déplier" }}
|
|
338
|
+
/>,
|
|
339
|
+
)
|
|
340
|
+
fireEvent.click(screen.getByRole("button", { name: "Déplier" }))
|
|
341
|
+
// The omitted key keeps its English default.
|
|
342
|
+
expect(screen.getByRole("button", { name: "Collapse" })).toBeTruthy()
|
|
343
|
+
})
|
|
344
|
+
|
|
345
|
+
it("keeps the English default without an override", () => {
|
|
346
|
+
render(<Notification title="Saved" translations={{}} />)
|
|
347
|
+
expect(screen.getByRole("button", { name: "Dismiss" })).toBeTruthy()
|
|
348
|
+
})
|
|
349
|
+
})
|
|
350
|
+
|
|
351
|
+
describe("Notifications translations", () => {
|
|
352
|
+
it("names the region and forwards the card keys to every toast", async () => {
|
|
353
|
+
const { notify, Notifications } = createNotifier({
|
|
354
|
+
duration: Number.POSITIVE_INFINITY,
|
|
355
|
+
withinPortal: false,
|
|
356
|
+
})
|
|
357
|
+
render(<Notifications translations={{ regionLabel: "Alertes", closeTriggerLabel: "Fermer" }} />)
|
|
358
|
+
expect(screen.getByRole("region", { name: "Alertes" })).toBeTruthy()
|
|
359
|
+
act(() => {
|
|
360
|
+
notify("Saved")
|
|
361
|
+
})
|
|
362
|
+
expect(await screen.findByRole("button", { name: "Fermer" })).toBeTruthy()
|
|
363
|
+
})
|
|
364
|
+
|
|
365
|
+
it("keeps the English region name without an override", () => {
|
|
366
|
+
const { Notifications } = createNotifier({ withinPortal: false })
|
|
367
|
+
render(<Notifications />)
|
|
368
|
+
expect(screen.getByRole("region", { name: "Notifications" })).toBeTruthy()
|
|
369
|
+
})
|
|
370
|
+
})
|
|
@@ -155,7 +155,7 @@ export const ActionTrigger = ({
|
|
|
155
155
|
className={cn(
|
|
156
156
|
"inline-flex h-7 cursor-pointer items-center rounded-input px-2 text-xs font-medium",
|
|
157
157
|
"border border-current/30 hover:bg-current/10",
|
|
158
|
-
|
|
158
|
+
focusStyles({ ring: "palette", offset: false }),
|
|
159
159
|
"transition-colors",
|
|
160
160
|
className,
|
|
161
161
|
)}
|
|
@@ -177,7 +177,9 @@ export const CloseTrigger = ({
|
|
|
177
177
|
className={cn(
|
|
178
178
|
"ms-auto inline-flex size-5 shrink-0 cursor-pointer items-center justify-center",
|
|
179
179
|
"rounded-full opacity-70 hover:opacity-100 [&_svg]:size-4",
|
|
180
|
-
|
|
180
|
+
focusStyles({ ring: "palette", offset: false }),
|
|
181
|
+
// The button rests at 70% opacity, which would fade its ring with it.
|
|
182
|
+
"focus-visible:opacity-100",
|
|
181
183
|
"transition-colors",
|
|
182
184
|
className,
|
|
183
185
|
)}
|
|
@@ -214,7 +216,9 @@ export const CollapseTrigger = ({
|
|
|
214
216
|
className={cn(
|
|
215
217
|
"ms-auto inline-flex size-5 shrink-0 cursor-pointer items-center justify-center",
|
|
216
218
|
"rounded-full opacity-70 hover:opacity-100 [&_svg]:size-4",
|
|
217
|
-
|
|
219
|
+
focusStyles({ ring: "palette", offset: false }),
|
|
220
|
+
// The button rests at 70% opacity, which would fade its ring with it.
|
|
221
|
+
"focus-visible:opacity-100",
|
|
218
222
|
"transition-colors",
|
|
219
223
|
className,
|
|
220
224
|
)}
|
|
@@ -237,6 +241,23 @@ export const CollapseTrigger = ({
|
|
|
237
241
|
* the Notifier-managed plumbing (`id` / `status` / `duration`) is optional, so a
|
|
238
242
|
* standalone card is just `<Notification type="success" title="Saved" />`.
|
|
239
243
|
*/
|
|
244
|
+
/** The ready-made card's control names. `closeTriggerLabel` follows Ark's own Toast key; the
|
|
245
|
+
* compound parts (`CloseTrigger`, `CollapseTrigger`) take a plain `aria-label` instead. */
|
|
246
|
+
export type NotificationTranslations = {
|
|
247
|
+
/** The close (×) button. Default `"Dismiss"`. */
|
|
248
|
+
closeTriggerLabel?: string
|
|
249
|
+
/** The collapse chevron while the card is open. Default `"Collapse"`. */
|
|
250
|
+
collapseLabel?: string
|
|
251
|
+
/** The collapse chevron while the card is folded. Default `"Expand"`. */
|
|
252
|
+
expandLabel?: string
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
const NOTIFICATION_DEFAULT_TRANSLATIONS = {
|
|
256
|
+
closeTriggerLabel: "Dismiss",
|
|
257
|
+
collapseLabel: "Collapse",
|
|
258
|
+
expandLabel: "Expand",
|
|
259
|
+
} as const satisfies NotificationTranslations
|
|
260
|
+
|
|
240
261
|
export type NotificationProps = Omit<NotificationRootProps, "title" | "color" | "asChild"> &
|
|
241
262
|
ForbidAsChild &
|
|
242
263
|
Omit<ToastFields, "id" | "status" | "duration"> &
|
|
@@ -254,6 +275,9 @@ export type NotificationProps = Omit<NotificationRootProps, "title" | "color" |
|
|
|
254
275
|
open?: boolean
|
|
255
276
|
/** Fired when the collapse toggle is pressed. */
|
|
256
277
|
onOpenChange?: (open: boolean) => void
|
|
278
|
+
/** Overrides the close and collapse buttons' accessible names. A partial override keeps
|
|
279
|
+
* the other defaults. */
|
|
280
|
+
translations?: NotificationTranslations
|
|
257
281
|
}
|
|
258
282
|
|
|
259
283
|
/**
|
|
@@ -283,12 +307,14 @@ function NotificationComponent({
|
|
|
283
307
|
open: _open,
|
|
284
308
|
onOpenChange,
|
|
285
309
|
onClose,
|
|
310
|
+
translations,
|
|
286
311
|
// Notifier-managed plumbing — not rendered onto the card.
|
|
287
312
|
status: _status,
|
|
288
313
|
duration: _duration,
|
|
289
314
|
asChild: _asChild,
|
|
290
315
|
...rest
|
|
291
316
|
}: NotificationProps) {
|
|
317
|
+
const resolvedTranslations = { ...NOTIFICATION_DEFAULT_TRANSLATIONS, ...translations }
|
|
292
318
|
const preset = type ? TOAST_STATUS[type] : undefined
|
|
293
319
|
// `type` and `color` are exclusive (see `ToastHue`); the preset wins
|
|
294
320
|
// should a JS caller pass both anyway.
|
|
@@ -322,9 +348,17 @@ function NotificationComponent({
|
|
|
322
348
|
{icon != null && <Icon>{icon}</Icon>}
|
|
323
349
|
{title != null && <Title>{title}</Title>}
|
|
324
350
|
{match({ withCloseButton, withCollapse })
|
|
325
|
-
.with({ withCloseButton: true }, () =>
|
|
351
|
+
.with({ withCloseButton: true }, () => (
|
|
352
|
+
<CloseTrigger aria-label={resolvedTranslations.closeTriggerLabel} onClick={onClose} />
|
|
353
|
+
))
|
|
326
354
|
.with({ withCollapse: true }, () => (
|
|
327
|
-
<CollapseTrigger
|
|
355
|
+
<CollapseTrigger
|
|
356
|
+
open={open}
|
|
357
|
+
aria-label={
|
|
358
|
+
open ? resolvedTranslations.collapseLabel : resolvedTranslations.expandLabel
|
|
359
|
+
}
|
|
360
|
+
onClick={() => setOpen(!open)}
|
|
361
|
+
/>
|
|
328
362
|
))
|
|
329
363
|
.with({ withCollapse: false }, () => null)
|
|
330
364
|
.exhaustive()}
|
|
@@ -289,3 +289,40 @@ describe("NumberInput", () => {
|
|
|
289
289
|
})
|
|
290
290
|
})
|
|
291
291
|
})
|
|
292
|
+
|
|
293
|
+
describe("NumberInput translations", () => {
|
|
294
|
+
it("names the steppers and clear button from translations", () => {
|
|
295
|
+
render(
|
|
296
|
+
<NumberInput
|
|
297
|
+
clearable
|
|
298
|
+
defaultValue={5}
|
|
299
|
+
translations={{
|
|
300
|
+
incrementLabel: "Augmenter",
|
|
301
|
+
decrementLabel: "Diminuer",
|
|
302
|
+
clearTriggerLabel: "Effacer",
|
|
303
|
+
}}
|
|
304
|
+
/>,
|
|
305
|
+
)
|
|
306
|
+
expect(screen.getByRole("button", { name: "Augmenter" })).toBeTruthy()
|
|
307
|
+
expect(screen.getByRole("button", { name: "Diminuer" })).toBeTruthy()
|
|
308
|
+
expect(screen.getByRole("button", { name: "Effacer" })).toBeTruthy()
|
|
309
|
+
})
|
|
310
|
+
|
|
311
|
+
it("keeps the English defaults for the keys a partial override omits", () => {
|
|
312
|
+
render(
|
|
313
|
+
<NumberInput clearable defaultValue={5} translations={{ incrementLabel: "Augmenter" }} />,
|
|
314
|
+
)
|
|
315
|
+
expect(screen.getByRole("button", { name: "Augmenter" })).toBeTruthy()
|
|
316
|
+
expect(screen.getByRole("button", { name: "Decrement" })).toBeTruthy()
|
|
317
|
+
expect(screen.getByRole("button", { name: "Clear value" })).toBeTruthy()
|
|
318
|
+
})
|
|
319
|
+
|
|
320
|
+
it("forwards valueText to the input's aria-valuetext", () => {
|
|
321
|
+
render(
|
|
322
|
+
<NumberInput label="Age" defaultValue={5} translations={{ valueText: (v) => `${v} ans` }} />,
|
|
323
|
+
)
|
|
324
|
+
expect(screen.getByRole("spinbutton", { name: "Age" }).getAttribute("aria-valuetext")).toBe(
|
|
325
|
+
"5 ans",
|
|
326
|
+
)
|
|
327
|
+
})
|
|
328
|
+
})
|
|
@@ -3,7 +3,14 @@
|
|
|
3
3
|
import { useFieldContext } from "@ark-ui/react/field"
|
|
4
4
|
import { NumberInput as Ark, useNumberInputContext } from "@ark-ui/react/number-input"
|
|
5
5
|
import { ChevronDown, ChevronUp } from "lucide-react"
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
type ComponentProps,
|
|
8
|
+
type FocusEvent,
|
|
9
|
+
type KeyboardEvent,
|
|
10
|
+
type ReactNode,
|
|
11
|
+
type Ref,
|
|
12
|
+
useRef,
|
|
13
|
+
} from "react"
|
|
7
14
|
import { cn } from "../../lib/cn"
|
|
8
15
|
import { mergeRefs } from "../../lib/merge-refs"
|
|
9
16
|
import { props } from "../../lib/props"
|
|
@@ -19,6 +26,22 @@ import {
|
|
|
19
26
|
import { CloseIcon } from "../popover/icons"
|
|
20
27
|
import { popoverClearTrigger } from "../popover/popover"
|
|
21
28
|
|
|
29
|
+
/** Ark's own NumberInput `translations` type (`incrementLabel`, `decrementLabel`, and
|
|
30
|
+
* `valueText` for `aria-valuetext`), derived structurally rather than imported from
|
|
31
|
+
* `@zag-js/number-input`, plus the combobox family's `clearTriggerLabel` for the kit's own
|
|
32
|
+
* clear button. */
|
|
33
|
+
export type NumberInputTranslations = NonNullable<
|
|
34
|
+
ComponentProps<typeof Ark.Root>["translations"]
|
|
35
|
+
> & {
|
|
36
|
+
clearTriggerLabel?: string
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const NUMBER_INPUT_DEFAULT_TRANSLATIONS = {
|
|
40
|
+
incrementLabel: "Increment",
|
|
41
|
+
decrementLabel: "Decrement",
|
|
42
|
+
clearTriggerLabel: "Clear value",
|
|
43
|
+
} as const satisfies NumberInputTranslations
|
|
44
|
+
|
|
22
45
|
/**
|
|
23
46
|
* NumberInput — a numeric `<input>` with increment / decrement steppers on Ark
|
|
24
47
|
* UI's NumberInput machine. It lives on the same shell as [`Input`](/docs/input)
|
|
@@ -119,6 +142,11 @@ export type NumberInputProps = Pick<FieldProps, "label" | "description" | "error
|
|
|
119
142
|
onBlur?: (event: FocusEvent<HTMLInputElement>) => void
|
|
120
143
|
className?: string
|
|
121
144
|
classNames?: NumberInputClassNames
|
|
145
|
+
/** Overrides the steppers' (`incrementLabel`, `decrementLabel`, default `"Increment"` /
|
|
146
|
+
* `"Decrement"`) and the clear button's (`clearTriggerLabel`, default `"Clear value"`)
|
|
147
|
+
* accessible names, and sets `valueText` (the input's `aria-valuetext`). A partial override
|
|
148
|
+
* keeps the other defaults. */
|
|
149
|
+
translations?: NumberInputTranslations
|
|
122
150
|
}
|
|
123
151
|
|
|
124
152
|
/** Bridge the kit's `number | null` value to the machine's string contract:
|
|
@@ -249,7 +277,9 @@ export const NumberInput = ({
|
|
|
249
277
|
className,
|
|
250
278
|
classNames,
|
|
251
279
|
testId,
|
|
280
|
+
translations,
|
|
252
281
|
}: NumberInputProps) => {
|
|
282
|
+
const resolvedTranslations = { ...NUMBER_INPUT_DEFAULT_TRANSLATIONS, ...translations }
|
|
253
283
|
// Drive the red state independently of the `Field` error slot so a form
|
|
254
284
|
// library can flip it from `fieldState.invalid` (see FormControlProps).
|
|
255
285
|
const isInvalid = invalid || error != null
|
|
@@ -303,6 +333,7 @@ export const NumberInput = ({
|
|
|
303
333
|
name={name}
|
|
304
334
|
{...props({ invalid: isInvalid, disabled, readOnly, required })}
|
|
305
335
|
ids={id ? { input: id } : undefined}
|
|
336
|
+
translations={resolvedTranslations}
|
|
306
337
|
className={cn("w-full", className)}
|
|
307
338
|
>
|
|
308
339
|
<Ark.Context>
|
|
@@ -355,7 +386,7 @@ export const NumberInput = ({
|
|
|
355
386
|
{canClear && (
|
|
356
387
|
<button
|
|
357
388
|
type="button"
|
|
358
|
-
aria-label=
|
|
389
|
+
aria-label={resolvedTranslations.clearTriggerLabel}
|
|
359
390
|
aria-hidden={!showClear}
|
|
360
391
|
tabIndex={showClear ? 0 : -1}
|
|
361
392
|
onPointerDown={(event) => event.preventDefault()}
|
|
@@ -368,7 +399,6 @@ export const NumberInput = ({
|
|
|
368
399
|
{!hideControls && (
|
|
369
400
|
<Ark.Control className={cn("-my-1 flex flex-col", classNames?.control)}>
|
|
370
401
|
<Ark.IncrementTrigger
|
|
371
|
-
aria-label="Increment"
|
|
372
402
|
disabled={!wrap && !!(max !== undefined && (value ?? 0) >= max)}
|
|
373
403
|
{...props({
|
|
374
404
|
"data-disabled": !wrap && !!(max !== undefined && (value ?? 0) >= max),
|
|
@@ -382,7 +412,6 @@ export const NumberInput = ({
|
|
|
382
412
|
<ChevronUp />
|
|
383
413
|
</Ark.IncrementTrigger>
|
|
384
414
|
<Ark.DecrementTrigger
|
|
385
|
-
aria-label="Decrement"
|
|
386
415
|
disabled={!wrap && !!(min !== undefined && (value ?? 0) <= min)}
|
|
387
416
|
{...props({
|
|
388
417
|
"data-disabled": !wrap && !!(min !== undefined && (value ?? 0) <= min),
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { fireEvent, render, screen, waitFor } from "@testing-library/react"
|
|
2
|
-
import { createRef } from "react"
|
|
2
|
+
import { createRef, useState } from "react"
|
|
3
3
|
import { describe, expect, it, vi } from "vitest"
|
|
4
|
+
import { focusStyles } from "../../lib/focus-styles"
|
|
4
5
|
import { PasswordInput } from "./password-input"
|
|
5
6
|
|
|
6
7
|
const getInput = () => document.querySelector("input") as HTMLInputElement
|
|
@@ -54,13 +55,90 @@ describe("PasswordInput", () => {
|
|
|
54
55
|
// A real <button> (not an aria-hidden span) so it is exposed to AT and
|
|
55
56
|
// receives pointer events directly.
|
|
56
57
|
expect(trigger.tagName).toBe("BUTTON")
|
|
57
|
-
expect(trigger.getAttribute("aria-controls")).
|
|
58
|
-
// The toggle is focusable programmatically (focus management lives on the
|
|
59
|
-
// input itself; Ark sets tabIndex=-1 on the redundant convenience toggle).
|
|
58
|
+
expect(trigger.getAttribute("aria-controls")).toBe(getInput().id)
|
|
60
59
|
trigger.focus()
|
|
61
60
|
expect(document.activeElement).toBe(trigger)
|
|
62
61
|
})
|
|
63
62
|
|
|
63
|
+
describe("toggle keyboard + AT access", () => {
|
|
64
|
+
// jsdom has no native Tab, so read the sequential focus order the way the
|
|
65
|
+
// browser builds it: focusable, enabled, tabIndex >= 0, in document order.
|
|
66
|
+
// (Verified against real Tab presses in Chromium on the docs page.)
|
|
67
|
+
const tabOrder = () =>
|
|
68
|
+
Array.from(document.querySelectorAll<HTMLElement>("input, button")).filter(
|
|
69
|
+
(el) => el.tabIndex >= 0 && !(el as HTMLButtonElement).disabled,
|
|
70
|
+
)
|
|
71
|
+
const ready = () => new Promise((resolve) => setTimeout(resolve, 0))
|
|
72
|
+
|
|
73
|
+
it("puts the toggle in the tab order right after the input by default", () => {
|
|
74
|
+
render(<PasswordInput placeholder="Password" />)
|
|
75
|
+
expect(tabOrder()).toEqual([getInput(), screen.getByRole("button")])
|
|
76
|
+
expect(screen.getByRole("button").tabIndex).toBe(0)
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
it("skips the toggle with `toggleTabIndex={-1}`", () => {
|
|
80
|
+
render(<PasswordInput placeholder="Password" toggleTabIndex={-1} />)
|
|
81
|
+
expect(screen.getByRole("button").tabIndex).toBe(-1)
|
|
82
|
+
expect(tabOrder()).toEqual([getInput()])
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
it("lands `classNames.visibilityTrigger` on the button, after the kit's classes", () => {
|
|
86
|
+
render(<PasswordInput classNames={{ visibilityTrigger: "my-toggle text-red-500" }} />)
|
|
87
|
+
const cls = screen.getByRole("button").className
|
|
88
|
+
expect(cls).toContain("my-toggle")
|
|
89
|
+
expect(cls).toContain("cursor-pointer")
|
|
90
|
+
expect(cls.indexOf("my-toggle")).toBeGreaterThan(cls.indexOf("cursor-pointer"))
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
it("rings the toggle with the kit's focusStyles(), flush (no offset)", () => {
|
|
94
|
+
render(<PasswordInput />)
|
|
95
|
+
const cls = screen.getByRole("button").className.split(" ")
|
|
96
|
+
for (const c of focusStyles({ offset: false }).split(" ")) expect(cls).toContain(c)
|
|
97
|
+
expect(cls).not.toContain("focus-visible:ring-offset-2")
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
it("conveys the state through its label, not aria-expanded / aria-pressed", async () => {
|
|
101
|
+
render(<PasswordInput placeholder="Password" />)
|
|
102
|
+
await ready()
|
|
103
|
+
const trigger = screen.getByRole("button", { name: "Show password" })
|
|
104
|
+
expect(trigger.hasAttribute("aria-expanded")).toBe(false)
|
|
105
|
+
expect(trigger.hasAttribute("aria-pressed")).toBe(false)
|
|
106
|
+
fireEvent.pointerDown(trigger)
|
|
107
|
+
await waitFor(() => expect(trigger.getAttribute("aria-label")).toBe("Hide password"))
|
|
108
|
+
expect(trigger.hasAttribute("aria-expanded")).toBe(false)
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
it("toggles from a keyboard / AT click (detail 0), which zag ignores", async () => {
|
|
112
|
+
const onVisibleChange = vi.fn()
|
|
113
|
+
render(<PasswordInput placeholder="Password" onVisibleChange={onVisibleChange} />)
|
|
114
|
+
await ready()
|
|
115
|
+
const trigger = screen.getByRole("button")
|
|
116
|
+
// Enter / Space on a <button> dispatch a click with detail 0, no pointerdown.
|
|
117
|
+
fireEvent.click(trigger, { detail: 0 })
|
|
118
|
+
await waitFor(() => expect(getInput().type).toBe("text"))
|
|
119
|
+
expect(onVisibleChange).toHaveBeenCalledWith(true)
|
|
120
|
+
fireEvent.click(trigger, { detail: 0 })
|
|
121
|
+
await waitFor(() => expect(getInput().type).toBe("password"))
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
it("does not toggle twice on a pointer click (pointerdown already did)", async () => {
|
|
125
|
+
render(<PasswordInput placeholder="Password" />)
|
|
126
|
+
await ready()
|
|
127
|
+
const trigger = screen.getByRole("button")
|
|
128
|
+
fireEvent.pointerDown(trigger)
|
|
129
|
+
fireEvent.click(trigger, { detail: 1 })
|
|
130
|
+
await waitFor(() => expect(getInput().type).toBe("text"))
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
it("ignores a keyboard click while read-only, like the machine does", async () => {
|
|
134
|
+
render(<PasswordInput placeholder="Password" readOnly />)
|
|
135
|
+
await ready()
|
|
136
|
+
fireEvent.click(screen.getByRole("button"), { detail: 0 })
|
|
137
|
+
await ready()
|
|
138
|
+
expect(getInput().type).toBe("password")
|
|
139
|
+
})
|
|
140
|
+
})
|
|
141
|
+
|
|
64
142
|
it("renders a built-in label + error from props", () => {
|
|
65
143
|
render(<PasswordInput label="Password" error="Required" placeholder="pwd" />)
|
|
66
144
|
expect(screen.getByText("Password")).toBeTruthy()
|
|
@@ -91,4 +169,123 @@ describe("PasswordInput", () => {
|
|
|
91
169
|
render(<PasswordInput testId="password" placeholder="Password" />)
|
|
92
170
|
expect(screen.getByTestId("password")).toBe(screen.getByPlaceholderText("Password"))
|
|
93
171
|
})
|
|
172
|
+
describe("visibility override", () => {
|
|
173
|
+
// Ark binds the trigger handler once its machine is ready (a macrotask).
|
|
174
|
+
const ready = () => new Promise((resolve) => setTimeout(resolve, 0))
|
|
175
|
+
|
|
176
|
+
it("reveals the value from `defaultVisible`", () => {
|
|
177
|
+
render(<PasswordInput defaultVisible placeholder="Password" />)
|
|
178
|
+
expect(getInput().type).toBe("text")
|
|
179
|
+
})
|
|
180
|
+
|
|
181
|
+
it("follows a controlled `visible` and reports presses as a boolean", async () => {
|
|
182
|
+
const onVisibleChange = vi.fn()
|
|
183
|
+
const { rerender } = render(
|
|
184
|
+
<PasswordInput visible={false} onVisibleChange={onVisibleChange} />,
|
|
185
|
+
)
|
|
186
|
+
await ready()
|
|
187
|
+
fireEvent.pointerDown(screen.getByRole("button"))
|
|
188
|
+
await waitFor(() => expect(onVisibleChange).toHaveBeenCalledWith(true))
|
|
189
|
+
// The parent didn't accept the change, so the field stays masked.
|
|
190
|
+
expect(getInput().type).toBe("password")
|
|
191
|
+
|
|
192
|
+
rerender(<PasswordInput visible onVisibleChange={onVisibleChange} />)
|
|
193
|
+
await waitFor(() => expect(getInput().type).toBe("text"))
|
|
194
|
+
})
|
|
195
|
+
|
|
196
|
+
it("lets one external control drive several fields", async () => {
|
|
197
|
+
const Form = () => {
|
|
198
|
+
const [visible, setVisible] = useState(false)
|
|
199
|
+
return (
|
|
200
|
+
<>
|
|
201
|
+
<PasswordInput visible={visible} hideToggle placeholder="a" />
|
|
202
|
+
<PasswordInput visible={visible} hideToggle placeholder="b" />
|
|
203
|
+
<input
|
|
204
|
+
type="checkbox"
|
|
205
|
+
aria-label="show"
|
|
206
|
+
onChange={(e) => setVisible(e.target.checked)}
|
|
207
|
+
/>
|
|
208
|
+
</>
|
|
209
|
+
)
|
|
210
|
+
}
|
|
211
|
+
render(<Form />)
|
|
212
|
+
fireEvent.click(screen.getByLabelText("show"))
|
|
213
|
+
await waitFor(() => {
|
|
214
|
+
expect((screen.getByPlaceholderText("a") as HTMLInputElement).type).toBe("text")
|
|
215
|
+
expect((screen.getByPlaceholderText("b") as HTMLInputElement).type).toBe("text")
|
|
216
|
+
})
|
|
217
|
+
})
|
|
218
|
+
|
|
219
|
+
it("renders `renderToggle` content inside the kit's button", async () => {
|
|
220
|
+
render(<PasswordInput renderToggle={(visible) => (visible ? "hide" : "show")} />)
|
|
221
|
+
await ready()
|
|
222
|
+
const trigger = screen.getByRole("button")
|
|
223
|
+
expect(trigger.textContent).toBe("show")
|
|
224
|
+
expect(trigger.getAttribute("aria-controls")).toBeTruthy()
|
|
225
|
+
fireEvent.pointerDown(trigger)
|
|
226
|
+
await waitFor(() => expect(trigger.textContent).toBe("hide"))
|
|
227
|
+
expect(getInput().type).toBe("text")
|
|
228
|
+
})
|
|
229
|
+
|
|
230
|
+
it("renders no button with `hideToggle`", () => {
|
|
231
|
+
render(<PasswordInput hideToggle />)
|
|
232
|
+
expect(screen.queryByRole("button")).toBeNull()
|
|
233
|
+
})
|
|
234
|
+
|
|
235
|
+
describe("Label in Name (WCAG 2.5.3) with a text `renderToggle`", () => {
|
|
236
|
+
const text = (visible: boolean) => (visible ? "Masquer" : "Afficher")
|
|
237
|
+
|
|
238
|
+
it("names the button from `translations`, so it can contain the visible text", async () => {
|
|
239
|
+
render(
|
|
240
|
+
<PasswordInput
|
|
241
|
+
renderToggle={text}
|
|
242
|
+
translations={{
|
|
243
|
+
visibilityTrigger: (visible) =>
|
|
244
|
+
visible ? "Masquer le mot de passe" : "Afficher le mot de passe",
|
|
245
|
+
}}
|
|
246
|
+
/>,
|
|
247
|
+
)
|
|
248
|
+
await ready()
|
|
249
|
+
const trigger = screen.getByRole("button", { name: "Afficher le mot de passe" })
|
|
250
|
+
expect(trigger.textContent).toBe("Afficher")
|
|
251
|
+
})
|
|
252
|
+
|
|
253
|
+
it("warns in dev when the label doesn't contain the visible text", async () => {
|
|
254
|
+
const warn = vi.spyOn(console, "warn").mockImplementation(() => {})
|
|
255
|
+
render(<PasswordInput renderToggle={text} />)
|
|
256
|
+
await ready()
|
|
257
|
+
expect(warn).toHaveBeenCalledWith(expect.stringContaining('the text "Afficher"'))
|
|
258
|
+
expect(warn).toHaveBeenCalledWith(expect.stringContaining('"Show password"'))
|
|
259
|
+
warn.mockRestore()
|
|
260
|
+
})
|
|
261
|
+
|
|
262
|
+
it("stays quiet when the label contains it, and for icon-only content", async () => {
|
|
263
|
+
const warn = vi.spyOn(console, "warn").mockImplementation(() => {})
|
|
264
|
+
render(
|
|
265
|
+
<>
|
|
266
|
+
<PasswordInput
|
|
267
|
+
renderToggle={(visible) => (visible ? "Hide" : "Show")}
|
|
268
|
+
placeholder="a"
|
|
269
|
+
/>
|
|
270
|
+
<PasswordInput renderToggle={() => <svg aria-hidden />} placeholder="b" />
|
|
271
|
+
</>,
|
|
272
|
+
)
|
|
273
|
+
await ready()
|
|
274
|
+
expect(warn).not.toHaveBeenCalled()
|
|
275
|
+
warn.mockRestore()
|
|
276
|
+
})
|
|
277
|
+
})
|
|
278
|
+
|
|
279
|
+
it("localizes the button label via `translations`", async () => {
|
|
280
|
+
render(
|
|
281
|
+
<PasswordInput
|
|
282
|
+
translations={{ visibilityTrigger: (visible) => (visible ? "Masquer" : "Afficher") }}
|
|
283
|
+
/>,
|
|
284
|
+
)
|
|
285
|
+
await ready()
|
|
286
|
+
const trigger = screen.getByRole("button", { name: "Afficher" })
|
|
287
|
+
fireEvent.pointerDown(trigger)
|
|
288
|
+
await waitFor(() => expect(trigger.getAttribute("aria-label")).toBe("Masquer"))
|
|
289
|
+
})
|
|
290
|
+
})
|
|
94
291
|
})
|