@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,606 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMemo, useState } from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { AreaChart, Delta, FigureTabs, RollingNumber, SegmentedControl } from "@orbitcommerce/constellation";
|
|
5
|
+
//#region src/pages/components/_figures-data.tsx
|
|
6
|
+
var GBP = {
|
|
7
|
+
style: "currency",
|
|
8
|
+
currency: "GBP"
|
|
9
|
+
};
|
|
10
|
+
var RATE = {
|
|
11
|
+
style: "percent",
|
|
12
|
+
minimumFractionDigits: 1,
|
|
13
|
+
maximumFractionDigits: 1
|
|
14
|
+
};
|
|
15
|
+
var WHOLE = { maximumFractionDigits: 0 };
|
|
16
|
+
var gbp = new Intl.NumberFormat("en-GB", GBP);
|
|
17
|
+
var gbpCompact = new Intl.NumberFormat("en-GB", {
|
|
18
|
+
...GBP,
|
|
19
|
+
notation: "compact",
|
|
20
|
+
maximumFractionDigits: 1
|
|
21
|
+
});
|
|
22
|
+
var whole = new Intl.NumberFormat("en-GB", WHOLE);
|
|
23
|
+
var compact = new Intl.NumberFormat("en-GB", {
|
|
24
|
+
notation: "compact",
|
|
25
|
+
maximumFractionDigits: 1
|
|
26
|
+
});
|
|
27
|
+
var formatGbp = (n) => gbp.format(n);
|
|
28
|
+
var formatGbpTick = (n) => gbpCompact.format(n);
|
|
29
|
+
var formatCount = (n) => whole.format(n);
|
|
30
|
+
var formatCountTick = (n) => compact.format(n);
|
|
31
|
+
/** Rates are kept in percent units (3.1 means 3.1%). */
|
|
32
|
+
var formatRate$1 = (n) => `${n.toFixed(1)}%`;
|
|
33
|
+
var formatRateTick = (n) => `${Math.round(n * 10) / 10}%`;
|
|
34
|
+
/** Hourly axis labels: "14:00". */
|
|
35
|
+
var formatHour = (d) => `${String(d.getHours()).padStart(2, "0")}:00`;
|
|
36
|
+
var round2 = (n) => Math.round(n * 100) / 100;
|
|
37
|
+
/** The demos pin the clock to 20:24, so most of the day has already traded. */
|
|
38
|
+
var NOW_MINUTES = 1224;
|
|
39
|
+
/** A moment `minutes` past midnight, `dayOffset` days from today, on the viewer's clock. */
|
|
40
|
+
function dayAt(dayOffset, minutes) {
|
|
41
|
+
const d = /* @__PURE__ */ new Date();
|
|
42
|
+
d.setDate(d.getDate() + dayOffset);
|
|
43
|
+
d.setHours(0, minutes, 0, 0);
|
|
44
|
+
return d;
|
|
45
|
+
}
|
|
46
|
+
var minutesOf = (d) => d.getHours() * 60 + d.getMinutes();
|
|
47
|
+
var hm = (time) => {
|
|
48
|
+
const [h, m] = time.split(":").map(Number);
|
|
49
|
+
return (h ?? 0) * 60 + (m ?? 0);
|
|
50
|
+
};
|
|
51
|
+
var TODAY_ROWS = [
|
|
52
|
+
[
|
|
53
|
+
"07:12",
|
|
54
|
+
45,
|
|
55
|
+
"Sarah Whitfield",
|
|
56
|
+
1
|
|
57
|
+
],
|
|
58
|
+
[
|
|
59
|
+
"08:03",
|
|
60
|
+
129,
|
|
61
|
+
"James Okafor",
|
|
62
|
+
2
|
|
63
|
+
],
|
|
64
|
+
[
|
|
65
|
+
"08:47",
|
|
66
|
+
68.5,
|
|
67
|
+
"Rachel Adams",
|
|
68
|
+
1
|
|
69
|
+
],
|
|
70
|
+
[
|
|
71
|
+
"09:26",
|
|
72
|
+
18.99,
|
|
73
|
+
"Tom Hughes",
|
|
74
|
+
1
|
|
75
|
+
],
|
|
76
|
+
[
|
|
77
|
+
"10:14",
|
|
78
|
+
249,
|
|
79
|
+
"Aisha Rahman",
|
|
80
|
+
1
|
|
81
|
+
],
|
|
82
|
+
[
|
|
83
|
+
"11:02",
|
|
84
|
+
34.37,
|
|
85
|
+
"Oliver Barnes",
|
|
86
|
+
2
|
|
87
|
+
],
|
|
88
|
+
[
|
|
89
|
+
"11:48",
|
|
90
|
+
89.95,
|
|
91
|
+
"Chloe Evans",
|
|
92
|
+
1
|
|
93
|
+
],
|
|
94
|
+
[
|
|
95
|
+
"12:06",
|
|
96
|
+
420,
|
|
97
|
+
"Daniel Murray",
|
|
98
|
+
2
|
|
99
|
+
],
|
|
100
|
+
[
|
|
101
|
+
"12:19",
|
|
102
|
+
59,
|
|
103
|
+
"Emma Clarke",
|
|
104
|
+
1
|
|
105
|
+
],
|
|
106
|
+
[
|
|
107
|
+
"12:31",
|
|
108
|
+
24.5,
|
|
109
|
+
"Harry Doyle",
|
|
110
|
+
1,
|
|
111
|
+
"pending"
|
|
112
|
+
],
|
|
113
|
+
[
|
|
114
|
+
"12:31",
|
|
115
|
+
145,
|
|
116
|
+
"Fatima Begum",
|
|
117
|
+
1
|
|
118
|
+
],
|
|
119
|
+
[
|
|
120
|
+
"12:54",
|
|
121
|
+
76,
|
|
122
|
+
"George Fletcher",
|
|
123
|
+
3
|
|
124
|
+
],
|
|
125
|
+
[
|
|
126
|
+
"13:12",
|
|
127
|
+
38,
|
|
128
|
+
"Megan Lloyd",
|
|
129
|
+
1,
|
|
130
|
+
"refunded"
|
|
131
|
+
],
|
|
132
|
+
[
|
|
133
|
+
"13:40",
|
|
134
|
+
199,
|
|
135
|
+
"Ravi Kaur",
|
|
136
|
+
1
|
|
137
|
+
],
|
|
138
|
+
[
|
|
139
|
+
"14:32",
|
|
140
|
+
120,
|
|
141
|
+
"Lucy Bennett",
|
|
142
|
+
2
|
|
143
|
+
],
|
|
144
|
+
[
|
|
145
|
+
"15:47",
|
|
146
|
+
64,
|
|
147
|
+
"Callum Reid",
|
|
148
|
+
1
|
|
149
|
+
],
|
|
150
|
+
[
|
|
151
|
+
"16:58",
|
|
152
|
+
52.5,
|
|
153
|
+
"Zara Hussain",
|
|
154
|
+
1
|
|
155
|
+
],
|
|
156
|
+
[
|
|
157
|
+
"18:05",
|
|
158
|
+
310,
|
|
159
|
+
"Ben Cole",
|
|
160
|
+
2
|
|
161
|
+
],
|
|
162
|
+
[
|
|
163
|
+
"18:22",
|
|
164
|
+
27.99,
|
|
165
|
+
"Holly Price",
|
|
166
|
+
1
|
|
167
|
+
],
|
|
168
|
+
[
|
|
169
|
+
"18:41",
|
|
170
|
+
168,
|
|
171
|
+
"Ewan Grant",
|
|
172
|
+
1
|
|
173
|
+
],
|
|
174
|
+
[
|
|
175
|
+
"19:07",
|
|
176
|
+
95,
|
|
177
|
+
"Grace Turner",
|
|
178
|
+
2
|
|
179
|
+
],
|
|
180
|
+
[
|
|
181
|
+
"19:33",
|
|
182
|
+
240,
|
|
183
|
+
"Isaac Brown",
|
|
184
|
+
1,
|
|
185
|
+
"pending"
|
|
186
|
+
],
|
|
187
|
+
[
|
|
188
|
+
"20:02",
|
|
189
|
+
579,
|
|
190
|
+
"Nadia Ahmed",
|
|
191
|
+
3
|
|
192
|
+
]
|
|
193
|
+
];
|
|
194
|
+
var YESTERDAY_ROWS = [
|
|
195
|
+
["06:48", 32],
|
|
196
|
+
["07:35", 89],
|
|
197
|
+
["08:20", 145],
|
|
198
|
+
["09:02", 24.99],
|
|
199
|
+
["09:41", 210],
|
|
200
|
+
["10:26", 56.5],
|
|
201
|
+
["11:05", 72],
|
|
202
|
+
["11:37", 18.5],
|
|
203
|
+
["12:02", 265],
|
|
204
|
+
["12:15", 39],
|
|
205
|
+
["12:28", 129],
|
|
206
|
+
["12:44", 84],
|
|
207
|
+
["13:05", 46],
|
|
208
|
+
["13:26", 199],
|
|
209
|
+
["14:10", 61.5],
|
|
210
|
+
["14:55", 88],
|
|
211
|
+
["15:38", 142],
|
|
212
|
+
["16:20", 35],
|
|
213
|
+
["17:12", 97],
|
|
214
|
+
["17:58", 228],
|
|
215
|
+
["18:30", 64],
|
|
216
|
+
["19:02", 149],
|
|
217
|
+
["19:40", 52],
|
|
218
|
+
["20:05", 544],
|
|
219
|
+
["20:40", 115],
|
|
220
|
+
["21:15", 79],
|
|
221
|
+
["21:50", 189],
|
|
222
|
+
["22:30", 45],
|
|
223
|
+
["23:05", 22.5],
|
|
224
|
+
["23:40", 68]
|
|
225
|
+
];
|
|
226
|
+
var FIRST_ORDER = 1021;
|
|
227
|
+
function sale(number, minutes, amount, customer, items, status = "paid") {
|
|
228
|
+
return {
|
|
229
|
+
id: `sale-${number}`,
|
|
230
|
+
number,
|
|
231
|
+
at: dayAt(0, minutes),
|
|
232
|
+
amount,
|
|
233
|
+
customer,
|
|
234
|
+
items,
|
|
235
|
+
status,
|
|
236
|
+
label: `Order #${number} from ${customer}`
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
/** Today's sales up to 20:24, oldest first. */
|
|
240
|
+
var TODAY = TODAY_ROWS.map(([time, amount, customer, items, status], i) => sale(FIRST_ORDER + i, hm(time), amount, customer, items, status));
|
|
241
|
+
/** Yesterday's whole day, for the inner ring. */
|
|
242
|
+
var YESTERDAY = YESTERDAY_ROWS.map(([time, amount], i) => ({
|
|
243
|
+
id: `yesterday-${i}`,
|
|
244
|
+
at: dayAt(-1, hm(time)),
|
|
245
|
+
amount
|
|
246
|
+
}));
|
|
247
|
+
/** Takings count paid sales only: pending money has not arrived and refunds went back. */
|
|
248
|
+
var takingsOf = (list) => round2(list.reduce((sum, s) => (s.status ?? "paid") === "paid" ? sum + s.amount : sum, 0));
|
|
249
|
+
/** Yesterday's takings up to the same clock time, so the comparison is fair all day. */
|
|
250
|
+
var yesterdayUntil = (minutes) => takingsOf(YESTERDAY.filter((s) => minutesOf(s.at) <= minutes));
|
|
251
|
+
/** Percentage change, or 0 when there is nothing to compare with. */
|
|
252
|
+
var changeOf = (value, previous) => previous ? (value - previous) / previous * 100 : 0;
|
|
253
|
+
var NEW_SALES = [
|
|
254
|
+
[
|
|
255
|
+
64,
|
|
256
|
+
"Rosie Carter",
|
|
257
|
+
1
|
|
258
|
+
],
|
|
259
|
+
[
|
|
260
|
+
129,
|
|
261
|
+
"Samir Khan",
|
|
262
|
+
2
|
|
263
|
+
],
|
|
264
|
+
[
|
|
265
|
+
38.5,
|
|
266
|
+
"Hannah Wright",
|
|
267
|
+
1
|
|
268
|
+
],
|
|
269
|
+
[
|
|
270
|
+
249,
|
|
271
|
+
"Joe Parry",
|
|
272
|
+
1
|
|
273
|
+
],
|
|
274
|
+
[
|
|
275
|
+
89.95,
|
|
276
|
+
"Amelia Stone",
|
|
277
|
+
1
|
|
278
|
+
],
|
|
279
|
+
[
|
|
280
|
+
18.99,
|
|
281
|
+
"Luke Harris",
|
|
282
|
+
1
|
|
283
|
+
],
|
|
284
|
+
[
|
|
285
|
+
175,
|
|
286
|
+
"Maya Collins",
|
|
287
|
+
2
|
|
288
|
+
]
|
|
289
|
+
];
|
|
290
|
+
/** The next invented sale for a "Simulate a sale" button: the n-th after the sample day. */
|
|
291
|
+
function nextSale(n, minutes) {
|
|
292
|
+
const [amount, customer, items] = NEW_SALES[n % NEW_SALES.length];
|
|
293
|
+
return sale(FIRST_ORDER + TODAY_ROWS.length + n, minutes, amount, customer, items);
|
|
294
|
+
}
|
|
295
|
+
function random(seed) {
|
|
296
|
+
return () => {
|
|
297
|
+
seed = seed + 1831565813 | 0;
|
|
298
|
+
let t = Math.imul(seed ^ seed >>> 15, 1 | seed);
|
|
299
|
+
t = t + Math.imul(t ^ t >>> 7, 61 | t) ^ t;
|
|
300
|
+
return ((t ^ t >>> 14) >>> 0) / 4294967296;
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
var HISTORY_DAYS = 730;
|
|
304
|
+
var WEEKDAY = [
|
|
305
|
+
1.2,
|
|
306
|
+
.85,
|
|
307
|
+
.9,
|
|
308
|
+
.95,
|
|
309
|
+
1,
|
|
310
|
+
1.1,
|
|
311
|
+
1.35
|
|
312
|
+
];
|
|
313
|
+
var TODAY_SESSIONS = 742;
|
|
314
|
+
var HISTORY = (() => {
|
|
315
|
+
const rand = random(7);
|
|
316
|
+
const out = [];
|
|
317
|
+
for (let i = 0; i < HISTORY_DAYS; i++) {
|
|
318
|
+
const date = /* @__PURE__ */ new Date();
|
|
319
|
+
date.setHours(0, 0, 0, 0);
|
|
320
|
+
date.setDate(date.getDate() - (729 - i));
|
|
321
|
+
const trend = 1 + 34e-5 * i;
|
|
322
|
+
const season = 1 + .1 * Math.sin((i + 60) / 365 * Math.PI * 2);
|
|
323
|
+
const sales = round2(2150 * trend * season * WEEKDAY[date.getDay()] * (1 + (rand() - .5) * .38));
|
|
324
|
+
const orders = Math.max(1, Math.round(sales / (140 + rand() * 26)));
|
|
325
|
+
const sessions = Math.round(orders / (.027 + rand() * .008));
|
|
326
|
+
out.push({
|
|
327
|
+
date,
|
|
328
|
+
sales,
|
|
329
|
+
orders,
|
|
330
|
+
sessions
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
const last = out[out.length - 1];
|
|
334
|
+
last.sales = takingsOf(TODAY);
|
|
335
|
+
last.orders = TODAY.length;
|
|
336
|
+
last.sessions = TODAY_SESSIONS;
|
|
337
|
+
return out;
|
|
338
|
+
})();
|
|
339
|
+
var iso = (d) => `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
|
|
340
|
+
/** Daily takings for the last `days` days (today last), compared with the period before. */
|
|
341
|
+
function takingsSeries(days, compare = "previous") {
|
|
342
|
+
return Array.from({ length: days }, (_, j) => {
|
|
343
|
+
const i = HISTORY_DAYS - days + j;
|
|
344
|
+
const day = HISTORY[i];
|
|
345
|
+
const other = compare === "previous" ? HISTORY[i - days] : compare === "last-year" ? HISTORY[i - 364] : void 0;
|
|
346
|
+
return compare === "none" ? {
|
|
347
|
+
date: iso(day.date),
|
|
348
|
+
value: day.sales
|
|
349
|
+
} : {
|
|
350
|
+
date: iso(day.date),
|
|
351
|
+
value: day.sales,
|
|
352
|
+
compare: other?.sales ?? null
|
|
353
|
+
};
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
var HOURLY_VISITS = [
|
|
357
|
+
4,
|
|
358
|
+
2,
|
|
359
|
+
1,
|
|
360
|
+
1,
|
|
361
|
+
1,
|
|
362
|
+
4,
|
|
363
|
+
14,
|
|
364
|
+
27,
|
|
365
|
+
36,
|
|
366
|
+
40,
|
|
367
|
+
37,
|
|
368
|
+
40,
|
|
369
|
+
52,
|
|
370
|
+
49,
|
|
371
|
+
37,
|
|
372
|
+
33,
|
|
373
|
+
33,
|
|
374
|
+
36,
|
|
375
|
+
43,
|
|
376
|
+
55,
|
|
377
|
+
61,
|
|
378
|
+
48,
|
|
379
|
+
26,
|
|
380
|
+
10
|
|
381
|
+
];
|
|
382
|
+
function hours(list, dayOffset, lastHour) {
|
|
383
|
+
return Array.from({ length: lastHour + 1 }, (_, h) => {
|
|
384
|
+
const inHour = list.filter((s) => s.at.getHours() === h);
|
|
385
|
+
return {
|
|
386
|
+
date: dayAt(dayOffset, h * 60),
|
|
387
|
+
sales: takingsOf(inHour),
|
|
388
|
+
orders: inHour.length,
|
|
389
|
+
sessions: HOURLY_VISITS[h] + (dayOffset === 0 ? 0 : h * 7 % 5)
|
|
390
|
+
};
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
var RANGE_OPTIONS = [
|
|
394
|
+
{
|
|
395
|
+
value: "today",
|
|
396
|
+
label: "Today"
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
value: "7",
|
|
400
|
+
label: "7 days"
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
value: "30",
|
|
404
|
+
label: "30 days"
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
value: "90",
|
|
408
|
+
label: "90 days"
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
value: "365",
|
|
412
|
+
label: "12 months"
|
|
413
|
+
}
|
|
414
|
+
];
|
|
415
|
+
var rateOf = (b) => b.sessions ? b.orders / b.sessions * 100 : 0;
|
|
416
|
+
function figuresFor(range) {
|
|
417
|
+
let current;
|
|
418
|
+
let previous;
|
|
419
|
+
if (range === "today") {
|
|
420
|
+
const lastHour = Math.floor(NOW_MINUTES / 60);
|
|
421
|
+
current = hours(TODAY, 0, lastHour);
|
|
422
|
+
previous = hours(YESTERDAY, -1, lastHour);
|
|
423
|
+
} else {
|
|
424
|
+
const days = Number(range);
|
|
425
|
+
current = HISTORY.slice(-days);
|
|
426
|
+
previous = HISTORY.slice(-2 * days, -days);
|
|
427
|
+
}
|
|
428
|
+
const sum = (list, key) => list.reduce((s, b) => s + b[key], 0);
|
|
429
|
+
const key = (d) => range === "today" ? d : iso(d);
|
|
430
|
+
const series = (pick) => current.map((b, i) => ({
|
|
431
|
+
date: key(b.date),
|
|
432
|
+
value: round2(pick(b)),
|
|
433
|
+
compare: previous[i] ? round2(pick(previous[i])) : null
|
|
434
|
+
}));
|
|
435
|
+
const sales = round2(sum(current, "sales"));
|
|
436
|
+
const orders = sum(current, "orders");
|
|
437
|
+
const sessions = sum(current, "sessions");
|
|
438
|
+
const rate = rateOf({
|
|
439
|
+
orders,
|
|
440
|
+
sessions
|
|
441
|
+
});
|
|
442
|
+
const before = {
|
|
443
|
+
sales: sum(previous, "sales"),
|
|
444
|
+
orders: sum(previous, "orders"),
|
|
445
|
+
sessions: sum(previous, "sessions")
|
|
446
|
+
};
|
|
447
|
+
return [
|
|
448
|
+
{
|
|
449
|
+
key: "sales",
|
|
450
|
+
label: "Total sales",
|
|
451
|
+
amount: sales,
|
|
452
|
+
numberFormat: GBP,
|
|
453
|
+
change: changeOf(sales, before.sales),
|
|
454
|
+
series: series((b) => b.sales),
|
|
455
|
+
format: formatGbp,
|
|
456
|
+
formatTick: formatGbpTick
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
key: "orders",
|
|
460
|
+
label: "Orders",
|
|
461
|
+
amount: orders,
|
|
462
|
+
numberFormat: WHOLE,
|
|
463
|
+
change: changeOf(orders, before.orders),
|
|
464
|
+
series: series((b) => b.orders),
|
|
465
|
+
format: formatCount,
|
|
466
|
+
formatTick: formatCountTick
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
key: "sessions",
|
|
470
|
+
label: "Sessions",
|
|
471
|
+
amount: sessions,
|
|
472
|
+
numberFormat: WHOLE,
|
|
473
|
+
change: changeOf(sessions, before.sessions),
|
|
474
|
+
series: series((b) => b.sessions),
|
|
475
|
+
format: formatCount,
|
|
476
|
+
formatTick: formatCountTick
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
key: "conversion",
|
|
480
|
+
label: "Conversion rate",
|
|
481
|
+
amount: rate / 100,
|
|
482
|
+
numberFormat: RATE,
|
|
483
|
+
change: changeOf(rate, rateOf(before)),
|
|
484
|
+
series: series(rateOf),
|
|
485
|
+
format: formatRate$1,
|
|
486
|
+
formatTick: formatRateTick
|
|
487
|
+
}
|
|
488
|
+
];
|
|
489
|
+
}
|
|
490
|
+
var TOP_PRODUCTS = [
|
|
491
|
+
{
|
|
492
|
+
id: "arden",
|
|
493
|
+
name: "Arden ergonomic chair",
|
|
494
|
+
sales: 18240,
|
|
495
|
+
change: 20.7
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
id: "oslo",
|
|
499
|
+
name: "Oslo sit-stand desk, oak",
|
|
500
|
+
sales: 14980,
|
|
501
|
+
change: -4.2
|
|
502
|
+
},
|
|
503
|
+
{
|
|
504
|
+
id: "lumen",
|
|
505
|
+
name: "Lumen desk lamp",
|
|
506
|
+
sales: 6210,
|
|
507
|
+
change: 27.5
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
id: "harbour",
|
|
511
|
+
name: "Harbour three-seat sofa",
|
|
512
|
+
sales: 5890,
|
|
513
|
+
change: 15
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
id: "fern",
|
|
517
|
+
name: "Fern acoustic panel set",
|
|
518
|
+
sales: 3140,
|
|
519
|
+
change: -5.1
|
|
520
|
+
}
|
|
521
|
+
];
|
|
522
|
+
var strip = {
|
|
523
|
+
head: {
|
|
524
|
+
display: "flex",
|
|
525
|
+
flexWrap: "wrap",
|
|
526
|
+
alignItems: "center",
|
|
527
|
+
justifyContent: "space-between",
|
|
528
|
+
gap: 12,
|
|
529
|
+
marginBottom: 8
|
|
530
|
+
},
|
|
531
|
+
title: {
|
|
532
|
+
margin: 0,
|
|
533
|
+
fontFamily: "var(--o-font-display)",
|
|
534
|
+
fontSize: "var(--o-text-2xl)",
|
|
535
|
+
fontWeight: 600,
|
|
536
|
+
letterSpacing: "var(--o-tracking-display)",
|
|
537
|
+
color: "var(--o-fg-1)"
|
|
538
|
+
},
|
|
539
|
+
chart: { marginTop: 20 }
|
|
540
|
+
};
|
|
541
|
+
/**
|
|
542
|
+
* "Performance" on the home: a range control, the Z-read strip of four figures (each rolls when
|
|
543
|
+
* the range changes) and the range chart for the figure that is selected.
|
|
544
|
+
*/
|
|
545
|
+
function PerformanceStrip({ headingId, headingAs: Heading = "h3", chartHeight = 280, ranges = RANGE_OPTIONS }) {
|
|
546
|
+
const [range, setRange] = useState("30");
|
|
547
|
+
const [selected, setSelected] = useState("sales");
|
|
548
|
+
const figures = useMemo(() => figuresFor(range), [range]);
|
|
549
|
+
const current = figures.find((f) => f.key === selected) ?? figures[0];
|
|
550
|
+
const hourly = range === "today";
|
|
551
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
552
|
+
"aria-labelledby": headingId,
|
|
553
|
+
children: [
|
|
554
|
+
/* @__PURE__ */ jsxs("header", {
|
|
555
|
+
style: strip.head,
|
|
556
|
+
children: [/* @__PURE__ */ jsx(Heading, {
|
|
557
|
+
style: strip.title,
|
|
558
|
+
id: headingId,
|
|
559
|
+
children: "Performance"
|
|
560
|
+
}), /* @__PURE__ */ jsx(SegmentedControl, {
|
|
561
|
+
"aria-label": "Date range",
|
|
562
|
+
size: "sm",
|
|
563
|
+
value: range,
|
|
564
|
+
onValueChange: setRange,
|
|
565
|
+
options: ranges
|
|
566
|
+
})]
|
|
567
|
+
}),
|
|
568
|
+
/* @__PURE__ */ jsx(FigureTabs, {
|
|
569
|
+
variant: "compact",
|
|
570
|
+
"aria-label": "Headline figures",
|
|
571
|
+
value: current.key,
|
|
572
|
+
onValueChange: setSelected,
|
|
573
|
+
items: figures.map((f) => ({
|
|
574
|
+
key: f.key,
|
|
575
|
+
label: f.label,
|
|
576
|
+
value: /* @__PURE__ */ jsx(RollingNumber, {
|
|
577
|
+
value: f.amount,
|
|
578
|
+
format: f.numberFormat
|
|
579
|
+
}),
|
|
580
|
+
change: /* @__PURE__ */ jsx(Delta, {
|
|
581
|
+
value: f.change,
|
|
582
|
+
size: "sm"
|
|
583
|
+
})
|
|
584
|
+
}))
|
|
585
|
+
}),
|
|
586
|
+
/* @__PURE__ */ jsx("div", {
|
|
587
|
+
role: "tabpanel",
|
|
588
|
+
"aria-label": current.label,
|
|
589
|
+
style: strip.chart,
|
|
590
|
+
children: /* @__PURE__ */ jsx(AreaChart, {
|
|
591
|
+
height: chartHeight,
|
|
592
|
+
data: current.series,
|
|
593
|
+
valueLabel: current.label,
|
|
594
|
+
compareLabel: hourly ? "Yesterday" : "Previous period",
|
|
595
|
+
formatValue: current.format,
|
|
596
|
+
formatTick: current.formatTick,
|
|
597
|
+
formatDate: hourly ? formatHour : void 0,
|
|
598
|
+
formatTooltipDate: hourly ? (d) => `Today, ${formatHour(d)}` : void 0,
|
|
599
|
+
emptyMessage: "No sales in this period yet"
|
|
600
|
+
})
|
|
601
|
+
})
|
|
602
|
+
]
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
//#endregion
|
|
606
|
+
export { yesterdayUntil as _, RATE as a, changeOf as c, formatGbp as d, formatGbpTick as f, takingsSeries as g, takingsOf as h, RANGE_OPTIONS as i, dayAt as l, nextSale as m, NOW_MINUTES as n, TODAY as o, formatHour as p, PerformanceStrip as r, TOP_PRODUCTS as s, GBP as t, figuresFor as u };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/pages/foundations/_foundations.tsx
|
|
5
|
+
/** Copies text to the clipboard and remembers what was copied for a moment, for "Copied" feedback. */
|
|
6
|
+
function useCopied(timeout = 1600) {
|
|
7
|
+
const [copied, setCopied] = useState(null);
|
|
8
|
+
const timer = useRef(void 0);
|
|
9
|
+
useEffect(() => () => window.clearTimeout(timer.current), []);
|
|
10
|
+
return {
|
|
11
|
+
copied,
|
|
12
|
+
copy: useCallback((text) => {
|
|
13
|
+
navigator.clipboard?.writeText(text).catch(() => {});
|
|
14
|
+
setCopied(text);
|
|
15
|
+
window.clearTimeout(timer.current);
|
|
16
|
+
timer.current = window.setTimeout(() => setCopied(null), timeout);
|
|
17
|
+
}, [timeout])
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/** A polite live region that says what just happened, e.g. "Copied PackageIcon". Visually hidden. */
|
|
21
|
+
function LiveStatus({ message }) {
|
|
22
|
+
return /* @__PURE__ */ jsx("p", {
|
|
23
|
+
className: "o-sr-only",
|
|
24
|
+
role: "status",
|
|
25
|
+
"aria-live": "polite",
|
|
26
|
+
children: message ?? ""
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { useCopied as n, LiveStatus as t };
|