division-ds 0.3.1 → 0.4.0
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/AGENTS.md +1 -1
- package/package.json +1 -1
- package/public/docs/components/chart-panel.md +57 -42
- package/public/docs/components/code-block.md +106 -0
- package/public/docs/components/dropdown-menu.md +1 -0
- package/public/docs/components/kbd.md +24 -3
- package/public/docs/components/navbar.md +54 -3
- package/public/docs/components/panel.md +139 -0
- package/public/docs/components/progress.md +1 -1
- package/public/manifest/components.json +345 -12
- package/public/manifest/tokens.json +10 -7
- package/skills/division-ds/SKILL.md +1 -1
package/AGENTS.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Division DS: instructions for coding agents
|
|
2
2
|
|
|
3
|
-
A React 19 + Tailwind 4 + Radix design system:
|
|
3
|
+
A React 19 + Tailwind 4 + Radix design system: 74 components, tokens in three layers, light and
|
|
4
4
|
dark themes, WCAG 2.2 AA. This file is the entry point. It is short on purpose; everything it
|
|
5
5
|
points to is generated from the code, so it is current.
|
|
6
6
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "division-ds",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Checks a project that uses Division DS components (raw colours, invented tokens, touching buttons, unknown props), and serves the docs and the same checks to agents over MCP.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Victor Ilioiu",
|
|
@@ -59,20 +59,26 @@ Each is compiled and rendered on the docs page. Imports are omitted; see above.
|
|
|
59
59
|
type Week = { week: string; online: number; store: number }
|
|
60
60
|
|
|
61
61
|
const WEEKS: Week[] = [
|
|
62
|
-
{ week: 'W1', online:
|
|
63
|
-
{ week: 'W2', online:
|
|
64
|
-
{ week: 'W3', online:
|
|
65
|
-
{ week: 'W4', online:
|
|
66
|
-
{ week: 'W5', online:
|
|
67
|
-
{ week: 'W6', online:
|
|
68
|
-
{ week: 'W7', online:
|
|
69
|
-
{ week: 'W8', online:
|
|
62
|
+
{ week: 'W1', online: 118, store: 150 },
|
|
63
|
+
{ week: 'W2', online: 149, store: 172 },
|
|
64
|
+
{ week: 'W3', online: 168, store: 158 },
|
|
65
|
+
{ week: 'W4', online: 141, store: 131 },
|
|
66
|
+
{ week: 'W5', online: 126, store: 128 },
|
|
67
|
+
{ week: 'W6', online: 174, store: 150 },
|
|
68
|
+
{ week: 'W7', online: 231, store: 141 },
|
|
69
|
+
{ week: 'W8', online: 183, store: 122 },
|
|
70
|
+
{ week: 'W9', online: 139, store: 149 },
|
|
71
|
+
{ week: 'W10', online: 162, store: 185 },
|
|
72
|
+
{ week: 'W11', online: 196, store: 163 },
|
|
73
|
+
{ week: 'W12', online: 170, store: 140 },
|
|
70
74
|
]
|
|
71
75
|
|
|
72
76
|
<ChartPanel<Week>
|
|
73
77
|
title="Weekly orders"
|
|
74
|
-
summary="Online orders
|
|
78
|
+
summary="Online orders peaked three times in twelve weeks, highest at 231 in week 7; in-store orders peaked highest at 185 in week 10."
|
|
75
79
|
kind="line"
|
|
80
|
+
area
|
|
81
|
+
curve="smooth"
|
|
76
82
|
data={WEEKS}
|
|
77
83
|
xKey="week"
|
|
78
84
|
xLabel="Week"
|
|
@@ -116,17 +122,17 @@ type Day = { day: string; visits: number; orders: number }
|
|
|
116
122
|
|
|
117
123
|
const DAYS: Day[] = [
|
|
118
124
|
{ day: 'Mon', visits: 1840, orders: 61 },
|
|
119
|
-
{ day: 'Tue', visits:
|
|
120
|
-
{ day: 'Wed', visits:
|
|
121
|
-
{ day: 'Thu', visits:
|
|
122
|
-
{ day: 'Fri', visits:
|
|
125
|
+
{ day: 'Tue', visits: 2960, orders: 104 },
|
|
126
|
+
{ day: 'Wed', visits: 2210, orders: 74 },
|
|
127
|
+
{ day: 'Thu', visits: 1720, orders: 55 },
|
|
128
|
+
{ day: 'Fri', visits: 2650, orders: 92 },
|
|
123
129
|
{ day: 'Sat', visits: 3890, orders: 141 },
|
|
124
|
-
{ day: 'Sun', visits:
|
|
130
|
+
{ day: 'Sun', visits: 3120, orders: 118 },
|
|
125
131
|
]
|
|
126
132
|
|
|
127
133
|
<ChartPanel<Day>
|
|
128
134
|
title="Visits this week"
|
|
129
|
-
summary="Visits
|
|
135
|
+
summary="Visits peaked on Tuesday at 2,960, fell to a Thursday low of 1,720, then peaked higher on Saturday at 3,890."
|
|
130
136
|
kind="line"
|
|
131
137
|
area
|
|
132
138
|
curve="smooth"
|
|
@@ -134,7 +140,7 @@ const DAYS: Day[] = [
|
|
|
134
140
|
xKey="day"
|
|
135
141
|
xLabel="Day"
|
|
136
142
|
series={[{ key: 'visits', label: 'Visits' }]}
|
|
137
|
-
headline="
|
|
143
|
+
headline="18,390"
|
|
138
144
|
headingLevel={4}
|
|
139
145
|
/>
|
|
140
146
|
```
|
|
@@ -145,19 +151,23 @@ const DAYS: Day[] = [
|
|
|
145
151
|
type Week = { week: string; online: number; store: number }
|
|
146
152
|
|
|
147
153
|
const WEEKS: Week[] = [
|
|
148
|
-
{ week: 'W1', online:
|
|
149
|
-
{ week: 'W2', online:
|
|
150
|
-
{ week: 'W3', online:
|
|
151
|
-
{ week: 'W4', online:
|
|
152
|
-
{ week: 'W5', online:
|
|
153
|
-
{ week: 'W6', online:
|
|
154
|
-
{ week: 'W7', online:
|
|
155
|
-
{ week: 'W8', online:
|
|
154
|
+
{ week: 'W1', online: 118, store: 150 },
|
|
155
|
+
{ week: 'W2', online: 149, store: 172 },
|
|
156
|
+
{ week: 'W3', online: 168, store: 158 },
|
|
157
|
+
{ week: 'W4', online: 141, store: 131 },
|
|
158
|
+
{ week: 'W5', online: 126, store: 128 },
|
|
159
|
+
{ week: 'W6', online: 174, store: 150 },
|
|
160
|
+
{ week: 'W7', online: 231, store: 141 },
|
|
161
|
+
{ week: 'W8', online: 183, store: 122 },
|
|
162
|
+
{ week: 'W9', online: 139, store: 149 },
|
|
163
|
+
{ week: 'W10', online: 162, store: 185 },
|
|
164
|
+
{ week: 'W11', online: 196, store: 163 },
|
|
165
|
+
{ week: 'W12', online: 170, store: 140 },
|
|
156
166
|
]
|
|
157
167
|
|
|
158
168
|
<ChartPanel<Week>
|
|
159
169
|
title="Weekly orders, gridless"
|
|
160
|
-
summary="Online orders
|
|
170
|
+
summary="Online orders peaked three times in twelve weeks, highest at 231 in week 7; in-store orders peaked highest at 185 in week 10."
|
|
161
171
|
kind="line"
|
|
162
172
|
area
|
|
163
173
|
curve="smooth"
|
|
@@ -206,30 +216,34 @@ type Week = { week: string; online: number; store: number }
|
|
|
206
216
|
type Day = { day: string; visits: number; orders: number }
|
|
207
217
|
|
|
208
218
|
const WEEKS: Week[] = [
|
|
209
|
-
{ week: 'W1', online:
|
|
210
|
-
{ week: 'W2', online:
|
|
211
|
-
{ week: 'W3', online:
|
|
212
|
-
{ week: 'W4', online:
|
|
213
|
-
{ week: 'W5', online:
|
|
214
|
-
{ week: 'W6', online:
|
|
215
|
-
{ week: 'W7', online:
|
|
216
|
-
{ week: 'W8', online:
|
|
219
|
+
{ week: 'W1', online: 118, store: 150 },
|
|
220
|
+
{ week: 'W2', online: 149, store: 172 },
|
|
221
|
+
{ week: 'W3', online: 168, store: 158 },
|
|
222
|
+
{ week: 'W4', online: 141, store: 131 },
|
|
223
|
+
{ week: 'W5', online: 126, store: 128 },
|
|
224
|
+
{ week: 'W6', online: 174, store: 150 },
|
|
225
|
+
{ week: 'W7', online: 231, store: 141 },
|
|
226
|
+
{ week: 'W8', online: 183, store: 122 },
|
|
227
|
+
{ week: 'W9', online: 139, store: 149 },
|
|
228
|
+
{ week: 'W10', online: 162, store: 185 },
|
|
229
|
+
{ week: 'W11', online: 196, store: 163 },
|
|
230
|
+
{ week: 'W12', online: 170, store: 140 },
|
|
217
231
|
]
|
|
218
232
|
|
|
219
233
|
const DAYS: Day[] = [
|
|
220
234
|
{ day: 'Mon', visits: 1840, orders: 61 },
|
|
221
|
-
{ day: 'Tue', visits:
|
|
222
|
-
{ day: 'Wed', visits:
|
|
223
|
-
{ day: 'Thu', visits:
|
|
224
|
-
{ day: 'Fri', visits:
|
|
235
|
+
{ day: 'Tue', visits: 2960, orders: 104 },
|
|
236
|
+
{ day: 'Wed', visits: 2210, orders: 74 },
|
|
237
|
+
{ day: 'Thu', visits: 1720, orders: 55 },
|
|
238
|
+
{ day: 'Fri', visits: 2650, orders: 92 },
|
|
225
239
|
{ day: 'Sat', visits: 3890, orders: 141 },
|
|
226
|
-
{ day: 'Sun', visits:
|
|
240
|
+
{ day: 'Sun', visits: 3120, orders: 118 },
|
|
227
241
|
]
|
|
228
242
|
|
|
229
243
|
<ChartPanel<Day>
|
|
230
244
|
title="Visits"
|
|
231
|
-
headline="
|
|
232
|
-
summary="
|
|
245
|
+
headline="18,390"
|
|
246
|
+
summary="Two peaks: Tuesday, then a higher Saturday."
|
|
233
247
|
kind="line"
|
|
234
248
|
area
|
|
235
249
|
curve="smooth"
|
|
@@ -254,9 +268,10 @@ const DAYS: Day[] = [
|
|
|
254
268
|
/>
|
|
255
269
|
<ChartPanel<Week>
|
|
256
270
|
title="Online orders"
|
|
257
|
-
headline="
|
|
258
|
-
summary="
|
|
271
|
+
headline="170"
|
|
272
|
+
summary="Three peaks in twelve weeks; the highest, 231, in week 7."
|
|
259
273
|
kind="line"
|
|
274
|
+
area
|
|
260
275
|
curve="smooth"
|
|
261
276
|
size="sm"
|
|
262
277
|
data={WEEKS}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# CodeBlock
|
|
2
|
+
|
|
3
|
+
> Code or a command in a panel, with a title bar that names the file or language and a button that copies the text. Long lines scroll sideways inside it, and code longer than one line gets line numbers.
|
|
4
|
+
|
|
5
|
+
- **Best for:** Showing code or a command someone will read or copy: an install step, a config file, an example.
|
|
6
|
+
- **Not for:** A word of code inside a sentence: use a code element. A key to press: use Kbd.
|
|
7
|
+
- Molecule. Source: `src/components/molecules/code-block/CodeBlock.tsx`
|
|
8
|
+
- Rendered docs page: `/components/code-block`
|
|
9
|
+
|
|
10
|
+
## Import
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
import { CodeBlock } from 'src/components/molecules/code-block/CodeBlock'
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Paths are from the Division DS repository root. Installed with shadcn they start `src/division-ds/` instead of `src/` (`src/division-ds/components/...`); import them relative to your file. An install has no index barrels: import each component from its own file, never from `components/molecules`.
|
|
17
|
+
|
|
18
|
+
## Requires
|
|
19
|
+
|
|
20
|
+
- The app’s one Toaster at the root: the copy is confirmed with a toast.
|
|
21
|
+
|
|
22
|
+
## Props
|
|
23
|
+
|
|
24
|
+
| Prop | Type | Default | Description |
|
|
25
|
+
|---|---|---|---|
|
|
26
|
+
| `code` | `string` | | The text shown and copied, exactly. |
|
|
27
|
+
| `label` | `string` | | What the code is, in a few words ("the theme CSS"). Names the region and the copy button ("Copy the theme CSS"). |
|
|
28
|
+
| `title` | `string` | | Shown in the title bar: a file name ("index.css") or a language ("bash"). |
|
|
29
|
+
| `language` | `'css' \| 'text'` | `'text'` | css colours comments, at-rules, selectors and property names; text is plain. |
|
|
30
|
+
| `lineNumbers` | `boolean` | | Line numbers in a gutter. Unset, they show when the code has more than one line. |
|
|
31
|
+
| `copyable` | `boolean` | `true` | The copy button. Turn it off for code nobody should paste, such as a wrong example. |
|
|
32
|
+
| `wrap` | `boolean` | `false` | Wraps long lines instead of scrolling them sideways. For prose, such as a prompt; leave code unwrapped. |
|
|
33
|
+
| `className` | `string` | | Merged onto the frame. Use it for width (max-w-3xl) and spacing. |
|
|
34
|
+
| `ref` | `Ref<HTMLDivElement>` | | Passed through to the frame. |
|
|
35
|
+
|
|
36
|
+
## Examples
|
|
37
|
+
|
|
38
|
+
Each is compiled and rendered on the docs page. Imports are omitted; see above.
|
|
39
|
+
|
|
40
|
+
### A command
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
<CodeBlock title="bash" label="the check command" code="npx division-ds check src" className="max-w-3xl" />
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### A file, with CSS colours and line numbers
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
<CodeBlock
|
|
50
|
+
title="index.css"
|
|
51
|
+
language="css"
|
|
52
|
+
label="the theme CSS"
|
|
53
|
+
className="max-w-3xl"
|
|
54
|
+
code={'@import "./division-ds/styles/division-ds.css";\n\n/* Square corners */\n:root {\n --shape-bevel: 0;\n --shape-radius: 4px;\n}\n'}
|
|
55
|
+
/>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Not copyable, for code nobody should paste
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
<CodeBlock title="Wrong" label="a bare pre" copyable={false} code={'<pre>{command}</pre>'} className="max-w-3xl" />
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Keyboard
|
|
65
|
+
|
|
66
|
+
| Keys | Result |
|
|
67
|
+
|---|---|
|
|
68
|
+
| `Tab` | Moves to the copy button, then to the code region. |
|
|
69
|
+
| `←` `→` | In the focused code region: scrolls a long line sideways. |
|
|
70
|
+
| `Enter` | On the copy button: copies the code. |
|
|
71
|
+
|
|
72
|
+
## Do
|
|
73
|
+
|
|
74
|
+
- Write a label that says what the code is, so the copy button reads "Copy the install command".
|
|
75
|
+
- Give it a title: the file name it belongs in, or the language.
|
|
76
|
+
- Set a max width with className; long lines scroll inside it, so it never widens the page.
|
|
77
|
+
|
|
78
|
+
## Don't
|
|
79
|
+
|
|
80
|
+
- Don’t put several unrelated commands in one block. One block per thing to copy.
|
|
81
|
+
- Don’t set copyable on an example of what not to write.
|
|
82
|
+
- Don’t wrap it in another bordered panel; it brings its own frame.
|
|
83
|
+
|
|
84
|
+
## Common mistakes
|
|
85
|
+
|
|
86
|
+
Wrong:
|
|
87
|
+
|
|
88
|
+
```tsx
|
|
89
|
+
<pre className="font-mono text-sm">{command}</pre>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Right:
|
|
93
|
+
|
|
94
|
+
```tsx
|
|
95
|
+
<CodeBlock code={command} label="the install command" title="bash" />
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
A bare pre has no copy button, no name, and cannot be scrolled with a keyboard when a line runs past the edge.
|
|
99
|
+
|
|
100
|
+
## Anatomy
|
|
101
|
+
|
|
102
|
+
- **Frame**: A thin border around a surface.base fill. The syntax colours are measured for contrast on surface.base.
|
|
103
|
+
- **Title bar**: The title on the left, in 12px uppercase mono, and the copy button on the right, above a thin line.
|
|
104
|
+
- **Code region**: A pre with role region, named by the title and the label, focusable so a keyboard can scroll it. Up to 32rem tall, then it scrolls.
|
|
105
|
+
- **Line numbers**: A gutter in text.muted, hidden from screen readers and from text selection.
|
|
106
|
+
- **Copy button**: An IconButton named "Copy" plus the label. After copying, its icon turns into a tick for a moment and a toast confirms it.
|
|
@@ -29,6 +29,7 @@ Paths are from the Division DS repository root. Installed with shadcn they start
|
|
|
29
29
|
| `onSelect (Item)` | `(event: Event) => void` | | Called when the item is chosen. |
|
|
30
30
|
| `disabled (Item)` | `boolean` | `false` | The item can't be chosen, and typing letters (typeahead) skips it. |
|
|
31
31
|
| `tone (Item)` | `'default' \| 'hostile'` | `'default'` | Use hostile for a destructive action: hostile-coloured text at rest, the hostile fill with ink text when highlighted. |
|
|
32
|
+
| `asChild (Item)` | `boolean` | `false` | Makes the one child (a link) the item, for a menu of links. icon and shortcut are ignored then; put the content inside the link. |
|
|
32
33
|
| `icon (Item)` | `ReactNode` | | A small icon before the text, hidden from screen readers (aria-hidden). |
|
|
33
34
|
| `shortcut (Item)` | `string` | | Shown on the right and passed to screen readers as aria-keyshortcuts. It only displays the key: the menu never makes the key work. |
|
|
34
35
|
| `checked (Checkbox item)` | `boolean` | | Whether the tick shows. |
|
|
@@ -20,6 +20,8 @@ Paths are from the Division DS repository root. Installed with shadcn they start
|
|
|
20
20
|
| Prop | Type | Default | Description |
|
|
21
21
|
|---|---|---|---|
|
|
22
22
|
| `children` | `ReactNode` | | The key's name, for example "Esc" or "⌘". |
|
|
23
|
+
| `size` | `'md' \| 'sm'` | `'md'` | md is 24px tall, for a cap beside text or in a menu row. sm is 20px tall, for a cap inside a 32px control: a small Button or a search field. |
|
|
24
|
+
| `cut` | `boolean` | `false` | Cuts the bottom-right corner (5px at sm, 8px at md) so the cap nests in the corner of a bevelled control, its diagonal parallel to the control's. Only for a cap inside such a control. |
|
|
23
25
|
| `className` | `string` | | Merged with the component's classes. When Tailwind utility classes clash, the later one wins. |
|
|
24
26
|
| `ref` | `Ref<HTMLElement>` | | Passed through to the kbd element. |
|
|
25
27
|
| `...rest` | `HTMLAttributes<HTMLElement>` | | Every native attribute, passed onto the kbd element, such as a title, or an aria-label for a symbol key (aria-label is the name screen readers read out). |
|
|
@@ -49,6 +51,24 @@ Each is compiled and rendered on the docs page. Imports are omitted; see above.
|
|
|
49
51
|
<span className="text-sm text-[var(--color-text-secondary)]">Open the command palette</span>
|
|
50
52
|
```
|
|
51
53
|
|
|
54
|
+
### Sizes
|
|
55
|
+
|
|
56
|
+
```tsx
|
|
57
|
+
<Kbd>Esc</Kbd>
|
|
58
|
+
<Kbd size="sm">Esc</Kbd>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Small and cut, inside a small button
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
<Button variant="secondary" size="sm" iconStart={<Search />} aria-keyshortcuts="Control+K">
|
|
65
|
+
Search
|
|
66
|
+
<Kbd aria-hidden="true" size="sm" cut className="-mr-1.5 ml-2 -translate-y-[var(--cap-shift,0px)]">
|
|
67
|
+
Ctrl K
|
|
68
|
+
</Kbd>
|
|
69
|
+
</Button>
|
|
70
|
+
```
|
|
71
|
+
|
|
52
72
|
## Keyboard
|
|
53
73
|
|
|
54
74
|
Not focusable. No keyboard behaviour of its own.
|
|
@@ -58,15 +78,16 @@ Not focusable. No keyboard behaviour of its own.
|
|
|
58
78
|
- Use one Kbd per physical key, and put them side by side for a chord (keys pressed together).
|
|
59
79
|
- Put it next to the action it triggers, in the same row or the same tooltip.
|
|
60
80
|
- Write the key name the way the keyboard prints it.
|
|
81
|
+
- Inside a 32px control, use size="sm"; inside a bevelled one (a Button), add cut and place the cap at the end, near the cut corner.
|
|
61
82
|
|
|
62
83
|
## Don't
|
|
63
84
|
|
|
64
|
-
- Don’t
|
|
85
|
+
- Don’t set cut on a cap that stands alone in text or a menu row. The cut answers a bevelled corner around it; without one it reads as a button.
|
|
65
86
|
- Don’t put a whole chord inside one Kbd ("Ctrl+K" in a single cap).
|
|
66
87
|
- Don’t use it for anything that isn’t a key. It’s not a badge.
|
|
67
88
|
|
|
68
89
|
## Anatomy
|
|
69
90
|
|
|
70
91
|
- **kbd element**: The HTML element made for keys. Screen readers announce it as keyboard input.
|
|
71
|
-
- **Hairline border**: A one-pixel border in border.hairline-strong
|
|
72
|
-
- **Mono legend**: JetBrains Mono, uppercase, 11px (pixels): the tertiary type role.
|
|
92
|
+
- **Hairline border**: A one-pixel border in border.hairline-strong. Square corners by default; with cut, the bottom-right corner is cut at 45 degrees and the border follows the diagonal.
|
|
93
|
+
- **Mono legend**: JetBrains Mono, uppercase, 11px (pixels): the tertiary type role, at both sizes.
|
|
@@ -21,11 +21,12 @@ Paths are from the Division DS repository root. Installed with shadcn they start
|
|
|
21
21
|
|---|---|---|---|
|
|
22
22
|
| `label` | `string` | | Required. The name screen readers give the navigation region. |
|
|
23
23
|
| `brand` | `ReactNode` | | Required. The wordmark or logo, usually a link to the home page. |
|
|
24
|
-
| `items` | `NavbarItem[]` | | Required.
|
|
24
|
+
| `items` | `NavbarItem[]` | | Required. A link is { label, href, current }. A menu among the links is { label, menu, current }: menu lists { label, href, description } entries, opened from a dropdown on a wide bar and listed as a labelled group in the menu sheet on a narrow one. |
|
|
25
25
|
| `actions` | `ReactNode` | | Controls on the right: icon buttons, a cart link, an account menu. Keep them small, because they stay visible at every width. |
|
|
26
26
|
| `renderLink` | `(props: LinkRenderProps) => ReactNode` | `a plain anchor` | Pass your router's link component here. Map href to its own prop, and pass className, aria-current and onClick through. |
|
|
27
27
|
| `menuLabel` | `string` | `'Menu'` | The menu button's name for screen readers, and the sheet's title. |
|
|
28
|
-
| `menuFooter` | `ReactNode` | | Shown in the menu sheet under the links. Use it for an action that doesn't fit in actions on a narrow bar. Hide the matching copy in actions below the breakpoint by wrapping it in an element with the classes hidden @2xl:flex. |
|
|
28
|
+
| `menuFooter` | `ReactNode` | | Shown in the menu sheet under the links. Use it for an action that doesn't fit in actions on a narrow bar. Hide the matching copy in actions below the breakpoint by wrapping it in an element with the classes hidden @2xl:flex (hidden @4xl:flex when collapseBelow is '4xl'). |
|
|
29
|
+
| `collapseBelow` | `'2xl' \| '4xl'` | `'2xl'` | The bar's own width below which the links fold into the menu sheet: 2xl is 42rem, 4xl is 56rem. Pick the one at which the brand, every link and the actions still fit on one row with room to spare. |
|
|
29
30
|
| `className` | `string` | | Added to the root classes. Where two Tailwind utility classes clash, the later one wins. |
|
|
30
31
|
| `ref` | `Ref<HTMLElement>` | | The header element. |
|
|
31
32
|
|
|
@@ -34,7 +35,7 @@ Paths are from the Division DS repository root. Installed with shadcn they start
|
|
|
34
35
|
Exported beside the component, from the same file. Import a type with `import type { ... }`.
|
|
35
36
|
|
|
36
37
|
```ts
|
|
37
|
-
export type NavbarItem =
|
|
38
|
+
export type NavbarItem = NavbarLink | NavbarMenu
|
|
38
39
|
```
|
|
39
40
|
|
|
40
41
|
## Examples
|
|
@@ -77,6 +78,56 @@ const ACTIONS = (
|
|
|
77
78
|
<Navbar label="Store navigation" brand={BRAND} items={ITEMS} actions={ACTIONS} />
|
|
78
79
|
```
|
|
79
80
|
|
|
81
|
+
### A menu among the links
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
const ITEMS = [
|
|
85
|
+
{ label: 'Replicas', href: '#replicas' },
|
|
86
|
+
{ label: 'Optics', href: '#optics', current: true },
|
|
87
|
+
{ label: 'Parts', href: '#parts' },
|
|
88
|
+
{ label: 'Care', href: '#care' },
|
|
89
|
+
{ label: 'Field notes', href: '#field-notes' },
|
|
90
|
+
]
|
|
91
|
+
|
|
92
|
+
const BRAND = (
|
|
93
|
+
<a
|
|
94
|
+
href="#home"
|
|
95
|
+
className="inline-flex items-center min-h-10 font-display font-bold uppercase tracking-[0.14em] text-[var(--color-text-primary)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--color-focus-ring)]"
|
|
96
|
+
>
|
|
97
|
+
Hexline
|
|
98
|
+
</a>
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
const ACTIONS = (
|
|
102
|
+
<>
|
|
103
|
+
<IconButton label="Search" variant="ghost">
|
|
104
|
+
<Search aria-hidden="true" className="w-5 h-5" />
|
|
105
|
+
</IconButton>
|
|
106
|
+
<IconButton label="Cart, 2 items" variant="ghost" asChild>
|
|
107
|
+
<a href="#cart">
|
|
108
|
+
<ShoppingBag aria-hidden="true" className="w-5 h-5" />
|
|
109
|
+
</a>
|
|
110
|
+
</IconButton>
|
|
111
|
+
</>
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
<Navbar
|
|
115
|
+
label="Store navigation with a menu"
|
|
116
|
+
brand={BRAND}
|
|
117
|
+
items={[
|
|
118
|
+
...ITEMS.slice(0, 3),
|
|
119
|
+
{
|
|
120
|
+
label: 'Guides',
|
|
121
|
+
menu: [
|
|
122
|
+
{ label: 'Sizing', href: '#sizing', description: 'Fit charts for every replica.' },
|
|
123
|
+
{ label: 'Returns', href: '#returns', description: 'Thirty days, no questions.' },
|
|
124
|
+
],
|
|
125
|
+
},
|
|
126
|
+
]}
|
|
127
|
+
actions={ACTIONS}
|
|
128
|
+
/>
|
|
129
|
+
```
|
|
130
|
+
|
|
80
131
|
### A narrow container
|
|
81
132
|
|
|
82
133
|
```tsx
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Panel
|
|
2
|
+
|
|
3
|
+
> The system's framed surface: a thin border around a fill, with the crosshair corner marks and the cut corner as options. Card is a Panel with a title, body and footer; Panel is the frame alone, for a feature tile, a demo frame or a tile that is one link.
|
|
4
|
+
|
|
5
|
+
- **Best for:** Framing content that has no title, body and footer structure: a feature tile, a demo area, or a tile that is one link.
|
|
6
|
+
- **Not for:** Content with a title, a body and actions: use Card. A page-width layout wrapper: use a plain div with max-w-*.
|
|
7
|
+
- Atom. Source: `src/components/atoms/panel/Panel.tsx`
|
|
8
|
+
- Rendered docs page: `/components/panel`
|
|
9
|
+
|
|
10
|
+
## Import
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
import { Panel } from 'src/components/atoms/panel/Panel'
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Paths are from the Division DS repository root. Installed with shadcn they start `src/division-ds/` instead of `src/` (`src/division-ds/components/...`); import them relative to your file. An install has no index barrels: import each component from its own file, never from `components/molecules`.
|
|
17
|
+
|
|
18
|
+
## Props
|
|
19
|
+
|
|
20
|
+
| Prop | Type | Default | Description |
|
|
21
|
+
|---|---|---|---|
|
|
22
|
+
| `padding` | `'none' \| 'sm' \| 'md' \| 'lg'` | `'md'` | Inner spacing: 0, 12px, 20px or 32px. |
|
|
23
|
+
| `tone` | `'base' \| 'raised' \| 'signal'` | `'raised'` | base sits flush with the page, raised is one step up, signal is the brand wash for the one panel in a group that leads. |
|
|
24
|
+
| `crosshair` | `boolean` | `false` | Draws the crosshair marks at the corners. |
|
|
25
|
+
| `cut` | `boolean` | `false` | Cuts the bottom-right corner, with the border following the cut. |
|
|
26
|
+
| `interactive` | `boolean` | `false` | Hover and focus states for a panel that is one link or button. Use it with asChild; it adds no behaviour of its own. |
|
|
27
|
+
| `asChild` | `boolean` | `false` | Renders the single child element (an a, a router Link, a button) with the panel classes merged onto it, instead of a div. |
|
|
28
|
+
| `className` | `string` | | Merged with the component's classes. Use it for layout (a grid span, flex, gap), not for the fill or the border. |
|
|
29
|
+
| `ref` | `Ref<HTMLDivElement>` | | Passed through to the div, or to the child with asChild. |
|
|
30
|
+
| `...rest` | `HTMLAttributes<HTMLDivElement>` | | Every native attribute, passed onto the element. |
|
|
31
|
+
|
|
32
|
+
## Examples
|
|
33
|
+
|
|
34
|
+
Each is compiled and rendered on the docs page. Imports are omitted; see above.
|
|
35
|
+
|
|
36
|
+
### Tones
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
<Panel tone="base">
|
|
40
|
+
<p className="font-display font-semibold">Base</p>
|
|
41
|
+
<p className="text-sm text-[var(--color-text-secondary)]">Flush with the page.</p>
|
|
42
|
+
</Panel>
|
|
43
|
+
<Panel tone="raised">
|
|
44
|
+
<p className="font-display font-semibold">Raised</p>
|
|
45
|
+
<p className="text-sm text-[var(--color-text-secondary)]">One step up.</p>
|
|
46
|
+
</Panel>
|
|
47
|
+
<Panel tone="signal">
|
|
48
|
+
<p className="font-display font-semibold">Signal</p>
|
|
49
|
+
<p className="text-sm text-[var(--color-text-secondary)]">The one that leads.</p>
|
|
50
|
+
</Panel>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Padding
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
<Panel padding="none">none</Panel>
|
|
57
|
+
<Panel padding="sm">sm</Panel>
|
|
58
|
+
<Panel padding="md">md</Panel>
|
|
59
|
+
<Panel padding="lg">lg</Panel>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Crosshair and cut corner
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
<Panel crosshair>Crosshair</Panel>
|
|
66
|
+
<Panel cut>Cut corner</Panel>
|
|
67
|
+
<Panel crosshair cut tone="signal">Both</Panel>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Interactive, as a router link
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
<Panel interactive cut padding="lg" asChild>
|
|
74
|
+
<RouterLink to="/components/card" className="flex flex-col gap-3">
|
|
75
|
+
<span className="font-display text-lg font-semibold">Card</span>
|
|
76
|
+
<span className="text-sm text-[var(--color-text-secondary)]">A panel with a title, a body and a footer.</span>
|
|
77
|
+
<span className="inline-flex items-center gap-2 font-semibold text-[var(--color-accent-signal-text)]">
|
|
78
|
+
Open <ArrowRight aria-hidden="true" className="size-4" />
|
|
79
|
+
</span>
|
|
80
|
+
</RouterLink>
|
|
81
|
+
</Panel>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Keyboard
|
|
85
|
+
|
|
86
|
+
| Keys | Result |
|
|
87
|
+
|---|---|
|
|
88
|
+
| `Tab` | With interactive and asChild on a link or button: moves focus to the panel and shows the focus ring. |
|
|
89
|
+
| `Enter` | Follows the link, or presses the button, that the panel was rendered as. |
|
|
90
|
+
|
|
91
|
+
## Do
|
|
92
|
+
|
|
93
|
+
- Use signal on at most one panel in a group: the one that leads.
|
|
94
|
+
- Give a clickable panel interactive and asChild, with a real link or button as the child.
|
|
95
|
+
- Leave 8px around a panel with the crosshair, so a parent that clips does not cut the marks off.
|
|
96
|
+
|
|
97
|
+
## Don't
|
|
98
|
+
|
|
99
|
+
- Don’t put a button near the bottom-right corner of a cut panel; the cut can clip it.
|
|
100
|
+
- Don’t set a fill or border colour with a class. Choose a tone.
|
|
101
|
+
- Don’t put a second link or button inside an interactive panel.
|
|
102
|
+
|
|
103
|
+
## Common mistakes
|
|
104
|
+
|
|
105
|
+
Wrong:
|
|
106
|
+
|
|
107
|
+
```tsx
|
|
108
|
+
<Panel className="bg-[var(--color-surface-base)] border-[var(--color-border-selection)]">
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Right:
|
|
112
|
+
|
|
113
|
+
```tsx
|
|
114
|
+
<Panel tone="base">
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
The panel's fill and border come from its tone, through CSS that sits outside Tailwind's layers, so a bg- or border- class never wins. Pick the tone.
|
|
118
|
+
|
|
119
|
+
Wrong:
|
|
120
|
+
|
|
121
|
+
```tsx
|
|
122
|
+
<Panel interactive onClick={open}>Replicas</Panel>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Right:
|
|
126
|
+
|
|
127
|
+
```tsx
|
|
128
|
+
<Panel interactive asChild><Link to="/replicas">Replicas</Link></Panel>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
A div with a click handler cannot be reached by keyboard and is not announced as a link. interactive styles a panel that already is a link or a button; asChild makes it one.
|
|
132
|
+
|
|
133
|
+
## Anatomy
|
|
134
|
+
|
|
135
|
+
- **Frame**: A div (or, with asChild, your element) with the .panel class: a one-pixel border and a fill, both set by the tone.
|
|
136
|
+
- **Tone**: base: surface.base fill, border.hairline border. raised: surface.raised fill, border.hairline border. signal: accent.signal.wash fill, border.selection border. All tokens, so each one is right in both themes.
|
|
137
|
+
- **Crosshair**: Optional. Short marks drawn 5px outside each corner, in text.muted. The parent must not clip its overflow.
|
|
138
|
+
- **Cut corner**: Optional. The bottom-right corner cut at 45 degrees (14px), with the border drawn along the cut, so the outline does not break at that corner. With the crosshair on, the bottom-right marks fall inside the cut and are not drawn.
|
|
139
|
+
- **Interactive state**: Optional. On hover and on keyboard focus the border, diagonal included, turns accent.signal.indicator; keyboard focus also draws the focus ring 2px outside. Nothing moves.
|
|
@@ -23,7 +23,7 @@ Paths are from the Division DS repository root. Installed with shadcn they start
|
|
|
23
23
|
| `value` | `number \| null` | | null means indeterminate. The value is clamped to [0, max], so an out-of-range value shows as complete instead of overflowing the track. |
|
|
24
24
|
| `max` | `number` | `100` | The value at which the bar is complete. |
|
|
25
25
|
| `showValue` | `boolean` | `false` | Shows the percentage (or "In progress") as a readout. |
|
|
26
|
-
| `tone` | `'signal' \| 'ok' \| 'warning' \| 'hostile'` | `'signal'` | The fill colour. signal paints accent.signal.indicator to match Slider. On the track in light theme that’s a 2.
|
|
26
|
+
| `tone` | `'signal' \| 'ok' \| 'warning' \| 'hostile'` | `'signal'` | The fill colour. signal paints accent.signal.indicator to match Slider. On the track in light theme that’s a 2.80:1 contrast ratio, below the 3:1 a bar needs when it’s the only sign of progress. So set showValue there. |
|
|
27
27
|
| `className` | `string` | | Merged with the outer wrapper’s classes. Later Tailwind utilities (Tailwind is the CSS framework the system is styled with) win. |
|
|
28
28
|
| `ref` | `Ref<HTMLDivElement>` | | Passed through to the Radix Progress root, which is the bar itself. Radix is the library of accessible building blocks this component sits on. |
|
|
29
29
|
| `...rest` | `Omit<HTMLAttributes<HTMLDivElement>, 'children'>` | | Every native div prop except children, spread onto the outer wrapper, so a molecule can attach a data-testid there. children is typed away because this component draws its own label row and track, and a children prop would be thrown away without any warning. |
|
|
@@ -1231,6 +1231,18 @@
|
|
|
1231
1231
|
"type": "ReactNode",
|
|
1232
1232
|
"description": "The key's name, for example \"Esc\" or \"⌘\"."
|
|
1233
1233
|
},
|
|
1234
|
+
{
|
|
1235
|
+
"name": "size",
|
|
1236
|
+
"type": "'md' | 'sm'",
|
|
1237
|
+
"default": "'md'",
|
|
1238
|
+
"description": "md is 24px tall, for a cap beside text or in a menu row. sm is 20px tall, for a cap inside a 32px control: a small Button or a search field."
|
|
1239
|
+
},
|
|
1240
|
+
{
|
|
1241
|
+
"name": "cut",
|
|
1242
|
+
"type": "boolean",
|
|
1243
|
+
"default": "false",
|
|
1244
|
+
"description": "Cuts the bottom-right corner (5px at sm, 8px at md) so the cap nests in the corner of a bevelled control, its diagonal parallel to the control's. Only for a cap inside such a control."
|
|
1245
|
+
},
|
|
1234
1246
|
{
|
|
1235
1247
|
"name": "className",
|
|
1236
1248
|
"type": "string",
|
|
@@ -1251,10 +1263,11 @@
|
|
|
1251
1263
|
"dos": [
|
|
1252
1264
|
"Use one Kbd per physical key, and put them side by side for a chord (keys pressed together).",
|
|
1253
1265
|
"Put it next to the action it triggers, in the same row or the same tooltip.",
|
|
1254
|
-
"Write the key name the way the keyboard prints it."
|
|
1266
|
+
"Write the key name the way the keyboard prints it.",
|
|
1267
|
+
"Inside a 32px control, use size=\"sm\"; inside a bevelled one (a Button), add cut and place the cap at the end, near the cut corner."
|
|
1255
1268
|
],
|
|
1256
1269
|
"donts": [
|
|
1257
|
-
"Don’t
|
|
1270
|
+
"Don’t set cut on a cap that stands alone in text or a menu row. The cut answers a bevelled corner around it; without one it reads as a button.",
|
|
1258
1271
|
"Don’t put a whole chord inside one Kbd (\"Ctrl+K\" in a single cap).",
|
|
1259
1272
|
"Don’t use it for anything that isn’t a key. It’s not a badge."
|
|
1260
1273
|
],
|
|
@@ -1265,11 +1278,11 @@
|
|
|
1265
1278
|
},
|
|
1266
1279
|
{
|
|
1267
1280
|
"part": "Hairline border",
|
|
1268
|
-
"description": "A one-pixel border in border.hairline-strong
|
|
1281
|
+
"description": "A one-pixel border in border.hairline-strong. Square corners by default; with cut, the bottom-right corner is cut at 45 degrees and the border follows the diagonal."
|
|
1269
1282
|
},
|
|
1270
1283
|
{
|
|
1271
1284
|
"part": "Mono legend",
|
|
1272
|
-
"description": "JetBrains Mono, uppercase, 11px (pixels): the tertiary type role."
|
|
1285
|
+
"description": "JetBrains Mono, uppercase, 11px (pixels): the tertiary type role, at both sizes."
|
|
1273
1286
|
}
|
|
1274
1287
|
],
|
|
1275
1288
|
"examples": [
|
|
@@ -1280,6 +1293,14 @@
|
|
|
1280
1293
|
{
|
|
1281
1294
|
"caption": "A chord: one cap per key",
|
|
1282
1295
|
"source": "<span className=\"flex items-center gap-1\">\n <Kbd>Ctrl</Kbd>\n <span className=\"text-[var(--color-text-muted)] text-sm\">+</span>\n <Kbd>K</Kbd>\n</span>\n<span className=\"text-sm text-[var(--color-text-secondary)]\">Open the command palette</span>"
|
|
1296
|
+
},
|
|
1297
|
+
{
|
|
1298
|
+
"caption": "Sizes",
|
|
1299
|
+
"source": "<Kbd>Esc</Kbd>\n<Kbd size=\"sm\">Esc</Kbd>"
|
|
1300
|
+
},
|
|
1301
|
+
{
|
|
1302
|
+
"caption": "Small and cut, inside a small button",
|
|
1303
|
+
"source": "<Button variant=\"secondary\" size=\"sm\" iconStart={<Search />} aria-keyshortcuts=\"Control+K\">\n Search\n <Kbd aria-hidden=\"true\" size=\"sm\" cut className=\"-mr-1.5 ml-2 -translate-y-[var(--cap-shift,0px)]\">\n Ctrl K\n </Kbd>\n</Button>"
|
|
1283
1304
|
}
|
|
1284
1305
|
],
|
|
1285
1306
|
"closed": false
|
|
@@ -1503,6 +1524,155 @@
|
|
|
1503
1524
|
],
|
|
1504
1525
|
"closed": false
|
|
1505
1526
|
},
|
|
1527
|
+
{
|
|
1528
|
+
"name": "Panel",
|
|
1529
|
+
"title": "Panel",
|
|
1530
|
+
"tier": "atoms",
|
|
1531
|
+
"slug": "panel",
|
|
1532
|
+
"summary": "The system's framed surface: a thin border around a fill, with the crosshair corner marks and the cut corner as options. Card is a Panel with a title, body and footer; Panel is the frame alone, for a feature tile, a demo frame or a tile that is one link.",
|
|
1533
|
+
"useWhen": "Framing content that has no title, body and footer structure: a feature tile, a demo area, or a tile that is one link.",
|
|
1534
|
+
"notFor": "Content with a title, a body and actions: use Card. A page-width layout wrapper: use a plain div with max-w-*.",
|
|
1535
|
+
"source": "src/components/atoms/panel/Panel.tsx",
|
|
1536
|
+
"docs": "/docs/components/panel.md",
|
|
1537
|
+
"imports": [
|
|
1538
|
+
{
|
|
1539
|
+
"names": [
|
|
1540
|
+
"Panel"
|
|
1541
|
+
],
|
|
1542
|
+
"from": "src/components/atoms/panel/Panel"
|
|
1543
|
+
}
|
|
1544
|
+
],
|
|
1545
|
+
"props": [
|
|
1546
|
+
{
|
|
1547
|
+
"name": "padding",
|
|
1548
|
+
"type": "'none' | 'sm' | 'md' | 'lg'",
|
|
1549
|
+
"default": "'md'",
|
|
1550
|
+
"description": "Inner spacing: 0, 12px, 20px or 32px."
|
|
1551
|
+
},
|
|
1552
|
+
{
|
|
1553
|
+
"name": "tone",
|
|
1554
|
+
"type": "'base' | 'raised' | 'signal'",
|
|
1555
|
+
"default": "'raised'",
|
|
1556
|
+
"description": "base sits flush with the page, raised is one step up, signal is the brand wash for the one panel in a group that leads."
|
|
1557
|
+
},
|
|
1558
|
+
{
|
|
1559
|
+
"name": "crosshair",
|
|
1560
|
+
"type": "boolean",
|
|
1561
|
+
"default": "false",
|
|
1562
|
+
"description": "Draws the crosshair marks at the corners."
|
|
1563
|
+
},
|
|
1564
|
+
{
|
|
1565
|
+
"name": "cut",
|
|
1566
|
+
"type": "boolean",
|
|
1567
|
+
"default": "false",
|
|
1568
|
+
"description": "Cuts the bottom-right corner, with the border following the cut."
|
|
1569
|
+
},
|
|
1570
|
+
{
|
|
1571
|
+
"name": "interactive",
|
|
1572
|
+
"type": "boolean",
|
|
1573
|
+
"default": "false",
|
|
1574
|
+
"description": "Hover and focus states for a panel that is one link or button. Use it with asChild; it adds no behaviour of its own."
|
|
1575
|
+
},
|
|
1576
|
+
{
|
|
1577
|
+
"name": "asChild",
|
|
1578
|
+
"type": "boolean",
|
|
1579
|
+
"default": "false",
|
|
1580
|
+
"description": "Renders the single child element (an a, a router Link, a button) with the panel classes merged onto it, instead of a div."
|
|
1581
|
+
},
|
|
1582
|
+
{
|
|
1583
|
+
"name": "className",
|
|
1584
|
+
"type": "string",
|
|
1585
|
+
"description": "Merged with the component's classes. Use it for layout (a grid span, flex, gap), not for the fill or the border."
|
|
1586
|
+
},
|
|
1587
|
+
{
|
|
1588
|
+
"name": "ref",
|
|
1589
|
+
"type": "Ref<HTMLDivElement>",
|
|
1590
|
+
"description": "Passed through to the div, or to the child with asChild."
|
|
1591
|
+
},
|
|
1592
|
+
{
|
|
1593
|
+
"name": "...rest",
|
|
1594
|
+
"type": "HTMLAttributes<HTMLDivElement>",
|
|
1595
|
+
"description": "Every native attribute, passed onto the element."
|
|
1596
|
+
}
|
|
1597
|
+
],
|
|
1598
|
+
"keyboard": [
|
|
1599
|
+
{
|
|
1600
|
+
"keys": [
|
|
1601
|
+
"Tab"
|
|
1602
|
+
],
|
|
1603
|
+
"does": "With interactive and asChild on a link or button: moves focus to the panel and shows the focus ring."
|
|
1604
|
+
},
|
|
1605
|
+
{
|
|
1606
|
+
"keys": [
|
|
1607
|
+
"Enter"
|
|
1608
|
+
],
|
|
1609
|
+
"does": "Follows the link, or presses the button, that the panel was rendered as."
|
|
1610
|
+
}
|
|
1611
|
+
],
|
|
1612
|
+
"dos": [
|
|
1613
|
+
"Use signal on at most one panel in a group: the one that leads.",
|
|
1614
|
+
"Give a clickable panel interactive and asChild, with a real link or button as the child.",
|
|
1615
|
+
"Leave 8px around a panel with the crosshair, so a parent that clips does not cut the marks off."
|
|
1616
|
+
],
|
|
1617
|
+
"donts": [
|
|
1618
|
+
"Don’t put a button near the bottom-right corner of a cut panel; the cut can clip it.",
|
|
1619
|
+
"Don’t set a fill or border colour with a class. Choose a tone.",
|
|
1620
|
+
"Don’t put a second link or button inside an interactive panel."
|
|
1621
|
+
],
|
|
1622
|
+
"pitfalls": [
|
|
1623
|
+
{
|
|
1624
|
+
"wrong": "<Panel className=\"bg-[var(--color-surface-base)] border-[var(--color-border-selection)]\">",
|
|
1625
|
+
"right": "<Panel tone=\"base\">",
|
|
1626
|
+
"why": "The panel's fill and border come from its tone, through CSS that sits outside Tailwind's layers, so a bg- or border- class never wins. Pick the tone."
|
|
1627
|
+
},
|
|
1628
|
+
{
|
|
1629
|
+
"wrong": "<Panel interactive onClick={open}>Replicas</Panel>",
|
|
1630
|
+
"right": "<Panel interactive asChild><Link to=\"/replicas\">Replicas</Link></Panel>",
|
|
1631
|
+
"why": "A div with a click handler cannot be reached by keyboard and is not announced as a link. interactive styles a panel that already is a link or a button; asChild makes it one."
|
|
1632
|
+
}
|
|
1633
|
+
],
|
|
1634
|
+
"anatomy": [
|
|
1635
|
+
{
|
|
1636
|
+
"part": "Frame",
|
|
1637
|
+
"description": "A div (or, with asChild, your element) with the .panel class: a one-pixel border and a fill, both set by the tone."
|
|
1638
|
+
},
|
|
1639
|
+
{
|
|
1640
|
+
"part": "Tone",
|
|
1641
|
+
"description": "base: surface.base fill, border.hairline border. raised: surface.raised fill, border.hairline border. signal: accent.signal.wash fill, border.selection border. All tokens, so each one is right in both themes."
|
|
1642
|
+
},
|
|
1643
|
+
{
|
|
1644
|
+
"part": "Crosshair",
|
|
1645
|
+
"description": "Optional. Short marks drawn 5px outside each corner, in text.muted. The parent must not clip its overflow."
|
|
1646
|
+
},
|
|
1647
|
+
{
|
|
1648
|
+
"part": "Cut corner",
|
|
1649
|
+
"description": "Optional. The bottom-right corner cut at 45 degrees (14px), with the border drawn along the cut, so the outline does not break at that corner. With the crosshair on, the bottom-right marks fall inside the cut and are not drawn."
|
|
1650
|
+
},
|
|
1651
|
+
{
|
|
1652
|
+
"part": "Interactive state",
|
|
1653
|
+
"description": "Optional. On hover and on keyboard focus the border, diagonal included, turns accent.signal.indicator; keyboard focus also draws the focus ring 2px outside. Nothing moves."
|
|
1654
|
+
}
|
|
1655
|
+
],
|
|
1656
|
+
"examples": [
|
|
1657
|
+
{
|
|
1658
|
+
"caption": "Tones",
|
|
1659
|
+
"source": "<Panel tone=\"base\">\n <p className=\"font-display font-semibold\">Base</p>\n <p className=\"text-sm text-[var(--color-text-secondary)]\">Flush with the page.</p>\n</Panel>\n<Panel tone=\"raised\">\n <p className=\"font-display font-semibold\">Raised</p>\n <p className=\"text-sm text-[var(--color-text-secondary)]\">One step up.</p>\n</Panel>\n<Panel tone=\"signal\">\n <p className=\"font-display font-semibold\">Signal</p>\n <p className=\"text-sm text-[var(--color-text-secondary)]\">The one that leads.</p>\n</Panel>"
|
|
1660
|
+
},
|
|
1661
|
+
{
|
|
1662
|
+
"caption": "Padding",
|
|
1663
|
+
"source": "<Panel padding=\"none\">none</Panel>\n<Panel padding=\"sm\">sm</Panel>\n<Panel padding=\"md\">md</Panel>\n<Panel padding=\"lg\">lg</Panel>"
|
|
1664
|
+
},
|
|
1665
|
+
{
|
|
1666
|
+
"caption": "Crosshair and cut corner",
|
|
1667
|
+
"source": "<Panel crosshair>Crosshair</Panel>\n<Panel cut>Cut corner</Panel>\n<Panel crosshair cut tone=\"signal\">Both</Panel>"
|
|
1668
|
+
},
|
|
1669
|
+
{
|
|
1670
|
+
"caption": "Interactive, as a router link",
|
|
1671
|
+
"source": "<Panel interactive cut padding=\"lg\" asChild>\n <RouterLink to=\"/components/card\" className=\"flex flex-col gap-3\">\n <span className=\"font-display text-lg font-semibold\">Card</span>\n <span className=\"text-sm text-[var(--color-text-secondary)]\">A panel with a title, a body and a footer.</span>\n <span className=\"inline-flex items-center gap-2 font-semibold text-[var(--color-accent-signal-text)]\">\n Open <ArrowRight aria-hidden=\"true\" className=\"size-4\" />\n </span>\n </RouterLink>\n</Panel>"
|
|
1672
|
+
}
|
|
1673
|
+
],
|
|
1674
|
+
"closed": false
|
|
1675
|
+
},
|
|
1506
1676
|
{
|
|
1507
1677
|
"name": "Progress",
|
|
1508
1678
|
"title": "Progress",
|
|
@@ -1548,7 +1718,7 @@
|
|
|
1548
1718
|
"name": "tone",
|
|
1549
1719
|
"type": "'signal' | 'ok' | 'warning' | 'hostile'",
|
|
1550
1720
|
"default": "'signal'",
|
|
1551
|
-
"description": "The fill colour. signal paints accent.signal.indicator to match Slider. On the track in light theme that’s a 2.
|
|
1721
|
+
"description": "The fill colour. signal paints accent.signal.indicator to match Slider. On the track in light theme that’s a 2.80:1 contrast ratio, below the 3:1 a bar needs when it’s the only sign of progress. So set showValue there."
|
|
1552
1722
|
},
|
|
1553
1723
|
{
|
|
1554
1724
|
"name": "className",
|
|
@@ -4373,6 +4543,153 @@
|
|
|
4373
4543
|
],
|
|
4374
4544
|
"closed": true
|
|
4375
4545
|
},
|
|
4546
|
+
{
|
|
4547
|
+
"name": "CodeBlock",
|
|
4548
|
+
"title": "Code block",
|
|
4549
|
+
"tier": "molecules",
|
|
4550
|
+
"slug": "code-block",
|
|
4551
|
+
"summary": "Code or a command in a panel, with a title bar that names the file or language and a button that copies the text. Long lines scroll sideways inside it, and code longer than one line gets line numbers.",
|
|
4552
|
+
"useWhen": "Showing code or a command someone will read or copy: an install step, a config file, an example.",
|
|
4553
|
+
"notFor": "A word of code inside a sentence: use a code element. A key to press: use Kbd.",
|
|
4554
|
+
"source": "src/components/molecules/code-block/CodeBlock.tsx",
|
|
4555
|
+
"docs": "/docs/components/code-block.md",
|
|
4556
|
+
"imports": [
|
|
4557
|
+
{
|
|
4558
|
+
"names": [
|
|
4559
|
+
"CodeBlock"
|
|
4560
|
+
],
|
|
4561
|
+
"from": "src/components/molecules/code-block/CodeBlock"
|
|
4562
|
+
}
|
|
4563
|
+
],
|
|
4564
|
+
"requires": [
|
|
4565
|
+
"The app’s one Toaster at the root: the copy is confirmed with a toast."
|
|
4566
|
+
],
|
|
4567
|
+
"props": [
|
|
4568
|
+
{
|
|
4569
|
+
"name": "code",
|
|
4570
|
+
"type": "string",
|
|
4571
|
+
"description": "The text shown and copied, exactly."
|
|
4572
|
+
},
|
|
4573
|
+
{
|
|
4574
|
+
"name": "label",
|
|
4575
|
+
"type": "string",
|
|
4576
|
+
"description": "What the code is, in a few words (\"the theme CSS\"). Names the region and the copy button (\"Copy the theme CSS\")."
|
|
4577
|
+
},
|
|
4578
|
+
{
|
|
4579
|
+
"name": "title",
|
|
4580
|
+
"type": "string",
|
|
4581
|
+
"description": "Shown in the title bar: a file name (\"index.css\") or a language (\"bash\")."
|
|
4582
|
+
},
|
|
4583
|
+
{
|
|
4584
|
+
"name": "language",
|
|
4585
|
+
"type": "'css' | 'text'",
|
|
4586
|
+
"default": "'text'",
|
|
4587
|
+
"description": "css colours comments, at-rules, selectors and property names; text is plain."
|
|
4588
|
+
},
|
|
4589
|
+
{
|
|
4590
|
+
"name": "lineNumbers",
|
|
4591
|
+
"type": "boolean",
|
|
4592
|
+
"description": "Line numbers in a gutter. Unset, they show when the code has more than one line."
|
|
4593
|
+
},
|
|
4594
|
+
{
|
|
4595
|
+
"name": "copyable",
|
|
4596
|
+
"type": "boolean",
|
|
4597
|
+
"default": "true",
|
|
4598
|
+
"description": "The copy button. Turn it off for code nobody should paste, such as a wrong example."
|
|
4599
|
+
},
|
|
4600
|
+
{
|
|
4601
|
+
"name": "wrap",
|
|
4602
|
+
"type": "boolean",
|
|
4603
|
+
"default": "false",
|
|
4604
|
+
"description": "Wraps long lines instead of scrolling them sideways. For prose, such as a prompt; leave code unwrapped."
|
|
4605
|
+
},
|
|
4606
|
+
{
|
|
4607
|
+
"name": "className",
|
|
4608
|
+
"type": "string",
|
|
4609
|
+
"description": "Merged onto the frame. Use it for width (max-w-3xl) and spacing."
|
|
4610
|
+
},
|
|
4611
|
+
{
|
|
4612
|
+
"name": "ref",
|
|
4613
|
+
"type": "Ref<HTMLDivElement>",
|
|
4614
|
+
"description": "Passed through to the frame."
|
|
4615
|
+
}
|
|
4616
|
+
],
|
|
4617
|
+
"keyboard": [
|
|
4618
|
+
{
|
|
4619
|
+
"keys": [
|
|
4620
|
+
"Tab"
|
|
4621
|
+
],
|
|
4622
|
+
"does": "Moves to the copy button, then to the code region."
|
|
4623
|
+
},
|
|
4624
|
+
{
|
|
4625
|
+
"keys": [
|
|
4626
|
+
"←",
|
|
4627
|
+
"→"
|
|
4628
|
+
],
|
|
4629
|
+
"does": "In the focused code region: scrolls a long line sideways."
|
|
4630
|
+
},
|
|
4631
|
+
{
|
|
4632
|
+
"keys": [
|
|
4633
|
+
"Enter"
|
|
4634
|
+
],
|
|
4635
|
+
"does": "On the copy button: copies the code."
|
|
4636
|
+
}
|
|
4637
|
+
],
|
|
4638
|
+
"dos": [
|
|
4639
|
+
"Write a label that says what the code is, so the copy button reads \"Copy the install command\".",
|
|
4640
|
+
"Give it a title: the file name it belongs in, or the language.",
|
|
4641
|
+
"Set a max width with className; long lines scroll inside it, so it never widens the page."
|
|
4642
|
+
],
|
|
4643
|
+
"donts": [
|
|
4644
|
+
"Don’t put several unrelated commands in one block. One block per thing to copy.",
|
|
4645
|
+
"Don’t set copyable on an example of what not to write.",
|
|
4646
|
+
"Don’t wrap it in another bordered panel; it brings its own frame."
|
|
4647
|
+
],
|
|
4648
|
+
"pitfalls": [
|
|
4649
|
+
{
|
|
4650
|
+
"wrong": "<pre className=\"font-mono text-sm\">{command}</pre>",
|
|
4651
|
+
"right": "<CodeBlock code={command} label=\"the install command\" title=\"bash\" />",
|
|
4652
|
+
"why": "A bare pre has no copy button, no name, and cannot be scrolled with a keyboard when a line runs past the edge."
|
|
4653
|
+
}
|
|
4654
|
+
],
|
|
4655
|
+
"anatomy": [
|
|
4656
|
+
{
|
|
4657
|
+
"part": "Frame",
|
|
4658
|
+
"description": "A thin border around a surface.base fill. The syntax colours are measured for contrast on surface.base."
|
|
4659
|
+
},
|
|
4660
|
+
{
|
|
4661
|
+
"part": "Title bar",
|
|
4662
|
+
"description": "The title on the left, in 12px uppercase mono, and the copy button on the right, above a thin line."
|
|
4663
|
+
},
|
|
4664
|
+
{
|
|
4665
|
+
"part": "Code region",
|
|
4666
|
+
"description": "A pre with role region, named by the title and the label, focusable so a keyboard can scroll it. Up to 32rem tall, then it scrolls."
|
|
4667
|
+
},
|
|
4668
|
+
{
|
|
4669
|
+
"part": "Line numbers",
|
|
4670
|
+
"description": "A gutter in text.muted, hidden from screen readers and from text selection."
|
|
4671
|
+
},
|
|
4672
|
+
{
|
|
4673
|
+
"part": "Copy button",
|
|
4674
|
+
"description": "An IconButton named \"Copy\" plus the label. After copying, its icon turns into a tick for a moment and a toast confirms it."
|
|
4675
|
+
}
|
|
4676
|
+
],
|
|
4677
|
+
"examples": [
|
|
4678
|
+
{
|
|
4679
|
+
"caption": "A command",
|
|
4680
|
+
"source": "<CodeBlock title=\"bash\" label=\"the check command\" code=\"npx division-ds check src\" className=\"max-w-3xl\" />"
|
|
4681
|
+
},
|
|
4682
|
+
{
|
|
4683
|
+
"caption": "A file, with CSS colours and line numbers",
|
|
4684
|
+
"source": "<CodeBlock\n title=\"index.css\"\n language=\"css\"\n label=\"the theme CSS\"\n className=\"max-w-3xl\"\n code={'@import \"./division-ds/styles/division-ds.css\";\\n\\n/* Square corners */\\n:root {\\n --shape-bevel: 0;\\n --shape-radius: 4px;\\n}\\n'}\n/>"
|
|
4685
|
+
},
|
|
4686
|
+
{
|
|
4687
|
+
"caption": "Not copyable, for code nobody should paste",
|
|
4688
|
+
"source": "<CodeBlock title=\"Wrong\" label=\"a bare pre\" copyable={false} code={'<pre>{command}</pre>'} className=\"max-w-3xl\" />"
|
|
4689
|
+
}
|
|
4690
|
+
],
|
|
4691
|
+
"closed": true
|
|
4692
|
+
},
|
|
4376
4693
|
{
|
|
4377
4694
|
"name": "DatePicker",
|
|
4378
4695
|
"title": "Date picker",
|
|
@@ -5222,6 +5539,12 @@
|
|
|
5222
5539
|
"default": "'default'",
|
|
5223
5540
|
"description": "Use hostile for a destructive action: hostile-coloured text at rest, the hostile fill with ink text when highlighted."
|
|
5224
5541
|
},
|
|
5542
|
+
{
|
|
5543
|
+
"name": "asChild (Item)",
|
|
5544
|
+
"type": "boolean",
|
|
5545
|
+
"default": "false",
|
|
5546
|
+
"description": "Makes the one child (a link) the item, for a menu of links. icon and shortcut are ignored then; put the content inside the link."
|
|
5547
|
+
},
|
|
5225
5548
|
{
|
|
5226
5549
|
"name": "icon (Item)",
|
|
5227
5550
|
"type": "ReactNode",
|
|
@@ -9547,7 +9870,7 @@
|
|
|
9547
9870
|
"examples": [
|
|
9548
9871
|
{
|
|
9549
9872
|
"caption": "Line, two series",
|
|
9550
|
-
"source": "type Week = { week: string; online: number; store: number }\n\nconst WEEKS: Week[] = [\n { week: 'W1', online:
|
|
9873
|
+
"source": "type Week = { week: string; online: number; store: number }\n\nconst WEEKS: Week[] = [\n { week: 'W1', online: 118, store: 150 },\n { week: 'W2', online: 149, store: 172 },\n { week: 'W3', online: 168, store: 158 },\n { week: 'W4', online: 141, store: 131 },\n { week: 'W5', online: 126, store: 128 },\n { week: 'W6', online: 174, store: 150 },\n { week: 'W7', online: 231, store: 141 },\n { week: 'W8', online: 183, store: 122 },\n { week: 'W9', online: 139, store: 149 },\n { week: 'W10', online: 162, store: 185 },\n { week: 'W11', online: 196, store: 163 },\n { week: 'W12', online: 170, store: 140 },\n]\n\n<ChartPanel<Week>\n title=\"Weekly orders\"\n summary=\"Online orders peaked three times in twelve weeks, highest at 231 in week 7; in-store orders peaked highest at 185 in week 10.\"\n kind=\"line\"\n area\n curve=\"smooth\"\n data={WEEKS}\n xKey=\"week\"\n xLabel=\"Week\"\n series={[\n { key: 'online', label: 'Online' },\n { key: 'store', label: 'In store' },\n ]}\n headingLevel={4}\n/>"
|
|
9551
9874
|
},
|
|
9552
9875
|
{
|
|
9553
9876
|
"caption": "Bar, one series",
|
|
@@ -9555,11 +9878,11 @@
|
|
|
9555
9878
|
},
|
|
9556
9879
|
{
|
|
9557
9880
|
"caption": "Area under a smooth line",
|
|
9558
|
-
"source": "type Day = { day: string; visits: number; orders: number }\n\nconst DAYS: Day[] = [\n { day: 'Mon', visits: 1840, orders: 61 },\n { day: 'Tue', visits:
|
|
9881
|
+
"source": "type Day = { day: string; visits: number; orders: number }\n\nconst DAYS: Day[] = [\n { day: 'Mon', visits: 1840, orders: 61 },\n { day: 'Tue', visits: 2960, orders: 104 },\n { day: 'Wed', visits: 2210, orders: 74 },\n { day: 'Thu', visits: 1720, orders: 55 },\n { day: 'Fri', visits: 2650, orders: 92 },\n { day: 'Sat', visits: 3890, orders: 141 },\n { day: 'Sun', visits: 3120, orders: 118 },\n]\n\n<ChartPanel<Day>\n title=\"Visits this week\"\n summary=\"Visits peaked on Tuesday at 2,960, fell to a Thursday low of 1,720, then peaked higher on Saturday at 3,890.\"\n kind=\"line\"\n area\n curve=\"smooth\"\n data={DAYS}\n xKey=\"day\"\n xLabel=\"Day\"\n series={[{ key: 'visits', label: 'Visits' }]}\n headline=\"18,390\"\n headingLevel={4}\n/>"
|
|
9559
9882
|
},
|
|
9560
9883
|
{
|
|
9561
9884
|
"caption": "No grid lines: only the labels along the axes",
|
|
9562
|
-
"source": "type Week = { week: string; online: number; store: number }\n\nconst WEEKS: Week[] = [\n { week: 'W1', online:
|
|
9885
|
+
"source": "type Week = { week: string; online: number; store: number }\n\nconst WEEKS: Week[] = [\n { week: 'W1', online: 118, store: 150 },\n { week: 'W2', online: 149, store: 172 },\n { week: 'W3', online: 168, store: 158 },\n { week: 'W4', online: 141, store: 131 },\n { week: 'W5', online: 126, store: 128 },\n { week: 'W6', online: 174, store: 150 },\n { week: 'W7', online: 231, store: 141 },\n { week: 'W8', online: 183, store: 122 },\n { week: 'W9', online: 139, store: 149 },\n { week: 'W10', online: 162, store: 185 },\n { week: 'W11', online: 196, store: 163 },\n { week: 'W12', online: 170, store: 140 },\n]\n\n<ChartPanel<Week>\n title=\"Weekly orders, gridless\"\n summary=\"Online orders peaked three times in twelve weeks, highest at 231 in week 7; in-store orders peaked highest at 185 in week 10.\"\n kind=\"line\"\n area\n curve=\"smooth\"\n grid={false}\n data={WEEKS}\n xKey=\"week\"\n xLabel=\"Week\"\n series={[\n { key: 'online', label: 'Online' },\n { key: 'store', label: 'In store' },\n ]}\n headingLevel={4}\n/>"
|
|
9563
9886
|
},
|
|
9564
9887
|
{
|
|
9565
9888
|
"caption": "A shaded band: night hours on a 24-hour series (the band wraps past midnight)",
|
|
@@ -9567,7 +9890,7 @@
|
|
|
9567
9890
|
},
|
|
9568
9891
|
{
|
|
9569
9892
|
"caption": "Small: stat cards, each with a sparkline (a tiny line chart with no axes)",
|
|
9570
|
-
"source": "type Week = { week: string; online: number; store: number }\n\ntype Day = { day: string; visits: number; orders: number }\n\nconst WEEKS: Week[] = [\n { week: 'W1', online:
|
|
9893
|
+
"source": "type Week = { week: string; online: number; store: number }\n\ntype Day = { day: string; visits: number; orders: number }\n\nconst WEEKS: Week[] = [\n { week: 'W1', online: 118, store: 150 },\n { week: 'W2', online: 149, store: 172 },\n { week: 'W3', online: 168, store: 158 },\n { week: 'W4', online: 141, store: 131 },\n { week: 'W5', online: 126, store: 128 },\n { week: 'W6', online: 174, store: 150 },\n { week: 'W7', online: 231, store: 141 },\n { week: 'W8', online: 183, store: 122 },\n { week: 'W9', online: 139, store: 149 },\n { week: 'W10', online: 162, store: 185 },\n { week: 'W11', online: 196, store: 163 },\n { week: 'W12', online: 170, store: 140 },\n]\n\nconst DAYS: Day[] = [\n { day: 'Mon', visits: 1840, orders: 61 },\n { day: 'Tue', visits: 2960, orders: 104 },\n { day: 'Wed', visits: 2210, orders: 74 },\n { day: 'Thu', visits: 1720, orders: 55 },\n { day: 'Fri', visits: 2650, orders: 92 },\n { day: 'Sat', visits: 3890, orders: 141 },\n { day: 'Sun', visits: 3120, orders: 118 },\n]\n\n<ChartPanel<Day>\n title=\"Visits\"\n headline=\"18,390\"\n summary=\"Two peaks: Tuesday, then a higher Saturday.\"\n kind=\"line\"\n area\n curve=\"smooth\"\n size=\"sm\"\n data={DAYS}\n xKey=\"day\"\n xLabel=\"Day\"\n series={[{ key: 'visits', label: 'Visits' }]}\n headingLevel={4}\n/>\n<ChartPanel<Day>\n title=\"Orders\"\n headline=\"670\"\n summary=\"Saturday took 141, the most of the week.\"\n kind=\"bar\"\n size=\"sm\"\n data={DAYS}\n xKey=\"day\"\n xLabel=\"Day\"\n series={[{ key: 'orders', label: 'Orders' }]}\n headingLevel={4}\n/>\n<ChartPanel<Week>\n title=\"Online orders\"\n headline=\"170\"\n summary=\"Three peaks in twelve weeks; the highest, 231, in week 7.\"\n kind=\"line\"\n area\n curve=\"smooth\"\n size=\"sm\"\n data={WEEKS}\n xKey=\"week\"\n xLabel=\"Week\"\n series={[{ key: 'online', label: 'Online' }]}\n headingLevel={4}\n/>"
|
|
9571
9894
|
},
|
|
9572
9895
|
{
|
|
9573
9896
|
"caption": "Donut with a centre total",
|
|
@@ -10984,7 +11307,7 @@
|
|
|
10984
11307
|
{
|
|
10985
11308
|
"name": "items",
|
|
10986
11309
|
"type": "NavbarItem[]",
|
|
10987
|
-
"description": "Required.
|
|
11310
|
+
"description": "Required. A link is { label, href, current }. A menu among the links is { label, menu, current }: menu lists { label, href, description } entries, opened from a dropdown on a wide bar and listed as a labelled group in the menu sheet on a narrow one."
|
|
10988
11311
|
},
|
|
10989
11312
|
{
|
|
10990
11313
|
"name": "actions",
|
|
@@ -11006,7 +11329,13 @@
|
|
|
11006
11329
|
{
|
|
11007
11330
|
"name": "menuFooter",
|
|
11008
11331
|
"type": "ReactNode",
|
|
11009
|
-
"description": "Shown in the menu sheet under the links. Use it for an action that doesn't fit in actions on a narrow bar. Hide the matching copy in actions below the breakpoint by wrapping it in an element with the classes hidden @2xl:flex."
|
|
11332
|
+
"description": "Shown in the menu sheet under the links. Use it for an action that doesn't fit in actions on a narrow bar. Hide the matching copy in actions below the breakpoint by wrapping it in an element with the classes hidden @2xl:flex (hidden @4xl:flex when collapseBelow is '4xl')."
|
|
11333
|
+
},
|
|
11334
|
+
{
|
|
11335
|
+
"name": "collapseBelow",
|
|
11336
|
+
"type": "'2xl' | '4xl'",
|
|
11337
|
+
"default": "'2xl'",
|
|
11338
|
+
"description": "The bar's own width below which the links fold into the menu sheet: 2xl is 42rem, 4xl is 56rem. Pick the one at which the brand, every link and the actions still fit on one row with room to spare."
|
|
11010
11339
|
},
|
|
11011
11340
|
{
|
|
11012
11341
|
"name": "className",
|
|
@@ -11023,7 +11352,7 @@
|
|
|
11023
11352
|
{
|
|
11024
11353
|
"name": "NavbarItem",
|
|
11025
11354
|
"kind": "type",
|
|
11026
|
-
"code": "export type NavbarItem =
|
|
11355
|
+
"code": "export type NavbarItem = NavbarLink | NavbarMenu",
|
|
11027
11356
|
"from": "src/components/organisms/navbar/Navbar"
|
|
11028
11357
|
}
|
|
11029
11358
|
],
|
|
@@ -11084,6 +11413,10 @@
|
|
|
11084
11413
|
"caption": "Store navigation",
|
|
11085
11414
|
"source": "const ITEMS = [\n { label: 'Replicas', href: '#replicas' },\n { label: 'Optics', href: '#optics', current: true },\n { label: 'Parts', href: '#parts' },\n { label: 'Care', href: '#care' },\n { label: 'Field notes', href: '#field-notes' },\n]\n\nconst BRAND = (\n <a\n href=\"#home\"\n className=\"inline-flex items-center min-h-10 font-display font-bold uppercase tracking-[0.14em] text-[var(--color-text-primary)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--color-focus-ring)]\"\n >\n Hexline\n </a>\n)\n\nconst ACTIONS = (\n <>\n <IconButton label=\"Search\" variant=\"ghost\">\n <Search aria-hidden=\"true\" className=\"w-5 h-5\" />\n </IconButton>\n <IconButton label=\"Cart, 2 items\" variant=\"ghost\" asChild>\n <a href=\"#cart\">\n <ShoppingBag aria-hidden=\"true\" className=\"w-5 h-5\" />\n </a>\n </IconButton>\n </>\n)\n\n<Navbar label=\"Store navigation\" brand={BRAND} items={ITEMS} actions={ACTIONS} />"
|
|
11086
11415
|
},
|
|
11416
|
+
{
|
|
11417
|
+
"caption": "A menu among the links",
|
|
11418
|
+
"source": "const ITEMS = [\n { label: 'Replicas', href: '#replicas' },\n { label: 'Optics', href: '#optics', current: true },\n { label: 'Parts', href: '#parts' },\n { label: 'Care', href: '#care' },\n { label: 'Field notes', href: '#field-notes' },\n]\n\nconst BRAND = (\n <a\n href=\"#home\"\n className=\"inline-flex items-center min-h-10 font-display font-bold uppercase tracking-[0.14em] text-[var(--color-text-primary)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--color-focus-ring)]\"\n >\n Hexline\n </a>\n)\n\nconst ACTIONS = (\n <>\n <IconButton label=\"Search\" variant=\"ghost\">\n <Search aria-hidden=\"true\" className=\"w-5 h-5\" />\n </IconButton>\n <IconButton label=\"Cart, 2 items\" variant=\"ghost\" asChild>\n <a href=\"#cart\">\n <ShoppingBag aria-hidden=\"true\" className=\"w-5 h-5\" />\n </a>\n </IconButton>\n </>\n)\n\n<Navbar\n label=\"Store navigation with a menu\"\n brand={BRAND}\n items={[\n ...ITEMS.slice(0, 3),\n {\n label: 'Guides',\n menu: [\n { label: 'Sizing', href: '#sizing', description: 'Fit charts for every replica.' },\n { label: 'Returns', href: '#returns', description: 'Thirty days, no questions.' },\n ],\n },\n ]}\n actions={ACTIONS}\n/>"
|
|
11419
|
+
},
|
|
11087
11420
|
{
|
|
11088
11421
|
"caption": "A narrow container",
|
|
11089
11422
|
"source": "const ITEMS = [\n { label: 'Replicas', href: '#replicas' },\n { label: 'Optics', href: '#optics', current: true },\n { label: 'Parts', href: '#parts' },\n { label: 'Care', href: '#care' },\n { label: 'Field notes', href: '#field-notes' },\n]\n\nconst BRAND = (\n <a\n href=\"#home\"\n className=\"inline-flex items-center min-h-10 font-display font-bold uppercase tracking-[0.14em] text-[var(--color-text-primary)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--color-focus-ring)]\"\n >\n Hexline\n </a>\n)\n\nconst ACTIONS = (\n <>\n <IconButton label=\"Search\" variant=\"ghost\">\n <Search aria-hidden=\"true\" className=\"w-5 h-5\" />\n </IconButton>\n <IconButton label=\"Cart, 2 items\" variant=\"ghost\" asChild>\n <a href=\"#cart\">\n <ShoppingBag aria-hidden=\"true\" className=\"w-5 h-5\" />\n </a>\n </IconButton>\n </>\n)\n\n<div className=\"max-w-sm\">\n <Navbar label=\"Store navigation, narrow\" brand={BRAND} items={ITEMS} actions={ACTIONS} />\n</div>"
|
|
@@ -430,9 +430,12 @@
|
|
|
430
430
|
"layer": "semantic",
|
|
431
431
|
"value": {
|
|
432
432
|
"dark": "#0d1016",
|
|
433
|
-
"light": "#
|
|
433
|
+
"light": "#e3e8ef"
|
|
434
434
|
},
|
|
435
|
-
"use": "The opaque fill of a control you type or pick in (Input, Textarea, Select), and of small opaque surfaces: Kbd, Tag, Tooltip, menus, toasts. Not a card."
|
|
435
|
+
"use": "The opaque fill of a control you type or pick in (Input, Textarea, Select), and of small opaque surfaces: Kbd, Tag, Tooltip, menus, toasts. Not a card.",
|
|
436
|
+
"measured": {
|
|
437
|
+
"light": "neutral.50 mixed 31% of the way to neutral.100 in OKLab (#e3e8ef with the default preset), so the base-to-sunken step is OKLCH ΔL 0.038, the same step as the dark theme (#07080b to #0d1016, ΔL 0.038). neutral.100 alone sat ΔL 0.122 below base and made every field a heavy grey slab; the ramp has no stop in between. A mix of two ramp stops, not a literal, so a Theme Builder preset re-tints it."
|
|
438
|
+
}
|
|
436
439
|
},
|
|
437
440
|
{
|
|
438
441
|
"name": "--color-surface-raised",
|
|
@@ -488,7 +491,7 @@
|
|
|
488
491
|
"use": "The boundary of an interactive control at rest (Input, Select, secondary Button). The one border that has to be seen to find the control.",
|
|
489
492
|
"measured": {
|
|
490
493
|
"dark": "3.53:1 on surface.sunken (the control fill it is painted on) and 3.71:1 on surface.base — the INFORMATIONAL hairline, the one SC 1.4.11 governs. Opaque rather than alpha so the boundary holds whatever surface it lands on.",
|
|
491
|
-
"light": "
|
|
494
|
+
"light": "4.56:1 on surface.sunken (the control fill it is painted on) and 5.10:1 on surface.base — the INFORMATIONAL hairline, the one SC 1.4.11 governs. Opaque rather than alpha so the boundary holds whatever surface it lands on."
|
|
492
495
|
}
|
|
493
496
|
},
|
|
494
497
|
{
|
|
@@ -501,7 +504,7 @@
|
|
|
501
504
|
"use": "The boundary of the small selection controls at rest: Checkbox, Radio, Switch track.",
|
|
502
505
|
"measured": {
|
|
503
506
|
"dark": "The boundary of the small selection controls (Checkbox, Radio, Switch track) at rest. 6.12:1 on surface.sunken. Brighter than border.control (3.53:1) on purpose: a 20px box drawn with the same hairline as a 320px input carries a fraction of the edge length, and at 3.53:1 an unchecked checkbox all but vanished on the dark page. border.control stays the hairline for the large fields.",
|
|
504
|
-
"light": "The boundary of the small selection controls (Checkbox, Radio, Switch track) at rest. Same value as border.control in this theme (
|
|
507
|
+
"light": "The boundary of the small selection controls (Checkbox, Radio, Switch track) at rest. Same value as border.control in this theme (4.56:1 on surface.sunken), which reads clearly on a light page; the token exists in both themes because dark needed its own brighter step."
|
|
505
508
|
}
|
|
506
509
|
},
|
|
507
510
|
{
|
|
@@ -544,7 +547,7 @@
|
|
|
544
547
|
"use": "Placeholder text inside a control, on surface.sunken. Only there.",
|
|
545
548
|
"measured": {
|
|
546
549
|
"dark": "4.68:1 on surface.sunken, which is the control fill placeholder text is actually painted on. text.muted is gated against surface.base and passes there at 4.59:1, but reaches only 4.37:1 on the sunken fill — so placeholder needs its own step.",
|
|
547
|
-
"light": "
|
|
550
|
+
"light": "10.23:1 on surface.sunken, the control fill it is painted on. Light theme needs no separate step from text.muted — unlike dark, where muted reaches only 4.37:1 there — but the name exists in both themes so the component layer has one alias to point at."
|
|
548
551
|
}
|
|
549
552
|
},
|
|
550
553
|
{
|
|
@@ -775,7 +778,7 @@
|
|
|
775
778
|
"use": "Text or an icon that marks something as made by AI: the AiLabel mark, the AI glyph in a field an AI filled. Always beside a word, never colour alone.",
|
|
776
779
|
"measured": {
|
|
777
780
|
"dark": "Measured by the gate: 9.55:1 on surface.base, 9.08:1 on surface.sunken, 8.32:1 on surface.raised. One step lighter than accent.info.text (info.500) so AI marks and status text do not read as the same thing.",
|
|
778
|
-
"light": "Measured by the gate: 8.39:1 on surface.base,
|
|
781
|
+
"light": "Measured by the gate: 8.39:1 on surface.base, 7.50:1 on surface.sunken, 8.92:1 on surface.raised. info.700 reached only 3.49:1 on the earlier, darker surface.sunken (neutral.100), so the light theme takes info.800."
|
|
779
782
|
}
|
|
780
783
|
},
|
|
781
784
|
{
|
|
@@ -788,7 +791,7 @@
|
|
|
788
791
|
"use": "The boundary of a form field whose value an AI filled and the person has not changed. Input and Textarea paint it from aiValue; do not paint it by hand.",
|
|
789
792
|
"measured": {
|
|
790
793
|
"dark": "The edge of a field an AI filled. 7.91:1 on the AI-filled field (ai.wash over the control fill), far above the 3:1 SC 1.4.11 floor. Same stop as ai.text; a separate token because a boundary and text carry different floors.",
|
|
791
|
-
"light": "The edge of a field an AI filled.
|
|
794
|
+
"light": "The edge of a field an AI filled. 6.72:1 on the AI-filled field (ai.wash over surface.sunken). Same stop as ai.text; a separate token because a boundary and text carry different floors."
|
|
792
795
|
}
|
|
793
796
|
},
|
|
794
797
|
{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: division-ds
|
|
3
|
-
description: Use when building or changing UI with Division DS (React 19, Tailwind 4, Radix;
|
|
3
|
+
description: Use when building or changing UI with Division DS (React 19, Tailwind 4, Radix; 74 components). Covers which component and token to use, the composition rules prop types cannot express (providers, FormField, button gaps, card borders), planning a screen's states, and how to check the result. Load it before writing any screen or component in a project that has Division DS components.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Division DS
|