@sanity/ui 2.0.13-alpha.1 → 2.0.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 (66) hide show
  1. package/dist/index.d.mts +2 -2
  2. package/dist/index.d.ts +2 -2
  3. package/dist/index.esm.js +73 -73
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/index.js +78 -78
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +73 -73
  8. package/dist/index.mjs.map +1 -1
  9. package/dist/theme.d.mts +1 -1
  10. package/dist/theme.d.ts +1 -1
  11. package/dist/theme.esm.js +587 -51
  12. package/dist/theme.esm.js.map +1 -1
  13. package/dist/theme.js +560 -22
  14. package/dist/theme.js.map +1 -1
  15. package/dist/theme.mjs +587 -51
  16. package/dist/theme.mjs.map +1 -1
  17. package/package.json +27 -28
  18. package/src/core/components/dialog/styles.ts +3 -3
  19. package/src/core/components/skeleton/textSkeleton.tsx +2 -2
  20. package/src/core/components/tree/style.ts +3 -2
  21. package/src/core/hooks/useMediaIndex/useMediaIndex.test.tsx +1 -1
  22. package/src/core/primitives/_selectable/style.ts +2 -1
  23. package/src/core/primitives/avatar/avatarCounter.tsx +3 -2
  24. package/src/core/primitives/avatar/avatarStack.tsx +2 -1
  25. package/src/core/primitives/avatar/styles.ts +3 -3
  26. package/src/core/primitives/button/styles.ts +3 -3
  27. package/src/core/primitives/card/__workshop__/selected.tsx +2 -2
  28. package/src/core/primitives/card/styles.ts +3 -2
  29. package/src/core/primitives/checkbox/styles.ts +2 -1
  30. package/src/core/primitives/code/styles.ts +4 -1
  31. package/src/core/primitives/container/styles.ts +2 -2
  32. package/src/core/primitives/heading/styles.ts +2 -1
  33. package/src/core/primitives/inline/styles.ts +2 -2
  34. package/src/core/primitives/label/styles.ts +2 -1
  35. package/src/core/primitives/radio/styles.ts +2 -1
  36. package/src/core/primitives/select/styles.ts +5 -5
  37. package/src/core/primitives/stack/styles.ts +2 -2
  38. package/src/core/primitives/switch/styles.ts +4 -3
  39. package/src/core/primitives/text/__workshop__/colored.tsx +2 -2
  40. package/src/core/primitives/text/styles.ts +2 -1
  41. package/src/core/styles/border/borderStyle.ts +6 -6
  42. package/src/core/styles/box/boxStyle.ts +5 -5
  43. package/src/core/styles/flex/flexItemStyle.ts +2 -2
  44. package/src/core/styles/flex/flexStyle.ts +6 -6
  45. package/src/core/styles/font/responsiveFont.ts +2 -2
  46. package/src/core/styles/font/textAlignStyle.ts +2 -2
  47. package/src/core/styles/grid/gridItemStyle.ts +7 -7
  48. package/src/core/styles/grid/gridStyle.ts +9 -9
  49. package/src/core/styles/helpers.ts +2 -2
  50. package/src/core/styles/input/responsiveInputPaddingStyle.ts +2 -2
  51. package/src/core/styles/input/textInputStyle.ts +4 -4
  52. package/src/core/styles/margin/marginsStyle.test.ts +1 -1
  53. package/src/core/styles/padding/paddingStyle.test.ts +1 -1
  54. package/src/core/styles/radius/radiusStyle.ts +2 -2
  55. package/src/core/styles/shadow/shadowStyle.ts +2 -2
  56. package/src/core/theme/__workshop__/build/Root.tsx +2 -1
  57. package/src/core/theme/theme.test.tsx +1 -1
  58. package/src/core/theme/themeProvider.tsx +7 -6
  59. package/src/core/theme/useTheme.ts +1 -2
  60. package/src/theme/system/theme.ts +1 -1
  61. package/dist/_chunks-cjs/getScopedTheme.js +0 -547
  62. package/dist/_chunks-cjs/getScopedTheme.js.map +0 -1
  63. package/dist/_chunks-es/getScopedTheme.mjs +0 -548
  64. package/dist/_chunks-es/getScopedTheme.mjs.map +0 -1
  65. package/dist/_legacy/getScopedTheme.esm.js +0 -548
  66. package/dist/_legacy/getScopedTheme.esm.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/ui",
