@tempoxyz/ds 0.3.14 → 0.3.16

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 (209) hide show
  1. package/dist/docs/AGENTS.md +75 -10
  2. package/dist/docs/arsenal.md +44 -0
  3. package/dist/docs/{marketing/introduction/getting-started.md → marketing.md} +32 -24
  4. package/dist/docs/product/components/actions.md +2110 -0
  5. package/dist/docs/product/components/blockchain.md +3969 -0
  6. package/dist/docs/product/components/data-display.md +5901 -0
  7. package/dist/docs/product/components/feedback-and-status.md +4138 -0
  8. package/dist/docs/product/components/forms-and-inputs.md +10543 -0
  9. package/dist/docs/product/components/layout.md +3339 -0
  10. package/dist/docs/product/components/navigation.md +2914 -0
  11. package/dist/docs/product/components/overlays.md +4917 -0
  12. package/dist/docs/product/components.md +125 -125
  13. package/dist/docs/product/foundations.md +4597 -0
  14. package/dist/docs/product/patterns.md +10110 -0
  15. package/dist/marketing/index.js.zyzz.json +1 -1
  16. package/dist/marketing/vars.d.ts +618 -758
  17. package/dist/marketing/vars.d.ts.map +1 -1
  18. package/dist/marketing/vars.js +8 -5
  19. package/dist/marketing/vars.js.map +1 -1
  20. package/dist/marketing/vars.js.zyzz.json +1 -1
  21. package/dist/marketing/zyzz.config.d.ts +3042 -3757
  22. package/dist/marketing/zyzz.config.d.ts.map +1 -1
  23. package/dist/marketing/zyzz.config.js +1 -1
  24. package/dist/marketing/zyzz.config.js.map +1 -1
  25. package/dist/marketing/zyzz.config.js.zyzz.json +1 -1
  26. package/dist/mobile/components/Button.d.ts +115 -15
  27. package/dist/mobile/components/Button.d.ts.map +1 -1
  28. package/dist/mobile/components/Button.js +85 -14
  29. package/dist/mobile/components/Button.js.map +1 -1
  30. package/dist/mobile/components/IconButton.d.ts +129 -40
  31. package/dist/mobile/components/IconButton.d.ts.map +1 -1
  32. package/dist/mobile/components/IconButton.js +97 -28
  33. package/dist/mobile/components/IconButton.js.map +1 -1
  34. package/dist/mobile/components/TextInput.d.ts +132 -11
  35. package/dist/mobile/components/TextInput.d.ts.map +1 -1
  36. package/dist/mobile/components/TextInput.js +115 -14
  37. package/dist/mobile/components/TextInput.js.map +1 -1
  38. package/dist/mobile/index.d.ts +1 -0
  39. package/dist/mobile/index.d.ts.map +1 -1
  40. package/dist/mobile/index.js +1 -0
  41. package/dist/mobile/index.js.map +1 -1
  42. package/dist/mobile/vars.d.ts +103 -0
  43. package/dist/mobile/vars.d.ts.map +1 -1
  44. package/dist/mobile/vars.js +74 -0
  45. package/dist/mobile/vars.js.map +1 -1
  46. package/dist/mobile/zyzz.config.d.ts +408 -0
  47. package/dist/mobile/zyzz.config.d.ts.map +1 -1
  48. package/dist/web/components/AddressCard.js.zyzz.json +1 -1
  49. package/dist/web/components/Amount.css +1 -1
  50. package/dist/web/components/Amount.d.ts +9 -0
  51. package/dist/web/components/Amount.d.ts.map +1 -1
  52. package/dist/web/components/Amount.js +8 -5
  53. package/dist/web/components/Amount.js.map +1 -1
  54. package/dist/web/components/Amount.js.zyzz.json +1 -1
  55. package/dist/web/components/CopyButton.d.ts +6 -0
  56. package/dist/web/components/CopyButton.d.ts.map +1 -1
  57. package/dist/web/components/CopyButton.js +4 -1
  58. package/dist/web/components/CopyButton.js.map +1 -1
  59. package/dist/web/components/CopyButton.js.zyzz.json +1 -1
  60. package/dist/web/components/Hex.css +1 -1
  61. package/dist/web/components/Hex.d.ts +84 -3
  62. package/dist/web/components/Hex.d.ts.map +1 -1
  63. package/dist/web/components/Hex.js +20 -13
  64. package/dist/web/components/Hex.js.map +1 -1
  65. package/dist/web/components/Hex.js.zyzz.json +1 -1
  66. package/dist/web/components/Progress.css +1 -1
  67. package/dist/web/components/Progress.d.ts +12 -2
  68. package/dist/web/components/Progress.d.ts.map +1 -1
  69. package/dist/web/components/Progress.js +9 -5
  70. package/dist/web/components/Progress.js.map +1 -1
  71. package/dist/web/components/Progress.js.zyzz.json +1 -1
  72. package/dist/web/components/SecretValue.js.zyzz.json +1 -1
  73. package/dist/web/components/SidebarMenu.d.ts +4 -4
  74. package/dist/web/components/SidebarMenu.js +6 -6
  75. package/dist/web/components/SidebarMenu.js.map +1 -1
  76. package/dist/web/components/Snippet.js.zyzz.json +1 -1
  77. package/dist/web/index.js.zyzz.json +1 -1
  78. package/package.json +1 -1
  79. package/src/marketing/README.md +1 -1
  80. package/src/marketing/vars.ts +526 -604
  81. package/src/marketing/zyzz.config.ts +5 -4
  82. package/src/mobile/README.md +19 -6
  83. package/src/mobile/components/Button.tsx +94 -17
  84. package/src/mobile/components/IconButton.tsx +122 -30
  85. package/src/mobile/components/TextInput.tsx +139 -24
  86. package/src/mobile/index.ts +1 -0
  87. package/src/mobile/vars.ts +74 -0
  88. package/src/web/components/Amount.tsx +37 -3
  89. package/src/web/components/CopyButton.tsx +8 -0
  90. package/src/web/components/Hex.tsx +79 -13
  91. package/src/web/components/Progress.tsx +8 -2
  92. package/src/web/components/SidebarMenu.tsx +6 -6
  93. package/dist/docs/index.md +0 -145
  94. package/dist/docs/product/components/accordion.md +0 -489
  95. package/dist/docs/product/components/address-card.md +0 -147
  96. package/dist/docs/product/components/agent-logo.md +0 -194
  97. package/dist/docs/product/components/alert-dialog.md +0 -631
  98. package/dist/docs/product/components/alert.md +0 -448
  99. package/dist/docs/product/components/amount-input.md +0 -305
  100. package/dist/docs/product/components/amount.md +0 -794
  101. package/dist/docs/product/components/app-shell.md +0 -559
  102. package/dist/docs/product/components/asset-chip.md +0 -294
  103. package/dist/docs/product/components/autocomplete.md +0 -620
  104. package/dist/docs/product/components/avatar.md +0 -321
  105. package/dist/docs/product/components/badge.md +0 -339
  106. package/dist/docs/product/components/badged-logo.md +0 -116
  107. package/dist/docs/product/components/banner.md +0 -379
  108. package/dist/docs/product/components/bar-chart.md +0 -208
  109. package/dist/docs/product/components/breadcrumbs.md +0 -380
  110. package/dist/docs/product/components/button-group.md +0 -286
  111. package/dist/docs/product/components/button.md +0 -650
  112. package/dist/docs/product/components/calendar.md +0 -375
  113. package/dist/docs/product/components/callout.md +0 -96
  114. package/dist/docs/product/components/checkbox-group.md +0 -521
  115. package/dist/docs/product/components/checkbox.md +0 -467
  116. package/dist/docs/product/components/choice-group.md +0 -516
  117. package/dist/docs/product/components/choicebox.md +0 -641
  118. package/dist/docs/product/components/code.md +0 -100
  119. package/dist/docs/product/components/combobox.md +0 -939
  120. package/dist/docs/product/components/container.md +0 -257
  121. package/dist/docs/product/components/copy-button.md +0 -642
  122. package/dist/docs/product/components/date-picker.md +0 -514
  123. package/dist/docs/product/components/dialog.md +0 -1332
  124. package/dist/docs/product/components/drawer.md +0 -966
  125. package/dist/docs/product/components/empty.md +0 -340
  126. package/dist/docs/product/components/field.md +0 -570
  127. package/dist/docs/product/components/fieldset.md +0 -398
  128. package/dist/docs/product/components/frame.md +0 -434
  129. package/dist/docs/product/components/gauge.md +0 -299
  130. package/dist/docs/product/components/get-started-visual.md +0 -117
  131. package/dist/docs/product/components/grid.md +0 -288
  132. package/dist/docs/product/components/hero-visual.md +0 -155
  133. package/dist/docs/product/components/hex.md +0 -487
  134. package/dist/docs/product/components/icon-tile.md +0 -292
  135. package/dist/docs/product/components/identicon.md +0 -371
  136. package/dist/docs/product/components/inline.md +0 -233
  137. package/dist/docs/product/components/inset.md +0 -225
  138. package/dist/docs/product/components/kbd.md +0 -423
  139. package/dist/docs/product/components/list-group.md +0 -981
  140. package/dist/docs/product/components/loading-dots.md +0 -237
  141. package/dist/docs/product/components/menu.md +0 -934
  142. package/dist/docs/product/components/native-select.md +0 -204
  143. package/dist/docs/product/components/network-logo.md +0 -248
  144. package/dist/docs/product/components/number-field.md +0 -543
  145. package/dist/docs/product/components/otp-field.md +0 -616
  146. package/dist/docs/product/components/pagination.md +0 -516
  147. package/dist/docs/product/components/popover.md +0 -544
  148. package/dist/docs/product/components/progress.md +0 -388
  149. package/dist/docs/product/components/qr.md +0 -314
  150. package/dist/docs/product/components/radio-group.md +0 -528
  151. package/dist/docs/product/components/secret-value.md +0 -406
  152. package/dist/docs/product/components/select.md +0 -751
  153. package/dist/docs/product/components/separator.md +0 -379
  154. package/dist/docs/product/components/sidebar-menu.md +0 -922
  155. package/dist/docs/product/components/skeleton.md +0 -517
  156. package/dist/docs/product/components/slider.md +0 -539
  157. package/dist/docs/product/components/snippet.md +0 -424
  158. package/dist/docs/product/components/spinner.md +0 -216
  159. package/dist/docs/product/components/split-bar.md +0 -139
  160. package/dist/docs/product/components/split-button.md +0 -464
  161. package/dist/docs/product/components/stack.md +0 -299
  162. package/dist/docs/product/components/status-chip.md +0 -226
  163. package/dist/docs/product/components/status-indicator.md +0 -119
  164. package/dist/docs/product/components/status-row.md +0 -174
  165. package/dist/docs/product/components/stepper.md +0 -451
  166. package/dist/docs/product/components/success-hero.md +0 -157
  167. package/dist/docs/product/components/surface.md +0 -639
  168. package/dist/docs/product/components/switch.md +0 -472
  169. package/dist/docs/product/components/table.md +0 -968
  170. package/dist/docs/product/components/tabs.md +0 -627
  171. package/dist/docs/product/components/tempo-logo.md +0 -185
  172. package/dist/docs/product/components/text-input.md +0 -624
  173. package/dist/docs/product/components/textarea.md +0 -352
  174. package/dist/docs/product/components/toast.md +0 -535
  175. package/dist/docs/product/components/token-logo.md +0 -371
  176. package/dist/docs/product/components/token.md +0 -247
  177. package/dist/docs/product/components/tooltip.md +0 -490
  178. package/dist/docs/product/components/verification-code.md +0 -116
  179. package/dist/docs/product/components/visual.md +0 -249
  180. package/dist/docs/product/foundations/accessibility.md +0 -377
  181. package/dist/docs/product/foundations/agents.md +0 -159
  182. package/dist/docs/product/foundations/color.md +0 -522
  183. package/dist/docs/product/foundations/content/tone.md +0 -194
  184. package/dist/docs/product/foundations/content/voice.md +0 -194
  185. package/dist/docs/product/foundations/content/writing-style.md +0 -406
  186. package/dist/docs/product/foundations/iconography.md +0 -282
  187. package/dist/docs/product/foundations/intent.md +0 -360
  188. package/dist/docs/product/foundations/layout.md +0 -508
  189. package/dist/docs/product/foundations/linter.md +0 -523
  190. package/dist/docs/product/foundations/motion.md +0 -151
  191. package/dist/docs/product/foundations/radius-and-padding.md +0 -86
  192. package/dist/docs/product/foundations/typography.md +0 -331
  193. package/dist/docs/product/introduction/faq.md +0 -133
  194. package/dist/docs/product/introduction/getting-started.md +0 -377
  195. package/dist/docs/product/patterns/blockchain-values.md +0 -709
  196. package/dist/docs/product/patterns/dashboards.md +0 -638
  197. package/dist/docs/product/patterns/destructive-actions.md +0 -626
  198. package/dist/docs/product/patterns/empty-states.md +0 -612
  199. package/dist/docs/product/patterns/errors-and-validation.md +0 -808
  200. package/dist/docs/product/patterns/feedback-and-status.md +0 -518
  201. package/dist/docs/product/patterns/forms.md +0 -679
  202. package/dist/docs/product/patterns/loading.md +0 -630
  203. package/dist/docs/product/patterns/navigation.md +0 -397
  204. package/dist/docs/product/patterns/payments.md +0 -765
  205. package/dist/docs/product/patterns/responsive-layout.md +0 -997
  206. package/dist/docs/product/patterns/tables-and-lists.md +0 -1170
  207. package/dist/docs/product/products/tempo-console.md +0 -671
  208. package/dist/docs/product/products/tempo-performance.md +0 -435
  209. package/dist/docs/product/products/tempo-wallet.md +0 -438
