@tempoxyz/ds 0.3.10 → 0.3.13
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/README.md +7 -6
- package/dist/docs/AGENTS.md +12 -0
- package/dist/docs/index.md +145 -0
- package/dist/docs/marketing/introduction/getting-started.md +241 -0
- package/dist/docs/product/components/accordion.md +489 -0
- package/dist/docs/product/components/address-card.md +147 -0
- package/dist/docs/product/components/agent-logo.md +194 -0
- package/dist/docs/product/components/alert-dialog.md +631 -0
- package/dist/docs/product/components/alert.md +448 -0
- package/dist/docs/product/components/amount-input.md +305 -0
- package/dist/docs/product/components/amount.md +794 -0
- package/dist/docs/product/components/app-shell.md +559 -0
- package/dist/docs/product/components/asset-chip.md +294 -0
- package/dist/docs/product/components/autocomplete.md +620 -0
- package/dist/docs/product/components/avatar.md +321 -0
- package/dist/docs/product/components/badge.md +339 -0
- package/dist/docs/product/components/badged-logo.md +116 -0
- package/dist/docs/product/components/banner.md +379 -0
- package/dist/docs/product/components/bar-chart.md +208 -0
- package/dist/docs/product/components/breadcrumbs.md +380 -0
- package/dist/docs/product/components/button-group.md +286 -0
- package/dist/docs/product/components/button.md +650 -0
- package/dist/docs/product/components/calendar.md +375 -0
- package/dist/docs/product/components/callout.md +96 -0
- package/dist/docs/product/components/checkbox-group.md +521 -0
- package/dist/docs/product/components/checkbox.md +467 -0
- package/dist/docs/product/components/choice-group.md +516 -0
- package/dist/docs/product/components/choicebox.md +641 -0
- package/dist/docs/product/components/code.md +100 -0
- package/dist/docs/product/components/combobox.md +939 -0
- package/dist/docs/product/components/container.md +257 -0
- package/dist/docs/product/components/copy-button.md +642 -0
- package/dist/docs/product/components/date-picker.md +514 -0
- package/dist/docs/product/components/dialog.md +1332 -0
- package/dist/docs/product/components/drawer.md +966 -0
- package/dist/docs/product/components/empty.md +340 -0
- package/dist/docs/product/components/field.md +570 -0
- package/dist/docs/product/components/fieldset.md +398 -0
- package/dist/docs/product/components/frame.md +434 -0
- package/dist/docs/product/components/gauge.md +299 -0
- package/dist/docs/product/components/get-started-visual.md +117 -0
- package/dist/docs/product/components/grid.md +288 -0
- package/dist/docs/product/components/hero-visual.md +155 -0
- package/dist/docs/product/components/hex.md +487 -0
- package/dist/docs/product/components/icon-tile.md +292 -0
- package/dist/docs/product/components/identicon.md +371 -0
- package/dist/docs/product/components/inline.md +233 -0
- package/dist/docs/product/components/inset.md +225 -0
- package/dist/docs/product/components/kbd.md +423 -0
- package/dist/docs/product/components/list-group.md +981 -0
- package/dist/docs/product/components/loading-dots.md +237 -0
- package/dist/docs/product/components/menu.md +934 -0
- package/dist/docs/product/components/native-select.md +204 -0
- package/dist/docs/product/components/network-logo.md +248 -0
- package/dist/docs/product/components/number-field.md +543 -0
- package/dist/docs/product/components/otp-field.md +616 -0
- package/dist/docs/product/components/pagination.md +516 -0
- package/dist/docs/product/components/popover.md +544 -0
- package/dist/docs/product/components/progress.md +388 -0
- package/dist/docs/product/components/qr.md +314 -0
- package/dist/docs/product/components/radio-group.md +528 -0
- package/dist/docs/product/components/secret-value.md +406 -0
- package/dist/docs/product/components/select.md +751 -0
- package/dist/docs/product/components/separator.md +379 -0
- package/dist/docs/product/components/sidebar-menu.md +922 -0
- package/dist/docs/product/components/skeleton.md +517 -0
- package/dist/docs/product/components/slider.md +539 -0
- package/dist/docs/product/components/snippet.md +424 -0
- package/dist/docs/product/components/spinner.md +216 -0
- package/dist/docs/product/components/split-bar.md +139 -0
- package/dist/docs/product/components/split-button.md +464 -0
- package/dist/docs/product/components/stack.md +299 -0
- package/dist/docs/product/components/status-chip.md +226 -0
- package/dist/docs/product/components/status-indicator.md +119 -0
- package/dist/docs/product/components/status-row.md +174 -0
- package/dist/docs/product/components/stepper.md +451 -0
- package/dist/docs/product/components/success-hero.md +157 -0
- package/dist/docs/product/components/surface.md +639 -0
- package/dist/docs/product/components/switch.md +472 -0
- package/dist/docs/product/components/table.md +967 -0
- package/dist/docs/product/components/tabs.md +627 -0
- package/dist/docs/product/components/tempo-logo.md +185 -0
- package/dist/docs/product/components/text-input.md +624 -0
- package/dist/docs/product/components/textarea.md +352 -0
- package/dist/docs/product/components/toast.md +535 -0
- package/dist/docs/product/components/token-logo.md +371 -0
- package/dist/docs/product/components/token.md +247 -0
- package/dist/docs/product/components/tooltip.md +490 -0
- package/dist/docs/product/components/verification-code.md +116 -0
- package/dist/docs/product/components/visual.md +249 -0
- package/dist/docs/product/components.md +203 -0
- package/dist/docs/product/foundations/accessibility.md +377 -0
- package/dist/docs/product/foundations/agents.md +150 -0
- package/dist/docs/product/foundations/color.md +522 -0
- package/dist/docs/product/foundations/content/tone.md +194 -0
- package/dist/docs/product/foundations/content/voice.md +194 -0
- package/dist/docs/product/foundations/content/writing-style.md +406 -0
- package/dist/docs/product/foundations/iconography.md +282 -0
- package/dist/docs/product/foundations/intent.md +360 -0
- package/dist/docs/product/foundations/layout.md +508 -0
- package/dist/docs/product/foundations/linter.md +496 -0
- package/dist/docs/product/foundations/motion.md +151 -0
- package/dist/docs/product/foundations/radius-and-padding.md +86 -0
- package/dist/docs/product/foundations/typography.md +266 -0
- package/dist/docs/product/introduction/faq.md +133 -0
- package/dist/docs/product/introduction/getting-started.md +377 -0
- package/dist/docs/product/patterns/blockchain-values.md +709 -0
- package/dist/docs/product/patterns/dashboards.md +638 -0
- package/dist/docs/product/patterns/destructive-actions.md +626 -0
- package/dist/docs/product/patterns/empty-states.md +612 -0
- package/dist/docs/product/patterns/errors-and-validation.md +808 -0
- package/dist/docs/product/patterns/feedback-and-status.md +518 -0
- package/dist/docs/product/patterns/forms.md +679 -0
- package/dist/docs/product/patterns/loading.md +630 -0
- package/dist/docs/product/patterns/navigation.md +397 -0
- package/dist/docs/product/patterns/payments.md +765 -0
- package/dist/docs/product/patterns/responsive-layout.md +997 -0
- package/dist/docs/product/patterns/tables-and-lists.md +964 -0
- package/dist/docs/product/products/tempo-console.md +671 -0
- package/dist/docs/product/products/tempo-performance.md +437 -0
- package/dist/docs/product/products/tempo-wallet.md +438 -0
- package/dist/marketing/index.d.ts +4 -0
- package/dist/marketing/index.d.ts.map +1 -0
- package/dist/marketing/index.js +4 -0
- package/dist/marketing/index.js.map +1 -0
- package/dist/marketing/index.js.zyzz.json +1 -0
- package/dist/marketing/vars.d.ts +907 -0
- package/dist/marketing/vars.d.ts.map +1 -0
- package/dist/marketing/vars.js +15 -0
- package/dist/marketing/vars.js.map +1 -0
- package/dist/marketing/vars.js.zyzz.json +1 -0
- package/dist/marketing/zyzz.config.d.ts +4512 -0
- package/dist/marketing/zyzz.config.d.ts.map +1 -0
- package/dist/marketing/zyzz.config.js +63 -0
- package/dist/marketing/zyzz.config.js.map +1 -0
- package/dist/marketing/zyzz.config.js.zyzz.json +1 -0
- package/dist/oxlint/index.d.ts +12 -1
- package/dist/oxlint/index.d.ts.map +1 -1
- package/dist/oxlint/index.js +39 -1
- package/dist/oxlint/index.js.map +1 -1
- package/dist/oxlint/internal/Docs.d.ts +9 -0
- package/dist/oxlint/internal/Docs.d.ts.map +1 -0
- package/dist/oxlint/internal/Docs.js +15 -0
- package/dist/oxlint/internal/Docs.js.map +1 -0
- package/dist/oxlint/internal/Imports.d.ts +1 -1
- package/dist/oxlint/internal/Imports.d.ts.map +1 -1
- package/dist/oxlint/internal/Imports.js +2 -0
- package/dist/oxlint/internal/Imports.js.map +1 -1
- package/dist/oxlint/internal/Styles.d.ts +40 -0
- package/dist/oxlint/internal/Styles.d.ts.map +1 -0
- package/dist/oxlint/internal/Styles.js +194 -0
- package/dist/oxlint/internal/Styles.js.map +1 -0
- package/dist/oxlint/internal/Tokens.d.ts +16 -0
- package/dist/oxlint/internal/Tokens.d.ts.map +1 -0
- package/dist/oxlint/internal/Tokens.js +39 -0
- package/dist/oxlint/internal/Tokens.js.map +1 -0
- package/dist/oxlint/rules/NoCrossSurface.d.ts +2 -2
- package/dist/oxlint/rules/NoCrossSurface.js +3 -3
- package/dist/oxlint/rules/NoCrossSurface.js.map +1 -1
- package/dist/oxlint/rules/NoCustomValues.d.ts +11 -0
- package/dist/oxlint/rules/NoCustomValues.d.ts.map +1 -0
- package/dist/oxlint/rules/NoCustomValues.js +150 -0
- package/dist/oxlint/rules/NoCustomValues.js.map +1 -0
- package/dist/oxlint/rules/NoSingleKeyShortcuts.d.ts +11 -0
- package/dist/oxlint/rules/NoSingleKeyShortcuts.d.ts.map +1 -0
- package/dist/oxlint/rules/NoSingleKeyShortcuts.js +158 -0
- package/dist/oxlint/rules/NoSingleKeyShortcuts.js.map +1 -0
- package/dist/oxlint/rules/PreferComponent.d.ts +3 -2
- package/dist/oxlint/rules/PreferComponent.d.ts.map +1 -1
- package/dist/oxlint/rules/PreferComponent.js +11 -4
- package/dist/oxlint/rules/PreferComponent.js.map +1 -1
- package/dist/oxlint/rules/PreferLayout.d.ts +9 -0
- package/dist/oxlint/rules/PreferLayout.d.ts.map +1 -0
- package/dist/oxlint/rules/PreferLayout.js +90 -0
- package/dist/oxlint/rules/PreferLayout.js.map +1 -0
- package/dist/oxlint/rules/PreferProgress.d.ts +9 -0
- package/dist/oxlint/rules/PreferProgress.d.ts.map +1 -0
- package/dist/oxlint/rules/PreferProgress.js +43 -0
- package/dist/oxlint/rules/PreferProgress.js.map +1 -0
- package/dist/oxlint/rules/PreferSurface.d.ts +9 -0
- package/dist/oxlint/rules/PreferSurface.d.ts.map +1 -0
- package/dist/oxlint/rules/PreferSurface.js +55 -0
- package/dist/oxlint/rules/PreferSurface.js.map +1 -0
- package/dist/oxlint/rules/RequireAccessibleName.d.ts.map +1 -1
- package/dist/oxlint/rules/RequireAccessibleName.js +3 -1
- package/dist/oxlint/rules/RequireAccessibleName.js.map +1 -1
- package/dist/oxlint/rules/RequireScrollRegion.d.ts +11 -0
- package/dist/oxlint/rules/RequireScrollRegion.d.ts.map +1 -0
- package/dist/oxlint/rules/RequireScrollRegion.js +71 -0
- package/dist/oxlint/rules/RequireScrollRegion.js.map +1 -0
- package/dist/web/icons/index.js.zyzz.json +1 -0
- package/package.json +6 -1
- package/src/marketing/README.md +21 -0
- package/src/marketing/index.ts +3 -0
- package/src/marketing/vars.ts +751 -0
- package/src/marketing/zyzz.config.ts +376 -0
- package/src/oxlint/index.ts +40 -1
- package/src/oxlint/internal/Docs.ts +18 -0
- package/src/oxlint/internal/Imports.ts +2 -1
- package/src/oxlint/internal/Styles.ts +240 -0
- package/src/oxlint/internal/Tokens.ts +43 -0
- package/src/oxlint/rules/NoCrossSurface.ts +3 -3
- package/src/oxlint/rules/NoCustomValues.ts +170 -0
- package/src/oxlint/rules/NoSingleKeyShortcuts.ts +190 -0
- package/src/oxlint/rules/PreferComponent.ts +11 -4
- package/src/oxlint/rules/PreferLayout.ts +96 -0
- package/src/oxlint/rules/PreferProgress.ts +49 -0
- package/src/oxlint/rules/PreferSurface.ts +70 -0
- package/src/oxlint/rules/RequireAccessibleName.ts +3 -1
- package/src/oxlint/rules/RequireScrollRegion.ts +92 -0
|
@@ -0,0 +1,544 @@
|
|
|
1
|
+
# Popover
|
|
2
|
+
|
|
3
|
+
Opens a non-modal popup anchored to a trigger.
|
|
4
|
+
|
|
5
|
+
[View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/Popover.tsx)
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
Popover renders a non-modal dialog anchored to a trigger, opened on click, for interactive or longer content.
|
|
10
|
+
|
|
11
|
+
## Examples
|
|
12
|
+
|
|
13
|
+
### Basic
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { Button, Popover, style } from '@tempoxyz/ds'
|
|
17
|
+
|
|
18
|
+
export function Demo() {
|
|
19
|
+
return (
|
|
20
|
+
<Popover.Root>
|
|
21
|
+
<Popover.Trigger render={<Button variant="secondary" />}>Network fee</Popover.Trigger>
|
|
22
|
+
<Popover.Popup>
|
|
23
|
+
<Popover.Title>Network fee</Popover.Title>
|
|
24
|
+
<Popover.Description>Paid in the token you send.</Popover.Description>
|
|
25
|
+
<div {...styles.actions()}>
|
|
26
|
+
<Popover.Close render={<Button size="small" variant="secondary" />}>Got it</Popover.Close>
|
|
27
|
+
</div>
|
|
28
|
+
</Popover.Popup>
|
|
29
|
+
</Popover.Root>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
namespace styles {
|
|
34
|
+
export const actions = style({ marginTop: '16' })
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Popover/Basic.tsx)
|
|
39
|
+
|
|
40
|
+
### Side
|
|
41
|
+
|
|
42
|
+
Set `side` on `Popover.Popup` to `top`, `right`, `bottom` (default), or `left`. Add `Popover.Arrow` to point toward the trigger.
|
|
43
|
+
|
|
44
|
+
```tsx
|
|
45
|
+
import { Button, Popover } from '@tempoxyz/ds'
|
|
46
|
+
|
|
47
|
+
export function Demo() {
|
|
48
|
+
return (
|
|
49
|
+
<Popover.Root>
|
|
50
|
+
<Popover.Trigger render={<Button variant="secondary" />}>With arrow</Popover.Trigger>
|
|
51
|
+
<Popover.Popup side="right">
|
|
52
|
+
<Popover.Arrow />
|
|
53
|
+
<Popover.Title>Estimated arrival</Popover.Title>
|
|
54
|
+
<Popover.Description>About one minute.</Popover.Description>
|
|
55
|
+
</Popover.Popup>
|
|
56
|
+
</Popover.Root>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
[View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/Popover/Side.tsx)
|
|
62
|
+
|
|
63
|
+
## Anatomy
|
|
64
|
+
|
|
65
|
+
Import the component and assemble its parts.
|
|
66
|
+
|
|
67
|
+
```tsx
|
|
68
|
+
import { Popover } from '@tempoxyz/ds'
|
|
69
|
+
|
|
70
|
+
<Popover.Root>
|
|
71
|
+
<Popover.Trigger />
|
|
72
|
+
<Popover.Popup>
|
|
73
|
+
<Popover.Arrow />
|
|
74
|
+
<Popover.Title />
|
|
75
|
+
<Popover.Description />
|
|
76
|
+
<Popover.Close />
|
|
77
|
+
</Popover.Popup>
|
|
78
|
+
</Popover.Root>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Guidelines
|
|
82
|
+
|
|
83
|
+
### When to Use
|
|
84
|
+
|
|
85
|
+
* Explain a value with a sentence and a link, such as the methodology behind a throughput tile.
|
|
86
|
+
* Show details on demand, such as the breakdown of a network fee.
|
|
87
|
+
* Edit one setting in place, such as the label of a saved address.
|
|
88
|
+
|
|
89
|
+
### When Not to Use
|
|
90
|
+
|
|
91
|
+
* Use a [Tooltip](tooltip.md) for a short label on an icon button.
|
|
92
|
+
* Use a [Menu](menu.md) for a list of actions.
|
|
93
|
+
* Use [Select](select.md), [Combobox](combobox.md), or [DatePicker](date-picker.md) to choose a value.
|
|
94
|
+
* Use a [Dialog](dialog.md) for a task with several fields or full attention.
|
|
95
|
+
* Use a [Drawer](drawer.md) for long content.
|
|
96
|
+
* Use visible text for information everyone needs, such as an error or a required step.
|
|
97
|
+
|
|
98
|
+
### Keep Content Small
|
|
99
|
+
|
|
100
|
+
A popover holds a title, a sentence or two, and at most two controls. `Popover.Popup` grows up to the available width, so give text popovers a `maxWidth`, such as 20rem.
|
|
101
|
+
|
|
102
|
+
**Do:** Explain a metric with a title, one sentence, and a link.
|
|
103
|
+
|
|
104
|
+
```tsx
|
|
105
|
+
/**
|
|
106
|
+
* Do example for "Keep Content Small" on the Popover page.
|
|
107
|
+
* Explain a metric with a title, one sentence, and a link.
|
|
108
|
+
* @module
|
|
109
|
+
*/
|
|
110
|
+
import { Button, style } from '@tempoxyz/ds'
|
|
111
|
+
import { InfoCircle } from '@tempoxyz/ds/icons'
|
|
112
|
+
|
|
113
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
114
|
+
export function Demo() {
|
|
115
|
+
return (
|
|
116
|
+
<div {...styles.stack()}>
|
|
117
|
+
<div {...styles.header()}>
|
|
118
|
+
<span {...styles.label()}>Throughput</span>
|
|
119
|
+
<Button aria-label="About throughput" shape="icon" size="small" variant="tertiary">
|
|
120
|
+
<InfoCircle />
|
|
121
|
+
</Button>
|
|
122
|
+
</div>
|
|
123
|
+
<div {...styles.popup()}>
|
|
124
|
+
<span {...styles.title()}>Throughput</span>
|
|
125
|
+
<p {...styles.description()}>Transactions per second, averaged over each block.</p>
|
|
126
|
+
<span {...styles.link()}>View methodology</span>
|
|
127
|
+
</div>
|
|
128
|
+
</div>
|
|
129
|
+
)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
namespace styles {
|
|
133
|
+
export const description = style({
|
|
134
|
+
color: 'content.secondary',
|
|
135
|
+
margin: '0 !custom',
|
|
136
|
+
typography: 'body.b2',
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
export const header = style({ alignItems: 'center', columnGap: '4', display: 'flex' })
|
|
140
|
+
|
|
141
|
+
export const label = style({ color: 'content.primary', typography: 'body.b2Strong' })
|
|
142
|
+
|
|
143
|
+
export const link = style({
|
|
144
|
+
color: 'content.primary',
|
|
145
|
+
textDecorationLine: 'underline !custom',
|
|
146
|
+
typography: 'body.b2Strong',
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
export const popup = style({
|
|
150
|
+
backgroundColor: 'background.elevated',
|
|
151
|
+
borderRadius: 'sm',
|
|
152
|
+
boxShadow: 'regular',
|
|
153
|
+
boxSizing: 'border-box',
|
|
154
|
+
display: 'flex',
|
|
155
|
+
flexDirection: 'column',
|
|
156
|
+
padding: '20',
|
|
157
|
+
rowGap: '8',
|
|
158
|
+
width: '15rem !custom',
|
|
159
|
+
})
|
|
160
|
+
|
|
161
|
+
export const stack = style({
|
|
162
|
+
alignItems: 'flex-start',
|
|
163
|
+
display: 'flex',
|
|
164
|
+
flexDirection: 'column',
|
|
165
|
+
rowGap: '8',
|
|
166
|
+
})
|
|
167
|
+
|
|
168
|
+
export const title = style({ color: 'content.primary', typography: 'body.b1Strong' })
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Don't:** Build a multi-field form in a popover. Use a [Dialog](dialog.md).
|
|
173
|
+
|
|
174
|
+
```tsx
|
|
175
|
+
/**
|
|
176
|
+
* Don't example for "Keep Content Small" on the Popover page.
|
|
177
|
+
* Don't build a multi-field form in a popover. Use a Dialog.
|
|
178
|
+
* @module
|
|
179
|
+
*/
|
|
180
|
+
import { Button, style, TextInput } from '@tempoxyz/ds'
|
|
181
|
+
|
|
182
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
183
|
+
export function Demo() {
|
|
184
|
+
return (
|
|
185
|
+
<div {...styles.popup()}>
|
|
186
|
+
<span {...styles.title()}>New webhook</span>
|
|
187
|
+
<TextInput.Group>
|
|
188
|
+
<TextInput.Control aria-label="Endpoint URL" placeholder="Endpoint URL" />
|
|
189
|
+
</TextInput.Group>
|
|
190
|
+
<TextInput.Group>
|
|
191
|
+
<TextInput.Control aria-label="Events" placeholder="Events" />
|
|
192
|
+
</TextInput.Group>
|
|
193
|
+
<TextInput.Group>
|
|
194
|
+
<TextInput.Control aria-label="Signing secret" placeholder="Signing secret" />
|
|
195
|
+
</TextInput.Group>
|
|
196
|
+
<div {...styles.actions()}>
|
|
197
|
+
<Button size="small" variant="secondary">
|
|
198
|
+
Cancel
|
|
199
|
+
</Button>
|
|
200
|
+
<Button size="small">Create webhook</Button>
|
|
201
|
+
</div>
|
|
202
|
+
</div>
|
|
203
|
+
)
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
namespace styles {
|
|
207
|
+
export const actions = style({
|
|
208
|
+
columnGap: '8',
|
|
209
|
+
display: 'flex',
|
|
210
|
+
justifyContent: 'flex-end',
|
|
211
|
+
marginTop: '4',
|
|
212
|
+
})
|
|
213
|
+
|
|
214
|
+
export const popup = style({
|
|
215
|
+
backgroundColor: 'background.elevated',
|
|
216
|
+
borderRadius: 'sm',
|
|
217
|
+
boxShadow: 'regular',
|
|
218
|
+
boxSizing: 'border-box',
|
|
219
|
+
display: 'flex',
|
|
220
|
+
flexDirection: 'column',
|
|
221
|
+
padding: '20',
|
|
222
|
+
rowGap: '8',
|
|
223
|
+
width: '16rem !custom',
|
|
224
|
+
})
|
|
225
|
+
|
|
226
|
+
export const title = style({ color: 'content.primary', typography: 'body.b1Strong' })
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Add Hover Without Replacing Click
|
|
231
|
+
|
|
232
|
+
* **Click (default):** `Popover.Trigger` toggles on click, which covers a mouse, a tap, and Enter or Space.
|
|
233
|
+
* **Hover and Click (openOnHover):** For info icons on dashboards. Opens after 300ms of hover, and click still works.
|
|
234
|
+
|
|
235
|
+
### Offer a Close Action for Controls
|
|
236
|
+
|
|
237
|
+
Escape and an outside press close a popover. If it holds controls, add a `Popover.Close` button, such as Cancel or Done, for touch screens.
|
|
238
|
+
|
|
239
|
+
**Do:** Add a `Popover.Close` action beside the controls.
|
|
240
|
+
|
|
241
|
+
```tsx
|
|
242
|
+
/**
|
|
243
|
+
* Do example for "Offer a Close Action for Controls" on the Popover page.
|
|
244
|
+
* Add a `Popover.Close` action beside the controls.
|
|
245
|
+
* @module
|
|
246
|
+
*/
|
|
247
|
+
import { Button, style, TextInput } from '@tempoxyz/ds'
|
|
248
|
+
|
|
249
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
250
|
+
export function Demo() {
|
|
251
|
+
return (
|
|
252
|
+
<div {...styles.popup()}>
|
|
253
|
+
<span {...styles.title()}>Address label</span>
|
|
254
|
+
<TextInput.Group>
|
|
255
|
+
<TextInput.Control aria-label="Label" defaultValue="Alex, main wallet" />
|
|
256
|
+
</TextInput.Group>
|
|
257
|
+
<div {...styles.actions()}>
|
|
258
|
+
<Button size="small" variant="secondary">
|
|
259
|
+
Cancel
|
|
260
|
+
</Button>
|
|
261
|
+
<Button size="small">Save label</Button>
|
|
262
|
+
</div>
|
|
263
|
+
</div>
|
|
264
|
+
)
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
namespace styles {
|
|
268
|
+
export const actions = style({
|
|
269
|
+
columnGap: '8',
|
|
270
|
+
display: 'flex',
|
|
271
|
+
justifyContent: 'flex-end',
|
|
272
|
+
marginTop: '4',
|
|
273
|
+
})
|
|
274
|
+
|
|
275
|
+
export const popup = style({
|
|
276
|
+
backgroundColor: 'background.elevated',
|
|
277
|
+
borderRadius: 'sm',
|
|
278
|
+
boxShadow: 'regular',
|
|
279
|
+
boxSizing: 'border-box',
|
|
280
|
+
display: 'flex',
|
|
281
|
+
flexDirection: 'column',
|
|
282
|
+
padding: '20',
|
|
283
|
+
rowGap: '8',
|
|
284
|
+
width: '16rem !custom',
|
|
285
|
+
})
|
|
286
|
+
|
|
287
|
+
export const title = style({ color: 'content.primary', typography: 'body.b1Strong' })
|
|
288
|
+
}
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
**Don't:** Rely on Escape or an outside press to leave a popover with controls.
|
|
292
|
+
|
|
293
|
+
```tsx
|
|
294
|
+
/**
|
|
295
|
+
* Don't example for "Offer a Close Action for Controls" on the Popover page.
|
|
296
|
+
* Don't rely on Escape or an outside press to leave a popover with controls.
|
|
297
|
+
* @module
|
|
298
|
+
*/
|
|
299
|
+
import { style, TextInput } from '@tempoxyz/ds'
|
|
300
|
+
|
|
301
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
302
|
+
export function Demo() {
|
|
303
|
+
return (
|
|
304
|
+
<div {...styles.popup()}>
|
|
305
|
+
<span {...styles.title()}>Address label</span>
|
|
306
|
+
<TextInput.Group>
|
|
307
|
+
<TextInput.Control aria-label="Label" defaultValue="Alex, main wallet" />
|
|
308
|
+
</TextInput.Group>
|
|
309
|
+
</div>
|
|
310
|
+
)
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
namespace styles {
|
|
314
|
+
export const popup = style({
|
|
315
|
+
backgroundColor: 'background.elevated',
|
|
316
|
+
borderRadius: 'sm',
|
|
317
|
+
boxShadow: 'regular',
|
|
318
|
+
boxSizing: 'border-box',
|
|
319
|
+
display: 'flex',
|
|
320
|
+
flexDirection: 'column',
|
|
321
|
+
padding: '20',
|
|
322
|
+
rowGap: '8',
|
|
323
|
+
width: '16rem !custom',
|
|
324
|
+
})
|
|
325
|
+
|
|
326
|
+
export const title = style({ color: 'content.primary', typography: 'body.b1Strong' })
|
|
327
|
+
}
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
### Point at Small Triggers
|
|
331
|
+
|
|
332
|
+
`Popover.Popup` opens 8px from its trigger. If the trigger is small, such as an info icon in a table header, add `Popover.Arrow`.
|
|
333
|
+
|
|
334
|
+
**Do:** Add `Popover.Arrow` to point at a small trigger.
|
|
335
|
+
|
|
336
|
+
```tsx
|
|
337
|
+
/**
|
|
338
|
+
* Do example for "Point at Small Triggers" on the Popover page.
|
|
339
|
+
* Add `Popover.Arrow` to point at a small trigger.
|
|
340
|
+
* @module
|
|
341
|
+
*/
|
|
342
|
+
import { Button, style } from '@tempoxyz/ds'
|
|
343
|
+
import { InfoCircle } from '@tempoxyz/ds/icons'
|
|
344
|
+
|
|
345
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
346
|
+
export function Demo() {
|
|
347
|
+
return (
|
|
348
|
+
<div {...styles.stack()}>
|
|
349
|
+
<div {...styles.header()}>
|
|
350
|
+
<span {...styles.column()}>
|
|
351
|
+
Fee
|
|
352
|
+
<Button aria-label="About fee" shape="icon" size="small" variant="tertiary">
|
|
353
|
+
<InfoCircle />
|
|
354
|
+
</Button>
|
|
355
|
+
</span>
|
|
356
|
+
<span {...styles.column()}>
|
|
357
|
+
Throughput
|
|
358
|
+
<Button aria-label="About throughput" shape="icon" size="small" variant="tertiary">
|
|
359
|
+
<InfoCircle />
|
|
360
|
+
</Button>
|
|
361
|
+
</span>
|
|
362
|
+
</div>
|
|
363
|
+
<div {...styles.popup()}>
|
|
364
|
+
{/* Popover.Arrow needs an open popup, so this preview draws its shape in place. */}
|
|
365
|
+
<svg
|
|
366
|
+
aria-hidden="true"
|
|
367
|
+
fill="currentColor"
|
|
368
|
+
height="10"
|
|
369
|
+
viewBox="0 0 20 10"
|
|
370
|
+
width="20"
|
|
371
|
+
{...styles.arrow()}
|
|
372
|
+
>
|
|
373
|
+
<path d="M0 10C4 10 7 7 8.6 4.6a2 2 0 0 1 2.8 0C13 7 16 10 20 10Z" />
|
|
374
|
+
</svg>
|
|
375
|
+
<p {...styles.description()}>Paid in the token you send, about 0.01 USDC.</p>
|
|
376
|
+
</div>
|
|
377
|
+
</div>
|
|
378
|
+
)
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
namespace styles {
|
|
382
|
+
export const arrow = style({
|
|
383
|
+
color: 'background.elevated',
|
|
384
|
+
left: '4.25rem !custom',
|
|
385
|
+
position: 'absolute',
|
|
386
|
+
top: '-10px !custom',
|
|
387
|
+
})
|
|
388
|
+
|
|
389
|
+
export const column = style({
|
|
390
|
+
alignItems: 'center',
|
|
391
|
+
color: 'content.secondary',
|
|
392
|
+
columnGap: '2px !custom',
|
|
393
|
+
display: 'flex',
|
|
394
|
+
typography: 'body.b3',
|
|
395
|
+
})
|
|
396
|
+
|
|
397
|
+
export const description = style({
|
|
398
|
+
color: 'content.secondary',
|
|
399
|
+
margin: '0 !custom',
|
|
400
|
+
typography: 'body.b2',
|
|
401
|
+
})
|
|
402
|
+
|
|
403
|
+
export const header = style({ columnGap: '24', display: 'flex', paddingInlineStart: '24' })
|
|
404
|
+
|
|
405
|
+
export const popup = style({
|
|
406
|
+
backgroundColor: 'background.elevated',
|
|
407
|
+
borderRadius: 'sm',
|
|
408
|
+
boxShadow: 'regular',
|
|
409
|
+
boxSizing: 'border-box',
|
|
410
|
+
padding: '16',
|
|
411
|
+
position: 'relative',
|
|
412
|
+
width: '15rem !custom',
|
|
413
|
+
})
|
|
414
|
+
|
|
415
|
+
export const stack = style({ display: 'flex', flexDirection: 'column', rowGap: '8' })
|
|
416
|
+
}
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
**Don't:** Leave the popup's trigger unclear among small icons.
|
|
420
|
+
|
|
421
|
+
```tsx
|
|
422
|
+
/**
|
|
423
|
+
* Don't example for "Point at Small Triggers" on the Popover page.
|
|
424
|
+
* Don't leave the popup's trigger unclear among small icons.
|
|
425
|
+
* @module
|
|
426
|
+
*/
|
|
427
|
+
import { Button, style } from '@tempoxyz/ds'
|
|
428
|
+
import { InfoCircle } from '@tempoxyz/ds/icons'
|
|
429
|
+
|
|
430
|
+
/** Renders the static preview, which the guideline card shows inert. */
|
|
431
|
+
export function Demo() {
|
|
432
|
+
return (
|
|
433
|
+
<div {...styles.stack()}>
|
|
434
|
+
<div {...styles.header()}>
|
|
435
|
+
<span {...styles.column()}>
|
|
436
|
+
Fee
|
|
437
|
+
<Button aria-label="About fee" shape="icon" size="small" variant="tertiary">
|
|
438
|
+
<InfoCircle />
|
|
439
|
+
</Button>
|
|
440
|
+
</span>
|
|
441
|
+
<span {...styles.column()}>
|
|
442
|
+
Throughput
|
|
443
|
+
<Button aria-label="About throughput" shape="icon" size="small" variant="tertiary">
|
|
444
|
+
<InfoCircle />
|
|
445
|
+
</Button>
|
|
446
|
+
</span>
|
|
447
|
+
</div>
|
|
448
|
+
<div {...styles.popup()}>
|
|
449
|
+
<p {...styles.description()}>Paid in the token you send, about 0.01 USDC.</p>
|
|
450
|
+
</div>
|
|
451
|
+
</div>
|
|
452
|
+
)
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
namespace styles {
|
|
456
|
+
export const column = style({
|
|
457
|
+
alignItems: 'center',
|
|
458
|
+
color: 'content.secondary',
|
|
459
|
+
columnGap: '2px !custom',
|
|
460
|
+
display: 'flex',
|
|
461
|
+
typography: 'body.b3',
|
|
462
|
+
})
|
|
463
|
+
|
|
464
|
+
export const description = style({
|
|
465
|
+
color: 'content.secondary',
|
|
466
|
+
margin: '0 !custom',
|
|
467
|
+
typography: 'body.b2',
|
|
468
|
+
})
|
|
469
|
+
|
|
470
|
+
export const header = style({ columnGap: '24', display: 'flex', paddingInlineStart: '24' })
|
|
471
|
+
|
|
472
|
+
export const popup = style({
|
|
473
|
+
backgroundColor: 'background.elevated',
|
|
474
|
+
borderRadius: 'sm',
|
|
475
|
+
boxShadow: 'regular',
|
|
476
|
+
boxSizing: 'border-box',
|
|
477
|
+
padding: '16',
|
|
478
|
+
width: '15rem !custom',
|
|
479
|
+
})
|
|
480
|
+
|
|
481
|
+
export const stack = style({ display: 'flex', flexDirection: 'column', rowGap: '8' })
|
|
482
|
+
}
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
## Content
|
|
486
|
+
|
|
487
|
+
### Title With the Subject
|
|
488
|
+
|
|
489
|
+
Name the value or setting, such as Network fee, with no question. Put the explanation in `Popover.Description`.
|
|
490
|
+
|
|
491
|
+
### Lead With the Answer
|
|
492
|
+
|
|
493
|
+
Start with the explanation, such as Transactions per second, averaged over each block. Keep it under about 25 words.
|
|
494
|
+
|
|
495
|
+
## Accessibility
|
|
496
|
+
|
|
497
|
+
### Semantics
|
|
498
|
+
|
|
499
|
+
* **Popover.Trigger (button):** Announces a dialog that click and keyboard open.
|
|
500
|
+
* **Popover.Popup (dialog):** A non-modal dialog, named by its title.
|
|
501
|
+
* **Popover.Title (h2):** Names the popup.
|
|
502
|
+
* **Popover.Description (p):** Describes the popup to screen readers.
|
|
503
|
+
* **Popover.Arrow (aria-hidden):** Decorative and hidden from assistive technology.
|
|
504
|
+
|
|
505
|
+
### Keyboard
|
|
506
|
+
|
|
507
|
+
* **Open and Activate (Enter or Space):** Opens the popover from the trigger, and activates the focused control in it.
|
|
508
|
+
* **Move Through the Popup (Tab):** Moves through the controls in the popup. Past the last control, the popover closes.
|
|
509
|
+
* **Return to the Trigger (Shift+Tab):** From the first control, moves focus back to the trigger.
|
|
510
|
+
* **Close the Popover (Escape):** Closes the popover.
|
|
511
|
+
|
|
512
|
+
### Focus
|
|
513
|
+
|
|
514
|
+
* **Opening (initialFocus):** Focus moves to the first control, or to the popup on touch. Pass `initialFocus` to change it.
|
|
515
|
+
* **Non-Modal (modal):** Focus is not trapped, and the page stays interactive unless you set `modal`.
|
|
516
|
+
* **Outside Press:** A press outside the popup closes it.
|
|
517
|
+
* **Closing (finalFocus):** Escape or an outside press returns focus to the trigger. If the trigger is gone, pass `finalFocus`.
|
|
518
|
+
|
|
519
|
+
### Your Responsibilities
|
|
520
|
+
|
|
521
|
+
* **Render Popover.Title:** Always render a title, so the dialog has an accessible name.
|
|
522
|
+
* **Name Icon-Only Triggers (aria-label):** Name the trigger's subject, such as "About throughput".
|
|
523
|
+
|
|
524
|
+
## Related
|
|
525
|
+
|
|
526
|
+
[Tooltip](tooltip.md)
|
|
527
|
+
|
|
528
|
+
Use for short labels on icon buttons.
|
|
529
|
+
|
|
530
|
+
[Dialog](dialog.md)
|
|
531
|
+
|
|
532
|
+
Use for focused tasks that block the page.
|
|
533
|
+
|
|
534
|
+
[Drawer](drawer.md)
|
|
535
|
+
|
|
536
|
+
Use for long content and bottom sheets.
|
|
537
|
+
|
|
538
|
+
[Menu](menu.md)
|
|
539
|
+
|
|
540
|
+
Use for lists of actions.
|
|
541
|
+
|
|
542
|
+
[Dashboards](../patterns/dashboards.md)
|
|
543
|
+
|
|
544
|
+
Covers explaining metrics.
|