@orbitcommerce/constellation-docs 0.0.0-stage → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/LICENSE.md +6 -0
  2. package/README.md +6 -2
  3. package/dist/docs.css +8260 -0
  4. package/dist/index.d.ts +33 -0
  5. package/dist/index.js +308 -0
  6. package/dist/pages/Playground-CNbBbErC.js +129 -0
  7. package/dist/pages/_figures-data-BDmScEny.js +606 -0
  8. package/dist/pages/_foundations-blXWyYh8.js +30 -0
  9. package/dist/pages/_overlays-specimens-Dpn6oiyH.js +310 -0
  10. package/dist/pages/alert-BD4e6QTh.js +769 -0
  11. package/dist/pages/app-shell-KbA-nRqZ.js +1479 -0
  12. package/dist/pages/area-chart-B91dLcGo.js +562 -0
  13. package/dist/pages/avatar-DPPHXJAu.js +713 -0
  14. package/dist/pages/badge-C9JR0thI.js +729 -0
  15. package/dist/pages/button-D3V912P4.js +518 -0
  16. package/dist/pages/calendar-DSDZ9nRH.js +630 -0
  17. package/dist/pages/card-DUggbis3.js +659 -0
  18. package/dist/pages/checkbox-DwimQaK3.js +365 -0
  19. package/dist/pages/colour-BwuO8xAv.js +1498 -0
  20. package/dist/pages/command-palette-xAD7fOg6.js +1243 -0
  21. package/dist/pages/date-picker-BYSa816m.js +1421 -0
  22. package/dist/pages/delta-CtAo0eIM.js +574 -0
  23. package/dist/pages/dialog-BRAf4LMh.js +1451 -0
  24. package/dist/pages/docs-BNOb7AqR.js +515 -0
  25. package/dist/pages/empty-state-C-mLrXW2.js +417 -0
  26. package/dist/pages/figure-tabs-CoPFzzKz.js +460 -0
  27. package/dist/pages/home-dashboard-CFQwDtC9.js +959 -0
  28. package/dist/pages/host-B6znjEgQ.js +109 -0
  29. package/dist/pages/icon-button-C9eSVPPW.js +861 -0
  30. package/dist/pages/icons-sxkTs5Ob.js +473 -0
  31. package/dist/pages/input-KF9Gkawf.js +1093 -0
  32. package/dist/pages/installation-DpsX8G_n.js +445 -0
  33. package/dist/pages/kbd-cNfDoikz.js +544 -0
  34. package/dist/pages/live-globe-ClvLn9Lb.js +571 -0
  35. package/dist/pages/logo-BfGF1Pq9.js +571 -0
  36. package/dist/pages/menu-by2sgQ09.js +1618 -0
  37. package/dist/pages/motion-BvTGc2Dk.js +855 -0
  38. package/dist/pages/orbit-spinner-Dil1Z3Oy.js +332 -0
  39. package/dist/pages/overview-BPEbZQ6g.js +130 -0
  40. package/dist/pages/pagination-BBUnGvv5.js +249 -0
  41. package/dist/pages/popover-Db1gLDpb.js +1136 -0
  42. package/dist/pages/principles-CeAIOIdt.js +483 -0
  43. package/dist/pages/radio-group-CkdBWWfG.js +1077 -0
  44. package/dist/pages/registry-CroHzK9I.js +244 -0
  45. package/dist/pages/release-Dvo684UJ.js +13 -0
  46. package/dist/pages/rolling-number-qmvH84Mq.js +529 -0
  47. package/dist/pages/search-field-BN7MWGQ4.js +693 -0
  48. package/dist/pages/segmented-control-CTbIpRBW.js +777 -0
  49. package/dist/pages/select-DguELoRR.js +1429 -0
  50. package/dist/pages/separator-CPZub9pv.js +351 -0
  51. package/dist/pages/shape-DKvA0YKr.js +627 -0
  52. package/dist/pages/skeleton-DLuBhP46.js +561 -0
  53. package/dist/pages/sparkline-DMMYGbHn.js +668 -0
  54. package/dist/pages/switch-B-Qe4kcT.js +517 -0
  55. package/dist/pages/table-AMoODng4.js +607 -0
  56. package/dist/pages/tabs-B4M-usCV.js +1455 -0
  57. package/dist/pages/textarea-fTuUZRQb.js +693 -0
  58. package/dist/pages/toast-CKP03zjy.js +1176 -0
  59. package/dist/pages/tooltip-CBYil3kt.js +697 -0
  60. package/dist/pages/typography-PCbg8Bhg.js +735 -0
  61. package/manifest.json +3125 -0
  62. package/package.json +35 -4
