@42-central/ui-react 0.17.1 → 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/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-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-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 +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/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/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/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 +5 -3
- 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/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/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 +17 -0
- package/src/components/alert/alert.tsx +21 -2
- 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/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/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 +5 -3
- 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/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/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-NGAQITWP.js.map +0 -1
- package/dist/chunk-POKDSVQT.js.map +0 -1
- package/dist/chunk-QMW7D5GU.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
|
@@ -2,6 +2,7 @@ import { useFieldContext } from "@ark-ui/react/field"
|
|
|
2
2
|
import { RatingGroup as Ark } from "@ark-ui/react/rating-group"
|
|
3
3
|
import { cva } from "class-variance-authority"
|
|
4
4
|
import type { ComponentPropsWithoutRef, CSSProperties, FocusEvent, ReactNode, Ref } from "react"
|
|
5
|
+
import type { ForbidAsChild } from "../../lib/as-child"
|
|
5
6
|
import { cn } from "../../lib/cn"
|
|
6
7
|
import type { Color } from "../../lib/colors"
|
|
7
8
|
import { focusStyles } from "../../lib/focus-styles"
|
|
@@ -124,29 +125,31 @@ export type RatingClassNames = {
|
|
|
124
125
|
symbol?: string
|
|
125
126
|
}
|
|
126
127
|
|
|
127
|
-
export type RatingProps =
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
128
|
+
export type RatingProps = ForbidAsChild &
|
|
129
|
+
Omit<
|
|
130
|
+
ArkRootProps,
|
|
131
|
+
| "asChild"
|
|
132
|
+
| "count"
|
|
133
|
+
| "value"
|
|
134
|
+
| "defaultValue"
|
|
135
|
+
| "onValueChange"
|
|
136
|
+
| "readOnly"
|
|
137
|
+
| "disabled"
|
|
138
|
+
| "allowHalf"
|
|
139
|
+
| "name"
|
|
140
|
+
| "form"
|
|
141
|
+
| "translations"
|
|
142
|
+
| "onBlur"
|
|
143
|
+
| "ref"
|
|
144
|
+
| "className"
|
|
145
|
+
| "children"
|
|
146
|
+
// Ark's polymorphic `HTMLProps<'div'>` pulls in the full (deprecated)
|
|
147
|
+
// `AllHTMLAttributes` set for `as` support, including a plain `color:
|
|
148
|
+
// string` — without omitting it, our richer `Color |
|
|
149
|
+
// ((index: number) => Color)` type below intersects with that `string`
|
|
150
|
+
// instead of replacing it.
|
|
151
|
+
| "color"
|
|
152
|
+
> &
|
|
150
153
|
WithTestId & {
|
|
151
154
|
/** Total number of symbols in the group. */
|
|
152
155
|
count?: number
|
|
@@ -329,6 +332,7 @@ export const Rating = ({
|
|
|
329
332
|
className,
|
|
330
333
|
classNames,
|
|
331
334
|
testId,
|
|
335
|
+
asChild: _asChild,
|
|
332
336
|
...rest
|
|
333
337
|
}: RatingProps) => {
|
|
334
338
|
const resolvedTranslations = resolveRatingTranslations(translations)
|
|
@@ -152,7 +152,7 @@ import { YearView as _YearView } from "./schedule-year-view"
|
|
|
152
152
|
* namespace later without a breaking change. `DayView`/`WeekView` are thin
|
|
153
153
|
* preconfigured `DaysView` wrappers (RFC §17a), not independent
|
|
154
154
|
* implementations — reinstated for convenience after the `DaysView` merge.
|
|
155
|
-
* `AgendaView` is the
|
|
155
|
+
* `AgendaView` is the date-anchored agenda and *is* toolbar-switchable —
|
|
156
156
|
* put `"agenda"` in `views` to give it a tab. `NextUp` renders the same list
|
|
157
157
|
* (`schedule-agenda-list.tsx`) over an unbounded from-now window, with no
|
|
158
158
|
* chrome and no selection, and is deliberately still not a switcher entry:
|
|
@@ -25,16 +25,15 @@ import { chipSelection } from "./use-schedule-selection"
|
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* The agenda list itself — day groups, `HH:MM` slots, event rows — shared
|
|
28
|
-
* verbatim by `AgendaView` (a
|
|
28
|
+
* verbatim by `AgendaView` (a span of days from its date) and `Schedule.NextUp`
|
|
29
29
|
* (everything from now on). The two differ only in *which* events they
|
|
30
30
|
* gather; once grouped, there is exactly one rendering, which is why this
|
|
31
31
|
* takes `groups` already built and never decides what is in range itself.
|
|
32
32
|
*
|
|
33
|
-
* It renders no root element, deliberately. `Schedule.NextUp`
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* them.
|
|
33
|
+
* It renders no root element, deliberately. `Schedule.NextUp` renders its
|
|
34
|
+
* own `<ark.section>` (with the section's props, `asChild` excluded) and
|
|
35
|
+
* `AgendaView` supplies its own `<ark.div>` plus a toolbar. A shared root
|
|
36
|
+
* here would double-wrap one of them.
|
|
38
37
|
*/
|
|
39
38
|
|
|
40
39
|
/** The only signal a custom row renderer can't trivially recompute from
|
|
@@ -42,7 +41,7 @@ import { chipSelection } from "./use-schedule-selection"
|
|
|
42
41
|
* (tie-broken to the first event of the first same-start stack).
|
|
43
42
|
*
|
|
44
43
|
* Only ever `true` under `Schedule.NextUp`. "Soonest still to come" is a
|
|
45
|
-
* from-now idea; in a
|
|
44
|
+
* from-now idea; in a window anchored on last March there is no such
|
|
46
45
|
* event, so `AgendaView` passes no `nextEventId` and every row gets `false`. */
|
|
47
46
|
export type AgendaEventRenderState = { isNext: boolean }
|
|
48
47
|
|
|
@@ -4,8 +4,7 @@ import { AgendaView } from "./schedule-agenda-view"
|
|
|
4
4
|
import type { ScheduleEvent, ScheduleStaticEvent } from "./schedule-types"
|
|
5
5
|
|
|
6
6
|
const day = (y: number, m: number, d: number, h = 0, min = 0) => new Date(Date.UTC(y, m, d, h, min))
|
|
7
|
-
/** Tue 15 Sep 2026, noon UTC —
|
|
8
|
-
* window is 1 Sep .. 1 Oct and "today" is the 15th. */
|
|
7
|
+
/** Tue 15 Sep 2026, noon UTC — "today" for every case below. */
|
|
9
8
|
const NOW = day(2026, 8, 15, 12)
|
|
10
9
|
|
|
11
10
|
const event = (id: string, start: Date, end: Date, rest: Partial<ScheduleEvent> = {}) =>
|
|
@@ -36,21 +35,38 @@ const controls = () =>
|
|
|
36
35
|
)
|
|
37
36
|
const rowTitles = () => rows().map((el) => el.querySelector("p")?.textContent)
|
|
38
37
|
|
|
38
|
+
/** Anchored on Tue 1 Sep and spanning 30 days, so the window is 1 Sep ..
|
|
39
|
+
* 1 Oct and every row-level case below has a whole month of room. The
|
|
40
|
+
* window's own cases override both. */
|
|
39
41
|
const renderView = (props: Partial<React.ComponentProps<typeof AgendaView>> = {}) =>
|
|
40
42
|
render(
|
|
41
|
-
<AgendaView
|
|
43
|
+
<AgendaView
|
|
44
|
+
data={[]}
|
|
45
|
+
now={NOW}
|
|
46
|
+
defaultDate={day(2026, 8, 1)}
|
|
47
|
+
visibleDays={30}
|
|
48
|
+
timeZone="UTC"
|
|
49
|
+
locale="en-GB"
|
|
50
|
+
testId="agenda"
|
|
51
|
+
{...props}
|
|
52
|
+
/>,
|
|
42
53
|
)
|
|
43
54
|
|
|
44
|
-
describe("AgendaView — the
|
|
45
|
-
|
|
55
|
+
describe("AgendaView — the window", () => {
|
|
56
|
+
/** The whole point: a list is read from its top, so it opens on the
|
|
57
|
+
* anchor's own day — not on the 1st of the month, with today buried. */
|
|
58
|
+
it("starts at the anchor date and spans visibleDays", () => {
|
|
46
59
|
renderView({
|
|
60
|
+
defaultDate: undefined,
|
|
61
|
+
visibleDays: undefined,
|
|
47
62
|
data: [
|
|
48
|
-
event("
|
|
49
|
-
event("
|
|
50
|
-
event("
|
|
63
|
+
event("yesterday", day(2026, 8, 14, 9), day(2026, 8, 14, 10)),
|
|
64
|
+
event("this-morning", day(2026, 8, 15, 8), day(2026, 8, 15, 9)),
|
|
65
|
+
event("in-six-days", day(2026, 8, 21, 9), day(2026, 8, 21, 10)),
|
|
66
|
+
event("in-a-week", day(2026, 8, 22, 9), day(2026, 8, 22, 10)),
|
|
51
67
|
],
|
|
52
68
|
})
|
|
53
|
-
expect(rowTitles()).toEqual(["
|
|
69
|
+
expect(rowTitles()).toEqual(["this-morning", "in-six-days"])
|
|
54
70
|
})
|
|
55
71
|
|
|
56
72
|
it("lists staticEvents alongside data", () => {
|
|
@@ -71,7 +87,7 @@ describe("AgendaView — the month window", () => {
|
|
|
71
87
|
/** Listed once, under its own real start date — clamping it into the window
|
|
72
88
|
* would invent a start the event doesn't have, and disagree with the range
|
|
73
89
|
* its own details popover prints. */
|
|
74
|
-
it("lists a multi-day event straddling the
|
|
90
|
+
it("lists a multi-day event straddling the window start exactly once", () => {
|
|
75
91
|
renderView({ data: [event("conference", day(2026, 7, 28), day(2026, 8, 2))] })
|
|
76
92
|
expect(rowTitles()).toEqual(["conference"])
|
|
77
93
|
})
|
|
@@ -81,7 +97,7 @@ describe("AgendaView — the month window", () => {
|
|
|
81
97
|
expect(list().getByText("today")).toBeTruthy()
|
|
82
98
|
})
|
|
83
99
|
|
|
84
|
-
it("shows the empty state for a
|
|
100
|
+
it("shows the empty state for a window with nothing in it", () => {
|
|
85
101
|
renderView({ data: [event("october", day(2026, 9, 1, 9), day(2026, 9, 1, 10))] })
|
|
86
102
|
expect(list().getByText("No events")).toBeTruthy()
|
|
87
103
|
expect(rows()).toHaveLength(0)
|
|
@@ -94,22 +110,55 @@ describe("AgendaView — the month window", () => {
|
|
|
94
110
|
})
|
|
95
111
|
|
|
96
112
|
describe("AgendaView — pagination", () => {
|
|
97
|
-
it("steps
|
|
113
|
+
it("steps by visibleDays per Prev/Next press", () => {
|
|
98
114
|
renderView({
|
|
115
|
+
defaultDate: day(2026, 8, 15),
|
|
116
|
+
visibleDays: 7,
|
|
99
117
|
data: [
|
|
100
|
-
event("
|
|
101
|
-
event("
|
|
102
|
-
event("
|
|
118
|
+
event("previous-week", day(2026, 8, 10, 9), day(2026, 8, 10, 10)),
|
|
119
|
+
event("this-week", day(2026, 8, 17, 9), day(2026, 8, 17, 10)),
|
|
120
|
+
event("next-week", day(2026, 8, 24, 9), day(2026, 8, 24, 10)),
|
|
103
121
|
],
|
|
104
122
|
})
|
|
105
|
-
expect(rowTitles()).toEqual(["
|
|
123
|
+
expect(rowTitles()).toEqual(["this-week"])
|
|
106
124
|
|
|
107
125
|
fireEvent.click(screen.getByRole("button", { name: "Next" }))
|
|
108
|
-
expect(rowTitles()).toEqual(["
|
|
126
|
+
expect(rowTitles()).toEqual(["next-week"])
|
|
109
127
|
|
|
110
128
|
fireEvent.click(screen.getByRole("button", { name: "Previous" }))
|
|
111
129
|
fireEvent.click(screen.getByRole("button", { name: "Previous" }))
|
|
112
|
-
expect(rowTitles()).toEqual(["
|
|
130
|
+
expect(rowTitles()).toEqual(["previous-week"])
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
/** A new window is a new list: the reader starts at its top, not at
|
|
134
|
+
* whatever offset they had scrolled to in the previous one. */
|
|
135
|
+
it("scrolls the list back to the top when the window moves", () => {
|
|
136
|
+
const scrollTo = vi.fn()
|
|
137
|
+
const original = HTMLElement.prototype.scrollTo
|
|
138
|
+
HTMLElement.prototype.scrollTo = scrollTo
|
|
139
|
+
try {
|
|
140
|
+
renderView()
|
|
141
|
+
scrollTo.mockClear()
|
|
142
|
+
fireEvent.click(screen.getByRole("button", { name: "Next" }))
|
|
143
|
+
expect(scrollTo).toHaveBeenCalledWith({ top: 0 })
|
|
144
|
+
} finally {
|
|
145
|
+
HTMLElement.prototype.scrollTo = original
|
|
146
|
+
}
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
it("puts today first after Now, from any window", () => {
|
|
150
|
+
renderView({
|
|
151
|
+
defaultDate: day(2026, 5, 1),
|
|
152
|
+
visibleDays: 7,
|
|
153
|
+
withNowButton: true,
|
|
154
|
+
data: [
|
|
155
|
+
event("earlier-this-month", day(2026, 8, 2, 9), day(2026, 8, 2, 10)),
|
|
156
|
+
event("today", day(2026, 8, 15, 14), day(2026, 8, 15, 15)),
|
|
157
|
+
],
|
|
158
|
+
})
|
|
159
|
+
expect(rows()).toHaveLength(0)
|
|
160
|
+
fireEvent.click(screen.getByRole("button", { name: "Now" }))
|
|
161
|
+
expect(rowTitles()).toEqual(["today"])
|
|
113
162
|
})
|
|
114
163
|
|
|
115
164
|
it("renders no chrome under withPagination={false}", () => {
|
|
@@ -220,30 +269,58 @@ describe("AgendaView — a description is not inside the control", () => {
|
|
|
220
269
|
})
|
|
221
270
|
|
|
222
271
|
describe("AgendaView — event details popover", () => {
|
|
223
|
-
|
|
272
|
+
/** A row already prints title, time and description, so a click selects it
|
|
273
|
+
* and nothing more — a popover would only repeat them. */
|
|
274
|
+
it("opens no popover by default", () => {
|
|
224
275
|
renderView({
|
|
225
276
|
data: [event("standup", day(2026, 8, 2, 9), day(2026, 8, 2, 10))],
|
|
226
277
|
selected: "standup",
|
|
227
278
|
})
|
|
228
279
|
const control = controls()[0]
|
|
229
|
-
expect(control?.getAttribute("aria-haspopup")).
|
|
230
|
-
|
|
280
|
+
expect(control?.getAttribute("aria-haspopup")).toBeNull()
|
|
281
|
+
fireEvent.click(control as HTMLElement)
|
|
282
|
+
expect(screen.queryByRole("dialog")).toBeNull()
|
|
231
283
|
})
|
|
232
284
|
|
|
233
|
-
it("
|
|
234
|
-
|
|
285
|
+
it("still selects the row on click", () => {
|
|
286
|
+
const onSelect = vi.fn()
|
|
287
|
+
renderView({
|
|
288
|
+
data: [event("standup", day(2026, 8, 2, 9), day(2026, 8, 2, 10))],
|
|
289
|
+
onSelect,
|
|
290
|
+
})
|
|
235
291
|
fireEvent.click(controls()[0] as HTMLElement)
|
|
236
|
-
|
|
237
|
-
expect(
|
|
292
|
+
expect(onSelect).toHaveBeenCalledWith(expect.objectContaining({ id: "standup" }))
|
|
293
|
+
expect(rows()[0]?.dataset["selected"]).toBeDefined()
|
|
294
|
+
})
|
|
295
|
+
|
|
296
|
+
it("opens the built-in popover for the selected row under withEventDetails", () => {
|
|
297
|
+
renderView({
|
|
298
|
+
data: [event("standup", day(2026, 8, 2, 9), day(2026, 8, 2, 10))],
|
|
299
|
+
selected: "standup",
|
|
300
|
+
withEventDetails: true,
|
|
301
|
+
})
|
|
302
|
+
const control = controls()[0]
|
|
303
|
+
expect(control?.getAttribute("aria-haspopup")).toBe("dialog")
|
|
304
|
+
expect(control?.getAttribute("aria-expanded")).toBe("true")
|
|
238
305
|
})
|
|
239
306
|
|
|
240
|
-
it("
|
|
307
|
+
it("opts back in when renderEventDetails is passed alone", () => {
|
|
241
308
|
renderView({
|
|
242
309
|
data: [event("standup", day(2026, 8, 2, 9), day(2026, 8, 2, 10))],
|
|
243
310
|
selected: "standup",
|
|
244
|
-
|
|
311
|
+
renderEventDetails: (e) => <span>Details for {e.title}</span>,
|
|
312
|
+
})
|
|
313
|
+
expect(controls()[0]?.getAttribute("aria-haspopup")).toBe("dialog")
|
|
314
|
+
})
|
|
315
|
+
|
|
316
|
+
it("renders the panel inside the agenda's own scroller, not the body", async () => {
|
|
317
|
+
renderView({
|
|
318
|
+
data: [event("standup", day(2026, 8, 2, 9), day(2026, 8, 2, 10))],
|
|
319
|
+
withEventDetails: true,
|
|
245
320
|
})
|
|
246
|
-
|
|
321
|
+
fireEvent.click(controls()[0] as HTMLElement)
|
|
322
|
+
const dialog = await screen.findByRole("dialog")
|
|
323
|
+
expect(dialog.closest("[data-schedule-part='agenda-view']")).not.toBeNull()
|
|
247
324
|
})
|
|
248
325
|
})
|
|
249
326
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
3
|
import { ark, type HTMLArkProps } from "@ark-ui/react"
|
|
4
|
-
import { useRef } from "react"
|
|
4
|
+
import { useEffect, useRef } 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 { OverlayContainerProvider } from "../../lib/overlay-container"
|
|
@@ -25,22 +26,17 @@ import { resolveScheduleTranslations } from "./schedule-types"
|
|
|
25
26
|
import { useScheduleSelection } from "./use-schedule-selection"
|
|
26
27
|
|
|
27
28
|
/**
|
|
28
|
-
* The agenda:
|
|
29
|
-
* fourth toolbar-switchable renderer
|
|
29
|
+
* The agenda: `visibleDays` days of events as a chronological list, starting
|
|
30
|
+
* at the schedule's own date, and the fourth toolbar-switchable renderer
|
|
31
|
+
* (`views={["week", "agenda", "month"]}`).
|
|
30
32
|
*
|
|
31
33
|
* It renders the same list as `Schedule.NextUp` (`schedule-agenda-list.tsx`),
|
|
32
|
-
* over a different window —
|
|
33
|
-
* rather than everything from now on.
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* than growing a branch.
|
|
38
|
-
*
|
|
39
|
-
* `getVisibleRange("agenda", …)` is the one that can't be shared — it is the
|
|
40
|
-
* strict calendar month where Month's is the padded six-week grid. See its
|
|
41
|
-
* own comment; the short version is that a list has no adjacent-month cells
|
|
42
|
-
* to justify padding, and `Root`'s reveal would otherwise be told an event
|
|
43
|
-
* the list never renders is already visible.
|
|
34
|
+
* over a different window — one anchored on the schedule's date and bounded at
|
|
35
|
+
* both ends, rather than everything from now on. A list is read from its top,
|
|
36
|
+
* so the window **starts at the anchor itself**: Now puts "Today" first, and
|
|
37
|
+
* Prev/Next step by the window's own span, exactly as a `"relative"` Days
|
|
38
|
+
* window does — which is why `paginateDate` and `formatScheduleTitle` fold
|
|
39
|
+
* `"agenda"` into their `"days"` pattern rather than growing a branch.
|
|
44
40
|
*
|
|
45
41
|
* Unlike Month and Year this holds a live clock (`useNow`): its day headings
|
|
46
42
|
* say "Today"/"Tomorrow", which is the one thing on screen that goes stale
|
|
@@ -50,12 +46,10 @@ import { useScheduleSelection } from "./use-schedule-selection"
|
|
|
50
46
|
* only a divider labelling a group — so there is no surface for it, and a
|
|
51
47
|
* drill-down from a list of events into the day of one of them is what
|
|
52
48
|
* selecting the event already does.
|
|
49
|
+
*
|
|
50
|
+
* And no details popover by default: every row already prints its title, time
|
|
51
|
+
* and description, which is everything the built-in popover would repeat.
|
|
53
52
|
*/
|
|
54
|
-
// No `ScheduleDayClickProps`: an agenda has no day cells and no day headers to
|
|
55
|
-
// click — only a divider labelling a group — so there is no surface for
|
|
56
|
-
// `onDayClick`, and a drill-down from a list of events into the day of one of
|
|
57
|
-
// them is what selecting the event already does. It used to say this by
|
|
58
|
-
// `Omit`ing that one name off the shared slice.
|
|
59
53
|
export type AgendaViewProps<P = unknown> = ScheduleSharedProps<P> &
|
|
60
54
|
ScheduleEventProps<P> &
|
|
61
55
|
ScheduleEmptyProps &
|
|
@@ -64,9 +58,13 @@ export type AgendaViewProps<P = unknown> = ScheduleSharedProps<P> &
|
|
|
64
58
|
// `ScheduleEventProps` contributes `onSelect`, and React's own DOM props
|
|
65
59
|
// carry an `onSelect` (text-selection) of their own — the same `Omit`
|
|
66
60
|
// `ScheduleProps` and `MonthViewProps` already need for the same reason.
|
|
67
|
-
Omit<HTMLArkProps<"div">, "onSelect"
|
|
61
|
+
NoAsChild<Omit<HTMLArkProps<"div">, "onSelect">> &
|
|
68
62
|
WithTestId &
|
|
69
|
-
ScheduleAgendaOnlyProps<P>
|
|
63
|
+
ScheduleAgendaOnlyProps<P> & {
|
|
64
|
+
/** How many days the list spans, starting at the anchor date. Default
|
|
65
|
+
* `7`. Prev/Next step by the same amount. */
|
|
66
|
+
visibleDays?: number
|
|
67
|
+
}
|
|
70
68
|
|
|
71
69
|
/** Agenda only. Named so `ScheduleProps` can gate it by name rather than
|
|
72
70
|
* `Pick`ing the key out of `AgendaViewProps` — the hand-maintained shape that
|
|
@@ -90,8 +88,11 @@ export function AgendaView<P = unknown>({
|
|
|
90
88
|
defaultSelected,
|
|
91
89
|
onSelect,
|
|
92
90
|
withSelection = true,
|
|
93
|
-
withEventDetails = true,
|
|
94
91
|
renderEventDetails,
|
|
92
|
+
// Off by default — a row already shows everything the popover would. Passing
|
|
93
|
+
// `renderEventDetails` alone opts back in: it asks for a popover's content,
|
|
94
|
+
// which is only meaningful with a popover to put it in.
|
|
95
|
+
withEventDetails = renderEventDetails !== undefined,
|
|
95
96
|
locale: localeProp,
|
|
96
97
|
timeZone: timeZoneProp,
|
|
97
98
|
translations,
|
|
@@ -105,7 +106,9 @@ export function AgendaView<P = unknown>({
|
|
|
105
106
|
now,
|
|
106
107
|
empty,
|
|
107
108
|
renderEvent,
|
|
109
|
+
visibleDays = 7,
|
|
108
110
|
testId,
|
|
111
|
+
asChild: _asChild,
|
|
109
112
|
...rest
|
|
110
113
|
}: AgendaViewProps<P>) {
|
|
111
114
|
const locale = useLocale(localeProp)
|
|
@@ -124,15 +127,16 @@ export function AgendaView<P = unknown>({
|
|
|
124
127
|
})
|
|
125
128
|
const t = resolveScheduleTranslations(translations)
|
|
126
129
|
const current = useNow(now)
|
|
127
|
-
const range = getVisibleRange("agenda", currentDate, { timeZone, locale })
|
|
130
|
+
const range = getVisibleRange("agenda", currentDate, { timeZone, locale, visibleDays })
|
|
128
131
|
// `rangesOverlap` against the very range `isEventInVisibleRange` asks about
|
|
129
132
|
// — not `filterUpcomingEvents`, whose open-ended lower bound is NextUp's
|
|
130
133
|
// alone. The two being the same predicate over the same range is what makes
|
|
131
134
|
// `Root`'s reveal correct here by construction rather than by coincidence:
|
|
132
135
|
// an event this list doesn't render is an event `Root` will page to.
|
|
133
136
|
//
|
|
134
|
-
// A multi-day event that started
|
|
135
|
-
// real start date — which can head a group dated
|
|
137
|
+
// A multi-day event that started before the window is listed once, under
|
|
138
|
+
// its own real start date — which can head a group dated before the title's
|
|
139
|
+
// range.
|
|
136
140
|
// Clamping it to the window would invent a start it doesn't have, and
|
|
137
141
|
// disagree with the range its own details popover prints.
|
|
138
142
|
const groups = groupUpcomingEvents(
|
|
@@ -142,6 +146,13 @@ export function AgendaView<P = unknown>({
|
|
|
142
146
|
// The list is the agenda's scroller, and its rows' popovers portal *into* it
|
|
143
147
|
// (see `OverlayContainerProvider`), the same as the Days and Month grids.
|
|
144
148
|
const scrollerRef = useRef<HTMLDivElement>(null)
|
|
149
|
+
// A new window is a new list, read from its top — Prev/Next and Now would
|
|
150
|
+
// otherwise leave the reader wherever they had scrolled in the old one.
|
|
151
|
+
const windowStart = range.start.getTime()
|
|
152
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: re-runs on purpose whenever the window moves
|
|
153
|
+
useEffect(() => {
|
|
154
|
+
scrollerRef.current?.scrollTo({ top: 0 })
|
|
155
|
+
}, [windowStart])
|
|
145
156
|
|
|
146
157
|
return (
|
|
147
158
|
<ark.div
|
|
@@ -160,6 +171,7 @@ export function AgendaView<P = unknown>({
|
|
|
160
171
|
onDateChange={setCurrentDate}
|
|
161
172
|
timeZone={timeZone}
|
|
162
173
|
translations={t}
|
|
174
|
+
visibleDays={visibleDays}
|
|
163
175
|
/>
|
|
164
176
|
<ScheduleToolbar.NextTrigger
|
|
165
177
|
view="agenda"
|
|
@@ -167,6 +179,7 @@ export function AgendaView<P = unknown>({
|
|
|
167
179
|
onDateChange={setCurrentDate}
|
|
168
180
|
timeZone={timeZone}
|
|
169
181
|
translations={t}
|
|
182
|
+
visibleDays={visibleDays}
|
|
170
183
|
/>
|
|
171
184
|
</>
|
|
172
185
|
) : null}
|
|
@@ -194,8 +207,8 @@ export function AgendaView<P = unknown>({
|
|
|
194
207
|
translations={t}
|
|
195
208
|
empty={empty}
|
|
196
209
|
// Deliberately no `nextEventId`: "the soonest one still to come" is
|
|
197
|
-
// a from-now idea, and a
|
|
198
|
-
//
|
|
210
|
+
// a from-now idea, and a window anchored on last March has no such
|
|
211
|
+
// event. Every row gets `isNext: false` here.
|
|
199
212
|
renderEvent={renderEvent}
|
|
200
213
|
onEventSelect={onEventSelect}
|
|
201
214
|
selected={selectedIds}
|
|
@@ -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
|
})
|