@sanity/ui 3.0.0-static.26 → 3.0.0-static.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.
Files changed (248) hide show
  1. package/README.md +1 -1
  2. package/dist/_chunks-cjs/_visual-editing.cjs +674 -804
  3. package/dist/_chunks-cjs/_visual-editing.cjs.map +1 -1
  4. package/dist/_chunks-cjs/refractor.cjs +2 -2
  5. package/dist/_chunks-cjs/refractor.cjs.map +1 -1
  6. package/dist/_chunks-es/_visual-editing.js +652 -781
  7. package/dist/_chunks-es/_visual-editing.js.map +1 -1
  8. package/dist/_chunks-es/refractor.js +1 -1
  9. package/dist/_visual-editing.d.cts +1 -0
  10. package/dist/_visual-editing.d.ts +1 -0
  11. package/dist/css/layers.css +4 -0
  12. package/dist/css/primitives/popover/popover.css +4 -0
  13. package/dist/css.cjs +59 -50
  14. package/dist/css.cjs.map +1 -1
  15. package/dist/css.d.cts +14 -6
  16. package/dist/css.d.ts +14 -6
  17. package/dist/css.js +59 -50
  18. package/dist/css.js.map +1 -1
  19. package/dist/index.cjs +1995 -1813
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.css +1 -0
  22. package/dist/index.d.cts +35 -17
  23. package/dist/index.d.ts +35 -17
  24. package/dist/index.js +2013 -1832
  25. package/dist/index.js.map +1 -1
  26. package/dist/theme.cjs +2605 -1075
  27. package/dist/theme.cjs.map +1 -1
  28. package/dist/theme.d.cts +1 -1
  29. package/dist/theme.d.ts +1 -1
  30. package/dist/theme.js +2689 -1159
  31. package/dist/theme.js.map +1 -1
  32. package/exports/_visual-editing.ts +2 -2
  33. package/package.json +20 -38
  34. package/src/core/components/autocomplete/__workshop__/constrainedHeight.tsx +2 -2
  35. package/src/core/components/autocomplete/__workshop__/fullscreen.tsx +1 -1
  36. package/src/core/components/autocomplete/autocomplete.tsx +13 -17
  37. package/src/core/components/autocomplete/autocompleteOption.tsx +1 -1
  38. package/src/core/components/autocomplete/constants.ts +3 -1
  39. package/src/core/components/autocomplete/types.ts +1 -1
  40. package/src/core/components/breadcrumbs/breadcrumbs.tsx +8 -3
  41. package/src/core/components/dialog/__workshop__/activate.tsx +11 -3
  42. package/src/core/components/dialog/__workshop__/panes.tsx +12 -5
  43. package/src/core/components/dialog/dialog.tsx +12 -13
  44. package/src/core/components/dialog/dialogCard.tsx +89 -53
  45. package/src/core/components/dialog/dialogContext.ts +1 -1
  46. package/src/core/components/dialog/dialogProvider.tsx +1 -1
  47. package/src/core/components/dialog/index.ts +1 -0
  48. package/src/core/components/dialog/isTargetWithinScope.ts +1 -1
  49. package/src/core/components/hotkeys/hotkeys.tsx +3 -2
  50. package/src/core/components/menu/__workshop__/avatarMenu.tsx +12 -6
  51. package/src/core/components/menu/__workshop__/customSelectedState.tsx +1 -5
  52. package/src/core/components/menu/__workshop__/shouldFocus.tsx +1 -2
  53. package/src/core/components/menu/helpers.ts +1 -1
  54. package/src/core/components/menu/menu.tsx +6 -4
  55. package/src/core/components/menu/menuButton.tsx +5 -3
  56. package/src/core/components/menu/menuDivider.tsx +1 -1
  57. package/src/core/components/menu/menuGroup.tsx +8 -4
  58. package/src/core/components/menu/menuItem.tsx +4 -2
  59. package/src/core/components/tab/tab.tsx +2 -2
  60. package/src/core/components/tab/tabList.tsx +2 -2
  61. package/src/core/components/tab/tabPanel.tsx +2 -2
  62. package/src/core/components/toast/toast.tsx +7 -2
  63. package/src/core/components/toast/toastLayer.tsx +2 -2
  64. package/src/core/components/toast/toastProvider.tsx +1 -1
  65. package/src/core/components/tree/tree.tsx +2 -2
  66. package/src/core/components/tree/treeGroup.tsx +2 -2
  67. package/src/core/components/tree/treeItem.tsx +13 -6
  68. package/src/core/components/tree/types.ts +0 -1
  69. package/src/core/{utils → components}/virtualList/__workshop__/index.ts +1 -1
  70. package/src/core/{utils → components}/virtualList/virtualList.tsx +10 -5
  71. package/src/core/helpers/focus.ts +0 -8
  72. package/src/core/hooks/useArrayProp.ts +1 -1
  73. package/src/core/hooks/useElementRect/__workshop__/example.tsx +1 -3
  74. package/src/core/hooks/useElementSize.ts +1 -1
  75. package/src/core/hooks/useResponsiveProp.ts +1 -1
  76. package/src/core/index.ts +83 -7
  77. package/src/core/observers/{elementSizeObserver.ts → elementSize.ts} +1 -1
  78. package/src/core/primitives/_selectable/index.ts +1 -0
  79. package/src/core/primitives/_selectable/selectable.tsx +13 -3
  80. package/src/core/{types/selectable.ts → primitives/_selectable/types.ts} +1 -1
  81. package/src/core/{utils → primitives}/arrow/arrow.tsx +1 -1
  82. package/src/core/primitives/avatar/avatar.tsx +4 -3
  83. package/src/core/primitives/avatar/avatarCounter.tsx +3 -3
  84. package/src/core/primitives/avatar/avatarStack.tsx +4 -4
  85. package/src/core/primitives/avatar/types.ts +17 -0
  86. package/src/core/primitives/badge/badge.tsx +4 -2
  87. package/src/core/primitives/badge/types.ts +11 -2
  88. package/src/core/primitives/box/__workshop__/responsive.tsx +0 -1
  89. package/src/core/primitives/box/box.tsx +1 -1
  90. package/src/core/primitives/box/index.ts +1 -0
  91. package/src/core/primitives/button/__workshop__/disabled.tsx +37 -51
  92. package/src/core/primitives/button/__workshop__/index.ts +5 -0
  93. package/src/core/primitives/button/__workshop__/textOverflow.tsx +13 -0
  94. package/src/core/primitives/button/button.tsx +15 -14
  95. package/src/core/primitives/button/index.ts +1 -0
  96. package/src/core/primitives/card/__workshop__/listNavigation.tsx +2 -2
  97. package/src/core/primitives/card/card.tsx +1 -1
  98. package/src/core/primitives/card/types.ts +3 -0
  99. package/src/core/primitives/checkbox/__workshop__/tones.tsx +9 -1
  100. package/src/core/primitives/checkbox/checkbox.tsx +3 -4
  101. package/src/core/primitives/code/__workshop__/opticalAlignment.tsx +17 -42
  102. package/src/core/primitives/code/code.tsx +1 -1
  103. package/src/core/primitives/container/container.tsx +1 -1
  104. package/src/core/primitives/flex/flex.tsx +1 -1
  105. package/src/core/primitives/flex/index.ts +1 -0
  106. package/src/core/primitives/grid/grid.tsx +1 -1
  107. package/src/core/primitives/grid/index.ts +1 -0
  108. package/src/core/primitives/heading/heading.tsx +1 -1
  109. package/src/core/primitives/inline/inline.tsx +1 -1
  110. package/src/core/primitives/kbd/kbd.tsx +1 -1
  111. package/src/core/primitives/label/label.tsx +1 -1
  112. package/src/core/{utils → primitives}/layer/__workshop__/index.ts +1 -1
  113. package/src/core/{utils → primitives}/layer/layer.test.tsx +1 -1
  114. package/src/core/{utils → primitives}/layer/layer.tsx +2 -2
  115. package/src/core/{utils → primitives}/layer/layerCard.tsx +3 -3
  116. package/src/core/{utils → primitives}/layer/layerProvider.tsx +2 -1
  117. package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +12 -9
  118. package/src/core/primitives/popover/__workshop__/TestStory.tsx +9 -8
  119. package/src/core/primitives/popover/constants.ts +1 -1
  120. package/src/core/primitives/popover/floating-ui/size.ts +1 -1
  121. package/src/core/primitives/popover/popover.tsx +8 -4
  122. package/src/core/primitives/popover/popoverLayer.tsx +4 -2
  123. package/src/core/primitives/popover/types.ts +5 -0
  124. package/src/core/primitives/radio/radio.tsx +2 -2
  125. package/src/core/primitives/select/select.tsx +2 -2
  126. package/src/core/{components → primitives}/skeleton/__workshop__/index.ts +1 -1
  127. package/src/core/{components → primitives}/skeleton/codeSkeleton.tsx +1 -1
  128. package/src/core/{components → primitives}/skeleton/headingSkeleton.tsx +1 -1
  129. package/src/core/{components → primitives}/skeleton/labelSkeleton.tsx +1 -1
  130. package/src/core/{components → primitives}/skeleton/skeleton.tsx +7 -8
  131. package/src/core/{components → primitives}/skeleton/textSkeleton.tsx +1 -1
  132. package/src/core/primitives/spinner/spinner.tsx +1 -1
  133. package/src/core/{utils → primitives}/srOnly/srOnly.tsx +1 -1
  134. package/src/core/primitives/stack/stack.tsx +2 -1
  135. package/src/core/primitives/switch/switch.tsx +2 -7
  136. package/src/core/primitives/text/__workshop__/colored.tsx +2 -2
  137. package/src/core/primitives/text/__workshop__/opticalAlignment.tsx +17 -42
  138. package/src/core/primitives/text/text.tsx +3 -1
  139. package/src/core/primitives/textArea/__workshop__/plain.tsx +2 -2
  140. package/src/core/primitives/textArea/textArea.tsx +2 -2
  141. package/src/core/primitives/textInput/textInput.tsx +3 -2
  142. package/src/core/primitives/tooltip/constants.ts +1 -1
  143. package/src/core/primitives/tooltip/tooltip.tsx +6 -3
  144. package/src/core/primitives/tooltip/tooltipLayer.tsx +3 -2
  145. package/src/core/primitives/types.ts +8 -10
  146. package/src/core/types/radius.ts +1 -1
  147. package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +9 -5
  148. package/src/core/utils/elementQuery/elementQuery.tsx +2 -2
  149. package/src/core/utils/getElementRef.ts +1 -0
  150. package/src/core/utils/portal/portal.tsx +1 -1
  151. package/src/css/components/dialog/dialog.css.ts +26 -1
  152. package/src/css/components/dialog/dialog.ts +27 -7
  153. package/src/css/components/skeleton/skeleton.ts +3 -1
  154. package/src/css/components/skeleton/types.ts +3 -1
  155. package/src/css/index.ts +75 -5
  156. package/src/css/primitives/_input/input.ts +2 -1
  157. package/src/css/primitives/_input/types.ts +2 -1
  158. package/src/css/primitives/_selectable/_selectable.css.ts +32 -24
  159. package/src/css/primitives/_selectable/selectable.ts +1 -1
  160. package/src/css/primitives/_selectable/types.ts +1 -1
  161. package/src/css/primitives/avatar/avatar.css.ts +11 -2
  162. package/src/css/primitives/avatar/avatar.ts +1 -1
  163. package/src/css/primitives/badge/badge.css.ts +2 -1
  164. package/src/css/primitives/badge/types.ts +0 -2
  165. package/src/css/primitives/box/box.ts +35 -37
  166. package/src/css/primitives/box/types.ts +34 -36
  167. package/src/css/primitives/button/button.css.ts +4 -0
  168. package/src/css/primitives/button/button.ts +5 -2
  169. package/src/css/primitives/button/types.ts +4 -11
  170. package/src/css/primitives/card/__workshop__/color.tsx +70 -0
  171. package/src/css/primitives/card/__workshop__/index.ts +14 -0
  172. package/src/css/primitives/card/card.css.ts +4 -0
  173. package/src/css/primitives/code/code.ts +3 -1
  174. package/src/css/primitives/code/types.ts +2 -1
  175. package/src/css/primitives/container/container.ts +3 -1
  176. package/src/css/primitives/heading/heading.ts +4 -1
  177. package/src/css/primitives/heading/types.ts +3 -1
  178. package/src/css/primitives/kbd/kbd.ts +1 -1
  179. package/src/css/primitives/kbd/types.ts +1 -1
  180. package/src/css/primitives/label/label.css.ts +1 -0
  181. package/src/css/primitives/label/label.ts +4 -1
  182. package/src/css/primitives/label/types.ts +3 -1
  183. package/src/css/primitives/switch/switch.css.ts +1 -1
  184. package/src/css/primitives/text/text.ts +6 -1
  185. package/src/css/primitives/text/types.ts +5 -2
  186. package/src/css/props/width/types.ts +1 -1
  187. package/src/css/props/width/width.css.ts +3 -0
  188. package/src/theme/v2/build/buildTheme.test.ts +8 -8
  189. package/src/theme/v2/build/buildTheme.ts +32 -7
  190. package/src/theme/v3/defaultFonts.ts +6 -6
  191. package/src/theme/v3/defaultTokens.ts +1 -1
  192. package/bin/sanity-ui.cjs +0 -5
  193. package/dist/ui.css +0 -1
  194. package/src/cli/buildCommand.ts +0 -10
  195. package/src/cli/index.ts +0 -26
  196. package/src/core/components/autocomplete/index.ts +0 -2
  197. package/src/core/components/index.ts +0 -9
  198. package/src/core/helpers/index.ts +0 -5
  199. package/src/core/hooks/index.ts +0 -13
  200. package/src/core/observers/index.ts +0 -2
  201. package/src/core/primitives/index.ts +0 -27
  202. package/src/core/types/avatar.ts +0 -16
  203. package/src/core/types/card.ts +0 -4
  204. package/src/core/types/index.ts +0 -15
  205. package/src/core/types/popover.ts +0 -4
  206. package/src/core/utils/index.ts +0 -8
  207. package/src/css/__theme/index.ts +0 -16
  208. package/src/css/__theme/lib/contract/buildVarContract.ts +0 -78
  209. package/src/css/__theme/lib/contract/index.ts +0 -4
  210. package/src/css/__theme/lib/contract/types.ts +0 -17
  211. package/src/css/__theme/resolveTheme.ts +0 -865
  212. package/src/css/components/index.ts +0 -6
  213. package/src/css/primitives/index.ts +0 -24
  214. package/src/css/props/index.ts +0 -37
  215. package/src/css/utils/srOnly/index.ts +0 -1
  216. /package/src/core/{global.ts → __DEV__.ts} +0 -0
  217. /package/src/core/{types/dialog.ts → components/dialog/types.ts} +0 -0
  218. /package/src/core/{utils → components}/virtualList/__workshop__/changingProps.tsx +0 -0
  219. /package/src/core/{utils → components}/virtualList/__workshop__/elementScroll.tsx +0 -0
  220. /package/src/core/{utils → components}/virtualList/__workshop__/infiniteList.tsx +0 -0
  221. /package/src/core/{utils → components}/virtualList/__workshop__/windowScrolll.tsx +0 -0
  222. /package/src/core/{utils → components}/virtualList/index.ts +0 -0
  223. /package/src/core/observers/{resizeObserver.ts → resize.ts} +0 -0
  224. /package/src/core/{utils → primitives}/arrow/cmds.ts +0 -0
  225. /package/src/core/{utils → primitives}/arrow/index.ts +0 -0
  226. /package/src/core/{types/badge.ts → primitives/badge/types2.ts} +0 -0
  227. /package/src/core/{types/box.ts → primitives/box/types.ts} +0 -0
  228. /package/src/core/{types/button.ts → primitives/button/types.ts} +0 -0
  229. /package/src/core/{types/flex.ts → primitives/flex/types.ts} +0 -0
  230. /package/src/core/{types/grid.ts → primitives/grid/types.ts} +0 -0
  231. /package/src/core/{utils → primitives}/layer/__workshop__/_debug.tsx +0 -0
  232. /package/src/core/{utils → primitives}/layer/__workshop__/multipleRoots.tsx +0 -0
  233. /package/src/core/{utils → primitives}/layer/__workshop__/nested.tsx +0 -0
  234. /package/src/core/{utils → primitives}/layer/__workshop__/responsiveZOffset.tsx +0 -0
  235. /package/src/core/{utils → primitives}/layer/getLayerContext.test.ts +0 -0
  236. /package/src/core/{utils → primitives}/layer/getLayerContext.ts +0 -0
  237. /package/src/core/{utils → primitives}/layer/index.ts +0 -0
  238. /package/src/core/{utils → primitives}/layer/layerContext.ts +0 -0
  239. /package/src/core/{utils → primitives}/layer/types.ts +0 -0
  240. /package/src/core/{utils → primitives}/layer/useLayer.ts +0 -0
  241. /package/src/core/{components → primitives}/skeleton/__workshop__/delay.tsx +0 -0
  242. /package/src/core/{components → primitives}/skeleton/__workshop__/skeleton.tsx +0 -0
  243. /package/src/core/{components → primitives}/skeleton/index.ts +0 -0
  244. /package/src/core/{utils → primitives}/srOnly/index.ts +0 -0
  245. /package/src/core/types/{text.ts → textAlign.ts} +0 -0
  246. /package/src/css/{utils → primitives/srOnly}/index.ts +0 -0
  247. /package/src/css/{utils → primitives}/srOnly/srOnly.css.ts +0 -0
  248. /package/src/css/{utils → primitives}/srOnly/srOnly.ts +0 -0
