@tempoxyz/ds 0.3.9 → 0.3.11

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 (128) hide show
  1. package/dist/docs/AGENTS.md +9 -0
  2. package/dist/docs/components/accordion.md +489 -0
  3. package/dist/docs/components/address-card.md +147 -0
  4. package/dist/docs/components/agent-logo.md +194 -0
  5. package/dist/docs/components/alert-dialog.md +631 -0
  6. package/dist/docs/components/alert.md +448 -0
  7. package/dist/docs/components/amount-input.md +305 -0
  8. package/dist/docs/components/amount.md +794 -0
  9. package/dist/docs/components/app-shell.md +559 -0
  10. package/dist/docs/components/asset-chip.md +294 -0
  11. package/dist/docs/components/autocomplete.md +619 -0
  12. package/dist/docs/components/avatar.md +321 -0
  13. package/dist/docs/components/badge.md +339 -0
  14. package/dist/docs/components/badged-logo.md +116 -0
  15. package/dist/docs/components/banner.md +379 -0
  16. package/dist/docs/components/bar-chart.md +208 -0
  17. package/dist/docs/components/breadcrumbs.md +380 -0
  18. package/dist/docs/components/button-group.md +286 -0
  19. package/dist/docs/components/button.md +650 -0
  20. package/dist/docs/components/calendar.md +375 -0
  21. package/dist/docs/components/callout.md +96 -0
  22. package/dist/docs/components/checkbox-group.md +521 -0
  23. package/dist/docs/components/checkbox.md +467 -0
  24. package/dist/docs/components/choice-group.md +516 -0
  25. package/dist/docs/components/choicebox.md +641 -0
  26. package/dist/docs/components/code.md +100 -0
  27. package/dist/docs/components/combobox.md +939 -0
  28. package/dist/docs/components/container.md +257 -0
  29. package/dist/docs/components/copy-button.md +642 -0
  30. package/dist/docs/components/date-picker.md +514 -0
  31. package/dist/docs/components/dialog.md +1332 -0
  32. package/dist/docs/components/drawer.md +966 -0
  33. package/dist/docs/components/empty.md +340 -0
  34. package/dist/docs/components/field.md +570 -0
  35. package/dist/docs/components/fieldset.md +398 -0
  36. package/dist/docs/components/frame.md +434 -0
  37. package/dist/docs/components/gauge.md +299 -0
  38. package/dist/docs/components/get-started-visual.md +117 -0
  39. package/dist/docs/components/grid.md +288 -0
  40. package/dist/docs/components/hero-visual.md +155 -0
  41. package/dist/docs/components/hex.md +487 -0
  42. package/dist/docs/components/icon-tile.md +292 -0
  43. package/dist/docs/components/identicon.md +371 -0
  44. package/dist/docs/components/inline.md +233 -0
  45. package/dist/docs/components/inset.md +225 -0
  46. package/dist/docs/components/kbd.md +423 -0
  47. package/dist/docs/components/list-group.md +981 -0
  48. package/dist/docs/components/loading-dots.md +237 -0
  49. package/dist/docs/components/menu.md +934 -0
  50. package/dist/docs/components/native-select.md +204 -0
  51. package/dist/docs/components/network-logo.md +248 -0
  52. package/dist/docs/components/number-field.md +543 -0
  53. package/dist/docs/components/otp-field.md +616 -0
  54. package/dist/docs/components/pagination.md +516 -0
  55. package/dist/docs/components/popover.md +544 -0
  56. package/dist/docs/components/progress.md +388 -0
  57. package/dist/docs/components/qr.md +314 -0
  58. package/dist/docs/components/radio-group.md +528 -0
  59. package/dist/docs/components/secret-value.md +406 -0
  60. package/dist/docs/components/select.md +751 -0
  61. package/dist/docs/components/separator.md +379 -0
  62. package/dist/docs/components/sidebar-menu.md +922 -0
  63. package/dist/docs/components/skeleton.md +517 -0
  64. package/dist/docs/components/slider.md +539 -0
  65. package/dist/docs/components/snippet.md +424 -0
  66. package/dist/docs/components/spinner.md +216 -0
  67. package/dist/docs/components/split-bar.md +139 -0
  68. package/dist/docs/components/split-button.md +464 -0
  69. package/dist/docs/components/stack.md +299 -0
  70. package/dist/docs/components/status-chip.md +226 -0
  71. package/dist/docs/components/status-indicator.md +119 -0
  72. package/dist/docs/components/status-row.md +174 -0
  73. package/dist/docs/components/stepper.md +451 -0
  74. package/dist/docs/components/success-hero.md +157 -0
  75. package/dist/docs/components/surface.md +639 -0
  76. package/dist/docs/components/switch.md +472 -0
  77. package/dist/docs/components/table.md +967 -0
  78. package/dist/docs/components/tabs.md +627 -0
  79. package/dist/docs/components/tempo-logo.md +185 -0
  80. package/dist/docs/components/text-input.md +624 -0
  81. package/dist/docs/components/textarea.md +352 -0
  82. package/dist/docs/components/toast.md +535 -0
  83. package/dist/docs/components/token-logo.md +371 -0
  84. package/dist/docs/components/token.md +247 -0
  85. package/dist/docs/components/tooltip.md +490 -0
  86. package/dist/docs/components/verification-code.md +116 -0
  87. package/dist/docs/components/visual.md +249 -0
  88. package/dist/docs/components.md +203 -0
  89. package/dist/docs/foundations/accessibility.md +377 -0
  90. package/dist/docs/foundations/agents.md +150 -0
  91. package/dist/docs/foundations/color.md +522 -0
  92. package/dist/docs/foundations/content/tone.md +194 -0
  93. package/dist/docs/foundations/content/voice.md +194 -0
  94. package/dist/docs/foundations/content/writing-style.md +406 -0
  95. package/dist/docs/foundations/iconography.md +282 -0
  96. package/dist/docs/foundations/intent.md +360 -0
  97. package/dist/docs/foundations/layout.md +508 -0
  98. package/dist/docs/foundations/linter.md +296 -0
  99. package/dist/docs/foundations/motion.md +151 -0
  100. package/dist/docs/foundations/radius-and-padding.md +86 -0
  101. package/dist/docs/foundations/typography.md +266 -0
  102. package/dist/docs/index.md +137 -0
  103. package/dist/docs/introduction/faq.md +132 -0
  104. package/dist/docs/introduction/getting-started.md +377 -0
  105. package/dist/docs/patterns/blockchain-values.md +709 -0
  106. package/dist/docs/patterns/dashboards.md +638 -0
  107. package/dist/docs/patterns/destructive-actions.md +626 -0
  108. package/dist/docs/patterns/empty-states.md +612 -0
  109. package/dist/docs/patterns/errors-and-validation.md +808 -0
  110. package/dist/docs/patterns/feedback-and-status.md +518 -0
  111. package/dist/docs/patterns/forms.md +679 -0
  112. package/dist/docs/patterns/loading.md +630 -0
  113. package/dist/docs/patterns/navigation.md +397 -0
  114. package/dist/docs/patterns/payments.md +765 -0
  115. package/dist/docs/patterns/responsive-layout.md +997 -0
  116. package/dist/docs/patterns/tables-and-lists.md +964 -0
  117. package/dist/docs/products/tempo-console.md +671 -0
  118. package/dist/docs/products/tempo-performance.md +437 -0
  119. package/dist/docs/products/tempo-wallet.md +438 -0
  120. package/dist/web/components/OtpField.css +1 -1
  121. package/dist/web/components/OtpField.d.ts +1 -1
  122. package/dist/web/components/OtpField.d.ts.map +1 -1
  123. package/dist/web/components/OtpField.js +3 -4
  124. package/dist/web/components/OtpField.js.map +1 -1
  125. package/dist/web/components/OtpField.js.zyzz.json +1 -1
  126. package/dist/web/index.js.zyzz.json +1 -1
  127. package/package.json +1 -1
  128. package/src/web/components/OtpField.tsx +2 -24
