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

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 (67) hide show
  1. package/dist/index.cjs.mjs +10 -36
  2. package/dist/index.d.ts +180 -239
  3. package/dist/index.esm.js +105 -84
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/index.js +113 -297
  6. package/dist/index.js.map +1 -1
  7. package/dist/theme.cjs.mjs +1 -1
  8. package/dist/theme.d.ts +75 -111
  9. package/dist/theme.esm.js +169 -97
  10. package/dist/theme.esm.js.map +1 -1
  11. package/dist/theme.js +169 -97
  12. package/dist/theme.js.map +1 -1
  13. package/package.json +1 -1
  14. package/src/core/__workshop__/constants.ts +3 -2
  15. package/src/core/_compat.ts +236 -87
  16. package/src/core/hooks/useMediaIndex/useMediaIndex.test.tsx +6 -3
  17. package/src/core/primitives/avatar/__workshop__/asButton.tsx +1 -1
  18. package/src/core/primitives/avatar/__workshop__/stack.tsx +1 -1
  19. package/src/core/primitives/avatar/avatar.tsx +14 -4
  20. package/src/core/primitives/avatar/avatarCounter.tsx +16 -5
  21. package/src/core/primitives/avatar/avatarStack.tsx +2 -2
  22. package/src/core/primitives/kbd/kbd.tsx +2 -0
  23. package/src/core/primitives/tooltip/tooltip.tsx +1 -1
  24. package/src/core/styles/margin/marginsStyle.test.ts +2 -2
  25. package/src/core/styles/padding/paddingStyle.test.ts +2 -2
  26. package/src/core/theme/__workshop__/build/Root.tsx +20 -3
  27. package/src/core/theme/__workshop__/build/story.tsx +16 -10
  28. package/src/core/theme/__workshop__/canvas.tsx +7 -7
  29. package/src/core/theme/__workshop__/debug/story.tsx +159 -0
  30. package/src/core/theme/__workshop__/index.ts +5 -0
  31. package/src/core/theme/theme.test.tsx +2 -2
  32. package/src/core/types/avatar.ts +1 -1
  33. package/src/core/types/button.ts +1 -2
  34. package/src/theme/build/_deprecated/color/factory.ts +3 -3
  35. package/src/theme/build/buildColorTheme.ts +16 -16
  36. package/src/theme/build/colorToken/colorToken.ts +19 -0
  37. package/src/theme/build/colorToken/compileColorToken.ts +17 -0
  38. package/src/theme/build/colorToken/index.ts +2 -0
  39. package/src/theme/build/colorToken/types.ts +6 -0
  40. package/src/theme/build/renderColorTheme.ts +14 -15
  41. package/src/theme/build/renderColorValue.ts +1 -1
  42. package/src/theme/config/system.ts +9 -9
  43. package/src/theme/config/tokens/color/types.ts +12 -1
  44. package/src/theme/config/tokens/parseTokenKey.ts +1 -0
  45. package/src/theme/config/tokens/parseTokenValue.ts +1 -0
  46. package/src/theme/defaults/colorTokens.ts +127 -66
  47. package/src/theme/defaults/config.ts +1 -0
  48. package/src/theme/defaults/fonts.ts +13 -5
  49. package/src/theme/index.ts +0 -7
  50. package/src/theme/system/color/_constants.ts +5 -2
  51. package/src/theme/system/color/_system.ts +2 -1
  52. package/src/theme/system/color/avatar.ts +2 -12
  53. package/src/theme/system/color/button.ts +4 -20
  54. package/src/theme/system/color/input.ts +3 -11
  55. package/src/theme/system/color/selectable.ts +3 -14
  56. package/src/theme/system/shadow.ts +0 -6
  57. package/src/theme/system/styles.ts +0 -6
  58. package/src/theme/system/theme.ts +2 -0
  59. package/src/theme/system/v0/avatar.ts +1 -1
  60. package/src/theme/system/v0/color/button.ts +4 -4
  61. package/src/theme/system/v0/color/card.ts +2 -2
  62. package/src/theme/system/v0/color/input.ts +3 -3
  63. package/src/theme/system/v0/color/muted.ts +2 -2
  64. package/src/theme/system/v0/color/solid.ts +2 -2
  65. package/src/theme/versioning/themeColor_v0_v2.ts +2 -2
  66. package/src/theme/versioning/v2_v0.ts +2 -2
  67. package/src/theme/build/colorToken.ts +0 -39
