@sanity/ui 5.0.0-alpha.27 → 5.0.0-alpha.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/docs/components/box.dsds.yaml +2 -2
- package/docs/components/button.dsds.yaml +4 -3
- package/docs/components/card.dsds.yaml +1 -1
- package/docs/components/dialog.dsds.yaml +2 -2
- package/docs/components/divider.dsds.yaml +1 -1
- package/docs/components/flex.dsds.yaml +1 -1
- package/docs/components/grid.dsds.yaml +3 -3
- package/docs/components/h-stack.dsds.yaml +1 -1
- package/docs/components/icon-button.dsds.yaml +1 -1
- package/docs/components/indicator-stack.dsds.yaml +1 -1
- package/docs/components/indicator.dsds.yaml +2 -1
- package/docs/components/list-item-button.dsds.yaml +150 -0
- package/docs/components/list-item-image.dsds.yaml +6 -3
- package/docs/components/list-item.dsds.yaml +51 -66
- package/docs/components/list.dsds.yaml +26 -30
- package/docs/components/popover.dsds.yaml +3 -3
- package/docs/components/press-area.dsds.yaml +3 -3
- package/docs/components/search-input.dsds.yaml +115 -0
- package/docs/components/select.dsds.yaml +1 -1
- package/docs/components/tabs-panel.dsds.yaml +1 -1
- package/docs/components/tooltip.dsds.yaml +1 -1
- package/docs/components/v-stack.dsds.yaml +3 -2
- package/docs/components/visually-hidden.dsds.yaml +1 -1
- package/docs/foundations/color-guidelines.dsds.yaml +6 -6
- package/docs/index.dsds.yaml +20 -19
- package/docs/overview/api-essentials.dsds.yaml +2 -2
- package/docs/overview/component-reference.dsds.yaml +4 -4
- package/docs/overview/quick-start.dsds.yaml +1 -0
- package/docs/patterns/confirmation-dialogs.dsds.yaml +3 -3
- package/docs/patterns/layouts.dsds.yaml +8 -7
- package/docs/patterns/navigation.dsds.yaml +37 -37
- package/docs/patterns/responsive.dsds.yaml +1 -1
- package/docs/tokens/dtcg/README.md +4 -4
- package/docs/tokens/dtcg/css/color.css +1 -1
- package/docs/tokens/dtcg/css/semantic.css +7 -7
- package/docs/tokens/dtcg/json/color.tokens.json +2 -2
- package/docs/tokens/dtcg/json/semantic.tokens.json +18 -21
- package/package.json +1 -1
- package/src/version.ts +2 -2
- package/docs/components/list-button-item.dsds.yaml +0 -103
- package/docs/components/list-item-text.dsds.yaml +0 -80
|
@@ -35,7 +35,7 @@ sections:
|
|
|
35
35
|
statement: Only use a Navigation sidebar when the application has multiple pages/views that require navigation.
|
|
36
36
|
tags: [development]
|
|
37
37
|
- level: must
|
|
38
|
-
statement: 'Use only Sanity UI''s `<List.
|
|
38
|
+
statement: 'Use only Sanity UI''s `<List.ItemButton />` for Navigation Content items and filters. A navigation item renders as a link: pass `as="a"` and `href`.'
|
|
39
39
|
tags: [development]
|
|
40
40
|
- level: must
|
|
41
41
|
statement: Show the application name as the Content Toolbar Title when there is no Navigation sidebar; otherwise show the current page or view name. The title anchors the collection of content being viewed and should be given priority in spacing to avoid truncation at all costs.
|
|
@@ -52,10 +52,11 @@ sections:
|
|
|
52
52
|
statement: Place the primary action (`level="primary"`) first (inline-start) in a Content Toolbar action row, with only one primary action per action area.
|
|
53
53
|
tags: [interaction]
|
|
54
54
|
- level: must
|
|
55
|
+
id: destructive-critical-icon
|
|
55
56
|
statement: 'Give destructive actions `tone="critical"` and an `ErrorOutlineIcon` through `iconStart` (`iconStart={ErrorOutlineIcon}`).'
|
|
56
57
|
tags: [visual-design]
|
|
57
58
|
refines:
|
|
58
|
-
- to: shared-foundations#destructive-
|
|
59
|
+
- to: shared-foundations#destructive-critical-tone
|
|
59
60
|
- level: must
|
|
60
61
|
statement: Show an empty state in Content display when no content exists, explaining why nothing is shown and offering an action to add content when one is available.
|
|
61
62
|
tags: [content]
|
|
@@ -94,7 +95,7 @@ sections:
|
|
|
94
95
|
statement: Place destructive items at the bottom of an overflow menu, separated by a divider, with `tone="critical"`.
|
|
95
96
|
tags: [visual-design]
|
|
96
97
|
refines:
|
|
97
|
-
- to: shared-foundations#destructive-
|
|
98
|
+
- to: shared-foundations#destructive-critical-tone
|
|
98
99
|
- level: must
|
|
99
100
|
statement: Keep primary actions (`level="primary"`) for critical workflows visible at all times — never hide them.
|
|
100
101
|
tags: [interaction]
|
|
@@ -168,7 +169,7 @@ sections:
|
|
|
168
169
|
role: WCAG 2.4.6 Headings and Labels
|
|
169
170
|
tags: [accessibility]
|
|
170
171
|
- refs:
|
|
171
|
-
- to: shared-foundations#destructive-
|
|
172
|
+
- to: shared-foundations#destructive-critical-tone
|
|
172
173
|
rel: same-as
|
|
173
174
|
- level: should
|
|
174
175
|
statement: Keep the application's title fully displayed in the Navigation header; treat truncation as a last resort.
|
|
@@ -257,7 +258,7 @@ sections:
|
|
|
257
258
|
statement: Do not place filtering, sorting, application/view search, or in-view content tabs inside the Navigation sidebar. Navigation is the act of moving between distinct views. Filtering and sorting belong in the Content toolbar or display; application-wide search belongs in the Navigation header; view-specific search belongs in the Content toolbar; in-view tabs belong in the Content display area.
|
|
258
259
|
tags: [interaction]
|
|
259
260
|
- level: must-not
|
|
260
|
-
statement: Do not use `<Button />` for navigation (use `<List.
|
|
261
|
+
statement: Do not use `<Button />` for navigation (use `<List.ItemButton as="a" href=…>` instead) or to switch between views within a surface (use tabs instead), and do not use `<Button />` alone as a menu activator (wrap it in a `<Popover />`). Assistive technology users expect buttons to perform actions and links to navigate; `<Popover />` handles menu placement and display consistently.
|
|
261
262
|
tags: [development]
|
|
262
263
|
- level: must-not
|
|
263
264
|
statement: Do not exceed 8 items in an overflow menu; group items into labeled sections when more exist.
|
|
@@ -293,7 +294,7 @@ sections:
|
|
|
293
294
|
usage: Optional.
|
|
294
295
|
- id: navigation-content
|
|
295
296
|
term: Navigation content
|
|
296
|
-
definition: Displays all navigation options or filters for content, using only Sanity UI's `<List.
|
|
297
|
+
definition: Displays all navigation options or filters for content, using only Sanity UI's `<List.ItemButton />` component. Scrolls independently to accommodate overflow.
|
|
297
298
|
usage: Optional.
|
|
298
299
|
- id: navigation-footer
|
|
299
300
|
term: Navigation footer
|
|
@@ -360,7 +361,7 @@ traits:
|
|
|
360
361
|
Use when the application has more than one page/view to navigate across.
|
|
361
362
|
|
|
362
363
|
Do not use when the application has only one view and requires no navigation (use Shell, Shell with Toolbar, or Shell with Inspector instead), or when at least one page/view needs a dedicated area to view/edit metadata (use Shell with Navigation and Inspector instead).
|
|
363
|
-
- id: shell-
|
|
364
|
+
- id: shell-nav-and-inspector
|
|
364
365
|
name: Shell with Navigation and Inspector
|
|
365
366
|
description: |-
|
|
366
367
|
A multi-view application with persistent navigation, actions, and viewing/editing of content metadata (Navigation sidebar visible by default; Inspection sidebar visible by default). Ideal for more organized, fine-grained management of content and its metadata. It's recommended to hide the Inspection sidebar on pages/views where it's not used.
|
|
@@ -4,7 +4,7 @@ name: Sidebar navigation pattern
|
|
|
4
4
|
description: >-
|
|
5
5
|
Sanity UI has no built-in NavItem or SidebarLink component. This pattern shows
|
|
6
6
|
the canonical way to build keyboard-accessible sidebar navigation by composing
|
|
7
|
-
List + List.
|
|
7
|
+
List + List.ItemButton, instead of hand-building nav items from a native
|
|
8
8
|
button or Box as="button". Use this pattern for persistent sidebar navigation,
|
|
9
9
|
not for a popover menu.
|
|
10
10
|
metadata:
|
|
@@ -18,7 +18,7 @@ metadata:
|
|
|
18
18
|
- badge
|
|
19
19
|
- keyboard accessible
|
|
20
20
|
- aria-current
|
|
21
|
-
-
|
|
21
|
+
- current state
|
|
22
22
|
status:
|
|
23
23
|
status: stable
|
|
24
24
|
sections:
|
|
@@ -37,19 +37,19 @@ sections:
|
|
|
37
37
|
for: all
|
|
38
38
|
framing: how-to-use
|
|
39
39
|
items:
|
|
40
|
-
- id:
|
|
40
|
+
- id: nav-rows-list-item-button
|
|
41
41
|
level: must
|
|
42
|
-
statement: Use `List.
|
|
42
|
+
statement: Use `List.ItemButton` inside a `List.Item` for navigation rows.
|
|
43
43
|
tags: [development]
|
|
44
|
-
- id:
|
|
44
|
+
- id: current-marks-active-row
|
|
45
45
|
level: must
|
|
46
|
-
statement:
|
|
46
|
+
statement: Mark the active row with `List.ItemButton`'s `current` prop, as `current={isActive}`. It sets `aria-current="true"`, which the active style keys on. Don't set `aria-current` yourself.
|
|
47
47
|
tags: [accessibility]
|
|
48
48
|
- level: should
|
|
49
49
|
statement: Verify the selected state's contrast in your theme, and consider marking the active item with a bold label or a left border accent instead of relying on a selected background alone. Confirm the result meets WCAG AA in whichever theme is active.
|
|
50
50
|
tags: [visual-design]
|
|
51
51
|
- level: must-not
|
|
52
|
-
statement: Never use a native `<button>` or `<Box as="button">` with inline styles for navigation items. Hand-built nav items are the single most common source of unnecessary inline styles in test runs — agents create 10–12 CSS properties per nav item to replicate what Sanity UI's List/List.
|
|
52
|
+
statement: Never use a native `<button>` or `<Box as="button">` with inline styles for navigation items. Hand-built nav items are the single most common source of unnecessary inline styles in test runs — agents create 10–12 CSS properties per nav item to replicate what Sanity UI's List/List.ItemButton already provide.
|
|
53
53
|
tags: [development]
|
|
54
54
|
- level: must-not
|
|
55
55
|
statement: Don't use `Box as="button">` for a navigation item. It inherits browser button defaults (border, background, cursor) with no prop-based reset available.
|
|
@@ -83,7 +83,7 @@ sections:
|
|
|
83
83
|
- level: must-not
|
|
84
84
|
statement: 'Don''t give every node `tabIndex={0}` inside a `role="tree"`. That makes the tree as many tab stops as it has rows, which is the cost the single-tab-stop pattern exists to remove. Exactly one node carries `tabIndex={0}`; the rest carry `tabIndex={-1}`.'
|
|
85
85
|
- level: must-not
|
|
86
|
-
statement: 'Don''t build a tree row from `Box`/`Flex` with `onClick`, `role="button"` and `tabIndex`. Use `List.
|
|
86
|
+
statement: 'Don''t build a tree row from `Box`/`Flex` with `onClick`, `role="button"` and `tabIndex`. Use `List.ItemButton` with `as="a"` and `href` for a navigation row, or `PressArea` for a custom surface. Both render a real control with keyboard support already wired.'
|
|
87
87
|
|
|
88
88
|
- kind: steps
|
|
89
89
|
for: all
|
|
@@ -92,7 +92,7 @@ sections:
|
|
|
92
92
|
items:
|
|
93
93
|
- title: Navigation container uses `<Box as="nav" aria-label="...">`.
|
|
94
94
|
- title: Each item is keyboard-reachable and activatable (`Enter`/`Space`).
|
|
95
|
-
- title: Active item is marked `
|
|
95
|
+
- title: Active item is marked with `current` on `List.ItemButton`, which sets `aria-current`.
|
|
96
96
|
- title: Icon-only items have `aria-label` (not needed if a text label is present).
|
|
97
97
|
- optional: true
|
|
98
98
|
title: Navigation group uses `VStack gap={1}` or `gap={2}` for target spacing.
|
|
@@ -100,9 +100,9 @@ sections:
|
|
|
100
100
|
- kind: section
|
|
101
101
|
for: all
|
|
102
102
|
freeform:
|
|
103
|
-
- title: 'List + List.
|
|
103
|
+
- title: 'List + List.ItemButton'
|
|
104
104
|
body: |-
|
|
105
|
-
Use `List` with `List.
|
|
105
|
+
Use `List` with a `List.Item` per row, and a `List.ItemButton` inside each one. Pass `as="a"` and `href`: each row then renders a real link, and middle-click, "Open in new tab" and bookmarking work.
|
|
106
106
|
|
|
107
107
|
```tsx
|
|
108
108
|
import { Badge, Box, List, Text } from '@sanity/ui'
|
|
@@ -111,43 +111,43 @@ sections:
|
|
|
111
111
|
|
|
112
112
|
<Box as="nav" aria-label="Main navigation" padding={3}>
|
|
113
113
|
<List>
|
|
114
|
-
<List.
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
</List.
|
|
124
|
-
<List.
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
</List.
|
|
114
|
+
<List.Item>
|
|
115
|
+
<List.ItemButton
|
|
116
|
+
as="a"
|
|
117
|
+
href="/guides"
|
|
118
|
+
current={activeSection === 'guides'}
|
|
119
|
+
text="Guides"
|
|
120
|
+
start={<Text size={1}><DocumentTextIcon /></Text>}
|
|
121
|
+
end={<Badge>{counts.guides}</Badge>}
|
|
122
|
+
/>
|
|
123
|
+
</List.Item>
|
|
124
|
+
<List.Item>
|
|
125
|
+
<List.ItemButton
|
|
126
|
+
as="a"
|
|
127
|
+
href="/api"
|
|
128
|
+
current={activeSection === 'api'}
|
|
129
|
+
text="API References"
|
|
130
|
+
start={<Text size={1}><CodeIcon /></Text>}
|
|
131
|
+
end={<Badge>{counts.api}</Badge>}
|
|
132
|
+
/>
|
|
133
|
+
</List.Item>
|
|
134
134
|
</List>
|
|
135
135
|
</Box>
|
|
136
136
|
```
|
|
137
137
|
|
|
138
138
|
**Notes on the List approach:**
|
|
139
|
-
- The whole row is one link
|
|
140
|
-
-
|
|
141
|
-
- No arrow-key navigation between items
|
|
142
|
-
- `
|
|
139
|
+
- The whole row is one link: focusable via `Tab`, and it follows the link on `Enter`.
|
|
140
|
+
- `start` holds an icon, and `end` holds a non-interactive badge or count. Neither adds a second tab stop.
|
|
141
|
+
- No arrow-key navigation between items. Each row is a separate Tab stop.
|
|
142
|
+
- `current` sets `aria-current="true"` on the active row. That is valid ARIA, but it is not `aria-current="page"`. If your team requires `"page"` for navigation, this component does not produce it.
|
|
143
143
|
- kind: section
|
|
144
144
|
for: agent
|
|
145
145
|
freeform:
|
|
146
146
|
- title: Intent
|
|
147
|
-
body: Build sidebar navigation with List + List.
|
|
147
|
+
body: Build sidebar navigation with List + List.ItemButton, never with a hand-built button or Box as="button".
|
|
148
148
|
uses:
|
|
149
149
|
- to: list
|
|
150
150
|
note: Optional part.
|
|
151
|
-
- to: list-button
|
|
151
|
+
- to: list-item-button
|
|
152
152
|
note: Optional part.
|
|
153
153
|
- to: badge
|
|
@@ -34,7 +34,7 @@ sections:
|
|
|
34
34
|
statement: Add `flexWrap="wrap"` to every horizontal `Flex` row (toolbar, action bar, card actions) so layouts reflow at 320px without horizontal scrolling.
|
|
35
35
|
- level: must
|
|
36
36
|
statement: Add `minWidth="0"` to any flex child that contains text. Without it the child cannot shrink below its content size, causing overflow past the viewport.
|
|
37
|
-
- id:
|
|
37
|
+
- id: top-layer-in-scroll
|
|
38
38
|
level: must
|
|
39
39
|
statement: >-
|
|
40
40
|
Tooltip and Popover render in the browser's top layer, so a scrollable or `overflow: hidden` ancestor does not clip them. Set their boolean `portal` prop only when an ancestor with `transform`, `filter` or `contain` breaks their positioning.
|
|
@@ -9,19 +9,19 @@ The files are a copy of `dist/json` and `dist/css` from [sanity-labs/design-toke
|
|
|
9
9
|
| Field | Value |
|
|
10
10
|
| ------- | -------------------------------- |
|
|
11
11
|
| Package | `@sanity-labs/design-tokens` |
|
|
12
|
-
| Version | `0.0.2-alpha.
|
|
12
|
+
| Version | `0.0.2-alpha.12` |
|
|
13
13
|
| Commit | Not recorded in the npm package |
|
|
14
|
-
| Copied | 2026-11-
|
|
14
|
+
| Copied | 2026-11-23, from the npm package |
|
|
15
15
|
|
|
16
16
|
This is the highest version published on npm, and the version `packages/ui/package.json` pins. Keep the copy on the version Sanity UI pins.
|
|
17
17
|
|
|
18
|
-
`shadow.tokens.json` and `shadow.css` are not in `0.0.2-alpha.
|
|
18
|
+
`shadow.tokens.json` and `shadow.css` are not in `0.0.2-alpha.12`. They are still the copies from `0.0.2-alpha.6`, and they are kept because the shadow docs depend on them.
|
|
19
19
|
|
|
20
20
|
## The semantic file
|
|
21
21
|
|
|
22
22
|
Two files do not come from the design-tokens repo. `json/semantic.tokens.json` and `css/semantic.css` hold the semantic layer: `--background-low`, `--separator-low` and the rest. Sanity UI 5 defines that layer in its CSS. The `build-semantic.mjs` script makes both files from that CSS.
|
|
23
23
|
|
|
24
|
-
Each light value points at a palette token. The dark value and the tone value sit in `$extensions`. Rerun the script when Sanity UI changes version:
|
|
24
|
+
Each light value points at a palette token. The dark value and the tone value sit in `$extensions`. The semantic files were last patched by hand, not by the script. The script is not in this repo, so the `active-*`, `focus-outline` and `inert-*` values were copied from `packages/ui/src/css/tokens/semantic.css` at 5.0.0-alpha.27. Those tokens are now gray, not blue. Rerun the script when Sanity UI changes version, and check that its output matches these values:
|
|
25
25
|
|
|
26
26
|
```sh
|
|
27
27
|
node tokens/dtcg/build-semantic.mjs <path to sanity-io/ui/packages/ui>
|
|
@@ -19,19 +19,19 @@
|
|
|
19
19
|
--brand-foreground: var(--black);
|
|
20
20
|
--placeholder-opacity: var(--opacity-mid);
|
|
21
21
|
--overlay-opacity: var(--opacity-mid);
|
|
22
|
-
--active-background-normal: light-dark(var(--
|
|
23
|
-
--active-foreground-normal: light-dark(var(--
|
|
24
|
-
--active-background-emphasized: light-dark(var(--
|
|
25
|
-
--active-foreground-emphasized: light-dark(var(--white), var(--
|
|
22
|
+
--active-background-normal: light-dark(var(--gray-100), var(--gray-900));
|
|
23
|
+
--active-foreground-normal: light-dark(var(--gray-800), var(--gray-200));
|
|
24
|
+
--active-background-emphasized: light-dark(var(--gray-800), var(--gray-200));
|
|
25
|
+
--active-foreground-emphasized: light-dark(var(--white), var(--gray-950));
|
|
26
26
|
--error-background-emphasized: light-dark(var(--red-600), var(--red-400));
|
|
27
27
|
--error-foreground: light-dark(var(--red-800), var(--red-200));
|
|
28
28
|
--error-separator: light-dark(var(--red-600), var(--red-400));
|
|
29
|
-
--focus-outline: 2px solid var(--blue-
|
|
29
|
+
--focus-outline: 2px solid light-dark(var(--blue-600), var(--blue-400));
|
|
30
30
|
--focus-offset: 2px;
|
|
31
31
|
--hover-lightness-delta: 0.125;
|
|
32
32
|
--hover-transition: border-color 100ms linear, background-color 100ms linear;
|
|
33
|
-
--inert-background:
|
|
34
|
-
--inert-foreground: light-dark(var(--gray-400), var(--gray-
|
|
33
|
+
--inert-background: hsl(from var(--gray-500) h s l / 0.125);
|
|
34
|
+
--inert-foreground: light-dark(var(--gray-400), var(--gray-500));
|
|
35
35
|
--fade-in-transition:
|
|
36
36
|
opacity 200ms cubic-bezier(0.34, 1.2, 0.64, 1), scale 200ms cubic-bezier(0.34, 1.2, 0.64, 1),
|
|
37
37
|
visibility 0s linear, display 200ms linear allow-discrete;
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"$value": {
|
|
5
5
|
"alpha": 1,
|
|
6
6
|
"colorSpace": "srgb",
|
|
7
|
-
"components": [0.
|
|
8
|
-
"hex": "#
|
|
7
|
+
"components": [0.050980392156862744, 0.054901960784313725, 0.07058823529411765],
|
|
8
|
+
"hex": "#0d0e12"
|
|
9
9
|
}
|
|
10
10
|
},
|
|
11
11
|
"blue-100": {
|
|
@@ -179,36 +179,36 @@
|
|
|
179
179
|
},
|
|
180
180
|
"active-background-normal": {
|
|
181
181
|
"$type": "color",
|
|
182
|
-
"$value": "{
|
|
182
|
+
"$value": "{gray-100}",
|
|
183
183
|
"$extensions": {
|
|
184
184
|
"com.sanity.ui": {
|
|
185
|
-
"css": "light-dark(var(--
|
|
185
|
+
"css": "light-dark(var(--gray-100), var(--gray-900))",
|
|
186
186
|
"modes": {
|
|
187
|
-
"dark": "{
|
|
187
|
+
"dark": "{gray-900}"
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
},
|
|
192
192
|
"active-foreground-normal": {
|
|
193
193
|
"$type": "color",
|
|
194
|
-
"$value": "{
|
|
194
|
+
"$value": "{gray-800}",
|
|
195
195
|
"$extensions": {
|
|
196
196
|
"com.sanity.ui": {
|
|
197
|
-
"css": "light-dark(var(--
|
|
197
|
+
"css": "light-dark(var(--gray-800), var(--gray-200))",
|
|
198
198
|
"modes": {
|
|
199
|
-
"dark": "{
|
|
199
|
+
"dark": "{gray-200}"
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
},
|
|
204
204
|
"active-background-emphasized": {
|
|
205
205
|
"$type": "color",
|
|
206
|
-
"$value": "{
|
|
206
|
+
"$value": "{gray-800}",
|
|
207
207
|
"$extensions": {
|
|
208
208
|
"com.sanity.ui": {
|
|
209
|
-
"css": "light-dark(var(--
|
|
209
|
+
"css": "light-dark(var(--gray-800), var(--gray-200))",
|
|
210
210
|
"modes": {
|
|
211
|
-
"dark": "{
|
|
211
|
+
"dark": "{gray-200}"
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
}
|
|
@@ -218,9 +218,9 @@
|
|
|
218
218
|
"$value": "{white}",
|
|
219
219
|
"$extensions": {
|
|
220
220
|
"com.sanity.ui": {
|
|
221
|
-
"css": "light-dark(var(--white), var(--
|
|
221
|
+
"css": "light-dark(var(--white), var(--gray-950))",
|
|
222
222
|
"modes": {
|
|
223
|
-
"dark": "{
|
|
223
|
+
"dark": "{gray-950}"
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
}
|
|
@@ -263,10 +263,10 @@
|
|
|
263
263
|
},
|
|
264
264
|
"focus-outline": {
|
|
265
265
|
"$type": "css",
|
|
266
|
-
"$value": "2px solid var(--blue-
|
|
266
|
+
"$value": "2px solid light-dark(var(--blue-600), var(--blue-400))",
|
|
267
267
|
"$extensions": {
|
|
268
268
|
"com.sanity.ui": {
|
|
269
|
-
"css": "2px solid var(--blue-
|
|
269
|
+
"css": "2px solid light-dark(var(--blue-600), var(--blue-400))"
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
272
|
},
|
|
@@ -301,14 +301,11 @@
|
|
|
301
301
|
}
|
|
302
302
|
},
|
|
303
303
|
"inert-background": {
|
|
304
|
-
"$type": "
|
|
305
|
-
"$value": "
|
|
304
|
+
"$type": "css",
|
|
305
|
+
"$value": "hsl(from var(--gray-500) h s l / 0.125)",
|
|
306
306
|
"$extensions": {
|
|
307
307
|
"com.sanity.ui": {
|
|
308
|
-
"css": "
|
|
309
|
-
"modes": {
|
|
310
|
-
"dark": "{gray-950}"
|
|
311
|
-
}
|
|
308
|
+
"css": "hsl(from var(--gray-500) h s l / 0.125)"
|
|
312
309
|
}
|
|
313
310
|
}
|
|
314
311
|
},
|
|
@@ -317,9 +314,9 @@
|
|
|
317
314
|
"$value": "{gray-400}",
|
|
318
315
|
"$extensions": {
|
|
319
316
|
"com.sanity.ui": {
|
|
320
|
-
"css": "light-dark(var(--gray-400), var(--gray-
|
|
317
|
+
"css": "light-dark(var(--gray-400), var(--gray-500))",
|
|
321
318
|
"modes": {
|
|
322
|
-
"dark": "{gray-
|
|
319
|
+
"dark": "{gray-500}"
|
|
323
320
|
}
|
|
324
321
|
}
|
|
325
322
|
}
|
package/package.json
CHANGED
package/src/version.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// This file is generated by scripts/write-version.js. Do not edit.
|
|
2
|
-
export const VERSION = '
|
|
3
|
-
export const HASH = '
|
|
2
|
+
export const VERSION = '500alpha28'
|
|
3
|
+
export const HASH = 'ad5e6f'
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
kind: component
|
|
2
|
-
id: list-button-item
|
|
3
|
-
name: List.ButtonItem
|
|
4
|
-
description: The interactive, selectable variant of List.Item.
|
|
5
|
-
metadata:
|
|
6
|
-
tags: [list, item, row, li, button, interactive, selectable]
|
|
7
|
-
status:
|
|
8
|
-
status: beta
|
|
9
|
-
sections:
|
|
10
|
-
- kind: guidelines
|
|
11
|
-
for: all
|
|
12
|
-
framing: when-to-use
|
|
13
|
-
title: When to use
|
|
14
|
-
items:
|
|
15
|
-
- level: should
|
|
16
|
-
statement: A row that navigates, selects, or triggers an action — a document in a browser list, a sidebar nav item, a selectable row in a picker.
|
|
17
|
-
- level: should
|
|
18
|
-
statement: Anywhere you would otherwise wrap List.Item in PressArea by hand.
|
|
19
|
-
- level: should-not
|
|
20
|
-
statement: A row with no interaction. Use plain List.Item instead.
|
|
21
|
-
alternatives:
|
|
22
|
-
- to: list-item
|
|
23
|
-
- level: should-not
|
|
24
|
-
statement: A row containing more than one interactive control. Nested interactive elements inside a button/anchor break keyboard and screen-reader expectations — use List.Item with start/end slots and make only one child interactive.
|
|
25
|
-
alternatives:
|
|
26
|
-
- to: list-item
|
|
27
|
-
- kind: guidelines
|
|
28
|
-
for: all
|
|
29
|
-
framing: how-to-use
|
|
30
|
-
items:
|
|
31
|
-
- id: every-prop-besides-selected-density
|
|
32
|
-
level: must
|
|
33
|
-
statement: Every prop besides as/selected/density/start/end/children forwards to the inner <button>/<a>, not the outer <li>. This differs from plain List.Item, whose extra props land on the <li> itself.
|
|
34
|
-
- level: must-not
|
|
35
|
-
statement: Don't use List.ButtonItem outside of a List — it renders as <li> and requires a <ul> or <ol> parent.
|
|
36
|
-
- level: must-not
|
|
37
|
-
statement: 'Don''t pass selected unconditionally. selected={false} still renders data-selected="false", and the component''s CSS selects on attribute presence ([data-selected]), not value — so selected={false} looks identical to selected={true}. Only omit the prop to render the unselected state: {...(isActive ? {selected: true} : {})}, or selected={isActive || undefined}.'
|
|
38
|
-
- id: don-nest-another-interactive-element
|
|
39
|
-
level: must-not
|
|
40
|
-
statement: Don't nest another interactive element (Button, a second PressArea) inside List.ButtonItem. The whole row is already one press target.
|
|
41
|
-
- kind: guidelines
|
|
42
|
-
for: agent
|
|
43
|
-
framing: how-to-use
|
|
44
|
-
items:
|
|
45
|
-
- refs:
|
|
46
|
-
- to: list#subcomponents-not-named-exports
|
|
47
|
-
rel: same-as
|
|
48
|
-
- level: must
|
|
49
|
-
statement: The selected prop sets no ARIA state — only a data-selected styling hook. When using selected, also set aria-current="true" (for a current-item-in-a-list pattern like active nav) or aria-selected="true" (inside a listbox/grid with role wired accordingly) when the row is selected, and omit that ARIA attribute entirely when it is not (do not set it to "false").
|
|
50
|
-
- level: must-not
|
|
51
|
-
statement: selected={false} is not equivalent to omitting selected. Because the component's CSS rule is `.sui-ListButtonItem[data-selected]` (an attribute-presence selector, not a value match) and React renders data-selected={false} as the literal attribute data-selected="false", a row with selected={false} is styled identically to selected={true}. Only pass the selected prop when true — use selected={isActive || undefined} or a conditional spread, never a bare boolean expression.
|
|
52
|
-
- level: must-not
|
|
53
|
-
statement: "Using onClick on a plain List.Item instead of List.ButtonItem. Instead: List.Item is not interactive and has none of List.ButtonItem's keyboard handling — use List.ButtonItem for any pressable row."
|
|
54
|
-
- kind: section
|
|
55
|
-
for: all
|
|
56
|
-
freeform:
|
|
57
|
-
- title: Composition
|
|
58
|
-
body: |-
|
|
59
|
-
Same child order as List.Item: `start`, then the row's text content, then `end`. Use `start` for a thumbnail or icon, and `end` for an action, badge, or timestamp.
|
|
60
|
-
|
|
61
|
-
```tsx
|
|
62
|
-
import { List } from '@sanity/ui'
|
|
63
|
-
|
|
64
|
-
<List>
|
|
65
|
-
{documents.map((doc) => (
|
|
66
|
-
<List.ButtonItem
|
|
67
|
-
key={doc.id}
|
|
68
|
-
onClick={() => setActiveId(doc.id)}
|
|
69
|
-
selected={activeId === doc.id || undefined}
|
|
70
|
-
start={<List.ItemImage src={doc.thumbnailUrl} alt="" />}
|
|
71
|
-
>
|
|
72
|
-
<List.ItemText title={doc.title} subtitle={doc.updatedAt} />
|
|
73
|
-
</List.ButtonItem>
|
|
74
|
-
))}
|
|
75
|
-
</List>
|
|
76
|
-
```
|
|
77
|
-
alternatives:
|
|
78
|
-
- to: list-item
|
|
79
|
-
note: The non-interactive row — see **List.Item** docs
|
|
80
|
-
- to: press-area
|
|
81
|
-
note: The lower-level interaction primitive List.ButtonItem is built on
|
|
82
|
-
refs:
|
|
83
|
-
- to: list
|
|
84
|
-
rel: relates-to
|
|
85
|
-
note: The parent component — see **List** for full compound component docs
|
|
86
|
-
sourceFiles:
|
|
87
|
-
- platform: react
|
|
88
|
-
file: packages/ui/src/components/list/List.tsx
|
|
89
|
-
imports:
|
|
90
|
-
- platform: react
|
|
91
|
-
code: import { List } from '@sanity/ui'
|
|
92
|
-
package: '@sanity/ui'
|
|
93
|
-
traits:
|
|
94
|
-
- traitType: state
|
|
95
|
-
kind: boolean
|
|
96
|
-
id: selected
|
|
97
|
-
description: Marks the row as the current selection via a data-selected styling hook. Only pass this prop when true — see the how-to-use guidance below.
|
|
98
|
-
|
|
99
|
-
$extensions:
|
|
100
|
-
com.sanity.ui:
|
|
101
|
-
implementationStatus:
|
|
102
|
-
context: Implementation status. Lets a tool tell a component that is coming from one that does not exist, without parsing the status note.
|
|
103
|
-
implemented: true
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
kind: component
|
|
2
|
-
id: list-item-text
|
|
3
|
-
name: List.ItemText
|
|
4
|
-
description: The text content slot inside a List.Item.
|
|
5
|
-
metadata:
|
|
6
|
-
tags: [list, item, text, title, subtitle]
|
|
7
|
-
status:
|
|
8
|
-
status: beta
|
|
9
|
-
sections:
|
|
10
|
-
- kind: guidelines
|
|
11
|
-
for: all
|
|
12
|
-
framing: how-to-use
|
|
13
|
-
items:
|
|
14
|
-
- level: should
|
|
15
|
-
statement: Keep titles short — they are clamped to one line.
|
|
16
|
-
- level: must-not
|
|
17
|
-
statement: Don't use List.ItemText outside of List.Item. It relies on the flex layout of the parent row.
|
|
18
|
-
- kind: guidelines
|
|
19
|
-
for: agent
|
|
20
|
-
framing: how-to-use
|
|
21
|
-
items:
|
|
22
|
-
- refs:
|
|
23
|
-
- to: list#subcomponents-not-named-exports
|
|
24
|
-
rel: same-as
|
|
25
|
-
- level: must-not
|
|
26
|
-
statement: Do not wrap title or subtitle in a Text component — List.ItemText applies sizing, weight, and truncation internally.
|
|
27
|
-
- kind: guidelines
|
|
28
|
-
for: all
|
|
29
|
-
title: Content
|
|
30
|
-
tags: [content]
|
|
31
|
-
items:
|
|
32
|
-
- refs:
|
|
33
|
-
- to: content-guidelines#sentence-case-all-system-set
|
|
34
|
-
rel: same-as
|
|
35
|
-
- kind: section
|
|
36
|
-
for: agent
|
|
37
|
-
freeform:
|
|
38
|
-
- title: Examples
|
|
39
|
-
body: |-
|
|
40
|
-
List.ItemText renders a two-line label block with built-in styling.
|
|
41
|
-
|
|
42
|
-
```tsx
|
|
43
|
-
// ✓ — ItemText applies size, weight, and truncation internally
|
|
44
|
-
<List.ItemText title="My document" subtitle="Last edited 2 hours ago" />
|
|
45
|
-
|
|
46
|
-
// ✗ — wrapping in Text adds conflicting styles
|
|
47
|
-
<List.ItemText
|
|
48
|
-
title={<Text size={1} weight="medium">My document</Text>}
|
|
49
|
-
subtitle="..."
|
|
50
|
-
/>
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
Both `title` and `subtitle` accept `React.ReactNode`, so you can pass a `Badge` or `Icon` when needed. Keep the value short — both lines are clamped to one line (`truncate={1}`).
|
|
54
|
-
|
|
55
|
-
refs:
|
|
56
|
-
- href: https://www.figma.com/design/5mhVqXlldJEEB2VWZeKQ4i/Sanity-UI?node-id=32249-547
|
|
57
|
-
rel: design
|
|
58
|
-
role: Figma component (v5)
|
|
59
|
-
- to: list-item
|
|
60
|
-
rel: relates-to
|
|
61
|
-
note: The parent row
|
|
62
|
-
- to: list
|
|
63
|
-
rel: relates-to
|
|
64
|
-
note: The root list component — see **List** for full compound component docs
|
|
65
|
-
- to: tooltip
|
|
66
|
-
rel: relates-to
|
|
67
|
-
note: Use to reveal full text when a title is truncated
|
|
68
|
-
sourceFiles:
|
|
69
|
-
- platform: react
|
|
70
|
-
file: packages/ui/src/components/list/List.tsx
|
|
71
|
-
imports:
|
|
72
|
-
- platform: react
|
|
73
|
-
code: import { List } from '@sanity/ui'
|
|
74
|
-
package: '@sanity/ui'
|
|
75
|
-
|
|
76
|
-
$extensions:
|
|
77
|
-
com.sanity.ui:
|
|
78
|
-
implementationStatus:
|
|
79
|
-
context: Implementation status. Lets a tool tell a component that is coming from one that does not exist, without parsing the status note.
|
|
80
|
-
implemented: true
|