@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
|
@@ -294,6 +294,10 @@ export const measureScrollExtent = (grid: HTMLElement) => ({
|
|
|
294
294
|
})
|
|
295
295
|
|
|
296
296
|
export type EdgeBehaviourOptions = {
|
|
297
|
+
/** The locale's text direction (`useLocaleContext().dir`). Under `rtl`,
|
|
298
|
+
* `scrollLeft` runs from `0` down to `-maxScrollLeft`, and the left edge
|
|
299
|
+
* leads to *later* days, so both the clamp and the page direction flip. */
|
|
300
|
+
dir: "ltr" | "rtl"
|
|
297
301
|
/** Repaint the preview from the last known pointer position. Called every
|
|
298
302
|
* frame — the pointer can be stationary while the grid moves under it. */
|
|
299
303
|
paint: () => void
|
|
@@ -340,11 +344,15 @@ export const tickEdges = (state: EdgeState, options: EdgeBehaviourOptions) => {
|
|
|
340
344
|
|
|
341
345
|
// Frozen at pointerdown, deliberately not re-read here — see
|
|
342
346
|
// `EdgeState.maxScrollLeft`.
|
|
343
|
-
const
|
|
347
|
+
const rtl = options.dir === "rtl"
|
|
348
|
+
const [minLeft, maxLeft] = rtl ? [-state.maxScrollLeft, 0] : [0, state.maxScrollLeft]
|
|
344
349
|
const maxTop = state.maxScrollTop
|
|
345
350
|
const beforeLeft = grid.scrollLeft
|
|
346
351
|
if (hx !== 0) {
|
|
347
|
-
grid.scrollLeft = Math.max(
|
|
352
|
+
grid.scrollLeft = Math.max(
|
|
353
|
+
minLeft,
|
|
354
|
+
Math.min(maxLeft, grid.scrollLeft + hx * MAX_SCROLL_PX_PER_FRAME),
|
|
355
|
+
)
|
|
348
356
|
}
|
|
349
357
|
if (vy !== 0) {
|
|
350
358
|
grid.scrollTop = Math.max(0, Math.min(maxTop, grid.scrollTop + vy * MAX_SCROLL_PX_PER_FRAME))
|
|
@@ -352,7 +360,9 @@ export const tickEdges = (state: EdgeState, options: EdgeBehaviourOptions) => {
|
|
|
352
360
|
|
|
353
361
|
// Horizontal only: there is no "next range" vertically — the day is already
|
|
354
362
|
// fully rendered, so the vertical edge just scrolls.
|
|
355
|
-
|
|
363
|
+
// `hx` is physical (negative at the left edge); `direction` is in days,
|
|
364
|
+
// which run right-to-left under RTL.
|
|
365
|
+
const direction: -1 | 1 | null = hx === 0 ? null : hx > 0 !== rtl ? 1 : -1
|
|
356
366
|
const stuck = hx !== 0 && grid.scrollLeft === beforeLeft
|
|
357
367
|
if (direction !== null && stuck && options.onPaginate) {
|
|
358
368
|
if (state.paginateDirection !== direction) {
|
|
@@ -397,22 +407,33 @@ export const tickEdges = (state: EdgeState, options: EdgeBehaviourOptions) => {
|
|
|
397
407
|
|
|
398
408
|
/* ── The draft preview ──────────────────────────────────────────────────────
|
|
399
409
|
*
|
|
400
|
-
*
|
|
401
|
-
*
|
|
402
|
-
*
|
|
403
|
-
* its
|
|
404
|
-
*
|
|
410
|
+
* A pool of preview pieces, one per rendered day, lives in a single layer laid
|
|
411
|
+
* over the day columns (`ScheduleTimedGrid`'s `piece-pool`), and a gesture
|
|
412
|
+
* writes to all of them. Both authoring gestures need this: a create drag uses
|
|
413
|
+
* it for its whole preview, and a resize falls back to it the moment its edge
|
|
414
|
+
* leaves the chip's own day, where the chip's `--sch-resize-delta-y` stretch
|
|
415
|
+
* stops being able to represent the candidate at all.
|
|
416
|
+
*
|
|
417
|
+
* The pieces used to be mounted *inside* each day column. That drew every
|
|
418
|
+
* piece of a cross-day candidate correctly, but it tied a piece's identity to
|
|
419
|
+
* its column: a move onto the next day hid one element and showed another, so
|
|
420
|
+
* every column change played a full fade-out and fade-in where a vertical move
|
|
421
|
+
* just glided. Placed by a column var instead, a piece can stay the same
|
|
422
|
+
* element while its column changes, and the browser transitions the horizontal
|
|
423
|
+
* position exactly the way it already transitions `top`.
|
|
405
424
|
*/
|
|
406
425
|
|
|
407
|
-
/** Which
|
|
408
|
-
*
|
|
409
|
-
*
|
|
410
|
-
*
|
|
426
|
+
/** Which preview a gesture paints into. Create and resize paint the draft; a
|
|
427
|
+
* move paints the ghost. Same geometry, and since the draft lost its dashes
|
|
428
|
+
* the same skin too — they are the same kind of object ("the box you are
|
|
429
|
+
* about to commit") and never appear at once. */
|
|
411
430
|
export type PiecePreview = {
|
|
412
|
-
/** `data-schedule-part` of the leaf, one per
|
|
431
|
+
/** `data-schedule-part` of the leaf, one per pool slot. */
|
|
413
432
|
part: string
|
|
414
433
|
topVar: string
|
|
415
434
|
heightVar: string
|
|
435
|
+
/** The rendered day index the piece is drawn over. */
|
|
436
|
+
columnVar: string
|
|
416
437
|
labelPart: string
|
|
417
438
|
}
|
|
418
439
|
|
|
@@ -420,6 +441,7 @@ export const CREATE_DRAFT: PiecePreview = {
|
|
|
420
441
|
part: "create-draft",
|
|
421
442
|
topVar: "--sch-create-top",
|
|
422
443
|
heightVar: "--sch-create-height",
|
|
444
|
+
columnVar: "--sch-create-col",
|
|
423
445
|
labelPart: "create-draft-label",
|
|
424
446
|
}
|
|
425
447
|
|
|
@@ -427,23 +449,21 @@ export const DRAG_GHOST: PiecePreview = {
|
|
|
427
449
|
part: "drag-ghost",
|
|
428
450
|
topVar: "--sch-ghost-top",
|
|
429
451
|
heightVar: "--sch-ghost-height",
|
|
452
|
+
columnVar: "--sch-ghost-col",
|
|
430
453
|
labelPart: "drag-ghost-label",
|
|
431
454
|
}
|
|
432
455
|
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
): Map<number, HTMLElement> =>
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
}
|
|
445
|
-
return drafts
|
|
446
|
-
}
|
|
456
|
+
/** The pool's pieces, keyed by slot. The pool sits outside the paged bands, so
|
|
457
|
+
* unlike the chips it never remounts with a page turn and needs no `isLive`
|
|
458
|
+
* filter: one collection lasts the whole gesture. */
|
|
459
|
+
export const collectPieces = (grid: HTMLElement, preview: PiecePreview): Map<number, HTMLElement> =>
|
|
460
|
+
new Map(
|
|
461
|
+
[
|
|
462
|
+
...grid.querySelectorAll<HTMLElement>(
|
|
463
|
+
`[data-schedule-part='piece-pool'] > [data-schedule-part='${preview.part}']`,
|
|
464
|
+
),
|
|
465
|
+
].map((piece, slot) => [slot, piece]),
|
|
466
|
+
)
|
|
447
467
|
|
|
448
468
|
const pieceLabel = (piece: HTMLElement, preview: PiecePreview) =>
|
|
449
469
|
piece.querySelector<HTMLElement>(`[data-schedule-part='${preview.labelPart}']`)
|
|
@@ -506,6 +526,20 @@ export type PiecePaintOptions = {
|
|
|
506
526
|
* gesture passes one; a repeat create passes one per day. */
|
|
507
527
|
candidates: PieceCandidate[]
|
|
508
528
|
totalWindowMinutes: number
|
|
529
|
+
/**
|
|
530
|
+
* The column a piece's identity is measured from. Default `0`, which keys
|
|
531
|
+
* every piece by its own column — right for create and resize, whose
|
|
532
|
+
* pieces are pinned where the gesture began and only grow or shrink.
|
|
533
|
+
*
|
|
534
|
+
* A move passes the column under the pointer, because there the whole
|
|
535
|
+
* candidate travels: keyed by offset from the pointer, the piece the user is
|
|
536
|
+
* holding keeps one element as it changes day, and so does every piece
|
|
537
|
+
* beside it, so a horizontal move *slides* the preview instead of
|
|
538
|
+
* cross-fading it. Not the event's start day: a vertical move through
|
|
539
|
+
* midnight changes that day without the pointer leaving its column, and the
|
|
540
|
+
* piece keyed to it would sweep diagonally into the next column.
|
|
541
|
+
*/
|
|
542
|
+
anchor?: number
|
|
509
543
|
}
|
|
510
544
|
|
|
511
545
|
/**
|
|
@@ -526,10 +560,14 @@ export const paintPieces = ({
|
|
|
526
560
|
bandOfColumn,
|
|
527
561
|
candidates,
|
|
528
562
|
totalWindowMinutes,
|
|
563
|
+
anchor = 0,
|
|
529
564
|
}: PiecePaintOptions) => {
|
|
530
565
|
const labelled = new Set<PieceCandidate>()
|
|
531
566
|
for (const index of columnIndices) {
|
|
532
|
-
|
|
567
|
+
// There are as many slots as rendered days and every piece of a frame sits
|
|
568
|
+
// within those days, so the offsets are a run of at most `size` integers
|
|
569
|
+
// and folding them modulo `size` never puts two pieces in one slot.
|
|
570
|
+
const draft = pieces.get((((index - anchor) % pieces.size) + pieces.size) % pieces.size)
|
|
533
571
|
if (!draft) continue
|
|
534
572
|
const band = bandOfColumn(index)
|
|
535
573
|
// Strict `<`, matching `segmentEvents` — a candidate ending exactly when a
|
|
@@ -548,6 +586,7 @@ export const paintPieces = ({
|
|
|
548
586
|
const height = ((pieceEnd - pieceStart) / 60_000 / totalWindowMinutes) * 100
|
|
549
587
|
draft.style.setProperty(preview.topVar, `${top}%`)
|
|
550
588
|
draft.style.setProperty(preview.heightVar, `${height}%`)
|
|
589
|
+
draft.style.setProperty(preview.columnVar, `${index}`)
|
|
551
590
|
draft.dataset["active"] = "true"
|
|
552
591
|
if (candidate.invalid) draft.dataset["invalid"] = "true"
|
|
553
592
|
else delete draft.dataset["invalid"]
|
|
@@ -1,11 +1,12 @@
|
|
|
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 } from "react"
|
|
6
5
|
import { useRef } from "react"
|
|
6
|
+
import type { NoAsChild } from "../../lib/as-child"
|
|
7
7
|
import { cn } from "../../lib/cn"
|
|
8
8
|
import { focusStyles } from "../../lib/focus-styles"
|
|
9
|
+
import { useLocale, useTimeZone } from "../../lib/intl"
|
|
9
10
|
import { OverlayContainerProvider } from "../../lib/overlay-container"
|
|
10
11
|
import { props as dataProps } from "../../lib/props"
|
|
11
12
|
import type { WithTestId } from "../../lib/test-id"
|
|
@@ -89,7 +90,7 @@ export type MonthViewProps<P = unknown> = ScheduleSharedProps<P> &
|
|
|
89
90
|
// two intersect into a handler that has to satisfy *both* signatures, so the
|
|
90
91
|
// declaration compiles and every call site fails. The kit already uses this
|
|
91
92
|
// treatment for other redefined natives.
|
|
92
|
-
Omit<HTMLArkProps<"div">, "onSelect"
|
|
93
|
+
NoAsChild<Omit<HTMLArkProps<"div">, "onSelect">> &
|
|
93
94
|
WithTestId & {
|
|
94
95
|
/** Locale default when omitted. */
|
|
95
96
|
startOfWeek?: FirstDayOfWeek
|
|
@@ -212,7 +213,7 @@ function MonthEventPill<P>({
|
|
|
212
213
|
)}
|
|
213
214
|
>
|
|
214
215
|
{event.icon != null ? (
|
|
215
|
-
<span className="
|
|
216
|
+
<span className="me-1 inline-flex align-[-1px] [&_svg]:size-3">{event.icon}</span>
|
|
216
217
|
) : null}
|
|
217
218
|
{event.title}
|
|
218
219
|
</button>
|
|
@@ -496,8 +497,8 @@ export function MonthView<P = unknown>({
|
|
|
496
497
|
onOverflowClick,
|
|
497
498
|
withOverflowDetails,
|
|
498
499
|
renderOverflowDetails,
|
|
499
|
-
locale,
|
|
500
|
-
timeZone
|
|
500
|
+
locale: localeProp,
|
|
501
|
+
timeZone: timeZoneProp,
|
|
501
502
|
translations,
|
|
502
503
|
classNames,
|
|
503
504
|
className,
|
|
@@ -511,8 +512,11 @@ export function MonthView<P = unknown>({
|
|
|
511
512
|
dayDisabled,
|
|
512
513
|
maxEventsPerDay = 3,
|
|
513
514
|
testId,
|
|
515
|
+
asChild: _asChild,
|
|
514
516
|
...rest
|
|
515
517
|
}: MonthViewProps<P>) {
|
|
518
|
+
const locale = useLocale(localeProp)
|
|
519
|
+
const timeZone = useTimeZone(timeZoneProp)
|
|
516
520
|
const [currentDate, setCurrentDate] = useUncontrolled<Date>({
|
|
517
521
|
value: date,
|
|
518
522
|
defaultValue: defaultDate,
|
|
@@ -529,7 +533,7 @@ export function MonthView<P = unknown>({
|
|
|
529
533
|
const todayRef = now ?? new Date()
|
|
530
534
|
const range = getVisibleRange("month", currentDate, {
|
|
531
535
|
timeZone,
|
|
532
|
-
locale
|
|
536
|
+
locale,
|
|
533
537
|
startOfWeek,
|
|
534
538
|
})
|
|
535
539
|
const days = enumerateDays(range, timeZone)
|
|
@@ -1,9 +1,10 @@
|
|
|
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 } from "react"
|
|
5
|
+
import type { NoAsChild } from "../../lib/as-child"
|
|
6
6
|
import { cn } from "../../lib/cn"
|
|
7
|
+
import { useLocale, useTimeZone } from "../../lib/intl"
|
|
7
8
|
import { props } from "../../lib/props"
|
|
8
9
|
import type { WithTestId } from "../../lib/test-id"
|
|
9
10
|
import { useNow } from "../../lib/use-now"
|
|
@@ -22,7 +23,7 @@ import { resolveScheduleTranslations } from "./schedule-types"
|
|
|
22
23
|
* time label).
|
|
23
24
|
*
|
|
24
25
|
* It renders the very same list `AgendaView` does (`schedule-agenda-list.tsx`)
|
|
25
|
-
* over a different window: `AgendaView` shows
|
|
26
|
+
* over a different window: `AgendaView` shows a span of days from its date and is a
|
|
26
27
|
* toolbar-switchable view; this shows everything from now on, unbounded, and
|
|
27
28
|
* is not. That makes it the standalone preset — a sidebar/dashboard "what's
|
|
28
29
|
* next" panel — rather than a fourth grid.
|
|
@@ -54,7 +55,9 @@ export type ScheduleNextUpClassNames = ScheduleAgendaListClassNames
|
|
|
54
55
|
* `ScheduleNextUpClassNames` above. */
|
|
55
56
|
export type NextUpEventRenderState = AgendaEventRenderState
|
|
56
57
|
|
|
57
|
-
export type ScheduleNextUpProps<P = unknown> =
|
|
58
|
+
export type ScheduleNextUpProps<P = unknown> = NoAsChild<
|
|
59
|
+
Omit<HTMLArkProps<"section">, "children">
|
|
60
|
+
> &
|
|
58
61
|
WithTestId & {
|
|
59
62
|
/** Both interactive and read-only events, merged — `NextUp` never
|
|
60
63
|
* drags, resizes, or removes anything, so there's no reason to force
|
|
@@ -97,16 +100,19 @@ export function ScheduleNextUp<P = unknown>({
|
|
|
97
100
|
data,
|
|
98
101
|
now,
|
|
99
102
|
pastEventsOffset = 30,
|
|
100
|
-
locale,
|
|
101
|
-
timeZone
|
|
103
|
+
locale: localeProp,
|
|
104
|
+
timeZone: timeZoneProp,
|
|
102
105
|
translations,
|
|
103
106
|
empty,
|
|
104
107
|
renderEvent,
|
|
105
108
|
classNames,
|
|
106
109
|
className,
|
|
107
110
|
testId,
|
|
111
|
+
asChild: _asChild,
|
|
108
112
|
...rest
|
|
109
113
|
}: ScheduleNextUpProps<P>) {
|
|
114
|
+
const locale = useLocale(localeProp)
|
|
115
|
+
const timeZone = useTimeZone(timeZoneProp)
|
|
110
116
|
const current = useNow(now)
|
|
111
117
|
const agenda = buildNextUpAgenda(data, current, { pastEventsOffset, timeZone })
|
|
112
118
|
const t = resolveScheduleTranslations(translations)
|
|
@@ -614,7 +614,9 @@ function DayColumn<P = unknown>({
|
|
|
614
614
|
// its own; `align-self: stretch` (the grid default) is what makes
|
|
615
615
|
// that stretch actually apply here.
|
|
616
616
|
"relative row-2 h-full",
|
|
617
|
-
// `overflow-y-clip`
|
|
617
|
+
// `overflow-y-clip` contained the create draft's own scale overshoot
|
|
618
|
+
// when the draft was mounted in here; it now lives in the grid's
|
|
619
|
+
// `piece-pool` layer, which carries the same clip for the same reason.
|
|
618
620
|
// The draft rests at `scale-105` and transitions to `scale-100` on
|
|
619
621
|
// enter (see `schedule-create-draft.tsx` — the >1 resting scale is
|
|
620
622
|
// deliberate, so its *leave* expands outward where it can be seen
|
|
@@ -688,8 +690,6 @@ function DayColumn<P = unknown>({
|
|
|
688
690
|
}}
|
|
689
691
|
/>
|
|
690
692
|
))}
|
|
691
|
-
<ScheduleCreateDraft className={classNames?.createDraft} />
|
|
692
|
-
<ScheduleDragGhost className={classNames?.dragGhost} />
|
|
693
693
|
{chips.map((chip) => chip.node)}
|
|
694
694
|
{withNowIndicator && isToday ? (
|
|
695
695
|
<NowCursorLine
|
|
@@ -1279,6 +1279,8 @@ export function ScheduleTimedGrid<P = unknown>({
|
|
|
1279
1279
|
// details popovers are portalled *into* this subtree, so their panels
|
|
1280
1280
|
// opt back in with `select-text`.
|
|
1281
1281
|
"select-none",
|
|
1282
|
+
// Mirrors the page-turn slide: see the `schedule-page-*` keyframes.
|
|
1283
|
+
"rtl:[--sch-inline-dir:-1]",
|
|
1282
1284
|
classNames?.grid,
|
|
1283
1285
|
)}
|
|
1284
1286
|
style={
|
|
@@ -1584,6 +1586,42 @@ export function ScheduleTimedGrid<P = unknown>({
|
|
|
1584
1586
|
</div>
|
|
1585
1587
|
) : null}
|
|
1586
1588
|
|
|
1589
|
+
{/* The gesture previews: one create draft and one drag ghost per
|
|
1590
|
+
* rendered day, in one layer over every day column, each placed on
|
|
1591
|
+
* its day by a var (`poolPieceInsets`). Over the columns rather
|
|
1592
|
+
* than inside them so a piece can change day without changing
|
|
1593
|
+
* element — the drag ghost then *slides* to the next column instead
|
|
1594
|
+
* of fading out of one and into another.
|
|
1595
|
+
*
|
|
1596
|
+
* The same in-flow `relative col-[2/-1] row-2 min-w-0` wrapper the
|
|
1597
|
+
* now-cursor guide above uses, for the same reasons: it resolves to
|
|
1598
|
+
* the row's real height (so the pieces' `top` percentages share the
|
|
1599
|
+
* columns' basis), and `min-w-0` stops it distorting the `1fr`
|
|
1600
|
+
* tracks it spans. No z-index, so it forms no stacking context and
|
|
1601
|
+
* the pieces' own `z-26`/`z-27` still clear the columns' chips.
|
|
1602
|
+
*
|
|
1603
|
+
* Outside `renderBand` on purpose: the pool is not part of a page,
|
|
1604
|
+
* so a page turn mid-gesture neither remounts it nor slides it away.
|
|
1605
|
+
*
|
|
1606
|
+
* `overflow-y-clip` contains the pieces' scale overshoot (they rest
|
|
1607
|
+
* at `scale-105`), which would otherwise grow the grid's scrollable
|
|
1608
|
+
* height for the length of the fade — see `DayColumn`'s own. */}
|
|
1609
|
+
<div
|
|
1610
|
+
aria-hidden
|
|
1611
|
+
data-schedule-part="piece-pool"
|
|
1612
|
+
className="pointer-events-none relative col-[2/-1] row-2 min-w-0 overflow-y-clip"
|
|
1613
|
+
style={{ "--sch-pool-columns": `${days.length}` } as CSSProperties}
|
|
1614
|
+
>
|
|
1615
|
+
{days.map((_, slot) => (
|
|
1616
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: pool slots, not days — keyed by date, a page turn would remount the pool mid-gesture.
|
|
1617
|
+
<ScheduleCreateDraft key={slot} className={classNames?.createDraft} />
|
|
1618
|
+
))}
|
|
1619
|
+
{days.map((_, slot) => (
|
|
1620
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: pool slots, not days — keyed by date, a page turn would remount the pool mid-gesture.
|
|
1621
|
+
<ScheduleDragGhost key={slot} className={classNames?.dragGhost} />
|
|
1622
|
+
))}
|
|
1623
|
+
</div>
|
|
1624
|
+
|
|
1587
1625
|
{renderBand(days, dataSegments, staticSegments, paging ? "entering" : undefined, "")}
|
|
1588
1626
|
{pageOut
|
|
1589
1627
|
? renderBand(outDays, outDataSegments, outStaticSegments, "exiting", "exit-")
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { render, screen } from "@testing-library/react"
|
|
2
|
+
import { describe, expect, it } from "vitest"
|
|
3
|
+
import { ScheduleToolbar } from "./schedule-toolbar"
|
|
4
|
+
|
|
5
|
+
const MARCH = new Date("2026-03-04T10:00:00Z")
|
|
6
|
+
|
|
7
|
+
describe("ScheduleToolbar.Title", () => {
|
|
8
|
+
it("renders the computed title in its own heading", () => {
|
|
9
|
+
render(<ScheduleToolbar.Title view="month" date={MARCH} timeZone="UTC" locale="en-US" />)
|
|
10
|
+
expect(screen.getByRole("heading", { level: 2 }).textContent).toBe("March 2026")
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
// The computed string used to replace the children outright, so under
|
|
14
|
+
// `asChild` Ark got a string instead of an element and rendered nothing.
|
|
15
|
+
it("fills an empty asChild element with the computed title", () => {
|
|
16
|
+
render(
|
|
17
|
+
<ScheduleToolbar.Title asChild view="month" date={MARCH} timeZone="UTC" locale="en-US">
|
|
18
|
+
{/* biome-ignore lint/a11y/useHeadingContent: the computed title is what fills the empty heading */}
|
|
19
|
+
<h1 />
|
|
20
|
+
</ScheduleToolbar.Title>,
|
|
21
|
+
)
|
|
22
|
+
const heading = screen.getByRole("heading", { level: 1 })
|
|
23
|
+
expect(heading.textContent).toBe("March 2026")
|
|
24
|
+
expect(heading.getAttribute("data-schedule-part")).toBe("toolbar-title")
|
|
25
|
+
})
|
|
26
|
+
})
|
|
@@ -1,9 +1,10 @@
|
|
|
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 { ChevronLeftIcon, ChevronRightIcon } from "lucide-react"
|
|
5
|
+
import { withAsChildContent } from "../../lib/as-child"
|
|
6
6
|
import { cn } from "../../lib/cn"
|
|
7
|
+
import { useLocale, useTimeZone } from "../../lib/intl"
|
|
7
8
|
import { props } from "../../lib/props"
|
|
8
9
|
import type { Size } from "../../lib/sizes"
|
|
9
10
|
import type { WithTestId } from "../../lib/test-id"
|
|
@@ -61,13 +62,14 @@ const ScheduleToolbarPrevTrigger = ({
|
|
|
61
62
|
view,
|
|
62
63
|
date,
|
|
63
64
|
onDateChange,
|
|
64
|
-
timeZone
|
|
65
|
+
timeZone: timeZoneProp,
|
|
65
66
|
translations,
|
|
66
67
|
size = "sm",
|
|
67
68
|
className,
|
|
68
69
|
testId,
|
|
69
70
|
visibleDays,
|
|
70
71
|
}: PaginationTriggerProps) => {
|
|
72
|
+
const timeZone = useTimeZone(timeZoneProp)
|
|
71
73
|
const t = resolveScheduleTranslations(translations)
|
|
72
74
|
return (
|
|
73
75
|
<ActionIcon
|
|
@@ -79,7 +81,7 @@ const ScheduleToolbarPrevTrigger = ({
|
|
|
79
81
|
className={className}
|
|
80
82
|
testId={testId}
|
|
81
83
|
>
|
|
82
|
-
<ChevronLeftIcon />
|
|
84
|
+
<ChevronLeftIcon className="rtl:rotate-180" />
|
|
83
85
|
</ActionIcon>
|
|
84
86
|
)
|
|
85
87
|
}
|
|
@@ -88,13 +90,14 @@ const ScheduleToolbarNextTrigger = ({
|
|
|
88
90
|
view,
|
|
89
91
|
date,
|
|
90
92
|
onDateChange,
|
|
91
|
-
timeZone
|
|
93
|
+
timeZone: timeZoneProp,
|
|
92
94
|
translations,
|
|
93
95
|
size = "sm",
|
|
94
96
|
className,
|
|
95
97
|
testId,
|
|
96
98
|
visibleDays,
|
|
97
99
|
}: PaginationTriggerProps) => {
|
|
100
|
+
const timeZone = useTimeZone(timeZoneProp)
|
|
98
101
|
const t = resolveScheduleTranslations(translations)
|
|
99
102
|
return (
|
|
100
103
|
<ActionIcon
|
|
@@ -106,7 +109,7 @@ const ScheduleToolbarNextTrigger = ({
|
|
|
106
109
|
className={className}
|
|
107
110
|
testId={testId}
|
|
108
111
|
>
|
|
109
|
-
<ChevronRightIcon />
|
|
112
|
+
<ChevronRightIcon className="rtl:rotate-180" />
|
|
110
113
|
</ActionIcon>
|
|
111
114
|
)
|
|
112
115
|
}
|
|
@@ -169,23 +172,38 @@ export type ScheduleToolbarTitleProps = HTMLArkProps<"h2"> &
|
|
|
169
172
|
const ScheduleToolbarTitle = ({
|
|
170
173
|
view,
|
|
171
174
|
date,
|
|
172
|
-
timeZone
|
|
173
|
-
locale,
|
|
175
|
+
timeZone: timeZoneProp,
|
|
176
|
+
locale: localeProp,
|
|
174
177
|
align,
|
|
175
178
|
visibleDays,
|
|
176
179
|
className,
|
|
177
180
|
testId,
|
|
181
|
+
asChild,
|
|
182
|
+
children,
|
|
178
183
|
...rest
|
|
179
|
-
}: ScheduleToolbarTitleProps) =>
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
184
|
+
}: ScheduleToolbarTitleProps) => {
|
|
185
|
+
const locale = useLocale(localeProp)
|
|
186
|
+
const timeZone = useTimeZone(timeZoneProp)
|
|
187
|
+
const title = formatScheduleTitle(view, date, {
|
|
188
|
+
timeZone,
|
|
189
|
+
locale,
|
|
190
|
+
startOfWeek: align,
|
|
191
|
+
visibleDays,
|
|
192
|
+
})
|
|
193
|
+
return (
|
|
194
|
+
<ark.h2
|
|
195
|
+
asChild={asChild}
|
|
196
|
+
data-schedule-part="toolbar-title"
|
|
197
|
+
className={cn("truncate font-semibold text-sm", className)}
|
|
198
|
+
{...props({ "data-testid": testId })}
|
|
199
|
+
{...rest}
|
|
200
|
+
>
|
|
201
|
+
{/* Under `asChild` the computed title fills the consumer's element (an
|
|
202
|
+
`<h1>`, say) unless that element brings its own content. */}
|
|
203
|
+
{asChild ? withAsChildContent(children, (own) => own ?? title) : title}
|
|
204
|
+
</ark.h2>
|
|
205
|
+
)
|
|
206
|
+
}
|
|
189
207
|
|
|
190
208
|
export type ScheduleToolbarViewSwitcherProps<V extends ScheduleViews = DefaultScheduleViews> =
|
|
191
209
|
WithTestId & {
|
|
@@ -371,7 +371,7 @@ export type ScheduleTranslations = {
|
|
|
371
371
|
days?: string
|
|
372
372
|
month?: string
|
|
373
373
|
year?: string
|
|
374
|
-
/** The `"agenda"` view-switcher entry — the
|
|
374
|
+
/** The `"agenda"` view-switcher entry — the event list. */
|
|
375
375
|
agenda?: string
|
|
376
376
|
empty?: string
|
|
377
377
|
removeEvent?: string
|
|
@@ -537,8 +537,11 @@ export type ScheduleSharedProps<P = unknown> = {
|
|
|
537
537
|
* uncontrolled anchor date from it.
|
|
538
538
|
*/
|
|
539
539
|
now?: Date
|
|
540
|
+
/** BCP-47 tag for every label and the week start. Defaults to the nearest
|
|
541
|
+
* `IntlProvider`'s locale, else `"en-US"`; `"auto"` reads the browser's. */
|
|
540
542
|
locale?: string
|
|
541
|
-
/**
|
|
543
|
+
/** IANA zone the events are laid out in. Defaults to the nearest
|
|
544
|
+
* `IntlProvider`'s zone, else `"auto"` (the browser's own). */
|
|
542
545
|
timeZone?: string
|
|
543
546
|
translations?: ScheduleTranslations
|
|
544
547
|
classNames?: ScheduleClassNames
|
|
@@ -620,8 +623,10 @@ export type ScheduleEventProps<P = unknown> = {
|
|
|
620
623
|
*/
|
|
621
624
|
withSelection?: boolean
|
|
622
625
|
/**
|
|
623
|
-
* Default `true
|
|
624
|
-
*
|
|
626
|
+
* Default `true` — except in the agenda, whose rows already print the title,
|
|
627
|
+
* time and description, so it defaults to `false` there unless
|
|
628
|
+
* `renderEventDetails` is passed. Whether the built-in event-details popover
|
|
629
|
+
* mounts for the selected event.
|
|
625
630
|
*
|
|
626
631
|
* Set `false` when you are rendering the detail yourself (a side panel, a
|
|
627
632
|
* drawer) and only want the selection state — the dashboard example does
|
|
@@ -38,8 +38,8 @@ export type ScheduleViewOptionObject = {
|
|
|
38
38
|
* shorthand, otherwise `"days"`. */
|
|
39
39
|
view?: ScheduleView
|
|
40
40
|
/** Overrides `ScheduleProps.visibleDays` while this entry is active.
|
|
41
|
-
* Meaningful
|
|
42
|
-
* window size. */
|
|
41
|
+
* Meaningful for the `"days"` and `"agenda"` renderers; Month and Year take
|
|
42
|
+
* no window size. */
|
|
43
43
|
visibleDays?: number
|
|
44
44
|
/** Overrides the `translations`-derived tab label. `ReactNode`, not `string`,
|
|
45
45
|
* so a custom entry can carry an icon or a `<Trans>`-style element. */
|
|
@@ -200,9 +200,8 @@ const SHORTHANDS: {
|
|
|
200
200
|
days: { id: "days", view: "days" },
|
|
201
201
|
month: { id: "month", view: "month" },
|
|
202
202
|
year: { id: "year", view: "year" },
|
|
203
|
-
// Pins no `visibleDays
|
|
204
|
-
//
|
|
205
|
-
// the agenda is month-scoped, exactly like `month` and `year`.
|
|
203
|
+
// Pins no `visibleDays`, for the same reason `"days"` doesn't: it inherits
|
|
204
|
+
// the consumer's window, so a week-sized Days and the agenda step in sync.
|
|
206
205
|
agenda: { id: "agenda", view: "agenda" },
|
|
207
206
|
}
|
|
208
207
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
3
|
import { ark, type HTMLArkProps } from "@ark-ui/react"
|
|
4
|
-
import {
|
|
4
|
+
import type { NoAsChild } from "../../lib/as-child"
|
|
5
5
|
import { cn } from "../../lib/cn"
|
|
6
6
|
import { focusStyles } from "../../lib/focus-styles"
|
|
7
|
+
import { useLocale, useTimeZone } from "../../lib/intl"
|
|
7
8
|
import { props as dataProps } from "../../lib/props"
|
|
8
9
|
import type { WithTestId } from "../../lib/test-id"
|
|
9
10
|
import { useUncontrolled } from "../../lib/use-uncontrolled"
|
|
@@ -54,7 +55,7 @@ export type YearViewProps<P = unknown> = ScheduleSharedProps<P> &
|
|
|
54
55
|
ScheduleDayDisabledProps &
|
|
55
56
|
AnchorDateProps &
|
|
56
57
|
PaginationChromeProps &
|
|
57
|
-
HTMLArkProps<"div"
|
|
58
|
+
NoAsChild<HTMLArkProps<"div">> &
|
|
58
59
|
WithTestId &
|
|
59
60
|
ScheduleYearOnlyProps
|
|
60
61
|
|
|
@@ -81,8 +82,8 @@ export function YearView<P = unknown>({
|
|
|
81
82
|
staticEvents = [],
|
|
82
83
|
onDayClick,
|
|
83
84
|
onMonthClick,
|
|
84
|
-
locale,
|
|
85
|
-
timeZone
|
|
85
|
+
locale: localeProp,
|
|
86
|
+
timeZone: timeZoneProp,
|
|
86
87
|
translations,
|
|
87
88
|
classNames,
|
|
88
89
|
className,
|
|
@@ -94,8 +95,11 @@ export function YearView<P = unknown>({
|
|
|
94
95
|
now,
|
|
95
96
|
dayDisabled,
|
|
96
97
|
testId,
|
|
98
|
+
asChild: _asChild,
|
|
97
99
|
...rest
|
|
98
100
|
}: YearViewProps<P>) {
|
|
101
|
+
const locale = useLocale(localeProp)
|
|
102
|
+
const timeZone = useTimeZone(timeZoneProp)
|
|
99
103
|
const [currentDate, setCurrentDate] = useUncontrolled<Date>({
|
|
100
104
|
value: date,
|
|
101
105
|
defaultValue: defaultDate,
|
|
@@ -104,7 +108,7 @@ export function YearView<P = unknown>({
|
|
|
104
108
|
})
|
|
105
109
|
const t = resolveScheduleTranslations(translations)
|
|
106
110
|
const todayRef = now ?? new Date()
|
|
107
|
-
const yearRange = getVisibleRange("year", currentDate, { timeZone, locale
|
|
111
|
+
const yearRange = getVisibleRange("year", currentDate, { timeZone, locale })
|
|
108
112
|
const monthStarts = enumerateMonths(yearRange, timeZone)
|
|
109
113
|
const allEvents = [...data, ...staticEvents]
|
|
110
114
|
|
|
@@ -153,7 +157,7 @@ export function YearView<P = unknown>({
|
|
|
153
157
|
{monthStarts.map((monthStart) => {
|
|
154
158
|
const monthGrid = getVisibleRange("month", monthStart, {
|
|
155
159
|
timeZone,
|
|
156
|
-
locale
|
|
160
|
+
locale,
|
|
157
161
|
})
|
|
158
162
|
const nextMonthStart = monthStarts.find((m) => m.getTime() > monthStart.getTime())
|
|
159
163
|
const monthEnd = nextMonthStart ?? yearRange.end
|