@@ -18,13 +18,13 @@ export {Button, type ButtonProps} from '../src/core/primitives/button/button'
18
18
  export {Card, type CardProps} from '../src/core/primitives/card/card'
19
19
  export {Flex, type FlexProps} from '../src/core/primitives/flex/flex'
20
20
  export {Grid, type GridProps} from '../src/core/primitives/grid/grid'
21
+ export {LayerProvider} from '../src/core/primitives/layer/layerProvider'
21
22
  export {Popover, type PopoverProps} from '../src/core/primitives/popover/popover'
23
+ export type {PopoverMargins} from '../src/core/primitives/popover/types'
22
24
  export {Spinner, type SpinnerProps} from '../src/core/primitives/spinner/spinner'
23
25
  export {Stack, type StackProps} from '../src/core/primitives/stack/stack'
24
26
  export {Text, type TextProps} from '../src/core/primitives/text/text'
25
27
  export {TextInput, type TextInputProps} from '../src/core/primitives/textInput/textInput'
26
28
  export {Tooltip, type TooltipProps} from '../src/core/primitives/tooltip/tooltip'
27
- export type {PopoverMargins} from '../src/core/types/popover'
28
- export {LayerProvider} from '../src/core/utils/layer/layerProvider'
29
29
  export {Portal, type PortalProps} from '../src/core/utils/portal/portal'
