@sanity/ui 5.0.0-alpha.26 → 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 +3 -2
- 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 +2 -2
- package/src/components/tabs/tabs.css +1 -1
- package/src/utils/getProps.test.ts +22 -0
- package/src/utils/getProps.ts +5 -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
|
@@ -21,10 +21,10 @@ sections:
|
|
|
21
21
|
alternatives:
|
|
22
22
|
- to: v-stack
|
|
23
23
|
- level: should-not
|
|
24
|
-
statement: For action menus or dropdown options. Use List.
|
|
24
|
+
statement: For action menus or dropdown options. Use List.ItemButton rows inside a Popover instead.
|
|
25
25
|
alternatives:
|
|
26
26
|
- to: popover
|
|
27
|
-
- to: list-button
|
|
27
|
+
- to: list-item-button
|
|
28
28
|
- level: should-not
|
|
29
29
|
statement: For table data with column headers. Use a table element directly.
|
|
30
30
|
- kind: guidelines
|
|
@@ -32,16 +32,13 @@ sections:
|
|
|
32
32
|
framing: how-to-use
|
|
33
33
|
items:
|
|
34
34
|
- level: should
|
|
35
|
-
statement:
|
|
35
|
+
statement: Set density on each List.ItemButton row. Use density='compact' in sidebars and panels, and density='loose' for touch-first UIs.
|
|
36
36
|
- level: should
|
|
37
37
|
statement: Use as='ol' when list order is meaningful (ranked results, step sequences).
|
|
38
38
|
- level: should
|
|
39
|
-
statement:
|
|
40
|
-
- id: don-list-itemtext-outside-list
|
|
41
|
-
level: must-not
|
|
42
|
-
statement: Don't use List.ItemText outside of List.Item. It relies on the flex layout of the parent row.
|
|
39
|
+
statement: Keep the start and end slots of List.ItemButton to one non-interactive element each, such as a thumbnail or icon for start, and a badge, icon or timestamp for end.
|
|
43
40
|
- level: must-not
|
|
44
|
-
statement: "Don't place
|
|
41
|
+
statement: "Don't place a button, link or other interactive element in the start or end slot of List.ItemButton. The slots render inside the row's own button, so the element would be nested inside another control."
|
|
45
42
|
- level: must-not
|
|
46
43
|
statement: Don't override List.ItemImage dimensions with inline styles. The fixed size keeps rows visually even.
|
|
47
44
|
- kind: guidelines
|
|
@@ -49,20 +46,19 @@ sections:
|
|
|
49
46
|
framing: how-to-use
|
|
50
47
|
items:
|
|
51
48
|
- level: must
|
|
52
|
-
statement: List has subcomponents, List.Item, List.
|
|
49
|
+
statement: List has three subcomponents, List.Item, List.ItemButton and List.ItemImage. Each has its own entry, `list-item`, `list-item-button` and `list-item-image`. Read each one's entry in `docs/components/` before you write it. Its props are not listed here.
|
|
53
50
|
- id: subcomponents-not-named-exports
|
|
54
51
|
level: must
|
|
55
|
-
statement: "Access subcomponents via dot notation: List.Item, List.
|
|
52
|
+
statement: "Access subcomponents via dot notation: List.Item, List.ItemButton, List.ItemImage. They are not separate named exports, so don't import them that way."
|
|
56
53
|
- level: must
|
|
57
|
-
statement: Provide alt on every List.ItemImage
|
|
54
|
+
statement: Provide alt on every List.ItemImage. It renders a native <img> with no implicit accessible name.
|
|
58
55
|
- id: no-density-on-list
|
|
59
56
|
level: must-not
|
|
60
|
-
statement: Do not set `density` on List. It has no `density` prop, and `<List density="compact">` is a TypeScript error. Set it on each List.
|
|
57
|
+
statement: Do not set `density` on List. It has no `density` prop, and `<List density="compact">` is a TypeScript error. Set it on each List.ItemButton.
|
|
61
58
|
- level: must-not
|
|
62
|
-
statement: List.Item does not support the `as` prop
|
|
59
|
+
statement: List.Item does not support the `as` prop. It always renders as `<li>`. Passing `as` to List.Item causes a TypeScript error.
|
|
63
60
|
- level: must-not
|
|
64
|
-
statement: There is no `trailing` prop
|
|
65
|
-
|
|
61
|
+
statement: There is no `trailing` prop. Use `end` on List.ItemButton.
|
|
66
62
|
- kind: guidelines
|
|
67
63
|
for: all
|
|
68
64
|
title: Content
|
|
@@ -74,7 +70,7 @@ sections:
|
|
|
74
70
|
- level: should
|
|
75
71
|
statement: Keep titles short. Aim for one line at the target container width.
|
|
76
72
|
- level: should
|
|
77
|
-
statement: Use `
|
|
73
|
+
statement: Use `subtext` for metadata, not for key actions or status.
|
|
78
74
|
- refs:
|
|
79
75
|
- to: content-guidelines#plain-language
|
|
80
76
|
rel: same-as
|
|
@@ -85,9 +81,9 @@ sections:
|
|
|
85
81
|
items:
|
|
86
82
|
- id: list-item-image-alt-required
|
|
87
83
|
level: must
|
|
88
|
-
statement: Always pass `alt` on `List.ItemImage`. Use `alt=""` only if the image is decorative and the
|
|
84
|
+
statement: Always pass `alt` on `List.ItemImage`. Use `alt=""` only if the image is decorative and the row's text already describes the item.
|
|
89
85
|
- level: must
|
|
90
|
-
statement:
|
|
86
|
+
statement: Every List.ItemButton needs a visible name from `text` or its children. An image with `alt=""` does not name the row.
|
|
91
87
|
- level: should
|
|
92
88
|
statement: '`List` renders as `<ul>` by default. Use `as="ol"` when order is meaningful.'
|
|
93
89
|
- level: must-not
|
|
@@ -96,7 +92,7 @@ sections:
|
|
|
96
92
|
alternatives:
|
|
97
93
|
- to: v-stack
|
|
98
94
|
note: Plain vertical stacking without list semantics
|
|
99
|
-
- to: list-button
|
|
95
|
+
- to: list-item-button
|
|
100
96
|
note: Action rows inside a Popover
|
|
101
97
|
refs:
|
|
102
98
|
- href: https://www.figma.com/design/5mhVqXlldJEEB2VWZeKQ4i/Sanity-UI?node-id=32244-2
|
|
@@ -104,18 +100,18 @@ refs:
|
|
|
104
100
|
role: Figma component (v5)
|
|
105
101
|
- to: space
|
|
106
102
|
rel: relates-to
|
|
107
|
-
- to: list-
|
|
103
|
+
- to: list-item
|
|
108
104
|
rel: relates-to
|
|
109
|
-
note:
|
|
105
|
+
note: The non-interactive row
|
|
106
|
+
- to: list-item-button
|
|
107
|
+
rel: relates-to
|
|
108
|
+
note: The interactive row. Also the action row inside a Popover
|
|
110
109
|
- to: badge
|
|
111
110
|
rel: relates-to
|
|
112
111
|
note: Good as an `end` element for status indicators
|
|
113
|
-
- to: list-button-item
|
|
114
|
-
rel: relates-to
|
|
115
|
-
note: The interactive/selectable variant of **List.Item**
|
|
116
112
|
- to: avatar
|
|
117
113
|
rel: relates-to
|
|
118
|
-
note: Good as a start element before
|
|
114
|
+
note: Good as a start element before the row text
|
|
119
115
|
sourceFiles:
|
|
120
116
|
- platform: react
|
|
121
117
|
file: packages/ui/src/components/list/List.tsx
|
|
@@ -133,12 +129,12 @@ $extensions:
|
|
|
133
129
|
guidance: |-
|
|
134
130
|
List is new in v5, with no direct v3 match. v3 list patterns were built with `Stack` \+ `Card` or custom `<ul>/<li>` markup.
|
|
135
131
|
|
|
136
|
-
The new `List` formalizes that pattern. It adds built-in density, start
|
|
132
|
+
The new `List` formalizes that pattern. It adds built-in density, start and end slots on the interactive row, and an image slot.
|
|
137
133
|
|
|
138
134
|
### **Key differences**
|
|
139
135
|
|
|
140
|
-
- `List.Item` handles its own
|
|
141
|
-
- `List.
|
|
136
|
+
- `List.Item` is a plain `<li>`. It handles no layout of its own beyond the text style. No need to wrap rows in `Card` or `Box` for spacing.
|
|
137
|
+
- `List.ItemButton` is the interactive row. It takes `text` and `subtext` for its labels, so there is no separate text component.
|
|
142
138
|
- `List.ItemImage` provides a standard thumbnail slot with fixed sizing and rounded corners.
|
|
143
139
|
|
|
144
140
|
### **If you used Stack \+ Card rows**
|
|
@@ -153,10 +149,10 @@ $extensions:
|
|
|
153
149
|
</Card>
|
|
154
150
|
</Stack>
|
|
155
151
|
|
|
156
|
-
// v5 equivalent
|
|
152
|
+
// v5 equivalent: an interactive row
|
|
157
153
|
<List>
|
|
158
154
|
<List.Item>
|
|
159
|
-
<List.
|
|
155
|
+
<List.ItemButton text={item.title} onClick={handleOpen} />
|
|
160
156
|
</List.Item>
|
|
161
157
|
</List>
|
|
162
158
|
```
|
|
@@ -19,9 +19,9 @@ sections:
|
|
|
19
19
|
- level: should-not
|
|
20
20
|
statement: To display critical information the user needs for their workflow.
|
|
21
21
|
- level: should-not
|
|
22
|
-
statement: To provide a standard list of options in a contextual menu. Use a List with List.
|
|
22
|
+
statement: To provide a standard list of options in a contextual menu. Use a List with List.ItemButton inside this Popover instead.
|
|
23
23
|
alternatives:
|
|
24
|
-
- to: list-button
|
|
24
|
+
- to: list-item-button
|
|
25
25
|
- level: must-not
|
|
26
26
|
statement: To display helper text via hover or focus. Use Tooltip instead.
|
|
27
27
|
alternatives:
|
|
@@ -97,7 +97,7 @@ alternatives:
|
|
|
97
97
|
note: Use when the content must block the rest of the page or gate a task
|
|
98
98
|
- to: tooltip
|
|
99
99
|
note: Use when the floating content is a short, non-interactive label. Share a trigger with a Popover via `anchorName`
|
|
100
|
-
- to: list-button
|
|
100
|
+
- to: list-item-button
|
|
101
101
|
refs:
|
|
102
102
|
- href: https://www.figma.com/design/5mhVqXlldJEEB2VWZeKQ4i/Sanity-UI?node-id=33949-674
|
|
103
103
|
rel: design
|
|
@@ -43,7 +43,7 @@ sections:
|
|
|
43
43
|
- to: tabs
|
|
44
44
|
- level: should-not
|
|
45
45
|
statement: To wrap another interactive element (Button inside PressArea, PressArea inside PressArea). Nested interactives fail screen reader expectations (WCAG 4.1.2 A).
|
|
46
|
-
- id:
|
|
46
|
+
- id: press-area-no-backdrop
|
|
47
47
|
level: must-not
|
|
48
48
|
statement: "As a non-interactive backdrop, dialog overlay, or plain layout wrapper. PressArea must be activatable and cannot render as='div' — for a non-interactive surface use a styled Box."
|
|
49
49
|
alternatives:
|
|
@@ -75,7 +75,7 @@ sections:
|
|
|
75
75
|
statement: Give every PressArea an accessible name. Visible child text serves as the name; for purely visual content (icon-only press, captionless avatar) provide an aria-label that describes the action.
|
|
76
76
|
- level: must
|
|
77
77
|
statement: Use PressArea only for interactive surfaces — a real press target. Never use it as a non-interactive backdrop, dialog overlay, or layout wrapper; render a styled Box for those.
|
|
78
|
-
- id:
|
|
78
|
+
- id: press-area-constrained-as
|
|
79
79
|
level: must
|
|
80
80
|
statement: Keep as constrained to 'button', 'a', or a React component. InteractiveAs<T> rejects arbitrary tags like 'div' or 'span'. Passing as='div' produces the error "Type 'string' is not assignable to type 'undefined'" — switch to 'button'/'a', or use Box if the element is not interactive.
|
|
81
81
|
- level: should
|
|
@@ -240,7 +240,7 @@ refs:
|
|
|
240
240
|
- to: card
|
|
241
241
|
rel: relates-to
|
|
242
242
|
note: Visual content surface. Often the child of PressArea when the whole card should be interactive
|
|
243
|
-
- to: list-button
|
|
243
|
+
- to: list-item-button
|
|
244
244
|
rel: relates-to
|
|
245
245
|
note: Action trigger inside a Popover list
|
|
246
246
|
sourceFiles:
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
kind: component
|
|
2
|
+
id: search-input
|
|
3
|
+
name: SearchInput
|
|
4
|
+
description: A single-line search field with a search icon, a clear button and a loading state.
|
|
5
|
+
metadata:
|
|
6
|
+
tags: [search, input, form, search field, filter, query, loading, clear]
|
|
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: To find specific content by typed text, as a search or filter action.
|
|
17
|
+
- level: should-not
|
|
18
|
+
statement: For freeform text that is not used for search or filtering. Use TextInput instead.
|
|
19
|
+
alternatives:
|
|
20
|
+
- to: text-input
|
|
21
|
+
- kind: guidelines
|
|
22
|
+
for: all
|
|
23
|
+
framing: how-to-use
|
|
24
|
+
items:
|
|
25
|
+
- refs:
|
|
26
|
+
- to: forms#pair-with-visible-label
|
|
27
|
+
rel: same-as
|
|
28
|
+
- level: must
|
|
29
|
+
statement: Give every SearchInput an accessible name, with a visible label or `aria-label`.
|
|
30
|
+
- refs:
|
|
31
|
+
- to: forms#placeholder-not-a-label
|
|
32
|
+
rel: same-as
|
|
33
|
+
- level: should
|
|
34
|
+
statement: Use `loading` while results for the current query are pending. It swaps the search icon for a spinner and sets `aria-busy="true"` on the input. Pass it only while a request is in flight.
|
|
35
|
+
- level: should
|
|
36
|
+
statement: Use `density="loose"` when searching requires more visual weight.
|
|
37
|
+
- kind: guidelines
|
|
38
|
+
for: agent
|
|
39
|
+
framing: how-to-use
|
|
40
|
+
items:
|
|
41
|
+
- level: should
|
|
42
|
+
statement: Handle the clear button through `onChange`. Clearing dispatches a native input event with an empty value, so `onChange` runs with `''`. Don't add a separate reset button for the same action.
|
|
43
|
+
- level: must-not
|
|
44
|
+
statement: Don't set `type` on SearchInput. It always renders `type="search"`, and the prop is removed from its type.
|
|
45
|
+
- level: must-not
|
|
46
|
+
statement: Don't rely on the default placeholder. It is a space, so it exists to keep the clear button's logic working, not to tell the user anything.
|
|
47
|
+
- kind: guidelines
|
|
48
|
+
for: all
|
|
49
|
+
title: Accessibility
|
|
50
|
+
tags: [accessibility]
|
|
51
|
+
items:
|
|
52
|
+
- level: must
|
|
53
|
+
statement: The clear button is labelled "Clear search query" in English. The label is fixed and can't be changed through props, so use this component only where that English label is acceptable.
|
|
54
|
+
- level: should
|
|
55
|
+
statement: The clear button shows only when the field has a value and is editable. Don't expect it on an empty or read-only field.
|
|
56
|
+
- refs:
|
|
57
|
+
- to: forms#programmatic-name-required
|
|
58
|
+
rel: same-as
|
|
59
|
+
- kind: section
|
|
60
|
+
for: agent
|
|
61
|
+
freeform:
|
|
62
|
+
- title: Examples
|
|
63
|
+
body: |-
|
|
64
|
+
A labelled search field that follows a query:
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
import {SearchInput} from '@sanity/ui'
|
|
68
|
+
|
|
69
|
+
<SearchInput
|
|
70
|
+
aria-label="Search documents"
|
|
71
|
+
placeholder="Search documents"
|
|
72
|
+
value={query}
|
|
73
|
+
onChange={(event) => setQuery(event.currentTarget.value)}
|
|
74
|
+
loading={isSearching}
|
|
75
|
+
/>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
The clear button does not need its own handler. Clearing the field runs `onChange` with an empty value.
|
|
79
|
+
refs:
|
|
80
|
+
- to: text-input
|
|
81
|
+
rel: relates-to
|
|
82
|
+
note: Freeform single-line text that is not a search
|
|
83
|
+
- to: select
|
|
84
|
+
rel: relates-to
|
|
85
|
+
note: Choosing one value from a fixed set
|
|
86
|
+
- to: spinner
|
|
87
|
+
rel: relates-to
|
|
88
|
+
note: The loading indicator that replaces the search icon
|
|
89
|
+
sourceFiles:
|
|
90
|
+
- platform: react
|
|
91
|
+
file: packages/ui/src/components/search-input/SearchInput.tsx
|
|
92
|
+
imports:
|
|
93
|
+
- platform: react
|
|
94
|
+
code: import { SearchInput } from '@sanity/ui'
|
|
95
|
+
package: '@sanity/ui'
|
|
96
|
+
traits:
|
|
97
|
+
- traitType: state
|
|
98
|
+
kind: boolean
|
|
99
|
+
id: loading
|
|
100
|
+
description: Shows a spinner in place of the search icon and sets aria-busy on the input while results are pending.
|
|
101
|
+
- traitType: variant
|
|
102
|
+
kind: enum
|
|
103
|
+
id: density
|
|
104
|
+
description: Sets the field's density. Form fields accept regular and loose only.
|
|
105
|
+
values:
|
|
106
|
+
- id: regular
|
|
107
|
+
description: Default density.
|
|
108
|
+
- id: loose
|
|
109
|
+
description: Wider spacing, for forms with generous layouts.
|
|
110
|
+
|
|
111
|
+
$extensions:
|
|
112
|
+
com.sanity.ui:
|
|
113
|
+
implementationStatus:
|
|
114
|
+
context: Implementation status. Lets a tool tell a component that is coming from one that does not exist, without parsing the status note.
|
|
115
|
+
implemented: true
|
|
@@ -45,7 +45,7 @@ sections:
|
|
|
45
45
|
for: all
|
|
46
46
|
framing: how-to-use
|
|
47
47
|
items:
|
|
48
|
-
- id:
|
|
48
|
+
- id: select-options-as-children
|
|
49
49
|
level: must
|
|
50
50
|
statement: Pass the options as children. Select renders a native `select`. Each option is an `option` element, and `optgroup` groups them.
|
|
51
51
|
checkedBy: manual
|
|
@@ -17,7 +17,7 @@ sections:
|
|
|
17
17
|
- id: tabpanel-value-matches-tab
|
|
18
18
|
level: must
|
|
19
19
|
statement: Give Tabs.Panel the same value as its Tabs.Tab.
|
|
20
|
-
- id:
|
|
20
|
+
- id: panel-no-conditional-render
|
|
21
21
|
level: must-not
|
|
22
22
|
statement: "Don't render Tabs.Panel conditionally. Unselected panels stay mounted with display none. Their content keeps its state."
|
|
23
23
|
- level: should
|
|
@@ -27,7 +27,7 @@ sections:
|
|
|
27
27
|
- refs:
|
|
28
28
|
- to: tooltip#no-tooltip-on-disabled
|
|
29
29
|
rel: same-as
|
|
30
|
-
- id: tooltip-
|
|
30
|
+
- id: tooltip-interactive-only
|
|
31
31
|
level: must-not
|
|
32
32
|
statement: Never use Tooltip on a non-interactive element — text, a Badge, an Indicator, an Avatar, a bare Icon, or a Box or Card. Its trigger must be a button, a link, or a PressArea. Either put the information in visible text or wrap the non-interactive element in a PressArea.
|
|
33
33
|
- kind: guidelines
|
|
@@ -35,11 +35,11 @@ sections:
|
|
|
35
35
|
statement: "Size the gap to the content: {space-1} between a label and its input, {space-3} between form fields, and {space-4} or more between sections. The full scale is in the Space scale entry's table (`space`)."
|
|
36
36
|
- level: should
|
|
37
37
|
statement: Wrap VStack with Box when padding or margin values are needed.
|
|
38
|
-
- id:
|
|
38
|
+
- id: vstack-no-flex-props
|
|
39
39
|
level: must-not
|
|
40
40
|
statement: "Don't use VStack when you need alignItems, justifyContent, flexWrap, or any other flex prop — use Flex with flexDirection='column'. VStack only accepts `as` and `gap`. Passing any other prop is a TypeScript error."
|
|
41
41
|
refines:
|
|
42
|
-
- to: v-stack#
|
|
42
|
+
- to: v-stack#no-vstack-for-centering
|
|
43
43
|
- level: must-not
|
|
44
44
|
statement: Don't add margin to children for spacing — use gap.
|
|
45
45
|
- kind: guidelines
|
|
@@ -49,6 +49,7 @@ sections:
|
|
|
49
49
|
- level: must-not
|
|
50
50
|
statement: "VStack accepts only as and gap. Don't pass any other prop directly as a JSX attribute (padding, tone, width/height, position, border, alignItems, justifyContent, flexGrow, overflowY)."
|
|
51
51
|
- level: must-not
|
|
52
|
+
id: no-vstack-for-centering
|
|
52
53
|
statement: 'Do not use VStack for centered or space-between layouts. Use `<Flex flexDirection="column" justifyContent="center">` instead. Instead: Use Flex with flexDirection=''column'' and the appropriate alignItems or justifyContent.'
|
|
53
54
|
|
|
54
55
|
- kind: guidelines
|
|
@@ -80,7 +80,7 @@ sections:
|
|
|
80
80
|
items:
|
|
81
81
|
- level: should
|
|
82
82
|
statement: VisuallyHidden does not make its children non-focusable. If you put a `<button>` or `<a>` inside, it stays keyboard-reachable — and users get a focus ring on something they can't see. Avoid putting focusable elements inside VisuallyHidden. If you need a hidden control, use `tabIndex={-1}`.
|
|
83
|
-
- id: visuallyhidden-
|
|
83
|
+
- id: visuallyhidden-not-label
|
|
84
84
|
level: should
|
|
85
85
|
statement: VisuallyHidden does not replace `aria-label`. Prefer `aria-label` for short, fixed strings (`aria-label="Close"`). Prefer VisuallyHidden when the content includes dynamic data, formatting, or multiple elements (`<VisuallyHidden>Sort by date, descending</VisuallyHidden>`).
|
|
86
86
|
|
|
@@ -42,7 +42,7 @@ sections:
|
|
|
42
42
|
- to: accessibility-guidelines#contrast-minimums
|
|
43
43
|
rel: same-as
|
|
44
44
|
- refs:
|
|
45
|
-
- to: shared-foundations#destructive-
|
|
45
|
+
- to: shared-foundations#destructive-critical-tone
|
|
46
46
|
rel: same-as
|
|
47
47
|
- level: should
|
|
48
48
|
statement: The palette is as small as the job allows.
|
|
@@ -180,14 +180,14 @@ sections:
|
|
|
180
180
|
|
|
181
181
|
**Hover:** Calculated as a brightness shift — darker in light mode, lighter in dark mode. These colors are dynamically calculated from the base color.
|
|
182
182
|
|
|
183
|
-
**The active family (`active-*`):**
|
|
183
|
+
**The active family (`active-*`):** Selected and checked states use gray, not a hue. Active tokens have two parts: background and foreground, and two emphasis levels.
|
|
184
184
|
|
|
185
|
-
- *
|
|
186
|
-
- *
|
|
185
|
+
- *Emphasized* (`--active-background-emphasized` with `--active-foreground-emphasized`): marks an on state. Checked checkboxes, radios and switches use it, and so does the current row in a List. The background is high-contrast gray, and the foreground is white in light mode and gray-950 in dark mode.
|
|
186
|
+
- *Normal* (`--active-background-normal` with `--active-foreground-normal`): the lighter pair, for lower-emphasis selection.
|
|
187
187
|
|
|
188
|
-
**
|
|
188
|
+
**Focus is not part of the active family.** A focused element gets a 2px halo outline from `--focus-outline`, offset by `--focus-offset`. The halo is blue: a darker blue in light mode and a lighter blue in dark mode.
|
|
189
189
|
|
|
190
|
-
**The inert family (`inert-*`):** represents elements that aren't interactive. Inert tokens have two parts: background and foreground.
|
|
190
|
+
**The inert family (`inert-*`):** represents elements that aren't interactive. Inert tokens have two parts: background and foreground. The inert background is 12.5% gray (`hsl(from var(--gray-500) h s l / 0.125)`), so it tints the surface behind it in both modes instead of setting a fixed colour. The inert foreground is gray-400 in light mode and gray-500 in dark mode.
|
|
191
191
|
|
|
192
192
|
- *Read-only:* Read-only elements use an inert background only. The inert background signals the element can't be edited, but the text can still be read and selected.
|
|
193
193
|
- *Disabled:* Disabled elements use inert background and foreground to represent that the entire element provides no interaction.
|
package/docs/index.dsds.yaml
CHANGED
|
@@ -66,7 +66,7 @@ shared:
|
|
|
66
66
|
checkedBy: assisted
|
|
67
67
|
refines:
|
|
68
68
|
- to: button#button-icon-only-accessible-name
|
|
69
|
-
- to: quick-start#
|
|
69
|
+
- to: quick-start#icon-only-aria-label
|
|
70
70
|
$extensions:
|
|
71
71
|
io.jev:
|
|
72
72
|
type: boolean
|
|
@@ -83,7 +83,7 @@ shared:
|
|
|
83
83
|
- id: inner-spacing-smaller-than-outer
|
|
84
84
|
level: must
|
|
85
85
|
statement: Inner spacing within a group must be smaller than the space around it, by at least one step on the scale. Equal inner and outer spacing hides that the container is one group.
|
|
86
|
-
- id: destructive-
|
|
86
|
+
- id: destructive-critical-tone
|
|
87
87
|
level: must
|
|
88
88
|
statement: A destructive action should use `tone="critical"`. Destructive means the action removes data — delete, archive, revoke, terminate. All destructive actions should display an icon that reads as destructive and use a verb in the label naming what is lost.
|
|
89
89
|
checks:
|
|
@@ -92,7 +92,7 @@ shared:
|
|
|
92
92
|
checkedBy: assisted
|
|
93
93
|
refines:
|
|
94
94
|
- to: button#most-buttons-tertiary
|
|
95
|
-
- to: layouts#
|
|
95
|
+
- to: layouts#destructive-critical-icon
|
|
96
96
|
$extensions:
|
|
97
97
|
io.jev:
|
|
98
98
|
type: boolean
|
|
@@ -106,7 +106,7 @@ shared:
|
|
|
106
106
|
refs:
|
|
107
107
|
- to: shared-foundations#tone-paired-with-second-channel
|
|
108
108
|
rel: relates-to
|
|
109
|
-
- to: shared-foundations#destructive-
|
|
109
|
+
- to: shared-foundations#destructive-critical-tone
|
|
110
110
|
rel: relates-to
|
|
111
111
|
$extensions:
|
|
112
112
|
io.jev:
|
|
@@ -126,32 +126,32 @@ shared:
|
|
|
126
126
|
$extensions:
|
|
127
127
|
io.jev:
|
|
128
128
|
type: boolean
|
|
129
|
-
- id: form-
|
|
129
|
+
- id: form-visible-label-name
|
|
130
130
|
level: should
|
|
131
131
|
statement: Name a Checkbox, Radio or Switch through a linked label element (id and htmlFor), aria-label or aria-labelledby. These controls render no label of their own, so the name must come from one of these.
|
|
132
|
-
- id: form-
|
|
132
|
+
- id: form-rows-visually-hidden
|
|
133
133
|
level: should
|
|
134
134
|
statement: When the visible label would repeat across rows, wrap a fully descriptive label in `VisuallyHidden` rather than showing the repeated text. The linked label element is the accessible name, so hiding a more descriptive version of its text keeps a single accessible name in the DOM instead of introducing a second, separately maintained one.
|
|
135
|
-
- id: form-
|
|
135
|
+
- id: form-aria-label-fallback
|
|
136
136
|
level: should
|
|
137
137
|
statement: Use `aria-label` or `aria-labelledby` only when the label content can't be restructured that way — for example, when the descriptive text already exists elsewhere in the DOM. Both attributes forward straight to the underlying `<input>`, but they create a second source of the accessible name that can drift out of sync with the visible label.
|
|
138
138
|
refines:
|
|
139
139
|
- to: forms#aria-label-overrides-name
|
|
140
|
-
- id: form-
|
|
140
|
+
- id: form-aria-label-visible-text
|
|
141
141
|
level: should
|
|
142
142
|
statement: When setting `aria-label` on a Checkbox, Radio or Switch, include the visible `label` text inside it. This satisfies WCAG 2.5.3 (Label in Name). Voice-control users can then target the control by what they see on screen.
|
|
143
143
|
- id: least-that-does-the-job
|
|
144
144
|
level: should
|
|
145
145
|
statement: "Use the least that does the job. Each foundation provides a constrained set: a spacing scale, a tone family, motion tokens, and elevation levels. The set exists so you don't invent. One emphasized element draws attention; three cancel each other out."
|
|
146
146
|
refines:
|
|
147
|
-
- to: shared-foundations#
|
|
147
|
+
- to: shared-foundations#constrained-tokens
|
|
148
148
|
- id: define-state-model-first
|
|
149
149
|
level: should
|
|
150
150
|
statement: Define the complete state model before any visual design. Name every state, every transition, and every copy slot. A spec is not done until all keyboard behaviors are defined, all states are verifiable, and all ARIA properties are assigned.
|
|
151
151
|
- id: every-choice-has-a-job
|
|
152
152
|
level: should
|
|
153
153
|
statement: Every design choice should have a job. Color communicates status. Motion marks a state change. Icons support recognition. Elevation signals layering. If a choice has no named job, leave it out.
|
|
154
|
-
- id: prefer-component-over-native
|
|
154
|
+
- id: prefer-component-over-native
|
|
155
155
|
level: should
|
|
156
156
|
statement: 'Reach for the design-system component before a native element that has a direct equivalent: `Box` (or `VStack`/`HStack`/`Flex`/`Grid`) instead of `div`, `Text` instead of `p` or `span`, `Heading` instead of `h1`–`h6`, `Button` instead of `button`, `Link` instead of `a`, `List` instead of `ul`/`ol`, `Divider` instead of `hr`. A native element used where a component exists opts out of the theme, the spacing scale, and the accessibility behaviour the component already carries. Elements with no component equivalent stay native — `table` and its parts, `form`, `section`, `main`, `label`.'
|
|
157
157
|
checks:
|
|
@@ -194,7 +194,7 @@ shared:
|
|
|
194
194
|
role: agent-test
|
|
195
195
|
checkedBy: assisted
|
|
196
196
|
refines:
|
|
197
|
-
- to: button#
|
|
197
|
+
- to: button#text-label-required
|
|
198
198
|
$extensions:
|
|
199
199
|
io.jev:
|
|
200
200
|
type: boolean
|
|
@@ -203,6 +203,7 @@ shared:
|
|
|
203
203
|
framing: how-to-use
|
|
204
204
|
items:
|
|
205
205
|
- level: must
|
|
206
|
+
id: constrained-tokens
|
|
206
207
|
statement: 'Use the constrained token set: spacing scale, tone family, motion tokens, elevation levels. Do not invent custom values outside the system.'
|
|
207
208
|
- level: should
|
|
208
209
|
statement: Design token values ship from `@sanity-labs/design-tokens` as DTCG tokens and CSS custom properties. Each token group has a file in the package's `docs/tokens/` folder, with its values in `docs/tokens/dtcg/json/`. The groups are `color`, `container-widths`, `font-family`, `font-weight`, `radius`, `semantic`, `shadow`, `space` and `typography`.
|
|
@@ -250,9 +251,9 @@ shared:
|
|
|
250
251
|
- id: shell-min-height-not-height
|
|
251
252
|
level: must
|
|
252
253
|
statement: Use `minHeight="100vh"` on the outer container, not `height="100vh"`. `height` stops the layout from growing taller than the viewport.
|
|
253
|
-
- id:
|
|
254
|
+
- id: current-marks-active-row
|
|
254
255
|
level: must
|
|
255
|
-
statement: '
|
|
256
|
+
statement: 'Mark the active List.ItemButton with `current={isActive}`. It sets `aria-current="true"` and the active style. Only the value true is styled, so don''t pass a string such as "page" and expect the active look.'
|
|
256
257
|
- id: navigating-row-is-a-link
|
|
257
258
|
level: must
|
|
258
259
|
statement: 'A row that navigates renders as a link: pass `as="a"` and `href`, not `onClick`. Middle-click and "Open in new tab" then work.'
|
|
@@ -268,7 +269,7 @@ shared:
|
|
|
268
269
|
type: boolean
|
|
269
270
|
- id: card-has-no-onclick
|
|
270
271
|
level: must-not
|
|
271
|
-
statement: Do not put `onClick` on Card; it has none. To make a card clickable, wrap its content in PressArea, which renders a real `<button>` or `<a>`, or use a List.
|
|
272
|
+
statement: Do not put `onClick` on Card; it has none. To make a card clickable, wrap its content in PressArea, which renders a real `<button>` or `<a>`, or use a List.ItemButton row.
|
|
272
273
|
- id: table-not-simulated-with-flex
|
|
273
274
|
level: must-not
|
|
274
275
|
statement: Do not use Flex or Grid to simulate a table. It has no row or cell semantics, so screen readers cannot announce row counts or move by column.
|
|
@@ -348,15 +349,12 @@ refs:
|
|
|
348
349
|
- href: ./components/link.dsds.yaml
|
|
349
350
|
rel: file
|
|
350
351
|
role: Link
|
|
351
|
-
- href: ./components/list-button
|
|
352
|
+
- href: ./components/list-item-button.dsds.yaml
|
|
352
353
|
rel: file
|
|
353
|
-
role: List.
|
|
354
|
+
role: List.ItemButton
|
|
354
355
|
- href: ./components/list-item-image.dsds.yaml
|
|
355
356
|
rel: file
|
|
356
357
|
role: List.ItemImage
|
|
357
|
-
- href: ./components/list-item-text.dsds.yaml
|
|
358
|
-
rel: file
|
|
359
|
-
role: List.ItemText
|
|
360
358
|
- href: ./components/list-item.dsds.yaml
|
|
361
359
|
rel: file
|
|
362
360
|
role: List.Item
|
|
@@ -405,6 +403,9 @@ refs:
|
|
|
405
403
|
- href: ./components/text-input.dsds.yaml
|
|
406
404
|
rel: file
|
|
407
405
|
role: TextInput
|
|
406
|
+
- href: ./components/search-input.dsds.yaml
|
|
407
|
+
rel: file
|
|
408
|
+
role: SearchInput
|
|
408
409
|
- href: ./components/tooltip-group.dsds.yaml
|
|
409
410
|
rel: file
|
|
410
411
|
role: TooltipGroup
|
|
@@ -153,7 +153,7 @@ sections:
|
|
|
153
153
|
visible effect, check for a spread like this first.
|
|
154
154
|
- level: must-not
|
|
155
155
|
statement: Do not put `flexDirection`, `alignItems`, `justifyContent` or `flexWrap` on `Box`. They belong to `Flex`. On `Box` they are a TypeScript error, not a setting that quietly does nothing.
|
|
156
|
-
- id: no-layout-props-
|
|
156
|
+
- id: no-layout-props-actions
|
|
157
157
|
level: must-not
|
|
158
158
|
statement: >-
|
|
159
159
|
Button and IconButton accept no layout, spacing or sizing props —
|
|
@@ -186,7 +186,7 @@ sections:
|
|
|
186
186
|
- level: must
|
|
187
187
|
statement: Do not import an icon from the package root. The root ships a type-only stub. The import passes `tsc` and then fails in the browser.
|
|
188
188
|
- level: must
|
|
189
|
-
statement: Import `List` alone and reach its parts through dot access, as in `<List.Item>` and `<List.
|
|
189
|
+
statement: Import `List` alone and reach its parts through dot access, as in `<List.Item>` and `<List.ItemButton>`. `ListItem` is not an export.
|
|
190
190
|
- id: choose-icons-from-icons-entry
|
|
191
191
|
level: should
|
|
192
192
|
statement: >-
|
|
@@ -83,13 +83,10 @@ sections:
|
|
|
83
83
|
- to: list-item
|
|
84
84
|
rel: relates-to
|
|
85
85
|
role: beta
|
|
86
|
-
- to: list-item-text
|
|
87
|
-
rel: relates-to
|
|
88
|
-
role: beta
|
|
89
86
|
- to: list-item-image
|
|
90
87
|
rel: relates-to
|
|
91
88
|
role: beta
|
|
92
|
-
- to: list-button
|
|
89
|
+
- to: list-item-button
|
|
93
90
|
rel: relates-to
|
|
94
91
|
role: beta
|
|
95
92
|
- to: avatar-stack
|
|
@@ -184,6 +181,9 @@ sections:
|
|
|
184
181
|
- to: text-input
|
|
185
182
|
rel: relates-to
|
|
186
183
|
role: beta
|
|
184
|
+
- to: search-input
|
|
185
|
+
rel: relates-to
|
|
186
|
+
role: beta
|
|
187
187
|
- to: text-area
|
|
188
188
|
rel: relates-to
|
|
189
189
|
role: beta
|
|
@@ -35,6 +35,7 @@ sections:
|
|
|
35
35
|
- level: must
|
|
36
36
|
statement: Add `flexWrap="wrap"` to every `Flex` with two or more children to prevent overflow at 320px.
|
|
37
37
|
- level: must
|
|
38
|
+
id: icon-only-aria-label
|
|
38
39
|
statement: Add `aria-label` to every icon-only button. A tooltip does not set an accessible name.
|
|
39
40
|
- level: should
|
|
40
41
|
statement: Use `VStack` for simple vertical lists with even spacing. Use `Flex flexDirection="column"` when you need `flexGrow`, `overflow`, `minHeight`, or full flex control.
|
|
@@ -26,11 +26,11 @@ sections:
|
|
|
26
26
|
items:
|
|
27
27
|
- level: must
|
|
28
28
|
statement: Anchor the inline confirm popover to the triggering element, not the viewport center. That's what makes it read as "confirming this row," not "confirming something."
|
|
29
|
-
- id:
|
|
29
|
+
- id: confirm-destructive-critical
|
|
30
30
|
level: must
|
|
31
31
|
statement: Default destructive confirms to `tone="critical"` on both the popover's accent and the confirm button, and give the confirm button `level="primary"`. The confirm button is the most important action on a confirmation surface — that is what the surface exists for — so it carries the primary level alongside the critical tone. Cancel is the secondary or tertiary action.
|
|
32
32
|
refines:
|
|
33
|
-
- to: shared-foundations#destructive-
|
|
33
|
+
- to: shared-foundations#destructive-critical-tone
|
|
34
34
|
- level: must
|
|
35
35
|
statement: 'Disable or hide the confirm action until an async impact check resolves — for example, counting how many other documents reference this one, or checking permissions. Once it resolves, name the consequence on the confirm button. A generic confirm gives a destructive action less friction than it needs, and lets someone confirm before they know what breaks.'
|
|
36
36
|
example:
|
|
@@ -38,7 +38,7 @@ sections:
|
|
|
38
38
|
ref:
|
|
39
39
|
href: ../examples/confirmation-dialogs-3.tsx
|
|
40
40
|
rel: source
|
|
41
|
-
- id:
|
|
41
|
+
- id: confirm-surface-escape
|
|
42
42
|
level: must
|
|
43
43
|
statement: Guarantee every confirmation surface a way out — Escape, click-outside, and an explicit Cancel/close control. A surface missing any of the three can trap whoever opened it.
|
|
44
44
|
- level: must
|