@sanity/ui 2.9.0-corel.0 → 3.0.0-static.0
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/bin/ui.js +6 -0
- package/dist/_chunks-cjs/buildCommand.js +2836 -0
- package/dist/_chunks-cjs/buildCommand.js.map +1 -0
- package/dist/_chunks-cjs/getTheme_v2.js +1 -27
- package/dist/_chunks-cjs/getTheme_v2.js.map +1 -1
- package/dist/_chunks-es/getTheme_v2.mjs +1 -27
- package/dist/_chunks-es/getTheme_v2.mjs.map +1 -1
- package/dist/_legacy/getTheme_v2.esm.js +1 -27
- package/dist/_legacy/getTheme_v2.esm.js.map +1 -1
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +23 -0
- package/dist/cli.js.map +1 -0
- package/dist/css.d.mts +943 -0
- package/dist/css.d.ts +943 -0
- package/dist/css.esm.js +3135 -0
- package/dist/css.esm.js.map +1 -0
- package/dist/css.js +3135 -0
- package/dist/css.js.map +1 -0
- package/dist/css.mjs +3135 -0
- package/dist/css.mjs.map +1 -0
- package/dist/index.d.mts +175 -164
- package/dist/index.d.ts +175 -164
- package/dist/index.esm.js +864 -1955
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +870 -1962
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +864 -1955
- package/dist/index.mjs.map +1 -1
- package/dist/sanity-theme.css +25 -0
- package/dist/system.css +2953 -0
- package/dist/theme.d.mts +84 -22
- package/dist/theme.d.ts +84 -22
- package/dist/theme.esm.js +232 -283
- package/dist/theme.esm.js.map +1 -1
- package/dist/theme.js +232 -283
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +232 -283
- package/dist/theme.mjs.map +1 -1
- package/exports/css.ts +1 -0
- package/package.json +25 -4
- package/src/core/__workshop__/constants.ts +15 -15
- package/src/core/__workshop__/fontsPlugin.tsx +1 -1
- package/src/core/components/autocomplete/autocomplete.styles.tsx +1 -1
- package/src/core/components/autocomplete/autocomplete.tsx +12 -4
- package/src/core/components/breadcrumbs/__workshop__/example.tsx +1 -3
- package/src/core/components/breadcrumbs/__workshop__/index.ts +0 -5
- package/src/core/components/breadcrumbs/breadcrumbs.styles.ts +14 -2
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +14 -9
- package/src/core/components/dialog/__workshop__/panes.tsx +1 -1
- package/src/core/components/dialog/dialog.tsx +77 -92
- package/src/core/components/hotkeys/hotkeys.tsx +18 -29
- package/src/core/components/menu/menu.tsx +8 -5
- package/src/core/components/menu/menuDivider.ts +2 -1
- package/src/core/components/menu/menuGroup.tsx +16 -8
- package/src/core/components/menu/menuItem.tsx +23 -14
- package/src/core/components/skeleton/skeleton.tsx +1 -1
- package/src/core/components/skeleton/styles.ts +1 -1
- package/src/core/components/skeleton/textSkeleton.tsx +1 -1
- package/src/core/components/tab/tab.tsx +6 -7
- package/src/core/components/tab/tabList.tsx +3 -2
- package/src/core/components/toast/styles.ts +1 -1
- package/src/core/components/toast/toast.tsx +6 -4
- package/src/core/components/toast/toastProvider.tsx +31 -22
- package/src/core/components/tree/style.ts +1 -1
- package/src/core/components/tree/tree.tsx +8 -2
- package/src/core/components/tree/treeGroup.tsx +1 -1
- package/src/core/components/tree/treeItem.tsx +38 -25
- package/src/core/components/tree/types.ts +5 -1
- package/src/core/lib/styled/elements.ts +135 -0
- package/src/core/lib/styled/index.ts +2 -0
- package/src/core/lib/styled/members.ts +15 -0
- package/src/core/lib/styled/styled.ts +79 -0
- package/src/core/primitives/_selectable/selectable.tsx +27 -14
- package/src/core/primitives/avatar/avatar.tsx +52 -32
- package/src/core/primitives/avatar/avatarCounter.tsx +1 -1
- package/src/core/primitives/avatar/avatarStack.tsx +1 -1
- package/src/core/primitives/badge/__workshop__/tones.tsx +9 -16
- package/src/core/primitives/badge/badge.tsx +18 -20
- package/src/core/primitives/box/box.tsx +62 -74
- package/src/core/primitives/button/__workshop__/props.tsx +3 -1
- package/src/core/primitives/button/__workshop__/sanityUploadButton.tsx +1 -1
- package/src/core/primitives/button/__workshop__/styled1.tsx +1 -1
- package/src/core/primitives/button/__workshop__/styled2.tsx +1 -1
- package/src/core/primitives/button/button.tsx +38 -45
- package/src/core/primitives/button/styles.ts +2 -2
- package/src/core/primitives/card/RootCardContext.ts +3 -0
- package/src/core/primitives/card/__workshop__/selected.tsx +1 -1
- package/src/core/primitives/card/__workshop__/styled.tsx +1 -1
- package/src/core/primitives/card/card.tsx +44 -46
- package/src/core/primitives/card/styles.ts +1 -1
- package/src/core/primitives/checkbox/checkbox.tsx +6 -8
- package/src/core/primitives/code/code.tsx +23 -12
- package/src/core/primitives/code/styles.ts +1 -1
- package/src/core/primitives/container/container.tsx +7 -15
- package/src/core/primitives/flex/__workshop__/example.tsx +1 -1
- package/src/core/primitives/flex/flex.tsx +6 -19
- package/src/core/primitives/grid/grid.tsx +2 -1
- package/src/core/primitives/heading/heading.tsx +32 -19
- package/src/core/primitives/heading/styles.ts +1 -1
- package/src/core/primitives/inline/inline.tsx +22 -13
- package/src/core/primitives/kbd/kbd.tsx +30 -37
- package/src/core/primitives/label/label.tsx +15 -4
- package/src/core/primitives/label/styles.ts +1 -1
- package/src/core/primitives/popover/__workshop__/RecursiveStory.tsx +0 -1
- package/src/core/primitives/popover/popover.tsx +21 -15
- package/src/core/primitives/popover/popoverCard.tsx +36 -38
- package/src/core/primitives/radio/radio.tsx +1 -1
- package/src/core/primitives/radio/styles.ts +1 -1
- package/src/core/primitives/select/select.tsx +1 -1
- package/src/core/primitives/select/styles.ts +1 -1
- package/src/core/primitives/spinner/spinner.tsx +6 -20
- package/src/core/primitives/stack/stack.tsx +12 -10
- package/src/core/primitives/switch/styles.ts +9 -9
- package/src/core/primitives/switch/switch.tsx +20 -21
- package/src/core/primitives/text/__workshop__/colored.tsx +1 -1
- package/src/core/primitives/text/styles.ts +1 -2
- package/src/core/primitives/text/text.tsx +17 -21
- package/src/core/primitives/textArea/textArea.tsx +1 -1
- package/src/core/primitives/textInput/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/textInput/textInput.tsx +176 -123
- package/src/core/primitives/tooltip/tooltip.test.tsx +1 -0
- package/src/core/primitives/tooltip/tooltip.tsx +13 -13
- package/src/core/primitives/tooltip/tooltipCard.tsx +15 -14
- package/src/core/primitives/types.ts +35 -16
- package/src/core/styles/border/borderStyle.ts +6 -0
- package/src/core/styles/border/types.ts +1 -0
- package/src/core/styles/box/boxStyle.ts +6 -0
- package/src/core/styles/card/_cardColorStyle.ts +0 -8
- package/src/core/styles/flex/flexStyle.ts +0 -18
- package/src/core/styles/flex/types.ts +1 -3
- package/src/core/styles/grid/gridStyle.ts +0 -10
- package/src/core/styles/helpers.ts +9 -0
- package/src/core/styles/input/textInputStyle.ts +1 -1
- package/src/core/theme/__workshop__/build/Root.tsx +1 -1
- package/src/core/theme/themeProvider.tsx +1 -1
- package/src/core/theme/useTheme.ts +1 -1
- package/src/core/types/avatar.ts +6 -1
- package/src/core/types/button.ts +1 -0
- package/src/core/types/flex.ts +27 -26
- package/src/core/types/gridItem.ts +32 -24
- package/src/core/types/radius.ts +7 -4
- package/src/core/utils/arrow/arrow.tsx +1 -1
- package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +1 -1
- package/src/core/utils/layer/layer.tsx +28 -11
- package/src/core/utils/srOnly/srOnly.tsx +1 -1
- package/src/core/utils/virtualList/virtualList.tsx +1 -1
- package/src/css/_resp.ts +28 -0
- package/src/css/cli/buildCommand.ts +36 -0
- package/src/css/cli/index.ts +38 -0
- package/src/css/compile/comileRules.ts +59 -0
- package/src/css/compile/compileRule.ts +58 -0
- package/src/css/compile/compileSystem.ts +7 -0
- package/src/css/compile/compileTheme.ts +509 -0
- package/src/css/components/breadcrumbs/breadcrumbs.ts +5 -0
- package/src/css/components/breadcrumbs/index.ts +1 -0
- package/src/css/components/breadcrumbs/rules.ts +7 -0
- package/src/css/components/dialog/classes.ts +29 -0
- package/src/css/components/dialog/index.ts +1 -0
- package/src/css/components/dialog/rules.ts +75 -0
- package/src/css/components/tree/index.ts +1 -0
- package/src/css/components/tree/rules.ts +52 -0
- package/src/css/components/tree/tree.ts +5 -0
- package/src/css/composeClassNames.ts +3 -0
- package/src/css/index.ts +47 -0
- package/src/css/primitives/avatar/avatar.ts +32 -0
- package/src/css/primitives/avatar/index.ts +2 -0
- package/src/css/primitives/avatar/rules.ts +190 -0
- package/src/css/primitives/avatar/types.ts +9 -0
- package/src/css/primitives/badge/badge.ts +8 -0
- package/src/css/primitives/badge/index.ts +2 -0
- package/src/css/primitives/badge/rules.ts +25 -0
- package/src/css/primitives/badge/types.ts +8 -0
- package/src/css/primitives/box/box.ts +34 -0
- package/src/css/primitives/box/index.ts +2 -0
- package/src/css/primitives/box/rules.ts +25 -0
- package/src/css/primitives/box/types.ts +49 -0
- package/src/css/primitives/button/button.ts +26 -0
- package/src/css/primitives/button/index.ts +1 -0
- package/src/css/primitives/button/rules.ts +58 -0
- package/src/css/primitives/card/card.ts +21 -0
- package/src/css/primitives/card/index.ts +1 -0
- package/src/css/primitives/card/rules.ts +93 -0
- package/src/{core/primitives/checkbox/styles.ts → css/primitives/checkbox/__styles.ts} +3 -3
- package/src/css/primitives/checkbox/checkbox.ts +9 -0
- package/src/css/primitives/checkbox/index.ts +1 -0
- package/src/css/primitives/checkbox/rules.ts +136 -0
- package/src/css/primitives/code/code.ts +9 -0
- package/src/css/primitives/code/index.ts +2 -0
- package/src/css/primitives/code/rules.ts +71 -0
- package/src/css/primitives/code/types.ts +10 -0
- package/src/css/primitives/container/container.ts +7 -0
- package/src/css/primitives/container/index.ts +2 -0
- package/src/css/primitives/container/rules.ts +8 -0
- package/src/css/primitives/container/types.ts +6 -0
- package/src/css/primitives/heading/heading.ts +16 -0
- package/src/css/primitives/heading/index.ts +2 -0
- package/src/css/primitives/heading/rules.ts +84 -0
- package/src/css/primitives/heading/types.ts +12 -0
- package/src/css/primitives/kbd/index.ts +2 -0
- package/src/css/primitives/kbd/kbd.ts +7 -0
- package/src/css/primitives/kbd/rules.ts +20 -0
- package/src/css/primitives/kbd/types.ts +5 -0
- package/src/css/primitives/label/index.ts +2 -0
- package/src/css/primitives/label/label.ts +16 -0
- package/src/css/primitives/label/rules.ts +85 -0
- package/src/css/primitives/label/types.ts +12 -0
- package/src/css/primitives/popover/index.ts +1 -0
- package/src/css/primitives/popover/popover.ts +5 -0
- package/src/css/primitives/popover/rules.ts +5 -0
- package/src/css/primitives/radio/index.ts +1 -0
- package/src/css/primitives/radio/radio.ts +5 -0
- package/src/css/primitives/radio/rules.ts +5 -0
- package/src/css/primitives/select/index.ts +1 -0
- package/src/css/primitives/select/rules.ts +5 -0
- package/src/css/primitives/select/select.ts +5 -0
- package/src/{core/primitives/_selectable/style.ts → css/primitives/selectable/__style.ts} +5 -4
- package/src/css/primitives/selectable/index.ts +2 -0
- package/src/css/primitives/selectable/rules.ts +27 -0
- package/src/css/primitives/selectable/selectable.ts +9 -0
- package/src/css/primitives/selectable/types.ts +6 -0
- package/src/css/primitives/spinner/index.ts +1 -0
- package/src/css/primitives/spinner/rules.ts +22 -0
- package/src/css/primitives/spinner/spinner.ts +5 -0
- package/src/css/primitives/switch/index.ts +1 -0
- package/src/css/primitives/switch/rules.ts +132 -0
- package/src/css/primitives/switch/switch.ts +5 -0
- package/src/css/primitives/text/index.ts +2 -0
- package/src/css/primitives/text/rules.ts +75 -0
- package/src/css/primitives/text/text.ts +16 -0
- package/src/css/primitives/text/types.ts +11 -0
- package/src/css/primitives/textArea/index.ts +1 -0
- package/src/css/primitives/textArea/rules.ts +5 -0
- package/src/css/primitives/textArea/textArea.ts +5 -0
- package/src/css/primitives/textInput/index.ts +1 -0
- package/src/css/primitives/textInput/rules.ts +226 -0
- package/src/css/primitives/textInput/textInput.ts +7 -0
- package/src/css/primitives/token/rules.ts +45 -0
- package/src/css/primitives/tooltip/index.ts +1 -0
- package/src/css/primitives/tooltip/rules.ts +17 -0
- package/src/css/primitives/tooltip/tooltip.ts +9 -0
- package/src/css/responsiveRules.ts +25 -0
- package/src/css/rules.ts +121 -0
- package/src/css/styles/border/border.ts +22 -0
- package/src/css/styles/border/index.ts +2 -0
- package/src/css/styles/border/rules.ts +24 -0
- package/src/css/styles/border/types.ts +10 -0
- package/src/css/styles/display/rules.ts +62 -0
- package/src/css/styles/flex/flex.ts +20 -0
- package/src/css/styles/flex/index.ts +2 -0
- package/src/css/styles/flex/rules.ts +28 -0
- package/src/css/styles/flex/types.ts +35 -0
- package/src/css/styles/flexItem/flexItem.ts +8 -0
- package/src/css/styles/flexItem/index.ts +2 -0
- package/src/css/styles/flexItem/rules.ts +11 -0
- package/src/css/styles/flexItem/types.ts +11 -0
- package/src/css/styles/font/font.ts +12 -0
- package/src/css/styles/font/index.ts +2 -0
- package/src/css/styles/font/rules.ts +125 -0
- package/src/css/styles/font/types.ts +6 -0
- package/src/css/styles/gap/gap.ts +8 -0
- package/src/css/styles/gap/index.ts +2 -0
- package/src/css/styles/gap/rules.ts +33 -0
- package/src/css/styles/gap/types.ts +9 -0
- package/src/css/styles/grid/rules.ts +35 -0
- package/src/css/styles/gridItem/gridItem.ts +15 -0
- package/src/css/styles/gridItem/index.ts +2 -0
- package/src/css/styles/gridItem/rules.ts +96 -0
- package/src/css/styles/gridItem/types.ts +41 -0
- package/src/css/styles/height/rules.ts +7 -0
- package/src/css/styles/margin/index.ts +2 -0
- package/src/css/styles/margin/margin.ts +15 -0
- package/src/css/styles/margin/rules.ts +59 -0
- package/src/css/styles/margin/types.ts +11 -0
- package/src/css/styles/maxWidth/index.ts +2 -0
- package/src/css/styles/maxWidth/maxWidth.ts +6 -0
- package/src/css/styles/maxWidth/rules.ts +36 -0
- package/src/css/styles/maxWidth/types.ts +6 -0
- package/src/css/styles/overflow/rules.ts +9 -0
- package/src/css/styles/padding/index.ts +2 -0
- package/src/css/styles/padding/padding.ts +15 -0
- package/src/css/styles/padding/rules.ts +59 -0
- package/src/css/styles/padding/types.ts +12 -0
- package/src/css/styles/pointerEvents/index.ts +2 -0
- package/src/css/styles/pointerEvents/pointerEvents.ts +6 -0
- package/src/css/styles/pointerEvents/rules.ts +11 -0
- package/src/css/styles/pointerEvents/types.ts +7 -0
- package/src/css/styles/position/index.ts +2 -0
- package/src/css/styles/position/position.ts +7 -0
- package/src/css/styles/position/rules.ts +31 -0
- package/src/css/styles/position/types.ts +13 -0
- package/src/css/styles/radius/index.ts +2 -0
- package/src/css/styles/radius/radius.ts +8 -0
- package/src/css/styles/radius/rules.ts +13 -0
- package/src/css/styles/radius/types.ts +7 -0
- package/src/css/styles/shadow/rules.ts +53 -0
- package/src/css/styles/width/index.ts +2 -0
- package/src/css/styles/width/rules.ts +7 -0
- package/src/css/styles/width/types.ts +8 -0
- package/src/css/styles/width/width.ts +6 -0
- package/src/css/types.ts +591 -0
- package/src/css/varNames.ts +381 -0
- package/src/css/vars.ts +313 -0
- package/src/theme/build/_deprecated/color/factory.ts +1 -1
- package/src/theme/build/_deprecated/color/muted/createMuted.ts +2 -2
- package/src/theme/build/buildColorTheme.ts +39 -45
- package/src/theme/build/renderColorTheme.ts +65 -239
- package/src/theme/build/resolveColorTokens.ts +115 -51
- package/src/theme/config/tokens/color/types.ts +18 -4
- package/src/theme/defaults/colorTokens.ts +10 -17
- package/src/theme/defaults/config.ts +1 -1
- package/src/theme/getScopedTheme.ts +2 -9
- package/src/theme/system/_constants.ts +25 -0
- package/src/theme/system/_types.ts +41 -0
- package/src/theme/system/color/_constants.ts +0 -8
- package/src/theme/system/color/badge.ts +7 -3
- package/src/theme/system/index.ts +2 -0
- package/src/theme/system/v0/color/_system.ts +4 -8
- package/src/theme/system/v0/color/color.ts +2 -3
- package/src/theme/versioning/themeColor_v0_v2.ts +0 -26
- package/src/theme/versioning/v0_v2.ts +0 -4
- package/src/core/components/breadcrumbs/__workshop__/buttons.tsx +0 -58
- package/src/core/components/dialog/styles.ts +0 -76
|
@@ -24,7 +24,6 @@ import {
|
|
|
24
24
|
ThemeColorInput_v2,
|
|
25
25
|
ThemeColorInputMode_v2,
|
|
26
26
|
ThemeColorInputState_v2,
|
|
27
|
-
THEME_COLOR_CARD_TONES,
|
|
28
27
|
} from '../system'
|
|
29
28
|
import {ColorTokenContext, resolveColorTokenValue as _color} from './colorToken'
|
|
30
29
|
import {resolveColorTokens} from './resolveColorTokens'
|
|
@@ -47,11 +46,14 @@ function buildColorScheme(
|
|
|
47
46
|
): ThemeColorScheme_v2 {
|
|
48
47
|
const {scheme} = options
|
|
49
48
|
|
|
50
|
-
return
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
return {
|
|
50
|
+
transparent: buildCardColorTheme({scheme, tone: 'transparent'}, config),
|
|
51
|
+
default: buildCardColorTheme({scheme, tone: 'default'}, config),
|
|
52
|
+
primary: buildCardColorTheme({scheme, tone: 'primary'}, config),
|
|
53
|
+
positive: buildCardColorTheme({scheme, tone: 'positive'}, config),
|
|
54
|
+
caution: buildCardColorTheme({scheme, tone: 'caution'}, config),
|
|
55
|
+
critical: buildCardColorTheme({scheme, tone: 'critical'}, config),
|
|
56
|
+
}
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
function buildCardColorTheme(
|
|
@@ -75,7 +77,7 @@ function buildCardColorTheme(
|
|
|
75
77
|
badge: buildBadgeColorTheme(tokens?.badge, {scheme}, config),
|
|
76
78
|
bg: _color(context, tokens?.bg),
|
|
77
79
|
border: _color(context, tokens?.border),
|
|
78
|
-
button: buildButtonColorTheme({scheme
|
|
80
|
+
button: buildButtonColorTheme({scheme}, config),
|
|
79
81
|
code: {
|
|
80
82
|
bg: _color(context, tokens?.code?.bg),
|
|
81
83
|
fg: _color(context, tokens?.code?.fg),
|
|
@@ -96,7 +98,7 @@ function buildCardColorTheme(
|
|
|
96
98
|
bg: _color(context, tokens?.muted?.bg),
|
|
97
99
|
fg: _color(context, tokens?.muted?.fg),
|
|
98
100
|
},
|
|
99
|
-
selectable: buildSelectableColorTheme({scheme
|
|
101
|
+
selectable: buildSelectableColorTheme({scheme}, config),
|
|
100
102
|
shadow: buildShadowColorTheme({scheme, tone}, config),
|
|
101
103
|
skeleton: {
|
|
102
104
|
from: _color(context, tokens?.skeleton?.from),
|
|
@@ -165,11 +167,13 @@ function buildBadgeColorTheme(
|
|
|
165
167
|
): ThemeColorBadge_v2 {
|
|
166
168
|
const {scheme} = options
|
|
167
169
|
|
|
168
|
-
return
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
170
|
+
return {
|
|
171
|
+
default: _buildBadgeColorTheme(tokens, {scheme, tone: 'default'}, config),
|
|
172
|
+
primary: _buildBadgeColorTheme(tokens, {scheme, tone: 'primary'}, config),
|
|
173
|
+
positive: _buildBadgeColorTheme(tokens, {scheme, tone: 'positive'}, config),
|
|
174
|
+
caution: _buildBadgeColorTheme(tokens, {scheme, tone: 'caution'}, config),
|
|
175
|
+
critical: _buildBadgeColorTheme(tokens, {scheme, tone: 'critical'}, config),
|
|
176
|
+
}
|
|
173
177
|
}
|
|
174
178
|
|
|
175
179
|
function _buildBadgeColorTheme(
|
|
@@ -191,15 +195,15 @@ function _buildBadgeColorTheme(
|
|
|
191
195
|
}
|
|
192
196
|
|
|
193
197
|
function buildButtonColorTheme(
|
|
194
|
-
options: {scheme: ThemeColorSchemeKey
|
|
198
|
+
options: {scheme: ThemeColorSchemeKey},
|
|
195
199
|
config?: ThemeConfig,
|
|
196
200
|
): ThemeColorButton_v2 {
|
|
197
|
-
const {scheme
|
|
201
|
+
const {scheme} = options
|
|
198
202
|
|
|
199
203
|
const modes: Partial<ThemeColorButton_v2> = {}
|
|
200
204
|
|
|
201
205
|
for (const mode of THEME_COLOR_BUTTON_MODES) {
|
|
202
|
-
modes[mode] = buildButtonTonesColorTheme({
|
|
206
|
+
modes[mode] = buildButtonTonesColorTheme({scheme, mode}, config)
|
|
203
207
|
}
|
|
204
208
|
|
|
205
209
|
return modes as ThemeColorButton_v2
|
|
@@ -207,18 +211,17 @@ function buildButtonColorTheme(
|
|
|
207
211
|
|
|
208
212
|
function buildButtonTonesColorTheme(
|
|
209
213
|
options: {
|
|
210
|
-
cardTone: ThemeColorCardToneKey
|
|
211
214
|
scheme: ThemeColorSchemeKey
|
|
212
215
|
mode: ThemeColorButtonModeKey
|
|
213
216
|
},
|
|
214
217
|
config?: ThemeConfig,
|
|
215
218
|
): ThemeColorButtonMode_v2 {
|
|
216
|
-
const {
|
|
219
|
+
const {mode, scheme} = options
|
|
217
220
|
|
|
218
221
|
const tones: Partial<ThemeColorButtonMode_v2> = {}
|
|
219
222
|
|
|
220
223
|
for (const tone of THEME_COLOR_STATE_TONES) {
|
|
221
|
-
tones[tone] = buildButtonStatesColorTheme({
|
|
224
|
+
tones[tone] = buildButtonStatesColorTheme({mode, scheme, tone}, config)
|
|
222
225
|
}
|
|
223
226
|
|
|
224
227
|
return tones as ThemeColorButtonMode_v2
|
|
@@ -226,19 +229,18 @@ function buildButtonTonesColorTheme(
|
|
|
226
229
|
|
|
227
230
|
function buildButtonStatesColorTheme(
|
|
228
231
|
options: {
|
|
229
|
-
cardTone: ThemeColorCardToneKey
|
|
230
232
|
mode: ThemeColorButtonModeKey
|
|
231
233
|
scheme: ThemeColorSchemeKey
|
|
232
234
|
tone: ThemeColorStateToneKey
|
|
233
235
|
},
|
|
234
236
|
config?: ThemeConfig,
|
|
235
237
|
): ThemeColorButtonTone_v2 {
|
|
236
|
-
const {
|
|
238
|
+
const {mode, scheme, tone} = options
|
|
237
239
|
|
|
238
240
|
const states: Partial<ThemeColorButtonTone_v2> = {}
|
|
239
241
|
|
|
240
242
|
for (const state of THEME_COLOR_STATES) {
|
|
241
|
-
states[state] = buildButtonStateColorTheme({
|
|
243
|
+
states[state] = buildButtonStateColorTheme({mode, tone, scheme, state}, config)
|
|
242
244
|
}
|
|
243
245
|
|
|
244
246
|
return states as ThemeColorButtonTone_v2
|
|
@@ -246,7 +248,6 @@ function buildButtonStatesColorTheme(
|
|
|
246
248
|
|
|
247
249
|
function buildButtonStateColorTheme(
|
|
248
250
|
options: {
|
|
249
|
-
cardTone: ThemeColorCardToneKey
|
|
250
251
|
mode: ThemeColorButtonModeKey
|
|
251
252
|
tone: ThemeColorStateToneKey
|
|
252
253
|
scheme: ThemeColorSchemeKey
|
|
@@ -254,10 +255,9 @@ function buildButtonStateColorTheme(
|
|
|
254
255
|
},
|
|
255
256
|
config?: ThemeConfig,
|
|
256
257
|
): ThemeColorState_v2 {
|
|
257
|
-
const {
|
|
258
|
-
const cardTokens = config?.color?.base?.[cardTone]
|
|
258
|
+
const {mode, tone, scheme, state} = options
|
|
259
259
|
const tokens = config?.color?.button?.[mode]?.[tone]?.[state]
|
|
260
|
-
const hue = tokens?._hue ||
|
|
260
|
+
const hue = tokens?._hue || 'gray'
|
|
261
261
|
const blendMode = tokens?._blend || ['screen', 'multiply']
|
|
262
262
|
const context: ColorTokenContext = {hue, scheme}
|
|
263
263
|
|
|
@@ -318,26 +318,25 @@ function buildInputStatesColorTheme(
|
|
|
318
318
|
const {mode, scheme, tone} = options
|
|
319
319
|
|
|
320
320
|
return {
|
|
321
|
-
enabled: buildInputStateColorTheme({mode, scheme, state: 'enabled',
|
|
322
|
-
hovered: buildInputStateColorTheme({mode, scheme, state: 'hovered',
|
|
323
|
-
readOnly: buildInputStateColorTheme({mode, scheme, state: 'readOnly',
|
|
324
|
-
disabled: buildInputStateColorTheme({mode, scheme, state: 'disabled',
|
|
321
|
+
enabled: buildInputStateColorTheme({mode, scheme, state: 'enabled', tone}, config),
|
|
322
|
+
hovered: buildInputStateColorTheme({mode, scheme, state: 'hovered', tone}, config),
|
|
323
|
+
readOnly: buildInputStateColorTheme({mode, scheme, state: 'readOnly', tone}, config),
|
|
324
|
+
disabled: buildInputStateColorTheme({mode, scheme, state: 'disabled', tone}, config),
|
|
325
325
|
}
|
|
326
326
|
}
|
|
327
327
|
|
|
328
328
|
function buildInputStateColorTheme(
|
|
329
329
|
options: {
|
|
330
|
-
cardTone: ThemeColorCardToneKey
|
|
331
330
|
mode: 'default' | 'invalid'
|
|
332
331
|
scheme: ThemeColorSchemeKey
|
|
333
332
|
state: 'enabled' | 'hovered' | 'readOnly' | 'disabled'
|
|
333
|
+
tone: ThemeColorCardToneKey
|
|
334
334
|
},
|
|
335
335
|
config?: ThemeConfig,
|
|
336
336
|
): ThemeColorInputState_v2 {
|
|
337
|
-
const {
|
|
338
|
-
const cardTokens = config?.color?.base?.[cardTone]
|
|
337
|
+
const {mode, tone, scheme, state} = options
|
|
339
338
|
const tokens = config?.color?.input?.[mode]?.[state]
|
|
340
|
-
const hue = tokens?._hue ||
|
|
339
|
+
const hue = tokens?._hue || config?.color?.base?.[tone]?._hue || 'gray'
|
|
341
340
|
const blendMode = tokens?._blend || ['screen', 'multiply']
|
|
342
341
|
const context: ColorTokenContext = {hue, scheme}
|
|
343
342
|
|
|
@@ -356,16 +355,15 @@ function buildInputStateColorTheme(
|
|
|
356
355
|
function buildSelectableColorTheme(
|
|
357
356
|
options: {
|
|
358
357
|
scheme: ThemeColorSchemeKey
|
|
359
|
-
tone: ThemeColorCardToneKey
|
|
360
358
|
},
|
|
361
359
|
config?: ThemeConfig,
|
|
362
360
|
): ThemeColorButtonMode_v2 {
|
|
363
|
-
const {scheme
|
|
361
|
+
const {scheme} = options
|
|
364
362
|
|
|
365
363
|
const tones: Partial<ThemeColorButtonMode_v2> = {}
|
|
366
364
|
|
|
367
365
|
for (const tone of THEME_COLOR_STATE_TONES) {
|
|
368
|
-
tones[tone] = buildSelectableStatesColorTheme({
|
|
366
|
+
tones[tone] = buildSelectableStatesColorTheme({scheme, tone}, config)
|
|
369
367
|
}
|
|
370
368
|
|
|
371
369
|
return tones as ThemeColorButtonMode_v2
|
|
@@ -373,18 +371,17 @@ function buildSelectableColorTheme(
|
|
|
373
371
|
|
|
374
372
|
function buildSelectableStatesColorTheme(
|
|
375
373
|
options: {
|
|
376
|
-
cardTone: ThemeColorCardToneKey
|
|
377
374
|
scheme: ThemeColorSchemeKey
|
|
378
375
|
tone: ThemeColorStateToneKey
|
|
379
376
|
},
|
|
380
377
|
config?: ThemeConfig,
|
|
381
378
|
): ThemeColorButtonTone_v2 {
|
|
382
|
-
const {
|
|
379
|
+
const {scheme, tone} = options
|
|
383
380
|
|
|
384
381
|
const states: Partial<ThemeColorButtonTone_v2> = {}
|
|
385
382
|
|
|
386
383
|
for (const state of THEME_COLOR_STATES) {
|
|
387
|
-
states[state] = buildSelectableStateColorTheme({
|
|
384
|
+
states[state] = buildSelectableStateColorTheme({tone, scheme, state}, config)
|
|
388
385
|
}
|
|
389
386
|
|
|
390
387
|
return states as ThemeColorButtonTone_v2
|
|
@@ -392,18 +389,15 @@ function buildSelectableStatesColorTheme(
|
|
|
392
389
|
|
|
393
390
|
function buildSelectableStateColorTheme(
|
|
394
391
|
options: {
|
|
395
|
-
cardTone: ThemeColorCardToneKey
|
|
396
392
|
scheme: ThemeColorSchemeKey
|
|
397
393
|
state: ThemeColorStateKey
|
|
398
394
|
tone: ThemeColorStateToneKey
|
|
399
395
|
},
|
|
400
396
|
config?: ThemeConfig,
|
|
401
397
|
): ThemeColorState_v2 {
|
|
402
|
-
const {
|
|
403
|
-
const cardTokens = config?.color?.base?.[cardTone]
|
|
398
|
+
const {scheme, state, tone} = options
|
|
404
399
|
const tokens = config?.color?.selectable?.[tone]?.[state]
|
|
405
|
-
|
|
406
|
-
const hue = tokens?._hue || cardTokens?._hue || 'gray'
|
|
400
|
+
const hue = tokens?._hue || 'gray'
|
|
407
401
|
const blendMode = tokens?._blend || ['screen', 'multiply']
|
|
408
402
|
const context: ColorTokenContext = {hue, scheme}
|
|
409
403
|
|