@@ -0,0 +1,517 @@
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, r as DoDont, s as Guidelines, u as PropsTable } from "./docs-BNOb7AqR.js";
4
+ import { t as Playground } from "./Playground-CNbBbErC.js";
5
+ import { Fragment, useId, useState } from "react";
6
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
+ import { Badge, Button, Card, CardHeader, Separator, Switch } from "@orbitcommerce/constellation";
8
+ //#region src/pages/components/switch.tsx
9
+ function Preview() {
10
+ return /* @__PURE__ */ jsxs("div", {
11
+ style: {
12
+ display: "grid",
13
+ gap: 14
14
+ },
15
+ children: [/* @__PURE__ */ jsx(Switch, {
16
+ label: "Accept new orders",
17
+ defaultChecked: true
18
+ }), /* @__PURE__ */ jsx(Switch, { label: "Holiday mode" })]
19
+ });
20
+ }
21
+ var quote = (v) => String(v).replace(/"/g, """);
22
+ var PLAYGROUND = [
23
+ {
24
+ prop: "label",
25
+ type: "text",
26
+ default: "Accept new orders",
27
+ toAttr: (v) => v ? `label="${quote(v)}"` : "aria-label=\"Accept new orders\""
28
+ },
29
+ {
30
+ prop: "size",
31
+ type: "select",
32
+ options: ["sm", "md"],
33
+ default: "md"
34
+ },
35
+ {
36
+ prop: "defaultChecked",
37
+ type: "boolean",
38
+ default: true,
39
+ toAttr: (v) => v ? "defaultChecked" : null
40
+ },
41
+ {
42
+ prop: "disabled",
43
+ type: "boolean",
44
+ default: false
45
+ }
46
+ ];
47
+ /** A switch with a line of description under its label, linked for screen readers. */
48
+ function Setting({ label, description, size = "md", defaultChecked, disabled, onCheckedChange }) {
49
+ const descriptionId = useId();
50
+ return /* @__PURE__ */ jsxs("div", {
51
+ className: "switch-setting",
52
+ "data-size": size,
53
+ children: [/* @__PURE__ */ jsx(Switch, {
54
+ label,
55
+ size,
56
+ defaultChecked,
57
+ disabled,
58
+ "aria-describedby": descriptionId,
59
+ onCheckedChange
60
+ }), /* @__PURE__ */ jsx("p", {
61
+ id: descriptionId,
62
+ className: "switch-setting__description",
63
+ children: description
64
+ })]
65
+ });
66
+ }
67
+ var NOTIFICATIONS = [
68
+ {
69
+ key: "orders",
70
+ label: "New orders",
71
+ description: "An email each time an order is placed.",
72
+ on: true
73
+ },
74
+ {
75
+ key: "stock",
76
+ label: "Low stock",
77
+ description: "When a product falls to 5 or fewer in stock.",
78
+ on: true
79
+ },
80
+ {
81
+ key: "abandoned",
82
+ label: "Abandoned checkouts",
83
+ description: "A daily summary of baskets left at checkout.",
84
+ on: false
85
+ },
86
+ {
87
+ key: "replies",
88
+ label: "Customer replies",
89
+ description: "When a customer replies to an order email.",
90
+ on: true
91
+ },
92
+ {
93
+ key: "weekly",
94
+ label: "Weekly takings",
95
+ description: "Your takings and best sellers, every Monday at 8am.",
96
+ on: false
97
+ }
98
+ ];
99
+ function NotificationSettings() {
100
+ const [status, setStatus] = useState("Changes save as you make them.");
101
+ return /* @__PURE__ */ jsxs("div", {
102
+ className: "switch-settings",
103
+ children: [/* @__PURE__ */ jsxs(Card, { children: [/* @__PURE__ */ jsx(CardHeader, {
104
+ title: "Store notifications",
105
+ description: "Emails go to priya@harbourdesk.co.uk",
106
+ titleAs: "p"
107
+ }), /* @__PURE__ */ jsx("div", {
108
+ className: "switch-settings__rows",
109
+ children: NOTIFICATIONS.map((n, i) => /* @__PURE__ */ jsxs(Fragment, { children: [i > 0 ? /* @__PURE__ */ jsx(Separator, {}) : null, /* @__PURE__ */ jsx(Setting, {
110
+ label: n.label,
111
+ description: n.description,
112
+ defaultChecked: n.on,
113
+ onCheckedChange: (on) => setStatus(`${n.label}: ${on ? "on" : "off"}. Saved.`)
114
+ })] }, n.key))
115
+ })] }), /* @__PURE__ */ jsx("p", {
116
+ role: "status",
117
+ className: "switch-status",
118
+ children: status
119
+ })]
120
+ });
121
+ }
122
+ function StoreOpen() {
123
+ const [open, setOpen] = useState(true);
124
+ return /* @__PURE__ */ jsxs("div", {
125
+ className: "switch-store",
126
+ children: [/* @__PURE__ */ jsx(Switch, {
127
+ label: "Store open",
128
+ checked: open,
129
+ onCheckedChange: setOpen
130
+ }), open ? /* @__PURE__ */ jsx(Badge, {
131
+ tone: "positive",
132
+ pulse: true,
133
+ children: "Taking orders"
134
+ }) : /* @__PURE__ */ jsx(Badge, {
135
+ dot: true,
136
+ children: "Checkout paused"
137
+ })]
138
+ });
139
+ }
140
+ function Page() {
141
+ return /* @__PURE__ */ jsxs(DocPage, {
142
+ title: "Switch",
143
+ status: "stable",
144
+ importNames: ["Switch"],
145
+ lead: "An on or off setting that takes effect the moment it is flipped, such as holiday mode or a notification email. When a choice only counts once a form is sent, it is a checkbox's job instead.",
146
+ children: [
147
+ /* @__PURE__ */ jsx(Section, {
148
+ id: "playground",
149
+ title: "Playground",
150
+ description: /* @__PURE__ */ jsx("p", { children: "Change the props, then flip the switch. Press and hold it to feel the thumb stretch." }),
151
+ children: /* @__PURE__ */ jsx(Playground, {
152
+ component: "Switch",
153
+ controls: PLAYGROUND,
154
+ render: (v) => /* @__PURE__ */ jsx(Switch, {
155
+ label: v.label ? String(v.label) : void 0,
156
+ "aria-label": v.label ? void 0 : "Accept new orders",
157
+ size: v.size,
158
+ defaultChecked: Boolean(v.defaultChecked),
159
+ disabled: Boolean(v.disabled)
160
+ }, String(v.defaultChecked))
161
+ })
162
+ }),
163
+ /* @__PURE__ */ jsx(Section, {
164
+ id: "states",
165
+ title: "States",
166
+ description: /* @__PURE__ */ jsx("p", { children: "Off is ink at 15%; on is Orbit teal. Disabled drops to 45% and cannot be focused. Every state at both sizes:" }),
167
+ children: /* @__PURE__ */ jsx(Example, {
168
+ code: `
169
+ <Switch aria-label="Holiday mode" />
170
+ <Switch aria-label="Accept new orders" defaultChecked />
171
+ <Switch aria-label="Sell to trade customers" disabled />
172
+ <Switch aria-label="Show prices including VAT" disabled defaultChecked />
173
+
174
+ <Switch size="sm" aria-label="Holiday mode" />
175
+ <Switch size="sm" aria-label="Accept new orders" defaultChecked />
176
+ <Switch size="sm" aria-label="Sell to trade customers" disabled />
177
+ <Switch size="sm" aria-label="Show prices including VAT" disabled defaultChecked />`,
178
+ caption: "Off, on, disabled off and disabled on. Medium above, small below.",
179
+ children: /* @__PURE__ */ jsxs("div", {
180
+ className: "switch-rows",
181
+ children: [/* @__PURE__ */ jsxs("div", {
182
+ className: "switch-row",
183
+ children: [
184
+ /* @__PURE__ */ jsx(Switch, { "aria-label": "Holiday mode" }),
185
+ /* @__PURE__ */ jsx(Switch, {
186
+ "aria-label": "Accept new orders",
187
+ defaultChecked: true
188
+ }),
189
+ /* @__PURE__ */ jsx(Switch, {
190
+ "aria-label": "Sell to trade customers",
191
+ disabled: true
192
+ }),
193
+ /* @__PURE__ */ jsx(Switch, {
194
+ "aria-label": "Show prices including VAT",
195
+ disabled: true,
196
+ defaultChecked: true
197
+ })
198
+ ]
199
+ }), /* @__PURE__ */ jsxs("div", {
200
+ className: "switch-row",
201
+ children: [
202
+ /* @__PURE__ */ jsx(Switch, {
203
+ size: "sm",
204
+ "aria-label": "Holiday mode"
205
+ }),
206
+ /* @__PURE__ */ jsx(Switch, {
207
+ size: "sm",
208
+ "aria-label": "Accept new orders",
209
+ defaultChecked: true
210
+ }),
211
+ /* @__PURE__ */ jsx(Switch, {
212
+ size: "sm",
213
+ "aria-label": "Sell to trade customers",
214
+ disabled: true
215
+ }),
216
+ /* @__PURE__ */ jsx(Switch, {
217
+ size: "sm",
218
+ "aria-label": "Show prices including VAT",
219
+ disabled: true,
220
+ defaultChecked: true
221
+ })
222
+ ]
223
+ })]
224
+ })
225
+ })
226
+ }),
227
+ /* @__PURE__ */ jsx(Section, {
228
+ id: "both-themes",
229
+ title: "In both themes",
230
+ description: /* @__PURE__ */ jsx("p", { children: "On, off and disabled with labels, light and dark side by side. In dark, on turns mint." }),
231
+ children: /* @__PURE__ */ jsx(ThemePair, { children: /* @__PURE__ */ jsxs("div", {
232
+ className: "switch-stack",
233
+ children: [
234
+ /* @__PURE__ */ jsx(Switch, {
235
+ label: "Accept new orders",
236
+ defaultChecked: true
237
+ }),
238
+ /* @__PURE__ */ jsx(Switch, { label: "Holiday mode" }),
239
+ /* @__PURE__ */ jsx(Switch, {
240
+ label: "Sell to trade customers",
241
+ disabled: true
242
+ })
243
+ ]
244
+ }) })
245
+ }),
246
+ /* @__PURE__ */ jsx(Section, {
247
+ id: "sizes",
248
+ title: "Sizes",
249
+ description: /* @__PURE__ */ jsxs("p", { children: [
250
+ /* @__PURE__ */ jsx("code", { children: "md" }),
251
+ " is 36 by 20px with 14px label text (default). ",
252
+ /* @__PURE__ */ jsx("code", { children: "sm" }),
253
+ " is 30 by 17px with 13px text, for dense panels and settings inside cards."
254
+ ] }),
255
+ children: /* @__PURE__ */ jsx(Example, {
256
+ code: `
257
+ <Switch label="Accept new orders" defaultChecked />
258
+ <Switch size="sm" label="Email me when stock runs low" defaultChecked />`,
259
+ children: /* @__PURE__ */ jsxs("div", {
260
+ className: "switch-stack",
261
+ children: [/* @__PURE__ */ jsx(Switch, {
262
+ label: "Accept new orders",
263
+ defaultChecked: true
264
+ }), /* @__PURE__ */ jsx(Switch, {
265
+ size: "sm",
266
+ label: "Email me when stock runs low",
267
+ defaultChecked: true
268
+ })]
269
+ })
270
+ })
271
+ }),
272
+ /* @__PURE__ */ jsx(Section, {
273
+ id: "label-and-description",
274
+ title: "Label and description",
275
+ description: /* @__PURE__ */ jsxs("p", { children: [
276
+ /* @__PURE__ */ jsx("code", { children: "label" }),
277
+ " puts text to the right of the switch: it names the switch, and clicking it flips the switch too. There is no description prop, so write the description under it and link it with",
278
+ " ",
279
+ /* @__PURE__ */ jsx("code", { children: "aria-describedby" }),
280
+ ": native props go to the switch itself. Indent it by the switch's width and gap (46px, or 38px small) so it lines up with the label."
281
+ ] }),
282
+ children: /* @__PURE__ */ jsx(Example, {
283
+ code: `
284
+ const descriptionId = useId()
285
+
286
+ <Switch label="Holiday mode" aria-describedby={descriptionId} />
287
+ <p id={descriptionId}>Shows shoppers a banner with the date you are back.</p>`,
288
+ children: /* @__PURE__ */ jsx(Setting, {
289
+ label: "Holiday mode",
290
+ description: "Shows shoppers a banner with the date you are back."
291
+ })
292
+ })
293
+ }),
294
+ /* @__PURE__ */ jsx(Section, {
295
+ id: "settings-list",
296
+ title: "In a settings list",
297
+ description: /* @__PURE__ */ jsx("p", { children: "A list of switches under one heading, split by hairlines. Nothing waits for a Save button: each change is saved as it is made, and a quiet line says so." }),
298
+ children: /* @__PURE__ */ jsx(Example, {
299
+ align: "fill",
300
+ code: `
301
+ <Card>
302
+ <CardHeader title="Store notifications" description="Emails go to priya@harbourdesk.co.uk" />
303
+ <Switch label="New orders" defaultChecked aria-describedby="new-orders-hint" onCheckedChange={save} />
304
+ <p id="new-orders-hint">An email each time an order is placed.</p>
305
+ <Separator />
306
+ <Switch label="Low stock" defaultChecked aria-describedby="low-stock-hint" onCheckedChange={save} />
307
+ <p id="low-stock-hint">When a product falls to 5 or fewer in stock.</p>
308
+ {/* Abandoned checkouts, Customer replies, Weekly takings */}
309
+ </Card>
310
+ <p role="status">{status}</p>`,
311
+ children: /* @__PURE__ */ jsx(NotificationSettings, {})
312
+ })
313
+ }),
314
+ /* @__PURE__ */ jsx(Section, {
315
+ id: "controlled",
316
+ title: "Controlled",
317
+ description: /* @__PURE__ */ jsxs("p", { children: [
318
+ "Pass ",
319
+ /* @__PURE__ */ jsx("code", { children: "checked" }),
320
+ " and ",
321
+ /* @__PURE__ */ jsx("code", { children: "onCheckedChange" }),
322
+ " when the page needs to react to the switch, or when the value comes from the server."
323
+ ] }),
324
+ children: /* @__PURE__ */ jsx(Example, {
325
+ code: `
326
+ const [open, setOpen] = useState(true)
327
+
328
+ <Switch label="Store open" checked={open} onCheckedChange={setOpen} />
329
+ {open ? <Badge tone="positive" pulse>Taking orders</Badge> : <Badge dot>Checkout paused</Badge>}`,
330
+ children: /* @__PURE__ */ jsx(StoreOpen, {})
331
+ })
332
+ }),
333
+ /* @__PURE__ */ jsxs(Section, {
334
+ id: "switch-or-checkbox",
335
+ title: "Switch or checkbox?",
336
+ description: /* @__PURE__ */ jsxs("p", { children: [
337
+ "A switch is a setting that is on or off right now. A checkbox is an answer that counts when a form is sent. If there is a Save or Submit button, the choices above it are",
338
+ " ",
339
+ /* @__PURE__ */ jsx(DocLink, {
340
+ to: "/components/checkbox",
341
+ children: "checkboxes"
342
+ }),
343
+ "."
344
+ ] }),
345
+ children: [/* @__PURE__ */ jsx(DoDont, {
346
+ do: {
347
+ children: /* @__PURE__ */ jsx(Switch, {
348
+ label: "Holiday mode",
349
+ defaultChecked: true
350
+ }),
351
+ caption: "A switch for a setting that takes effect the moment it is flipped."
352
+ },
353
+ dont: {
354
+ children: /* @__PURE__ */ jsxs("div", {
355
+ className: "switch-stack",
356
+ style: { justifyItems: "start" },
357
+ children: [/* @__PURE__ */ jsx(Switch, { label: "I agree to the terms of sale" }), /* @__PURE__ */ jsx(Button, {
358
+ variant: "primary",
359
+ children: "Create account"
360
+ })]
361
+ }),
362
+ caption: "An answer sent with a form is a checkbox. A switch suggests something has already happened."
363
+ }
364
+ }), /* @__PURE__ */ jsx(DocTable, {
365
+ columns: [
366
+ /* @__PURE__ */ jsx("span", {
367
+ className: "o-sr-only",
368
+ children: "Question"
369
+ }),
370
+ "Switch",
371
+ "Checkbox"
372
+ ],
373
+ rows: [
374
+ [
375
+ "Takes effect",
376
+ "At once",
377
+ "When the form is sent"
378
+ ],
379
+ [
380
+ "Reads as",
381
+ "A setting that is on or off",
382
+ "An answer or a choice to send"
383
+ ],
384
+ [
385
+ "For example",
386
+ "Holiday mode, Accept new orders",
387
+ "Agree to the terms, pick products to export"
388
+ ]
389
+ ]
390
+ })]
391
+ }),
392
+ /* @__PURE__ */ jsx(Section, {
393
+ id: "motion",
394
+ title: "Motion",
395
+ description: /* @__PURE__ */ jsx("p", { children: "The thumb slides on the settle spring in 320ms. While it is pressed it takes the weight and stretches 4px towards the side it is about to go to (3px small). Under reduced motion it moves at once and only the colour fades." }),
396
+ children: /* @__PURE__ */ jsx(Example, {
397
+ code: `<Switch label="Holiday mode" />`,
398
+ children: /* @__PURE__ */ jsx(Switch, { label: "Holiday mode" })
399
+ })
400
+ }),
401
+ /* @__PURE__ */ jsx(Section, {
402
+ id: "guidelines",
403
+ title: "Guidelines",
404
+ children: /* @__PURE__ */ jsx(Guidelines, { items: [
405
+ "Name the setting, not the action: \"Holiday mode\", not \"Turn on holiday mode\". The switch already shows the state.",
406
+ "Keep labels positive, so on means yes: \"Email me about low stock\", not \"Do not email me\".",
407
+ "No \"On\" or \"Off\" text beside it; the switch says it.",
408
+ "Apply the change at once and confirm it quietly. If it cannot be saved, flip it back and say why.",
409
+ "When a setting needs a plan or another setting first, say so in its description rather than only disabling it."
410
+ ] })
411
+ }),
412
+ /* @__PURE__ */ jsxs(Section, {
413
+ id: "accessibility",
414
+ title: "Accessibility",
415
+ children: [/* @__PURE__ */ jsx(Guidelines, { items: [
416
+ /* @__PURE__ */ jsxs(Fragment$1, { children: [
417
+ "A native button with ",
418
+ /* @__PURE__ */ jsx("code", { children: "role=\"switch\"" }),
419
+ " and ",
420
+ /* @__PURE__ */ jsx("code", { children: "aria-checked" }),
421
+ ", announced as a switch that is on or off. Space and Enter flip it."
422
+ ] }),
423
+ /* @__PURE__ */ jsxs(Fragment$1, { children: [
424
+ "With ",
425
+ /* @__PURE__ */ jsx("code", { children: "label" }),
426
+ ", the switch and its text sit in one ",
427
+ /* @__PURE__ */ jsx("code", { children: "label" }),
428
+ " element, so the text names the switch. Without one, pass ",
429
+ /* @__PURE__ */ jsx("code", { children: "aria-label" }),
430
+ " or ",
431
+ /* @__PURE__ */ jsx("code", { children: "aria-labelledby" }),
432
+ "."
433
+ ] }),
434
+ /* @__PURE__ */ jsxs(Fragment$1, { children: [
435
+ "Link a description with ",
436
+ /* @__PURE__ */ jsx("code", { children: "aria-describedby" }),
437
+ ", as above."
438
+ ] }),
439
+ "Disabled is native: Tab skips it and its label turns quiet slate.",
440
+ "The focus ring is teal, 2px, offset from the track, for keyboard focus only.",
441
+ "Under reduced motion the thumb does not slide; the colour change still shows the state."
442
+ ] }), /* @__PURE__ */ jsxs(Note, {
443
+ title: "In a form",
444
+ children: [
445
+ "With ",
446
+ /* @__PURE__ */ jsx("code", { children: "name" }),
447
+ " set, a hidden input sends ",
448
+ /* @__PURE__ */ jsx("code", { children: "name=value" }),
449
+ " while the switch is on, and nothing while it is off, like a checkbox. ",
450
+ /* @__PURE__ */ jsx("code", { children: "value" }),
451
+ " defaults to \"on\"."
452
+ ]
453
+ })]
454
+ }),
455
+ /* @__PURE__ */ jsx(Section, {
456
+ id: "props",
457
+ title: "Props",
458
+ description: /* @__PURE__ */ jsxs("p", { children: [
459
+ "Other native button attributes, and the ",
460
+ /* @__PURE__ */ jsx("code", { children: "ref" }),
461
+ ", go to the switch. ",
462
+ /* @__PURE__ */ jsx("code", { children: "className" }),
463
+ " goes to the outer element: the label row when there is a ",
464
+ /* @__PURE__ */ jsx("code", { children: "label" }),
465
+ "."
466
+ ] }),
467
+ children: /* @__PURE__ */ jsx(PropsTable, { rows: [
468
+ {
469
+ name: "checked",
470
+ type: "boolean",
471
+ description: "On or off, when you control it."
472
+ },
473
+ {
474
+ name: "defaultChecked",
475
+ type: "boolean",
476
+ default: "false",
477
+ description: "The starting state when uncontrolled."
478
+ },
479
+ {
480
+ name: "onCheckedChange",
481
+ type: "(checked: boolean) => void",
482
+ description: "Called with the new state on every flip."
483
+ },
484
+ {
485
+ name: "size",
486
+ type: "'sm' | 'md'",
487
+ default: "'md'",
488
+ description: "30 by 17px or 36 by 20px."
489
+ },
490
+ {
491
+ name: "label",
492
+ type: "ReactNode",
493
+ description: "Text to the right. It names the switch, and clicking it flips the switch."
494
+ },
495
+ {
496
+ name: "name",
497
+ type: "string",
498
+ description: "Form field name. The value is sent only while on."
499
+ },
500
+ {
501
+ name: "value",
502
+ type: "string",
503
+ default: "'on'",
504
+ description: "Sent with the form as name=value while on."
505
+ },
506
+ {
507
+ name: "disabled",
508
+ type: "boolean",
509
+ description: "Native disabled: 45%, not focusable."
510
+ }
511
+ ] })
512
+ })
513
+ ]
514
+ });
515
+ }
516
+ //#endregion
517
+ export { Page, Preview };