@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
|
@@ -202,37 +202,31 @@ describe("getVisibleRange", () => {
|
|
|
202
202
|
expect(end.toISOString()).toBe(day(2027, 0, 1).toISOString())
|
|
203
203
|
})
|
|
204
204
|
|
|
205
|
-
it("agenda view
|
|
206
|
-
const { start, end } = getVisibleRange("agenda", day(2026, 6, 15), opts)
|
|
207
|
-
expect(start.toISOString()).toBe(day(2026, 6,
|
|
208
|
-
expect(end.toISOString()).toBe(day(2026,
|
|
205
|
+
it("agenda view starts at the anchor's own day and spans visibleDays", () => {
|
|
206
|
+
const { start, end } = getVisibleRange("agenda", day(2026, 6, 15, 14), opts)
|
|
207
|
+
expect(start.toISOString()).toBe(day(2026, 6, 15).toISOString())
|
|
208
|
+
expect(end.toISOString()).toBe(day(2026, 6, 22).toISOString())
|
|
209
209
|
})
|
|
210
210
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
const agenda = getVisibleRange("agenda", day(2026, 6, 15), opts)
|
|
216
|
-
const month = getVisibleRange("month", day(2026, 6, 15), opts)
|
|
217
|
-
expect(agenda.start.toISOString()).not.toBe(month.start.toISOString())
|
|
218
|
-
expect(agenda.end.toISOString()).not.toBe(month.end.toISOString())
|
|
211
|
+
it("agenda view takes its span from visibleDays", () => {
|
|
212
|
+
const { start, end } = getVisibleRange("agenda", day(2026, 6, 15), { ...opts, visibleDays: 3 })
|
|
213
|
+
expect(start.toISOString()).toBe(day(2026, 6, 15).toISOString())
|
|
214
|
+
expect(end.toISOString()).toBe(day(2026, 6, 18).toISOString())
|
|
219
215
|
})
|
|
220
216
|
|
|
221
|
-
|
|
217
|
+
/** A list is read from its top, so the window never snaps back to a week
|
|
218
|
+
* start — whatever `startOfWeek` says, the anchor's day comes first. */
|
|
219
|
+
it("agenda view ignores startOfWeek", () => {
|
|
222
220
|
const plain = getVisibleRange("agenda", day(2026, 6, 15), opts)
|
|
223
|
-
const fiddled = getVisibleRange("agenda", day(2026, 6, 15), {
|
|
224
|
-
...opts,
|
|
225
|
-
startOfWeek: "mon",
|
|
226
|
-
visibleDays: 3,
|
|
227
|
-
})
|
|
221
|
+
const fiddled = getVisibleRange("agenda", day(2026, 6, 15), { ...opts, startOfWeek: "mon" })
|
|
228
222
|
expect(fiddled.start.toISOString()).toBe(plain.start.toISOString())
|
|
229
223
|
expect(fiddled.end.toISOString()).toBe(plain.end.toISOString())
|
|
230
224
|
})
|
|
231
225
|
|
|
232
|
-
it("agenda view
|
|
233
|
-
const { start, end } = getVisibleRange("agenda", day(2028, 1,
|
|
234
|
-
expect(start.toISOString()).toBe(day(2028, 1,
|
|
235
|
-
expect(end.toISOString()).toBe(day(2028, 2,
|
|
226
|
+
it("agenda view runs across a month end", () => {
|
|
227
|
+
const { start, end } = getVisibleRange("agenda", day(2028, 1, 27), opts)
|
|
228
|
+
expect(start.toISOString()).toBe(day(2028, 1, 27).toISOString())
|
|
229
|
+
expect(end.toISOString()).toBe(day(2028, 2, 5).toISOString())
|
|
236
230
|
})
|
|
237
231
|
})
|
|
238
232
|
|
|
@@ -251,27 +245,18 @@ describe("paginateDate", () => {
|
|
|
251
245
|
expect(paginateDate("year", anchor, 1, { timeZone: TZ }).toISOString()).toBe(
|
|
252
246
|
day(2027, 6, 15).toISOString(),
|
|
253
247
|
)
|
|
254
|
-
expect(paginateDate("agenda", anchor, 1, { timeZone: TZ }).toISOString()).toBe(
|
|
255
|
-
day(2026,
|
|
248
|
+
expect(paginateDate("agenda", anchor, 1, { timeZone: TZ, visibleDays: 7 }).toISOString()).toBe(
|
|
249
|
+
day(2026, 6, 22).toISOString(),
|
|
256
250
|
)
|
|
257
|
-
expect(paginateDate("agenda", anchor, -1, { timeZone: TZ }).toISOString()).toBe(
|
|
258
|
-
day(2026,
|
|
251
|
+
expect(paginateDate("agenda", anchor, -1, { timeZone: TZ, visibleDays: 7 }).toISOString()).toBe(
|
|
252
|
+
day(2026, 6, 8).toISOString(),
|
|
259
253
|
)
|
|
260
254
|
})
|
|
261
255
|
|
|
262
|
-
|
|
263
|
-
* skip February entirely. `@internationalized/date` handles it; this pins
|
|
264
|
-
* that we rely on it. */
|
|
265
|
-
it("clamps an agenda step onto a shorter month", () => {
|
|
266
|
-
expect(paginateDate("agenda", day(2026, 0, 31), 1, { timeZone: TZ }).toISOString()).toBe(
|
|
267
|
-
day(2026, 1, 28).toISOString(),
|
|
268
|
-
)
|
|
269
|
-
})
|
|
270
|
-
|
|
271
|
-
it("steps the agenda exactly as the month view does", () => {
|
|
256
|
+
it("steps the agenda exactly as the days view does", () => {
|
|
272
257
|
const anchor = day(2026, 6, 15)
|
|
273
|
-
expect(paginateDate("agenda", anchor, 1, { timeZone: TZ }).toISOString()).toBe(
|
|
274
|
-
paginateDate("
|
|
258
|
+
expect(paginateDate("agenda", anchor, 1, { timeZone: TZ, visibleDays: 5 }).toISOString()).toBe(
|
|
259
|
+
paginateDate("days", anchor, 1, { timeZone: TZ, visibleDays: 5 }).toISOString(),
|
|
275
260
|
)
|
|
276
261
|
})
|
|
277
262
|
|
|
@@ -526,14 +511,14 @@ describe("formatScheduleTitle", () => {
|
|
|
526
511
|
expect(formatScheduleTitle("days", anchor, { ...opts, visibleDays: 1 })).toBe("July 15, 2026")
|
|
527
512
|
expect(formatScheduleTitle("month", anchor, opts)).toBe("July 2026")
|
|
528
513
|
expect(formatScheduleTitle("year", anchor, opts)).toBe("2026")
|
|
529
|
-
expect(formatScheduleTitle("agenda", anchor, opts)).toBe("July 2026")
|
|
530
514
|
})
|
|
531
515
|
|
|
532
|
-
|
|
516
|
+
/** Days would snap this Wednesday anchor back to Sunday the 12th; the
|
|
517
|
+
* agenda's title names the window it really lists, from the anchor on. */
|
|
518
|
+
it("titles the agenda with its own range, starting at the anchor", () => {
|
|
533
519
|
const anchor = day(2026, 6, 15)
|
|
534
|
-
expect(formatScheduleTitle("agenda", anchor, opts)).toBe(
|
|
535
|
-
|
|
536
|
-
)
|
|
520
|
+
expect(formatScheduleTitle("agenda", anchor, opts)).toBe("Jul 15 – 21, 2026")
|
|
521
|
+
expect(formatScheduleTitle("agenda", anchor, { ...opts, visibleDays: 1 })).toBe("July 15, 2026")
|
|
537
522
|
})
|
|
538
523
|
|
|
539
524
|
it("condenses a same-month 7-day range (the default visibleDays)", () => {
|
|
@@ -750,22 +735,22 @@ describe("isEventInVisibleRange", () => {
|
|
|
750
735
|
|
|
751
736
|
describe("isEventInVisibleRange — agenda", () => {
|
|
752
737
|
const opts = { timeZone: "UTC", locale: "en-US" } as const
|
|
753
|
-
const anchor = new Date(Date.UTC(2026, 8, 15, 12)) //
|
|
738
|
+
const anchor = new Date(Date.UTC(2026, 8, 15, 12)) // Tue 15 Sep → window 15–21 Sep
|
|
754
739
|
const at = (m: number, d: number, h = 0) => new Date(Date.UTC(2026, m, d, h))
|
|
755
740
|
const inAgenda = (start: Date, end: Date) =>
|
|
756
741
|
isEventInVisibleRange({ start, end }, "agenda", anchor, opts)
|
|
757
742
|
|
|
758
|
-
it("sees an event inside the
|
|
759
|
-
expect(inAgenda(at(8,
|
|
760
|
-
expect(inAgenda(at(8,
|
|
743
|
+
it("sees an event inside the window, including earlier on the anchor's day", () => {
|
|
744
|
+
expect(inAgenda(at(8, 15, 9), at(8, 15, 10))).toBe(true)
|
|
745
|
+
expect(inAgenda(at(8, 21, 22), at(8, 21, 23))).toBe(true)
|
|
761
746
|
})
|
|
762
747
|
|
|
763
|
-
it("does not see an event
|
|
764
|
-
expect(inAgenda(at(
|
|
765
|
-
expect(inAgenda(at(
|
|
748
|
+
it("does not see an event before the anchor's day or past the window", () => {
|
|
749
|
+
expect(inAgenda(at(8, 14, 9), at(8, 14, 10))).toBe(false)
|
|
750
|
+
expect(inAgenda(at(8, 22, 9), at(8, 22, 10))).toBe(false)
|
|
766
751
|
})
|
|
767
752
|
|
|
768
|
-
it("sees a multi-day event that only straddles the
|
|
769
|
-
expect(inAgenda(at(
|
|
753
|
+
it("sees a multi-day event that only straddles the window start", () => {
|
|
754
|
+
expect(inAgenda(at(8, 12), at(8, 16))).toBe(true)
|
|
770
755
|
})
|
|
771
756
|
})
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
} from "@internationalized/date"
|
|
11
11
|
import { match } from "ts-pattern"
|
|
12
12
|
import { calendarValueToDate, dateToCalendarValue } from "../../lib/date-value"
|
|
13
|
+
import { DEFAULT_LOCALE } from "../../lib/intl"
|
|
13
14
|
import type { ScheduleSlotPredicate } from "../../lib/schedule-predicates"
|
|
14
15
|
import type {
|
|
15
16
|
FirstDayOfWeek,
|
|
@@ -157,23 +158,19 @@ export function getVisibleRange(view: ScheduleView, date: Date, options: RangeOp
|
|
|
157
158
|
return { start, end }
|
|
158
159
|
})
|
|
159
160
|
.with("agenda", () => {
|
|
160
|
-
//
|
|
161
|
-
//
|
|
162
|
-
//
|
|
163
|
-
//
|
|
164
|
-
//
|
|
165
|
-
// seam day across two consecutive months.
|
|
161
|
+
// A list window that **starts at the anchor itself** and runs
|
|
162
|
+
// `visibleDays` days — `"relative"` Days, never a calendar snap. A list
|
|
163
|
+
// is read top to bottom, so wherever it starts is what the reader sees
|
|
164
|
+
// first: snapping to the 1st of the month (the old window) buried today
|
|
165
|
+
// halfway down and left the Now button with nothing visible to do.
|
|
166
166
|
//
|
|
167
|
-
//
|
|
168
|
-
//
|
|
169
|
-
//
|
|
170
|
-
//
|
|
171
|
-
//
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
const start = midnightOf(startOfMonth(value))
|
|
175
|
-
const end = midnightOf(endOfMonth(value)).add({ days: 1 })
|
|
176
|
-
return { start, end }
|
|
167
|
+
// Still unpadded, and still the one range both "is it in range" and "is
|
|
168
|
+
// it rendered" are asked against: `Root`'s reveal asks
|
|
169
|
+
// `isEventInVisibleRange(event, "agenda", ...)`, a composition over this
|
|
170
|
+
// function, and an event outside it moves the anchor onto that event's
|
|
171
|
+
// own day — so the reveal needs no agenda-specific code.
|
|
172
|
+
const start = midnightOf(value)
|
|
173
|
+
return { start, end: start.add({ days: visibleDays }) }
|
|
177
174
|
})
|
|
178
175
|
.exhaustive()
|
|
179
176
|
|
|
@@ -194,12 +191,12 @@ export function paginateDate(
|
|
|
194
191
|
): Date {
|
|
195
192
|
const value = toZoned(date, options.timeZone)
|
|
196
193
|
const duration = match(view)
|
|
197
|
-
|
|
198
|
-
//
|
|
199
|
-
|
|
194
|
+
// One pattern, not two branches: the agenda's window is a days-window
|
|
195
|
+
// that starts at the anchor, so it steps exactly as Days does.
|
|
196
|
+
.with("days", "agenda", () => ({ days: options.visibleDays ?? 7 }))
|
|
200
197
|
// `@internationalized/date`'s `add({ months: 1 })` clamps Jan 31 to Feb
|
|
201
198
|
// 28/29, so Prev/Next never skips a month.
|
|
202
|
-
.with("month",
|
|
199
|
+
.with("month", () => ({ months: 1 }))
|
|
203
200
|
.with("year", () => ({ years: 1 }))
|
|
204
201
|
.exhaustive()
|
|
205
202
|
const next = direction === 1 ? value.add(duration) : value.subtract(duration)
|
|
@@ -601,17 +598,20 @@ export function formatScheduleTitle(
|
|
|
601
598
|
visibleDays?: number
|
|
602
599
|
},
|
|
603
600
|
): string {
|
|
604
|
-
const { timeZone, locale, startOfWeek, visibleDays } = options
|
|
601
|
+
const { timeZone, locale = DEFAULT_LOCALE, startOfWeek, visibleDays } = options
|
|
605
602
|
return (
|
|
606
603
|
match(view)
|
|
607
|
-
|
|
604
|
+
// The agenda's window is a days-window (see `getVisibleRange`), so its
|
|
605
|
+
// title is the same range label — computed from its own range, which
|
|
606
|
+
// never snaps, rather than Days'.
|
|
607
|
+
.with("days", "agenda", (v) => {
|
|
608
608
|
const days = visibleDays ?? 7
|
|
609
609
|
if (days === 1) {
|
|
610
610
|
return new Intl.DateTimeFormat(locale, { dateStyle: "long", timeZone }).format(date)
|
|
611
611
|
}
|
|
612
|
-
const range = getVisibleRange(
|
|
612
|
+
const range = getVisibleRange(v, date, {
|
|
613
613
|
timeZone,
|
|
614
|
-
locale
|
|
614
|
+
locale,
|
|
615
615
|
startOfWeek,
|
|
616
616
|
visibleDays: days,
|
|
617
617
|
})
|
|
@@ -620,9 +620,7 @@ export function formatScheduleTitle(
|
|
|
620
620
|
.formatRange(range.start, lastDay)
|
|
621
621
|
.normalize("NFKC")
|
|
622
622
|
})
|
|
623
|
-
|
|
624
|
-
// Month's by construction rather than by a copied format object.
|
|
625
|
-
.with("month", "agenda", () =>
|
|
623
|
+
.with("month", () =>
|
|
626
624
|
new Intl.DateTimeFormat(locale, { month: "long", year: "numeric", timeZone }).format(date),
|
|
627
625
|
)
|
|
628
626
|
.with("year", () =>
|
|
@@ -1,10 +1,11 @@
|
|
|
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 { Ref } from "react"
|
|
6
5
|
import { useRef } from "react"
|
|
6
|
+
import type { NoAsChild } from "../../lib/as-child"
|
|
7
7
|
import { cn } from "../../lib/cn"
|
|
8
|
+
import { useLocale, useTimeZone } from "../../lib/intl"
|
|
8
9
|
import { mergeRefs } from "../../lib/merge-refs"
|
|
9
10
|
import { props } from "../../lib/props"
|
|
10
11
|
import type { WithTestId } from "../../lib/test-id"
|
|
@@ -57,7 +58,7 @@ export type DaysViewBaseProps<P = unknown> = ScheduleSharedProps<P> &
|
|
|
57
58
|
// two intersect into a handler that has to satisfy *both* signatures, so the
|
|
58
59
|
// declaration compiles and every call site fails. The kit already uses this
|
|
59
60
|
// treatment for other redefined natives.
|
|
60
|
-
Omit<HTMLArkProps<"div">, "onSelect"
|
|
61
|
+
NoAsChild<Omit<HTMLArkProps<"div">, "onSelect">> &
|
|
61
62
|
WithTestId & {
|
|
62
63
|
/** How many day-columns to show at once. Default `7`. */
|
|
63
64
|
visibleDays?: number
|
|
@@ -108,8 +109,8 @@ export function DaysViewBody<P = unknown>({
|
|
|
108
109
|
withEventDetails = true,
|
|
109
110
|
onDayClick,
|
|
110
111
|
renderEventDetails,
|
|
111
|
-
locale,
|
|
112
|
-
timeZone
|
|
112
|
+
locale: localeProp,
|
|
113
|
+
timeZone: timeZoneProp,
|
|
113
114
|
translations,
|
|
114
115
|
classNames,
|
|
115
116
|
className,
|
|
@@ -145,8 +146,11 @@ export function DaysViewBody<P = unknown>({
|
|
|
145
146
|
gridRef,
|
|
146
147
|
nowRef,
|
|
147
148
|
testId,
|
|
149
|
+
asChild: _asChild,
|
|
148
150
|
...rest
|
|
149
151
|
}: DaysViewBaseProps<P> & ScheduleSlotValues) {
|
|
152
|
+
const locale = useLocale(localeProp)
|
|
153
|
+
const timeZone = useTimeZone(timeZoneProp)
|
|
150
154
|
const [anchorDate, setAnchorDate] = useUncontrolled<Date>({
|
|
151
155
|
value: date,
|
|
152
156
|
defaultValue: defaultDate,
|
|
@@ -164,7 +168,7 @@ export function DaysViewBody<P = unknown>({
|
|
|
164
168
|
const t = resolveScheduleTranslations(translations)
|
|
165
169
|
const range = getVisibleRange("days", anchorDate, {
|
|
166
170
|
timeZone,
|
|
167
|
-
locale
|
|
171
|
+
locale,
|
|
168
172
|
startOfWeek: align,
|
|
169
173
|
visibleDays,
|
|
170
174
|
})
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { cn } from "../../lib/cn"
|
|
2
|
+
import { poolPieceInsets } from "./schedule-geometry"
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* The move-drag preview. Same shape and same geometry as
|
|
5
6
|
* `schedule-create-draft.tsx` — a permanently-mounted, `aria-hidden`,
|
|
6
7
|
* pointer-events-none leaf driven purely by imperative CSS-var writes, never a
|
|
7
|
-
* `useState` re-render per `pointermove` — and, like it,
|
|
8
|
-
*
|
|
8
|
+
* `useState` re-render per `pointermove` — and, like it, pooled: one per
|
|
9
|
+
* rendered day, in a layer laid over the day columns (`piece-pool` in
|
|
10
|
+
* `schedule-timed-grid.tsx`), each placed on its day by `--sch-ghost-col`.
|
|
9
11
|
*
|
|
10
12
|
* It used to be a single element at the grid level, placed by writing
|
|
11
13
|
* `gridColumn`, which needed no horizontal pixel math. That was elegant and it
|
|
@@ -13,11 +15,17 @@ import { cn } from "../../lib/cn"
|
|
|
13
15
|
* days, and one box can only ever draw one of them. Its own comment admitted
|
|
14
16
|
* as much ("the ghost shows the *first* day's piece"), so dragging an event up
|
|
15
17
|
* through midnight drew the piece on the previous day and simply omitted the
|
|
16
|
-
* piece under the pointer.
|
|
18
|
+
* piece under the pointer. One piece per day draws every piece, exactly the way
|
|
17
19
|
* a committed multi-day event already renders.
|
|
18
20
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
+
* Those pieces were then mounted *inside* each day column, which fixed the
|
|
22
|
+
* midnight case and broke a smaller one: a piece's identity was its column, so
|
|
23
|
+
* moving to another day faded one element out and the next one in, where a
|
|
24
|
+
* vertical move glided. Placed by a var, a piece keeps its element across the
|
|
25
|
+
* change and slides — see `paintPieces`' `anchor`.
|
|
26
|
+
*
|
|
27
|
+
* `--sch-ghost-top`/`--sch-ghost-height` are percentages of the timed row's
|
|
28
|
+
* height (the pool layer's, and every day column's), exactly like a chip's `--sch-base-top`/`--sch-base-height`, so
|
|
21
29
|
* the ghost lines up with the hour grid without knowing the hour height.
|
|
22
30
|
*/
|
|
23
31
|
export function ScheduleDragGhost({ className }: { className?: string }) {
|
|
@@ -33,7 +41,7 @@ export function ScheduleDragGhost({ className }: { className?: string }) {
|
|
|
33
41
|
// while staying under the sticky gutter (30) — same band, and same
|
|
34
42
|
// reasoning, as the create draft's own.
|
|
35
43
|
className={cn(
|
|
36
|
-
"group pointer-events-none absolute
|
|
44
|
+
"group pointer-events-none absolute z-26 hidden select-none rounded-sm",
|
|
37
45
|
// The piece carrying the readout paints above its siblings — same
|
|
38
46
|
// collision the create draft has, for the same reason: the label is
|
|
39
47
|
// deliberately wider than its own column so a cross-day range is not
|
|
@@ -97,12 +105,15 @@ export function ScheduleDragGhost({ className }: { className?: string }) {
|
|
|
97
105
|
* during a move (a move preserves duration) and is listed only so the
|
|
98
106
|
* two previews stay one declaration apart.
|
|
99
107
|
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
108
|
+
* `inset-inline-start` eases a move onto another day the same way. The
|
|
109
|
+
* piece stays one element across the change (`paintPieces` keys it by
|
|
110
|
+
* its offset from the pointer's column), so this slides it rather than
|
|
111
|
+
* fading one column's piece out and the next one's in. Longer than the
|
|
112
|
+
* vertical step because the distance is: a column is a hundred-odd
|
|
113
|
+
* pixels where a slot is a dozen.
|
|
103
114
|
*/
|
|
104
|
-
"[transition:opacity_200ms_ease-in,scale_200ms_ease-in,display_200ms_ease-in_allow-discrete,top_45ms_ease-out,height_45ms_ease-out]",
|
|
105
|
-
"data-active:[transition:opacity_200ms_ease-out,scale_200ms_ease-out,display_200ms_ease-out_allow-discrete,top_45ms_ease-out,height_45ms_ease-out]",
|
|
115
|
+
"[transition:opacity_200ms_ease-in,scale_200ms_ease-in,display_200ms_ease-in_allow-discrete,top_45ms_ease-out,height_45ms_ease-out,inset-inline-start_70ms_ease-out]",
|
|
116
|
+
"data-active:[transition:opacity_200ms_ease-out,scale_200ms_ease-out,display_200ms_ease-out_allow-discrete,top_45ms_ease-out,height_45ms_ease-out,inset-inline-start_70ms_ease-out]",
|
|
106
117
|
"starting:data-active:opacity-0 starting:data-active:scale-105",
|
|
107
118
|
// `!` and the full shorthand, not `transition-none`: the `data-active`
|
|
108
119
|
// rule above is a class *and* an attribute selector, so a plain
|
|
@@ -119,7 +130,11 @@ export function ScheduleDragGhost({ className }: { className?: string }) {
|
|
|
119
130
|
"data-continues-after:rounded-b-none data-continues-after:border-b-0",
|
|
120
131
|
className,
|
|
121
132
|
)}
|
|
122
|
-
style={{
|
|
133
|
+
style={{
|
|
134
|
+
top: "var(--sch-ghost-top, 0%)",
|
|
135
|
+
height: "var(--sch-ghost-height, 0%)",
|
|
136
|
+
...poolPieceInsets("--sch-ghost-col"),
|
|
137
|
+
}}
|
|
123
138
|
>
|
|
124
139
|
{/* The live drop-time readout. Both products that ship drag-to-page pair
|
|
125
140
|
* the gesture with one, and for the same reason: once the view can move
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
|
+
import { useLocaleContext } from "@ark-ui/react/locale"
|
|
3
4
|
import { usePresence } from "@ark-ui/react/presence"
|
|
4
5
|
import { cva } from "class-variance-authority"
|
|
5
6
|
import { XIcon } from "lucide-react"
|
|
@@ -928,6 +929,11 @@ function InteractiveEventChip<P = unknown>({
|
|
|
928
929
|
locale,
|
|
929
930
|
})
|
|
930
931
|
|
|
932
|
+
// Left/Right are physical keys, but days run right-to-left under an RTL
|
|
933
|
+
// locale. The locale is where the kit takes direction from (see
|
|
934
|
+
// `useDirectionCheck`), which is also how zag mirrors arrow keys.
|
|
935
|
+
const { dir } = useLocaleContext()
|
|
936
|
+
|
|
931
937
|
const handleBodyKeyDown = (e: ReactKeyboardEvent<HTMLDivElement>) => {
|
|
932
938
|
if (!present) return
|
|
933
939
|
if (e.key === "Enter" || e.key === " ") {
|
|
@@ -943,13 +949,14 @@ function InteractiveEventChip<P = unknown>({
|
|
|
943
949
|
// scrolls it instead of moving anything.
|
|
944
950
|
e.preventDefault()
|
|
945
951
|
// Left/Right move by a whole day, with no modifier variants — the
|
|
946
|
-
// keyboard counterpart of dragging sideways
|
|
952
|
+
// keyboard counterpart of dragging sideways, so they follow the columns:
|
|
953
|
+
// under RTL, Left is the *next* day. Up/Down keep their existing
|
|
947
954
|
// `slotDuration` step (Shift ×4). Both go through the same displacement
|
|
948
955
|
// primitive as the pointer path, so "a move never changes duration" is one
|
|
949
956
|
// rule rather than two implementations of it.
|
|
950
957
|
const step = e.shiftKey ? slotDuration * 4 : slotDuration
|
|
951
958
|
const delta = isHorizontal
|
|
952
|
-
? { days: e.key === "ArrowLeft" ?
|
|
959
|
+
? { days: (e.key === "ArrowLeft") === (dir === "rtl") ? 1 : -1, minutes: 0 }
|
|
953
960
|
: { days: 0, minutes: e.key === "ArrowUp" ? -step : step }
|
|
954
961
|
const next = { ...moveRange(event, delta, { timeZone, slotDuration }) }
|
|
955
962
|
const result = checkRangeCommit(next, {
|
|
@@ -98,7 +98,7 @@ export function ScheduleEventListPopoverContent<P = unknown>({
|
|
|
98
98
|
aria-label={translations.back}
|
|
99
99
|
className="-ms-1 flex items-center gap-1 rounded-sm px-1 py-0.5 text-gray-light-500 text-xs hover:bg-black/5 dark:text-gray-dark-400 dark:hover:bg-white/8"
|
|
100
100
|
>
|
|
101
|
-
<ArrowLeftIcon className="size-3.5" />
|
|
101
|
+
<ArrowLeftIcon className="size-3.5 rtl:rotate-180" />
|
|
102
102
|
{translations.back}
|
|
103
103
|
</button>
|
|
104
104
|
</Popover.Header>
|
|
@@ -193,6 +193,27 @@ export function columnInsets({ column, columnCount }: ScheduleLayoutResult): {
|
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
+
/** The horizontal box of one preview piece in the timed grid's `piece-pool`
|
|
197
|
+
* layer, which spans every day column at once. `columnVar` holds the day
|
|
198
|
+
* index the gesture painted the piece over; `--sch-pool-columns` is the
|
|
199
|
+
* number of rendered days, written on the layer.
|
|
200
|
+
*
|
|
201
|
+
* Logical (`insetInlineStart`), so a column index lands on the same day in
|
|
202
|
+
* RTL as the grid's own placement does, with no sign math.
|
|
203
|
+
*
|
|
204
|
+
* The `min(col, 1) * 1px` terms step past the hairline every day column after
|
|
205
|
+
* the first draws at its start edge (`border-s`), so a piece covers exactly
|
|
206
|
+
* the column's padding box: the box its chips are laid out in, and the box
|
|
207
|
+
* the piece used to fill when it was mounted inside the column. */
|
|
208
|
+
export function poolPieceInsets(columnVar: string): { insetInlineStart: string; width: string } {
|
|
209
|
+
const col = `var(${columnVar}, 0)`
|
|
210
|
+
const hairline = `min(${col}, 1) * 1px`
|
|
211
|
+
return {
|
|
212
|
+
insetInlineStart: `calc(${col} * 100% / var(--sch-pool-columns, 1) + ${hairline})`,
|
|
213
|
+
width: `calc(100% / var(--sch-pool-columns, 1) - ${hairline})`,
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
196
217
|
/**
|
|
197
218
|
* Resolves a px-per-minute rate by measuring the day-column's *real*
|
|
198
219
|
* rendered height (`getBoundingClientRect()`), divided by the window's total
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { afterEach, describe, expect, it, vi } from "vitest"
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
type ColumnBox,
|
|
4
|
+
type EdgeState,
|
|
5
|
+
liveColumns,
|
|
6
|
+
MAX_SCROLL_PX_PER_FRAME,
|
|
7
|
+
measureColumns,
|
|
8
|
+
PAGINATE_DWELL_MS,
|
|
9
|
+
stopEdgeBehaviours,
|
|
10
|
+
tickEdges,
|
|
11
|
+
} from "./schedule-grid-gesture"
|
|
3
12
|
|
|
4
13
|
/**
|
|
5
14
|
* `measureColumns` decides whether a gesture has a horizontal axis at all, and
|
|
@@ -151,3 +160,76 @@ describe("the rejection is no longer silent", () => {
|
|
|
151
160
|
expect(warn.mock.calls[0]?.[0]).toMatch(/could not measure the day columns/)
|
|
152
161
|
})
|
|
153
162
|
})
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Under `dir="rtl"` a scroller's `scrollLeft` runs from `0` at its right edge
|
|
166
|
+
* down to `-(scrollWidth - clientWidth)`, and the *left* edge leads to later
|
|
167
|
+
* days. jsdom has neither layout nor scrolling, so the grid's box and its
|
|
168
|
+
* `scrollLeft` are stubbed: the browser's own clamp is exactly what this
|
|
169
|
+
* function's frozen extent replaces, so a plain read/write field is faithful.
|
|
170
|
+
*/
|
|
171
|
+
describe("tickEdges", () => {
|
|
172
|
+
const edgeState = (scrollLeft: number): EdgeState => {
|
|
173
|
+
const el = document.createElement("div")
|
|
174
|
+
let left = scrollLeft
|
|
175
|
+
Object.defineProperty(el, "scrollLeft", { get: () => left, set: (v: number) => (left = v) })
|
|
176
|
+
vi.spyOn(el, "getBoundingClientRect").mockReturnValue({
|
|
177
|
+
left: 0,
|
|
178
|
+
right: 1000,
|
|
179
|
+
width: 1000,
|
|
180
|
+
top: 0,
|
|
181
|
+
bottom: 500,
|
|
182
|
+
height: 500,
|
|
183
|
+
} as DOMRect)
|
|
184
|
+
return {
|
|
185
|
+
grid: el,
|
|
186
|
+
// Hard against the left edge, mid-height: full horizontal pressure only.
|
|
187
|
+
clientX: 0,
|
|
188
|
+
clientY: 250,
|
|
189
|
+
scrollRaf: null,
|
|
190
|
+
paginateTimer: null,
|
|
191
|
+
paginateDirection: null,
|
|
192
|
+
paginationOffset: 0,
|
|
193
|
+
columns: [],
|
|
194
|
+
maxScrollLeft: 300,
|
|
195
|
+
maxScrollTop: 0,
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
afterEach(() => vi.useRealTimers())
|
|
200
|
+
|
|
201
|
+
it("scrolls into a negative rtl scrollLeft instead of pinning it to 0", () => {
|
|
202
|
+
const state = edgeState(-100)
|
|
203
|
+
tickEdges(state, { dir: "rtl", paint: () => {}, isLive: () => true })
|
|
204
|
+
stopEdgeBehaviours(state)
|
|
205
|
+
|
|
206
|
+
expect(state.grid.scrollLeft).toBe(-100 - MAX_SCROLL_PX_PER_FRAME)
|
|
207
|
+
})
|
|
208
|
+
|
|
209
|
+
it.each([
|
|
210
|
+
["ltr", 0, -1],
|
|
211
|
+
["rtl", -300, 1],
|
|
212
|
+
] as const)(
|
|
213
|
+
"pages %s at the left edge once it can't scroll further",
|
|
214
|
+
(dir, scrollLeft, expected) => {
|
|
215
|
+
vi.useFakeTimers()
|
|
216
|
+
const state = edgeState(scrollLeft)
|
|
217
|
+
const onPaginate = vi.fn()
|
|
218
|
+
let live = true
|
|
219
|
+
tickEdges(state, {
|
|
220
|
+
dir,
|
|
221
|
+
paint: () => {},
|
|
222
|
+
isLive: () => live,
|
|
223
|
+
onPaginate: (direction) => {
|
|
224
|
+
live = false
|
|
225
|
+
onPaginate(direction)
|
|
226
|
+
},
|
|
227
|
+
})
|
|
228
|
+
vi.advanceTimersByTime(PAGINATE_DWELL_MS)
|
|
229
|
+
stopEdgeBehaviours(state)
|
|
230
|
+
|
|
231
|
+
expect(onPaginate).toHaveBeenCalledExactlyOnceWith(expected)
|
|
232
|
+
expect(state.grid.scrollLeft).toBe(scrollLeft)
|
|
233
|
+
},
|
|
234
|
+
)
|
|
235
|
+
})
|