30
30
  export {PortalProvider, type PortalProviderProps} from '../src/core/utils/portal/portalProvider'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/ui",
3
- "version": "3.0.0-static.26",
3
+ "version": "3.0.0-static.28",
4
4
  "keywords": [
5
5
  "react",
6
6
  "ui",
@@ -41,14 +41,14 @@
41
41
  "require": "./dist/css.cjs",
42
42
  "default": "./dist/css.js"
43
43
  },
44
+ "./index.css": "./dist/index.css",
44
45
  "./package.json": "./package.json",
45
46
  "./theme": {
46
47
  "source": "./exports/theme.ts",
47
48
  "import": "./dist/theme.js",
48
49
  "require": "./dist/theme.cjs",
49
50
  "default": "./dist/theme.js"
50
- },
51
- "./ui.css": "./dist/ui.css"
51
+ }
52
52
  },
53
53
  "main": "./dist/index.cjs",
54
54
  "module": "./dist/index.js",
@@ -66,9 +66,6 @@
66
66
  ]
67
67
  }
68
68
  },
69
- "bin": {
70
- "sanity-ui": "./bin/sanity-ui.cjs"
71
- },
72
69
  "files": [
73
70
  "dist",
74
71
  "exports",
@@ -120,28 +117,14 @@
120
117
  "@babel/preset-env": "^7.27.1",
121
118
  "@babel/preset-react": "^7.27.1",
122
119
  "@babel/preset-typescript": "^7.27.1",
123
- "@commitlint/cli": "^19.8.0",
124
- "@commitlint/config-conventional": "^19.8.0",
120
+ "@commitlint/cli": "19.5.0",
121
+ "@commitlint/config-conventional": "19.5.0",
125
122
  "@eslint/js": "^9.26.0",
126
123
  "@sanity/browserslist-config": "^1.0.5",
127
124
  "@sanity/pkg-utils": "^7.2.2",
128
125
  "@sanity/prettier-config": "^1.0.3",
129
126
  "@sanity/semantic-release-preset": "^5.0.0",
130
- "@sanity/ui-workshop": "^2.1.2",
131
- "@storybook/addon-a11y": "^8.6.14",
132
- "@storybook/addon-docs": "^8.6.14",
133
- "@storybook/addon-essentials": "^8.6.12",
134
- "@storybook/addon-interactions": "^8.6.12",
135
- "@storybook/addon-links": "^8.6.14",
136
- "@storybook/addon-mdx-gfm": "^8.6.12",
137
- "@storybook/addon-storysource": "^8.6.12",
138
- "@storybook/addon-themes": "^8.6.14",
139
- "@storybook/blocks": "^8.6.12",
140
- "@storybook/manager-api": "^8.6.12",
141
- "@storybook/react": "^8.6.14",
142
- "@storybook/react-vite": "^8.6.14",
143
- "@storybook/test": "^8.6.12",
144
- "@storybook/theming": "^8.6.12",
127
+ "@sanity/ui-workshop": "^3.0.0",
145
128
  "@testing-library/dom": "^10.4.0",
146
129
  "@testing-library/jest-dom": "^6.6.3",
147
130
  "@testing-library/react": "^16.3.0",
@@ -152,6 +135,7 @@
152
135
  "@types/react-is": "^19.0.0",
153
136
  "@types/refractor": "^3.4.1",
154
137
  "@vanilla-extract/rollup-plugin": "^1.3.15",
138
+ "@vanilla-extract/vite-plugin": "^5.0.3",
155
139
  "@vitejs/plugin-react": "^4.4.1",
156
140
  "@vitest/browser": "^3.1.4",
157
141
  "autoprefixer": "^10.4.21",
@@ -163,7 +147,6 @@
163
147
  "cypress-real-events": "^1.14.0",
164
148
  "cz-conventional-changelog": "^3.3.0",
165
149
  "dotenv-flow": "^4.1.0",
166
- "esbuild-register": "^3.6.0",
167
150
  "eslint": "^9.26.0",
168
151
  "eslint-config-prettier": "^10.1.2",
169
152
  "eslint-formatter-compact": "^8.40.0",
@@ -174,9 +157,8 @@
174
157
  "eslint-plugin-react-hooks": "0.0.0-experimental-4448b187-20250515",
175
158
  "eslint-plugin-react-refresh": "^0.4.20",
176
159
  "eslint-plugin-simple-import-sort": "^12.1.1",
177
- "eslint-plugin-storybook": "^0.12.0",
160
+ "eslint-plugin-storybook": "^9.0.5",
178
161
  "globals": "^16.0.0",
179
- "http-server": "^14.1.1",
180
162
  "husky": "^8.0.3",
181
163
  "lightningcss": "^1.30.1",
182
164
  "lint-staged": "^14.0.1",
@@ -185,21 +167,21 @@
185
167
  "postcss": "^8.5.3",
186
168
  "postcss-preset-env": "^10.2.0",
187
169
  "prettier": "^3.5.3",
170
+ "prettier-plugin-packagejson": "^2.5.15",
188
171
  "react": "^19.1.0",
189
172
  "react-dom": "^19.1.0",
190
173
  "react-is": "^19.1.0",
191
174
  "refractor": "^4.9.0",
192
175
  "rimraf": "^5.0.10",
193
- "semantic-release": "^24.2.3",
176
+ "semantic-release": "23.1.1",
194
177
  "start-server-and-test": "^2.0.11",
195
- "storybook": "^8.6.14",
196
178
  "styled-components": "^6.1.17",
197
179
  "tsconfig-paths": "^4.2.0",
198
180
  "typescript": "5.8.3",
199
181
  "typescript-eslint": "^8.32.0",
200
- "vite": "^5.4.19",
182
+ "vite": "^6.3.5",
201
183
  "vite-tsconfig-paths": "^5.1.4",
202
- "vitest": "^3.1.4",
184
+ "vitest": "^3.2.2",
203
185
  "vitest-axe": "1.0.0-pre.5"
204
186
  },
