@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.
- package/LICENSE.md +6 -0
- package/README.md +6 -2
- package/dist/docs.css +8260 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +308 -0
- package/dist/pages/Playground-CNbBbErC.js +129 -0
- package/dist/pages/_figures-data-BDmScEny.js +606 -0
- package/dist/pages/_foundations-blXWyYh8.js +30 -0
- package/dist/pages/_overlays-specimens-Dpn6oiyH.js +310 -0
- package/dist/pages/alert-BD4e6QTh.js +769 -0
- package/dist/pages/app-shell-KbA-nRqZ.js +1479 -0
- package/dist/pages/area-chart-B91dLcGo.js +562 -0
- package/dist/pages/avatar-DPPHXJAu.js +713 -0
- package/dist/pages/badge-C9JR0thI.js +729 -0
- package/dist/pages/button-D3V912P4.js +518 -0
- package/dist/pages/calendar-DSDZ9nRH.js +630 -0
- package/dist/pages/card-DUggbis3.js +659 -0
- package/dist/pages/checkbox-DwimQaK3.js +365 -0
- package/dist/pages/colour-BwuO8xAv.js +1498 -0
- package/dist/pages/command-palette-xAD7fOg6.js +1243 -0
- package/dist/pages/date-picker-BYSa816m.js +1421 -0
- package/dist/pages/delta-CtAo0eIM.js +574 -0
- package/dist/pages/dialog-BRAf4LMh.js +1451 -0
- package/dist/pages/docs-BNOb7AqR.js +515 -0
- package/dist/pages/empty-state-C-mLrXW2.js +417 -0
- package/dist/pages/figure-tabs-CoPFzzKz.js +460 -0
- package/dist/pages/home-dashboard-CFQwDtC9.js +959 -0
- package/dist/pages/host-B6znjEgQ.js +109 -0
- package/dist/pages/icon-button-C9eSVPPW.js +861 -0
- package/dist/pages/icons-sxkTs5Ob.js +473 -0
- package/dist/pages/input-KF9Gkawf.js +1093 -0
- package/dist/pages/installation-DpsX8G_n.js +445 -0
- package/dist/pages/kbd-cNfDoikz.js +544 -0
- package/dist/pages/live-globe-ClvLn9Lb.js +571 -0
- package/dist/pages/logo-BfGF1Pq9.js +571 -0
- package/dist/pages/menu-by2sgQ09.js +1618 -0
- package/dist/pages/motion-BvTGc2Dk.js +855 -0
- package/dist/pages/orbit-spinner-Dil1Z3Oy.js +332 -0
- package/dist/pages/overview-BPEbZQ6g.js +130 -0
- package/dist/pages/pagination-BBUnGvv5.js +249 -0
- package/dist/pages/popover-Db1gLDpb.js +1136 -0
- package/dist/pages/principles-CeAIOIdt.js +483 -0
- package/dist/pages/radio-group-CkdBWWfG.js +1077 -0
- package/dist/pages/registry-CroHzK9I.js +244 -0
- package/dist/pages/release-Dvo684UJ.js +13 -0
- package/dist/pages/rolling-number-qmvH84Mq.js +529 -0
- package/dist/pages/search-field-BN7MWGQ4.js +693 -0
- package/dist/pages/segmented-control-CTbIpRBW.js +777 -0
- package/dist/pages/select-DguELoRR.js +1429 -0
- package/dist/pages/separator-CPZub9pv.js +351 -0
- package/dist/pages/shape-DKvA0YKr.js +627 -0
- package/dist/pages/skeleton-DLuBhP46.js +561 -0
- package/dist/pages/sparkline-DMMYGbHn.js +668 -0
- package/dist/pages/switch-B-Qe4kcT.js +517 -0
- package/dist/pages/table-AMoODng4.js +607 -0
- package/dist/pages/tabs-B4M-usCV.js +1455 -0
- package/dist/pages/textarea-fTuUZRQb.js +693 -0
- package/dist/pages/toast-CKP03zjy.js +1176 -0
- package/dist/pages/tooltip-CBYil3kt.js +697 -0
- package/dist/pages/typography-PCbg8Bhg.js +735 -0
- package/manifest.json +3125 -0
- package/package.json +35 -4
|
@@ -0,0 +1,1479 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { r as ForAudience, t as DocLink } from "./host-B6znjEgQ.js";
|
|
3
|
+
import { a as DocTable, d as Section, i as DocPage, l as Note, m as ThemePair, n as CodeBlock, o as Example, p as SubSection, r as DoDont, s as Guidelines, u as PropsTable } from "./docs-BNOb7AqR.js";
|
|
4
|
+
import { a as TODAY, u as formatGbp } from "./_figures-data-BDmScEny.js";
|
|
5
|
+
import { useState } from "react";
|
|
6
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { AppShell, Avatar, Badge, Breadcrumbs, Button, Canvas, CommandEmpty, CommandGroup, CommandItem, CommandPalette, IconButton, Kbd, Menu, MenuContent, MenuItem, MenuLabel, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuTrigger, OrbitLogo, SearchTrigger, ShellBrand, Sidebar, SidebarFooter, SidebarHeader, SidebarItem, SidebarNav, SidebarSection, SidebarToggle, StoreButton, Tooltip, TopBar, useShell } from "@orbitcommerce/constellation";
|
|
8
|
+
import { BellIcon, ChartLineUpIcon, CreditCardIcon, GearSixIcon, HouseIcon, ImageSquareIcon, MegaphoneIcon, PackageIcon, PlusIcon, PuzzlePieceIcon, ReceiptIcon, SparkleIcon, StorefrontIcon, TagIcon, UsersThreeIcon } from "@orbitcommerce/constellation/icons";
|
|
9
|
+
//#region src/pages/patterns/app-shell.tsx
|
|
10
|
+
var NAV = [
|
|
11
|
+
{
|
|
12
|
+
id: "start",
|
|
13
|
+
items: [{
|
|
14
|
+
id: "home",
|
|
15
|
+
label: "Home",
|
|
16
|
+
icon: HouseIcon,
|
|
17
|
+
page: true
|
|
18
|
+
}]
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: "commerce",
|
|
22
|
+
title: "Commerce",
|
|
23
|
+
items: [
|
|
24
|
+
{
|
|
25
|
+
id: "orders",
|
|
26
|
+
label: "Orders",
|
|
27
|
+
icon: ReceiptIcon,
|
|
28
|
+
page: true,
|
|
29
|
+
children: [
|
|
30
|
+
{
|
|
31
|
+
id: "drafts",
|
|
32
|
+
label: "Drafts"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: "abandoned",
|
|
36
|
+
label: "Abandoned checkouts"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: "returns",
|
|
40
|
+
label: "Returns"
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: "catalogue",
|
|
46
|
+
label: "Catalogue",
|
|
47
|
+
icon: PackageIcon,
|
|
48
|
+
children: [
|
|
49
|
+
{
|
|
50
|
+
id: "products",
|
|
51
|
+
label: "Products"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
id: "categories",
|
|
55
|
+
label: "Categories"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: "inventory",
|
|
59
|
+
label: "Inventory"
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: "customers",
|
|
65
|
+
label: "Customers",
|
|
66
|
+
icon: UsersThreeIcon,
|
|
67
|
+
page: true
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
id: "discounts",
|
|
71
|
+
label: "Discounts",
|
|
72
|
+
icon: TagIcon,
|
|
73
|
+
page: true
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
id: "payments",
|
|
77
|
+
label: "Payments",
|
|
78
|
+
icon: CreditCardIcon,
|
|
79
|
+
page: true
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: "content",
|
|
85
|
+
title: "Content",
|
|
86
|
+
items: [{
|
|
87
|
+
id: "media",
|
|
88
|
+
label: "Media library",
|
|
89
|
+
icon: ImageSquareIcon,
|
|
90
|
+
page: true
|
|
91
|
+
}, {
|
|
92
|
+
id: "storefront",
|
|
93
|
+
label: "Storefront",
|
|
94
|
+
icon: StorefrontIcon,
|
|
95
|
+
page: true
|
|
96
|
+
}]
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: "insights",
|
|
100
|
+
title: "Insights",
|
|
101
|
+
items: [{
|
|
102
|
+
id: "analytics",
|
|
103
|
+
label: "Analytics",
|
|
104
|
+
icon: ChartLineUpIcon,
|
|
105
|
+
page: true
|
|
106
|
+
}, {
|
|
107
|
+
id: "marketing",
|
|
108
|
+
label: "Marketing",
|
|
109
|
+
icon: MegaphoneIcon,
|
|
110
|
+
page: true
|
|
111
|
+
}]
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
id: "configuration",
|
|
115
|
+
title: "Configuration",
|
|
116
|
+
items: [{
|
|
117
|
+
id: "plugins",
|
|
118
|
+
label: "Plugins",
|
|
119
|
+
icon: PuzzlePieceIcon,
|
|
120
|
+
page: true
|
|
121
|
+
}, {
|
|
122
|
+
id: "settings",
|
|
123
|
+
label: "Settings",
|
|
124
|
+
icon: GearSixIcon,
|
|
125
|
+
page: true
|
|
126
|
+
}]
|
|
127
|
+
}
|
|
128
|
+
];
|
|
129
|
+
var STORES = [
|
|
130
|
+
{
|
|
131
|
+
name: "Harbour Desk Co",
|
|
132
|
+
detail: "harbourdesk.co.uk"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
name: "Fernside Lighting",
|
|
136
|
+
detail: "fernsidelighting.co.uk"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
name: "Quayside Gifts",
|
|
140
|
+
detail: "quaysidegifts.co.uk"
|
|
141
|
+
}
|
|
142
|
+
];
|
|
143
|
+
var icons = (I) => ({
|
|
144
|
+
icon: /* @__PURE__ */ jsx(I, {}),
|
|
145
|
+
activeIcon: /* @__PURE__ */ jsx(I, { weight: "duotone" })
|
|
146
|
+
});
|
|
147
|
+
function findPage(id) {
|
|
148
|
+
for (const group of NAV) for (const item of group.items) {
|
|
149
|
+
if (item.id === id) return { label: item.label };
|
|
150
|
+
const child = item.children?.find((c) => c.id === id);
|
|
151
|
+
if (child) return {
|
|
152
|
+
label: child.label,
|
|
153
|
+
parent: item
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
return { label: "Home" };
|
|
157
|
+
}
|
|
158
|
+
function Preview() {
|
|
159
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
160
|
+
className: "app-shell-preview",
|
|
161
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
162
|
+
className: "app-shell-preview__rail",
|
|
163
|
+
children: [
|
|
164
|
+
/* @__PURE__ */ jsx(OrbitLogo, {
|
|
165
|
+
variant: "mark",
|
|
166
|
+
size: 14,
|
|
167
|
+
className: "app-shell-preview__logo",
|
|
168
|
+
"aria-hidden": "true",
|
|
169
|
+
title: ""
|
|
170
|
+
}),
|
|
171
|
+
/* @__PURE__ */ jsx("span", {
|
|
172
|
+
className: "app-shell-preview__item",
|
|
173
|
+
"data-active": "",
|
|
174
|
+
children: /* @__PURE__ */ jsx(HouseIcon, { weight: "duotone" })
|
|
175
|
+
}),
|
|
176
|
+
/* @__PURE__ */ jsx("span", {
|
|
177
|
+
className: "app-shell-preview__item",
|
|
178
|
+
"data-badge": "",
|
|
179
|
+
children: /* @__PURE__ */ jsx(ReceiptIcon, {})
|
|
180
|
+
}),
|
|
181
|
+
/* @__PURE__ */ jsx("span", {
|
|
182
|
+
className: "app-shell-preview__item",
|
|
183
|
+
children: /* @__PURE__ */ jsx(PackageIcon, {})
|
|
184
|
+
}),
|
|
185
|
+
/* @__PURE__ */ jsx("span", {
|
|
186
|
+
className: "app-shell-preview__item",
|
|
187
|
+
children: /* @__PURE__ */ jsx(UsersThreeIcon, {})
|
|
188
|
+
}),
|
|
189
|
+
/* @__PURE__ */ jsx("span", {
|
|
190
|
+
className: "app-shell-preview__item",
|
|
191
|
+
children: /* @__PURE__ */ jsx(ChartLineUpIcon, {})
|
|
192
|
+
}),
|
|
193
|
+
/* @__PURE__ */ jsx(Avatar, {
|
|
194
|
+
shape: "square",
|
|
195
|
+
size: "xs",
|
|
196
|
+
name: "Harbour Desk Co",
|
|
197
|
+
className: "app-shell-preview__store"
|
|
198
|
+
})
|
|
199
|
+
]
|
|
200
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
201
|
+
className: "app-shell-preview__main",
|
|
202
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
203
|
+
className: "app-shell-preview__bar",
|
|
204
|
+
children: [
|
|
205
|
+
/* @__PURE__ */ jsx("span", { className: "app-shell-preview__crumb" }),
|
|
206
|
+
/* @__PURE__ */ jsx("span", { className: "app-shell-preview__search" }),
|
|
207
|
+
/* @__PURE__ */ jsx(Avatar, {
|
|
208
|
+
size: "xs",
|
|
209
|
+
name: "Priya Shah"
|
|
210
|
+
})
|
|
211
|
+
]
|
|
212
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
213
|
+
className: "app-shell-preview__canvas",
|
|
214
|
+
children: [
|
|
215
|
+
/* @__PURE__ */ jsx("span", {
|
|
216
|
+
className: "app-shell-preview__title",
|
|
217
|
+
children: "Good evening, Priya"
|
|
218
|
+
}),
|
|
219
|
+
/* @__PURE__ */ jsx("span", { className: "app-shell-preview__line" }),
|
|
220
|
+
/* @__PURE__ */ jsx("span", {
|
|
221
|
+
className: "app-shell-preview__line",
|
|
222
|
+
"data-short": ""
|
|
223
|
+
})
|
|
224
|
+
]
|
|
225
|
+
})]
|
|
226
|
+
})]
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
function StoreSwitcher({ store, onStore }) {
|
|
230
|
+
return /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, {
|
|
231
|
+
asChild: true,
|
|
232
|
+
children: /* @__PURE__ */ jsx(StoreButton, {
|
|
233
|
+
name: store.name,
|
|
234
|
+
detail: store.detail,
|
|
235
|
+
avatar: /* @__PURE__ */ jsx(Avatar, {
|
|
236
|
+
shape: "square",
|
|
237
|
+
size: "sm",
|
|
238
|
+
name: store.name
|
|
239
|
+
})
|
|
240
|
+
})
|
|
241
|
+
}), /* @__PURE__ */ jsxs(MenuContent, {
|
|
242
|
+
width: 264,
|
|
243
|
+
side: "top",
|
|
244
|
+
align: "start",
|
|
245
|
+
children: [
|
|
246
|
+
/* @__PURE__ */ jsx(MenuLabel, { children: "Switch store" }),
|
|
247
|
+
/* @__PURE__ */ jsx(MenuRadioGroup, {
|
|
248
|
+
value: store.name,
|
|
249
|
+
onValueChange: onStore,
|
|
250
|
+
children: STORES.map((s) => /* @__PURE__ */ jsx(MenuRadioItem, {
|
|
251
|
+
value: s.name,
|
|
252
|
+
children: s.name
|
|
253
|
+
}, s.name))
|
|
254
|
+
}),
|
|
255
|
+
/* @__PURE__ */ jsx(MenuSeparator, {}),
|
|
256
|
+
/* @__PURE__ */ jsx(MenuItem, {
|
|
257
|
+
icon: /* @__PURE__ */ jsx(PlusIcon, {}),
|
|
258
|
+
children: "Add a store"
|
|
259
|
+
})
|
|
260
|
+
]
|
|
261
|
+
})] });
|
|
262
|
+
}
|
|
263
|
+
function DemoSidebar({ active, navigate, open, setOpen, orders, store, setStore }) {
|
|
264
|
+
const shell = useShell();
|
|
265
|
+
const go = (id) => (event) => {
|
|
266
|
+
event.preventDefault();
|
|
267
|
+
navigate(id);
|
|
268
|
+
if (shell.mode === "mobile") shell.setDrawerOpen(false);
|
|
269
|
+
};
|
|
270
|
+
return /* @__PURE__ */ jsxs(Sidebar, {
|
|
271
|
+
label: store.name,
|
|
272
|
+
children: [
|
|
273
|
+
/* @__PURE__ */ jsxs(SidebarHeader, { children: [/* @__PURE__ */ jsx(ShellBrand, {
|
|
274
|
+
placement: "header",
|
|
275
|
+
name: "Store Dashboard"
|
|
276
|
+
}), /* @__PURE__ */ jsx(SidebarToggle, {})] }),
|
|
277
|
+
/* @__PURE__ */ jsx(SidebarNav, { children: NAV.map((group) => /* @__PURE__ */ jsx(SidebarSection, {
|
|
278
|
+
title: group.title,
|
|
279
|
+
children: group.items.map((item) => {
|
|
280
|
+
const childActive = item.children?.some((c) => c.id === active) ?? false;
|
|
281
|
+
return /* @__PURE__ */ jsx(SidebarItem, {
|
|
282
|
+
itemId: `frame-${item.id}`,
|
|
283
|
+
label: item.label,
|
|
284
|
+
...icons(item.icon),
|
|
285
|
+
active: active === item.id,
|
|
286
|
+
current: childActive,
|
|
287
|
+
badge: item.id === "orders" ? orders : void 0,
|
|
288
|
+
badgeLabel: item.id === "orders" ? `${orders} orders to fulfil` : void 0,
|
|
289
|
+
link: item.page ? /* @__PURE__ */ jsx("a", { href: `#${item.id}` }) : void 0,
|
|
290
|
+
onSelect: item.page ? go(item.id) : void 0,
|
|
291
|
+
open: item.children ? open[item.id] ?? (active === item.id || childActive) : void 0,
|
|
292
|
+
onOpenChange: (next) => setOpen(item.id, next),
|
|
293
|
+
toggleLabel: `Show ${item.label.toLowerCase()} pages`,
|
|
294
|
+
children: item.children?.map((child) => /* @__PURE__ */ jsx(SidebarItem, {
|
|
295
|
+
itemId: `frame-${child.id}`,
|
|
296
|
+
label: child.label,
|
|
297
|
+
active: active === child.id,
|
|
298
|
+
link: /* @__PURE__ */ jsx("a", { href: `#${child.id}` }),
|
|
299
|
+
onSelect: go(child.id)
|
|
300
|
+
}, child.id))
|
|
301
|
+
}, item.id);
|
|
302
|
+
})
|
|
303
|
+
}, group.id)) }),
|
|
304
|
+
/* @__PURE__ */ jsx(SidebarFooter, { children: /* @__PURE__ */ jsx(StoreSwitcher, {
|
|
305
|
+
store,
|
|
306
|
+
onStore: setStore
|
|
307
|
+
}) })
|
|
308
|
+
]
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
function DemoTopBar({ crumbs, onSearch }) {
|
|
312
|
+
return /* @__PURE__ */ jsx(TopBar, {
|
|
313
|
+
start: /* @__PURE__ */ jsx(Breadcrumbs, { items: crumbs }),
|
|
314
|
+
center: /* @__PURE__ */ jsx(SearchTrigger, {
|
|
315
|
+
hotkey: false,
|
|
316
|
+
width: 200,
|
|
317
|
+
onOpen: onSearch
|
|
318
|
+
}),
|
|
319
|
+
end: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
320
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
321
|
+
content: "Ask Nebula",
|
|
322
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
323
|
+
label: "Ask Nebula",
|
|
324
|
+
children: /* @__PURE__ */ jsx(SparkleIcon, {})
|
|
325
|
+
})
|
|
326
|
+
}),
|
|
327
|
+
/* @__PURE__ */ jsx(Tooltip, {
|
|
328
|
+
content: "Notifications",
|
|
329
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
330
|
+
label: "Notifications",
|
|
331
|
+
children: /* @__PURE__ */ jsx(BellIcon, {})
|
|
332
|
+
})
|
|
333
|
+
}),
|
|
334
|
+
/* @__PURE__ */ jsx(Avatar, { name: "Priya Shah" })
|
|
335
|
+
] })
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
var FULFILMENT = [
|
|
339
|
+
"Unfulfilled",
|
|
340
|
+
"Fulfilled",
|
|
341
|
+
"Unfulfilled",
|
|
342
|
+
"Shipped"
|
|
343
|
+
];
|
|
344
|
+
function DemoPage({ title, orders, onOrder }) {
|
|
345
|
+
const shell = useShell();
|
|
346
|
+
const phone = shell.mode === "mobile";
|
|
347
|
+
const rows = [...TODAY].reverse().slice(0, 9);
|
|
348
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
349
|
+
className: "app-shell-page",
|
|
350
|
+
children: [
|
|
351
|
+
/* @__PURE__ */ jsx("h3", {
|
|
352
|
+
className: "app-shell-page__title",
|
|
353
|
+
children: title
|
|
354
|
+
}),
|
|
355
|
+
/* @__PURE__ */ jsx("p", {
|
|
356
|
+
className: "app-shell-page__lead",
|
|
357
|
+
children: "This is the canvas, the one raised surface. It scrolls on its own while the sidebar and header stay put."
|
|
358
|
+
}),
|
|
359
|
+
/* @__PURE__ */ jsxs("div", {
|
|
360
|
+
className: "app-shell-page__state",
|
|
361
|
+
children: [/* @__PURE__ */ jsxs("dl", {
|
|
362
|
+
className: "app-shell-page__facts",
|
|
363
|
+
children: [
|
|
364
|
+
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", { children: "Mode" }), /* @__PURE__ */ jsx("dd", { children: shell.mode })] }),
|
|
365
|
+
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", { children: "Sidebar" }), /* @__PURE__ */ jsx("dd", { children: phone ? shell.drawerOpen ? "drawer open" : "drawer closed" : shell.collapsed ? "icon rail" : "expanded" })] }),
|
|
366
|
+
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("dt", { children: "Orders to fulfil" }), /* @__PURE__ */ jsx("dd", { children: orders })] })
|
|
367
|
+
]
|
|
368
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
369
|
+
className: "app-shell-page__actions",
|
|
370
|
+
children: [phone ? /* @__PURE__ */ jsx(Button, {
|
|
371
|
+
size: "sm",
|
|
372
|
+
onClick: () => shell.setDrawerOpen(true),
|
|
373
|
+
children: "Open the drawer"
|
|
374
|
+
}) : /* @__PURE__ */ jsx(Button, {
|
|
375
|
+
size: "sm",
|
|
376
|
+
onClick: shell.toggleCollapsed,
|
|
377
|
+
children: shell.collapsed ? "Expand the sidebar" : "Fold the sidebar"
|
|
378
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
379
|
+
size: "sm",
|
|
380
|
+
icon: /* @__PURE__ */ jsx(PlusIcon, {}),
|
|
381
|
+
onClick: onOrder,
|
|
382
|
+
children: "Receive an order"
|
|
383
|
+
})]
|
|
384
|
+
})]
|
|
385
|
+
}),
|
|
386
|
+
/* @__PURE__ */ jsx("ul", {
|
|
387
|
+
className: "app-shell-page__rows",
|
|
388
|
+
children: rows.map((sale, i) => /* @__PURE__ */ jsxs("li", {
|
|
389
|
+
className: "app-shell-page__row",
|
|
390
|
+
children: [
|
|
391
|
+
/* @__PURE__ */ jsx(Avatar, {
|
|
392
|
+
size: "sm",
|
|
393
|
+
name: sale.customer
|
|
394
|
+
}),
|
|
395
|
+
/* @__PURE__ */ jsxs("span", {
|
|
396
|
+
className: "app-shell-page__who",
|
|
397
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
398
|
+
className: "app-shell-page__name",
|
|
399
|
+
children: sale.customer
|
|
400
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
401
|
+
className: "app-shell-page__meta",
|
|
402
|
+
children: [
|
|
403
|
+
"#",
|
|
404
|
+
sale.number,
|
|
405
|
+
" · ",
|
|
406
|
+
sale.items,
|
|
407
|
+
" ",
|
|
408
|
+
sale.items === 1 ? "item" : "items"
|
|
409
|
+
]
|
|
410
|
+
})]
|
|
411
|
+
}),
|
|
412
|
+
/* @__PURE__ */ jsx(Badge, {
|
|
413
|
+
size: "sm",
|
|
414
|
+
tone: sale.status === "refunded" ? "negative" : FULFILMENT[i % 4] === "Unfulfilled" ? "warning" : "positive",
|
|
415
|
+
children: sale.status === "refunded" ? "Refunded" : FULFILMENT[i % 4]
|
|
416
|
+
}),
|
|
417
|
+
/* @__PURE__ */ jsx("span", {
|
|
418
|
+
className: "app-shell-page__amount",
|
|
419
|
+
children: formatGbp(sale.amount)
|
|
420
|
+
})
|
|
421
|
+
]
|
|
422
|
+
}, sale.id))
|
|
423
|
+
})
|
|
424
|
+
]
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
function HarbourShell() {
|
|
428
|
+
const [active, setActive] = useState("orders");
|
|
429
|
+
const [open, setOpenState] = useState({});
|
|
430
|
+
const [orders, setOrders] = useState(12);
|
|
431
|
+
const [storeName, setStoreName] = useState(STORES[0].name);
|
|
432
|
+
const [searching, setSearching] = useState(false);
|
|
433
|
+
const store = STORES.find((s) => s.name === storeName) ?? STORES[0];
|
|
434
|
+
const page = findPage(active);
|
|
435
|
+
const crumbs = page.parent ? [{
|
|
436
|
+
key: page.parent.id,
|
|
437
|
+
label: page.parent.label,
|
|
438
|
+
link: page.parent.page ? /* @__PURE__ */ jsx("a", {
|
|
439
|
+
href: `#${page.parent.id}`,
|
|
440
|
+
onClick: (e) => {
|
|
441
|
+
e.preventDefault();
|
|
442
|
+
setActive(page.parent.id);
|
|
443
|
+
}
|
|
444
|
+
}) : void 0
|
|
445
|
+
}, {
|
|
446
|
+
key: active,
|
|
447
|
+
label: page.label
|
|
448
|
+
}] : [{
|
|
449
|
+
key: active,
|
|
450
|
+
label: page.label
|
|
451
|
+
}];
|
|
452
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
453
|
+
className: "app-shell-frame",
|
|
454
|
+
children: [/* @__PURE__ */ jsx(AppShell, {
|
|
455
|
+
sidebar: /* @__PURE__ */ jsx(DemoSidebar, {
|
|
456
|
+
active,
|
|
457
|
+
navigate: setActive,
|
|
458
|
+
open,
|
|
459
|
+
setOpen: (id, next) => setOpenState((o) => ({
|
|
460
|
+
...o,
|
|
461
|
+
[id]: next
|
|
462
|
+
})),
|
|
463
|
+
orders,
|
|
464
|
+
store,
|
|
465
|
+
setStore: setStoreName
|
|
466
|
+
}),
|
|
467
|
+
header: /* @__PURE__ */ jsx(DemoTopBar, {
|
|
468
|
+
crumbs,
|
|
469
|
+
onSearch: () => setSearching(true)
|
|
470
|
+
}),
|
|
471
|
+
children: /* @__PURE__ */ jsx(Canvas, { children: /* @__PURE__ */ jsx(DemoPage, {
|
|
472
|
+
title: page.label,
|
|
473
|
+
orders,
|
|
474
|
+
onOrder: () => setOrders((n) => n + 1)
|
|
475
|
+
}) })
|
|
476
|
+
}), /* @__PURE__ */ jsxs(CommandPalette, {
|
|
477
|
+
open: searching,
|
|
478
|
+
onOpenChange: setSearching,
|
|
479
|
+
label: `Search ${store.name}`,
|
|
480
|
+
children: [/* @__PURE__ */ jsx(CommandEmpty, {
|
|
481
|
+
description: "Try a page name, like orders or discounts.",
|
|
482
|
+
children: "No pages match that"
|
|
483
|
+
}), /* @__PURE__ */ jsx(CommandGroup, {
|
|
484
|
+
heading: "Go to",
|
|
485
|
+
children: NAV.flatMap((g) => g.items).flatMap((item) => [...item.page ? [{
|
|
486
|
+
id: item.id,
|
|
487
|
+
label: item.label,
|
|
488
|
+
icon: item.icon
|
|
489
|
+
}] : [], ...(item.children ?? []).map((c) => ({
|
|
490
|
+
...c,
|
|
491
|
+
icon: item.icon
|
|
492
|
+
}))]).map((entry) => {
|
|
493
|
+
const EntryIcon = entry.icon;
|
|
494
|
+
return /* @__PURE__ */ jsx(CommandItem, {
|
|
495
|
+
value: entry.id,
|
|
496
|
+
keywords: [entry.label],
|
|
497
|
+
icon: /* @__PURE__ */ jsx(EntryIcon, {}),
|
|
498
|
+
onSelect: () => {
|
|
499
|
+
setSearching(false);
|
|
500
|
+
setActive(entry.id);
|
|
501
|
+
},
|
|
502
|
+
children: entry.label
|
|
503
|
+
}, entry.id);
|
|
504
|
+
})
|
|
505
|
+
})]
|
|
506
|
+
})]
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
function SpecimenSidebar({ collapsed, orders = 12, children }) {
|
|
510
|
+
const [active, setActive] = useState("returns");
|
|
511
|
+
const [open, setOpen] = useState({});
|
|
512
|
+
const select = (id) => (event) => {
|
|
513
|
+
event.preventDefault();
|
|
514
|
+
setActive(id);
|
|
515
|
+
};
|
|
516
|
+
return /* @__PURE__ */ jsx("div", {
|
|
517
|
+
className: "app-shell-specimen",
|
|
518
|
+
"data-collapsed": collapsed ? "" : void 0,
|
|
519
|
+
children: /* @__PURE__ */ jsxs(Sidebar, {
|
|
520
|
+
collapsed,
|
|
521
|
+
label: `Harbour Desk Co${collapsed ? ", icon rail" : ""}`,
|
|
522
|
+
children: [
|
|
523
|
+
/* @__PURE__ */ jsxs(SidebarHeader, { children: [/* @__PURE__ */ jsx(ShellBrand, {
|
|
524
|
+
placement: "header",
|
|
525
|
+
name: "Store Dashboard"
|
|
526
|
+
}), children] }),
|
|
527
|
+
/* @__PURE__ */ jsxs(SidebarNav, { children: [
|
|
528
|
+
/* @__PURE__ */ jsx(SidebarSection, { children: /* @__PURE__ */ jsx(SidebarItem, {
|
|
529
|
+
itemId: "home",
|
|
530
|
+
label: "Home",
|
|
531
|
+
...icons(HouseIcon),
|
|
532
|
+
active: active === "home",
|
|
533
|
+
link: /* @__PURE__ */ jsx("a", { href: "#home" }),
|
|
534
|
+
onSelect: select("home")
|
|
535
|
+
}) }),
|
|
536
|
+
/* @__PURE__ */ jsxs(SidebarSection, {
|
|
537
|
+
title: "Commerce",
|
|
538
|
+
children: [
|
|
539
|
+
/* @__PURE__ */ jsxs(SidebarItem, {
|
|
540
|
+
itemId: "orders",
|
|
541
|
+
label: "Orders",
|
|
542
|
+
...icons(ReceiptIcon),
|
|
543
|
+
active: active === "orders",
|
|
544
|
+
current: ["drafts", "returns"].includes(active),
|
|
545
|
+
badge: orders,
|
|
546
|
+
badgeLabel: `${orders} orders to fulfil`,
|
|
547
|
+
link: /* @__PURE__ */ jsx("a", { href: "#orders" }),
|
|
548
|
+
onSelect: select("orders"),
|
|
549
|
+
open: open.orders ?? true,
|
|
550
|
+
onOpenChange: (v) => setOpen((o) => ({
|
|
551
|
+
...o,
|
|
552
|
+
orders: v
|
|
553
|
+
})),
|
|
554
|
+
toggleLabel: "Show order pages",
|
|
555
|
+
children: [/* @__PURE__ */ jsx(SidebarItem, {
|
|
556
|
+
itemId: "drafts",
|
|
557
|
+
label: "Drafts",
|
|
558
|
+
active: active === "drafts",
|
|
559
|
+
link: /* @__PURE__ */ jsx("a", { href: "#drafts" }),
|
|
560
|
+
onSelect: select("drafts")
|
|
561
|
+
}), /* @__PURE__ */ jsx(SidebarItem, {
|
|
562
|
+
itemId: "returns",
|
|
563
|
+
label: "Returns",
|
|
564
|
+
active: active === "returns",
|
|
565
|
+
link: /* @__PURE__ */ jsx("a", { href: "#returns" }),
|
|
566
|
+
onSelect: select("returns")
|
|
567
|
+
})]
|
|
568
|
+
}),
|
|
569
|
+
/* @__PURE__ */ jsxs(SidebarItem, {
|
|
570
|
+
itemId: "catalogue",
|
|
571
|
+
label: "Catalogue",
|
|
572
|
+
...icons(PackageIcon),
|
|
573
|
+
open: open.catalogue ?? false,
|
|
574
|
+
onOpenChange: (v) => setOpen((o) => ({
|
|
575
|
+
...o,
|
|
576
|
+
catalogue: v
|
|
577
|
+
})),
|
|
578
|
+
children: [/* @__PURE__ */ jsx(SidebarItem, {
|
|
579
|
+
itemId: "products",
|
|
580
|
+
label: "Products",
|
|
581
|
+
active: active === "products",
|
|
582
|
+
link: /* @__PURE__ */ jsx("a", { href: "#products" }),
|
|
583
|
+
onSelect: select("products")
|
|
584
|
+
}), /* @__PURE__ */ jsx(SidebarItem, {
|
|
585
|
+
itemId: "inventory",
|
|
586
|
+
label: "Inventory",
|
|
587
|
+
active: active === "inventory",
|
|
588
|
+
link: /* @__PURE__ */ jsx("a", { href: "#inventory" }),
|
|
589
|
+
onSelect: select("inventory")
|
|
590
|
+
})]
|
|
591
|
+
}),
|
|
592
|
+
/* @__PURE__ */ jsx(SidebarItem, {
|
|
593
|
+
itemId: "customers",
|
|
594
|
+
label: "Customers",
|
|
595
|
+
...icons(UsersThreeIcon),
|
|
596
|
+
active: active === "customers",
|
|
597
|
+
link: /* @__PURE__ */ jsx("a", { href: "#customers" }),
|
|
598
|
+
onSelect: select("customers")
|
|
599
|
+
})
|
|
600
|
+
]
|
|
601
|
+
}),
|
|
602
|
+
/* @__PURE__ */ jsx(SidebarSection, {
|
|
603
|
+
title: "Insights",
|
|
604
|
+
children: /* @__PURE__ */ jsx(SidebarItem, {
|
|
605
|
+
itemId: "analytics",
|
|
606
|
+
label: "Analytics",
|
|
607
|
+
...icons(ChartLineUpIcon),
|
|
608
|
+
active: active === "analytics",
|
|
609
|
+
link: /* @__PURE__ */ jsx("a", { href: "#analytics" }),
|
|
610
|
+
onSelect: select("analytics")
|
|
611
|
+
})
|
|
612
|
+
})
|
|
613
|
+
] }),
|
|
614
|
+
/* @__PURE__ */ jsx(SidebarFooter, { children: /* @__PURE__ */ jsx(StoreButton, {
|
|
615
|
+
name: "Harbour Desk Co",
|
|
616
|
+
detail: "harbourdesk.co.uk",
|
|
617
|
+
avatar: /* @__PURE__ */ jsx(Avatar, {
|
|
618
|
+
shape: "square",
|
|
619
|
+
size: "sm",
|
|
620
|
+
name: "Harbour Desk Co"
|
|
621
|
+
})
|
|
622
|
+
}) })
|
|
623
|
+
]
|
|
624
|
+
})
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
function ItemsDemo() {
|
|
628
|
+
const [orders, setOrders] = useState(12);
|
|
629
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
630
|
+
className: "app-shell-items",
|
|
631
|
+
children: [
|
|
632
|
+
/* @__PURE__ */ jsx(SpecimenSidebar, {
|
|
633
|
+
collapsed: false,
|
|
634
|
+
orders
|
|
635
|
+
}),
|
|
636
|
+
/* @__PURE__ */ jsx(SpecimenSidebar, {
|
|
637
|
+
collapsed: true,
|
|
638
|
+
orders
|
|
639
|
+
}),
|
|
640
|
+
/* @__PURE__ */ jsxs("div", {
|
|
641
|
+
className: "app-shell-items__side",
|
|
642
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
643
|
+
icon: /* @__PURE__ */ jsx(PlusIcon, {}),
|
|
644
|
+
onClick: () => setOrders((n) => n + 1),
|
|
645
|
+
children: "Receive an order"
|
|
646
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
647
|
+
className: "app-shell-items__note",
|
|
648
|
+
children: "The count bumps and the Orders icon sends out one ping. In the rail the count is a teal dot."
|
|
649
|
+
})]
|
|
650
|
+
})
|
|
651
|
+
]
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
function Pair() {
|
|
655
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
656
|
+
className: "app-shell-pair",
|
|
657
|
+
children: [/* @__PURE__ */ jsx(SpecimenSidebar, { collapsed: false }), /* @__PURE__ */ jsx(SpecimenSidebar, { collapsed: true })]
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
var ANATOMY = `
|
|
661
|
+
import {
|
|
662
|
+
AppShell, Canvas, Sidebar, SidebarHeader, SidebarNav, SidebarSection, SidebarItem,
|
|
663
|
+
SidebarFooter, StoreButton, ShellBrand, SidebarToggle, TopBar, Breadcrumbs, SearchTrigger, Avatar,
|
|
664
|
+
} from '@orbitcommerce/constellation'
|
|
665
|
+
import { HouseIcon, ReceiptIcon } from '@orbitcommerce/constellation/icons'
|
|
666
|
+
import { Link, NavLink } from 'react-router'
|
|
667
|
+
|
|
668
|
+
<AppShell
|
|
669
|
+
sidebar={
|
|
670
|
+
<Sidebar label="Harbour Desk Co">
|
|
671
|
+
<SidebarHeader>
|
|
672
|
+
<Link to="/">
|
|
673
|
+
<ShellBrand placement="header" name="Store Dashboard" />
|
|
674
|
+
</Link>
|
|
675
|
+
<SidebarToggle />
|
|
676
|
+
</SidebarHeader>
|
|
677
|
+
<SidebarNav>
|
|
678
|
+
<SidebarSection>
|
|
679
|
+
<SidebarItem label="Home" icon={<HouseIcon />} activeIcon={<HouseIcon weight="duotone" />}
|
|
680
|
+
link={<NavLink to="/" />} active={path === '/'} />
|
|
681
|
+
</SidebarSection>
|
|
682
|
+
<SidebarSection title="Commerce">
|
|
683
|
+
<SidebarItem label="Orders" icon={<ReceiptIcon />} activeIcon={<ReceiptIcon weight="duotone" />}
|
|
684
|
+
link={<NavLink to="/orders" />} active={path === '/orders'} current={path.startsWith('/orders/')}
|
|
685
|
+
badge={toFulfil} badgeLabel={\`\${toFulfil} orders to fulfil\`} toggleLabel="Show order pages">
|
|
686
|
+
<SidebarItem label="Drafts" link={<NavLink to="/orders/drafts" />} active={path === '/orders/drafts'} />
|
|
687
|
+
<SidebarItem label="Returns" link={<NavLink to="/orders/returns" />} active={path === '/orders/returns'} />
|
|
688
|
+
</SidebarItem>
|
|
689
|
+
</SidebarSection>
|
|
690
|
+
</SidebarNav>
|
|
691
|
+
<SidebarFooter>
|
|
692
|
+
{/* The host's store switcher: a Menu opening upwards, triggered by the StoreButton. */}
|
|
693
|
+
<StoreButton
|
|
694
|
+
name="Harbour Desk Co"
|
|
695
|
+
detail="harbourdesk.co.uk"
|
|
696
|
+
avatar={<Avatar shape="square" size="sm" name="Harbour Desk Co" />}
|
|
697
|
+
/>
|
|
698
|
+
</SidebarFooter>
|
|
699
|
+
</Sidebar>
|
|
700
|
+
}
|
|
701
|
+
header={
|
|
702
|
+
<TopBar
|
|
703
|
+
start={<Breadcrumbs items={[{ label: 'Orders', link: <Link to="/orders" /> }, { label: 'Returns' }]} />}
|
|
704
|
+
center={<SearchTrigger onOpen={() => setSearchOpen(true)} />}
|
|
705
|
+
end={<>{/* ghost icon buttons, View store, the account avatar */}</>}
|
|
706
|
+
/>
|
|
707
|
+
}
|
|
708
|
+
>
|
|
709
|
+
<Canvas>{/* the page */}</Canvas>
|
|
710
|
+
</AppShell>`;
|
|
711
|
+
function Page() {
|
|
712
|
+
return /* @__PURE__ */ jsxs(DocPage, {
|
|
713
|
+
title: "App shell",
|
|
714
|
+
status: "new",
|
|
715
|
+
importNames: [
|
|
716
|
+
"AppShell",
|
|
717
|
+
"Canvas",
|
|
718
|
+
"Sidebar",
|
|
719
|
+
"SidebarItem",
|
|
720
|
+
"TopBar"
|
|
721
|
+
],
|
|
722
|
+
lead: "The Orbit app frame: the merchant's store and navigation on the porcelain ground, a slim header across the top, and every page on one white canvas raised on it. Use it once, at the root of every Orbit dashboard.",
|
|
723
|
+
children: [
|
|
724
|
+
/* @__PURE__ */ jsx(ForAudience, {
|
|
725
|
+
audience: "public",
|
|
726
|
+
children: /* @__PURE__ */ jsx(Note, {
|
|
727
|
+
title: "Building a plugin?",
|
|
728
|
+
children: "A plugin runs inside Orbit Commerce's dashboard, which already draws this frame around it, so a plugin page needs only what goes on the canvas. The shell is shown here so your pages fit the frame they sit in."
|
|
729
|
+
})
|
|
730
|
+
}),
|
|
731
|
+
/* @__PURE__ */ jsxs(Section, {
|
|
732
|
+
id: "frame",
|
|
733
|
+
title: "The frame, live",
|
|
734
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
735
|
+
"A whole shell for an invented shop, Harbour Desk Co, in a fixed-height frame. Move between pages and watch the white pill glide, open the store switcher at the foot, press Receive an order, and fold the sidebar with the toggle beside the logo or the ",
|
|
736
|
+
/* @__PURE__ */ jsx(Kbd, { children: "[" }),
|
|
737
|
+
" key. On this page ",
|
|
738
|
+
/* @__PURE__ */ jsx(Kbd, { children: "[" }),
|
|
739
|
+
" folds this demo frame; the docs site's own sidebar is held open."
|
|
740
|
+
] }),
|
|
741
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
742
|
+
align: "fill",
|
|
743
|
+
children: /* @__PURE__ */ jsx(HarbourShell, {})
|
|
744
|
+
}), /* @__PURE__ */ jsx(Note, {
|
|
745
|
+
title: "Resize to see phones",
|
|
746
|
+
children: "The shell picks its mode from the window width, not its container, so this frame turns into the phone layout when the browser is narrower than 768px. On a phone it shows a menu button and a drawer."
|
|
747
|
+
})]
|
|
748
|
+
}),
|
|
749
|
+
/* @__PURE__ */ jsxs(Section, {
|
|
750
|
+
id: "anatomy",
|
|
751
|
+
title: "Anatomy",
|
|
752
|
+
description: /* @__PURE__ */ jsx("p", { children: "Two planes: the ground (sidebar and header) and the raised canvas. Every part is a separate component, so hosts compose their own sidebar and header." }),
|
|
753
|
+
children: [/* @__PURE__ */ jsx(DocTable, {
|
|
754
|
+
columns: ["Part", "What it is"],
|
|
755
|
+
rows: [
|
|
756
|
+
[/* @__PURE__ */ jsx("code", { children: "AppShell" }), "The grid: sidebar on the left, header across the top, the canvas in the rest. Full height (100dvh). Owns the folded rail, the phone drawer and the [ key."],
|
|
757
|
+
[/* @__PURE__ */ jsx("code", { children: "Sidebar" }), "The navigation column on the ground, 256px wide or a 68px icon rail. One white pill marks the page you are on and one soft pill follows the pointer."],
|
|
758
|
+
[/* @__PURE__ */ jsx("code", { children: "SidebarHeader" }), "The 60px row at the top, lined up with the header. Holds the app's lockup (ShellBrand, linking home) and the SidebarToggle."],
|
|
759
|
+
[/* @__PURE__ */ jsx("code", { children: "ShellBrand" }), "The app's lockup, top left: the Orbit mark, the app's name (name=\"Store Dashboard\") and \"by Orbit Commerce\". In the rail it shrinks to the mark, and the toggle shows over it on hover."],
|
|
760
|
+
[/* @__PURE__ */ jsx("code", { children: "SidebarNav" }), "The scrolling list of sections. Items fade under its top and bottom edges rather than being cut off."],
|
|
761
|
+
[/* @__PURE__ */ jsx("code", { children: "SidebarSection" }), "A group with a quiet sentence-case title. In the rail the title becomes a short hairline tick."],
|
|
762
|
+
[/* @__PURE__ */ jsx("code", { children: "SidebarItem" }), "A 32px row: icon, label and an optional count. Holds one level of nested items."],
|
|
763
|
+
[/* @__PURE__ */ jsx("code", { children: "SidebarFooter" }), "The foot of the sidebar: the merchant's store, as a StoreButton that opens the host's store switcher upwards."],
|
|
764
|
+
[/* @__PURE__ */ jsx("code", { children: "StoreButton" }), "The merchant's store: logo or initials, name and domain, with a chevron. In the rail, only the logo."],
|
|
765
|
+
[/* @__PURE__ */ jsx("code", { children: "TopBar" }), "The 60px header on the ground: breadcrumbs at the start, the search pill in the centre, actions at the end."],
|
|
766
|
+
[/* @__PURE__ */ jsx("code", { children: "Breadcrumbs" }), "Where you are, in 28px pills. The last crumb is the current page."],
|
|
767
|
+
[/* @__PURE__ */ jsx("code", { children: "Canvas" }), "The raised white page, inset 8px from the edges with 18px corners. It scrolls inside itself, so the frame never moves."]
|
|
768
|
+
]
|
|
769
|
+
}), /* @__PURE__ */ jsx(SubSection, {
|
|
770
|
+
title: "Putting it together",
|
|
771
|
+
children: /* @__PURE__ */ jsx(CodeBlock, { code: ANATOMY })
|
|
772
|
+
})]
|
|
773
|
+
}),
|
|
774
|
+
/* @__PURE__ */ jsxs(Section, {
|
|
775
|
+
id: "items",
|
|
776
|
+
title: "Sidebar items",
|
|
777
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
778
|
+
/* @__PURE__ */ jsx("code", { children: "active" }),
|
|
779
|
+
" marks the page you are on: the white pill settles there, the label turns ink and the icon swaps to its duotone ",
|
|
780
|
+
/* @__PURE__ */ jsx("code", { children: "activeIcon" }),
|
|
781
|
+
" in teal. ",
|
|
782
|
+
/* @__PURE__ */ jsx("code", { children: "current" }),
|
|
783
|
+
" marks a parent whose child page is active: it reads as current without taking the pill. Here Returns is active and Orders is current."
|
|
784
|
+
] }),
|
|
785
|
+
children: [
|
|
786
|
+
/* @__PURE__ */ jsx(Example, {
|
|
787
|
+
align: "fill",
|
|
788
|
+
code: `
|
|
789
|
+
<SidebarItem
|
|
790
|
+
label="Orders"
|
|
791
|
+
icon={<ReceiptIcon />}
|
|
792
|
+
activeIcon={<ReceiptIcon weight="duotone" />}
|
|
793
|
+
link={<NavLink to="/orders" />}
|
|
794
|
+
current // a child page is active
|
|
795
|
+
badge={12}
|
|
796
|
+
badgeLabel="12 orders to fulfil"
|
|
797
|
+
toggleLabel="Show order pages"
|
|
798
|
+
>
|
|
799
|
+
<SidebarItem label="Drafts" link={<NavLink to="/orders/drafts" />} />
|
|
800
|
+
<SidebarItem label="Returns" link={<NavLink to="/orders/returns" />} active />
|
|
801
|
+
</SidebarItem>
|
|
802
|
+
|
|
803
|
+
// No page of its own: pressing the row opens its children.
|
|
804
|
+
<SidebarItem label="Catalogue" icon={<PackageIcon />}>
|
|
805
|
+
<SidebarItem label="Products" link={<NavLink to="/products" />} />
|
|
806
|
+
</SidebarItem>`,
|
|
807
|
+
children: /* @__PURE__ */ jsx(ItemsDemo, {})
|
|
808
|
+
}),
|
|
809
|
+
/* @__PURE__ */ jsx(SubSection, {
|
|
810
|
+
title: "Nested items",
|
|
811
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
812
|
+
"Children hang off a hairline orbit that runs through the icons' centre, and a small teal satellite rides the active nested pill. A parent with its own page (Orders) keeps its link and gets a separate chevron button to open and close; a parent without one (Catalogue) is a button that opens its children. Groups open and close with ",
|
|
813
|
+
/* @__PURE__ */ jsx("code", { children: "open" }),
|
|
814
|
+
", ",
|
|
815
|
+
/* @__PURE__ */ jsx("code", { children: "defaultOpen" }),
|
|
816
|
+
" and ",
|
|
817
|
+
/* @__PURE__ */ jsx("code", { children: "onOpenChange" }),
|
|
818
|
+
", and stay closed in the rail. One level of nesting is all there is."
|
|
819
|
+
] })
|
|
820
|
+
}),
|
|
821
|
+
/* @__PURE__ */ jsx(SubSection, {
|
|
822
|
+
title: "Counts",
|
|
823
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
824
|
+
/* @__PURE__ */ jsx("code", { children: "badge" }),
|
|
825
|
+
" puts a small count on the right, in teal numerals on a teal tint. When a numeric badge goes up, it bumps and the icon sends out one ping, so a new order is noticed without a toast. The count is hidden from the item's name; ",
|
|
826
|
+
/* @__PURE__ */ jsx("code", { children: "badgeLabel" }),
|
|
827
|
+
" gives screen readers the full meaning, such as \"12 orders to fulfil\". In the rail the count shrinks to a 7px teal dot."
|
|
828
|
+
] })
|
|
829
|
+
}),
|
|
830
|
+
/* @__PURE__ */ jsx(SubSection, {
|
|
831
|
+
title: "Links",
|
|
832
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
833
|
+
"Pass your router's link as ",
|
|
834
|
+
/* @__PURE__ */ jsx("code", { children: "link" }),
|
|
835
|
+
", for example",
|
|
836
|
+
" ",
|
|
837
|
+
/* @__PURE__ */ jsx("code", { children: "link={<NavLink to=\"/orders\" />}" }),
|
|
838
|
+
". The shell fills it with the icon, label and count, adds its classes, and sets ",
|
|
839
|
+
/* @__PURE__ */ jsx("code", { children: "aria-current=\"page\"" }),
|
|
840
|
+
" when the item is active. Without",
|
|
841
|
+
" ",
|
|
842
|
+
/* @__PURE__ */ jsx("code", { children: "link" }),
|
|
843
|
+
" the row is a button, and ",
|
|
844
|
+
/* @__PURE__ */ jsx("code", { children: "onSelect" }),
|
|
845
|
+
" runs on every press either way."
|
|
846
|
+
] })
|
|
847
|
+
})
|
|
848
|
+
]
|
|
849
|
+
}),
|
|
850
|
+
/* @__PURE__ */ jsxs(Section, {
|
|
851
|
+
id: "rail",
|
|
852
|
+
title: "Expanded and the icon rail",
|
|
853
|
+
description: /* @__PURE__ */ jsx("p", { children: "Folded, the sidebar becomes a 68px rail: labels fade out, section titles become hairline ticks, counts become dots, the store shows only its logo, and each item's name moves into a tooltip on the right. The columns resize on the settle spring over 480ms. Both states side by side, in both themes:" }),
|
|
854
|
+
children: [
|
|
855
|
+
/* @__PURE__ */ jsx(ThemePair, {
|
|
856
|
+
align: "fill",
|
|
857
|
+
children: /* @__PURE__ */ jsx(Pair, {})
|
|
858
|
+
}),
|
|
859
|
+
/* @__PURE__ */ jsx(Guidelines, { items: [
|
|
860
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Kbd, { children: "[" }), " folds and unfolds the rail on desktop and tablet. It is ignored while someone is typing in a field, and when a modifier key is held."] }),
|
|
861
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
862
|
+
/* @__PURE__ */ jsx("code", { children: "SidebarToggle" }),
|
|
863
|
+
" does the same from beside the logo. In the rail it waits over the mark and shows on hover or keyboard focus. Its tooltip shows the ",
|
|
864
|
+
/* @__PURE__ */ jsx(Kbd, { children: "[" }),
|
|
865
|
+
" key."
|
|
866
|
+
] }),
|
|
867
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
868
|
+
"Leave the state to the shell, or control it with ",
|
|
869
|
+
/* @__PURE__ */ jsx("code", { children: "collapsed" }),
|
|
870
|
+
" and ",
|
|
871
|
+
/* @__PURE__ */ jsx("code", { children: "onCollapsedChange" }),
|
|
872
|
+
" ",
|
|
873
|
+
"to remember the merchant's choice."
|
|
874
|
+
] })
|
|
875
|
+
] }),
|
|
876
|
+
/* @__PURE__ */ jsx(CodeBlock, { code: `
|
|
877
|
+
const [folded, setFolded] = useState(() => localStorage.getItem('sidebar') === 'rail')
|
|
878
|
+
|
|
879
|
+
<AppShell
|
|
880
|
+
collapsed={folded}
|
|
881
|
+
onCollapsedChange={(next) => {
|
|
882
|
+
setFolded(next)
|
|
883
|
+
localStorage.setItem('sidebar', next ? 'rail' : 'expanded')
|
|
884
|
+
}}
|
|
885
|
+
sidebar={…}
|
|
886
|
+
header={…}
|
|
887
|
+
>` })
|
|
888
|
+
]
|
|
889
|
+
}),
|
|
890
|
+
/* @__PURE__ */ jsxs(Section, {
|
|
891
|
+
id: "responsive",
|
|
892
|
+
title: "Tablet and phone",
|
|
893
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
894
|
+
"The shell reads the window width, reports it as ",
|
|
895
|
+
/* @__PURE__ */ jsx("code", { children: "mode" }),
|
|
896
|
+
", and changes shape only on phones."
|
|
897
|
+
] }),
|
|
898
|
+
children: [/* @__PURE__ */ jsx(DocTable, {
|
|
899
|
+
columns: [
|
|
900
|
+
"Window",
|
|
901
|
+
"Mode",
|
|
902
|
+
"What changes"
|
|
903
|
+
],
|
|
904
|
+
rows: [
|
|
905
|
+
[
|
|
906
|
+
"1024px and wider",
|
|
907
|
+
/* @__PURE__ */ jsx("code", { children: "desktop" }),
|
|
908
|
+
"The 256px sidebar, folding to the 68px rail with [ or the toggle."
|
|
909
|
+
],
|
|
910
|
+
[
|
|
911
|
+
"768 to 1023px",
|
|
912
|
+
/* @__PURE__ */ jsx("code", { children: "tablet" }),
|
|
913
|
+
"Nothing: the sidebar and its rail stay as on desktop. The mode is there if a host wants to fold the sidebar by default."
|
|
914
|
+
],
|
|
915
|
+
[
|
|
916
|
+
"Below 768px",
|
|
917
|
+
/* @__PURE__ */ jsx("code", { children: "mobile" }),
|
|
918
|
+
"The sidebar becomes a drawer: up to 304px or 86% of the width, rounded 22px on its open edge, on the modal shadow, sliding on the settle spring over a dimmed, lightly blurred scrim. The header gains a 36px menu button and drops its centre, breadcrumbs show only the current page, and the canvas insets 6px with 16px corners."
|
|
919
|
+
]
|
|
920
|
+
]
|
|
921
|
+
}), /* @__PURE__ */ jsx(Guidelines, { items: [
|
|
922
|
+
"The menu button opens the drawer; tapping the scrim or pressing Escape closes it, and so does widening the window past 768px.",
|
|
923
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
924
|
+
"Close the drawer yourself when a page is chosen: call ",
|
|
925
|
+
/* @__PURE__ */ jsx("code", { children: "setDrawerOpen(false)" }),
|
|
926
|
+
" from",
|
|
927
|
+
" ",
|
|
928
|
+
/* @__PURE__ */ jsx("code", { children: "useShell()" }),
|
|
929
|
+
" in the item's ",
|
|
930
|
+
/* @__PURE__ */ jsx("code", { children: "onSelect" }),
|
|
931
|
+
", as the frame above does."
|
|
932
|
+
] }),
|
|
933
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
934
|
+
"On phones the rail does not exist: ",
|
|
935
|
+
/* @__PURE__ */ jsx("code", { children: "collapsed" }),
|
|
936
|
+
" reads false and ",
|
|
937
|
+
/* @__PURE__ */ jsx("code", { children: "[" }),
|
|
938
|
+
" does nothing."
|
|
939
|
+
] }),
|
|
940
|
+
"Drop the actions that do not fit a phone header, the way Orbit Commerce's store dashboard drops View store, the plan pill and help on phones."
|
|
941
|
+
] })]
|
|
942
|
+
}),
|
|
943
|
+
/* @__PURE__ */ jsxs(Section, {
|
|
944
|
+
id: "use-shell",
|
|
945
|
+
title: "useShell and useOptionalShell",
|
|
946
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
947
|
+
"Anything inside ",
|
|
948
|
+
/* @__PURE__ */ jsx("code", { children: "AppShell" }),
|
|
949
|
+
" can read and drive the frame. ",
|
|
950
|
+
/* @__PURE__ */ jsx("code", { children: "useShell()" }),
|
|
951
|
+
" throws outside a shell; ",
|
|
952
|
+
/* @__PURE__ */ jsx("code", { children: "useOptionalShell()" }),
|
|
953
|
+
" returns null instead, for parts that also render on their own (the sidebar, the header and the toggle use it). The frame's canvas above reads it to show the mode and to fold the sidebar."
|
|
954
|
+
] }),
|
|
955
|
+
children: [/* @__PURE__ */ jsx(DocTable, {
|
|
956
|
+
columns: [
|
|
957
|
+
"Value",
|
|
958
|
+
"Type",
|
|
959
|
+
"What it is"
|
|
960
|
+
],
|
|
961
|
+
rows: [
|
|
962
|
+
[
|
|
963
|
+
/* @__PURE__ */ jsx("code", { children: "mode" }),
|
|
964
|
+
/* @__PURE__ */ jsx("code", { children: "'desktop' | 'tablet' | 'mobile'" }),
|
|
965
|
+
"From the window width: 1024px and up, 768 to 1023px, below 768px."
|
|
966
|
+
],
|
|
967
|
+
[
|
|
968
|
+
/* @__PURE__ */ jsx("code", { children: "collapsed" }),
|
|
969
|
+
/* @__PURE__ */ jsx("code", { children: "boolean" }),
|
|
970
|
+
"The sidebar is the icon rail. Always false on phones."
|
|
971
|
+
],
|
|
972
|
+
[
|
|
973
|
+
/* @__PURE__ */ jsx("code", { children: "setCollapsed" }),
|
|
974
|
+
/* @__PURE__ */ jsx("code", { children: "(next: boolean) => void" }),
|
|
975
|
+
"Fold or unfold the rail."
|
|
976
|
+
],
|
|
977
|
+
[
|
|
978
|
+
/* @__PURE__ */ jsx("code", { children: "toggleCollapsed" }),
|
|
979
|
+
/* @__PURE__ */ jsx("code", { children: "() => void" }),
|
|
980
|
+
"Flip it."
|
|
981
|
+
],
|
|
982
|
+
[
|
|
983
|
+
/* @__PURE__ */ jsx("code", { children: "drawerOpen" }),
|
|
984
|
+
/* @__PURE__ */ jsx("code", { children: "boolean" }),
|
|
985
|
+
"The phone drawer is open."
|
|
986
|
+
],
|
|
987
|
+
[
|
|
988
|
+
/* @__PURE__ */ jsx("code", { children: "setDrawerOpen" }),
|
|
989
|
+
/* @__PURE__ */ jsx("code", { children: "(next: boolean) => void" }),
|
|
990
|
+
"Open or close the drawer."
|
|
991
|
+
]
|
|
992
|
+
]
|
|
993
|
+
}), /* @__PURE__ */ jsx(CodeBlock, { code: `
|
|
994
|
+
import { useShell } from '@orbitcommerce/constellation'
|
|
995
|
+
|
|
996
|
+
function PageHeader() {
|
|
997
|
+
const shell = useShell()
|
|
998
|
+
return shell.mode === 'mobile' ? null : <Button size="sm">View store</Button>
|
|
999
|
+
}` })]
|
|
1000
|
+
}),
|
|
1001
|
+
/* @__PURE__ */ jsxs(Section, {
|
|
1002
|
+
id: "top-bar",
|
|
1003
|
+
title: "Header, breadcrumbs and brand",
|
|
1004
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
1005
|
+
/* @__PURE__ */ jsx("code", { children: "TopBar" }),
|
|
1006
|
+
" takes three slots. ",
|
|
1007
|
+
/* @__PURE__ */ jsx("code", { children: "start" }),
|
|
1008
|
+
" holds ",
|
|
1009
|
+
/* @__PURE__ */ jsx("code", { children: "Breadcrumbs" }),
|
|
1010
|
+
" (or a page title),",
|
|
1011
|
+
" ",
|
|
1012
|
+
/* @__PURE__ */ jsx("code", { children: "center" }),
|
|
1013
|
+
" the ",
|
|
1014
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
1015
|
+
to: "/components/command-palette",
|
|
1016
|
+
children: "search pill"
|
|
1017
|
+
}),
|
|
1018
|
+
" that grows into the command palette, and ",
|
|
1019
|
+
/* @__PURE__ */ jsx("code", { children: "end" }),
|
|
1020
|
+
" the actions: ghost icon buttons 4px apart, the View store pill and the account avatar. ",
|
|
1021
|
+
/* @__PURE__ */ jsx("code", { children: "ShellBrand" }),
|
|
1022
|
+
" is the Orbit logo: ",
|
|
1023
|
+
/* @__PURE__ */ jsx("code", { children: "placement=\"header\"" }),
|
|
1024
|
+
" for the app's logo top left of the sidebar, or the default quiet signature (with an optional ",
|
|
1025
|
+
/* @__PURE__ */ jsx("code", { children: "meta" }),
|
|
1026
|
+
" such as a version) for a footer. Both turn to the mark alone in the rail."
|
|
1027
|
+
] }),
|
|
1028
|
+
children: [
|
|
1029
|
+
/* @__PURE__ */ jsx(Example, {
|
|
1030
|
+
surface: "ground",
|
|
1031
|
+
code: `
|
|
1032
|
+
<Breadcrumbs
|
|
1033
|
+
items={[
|
|
1034
|
+
{ label: 'Orders', link: <Link to="/orders" /> },
|
|
1035
|
+
{ label: 'Returns' },
|
|
1036
|
+
]}
|
|
1037
|
+
/>
|
|
1038
|
+
|
|
1039
|
+
<ShellBrand meta="v2.4" />`,
|
|
1040
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
1041
|
+
className: "app-shell-crumbs",
|
|
1042
|
+
children: [/* @__PURE__ */ jsx(Breadcrumbs, { items: [{
|
|
1043
|
+
key: "orders",
|
|
1044
|
+
label: "Orders",
|
|
1045
|
+
link: /* @__PURE__ */ jsx("a", { href: "#top-bar" })
|
|
1046
|
+
}, {
|
|
1047
|
+
key: "returns",
|
|
1048
|
+
label: "Returns"
|
|
1049
|
+
}] }), /* @__PURE__ */ jsx("div", {
|
|
1050
|
+
className: "app-shell-crumbs__brand",
|
|
1051
|
+
children: /* @__PURE__ */ jsx(ShellBrand, { meta: "v2.4" })
|
|
1052
|
+
})]
|
|
1053
|
+
})
|
|
1054
|
+
}),
|
|
1055
|
+
/* @__PURE__ */ jsxs(Note, {
|
|
1056
|
+
title: "Narrow headers",
|
|
1057
|
+
children: [
|
|
1058
|
+
"The search pill keeps its full width while there is any room at all, so in a narrow header (a tablet with the sidebar open, or a panel docked beside the canvas) a long row of actions at the end runs into it. Keep the end to a few icon buttons there, or pass the ",
|
|
1059
|
+
/* @__PURE__ */ jsx("code", { children: "SearchTrigger" }),
|
|
1060
|
+
" a smaller ",
|
|
1061
|
+
/* @__PURE__ */ jsx("code", { children: "width" }),
|
|
1062
|
+
", as the frame above does."
|
|
1063
|
+
]
|
|
1064
|
+
}),
|
|
1065
|
+
/* @__PURE__ */ jsxs(Note, {
|
|
1066
|
+
title: "Inside this docs site",
|
|
1067
|
+
children: [
|
|
1068
|
+
"The docs site is itself built on ",
|
|
1069
|
+
/* @__PURE__ */ jsx("code", { children: "AppShell" }),
|
|
1070
|
+
", so the phone rules reach anything on this page: on a phone, the breadcrumbs above show only their last crumb, just as they would in a real header."
|
|
1071
|
+
]
|
|
1072
|
+
})
|
|
1073
|
+
]
|
|
1074
|
+
}),
|
|
1075
|
+
/* @__PURE__ */ jsxs(Section, {
|
|
1076
|
+
id: "guidelines",
|
|
1077
|
+
title: "Guidelines",
|
|
1078
|
+
children: [/* @__PURE__ */ jsx(DoDont, {
|
|
1079
|
+
do: {
|
|
1080
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
1081
|
+
className: "app-shell-dodont",
|
|
1082
|
+
children: /* @__PURE__ */ jsx(Sidebar, {
|
|
1083
|
+
collapsed: false,
|
|
1084
|
+
label: "Do example",
|
|
1085
|
+
children: /* @__PURE__ */ jsx(SidebarNav, {
|
|
1086
|
+
label: "Do example",
|
|
1087
|
+
children: /* @__PURE__ */ jsxs(SidebarSection, {
|
|
1088
|
+
title: "Commerce",
|
|
1089
|
+
children: [
|
|
1090
|
+
/* @__PURE__ */ jsx(SidebarItem, {
|
|
1091
|
+
itemId: "do-orders",
|
|
1092
|
+
label: "Orders",
|
|
1093
|
+
...icons(ReceiptIcon),
|
|
1094
|
+
badge: 12,
|
|
1095
|
+
badgeLabel: "12 orders to fulfil"
|
|
1096
|
+
}),
|
|
1097
|
+
/* @__PURE__ */ jsx(SidebarItem, {
|
|
1098
|
+
itemId: "do-products",
|
|
1099
|
+
label: "Products",
|
|
1100
|
+
...icons(PackageIcon)
|
|
1101
|
+
}),
|
|
1102
|
+
/* @__PURE__ */ jsx(SidebarItem, {
|
|
1103
|
+
itemId: "do-customers",
|
|
1104
|
+
label: "Customers",
|
|
1105
|
+
...icons(UsersThreeIcon)
|
|
1106
|
+
})
|
|
1107
|
+
]
|
|
1108
|
+
})
|
|
1109
|
+
})
|
|
1110
|
+
})
|
|
1111
|
+
}),
|
|
1112
|
+
caption: "Counts only for work waiting on the merchant, like orders to fulfil."
|
|
1113
|
+
},
|
|
1114
|
+
dont: {
|
|
1115
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
1116
|
+
className: "app-shell-dodont",
|
|
1117
|
+
children: /* @__PURE__ */ jsx(Sidebar, {
|
|
1118
|
+
collapsed: false,
|
|
1119
|
+
label: "Don't example",
|
|
1120
|
+
children: /* @__PURE__ */ jsx(SidebarNav, {
|
|
1121
|
+
label: "Don't example",
|
|
1122
|
+
children: /* @__PURE__ */ jsxs(SidebarSection, {
|
|
1123
|
+
title: "Commerce",
|
|
1124
|
+
children: [
|
|
1125
|
+
/* @__PURE__ */ jsx(SidebarItem, {
|
|
1126
|
+
itemId: "dont-orders",
|
|
1127
|
+
label: "Orders",
|
|
1128
|
+
...icons(ReceiptIcon),
|
|
1129
|
+
badge: 12
|
|
1130
|
+
}),
|
|
1131
|
+
/* @__PURE__ */ jsx(SidebarItem, {
|
|
1132
|
+
itemId: "dont-products",
|
|
1133
|
+
label: "Products",
|
|
1134
|
+
...icons(PackageIcon),
|
|
1135
|
+
badge: 318
|
|
1136
|
+
}),
|
|
1137
|
+
/* @__PURE__ */ jsx(SidebarItem, {
|
|
1138
|
+
itemId: "dont-customers",
|
|
1139
|
+
label: "Customers",
|
|
1140
|
+
...icons(UsersThreeIcon),
|
|
1141
|
+
badge: 1206
|
|
1142
|
+
})
|
|
1143
|
+
]
|
|
1144
|
+
})
|
|
1145
|
+
})
|
|
1146
|
+
})
|
|
1147
|
+
}),
|
|
1148
|
+
caption: "Totals on every item are noise, and the one count that needs action gets lost among them."
|
|
1149
|
+
}
|
|
1150
|
+
}), /* @__PURE__ */ jsx(Guidelines, { items: [
|
|
1151
|
+
"One AppShell per app, at the root. Pages render inside Canvas; they never draw their own frame.",
|
|
1152
|
+
"Keep the sidebar and header on the ground: no backgrounds, cards or shadows of their own. The canvas is the only raised surface.",
|
|
1153
|
+
"Group items under short sentence-case section titles, with a Phosphor icon for each top-level item: regular at rest, duotone when active.",
|
|
1154
|
+
"Name items for the place, in a word or two: Orders, Gift cards, Media library.",
|
|
1155
|
+
"Give every icon-only header button a label and a tooltip, and keep the header to a handful of actions."
|
|
1156
|
+
] })]
|
|
1157
|
+
}),
|
|
1158
|
+
/* @__PURE__ */ jsx(Section, {
|
|
1159
|
+
id: "accessibility",
|
|
1160
|
+
title: "Accessibility",
|
|
1161
|
+
children: /* @__PURE__ */ jsx(Guidelines, { items: [
|
|
1162
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1163
|
+
"Landmarks: the sidebar is an ",
|
|
1164
|
+
/* @__PURE__ */ jsx("code", { children: "aside" }),
|
|
1165
|
+
" named by ",
|
|
1166
|
+
/* @__PURE__ */ jsx("code", { children: "label" }),
|
|
1167
|
+
" (default \"Main\") with a",
|
|
1168
|
+
" ",
|
|
1169
|
+
/* @__PURE__ */ jsx("code", { children: "nav" }),
|
|
1170
|
+
" inside (default \"Primary\"), the top bar is a ",
|
|
1171
|
+
/* @__PURE__ */ jsx("code", { children: "header" }),
|
|
1172
|
+
", and the canvas is the",
|
|
1173
|
+
" ",
|
|
1174
|
+
/* @__PURE__ */ jsx("code", { children: "main" }),
|
|
1175
|
+
" element unless you change ",
|
|
1176
|
+
/* @__PURE__ */ jsx("code", { children: "as" }),
|
|
1177
|
+
"."
|
|
1178
|
+
] }),
|
|
1179
|
+
"Sections are groups named by their titles. The active item carries aria-current=\"page\", and its count is left out of its name, with badgeLabel attached as a description.",
|
|
1180
|
+
"A parent without a page is a button with aria-expanded. A parent with a page has a separate toggle named by toggleLabel, with aria-expanded and aria-controls. Closed groups are inert, so their links leave the tab order.",
|
|
1181
|
+
"Items are ordinary links and buttons in tab order. In the rail their names stay in place for screen readers and show as tooltips for everyone else.",
|
|
1182
|
+
"SidebarToggle has aria-expanded and aria-keyshortcuts=\"[\". The phone menu button has aria-expanded, and Escape closes the drawer.",
|
|
1183
|
+
"Breadcrumbs are a nav named \"Breadcrumb\" holding an ordered list, with the current page marked and the separators hidden.",
|
|
1184
|
+
"Focus rings are teal and 2px on every item, toggle, crumb and the store button.",
|
|
1185
|
+
"With reduced motion the columns and the drawer change at once, the pills jump instead of gliding, groups open without the slide, and counts neither bump nor ping."
|
|
1186
|
+
] })
|
|
1187
|
+
}),
|
|
1188
|
+
/* @__PURE__ */ jsxs(Section, {
|
|
1189
|
+
id: "props",
|
|
1190
|
+
title: "Props",
|
|
1191
|
+
children: [
|
|
1192
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
1193
|
+
title: "AppShell",
|
|
1194
|
+
rows: [
|
|
1195
|
+
{
|
|
1196
|
+
name: "sidebar",
|
|
1197
|
+
type: "ReactNode",
|
|
1198
|
+
required: true,
|
|
1199
|
+
description: "The Sidebar."
|
|
1200
|
+
},
|
|
1201
|
+
{
|
|
1202
|
+
name: "header",
|
|
1203
|
+
type: "ReactNode",
|
|
1204
|
+
required: true,
|
|
1205
|
+
description: "The TopBar."
|
|
1206
|
+
},
|
|
1207
|
+
{
|
|
1208
|
+
name: "children",
|
|
1209
|
+
type: "ReactNode",
|
|
1210
|
+
required: true,
|
|
1211
|
+
description: "The page, usually a Canvas."
|
|
1212
|
+
},
|
|
1213
|
+
{
|
|
1214
|
+
name: "collapsed",
|
|
1215
|
+
type: "boolean",
|
|
1216
|
+
description: "Controlled icon rail. Leave undefined to let the shell manage it."
|
|
1217
|
+
},
|
|
1218
|
+
{
|
|
1219
|
+
name: "defaultCollapsed",
|
|
1220
|
+
type: "boolean",
|
|
1221
|
+
default: "false",
|
|
1222
|
+
description: "Starting state when uncontrolled."
|
|
1223
|
+
},
|
|
1224
|
+
{
|
|
1225
|
+
name: "onCollapsedChange",
|
|
1226
|
+
type: "(collapsed: boolean) => void",
|
|
1227
|
+
description: "Called when the rail is folded or unfolded."
|
|
1228
|
+
},
|
|
1229
|
+
{
|
|
1230
|
+
name: "drawerOpen",
|
|
1231
|
+
type: "boolean",
|
|
1232
|
+
description: "Controlled phone drawer."
|
|
1233
|
+
},
|
|
1234
|
+
{
|
|
1235
|
+
name: "onDrawerOpenChange",
|
|
1236
|
+
type: "(open: boolean) => void",
|
|
1237
|
+
description: "Called when the drawer opens or closes."
|
|
1238
|
+
},
|
|
1239
|
+
{
|
|
1240
|
+
name: "aside",
|
|
1241
|
+
type: "ReactNode",
|
|
1242
|
+
description: "Content docked beside the canvas, e.g. an assistant panel."
|
|
1243
|
+
}
|
|
1244
|
+
]
|
|
1245
|
+
}),
|
|
1246
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
1247
|
+
title: "Canvas",
|
|
1248
|
+
rows: [
|
|
1249
|
+
{
|
|
1250
|
+
name: "as",
|
|
1251
|
+
type: "'main' | 'div' | 'section'",
|
|
1252
|
+
default: "'main'",
|
|
1253
|
+
description: "Element for the scroll container. The ref points at it."
|
|
1254
|
+
},
|
|
1255
|
+
{
|
|
1256
|
+
name: "scrollClassName",
|
|
1257
|
+
type: "string",
|
|
1258
|
+
description: "Classes for the inner scroll container."
|
|
1259
|
+
},
|
|
1260
|
+
{
|
|
1261
|
+
name: "top",
|
|
1262
|
+
type: "ReactNode",
|
|
1263
|
+
description: "Content pinned above the scroll area, e.g. banners."
|
|
1264
|
+
}
|
|
1265
|
+
]
|
|
1266
|
+
}),
|
|
1267
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
1268
|
+
title: "Sidebar",
|
|
1269
|
+
rows: [
|
|
1270
|
+
{
|
|
1271
|
+
name: "label",
|
|
1272
|
+
type: "string",
|
|
1273
|
+
default: "'Main'",
|
|
1274
|
+
description: "Accessible name for the sidebar landmark."
|
|
1275
|
+
},
|
|
1276
|
+
{
|
|
1277
|
+
name: "collapsed",
|
|
1278
|
+
type: "boolean",
|
|
1279
|
+
description: "Force the icon rail regardless of the shell, e.g. when rendered on its own."
|
|
1280
|
+
},
|
|
1281
|
+
{
|
|
1282
|
+
name: "children",
|
|
1283
|
+
type: "ReactNode",
|
|
1284
|
+
required: true,
|
|
1285
|
+
description: "Header, nav and footer."
|
|
1286
|
+
}
|
|
1287
|
+
]
|
|
1288
|
+
}),
|
|
1289
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
1290
|
+
title: "SidebarNav and SidebarSection",
|
|
1291
|
+
rows: [{
|
|
1292
|
+
name: "label",
|
|
1293
|
+
type: "string",
|
|
1294
|
+
default: "'Primary'",
|
|
1295
|
+
description: "SidebarNav: accessible name for the nav landmark."
|
|
1296
|
+
}, {
|
|
1297
|
+
name: "title",
|
|
1298
|
+
type: "ReactNode",
|
|
1299
|
+
description: "SidebarSection: quiet heading, sentence case. A tick in the rail."
|
|
1300
|
+
}]
|
|
1301
|
+
}),
|
|
1302
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
1303
|
+
title: "SidebarItem",
|
|
1304
|
+
rows: [
|
|
1305
|
+
{
|
|
1306
|
+
name: "label",
|
|
1307
|
+
type: "ReactNode",
|
|
1308
|
+
required: true,
|
|
1309
|
+
description: "The item name. Also the rail tooltip."
|
|
1310
|
+
},
|
|
1311
|
+
{
|
|
1312
|
+
name: "icon",
|
|
1313
|
+
type: "ReactNode",
|
|
1314
|
+
description: "Icon at rest (18px)."
|
|
1315
|
+
},
|
|
1316
|
+
{
|
|
1317
|
+
name: "activeIcon",
|
|
1318
|
+
type: "ReactNode",
|
|
1319
|
+
description: "Icon while active, e.g. the duotone weight. Falls back to icon."
|
|
1320
|
+
},
|
|
1321
|
+
{
|
|
1322
|
+
name: "active",
|
|
1323
|
+
type: "boolean",
|
|
1324
|
+
default: "false",
|
|
1325
|
+
description: "The current page: the active pill settles here."
|
|
1326
|
+
},
|
|
1327
|
+
{
|
|
1328
|
+
name: "current",
|
|
1329
|
+
type: "boolean",
|
|
1330
|
+
default: "false",
|
|
1331
|
+
description: "A child page is active: reads as current without the pill."
|
|
1332
|
+
},
|
|
1333
|
+
{
|
|
1334
|
+
name: "badge",
|
|
1335
|
+
type: "ReactNode",
|
|
1336
|
+
description: "A small count on the right. A rising number bumps and pings."
|
|
1337
|
+
},
|
|
1338
|
+
{
|
|
1339
|
+
name: "badgeLabel",
|
|
1340
|
+
type: "string",
|
|
1341
|
+
description: "What the count means, for screen readers, e.g. \"12 orders to fulfil\"."
|
|
1342
|
+
},
|
|
1343
|
+
{
|
|
1344
|
+
name: "link",
|
|
1345
|
+
type: "ReactElement",
|
|
1346
|
+
description: "The element that navigates, e.g. <NavLink to=\"/orders\" />. Without it the row is a button."
|
|
1347
|
+
},
|
|
1348
|
+
{
|
|
1349
|
+
name: "onSelect",
|
|
1350
|
+
type: "(event: MouseEvent<HTMLElement>) => void",
|
|
1351
|
+
description: "Called when the row is pressed."
|
|
1352
|
+
},
|
|
1353
|
+
{
|
|
1354
|
+
name: "children",
|
|
1355
|
+
type: "ReactNode",
|
|
1356
|
+
description: "Nested items, one level."
|
|
1357
|
+
},
|
|
1358
|
+
{
|
|
1359
|
+
name: "open",
|
|
1360
|
+
type: "boolean",
|
|
1361
|
+
description: "Controlled open state for nested items."
|
|
1362
|
+
},
|
|
1363
|
+
{
|
|
1364
|
+
name: "defaultOpen",
|
|
1365
|
+
type: "boolean",
|
|
1366
|
+
default: "false",
|
|
1367
|
+
description: "Starting open state when uncontrolled."
|
|
1368
|
+
},
|
|
1369
|
+
{
|
|
1370
|
+
name: "onOpenChange",
|
|
1371
|
+
type: "(open: boolean) => void",
|
|
1372
|
+
description: "Called when the group opens or closes."
|
|
1373
|
+
},
|
|
1374
|
+
{
|
|
1375
|
+
name: "toggleLabel",
|
|
1376
|
+
type: "string",
|
|
1377
|
+
default: "'Show more'",
|
|
1378
|
+
description: "Name of the expand toggle on a parent with its own page."
|
|
1379
|
+
},
|
|
1380
|
+
{
|
|
1381
|
+
name: "itemId",
|
|
1382
|
+
type: "string",
|
|
1383
|
+
description: "Stable id for the hover pill. Generated when omitted."
|
|
1384
|
+
}
|
|
1385
|
+
]
|
|
1386
|
+
}),
|
|
1387
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
1388
|
+
title: "TopBar",
|
|
1389
|
+
rows: [
|
|
1390
|
+
{
|
|
1391
|
+
name: "start",
|
|
1392
|
+
type: "ReactNode",
|
|
1393
|
+
description: "Left: breadcrumbs or the page title."
|
|
1394
|
+
},
|
|
1395
|
+
{
|
|
1396
|
+
name: "center",
|
|
1397
|
+
type: "ReactNode",
|
|
1398
|
+
description: "Centre: usually the SearchTrigger. Hidden on phones."
|
|
1399
|
+
},
|
|
1400
|
+
{
|
|
1401
|
+
name: "end",
|
|
1402
|
+
type: "ReactNode",
|
|
1403
|
+
description: "Right: actions, notifications, account."
|
|
1404
|
+
},
|
|
1405
|
+
{
|
|
1406
|
+
name: "menuLabel",
|
|
1407
|
+
type: "string",
|
|
1408
|
+
default: "'Open navigation'",
|
|
1409
|
+
description: "Name of the menu button shown on phones."
|
|
1410
|
+
}
|
|
1411
|
+
]
|
|
1412
|
+
}),
|
|
1413
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
1414
|
+
title: "Breadcrumbs",
|
|
1415
|
+
rows: [{
|
|
1416
|
+
name: "items",
|
|
1417
|
+
type: "BreadcrumbItem[]",
|
|
1418
|
+
required: true,
|
|
1419
|
+
description: "{ label, link?, key? }. The last item is the current page."
|
|
1420
|
+
}, {
|
|
1421
|
+
name: "label",
|
|
1422
|
+
type: "string",
|
|
1423
|
+
default: "'Breadcrumb'",
|
|
1424
|
+
description: "Accessible name for the nav."
|
|
1425
|
+
}]
|
|
1426
|
+
}),
|
|
1427
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
1428
|
+
title: "SidebarToggle",
|
|
1429
|
+
rows: [{
|
|
1430
|
+
name: "collapseLabel",
|
|
1431
|
+
type: "string",
|
|
1432
|
+
default: "'Collapse sidebar'",
|
|
1433
|
+
description: "Name while expanded."
|
|
1434
|
+
}, {
|
|
1435
|
+
name: "expandLabel",
|
|
1436
|
+
type: "string",
|
|
1437
|
+
default: "'Expand sidebar'",
|
|
1438
|
+
description: "Name while folded. Renders nothing on phones or outside a shell."
|
|
1439
|
+
}]
|
|
1440
|
+
}),
|
|
1441
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
1442
|
+
title: "StoreButton and ShellBrand",
|
|
1443
|
+
rows: [
|
|
1444
|
+
{
|
|
1445
|
+
name: "name",
|
|
1446
|
+
type: "ReactNode",
|
|
1447
|
+
required: true,
|
|
1448
|
+
description: "StoreButton: the store name."
|
|
1449
|
+
},
|
|
1450
|
+
{
|
|
1451
|
+
name: "detail",
|
|
1452
|
+
type: "ReactNode",
|
|
1453
|
+
description: "StoreButton: a second line, e.g. the store's domain."
|
|
1454
|
+
},
|
|
1455
|
+
{
|
|
1456
|
+
name: "avatar",
|
|
1457
|
+
type: "ReactNode",
|
|
1458
|
+
description: "StoreButton: logo or initials, e.g. <Avatar shape=\"square\" />."
|
|
1459
|
+
},
|
|
1460
|
+
{
|
|
1461
|
+
name: "placement",
|
|
1462
|
+
type: "'header' | 'footer'",
|
|
1463
|
+
default: "'footer'",
|
|
1464
|
+
description: "ShellBrand: header is the app logo top left at full strength; footer is a quiet signature."
|
|
1465
|
+
},
|
|
1466
|
+
{
|
|
1467
|
+
name: "meta",
|
|
1468
|
+
type: "ReactNode",
|
|
1469
|
+
description: "ShellBrand: shown beside the logo when expanded, e.g. a version."
|
|
1470
|
+
}
|
|
1471
|
+
]
|
|
1472
|
+
})
|
|
1473
|
+
]
|
|
1474
|
+
})
|
|
1475
|
+
]
|
|
1476
|
+
});
|
|
1477
|
+
}
|
|
1478
|
+
//#endregion
|
|
1479
|
+
export { Page, Preview };
|