@sanity/ui 2.0.0-alpha.34 → 2.0.0-alpha.35

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 (163) hide show
  1. package/dist/index.cjs.mjs +4 -3
  2. package/dist/index.d.ts +29 -22
  3. package/dist/index.esm.js +397 -518
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/index.js +413 -534
  6. package/dist/index.js.map +1 -1
  7. package/dist/theme.cjs.mjs +10 -4
  8. package/dist/theme.d.ts +450 -187
  9. package/dist/theme.esm.js +2933 -2750
  10. package/dist/theme.esm.js.map +1 -1
  11. package/dist/theme.js +2942 -2753
  12. package/dist/theme.js.map +1 -1
  13. package/package.json +3 -3
  14. package/src/core/_compat.ts +7 -7
  15. package/src/core/components/dialog/dialog.tsx +5 -5
  16. package/src/core/components/dialog/styles.ts +4 -5
  17. package/src/core/components/hotkeys/hotkeys.tsx +4 -2
  18. package/src/core/components/menu/__workshop__/avatarMenu.tsx +50 -0
  19. package/src/core/components/menu/__workshop__/index.ts +5 -0
  20. package/src/core/components/menu/menuItem.tsx +7 -1
  21. package/src/core/components/skeleton/textSkeleton.tsx +12 -14
  22. package/src/core/components/tree/style.ts +14 -17
  23. package/src/core/hooks/useMediaIndex/useMediaIndex.test.tsx +3 -3
  24. package/src/core/hooks/useMediaIndex/useMediaIndex.ts +2 -3
  25. package/src/core/primitives/_selectable/style.ts +18 -18
  26. package/src/core/primitives/avatar/avatar.tsx +3 -3
  27. package/src/core/primitives/avatar/avatarCounter.tsx +4 -4
  28. package/src/core/primitives/avatar/avatarStack.tsx +2 -2
  29. package/src/core/primitives/avatar/styles.ts +7 -8
  30. package/src/core/primitives/avatar/types.ts +2 -2
  31. package/src/core/primitives/badge/__workshop__/props.tsx +1 -1
  32. package/src/core/primitives/badge/__workshop__/tones.tsx +1 -1
  33. package/src/core/primitives/badge/badge.tsx +1 -1
  34. package/src/core/primitives/badge/styles.ts +5 -6
  35. package/src/core/primitives/button/button.tsx +3 -4
  36. package/src/core/primitives/button/styles.ts +22 -23
  37. package/src/core/primitives/card/__workshop__/selected.tsx +15 -15
  38. package/src/core/primitives/card/card.tsx +1 -1
  39. package/src/core/primitives/card/styles.ts +22 -22
  40. package/src/core/primitives/checkbox/styles.ts +21 -22
  41. package/src/core/primitives/code/styles.ts +4 -1
  42. package/src/core/primitives/container/styles.ts +2 -3
  43. package/src/core/primitives/heading/styles.ts +4 -2
  44. package/src/core/primitives/inline/styles.ts +6 -6
  45. package/src/core/primitives/kbd/kbd.tsx +7 -11
  46. package/src/core/primitives/label/styles.ts +4 -3
  47. package/src/core/primitives/popover/helpers.ts +3 -4
  48. package/src/core/primitives/popover/popover.tsx +8 -4
  49. package/src/core/primitives/popover/types.ts +1 -1
  50. package/src/core/primitives/radio/styles.ts +17 -19
  51. package/src/core/primitives/select/styles.ts +27 -32
  52. package/src/core/primitives/stack/styles.ts +2 -3
  53. package/src/core/primitives/switch/__workshop__/props.tsx +11 -31
  54. package/src/core/primitives/switch/styles.ts +18 -21
  55. package/src/core/primitives/text/__workshop__/colored.tsx +10 -10
  56. package/src/core/primitives/text/styles.ts +9 -4
  57. package/src/core/primitives/tooltip/tooltip.tsx +3 -3
  58. package/src/core/styles/border/borderStyle.ts +6 -11
  59. package/src/core/styles/box/boxStyle.ts +5 -9
  60. package/src/core/styles/card/_cardColorStyle.ts +99 -0
  61. package/src/core/styles/card/index.ts +1 -0
  62. package/src/core/styles/flex/flexItemStyle.ts +2 -3
  63. package/src/core/styles/flex/flexStyle.ts +6 -11
  64. package/src/core/styles/font/responsiveFont.ts +4 -4
  65. package/src/core/styles/font/textAlignStyle.ts +3 -3
  66. package/src/core/styles/grid/gridItemStyle.ts +7 -13
  67. package/src/core/styles/grid/gridStyle.ts +9 -17
  68. package/src/core/styles/helpers.ts +5 -3
  69. package/src/core/styles/input/responsiveInputPaddingStyle.ts +6 -6
  70. package/src/core/styles/input/textInputStyle.ts +36 -40
  71. package/src/core/styles/margin/marginsStyle.test.ts +2 -3
  72. package/src/core/styles/padding/paddingStyle.test.ts +2 -3
  73. package/src/core/styles/radius/radiusStyle.ts +2 -3
  74. package/src/core/styles/shadow/shadowStyle.ts +4 -5
  75. package/src/core/theme/__workshop__/build/Root.tsx +24 -20
  76. package/src/core/theme/__workshop__/build/story.tsx +22 -26
  77. package/src/core/theme/__workshop__/canvas.tsx +21 -40
  78. package/src/core/theme/theme.test.tsx +2 -35
  79. package/src/core/theme/themeColorProvider.tsx +2 -2
  80. package/src/core/theme/themeContext.ts +2 -2
  81. package/src/core/theme/themeProvider.tsx +25 -25
  82. package/src/core/theme/types.ts +3 -2
  83. package/src/core/theme/useRootTheme.ts +1 -9
  84. package/src/core/theme/useTheme.ts +8 -1
  85. package/src/core/types/card.ts +2 -2
  86. package/src/core/utils/arrow/arrow.tsx +3 -3
  87. package/src/core/utils/elementQuery/elementQuery.tsx +3 -3
  88. package/src/core/utils/virtualList/virtualList.tsx +2 -2
  89. package/src/theme/build/_deprecated/color/muted/createMuted.ts +2 -2
  90. package/src/theme/build/buildColorTheme.test.ts +14 -15
  91. package/src/theme/build/buildColorTheme.ts +239 -292
  92. package/src/theme/build/buildTheme.test.ts +9 -7
  93. package/src/theme/build/buildTheme.ts +12 -9
  94. package/src/theme/build/colorToken.ts +3 -1
  95. package/src/theme/build/lib/color-fns/contrastRatio.ts +1 -0
  96. package/src/theme/build/lib/isRecord.ts +3 -0
  97. package/src/theme/build/merge.ts +18 -13
  98. package/src/theme/build/renderColorTheme.ts +205 -213
  99. package/src/theme/build/renderColorValue.ts +15 -8
  100. package/src/theme/build/resolveColorTokens.ts +177 -198
  101. package/src/theme/build/theme.test.ts +27 -0
  102. package/src/theme/config/helpers.ts +16 -8
  103. package/src/theme/config/system.ts +46 -17
  104. package/src/theme/config/tokens/color/types.ts +55 -32
  105. package/src/theme/config/tokens/types.ts +11 -4
  106. package/src/theme/config/types.ts +5 -11
  107. package/src/theme/{build/defaults → defaults}/colorPalette.ts +1 -1
  108. package/src/theme/{build/defaults → defaults}/colorTokens.ts +189 -136
  109. package/src/theme/{build/defaults → defaults}/config.ts +14 -12
  110. package/src/theme/{build/defaults → defaults}/fonts.ts +6 -6
  111. package/src/theme/getScopedTheme.ts +81 -0
  112. package/src/theme/index.ts +9 -1
  113. package/src/theme/system/avatar.ts +1 -1
  114. package/src/theme/system/color/_constants.ts +11 -11
  115. package/src/theme/system/color/_system.ts +10 -71
  116. package/src/theme/system/color/avatar.ts +22 -10
  117. package/src/theme/system/color/badge.ts +18 -7
  118. package/src/theme/system/color/button.ts +17 -23
  119. package/src/theme/system/color/color.ts +34 -0
  120. package/src/theme/system/color/index.ts +3 -10
  121. package/src/theme/system/color/input.ts +13 -11
  122. package/src/theme/system/color/kbd.ts +3 -3
  123. package/src/theme/system/color/selectable.ts +13 -19
  124. package/src/theme/system/color/shadow.ts +7 -0
  125. package/src/theme/system/color/state.ts +37 -0
  126. package/src/theme/system/css.ts +9 -0
  127. package/src/theme/system/focusRing.ts +7 -0
  128. package/src/theme/system/index.ts +5 -1
  129. package/src/theme/system/input.ts +1 -1
  130. package/src/theme/system/layer.ts +1 -2
  131. package/src/theme/system/shadow.ts +1 -0
  132. package/src/theme/system/styles.ts +19 -0
  133. package/src/theme/system/theme.ts +97 -0
  134. package/src/theme/system/{color → v0/color}/_generic.ts +2 -1
  135. package/src/theme/system/v0/color/_system.ts +13 -0
  136. package/src/theme/system/{color → v0/color}/base.ts +2 -0
  137. package/src/theme/system/v0/color/button.ts +42 -0
  138. package/src/theme/system/{color → v0/color}/card.ts +2 -1
  139. package/src/theme/system/v0/color/color.ts +40 -0
  140. package/src/theme/system/v0/color/index.ts +11 -0
  141. package/src/theme/system/v0/color/input.ts +34 -0
  142. package/src/theme/system/{color/_deprecated → v0/color}/muted.ts +1 -1
  143. package/src/theme/system/v0/color/selectable.ts +31 -0
  144. package/src/theme/system/{color/_deprecated → v0/color}/solid.ts +1 -1
  145. package/src/theme/system/v0/color/spot.ts +13 -0
  146. package/src/theme/system/v0/index.ts +1 -0
  147. package/src/theme/versioning/getTheme_v2.ts +35 -0
  148. package/src/theme/versioning/index.ts +5 -0
  149. package/src/theme/versioning/is_v0.ts +6 -0
  150. package/src/theme/versioning/is_v2.ts +6 -0
  151. package/src/theme/versioning/themeColor_v0_v2.ts +217 -0
  152. package/src/theme/versioning/v0_v2.ts +70 -0
  153. package/src/theme/versioning/v2_v0.ts +128 -0
  154. package/src/core/styles/colorVars/colorVarsStyle.ts +0 -43
  155. package/src/core/styles/colorVars/index.ts +0 -1
  156. package/src/core/theme/defaults.ts +0 -7
  157. package/src/theme/system/_system.ts +0 -95
  158. package/src/theme/system/color/_deprecated/spot.ts +0 -13
  159. package/src/theme/themes/studio/config.ts +0 -69
  160. package/src/theme/themes/studio/fonts.ts +0 -219
  161. package/src/theme/themes/studio/index.ts +0 -1
  162. package/src/theme/themes/studio/studioTheme.test.ts +0 -27
  163. package/src/theme/themes/studio/studioTheme.ts +0 -8
