@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.
Files changed (128) hide show
  1. package/README.md +10 -0
  2. package/dist/index.js +1 -1
  3. package/dist/index.js.map +1 -1
  4. package/dist/styles.css +1 -1
  5. package/docs/components/avatar-counter.dsds.yaml +78 -0
  6. package/docs/components/avatar-stack.dsds.yaml +96 -0
  7. package/docs/components/avatar.dsds.yaml +115 -0
  8. package/docs/components/badge.dsds.yaml +126 -0
  9. package/docs/components/box.dsds.yaml +223 -0
  10. package/docs/components/button.dsds.yaml +284 -0
  11. package/docs/components/card.dsds.yaml +317 -0
  12. package/docs/components/checkbox.dsds.yaml +204 -0
  13. package/docs/components/code.dsds.yaml +167 -0
  14. package/docs/components/container.dsds.yaml +189 -0
  15. package/docs/components/dialog.dsds.yaml +343 -0
  16. package/docs/components/divider.dsds.yaml +93 -0
  17. package/docs/components/eyebrow.dsds.yaml +217 -0
  18. package/docs/components/flex.dsds.yaml +237 -0
  19. package/docs/components/grid.dsds.yaml +217 -0
  20. package/docs/components/h-stack.dsds.yaml +127 -0
  21. package/docs/components/heading.dsds.yaml +233 -0
  22. package/docs/components/hotkeys.dsds.yaml +60 -0
  23. package/docs/components/icon-button.dsds.yaml +220 -0
  24. package/docs/components/icon.dsds.yaml +275 -0
  25. package/docs/components/indicator-stack.dsds.yaml +98 -0
  26. package/docs/components/indicator.dsds.yaml +108 -0
  27. package/docs/components/inline.dsds.yaml +127 -0
  28. package/docs/components/kbd.dsds.yaml +59 -0
  29. package/docs/components/link.dsds.yaml +108 -0
  30. package/docs/components/list-button-item.dsds.yaml +103 -0
  31. package/docs/components/list-item-image.dsds.yaml +82 -0
  32. package/docs/components/list-item-text.dsds.yaml +80 -0
  33. package/docs/components/list-item.dsds.yaml +148 -0
  34. package/docs/components/list.dsds.yaml +162 -0
  35. package/docs/components/popover.dsds.yaml +208 -0
  36. package/docs/components/press-area.dsds.yaml +279 -0
  37. package/docs/components/radio.dsds.yaml +198 -0
  38. package/docs/components/select.dsds.yaml +214 -0
  39. package/docs/components/skip-to-content.dsds.yaml +110 -0
  40. package/docs/components/spinner.dsds.yaml +119 -0
  41. package/docs/components/switch.dsds.yaml +202 -0
  42. package/docs/components/tab.dsds.yaml +54 -0
  43. package/docs/components/tabs-list.dsds.yaml +56 -0
  44. package/docs/components/tabs-panel.dsds.yaml +54 -0
  45. package/docs/components/tabs.dsds.yaml +104 -0
  46. package/docs/components/text-area.dsds.yaml +170 -0
  47. package/docs/components/text-input.dsds.yaml +189 -0
  48. package/docs/components/text.dsds.yaml +268 -0
  49. package/docs/components/tooltip-group.dsds.yaml +90 -0
  50. package/docs/components/tooltip.dsds.yaml +216 -0
  51. package/docs/components/v-stack.dsds.yaml +155 -0
  52. package/docs/components/visually-hidden.dsds.yaml +112 -0
  53. package/docs/evals/cases.yaml +1319 -0
  54. package/docs/examples/checkbox-2.tsx +57 -0
  55. package/docs/examples/confirmation-dialogs-1.tsx +27 -0
  56. package/docs/examples/confirmation-dialogs-2.tsx +55 -0
  57. package/docs/examples/confirmation-dialogs-3.tsx +28 -0
  58. package/docs/examples/confirmation-dialogs-4.tsx +38 -0
  59. package/docs/examples/popover-1.tsx +48 -0
  60. package/docs/examples/popover-2.tsx +53 -0
  61. package/docs/foundations/accessibility-guidelines.dsds.yaml +301 -0
  62. package/docs/foundations/color-guidelines.dsds.yaml +308 -0
  63. package/docs/foundations/content-guidelines.dsds.yaml +285 -0
  64. package/docs/foundations/semantics.dsds.yaml +125 -0
  65. package/docs/foundations/spacing-guidelines.dsds.yaml +226 -0
  66. package/docs/foundations/typography-guidelines.dsds.yaml +322 -0
  67. package/docs/icons.dsds.yaml +2513 -0
  68. package/docs/index.dsds.yaml +515 -0
  69. package/docs/overview/api-essentials.dsds.yaml +221 -0
  70. package/docs/overview/component-reference.dsds.yaml +215 -0
  71. package/docs/overview/designer-contribution-model.dsds.yaml +77 -0
  72. package/docs/overview/developer-contribution-model.dsds.yaml +362 -0
  73. package/docs/overview/installation.dsds.yaml +238 -0
  74. package/docs/overview/quick-start.dsds.yaml +317 -0
  75. package/docs/overview/resources.dsds.yaml +34 -0
  76. package/docs/patterns/confirmation-dialogs.dsds.yaml +140 -0
  77. package/docs/patterns/error-messaging.dsds.yaml +58 -0
  78. package/docs/patterns/forms.dsds.yaml +356 -0
  79. package/docs/patterns/layouts.dsds.yaml +403 -0
  80. package/docs/patterns/loading-states.dsds.yaml +41 -0
  81. package/docs/patterns/messaging.dsds.yaml +72 -0
  82. package/docs/patterns/navigation.dsds.yaml +153 -0
  83. package/docs/patterns/responsive.dsds.yaml +590 -0
  84. package/docs/tokens/color.dsds.yaml +1158 -0
  85. package/docs/tokens/container-widths.dsds.yaml +131 -0
  86. package/docs/tokens/content.dsds.yaml +258 -0
  87. package/docs/tokens/content.tokens.json +180 -0
  88. package/docs/tokens/dtcg/README.md +39 -0
  89. package/docs/tokens/dtcg/css/color.css +107 -0
  90. package/docs/tokens/dtcg/css/container.css +12 -0
  91. package/docs/tokens/dtcg/css/fontFamily.css +10 -0
  92. package/docs/tokens/dtcg/css/fontWeight.css +10 -0
  93. package/docs/tokens/dtcg/css/index.css +13 -0
  94. package/docs/tokens/dtcg/css/radius.css +14 -0
  95. package/docs/tokens/dtcg/css/semantic.css +42 -0
  96. package/docs/tokens/dtcg/css/shadow.css +22 -0
  97. package/docs/tokens/dtcg/css/space.css +16 -0
  98. package/docs/tokens/dtcg/css/typography.css +69 -0
  99. package/docs/tokens/dtcg/json/color.tokens.json +911 -0
  100. package/docs/tokens/dtcg/json/container.tokens.json +44 -0
  101. package/docs/tokens/dtcg/json/fontFamily.tokens.json +10 -0
  102. package/docs/tokens/dtcg/json/fontWeight.tokens.json +18 -0
  103. package/docs/tokens/dtcg/json/radius.tokens.json +58 -0
  104. package/docs/tokens/dtcg/json/semantic.tokens.json +372 -0
  105. package/docs/tokens/dtcg/json/shadow.tokens.json +599 -0
  106. package/docs/tokens/dtcg/json/space.tokens.json +72 -0
  107. package/docs/tokens/dtcg/json/typography.tokens.json +354 -0
  108. package/docs/tokens/font-family.dsds.yaml +79 -0
  109. package/docs/tokens/font-weight.dsds.yaml +103 -0
  110. package/docs/tokens/radius.dsds.yaml +153 -0
  111. package/docs/tokens/semantic.dsds.yaml +397 -0
  112. package/docs/tokens/shadow.dsds.yaml +125 -0
  113. package/docs/tokens/space.dsds.yaml +185 -0
  114. package/docs/tokens/typography.dsds.yaml +316 -0
  115. package/llms.txt +108 -0
  116. package/package.json +6 -3
  117. package/skills/sanity-ui-5/SKILL.md +158 -0
  118. package/skills/sanity-ui-5/references/component-choice.md +37 -0
  119. package/skills/sanity-ui-5/references/components.md +145 -0
  120. package/skills/sanity-ui-5/references/forms-and-accessibility.md +189 -0
  121. package/skills/sanity-ui-5/references/migrating-from-v3.md +250 -0
  122. package/skills/sanity-ui-5/references/props-and-imports.md +169 -0
  123. package/skills/sanity-ui-5/references/setup.md +177 -0
  124. package/skills/sanity-ui-5/references/silent-failures.md +33 -0
  125. package/skills/sanity-ui-5/references/taste.md +53 -0
  126. package/skills/sanity-ui-5/references/tone-and-color.md +55 -0
  127. package/src/css/classes/system/shadow.css +45 -0
  128. package/src/version.ts +2 -2