3
- "version": "2.0.13-alpha.1",
3
+ "version": "2.0.13",
4
4
  "keywords": [
5
5
  "sanity",
6
6
  "ui",
@@ -13,7 +13,6 @@
13
13
  "bugs": {
14
14
  "url": "https://github.com/sanity-io/ui/issues"
15
15
  },
16
- "type": "commonjs",
17
16
  "repository": {
18
17
  "type": "git",
19
18
  "url": "git+https://github.com/sanity-io/ui.git"
@@ -107,8 +106,8 @@
107
106
  },
108
107
  "dependencies": {
109
108
  "@floating-ui/react-dom": "^2.0.8",
110
- "@sanity/color": "^3.0.0",
111
- "@sanity/icons": "^2.11.3",
109
+ "@sanity/color": "^3.0.2",
110
+ "@sanity/icons": "^2.11.4",
112
111
  "csstype": "^3.1.3",
113
112
  "framer-motion": "11.0.8",
114
113
  "react-refractor": "^2.1.7"
@@ -121,38 +120,38 @@
121
120
  "@commitlint/cli": "^19.2.1",
122
121
  "@commitlint/config-conventional": "^19.1.0",
123
122
  "@juggle/resize-observer": "^3.4.0",
124
- "@sanity/pkg-utils": "^5.1.4",
123
+ "@sanity/pkg-utils": "^5.1.6",
125
124
  "@sanity/semantic-release-preset": "^4.1.7",
126
- "@sanity/ui-workshop": "^2.0.6",
127
- "@storybook/addon-a11y": "^8.0.2",
128
- "@storybook/addon-docs": "^8.0.2",
129
- "@storybook/addon-essentials": "^8.0.2",
130
- "@storybook/addon-interactions": "^8.0.2",
131
- "@storybook/addon-links": "^8.0.2",
132
- "@storybook/addon-storysource": "^8.0.2",
133
- "@storybook/addon-themes": "^8.0.2",
134
- "@storybook/blocks": "^8.0.2",
125
+ "@sanity/ui-workshop": "^2.0.7",
126
+ "@storybook/addon-a11y": "^8.0.5",
127
+ "@storybook/addon-docs": "^8.0.5",
128
+ "@storybook/addon-essentials": "^8.0.5",
129
+ "@storybook/addon-interactions": "^8.0.5",
130
+ "@storybook/addon-links": "^8.0.5",
131
+ "@storybook/addon-storysource": "^8.0.5",
132
+ "@storybook/addon-themes": "^8.0.5",
133
+ "@storybook/blocks": "^8.0.5",
135
134
  "@storybook/jest": "^0.2.3",
136
- "@storybook/manager-api": "^8.0.2",
137
- "@storybook/react": "^8.0.2",
138
- "@storybook/react-vite": "^8.0.2",
135
+ "@storybook/manager-api": "^8.0.5",
136
+ "@storybook/react": "^8.0.5",
137
+ "@storybook/react-vite": "^8.0.5",
139
138
  "@storybook/testing-library": "^0.2.2",
140
- "@storybook/theming": "^8.0.2",
139
+ "@storybook/theming": "^8.0.5",
141
140
  "@testing-library/dom": "^9.3.4",
142
141
  "@testing-library/jest-dom": "^5.17.0",
143
142
  "@testing-library/react": "^14.2.2",
144
143
  "@types/jest": "^29.5.12",
145
144
  "@types/jest-axe": "^3.5.9",
146
145
  "@types/node": "^20.5.9",
147
- "@types/react": "^18.2.67",
148
- "@types/react-dom": "^18.2.22",
146
+ "@types/react": "^18.2.73",
147
+ "@types/react-dom": "^18.2.23",
149
148
  "@types/react-is": "^18.2.4",
150
149
  "@types/refractor": "^3.4.1",
151
150
  "@types/testing-library__jest-dom": "^5.14.9",
152
- "@typescript-eslint/eslint-plugin": "^7.3.1",
153
- "@typescript-eslint/parser": "^7.3.1",
151
+ "@typescript-eslint/eslint-plugin": "^7.5.0",
152
+ "@typescript-eslint/parser": "^7.5.0",
154
153
  "commitizen": "^4.3.0",
155
- "cypress": "^13.7.0",
154
+ "cypress": "^13.7.1",
156
155
  "cypress-real-events": "^1.12.0",
157
156
  "cz-conventional-changelog": "^3.3.0",
158
157
  "eslint": "^8.57.0",
@@ -173,19 +172,19 @@
173
172
  "module-alias": "^2.2.3",
174
173
  "npm-run-all2": "^5.0.2",
175
174
  "prettier": "^3.2.5",
176
- "prettier-plugin-packagejson": "^2.4.12",
175
+ "prettier-plugin-packagejson": "^2.4.14",
177
176
  "react": "^18.2.0",
178
177
  "react-dom": "^18.2.0",
179
178
  "react-is": "^18.2.0",
180
179
  "refractor": "^4.8.1",
181
180
  "rimraf": "^5.0.1",
182
- "semantic-release": "^23.0.5",
181
+ "semantic-release": "^23.0.6",
183
182
  "start-server-and-test": "^2.0.3",
184
- "storybook": "^8.0.2",
183
+ "storybook": "^8.0.5",
185
184
  "styled-components": "^6.1.8",
186
185
  "tsconfig-paths": "^4.2.0",
187
186
  "typescript": "5.4.2",
188
- "vite": "^5.2.2",
187
+ "vite": "^5.2.7",
189
188
  "vite-tsconfig-paths": "^4.3.2"
190
189
  },
191
190
  "peerDependencies": {
@@ -194,7 +193,7 @@
194
193
  "react-is": "^18",
195
194
  "styled-components": "^5.2 || ^6"
196
195
  },
197
- "packageManager": "pnpm@8.15.5",
196
+ "packageManager": "pnpm@8.15.6",
198
197
  "engines": {
199
198
  "node": ">=14.0.0"
200
199
  },
@@ -1,4 +1,4 @@
1
- import {CSSObject} from '@sanity/ui/theme'
1
+ import {CSSObject, getTheme_v2} 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} = theme.sanity.v2
14
+ const {color} = getTheme_v2(theme)
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} = props.theme.sanity.v2
35
+ const {media} = getTheme_v2(props.theme)
36
36
 
