@orbitcommerce/constellation-docs 0.0.0-stage → 1.0.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.
Files changed (62) hide show
  1. package/LICENSE.md +6 -0
  2. package/README.md +6 -2
  3. package/dist/docs.css +8260 -0
  4. package/dist/index.d.ts +33 -0
  5. package/dist/index.js +308 -0
  6. package/dist/pages/Playground-CNbBbErC.js +129 -0
  7. package/dist/pages/_figures-data-BDmScEny.js +606 -0
  8. package/dist/pages/_foundations-blXWyYh8.js +30 -0
  9. package/dist/pages/_overlays-specimens-Dpn6oiyH.js +310 -0
  10. package/dist/pages/alert-BD4e6QTh.js +769 -0
  11. package/dist/pages/app-shell-KbA-nRqZ.js +1479 -0
  12. package/dist/pages/area-chart-B91dLcGo.js +562 -0
  13. package/dist/pages/avatar-DPPHXJAu.js +713 -0
  14. package/dist/pages/badge-C9JR0thI.js +729 -0
  15. package/dist/pages/button-D3V912P4.js +518 -0
  16. package/dist/pages/calendar-DSDZ9nRH.js +630 -0
  17. package/dist/pages/card-DUggbis3.js +659 -0
  18. package/dist/pages/checkbox-DwimQaK3.js +365 -0
  19. package/dist/pages/colour-BwuO8xAv.js +1498 -0
  20. package/dist/pages/command-palette-xAD7fOg6.js +1243 -0
  21. package/dist/pages/date-picker-BYSa816m.js +1421 -0
  22. package/dist/pages/delta-CtAo0eIM.js +574 -0
  23. package/dist/pages/dialog-BRAf4LMh.js +1451 -0
  24. package/dist/pages/docs-BNOb7AqR.js +515 -0
  25. package/dist/pages/empty-state-C-mLrXW2.js +417 -0
  26. package/dist/pages/figure-tabs-CoPFzzKz.js +460 -0
  27. package/dist/pages/home-dashboard-CFQwDtC9.js +959 -0
  28. package/dist/pages/host-B6znjEgQ.js +109 -0
  29. package/dist/pages/icon-button-C9eSVPPW.js +861 -0
  30. package/dist/pages/icons-sxkTs5Ob.js +473 -0
  31. package/dist/pages/input-KF9Gkawf.js +1093 -0
  32. package/dist/pages/installation-DpsX8G_n.js +445 -0
  33. package/dist/pages/kbd-cNfDoikz.js +544 -0
  34. package/dist/pages/live-globe-ClvLn9Lb.js +571 -0
  35. package/dist/pages/logo-BfGF1Pq9.js +571 -0
  36. package/dist/pages/menu-by2sgQ09.js +1618 -0
  37. package/dist/pages/motion-BvTGc2Dk.js +855 -0
  38. package/dist/pages/orbit-spinner-Dil1Z3Oy.js +332 -0
  39. package/dist/pages/overview-BPEbZQ6g.js +130 -0
  40. package/dist/pages/pagination-BBUnGvv5.js +249 -0
  41. package/dist/pages/popover-Db1gLDpb.js +1136 -0
  42. package/dist/pages/principles-CeAIOIdt.js +483 -0
  43. package/dist/pages/radio-group-CkdBWWfG.js +1077 -0
  44. package/dist/pages/registry-CroHzK9I.js +244 -0
  45. package/dist/pages/release-Dvo684UJ.js +13 -0
  46. package/dist/pages/rolling-number-qmvH84Mq.js +529 -0
  47. package/dist/pages/search-field-BN7MWGQ4.js +693 -0
  48. package/dist/pages/segmented-control-CTbIpRBW.js +777 -0
  49. package/dist/pages/select-DguELoRR.js +1429 -0
  50. package/dist/pages/separator-CPZub9pv.js +351 -0
  51. package/dist/pages/shape-DKvA0YKr.js +627 -0
  52. package/dist/pages/skeleton-DLuBhP46.js +561 -0
  53. package/dist/pages/sparkline-DMMYGbHn.js +668 -0
  54. package/dist/pages/switch-B-Qe4kcT.js +517 -0
  55. package/dist/pages/table-AMoODng4.js +607 -0
  56. package/dist/pages/tabs-B4M-usCV.js +1455 -0
  57. package/dist/pages/textarea-fTuUZRQb.js +693 -0
  58. package/dist/pages/toast-CKP03zjy.js +1176 -0
  59. package/dist/pages/tooltip-CBYil3kt.js +697 -0
  60. package/dist/pages/typography-PCbg8Bhg.js +735 -0
  61. package/manifest.json +3125 -0
  62. package/package.json +35 -4
