@tempoxyz/ds 0.3.14 → 0.3.15

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 (131) hide show
  1. package/dist/docs/AGENTS.md +73 -10
  2. package/dist/docs/{marketing/introduction/getting-started.md → marketing.md} +28 -20
  3. package/dist/docs/product/components/actions.md +2058 -0
  4. package/dist/docs/product/components/blockchain.md +3825 -0
  5. package/dist/docs/product/components/data-display.md +5901 -0
  6. package/dist/docs/product/components/feedback-and-status.md +4008 -0
  7. package/dist/docs/product/components/forms-and-inputs.md +10543 -0
  8. package/dist/docs/product/components/layout.md +3339 -0
  9. package/dist/docs/product/components/navigation.md +2914 -0
  10. package/dist/docs/product/components/overlays.md +4917 -0
  11. package/dist/docs/product/components.md +125 -125
  12. package/dist/docs/product/foundations.md +4596 -0
  13. package/dist/docs/product/patterns.md +10129 -0
  14. package/package.json +1 -1
  15. package/dist/docs/index.md +0 -145
  16. package/dist/docs/product/components/accordion.md +0 -489
  17. package/dist/docs/product/components/address-card.md +0 -147
  18. package/dist/docs/product/components/agent-logo.md +0 -194
  19. package/dist/docs/product/components/alert-dialog.md +0 -631
  20. package/dist/docs/product/components/alert.md +0 -448
  21. package/dist/docs/product/components/amount-input.md +0 -305
  22. package/dist/docs/product/components/amount.md +0 -794
  23. package/dist/docs/product/components/app-shell.md +0 -559
  24. package/dist/docs/product/components/asset-chip.md +0 -294
  25. package/dist/docs/product/components/autocomplete.md +0 -620
  26. package/dist/docs/product/components/avatar.md +0 -321
  27. package/dist/docs/product/components/badge.md +0 -339
  28. package/dist/docs/product/components/badged-logo.md +0 -116
  29. package/dist/docs/product/components/banner.md +0 -379
  30. package/dist/docs/product/components/bar-chart.md +0 -208
  31. package/dist/docs/product/components/breadcrumbs.md +0 -380
  32. package/dist/docs/product/components/button-group.md +0 -286
  33. package/dist/docs/product/components/button.md +0 -650
  34. package/dist/docs/product/components/calendar.md +0 -375
  35. package/dist/docs/product/components/callout.md +0 -96
  36. package/dist/docs/product/components/checkbox-group.md +0 -521
  37. package/dist/docs/product/components/checkbox.md +0 -467
  38. package/dist/docs/product/components/choice-group.md +0 -516
  39. package/dist/docs/product/components/choicebox.md +0 -641
  40. package/dist/docs/product/components/code.md +0 -100
  41. package/dist/docs/product/components/combobox.md +0 -939
  42. package/dist/docs/product/components/container.md +0 -257
  43. package/dist/docs/product/components/copy-button.md +0 -642
  44. package/dist/docs/product/components/date-picker.md +0 -514
  45. package/dist/docs/product/components/dialog.md +0 -1332
  46. package/dist/docs/product/components/drawer.md +0 -966
  47. package/dist/docs/product/components/empty.md +0 -340
  48. package/dist/docs/product/components/field.md +0 -570
  49. package/dist/docs/product/components/fieldset.md +0 -398
  50. package/dist/docs/product/components/frame.md +0 -434
  51. package/dist/docs/product/components/gauge.md +0 -299
  52. package/dist/docs/product/components/get-started-visual.md +0 -117
  53. package/dist/docs/product/components/grid.md +0 -288
  54. package/dist/docs/product/components/hero-visual.md +0 -155
  55. package/dist/docs/product/components/hex.md +0 -487
  56. package/dist/docs/product/components/icon-tile.md +0 -292
  57. package/dist/docs/product/components/identicon.md +0 -371
  58. package/dist/docs/product/components/inline.md +0 -233
  59. package/dist/docs/product/components/inset.md +0 -225
  60. package/dist/docs/product/components/kbd.md +0 -423
  61. package/dist/docs/product/components/list-group.md +0 -981
  62. package/dist/docs/product/components/loading-dots.md +0 -237
  63. package/dist/docs/product/components/menu.md +0 -934
  64. package/dist/docs/product/components/native-select.md +0 -204
  65. package/dist/docs/product/components/network-logo.md +0 -248
  66. package/dist/docs/product/components/number-field.md +0 -543
  67. package/dist/docs/product/components/otp-field.md +0 -616
  68. package/dist/docs/product/components/pagination.md +0 -516
  69. package/dist/docs/product/components/popover.md +0 -544
  70. package/dist/docs/product/components/progress.md +0 -388
  71. package/dist/docs/product/components/qr.md +0 -314
  72. package/dist/docs/product/components/radio-group.md +0 -528
  73. package/dist/docs/product/components/secret-value.md +0 -406
  74. package/dist/docs/product/components/select.md +0 -751
  75. package/dist/docs/product/components/separator.md +0 -379
  76. package/dist/docs/product/components/sidebar-menu.md +0 -922
  77. package/dist/docs/product/components/skeleton.md +0 -517
  78. package/dist/docs/product/components/slider.md +0 -539
  79. package/dist/docs/product/components/snippet.md +0 -424
  80. package/dist/docs/product/components/spinner.md +0 -216
  81. package/dist/docs/product/components/split-bar.md +0 -139
  82. package/dist/docs/product/components/split-button.md +0 -464
  83. package/dist/docs/product/components/stack.md +0 -299
  84. package/dist/docs/product/components/status-chip.md +0 -226
  85. package/dist/docs/product/components/status-indicator.md +0 -119
  86. package/dist/docs/product/components/status-row.md +0 -174
  87. package/dist/docs/product/components/stepper.md +0 -451
  88. package/dist/docs/product/components/success-hero.md +0 -157
  89. package/dist/docs/product/components/surface.md +0 -639
  90. package/dist/docs/product/components/switch.md +0 -472
  91. package/dist/docs/product/components/table.md +0 -968
  92. package/dist/docs/product/components/tabs.md +0 -627
  93. package/dist/docs/product/components/tempo-logo.md +0 -185
  94. package/dist/docs/product/components/text-input.md +0 -624
  95. package/dist/docs/product/components/textarea.md +0 -352
  96. package/dist/docs/product/components/toast.md +0 -535
  97. package/dist/docs/product/components/token-logo.md +0 -371
  98. package/dist/docs/product/components/token.md +0 -247
  99. package/dist/docs/product/components/tooltip.md +0 -490
  100. package/dist/docs/product/components/verification-code.md +0 -116
  101. package/dist/docs/product/components/visual.md +0 -249
  102. package/dist/docs/product/foundations/accessibility.md +0 -377
  103. package/dist/docs/product/foundations/agents.md +0 -159
  104. package/dist/docs/product/foundations/color.md +0 -522
  105. package/dist/docs/product/foundations/content/tone.md +0 -194
  106. package/dist/docs/product/foundations/content/voice.md +0 -194
  107. package/dist/docs/product/foundations/content/writing-style.md +0 -406
  108. package/dist/docs/product/foundations/iconography.md +0 -282
  109. package/dist/docs/product/foundations/intent.md +0 -360
  110. package/dist/docs/product/foundations/layout.md +0 -508
  111. package/dist/docs/product/foundations/linter.md +0 -523
  112. package/dist/docs/product/foundations/motion.md +0 -151
  113. package/dist/docs/product/foundations/radius-and-padding.md +0 -86
  114. package/dist/docs/product/foundations/typography.md +0 -331
  115. package/dist/docs/product/introduction/faq.md +0 -133
  116. package/dist/docs/product/introduction/getting-started.md +0 -377
  117. package/dist/docs/product/patterns/blockchain-values.md +0 -709
  118. package/dist/docs/product/patterns/dashboards.md +0 -638
  119. package/dist/docs/product/patterns/destructive-actions.md +0 -626
  120. package/dist/docs/product/patterns/empty-states.md +0 -612
  121. package/dist/docs/product/patterns/errors-and-validation.md +0 -808
  122. package/dist/docs/product/patterns/feedback-and-status.md +0 -518
  123. package/dist/docs/product/patterns/forms.md +0 -679
  124. package/dist/docs/product/patterns/loading.md +0 -630
  125. package/dist/docs/product/patterns/navigation.md +0 -397
  126. package/dist/docs/product/patterns/payments.md +0 -765
  127. package/dist/docs/product/patterns/responsive-layout.md +0 -997
  128. package/dist/docs/product/patterns/tables-and-lists.md +0 -1170
  129. package/dist/docs/product/products/tempo-console.md +0 -671
  130. package/dist/docs/product/products/tempo-performance.md +0 -435
  131. package/dist/docs/product/products/tempo-wallet.md +0 -438