@@ -0,0 +1,619 @@
1
+ # Autocomplete
2
+
3
+ A text input that suggests values while people type.
4
+
5
+ [View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/Autocomplete.tsx)
6
+
7
+ ## Overview
8
+
9
+ A text input with a suggestion list. Any typed string is a valid value, so suggestions only speed up entry.
10
+
11
+ ## Examples
12
+
13
+ ### Basic
14
+
15
+ ```tsx
16
+ import { Autocomplete } from '@tempoxyz/ds'
17
+
18
+ const actions = ['Send payment', 'Send request', 'Swap tokens', 'View activity']
19
+
20
+ export function Demo() {
21
+ return (
22
+ <Autocomplete.Root items={actions}>
23
+ <Autocomplete.InputGroup>
24
+ <Autocomplete.Input aria-label="Search" placeholder="Search actions" />
25
+ <Autocomplete.Clear />
26
+ </Autocomplete.InputGroup>
27
+ <Autocomplete.Popup>
28
+ <Autocomplete.Empty>No matches</Autocomplete.Empty>
29
+ <Autocomplete.List>
30
+ {(action: string) => (
31
+ <Autocomplete.Item key={action} value={action}>
32
+ {action}
33
+ </Autocomplete.Item>
34
+ )}
35
+ </Autocomplete.List>
36
+ </Autocomplete.Popup>
37
+ </Autocomplete.Root>
38
+ )
39
+ }
40
+ ```
41
+
42
+ [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Autocomplete/Basic.tsx)
43
+
44
+ ## Anatomy
45
+
46
+ Import the component and assemble its parts.
47
+
48
+ ```tsx
49
+ import { Autocomplete } from '@tempoxyz/ds'
50
+
51
+ <Autocomplete.Root>
52
+ <Autocomplete.InputGroup>
53
+ <Autocomplete.Input />
54
+ <Autocomplete.Clear />
55
+ </Autocomplete.InputGroup>
56
+ <Autocomplete.Popup>
57
+ <Autocomplete.Empty />
58
+ <Autocomplete.List>
59
+ <Autocomplete.Group>
60
+ <Autocomplete.GroupLabel />
61
+ <Autocomplete.Collection>
62
+ <Autocomplete.Item />
63
+ </Autocomplete.Collection>
64
+ </Autocomplete.Group>
65
+ <Autocomplete.Separator />
66
+ </Autocomplete.List>
67
+ </Autocomplete.Popup>
68
+ </Autocomplete.Root>
69
+ ```
70
+
71
+ ## Guidelines
72
+
73
+ ### When to Use
74
+
75
+ * Enter free text with suggested values, such as a recipient address with recent recipients below it.
76
+ * Search actions or pages from one field, such as Send payment or View activity.
77
+
78
+ ### When Not to Use
79
+
80
+ * If the value must be one of the items, such as the asset to send, use [Combobox](/docs/components/combobox).
81
+ * Use [Select](/docs/components/select) for a short list of fixed options.
82
+ * If there is nothing useful to suggest, use [TextInput](/docs/components/text-input).
83
+
84
+ ### Accept Any Typed Value
85
+
86
+ Validate the text as you would a plain [TextInput](/docs/components/text-input), such as a 0x prefix on an address, and explain problems in a `Field.Error`.
87
+
88
+ **Do:** Accept a new 0x address that isn't among the suggestions.
89
+
90
+ ```tsx
91
+ /**
92
+ * Do example for "Accept Any Typed Value" on the Autocomplete page.
93
+ * Accept a new 0x address that isn't among the suggestions.
94
+ * @module
95
+ */
96
+ import { Autocomplete, Field, style } from '@tempoxyz/ds'
97
+
98
+ const recipients = ['alice.tempo', 'payroll.tempo']
99
+
100
+ /** Renders the static preview, which the guideline card shows inert. */
101
+ export function Demo() {
102
+ return (
103
+ <Field.Root {...styles.field()}>
104
+ <Field.Label>Recipient</Field.Label>
105
+ <Autocomplete.Root defaultValue="0x8f3a…c21d" items={recipients}>
106
+ <Autocomplete.InputGroup>
107
+ <Autocomplete.Input placeholder="Name or 0x address" />
108
+ </Autocomplete.InputGroup>
109
+ </Autocomplete.Root>
110
+ <Field.Description>A new address. Check it before you send.</Field.Description>
111
+ </Field.Root>
112
+ )
113
+ }
114
+
115
+ namespace styles {
116
+ export const field = style({ maxWidth: '16rem !custom', width: '100% !custom' })
117
+ }
118
+ ```
119
+
120
+ **Don't:** Clear or reject text because it doesn't match a suggestion.
121
+
122
+ ```tsx
123
+ /**
124
+ * Don't example for "Accept Any Typed Value" on the Autocomplete page.
125
+ * Don't clear or reject text because it doesn't match a suggestion.
126
+ * @module
127
+ */
128
+ import { Autocomplete, Field, style } from '@tempoxyz/ds'
129
+
130
+ const recipients = ['alice.tempo', 'payroll.tempo']
131
+
132
+ /** Renders the static preview, which the guideline card shows inert. */
133
+ export function Demo() {
134
+ return (
135
+ <Field.Root invalid {...styles.field()}>
136
+ <Field.Label>Recipient</Field.Label>
137
+ <Autocomplete.Root defaultValue="0x8f3a…c21d" items={recipients}>
138
+ <Autocomplete.InputGroup invalid>
139
+ <Autocomplete.Input aria-invalid placeholder="Name or 0x address" />
140
+ </Autocomplete.InputGroup>
141
+ </Autocomplete.Root>
142
+ <Field.Error match>Select a saved recipient</Field.Error>
143
+ </Field.Root>
144
+ )
145
+ }
146
+
147
+ namespace styles {
148
+ export const field = style({ maxWidth: '16rem !custom', width: '100% !custom' })
149
+ }
150
+ ```
151
+
152
+ ### Suggest Likely Values
153
+
154
+ * **`items`:** Filters automatically.
155
+ * **`filteredItems`:** Accepts items you filter yourself, such as results from a server.
156
+
157
+ **Do:** List recent, frequent, or saved values first, such as the last few recipients.
158
+
159
+ ```tsx
160
+ /**
161
+ * Do example for "Suggest Likely Values" on the Autocomplete page.
162
+ * List recent, frequent, or saved values first, such as the last few recipients.
163
+ * @module
164
+ */
165
+ import { style } from '@tempoxyz/ds'
166
+
167
+ const recipients = ['alice.tempo', 'payroll.tempo', 'treasury.tempo']
168
+
169
+ // A static copy of the open popup, since the real one portals and opens on input.
170
+ /** Renders the static preview, which the guideline card shows inert. */
171
+ export function Demo() {
172
+ return (
173
+ <div {...styles.popup()}>
174
+ <div {...styles.label()}>Recent recipients</div>
175
+ {recipients.map((recipient) => (
176
+ <div key={recipient} {...styles.item()}>
177
+ {recipient}
178
+ </div>
179
+ ))}
180
+ </div>
181
+ )
182
+ }
183
+
184
+ namespace styles {
185
+ export const item = style({
186
+ alignItems: 'center',
187
+ display: 'flex',
188
+ minHeight: '40',
189
+ paddingInline: '16',
190
+ typography: 'body.b2Strong',
191
+ })
192
+
193
+ export const label = style({
194
+ color: 'content.secondary',
195
+ paddingBlock: '8',
196
+ paddingInline: '16',
197
+ typography: 'body.b3',
198
+ })
199
+
200
+ export const popup = style({
201
+ backgroundColor: 'background.elevated',
202
+ borderRadius: 'sm',
203
+ boxShadow: 'regular',
204
+ padding: '6px !custom',
205
+ width: '16rem !custom',
206
+ })
207
+ }
208
+ ```
209
+
210
+ **Don't:** Suggest a list too long to scan without scrolling.
211
+
212
+ ```tsx
213
+ /**
214
+ * Don't example for "Suggest Likely Values" on the Autocomplete page.
215
+ * Don't suggest a list too long to scan without scrolling.
216
+ * @module
217
+ */
218
+ import { style } from '@tempoxyz/ds'
219
+
220
+ const recipients = [
221
+ 'acme.tempo',
222
+ 'alice.tempo',
223
+ 'bob.tempo',
224
+ 'carol.tempo',
225
+ 'dave.tempo',
226
+ 'erin.tempo',
227
+ 'frank.tempo',
228
+ ]
229
+
230
+ // A static copy of the open popup, since the real one portals and opens on input.
231
+ /** Renders the static preview, which the guideline card shows inert. */
232
+ export function Demo() {
233
+ return (
234
+ <div {...styles.popup()}>
235
+ {recipients.map((recipient) => (
236
+ <div key={recipient} {...styles.item()}>
237
+ {recipient}
238
+ </div>
239
+ ))}
240
+ </div>
241
+ )
242
+ }
243
+
244
+ namespace styles {
245
+ export const item = style({
246
+ alignItems: 'center',
247
+ display: 'flex',
248
+ flexShrink: '0 !custom',
249
+ minHeight: '40',
250
+ paddingInline: '16',
251
+ typography: 'body.b2Strong',
252
+ })
253
+
254
+ export const popup = style({
255
+ backgroundColor: 'background.elevated',
256
+ borderRadius: 'sm',
257
+ boxShadow: 'regular',
258
+ display: 'flex',
259
+ flexDirection: 'column',
260
+ maxHeight: '10rem !custom',
261
+ overflowY: 'auto',
262
+ padding: '6px !custom',
263
+ width: '16rem !custom',
264
+ })
265
+ }
266
+ ```
267
+
268
+ ### Show the Text a Suggestion Inserts
269
+
270
+ Pressing an `Autocomplete.Item` fills the input with the string form of its `value`.
271
+
272
+ **Do:** Show the same text in the item that it inserts.
273
+
274
+ ```tsx
275
+ /**
276
+ * Do example for "Show the Text a Suggestion Inserts" on the Autocomplete page.
277
+ * Show the same text in the item that it inserts.
278
+ * @module
279
+ */
280
+ import { Autocomplete, style } from '@tempoxyz/ds'
281
+
282
+ const recipients = ['alice.tempo', 'payroll.tempo']
283
+
284
+ // The popup portals and opens on input, so a static copy shows the picked suggestion.
285
+ /** Renders the static preview, which the guideline card shows inert. */
286
+ export function Demo() {
287
+ return (
288
+ <div {...styles.column()}>
289
+ <Autocomplete.Root defaultValue="alice.tempo" items={recipients}>
290
+ <Autocomplete.InputGroup>
291
+ <Autocomplete.Input aria-label="Recipient" />
292
+ </Autocomplete.InputGroup>
293
+ </Autocomplete.Root>
294
+ <div {...styles.popup()}>
295
+ <div {...styles.item()}>alice.tempo</div>
296
+ </div>
297
+ </div>
298
+ )
299
+ }
300
+
301
+ namespace styles {
302
+ export const column = style({
303
+ display: 'flex',
304
+ flexDirection: 'column',
305
+ gap: '8',
306
+ maxWidth: '16rem !custom',
307
+ width: '100% !custom',
308
+ })
309
+
310
+ export const item = style({
311
+ alignItems: 'center',
312
+ display: 'flex',
313
+ minHeight: '40',
314
+ paddingInline: '16',
315
+ typography: 'body.b2Strong',
316
+ })
317
+
318
+ export const popup = style({
319
+ backgroundColor: 'background.elevated',
320
+ borderRadius: 'sm',
321
+ boxShadow: 'regular',
322
+ padding: '6px !custom',
323
+ })
324
+ }
325
+ ```
326
+
327
+ **Don't:** Show a name that inserts an address.
328
+
329
+ ```tsx
330
+ /**
331
+ * Don't example for "Show the Text a Suggestion Inserts" on the Autocomplete page.
332
+ * Don't show a name that inserts an address.
333
+ * @module
334
+ */
335
+ import { Autocomplete, style } from '@tempoxyz/ds'
336
+
337
+ const recipients = ['0x8f3a…c21d', '0x51b0…9e04']
338
+
339
+ // The popup portals and opens on input, so a static copy shows the picked suggestion.
340
+ /** Renders the static preview, which the guideline card shows inert. */
341
+ export function Demo() {
342
+ return (
343
+ <div {...styles.column()}>
344
+ <Autocomplete.Root defaultValue="0x8f3a…c21d" items={recipients}>
345
+ <Autocomplete.InputGroup>
346
+ <Autocomplete.Input aria-label="Recipient" />
347
+ </Autocomplete.InputGroup>
348
+ </Autocomplete.Root>
349
+ <div {...styles.popup()}>
350
+ <div {...styles.item()}>Alice</div>
351
+ </div>
352
+ </div>
353
+ )
354
+ }
355
+
356
+ namespace styles {
357
+ export const column = style({
358
+ display: 'flex',
359
+ flexDirection: 'column',
360
+ gap: '8',
361
+ maxWidth: '16rem !custom',
362
+ width: '100% !custom',
363
+ })
364
+
365
+ export const item = style({
366
+ alignItems: 'center',
367
+ display: 'flex',
368
+ minHeight: '40',
369
+ paddingInline: '16',
370
+ typography: 'body.b2Strong',
371
+ })
372
+
373
+ export const popup = style({
374
+ backgroundColor: 'background.elevated',
375
+ borderRadius: 'sm',
376
+ boxShadow: 'regular',
377
+ padding: '6px !custom',
378
+ })
379
+ }
380
+ ```
381
+
382
+ ### Keep Autocomplete.Empty Mounted
383
+
384
+ `Autocomplete.Empty` shows its children only when nothing matches, and announces them politely. It requires `items` on `Autocomplete.Root`.
385
+
386
+ **Do:** Keep it mounted, and say that people can continue.
387
+
388
+ ```tsx
389
+ /**
390
+ * Do example for "Keep Autocomplete.Empty Mounted" on the Autocomplete page.
391
+ * Keep it mounted, and say that people can continue.
392
+ * @module
393
+ */
394
+ import { Autocomplete, style } from '@tempoxyz/ds'
395
+
396
+ const recipients = ['alice.tempo', 'payroll.tempo']
397
+
398
+ // The popup portals and opens on input, so a static copy shows it open.
399
+ /** Renders the static preview, which the guideline card shows inert. */
400
+ export function Demo() {
401
+ return (
402
+ <div {...styles.column()}>
403
+ <Autocomplete.Root defaultValue="0x8f3a…c21d" items={recipients}>
404
+ <Autocomplete.InputGroup>
405
+ <Autocomplete.Input aria-label="Recipient" />
406
+ </Autocomplete.InputGroup>
407
+ </Autocomplete.Root>
408
+ <div {...styles.popup()}>
409
+ <div {...styles.empty()}>No saved recipients. You can still send to this address.</div>
410
+ </div>
411
+ </div>
412
+ )
413
+ }
414
+
415
+ namespace styles {
416
+ export const column = style({
417
+ display: 'flex',
418
+ flexDirection: 'column',
419
+ gap: '8',
420
+ maxWidth: '16rem !custom',
421
+ width: '100% !custom',
422
+ })
423
+
424
+ export const empty = style({
425
+ color: 'content.secondary',
426
+ paddingBlock: '12',
427
+ paddingInline: '16',
428
+ typography: 'body.b2',
429
+ })
430
+
431
+ export const popup = style({
432
+ backgroundColor: 'background.elevated',
433
+ borderRadius: 'sm',
434
+ boxShadow: 'regular',
435
+ padding: '6px !custom',
436
+ })
437
+ }
438
+ ```
439
+
440
+ **Don't:** Hide it. Hiding it stops the announcement.
441
+
442
+ ```tsx
443
+ /**
444
+ * Don't example for "Keep Autocomplete.Empty Mounted" on the Autocomplete page.
445
+ * Don't hide it. Hiding it stops the announcement.
446
+ * @module
447
+ */
448
+ import { Autocomplete, style } from '@tempoxyz/ds'
449
+
450
+ const recipients = ['alice.tempo', 'payroll.tempo']
451
+
452
+ // The popup portals and opens on input, so a static copy shows it open.
453
+ /** Renders the static preview, which the guideline card shows inert. */
454
+ export function Demo() {
455
+ return (
456
+ <div {...styles.column()}>
457
+ <Autocomplete.Root defaultValue="0x8f3a…c21d" items={recipients}>
458
+ <Autocomplete.InputGroup>
459
+ <Autocomplete.Input aria-label="Recipient" />
460
+ </Autocomplete.InputGroup>
461
+ </Autocomplete.Root>
462
+ <div {...styles.popup()} />
463
+ </div>
464
+ )
465
+ }
466
+
467
+ namespace styles {
468
+ export const column = style({
469
+ display: 'flex',
470
+ flexDirection: 'column',
471
+ gap: '8',
472
+ maxWidth: '16rem !custom',
473
+ width: '100% !custom',
474
+ })
475
+
476
+ export const popup = style({
477
+ backgroundColor: 'background.elevated',
478
+ borderRadius: 'sm',
479
+ boxShadow: 'regular',
480
+ padding: '6px !custom',
481
+ })
482
+ }
483
+ ```
484
+
485
+ ### Add Clear for Long Values
486
+
487
+ `Autocomplete.Clear` mounts only while there is text.
488
+
489
+ **Do:** Add `Autocomplete.Clear` to fields with long values, such as addresses.
490
+
491
+ ```tsx
492
+ /**
493
+ * Do example for "Add Clear for Long Values" on the Autocomplete page.
494
+ * Add `Autocomplete.Clear` to fields with long values, such as addresses.
495
+ * @module
496
+ */
497
+ import { Autocomplete, Field, style } from '@tempoxyz/ds'
498
+
499
+ const recipients = ['alice.tempo', 'payroll.tempo']
500
+
501
+ /** Renders the static preview, which the guideline card shows inert. */
502
+ export function Demo() {
503
+ return (
504
+ <Field.Root {...styles.field()}>
505
+ <Field.Label>Recipient</Field.Label>
506
+ <Autocomplete.Root
507
+ defaultValue="0x8f3a2b7c9d1e4f60a5b3c2d1e0f9a8b7c6d5c21d"
508
+ items={recipients}
509
+ >
510
+ <Autocomplete.InputGroup>
511
+ <Autocomplete.Input placeholder="Name or 0x address" />
512
+ <Autocomplete.Clear />
513
+ </Autocomplete.InputGroup>
514
+ </Autocomplete.Root>
515
+ </Field.Root>
516
+ )
517
+ }
518
+
519
+ namespace styles {
520
+ export const field = style({ maxWidth: '16rem !custom', width: '100% !custom' })
521
+ }
522
+ ```
523
+
524
+ **Don't:** Make people delete a long address one character at a time.
525
+
526
+ ```tsx
527
+ /**
528
+ * Don't example for "Add Clear for Long Values" on the Autocomplete page.
529
+ * Don't make people delete a long address one character at a time.
530
+ * @module
531
+ */
532
+ import { Autocomplete, Field, style } from '@tempoxyz/ds'
533
+
534
+ const recipients = ['alice.tempo', 'payroll.tempo']
535
+
536
+ /** Renders the static preview, which the guideline card shows inert. */
537
+ export function Demo() {
538
+ return (
539
+ <Field.Root {...styles.field()}>
540
+ <Field.Label>Recipient</Field.Label>
541
+ <Autocomplete.Root
542
+ defaultValue="0x8f3a2b7c9d1e4f60a5b3c2d1e0f9a8b7c6d5c21d"
543
+ items={recipients}
544
+ >
545
+ <Autocomplete.InputGroup>
546
+ <Autocomplete.Input placeholder="Name or 0x address" />
547
+ </Autocomplete.InputGroup>
548
+ </Autocomplete.Root>
549
+ </Field.Root>
550
+ )
551
+ }
552
+
553
+ namespace styles {
554
+ export const field = style({ maxWidth: '16rem !custom', width: '100% !custom' })
555
+ }
556
+ ```
557
+
558
+ ## Content
559
+
560
+ * **Label:** Use a noun, such as Recipient, or Search for a search field.
561
+ * **Placeholder:** Name what people can enter, such as Search actions.
562
+ * **Suggestions:** Use the typed format, so a pasted value and a picked one look alike.
563
+
564
+ ## Accessibility
565
+
566
+ Follows the [WAI-ARIA combobox pattern](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/) with list autocomplete.
567
+
568
+ ### Semantics
569
+
570
+ * **Autocomplete.Input (combobox):** A text input that announces a suggestion list and whether it is open.
571
+ * **Highlighted Suggestion (aria-activedescendant):** Points to the highlighted suggestion while focus stays in the input.
572
+ * **Autocomplete.List and Autocomplete.Item (listbox and option):** Each suggestion is announced as an option inside a listbox.
573
+ * **Autocomplete.Group (group):** Named by the `Autocomplete.GroupLabel` inside it, and announced as a group.
574
+ * **Autocomplete.Clear (button):** Named "Clear" by default. Renders only while the input has text.
575
+
576
+ ### Keyboard
577
+
578
+ * **Move to the TextInput (Tab):** Moves focus to the input.
579
+ * **Filter the Suggestions (Typing):** Filters the suggestions and opens the list.
580
+ * **Highlight the Next Suggestion (Down Arrow):** Opens the list, then highlights the next suggestion.
581
+ * **Highlight the Previous Suggestion (Up Arrow):** Highlights the previous one, then the typed text.
582
+ * **Choose the Suggestion (Enter):** Enters the highlighted suggestion and closes the list.
583
+ * **Close or Clear (Escape):** Closes the list. A second press clears the input.
584
+
585
+ ### Focus
586
+
587
+ DOM focus stays on the input while the arrow keys highlight suggestions, so typing continues at any point.
588
+
589
+ ### Announcements
590
+
591
+ * **Highlighted Suggestion (aria-activedescendant):** Each suggestion is announced on highlight.
592
+ * **No Matches (Autocomplete.Empty):** Announces "No matches" politely.
593
+
594
+ ### Your Responsibilities
595
+
596
+ * **Label the TextInput (aria-label):** Name the input with `Field.Label`, or `aria-label` if no label fits. The placeholder disappears.
597
+ * **Set aria-invalid on the TextInput (aria-invalid):** The group's `invalid` prop only fills it red. Set the attribute on the input, and explain the error.
598
+
599
+ ## Related
600
+
601
+ [Combobox](/docs/components/combobox)
602
+
603
+ Use for choosing from fixed options.
604
+
605
+ [TextInput](/docs/components/text-input)
606
+
607
+ Use for text without suggestions.
608
+
609
+ [Field](/docs/components/field)
610
+
611
+ Use for the label and error.
612
+
613
+ [Select](/docs/components/select)
614
+
615
+ Use for short lists.
616
+
617
+ [Blockchain Values](/docs/patterns/blockchain-values)
618
+
619
+ Covers entering and showing addresses.