@sanity/ui 2.0.12 → 2.0.13-alpha.1

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 (66) hide show
  1. package/dist/_chunks-cjs/getScopedTheme.js +547 -0
  2. package/dist/_chunks-cjs/getScopedTheme.js.map +1 -0
  3. package/dist/_chunks-es/getScopedTheme.mjs +548 -0
  4. package/dist/_chunks-es/getScopedTheme.mjs.map +1 -0
  5. package/dist/_legacy/getScopedTheme.esm.js +548 -0
  6. package/dist/_legacy/getScopedTheme.esm.js.map +1 -0
  7. package/dist/index.d.mts +2 -2
  8. package/dist/index.d.ts +2 -2
  9. package/dist/index.esm.js +73 -73
  10. package/dist/index.esm.js.map +1 -1
  11. package/dist/index.js +78 -78
  12. package/dist/index.js.map +1 -1
  13. package/dist/index.mjs +73 -73
  14. package/dist/index.mjs.map +1 -1
  15. package/dist/theme.d.mts +1 -1
  16. package/dist/theme.d.ts +1 -1
  17. package/dist/theme.esm.js +51 -587
  18. package/dist/theme.esm.js.map +1 -1
  19. package/dist/theme.js +22 -560
  20. package/dist/theme.js.map +1 -1
  21. package/dist/theme.mjs +51 -587
  22. package/dist/theme.mjs.map +1 -1
  23. package/package.json +1 -1
  24. package/src/core/components/dialog/styles.ts +3 -3
  25. package/src/core/components/skeleton/textSkeleton.tsx +2 -2
  26. package/src/core/components/tree/style.ts +2 -3
  27. package/src/core/hooks/useMediaIndex/useMediaIndex.test.tsx +1 -1
  28. package/src/core/primitives/_selectable/style.ts +1 -2
  29. package/src/core/primitives/avatar/avatarCounter.tsx +2 -3
  30. package/src/core/primitives/avatar/avatarStack.tsx +1 -2
  31. package/src/core/primitives/avatar/styles.ts +3 -3
  32. package/src/core/primitives/button/styles.ts +3 -3
  33. package/src/core/primitives/card/__workshop__/selected.tsx +2 -2
  34. package/src/core/primitives/card/styles.ts +2 -3
  35. package/src/core/primitives/checkbox/styles.ts +1 -2
  36. package/src/core/primitives/code/styles.ts +1 -4
  37. package/src/core/primitives/container/styles.ts +2 -2
  38. package/src/core/primitives/heading/styles.ts +1 -2
  39. package/src/core/primitives/inline/styles.ts +2 -2
  40. package/src/core/primitives/label/styles.ts +1 -2
  41. package/src/core/primitives/radio/styles.ts +1 -2
  42. package/src/core/primitives/select/styles.ts +5 -5
  43. package/src/core/primitives/stack/styles.ts +2 -2
  44. package/src/core/primitives/switch/styles.ts +3 -4
  45. package/src/core/primitives/text/__workshop__/colored.tsx +2 -2
  46. package/src/core/primitives/text/styles.ts +1 -2
  47. package/src/core/styles/border/borderStyle.ts +6 -6
  48. package/src/core/styles/box/boxStyle.ts +5 -5
  49. package/src/core/styles/flex/flexItemStyle.ts +2 -2
  50. package/src/core/styles/flex/flexStyle.ts +6 -6
  51. package/src/core/styles/font/responsiveFont.ts +2 -2
  52. package/src/core/styles/font/textAlignStyle.ts +2 -2
  53. package/src/core/styles/grid/gridItemStyle.ts +7 -7
  54. package/src/core/styles/grid/gridStyle.ts +9 -9
  55. package/src/core/styles/helpers.ts +2 -2
  56. package/src/core/styles/input/responsiveInputPaddingStyle.ts +2 -2
  57. package/src/core/styles/input/textInputStyle.ts +4 -4
  58. package/src/core/styles/margin/marginsStyle.test.ts +1 -1
  59. package/src/core/styles/padding/paddingStyle.test.ts +1 -1
  60. package/src/core/styles/radius/radiusStyle.ts +2 -2
  61. package/src/core/styles/shadow/shadowStyle.ts +2 -2
  62. package/src/core/theme/__workshop__/build/Root.tsx +1 -2
  63. package/src/core/theme/theme.test.tsx +1 -1
  64. package/src/core/theme/themeProvider.tsx +6 -7
  65. package/src/core/theme/useTheme.ts +2 -1
  66. package/src/theme/system/theme.ts +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/ui",
