@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,1429 @@
|
|
|
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, u as PropsTable } from "./docs-BNOb7AqR.js";
|
|
4
|
+
import { t as Playground } from "./Playground-CNbBbErC.js";
|
|
5
|
+
import { c as SpecimenFrame } from "./_overlays-specimens-Dpn6oiyH.js";
|
|
6
|
+
import { useState } from "react";
|
|
7
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { Button, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, Field, Input, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue } from "@orbitcommerce/constellation";
|
|
9
|
+
import { ArrowsDownUpIcon, ArrowsLeftRightIcon, StorefrontIcon, WarehouseIcon } from "@orbitcommerce/constellation/icons";
|
|
10
|
+
//#region src/pages/components/select.tsx
|
|
11
|
+
var STATUSES = [
|
|
12
|
+
{
|
|
13
|
+
value: "unfulfilled",
|
|
14
|
+
label: "Unfulfilled"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
value: "partial",
|
|
18
|
+
label: "Partially fulfilled"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
value: "fulfilled",
|
|
22
|
+
label: "Fulfilled"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
value: "returned",
|
|
26
|
+
label: "Returned"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
value: "cancelled",
|
|
30
|
+
label: "Cancelled"
|
|
31
|
+
}
|
|
32
|
+
];
|
|
33
|
+
var RATES = [
|
|
34
|
+
{
|
|
35
|
+
value: "standard",
|
|
36
|
+
label: "Standard delivery",
|
|
37
|
+
description: "2 to 4 working days",
|
|
38
|
+
hint: "£3.95"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
value: "next-day",
|
|
42
|
+
label: "Next working day",
|
|
43
|
+
description: "Order by 2pm",
|
|
44
|
+
hint: "£6.95"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
value: "saturday",
|
|
48
|
+
label: "Saturday delivery",
|
|
49
|
+
description: "Order by 2pm on Friday",
|
|
50
|
+
hint: "£9.95"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
value: "collect",
|
|
54
|
+
label: "Click and collect",
|
|
55
|
+
description: "Ready in 2 hours at our Leeds shop",
|
|
56
|
+
hint: "Free"
|
|
57
|
+
}
|
|
58
|
+
];
|
|
59
|
+
var LOCATIONS = [
|
|
60
|
+
{
|
|
61
|
+
value: "leeds",
|
|
62
|
+
label: "Leeds warehouse",
|
|
63
|
+
icon: /* @__PURE__ */ jsx(WarehouseIcon, {}),
|
|
64
|
+
hint: "42 in stock"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
value: "manchester",
|
|
68
|
+
label: "Manchester shop",
|
|
69
|
+
icon: /* @__PURE__ */ jsx(StorefrontIcon, {}),
|
|
70
|
+
hint: "6 in stock"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
value: "york",
|
|
74
|
+
label: "York shop",
|
|
75
|
+
icon: /* @__PURE__ */ jsx(StorefrontIcon, {}),
|
|
76
|
+
hint: "None in stock",
|
|
77
|
+
disabled: true
|
|
78
|
+
}
|
|
79
|
+
];
|
|
80
|
+
var STOCK = {
|
|
81
|
+
leeds: 42,
|
|
82
|
+
manchester: 6,
|
|
83
|
+
york: 0
|
|
84
|
+
};
|
|
85
|
+
var DISCOUNTS = [
|
|
86
|
+
{
|
|
87
|
+
value: "percent",
|
|
88
|
+
label: "Percentage"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
value: "fixed",
|
|
92
|
+
label: "Fixed amount"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
value: "delivery",
|
|
96
|
+
label: "Free delivery"
|
|
97
|
+
}
|
|
98
|
+
];
|
|
99
|
+
var SORTS = [
|
|
100
|
+
{
|
|
101
|
+
value: "newest",
|
|
102
|
+
label: "Newest first"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
value: "oldest",
|
|
106
|
+
label: "Oldest first"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
value: "total-high",
|
|
110
|
+
label: "Highest total"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
value: "total-low",
|
|
114
|
+
label: "Lowest total"
|
|
115
|
+
}
|
|
116
|
+
];
|
|
117
|
+
var COLLECTIONS = [
|
|
118
|
+
{
|
|
119
|
+
value: "chairs",
|
|
120
|
+
label: "Ergonomic office chairs with adjustable lumbar support"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
value: "desks",
|
|
124
|
+
label: "Height-adjustable standing desks"
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
value: "storage",
|
|
128
|
+
label: "Storage"
|
|
129
|
+
}
|
|
130
|
+
];
|
|
131
|
+
var slug = (name) => name.toLowerCase().replace(/[^a-z]+/g, "-");
|
|
132
|
+
var regions = (names) => names.map((name) => ({
|
|
133
|
+
value: slug(name),
|
|
134
|
+
label: name
|
|
135
|
+
}));
|
|
136
|
+
var COUNTRIES = [
|
|
137
|
+
{
|
|
138
|
+
label: "United Kingdom",
|
|
139
|
+
options: regions([
|
|
140
|
+
"England",
|
|
141
|
+
"Scotland",
|
|
142
|
+
"Wales",
|
|
143
|
+
"Northern Ireland",
|
|
144
|
+
"Isle of Man",
|
|
145
|
+
"Jersey",
|
|
146
|
+
"Guernsey"
|
|
147
|
+
])
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
label: "Europe",
|
|
151
|
+
options: regions([
|
|
152
|
+
"Austria",
|
|
153
|
+
"Belgium",
|
|
154
|
+
"Croatia",
|
|
155
|
+
"Cyprus",
|
|
156
|
+
"Czechia",
|
|
157
|
+
"Denmark",
|
|
158
|
+
"Estonia",
|
|
159
|
+
"Finland",
|
|
160
|
+
"France",
|
|
161
|
+
"Germany",
|
|
162
|
+
"Greece",
|
|
163
|
+
"Hungary",
|
|
164
|
+
"Iceland",
|
|
165
|
+
"Ireland",
|
|
166
|
+
"Italy",
|
|
167
|
+
"Latvia",
|
|
168
|
+
"Lithuania",
|
|
169
|
+
"Luxembourg",
|
|
170
|
+
"Malta",
|
|
171
|
+
"Netherlands",
|
|
172
|
+
"Norway",
|
|
173
|
+
"Poland",
|
|
174
|
+
"Portugal",
|
|
175
|
+
"Romania",
|
|
176
|
+
"Slovakia",
|
|
177
|
+
"Slovenia",
|
|
178
|
+
"Spain",
|
|
179
|
+
"Sweden",
|
|
180
|
+
"Switzerland"
|
|
181
|
+
])
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
label: "Rest of the world",
|
|
185
|
+
options: regions([
|
|
186
|
+
"Australia",
|
|
187
|
+
"Canada",
|
|
188
|
+
"Hong Kong",
|
|
189
|
+
"Japan",
|
|
190
|
+
"New Zealand",
|
|
191
|
+
"Singapore",
|
|
192
|
+
"United Arab Emirates",
|
|
193
|
+
"United States"
|
|
194
|
+
])
|
|
195
|
+
}
|
|
196
|
+
];
|
|
197
|
+
var CHECK = /* @__PURE__ */ jsx("svg", {
|
|
198
|
+
viewBox: "0 0 16 16",
|
|
199
|
+
children: /* @__PURE__ */ jsx("path", { d: "M3.6 8.4l2.9 2.9 5.9-6.6" })
|
|
200
|
+
});
|
|
201
|
+
function StillRow({ icon, description, hint, checked, highlighted, disabled, children }) {
|
|
202
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
203
|
+
className: "o-select__item",
|
|
204
|
+
"data-state": checked ? "checked" : "unchecked",
|
|
205
|
+
"data-highlighted": highlighted ? "" : void 0,
|
|
206
|
+
"data-disabled": disabled ? "" : void 0,
|
|
207
|
+
"data-icon": icon ? "" : void 0,
|
|
208
|
+
"data-description": description ? "" : void 0,
|
|
209
|
+
children: [
|
|
210
|
+
/* @__PURE__ */ jsxs("span", {
|
|
211
|
+
className: "o-select__body",
|
|
212
|
+
children: [/* @__PURE__ */ jsxs("span", { children: [icon ? /* @__PURE__ */ jsx("span", {
|
|
213
|
+
className: "o-select__icon",
|
|
214
|
+
children: icon
|
|
215
|
+
}) : null, /* @__PURE__ */ jsx("span", {
|
|
216
|
+
className: "o-select__label",
|
|
217
|
+
children
|
|
218
|
+
})] }), description ? /* @__PURE__ */ jsx("span", {
|
|
219
|
+
className: "o-select__description",
|
|
220
|
+
children: description
|
|
221
|
+
}) : null]
|
|
222
|
+
}),
|
|
223
|
+
hint ? /* @__PURE__ */ jsx("span", {
|
|
224
|
+
className: "o-select__hint",
|
|
225
|
+
children: hint
|
|
226
|
+
}) : null,
|
|
227
|
+
/* @__PURE__ */ jsx("span", {
|
|
228
|
+
className: "o-select__indicator",
|
|
229
|
+
children: CHECK
|
|
230
|
+
})
|
|
231
|
+
]
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
function StillScroll() {
|
|
235
|
+
return /* @__PURE__ */ jsx("div", {
|
|
236
|
+
className: "o-select__scroll",
|
|
237
|
+
"data-direction": "down",
|
|
238
|
+
children: /* @__PURE__ */ jsx("svg", {
|
|
239
|
+
viewBox: "0 0 16 16",
|
|
240
|
+
children: /* @__PURE__ */ jsx("path", { d: "M4.25 6.25 8 10l3.75-3.75" })
|
|
241
|
+
})
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
/** A trigger, open, with its list 6px below it. */
|
|
245
|
+
function SelectStill({ value, size = "md", width, gap, maxHeight, after, children }) {
|
|
246
|
+
const sheet = {
|
|
247
|
+
display: "flex",
|
|
248
|
+
flexDirection: "column",
|
|
249
|
+
"--o-select-w": `${width}px`,
|
|
250
|
+
"--o-select-min-w": `${width}px`,
|
|
251
|
+
...maxHeight ? { maxHeight } : null
|
|
252
|
+
};
|
|
253
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
254
|
+
className: "select-still",
|
|
255
|
+
style: gap !== void 0 ? { gap } : void 0,
|
|
256
|
+
children: [/* @__PURE__ */ jsxs("button", {
|
|
257
|
+
type: "button",
|
|
258
|
+
tabIndex: -1,
|
|
259
|
+
className: "o-select-trigger",
|
|
260
|
+
"data-size": size,
|
|
261
|
+
"data-state": "open",
|
|
262
|
+
style: { width },
|
|
263
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
264
|
+
className: "o-select-trigger__value",
|
|
265
|
+
children: /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx("span", {
|
|
266
|
+
className: "o-select__label",
|
|
267
|
+
children: value
|
|
268
|
+
}) })
|
|
269
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
270
|
+
className: "o-select-trigger__chevron",
|
|
271
|
+
children: /* @__PURE__ */ jsx("svg", {
|
|
272
|
+
viewBox: "0 0 16 16",
|
|
273
|
+
children: /* @__PURE__ */ jsx("path", { d: "M4.25 6.25 8 10l3.75-3.75" })
|
|
274
|
+
})
|
|
275
|
+
})]
|
|
276
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
277
|
+
className: "o-select",
|
|
278
|
+
"data-size": size,
|
|
279
|
+
style: sheet,
|
|
280
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
281
|
+
className: "o-select__viewport",
|
|
282
|
+
style: {
|
|
283
|
+
flex: 1,
|
|
284
|
+
minHeight: 0,
|
|
285
|
+
overflow: "hidden"
|
|
286
|
+
},
|
|
287
|
+
children
|
|
288
|
+
}), after]
|
|
289
|
+
})]
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
function Preview() {
|
|
293
|
+
return /* @__PURE__ */ jsxs(SelectStill, {
|
|
294
|
+
size: "sm",
|
|
295
|
+
width: 200,
|
|
296
|
+
gap: 4,
|
|
297
|
+
value: "Next working day",
|
|
298
|
+
children: [
|
|
299
|
+
/* @__PURE__ */ jsx(StillRow, { children: "Standard delivery" }),
|
|
300
|
+
/* @__PURE__ */ jsx(StillRow, {
|
|
301
|
+
checked: true,
|
|
302
|
+
highlighted: true,
|
|
303
|
+
children: "Next working day"
|
|
304
|
+
}),
|
|
305
|
+
/* @__PURE__ */ jsx(StillRow, { children: "Click and collect" })
|
|
306
|
+
]
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
var quote = (v) => String(v).replace(/"/g, """);
|
|
310
|
+
var PLAYGROUND_ROWS = {
|
|
311
|
+
plain: {
|
|
312
|
+
options: STATUSES,
|
|
313
|
+
name: "statuses"
|
|
314
|
+
},
|
|
315
|
+
icons: {
|
|
316
|
+
options: LOCATIONS,
|
|
317
|
+
name: "locations"
|
|
318
|
+
},
|
|
319
|
+
descriptions: {
|
|
320
|
+
options: RATES,
|
|
321
|
+
name: "rates"
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
var PLAYGROUND = [
|
|
325
|
+
{
|
|
326
|
+
prop: "aria-label",
|
|
327
|
+
type: "text",
|
|
328
|
+
default: "Delivery rate",
|
|
329
|
+
toAttr: (v) => `aria-label="${quote(v)}"`
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
prop: "placeholder",
|
|
333
|
+
type: "text",
|
|
334
|
+
default: "Choose an option",
|
|
335
|
+
toAttr: (v) => v ? `placeholder="${quote(v)}"` : null
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
prop: "options",
|
|
339
|
+
type: "select",
|
|
340
|
+
options: [
|
|
341
|
+
"plain",
|
|
342
|
+
"icons",
|
|
343
|
+
"descriptions"
|
|
344
|
+
],
|
|
345
|
+
default: "descriptions",
|
|
346
|
+
toAttr: (v) => `options={${PLAYGROUND_ROWS[v].name}}`
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
prop: "size",
|
|
350
|
+
type: "select",
|
|
351
|
+
options: [
|
|
352
|
+
"sm",
|
|
353
|
+
"md",
|
|
354
|
+
"lg"
|
|
355
|
+
],
|
|
356
|
+
default: "md"
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
prop: "invalid",
|
|
360
|
+
type: "boolean",
|
|
361
|
+
default: false
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
prop: "disabled",
|
|
365
|
+
type: "boolean",
|
|
366
|
+
default: false
|
|
367
|
+
}
|
|
368
|
+
];
|
|
369
|
+
function StatusField() {
|
|
370
|
+
const [status, setStatus] = useState("");
|
|
371
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
372
|
+
className: "select-stack",
|
|
373
|
+
children: [/* @__PURE__ */ jsx(Field, {
|
|
374
|
+
label: "Fulfilment status",
|
|
375
|
+
hint: "Only orders in this state are listed.",
|
|
376
|
+
children: /* @__PURE__ */ jsx(Select, {
|
|
377
|
+
value: status,
|
|
378
|
+
onValueChange: setStatus,
|
|
379
|
+
placeholder: "Any status",
|
|
380
|
+
options: STATUSES
|
|
381
|
+
})
|
|
382
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
383
|
+
className: "select-status",
|
|
384
|
+
role: "status",
|
|
385
|
+
children: status ? `Showing ${STATUSES.find((s) => s.value === status)?.label.toLowerCase()} orders` : "Showing all orders"
|
|
386
|
+
})]
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
function TransferDialog() {
|
|
390
|
+
const [open, setOpen] = useState(false);
|
|
391
|
+
const [from, setFrom] = useState("leeds");
|
|
392
|
+
const [to, setTo] = useState("");
|
|
393
|
+
const [error, setError] = useState();
|
|
394
|
+
const submit = (event) => {
|
|
395
|
+
event.preventDefault();
|
|
396
|
+
if (!to) return setError("Choose where the stock is going");
|
|
397
|
+
if (to === from) return setError("Choose a different location from the one it leaves");
|
|
398
|
+
setOpen(false);
|
|
399
|
+
setTo("");
|
|
400
|
+
};
|
|
401
|
+
return /* @__PURE__ */ jsxs(Dialog, {
|
|
402
|
+
open,
|
|
403
|
+
onOpenChange: (next) => {
|
|
404
|
+
setOpen(next);
|
|
405
|
+
if (!next) setError(void 0);
|
|
406
|
+
},
|
|
407
|
+
children: [/* @__PURE__ */ jsx(DialogTrigger, {
|
|
408
|
+
asChild: true,
|
|
409
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
410
|
+
icon: /* @__PURE__ */ jsx(ArrowsLeftRightIcon, {}),
|
|
411
|
+
children: "Transfer stock"
|
|
412
|
+
})
|
|
413
|
+
}), /* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsxs("form", {
|
|
414
|
+
onSubmit: submit,
|
|
415
|
+
noValidate: true,
|
|
416
|
+
style: { display: "contents" },
|
|
417
|
+
children: [
|
|
418
|
+
/* @__PURE__ */ jsxs(DialogHeader, { children: [/* @__PURE__ */ jsx(DialogTitle, { children: "Transfer stock" }), /* @__PURE__ */ jsx(DialogDescription, { children: "Move units of the Arden ergonomic chair between locations. Both counts update when it arrives." })] }),
|
|
419
|
+
/* @__PURE__ */ jsxs(DialogBody, {
|
|
420
|
+
className: "select-dialog-fields",
|
|
421
|
+
children: [
|
|
422
|
+
/* @__PURE__ */ jsx(Field, {
|
|
423
|
+
label: "From",
|
|
424
|
+
children: /* @__PURE__ */ jsx(Select, {
|
|
425
|
+
value: from,
|
|
426
|
+
onValueChange: setFrom,
|
|
427
|
+
options: LOCATIONS
|
|
428
|
+
})
|
|
429
|
+
}),
|
|
430
|
+
/* @__PURE__ */ jsx(Field, {
|
|
431
|
+
label: "To",
|
|
432
|
+
error,
|
|
433
|
+
children: /* @__PURE__ */ jsx(Select, {
|
|
434
|
+
value: to,
|
|
435
|
+
onValueChange: (next) => {
|
|
436
|
+
setTo(next);
|
|
437
|
+
setError(void 0);
|
|
438
|
+
},
|
|
439
|
+
placeholder: "Choose a location",
|
|
440
|
+
options: LOCATIONS
|
|
441
|
+
})
|
|
442
|
+
}),
|
|
443
|
+
/* @__PURE__ */ jsx(Field, {
|
|
444
|
+
label: "Units",
|
|
445
|
+
hint: `Up to ${STOCK[from] ?? 0} from ${LOCATIONS.find((l) => l.value === from)?.label}`,
|
|
446
|
+
children: /* @__PURE__ */ jsx(Input, {
|
|
447
|
+
inputMode: "numeric",
|
|
448
|
+
defaultValue: "6"
|
|
449
|
+
})
|
|
450
|
+
})
|
|
451
|
+
]
|
|
452
|
+
}),
|
|
453
|
+
/* @__PURE__ */ jsxs(DialogFooter, { children: [/* @__PURE__ */ jsx(DialogClose, {
|
|
454
|
+
asChild: true,
|
|
455
|
+
children: /* @__PURE__ */ jsx(Button, { children: "Cancel" })
|
|
456
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
457
|
+
type: "submit",
|
|
458
|
+
variant: "primary",
|
|
459
|
+
children: "Transfer"
|
|
460
|
+
})] })
|
|
461
|
+
]
|
|
462
|
+
}) })]
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
function AssignOrder() {
|
|
466
|
+
return /* @__PURE__ */ jsxs(Select, {
|
|
467
|
+
defaultValue: "priya",
|
|
468
|
+
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
469
|
+
"aria-label": "Assign order #1043 to",
|
|
470
|
+
className: "select-assign",
|
|
471
|
+
children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Unassigned" })
|
|
472
|
+
}), /* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
473
|
+
/* @__PURE__ */ jsxs(SelectGroup, { children: [/* @__PURE__ */ jsx(SelectLabel, { children: "Owner" }), /* @__PURE__ */ jsx(SelectItem, {
|
|
474
|
+
value: "priya",
|
|
475
|
+
description: "priya@harbourdesk.co.uk",
|
|
476
|
+
children: "Priya Shah"
|
|
477
|
+
})] }),
|
|
478
|
+
/* @__PURE__ */ jsx(SelectSeparator, {}),
|
|
479
|
+
/* @__PURE__ */ jsxs(SelectGroup, { children: [
|
|
480
|
+
/* @__PURE__ */ jsx(SelectLabel, { children: "Staff" }),
|
|
481
|
+
/* @__PURE__ */ jsx(SelectItem, {
|
|
482
|
+
value: "tom",
|
|
483
|
+
description: "Orders and fulfilment",
|
|
484
|
+
children: "Tom Hughes"
|
|
485
|
+
}),
|
|
486
|
+
/* @__PURE__ */ jsx(SelectItem, {
|
|
487
|
+
value: "amara",
|
|
488
|
+
description: "Orders and fulfilment",
|
|
489
|
+
children: "Amara Okafor"
|
|
490
|
+
}),
|
|
491
|
+
/* @__PURE__ */ jsx(SelectItem, {
|
|
492
|
+
value: "jack",
|
|
493
|
+
description: "View only, so orders cannot be assigned to him",
|
|
494
|
+
disabled: true,
|
|
495
|
+
children: "Jack Reid"
|
|
496
|
+
})
|
|
497
|
+
] }),
|
|
498
|
+
/* @__PURE__ */ jsx(SelectSeparator, {}),
|
|
499
|
+
/* @__PURE__ */ jsx(SelectItem, {
|
|
500
|
+
value: "nobody",
|
|
501
|
+
children: "Nobody"
|
|
502
|
+
})
|
|
503
|
+
] })]
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
function CountryField() {
|
|
507
|
+
const [country, setCountry] = useState("");
|
|
508
|
+
return /* @__PURE__ */ jsx("div", {
|
|
509
|
+
className: "select-stack",
|
|
510
|
+
children: /* @__PURE__ */ jsx(Field, {
|
|
511
|
+
label: "Country or region",
|
|
512
|
+
hint: "Type the first letters of a name to jump to it.",
|
|
513
|
+
children: /* @__PURE__ */ jsx(Select, {
|
|
514
|
+
value: country,
|
|
515
|
+
onValueChange: setCountry,
|
|
516
|
+
placeholder: "Choose a country or region",
|
|
517
|
+
options: COUNTRIES
|
|
518
|
+
})
|
|
519
|
+
})
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
function HeldOpen() {
|
|
523
|
+
return /* @__PURE__ */ jsxs(SpecimenFrame, {
|
|
524
|
+
className: "select-stills",
|
|
525
|
+
children: [/* @__PURE__ */ jsxs(SelectStill, {
|
|
526
|
+
width: 280,
|
|
527
|
+
value: "Next working day",
|
|
528
|
+
children: [
|
|
529
|
+
/* @__PURE__ */ jsx(StillRow, {
|
|
530
|
+
description: "2 to 4 working days",
|
|
531
|
+
hint: "£3.95",
|
|
532
|
+
children: "Standard delivery"
|
|
533
|
+
}),
|
|
534
|
+
/* @__PURE__ */ jsx(StillRow, {
|
|
535
|
+
description: "Order by 2pm",
|
|
536
|
+
hint: "£6.95",
|
|
537
|
+
checked: true,
|
|
538
|
+
highlighted: true,
|
|
539
|
+
children: "Next working day"
|
|
540
|
+
}),
|
|
541
|
+
/* @__PURE__ */ jsx(StillRow, {
|
|
542
|
+
description: "Order by 2pm on Friday",
|
|
543
|
+
hint: "£9.95",
|
|
544
|
+
children: "Saturday delivery"
|
|
545
|
+
}),
|
|
546
|
+
/* @__PURE__ */ jsx(StillRow, {
|
|
547
|
+
description: "Ready in 2 hours at our Leeds shop",
|
|
548
|
+
hint: "Free",
|
|
549
|
+
children: "Click and collect"
|
|
550
|
+
})
|
|
551
|
+
]
|
|
552
|
+
}), /* @__PURE__ */ jsxs(SelectStill, {
|
|
553
|
+
width: 240,
|
|
554
|
+
value: "Scotland",
|
|
555
|
+
maxHeight: 268,
|
|
556
|
+
after: /* @__PURE__ */ jsx(StillScroll, {}),
|
|
557
|
+
children: [
|
|
558
|
+
/* @__PURE__ */ jsx("div", {
|
|
559
|
+
className: "o-select__heading",
|
|
560
|
+
children: "United Kingdom"
|
|
561
|
+
}),
|
|
562
|
+
/* @__PURE__ */ jsx(StillRow, { children: "England" }),
|
|
563
|
+
/* @__PURE__ */ jsx(StillRow, {
|
|
564
|
+
checked: true,
|
|
565
|
+
children: "Scotland"
|
|
566
|
+
}),
|
|
567
|
+
/* @__PURE__ */ jsx(StillRow, {
|
|
568
|
+
highlighted: true,
|
|
569
|
+
children: "Wales"
|
|
570
|
+
}),
|
|
571
|
+
/* @__PURE__ */ jsx(StillRow, { children: "Northern Ireland" }),
|
|
572
|
+
/* @__PURE__ */ jsx(StillRow, { children: "Isle of Man" }),
|
|
573
|
+
/* @__PURE__ */ jsx("div", { className: "o-select__separator" }),
|
|
574
|
+
/* @__PURE__ */ jsx("div", {
|
|
575
|
+
className: "o-select__heading",
|
|
576
|
+
children: "Europe"
|
|
577
|
+
}),
|
|
578
|
+
/* @__PURE__ */ jsx(StillRow, { children: "Austria" })
|
|
579
|
+
]
|
|
580
|
+
})]
|
|
581
|
+
});
|
|
582
|
+
}
|
|
583
|
+
function Page() {
|
|
584
|
+
return /* @__PURE__ */ jsxs(DocPage, {
|
|
585
|
+
title: "Select",
|
|
586
|
+
status: "new",
|
|
587
|
+
importNames: [
|
|
588
|
+
"Select",
|
|
589
|
+
"SelectTrigger",
|
|
590
|
+
"SelectContent",
|
|
591
|
+
"SelectItem"
|
|
592
|
+
],
|
|
593
|
+
lead: "Choose one value from a list that is too long, or too likely to grow, to show all at once: a country, a stock location, a delivery rate. The trigger is an Input frame; the list is the Menu's sheet, growing out of the trigger.",
|
|
594
|
+
children: [
|
|
595
|
+
/* @__PURE__ */ jsx(Section, {
|
|
596
|
+
id: "playground",
|
|
597
|
+
title: "Playground",
|
|
598
|
+
description: /* @__PURE__ */ jsx("p", { children: "Change the props, then open the list: try the arrow keys, Enter, and typing the first letters of a row." }),
|
|
599
|
+
children: /* @__PURE__ */ jsx(Playground, {
|
|
600
|
+
component: "Select",
|
|
601
|
+
controls: PLAYGROUND,
|
|
602
|
+
minHeight: 260,
|
|
603
|
+
render: (v) => /* @__PURE__ */ jsx("div", {
|
|
604
|
+
className: "select-stage",
|
|
605
|
+
children: /* @__PURE__ */ jsx(Select, {
|
|
606
|
+
"aria-label": String(v["aria-label"]),
|
|
607
|
+
placeholder: String(v.placeholder) || void 0,
|
|
608
|
+
options: PLAYGROUND_ROWS[v.options].options,
|
|
609
|
+
size: v.size,
|
|
610
|
+
invalid: Boolean(v.invalid),
|
|
611
|
+
disabled: Boolean(v.disabled)
|
|
612
|
+
}, String(v.options))
|
|
613
|
+
})
|
|
614
|
+
})
|
|
615
|
+
}),
|
|
616
|
+
/* @__PURE__ */ jsx(Section, {
|
|
617
|
+
id: "basics",
|
|
618
|
+
title: "Basics",
|
|
619
|
+
description: /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsxs("p", { children: [
|
|
620
|
+
"The common case needs one tag: pass ",
|
|
621
|
+
/* @__PURE__ */ jsx("code", { children: "options" }),
|
|
622
|
+
" and Select renders the trigger and the list. Put it in a ",
|
|
623
|
+
/* @__PURE__ */ jsx("code", { children: "Field" }),
|
|
624
|
+
" for a label and a hint, and control it with ",
|
|
625
|
+
/* @__PURE__ */ jsx("code", { children: "value" }),
|
|
626
|
+
" and",
|
|
627
|
+
" ",
|
|
628
|
+
/* @__PURE__ */ jsx("code", { children: "onValueChange" }),
|
|
629
|
+
". The ",
|
|
630
|
+
/* @__PURE__ */ jsx("code", { children: "placeholder" }),
|
|
631
|
+
" shows while nothing is chosen; set",
|
|
632
|
+
" ",
|
|
633
|
+
/* @__PURE__ */ jsx("code", { children: "value=\"\"" }),
|
|
634
|
+
" to bring it back."
|
|
635
|
+
] }) }),
|
|
636
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
637
|
+
code: `
|
|
638
|
+
const statuses = [
|
|
639
|
+
{ value: 'unfulfilled', label: 'Unfulfilled' },
|
|
640
|
+
{ value: 'partial', label: 'Partially fulfilled' },
|
|
641
|
+
{ value: 'fulfilled', label: 'Fulfilled' },
|
|
642
|
+
{ value: 'returned', label: 'Returned' },
|
|
643
|
+
{ value: 'cancelled', label: 'Cancelled' },
|
|
644
|
+
]
|
|
645
|
+
|
|
646
|
+
const [status, setStatus] = useState('')
|
|
647
|
+
|
|
648
|
+
<Field label="Fulfilment status" hint="Only orders in this state are listed.">
|
|
649
|
+
<Select value={status} onValueChange={setStatus} placeholder="Any status" options={statuses} />
|
|
650
|
+
</Field>`,
|
|
651
|
+
children: /* @__PURE__ */ jsx(StatusField, {})
|
|
652
|
+
})
|
|
653
|
+
}),
|
|
654
|
+
/* @__PURE__ */ jsx(Section, {
|
|
655
|
+
id: "sizes",
|
|
656
|
+
title: "Sizes",
|
|
657
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
658
|
+
/* @__PURE__ */ jsx("code", { children: "sm" }),
|
|
659
|
+
" 30px, ",
|
|
660
|
+
/* @__PURE__ */ jsx("code", { children: "md" }),
|
|
661
|
+
" 36px (default) and ",
|
|
662
|
+
/* @__PURE__ */ jsx("code", { children: "lg" }),
|
|
663
|
+
" 44px: the Input and Button heights, so a select shares a line with both. The rows in the list follow the size (30, 34 and 40px)."
|
|
664
|
+
] }),
|
|
665
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
666
|
+
code: `
|
|
667
|
+
<Input size="sm" aria-label="Discount code" placeholder="Discount code" />
|
|
668
|
+
<Select size="sm" aria-label="Discount type" defaultValue="percent" options={discountTypes} />
|
|
669
|
+
<Button size="sm">Apply</Button>
|
|
670
|
+
|
|
671
|
+
<Input aria-label="Discount code" placeholder="Discount code" />
|
|
672
|
+
<Select aria-label="Discount type" defaultValue="percent" options={discountTypes} />
|
|
673
|
+
<Button>Apply</Button>
|
|
674
|
+
|
|
675
|
+
<Input size="lg" aria-label="Discount code" placeholder="Discount code" />
|
|
676
|
+
<Select size="lg" aria-label="Discount type" defaultValue="percent" options={discountTypes} />
|
|
677
|
+
<Button size="lg">Apply</Button>`,
|
|
678
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
679
|
+
className: "select-sizes",
|
|
680
|
+
children: [
|
|
681
|
+
"sm",
|
|
682
|
+
"md",
|
|
683
|
+
"lg"
|
|
684
|
+
].map((size) => /* @__PURE__ */ jsxs("div", {
|
|
685
|
+
className: "select-sizes__row",
|
|
686
|
+
children: [
|
|
687
|
+
/* @__PURE__ */ jsx(Input, {
|
|
688
|
+
size,
|
|
689
|
+
"aria-label": "Discount code",
|
|
690
|
+
placeholder: "Discount code"
|
|
691
|
+
}),
|
|
692
|
+
/* @__PURE__ */ jsx(Select, {
|
|
693
|
+
size,
|
|
694
|
+
"aria-label": "Discount type",
|
|
695
|
+
defaultValue: "percent",
|
|
696
|
+
options: DISCOUNTS
|
|
697
|
+
}),
|
|
698
|
+
/* @__PURE__ */ jsx(Button, {
|
|
699
|
+
size,
|
|
700
|
+
children: "Apply"
|
|
701
|
+
})
|
|
702
|
+
]
|
|
703
|
+
}, size))
|
|
704
|
+
})
|
|
705
|
+
})
|
|
706
|
+
}),
|
|
707
|
+
/* @__PURE__ */ jsxs(Section, {
|
|
708
|
+
id: "rows",
|
|
709
|
+
title: "Rows",
|
|
710
|
+
description: /* @__PURE__ */ jsxs("p", { children: [
|
|
711
|
+
"A row can carry an ",
|
|
712
|
+
/* @__PURE__ */ jsx("code", { children: "icon" }),
|
|
713
|
+
", a quieter ",
|
|
714
|
+
/* @__PURE__ */ jsx("code", { children: "description" }),
|
|
715
|
+
" under its label and a",
|
|
716
|
+
" ",
|
|
717
|
+
/* @__PURE__ */ jsx("code", { children: "hint" }),
|
|
718
|
+
" at the end, such as a price or a stock count. Only the icon and label come up into the trigger once a row is chosen. A ",
|
|
719
|
+
/* @__PURE__ */ jsx("code", { children: "disabled" }),
|
|
720
|
+
" row dims and the arrow keys skip it: say why in its hint."
|
|
721
|
+
] }),
|
|
722
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
723
|
+
align: "fill",
|
|
724
|
+
minHeight: 240,
|
|
725
|
+
code: `
|
|
726
|
+
const rates = [
|
|
727
|
+
{ value: 'standard', label: 'Standard delivery', description: '2 to 4 working days', hint: '£3.95' },
|
|
728
|
+
{ value: 'next-day', label: 'Next working day', description: 'Order by 2pm', hint: '£6.95' },
|
|
729
|
+
{ value: 'saturday', label: 'Saturday delivery', description: 'Order by 2pm on Friday', hint: '£9.95' },
|
|
730
|
+
{ value: 'collect', label: 'Click and collect', description: 'Ready in 2 hours at our Leeds shop', hint: 'Free' },
|
|
731
|
+
]
|
|
732
|
+
|
|
733
|
+
const locations = [
|
|
734
|
+
{ value: 'leeds', label: 'Leeds warehouse', icon: <WarehouseIcon />, hint: '42 in stock' },
|
|
735
|
+
{ value: 'manchester', label: 'Manchester shop', icon: <StorefrontIcon />, hint: '6 in stock' },
|
|
736
|
+
{ value: 'york', label: 'York shop', icon: <StorefrontIcon />, hint: 'None in stock', disabled: true },
|
|
737
|
+
]
|
|
738
|
+
|
|
739
|
+
<Field label="Delivery rate">
|
|
740
|
+
<Select defaultValue="next-day" options={rates} />
|
|
741
|
+
</Field>
|
|
742
|
+
<Field label="Fulfil from">
|
|
743
|
+
<Select defaultValue="leeds" options={locations} />
|
|
744
|
+
</Field>`,
|
|
745
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
746
|
+
className: "select-grid",
|
|
747
|
+
children: [/* @__PURE__ */ jsx(Field, {
|
|
748
|
+
label: "Delivery rate",
|
|
749
|
+
children: /* @__PURE__ */ jsx(Select, {
|
|
750
|
+
defaultValue: "next-day",
|
|
751
|
+
options: RATES
|
|
752
|
+
})
|
|
753
|
+
}), /* @__PURE__ */ jsx(Field, {
|
|
754
|
+
label: "Fulfil from",
|
|
755
|
+
children: /* @__PURE__ */ jsx(Select, {
|
|
756
|
+
defaultValue: "leeds",
|
|
757
|
+
options: LOCATIONS
|
|
758
|
+
})
|
|
759
|
+
})]
|
|
760
|
+
})
|
|
761
|
+
}), /* @__PURE__ */ jsx(DocTable, {
|
|
762
|
+
columns: [
|
|
763
|
+
"Part",
|
|
764
|
+
"In the list",
|
|
765
|
+
"In the trigger"
|
|
766
|
+
],
|
|
767
|
+
rows: [
|
|
768
|
+
[
|
|
769
|
+
"label",
|
|
770
|
+
"14px at 450, one line, cut short with an ellipsis",
|
|
771
|
+
"Yes"
|
|
772
|
+
],
|
|
773
|
+
[
|
|
774
|
+
"icon",
|
|
775
|
+
"16px in slate, firming to ink on the highlighted row",
|
|
776
|
+
"Yes"
|
|
777
|
+
],
|
|
778
|
+
[
|
|
779
|
+
"description",
|
|
780
|
+
"13px in quiet slate, wrapping under the label",
|
|
781
|
+
"No"
|
|
782
|
+
],
|
|
783
|
+
[
|
|
784
|
+
"hint",
|
|
785
|
+
"13px in quiet slate, at the end of the row",
|
|
786
|
+
"No"
|
|
787
|
+
],
|
|
788
|
+
[
|
|
789
|
+
"Check",
|
|
790
|
+
"Teal, on the chosen row only",
|
|
791
|
+
"No"
|
|
792
|
+
]
|
|
793
|
+
]
|
|
794
|
+
})]
|
|
795
|
+
}),
|
|
796
|
+
/* @__PURE__ */ jsx(Section, {
|
|
797
|
+
id: "groups",
|
|
798
|
+
title: "Groups and separators",
|
|
799
|
+
description: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("p", { children: [
|
|
800
|
+
"For headings and hairlines, compose the parts: a ",
|
|
801
|
+
/* @__PURE__ */ jsx("code", { children: "SelectTrigger" }),
|
|
802
|
+
", then a",
|
|
803
|
+
" ",
|
|
804
|
+
/* @__PURE__ */ jsx("code", { children: "SelectContent" }),
|
|
805
|
+
" holding ",
|
|
806
|
+
/* @__PURE__ */ jsx("code", { children: "SelectItem" }),
|
|
807
|
+
"s, with ",
|
|
808
|
+
/* @__PURE__ */ jsx("code", { children: "SelectGroup" }),
|
|
809
|
+
",",
|
|
810
|
+
" ",
|
|
811
|
+
/* @__PURE__ */ jsx("code", { children: "SelectLabel" }),
|
|
812
|
+
" and ",
|
|
813
|
+
/* @__PURE__ */ jsx("code", { children: "SelectSeparator" }),
|
|
814
|
+
" between them. Composed by hand, the trigger takes the same props as Select does in the simple form."
|
|
815
|
+
] }), /* @__PURE__ */ jsxs("p", { children: [
|
|
816
|
+
"With ",
|
|
817
|
+
/* @__PURE__ */ jsx("code", { children: "options" }),
|
|
818
|
+
", a group is an entry with a ",
|
|
819
|
+
/* @__PURE__ */ jsx("code", { children: "label" }),
|
|
820
|
+
" and its own ",
|
|
821
|
+
/* @__PURE__ */ jsx("code", { children: "options" }),
|
|
822
|
+
", and hairlines are drawn between groups for you."
|
|
823
|
+
] })] }),
|
|
824
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
825
|
+
minHeight: 320,
|
|
826
|
+
code: `
|
|
827
|
+
<Select defaultValue="priya">
|
|
828
|
+
<SelectTrigger aria-label="Assign order #1043 to">
|
|
829
|
+
<SelectValue placeholder="Unassigned" />
|
|
830
|
+
</SelectTrigger>
|
|
831
|
+
<SelectContent>
|
|
832
|
+
<SelectGroup>
|
|
833
|
+
<SelectLabel>Owner</SelectLabel>
|
|
834
|
+
<SelectItem value="priya" description="priya@harbourdesk.co.uk">Priya Shah</SelectItem>
|
|
835
|
+
</SelectGroup>
|
|
836
|
+
<SelectSeparator />
|
|
837
|
+
<SelectGroup>
|
|
838
|
+
<SelectLabel>Staff</SelectLabel>
|
|
839
|
+
<SelectItem value="tom" description="Orders and fulfilment">Tom Hughes</SelectItem>
|
|
840
|
+
<SelectItem value="amara" description="Orders and fulfilment">Amara Okafor</SelectItem>
|
|
841
|
+
<SelectItem value="jack" description="View only, so orders cannot be assigned to him" disabled>
|
|
842
|
+
Jack Reid
|
|
843
|
+
</SelectItem>
|
|
844
|
+
</SelectGroup>
|
|
845
|
+
<SelectSeparator />
|
|
846
|
+
<SelectItem value="nobody">Nobody</SelectItem>
|
|
847
|
+
</SelectContent>
|
|
848
|
+
</Select>
|
|
849
|
+
|
|
850
|
+
// The same shape with options: groups are { label, options }
|
|
851
|
+
<Select options={[{ label: 'Owner', options: owners }, { label: 'Staff', options: staff }]} />`,
|
|
852
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
853
|
+
className: "overlays-top",
|
|
854
|
+
children: /* @__PURE__ */ jsx(AssignOrder, {})
|
|
855
|
+
})
|
|
856
|
+
})
|
|
857
|
+
}),
|
|
858
|
+
/* @__PURE__ */ jsxs(Section, {
|
|
859
|
+
id: "long-lists",
|
|
860
|
+
title: "Long lists",
|
|
861
|
+
description: /* @__PURE__ */ jsx("p", { children: "The list stops at 320px, or where the window runs out, and scrolls. Soft arrows at either end show there is more, and resting the pointer on one scrolls the list. With the list closed or open, typing the first letters of a row jumps to it: try \"sw\" for Sweden." }),
|
|
862
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
863
|
+
code: `
|
|
864
|
+
const countries = [
|
|
865
|
+
{ label: 'United Kingdom', options: [{ value: 'england', label: 'England' }, ...] },
|
|
866
|
+
{ label: 'Europe', options: [{ value: 'austria', label: 'Austria' }, ...] },
|
|
867
|
+
{ label: 'Rest of the world', options: [{ value: 'australia', label: 'Australia' }, ...] },
|
|
868
|
+
]
|
|
869
|
+
|
|
870
|
+
<Field label="Country or region" hint="Type the first letters of a name to jump to it.">
|
|
871
|
+
<Select value={country} onValueChange={setCountry} placeholder="Choose a country or region" options={countries} />
|
|
872
|
+
</Field>`,
|
|
873
|
+
children: /* @__PURE__ */ jsx(CountryField, {})
|
|
874
|
+
}), /* @__PURE__ */ jsxs(Note, {
|
|
875
|
+
title: "Hundreds of rows?",
|
|
876
|
+
children: [
|
|
877
|
+
"Past a hundred or so rows, a list to scroll stops being quick. Search instead: a",
|
|
878
|
+
" ",
|
|
879
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
880
|
+
to: "/components/search-field",
|
|
881
|
+
children: "Search field"
|
|
882
|
+
}),
|
|
883
|
+
" over a list, or the",
|
|
884
|
+
" ",
|
|
885
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
886
|
+
to: "/components/command-palette",
|
|
887
|
+
children: "Command palette"
|
|
888
|
+
}),
|
|
889
|
+
"."
|
|
890
|
+
]
|
|
891
|
+
})]
|
|
892
|
+
}),
|
|
893
|
+
/* @__PURE__ */ jsxs(Section, {
|
|
894
|
+
id: "states",
|
|
895
|
+
title: "States",
|
|
896
|
+
description: /* @__PURE__ */ jsx("p", { children: "The trigger is an Input in every state. Hover firms the hairline; keyboard focus, and the whole time the list is open, turn it teal with the soft halo. An error in the Field swaps the teal for red. Disabled sinks into the well. A long value is cut short with an ellipsis rather than pushing the chevron out." }),
|
|
897
|
+
children: [/* @__PURE__ */ jsx(Example, {
|
|
898
|
+
align: "fill",
|
|
899
|
+
code: `
|
|
900
|
+
<Field label="Fulfilment status">
|
|
901
|
+
<Select placeholder="Any status" options={statuses} />
|
|
902
|
+
</Field>
|
|
903
|
+
<Field label="Fulfilment status">
|
|
904
|
+
<Select defaultValue="unfulfilled" options={statuses} />
|
|
905
|
+
</Field>
|
|
906
|
+
<Field label="Delivery rate" error="Choose a delivery rate for this zone">
|
|
907
|
+
<Select placeholder="Choose a rate" options={rates} />
|
|
908
|
+
</Field>
|
|
909
|
+
<Field label="Fulfil from" hint="Set by the order's sales channel">
|
|
910
|
+
<Select disabled defaultValue="leeds" options={locations} />
|
|
911
|
+
</Field>
|
|
912
|
+
<Field label="Collection">
|
|
913
|
+
<Select defaultValue="chairs" options={collections} />
|
|
914
|
+
</Field>`,
|
|
915
|
+
caption: "Empty, chosen, invalid, disabled and a long value.",
|
|
916
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
917
|
+
className: "select-grid",
|
|
918
|
+
children: [
|
|
919
|
+
/* @__PURE__ */ jsx(Field, {
|
|
920
|
+
label: "Fulfilment status",
|
|
921
|
+
children: /* @__PURE__ */ jsx(Select, {
|
|
922
|
+
placeholder: "Any status",
|
|
923
|
+
options: STATUSES
|
|
924
|
+
})
|
|
925
|
+
}),
|
|
926
|
+
/* @__PURE__ */ jsx(Field, {
|
|
927
|
+
label: "Fulfilment status",
|
|
928
|
+
children: /* @__PURE__ */ jsx(Select, {
|
|
929
|
+
defaultValue: "unfulfilled",
|
|
930
|
+
options: STATUSES
|
|
931
|
+
})
|
|
932
|
+
}),
|
|
933
|
+
/* @__PURE__ */ jsx(Field, {
|
|
934
|
+
label: "Delivery rate",
|
|
935
|
+
error: "Choose a delivery rate for this zone",
|
|
936
|
+
children: /* @__PURE__ */ jsx(Select, {
|
|
937
|
+
placeholder: "Choose a rate",
|
|
938
|
+
options: RATES
|
|
939
|
+
})
|
|
940
|
+
}),
|
|
941
|
+
/* @__PURE__ */ jsx(Field, {
|
|
942
|
+
label: "Fulfil from",
|
|
943
|
+
hint: "Set by the order's sales channel",
|
|
944
|
+
children: /* @__PURE__ */ jsx(Select, {
|
|
945
|
+
disabled: true,
|
|
946
|
+
defaultValue: "leeds",
|
|
947
|
+
options: LOCATIONS
|
|
948
|
+
})
|
|
949
|
+
}),
|
|
950
|
+
/* @__PURE__ */ jsx(Field, {
|
|
951
|
+
label: "Collection",
|
|
952
|
+
children: /* @__PURE__ */ jsx(Select, {
|
|
953
|
+
defaultValue: "chairs",
|
|
954
|
+
options: COLLECTIONS
|
|
955
|
+
})
|
|
956
|
+
})
|
|
957
|
+
]
|
|
958
|
+
})
|
|
959
|
+
}), /* @__PURE__ */ jsx(SubSection, {
|
|
960
|
+
title: "A leading icon",
|
|
961
|
+
description: /* @__PURE__ */ jsxs("p", { children: [/* @__PURE__ */ jsx("code", { children: "icon" }), " on the select puts a fixed icon at the start of the trigger, muted until it has focus, as on an Input. Leave it out when the rows have icons of their own: the chosen row's icon shows there instead."] }),
|
|
962
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
963
|
+
code: `<Select icon={<ArrowsDownUpIcon />} aria-label="Sort orders" defaultValue="newest" options={sorts} />`,
|
|
964
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
965
|
+
className: "select-stage",
|
|
966
|
+
children: /* @__PURE__ */ jsx(Select, {
|
|
967
|
+
icon: /* @__PURE__ */ jsx(ArrowsDownUpIcon, {}),
|
|
968
|
+
"aria-label": "Sort orders",
|
|
969
|
+
defaultValue: "newest",
|
|
970
|
+
options: SORTS
|
|
971
|
+
})
|
|
972
|
+
})
|
|
973
|
+
})
|
|
974
|
+
})]
|
|
975
|
+
}),
|
|
976
|
+
/* @__PURE__ */ jsx(Section, {
|
|
977
|
+
id: "in-a-dialog",
|
|
978
|
+
title: "In a dialog",
|
|
979
|
+
description: /* @__PURE__ */ jsx("p", { children: "The list is portalled and sits above dialogs and sheets, so it opens over the dialog's edge rather than being cut off by it, and Escape closes the list before the dialog. Press Transfer without choosing where the stock is going to see the error." }),
|
|
980
|
+
children: /* @__PURE__ */ jsx(Example, {
|
|
981
|
+
code: `
|
|
982
|
+
<Dialog open={open} onOpenChange={setOpen}>
|
|
983
|
+
<DialogTrigger asChild>
|
|
984
|
+
<Button icon={<ArrowsLeftRightIcon />}>Transfer stock</Button>
|
|
985
|
+
</DialogTrigger>
|
|
986
|
+
<DialogContent>
|
|
987
|
+
<form onSubmit={submit} noValidate style={{ display: 'contents' }}>
|
|
988
|
+
<DialogHeader>
|
|
989
|
+
<DialogTitle>Transfer stock</DialogTitle>
|
|
990
|
+
<DialogDescription>Move units of the Arden ergonomic chair between locations.</DialogDescription>
|
|
991
|
+
</DialogHeader>
|
|
992
|
+
<DialogBody>
|
|
993
|
+
<Field label="From">
|
|
994
|
+
<Select value={from} onValueChange={setFrom} options={locations} />
|
|
995
|
+
</Field>
|
|
996
|
+
<Field label="To" error={error}>
|
|
997
|
+
<Select value={to} onValueChange={setTo} placeholder="Choose a location" options={locations} />
|
|
998
|
+
</Field>
|
|
999
|
+
</DialogBody>
|
|
1000
|
+
<DialogFooter>
|
|
1001
|
+
<DialogClose asChild><Button>Cancel</Button></DialogClose>
|
|
1002
|
+
<Button type="submit" variant="primary">Transfer</Button>
|
|
1003
|
+
</DialogFooter>
|
|
1004
|
+
</form>
|
|
1005
|
+
</DialogContent>
|
|
1006
|
+
</Dialog>`,
|
|
1007
|
+
children: /* @__PURE__ */ jsx(TransferDialog, {})
|
|
1008
|
+
})
|
|
1009
|
+
}),
|
|
1010
|
+
/* @__PURE__ */ jsxs(Section, {
|
|
1011
|
+
id: "both-themes",
|
|
1012
|
+
title: "In both themes",
|
|
1013
|
+
description: /* @__PURE__ */ jsx("p", { children: "Held open for review: delivery rates with descriptions and prices, and a grouped list long enough to scroll, light above dark. The sheet is the canvas colour in light and lifts to graphite in dark, as the Menu does." }),
|
|
1014
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
1015
|
+
className: "overlays-stack",
|
|
1016
|
+
children: /* @__PURE__ */ jsx(ThemePair, {
|
|
1017
|
+
align: "fill",
|
|
1018
|
+
caption: "A still of the open lists, drawn with the select's own classes so both themes sit side by side. The selects below and on the rest of this page are live.",
|
|
1019
|
+
children: /* @__PURE__ */ jsx(HeldOpen, {})
|
|
1020
|
+
})
|
|
1021
|
+
}), /* @__PURE__ */ jsx(SubSection, {
|
|
1022
|
+
title: "Open them for real",
|
|
1023
|
+
description: /* @__PURE__ */ jsx("p", { children: "Each select opens its list in the theme of its own side." }),
|
|
1024
|
+
children: /* @__PURE__ */ jsx(ThemePair, {
|
|
1025
|
+
minHeight: 200,
|
|
1026
|
+
align: "start",
|
|
1027
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
1028
|
+
className: "select-pair",
|
|
1029
|
+
children: [
|
|
1030
|
+
/* @__PURE__ */ jsx(Select, {
|
|
1031
|
+
"aria-label": "Delivery rate",
|
|
1032
|
+
defaultValue: "next-day",
|
|
1033
|
+
options: RATES
|
|
1034
|
+
}),
|
|
1035
|
+
/* @__PURE__ */ jsx(Select, {
|
|
1036
|
+
"aria-label": "Fulfil from",
|
|
1037
|
+
placeholder: "Choose a location",
|
|
1038
|
+
options: LOCATIONS
|
|
1039
|
+
}),
|
|
1040
|
+
/* @__PURE__ */ jsx(Select, {
|
|
1041
|
+
"aria-label": "Delivery rate",
|
|
1042
|
+
placeholder: "Choose a rate",
|
|
1043
|
+
options: RATES,
|
|
1044
|
+
invalid: true
|
|
1045
|
+
})
|
|
1046
|
+
]
|
|
1047
|
+
})
|
|
1048
|
+
})
|
|
1049
|
+
})]
|
|
1050
|
+
}),
|
|
1051
|
+
/* @__PURE__ */ jsxs(Section, {
|
|
1052
|
+
id: "guidelines",
|
|
1053
|
+
title: "Guidelines",
|
|
1054
|
+
children: [
|
|
1055
|
+
/* @__PURE__ */ jsx(DoDont, {
|
|
1056
|
+
do: {
|
|
1057
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
1058
|
+
className: "select-dodont",
|
|
1059
|
+
children: /* @__PURE__ */ jsx(Field, {
|
|
1060
|
+
label: "Country or region",
|
|
1061
|
+
children: /* @__PURE__ */ jsx(Select, {
|
|
1062
|
+
placeholder: "Choose a country or region",
|
|
1063
|
+
options: COUNTRIES
|
|
1064
|
+
})
|
|
1065
|
+
})
|
|
1066
|
+
}),
|
|
1067
|
+
caption: "A list that is long, or keeps growing, and only needs to show the one that is chosen."
|
|
1068
|
+
},
|
|
1069
|
+
dont: {
|
|
1070
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
1071
|
+
className: "select-dodont",
|
|
1072
|
+
children: /* @__PURE__ */ jsx(Field, {
|
|
1073
|
+
label: "Weight unit",
|
|
1074
|
+
children: /* @__PURE__ */ jsx(Select, {
|
|
1075
|
+
defaultValue: "kg",
|
|
1076
|
+
options: [{
|
|
1077
|
+
value: "kg",
|
|
1078
|
+
label: "Kilograms"
|
|
1079
|
+
}, {
|
|
1080
|
+
value: "lb",
|
|
1081
|
+
label: "Pounds"
|
|
1082
|
+
}]
|
|
1083
|
+
})
|
|
1084
|
+
})
|
|
1085
|
+
}),
|
|
1086
|
+
caption: "Two choices hidden behind a click. Show them: a Segmented control or a Radio group."
|
|
1087
|
+
}
|
|
1088
|
+
}),
|
|
1089
|
+
/* @__PURE__ */ jsx(DoDont, {
|
|
1090
|
+
do: {
|
|
1091
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
1092
|
+
className: "select-dodont",
|
|
1093
|
+
children: /* @__PURE__ */ jsx(Field, {
|
|
1094
|
+
label: "Delivery rate",
|
|
1095
|
+
children: /* @__PURE__ */ jsx(Select, {
|
|
1096
|
+
placeholder: "Choose a rate",
|
|
1097
|
+
options: RATES
|
|
1098
|
+
})
|
|
1099
|
+
})
|
|
1100
|
+
}),
|
|
1101
|
+
caption: "A placeholder that says what to do, and a Field label that stays put."
|
|
1102
|
+
},
|
|
1103
|
+
dont: {
|
|
1104
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
1105
|
+
className: "select-dodont",
|
|
1106
|
+
children: /* @__PURE__ */ jsx(Select, {
|
|
1107
|
+
"aria-label": "Delivery rate",
|
|
1108
|
+
placeholder: "Select...",
|
|
1109
|
+
options: RATES
|
|
1110
|
+
})
|
|
1111
|
+
}),
|
|
1112
|
+
caption: "\"Select...\" as the only label: it vanishes once something is chosen, and says nothing about what."
|
|
1113
|
+
}
|
|
1114
|
+
}),
|
|
1115
|
+
/* @__PURE__ */ jsx(Guidelines, { items: [
|
|
1116
|
+
"Order rows the way people look for them: alphabetically for names and places, by size or speed for rates, most used first only when the list is short.",
|
|
1117
|
+
"Keep labels short and distinct from their first words, so type-to-select finds them.",
|
|
1118
|
+
"Never use a row as a fake placeholder (\"Please choose\"). Use placeholder, and value=\"\" to clear.",
|
|
1119
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1120
|
+
"If choosing should do something straight away (sort a list, switch a view), that is fine; if it starts an action, use a ",
|
|
1121
|
+
/* @__PURE__ */ jsx(DocLink, {
|
|
1122
|
+
to: "/components/menu",
|
|
1123
|
+
children: "Menu"
|
|
1124
|
+
}),
|
|
1125
|
+
"."
|
|
1126
|
+
] })
|
|
1127
|
+
] }),
|
|
1128
|
+
/* @__PURE__ */ jsx(DocTable, {
|
|
1129
|
+
columns: ["To choose", "Use"],
|
|
1130
|
+
rows: [
|
|
1131
|
+
["One of many, or a list that grows (countries, locations, staff)", "Select"],
|
|
1132
|
+
["One of two to five, with descriptions worth reading side by side", /* @__PURE__ */ jsx(DocLink, {
|
|
1133
|
+
to: "/components/radio-group",
|
|
1134
|
+
children: "Radio group"
|
|
1135
|
+
})],
|
|
1136
|
+
["One of a few views or ranges, applied at once", /* @__PURE__ */ jsx(DocLink, {
|
|
1137
|
+
to: "/components/segmented-control",
|
|
1138
|
+
children: "Segmented control"
|
|
1139
|
+
})],
|
|
1140
|
+
["An action to run, not a value to keep", /* @__PURE__ */ jsx(DocLink, {
|
|
1141
|
+
to: "/components/menu",
|
|
1142
|
+
children: "Menu"
|
|
1143
|
+
})],
|
|
1144
|
+
["One of hundreds, or by searching", /* @__PURE__ */ jsx(DocLink, {
|
|
1145
|
+
to: "/components/command-palette",
|
|
1146
|
+
children: "Command palette"
|
|
1147
|
+
})]
|
|
1148
|
+
]
|
|
1149
|
+
})
|
|
1150
|
+
]
|
|
1151
|
+
}),
|
|
1152
|
+
/* @__PURE__ */ jsx(Section, {
|
|
1153
|
+
id: "accessibility",
|
|
1154
|
+
title: "Accessibility",
|
|
1155
|
+
children: /* @__PURE__ */ jsx(Guidelines, { items: [
|
|
1156
|
+
"Built on Radix Select: the trigger is a combobox button and the list a listbox. Space, Enter and the arrow keys open it; the arrow keys, Home and End move; Enter or Space chooses; Escape closes; typing jumps to a row.",
|
|
1157
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1158
|
+
"In a Field, the label names the trigger and the hint or error is its description. An error also sets",
|
|
1159
|
+
" ",
|
|
1160
|
+
/* @__PURE__ */ jsx("code", { children: "aria-invalid" }),
|
|
1161
|
+
". Outside a Field, give it an ",
|
|
1162
|
+
/* @__PURE__ */ jsx("code", { children: "aria-label" }),
|
|
1163
|
+
"."
|
|
1164
|
+
] }),
|
|
1165
|
+
"A row's description and hint are read after its label, as its description.",
|
|
1166
|
+
/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1167
|
+
"A hidden native select goes with it, so ",
|
|
1168
|
+
/* @__PURE__ */ jsx("code", { children: "name" }),
|
|
1169
|
+
" and ",
|
|
1170
|
+
/* @__PURE__ */ jsx("code", { children: "required" }),
|
|
1171
|
+
" work in forms, and resetting the form brings back the starting value."
|
|
1172
|
+
] }),
|
|
1173
|
+
"Focus returns to the trigger when the list closes. Disabled rows are skipped.",
|
|
1174
|
+
"The list follows the nearest ThemeScope, though it is portalled out of it.",
|
|
1175
|
+
"Under reduced motion the list fades in and out without growing, and its rows fade without rising."
|
|
1176
|
+
] })
|
|
1177
|
+
}),
|
|
1178
|
+
/* @__PURE__ */ jsxs(Section, {
|
|
1179
|
+
id: "props",
|
|
1180
|
+
title: "Props",
|
|
1181
|
+
children: [
|
|
1182
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
1183
|
+
title: "Select",
|
|
1184
|
+
rows: [
|
|
1185
|
+
{
|
|
1186
|
+
name: "options",
|
|
1187
|
+
type: "Array<SelectOption | SelectOptionGroup>",
|
|
1188
|
+
description: "The rows, and groups of rows. With it, Select renders the trigger and the list; without it, compose the parts as children."
|
|
1189
|
+
},
|
|
1190
|
+
{
|
|
1191
|
+
name: "value",
|
|
1192
|
+
type: "string | ''",
|
|
1193
|
+
description: "Controlled value. '' clears it and the placeholder shows again."
|
|
1194
|
+
},
|
|
1195
|
+
{
|
|
1196
|
+
name: "defaultValue",
|
|
1197
|
+
type: "string",
|
|
1198
|
+
description: "Starting value when uncontrolled."
|
|
1199
|
+
},
|
|
1200
|
+
{
|
|
1201
|
+
name: "onValueChange",
|
|
1202
|
+
type: "(value: string) => void",
|
|
1203
|
+
description: "Called with the chosen value. Typed options keep it typed."
|
|
1204
|
+
},
|
|
1205
|
+
{
|
|
1206
|
+
name: "placeholder",
|
|
1207
|
+
type: "ReactNode",
|
|
1208
|
+
description: "With options: shown in quiet slate while nothing is chosen."
|
|
1209
|
+
},
|
|
1210
|
+
{
|
|
1211
|
+
name: "size",
|
|
1212
|
+
type: "'sm' | 'md' | 'lg'",
|
|
1213
|
+
default: "'md'",
|
|
1214
|
+
description: "Trigger height (30, 36 or 44px) and row height (30, 34 or 40px)."
|
|
1215
|
+
},
|
|
1216
|
+
{
|
|
1217
|
+
name: "disabled",
|
|
1218
|
+
type: "boolean",
|
|
1219
|
+
default: "false",
|
|
1220
|
+
description: "Cannot be opened; the trigger sinks into the well."
|
|
1221
|
+
},
|
|
1222
|
+
{
|
|
1223
|
+
name: "name, required, form",
|
|
1224
|
+
type: "string, boolean, string",
|
|
1225
|
+
description: "For the hidden native select that forms submit."
|
|
1226
|
+
},
|
|
1227
|
+
{
|
|
1228
|
+
name: "open, defaultOpen, onOpenChange",
|
|
1229
|
+
type: "boolean, boolean, (open) => void",
|
|
1230
|
+
description: "Control the list being open."
|
|
1231
|
+
},
|
|
1232
|
+
{
|
|
1233
|
+
name: "contentWidth",
|
|
1234
|
+
type: "number | string | 'trigger'",
|
|
1235
|
+
description: "With options: the width of the list. By default at least the trigger."
|
|
1236
|
+
}
|
|
1237
|
+
]
|
|
1238
|
+
}),
|
|
1239
|
+
/* @__PURE__ */ jsxs("p", {
|
|
1240
|
+
className: "doc-section__description",
|
|
1241
|
+
children: [
|
|
1242
|
+
"With ",
|
|
1243
|
+
/* @__PURE__ */ jsx("code", { children: "options" }),
|
|
1244
|
+
", every other prop (",
|
|
1245
|
+
/* @__PURE__ */ jsx("code", { children: "id" }),
|
|
1246
|
+
", ",
|
|
1247
|
+
/* @__PURE__ */ jsx("code", { children: "aria-label" }),
|
|
1248
|
+
", ",
|
|
1249
|
+
/* @__PURE__ */ jsx("code", { children: "icon" }),
|
|
1250
|
+
",",
|
|
1251
|
+
" ",
|
|
1252
|
+
/* @__PURE__ */ jsx("code", { children: "invalid" }),
|
|
1253
|
+
", ",
|
|
1254
|
+
/* @__PURE__ */ jsx("code", { children: "className" }),
|
|
1255
|
+
") and the ",
|
|
1256
|
+
/* @__PURE__ */ jsx("code", { children: "ref" }),
|
|
1257
|
+
" go to the trigger."
|
|
1258
|
+
]
|
|
1259
|
+
}),
|
|
1260
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
1261
|
+
title: "SelectOption",
|
|
1262
|
+
rows: [
|
|
1263
|
+
{
|
|
1264
|
+
name: "value",
|
|
1265
|
+
type: "string",
|
|
1266
|
+
required: true,
|
|
1267
|
+
description: "Unique, and never an empty string."
|
|
1268
|
+
},
|
|
1269
|
+
{
|
|
1270
|
+
name: "label",
|
|
1271
|
+
type: "ReactNode",
|
|
1272
|
+
required: true,
|
|
1273
|
+
description: "The row, and the trigger once chosen."
|
|
1274
|
+
},
|
|
1275
|
+
{
|
|
1276
|
+
name: "description",
|
|
1277
|
+
type: "ReactNode",
|
|
1278
|
+
description: "A quieter second line, in the list only."
|
|
1279
|
+
},
|
|
1280
|
+
{
|
|
1281
|
+
name: "icon",
|
|
1282
|
+
type: "ReactNode",
|
|
1283
|
+
description: "Leading 16px icon, shown in the trigger too."
|
|
1284
|
+
},
|
|
1285
|
+
{
|
|
1286
|
+
name: "hint",
|
|
1287
|
+
type: "ReactNode",
|
|
1288
|
+
description: "Quiet trailing text, e.g. a price or a stock count."
|
|
1289
|
+
},
|
|
1290
|
+
{
|
|
1291
|
+
name: "disabled",
|
|
1292
|
+
type: "boolean",
|
|
1293
|
+
description: "Dimmed and skipped by the arrow keys."
|
|
1294
|
+
},
|
|
1295
|
+
{
|
|
1296
|
+
name: "textValue",
|
|
1297
|
+
type: "string",
|
|
1298
|
+
description: "Text for type-to-select when the label is not plain text."
|
|
1299
|
+
}
|
|
1300
|
+
]
|
|
1301
|
+
}),
|
|
1302
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
1303
|
+
title: "SelectTrigger",
|
|
1304
|
+
rows: [
|
|
1305
|
+
{
|
|
1306
|
+
name: "placeholder",
|
|
1307
|
+
type: "ReactNode",
|
|
1308
|
+
description: "Shown while nothing is chosen, when the trigger has no SelectValue of its own."
|
|
1309
|
+
},
|
|
1310
|
+
{
|
|
1311
|
+
name: "icon",
|
|
1312
|
+
type: "ReactNode",
|
|
1313
|
+
description: "A fixed leading icon, muted until focus."
|
|
1314
|
+
},
|
|
1315
|
+
{
|
|
1316
|
+
name: "invalid",
|
|
1317
|
+
type: "boolean",
|
|
1318
|
+
description: "Red edge and aria-invalid. In a Field, follows its error; aria-invalid works too."
|
|
1319
|
+
},
|
|
1320
|
+
{
|
|
1321
|
+
name: "size",
|
|
1322
|
+
type: "'sm' | 'md' | 'lg'",
|
|
1323
|
+
description: "Overrides the size set on Select."
|
|
1324
|
+
},
|
|
1325
|
+
{
|
|
1326
|
+
name: "children",
|
|
1327
|
+
type: "ReactNode",
|
|
1328
|
+
description: "Defaults to a SelectValue. Pass your own to show something else."
|
|
1329
|
+
}
|
|
1330
|
+
]
|
|
1331
|
+
}),
|
|
1332
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
1333
|
+
title: "SelectContent",
|
|
1334
|
+
rows: [
|
|
1335
|
+
{
|
|
1336
|
+
name: "width",
|
|
1337
|
+
type: "number | string | 'trigger'",
|
|
1338
|
+
description: "Width of the list. By default at least the trigger, up to 360px for longer rows."
|
|
1339
|
+
},
|
|
1340
|
+
{
|
|
1341
|
+
name: "position",
|
|
1342
|
+
type: "'popper' | 'item-aligned'",
|
|
1343
|
+
default: "'popper'",
|
|
1344
|
+
description: "Below the trigger, or over it with the chosen row lined up (macOS style)."
|
|
1345
|
+
},
|
|
1346
|
+
{
|
|
1347
|
+
name: "side, align, sideOffset",
|
|
1348
|
+
type: "Radix placement",
|
|
1349
|
+
default: "'bottom', 'start', 6",
|
|
1350
|
+
description: "Where the list opens. It flips when there is no room."
|
|
1351
|
+
},
|
|
1352
|
+
{
|
|
1353
|
+
name: "onScroll",
|
|
1354
|
+
type: "(event) => void",
|
|
1355
|
+
description: "The list's own scrolling, e.g. to load more rows near the end."
|
|
1356
|
+
},
|
|
1357
|
+
{
|
|
1358
|
+
name: "container",
|
|
1359
|
+
type: "HTMLElement | null",
|
|
1360
|
+
description: "Where it is portalled. Defaults to document.body."
|
|
1361
|
+
}
|
|
1362
|
+
]
|
|
1363
|
+
}),
|
|
1364
|
+
/* @__PURE__ */ jsx(PropsTable, {
|
|
1365
|
+
title: "SelectItem",
|
|
1366
|
+
rows: [
|
|
1367
|
+
{
|
|
1368
|
+
name: "value",
|
|
1369
|
+
type: "string",
|
|
1370
|
+
required: true,
|
|
1371
|
+
description: "Unique, and never an empty string."
|
|
1372
|
+
},
|
|
1373
|
+
{
|
|
1374
|
+
name: "children",
|
|
1375
|
+
type: "ReactNode",
|
|
1376
|
+
required: true,
|
|
1377
|
+
description: "The label, mirrored into the trigger once chosen."
|
|
1378
|
+
},
|
|
1379
|
+
{
|
|
1380
|
+
name: "description",
|
|
1381
|
+
type: "ReactNode",
|
|
1382
|
+
description: "A quieter second line, in the list only."
|
|
1383
|
+
},
|
|
1384
|
+
{
|
|
1385
|
+
name: "icon",
|
|
1386
|
+
type: "ReactNode",
|
|
1387
|
+
description: "Leading 16px icon, mirrored into the trigger."
|
|
1388
|
+
},
|
|
1389
|
+
{
|
|
1390
|
+
name: "hint",
|
|
1391
|
+
type: "ReactNode",
|
|
1392
|
+
description: "Quiet trailing text."
|
|
1393
|
+
},
|
|
1394
|
+
{
|
|
1395
|
+
name: "disabled",
|
|
1396
|
+
type: "boolean",
|
|
1397
|
+
description: "Dimmed and skipped."
|
|
1398
|
+
},
|
|
1399
|
+
{
|
|
1400
|
+
name: "textValue",
|
|
1401
|
+
type: "string",
|
|
1402
|
+
description: "Text for type-to-select when children is not plain text."
|
|
1403
|
+
}
|
|
1404
|
+
]
|
|
1405
|
+
}),
|
|
1406
|
+
/* @__PURE__ */ jsxs("p", {
|
|
1407
|
+
className: "doc-section__description",
|
|
1408
|
+
children: [
|
|
1409
|
+
/* @__PURE__ */ jsx("code", { children: "SelectValue" }),
|
|
1410
|
+
" takes a ",
|
|
1411
|
+
/* @__PURE__ */ jsx("code", { children: "placeholder" }),
|
|
1412
|
+
". ",
|
|
1413
|
+
/* @__PURE__ */ jsx("code", { children: "SelectGroup" }),
|
|
1414
|
+
", ",
|
|
1415
|
+
/* @__PURE__ */ jsx("code", { children: "SelectLabel" }),
|
|
1416
|
+
" ",
|
|
1417
|
+
"(inside a group) and ",
|
|
1418
|
+
/* @__PURE__ */ jsx("code", { children: "SelectSeparator" }),
|
|
1419
|
+
" take no props of their own."
|
|
1420
|
+
]
|
|
1421
|
+
}),
|
|
1422
|
+
/* @__PURE__ */ jsx(Fragment$1, {})
|
|
1423
|
+
]
|
|
1424
|
+
})
|
|
1425
|
+
]
|
|
1426
|
+
});
|
|
1427
|
+
}
|
|
1428
|
+
//#endregion
|
|
1429
|
+
export { Page, Preview };
|