@@ -1,631 +0,0 @@
1
- # AlertDialog
2
-
3
- Asks you to confirm a critical action before it happens.
4
-
5
- [View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/AlertDialog.tsx)
6
-
7
- ## Overview
8
-
9
- A modal confirmation that blocks the page until the user decides. It never closes on an outside press. It takes the parts and the `small` size of a [Dialog](dialog.md). Reserve it for decisions that need an explicit answer.
10
-
11
- ## Examples
12
-
13
- ### Basic
14
-
15
- ```tsx
16
- import { AlertDialog, Button, ButtonGroup } from '@tempoxyz/ds'
17
-
18
- export function Demo() {
19
- return (
20
- <AlertDialog.Root>
21
- <AlertDialog.Trigger render={<Button />}>Delete key</AlertDialog.Trigger>
22
- <AlertDialog.Popup>
23
- <AlertDialog.Header>
24
- <AlertDialog.Title>Delete this key?</AlertDialog.Title>
25
- <AlertDialog.Description>
26
- Apps that use this key stop working immediately. You cannot undo this.
27
- </AlertDialog.Description>
28
- </AlertDialog.Header>
29
- <ButtonGroup>
30
- <AlertDialog.Close render={<Button size="large" variant="secondary" />}>
31
- Cancel
32
- </AlertDialog.Close>
33
- <AlertDialog.Close render={<Button size="large" variant="danger" />}>
34
- Delete key
35
- </AlertDialog.Close>
36
- </ButtonGroup>
37
- </AlertDialog.Popup>
38
- </AlertDialog.Root>
39
- )
40
- }
41
- ```
42
-
43
- [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/AlertDialog/Basic.tsx)
44
-
45
- ## Anatomy
46
-
47
- Import the component and assemble its parts.
48
-
49
- ```tsx
50
- import { AlertDialog, ButtonGroup } from '@tempoxyz/ds'
51
-
52
- <AlertDialog.Root>
53
- <AlertDialog.Trigger />
54
- <AlertDialog.Popup>
55
- <AlertDialog.Header>
56
- <AlertDialog.Title />
57
- <AlertDialog.Description />
58
- </AlertDialog.Header>
59
- <AlertDialog.Body />
60
- <ButtonGroup>
61
- <AlertDialog.Close />
62
- </ButtonGroup>
63
- </AlertDialog.Popup>
64
- </AlertDialog.Root>
65
- ```
66
-
67
- ## Guidelines
68
-
69
- ### When to Use
70
-
71
- * Confirm an action you can't undo, such as Revoke key, Delete webhook, or Remove passkey.
72
- * Ask before discarding unsaved work, such as Discard changes? on a settings page with edits.
73
-
74
- ### When Not to Use
75
-
76
- * Use a [Dialog](dialog.md) for a task with fields, or to review a payment before sending it.
77
- * For reversible actions, such as archiving an address, act at once and offer Undo in a [Toast](toast.md). The toast dismisses itself, so keep another way to restore the item.
78
- * Use an [Alert](alert.md) or [Banner](banner.md) for a warning that needs no decision.
79
- * Use a [Toast](toast.md) to report that an action finished.
80
-
81
- ### Focus the Safe Action
82
-
83
- Opening focuses the first tabbable element in the popup. Place Cancel first in the DOM, or pass its ref to `initialFocus` on `AlertDialog.Popup`, so an Enter press right after opening cancels.
84
-
85
- **Do:** Start focus on Cancel.
86
-
87
- ```tsx
88
- /** Do example for "Focus the Safe Action" on the AlertDialog page: start focus on Cancel. @module */
89
- import { Button, style } from '@tempoxyz/ds'
90
- import { Focus } from '../../../components/mdx/Access.js'
91
-
92
- /** Renders the static preview, which the guideline card shows inert. */
93
- export function Demo() {
94
- return (
95
- <div {...styles.popup()}>
96
- <span {...styles.title()}>Delete this webhook?</span>
97
- <p {...styles.description()}>
98
- Payment events stop reaching api.acme.com/hooks. You can’t undo this.
99
- </p>
100
- <div {...styles.actions()}>
101
- <Focus>
102
- <Button size="small" variant="secondary">
103
- Cancel
104
- </Button>
105
- </Focus>
106
- <Button size="small">Delete webhook</Button>
107
- </div>
108
- </div>
109
- )
110
- }
111
-
112
- namespace styles {
113
- export const actions = style({
114
- alignItems: 'center',
115
- columnGap: '8',
116
- display: 'flex',
117
- justifyContent: 'flex-end',
118
- marginTop: '16',
119
- })
120
-
121
- export const description = style({
122
- color: 'content.secondary',
123
- margin: '0 !custom',
124
- typography: 'body.b2',
125
- })
126
-
127
- export const popup = style({
128
- backgroundColor: 'background.elevated',
129
- borderRadius: 'sm',
130
- boxShadow: 'regular',
131
- boxSizing: 'border-box',
132
- display: 'flex',
133
- flexDirection: 'column',
134
- padding: '24',
135
- rowGap: '8',
136
- width: '17rem !custom',
137
- })
138
-
139
- export const title = style({ color: 'content.primary', typography: 'heading.h3' })
140
- }
141
- ```
142
-
143
- **Don't:** Start focus on the destructive action, where one Enter press confirms it.
144
-
145
- ```tsx
146
- /**
147
- * Don't example for "Focus the Safe Action" on the AlertDialog page.
148
- * Don't start focus on the destructive action, where one Enter press confirms it.
149
- * @module
150
- */
151
- import { Button, style } from '@tempoxyz/ds'
152
- import { Focus } from '../../../components/mdx/Access.js'
153
-
154
- /** Renders the static preview, which the guideline card shows inert. */
155
- export function Demo() {
156
- return (
157
- <div {...styles.popup()}>
158
- <span {...styles.title()}>Delete this webhook?</span>
159
- <p {...styles.description()}>
160
- Payment events stop reaching api.acme.com/hooks. You can’t undo this.
161
- </p>
162
- <div {...styles.actions()}>
163
- <Button size="small" variant="secondary">
164
- Cancel
165
- </Button>
166
- <Focus>
167
- <Button size="small">Delete webhook</Button>
168
- </Focus>
169
- </div>
170
- </div>
171
- )
172
- }
173
-
174
- namespace styles {
175
- export const actions = style({
176
- alignItems: 'center',
177
- columnGap: '8',
178
- display: 'flex',
179
- justifyContent: 'flex-end',
180
- marginTop: '16',
181
- })
182
-
183
- export const description = style({
184
- color: 'content.secondary',
185
- margin: '0 !custom',
186
- typography: 'body.b2',
187
- })
188
-
189
- export const popup = style({
190
- backgroundColor: 'background.elevated',
191
- borderRadius: 'sm',
192
- boxShadow: 'regular',
193
- boxSizing: 'border-box',
194
- display: 'flex',
195
- flexDirection: 'column',
196
- padding: '24',
197
- rowGap: '8',
198
- width: '17rem !custom',
199
- })
200
-
201
- export const title = style({ color: 'content.primary', typography: 'heading.h3' })
202
- }
203
- ```
204
-
205
- ### Always Offer Cancel
206
-
207
- Only Escape, `closeButton` and `AlertDialog.Close` close the dialog, so render a Cancel button with `AlertDialog.Close`.
208
-
209
- **Do:** Pair the confirm button with Cancel.
210
-
211
- ```tsx
212
- /** Do example for "Always Offer Cancel" on the AlertDialog page: pair the confirm button with Cancel. @module */
213
- import { Button, style } from '@tempoxyz/ds'
214
-
215
- /** Renders the static preview, which the guideline card shows inert. */
216
- export function Demo() {
217
- return (
218
- <div {...styles.popup()}>
219
- <span {...styles.title()}>Revoke this API key?</span>
220
- <p {...styles.description()}>
221
- Apps that use the Production server key stop working immediately. You can’t undo this.
222
- </p>
223
- <div {...styles.actions()}>
224
- <Button size="small" variant="secondary">
225
- Cancel
226
- </Button>
227
- <Button size="small">Revoke key</Button>
228
- </div>
229
- </div>
230
- )
231
- }
232
-
233
- namespace styles {
234
- export const actions = style({
235
- columnGap: '8',
236
- display: 'flex',
237
- justifyContent: 'flex-end',
238
- marginTop: '16',
239
- })
240
-
241
- export const description = style({
242
- color: 'content.secondary',
243
- margin: '0 !custom',
244
- typography: 'body.b2',
245
- })
246
-
247
- export const popup = style({
248
- backgroundColor: 'background.elevated',
249
- borderRadius: 'sm',
250
- boxShadow: 'regular',
251
- boxSizing: 'border-box',
252
- display: 'flex',
253
- flexDirection: 'column',
254
- padding: '24',
255
- rowGap: '8',
256
- width: '17rem !custom',
257
- })
258
-
259
- export const title = style({ color: 'content.primary', typography: 'heading.h3' })
260
- }
261
- ```
262
-
263
- **Don't:** Render the confirm button alone. An outside press doesn't close the dialog.
264
-
265
- ```tsx
266
- /**
267
- * Don't example for "Always Offer Cancel" on the AlertDialog page.
268
- * Don't render the confirm button alone. An outside press doesn't close the dialog.
269
- * @module
270
- */
271
- import { Button, style } from '@tempoxyz/ds'
272
-
273
- /** Renders the static preview, which the guideline card shows inert. */
274
- export function Demo() {
275
- return (
276
- <div {...styles.popup()}>
277
- <span {...styles.title()}>Revoke this API key?</span>
278
- <p {...styles.description()}>
279
- Apps that use the Production server key stop working immediately. You can’t undo this.
280
- </p>
281
- <div {...styles.actions()}>
282
- <Button size="small">Revoke key</Button>
283
- </div>
284
- </div>
285
- )
286
- }
287
-
288
- namespace styles {
289
- export const actions = style({
290
- alignItems: 'center',
291
- columnGap: '8',
292
- display: 'flex',
293
- justifyContent: 'flex-end',
294
- marginTop: '16',
295
- })
296
-
297
- export const description = style({
298
- color: 'content.secondary',
299
- margin: '0 !custom',
300
- typography: 'body.b2',
301
- })
302
-
303
- export const popup = style({
304
- backgroundColor: 'background.elevated',
305
- borderRadius: 'sm',
306
- boxShadow: 'regular',
307
- boxSizing: 'border-box',
308
- display: 'flex',
309
- flexDirection: 'column',
310
- padding: '24',
311
- rowGap: '8',
312
- width: '17rem !custom',
313
- })
314
-
315
- export const title = style({ color: 'content.primary', typography: 'heading.h3' })
316
- }
317
- ```
318
-
319
- ### Show Progress on the Confirm Button
320
-
321
- If the action waits on the network, such as revoking a key:
322
-
323
- 1. Render the confirm button without `AlertDialog.Close`, and control `open` on `AlertDialog.Root`.
324
- 2. Set `loading` while the request runs.
325
- 3. Close the dialog on success. Show any error inside the dialog.
326
-
327
- **Do:** Set `loading` on the confirm button and keep the dialog open.
328
-
329
- ```tsx
330
- /**
331
- * Do example for "Show Progress on the Confirm Button" on the AlertDialog page.
332
- * Set `loading` on the confirm button and keep the dialog open.
333
- * @module
334
- */
335
- import { Button, style } from '@tempoxyz/ds'
336
-
337
- /** Renders the static preview, which the guideline card shows inert. */
338
- export function Demo() {
339
- return (
340
- <div {...styles.popup()}>
341
- <span {...styles.title()}>Revoke this API key?</span>
342
- <p {...styles.description()}>
343
- Apps that use the Production server key stop working immediately. You can’t undo this.
344
- </p>
345
- <div {...styles.actions()}>
346
- <Button size="small" variant="secondary">
347
- Cancel
348
- </Button>
349
- <Button size="small" loading>
350
- Revoke key
351
- </Button>
352
- </div>
353
- </div>
354
- )
355
- }
356
-
357
- namespace styles {
358
- export const actions = style({
359
- alignItems: 'center',
360
- columnGap: '8',
361
- display: 'flex',
362
- justifyContent: 'flex-end',
363
- marginTop: '16',
364
- })
365
-
366
- export const description = style({
367
- color: 'content.secondary',
368
- margin: '0 !custom',
369
- typography: 'body.b2',
370
- })
371
-
372
- export const popup = style({
373
- backgroundColor: 'background.elevated',
374
- borderRadius: 'sm',
375
- boxShadow: 'regular',
376
- boxSizing: 'border-box',
377
- display: 'flex',
378
- flexDirection: 'column',
379
- padding: '24',
380
- rowGap: '8',
381
- width: '17rem !custom',
382
- })
383
-
384
- export const title = style({ color: 'content.primary', typography: 'heading.h3' })
385
- }
386
- ```
387
-
388
- **Don't:** Add a separate spinner and leave the buttons active.
389
-
390
- ```tsx
391
- /**
392
- * Don't example for "Show Progress on the Confirm Button" on the AlertDialog page.
393
- * Don't add a separate spinner and leave the buttons active.
394
- * @module
395
- */
396
- import { Button, Spinner, style } from '@tempoxyz/ds'
397
-
398
- /** Renders the static preview, which the guideline card shows inert. */
399
- export function Demo() {
400
- return (
401
- <div {...styles.popup()}>
402
- <span {...styles.title()}>Revoke this API key?</span>
403
- <p {...styles.description()}>
404
- Apps that use the Production server key stop working immediately. You can’t undo this.
405
- </p>
406
- <div {...styles.actions()}>
407
- <Spinner aria-label="Revoking key" />
408
- <Button size="small" variant="secondary">
409
- Cancel
410
- </Button>
411
- <Button size="small">Revoke key</Button>
412
- </div>
413
- </div>
414
- )
415
- }
416
-
417
- namespace styles {
418
- export const actions = style({
419
- alignItems: 'center',
420
- columnGap: '8',
421
- display: 'flex',
422
- justifyContent: 'flex-end',
423
- marginTop: '16',
424
- })
425
-
426
- export const description = style({
427
- color: 'content.secondary',
428
- margin: '0 !custom',
429
- typography: 'body.b2',
430
- })
431
-
432
- export const popup = style({
433
- backgroundColor: 'background.elevated',
434
- borderRadius: 'sm',
435
- boxShadow: 'regular',
436
- boxSizing: 'border-box',
437
- display: 'flex',
438
- flexDirection: 'column',
439
- padding: '24',
440
- rowGap: '8',
441
- width: '17rem !custom',
442
- })
443
-
444
- export const title = style({ color: 'content.primary', typography: 'heading.h3' })
445
- }
446
- ```
447
-
448
- ## Content
449
-
450
- ### Ask a Specific Question
451
-
452
- Write the title as one question that names the action and its object, such as Revoke this API key?
453
-
454
- ### State the Consequence
455
-
456
- Always include an `AlertDialog.Description`. Say what stops working, then whether it can be recovered, without repeating the title.
457
-
458
- ### Repeat the Action Verb on the Confirm Button
459
-
460
- Label the confirm button with the verb from the trigger and title, such as Revoke key after Revoke this API key?
461
-
462
- **Do:** Repeat the action's verb on the confirm button, such as Revoke key.
463
-
464
- ```tsx
465
- /** Do example for "Always Offer Cancel" on the AlertDialog page: pair the confirm button with Cancel. @module */
466
- import { Button, style } from '@tempoxyz/ds'
467
-
468
- /** Renders the static preview, which the guideline card shows inert. */
469
- export function Demo() {
470
- return (
471
- <div {...styles.popup()}>
472
- <span {...styles.title()}>Revoke this API key?</span>
473
- <p {...styles.description()}>
474
- Apps that use the Production server key stop working immediately. You can’t undo this.
475
- </p>
476
- <div {...styles.actions()}>
477
- <Button size="small" variant="secondary">
478
- Cancel
479
- </Button>
480
- <Button size="small">Revoke key</Button>
481
- </div>
482
- </div>
483
- )
484
- }
485
-
486
- namespace styles {
487
- export const actions = style({
488
- columnGap: '8',
489
- display: 'flex',
490
- justifyContent: 'flex-end',
491
- marginTop: '16',
492
- })
493
-
494
- export const description = style({
495
- color: 'content.secondary',
496
- margin: '0 !custom',
497
- typography: 'body.b2',
498
- })
499
-
500
- export const popup = style({
501
- backgroundColor: 'background.elevated',
502
- borderRadius: 'sm',
503
- boxShadow: 'regular',
504
- boxSizing: 'border-box',
505
- display: 'flex',
506
- flexDirection: 'column',
507
- padding: '24',
508
- rowGap: '8',
509
- width: '17rem !custom',
510
- })
511
-
512
- export const title = style({ color: 'content.primary', typography: 'heading.h3' })
513
- }
514
- ```
515
-
516
- **Don't:** Ask Are you sure? or label the confirm button OK.
517
-
518
- ```tsx
519
- /**
520
- * Don't example for "Repeat the Action Verb on the Confirm Button" on the AlertDialog page.
521
- * Don't ask Are you sure? or label the confirm button OK.
522
- * @module
523
- */
524
- import { Button, style } from '@tempoxyz/ds'
525
-
526
- /** Renders the static preview, which the guideline card shows inert. */
527
- export function Demo() {
528
- return (
529
- <div {...styles.popup()}>
530
- <span {...styles.title()}>Are you sure?</span>
531
- <p {...styles.description()}>This action cannot be undone.</p>
532
- <div {...styles.actions()}>
533
- <Button size="small" variant="secondary">
534
- Cancel
535
- </Button>
536
- <Button size="small">OK</Button>
537
- </div>
538
- </div>
539
- )
540
- }
541
-
542
- namespace styles {
543
- export const actions = style({
544
- columnGap: '8',
545
- display: 'flex',
546
- justifyContent: 'flex-end',
547
- marginTop: '16',
548
- })
549
-
550
- export const description = style({
551
- color: 'content.secondary',
552
- margin: '0 !custom',
553
- typography: 'body.b2',
554
- })
555
-
556
- export const popup = style({
557
- backgroundColor: 'background.elevated',
558
- borderRadius: 'sm',
559
- boxShadow: 'regular',
560
- boxSizing: 'border-box',
561
- display: 'flex',
562
- flexDirection: 'column',
563
- padding: '24',
564
- rowGap: '8',
565
- width: '17rem !custom',
566
- })
567
-
568
- export const title = style({ color: 'content.primary', typography: 'heading.h3' })
569
- }
570
- ```
571
-
572
- ### Avoid Two Cancels
573
-
574
- If the action cancels something, such as a scheduled payment, label the pair Keep payment and Cancel payment. A plain Cancel beside Cancel payment is ambiguous.
575
-
576
- ## Accessibility
577
-
578
- Follows the [WAI-ARIA alert dialog pattern](https://www.w3.org/WAI/ARIA/apg/patterns/alertdialog/).
579
-
580
- ### Semantics
581
-
582
- * **AlertDialog.Trigger (button):** Announces the dialog and whether it is open.
583
- * **AlertDialog.Popup (alertdialog):** The dialog is always modal.
584
- * **AlertDialog.Title (h2):** Names the popup. Include it in every alert dialog.
585
- * **AlertDialog.Description (aria-describedby):** Describes the popup. Include it in every alert dialog.
586
- * **Page Behind (inert):** The page behind ignores input and stops scrolling.
587
- * **Reduced Motion (prefers-reduced-motion):** The dialog fades in and out without scaling or sliding.
588
-
589
- ### Keyboard
590
-
591
- * **Open or Activate (Enter or Space):** Opens the dialog from the trigger, and activates the focused action.
592
- * **Move to the Next Action (Tab):** Moves focus to the next action, wrapping from the last to the first.
593
- * **Move to the Previous Action (Shift+Tab):** Moves focus to the previous action, wrapping from the first to the last.
594
- * **Close the Alert Dialog (Escape):** Closes the dialog and returns focus to the trigger that opened it.
595
-
596
- ### Focus
597
-
598
- * **Opening:** Focuses the first tabbable element, or the popup on touch. Pass `initialFocus` to start on Cancel.
599
- * **Trapping:** Focus stays inside the popup while it is open, and Tab never leaves it.
600
- * **Outside Press:** Does not close the popup. Only Escape, `closeButton` or `AlertDialog.Close` closes it.
601
- * **Closing:** Focus returns to the trigger. Pass `finalFocus` when the trigger is gone, such as after deleting its row.
602
-
603
- ### Your Responsibilities
604
-
605
- * **Render a Title and Description:** Always render both in `AlertDialog.Header`. Without them, the popup has no name or description.
606
-
607
- ## Related
608
-
609
- [Dialog](dialog.md)
610
-
611
- Use for focused tasks with fields.
612
-
613
- [Button](button.md)
614
-
615
- Use for each action in the footer.
616
-
617
- [ButtonGroup](button-group.md)
618
-
619
- Use for the Cancel and confirm actions.
620
-
621
- [Menu](menu.md)
622
-
623
- Use for opening a confirmation from a destructive item.
624
-
625
- [Toast](toast.md)
626
-
627
- Use for Undo after reversible actions.
628
-
629
- [Destructive Actions](../patterns/destructive-actions.md)
630
-
631
- Covers deleting and revoking.