@@ -0,0 +1,155 @@
1
+ kind: component
2
+ id: v-stack
3
+ name: VStack
4
+ description: Stacks children vertically with even spacing.
5
+ metadata:
6
+ tags: [layout, vertical, stack, column, gap, form, vstack, list, flex]
7
+ status:
8
+ status: stable
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: 'For common layouts with uniform vertical spacing: form fields, item collections, and sequential controls or content.'
17
+ - level: should-not
18
+ statement: For horizontal stacking. Use HStack or Flex instead.
19
+ alternatives:
20
+ - to: h-stack
21
+ - to: flex
22
+ - level: should-not
23
+ statement: For vertical layouts needing custom alignment or wrapping. Use Flex instead.
24
+ alternatives:
25
+ - to: flex
26
+ - level: should-not
27
+ statement: For two-axis layouts. Use Grid instead.
28
+ alternatives:
29
+ - to: grid
30
+ - kind: guidelines
31
+ for: all
32
+ framing: how-to-use
33
+ items:
34
+ - level: should
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
+ - level: should
37
+ statement: Wrap VStack with Box when padding or margin values are needed.
38
+ - id: don-vstack-need-alignitems-justifycontent
39
+ level: must-not
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
+ refines:
42
+ - to: v-stack#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
43
+ - level: must-not
44
+ statement: Don't add margin to children for spacing — use gap.
45
+ - kind: guidelines
46
+ for: agent
47
+ framing: how-to-use
48
+ items:
49
+ - level: must-not
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
+ - level: must-not
52
+ 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
+ - kind: guidelines
55
+ for: all
56
+ title: Accessibility
57
+ tags: [accessibility]
58
+ items:
59
+ - level: should
60
+ statement: Using `as="ul"` or `as="ol"` with VStack needs extra setup. Children must be `<li>` elements and `role="list"` must be applied.
61
+ - id: v-stack-dom-order-not-css-order
62
+ level: must-not
63
+ statement: Don’t use CSS to change the visual order of VStack's children. Children render in DOM order–meaning screen readers will not detect CSS order changes.
64
+ - kind: section
65
+ for: agent
66
+ freeform:
67
+ - title: VStack vs Flex column
68
+ body: |-
69
+ VStack only accepts `as` and `gap`. Passing any other prop directly is a TypeScript error.
70
+
71
+ ```tsx
72
+ // correct — gap is the only spacing control
73
+ <VStack gap={4}>
74
+ <Heading as="h2">Title</Heading>
75
+ <Text>Body text</Text>
76
+ </VStack>
77
+
78
+ // wrong — TS2322: padding and alignItems do not exist on VStack
79
+ <VStack gap={4} padding={4} alignItems="center">
80
+ ...
81
+ </VStack>
82
+ ```
83
+
84
+ When you need padding, alignment, or distribution, use `Flex`:
85
+
86
+ ```tsx
87
+ <Flex flexDirection="column" gap={4} padding={4} alignItems="center">
88
+ <Heading as="h2">Title</Heading>
89
+ <Text>Body text</Text>
90
+ </Flex>
91
+ ```
92
+
93
+ alternatives:
94
+ - to: flex
95
+ note: Column or row layout with full flex control
96
+ - to: h-stack
97
+ note: Horizontal row, aligned to center
98
+ - to: grid
99
+ note: Two-axis layout
100
+ refs:
101
+ - href: https://www.figma.com/design/5mhVqXlldJEEB2VWZeKQ4i/Sanity-UI?node-id=32600-2620
102
+ rel: design
103
+ role: Figma component (v5)
104
+ - to: space
105
+ rel: relates-to
106
+ sourceFiles:
107
+ - platform: react
108
+ file: packages/ui/src/components/v-stack/VStack.tsx
109
+ imports:
110
+ - platform: react
111
+ code: import { VStack } from '@sanity/ui'
112
+ package: '@sanity/ui'
113
+ $extensions:
114
+ com.sanity.ui:
115
+ implementationStatus:
116
+ context: Implementation status. Lets a tool tell a component that is coming from one that does not exist, without parsing the status note.
117
+ implemented: true
118
+ migrationGuide:
119
+ context: 'Migration guide for this component, covering the codemod and the changes it cannot make. Held as an extension because it is temporary: migration tooling and porting agents read it, and it should be dropped when Sanity UI 3 support ends.'
120
+ codemod: |-
121
+ VStack replaces `@sanity/ui`'s Stack used in its default vertical direction. `space`→`gap`; `sizing` is removed with no replacement. A Stack that used padding, margin, overflow, or flex props migrates to `Flex flexDirection="column"` instead, since VStack accepts only `gap` and `as`.
122
+
123
+ Run the codemod: `pnpx @sanity/ui-codemod latest:stack --paths <paths> --toPackage @sanity/ui`. It chooses VStack or Flex per instance depending on which props are present.
124
+ guidance: |-
125
+ VStack replaces `@sanity/ui`'s Stack component, used with its default vertical direction. The API changes are:
126
+
127
+ ### Key differences
128
+
129
+ - `space` renamed to `gap`, matching the prop name used across other v5 layout components.
130
+ - `sizing` removed. v3's `sizing` prop has no v5 equivalent — use `style={{ boxSizing: '...' }}` directly if needed.
131
+ - A v3 Stack that used padding, margin, overflow, or flex props migrates to `Flex flexDirection="column"` instead of VStack, since VStack accepts only `gap` and `as`.
132
+
133
+ ### Detailed list of differences
134
+
135
+ | v3 prop | v5 prop | Notes |
136
+ | :---- | :---- | :---- |
137
+ | `space` | `gap` | Renamed. Same scale (`0`–`9`, `'inherit'`). |
138
+ | `sizing` | — | Removed. No direct replacement. |
139
+ | `padding`, `margin`, `overflow`, `flex*` | — | Not supported on VStack. A Stack using any of these migrates to `Flex flexDirection="column"` instead — see the Flex migration guide for that prop set. |
140
+
141
+ ### Breaking changes
142
+
143
+ - **`space` prop renamed to `gap`.** `<Stack space={3}>` no longer sets spacing. Use `<VStack gap={3}>`.
144
+ - **`sizing` prop removed.** `<Stack sizing="border">` does nothing on VStack. There is no replacement prop.
145
+ - **Layout props no longer apply.** A v3 Stack that set `padding`, `margin`, `overflow`, or any flex prop needs `Flex flexDirection="column"` in v5, not VStack — VStack accepts only `gap` and `as`.
146
+
147
+ ### Codemod
148
+
149
+ A codemod is available to ease the changes above. Run the command below with the path to the file or folder you want to migrate. Use spaces to pass more than one path.
150
+
151
+ ```
152
+ pnpx @sanity/ui-codemod latest:stack --paths <paths> --toPackage @sanity/ui
153
+ ```
154
+
155
+ The codemod inspects each Stack instance. One with only `space`/`gap`-style props becomes `VStack`, with `space` renamed to `gap`. One that also uses padding, margin, overflow, or flex props becomes `Flex flexDirection="column"` instead, with those props converted the same way as the Flex codemod. If a component instance cannot be migrated or needs manual review, the codemod inserts a comment prefixed with "UI-POC-CODEMOD TODO".
@@ -0,0 +1,112 @@
1
+ kind: component
2
+ id: visually-hidden
3
+ name: VisuallyHidden
4
+ description: Hides content from sighted users while keeping it in the accessibility tree.
5
+ metadata:
6
+ tags:
7
+ - accessibility
8
+ - screen-reader
9
+ - hidden
10
+ - visually-hidden
11
+ - ARIA
12
+ - accessible-name
13
+ - sr-only
14
+ - clip
15
+ - aria-label
16
+ status:
17
+ status: stable
18
+ sections:
19
+ - kind: guidelines
20
+ for: all
21
+ framing: when-to-use
22
+ title: When to use
23
+ items:
24
+ - level: must
25
+ statement: When content must be visible for browser reading modes, translation tools, and some testing frameworks. `aria-label` is often invisible in those circumstances.
26
+ - level: should
27
+ statement: "To add screen-reader-only context to a control with a visual label (for example, 'Edit John Doe' where 'John Doe' comes from row context)."
28
+ - level: should
29
+ statement: As extra content for a repeated text content, such as links.
30
+ - level: should
31
+ statement: As a table column header that's visually implied.
32
+ - level: should
33
+ statement: As status text to support indicators or color-only elements.
34
+ - level: should
35
+ statement: To label a section landmark when the visual treatment doesn't include a visible heading.
36
+ - level: should-not
37
+ statement: For content the user shouldn't see at all. Use Box with display='none' instead.
38
+ alternatives:
39
+ - to: box
40
+ - level: should-not
41
+ statement: To hide decorative imagery — use aria-hidden='true' on the visual instead.
42
+ - level: should-not
43
+ statement: For collapsible UI — use hidden on the wrapping element or conditional rendering.
44
+ - kind: guidelines
45
+ for: agent
46
+ framing: when-to-use
47
+ title: When to use
48
+ items:
49
+ - level: should-not
50
+ statement: To give an accessible name to an icon-only control (close button, sort handle). Use an IconButton instead.
51
+ alternatives:
52
+ - to: icon-button
53
+ - kind: guidelines
54
+ for: all
55
+ framing: how-to-use
56
+ items:
57
+ - level: should
58
+ statement: 'Pair VisuallyHidden with content that must reach assistive technology but not sighted users: per-row context on a control that already has a visible label, or status text backing a color-only indicator. For an icon-only control, use IconButton instead.'
59
+ - level: should
60
+ statement: Use sentence-case, action-describing text. 'Close dialog' not 'Close'.
61
+ - level: must-not
62
+ statement: Don't use VisuallyHidden to hide content you'll show later — use conditional rendering or hidden.
63
+ - level: must-not
64
+ statement: Don't put interactive elements (button, a) inside VisuallyHidden — they remain keyboard-reachable and the user sees a focus ring on invisible content.
65
+ - kind: guidelines
66
+ for: agent
67
+ framing: how-to-use
68
+ items:
69
+ - level: must
70
+ statement: Use a visible label element (Text as='label', linked with htmlFor) for form labels. Use VisuallyHidden with as='label' when a visible label is not possible.
71
+ - level: must-not
72
+ statement: 'Do not use VisuallyHidden for content that should be fully hidden — use display: none.'
73
+ - level: must-not
74
+ statement: "Putting a button inside VisuallyHidden to hide an action from sighted users. Instead: Use display='none' or conditional rendering — VisuallyHidden keeps content focusable."
75
+
76
+ - kind: guidelines
77
+ for: all
78
+ title: Accessibility
79
+ tags: [accessibility]
80
+ items:
81
+ - level: should
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-does-replace-prefer-short
84
+ level: should
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
+
87
+ refs:
88
+ - to: icon-button
89
+ rel: relates-to
90
+ note: Preferred for a plain icon-only button — it takes a required `aria-label` for the accessible name
91
+ - to: checkbox
92
+ rel: relates-to
93
+ note: Input components that use VisuallyHidden internally to hide the native `<input>` while keeping it focusable and announceable
94
+ - to: radio
95
+ rel: relates-to
96
+ note: Input components that use VisuallyHidden internally to hide the native `<input>` while keeping it focusable and announceable
97
+ - to: switch
98
+ rel: relates-to
99
+ note: Input components that use VisuallyHidden internally to hide the native `<input>` while keeping it focusable and announceable
100
+ sourceFiles:
101
+ - platform: react
102
+ file: packages/ui/src/components/visually-hidden/VisuallyHidden.tsx
103
+ imports:
104
+ - platform: react
105
+ code: import { VisuallyHidden } from '@sanity/ui'
106
+ package: '@sanity/ui'
107
+
108
+ $extensions:
109
+ com.sanity.ui:
110
+ implementationStatus:
111
+ context: Implementation status. Lets a tool tell a component that is coming from one that does not exist, without parsing the status note.
112
+ implemented: true