@sanity/ui 5.0.0-alpha.21 → 5.0.0-alpha.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/docs/components/avatar-counter.dsds.yaml +78 -0
- package/docs/components/avatar-stack.dsds.yaml +96 -0
- package/docs/components/avatar.dsds.yaml +115 -0
- package/docs/components/badge.dsds.yaml +126 -0
- package/docs/components/box.dsds.yaml +223 -0
- package/docs/components/button.dsds.yaml +284 -0
- package/docs/components/card.dsds.yaml +317 -0
- package/docs/components/checkbox.dsds.yaml +204 -0
- package/docs/components/code.dsds.yaml +167 -0
- package/docs/components/container.dsds.yaml +189 -0
- package/docs/components/dialog.dsds.yaml +343 -0
- package/docs/components/divider.dsds.yaml +93 -0
- package/docs/components/eyebrow.dsds.yaml +217 -0
- package/docs/components/flex.dsds.yaml +237 -0
- package/docs/components/grid.dsds.yaml +217 -0
- package/docs/components/h-stack.dsds.yaml +127 -0
- package/docs/components/heading.dsds.yaml +233 -0
- package/docs/components/hotkeys.dsds.yaml +60 -0
- package/docs/components/icon-button.dsds.yaml +220 -0
- package/docs/components/icon.dsds.yaml +275 -0
- package/docs/components/indicator-stack.dsds.yaml +98 -0
- package/docs/components/indicator.dsds.yaml +108 -0
- package/docs/components/inline.dsds.yaml +127 -0
- package/docs/components/kbd.dsds.yaml +59 -0
- package/docs/components/link.dsds.yaml +108 -0
- package/docs/components/list-button-item.dsds.yaml +103 -0
- package/docs/components/list-item-image.dsds.yaml +82 -0
- package/docs/components/list-item-text.dsds.yaml +80 -0
- package/docs/components/list-item.dsds.yaml +148 -0
- package/docs/components/list.dsds.yaml +162 -0
- package/docs/components/popover.dsds.yaml +208 -0
- package/docs/components/press-area.dsds.yaml +279 -0
- package/docs/components/radio.dsds.yaml +198 -0
- package/docs/components/select.dsds.yaml +214 -0
- package/docs/components/skip-to-content.dsds.yaml +110 -0
- package/docs/components/spinner.dsds.yaml +119 -0
- package/docs/components/switch.dsds.yaml +202 -0
- package/docs/components/tab.dsds.yaml +54 -0
- package/docs/components/tabs-list.dsds.yaml +56 -0
- package/docs/components/tabs-panel.dsds.yaml +54 -0
- package/docs/components/tabs.dsds.yaml +104 -0
- package/docs/components/text-area.dsds.yaml +170 -0
- package/docs/components/text-input.dsds.yaml +189 -0
- package/docs/components/text.dsds.yaml +268 -0
- package/docs/components/tooltip-group.dsds.yaml +90 -0
- package/docs/components/tooltip.dsds.yaml +216 -0
- package/docs/components/v-stack.dsds.yaml +155 -0
- package/docs/components/visually-hidden.dsds.yaml +112 -0
- package/docs/evals/cases.yaml +1319 -0
- package/docs/examples/checkbox-2.tsx +57 -0
- package/docs/examples/confirmation-dialogs-1.tsx +27 -0
- package/docs/examples/confirmation-dialogs-2.tsx +55 -0
- package/docs/examples/confirmation-dialogs-3.tsx +28 -0
- package/docs/examples/confirmation-dialogs-4.tsx +38 -0
- package/docs/examples/popover-1.tsx +48 -0
- package/docs/examples/popover-2.tsx +53 -0
- package/docs/foundations/accessibility-guidelines.dsds.yaml +301 -0
- package/docs/foundations/color-guidelines.dsds.yaml +308 -0
- package/docs/foundations/content-guidelines.dsds.yaml +285 -0
- package/docs/foundations/semantics.dsds.yaml +125 -0
- package/docs/foundations/spacing-guidelines.dsds.yaml +226 -0
- package/docs/foundations/typography-guidelines.dsds.yaml +322 -0
- package/docs/icons.dsds.yaml +2513 -0
- package/docs/index.dsds.yaml +515 -0
- package/docs/overview/api-essentials.dsds.yaml +221 -0
- package/docs/overview/component-reference.dsds.yaml +215 -0
- package/docs/overview/designer-contribution-model.dsds.yaml +77 -0
- package/docs/overview/developer-contribution-model.dsds.yaml +362 -0
- package/docs/overview/installation.dsds.yaml +238 -0
- package/docs/overview/quick-start.dsds.yaml +317 -0
- package/docs/overview/resources.dsds.yaml +34 -0
- package/docs/patterns/confirmation-dialogs.dsds.yaml +140 -0
- package/docs/patterns/error-messaging.dsds.yaml +58 -0
- package/docs/patterns/forms.dsds.yaml +356 -0
- package/docs/patterns/layouts.dsds.yaml +403 -0
- package/docs/patterns/loading-states.dsds.yaml +41 -0
- package/docs/patterns/messaging.dsds.yaml +72 -0
- package/docs/patterns/navigation.dsds.yaml +153 -0
- package/docs/patterns/responsive.dsds.yaml +590 -0
- package/docs/tokens/color.dsds.yaml +1158 -0
- package/docs/tokens/container-widths.dsds.yaml +131 -0
- package/docs/tokens/content.dsds.yaml +258 -0
- package/docs/tokens/content.tokens.json +180 -0
- package/docs/tokens/dtcg/README.md +39 -0
- package/docs/tokens/dtcg/css/color.css +107 -0
- package/docs/tokens/dtcg/css/container.css +12 -0
- package/docs/tokens/dtcg/css/fontFamily.css +10 -0
- package/docs/tokens/dtcg/css/fontWeight.css +10 -0
- package/docs/tokens/dtcg/css/index.css +13 -0
- package/docs/tokens/dtcg/css/radius.css +14 -0
- package/docs/tokens/dtcg/css/semantic.css +42 -0
- package/docs/tokens/dtcg/css/shadow.css +22 -0
- package/docs/tokens/dtcg/css/space.css +16 -0
- package/docs/tokens/dtcg/css/typography.css +69 -0
- package/docs/tokens/dtcg/json/color.tokens.json +911 -0
- package/docs/tokens/dtcg/json/container.tokens.json +44 -0
- package/docs/tokens/dtcg/json/fontFamily.tokens.json +10 -0
- package/docs/tokens/dtcg/json/fontWeight.tokens.json +18 -0
- package/docs/tokens/dtcg/json/radius.tokens.json +58 -0
- package/docs/tokens/dtcg/json/semantic.tokens.json +372 -0
- package/docs/tokens/dtcg/json/shadow.tokens.json +599 -0
- package/docs/tokens/dtcg/json/space.tokens.json +72 -0
- package/docs/tokens/dtcg/json/typography.tokens.json +354 -0
- package/docs/tokens/font-family.dsds.yaml +79 -0
- package/docs/tokens/font-weight.dsds.yaml +103 -0
- package/docs/tokens/radius.dsds.yaml +153 -0
- package/docs/tokens/semantic.dsds.yaml +397 -0
- package/docs/tokens/shadow.dsds.yaml +125 -0
- package/docs/tokens/space.dsds.yaml +185 -0
- package/docs/tokens/typography.dsds.yaml +316 -0
- package/llms.txt +108 -0
- package/package.json +6 -3
- package/skills/sanity-ui-5/SKILL.md +158 -0
- package/skills/sanity-ui-5/references/component-choice.md +37 -0
- package/skills/sanity-ui-5/references/components.md +145 -0
- package/skills/sanity-ui-5/references/forms-and-accessibility.md +189 -0
- package/skills/sanity-ui-5/references/migrating-from-v3.md +250 -0
- package/skills/sanity-ui-5/references/props-and-imports.md +169 -0
- package/skills/sanity-ui-5/references/setup.md +177 -0
- package/skills/sanity-ui-5/references/silent-failures.md +33 -0
- package/skills/sanity-ui-5/references/taste.md +53 -0
- package/skills/sanity-ui-5/references/tone-and-color.md +55 -0
- package/src/css/classes/system/shadow.css +45 -0
- package/src/version.ts +2 -2
|
@@ -0,0 +1,1319 @@
|
|
|
1
|
+
# Labelled cases for the guidelines that carry `rel: agent-test`.
|
|
2
|
+
#
|
|
3
|
+
# Shape follows ESLint's RuleTester, which eslint-plugin-sanity-ui already
|
|
4
|
+
# uses for the same rules: a case is explicitly valid or invalid for a named
|
|
5
|
+
# rule. Nothing is inferred from absence.
|
|
6
|
+
#
|
|
7
|
+
# kind `conforms` or `violates` — what this code does to the
|
|
8
|
+
# guidelines named below. A `must` guideline's natural
|
|
9
|
+
# illustration is a conforming case; a `must-not`'s is a
|
|
10
|
+
# violating one.
|
|
11
|
+
# guidelines the guideline item ids this case is evidence for. A case is
|
|
12
|
+
# UNLABELLED for any guideline it does not name — not a
|
|
13
|
+
# negative. Omission used to mean 'clean', which silently
|
|
14
|
+
# mislabelled every existing case whenever a guideline was
|
|
15
|
+
# added.
|
|
16
|
+
# code the snippet, or a list of snippets sharing this entry's kind
|
|
17
|
+
# and guidelines. Each is its own data point; the list only
|
|
18
|
+
# saves repeating the labels. Small on purpose: a case needing
|
|
19
|
+
# a screenful of context tests retrieval, not judgment.
|
|
20
|
+
#
|
|
21
|
+
# `guidelines` rather than `rules` because DSDS retires that word —
|
|
22
|
+
# terms.yaml: `use: item / not: entry, rule, criterion` — and because
|
|
23
|
+
# Tools/dsds-jev-eval already uses 'rules' for ESLint rule ids.
|
|
24
|
+
#
|
|
25
|
+
# To add a case: append one entry. To make another guideline assessable: add
|
|
26
|
+
# `checks`/`$extensions` to it in the corpus, then add at least one
|
|
27
|
+
# conforming and one violating case naming it here.
|
|
28
|
+
|
|
29
|
+
cases:
|
|
30
|
+
- kind: violates
|
|
31
|
+
guidelines: ['no-onclick-on-card']
|
|
32
|
+
code:
|
|
33
|
+
- |
|
|
34
|
+
import { Card, Text } from '@sanity/ui-v5'
|
|
35
|
+
export function Row({ item, onOpen }) {
|
|
36
|
+
return <Card onClick={() => onOpen(item)}><Text>{item.title}</Text></Card>
|
|
37
|
+
}
|
|
38
|
+
- |
|
|
39
|
+
import { Card, Text } from '@sanity/ui-v5'
|
|
40
|
+
export function ClickableCard({ item, onOpen }) {
|
|
41
|
+
return <Card padding={3} onClick={() => onOpen(item)}><Text>{item.title}</Text></Card>
|
|
42
|
+
}
|
|
43
|
+
- kind: conforms
|
|
44
|
+
guidelines: ['no-onclick-on-card']
|
|
45
|
+
code:
|
|
46
|
+
- |
|
|
47
|
+
import { Card, PressArea, Text } from '@sanity/ui-v5'
|
|
48
|
+
export function Row({ item, onOpen }) {
|
|
49
|
+
return <PressArea onClick={() => onOpen(item)} aria-label={`Open ${item.title}`}>
|
|
50
|
+
<Card><Text>{item.title}</Text></Card>
|
|
51
|
+
</PressArea>
|
|
52
|
+
}
|
|
53
|
+
- |
|
|
54
|
+
import { Card, PressArea, Text } from '@sanity/ui-v5'
|
|
55
|
+
export function ClickableCard({ item, onOpen }) {
|
|
56
|
+
return <PressArea onClick={() => onNavigate(item)} aria-label={`Go to ${item.title}`}>
|
|
57
|
+
<Card density="compact"><Text>Go to {item.title}</Text></Card>
|
|
58
|
+
</PressArea>
|
|
59
|
+
}
|
|
60
|
+
- kind: violates
|
|
61
|
+
guidelines: ['flex-no-onclick']
|
|
62
|
+
code:
|
|
63
|
+
- |
|
|
64
|
+
import { Flex, Text } from '@sanity/ui-v5'
|
|
65
|
+
export function Toolbar({ onSelect }) {
|
|
66
|
+
return <Flex gap={2} onClick={onSelect}><Text>Filter</Text></Flex>
|
|
67
|
+
}
|
|
68
|
+
- |
|
|
69
|
+
import { HStack, Text } from '@sanity/ui-v5'
|
|
70
|
+
export function Bar({ onOpen }) {
|
|
71
|
+
return <HStack gap={2} onClick={() => onOpen()}><Text>Open</Text></HStack>
|
|
72
|
+
}
|
|
73
|
+
- kind: conforms
|
|
74
|
+
guidelines: ['flex-no-onclick']
|
|
75
|
+
code:
|
|
76
|
+
- |
|
|
77
|
+
import { Button, Flex } from '@sanity/ui-v5'
|
|
78
|
+
export function Toolbar({ onSelect }) {
|
|
79
|
+
return <Flex gap={2}><Button text="Filter" onClick={onSelect} /></Flex>
|
|
80
|
+
}
|
|
81
|
+
- |
|
|
82
|
+
import { Flex, PressArea, Text } from '@sanity/ui-v5'
|
|
83
|
+
export function Toolbar({ onSelect }) {
|
|
84
|
+
return <PressArea onClick={onSelect}><Flex gap={2}><Text>Filter</Text></Flex>
|
|
85
|
+
}
|
|
86
|
+
- kind: violates
|
|
87
|
+
guidelines: ['spacing-is-an-integer-scale-token']
|
|
88
|
+
code: |
|
|
89
|
+
import { Box, Text } from '@sanity/ui-v5'
|
|
90
|
+
export function Panel() {
|
|
91
|
+
return <Box padding="2"><Text>Body</Text></Box>
|
|
92
|
+
}
|
|
93
|
+
- kind: conforms
|
|
94
|
+
guidelines: ['spacing-is-an-integer-scale-token']
|
|
95
|
+
code: |
|
|
96
|
+
import { Box, Text } from '@sanity/ui-v5'
|
|
97
|
+
export function Panel() {
|
|
98
|
+
return <Box padding={2}><Text>Body</Text></Box>
|
|
99
|
+
}
|
|
100
|
+
- kind: violates
|
|
101
|
+
guidelines: ['button-icon-only-accessible-name', 'icon-only-control-needs-name']
|
|
102
|
+
code: |
|
|
103
|
+
import { IconButton } from '@sanity/ui-v5'
|
|
104
|
+
import { TrashIcon } from '@sanity/icons/Trash'
|
|
105
|
+
export function DeleteAction({ onDelete }) {
|
|
106
|
+
return <IconButton icon={TrashIcon} onClick={onDelete} />
|
|
107
|
+
}
|
|
108
|
+
- kind: conforms
|
|
109
|
+
guidelines: ['button-icon-only-accessible-name', 'icon-only-control-needs-name']
|
|
110
|
+
code: |
|
|
111
|
+
import { IconButton } from '@sanity/ui-v5'
|
|
112
|
+
import { TrashIcon } from '@sanity/icons/Trash'
|
|
113
|
+
export function DeleteAction({ onDelete }) {
|
|
114
|
+
return <IconButton icon={TrashIcon} onClick={onDelete} aria-label="Delete item" />
|
|
115
|
+
}
|
|
116
|
+
- kind: violates
|
|
117
|
+
guidelines:
|
|
118
|
+
[
|
|
119
|
+
'button-icon-only-accessible-name',
|
|
120
|
+
'icon-not-sole-content-of-control',
|
|
121
|
+
'icon-only-control-needs-name',
|
|
122
|
+
]
|
|
123
|
+
code: |
|
|
124
|
+
import { Button, Icon } from '@sanity/ui-v5'
|
|
125
|
+
import { EditIcon } from '@sanity/icons/Edit'
|
|
126
|
+
export function EditAction({ onEdit }) {
|
|
127
|
+
return <Button onClick={onEdit}><Icon icon={EditIcon} /></Button>
|
|
128
|
+
}
|
|
129
|
+
- kind: conforms
|
|
130
|
+
guidelines:
|
|
131
|
+
[
|
|
132
|
+
'button-icon-only-accessible-name',
|
|
133
|
+
'icon-not-sole-content-of-control',
|
|
134
|
+
'icon-only-control-needs-name',
|
|
135
|
+
]
|
|
136
|
+
code:
|
|
137
|
+
- |
|
|
138
|
+
import { Button } from '@sanity/ui-v5'
|
|
139
|
+
import { EditIcon } from '@sanity/icons/Edit'
|
|
140
|
+
export function EditAction({ onEdit }) {
|
|
141
|
+
return <Button text="Edit" iconStart={EditIcon} onClick={onEdit} />
|
|
142
|
+
}
|
|
143
|
+
- |
|
|
144
|
+
import { IconButton } from '@sanity/ui-v5'
|
|
145
|
+
import { EditIcon } from '@sanity/icons/Edit'
|
|
146
|
+
export function EditAction({ onEdit }) {
|
|
147
|
+
return <IconButton icon={EditIcon} onClick={onEdit} aria-label="Edit" />
|
|
148
|
+
}
|
|
149
|
+
- kind: violates
|
|
150
|
+
guidelines: ['flex-no-inline-styles']
|
|
151
|
+
code: |
|
|
152
|
+
import { Flex, Text } from '@sanity/ui-v5'
|
|
153
|
+
export function Row() {
|
|
154
|
+
return <Flex style={{ gap: 8, alignItems: 'center' }}><Text>A</Text></Flex>
|
|
155
|
+
}
|
|
156
|
+
- kind: conforms
|
|
157
|
+
guidelines: ['flex-no-inline-styles']
|
|
158
|
+
code: |
|
|
159
|
+
import { Flex, Text } from '@sanity/ui-v5'
|
|
160
|
+
export function Row() {
|
|
161
|
+
return <Flex gap={2} alignItems="center"><Text>A</Text></Flex>
|
|
162
|
+
}
|
|
163
|
+
- kind: violates
|
|
164
|
+
guidelines: ['no-inline-style-for-spacing']
|
|
165
|
+
code: |
|
|
166
|
+
import { Card, Text } from '@sanity/ui-v5'
|
|
167
|
+
export function Panel() {
|
|
168
|
+
return <Card style={{ padding: 16, borderRadius: 6 }}><Text>Body</Text></Card>
|
|
169
|
+
}
|
|
170
|
+
- kind: conforms
|
|
171
|
+
guidelines: ['no-inline-style-for-spacing']
|
|
172
|
+
code: |
|
|
173
|
+
import { Card, Text } from '@sanity/ui-v5'
|
|
174
|
+
export function Panel() {
|
|
175
|
+
return <Card density="regular"><Text>Body</Text></Card>
|
|
176
|
+
}
|
|
177
|
+
- kind: violates
|
|
178
|
+
guidelines: ['button-not-hand-written-native']
|
|
179
|
+
code: |
|
|
180
|
+
export function SaveAction({ onSave, buttonRef }) {
|
|
181
|
+
return <button ref={buttonRef} onClick={onSave} className="save">Save</button>
|
|
182
|
+
}
|
|
183
|
+
- kind: conforms
|
|
184
|
+
guidelines: ['button-not-hand-written-native']
|
|
185
|
+
code: |
|
|
186
|
+
import { Button } from '@sanity/ui-v5'
|
|
187
|
+
export function SaveAction({ onSave, buttonRef }) {
|
|
188
|
+
return <Button ref={buttonRef} text="Save" onClick={onSave} />
|
|
189
|
+
}
|
|
190
|
+
- kind: violates
|
|
191
|
+
guidelines: ['press-area-renders-native-element']
|
|
192
|
+
code: |
|
|
193
|
+
export function Tile({ onOpen, label }) {
|
|
194
|
+
return <div role="button" tabIndex={0} onClick={onOpen}>{label}</div>
|
|
195
|
+
}
|
|
196
|
+
- kind: conforms
|
|
197
|
+
guidelines: ['press-area-renders-native-element']
|
|
198
|
+
code: |
|
|
199
|
+
import { PressArea, Text } from '@sanity/ui-v5'
|
|
200
|
+
export function Tile({ onOpen, label }) {
|
|
201
|
+
return <PressArea onClick={onOpen}><Text>{label}</Text></PressArea>
|
|
202
|
+
}
|
|
203
|
+
- kind: violates
|
|
204
|
+
guidelines: ['card-no-layout-props']
|
|
205
|
+
code:
|
|
206
|
+
- |
|
|
207
|
+
import { Card, Text } from '@sanity/ui-v5'
|
|
208
|
+
export function Tile({ title }) {
|
|
209
|
+
return <Card flexGrow={1} minWidth={0} radius={2} padding={3}><Text>{title}</Text></Card>
|
|
210
|
+
}
|
|
211
|
+
- kind: conforms
|
|
212
|
+
guidelines: ['card-no-layout-props']
|
|
213
|
+
code: |
|
|
214
|
+
import { Box, Card, Text } from '@sanity/ui-v5'
|
|
215
|
+
export function Tile({ title }) {
|
|
216
|
+
return <Box flexGrow={1} minWidth={0}><Card density="compact"><Text>{title}</Text></Card></Box>
|
|
217
|
+
}
|
|
218
|
+
- kind: violates
|
|
219
|
+
guidelines: ['checkbox-label-required']
|
|
220
|
+
code: |
|
|
221
|
+
import { Checkbox, Flex, Text } from '@sanity/ui-v5'
|
|
222
|
+
export function SelectRow({ checked, onChange }) {
|
|
223
|
+
return <Flex gap={2}><Checkbox checked={checked} onChange={onChange} /><Text>Select</Text></Flex>
|
|
224
|
+
}
|
|
225
|
+
- kind: conforms
|
|
226
|
+
guidelines: ['checkbox-label-required']
|
|
227
|
+
code: |
|
|
228
|
+
import { Checkbox } from '@sanity/ui-v5'
|
|
229
|
+
export function SelectRow({ checked, onChange }) {
|
|
230
|
+
return <Checkbox label="Select row" checked={checked} onChange={onChange} />
|
|
231
|
+
}
|
|
232
|
+
- kind: violates
|
|
233
|
+
guidelines: ['icon-import-from-subpath']
|
|
234
|
+
code: |
|
|
235
|
+
import { Button } from '@sanity/ui-v5'
|
|
236
|
+
import { SearchIcon, TrashIcon } from '@sanity/icons'
|
|
237
|
+
export function Actions() {
|
|
238
|
+
return <Button text="Search" iconStart={SearchIcon} />
|
|
239
|
+
}
|
|
240
|
+
- kind: conforms
|
|
241
|
+
guidelines: ['icon-import-from-subpath']
|
|
242
|
+
code: |
|
|
243
|
+
import { Button } from '@sanity/ui-v5'
|
|
244
|
+
import { SearchIcon } from '@sanity/icons/Search'
|
|
245
|
+
export function Actions() {
|
|
246
|
+
return <Button text="Search" iconStart={SearchIcon} />
|
|
247
|
+
}
|
|
248
|
+
# Real pre-fix agent output. `marginBottom` on Heading/Text used to be
|
|
249
|
+
# labelled a violation here, and counted as the most common layout-prop
|
|
250
|
+
# mistake (1,218 Heading and 1,030 Text occurrences). It is valid: v5
|
|
251
|
+
# TypographyProps extends MarginProps. That snippet is now a conforming case
|
|
252
|
+
# below; these two still break the rule.
|
|
253
|
+
- kind: violates
|
|
254
|
+
guidelines: ['no-layout-props-on-typography-or-actions']
|
|
255
|
+
code:
|
|
256
|
+
- |
|
|
257
|
+
import { Text } from '@sanity/ui-v5'
|
|
258
|
+
export function FieldLabel({ children }) {
|
|
259
|
+
return <Text as="label" size={0} weight="medium" display="block" marginBottom={1}>{children}</Text>
|
|
260
|
+
}
|
|
261
|
+
- |
|
|
262
|
+
import { Button, Flex } from '@sanity/ui-v5'
|
|
263
|
+
export function Actions({ onSave }) {
|
|
264
|
+
return <Flex gap={2}><Button text="Save" onClick={onSave} width="fill" marginTop={2} /></Flex>
|
|
265
|
+
}
|
|
266
|
+
- kind: conforms
|
|
267
|
+
guidelines: ['no-layout-props-on-typography-or-actions']
|
|
268
|
+
code:
|
|
269
|
+
# Margins are props on Text and Heading. A judgment that fires here is wrong.
|
|
270
|
+
- |
|
|
271
|
+
import { Heading, Text, VStack } from '@sanity/ui-v5'
|
|
272
|
+
export function Section({ title, body }) {
|
|
273
|
+
return (
|
|
274
|
+
<VStack>
|
|
275
|
+
<Heading as="h4" size={0} marginBottom={3}>{title}</Heading>
|
|
276
|
+
<Text size={0} muted as="p" marginTop={2}>{body}</Text>
|
|
277
|
+
</VStack>
|
|
278
|
+
)
|
|
279
|
+
}
|
|
280
|
+
- |
|
|
281
|
+
import { Box, Heading, Text, VStack } from '@sanity/ui-v5'
|
|
282
|
+
export function Section({ title, body }) {
|
|
283
|
+
return (
|
|
284
|
+
<VStack gap={3}>
|
|
285
|
+
<Heading as="h4" size={0}>{title}</Heading>
|
|
286
|
+
<Box marginTop={2}><Text size={0} muted as="p">{body}</Text></Box>
|
|
287
|
+
</VStack>
|
|
288
|
+
)
|
|
289
|
+
}
|
|
290
|
+
- |
|
|
291
|
+
import { Text } from '@sanity/ui-v5'
|
|
292
|
+
export function Caption({ children }) {
|
|
293
|
+
return <Text size={0} muted align="center">{children}</Text>
|
|
294
|
+
}
|
|
295
|
+
# Real pre-fix agent output. `style={{}}` on a DS component is the single
|
|
296
|
+
# largest error class in the corpus: 13,670 CSS properties across the run
|
|
297
|
+
# history, led by width (1,021), height (854), minWidth (771), padding
|
|
298
|
+
# (534) — all of which have a prop.
|
|
299
|
+
- kind: violates
|
|
300
|
+
guidelines: ['prop-before-inline-style']
|
|
301
|
+
code:
|
|
302
|
+
- |
|
|
303
|
+
import { Box, Flex, Text } from '@sanity/ui-v5'
|
|
304
|
+
export function Panel({ children }) {
|
|
305
|
+
return (
|
|
306
|
+
<Box style={{ width: '100%', overflowX: 'auto' }}>
|
|
307
|
+
<Flex alignItems="center" gap={2} style={{ backgroundColor: '#f5f5f5', borderRadius: '4px', padding: '0 12px' }}>
|
|
308
|
+
<Text size={0}>{children}</Text>
|
|
309
|
+
</Flex>
|
|
310
|
+
</Box>
|
|
311
|
+
)
|
|
312
|
+
}
|
|
313
|
+
- |
|
|
314
|
+
import { Card } from '@sanity/ui-v5'
|
|
315
|
+
export function Tile({ children }) {
|
|
316
|
+
return <Card density="regular" style={{ height: '100%' }}>{children}</Card>
|
|
317
|
+
}
|
|
318
|
+
- kind: conforms
|
|
319
|
+
guidelines: ['prop-before-inline-style']
|
|
320
|
+
code:
|
|
321
|
+
- |
|
|
322
|
+
import { Box, Flex, Text } from '@sanity/ui-v5'
|
|
323
|
+
export function Panel({ children }) {
|
|
324
|
+
return (
|
|
325
|
+
<Box width="fill" overflowX="auto">
|
|
326
|
+
<Flex alignItems="center" gap={2} radius={2} paddingX={3}>
|
|
327
|
+
<Text size={0}>{children}</Text>
|
|
328
|
+
</Flex>
|
|
329
|
+
</Box>
|
|
330
|
+
)
|
|
331
|
+
}
|
|
332
|
+
# The legitimate case: no prop path exists for either of these, so the
|
|
333
|
+
# rule deliberately allows them. A judgment that fires here is wrong.
|
|
334
|
+
- |
|
|
335
|
+
import { Box } from '@sanity/ui-v5'
|
|
336
|
+
export function Sheet({ children }) {
|
|
337
|
+
return <Box style={{ transform: 'translateY(-2px)', backgroundImage: 'linear-gradient(#000, #fff)' }}>{children}</Box>
|
|
338
|
+
}
|
|
339
|
+
# The `no-emojis` family. The shared rule and its three component
|
|
340
|
+
# refinements are labelled together on the same case wherever a snippet
|
|
341
|
+
# breaks both: an emoji in a Heading violates `heading-no-emojis` and
|
|
342
|
+
# `no-emojis` at once, the same refines-chain shape as the icon-only cases
|
|
343
|
+
# above. Fixtures necessarily contain the emojis the rule forbids.
|
|
344
|
+
- kind: violates
|
|
345
|
+
guidelines: ['heading-no-emojis', 'no-emojis']
|
|
346
|
+
code:
|
|
347
|
+
- |
|
|
348
|
+
import { Heading } from '@sanity/ui-v5'
|
|
349
|
+
export function SectionTitle() {
|
|
350
|
+
return <Heading as="h2" size={2}>🚀 Deployments</Heading>
|
|
351
|
+
}
|
|
352
|
+
- |
|
|
353
|
+
import { Heading } from '@sanity/ui-v5'
|
|
354
|
+
export function SectionTitle() {
|
|
355
|
+
return <Heading as="h2" size={2}>Deployments ✅</Heading>
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
- kind: conforms
|
|
359
|
+
guidelines: ['heading-no-emojis', 'heading-no-icons', 'no-emojis']
|
|
360
|
+
code:
|
|
361
|
+
- |
|
|
362
|
+
import { Heading } from '@sanity/ui-v5'
|
|
363
|
+
export function SectionTitle() {
|
|
364
|
+
return <Heading as="h2" size={2}>Deployments</Heading>
|
|
365
|
+
}
|
|
366
|
+
# The symbol sits on an adjacent element with its own accessible name,
|
|
367
|
+
# not inside the Heading. A judgment that fires here is wrong.
|
|
368
|
+
- |
|
|
369
|
+
import { Badge, Flex, Heading } from '@sanity/ui-v5'
|
|
370
|
+
import { RocketIcon } from '@sanity/icons/Rocket'
|
|
371
|
+
export function SectionTitle() {
|
|
372
|
+
return (
|
|
373
|
+
<Flex alignItems="center" gap={2}>
|
|
374
|
+
<Heading as="h2" size={2}>Deployments</Heading>
|
|
375
|
+
<Badge tone="positive" text="Live" iconStart={RocketIcon} />
|
|
376
|
+
</Flex>
|
|
377
|
+
)
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
- kind: violates
|
|
381
|
+
guidelines: ['heading-no-icons']
|
|
382
|
+
code:
|
|
383
|
+
- |
|
|
384
|
+
import { Flex, Heading, Icon } from '@sanity/ui-v5'
|
|
385
|
+
import { RocketIcon } from '@sanity/icons/Rocket'
|
|
386
|
+
export function SectionTitle() {
|
|
387
|
+
return (
|
|
388
|
+
<Flex alignItems="center" gap={2}>
|
|
389
|
+
<Icon icon={RocketIcon} />
|
|
390
|
+
<Heading as="h2" size={2}>Deployments</Heading>
|
|
391
|
+
</Flex>
|
|
392
|
+
)
|
|
393
|
+
}
|
|
394
|
+
- |
|
|
395
|
+
import { Heading, Icon } from '@sanity/ui-v5'
|
|
396
|
+
import { RocketIcon } from '@sanity/icons/Rocket'
|
|
397
|
+
export function SectionTitle() {
|
|
398
|
+
return <Heading as="h2" size={2}><Icon icon={RocketIcon} /> Deployments</Heading>
|
|
399
|
+
}
|
|
400
|
+
- kind: violates
|
|
401
|
+
guidelines: ['text-no-emojis', 'no-emojis']
|
|
402
|
+
code:
|
|
403
|
+
- |
|
|
404
|
+
import { Text } from '@sanity/ui-v5'
|
|
405
|
+
export function Status() {
|
|
406
|
+
return <Text size={1}>Your changes were saved ✅ — nothing else to do.</Text>
|
|
407
|
+
}
|
|
408
|
+
- |
|
|
409
|
+
import { Text, VStack } from '@sanity/ui-v5'
|
|
410
|
+
export function Checklist() {
|
|
411
|
+
return (
|
|
412
|
+
<VStack gap={2}>
|
|
413
|
+
<Text size={1}>✔️ Connect a dataset</Text>
|
|
414
|
+
<Text size={1}>✔️ Invite your team</Text>
|
|
415
|
+
</VStack>
|
|
416
|
+
)
|
|
417
|
+
}
|
|
418
|
+
- |
|
|
419
|
+
import {Flex, Text } from '@sanity/ui-v5'
|
|
420
|
+
export function errorMessage() {
|
|
421
|
+
return <Flex gap={2}><Text size={2}>⛔️</Text><Text size={2}>Error!</Text></Flex>
|
|
422
|
+
}
|
|
423
|
+
- kind: conforms
|
|
424
|
+
guidelines: ['text-no-emojis', 'no-emojis']
|
|
425
|
+
code:
|
|
426
|
+
- |
|
|
427
|
+
import { Flex, Icon, Text } from '@sanity/ui-v5'
|
|
428
|
+
import { CheckmarkIcon } from '@sanity/icons/Checkmark'
|
|
429
|
+
export function Status() {
|
|
430
|
+
return (
|
|
431
|
+
<Flex alignItems="center" gap={2}>
|
|
432
|
+
<Icon icon={CheckmarkIcon} />
|
|
433
|
+
<Text size={1}>Your changes were saved.</Text>
|
|
434
|
+
</Flex>
|
|
435
|
+
)
|
|
436
|
+
}
|
|
437
|
+
- |
|
|
438
|
+
import { Text } from '@sanity/ui-v5'
|
|
439
|
+
export function Status() {
|
|
440
|
+
return <Text size={1}>Your changes were saved.</Text>
|
|
441
|
+
}
|
|
442
|
+
- |
|
|
443
|
+
import {Flex, Text } from '@sanity/ui-v5'
|
|
444
|
+
import { ErrorOutlineIcon } from '@sanity/icons/ErrorOutlineIcon'
|
|
445
|
+
export function errorMessage() {
|
|
446
|
+
return <Flex gap={2}><Icon icon={ErrorOutlineIcon} size={2} /><Text size={2}>Error!</Text></Flex>
|
|
447
|
+
}
|
|
448
|
+
- kind: violates
|
|
449
|
+
guidelines: ['badge-no-emojis', 'no-emojis']
|
|
450
|
+
code:
|
|
451
|
+
- |
|
|
452
|
+
import { Badge } from '@sanity/ui-v5'
|
|
453
|
+
export function PublishState() {
|
|
454
|
+
return <Badge tone="positive" text="✅ Published" />
|
|
455
|
+
}
|
|
456
|
+
- |
|
|
457
|
+
import { Badge } from '@sanity/ui-v5'
|
|
458
|
+
export function PublishState() {
|
|
459
|
+
return <Badge tone="caution" text="⚠️ In review" />
|
|
460
|
+
}
|
|
461
|
+
- |
|
|
462
|
+
import {Badge } from '@sanity/ui-v5'
|
|
463
|
+
export function errorMessage() {
|
|
464
|
+
return <Badge text="⛔️ Critical" tone="critical" />
|
|
465
|
+
}
|
|
466
|
+
- kind: conforms
|
|
467
|
+
guidelines: ['badge-no-emojis', 'no-emojis']
|
|
468
|
+
code:
|
|
469
|
+
- |
|
|
470
|
+
import { Badge } from '@sanity/ui-v5'
|
|
471
|
+
import { CheckmarkIcon } from '@sanity/icons/Checkmark'
|
|
472
|
+
export function PublishState() {
|
|
473
|
+
return <Badge tone="positive" text="Published" iconStart={CheckmarkIcon} />
|
|
474
|
+
}
|
|
475
|
+
- |
|
|
476
|
+
import { Badge } from '@sanity/ui-v5'
|
|
477
|
+
export function PublishState() {
|
|
478
|
+
return <Badge tone="caution" text="In review" />
|
|
479
|
+
}
|
|
480
|
+
- |
|
|
481
|
+
import {Badge } from '@sanity/ui-v5'
|
|
482
|
+
import { ErrorOutlineIcon } from '@sanity/icons/ErrorOutlineIcon'
|
|
483
|
+
export function errorMessage() {
|
|
484
|
+
return <Badge iconStart={ErrorOutlineIcon} text="Critical" tone="critical" />
|
|
485
|
+
}
|
|
486
|
+
- kind: conforms
|
|
487
|
+
guidelines: ['no-emojis']
|
|
488
|
+
code:
|
|
489
|
+
# The carve-out: `no-emojis` permits user reactions. The emoji is
|
|
490
|
+
# user-supplied content, not a design decision. A judgment that fires
|
|
491
|
+
# here is wrong.
|
|
492
|
+
- |
|
|
493
|
+
import { Button, Flex } from '@sanity/ui-v5'
|
|
494
|
+
export function Reactions({ reactions, onToggle }) {
|
|
495
|
+
return (
|
|
496
|
+
<Flex gap={1}>
|
|
497
|
+
{reactions.map((reaction) => (
|
|
498
|
+
<Button
|
|
499
|
+
key={reaction.id}
|
|
500
|
+
text={`${reaction.emoji} ${reaction.count}`}
|
|
501
|
+
onClick={() => onToggle(reaction.id)}
|
|
502
|
+
/>
|
|
503
|
+
))}
|
|
504
|
+
</Flex>
|
|
505
|
+
)
|
|
506
|
+
}
|
|
507
|
+
# `prefer-component-over-native-element`. The most-violated rule in the
|
|
508
|
+
# mined corpus that had no question: 332 of 2,176 real generated files
|
|
509
|
+
# (15%) trip `sanity-ui/no-native-html-elements`.
|
|
510
|
+
#
|
|
511
|
+
# The negative cases matter more than usual here. The rule covers a closed
|
|
512
|
+
# list — div, span, p, button, h1-h6, ul, ol, li, a, hr — and the corpus
|
|
513
|
+
# positively requires native `<table>` markup (see the data-table and
|
|
514
|
+
# sortable-data-table chunks). A judgment that fires on a table is wrong.
|
|
515
|
+
- kind: violates
|
|
516
|
+
guidelines: ['prefer-component-over-native-element']
|
|
517
|
+
code:
|
|
518
|
+
- |
|
|
519
|
+
import { Text } from '@sanity/ui-v5'
|
|
520
|
+
export function Panel({ title, body }) {
|
|
521
|
+
return (
|
|
522
|
+
<div className="panel">
|
|
523
|
+
<h2>{title}</h2>
|
|
524
|
+
<p>{body}</p>
|
|
525
|
+
</div>
|
|
526
|
+
)
|
|
527
|
+
}
|
|
528
|
+
- |
|
|
529
|
+
import { Card } from '@sanity/ui-v5'
|
|
530
|
+
export function Actions({ onSave, href }) {
|
|
531
|
+
return (
|
|
532
|
+
<Card>
|
|
533
|
+
<button onClick={onSave}>Save</button>
|
|
534
|
+
<a href={href}>Read more</a>
|
|
535
|
+
<hr />
|
|
536
|
+
</Card>
|
|
537
|
+
)
|
|
538
|
+
}
|
|
539
|
+
- kind: conforms
|
|
540
|
+
guidelines: ['prefer-component-over-native-element']
|
|
541
|
+
code:
|
|
542
|
+
- |
|
|
543
|
+
import { Box, Divider, Heading, Text } from '@sanity/ui-v5'
|
|
544
|
+
export function Panel({ title, body }) {
|
|
545
|
+
return (
|
|
546
|
+
<Box padding={3}>
|
|
547
|
+
<Heading as="h2" size={2}>{title}</Heading>
|
|
548
|
+
<Text size={1}>{body}</Text>
|
|
549
|
+
<Divider />
|
|
550
|
+
</Box>
|
|
551
|
+
)
|
|
552
|
+
}
|
|
553
|
+
# The carve-out: table markup has no component equivalent and the
|
|
554
|
+
# corpus's own data-table chunks require it. A judgment that fires
|
|
555
|
+
# here is wrong.
|
|
556
|
+
- |
|
|
557
|
+
import { Box, Text } from '@sanity/ui-v5'
|
|
558
|
+
export function AssetTable({ rows }) {
|
|
559
|
+
return (
|
|
560
|
+
<Box padding={3}>
|
|
561
|
+
<table>
|
|
562
|
+
<thead>
|
|
563
|
+
<tr><th scope="col"><Text size={0}>Name</Text></th></tr>
|
|
564
|
+
</thead>
|
|
565
|
+
<tbody>
|
|
566
|
+
{rows.map((r) => (
|
|
567
|
+
<tr key={r.id}><td><Text size={1}>{r.name}</Text></td></tr>
|
|
568
|
+
))}
|
|
569
|
+
</tbody>
|
|
570
|
+
</table>
|
|
571
|
+
</Box>
|
|
572
|
+
)
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
# ═══ Judgment questions, moved from template-cases.yaml on 2026-09-23 ═══
|
|
576
|
+
# ── tone-is-semantic → tone-signals-state ────────────────────────────────
|
|
577
|
+
# The decorative half of the rule: a tone with no real state behind it.
|
|
578
|
+
- kind: violates
|
|
579
|
+
guidelines: ['tone-signals-state']
|
|
580
|
+
code:
|
|
581
|
+
- |
|
|
582
|
+
import { Text } from '@sanity/ui-v5'
|
|
583
|
+
export function Greeting({ name }) {
|
|
584
|
+
return <Text size={3} tone="critical">Welcome back, {name}</Text>
|
|
585
|
+
}
|
|
586
|
+
- |
|
|
587
|
+
import { Badge } from '@sanity/ui-v5'
|
|
588
|
+
export function CategoryTag({ category }) {
|
|
589
|
+
return <Badge tone="positive" text={category} />
|
|
590
|
+
}
|
|
591
|
+
# Tone used to make a section title stand out. Nothing is in a state.
|
|
592
|
+
- |
|
|
593
|
+
import { Heading } from '@sanity/ui-v5'
|
|
594
|
+
export function GettingStarted() {
|
|
595
|
+
return <Heading as="h2" size={2} tone="caution">Getting started</Heading>
|
|
596
|
+
}
|
|
597
|
+
- kind: conforms
|
|
598
|
+
guidelines: ['tone-signals-state']
|
|
599
|
+
code:
|
|
600
|
+
- |
|
|
601
|
+
import { Text } from '@sanity/ui-v5'
|
|
602
|
+
export function Greeting({ name }) {
|
|
603
|
+
return <Text size={3}>Welcome back, {name}</Text>
|
|
604
|
+
}
|
|
605
|
+
- |
|
|
606
|
+
import { Badge } from '@sanity/ui-v5'
|
|
607
|
+
export function PublishState() {
|
|
608
|
+
return <Badge tone="positive" text="Published" />
|
|
609
|
+
}
|
|
610
|
+
# A plain category carries no state, so it stays neutral.
|
|
611
|
+
- |
|
|
612
|
+
import { Badge } from '@sanity/ui-v5'
|
|
613
|
+
export function CategoryTag({ category }) {
|
|
614
|
+
return <Badge text={category} />
|
|
615
|
+
}
|
|
616
|
+
# Emphasis comes from size and heading level, not tone.
|
|
617
|
+
- |
|
|
618
|
+
import { Heading } from '@sanity/ui-v5'
|
|
619
|
+
export function GettingStarted() {
|
|
620
|
+
return <Heading as="h2" size={3}>Getting started</Heading>
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
# ── color-alone → second-channel-required ────────────────────────────────
|
|
624
|
+
# Meaning carried by one channel only. The status dot is colour and nothing
|
|
625
|
+
# else, so it breaks both rules. Tone plus descriptive text is the pairing
|
|
626
|
+
# rule's concern alone: the broad rule accepts any visible text, so those
|
|
627
|
+
# cases are labelled for tone-paired-with-second-channel only.
|
|
628
|
+
- kind: violates
|
|
629
|
+
guidelines: ['second-channel-required', 'tone-paired-with-second-channel']
|
|
630
|
+
code:
|
|
631
|
+
- |
|
|
632
|
+
import { Icon } from '@sanity/ui-v5'
|
|
633
|
+
import { CircleIcon } from '@sanity/icons/Circle'
|
|
634
|
+
export function SyncDot({ ok }) {
|
|
635
|
+
return <Icon icon={CircleIcon} tone={ok ? 'positive' : 'critical'} />
|
|
636
|
+
}
|
|
637
|
+
# Tone and text, no icon. The text describes the event but never names the state.
|
|
638
|
+
- kind: violates
|
|
639
|
+
guidelines: ['tone-paired-with-second-channel']
|
|
640
|
+
code:
|
|
641
|
+
- |
|
|
642
|
+
import { Badge } from '@sanity/ui-v5'
|
|
643
|
+
export function ErrorMarker() {
|
|
644
|
+
return <Badge tone="critical" text="Failed" />
|
|
645
|
+
}
|
|
646
|
+
- |
|
|
647
|
+
import { Text } from '@sanity/ui-v5'
|
|
648
|
+
export function SuccessMessage() {
|
|
649
|
+
return <Text tone="positive">Process complete</Text>
|
|
650
|
+
}
|
|
651
|
+
- |
|
|
652
|
+
import { Text } from '@sanity/ui-v5'
|
|
653
|
+
export function TimeoutMessage() {
|
|
654
|
+
return <Text tone="critical">Timed out</Text>
|
|
655
|
+
}
|
|
656
|
+
- kind: conforms
|
|
657
|
+
guidelines: ['second-channel-required', 'tone-paired-with-second-channel']
|
|
658
|
+
code:
|
|
659
|
+
- |
|
|
660
|
+
import { Flex, Icon, Text } from '@sanity/ui-v5'
|
|
661
|
+
import { ErrorOutlineIcon } from '@sanity/icons/ErrorOutline'
|
|
662
|
+
export function UploadStatus() {
|
|
663
|
+
return (
|
|
664
|
+
<Flex gap={2} alignItems="center">
|
|
665
|
+
<Icon icon={ErrorOutlineIcon} tone="critical" aria-hidden={true} />
|
|
666
|
+
<Text tone="critical">Upload failed</Text>
|
|
667
|
+
</Flex>
|
|
668
|
+
)
|
|
669
|
+
}
|
|
670
|
+
- |
|
|
671
|
+
import { Badge } from '@sanity/ui-v5'
|
|
672
|
+
import { ErrorOutlineIcon } from '@sanity/icons/ErrorOutline'
|
|
673
|
+
export function ErrorMarker() {
|
|
674
|
+
return <Badge tone="critical" text="Failed" iconStart={ErrorOutlineIcon} />
|
|
675
|
+
}
|
|
676
|
+
- |
|
|
677
|
+
import { Flex, Icon, Text } from '@sanity/ui-v5'
|
|
678
|
+
import { CheckmarkIcon } from '@sanity/icons/Checkmark'
|
|
679
|
+
export function SuccessMessage() {
|
|
680
|
+
return <Flex gap={1}><Icon icon={CheckmarkIcon} tone="positive" aria-hidden={true} /><Text tone="positive">Process complete</Text></Flex>
|
|
681
|
+
}
|
|
682
|
+
# No icon, but the text names the state outright, so text is enough.
|
|
683
|
+
- |
|
|
684
|
+
import { Text } from '@sanity/ui-v5'
|
|
685
|
+
export function TimeoutMessage() {
|
|
686
|
+
return (
|
|
687
|
+
<Text tone="critical">
|
|
688
|
+
<strong>Error:</strong> Process timed out. Restart the process to try again.
|
|
689
|
+
</Text>
|
|
690
|
+
)
|
|
691
|
+
}
|
|
692
|
+
# ── action-labels → name-the-action ──────────────────────────────────────
|
|
693
|
+
- kind: violates
|
|
694
|
+
guidelines: ['name-the-action']
|
|
695
|
+
code:
|
|
696
|
+
- |
|
|
697
|
+
import { Button } from '@sanity/ui-v5'
|
|
698
|
+
export function ExportForm({ onExport }) {
|
|
699
|
+
return <Button text="Submit" level="primary" onClick={onExport} />
|
|
700
|
+
}
|
|
701
|
+
- |
|
|
702
|
+
import { Link, Text } from '@sanity/ui-v5'
|
|
703
|
+
export function LimitsNote() {
|
|
704
|
+
return <Text size={1}>Files over 50 MB fail. <Link href="/docs/limits">Read more</Link></Text>
|
|
705
|
+
}
|
|
706
|
+
- |
|
|
707
|
+
import { Button, Flex } from '@sanity/ui-v5'
|
|
708
|
+
export function LeavePrompt({ onLeave, onStay }) {
|
|
709
|
+
return (
|
|
710
|
+
<Flex gap={2}>
|
|
711
|
+
<Button text="Yes" onClick={onLeave} />
|
|
712
|
+
<Button text="No" level="secondary" onClick={onStay} />
|
|
713
|
+
</Flex>
|
|
714
|
+
)
|
|
715
|
+
}
|
|
716
|
+
- kind: conforms
|
|
717
|
+
guidelines: ['name-the-action']
|
|
718
|
+
code:
|
|
719
|
+
- |
|
|
720
|
+
import { Button } from '@sanity/ui-v5'
|
|
721
|
+
export function ExportForm({ onExport }) {
|
|
722
|
+
return <Button text="Export as CSV" level="primary" onClick={onExport} />
|
|
723
|
+
}
|
|
724
|
+
- |
|
|
725
|
+
import { Link, Text } from '@sanity/ui-v5'
|
|
726
|
+
export function LimitsNote() {
|
|
727
|
+
return <Text size={1}>Files over 50 MB fail. <Link href="/docs/limits">Read the upload limits</Link></Text>
|
|
728
|
+
}
|
|
729
|
+
# "Cancel" names the only thing it can do. A judgment that fires here is wrong.
|
|
730
|
+
- |
|
|
731
|
+
import { Button } from '@sanity/ui-v5'
|
|
732
|
+
export function CancelEdit({ onCancel }) {
|
|
733
|
+
return <Button text="Cancel" level="secondary" onClick={onCancel} />
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
# ── plain-language → plain-language ──────────────────────────────────────
|
|
737
|
+
- kind: violates
|
|
738
|
+
guidelines: ['plain-language']
|
|
739
|
+
code:
|
|
740
|
+
- |
|
|
741
|
+
import { Text } from '@sanity/ui-v5'
|
|
742
|
+
export function SearchHint() {
|
|
743
|
+
return <Text size={1}>Leverage the GROQ projection pipeline to hydrate refs.</Text>
|
|
744
|
+
}
|
|
745
|
+
- |
|
|
746
|
+
import { Text } from '@sanity/ui-v5'
|
|
747
|
+
export function SignInHint() {
|
|
748
|
+
return <Text size={1}>Enable SSO via your SAML IdP.</Text>
|
|
749
|
+
}
|
|
750
|
+
- kind: conforms
|
|
751
|
+
guidelines: ['plain-language']
|
|
752
|
+
code:
|
|
753
|
+
# The acronym is spelled out on first use. A judgment that fires here is wrong.
|
|
754
|
+
- |
|
|
755
|
+
import { Text } from '@sanity/ui-v5'
|
|
756
|
+
export function SignInHint() {
|
|
757
|
+
return <Text size={1}>Sign in with single sign-on (SSO) through your company account.</Text>
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
# More plain-language cases, one way jargon reaches the UI per snippet.
|
|
761
|
+
# Each violation has a rewrite of the same interface below it, so the only
|
|
762
|
+
# difference a judge can use is the wording. Copy lives in props as often
|
|
763
|
+
# as in children — `label`, `text`, `content`, `aria-label` — so the cases
|
|
764
|
+
# spread across them.
|
|
765
|
+
- kind: violates
|
|
766
|
+
guidelines: ['plain-language']
|
|
767
|
+
code:
|
|
768
|
+
# An internal codename.
|
|
769
|
+
- |
|
|
770
|
+
import { Switch } from '@sanity/ui-v5'
|
|
771
|
+
export function ImportToggle({ on, onToggle }) {
|
|
772
|
+
return <Switch label="Enable Mercury ingest" checked={on} onChange={onToggle} />
|
|
773
|
+
}
|
|
774
|
+
# Design-speak.
|
|
775
|
+
- |
|
|
776
|
+
import { Text } from '@sanity/ui-v5'
|
|
777
|
+
export function DensityHint() {
|
|
778
|
+
return <Text size={1}>Adjust the affordance density of your workspace.</Text>
|
|
779
|
+
}
|
|
780
|
+
# An unexplained acronym on an action.
|
|
781
|
+
- |
|
|
782
|
+
import { Button } from '@sanity/ui-v5'
|
|
783
|
+
export function AccessSettings({ onOpen }) {
|
|
784
|
+
return <Button text="Configure RBAC" onClick={onOpen} />
|
|
785
|
+
}
|
|
786
|
+
# Implementation vocabulary in a tooltip.
|
|
787
|
+
- |
|
|
788
|
+
import { IconButton, Tooltip } from '@sanity/ui-v5'
|
|
789
|
+
import { LinkIcon } from '@sanity/icons/Link'
|
|
790
|
+
export function OpenSource({ onOpen }) {
|
|
791
|
+
return (
|
|
792
|
+
<Tooltip content="Dereference to the canonical rev">
|
|
793
|
+
<IconButton icon={LinkIcon} aria-label="Open original" onClick={onOpen} />
|
|
794
|
+
</Tooltip>
|
|
795
|
+
)
|
|
796
|
+
}
|
|
797
|
+
# Jargon in an accessible name, where no one sees it to catch it.
|
|
798
|
+
- |
|
|
799
|
+
import { IconButton } from '@sanity/ui-v5'
|
|
800
|
+
import { RefreshIcon } from '@sanity/icons/Refresh'
|
|
801
|
+
export function Purge({ onPurge }) {
|
|
802
|
+
return <IconButton icon={RefreshIcon} aria-label="Purge edge cache" onClick={onPurge} />
|
|
803
|
+
}
|
|
804
|
+
# Internal vocabulary as a heading.
|
|
805
|
+
- |
|
|
806
|
+
import { Heading } from '@sanity/ui-v5'
|
|
807
|
+
export function SectionTitle() {
|
|
808
|
+
return <Heading as="h2" size={2}>Ingest pipeline v2</Heading>
|
|
809
|
+
}
|
|
810
|
+
# Plain words, but one long bureaucratic sentence.
|
|
811
|
+
- |
|
|
812
|
+
import { Text } from '@sanity/ui-v5'
|
|
813
|
+
export function AccessNote() {
|
|
814
|
+
return (
|
|
815
|
+
<Text size={1}>
|
|
816
|
+
In order to facilitate optimal utilisation of collaborative functionality, it is necessary to ensure that
|
|
817
|
+
appropriate permissions have been provisioned prior to initiating a session.
|
|
818
|
+
</Text>
|
|
819
|
+
)
|
|
820
|
+
}
|
|
821
|
+
- kind: conforms
|
|
822
|
+
guidelines: ['plain-language']
|
|
823
|
+
code:
|
|
824
|
+
- |
|
|
825
|
+
import { Switch } from '@sanity/ui-v5'
|
|
826
|
+
export function ImportToggle({ on, onToggle }) {
|
|
827
|
+
return <Switch label="Import documents from the old site" checked={on} onChange={onToggle} />
|
|
828
|
+
}
|
|
829
|
+
- |
|
|
830
|
+
import { Text } from '@sanity/ui-v5'
|
|
831
|
+
export function DensityHint() {
|
|
832
|
+
return <Text size={1}>Show more or less space between items.</Text>
|
|
833
|
+
}
|
|
834
|
+
- |
|
|
835
|
+
import { Button } from '@sanity/ui-v5'
|
|
836
|
+
export function AccessSettings({ onOpen }) {
|
|
837
|
+
return <Button text="Choose who can edit" onClick={onOpen} />
|
|
838
|
+
}
|
|
839
|
+
- |
|
|
840
|
+
import { IconButton, Tooltip } from '@sanity/ui-v5'
|
|
841
|
+
import { LinkIcon } from '@sanity/icons/Link'
|
|
842
|
+
export function OpenSource({ onOpen }) {
|
|
843
|
+
return (
|
|
844
|
+
<Tooltip content="Open the original document">
|
|
845
|
+
<IconButton icon={LinkIcon} aria-label="Open original" onClick={onOpen} />
|
|
846
|
+
</Tooltip>
|
|
847
|
+
)
|
|
848
|
+
}
|
|
849
|
+
- |
|
|
850
|
+
import { Heading } from '@sanity/ui-v5'
|
|
851
|
+
export function SectionTitle() {
|
|
852
|
+
return <Heading as="h2" size={2}>Import settings</Heading>
|
|
853
|
+
}
|
|
854
|
+
- |
|
|
855
|
+
import { Text } from '@sanity/ui-v5'
|
|
856
|
+
export function AccessNote() {
|
|
857
|
+
return <Text size={1}>Ask an admin for edit access to start a session.</Text>
|
|
858
|
+
}
|
|
859
|
+
# User content is not system copy. A document titled "GROQ cheat sheet"
|
|
860
|
+
# is the user's words. A judgment that fires here is wrong.
|
|
861
|
+
- |
|
|
862
|
+
import { Heading } from '@sanity/ui-v5'
|
|
863
|
+
export function PostTitle({ post }) {
|
|
864
|
+
return <Heading as="h1" size={3}>{post.title}</Heading>
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
# A third round: product vocabulary, sentence shape and more controls.
|
|
868
|
+
# The first rounds were mostly single words of jargon. These add Sanity's
|
|
869
|
+
# own terms, which an agent copies from the docs it reads, plus copy that
|
|
870
|
+
# uses no jargon at all and is still hard to read.
|
|
871
|
+
- kind: violates
|
|
872
|
+
guidelines: ['plain-language']
|
|
873
|
+
code:
|
|
874
|
+
# Internal status vocabulary on a badge.
|
|
875
|
+
- |
|
|
876
|
+
import { Badge } from '@sanity/ui-v5'
|
|
877
|
+
export function AssetUsage() {
|
|
878
|
+
return <Badge text="Orphaned" />
|
|
879
|
+
}
|
|
880
|
+
# A developer verb on an editor's action.
|
|
881
|
+
- |
|
|
882
|
+
import { Button } from '@sanity/ui-v5'
|
|
883
|
+
export function UpdateDraft({ onUpdate }) {
|
|
884
|
+
return <Button text="Rebase draft" onClick={onUpdate} />
|
|
885
|
+
}
|
|
886
|
+
# Two acronyms, neither spelled out.
|
|
887
|
+
- |
|
|
888
|
+
import { Text } from '@sanity/ui-v5'
|
|
889
|
+
export function CacheHint() {
|
|
890
|
+
return <Text size={1}>Set the CDN TTL for published assets.</Text>
|
|
891
|
+
}
|
|
892
|
+
# An engineering pattern name as a setting.
|
|
893
|
+
- |
|
|
894
|
+
import { Switch } from '@sanity/ui-v5'
|
|
895
|
+
export function InstantSave({ on, onToggle }) {
|
|
896
|
+
return <Switch label="Enable optimistic UI" checked={on} onChange={onToggle} />
|
|
897
|
+
}
|
|
898
|
+
# No jargon, but long words where short ones exist.
|
|
899
|
+
- |
|
|
900
|
+
import { Text } from '@sanity/ui-v5'
|
|
901
|
+
export function LanguageHint() {
|
|
902
|
+
return <Text size={1}>Utilize the dropdown to select your preferred locale configuration.</Text>
|
|
903
|
+
}
|
|
904
|
+
# Nouns doing the work of verbs.
|
|
905
|
+
- |
|
|
906
|
+
import { Text } from '@sanity/ui-v5'
|
|
907
|
+
export function DeleteWarning() {
|
|
908
|
+
return <Text size={1}>Execution of the deletion will result in the permanent unavailability of this asset.</Text>
|
|
909
|
+
}
|
|
910
|
+
# A double negative.
|
|
911
|
+
- |
|
|
912
|
+
import { Text } from '@sanity/ui-v5'
|
|
913
|
+
export function ListHint() {
|
|
914
|
+
return <Text size={1}>Documents that are not unpublished will not be hidden from the list.</Text>
|
|
915
|
+
}
|
|
916
|
+
# Internal vocabulary as a heading.
|
|
917
|
+
- |
|
|
918
|
+
import { Heading } from '@sanity/ui-v5'
|
|
919
|
+
export function SchemaWarning() {
|
|
920
|
+
return <Heading as="h2" size={2}>Schema drift detected</Heading>
|
|
921
|
+
}
|
|
922
|
+
# Query language in an empty result.
|
|
923
|
+
- |
|
|
924
|
+
import { Text } from '@sanity/ui-v5'
|
|
925
|
+
export function NoResults() {
|
|
926
|
+
return <Text size={1}>0 hits for filter predicate.</Text>
|
|
927
|
+
}
|
|
928
|
+
- kind: conforms
|
|
929
|
+
guidelines: ['plain-language']
|
|
930
|
+
code:
|
|
931
|
+
- |
|
|
932
|
+
import { Badge } from '@sanity/ui-v5'
|
|
933
|
+
export function AssetUsage() {
|
|
934
|
+
return <Badge text="Not used anywhere" />
|
|
935
|
+
}
|
|
936
|
+
- |
|
|
937
|
+
import { Button } from '@sanity/ui-v5'
|
|
938
|
+
export function UpdateDraft({ onUpdate }) {
|
|
939
|
+
return <Button text="Add the latest changes" onClick={onUpdate} />
|
|
940
|
+
}
|
|
941
|
+
- |
|
|
942
|
+
import { Text } from '@sanity/ui-v5'
|
|
943
|
+
export function CacheHint() {
|
|
944
|
+
return <Text size={1}>Choose how long visitors see a saved copy of your images.</Text>
|
|
945
|
+
}
|
|
946
|
+
- |
|
|
947
|
+
import { Switch } from '@sanity/ui-v5'
|
|
948
|
+
export function InstantSave({ on, onToggle }) {
|
|
949
|
+
return <Switch label="Show changes before they finish saving" checked={on} onChange={onToggle} />
|
|
950
|
+
}
|
|
951
|
+
- |
|
|
952
|
+
import { Text } from '@sanity/ui-v5'
|
|
953
|
+
export function LanguageHint() {
|
|
954
|
+
return <Text size={1}>Pick your language from the list.</Text>
|
|
955
|
+
}
|
|
956
|
+
- |
|
|
957
|
+
import { Text } from '@sanity/ui-v5'
|
|
958
|
+
export function DeleteWarning() {
|
|
959
|
+
return <Text size={1}>Deleting this image removes it for good.</Text>
|
|
960
|
+
}
|
|
961
|
+
- |
|
|
962
|
+
import { Text } from '@sanity/ui-v5'
|
|
963
|
+
export function ListHint() {
|
|
964
|
+
return <Text size={1}>Published documents stay in the list.</Text>
|
|
965
|
+
}
|
|
966
|
+
- |
|
|
967
|
+
import { Heading } from '@sanity/ui-v5'
|
|
968
|
+
export function SchemaWarning() {
|
|
969
|
+
return <Heading as="h2" size={2}>Some fields have changed</Heading>
|
|
970
|
+
}
|
|
971
|
+
- |
|
|
972
|
+
import { Text } from '@sanity/ui-v5'
|
|
973
|
+
export function NoResults() {
|
|
974
|
+
return <Text size={1}>No documents match these filters.</Text>
|
|
975
|
+
}
|
|
976
|
+
# The user's own search words, echoed back. A judgment that fires here is wrong.
|
|
977
|
+
- |
|
|
978
|
+
import { Text } from '@sanity/ui-v5'
|
|
979
|
+
export function NoMatches({ query }) {
|
|
980
|
+
return <Text size={1}>No results for "{query}".</Text>
|
|
981
|
+
}
|
|
982
|
+
# A product name is a name, not jargon. A judgment that fires here is wrong.
|
|
983
|
+
- |
|
|
984
|
+
import { Button } from '@sanity/ui-v5'
|
|
985
|
+
export function GitHubSignIn({ onSignIn }) {
|
|
986
|
+
return <Button text="Sign in with GitHub" onClick={onSignIn} />
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
# An error message that leaks implementation detail breaks both the
|
|
990
|
+
# plain-language rule and error-messaging's own.
|
|
991
|
+
- kind: violates
|
|
992
|
+
guidelines: ['plain-language', 'name-what-failed']
|
|
993
|
+
code: |
|
|
994
|
+
import { Text } from '@sanity/ui-v5'
|
|
995
|
+
export function SaveError() {
|
|
996
|
+
return <Text size={1} tone="critical">Mutation rejected: _rev mismatch (409)</Text>
|
|
997
|
+
}
|
|
998
|
+
- kind: conforms
|
|
999
|
+
guidelines: ['plain-language', 'name-what-failed']
|
|
1000
|
+
code: |
|
|
1001
|
+
import { Text } from '@sanity/ui-v5'
|
|
1002
|
+
export function SaveError() {
|
|
1003
|
+
return <Text size={1} tone="critical">Someone else changed this document. Reload to see their version.</Text>
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
# ── destructive-copy → the dialog's title and button rules ───────────────
|
|
1007
|
+
# Labelled per rule, so a judge that only reads the title shows up as a
|
|
1008
|
+
# miss on the button case and not as a pass.
|
|
1009
|
+
# Both titles are fine for the title rule: the first names the action and
|
|
1010
|
+
# the target, and the second is not destructive. Only the buttons fail.
|
|
1011
|
+
- kind: violates
|
|
1012
|
+
guidelines: ['dialog-buttons-reinforce-the-action']
|
|
1013
|
+
code:
|
|
1014
|
+
- |
|
|
1015
|
+
import { Button, Dialog, Flex, Text } from '@sanity/ui-v5'
|
|
1016
|
+
export function ConfirmDelete({ document, open, onConfirm, onCancel }) {
|
|
1017
|
+
return (
|
|
1018
|
+
<Dialog header={`Do you want to delete ${document.name}?`} open={open} onClose={onCancel}>
|
|
1019
|
+
<Dialog.Content><Text>This can't be undone.</Text></Dialog.Content>
|
|
1020
|
+
<Dialog.Footer>
|
|
1021
|
+
<Flex gap={3} justifyContent="flex-end">
|
|
1022
|
+
<Button text="Cancel" level="secondary" onClick={onCancel} />
|
|
1023
|
+
<Button text="Confirm" tone="critical" onClick={onConfirm} />
|
|
1024
|
+
</Flex>
|
|
1025
|
+
</Dialog.Footer>
|
|
1026
|
+
</Dialog>
|
|
1027
|
+
)
|
|
1028
|
+
}
|
|
1029
|
+
- |
|
|
1030
|
+
import { Button, Dialog, Flex, Text } from '@sanity/ui-v5'
|
|
1031
|
+
export function ConfirmDelete({ open, onConfirm, onCancel }) {
|
|
1032
|
+
return (
|
|
1033
|
+
<Dialog header="Upgrade your account?" open={open} onClose={onCancel}>
|
|
1034
|
+
<Dialog.Content><Text>Upgrading gives you more tokens per month.</Text></Dialog.Content>
|
|
1035
|
+
<Dialog.Footer>
|
|
1036
|
+
<Flex gap={3} justifyContent="flex-end">
|
|
1037
|
+
<Button text="No, not yet" tone="critical" level="secondary" onClick={onCancel} />
|
|
1038
|
+
<Button text="Yes, upgrade my account " level="primary" onClick={onConfirm} />
|
|
1039
|
+
</Flex>
|
|
1040
|
+
</Dialog.Footer>
|
|
1041
|
+
</Dialog>
|
|
1042
|
+
)
|
|
1043
|
+
}
|
|
1044
|
+
# The button repeats the verb; only the title is vague.
|
|
1045
|
+
- kind: violates
|
|
1046
|
+
guidelines: ['destructive-dialog-title-names-target']
|
|
1047
|
+
code:
|
|
1048
|
+
- |
|
|
1049
|
+
import { Button, Dialog, Flex, Text } from '@sanity/ui-v5'
|
|
1050
|
+
export function ConfirmDelete({ open, onConfirm, onCancel }) {
|
|
1051
|
+
return (
|
|
1052
|
+
<Dialog header="Delete?" open={open} onClose={onCancel}>
|
|
1053
|
+
<Dialog.Content><Text>This can't be undone.</Text></Dialog.Content>
|
|
1054
|
+
<Dialog.Footer>
|
|
1055
|
+
<Flex gap={3} justifyContent="flex-end">
|
|
1056
|
+
<Button text="Cancel" level="secondary" onClick={onCancel} />
|
|
1057
|
+
<Button text="Delete" tone="critical" onClick={onConfirm} />
|
|
1058
|
+
</Flex>
|
|
1059
|
+
</Dialog.Footer>
|
|
1060
|
+
</Dialog>
|
|
1061
|
+
)
|
|
1062
|
+
}
|
|
1063
|
+
- |
|
|
1064
|
+
import { Button, Dialog, Flex, Text } from '@sanity/ui-v5'
|
|
1065
|
+
export function ConfirmDelete({ open, onConfirm, onCancel }) {
|
|
1066
|
+
return (
|
|
1067
|
+
<Dialog header="Stop process?" open={open} onClose={onCancel}>
|
|
1068
|
+
<Dialog.Content><Text>This can't be undone.</Text></Dialog.Content>
|
|
1069
|
+
<Dialog.Footer>
|
|
1070
|
+
<Flex gap={3} justifyContent="flex-end">
|
|
1071
|
+
<Button text="No" level="secondary" onClick={onCancel} />
|
|
1072
|
+
<Button text="Yes" tone="critical" onClick={onConfirm} />
|
|
1073
|
+
</Flex>
|
|
1074
|
+
</Dialog.Footer>
|
|
1075
|
+
</Dialog>
|
|
1076
|
+
)
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
- kind: conforms
|
|
1080
|
+
guidelines: ['destructive-dialog-title-names-target', 'dialog-buttons-reinforce-the-action']
|
|
1081
|
+
code:
|
|
1082
|
+
- |
|
|
1083
|
+
import { Button, Dialog, Flex, Text } from '@sanity/ui-v5'
|
|
1084
|
+
export function ConfirmDelete({ page, open, onConfirm, onCancel }) {
|
|
1085
|
+
return (
|
|
1086
|
+
<Dialog header={`Delete '${page.title}'?`} open={open} onClose={onCancel}>
|
|
1087
|
+
<Dialog.Content><Text>The page and its 3 drafts are removed. This can't be undone.</Text></Dialog.Content>
|
|
1088
|
+
<Dialog.Footer>
|
|
1089
|
+
<Flex gap={3} justifyContent="flex-end">
|
|
1090
|
+
<Button text="Don't delete" level="secondary" onClick={onCancel} />
|
|
1091
|
+
<Button text="Delete page and 3 drafts" tone="critical" onClick={onConfirm} />
|
|
1092
|
+
</Flex>
|
|
1093
|
+
</Dialog.Footer>
|
|
1094
|
+
</Dialog>
|
|
1095
|
+
)
|
|
1096
|
+
}
|
|
1097
|
+
- |
|
|
1098
|
+
import { Button, Dialog, Flex, Text } from '@sanity/ui-v5'
|
|
1099
|
+
export function ConfirmDelete({ process, open, onConfirm, onCancel }) {
|
|
1100
|
+
return (
|
|
1101
|
+
<Dialog header={`Stop '${process.name}'?`} open={open} onClose={onCancel}>
|
|
1102
|
+
<Dialog.Content><Text>This will immediately suspend the active process and can't be undone.</Text></Dialog.Content>
|
|
1103
|
+
<Dialog.Footer>
|
|
1104
|
+
<Flex gap={3} justifyContent="flex-end">
|
|
1105
|
+
<Button text="Don't stop process" level="secondary" onClick={onCancel} />
|
|
1106
|
+
<Button text="Stop process" tone="critical" onClick={onConfirm} />
|
|
1107
|
+
</Flex>
|
|
1108
|
+
</Dialog.Footer>
|
|
1109
|
+
</Dialog>
|
|
1110
|
+
)
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
# ── destructive-tone → destructive-actions-use-critical-tone ─────────────
|
|
1114
|
+
- kind: violates
|
|
1115
|
+
guidelines: ['destructive-actions-use-critical-tone']
|
|
1116
|
+
code:
|
|
1117
|
+
- |
|
|
1118
|
+
import { Button } from '@sanity/ui-v5'
|
|
1119
|
+
export function DeleteProject({ onDelete }) {
|
|
1120
|
+
return <Button text="Delete project" onClick={onDelete} />
|
|
1121
|
+
}
|
|
1122
|
+
# Tone without the icon the rule pairs it with.
|
|
1123
|
+
- |
|
|
1124
|
+
import { Button } from '@sanity/ui-v5'
|
|
1125
|
+
export function RevokeAccess({ onRevoke }) {
|
|
1126
|
+
return <Button text="Revoke access" tone="critical" onClick={onRevoke} />
|
|
1127
|
+
}
|
|
1128
|
+
# The confirm is demoted below Cancel to make it less prominent.
|
|
1129
|
+
- |
|
|
1130
|
+
import { Button, Dialog, Flex, Text } from '@sanity/ui-v5'
|
|
1131
|
+
import { TrashIcon } from '@sanity/icons/Trash'
|
|
1132
|
+
export function ConfirmDeleteProject({ project, open, onConfirm, onCancel }) {
|
|
1133
|
+
return (
|
|
1134
|
+
<Dialog header={`Delete '${project.name}'?`} open={open} onClose={onCancel}>
|
|
1135
|
+
<Dialog.Content><Text>All documents in the project are removed. This can't be undone.</Text></Dialog.Content>
|
|
1136
|
+
<Dialog.Footer>
|
|
1137
|
+
<Flex gap={3} justifyContent="flex-end">
|
|
1138
|
+
<Button text="Don't delete" level="secondary" onClick={onCancel} />
|
|
1139
|
+
<Button text="Delete project" tone="critical" level="tertiary" iconStart={TrashIcon} onClick={onConfirm} />
|
|
1140
|
+
</Flex>
|
|
1141
|
+
</Dialog.Footer>
|
|
1142
|
+
</Dialog>
|
|
1143
|
+
)
|
|
1144
|
+
}
|
|
1145
|
+
- kind: conforms
|
|
1146
|
+
guidelines: ['destructive-actions-use-critical-tone']
|
|
1147
|
+
code:
|
|
1148
|
+
- |
|
|
1149
|
+
import { Button } from '@sanity/ui-v5'
|
|
1150
|
+
import { TrashIcon } from '@sanity/icons/Trash'
|
|
1151
|
+
export function DeleteProject({ onDelete }) {
|
|
1152
|
+
return <Button text="Delete project" tone="critical" level="primary" iconStart={TrashIcon} onClick={onDelete} />
|
|
1153
|
+
}
|
|
1154
|
+
# The same dialog with the confirm at its real importance.
|
|
1155
|
+
- |
|
|
1156
|
+
import { Button, Dialog, Flex, Text } from '@sanity/ui-v5'
|
|
1157
|
+
import { TrashIcon } from '@sanity/icons/Trash'
|
|
1158
|
+
export function ConfirmDeleteProject({ project, open, onConfirm, onCancel }) {
|
|
1159
|
+
return (
|
|
1160
|
+
<Dialog header={`Delete '${project.name}'?`} open={open} onClose={onCancel}>
|
|
1161
|
+
<Dialog.Content><Text>All documents in the project are removed. This can't be undone.</Text></Dialog.Content>
|
|
1162
|
+
<Dialog.Footer>
|
|
1163
|
+
<Flex gap={3} justifyContent="flex-end">
|
|
1164
|
+
<Button text="Don't delete" level="secondary" onClick={onCancel} />
|
|
1165
|
+
<Button text="Delete project" tone="critical" level="primary" iconStart={TrashIcon} onClick={onConfirm} />
|
|
1166
|
+
</Flex>
|
|
1167
|
+
</Dialog.Footer>
|
|
1168
|
+
</Dialog>
|
|
1169
|
+
)
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
# ── truncate-body → no-truncate-body-copy ────────────────────────────────
|
|
1173
|
+
- kind: violates
|
|
1174
|
+
guidelines: ['no-truncate-body-copy']
|
|
1175
|
+
code:
|
|
1176
|
+
- |
|
|
1177
|
+
import { Text } from '@sanity/ui-v5'
|
|
1178
|
+
export function ArticleBody({ article }) {
|
|
1179
|
+
return <Text truncate={2}>{article.body}</Text>
|
|
1180
|
+
}
|
|
1181
|
+
- |
|
|
1182
|
+
import { Card, Text } from '@sanity/ui-v5'
|
|
1183
|
+
export function ReleaseNote({ note }) {
|
|
1184
|
+
return <Card><Text truncate={1}>{note.summaryParagraph}</Text></Card>
|
|
1185
|
+
}
|
|
1186
|
+
- kind: conforms
|
|
1187
|
+
guidelines: ['no-truncate-body-copy']
|
|
1188
|
+
code:
|
|
1189
|
+
- |
|
|
1190
|
+
import { Text } from '@sanity/ui-v5'
|
|
1191
|
+
export function ArticleBody({ article }) {
|
|
1192
|
+
return <Text>{article.body}</Text>
|
|
1193
|
+
}
|
|
1194
|
+
# Metadata is exactly what truncate is for. A judgment that fires here is wrong.
|
|
1195
|
+
- |
|
|
1196
|
+
import { Text } from '@sanity/ui-v5'
|
|
1197
|
+
export function DocSlug({ doc }) {
|
|
1198
|
+
return <Text size={1} muted truncate={1}>{doc.slug}</Text>
|
|
1199
|
+
}
|
|
1200
|
+
# Added 2026-09-25 from the corpus's own chunks, which Jev flagged. Each is
|
|
1201
|
+
# correct under the current docs: Icon and IconButton hide their icon by
|
|
1202
|
+
# themselves, `style` is the only path on a native element, and layout
|
|
1203
|
+
# props belong on the Box around a Text or Button.
|
|
1204
|
+
- kind: conforms
|
|
1205
|
+
guidelines: ['icon-only-control-needs-name']
|
|
1206
|
+
code:
|
|
1207
|
+
# From toolbar-action-bar. The IconButton names itself; the Tooltip only adds a hint.
|
|
1208
|
+
- |
|
|
1209
|
+
import { Flex, IconButton, Tooltip } from '@sanity/ui-v5'
|
|
1210
|
+
import { CopyIcon } from '@sanity/icons/Copy'
|
|
1211
|
+
import { EllipsisHorizontalIcon } from '@sanity/icons/EllipsisHorizontal'
|
|
1212
|
+
export function SecondaryActions({ onCopy, onMore }) {
|
|
1213
|
+
return (
|
|
1214
|
+
<Flex gap={1}>
|
|
1215
|
+
<Tooltip content="Copy">
|
|
1216
|
+
<IconButton icon={CopyIcon} aria-label="Copy" onClick={onCopy} />
|
|
1217
|
+
</Tooltip>
|
|
1218
|
+
<IconButton icon={EllipsisHorizontalIcon} aria-label="More actions" onClick={onMore} />
|
|
1219
|
+
</Flex>
|
|
1220
|
+
)
|
|
1221
|
+
}
|
|
1222
|
+
# A bare decorative Icon beside visible text. Icon hides itself.
|
|
1223
|
+
- |
|
|
1224
|
+
import { Flex, Icon, Text } from '@sanity/ui-v5'
|
|
1225
|
+
import { DocumentIcon } from '@sanity/icons/Document'
|
|
1226
|
+
export function DocumentRow({ title }) {
|
|
1227
|
+
return (
|
|
1228
|
+
<Flex gap={2} alignItems="center">
|
|
1229
|
+
<Icon icon={DocumentIcon} muted />
|
|
1230
|
+
<Text size={1}>{title}</Text>
|
|
1231
|
+
</Flex>
|
|
1232
|
+
)
|
|
1233
|
+
}
|
|
1234
|
+
- kind: violates
|
|
1235
|
+
guidelines: ['icon-only-control-needs-name']
|
|
1236
|
+
code:
|
|
1237
|
+
# A Tooltip is not an accessible name.
|
|
1238
|
+
- |
|
|
1239
|
+
import { IconButton, Tooltip } from '@sanity/ui-v5'
|
|
1240
|
+
import { CloseIcon } from '@sanity/icons/Close'
|
|
1241
|
+
export function CloseAction({ onClose }) {
|
|
1242
|
+
return (
|
|
1243
|
+
<Tooltip content="Close navigation">
|
|
1244
|
+
<IconButton icon={CloseIcon} onClick={onClose} />
|
|
1245
|
+
</Tooltip>
|
|
1246
|
+
)
|
|
1247
|
+
}
|
|
1248
|
+
- kind: conforms
|
|
1249
|
+
guidelines: ['prop-before-inline-style']
|
|
1250
|
+
code:
|
|
1251
|
+
# From data-table. A native table has no Sanity UI equivalent, so style is its only path.
|
|
1252
|
+
- |
|
|
1253
|
+
import { Box, Text } from '@sanity/ui-v5'
|
|
1254
|
+
export function Table({ rows }) {
|
|
1255
|
+
return (
|
|
1256
|
+
<Box overflowX="auto">
|
|
1257
|
+
<table style={{ width: '100%', borderCollapse: 'collapse' }}>
|
|
1258
|
+
<tbody>
|
|
1259
|
+
{rows.map((r) => (
|
|
1260
|
+
<tr key={r.id}>
|
|
1261
|
+
<td style={{ padding: 'var(--space-3)', borderTop: '1px solid var(--separator-low)' }}>
|
|
1262
|
+
<Text size={1}>{r.title}</Text>
|
|
1263
|
+
</td>
|
|
1264
|
+
</tr>
|
|
1265
|
+
))}
|
|
1266
|
+
</tbody>
|
|
1267
|
+
</table>
|
|
1268
|
+
</Box>
|
|
1269
|
+
)
|
|
1270
|
+
}
|
|
1271
|
+
# From form-layout. The reset removes the browser's default fieldset border and spacing.
|
|
1272
|
+
- |
|
|
1273
|
+
import { Box, Checkbox, Text, VStack } from '@sanity/ui-v5'
|
|
1274
|
+
export function Notifications() {
|
|
1275
|
+
return (
|
|
1276
|
+
<fieldset style={{ border: 0, margin: 0, padding: 0, minWidth: 0 }}>
|
|
1277
|
+
<legend style={{ padding: 0 }}>
|
|
1278
|
+
<Text size={1} weight="medium">Notifications</Text>
|
|
1279
|
+
</legend>
|
|
1280
|
+
<Box marginTop={3}>
|
|
1281
|
+
<VStack gap={3}>
|
|
1282
|
+
<Checkbox label="Email notifications" name="notifyEmail" />
|
|
1283
|
+
</VStack>
|
|
1284
|
+
</Box>
|
|
1285
|
+
</fieldset>
|
|
1286
|
+
)
|
|
1287
|
+
}
|
|
1288
|
+
- kind: conforms
|
|
1289
|
+
guidelines: ['no-layout-props-on-typography-or-actions']
|
|
1290
|
+
code:
|
|
1291
|
+
# From inspector-panel. Layout props sit on the Box; fullWidth is Button's own prop.
|
|
1292
|
+
- |
|
|
1293
|
+
import { Box, Button, VStack } from '@sanity/ui-v5'
|
|
1294
|
+
export function PanelActions({ actions }) {
|
|
1295
|
+
return (
|
|
1296
|
+
<Box padding={3} flexShrink={0}>
|
|
1297
|
+
<VStack gap={2}>
|
|
1298
|
+
{actions.map((a) => (
|
|
1299
|
+
<Button key={a.label} level="secondary" text={a.label} fullWidth onClick={a.onClick} />
|
|
1300
|
+
))}
|
|
1301
|
+
</VStack>
|
|
1302
|
+
</Box>
|
|
1303
|
+
)
|
|
1304
|
+
}
|
|
1305
|
+
# From inspector-panel. The Box sizes the column; the Text inside has only its own props.
|
|
1306
|
+
- |
|
|
1307
|
+
import { Box, Flex, Text } from '@sanity/ui-v5'
|
|
1308
|
+
export function DetailRow({ label, value }) {
|
|
1309
|
+
return (
|
|
1310
|
+
<Flex gap={3} alignItems="flex-start">
|
|
1311
|
+
<Box minWidth="120px" flexShrink={0}>
|
|
1312
|
+
<Text size={1} muted weight="semibold">{label}</Text>
|
|
1313
|
+
</Box>
|
|
1314
|
+
<Box flexGrow={1} minWidth="0">
|
|
1315
|
+
<Text size={1}>{value}</Text>
|
|
1316
|
+
</Box>
|
|
1317
|
+
</Flex>
|
|
1318
|
+
)
|
|
1319
|
+
}
|