@@ -0,0 +1,959 @@
1
+ "use client";
2
+ import { t as DocLink } from "./host-B6znjEgQ.js";
3
+ import { a as DocTable, d as Section, i as DocPage, l as Note, m as ThemePair, o as Example, p as SubSection, r as DoDont, s as Guidelines } from "./docs-BNOb7AqR.js";
4
+ import { a as TODAY, c as dayAt, g as yesterdayUntil, m as takingsOf, n as NOW_MINUTES, o as TOP_PRODUCTS, p as nextSale, r as PerformanceStrip, s as changeOf, t as GBP, u as formatGbp } from "./_figures-data-BDmScEny.js";
5
+ import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
6
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
+ import { Avatar, Badge, Button, Delta, EmptyState, LiveGlobe, RollingNumber, SegmentedControl, Skeleton, useOptionalShell } from "@orbitcommerce/constellation";
8
+ import { ArrowRightIcon, PackageIcon, PlusIcon, RocketLaunchIcon, TruckIcon } from "@orbitcommerce/constellation/icons";
9
+ //#region src/pages/patterns/home-dashboard.tsx
10
+ var PINNED_NOW = dayAt(0, NOW_MINUTES);
11
+ var LONG_DATE = new Intl.DateTimeFormat("en-GB", {
12
+ weekday: "long",
13
+ day: "numeric",
14
+ month: "long"
15
+ }).format(PINNED_NOW);
16
+ var pad = (n) => String(n).padStart(2, "0");
17
+ var clock = (d) => `${pad(d.getHours())}:${pad(d.getMinutes())}`;
18
+ /** Where the invented shop's visitors are browsing from: mostly the UK, one in Dublin. */
19
+ var VISITORS = [
20
+ {
21
+ lat: 51.5074,
22
+ lng: -.1278,
23
+ live: true,
24
+ label: "London",
25
+ count: 3,
26
+ countryCode: "GB"
27
+ },
28
+ {
29
+ lat: 53.4808,
30
+ lng: -2.2426,
31
+ live: true,
32
+ label: "Manchester",
33
+ count: 1,
34
+ countryCode: "GB"
35
+ },
36
+ {
37
+ lat: 53.8008,
38
+ lng: -1.5491,
39
+ live: true,
40
+ label: "Leeds",
41
+ count: 1,
42
+ countryCode: "GB"
43
+ },
44
+ {
45
+ lat: 51.4545,
46
+ lng: -2.5879,
47
+ live: true,
48
+ label: "Bristol",
49
+ count: 1,
50
+ countryCode: "GB"
51
+ },
52
+ {
53
+ lat: 53.3498,
54
+ lng: -6.2603,
55
+ live: true,
56
+ label: "Dublin",
57
+ count: 1,
58
+ countryCode: "IE"
59
+ }
60
+ ];
61
+ /** Where simulated visitors arrive from, in turn. */
62
+ var ARRIVALS = [
63
+ {
64
+ lat: 55.8642,
65
+ lng: -4.2518,
66
+ live: true,
67
+ label: "Glasgow",
68
+ count: 1,
69
+ countryCode: "GB"
70
+ },
71
+ {
72
+ lat: 52.4862,
73
+ lng: -1.8904,
74
+ live: true,
75
+ label: "Birmingham",
76
+ count: 1,
77
+ countryCode: "GB"
78
+ },
79
+ {
80
+ lat: 50.3755,
81
+ lng: -4.1427,
82
+ live: true,
83
+ label: "Plymouth",
84
+ count: 1,
85
+ countryCode: "GB"
86
+ },
87
+ {
88
+ lat: 54.5973,
89
+ lng: -5.9301,
90
+ live: true,
91
+ label: "Belfast",
92
+ count: 1,
93
+ countryCode: "GB"
94
+ }
95
+ ];
96
+ var liveCount = (markers) => markers.reduce((n, m) => n + (m.count ?? 1), 0);
97
+ /** Sales today, read like a till: the rolling takings, the orders and the change on one line. */
98
+ function Till({ takings, orders, change, labelId }) {
99
+ return /* @__PURE__ */ jsxs("div", {
100
+ className: "home-dashboard-till",
101
+ children: [
102
+ /* @__PURE__ */ jsx("p", {
103
+ className: "home-dashboard-till__label",
104
+ id: labelId,
105
+ children: "Sales today"
106
+ }),
107
+ /* @__PURE__ */ jsx(RollingNumber, {
108
+ className: "home-dashboard-till__figure",
109
+ value: takings,
110
+ format: GBP
111
+ }),
112
+ /* @__PURE__ */ jsxs("p", {
113
+ className: "home-dashboard-till__meta",
114
+ children: [
115
+ /* @__PURE__ */ jsxs("span", { children: [
116
+ orders,
117
+ " ",
118
+ orders === 1 ? "order" : "orders"
119
+ ] }),
120
+ /* @__PURE__ */ jsx(Delta, {
121
+ value: change,
122
+ size: "sm"
123
+ }),
124
+ /* @__PURE__ */ jsx("span", {
125
+ className: "home-dashboard-till__hint",
126
+ children: "vs this time yesterday"
127
+ })
128
+ ]
129
+ })
130
+ ]
131
+ });
132
+ }
133
+ function jobsFor(toFulfil) {
134
+ return [
135
+ {
136
+ key: "fulfil",
137
+ icon: /* @__PURE__ */ jsx(TruckIcon, { weight: "duotone" }),
138
+ title: `${toFulfil} orders to fulfil`,
139
+ detail: "The oldest has waited 1 day",
140
+ action: "Fulfil orders",
141
+ strained: true
142
+ },
143
+ {
144
+ key: "stock",
145
+ icon: /* @__PURE__ */ jsx(PackageIcon, { weight: "duotone" }),
146
+ title: "2 products running low",
147
+ detail: "Arden ergonomic chair has 3 left",
148
+ action: "Review stock"
149
+ },
150
+ {
151
+ key: "setup",
152
+ icon: /* @__PURE__ */ jsx(RocketLaunchIcon, { weight: "duotone" }),
153
+ title: "Finish setting up your store",
154
+ detail: "6 of 7 done. Next: Connect a domain",
155
+ action: "Continue",
156
+ progress: 6 / 7
157
+ }
158
+ ];
159
+ }
160
+ /** The jobs as an ordered list. The first carries the page's one primary button. */
161
+ function JobRows({ jobs, allPrimary = false }) {
162
+ return /* @__PURE__ */ jsx("ol", {
163
+ className: "home-dashboard-jobs",
164
+ children: jobs.map((job, index) => {
165
+ const primary = allPrimary || index === 0;
166
+ return /* @__PURE__ */ jsxs("li", {
167
+ className: "home-dashboard-job",
168
+ "data-first": index === 0 ? "" : void 0,
169
+ "data-strained": job.strained ? "" : void 0,
170
+ children: [
171
+ /* @__PURE__ */ jsx("span", {
172
+ className: "home-dashboard-job__icon",
173
+ "data-progress": job.progress !== void 0 ? "" : void 0,
174
+ style: job.progress !== void 0 ? { "--home-dashboard-progress": job.progress } : void 0,
175
+ "aria-hidden": "true",
176
+ children: job.icon
177
+ }),
178
+ /* @__PURE__ */ jsxs("div", {
179
+ className: "home-dashboard-job__text",
180
+ children: [/* @__PURE__ */ jsx("span", {
181
+ className: "home-dashboard-job__title",
182
+ children: job.title
183
+ }), /* @__PURE__ */ jsx("span", {
184
+ className: "home-dashboard-job__detail",
185
+ children: job.detail
186
+ })]
187
+ }),
188
+ /* @__PURE__ */ jsx(Button, {
189
+ size: "sm",
190
+ variant: primary ? "primary" : "secondary",
191
+ iconEnd: primary ? /* @__PURE__ */ jsx(ArrowRightIcon, {}) : void 0,
192
+ children: job.action
193
+ })
194
+ ]
195
+ }, job.key);
196
+ })
197
+ });
198
+ }
199
+ function NextUp({ jobs, state = "jobs", headingId }) {
200
+ return /* @__PURE__ */ jsxs("section", {
201
+ className: "home-dashboard-next",
202
+ "aria-labelledby": headingId,
203
+ children: [/* @__PURE__ */ jsx("h3", {
204
+ className: "home-dashboard-next__title",
205
+ id: headingId,
206
+ children: "Next up"
207
+ }), state === "loading" ? /* @__PURE__ */ jsx("div", {
208
+ className: "home-dashboard-jobs",
209
+ "aria-busy": "true",
210
+ children: [
211
+ 0,
212
+ 1,
213
+ 2
214
+ ].map((i) => /* @__PURE__ */ jsxs("div", {
215
+ className: "home-dashboard-job home-dashboard-job--skeleton",
216
+ children: [/* @__PURE__ */ jsx(Skeleton, {
217
+ width: 40,
218
+ height: 40,
219
+ radius: "md"
220
+ }), /* @__PURE__ */ jsxs("div", {
221
+ className: "home-dashboard-job__text",
222
+ children: [/* @__PURE__ */ jsx(Skeleton, {
223
+ width: "60%",
224
+ height: 14,
225
+ radius: "pill"
226
+ }), /* @__PURE__ */ jsx(Skeleton, {
227
+ width: "40%",
228
+ height: 12,
229
+ radius: "pill"
230
+ })]
231
+ })]
232
+ }, i))
233
+ }) : state === "clear" ? /* @__PURE__ */ jsx(EmptyState, {
234
+ size: "sm",
235
+ titleAs: "h4",
236
+ title: "You're all caught up",
237
+ description: "Nothing needs you right now. New orders and stock alerts will show up here."
238
+ }) : /* @__PURE__ */ jsx(JobRows, { jobs })]
239
+ });
240
+ }
241
+ var TONE = {
242
+ unfulfilled: "warning",
243
+ pending: "warning",
244
+ fulfilled: "positive",
245
+ shipped: "positive",
246
+ refunded: "negative"
247
+ };
248
+ var STATUS = {
249
+ unfulfilled: "Unfulfilled",
250
+ pending: "Pending",
251
+ fulfilled: "Fulfilled",
252
+ shipped: "Shipped",
253
+ refunded: "Refunded"
254
+ };
255
+ var fulfilmentOf = (s) => s.status === "refunded" ? "refunded" : s.status === "pending" ? "pending" : s.number % 3 ? "unfulfilled" : "shipped";
256
+ function SalesTape({ rows, fresh, headingId }) {
257
+ return /* @__PURE__ */ jsxs("section", {
258
+ className: "home-dashboard-panel",
259
+ "aria-labelledby": headingId,
260
+ children: [/* @__PURE__ */ jsxs("header", {
261
+ className: "home-dashboard-panel__head",
262
+ children: [/* @__PURE__ */ jsx("h3", {
263
+ className: "home-dashboard__h2",
264
+ id: headingId,
265
+ children: "Latest orders"
266
+ }), /* @__PURE__ */ jsxs("span", {
267
+ className: "home-dashboard-panel__link",
268
+ children: ["View all orders", /* @__PURE__ */ jsx(ArrowRightIcon, {})]
269
+ })]
270
+ }), /* @__PURE__ */ jsx("ul", {
271
+ className: "home-dashboard-tape",
272
+ children: rows.map((row) => {
273
+ const f = fulfilmentOf(row);
274
+ return /* @__PURE__ */ jsx("li", {
275
+ className: "home-dashboard-tape__row",
276
+ "data-fresh": fresh.has(row.id) ? "" : void 0,
277
+ children: /* @__PURE__ */ jsxs("div", {
278
+ className: "home-dashboard-tape__link",
279
+ children: [
280
+ /* @__PURE__ */ jsx("time", {
281
+ className: "home-dashboard-tape__time",
282
+ dateTime: row.at.toISOString(),
283
+ children: clock(row.at)
284
+ }),
285
+ /* @__PURE__ */ jsx("span", {
286
+ className: "home-dashboard-tape__dot",
287
+ "data-tone": TONE[f],
288
+ "aria-hidden": "true"
289
+ }),
290
+ /* @__PURE__ */ jsx(Avatar, {
291
+ size: "sm",
292
+ name: row.customer
293
+ }),
294
+ /* @__PURE__ */ jsxs("span", {
295
+ className: "home-dashboard-tape__who",
296
+ children: [/* @__PURE__ */ jsx("span", {
297
+ className: "home-dashboard-tape__name",
298
+ children: row.customer
299
+ }), /* @__PURE__ */ jsxs("span", {
300
+ className: "home-dashboard-tape__meta",
301
+ children: [
302
+ "#",
303
+ row.number,
304
+ " · ",
305
+ row.items,
306
+ " ",
307
+ row.items === 1 ? "item" : "items"
308
+ ]
309
+ })]
310
+ }),
311
+ /* @__PURE__ */ jsx(Badge, {
312
+ size: "sm",
313
+ tone: TONE[f],
314
+ children: STATUS[f]
315
+ }),
316
+ /* @__PURE__ */ jsx("span", {
317
+ className: "home-dashboard-tape__amount",
318
+ "data-refunded": f === "refunded" ? "" : void 0,
319
+ children: formatGbp(row.amount)
320
+ })
321
+ ]
322
+ })
323
+ }, row.id);
324
+ })
325
+ })]
326
+ });
327
+ }
328
+ function TopProducts({ headingId }) {
329
+ const leader = Math.max(1, ...TOP_PRODUCTS.map((p) => p.sales));
330
+ return /* @__PURE__ */ jsxs("section", {
331
+ className: "home-dashboard-panel",
332
+ "aria-labelledby": headingId,
333
+ children: [/* @__PURE__ */ jsxs("header", {
334
+ className: "home-dashboard-panel__head",
335
+ children: [/* @__PURE__ */ jsx("h3", {
336
+ className: "home-dashboard__h2",
337
+ id: headingId,
338
+ children: "Top products"
339
+ }), /* @__PURE__ */ jsxs("span", {
340
+ className: "home-dashboard-panel__link",
341
+ children: ["Analytics", /* @__PURE__ */ jsx(ArrowRightIcon, {})]
342
+ })]
343
+ }), /* @__PURE__ */ jsx("ol", {
344
+ className: "home-dashboard-top",
345
+ children: TOP_PRODUCTS.map((p, index) => /* @__PURE__ */ jsxs("li", {
346
+ className: "home-dashboard-top__row",
347
+ style: {
348
+ "--home-dashboard-share": p.sales / leader,
349
+ "--home-dashboard-i": index
350
+ },
351
+ children: [/* @__PURE__ */ jsx(Avatar, {
352
+ shape: "square",
353
+ size: "lg",
354
+ name: p.name
355
+ }), /* @__PURE__ */ jsxs("span", {
356
+ className: "home-dashboard-top__body",
357
+ children: [/* @__PURE__ */ jsxs("span", {
358
+ className: "home-dashboard-top__line",
359
+ children: [/* @__PURE__ */ jsx("span", {
360
+ className: "home-dashboard-top__name",
361
+ children: p.name
362
+ }), /* @__PURE__ */ jsxs("span", {
363
+ className: "home-dashboard-top__figures",
364
+ children: [/* @__PURE__ */ jsx("span", {
365
+ className: "home-dashboard-top__amount",
366
+ children: formatGbp(p.sales)
367
+ }), /* @__PURE__ */ jsx(Delta, {
368
+ value: p.change,
369
+ size: "sm"
370
+ })]
371
+ })]
372
+ }), /* @__PURE__ */ jsx("span", {
373
+ className: "home-dashboard-top__bar",
374
+ "aria-hidden": "true",
375
+ children: /* @__PURE__ */ jsx("span", { className: "home-dashboard-top__fill" })
376
+ })]
377
+ })]
378
+ }, p.id))
379
+ })]
380
+ });
381
+ }
382
+ function HomeMiniature() {
383
+ const globeSize = useOptionalShell()?.mode === "mobile" ? 260 : 400;
384
+ const [visitors, setVisitors] = useState(VISITORS);
385
+ const [focus, setFocus] = useState(null);
386
+ const [sales, setSales] = useState(TODAY);
387
+ const [minutes, setMinutes] = useState(NOW_MINUTES);
388
+ const [shown, setShown] = useState(() => ({
389
+ takings: takingsOf(TODAY),
390
+ orders: TODAY.length
391
+ }));
392
+ const [added, setAdded] = useState(0);
393
+ const [fresh, setFresh] = useState(() => /* @__PURE__ */ new Set());
394
+ const timer = useRef(void 0);
395
+ useEffect(() => () => window.clearTimeout(timer.current), []);
396
+ const change = changeOf(shown.takings, yesterdayUntil(minutes));
397
+ const tape = useMemo(() => [...sales].reverse().slice(0, 6), [sales]);
398
+ const simulate = () => {
399
+ const next = Math.min(minutes + 3, 1439);
400
+ const sale = nextSale(added, next - 1);
401
+ const list = [...sales, sale];
402
+ setSales(list);
403
+ setMinutes(next);
404
+ setAdded((n) => n + 1);
405
+ setFresh(/* @__PURE__ */ new Set([sale.id]));
406
+ const arrival = ARRIVALS[added % ARRIVALS.length];
407
+ setVisitors((list) => [...list.filter((m) => m.label !== arrival.label), {
408
+ ...arrival,
409
+ arrivedAt: performance.now()
410
+ }]);
411
+ setFocus({
412
+ lat: arrival.lat,
413
+ lng: arrival.lng,
414
+ key: `arrival-${added}`
415
+ });
416
+ window.clearTimeout(timer.current);
417
+ timer.current = window.setTimeout(() => setShown({
418
+ takings: takingsOf(list),
419
+ orders: list.length
420
+ }), 420);
421
+ };
422
+ return /* @__PURE__ */ jsxs("div", {
423
+ className: "home-dashboard-demo",
424
+ children: [/* @__PURE__ */ jsxs("div", {
425
+ className: "home-dashboard-demo__bar",
426
+ children: [/* @__PURE__ */ jsx(Button, {
427
+ icon: /* @__PURE__ */ jsx(PlusIcon, {}),
428
+ onClick: simulate,
429
+ children: "Simulate a sale"
430
+ }), /* @__PURE__ */ jsx("span", {
431
+ className: "home-dashboard-demo__hint",
432
+ children: "A visitor lands on the globe, the takings roll and the order prints on the tape."
433
+ })]
434
+ }), /* @__PURE__ */ jsx(FitWidth, { children: /* @__PURE__ */ jsx("div", {
435
+ className: "home-dashboard-mini",
436
+ children: /* @__PURE__ */ jsxs("div", {
437
+ className: "home-dashboard",
438
+ children: [
439
+ /* @__PURE__ */ jsxs("header", {
440
+ className: "home-dashboard__greeting",
441
+ children: [/* @__PURE__ */ jsx("p", {
442
+ className: "home-dashboard__h1",
443
+ children: "Good evening, Priya"
444
+ }), /* @__PURE__ */ jsxs("p", {
445
+ className: "home-dashboard__sub",
446
+ children: [
447
+ /* @__PURE__ */ jsx("span", { children: LONG_DATE }),
448
+ /* @__PURE__ */ jsxs("span", {
449
+ className: "home-dashboard__live",
450
+ children: [
451
+ /* @__PURE__ */ jsx("span", {
452
+ className: "home-dashboard__live-dot",
453
+ "aria-hidden": "true"
454
+ }),
455
+ liveCount(visitors),
456
+ " people browsing now"
457
+ ]
458
+ }),
459
+ /* @__PURE__ */ jsx(Badge, {
460
+ tone: "warning",
461
+ variant: "outline",
462
+ size: "sm",
463
+ children: "Sample data"
464
+ })
465
+ ]
466
+ })]
467
+ }),
468
+ /* @__PURE__ */ jsxs("section", {
469
+ className: "home-dashboard__hero",
470
+ "aria-labelledby": "home-dashboard-today",
471
+ children: [/* @__PURE__ */ jsx("div", {
472
+ className: "home-dashboard__globe",
473
+ children: /* @__PURE__ */ jsx(LiveGlobe, {
474
+ size: globeSize,
475
+ markers: visitors,
476
+ focus,
477
+ zoomable: true,
478
+ zoomOutHint: "Click anywhere to zoom out",
479
+ title: "Live visitors"
480
+ })
481
+ }), /* @__PURE__ */ jsxs("div", {
482
+ className: "home-dashboard__today",
483
+ children: [/* @__PURE__ */ jsx(Till, {
484
+ takings: shown.takings,
485
+ orders: shown.orders,
486
+ change,
487
+ labelId: "home-dashboard-today"
488
+ }), /* @__PURE__ */ jsx(NextUp, {
489
+ jobs: jobsFor(5 + added),
490
+ headingId: "home-dashboard-next"
491
+ })]
492
+ })]
493
+ }),
494
+ /* @__PURE__ */ jsx(PerformanceStrip, { headingId: "home-dashboard-performance" }),
495
+ /* @__PURE__ */ jsxs("div", {
496
+ className: "home-dashboard__split",
497
+ children: [/* @__PURE__ */ jsx(SalesTape, {
498
+ rows: tape,
499
+ fresh,
500
+ headingId: "home-dashboard-tape"
501
+ }), /* @__PURE__ */ jsx(TopProducts, { headingId: "home-dashboard-top" })]
502
+ }),
503
+ /* @__PURE__ */ jsxs("div", {
504
+ className: "home-dashboard__news",
505
+ children: [
506
+ /* @__PURE__ */ jsx("span", {
507
+ className: "home-dashboard__news-label",
508
+ children: "What's new"
509
+ }),
510
+ /* @__PURE__ */ jsx(Badge, {
511
+ size: "sm",
512
+ tone: "accent",
513
+ children: "New"
514
+ }),
515
+ /* @__PURE__ */ jsx("span", {
516
+ className: "home-dashboard__news-title",
517
+ children: "Edit prices for many products at once from the product list"
518
+ }),
519
+ /* @__PURE__ */ jsx("span", {
520
+ className: "home-dashboard__news-date",
521
+ children: "Thursday 24 September"
522
+ }),
523
+ /* @__PURE__ */ jsx(ArrowRightIcon, {})
524
+ ]
525
+ })
526
+ ]
527
+ })
528
+ }) })]
529
+ });
530
+ }
531
+ /** The width the miniature lays out at: the home as it looks in a laptop window. */
532
+ var HOME_WIDTH = 920;
533
+ /**
534
+ * Lays the home out at a laptop width and scales it to fit the example (CSS zoom), so the page
535
+ * shows the desktop composition. Narrow examples (phones) show the phone layout at full size.
536
+ */
537
+ function FitWidth({ children }) {
538
+ const ref = useRef(null);
539
+ const [zoom, setZoom] = useState(1);
540
+ useLayoutEffect(() => {
541
+ const el = ref.current;
542
+ if (!el) return;
543
+ const update = () => {
544
+ const w = el.clientWidth;
545
+ setZoom(w >= 600 && w < HOME_WIDTH ? Math.round(w / HOME_WIDTH * 1e3) / 1e3 : 1);
546
+ };
547
+ update();
548
+ const observer = new ResizeObserver(update);
549
+ observer.observe(el);
550
+ return () => observer.disconnect();
551
+ }, []);
552
+ return /* @__PURE__ */ jsx("div", {
553
+ ref,
554
+ className: "home-dashboard-fit",
555
+ children: /* @__PURE__ */ jsx("div", {
556
+ style: zoom < 1 ? {
557
+ width: HOME_WIDTH,
558
+ zoom
559
+ } : void 0,
560
+ children
561
+ })
562
+ });
563
+ }
564
+ function StatesDemo() {
565
+ const [state, setState] = useState("loading");
566
+ return /* @__PURE__ */ jsxs("div", {
567
+ className: "home-dashboard-states",
568
+ children: [/* @__PURE__ */ jsx(SegmentedControl, {
569
+ "aria-label": "Next up state",
570
+ size: "sm",
571
+ value: state,
572
+ onValueChange: setState,
573
+ options: [
574
+ {
575
+ value: "jobs",
576
+ label: "Jobs"
577
+ },
578
+ {
579
+ value: "loading",
580
+ label: "Loading"
581
+ },
582
+ {
583
+ value: "clear",
584
+ label: "All caught up"
585
+ }
586
+ ]
587
+ }), /* @__PURE__ */ jsx("div", {
588
+ className: "home-dashboard-states__panel",
589
+ children: /* @__PURE__ */ jsx(NextUp, {
590
+ jobs: jobsFor(5),
591
+ state,
592
+ headingId: "home-dashboard-states-next"
593
+ })
594
+ })]
595
+ });
596
+ }
597
+ function Preview() {
598
+ return /* @__PURE__ */ jsxs("div", {
599
+ className: "home-dashboard-preview",
600
+ children: [/* @__PURE__ */ jsx(LiveGlobe, {
601
+ size: 120,
602
+ markers: VISITORS,
603
+ still: true
604
+ }), /* @__PURE__ */ jsxs("div", {
605
+ className: "home-dashboard-preview__side",
606
+ children: [
607
+ /* @__PURE__ */ jsx("span", {
608
+ className: "home-dashboard-preview__hello",
609
+ children: "Good evening"
610
+ }),
611
+ /* @__PURE__ */ jsx("span", {
612
+ className: "home-dashboard-preview__figure",
613
+ children: "£2,950.40"
614
+ }),
615
+ /* @__PURE__ */ jsxs("span", {
616
+ className: "home-dashboard-preview__job",
617
+ "data-first": "",
618
+ children: [/* @__PURE__ */ jsx("span", {
619
+ className: "home-dashboard-preview__tile",
620
+ children: /* @__PURE__ */ jsx(TruckIcon, { weight: "duotone" })
621
+ }), "5 to fulfil"]
622
+ }),
623
+ /* @__PURE__ */ jsxs("span", {
624
+ className: "home-dashboard-preview__job",
625
+ children: [/* @__PURE__ */ jsx("span", {
626
+ className: "home-dashboard-preview__tile",
627
+ children: /* @__PURE__ */ jsx(PackageIcon, { weight: "duotone" })
628
+ }), "2 running low"]
629
+ })
630
+ ]
631
+ })]
632
+ });
633
+ }
634
+ function Page() {
635
+ return /* @__PURE__ */ jsxs(DocPage, {
636
+ title: "Home dashboard",
637
+ status: "new",
638
+ lead: "The home page of Orbit Commerce's store dashboard: the live globe and today's takings at the top, the next job beside them, then how the shop is doing over time. A pattern built entirely from the kit's components; this page shows how they fit together and the rules that hold them.",
639
+ children: [
640
+ /* @__PURE__ */ jsx(Section, {
641
+ id: "thesis",
642
+ title: "Your business, at the centre",
643
+ description: /* @__PURE__ */ jsxs(Fragment$1, { children: [
644
+ /* @__PURE__ */ jsx("p", { children: "The home answers one question the moment it opens: how is the shop doing right now? So the first screen is the shop live: a globe with a pin wherever someone is browsing, and beside it today's takings with the next job under them. Everything else follows by urgency: how the shop is doing over time, then the latest orders and best sellers. The frame keeps the same order: Orbit's logo top left takes you home, and the merchant's store sits at the foot of the sidebar, one click from every other store." }),
645
+ /* @__PURE__ */ jsx("p", { children: "It reads like a till. Money and counts are set in Sora with tabular numerals and roll into place digit by digit, the way a till display turns over. The performance figures sit on one hairline like the totals on a Z-read, the report a till prints at the close of the day: label, figure and change on one line each, with no boxes around them." }),
646
+ /* @__PURE__ */ jsx("p", { children: "Teal is drawn, never poured. On the home it is only ever a line or a small mark: the visitor pins on the globe, the line under the selected figure, the chart's line, the share bars, the live dot, the done dots on the tape, and the one primary button. Everything you read stays ink. That keeps teal meaning live or chosen, leaves amber and red free to mean waiting and refunded, and stops the page becoming a wall of colour in which nothing stands out." })
647
+ ] })
648
+ }),
649
+ /* @__PURE__ */ jsxs(Section, {
650
+ id: "live",
651
+ title: "The page, live",
652
+ description: /* @__PURE__ */ jsx("p", { children: "A working miniature of the home with an invented shop's evening, built from the kit's components. Drag the globe, click a pin to zoom in, change the range, pick a figure, and simulate a sale." }),
653
+ children: [/* @__PURE__ */ jsx(Example, {
654
+ clientOnly: true,
655
+ align: "fill",
656
+ children: /* @__PURE__ */ jsx(HomeMiniature, {})
657
+ }), /* @__PURE__ */ jsx(Note, {
658
+ title: "Sample data",
659
+ children: "Everything here is invented, and the page says so with a Sample data badge, just as the store dashboard does when it runs on sample data for design review."
660
+ })]
661
+ }),
662
+ /* @__PURE__ */ jsx(Section, {
663
+ id: "composition",
664
+ title: "Composition",
665
+ description: /* @__PURE__ */ jsx("p", { children: "Top to bottom, each region and what it is made of." }),
666
+ children: /* @__PURE__ */ jsx(DocTable, {
667
+ columns: [
668
+ "Region",
669
+ "Built from",
670
+ "What it shows"
671
+ ],
672
+ rows: [
673
+ [
674
+ "Greeting",
675
+ "Display type, Badge",
676
+ "Good morning, afternoon or evening by the hour, with the first name; the date; a live link that pulses teal while people are browsing and rests grey when the shop is quiet."
677
+ ],
678
+ [
679
+ "Live globe",
680
+ /* @__PURE__ */ jsx(DocLink, {
681
+ to: "/components/live-globe",
682
+ children: "Live globe"
683
+ }),
684
+ "Everyone browsing the shop right now, as pins on a dotted world: up to 520px on desktop, leading the page on phones."
685
+ ],
686
+ [
687
+ "Sales today",
688
+ /* @__PURE__ */ jsxs(Fragment$1, { children: [
689
+ /* @__PURE__ */ jsx(DocLink, {
690
+ to: "/components/rolling-number",
691
+ children: "Rolling number"
692
+ }),
693
+ ", ",
694
+ /* @__PURE__ */ jsx(DocLink, {
695
+ to: "/components/delta",
696
+ children: "Delta"
697
+ })
698
+ ] }),
699
+ "The takings in Sora, then the order count, its change and \"vs this time yesterday\" on one line, like a till."
700
+ ],
701
+ [
702
+ "Next up",
703
+ "Button, Skeleton, Empty state, duotone icons",
704
+ "Up to three jobs under the takings, most urgent first. The first carries the page's one primary button. The Nebula prompt sits under them."
705
+ ],
706
+ [
707
+ "Performance",
708
+ /* @__PURE__ */ jsxs(Fragment$1, { children: [
709
+ /* @__PURE__ */ jsx(DocLink, {
710
+ to: "/components/segmented-control",
711
+ children: "Segmented control"
712
+ }),
713
+ ",",
714
+ " ",
715
+ /* @__PURE__ */ jsx(DocLink, {
716
+ to: "/components/figure-tabs",
717
+ children: "Figure tabs"
718
+ }),
719
+ ", Rolling number, Delta,",
720
+ " ",
721
+ /* @__PURE__ */ jsx(DocLink, {
722
+ to: "/components/area-chart",
723
+ children: "Area chart"
724
+ })
725
+ ] }),
726
+ "The range (Today, 7 days, 30 days, 90 days, 12 months), four figures on the Z-read strip, and a 280px chart of the selected one."
727
+ ],
728
+ [
729
+ "Latest orders",
730
+ "Avatar, Badge",
731
+ "The newest orders printed down a hairline rail, each row a link to its order."
732
+ ],
733
+ [
734
+ "Top products",
735
+ "Avatar, Delta",
736
+ "The five best sellers for the range, each with a bar for its share of the leader."
737
+ ],
738
+ [
739
+ "What's new",
740
+ "Badge",
741
+ "One quiet line under a hairline: the latest product update."
742
+ ],
743
+ [
744
+ "Plugin widgets",
745
+ "Host blocks",
746
+ "Plugins can add their own blocks at the foot of the home."
747
+ ]
748
+ ]
749
+ })
750
+ }),
751
+ /* @__PURE__ */ jsxs(Section, {
752
+ id: "today",
753
+ title: "Today",
754
+ description: /* @__PURE__ */ jsx("p", { children: "The first screen is the live globe beside today's takings and the next job. Nothing above them but the greeting." }),
755
+ children: [
756
+ /* @__PURE__ */ jsx(SubSection, {
757
+ title: "The live globe",
758
+ description: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("p", { children: "The globe shows who is browsing right now and nothing else: live sessions only, never invented, grouped so ten people in London are one pin reading \"London · 10\". A chip names the place nearest the front. When someone new arrives, their pin flashes and the globe swings round to face them; when everyone is in one place, it parks there and stops spinning." }), /* @__PURE__ */ jsx("p", { children: "Drag to turn it, click a pin to zoom in on that country, click anywhere else to zoom out. It pauses when scrolled off screen, and with reduced motion it holds still but still turns on drag. The greeting's \"people browsing now\" count reads the same live feed, so the two always agree." })] })
759
+ }),
760
+ /* @__PURE__ */ jsx(SubSection, {
761
+ title: "Sales today",
762
+ description: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("p", { children: "The takings count paid sales only: pending money has not arrived and refunds have gone back. The order count is every order that was not cancelled. The change compares with yesterday up to the same clock time, so it is as fair at nine in the morning as at nine at night, and it only appears when there is something to compare with." }), /* @__PURE__ */ jsx("p", { children: "Before the first sale it reads \"No orders yet today\". The day's sales refresh every 30 seconds, so the takings roll without a reload, and the takings, the tape and the day's boundaries all use the store's time zone (UK time when none is set)." })] })
763
+ }),
764
+ /* @__PURE__ */ jsxs(SubSection, {
765
+ title: "Next up",
766
+ description: /* @__PURE__ */ jsx("p", { children: "Jobs come in a fixed order of urgency, and each hides when there is nothing to do. The first job's tile is tinted teal and its button is the page's one primary. A strained job turns its tile amber while its words stay ink." }),
767
+ children: [/* @__PURE__ */ jsx(DocTable, {
768
+ columns: [
769
+ "Job",
770
+ "Shown when",
771
+ "Strained when"
772
+ ],
773
+ rows: [
774
+ [
775
+ "Orders to fulfil",
776
+ "Paid orders are waiting to be sent",
777
+ "The oldest has waited a day or more"
778
+ ],
779
+ [
780
+ "Products running low",
781
+ "Any product is low on stock",
782
+ "The first one is out of stock"
783
+ ],
784
+ [
785
+ "Finish setting up your store",
786
+ "Setup is not finished or dismissed; a ring round the icon shows progress",
787
+ "Never: it is a nudge, not a problem"
788
+ ]
789
+ ]
790
+ }), /* @__PURE__ */ jsx(ThemePair, {
791
+ clientOnly: true,
792
+ align: "fill",
793
+ children: /* @__PURE__ */ jsx(NextUp, {
794
+ jobs: jobsFor(5),
795
+ headingId: "home-dashboard-pair-next"
796
+ })
797
+ })]
798
+ })
799
+ ]
800
+ }),
801
+ /* @__PURE__ */ jsx(Section, {
802
+ id: "performance",
803
+ title: "The Z-read strip",
804
+ description: /* @__PURE__ */ jsxs("p", { children: [
805
+ "Four figures (total sales, orders, sessions and conversion rate) on one hairline, each a",
806
+ " ",
807
+ /* @__PURE__ */ jsx(DocLink, {
808
+ to: "/components/figure-tabs",
809
+ children: "figure tab"
810
+ }),
811
+ ". Changing the range rolls every figure to its new value; picking a figure glides the teal line to it and the chart follows. Today is drawn by the hour (\"14:00\") and longer ranges by the day (\"3 Aug\"). The chart sits in a tab panel named after the selected figure."
812
+ ] })
813
+ }),
814
+ /* @__PURE__ */ jsxs(Section, {
815
+ id: "lists",
816
+ title: "The tape and top products",
817
+ description: /* @__PURE__ */ jsx("p", { children: "Below the chart the page splits 1.35 to 1: the latest orders on the left, the best sellers on the right. Both sit straight on the canvas under a heading and a hairline." }),
818
+ children: [/* @__PURE__ */ jsx(DocTable, {
819
+ columns: ["On the tape", "Means"],
820
+ rows: [
821
+ [/* @__PURE__ */ jsxs("span", {
822
+ className: "home-dashboard-key",
823
+ children: [/* @__PURE__ */ jsx("span", {
824
+ className: "home-dashboard-tape__dot",
825
+ "data-tone": "warning"
826
+ }), "Amber ring"]
827
+ }), "Waiting: unfulfilled, or payment pending."],
828
+ [/* @__PURE__ */ jsxs("span", {
829
+ className: "home-dashboard-key",
830
+ children: [/* @__PURE__ */ jsx("span", {
831
+ className: "home-dashboard-tape__dot",
832
+ "data-tone": "positive"
833
+ }), "Teal dot"]
834
+ }), "Done: fulfilled or shipped."],
835
+ [/* @__PURE__ */ jsxs("span", {
836
+ className: "home-dashboard-key",
837
+ children: [/* @__PURE__ */ jsx("span", {
838
+ className: "home-dashboard-tape__dot",
839
+ "data-tone": "negative"
840
+ }), "Red ring"]
841
+ }), "Refunded. The amount is struck through in quiet ink."]
842
+ ]
843
+ }), /* @__PURE__ */ jsx(Guidelines, { items: [
844
+ "Newest on top, the time in quiet tabular figures at the left of the rail, and the status in words on a badge as well as in the dot.",
845
+ "A new order prints in at the top: it slides down from under the heading as if fed from a till roll, and its dot transmits twice.",
846
+ "Top products shows the five best sellers for the chosen range. Each bar is the product's share of the leader, not of all sales, and the bars grow in one after another."
847
+ ] })]
848
+ }),
849
+ /* @__PURE__ */ jsxs(Section, {
850
+ id: "layout",
851
+ title: "Layout",
852
+ children: [/* @__PURE__ */ jsx(DocTable, {
853
+ columns: ["Rule", "Value"],
854
+ rows: [
855
+ ["Width", "Up to 1180px, centred on the canvas, with sections 44px apart (32px on phones)."],
856
+ ["Today", "The globe column is up to 520px (the world itself is about 400px across), then 48px, then the takings and Next up."],
857
+ ["Lists", "Latest orders and top products split 1.35 to 1, 56px apart."],
858
+ ["Below 1100px", "Today and the lists each stack into one column: the globe leads, centred, then the takings and Next up."],
859
+ ["Below 640px", "The greeting drops to 24px, the figures go two to a row, job buttons move under their text, the tape drops avatars and badges, and product names wrap."]
860
+ ]
861
+ }), /* @__PURE__ */ jsx(Note, {
862
+ title: "In this miniature",
863
+ children: "The miniature above lays the home out at 920px, about the width it has in a laptop window, and scales it down to fit this page. On a phone it shows the phone layout at full size. The real home responds to the window width; the miniature responds to the width of its example instead."
864
+ })]
865
+ }),
866
+ /* @__PURE__ */ jsxs(Section, {
867
+ id: "states",
868
+ title: "Loading and empty",
869
+ description: /* @__PURE__ */ jsx("p", { children: "Every region has a loading shape and an empty line of its own, so a new shop's home reads as ready rather than broken." }),
870
+ children: [/* @__PURE__ */ jsx(Example, {
871
+ clientOnly: true,
872
+ align: "fill",
873
+ children: /* @__PURE__ */ jsx(StatesDemo, {})
874
+ }), /* @__PURE__ */ jsx(DocTable, {
875
+ columns: [
876
+ "Region",
877
+ "Loading",
878
+ "Empty"
879
+ ],
880
+ rows: [
881
+ [
882
+ "Live globe",
883
+ "The world turns with no pins",
884
+ "\"No visitors yet today\" in the greeting; the globe keeps turning"
885
+ ],
886
+ [
887
+ "Sales today",
888
+ "£0.00 until the day's orders arrive",
889
+ "\"No orders yet today\""
890
+ ],
891
+ [
892
+ "Next up",
893
+ "Three skeleton rows",
894
+ "\"You're all caught up\" and one line of what will appear"
895
+ ],
896
+ [
897
+ "Performance",
898
+ "Shimmering figures and the chart silhouette",
899
+ "\"No sales in this period yet\""
900
+ ],
901
+ [
902
+ "Latest orders",
903
+ "Five skeleton rows on the rail",
904
+ "\"No orders yet\" and \"When customers buy, their orders land here.\""
905
+ ],
906
+ [
907
+ "Top products",
908
+ "Four skeleton rows",
909
+ "\"No sales in this period\" and \"Your best sellers will show here once orders come in.\""
910
+ ]
911
+ ]
912
+ })]
913
+ }),
914
+ /* @__PURE__ */ jsxs(Section, {
915
+ id: "guidelines",
916
+ title: "Guidelines",
917
+ children: [/* @__PURE__ */ jsx(DoDont, {
918
+ clientOnly: true,
919
+ do: {
920
+ children: /* @__PURE__ */ jsx("div", {
921
+ className: "home-dashboard-dodont",
922
+ children: /* @__PURE__ */ jsx(JobRows, { jobs: jobsFor(5).slice(0, 2) })
923
+ }),
924
+ caption: "One primary: the first job, which is the move the merchant most likely came to make."
925
+ },
926
+ dont: {
927
+ children: /* @__PURE__ */ jsx("div", {
928
+ className: "home-dashboard-dodont",
929
+ children: /* @__PURE__ */ jsx(JobRows, {
930
+ jobs: jobsFor(5).slice(0, 2),
931
+ allPrimary: true
932
+ })
933
+ }),
934
+ caption: "Every job primary means none of them is. The eye has nowhere to start."
935
+ }
936
+ }), /* @__PURE__ */ jsx(Guidelines, { items: [
937
+ "No cards on the home. Sections sit on the canvas under a heading and a hairline; the globe, the takings and the jobs own the first screen.",
938
+ "Keep the first screen to today. History (the range, the chart, the lists) comes below it.",
939
+ "Read the takings and the tape from one list of orders, and the globe and the browsing count from one live feed, so they always agree.",
940
+ "Keep words ink. Colour goes on marks: the dot on the rail, the tile of a strained job, the pill of a delta.",
941
+ "Label sample data. Invented figures always carry the Sample data badge."
942
+ ] })]
943
+ }),
944
+ /* @__PURE__ */ jsx(Section, {
945
+ id: "accessibility",
946
+ title: "Accessibility",
947
+ children: /* @__PURE__ */ jsx(Guidelines, { items: [
948
+ "Each region is a section named by its heading, so the page can be read region by region.",
949
+ "The globe is a picture of live activity, so its numbers are always written too: the browsing count in the greeting. Its tooltip names it, and its pins can be reached by pointer only, so nothing is found on the globe alone.",
950
+ "The figures are a tab list, and the chart is a tab panel named after the selected figure.",
951
+ "Each tape row is a single link to its order, and every status is written as well as coloured.",
952
+ "With reduced motion the globe holds still (it still turns on drag), and there is no rolling and no printing: figures swap with a fade."
953
+ ] })
954
+ })
955
+ ]
956
+ });
957
+ }
958
+ //#endregion
959
+ export { Page, Preview };