@slotted/react 0.1.0-beta.42 → 0.1.0-beta.43
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/{app-shell-D54YkU7E.js → app-shell-DsWhsSMU.js} +3 -2
- package/dist/app-shell.js +1 -1
- package/dist/attachment-TZykYNu5.js +300 -0
- package/dist/attachment.js +2 -2
- package/dist/{avatar-group-bJaZE1_C.js → avatar-group-Bzmmj2HI.js} +2 -1
- package/dist/avatar-group.js +1 -1
- package/dist/{carousel-B9nMK7Yf.js → carousel-CRNz-T3g.js} +1 -1
- package/dist/carousel.js +1 -1
- package/dist/{command-palette-C90CzfQi.js → command-palette-Bgf5tfCI.js} +160 -156
- package/dist/command-palette.js +1 -1
- package/dist/{data-grid-D106baPp.js → data-grid-DUft3rJb.js} +1 -1
- package/dist/data-grid.js +1 -1
- package/dist/{data-list-BA0xrySM.js → data-list-Dv3orBtf.js} +15 -15
- package/dist/data-list.js +1 -1
- package/dist/detail-panel-Cke3ZFU3.js +342 -0
- package/dist/detail-panel.js +2 -2
- package/dist/docs/action-bar.examples.md +768 -0
- package/dist/docs/action-bar.json +74 -50
- package/dist/docs/action-bar.md +49 -311
- package/dist/docs/app-shell.examples.md +1221 -64
- package/dist/docs/app-shell.json +92 -60
- package/dist/docs/app-shell.md +92 -57
- package/dist/docs/attachment.examples.md +689 -0
- package/dist/docs/attachment.json +69 -37
- package/dist/docs/attachment.md +44 -203
- package/dist/docs/avatar-group.json +111 -23
- package/dist/docs/avatar-group.md +487 -28
- package/dist/docs/button-group.json +98 -2
- package/dist/docs/button-group.md +411 -8
- package/dist/docs/calendar.examples.md +512 -0
- package/dist/docs/calendar.json +72 -24
- package/dist/docs/calendar.md +18 -147
- package/dist/docs/carousel.examples.md +868 -0
- package/dist/docs/carousel.json +58 -50
- package/dist/docs/carousel.md +66 -300
- package/dist/docs/cascader.examples.md +1269 -0
- package/dist/docs/cascader.json +72 -16
- package/dist/docs/cascader.md +78 -154
- package/dist/docs/chart.examples.md +734 -24
- package/dist/docs/chart.json +93 -13
- package/dist/docs/chart.md +28 -7
- package/dist/docs/clock.json +71 -15
- package/dist/docs/clock.md +326 -21
- package/dist/docs/code-block.json +79 -55
- package/dist/docs/code-block.md +417 -74
- package/dist/docs/color-picker.json +60 -12
- package/dist/docs/color-picker.md +245 -22
- package/dist/docs/column-manager.examples.md +764 -0
- package/dist/docs/column-manager.json +68 -12
- package/dist/docs/column-manager.md +44 -203
- package/dist/docs/command-palette.examples.md +747 -0
- package/dist/docs/command-palette.json +48 -24
- package/dist/docs/command-palette.md +60 -339
- package/dist/docs/currency-field.examples.md +355 -73
- package/dist/docs/currency-field.json +96 -64
- package/dist/docs/currency-field.md +57 -50
- package/dist/docs/dashboard-grid.examples.md +629 -0
- package/dist/docs/dashboard-grid.json +64 -16
- package/dist/docs/dashboard-grid.md +34 -152
- package/dist/docs/data-list.examples.md +1556 -0
- package/dist/docs/data-list.json +58 -18
- package/dist/docs/data-list.md +139 -224
- package/dist/docs/date-field.examples.md +543 -0
- package/dist/docs/date-field.json +64 -24
- package/dist/docs/date-field.md +22 -168
- package/dist/docs/datetime-field.examples.md +699 -0
- package/dist/docs/datetime-field.json +79 -31
- package/dist/docs/datetime-field.md +24 -269
- package/dist/docs/datetime-range-picker.examples.md +682 -0
- package/dist/docs/datetime-range-picker.json +117 -61
- package/dist/docs/datetime-range-picker.md +59 -224
- package/dist/docs/description-list.examples.md +652 -0
- package/dist/docs/description-list.json +49 -25
- package/dist/docs/description-list.md +33 -188
- package/dist/docs/detail-panel.examples.md +1177 -0
- package/dist/docs/detail-panel.json +69 -53
- package/dist/docs/detail-panel.md +114 -324
- package/dist/docs/entity-picker.examples.md +1037 -0
- package/dist/docs/entity-picker.json +66 -18
- package/dist/docs/entity-picker.md +56 -246
- package/dist/docs/event-calendar.examples.md +749 -49
- package/dist/docs/event-calendar.json +46 -22
- package/dist/docs/event-calendar.md +81 -11
- package/dist/docs/field-group.examples.md +554 -0
- package/dist/docs/field-group.json +98 -34
- package/dist/docs/field-group.md +55 -133
- package/dist/docs/filter-bar.examples.md +772 -0
- package/dist/docs/filter-bar.json +41 -25
- package/dist/docs/filter-bar.md +42 -246
- package/dist/docs/form.examples.md +579 -0
- package/dist/docs/form.json +87 -39
- package/dist/docs/form.md +53 -177
- package/dist/docs/fullscreen.examples.md +558 -0
- package/dist/docs/fullscreen.json +58 -18
- package/dist/docs/fullscreen.md +50 -169
- package/dist/docs/highlight.json +57 -25
- package/dist/docs/highlight.md +402 -50
- package/dist/docs/icon.json +85 -5
- package/dist/docs/icon.md +401 -10
- package/dist/docs/image.examples.md +670 -0
- package/dist/docs/image.json +44 -28
- package/dist/docs/image.md +24 -176
- package/dist/docs/import-export-center.examples.md +1280 -0
- package/dist/docs/import-export-center.json +67 -27
- package/dist/docs/import-export-center.md +121 -226
- package/dist/docs/list-item.examples.md +769 -0
- package/dist/docs/list-item.json +110 -38
- package/dist/docs/list-item.md +84 -201
- package/dist/docs/listbox.examples.md +858 -0
- package/dist/docs/listbox.json +76 -28
- package/dist/docs/listbox.md +41 -263
- package/dist/docs/markdown.json +79 -55
- package/dist/docs/markdown.md +581 -85
- package/dist/docs/media-viewer.examples.md +1038 -0
- package/dist/docs/media-viewer.json +70 -15
- package/dist/docs/media-viewer.md +84 -135
- package/dist/docs/message-scroller.examples.md +1193 -0
- package/dist/docs/message-scroller.json +41 -17
- package/dist/docs/message-scroller.md +80 -134
- package/dist/docs/message.examples.md +944 -0
- package/dist/docs/message.json +64 -16
- package/dist/docs/message.md +34 -326
- package/dist/docs/meter.json +58 -26
- package/dist/docs/meter.md +312 -32
- package/dist/docs/navigation-menu.examples.md +1107 -0
- package/dist/docs/navigation-menu.json +57 -41
- package/dist/docs/navigation-menu.md +105 -298
- package/dist/docs/notification-center.examples.md +1045 -0
- package/dist/docs/notification-center.json +71 -15
- package/dist/docs/notification-center.md +76 -266
- package/dist/docs/otp-input.examples.md +490 -0
- package/dist/docs/otp-input.json +65 -25
- package/dist/docs/otp-input.md +20 -191
- package/dist/docs/page-header.examples.md +1041 -0
- package/dist/docs/page-header.json +75 -43
- package/dist/docs/page-header.md +79 -291
- package/dist/docs/page.examples.md +633 -0
- package/dist/docs/page.json +48 -16
- package/dist/docs/page.md +62 -129
- package/dist/docs/prompt-composer.examples.md +630 -0
- package/dist/docs/prompt-composer.json +66 -18
- package/dist/docs/prompt-composer.md +35 -161
- package/dist/docs/prose.json +69 -37
- package/dist/docs/prose.md +393 -75
- package/dist/docs/rating.examples.md +525 -0
- package/dist/docs/rating.json +92 -28
- package/dist/docs/rating.md +27 -241
- package/dist/docs/saved-views.examples.md +1108 -0
- package/dist/docs/saved-views.json +53 -21
- package/dist/docs/saved-views.md +86 -171
- package/dist/docs/scroll-area.examples.md +837 -0
- package/dist/docs/scroll-area.json +64 -24
- package/dist/docs/scroll-area.md +57 -140
- package/dist/docs/section.examples.md +676 -0
- package/dist/docs/section.json +68 -20
- package/dist/docs/section.md +39 -162
- package/dist/docs/segmented-control.examples.md +480 -0
- package/dist/docs/segmented-control.json +76 -28
- package/dist/docs/segmented-control.md +20 -191
- package/dist/docs/side-navigation.examples.md +1468 -0
- package/dist/docs/side-navigation.json +53 -53
- package/dist/docs/side-navigation.md +79 -354
- package/dist/docs/slider.examples.md +505 -0
- package/dist/docs/slider.json +91 -51
- package/dist/docs/slider.md +47 -212
- package/dist/docs/sparkline.json +60 -36
- package/dist/docs/sparkline.md +447 -71
- package/dist/docs/split-button.examples.md +509 -0
- package/dist/docs/split-button.json +73 -41
- package/dist/docs/split-button.md +64 -194
- package/dist/docs/splitter.examples.md +921 -0
- package/dist/docs/splitter.json +94 -46
- package/dist/docs/splitter.md +75 -182
- package/dist/docs/stat-card.examples.md +725 -0
- package/dist/docs/stat-card.json +89 -41
- package/dist/docs/stat-card.md +55 -227
- package/dist/docs/status-indicator.json +80 -32
- package/dist/docs/status-indicator.md +409 -65
- package/dist/docs/stepper.json +53 -21
- package/dist/docs/stepper.md +369 -48
- package/dist/docs/table-of-contents.examples.md +550 -0
- package/dist/docs/table-of-contents.json +60 -28
- package/dist/docs/table-of-contents.md +70 -205
- package/dist/docs/tags-input.examples.md +541 -0
- package/dist/docs/tags-input.json +64 -16
- package/dist/docs/tags-input.md +15 -262
- package/dist/docs/time-field.examples.md +587 -0
- package/dist/docs/time-field.json +69 -29
- package/dist/docs/time-field.md +21 -223
- package/dist/docs/time-picker.json +117 -53
- package/dist/docs/time-picker.md +499 -54
- package/dist/docs/time-range-picker.examples.md +750 -0
- package/dist/docs/time-range-picker.json +139 -75
- package/dist/docs/time-range-picker.md +63 -225
- package/dist/docs/timeline.examples.md +617 -0
- package/dist/docs/timeline.json +44 -28
- package/dist/docs/timeline.md +34 -208
- package/dist/docs/toolbar.json +56 -16
- package/dist/docs/toolbar.md +357 -63
- package/dist/docs/top-navigation.examples.md +1206 -140
- package/dist/docs/top-navigation.json +49 -33
- package/dist/docs/top-navigation.md +87 -36
- package/dist/docs/tour.examples.md +960 -0
- package/dist/docs/tour.json +57 -25
- package/dist/docs/tour.md +60 -244
- package/dist/docs/transfer.examples.md +631 -0
- package/dist/docs/transfer.json +80 -16
- package/dist/docs/transfer.md +41 -170
- package/dist/docs/typography.json +96 -0
- package/dist/docs/typography.md +352 -4
- package/dist/docs/upload.examples.md +555 -53
- package/dist/docs/upload.json +62 -30
- package/dist/docs/upload.md +46 -11
- package/dist/docs/wizard.examples.md +1389 -0
- package/dist/docs/wizard.json +89 -49
- package/dist/docs/wizard.md +122 -263
- package/dist/{entity-picker-CC4VoC3p.js → entity-picker-C78f3Z0o.js} +9 -6
- package/dist/entity-picker.js +1 -1
- package/dist/{event-calendar-CjmF_e0H.js → event-calendar-DJPoCi-O.js} +1 -1
- package/dist/event-calendar.js +1 -1
- package/dist/{filter-bar-B3QJD7SZ.js → filter-bar-D61wiQFP.js} +1 -1
- package/dist/filter-bar.js +1 -1
- package/dist/{import-export-center-CW8YVZev.js → import-export-center-mqvmlzwB.js} +44 -36
- package/dist/import-export-center.js +1 -1
- package/dist/index.js +58 -58
- package/dist/{markdown-BdskE4-L.js → markdown-8CtV4k44.js} +2 -2
- package/dist/markdown.js +1 -1
- package/dist/{media-viewer-zEXcwfEY.js → media-viewer-C_cbuAq-.js} +64 -60
- package/dist/media-viewer.js +2 -2
- package/dist/message-P91bEGyV.js +455 -0
- package/dist/message.js +2 -2
- package/dist/{page-header-DmwBGwlm.js → page-header-jeAIQSZM.js} +103 -108
- package/dist/page-header.js +1 -1
- package/dist/section-CVTQdWBl.js +216 -0
- package/dist/section.js +2 -2
- package/dist/{segmented-control-CbK7SurB.js → segmented-control-BSMVjukr.js} +1 -1
- package/dist/segmented-control.js +1 -1
- package/dist/{side-navigation-CKRETc8E.js → side-navigation-BQzBxz2B.js} +179 -179
- package/dist/side-navigation.js +1 -1
- package/dist/{stat-card-CL3Xe6pV.js → stat-card-BpGZiFbG.js} +12 -14
- package/dist/stat-card.js +1 -1
- package/dist/{stepper-DHdrANZI.js → stepper-Cxb_tHnA.js} +130 -127
- package/dist/stepper.js +2 -2
- package/dist/styles/carousel.css +1 -1
- package/dist/styles/index.css +1 -1
- package/dist/styles.css +1 -1
- package/dist/{timeline-BiL2CXfn.js → timeline-ZngK6zLC.js} +9 -6
- package/dist/timeline.js +1 -1
- package/dist/top-navigation-YSEQzBhD.js +744 -0
- package/dist/top-navigation.js +2 -2
- package/dist/{transfer-sKUvmEKe.js → transfer-Cv5yQuTN.js} +1 -1
- package/dist/transfer.js +1 -1
- package/dist/types/attachment/attachment-parts.d.ts +24 -11
- package/dist/types/attachment/attachment-parts.d.ts.map +1 -1
- package/dist/types/attachment/attachment.d.ts +3 -3
- package/dist/types/attachment/attachment.d.ts.map +1 -1
- package/dist/types/avatar-group/avatar-group.d.ts.map +1 -1
- package/dist/types/carousel/carousel-parts.d.ts +2 -2
- package/dist/types/command-palette/command-palette.d.ts.map +1 -1
- package/dist/types/data-list/data-list.d.ts.map +1 -1
- package/dist/types/detail-panel/detail-panel-parts.d.ts +10 -3
- package/dist/types/detail-panel/detail-panel-parts.d.ts.map +1 -1
- package/dist/types/detail-panel/detail-panel.d.ts.map +1 -1
- package/dist/types/detail-panel/detail-panel.types.d.ts +7 -0
- package/dist/types/detail-panel/detail-panel.types.d.ts.map +1 -1
- package/dist/types/entity-picker/entity-picker.d.ts.map +1 -1
- package/dist/types/import-export-center/import-export-center.d.ts.map +1 -1
- package/dist/types/media-viewer/index.d.ts +2 -2
- package/dist/types/media-viewer/index.d.ts.map +1 -1
- package/dist/types/media-viewer/media-viewer-bar.d.ts +3 -1
- package/dist/types/media-viewer/media-viewer-bar.d.ts.map +1 -1
- package/dist/types/media-viewer/media-viewer.types.d.ts +1 -0
- package/dist/types/media-viewer/media-viewer.types.d.ts.map +1 -1
- package/dist/types/message/message-parts.d.ts +7 -0
- package/dist/types/message/message-parts.d.ts.map +1 -1
- package/dist/types/message/message.d.ts.map +1 -1
- package/dist/types/page-header/page-header-parts.d.ts.map +1 -1
- package/dist/types/section/section-parts.d.ts +16 -8
- package/dist/types/section/section-parts.d.ts.map +1 -1
- package/dist/types/section/section.d.ts.map +1 -1
- package/dist/types/segmented-control/segmented-control-parts.d.ts.map +1 -1
- package/dist/types/side-navigation/side-navigation-parts.d.ts.map +1 -1
- package/dist/types/stat-card/stat-card-delta.d.ts.map +1 -1
- package/dist/types/stat-card/stat-card-parts.d.ts +3 -3
- package/dist/types/stat-card/stat-card-parts.d.ts.map +1 -1
- package/dist/types/stepper/stepper-parts.d.ts +11 -2
- package/dist/types/stepper/stepper-parts.d.ts.map +1 -1
- package/dist/types/stepper/stepper.d.ts.map +1 -1
- package/dist/types/timeline/timeline-parts.d.ts.map +1 -1
- package/dist/types/top-navigation/top-navigation.d.ts.map +1 -1
- package/dist/{wizard-4c0X7Bx_.js → wizard-Dfryz1id.js} +214 -214
- package/dist/wizard.js +1 -1
- package/package.json +6 -6
- package/dist/attachment-MqczA38F.js +0 -292
- package/dist/detail-panel-EImAtksY.js +0 -327
- package/dist/message-D1Dd6Y2k.js +0 -452
- package/dist/section-D_qOfdxR.js +0 -213
- package/dist/top-navigation-D8IHPOmm.js +0 -744
package/dist/docs/calendar.json
CHANGED
|
@@ -169,7 +169,7 @@
|
|
|
169
169
|
"part": "grid",
|
|
170
170
|
"element": "table",
|
|
171
171
|
"required": true,
|
|
172
|
-
"purpose": "One month, carrying role=\"grid\". The row, columnheader and gridcell roles are implied by tr, th and td and are deliberately not written — the
|
|
172
|
+
"purpose": "One month, carrying role=\"grid\". The row, columnheader and gridcell roles are implied by tr, th and td and are deliberately not written — the note of the ARIA Authoring Practices Guide, and the duplication a pattern check refuses."
|
|
173
173
|
},
|
|
174
174
|
{
|
|
175
175
|
"part": "grid-caption",
|
|
@@ -259,13 +259,13 @@
|
|
|
259
259
|
"part": "months",
|
|
260
260
|
"element": "div",
|
|
261
261
|
"required": false,
|
|
262
|
-
"purpose": "The month view’s own grid,
|
|
262
|
+
"purpose": "The month view’s own grid, three across, reached from the heading."
|
|
263
263
|
},
|
|
264
264
|
{
|
|
265
265
|
"part": "years",
|
|
266
266
|
"element": "div",
|
|
267
267
|
"required": false,
|
|
268
|
-
"purpose": "The year view’s own grid,
|
|
268
|
+
"purpose": "The year view’s own grid, three across and twelve to a page. The page is anchored rather than centered, so the year the reader is on keeps its cell between presses."
|
|
269
269
|
},
|
|
270
270
|
{
|
|
271
271
|
"part": "period",
|
|
@@ -406,7 +406,7 @@
|
|
|
406
406
|
"type": "(date, state) => ReactNode",
|
|
407
407
|
"defaultValue": "—",
|
|
408
408
|
"appliesTo": "Calendar",
|
|
409
|
-
"description": "What a day holds under its number: CalendarDayMarks with one CalendarDayMark per record (a tone or data-1 to data-8, hollow for an open record) and a one-line CalendarDayValue. The
|
|
409
|
+
"description": "What a day holds under its number: CalendarDayMarks with one CalendarDayMark per record (a tone or data-1 to data-8, hollow for an open record) and a one-line CalendarDayValue. The calendar keeps the day’s button, focus, selection, today and outside-day states; state is outside, selected, today and unavailable."
|
|
410
410
|
},
|
|
411
411
|
{
|
|
412
412
|
"name": "renderDayTooltip",
|
|
@@ -518,7 +518,7 @@
|
|
|
518
518
|
"type": "Partial<CalendarMessages>",
|
|
519
519
|
"defaultValue": "—",
|
|
520
520
|
"appliesTo": "Calendar",
|
|
521
|
-
"description": "Words laid over the language in force, key by key: the
|
|
521
|
+
"description": "Words laid over the language in force, key by key: the accessible names of the page triggers (previousMonth, nextMonth, previousYear, nextYear, previousYears, nextYears), the text a day adds for its marks (markCount, marked) and the name of the week choice (chooseWeek)."
|
|
522
522
|
}
|
|
523
523
|
],
|
|
524
524
|
"composition": [
|
|
@@ -534,7 +534,7 @@
|
|
|
534
534
|
"type": "(props: CalendarRootProps) => ReactNode",
|
|
535
535
|
"defaultValue": "—",
|
|
536
536
|
"appliesTo": "Calendar",
|
|
537
|
-
"description": "Substitutes the element the root renders. The props carry the ref, which the
|
|
537
|
+
"description": "Substitutes the element the root renders. The props carry the ref, which the calendar reaches its own cells through."
|
|
538
538
|
},
|
|
539
539
|
{
|
|
540
540
|
"name": "ref",
|
|
@@ -548,14 +548,14 @@
|
|
|
548
548
|
"type": "KeyboardEventHandler",
|
|
549
549
|
"defaultValue": "—",
|
|
550
550
|
"appliesTo": "Calendar",
|
|
551
|
-
"description": "Runs before the
|
|
551
|
+
"description": "Runs before the calendar acts, and calling preventDefault stops it acting at all — which is how a surface above the calendar takes a key first."
|
|
552
552
|
}
|
|
553
553
|
],
|
|
554
554
|
"events": [
|
|
555
555
|
{
|
|
556
556
|
"name": "onValueChange",
|
|
557
557
|
"payload": "(value: CalendarValue, request: ChangeRequest<CalendarValue>)",
|
|
558
|
-
"when": "Before the value moves, and cancellable. The request carries the new value, the value it replaces, the reason
|
|
558
|
+
"when": "Before the value moves, and cancellable. The request carries the new value, the value it replaces, the reason (pointer, keyboard, clear or programmatic) and the originating event."
|
|
559
559
|
},
|
|
560
560
|
{
|
|
561
561
|
"name": "onFocusedDateChange",
|
|
@@ -574,7 +574,7 @@
|
|
|
574
574
|
}
|
|
575
575
|
],
|
|
576
576
|
"accessibility": [
|
|
577
|
-
"The grid role is on a real table, so the row, column-header and cell roles are implied by tr, th and td and are deliberately not written — the
|
|
577
|
+
"The grid role is on a real table, so the row, column-header and cell roles are implied by tr, th and td and are deliberately not written — the note of the ARIA Authoring Practices Guide, and the duplication a pattern check exists to refuse.",
|
|
578
578
|
"Exactly one cell is in the tab sequence, and the arrows move it. Focus is only put back into the DOM after a key moved it, never on a render, so a calendar on a page does not steal the reader’s place.",
|
|
579
579
|
"The heading is a polite live region, because paging with a key changes nothing that focus lands on and nothing else would announce the new month.",
|
|
580
580
|
"A column header shows the locale’s narrow weekday and carries the full name in abbr, which is the difference between a screen reader saying \"Mo\" and saying \"Monday\".",
|
|
@@ -688,7 +688,7 @@
|
|
|
688
688
|
"title": "Playground",
|
|
689
689
|
"note": "One calendar with every axis on it, driven by the controls below the canvas. Arrow around it, page with PageUp and PageDown, and press the heading to walk up a view.",
|
|
690
690
|
"language": "tsx",
|
|
691
|
-
"source": "<Calendar aria-label=\"
|
|
691
|
+
"source": "<Calendar aria-label=\"Delivery date\" locale=\"pt-BR\" onValueChange={setValue} value={value} />;\n",
|
|
692
692
|
"verdict": "excerpt"
|
|
693
693
|
},
|
|
694
694
|
{
|
|
@@ -704,32 +704,32 @@
|
|
|
704
704
|
"title": "A run of days",
|
|
705
705
|
"note": "Two presses make a range, and either end may come first: choosing the 11th and then the 7th means the 7th to the 11th. A third press starts again, because a range that only grew could never be narrowed.",
|
|
706
706
|
"language": "tsx",
|
|
707
|
-
"source": "
|
|
708
|
-
"verdict": "
|
|
707
|
+
"source": "import { Calendar } from '@slotted/react/calendar';\nimport { Stack } from '@slotted/react/stack';\nimport { Text } from '@slotted/react/typography';\nimport { plainDate, toISODate, type PlainDate } from '@slotted/core/date';\n\nconst TODAY = plainDate(2026, 10, 14);\nconst LAST_INCLUDED_DAY = '2026-10-18';\n\nconst isOverLimit = (date: PlainDate) => toISODate(date) > LAST_INCLUDED_DAY;\n\nexport default function CalendarRange() {\n return (\n <Stack gap={3}>\n <Calendar\n aria-label=\"Pallet storage period\"\n defaultValue={{ start: plainDate(2026, 10, 12), end: plainDate(2026, 10, 21) }}\n isDateOver={isOverLimit}\n selectionMode=\"range\"\n today={TODAY}\n />\n <Text size=\"sm\" tone=\"muted\">\n The storage contract covers 7 days. Days after October 18 are over the limit.\n </Text>\n </Stack>\n );\n}\n",
|
|
708
|
+
"verdict": "example"
|
|
709
709
|
},
|
|
710
710
|
{
|
|
711
711
|
"id": "views",
|
|
712
712
|
"title": "Day, month and year",
|
|
713
713
|
"note": "Press the heading to walk up and Escape to walk down. A reader entering a birth date must not press \"previous month\" four hundred times, which is what these two views exist to prevent.",
|
|
714
714
|
"language": "tsx",
|
|
715
|
-
"source": "<Calendar defaultView=\"year\"
|
|
716
|
-
"verdict": "
|
|
715
|
+
"source": "import { useState } from 'react';\nimport { Calendar, type CalendarView } from '@slotted/react/calendar';\nimport { Stack } from '@slotted/react/stack';\nimport { Text } from '@slotted/react/typography';\nimport { plainDate } from '@slotted/core/date';\n\nconst TODAY = plainDate(2026, 10, 14);\n\nexport default function CalendarViews() {\n const [view, setView] = useState<CalendarView>('year');\n\n return (\n <Stack gap={3}>\n <Calendar\n aria-label=\"Supplier contract start\"\n defaultValue={plainDate(2023, 3, 15)}\n defaultView=\"year\"\n onViewChange={setView}\n today={TODAY}\n />\n <Text size=\"sm\" tone=\"muted\">\n {`Showing the ${view} view.`}\n </Text>\n </Stack>\n );\n}\n",
|
|
716
|
+
"verdict": "example"
|
|
717
717
|
},
|
|
718
718
|
{
|
|
719
719
|
"id": "months",
|
|
720
720
|
"title": "More than one month",
|
|
721
721
|
"note": "Two or three months side by side, each with its own caption because the heading then names the span. Narrow the stage: a month that no longer fits wraps under the first rather than being withdrawn.",
|
|
722
722
|
"language": "tsx",
|
|
723
|
-
"source": "<Calendar months={2}
|
|
724
|
-
"verdict": "
|
|
723
|
+
"source": "import { Calendar } from '@slotted/react/calendar';\nimport { plainDate } from '@slotted/core/date';\n\nconst TODAY = plainDate(2026, 10, 14);\n\nexport default function CalendarMonths() {\n return (\n <Calendar\n aria-label=\"Seasonal staffing period\"\n defaultValue={{ start: plainDate(2026, 10, 26), end: plainDate(2026, 11, 6) }}\n months={2}\n selectionMode=\"range\"\n today={TODAY}\n />\n );\n}\n",
|
|
724
|
+
"verdict": "example"
|
|
725
725
|
},
|
|
726
726
|
{
|
|
727
727
|
"id": "locale",
|
|
728
728
|
"title": "The locale writes the month",
|
|
729
729
|
"note": "The month name, the weekday names and the day a week starts on all come from Intl. A German week starts on Monday and a Brazilian one on Sunday, from the same component and no table.",
|
|
730
730
|
"language": "tsx",
|
|
731
|
-
"source": "
|
|
732
|
-
"verdict": "
|
|
731
|
+
"source": "import { Calendar } from '@slotted/react/calendar';\nimport { Inline } from '@slotted/react/inline';\nimport { Stack } from '@slotted/react/stack';\nimport { Text } from '@slotted/react/typography';\nimport { plainDate } from '@slotted/core/date';\n\nconst TODAY = plainDate(2026, 10, 14);\n\nexport default function CalendarLocale() {\n return (\n <Inline gap={6}>\n <Stack gap={2}>\n <Text size=\"sm\" tone=\"muted\">\n Hamburg warehouse, de-DE\n </Text>\n <Calendar aria-label=\"Hamburg inbound date\" locale=\"de-DE\" today={TODAY} />\n </Stack>\n <Stack gap={2}>\n <Text size=\"sm\" tone=\"muted\">\n São Paulo warehouse, pt-BR, week from Monday\n </Text>\n <Calendar\n aria-label=\"São Paulo inbound date\"\n firstDayOfWeek={1}\n locale=\"pt-BR\"\n today={TODAY}\n />\n </Stack>\n </Inline>\n );\n}\n",
|
|
732
|
+
"verdict": "example"
|
|
733
733
|
},
|
|
734
734
|
{
|
|
735
735
|
"id": "range-bounds",
|
|
@@ -752,21 +752,21 @@
|
|
|
752
752
|
"title": "Week numbers",
|
|
753
753
|
"note": "ISO 8601 numbering, as a row header separated by a rule. The rule is what keeps the column from reading as an eighth day of the week.",
|
|
754
754
|
"language": "tsx",
|
|
755
|
-
"source": "<Calendar
|
|
756
|
-
"verdict": "
|
|
755
|
+
"source": "import { Calendar } from '@slotted/react/calendar';\nimport { plainDate } from '@slotted/core/date';\n\nconst TODAY = plainDate(2026, 10, 14);\n\nexport default function CalendarWeekNumbers() {\n return (\n <Calendar\n aria-label=\"Reporting weeks\"\n defaultValue={{ start: plainDate(2026, 10, 12), end: plainDate(2026, 10, 18) }}\n firstDayOfWeek={1}\n fixedWeeks\n selectionMode=\"range\"\n today={TODAY}\n weekNumbers\n />\n );\n}\n",
|
|
756
|
+
"verdict": "example"
|
|
757
757
|
},
|
|
758
758
|
{
|
|
759
759
|
"id": "states",
|
|
760
760
|
"title": "States",
|
|
761
761
|
"note": "Read-only keeps the value legible and answers nothing; disabled takes every cell out of the tab sequence and paints today in the disabled ink; invalid retargets the focus ring rather than removing it.",
|
|
762
762
|
"language": "tsx",
|
|
763
|
-
"source": "
|
|
764
|
-
"verdict": "
|
|
763
|
+
"source": "import { Calendar } from '@slotted/react/calendar';\nimport { Inline } from '@slotted/react/inline';\nimport { Stack } from '@slotted/react/stack';\nimport { Text } from '@slotted/react/typography';\nimport { plainDate } from '@slotted/core/date';\n\nconst TODAY = plainDate(2026, 10, 14);\nconst VALUE = plainDate(2026, 10, 20);\n\nexport default function CalendarStates() {\n return (\n <Inline gap={6}>\n <Stack gap={2}>\n <Text size=\"sm\" tone=\"muted\">\n readOnly, set by the carrier\n </Text>\n <Calendar aria-label=\"Confirmed pickup\" defaultValue={VALUE} readOnly today={TODAY} />\n </Stack>\n <Stack gap={2}>\n <Text size=\"sm\" tone=\"muted\">\n invalid, no slot left\n </Text>\n <Calendar aria-label=\"Requested pickup\" defaultValue={VALUE} invalid today={TODAY} />\n </Stack>\n <Stack gap={2}>\n <Text size=\"sm\" tone=\"muted\">\n disabled, order shipped\n </Text>\n <Calendar aria-label=\"Shipped pickup\" defaultValue={VALUE} disabled today={TODAY} />\n </Stack>\n </Inline>\n );\n}\n",
|
|
764
|
+
"verdict": "example"
|
|
765
765
|
},
|
|
766
766
|
{
|
|
767
767
|
"id": "density",
|
|
768
768
|
"title": "Density and width",
|
|
769
|
-
"note": "Seven columns of two-digit numbers make this the densest grid
|
|
769
|
+
"note": "Seven columns of two-digit numbers make this the densest grid Slotted draws. Switch the toolbar to dense and narrow the stage: the cell is the room there is divided by the columns there are, bounded by the WCAG minimum below.",
|
|
770
770
|
"language": "tsx",
|
|
771
771
|
"source": "<Calendar fixedWeeks />;\n",
|
|
772
772
|
"verdict": "excerpt"
|
|
@@ -784,8 +784,56 @@
|
|
|
784
784
|
"title": "The keyboard",
|
|
785
785
|
"note": "Every key the APG grid pattern lists, including the two a month grid needs that a list does not: PageUp and PageDown move a month, and Shift with either moves a year.",
|
|
786
786
|
"language": "tsx",
|
|
787
|
-
"source": "// ArrowLeft / ArrowRight a day, mirrored under dir=\"rtl\"\n// ArrowUp / ArrowDown the same weekday, a week either way\n// Home / End the first and last day of the displayed week\n// PageUp / PageDown a month, clamped to the last day it has\n// Shift + PageUp / Down a year, on the same terms\n// Enter / Space chooses the date focus is on\n// Escape walks down a view, and
|
|
787
|
+
"source": "// ArrowLeft / ArrowRight a day, mirrored under dir=\"rtl\"\n// ArrowUp / ArrowDown the same weekday, a week either way\n// Home / End the first and last day of the displayed week\n// PageUp / PageDown a month, clamped to the last day it has\n// Shift + PageUp / Down a year, on the same terms\n// Enter / Space chooses the date focus is on\n// Escape walks down a view, and does nothing in the day view\n",
|
|
788
788
|
"verdict": "excerpt"
|
|
789
|
+
},
|
|
790
|
+
{
|
|
791
|
+
"id": "basic",
|
|
792
|
+
"title": "basic.tsx",
|
|
793
|
+
"note": null,
|
|
794
|
+
"language": "tsx",
|
|
795
|
+
"source": "import { Calendar } from '@slotted/react/calendar';\nimport { plainDate } from '@slotted/core/date';\n\nconst TODAY = plainDate(2026, 10, 14);\n\nexport default function CalendarBasic() {\n return (\n <Calendar aria-label=\"Delivery date\" defaultValue={plainDate(2026, 10, 20)} today={TODAY} />\n );\n}\n",
|
|
796
|
+
"verdict": "example"
|
|
797
|
+
},
|
|
798
|
+
{
|
|
799
|
+
"id": "bounds",
|
|
800
|
+
"title": "bounds.tsx",
|
|
801
|
+
"note": null,
|
|
802
|
+
"language": "tsx",
|
|
803
|
+
"source": "import { Calendar } from '@slotted/react/calendar';\nimport { dayOfWeek, plainDate, toISODate, type PlainDate } from '@slotted/core/date';\n\nconst TODAY = plainDate(2026, 10, 14);\n\n/** Columbus Day, 2026. */\nconst HOLIDAYS = new Set(['2026-10-12']);\n\nconst isClosed = (date: PlainDate) =>\n dayOfWeek(date) === 0 || dayOfWeek(date) === 6 || HOLIDAYS.has(toISODate(date));\n\nexport default function CalendarBounds() {\n return (\n <Calendar\n aria-label=\"Pickup date\"\n defaultValue={plainDate(2026, 10, 15)}\n isDateUnavailable={isClosed}\n max={plainDate(2026, 10, 30)}\n min={plainDate(2026, 10, 5)}\n today={TODAY}\n />\n );\n}\n",
|
|
804
|
+
"verdict": "example"
|
|
805
|
+
},
|
|
806
|
+
{
|
|
807
|
+
"id": "controlled",
|
|
808
|
+
"title": "controlled.tsx",
|
|
809
|
+
"note": null,
|
|
810
|
+
"language": "tsx",
|
|
811
|
+
"source": "import { useState } from 'react';\nimport { Button } from '@slotted/react/button';\nimport { asDates, Calendar } from '@slotted/react/calendar';\nimport { Inline } from '@slotted/react/inline';\nimport { Stack } from '@slotted/react/stack';\nimport { Text } from '@slotted/react/typography';\nimport { createDateFormat, plainDate, type PlainDate } from '@slotted/core/date';\n\nconst TODAY = plainDate(2026, 10, 14);\nconst words = createDateFormat({ locale: 'en-US' });\n\nexport default function CalendarControlled() {\n const [counts, setCounts] = useState<PlainDate[]>([\n plainDate(2026, 10, 8),\n plainDate(2026, 10, 22),\n ]);\n\n return (\n <Stack gap={3}>\n <Calendar\n aria-label=\"Cycle count days\"\n onValueChange={(value) => setCounts(asDates(value))}\n selectionMode=\"multiple\"\n today={TODAY}\n value={counts}\n />\n <Text size=\"sm\" tone=\"muted\">\n {counts.length === 0\n ? 'No cycle counts scheduled.'\n : `Cycle counts on ${counts.map((date) => words.describe(date)).join('; ')}.`}\n </Text>\n <Inline gap={2}>\n <Button size=\"sm\" tone=\"secondary\" variant=\"ghost\" onClick={() => setCounts([])}>\n Clear all\n </Button>\n </Inline>\n </Stack>\n );\n}\n",
|
|
812
|
+
"verdict": "example"
|
|
813
|
+
},
|
|
814
|
+
{
|
|
815
|
+
"id": "fill",
|
|
816
|
+
"title": "fill.tsx",
|
|
817
|
+
"note": null,
|
|
818
|
+
"language": "tsx",
|
|
819
|
+
"source": "import {\n Calendar,\n CalendarDayMark,\n CalendarDayMarks,\n CalendarDayValue,\n} from '@slotted/react/calendar';\nimport { plainDate, toISODate, type PlainDate } from '@slotted/core/date';\n\ntype DataTone = 'data-1' | 'data-2' | 'data-3';\n\ninterface Ledger {\n readonly total: string;\n readonly entries: readonly { readonly tone: DataTone; readonly open?: boolean }[];\n}\n\nconst TODAY = plainDate(2026, 10, 14);\n\nconst LEDGER = new Map<string, Ledger>([\n ['2026-10-06', { total: '4,200', entries: [{ tone: 'data-1' }, { tone: 'data-2' }] }],\n ['2026-10-14', { total: '1,150', entries: [{ tone: 'data-3' }] }],\n ['2026-10-20', { total: '9,800', entries: [{ tone: 'data-1' }, { tone: 'data-2', open: true }] }],\n ['2026-10-27', { total: '640', entries: [{ tone: 'data-2', open: true }] }],\n]);\n\nexport default function CalendarFill() {\n return (\n <Calendar\n aria-label=\"Receivables by due date\"\n dayAlign=\"start\"\n defaultValue={plainDate(2026, 10, 20)}\n layout=\"fill\"\n lines\n outsideDays=\"hidden\"\n renderDay={renderLedger}\n today={TODAY}\n todayMark=\"disc\"\n />\n );\n}\n\nfunction renderLedger(date: PlainDate) {\n const ledger = LEDGER.get(toISODate(date));\n\n if (ledger === undefined) return null;\n\n return (\n <>\n <CalendarDayValue>{ledger.total}</CalendarDayValue>\n <CalendarDayMarks>\n {ledger.entries.map((entry, index) => (\n <CalendarDayMark hollow={entry.open} key={index} tone={entry.tone} />\n ))}\n </CalendarDayMarks>\n </>\n );\n}\n",
|
|
820
|
+
"verdict": "example"
|
|
821
|
+
},
|
|
822
|
+
{
|
|
823
|
+
"id": "marks",
|
|
824
|
+
"title": "marks.tsx",
|
|
825
|
+
"note": null,
|
|
826
|
+
"language": "tsx",
|
|
827
|
+
"source": "import { Calendar, type CalendarMark } from '@slotted/react/calendar';\nimport { plainDate, toISODate, type PlainDate } from '@slotted/core/date';\n\nconst TODAY = plainDate(2026, 10, 14);\n\nconst SHIPMENTS: ReadonlyMap<string, CalendarMark> = new Map([\n ['2026-10-06', { count: 2, tone: 'success' }],\n ['2026-10-08', { count: 1, tone: 'info' }],\n ['2026-10-13', { count: 3, tone: 'warning' }],\n ['2026-10-15', { count: 1, tone: 'danger' }],\n ['2026-10-20', { count: 2, tone: 'accent' }],\n ['2026-10-22', { count: 1, tone: 'success' }],\n]);\n\nconst hasNoShipment = (date: PlainDate) => !SHIPMENTS.has(toISODate(date));\n\nexport default function CalendarMarks() {\n return (\n <Calendar\n aria-label=\"Inbound shipments\"\n isDateInert={hasNoShipment}\n marks={SHIPMENTS}\n outsideDays=\"hidden\"\n today={TODAY}\n />\n );\n}\n",
|
|
828
|
+
"verdict": "example"
|
|
829
|
+
},
|
|
830
|
+
{
|
|
831
|
+
"id": "outside-days",
|
|
832
|
+
"title": "outside-days.tsx",
|
|
833
|
+
"note": null,
|
|
834
|
+
"language": "tsx",
|
|
835
|
+
"source": "import { Calendar } from '@slotted/react/calendar';\nimport { Inline } from '@slotted/react/inline';\nimport { Stack } from '@slotted/react/stack';\nimport { Text } from '@slotted/react/typography';\nimport { plainDate } from '@slotted/core/date';\n\nconst TODAY = plainDate(2026, 10, 14);\n\nexport default function CalendarOutsideDays() {\n return (\n <Inline gap={6}>\n <Stack gap={2}>\n <Text size=\"sm\" tone=\"muted\">\n shown\n </Text>\n <Calendar\n aria-label=\"Dispatch date, outside days shown\"\n outsideDays=\"shown\"\n today={TODAY}\n />\n </Stack>\n <Stack gap={2}>\n <Text size=\"sm\" tone=\"muted\">\n selectable\n </Text>\n <Calendar\n aria-label=\"Dispatch date, outside days selectable\"\n outsideDays=\"selectable\"\n today={TODAY}\n />\n </Stack>\n <Stack gap={2}>\n <Text size=\"sm\" tone=\"muted\">\n hidden\n </Text>\n <Calendar\n aria-label=\"Dispatch date, outside days hidden\"\n outsideDays=\"hidden\"\n today={TODAY}\n />\n </Stack>\n </Inline>\n );\n}\n",
|
|
836
|
+
"verdict": "example"
|
|
789
837
|
}
|
|
790
838
|
]
|
|
791
839
|
}
|
package/dist/docs/calendar.md
CHANGED
|
@@ -11,10 +11,19 @@ import { Calendar, CalendarDefaultsProvider } from '@slotted/react';
|
|
|
11
11
|
|
|
12
12
|
## Minimal example
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Example
|
|
15
15
|
|
|
16
16
|
```tsx
|
|
17
|
-
|
|
17
|
+
import { Calendar } from '@slotted/react/calendar';
|
|
18
|
+
import { plainDate } from '@slotted/core/date';
|
|
19
|
+
|
|
20
|
+
const TODAY = plainDate(2026, 10, 14);
|
|
21
|
+
|
|
22
|
+
export default function CalendarBasic() {
|
|
23
|
+
return (
|
|
24
|
+
<Calendar aria-label="Delivery date" defaultValue={plainDate(2026, 10, 20)} today={TODAY} />
|
|
25
|
+
);
|
|
26
|
+
}
|
|
18
27
|
```
|
|
19
28
|
|
|
20
29
|
## Anatomy
|
|
@@ -70,7 +79,7 @@ Excerpt — not a complete module
|
|
|
70
79
|
| `fixedWeeks` | `boolean` | false | Calendar | Always six rows, so paging does not change the surface’s height. Worth setting inside a popover. |
|
|
71
80
|
| `outsideDays` | `'shown' \| 'selectable' \| 'hidden'` | shown | Calendar | What a day of the month either side does: drawn and not pressable, drawn and pressable, or not drawn. |
|
|
72
81
|
| `marks` | `ReadonlyMap<string, CalendarMark>` | — | Calendar | What falls on each day, keyed by its ISO date: a dot under the number in the mark’s tone, and its count in the day’s accessible name (“12, 2 items”). Composes with every selection mode, min, max and outsideDays. |
|
|
73
|
-
| `renderDay` | `(date, state) => ReactNode` | — | Calendar | What a day holds under its number: CalendarDayMarks with one CalendarDayMark per record (a tone or data-1 to data-8, hollow for an open record) and a one-line CalendarDayValue. The
|
|
82
|
+
| `renderDay` | `(date, state) => ReactNode` | — | Calendar | What a day holds under its number: CalendarDayMarks with one CalendarDayMark per record (a tone or data-1 to data-8, hollow for an open record) and a one-line CalendarDayValue. The calendar keeps the day’s button, focus, selection, today and outside-day states; state is outside, selected, today and unavailable. |
|
|
74
83
|
| `renderDayTooltip` | `(date, state) => ReactNode` | — | Calendar | What a tooltip says of a day, with the day as its trigger: it opens on hover and on the keyboard focus, and describes the day. Nothing returned draws no tooltip. |
|
|
75
84
|
| `dayLabel` | `(date) => string` | — | Calendar | Replaces the day’s generated accessible name, for a day whose content says more than a count. |
|
|
76
85
|
| `layout` | `'cells' \| 'fill'` | cells | Calendar | cells draws square cells of --slotted-calendar-cell-size; fill shares the inline size between the seven columns and takes the row height from --slotted-calendar-day-height. |
|
|
@@ -86,17 +95,17 @@ Excerpt — not a complete module
|
|
|
86
95
|
| `disabled` | `boolean` | — | Calendar | Answers no key and no press, and takes every cell out of the tab sequence. |
|
|
87
96
|
| `readOnly` | `boolean` | — | Calendar | Readable and not changeable, and never faded. |
|
|
88
97
|
| `invalid` | `boolean` | — | Calendar | Retargets the focus ring to the danger color. |
|
|
89
|
-
| `messages` | `Partial<CalendarMessages>` | — | Calendar | Words laid over the language in force, key by key: the
|
|
98
|
+
| `messages` | `Partial<CalendarMessages>` | — | Calendar | Words laid over the language in force, key by key: the accessible names of the page triggers (previousMonth, nextMonth, previousYear, nextYear, previousYears, nextYears), the text a day adds for its marks (markCount, marked) and the name of the week choice (chooseWeek). |
|
|
90
99
|
| `CalendarDefaultsProvider` | `component` | — | application | Sets timeZone, today, firstDayOfWeek, months, weekNumbers, fixedWeeks, outsideDays and calendar once for everything under it; a prop on the calendar still wins. |
|
|
91
|
-
| `render` | `(props: CalendarRootProps) => ReactNode` | — | Calendar | Substitutes the element the root renders. The props carry the ref, which the
|
|
100
|
+
| `render` | `(props: CalendarRootProps) => ReactNode` | — | Calendar | Substitutes the element the root renders. The props carry the ref, which the calendar reaches its own cells through. |
|
|
92
101
|
| `ref` | `Ref<CalendarHandle>` | — | Calendar | focus() puts the reader on the cell holding the tab stop; focusDate() moves them to a date, paging the grid to reach it. |
|
|
93
|
-
| `onKeyDown` | `KeyboardEventHandler` | — | Calendar | Runs before the
|
|
102
|
+
| `onKeyDown` | `KeyboardEventHandler` | — | Calendar | Runs before the calendar acts, and calling preventDefault stops it acting at all — which is how a surface above the calendar takes a key first. |
|
|
94
103
|
|
|
95
104
|
## Events
|
|
96
105
|
|
|
97
106
|
| Name | Payload | When |
|
|
98
107
|
| --- | --- | --- |
|
|
99
|
-
| `onValueChange` | `(value: CalendarValue, request: ChangeRequest<CalendarValue>)` | Before the value moves, and cancellable. The request carries the new value, the value it replaces, the reason
|
|
108
|
+
| `onValueChange` | `(value: CalendarValue, request: ChangeRequest<CalendarValue>)` | Before the value moves, and cancellable. The request carries the new value, the value it replaces, the reason (pointer, keyboard, clear or programmatic) and the originating event. |
|
|
100
109
|
| `onFocusedDateChange` | `(date: PlainDate, request: ChangeRequest<PlainDate>)` | Before the date the reader is on moves, and cancellable. It fires for every arrow and every page, which is what lets a consumer load a month before it is shown. |
|
|
101
110
|
| `onViewChange` | `(view: CalendarView)` | When the heading walks up a view or Escape walks down one. |
|
|
102
111
|
| `onPageChange` | `(month: PlainYearMonth)` | When the first month on screen changes, for a month control beside the calendar. |
|
|
@@ -117,7 +126,7 @@ Excerpt — not a complete module
|
|
|
117
126
|
|
|
118
127
|
## Rules
|
|
119
128
|
|
|
120
|
-
- The grid role is on a real table, so the row, column-header and cell roles are implied by tr, th and td and are deliberately not written — the
|
|
129
|
+
- The grid role is on a real table, so the row, column-header and cell roles are implied by tr, th and td and are deliberately not written — the note of the ARIA Authoring Practices Guide, and the duplication a pattern check exists to refuse.
|
|
121
130
|
- Exactly one cell is in the tab sequence, and the arrows move it. Focus is only put back into the DOM after a key moved it, never on a render, so a calendar on a page does not steal the reader’s place.
|
|
122
131
|
- The heading is a polite live region, because paging with a key changes nothing that focus lands on and nothing else would announce the new month.
|
|
123
132
|
- A column header shows the locale’s narrow weekday and carries the full name in abbr, which is the difference between a screen reader saying "Mo" and saying "Monday".
|
|
@@ -130,142 +139,4 @@ Excerpt — not a complete module
|
|
|
130
139
|
|
|
131
140
|
## Examples
|
|
132
141
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
The default mode. Pressing the chosen date again takes it back, which is the only way to empty the value without a control of its own.
|
|
136
|
-
|
|
137
|
-
Excerpt — not a complete module
|
|
138
|
-
|
|
139
|
-
```tsx
|
|
140
|
-
<Calendar selectionMode="single" value={value} onValueChange={setValue} />;
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
### A run of days
|
|
144
|
-
|
|
145
|
-
Two presses make a range, and either end may come first: choosing the 11th and then the 7th means the 7th to the 11th. A third press starts again, because a range that only grew could never be narrowed.
|
|
146
|
-
|
|
147
|
-
Excerpt — not a complete module
|
|
148
|
-
|
|
149
|
-
```tsx
|
|
150
|
-
<>
|
|
151
|
-
<Calendar selectionMode="range" value={run} onValueChange={setRun} />
|
|
152
|
-
<Calendar selectionMode="multiple" value={dates} onValueChange={setDates} />
|
|
153
|
-
</>;
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
### Day, month and year
|
|
157
|
-
|
|
158
|
-
Press the heading to walk up and Escape to walk down. A reader entering a birth date must not press "previous month" four hundred times, which is what these two views exist to prevent.
|
|
159
|
-
|
|
160
|
-
Excerpt — not a complete module
|
|
161
|
-
|
|
162
|
-
```tsx
|
|
163
|
-
<Calendar defaultView="year" onViewChange={setView} />;
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
### More than one month
|
|
167
|
-
|
|
168
|
-
Two or three months side by side, each with its own caption because the heading then names the span. Narrow the stage: a month that no longer fits wraps under the first rather than being withdrawn.
|
|
169
|
-
|
|
170
|
-
Excerpt — not a complete module
|
|
171
|
-
|
|
172
|
-
```tsx
|
|
173
|
-
<Calendar months={2} selectionMode="range" />;
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
### The locale writes the month
|
|
177
|
-
|
|
178
|
-
The month name, the weekday names and the day a week starts on all come from Intl. A German week starts on Monday and a Brazilian one on Sunday, from the same component and no table.
|
|
179
|
-
|
|
180
|
-
Excerpt — not a complete module
|
|
181
|
-
|
|
182
|
-
```tsx
|
|
183
|
-
<>
|
|
184
|
-
<Calendar locale="pt-BR" />
|
|
185
|
-
<Calendar locale="de-DE" />
|
|
186
|
-
<Calendar locale="ja-JP" />
|
|
187
|
-
<Calendar locale="pt-BR" firstDayOfWeek={1} />
|
|
188
|
-
</>;
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
### Bounds
|
|
192
|
-
|
|
193
|
-
min and max fence what the reader may reach: an arrow that would leave the range stops at the edge, and a date outside it cannot be pressed at all.
|
|
194
|
-
|
|
195
|
-
Excerpt — not a complete module
|
|
196
|
-
|
|
197
|
-
```tsx
|
|
198
|
-
<Calendar max={{ year: 2026, month: 9, day: 30 }} min={{ year: 2026, month: 9, day: 1 }} />;
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
### Days that are refused
|
|
202
|
-
|
|
203
|
-
A refused date stays focusable — aria-disabled, never disabled — so a reader can arrow onto it, be told why it is out, and arrow past. Struck through rather than only faded, because color alone says nothing under forced colors.
|
|
204
|
-
|
|
205
|
-
Excerpt — not a complete module
|
|
206
|
-
|
|
207
|
-
```tsx
|
|
208
|
-
<Calendar isDateUnavailable={(date) => isWeekend(date) || isHoliday(date)} />;
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
### Week numbers
|
|
212
|
-
|
|
213
|
-
ISO 8601 numbering, as a row header separated by a rule. The rule is what keeps the column from reading as an eighth day of the week.
|
|
214
|
-
|
|
215
|
-
Excerpt — not a complete module
|
|
216
|
-
|
|
217
|
-
```tsx
|
|
218
|
-
<Calendar fixedWeeks firstDayOfWeek={1} weekNumbers />;
|
|
219
|
-
```
|
|
220
|
-
|
|
221
|
-
### States
|
|
222
|
-
|
|
223
|
-
Read-only keeps the value legible and answers nothing; disabled takes every cell out of the tab sequence and paints today in the disabled ink; invalid retargets the focus ring rather than removing it.
|
|
224
|
-
|
|
225
|
-
Excerpt — not a complete module
|
|
226
|
-
|
|
227
|
-
```tsx
|
|
228
|
-
<>
|
|
229
|
-
<Calendar readOnly />
|
|
230
|
-
<Calendar invalid />
|
|
231
|
-
<Calendar disabled />
|
|
232
|
-
</>;
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
### Density and width
|
|
236
|
-
|
|
237
|
-
Seven columns of two-digit numbers make this the densest grid the library draws. Switch the toolbar to dense and narrow the stage: the cell is the room there is divided by the columns there are, bounded by the WCAG minimum below.
|
|
238
|
-
|
|
239
|
-
Excerpt — not a complete module
|
|
240
|
-
|
|
241
|
-
```tsx
|
|
242
|
-
<Calendar fixedWeeks />;
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
### Composition and escape hatches
|
|
246
|
-
|
|
247
|
-
A provider sets the shape once, SlottedProvider the language; focusedDate is a value of its own a consumer may own; and the ref hands back focus() and focusDate(), which page the grid to reach a date.
|
|
248
|
-
|
|
249
|
-
Excerpt — not a complete module
|
|
250
|
-
|
|
251
|
-
```tsx
|
|
252
|
-
<CalendarDefaultsProvider fixedWeeks>
|
|
253
|
-
<Calendar focusedDate={focused} onFocusedDateChange={setFocused} ref={handle} />
|
|
254
|
-
</CalendarDefaultsProvider>;
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
### The keyboard
|
|
258
|
-
|
|
259
|
-
Every key the APG grid pattern lists, including the two a month grid needs that a list does not: PageUp and PageDown move a month, and Shift with either moves a year.
|
|
260
|
-
|
|
261
|
-
Excerpt — not a complete module
|
|
262
|
-
|
|
263
|
-
```tsx
|
|
264
|
-
// ArrowLeft / ArrowRight a day, mirrored under dir="rtl"
|
|
265
|
-
// ArrowUp / ArrowDown the same weekday, a week either way
|
|
266
|
-
// Home / End the first and last day of the displayed week
|
|
267
|
-
// PageUp / PageDown a month, clamped to the last day it has
|
|
268
|
-
// Shift + PageUp / Down a year, on the same terms
|
|
269
|
-
// Enter / Space chooses the date focus is on
|
|
270
|
-
// Escape walks down a view, and out of nothing
|
|
271
|
-
```
|
|
142
|
+
See [calendar.examples.md](./calendar.examples.md).
|