@@ -1,4 +1,4 @@
1
- import {ThemeFocusRing} from './_system'
1
+ import {ThemeFocusRing} from './focusRing'
2
2
 
3
3
  /**
4
4
  * @public
@@ -1,38 +1,38 @@
1
1
  import {COLOR_HUES} from '@sanity/color'
2
2
 
3
- /** @internal */
3
+ /** @public */
4
4
  export const THEME_COLOR_BLEND_MODES = ['multiply', 'screen'] as const
5
5
 
6
- /** @internal */
7
- export const THEME_COLOR_BASE_TONES = [
6
+ /** @public */
7
+ export const THEME_COLOR_CARD_TONES = [
8
8
  'transparent',
9
9
  'default',
10
- 'primary', // todo: rename to `accent`
10
+ 'primary', // todo: rename to `accent` in the next breaking major version
11
11
  'positive',
12
12
  'caution',
13
13
  'critical',
14
14
  ] as const
15
15
 
16
- /** @internal */
16
+ /** @public */
17
17
  export const THEME_COLOR_STATE_TONES = [
18
18
  'default',
19
- 'primary', // todo: rename to `accent`
19
+ 'primary', // todo: rename to `accent` in the next breaking major version
20
20
  'positive',
21
21
  'caution',
22
22
  'critical',
23
23
  ] as const
24
24
 
25
- /** @internal */
25
+ /** @public */
26
26
  export const THEME_COLOR_STATES = ['enabled', 'hovered', 'pressed', 'selected', 'disabled'] as const
27
27
 
28
- /** @internal */
28
+ /** @public */
29
29
  export const THEME_COLOR_BUTTON_MODES = ['default', 'ghost', 'bleed'] as const
30
30
 
31
- /** @internal */
31
+ /** @public */
32
32
  export const THEME_COLOR_INPUT_MODES = ['default', 'invalid'] as const
33
33
 
34
- /** @internal */
34
+ /** @public */
35
35
  export const THEME_COLOR_INPUT_STATES = ['enabled', 'hovered', 'readOnly', 'disabled'] as const
36
36
 
37
- /** @internal */
37
+ /** @public */
38
38
  export const THEME_COLOR_AVATAR_COLORS = COLOR_HUES
@@ -1,100 +1,39 @@
1
1
  import {
2
2
  THEME_COLOR_AVATAR_COLORS,
3
- THEME_COLOR_BASE_TONES,
4
3
  THEME_COLOR_BLEND_MODES,
5
4
  THEME_COLOR_BUTTON_MODES,
5
+ THEME_COLOR_CARD_TONES,
6
6
  THEME_COLOR_INPUT_MODES,
7
7
  THEME_COLOR_INPUT_STATES,
8
8
  THEME_COLOR_STATES,
9
9
  THEME_COLOR_STATE_TONES,
10
10
  } from './_constants'
11
- import {ThemeColorMuted} from './_deprecated/muted'
12
- import {ThemeColorSolid} from './_deprecated/solid'
13
- import {ThemeColorSpot} from './_deprecated/spot'
14
- import {ThemeColorAvatar} from './avatar'
15
- import {ThemeColorBadge} from './badge'
16
- import {ThemeColorBase} from './base'
17
- import {ThemeColorButton} from './button'
18
- import {ThemeColorCard} from './card'
19
- import {ThemeColorInput} from './input'
20
- import {ThemeColorKBD} from './kbd'
21
- import {ThemeColorSelectable} from './selectable'
22
- import {ThemeColorSyntax} from './syntax'
23
11
 
24
12
  /**
25
13
  * @public
26
14
  */
27
15
  export type ThemeColorSchemeKey = 'dark' | 'light'
28
16
 
29
- /** @internal */
17
+ /** @public */
30
18
  export type ThemeColorBlendModeKey = (typeof THEME_COLOR_BLEND_MODES)[number]
31
19
 
32
- /** @internal */
33
- export type ThemeColorBaseToneKey = (typeof THEME_COLOR_BASE_TONES)[number]
20
+ /** @public */
21
+ export type ThemeColorCardToneKey = (typeof THEME_COLOR_CARD_TONES)[number]
34
22
 
35
- /** @internal */
23
+ /** @public */
36
24
  export type ThemeColorButtonModeKey = (typeof THEME_COLOR_BUTTON_MODES)[number]
37
25
 
38
- /** @internal */
26
+ /** @public */
39
27
  export type ThemeColorStateKey = (typeof THEME_COLOR_STATES)[number]
40
28
 
41
- /** @internal */
29
+ /** @public */
42
30
  export type ThemeColorStateToneKey = (typeof THEME_COLOR_STATE_TONES)[number]
43
31
 
44
- /** @internal */
32
+ /** @public */
45
33
  export type ThemeColorInputModeKey = (typeof THEME_COLOR_INPUT_MODES)[number]
46
34
 
47
- /** @internal */
35
+ /** @public */
48
36
  export type ThemeColorInputStateKey = (typeof THEME_COLOR_INPUT_STATES)[number]
49
37
 
50
- /** @internal */
38
+ /** @public */
51
39
  export type ThemeColorAvatarColorKey = (typeof THEME_COLOR_AVATAR_COLORS)[number]
52
-
53
- /**
54
- * @public
55
- * @deprecated Use `ThemeColorBaseToneKey` instead.
56
- */
57
- export type ThemeColorName = ThemeColorBaseToneKey
58
-
59
- /**
60
- * @public
61
- * @deprecated Use `ThemeColorBaseToneKey` instead.
62
- */
63
- export type ThemeColorToneKey = ThemeColorBaseToneKey
64
-
65
- /**
66
- * @public
67
- */
68
- export interface ThemeColor {
69
- /** @internal */
70
- _blend?: ThemeColorBlendModeKey
71
- _dark?: boolean
72
- avatar?: ThemeColorAvatar
73
- badge?: ThemeColorBadge
74
- base: ThemeColorBase
75
- button: ThemeColorButton
76
- card: ThemeColorCard
77
- input: ThemeColorInput
78
- kbd?: ThemeColorKBD
79
- selectable?: ThemeColorSelectable
80
- syntax: ThemeColorSyntax
81
-
82
- /** @deprecated Use `_dark` instead */
83
- dark: boolean
84
- /** @deprecated */
85
- muted: ThemeColorMuted
86
- /** @deprecated */
87
- spot: ThemeColorSpot
88
- /** @deprecated */
89
- solid: ThemeColorSolid
90
- }
91
-
92
- /**
93
- * @public
94
- */
95
- export type ThemeColorScheme = Record<ThemeColorBaseToneKey, ThemeColor>
96
-
97
- /**
98
- * @public
99
- */
100
- export type ThemeColorSchemes = Record<ThemeColorSchemeKey, ThemeColorScheme>
@@ -1,13 +1,25 @@
1
1
  import {ThemeColorBlendModeKey} from './_system'
2
2
 
3
- export interface ThemeColorAvatar {
4
- gray: {_blend?: ThemeColorBlendModeKey; bg: string; fg: string}
5
- blue: {_blend?: ThemeColorBlendModeKey; bg: string; fg: string}
6
- purple: {_blend?: ThemeColorBlendModeKey; bg: string; fg: string}
7
- magenta: {_blend?: ThemeColorBlendModeKey; bg: string; fg: string}
8
- red: {_blend?: ThemeColorBlendModeKey; bg: string; fg: string}
9
- orange: {_blend?: ThemeColorBlendModeKey; bg: string; fg: string}
10
- yellow: {_blend?: ThemeColorBlendModeKey; bg: string; fg: string}
11
- green: {_blend?: ThemeColorBlendModeKey; bg: string; fg: string}
12
- cyan: {_blend?: ThemeColorBlendModeKey; bg: string; fg: string}
3
+ /**
4
+ * @public
5
+ */
6
+ export interface ThemeColorAvatarHue_v2 {
7
+ _blend?: ThemeColorBlendModeKey
8
+ bg: string
9
+ fg: string
10
+ }
11
+
12
+ /**
13
+ * @public
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
13
25
  }
@@ -1,9 +1,20 @@
1
- import {ThemeColorBlendModeKey} from './_system'
1
+ /**
2
+ * @public
3
+ */
4
+ export interface ThemeColorBadgeTone_v2 {
5
+ bg: string
6
+ fg: string
7
+ dot: string
8
+ icon: string
9
+ }
2
10
 
3
- export interface ThemeColorBadge {
4
- default: {_blend?: ThemeColorBlendModeKey; bg: string; fg: string}
5
- primary: {_blend?: ThemeColorBlendModeKey; bg: string; fg: string}
6
- positive: {_blend?: ThemeColorBlendModeKey; bg: string; fg: string}
7
- caution: {_blend?: ThemeColorBlendModeKey; bg: string; fg: string}
8
- critical: {_blend?: ThemeColorBlendModeKey; bg: string; fg: string}
11
+ /**
12
+ * @public
13
+ */
14
+ export interface ThemeColorBadge_v2 {
15
+ default: ThemeColorBadgeTone_v2
16
+ primary: ThemeColorBadgeTone_v2
17
+ positive: ThemeColorBadgeTone_v2
18
+ caution: ThemeColorBadgeTone_v2
19
+ critical: ThemeColorBadgeTone_v2
9
20
  }
@@ -1,39 +1,33 @@
1
- import {ThemeColorGenericState} from './_generic'
1
+ import {ThemeColorState_v2} from './state'
2
2
 
3
3
  /**
4
- * @deprecated Use `ThemeColorGenericState` instead.
5
4
  * @public
6
5
  */
7
- export type ThemeColorButtonState = ThemeColorGenericState
8
-
9
- /**
10
- * @public
11
- */
12
- export interface ThemeColorButtonStates {
13
- enabled: ThemeColorGenericState
14
- hovered: ThemeColorGenericState
15
- pressed: ThemeColorGenericState
16
- selected: ThemeColorGenericState
17
- disabled: ThemeColorGenericState
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
18
12
  }
19
13
 
20
14
  /**
21
15
  * TODO: Rename to `ThemeColorButtonMode`.
22
16
  * @public
23
17
  */
24
- export interface ThemeColorButtonTones {
25
- default: ThemeColorButtonStates
26
- primary: ThemeColorButtonStates
27
- positive: ThemeColorButtonStates
28
- caution: ThemeColorButtonStates
29
- critical: ThemeColorButtonStates
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
30
24
  }
31
25
 
32
26
  /**
33
27
  * @public
34
28
  */
35
- export interface ThemeColorButton {
36
- default: ThemeColorButtonTones
37
- ghost: ThemeColorButtonTones
38
- bleed: ThemeColorButtonTones
29
+ export interface ThemeColorButton_v2 {
30
+ default: ThemeColorButtonTones_v2
31
+ ghost: ThemeColorButtonTones_v2
32
+ bleed: ThemeColorButtonTones_v2
39
33
  }
@@ -0,0 +1,34 @@
1
+ import {ThemeColorCardToneKey, ThemeColorBlendModeKey, ThemeColorSchemeKey} from './_system'
2
+ import {ThemeColorButton_v2} from './button'
3
+ import {ThemeColorInput_v2} from './input'
4
+ import {ThemeColorSelectable_v2} from './selectable'
5
+ import {ThemeColorShadow} from './shadow'
6
+ import {ThemeColorState_v2} from './state'
7
+ import {ThemeColorSyntax} from './syntax'
8
+
9
+ /**
10
+ * @public
11
+ */
12
+ export interface ThemeColorCard_v2 extends ThemeColorState_v2 {
13
+ /** @internal */
14
+ _blend: ThemeColorBlendModeKey
15
+ _dark: boolean
16
+
17
+ backdrop: string
18
+ button: ThemeColorButton_v2
19
+ focusRing: string
20
+ input: ThemeColorInput_v2
21
+ selectable: ThemeColorSelectable_v2
22
+ shadow: ThemeColorShadow
23
+ syntax: ThemeColorSyntax
24
+ }
25
+
26
+ /**
27
+ * @public
28
+ */
29
+ export type ThemeColorScheme_v2 = Record<ThemeColorCardToneKey, ThemeColorCard_v2>
30
+
31
+ /**
32
+ * @public
33
+ */
34
+ export type ThemeColorSchemes_v2 = Record<ThemeColorSchemeKey, ThemeColorScheme_v2>
@@ -1,20 +1,13 @@
1
1
  export * from './_constants'
2
2
  export * from './_helpers'
3
3
  export * from './_system'
4
-
5
- //
6
- export * from './_generic'
7
4
  export * from './avatar'
8
5
  export * from './badge'
9
- export * from './base'
10
6
  export * from './button'
11
- export * from './card'
7
+ export * from './color'
12
8
  export * from './input'
13
9
  export * from './kbd'
14
10
  export * from './selectable'
11
+ export * from './shadow'
12
+ export * from './state'
15
13
  export * from './syntax'
16
-
17
- // deprecated
18
- export * from './_deprecated/muted'
19
- export * from './_deprecated/solid'
20
- export * from './_deprecated/spot'
@@ -3,29 +3,31 @@ import {ThemeColorBlendModeKey} from './_system'
3
3
  /**
4
4
  * @public
5
5
  */
6
- export interface ThemeColorInputState {
6
+ export interface ThemeColorInputState_v2 {
7
7
  _blend?: ThemeColorBlendModeKey
8
8
  bg: string
9
- bg2: string
10
- fg: string
11
9
  border: string
10
+ fg: string
11
+ muted: {
12
+ bg: string
13
+ }
12
14
  placeholder: string
13
15
  }
14
16
 
15
17
  /**
16
18
  * @public
17
19
  */
18
- export interface ThemeColorInputStates {
19
- enabled: ThemeColorInputState
20
- disabled: ThemeColorInputState
21
- hovered: ThemeColorInputState
22
- readOnly: ThemeColorInputState
20
+ export interface ThemeColorInputStates_v2 {
21
+ enabled: ThemeColorInputState_v2
22
+ disabled: ThemeColorInputState_v2
23
+ hovered: ThemeColorInputState_v2
24
+ readOnly: ThemeColorInputState_v2
23
25
  }
24
26
 
25
27
  /**
26
28
  * @public
27
29
  */
28
- export interface ThemeColorInput {
29
- default: ThemeColorInputStates
30
- invalid: ThemeColorInputStates
30
+ export interface ThemeColorInput_v2 {
31
+ default: ThemeColorInputStates_v2
32
+ invalid: ThemeColorInputStates_v2
31
33
  }
@@ -1,7 +1,7 @@
1
- import {ThemeColorBlendModeKey} from './_system'
2
-
1
+ /**
2
+ * @public
3
+ */
3
4
  export interface ThemeColorKBD {
4
- _blend?: ThemeColorBlendModeKey
5
5
  bg: string
6
6
  fg: string
7
7
  border: string
@@ -1,29 +1,23 @@
1
- import {ThemeColorGenericState} from './_generic'
1
+ import {ThemeColorState_v2} from './state'
2
2
 
3
3
  /**
4
- * @deprecated Use `ThemeColorGenericState` instead.
5
4
  * @public
6
5
  */
7
- export type ThemeColorSelectableState = ThemeColorGenericState
8
-
9
- /**
10
- * @public
11
- */
12
- export interface ThemeColorSelectableStates {
13
- enabled: ThemeColorSelectableState
14
- hovered: ThemeColorSelectableState
15
- pressed: ThemeColorSelectableState
16
- selected: ThemeColorSelectableState
17
- disabled: ThemeColorSelectableState
6
+ export interface ThemeColorSelectableStates_v2 {
7
+ enabled: ThemeColorState_v2
8
+ hovered: ThemeColorState_v2
9
+ pressed: ThemeColorState_v2
10
+ selected: ThemeColorState_v2
11
+ disabled: ThemeColorState_v2
18
12
  }
19
13
 
20
14
  /**
21
15
  * @public
22
16
  */
23
- export interface ThemeColorSelectable {
24
- default: ThemeColorSelectableStates
25
- primary: ThemeColorSelectableStates
26
- positive: ThemeColorSelectableStates
27
- caution: ThemeColorSelectableStates
28
- critical: ThemeColorSelectableStates
17
+ export interface ThemeColorSelectable_v2 {
18
+ default: ThemeColorSelectableStates_v2
19
+ primary: ThemeColorSelectableStates_v2
20
+ positive: ThemeColorSelectableStates_v2
21
+ caution: ThemeColorSelectableStates_v2
22
+ critical: ThemeColorSelectableStates_v2
29
23
  }
@@ -0,0 +1,7 @@
1
+ /** @public */
2
+ export interface ThemeColorShadow {
3
+ outline: string
4
+ umbra: string
5
+ penumbra: string
6
+ ambient: string
7
+ }
@@ -0,0 +1,37 @@
1
+ import {ThemeColorBlendModeKey} from './_system'
2
+ import {ThemeColorAvatar_v2} from './avatar'
3
+ import {ThemeColorBadge_v2} from './badge'
4
+ import {ThemeColorKBD} from './kbd'
5
+
6
+ /**
7
+ * @public
8
+ */
9
+ export interface ThemeColorState_v2 {
10
+ /** @internal */
11
+ _blend?: ThemeColorBlendModeKey
12
+ accent: {
13
+ fg: string
14
+ }
15
+ avatar: ThemeColorAvatar_v2
16
+ badge: ThemeColorBadge_v2
17
+ bg: string
18
+ border: string
19
+ code: {
20
+ bg: string
21
+ fg: string
22
+ }
23
+ fg: string
24
+ icon: string
25
+ kbd: ThemeColorKBD
26
+ link: {
27
+ fg: string
28
+ }
29
+ muted: {
30
+ bg: string
31
+ fg: string
32
+ }
33
+ skeleton: {
34
+ from: string
35
+ to: string
36
+ }
37
+ }
@@ -0,0 +1,9 @@
1
+ import type {StyledObject} from 'styled-components'
2
+
3
+ /**
4
+ * Work around types that are missing in `styled-components@6`
5
+ * https://github.com/styled-components/styled-components/issues/4062
6
+ * @internal
7
+ * */
8
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
+ export type CSSObject = StyledObject<any>
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @public
3
+ */
4
+ export interface ThemeFocusRing {
5
+ offset: number
6
+ width: number
7
+ }
@@ -1,8 +1,12 @@
1
- export * from './_system'
1
+ export * from './v0'
2
2
 
3
3
  export * from './avatar'
4
4
  export * from './color'
5
+ export * from './css'
6
+ export * from './focusRing'
5
7
  export * from './fonts'
6
8
  export * from './input'
7
9
  export * from './layer'
8
10
  export * from './shadow'
11
+ export * from './styles'
12
+ export * from './theme'
@@ -1,4 +1,4 @@
1
- import {ThemeFocusRing} from './_system'
1
+ import {ThemeFocusRing} from './focusRing'
2
2
 
3
3
  /**
4
4
  * @public
@@ -1,6 +1,5 @@
1
1
  /**
2
- * THIS API MAY BE UNSTABLE. DO NOT USE IN PRODUCTION.
3
- * @beta
2
+ * @public
4
3
  */
5
4
  export interface ThemeLayer {
6
5
  dialog: {zOffset: number}
@@ -10,6 +10,7 @@ export type ThemeBoxShadow = [
10
10
  ]
11
11
 
12
12
  /**
13
+ * @public
13
14
  * @deprecated Use `ThemeBoxShadow` instead
14
15
  */
15
16
  export type BoxShadow = ThemeBoxShadow
@@ -0,0 +1,19 @@
1
+ import {CSSObject} from './css'
2
+
3
+ /**
4
+ * @internal
5
+ */
6
+ export interface ThemeStyles {
7
+ button?: {
8
+ root?: CSSObject
9
+ }
10
+ card?: {
11
+ root?: CSSObject
12
+ }
13
+ }
14
+
15
+ /**
16
+ * @deprecated Use `ThemeStyles` instead
17
+ * @internal
18
+ */
19
+ export type Styles = ThemeStyles
@@ -0,0 +1,97 @@
1
+ import {ThemeAvatar} from './avatar'
2
+ import {ThemeColorSchemes_v2, ThemeColorCard_v2} from './color'
3
+ import {ThemeFocusRing} from './focusRing'
4
+ import {ThemeFontWeightKey, ThemeFonts} from './fonts'
5
+ import {ThemeInput} from './input'
6
+ import {ThemeLayer} from './layer'
7
+ import {ThemeShadow} from './shadow'
8
+ import {ThemeStyles} from './styles'
9
+ import {ThemeColor, ThemeColorSchemes} from './v0'
10
+
11
+ /**
12
+ * @public
13
+ */
14
+ export interface RootTheme_v2 {
15
+ _version: 2
16
+ avatar: ThemeAvatar
17
+ button: {
18
+ border: {width: number}
19
+ focusRing: ThemeFocusRing
20
+ textWeight: ThemeFontWeightKey
21
+ }
22
+ card: {
23
+ border: {width: number}
24
+ focusRing: ThemeFocusRing
25
+ shadow: {outline: number}
26
+ }
27
+ color: ThemeColorSchemes_v2
28
+ container: number[]
29
+ font: ThemeFonts
30
+ input: ThemeInput
31
+ layer: ThemeLayer
32
+ media: number[]
33
+ radius: number[]
34
+ shadow: Array<ThemeShadow | null>
35
+ space: number[]
36
+ style?: ThemeStyles
37
+ }
38
+
39
+ /**
40
+ * @public
41
+ */
42
+ export interface BaseTheme {
43
+ _version?: 0
44
+ avatar: ThemeAvatar
45
+ button: {
46
+ border: {width: number}
47
+ focusRing: ThemeFocusRing
48
+ textWeight: ThemeFontWeightKey
49
+ }
50
+ card: {
51
+ border: {width: number}
52
+ focusRing: ThemeFocusRing
53
+ shadow: {outline: number}
54
+ }
55
+ color: ThemeColorSchemes
56
+ container: number[]
57
+ /** @deprecated Use component-specific `focusRing` values instead */
58
+ focusRing: {
59
+ offset: number
60
+ width: number
61
+ }
62
+ fonts: ThemeFonts
63
+ input: ThemeInput
64
+ /**
65
+ * THIS API MAY BE UNSTABLE. DO NOT USE IN PRODUCTION.
66
+ * @beta
67
+ */
68
+ layer?: ThemeLayer
69
+ media: number[]
70
+ radius: number[]
71
+ shadows: Array<ThemeShadow | null>
72
+ space: number[]
73
+ /** @internal */
74
+ styles?: ThemeStyles
75
+
76
+ v2?: RootTheme_v2
77
+ }
78
+
79
+ /**
80
+ * @public
81
+ */
82
+ export type RootTheme = BaseTheme
83
+
84
+ /**
85
+ * @public
86
+ */
87
+ export type Theme_v2 = Omit<RootTheme_v2, 'color'> & {color: ThemeColorCard_v2}
88
+
89
+ /**
90
+ * @public
91
+ */
92
+ export interface Theme {
93
+ sanity: Omit<RootTheme, 'color' | 'v2'> & {
94
+ color: ThemeColor
95
+ v2?: Theme_v2
96
+ }
97
+ }