@42-central/ui-react 0.17.1 → 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/biome/no-gray-color.grit +18 -0
- 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-EVVMHTCL.js → chunk-EBREIC3L.js} +4 -3
- 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-YON5Y336.js → chunk-O23Y5ML4.js} +8 -8
- package/dist/{chunk-YON5Y336.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-6I4R3HR6.js → chunk-RQL7FVCS.js} +3 -3
- package/dist/{chunk-6I4R3HR6.js.map → chunk-RQL7FVCS.js.map} +1 -1
- 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-NSOA3GMZ.js → chunk-UHNRAI6V.js} +3 -3
- package/dist/{chunk-NSOA3GMZ.js.map → chunk-UHNRAI6V.js.map} +1 -1
- package/dist/{chunk-JBVFWSRQ.js → chunk-VIYVN4WF.js} +6 -4
- package/dist/chunk-VIYVN4WF.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-S53FHWNG.js → chunk-YWRBG23W.js} +3 -3
- package/dist/chunk-YWRBG23W.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/colors.css +12 -26
- 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 +1 -1
- package/dist/components/alert/alert.d.ts.map +1 -1
- package/dist/components/alert/index.js +16 -4
- 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/avatar/avatar.d.ts +3 -3
- package/dist/components/avatar/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/index.js +3 -2
- package/dist/components/chart/chart.d.ts +1 -1
- package/dist/components/chart/index.js +1 -1
- package/dist/components/chart/index.js.map +1 -1
- 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/index.js +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 +21 -20
- 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/mark/index.js +1 -1
- package/dist/components/mark/mark.d.ts +2 -2
- 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/index.js +4 -3
- package/dist/components/notification/index.js.map +1 -1
- package/dist/components/notification/notification.d.ts +3 -2
- 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 +2 -2
- package/dist/components/schedule/index.js +50 -23
- 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-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-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-toolbar.d.ts +1 -1
- package/dist/components/schedule/schedule-toolbar.d.ts.map +1 -1
- package/dist/components/schedule/schedule-types.d.ts +6 -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/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/theme-icon/index.js +1 -1
- 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/index.js +1 -1
- package/dist/lib/as-child.d.ts +104 -0
- package/dist/lib/as-child.d.ts.map +1 -0
- package/dist/lib/colors.d.ts +1 -1
- package/dist/lib/colors.d.ts.map +1 -1
- package/dist/theme.css +0 -33
- package/package.json +2 -1
- package/src/as-child.contract.test.tsx +809 -0
- package/src/biome-plugins.test.ts +61 -0
- package/src/colors.css +12 -26
- 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 +17 -0
- package/src/components/alert/alert.tsx +21 -2
- package/src/components/app-shell/app-shell.tsx +3 -1
- package/src/components/avatar/avatar.tsx +3 -3
- 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/chart/chart.test.tsx +1 -2
- package/src/components/chart/chart.tsx +1 -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/gutters.test.ts +2 -2
- 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/mark/mark.test.tsx +4 -4
- package/src/components/mark/mark.tsx +3 -3
- 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/notification.tsx +4 -1
- 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/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 +41 -28
- package/src/components/schedule/schedule-dates.test.ts +37 -52
- package/src/components/schedule/schedule-dates.ts +22 -25
- package/src/components/schedule/schedule-days-view.tsx +3 -1
- package/src/components/schedule/schedule-month-view.tsx +3 -1
- package/src/components/schedule/schedule-next-up.tsx +6 -2
- package/src/components/schedule/schedule-toolbar.test.tsx +26 -0
- package/src/components/schedule/schedule-toolbar.tsx +13 -1
- package/src/components/schedule/schedule-types.ts +6 -4
- package/src/components/schedule/schedule-views.ts +4 -5
- package/src/components/schedule/schedule-year-view.tsx +3 -1
- package/src/components/schedule/schedule.test.tsx +66 -22
- package/src/components/schedule/schedule.tsx +22 -13
- package/src/components/slider/slider.tsx +4 -0
- package/src/components/tabs/tabs-data.tsx +17 -14
- package/src/components/theme-icon/theme-icon.tsx +1 -1
- 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/lib/colors.ts +4 -2
- package/src/theme.css +0 -33
- 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-EVVMHTCL.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-JBVFWSRQ.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-S53FHWNG.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
|
})
|
|
@@ -158,23 +158,19 @@ export function getVisibleRange(view: ScheduleView, date: Date, options: RangeOp
|
|
|
158
158
|
return { start, end }
|
|
159
159
|
})
|
|
160
160
|
.with("agenda", () => {
|
|
161
|
-
//
|
|
162
|
-
//
|
|
163
|
-
//
|
|
164
|
-
//
|
|
165
|
-
//
|
|
166
|
-
// 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.
|
|
167
166
|
//
|
|
168
|
-
//
|
|
169
|
-
//
|
|
170
|
-
//
|
|
171
|
-
//
|
|
172
|
-
//
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
const start = midnightOf(startOfMonth(value))
|
|
176
|
-
const end = midnightOf(endOfMonth(value)).add({ days: 1 })
|
|
177
|
-
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 }) }
|
|
178
174
|
})
|
|
179
175
|
.exhaustive()
|
|
180
176
|
|
|
@@ -195,12 +191,12 @@ export function paginateDate(
|
|
|
195
191
|
): Date {
|
|
196
192
|
const value = toZoned(date, options.timeZone)
|
|
197
193
|
const duration = match(view)
|
|
198
|
-
|
|
199
|
-
//
|
|
200
|
-
|
|
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 }))
|
|
201
197
|
// `@internationalized/date`'s `add({ months: 1 })` clamps Jan 31 to Feb
|
|
202
198
|
// 28/29, so Prev/Next never skips a month.
|
|
203
|
-
.with("month",
|
|
199
|
+
.with("month", () => ({ months: 1 }))
|
|
204
200
|
.with("year", () => ({ years: 1 }))
|
|
205
201
|
.exhaustive()
|
|
206
202
|
const next = direction === 1 ? value.add(duration) : value.subtract(duration)
|
|
@@ -605,12 +601,15 @@ export function formatScheduleTitle(
|
|
|
605
601
|
const { timeZone, locale = DEFAULT_LOCALE, startOfWeek, visibleDays } = options
|
|
606
602
|
return (
|
|
607
603
|
match(view)
|
|
608
|
-
|
|
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) => {
|
|
609
608
|
const days = visibleDays ?? 7
|
|
610
609
|
if (days === 1) {
|
|
611
610
|
return new Intl.DateTimeFormat(locale, { dateStyle: "long", timeZone }).format(date)
|
|
612
611
|
}
|
|
613
|
-
const range = getVisibleRange(
|
|
612
|
+
const range = getVisibleRange(v, date, {
|
|
614
613
|
timeZone,
|
|
615
614
|
locale,
|
|
616
615
|
startOfWeek,
|
|
@@ -621,9 +620,7 @@ export function formatScheduleTitle(
|
|
|
621
620
|
.formatRange(range.start, lastDay)
|
|
622
621
|
.normalize("NFKC")
|
|
623
622
|
})
|
|
624
|
-
|
|
625
|
-
// Month's by construction rather than by a copied format object.
|
|
626
|
-
.with("month", "agenda", () =>
|
|
623
|
+
.with("month", () =>
|
|
627
624
|
new Intl.DateTimeFormat(locale, { month: "long", year: "numeric", timeZone }).format(date),
|
|
628
625
|
)
|
|
629
626
|
.with("year", () =>
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { ark, type HTMLArkProps } from "@ark-ui/react"
|
|
4
4
|
import type { Ref } from "react"
|
|
5
5
|
import { useRef } from "react"
|
|
6
|
+
import type { NoAsChild } from "../../lib/as-child"
|
|
6
7
|
import { cn } from "../../lib/cn"
|
|
7
8
|
import { useLocale, useTimeZone } from "../../lib/intl"
|
|
8
9
|
import { mergeRefs } from "../../lib/merge-refs"
|
|
@@ -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
|
|
@@ -145,6 +146,7 @@ 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) {
|
|
150
152
|
const locale = useLocale(localeProp)
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { ark, type HTMLArkProps } from "@ark-ui/react"
|
|
4
4
|
import type { ReactNode } from "react"
|
|
5
5
|
import { useRef } from "react"
|
|
6
|
+
import type { NoAsChild } from "../../lib/as-child"
|
|
6
7
|
import { cn } from "../../lib/cn"
|
|
7
8
|
import { focusStyles } from "../../lib/focus-styles"
|
|
8
9
|
import { useLocale, useTimeZone } from "../../lib/intl"
|
|
@@ -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
|
|
@@ -511,6 +512,7 @@ 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>) {
|
|
516
518
|
const locale = useLocale(localeProp)
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { ark, type HTMLArkProps } from "@ark-ui/react"
|
|
4
4
|
import type { ReactNode } from "react"
|
|
5
|
+
import type { NoAsChild } from "../../lib/as-child"
|
|
5
6
|
import { cn } from "../../lib/cn"
|
|
6
7
|
import { useLocale, useTimeZone } from "../../lib/intl"
|
|
7
8
|
import { props } from "../../lib/props"
|
|
@@ -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
|
|
@@ -105,6 +108,7 @@ export function ScheduleNextUp<P = unknown>({
|
|
|
105
108
|
classNames,
|
|
106
109
|
className,
|
|
107
110
|
testId,
|
|
111
|
+
asChild: _asChild,
|
|
108
112
|
...rest
|
|
109
113
|
}: ScheduleNextUpProps<P>) {
|
|
110
114
|
const locale = useLocale(localeProp)
|
|
@@ -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
|
+
})
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { ark, type HTMLArkProps } from "@ark-ui/react"
|
|
4
4
|
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react"
|
|
5
|
+
import { withAsChildContent } from "../../lib/as-child"
|
|
5
6
|
import { cn } from "../../lib/cn"
|
|
6
7
|
import { useLocale, useTimeZone } from "../../lib/intl"
|
|
7
8
|
import { props } from "../../lib/props"
|
|
@@ -177,18 +178,29 @@ const ScheduleToolbarTitle = ({
|
|
|
177
178
|
visibleDays,
|
|
178
179
|
className,
|
|
179
180
|
testId,
|
|
181
|
+
asChild,
|
|
182
|
+
children,
|
|
180
183
|
...rest
|
|
181
184
|
}: ScheduleToolbarTitleProps) => {
|
|
182
185
|
const locale = useLocale(localeProp)
|
|
183
186
|
const timeZone = useTimeZone(timeZoneProp)
|
|
187
|
+
const title = formatScheduleTitle(view, date, {
|
|
188
|
+
timeZone,
|
|
189
|
+
locale,
|
|
190
|
+
startOfWeek: align,
|
|
191
|
+
visibleDays,
|
|
192
|
+
})
|
|
184
193
|
return (
|
|
185
194
|
<ark.h2
|
|
195
|
+
asChild={asChild}
|
|
186
196
|
data-schedule-part="toolbar-title"
|
|
187
197
|
className={cn("truncate font-semibold text-sm", className)}
|
|
188
198
|
{...props({ "data-testid": testId })}
|
|
189
199
|
{...rest}
|
|
190
200
|
>
|
|
191
|
-
{
|
|
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}
|
|
192
204
|
</ark.h2>
|
|
193
205
|
)
|
|
194
206
|
}
|
|
@@ -6,7 +6,7 @@ import type { ScheduleSlotPredicate } from "../../lib/schedule-predicates"
|
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* A closed subset of the kit's full palette (`lib/colors.ts`), not the
|
|
9
|
-
* shared `Color` type: `brand` and `
|
|
9
|
+
* shared `Color` type: `brand` and `neutral` are excluded (reserved for chrome),
|
|
10
10
|
* and there's no custom-string escape hatch — every allowed value's
|
|
11
11
|
* `--c-text`/`--c-soft` pairing has been checked against a white/near-black
|
|
12
12
|
* grid background, a guarantee an arbitrary custom color couldn't make.
|
|
@@ -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
|
|
@@ -623,8 +623,10 @@ export type ScheduleEventProps<P = unknown> = {
|
|
|
623
623
|
*/
|
|
624
624
|
withSelection?: boolean
|
|
625
625
|
/**
|
|
626
|
-
* Default `true
|
|
627
|
-
*
|
|
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.
|
|
628
630
|
*
|
|
629
631
|
* Set `false` when you are rendering the detail yourself (a side panel, a
|
|
630
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,6 +1,7 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
3
|
import { ark, type HTMLArkProps } from "@ark-ui/react"
|
|
4
|
+
import type { NoAsChild } from "../../lib/as-child"
|
|
4
5
|
import { cn } from "../../lib/cn"
|
|
5
6
|
import { focusStyles } from "../../lib/focus-styles"
|
|
6
7
|
import { useLocale, useTimeZone } from "../../lib/intl"
|
|
@@ -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
|
|
|
@@ -94,6 +95,7 @@ export function YearView<P = unknown>({
|
|
|
94
95
|
now,
|
|
95
96
|
dayDisabled,
|
|
96
97
|
testId,
|
|
98
|
+
asChild: _asChild,
|
|
97
99
|
...rest
|
|
98
100
|
}: YearViewProps<P>) {
|
|
99
101
|
const locale = useLocale(localeProp)
|
|
@@ -3644,6 +3644,7 @@ describe("ScheduleRoot — several selected chips", () => {
|
|
|
3644
3644
|
views={["days", "agenda"]}
|
|
3645
3645
|
view="agenda"
|
|
3646
3646
|
selected={["offer:before", "offer:after"]}
|
|
3647
|
+
withEventDetails
|
|
3647
3648
|
/>,
|
|
3648
3649
|
)
|
|
3649
3650
|
const rows = document.querySelectorAll('[data-schedule-part="agenda-event"][data-selected]')
|
|
@@ -3856,20 +3857,30 @@ describe("ScheduleRoot — the agenda view", () => {
|
|
|
3856
3857
|
),
|
|
3857
3858
|
).map((el) => el.dataset["eventId"])
|
|
3858
3859
|
|
|
3860
|
+
// "Today" is Tue 15 Sep, so the default 7-day window is 15–21 Sep: one
|
|
3861
|
+
// event in it, one the week after, and one earlier in the same month that a
|
|
3862
|
+
// month window would have listed first.
|
|
3859
3863
|
const SEPT: ScheduleEvent[] = [
|
|
3860
3864
|
{
|
|
3861
3865
|
kind: "event",
|
|
3862
|
-
id: "
|
|
3863
|
-
title: "
|
|
3864
|
-
start: day(2026, 8,
|
|
3865
|
-
end: day(2026, 8,
|
|
3866
|
+
id: "this-week",
|
|
3867
|
+
title: "Planning",
|
|
3868
|
+
start: day(2026, 8, 16, 9),
|
|
3869
|
+
end: day(2026, 8, 16, 10),
|
|
3870
|
+
},
|
|
3871
|
+
{
|
|
3872
|
+
kind: "event",
|
|
3873
|
+
id: "next-week",
|
|
3874
|
+
title: "Retro",
|
|
3875
|
+
start: day(2026, 8, 23, 9),
|
|
3876
|
+
end: day(2026, 8, 23, 10),
|
|
3866
3877
|
},
|
|
3867
3878
|
{
|
|
3868
3879
|
kind: "event",
|
|
3869
|
-
id: "
|
|
3870
|
-
title: "
|
|
3871
|
-
start: day(2026,
|
|
3872
|
-
end: day(2026,
|
|
3880
|
+
id: "last-week",
|
|
3881
|
+
title: "Kickoff",
|
|
3882
|
+
start: day(2026, 8, 10, 9),
|
|
3883
|
+
end: day(2026, 8, 10, 10),
|
|
3873
3884
|
},
|
|
3874
3885
|
]
|
|
3875
3886
|
const SEPT_NOW = day(2026, 8, 15, 12)
|
|
@@ -3880,7 +3891,7 @@ describe("ScheduleRoot — the agenda view", () => {
|
|
|
3880
3891
|
expect(tabNames()).toEqual(["Week", "Agenda", "Month"])
|
|
3881
3892
|
})
|
|
3882
3893
|
|
|
3883
|
-
it("renders the agenda, titled
|
|
3894
|
+
it("renders the agenda from today, titled by its range", () => {
|
|
3884
3895
|
render(
|
|
3885
3896
|
<ScheduleRoot
|
|
3886
3897
|
data={SEPT}
|
|
@@ -3891,11 +3902,25 @@ describe("ScheduleRoot — the agenda view", () => {
|
|
|
3891
3902
|
/>,
|
|
3892
3903
|
)
|
|
3893
3904
|
expect(agenda()).not.toBeNull()
|
|
3894
|
-
expect(title()).toBe("
|
|
3895
|
-
expect(rowIds()).toEqual(["
|
|
3905
|
+
expect(title()).toBe("15 – 21 Sept 2026")
|
|
3906
|
+
expect(rowIds()).toEqual(["this-week"])
|
|
3907
|
+
})
|
|
3908
|
+
|
|
3909
|
+
it("takes its span from an entry's own visibleDays", () => {
|
|
3910
|
+
render(
|
|
3911
|
+
<ScheduleRoot
|
|
3912
|
+
data={SEPT}
|
|
3913
|
+
now={SEPT_NOW}
|
|
3914
|
+
timeZone="UTC"
|
|
3915
|
+
locale="en-GB"
|
|
3916
|
+
views={[{ id: "agenda", visibleDays: 14 }]}
|
|
3917
|
+
/>,
|
|
3918
|
+
)
|
|
3919
|
+
expect(title()).toBe("15 – 28 Sept 2026")
|
|
3920
|
+
expect(rowIds()).toEqual(["this-week", "next-week"])
|
|
3896
3921
|
})
|
|
3897
3922
|
|
|
3898
|
-
it("steps
|
|
3923
|
+
it("steps by its span per Prev/Next from Root's own toolbar", () => {
|
|
3899
3924
|
render(
|
|
3900
3925
|
<ScheduleRoot
|
|
3901
3926
|
data={SEPT}
|
|
@@ -3906,8 +3931,8 @@ describe("ScheduleRoot — the agenda view", () => {
|
|
|
3906
3931
|
/>,
|
|
3907
3932
|
)
|
|
3908
3933
|
fireEvent.click(screen.getByRole("button", { name: "Next" }))
|
|
3909
|
-
expect(title()).toBe("
|
|
3910
|
-
expect(rowIds()).toEqual(["
|
|
3934
|
+
expect(title()).toBe("22 – 28 Sept 2026")
|
|
3935
|
+
expect(rowIds()).toEqual(["next-week"])
|
|
3911
3936
|
})
|
|
3912
3937
|
|
|
3913
3938
|
it("suppresses the view's own pagination chrome", () => {
|
|
@@ -3933,16 +3958,18 @@ describe("ScheduleRoot — the agenda view", () => {
|
|
|
3933
3958
|
'[data-schedule-part="agenda-event-trigger"]',
|
|
3934
3959
|
)
|
|
3935
3960
|
if (control) fireEvent.click(control)
|
|
3936
|
-
expect(onSelect).toHaveBeenCalledWith(expect.objectContaining({ id: "
|
|
3961
|
+
expect(onSelect).toHaveBeenCalledWith(expect.objectContaining({ id: "this-week" }))
|
|
3962
|
+
// Selecting is all a click does here: the row already shows the details.
|
|
3963
|
+
expect(screen.queryByRole("dialog")).toBeNull()
|
|
3937
3964
|
})
|
|
3938
3965
|
|
|
3939
3966
|
/**
|
|
3940
3967
|
* The load-bearing integration: `Root`'s reveal effect asks
|
|
3941
|
-
* `isEventInVisibleRange`, which resolves the agenda's
|
|
3942
|
-
* selection outside
|
|
3943
|
-
*
|
|
3968
|
+
* `isEventInVisibleRange`, which resolves the agenda's own window — so a
|
|
3969
|
+
* selection outside it pages there with no agenda-specific code in `Root`
|
|
3970
|
+
* at all. It is tested precisely *because* nothing implements it.
|
|
3944
3971
|
*/
|
|
3945
|
-
it("pages to a selection outside the current
|
|
3972
|
+
it("pages to a selection outside the current window", () => {
|
|
3946
3973
|
const onDateChange = vi.fn()
|
|
3947
3974
|
render(
|
|
3948
3975
|
<ScheduleRoot
|
|
@@ -3950,14 +3977,31 @@ describe("ScheduleRoot — the agenda view", () => {
|
|
|
3950
3977
|
now={SEPT_NOW}
|
|
3951
3978
|
timeZone="UTC"
|
|
3952
3979
|
views={["agenda"]}
|
|
3953
|
-
selected="
|
|
3980
|
+
selected="next-week"
|
|
3954
3981
|
onDateChange={onDateChange}
|
|
3955
3982
|
/>,
|
|
3956
3983
|
)
|
|
3957
3984
|
expect(onDateChange).toHaveBeenCalledWith(SEPT[1]?.start)
|
|
3958
3985
|
})
|
|
3959
3986
|
|
|
3960
|
-
|
|
3987
|
+
/** Earlier in the same month: a month window used to list it, so this is
|
|
3988
|
+
* the case that changed. */
|
|
3989
|
+
it("pages back to a selection before the window", () => {
|
|
3990
|
+
const onDateChange = vi.fn()
|
|
3991
|
+
render(
|
|
3992
|
+
<ScheduleRoot
|
|
3993
|
+
data={SEPT}
|
|
3994
|
+
now={SEPT_NOW}
|
|
3995
|
+
timeZone="UTC"
|
|
3996
|
+
views={["agenda"]}
|
|
3997
|
+
selected="last-week"
|
|
3998
|
+
onDateChange={onDateChange}
|
|
3999
|
+
/>,
|
|
4000
|
+
)
|
|
4001
|
+
expect(onDateChange).toHaveBeenCalledWith(SEPT[2]?.start)
|
|
4002
|
+
})
|
|
4003
|
+
|
|
4004
|
+
it("leaves the anchor alone for a selection already in the window", () => {
|
|
3961
4005
|
const onDateChange = vi.fn()
|
|
3962
4006
|
render(
|
|
3963
4007
|
<ScheduleRoot
|
|
@@ -3965,7 +4009,7 @@ describe("ScheduleRoot — the agenda view", () => {
|
|
|
3965
4009
|
now={SEPT_NOW}
|
|
3966
4010
|
timeZone="UTC"
|
|
3967
4011
|
views={["agenda"]}
|
|
3968
|
-
selected="
|
|
4012
|
+
selected="this-week"
|
|
3969
4013
|
onDateChange={onDateChange}
|
|
3970
4014
|
/>,
|
|
3971
4015
|
)
|