@sanity/ui 3.0.0-static.11 → 3.0.0-static.13
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/_chunks-cjs/_visual-editing.js +1293 -1215
- package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
- package/dist/_chunks-cjs/buildCommand.js +28 -10
- package/dist/_chunks-cjs/buildCommand.js.map +1 -1
- package/dist/_chunks-es/_visual-editing.mjs +1284 -1202
- package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
- package/dist/_visual-editing.d.mts +528 -358
- package/dist/_visual-editing.d.ts +528 -358
- package/dist/cli.js +1 -1
- package/dist/css.d.mts +143 -73
- package/dist/css.d.ts +143 -73
- package/dist/css.js +329 -472
- package/dist/css.js.map +1 -1
- package/dist/css.mjs +330 -473
- package/dist/css.mjs.map +1 -1
- package/dist/index.d.mts +1362 -869
- package/dist/index.d.ts +1362 -869
- package/dist/index.js +383 -308
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +387 -312
- package/dist/index.mjs.map +1 -1
- package/dist/sanity-palette.css +105 -1
- package/dist/sanity-palette.min.css +1 -0
- package/dist/sanity-theme.css +4571 -1
- package/dist/sanity-theme.min.css +1 -0
- package/dist/system.css +22053 -21946
- package/dist/system.min.css +1 -0
- package/dist/theme.d.mts +51 -106
- package/dist/theme.d.ts +51 -106
- package/dist/theme.js +9 -9
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +9 -9
- package/dist/theme.mjs.map +1 -1
- package/package.json +10 -5
- package/src/cli/buildCommand.ts +46 -19
- package/src/css/_comp.ts +2 -2
- package/src/css/{compile/compileStyle.ts → _compileStyle.ts} +7 -7
- package/src/css/{system.style.ts → _system.style.ts} +3 -2
- package/src/css/aspects/display/display.ts +1 -0
- package/src/css/aspects/display/types.ts +2 -3
- package/src/css/aspects/flex/types.ts +4 -12
- package/src/css/aspects/flexItem/types.ts +1 -3
- package/src/css/aspects/font/types.ts +1 -3
- package/src/css/aspects/grid/grid.ts +1 -0
- package/src/css/aspects/grid/types.ts +5 -9
- package/src/css/aspects/gridItem/gridItem.ts +1 -1
- package/src/css/aspects/gridItem/types.ts +7 -18
- package/src/css/aspects/height/height.ts +3 -4
- package/src/css/aspects/inset/inset.ts +1 -0
- package/src/css/aspects/margin/margin.ts +1 -0
- package/src/css/aspects/margin/types.ts +1 -0
- package/src/css/aspects/maxWidth/maxWidth.ts +1 -0
- package/src/css/aspects/maxWidth/types.ts +1 -0
- package/src/css/aspects/minWidth/minWidth.ts +1 -0
- package/src/css/aspects/minWidth/types.ts +2 -0
- package/src/css/aspects/overflow/overflow.ts +1 -0
- package/src/css/aspects/padding/padding.ts +1 -0
- package/src/css/aspects/pointerEvents/pointerEvents.ts +1 -0
- package/src/css/aspects/position/position.ts +1 -0
- package/src/css/aspects/shadow/shadow.ts +1 -0
- package/src/css/aspects/textOverflow/textOverflow.ts +1 -0
- package/src/css/aspects/textOverflow/types.ts +1 -0
- package/src/css/aspects/width/types.ts +2 -0
- package/src/css/aspects/width/width.ts +1 -0
- package/src/css/{compile/compilePalette.ts → compilePalette.ts} +14 -10
- package/src/css/compileSystem.ts +7 -0
- package/src/css/{compile/compileTheme.ts → compileTheme.ts} +1 -0
- package/src/css/{compile/compileTheme_v3.ts → compileTheme_v3.ts} +123 -104
- package/src/css/components/breadcrumbs/breadcrumbs.ts +1 -0
- package/src/css/components/dialog/dialog.ts +7 -0
- package/src/css/components/menu/menu.ts +2 -0
- package/src/css/components/skeleton/skeleton.ts +4 -0
- package/src/css/components/skeleton/types.ts +4 -0
- package/src/css/components/toast/toast.ts +5 -0
- package/src/css/components/tree/tree.ts +1 -0
- package/src/css/composeClassNames.ts +4 -2
- package/src/css/constants.ts +2 -0
- package/src/css/index.ts +3 -3
- package/src/css/primitives/_arrow/_arrow.ts +3 -0
- package/src/css/primitives/_input/input.ts +2 -0
- package/src/css/primitives/_selectable/_selectable.style.ts +1 -2
- package/src/css/primitives/_selectable/selectable.ts +1 -2
- package/src/css/primitives/avatar/avatar.style.ts +5 -8
- package/src/css/primitives/avatar/avatar.ts +6 -0
- package/src/css/primitives/avatar/types.ts +1 -0
- package/src/css/primitives/box/types.ts +1 -3
- package/src/css/primitives/button/button.ts +4 -21
- package/src/css/primitives/button/index.ts +1 -0
- package/src/css/primitives/button/types.ts +18 -0
- package/src/css/primitives/card/card.style.ts +3 -6
- package/src/css/primitives/card/card.ts +2 -2
- package/src/css/primitives/card/types.ts +2 -2
- package/src/css/primitives/checkbox/checkbox.ts +2 -0
- package/src/css/primitives/container/container.ts +1 -0
- package/src/css/primitives/container/types.ts +1 -0
- package/src/css/primitives/kbd/kbd.ts +1 -0
- package/src/css/primitives/label/types.ts +7 -2
- package/src/css/primitives/popover/popover.ts +2 -0
- package/src/css/primitives/radio/radio.ts +1 -0
- package/src/css/primitives/select/select.ts +2 -0
- package/src/css/primitives/spinner/spinner.ts +2 -0
- package/src/css/primitives/switch/switch.ts +5 -0
- package/src/css/primitives/text/types.ts +4 -0
- package/src/css/primitives/textArea/textArea.ts +1 -0
- package/src/css/primitives/textInput/textInput.ts +1 -0
- package/src/css/primitives/tooltip/tooltip.ts +2 -0
- package/src/css/scopeClassName.ts +1 -0
- package/src/css/types.ts +9 -12
- package/src/css/util.ts +5 -0
- package/src/css/utils/srOnly/srOnly.ts +3 -1
- package/src/css/varNames.ts +131 -141
- package/src/css/vars.ts +1 -6
- package/src/theme/palette/constants.ts +2 -0
- package/src/theme/palette/types.ts +3 -0
- package/src/theme/types.ts +2 -6
- package/src/theme/v0/focusRing.ts +1 -3
- package/src/theme/v0/font.ts +6 -18
- package/src/theme/v0/layer.ts +1 -3
- package/src/theme/v0/shadow.ts +2 -6
- package/src/theme/v2/avatar.ts +1 -3
- package/src/theme/v2/color/_system.ts +1 -3
- package/src/theme/v2/color/avatar.ts +2 -6
- package/src/theme/v2/color/badge.ts +2 -6
- package/src/theme/v2/color/button.ts +3 -9
- package/src/theme/v2/color/color.ts +3 -9
- package/src/theme/v2/color/input.ts +3 -9
- package/src/theme/v2/color/kbd.ts +1 -3
- package/src/theme/v2/color/selectable.ts +2 -6
- package/src/theme/v2/color/state.ts +1 -3
- package/src/theme/v2/color/syntax.ts +1 -3
- package/src/theme/v2/input.ts +1 -3
- package/src/theme/v2/theme.ts +2 -6
- package/src/theme/v3/buildTheme_v3.ts +1 -0
- package/src/theme/v3/color/color.ts +6 -4
- package/src/theme/v3/color/renderColor.ts +4 -1
- package/src/theme/v3/defaultTokens.ts +1 -0
- package/src/theme/v3/resolveTokens.ts +9 -9
- package/src/ui/RootClassNames.tsx +3 -0
- package/src/ui/StyleTags.tsx +3 -1
- package/src/ui/_compat/theme/themeColorProvider.tsx +2 -6
- package/src/ui/_compat/theme/themeProvider.tsx +2 -6
- package/src/ui/_compat/theme/types.ts +1 -3
- package/src/ui/_compat/theme/useRootTheme.ts +1 -3
- package/src/ui/_compat/theme/useTheme.ts +2 -6
- package/src/ui/components/autocomplete/__workshop__/constrainedHeight.tsx +2 -2
- package/src/ui/components/autocomplete/autocomplete.tsx +86 -114
- package/src/ui/components/autocomplete/autocompleteOption.tsx +2 -0
- package/src/ui/components/autocomplete/types.ts +3 -8
- package/src/ui/components/breadcrumbs/breadcrumbs.tsx +27 -21
- package/src/ui/components/dialog/dialog.tsx +89 -291
- package/src/ui/components/dialog/dialogCard.tsx +183 -0
- package/src/ui/components/dialog/isTargetWithinScope.ts +14 -0
- package/src/ui/components/hotkeys/hotkeys.tsx +33 -15
- package/src/ui/components/menu/__workshop__/asComponent.tsx +6 -6
- package/src/ui/components/menu/menu.tsx +27 -33
- package/src/ui/components/menu/menuButton.tsx +10 -14
- package/src/ui/components/menu/menuDivider.tsx +25 -13
- package/src/ui/components/menu/menuGroup.tsx +34 -26
- package/src/ui/components/menu/menuItem.tsx +51 -40
- package/src/ui/components/skeleton/codeSkeleton.tsx +53 -0
- package/src/ui/components/skeleton/headingSkeleton.tsx +52 -0
- package/src/ui/components/skeleton/index.ts +3 -0
- package/src/ui/components/skeleton/labelSkeleton.tsx +51 -0
- package/src/ui/components/skeleton/skeleton.tsx +39 -16
- package/src/ui/components/skeleton/textSkeleton.tsx +31 -110
- package/src/ui/components/tab/tab.tsx +23 -19
- package/src/ui/components/tab/tabList.tsx +34 -33
- package/src/ui/components/tab/tabPanel.tsx +25 -19
- package/src/ui/components/toast/toast.tsx +21 -16
- package/src/ui/components/toast/toastLayer.tsx +28 -10
- package/src/ui/components/toast/toastProvider.tsx +2 -6
- package/src/ui/components/toast/types.ts +2 -6
- package/src/ui/components/toast/useToast.ts +1 -3
- package/src/ui/components/tree/tree.tsx +194 -187
- package/src/ui/components/tree/treeGroup.tsx +25 -5
- package/src/ui/components/tree/treeItem.tsx +35 -23
- package/src/ui/hooks/useClickOutside.ts +2 -6
- package/src/ui/hooks/useClickOutsideEvent.ts +3 -9
- package/src/ui/primitives/_selectable/selectable.tsx +33 -20
- package/src/ui/primitives/avatar/avatar.tsx +28 -31
- package/src/ui/primitives/avatar/avatarCounter.tsx +33 -25
- package/src/ui/primitives/avatar/avatarStack.tsx +31 -24
- package/src/ui/primitives/avatar/types.ts +2 -0
- package/src/ui/primitives/badge/__workshop__/props.tsx +1 -9
- package/src/ui/primitives/badge/__workshop__/tones.tsx +1 -6
- package/src/ui/primitives/badge/badge.tsx +33 -32
- package/src/ui/primitives/badge/types.ts +2 -1
- package/src/ui/primitives/box/box.tsx +59 -29
- package/src/ui/primitives/button/__workshop__/sanityUploadButton.tsx +3 -3
- package/src/ui/primitives/button/__workshop__/uploadButton.tsx +2 -1
- package/src/ui/primitives/button/button.test.tsx +1 -15
- package/src/ui/primitives/button/button.tsx +64 -70
- package/src/ui/primitives/card/__workshop__/asComponent.tsx +3 -3
- package/src/ui/primitives/card/card.tsx +22 -22
- package/src/ui/primitives/card/cardProvider.tsx +2 -0
- package/src/ui/primitives/checkbox/checkbox.tsx +26 -15
- package/src/ui/primitives/code/code.tsx +24 -22
- package/src/ui/primitives/container/container.tsx +26 -15
- package/src/ui/primitives/flex/flex.tsx +21 -19
- package/src/ui/primitives/grid/grid.tsx +21 -16
- package/src/ui/primitives/heading/heading.tsx +42 -19
- package/src/ui/primitives/inline/inline.tsx +26 -23
- package/src/ui/primitives/kbd/kbd.tsx +25 -23
- package/src/ui/primitives/label/label.tsx +41 -26
- package/src/ui/primitives/popover/popover.tsx +281 -277
- package/src/ui/primitives/popover/popoverCard.tsx +119 -118
- package/src/ui/primitives/radio/radio.tsx +30 -14
- package/src/ui/primitives/select/select.tsx +24 -16
- package/src/ui/primitives/spinner/animatedSpinnerIcon.tsx +4 -2
- package/src/ui/primitives/spinner/spinner.tsx +24 -12
- package/src/ui/primitives/stack/stack.tsx +27 -18
- package/src/ui/primitives/switch/switch.tsx +31 -14
- package/src/ui/primitives/text/text.tsx +42 -24
- package/src/ui/primitives/textArea/textArea.tsx +33 -18
- package/src/ui/primitives/textInput/textInput.tsx +28 -40
- package/src/ui/primitives/tooltip/constants.ts +1 -1
- package/src/ui/primitives/tooltip/tooltip.tsx +76 -59
- package/src/ui/primitives/tooltip/tooltipCard.tsx +89 -82
- package/src/ui/primitives/types.ts +1 -3
- package/src/ui/types/avatar.ts +3 -6
- package/src/ui/types/badge.ts +1 -3
- package/src/ui/types/button.ts +1 -3
- package/src/ui/types/card.ts +1 -3
- package/src/ui/types/dialog.ts +1 -3
- package/src/ui/types/props.ts +20 -10
- package/src/ui/utils/arrow/arrow.tsx +40 -14
- package/src/ui/utils/boundaryElement/boundaryElementProvider.tsx +2 -6
- package/src/ui/utils/boundaryElement/types.ts +1 -3
- package/src/ui/utils/boundaryElement/useBoundaryElement.ts +1 -3
- package/src/ui/utils/elementQuery/elementQuery.tsx +36 -14
- package/src/ui/utils/errorBoundary.tsx +2 -0
- package/src/ui/utils/index.ts +0 -1
- package/src/ui/utils/layer/layer.tsx +23 -93
- package/src/ui/utils/layer/layerCard.tsx +92 -0
- package/src/ui/utils/layer/layerProvider.tsx +2 -6
- package/src/ui/utils/layer/useLayer.ts +1 -3
- package/src/ui/utils/portal/portal.ts +2 -6
- package/src/ui/utils/portal/portalProvider.tsx +2 -6
- package/src/ui/utils/portal/types.ts +1 -3
- package/src/ui/utils/portal/usePortal.ts +1 -3
- package/src/ui/utils/srOnly/srOnly.tsx +25 -20
- package/src/ui/utils/virtualList/virtualList.tsx +36 -24
- package/src/css/compile/compileRule.ts +0 -97
- package/src/css/compile/compileRules.test.ts +0 -36
- package/src/css/compile/compileRules.ts +0 -43
- package/src/css/compile/compileSystem.ts +0 -7
- package/src/css/compile/types.ts +0 -6
- package/src/css/primitives/_selectable/_contants.ts +0 -11
- package/src/css/primitives/card/_constants.ts +0 -13
- package/src/ui/utils/conditionalWrapper/conditionalWrapper.tsx +0 -23
- package/src/ui/utils/conditionalWrapper/index.ts +0 -1
|
@@ -13,16 +13,23 @@ import {
|
|
|
13
13
|
ThemeColorSchemeKey,
|
|
14
14
|
} from '@sanity/ui/theme'
|
|
15
15
|
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
16
|
+
import {_compileStyle} from './_compileStyle'
|
|
17
|
+
import {Properties} from './types'
|
|
18
|
+
import {px, rem, toBoxShadow} from './util'
|
|
19
|
+
import {varNames} from './varNames'
|
|
20
20
|
|
|
21
21
|
const THEME_COLOR_SCHEMES = ['dark', 'light'] as const
|
|
22
22
|
const THEME_COLOR_VARIANTS = ['tinted', 'solid'] as const
|
|
23
23
|
|
|
24
|
+
/** @internal */
|
|
24
25
|
export function compileTheme_v3(theme: Theme_v3): string {
|
|
25
|
-
return
|
|
26
|
+
return _compileStyle({
|
|
27
|
+
layers: {
|
|
28
|
+
theme: {
|
|
29
|
+
':root': compileThemeProperties(theme),
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
})
|
|
26
33
|
}
|
|
27
34
|
|
|
28
35
|
function compileThemeProperties(theme: Theme_v3): Properties {
|
|
@@ -30,6 +37,7 @@ function compileThemeProperties(theme: Theme_v3): Properties {
|
|
|
30
37
|
...buildAvatarThemeProperties(theme),
|
|
31
38
|
...buildButtonThemeProperties(theme),
|
|
32
39
|
[varNames.card.shadow.outline]: px(theme.card.shadow.outline),
|
|
40
|
+
...buildColorThemeProperties(theme),
|
|
33
41
|
...buildContainerThemeProperties(theme),
|
|
34
42
|
...buildFontCodeThemeProperties(theme),
|
|
35
43
|
...buildFontHeadingThemeProperties(theme),
|
|
@@ -39,7 +47,6 @@ function compileThemeProperties(theme: Theme_v3): Properties {
|
|
|
39
47
|
...buildRadiusThemeProperties(theme),
|
|
40
48
|
...buildShadowThemeProperties(theme),
|
|
41
49
|
...buildSpaceThemeProperties(theme),
|
|
42
|
-
...buildColorThemeProperties(theme),
|
|
43
50
|
}
|
|
44
51
|
}
|
|
45
52
|
|
|
@@ -48,17 +55,17 @@ function buildAvatarThemeProperties(theme: Theme_v3): Properties {
|
|
|
48
55
|
[varNames.avatar.focusRing.offset]: px(theme.avatar.focusRing.offset),
|
|
49
56
|
[varNames.avatar.focusRing.width]: px(theme.avatar.focusRing.width),
|
|
50
57
|
|
|
51
|
-
[varNames.avatar.sizes[0].distance]:
|
|
52
|
-
[varNames.avatar.sizes[0].size]:
|
|
58
|
+
[varNames.avatar.sizes[0].distance]: rem(theme.avatar.sizes[0].distance),
|
|
59
|
+
[varNames.avatar.sizes[0].size]: rem(theme.avatar.sizes[0].size),
|
|
53
60
|
|
|
54
|
-
[varNames.avatar.sizes[1].distance]:
|
|
55
|
-
[varNames.avatar.sizes[1].size]:
|
|
61
|
+
[varNames.avatar.sizes[1].distance]: rem(theme.avatar.sizes[1].distance),
|
|
62
|
+
[varNames.avatar.sizes[1].size]: rem(theme.avatar.sizes[1].size),
|
|
56
63
|
|
|
57
|
-
[varNames.avatar.sizes[2].distance]:
|
|
58
|
-
[varNames.avatar.sizes[2].size]:
|
|
64
|
+
[varNames.avatar.sizes[2].distance]: rem(theme.avatar.sizes[2].distance),
|
|
65
|
+
[varNames.avatar.sizes[2].size]: rem(theme.avatar.sizes[2].size),
|
|
59
66
|
|
|
60
|
-
[varNames.avatar.sizes[3].distance]:
|
|
61
|
-
[varNames.avatar.sizes[3].size]:
|
|
67
|
+
[varNames.avatar.sizes[3].distance]: rem(theme.avatar.sizes[3].distance),
|
|
68
|
+
[varNames.avatar.sizes[3].size]: rem(theme.avatar.sizes[3].size),
|
|
62
69
|
}
|
|
63
70
|
}
|
|
64
71
|
|
|
@@ -72,110 +79,122 @@ function buildButtonThemeProperties(theme: Theme_v3): Properties {
|
|
|
72
79
|
|
|
73
80
|
function buildContainerThemeProperties(theme: Theme_v3): Properties {
|
|
74
81
|
return {
|
|
75
|
-
[varNames.container[0]]:
|
|
76
|
-
[varNames.container[1]]:
|
|
77
|
-
[varNames.container[2]]:
|
|
78
|
-
[varNames.container[3]]:
|
|
79
|
-
[varNames.container[4]]:
|
|
80
|
-
[varNames.container[5]]:
|
|
82
|
+
[varNames.container[0]]: rem(theme.container[0]),
|
|
83
|
+
[varNames.container[1]]: rem(theme.container[1]),
|
|
84
|
+
[varNames.container[2]]: rem(theme.container[2]),
|
|
85
|
+
[varNames.container[3]]: rem(theme.container[3]),
|
|
86
|
+
[varNames.container[4]]: rem(theme.container[4]),
|
|
87
|
+
[varNames.container[5]]: rem(theme.container[5]),
|
|
81
88
|
}
|
|
82
89
|
}
|
|
83
90
|
|
|
84
91
|
function buildFontCodeThemeProperties(theme: Theme_v3): Properties {
|
|
92
|
+
const v = varNames.font.code
|
|
93
|
+
const t = theme.font.code
|
|
94
|
+
|
|
85
95
|
const props: Properties = {
|
|
86
|
-
[
|
|
87
|
-
[
|
|
88
|
-
[
|
|
89
|
-
[
|
|
90
|
-
[
|
|
91
|
-
[
|
|
96
|
+
[v.family]: t.family,
|
|
97
|
+
[v.featureSettings]: t.featureSettings || 'normal',
|
|
98
|
+
[v.weights.regular]: t.weights.regular,
|
|
99
|
+
[v.weights.medium]: t.weights.medium,
|
|
100
|
+
[v.weights.semibold]: t.weights.semibold,
|
|
101
|
+
[v.weights.bold]: t.weights.bold,
|
|
92
102
|
}
|
|
93
103
|
|
|
94
104
|
for (const size of FONT_CODE_SIZE) {
|
|
95
|
-
const
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
props[
|
|
99
|
-
props[
|
|
100
|
-
props[
|
|
101
|
-
props[
|
|
102
|
-
props[
|
|
103
|
-
props[
|
|
105
|
+
const _v = varNames.font.code.sizes[size]
|
|
106
|
+
const _t = theme.font.code.sizes[size]
|
|
107
|
+
|
|
108
|
+
props[_v.fontSize] = rem(_t.fontSize)
|
|
109
|
+
props[_v.lineHeight] = rem(_t.lineHeight)
|
|
110
|
+
props[_v.ascenderHeight] = rem(_t.ascenderHeight)
|
|
111
|
+
props[_v.descenderHeight] = rem(_t.descenderHeight)
|
|
112
|
+
props[_v.letterSpacing] = rem(_t.letterSpacing)
|
|
113
|
+
props[_v.iconSize] = rem(_t.iconSize)
|
|
104
114
|
}
|
|
105
115
|
|
|
106
116
|
return props
|
|
107
117
|
}
|
|
108
118
|
|
|
109
119
|
function buildFontHeadingThemeProperties(theme: Theme_v3): Properties {
|
|
120
|
+
const v = varNames.font.heading
|
|
121
|
+
const t = theme.font.heading
|
|
122
|
+
|
|
110
123
|
const props: Properties = {
|
|
111
|
-
[
|
|
112
|
-
[
|
|
113
|
-
[
|
|
114
|
-
[
|
|
115
|
-
[
|
|
116
|
-
[
|
|
124
|
+
[v.family]: t.family,
|
|
125
|
+
[v.featureSettings]: t.featureSettings,
|
|
126
|
+
[v.weights.regular]: t.weights.regular,
|
|
127
|
+
[v.weights.medium]: t.weights.medium,
|
|
128
|
+
[v.weights.semibold]: t.weights.semibold,
|
|
129
|
+
[v.weights.bold]: t.weights.bold,
|
|
117
130
|
}
|
|
118
131
|
|
|
119
132
|
for (const size of FONT_HEADING_SIZE) {
|
|
120
|
-
const
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
props[
|
|
124
|
-
props[
|
|
125
|
-
props[
|
|
126
|
-
props[
|
|
127
|
-
props[
|
|
128
|
-
props[
|
|
133
|
+
const _v = v.sizes[size]
|
|
134
|
+
const _t = t.sizes[size]
|
|
135
|
+
|
|
136
|
+
props[_v.fontSize] = rem(_t.fontSize)
|
|
137
|
+
props[_v.lineHeight] = rem(_t.lineHeight)
|
|
138
|
+
props[_v.ascenderHeight] = rem(_t.ascenderHeight)
|
|
139
|
+
props[_v.descenderHeight] = rem(_t.descenderHeight)
|
|
140
|
+
props[_v.letterSpacing] = rem(_t.letterSpacing)
|
|
141
|
+
props[_v.iconSize] = rem(_t.iconSize)
|
|
129
142
|
}
|
|
130
143
|
|
|
131
144
|
return props
|
|
132
145
|
}
|
|
133
146
|
|
|
134
147
|
function buildFontLabelThemeProperties(theme: Theme_v3): Properties {
|
|
148
|
+
const v = varNames.font.label
|
|
149
|
+
const t = theme.font.label
|
|
150
|
+
|
|
135
151
|
const props: Properties = {
|
|
136
|
-
[
|
|
137
|
-
[
|
|
138
|
-
[
|
|
139
|
-
[
|
|
140
|
-
[
|
|
141
|
-
[
|
|
152
|
+
[v.family]: t.family,
|
|
153
|
+
[v.featureSettings]: t.featureSettings,
|
|
154
|
+
[v.weights.regular]: t.weights.regular,
|
|
155
|
+
[v.weights.medium]: t.weights.medium,
|
|
156
|
+
[v.weights.semibold]: t.weights.semibold,
|
|
157
|
+
[v.weights.bold]: t.weights.bold,
|
|
142
158
|
}
|
|
143
159
|
|
|
144
160
|
for (const size of FONT_LABEL_SIZE) {
|
|
145
|
-
const
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
props[
|
|
149
|
-
props[
|
|
150
|
-
props[
|
|
151
|
-
props[
|
|
152
|
-
props[
|
|
153
|
-
props[
|
|
161
|
+
const _v = v.sizes[size]
|
|
162
|
+
const _t = t.sizes[size]
|
|
163
|
+
|
|
164
|
+
props[_v.fontSize] = rem(_t.fontSize)
|
|
165
|
+
props[_v.lineHeight] = rem(_t.lineHeight)
|
|
166
|
+
props[_v.ascenderHeight] = rem(_t.ascenderHeight)
|
|
167
|
+
props[_v.descenderHeight] = rem(_t.descenderHeight)
|
|
168
|
+
props[_v.letterSpacing] = rem(_t.letterSpacing)
|
|
169
|
+
props[_v.iconSize] = rem(_t.iconSize)
|
|
154
170
|
}
|
|
155
171
|
|
|
156
172
|
return props
|
|
157
173
|
}
|
|
158
174
|
|
|
159
175
|
function buildFontTextThemeProperties(theme: Theme_v3): Properties {
|
|
176
|
+
const v = varNames.font.text
|
|
177
|
+
const t = theme.font.text
|
|
178
|
+
|
|
160
179
|
const props: Properties = {
|
|
161
|
-
[
|
|
162
|
-
[
|
|
163
|
-
[
|
|
164
|
-
[
|
|
165
|
-
[
|
|
166
|
-
[
|
|
180
|
+
[v.family]: t.family,
|
|
181
|
+
[v.featureSettings]: t.featureSettings,
|
|
182
|
+
[v.weights.regular]: t.weights.regular,
|
|
183
|
+
[v.weights.medium]: t.weights.medium,
|
|
184
|
+
[v.weights.semibold]: t.weights.semibold,
|
|
185
|
+
[v.weights.bold]: t.weights.bold,
|
|
167
186
|
}
|
|
168
187
|
|
|
169
188
|
for (const size of FONT_TEXT_SIZE) {
|
|
170
|
-
const
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
props[
|
|
174
|
-
props[
|
|
175
|
-
props[
|
|
176
|
-
props[
|
|
177
|
-
props[
|
|
178
|
-
props[
|
|
189
|
+
const _v = v.sizes[size]
|
|
190
|
+
const _t = t.sizes[size]
|
|
191
|
+
|
|
192
|
+
props[_v.fontSize] = rem(_t.fontSize)
|
|
193
|
+
props[_v.lineHeight] = rem(_t.lineHeight)
|
|
194
|
+
props[_v.ascenderHeight] = rem(_t.ascenderHeight)
|
|
195
|
+
props[_v.descenderHeight] = rem(_t.descenderHeight)
|
|
196
|
+
props[_v.letterSpacing] = rem(_t.letterSpacing)
|
|
197
|
+
props[_v.iconSize] = rem(_t.iconSize)
|
|
179
198
|
}
|
|
180
199
|
|
|
181
200
|
return props
|
|
@@ -186,20 +205,20 @@ function buildInputThemeProperties(theme: Theme_v3): Properties {
|
|
|
186
205
|
[varNames.input.border.width]: px(theme.input.border.width),
|
|
187
206
|
[varNames.input.checkbox.focusRing.offset]: px(theme.input.checkbox.focusRing.offset),
|
|
188
207
|
[varNames.input.checkbox.focusRing.width]: px(theme.input.checkbox.focusRing.width),
|
|
189
|
-
[varNames.input.checkbox.size]:
|
|
208
|
+
[varNames.input.checkbox.size]: rem(theme.input.checkbox.size),
|
|
190
209
|
[varNames.input.radio.focusRing.offset]: px(theme.input.radio.focusRing.offset),
|
|
191
210
|
[varNames.input.radio.focusRing.width]: px(theme.input.radio.focusRing.width),
|
|
192
|
-
[varNames.input.radio.markSize]:
|
|
193
|
-
[varNames.input.radio.size]:
|
|
211
|
+
[varNames.input.radio.markSize]: rem(theme.input.radio.markSize),
|
|
212
|
+
[varNames.input.radio.size]: rem(theme.input.radio.size),
|
|
194
213
|
[varNames.input.select.focusRing.offset]: px(theme.input.select.focusRing.offset),
|
|
195
214
|
[varNames.input.select.focusRing.width]: px(theme.input.select.focusRing.width),
|
|
196
215
|
[varNames.input.switch.focusRing.offset]: px(theme.input.switch.focusRing.offset),
|
|
197
216
|
[varNames.input.switch.focusRing.width]: px(theme.input.switch.focusRing.width),
|
|
198
|
-
[varNames.input.switch.height]:
|
|
199
|
-
[varNames.input.switch.padding]:
|
|
217
|
+
[varNames.input.switch.height]: rem(theme.input.switch.height),
|
|
218
|
+
[varNames.input.switch.padding]: rem(theme.input.switch.padding),
|
|
200
219
|
[varNames.input.switch.transitionDurationMs]: `${theme.input.switch.transitionDurationMs}ms`,
|
|
201
220
|
[varNames.input.switch.transitionTimingFunction]: theme.input.switch.transitionTimingFunction,
|
|
202
|
-
[varNames.input.switch.width]:
|
|
221
|
+
[varNames.input.switch.width]: rem(theme.input.switch.width),
|
|
203
222
|
[varNames.input.text.focusRing.offset]: px(theme.input.text.focusRing.offset),
|
|
204
223
|
[varNames.input.text.focusRing.width]: px(theme.input.text.focusRing.width),
|
|
205
224
|
}
|
|
@@ -207,13 +226,13 @@ function buildInputThemeProperties(theme: Theme_v3): Properties {
|
|
|
207
226
|
|
|
208
227
|
function buildRadiusThemeProperties(theme: Theme_v3): Properties {
|
|
209
228
|
return {
|
|
210
|
-
[varNames.radius[0]]:
|
|
211
|
-
[varNames.radius[1]]:
|
|
212
|
-
[varNames.radius[2]]:
|
|
213
|
-
[varNames.radius[3]]:
|
|
214
|
-
[varNames.radius[4]]:
|
|
215
|
-
[varNames.radius[5]]:
|
|
216
|
-
[varNames.radius[6]]:
|
|
229
|
+
[varNames.radius[0]]: px(theme.radius[0]),
|
|
230
|
+
[varNames.radius[1]]: px(theme.radius[1]),
|
|
231
|
+
[varNames.radius[2]]: px(theme.radius[2]),
|
|
232
|
+
[varNames.radius[3]]: px(theme.radius[3]),
|
|
233
|
+
[varNames.radius[4]]: px(theme.radius[4]),
|
|
234
|
+
[varNames.radius[5]]: px(theme.radius[5]),
|
|
235
|
+
[varNames.radius[6]]: px(theme.radius[6]),
|
|
217
236
|
}
|
|
218
237
|
}
|
|
219
238
|
|
|
@@ -247,17 +266,17 @@ function buildShadowThemeProperties(theme: Theme_v3): Properties {
|
|
|
247
266
|
|
|
248
267
|
function buildSpaceThemeProperties(theme: Theme_v3): Properties {
|
|
249
268
|
return {
|
|
250
|
-
[varNames.space[0]]:
|
|
251
|
-
[varNames.space[0.5]]:
|
|
252
|
-
[varNames.space[1]]:
|
|
253
|
-
[varNames.space[2]]:
|
|
254
|
-
[varNames.space[3]]:
|
|
255
|
-
[varNames.space[4]]:
|
|
256
|
-
[varNames.space[5]]:
|
|
257
|
-
[varNames.space[6]]:
|
|
258
|
-
[varNames.space[7]]:
|
|
259
|
-
[varNames.space[8]]:
|
|
260
|
-
[varNames.space[9]]:
|
|
269
|
+
[varNames.space[0]]: px(theme.space[0]),
|
|
270
|
+
[varNames.space[0.5]]: px(theme.space[1] / 2),
|
|
271
|
+
[varNames.space[1]]: px(theme.space[1]),
|
|
272
|
+
[varNames.space[2]]: px(theme.space[2]),
|
|
273
|
+
[varNames.space[3]]: px(theme.space[3]),
|
|
274
|
+
[varNames.space[4]]: px(theme.space[4]),
|
|
275
|
+
[varNames.space[5]]: px(theme.space[5]),
|
|
276
|
+
[varNames.space[6]]: px(theme.space[6]),
|
|
277
|
+
[varNames.space[7]]: px(theme.space[7]),
|
|
278
|
+
[varNames.space[8]]: px(theme.space[8]),
|
|
279
|
+
[varNames.space[9]]: px(theme.space[9]),
|
|
261
280
|
}
|
|
262
281
|
}
|
|
263
282
|
|
|
@@ -1,30 +1,37 @@
|
|
|
1
1
|
import {_comp} from '../../_comp'
|
|
2
2
|
import {inset} from '../../aspects'
|
|
3
3
|
|
|
4
|
+
/** @public */
|
|
4
5
|
export function dialog(): string | undefined {
|
|
5
6
|
return _comp('dialog', inset({inset: 0}))
|
|
6
7
|
}
|
|
7
8
|
|
|
9
|
+
/** @public */
|
|
8
10
|
export function dialogContainer(): string | undefined {
|
|
9
11
|
return _comp('dialog-container')
|
|
10
12
|
}
|
|
11
13
|
|
|
14
|
+
/** @public */
|
|
12
15
|
export function dialogCardRoot(): string | undefined {
|
|
13
16
|
return _comp('dialog-card-root')
|
|
14
17
|
}
|
|
15
18
|
|
|
19
|
+
/** @public */
|
|
16
20
|
export function dialogLayout(): string | undefined {
|
|
17
21
|
return _comp('dialog-layout')
|
|
18
22
|
}
|
|
19
23
|
|
|
24
|
+
/** @public */
|
|
20
25
|
export function dialogHeader(): string | undefined {
|
|
21
26
|
return _comp('dialog-header')
|
|
22
27
|
}
|
|
23
28
|
|
|
29
|
+
/** @public */
|
|
24
30
|
export function dialogContent(): string | undefined {
|
|
25
31
|
return _comp('dialog-content')
|
|
26
32
|
}
|
|
27
33
|
|
|
34
|
+
/** @public */
|
|
28
35
|
export function dialogFooter(): string | undefined {
|
|
29
36
|
return _comp('dialog-footer')
|
|
30
37
|
}
|
|
@@ -14,18 +14,22 @@ export function skeleton(props: SkeletonStyleProps): string | undefined {
|
|
|
14
14
|
return _comp('skeleton', radius(props))
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
/** @beta */
|
|
17
18
|
export function codeSkeleton(props: CodeSkeletonStyleProps): string | undefined {
|
|
18
19
|
return _comp('font-skeleton', _resp('code-skeleton', props.size))
|
|
19
20
|
}
|
|
20
21
|
|
|
22
|
+
/** @beta */
|
|
21
23
|
export function headingSkeleton(props: HeadingSkeletonStyleProps): string | undefined {
|
|
22
24
|
return _comp('font-skeleton', _resp('heading-skeleton', props.size))
|
|
23
25
|
}
|
|
24
26
|
|
|
27
|
+
/** @beta */
|
|
25
28
|
export function labelSkeleton(props: LabelSkeletonStyleProps): string | undefined {
|
|
26
29
|
return _comp('font-skeleton', _resp('label-skeleton', props.size))
|
|
27
30
|
}
|
|
28
31
|
|
|
32
|
+
/** @beta */
|
|
29
33
|
export function textSkeleton(props: TextSkeletonStyleProps): string | undefined {
|
|
30
34
|
return _comp('font-skeleton', _resp('text-skeleton', props.size))
|
|
31
35
|
}
|
|
@@ -9,18 +9,22 @@ export interface SkeletonStyleProps extends RadiusStyleProps {
|
|
|
9
9
|
// visible?: boolean
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
/** @beta */
|
|
12
13
|
export interface CodeSkeletonStyleProps {
|
|
13
14
|
size?: ResponsiveProp<FontCodeSize>
|
|
14
15
|
}
|
|
15
16
|
|
|
17
|
+
/** @beta */
|
|
16
18
|
export interface HeadingSkeletonStyleProps {
|
|
17
19
|
size?: ResponsiveProp<FontHeadingSize>
|
|
18
20
|
}
|
|
19
21
|
|
|
22
|
+
/** @beta */
|
|
20
23
|
export interface LabelSkeletonStyleProps {
|
|
21
24
|
size?: ResponsiveProp<FontLabelSize>
|
|
22
25
|
}
|
|
23
26
|
|
|
27
|
+
/** @beta */
|
|
24
28
|
export interface TextSkeletonStyleProps {
|
|
25
29
|
size?: ResponsiveProp<FontTextSize>
|
|
26
30
|
}
|
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
import {_comp} from '../../_comp'
|
|
2
2
|
|
|
3
|
+
/** @public */
|
|
3
4
|
export function toastLayer() {
|
|
4
5
|
return _comp('toast-layer')
|
|
5
6
|
}
|
|
6
7
|
|
|
8
|
+
/** @public */
|
|
7
9
|
export function toast() {
|
|
8
10
|
return _comp('toast')
|
|
9
11
|
}
|
|
10
12
|
|
|
13
|
+
/** @public */
|
|
11
14
|
export function toastLoadingBar() {
|
|
12
15
|
return _comp('toast-loading-bar')
|
|
13
16
|
}
|
|
14
17
|
|
|
18
|
+
/** @public */
|
|
15
19
|
export function toastLoadingBarProgress() {
|
|
16
20
|
return _comp('toast-loading-bar-progress')
|
|
17
21
|
}
|
|
18
22
|
|
|
23
|
+
/** @public */
|
|
19
24
|
export function toastLoadingBarMask() {
|
|
20
25
|
return _comp('toast-loading-bar-mask')
|
|
21
26
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/** @internal */
|
|
2
|
+
export function _getClassNames(...classNames: Array<string | false | undefined>): string[] {
|
|
2
3
|
return classNames
|
|
3
4
|
.map((n) => typeof n === 'string' && n.trim())
|
|
4
5
|
.filter(Boolean)
|
|
@@ -6,10 +7,11 @@ export function getClassNames(...classNames: Array<string | false | undefined>):
|
|
|
6
7
|
.split(' ')
|
|
7
8
|
}
|
|
8
9
|
|
|
10
|
+
/** @public */
|
|
9
11
|
export function composeClassNames(
|
|
10
12
|
...classNames: Array<string | false | undefined>
|
|
11
13
|
): string | undefined {
|
|
12
|
-
return unique(
|
|
14
|
+
return unique(_getClassNames(...classNames)).join(' ') || undefined
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
function unique<T>(array: T[]): T[] {
|
package/src/css/constants.ts
CHANGED
package/src/css/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from './aspects'
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
2
|
+
export * from './compilePalette'
|
|
3
|
+
export * from './compileSystem'
|
|
4
|
+
export * from './compileTheme'
|
|
5
5
|
export * from './components/breadcrumbs'
|
|
6
6
|
export * from './components/dialog'
|
|
7
7
|
export * from './components/menu'
|
|
@@ -5,14 +5,17 @@ export function _arrow(): string | undefined {
|
|
|
5
5
|
return _comp('arrow')
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
+
/** @internal */
|
|
8
9
|
export function _arrowStroke(): string | undefined {
|
|
9
10
|
return _comp('arrow-stroke')
|
|
10
11
|
}
|
|
11
12
|
|
|
13
|
+
/** @internal */
|
|
12
14
|
export function _arrowStrokeMask(): string | undefined {
|
|
13
15
|
return _comp('arrow-stroke-mask')
|
|
14
16
|
}
|
|
15
17
|
|
|
18
|
+
/** @internal */
|
|
16
19
|
export function _arrowShape(): string | undefined {
|
|
17
20
|
return _comp('arrow-shape')
|
|
18
21
|
}
|
|
@@ -16,10 +16,12 @@ export function _input(props: InputStyleProps): string | undefined {
|
|
|
16
16
|
)
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
/** @internal */
|
|
19
20
|
export function _inputElement(): string | undefined {
|
|
20
21
|
return _comp('input-element')
|
|
21
22
|
}
|
|
22
23
|
|
|
24
|
+
/** @internal */
|
|
23
25
|
export function _inputPresentation(): string | undefined {
|
|
24
26
|
return _comp('input-presentation')
|
|
25
27
|
}
|
|
@@ -3,7 +3,6 @@ import {THEME_COLOR_STATE_TONES} from '@sanity/ui/theme'
|
|
|
3
3
|
import {Properties, Style, StyleRules} from '../../types'
|
|
4
4
|
import {varNames} from '../../varNames'
|
|
5
5
|
import {vars} from '../../vars'
|
|
6
|
-
import {toneMap} from './_contants'
|
|
7
6
|
|
|
8
7
|
const primitive: StyleRules = {
|
|
9
8
|
'.selectable': {
|
|
@@ -89,7 +88,7 @@ function buildSelectableTones(): Record<string, Properties> {
|
|
|
89
88
|
const target = varNames.color
|
|
90
89
|
const source = vars.color
|
|
91
90
|
|
|
92
|
-
rules[`&.${
|
|
91
|
+
rules[`&.${tone}`] = {
|
|
93
92
|
[target.tinted.bg[0]]: source.tinted[tone].bg[0],
|
|
94
93
|
[target.tinted.bg[1]]: source.tinted[tone].bg[1],
|
|
95
94
|
[target.tinted.bg[2]]: source.tinted[tone].bg[2],
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import {_comp} from '../../_comp'
|
|
2
2
|
import {radius} from '../../aspects'
|
|
3
|
-
import {toneMap} from './_contants'
|
|
4
3
|
import {SelectableStyleProps} from './types'
|
|
5
4
|
|
|
6
5
|
/** @internal */
|
|
7
6
|
export function _selectable(props: SelectableStyleProps): string | undefined {
|
|
8
|
-
return _comp('selectable',
|
|
7
|
+
return _comp('selectable', props.tone ?? 'default', radius(props))
|
|
9
8
|
}
|
|
@@ -7,6 +7,8 @@ import {vars} from '../../vars'
|
|
|
7
7
|
|
|
8
8
|
const primitive: StyleRules = {
|
|
9
9
|
'.avatar': {
|
|
10
|
+
[varNames.color.fg]: vars.color.avatar.fg,
|
|
11
|
+
|
|
10
12
|
'backgroundColor': vars.color.avatar.bg,
|
|
11
13
|
'position': 'relative',
|
|
12
14
|
'boxSizing': 'border-box',
|
|
@@ -19,12 +21,7 @@ const primitive: StyleRules = {
|
|
|
19
21
|
'borderRadius': vars.avatar.size,
|
|
20
22
|
|
|
21
23
|
'@nest': {
|
|
22
|
-
'&
|
|
23
|
-
opacity: 0.5,
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
// &:is(button)
|
|
27
|
-
'&:is(button)': {
|
|
24
|
+
'button&': {
|
|
28
25
|
WebkitFontSmoothing: 'inherit',
|
|
29
26
|
appearance: 'none',
|
|
30
27
|
margin: 0,
|
|
@@ -35,12 +32,12 @@ const primitive: StyleRules = {
|
|
|
35
32
|
outline: 'none',
|
|
36
33
|
},
|
|
37
34
|
|
|
38
|
-
'&:
|
|
35
|
+
'button&:focus': {
|
|
39
36
|
outline: 'var(--avatar-focus-ring-width) solid var(--color-focus-ring)',
|
|
40
37
|
outlineOffset: 'var(--avatar-focus-ring-offset)',
|
|
41
38
|
},
|
|
42
39
|
|
|
43
|
-
'&:
|
|
40
|
+
'button&:focus:not(:focus-visible)': {
|
|
44
41
|
boxShadow: 'none',
|
|
45
42
|
},
|
|
46
43
|
|
|
@@ -2,26 +2,32 @@ import {_comp} from '../../_comp'
|
|
|
2
2
|
import {_resp} from '../../_resp'
|
|
3
3
|
import {AvatarStyleProps} from './types'
|
|
4
4
|
|
|
5
|
+
/** @public */
|
|
5
6
|
export function avatar(props: AvatarStyleProps): string | undefined {
|
|
6
7
|
return _comp('avatar', props.color || 'gray', _resp('avatar', props.size))
|
|
7
8
|
}
|
|
8
9
|
|
|
10
|
+
/** @public */
|
|
9
11
|
export function avatarArrow(): string | undefined {
|
|
10
12
|
return _comp('avatar-arrow')
|
|
11
13
|
}
|
|
12
14
|
|
|
15
|
+
/** @public */
|
|
13
16
|
export function avatarInitials(): string | undefined {
|
|
14
17
|
return _comp('avatar-initials')
|
|
15
18
|
}
|
|
16
19
|
|
|
20
|
+
/** @public */
|
|
17
21
|
export function avatarImage(): string | undefined {
|
|
18
22
|
return _comp('avatar-image')
|
|
19
23
|
}
|
|
20
24
|
|
|
25
|
+
/** @public */
|
|
21
26
|
export function avatarCounter(props: {size?: AvatarStyleProps['size']}): string | undefined {
|
|
22
27
|
return _comp('avatar-counter', _resp('avatar', props.size))
|
|
23
28
|
}
|
|
24
29
|
|
|
30
|
+
/** @public */
|
|
25
31
|
export function avatarStack(props: {size?: AvatarStyleProps['size']}): string | undefined {
|
|
26
32
|
return _comp('avatar-stack', _resp('avatar', props.size))
|
|
27
33
|
}
|