@sanity/ui 3.0.0-static.10 → 3.0.0-static.12

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 (275) hide show
  1. package/dist/_chunks-cjs/_visual-editing.js +1300 -1269
  2. package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
  3. package/dist/_chunks-cjs/buildCommand.js +28 -10
  4. package/dist/_chunks-cjs/buildCommand.js.map +1 -1
  5. package/dist/_chunks-es/_visual-editing.mjs +1298 -1263
  6. package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
  7. package/dist/_visual-editing.d.mts +516 -360
  8. package/dist/_visual-editing.d.ts +516 -360
  9. package/dist/cli.js +1 -1
  10. package/dist/css.d.mts +258 -75
  11. package/dist/css.d.ts +258 -75
  12. package/dist/css.js +746 -752
  13. package/dist/css.js.map +1 -1
  14. package/dist/css.mjs +748 -754
  15. package/dist/css.mjs.map +1 -1
  16. package/dist/index.d.mts +1342 -871
  17. package/dist/index.d.ts +1342 -871
  18. package/dist/index.js +433 -325
  19. package/dist/index.js.map +1 -1
  20. package/dist/index.mjs +429 -321
  21. package/dist/index.mjs.map +1 -1
  22. package/dist/sanity-palette.css +105 -1
  23. package/dist/sanity-palette.min.css +1 -0
  24. package/dist/sanity-theme.css +4571 -1
  25. package/dist/sanity-theme.min.css +1 -0
  26. package/dist/system.css +22053 -21710
  27. package/dist/system.min.css +1 -0
  28. package/dist/theme.d.mts +51 -106
  29. package/dist/theme.d.ts +51 -106
  30. package/dist/theme.js +19 -20
  31. package/dist/theme.js.map +1 -1
  32. package/dist/theme.mjs +19 -20
  33. package/dist/theme.mjs.map +1 -1
  34. package/package.json +10 -5
  35. package/src/cli/buildCommand.ts +46 -19
  36. package/src/css/_comp.ts +2 -2
  37. package/src/css/{compile/compileStyle.ts → _compileStyle.ts} +7 -7
  38. package/src/css/_resp.ts +0 -1
  39. package/src/css/{system.style.ts → _system.style.ts} +3 -2
  40. package/src/css/aspects/display/display.ts +1 -0
  41. package/src/css/aspects/display/types.ts +2 -3
  42. package/src/css/aspects/flex/types.ts +4 -12
  43. package/src/css/aspects/flexItem/types.ts +1 -3
  44. package/src/css/aspects/font/font.style.ts +7 -66
  45. package/src/css/aspects/font/types.ts +1 -3
  46. package/src/css/aspects/grid/grid.ts +1 -0
  47. package/src/css/aspects/grid/types.ts +5 -9
  48. package/src/css/aspects/gridItem/gridItem.ts +1 -1
  49. package/src/css/aspects/gridItem/types.ts +7 -18
  50. package/src/css/aspects/height/height.ts +3 -4
  51. package/src/css/aspects/inset/inset.ts +1 -0
  52. package/src/css/aspects/margin/margin.ts +1 -0
  53. package/src/css/aspects/margin/types.ts +1 -0
  54. package/src/css/aspects/maxWidth/maxWidth.ts +1 -0
  55. package/src/css/aspects/maxWidth/types.ts +1 -0
  56. package/src/css/aspects/minWidth/minWidth.ts +1 -0
  57. package/src/css/aspects/minWidth/types.ts +2 -0
  58. package/src/css/aspects/overflow/overflow.ts +1 -0
  59. package/src/css/aspects/padding/padding.ts +1 -0
  60. package/src/css/aspects/pointerEvents/pointerEvents.ts +1 -0
  61. package/src/css/aspects/position/position.ts +1 -0
  62. package/src/css/aspects/shadow/shadow.style.ts +16 -41
  63. package/src/css/aspects/shadow/shadow.ts +1 -0
  64. package/src/css/aspects/textOverflow/textOverflow.ts +1 -0
  65. package/src/css/aspects/textOverflow/types.ts +1 -0
  66. package/src/css/aspects/width/types.ts +2 -0
  67. package/src/css/aspects/width/width.ts +1 -0
  68. package/src/css/compilePalette.ts +32 -0
  69. package/src/css/compileSystem.ts +7 -0
  70. package/src/css/{compile/compileTheme.ts → compileTheme.ts} +1 -0
  71. package/src/css/compileTheme_v3.ts +434 -0
  72. package/src/css/components/breadcrumbs/breadcrumbs.ts +1 -0
  73. package/src/css/components/dialog/dialog.ts +7 -0
  74. package/src/css/components/menu/menu.ts +2 -0
  75. package/src/css/components/skeleton/skeleton.style.ts +8 -4
  76. package/src/css/components/skeleton/skeleton.ts +4 -0
  77. package/src/css/components/skeleton/types.ts +4 -0
  78. package/src/css/components/toast/toast.ts +5 -0
  79. package/src/css/components/tree/tree.ts +1 -0
  80. package/src/css/composeClassNames.ts +4 -2
  81. package/src/css/constants.ts +11 -0
  82. package/src/css/index.ts +4 -3
  83. package/src/css/primitives/_arrow/_arrow.style.ts +6 -8
  84. package/src/css/primitives/_arrow/_arrow.ts +7 -0
  85. package/src/css/primitives/_input/input.ts +2 -0
  86. package/src/css/primitives/_selectable/_selectable.style.ts +24 -25
  87. package/src/css/primitives/_selectable/selectable.ts +1 -2
  88. package/src/css/primitives/avatar/avatar.style.ts +5 -8
  89. package/src/css/primitives/avatar/avatar.ts +6 -0
  90. package/src/css/primitives/avatar/types.ts +1 -0
  91. package/src/css/primitives/box/types.ts +1 -3
  92. package/src/css/primitives/button/button.style.ts +48 -15
  93. package/src/css/primitives/button/button.ts +4 -21
  94. package/src/css/primitives/button/index.ts +1 -0
  95. package/src/css/primitives/button/types.ts +18 -0
  96. package/src/css/primitives/card/card.style.ts +4 -7
  97. package/src/css/primitives/card/card.ts +2 -2
  98. package/src/css/primitives/card/types.ts +2 -2
  99. package/src/css/primitives/checkbox/checkbox.ts +2 -0
  100. package/src/css/primitives/container/container.ts +1 -0
  101. package/src/css/primitives/container/types.ts +1 -0
  102. package/src/css/primitives/kbd/kbd.ts +1 -0
  103. package/src/css/primitives/label/types.ts +7 -2
  104. package/src/css/primitives/popover/popover.ts +2 -0
  105. package/src/css/primitives/radio/radio.ts +1 -0
  106. package/src/css/primitives/select/select.ts +2 -0
  107. package/src/css/primitives/spinner/spinner.ts +2 -0
  108. package/src/css/primitives/switch/switch.ts +5 -0
  109. package/src/css/primitives/text/types.ts +4 -0
  110. package/src/css/primitives/textArea/textArea.ts +1 -0
  111. package/src/css/primitives/textInput/textInput.ts +1 -0
  112. package/src/css/primitives/token/token.style.ts +37 -36
  113. package/src/css/primitives/tooltip/tooltip.ts +2 -0
  114. package/src/css/responsiveRules.ts +12 -19
  115. package/src/css/scopeClassName.ts +1 -0
  116. package/src/css/types.ts +115 -15
  117. package/src/css/util.ts +5 -0
  118. package/src/css/utils/srOnly/srOnly.ts +1 -0
  119. package/src/css/varNames.ts +230 -143
  120. package/src/css/vars.ts +53 -22
  121. package/src/theme/palette/constants.ts +2 -0
  122. package/src/theme/palette/types.ts +3 -0
  123. package/src/theme/types.ts +2 -6
  124. package/src/theme/v0/focusRing.ts +1 -3
  125. package/src/theme/v0/font.ts +6 -18
  126. package/src/theme/v0/layer.ts +1 -3
  127. package/src/theme/v0/shadow.ts +2 -6
  128. package/src/theme/v2/avatar.ts +1 -3
  129. package/src/theme/v2/color/_system.ts +1 -3
  130. package/src/theme/v2/color/avatar.ts +2 -6
  131. package/src/theme/v2/color/badge.ts +2 -6
  132. package/src/theme/v2/color/button.ts +3 -9
  133. package/src/theme/v2/color/color.ts +3 -9
  134. package/src/theme/v2/color/input.ts +3 -9
  135. package/src/theme/v2/color/kbd.ts +1 -3
  136. package/src/theme/v2/color/selectable.ts +2 -6
  137. package/src/theme/v2/color/state.ts +1 -3
  138. package/src/theme/v2/color/syntax.ts +1 -3
  139. package/src/theme/v2/input.ts +1 -3
  140. package/src/theme/v2/theme.ts +2 -6
  141. package/src/theme/v3/buildTheme_v3.ts +2 -1
  142. package/src/theme/v3/color/color.ts +6 -4
  143. package/src/theme/v3/color/renderColor.ts +4 -1
  144. package/src/theme/v3/{defaults.ts → defaultTokens.ts} +2 -2
  145. package/src/theme/v3/index.ts +1 -1
  146. package/src/theme/v3/resolveTokens.ts +18 -18
  147. package/src/ui/RootClassNames.tsx +44 -0
  148. package/src/ui/StyleTags.tsx +3 -1
  149. package/src/ui/_compat/helpers.ts +72 -0
  150. package/src/ui/_compat/index.ts +2 -6
  151. package/src/ui/_compat/studioTheme.ts +7 -0
  152. package/src/ui/_compat/theme/themeColorProvider.tsx +2 -6
  153. package/src/ui/_compat/theme/themeProvider.tsx +2 -6
  154. package/src/ui/_compat/theme/types.ts +1 -3
  155. package/src/ui/_compat/theme/useRootTheme.ts +1 -3
  156. package/src/ui/_compat/theme/useTheme.ts +2 -6
  157. package/src/ui/_compat/types.ts +0 -83
  158. package/src/ui/components/autocomplete/__workshop__/constrainedHeight.tsx +2 -2
  159. package/src/ui/components/autocomplete/autocomplete.tsx +86 -114
  160. package/src/ui/components/autocomplete/autocompleteOption.tsx +2 -0
  161. package/src/ui/components/autocomplete/types.ts +3 -8
  162. package/src/ui/components/breadcrumbs/breadcrumbs.tsx +27 -21
  163. package/src/ui/components/dialog/dialog.tsx +89 -291
  164. package/src/ui/components/dialog/dialogCard.tsx +183 -0
  165. package/src/ui/components/dialog/isTargetWithinScope.ts +14 -0
  166. package/src/ui/components/hotkeys/hotkeys.tsx +33 -15
  167. package/src/ui/components/menu/__workshop__/asComponent.tsx +6 -6
  168. package/src/ui/components/menu/menu.tsx +27 -33
  169. package/src/ui/components/menu/menuButton.tsx +10 -14
  170. package/src/ui/components/menu/menuDivider.tsx +25 -13
  171. package/src/ui/components/menu/menuGroup.tsx +34 -26
  172. package/src/ui/components/menu/menuItem.tsx +51 -40
  173. package/src/ui/components/skeleton/codeSkeleton.tsx +53 -0
  174. package/src/ui/components/skeleton/headingSkeleton.tsx +52 -0
  175. package/src/ui/components/skeleton/index.ts +3 -0
  176. package/src/ui/components/skeleton/labelSkeleton.tsx +51 -0
  177. package/src/ui/components/skeleton/skeleton.tsx +39 -16
  178. package/src/ui/components/skeleton/textSkeleton.tsx +31 -110
  179. package/src/ui/components/tab/tab.tsx +23 -19
  180. package/src/ui/components/tab/tabList.tsx +34 -33
  181. package/src/ui/components/tab/tabPanel.tsx +25 -19
  182. package/src/ui/components/toast/toast.tsx +21 -16
  183. package/src/ui/components/toast/toastLayer.tsx +28 -10
  184. package/src/ui/components/toast/toastProvider.tsx +2 -6
  185. package/src/ui/components/toast/types.ts +2 -6
  186. package/src/ui/components/toast/useToast.ts +1 -3
  187. package/src/ui/components/tree/tree.tsx +194 -187
  188. package/src/ui/components/tree/treeGroup.tsx +25 -5
  189. package/src/ui/components/tree/treeItem.tsx +35 -23
  190. package/src/ui/hooks/useClickOutside.ts +2 -6
  191. package/src/ui/hooks/useClickOutsideEvent.ts +3 -9
  192. package/src/ui/index.ts +1 -0
  193. package/src/ui/primitives/_selectable/selectable.tsx +33 -20
  194. package/src/ui/primitives/avatar/avatar.tsx +28 -31
  195. package/src/ui/primitives/avatar/avatarCounter.tsx +33 -25
  196. package/src/ui/primitives/avatar/avatarStack.tsx +31 -24
  197. package/src/ui/primitives/avatar/types.ts +2 -0
  198. package/src/ui/primitives/badge/__workshop__/props.tsx +1 -9
  199. package/src/ui/primitives/badge/__workshop__/tones.tsx +1 -6
  200. package/src/ui/primitives/badge/badge.tsx +33 -32
  201. package/src/ui/primitives/badge/types.ts +2 -1
  202. package/src/ui/primitives/box/box.tsx +59 -29
  203. package/src/ui/primitives/button/__workshop__/sanityUploadButton.tsx +3 -3
  204. package/src/ui/primitives/button/__workshop__/uploadButton.tsx +2 -1
  205. package/src/ui/primitives/button/button.test.tsx +1 -15
  206. package/src/ui/primitives/button/button.tsx +63 -70
  207. package/src/ui/primitives/card/__workshop__/asComponent.tsx +3 -3
  208. package/src/ui/primitives/card/card.tsx +22 -22
  209. package/src/ui/primitives/card/cardProvider.tsx +2 -0
  210. package/src/ui/primitives/checkbox/checkbox.tsx +26 -15
  211. package/src/ui/primitives/code/code.tsx +24 -22
  212. package/src/ui/primitives/container/container.tsx +26 -15
  213. package/src/ui/primitives/flex/flex.tsx +21 -19
  214. package/src/ui/primitives/grid/grid.tsx +21 -16
  215. package/src/ui/primitives/heading/heading.tsx +42 -19
  216. package/src/ui/primitives/inline/inline.tsx +26 -23
  217. package/src/ui/primitives/kbd/kbd.tsx +25 -23
  218. package/src/ui/primitives/label/label.tsx +29 -26
  219. package/src/ui/primitives/popover/popover.tsx +293 -271
  220. package/src/ui/primitives/popover/popoverCard.tsx +122 -120
  221. package/src/ui/primitives/radio/radio.tsx +30 -14
  222. package/src/ui/primitives/select/select.tsx +24 -16
  223. package/src/ui/primitives/spinner/animatedSpinnerIcon.tsx +4 -2
  224. package/src/ui/primitives/spinner/spinner.tsx +24 -12
  225. package/src/ui/primitives/stack/stack.tsx +27 -18
  226. package/src/ui/primitives/switch/switch.tsx +31 -14
  227. package/src/ui/primitives/text/text.tsx +30 -24
  228. package/src/ui/primitives/textArea/textArea.tsx +33 -18
  229. package/src/ui/primitives/textInput/textInput.tsx +28 -40
  230. package/src/ui/primitives/tooltip/constants.ts +1 -1
  231. package/src/ui/primitives/tooltip/tooltip.tsx +85 -61
  232. package/src/ui/primitives/tooltip/tooltipCard.tsx +89 -82
  233. package/src/ui/primitives/types.ts +1 -3
  234. package/src/ui/types/avatar.ts +3 -6
  235. package/src/ui/types/badge.ts +1 -3
  236. package/src/ui/types/button.ts +1 -3
  237. package/src/ui/types/card.ts +1 -3
  238. package/src/ui/types/dialog.ts +1 -3
  239. package/src/ui/types/props.ts +20 -10
  240. package/src/ui/utils/arrow/arrow.tsx +43 -25
  241. package/src/ui/utils/boundaryElement/boundaryElementProvider.tsx +2 -6
  242. package/src/ui/utils/boundaryElement/types.ts +1 -3
  243. package/src/ui/utils/boundaryElement/useBoundaryElement.ts +1 -3
  244. package/src/ui/utils/elementQuery/elementQuery.tsx +43 -19
  245. package/src/ui/utils/errorBoundary.tsx +2 -0
  246. package/src/ui/utils/index.ts +0 -1
  247. package/src/ui/utils/layer/layer.tsx +23 -93
  248. package/src/ui/utils/layer/layerCard.tsx +92 -0
  249. package/src/ui/utils/layer/layerProvider.tsx +2 -6
  250. package/src/ui/utils/layer/useLayer.ts +1 -3
  251. package/src/ui/utils/portal/portal.ts +2 -6
  252. package/src/ui/utils/portal/portalProvider.tsx +2 -6
  253. package/src/ui/utils/portal/types.ts +1 -3
  254. package/src/ui/utils/portal/usePortal.ts +1 -3
  255. package/src/ui/utils/srOnly/srOnly.tsx +25 -20
  256. package/src/ui/utils/virtualList/virtualList.tsx +69 -50
  257. package/src/css/compile/compilePalette.ts +0 -27
  258. package/src/css/compile/compileRule.ts +0 -97
  259. package/src/css/compile/compileRules.test.ts +0 -36
  260. package/src/css/compile/compileRules.ts +0 -43
  261. package/src/css/compile/compileSystem.ts +0 -10
  262. package/src/css/compile/compileTheme_v3.ts +0 -401
  263. package/src/css/compile/types.ts +0 -6
  264. package/src/css/components/breadcrumbs/rules.ts +0 -25
  265. package/src/css/components/dialog/rules.ts +0 -78
  266. package/src/css/components/skeleton/rules.ts +0 -113
  267. package/src/css/components/toast/rules.ts +0 -18
  268. package/src/css/components/tree/rules.ts +0 -168
  269. package/src/css/primitives/_selectable/_contants.ts +0 -11
  270. package/src/css/primitives/card/_constants.ts +0 -13
  271. package/src/css/primitives/popover/rules.ts +0 -5
  272. package/src/css/primitives/spinner/rules.ts +0 -21
  273. package/src/css/primitives/token/rules.ts +0 -45
  274. package/src/ui/utils/conditionalWrapper/conditionalWrapper.tsx +0 -23
  275. package/src/ui/utils/conditionalWrapper/index.ts +0 -1
