@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,718 @@
|
|
|
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, p as SubSection, r as DoDont, s as Guidelines, u as PropsTable } from "./docs-lM2UBSir.js";
|
|
4
|
+
import { d as formatGbp, f as formatGbpTick, g as takingsSeries, p as formatHour, u as figuresFor } from "./_figures-data-DaDvB7Nm.js";
|
|
5
|
+
import { useEffect, useMemo, useRef, useState } from "react";
|
|
6
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { AreaChart, Button, SegmentedControl, dateFormatter } from "@orbitcommerce/constellation";
|
|
8
|
+
import { ArrowsClockwiseIcon } from "@orbitcommerce/constellation/icons";
|
|
9
|
+
//#region src/pages/components/area-chart.tsx
|
|
10
|
+
var PREVIEW = takingsSeries(21, "none");
|
|
11
|
+
var LAST_30 = takingsSeries(30, "none");
|
|
12
|
+
var LAST_30_COMPARED = takingsSeries(30);
|
|
13
|
+
var LAST_14 = takingsSeries(14, "none");
|
|
14
|
+
var TODAY_BY_HOUR = figuresFor("today")[0].series;
|
|
15
|
+
var round2 = (n) => Math.round(n * 100) / 100;
|
|
16
|
+
var CPU_DAY = [
|
|
17
|
+
18,
|
|
18
|
+
21,
|
|
19
|
+
24,
|
|
20
|
+
null,
|
|
21
|
+
47,
|
|
22
|
+
63,
|
|
23
|
+
58,
|
|
24
|
+
52,
|
|
25
|
+
null,
|
|
26
|
+
39,
|
|
27
|
+
28,
|
|
28
|
+
22
|
|
29
|
+
].map((value, i) => value === null ? {
|
|
30
|
+
date: new Date(2026, 8, 3, i * 2),
|
|
31
|
+
value: null
|
|
32
|
+
} : {
|
|
33
|
+
date: new Date(2026, 8, 3, i * 2),
|
|
34
|
+
value
|
|
35
|
+
});
|
|
36
|
+
var cpuTime = dateFormatter("en-GB", {
|
|
37
|
+
hour: "2-digit",
|
|
38
|
+
minute: "2-digit"
|
|
39
|
+
});
|
|
40
|
+
var cpuReadout = dateFormatter("en-GB", {
|
|
41
|
+
weekday: "short",
|
|
42
|
+
day: "numeric",
|
|
43
|
+
month: "short",
|
|
44
|
+
hour: "2-digit",
|
|
45
|
+
minute: "2-digit"
|
|
46
|
+
});
|
|
47
|
+
var percent = (v) => `${v}%`;
|
|
48
|
+
function Preview() {
|
|
49
|
+
return /* @__PURE__ */ jsx("div", {
|
|
50
|
+
className: "area-chart-preview",
|
|
51
|
+
children: /* @__PURE__ */ jsx(AreaChart, {
|
|
52
|
+
data: PREVIEW,
|
|
53
|
+
height: 124,
|
|
54
|
+
formatValue: formatGbp,
|
|
55
|
+
formatTick: formatGbpTick
|
|
56
|
+
})
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function RangeDemo() {
|
|
60
|
+
const [range, setRange] = useState("30");
|
|
61
|
+
const [compare, setCompare] = useState("previous");
|
|
62
|
+
const [refreshes, setRefreshes] = useState(0);
|
|
63
|
+
const days = Number(range);
|
|
64
|
+
const data = useMemo(() => {
|
|
65
|
+
const base = takingsSeries(days, compare);
|
|
66
|
+
if (!refreshes) return base;
|
|
67
|
+
return base.map((d, i) => ({
|
|
68
|
+
...d,
|
|
69
|
+
value: round2(d.value * (1 + .1 * Math.sin(i * 1.7 + refreshes * 2.3)))
|
|
70
|
+
}));
|
|
71
|
+
}, [
|
|
72
|
+
days,
|
|
73
|
+
compare,
|
|
74
|
+
refreshes
|
|
75
|
+
]);
|
|
76
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
77
|
+
className: "area-chart-demo",
|
|
78
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
79
|
+
className: "area-chart-demo__controls",
|
|
80
|
+
children: [
|
|
81
|
+
/* @__PURE__ */ jsx(SegmentedControl, {
|
|
82
|
+
"aria-label": "Range",
|
|
83
|
+
size: "sm",
|
|
84
|
+
value: range,
|
|
85
|
+
onValueChange: setRange,
|
|
86
|
+
options: [
|
|
87
|
+
{
|
|
88
|
+
value: "7",
|
|
89
|
+
label: "7 days"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
value: "30",
|
|
93
|
+
label: "30 days"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
value: "90",
|
|
97
|
+
label: "90 days"
|
|
98
|
+
}
|
|
99
|
+
]
|
|
100
|
+
}),
|
|
101
|
+
/* @__PURE__ */ jsx(SegmentedControl, {
|
|
102
|
+
"aria-label": "Compare with",
|
|
103
|
+
size: "sm",
|
|
104
|
+
value: compare,
|
|
105
|
+
onValueChange: setCompare,
|
|
106
|
+
options: [{
|
|
107
|
+
value: "previous",
|
|
108
|
+
label: "Previous period"
|
|
109
|
+
}, {
|
|
110
|
+
value: "last-year",
|
|
111
|
+
label: "Last year"
|
|
112
|
+
}]
|
|
113
|
+
}),
|
|
114
|
+
/* @__PURE__ */ jsx(Button, {
|
|
115
|
+
size: "sm",
|
|
116
|
+
variant: "ghost",
|
|
117
|
+
icon: /* @__PURE__ */ jsx(ArrowsClockwiseIcon, {}),
|
|
118
|
+
onClick: () => setRefreshes((r) => r + 1),
|
|
119
|
+
children: "Refresh"
|
|
120
|
+
})
|
|
121
|
+
]
|
|
122
|
+
}), /* @__PURE__ */ jsx(AreaChart, {
|
|
123
|
+
data,
|
|
124
|
+
height: 260,
|
|
125
|
+
valueLabel: `Last ${days} days`,
|
|
126
|
+
compareLabel: compare === "previous" ? `Previous ${days} days` : "Same days last year",
|
|
127
|
+
formatValue: formatGbp,
|
|
128
|
+
formatTick: formatGbpTick
|
|
129
|
+
})]
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
function StatesDemo() {
|
|
133
|
+
const [state, setState] = useState("loading");
|
|
134
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
135
|
+
className: "area-chart-demo",
|
|
136
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
137
|
+
className: "area-chart-demo__controls",
|
|
138
|
+
children: /* @__PURE__ */ jsx(SegmentedControl, {
|
|
139
|
+
"aria-label": "Chart state",
|
|
140
|
+
size: "sm",
|
|
141
|
+
value: state,
|
|
142
|
+
onValueChange: setState,
|
|
143
|
+
options: [
|
|
144
|
+
{
|
|
145
|
+
value: "data",
|
|
146
|
+
label: "With data"
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
value: "loading",
|
|
150
|
+
label: "Loading"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
value: "refreshing",
|
|
154
|
+
label: "Refreshing"
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
value: "empty",
|
|
158
|
+
label: "Empty"
|
|
159
|
+
}
|
|
160
|
+
]
|
|
161
|
+
})
|
|
162
|
+
}), /* @__PURE__ */ jsx(AreaChart, {
|
|
163
|
+
data: state === "data" || state === "refreshing" ? LAST_30_COMPARED : [],
|
|
164
|
+
loading: state === "loading" || state === "refreshing",
|
|
165
|
+
emptyMessage: "No sales in this period yet",
|
|
166
|
+
valueLabel: "Last 30 days",
|
|
167
|
+
compareLabel: "Previous 30 days",
|
|
168
|
+
formatValue: formatGbp,
|
|
169
|
+
formatTick: formatGbpTick
|
|
170
|
+
})]
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Holds the readout open on one day for review, by pointing at the plot the way a mouse would.
|
|
175
|
+
* Moving the real pointer over the chart takes over from there.
|
|
176
|
+
*/
|
|
177
|
+
function HeldOpen({ at, children }) {
|
|
178
|
+
const ref = useRef(null);
|
|
179
|
+
useEffect(() => {
|
|
180
|
+
let frame = requestAnimationFrame(() => {
|
|
181
|
+
frame = requestAnimationFrame(() => {
|
|
182
|
+
const plot = ref.current?.querySelector(".o-area-chart__plot");
|
|
183
|
+
if (!plot) return;
|
|
184
|
+
const rect = plot.getBoundingClientRect();
|
|
185
|
+
plot.dispatchEvent(new PointerEvent("pointermove", {
|
|
186
|
+
bubbles: true,
|
|
187
|
+
clientX: rect.left + rect.width * at,
|
|
188
|
+
clientY: rect.top + rect.height / 2
|
|
189
|
+
}));
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
return () => cancelAnimationFrame(frame);
|
|
193
|
+
}, [at]);
|
|
194
|
+
return /* @__PURE__ */ jsx("div", {
|
|
195
|
+
ref,
|
|
196
|
+
className: "area-chart-held",
|
|
197
|
+
children
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
function Page() {
|
|
201
|
+
return /* @__PURE__ */ jsxs(DocPage, {
|
|
202
|
+
title: "Area chart",
|
|
203
|
+
status: "new",
|
|
204
|
+
importNames: ["AreaChart"],
|
|
205
|
+
lead: "The range chart: one figure over time as a single Orbit line over a wash that fades to nothing, with an optional dashed comparison and a readout that snaps to the nearest day. Reach for it under headline figures, for takings, orders or visits across a range.",
|
|
206
|
+
children: [
|
|
207
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
208
|
+
id: "basics",
|
|
209
|
+
title: "Basics",
|
|
210
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
211
|
+
"Give it one point per day, oldest first, with dates as ",
|
|
212
|
+
/* @__PURE__ */ jsx("code", { children: "YYYY-MM-DD" }),
|
|
213
|
+
" strings (read as local dates) or ",
|
|
214
|
+
/* @__PURE__ */ jsx("code", { children: "Date" }),
|
|
215
|
+
" objects. Hover or tap the chart, or tab to it and use the arrow keys, to read each day."
|
|
216
|
+
] }),
|
|
217
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
218
|
+
clientOnly: true,
|
|
219
|
+
align: "fill",
|
|
220
|
+
code: `
|
|
221
|
+
const gbp = new Intl.NumberFormat('en-GB', { style: 'currency', currency: 'GBP' })
|
|
222
|
+
const gbpCompact = new Intl.NumberFormat('en-GB', {
|
|
223
|
+
style: 'currency', currency: 'GBP', notation: 'compact', maximumFractionDigits: 1,
|
|
224
|
+
})
|
|
225
|
+
|
|
226
|
+
<AreaChart
|
|
227
|
+
data={[{ date: '2026-08-31', value: 2412.5 }, /* one point per day */]}
|
|
228
|
+
valueLabel="Takings"
|
|
229
|
+
formatValue={(v) => gbp.format(v)}
|
|
230
|
+
formatTick={(v) => gbpCompact.format(v)}
|
|
231
|
+
/>`,
|
|
232
|
+
children: /* @__PURE__ */ jsx(AreaChart, {
|
|
233
|
+
data: LAST_30,
|
|
234
|
+
valueLabel: "Takings",
|
|
235
|
+
formatValue: formatGbp,
|
|
236
|
+
formatTick: formatGbpTick
|
|
237
|
+
})
|
|
238
|
+
})
|
|
239
|
+
}),
|
|
240
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
241
|
+
id: "comparison",
|
|
242
|
+
title: "With a comparison",
|
|
243
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
244
|
+
"Add ",
|
|
245
|
+
/* @__PURE__ */ jsx("code", { children: "compare" }),
|
|
246
|
+
" to each point and the chart draws the earlier period as a dashed grey line, adds a legend above the plot, and shows both values and the change in the readout. Name both series for what they are with ",
|
|
247
|
+
/* @__PURE__ */ jsx("code", { children: "valueLabel" }),
|
|
248
|
+
" and ",
|
|
249
|
+
/* @__PURE__ */ jsx("code", { children: "compareLabel" }),
|
|
250
|
+
"."
|
|
251
|
+
] }),
|
|
252
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
253
|
+
clientOnly: true,
|
|
254
|
+
align: "fill",
|
|
255
|
+
code: `
|
|
256
|
+
<AreaChart
|
|
257
|
+
data={[{ date: '2026-08-31', value: 2412.5, compare: 2198 }, /* ... */]}
|
|
258
|
+
valueLabel="Last 30 days"
|
|
259
|
+
compareLabel="Previous 30 days"
|
|
260
|
+
formatValue={(v) => gbp.format(v)}
|
|
261
|
+
formatTick={(v) => gbpCompact.format(v)}
|
|
262
|
+
/>`,
|
|
263
|
+
children: /* @__PURE__ */ jsx(AreaChart, {
|
|
264
|
+
data: LAST_30_COMPARED,
|
|
265
|
+
valueLabel: "Last 30 days",
|
|
266
|
+
compareLabel: "Previous 30 days",
|
|
267
|
+
formatValue: formatGbp,
|
|
268
|
+
formatTick: formatGbpTick
|
|
269
|
+
})
|
|
270
|
+
})
|
|
271
|
+
}),
|
|
272
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
273
|
+
id: "ranges",
|
|
274
|
+
title: "Ranges and refreshes",
|
|
275
|
+
description: /* @__PURE__ */ jsx("p", { children: "A new range (different days) redraws: the old line fades out as the new one is uncovered from the left. A refresh of the same range (same days, new figures) morphs the line, the wash and the gridlines in place, so you can see what changed. Switch the range, then press Refresh." }),
|
|
276
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
277
|
+
clientOnly: true,
|
|
278
|
+
align: "fill",
|
|
279
|
+
code: `
|
|
280
|
+
const [range, setRange] = useState('30')
|
|
281
|
+
|
|
282
|
+
<SegmentedControl aria-label="Range" size="sm" value={range} onValueChange={setRange}
|
|
283
|
+
options={[{ value: '7', label: '7 days' }, { value: '30', label: '30 days' }, { value: '90', label: '90 days' }]} />
|
|
284
|
+
|
|
285
|
+
<AreaChart
|
|
286
|
+
data={takings[range]}
|
|
287
|
+
height={260}
|
|
288
|
+
valueLabel={\`Last \${range} days\`}
|
|
289
|
+
compareLabel={\`Previous \${range} days\`}
|
|
290
|
+
formatValue={(v) => gbp.format(v)}
|
|
291
|
+
formatTick={(v) => gbpCompact.format(v)}
|
|
292
|
+
/>`,
|
|
293
|
+
children: /* @__PURE__ */ jsx(RangeDemo, {})
|
|
294
|
+
})
|
|
295
|
+
}),
|
|
296
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
297
|
+
id: "readout",
|
|
298
|
+
title: "The readout",
|
|
299
|
+
description: /* @__PURE__ */ jsx("p", { children: "The crosshair snaps to the nearest day and the readout glides after it on a spring, opening on whichever side has room and never past the edge of the plot, a phone's included. It leads with the value in Sora, keys each series with a short stroke that matches its line, and shows the change against the comparison. Here it is held open on one day in both themes." }),
|
|
300
|
+
children: /* @__PURE__ */ jsx(ThemePair, {
|
|
301
|
+
clientOnly: true,
|
|
302
|
+
align: "fill",
|
|
303
|
+
children: /* @__PURE__ */ jsx(HeldOpen, {
|
|
304
|
+
at: .72,
|
|
305
|
+
children: /* @__PURE__ */ jsx(AreaChart, {
|
|
306
|
+
data: LAST_30_COMPARED,
|
|
307
|
+
height: 220,
|
|
308
|
+
valueLabel: "Last 30 days",
|
|
309
|
+
compareLabel: "Previous 30 days",
|
|
310
|
+
formatValue: formatGbp,
|
|
311
|
+
formatTick: formatGbpTick
|
|
312
|
+
})
|
|
313
|
+
})
|
|
314
|
+
})
|
|
315
|
+
}),
|
|
316
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
317
|
+
id: "axes",
|
|
318
|
+
title: "Axes and formatting",
|
|
319
|
+
description: /* @__PURE__ */ jsx("p", { children: "Four formatters shape every label. The defaults are UK formats: dates such as \"3 Aug\" on the axis, \"Mon 3 Aug\" in the readout, and compact values such as \"2.5k\" on the gridlines. For hourly data, pass dates for each hour and format them as times (\"14:00\")." }),
|
|
320
|
+
children: [
|
|
321
|
+
/* @__PURE__ */ jsx(Example, {
|
|
322
|
+
clientOnly: true,
|
|
323
|
+
align: "fill",
|
|
324
|
+
code: `
|
|
325
|
+
const hour = (d: Date) => \`\${String(d.getHours()).padStart(2, '0')}:00\`
|
|
326
|
+
|
|
327
|
+
<AreaChart
|
|
328
|
+
data={todayByHour} // { date: Date at each hour, value, compare }
|
|
329
|
+
valueLabel="Today"
|
|
330
|
+
compareLabel="Yesterday"
|
|
331
|
+
formatDate={hour}
|
|
332
|
+
formatTooltipDate={(d) => \`Today, \${hour(d)}\`}
|
|
333
|
+
formatValue={(v) => gbp.format(v)}
|
|
334
|
+
formatTick={(v) => gbpCompact.format(v)}
|
|
335
|
+
/>`,
|
|
336
|
+
children: /* @__PURE__ */ jsx(AreaChart, {
|
|
337
|
+
data: TODAY_BY_HOUR,
|
|
338
|
+
valueLabel: "Today",
|
|
339
|
+
compareLabel: "Yesterday",
|
|
340
|
+
formatDate: formatHour,
|
|
341
|
+
formatTooltipDate: (d) => `Today, ${formatHour(d)}`,
|
|
342
|
+
formatValue: formatGbp,
|
|
343
|
+
formatTick: formatGbpTick
|
|
344
|
+
})
|
|
345
|
+
}),
|
|
346
|
+
/* @__PURE__ */ jsx(DocTable, {
|
|
347
|
+
columns: [
|
|
348
|
+
"Prop",
|
|
349
|
+
"Formats",
|
|
350
|
+
"Default"
|
|
351
|
+
],
|
|
352
|
+
rows: [
|
|
353
|
+
[
|
|
354
|
+
/* @__PURE__ */ jsx("code", { children: "formatDate" }),
|
|
355
|
+
"Dates under the plot",
|
|
356
|
+
"\"3 Aug\": day and short month, en-GB"
|
|
357
|
+
],
|
|
358
|
+
[
|
|
359
|
+
/* @__PURE__ */ jsx("code", { children: "formatTooltipDate" }),
|
|
360
|
+
"The date heading the readout",
|
|
361
|
+
"\"Mon 3 Aug\": weekday, day and short month"
|
|
362
|
+
],
|
|
363
|
+
[
|
|
364
|
+
/* @__PURE__ */ jsx("code", { children: "formatTick" }),
|
|
365
|
+
"Gridline labels",
|
|
366
|
+
"\"2.5k\": a compact number"
|
|
367
|
+
],
|
|
368
|
+
[
|
|
369
|
+
/* @__PURE__ */ jsx("code", { children: "formatValue" }),
|
|
370
|
+
"Values in the readout and the accessible summary",
|
|
371
|
+
"\"2,512.4\": a grouped number"
|
|
372
|
+
]
|
|
373
|
+
]
|
|
374
|
+
}),
|
|
375
|
+
/* @__PURE__ */ jsxs(Note, {
|
|
376
|
+
title: "Sep, not Sept",
|
|
377
|
+
children: [
|
|
378
|
+
"Current browsers write September as \"Sept\" in en-GB. The kit's dates write \"Sep\", three letters as every other month, so the defaults show \"29 Sep\". Build your own ",
|
|
379
|
+
/* @__PURE__ */ jsx("code", { children: "formatDate" }),
|
|
380
|
+
" with the kit's ",
|
|
381
|
+
/* @__PURE__ */ jsx("code", { children: "dateFormatter" }),
|
|
382
|
+
" to write it the same way, as the examples here do, or with ",
|
|
383
|
+
/* @__PURE__ */ jsx("code", { children: "Intl" }),
|
|
384
|
+
" for the browser's spelling."
|
|
385
|
+
]
|
|
386
|
+
}),
|
|
387
|
+
/* @__PURE__ */ jsx(SubSection, {
|
|
388
|
+
title: "How many labels",
|
|
389
|
+
description: /* @__PURE__ */ jsx("p", { children: "Dates are spaced to fit, roughly one per 84px, counted back from the latest day so today always has a label. The first and last labels align to the edges of the plot. Gridlines fall on round values (steps of 1, 2, 2.5 or 5) and always include zero." })
|
|
390
|
+
})
|
|
391
|
+
]
|
|
392
|
+
}),
|
|
393
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
394
|
+
id: "gaps",
|
|
395
|
+
title: "Gaps in the data",
|
|
396
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
397
|
+
"A ",
|
|
398
|
+
/* @__PURE__ */ jsx("code", { children: "null" }),
|
|
399
|
+
" value is a reading nobody took: the line and its wash break there rather than drawing a slope across it, and the readout, the announcement and the table say \"No data\" (",
|
|
400
|
+
/* @__PURE__ */ jsx("code", { children: "noDataLabel" }),
|
|
401
|
+
"). A reading alone between two gaps is a dot. The comparison line, when there is one, still joins across its own missing days, as it always has."
|
|
402
|
+
] }),
|
|
403
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
404
|
+
clientOnly: true,
|
|
405
|
+
align: "fill",
|
|
406
|
+
code: `
|
|
407
|
+
<AreaChart
|
|
408
|
+
data={[
|
|
409
|
+
{ date: '2026-09-03T04:00', value: 24 },
|
|
410
|
+
{ date: '2026-09-03T06:00', value: null }, // the agent missed it
|
|
411
|
+
{ date: '2026-09-03T08:00', value: 47 },
|
|
412
|
+
/* ... */
|
|
413
|
+
]}
|
|
414
|
+
max={100}
|
|
415
|
+
formatValue={(v) => \`\${v}%\`}
|
|
416
|
+
formatTick={(v) => \`\${v}%\`}
|
|
417
|
+
/>`,
|
|
418
|
+
children: /* @__PURE__ */ jsx(AreaChart, {
|
|
419
|
+
data: CPU_DAY,
|
|
420
|
+
max: 100,
|
|
421
|
+
height: 200,
|
|
422
|
+
valueLabel: "CPU",
|
|
423
|
+
formatValue: percent,
|
|
424
|
+
formatTick: percent,
|
|
425
|
+
formatDate: (d) => cpuTime.format(d),
|
|
426
|
+
formatTooltipDate: (d) => cpuReadout.format(d)
|
|
427
|
+
})
|
|
428
|
+
})
|
|
429
|
+
}),
|
|
430
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
431
|
+
id: "fixed-axis",
|
|
432
|
+
title: "A fixed value axis",
|
|
433
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
434
|
+
"A percentage reads best on its whole range: ",
|
|
435
|
+
/* @__PURE__ */ jsx("code", { children: "min" }),
|
|
436
|
+
" and ",
|
|
437
|
+
/* @__PURE__ */ jsx("code", { children: "max" }),
|
|
438
|
+
" fix the axis' ends (0 to 100 for a server's load, above), whatever the data, with round gridlines inside them, and a value past an end is drawn at it. Without them the axis rounds out the data to round steps, with zero in it.",
|
|
439
|
+
" ",
|
|
440
|
+
/* @__PURE__ */ jsx("code", { children: "wholeTicks" }),
|
|
441
|
+
" keeps a count's axis on whole numbers and ",
|
|
442
|
+
/* @__PURE__ */ jsx("code", { children: "maxTicks" }),
|
|
443
|
+
" caps its gridlines."
|
|
444
|
+
] })
|
|
445
|
+
}),
|
|
446
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
447
|
+
id: "states",
|
|
448
|
+
title: "Loading and empty",
|
|
449
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
450
|
+
"With ",
|
|
451
|
+
/* @__PURE__ */ jsx("code", { children: "loading" }),
|
|
452
|
+
" and no data yet, a soft silhouette of a chart shimmers where the plot will be. With ",
|
|
453
|
+
/* @__PURE__ */ jsx("code", { children: "loading" }),
|
|
454
|
+
" and data already drawn, the chart holds its frame at half strength until the new data lands. With no data, ",
|
|
455
|
+
/* @__PURE__ */ jsx("code", { children: "emptyMessage" }),
|
|
456
|
+
" sits in the middle of the plot. Without data the axis labels no scale, keeping its width so the plot does not jump."
|
|
457
|
+
] }),
|
|
458
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
459
|
+
clientOnly: true,
|
|
460
|
+
align: "fill",
|
|
461
|
+
code: `
|
|
462
|
+
<AreaChart data={[]} loading />
|
|
463
|
+
<AreaChart data={data} loading /> // refreshing: dims and holds its frame
|
|
464
|
+
<AreaChart data={[]} emptyMessage="No sales in this period yet" />`,
|
|
465
|
+
children: /* @__PURE__ */ jsx(StatesDemo, {})
|
|
466
|
+
})
|
|
467
|
+
}),
|
|
468
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
469
|
+
id: "motion",
|
|
470
|
+
title: "Motion",
|
|
471
|
+
children: /* @__PURE__ */ jsx(DocTable, {
|
|
472
|
+
columns: ["Moment", "What happens"],
|
|
473
|
+
rows: [
|
|
474
|
+
["Arrival", "The line is uncovered left to right behind a soft edge over 720ms, and the wash settles in after it."],
|
|
475
|
+
["A new range", "The old line fades out over 220ms while the new one is uncovered."],
|
|
476
|
+
["A refresh", "The line, wash and comparison morph to their new shape over 720ms, and gridlines and their labels glide with them."],
|
|
477
|
+
["Reading", "The crosshair, markers and readout glide from day to day on the snappy spring."],
|
|
478
|
+
["Reduced motion", "The line fades in, refreshes swap without morphing, the readout jumps, and the loading silhouette breathes instead of shimmering."]
|
|
479
|
+
]
|
|
480
|
+
})
|
|
481
|
+
}),
|
|
482
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
483
|
+
id: "guidelines",
|
|
484
|
+
title: "Guidelines",
|
|
485
|
+
children: [/* @__PURE__ */ jsx(DoDont, {
|
|
486
|
+
clientOnly: true,
|
|
487
|
+
do: {
|
|
488
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
489
|
+
className: "area-chart-dodont",
|
|
490
|
+
children: /* @__PURE__ */ jsx(AreaChart, {
|
|
491
|
+
data: LAST_14,
|
|
492
|
+
height: 140,
|
|
493
|
+
formatValue: formatGbp,
|
|
494
|
+
formatTick: formatGbpTick
|
|
495
|
+
})
|
|
496
|
+
}),
|
|
497
|
+
caption: "Compact money on the gridlines (\"£4k\"), full amounts in the readout where they can be read."
|
|
498
|
+
},
|
|
499
|
+
dont: {
|
|
500
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
501
|
+
className: "area-chart-dodont",
|
|
502
|
+
children: /* @__PURE__ */ jsx(AreaChart, {
|
|
503
|
+
data: LAST_14,
|
|
504
|
+
height: 140,
|
|
505
|
+
formatValue: formatGbp,
|
|
506
|
+
formatTick: formatGbp
|
|
507
|
+
})
|
|
508
|
+
}),
|
|
509
|
+
caption: "Full amounts on the axis push the plot aside and make every gridline a figure to read."
|
|
510
|
+
}
|
|
511
|
+
}), /* @__PURE__ */ jsx(Guidelines, { items: [
|
|
512
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
513
|
+
"One figure at a time. To offer several, put them in ",
|
|
514
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
515
|
+
to: "/components/figure-tabs",
|
|
516
|
+
children: "Figure tabs"
|
|
517
|
+
}),
|
|
518
|
+
" ",
|
|
519
|
+
"above the chart and let it follow the one that is selected."
|
|
520
|
+
] }),
|
|
521
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
522
|
+
"Choose the range with a ",
|
|
523
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
524
|
+
to: "/components/segmented-control",
|
|
525
|
+
children: "Segmented control"
|
|
526
|
+
}),
|
|
527
|
+
" above the chart, and compare with the period just before it, of the same length, unless the page says otherwise."
|
|
528
|
+
] }),
|
|
529
|
+
"Name the comparison for what it is: \"Previous 30 days\" or \"Same days last year\", never just \"Before\".",
|
|
530
|
+
"Give it room: 240px (the default) on a page, 200px at the least. The height includes the date labels; the legend sits above."
|
|
531
|
+
] })]
|
|
532
|
+
}),
|
|
533
|
+
/* @__PURE__ */ jsx(Section$1, {
|
|
534
|
+
id: "accessibility",
|
|
535
|
+
title: "Accessibility",
|
|
536
|
+
children: /* @__PURE__ */ jsx(Guidelines, { items: [
|
|
537
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
538
|
+
"The plot is a group, described as a chart, with a summary for its name, generated from the data unless you pass ",
|
|
539
|
+
/* @__PURE__ */ jsx("code", { children: "label" }),
|
|
540
|
+
": the range, the highest and lowest days, the comparison, and how to read it with the arrow keys."
|
|
541
|
+
] }),
|
|
542
|
+
"A visually hidden table repeats every day: its date, the value and, with a comparison, the earlier figure, so the numbers are there for assistive technology in browse mode too.",
|
|
543
|
+
"Tab to the plot and it reads the latest day. Left and right arrows step through the days, Home and End jump to the ends, and Escape hides the readout; the next arrow picks up where it left off. Each step is announced politely.",
|
|
544
|
+
"On a touch screen, a tap reads the day under the finger and the readout follows a drag. It stays when the finger lifts, until a tap anywhere else or a scroll.",
|
|
545
|
+
"The focus ring is teal, 2px, and sits 6px outside the plot.",
|
|
546
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
547
|
+
"While ",
|
|
548
|
+
/* @__PURE__ */ jsx("code", { children: "loading" }),
|
|
549
|
+
", the plot is marked busy. The readout itself is hidden from assistive tech, because the announcement already says what it shows."
|
|
550
|
+
] }),
|
|
551
|
+
"Every movement respects reduced motion (see Motion).",
|
|
552
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
553
|
+
"The words it adds for assistive technology are English by default, and each one can be replaced:",
|
|
554
|
+
" ",
|
|
555
|
+
/* @__PURE__ */ jsx("code", { children: "legendLabel" }),
|
|
556
|
+
", ",
|
|
557
|
+
/* @__PURE__ */ jsx("code", { children: "dateLabel" }),
|
|
558
|
+
", ",
|
|
559
|
+
/* @__PURE__ */ jsx("code", { children: "noDataLabel" }),
|
|
560
|
+
", ",
|
|
561
|
+
/* @__PURE__ */ jsx("code", { children: "keyboardHint" }),
|
|
562
|
+
" and",
|
|
563
|
+
" ",
|
|
564
|
+
/* @__PURE__ */ jsx("code", { children: "roleDescription" }),
|
|
565
|
+
"."
|
|
566
|
+
] }),
|
|
567
|
+
"Under forced colours the line keeps its colour (the chart is SVG), and so do the markers; the crosshair takes the system text colour."
|
|
568
|
+
] })
|
|
569
|
+
}),
|
|
570
|
+
/* @__PURE__ */ jsxs(Section$1, {
|
|
571
|
+
id: "props",
|
|
572
|
+
title: "Props",
|
|
573
|
+
description: /* @__PURE__ */ jsx("p", { children: "Also accepts every native div attribute except children." }),
|
|
574
|
+
children: [/* @__PURE__ */ jsx(PropsTable, { rows: [
|
|
575
|
+
{
|
|
576
|
+
name: "data",
|
|
577
|
+
type: "readonly (AreaChartDatum | AreaChartGap)[]",
|
|
578
|
+
required: true,
|
|
579
|
+
description: "One point per day (or bucket), oldest first. A point whose value is null (AreaChartGap) is a gap."
|
|
580
|
+
},
|
|
581
|
+
{
|
|
582
|
+
name: "height",
|
|
583
|
+
type: "number",
|
|
584
|
+
default: "240",
|
|
585
|
+
description: "Height in px of the plot and its date labels. The legend sits above."
|
|
586
|
+
},
|
|
587
|
+
{
|
|
588
|
+
name: "valueLabel",
|
|
589
|
+
type: "string",
|
|
590
|
+
default: "'This period'",
|
|
591
|
+
description: "Names the main series in the legend and the summary."
|
|
592
|
+
},
|
|
593
|
+
{
|
|
594
|
+
name: "compareLabel",
|
|
595
|
+
type: "string",
|
|
596
|
+
default: "'Previous period'",
|
|
597
|
+
description: "Names the comparison series."
|
|
598
|
+
},
|
|
599
|
+
{
|
|
600
|
+
name: "formatValue",
|
|
601
|
+
type: "(value: number) => string",
|
|
602
|
+
default: "grouped number",
|
|
603
|
+
description: "Values in the readout and the summary."
|
|
604
|
+
},
|
|
605
|
+
{
|
|
606
|
+
name: "formatTick",
|
|
607
|
+
type: "(value: number) => string",
|
|
608
|
+
default: "compact number",
|
|
609
|
+
description: "Gridline labels, e.g. \"2.5k\"."
|
|
610
|
+
},
|
|
611
|
+
{
|
|
612
|
+
name: "min",
|
|
613
|
+
type: "number",
|
|
614
|
+
description: "Fixes the axis' lowest value; otherwise zero, or the round step below the lowest value."
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
name: "max",
|
|
618
|
+
type: "number",
|
|
619
|
+
description: "Fixes the axis' highest value (100 for a percentage)."
|
|
620
|
+
},
|
|
621
|
+
{
|
|
622
|
+
name: "wholeTicks",
|
|
623
|
+
type: "boolean",
|
|
624
|
+
default: "false",
|
|
625
|
+
description: "Labels the axis in whole numbers only."
|
|
626
|
+
},
|
|
627
|
+
{
|
|
628
|
+
name: "maxTicks",
|
|
629
|
+
type: "number",
|
|
630
|
+
description: "At most this many gridlines."
|
|
631
|
+
},
|
|
632
|
+
{
|
|
633
|
+
name: "formatDate",
|
|
634
|
+
type: "(date: Date) => string",
|
|
635
|
+
default: "day and month",
|
|
636
|
+
description: "Dates under the plot, e.g. \"3 Aug\"."
|
|
637
|
+
},
|
|
638
|
+
{
|
|
639
|
+
name: "formatTooltipDate",
|
|
640
|
+
type: "(date: Date) => string",
|
|
641
|
+
default: "weekday, day and month",
|
|
642
|
+
description: "The date heading the readout."
|
|
643
|
+
},
|
|
644
|
+
{
|
|
645
|
+
name: "loading",
|
|
646
|
+
type: "boolean",
|
|
647
|
+
default: "false",
|
|
648
|
+
description: "A shimmering silhouette with no data; a dimmed, held frame with data."
|
|
649
|
+
},
|
|
650
|
+
{
|
|
651
|
+
name: "emptyMessage",
|
|
652
|
+
type: "ReactNode",
|
|
653
|
+
default: "'Nothing to show for this period yet'",
|
|
654
|
+
description: "Shown in the plot when data is empty."
|
|
655
|
+
},
|
|
656
|
+
{
|
|
657
|
+
name: "label",
|
|
658
|
+
type: "string",
|
|
659
|
+
description: "Accessible summary. Generated from the data when omitted."
|
|
660
|
+
},
|
|
661
|
+
{
|
|
662
|
+
name: "legendLabel",
|
|
663
|
+
type: "string",
|
|
664
|
+
default: "label, or 'Series'",
|
|
665
|
+
description: "Names the legend, shown with a comparison, for assistive technology."
|
|
666
|
+
},
|
|
667
|
+
{
|
|
668
|
+
name: "dateLabel",
|
|
669
|
+
type: "string",
|
|
670
|
+
default: "'Date'",
|
|
671
|
+
description: "Heads the hidden table’s column of dates."
|
|
672
|
+
},
|
|
673
|
+
{
|
|
674
|
+
name: "noDataLabel",
|
|
675
|
+
type: "string",
|
|
676
|
+
default: "'No data'",
|
|
677
|
+
description: "Stands in the readout, the announcement and the table for a day with no value."
|
|
678
|
+
},
|
|
679
|
+
{
|
|
680
|
+
name: "keyboardHint",
|
|
681
|
+
type: "string",
|
|
682
|
+
default: "'Use the arrow keys to read each point.'",
|
|
683
|
+
description: "Ends the summary generated when there is no label."
|
|
684
|
+
},
|
|
685
|
+
{
|
|
686
|
+
name: "roleDescription",
|
|
687
|
+
type: "string",
|
|
688
|
+
default: "'chart'",
|
|
689
|
+
description: "What assistive technology calls the plot after its name."
|
|
690
|
+
}
|
|
691
|
+
] }), /* @__PURE__ */ jsx(PropsTable, {
|
|
692
|
+
title: "AreaChartDatum",
|
|
693
|
+
rows: [
|
|
694
|
+
{
|
|
695
|
+
name: "date",
|
|
696
|
+
type: "string | Date",
|
|
697
|
+
required: true,
|
|
698
|
+
description: "The day or bucket. YYYY-MM-DD strings are read as local dates."
|
|
699
|
+
},
|
|
700
|
+
{
|
|
701
|
+
name: "value",
|
|
702
|
+
type: "number",
|
|
703
|
+
required: true,
|
|
704
|
+
description: "The figure for that day."
|
|
705
|
+
},
|
|
706
|
+
{
|
|
707
|
+
name: "compare",
|
|
708
|
+
type: "number | null",
|
|
709
|
+
description: "The same point in the comparison period, drawn dashed."
|
|
710
|
+
}
|
|
711
|
+
]
|
|
712
|
+
})]
|
|
713
|
+
})
|
|
714
|
+
]
|
|
715
|
+
});
|
|
716
|
+
}
|
|
717
|
+
//#endregion
|
|
718
|
+
export { Page, Preview };
|