@@ -9,7 +9,7 @@ import {
9
9
  ThemeColorBlendModeKey,
10
10
  } from '../system'
11
11
 
12
- /** @internal */
12
+ /** @public */
13
13
  export const COLOR_CONFIG_STATE_KEYS = [
14
14
  '_hue',
15
15
  'bg',
@@ -30,7 +30,7 @@ export const COLOR_CONFIG_STATE_KEYS = [
30
30
  /** @public */
31
31
  export type ColorConfigStateKey = (typeof COLOR_CONFIG_STATE_KEYS)[number]
32
32
 
33
- /** @internal */
33
+ /** @public */
34
34
  export const COLOR_CONFIG_CARD_KEYS = [
35
35
  ...COLOR_CONFIG_STATE_KEYS,
36
36
  '_hue',
@@ -47,7 +47,7 @@ export const COLOR_CONFIG_CARD_KEYS = [
47
47
  /** @public */
48
48
  export type ColorConfigCardKey = (typeof COLOR_CONFIG_CARD_KEYS)[number]
49
49
 
50
- /** @internal */
50
+ /** @public */
51
51
  export const COLOR_CONFIG_BLEND_KEYS = ['_blend'] as const
52
52
 
53
53
  /** @public */
@@ -75,37 +75,37 @@ export type ThemeColorTokenValue = [ColorConfigValue, ColorConfigValue]
75
75
  /** @public */
76
76
  export type ColorBlendModeTokenValue = [ThemeColorBlendModeKey, ThemeColorBlendModeKey]
77
77
 
78
- /** @internal */
78
+ /** @public */
79
79
  export const COLOR_CONFIG_AVATAR_COLORS = ['*', ...THEME_COLOR_AVATAR_COLORS] as const
80
80
 
81
81
  /** @public */
82
82
  export type ColorConfigAvatarColor = (typeof COLOR_CONFIG_AVATAR_COLORS)[number]
83
83
 
84
- /** @internal */
84
+ /** @public */
85
85
  export const COLOR_CONFIG_CARD_TONES = ['*', ...THEME_COLOR_CARD_TONES] as const
86
86
 
87
87
  /** @public */
88
88
  export type ColorConfigCardTone = (typeof COLOR_CONFIG_CARD_TONES)[number]
89
89
 
90
- /** @internal */
90
+ /** @public */
91
91
  export const COLOR_CONFIG_STATE_TONES = ['*', ...THEME_COLOR_STATE_TONES] as const
92
92
 
93
93
  /** @public */
94
94
  export type ColorConfigStateTone = (typeof COLOR_CONFIG_STATE_TONES)[number]
95
95
 
96
- /** @internal */
96
+ /** @public */
97
97
  export const COLOR_CONFIG_STATES = ['*', ...THEME_COLOR_STATES] as const
98
98
 
99
99
  /** @public */
100
100
  export type ColorConfigState = (typeof COLOR_CONFIG_STATES)[number]
101
101
 
102
- /** @internal */
102
+ /** @public */
103
103
  export const COLOR_CONFIG_INPUT_MODES = ['*', ...THEME_COLOR_INPUT_MODES] as const
104
104
 
105
105
  /** @public */
106
106
  export type ColorConfigInputMode = (typeof COLOR_CONFIG_INPUT_MODES)[number]
107
107
 
108
- /** @internal */
108
+ /** @public */
109
109
  export const COLOR_CONFIG_INPUT_STATES = ['*', ...THEME_COLOR_INPUT_STATES] as const
110
110
 
111
111
  /** @public */
@@ -10,6 +10,7 @@ import {
10
10
  ThemeColorTokenValue,
11
11
  } from '../../system'
12
12
 
13
+ /** @public */
13
14
  export interface ThemeColorAvatarHueTokens {
14
15
  _blend?: ColorBlendModeTokenValue
15
16
  _hue?: ColorHueKey
@@ -17,6 +18,7 @@ export interface ThemeColorAvatarHueTokens {
17
18
  fg?: ThemeColorTokenValue
18
19
  }
19
20
 
21
+ /** @public */
20
22
  export interface ThemeColorAvatarTokens {
21
23
  '*'?: ThemeColorAvatarHueTokens
22
24
  gray?: ThemeColorAvatarHueTokens
@@ -30,8 +32,8 @@ export interface ThemeColorAvatarTokens {
30
32
  cyan?: ThemeColorAvatarHueTokens
31
33
  }
32
34
 
35
+ /** @public */
33
36
  export interface ThemeColorBadgeTokens {
34
- // _blend?: ColorBlendModeTokenValue
35
37
  _hue?: ColorHueKey
36
38
  bg?: ThemeColorTokenValue
37
39
  fg?: ThemeColorTokenValue
@@ -39,6 +41,7 @@ export interface ThemeColorBadgeTokens {
39
41
  icon?: ThemeColorTokenValue
40
42
  }
41
43
 
44
+ /** @public */
42
45
  export interface ThemeColorBaseTokens extends ThemeColorStateTokens {
43
46
  focusRing?: ThemeColorTokenValue
44
47
  backdrop?: ThemeColorTokenValue
@@ -50,6 +53,7 @@ export interface ThemeColorBaseTokens extends ThemeColorStateTokens {
50
53
  }
51
54
  }
52
55
 
56
+ /** @public */
53
57
  export interface ThemeColorBadgeToneTokens {
54
58
  _blend?: ColorBlendModeTokenValue
55
59
  _hue?: ColorHueKey
@@ -59,6 +63,7 @@ export interface ThemeColorBadgeToneTokens {
59
63
  icon?: ThemeColorTokenValue
60
64
  }
61
65
 
66
+ /** @public */
62
67
  export interface ThemeColorBadgeTokens {
63
68
  '*'?: ThemeColorBadgeToneTokens
64
69
  default?: ThemeColorBadgeToneTokens
@@ -68,6 +73,7 @@ export interface ThemeColorBadgeTokens {
68
73
  critical?: ThemeColorBadgeToneTokens
69
74
  }
70
75
 
76
+ /** @public */
71
77
  export interface ThemeColorStateTokens {
72
78
  _blend?: ColorBlendModeTokenValue
73
79
  _hue?: ColorHueKey
@@ -102,13 +108,16 @@ export interface ThemeColorStateTokens {
102
108
  }
103
109
  }
104
110
 
111
+ /** @public */
105
112
  export type ThemeColorStatesTokens = Partial<Record<ColorConfigState, ThemeColorStateTokens>>
106
113
 
114
+ /** @public */
107
115
  export interface ThemeColorButtonTokens
108
116
  extends Partial<Record<ColorConfigStateTone, ThemeColorStatesTokens>> {
109
117
  _hue?: ColorHueKey
110
118
  }
111
119
 
120
+ /** @public */
112
121
  export interface ThemeColorInputStateTokens {
113
122
  _blend?: ColorBlendModeTokenValue
114
123
  _hue?: ColorHueKey
@@ -121,11 +130,13 @@ export interface ThemeColorInputStateTokens {
121
130
  placeholder?: ThemeColorTokenValue
122
131
  }
123
132
 
133
+ /** @public */
124
134
  export interface ThemeColorInputTokens
125
135
  extends Partial<Record<ColorConfigInputState, ThemeColorInputStateTokens>> {
126
136
  _hue?: ColorHueKey
127
137
  }
128
138
 
139
+ /** @public */
129
140
  export interface ThemeColorTokens {
130
141
  base?: Partial<Record<ColorConfigCardTone, ThemeColorBaseTokens>>
131
142
  button?: Partial<Record<ThemeColorButtonModeKey, ThemeColorButtonTokens>>
@@ -8,6 +8,7 @@ import {
8
8
  } from '../helpers'
9
9
  import {TokenKeyNode} from './types'
10
10
 
11
+ /** @internal */
11
12
  export function parseTokenKey(str: string): TokenKeyNode | undefined {
12
13
  const segments = str.split('/')
13
14
  const segment0 = segments.shift() || ''
@@ -2,6 +2,7 @@ import {isColorBlendModeValue, isColorHueKey, isColorTintKey} from '../../system
2
2
  import {isColorOpacityValue, isColorValue} from '../helpers'
3
3
  import {TokenValueNode} from './types'
4
4
 
5
+ /** @internal */
5
6
  export function parseTokenValue(str: string): TokenValueNode | undefined {
6
7
  const segments = str.split('/')
7
8
  const segment0 = segments.shift() || ''
@@ -4,6 +4,9 @@ export const defaultColorTokens: ThemeColorTokens = {
4
4
  base: {
5
5
  '*': {
6
6
  _blend: ['multiply', 'screen'],
7
+ accent: {
8
+ fg: ['purple/600', 'purple/400'],
9
+ },
7
10
  avatar: {
8
11
  '*': {
9
12
  _blend: ['screen', 'multiply'],
@@ -19,6 +22,8 @@ export const defaultColorTokens: ThemeColorTokens = {
19
22
  '*': {
20
23
  bg: ['100', '900'],
21
24
  fg: ['600', '400'],
25
+ icon: ['500', '500'],
26
+ dot: ['500', '500'],
22
27
  },
23
28
  positive: {
24
29
  bg: ['200/0.6', '900'],
@@ -33,7 +38,7 @@ export const defaultColorTokens: ThemeColorTokens = {
33
38
  border: ['200', '800'],
34
39
  code: {
35
40
  bg: ['50', '950'],
36
- fg: ['600', '400'],
41
+ fg: ['700', '300'],
37
42
  },
38
43
  fg: ['800', '200'],
39
44
  focusRing: ['blue/500', 'blue/500'],
@@ -43,7 +48,7 @@ export const defaultColorTokens: ThemeColorTokens = {
43
48
  border: ['200', '800'],
44
49
  },
45
50
  link: {
46
- fg: ['blue/600', 'blue/400'],
51
+ fg: ['blue/700', 'blue/300'],
47
52
  },
48
53
  muted: {
49
54
  bg: ['50', '950'],
@@ -100,8 +105,10 @@ export const defaultColorTokens: ThemeColorTokens = {
100
105
  },
101
106
  badge: {
102
107
  '*': {
103
- dot: ['300', '700'],
104
- icon: ['600', '400'],
108
+ bg: ['900', '100'],
109
+ fg: ['400', '600'],
110
+ dot: ['500', '500'],
111
+ icon: ['500', '500'],
105
112
  },
106
113
  },
107
114
  bg: ['500', '400'],
@@ -113,8 +120,8 @@ export const defaultColorTokens: ThemeColorTokens = {
113
120
  fg: ['white', 'black'],
114
121
  icon: ['200', '800'],
115
122
  kbd: {
116
- bg: ['900', '50'],
117
- fg: ['white', 'black'],
123
+ bg: ['black', 'white'],
124
+ fg: ['200', '800'],
118
125
  border: ['800', '200'],
119
126
  },
120
127
  link: {
@@ -141,8 +148,21 @@ export const defaultColorTokens: ThemeColorTokens = {
141
148
  },
142
149
  disabled: {
143
150
  _hue: 'gray',
151
+ badge: {
152
+ '*': {
153
+ bg: ['gray/700', 'gray/300'],
154
+ fg: ['white', 'black'],
155
+ dot: ['white', 'black'],
156
+ icon: ['white', 'black'],
157
+ },
158
+ },
144
159
  bg: ['200', '800'],
145
160
  icon: ['white', 'black'],
161
+ kbd: {
162
+ bg: ['black', 'white'],
163
+ fg: ['white', 'black'],
164
+ border: ['700', '300'],
165
+ },
146
166
  },
147
167
  },
148
168
  default: {
@@ -192,12 +212,29 @@ export const defaultColorTokens: ThemeColorTokens = {
192
212
  '*': {
193
213
  '*': {
194
214
  _blend: ['multiply', 'screen'],
215
+ accent: {
216
+ fg: ['purple/700/0.6', 'purple/400/0.8'],
217
+ },
218
+ badge: {
219
+ '*': {
220
+ bg: ['100', '900'],
221
+ fg: ['600', '400'],
222
+ dot: ['500', '500'],
223
+ icon: ['500', '500'],
224
+ },
225
+ },
195
226
  bg: ['50', '950'],
227
+ border: ['100', '900'],
228
+ code: {
229
+ bg: ['500/0.1', '400/0.1'],
230
+ fg: ['700/0.6', '400/0.6'],
231
+ },
196
232
  fg: ['700', '400'],
197
233
  icon: ['600', '500'],
198
- border: ['100', '900'],
199
- accent: {
200
- fg: ['purple/700/0.6', 'purple/400/0.8'],
234
+ kbd: {
235
+ bg: ['white', 'black'],
236
+ fg: ['600', '400'],
237
+ border: ['200', '800'],
201
238
  },
202
239
  link: {
203
240
  fg: ['blue/700/0.6', 'blue/400/0.8'],
@@ -206,20 +243,10 @@ export const defaultColorTokens: ThemeColorTokens = {
206
243
  bg: ['100', '950'],
207
244
  fg: ['700/0.6', '400/0.6'],
208
245
  },
209
- code: {
210
- bg: ['500/0.1', '400/0.1'],
211
- fg: ['700/0.6', '400/0.6'],
212
- },
213
246
  skeleton: {
214
247
  from: ['100', '900'],
215
248
  to: ['100/0.5', '900/0.5'],
216
249
  },
217
- badge: {
218
- '*': {
219
- dot: ['300', '700'],
220
- icon: ['600', '400'],
221
- },
222
- },
223
250
  },
224
251
  hovered: {
225
252
  bg: ['100', '900'],
@@ -235,21 +262,35 @@ export const defaultColorTokens: ThemeColorTokens = {
235
262
  },
236
263
  disabled: {
237
264
  _hue: 'gray',
238
- fg: ['200', '800'],
239
- icon: ['200', '800'],
265
+ accent: {
266
+ fg: ['200', '800'],
267
+ },
268
+ badge: {
269
+ '*': {
270
+ _hue: 'gray',
271
+ bg: ['50', '950'],
272
+ fg: ['gray/200', 'gray/800'],
273
+ dot: ['gray/200', 'gray/800'],
274
+ icon: ['gray/200', 'gray/800'],
275
+ },
276
+ },
240
277
  border: ['100', '900'],
241
- muted: {
242
- fg: ['200/0.6', '900/0.6'],
278
+ code: {
279
+ bg: ['50', '950'],
280
+ fg: ['200', '800'],
243
281
  },
244
- accent: {
245
- fg: ['200/0.6', '900/0.6'],
282
+ fg: ['200', '800'],
283
+ icon: ['200', '800'],
284
+ kbd: {
285
+ bg: ['white', 'black'],
286
+ fg: ['200', '800'],
287
+ border: ['100', '900'],
246
288
  },
247
289
  link: {
248
- fg: ['200/0.6', '900/0.6'],
290
+ fg: ['200', '800'],
249
291
  },
250
- code: {
251
- bg: ['50/0.5', '950/0.5'],
252
- fg: ['200/0.6', '900/0.6'],
292
+ muted: {
293
+ fg: ['200', '800'],
253
294
  },
254
295
  },
255
296
  },
@@ -268,34 +309,41 @@ export const defaultColorTokens: ThemeColorTokens = {
268
309
  '*': {
269
310
  '*': {
270
311
  _blend: ['multiply', 'screen'],
312
+ accent: {
313
+ fg: ['purple/700/0.7', 'purple/300/0.7'],
314
+ },
315
+ badge: {
316
+ '*': {
317
+ bg: ['100', '900'],
318
+ fg: ['600', '400'],
319
+ dot: ['500', '500'],
320
+ icon: ['500', '500'],
321
+ },
322
+ },
271
323
  bg: ['white', 'black'],
272
- fg: ['700', '300'],
273
- icon: ['700/0.7', '300/0.7'],
274
324
  border: ['white/0', 'black/0'],
275
- muted: {
325
+ code: {
276
326
  bg: ['100', '950'],
277
- fg: ['700/0.7', '300/0.7'],
327
+ fg: ['600', '300'],
278
328
  },
279
- accent: {
280
- fg: ['purple/700/0.7', 'purple/300/0.7'],
329
+ fg: ['700', '300'],
330
+ icon: ['700/0.7', '300/0.7'],
331
+ kbd: {
332
+ bg: ['white', 'black'],
333
+ fg: ['600', '400'],
334
+ border: ['200', '800'],
281
335
  },
282
336
  link: {
283
337
  fg: ['blue/700/0.7', 'blue/300/0.7'],
284
338
  },
285
- code: {
339
+ muted: {
286
340
  bg: ['100', '950'],
287
- fg: ['600', '300'],
341
+ fg: ['700/0.7', '300/0.7'],
288
342
  },
289
343
  skeleton: {
290
344
  from: ['100', '900'],
291
345
  to: ['100/0.5', '900/0.5'],
292
346
  },
293
- badge: {
294
- '*': {
295
- dot: ['300', '700'],
296
- icon: ['600', '400'],
297
- },
298
- },
299
347
  },
300
348
  hovered: {
301
349
  bg: ['50', '950'],
@@ -314,19 +362,33 @@ export const defaultColorTokens: ThemeColorTokens = {
314
362
  },
315
363
  disabled: {
316
364
  _hue: 'gray',
365
+ badge: {
366
+ '*': {
367
+ _hue: 'gray',
368
+ bg: ['50', '950'],
369
+ fg: ['gray/200', 'gray/800'],
370
+ dot: ['gray/200', 'gray/800'],
371
+ icon: ['gray/200', 'gray/800'],
372
+ },
373
+ },
317
374
  fg: ['200', '800'],
318
375
  muted: {
319
- fg: ['200/0.6', '900/0.6'],
376
+ fg: ['200', '800'],
320
377
  },
321
378
  accent: {
322
- fg: ['200/0.6', '900/0.6'],
379
+ fg: ['200', '800'],
380
+ },
381
+ kbd: {
382
+ bg: ['white', 'black'],
383
+ fg: ['200', '800'],
384
+ border: ['100', '900'],
323
385
  },
324
386
  link: {
325
- fg: ['200/0.6', '900/0.6'],
387
+ fg: ['200', '800'],
326
388
  },
327
389
  code: {
328
- bg: ['50/0.5', '950/0.5'],
329
- fg: ['200/0.6', '900/0.6'],
390
+ bg: ['50', '950'],
391
+ fg: ['200', '800'],
330
392
  },
331
393
  },
332
394
  },
@@ -380,9 +442,18 @@ export const defaultColorTokens: ThemeColorTokens = {
380
442
  bg: ['500', '400'],
381
443
  fg: ['white', 'black'],
382
444
  },
383
- // yellow: {bg: ['600', '400']},
384
- // green: {bg: ['600', '400']},
385
- // cyan: {bg: ['600', '400']},
445
+ yellow: {bg: ['600', '400']},
446
+ green: {bg: ['600', '400']},
447
+ cyan: {bg: ['600', '400']},
448
+ },
449
+ badge: {
450
+ '*': {
451
+ // _blend: ['multiply', 'screen'],
452
+ bg: ['100', '900'],
453
+ fg: ['600', '400'],
454
+ dot: ['500', '500'],
455
+ icon: ['500', '500'],
456
+ },
386
457
  },
387
458
  border: ['200', '800'],
388
459
  muted: {
@@ -392,6 +463,11 @@ export const defaultColorTokens: ThemeColorTokens = {
392
463
  accent: {
393
464
  fg: ['purple/600', 'purple/400'],
394
465
  },
466
+ kbd: {
467
+ bg: ['white', 'black'],
468
+ fg: ['600', '400'],
469
+ border: ['200', '800'],
470
+ },
395
471
  link: {
396
472
  fg: ['blue/700', 'blue/300'],
397
473
  },
@@ -403,21 +479,6 @@ export const defaultColorTokens: ThemeColorTokens = {
403
479
  from: ['100', '900'],
404
480
  to: ['100/0.5', '900/0.5'],
405
481
  },
406
- badge: {
407
- '*': {
408
- // _blend: ['multiply', 'screen'],
409
- bg: ['100', '900'],
410
- fg: ['600', '200'],
411
- dot: ['300', '700'],
412
- icon: ['600', '400'],
413
- },
414
- },
415
- kbd: {
416
- // _blend: ['multiply', 'screen'],
417
- bg: ['white', 'black'],
418
- fg: ['600', '400'],
419
- border: ['200', '800'],
420
- },
421
482
  },
422
483
  hovered: {
423
484
  bg: ['50', '950'],
@@ -7,6 +7,7 @@ export const defaultThemeConfig: Omit<RootTheme_v2, 'color' | 'font'> = {
7
7
  _version: 2,
8
8
  avatar: {
9
9
  sizes: [
10
+ {distance: -4, size: 19},
10
11
  {distance: -4, size: 25},
11
12
  {distance: -8, size: 33},
12
13
  {distance: -12, size: 49},
@@ -125,7 +125,15 @@ export const defaultThemeFonts: ThemeFonts = {
125
125
  {
126
126
  ascenderHeight: 2,
127
127
  descenderHeight: 2,
128
- fontSize: 9.8,
128
+ fontSize: 8.1,
129
+ iconSize: 13,
130
+ lineHeight: 10,
131
+ letterSpacing: 0.5,
132
+ },
133
+ {
134
+ ascenderHeight: 2,
135
+ descenderHeight: 2,
136
+ fontSize: 9.5,
129
137
  iconSize: 15,
130
138
  lineHeight: 11,
131
139
  letterSpacing: 0.5,
@@ -133,7 +141,7 @@ export const defaultThemeFonts: ThemeFonts = {
133
141
  {
134
142
  ascenderHeight: 2,
135
143
  descenderHeight: 2,
136
- fontSize: 11.25,
144
+ fontSize: 10.8,
137
145
  iconSize: 17,
138
146
  lineHeight: 12,
139
147
  letterSpacing: 0.5,
@@ -141,7 +149,7 @@ export const defaultThemeFonts: ThemeFonts = {
141
149
  {
142
150
  ascenderHeight: 2,
143
151
  descenderHeight: 2,
144
- fontSize: 12.75,
152
+ fontSize: 12.25,
145
153
  iconSize: 19,
146
154
  lineHeight: 13,
147
155
  letterSpacing: 0.5,
@@ -149,7 +157,7 @@ export const defaultThemeFonts: ThemeFonts = {
149
157
  {
150
158
  ascenderHeight: 2,
151
159
  descenderHeight: 2,
152
- fontSize: 14,
160
+ fontSize: 13.6,
153
161
  iconSize: 21,
154
162
  lineHeight: 14,
155
163
  letterSpacing: 0.5,
@@ -157,7 +165,7 @@ export const defaultThemeFonts: ThemeFonts = {
157
165
  {
158
166
  ascenderHeight: 2,
159
167
  descenderHeight: 2,
160
- fontSize: 15.5,
168
+ fontSize: 15,
161
169
  iconSize: 23,
162
170
  lineHeight: 15,
163
171
  letterSpacing: 0.5,
@@ -1,12 +1,5 @@
1
- import {buildTheme} from './build'
2
-
3
1
  export * from './build'
4
2
  export * from './config'
5
3
  export * from './getScopedTheme'
6
4
  export * from './system'
7
5
  export * from './versioning'
8
-
9
- /**
10
- * @public
11
- */
12
- export const defaultTheme = buildTheme()
@@ -1,5 +1,8 @@
1
1
  import {COLOR_HUES} from '@sanity/color'
2
2
 
3
+ /** @public */
4
+ export const THEME_COLOR_SCHEMES = ['light', 'dark'] as const
5
+
3
6
  /** @public */
4
7
  export const THEME_COLOR_BLEND_MODES = ['multiply', 'screen'] as const
5
8
 
@@ -7,7 +10,7 @@ export const THEME_COLOR_BLEND_MODES = ['multiply', 'screen'] as const
7
10
  export const THEME_COLOR_CARD_TONES = [
8
11
  'transparent',
9
12
  'default',
10
- 'primary', // todo: rename to `accent` in the next breaking major version
13
+ 'primary',
11
14
  'positive',
12
15
  'caution',
13
16
  'critical',
@@ -16,7 +19,7 @@ export const THEME_COLOR_CARD_TONES = [
16
19
  /** @public */
17
20
  export const THEME_COLOR_STATE_TONES = [
18
21
  'default',
19
- 'primary', // todo: rename to `accent` in the next breaking major version
22
+ 'primary',
20
23
  'positive',
21
24
  'caution',
22
25
  'critical',
@@ -5,6 +5,7 @@ import {
5
5
  THEME_COLOR_CARD_TONES,
6
6
  THEME_COLOR_INPUT_MODES,
7
7
  THEME_COLOR_INPUT_STATES,
8
+ THEME_COLOR_SCHEMES,
8
9
  THEME_COLOR_STATES,
9
10
  THEME_COLOR_STATE_TONES,
10
11
  } from './_constants'
@@ -12,7 +13,7 @@ import {
12
13
  /**
13
14
  * @public
14
15
  */
15
- export type ThemeColorSchemeKey = 'dark' | 'light'
16
+ export type ThemeColorSchemeKey = (typeof THEME_COLOR_SCHEMES)[number]
16
17
 
17
18
  /** @public */
18
19
  export type ThemeColorBlendModeKey = (typeof THEME_COLOR_BLEND_MODES)[number]
@@ -1,4 +1,4 @@
1
- import {ThemeColorBlendModeKey} from './_system'
1
+ import {ThemeColorAvatarColorKey, ThemeColorBlendModeKey} from './_system'
2
2
 
3
3
  /**
4
4
  * @public
@@ -12,14 +12,4 @@ export interface ThemeColorAvatarHue_v2 {
12
12
  /**
13
13
  * @public
14
14
  */
15
- export interface ThemeColorAvatar_v2 {
16
- gray: ThemeColorAvatarHue_v2
17
- blue: ThemeColorAvatarHue_v2
18
- purple: ThemeColorAvatarHue_v2
19
- magenta: ThemeColorAvatarHue_v2
20
- red: ThemeColorAvatarHue_v2
21
- orange: ThemeColorAvatarHue_v2
22
- yellow: ThemeColorAvatarHue_v2
23
- green: ThemeColorAvatarHue_v2
24
- cyan: ThemeColorAvatarHue_v2
25
- }
15
+ export type ThemeColorAvatar_v2 = Record<ThemeColorAvatarColorKey, ThemeColorAvatarHue_v2>
@@ -1,33 +1,17 @@
1
+ import {ThemeColorButtonModeKey, ThemeColorStateKey, ThemeColorStateToneKey} from './_system'
1
2
  import {ThemeColorState_v2} from './state'
2
3
 
3
4
  /**
4
5
  * @public
5
6
  */
6
- export interface ThemeColorButtonStates_v2 {
7
- enabled: ThemeColorState_v2
8
- hovered: ThemeColorState_v2
9
- pressed: ThemeColorState_v2
10
- selected: ThemeColorState_v2
11
- disabled: ThemeColorState_v2
12
- }
7
+ export type ThemeColorButtonTone_v2 = Record<ThemeColorStateKey, ThemeColorState_v2>
13
8
 
14
9
  /**
15
- * TODO: Rename to `ThemeColorButtonMode`.
16
10
  * @public
17
11
  */
18
- export interface ThemeColorButtonTones_v2 {
19
- default: ThemeColorButtonStates_v2
20
- primary: ThemeColorButtonStates_v2
21
- positive: ThemeColorButtonStates_v2
22
- caution: ThemeColorButtonStates_v2
23
- critical: ThemeColorButtonStates_v2
24
- }
12
+ export type ThemeColorButtonMode_v2 = Record<ThemeColorStateToneKey, ThemeColorButtonTone_v2>
25
13
 
26
14
  /**
27
15
  * @public
28
16
  */
29
- export interface ThemeColorButton_v2 {
30
- default: ThemeColorButtonTones_v2
31
- ghost: ThemeColorButtonTones_v2
32
- bleed: ThemeColorButtonTones_v2
33
- }
17
+ export type ThemeColorButton_v2 = Record<ThemeColorButtonModeKey, ThemeColorButtonMode_v2>