@@ -1,9 +1,11 @@
1
1
  import {_comp} from '../../_comp'
2
2
 
3
+ /** @public */
3
4
  export function popover(): string | undefined {
4
5
  return _comp('popover')
5
6
  }
6
7
 
8
+ /** @public */
7
9
  export function popoverCard(): string | undefined {
8
10
  return _comp('popover-card')
9
11
  }
@@ -1,5 +1,6 @@
1
1
  import {_comp} from '../../_comp'
2
2
 
3
+ /** @public */
3
4
  export function radio(): string | undefined {
4
5
  return _comp('radio')
5
6
  }
@@ -3,10 +3,12 @@ import {composeClassNames} from '../../composeClassNames'
3
3
  import {_input, _inputPresentation} from '../_input'
4
4
  import {SelectStyleProps} from './types'
5
5
 
6
+ /** @public */
6
7
  export function select(props: SelectStyleProps): string | undefined {
7
8
  return composeClassNames(_comp('select'), _input(props))
8
9
  }
9
10
 
11
+ /** @public */
10
12
  export function selectPresentation(): string | undefined {
11
13
  return composeClassNames(_comp('select-presentation'), _inputPresentation())
12
14
  }
@@ -1,9 +1,11 @@
1
1
  import {_comp} from '../../_comp'
