@sanity/ui 2.0.0-beta.1 → 2.0.0-beta.11

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 (89) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +6 -3
  3. package/dist/index.cjs.mjs +11 -36
  4. package/dist/index.d.ts +248 -268
  5. package/dist/index.esm.js +502 -356
  6. package/dist/index.esm.js.map +1 -1
  7. package/dist/index.js +511 -569
  8. package/dist/index.js.map +1 -1
  9. package/dist/theme.cjs.mjs +1 -1
  10. package/dist/theme.d.ts +81 -114
  11. package/dist/theme.esm.js +355 -290
  12. package/dist/theme.esm.js.map +1 -1
  13. package/dist/theme.js +355 -290
  14. package/dist/theme.js.map +1 -1
  15. package/package.json +6 -3
  16. package/src/core/__workshop__/constants.ts +3 -2
  17. package/src/core/_compat.ts +236 -87
  18. package/src/core/components/menu/__workshop__/selectedItem.tsx +7 -2
  19. package/src/core/components/menu/menuButton.tsx +12 -1
  20. package/src/core/constants.ts +18 -0
  21. package/src/core/hooks/useMediaIndex/useMediaIndex.test.tsx +6 -3
  22. package/src/core/middleware/origin.ts +47 -0
  23. package/src/core/primitives/avatar/__workshop__/asButton.tsx +1 -1
  24. package/src/core/primitives/avatar/__workshop__/stack.tsx +1 -1
  25. package/src/core/primitives/avatar/avatar.tsx +14 -4
  26. package/src/core/primitives/avatar/avatarCounter.tsx +16 -5
  27. package/src/core/primitives/avatar/avatarStack.tsx +2 -2
  28. package/src/core/primitives/badge/badge.tsx +1 -3
  29. package/src/core/primitives/kbd/kbd.tsx +2 -0
  30. package/src/core/primitives/popover/popover.tsx +67 -13
  31. package/src/core/primitives/popover/popoverCard.tsx +26 -15
  32. package/src/core/primitives/select/select.tsx +1 -1
  33. package/src/core/primitives/switch/styles.ts +6 -1
  34. package/src/core/primitives/textInput/__workshop__/plain.tsx +1 -1
  35. package/src/core/primitives/textInput/__workshop__/states.tsx +10 -2
  36. package/src/core/primitives/tooltip/tooltip.tsx +47 -57
  37. package/src/core/primitives/tooltip/tooltipCard.tsx +104 -0
  38. package/src/core/styles/card/_cardColorStyle.ts +2 -0
  39. package/src/core/styles/input/textInputStyle.ts +33 -2
  40. package/src/core/styles/margin/marginsStyle.test.ts +2 -2
  41. package/src/core/styles/padding/paddingStyle.test.ts +2 -2
  42. package/src/core/theme/__workshop__/build/Root.tsx +20 -3
  43. package/src/core/theme/__workshop__/build/story.tsx +16 -10
  44. package/src/core/theme/__workshop__/canvas.tsx +7 -7
  45. package/src/core/theme/__workshop__/debug/story.tsx +196 -0
  46. package/src/core/theme/__workshop__/index.ts +5 -0
  47. package/src/core/theme/theme.test.tsx +2 -2
  48. package/src/core/types/avatar.ts +1 -1
  49. package/src/core/types/button.ts +1 -2
  50. package/src/core/{primitives/tooltip → utils/conditionalWrapper}/conditionalWrapper.tsx +3 -0
  51. package/src/core/utils/conditionalWrapper/index.ts +1 -0
  52. package/src/core/utils/index.ts +1 -0
  53. package/src/theme/build/_deprecated/color/factory.ts +3 -3
  54. package/src/theme/build/buildColorTheme.test.ts +2 -2
  55. package/src/theme/build/buildColorTheme.ts +16 -16
  56. package/src/theme/build/colorToken/colorToken.ts +19 -0
  57. package/src/theme/build/colorToken/compileColorToken.ts +21 -0
  58. package/src/theme/build/colorToken/index.ts +2 -0
  59. package/src/theme/build/colorToken/types.ts +6 -0
  60. package/src/theme/build/renderColorTheme.ts +14 -15
  61. package/src/theme/build/renderColorValue.ts +9 -2
  62. package/src/theme/config/system.ts +12 -10
  63. package/src/theme/config/tokens/color/types.ts +12 -1
  64. package/src/theme/config/tokens/parseTokenKey.ts +1 -0
  65. package/src/theme/config/tokens/parseTokenValue.test.ts +13 -16
  66. package/src/theme/config/tokens/parseTokenValue.ts +45 -14
  67. package/src/theme/config/tokens/types.ts +3 -2
  68. package/src/theme/defaults/colorTokens.ts +278 -252
  69. package/src/theme/defaults/config.ts +2 -1
  70. package/src/theme/defaults/fonts.ts +13 -5
  71. package/src/theme/index.ts +0 -7
  72. package/src/theme/system/color/_constants.ts +5 -2
  73. package/src/theme/system/color/_system.ts +2 -1
  74. package/src/theme/system/color/avatar.ts +2 -12
  75. package/src/theme/system/color/button.ts +4 -20
  76. package/src/theme/system/color/input.ts +3 -11
  77. package/src/theme/system/color/selectable.ts +3 -14
  78. package/src/theme/system/shadow.ts +0 -6
  79. package/src/theme/system/styles.ts +0 -6
  80. package/src/theme/system/theme.ts +2 -0
  81. package/src/theme/system/v0/avatar.ts +1 -1
  82. package/src/theme/system/v0/color/button.ts +4 -4
  83. package/src/theme/system/v0/color/card.ts +2 -2
  84. package/src/theme/system/v0/color/input.ts +3 -3
  85. package/src/theme/system/v0/color/muted.ts +2 -2
  86. package/src/theme/system/v0/color/solid.ts +2 -2
  87. package/src/theme/versioning/themeColor_v0_v2.ts +2 -2
  88. package/src/theme/versioning/v2_v0.ts +2 -2
  89. package/src/theme/build/colorToken.ts +0 -39
