@42-central/ui-react 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -175
- package/dist/{chunk-FD6P6PLQ.js → chunk-5JHDSVEZ.js} +3 -3
- package/dist/{chunk-FD6P6PLQ.js.map → chunk-5JHDSVEZ.js.map} +1 -1
- package/dist/{chunk-QMW7D5GU.js → chunk-5OQLFX47.js} +4 -3
- package/dist/chunk-5OQLFX47.js.map +1 -0
- package/dist/{chunk-VZ2TPU4B.js → chunk-6GDMSENK.js} +3 -2
- package/dist/chunk-6GDMSENK.js.map +1 -0
- package/dist/{chunk-TNNH3FVQ.js → chunk-6OLTJYSX.js} +24 -8
- package/dist/chunk-6OLTJYSX.js.map +1 -0
- package/dist/{chunk-POKDSVQT.js → chunk-AE7QTLJ5.js} +5 -4
- package/dist/chunk-AE7QTLJ5.js.map +1 -0
- package/dist/{chunk-44OV3PNH.js → chunk-B2YJKRNQ.js} +3 -3
- package/dist/{chunk-44OV3PNH.js.map → chunk-B2YJKRNQ.js.map} +1 -1
- package/dist/{chunk-YIQI2CF3.js → chunk-CTSO6V72.js} +3 -2
- package/dist/chunk-CTSO6V72.js.map +1 -0
- package/dist/{chunk-ACE7FBWE.js → chunk-EBREIC3L.js} +5 -4
- package/dist/chunk-EBREIC3L.js.map +1 -0
- package/dist/{chunk-UNSAA7YG.js → chunk-FHG54IT5.js} +3 -2
- package/dist/chunk-FHG54IT5.js.map +1 -0
- package/dist/{chunk-3GYOIQW7.js → chunk-FZIHZT5R.js} +5 -5
- package/dist/{chunk-3GYOIQW7.js.map → chunk-FZIHZT5R.js.map} +1 -1
- package/dist/{chunk-2H46IXW4.js → chunk-HAQJQFE6.js} +28 -8
- package/dist/chunk-HAQJQFE6.js.map +1 -0
- package/dist/{chunk-IHYFYMHJ.js → chunk-HT5JAHR3.js} +6 -6
- package/dist/{chunk-IHYFYMHJ.js.map → chunk-HT5JAHR3.js.map} +1 -1
- package/dist/chunk-I4SQQIP5.js +12 -0
- package/dist/chunk-I4SQQIP5.js.map +1 -0
- package/dist/{chunk-J3PELDH3.js → chunk-JITF6I7N.js} +22 -6
- package/dist/chunk-JITF6I7N.js.map +1 -0
- package/dist/{chunk-IFWCCAQV.js → chunk-KHMFNH3X.js} +3 -2
- package/dist/chunk-KHMFNH3X.js.map +1 -0
- package/dist/{chunk-SIG4DMNZ.js → chunk-MI2WZRK3.js} +4 -4
- package/dist/{chunk-SIG4DMNZ.js.map → chunk-MI2WZRK3.js.map} +1 -1
- package/dist/{chunk-PJL4ZL5V.js → chunk-O23Y5ML4.js} +8 -8
- package/dist/{chunk-PJL4ZL5V.js.map → chunk-O23Y5ML4.js.map} +1 -1
- package/dist/{chunk-P7A3BCAC.js → chunk-OWG4BCQR.js} +3 -3
- package/dist/{chunk-P7A3BCAC.js.map → chunk-OWG4BCQR.js.map} +1 -1
- package/dist/{chunk-FUWSTUDM.js → chunk-PH354ECN.js} +4 -4
- package/dist/{chunk-FUWSTUDM.js.map → chunk-PH354ECN.js.map} +1 -1
- package/dist/{chunk-U5GW5EBR.js → chunk-RAUOFTUH.js} +12 -20
- package/dist/chunk-RAUOFTUH.js.map +1 -0
- package/dist/{chunk-2762HZYX.js → chunk-S2HWWR2H.js} +47 -25
- package/dist/chunk-S2HWWR2H.js.map +1 -0
- package/dist/{chunk-VLUKI3HL.js → chunk-S7N4LGLZ.js} +6 -13
- package/dist/chunk-S7N4LGLZ.js.map +1 -0
- package/dist/{chunk-TMMEJKLI.js → chunk-UHNRAI6V.js} +17 -4
- package/dist/chunk-UHNRAI6V.js.map +1 -0
- package/dist/{chunk-3NZXWCGF.js → chunk-WHKKN3ZK.js} +6 -6
- package/dist/{chunk-3NZXWCGF.js.map → chunk-WHKKN3ZK.js.map} +1 -1
- package/dist/{chunk-MOI7B3KH.js → chunk-WQN64ZHG.js} +5 -5
- package/dist/{chunk-MOI7B3KH.js.map → chunk-WQN64ZHG.js.map} +1 -1
- package/dist/chunk-WSIVRDRB.js +34 -0
- package/dist/chunk-WSIVRDRB.js.map +1 -0
- package/dist/{chunk-6SWK4XG5.js → chunk-YXE4B6X3.js} +2 -2
- package/dist/chunk-YXE4B6X3.js.map +1 -0
- package/dist/{chunk-NGAQITWP.js → chunk-Z2Z5EXVT.js} +10 -7
- package/dist/chunk-Z2Z5EXVT.js.map +1 -0
- package/dist/{chunk-IXKELBJA.js → chunk-ZDXQ64A7.js} +63 -44
- package/dist/chunk-ZDXQ64A7.js.map +1 -0
- package/dist/components/accordion/accordion-data.d.ts +3 -2
- package/dist/components/accordion/accordion-data.d.ts.map +1 -1
- package/dist/components/accordion/accordion.d.ts +2 -2
- package/dist/components/accordion/accordion.d.ts.map +1 -1
- package/dist/components/accordion/index.js +20 -8
- package/dist/components/accordion/index.js.map +1 -1
- package/dist/components/action-icon/action-icon.d.ts +3 -4
- package/dist/components/action-icon/action-icon.d.ts.map +1 -1
- package/dist/components/action-icon/index.js +2 -1
- package/dist/components/alert/alert.d.ts +18 -10
- package/dist/components/alert/alert.d.ts.map +1 -1
- package/dist/components/alert/index.js +17 -5
- package/dist/components/alert/index.js.map +1 -1
- package/dist/components/app-shell/app-shell.d.ts +3 -2
- package/dist/components/app-shell/app-shell.d.ts.map +1 -1
- package/dist/components/app-shell/index.js +4 -2
- package/dist/components/app-shell/index.js.map +1 -1
- package/dist/components/autocomplete/index.js +5 -4
- package/dist/components/autocomplete/index.js.map +1 -1
- package/dist/components/breadcrumb/breadcrumb.d.ts +3 -2
- package/dist/components/breadcrumb/breadcrumb.d.ts.map +1 -1
- package/dist/components/breadcrumb/index.js +11 -5
- package/dist/components/breadcrumb/index.js.map +1 -1
- package/dist/components/button/button.d.ts +4 -4
- package/dist/components/button/button.d.ts.map +1 -1
- package/dist/components/button/index.js +2 -1
- package/dist/components/button-multi-select/index.js +4 -3
- package/dist/components/button-multi-select/index.js.map +1 -1
- package/dist/components/button-select/index.js +4 -3
- package/dist/components/button-select/index.js.map +1 -1
- package/dist/components/calendar/calendar-body.d.ts.map +1 -1
- package/dist/components/calendar/index.js +3 -2
- package/dist/components/checkbox/index.js +2 -2
- package/dist/components/choice-card-group/index.js +1 -1
- package/dist/components/circular-progress/circular-progress.d.ts +3 -2
- package/dist/components/circular-progress/circular-progress.d.ts.map +1 -1
- package/dist/components/circular-progress/index.js +1 -0
- package/dist/components/circular-progress/index.js.map +1 -1
- package/dist/components/clipboard/clipboard.d.ts +1 -1
- package/dist/components/clipboard/clipboard.d.ts.map +1 -1
- package/dist/components/clipboard/index.js +9 -5
- package/dist/components/clipboard/index.js.map +1 -1
- package/dist/components/code-block/chrome.d.ts +4 -1
- package/dist/components/code-block/chrome.d.ts.map +1 -1
- package/dist/components/code-block/chrome.js +5 -4
- package/dist/components/code-block/code-block.d.ts +7 -1
- package/dist/components/code-block/code-block.d.ts.map +1 -1
- package/dist/components/code-block/index.d.ts +1 -1
- package/dist/components/code-block/index.js +12 -10
- package/dist/components/code-block/index.js.map +1 -1
- package/dist/components/code-block/notation.d.ts +5 -2
- package/dist/components/code-block/notation.d.ts.map +1 -1
- package/dist/components/code-block/static.d.ts +4 -1
- package/dist/components/code-block/static.d.ts.map +1 -1
- package/dist/components/code-block/static.js +5 -4
- package/dist/components/code-block/static.js.map +1 -1
- package/dist/components/collapse/collapse.d.ts +7 -3
- package/dist/components/collapse/collapse.d.ts.map +1 -1
- package/dist/components/collapse/index.js +2 -1
- package/dist/components/combobox/combobox.d.ts +11 -10
- package/dist/components/combobox/combobox.d.ts.map +1 -1
- package/dist/components/combobox/index.js +5 -4
- package/dist/components/combobox-list/index.js +6 -5
- package/dist/components/data-table/index.js +20 -19
- package/dist/components/data-table/index.js.map +1 -1
- package/dist/components/date-picker/index.js +12 -11
- package/dist/components/date-picker/index.js.map +1 -1
- package/dist/components/divider/divider.d.ts +3 -2
- package/dist/components/divider/divider.d.ts.map +1 -1
- package/dist/components/divider/index.js +1 -1
- package/dist/components/drawer/drawer.d.ts +6 -5
- package/dist/components/drawer/drawer.d.ts.map +1 -1
- package/dist/components/drawer/index.js +3 -2
- package/dist/components/field/field.d.ts +7 -4
- package/dist/components/field/field.d.ts.map +1 -1
- package/dist/components/field/index.js +1 -1
- package/dist/components/file-upload/index.js +3 -2
- package/dist/components/file-upload/index.js.map +1 -1
- package/dist/components/hover-card/index.js +1 -1
- package/dist/components/input/index.js +2 -2
- package/dist/components/input/input.d.ts +3 -2
- package/dist/components/input/input.d.ts.map +1 -1
- package/dist/components/menu/index.js +3 -2
- package/dist/components/menu/index.js.map +1 -1
- package/dist/components/menu/menu-data.d.ts +6 -1
- package/dist/components/menu/menu-data.d.ts.map +1 -1
- package/dist/components/menu/menu.d.ts +5 -5
- package/dist/components/menu/menu.d.ts.map +1 -1
- package/dist/components/modal/index.js +3 -2
- package/dist/components/modal/modal.d.ts +4 -3
- package/dist/components/modal/modal.d.ts.map +1 -1
- package/dist/components/multi-combobox-list/index.js +6 -5
- package/dist/components/multi-select/index.js +7 -6
- package/dist/components/multi-select/index.js.map +1 -1
- package/dist/components/nav-link/index.js +3 -2
- package/dist/components/nav-link/tanstack.js +3 -2
- package/dist/components/nav-link/tanstack.js.map +1 -1
- package/dist/components/notification/create-notifier.d.ts.map +1 -1
- package/dist/components/notification/index.js +8 -7
- package/dist/components/notification/index.js.map +1 -1
- package/dist/components/notification/notification.d.ts +7 -6
- package/dist/components/notification/notification.d.ts.map +1 -1
- package/dist/components/number-input/index.js +4 -4
- package/dist/components/overlays/index.js +5 -4
- package/dist/components/overlays/index.js.map +1 -1
- package/dist/components/password-input/index.js +2 -2
- package/dist/components/pill/index.js +2 -1
- package/dist/components/pill/pill.d.ts +4 -2
- package/dist/components/pill/pill.d.ts.map +1 -1
- package/dist/components/pills-input/index.js +5 -4
- package/dist/components/pills-input/pills-input.d.ts +3 -2
- package/dist/components/pills-input/pills-input.d.ts.map +1 -1
- package/dist/components/pin-input/index.js +2 -2
- package/dist/components/popover/index.js +1 -1
- package/dist/components/popover/popover.d.ts +3 -2
- package/dist/components/popover/popover.d.ts.map +1 -1
- package/dist/components/progress/index.js +1 -0
- package/dist/components/progress/index.js.map +1 -1
- package/dist/components/progress/progress.d.ts +3 -2
- package/dist/components/progress/progress.d.ts.map +1 -1
- package/dist/components/radio-group/index.js +1 -1
- package/dist/components/rating/index.js +2 -1
- package/dist/components/rating/index.js.map +1 -1
- package/dist/components/rating/rating.d.ts +3 -2
- package/dist/components/rating/rating.d.ts.map +1 -1
- package/dist/components/schedule/index.d.ts +4 -4
- package/dist/components/schedule/index.js +211 -110
- package/dist/components/schedule/index.js.map +1 -1
- package/dist/components/schedule/schedule-agenda-list.d.ts +6 -7
- package/dist/components/schedule/schedule-agenda-list.d.ts.map +1 -1
- package/dist/components/schedule/schedule-agenda-view.d.ts +19 -16
- package/dist/components/schedule/schedule-agenda-view.d.ts.map +1 -1
- package/dist/components/schedule/schedule-create-draft.d.ts +3 -2
- package/dist/components/schedule/schedule-create-draft.d.ts.map +1 -1
- package/dist/components/schedule/schedule-dates.d.ts.map +1 -1
- package/dist/components/schedule/schedule-days-view.d.ts +3 -2
- package/dist/components/schedule/schedule-days-view.d.ts.map +1 -1
- package/dist/components/schedule/schedule-drag-ghost.d.ts +12 -5
- package/dist/components/schedule/schedule-drag-ghost.d.ts.map +1 -1
- package/dist/components/schedule/schedule-event-chip.d.ts.map +1 -1
- package/dist/components/schedule/schedule-geometry.d.ts +16 -0
- package/dist/components/schedule/schedule-geometry.d.ts.map +1 -1
- package/dist/components/schedule/schedule-grid-gesture.d.ts +29 -6
- package/dist/components/schedule/schedule-grid-gesture.d.ts.map +1 -1
- package/dist/components/schedule/schedule-month-view.d.ts +3 -2
- package/dist/components/schedule/schedule-month-view.d.ts.map +1 -1
- package/dist/components/schedule/schedule-next-up.d.ts +4 -3
- package/dist/components/schedule/schedule-next-up.d.ts.map +1 -1
- package/dist/components/schedule/schedule-timed-grid.d.ts.map +1 -1
- package/dist/components/schedule/schedule-toolbar.d.ts +3 -3
- package/dist/components/schedule/schedule-toolbar.d.ts.map +1 -1
- package/dist/components/schedule/schedule-types.d.ts +9 -4
- package/dist/components/schedule/schedule-types.d.ts.map +1 -1
- package/dist/components/schedule/schedule-views.d.ts +2 -2
- package/dist/components/schedule/schedule-views.d.ts.map +1 -1
- package/dist/components/schedule/schedule-year-view.d.ts +3 -2
- package/dist/components/schedule/schedule-year-view.d.ts.map +1 -1
- package/dist/components/schedule/schedule.d.ts +9 -6
- package/dist/components/schedule/schedule.d.ts.map +1 -1
- package/dist/components/schedule/use-event-create.d.ts.map +1 -1
- package/dist/components/schedule/use-event-drag.d.ts.map +1 -1
- package/dist/components/schedule/use-event-resize.d.ts.map +1 -1
- package/dist/components/segment-group/index.js +2 -2
- package/dist/components/select/index.js +4 -4
- package/dist/components/slider/index.js +2 -1
- package/dist/components/slider/index.js.map +1 -1
- package/dist/components/slider/slider.d.ts +3 -2
- package/dist/components/slider/slider.d.ts.map +1 -1
- package/dist/components/switch/index.js +1 -1
- package/dist/components/tabs/index.js +1 -1
- package/dist/components/tabs/tabs-data.d.ts +3 -2
- package/dist/components/tabs/tabs-data.d.ts.map +1 -1
- package/dist/components/tags-input/index.js +6 -5
- package/dist/components/tags-input/index.js.map +1 -1
- package/dist/components/text-input/index.js +2 -2
- package/dist/components/textarea/index.js +2 -2
- package/dist/components/time-input/index.js +6 -6
- package/dist/components/timeline/index.js +8 -5
- package/dist/components/timeline/index.js.map +1 -1
- package/dist/components/timeline/timeline.d.ts +1 -1
- package/dist/components/timeline/timeline.d.ts.map +1 -1
- package/dist/components/tooltip/index.js +1 -1
- package/dist/components/tooltip/tooltip.d.ts +2 -1
- package/dist/components/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/tree-multi-select/index.js +6 -5
- package/dist/components/tree-multi-select/index.js.map +1 -1
- package/dist/components/tree-select/index.js +3 -3
- package/dist/lib/as-child.d.ts +104 -0
- package/dist/lib/as-child.d.ts.map +1 -0
- package/dist/theme.css +9 -3
- package/package.json +1 -1
- package/src/as-child.contract.test.tsx +809 -0
- package/src/components/accordion/accordion-data.tsx +8 -5
- package/src/components/accordion/accordion.test.tsx +40 -0
- package/src/components/accordion/accordion.tsx +23 -6
- package/src/components/action-icon/action-icon.tsx +9 -24
- package/src/components/alert/alert.test.tsx +25 -2
- package/src/components/alert/alert.tsx +39 -13
- package/src/components/app-shell/app-shell.tsx +3 -1
- package/src/components/breadcrumb/breadcrumb.test.tsx +30 -0
- package/src/components/breadcrumb/breadcrumb.tsx +21 -12
- package/src/components/button/button.tsx +21 -50
- package/src/components/calendar/calendar-body.tsx +8 -1
- package/src/components/circular-progress/circular-progress.tsx +4 -1
- package/src/components/clipboard/clipboard.test.tsx +18 -0
- package/src/components/clipboard/clipboard.tsx +8 -2
- package/src/components/code-block/chrome.tsx +60 -36
- package/src/components/code-block/code-block.test.tsx +27 -0
- package/src/components/code-block/code-block.tsx +13 -3
- package/src/components/code-block/notation.test.ts +8 -0
- package/src/components/code-block/notation.ts +6 -3
- package/src/components/code-block/static.tsx +8 -2
- package/src/components/collapse/collapse.tsx +33 -15
- package/src/components/combobox/combobox.test.tsx +38 -0
- package/src/components/combobox/combobox.tsx +24 -10
- package/src/components/divider/divider.tsx +3 -1
- package/src/components/drawer/drawer.tsx +37 -16
- package/src/components/field/field.tsx +7 -3
- package/src/components/input/input.tsx +3 -1
- package/src/components/menu/menu-data.tsx +8 -1
- package/src/components/menu/menu.test.tsx +52 -0
- package/src/components/menu/menu.tsx +83 -35
- package/src/components/modal/close-trigger.test.tsx +38 -0
- package/src/components/modal/modal.tsx +29 -13
- package/src/components/notification/create-notifier.tsx +6 -5
- package/src/components/notification/notification.test.tsx +15 -0
- package/src/components/notification/notification.tsx +8 -5
- package/src/components/pill/pill.tsx +29 -20
- package/src/components/pills-input/pills-input.tsx +3 -1
- package/src/components/popover/popover.tsx +3 -1
- package/src/components/progress/progress.tsx +4 -1
- package/src/components/rating/rating.tsx +27 -23
- package/src/components/schedule/index.ts +1 -1
- package/src/components/schedule/now-cursor-line.tsx +1 -1
- package/src/components/schedule/schedule-agenda-list.tsx +6 -7
- package/src/components/schedule/schedule-agenda-view.test.tsx +105 -28
- package/src/components/schedule/schedule-agenda-view.tsx +46 -31
- package/src/components/schedule/schedule-all-day-row.tsx +1 -1
- package/src/components/schedule/schedule-create-draft.tsx +14 -5
- package/src/components/schedule/schedule-dates.test.ts +37 -52
- package/src/components/schedule/schedule-dates.ts +25 -27
- package/src/components/schedule/schedule-days-view.tsx +9 -5
- package/src/components/schedule/schedule-drag-ghost.tsx +27 -12
- package/src/components/schedule/schedule-event-chip.tsx +9 -2
- package/src/components/schedule/schedule-event-list-popover-content.tsx +1 -1
- package/src/components/schedule/schedule-geometry.ts +21 -0
- package/src/components/schedule/schedule-grid-gesture.test.ts +83 -1
- package/src/components/schedule/schedule-grid-gesture.ts +67 -28
- package/src/components/schedule/schedule-month-view.tsx +10 -6
- package/src/components/schedule/schedule-next-up.tsx +11 -5
- package/src/components/schedule/schedule-timed-grid.tsx +41 -3
- package/src/components/schedule/schedule-toolbar.test.tsx +26 -0
- package/src/components/schedule/schedule-toolbar.tsx +35 -17
- package/src/components/schedule/schedule-types.ts +9 -4
- package/src/components/schedule/schedule-views.ts +4 -5
- package/src/components/schedule/schedule-year-view.tsx +10 -6
- package/src/components/schedule/schedule.test.tsx +198 -36
- package/src/components/schedule/schedule.tsx +28 -17
- package/src/components/schedule/use-event-create.ts +7 -6
- package/src/components/schedule/use-event-drag.ts +10 -4
- package/src/components/schedule/use-event-resize.ts +4 -2
- package/src/components/slider/slider.tsx +4 -0
- package/src/components/tabs/tabs-data.tsx +17 -14
- package/src/components/timeline/timeline.tsx +102 -95
- package/src/components/tooltip/tooltip.tsx +2 -1
- package/src/lib/as-child.test.tsx +70 -0
- package/src/lib/as-child.ts +119 -0
- package/src/theme.css +9 -3
- package/dist/chunk-2762HZYX.js.map +0 -1
- package/dist/chunk-2H46IXW4.js.map +0 -1
- package/dist/chunk-6SWK4XG5.js.map +0 -1
- package/dist/chunk-ACE7FBWE.js.map +0 -1
- package/dist/chunk-HWNPXAEN.js +0 -31
- package/dist/chunk-HWNPXAEN.js.map +0 -1
- package/dist/chunk-IFWCCAQV.js.map +0 -1
- package/dist/chunk-IXKELBJA.js.map +0 -1
- package/dist/chunk-J3PELDH3.js.map +0 -1
- package/dist/chunk-NGAQITWP.js.map +0 -1
- package/dist/chunk-POKDSVQT.js.map +0 -1
- package/dist/chunk-QMW7D5GU.js.map +0 -1
- package/dist/chunk-TMMEJKLI.js.map +0 -1
- package/dist/chunk-TNNH3FVQ.js.map +0 -1
- package/dist/chunk-U5GW5EBR.js.map +0 -1
- package/dist/chunk-UNSAA7YG.js.map +0 -1
- package/dist/chunk-VLUKI3HL.js.map +0 -1
- package/dist/chunk-VZ2TPU4B.js.map +0 -1
- package/dist/chunk-YIQI2CF3.js.map +0 -1
|
@@ -89,6 +89,46 @@ describe("ScheduleRoot — text direction", () => {
|
|
|
89
89
|
})
|
|
90
90
|
})
|
|
91
91
|
|
|
92
|
+
describe("ScheduleRoot — IntlProvider", () => {
|
|
93
|
+
const title = () => document.querySelector('[data-schedule-part="toolbar-title"]')?.textContent
|
|
94
|
+
|
|
95
|
+
it("formats with the provider's locale", () => {
|
|
96
|
+
render(
|
|
97
|
+
<IntlProvider locale="fr-FR">
|
|
98
|
+
<ScheduleRoot data={[]} now={NOW} timeZone="UTC" />
|
|
99
|
+
</IntlProvider>,
|
|
100
|
+
)
|
|
101
|
+
expect(title()).toContain("janv.")
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
it("defaults to en-US without a provider, never the host's locale", () => {
|
|
105
|
+
render(<ScheduleRoot data={[]} now={NOW} timeZone="UTC" />)
|
|
106
|
+
expect(title()).toContain("Jan")
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
it("lets its own locale prop win over the provider", () => {
|
|
110
|
+
render(
|
|
111
|
+
<IntlProvider locale="fr-FR">
|
|
112
|
+
<ScheduleRoot data={[]} now={NOW} timeZone="UTC" locale="en-US" />
|
|
113
|
+
</IntlProvider>,
|
|
114
|
+
)
|
|
115
|
+
expect(title()).toContain("Jan")
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
it("resolves dates in the provider's time zone", () => {
|
|
119
|
+
// Sunday 03:00 UTC is still Saturday evening in Los Angeles, so the week
|
|
120
|
+
// view opens on the week that Saturday closes — where the host (UTC in CI,
|
|
121
|
+
// Paris locally) would already be on the next one.
|
|
122
|
+
const sundayMorning = day(2026, 0, 18, 3)
|
|
123
|
+
render(
|
|
124
|
+
<IntlProvider timeZone="America/Los_Angeles">
|
|
125
|
+
<ScheduleRoot data={[]} now={sundayMorning} />
|
|
126
|
+
</IntlProvider>,
|
|
127
|
+
)
|
|
128
|
+
expect(title()).toBe("Jan 11 – 17, 2026")
|
|
129
|
+
})
|
|
130
|
+
})
|
|
131
|
+
|
|
92
132
|
describe("ScheduleRoot — view switching", () => {
|
|
93
133
|
it("switches to Month view on its tab and back to Week", async () => {
|
|
94
134
|
render(<ScheduleRoot data={[]} now={NOW} timeZone="UTC" />)
|
|
@@ -1770,6 +1810,35 @@ describe("ScheduleRoot — keyboard day move", () => {
|
|
|
1770
1810
|
)
|
|
1771
1811
|
})
|
|
1772
1812
|
|
|
1813
|
+
// Days run right-to-left under an RTL locale, so the arrow keys follow the
|
|
1814
|
+
// columns: Left is the next day, Right the previous one.
|
|
1815
|
+
it.each([
|
|
1816
|
+
["ArrowLeft", 16],
|
|
1817
|
+
["ArrowRight", 14],
|
|
1818
|
+
])("mirrors %s under an rtl locale", (key, date) => {
|
|
1819
|
+
const onEventChange = vi.fn()
|
|
1820
|
+
render(
|
|
1821
|
+
<div dir="rtl">
|
|
1822
|
+
<IntlProvider locale="ar">
|
|
1823
|
+
<ScheduleRoot
|
|
1824
|
+
data={EVENTS}
|
|
1825
|
+
now={NOW}
|
|
1826
|
+
timeZone="UTC"
|
|
1827
|
+
editable={["drag"]}
|
|
1828
|
+
onEventChange={onEventChange}
|
|
1829
|
+
/>
|
|
1830
|
+
</IntlProvider>
|
|
1831
|
+
</div>,
|
|
1832
|
+
)
|
|
1833
|
+
fireEvent.keyDown(screen.getByTestId("e1"), { key })
|
|
1834
|
+
|
|
1835
|
+
expect(onEventChange).toHaveBeenCalledWith(
|
|
1836
|
+
expect.objectContaining({ id: "e1" }),
|
|
1837
|
+
{ start: day(2026, 0, date, 9), end: day(2026, 0, date, 9, 30) },
|
|
1838
|
+
"drag",
|
|
1839
|
+
)
|
|
1840
|
+
})
|
|
1841
|
+
|
|
1773
1842
|
it("ignores Shift on a day move — one press is one day", () => {
|
|
1774
1843
|
const onEventChange = vi.fn()
|
|
1775
1844
|
renderChip(onEventChange)
|
|
@@ -2193,8 +2262,12 @@ describe("ScheduleRoot — cross-day create", () => {
|
|
|
2193
2262
|
index
|
|
2194
2263
|
] as HTMLElement
|
|
2195
2264
|
|
|
2265
|
+
/** A create/resize draft piece is keyed by its own column, so the pool's
|
|
2266
|
+
* slot `index` is always the piece drawn over day column `index`. */
|
|
2196
2267
|
const draftIn = (index: number) =>
|
|
2197
|
-
|
|
2268
|
+
document.querySelectorAll<HTMLElement>("[data-schedule-part='create-draft']")[
|
|
2269
|
+
index
|
|
2270
|
+
] as HTMLElement
|
|
2198
2271
|
|
|
2199
2272
|
it("commits one continuous range when the drag ends over a later column", () => {
|
|
2200
2273
|
const onEventCreate = vi.fn()
|
|
@@ -2598,9 +2671,9 @@ describe("ScheduleRoot — cross-day resize", () => {
|
|
|
2598
2671
|
.querySelectorAll<HTMLElement>("[data-schedule-part='resize-handle']")[1] as HTMLElement
|
|
2599
2672
|
|
|
2600
2673
|
const draftIn = (index: number) =>
|
|
2601
|
-
document
|
|
2602
|
-
|
|
2603
|
-
|
|
2674
|
+
document.querySelectorAll<HTMLElement>("[data-schedule-part='create-draft']")[
|
|
2675
|
+
index
|
|
2676
|
+
] as HTMLElement
|
|
2604
2677
|
|
|
2605
2678
|
it("carries the dragged edge onto another day", () => {
|
|
2606
2679
|
const onEventChange = vi.fn()
|
|
@@ -2955,19 +3028,27 @@ describe("ScheduleRoot — drag preview across a day boundary", () => {
|
|
|
2955
3028
|
}
|
|
2956
3029
|
}
|
|
2957
3030
|
|
|
2958
|
-
/**
|
|
2959
|
-
*
|
|
2960
|
-
*
|
|
3031
|
+
/** Every pooled ghost piece. There is one per rendered day, so a move that
|
|
3032
|
+
* spans two days can draw both of its pieces — but a piece is keyed by its
|
|
3033
|
+
* offset from the pointer's column, not by the column it is drawn over. */
|
|
3034
|
+
const ghosts = () => [
|
|
3035
|
+
...document.querySelectorAll<HTMLElement>("[data-schedule-part='drag-ghost']"),
|
|
3036
|
+
]
|
|
3037
|
+
|
|
3038
|
+
/** The active ghost piece drawn over day column `index`. */
|
|
2961
3039
|
const ghostIn = (index: number) =>
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
3040
|
+
ghosts().find(
|
|
3041
|
+
(el) =>
|
|
3042
|
+
el.dataset["active"] === "true" &&
|
|
3043
|
+
el.style.getPropertyValue("--sch-ghost-col") === `${index}`,
|
|
3044
|
+
) as HTMLElement
|
|
2965
3045
|
|
|
3046
|
+
/** The day columns the active ghost pieces are drawn over, ascending. */
|
|
2966
3047
|
const activeGhosts = () =>
|
|
2967
|
-
|
|
2968
|
-
.
|
|
2969
|
-
.
|
|
2970
|
-
.
|
|
3048
|
+
ghosts()
|
|
3049
|
+
.filter((el) => el.dataset["active"] === "true")
|
|
3050
|
+
.map((el) => Number(el.style.getPropertyValue("--sch-ghost-col")))
|
|
3051
|
+
.sort((a, b) => a - b)
|
|
2971
3052
|
|
|
2972
3053
|
const renderGrid = (data: ScheduleEvent[] = EVENTS) => {
|
|
2973
3054
|
HTMLElement.prototype.setPointerCapture = vi.fn()
|
|
@@ -3021,6 +3102,43 @@ describe("ScheduleRoot — drag preview across a day boundary", () => {
|
|
|
3021
3102
|
fireEvent.pointerUp(chip, { clientX: 450, clientY: 1080 + 885 * 2, pointerId: 1 })
|
|
3022
3103
|
})
|
|
3023
3104
|
|
|
3105
|
+
it("keeps the same ghost element when the move changes day", () => {
|
|
3106
|
+
// One element per column made every day change a fade-out on one piece and
|
|
3107
|
+
// a fade-in on another. Keyed by its offset from the pointer, the piece
|
|
3108
|
+
// the user holds stays one element and only its column var changes — the
|
|
3109
|
+
// property its `inset-inline-start` transition slides on.
|
|
3110
|
+
renderGrid()
|
|
3111
|
+
const chip = screen.getByTestId("e1") // Thu Jan 15, 09:00 — column 4
|
|
3112
|
+
fireEvent.pointerDown(chip, { clientX: 450, clientY: 1080, pointerId: 1, button: 0 })
|
|
3113
|
+
layOutColumns()
|
|
3114
|
+
fireEvent.pointerMove(chip, { clientX: 450, clientY: 1100, pointerId: 1 })
|
|
3115
|
+
const held = ghostIn(4)
|
|
3116
|
+
expect(held).toBeDefined()
|
|
3117
|
+
|
|
3118
|
+
fireEvent.pointerMove(chip, { clientX: 650, clientY: 1100, pointerId: 1 })
|
|
3119
|
+
expect(activeGhosts()).toEqual([6])
|
|
3120
|
+
expect(ghostIn(6)).toBe(held)
|
|
3121
|
+
|
|
3122
|
+
fireEvent.pointerUp(chip, { clientX: 650, clientY: 1100, pointerId: 1 })
|
|
3123
|
+
})
|
|
3124
|
+
|
|
3125
|
+
it("slides both pieces of a cross-midnight move together", () => {
|
|
3126
|
+
renderGrid()
|
|
3127
|
+
const chip = screen.getByTestId("e1")
|
|
3128
|
+
fireEvent.pointerDown(chip, { clientX: 450, clientY: 1080, pointerId: 1, button: 0 })
|
|
3129
|
+
layOutColumns()
|
|
3130
|
+
fireEvent.pointerMove(chip, { clientX: 450, clientY: 1080 + 885 * 2, pointerId: 1 })
|
|
3131
|
+
const [before, after] = [ghostIn(4), ghostIn(5)]
|
|
3132
|
+
|
|
3133
|
+
// One day earlier: the pair lands on Wed/Thu, each piece on its own element.
|
|
3134
|
+
fireEvent.pointerMove(chip, { clientX: 350, clientY: 1080 + 885 * 2, pointerId: 1 })
|
|
3135
|
+
expect(activeGhosts()).toEqual([3, 4])
|
|
3136
|
+
expect(ghostIn(3)).toBe(before)
|
|
3137
|
+
expect(ghostIn(4)).toBe(after)
|
|
3138
|
+
|
|
3139
|
+
fireEvent.pointerUp(chip, { clientX: 350, clientY: 1080 + 885 * 2, pointerId: 1 })
|
|
3140
|
+
})
|
|
3141
|
+
|
|
3024
3142
|
it("paints into the live band, not the copy a page turn is animating out", () => {
|
|
3025
3143
|
// The outgoing band a page turn keeps mounted is a full second set of
|
|
3026
3144
|
// columns carrying the *same* `data-day-index` values, later in the DOM —
|
|
@@ -3526,6 +3644,7 @@ describe("ScheduleRoot — several selected chips", () => {
|
|
|
3526
3644
|
views={["days", "agenda"]}
|
|
3527
3645
|
view="agenda"
|
|
3528
3646
|
selected={["offer:before", "offer:after"]}
|
|
3647
|
+
withEventDetails
|
|
3529
3648
|
/>,
|
|
3530
3649
|
)
|
|
3531
3650
|
const rows = document.querySelectorAll('[data-schedule-part="agenda-event"][data-selected]')
|
|
@@ -3738,20 +3857,30 @@ describe("ScheduleRoot — the agenda view", () => {
|
|
|
3738
3857
|
),
|
|
3739
3858
|
).map((el) => el.dataset["eventId"])
|
|
3740
3859
|
|
|
3860
|
+
// "Today" is Tue 15 Sep, so the default 7-day window is 15–21 Sep: one
|
|
3861
|
+
// event in it, one the week after, and one earlier in the same month that a
|
|
3862
|
+
// month window would have listed first.
|
|
3741
3863
|
const SEPT: ScheduleEvent[] = [
|
|
3742
3864
|
{
|
|
3743
3865
|
kind: "event",
|
|
3744
|
-
id: "
|
|
3745
|
-
title: "
|
|
3746
|
-
start: day(2026, 8,
|
|
3747
|
-
end: day(2026, 8,
|
|
3866
|
+
id: "this-week",
|
|
3867
|
+
title: "Planning",
|
|
3868
|
+
start: day(2026, 8, 16, 9),
|
|
3869
|
+
end: day(2026, 8, 16, 10),
|
|
3748
3870
|
},
|
|
3749
3871
|
{
|
|
3750
3872
|
kind: "event",
|
|
3751
|
-
id: "
|
|
3752
|
-
title: "
|
|
3753
|
-
start: day(2026,
|
|
3754
|
-
end: day(2026,
|
|
3873
|
+
id: "next-week",
|
|
3874
|
+
title: "Retro",
|
|
3875
|
+
start: day(2026, 8, 23, 9),
|
|
3876
|
+
end: day(2026, 8, 23, 10),
|
|
3877
|
+
},
|
|
3878
|
+
{
|
|
3879
|
+
kind: "event",
|
|
3880
|
+
id: "last-week",
|
|
3881
|
+
title: "Kickoff",
|
|
3882
|
+
start: day(2026, 8, 10, 9),
|
|
3883
|
+
end: day(2026, 8, 10, 10),
|
|
3755
3884
|
},
|
|
3756
3885
|
]
|
|
3757
3886
|
const SEPT_NOW = day(2026, 8, 15, 12)
|
|
@@ -3762,7 +3891,7 @@ describe("ScheduleRoot — the agenda view", () => {
|
|
|
3762
3891
|
expect(tabNames()).toEqual(["Week", "Agenda", "Month"])
|
|
3763
3892
|
})
|
|
3764
3893
|
|
|
3765
|
-
it("renders the agenda, titled
|
|
3894
|
+
it("renders the agenda from today, titled by its range", () => {
|
|
3766
3895
|
render(
|
|
3767
3896
|
<ScheduleRoot
|
|
3768
3897
|
data={SEPT}
|
|
@@ -3773,11 +3902,25 @@ describe("ScheduleRoot — the agenda view", () => {
|
|
|
3773
3902
|
/>,
|
|
3774
3903
|
)
|
|
3775
3904
|
expect(agenda()).not.toBeNull()
|
|
3776
|
-
expect(title()).toBe("
|
|
3777
|
-
expect(rowIds()).toEqual(["
|
|
3905
|
+
expect(title()).toBe("15 – 21 Sept 2026")
|
|
3906
|
+
expect(rowIds()).toEqual(["this-week"])
|
|
3778
3907
|
})
|
|
3779
3908
|
|
|
3780
|
-
it("
|
|
3909
|
+
it("takes its span from an entry's own visibleDays", () => {
|
|
3910
|
+
render(
|
|
3911
|
+
<ScheduleRoot
|
|
3912
|
+
data={SEPT}
|
|
3913
|
+
now={SEPT_NOW}
|
|
3914
|
+
timeZone="UTC"
|
|
3915
|
+
locale="en-GB"
|
|
3916
|
+
views={[{ id: "agenda", visibleDays: 14 }]}
|
|
3917
|
+
/>,
|
|
3918
|
+
)
|
|
3919
|
+
expect(title()).toBe("15 – 28 Sept 2026")
|
|
3920
|
+
expect(rowIds()).toEqual(["this-week", "next-week"])
|
|
3921
|
+
})
|
|
3922
|
+
|
|
3923
|
+
it("steps by its span per Prev/Next from Root's own toolbar", () => {
|
|
3781
3924
|
render(
|
|
3782
3925
|
<ScheduleRoot
|
|
3783
3926
|
data={SEPT}
|
|
@@ -3788,8 +3931,8 @@ describe("ScheduleRoot — the agenda view", () => {
|
|
|
3788
3931
|
/>,
|
|
3789
3932
|
)
|
|
3790
3933
|
fireEvent.click(screen.getByRole("button", { name: "Next" }))
|
|
3791
|
-
expect(title()).toBe("
|
|
3792
|
-
expect(rowIds()).toEqual(["
|
|
3934
|
+
expect(title()).toBe("22 – 28 Sept 2026")
|
|
3935
|
+
expect(rowIds()).toEqual(["next-week"])
|
|
3793
3936
|
})
|
|
3794
3937
|
|
|
3795
3938
|
it("suppresses the view's own pagination chrome", () => {
|
|
@@ -3815,16 +3958,18 @@ describe("ScheduleRoot — the agenda view", () => {
|
|
|
3815
3958
|
'[data-schedule-part="agenda-event-trigger"]',
|
|
3816
3959
|
)
|
|
3817
3960
|
if (control) fireEvent.click(control)
|
|
3818
|
-
expect(onSelect).toHaveBeenCalledWith(expect.objectContaining({ id: "
|
|
3961
|
+
expect(onSelect).toHaveBeenCalledWith(expect.objectContaining({ id: "this-week" }))
|
|
3962
|
+
// Selecting is all a click does here: the row already shows the details.
|
|
3963
|
+
expect(screen.queryByRole("dialog")).toBeNull()
|
|
3819
3964
|
})
|
|
3820
3965
|
|
|
3821
3966
|
/**
|
|
3822
3967
|
* The load-bearing integration: `Root`'s reveal effect asks
|
|
3823
|
-
* `isEventInVisibleRange`, which resolves the agenda's
|
|
3824
|
-
* selection outside
|
|
3825
|
-
*
|
|
3968
|
+
* `isEventInVisibleRange`, which resolves the agenda's own window — so a
|
|
3969
|
+
* selection outside it pages there with no agenda-specific code in `Root`
|
|
3970
|
+
* at all. It is tested precisely *because* nothing implements it.
|
|
3826
3971
|
*/
|
|
3827
|
-
it("pages to a selection outside the current
|
|
3972
|
+
it("pages to a selection outside the current window", () => {
|
|
3828
3973
|
const onDateChange = vi.fn()
|
|
3829
3974
|
render(
|
|
3830
3975
|
<ScheduleRoot
|
|
@@ -3832,14 +3977,31 @@ describe("ScheduleRoot — the agenda view", () => {
|
|
|
3832
3977
|
now={SEPT_NOW}
|
|
3833
3978
|
timeZone="UTC"
|
|
3834
3979
|
views={["agenda"]}
|
|
3835
|
-
selected="
|
|
3980
|
+
selected="next-week"
|
|
3836
3981
|
onDateChange={onDateChange}
|
|
3837
3982
|
/>,
|
|
3838
3983
|
)
|
|
3839
3984
|
expect(onDateChange).toHaveBeenCalledWith(SEPT[1]?.start)
|
|
3840
3985
|
})
|
|
3841
3986
|
|
|
3842
|
-
|
|
3987
|
+
/** Earlier in the same month: a month window used to list it, so this is
|
|
3988
|
+
* the case that changed. */
|
|
3989
|
+
it("pages back to a selection before the window", () => {
|
|
3990
|
+
const onDateChange = vi.fn()
|
|
3991
|
+
render(
|
|
3992
|
+
<ScheduleRoot
|
|
3993
|
+
data={SEPT}
|
|
3994
|
+
now={SEPT_NOW}
|
|
3995
|
+
timeZone="UTC"
|
|
3996
|
+
views={["agenda"]}
|
|
3997
|
+
selected="last-week"
|
|
3998
|
+
onDateChange={onDateChange}
|
|
3999
|
+
/>,
|
|
4000
|
+
)
|
|
4001
|
+
expect(onDateChange).toHaveBeenCalledWith(SEPT[2]?.start)
|
|
4002
|
+
})
|
|
4003
|
+
|
|
4004
|
+
it("leaves the anchor alone for a selection already in the window", () => {
|
|
3843
4005
|
const onDateChange = vi.fn()
|
|
3844
4006
|
render(
|
|
3845
4007
|
<ScheduleRoot
|
|
@@ -3847,7 +4009,7 @@ describe("ScheduleRoot — the agenda view", () => {
|
|
|
3847
4009
|
now={SEPT_NOW}
|
|
3848
4010
|
timeZone="UTC"
|
|
3849
4011
|
views={["agenda"]}
|
|
3850
|
-
selected="
|
|
4012
|
+
selected="this-week"
|
|
3851
4013
|
onDateChange={onDateChange}
|
|
3852
4014
|
/>,
|
|
3853
4015
|
)
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
3
|
import { ark, type HTMLArkProps } from "@ark-ui/react"
|
|
4
|
-
import { getLocalTimeZone } from "@internationalized/date"
|
|
5
4
|
import { type ReactNode, useEffect, useRef } from "react"
|
|
6
5
|
import { match } from "ts-pattern"
|
|
6
|
+
import type { NoAsChild } from "../../lib/as-child"
|
|
7
7
|
import type { AvailableIf, UnavailableProps } from "../../lib/available-if"
|
|
8
8
|
import { cn } from "../../lib/cn"
|
|
9
9
|
import { devWarn } from "../../lib/dev-warn"
|
|
10
|
+
import { useLocale, useTimeZone } from "../../lib/intl"
|
|
10
11
|
import { props } from "../../lib/props"
|
|
11
12
|
import type { WithTestId } from "../../lib/test-id"
|
|
12
13
|
import { useUncontrolled } from "../../lib/use-uncontrolled"
|
|
@@ -91,7 +92,7 @@ const PROP_RENDERERS = {
|
|
|
91
92
|
onOverflowClick: ["days", "month"],
|
|
92
93
|
withOverflowDetails: ["days", "month"],
|
|
93
94
|
renderOverflowDetails: ["days", "month"],
|
|
94
|
-
visibleDays: ["days"],
|
|
95
|
+
visibleDays: ["days", "agenda"],
|
|
95
96
|
revealBehavior: ["days"],
|
|
96
97
|
editable: ["days"],
|
|
97
98
|
onEventChange: ["days"],
|
|
@@ -211,7 +212,7 @@ export type ScheduleProps<
|
|
|
211
212
|
// two intersect into a handler that has to satisfy *both* signatures, so the
|
|
212
213
|
// declaration compiles and every call site fails. The kit already uses this
|
|
213
214
|
// treatment for other redefined natives.
|
|
214
|
-
Omit<HTMLArkProps<"div">, "onSelect"
|
|
215
|
+
NoAsChild<Omit<HTMLArkProps<"div">, "onSelect">> &
|
|
215
216
|
WithTestId &
|
|
216
217
|
// ─── days · month · year ───────────────────────────────────────────────
|
|
217
218
|
AvailableIf<
|
|
@@ -231,6 +232,18 @@ export type ScheduleProps<
|
|
|
231
232
|
ScheduleEmptyProps,
|
|
232
233
|
"requires a days or agenda renderer in `views` — month and year always draw a calendar, so they have no empty state"
|
|
233
234
|
> &
|
|
235
|
+
AvailableIf<
|
|
236
|
+
HasRenderer<V, "days" | "agenda">,
|
|
237
|
+
{
|
|
238
|
+
/** Fallback window size, in days, for the `"days"` and `"agenda"`
|
|
239
|
+
* renderers. Default `7`. An active entry that pins its own
|
|
240
|
+
* `visibleDays` (`"day"` and `"week"` do) overrides this; `"days"` and
|
|
241
|
+
* `"agenda"` deliberately do not, so the two share one span unless an
|
|
242
|
+
* entry says otherwise. */
|
|
243
|
+
visibleDays?: number
|
|
244
|
+
},
|
|
245
|
+
"requires a days or agenda renderer in `views` — month and year draw a whole calendar period, not a span of days"
|
|
246
|
+
> &
|
|
234
247
|
// ─── days · month ──────────────────────────────────────────────────────
|
|
235
248
|
AvailableIf<
|
|
236
249
|
HasRenderer<V, "days" | "month">,
|
|
@@ -267,11 +280,6 @@ export type ScheduleProps<
|
|
|
267
280
|
ScheduleTimedProps<P>,
|
|
268
281
|
"editable" | "onEventChange" | "onEventRemove" | "onEventCreate"
|
|
269
282
|
> & {
|
|
270
|
-
/** Fallback window size, in days, for the `"days"` renderer. Default `7`.
|
|
271
|
-
* An active entry that pins its own `visibleDays` (`"day"` and `"week"`
|
|
272
|
-
* do) overrides this; `"days"` deliberately does not, so this prop keeps
|
|
273
|
-
* working exactly as before under the default entries. */
|
|
274
|
-
visibleDays?: number
|
|
275
283
|
/**
|
|
276
284
|
* How a **reveal** scrolls the days grid — the day brought into view by
|
|
277
285
|
* navigating to it, and the chip brought into view by selecting it.
|
|
@@ -360,10 +368,6 @@ export type ScheduleProps<
|
|
|
360
368
|
* `DaysView`/... has no toolbar row of its own to put it in unless
|
|
361
369
|
* `withPagination` is also on; `Root` always has one. */
|
|
362
370
|
withNowButton?: boolean
|
|
363
|
-
/** Fallback window size, in days, for the `"days"` renderer. Default `7`.
|
|
364
|
-
* An active entry that pins its own `visibleDays` (`"day"` and `"week"`
|
|
365
|
-
* do) overrides this; `"days"` deliberately does not, so this prop keeps
|
|
366
|
-
* working exactly as before under the default entries. */
|
|
367
371
|
}
|
|
368
372
|
|
|
369
373
|
/**
|
|
@@ -387,7 +391,7 @@ type ScheduleAllProps<P = unknown> = ScheduleSharedProps<P> &
|
|
|
387
391
|
ScheduleYearOnlyProps &
|
|
388
392
|
ScheduleAgendaOnlyProps<P> &
|
|
389
393
|
AnchorDateProps &
|
|
390
|
-
Omit<HTMLArkProps<"div">, "onSelect"
|
|
394
|
+
NoAsChild<Omit<HTMLArkProps<"div">, "onSelect">> &
|
|
391
395
|
WithTestId & {
|
|
392
396
|
views?: ScheduleViews
|
|
393
397
|
view?: string
|
|
@@ -421,11 +425,14 @@ export function ScheduleRoot<P = unknown>(allProps: ScheduleAllProps<P>) {
|
|
|
421
425
|
defaultSelected,
|
|
422
426
|
onSelect,
|
|
423
427
|
withSelection = true,
|
|
424
|
-
|
|
428
|
+
// No default here: each renderer owns its own — `true` for the grids,
|
|
429
|
+
// whose chips can't show a description, `false` for the agenda, whose
|
|
430
|
+
// rows already do.
|
|
431
|
+
withEventDetails,
|
|
425
432
|
onDayClick,
|
|
426
433
|
renderEventDetails,
|
|
427
|
-
locale,
|
|
428
|
-
timeZone
|
|
434
|
+
locale: localeProp,
|
|
435
|
+
timeZone: timeZoneProp,
|
|
429
436
|
translations,
|
|
430
437
|
classNames,
|
|
431
438
|
className,
|
|
@@ -467,8 +474,11 @@ export function ScheduleRoot<P = unknown>(allProps: ScheduleAllProps<P>) {
|
|
|
467
474
|
onMonthClick,
|
|
468
475
|
renderEvent,
|
|
469
476
|
testId,
|
|
477
|
+
asChild: _asChild,
|
|
470
478
|
...rest
|
|
471
479
|
} = allProps
|
|
480
|
+
const locale = useLocale(localeProp)
|
|
481
|
+
const timeZone = useTimeZone(timeZoneProp)
|
|
472
482
|
|
|
473
483
|
const [currentDate, setCurrentDate] = useUncontrolled<Date>({
|
|
474
484
|
value: date,
|
|
@@ -738,7 +748,7 @@ export function ScheduleRoot<P = unknown>(allProps: ScheduleAllProps<P>) {
|
|
|
738
748
|
if (
|
|
739
749
|
!isEventInVisibleRange(event, currentView, currentDate, {
|
|
740
750
|
timeZone,
|
|
741
|
-
locale
|
|
751
|
+
locale,
|
|
742
752
|
// The wide `align` value, deliberately un-narrowed: `getVisibleRange`
|
|
743
753
|
// calls `resolveWeekStartDay` itself and the days branch needs the raw
|
|
744
754
|
// `"relative"`.
|
|
@@ -1029,6 +1039,7 @@ export function ScheduleRoot<P = unknown>(allProps: ScheduleAllProps<P>) {
|
|
|
1029
1039
|
withPagination={false}
|
|
1030
1040
|
withNowButton={false}
|
|
1031
1041
|
now={now}
|
|
1042
|
+
visibleDays={activeVisibleDays}
|
|
1032
1043
|
/>
|
|
1033
1044
|
))
|
|
1034
1045
|
.exhaustive()}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
|
+
import { useLocaleContext } from "@ark-ui/react/locale"
|
|
3
4
|
import type { CSSProperties, PointerEvent as ReactPointerEvent } from "react"
|
|
4
5
|
import { useCallback, useRef } from "react"
|
|
5
6
|
import type { ScheduleSlotPredicate } from "../../lib/schedule-predicates"
|
|
@@ -212,6 +213,7 @@ export function useEventCreate({
|
|
|
212
213
|
// them mid-gesture. Note this ref stops updating once a pagination unmounts
|
|
213
214
|
// the owning column — which is exactly why the candidate math below is
|
|
214
215
|
// expressed as an offset from `day`, never as a lookup into a `days` array.
|
|
216
|
+
const { dir } = useLocaleContext()
|
|
215
217
|
const latest = useRef({
|
|
216
218
|
day,
|
|
217
219
|
dayIndex,
|
|
@@ -229,6 +231,7 @@ export function useEventCreate({
|
|
|
229
231
|
onGridClick,
|
|
230
232
|
onPaginate,
|
|
231
233
|
locale,
|
|
234
|
+
dir,
|
|
232
235
|
})
|
|
233
236
|
latest.current = {
|
|
234
237
|
day,
|
|
@@ -247,6 +250,7 @@ export function useEventCreate({
|
|
|
247
250
|
onGridClick,
|
|
248
251
|
onPaginate,
|
|
249
252
|
locale,
|
|
253
|
+
dir,
|
|
250
254
|
}
|
|
251
255
|
|
|
252
256
|
const clearPending = useCallback(() => {
|
|
@@ -348,18 +352,15 @@ export function useEventCreate({
|
|
|
348
352
|
[bandOf, resolveCandidates],
|
|
349
353
|
)
|
|
350
354
|
|
|
351
|
-
/** Drive the shared edge behaviour. Paging remounts every column,
|
|
352
|
-
* draft
|
|
355
|
+
/** Drive the shared edge behaviour. Paging remounts every column, but not
|
|
356
|
+
* the piece pool the draft lives in, so there is nothing to re-collect. */
|
|
353
357
|
const runEdges = useCallback(
|
|
354
358
|
(state: CreateState) => {
|
|
355
359
|
tickEdges(state, {
|
|
356
360
|
paint: () => paint(state),
|
|
357
361
|
isLive: () => stateRef.current === state,
|
|
362
|
+
dir: latest.current.dir,
|
|
358
363
|
onPaginate: (direction) => latest.current.onPaginate?.(direction),
|
|
359
|
-
onAfterPaginate: () => {
|
|
360
|
-
hidePieces(state.drafts, CREATE_DRAFT)
|
|
361
|
-
state.drafts = collectPieces(state.grid, CREATE_DRAFT)
|
|
362
|
-
},
|
|
363
364
|
})
|
|
364
365
|
},
|
|
365
366
|
[paint],
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
|
+
import { useLocaleContext } from "@ark-ui/react/locale"
|
|
3
4
|
import type { PointerEvent as ReactPointerEvent } from "react"
|
|
4
5
|
import { useCallback, useRef } from "react"
|
|
5
6
|
import type { ScheduleSlotPredicate } from "../../lib/schedule-predicates"
|
|
@@ -191,6 +192,7 @@ export function useEventDrag({
|
|
|
191
192
|
// Every value the imperative listeners read, kept fresh without re-binding
|
|
192
193
|
// them mid-gesture (which would drop the listener the browser is currently
|
|
193
194
|
// dispatching to).
|
|
195
|
+
const { dir } = useLocaleContext()
|
|
194
196
|
const latest = useRef({
|
|
195
197
|
event,
|
|
196
198
|
dayIndex,
|
|
@@ -208,6 +210,7 @@ export function useEventDrag({
|
|
|
208
210
|
onEventClick,
|
|
209
211
|
onPaginate,
|
|
210
212
|
locale,
|
|
213
|
+
dir,
|
|
211
214
|
})
|
|
212
215
|
latest.current = {
|
|
213
216
|
event,
|
|
@@ -226,6 +229,7 @@ export function useEventDrag({
|
|
|
226
229
|
onEventClick,
|
|
227
230
|
onPaginate,
|
|
228
231
|
locale,
|
|
232
|
+
dir,
|
|
229
233
|
}
|
|
230
234
|
|
|
231
235
|
/** The snapped candidate a given pointer position would commit to, plus
|
|
@@ -279,7 +283,7 @@ export function useEventDrag({
|
|
|
279
283
|
const paint = useCallback(
|
|
280
284
|
(state: DragState) => {
|
|
281
285
|
const o = latest.current
|
|
282
|
-
const { next, result } = resolveCandidate(state, state.clientX, state.clientY)
|
|
286
|
+
const { next, result, renderedIndex } = resolveCandidate(state, state.clientX, state.clientY)
|
|
283
287
|
setChipsDragging(state.chips, true)
|
|
284
288
|
|
|
285
289
|
// One piece per day, each clipped to that column's own band — the same
|
|
@@ -308,6 +312,10 @@ export function useEventDrag({
|
|
|
308
312
|
},
|
|
309
313
|
],
|
|
310
314
|
totalWindowMinutes: o.totalWindowMinutes,
|
|
315
|
+
// Pieces keyed from the pointer's column: the candidate moves as one,
|
|
316
|
+
// so each piece keeps its element when the day changes and the ghost
|
|
317
|
+
// slides there rather than fading out of one column and into the next.
|
|
318
|
+
anchor: renderedIndex,
|
|
311
319
|
})
|
|
312
320
|
setInvalid(state.chips, !result.ok)
|
|
313
321
|
},
|
|
@@ -323,14 +331,12 @@ export function useEventDrag({
|
|
|
323
331
|
tickEdges(state, {
|
|
324
332
|
paint: () => paint(state),
|
|
325
333
|
isLive: () => dragRef.current === state,
|
|
334
|
+
dir: latest.current.dir,
|
|
326
335
|
onPaginate: (direction) => latest.current.onPaginate?.(direction),
|
|
327
336
|
onAfterPaginate: () => {
|
|
328
337
|
const refreshed = liveChipsFor(state.grid, latest.current.event.id)
|
|
329
338
|
setChipsDragging(state.chips, false)
|
|
330
339
|
state.chips = refreshed
|
|
331
|
-
// The per-column ghosts remounted with the new range too.
|
|
332
|
-
hidePieces(state.ghosts, DRAG_GHOST)
|
|
333
|
-
state.ghosts = collectPieces(state.grid, DRAG_GHOST)
|
|
334
340
|
},
|
|
335
341
|
})
|
|
336
342
|
},
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
|
+
import { useLocaleContext } from "@ark-ui/react/locale"
|
|
3
4
|
import type {
|
|
4
5
|
CSSProperties,
|
|
5
6
|
KeyboardEvent as ReactKeyboardEvent,
|
|
@@ -180,6 +181,7 @@ export function useEventResize({
|
|
|
180
181
|
// them mid-gesture. Stops updating once a pagination unmounts the owning
|
|
181
182
|
// chip — which is why the candidate below is a calendar-day *offset* from
|
|
182
183
|
// `day`, never a lookup into a rendered `days` array.
|
|
184
|
+
const { dir } = useLocaleContext()
|
|
183
185
|
const options = {
|
|
184
186
|
event,
|
|
185
187
|
edge,
|
|
@@ -198,6 +200,7 @@ export function useEventResize({
|
|
|
198
200
|
onEventChange,
|
|
199
201
|
onPaginate,
|
|
200
202
|
locale,
|
|
203
|
+
dir,
|
|
201
204
|
}
|
|
202
205
|
const latest = useRef(options)
|
|
203
206
|
latest.current = options
|
|
@@ -383,10 +386,9 @@ export function useEventResize({
|
|
|
383
386
|
tickEdges(state, {
|
|
384
387
|
paint: () => paint(state),
|
|
385
388
|
isLive: () => resizeRef.current === state,
|
|
389
|
+
dir: latest.current.dir,
|
|
386
390
|
onPaginate: (direction) => latest.current.onPaginate?.(direction),
|
|
387
391
|
onAfterPaginate: () => {
|
|
388
|
-
hidePieces(state.drafts, CREATE_DRAFT)
|
|
389
|
-
state.drafts = collectPieces(state.grid, CREATE_DRAFT)
|
|
390
392
|
setChipsDimmed(state.chips, false)
|
|
391
393
|
const refreshed = liveChipsFor(state.grid, latest.current.event.id)
|
|
392
394
|
state.chips = refreshed
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { Slider as Ark } from "@ark-ui/react/slider"
|
|
4
4
|
import { cva } from "class-variance-authority"
|
|
5
5
|
import type { ComponentPropsWithoutRef, FocusEvent, ReactNode, Ref } from "react"
|
|
6
|
+
import type { ForbidAsChild } from "../../lib/as-child"
|
|
6
7
|
import { cn } from "../../lib/cn"
|
|
7
8
|
import type { Color } from "../../lib/colors"
|
|
8
9
|
import { focusStyles } from "../../lib/focus-styles"
|
|
@@ -191,8 +192,10 @@ export type SliderProps<V extends SliderValue = number> = Pick<
|
|
|
191
192
|
// thumb label (see below), so the Field gets only the surrounding slots.
|
|
192
193
|
"description" | "error" | "required"
|
|
193
194
|
> &
|
|
195
|
+
ForbidAsChild &
|
|
194
196
|
Omit<
|
|
195
197
|
ArkRootProps,
|
|
198
|
+
| "asChild"
|
|
196
199
|
| "value"
|
|
197
200
|
| "defaultValue"
|
|
198
201
|
| "onValueChange"
|
|
@@ -260,6 +263,7 @@ export const Slider = <V extends SliderValue = number>({
|
|
|
260
263
|
className,
|
|
261
264
|
classNames,
|
|
262
265
|
testId,
|
|
266
|
+
asChild: _asChild,
|
|
263
267
|
...rest
|
|
264
268
|
}: SliderProps<V>) => {
|
|
265
269
|
const _showLabel =
|