2
2
 
3
+ /** @public */
3
4
  export function spinner(): string | undefined {
4
5
  return _comp('spinner')
5
6
  }
6
7
 
8
+ /** @public */
7
9
  export function animatedSpinnerIcon(): string | undefined {
8
10
  return _comp('animated-spinner-icon')
9
11
  }
@@ -1,21 +1,26 @@
1
1
  import {_comp} from '../../_comp'
2
2
 
3
+ /** @public */
3
4
  export function _switch(): string | undefined {
4
5
  return _comp('switch')
5
6
  }
6
7
 
8
+ /** @public */
7
9
  export function _switchElement(): string | undefined {
8
10
  return _comp('switch-element')
9
11
  }
10
12
 
13
+ /** @public */
11
14
  export function _switchPresentation(): string | undefined {
12
15
  return _comp('switch-presentation')
13
16
  }
14
17
 
18
+ /** @public */
15
19
  export function _switchThumb(): string | undefined {
16
20
  return _comp('switch-thumb')
17
21
  }
18
22
 
23
+ /** @public */
19
24
  export function _switchTrack(): string | undefined {
20
25
  return _comp('switch-track')
21
26
  }
@@ -1,10 +1,14 @@
1
1
  import {FlexItemStyleProps, FontStyleProps} from '../../aspects'
