@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,612 +0,0 @@
1
- # Empty States
2
-
3
- Explain why a region has nothing to show, and offer the next step that fills it.
4
-
5
- ## Overview
6
-
7
- An empty region can mean missing data, a filter with no matches, finished work, or a failed request. Each cause takes different words and actions. [Empty](../components/empty.md) composes the parts, and every empty state covers three points:
8
-
9
- * **What Is This Place? (Empty.Title):** Names the content that would appear.
10
- * **Why Is It Empty? (Empty.Description):** Explains the cause in one sentence.
11
- * **What Can I Do? (Empty.Actions):** One action that fills the region, if one exists.
12
-
13
- ## Variants
14
-
15
- The cause decides the text and the action. These are reference layouts built from [Surface](../components/surface.md), [Empty](../components/empty.md), and [Button](../components/button.md), not shipped components.
16
-
17
- ### First Use
18
-
19
- ```tsx
20
- import { Button, Empty, style, Surface } from '@tempoxyz/ds'
21
- import { History } from '@tempoxyz/ds/icons'
22
-
23
- export const fill = true
24
- export function Demo() {
25
- return (
26
- <div {...styles.page()}>
27
- <Surface {...styles.card()}>
28
- <Surface.Header>
29
- <Surface.Title>Activity</Surface.Title>
30
- </Surface.Header>
31
- <Empty.Root>
32
- <Empty.Icon>
33
- <History />
34
- </Empty.Icon>
35
- <Empty.Title>No activity yet</Empty.Title>
36
- <Empty.Description>
37
- Payments you send and receive appear here. Add funds to make your first payment.
38
- </Empty.Description>
39
- <Empty.Actions>
40
- <Button size="small">Add funds</Button>
41
- </Empty.Actions>
42
- </Empty.Root>
43
- </Surface>
44
- </div>
45
- )
46
- }
47
-
48
- namespace styles {
49
- export const card = style({
50
- boxSizing: 'border-box',
51
- maxWidth: '26rem !custom',
52
- width: '100% !custom',
53
- })
54
-
55
- export const page = style({
56
- backgroundColor: 'background.primary',
57
- display: 'grid',
58
- justifyItems: 'center',
59
- padding: '16',
60
- })
61
- }
62
- ```
63
-
64
- [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Patterns/EmptyFirstUse.tsx)
65
-
66
- Nothing exists yet. State what will appear, and offer the action that creates the first item, such as Add funds or Create key.
67
-
68
- ### No Results
69
-
70
- ```tsx
71
- import { Button, Empty, Field, Identicon, ListGroup, style, Surface, TextInput } from '@tempoxyz/ds'
72
- import { Search } from '@tempoxyz/ds/icons'
73
- import { useRef, useState } from 'react'
74
-
75
- export const fill = true
76
- const contacts = [
77
- ['Ada', '0x71C7656EC7ab88b098defB751B7401B5f6d8976F'],
78
- ['Payroll', '0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC'],
79
- ['Treasury', '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'],
80
- ] as const
81
-
82
- export function Demo() {
83
- const input = useRef<HTMLInputElement>(null)
84
- const [query, setQuery] = useState('zara')
85
- const matches = contacts.filter(([name, address]) =>
86
- `${name} ${address}`.toLowerCase().includes(query.trim().toLowerCase()),
87
- )
88
-
89
- return (
90
- <div {...styles.page()}>
91
- <Surface {...styles.card()}>
92
- <Surface.Header>
93
- <Surface.Title>Contacts</Surface.Title>
94
- </Surface.Header>
95
- <Field.Root>
96
- <TextInput.Group>
97
- <TextInput.Prefix>
98
- <Search />
99
- </TextInput.Prefix>
100
- <TextInput.Control
101
- aria-label="Search contacts"
102
- onValueChange={setQuery}
103
- placeholder="Name or address"
104
- ref={input}
105
- type="search"
106
- value={query}
107
- />
108
- <TextInput.Clear />
109
- </TextInput.Group>
110
- </Field.Root>
111
- {/* Stays mounted, so screen readers hear the count change as you type. */}
112
- <p role="status" {...styles.status()}>
113
- {matches.length === 1 ? '1 contact' : `${matches.length} contacts`}
114
- </p>
115
- {matches.length > 0 ? (
116
- <div {...styles.rows()}>
117
- <ListGroup.Root>
118
- {matches.map(([name, address]) => (
119
- <ListGroup.Row key={address}>
120
- <Identicon address={address} aria-hidden size="24" />
121
- <ListGroup.Info>
122
- <ListGroup.Title>{name}</ListGroup.Title>
123
- <ListGroup.Description>
124
- {address.slice(0, 6)}…{address.slice(-4)}
125
- </ListGroup.Description>
126
- </ListGroup.Info>
127
- </ListGroup.Row>
128
- ))}
129
- </ListGroup.Root>
130
- </div>
131
- ) : (
132
- <Empty.Root>
133
- <Empty.Icon>
134
- <Search />
135
- </Empty.Icon>
136
- <Empty.Title>No contacts match “{query.trim()}”</Empty.Title>
137
- <Empty.Description>
138
- Check the spelling, or search by the full 0x address.
139
- </Empty.Description>
140
- <Empty.Actions>
141
- <Button
142
- onClick={() => {
143
- setQuery('')
144
- input.current?.focus()
145
- }}
146
- size="small"
147
- variant="secondary"
148
- >
149
- Clear search
150
- </Button>
151
- </Empty.Actions>
152
- </Empty.Root>
153
- )}
154
- </Surface>
155
- </div>
156
- )
157
- }
158
-
159
- namespace styles {
160
- export const card = style({
161
- boxSizing: 'border-box',
162
- maxWidth: '26rem !custom',
163
- width: '100% !custom',
164
- })
165
-
166
- export const page = style({
167
- backgroundColor: 'background.primary',
168
- display: 'grid',
169
- justifyItems: 'center',
170
- padding: '16',
171
- })
172
-
173
- export const rows = style({ marginBlockStart: '8' })
174
-
175
- export const status = style({
176
- clipPath: 'inset(50%) !custom',
177
- height: '1px !custom',
178
- margin: '0',
179
- overflow: 'hidden',
180
- position: 'absolute',
181
- whiteSpace: 'nowrap',
182
- width: '1px !custom',
183
- })
184
- }
185
- ```
186
-
187
- [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Patterns/EmptyNoResults.tsx)
188
-
189
- Repeat the query in the title, so the reader can spot a typo. Offer Clear search or Clear filters as a `secondary` button, and keep the search field and filters visible above the empty state.
190
-
191
- **Do:** Repeat the query and offer a way to widen the search.
192
-
193
- ```tsx
194
- <Empty.Root>
195
- <Empty.Icon>
196
- <Search />
197
- </Empty.Icon>
198
- <Empty.Title>No results for "rent"</Empty.Title>
199
- <Empty.Description>Check the spelling or search for another payment.</Empty.Description>
200
- <Empty.Actions>
201
- <Button size="small" variant="secondary">Clear search</Button>
202
- </Empty.Actions>
203
- </Empty.Root>
204
- ```
205
-
206
- **Don't:** If a filter hides existing items, don't show the first use state.
207
-
208
- ```tsx
209
- <Empty.Root>
210
- <Empty.Icon>
211
- <Wallet />
212
- </Empty.Icon>
213
- <Empty.Title>No payments yet</Empty.Title>
214
- <Empty.Description>Payments you send or receive appear here.</Empty.Description>
215
- <Empty.Actions>
216
- <Button size="small">Add funds</Button>
217
- </Empty.Actions>
218
- </Empty.Root>
219
- ```
220
-
221
- ### Cleared
222
-
223
- ```tsx
224
- import { Button, Empty, style, Surface } from '@tempoxyz/ds'
225
- import { CheckCircle } from '@tempoxyz/ds/icons'
226
-
227
- export const fill = true
228
- export function Demo() {
229
- return (
230
- <div {...styles.page()}>
231
- <Surface {...styles.card()}>
232
- <Surface.Header>
233
- <Surface.Title>Payment requests</Surface.Title>
234
- </Surface.Header>
235
- <Empty.Root>
236
- <Empty.Icon>
237
- <CheckCircle />
238
- </Empty.Icon>
239
- <Empty.Title>No pending requests</Empty.Title>
240
- <Empty.Description>
241
- You've paid or declined every request. New requests appear here.
242
- </Empty.Description>
243
- <Empty.Actions>
244
- <Button size="small" variant="secondary">
245
- View history
246
- </Button>
247
- </Empty.Actions>
248
- </Empty.Root>
249
- </Surface>
250
- </div>
251
- )
252
- }
253
-
254
- namespace styles {
255
- export const card = style({
256
- boxSizing: 'border-box',
257
- maxWidth: '26rem !custom',
258
- width: '100% !custom',
259
- })
260
-
261
- export const page = style({
262
- backgroundColor: 'background.primary',
263
- display: 'grid',
264
- justifyItems: 'center',
265
- padding: '16',
266
- })
267
- }
268
- ```
269
-
270
- [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Patterns/EmptyCleared.tsx)
271
-
272
- If the reader processed everything, such as every payment request, confirm that nothing is left. Leave out the primary action. If a history exists, link to it.
273
-
274
- **Do:** Confirm the reader finished, and state what will appear next.
275
-
276
- ```tsx
277
- <Empty.Root>
278
- <Empty.Icon>
279
- <Check />
280
- </Empty.Icon>
281
- <Empty.Title>All caught up</Empty.Title>
282
- <Empty.Description>New requests appear here when someone asks you to pay.</Empty.Description>
283
- </Empty.Root>
284
- ```
285
-
286
- **Don't:** Use playful filler in place of a clear outcome.
287
-
288
- ```tsx
289
- <Empty.Root>
290
- <Empty.Icon>
291
- <Clipboard />
292
- </Empty.Icon>
293
- <Empty.Title>Nothing here!</Empty.Title>
294
- <Empty.Description>Looks like it is pretty quiet. Check back later!</Empty.Description>
295
- </Empty.Root>
296
- ```
297
-
298
- ### Error-Empty
299
-
300
- ```tsx
301
- import { Button, Empty, ListGroup, style, Surface } from '@tempoxyz/ds'
302
- import { AlertCircle } from '@tempoxyz/ds/icons'
303
- import { useState } from 'react'
304
-
305
- export const fill = true
306
- function Failed(props: { onRetry: () => void; retrying: boolean }) {
307
- return (
308
- <Empty.Root>
309
- <Empty.Icon>
310
- <AlertCircle />
311
- </Empty.Icon>
312
- <Empty.Title>Couldn't load activity</Empty.Title>
313
- <Empty.Description>
314
- Check your connection, then try again. Your balance and payments aren't affected.
315
- </Empty.Description>
316
- <Empty.Actions>
317
- <Button loading={props.retrying} onClick={props.onRetry} size="small">
318
- Try again
319
- </Button>
320
- </Empty.Actions>
321
- </Empty.Root>
322
- )
323
- }
324
-
325
- export function Demo() {
326
- const [loaded, setLoaded] = useState(false)
327
- const [retrying, setRetrying] = useState(false)
328
-
329
- return (
330
- <div {...styles.page()}>
331
- <Surface {...styles.card()}>
332
- <Surface.Header>
333
- <Surface.Title>Activity</Surface.Title>
334
- </Surface.Header>
335
- {loaded ? (
336
- <div {...styles.rows()}>
337
- <ListGroup.Root>
338
- <ListGroup.Row>
339
- <ListGroup.Label>Received from 0x3C44…93BC</ListGroup.Label>
340
- 120.00 USDC
341
- </ListGroup.Row>
342
- <ListGroup.Row>
343
- <ListGroup.Label>Sent to 0x71C7…976F</ListGroup.Label>
344
- 25.00 USDC
345
- </ListGroup.Row>
346
- </ListGroup.Root>
347
- </div>
348
- ) : (
349
- <Failed
350
- onRetry={() => {
351
- setRetrying(true)
352
- setTimeout(() => {
353
- setRetrying(false)
354
- setLoaded(true)
355
- }, 1000)
356
- }}
357
- retrying={retrying}
358
- />
359
- )}
360
- </Surface>
361
- </div>
362
- )
363
- }
364
-
365
- namespace styles {
366
- export const card = style({
367
- boxSizing: 'border-box',
368
- maxWidth: '26rem !custom',
369
- width: '100% !custom',
370
- })
371
-
372
- export const page = style({
373
- backgroundColor: 'background.primary',
374
- display: 'grid',
375
- justifyItems: 'center',
376
- padding: '16',
377
- })
378
-
379
- export const rows = style({ marginBlockStart: '8' })
380
- }
381
- ```
382
-
383
- [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Patterns/EmptyError.tsx)
384
-
385
- If the request fails, write Couldn't load followed by the content, and offer Try again. Set `loading` on the [Button](../components/button.md) while the retry runs.
386
-
387
- ## Guidelines
388
-
389
- ### Explain the Cause and the Next Step
390
-
391
- Write the title as a short statement of what is missing, such as No API keys yet. Use the description for the cause and what the action does.
392
-
393
- **Do:** State what is missing and offer the action that adds it.
394
-
395
- ```tsx
396
- /**
397
- * Do example for "Explain the Cause and the Next Step" on the Empty States page.
398
- * State what is missing and offer the action that adds it.
399
- * @module
400
- */
401
- import { Button, Empty } from '@tempoxyz/ds'
402
- import { Key } from '@tempoxyz/ds/icons'
403
-
404
- /** Renders the static preview, which the guideline card shows inert. */
405
- export function Demo() {
406
- return (
407
- <Empty.Root>
408
- <Empty.Icon>
409
- <Key />
410
- </Empty.Icon>
411
- <Empty.Title>No API keys yet</Empty.Title>
412
- <Empty.Description>Create a key to call the Tempo API from your server.</Empty.Description>
413
- <Empty.Actions>
414
- <Button size="small">Create key</Button>
415
- </Empty.Actions>
416
- </Empty.Root>
417
- )
418
- }
419
- ```
420
-
421
- **Don't:** Show a bare No data message with nothing to do next.
422
-
423
- ```tsx
424
- /**
425
- * Don't example for "Explain the Cause and the Next Step" on the Empty States page.
426
- * Don't show a bare No data message with nothing to do next.
427
- * @module
428
- */
429
- import { Empty } from '@tempoxyz/ds'
430
-
431
- /** Renders the static preview, which the guideline card shows inert. */
432
- export function Demo() {
433
- return (
434
- <Empty.Root>
435
- <Empty.Title>No data</Empty.Title>
436
- </Empty.Root>
437
- )
438
- }
439
- ```
440
-
441
- ### Never Show a Failed Request as Empty
442
-
443
- An empty list after a failed request falsely reports no activity. Keep empty states for successful requests with no content.
444
-
445
- **Do:** State that the content couldn't load, and offer Try again.
446
-
447
- ```tsx
448
- /**
449
- * Do example for "Never Show a Failed Request as Empty" on the Empty States page.
450
- * State that the content couldn't load, and offer Try again.
451
- * @module
452
- */
453
- import { Button, Empty } from '@tempoxyz/ds'
454
- import { AlertCircle } from '@tempoxyz/ds/icons'
455
-
456
- /** Renders the static preview, which the guideline card shows inert. */
457
- export function Demo() {
458
- return (
459
- <Empty.Root>
460
- <Empty.Icon>
461
- <AlertCircle />
462
- </Empty.Icon>
463
- <Empty.Title>Couldn't load activity</Empty.Title>
464
- <Empty.Description>Check your connection, then try again.</Empty.Description>
465
- <Empty.Actions>
466
- <Button size="small">Try again</Button>
467
- </Empty.Actions>
468
- </Empty.Root>
469
- )
470
- }
471
- ```
472
-
473
- **Don't:** Show No activity yet after the request failed.
474
-
475
- ```tsx
476
- /**
477
- * Don't example for "Never Show a Failed Request as Empty" on the Empty States page.
478
- * Don't show No activity yet after the request failed.
479
- * @module
480
- */
481
- import { Empty } from '@tempoxyz/ds'
482
- import { History } from '@tempoxyz/ds/icons'
483
-
484
- /** Renders the static preview, which the guideline card shows inert. */
485
- export function Demo() {
486
- return (
487
- <Empty.Root>
488
- <Empty.Icon>
489
- <History />
490
- </Empty.Icon>
491
- <Empty.Title>No activity yet</Empty.Title>
492
- <Empty.Description>Payments you send and receive appear here.</Empty.Description>
493
- </Empty.Root>
494
- )
495
- }
496
- ```
497
-
498
- ### Offer One Primary Action
499
-
500
- Make it the task that fills the region. Add a secondary button only for a related step, such as a guide, and use `Button.Link` if the action opens another page.
501
-
502
- **Do:** Pair one primary action with an optional secondary one.
503
-
504
- ```tsx
505
- /**
506
- * Do example for "Offer One Primary Action" on the Empty States page.
507
- * Pair one primary action with an optional secondary one.
508
- * @module
509
- */
510
- import { Button, Empty } from '@tempoxyz/ds'
511
- import { Link } from '@tempoxyz/ds/icons'
512
-
513
- /** Renders the static preview, which the guideline card shows inert. */
514
- export function Demo() {
515
- return (
516
- <Empty.Root>
517
- <Empty.Icon>
518
- <Link />
519
- </Empty.Icon>
520
- <Empty.Title>No webhooks</Empty.Title>
521
- <Empty.Description>Add an endpoint to receive payment events.</Empty.Description>
522
- <Empty.Actions>
523
- <Button size="small">Add webhook</Button>
524
- <Button size="small" variant="secondary">
525
- Read the guide
526
- </Button>
527
- </Empty.Actions>
528
- </Empty.Root>
529
- )
530
- }
531
- ```
532
-
533
- **Don't:** Offer several primary actions that compete for attention.
534
-
535
- ```tsx
536
- /**
537
- * Don't example for "Offer One Primary Action" on the Empty States page.
538
- * Don't offer several primary actions that compete for attention.
539
- * @module
540
- */
541
- import { Button, Empty } from '@tempoxyz/ds'
542
- import { Link } from '@tempoxyz/ds/icons'
543
-
544
- /** Renders the static preview, which the guideline card shows inert. */
545
- export function Demo() {
546
- return (
547
- <Empty.Root>
548
- <Empty.Icon>
549
- <Link />
550
- </Empty.Icon>
551
- <Empty.Title>No webhooks</Empty.Title>
552
- <Empty.Description>Add an endpoint to receive payment events.</Empty.Description>
553
- <Empty.Actions>
554
- <Button size="small">Add webhook</Button>
555
- <Button size="small">Import</Button>
556
- <Button size="small">Test event</Button>
557
- </Empty.Actions>
558
- </Empty.Root>
559
- )
560
- }
561
- ```
562
-
563
- ### Fit the State to the Region
564
-
565
- * **Pages and Cards:** Use the full empty state with an icon that hints at the content.
566
- * **Small Regions:** In a small region, such as a [Popover](../components/popover.md), use a short line of text and no icon.
567
- * **Comboboxes (Combobox.Empty):** Render it in a [Combobox](../components/combobox.md), so an empty result is announced instead of an empty popup.
568
- * **Keep the Frame:** Keep the heading and filters. In a [Table](../components/table.md), put the empty state below the header row.
569
-
570
- ### Don't Show an Empty State While Loading
571
-
572
- * **Load First (Skeleton):** Show a [Skeleton](../components/skeleton.md) until the request settles. An empty state that flashes first reads as a missing balance.
573
- * **Then Decide:** After the request settles, choose content, an empty state, or an error (see [Loading](loading.md)).
574
-
575
- ## States
576
-
577
- * **Disabled:** If the reader lacks permission for the action, leave it out and state who can act.
578
- * **Success (Toast):** The new item replaces the empty state, and a [Toast](../components/toast.md) confirms it.
579
-
580
- ## Content
581
-
582
- * **Title (Sentence case):** Name what is missing, such as "No payments yet".
583
- * **Description (1 sentence):** Address the reader as "you".
584
- * **Action (Verb):** Lead with a verb, such as "Add funds".
585
-
586
- ## Accessibility
587
-
588
- * **Heading Level (h3):** Place the state under an `h2`, such as a `Surface.Title`, so heading levels stay in order.
589
- * **Announce Results (role=status):** The parts render no live region. If results change on input, announce the count in a polite region that stays mounted.
590
- * **Focus After Clearing:** After Clear search, move focus to the search field.
591
-
592
- ## Related
593
-
594
- [Empty](../components/empty.md)
595
-
596
- Use for the component parts.
597
-
598
- [Combobox](../components/combobox.md)
599
-
600
- Use for empty popups.
601
-
602
- [Loading](loading.md)
603
-
604
- Covers what shows before content.
605
-
606
- [Feedback and Status](feedback-and-status.md)
607
-
608
- Covers the Couldn't load state.
609
-
610
- [Tables and Lists](tables-and-lists.md)
611
-
612
- Covers empty tables.