@sanity/ui 3.0.0-static.11 → 3.0.0-static.13

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 (251) hide show
  1. package/dist/_chunks-cjs/_visual-editing.js +1293 -1215
  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 +1284 -1202
  6. package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
  7. package/dist/_visual-editing.d.mts +528 -358
  8. package/dist/_visual-editing.d.ts +528 -358
  9. package/dist/cli.js +1 -1
  10. package/dist/css.d.mts +143 -73
  11. package/dist/css.d.ts +143 -73
  12. package/dist/css.js +329 -472
  13. package/dist/css.js.map +1 -1
  14. package/dist/css.mjs +330 -473
  15. package/dist/css.mjs.map +1 -1
  16. package/dist/index.d.mts +1362 -869
  17. package/dist/index.d.ts +1362 -869
  18. package/dist/index.js +383 -308
  19. package/dist/index.js.map +1 -1
  20. package/dist/index.mjs +387 -312
  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 -21946
  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 +9 -9
  31. package/dist/theme.js.map +1 -1
  32. package/dist/theme.mjs +9 -9
  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/{system.style.ts → _system.style.ts} +3 -2
  39. package/src/css/aspects/display/display.ts +1 -0
  40. package/src/css/aspects/display/types.ts +2 -3
  41. package/src/css/aspects/flex/types.ts +4 -12
  42. package/src/css/aspects/flexItem/types.ts +1 -3
  43. package/src/css/aspects/font/types.ts +1 -3
  44. package/src/css/aspects/grid/grid.ts +1 -0
  45. package/src/css/aspects/grid/types.ts +5 -9
  46. package/src/css/aspects/gridItem/gridItem.ts +1 -1
  47. package/src/css/aspects/gridItem/types.ts +7 -18
  48. package/src/css/aspects/height/height.ts +3 -4
  49. package/src/css/aspects/inset/inset.ts +1 -0
  50. package/src/css/aspects/margin/margin.ts +1 -0
  51. package/src/css/aspects/margin/types.ts +1 -0
  52. package/src/css/aspects/maxWidth/maxWidth.ts +1 -0
  53. package/src/css/aspects/maxWidth/types.ts +1 -0
  54. package/src/css/aspects/minWidth/minWidth.ts +1 -0
  55. package/src/css/aspects/minWidth/types.ts +2 -0
  56. package/src/css/aspects/overflow/overflow.ts +1 -0
  57. package/src/css/aspects/padding/padding.ts +1 -0
  58. package/src/css/aspects/pointerEvents/pointerEvents.ts +1 -0
  59. package/src/css/aspects/position/position.ts +1 -0
  60. package/src/css/aspects/shadow/shadow.ts +1 -0
  61. package/src/css/aspects/textOverflow/textOverflow.ts +1 -0
  62. package/src/css/aspects/textOverflow/types.ts +1 -0
  63. package/src/css/aspects/width/types.ts +2 -0
  64. package/src/css/aspects/width/width.ts +1 -0
  65. package/src/css/{compile/compilePalette.ts → compilePalette.ts} +14 -10
  66. package/src/css/compileSystem.ts +7 -0
  67. package/src/css/{compile/compileTheme.ts → compileTheme.ts} +1 -0
  68. package/src/css/{compile/compileTheme_v3.ts → compileTheme_v3.ts} +123 -104
  69. package/src/css/components/breadcrumbs/breadcrumbs.ts +1 -0
  70. package/src/css/components/dialog/dialog.ts +7 -0
  71. package/src/css/components/menu/menu.ts +2 -0
  72. package/src/css/components/skeleton/skeleton.ts +4 -0
  73. package/src/css/components/skeleton/types.ts +4 -0
  74. package/src/css/components/toast/toast.ts +5 -0
  75. package/src/css/components/tree/tree.ts +1 -0
  76. package/src/css/composeClassNames.ts +4 -2
  77. package/src/css/constants.ts +2 -0
  78. package/src/css/index.ts +3 -3
  79. package/src/css/primitives/_arrow/_arrow.ts +3 -0
  80. package/src/css/primitives/_input/input.ts +2 -0
  81. package/src/css/primitives/_selectable/_selectable.style.ts +1 -2
  82. package/src/css/primitives/_selectable/selectable.ts +1 -2
  83. package/src/css/primitives/avatar/avatar.style.ts +5 -8
  84. package/src/css/primitives/avatar/avatar.ts +6 -0
  85. package/src/css/primitives/avatar/types.ts +1 -0
  86. package/src/css/primitives/box/types.ts +1 -3
  87. package/src/css/primitives/button/button.ts +4 -21
  88. package/src/css/primitives/button/index.ts +1 -0
  89. package/src/css/primitives/button/types.ts +18 -0
  90. package/src/css/primitives/card/card.style.ts +3 -6
  91. package/src/css/primitives/card/card.ts +2 -2
  92. package/src/css/primitives/card/types.ts +2 -2
  93. package/src/css/primitives/checkbox/checkbox.ts +2 -0
  94. package/src/css/primitives/container/container.ts +1 -0
  95. package/src/css/primitives/container/types.ts +1 -0
  96. package/src/css/primitives/kbd/kbd.ts +1 -0
  97. package/src/css/primitives/label/types.ts +7 -2
  98. package/src/css/primitives/popover/popover.ts +2 -0
  99. package/src/css/primitives/radio/radio.ts +1 -0
  100. package/src/css/primitives/select/select.ts +2 -0
  101. package/src/css/primitives/spinner/spinner.ts +2 -0
  102. package/src/css/primitives/switch/switch.ts +5 -0
  103. package/src/css/primitives/text/types.ts +4 -0
  104. package/src/css/primitives/textArea/textArea.ts +1 -0
  105. package/src/css/primitives/textInput/textInput.ts +1 -0
  106. package/src/css/primitives/tooltip/tooltip.ts +2 -0
  107. package/src/css/scopeClassName.ts +1 -0
  108. package/src/css/types.ts +9 -12
  109. package/src/css/util.ts +5 -0
  110. package/src/css/utils/srOnly/srOnly.ts +3 -1
  111. package/src/css/varNames.ts +131 -141
  112. package/src/css/vars.ts +1 -6
  113. package/src/theme/palette/constants.ts +2 -0
  114. package/src/theme/palette/types.ts +3 -0
  115. package/src/theme/types.ts +2 -6
  116. package/src/theme/v0/focusRing.ts +1 -3
  117. package/src/theme/v0/font.ts +6 -18
  118. package/src/theme/v0/layer.ts +1 -3
  119. package/src/theme/v0/shadow.ts +2 -6
  120. package/src/theme/v2/avatar.ts +1 -3
  121. package/src/theme/v2/color/_system.ts +1 -3
  122. package/src/theme/v2/color/avatar.ts +2 -6
  123. package/src/theme/v2/color/badge.ts +2 -6
  124. package/src/theme/v2/color/button.ts +3 -9
  125. package/src/theme/v2/color/color.ts +3 -9
  126. package/src/theme/v2/color/input.ts +3 -9
  127. package/src/theme/v2/color/kbd.ts +1 -3
  128. package/src/theme/v2/color/selectable.ts +2 -6
  129. package/src/theme/v2/color/state.ts +1 -3
  130. package/src/theme/v2/color/syntax.ts +1 -3
  131. package/src/theme/v2/input.ts +1 -3
  132. package/src/theme/v2/theme.ts +2 -6
  133. package/src/theme/v3/buildTheme_v3.ts +1 -0
  134. package/src/theme/v3/color/color.ts +6 -4
  135. package/src/theme/v3/color/renderColor.ts +4 -1
  136. package/src/theme/v3/defaultTokens.ts +1 -0
  137. package/src/theme/v3/resolveTokens.ts +9 -9
  138. package/src/ui/RootClassNames.tsx +3 -0
  139. package/src/ui/StyleTags.tsx +3 -1
  140. package/src/ui/_compat/theme/themeColorProvider.tsx +2 -6
  141. package/src/ui/_compat/theme/themeProvider.tsx +2 -6
  142. package/src/ui/_compat/theme/types.ts +1 -3
  143. package/src/ui/_compat/theme/useRootTheme.ts +1 -3
  144. package/src/ui/_compat/theme/useTheme.ts +2 -6
  145. package/src/ui/components/autocomplete/__workshop__/constrainedHeight.tsx +2 -2
  146. package/src/ui/components/autocomplete/autocomplete.tsx +86 -114
  147. package/src/ui/components/autocomplete/autocompleteOption.tsx +2 -0
  148. package/src/ui/components/autocomplete/types.ts +3 -8
  149. package/src/ui/components/breadcrumbs/breadcrumbs.tsx +27 -21
  150. package/src/ui/components/dialog/dialog.tsx +89 -291
  151. package/src/ui/components/dialog/dialogCard.tsx +183 -0
  152. package/src/ui/components/dialog/isTargetWithinScope.ts +14 -0
  153. package/src/ui/components/hotkeys/hotkeys.tsx +33 -15
  154. package/src/ui/components/menu/__workshop__/asComponent.tsx +6 -6
  155. package/src/ui/components/menu/menu.tsx +27 -33
  156. package/src/ui/components/menu/menuButton.tsx +10 -14
  157. package/src/ui/components/menu/menuDivider.tsx +25 -13
  158. package/src/ui/components/menu/menuGroup.tsx +34 -26
  159. package/src/ui/components/menu/menuItem.tsx +51 -40
  160. package/src/ui/components/skeleton/codeSkeleton.tsx +53 -0
  161. package/src/ui/components/skeleton/headingSkeleton.tsx +52 -0
  162. package/src/ui/components/skeleton/index.ts +3 -0
  163. package/src/ui/components/skeleton/labelSkeleton.tsx +51 -0
  164. package/src/ui/components/skeleton/skeleton.tsx +39 -16
  165. package/src/ui/components/skeleton/textSkeleton.tsx +31 -110
  166. package/src/ui/components/tab/tab.tsx +23 -19
  167. package/src/ui/components/tab/tabList.tsx +34 -33
  168. package/src/ui/components/tab/tabPanel.tsx +25 -19
  169. package/src/ui/components/toast/toast.tsx +21 -16
  170. package/src/ui/components/toast/toastLayer.tsx +28 -10
  171. package/src/ui/components/toast/toastProvider.tsx +2 -6
  172. package/src/ui/components/toast/types.ts +2 -6
  173. package/src/ui/components/toast/useToast.ts +1 -3
  174. package/src/ui/components/tree/tree.tsx +194 -187
  175. package/src/ui/components/tree/treeGroup.tsx +25 -5
  176. package/src/ui/components/tree/treeItem.tsx +35 -23
  177. package/src/ui/hooks/useClickOutside.ts +2 -6
  178. package/src/ui/hooks/useClickOutsideEvent.ts +3 -9
  179. package/src/ui/primitives/_selectable/selectable.tsx +33 -20
  180. package/src/ui/primitives/avatar/avatar.tsx +28 -31
  181. package/src/ui/primitives/avatar/avatarCounter.tsx +33 -25
  182. package/src/ui/primitives/avatar/avatarStack.tsx +31 -24
  183. package/src/ui/primitives/avatar/types.ts +2 -0
  184. package/src/ui/primitives/badge/__workshop__/props.tsx +1 -9
  185. package/src/ui/primitives/badge/__workshop__/tones.tsx +1 -6
  186. package/src/ui/primitives/badge/badge.tsx +33 -32
  187. package/src/ui/primitives/badge/types.ts +2 -1
  188. package/src/ui/primitives/box/box.tsx +59 -29
  189. package/src/ui/primitives/button/__workshop__/sanityUploadButton.tsx +3 -3
  190. package/src/ui/primitives/button/__workshop__/uploadButton.tsx +2 -1
  191. package/src/ui/primitives/button/button.test.tsx +1 -15
  192. package/src/ui/primitives/button/button.tsx +64 -70
  193. package/src/ui/primitives/card/__workshop__/asComponent.tsx +3 -3
  194. package/src/ui/primitives/card/card.tsx +22 -22
  195. package/src/ui/primitives/card/cardProvider.tsx +2 -0
  196. package/src/ui/primitives/checkbox/checkbox.tsx +26 -15
  197. package/src/ui/primitives/code/code.tsx +24 -22
  198. package/src/ui/primitives/container/container.tsx +26 -15
  199. package/src/ui/primitives/flex/flex.tsx +21 -19
  200. package/src/ui/primitives/grid/grid.tsx +21 -16
  201. package/src/ui/primitives/heading/heading.tsx +42 -19
  202. package/src/ui/primitives/inline/inline.tsx +26 -23
  203. package/src/ui/primitives/kbd/kbd.tsx +25 -23
  204. package/src/ui/primitives/label/label.tsx +41 -26
  205. package/src/ui/primitives/popover/popover.tsx +281 -277
  206. package/src/ui/primitives/popover/popoverCard.tsx +119 -118
  207. package/src/ui/primitives/radio/radio.tsx +30 -14
  208. package/src/ui/primitives/select/select.tsx +24 -16
  209. package/src/ui/primitives/spinner/animatedSpinnerIcon.tsx +4 -2
  210. package/src/ui/primitives/spinner/spinner.tsx +24 -12
  211. package/src/ui/primitives/stack/stack.tsx +27 -18
  212. package/src/ui/primitives/switch/switch.tsx +31 -14
  213. package/src/ui/primitives/text/text.tsx +42 -24
  214. package/src/ui/primitives/textArea/textArea.tsx +33 -18
  215. package/src/ui/primitives/textInput/textInput.tsx +28 -40
  216. package/src/ui/primitives/tooltip/constants.ts +1 -1
  217. package/src/ui/primitives/tooltip/tooltip.tsx +76 -59
  218. package/src/ui/primitives/tooltip/tooltipCard.tsx +89 -82
  219. package/src/ui/primitives/types.ts +1 -3
  220. package/src/ui/types/avatar.ts +3 -6
  221. package/src/ui/types/badge.ts +1 -3
  222. package/src/ui/types/button.ts +1 -3
  223. package/src/ui/types/card.ts +1 -3
  224. package/src/ui/types/dialog.ts +1 -3
  225. package/src/ui/types/props.ts +20 -10
  226. package/src/ui/utils/arrow/arrow.tsx +40 -14
  227. package/src/ui/utils/boundaryElement/boundaryElementProvider.tsx +2 -6
  228. package/src/ui/utils/boundaryElement/types.ts +1 -3
  229. package/src/ui/utils/boundaryElement/useBoundaryElement.ts +1 -3
  230. package/src/ui/utils/elementQuery/elementQuery.tsx +36 -14
  231. package/src/ui/utils/errorBoundary.tsx +2 -0
  232. package/src/ui/utils/index.ts +0 -1
  233. package/src/ui/utils/layer/layer.tsx +23 -93
  234. package/src/ui/utils/layer/layerCard.tsx +92 -0
  235. package/src/ui/utils/layer/layerProvider.tsx +2 -6
  236. package/src/ui/utils/layer/useLayer.ts +1 -3
  237. package/src/ui/utils/portal/portal.ts +2 -6
  238. package/src/ui/utils/portal/portalProvider.tsx +2 -6
  239. package/src/ui/utils/portal/types.ts +1 -3
  240. package/src/ui/utils/portal/usePortal.ts +1 -3
  241. package/src/ui/utils/srOnly/srOnly.tsx +25 -20
  242. package/src/ui/utils/virtualList/virtualList.tsx +36 -24
  243. package/src/css/compile/compileRule.ts +0 -97
  244. package/src/css/compile/compileRules.test.ts +0 -36
  245. package/src/css/compile/compileRules.ts +0 -43
  246. package/src/css/compile/compileSystem.ts +0 -7
  247. package/src/css/compile/types.ts +0 -6
  248. package/src/css/primitives/_selectable/_contants.ts +0 -11
  249. package/src/css/primitives/card/_constants.ts +0 -13
  250. package/src/ui/utils/conditionalWrapper/conditionalWrapper.tsx +0 -23
  251. package/src/ui/utils/conditionalWrapper/index.ts +0 -1