205
187
  "peerDependencies": {
@@ -220,27 +202,27 @@
220
202
  "scripts": {
221
203
  "build": "run-s clean pkg:build pkg:check",
222
204
  "clean": "rimraf dist",
223
- "_css:build": "node -r esbuild-register scripts/build",
224
205
  "commit": "cz",
225
206
  "cypress:dev": "run-p dev cypress:open",
226
207
  "cypress:open": "cypress open",
227
208
  "cypress:run": "cypress run",
228
209
  "dev": "run-p workshop:clean workshop:dev",
229
- "figma:pkg:build": "cd figma && pnpm build",
210
+ "figma:build": "pnpm run --filter 'figma-plugin-sanity-ui' build",
230
211
  "format": "prettier --write --cache --ignore-unknown .",
231
212
  "lint": "eslint .",
232
- "pkg:build": "mkdirp dist && touch dist/ui.css && pkg build --strict",
213
+ "pkg:build": "mkdirp dist && touch dist/index.css && NODE_ENV=production pkg build --strict",
233
214
  "pkg:check": "pkg --strict",
215
+ "pkg:watch": "mkdirp dist && touch dist/index.css && pkg watch --strict",
234
216
  "release": "semantic-release",
235
- "storybook:build": "storybook build",
236
- "storybook:dev": "storybook dev -p 6006",
217
+ "storybook:build": "pnpm run --filter 'sanity-ui-storybook' build",
218
+ "storybook:dev": "pnpm run --filter 'sanity-ui-storybook' dev",
237
219
  "test": "vitest run",
238
- "test:browser": "start-server-and-test 'run-s workshop:build workshop:start' http://localhost:1337 'run-s cypress:run'",
220
+ "test:browser": "start-server-and-test 'run-s workshop:build workshop:preview' http://localhost:1337 'run-s cypress:run'",
239
221
  "typecheck": "tsc",
240
222
  "watch": "pkg watch --strict",
241
223
  "workshop:build": "workshop build",
242
224
  "workshop:clean": "rimraf .workshop",
243
- "workshop:dev": "node -r esbuild-register ../ui-workshop/scripts/dev",
244
- "workshop:start": "http-server -a localhost -c-0 -p 1337 -s -P http://localhost:1337/index.html? dist"
225
+ "workshop:dev": "workshop dev",
226
+ "workshop:preview": "workshop preview"
245
227
  }
246
228
  }
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  Autocomplete,
3
+ type AutocompleteProps,
3
4
  BoundaryElementProvider,