@@ -1,559 +0,0 @@
1
- # AppShell
2
-
3
- Places a sticky sidebar beside the main content column.
4
-
5
- [View source and API](https://github.com/tempoxyz/ds/blob/main/src/web/components/AppShell.tsx)
6
-
7
- Figma: [Layout/App Shell](https://www.figma.com/design/yE96kcymnNR88PJp6G1sPs?node-id=5227-5593) (`AppShell.Root`), [Layout/Page Header](https://www.figma.com/design/yE96kcymnNR88PJp6G1sPs?node-id=5227-5633) (`AppShell.Header`), [Navigation/Tab Bar](https://www.figma.com/design/yE96kcymnNR88PJp6G1sPs?node-id=5265-2292) (`AppShell.Root`)
8
-
9
- ## Overview
10
-
11
- The outer frame of an application. Below 1024px, the sidebar moves into a drawer, which a menu button in a bottom bar opens. With `collapse`, the sidebar collapses to its icons until 768px instead. The bottom bar also repeats the items you choose.
12
-
13
- ## Examples
14
-
15
- ### Basic
16
-
17
- ```tsx
18
- /** Composes the Tempo Wallet shell: the account row, the wallet pages, the theme item and a page header. @module */
19
- import { AppShell, Avatar, Hex, Kbd, Menu, SidebarMenu, StatusChip, style, Surface } from '@tempoxyz/ds'
20
- import { Clock, DarkMode, Home, Link, LogOut, Plus, Wallet } from '@tempoxyz/ds/icons'
21
-
22
- export const fill = true
23
- const address = '0x7a3f2c19b0e4d85a6f1c3e9b2d7a40c58e6f91c2'
24
-
25
- const balances = ['pathUSD', 'USDC.e', 'AlphaUSD']
26
-
27
- export function Demo() {
28
- return (
29
- <div {...styles.frame()}>
30
- <AppShell.Root
31
- align="start"
32
- collapse
33
- style={{ height: '100%', minHeight: 0, overflowY: 'auto' }}
34
- >
35
- <AppShell.Sidebar aria-label="Wallet" style={{ height: '100%' }}>
36
- <AppShell.SidebarHeader>
37
- <Menu.Root>
38
- <Menu.Trigger
39
- render={<SidebarMenu.AccountRow description="Tempo Wallet" label="Piril Akay" />}
40
- >
41
- <Avatar size="32">
42
- <Avatar.Fallback>PA</Avatar.Fallback>
43
- </Avatar>
44
- </Menu.Trigger>
45
- <Menu.Popup>
46
- <Menu.Item>
47
- <Plus />
48
- Add account
49
- </Menu.Item>
50
- <Menu.Separator />
51
- <Menu.Item intent="negative">
52
- <LogOut />
53
- Sign out
54
- </Menu.Item>
55
- </Menu.Popup>
56
- </Menu.Root>
57
- </AppShell.SidebarHeader>
58
- <AppShell.SidebarBody>
59
- <SidebarMenu.Root>
60
- <SidebarMenu.Group aria-label="Wallet">
61
- <SidebarMenu.Item active href="#" tabBar="tab">
62
- <Home />
63
- Home
64
- </SidebarMenu.Item>
65
- <SidebarMenu.Item href="#" tabBar="tab">
66
- <Clock />
67
- Activity
68
- </SidebarMenu.Item>
69
- <SidebarMenu.Item href="#" tabBar="tab">
70
- <Wallet />
71
- Assets
72
- </SidebarMenu.Item>
73
- <SidebarMenu.Item href="#">
74
- <Link />
75
- Connections
76
- </SidebarMenu.Item>
77
- </SidebarMenu.Group>
78
- </SidebarMenu.Root>
79
- </AppShell.SidebarBody>
80
- <AppShell.SidebarFooter>
81
- <SidebarMenu.Root aria-label="Preferences">
82
- <SidebarMenu.Item render={<button type="button" />}>
83
- <DarkMode />
84
- <span {...styles.grow()}>Dark mode</span>
85
- <Kbd alt size="small">
86
- M
87
- </Kbd>
88
- </SidebarMenu.Item>
89
- </SidebarMenu.Root>
90
- </AppShell.SidebarFooter>
91
- </AppShell.Sidebar>
92
- <AppShell.Main>
93
- <AppShell.Header>
94
- <AppShell.Title>Home</AppShell.Title>
95
- <div {...styles.actions()}>
96
- <StatusChip intent="positive" network>
97
- Mainnet
98
- </StatusChip>
99
- <Hex.Root size="small" value={address} variant="filled" {...styles.address()}>
100
- <Hex.Text />
101
- <Hex.Copy aria-label="Copy wallet address" />
102
- </Hex.Root>
103
- </div>
104
- <AppShell.Trigger />
105
- </AppShell.Header>
106
- <div {...styles.list()}>
107
- {balances.map((balance) => (
108
- <Surface key={balance}>
109
- <p {...styles.name()}>{balance}</p>
110
- <p {...styles.caption()}>Available to send</p>
111
- </Surface>
112
- ))}
113
- </div>
114
- </AppShell.Main>
115
- </AppShell.Root>
116
- </div>
117
- )
118
- }
119
-
120
- namespace styles {
121
- // The bottom bar takes over below 768px, so the header keeps only its title.
122
- export const actions = style({
123
- alignItems: 'center',
124
- columnGap: '8',
125
- display: 'flex',
126
- '@media (max-width: 767px)': { display: 'none' },
127
- })
128
-
129
- export const address = style({ maxWidth: '10rem !custom' })
130
-
131
- export const caption = style({ color: 'content.secondary', margin: '0', typography: 'body.b3' })
132
-
133
- // The transform makes the frame the containing block for the mobile drawer.
134
- export const frame = style({
135
- borderRadius: 'sm',
136
- height: '32rem !custom',
137
- overflow: 'hidden',
138
- transform: 'translateZ(0) !custom',
139
- selectors: {
140
- // The maximized gallery preview shows the shell at full window height.
141
- ':root[data-maximized] &': { borderRadius: '0px !custom', height: '100vh !custom' },
142
- },
143
- })
144
-
145
- export const grow = style({ flex: '1 !custom', minWidth: '0 !custom' })
146
-
147
- export const list = style({ display: 'flex', flexDirection: 'column', rowGap: '12' })
148
-
149
- export const name = style({ margin: '0', typography: 'body.b2' })
150
- }
151
- ```
152
-
153
- [View example source](https://github.com/tempoxyz/ds/blob/main/docs/src/examples/demos/AppShell/Basic.tsx)
154
-
155
- ## Anatomy
156
-
157
- Import the component and assemble its parts.
158
-
159
- ```tsx
160
- import { AppShell } from '@tempoxyz/ds'
161
-
162
- <AppShell.Root>
163
- <AppShell.Sidebar>
164
- <AppShell.SidebarHeader />
165
- <AppShell.SidebarBody />
166
- <AppShell.SidebarFooter />
167
- </AppShell.Sidebar>
168
- <AppShell.Main>
169
- <AppShell.Header>
170
- <AppShell.Title />
171
- </AppShell.Header>
172
- </AppShell.Main>
173
- <AppShell.Trigger />
174
- </AppShell.Root>
175
- ```
176
-
177
- ## Guidelines
178
-
179
- ### When to Use
180
-
181
- * Frame a product with persistent navigation, such as Tempo Console or the web wallet. Render it once, in the root layout.
182
- * Pair a [SidebarMenu](sidebar-menu.md) with a content column of tables, cards, or settings.
183
-
184
- ### When Not to Use
185
-
186
- * Use [Container](container.md) for pages without persistent navigation, such as sign-in, onboarding, or a public receipt.
187
- * Use [Dialog](dialog.md), or a full-screen flow in a [Container](container.md), for focused tasks such as Send payment.
188
- * Use [Drawer](drawer.md) for a details or filter panel that opens on demand. The shell's drawer holds only primary navigation.
189
- * Use [Frame](frame.md) for a header, body, and footer inside a card or popup.
190
-
191
- ### Plan for Each Layout
192
-
193
- The shell switches layouts at 768px and 1024px (the `'768'` and `'1024'` breakpoints). Design and test each.
194
-
195
- * **Below 768px (Bottom bar):** The sidebar becomes a drawer from the right edge, and a bottom bar holds the chosen items and the menu button.
196
- * **768px to 1023px (collapse):** The drawer and bottom bar by default. With `collapse`, a 64px column of icons that keep their labels as names.
197
- * **1024px and Up (28px padding):** The sidebar sticks beside the content with its own scroll, and the bottom bar hides.
198
-
199
- The drawer is `min(18rem, 85vw)` wide. Server rendering emits the inline sidebar, and CSS hides it below 1024px, or collapses it until 768px with `collapse`.
200
-
201
- ### Always Render the Trigger
202
-
203
- Render `AppShell.Trigger` once inside `AppShell.Root`. It adds the menu button to the end of the bottom bar, so the header keeps its full width for the title and actions.
204
-
205
- **Do:** Render the trigger once in the shell.
206
-
207
- ```tsx
208
- /**
209
- * Do example for "Always Render the Trigger" on the AppShell page.
210
- * Render the trigger once in the shell.
211
- * @module
212
- */
213
- import { Button, style, Surface } from '@tempoxyz/ds'
214
- import { Menu } from '@tempoxyz/ds/icons'
215
-
216
- /** Renders the static preview, which the guideline card shows inert. */
217
- export function Demo() {
218
- return (
219
- <Surface size="small" {...styles.frame()}>
220
- <span {...styles.title()}>Balances</span>
221
- <div {...styles.bar()}>
222
- <Button aria-label="Open menu" shape="icon" size="small">
223
- <Menu />
224
- </Button>
225
- </div>
226
- </Surface>
227
- )
228
- }
229
-
230
- namespace styles {
231
- export const bar = style({ display: 'flex', justifyContent: 'flex-end' })
232
-
233
- export const frame = style({
234
- display: 'flex',
235
- flexDirection: 'column',
236
- gap: '24',
237
- width: '18rem !custom',
238
- })
239
-
240
- export const title = style({ color: 'content.primary', typography: 'heading.h3' })
241
- }
242
- ```
243
-
244
- **Don't:** Leave it out. Below 1024px, or 768px with `collapse`, it is the only way to reach every
245
- destination.
246
-
247
- ```tsx
248
- /**
249
- * Don't example for "Always Render the Trigger" on the AppShell page.
250
- * Don't leave it out. Below 1024px, it is the only way to reach navigation.
251
- * @module
252
- */
253
- import { style, Surface } from '@tempoxyz/ds'
254
-
255
- /** Renders the static preview, which the guideline card shows inert. */
256
- export function Demo() {
257
- return (
258
- <Surface size="small" {...styles.frame()}>
259
- <span {...styles.title()}>Balances</span>
260
- <div {...styles.bar()} />
261
- </Surface>
262
- )
263
- }
264
-
265
- namespace styles {
266
- // Matches the height of the bottom bar in the Do example, so only the missing button differs.
267
- export const bar = style({ minHeight: '32' })
268
-
269
- export const frame = style({
270
- display: 'flex',
271
- flexDirection: 'column',
272
- gap: '24',
273
- width: '18rem !custom',
274
- })
275
-
276
- export const title = style({ color: 'content.primary', typography: 'heading.h3' })
277
- }
278
- ```
279
-
280
- ### Choose an Alignment
281
-
282
- * **Centered (center):** The default. Centers the sidebar beside a content column up to 1024px wide.
283
- * **Start (start):** Pins the sidebar left, and the content fills the row. Use it for wide data views.
284
-
285
- ### Structure the Sidebar
286
-
287
- * **AppShell.SidebarHeader:** Holds the product or project switcher at the top of the sidebar.
288
- * **AppShell.SidebarBody:** Holds the sidebar menu. It scrolls on its own and fades the edge with more content.
289
- * **AppShell.SidebarFooter:** Holds the account row and other controls, pinned to the bottom edge.
290
-
291
- Keep the header and footer short so the menu keeps most of the height. Set `--sidebar-width` to change the width of the wide sidebar.
292
-
293
- ### Choose the Bottom Bar Items
294
-
295
- Wherever the drawer replaces the sidebar, a bottom bar repeats the [SidebarMenu](sidebar-menu.md) items that set `tabBar`, in sidebar order, and ends with the menu button. Keep the rest in the drawer.
296
-
297
- * **Tab (tabBar="tab"):** Shows the icon in the tab bar pill. Choose up to three top destinations.
298
- * **Action (tabBar="action"):** Shows the icon in a floating button beside the pill. Choose one main action.
299
-
300
- ```tsx
301
- <SidebarMenu.Item active href="/" tabBar="tab">
302
- <Home />
303
- Home
304
- </SidebarMenu.Item>
305
- ```
306
-
307
- ### Use One Title per Page
308
-
309
- `AppShell.Title` renders the page's `h1` in the header bar across the top of the content column. Keep one primary action in the header.
310
-
311
- **Do:** Put the title first, then page actions, such as a `small` [Button](button.md).
312
-
313
- ```tsx
314
- /**
315
- * Do example for "Use One Title per Page" on the AppShell page.
316
- * Put the title first, then page actions, such as a `small` Button.
317
- * @module
318
- */
319
- import { Button, style, Surface } from '@tempoxyz/ds'
320
-
321
- /** Renders the static preview, which the guideline card shows inert. */
322
- export function Demo() {
323
- return (
324
- <Surface size="small" {...styles.frame()}>
325
- <div {...styles.header()}>
326
- <span {...styles.title()}>API keys</span>
327
- <Button size="small">New key</Button>
328
- </div>
329
- </Surface>
330
- )
331
- }
332
-
333
- namespace styles {
334
- export const frame = style({ width: '18rem !custom' })
335
-
336
- export const header = style({ alignItems: 'center', display: 'flex', gap: '12' })
337
-
338
- export const title = style({
339
- color: 'content.primary',
340
- flex: '1 !custom',
341
- typography: 'heading.h3',
342
- })
343
- }
344
- ```
345
-
346
- **Don't:** Place actions before the title.
347
-
348
- ```tsx
349
- /** Don't example for "Use One Title per Page" on the AppShell page. Don't place actions before the title. @module */
350
- import { Button, style, Surface } from '@tempoxyz/ds'
351
-
352
- /** Renders the static preview, which the guideline card shows inert. */
353
- export function Demo() {
354
- return (
355
- <Surface size="small" {...styles.frame()}>
356
- <div {...styles.header()}>
357
- <Button size="small">New key</Button>
358
- <span {...styles.title()}>API keys</span>
359
- </div>
360
- </Surface>
361
- )
362
- }
363
-
364
- namespace styles {
365
- export const frame = style({ width: '18rem !custom' })
366
-
367
- export const header = style({ alignItems: 'center', display: 'flex', gap: '12' })
368
-
369
- export const title = style({
370
- color: 'content.primary',
371
- flex: '1 !custom',
372
- typography: 'heading.h3',
373
- })
374
- }
375
- ```
376
-
377
- ### Close the Drawer After Navigating
378
-
379
- With a client-side router, the drawer stays open when the route changes. Control `AppShell.Root` with `open` and `onOpenChange`, and set `open` to `false` when the location changes.
380
-
381
- **Do:** Close the drawer, so the new page shows.
382
-
383
- ```tsx
384
- /**
385
- * Do example for "Close the Drawer After Navigating" on the AppShell page.
386
- * Close the drawer, so the new page shows.
387
- * @module
388
- */
389
- import { Button, style } from '@tempoxyz/ds'
390
- import { Menu } from '@tempoxyz/ds/icons'
391
-
392
- /** Renders the static preview, which the guideline card shows inert. */
393
- export function Demo() {
394
- return (
395
- <div {...styles.screen()}>
396
- <div {...styles.header()}>
397
- <span {...styles.title()}>API keys</span>
398
- <Button aria-label="Open menu" shape="icon" size="small" variant="secondary">
399
- <Menu />
400
- </Button>
401
- </div>
402
- <span {...styles.meta()}>2 active keys</span>
403
- </div>
404
- )
405
- }
406
-
407
- namespace styles {
408
- export const header = style({
409
- alignItems: 'center',
410
- display: 'flex',
411
- gap: '12',
412
- justifyContent: 'space-between',
413
- })
414
-
415
- export const meta = style({ color: 'content.secondary', typography: 'body.b2' })
416
-
417
- export const screen = style({
418
- display: 'flex',
419
- flexDirection: 'column',
420
- height: '9rem !custom',
421
- position: 'relative',
422
- rowGap: '8',
423
- width: '18rem !custom',
424
- })
425
-
426
- export const title = style({ color: 'content.primary', typography: 'heading.h3' })
427
- }
428
- ```
429
-
430
- **Don't:** Leave the drawer over the new page.
431
-
432
- ```tsx
433
- /**
434
- * Don't example for "Close the Drawer After Navigating" on the AppShell page.
435
- * Don't leave the drawer over the new page.
436
- * @module
437
- */
438
- import { Button, SidebarMenu, style, Surface } from '@tempoxyz/ds'
439
- import { Home, Key, Menu } from '@tempoxyz/ds/icons'
440
-
441
- /** Renders the static preview, which the guideline card shows inert. */
442
- export function Demo() {
443
- return (
444
- <div {...styles.screen()}>
445
- <div {...styles.header()}>
446
- <span {...styles.title()}>API keys</span>
447
- <Button aria-label="Open menu" shape="icon" size="small" variant="secondary">
448
- <Menu />
449
- </Button>
450
- </div>
451
- <span {...styles.meta()}>2 active keys</span>
452
- <Surface size="small" {...styles.drawer()}>
453
- <SidebarMenu.Root aria-label="Primary" size="small">
454
- <SidebarMenu.Item href="#">
455
- <Home />
456
- Home
457
- </SidebarMenu.Item>
458
- <SidebarMenu.Item active href="#">
459
- <Key />
460
- API keys
461
- </SidebarMenu.Item>
462
- </SidebarMenu.Root>
463
- </Surface>
464
- </div>
465
- )
466
- }
467
-
468
- namespace styles {
469
- export const drawer = style({
470
- insetBlock: '0 !custom',
471
- insetInlineEnd: '0 !custom',
472
- position: 'absolute',
473
- width: '11rem !custom',
474
- })
475
-
476
- export const header = style({
477
- alignItems: 'center',
478
- display: 'flex',
479
- gap: '12',
480
- justifyContent: 'space-between',
481
- })
482
-
483
- export const meta = style({ color: 'content.secondary', typography: 'body.b2' })
484
-
485
- export const screen = style({
486
- display: 'flex',
487
- flexDirection: 'column',
488
- height: '9rem !custom',
489
- position: 'relative',
490
- rowGap: '8',
491
- width: '18rem !custom',
492
- })
493
-
494
- export const title = style({ color: 'content.primary', typography: 'heading.h3' })
495
- }
496
- ```
497
-
498
- ## Content
499
-
500
- * Match `AppShell.Title` to the label of the active [SidebarMenu](sidebar-menu.md) item, such as API keys.
501
- * Keep titles short enough to share the header row with its actions at 360px.
502
-
503
- ## Accessibility
504
-
505
- Provides the page landmarks and the `h1`. Below 1024px, the sidebar drawer follows the [WAI-ARIA Dialog (Modal) pattern](https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/).
506
-
507
- ### Semantics
508
-
509
- * **AppShell.Main (main):** The page's main landmark.
510
- * **AppShell.Header (header):** Holds the menu trigger and the page title.
511
- * **AppShell.Title (h1):** The page's top-level heading.
512
- * **Wide AppShell.Sidebar (complementary):** From 1024px, a landmark named by `aria-label`.
513
- * **Narrow AppShell.Sidebar (dialog):** Below 1024px, a dialog with the same name.
514
- * **AppShell.Trigger (button):** Named "Open menu" or "Close menu" by state.
515
-
516
- ### Keyboard
517
-
518
- * **Move Through the Shell (Tab):** Moves to the trigger, or cycles the open drawer.
519
- * **Open the Drawer (Enter or Space):** Opens the drawer from the trigger.
520
- * **Close the Drawer (Escape):** Closes the drawer.
521
-
522
- ### Focus
523
-
524
- * **Opening (Tab or Shift+Tab):** The drawer is modal. Opening it moves focus inside and traps it.
525
- * **While Open (aria-hidden):** Hides the rest of the page, including the trigger, from assistive technology.
526
- * **Closing:** Escape, the backdrop, or a swipe right closes the drawer and returns focus to the trigger.
527
-
528
- ### Motion and Size
529
-
530
- * **Reduced Motion (prefers-reduced-motion):** The drawer fades, and the trigger switches instantly.
531
- * **Minimum Width (360px):** The shell never shrinks below this width.
532
-
533
- ### Your Responsibilities
534
-
535
- * **Name the Sidebar (aria-label):** Name the sidebar, such as "Primary". The name labels the landmark and the drawer.
536
- * **Use One Title (h1):** Use one page title. Start the headings of the content at `h2`.
537
- * **Add a Skip Link (SC 2.4.1):** If the sidebar holds many links, add a [skip link](https://www.w3.org/WAI/WCAG22/Understanding/bypass-blocks.html). The shell adds none.
538
-
539
- ## Related
540
-
541
- [SidebarMenu](sidebar-menu.md)
542
-
543
- Use for the navigation inside the sidebar.
544
-
545
- [Container](container.md)
546
-
547
- Use for pages without a sidebar.
548
-
549
- [Drawer](drawer.md)
550
-
551
- Use for panels that open on demand.
552
-
553
- [Responsive Layout](../patterns/responsive-layout.md)
554
-
555
- Covers adapting pages across breakpoints.
556
-
557
- [Navigation](../patterns/navigation.md)
558
-
559
- Covers choosing between navigation components.