37
37
  return _responsive(media, props.$position, (position) => ({'&&': {position}}))
38
38
  }
@@ -1,4 +1,4 @@
1
- import {ThemeFontKey} from '@sanity/ui/theme'
1
+ import {ThemeFontKey, getTheme_v2} 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} = props.theme.sanity.v2
15
+ const {font, media} = getTheme_v2(props.theme)
16
16
  const fontStyle = font[$style]
17
17
 
18
18
  const styles = _responsive(media, $size, (sizeIndex) => {
@@ -1,3 +1,4 @@
1
+ import {getTheme_v2} from '@sanity/ui/theme'
1
2
  import {css} from 'styled-components'
2
3
  import {rem, ThemeProps} from '../../styles'
3
4
  import {_cardColorStyle} from '../../styles/card'
@@ -37,7 +38,7 @@ export function treeItemRootStyle(): ReturnType<typeof css> {
37
38
 
38
39
  export function treeItemRootColorStyle(props: ThemeProps): ReturnType<typeof css> {
39
40
  const $tone = 'default'
40
- const {color} = props.theme.sanity.v2
41
+ const {color} = getTheme_v2(props.theme)
41
42
  const tone = color.selectable[$tone]
42
43
 
43
44
  return css`
@@ -91,7 +92,7 @@ export function treeItemBoxStyle(
91
92
  props: TreeItemBoxStyleProps & ThemeProps,
92
93
  ): ReturnType<typeof css> {
93
94
  const {$level} = props
94
- const {space} = props.theme.sanity.v2
95
+ const {space} = getTheme_v2(props.theme)
95
96
 
96
97
  return css`
97
98
  padding-left: ${rem(space[2] * $level)};
@@ -1,7 +1,7 @@
1
1
  /** @jest-environment node */
2
2
 
3
+ import {buildTheme} from '@sanity/ui/theme'
3
4
  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,3 +1,4 @@
1
+ import {getTheme_v2} from '@sanity/ui/theme'
1
2
  import {css} from 'styled-components'
2
3
  import {ThemeProps} from '../../styles'
3
4
  import {_cardColorStyle} from '../../styles/card'
@@ -38,7 +39,7 @@ export function selectableColorStyle(
38
39
  props: SelectableStyleProps & ThemeProps,
39
40
  ): ReturnType<typeof css> {
40
41
  const {$tone} = props
41
- const {color, style} = props.theme.sanity.v2
42
+ const {color, style} = getTheme_v2(props.theme)
42
43
  const tone = color.selectable[$tone]
43
44
 
44
45
  return css`
@@ -1,3 +1,4 @@
1
+ import {getTheme_v2} from '@sanity/ui/theme'
1
2
  import {forwardRef, useMemo} from 'react'
2
3
  import {styled, css} from 'styled-components'
3
4
  import {EMPTY_RECORD} from '../../constants'
@@ -7,7 +8,7 @@ import {AvatarSize} from '../../types'
7
8
  import {Label} from '../label'
8
9
 
9
10
  function _responsiveAvatarCounterSizeStyle(props: {$size: AvatarSize[]} & ThemeProps) {
10
- const {avatar, media} = props.theme.sanity.v2
11
+ const {avatar, media} = getTheme_v2(props.theme)
11
12
 
12
13
  return _responsive(media, props.$size, (size) => {
13
14
  const avatarSize = avatar.sizes[size]
@@ -23,7 +24,7 @@ function _responsiveAvatarCounterSizeStyle(props: {$size: AvatarSize[]} & ThemeP
23
24
  }
24
25
 
25
26
  function _avatarCounterBaseStyle(props: ThemeProps) {
26
- const {space} = props.theme.sanity.v2
27
+ const {space} = getTheme_v2(props.theme)
27
28
 
28
29
  return css`
29
30
  align-items: center;
@@ -1,3 +1,4 @@
1
+ import {getTheme_v2} from '@sanity/ui/theme'
1
2
  import {cloneElement, forwardRef} from 'react'
2
3
  import {styled, css} from 'styled-components'
3
4
  import {EMPTY_RECORD} from '../../constants'
@@ -24,7 +25,7 @@ function avatarStackStyle() {
24
25
  }
25
26
 
26
27
  function responsiveAvatarStackSizeStyle(props: {$size: AvatarSize[]} & ThemeProps) {
27
- const {avatar, media} = props.theme.sanity.v2
28
+ const {avatar, media} = getTheme_v2(props.theme)
28
29
 
29
30
  return _responsive(media, props.$size, (size) => {
30
31
  const avatarSize = avatar.sizes[size]
@@ -1,4 +1,4 @@
1
- import {CSSObject} from '@sanity/ui/theme'
1
+ import {CSSObject, getTheme_v2} 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} = props.theme.sanity.v2
60
+ const {avatar} = getTheme_v2(props.theme)
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} = props.theme.sanity.v2
107
+ const {avatar, media} = getTheme_v2(props.theme)
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} from '@sanity/ui/theme'
1
+ import {CSSObject, getTheme_v2} 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} = props.theme.sanity.v2
15
+ const {style} = getTheme_v2(props.theme)
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} = props.theme.sanity.v2
70
+ const {button, color: baseColor, style} = getTheme_v2(props.theme)
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} from '@sanity/ui/theme'
3
+ import {ThemeColorStateToneKey, getTheme_v2} 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} = props.theme.sanity.v2
13
+ const {color} = getTheme_v2(props.theme)
14
14
  const tone = color.button.default[$tone]
15
15
 
16
16
  return css`
@@ -1,3 +1,4 @@
1
+ import {getTheme_v2} from '@sanity/ui/theme'
1
2
  import {css} from 'styled-components'
2
3
  import {ThemeProps} from '../../styles'
3
4
  import {_cardColorStyle} from '../../styles/card'
@@ -12,7 +13,7 @@ export function cardStyle(
12
13
 
13
14
  export function cardBaseStyle(props: CardStyleProps & ThemeProps): ReturnType<typeof css> {
14
15
  const {$checkered} = props
15
- const {space} = props.theme.sanity.v2
16
+ const {space} = getTheme_v2(props.theme)
16
17
 
17
18
  return css`
18
19
  ${$checkered &&
@@ -49,7 +50,7 @@ export function cardBaseStyle(props: CardStyleProps & ThemeProps): ReturnType<ty
49
50
 
50
51
  export function cardColorStyle(props: CardStyleProps & ThemeProps): ReturnType<typeof css> {
51
52
  const {$checkered, $focusRing} = props
52
- const {card, color, style} = props.theme.sanity.v2
53
+ const {card, color, style} = getTheme_v2(props.theme)
53
54
  const border = {width: card.border.width, color: 'var(--card-border-color)'}
54
55
 
55
56
  return css`
@@ -1,3 +1,4 @@
1
+ import {getTheme_v2} from '@sanity/ui/theme'
1
2
  import {css} from 'styled-components'
2
3
  import {rem, ThemeProps} from '../../styles'
3
4
  import {focusRingBorderStyle, focusRingStyle} from '../../styles/internal'
@@ -10,7 +11,7 @@ export function checkboxBaseStyles(): ReturnType<typeof css> {
10
11
  }
11
12
 
12
13
  export function inputElementStyles(props: ThemeProps): ReturnType<typeof css> {
13
- const {color, input, radius} = props.theme.sanity.v2
14
+ const {color, input, radius} = getTheme_v2(props.theme)
14
15
  const {focusRing} = input.checkbox
15
16
 
16
17
  return css`
@@ -1,7 +1,10 @@
1
+ import {getTheme_v2} from '@sanity/ui/theme'
1
2
  import {css, ExecutionContext} from 'styled-components'
2
3
 
3
4
  function codeSyntaxHighlightingStyle({theme}: ExecutionContext) {
4
- const color = theme.sanity.v2.color.syntax
5
+ const {
6
+ color: {syntax: color},
7
+ } = getTheme_v2(theme)
5
8
 
6
9
  return {
7
10
  '&.atrule': {color: color.atrule},
@@ -1,4 +1,4 @@
1
- import {CSSObject} from '@sanity/ui/theme'
1
+ import {CSSObject, getTheme_v2} 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} = props.theme.sanity.v2
17
+ const {container, media} = getTheme_v2(props.theme)
18
18
 
19
19
  return _responsive(media, props.$width, (val) => ({
20
20
  maxWidth: val === 'auto' ? 'none' : rem(container[val]),
@@ -1,10 +1,11 @@
1
+ import {getTheme_v2} from '@sanity/ui/theme'
1
2
  import {css} from 'styled-components'
2
3
  import {ThemeProps} from '../../styles'
3
4
  import {HeadingStyleProps} from './types'
4
5
 
5
6
  export function headingBaseStyle(props: HeadingStyleProps & ThemeProps): ReturnType<typeof css> {
6
7
  const {$accent, $muted} = props
7
- const {font} = props.theme.sanity.v2
8
+ const {font} = getTheme_v2(props.theme)
8
9
 
9
10
  return css`
10
11
  ${$accent &&
@@ -1,4 +1,4 @@
1
- import {CSSObject} from '@sanity/ui/theme'
1
+ import {CSSObject, getTheme_v2} 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} = props.theme.sanity.v2
21
+ const {media, space} = getTheme_v2(props.theme)
22
22
 
23
23
  return _responsive(media, props.$space, (spaceIndex) => {
24
24
  const _space = rem(spaceIndex === 0.5 ? space[1] / 2 : space[spaceIndex])
@@ -1,3 +1,4 @@
1
+ import {getTheme_v2} from '@sanity/ui/theme'
1
2
  import {css} from 'styled-components'
2
3
  import {ThemeProps} from '../../styles'
3
4
 
@@ -5,7 +6,7 @@ export function labelBaseStyle(
5
6
  props: {$accent?: boolean; $muted: boolean} & ThemeProps,
6
7
  ): ReturnType<typeof css> {
7
8
  const {$accent, $muted} = props
8
- const {font} = props.theme.sanity.v2
9
+ const {font} = getTheme_v2(props.theme)
9
10
 
10
11
  return css`
11
12
  text-transform: uppercase;
@@ -1,3 +1,4 @@
1
+ import {getTheme_v2} from '@sanity/ui/theme'
1
2
  import {css} from 'styled-components'
2
3
  import {rem, ThemeProps} from '../../styles'
3
4
  import {focusRingBorderStyle, focusRingStyle} from '../../styles/internal'
@@ -17,7 +18,7 @@ export function radioBaseStyle(): ReturnType<typeof css> {
17
18
  }
18
19
 
19
20
  export function inputElementStyle(props: ThemeProps): ReturnType<typeof css> {
20
- const {color, input} = props.theme.sanity.v2
21
+ const {color, input} = getTheme_v2(props.theme)
21
22
  const dist = (input.radio.size - input.radio.markSize) / 2
22
23
 
23
24
  return css`
@@ -1,4 +1,4 @@
1
- import {ThemeFontSize} from '@sanity/ui/theme'
1
+ import {ThemeFontSize, getTheme_v2} 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} = props.theme.sanity.v2
27
+ const {font} = getTheme_v2(props.theme)
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} = props.theme.sanity.v2
46
+ const {color, input} = getTheme_v2(props.theme)
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} = props.theme.sanity.v2
105
+ const {font, media} = getTheme_v2(props.theme)
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} = props.theme.sanity.v2
132
+ const {color} = getTheme_v2(props.theme)
133
133
 
134
134
  return css`
135
135
  pointer-events: none;
@@ -1,4 +1,4 @@
1
- import {CSSObject} from '@sanity/ui/theme'
1
+ import {CSSObject, getTheme_v2} 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} = props.theme.sanity.v2
26
+ const {media, space} = getTheme_v2(props.theme)
27
27
 
28
28
  return _responsive(media, props.$space, (spaceIndex) => ({
29
29
  gridGap: rem(space[spaceIndex]),
@@ -1,3 +1,4 @@
1
+ import {getTheme_v2} from '@sanity/ui/theme'
1
2
  import {css} from 'styled-components'
2
3
  import {rem, ThemeProps} from '../../styles'
3
4
  import {focusRingStyle} from '../../styles/internal'
@@ -35,7 +36,7 @@ export function switchInputStyles(): ReturnType<typeof css> {
35
36
 
36
37
  /* Representation */
37
38
  export function switchRepresentationStyles(props: ThemeProps): ReturnType<typeof css> {
38
- const {color, input} = props.theme.sanity.v2
39
+ const {color, input} = getTheme_v2(props.theme)
39
40
 
40
41
  return css`
41
42
  --switch-bg-color: ${color.input.default.enabled.border};
@@ -111,7 +112,7 @@ export function switchRepresentationStyles(props: ThemeProps): ReturnType<typeof
111
112
 
112
113
  /* Track */
113
114
  export function switchTrackStyles(props: ThemeProps): ReturnType<typeof css> {
114
- const {input} = props.theme.sanity.v2
115
+ const {input} = getTheme_v2(props.theme)
115
116
 
116
117
  return css`
117
118
  &:not([hidden]) {
@@ -132,7 +133,7 @@ export function switchThumbStyles(
132
133
  props: {$checked?: boolean; $indeterminate?: boolean} & ThemeProps,
133
134
  ): ReturnType<typeof css> {
134
135
  const {$indeterminate} = props
135
- const {input} = props.theme.sanity.v2
136
+ const {input} = getTheme_v2(props.theme)
136
137
  const trackWidth = input.switch.width
137
138
  const trackHeight = input.switch.height
138
139
  const trackPadding = input.switch.padding
@@ -1,5 +1,5 @@
1
1
  import {Flex, Text, ThemeProps} from '@sanity/ui'
2
- import {ThemeColorAvatarColorKey, ThemeColorSpotKey} from '@sanity/ui/theme'
2
+ import {ThemeColorAvatarColorKey, ThemeColorSpotKey, getTheme_v2} 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} = props.theme.sanity.v2
12
+ const {color} = getTheme_v2(props.theme)
13
13
 
14
14
  return css`
15
15
  color: ${color.avatar[props.$color || 'gray'].bg};
@@ -1,3 +1,4 @@
1
+ import {getTheme_v2} from '@sanity/ui/theme'
1
2
  import {css} from 'styled-components'
2
3
  import {ThemeProps} from '../../styles'
3
4
 
@@ -5,7 +6,7 @@ export function textBaseStyle(
5
6
  props: {$accent?: boolean; $muted?: boolean} & ThemeProps,
6
7
  ): ReturnType<typeof css> {
7
8
  const {$accent, $muted} = props
8
- const {font} = props.theme.sanity.v2
9
+ const {font} = getTheme_v2(props.theme)
9
10
 
10
11
  return css`
11
12
  color: var(--card-fg-color);
@@ -1,4 +1,4 @@
1
- import {CSSObject} from '@sanity/ui/theme'
1
+ import {CSSObject, getTheme_v2} 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} = props.theme.sanity.v2
13
+ const {card, media} = getTheme_v2(props.theme)
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} = props.theme.sanity.v2
22
+ const {card, media} = getTheme_v2(props.theme)
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} = props.theme.sanity.v2
31
+ const {card, media} = getTheme_v2(props.theme)
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} = props.theme.sanity.v2
40
+ const {card, media} = getTheme_v2(props.theme)
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} = props.theme.sanity.v2
49
+ const {card, media} = getTheme_v2(props.theme)
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} from '@sanity/ui/theme'
1
+ import {CSSObject, getTheme_v2} 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} = props.theme.sanity.v2
39
+ const {media} = getTheme_v2(props.theme)
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} = props.theme.sanity.v2
47
+ const {media} = getTheme_v2(props.theme)
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} = props.theme.sanity.v2
55
+ const {media} = getTheme_v2(props.theme)
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} = props.theme.sanity.v2
63
+ const {media} = getTheme_v2(props.theme)
64
64
 
65
65
  return _responsive(media, props.$overflow, (overflow) => ({
66
66
  overflow,