@tempoxyz/ds 0.3.9 → 0.3.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/docs/AGENTS.md +9 -0
- package/dist/docs/components/accordion.md +489 -0
- package/dist/docs/components/address-card.md +147 -0
- package/dist/docs/components/agent-logo.md +194 -0
- package/dist/docs/components/alert-dialog.md +631 -0
- package/dist/docs/components/alert.md +448 -0
- package/dist/docs/components/amount-input.md +305 -0
- package/dist/docs/components/amount.md +794 -0
- package/dist/docs/components/app-shell.md +559 -0
- package/dist/docs/components/asset-chip.md +294 -0
- package/dist/docs/components/autocomplete.md +619 -0
- package/dist/docs/components/avatar.md +321 -0
- package/dist/docs/components/badge.md +339 -0
- package/dist/docs/components/badged-logo.md +116 -0
- package/dist/docs/components/banner.md +379 -0
- package/dist/docs/components/bar-chart.md +208 -0
- package/dist/docs/components/breadcrumbs.md +380 -0
- package/dist/docs/components/button-group.md +286 -0
- package/dist/docs/components/button.md +650 -0
- package/dist/docs/components/calendar.md +375 -0
- package/dist/docs/components/callout.md +96 -0
- package/dist/docs/components/checkbox-group.md +521 -0
- package/dist/docs/components/checkbox.md +467 -0
- package/dist/docs/components/choice-group.md +516 -0
- package/dist/docs/components/choicebox.md +641 -0
- package/dist/docs/components/code.md +100 -0
- package/dist/docs/components/combobox.md +939 -0
- package/dist/docs/components/container.md +257 -0
- package/dist/docs/components/copy-button.md +642 -0
- package/dist/docs/components/date-picker.md +514 -0
- package/dist/docs/components/dialog.md +1332 -0
- package/dist/docs/components/drawer.md +966 -0
- package/dist/docs/components/empty.md +340 -0
- package/dist/docs/components/field.md +570 -0
- package/dist/docs/components/fieldset.md +398 -0
- package/dist/docs/components/frame.md +434 -0
- package/dist/docs/components/gauge.md +299 -0
- package/dist/docs/components/get-started-visual.md +117 -0
- package/dist/docs/components/grid.md +288 -0
- package/dist/docs/components/hero-visual.md +155 -0
- package/dist/docs/components/hex.md +487 -0
- package/dist/docs/components/icon-tile.md +292 -0
- package/dist/docs/components/identicon.md +371 -0
- package/dist/docs/components/inline.md +233 -0
- package/dist/docs/components/inset.md +225 -0
- package/dist/docs/components/kbd.md +423 -0
- package/dist/docs/components/list-group.md +981 -0
- package/dist/docs/components/loading-dots.md +237 -0
- package/dist/docs/components/menu.md +934 -0
- package/dist/docs/components/native-select.md +204 -0
- package/dist/docs/components/network-logo.md +248 -0
- package/dist/docs/components/number-field.md +543 -0
- package/dist/docs/components/otp-field.md +616 -0
- package/dist/docs/components/pagination.md +516 -0
- package/dist/docs/components/popover.md +544 -0
- package/dist/docs/components/progress.md +388 -0
- package/dist/docs/components/qr.md +314 -0
- package/dist/docs/components/radio-group.md +528 -0
- package/dist/docs/components/secret-value.md +406 -0
- package/dist/docs/components/select.md +751 -0
- package/dist/docs/components/separator.md +379 -0
- package/dist/docs/components/sidebar-menu.md +922 -0
- package/dist/docs/components/skeleton.md +517 -0
- package/dist/docs/components/slider.md +539 -0
- package/dist/docs/components/snippet.md +424 -0
- package/dist/docs/components/spinner.md +216 -0
- package/dist/docs/components/split-bar.md +139 -0
- package/dist/docs/components/split-button.md +464 -0
- package/dist/docs/components/stack.md +299 -0
- package/dist/docs/components/status-chip.md +226 -0
- package/dist/docs/components/status-indicator.md +119 -0
- package/dist/docs/components/status-row.md +174 -0
- package/dist/docs/components/stepper.md +451 -0
- package/dist/docs/components/success-hero.md +157 -0
- package/dist/docs/components/surface.md +639 -0
- package/dist/docs/components/switch.md +472 -0
- package/dist/docs/components/table.md +967 -0
- package/dist/docs/components/tabs.md +627 -0
- package/dist/docs/components/tempo-logo.md +185 -0
- package/dist/docs/components/text-input.md +624 -0
- package/dist/docs/components/textarea.md +352 -0
- package/dist/docs/components/toast.md +535 -0
- package/dist/docs/components/token-logo.md +371 -0
- package/dist/docs/components/token.md +247 -0
- package/dist/docs/components/tooltip.md +490 -0
- package/dist/docs/components/verification-code.md +116 -0
- package/dist/docs/components/visual.md +249 -0
- package/dist/docs/components.md +203 -0
- package/dist/docs/foundations/accessibility.md +377 -0
- package/dist/docs/foundations/agents.md +150 -0
- package/dist/docs/foundations/color.md +522 -0
- package/dist/docs/foundations/content/tone.md +194 -0
- package/dist/docs/foundations/content/voice.md +194 -0
- package/dist/docs/foundations/content/writing-style.md +406 -0
- package/dist/docs/foundations/iconography.md +282 -0
- package/dist/docs/foundations/intent.md +360 -0
- package/dist/docs/foundations/layout.md +508 -0
- package/dist/docs/foundations/linter.md +296 -0
- package/dist/docs/foundations/motion.md +151 -0
- package/dist/docs/foundations/radius-and-padding.md +86 -0
- package/dist/docs/foundations/typography.md +266 -0
- package/dist/docs/index.md +137 -0
- package/dist/docs/introduction/faq.md +132 -0
- package/dist/docs/introduction/getting-started.md +377 -0
- package/dist/docs/patterns/blockchain-values.md +709 -0
- package/dist/docs/patterns/dashboards.md +638 -0
- package/dist/docs/patterns/destructive-actions.md +626 -0
- package/dist/docs/patterns/empty-states.md +612 -0
- package/dist/docs/patterns/errors-and-validation.md +808 -0
- package/dist/docs/patterns/feedback-and-status.md +518 -0
- package/dist/docs/patterns/forms.md +679 -0
- package/dist/docs/patterns/loading.md +630 -0
- package/dist/docs/patterns/navigation.md +397 -0
- package/dist/docs/patterns/payments.md +765 -0
- package/dist/docs/patterns/responsive-layout.md +997 -0
- package/dist/docs/patterns/tables-and-lists.md +964 -0
- package/dist/docs/products/tempo-console.md +671 -0
- package/dist/docs/products/tempo-performance.md +437 -0
- package/dist/docs/products/tempo-wallet.md +438 -0
- package/dist/web/components/OtpField.css +1 -1
- package/dist/web/components/OtpField.d.ts +1 -1
- package/dist/web/components/OtpField.d.ts.map +1 -1
- package/dist/web/components/OtpField.js +3 -4
- package/dist/web/components/OtpField.js.map +1 -1
- package/dist/web/components/OtpField.js.zyzz.json +1 -1
- package/dist/web/index.js.zyzz.json +1 -1
- package/package.json +1 -1
- package/src/web/components/OtpField.tsx +2 -24
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
# HeroVisual
|
|
2
|
+
|
|
3
|
+
Shows animated streaks and a title beside the steps of a setup flow.
|
|
4
|
+
|
|
5
|
+
[View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/HeroVisual.tsx)
|
|
6
|
+
|
|
7
|
+
Figma: [Content/Hero Visual](https://www.figma.com/design/yE96kcymnNR88PJp6G1sPs?node-id=5227-4030)
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
A hero visual renders a dark 520px card with the Tempo wordmark at the top and a title block at the bottom. `step` selects the streaks of the current step, and the next step slides new streaks in.
|
|
12
|
+
|
|
13
|
+
## Examples
|
|
14
|
+
|
|
15
|
+
### Basic
|
|
16
|
+
|
|
17
|
+
Compose a title and a description. The card stays dark in both color schemes.
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
/** Demonstrates HeroVisual in the documentation. @module */
|
|
21
|
+
import { HeroVisual, style } from '@tempoxyz/ds'
|
|
22
|
+
|
|
23
|
+
export function Demo() {
|
|
24
|
+
return (
|
|
25
|
+
<div {...styles.frame()}>
|
|
26
|
+
<HeroVisual step="connect">
|
|
27
|
+
<HeroVisual.Title>Your agent</HeroVisual.Title>
|
|
28
|
+
<HeroVisual.Description>One command, and it can pay its own way.</HeroVisual.Description>
|
|
29
|
+
</HeroVisual>
|
|
30
|
+
</div>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
namespace styles {
|
|
35
|
+
export const frame = style({ maxWidth: '31.25rem !custom', width: '100% !custom' })
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/HeroVisual/Basic.tsx)
|
|
40
|
+
|
|
41
|
+
### Steps
|
|
42
|
+
|
|
43
|
+
Advance `step` with the flow. The title brightens on the steps that complete it.
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
/** Demonstrates HeroVisual in the documentation. @module */
|
|
47
|
+
import { Button, HeroVisual, style } from '@tempoxyz/ds'
|
|
48
|
+
import { useState } from 'react'
|
|
49
|
+
|
|
50
|
+
const steps = ['connect', 'approve', 'fund', 'funding', 'funded'] as const
|
|
51
|
+
|
|
52
|
+
export function Demo() {
|
|
53
|
+
const [index, setIndex] = useState(0)
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<div {...styles.frame()}>
|
|
57
|
+
<HeroVisual step={steps[index]}>
|
|
58
|
+
<HeroVisual.Caption>Claude</HeroVisual.Caption>
|
|
59
|
+
<HeroVisual.Title>Your agent</HeroVisual.Title>
|
|
60
|
+
<HeroVisual.Description>One command, and it can pay its own way.</HeroVisual.Description>
|
|
61
|
+
</HeroVisual>
|
|
62
|
+
<Button onClick={() => setIndex((index + 1) % steps.length)} variant="secondary">
|
|
63
|
+
Next step
|
|
64
|
+
</Button>
|
|
65
|
+
</div>
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
namespace styles {
|
|
70
|
+
export const frame = style({
|
|
71
|
+
display: 'grid',
|
|
72
|
+
gap: '16',
|
|
73
|
+
justifyItems: 'start',
|
|
74
|
+
maxWidth: '31.25rem !custom',
|
|
75
|
+
width: '100% !custom',
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/HeroVisual/Steps.tsx)
|
|
81
|
+
|
|
82
|
+
## Anatomy
|
|
83
|
+
|
|
84
|
+
Import the component and assemble its parts.
|
|
85
|
+
|
|
86
|
+
```tsx
|
|
87
|
+
import { HeroVisual } from '@tempoxyz/ds'
|
|
88
|
+
|
|
89
|
+
<HeroVisual>
|
|
90
|
+
<HeroVisual.Caption />
|
|
91
|
+
<HeroVisual.Title />
|
|
92
|
+
<HeroVisual.Description />
|
|
93
|
+
</HeroVisual>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Guidelines
|
|
97
|
+
|
|
98
|
+
### When to Use
|
|
99
|
+
|
|
100
|
+
* Accompany the steps of an agent or wallet setup flow, beside the form of each step.
|
|
101
|
+
|
|
102
|
+
### When Not to Use
|
|
103
|
+
|
|
104
|
+
* Use [SuccessHero](/docs/components/success-hero) once the flow finishes.
|
|
105
|
+
* Use [GetStartedVisual](/docs/components/get-started-visual) for the cards of a get started list.
|
|
106
|
+
|
|
107
|
+
### Advance the Step With the Flow
|
|
108
|
+
|
|
109
|
+
* **Agent (connect to funded):** The agent flow runs connect, approve, fund, funding, and funded.
|
|
110
|
+
* **Wallet (wallet to secure):** The wallet flow runs wallet, wallet funding, wallet funded, and secure.
|
|
111
|
+
|
|
112
|
+
### Keep the Title Short
|
|
113
|
+
|
|
114
|
+
The title sets at display size and fits about 12 characters on one line.
|
|
115
|
+
|
|
116
|
+
**Do:** Name the subject of the flow in two words.
|
|
117
|
+
|
|
118
|
+
```tsx
|
|
119
|
+
<HeroVisual step="connect" style={{ minHeight: 240, width: 320 }}>
|
|
120
|
+
<HeroVisual.Title>Your agent</HeroVisual.Title>
|
|
121
|
+
</HeroVisual>
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**Don't:** Write a sentence in the title.
|
|
125
|
+
|
|
126
|
+
```tsx
|
|
127
|
+
<HeroVisual step="connect" style={{ minHeight: 240, width: 320 }}>
|
|
128
|
+
<HeroVisual.Title>Set up your agent to pay for things</HeroVisual.Title>
|
|
129
|
+
</HeroVisual>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Content
|
|
133
|
+
|
|
134
|
+
* **Caption:** Name the agent or wallet in one or two words.
|
|
135
|
+
* **Title:** Name the subject of the flow, such as Your agent.
|
|
136
|
+
* **Description:** Write one sentence that states what the flow enables.
|
|
137
|
+
|
|
138
|
+
## Accessibility
|
|
139
|
+
|
|
140
|
+
The card renders a `<div>` with no role. Screen readers skip the artwork and the wordmark, and read the text in order.
|
|
141
|
+
|
|
142
|
+
* **Artwork (aria-hidden):** The streaks and the wordmark are decorative.
|
|
143
|
+
* **HeroVisual.Title (h2):** Announced as a second-level heading.
|
|
144
|
+
* **Reduced Motion (prefers-reduced-motion):** New streaks fade in without movement.
|
|
145
|
+
* **Announce Progress (Your task):** The steps of the flow announce progress, not the card.
|
|
146
|
+
|
|
147
|
+
## Related
|
|
148
|
+
|
|
149
|
+
[SuccessHero](/docs/components/success-hero)
|
|
150
|
+
|
|
151
|
+
Use for the confirmation after the flow finishes.
|
|
152
|
+
|
|
153
|
+
[Stepper](/docs/components/stepper)
|
|
154
|
+
|
|
155
|
+
Use for the steps beside the card.
|
|
@@ -0,0 +1,487 @@
|
|
|
1
|
+
# Hex
|
|
2
|
+
|
|
3
|
+
Shows a hex string, such as an address, truncated to fit.
|
|
4
|
+
|
|
5
|
+
[View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/Hex.tsx)
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
Hex shows a hex string, such as an address or hash, middle-truncated to fit its container. Both ends stay visible, and screen readers read the full value.
|
|
10
|
+
|
|
11
|
+
## Examples
|
|
12
|
+
|
|
13
|
+
### Basic
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { Hex, style } from '@tempoxyz/ds'
|
|
17
|
+
|
|
18
|
+
export function Demo() {
|
|
19
|
+
return (
|
|
20
|
+
<div {...styles.stack()}>
|
|
21
|
+
<Hex value="0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" />
|
|
22
|
+
<Hex value="0x1234" />
|
|
23
|
+
<div {...styles.frame()}>
|
|
24
|
+
<Hex value="0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" />
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
namespace styles {
|
|
31
|
+
export const frame = style({
|
|
32
|
+
borderColor: 'line.secondary',
|
|
33
|
+
borderRadius: '2xs',
|
|
34
|
+
borderStyle: 'dashed',
|
|
35
|
+
borderWidth: 'regular',
|
|
36
|
+
boxSizing: 'border-box',
|
|
37
|
+
maxWidth: '100% !custom',
|
|
38
|
+
padding: '8',
|
|
39
|
+
width: '6rem !custom',
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
export const stack = style({ display: 'grid', gap: '12', justifyItems: 'start' })
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Hex/Basic.tsx)
|
|
47
|
+
|
|
48
|
+
### Copy
|
|
49
|
+
|
|
50
|
+
Set `copy` to add a button that copies the full value.
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
import { CopyButton, Hex, style } from '@tempoxyz/ds'
|
|
54
|
+
|
|
55
|
+
const address = '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'
|
|
56
|
+
const transaction = '0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060'
|
|
57
|
+
|
|
58
|
+
export function Demo() {
|
|
59
|
+
return (
|
|
60
|
+
<div {...styles.stack()}>
|
|
61
|
+
<Hex copy value={transaction} />
|
|
62
|
+
{(['32rem', '20rem', '12rem', '8rem'] as const).map((width) => (
|
|
63
|
+
<div key={width} {...styles.frame({ style: { width } })}>
|
|
64
|
+
<Hex copy value={transaction} />
|
|
65
|
+
</div>
|
|
66
|
+
))}
|
|
67
|
+
<div {...styles.row()}>
|
|
68
|
+
<CopyButton value={address} />
|
|
69
|
+
<CopyButton value={address} variant="secondary" />
|
|
70
|
+
<CopyButton size="large" value={address} variant="primary" />
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
namespace styles {
|
|
77
|
+
export const frame = style({
|
|
78
|
+
borderColor: 'line.secondary',
|
|
79
|
+
borderRadius: '2xs',
|
|
80
|
+
borderStyle: 'dashed',
|
|
81
|
+
borderWidth: 'regular',
|
|
82
|
+
boxSizing: 'border-box',
|
|
83
|
+
maxWidth: '100% !custom',
|
|
84
|
+
padding: '8',
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
export const row = style({ alignItems: 'center', display: 'flex', flexWrap: 'wrap', gap: '12' })
|
|
88
|
+
|
|
89
|
+
export const stack = style({ display: 'grid', gap: '12', justifyItems: 'start' })
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Hex/Copy.tsx)
|
|
94
|
+
|
|
95
|
+
### Evm
|
|
96
|
+
|
|
97
|
+
Set `evm={false}` for values without a `0x` prefix.
|
|
98
|
+
|
|
99
|
+
```tsx
|
|
100
|
+
import { Hex } from '@tempoxyz/ds'
|
|
101
|
+
|
|
102
|
+
export function Demo() {
|
|
103
|
+
return <Hex evm={false} value="a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718" />
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Hex/Evm.tsx)
|
|
108
|
+
|
|
109
|
+
### Variant
|
|
110
|
+
|
|
111
|
+
Set `variant` to `inline` (default) or `filled`.
|
|
112
|
+
|
|
113
|
+
```tsx
|
|
114
|
+
import { Hex, style } from '@tempoxyz/ds'
|
|
115
|
+
|
|
116
|
+
const transaction = '0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060'
|
|
117
|
+
|
|
118
|
+
export function Demo() {
|
|
119
|
+
return (
|
|
120
|
+
<div {...styles.stack()}>
|
|
121
|
+
<Hex copy value={transaction} variant="inline" />
|
|
122
|
+
<div {...styles.resizable()}>
|
|
123
|
+
<Hex copy value={transaction} variant="filled" />
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
namespace styles {
|
|
130
|
+
export const resizable = style({
|
|
131
|
+
maxWidth: '100% !custom',
|
|
132
|
+
minWidth: 'min(10rem, 100%) !custom',
|
|
133
|
+
overflow: 'hidden',
|
|
134
|
+
resize: 'horizontal !custom',
|
|
135
|
+
width: '28rem !custom',
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
export const stack = style({ display: 'grid', gap: '12', justifyItems: 'start' })
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Hex/Variant.tsx)
|
|
143
|
+
|
|
144
|
+
### Size
|
|
145
|
+
|
|
146
|
+
Set `size` to `small`, `medium` (default), or `large`.
|
|
147
|
+
|
|
148
|
+
```tsx
|
|
149
|
+
import { Hex, style } from '@tempoxyz/ds'
|
|
150
|
+
|
|
151
|
+
export function Demo() {
|
|
152
|
+
return (
|
|
153
|
+
<div {...styles.stack()}>
|
|
154
|
+
{(['small', 'medium', 'large'] as const).map((size) => (
|
|
155
|
+
<Hex
|
|
156
|
+
copy
|
|
157
|
+
key={size}
|
|
158
|
+
size={size}
|
|
159
|
+
value="0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
|
|
160
|
+
variant="filled"
|
|
161
|
+
/>
|
|
162
|
+
))}
|
|
163
|
+
</div>
|
|
164
|
+
)
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
namespace styles {
|
|
168
|
+
export const stack = style({ display: 'grid', gap: '12', justifyItems: 'start' })
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Hex/Size.tsx)
|
|
173
|
+
|
|
174
|
+
## Anatomy
|
|
175
|
+
|
|
176
|
+
Import the component and assemble its parts.
|
|
177
|
+
|
|
178
|
+
```tsx
|
|
179
|
+
import { Hex } from '@tempoxyz/ds'
|
|
180
|
+
|
|
181
|
+
<Hex />
|
|
182
|
+
|
|
183
|
+
<Hex.Root>
|
|
184
|
+
<Hex.Text />
|
|
185
|
+
<Hex.Copy />
|
|
186
|
+
</Hex.Root>
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Guidelines
|
|
190
|
+
|
|
191
|
+
### When to Use
|
|
192
|
+
|
|
193
|
+
* Show an address or transaction hash in a row, table, or card where it may not fit.
|
|
194
|
+
* Show a receive address as a standalone field with `variant="filled"`. The whole row copies.
|
|
195
|
+
|
|
196
|
+
### When Not to Use
|
|
197
|
+
|
|
198
|
+
* Use [SecretValue](/docs/components/secret-value) for private keys and other secrets. Hex shows its value in the clear.
|
|
199
|
+
* Use [Snippet](/docs/components/snippet) for URLs, commands, and other values that aren't hex.
|
|
200
|
+
* Use [CopyButton](/docs/components/copy-button) alone when the value isn't displayed.
|
|
201
|
+
|
|
202
|
+
### Always Offer Copy
|
|
203
|
+
|
|
204
|
+
Set `copy` wherever people need the full value. To name the button, compose the parts and pass `aria-label` to `Hex.Copy`. Link a transaction hash to its block explorer page for verification.
|
|
205
|
+
|
|
206
|
+
```tsx
|
|
207
|
+
<Hex.Root value={address}>
|
|
208
|
+
<Hex.Text />
|
|
209
|
+
<Hex.Copy aria-label="Copy address" />
|
|
210
|
+
</Hex.Root>
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
**Do:** Add a copy button, named by what it copies.
|
|
214
|
+
|
|
215
|
+
```tsx
|
|
216
|
+
/** Do example for "Always Offer Copy" on the Hex page: add a copy button, named by what it copies. @module */
|
|
217
|
+
import { Hex } from '@tempoxyz/ds'
|
|
218
|
+
|
|
219
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
220
|
+
export function Demo() {
|
|
221
|
+
return (
|
|
222
|
+
<Hex.Root value="0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060">
|
|
223
|
+
<Hex.Text />
|
|
224
|
+
<Hex.Copy aria-label="Copy transaction hash" />
|
|
225
|
+
</Hex.Root>
|
|
226
|
+
)
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
**Don't:** Show a truncated value without a way to copy it.
|
|
231
|
+
|
|
232
|
+
```tsx
|
|
233
|
+
/**
|
|
234
|
+
* Don't example for "Always Offer Copy" on the Hex page.
|
|
235
|
+
* Don't show a truncated value without a way to copy it.
|
|
236
|
+
* @module
|
|
237
|
+
*/
|
|
238
|
+
import { Hex } from '@tempoxyz/ds'
|
|
239
|
+
|
|
240
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
241
|
+
export function Demo() {
|
|
242
|
+
return <Hex value="0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060" />
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Truncate in the Middle
|
|
247
|
+
|
|
248
|
+
People check an address by its first and last characters. For plain strings, such as a [Toast](/docs/components/toast) message, `formatHex` keeps both ends too.
|
|
249
|
+
|
|
250
|
+
**Do:** Keep both ends of the value visible.
|
|
251
|
+
|
|
252
|
+
```tsx
|
|
253
|
+
/** Do example for "Truncate in the Middle" on the Hex page: keep both ends of the value visible. @module */
|
|
254
|
+
import { Hex, style } from '@tempoxyz/ds'
|
|
255
|
+
|
|
256
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
257
|
+
export function Demo() {
|
|
258
|
+
return (
|
|
259
|
+
<div {...styles.frame()}>
|
|
260
|
+
<Hex copy value="0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" />
|
|
261
|
+
</div>
|
|
262
|
+
)
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
namespace styles {
|
|
266
|
+
export const frame = style({ maxWidth: '100% !custom', width: '12rem !custom' })
|
|
267
|
+
}
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
**Don't:** Truncate the end of an address with an ellipsis.
|
|
271
|
+
|
|
272
|
+
```tsx
|
|
273
|
+
/**
|
|
274
|
+
* Don't example for "Truncate in the Middle" on the Hex page.
|
|
275
|
+
* Don't truncate the end of an address with an ellipsis.
|
|
276
|
+
* @module
|
|
277
|
+
*/
|
|
278
|
+
import { style } from '@tempoxyz/ds'
|
|
279
|
+
|
|
280
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
281
|
+
export function Demo() {
|
|
282
|
+
return <span {...styles.text()}>0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045</span>
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
namespace styles {
|
|
286
|
+
export const text = style({
|
|
287
|
+
color: 'content.primary',
|
|
288
|
+
display: 'block',
|
|
289
|
+
maxWidth: '100% !custom',
|
|
290
|
+
overflow: 'hidden',
|
|
291
|
+
textOverflow: 'ellipsis !custom',
|
|
292
|
+
typography: 'mono.m1',
|
|
293
|
+
whiteSpace: 'nowrap',
|
|
294
|
+
width: '12rem !custom',
|
|
295
|
+
})
|
|
296
|
+
}
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### Show the Full Address Before Sending
|
|
300
|
+
|
|
301
|
+
Look-alike addresses can match the first and last four characters of a real one. Hex truncates only when its container is narrower than the value, so give it room on a payment review and ask people to check it against its source.
|
|
302
|
+
|
|
303
|
+
**Do:** Show every character of the recipient on review.
|
|
304
|
+
|
|
305
|
+
```tsx
|
|
306
|
+
/**
|
|
307
|
+
* Do example for "Show the Full Address Before Sending" on the Hex page.
|
|
308
|
+
* Show every character of the recipient on review.
|
|
309
|
+
* @module
|
|
310
|
+
*/
|
|
311
|
+
import { Hex, style } from '@tempoxyz/ds'
|
|
312
|
+
|
|
313
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
314
|
+
export function Demo() {
|
|
315
|
+
return (
|
|
316
|
+
<div {...styles.field()}>
|
|
317
|
+
<span {...styles.label()}>Recipient</span>
|
|
318
|
+
<Hex copy value="0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc" variant="filled" />
|
|
319
|
+
</div>
|
|
320
|
+
)
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
namespace styles {
|
|
324
|
+
export const field = style({ display: 'grid', gap: '4', width: '100% !custom' })
|
|
325
|
+
|
|
326
|
+
export const label = style({ color: 'content.secondary', typography: 'body.b2' })
|
|
327
|
+
}
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
**Don't:** Truncate the address people confirm a payment to.
|
|
331
|
+
|
|
332
|
+
```tsx
|
|
333
|
+
/**
|
|
334
|
+
* Don't example for "Show the Full Address Before Sending" on the Hex page.
|
|
335
|
+
* Don't truncate the address people confirm a payment to.
|
|
336
|
+
* @module
|
|
337
|
+
*/
|
|
338
|
+
import { Hex, style } from '@tempoxyz/ds'
|
|
339
|
+
|
|
340
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
341
|
+
export function Demo() {
|
|
342
|
+
return (
|
|
343
|
+
<div {...styles.field()}>
|
|
344
|
+
<span {...styles.label()}>Recipient</span>
|
|
345
|
+
<Hex copy value="0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc" variant="filled" />
|
|
346
|
+
</div>
|
|
347
|
+
)
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
namespace styles {
|
|
351
|
+
export const field = style({
|
|
352
|
+
display: 'grid',
|
|
353
|
+
gap: '4',
|
|
354
|
+
maxWidth: '100% !custom',
|
|
355
|
+
width: '12rem !custom',
|
|
356
|
+
})
|
|
357
|
+
|
|
358
|
+
export const label = style({ color: 'content.secondary', typography: 'body.b2' })
|
|
359
|
+
}
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
### Label Every Value
|
|
363
|
+
|
|
364
|
+
**Do:** Put a label beside each value, such as Recipient or Transaction hash.
|
|
365
|
+
|
|
366
|
+
```tsx
|
|
367
|
+
/**
|
|
368
|
+
* Do example for "Label Every Value" on the Hex page.
|
|
369
|
+
* Put a label beside each value, such as Recipient or Transaction hash.
|
|
370
|
+
* @module
|
|
371
|
+
*/
|
|
372
|
+
import { Hex, style } from '@tempoxyz/ds'
|
|
373
|
+
|
|
374
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
375
|
+
export function Demo() {
|
|
376
|
+
return (
|
|
377
|
+
<div {...styles.list()}>
|
|
378
|
+
<div {...styles.row()}>
|
|
379
|
+
<span {...styles.label()}>Recipient</span>
|
|
380
|
+
<Hex size="small" value="0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc" />
|
|
381
|
+
</div>
|
|
382
|
+
<div {...styles.row()}>
|
|
383
|
+
<span {...styles.label()}>Transaction hash</span>
|
|
384
|
+
<Hex
|
|
385
|
+
size="small"
|
|
386
|
+
value="0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060"
|
|
387
|
+
/>
|
|
388
|
+
</div>
|
|
389
|
+
</div>
|
|
390
|
+
)
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
namespace styles {
|
|
394
|
+
export const label = style({
|
|
395
|
+
color: 'content.secondary',
|
|
396
|
+
flexShrink: '0 !custom',
|
|
397
|
+
typography: 'body.b2',
|
|
398
|
+
})
|
|
399
|
+
|
|
400
|
+
export const list = style({ display: 'grid', gap: '12', width: '100% !custom' })
|
|
401
|
+
|
|
402
|
+
export const row = style({
|
|
403
|
+
alignItems: 'baseline',
|
|
404
|
+
display: 'flex',
|
|
405
|
+
gap: '16',
|
|
406
|
+
justifyContent: 'space-between',
|
|
407
|
+
minWidth: '0',
|
|
408
|
+
})
|
|
409
|
+
}
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
**Don't:** Show bare hex strings. They don't identify themselves.
|
|
413
|
+
|
|
414
|
+
```tsx
|
|
415
|
+
/**
|
|
416
|
+
* Don't example for "Label Every Value" on the Hex page.
|
|
417
|
+
* Don't show bare hex strings. They don't identify themselves.
|
|
418
|
+
* @module
|
|
419
|
+
*/
|
|
420
|
+
import { Hex, style } from '@tempoxyz/ds'
|
|
421
|
+
|
|
422
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
423
|
+
export function Demo() {
|
|
424
|
+
return (
|
|
425
|
+
<div {...styles.list()}>
|
|
426
|
+
<Hex size="small" value="0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc" />
|
|
427
|
+
<Hex
|
|
428
|
+
size="small"
|
|
429
|
+
value="0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060"
|
|
430
|
+
/>
|
|
431
|
+
</div>
|
|
432
|
+
)
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
namespace styles {
|
|
436
|
+
export const list = style({ display: 'grid', gap: '12', width: '100% !custom' })
|
|
437
|
+
}
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
### Pick a Variant
|
|
441
|
+
|
|
442
|
+
* **Inline (inline):** The default, for text, rows, and table cells.
|
|
443
|
+
* **Filled (filled):** A tinted field that copies on click, for standalone values.
|
|
444
|
+
* **No Prefix (evm={false}):** For hex values without a `0x` prefix.
|
|
445
|
+
|
|
446
|
+
## Accessibility
|
|
447
|
+
|
|
448
|
+
Hex renders a `<span>` with the truncated value on screen and the full value for screen readers. With `copy`, the copy button follows the [WAI-ARIA Authoring Practices button pattern](https://www.w3.org/WAI/ARIA/apg/patterns/button/).
|
|
449
|
+
|
|
450
|
+
### Semantics
|
|
451
|
+
|
|
452
|
+
* **Truncated Text (aria-hidden):** Hidden. Screen readers read the full value from hidden text.
|
|
453
|
+
* **Short Values:** Values that fit render as plain text, with no hidden copy of the value.
|
|
454
|
+
* **Hex.Copy (button):** Named "Copy" and the value, or `aria-label`. A copy renames it "Copied" for two seconds and announces it.
|
|
455
|
+
* **Filled Variant (filled):** A click anywhere on the row copies. The button stays the keyboard path.
|
|
456
|
+
|
|
457
|
+
### Keyboard
|
|
458
|
+
|
|
459
|
+
* **Move to Copy (Tab):** Moves focus to the copy button. The value takes no focus.
|
|
460
|
+
* **Copy the Value (Enter or Space):** Copies the full value. Focus stays on the button.
|
|
461
|
+
|
|
462
|
+
### Your Responsibilities
|
|
463
|
+
|
|
464
|
+
* **Name the Copy Button (aria-label):** Name what it copies, such as "Copy address". The default name reads the full value.
|
|
465
|
+
* **Show a Name:** If a name or contact label exists, show it with the address. A raw hex string is hard to listen to.
|
|
466
|
+
|
|
467
|
+
## Related
|
|
468
|
+
|
|
469
|
+
[CopyButton](/docs/components/copy-button)
|
|
470
|
+
|
|
471
|
+
Use for copying without a visible value.
|
|
472
|
+
|
|
473
|
+
[Identicon](/docs/components/identicon)
|
|
474
|
+
|
|
475
|
+
Use for an image beside an address.
|
|
476
|
+
|
|
477
|
+
[SecretValue](/docs/components/secret-value)
|
|
478
|
+
|
|
479
|
+
Use for secrets.
|
|
480
|
+
|
|
481
|
+
[Snippet](/docs/components/snippet)
|
|
482
|
+
|
|
483
|
+
Use for commands and URLs.
|
|
484
|
+
|
|
485
|
+
[Blockchain Values](/docs/patterns/blockchain-values)
|
|
486
|
+
|
|
487
|
+
Covers addresses, hashes, and amounts.
|