@@ -2,6 +2,7 @@ import {AvatarSize, ThemeColorAvatarColorKey} from '@sanity/ui/theme'
2
2
 
3
3
  import {ResponsiveProp} from '../../types'
4
4
 
5
+ /** @public */
5
6
  export interface AvatarStyleProps {
6
7
  color: ThemeColorAvatarColorKey
7
8
  size: ResponsiveProp<AvatarSize>
@@ -20,9 +20,7 @@ import {
20
20
  } from '../../aspects'
21
21
  import {ResponsiveProp} from '../../types'
22
22
 
23
- /**
24
- * @public
25
- */
23
+ /** @public */
26
24
  export type BoxSizing = 'content' | 'border'
27
25
 
28
26
  /** @public */
@@ -1,27 +1,9 @@
1
- import {ThemeColorButtonModeKey, ThemeColorStateToneKey} from '@sanity/ui/theme'
2
-
3
1
  import {_comp} from '../../_comp'
4
- import {
5
- display,
6
- DisplayStyleProps,
7
- flexItem,
8
- FlexItemStyleProps,
9
- radius,
10
- RadiusStyleProps,
11
- width,
12
- WidthStyleProps,
13
- } from '../../aspects'
2
+ import {display, flexItem, radius, width} from '../../aspects'
14
3
  import {toneMap, variantMap} from './_constants'
4
+ import {ButtonStyleProps} from './types'
15
5
 
16
- export interface ButtonStyleProps
17
- extends DisplayStyleProps,
18
- FlexItemStyleProps,
19
- RadiusStyleProps,
20
- WidthStyleProps {
21
- mode?: ThemeColorButtonModeKey
22
- tone?: ThemeColorStateToneKey
23
- }
24
-
6
+ /** @public */
25
7
  export function button(props: ButtonStyleProps): string | undefined {
26
8
  const {mode, tone} = props
27
9
 
@@ -36,6 +18,7 @@ export function button(props: ButtonStyleProps): string | undefined {
36
18
  )
37
19
  }
38
20
 
21
+ /** @public */
39
22
  export function buttonLoadingBox(): string | undefined {
40
23
  return 'button-loading-box'
41
24
  }
@@ -1 +1,2 @@
1
1
  export * from './button'
2
+ export * from './types'
@@ -0,0 +1,18 @@
1
+ import {ThemeColorButtonModeKey, ThemeColorStateToneKey} from '@sanity/ui/theme'
2
+
3
+ import {
4
+ DisplayStyleProps,
5
+ FlexItemStyleProps,
6
+ RadiusStyleProps,
7
+ WidthStyleProps,
8
+ } from '../../aspects'
9
+
10
+ /** @public */
11
+ export interface ButtonStyleProps
12
+ extends DisplayStyleProps,
13
+ FlexItemStyleProps,
14
+ RadiusStyleProps,
15
+ WidthStyleProps {
16
+ mode?: ThemeColorButtonModeKey
17
+ tone?: ThemeColorStateToneKey
18
+ }
@@ -8,7 +8,6 @@ import {
8
8
  import {ColorCardVarNames, ColorCardVars, Properties, Style, StyleRules} from '../../types'
9
9
  import {varNames} from '../../varNames'
10
10
  import {vars} from '../../vars'
11
- import {toneMap} from './_constants'
12
11
 
13
12
  const primitive: StyleRules = {
14
13
  '.card': {
@@ -165,11 +164,13 @@ for (const tone of THEME_COLOR_CARD_TONES) {
165
164
  '--card-shadow-umbra-color': vars.color.shadow.umbra,
166
165
  '--card-shadow-penumbra-color': vars.color.shadow.penumbra,
167
166
  '--card-shadow-ambient-color': vars.color.shadow.ambient,
167
+
168
+ // todo
168
169
  // '--card-skeleton-from-color': 'var(--color-skeleton-from)',
169
170
  // '--card-skeleton-to-color': 'var(--color-skeleton-to)',
170
171
  })
171
172
 
172
- primitive[`.card.${toneMap[tone]}`] = toneProps
173
+ primitive[`.card.${tone}`] = toneProps
173
174
  }
174
175
 
175
176
  export const cardStyle: Style = {layers: {primitive}}
@@ -179,10 +180,6 @@ function _assignToneProps(
179
180
  _varNames: ColorCardVarNames,
180
181
  _vars: ColorCardVars,
181
182
  ) {
182
- Object.assign(toneProps, {
183
- [_varNames.accent.fg]: _vars.accent.fg,
184
- })
185
-
186
183
  for (const hue of THEME_COLOR_AVATAR_COLORS) {
187
184
  toneProps[`${_varNames.avatar[hue].bg}`] = _vars.avatar[hue].bg
188
185
  toneProps[`${_varNames.avatar[hue].fg}`] = _vars.avatar[hue].fg
@@ -1,12 +1,12 @@
1
1
  import {_comp} from '../../_comp'
2
2
  import {shadow} from '../../aspects'
3
- import {toneMap} from './_constants'
4
3
  import {CardStyleProps} from './types'
5
4
 
5
+ /** @public */
6
6
  export function card(props: CardStyleProps): string | undefined {
7
7
  return _comp(
8
8
  props.scheme,
9
- toneMap[props.tone ?? 'default'],
9
+ props.tone ?? 'default',
10
10
  'card',
11
11
  props.checkered && 'card-checkered',
12
12
  shadow(props),
@@ -1,9 +1,9 @@
1
1
  import {ThemeColorCardToneKey, ThemeColorSchemeKey} from '@sanity/ui/theme'
2
2
 
3
3
  import {ShadowStyleProps} from '../../aspects'
4
- import {BoxStyleProps} from '../box'
5
4
 
6
- export interface CardStyleProps extends BoxStyleProps, ShadowStyleProps {
5
+ /** @public */
6
+ export interface CardStyleProps extends ShadowStyleProps {
7
7
  checkered?: boolean
8
8
  scheme?: ThemeColorSchemeKey
9
9
  tone?: ThemeColorCardToneKey | 'inherit'
@@ -1,9 +1,11 @@
1
1
  import {_comp} from '../../_comp'
2
2
 
3
+ /** @public */
3
4
  export function checkbox(): string | undefined {
4
5
  return _comp('checkbox')
5
6
  }
6
7
 
8
+ /** @public */
7
9
  export function checkboxInput(): string | undefined {
8
10
  return _comp('checkbox-input')
9
11
  }
@@ -2,6 +2,7 @@ import {_comp} from '../../_comp'
2
2
  import {maxWidth} from '../../aspects'
3
3
  import {ContainerStyleProps} from './types'
4
4
 
5
+ /** @public */
5
6
  export function container(props: ContainerStyleProps): string | undefined {
6
7
  return _comp('container', maxWidth({maxWidth: props.width}))
7
8
  }
@@ -2,6 +2,7 @@ import {ContainerWidth} from '@sanity/ui/theme'
2
2
 
3
3
  import {ResponsiveProp} from '../../types'
4
4
 
5
+ /** @public */
5
6
  export interface ContainerStyleProps {
6
7
  width?: ResponsiveProp<ContainerWidth>
7
8
  }
@@ -2,6 +2,7 @@ import {_comp} from '../../_comp'
2
2
  import {radius} from '../../aspects'
3
3
  import {KBDStyleProps} from './types'
4
4
 
5
+ /** @public */
5
6
  export function kbd(props: KBDStyleProps): string | undefined {
6
7
  return _comp('kbd', radius(props))
7
8
  }
@@ -1,12 +1,17 @@
1
+ import {FontLabelSize} from '@sanity/ui/theme'
2
+
1
3
  import {FontStyleProps} from '../../aspects'
2
4
  import {ResponsiveProp} from '../../types'
3
5
 
4
- /** @public */
6
+ /**
7
+ * @public
8
+ * @deprecated Use `FontLabelSize` from `@sanity/ui/theme` instead
9
+ */
5
10
  export type LabelSize = number
6
11
 
7
12
  /** @public */
8
13
  export interface LabelStyleProps extends FontStyleProps {
9
14
  accent?: boolean
10
15
  muted?: boolean
11
- size?: ResponsiveProp<LabelSize>
16
+ size?: ResponsiveProp<FontLabelSize>
12
17
  }
@@ -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,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,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
@@ -128,8 +128,8 @@ export type ThemeVarName =
128
128
  | `--shadow-${Shadow}-penumbra`
129
129
  | `--shadow-${Shadow}-ambient`
130
130
 
131
+ /** @public */
131
132
  export type ColorCardVarName =
132
- | `--color-${Scheme}-${CardTone}-accent-fg`
133
133
  | `--color-${Scheme}-${CardTone}-avatar-${AvatarColor}-bg`
134
134
  | `--color-${Scheme}-${CardTone}-avatar-${AvatarColor}-fg`
135
135
  | `--color-${Scheme}-${CardTone}-backdrop`
@@ -183,8 +183,8 @@ export type ColorCardVarName =
183
183
  | `--color-${Scheme}-${CardTone}-skeleton-from`
184
184
  | `--color-${Scheme}-${CardTone}-skeleton-to`
185
185
 
186
+ /** @public */
186
187
  export type ColorCardToneScopedVarName =
187
- | `--color-${CardTone}-accent-fg`
188
188
  | `--color-${CardTone}-avatar-${AvatarColor}-bg`
189
189
  | `--color-${CardTone}-avatar-${AvatarColor}-fg`
190
190
  | `--color-${CardTone}-backdrop`
@@ -240,7 +240,6 @@ export type ColorCardToneScopedVarName =
240
240
 
241
241
  /** @public */
242
242
  export type CardScopedVarName =
243
- | `--color-accent-fg`
244
243
  | `--color-avatar-bg`
245
244
  | `--color-avatar-fg`
246
245
  | `--color-avatar-${AvatarColor}-bg`
@@ -326,12 +325,14 @@ export type CardScopedVarName =
326
325
  | `--padding-bottom`
327
326
  | `--padding-left`
328
327
 
328
+ /** @public */
329
329
  export type AvatarScopedVarName =
330
330
  | `--avatar-bg-color`
331
331
  | `--avatar-fg-color`
332
332
  | `--avatar-distance`
333
333
  | `--avatar-size`
334
334
 
335
+ /** @public */
335
336
  export type LegacyCardScopedVarName =
336
337
  // legacy
337
338
  | `--card-accent-fg-color`
@@ -371,6 +372,7 @@ export type LegacyCardScopedVarName =
371
372
  export type ElementColorVariantScopedVarName =
372
373
  `--color-${ElementColorVariant}-${ElementColorVariantKey}`
373
374
 
375
+ /** @public */
374
376
  export type ButtonScopedVarName = '--button-box-shadow'
375
377
 
376
378
  /** @public */
@@ -497,15 +499,13 @@ export interface ColorElementVarNames {
497
499
  }
498
500
  }
499
501
 
502
+ /** @public */
500
503
  export interface ColorVariantVarNames
501
504
  extends ColorElementVarNames,
502
505
  Record<ElementTone, ColorElementVarNames> {}
503
506
 
504
507
  /** @public */
505
508
  export interface ColorCardVarNames {
506
- accent: {
507
- fg: VarName
508
- }
509
509
  avatar: Record<AvatarColor, ColorAvatarColorVarNames>
510
510
  backdrop: VarName
511
511
  code: {
@@ -577,10 +577,8 @@ export interface ColorCardVarNames {
577
577
  /** @public */
578
578
  export type ColorSchemeVarNames = Record<CardTone, ColorCardVarNames>
579
579
 
580
+ /** @public */
580
581
  export interface ScopedColorVarNames extends Omit<ColorCardVarNames, 'avatar'> {
581
- accent: {
582
- fg: VarName
583
- }
584
582
  avatar: Record<AvatarColor, ColorAvatarColorVarNames> & ColorAvatarColorVarNames
585
583
  bg: VarName
586
584
  border: VarName
@@ -603,6 +601,7 @@ export interface FontSizeVarNames {
603
601
  iconSize: VarName
604
602
  }
605
603
 
604
+ /** @public */
606
605
  export interface FontVarNames<Size extends number> {
607
606
  family: VarName
608
607
  featureSettings: VarName
@@ -768,9 +767,6 @@ export interface ColorVariantVars extends Record<ElementTone, ColorElementVars>,
768
767
 
769
768
  /** @public */
770
769
  export interface ColorCardVars {
771
- accent: {
772
- fg: CSSVar
773
- }
774
770
  avatar: ColorAvatarVars
775
771
  backdrop: CSSVar
776
772
  code: {
@@ -863,6 +859,7 @@ export interface ColorAvatarColorVars {
863
859
  // eslint-disable-next-line @typescript-eslint/no-empty-object-type
864
860
  export interface ColorSchemeVars extends Record<CardTone, ColorCardVars> {}
865
861
 
862
+ /** @public */
866
863
  export interface ScopedColorVars extends Omit<ColorCardVars, 'avatar'> {
867
864
  avatar: ColorAvatarVars & ColorAvatarColorVars
868
865
  bg: CSSVar
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,7 @@
1
+ import {_comp} from '../../_comp'
1
2
  import {composeClassNames} from '../../composeClassNames'
2
3
 
4
+ /** @public */
3
5
  export function srOnly(): string | undefined {
4
- return composeClassNames('sr-only')
6
+ return _comp(composeClassNames('sr-only'))
5
7
  }