@orbitcommerce/constellation-docs 0.0.0-stage → 1.2.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/LICENSE.md +6 -0
- package/README.md +6 -2
- package/dist/docs.css +20787 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +308 -0
- package/dist/pages/Playground-Mk1yIWXb.js +129 -0
- package/dist/pages/_address-data-L9BR499w.js +161 -0
- package/dist/pages/_builder-demo-C0eJUmPU.js +282 -0
- package/dist/pages/_card-art-0be5ncyV.js +18 -0
- package/dist/pages/_conversation-samples-Bq7cn-4d.js +70 -0
- package/dist/pages/_figures-data-DaDvB7Nm.js +606 -0
- package/dist/pages/_foundations-blXWyYh8.js +30 -0
- package/dist/pages/_kpi-examples-DeGCBB9T.js +208 -0
- package/dist/pages/_overlays-specimens-bawR331Z.js +320 -0
- package/dist/pages/_preview-specimens-DKQC9HAo.js +153 -0
- package/dist/pages/accordion-Sg0TUqxB.js +1036 -0
- package/dist/pages/address-autocomplete-DP0PUOlK.js +360 -0
- package/dist/pages/address-block-BZOOOPA9.js +368 -0
- package/dist/pages/address-fields-CwSqro3W.js +277 -0
- package/dist/pages/ai-highlight-D3x2vD83.js +642 -0
- package/dist/pages/alert-D3i7xZTU.js +914 -0
- package/dist/pages/anchored-overlay-BV0OCu2Q.js +788 -0
- package/dist/pages/app-shell-D4hdlHps.js +1558 -0
- package/dist/pages/area-chart-BEWFwiB2.js +718 -0
- package/dist/pages/avatar-BFEqQViw.js +895 -0
- package/dist/pages/avatar-upload-BDCzJfyN.js +484 -0
- package/dist/pages/badge-0-PyMrih.js +1035 -0
- package/dist/pages/bar-chart-DkLogYlt.js +1060 -0
- package/dist/pages/bar-fold-B-3XeIDZ.js +360 -0
- package/dist/pages/board-card-D2tZY_mU.js +415 -0
- package/dist/pages/brand-mark-BqiLvFSR.js +417 -0
- package/dist/pages/button-DAyfssDY.js +715 -0
- package/dist/pages/calendar-Ds7KsgSI.js +682 -0
- package/dist/pages/canvas-stage-1KiPspkX.js +472 -0
- package/dist/pages/card-CQEM1_wc.js +1567 -0
- package/dist/pages/caret-suggestions-oHI6QvqW.js +526 -0
- package/dist/pages/chart-legend-B20AbakD.js +724 -0
- package/dist/pages/chat-composer-CwzUJYIa.js +437 -0
- package/dist/pages/checkbox-BG9Zkb6j.js +1581 -0
- package/dist/pages/checklist-card-DEyykVFS.js +783 -0
- package/dist/pages/chip-Ck-o3Ui6.js +839 -0
- package/dist/pages/chip-list-k1LxXuCi.js +414 -0
- package/dist/pages/clamp-text-n-iE8RDR.js +203 -0
- package/dist/pages/coachmark-Be2ghobT.js +366 -0
- package/dist/pages/code-block-Dv_Y5GYq.js +622 -0
- package/dist/pages/collab-field-CfqqK7d2.js +696 -0
- package/dist/pages/color-field-CZpfcA-A.js +1127 -0
- package/dist/pages/colour-q2ntvI0w.js +1974 -0
- package/dist/pages/column-mapper-TsTG39cl.js +502 -0
- package/dist/pages/combobox-DvK2j5tI.js +1334 -0
- package/dist/pages/command-palette-CJ7uBA04.js +1386 -0
- package/dist/pages/comment-box-CDSGYhr5.js +346 -0
- package/dist/pages/composer-D4B0NgpA.js +689 -0
- package/dist/pages/condition-builder-BZy2ZGXe.js +715 -0
- package/dist/pages/conflict-chooser-C--_9UIS.js +210 -0
- package/dist/pages/context-menu-F9DV30ia.js +487 -0
- package/dist/pages/copy-button-Cn7WiKRF.js +568 -0
- package/dist/pages/copy-field-D3Xt3Jq6.js +511 -0
- package/dist/pages/danger-zone-Db_UUeiP.js +564 -0
- package/dist/pages/date-input-GOW067EB.js +956 -0
- package/dist/pages/date-picker-GdBciR99.js +1569 -0
- package/dist/pages/date-time-BLKCXtVZ.js +678 -0
- package/dist/pages/delta-CNAGv8JY.js +779 -0
- package/dist/pages/description-list-BPeXn1eW.js +1268 -0
- package/dist/pages/device-switcher-BCaN99c1.js +554 -0
- package/dist/pages/dialog-CRpkRC98.js +3164 -0
- package/dist/pages/docs-lM2UBSir.js +520 -0
- package/dist/pages/doodle-nzkqi2UI.js +201 -0
- package/dist/pages/drag-ghost-B6kpzC3O.js +426 -0
- package/dist/pages/drill-menu-cskH5mol.js +490 -0
- package/dist/pages/dropzone-DOY_Rhw0.js +1069 -0
- package/dist/pages/element-toolbar-DZIhXlCJ.js +498 -0
- package/dist/pages/emoji-picker-CqaWaffD.js +235 -0
- package/dist/pages/empty-state-4U2txFpI.js +1113 -0
- package/dist/pages/facet-filters-McbBeY9e.js +353 -0
- package/dist/pages/figure-D-HF5vCj.js +563 -0
- package/dist/pages/figure-strip-BB3mNl7D.js +1364 -0
- package/dist/pages/figure-tabs-QOeQMY6N.js +578 -0
- package/dist/pages/file-chip-DMDjtlqQ.js +738 -0
- package/dist/pages/filter-pill-DzqNOsD4.js +1295 -0
- package/dist/pages/font-picker-Bqhu0QMh.js +416 -0
- package/dist/pages/form-grid-BfWCVlie.js +692 -0
- package/dist/pages/gallery-BBk2EOri.js +453 -0
- package/dist/pages/gif-picker-CnoDTCaL.js +270 -0
- package/dist/pages/gradient-editor-Bqxp7Fxj.js +378 -0
- package/dist/pages/grouped-checklist-gNZ0tBKU.js +477 -0
- package/dist/pages/heatmap-BohgIcNk.js +507 -0
- package/dist/pages/highlight-text-BfxzfmvS.js +287 -0
- package/dist/pages/home-dashboard-CxPmvduE.js +962 -0
- package/dist/pages/host-B6znjEgQ.js +109 -0
- package/dist/pages/hosted-embed-Jef3aIMP.js +163 -0
- package/dist/pages/hosted-field-BLh-53AE.js +208 -0
- package/dist/pages/hosted-field-DEpI4lVS.js +514 -0
- package/dist/pages/icon-button-Bu4Gj5sy.js +1200 -0
- package/dist/pages/icon-picker-DEyoMUTh.js +291 -0
- package/dist/pages/icon-tile-DcgxyXPF.js +592 -0
- package/dist/pages/icons-CJ9Aar3d.js +736 -0
- package/dist/pages/image-cropper-NyougqLH.js +466 -0
- package/dist/pages/image-field-7knBv4mJ.js +567 -0
- package/dist/pages/import-result-CmTtGXW_.js +486 -0
- package/dist/pages/inline-confirm-CEcI5Lxo.js +327 -0
- package/dist/pages/inline-edit-Ba39SzhM.js +1125 -0
- package/dist/pages/input-CzLCzfyx.js +2372 -0
- package/dist/pages/installation-C3UcpQJT.js +528 -0
- package/dist/pages/job-indicator-DOXWbFdl.js +755 -0
- package/dist/pages/kanban-Dy9sPAI0.js +740 -0
- package/dist/pages/kbd-UNj4zqxn.js +545 -0
- package/dist/pages/layout-primitives-CPRaZeyt.js +483 -0
- package/dist/pages/line-chart-CntWxeMF.js +1117 -0
- package/dist/pages/link-CXqvAg9z.js +689 -0
- package/dist/pages/link-picker-BMFGCC67.js +478 -0
- package/dist/pages/link-row-x8yaUuWc.js +595 -0
- package/dist/pages/live-globe-95ROMhGQ.js +715 -0
- package/dist/pages/loading-overlay-BeGuXM9G.js +456 -0
- package/dist/pages/loading-state-BNbCo51C.js +556 -0
- package/dist/pages/log-viewer-BQz8I_a2.js +503 -0
- package/dist/pages/logo-B38rnzoq.js +571 -0
- package/dist/pages/lottie_light-CxEH8eiR.js +9116 -0
- package/dist/pages/markdown-Ied72vMT.js +237 -0
- package/dist/pages/markdown-field-BfnIEKZH.js +193 -0
- package/dist/pages/media-banner-DkStCia0.js +233 -0
- package/dist/pages/menu-NrLYKqKp.js +2132 -0
- package/dist/pages/message-thread-Bo4zbxqu.js +731 -0
- package/dist/pages/meta-line-D5p2TycR.js +371 -0
- package/dist/pages/model-viewer-BfokvHoc.js +60288 -0
- package/dist/pages/model-viewer-C8PFO8wk.js +577 -0
- package/dist/pages/month-calendar-T1vw9Rup.js +457 -0
- package/dist/pages/motion-CrXtiBvA.js +865 -0
- package/dist/pages/number-input-CuyMZg18.js +968 -0
- package/dist/pages/orbit-loader-DeVBtkFE.js +219 -0
- package/dist/pages/orbit-spinner-Dxv5qAhr.js +348 -0
- package/dist/pages/otp-input-CVRoX1mw.js +591 -0
- package/dist/pages/overview-LA9XRhZc.js +130 -0
- package/dist/pages/package-dimensions-DFCyZj_T.js +192 -0
- package/dist/pages/pagination-C1EgVtW4.js +294 -0
- package/dist/pages/palette-tile-X9ZXu2Z0.js +414 -0
- package/dist/pages/password-field-DHEQKyUC.js +912 -0
- package/dist/pages/person-cell-BmjbADBz.js +564 -0
- package/dist/pages/phone-input-B3G7Qpb2.js +747 -0
- package/dist/pages/plan-card-DRaA6RuB.js +621 -0
- package/dist/pages/plan-card-DtloWvMh.js +258 -0
- package/dist/pages/plan-comparison-BVIGTtbd.js +559 -0
- package/dist/pages/plan-grid-cfPVTB5V.js +251 -0
- package/dist/pages/point-list-BbPmZjsm.js +222 -0
- package/dist/pages/popover-C3Oar9D5.js +1198 -0
- package/dist/pages/presence-avatars-CRZIk8n9.js +328 -0
- package/dist/pages/preview-frame-Bcwk0y_Q.js +1631 -0
- package/dist/pages/price-CRBLoa9h.js +604 -0
- package/dist/pages/principles-pnDyfHpK.js +483 -0
- package/dist/pages/print-page-BkLv6bW8.js +513 -0
- package/dist/pages/profile-hero-CC9dUzuN.js +498 -0
- package/dist/pages/progress-CP_awmo4.js +904 -0
- package/dist/pages/progress-ring-JuOAwk2T.js +576 -0
- package/dist/pages/radio-group-C-4tg6FS.js +1639 -0
- package/dist/pages/radius-control-B2kRA2Ch.js +441 -0
- package/dist/pages/rating-CweKN2SX.js +471 -0
- package/dist/pages/record-layout-DUP_X0RL.js +719 -0
- package/dist/pages/record-pager-y9D7JFgb.js +278 -0
- package/dist/pages/registry-BZg-xAbi.js +594 -0
- package/dist/pages/release-Cs6tl16C.js +16 -0
- package/dist/pages/repeater-BRZYKRQa.js +1351 -0
- package/dist/pages/reply-feedback-BDnHprla.js +192 -0
- package/dist/pages/reveal-BygENBbL.js +460 -0
- package/dist/pages/rich-text-DOFQZEpT.js +156 -0
- package/dist/pages/rich-text-editor-BhIM20JI.js +1265 -0
- package/dist/pages/rolldown-runtime-CbKu08Hx.js +25 -0
- package/dist/pages/rolling-number-GR3Cyfpz.js +529 -0
- package/dist/pages/row-list-Dl6CYhC-.js +1565 -0
- package/dist/pages/rule-list-DTCmIMpT.js +648 -0
- package/dist/pages/save-status-B5KkyMZP.js +378 -0
- package/dist/pages/schedule-YycI95O1.js +243 -0
- package/dist/pages/scroll-area-B2sGm23Q.js +423 -0
- package/dist/pages/search-field-D1uG7R6A.js +693 -0
- package/dist/pages/search-menu-DMuXyUUW.js +580 -0
- package/dist/pages/secret-field-Dj9x3LL8.js +337 -0
- package/dist/pages/section-rail-BtTCETS5.js +637 -0
- package/dist/pages/section-v2Pubup9.js +639 -0
- package/dist/pages/segmented-control-D-FB1K1T.js +1190 -0
- package/dist/pages/select-DZ43NpOm.js +1434 -0
- package/dist/pages/selection-chrome-Czcs6RN6.js +437 -0
- package/dist/pages/separator-CFwqRvfO.js +428 -0
- package/dist/pages/serp-preview-BGwORjmo.js +346 -0
- package/dist/pages/setting-row-Bt-dZV8H.js +913 -0
- package/dist/pages/shape-DzniHAVT.js +627 -0
- package/dist/pages/share-list-D4wgBxKN.js +926 -0
- package/dist/pages/side-panel-CCtkrZjs.js +811 -0
- package/dist/pages/site-preview-Dj1hM2Yo.js +353 -0
- package/dist/pages/skeleton-C1F5HkAu.js +1325 -0
- package/dist/pages/skip-link-BxznhSkz.js +252 -0
- package/dist/pages/slider-CAoPURKD.js +774 -0
- package/dist/pages/sortable-card-Sr44uCpI.js +424 -0
- package/dist/pages/sortable-list-DUAleYE1.js +1298 -0
- package/dist/pages/sortable-tree-BLzK-hTE.js +737 -0
- package/dist/pages/spacing-box-CtuvzxQu.js +550 -0
- package/dist/pages/sparkline-D3aavCly.js +947 -0
- package/dist/pages/split-bar-DYgZnFID.js +414 -0
- package/dist/pages/split-button-Be08-VI-.js +335 -0
- package/dist/pages/split-pane-lSNZgTKt.js +523 -0
- package/dist/pages/status-badge-DOdNhmzn.js +1074 -0
- package/dist/pages/status-checklist-CWkjCZIC.js +1152 -0
- package/dist/pages/status-dot-D99gAGsV.js +567 -0
- package/dist/pages/stepper-CxKTbEA-.js +1093 -0
- package/dist/pages/success-mark-CqFTOBEu.js +142 -0
- package/dist/pages/swatch-H_kNvHuC.js +565 -0
- package/dist/pages/switch-C93K6j9h.js +617 -0
- package/dist/pages/table-CL0vomno.js +3225 -0
- package/dist/pages/tabs-Dh0mUsLw.js +1690 -0
- package/dist/pages/tag-input-BjZWKKRJ.js +1307 -0
- package/dist/pages/task-card-Dv0sR1-w.js +295 -0
- package/dist/pages/textarea-CCM-SnGN.js +949 -0
- package/dist/pages/thumbnail-DwFJL_k1.js +1147 -0
- package/dist/pages/time-input-CA9-uZAa.js +442 -0
- package/dist/pages/time-zone-select-CEtMXVYO.js +296 -0
- package/dist/pages/timeline-BsMUTlpR.js +1798 -0
- package/dist/pages/toast-zXLRiMRT.js +1391 -0
- package/dist/pages/tool-rail-B1AbTMCP.js +355 -0
- package/dist/pages/toolbar-B9l_fHKy.js +754 -0
- package/dist/pages/tooltip-LHtCUkF-.js +826 -0
- package/dist/pages/translation-field-CTRXiF2N.js +251 -0
- package/dist/pages/tree-checklist-CJj3OcLg.js +451 -0
- package/dist/pages/tree-select-DU1qXHy_.js +492 -0
- package/dist/pages/tree-view-g_RjLtAb.js +739 -0
- package/dist/pages/typography-BSijtiRl.js +876 -0
- package/dist/pages/unit-input-Dml4fjmK.js +659 -0
- package/dist/pages/upload-rules-yozEzSah.js +419 -0
- package/dist/pages/url-upload-input-SSnMgfpA.js +307 -0
- package/dist/pages/value-change-CnubDKyO.js +489 -0
- package/dist/pages/weekly-hours-i2EpsmTx.js +287 -0
- package/dist/pages/widget-preview-CUJMyZ_k.js +625 -0
- package/dist/pages/working-status-CENemSsw.js +389 -0
- package/manifest.json +13001 -0
- package/package.json +35 -4
|
@@ -0,0 +1,682 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as DocLink } from "./host-B6znjEgQ.js";
|
|
3
|
+
import { a as DocTable, d as Section$1, i as DocPage, l as Note, m as ThemePair, o as Example, s as Guidelines, u as PropsTable } from "./docs-lM2UBSir.js";
|
|
4
|
+
import { useMemo, useState } from "react";
|
|
5
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { Calendar, dateFormatter, toISODate } from "@orbitcommerce/constellation";
|
|
7
|
+
import { CheckCircleIcon, StorefrontIcon } from "@orbitcommerce/constellation/icons";
|
|
8
|
+
//#region src/pages/components/calendar.tsx
|
|
9
|
+
function startOfToday() {
|
|
10
|
+
const now = /* @__PURE__ */ new Date();
|
|
11
|
+
return new Date(now.getFullYear(), now.getMonth(), now.getDate());
|
|
12
|
+
}
|
|
13
|
+
var addDays = (date, days) => new Date(date.getFullYear(), date.getMonth(), date.getDate() + days);
|
|
14
|
+
var dayCount = (range) => Math.round((range.to.getTime() - range.from.getTime()) / 864e5) + 1;
|
|
15
|
+
var shortDate = dateFormatter("en-GB", {
|
|
16
|
+
day: "numeric",
|
|
17
|
+
month: "short",
|
|
18
|
+
year: "numeric"
|
|
19
|
+
});
|
|
20
|
+
var weekdayDate = dateFormatter("en-GB", {
|
|
21
|
+
weekday: "short",
|
|
22
|
+
day: "numeric",
|
|
23
|
+
month: "short",
|
|
24
|
+
year: "numeric"
|
|
25
|
+
});
|
|
26
|
+
/** The next day that is not a Sunday, at least `after` days away. */
|
|
27
|
+
function nextOpenDay(from, after = 1) {
|
|
28
|
+
let day = addDays(from, after);
|
|
29
|
+
while (day.getDay() === 0) day = addDays(day, 1);
|
|
30
|
+
return day;
|
|
31
|
+
}
|
|
32
|
+
/** The Christmas closure still ahead: 24 December to 2 January. */
|
|
33
|
+
function holidayClosure(today) {
|
|
34
|
+
const year = today > new Date(today.getFullYear(), 11, 24) ? today.getFullYear() + 1 : today.getFullYear();
|
|
35
|
+
return {
|
|
36
|
+
from: new Date(year, 11, 24),
|
|
37
|
+
to: new Date(year + 1, 0, 2)
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/** Bank holidays in England and Wales, 2026 and 2027. */
|
|
41
|
+
var BANK_HOLIDAYS = /* @__PURE__ */ new Set([
|
|
42
|
+
"2026-01-01",
|
|
43
|
+
"2026-04-03",
|
|
44
|
+
"2026-04-06",
|
|
45
|
+
"2026-05-04",
|
|
46
|
+
"2026-05-25",
|
|
47
|
+
"2026-08-31",
|
|
48
|
+
"2026-12-25",
|
|
49
|
+
"2026-12-28",
|
|
50
|
+
"2027-01-01",
|
|
51
|
+
"2027-03-26",
|
|
52
|
+
"2027-03-29",
|
|
53
|
+
"2027-05-03",
|
|
54
|
+
"2027-05-31",
|
|
55
|
+
"2027-08-30",
|
|
56
|
+
"2027-12-27",
|
|
57
|
+
"2027-12-28"
|
|
58
|
+
]);
|
|
59
|
+
function Preview() {
|
|
60
|
+
const today = startOfToday();
|
|
61
|
+
return /* @__PURE__ */ jsx("div", {
|
|
62
|
+
className: "calendar-preview",
|
|
63
|
+
children: /* @__PURE__ */ jsx(Calendar, {
|
|
64
|
+
mode: "range",
|
|
65
|
+
today,
|
|
66
|
+
defaultValue: {
|
|
67
|
+
from: addDays(today, 3),
|
|
68
|
+
to: addDays(today, 9)
|
|
69
|
+
},
|
|
70
|
+
fixedWeeks: false
|
|
71
|
+
})
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
function CollectionDay() {
|
|
75
|
+
const today = useMemo(() => startOfToday(), []);
|
|
76
|
+
const [day, setDay] = useState(() => nextOpenDay(today, 2));
|
|
77
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
78
|
+
className: "calendar-panel",
|
|
79
|
+
children: [
|
|
80
|
+
/* @__PURE__ */ jsxs("div", {
|
|
81
|
+
className: "calendar-panel__head",
|
|
82
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
83
|
+
className: "calendar-panel__icon",
|
|
84
|
+
"aria-hidden": "true",
|
|
85
|
+
children: /* @__PURE__ */ jsx(StorefrontIcon, {})
|
|
86
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
87
|
+
className: "calendar-panel__heading",
|
|
88
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
89
|
+
className: "calendar-panel__title",
|
|
90
|
+
id: "collection-title",
|
|
91
|
+
children: "Collection day"
|
|
92
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
93
|
+
className: "calendar-panel__meta",
|
|
94
|
+
children: "Harrogate shop, open Monday to Saturday"
|
|
95
|
+
})]
|
|
96
|
+
})]
|
|
97
|
+
}),
|
|
98
|
+
/* @__PURE__ */ jsx(Calendar, {
|
|
99
|
+
"aria-labelledby": "collection-title",
|
|
100
|
+
required: true,
|
|
101
|
+
value: day,
|
|
102
|
+
onChange: setDay,
|
|
103
|
+
today,
|
|
104
|
+
minValue: addDays(today, 1),
|
|
105
|
+
disabled: { dayOfWeek: [0] }
|
|
106
|
+
}),
|
|
107
|
+
/* @__PURE__ */ jsx("p", {
|
|
108
|
+
className: "calendar-status",
|
|
109
|
+
role: "status",
|
|
110
|
+
children: day ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
111
|
+
/* @__PURE__ */ jsx(CheckCircleIcon, {
|
|
112
|
+
weight: "fill",
|
|
113
|
+
"aria-hidden": "true"
|
|
114
|
+
}),
|
|
115
|
+
"Ready to collect on ",
|
|
116
|
+
weekdayDate.format(day),
|
|
117
|
+
", 10:00 to 17:00"
|
|
118
|
+
] }) : null
|
|
119
|
+
})
|
|
120
|
+
]
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
function HolidayClosure() {
|
|
124
|
+
const today = useMemo(() => startOfToday(), []);
|
|
125
|
+
const [range, setRange] = useState(() => holidayClosure(today));
|
|
126
|
+
const complete = range?.from && range.to ? {
|
|
127
|
+
from: range.from,
|
|
128
|
+
to: range.to
|
|
129
|
+
} : null;
|
|
130
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
131
|
+
className: "calendar-closure",
|
|
132
|
+
children: [/* @__PURE__ */ jsx(Calendar, {
|
|
133
|
+
mode: "range",
|
|
134
|
+
"aria-label": "Shop closed",
|
|
135
|
+
numberOfMonths: 2,
|
|
136
|
+
value: range,
|
|
137
|
+
onChange: setRange,
|
|
138
|
+
today,
|
|
139
|
+
minValue: today
|
|
140
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
141
|
+
className: "calendar-status",
|
|
142
|
+
role: "status",
|
|
143
|
+
children: complete ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
144
|
+
"Closed for ",
|
|
145
|
+
dayCount(complete),
|
|
146
|
+
" ",
|
|
147
|
+
dayCount(complete) === 1 ? "day" : "days",
|
|
148
|
+
": ",
|
|
149
|
+
shortDate.format(complete.from),
|
|
150
|
+
" to",
|
|
151
|
+
" ",
|
|
152
|
+
shortDate.format(complete.to),
|
|
153
|
+
". Orders placed then go out on ",
|
|
154
|
+
weekdayDate.format(nextOpenDay(complete.to)),
|
|
155
|
+
"."
|
|
156
|
+
] }) : range?.from ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
157
|
+
"Closed from ",
|
|
158
|
+
shortDate.format(range.from),
|
|
159
|
+
". Now pick the last day."
|
|
160
|
+
] }) : "Pick the first day the shop is closed."
|
|
161
|
+
})]
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
function DispatchDay() {
|
|
165
|
+
const today = useMemo(() => startOfToday(), []);
|
|
166
|
+
const [day, setDay] = useState(null);
|
|
167
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
168
|
+
className: "calendar-panel",
|
|
169
|
+
children: [/* @__PURE__ */ jsx(Calendar, {
|
|
170
|
+
"aria-label": "Dispatch date",
|
|
171
|
+
value: day,
|
|
172
|
+
onChange: setDay,
|
|
173
|
+
today,
|
|
174
|
+
minValue: today,
|
|
175
|
+
maxValue: addDays(today, 60),
|
|
176
|
+
disabled: [{ dayOfWeek: [0, 6] }, (date) => BANK_HOLIDAYS.has(toISODate(date))]
|
|
177
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
178
|
+
className: "calendar-status",
|
|
179
|
+
role: "status",
|
|
180
|
+
children: day ? `Dispatching on ${weekdayDate.format(day)}` : "Weekdays only, and never on a bank holiday."
|
|
181
|
+
})]
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
function Page() {
|
|
185
|
+
const today = startOfToday();
|
|
186
|
+
const chosen = nextOpenDay(today, 6);
|
|
187
|
+
return /* @__PURE__ */ jsxs(DocPage, {
|
|
188
|
+
title: "Calendar",
|
|
189
|
+
status: "new",
|
|
190
|
+
importNames: ["Calendar"],
|
|
191
|
+
lead: "A month of days to pick from, inline on the page: one day, or a first and a last. It is the calendar inside DatePicker and DateRangePicker, for when the date is the main thing on screen rather than one field in a form.",
|
|
192
|
+
children: [
|
|
193
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
194
|
+
id: "basics",
|
|
195
|
+
title: "Picking a day",
|
|
196
|
+
description: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("p", { children: "Each day is a pill that tints on hover. Today carries a teal satellite under its numeral, and the chosen day fills with Orbit teal, the disc settling into place. Days that cannot be picked fade to mist. Weeks start on Monday, and month and day names come from Intl in British English." }), /* @__PURE__ */ jsxs("p", { children: [
|
|
197
|
+
"Here a customer picks a collection day: from tomorrow, never on a Sunday. ",
|
|
198
|
+
/* @__PURE__ */ jsx("code", { children: "required" }),
|
|
199
|
+
" keeps the chosen day when it is pressed again, rather than clearing it."
|
|
200
|
+
] })] }),
|
|
201
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
202
|
+
clientOnly: true,
|
|
203
|
+
code: `
|
|
204
|
+
const [day, setDay] = useState<Date | null>(null)
|
|
205
|
+
|
|
206
|
+
<Calendar
|
|
207
|
+
aria-labelledby="collection-title"
|
|
208
|
+
required
|
|
209
|
+
value={day}
|
|
210
|
+
onChange={setDay}
|
|
211
|
+
minValue={tomorrow}
|
|
212
|
+
disabled={{ dayOfWeek: [0] }}
|
|
213
|
+
/>`,
|
|
214
|
+
children: /* @__PURE__ */ jsx(CollectionDay, {})
|
|
215
|
+
})
|
|
216
|
+
}),
|
|
217
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
218
|
+
id: "states",
|
|
219
|
+
title: "Days and their states",
|
|
220
|
+
description: /* @__PURE__ */ jsx("p", { children: "Every state a day can be in, light and dark side by side. Hover and focus are live: point at a day, or Tab into the grid and use the arrows." }),
|
|
221
|
+
children: [/* @__PURE__ */ jsx(ThemePair, {
|
|
222
|
+
clientOnly: true,
|
|
223
|
+
align: "start",
|
|
224
|
+
children: /* @__PURE__ */ jsx(Calendar, {
|
|
225
|
+
"aria-label": "Delivery date",
|
|
226
|
+
defaultValue: chosen,
|
|
227
|
+
today,
|
|
228
|
+
minValue: today,
|
|
229
|
+
disabled: { dayOfWeek: [0] }
|
|
230
|
+
})
|
|
231
|
+
}), /* @__PURE__ */ jsx(DocTable, {
|
|
232
|
+
columns: ["State", "Looks like"],
|
|
233
|
+
rows: [
|
|
234
|
+
["Today", "A teal satellite under the numeral, which turns semibold."],
|
|
235
|
+
["Chosen", "A teal disc (mint in dark) with the numeral in white, settling in on the spring."],
|
|
236
|
+
["Hover and press", "The quiet hover tint, then a deeper tint as the pill dips under the finger."],
|
|
237
|
+
["Focus", "A 2px teal ring, 2px off the pill, for keyboard focus only."],
|
|
238
|
+
["Range", "A teal wash between the two filled ends, rounded off at the edges of each week. The numerals stay ink."],
|
|
239
|
+
["Picking a range", "While the second end is picked, a fainter wash follows the pointer (or focus) to a teal ring."],
|
|
240
|
+
["Unavailable", "Numerals in mist, no hover, and the arrow keys pass over them."],
|
|
241
|
+
["Other months", "With one month showing, the days of the months either side fill its first and last weeks, a step quieter, and can still be picked."]
|
|
242
|
+
]
|
|
243
|
+
})]
|
|
244
|
+
}),
|
|
245
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
246
|
+
id: "ranges",
|
|
247
|
+
title: "Ranges",
|
|
248
|
+
description: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("p", { children: [
|
|
249
|
+
/* @__PURE__ */ jsx("code", { children: "mode=\"range\"" }),
|
|
250
|
+
" picks a first and a last day. The first click starts the range and",
|
|
251
|
+
" ",
|
|
252
|
+
/* @__PURE__ */ jsx("code", { children: "onChange" }),
|
|
253
|
+
" gets ",
|
|
254
|
+
/* @__PURE__ */ jsx("code", { children: "{ from }" }),
|
|
255
|
+
"; the second completes it as ",
|
|
256
|
+
/* @__PURE__ */ jsx("code", { children: "{ from, to }" }),
|
|
257
|
+
", swapping the ends if the second day is earlier; the next click starts again. Both ends are local midnight, and both are included."
|
|
258
|
+
] }), /* @__PURE__ */ jsxs("p", { children: [/* @__PURE__ */ jsx("code", { children: "numberOfMonths" }), " sets months side by side. With more than one, the days of other months are left out, so no day appears twice. Here, the shop's Christmas closure."] })] }),
|
|
259
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
260
|
+
clientOnly: true,
|
|
261
|
+
align: "fill",
|
|
262
|
+
code: `
|
|
263
|
+
const [range, setRange] = useState<Partial<DateRange> | null>({ from: christmasEve, to: secondOfJanuary })
|
|
264
|
+
|
|
265
|
+
<Calendar
|
|
266
|
+
mode="range"
|
|
267
|
+
aria-label="Shop closed"
|
|
268
|
+
numberOfMonths={2}
|
|
269
|
+
value={range}
|
|
270
|
+
onChange={setRange}
|
|
271
|
+
minValue={today}
|
|
272
|
+
/>`,
|
|
273
|
+
children: /* @__PURE__ */ jsx(HolidayClosure, {})
|
|
274
|
+
}), /* @__PURE__ */ jsxs(Note, {
|
|
275
|
+
title: "In a form",
|
|
276
|
+
children: [
|
|
277
|
+
"For a range in a form field, use ",
|
|
278
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
279
|
+
to: "/components/date-picker#ranges",
|
|
280
|
+
children: "DateRangePicker"
|
|
281
|
+
}),
|
|
282
|
+
": it opens this calendar in a popover, adds presets, and only reports a range once both ends are picked."
|
|
283
|
+
]
|
|
284
|
+
})]
|
|
285
|
+
}),
|
|
286
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
287
|
+
id: "unavailable",
|
|
288
|
+
title: "Unavailable days",
|
|
289
|
+
description: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("p", { children: [
|
|
290
|
+
/* @__PURE__ */ jsx("code", { children: "minValue" }),
|
|
291
|
+
" and ",
|
|
292
|
+
/* @__PURE__ */ jsx("code", { children: "maxValue" }),
|
|
293
|
+
" rule out everything outside them, and the months beyond cannot be reached. ",
|
|
294
|
+
/* @__PURE__ */ jsx("code", { children: "disabled" }),
|
|
295
|
+
" rules out any other days, and takes one matcher or a list of them."
|
|
296
|
+
] }), /* @__PURE__ */ jsx("p", { children: "Here, dispatch on a weekday in the next 60 days that is not a bank holiday in England and Wales." })] }),
|
|
297
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
298
|
+
clientOnly: true,
|
|
299
|
+
code: `
|
|
300
|
+
const bankHolidays = new Set(['2026-12-25', '2026-12-28', '2027-01-01', ...])
|
|
301
|
+
|
|
302
|
+
<Calendar
|
|
303
|
+
aria-label="Dispatch date"
|
|
304
|
+
value={day}
|
|
305
|
+
onChange={setDay}
|
|
306
|
+
minValue={today}
|
|
307
|
+
maxValue={inSixtyDays}
|
|
308
|
+
disabled={[{ dayOfWeek: [0, 6] }, (date) => bankHolidays.has(toISODate(date))]}
|
|
309
|
+
/>`,
|
|
310
|
+
children: /* @__PURE__ */ jsx(DispatchDay, {})
|
|
311
|
+
}), /* @__PURE__ */ jsx(DocTable, {
|
|
312
|
+
columns: [
|
|
313
|
+
"Matcher",
|
|
314
|
+
"Rules out",
|
|
315
|
+
"For example"
|
|
316
|
+
],
|
|
317
|
+
rows: [
|
|
318
|
+
[
|
|
319
|
+
/* @__PURE__ */ jsx("code", { children: "Date" }),
|
|
320
|
+
"That day.",
|
|
321
|
+
/* @__PURE__ */ jsx("code", { children: "new Date(2026, 11, 25)" })
|
|
322
|
+
],
|
|
323
|
+
[
|
|
324
|
+
/* @__PURE__ */ jsx("code", { children: "Date[]" }),
|
|
325
|
+
"Each of those days.",
|
|
326
|
+
"Days already fully booked."
|
|
327
|
+
],
|
|
328
|
+
[
|
|
329
|
+
/* @__PURE__ */ jsx("code", { children: "{ before: date }" }),
|
|
330
|
+
"Every day before it (not the day itself).",
|
|
331
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
332
|
+
"The same as ",
|
|
333
|
+
/* @__PURE__ */ jsx("code", { children: "minValue" }),
|
|
334
|
+
", without the navigation limit."
|
|
335
|
+
] })
|
|
336
|
+
],
|
|
337
|
+
[
|
|
338
|
+
/* @__PURE__ */ jsx("code", { children: "{ after: date }" }),
|
|
339
|
+
"Every day after it.",
|
|
340
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
341
|
+
"The same as ",
|
|
342
|
+
/* @__PURE__ */ jsx("code", { children: "maxValue" }),
|
|
343
|
+
", without the navigation limit."
|
|
344
|
+
] })
|
|
345
|
+
],
|
|
346
|
+
[
|
|
347
|
+
/* @__PURE__ */ jsx("code", { children: "{ from, to }" }),
|
|
348
|
+
"The days between, both included.",
|
|
349
|
+
"A warehouse stocktake."
|
|
350
|
+
],
|
|
351
|
+
[
|
|
352
|
+
/* @__PURE__ */ jsx("code", { children: "{ dayOfWeek: [0, 6] }" }),
|
|
353
|
+
"Those days of the week, 0 being Sunday.",
|
|
354
|
+
"Weekends."
|
|
355
|
+
],
|
|
356
|
+
[
|
|
357
|
+
/* @__PURE__ */ jsx("code", { children: "(date) => boolean" }),
|
|
358
|
+
"Any day the function returns true for.",
|
|
359
|
+
"Bank holidays, from a list."
|
|
360
|
+
],
|
|
361
|
+
[
|
|
362
|
+
/* @__PURE__ */ jsx("code", { children: "true" }),
|
|
363
|
+
"Every day: a calendar to look at, not pick from.",
|
|
364
|
+
"A read-only view of a past booking."
|
|
365
|
+
]
|
|
366
|
+
]
|
|
367
|
+
})]
|
|
368
|
+
}),
|
|
369
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
370
|
+
id: "caption",
|
|
371
|
+
title: "A month and a year to choose",
|
|
372
|
+
description: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("p", { children: [
|
|
373
|
+
"The caption is the month's name between the previous and next buttons. For a date years away, that is a press for every month between. ",
|
|
374
|
+
/* @__PURE__ */ jsx("code", { children: "captionLayout=\"dropdown\"" }),
|
|
375
|
+
" shows a month and a year to choose from instead: the browser's own selects (a list on a desktop, the wheel on a phone), named Month and Year, drawn as quiet words with a small arrow. ",
|
|
376
|
+
/* @__PURE__ */ jsx("code", { children: "dropdown-months" }),
|
|
377
|
+
" and ",
|
|
378
|
+
/* @__PURE__ */ jsx("code", { children: "dropdown-years" }),
|
|
379
|
+
" show one of them."
|
|
380
|
+
] }), /* @__PURE__ */ jsxs("p", { children: [
|
|
381
|
+
"The years run from ",
|
|
382
|
+
/* @__PURE__ */ jsx("code", { children: "minValue" }),
|
|
383
|
+
" to ",
|
|
384
|
+
/* @__PURE__ */ jsx("code", { children: "maxValue" }),
|
|
385
|
+
". With no limits they run from a hundred years back to twenty on, and always take in the month on show, so the chosen day is never out of reach. One limit moves the end it leaves out with it: a ",
|
|
386
|
+
/* @__PURE__ */ jsx("code", { children: "maxValue" }),
|
|
387
|
+
" in 1900 lists 1800 to 1900 and a",
|
|
388
|
+
" ",
|
|
389
|
+
/* @__PURE__ */ jsx("code", { children: "minValue" }),
|
|
390
|
+
" in 2100 lists 2100 to 2120, so there is always a calendar to draw. Months outside the limits are greyed in the list. Only a calendar of one month has them; several months keep the label, and a month swaps in without sliding. The date pickers keep the label unless asked: ",
|
|
391
|
+
/* @__PURE__ */ jsx("code", { children: "captionLayout=\"auto\"" }),
|
|
392
|
+
" ",
|
|
393
|
+
"on a date picker shows the selects when the days that can be picked span more than a year, and a",
|
|
394
|
+
" ",
|
|
395
|
+
/* @__PURE__ */ jsx("code", { children: "DateInput" }),
|
|
396
|
+
" does so by default."
|
|
397
|
+
] })] }),
|
|
398
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
399
|
+
clientOnly: true,
|
|
400
|
+
code: `
|
|
401
|
+
<Calendar captionLayout="dropdown" defaultValue={date} />
|
|
402
|
+
|
|
403
|
+
// The years follow the limits
|
|
404
|
+
<Calendar captionLayout="dropdown" minValue={new Date(2024, 0, 1)} maxValue={new Date(2028, 11, 31)} />`,
|
|
405
|
+
caption: "Choose a year, then a month, then the day.",
|
|
406
|
+
children: /* @__PURE__ */ jsx(Calendar, {
|
|
407
|
+
"aria-label": "With a month and a year to choose",
|
|
408
|
+
captionLayout: "dropdown",
|
|
409
|
+
today,
|
|
410
|
+
defaultValue: chosen
|
|
411
|
+
})
|
|
412
|
+
})
|
|
413
|
+
}),
|
|
414
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
415
|
+
id: "locale",
|
|
416
|
+
title: "Language and the start of the week",
|
|
417
|
+
description: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("p", { children: [
|
|
418
|
+
/* @__PURE__ */ jsx("code", { children: "locale" }),
|
|
419
|
+
" takes a BCP 47 tag. Month and weekday names come from Intl, and so does the first day of the week: Monday in British English, Sunday in American English. ",
|
|
420
|
+
/* @__PURE__ */ jsx("code", { children: "weekStartsOn" }),
|
|
421
|
+
" overrides it, 0 being Sunday."
|
|
422
|
+
] }), /* @__PURE__ */ jsxs("p", { children: [
|
|
423
|
+
"What the calendar reads out (Previous month, Next month, Today, selected, Month, Year) is English by default: pass translations through ",
|
|
424
|
+
/* @__PURE__ */ jsx("code", { children: "labels" }),
|
|
425
|
+
"."
|
|
426
|
+
] })] }),
|
|
427
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
428
|
+
clientOnly: true,
|
|
429
|
+
align: "fill",
|
|
430
|
+
code: `
|
|
431
|
+
<Calendar locale="en-GB" />
|
|
432
|
+
<Calendar locale="en-US" />
|
|
433
|
+
<Calendar
|
|
434
|
+
locale="de-DE"
|
|
435
|
+
labels={{ previousMonth: 'Vorheriger Monat', nextMonth: 'Nächster Monat', today: 'Heute', selected: 'ausgewählt' }}
|
|
436
|
+
/>`,
|
|
437
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
438
|
+
className: "calendar-locales",
|
|
439
|
+
children: [
|
|
440
|
+
/* @__PURE__ */ jsxs("figure", {
|
|
441
|
+
className: "calendar-locale",
|
|
442
|
+
children: [/* @__PURE__ */ jsx(Calendar, {
|
|
443
|
+
"aria-label": "British English",
|
|
444
|
+
locale: "en-GB",
|
|
445
|
+
today,
|
|
446
|
+
defaultValue: chosen
|
|
447
|
+
}), /* @__PURE__ */ jsxs("figcaption", { children: [/* @__PURE__ */ jsx("code", { children: "en-GB" }), ", the default"] })]
|
|
448
|
+
}),
|
|
449
|
+
/* @__PURE__ */ jsxs("figure", {
|
|
450
|
+
className: "calendar-locale",
|
|
451
|
+
children: [/* @__PURE__ */ jsx(Calendar, {
|
|
452
|
+
"aria-label": "American English",
|
|
453
|
+
locale: "en-US",
|
|
454
|
+
today,
|
|
455
|
+
defaultValue: chosen
|
|
456
|
+
}), /* @__PURE__ */ jsx("figcaption", { children: /* @__PURE__ */ jsx("code", { children: "en-US" }) })]
|
|
457
|
+
}),
|
|
458
|
+
/* @__PURE__ */ jsxs("figure", {
|
|
459
|
+
className: "calendar-locale",
|
|
460
|
+
children: [/* @__PURE__ */ jsx(Calendar, {
|
|
461
|
+
"aria-label": "Deutsch",
|
|
462
|
+
locale: "de-DE",
|
|
463
|
+
today,
|
|
464
|
+
defaultValue: chosen,
|
|
465
|
+
labels: {
|
|
466
|
+
previousMonth: "Vorheriger Monat",
|
|
467
|
+
nextMonth: "Nächster Monat",
|
|
468
|
+
today: "Heute",
|
|
469
|
+
selected: "ausgewählt"
|
|
470
|
+
}
|
|
471
|
+
}), /* @__PURE__ */ jsx("figcaption", { children: /* @__PURE__ */ jsx("code", { children: "de-DE" }) })]
|
|
472
|
+
})
|
|
473
|
+
]
|
|
474
|
+
})
|
|
475
|
+
})
|
|
476
|
+
}),
|
|
477
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
478
|
+
id: "keyboard",
|
|
479
|
+
title: "Keyboard",
|
|
480
|
+
description: /* @__PURE__ */ jsx("p", { children: "The grid is one Tab stop: focus lands on the chosen day, or today, or the first day that can be picked." }),
|
|
481
|
+
children: [/* @__PURE__ */ jsx(DocTable, {
|
|
482
|
+
columns: ["Key", "What it does"],
|
|
483
|
+
rows: [
|
|
484
|
+
["Left and right arrows", "Move a day, into the next or previous month at the edges. They swap in right-to-left layouts."],
|
|
485
|
+
["Up and down arrows", "Move a week."],
|
|
486
|
+
["Page Up, Page Down", "Move a month. With Shift, a year."],
|
|
487
|
+
["Home, End", "Move to the start or the end of the week."],
|
|
488
|
+
["Enter, Space", "Pick the focused day."],
|
|
489
|
+
["Tab", "Moves between the previous and next buttons, the month and year when they are choices, and the grid."],
|
|
490
|
+
["Arrow keys, on the month or the year", "Change it, when the caption is a month and a year to choose from."]
|
|
491
|
+
]
|
|
492
|
+
}), /* @__PURE__ */ jsxs(Note, { children: [
|
|
493
|
+
"Unavailable days are passed over: the arrows carry on to the next day that can be picked, and stop at",
|
|
494
|
+
" ",
|
|
495
|
+
/* @__PURE__ */ jsx("code", { children: "minValue" }),
|
|
496
|
+
" and ",
|
|
497
|
+
/* @__PURE__ */ jsx("code", { children: "maxValue" }),
|
|
498
|
+
"."
|
|
499
|
+
] })]
|
|
500
|
+
}),
|
|
501
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
502
|
+
id: "guidelines",
|
|
503
|
+
title: "Guidelines",
|
|
504
|
+
children: /* @__PURE__ */ jsx(Guidelines, { items: [
|
|
505
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
506
|
+
"Use the calendar inline when picking the date is the task on the screen: a collection day, a closure, days to block out. In a form, where the date is one answer among several, use",
|
|
507
|
+
" ",
|
|
508
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
509
|
+
to: "/components/date-picker",
|
|
510
|
+
children: "DatePicker"
|
|
511
|
+
}),
|
|
512
|
+
"."
|
|
513
|
+
] }),
|
|
514
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
515
|
+
"Name it: an ",
|
|
516
|
+
/* @__PURE__ */ jsx("code", { children: "aria-label" }),
|
|
517
|
+
", or ",
|
|
518
|
+
/* @__PURE__ */ jsx("code", { children: "aria-labelledby" }),
|
|
519
|
+
" pointing at a visible heading."
|
|
520
|
+
] }),
|
|
521
|
+
"Say what the choice means beside it, in words: \"Ready to collect on Thu, 8 Oct 2026\". A filled disc alone is easy to miss.",
|
|
522
|
+
"Rule out what cannot be picked rather than rejecting it afterwards, and say why nearby (\"Weekdays only\").",
|
|
523
|
+
"Keep weeks starting on Monday for UK merchants; only change the locale for people who read another one."
|
|
524
|
+
] })
|
|
525
|
+
}),
|
|
526
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
527
|
+
id: "accessibility",
|
|
528
|
+
title: "Accessibility",
|
|
529
|
+
children: /* @__PURE__ */ jsx(Guidelines, { items: [
|
|
530
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
531
|
+
"Each month is a ",
|
|
532
|
+
/* @__PURE__ */ jsx("code", { children: "grid" }),
|
|
533
|
+
" named by its month and year, with a column header for each weekday. Every day is a button read in full: \"Today, Friday, 2 October 2026\", with \", selected\" when chosen."
|
|
534
|
+
] }),
|
|
535
|
+
"The month caption is a polite live region, so moving to another month is announced. With a month and a year to choose from, they are two selects named Month and Year, and the live region says the month as it changes.",
|
|
536
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
537
|
+
"Previous and next are icon buttons named \"Previous month\" and \"Next month\". At the first or last month that can be reached they stay focusable but inert (",
|
|
538
|
+
/* @__PURE__ */ jsx("code", { children: "aria-disabled" }),
|
|
539
|
+
"), so focus is never dropped."
|
|
540
|
+
] }),
|
|
541
|
+
"Unavailable days are disabled buttons, skipped by the arrow keys.",
|
|
542
|
+
"Colour is never the only signal: today also turns semibold, a chosen day is announced as selected, and a range also reads in the status line beside it.",
|
|
543
|
+
"Under reduced motion the chosen-day disc appears without settling, a pressed day does not dip, and a new month swaps in without sliding."
|
|
544
|
+
] })
|
|
545
|
+
}),
|
|
546
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
547
|
+
id: "props",
|
|
548
|
+
title: "Props",
|
|
549
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
550
|
+
"Built on react-day-picker 9, styled entirely by the kit (react-day-picker's own stylesheet is not used). Pass ",
|
|
551
|
+
/* @__PURE__ */ jsx("code", { children: "className" }),
|
|
552
|
+
", ",
|
|
553
|
+
/* @__PURE__ */ jsx("code", { children: "style" }),
|
|
554
|
+
", ",
|
|
555
|
+
/* @__PURE__ */ jsx("code", { children: "id" }),
|
|
556
|
+
" and ",
|
|
557
|
+
/* @__PURE__ */ jsx("code", { children: "dir" }),
|
|
558
|
+
" for the root, and the",
|
|
559
|
+
" ",
|
|
560
|
+
/* @__PURE__ */ jsx("code", { children: "ref" }),
|
|
561
|
+
" reaches it too."
|
|
562
|
+
] }),
|
|
563
|
+
children: /* @__PURE__ */ jsx(PropsTable, {
|
|
564
|
+
title: "Calendar",
|
|
565
|
+
rows: [
|
|
566
|
+
{
|
|
567
|
+
name: "mode",
|
|
568
|
+
type: "'single' | 'range'",
|
|
569
|
+
default: "'single'",
|
|
570
|
+
description: "One day, or a first and a last."
|
|
571
|
+
},
|
|
572
|
+
{
|
|
573
|
+
name: "value",
|
|
574
|
+
type: "Date | null, or Partial<DateRange> | null",
|
|
575
|
+
description: "Controlled day, or range (to is missing while the second day is picked)."
|
|
576
|
+
},
|
|
577
|
+
{
|
|
578
|
+
name: "defaultValue",
|
|
579
|
+
type: "Date | null, or Partial<DateRange> | null",
|
|
580
|
+
description: "Starting value when uncontrolled."
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
name: "onChange",
|
|
584
|
+
type: "(value) => void",
|
|
585
|
+
description: "Every pick. In a range, { from } first, then { from, to }."
|
|
586
|
+
},
|
|
587
|
+
{
|
|
588
|
+
name: "required",
|
|
589
|
+
type: "boolean",
|
|
590
|
+
default: "false",
|
|
591
|
+
description: "Pressing the chosen day keeps it rather than clearing it."
|
|
592
|
+
},
|
|
593
|
+
{
|
|
594
|
+
name: "minValue",
|
|
595
|
+
type: "Date | null",
|
|
596
|
+
description: "The earliest day that can be picked; months before it cannot be reached."
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
name: "maxValue",
|
|
600
|
+
type: "Date | null",
|
|
601
|
+
description: "The latest day that can be picked; months after it cannot be reached."
|
|
602
|
+
},
|
|
603
|
+
{
|
|
604
|
+
name: "disabled",
|
|
605
|
+
type: "CalendarMatcher | CalendarMatcher[]",
|
|
606
|
+
description: "Other days that cannot be picked. See Unavailable days."
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
name: "excludeDisabled",
|
|
610
|
+
type: "boolean",
|
|
611
|
+
default: "false",
|
|
612
|
+
description: "Range only: start again rather than let a range run across an unavailable day."
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
name: "numberOfMonths",
|
|
616
|
+
type: "number",
|
|
617
|
+
default: "1",
|
|
618
|
+
description: "Months side by side."
|
|
619
|
+
},
|
|
620
|
+
{
|
|
621
|
+
name: "month, defaultMonth, onMonthChange",
|
|
622
|
+
type: "Date, Date, (month) => void",
|
|
623
|
+
description: "The month on show. Defaults to the chosen day, or today."
|
|
624
|
+
},
|
|
625
|
+
{
|
|
626
|
+
name: "showOutsideDays",
|
|
627
|
+
type: "boolean",
|
|
628
|
+
default: "true with one month",
|
|
629
|
+
description: "The neighbouring months' days in the first and last weeks."
|
|
630
|
+
},
|
|
631
|
+
{
|
|
632
|
+
name: "fixedWeeks",
|
|
633
|
+
type: "boolean",
|
|
634
|
+
default: "true",
|
|
635
|
+
description: "Always six weeks, so the calendar keeps its height from month to month."
|
|
636
|
+
},
|
|
637
|
+
{
|
|
638
|
+
name: "captionLayout",
|
|
639
|
+
type: "'label' | 'dropdown' | 'dropdown-months' | 'dropdown-years'",
|
|
640
|
+
default: "'label'",
|
|
641
|
+
description: "The month and year as a label, or a month and a year to choose from. One month on show only."
|
|
642
|
+
},
|
|
643
|
+
{
|
|
644
|
+
name: "locale",
|
|
645
|
+
type: "string",
|
|
646
|
+
default: "'en-GB'",
|
|
647
|
+
description: "BCP 47 tag for month and weekday names and the first day of the week."
|
|
648
|
+
},
|
|
649
|
+
{
|
|
650
|
+
name: "weekStartsOn",
|
|
651
|
+
type: "0 to 6",
|
|
652
|
+
description: "First column of the week, 0 for Sunday. Defaults to the locale's."
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
name: "today",
|
|
656
|
+
type: "Date",
|
|
657
|
+
description: "The day treated as today. Defaults to now."
|
|
658
|
+
},
|
|
659
|
+
{
|
|
660
|
+
name: "autoFocus",
|
|
661
|
+
type: "boolean",
|
|
662
|
+
default: "false",
|
|
663
|
+
description: "Focus the chosen day (or today) on mount."
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
name: "labels",
|
|
667
|
+
type: "Partial<CalendarLabels>",
|
|
668
|
+
description: "previousMonth, nextMonth, today and selected, and monthDropdown and yearDropdown (optional, English by default), for translation."
|
|
669
|
+
},
|
|
670
|
+
{
|
|
671
|
+
name: "aria-label, aria-labelledby",
|
|
672
|
+
type: "string",
|
|
673
|
+
description: "A name for the calendar."
|
|
674
|
+
}
|
|
675
|
+
]
|
|
676
|
+
})
|
|
677
|
+
})
|
|
678
|
+
]
|
|
679
|
+
});
|
|
680
|
+
}
|
|
681
|
+
//#endregion
|
|
682
|
+
export { Page, Preview };
|