@@ -12,6 +12,8 @@ export function _cardColorStyle(
12
12
  return {
13
13
  // from base
14
14
 
15
+ '--card-backdrop-color': base.backdrop,
16
+
15
17
  '--card-focus-ring-color': base.focusRing,
16
18
 
17
19
  '--card-shadow-outline-color': base.shadow.outline,
@@ -195,9 +195,10 @@ export function textInputRepresentationStyle(
195
195
  }
196
196
 
197
197
  /* disabled */
198
- *:disabled + & {
198
+ *:not(:invalid):disabled + & {
199
199
  --card-bg-color: ${color.input.default.disabled.bg} !important;
200
200
  --card-fg-color: ${color.input.default.disabled.fg} !important;
201
+ --card-icon-color: ${color.input.default.disabled.fg} !important;
201
202
 
202
203
  &[data-border] {
203
204
  --input-box-shadow: ${focusRingBorderStyle({
@@ -207,12 +208,30 @@ export function textInputRepresentationStyle(
207
208
  }
208
209
  }
209
210
 
211
+ *:invalid:disabled + & {
212
+ --card-bg-color: ${color.input.invalid.disabled.bg} !important;
213
+ --card-fg-color: ${color.input.invalid.disabled.fg} !important;
214
+ --card-icon-color: ${color.input.invalid.disabled.fg} !important;
215
+
216
+ &[data-border] {
217
+ --input-box-shadow: ${focusRingBorderStyle({
218
+ color: color.input.invalid.disabled.border,
219
+ width: input.border.width,
220
+ })};
221
+ }
222
+ }
223
+
210
224
  /* readOnly */
211
- *:read-only + & {
225
+ *:not(:invalid):read-only + & {
212
226
  --card-bg-color: ${color.input.default.readOnly.bg} !important;
213
227
  --card-fg-color: ${color.input.default.readOnly.fg} !important;
214
228
  }
215
229
 
230
+ *:invalid:read-only + & {
231
+ --card-bg-color: ${color.input.invalid.readOnly.bg} !important;
232
+ --card-fg-color: ${color.input.invalid.readOnly.fg} !important;
233
+ }
234
+
216
235
  /* hovered */
217
236
  @media (hover: hover) {
218
237
  *:not(:disabled):not(:read-only):not(:invalid):hover + & {
@@ -220,12 +239,24 @@ export function textInputRepresentationStyle(
220
239
  --card-fg-color: ${color.input.default.hovered.fg};
221
240
  }
222
241
 
242
+ *:invalid:not(:disabled):not(:read-only):hover + & {
243
+ --card-bg-color: ${color.input.invalid.hovered.bg};
244
+ --card-fg-color: ${color.input.invalid.hovered.fg};
245
+ }
246
+
223
247
  *:not(:disabled):not(:read-only):not(:invalid):not(:focus):hover + &[data-border] {
224
248
  --input-box-shadow: ${focusRingBorderStyle({
225
249
  color: color.input.default.hovered.border,
226
250
  width: input.border.width,
227
251
  })};
228
252
  }
253
+
254
+ *:invalid:not(:disabled):not(:read-only):not(:focus):hover + &[data-border] {
255
+ --input-box-shadow: ${focusRingBorderStyle({
256
+ color: color.input.invalid.hovered.border,
257
+ width: input.border.width,
258
+ })};
259
+ }
229
260
  }
230
261
  }
231
262
  `
@@ -1,9 +1,9 @@
1
1
  /** @jest-environment jsdom */
2
2
 
3
- import {getScopedTheme, defaultTheme} from '@sanity/ui/theme'
3
+ import {buildTheme, getScopedTheme} from '@sanity/ui/theme'
4
4
  import {responsiveMarginStyle} from './marginStyle'
5
5
 
6
- const theme = getScopedTheme(defaultTheme, 'light', 'default')
6
+ const theme = getScopedTheme(buildTheme(), 'light', 'default')
7
7
 
8
8
  describe('styles/margin', () => {
9
9
  it('should 1', () => {
@@ -1,9 +1,9 @@
1
1
  /** @jest-environment jsdom */
2
2
 
3
- import {getScopedTheme, defaultTheme} from '@sanity/ui/theme'
3
+ import {buildTheme, getScopedTheme} from '@sanity/ui/theme'
4
4
  import {responsivePaddingStyle} from './paddingStyle'
5
5
 
6
- const theme = getScopedTheme(defaultTheme, 'light', 'default')
6
+ const theme = getScopedTheme(buildTheme(), 'light', 'default')
7
7
 
8
8
  describe('styles/padding', () => {
9
9
  it('should 1', () => {
@@ -159,6 +159,7 @@ export const Root = styled.div((props) => {
159
159
  --link-fg: var(--card-enabled-link-fg);
160
160
  --code-bg: var(--card-enabled-code-bg);
161
161
  --code-fg: var(--card-enabled-code-fg);
162
+ --kbd-bg: var(--card-enabled-kbd-bg);
162
163
  --skeleton-from: var(--card-enabled-skeleton-from);
163
164
  --skeleton-to: var(--card-enabled-skeleton-to);
164
165
 
@@ -322,15 +323,15 @@ export const Root = styled.div((props) => {
322
323
  color: var(--icon);
323
324
  }
324
325
 
325
- .muted-fg {
326
+ .muted {
326
327
  color: var(--muted-fg);
327
328
  }
328
329
 
329
- .accent-fg {
330
+ .accent {
330
331
  color: var(--accent-fg);
331
332
  }
332
333
 
333
- .link-fg {
334
+ .link {
334
335
  color: var(--link-fg);
335
336
  }
336
337
 
@@ -339,6 +340,22 @@ export const Root = styled.div((props) => {
339
340
  color: var(--code-fg);
340
341
  }
341
342
 
343
+ .kbd {
344
+ background-color: var(--kbd-bg);
345
+ color: var(--kbd-fg);
346
+ }
347
+
348
+ .badge {
349
+ background-color: var(--badge-bg);
350
+ color: var(--badge-fg);
351
+ }
352
+
353
+ .badge--default {
354
+ --badge-bg: var(--badge-default-bg);
355
+ --badge-fg: var(--badge-default-fg);
356
+ --badge-border: var(--badge-default-border);
357
+ }
358
+
342
359
  .skeleton-from {
343
360
  color: var(--skeleton-from);
344
361
  }
@@ -1,27 +1,27 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
2
 
3
3
  import {
4
- ThemeColorButtonStates_v2,
4
+ ThemeColorButtonTone_v2,
5
5
  ThemeColorCard_v2,
6
- ThemeColorInputStates_v2,
6
+ ThemeColorInputMode_v2,
7
7
  ThemeColorState_v2,
8
8
  } from '@sanity/ui/theme'
9
9
  import {
10
- THEME_COLOR_CARD_TONES,
11
10
  THEME_COLOR_BUTTON_MODES,
11
+ THEME_COLOR_CARD_TONES,
12
12
  THEME_COLOR_INPUT_MODES,
13
13
  THEME_COLOR_STATE_TONES,
14
14
  ThemeColorCardToneKey,
15
15
  ThemeColorInputModeKey,
16
16
  } from '@sanity/ui/theme'
17
- import {defaultTheme} from '@sanity/ui/theme'
17
+ import {buildTheme} from '@sanity/ui/theme'
18
18
  import {ReactElement} from 'react'
19
19
  import {rem} from '../../../styles'
20
20
  import {useTheme_v2} from '../../useTheme'
21
21
  import {getCSSProps} from './helpers'
22
22
  import {Root} from './Root'
23
23
 
24
- const theme = defaultTheme
24
+ const theme = buildTheme()
25
25
 
26
26
  export default function BuildStory(): ReactElement {
27
27
  return (
@@ -268,7 +268,7 @@ function StatePreview(props: {theme: ThemeColorState_v2}) {
268
268
  )
269
269
  }
270
270
 
271
- function ButtonPreview(props: {theme: ThemeColorButtonStates_v2}) {
271
+ function ButtonPreview(props: {theme: ThemeColorButtonTone_v2}) {
272
272
  const {theme: button} = props
273
273
 
274
274
  return (
@@ -289,18 +289,24 @@ function ButtonPreview(props: {theme: ThemeColorButtonStates_v2}) {
289
289
  <div className="icon" style={{flex: 'none'}}>
290
290
  &copy;
291
291
  </div>
292
- <div className="muted-fg" style={{flex: 'none'}}>
292
+ <div className="muted" style={{flex: 'none'}}>
293
293
  m
294
294
  </div>
295
- <div className="accent-fg" style={{flex: 'none'}}>
295
+ <div className="accent" style={{flex: 'none'}}>
296
296
  a
297
297
  </div>
298
- <div className="link-fg" style={{flex: 'none'}}>
298
+ <div className="link" style={{flex: 'none'}}>
299
299
  l
300
300
  </div>
301
301
  <div className="code" style={{flex: 'none'}}>
302
302
  c
303
303
  </div>
304
+ <div className="kbd" style={{flex: 'none'}}>
305
+ k
306
+ </div>
307
+ <div className="badge badge--default" style={{flex: 'none'}}>
308
+ b
309
+ </div>
304
310
  <div style={{flex: 'none'}}>
305
311
  <CheckeredBackground />
306
312
  </div>
@@ -424,7 +430,7 @@ function Skeleton() {
424
430
  )
425
431
  }
426
432
 
427
- function InputPreview(props: {mode: ThemeColorInputModeKey; theme: ThemeColorInputStates_v2}) {
433
+ function InputPreview(props: {mode: ThemeColorInputModeKey; theme: ThemeColorInputMode_v2}) {
428
434
  const {mode, theme: input} = props
429
435
 
430
436
  return (
@@ -10,14 +10,14 @@ import {
10
10
  useRootTheme,
11
11
  } from '@sanity/ui'
12
12
  import {
13
- ThemeColorButtonStates_v2,
14
- ThemeColorButtonTones_v2,
13
+ ThemeColorButtonMode_v2,
14
+ ThemeColorButtonTone_v2,
15
15
  ThemeColorButton_v2,
16
+ ThemeColorCard_v2,
16
17
  ThemeColorScheme_v2,
17
- ThemeColorSelectableStates_v2,
18
+ ThemeColorSelectableTone_v2,
18
19
  ThemeColorSelectable_v2,
19
20
  ThemeColorState_v2,
20
- ThemeColorCard_v2,
21
21
  getContrastRatio,
22
22
  mix,
23
23
  parseColor,
@@ -202,7 +202,7 @@ function ColorButton(props: {color: ThemeColorButton_v2}) {
202
202
  )
203
203
  }
204
204
 
205
- function ColorButtonMode(props: {color: ThemeColorButtonTones_v2}) {
205
+ function ColorButtonMode(props: {color: ThemeColorButtonMode_v2}) {
206
206
  const {color} = props
207
207
 
208
208
  return (
@@ -243,7 +243,7 @@ function ColorButtonMode(props: {color: ThemeColorButtonTones_v2}) {
243
243
  )
244
244
  }
245
245
 
246
- function ColorGenericStates(props: {color: ThemeColorButtonStates_v2}) {
246
+ function ColorGenericStates(props: {color: ThemeColorButtonTone_v2}) {
247
247
  const {color} = props
248
248
 
249
249
  return (
@@ -335,7 +335,7 @@ function ColorSelectable(props: {color: ThemeColorSelectable_v2}) {
335
335
  )
336
336
  }
337
337
 
338
- function ColorSelectableTone(props: {color: ThemeColorSelectableStates_v2}) {
338
+ function ColorSelectableTone(props: {color: ThemeColorSelectableTone_v2}) {
339
339
  const {color} = props
340
340
 
341
341
  return (
@@ -0,0 +1,196 @@
1
+ import {CropIcon} from '@sanity/icons'
2
+ import {
3
+ THEME_COLOR_BUTTON_MODES,
4
+ THEME_COLOR_CARD_TONES,
5
+ THEME_COLOR_SCHEMES,
6
+ THEME_COLOR_STATES,
7
+ THEME_COLOR_STATE_TONES,
8
+ ThemeColorCard_v2,
9
+ ThemeColorScheme_v2,
10
+ ThemeColorState_v2,
11
+ } from '@sanity/ui/theme'
12
+ import {useBoolean} from '@sanity/ui-workshop'
13
+ import {CSSProperties} from 'react'
14
+ import {Badge, Box, Flex, KBD, Stack, Text} from '../../../primitives'
15
+ import {useRootTheme} from '../../useRootTheme'
16
+
17
+ export default function DebugStory() {
18
+ const {color} = useRootTheme().theme.v2!
19
+
20
+ return (
21
+ <Flex>
22
+ {THEME_COLOR_SCHEMES.map((scheme) => (
23
+ <DebugScheme key={scheme} scheme={color[scheme]} />
24
+ ))}
25
+ </Flex>
26
+ )
27
+ }
28
+
29
+ function DebugScheme(props: {scheme: ThemeColorScheme_v2}) {
30
+ const {scheme} = props
31
+
32
+ const button = useBoolean('Button', false, 'Props') || false
33
+ const selectable = useBoolean('Selectable', false, 'Props') || false
34
+
35
+ return (
36
+ <Box flex={1} style={{backgroundColor: scheme.default.bg}}>
37
+ {THEME_COLOR_CARD_TONES.map((tone) => (
38
+ <DebugCard card={scheme[tone]} features={{button, selectable}} key={tone} />
39
+ ))}
40
+ </Box>
41
+ )
42
+ }
43
+
44
+ function DebugCard(props: {
45
+ card: ThemeColorCard_v2
46
+ features: {button: boolean; selectable: boolean}
47
+ }) {
48
+ const {card, features} = props
49
+
50
+ // card.avatar
51
+ // card.backdrop
52
+ // card.badge
53
+ // card.button
54
+ // card.focusRing
55
+ // card.icon
56
+ // card.input
57
+ // card.kbd
58
+ // card.link
59
+ // card.selectable
60
+ // card.shadow
61
+ // card.skeleton
62
+ // card.syntax
63
+
64
+ return (
65
+ <Box style={getStateVars(card)}>
66
+ <DebugState />
67
+
68
+ {features.button && (
69
+ <Stack padding={2} space={1}>
70
+ {THEME_COLOR_BUTTON_MODES.map((mode) => (
71
+ <Stack key={mode} space={1}>
72
+ {THEME_COLOR_STATE_TONES.map((stateTone) => (
73
+ <Flex key={stateTone} gap={1}>
74
+ {/* {mode} */}
75
+ {THEME_COLOR_STATES.map((state) => (
76
+ <Box
77
+ flex={1}
78
+ key={state}
79
+ style={getStateVars(card.button[mode][stateTone][state])}
80
+ >
81
+ <DebugState />
82
+ </Box>
83
+ ))}
84
+ </Flex>
85
+ ))}
86
+ </Stack>
87
+ ))}
88
+ </Stack>
89
+ )}
90
+
91
+ {features.selectable && (
92
+ <Stack padding={2} space={1}>
93
+ {THEME_COLOR_STATE_TONES.map((stateTone) => (
94
+ <Flex key={stateTone} gap={1}>
95
+ {/* {mode} */}
96
+ {THEME_COLOR_STATES.map((state) => (
97
+ <Box flex={1} key={state} style={getStateVars(card.selectable[stateTone][state])}>
98
+ <DebugState />
99
+ </Box>
100
+ ))}
101
+ </Flex>
102
+ ))}
103
+ </Stack>
104
+ )}
105
+ </Box>
106
+ )
107
+ }
108
+
109
+ function DebugState() {
110
+ return (
111
+ <Stack
112
+ overflow="auto"
113
+ padding={4}
114
+ space={3}
115
+ style={{border: '1px solid var(--card-border-color)'}}
116
+ >
117
+ <Flex gap={3}>
118
+ <Text size={1}>Text</Text>
119
+ <Text size={1}>
120
+ <CropIcon />
121
+ </Text>
122
+ </Flex>
123
+ <Text muted size={1}>
124
+ Muted
125
+ </Text>
126
+ <Text accent size={1}>
127
+ Accent
128
+ </Text>
129
+ <Text size={1}>
130
+ <code>Code</code>
131
+ </Text>
132
+ <div>
133
+ <KBD>Cmd</KBD>
134
+ </div>
135
+ <Flex gap={1}>
136
+ {THEME_COLOR_STATE_TONES.map((stateTone) => (
137
+ <Box flex="none" key={stateTone}>
138
+ <Badge tone={stateTone}>{stateTone}</Badge>
139
+ </Box>
140
+ ))}
141
+ </Flex>
142
+ <div style={{borderBottom: '1px solid var(--card-border-color)'}} />
143
+ </Stack>
144
+ )
145
+ }
146
+
147
+ function getStateVars(state: ThemeColorState_v2) {
148
+ return {
149
+ '--card-accent-fg-color': state.accent.fg,
150
+
151
+ '--card-code-bg-color': state.code.bg,
152
+ '--card-code-fg-color': state.code.fg,
153
+
154
+ '--card-bg-color': state.bg,
155
+
156
+ '--card-border-color': state.border,
157
+
158
+ '--card-fg-color': state.fg,
159
+
160
+ '--card-icon-color': state.icon,
161
+
162
+ '--card-muted-fg-color': state.muted.fg,
163
+
164
+ '--card-kbd-bg-color': state.kbd.bg,
165
+ '--card-kbd-border-color': state.kbd.border,
166
+ '--card-kbd-fg-color': state.kbd.fg,
167
+
168
+ '--card-badge-default-bg-color': state.badge.default.bg,
169
+ '--card-badge-default-dot-color': state.badge.default.dot,
170
+ '--card-badge-default-fg-color': state.badge.default.fg,
171
+ '--card-badge-default-icon-color': state.badge.default.icon,
172
+
173
+ '--card-badge-primary-bg-color': state.badge.primary.bg,
174
+ '--card-badge-primary-dot-color': state.badge.primary.dot,
175
+ '--card-badge-primary-fg-color': state.badge.primary.fg,
176
+ '--card-badge-primary-icon-color': state.badge.primary.icon,
177
+
178
+ '--card-badge-positive-bg-color': state.badge.positive.bg,
179
+ '--card-badge-positive-dot-color': state.badge.positive.dot,
180
+ '--card-badge-positive-fg-color': state.badge.positive.fg,
181
+ '--card-badge-positive-icon-color': state.badge.positive.icon,
182
+
183
+ '--card-badge-caution-bg-color': state.badge.caution.bg,
184
+ '--card-badge-caution-dot-color': state.badge.caution.dot,
185
+ '--card-badge-caution-fg-color': state.badge.caution.fg,
186
+ '--card-badge-caution-icon-color': state.badge.caution.icon,
187
+
188
+ '--card-badge-critical-bg-color': state.badge.critical.bg,
189
+ '--card-badge-critical-dot-color': state.badge.critical.dot,
190
+ '--card-badge-critical-fg-color': state.badge.critical.fg,
191
+ '--card-badge-critical-icon-color': state.badge.critical.icon,
192
+
193
+ backgroundColor: 'var(--card-bg-color)',
194
+ color: 'var(--card-fg-color)',
195
+ } as CSSProperties
196
+ }
@@ -5,6 +5,11 @@ export default defineScope({
5
5
  name: 'theme',
6
6
  title: 'Theme',
7
7
  stories: [
8
+ {
9
+ name: 'debug',
10
+ title: 'Debug',
11
+ component: lazy(() => import('./debug/story')),
12
+ },
8
13
  {
9
14
  name: 'build',
10
15
  title: 'Build theme',
@@ -1,7 +1,7 @@
1
1
  /** @jest-environment jsdom */
2
2
  /* eslint-disable @typescript-eslint/no-explicit-any */
3
3
 
4
- import {defaultTheme} from '@sanity/ui/theme'
4
+ import {buildTheme} from '@sanity/ui/theme'
5
5
  import {render} from '../../../test'
6
6
  import {ThemeContext} from './themeContext'
7
7
  import {ThemeContextValue} from './types'
@@ -24,7 +24,7 @@ describe('theme', () => {
24
24
  const value: ThemeContextValue = {
25
25
  version: 0.0,
26
26
  scheme: 'light',
27
- theme: defaultTheme,
27
+ theme: buildTheme(),
28
28
  tone: 'default',
29
29
  }
30
30
 
@@ -6,7 +6,7 @@ export type AvatarPosition = 'top' | 'bottom' | 'inside'
6
6
  /**
7
7
  * @public
8
8
  */
9
- export type AvatarSize = 0 | 1 | 2
9
+ export type AvatarSize = 0 | 1 | 2 | 3
10
10
 
11
11
  /**
12
12
  * @public
@@ -1,5 +1,4 @@
1
- import {ThemeColorStateToneKey} from '@sanity/ui/theme'
2
- import {ThemeColorButtonModeKey} from '../_compat'
1
+ import {ThemeColorButtonModeKey, ThemeColorStateToneKey} from '@sanity/ui/theme'
3
2
 
4
3
  /**
5
4
  * @public
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @internal
3
+ */
1
4
  export function ConditionalWrapper({
2
5
  children,
3
6
  condition,
@@ -0,0 +1 @@
1
+ export * from './conditionalWrapper'
@@ -1,5 +1,6 @@
1
1
  export * from './arrow'
2
2
  export * from './boundaryElement'
3
+ export * from './conditionalWrapper'
3
4
  export * from './elementQuery'
4
5
  export * from './errorBoundary'
5
6
  export * from './layer'
@@ -27,7 +27,7 @@ import {createSpot} from './spot/createSpot'
27
27
 
28
28
  /**
29
29
  * @public
30
- * @deprecated
30
+ * @deprecated Use `buildColorTheme` instead.
31
31
  */
32
32
  export interface ThemeColorBuilderOpts {
33
33
  base: (opts: {dark: boolean; name: ThemeColorName}) => ThemeColorBase
@@ -82,13 +82,13 @@ export interface ThemeColorBuilderOpts {
82
82
 
83
83
  /**
84
84
  * @public
85
- * @deprecated
85
+ * @deprecated Use `ThemeConfig` instead.
86
86
  */
87
87
  export type PartialThemeColorBuilderOpts = Partial<ThemeColorBuilderOpts>
88
88
 
89
89
  /**
90
90
  * @public
91
- * @deprecated Use `buildTheme` instead
91
+ * @deprecated Use `buildColorTheme` instead.
92
92
  */
93
93
  export function createColorTheme(
94
94
  partialOpts: PartialThemeColorBuilderOpts = {},
@@ -65,7 +65,7 @@ test('buildColorTheme: base', () => {
65
65
  light: {
66
66
  transparent: {
67
67
  bg: 'gray/50',
68
- fg: 'gray/600',
68
+ fg: 'gray/800',
69
69
  },
70
70
  default: {
71
71
  bg: 'white',
@@ -79,7 +79,7 @@ test('buildColorTheme: base', () => {
79
79
  dark: {
80
80
  transparent: {
81
81
  bg: 'black',
82
- fg: 'gray/400',
82
+ fg: 'gray/200',
83
83
  },
84
84
  default: {
85
85
  bg: 'gray/950',