@sanity/ui 2.0.13-alpha.2 → 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 (115) hide show
  1. package/dist/index.d.mts +2 -2
  2. package/dist/index.d.ts +2 -2
  3. package/dist/index.esm.js +74 -74
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/index.js +202 -202
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +74 -74
  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/autocomplete/autocomplete.styles.tsx +1 -1
  19. package/src/core/components/breadcrumbs/breadcrumbs.styles.ts +1 -1
  20. package/src/core/components/dialog/__workshop__/panes.tsx +1 -1
  21. package/src/core/components/dialog/dialog.tsx +1 -1
  22. package/src/core/components/dialog/styles.ts +3 -3
  23. package/src/core/components/hotkeys/hotkeys.tsx +1 -1
  24. package/src/core/components/menu/menu.tsx +1 -1
  25. package/src/core/components/menu/menuDivider.ts +1 -1
  26. package/src/core/components/skeleton/skeleton.tsx +1 -1
  27. package/src/core/components/skeleton/textSkeleton.tsx +3 -3
  28. package/src/core/components/tab/tab.tsx +1 -1
  29. package/src/core/components/tab/tabList.tsx +1 -1
  30. package/src/core/components/toast/toast.tsx +1 -1
  31. package/src/core/components/toast/toastProvider.tsx +1 -1
  32. package/src/core/components/tree/style.ts +3 -2
  33. package/src/core/components/tree/treeItem.tsx +1 -1
  34. package/src/core/hooks/useMediaIndex/useMediaIndex.test.tsx +1 -1
  35. package/src/core/primitives/_selectable/selectable.tsx +1 -1
  36. package/src/core/primitives/_selectable/style.ts +2 -1
  37. package/src/core/primitives/avatar/avatar.tsx +1 -1
  38. package/src/core/primitives/avatar/avatarCounter.tsx +4 -3
  39. package/src/core/primitives/avatar/avatarStack.tsx +3 -2
  40. package/src/core/primitives/avatar/styles.ts +3 -3
  41. package/src/core/primitives/badge/badge.tsx +1 -1
  42. package/src/core/primitives/box/box.tsx +1 -1
  43. package/src/core/primitives/button/__workshop__/sanityUploadButton.tsx +1 -1
  44. package/src/core/primitives/button/__workshop__/styled1.tsx +1 -1
  45. package/src/core/primitives/button/__workshop__/styled2.tsx +1 -1
  46. package/src/core/primitives/button/button.tsx +1 -1
  47. package/src/core/primitives/button/styles.ts +3 -3
  48. package/src/core/primitives/card/__workshop__/selected.tsx +3 -3
  49. package/src/core/primitives/card/__workshop__/styled.tsx +1 -1
  50. package/src/core/primitives/card/card.tsx +1 -1
  51. package/src/core/primitives/card/styles.ts +3 -2
  52. package/src/core/primitives/checkbox/checkbox.tsx +1 -1
  53. package/src/core/primitives/checkbox/styles.ts +2 -1
  54. package/src/core/primitives/code/code.tsx +1 -1
  55. package/src/core/primitives/code/styles.ts +4 -1
  56. package/src/core/primitives/container/container.tsx +1 -1
  57. package/src/core/primitives/container/styles.ts +2 -2
  58. package/src/core/primitives/flex/__workshop__/example.tsx +1 -1
  59. package/src/core/primitives/flex/flex.tsx +1 -1
  60. package/src/core/primitives/grid/grid.tsx +1 -1
  61. package/src/core/primitives/heading/heading.tsx +1 -1
  62. package/src/core/primitives/heading/styles.ts +2 -1
  63. package/src/core/primitives/inline/inline.tsx +1 -1
  64. package/src/core/primitives/inline/styles.ts +2 -2
  65. package/src/core/primitives/kbd/kbd.tsx +1 -1
  66. package/src/core/primitives/label/label.tsx +1 -1
  67. package/src/core/primitives/label/styles.ts +2 -1
  68. package/src/core/primitives/popover/popoverCard.tsx +1 -1
  69. package/src/core/primitives/radio/radio.tsx +1 -1
  70. package/src/core/primitives/radio/styles.ts +2 -1
  71. package/src/core/primitives/select/select.tsx +1 -1
  72. package/src/core/primitives/select/styles.ts +5 -5
  73. package/src/core/primitives/spinner/spinner.tsx +1 -1
  74. package/src/core/primitives/stack/stack.tsx +1 -1
  75. package/src/core/primitives/stack/styles.ts +2 -2
  76. package/src/core/primitives/switch/styles.ts +4 -3
  77. package/src/core/primitives/switch/switch.tsx +1 -1
  78. package/src/core/primitives/text/__workshop__/colored.tsx +3 -3
  79. package/src/core/primitives/text/styles.ts +2 -1
  80. package/src/core/primitives/text/text.tsx +1 -1
  81. package/src/core/primitives/textArea/textArea.tsx +1 -1
  82. package/src/core/primitives/textInput/textInput.tsx +1 -1
  83. package/src/core/primitives/tooltip/tooltip.tsx +1 -1
  84. package/src/core/primitives/tooltip/tooltipCard.tsx +1 -1
  85. package/src/core/styles/border/borderStyle.ts +6 -6
  86. package/src/core/styles/box/boxStyle.ts +5 -5
  87. package/src/core/styles/flex/flexItemStyle.ts +2 -2
  88. package/src/core/styles/flex/flexStyle.ts +6 -6
  89. package/src/core/styles/font/responsiveFont.ts +2 -2
  90. package/src/core/styles/font/textAlignStyle.ts +2 -2
  91. package/src/core/styles/grid/gridItemStyle.ts +7 -7
  92. package/src/core/styles/grid/gridStyle.ts +9 -9
  93. package/src/core/styles/helpers.ts +2 -2
  94. package/src/core/styles/input/responsiveInputPaddingStyle.ts +2 -2
  95. package/src/core/styles/input/textInputStyle.ts +4 -4
  96. package/src/core/styles/margin/marginsStyle.test.ts +1 -1
  97. package/src/core/styles/padding/paddingStyle.test.ts +1 -1
  98. package/src/core/styles/radius/radiusStyle.ts +2 -2
  99. package/src/core/styles/shadow/shadowStyle.ts +2 -2
  100. package/src/core/theme/__workshop__/build/Root.tsx +2 -1
  101. package/src/core/theme/theme.test.tsx +1 -1
  102. package/src/core/theme/themeProvider.tsx +7 -6
  103. package/src/core/theme/useTheme.ts +1 -2
  104. package/src/core/utils/arrow/arrow.tsx +1 -1
  105. package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +1 -1
  106. package/src/core/utils/layer/layer.tsx +1 -1
  107. package/src/core/utils/srOnly/srOnly.tsx +1 -1
  108. package/src/core/utils/virtualList/virtualList.tsx +1 -1
  109. package/src/theme/system/theme.ts +1 -1
  110. package/dist/_chunks-cjs/getScopedTheme.js +0 -547
  111. package/dist/_chunks-cjs/getScopedTheme.js.map +0 -1
  112. package/dist/_chunks-es/getScopedTheme.mjs +0 -548
  113. package/dist/_chunks-es/getScopedTheme.mjs.map +0 -1
  114. package/dist/_legacy/getScopedTheme.esm.js +0 -548
  115. 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.2",
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,5 +1,5 @@
1
1
  import {SpinnerIcon} from '@sanity/icons'