3
- "version": "2.0.12",
3
+ "version": "2.0.13-alpha.1",
4
4
  "keywords": [
5
5
  "sanity",
6
6
  "ui",
@@ -1,4 +1,4 @@
1
- import {CSSObject, getTheme_v2} from '@sanity/ui/theme'
1
+ import {CSSObject} from '@sanity/ui/theme'
2
2
  import {css} from 'styled-components'
3
3
  import {_responsive, ThemeProps} from '../../styles'
4
4
  import {DialogPosition} from '../../types'
@@ -11,7 +11,7 @@ export interface ResponsiveDialogPositionStyleProps {
11
11
  }
12
12
 
13
13
  export function dialogStyle({theme}: ThemeProps): CSSObject {
14
- const {color} = getTheme_v2(theme)
14
+ const {color} = theme.sanity.v2
15
15
 
16
16
  return {
17
17
  '&:not([hidden])': {
@@ -32,7 +32,7 @@ export function dialogStyle({theme}: ThemeProps): CSSObject {
32
32
  export function responsiveDialogPositionStyle(
33
33
  props: ResponsiveDialogPositionStyleProps & ThemeProps,
34
34
  ): CSSObject[] {
35
- const {media} = getTheme_v2(props.theme)
35
+ const {media} = props.theme.sanity.v2
36
36
 
37
37
  return _responsive(media, props.$position, (position) => ({'&&': {position}}))
38
38
  }
@@ -1,4 +1,4 @@
1
- import {ThemeFontKey, getTheme_v2} from '@sanity/ui/theme'
1
+ import {ThemeFontKey} from '@sanity/ui/theme'
2
2
  import {forwardRef} from 'react'
3
3
  import {styled} from 'styled-components'
4
4
  import {useArrayProp} from '../../hooks'
@@ -12,7 +12,7 @@ const Root = styled(Skeleton)<{$size: number[]; $style: ThemeFontKey}>((
12
12
  } & ThemeProps,
13
13
  ) => {
14
14
  const {$size, $style} = props
15
- const {font, media} = getTheme_v2(props.theme)
15
+ const {font, media} = props.theme.sanity.v2
16
16
  const fontStyle = font[$style]
17
17
 
18
18
  const styles = _responsive(media, $size, (sizeIndex) => {
@@ -1,4 +1,3 @@
1
- import {getTheme_v2} from '@sanity/ui/theme'
2
1
  import {css} from 'styled-components'
3
2
  import {rem, ThemeProps} from '../../styles'
4
3
  import {_cardColorStyle} from '../../styles/card'
@@ -38,7 +37,7 @@ export function treeItemRootStyle(): ReturnType<typeof css> {
38
37
 
39
38
  export function treeItemRootColorStyle(props: ThemeProps): ReturnType<typeof css> {
40
39
  const $tone = 'default'
41
- const {color} = getTheme_v2(props.theme)
40
+ const {color} = props.theme.sanity.v2
42
41
  const tone = color.selectable[$tone]
43
42
 
44
43
  return css`
@@ -92,7 +91,7 @@ export function treeItemBoxStyle(
92
91
  props: TreeItemBoxStyleProps & ThemeProps,
93
92
  ): ReturnType<typeof css> {
94
93
  const {$level} = props
95
- const {space} = getTheme_v2(props.theme)
94
+ const {space} = props.theme.sanity.v2
96
95
 
97
96
  return css`
98
97
  padding-left: ${rem(space[2] * $level)};
@@ -1,7 +1,7 @@
1
1
  /** @jest-environment node */
2
2
 
3
- import {buildTheme} from '@sanity/ui/theme'
4
3
  import {renderToString, renderToStaticMarkup} from 'react-dom/server'
4
+ import {buildTheme} from '../../../theme'
5
5
  import {ThemeProvider} from '../../theme'
6
6
  import {useMediaIndex} from './useMediaIndex'
7
7
 
@@ -1,4 +1,3 @@
1
- import {getTheme_v2} from '@sanity/ui/theme'
2
1
  import {css} from 'styled-components'
3
2
  import {ThemeProps} from '../../styles'
4
3
  import {_cardColorStyle} from '../../styles/card'
@@ -39,7 +38,7 @@ export function selectableColorStyle(
39
38
  props: SelectableStyleProps & ThemeProps,
40
39
  ): ReturnType<typeof css> {
41
40
  const {$tone} = props
42
- const {color, style} = getTheme_v2(props.theme)
41
+ const {color, style} = props.theme.sanity.v2
43
42
  const tone = color.selectable[$tone]
44
43
 
45
44
  return css`
@@ -1,4 +1,3 @@
1
- import {getTheme_v2} from '@sanity/ui/theme'
2
1
  import {forwardRef, useMemo} from 'react'
3
2
  import {styled, css} from 'styled-components'
4
3
  import {EMPTY_RECORD} from '../../constants'
@@ -8,7 +7,7 @@ import {AvatarSize} from '../../types'
8
7
  import {Label} from '../label'
9
8
 
10
9
  function _responsiveAvatarCounterSizeStyle(props: {$size: AvatarSize[]} & ThemeProps) {
11
- const {avatar, media} = getTheme_v2(props.theme)
10
+ const {avatar, media} = props.theme.sanity.v2
12
11
 
13
12
  return _responsive(media, props.$size, (size) => {
14
13
  const avatarSize = avatar.sizes[size]
@@ -24,7 +23,7 @@ function _responsiveAvatarCounterSizeStyle(props: {$size: AvatarSize[]} & ThemeP
24
23
  }
25
24
 
26
25
  function _avatarCounterBaseStyle(props: ThemeProps) {
27
- const {space} = getTheme_v2(props.theme)
26
+ const {space} = props.theme.sanity.v2
28
27
 
29
28
  return css`
30
29
  align-items: center;
@@ -1,4 +1,3 @@
1
- import {getTheme_v2} from '@sanity/ui/theme'
2
1
  import {cloneElement, forwardRef} from 'react'
3
2
  import {styled, css} from 'styled-components'
4
3
  import {EMPTY_RECORD} from '../../constants'
@@ -25,7 +24,7 @@ function avatarStackStyle() {
25
24
  }
26
25
 
27
26
  function responsiveAvatarStackSizeStyle(props: {$size: AvatarSize[]} & ThemeProps) {
28
- const {avatar, media} = getTheme_v2(props.theme)
27
+ const {avatar, media} = props.theme.sanity.v2
29
28
 
30
29
  return _responsive(media, props.$size, (size) => {
31
30
  const avatarSize = avatar.sizes[size]
@@ -1,4 +1,4 @@
1
- import {CSSObject, getTheme_v2} from '@sanity/ui/theme'
1
+ import {CSSObject} from '@sanity/ui/theme'
2
2
  import {rem, _responsive, ThemeProps} from '../../styles'
3
3
  import {focusRingStyle} from '../../styles/internal'
4
4
  import {AvatarRootStyleProps, ResponsiveAvatarSizeStyleProps} from './types'
@@ -57,7 +57,7 @@ function avatarArrowStyle(): CSSObject {
57
57
 
58
58
  export function avatarRootStyle(props: AvatarRootStyleProps & ThemeProps): CSSObject {
59
59
  const {$color} = props
60
- const {avatar} = getTheme_v2(props.theme)
60
+ const {avatar} = props.theme.sanity.v2
61
61
 
62
62
  return {
63
63
  '--avatar-bg-color': `var(--card-avatar-${$color}-bg-color)`,
@@ -104,7 +104,7 @@ export function avatarRootStyle(props: AvatarRootStyleProps & ThemeProps): CSSOb
104
104
  export function responsiveAvatarSizeStyle(
105
105
  props: ResponsiveAvatarSizeStyleProps & ThemeProps,
106
106
  ): CSSObject[] {
107
- const {avatar, media} = getTheme_v2(props.theme)
107
+ const {avatar, media} = props.theme.sanity.v2
108
108
 
109
109
  return _responsive(media, props.$size, (size) => {
110
110
  const avatarSize = avatar.sizes[size] || avatar.sizes[0]
@@ -1,4 +1,4 @@
1
- import {CSSObject, getTheme_v2} from '@sanity/ui/theme'
1
+ import {CSSObject} from '@sanity/ui/theme'
2
2
  import {css} from 'styled-components'
3
3
  import {ThemeProps} from '../../styles'
4
4
  import {_cardColorStyle} from '../../styles/card'
@@ -12,7 +12,7 @@ export function buttonBaseStyles(
12
12
  props: {$width?: ButtonWidth} & ThemeProps,
13
13
  ): ReturnType<typeof css> {
14
14
  const {$width} = props
15
- const {style} = getTheme_v2(props.theme)
15
+ const {style} = props.theme.sanity.v2
16
16
 
17
17
  return css`
18
18
  ${style?.button};
@@ -67,7 +67,7 @@ export function buttonColorStyles(
67
67
  props: {$mode: ButtonMode; $tone: ButtonTone} & ThemeProps,
68
68
  ): CSSObject[] {
69
69
  const {$mode} = props
70
- const {button, color: baseColor, style} = getTheme_v2(props.theme)
70
+ const {button, color: baseColor, style} = props.theme.sanity.v2
71
71
  const shadow = props.$mode === 'ghost'
72
72
  const mode = baseColor.button[$mode] || baseColor.button.default
73
73
  const color = mode[props.$tone] || mode.default
@@ -1,6 +1,6 @@
1
1
  import {EditIcon, PublishIcon} from '@sanity/icons'
2
2
  import {Box, Card, Container, Flex, Inline, Stack, Text, ThemeProps, useRootTheme} from '@sanity/ui'
3
- import {ThemeColorStateToneKey, getTheme_v2} from '@sanity/ui/theme'
3
+ import {ThemeColorStateToneKey} from '@sanity/ui/theme'
4
4
  import {useBoolean} from '@sanity/ui-workshop'
5
5
  import {styled, css} from 'styled-components'
6
6
 
@@ -10,7 +10,7 @@ const TextWithTone = styled(Text)<{$tone: ThemeColorStateToneKey}>((
10
10
  } & ThemeProps,
11
11
  ) => {
12
12
  const {$tone} = props
13
- const {color} = getTheme_v2(props.theme)
13
+ const {color} = props.theme.sanity.v2
14
14
  const tone = color.button.default[$tone]
15
15
 
16
16
  return css`
@@ -1,4 +1,3 @@
1
- import {getTheme_v2} from '@sanity/ui/theme'
2
1
  import {css} from 'styled-components'
3
2
  import {ThemeProps} from '../../styles'
4
3
  import {_cardColorStyle} from '../../styles/card'
@@ -13,7 +12,7 @@ export function cardStyle(
13
12
 
14
13
  export function cardBaseStyle(props: CardStyleProps & ThemeProps): ReturnType<typeof css> {
15
14
  const {$checkered} = props
16
- const {space} = getTheme_v2(props.theme)
15
+ const {space} = props.theme.sanity.v2
17
16
 
18
17
  return css`
19
18
  ${$checkered &&
@@ -50,7 +49,7 @@ export function cardBaseStyle(props: CardStyleProps & ThemeProps): ReturnType<ty
50
49
 
51
50
  export function cardColorStyle(props: CardStyleProps & ThemeProps): ReturnType<typeof css> {
52
51
  const {$checkered, $focusRing} = props
53
- const {card, color, style} = getTheme_v2(props.theme)
52
+ const {card, color, style} = props.theme.sanity.v2
54
53
  const border = {width: card.border.width, color: 'var(--card-border-color)'}
55
54
 
56
55
  return css`
@@ -1,4 +1,3 @@
1
- import {getTheme_v2} from '@sanity/ui/theme'
2
1
  import {css} from 'styled-components'
3
2
  import {rem, ThemeProps} from '../../styles'
4
3
  import {focusRingBorderStyle, focusRingStyle} from '../../styles/internal'
@@ -11,7 +10,7 @@ export function checkboxBaseStyles(): ReturnType<typeof css> {
11
10
  }
12
11
 
13
12
  export function inputElementStyles(props: ThemeProps): ReturnType<typeof css> {
14
- const {color, input, radius} = getTheme_v2(props.theme)
13
+ const {color, input, radius} = props.theme.sanity.v2
15
14
  const {focusRing} = input.checkbox
16
15
 
17
16
  return css`
@@ -1,10 +1,7 @@
1
- import {getTheme_v2} from '@sanity/ui/theme'
2
1
  import {css, ExecutionContext} from 'styled-components'
3
2
 
4
3
  function codeSyntaxHighlightingStyle({theme}: ExecutionContext) {
5
- const {
6
- color: {syntax: color},
7
- } = getTheme_v2(theme)
4
+ const color = theme.sanity.v2.color.syntax
8
5
 
9
6
  return {
10
7
  '&.atrule': {color: color.atrule},
@@ -1,4 +1,4 @@
1
- import {CSSObject, getTheme_v2} from '@sanity/ui/theme'
1
+ import {CSSObject} from '@sanity/ui/theme'
2
2
  import {rem, _responsive, ThemeProps} from '../../styles'
3
3
  import {ResponsiveWidthStyleProps} from './types'
4
4
 
@@ -14,7 +14,7 @@ export function containerBaseStyle(): CSSObject {
14
14
  export function responsiveContainerWidthStyle(
15
15
  props: ResponsiveWidthStyleProps & ThemeProps,
16
16
  ): CSSObject[] {
17
- const {container, media} = getTheme_v2(props.theme)
17
+ const {container, media} = props.theme.sanity.v2
18
18
 
19
19
  return _responsive(media, props.$width, (val) => ({
20
20
  maxWidth: val === 'auto' ? 'none' : rem(container[val]),
@@ -1,11 +1,10 @@
1
- import {getTheme_v2} from '@sanity/ui/theme'
2
1
  import {css} from 'styled-components'
3
2
  import {ThemeProps} from '../../styles'
4
3
  import {HeadingStyleProps} from './types'
5
4
 
6
5
  export function headingBaseStyle(props: HeadingStyleProps & ThemeProps): ReturnType<typeof css> {
7
6
  const {$accent, $muted} = props
8
- const {font} = getTheme_v2(props.theme)
7
+ const {font} = props.theme.sanity.v2
9
8
 
10
9
  return css`
11
10
  ${$accent &&
@@ -1,4 +1,4 @@
1
- import {CSSObject, getTheme_v2} from '@sanity/ui/theme'
1
+ import {CSSObject} from '@sanity/ui/theme'
2
2
  import {rem, _responsive, ThemeProps} from '../../styles'
3
3
  import {ResponsiveInlineSpaceStyleProps} from './types'
4
4
 
@@ -18,7 +18,7 @@ export function inlineBaseStyle(): CSSObject {
18
18
  }
19
19
 
20
20
  export function inlineSpaceStyle(props: ResponsiveInlineSpaceStyleProps & ThemeProps): CSSObject[] {
21
- const {media, space} = getTheme_v2(props.theme)
21
+ const {media, space} = props.theme.sanity.v2
22
22
 
23
23
  return _responsive(media, props.$space, (spaceIndex) => {
24
24
  const _space = rem(spaceIndex === 0.5 ? space[1] / 2 : space[spaceIndex])
@@ -1,4 +1,3 @@
1
- import {getTheme_v2} from '@sanity/ui/theme'
2
1
  import {css} from 'styled-components'
3
2
  import {ThemeProps} from '../../styles'
4
3
 
@@ -6,7 +5,7 @@ export function labelBaseStyle(
6
5
  props: {$accent?: boolean; $muted: boolean} & ThemeProps,
7
6
  ): ReturnType<typeof css> {
8
7
  const {$accent, $muted} = props
9
- const {font} = getTheme_v2(props.theme)
8
+ const {font} = props.theme.sanity.v2
10
9
 
11
10
  return css`
12
11
  text-transform: uppercase;
@@ -1,4 +1,3 @@
1
- import {getTheme_v2} from '@sanity/ui/theme'
2
1
  import {css} from 'styled-components'
3
2
  import {rem, ThemeProps} from '../../styles'
4
3
  import {focusRingBorderStyle, focusRingStyle} from '../../styles/internal'
@@ -18,7 +17,7 @@ export function radioBaseStyle(): ReturnType<typeof css> {
18
17
  }
19
18
 
20
19
  export function inputElementStyle(props: ThemeProps): ReturnType<typeof css> {
21
- const {color, input} = getTheme_v2(props.theme)
20
+ const {color, input} = props.theme.sanity.v2
22
21
  const dist = (input.radio.size - input.radio.markSize) / 2
23
22
 
24
23
  return css`
@@ -1,4 +1,4 @@
1
- import {ThemeFontSize, getTheme_v2} from '@sanity/ui/theme'
1
+ import {ThemeFontSize} from '@sanity/ui/theme'
2
2
  import {CSSObject} from '@sanity/ui/theme'
3
3
  import {css} from 'styled-components'
4
4
  import {rem, _responsive, ThemeProps} from '../../styles'
@@ -24,7 +24,7 @@ function rootStyle(): ReturnType<typeof css> {
24
24
  }
25
25
 
26
26
  function inputBaseStyle(props: ThemeProps): ReturnType<typeof css> {
27
- const {font} = getTheme_v2(props.theme)
27
+ const {font} = props.theme.sanity.v2
28
28
 
29
29
  return css`
30
30
  -webkit-font-smoothing: antialiased;
@@ -43,7 +43,7 @@ function inputBaseStyle(props: ThemeProps): ReturnType<typeof css> {
43
43
  }
44
44
 
45
45
  function inputColorStyle(props: ThemeProps) {
46
- const {color, input} = getTheme_v2(props.theme)
46
+ const {color, input} = props.theme.sanity.v2
47
47
 
48
48
  return css`
49
49
  /* enabled */
@@ -102,7 +102,7 @@ function textSize(size: ThemeFontSize) {
102
102
 
103
103
  function inputTextSizeStyle(props: {$fontSize: number[]} & ThemeProps) {
104
104
  const {$fontSize} = props
105
- const {font, media} = getTheme_v2(props.theme)
105
+ const {font, media} = props.theme.sanity.v2
106
106
 
107
107
  return _responsive(media, $fontSize, (sizeIndex) =>
108
108
  textSize(font.text.sizes[sizeIndex] || font.text.sizes[2]),
@@ -129,7 +129,7 @@ function inputStyle(): Array<
129
129
  }
130
130
 
131
131
  function iconBoxStyle(props: ThemeProps): ReturnType<typeof css> {
132
- const {color} = getTheme_v2(props.theme)
132
+ const {color} = props.theme.sanity.v2
133
133
 
134
134
  return css`
135
135
  pointer-events: none;
@@ -1,4 +1,4 @@
1
- import {CSSObject, getTheme_v2} from '@sanity/ui/theme'
1
+ import {CSSObject} from '@sanity/ui/theme'
2
2
  import {rem, _responsive, ThemeProps} from '../../styles'
3
3
 
4
4
  export interface ResponsiveStackSpaceStyleProps {
@@ -23,7 +23,7 @@ export function stackBaseStyle(): CSSObject {
23
23
  export function responsiveStackSpaceStyle(
24
24
  props: ResponsiveStackSpaceStyleProps & ThemeProps,
25
25
  ): CSSObject[] {
26
- const {media, space} = getTheme_v2(props.theme)
26
+ const {media, space} = props.theme.sanity.v2
27
27
 
28
28
  return _responsive(media, props.$space, (spaceIndex) => ({
29
29
  gridGap: rem(space[spaceIndex]),
@@ -1,4 +1,3 @@
1
- import {getTheme_v2} from '@sanity/ui/theme'
2
1
  import {css} from 'styled-components'
3
2
  import {rem, ThemeProps} from '../../styles'
4
3
  import {focusRingStyle} from '../../styles/internal'
@@ -36,7 +35,7 @@ export function switchInputStyles(): ReturnType<typeof css> {
36
35
 
37
36
  /* Representation */
38
37
  export function switchRepresentationStyles(props: ThemeProps): ReturnType<typeof css> {
39
- const {color, input} = getTheme_v2(props.theme)
38
+ const {color, input} = props.theme.sanity.v2
40
39
 
41
40
  return css`
42
41
  --switch-bg-color: ${color.input.default.enabled.border};
@@ -112,7 +111,7 @@ export function switchRepresentationStyles(props: ThemeProps): ReturnType<typeof
112
111
 
113
112
  /* Track */
114
113
  export function switchTrackStyles(props: ThemeProps): ReturnType<typeof css> {
115
- const {input} = getTheme_v2(props.theme)
114
+ const {input} = props.theme.sanity.v2
116
115
 
117
116
  return css`
118
117
  &:not([hidden]) {
@@ -133,7 +132,7 @@ export function switchThumbStyles(
133
132
  props: {$checked?: boolean; $indeterminate?: boolean} & ThemeProps,
134
133
  ): ReturnType<typeof css> {
135
134
  const {$indeterminate} = props
136
- const {input} = getTheme_v2(props.theme)
135
+ const {input} = props.theme.sanity.v2
137
136
  const trackWidth = input.switch.width
138
137
  const trackHeight = input.switch.height
139
138
  const trackPadding = input.switch.padding
@@ -1,5 +1,5 @@
1
1
  import {Flex, Text, ThemeProps} from '@sanity/ui'
2
- import {ThemeColorAvatarColorKey, ThemeColorSpotKey, getTheme_v2} from '@sanity/ui/theme'
2
+ import {ThemeColorAvatarColorKey, ThemeColorSpotKey} from '@sanity/ui/theme'
3
3
  import {useSelect} from '@sanity/ui-workshop'
4
4
  import {styled, css} from 'styled-components'
5
5
  import {WORKSHOP_SPOT_COLOR_OPTIONS} from '../../../__workshop__/constants'
@@ -9,7 +9,7 @@ const ColoredText = styled(Text)<{$color?: ThemeColorSpotKey}>((
9
9
  $color?: ThemeColorAvatarColorKey
10
10
  } & ThemeProps,
11
11
  ) => {
12
- const {color} = getTheme_v2(props.theme)
12
+ const {color} = props.theme.sanity.v2
13
13
 
14
14
  return css`
15
15
  color: ${color.avatar[props.$color || 'gray'].bg};
@@ -1,4 +1,3 @@
1
- import {getTheme_v2} from '@sanity/ui/theme'
2
1
  import {css} from 'styled-components'
3
2
  import {ThemeProps} from '../../styles'
4
3
 
@@ -6,7 +5,7 @@ export function textBaseStyle(
6
5
  props: {$accent?: boolean; $muted?: boolean} & ThemeProps,
7
6
  ): ReturnType<typeof css> {
8
7
  const {$accent, $muted} = props
9
- const {font} = getTheme_v2(props.theme)
8
+ const {font} = props.theme.sanity.v2
10
9
 
11
10
  return css`
12
11
  color: var(--card-fg-color);
@@ -1,4 +1,4 @@
1
- import {CSSObject, getTheme_v2} from '@sanity/ui/theme'
1
+ import {CSSObject} from '@sanity/ui/theme'
2
2
  import {_responsive} from '../helpers'
3
3
  import {ThemeProps} from '../types'
4
4
  import {ResponsiveBorderStyleProps} from './types'
@@ -10,7 +10,7 @@ export function responsiveBorderStyle(): Array<
10
10
  }
11
11
 
12
12
  function border(props: ResponsiveBorderStyleProps & ThemeProps) {
13
- const {card, media} = getTheme_v2(props.theme)
13
+ const {card, media} = props.theme.sanity.v2
14
14
  const borderStyle = `${card.border?.width ?? 1}px solid var(--card-border-color)`
15
15
 
16
16
  return _responsive(media, props.$border, (value) =>
@@ -19,7 +19,7 @@ function border(props: ResponsiveBorderStyleProps & ThemeProps) {
19
19
  }
20
20
 
21
21
  function borderTop(props: ResponsiveBorderStyleProps & ThemeProps) {
22
- const {card, media} = getTheme_v2(props.theme)
22
+ const {card, media} = props.theme.sanity.v2
23
23
  const borderStyle = `${card.border?.width ?? 1}px solid var(--card-border-color)`
24
24
 
25
25
  return _responsive(media, props.$borderTop, (value) =>
@@ -28,7 +28,7 @@ function borderTop(props: ResponsiveBorderStyleProps & ThemeProps) {
28
28
  }
29
29
 
30
30
  function borderRight(props: ResponsiveBorderStyleProps & ThemeProps) {
31
- const {card, media} = getTheme_v2(props.theme)
31
+ const {card, media} = props.theme.sanity.v2
32
32
  const borderStyle = `${card.border?.width ?? 1}px solid var(--card-border-color)`
33
33
 
34
34
  return _responsive(media, props.$borderRight, (value) =>
@@ -37,7 +37,7 @@ function borderRight(props: ResponsiveBorderStyleProps & ThemeProps) {
37
37
  }
38
38
 
39
39
  function borderBottom(props: ResponsiveBorderStyleProps & ThemeProps) {
40
- const {card, media} = getTheme_v2(props.theme)
40
+ const {card, media} = props.theme.sanity.v2
41
41
  const borderStyle = `${card.border?.width ?? 1}px solid var(--card-border-color)`
42
42
 
43
43
  return _responsive(media, props.$borderBottom, (value) =>
@@ -46,7 +46,7 @@ function borderBottom(props: ResponsiveBorderStyleProps & ThemeProps) {
46
46
  }
47
47
 
48
48
  function borderLeft(props: ResponsiveBorderStyleProps & ThemeProps) {
49
- const {card, media} = getTheme_v2(props.theme)
49
+ const {card, media} = props.theme.sanity.v2
50
50
  const borderStyle = `${card.border?.width ?? 1}px solid var(--card-border-color)`
51
51
 
52
52
  return _responsive(media, props.$borderLeft, (value) =>
@@ -1,4 +1,4 @@
1
- import {CSSObject, getTheme_v2} from '@sanity/ui/theme'
1
+ import {CSSObject} from '@sanity/ui/theme'
2
2
  import {Property} from 'csstype'
3
3
  import {_responsive} from '../helpers'
4
4
  import {ThemeProps} from '../types'
@@ -36,7 +36,7 @@ export function responsiveBoxStyle(): Array<
36
36
  }
37
37
 
38
38
  function responsiveBoxDisplayStyle(props: ResponsiveBoxStyleProps & ThemeProps) {
39
- const {media} = getTheme_v2(props.theme)
39
+ const {media} = props.theme.sanity.v2
40
40
 
41
41
  return _responsive(media, props.$display, (display) => ({
42
42
  '&:not([hidden])': {display},
@@ -44,7 +44,7 @@ function responsiveBoxDisplayStyle(props: ResponsiveBoxStyleProps & ThemeProps)
44
44
  }
45
45
 
46
46
  function responsiveBoxSizingStyle(props: ResponsiveBoxStyleProps & ThemeProps) {
47
- const {media} = getTheme_v2(props.theme)
47
+ const {media} = props.theme.sanity.v2
48
48
 
49
49
  return _responsive(media, props.$sizing, (sizing) => ({
50
50
  boxSizing: BOX_SIZING[sizing],
@@ -52,7 +52,7 @@ function responsiveBoxSizingStyle(props: ResponsiveBoxStyleProps & ThemeProps) {
52
52
  }
53
53
 
54
54
  function responsiveBoxHeightStyle(props: ResponsiveBoxStyleProps & ThemeProps) {
55
- const {media} = getTheme_v2(props.theme)
55
+ const {media} = props.theme.sanity.v2
56
56
 
57
57
  return _responsive(media, props.$height, (height) => ({
58
58
  height: BOX_HEIGHT[height],
@@ -60,7 +60,7 @@ function responsiveBoxHeightStyle(props: ResponsiveBoxStyleProps & ThemeProps) {
60
60
  }
61
61
 
62
62
  function responsiveBoxOverflowStyle(props: ResponsiveBoxStyleProps & ThemeProps) {
63
- const {media} = getTheme_v2(props.theme)
63
+ const {media} = props.theme.sanity.v2
64
64
 
65
65
  return _responsive(media, props.$overflow, (overflow) => ({
66
66
  overflow,
@@ -1,4 +1,4 @@
1
- import {CSSObject, getTheme_v2} from '@sanity/ui/theme'
1
+ import {CSSObject} from '@sanity/ui/theme'
2
2
  import {EMPTY_ARRAY} from '../../constants'
3
3
  import {_responsive} from '../helpers'
4
4
  import {ThemeProps} from '../types'
@@ -18,7 +18,7 @@ export function flexItemStyle(): Array<
18
18
  export function responsiveFlexItemStyle(
19
19
  props: ResponsiveFlexItemStyleProps & ThemeProps,
20
20
  ): CSSObject[] {
21
- const {media} = getTheme_v2(props.theme)
21
+ const {media} = props.theme.sanity.v2
22
22
 
23
23
  if (!props.$flex) return EMPTY_ARRAY
24
24
 
@@ -1,4 +1,4 @@
1
- import {CSSObject, getTheme_v2} from '@sanity/ui/theme'
1
+ import {CSSObject} from '@sanity/ui/theme'
2
2
  import {rem, _responsive} from '../helpers'
3
3
  import {ThemeProps} from '../types'
4
4
  import {ResponsiveFlexStyleProps} from './types'
@@ -25,7 +25,7 @@ export function responsiveFlexStyle(): Array<
25
25
  export function responsiveFlexAlignStyle(
26
26
  props: ResponsiveFlexStyleProps & ThemeProps,
27
27
  ): CSSObject[] {
28
- const {media} = getTheme_v2(props.theme)
28
+ const {media} = props.theme.sanity.v2
29
29
 
30
30
  return _responsive(media, props.$align, (align) => {
31
31
  return {alignItems: align}
@@ -33,7 +33,7 @@ export function responsiveFlexAlignStyle(
33
33
  }
34
34
 
35
35
  function responsiveFlexGapStyle(props: ResponsiveFlexStyleProps & ThemeProps) {
36
- const {media, space} = getTheme_v2(props.theme)
36
+ const {media, space} = props.theme.sanity.v2
37
37
 
38
38
  return _responsive(media, props.$gap, (gap) => ({
39
39
  gap: gap ? rem(space[gap]) : undefined,
@@ -41,7 +41,7 @@ function responsiveFlexGapStyle(props: ResponsiveFlexStyleProps & ThemeProps) {
41
41
  }
42
42
 
43
43
  export function responsiveFlexWrapStyle(props: ResponsiveFlexStyleProps & ThemeProps): CSSObject[] {
44
- const {media} = getTheme_v2(props.theme)
44
+ const {media} = props.theme.sanity.v2
45
45
 
46
46
  return _responsive(media, props.$wrap, (wrap) => {
47
47
  return {flexWrap: wrap}
@@ -51,7 +51,7 @@ export function responsiveFlexWrapStyle(props: ResponsiveFlexStyleProps & ThemeP
51
51
  export function responsiveFlexJustifyStyle(
52
52
  props: ResponsiveFlexStyleProps & ThemeProps,
53
53
  ): CSSObject[] {
54
- const {media} = getTheme_v2(props.theme)
54
+ const {media} = props.theme.sanity.v2
55
55
 
56
56
  return _responsive(media, props.$justify, (justify) => {
57
57
  return {justifyContent: justify}
@@ -61,7 +61,7 @@ export function responsiveFlexJustifyStyle(
61
61
  export function responsiveFlexDirectionStyle(
62
62
  props: ResponsiveFlexStyleProps & ThemeProps,
63
63
  ): CSSObject[] {
64
- const {media} = getTheme_v2(props.theme)
64
+ const {media} = props.theme.sanity.v2
65
65
 
66
66
  return _responsive(media, props.$direction, (direction) => {
67
67
  return {flexDirection: direction}
@@ -1,4 +1,4 @@
1
- import {ThemeFontSize, ThemeFontKey, getTheme_v2} from '@sanity/ui/theme'
1
+ import {ThemeFontSize, ThemeFontKey} from '@sanity/ui/theme'
2
2
  import {CSSObject} from '@sanity/ui/theme'
3
3
  import {rem, _responsive} from '../helpers'
4
4
  import {ThemeProps} from '../types'
@@ -13,7 +13,7 @@ export function responsiveFont(
13
13
  props: ResponsiveFontStyleProps & ThemeProps,
14
14
  ): CSSObject[] {
15
15
  const {$size, $weight} = props
16
- const {font, media} = getTheme_v2(props.theme)
16
+ const {font, media} = props.theme.sanity.v2
17
17
  const {family, sizes, weights} = font[fontKey]
18
18
  const fontWeight = ($weight && weights[$weight]) || weights.regular
19
19
 
@@ -1,4 +1,4 @@
1
- import {CSSObject, getTheme_v2} from '@sanity/ui/theme'
1
+ import {CSSObject} from '@sanity/ui/theme'
2
2
  import {_responsive} from '../helpers'
3
3
  import {ThemeProps} from '../types'
4
4
  import {ResponsiveTextAlignStyleProps} from './types'
@@ -10,7 +10,7 @@ import {ResponsiveTextAlignStyleProps} from './types'
10
10
  export function responsiveTextAlignStyle(
11
11
  props: ResponsiveTextAlignStyleProps & ThemeProps,
12
12
  ): CSSObject[] {
13
- const {media} = getTheme_v2(props.theme)
13
+ const {media} = props.theme.sanity.v2
14
14
 
15
15
  return _responsive(media, props.$align, (textAlign) => {
16
16
  return {textAlign}