@sanity/ui 2.9.0-corel.0 → 3.0.0-static.0

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 (322) hide show
  1. package/bin/ui.js +6 -0
  2. package/dist/_chunks-cjs/buildCommand.js +2836 -0
  3. package/dist/_chunks-cjs/buildCommand.js.map +1 -0
  4. package/dist/_chunks-cjs/getTheme_v2.js +1 -27
  5. package/dist/_chunks-cjs/getTheme_v2.js.map +1 -1
  6. package/dist/_chunks-es/getTheme_v2.mjs +1 -27
  7. package/dist/_chunks-es/getTheme_v2.mjs.map +1 -1
  8. package/dist/_legacy/getTheme_v2.esm.js +1 -27
  9. package/dist/_legacy/getTheme_v2.esm.js.map +1 -1
  10. package/dist/cli.d.ts +1 -0
  11. package/dist/cli.js +23 -0
  12. package/dist/cli.js.map +1 -0
  13. package/dist/css.d.mts +943 -0
  14. package/dist/css.d.ts +943 -0
  15. package/dist/css.esm.js +3135 -0
  16. package/dist/css.esm.js.map +1 -0
  17. package/dist/css.js +3135 -0
  18. package/dist/css.js.map +1 -0
  19. package/dist/css.mjs +3135 -0
  20. package/dist/css.mjs.map +1 -0
  21. package/dist/index.d.mts +175 -164
  22. package/dist/index.d.ts +175 -164
  23. package/dist/index.esm.js +864 -1955
  24. package/dist/index.esm.js.map +1 -1
  25. package/dist/index.js +870 -1962
  26. package/dist/index.js.map +1 -1
  27. package/dist/index.mjs +864 -1955
  28. package/dist/index.mjs.map +1 -1
  29. package/dist/sanity-theme.css +25 -0
  30. package/dist/system.css +2953 -0
  31. package/dist/theme.d.mts +84 -22
  32. package/dist/theme.d.ts +84 -22
  33. package/dist/theme.esm.js +232 -283
  34. package/dist/theme.esm.js.map +1 -1
  35. package/dist/theme.js +232 -283
  36. package/dist/theme.js.map +1 -1
  37. package/dist/theme.mjs +232 -283
  38. package/dist/theme.mjs.map +1 -1
  39. package/exports/css.ts +1 -0
  40. package/package.json +25 -4
  41. package/src/core/__workshop__/constants.ts +15 -15
  42. package/src/core/__workshop__/fontsPlugin.tsx +1 -1
  43. package/src/core/components/autocomplete/autocomplete.styles.tsx +1 -1
  44. package/src/core/components/autocomplete/autocomplete.tsx +12 -4
  45. package/src/core/components/breadcrumbs/__workshop__/example.tsx +1 -3
  46. package/src/core/components/breadcrumbs/__workshop__/index.ts +0 -5
  47. package/src/core/components/breadcrumbs/breadcrumbs.styles.ts +14 -2
  48. package/src/core/components/breadcrumbs/breadcrumbs.tsx +14 -9
  49. package/src/core/components/dialog/__workshop__/panes.tsx +1 -1
  50. package/src/core/components/dialog/dialog.tsx +77 -92
  51. package/src/core/components/hotkeys/hotkeys.tsx +18 -29
  52. package/src/core/components/menu/menu.tsx +8 -5
  53. package/src/core/components/menu/menuDivider.ts +2 -1
  54. package/src/core/components/menu/menuGroup.tsx +16 -8
  55. package/src/core/components/menu/menuItem.tsx +23 -14
  56. package/src/core/components/skeleton/skeleton.tsx +1 -1
  57. package/src/core/components/skeleton/styles.ts +1 -1
  58. package/src/core/components/skeleton/textSkeleton.tsx +1 -1
  59. package/src/core/components/tab/tab.tsx +6 -7
  60. package/src/core/components/tab/tabList.tsx +3 -2
  61. package/src/core/components/toast/styles.ts +1 -1
  62. package/src/core/components/toast/toast.tsx +6 -4
  63. package/src/core/components/toast/toastProvider.tsx +31 -22
  64. package/src/core/components/tree/style.ts +1 -1
  65. package/src/core/components/tree/tree.tsx +8 -2
  66. package/src/core/components/tree/treeGroup.tsx +1 -1
  67. package/src/core/components/tree/treeItem.tsx +38 -25
  68. package/src/core/components/tree/types.ts +5 -1
  69. package/src/core/lib/styled/elements.ts +135 -0
  70. package/src/core/lib/styled/index.ts +2 -0
  71. package/src/core/lib/styled/members.ts +15 -0
  72. package/src/core/lib/styled/styled.ts +79 -0
  73. package/src/core/primitives/_selectable/selectable.tsx +27 -14
  74. package/src/core/primitives/avatar/avatar.tsx +52 -32
  75. package/src/core/primitives/avatar/avatarCounter.tsx +1 -1
  76. package/src/core/primitives/avatar/avatarStack.tsx +1 -1
  77. package/src/core/primitives/badge/__workshop__/tones.tsx +9 -16
  78. package/src/core/primitives/badge/badge.tsx +18 -20
  79. package/src/core/primitives/box/box.tsx +62 -74
  80. package/src/core/primitives/button/__workshop__/props.tsx +3 -1
  81. package/src/core/primitives/button/__workshop__/sanityUploadButton.tsx +1 -1
  82. package/src/core/primitives/button/__workshop__/styled1.tsx +1 -1
  83. package/src/core/primitives/button/__workshop__/styled2.tsx +1 -1
  84. package/src/core/primitives/button/button.tsx +38 -45
  85. package/src/core/primitives/button/styles.ts +2 -2
  86. package/src/core/primitives/card/RootCardContext.ts +3 -0
  87. package/src/core/primitives/card/__workshop__/selected.tsx +1 -1
  88. package/src/core/primitives/card/__workshop__/styled.tsx +1 -1
  89. package/src/core/primitives/card/card.tsx +44 -46
  90. package/src/core/primitives/card/styles.ts +1 -1
  91. package/src/core/primitives/checkbox/checkbox.tsx +6 -8
  92. package/src/core/primitives/code/code.tsx +23 -12
  93. package/src/core/primitives/code/styles.ts +1 -1
  94. package/src/core/primitives/container/container.tsx +7 -15
  95. package/src/core/primitives/flex/__workshop__/example.tsx +1 -1
  96. package/src/core/primitives/flex/flex.tsx +6 -19
  97. package/src/core/primitives/grid/grid.tsx +2 -1
  98. package/src/core/primitives/heading/heading.tsx +32 -19
  99. package/src/core/primitives/heading/styles.ts +1 -1
  100. package/src/core/primitives/inline/inline.tsx +22 -13
  101. package/src/core/primitives/kbd/kbd.tsx +30 -37
  102. package/src/core/primitives/label/label.tsx +15 -4
  103. package/src/core/primitives/label/styles.ts +1 -1
  104. package/src/core/primitives/popover/__workshop__/RecursiveStory.tsx +0 -1
  105. package/src/core/primitives/popover/popover.tsx +21 -15
  106. package/src/core/primitives/popover/popoverCard.tsx +36 -38
  107. package/src/core/primitives/radio/radio.tsx +1 -1
  108. package/src/core/primitives/radio/styles.ts +1 -1
  109. package/src/core/primitives/select/select.tsx +1 -1
  110. package/src/core/primitives/select/styles.ts +1 -1
  111. package/src/core/primitives/spinner/spinner.tsx +6 -20
  112. package/src/core/primitives/stack/stack.tsx +12 -10
  113. package/src/core/primitives/switch/styles.ts +9 -9
  114. package/src/core/primitives/switch/switch.tsx +20 -21
  115. package/src/core/primitives/text/__workshop__/colored.tsx +1 -1
  116. package/src/core/primitives/text/styles.ts +1 -2
  117. package/src/core/primitives/text/text.tsx +17 -21
  118. package/src/core/primitives/textArea/textArea.tsx +1 -1
  119. package/src/core/primitives/textInput/__workshop__/plain.tsx +1 -1
  120. package/src/core/primitives/textInput/textInput.tsx +176 -123
  121. package/src/core/primitives/tooltip/tooltip.test.tsx +1 -0
  122. package/src/core/primitives/tooltip/tooltip.tsx +13 -13
  123. package/src/core/primitives/tooltip/tooltipCard.tsx +15 -14
  124. package/src/core/primitives/types.ts +35 -16
  125. package/src/core/styles/border/borderStyle.ts +6 -0
  126. package/src/core/styles/border/types.ts +1 -0
  127. package/src/core/styles/box/boxStyle.ts +6 -0
  128. package/src/core/styles/card/_cardColorStyle.ts +0 -8
  129. package/src/core/styles/flex/flexStyle.ts +0 -18
  130. package/src/core/styles/flex/types.ts +1 -3
  131. package/src/core/styles/grid/gridStyle.ts +0 -10
  132. package/src/core/styles/helpers.ts +9 -0
  133. package/src/core/styles/input/textInputStyle.ts +1 -1
  134. package/src/core/theme/__workshop__/build/Root.tsx +1 -1
  135. package/src/core/theme/themeProvider.tsx +1 -1
  136. package/src/core/theme/useTheme.ts +1 -1
  137. package/src/core/types/avatar.ts +6 -1
  138. package/src/core/types/button.ts +1 -0
  139. package/src/core/types/flex.ts +27 -26
  140. package/src/core/types/gridItem.ts +32 -24
  141. package/src/core/types/radius.ts +7 -4
  142. package/src/core/utils/arrow/arrow.tsx +1 -1
  143. package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +1 -1
  144. package/src/core/utils/layer/layer.tsx +28 -11
  145. package/src/core/utils/srOnly/srOnly.tsx +1 -1
  146. package/src/core/utils/virtualList/virtualList.tsx +1 -1
  147. package/src/css/_resp.ts +28 -0
  148. package/src/css/cli/buildCommand.ts +36 -0
  149. package/src/css/cli/index.ts +38 -0
  150. package/src/css/compile/comileRules.ts +59 -0
  151. package/src/css/compile/compileRule.ts +58 -0
  152. package/src/css/compile/compileSystem.ts +7 -0
  153. package/src/css/compile/compileTheme.ts +509 -0
  154. package/src/css/components/breadcrumbs/breadcrumbs.ts +5 -0
  155. package/src/css/components/breadcrumbs/index.ts +1 -0
  156. package/src/css/components/breadcrumbs/rules.ts +7 -0
  157. package/src/css/components/dialog/classes.ts +29 -0
  158. package/src/css/components/dialog/index.ts +1 -0
  159. package/src/css/components/dialog/rules.ts +75 -0
  160. package/src/css/components/tree/index.ts +1 -0
  161. package/src/css/components/tree/rules.ts +52 -0
  162. package/src/css/components/tree/tree.ts +5 -0
  163. package/src/css/composeClassNames.ts +3 -0
  164. package/src/css/index.ts +47 -0
  165. package/src/css/primitives/avatar/avatar.ts +32 -0
  166. package/src/css/primitives/avatar/index.ts +2 -0
  167. package/src/css/primitives/avatar/rules.ts +190 -0
  168. package/src/css/primitives/avatar/types.ts +9 -0
  169. package/src/css/primitives/badge/badge.ts +8 -0
  170. package/src/css/primitives/badge/index.ts +2 -0
  171. package/src/css/primitives/badge/rules.ts +25 -0
  172. package/src/css/primitives/badge/types.ts +8 -0
  173. package/src/css/primitives/box/box.ts +34 -0
  174. package/src/css/primitives/box/index.ts +2 -0
  175. package/src/css/primitives/box/rules.ts +25 -0
  176. package/src/css/primitives/box/types.ts +49 -0
  177. package/src/css/primitives/button/button.ts +26 -0
  178. package/src/css/primitives/button/index.ts +1 -0
  179. package/src/css/primitives/button/rules.ts +58 -0
  180. package/src/css/primitives/card/card.ts +21 -0
  181. package/src/css/primitives/card/index.ts +1 -0
  182. package/src/css/primitives/card/rules.ts +93 -0
  183. package/src/{core/primitives/checkbox/styles.ts → css/primitives/checkbox/__styles.ts} +3 -3
  184. package/src/css/primitives/checkbox/checkbox.ts +9 -0
  185. package/src/css/primitives/checkbox/index.ts +1 -0
  186. package/src/css/primitives/checkbox/rules.ts +136 -0
  187. package/src/css/primitives/code/code.ts +9 -0
  188. package/src/css/primitives/code/index.ts +2 -0
  189. package/src/css/primitives/code/rules.ts +71 -0
  190. package/src/css/primitives/code/types.ts +10 -0
  191. package/src/css/primitives/container/container.ts +7 -0
  192. package/src/css/primitives/container/index.ts +2 -0
  193. package/src/css/primitives/container/rules.ts +8 -0
  194. package/src/css/primitives/container/types.ts +6 -0
  195. package/src/css/primitives/heading/heading.ts +16 -0
  196. package/src/css/primitives/heading/index.ts +2 -0
  197. package/src/css/primitives/heading/rules.ts +84 -0
  198. package/src/css/primitives/heading/types.ts +12 -0
  199. package/src/css/primitives/kbd/index.ts +2 -0
  200. package/src/css/primitives/kbd/kbd.ts +7 -0
  201. package/src/css/primitives/kbd/rules.ts +20 -0
  202. package/src/css/primitives/kbd/types.ts +5 -0
  203. package/src/css/primitives/label/index.ts +2 -0
  204. package/src/css/primitives/label/label.ts +16 -0
  205. package/src/css/primitives/label/rules.ts +85 -0
  206. package/src/css/primitives/label/types.ts +12 -0
  207. package/src/css/primitives/popover/index.ts +1 -0
  208. package/src/css/primitives/popover/popover.ts +5 -0
  209. package/src/css/primitives/popover/rules.ts +5 -0
  210. package/src/css/primitives/radio/index.ts +1 -0
  211. package/src/css/primitives/radio/radio.ts +5 -0
  212. package/src/css/primitives/radio/rules.ts +5 -0
  213. package/src/css/primitives/select/index.ts +1 -0
  214. package/src/css/primitives/select/rules.ts +5 -0
  215. package/src/css/primitives/select/select.ts +5 -0
  216. package/src/{core/primitives/_selectable/style.ts → css/primitives/selectable/__style.ts} +5 -4
  217. package/src/css/primitives/selectable/index.ts +2 -0
  218. package/src/css/primitives/selectable/rules.ts +27 -0
  219. package/src/css/primitives/selectable/selectable.ts +9 -0
  220. package/src/css/primitives/selectable/types.ts +6 -0
  221. package/src/css/primitives/spinner/index.ts +1 -0
  222. package/src/css/primitives/spinner/rules.ts +22 -0
  223. package/src/css/primitives/spinner/spinner.ts +5 -0
  224. package/src/css/primitives/switch/index.ts +1 -0
  225. package/src/css/primitives/switch/rules.ts +132 -0
  226. package/src/css/primitives/switch/switch.ts +5 -0
  227. package/src/css/primitives/text/index.ts +2 -0
  228. package/src/css/primitives/text/rules.ts +75 -0
  229. package/src/css/primitives/text/text.ts +16 -0
  230. package/src/css/primitives/text/types.ts +11 -0
  231. package/src/css/primitives/textArea/index.ts +1 -0
  232. package/src/css/primitives/textArea/rules.ts +5 -0
  233. package/src/css/primitives/textArea/textArea.ts +5 -0
  234. package/src/css/primitives/textInput/index.ts +1 -0
  235. package/src/css/primitives/textInput/rules.ts +226 -0
  236. package/src/css/primitives/textInput/textInput.ts +7 -0
  237. package/src/css/primitives/token/rules.ts +45 -0
  238. package/src/css/primitives/tooltip/index.ts +1 -0
  239. package/src/css/primitives/tooltip/rules.ts +17 -0
  240. package/src/css/primitives/tooltip/tooltip.ts +9 -0
  241. package/src/css/responsiveRules.ts +25 -0
  242. package/src/css/rules.ts +121 -0
  243. package/src/css/styles/border/border.ts +22 -0
  244. package/src/css/styles/border/index.ts +2 -0
  245. package/src/css/styles/border/rules.ts +24 -0
  246. package/src/css/styles/border/types.ts +10 -0
  247. package/src/css/styles/display/rules.ts +62 -0
  248. package/src/css/styles/flex/flex.ts +20 -0
  249. package/src/css/styles/flex/index.ts +2 -0
  250. package/src/css/styles/flex/rules.ts +28 -0
  251. package/src/css/styles/flex/types.ts +35 -0
  252. package/src/css/styles/flexItem/flexItem.ts +8 -0
  253. package/src/css/styles/flexItem/index.ts +2 -0
  254. package/src/css/styles/flexItem/rules.ts +11 -0
  255. package/src/css/styles/flexItem/types.ts +11 -0
  256. package/src/css/styles/font/font.ts +12 -0
  257. package/src/css/styles/font/index.ts +2 -0
  258. package/src/css/styles/font/rules.ts +125 -0
  259. package/src/css/styles/font/types.ts +6 -0
  260. package/src/css/styles/gap/gap.ts +8 -0
  261. package/src/css/styles/gap/index.ts +2 -0
  262. package/src/css/styles/gap/rules.ts +33 -0
  263. package/src/css/styles/gap/types.ts +9 -0
  264. package/src/css/styles/grid/rules.ts +35 -0
  265. package/src/css/styles/gridItem/gridItem.ts +15 -0
  266. package/src/css/styles/gridItem/index.ts +2 -0
  267. package/src/css/styles/gridItem/rules.ts +96 -0
  268. package/src/css/styles/gridItem/types.ts +41 -0
  269. package/src/css/styles/height/rules.ts +7 -0
  270. package/src/css/styles/margin/index.ts +2 -0
  271. package/src/css/styles/margin/margin.ts +15 -0
  272. package/src/css/styles/margin/rules.ts +59 -0
  273. package/src/css/styles/margin/types.ts +11 -0
  274. package/src/css/styles/maxWidth/index.ts +2 -0
  275. package/src/css/styles/maxWidth/maxWidth.ts +6 -0
  276. package/src/css/styles/maxWidth/rules.ts +36 -0
  277. package/src/css/styles/maxWidth/types.ts +6 -0
  278. package/src/css/styles/overflow/rules.ts +9 -0
  279. package/src/css/styles/padding/index.ts +2 -0
  280. package/src/css/styles/padding/padding.ts +15 -0
  281. package/src/css/styles/padding/rules.ts +59 -0
  282. package/src/css/styles/padding/types.ts +12 -0
  283. package/src/css/styles/pointerEvents/index.ts +2 -0
  284. package/src/css/styles/pointerEvents/pointerEvents.ts +6 -0
  285. package/src/css/styles/pointerEvents/rules.ts +11 -0
  286. package/src/css/styles/pointerEvents/types.ts +7 -0
  287. package/src/css/styles/position/index.ts +2 -0
  288. package/src/css/styles/position/position.ts +7 -0
  289. package/src/css/styles/position/rules.ts +31 -0
  290. package/src/css/styles/position/types.ts +13 -0
  291. package/src/css/styles/radius/index.ts +2 -0
  292. package/src/css/styles/radius/radius.ts +8 -0
  293. package/src/css/styles/radius/rules.ts +13 -0
  294. package/src/css/styles/radius/types.ts +7 -0
  295. package/src/css/styles/shadow/rules.ts +53 -0
  296. package/src/css/styles/width/index.ts +2 -0
  297. package/src/css/styles/width/rules.ts +7 -0
  298. package/src/css/styles/width/types.ts +8 -0
  299. package/src/css/styles/width/width.ts +6 -0
  300. package/src/css/types.ts +591 -0
  301. package/src/css/varNames.ts +381 -0
  302. package/src/css/vars.ts +313 -0
  303. package/src/theme/build/_deprecated/color/factory.ts +1 -1
  304. package/src/theme/build/_deprecated/color/muted/createMuted.ts +2 -2
  305. package/src/theme/build/buildColorTheme.ts +39 -45
  306. package/src/theme/build/renderColorTheme.ts +65 -239
  307. package/src/theme/build/resolveColorTokens.ts +115 -51
  308. package/src/theme/config/tokens/color/types.ts +18 -4
  309. package/src/theme/defaults/colorTokens.ts +10 -17
  310. package/src/theme/defaults/config.ts +1 -1
  311. package/src/theme/getScopedTheme.ts +2 -9
  312. package/src/theme/system/_constants.ts +25 -0
  313. package/src/theme/system/_types.ts +41 -0
  314. package/src/theme/system/color/_constants.ts +0 -8
  315. package/src/theme/system/color/badge.ts +7 -3
  316. package/src/theme/system/index.ts +2 -0
  317. package/src/theme/system/v0/color/_system.ts +4 -8
  318. package/src/theme/system/v0/color/color.ts +2 -3
  319. package/src/theme/versioning/themeColor_v0_v2.ts +0 -26
  320. package/src/theme/versioning/v0_v2.ts +0 -4
  321. package/src/core/components/breadcrumbs/__workshop__/buttons.tsx +0 -58
  322. package/src/core/components/dialog/styles.ts +0 -76