2
- import styled, {keyframes} from 'styled-components'
2
+ import {styled, keyframes} from 'styled-components'
3
3
  import {Box} from '../../primitives'
4
4
 
5
5
  /**
@@ -1,4 +1,4 @@
1
- import styled from 'styled-components'
1
+ import {styled} from 'styled-components'
2
2
  import {Button} from '../../primitives'
3
3
 
4
4
  export const Root = styled.ol`
@@ -1,5 +1,5 @@
1
1
  import {useCallback, useState} from 'react'
2
- import styled from 'styled-components'
2
+ import {styled} from 'styled-components'
3
3
  import {Box, Button, Card, Flex} from '../../../primitives'
4
4
  import {BoundaryElementProvider, PortalProvider} from '../../../utils'
5
5
  import {Menu, MenuButton, MenuItem} from '../../menu'
@@ -1,7 +1,7 @@
1
1
  import {CloseIcon} from '@sanity/icons'
2
2
  import {ThemeColorSchemeKey} from '@sanity/ui/theme'
3
3
  import {forwardRef, useCallback, useEffect, useRef, useState} from 'react'
4
- import styled from 'styled-components'
4
+ import {styled} from 'styled-components'
5
5
  import {
6
6
  containsOrEqualsElement,
7
7
  focusFirstDescendant,
@@ -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,5 +1,5 @@
1
1
  import {forwardRef} from 'react'
2
- import styled from 'styled-components'
2
+ import {styled} from 'styled-components'
3
3
  import {useArrayProp} from '../../hooks'
4
4
  import {Inline, KBD} from '../../primitives'
5
5
  import {Radius} from '../../types'
@@ -1,5 +1,5 @@
1
1
  import {forwardRef, useCallback, useEffect, useMemo} from 'react'
2
- import styled from 'styled-components'
2
+ import {styled} from 'styled-components'
3
3
  import {useClickOutside, useForwardedRef, useGlobalKeyDown} from '../../hooks'
4
4
  import {Box, Stack} from '../../primitives'
5
5
  import {ResponsivePaddingProps} from '../../primitives/types'
@@ -1,4 +1,4 @@
1
- import styled from 'styled-components'
1
+ import {styled} from 'styled-components'
2
2
 
3
3
  /**
4
4
  * @public
@@ -1,5 +1,5 @@
1
1
  import {forwardRef, useEffect, useState} from 'react'
2
- import styled from 'styled-components'
2
+ import {styled} from 'styled-components'
3
3
  import {useArrayProp} from '../../hooks'
4
4
  import {Box} from '../../primitives'
5
5
  import {BoxProps, ResponsiveRadiusProps} from '../../primitives'
@@ -1,6 +1,6 @@
1
- import {ThemeFontKey} from '@sanity/ui/theme'
1
+ import {ThemeFontKey, getTheme_v2} from '@sanity/ui/theme'
2
2
  import {forwardRef} from 'react'
3
- import styled from 'styled-components'
3
+ import {styled} from 'styled-components'
4
4
  import {useArrayProp} from '../../hooks'
5
5
  import {ThemeProps, _responsive} from '../../styles'
6
6
  import {Skeleton, SkeletonProps} from './skeleton'
@@ -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,5 +1,5 @@
1
1
  import {forwardRef, useCallback, useEffect, useRef} from 'react'
2
- import styled from 'styled-components'
2
+ import {styled} from 'styled-components'
3
3
  import {useForwardedRef} from '../../hooks'
4
4
  import {Button} from '../../primitives'
5
5
  import {ButtonTone} from '../../types'
@@ -1,5 +1,5 @@
1
1
  import {cloneElement, forwardRef, useCallback, useMemo, useState} from 'react'
2
- import styled from 'styled-components'
2
+ import {styled} from 'styled-components'
3
3
  import {Inline, InlineProps} from '../../primitives'
4
4
 
5
5
  /**
@@ -1,6 +1,6 @@
1
1
  import {CloseIcon} from '@sanity/icons'
2
2
  import {ThemeColorToneKey} from '@sanity/ui/theme'
3
- import styled from 'styled-components'
3
+ import {styled} from 'styled-components'
4
4
  import {POPOVER_MOTION_CONTENT_OPACITY_PROPERTY} from '../../constants'
5
5
  import {Box, Button, Card, Flex, Stack, Text} from '../../primitives'
6
6
  import type {ButtonTone} from '../../types'
@@ -1,6 +1,6 @@
1
1
  import {AnimatePresence, motion, type Variants} from 'framer-motion'
2
2
  import {useMemo, useRef, useState, startTransition, useEffect} from 'react'
3
- import styled from 'styled-components'
3
+ import {styled} from 'styled-components'
4
4
  import {POPOVER_MOTION_CONTENT_OPACITY_PROPERTY} from '../../constants'
5
5
  import {useMounted} from '../../hooks/useMounted'
6
6
  import {usePrefersReducedMotion} from '../../hooks/usePrefersReducedMotion'
@@ -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
  import {ToggleArrowRightIcon} from '@sanity/icons'
2
2
  import {ThemeFontWeightKey} from '@sanity/ui/theme'
3
3
  import {createElement, memo, useCallback, useEffect, useId, useMemo, useRef} from 'react'
4
- import styled from 'styled-components'
4
+ import {styled} from 'styled-components'
5
5
  import {Box, BoxProps, Flex, Text} from '../../primitives'
6
6
  import {
7
7
  treeItemRootStyle,
@@ -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,4 +1,4 @@
1
- import styled from 'styled-components'
1
+ import {styled} from 'styled-components'
2
2
  import {responsiveRadiusStyle, ResponsiveRadiusStyleProps} from '../../styles/radius'
3
3
  import {Box} from '../box'
4
4
  import {selectableBaseStyle, selectableColorStyle, SelectableStyleProps} from './style'
@@ -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,7 +1,7 @@
1
1
  import {ThemeColorAvatarColorKey} from '@sanity/ui/theme'
2
2
  import {forwardRef, useCallback, useEffect, useId, useMemo, useState} from 'react'
3
3
  import ReactIs from 'react-is'
4
- import styled from 'styled-components'
4
+ import {styled} from 'styled-components'
5
5
  import {useArrayProp} from '../../hooks'
6
6
  import {useTheme_v2} from '../../theme'
7
7
  import {AvatarPosition, AvatarSize, AvatarStatus} from '../../types'
@@ -1,5 +1,6 @@
1
+ import {getTheme_v2} from '@sanity/ui/theme'
1
2
  import {forwardRef, useMemo} from 'react'
2
- import styled, {css} from 'styled-components'
3
+ import {styled, css} from 'styled-components'
3
4
  import {EMPTY_RECORD} from '../../constants'
4
5
  import {useArrayProp} from '../../hooks'
5
6
  import {rem, _responsive, ThemeProps} from '../../styles'
@@ -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,5 +1,6 @@
1
+ import {getTheme_v2} from '@sanity/ui/theme'
1
2
  import {cloneElement, forwardRef} from 'react'
2
- import styled, {css} from 'styled-components'
3
+ import {styled, css} from 'styled-components'
3
4
  import {EMPTY_RECORD} from '../../constants'
4
5
  import {useArrayProp} from '../../hooks'
5
6
  import {rem, _responsive, ThemeProps} from '../../styles'
@@ -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,5 +1,5 @@
1
1
  import {forwardRef} from 'react'
2
- import styled from 'styled-components'
2
+ import {styled} from 'styled-components'
3
3
  import {useArrayProp} from '../../hooks'
4
4
  import {responsiveRadiusStyle, ResponsiveRadiusStyleProps} from '../../styles/internal'
5
5
  import {BadgeMode, BadgeTone} from '../../types'
@@ -1,5 +1,5 @@
1
1
  import {forwardRef} from 'react'
2
- import styled from 'styled-components'
2
+ import {styled} from 'styled-components'
3
3
  import {useArrayProp} from '../../hooks'
4
4
  import {
5
5
  boxStyle,
@@ -1,6 +1,6 @@
1
1
  import {UploadIcon} from '@sanity/icons'
2
2
  import {Button, Flex} from '@sanity/ui'
3
- import styled from 'styled-components'
3
+ import {styled} from 'styled-components'
4
4
 
5
5
  const SanityUploadButton = styled(Button).attrs({forwardedAs: 'label'})`
6
6
  & input {
@@ -1,5 +1,5 @@
1
1
  import {Button, Flex} from '@sanity/ui'
2
- import styled from 'styled-components'
2
+ import {styled} from 'styled-components'
3
3
 
4
4
  const StyledButton1 = styled.a`
5
5
  &:hover {
@@ -1,5 +1,5 @@
1
1
  import {Button, Flex} from '@sanity/ui'
2
- import styled from 'styled-components'
2
+ import {styled} from 'styled-components'
3
3
 
4
4
  const StyledButton2 = styled(Button)<{$color?: boolean}>`
5
5
  &:hover {
@@ -1,6 +1,6 @@
1
1
  import {createElement, forwardRef, isValidElement, useMemo} from 'react'
2
2
  import {isValidElementType} from 'react-is'
3
- import styled from 'styled-components'
3
+ import {styled} from 'styled-components'
4
4
  import {useArrayProp} from '../../hooks'
5
5
  import {ThemeProps} from '../../styles'
6
6
  import {responsiveRadiusStyle, ResponsiveRadiusStyleProps} from '../../styles/internal'
@@ -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,8 +1,8 @@
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
- import styled, {css} from 'styled-components'
5
+ import {styled, css} from 'styled-components'
6
6
 
7
7
  const TextWithTone = styled(Text)<{$tone: ThemeColorStateToneKey}>((
8
8
  props: {
@@ -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,5 +1,5 @@
1
1
  import {Card, Flex, Text} from '@sanity/ui'
2
- import styled from 'styled-components'
2
+ import {styled} from 'styled-components'
3
3
 
4
4
  const StyledCard = styled(Card).attrs({forwardedAs: 'ol'})``
5
5
 
@@ -1,7 +1,7 @@
1
1
  import {ThemeColorSchemeKey} from '@sanity/ui/theme'
2
2
  import {forwardRef} from 'react'
3
3
  import {isValidElementType} from 'react-is'
4
- import styled from 'styled-components'
4
+ import {styled} from 'styled-components'
5
5
  import {useArrayProp} from '../../hooks'
6
6
  import {
7
7
  responsiveBorderStyle,
@@ -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,6 +1,6 @@
1
1
  import {CheckmarkIcon, RemoveIcon} from '@sanity/icons'
2
2
  import {forwardRef, useEffect} from 'react'
3
- import styled from 'styled-components'
3
+ import {styled} from 'styled-components'
4
4
  import {useForwardedRef, useCustomValidity} from '../../hooks'
5
5
  import {checkboxBaseStyles, inputElementStyles} from './styles'
6
6
 
@@ -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,7 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
2
  import {forwardRef} from 'react'
3
3
  import Refractor from 'react-refractor'
4
- import styled from 'styled-components'
4
+ import {styled} from 'styled-components'
5
5
  import {useArrayProp} from '../../hooks'
6
6
  import {responsiveCodeFontStyle, ResponsiveFontStyleProps} from '../../styles/internal'
7
7
  import {codeBaseStyle} from './styles'
@@ -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,5 +1,5 @@
1
1
  import {forwardRef} from 'react'
2
- import styled from 'styled-components'
2
+ import {styled} from 'styled-components'
3
3
  import {useArrayProp} from '../../hooks'
4
4
  import {Box, BoxProps} from '../box'
5
5
  import {ResponsiveWidthProps} from '../types'
@@ -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,6 +1,6 @@
1
1
  import {Card, Code, Flex} from '@sanity/ui'
2
2
  import {useSelect} from '@sanity/ui-workshop'
3
- import styled from 'styled-components'
3
+ import {styled} from 'styled-components'
4
4
  import {WORKSHOP_FLEX_DIRECTION_OPTIONS} from '../../../__workshop__/constants'
5
5
 
6
6
  const DebugCard = styled(Card)`
@@ -1,5 +1,5 @@
1
1
  import {forwardRef} from 'react'
2
- import styled from 'styled-components'
2
+ import {styled} from 'styled-components'
3
3
  import {useArrayProp} from '../../hooks'
4
4
  import {
5
5
  flexItemStyle,