@sanity/ui 2.0.0-alpha.34 → 2.0.0-alpha.36
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.
- package/dist/index.cjs.mjs +4 -3
- package/dist/index.d.ts +29 -22
- package/dist/index.esm.js +397 -518
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +413 -534
- package/dist/index.js.map +1 -1
- package/dist/theme.cjs.mjs +10 -4
- package/dist/theme.d.ts +489 -201
- package/dist/theme.esm.js +2934 -2748
- package/dist/theme.esm.js.map +1 -1
- package/dist/theme.js +2943 -2751
- package/dist/theme.js.map +1 -1
- package/package.json +3 -3
- package/src/core/_compat.ts +7 -7
- package/src/core/components/dialog/dialog.tsx +5 -5
- package/src/core/components/dialog/styles.ts +4 -5
- package/src/core/components/hotkeys/hotkeys.tsx +4 -2
- package/src/core/components/menu/__workshop__/avatarMenu.tsx +50 -0
- package/src/core/components/menu/__workshop__/index.ts +5 -0
- package/src/core/components/menu/menuItem.tsx +7 -1
- package/src/core/components/skeleton/textSkeleton.tsx +12 -14
- package/src/core/components/tree/style.ts +14 -17
- package/src/core/hooks/useMediaIndex/useMediaIndex.test.tsx +3 -3
- package/src/core/hooks/useMediaIndex/useMediaIndex.ts +2 -3
- package/src/core/primitives/_selectable/style.ts +18 -18
- package/src/core/primitives/avatar/avatar.tsx +3 -3
- package/src/core/primitives/avatar/avatarCounter.tsx +4 -4
- package/src/core/primitives/avatar/avatarStack.tsx +2 -2
- package/src/core/primitives/avatar/styles.ts +7 -8
- package/src/core/primitives/avatar/types.ts +2 -2
- package/src/core/primitives/badge/__workshop__/props.tsx +1 -1
- package/src/core/primitives/badge/__workshop__/tones.tsx +1 -1
- package/src/core/primitives/badge/badge.tsx +1 -1
- package/src/core/primitives/badge/styles.ts +5 -6
- package/src/core/primitives/button/button.tsx +3 -4
- package/src/core/primitives/button/styles.ts +22 -23
- package/src/core/primitives/card/__workshop__/selected.tsx +15 -15
- package/src/core/primitives/card/card.tsx +1 -1
- package/src/core/primitives/card/styles.ts +22 -22
- package/src/core/primitives/checkbox/styles.ts +21 -22
- package/src/core/primitives/code/styles.ts +4 -1
- package/src/core/primitives/container/styles.ts +2 -3
- package/src/core/primitives/heading/styles.ts +4 -2
- package/src/core/primitives/inline/styles.ts +6 -6
- package/src/core/primitives/kbd/kbd.tsx +7 -11
- package/src/core/primitives/label/styles.ts +4 -3
- package/src/core/primitives/popover/helpers.ts +3 -4
- package/src/core/primitives/popover/popover.tsx +8 -4
- package/src/core/primitives/popover/types.ts +1 -1
- package/src/core/primitives/radio/styles.ts +17 -19
- package/src/core/primitives/select/styles.ts +27 -32
- package/src/core/primitives/stack/styles.ts +2 -3
- package/src/core/primitives/switch/__workshop__/props.tsx +11 -31
- package/src/core/primitives/switch/styles.ts +18 -21
- package/src/core/primitives/text/__workshop__/colored.tsx +10 -10
- package/src/core/primitives/text/styles.ts +9 -4
- package/src/core/primitives/tooltip/tooltip.tsx +3 -3
- package/src/core/styles/border/borderStyle.ts +6 -11
- package/src/core/styles/box/boxStyle.ts +5 -9
- package/src/core/styles/card/_cardColorStyle.ts +99 -0
- package/src/core/styles/card/index.ts +1 -0
- package/src/core/styles/flex/flexItemStyle.ts +2 -3
- package/src/core/styles/flex/flexStyle.ts +6 -11
- package/src/core/styles/font/responsiveFont.ts +4 -4
- package/src/core/styles/font/textAlignStyle.ts +3 -3
- package/src/core/styles/grid/gridItemStyle.ts +7 -13
- package/src/core/styles/grid/gridStyle.ts +9 -17
- package/src/core/styles/helpers.ts +5 -3
- package/src/core/styles/input/responsiveInputPaddingStyle.ts +6 -6
- package/src/core/styles/input/textInputStyle.ts +36 -40
- package/src/core/styles/margin/marginsStyle.test.ts +2 -3
- package/src/core/styles/padding/paddingStyle.test.ts +2 -3
- package/src/core/styles/radius/radiusStyle.ts +2 -3
- package/src/core/styles/shadow/shadowStyle.ts +4 -5
- package/src/core/theme/__workshop__/build/Root.tsx +24 -20
- package/src/core/theme/__workshop__/build/story.tsx +22 -26
- package/src/core/theme/__workshop__/canvas.tsx +21 -40
- package/src/core/theme/theme.test.tsx +2 -35
- package/src/core/theme/themeColorProvider.tsx +2 -2
- package/src/core/theme/themeContext.ts +2 -2
- package/src/core/theme/themeProvider.tsx +25 -25
- package/src/core/theme/types.ts +3 -2
- package/src/core/theme/useRootTheme.ts +1 -9
- package/src/core/theme/useTheme.ts +8 -1
- package/src/core/types/card.ts +2 -2
- package/src/core/utils/arrow/arrow.tsx +3 -3
- package/src/core/utils/elementQuery/elementQuery.tsx +3 -3
- package/src/core/utils/virtualList/virtualList.tsx +2 -2
- package/src/theme/build/_deprecated/color/muted/createMuted.ts +2 -2
- package/src/theme/build/buildColorTheme.test.ts +14 -15
- package/src/theme/build/buildColorTheme.ts +239 -292
- package/src/theme/build/buildTheme.test.ts +9 -7
- package/src/theme/build/buildTheme.ts +12 -9
- package/src/theme/build/colorToken.ts +3 -1
- package/src/theme/build/lib/color-fns/contrastRatio.ts +1 -0
- package/src/theme/build/lib/isRecord.ts +3 -0
- package/src/theme/build/merge.ts +18 -13
- package/src/theme/build/renderColorTheme.ts +205 -213
- package/src/theme/build/renderColorValue.ts +15 -8
- package/src/theme/build/resolveColorTokens.ts +177 -198
- package/src/theme/build/theme.test.ts +27 -0
- package/src/theme/config/helpers.ts +16 -8
- package/src/theme/config/system.ts +46 -17
- package/src/theme/config/tokens/color/types.ts +55 -32
- package/src/theme/config/tokens/types.ts +11 -4
- package/src/theme/config/types.ts +5 -11
- package/src/theme/{build/defaults → defaults}/colorPalette.ts +1 -1
- package/src/theme/{build/defaults → defaults}/colorTokens.ts +189 -136
- package/src/theme/{build/defaults → defaults}/config.ts +14 -12
- package/src/theme/{build/defaults → defaults}/fonts.ts +6 -6
- package/src/theme/getScopedTheme.ts +81 -0
- package/src/theme/index.ts +9 -1
- package/src/theme/system/avatar.ts +1 -1
- package/src/theme/system/color/_constants.ts +11 -11
- package/src/theme/system/color/_system.ts +10 -71
- package/src/theme/system/color/avatar.ts +22 -10
- package/src/theme/system/color/badge.ts +18 -7
- package/src/theme/system/color/button.ts +17 -23
- package/src/theme/system/color/color.ts +34 -0
- package/src/theme/system/color/index.ts +3 -10
- package/src/theme/system/color/input.ts +13 -11
- package/src/theme/system/color/kbd.ts +3 -3
- package/src/theme/system/color/selectable.ts +13 -19
- package/src/theme/system/color/shadow.ts +7 -0
- package/src/theme/system/color/state.ts +37 -0
- package/src/theme/system/css.ts +9 -0
- package/src/theme/system/focusRing.ts +7 -0
- package/src/theme/system/index.ts +5 -1
- package/src/theme/system/input.ts +1 -1
- package/src/theme/system/layer.ts +1 -2
- package/src/theme/system/shadow.ts +1 -0
- package/src/theme/system/styles.ts +19 -0
- package/src/theme/system/theme.ts +128 -0
- package/src/theme/system/{color → v0/color}/_generic.ts +2 -1
- package/src/theme/system/v0/color/_system.ts +13 -0
- package/src/theme/system/{color → v0/color}/base.ts +2 -0
- package/src/theme/system/v0/color/button.ts +42 -0
- package/src/theme/system/{color → v0/color}/card.ts +2 -1
- package/src/theme/system/v0/color/color.ts +40 -0
- package/src/theme/system/v0/color/index.ts +11 -0
- package/src/theme/system/v0/color/input.ts +34 -0
- package/src/theme/system/{color/_deprecated → v0/color}/muted.ts +1 -1
- package/src/theme/system/v0/color/selectable.ts +31 -0
- package/src/theme/system/{color/_deprecated → v0/color}/solid.ts +1 -1
- package/src/theme/system/v0/color/spot.ts +13 -0
- package/src/theme/system/v0/index.ts +1 -0
- package/src/theme/versioning/getTheme_v2.ts +38 -0
- package/src/theme/versioning/index.ts +5 -0
- package/src/theme/versioning/is_v0.ts +6 -0
- package/src/theme/versioning/is_v2.ts +6 -0
- package/src/theme/versioning/themeColor_v0_v2.ts +217 -0
- package/src/theme/versioning/v0_v2.ts +72 -0
- package/src/theme/versioning/v2_v0.ts +126 -0
- package/src/core/styles/colorVars/colorVarsStyle.ts +0 -43
- package/src/core/styles/colorVars/index.ts +0 -1
- package/src/core/theme/defaults.ts +0 -7
- package/src/theme/system/_system.ts +0 -95
- package/src/theme/system/color/_deprecated/spot.ts +0 -13
- package/src/theme/themes/studio/config.ts +0 -69
- package/src/theme/themes/studio/fonts.ts +0 -219
- package/src/theme/themes/studio/index.ts +0 -1
- package/src/theme/themes/studio/studioTheme.test.ts +0 -27
- package/src/theme/themes/studio/studioTheme.ts +0 -8
package/dist/index.cjs.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import cjs from './index.js';
|
|
2
2
|
|
|
3
|
-
export const COLOR_CONFIG_BASE_KEYS = cjs.COLOR_CONFIG_BASE_KEYS;
|
|
4
|
-
export const COLOR_CONFIG_BASE_TONES = cjs.COLOR_CONFIG_BASE_TONES;
|
|
5
3
|
export const COLOR_CONFIG_BLEND_KEYS = cjs.COLOR_CONFIG_BLEND_KEYS;
|
|
4
|
+
export const COLOR_CONFIG_CARD_KEYS = cjs.COLOR_CONFIG_CARD_KEYS;
|
|
5
|
+
export const COLOR_CONFIG_CARD_TONES = cjs.COLOR_CONFIG_CARD_TONES;
|
|
6
6
|
export const COLOR_CONFIG_STATE_KEYS = cjs.COLOR_CONFIG_STATE_KEYS;
|
|
7
7
|
export const COLOR_CONFIG_STATE_TONES = cjs.COLOR_CONFIG_STATE_TONES;
|
|
8
|
-
export const THEME_COLOR_BASE_TONES = cjs.THEME_COLOR_BASE_TONES;
|
|
9
8
|
export const THEME_COLOR_BLEND_MODES = cjs.THEME_COLOR_BLEND_MODES;
|
|
10
9
|
export const THEME_COLOR_BUTTON_MODES = cjs.THEME_COLOR_BUTTON_MODES;
|
|
10
|
+
export const THEME_COLOR_CARD_TONES = cjs.THEME_COLOR_CARD_TONES;
|
|
11
11
|
export const THEME_COLOR_STATES = cjs.THEME_COLOR_STATES;
|
|
12
12
|
export const THEME_COLOR_STATE_TONES = cjs.THEME_COLOR_STATE_TONES;
|
|
13
13
|
export const buildTheme = cjs.buildTheme;
|
|
@@ -143,6 +143,7 @@ export const usePrefersDark = cjs.usePrefersDark;
|
|
|
143
143
|
export const usePrefersReducedMotion = cjs.usePrefersReducedMotion;
|
|
144
144
|
export const useRootTheme = cjs.useRootTheme;
|
|
145
145
|
export const useTheme = cjs.useTheme;
|
|
146
|
+
export const useTheme_v2 = cjs.useTheme_v2;
|
|
146
147
|
export const useToast = cjs.useToast;
|
|
147
148
|
export const useTooltipDelayGroup = cjs.useTooltipDelayGroup;
|
|
148
149
|
export const useTree = cjs.useTree;
|
package/dist/index.d.ts
CHANGED
|
@@ -6,15 +6,15 @@ import {BaseTheme} from '@sanity/ui/theme'
|
|
|
6
6
|
import {BoxShadow} from '@sanity/ui/theme'
|
|
7
7
|
import {buildTheme} from '@sanity/ui/theme'
|
|
8
8
|
import {ClipboardEventHandler} from 'react'
|
|
9
|
-
import {COLOR_CONFIG_BASE_KEYS} from '@sanity/ui/theme'
|
|
10
|
-
import {COLOR_CONFIG_BASE_TONES} from '@sanity/ui/theme'
|
|
11
9
|
import {COLOR_CONFIG_BLEND_KEYS} from '@sanity/ui/theme'
|
|
10
|
+
import {COLOR_CONFIG_CARD_KEYS} from '@sanity/ui/theme'
|
|
11
|
+
import {COLOR_CONFIG_CARD_TONES} from '@sanity/ui/theme'
|
|
12
12
|
import {COLOR_CONFIG_STATE_KEYS} from '@sanity/ui/theme'
|
|
13
13
|
import {COLOR_CONFIG_STATE_TONES} from '@sanity/ui/theme'
|
|
14
14
|
import {ColorBlendModeTokenValue} from '@sanity/ui/theme'
|
|
15
|
-
import {ColorConfigBaseKey} from '@sanity/ui/theme'
|
|
16
|
-
import {ColorConfigBaseTone} from '@sanity/ui/theme'
|
|
17
15
|
import {ColorConfigBlendKey} from '@sanity/ui/theme'
|
|
16
|
+
import {ColorConfigCardKey} from '@sanity/ui/theme'
|
|
17
|
+
import {ColorConfigCardTone} from '@sanity/ui/theme'
|
|
18
18
|
import {ColorConfigOpacityValue} from '@sanity/ui/theme'
|
|
19
19
|
import {ColorConfigStateKey} from '@sanity/ui/theme'
|
|
20
20
|
import {ColorConfigStateTone} from '@sanity/ui/theme'
|
|
@@ -74,19 +74,19 @@ import {rgbToHex} from '@sanity/ui/theme'
|
|
|
74
74
|
import {rgbToHsl} from '@sanity/ui/theme'
|
|
75
75
|
import {RootTheme} from '@sanity/ui/theme'
|
|
76
76
|
import {screen as screen_2} from '@sanity/ui/theme'
|
|
77
|
-
import {studioTheme} from '@sanity/ui/theme'
|
|
77
|
+
import {defaultTheme as studioTheme} from '@sanity/ui/theme'
|
|
78
78
|
import {Theme} from '@sanity/ui/theme'
|
|
79
|
-
import {THEME_COLOR_BASE_TONES} from '@sanity/ui/theme'
|
|
80
79
|
import {THEME_COLOR_BLEND_MODES} from '@sanity/ui/theme'
|
|
81
80
|
import {THEME_COLOR_BUTTON_MODES} from '@sanity/ui/theme'
|
|
81
|
+
import {THEME_COLOR_CARD_TONES} from '@sanity/ui/theme'
|
|
82
82
|
import {THEME_COLOR_STATE_TONES} from '@sanity/ui/theme'
|
|
83
83
|
import {THEME_COLOR_STATES} from '@sanity/ui/theme'
|
|
84
|
+
import {Theme_v2} from '@sanity/ui/theme'
|
|
84
85
|
import {ThemeAvatar} from '@sanity/ui/theme'
|
|
85
86
|
import {ThemeColor} from '@sanity/ui/theme'
|
|
86
87
|
import {ThemeColorAvatarColorKey} from '@sanity/ui/theme'
|
|
87
88
|
import {ThemeColorBase} from '@sanity/ui/theme'
|
|
88
89
|
import {ThemeColorBaseTokens} from '@sanity/ui/theme'
|
|
89
|
-
import {ThemeColorBaseToneKey} from '@sanity/ui/theme'
|
|
90
90
|
import {ThemeColorBlendModeKey} from '@sanity/ui/theme'
|
|
91
91
|
import {ThemeColorBuilderOpts} from '@sanity/ui/theme'
|
|
92
92
|
import {ThemeColorButton} from '@sanity/ui/theme'
|
|
@@ -97,6 +97,7 @@ import {ThemeColorButtonTokens} from '@sanity/ui/theme'
|
|
|
97
97
|
import {ThemeColorButtonTones} from '@sanity/ui/theme'
|
|
98
98
|
import {ThemeColorCard} from '@sanity/ui/theme'
|
|
99
99
|
import {ThemeColorCardState} from '@sanity/ui/theme'
|
|
100
|
+
import {ThemeColorCardToneKey} from '@sanity/ui/theme'
|
|
100
101
|
import {ThemeColorGenericState} from '@sanity/ui/theme'
|
|
101
102
|
import {ThemeColorInput} from '@sanity/ui/theme'
|
|
102
103
|
import {ThemeColorInputState} from '@sanity/ui/theme'
|
|
@@ -405,7 +406,7 @@ export declare interface AvatarProps {
|
|
|
405
406
|
* @internal
|
|
406
407
|
*/
|
|
407
408
|
export declare interface AvatarRootStyleProps {
|
|
408
|
-
$color:
|
|
409
|
+
$color: ThemeColorAvatarColorKey
|
|
409
410
|
}
|
|
410
411
|
|
|
411
412
|
/**
|
|
@@ -663,7 +664,7 @@ export declare interface CardStyleProps {
|
|
|
663
664
|
/**
|
|
664
665
|
* @public
|
|
665
666
|
*/
|
|
666
|
-
export declare type CardTone =
|
|
667
|
+
export declare type CardTone = ThemeColorCardToneKey | 'inherit'
|
|
667
668
|
|
|
668
669
|
/**
|
|
669
670
|
* Checkboxes allow the user to select one or more items from a set.
|
|
@@ -726,11 +727,11 @@ export declare interface CodeSkeletonProps extends SkeletonProps {
|
|
|
726
727
|
size?: number | number[]
|
|
727
728
|
}
|
|
728
729
|
|
|
729
|
-
export {
|
|
730
|
+
export {COLOR_CONFIG_BLEND_KEYS}
|
|
730
731
|
|
|
731
|
-
export {
|
|
732
|
+
export {COLOR_CONFIG_CARD_KEYS}
|
|
732
733
|
|
|
733
|
-
export {
|
|
734
|
+
export {COLOR_CONFIG_CARD_TONES}
|
|
734
735
|
|
|
735
736
|
export {COLOR_CONFIG_STATE_KEYS}
|
|
736
737
|
|
|
@@ -738,11 +739,11 @@ export {COLOR_CONFIG_STATE_TONES}
|
|
|
738
739
|
|
|
739
740
|
export {ColorBlendModeTokenValue}
|
|
740
741
|
|
|
741
|
-
export {
|
|
742
|
+
export {ColorConfigBlendKey}
|
|
742
743
|
|
|
743
|
-
export {
|
|
744
|
+
export {ColorConfigCardKey}
|
|
744
745
|
|
|
745
|
-
export {
|
|
746
|
+
export {ColorConfigCardTone}
|
|
746
747
|
|
|
747
748
|
export {ColorConfigOpacityValue}
|
|
748
749
|
|
|
@@ -2558,12 +2559,12 @@ export declare interface TextSkeletonProps extends SkeletonProps {
|
|
|
2558
2559
|
|
|
2559
2560
|
export {Theme}
|
|
2560
2561
|
|
|
2561
|
-
export {THEME_COLOR_BASE_TONES}
|
|
2562
|
-
|
|
2563
2562
|
export {THEME_COLOR_BLEND_MODES}
|
|
2564
2563
|
|
|
2565
2564
|
export {THEME_COLOR_BUTTON_MODES}
|
|
2566
2565
|
|
|
2566
|
+
export {THEME_COLOR_CARD_TONES}
|
|
2567
|
+
|
|
2567
2568
|
export {THEME_COLOR_STATE_TONES}
|
|
2568
2569
|
|
|
2569
2570
|
export {THEME_COLOR_STATES}
|
|
@@ -2576,8 +2577,6 @@ export {ThemeColorBase}
|
|
|
2576
2577
|
|
|
2577
2578
|
export {ThemeColorBaseTokens}
|
|
2578
2579
|
|
|
2579
|
-
export {ThemeColorBaseToneKey}
|
|
2580
|
-
|
|
2581
2580
|
export {ThemeColorBlendModeKey}
|
|
2582
2581
|
|
|
2583
2582
|
export {ThemeColorBuilderOpts}
|
|
@@ -2598,6 +2597,8 @@ export {ThemeColorCard}
|
|
|
2598
2597
|
|
|
2599
2598
|
export {ThemeColorCardState}
|
|
2600
2599
|
|
|
2600
|
+
export {ThemeColorCardToneKey}
|
|
2601
|
+
|
|
2601
2602
|
export {ThemeColorGenericState}
|
|
2602
2603
|
|
|
2603
2604
|
export {ThemeColorInput}
|
|
@@ -2623,7 +2624,7 @@ export declare function ThemeColorProvider(props: ThemeColorProviderProps): Reac
|
|
|
2623
2624
|
export declare interface ThemeColorProviderProps {
|
|
2624
2625
|
children?: React.ReactNode
|
|
2625
2626
|
scheme?: ThemeColorSchemeKey
|
|
2626
|
-
tone?:
|
|
2627
|
+
tone?: ThemeColorCardToneKey
|
|
2627
2628
|
}
|
|
2628
2629
|
|
|
2629
2630
|
export {ThemeColorScheme}
|
|
@@ -2668,10 +2669,11 @@ export {ThemeConfig}
|
|
|
2668
2669
|
* @public
|
|
2669
2670
|
*/
|
|
2670
2671
|
export declare interface ThemeContextValue {
|
|
2672
|
+
/** @deprecated No longer used */
|
|
2671
2673
|
version: 0.0
|
|
2672
2674
|
scheme: ThemeColorSchemeKey
|
|
2673
2675
|
theme: RootTheme
|
|
2674
|
-
tone:
|
|
2676
|
+
tone: ThemeColorCardToneKey
|
|
2675
2677
|
}
|
|
2676
2678
|
|
|
2677
2679
|
export {ThemeFocusRing}
|
|
@@ -2711,7 +2713,7 @@ export declare interface ThemeProviderProps {
|
|
|
2711
2713
|
children?: React.ReactNode
|
|
2712
2714
|
scheme?: ThemeColorSchemeKey
|
|
2713
2715
|
theme?: RootTheme
|
|
2714
|
-
tone?:
|
|
2716
|
+
tone?: ThemeColorCardToneKey
|
|
2715
2717
|
}
|
|
2716
2718
|
|
|
2717
2719
|
export {ThemeShadow}
|
|
@@ -3060,6 +3062,11 @@ export declare function useRootTheme(): ThemeContextValue
|
|
|
3060
3062
|
*/
|
|
3061
3063
|
export declare function useTheme(): Theme
|
|
3062
3064
|
|
|
3065
|
+
/**
|
|
3066
|
+
* @public
|
|
3067
|
+
*/
|
|
3068
|
+
export declare function useTheme_v2(): Theme_v2
|
|
3069
|
+
|
|
3063
3070
|
/**
|
|
3064
3071
|
* @public
|
|
3065
3072
|
*/
|