@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,794 +0,0 @@
1
- # Amount
2
-
3
- Formats a number as money or a token amount.
4
-
5
- [View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/Amount.tsx)
6
-
7
- ## Overview
8
-
9
- Formats a number in `en-US` with tabular figures, as money or followed by a token symbol.
10
-
11
- ## Examples
12
-
13
- ### Basic
14
-
15
- ```tsx
16
- import { Amount } from '@tempoxyz/ds'
17
-
18
- export function Demo() {
19
- return <Amount symbol="PathUSD" value="1250.50" />
20
- }
21
- ```
22
-
23
- [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Amount/Basic.tsx)
24
-
25
- ### Size
26
-
27
- Set `size` to `sm` (default), `md`, `lg`, or `xl`.
28
-
29
- ```tsx
30
- import { Amount, style } from '@tempoxyz/ds'
31
-
32
- export const fill = true
33
- export function Demo() {
34
- return (
35
- <div {...styles.stack()}>
36
- {(['sm', 'md', 'lg', 'xl'] as const).map((size) => (
37
- <Amount key={size} size={size} symbol="PathUSD" value={1250.5} />
38
- ))}
39
- </div>
40
- )
41
- }
42
-
43
- namespace styles {
44
- export const stack = style({ display: 'grid', gap: '12', maxWidth: '24rem !custom' })
45
- }
46
- ```
47
-
48
- [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Amount/Size.tsx)
49
-
50
- ### Currency
51
-
52
- Set `currency` to an ISO 4217 code for money, or `symbol` to follow the number with a token symbol. Pass one, not both.
53
-
54
- ```tsx
55
- import { Amount, style } from '@tempoxyz/ds'
56
-
57
- export const fill = true
58
- export function Demo() {
59
- return (
60
- <div {...styles.stack()}>
61
- <Amount currency="USD" size="lg" value={1234.5} />
62
- <Amount currency="EUR" value={1234.5} />
63
- <Amount size="lg" symbol="PathUSD" value={1234.5} />
64
- </div>
65
- )
66
- }
67
-
68
- namespace styles {
69
- export const stack = style({ display: 'grid', gap: '12', maxWidth: '24rem !custom' })
70
- }
71
- ```
72
-
73
- [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Amount/Currency.tsx)
74
-
75
- ### Align
76
-
77
- Set `align` to `left` (default), `center`, or `right`.
78
-
79
- ```tsx
80
- import { Amount, style } from '@tempoxyz/ds'
81
-
82
- export const fill = true
83
- export function Demo() {
84
- return (
85
- <div {...styles.stack()}>
86
- {(['left', 'center', 'right'] as const).map((align) => (
87
- <Amount align={align} currency="USD" key={align} size="md" value={1234.5} />
88
- ))}
89
- </div>
90
- )
91
- }
92
-
93
- namespace styles {
94
- export const stack = style({ display: 'grid', gap: '12', maxWidth: '24rem !custom' })
95
- }
96
- ```
97
-
98
- [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Amount/Align.tsx)
99
-
100
- ### Sign
101
-
102
- Set `sign` to `+`, `-`, or `−` to prefix the amount.
103
-
104
- ```tsx
105
- import { Amount, style } from '@tempoxyz/ds'
106
-
107
- export const fill = true
108
- export function Demo() {
109
- return (
110
- <div {...styles.stack()}>
111
- <Amount align="center" sign="+" size="md" symbol="PathUSD" value="1250.50" />
112
- <Amount align="right" currency="USD" sign="−" size="md" value={1234.5} />
113
- </div>
114
- )
115
- }
116
-
117
- namespace styles {
118
- export const stack = style({ display: 'grid', gap: '12', maxWidth: '24rem !custom' })
119
- }
120
- ```
121
-
122
- [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Amount/Sign.tsx)
123
-
124
- ### Strikethrough
125
-
126
- Set `strikethrough` to mark a superseded amount.
127
-
128
- ```tsx
129
- import { Amount, style } from '@tempoxyz/ds'
130
-
131
- export const fill = true
132
- export function Demo() {
133
- return (
134
- <div {...styles.stack()}>
135
- <Amount size="md" strikethrough symbol="PathUSD" value={1250.5} />
136
- </div>
137
- )
138
- }
139
-
140
- namespace styles {
141
- export const stack = style({ display: 'grid', gap: '12', maxWidth: '24rem !custom' })
142
- }
143
- ```
144
-
145
- [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Amount/Strikethrough.tsx)
146
-
147
- ### Precise
148
-
149
- Set `precise` to show two significant digits for a currency value below the smallest shown unit.
150
-
151
- ```tsx
152
- import { Amount, style } from '@tempoxyz/ds'
153
-
154
- export const fill = true
155
- export function Demo() {
156
- return (
157
- <div {...styles.stack()}>
158
- <Amount currency="USD" value={0.0004} />
159
- <Amount currency="USD" precise value={0.0004} />
160
- </div>
161
- )
162
- }
163
-
164
- namespace styles {
165
- export const stack = style({ display: 'grid', gap: '12', maxWidth: '24rem !custom' })
166
- }
167
- ```
168
-
169
- [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Amount/Precise.tsx)
170
-
171
- ### Max Decimals
172
-
173
- Set `maxDecimals` to cap the fraction digits shown.
174
-
175
- ```tsx
176
- import { Amount, style } from '@tempoxyz/ds'
177
-
178
- export const fill = true
179
- export function Demo() {
180
- return (
181
- <div {...styles.stack()}>
182
- <Amount symbol="PathUSD" value="1.23456" />
183
- <Amount maxDecimals={2} symbol="PathUSD" value="1.23456" />
184
- </div>
185
- )
186
- }
187
-
188
- namespace styles {
189
- export const stack = style({ display: 'grid', gap: '12', maxWidth: '24rem !custom' })
190
- }
191
- ```
192
-
193
- [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Amount/MaxDecimals.tsx)
194
-
195
- ### Locale
196
-
197
- Set `locale` to a BCP 47 tag, such as `de-DE`, to change grouping, decimal marks, and currency symbols. It defaults to `en-US`, so server and browser render the same text.
198
-
199
- ```tsx
200
- import { Amount, style } from '@tempoxyz/ds'
201
-
202
- export const fill = true
203
- export function Demo() {
204
- return (
205
- <div {...styles.stack()}>
206
- <Amount currency="USD" value="1250.50" />
207
- <Amount currency="USD" locale="de-DE" value="1250.50" />
208
- </div>
209
- )
210
- }
211
-
212
- namespace styles {
213
- export const stack = style({ display: 'grid', gap: '12', maxWidth: '24rem !custom' })
214
- }
215
- ```
216
-
217
- [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Amount/Locale.tsx)
218
-
219
- ## Anatomy
220
-
221
- Import the component and assemble its parts.
222
-
223
- ```tsx
224
- import { Amount } from '@tempoxyz/ds'
225
-
226
- <Amount />
227
- ```
228
-
229
- ## Guidelines
230
-
231
- ### When to Use
232
-
233
- * Show balances, payment amounts, fees, and converted values, such as 1,250.50 USDC or $1,250.50.
234
- * Show amounts in tables, rows, and review screens with consistent formatting.
235
-
236
- ### When Not to Use
237
-
238
- * Use [AmountInput](amount-input.md) when people enter an amount.
239
- * Use `Table.Cell` with `numeric` in a [Table](table.md) for counts and metrics without a unit, such as TPS or block height.
240
-
241
- ### Always Show the Unit
242
-
243
- **Do:** Pass `symbol` for a token amount and `currency` for money.
244
-
245
- ```tsx
246
- /**
247
- * Do example for "Always Show the Unit" on the Amount page.
248
- * Pass `symbol` for a token amount and `currency` for money.
249
- * @module
250
- */
251
- import { Amount, style } from '@tempoxyz/ds'
252
-
253
- /** Renders the static preview, which the guideline card shows inert. */
254
- export function Demo() {
255
- return (
256
- <div {...styles.stack()}>
257
- <Amount size="md" symbol="USDC" value="1250.50" />
258
- <Amount currency="USD" value="1250.50" />
259
- </div>
260
- )
261
- }
262
-
263
- namespace styles {
264
- export const stack = style({ display: 'grid', gap: '4' })
265
- }
266
- ```
267
-
268
- **Don't:** Show an amount without its token or currency.
269
-
270
- ```tsx
271
- /**
272
- * Don't example for "Always Show the Unit" on the Amount page.
273
- * Don't show an amount without its token or currency.
274
- * @module
275
- */
276
- import { Amount, style } from '@tempoxyz/ds'
277
-
278
- /** Renders the static preview, which the guideline card shows inert. */
279
- export function Demo() {
280
- return (
281
- <div {...styles.stack()}>
282
- <Amount size="md" value="1250.50" />
283
- <Amount value="1250.50" />
284
- </div>
285
- )
286
- }
287
-
288
- namespace styles {
289
- export const stack = style({ display: 'grid', gap: '4' })
290
- }
291
- ```
292
-
293
- ### Choose Currency or Symbol
294
-
295
- * **Currency:** Money and converted values, such as a portfolio total.
296
- * **Symbol:** Token amounts, such as what an account holds or sends.
297
-
298
- Show a stablecoin balance in its token, such as PathUSD, even if it tracks the dollar. If you have a rate, add a converted value with `currency` as a second line.
299
-
300
- ### Pass Exact Decimal Strings
301
-
302
- Pass `value` as a decimal string, such as a token balance converted from base units. Without `currency`, a string keeps its own fraction digits, including trailing zeros.
303
-
304
- **Do:** Pass decimal strings, such as `"0.30"`.
305
-
306
- ```tsx
307
- /**
308
- * Do example for "Pass Exact Decimal Strings" on the Amount page.
309
- * Pass decimal strings, such as `"0.30"`.
310
- * @module
311
- */
312
- import { Amount, style } from '@tempoxyz/ds'
313
-
314
- /** Renders the static preview, which the guideline card shows inert. */
315
- export function Demo() {
316
- return (
317
- <div {...styles.list()}>
318
- <div {...styles.row()}>
319
- <span {...styles.label()}>Available balance</span>
320
- <Amount align="right" symbol="USDC" value="1250.10" />
321
- </div>
322
- <div {...styles.row()}>
323
- <span {...styles.label()}>Total fees</span>
324
- <Amount align="right" symbol="USDC" value="0.30" />
325
- </div>
326
- </div>
327
- )
328
- }
329
-
330
- namespace styles {
331
- export const label = style({ color: 'content.secondary', typography: 'body.b2' })
332
-
333
- export const list = style({ display: 'grid', gap: '12', width: '100% !custom' })
334
-
335
- export const row = style({
336
- alignItems: 'baseline',
337
- display: 'flex',
338
- gap: '16',
339
- justifyContent: 'space-between',
340
- })
341
- }
342
- ```
343
-
344
- **Don't:** Pass numbers. They drop trailing zeros and show floating-point errors.
345
-
346
- ```tsx
347
- /**
348
- * Don't example for "Pass Exact Decimal Strings" on the Amount page.
349
- * Don't pass numbers. They drop trailing zeros and show floating-point errors.
350
- * @module
351
- */
352
- import { Amount, style } from '@tempoxyz/ds'
353
-
354
- /** Renders the static preview, which the guideline card shows inert. */
355
- export function Demo() {
356
- return (
357
- <div {...styles.list()}>
358
- <div {...styles.row()}>
359
- <span {...styles.label()}>Available balance</span>
360
- <Amount align="right" symbol="USDC" value={1250.1} />
361
- </div>
362
- <div {...styles.row()}>
363
- <span {...styles.label()}>Total fees</span>
364
- <Amount align="right" symbol="USDC" value={0.1 + 0.2} />
365
- </div>
366
- </div>
367
- )
368
- }
369
-
370
- namespace styles {
371
- export const label = style({ color: 'content.secondary', typography: 'body.b2' })
372
-
373
- export const list = style({ display: 'grid', gap: '12', width: '100% !custom' })
374
-
375
- export const row = style({
376
- alignItems: 'baseline',
377
- display: 'flex',
378
- gap: '16',
379
- justifyContent: 'space-between',
380
- })
381
- }
382
- ```
383
-
384
- ### Set Decimals by Purpose
385
-
386
- * **With `currency`:** Shows the currency's own digits, two for USD. `maxDecimals={0}` renders `$5`.
387
- * **Without `currency`:** Shows every digit of the string. Set `maxDecimals` in lists, and show the exact value in details and review screens.
388
- * **Rounding:** `0.999` with `maxDecimals={2}` renders `1.00`. Show the exact balance wherever people choose how much to send.
389
-
390
- **Do:** Use one decimal count down a column so decimal points line up.
391
-
392
- ```tsx
393
- /**
394
- * Do example for "Set Decimals by Purpose" on the Amount page.
395
- * Use one decimal count down a column so decimal points line up.
396
- * @module
397
- */
398
- import { Amount, style } from '@tempoxyz/ds'
399
-
400
- /** Renders the static preview, which the guideline card shows inert. */
401
- export function Demo() {
402
- return (
403
- <div {...styles.list()}>
404
- <div {...styles.row()}>
405
- <span {...styles.label()}>Main wallet</span>
406
- <Amount align="right" symbol="USDC" value="1250.50" />
407
- </div>
408
- <div {...styles.row()}>
409
- <span {...styles.label()}>Savings</span>
410
- <Amount align="right" symbol="USDC" value="84.10" />
411
- </div>
412
- <div {...styles.row()}>
413
- <span {...styles.label()}>Payroll</span>
414
- <Amount align="right" symbol="USDC" value="312.00" />
415
- </div>
416
- </div>
417
- )
418
- }
419
-
420
- namespace styles {
421
- export const label = style({ color: 'content.secondary', typography: 'body.b2' })
422
-
423
- export const list = style({ display: 'grid', gap: '12', width: '100% !custom' })
424
-
425
- export const row = style({
426
- alignItems: 'baseline',
427
- display: 'flex',
428
- gap: '16',
429
- justifyContent: 'space-between',
430
- })
431
- }
432
- ```
433
-
434
- **Don't:** Mix decimal counts in one column.
435
-
436
- ```tsx
437
- /**
438
- * Don't example for "Set Decimals by Purpose" on the Amount page.
439
- * Don't mix decimal counts in one column.
440
- * @module
441
- */
442
- import { Amount, style } from '@tempoxyz/ds'
443
-
444
- /** Renders the static preview, which the guideline card shows inert. */
445
- export function Demo() {
446
- return (
447
- <div {...styles.list()}>
448
- <div {...styles.row()}>
449
- <span {...styles.label()}>Main wallet</span>
450
- <Amount align="right" symbol="USDC" value="1250.504812" />
451
- </div>
452
- <div {...styles.row()}>
453
- <span {...styles.label()}>Savings</span>
454
- <Amount align="right" symbol="USDC" value="84.1" />
455
- </div>
456
- <div {...styles.row()}>
457
- <span {...styles.label()}>Payroll</span>
458
- <Amount align="right" symbol="USDC" value="312.0005" />
459
- </div>
460
- </div>
461
- )
462
- }
463
-
464
- namespace styles {
465
- export const label = style({ color: 'content.secondary', typography: 'body.b2' })
466
-
467
- export const list = style({ display: 'grid', gap: '12', width: '100% !custom' })
468
-
469
- export const row = style({
470
- alignItems: 'baseline',
471
- display: 'flex',
472
- gap: '16',
473
- justifyContent: 'space-between',
474
- })
475
- }
476
- ```
477
-
478
- ### Show Values Below a Cent Precisely
479
-
480
- A currency value below its smallest unit renders as a bound, such as `<$0.01`.
481
-
482
- **Do:** Set `precise` on network fees to show two significant digits.
483
-
484
- ```tsx
485
- /**
486
- * Do example for "Show Values Below a Cent Precisely" on the Amount page.
487
- * Set `precise` on network fees to show two significant digits.
488
- * @module
489
- */
490
- import { Amount, style } from '@tempoxyz/ds'
491
-
492
- /** Renders the static preview, which the guideline card shows inert. */
493
- export function Demo() {
494
- return (
495
- <div {...styles.list()}>
496
- <div {...styles.row()}>
497
- <span {...styles.label()}>You send</span>
498
- <Amount align="right" symbol="USDC" value="250.00" />
499
- </div>
500
- <div {...styles.row()}>
501
- <span {...styles.label()}>Network fee</span>
502
- <Amount align="right" currency="USD" precise value="0.0004" />
503
- </div>
504
- </div>
505
- )
506
- }
507
-
508
- namespace styles {
509
- export const label = style({ color: 'content.secondary', typography: 'body.b2' })
510
-
511
- export const list = style({ display: 'grid', gap: '12', width: '100% !custom' })
512
-
513
- export const row = style({
514
- alignItems: 'baseline',
515
- display: 'flex',
516
- gap: '16',
517
- justifyContent: 'space-between',
518
- })
519
- }
520
- ```
521
-
522
- **Don't:** Show a fee people pay as a bound.
523
-
524
- ```tsx
525
- /**
526
- * Don't example for "Show Values Below a Cent Precisely" on the Amount page.
527
- * Don't show a fee people pay as a bound.
528
- * @module
529
- */
530
- import { Amount, style } from '@tempoxyz/ds'
531
-
532
- /** Renders the static preview, which the guideline card shows inert. */
533
- export function Demo() {
534
- return (
535
- <div {...styles.list()}>
536
- <div {...styles.row()}>
537
- <span {...styles.label()}>You send</span>
538
- <Amount align="right" symbol="USDC" value="250.00" />
539
- </div>
540
- <div {...styles.row()}>
541
- <span {...styles.label()}>Network fee</span>
542
- <Amount align="right" currency="USD" value="0.0004" />
543
- </div>
544
- </div>
545
- )
546
- }
547
-
548
- namespace styles {
549
- export const label = style({ color: 'content.secondary', typography: 'body.b2' })
550
-
551
- export const list = style({ display: 'grid', gap: '12', width: '100% !custom' })
552
-
553
- export const row = style({
554
- alignItems: 'baseline',
555
- display: 'flex',
556
- gap: '16',
557
- justifyContent: 'space-between',
558
- })
559
- }
560
- ```
561
-
562
- ### Show Direction With a Sign
563
-
564
- Set `sign="+"` for money in and `sign="−"` for money out. Pass `value` without its own minus, or the amount shows two signs. Prefer the minus sign `−` to the hyphen `-`.
565
-
566
- **Do:** Mark incoming and outgoing amounts with `+` and `−`.
567
-
568
- ```tsx
569
- /**
570
- * Do example for "Show Direction With a Sign" on the Amount page.
571
- * Mark incoming and outgoing amounts with `+` and `−`.
572
- * @module
573
- */
574
- import { Amount, style } from '@tempoxyz/ds'
575
-
576
- /** Renders the static preview, which the guideline card shows inert. */
577
- export function Demo() {
578
- return (
579
- <div {...styles.list()}>
580
- <div {...styles.row()}>
581
- <span {...styles.label()}>Received from Jane</span>
582
- <Amount align="right" sign="+" symbol="USDC" value="120.00" />
583
- </div>
584
- <div {...styles.row()}>
585
- <span {...styles.label()}>Sent to 0x91bd…07e1</span>
586
- <Amount align="right" sign="−" symbol="USDC" value="48.50" />
587
- </div>
588
- </div>
589
- )
590
- }
591
-
592
- namespace styles {
593
- export const label = style({ color: 'content.secondary', typography: 'body.b2' })
594
-
595
- export const list = style({ display: 'grid', gap: '12', width: '100% !custom' })
596
-
597
- export const row = style({
598
- alignItems: 'baseline',
599
- display: 'flex',
600
- gap: '16',
601
- justifyContent: 'space-between',
602
- })
603
- }
604
- ```
605
-
606
- **Don't:** Show direction with green and red alone.
607
-
608
- ```tsx
609
- /**
610
- * Don't example for "Show Direction With a Sign" on the Amount page.
611
- * Don't show direction with green and red alone.
612
- * @module
613
- */
614
- import { style } from '@tempoxyz/ds'
615
-
616
- /** Renders the static preview, which the guideline card shows inert. */
617
- export function Demo() {
618
- return (
619
- <div {...styles.list()}>
620
- <div {...styles.row()}>
621
- <span {...styles.label()}>Received from Jane</span>
622
- <span {...styles.credit()}>120.00 USDC</span>
623
- </div>
624
- <div {...styles.row()}>
625
- <span {...styles.label()}>Sent to 0x91bd…07e1</span>
626
- <span {...styles.debit()}>48.50 USDC</span>
627
- </div>
628
- </div>
629
- )
630
- }
631
-
632
- namespace styles {
633
- export const credit = style({
634
- color: 'content.positive',
635
- fontVariantNumeric: 'tabular-nums !custom',
636
- typography: 'body.b2Strong',
637
- })
638
-
639
- export const debit = style({
640
- color: 'content.negative',
641
- fontVariantNumeric: 'tabular-nums !custom',
642
- typography: 'body.b2Strong',
643
- })
644
-
645
- export const label = style({ color: 'content.secondary', typography: 'body.b2' })
646
-
647
- export const list = style({ display: 'grid', gap: '12', width: '100% !custom' })
648
-
649
- export const row = style({
650
- alignItems: 'baseline',
651
- display: 'flex',
652
- gap: '16',
653
- justifyContent: 'space-between',
654
- })
655
- }
656
- ```
657
-
658
- ### Mark Superseded Amounts in Words
659
-
660
- Use `strikethrough` for an amount that no longer applies, such as an expired fee quote, and show the new amount beside it.
661
-
662
- **Do:** Say it in text, such as Was $0.02.
663
-
664
- ```tsx
665
- /**
666
- * Do example for "Mark Superseded Amounts in Words" on the Amount page.
667
- * Say it in text, such as Was $0.02.
668
- * @module
669
- */
670
- import { Amount, style } from '@tempoxyz/ds'
671
-
672
- /** Renders the static preview, which the guideline card shows inert. */
673
- export function Demo() {
674
- return (
675
- <div {...styles.row()}>
676
- <span {...styles.label()}>Network fee</span>
677
- <div {...styles.values()}>
678
- <span {...styles.label()}>Was</span>
679
- <Amount currency="USD" strikethrough value="0.02" />
680
- <Amount currency="USD" value="0.01" />
681
- </div>
682
- </div>
683
- )
684
- }
685
-
686
- namespace styles {
687
- export const label = style({ color: 'content.secondary', typography: 'body.b2' })
688
-
689
- export const row = style({
690
- alignItems: 'baseline',
691
- display: 'flex',
692
- gap: '16',
693
- justifyContent: 'space-between',
694
- width: '100% !custom',
695
- })
696
-
697
- export const values = style({ alignItems: 'baseline', display: 'flex', gap: '8' })
698
- }
699
- ```
700
-
701
- **Don't:** Rely on the line. Screen readers don't announce it.
702
-
703
- ```tsx
704
- /**
705
- * Don't example for "Mark Superseded Amounts in Words" on the Amount page.
706
- * Don't rely on the line. Screen readers don't announce it.
707
- * @module
708
- */
709
- import { Amount, style } from '@tempoxyz/ds'
710
-
711
- /** Renders the static preview, which the guideline card shows inert. */
712
- export function Demo() {
713
- return (
714
- <div {...styles.row()}>
715
- <span {...styles.label()}>Network fee</span>
716
- <div {...styles.values()}>
717
- <Amount currency="USD" strikethrough value="0.02" />
718
- <Amount currency="USD" value="0.01" />
719
- </div>
720
- </div>
721
- )
722
- }
723
-
724
- namespace styles {
725
- export const label = style({ color: 'content.secondary', typography: 'body.b2' })
726
-
727
- export const row = style({
728
- alignItems: 'baseline',
729
- display: 'flex',
730
- gap: '16',
731
- justifyContent: 'space-between',
732
- width: '100% !custom',
733
- })
734
-
735
- export const values = style({ alignItems: 'baseline', display: 'flex', gap: '8' })
736
- }
737
- ```
738
-
739
- ### Size by Importance
740
-
741
- * **Small (sm):** The default, for lists, tables, and rows.
742
- * **Medium (md):** Card values and review totals.
743
- * **Large (lg):** A balance at the top of a page.
744
- * **Extra Large (xl):** The single balance on a home screen.
745
-
746
- Amount renders as a block and ignores the alignment of a table cell. Set `align="right"` in an end-aligned column.
747
-
748
- ## Content
749
-
750
- * Label each amount by its role, such as You send, Network fee, or Available balance.
751
- * Don't repeat the unit in text, such as USD after $1,250.50.
752
- * Don't abbreviate amounts people act on, such as 1.2K.
753
-
754
- ## Accessibility
755
-
756
- Renders a `<span>` with no role. Screen readers read the formatted text as written. How they read symbols, such as `$`, `−`, or the `<` in `<$0.01`, depends on the screen reader and its settings.
757
-
758
- ### Semantics
759
-
760
- * **Root (span):** Plain text. Screen readers read the number with its sign and unit.
761
- * **Locale (locale):** Formats in `en-US`. Set `locale` to the page language for other separators.
762
- * **Strikethrough (strikethrough):** Visual only. Say in text that an amount is superseded.
763
-
764
- ### Your Responsibilities
765
-
766
- * **Mark Inexact Amounts:** Say in text if an amount is a bound or estimate, such as "Less than $0.01".
767
- * **Announce Live Updates (aria-live):** Amount does not announce updates. Put awaited ones, such as a quote, in a live region.
768
- * **Label Direction in Words:** Keep the sign, and label direction in words, such as "Received" and "Sent".
769
-
770
- ## Related
771
-
772
- [AmountInput](amount-input.md)
773
-
774
- Use for entering amounts.
775
-
776
- [TokenLogo](token-logo.md)
777
-
778
- Use for the token icon beside an amount.
779
-
780
- [Table](table.md)
781
-
782
- Use for laying out amounts.
783
-
784
- [ListGroup](list-group.md)
785
-
786
- Use for laying out amounts.
787
-
788
- [Payments](../patterns/payments.md)
789
-
790
- Covers send and review screens.
791
-
792
- [Blockchain Values](../patterns/blockchain-values.md)
793
-
794
- Covers token amounts and fees.