@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,693 @@
1
+ "use client";
2
+ 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";
3
+ import { t as Playground } from "./Playground-CNbBbErC.js";
4
+ import { useState } from "react";
5
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
6
+ import { Button, Field, Input, Textarea } from "@orbitcommerce/constellation";
7
+ import { CheckCircleIcon } from "@orbitcommerce/constellation/icons";
8
+ //#region src/pages/components/textarea.tsx
9
+ var GIFT = "Happy birthday, Mum! Hope the new chair makes the long days at the desk a little easier. Lots of love, Sam x";
10
+ var SEO = "The Arden ergonomic chair in black mesh, with adjustable lumbar support, 4D arms and a five-year warranty. Free UK delivery on orders over £50, from Leeds.";
11
+ var NOTE = "Customer rang to ask for delivery after 3pm.\nIf nobody answers, leave it with the neighbour at number 12.";
12
+ var RETURNS = `You can return anything within 30 days of delivery, as long as it is unused and in its original packaging.
13
+
14
+ Start a return from your account, or reply to your order email. We will send a prepaid label for orders over £50; under that, returns cost £4.95, taken from your refund.
15
+
16
+ Large items such as desks and storage are collected by our courier. We will email you to book a day.
17
+
18
+ Refunds go back to the card you paid with within 5 working days of the return reaching Leeds.`;
19
+ function Preview() {
20
+ return /* @__PURE__ */ jsx("div", {
21
+ className: "textarea-preview",
22
+ children: /* @__PURE__ */ jsx(Field, {
23
+ label: "Gift message",
24
+ children: /* @__PURE__ */ jsx(Textarea, {
25
+ rows: 2,
26
+ size: "sm",
27
+ showCount: true,
28
+ maxLength: 200,
29
+ defaultValue: GIFT
30
+ })
31
+ })
32
+ });
33
+ }
34
+ var quote = (v) => String(v).replace(/"/g, """);
35
+ var PLAYGROUND = [
36
+ {
37
+ prop: "aria-label",
38
+ type: "text",
39
+ default: "Order note",
40
+ toAttr: (v) => `aria-label="${quote(v)}"`
41
+ },
42
+ {
43
+ prop: "placeholder",
44
+ type: "text",
45
+ default: "Only your team sees notes",
46
+ toAttr: (v) => v ? `placeholder="${quote(v)}"` : null
47
+ },
48
+ {
49
+ prop: "size",
50
+ type: "select",
51
+ options: [
52
+ "sm",
53
+ "md",
54
+ "lg"
55
+ ],
56
+ default: "md"
57
+ },
58
+ {
59
+ prop: "rows",
60
+ type: "select",
61
+ options: [
62
+ "1",
63
+ "2",
64
+ "3",
65
+ "5"
66
+ ],
67
+ default: "3",
68
+ toAttr: (v) => v === "3" ? null : `rows={${v}}`
69
+ },
70
+ {
71
+ prop: "autoGrow",
72
+ type: "boolean",
73
+ default: false,
74
+ toAttr: (v) => v ? "autoGrow maxRows={8}" : null
75
+ },
76
+ {
77
+ prop: "showCount",
78
+ type: "boolean",
79
+ default: false,
80
+ toAttr: (v) => v ? "showCount maxLength={160}" : null
81
+ },
82
+ {
83
+ prop: "invalid",
84
+ type: "boolean",
85
+ default: false
86
+ },
87
+ {
88
+ prop: "readOnly",
89
+ type: "boolean",
90
+ default: false
91
+ },
92
+ {
93
+ prop: "disabled",
94
+ type: "boolean",
95
+ default: false
96
+ }
97
+ ];
98
+ function NoteComposer({ size }) {
99
+ return /* @__PURE__ */ jsxs("div", {
100
+ className: "textarea-composer",
101
+ children: [/* @__PURE__ */ jsx(Textarea, {
102
+ size,
103
+ rows: 1,
104
+ autoGrow: true,
105
+ maxRows: 4,
106
+ "aria-label": "Add a note to order #1043",
107
+ placeholder: "Add a note"
108
+ }), /* @__PURE__ */ jsx(Button, {
109
+ size,
110
+ children: "Add note"
111
+ })]
112
+ });
113
+ }
114
+ function OrderNote() {
115
+ const [note, setNote] = useState(NOTE);
116
+ const [saved, setSaved] = useState();
117
+ const save = (event) => {
118
+ event.preventDefault();
119
+ setSaved(note.trim() ? "Note saved to order #1043" : void 0);
120
+ };
121
+ return /* @__PURE__ */ jsxs("form", {
122
+ className: "textarea-form",
123
+ noValidate: true,
124
+ onSubmit: save,
125
+ children: [/* @__PURE__ */ jsx(Field, {
126
+ label: "Note",
127
+ hint: "Only your team sees it, on the order and the packing slip.",
128
+ children: /* @__PURE__ */ jsx(Textarea, {
129
+ autoGrow: true,
130
+ minRows: 2,
131
+ maxRows: 8,
132
+ value: note,
133
+ onChange: (e) => {
134
+ setNote(e.target.value);
135
+ setSaved(void 0);
136
+ }
137
+ })
138
+ }), /* @__PURE__ */ jsxs("div", {
139
+ className: "textarea-form__footer",
140
+ children: [/* @__PURE__ */ jsx("span", {
141
+ role: "status",
142
+ className: "textarea-status",
143
+ children: saved ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(CheckCircleIcon, {
144
+ weight: "fill",
145
+ "aria-hidden": "true"
146
+ }), saved] }) : null
147
+ }), /* @__PURE__ */ jsx(Button, {
148
+ type: "submit",
149
+ variant: "primary",
150
+ children: "Save note"
151
+ })]
152
+ })]
153
+ });
154
+ }
155
+ function SeoDescription() {
156
+ const [text, setText] = useState(SEO);
157
+ return /* @__PURE__ */ jsx("div", {
158
+ className: "textarea-stack",
159
+ children: /* @__PURE__ */ jsx(Field, {
160
+ label: "Search engine description",
161
+ hint: "Shown under the page title in search results.",
162
+ children: /* @__PURE__ */ jsx(Textarea, {
163
+ rows: 3,
164
+ showCount: true,
165
+ maxLength: 160,
166
+ value: text,
167
+ onChange: (e) => setText(e.target.value)
168
+ })
169
+ })
170
+ });
171
+ }
172
+ function ReturnReason() {
173
+ const [reason, setReason] = useState("");
174
+ const [error, setError] = useState();
175
+ const [sent, setSent] = useState(false);
176
+ const send = (event) => {
177
+ event.preventDefault();
178
+ const problem = reason.trim().length < 10 ? "Tell us a little more about what is wrong, so we can sort it quickly" : void 0;
179
+ setError(problem);
180
+ setSent(!problem);
181
+ };
182
+ return /* @__PURE__ */ jsxs("form", {
183
+ className: "textarea-form",
184
+ noValidate: true,
185
+ onSubmit: send,
186
+ children: [/* @__PURE__ */ jsx(Field, {
187
+ label: "What is wrong with it?",
188
+ hint: "A sentence or two is plenty.",
189
+ error,
190
+ children: /* @__PURE__ */ jsx(Textarea, {
191
+ rows: 3,
192
+ placeholder: "For example, a caster arrived cracked",
193
+ value: reason,
194
+ onChange: (e) => {
195
+ setReason(e.target.value);
196
+ setError(void 0);
197
+ setSent(false);
198
+ }
199
+ })
200
+ }), /* @__PURE__ */ jsxs("div", {
201
+ className: "textarea-form__footer",
202
+ children: [/* @__PURE__ */ jsx("span", {
203
+ role: "status",
204
+ className: "textarea-status",
205
+ children: sent ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(CheckCircleIcon, {
206
+ weight: "fill",
207
+ "aria-hidden": "true"
208
+ }), "Return started for order #1043"] }) : null
209
+ }), /* @__PURE__ */ jsx(Button, {
210
+ type: "submit",
211
+ variant: "primary",
212
+ children: "Start return"
213
+ })]
214
+ })]
215
+ });
216
+ }
217
+ function Page() {
218
+ return /* @__PURE__ */ jsxs(DocPage, {
219
+ title: "Textarea",
220
+ status: "new",
221
+ importNames: ["Textarea"],
222
+ lead: "A multi-line text field, for notes, messages and descriptions: anything longer than a line. It is the Input's frame, and it can grow with its text and count characters against a limit.",
223
+ children: [
224
+ /* @__PURE__ */ jsx(Section, {
225
+ id: "playground",
226
+ title: "Playground",
227
+ description: /* @__PURE__ */ jsx("p", { children: "Change the props, then type a few lines. With autoGrow on, the field grows to eight rows and then scrolls." }),
228
+ children: /* @__PURE__ */ jsx(Playground, {
229
+ component: "Textarea",
230
+ controls: PLAYGROUND,
231
+ minHeight: 240,
232
+ render: (v) => /* @__PURE__ */ jsx("div", {
233
+ className: "textarea-stage",
234
+ children: /* @__PURE__ */ jsx(Textarea, {
235
+ "aria-label": String(v["aria-label"]),
236
+ placeholder: String(v.placeholder) || void 0,
237
+ size: v.size,
238
+ rows: Number(v.rows),
239
+ autoGrow: Boolean(v.autoGrow),
240
+ maxRows: v.autoGrow ? 8 : void 0,
241
+ showCount: Boolean(v.showCount),
242
+ maxLength: v.showCount ? 160 : void 0,
243
+ invalid: Boolean(v.invalid),
244
+ readOnly: Boolean(v.readOnly),
245
+ disabled: Boolean(v.disabled)
246
+ }, `${String(v.autoGrow)}-${String(v.rows)}`)
247
+ })
248
+ })
249
+ }),
250
+ /* @__PURE__ */ jsx(Section, {
251
+ id: "field",
252
+ title: "With a field",
253
+ description: /* @__PURE__ */ jsxs("p", { children: [
254
+ "Put it in a ",
255
+ /* @__PURE__ */ jsx("code", { children: "Field" }),
256
+ " for a label above and a hint below, as with an Input: the label points at the textarea, the hint becomes its description, and an error marks it invalid. Set ",
257
+ /* @__PURE__ */ jsx("code", { children: "rows" }),
258
+ " to the length of answer you expect; three is the default."
259
+ ] }),
260
+ children: /* @__PURE__ */ jsx(Example, {
261
+ code: `
262
+ <Field label="Gift message" hint="Printed on a card in the parcel.">
263
+ <Textarea rows={3} showCount maxLength={200} defaultValue="Happy birthday, Mum! ..." />
264
+ </Field>`,
265
+ children: /* @__PURE__ */ jsx("div", {
266
+ className: "textarea-stack",
267
+ children: /* @__PURE__ */ jsx(Field, {
268
+ label: "Gift message",
269
+ hint: "Printed on a card in the parcel.",
270
+ children: /* @__PURE__ */ jsx(Textarea, {
271
+ rows: 3,
272
+ showCount: true,
273
+ maxLength: 200,
274
+ defaultValue: GIFT
275
+ })
276
+ })
277
+ })
278
+ })
279
+ }),
280
+ /* @__PURE__ */ jsx(Section, {
281
+ id: "sizes",
282
+ title: "Sizes",
283
+ description: /* @__PURE__ */ jsxs("p", { children: [
284
+ /* @__PURE__ */ jsx("code", { children: "sm" }),
285
+ ", ",
286
+ /* @__PURE__ */ jsx("code", { children: "md" }),
287
+ " (default) and ",
288
+ /* @__PURE__ */ jsx("code", { children: "lg" }),
289
+ " take the Input's 13, 14 and 15px text. Lines run on a fixed rhythm, so one row is exactly as tall as an Input of the same size (30, 36 or 44px). A one-row field that grows sits on a line with its button, and stays lined up with it until the text wraps."
290
+ ] }),
291
+ children: /* @__PURE__ */ jsx(Example, {
292
+ code: `
293
+ <Textarea size="sm" rows={1} autoGrow maxRows={4} aria-label="Add a note to order #1043" placeholder="Add a note" />
294
+ <Button size="sm">Add note</Button>
295
+
296
+ <Textarea rows={1} autoGrow maxRows={4} aria-label="Add a note to order #1043" placeholder="Add a note" />
297
+ <Button>Add note</Button>
298
+
299
+ <Textarea size="lg" rows={1} autoGrow maxRows={4} aria-label="Add a note to order #1043" placeholder="Add a note" />
300
+ <Button size="lg">Add note</Button>`,
301
+ children: /* @__PURE__ */ jsxs("div", {
302
+ className: "textarea-sizes",
303
+ children: [
304
+ /* @__PURE__ */ jsx(NoteComposer, { size: "sm" }),
305
+ /* @__PURE__ */ jsx(NoteComposer, { size: "md" }),
306
+ /* @__PURE__ */ jsx(NoteComposer, { size: "lg" })
307
+ ]
308
+ })
309
+ })
310
+ }),
311
+ /* @__PURE__ */ jsx(Section, {
312
+ id: "auto-grow",
313
+ title: "Auto-grow",
314
+ description: /* @__PURE__ */ jsxs("p", { children: [
315
+ /* @__PURE__ */ jsx("code", { children: "autoGrow" }),
316
+ " fits the field to its text, from ",
317
+ /* @__PURE__ */ jsx("code", { children: "minRows" }),
318
+ " (or ",
319
+ /* @__PURE__ */ jsx("code", { children: "rows" }),
320
+ ") up to",
321
+ " ",
322
+ /* @__PURE__ */ jsx("code", { children: "maxRows" }),
323
+ ", then scrolls. It is measured by a hidden copy of the text set in the same place, so the page never jumps as the field grows, and the resize handle goes. Type a few more lines into this note."
324
+ ] }),
325
+ children: /* @__PURE__ */ jsx(Example, {
326
+ code: `
327
+ const [note, setNote] = useState('Customer rang to ask for delivery after 3pm. ...')
328
+
329
+ <Field label="Note" hint="Only your team sees it, on the order and the packing slip.">
330
+ <Textarea autoGrow minRows={2} maxRows={8} value={note} onChange={(e) => setNote(e.target.value)} />
331
+ </Field>`,
332
+ children: /* @__PURE__ */ jsx(OrderNote, {})
333
+ })
334
+ }),
335
+ /* @__PURE__ */ jsxs(Section, {
336
+ id: "count",
337
+ title: "Character count",
338
+ description: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("p", { children: [
339
+ /* @__PURE__ */ jsx("code", { children: "showCount" }),
340
+ " puts a count in the frame's bottom corner: the characters typed, out of",
341
+ " ",
342
+ /* @__PURE__ */ jsx("code", { children: "maxLength" }),
343
+ " when there is one. It stays quiet until the last tenth of the limit, then takes the warning wash; the browser stops typing at the limit itself. A value set in code that runs over turns it red."
344
+ ] }), /* @__PURE__ */ jsx("p", { children: "This description starts 5 short of its 160: delete a few words, or add some." })] }),
345
+ children: [
346
+ /* @__PURE__ */ jsx(Example, {
347
+ code: `
348
+ <Field label="Search engine description" hint="Shown under the page title in search results.">
349
+ <Textarea rows={3} showCount maxLength={160} value={text} onChange={(e) => setText(e.target.value)} />
350
+ </Field>`,
351
+ children: /* @__PURE__ */ jsx(SeoDescription, {})
352
+ }),
353
+ /* @__PURE__ */ jsx(DocTable, {
354
+ columns: [
355
+ "Count",
356
+ "Looks",
357
+ "Screen readers"
358
+ ],
359
+ rows: [
360
+ [
361
+ "Up to 90% of the limit",
362
+ "Quiet slate digits",
363
+ "Read with the field: \"12 characters left\""
364
+ ],
365
+ [
366
+ "The last 10%",
367
+ "Digits on the warning wash",
368
+ "Announced politely as they change"
369
+ ],
370
+ [
371
+ "Over the limit (set in code)",
372
+ "Digits on a red wash",
373
+ "Announced: \"3 characters too many\""
374
+ ]
375
+ ]
376
+ }),
377
+ /* @__PURE__ */ jsxs(Note, { children: [
378
+ "The spoken words come from ",
379
+ /* @__PURE__ */ jsx("code", { children: "countLabel" }),
380
+ ", a function of the length and the limit. Pass your own to translate them."
381
+ ] })
382
+ ]
383
+ }),
384
+ /* @__PURE__ */ jsxs(Section, {
385
+ id: "states",
386
+ title: "States",
387
+ description: /* @__PURE__ */ jsx("p", { children: "The Input's states, many lines tall. Hover firms the hairline; focus turns it teal with the soft halo; an error in the Field swaps the teal for red. Read-only and disabled sink into the well: a read-only field can still be selected and copied." }),
388
+ children: [
389
+ /* @__PURE__ */ jsx(Example, {
390
+ align: "fill",
391
+ code: `
392
+ <Field label="Packing instructions">
393
+ <Textarea rows={2} placeholder="For example, wrap the legs separately" />
394
+ </Field>
395
+ <Field label="Packing instructions">
396
+ <Textarea rows={2} defaultValue="Wrap the chair base in two layers of bubble wrap." />
397
+ </Field>
398
+ <Field label="Reason for the refund" error="Enter a reason, so the customer knows why">
399
+ <Textarea rows={2} />
400
+ </Field>
401
+ <Field label="Customer's note" hint="Left at checkout">
402
+ <Textarea rows={2} readOnly value="Please leave the parcel in the porch. The doorbell does not work." />
403
+ </Field>
404
+ <Field label="Gift message" hint="Turn on Gift wrap to add a message">
405
+ <Textarea rows={2} disabled />
406
+ </Field>`,
407
+ caption: "Empty, filled, invalid, read-only and disabled.",
408
+ children: /* @__PURE__ */ jsxs("div", {
409
+ className: "textarea-grid",
410
+ children: [
411
+ /* @__PURE__ */ jsx(Field, {
412
+ label: "Packing instructions",
413
+ children: /* @__PURE__ */ jsx(Textarea, {
414
+ rows: 2,
415
+ placeholder: "For example, wrap the legs separately"
416
+ })
417
+ }),
418
+ /* @__PURE__ */ jsx(Field, {
419
+ label: "Packing instructions",
420
+ children: /* @__PURE__ */ jsx(Textarea, {
421
+ rows: 2,
422
+ defaultValue: "Wrap the chair base in two layers of bubble wrap."
423
+ })
424
+ }),
425
+ /* @__PURE__ */ jsx(Field, {
426
+ label: "Reason for the refund",
427
+ error: "Enter a reason, so the customer knows why",
428
+ children: /* @__PURE__ */ jsx(Textarea, { rows: 2 })
429
+ }),
430
+ /* @__PURE__ */ jsx(Field, {
431
+ label: "Customer's note",
432
+ hint: "Left at checkout",
433
+ children: /* @__PURE__ */ jsx(Textarea, {
434
+ rows: 2,
435
+ readOnly: true,
436
+ value: "Please leave the parcel in the porch. The doorbell does not work."
437
+ })
438
+ }),
439
+ /* @__PURE__ */ jsx(Field, {
440
+ label: "Gift message",
441
+ hint: "Turn on Gift wrap to add a message",
442
+ children: /* @__PURE__ */ jsx(Textarea, {
443
+ rows: 2,
444
+ disabled: true
445
+ })
446
+ })
447
+ ]
448
+ })
449
+ }),
450
+ /* @__PURE__ */ jsx(SubSection, {
451
+ title: "Errors",
452
+ description: /* @__PURE__ */ jsx("p", { children: "Check when the form is sent and clear the error as soon as the person starts fixing it. Press Start return with the field empty." }),
453
+ children: /* @__PURE__ */ jsx(Example, {
454
+ code: `
455
+ <Field label="What is wrong with it?" hint="A sentence or two is plenty." error={error}>
456
+ <Textarea
457
+ rows={3}
458
+ placeholder="For example, a caster arrived cracked"
459
+ value={reason}
460
+ onChange={(e) => {
461
+ setReason(e.target.value)
462
+ setError(undefined)
463
+ }}
464
+ />
465
+ </Field>`,
466
+ children: /* @__PURE__ */ jsx(ReturnReason, {})
467
+ })
468
+ }),
469
+ /* @__PURE__ */ jsx(SubSection, {
470
+ title: "Long content",
471
+ description: /* @__PURE__ */ jsx("p", { children: "Past its most rows, a field that grows scrolls inside its frame, and the frame keeps its edge whole." }),
472
+ children: /* @__PURE__ */ jsx(Example, {
473
+ code: `<Textarea autoGrow minRows={3} maxRows={6} defaultValue={returnsPolicy} aria-label="Returns policy" />`,
474
+ children: /* @__PURE__ */ jsx("div", {
475
+ className: "textarea-stage",
476
+ children: /* @__PURE__ */ jsx(Textarea, {
477
+ autoGrow: true,
478
+ minRows: 3,
479
+ maxRows: 6,
480
+ defaultValue: RETURNS,
481
+ "aria-label": "Returns policy"
482
+ })
483
+ })
484
+ })
485
+ })
486
+ ]
487
+ }),
488
+ /* @__PURE__ */ jsx(Section, {
489
+ id: "both-themes",
490
+ title: "In both themes",
491
+ description: /* @__PURE__ */ jsx("p", { children: "A count in its warning wash, an error and a disabled field, light and dark side by side." }),
492
+ children: /* @__PURE__ */ jsx(ThemePair, {
493
+ align: "fill",
494
+ children: /* @__PURE__ */ jsxs("div", {
495
+ className: "textarea-pair",
496
+ children: [
497
+ /* @__PURE__ */ jsx(Field, {
498
+ label: "Search engine description",
499
+ children: /* @__PURE__ */ jsx(Textarea, {
500
+ rows: 3,
501
+ showCount: true,
502
+ maxLength: 160,
503
+ defaultValue: SEO
504
+ })
505
+ }),
506
+ /* @__PURE__ */ jsx(Field, {
507
+ label: "Reason for the refund",
508
+ error: "Enter a reason, so the customer knows why",
509
+ children: /* @__PURE__ */ jsx(Textarea, { rows: 2 })
510
+ }),
511
+ /* @__PURE__ */ jsx(Field, {
512
+ label: "Gift message",
513
+ hint: "Turn on Gift wrap to add a message",
514
+ children: /* @__PURE__ */ jsx(Textarea, {
515
+ rows: 2,
516
+ disabled: true
517
+ })
518
+ })
519
+ ]
520
+ })
521
+ })
522
+ }),
523
+ /* @__PURE__ */ jsxs(Section, {
524
+ id: "guidelines",
525
+ title: "Guidelines",
526
+ children: [
527
+ /* @__PURE__ */ jsx(DoDont, {
528
+ do: {
529
+ children: /* @__PURE__ */ jsx("div", {
530
+ className: "textarea-dodont",
531
+ children: /* @__PURE__ */ jsx(Field, {
532
+ label: "Note",
533
+ children: /* @__PURE__ */ jsx(Textarea, {
534
+ rows: 2,
535
+ defaultValue: "Customer rang to ask for delivery after 3pm."
536
+ })
537
+ })
538
+ }),
539
+ caption: "Free text with no set shape: a note, a message, a reason."
540
+ },
541
+ dont: {
542
+ children: /* @__PURE__ */ jsx("div", {
543
+ className: "textarea-dodont",
544
+ children: /* @__PURE__ */ jsx(Field, {
545
+ label: "Delivery address",
546
+ children: /* @__PURE__ */ jsx(Textarea, {
547
+ rows: 3,
548
+ defaultValue: "14 Mill Lane\nLeeds\nLS1 4AB"
549
+ })
550
+ })
551
+ }),
552
+ caption: "Structured answers in one box. An address is separate fields, so it can be checked and used."
553
+ }
554
+ }),
555
+ /* @__PURE__ */ jsx(DoDont, {
556
+ do: {
557
+ children: /* @__PURE__ */ jsx("div", {
558
+ className: "textarea-dodont",
559
+ children: /* @__PURE__ */ jsx(Field, {
560
+ label: "Product title",
561
+ children: /* @__PURE__ */ jsx(Input, { defaultValue: "Arden ergonomic chair" })
562
+ })
563
+ }),
564
+ caption: "One line of answer gets an Input."
565
+ },
566
+ dont: {
567
+ children: /* @__PURE__ */ jsx("div", {
568
+ className: "textarea-dodont",
569
+ children: /* @__PURE__ */ jsx(Field, {
570
+ label: "Product title",
571
+ children: /* @__PURE__ */ jsx(Textarea, {
572
+ rows: 4,
573
+ defaultValue: "Arden ergonomic chair"
574
+ })
575
+ })
576
+ }),
577
+ caption: "A tall box asks for more than the answer needs."
578
+ }
579
+ }),
580
+ /* @__PURE__ */ jsx(Guidelines, { items: [
581
+ "Size the field to the answer you expect: two or three rows for a note, more for a description. Let it grow rather than making it huge.",
582
+ /* @__PURE__ */ jsx(Fragment$1, { children: "Show a count only when there is a limit that matters, such as a search description or an SMS. Say what the limit is for in the hint." }),
583
+ "A placeholder gives an example of a good answer; it never replaces the label.",
584
+ "Long formatted copy (product descriptions, blog posts) belongs in the rich text editor, not here."
585
+ ] })
586
+ ]
587
+ }),
588
+ /* @__PURE__ */ jsx(Section, {
589
+ id: "accessibility",
590
+ title: "Accessibility",
591
+ children: /* @__PURE__ */ jsx(Guidelines, { items: [
592
+ "A native textarea: everything the browser and assistive tech know about text fields works, including spellcheck and dictation.",
593
+ /* @__PURE__ */ jsxs(Fragment$1, { children: [
594
+ "In a Field, the label names it and the hint or error describes it. An error also sets ",
595
+ /* @__PURE__ */ jsx("code", { children: "aria-invalid" }),
596
+ ". Outside a Field, give it an ",
597
+ /* @__PURE__ */ jsx("code", { children: "aria-label" }),
598
+ "."
599
+ ] }),
600
+ "With a limit, the count is part of its description, so it is read with the field. In the last tenth it is announced politely as it changes, never on every key press before that.",
601
+ "The visible digits are hidden from screen readers; they hear words instead, from countLabel.",
602
+ "Clicking anywhere in the frame, the count included, puts the caret in the field.",
603
+ "Focus shows as a teal edge with a soft halo round the whole frame."
604
+ ] })
605
+ }),
606
+ /* @__PURE__ */ jsxs(Section, {
607
+ id: "props",
608
+ title: "Props",
609
+ children: [
610
+ /* @__PURE__ */ jsx(PropsTable, { rows: [
611
+ {
612
+ name: "size",
613
+ type: "'sm' | 'md' | 'lg'",
614
+ default: "'md'",
615
+ description: "Text of 13, 14 or 15px; one row is 30, 36 or 44px tall, as an Input."
616
+ },
617
+ {
618
+ name: "rows",
619
+ type: "number",
620
+ default: "3",
621
+ description: "Height in rows. With autoGrow, the fewest rows unless minRows is set."
622
+ },
623
+ {
624
+ name: "autoGrow",
625
+ type: "boolean",
626
+ default: "false",
627
+ description: "Grow with the text, then scroll. Removes the resize handle."
628
+ },
629
+ {
630
+ name: "minRows",
631
+ type: "number",
632
+ description: "With autoGrow: the fewest rows. Defaults to rows, or 3."
633
+ },
634
+ {
635
+ name: "maxRows",
636
+ type: "number",
637
+ description: "With autoGrow: the most rows before it scrolls. No limit when left out."
638
+ },
639
+ {
640
+ name: "showCount",
641
+ type: "boolean",
642
+ default: "false",
643
+ description: "A character count in the bottom corner, out of maxLength when set."
644
+ },
645
+ {
646
+ name: "maxLength",
647
+ type: "number",
648
+ description: "The native limit. The count warns in its last tenth."
649
+ },
650
+ {
651
+ name: "countLabel",
652
+ type: "(length, maxLength) => string",
653
+ description: "Words screen readers hear for the count. Defaults to \"12 characters left\"."
654
+ },
655
+ {
656
+ name: "invalid",
657
+ type: "boolean",
658
+ description: "Red edge and aria-invalid. In a Field, follows its error; aria-invalid works too."
659
+ },
660
+ {
661
+ name: "readOnly",
662
+ type: "boolean",
663
+ description: "Sinks into the well; still focusable and copyable."
664
+ },
665
+ {
666
+ name: "disabled",
667
+ type: "boolean",
668
+ description: "Sinks into the well and dims; skipped by Tab."
669
+ }
670
+ ] }),
671
+ /* @__PURE__ */ jsxs("p", {
672
+ className: "doc-section__description",
673
+ children: [
674
+ "Every other native textarea attribute, and the ",
675
+ /* @__PURE__ */ jsx("code", { children: "ref" }),
676
+ ", go to the ",
677
+ /* @__PURE__ */ jsx("code", { children: "textarea" }),
678
+ ".",
679
+ " ",
680
+ /* @__PURE__ */ jsx("code", { children: "className" }),
681
+ " and ",
682
+ /* @__PURE__ */ jsx("code", { children: "style" }),
683
+ " go to the frame around it."
684
+ ]
685
+ }),
686
+ /* @__PURE__ */ jsx(Fragment$1, {})
687
+ ]
688
+ })
689
+ ]
690
+ });
691
+ }
692
+ //#endregion
693
+ export { Page, Preview };