2
2
  import {ResponsiveProp} from '../../types'
3
3
 
4
+ /** @public */
4
5
  export type TextSize = number
5
6
 
6
7
  /** @public */
7
8
  export interface TextStyleProps extends FlexItemStyleProps, FontStyleProps {
9
+ /**
10
+ * @deprecated Will be removed in next major version
11
+ */
8
12
  accent?: boolean
9
13
  muted?: boolean
10
14
  size?: ResponsiveProp<TextSize>
@@ -3,6 +3,7 @@ import {composeClassNames} from '../../composeClassNames'
3
3
  import {_input} from '../_input'
4
4
  import {TextAreaStyleProps} from './types'
5
5
 
6
+ /** @public */
6
7
  export function textArea(props: TextAreaStyleProps): string | undefined {
7
8
  return composeClassNames(_comp('text-area'), _input(props))
8
9
  }
@@ -3,6 +3,7 @@ import {composeClassNames} from '../../composeClassNames'
3
3
  import {_input} from '../_input'
4
4
  import {TextInputStyleProps} from './types'
5
5
 
6
+ /** @public */
6
7
  export function textInput(props: TextInputStyleProps): string | undefined {
7
8
  return composeClassNames(_input(props), _comp('text-input'))
8
9
  }
@@ -1,47 +1,48 @@
1
1
  import {Style, StyleRules} from '../../types'
2
+ import {vars} from '../../vars'
2
3
 
3
4
  const primitive: StyleRules = {
4
5
  '.token': {
5
6
  '_prefix': false,
6
7
 
7
8
  '@nest': {
8
- '&.atrule': {color: 'var(--color-token-atrule)'},
9
- '&.attr-name': {color: 'var(--color-token-attr-name)'},
10
- '&.attr-value': {color: 'var(--color-token-attr-value)'},
11
- '&.attribute': {color: 'var(--color-token-attribute)'},
12
- '&.boolean': {color: 'var(--color-token-boolean)'},
13
- '&.builtin': {color: 'var(--color-token-builtin)'},
14
- '&.cdata': {color: 'var(--color-token-cdata)'},
15
- '&.char': {color: 'var(--color-token-char)'},
16
- '&.class': {color: 'var(--color-token-class)'},
17
- '&.class-name': {color: 'var(--color-token-class-name)'},
18
- '&.comment': {color: 'var(--color-token-comment)'},
19
- '&.constant': {color: 'var(--color-token-constant)'},
20
- '&.deleted': {color: 'var(--color-token-deleted)'},
21
- '&.doctype': {color: 'var(--color-token-doctype)'},
22
- '&.entity': {color: 'var(--color-token-entity)'},
23
- '&.function': {color: 'var(--color-token-function)'},
24
- '&.hexcode': {color: 'var(--color-token-hexcode)'},
25
- '&.id': {color: 'var(--color-token-id)'},
26
- '&.important': {color: 'var(--color-token-important)'},
27
- '&.inserted': {color: 'var(--color-token-inserted)'},
28
- '&.keyword': {color: 'var(--color-token-keyword)'},
29
- '&.number': {color: 'var(--color-token-number)'},
30
- '&.operator': {color: 'var(--color-token-operator)'},
31
- '&.prolog': {color: 'var(--color-token-prolog)'},
32
- '&.property': {color: 'var(--color-token-property)'},
33
- '&.pseudo-class': {color: 'var(--color-token-pseudo-class)'},
34
- '&.pseudo-element': {color: 'var(--color-token-pseudo-element)'},
35
- '&.punctuation': {color: 'var(--color-token-punctuation)'},
9
+ '&.atrule': {color: vars.color.code.token.atrule},
10
+ '&.attr-name': {color: vars.color.code.token.attrName},
11
+ '&.attr-value': {color: vars.color.code.token.attrValue},
12
+ '&.attribute': {color: vars.color.code.token.attribute},
13
+ '&.boolean': {color: vars.color.code.token.boolean},
14
+ '&.builtin': {color: vars.color.code.token.builtin},
15
+ '&.cdata': {color: vars.color.code.token.cdata},
16
+ '&.char': {color: vars.color.code.token.char},
17
+ '&.class': {color: vars.color.code.token.class},
18
+ '&.class-name': {color: vars.color.code.token.className},
19
+ '&.comment': {color: vars.color.code.token.comment},
20
+ '&.constant': {color: vars.color.code.token.constant},
21
+ '&.deleted': {color: vars.color.code.token.deleted},
22
+ '&.doctype': {color: vars.color.code.token.doctype},
23
+ '&.entity': {color: vars.color.code.token.entity},
24
+ '&.function': {color: vars.color.code.token.function},
25
+ '&.hexcode': {color: vars.color.code.token.hexcode},
26
+ '&.id': {color: vars.color.code.token.id},
27
+ '&.important': {color: vars.color.code.token.important},
28
+ '&.inserted': {color: vars.color.code.token.inserted},
29
+ '&.keyword': {color: vars.color.code.token.keyword},
30
+ '&.number': {color: vars.color.code.token.number},
31
+ '&.operator': {color: vars.color.code.token.operator},
32
+ '&.prolog': {color: vars.color.code.token.prolog},
33
+ '&.property': {color: vars.color.code.token.property},
34
+ '&.pseudo-class': {color: vars.color.code.token.pseudoClass},
35
+ '&.pseudo-element': {color: vars.color.code.token.pseudoElement},
36
+ '&.punctuation': {color: vars.color.code.token.punctuation},
36
37
  '&.attr-value &:not(.attr-equals).punctuation': {color: 'inherit'},
37
- '&.regex': {color: 'var(--color-token-regex)'},
38
- '&.selector': {color: 'var(--color-token-selector)'},
39
- '&.string': {color: 'var(--color-token-string)'},
40
- '&.symbol': {color: 'var(--color-token-symbol)'},
41
- '&.tag': {color: 'var(--color-token-tag)'},
42
- '&.unit': {color: 'var(--color-token-unit)'},
43
- '&.url': {color: 'var(--color-token-url)'},
44
- '&.variable': {color: 'var(--color-token-variable)'},
38
+ '&.regex': {color: vars.color.code.token.regex},
39
+ '&.selector': {color: vars.color.code.token.selector},
40
+ '&.string': {color: vars.color.code.token.string},
41
+ '&.symbol': {color: vars.color.code.token.symbol},
42
+ '&.tag': {color: vars.color.code.token.tag},
43
+ '&.unit': {color: vars.color.code.token.unit},
44
+ '&.url': {color: vars.color.code.token.url},
45
+ '&.variable': {color: vars.color.code.token.variable},
45
46
  },
46
47
  },
47
48
  }
@@ -1,9 +1,11 @@
1
1
  import {_comp} from '../../_comp'
2
2
 
3
+ /** @public */
3
4
  export function tooltip(): string | undefined {
4
5
  return _comp('tooltip')
5
6
  }
6
7
 
8
+ /** @public */
7
9
  export function tooltipCard(): string | undefined {
8
10
  return _comp('tooltip-card')
9
11
  }
@@ -1,25 +1,18 @@
1
+ import {BREAKPOINTS} from './constants'
1
2
  import {type Properties, type Rules} from './types'
2
3
 
3
4
  export function responsiveRules(className: string, props: Properties): Rules {
4
- return {
5
+ const rules: Rules = {
5
6
  [className]: props,
6
- [`_1:${className}`]: {
7
- '@media': {'screen and (min-width: 360px)': props},
8
- },
9
- [`_2:${className}`]: {
10
- '@media': {'screen and (min-width: 600px)': props},
11
- },
12
- [`_3:${className}`]: {
13
- '@media': {'screen and (min-width: 900px)': props},
14
- },
15
- [`_4:${className}`]: {
16
- '@media': {'screen and (min-width: 1200px)': props},
17
- },
18
- [`_5:${className}`]: {
19
- '@media': {'screen and (min-width: 1800px)': props},
20
- },
21
- [`_6:${className}`]: {
22
- '@media': {'screen and (min-width: 2400px)': props},
23
- },
24
7
  }
8
+
9
+ for (const [index, width] of Object.entries(BREAKPOINTS)) {
10
+ rules[`_${index}:${className}`] = {
11
+ '@media': {
12
+ [`screen and (min-width: ${width}px)`]: props,
13
+ },
14
+ }
15
+ }
16
+
17
+ return rules
25
18
  }
@@ -1,5 +1,6 @@
1
1
  import {PREFIX} from './constants'
2
2
 
3
+ /** @public */
3
4
  export function scopeClassName(className: string | undefined) {
4
5
  if (className === undefined) return undefined
5
6
  return `${PREFIX}${className.trim()}`
package/src/css/types.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import {ColorTintKey} from '@sanity/color'
1
2
  import {
2
3
  type AvatarSize,
3
4
  type ContainerWidth,
@@ -58,7 +59,7 @@ export type ThemeVarName =
58
59
  | `--card-border-width`
59
60
  | `--card-focus-ring-offset`
60
61
  | `--card-focus-ring-width`
61
- | `--shadow-outline`
62
+ | `--card-shadow-outline`
62
63
  | `--container-${ContainerWidth}`
63
64
  | `--font-code-family`
64
65
  | `--font-code-feature-settings`
@@ -127,8 +128,8 @@ export type ThemeVarName =
127
128
  | `--shadow-${Shadow}-penumbra`
128
129
  | `--shadow-${Shadow}-ambient`
129
130
 
131
+ /** @public */
130
132
  export type ColorCardVarName =
131
- | `--color-${Scheme}-${CardTone}-accent-fg`
132
133
  | `--color-${Scheme}-${CardTone}-avatar-${AvatarColor}-bg`
133
134
  | `--color-${Scheme}-${CardTone}-avatar-${AvatarColor}-fg`
134
135
  | `--color-${Scheme}-${CardTone}-backdrop`
@@ -182,8 +183,8 @@ export type ColorCardVarName =
182
183
  | `--color-${Scheme}-${CardTone}-skeleton-from`
183
184
  | `--color-${Scheme}-${CardTone}-skeleton-to`
184
185
 
186
+ /** @public */
185
187
  export type ColorCardToneScopedVarName =
186
- | `--color-${CardTone}-accent-fg`
187
188
  | `--color-${CardTone}-avatar-${AvatarColor}-bg`
188
189
  | `--color-${CardTone}-avatar-${AvatarColor}-fg`
189
190
  | `--color-${CardTone}-backdrop`
@@ -239,7 +240,6 @@ export type ColorCardToneScopedVarName =
239
240
 
240
241
  /** @public */
241
242
  export type CardScopedVarName =
242
- | `--color-accent-fg`
243
243
  | `--color-avatar-bg`
244
244
  | `--color-avatar-fg`
245
245
  | `--color-avatar-${AvatarColor}-bg`
@@ -325,12 +325,14 @@ export type CardScopedVarName =
325
325
  | `--padding-bottom`
326
326
  | `--padding-left`
327
327
 
328
+ /** @public */
328
329
  export type AvatarScopedVarName =
329
330
  | `--avatar-bg-color`
330
331
  | `--avatar-fg-color`
331
332
  | `--avatar-distance`
332
333
  | `--avatar-size`
333
334
 
335
+ /** @public */
334
336
  export type LegacyCardScopedVarName =
335
337
  // legacy
336
338
  | `--card-accent-fg-color`
@@ -370,6 +372,7 @@ export type LegacyCardScopedVarName =
370
372
  export type ElementColorVariantScopedVarName =
371
373
  `--color-${ElementColorVariant}-${ElementColorVariantKey}`
372
374
 
375
+ /** @public */
373
376
  export type ButtonScopedVarName = '--button-box-shadow'
374
377
 
375
378
  /** @public */
@@ -496,15 +499,13 @@ export interface ColorElementVarNames {
496
499
  }
497
500
  }
498
501
 
502
+ /** @public */
499
503
  export interface ColorVariantVarNames
500
504
  extends ColorElementVarNames,
501
505
  Record<ElementTone, ColorElementVarNames> {}
502
506
 
503
507
  /** @public */
504
508
  export interface ColorCardVarNames {
505
- accent: {
506
- fg: VarName
507
- }
508
509
  avatar: Record<AvatarColor, ColorAvatarColorVarNames>
509
510
  backdrop: VarName
510
511
  code: {
@@ -576,10 +577,8 @@ export interface ColorCardVarNames {
576
577
  /** @public */
577
578
  export type ColorSchemeVarNames = Record<CardTone, ColorCardVarNames>
578
579
 
580
+ /** @public */
579
581
  export interface ScopedColorVarNames extends Omit<ColorCardVarNames, 'avatar'> {
580
- accent: {
581
- fg: VarName
582
- }
583
582
  avatar: Record<AvatarColor, ColorAvatarColorVarNames> & ColorAvatarColorVarNames
584
583
  bg: VarName
585
584
  border: VarName
@@ -602,14 +601,30 @@ export interface FontSizeVarNames {
602
601
  iconSize: VarName
603
602
  }
604
603
 
604
+ /** @public */
605
605
  export interface FontVarNames<Size extends number> {
606
606
  family: VarName
607
+ featureSettings: VarName
607
608
  sizes: Record<Size, FontSizeVarNames>
608
- weight: Record<FontWeight, VarName>
609
+ weights: Record<FontWeight, VarName>
609
610
  }
610
611
 
611
612
  /** @public */
612
613
  export interface VarNames {
614
+ button: {
615
+ border: {
616
+ width: VarName
617
+ }
618
+ focusRing: {
619
+ offset: VarName
620
+ width: VarName
621
+ }
622
+ }
623
+ card: {
624
+ shadow: {
625
+ outline: VarName
626
+ }
627
+ }
613
628
  color: Record<Scheme, ColorSchemeVarNames> &
614
629
  ScopedColorVarNames &
615
630
  Record<CardTone, ColorCardVarNames>
@@ -630,17 +645,85 @@ export interface VarNames {
630
645
  text: FontVarNames<FontTextSize>
631
646
  }
632
647
  input: {
648
+ border: {
649
+ width: VarName
650
+ }
651
+
652
+ checkbox: {
653
+ focusRing: {
654
+ offset: VarName
655
+ width: VarName
656
+ }
657
+ size: VarName
658
+ }
659
+
660
+ radio: {
661
+ focusRing: {
662
+ offset: VarName
663
+ width: VarName
664
+ }
665
+ markSize: VarName
666
+ size: VarName
667
+ }
668
+
669
+ select: {
670
+ focusRing: {
671
+ offset: VarName
672
+ width: VarName
673
+ }
674
+ }
675
+
676
+ switch: {
677
+ focusRing: {
678
+ offset: VarName
679
+ width: VarName
680
+ }
681
+ height: VarName
682
+ padding: VarName
683
+
684
+ transitionDurationMs: VarName
685
+ transitionTimingFunction: VarName
686
+ width: VarName
687
+ }
688
+
689
+ text: {
690
+ focusRing: {
691
+ offset: VarName
692
+ width: VarName
693
+ }
694
+ }
695
+
633
696
  fontSize: VarName
634
697
  lineHeight: VarName
635
698
  letterSpacing: VarName
636
699
  ascenderHeight: VarName
637
700
  descenderHeight: VarName
638
- // capHeight: CSSVarName
639
701
  gap: VarName
640
702
  padding: VarName
641
703
  }
642
704
  radius: Record<Radius, VarName>
705
+ shadow: Record<
706
+ Shadow,
707
+ {
708
+ umbra: VarName
709
+ penumbra: VarName
710
+ ambient: VarName
711
+ }
712
+ >
643
713
  space: Record<Space, VarName>
714
+
715
+ // color
716
+ black: VarName
717
+ white: VarName
718
+ gray: Record<ColorTintKey, VarName>
719
+ blue: Record<ColorTintKey, VarName>
720
+ purple: Record<ColorTintKey, VarName>
721
+ magenta: Record<ColorTintKey, VarName>
722
+ red: Record<ColorTintKey, VarName>
723
+ orange: Record<ColorTintKey, VarName>
724
+ yellow: Record<ColorTintKey, VarName>
725
+ green: Record<ColorTintKey, VarName>
726
+ cyan: Record<ColorTintKey, VarName>
644
727
  }
645
728
 
646
729
  /** @public */
@@ -684,9 +767,6 @@ export interface ColorVariantVars extends Record<ElementTone, ColorElementVars>,
684
767
 
685
768
  /** @public */
686
769
  export interface ColorCardVars {
687
- accent: {
688
- fg: CSSVar
689
- }
690
770
  avatar: ColorAvatarVars
691
771
  backdrop: CSSVar
692
772
  code: {
@@ -779,6 +859,7 @@ export interface ColorAvatarColorVars {
779
859
  // eslint-disable-next-line @typescript-eslint/no-empty-object-type
780
860
  export interface ColorSchemeVars extends Record<CardTone, ColorCardVars> {}
781
861
 
862
+ /** @public */
782
863
  export interface ScopedColorVars extends Omit<ColorCardVars, 'avatar'> {
783
864
  avatar: ColorAvatarVars & ColorAvatarColorVars
784
865
  bg: CSSVar
@@ -817,6 +898,11 @@ export interface Vars {
817
898
  size: CSSVar
818
899
  sizes: Record<AvatarSize, {distance: CSSVar; size: CSSVar}>
819
900
  }
901
+ card: {
902
+ shadow: {
903
+ outline: CSSVar
904
+ }
905
+ }
820
906
  color: {
821
907
  dark: ColorSchemeVars
822
908
  light: ColorSchemeVars
@@ -848,5 +934,19 @@ export interface Vars {
848
934
  }
849
935
  }
850
936
  radius: Record<Radius, CSSVar>
937
+ shadow: Record<Shadow, {umbra: CSSVar; penumbra: CSSVar; ambient: CSSVar}>
851
938
  space: Record<Space, CSSVar>
939
+
940
+ // color
941
+ black: CSSVar
942
+ white: CSSVar
943
+ gray: Record<ColorTintKey, CSSVar>
944
+ blue: Record<ColorTintKey, CSSVar>
945
+ purple: Record<ColorTintKey, CSSVar>
946
+ magenta: Record<ColorTintKey, CSSVar>
947
+ red: Record<ColorTintKey, CSSVar>
948
+ orange: Record<ColorTintKey, CSSVar>
949
+ yellow: Record<ColorTintKey, CSSVar>
950
+ green: Record<ColorTintKey, CSSVar>
951
+ cyan: Record<ColorTintKey, CSSVar>
852
952
  }
package/src/css/util.ts CHANGED
@@ -1,25 +1,30 @@
1
1
  import {type ThemeBoxShadow} from '@sanity/ui/theme'
2
2
 
3
+ /** @internal */
3
4
  export function isRecord(value: unknown): value is Record<string, unknown> {
4
5
  return value !== null && typeof value === 'object' && !Array.isArray(value)
5
6
  }
6
7
 
8
+ /** @internal */
7
9
  export function isArray(value: unknown): value is unknown[] {
8
10
  return Array.isArray(value)
9
11
  }
10
12
 
13
+ /** @internal */
11
14
  export function rem(value: number): string {
12
15
  if (value === 0) return '0'
13
16
 
14
17
  return `${value / 16}rem`
15
18
  }
16
19
 
20
+ /** @internal */
17
21
  export function px(value: number): string {
18
22
  if (value === 0) return '0'
19
23
 
20
24
  return `${value}px`
21
25
  }
22
26
 
27
+ /** @internal */
23
28
  export function toBoxShadow(value: ThemeBoxShadow | undefined): string {
24
29
  if (!value) return 'none'
25
30
 
@@ -1,5 +1,6 @@
1
1
  import {composeClassNames} from '../../composeClassNames'
2
2
 
3
+ /** @public */
3
4
  export function srOnly(): string | undefined {
4
5
  return composeClassNames('sr-only')
5
6
  }