@@ -1,43 +1,31 @@
1
+ import {RadiusStyleProps, ResponsiveProp} from '@sanity/ui/css'
2
+ import {FontTextSize, Space} from '@sanity/ui/theme'
1
3
  import {forwardRef} from 'react'
2
- import {styled} from 'styled-components'
3
4
  import {useArrayProp} from '../../hooks'
4
- import {Inline, KBD} from '../../primitives'
5
- import {Radius} from '../../types'
5
+ import {Box, Inline, KBD} from '../../primitives'
6
6
 
7
7
  /**
8
8
  * @public
9
9
  */
10
- export interface HotkeysProps {
11
- fontSize?: number | number[]
12
- padding?: number | number[]
13
- radius?: Radius | Radius[]
14
- space?: number | number[]
10
+ export interface HotkeysProps extends RadiusStyleProps {
11
+ fontSize?: ResponsiveProp<FontTextSize>
12
+ padding?: ResponsiveProp<Space>
13
+ space?: ResponsiveProp<Space>
15
14
  keys?: string[]
16
15
  }
17
16
 
18
- const Root = styled.kbd`
19
- font: inherit;
20
- padding: 1px;
21
-
22
- &:not([hidden]) {
23
- display: block;
24
- }
25
- `
26
-
27
- const Key = styled(KBD)`
28
- &:not([hidden]) {
29
- display: block;
30
- }
31
- `
32
-
33
17
  /**
34
18
  * Represent hotkeys (a keyboard combination) with semantic `<kbd>` elements.
35
19
  *
36
20
  * @public
37
21
  */
38
22
  export const Hotkeys = forwardRef(function Hotkeys(
39
- props: HotkeysProps & Omit<React.HTMLProps<HTMLElement>, 'as' | 'ref' | 'size'>,
40
- ref: React.Ref<HTMLElement>,
23
+ props: HotkeysProps &
24
+ Omit<
25
+ React.HTMLProps<HTMLDivElement>,
26
+ 'as' | 'display' | 'height' | 'ref' | 'size' | 'width' | 'wrap'
27
+ >,
28
+ ref: React.Ref<HTMLDivElement>,
41
29
  ) {
42
30
  const {fontSize, keys, padding, radius, space: spaceProp = 0.5, ...restProps} = props
43
31
  const space = useArrayProp(spaceProp)
@@ -47,15 +35,16 @@ export const Hotkeys = forwardRef(function Hotkeys(
47
35
  }
48
36
 
49
37
  return (
50
- <Root data-ui="Hotkeys" {...restProps} ref={ref}>
38
+ <Box as="kbd" data-ui="Hotkeys" {...restProps} display="flex" gap={spaceProp} ref={ref}>
51
39
  <Inline as="span" space={space}>
52
40
  {keys.map((key, i) => (
53
- <Key fontSize={fontSize} key={i} padding={padding} radius={radius}>
41
+ <KBD display="block" fontSize={fontSize} key={i} padding={padding} radius={radius}>
54
42
  {key}
55
- </Key>
43
+ </KBD>
56
44
  ))}
57
45
  </Inline>
58
- </Root>
46
+ </Box>
59
47
  )
60
48
  })
49
+
61
50
  Hotkeys.displayName = 'ForwardRef(Hotkeys)'
@@ -1,8 +1,9 @@
1
+ import {PaddingStyleProps, ResponsiveProp} from '@sanity/ui/css'
2
+ import {Space} from '@sanity/ui/theme'
1
3
  import {forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef} from 'react'
2
- import {styled} from 'styled-components'
3
4
  import {useClickOutsideEvent, useGlobalKeyDown} from '../../hooks'
5
+ import {styled} from '../../lib/styled'
4
6
  import {Box, Stack} from '../../primitives'
5
- import {ResponsivePaddingProps} from '../../primitives/types'
6
7
  import {useLayer} from '../../utils'
7
8
  import {MenuContext, MenuContextValue} from './menuContext'
8
9
  import {useMenuController} from './useMenuController'
@@ -10,7 +11,7 @@ import {useMenuController} from './useMenuController'
10
11
  /**
11
12
  * @public
12
13
  */
13
- export interface MenuProps extends ResponsivePaddingProps {
14
+ export interface MenuProps extends PaddingStyleProps {
14
15
  /**
15
16
  * @deprecated Use `shouldFocus="first"` instead.
16
17
  */
@@ -26,7 +27,8 @@ export interface MenuProps extends ResponsivePaddingProps {
26
27
  originElement?: HTMLElement | null
27
28
  registerElement?: (el: HTMLElement) => () => void
28
29
  shouldFocus?: 'first' | 'last' | null
29
- space?: number | number[]
30
+ // space?: number | number[]
31
+ space?: ResponsiveProp<Space>
30
32
  }
31
33
 
32
34
  const Root = styled(Box)`
@@ -40,7 +42,8 @@ const Root = styled(Box)`
40
42
  * @public
41
43
  */
42
44
  export const Menu = forwardRef(function Menu(
43
- props: MenuProps & Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height' | 'role' | 'tabIndex'>,
45
+ props: MenuProps &
46
+ Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height' | 'role' | 'tabIndex' | 'width' | 'wrap'>,
44
47
  forwardedRef: React.ForwardedRef<HTMLDivElement>,
45
48
  ) {
46
49
  const {
@@ -1,4 +1,4 @@
1
- import {styled} from 'styled-components'
1
+ import {styled} from '../../lib/styled'
2
2
 
3
3
  /**
4
4
  * @public
@@ -9,4 +9,5 @@ export const MenuDivider = styled.hr`
9
9
  background: var(--card-hairline-soft-color);
10
10
  margin: 0;
11
11
  `
12
+
12
13
  MenuDivider.displayName = 'MenuDivider'
@@ -1,10 +1,12 @@
1
1
  import {ChevronRightIcon} from '@sanity/icons'
2
+ import {ResponsiveProp} from '@sanity/ui/css'
3
+ import {Space} from '@sanity/ui/theme'
2
4
  import {isValidElement, useCallback, useEffect, useState} from 'react'
3
5
  import {isValidElementType} from 'react-is'
4
- import {useArrayProp} from '../../hooks'
6
+ // import {useArrayProp} from '../../hooks'
5
7
  import {Box, Flex, Popover, PopoverProps, Text} from '../../primitives'
6
8
  import {Selectable} from '../../primitives/_selectable'
7
- import {useRootTheme} from '../../theme'
9
+ // import {useRootTheme} from '../../theme'
8
10
  import {Radius, SelectableTone} from '../../types'
9
11
  import {Menu} from './menu'
10
12
  import {useMenu} from './useMenu'
@@ -19,7 +21,8 @@ export interface MenuGroupProps {
19
21
  padding?: number | number[]
20
22
  popover?: Omit<PopoverProps, 'content' | 'open'>
21
23
  radius?: Radius | Radius[]
22
- space?: number | number[]
24
+ space?: ResponsiveProp<Space>
25
+ // space?: number | number[]
23
26
  text: React.ReactNode
24
27
  tone?: SelectableTone
25
28
  }
@@ -28,7 +31,10 @@ export interface MenuGroupProps {
28
31
  * @public
29
32
  */
30
33
  export function MenuGroup(
31
- props: Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height' | 'popover' | 'ref' | 'tabIndex'> &
34
+ props: Omit<
35
+ React.HTMLProps<HTMLDivElement>,
36
+ 'as' | 'height' | 'popover' | 'ref' | 'tabIndex' | 'width' | 'wrap'
37
+ > &
32
38
  MenuGroupProps,
33
39
  ): React.ReactElement {
34
40
  const {
@@ -46,7 +52,7 @@ export function MenuGroup(
46
52
  ...restProps
47
53
  } = props
48
54
  const menu = useMenu()
49
- const {scheme} = useRootTheme()
55
+ // const {scheme} = useRootTheme()
50
56
  const {
51
57
  activeElement,
52
58
  mount,
@@ -166,14 +172,16 @@ export function MenuGroup(
166
172
  aria-pressed={as === 'button' ? withinMenu : undefined}
167
173
  data-pressed={as !== 'button' ? withinMenu : undefined}
168
174
  data-selected={!withinMenu && active ? '' : undefined}
169
- $radius={useArrayProp(radius)}
170
- $tone={tone}
171
- $scheme={scheme}
175
+ // $radius={useArrayProp(radius)}
176
+ // $tone={tone}
177
+ // $scheme={scheme}
172
178
  onClick={handleClick}
173
179
  onKeyDown={handleKeyDown}
174
180
  onMouseEnter={handleMouseEnter}
181
+ radius={radius}
175
182
  ref={setRootElement}
176
183
  tabIndex={-1}
184
+ tone={tone}
177
185
  type={as === 'button' ? 'button' : undefined}
178
186
  >
179
187
  <Flex gap={space} padding={padding}>
@@ -1,3 +1,5 @@
1
+ import {PaddingStyleProps, RadiusStyleProps, ResponsiveProp} from '@sanity/ui/css'
2
+ import {Space} from '@sanity/ui/theme'
1
3
  import {
2
4
  forwardRef,
3
5
  isValidElement,
@@ -9,11 +11,10 @@ import {
9
11
  useState,
10
12
  } from 'react'
11
13
  import {isValidElementType} from 'react-is'
12
- import {useArrayProp} from '../../hooks'
14
+ // import {useArrayProp} from '../../hooks'
13
15
  import {Box, Flex, Text} from '../../primitives'
14
16
  import {Selectable} from '../../primitives/_selectable'
15
- import {ResponsivePaddingProps, ResponsiveRadiusProps} from '../../primitives/types'
16
- import {useRootTheme} from '../../theme'
17
+ // import {useRootTheme} from '../../theme'
17
18
  import {SelectableTone} from '../../types/selectable'
18
19
  import {Hotkeys} from '../hotkeys'
19
20
  import {useMenu} from './useMenu'
@@ -21,7 +22,7 @@ import {useMenu} from './useMenu'
21
22
  /**
22
23
  * @public
23
24
  */
24
- export interface MenuItemProps extends ResponsivePaddingProps, ResponsiveRadiusProps {
25
+ export interface MenuItemProps extends PaddingStyleProps, RadiusStyleProps {
25
26
  as?: React.ElementType | keyof JSX.IntrinsicElements
26
27
  fontSize?: number | number[]
27
28
  hotkeys?: string[]
@@ -29,7 +30,8 @@ export interface MenuItemProps extends ResponsivePaddingProps, ResponsiveRadiusP
29
30
  iconRight?: React.ElementType | React.ReactNode
30
31
  pressed?: boolean
31
32
  selected?: boolean
32
- space?: number | number[]
33
+ // space?: number | number[]
34
+ space?: ResponsiveProp<Space>
33
35
  text?: React.ReactNode
34
36
  tone?: SelectableTone
35
37
  }
@@ -39,7 +41,10 @@ export interface MenuItemProps extends ResponsivePaddingProps, ResponsiveRadiusP
39
41
  */
40
42
  export const MenuItem = forwardRef(function MenuItem(
41
43
  props: MenuItemProps &
42
- Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height' | 'ref' | 'selected' | 'tabIndex'>,
44
+ Omit<
45
+ React.HTMLProps<HTMLDivElement>,
46
+ 'as' | 'height' | 'ref' | 'selected' | 'tabIndex' | 'width' | 'wrap'
47
+ >,
43
48
  forwardedRef: React.ForwardedRef<HTMLDivElement>,
44
49
  ) {
45
50
  const {
@@ -66,7 +71,7 @@ export const MenuItem = forwardRef(function MenuItem(
66
71
  tone = 'default',
67
72
  ...restProps
68
73
  } = props
69
- const {scheme} = useRootTheme()
74
+ // const {scheme} = useRootTheme()
70
75
  const menu = useMenu()
71
76
  const {
72
77
  activeElement,
@@ -105,7 +110,7 @@ export const MenuItem = forwardRef(function MenuItem(
105
110
  [padding, paddingX, paddingY, paddingTop, paddingRight, paddingBottom, paddingLeft],
106
111
  )
107
112
 
108
- const hotkeysFontSize = useArrayProp(fontSize).map((s) => s - 1)
113
+ // const hotkeysFontSize = useArrayProp(fontSize).map((s) => s - 1)
109
114
 
110
115
  const setRef = useCallback((el: HTMLDivElement | null) => {
111
116
  ref.current = el
@@ -117,14 +122,16 @@ export const MenuItem = forwardRef(function MenuItem(
117
122
  data-ui="MenuItem"
118
123
  {...restProps}
119
124
  aria-pressed={as === 'button' && pressed}
125
+ as={as}
120
126
  data-pressed={as !== 'button' && pressed ? '' : undefined}
121
127
  data-selected={active ? '' : undefined}
122
128
  data-disabled={disabled ? '' : undefined}
123
- forwardedAs={as}
124
- $radius={useArrayProp(radius)}
125
- $padding={useArrayProp(0)}
126
- $tone={disabled ? 'default' : tone}
127
- $scheme={scheme}
129
+ // forwardedAs={as}
130
+ radius={radius}
131
+ // $radius={useArrayProp(radius)}
132
+ // $padding={useArrayProp(0)}
133
+ // $tone={disabled ? 'default' : tone}
134
+ // $scheme={scheme}
128
135
  disabled={disabled}
129
136
  onClick={handleClick}
130
137
  onMouseEnter={onItemMouseEnter}
@@ -132,6 +139,7 @@ export const MenuItem = forwardRef(function MenuItem(
132
139
  ref={setRef}
133
140
  role="menuitem"
134
141
  tabIndex={-1}
142
+ tone={tone}
135
143
  type={as === 'button' ? 'button' : undefined}
136
144
  >
137
145
  {(IconComponent || text || IconRightComponent) && (
@@ -153,7 +161,7 @@ export const MenuItem = forwardRef(function MenuItem(
153
161
 
154
162
  {hotkeys && (
155
163
  <Hotkeys
156
- fontSize={hotkeysFontSize}
164
+ // fontSize={hotkeysFontSize}
157
165
  keys={hotkeys}
158
166
  style={{marginTop: -4, marginBottom: -4}}
159
167
  />
@@ -175,4 +183,5 @@ export const MenuItem = forwardRef(function MenuItem(
175
183
  </Selectable>
176
184
  )
177
185
  })
186
+
178
187
  MenuItem.displayName = 'ForwardRef(MenuItem)'
@@ -1,5 +1,5 @@
1
1
  import {forwardRef, useEffect, useState} from 'react'
2
- import {styled} from 'styled-components'
2
+ import {styled} from '../../lib/styled'
3
3
  import {useArrayProp} from '../../hooks'
4
4
  import {Box} from '../../primitives'
5
5
  import {BoxProps, ResponsiveRadiusProps} from '../../primitives'
@@ -1,4 +1,4 @@
1
- import {css, keyframes} from 'styled-components'
1
+ import {css, keyframes} from '../../lib/styled'
2
2
 
3
3
  const keyframe = keyframes`
4
4
  0% {
@@ -1,6 +1,6 @@
1
1
  import {ThemeFontKey, getTheme_v2} from '@sanity/ui/theme'
2
2
  import {forwardRef} from 'react'
3
- import {styled} from 'styled-components'
3
+ import {styled} from '../../lib/styled'
4
4
  import {useArrayProp} from '../../hooks'
5
5
  import {ThemeProps, _responsive} from '../../styles'
6
6
  import {Skeleton, SkeletonProps} from './skeleton'
@@ -1,5 +1,6 @@
1
+ import {ResponsiveProp} from '@sanity/ui/css'
2
+ import {FontTextSize} from '@sanity/ui/theme'
1
3
  import {forwardRef, useCallback, useEffect, useImperativeHandle, useRef} from 'react'
2
- import {styled} from 'styled-components'
3
4
  import {Button} from '../../primitives'
4
5
  import {ButtonTone} from '../../types'
5
6
 
@@ -14,17 +15,14 @@ export interface TabProps {
14
15
  'id': string
15
16
  'icon'?: React.ElementType | React.ReactNode
16
17
  'focused'?: boolean
17
- 'fontSize'?: number | number[]
18
+ 'fontSize'?: ResponsiveProp<FontTextSize>
19
+ // 'fontSize'?: number | number[]
18
20
  'label'?: React.ReactNode
19
21
  'padding'?: number | number[]
20
22
  'selected'?: boolean
21
23
  'tone'?: ButtonTone
22
24
  }
23
25
 
24
- const CustomButton = styled(Button)`
25
- max-width: 100%;
26
- `
27
-
28
26
  /**
29
27
  * @public
30
28
  */
@@ -76,7 +74,7 @@ export const Tab = forwardRef(function Tab(
76
74
  }, [focused])
77
75
 
78
76
  return (
79
- <CustomButton
77
+ <Button
80
78
  data-ui="Tab"
81
79
  {...restProps}
82
80
  aria-selected={selected ? 'true' : 'false'}
@@ -97,4 +95,5 @@ export const Tab = forwardRef(function Tab(
97
95
  />
98
96
  )
99
97
  })
98
+
100
99
  Tab.displayName = 'ForwardRef(Tab)'
@@ -1,5 +1,5 @@
1
1
  import {cloneElement, forwardRef, useCallback, useMemo, useState} from 'react'
2
- import {styled} from 'styled-components'
2
+ import {styled} from '../../lib/styled'
3
3
  import {Inline, InlineProps} from '../../primitives'
4
4
 
5
5
  /**
@@ -13,7 +13,7 @@ function _isReactElement(node: unknown): node is React.ReactElement {
13
13
  return Boolean(node)
14
14
  }
15
15
 
16
- //Limits the width of tabs in tablist
16
+ // Limits the width of tabs in tablist
17
17
  const CustomInline = styled(Inline)`
18
18
  & > div {
19
19
  display: inline-block;
@@ -74,4 +74,5 @@ export const TabList = forwardRef(function TabList(
74
74
  </CustomInline>
75
75
  )
76
76
  })
77
+
77
78
  TabList.displayName = 'ForwardRef(TabList)'
@@ -1,6 +1,6 @@
1
- import {styled, keyframes, css} from 'styled-components'
2
1
  import {ThemeColorStateToneKey, getTheme_v2} from '../../../theme'
3
2
  import {POPOVER_MOTION_CONTENT_OPACITY_PROPERTY} from '../../constants'
3
+ import {styled, keyframes, css} from '../../lib/styled'
4
4
  import {Flex} from '../../primitives'
5
5
  import {ThemeProps} from '../../styles'
6
6
 
@@ -1,6 +1,7 @@
1
1
  import {CloseIcon} from '@sanity/icons'
2
+ import {RadiusStyleProps} from '@sanity/ui/css'
2
3
  import {ThemeColorStateToneKey} from '@sanity/ui/theme'
3
- import {styled} from 'styled-components'
4
+ import {styled} from '../../lib/styled'
4
5
  import {Box, Button, Flex, Stack, Text, Card} from '../../primitives'
5
6
  import {ThemeProps} from '../../styles'
6
7
  import type {ButtonTone} from '../../types'
@@ -9,11 +10,10 @@ import {rootStyles, TextBox} from './styles'
9
10
  /**
10
11
  * @public
11
12
  */
12
- export interface ToastProps {
13
+ export interface ToastProps extends RadiusStyleProps {
13
14
  closable?: boolean
14
15
  description?: React.ReactNode
15
16
  onClose?: () => void
16
- radius?: number | number[]
17
17
  title?: React.ReactNode
18
18
  status?: 'error' | 'warning' | 'success' | 'info'
19
19
  duration?: number
@@ -52,7 +52,8 @@ const Root = styled(Card)<{$duration?: number; tone: ThemeColorStateToneKey} & T
52
52
  * @public
53
53
  */
54
54
  export function Toast(
55
- props: ToastProps & Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height' | 'ref' | 'title'>,
55
+ props: ToastProps &
56
+ Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height' | 'ref' | 'title' | 'width' | 'wrap'>,
56
57
  ): React.ReactElement {
57
58
  const {closable, description, duration, onClose, radius = 3, title, status, ...restProps} = props
58
59
  const cardTone = status ? STATUS_CARD_TONE[status] : 'default'
@@ -65,6 +66,7 @@ export function Toast(
65
66
  role={role}
66
67
  {...restProps}
67
68
  marginTop={3}
69
+ pointerEvents="auto"
68
70
  radius={radius}
69
71
  shadow={2}
70
72
  tone={cardTone}
@@ -1,9 +1,9 @@
1
1
  import {AnimatePresence, motion, type Variants} from 'framer-motion'
2
2
  import {useMemo, useRef, useState, startTransition, useEffect} from 'react'
3
- import {styled} from 'styled-components'
4
3
  import {POPOVER_MOTION_CONTENT_OPACITY_PROPERTY} from '../../constants'
5
4
  import {useMounted} from '../../hooks/useMounted'
6
5
  import {usePrefersReducedMotion} from '../../hooks/usePrefersReducedMotion'
6
+ // import {styled} from '../../lib/styled'
7
7
  import {Box} from '../../primitives'
8
8
  import {Layer} from '../../utils'
9
9
  import {Toast} from './toast'
@@ -27,23 +27,14 @@ export interface ToastProviderProps {
27
27
  zOffset?: number | number[]
28
28
  }
29
29
 
30
- const Root = styled(Layer)`
31
- position: fixed;
32
- top: 0;
33
- left: 0;
34
- right: 0;
35
- bottom: 0;
36
- pointer-events: none;
37
- `
38
-
39
- const ToastContainer = styled.div`
40
- box-sizing: border-box;
41
- position: absolute;
42
- right: 0;
43
- bottom: 0;
44
- max-width: 420px;
45
- width: 100%;
46
- `
30
+ // const ToastContainer = styled.div`
31
+ // box-sizing: border-box;
32
+ // position: absolute;
33
+ // right: 0;
34
+ // bottom: 0;
35
+ // max-width: 420px;
36
+ // width: 100%;
37
+ // `
47
38
 
48
39
  let toastId = 0
49
40
 
@@ -153,8 +144,26 @@ export function ToastProvider(props: ToastProviderProps): React.ReactElement {
153
144
  <ToastContext.Provider value={value}>
154
145
  {children}
155
146
  {mounted && (
156
- <Root data-ui="ToastProvider" zOffset={zOffset}>
157
- <ToastContainer>
147
+ <Layer
148
+ className={undefined /* root */}
149
+ data-ui="ToastProvider"
150
+ inset={0}
151
+ pointerEvents="none"
152
+ position="fixed"
153
+ zOffset={zOffset}
154
+ width="fill"
155
+ >
156
+ <Box
157
+ className={undefined /* container */}
158
+ position="absolute"
159
+ sizing="border"
160
+ style={{
161
+ // todo: move to css
162
+ right: 0,
163
+ bottom: 0,
164
+ maxWidth: 420,
165
+ }}
166
+ >
158
167
  <Box padding={padding} paddingX={paddingX} paddingY={paddingY}>
159
168
  <AnimatePresence initial={false}>
160
169
  {state.map(({dismiss, id, params}) => (
@@ -183,8 +192,8 @@ export function ToastProvider(props: ToastProviderProps): React.ReactElement {
183
192
  ))}
184
193
  </AnimatePresence>
185
194
  </Box>
186
- </ToastContainer>
187
- </Root>
195
+ </Box>
196
+ </Layer>
188
197
  )}
189
198
  </ToastContext.Provider>
190
199
  )
@@ -1,5 +1,5 @@
1
1
  import {getTheme_v2} from '@sanity/ui/theme'
2
- import {css} from 'styled-components'
2
+ import {css} from '../../lib/styled'
3
3
  import {rem, ThemeProps} from '../../styles'
4
4
  import {_cardColorStyle} from '../../styles/card'
5
5
 
@@ -1,3 +1,5 @@
1
+ import {ResponsiveProp} from '@sanity/ui/css'
2
+ import {Space} from '@sanity/ui/theme'
1
3
  import {
2
4
  forwardRef,
3
5
  memo,
@@ -18,7 +20,8 @@ import {TreeContextValue, TreeState} from './types'
18
20
  * @beta
19
21
  */
20
22
  export interface TreeProps {
21
- space?: number | number[]
23
+ // space?: number | number[]
24
+ space?: ResponsiveProp<Space>
22
25
  }
23
26
 
24
27
  /**
@@ -28,7 +31,10 @@ export interface TreeProps {
28
31
  export const Tree = memo(
29
32
  forwardRef(function Tree(
30
33
  props: TreeProps &
31
- Omit<React.HTMLProps<HTMLDivElement>, 'align' | 'as' | 'height' | 'ref' | 'role' | 'wrap'>,
34
+ Omit<
35
+ React.HTMLProps<HTMLDivElement>,
36
+ 'align' | 'as' | 'height' | 'ref' | 'role' | 'width' | 'wrap'
37
+ >,
32
38
  forwardedRef: React.ForwardedRef<HTMLDivElement>,
33
39
  ): React.ReactElement {
34
40
  const {children, space = 1, onFocus, ...restProps} = props
@@ -8,7 +8,7 @@ export interface TreeGroupProps {
8
8
 
9
9
  export const TreeGroup = memo(function TreeGroup(
10
10
  props: TreeGroupProps &
11
- Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height' | 'ref' | 'role' | 'wrap'>,
11
+ Omit<React.HTMLProps<HTMLDivElement>, 'as' | 'height' | 'ref' | 'role' | 'width' | 'wrap'>,
12
12
  ): React.ReactElement {
13
13
  const {children, expanded = false, ...restProps} = props
14
14
  const tree = useTree()