4
5
  Box,
5
6
  Card,
6
7
  Container,
7
8
  LayerProvider,
9
+ Popover,
8
10
  Stack,
9
11
  Text,
10
12
  } from '@sanity/ui'
11
13
  import {useCallback, useState} from 'react'
12
14
 
13
- import {Popover} from '../../../primitives'
14
- import type {AutocompleteProps} from '../autocomplete'
15
15
  import countries from './mock/countries'
16
16
  import type {ExampleOption} from './types'
17
17
 
@@ -174,7 +174,7 @@ export default function Fullscreen() {
174
174
  }, [value])
175
175
 
176
176
  return (
177
- <Card display="flex" direction="column" minHeight="full" tone="transparent">
177
+ <Card display="flex" flexDirection="column" minHeight="full" tone="transparent">
178
178
  <PortalProvider element={portalElement}>
179
179
  <Card hidden={open} padding={2}>
180
180
  <Flex align="center">
@@ -1,6 +1,6 @@
1
1
  import {ChevronDownIcon} from '@sanity/icons'
2
2
  import type {ResponsiveProp} from '@sanity/ui/css'
3
- import type {Space} from '@sanity/ui/theme'
3
+ import type {Radius, Space} from '@sanity/ui/theme'
4
4
  import {
5
5
  type ChangeEvent,
6
6
  cloneElement,
@@ -19,22 +19,18 @@ import {
19
19
  } from 'react'
20
20
 
21
21
  import {EMPTY_ARRAY, EMPTY_RECORD} from '../../constants'
22
- import {_hasFocus, _raf, focusFirstDescendant} from '../../helpers'
23
- import {useResponsiveProp} from '../../hooks'
24
- import {
25
- Box,
26
- type BoxProps,
27
- Button,
28
- Card,
29
- Popover,
30
- type PopoverProps,
31
- Stack,
32
- Text,
33
- TextInput,
34
- type TextInputOwnProps,
35
- } from '../../primitives'
22
+ import {_raf} from '../../helpers/animation'
23
+ import {_hasFocus, focusFirstDescendant} from '../../helpers/focus'
24
+ import {useResponsiveProp} from '../../hooks/useResponsiveProp'
25
+ import {Box, type BoxOwnProps} from '../../primitives/box'
26
+ import {Button} from '../../primitives/button'
27
+ import {Card} from '../../primitives/card'
28
+ import {Popover, type PopoverProps} from '../../primitives/popover'
36
29
  import {AnimatedSpinnerIcon} from '../../primitives/spinner/animatedSpinnerIcon'
37
- import type {ComponentType, Props, Radius} from '../../types'
30
+ import {Stack} from '../../primitives/stack'
31
+ import {Text} from '../../primitives/text'
32
+ import {TextInput, type TextInputOwnProps} from '../../primitives/textInput'
33
+ import type {ComponentType, Props} from '../../types/props'
38
34
  import {AutocompleteOption} from './autocompleteOption'
39
35
  import {autocompleteReducer} from './autocompleteReducer'
40
36
  import {
@@ -55,7 +51,7 @@ export type AutocompleteOwnProps<O extends BaseAutocompleteOption = BaseAutocomp
55
51
  filterOption?: (query: string, option: O) => boolean
56
52
  icon?: ElementType | ReactNode
57
53
  /** @beta */
58
- listBox?: BoxProps
54
+ listBox?: BoxOwnProps
59
55
  loading?: boolean
60
56
  onChange?: (value: string) => void
61
57
  onQueryChange?: (query: string | null) => void
@@ -1,6 +1,6 @@
1
1
  import {type KeyboardEvent, type ReactElement, type ReactNode, useCallback} from 'react'
2
2
 
3
- import {_isEnterToClickElement} from '../../helpers'
3
+ import {_isEnterToClickElement} from '../../helpers/element'
4
4
 
5
5
  export interface AutocompleteOptionProps {
6
6
  children: ReactNode
@@ -1,4 +1,6 @@
1
- import type {Placement} from '../../types'
1
+ // import type {Placement} from '../../types'
2
+
3
+ import type {Placement} from '../../types/placement'
2
4
 
3
5
  /**
4
6
  * @internal
@@ -1,4 +1,4 @@
1
- import type {ButtonProps} from '../../primitives'
1
+ import type {ButtonProps} from '../../primitives/button'
2
2
 
3
3
  /** @public */
4
4
  export type AutocompleteOpenButtonProps = Omit<ButtonProps<'button'>, 'as'>
@@ -11,9 +11,14 @@ import {
11
11
  useState,
12
12
  } from 'react'
13
13
 
14
- import {useClickOutsideEvent} from '../../hooks'
15
- import {Box, Button, type ButtonProps, Flex, Popover, Stack, Text} from '../../primitives'
16
- import type {ComponentType, Props} from '../../types'
14
+ import {useClickOutsideEvent} from '../../hooks/useClickOutsideEvent'
15
+ import {Box} from '../../primitives/box'
16
+ import {Button, type ButtonProps} from '../../primitives/button'
17
+ import {Flex} from '../../primitives/flex'
18
+ import {Popover} from '../../primitives/popover'
19
+ import {Stack} from '../../primitives/stack'
20
+ import {Text} from '../../primitives/text'
21
+ import type {ComponentType, Props} from '../../types/props'
17
22
 
18
23
  /** @beta */
19
24
  export const DEFAULT_BREADCRUMBS_ELEMENT = 'nav'
@@ -1,8 +1,16 @@
1
+ import {
2
+ Button,
3
+ Flex,
4
+ Layer,
5
+ LayerProvider,
6
+ Menu,
7
+ MenuButton,
8
+ MenuItem,
9
+ Stack,
10
+ Text,
11
+ } from '@sanity/ui'
1
12
  import {useState} from 'react'
2
13
 
3
- import {Button, Flex, Stack, Text} from '../../../primitives'
4
- import {Layer, LayerProvider} from '../../../utils'
5
- import {Menu, MenuButton, MenuItem} from '../../menu'
6
14
  import {Dialog} from '../dialog'
7
15
 
8
16
  export default function LayeringFocusStory() {
@@ -1,11 +1,18 @@
1
+ import {
2
+ BoundaryElementProvider,
3
+ Box,
4
+ Button,
5
+ Card,
6
+ Dialog,
7
+ Flex,
8
+ Menu,
9
+ MenuButton,
10
+ MenuItem,
11
+ PortalProvider,
12
+ } from '@sanity/ui'
1
13
  import {useCallback, useState} from 'react'
2
14
  import {styled} from 'styled-components'
3
15
 
4
- import {Box, Button, Card, Flex} from '../../../primitives'
5
- import {BoundaryElementProvider, PortalProvider} from '../../../utils'
6
- import {Menu, MenuButton, MenuItem} from '../../menu'
7
- import {Dialog} from '../dialog'
8
-
9
16
  export default function PanesStory() {
10
17
  return (
11
18
  <Flex height="fill">
@@ -4,24 +4,23 @@ import {
4
4
  dialogContainer,
5
5
  type ResponsiveProp,
6
6
  } from '@sanity/ui/css'
7
- import type {ThemeColorSchemeKey} from '@sanity/ui/theme'
7
+ import type {Radius, ThemeColorSchemeKey} from '@sanity/ui/theme'
8
8
  import {type FocusEvent, type ForwardedRef, type ReactNode, useCallback, useRef} from 'react'
9
9
 
10
10
  import {Z_OFFSETS} from '../../constants'
11
- import {focusFirstDescendant, focusLastDescendant, isHTMLElement} from '../../helpers'
12
- import {usePrefersReducedMotion, useResponsiveProp} from '../../hooks'
13
- import {Container} from '../../primitives'
14
- import type {CardTone, ComponentType, DialogPosition, Props, Radius} from '../../types'
15
- import {
16
- Layer,
17
- type LayerOwnProps,
18
- type LayerProps,
19
- Portal,
20
- useBoundaryElement,
21
- usePortal,
22
- } from '../../utils'
11
+ import {isHTMLElement} from '../../helpers/element'
12
+ import {focusFirstDescendant, focusLastDescendant} from '../../helpers/focus'
13
+ import {usePrefersReducedMotion} from '../../hooks/usePrefersReducedMotion'
14
+ import {useResponsiveProp} from '../../hooks/useResponsiveProp'
15
+ import type {CardTone} from '../../primitives/card'
16
+ import {Container} from '../../primitives/container'
17
+ import {Layer, type LayerOwnProps, type LayerProps} from '../../primitives/layer'
18
+ import type {ComponentType, Props} from '../../types/props'
19
+ import {useBoundaryElement} from '../../utils/boundaryElement'
20
+ import {Portal, usePortal} from '../../utils/portal'
23
21
  import {DialogCard} from './dialogCard'
24
22
  import {isTargetWithinScope} from './isTargetWithinScope'
23
+ import type {DialogPosition} from './types'
25
24
  import {useDialog} from './useDialog'
26
25
 
27
26
  /** @public */
@@ -1,5 +1,13 @@
1
1
  import {CloseIcon} from '@sanity/icons'
2
- import {dialogCard, dialogContent, dialogFooter, dialogHeader, dialogLayout} from '@sanity/ui/css'
2
+ import {
3
+ dialogCard,
4
+ dialogContent,
5
+ dialogFooter,
6
+ dialogHeader,
7
+ dialogScroller,
8
+ dialogScrollerShadowBottom,
9
+ dialogScrollerShadowTop,
10
+ } from '@sanity/ui/css'
3
11
  import {
4
12
  type ForwardedRef,
5
13
  type ReactNode,
@@ -7,21 +15,21 @@ import {
7
15
  useEffect,
8
16
  useImperativeHandle,
9
17
  useRef,
18
+ useState,
10
19
  } from 'react'
11
20
 
12
- import {focusFirstDescendant} from '../../helpers'
13
- import {useClickOutsideEvent, useGlobalKeyDown} from '../../hooks'
14
- import {
15
- Box,
16
- Button,
17
- Card,
18
- type CardElementType,
19
- type CardOwnProps,
20
- Flex,
21
- Text,
22
- } from '../../primitives'
23
- import type {Props} from '../../types'
24
- import {useBoundaryElement, useLayer, usePortal} from '../../utils'
21
+ import {focusFirstDescendant} from '../../helpers/focus'
22
+ import {useClickOutsideEvent} from '../../hooks/useClickOutsideEvent'
23
+ import {useGlobalKeyDown} from '../../hooks/useGlobalKeyDown'
24
+ import {Box} from '../../primitives/box'
25
+ import {Button} from '../../primitives/button'
26
+ import {Card, type CardElementType, type CardOwnProps} from '../../primitives/card'
27
+ import {Flex} from '../../primitives/flex'
28
+ import {useLayer} from '../../primitives/layer'
29
+ import {Text} from '../../primitives/text'
30
+ import type {Props} from '../../types/props'
31
+ import {useBoundaryElement} from '../../utils/boundaryElement'
32
+ import {usePortal} from '../../utils/portal'
25
33
  import {isTargetWithinScope} from './isTargetWithinScope'
26
34
 
27
35
  /** @internal */
@@ -87,6 +95,7 @@ export function DialogCard<E extends DialogCardElementType = typeof DEFAULT_DIAL
87
95
  const labelId = `${id}_label`
88
96
  const showCloseButton = Boolean(onClose) && hideCloseButton === false
89
97
  const showHeader = Boolean(header) || showCloseButton
98
+ const [scrollTop, setScrollTop] = useState(0)
90
99
 
91
100
  useImperativeHandle<HTMLDivElement | null, HTMLDivElement | null>(forwardedRef, () => ref.current)
92
101
  useImperativeHandle<HTMLDivElement | null, HTMLDivElement | null>(
@@ -141,50 +150,77 @@ export function DialogCard<E extends DialogCardElementType = typeof DEFAULT_DIAL
141
150
  () => [ref.current],
142
151
  )
143
152
 
153
+ useEffect(() => {
154
+ const el = contentRef.current
155
+
156
+ if (!el) return
157
+
158
+ const handleScroll = () => {
159
+ // console.log('scroll', el.scrollTop)
160
+ setScrollTop(el.scrollTop)
161
+ }
162
+
163
+ el.addEventListener('scroll', handleScroll, {passive: true})
164
+
165
+ return () => {
166
+ el.removeEventListener('scroll', handleScroll)
167
+ }
168
+ }, [])
169
+
144
170
  return (
145
- <Card {...rest} as={as} className={dialogCard()} display="flex" ref={ref}>
146
- <Flex className={dialogLayout()} direction="column" flex={1}>
147
- {showHeader && (
148
- <Box className={dialogHeader()} position="relative">
149
- <Flex align="flex-start" padding={3}>
150
- <Box flex={1} padding={2}>
151
- {header && (
152
- <Text id={labelId} size={1} weight="semibold">
153
- {header}
154
- </Text>
155
- )}
156
- </Box>
157
- {showCloseButton && (
158
- <Box flex="none">
159
- <Button
160
- aria-label="Close dialog"
161
- disabled={!onClose}
162
- icon={CloseIcon}
163
- mode="bleed"
164
- onClick={onClose}
165
- padding={2}
166
- />
167
- </Box>
168
- )}
169
- </Flex>
171
+ <Card
172
+ {...rest}
173
+ as={as}
174
+ className={dialogCard()}
175
+ display="flex"
176
+ flexDirection="column"
177
+ ref={ref}
178
+ >
179
+ {showHeader && (
180
+ <Flex align="flex-start" className={dialogHeader()} padding={3} position="relative">
181
+ <Box flex={1} padding={2}>
182
+ {header && (
183
+ <Text id={labelId} size={1} weight="semibold">
184
+ {header}
185
+ </Text>
186
+ )}
170
187
  </Box>
188
+
189
+ {showCloseButton && (
190
+ <Box flex="none">
191
+ <Button
192
+ aria-label="Close dialog"
193
+ disabled={!onClose}
194
+ icon={CloseIcon}
195
+ mode="bleed"
196
+ onClick={onClose}
197
+ padding={2}
198
+ />
199
+ </Box>
200
+ )}
201
+ </Flex>
202
+ )}
203
+
204
+ <Box className={dialogContent()} flex={1} position="relative" tabIndex={-1}>
205
+ {showHeader && (
206
+ <div
207
+ className={dialogScrollerShadowTop()}
208
+ style={{opacity: Math.min(scrollTop, 32) / 32}}
209
+ />
171
210
  )}
172
- <Box
173
- className={dialogContent()}
174
- flex={1}
175
- overflow="auto"
176
- position="relative"
177
- ref={contentRef}
178
- tabIndex={-1}
179
- >
211
+
212
+ <Box className={dialogScroller()} overflow="auto" ref={contentRef}>
180
213
  {children}
181
214
  </Box>
182
- {footer && (
183
- <Box className={dialogFooter()} position="relative">
184
- {footer}
185
- </Box>
186
- )}
187
- </Flex>
215
+
216
+ {footer && <div className={dialogScrollerShadowBottom()} />}
217
+ </Box>
218
+
219
+ {footer && (
220
+ <Box className={dialogFooter()} position="relative">
221
+ {footer}
222
+ </Box>
223
+ )}
188
224
  </Card>
189
225
  )
190
226
  }
@@ -1,7 +1,7 @@
1
1
  import type {ResponsiveProp} from '@sanity/ui/css'
2
2
 
3
3
  import {createGlobalScopedContext} from '../../lib/createGlobalScopedContext'
4
- import type {DialogPosition} from '../../types'
4
+ import type {DialogPosition} from './types'
5
5
 
6
6
  /**
7
7
  * This API might change. DO NOT USE IN PRODUCTION.
@@ -1,8 +1,8 @@
1
1
  import type {ResponsiveProp} from '@sanity/ui/css'
2
2
  import {type ReactElement, type ReactNode, useMemo} from 'react'
3
3
 
4
- import type {DialogPosition} from '../../types'
5
4
  import {DialogContext, type DialogContextValue} from './dialogContext'
5
+ import type {DialogPosition} from './types'
6
6
 
7
7
  /**
8
8
  * This API might change. DO NOT USE IN PRODUCTION.
@@ -1,4 +1,5 @@
1
1
  export * from './dialog'
2
2
  export * from './dialogContext'
3
3
  export * from './dialogProvider'
4
+ export * from './types'
4
5
  export * from './useDialog'
@@ -1,4 +1,4 @@
1
- import {containsOrEqualsElement} from '../../helpers'
1
+ import {containsOrEqualsElement} from '../../helpers/element'
2
2
 
3
3
  export function isTargetWithinScope(
4
4
  boundaryElement: HTMLElement | null,
@@ -1,8 +1,9 @@
1
1
  import type {GapStyleProps, RadiusStyleProps, ResponsiveProp} from '@sanity/ui/css'
2
2
  import type {FontTextSize, Space} from '@sanity/ui/theme'
3
3
 
4
- import {Box, KBD} from '../../primitives'
5
- import type {ComponentType, Props} from '../../types'
4
+ import {Box} from '../../primitives/box'
5
+ import {KBD} from '../../primitives/kbd'
6
+ import type {ComponentType, Props} from '../../types/props'
6
7
 
7
8
  /** @public */
8
9
  export const DEFAULT_HOTKEYS_ELEMENT = 'kbd'
@@ -1,10 +1,16 @@
1
1
  import {UsersIcon} from '@sanity/icons'
2
-
3
- import {Avatar, Badge, Box, Button, Flex, Text} from '../../../primitives'
4
- import {Hotkeys} from '../../hotkeys'
5
- import {Menu} from '../menu'
6
- import {MenuButton} from '../menuButton'
7
- import {MenuItem} from '../menuItem'
2
+ import {
3
+ Avatar,
4
+ Badge,
5
+ Box,
6
+ Button,
7
+ Flex,
8
+ Hotkeys,
9
+ Menu,
10
+ MenuButton,
11
+ MenuItem,
12
+ Text,
13
+ } from '@sanity/ui'
8
14
 
9
15
  export default function AvatarMenuStory() {
10
16
  return (
@@ -1,11 +1,7 @@
1
1
  import {ChevronDownIcon} from '@sanity/icons'
2
+ import {Box, Button, Menu, MenuButton, MenuItem} from '@sanity/ui'
2
3
  import {useSelect} from '@sanity/ui-workshop'
3
4
 
4
- import {Box, Button} from '../../../primitives'
5
- import {Menu} from '../menu'
6
- import {MenuButton} from '../menuButton'
7
- import {MenuItem} from '../menuItem'
8
-
9
5
  const selectedOptions = {
10
6
  undefined: 'undefined',
11
7
  true: true,
@@ -1,8 +1,7 @@
1
+ import {Button, Flex, LayerProvider, Popover} from '@sanity/ui'
1
2
  import {useSelect} from '@sanity/ui-workshop'
2
3
  import {Fragment, useCallback, useState} from 'react'
3
4
 
4
- import {Button, Flex, Popover} from '../../../primitives'
5
- import {LayerProvider} from '../../../utils'
6
5
  import {Menu} from '../menu'
7
6
  import {MenuDivider} from '../menuDivider'
8
7
  import {MenuItem} from '../menuItem'