@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
|
@@ -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
|
}
|
|
@@ -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
|
)
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { ark, type HTMLArkProps } from "@ark-ui/react"
|
|
4
4
|
import { type ReactNode, useEffect, useRef } from "react"
|
|
5
5
|
import { match } from "ts-pattern"
|
|
6
|
+
import type { NoAsChild } from "../../lib/as-child"
|
|
6
7
|
import type { AvailableIf, UnavailableProps } from "../../lib/available-if"
|
|
7
8
|
import { cn } from "../../lib/cn"
|
|
8
9
|
import { devWarn } from "../../lib/dev-warn"
|
|
@@ -91,7 +92,7 @@ const PROP_RENDERERS = {
|
|
|
91
92
|
onOverflowClick: ["days", "month"],
|
|
92
93
|
withOverflowDetails: ["days", "month"],
|
|
93
94
|
renderOverflowDetails: ["days", "month"],
|
|
94
|
-
visibleDays: ["days"],
|
|
95
|
+
visibleDays: ["days", "agenda"],
|
|
95
96
|
revealBehavior: ["days"],
|
|
96
97
|
editable: ["days"],
|
|
97
98
|
onEventChange: ["days"],
|
|
@@ -211,7 +212,7 @@ export type ScheduleProps<
|
|
|
211
212
|
// two intersect into a handler that has to satisfy *both* signatures, so the
|
|
212
213
|
// declaration compiles and every call site fails. The kit already uses this
|
|
213
214
|
// treatment for other redefined natives.
|
|
214
|
-
Omit<HTMLArkProps<"div">, "onSelect"
|
|
215
|
+
NoAsChild<Omit<HTMLArkProps<"div">, "onSelect">> &
|
|
215
216
|
WithTestId &
|
|
216
217
|
// ─── days · month · year ───────────────────────────────────────────────
|
|
217
218
|
AvailableIf<
|
|
@@ -231,6 +232,18 @@ export type ScheduleProps<
|
|
|
231
232
|
ScheduleEmptyProps,
|
|
232
233
|
"requires a days or agenda renderer in `views` — month and year always draw a calendar, so they have no empty state"
|
|
233
234
|
> &
|
|
235
|
+
AvailableIf<
|
|
236
|
+
HasRenderer<V, "days" | "agenda">,
|
|
237
|
+
{
|
|
238
|
+
/** Fallback window size, in days, for the `"days"` and `"agenda"`
|
|
239
|
+
* renderers. Default `7`. An active entry that pins its own
|
|
240
|
+
* `visibleDays` (`"day"` and `"week"` do) overrides this; `"days"` and
|
|
241
|
+
* `"agenda"` deliberately do not, so the two share one span unless an
|
|
242
|
+
* entry says otherwise. */
|
|
243
|
+
visibleDays?: number
|
|
244
|
+
},
|
|
245
|
+
"requires a days or agenda renderer in `views` — month and year draw a whole calendar period, not a span of days"
|
|
246
|
+
> &
|
|
234
247
|
// ─── days · month ──────────────────────────────────────────────────────
|
|
235
248
|
AvailableIf<
|
|
236
249
|
HasRenderer<V, "days" | "month">,
|
|
@@ -267,11 +280,6 @@ export type ScheduleProps<
|
|
|
267
280
|
ScheduleTimedProps<P>,
|
|
268
281
|
"editable" | "onEventChange" | "onEventRemove" | "onEventCreate"
|
|
269
282
|
> & {
|
|
270
|
-
/** Fallback window size, in days, for the `"days"` renderer. Default `7`.
|
|
271
|
-
* An active entry that pins its own `visibleDays` (`"day"` and `"week"`
|
|
272
|
-
* do) overrides this; `"days"` deliberately does not, so this prop keeps
|
|
273
|
-
* working exactly as before under the default entries. */
|
|
274
|
-
visibleDays?: number
|
|
275
283
|
/**
|
|
276
284
|
* How a **reveal** scrolls the days grid — the day brought into view by
|
|
277
285
|
* navigating to it, and the chip brought into view by selecting it.
|
|
@@ -360,10 +368,6 @@ export type ScheduleProps<
|
|
|
360
368
|
* `DaysView`/... has no toolbar row of its own to put it in unless
|
|
361
369
|
* `withPagination` is also on; `Root` always has one. */
|
|
362
370
|
withNowButton?: boolean
|
|
363
|
-
/** Fallback window size, in days, for the `"days"` renderer. Default `7`.
|
|
364
|
-
* An active entry that pins its own `visibleDays` (`"day"` and `"week"`
|
|
365
|
-
* do) overrides this; `"days"` deliberately does not, so this prop keeps
|
|
366
|
-
* working exactly as before under the default entries. */
|
|
367
371
|
}
|
|
368
372
|
|
|
369
373
|
/**
|
|
@@ -387,7 +391,7 @@ type ScheduleAllProps<P = unknown> = ScheduleSharedProps<P> &
|
|
|
387
391
|
ScheduleYearOnlyProps &
|
|
388
392
|
ScheduleAgendaOnlyProps<P> &
|
|
389
393
|
AnchorDateProps &
|
|
390
|
-
Omit<HTMLArkProps<"div">, "onSelect"
|
|
394
|
+
NoAsChild<Omit<HTMLArkProps<"div">, "onSelect">> &
|
|
391
395
|
WithTestId & {
|
|
392
396
|
views?: ScheduleViews
|
|
393
397
|
view?: string
|
|
@@ -421,7 +425,10 @@ export function ScheduleRoot<P = unknown>(allProps: ScheduleAllProps<P>) {
|
|
|
421
425
|
defaultSelected,
|
|
422
426
|
onSelect,
|
|
423
427
|
withSelection = true,
|
|
424
|
-
|
|
428
|
+
// No default here: each renderer owns its own — `true` for the grids,
|
|
429
|
+
// whose chips can't show a description, `false` for the agenda, whose
|
|
430
|
+
// rows already do.
|
|
431
|
+
withEventDetails,
|
|
425
432
|
onDayClick,
|
|
426
433
|
renderEventDetails,
|
|
427
434
|
locale: localeProp,
|
|
@@ -467,6 +474,7 @@ export function ScheduleRoot<P = unknown>(allProps: ScheduleAllProps<P>) {
|
|
|
467
474
|
onMonthClick,
|
|
468
475
|
renderEvent,
|
|
469
476
|
testId,
|
|
477
|
+
asChild: _asChild,
|
|
470
478
|
...rest
|
|
471
479
|
} = allProps
|
|
472
480
|
const locale = useLocale(localeProp)
|
|
@@ -1031,6 +1039,7 @@ export function ScheduleRoot<P = unknown>(allProps: ScheduleAllProps<P>) {
|
|
|
1031
1039
|
withPagination={false}
|
|
1032
1040
|
withNowButton={false}
|
|
1033
1041
|
now={now}
|
|
1042
|
+
visibleDays={activeVisibleDays}
|
|
1034
1043
|
/>
|
|
1035
1044
|
))
|
|
1036
1045
|
.exhaustive()}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { Slider as Ark } from "@ark-ui/react/slider"
|
|
4
4
|
import { cva } from "class-variance-authority"
|
|
5
5
|
import type { ComponentPropsWithoutRef, FocusEvent, ReactNode, Ref } from "react"
|
|
6
|
+
import type { ForbidAsChild } from "../../lib/as-child"
|
|
6
7
|
import { cn } from "../../lib/cn"
|
|
7
8
|
import type { Color } from "../../lib/colors"
|
|
8
9
|
import { focusStyles } from "../../lib/focus-styles"
|
|
@@ -191,8 +192,10 @@ export type SliderProps<V extends SliderValue = number> = Pick<
|
|
|
191
192
|
// thumb label (see below), so the Field gets only the surrounding slots.
|
|
192
193
|
"description" | "error" | "required"
|
|
193
194
|
> &
|
|
195
|
+
ForbidAsChild &
|
|
194
196
|
Omit<
|
|
195
197
|
ArkRootProps,
|
|
198
|
+
| "asChild"
|
|
196
199
|
| "value"
|
|
197
200
|
| "defaultValue"
|
|
198
201
|
| "onValueChange"
|
|
@@ -260,6 +263,7 @@ export const Slider = <V extends SliderValue = number>({
|
|
|
260
263
|
className,
|
|
261
264
|
classNames,
|
|
262
265
|
testId,
|
|
266
|
+
asChild: _asChild,
|
|
263
267
|
...rest
|
|
264
268
|
}: SliderProps<V>) => {
|
|
265
269
|
const _showLabel =
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
3
|
import type { ReactNode } from "react"
|
|
4
|
+
import type { ForbidAsChild } from "../../lib/as-child"
|
|
4
5
|
import type { Color } from "../../lib/colors"
|
|
5
6
|
import type { Size } from "../../lib/sizes"
|
|
6
7
|
import {
|
|
@@ -54,20 +55,21 @@ export type TabsValue<Data extends TabsData> = Data[number]["value"]
|
|
|
54
55
|
|
|
55
56
|
export type TabsProps<Data extends TabsData = TabsData> = Omit<
|
|
56
57
|
TabsRootProps,
|
|
57
|
-
"children" | "onValueChange"
|
|
58
|
-
> &
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
58
|
+
"children" | "onValueChange" | "onChange" | "asChild"
|
|
59
|
+
> &
|
|
60
|
+
ForbidAsChild & {
|
|
61
|
+
/** Tabs, in order. Each needs its own `content`. */
|
|
62
|
+
data: Data
|
|
63
|
+
/** Tray + trigger + indicator treatment, mirroring `Button`/`SegmentGroup`. */
|
|
64
|
+
variant?: TabsVariant
|
|
65
|
+
/** Trigger size. */
|
|
66
|
+
size?: Size
|
|
67
|
+
/** Palette for the sliding indicator + active-trigger text. Scoped to the
|
|
68
|
+
* strip (it lands on the `List`), so it never tints the panel content. */
|
|
69
|
+
color?: Color
|
|
70
|
+
/** Fires with the selected value (narrowed to the data value union). */
|
|
71
|
+
onChange?: (value: TabsValue<Data>) => void
|
|
72
|
+
}
|
|
71
73
|
|
|
72
74
|
const TabsComponent = <const Data extends TabsData>({
|
|
73
75
|
data,
|
|
@@ -77,6 +79,7 @@ const TabsComponent = <const Data extends TabsData>({
|
|
|
77
79
|
value,
|
|
78
80
|
defaultValue,
|
|
79
81
|
onChange,
|
|
82
|
+
asChild: _asChild,
|
|
80
83
|
...root
|
|
81
84
|
}: TabsProps<Data>) => (
|
|
82
85
|
<Root
|