@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
|
@@ -1,27 +1,9 @@
|
|
|
1
|
-
import {ThemeColorButtonModeKey, ThemeColorStateToneKey} from '@sanity/ui/theme'
|
|
2
|
-
|
|
3
1
|
import {_comp} from '../../_comp'
|
|
4
|
-
import {
|
|
5
|
-
display,
|
|
6
|
-
DisplayStyleProps,
|
|
7
|
-
flexItem,
|
|
8
|
-
FlexItemStyleProps,
|
|
9
|
-
radius,
|
|
10
|
-
RadiusStyleProps,
|
|
11
|
-
width,
|
|
12
|
-
WidthStyleProps,
|
|
13
|
-
} from '../../aspects'
|
|
2
|
+
import {display, flexItem, radius, width} from '../../aspects'
|
|
14
3
|
import {toneMap, variantMap} from './_constants'
|
|
4
|
+
import {ButtonStyleProps} from './types'
|
|
15
5
|
|
|
16
|
-
|
|
17
|
-
extends DisplayStyleProps,
|
|
18
|
-
FlexItemStyleProps,
|
|
19
|
-
RadiusStyleProps,
|
|
20
|
-
WidthStyleProps {
|
|
21
|
-
mode?: ThemeColorButtonModeKey
|
|
22
|
-
tone?: ThemeColorStateToneKey
|
|
23
|
-
}
|
|
24
|
-
|
|
6
|
+
/** @public */
|
|
25
7
|
export function button(props: ButtonStyleProps): string | undefined {
|
|
26
8
|
const {mode, tone} = props
|
|
27
9
|
|
|
@@ -36,6 +18,7 @@ export function button(props: ButtonStyleProps): string | undefined {
|
|
|
36
18
|
)
|
|
37
19
|
}
|
|
38
20
|
|
|
21
|
+
/** @public */
|
|
39
22
|
export function buttonLoadingBox(): string | undefined {
|
|
40
23
|
return 'button-loading-box'
|
|
41
24
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {ThemeColorButtonModeKey, ThemeColorStateToneKey} from '@sanity/ui/theme'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
DisplayStyleProps,
|
|
5
|
+
FlexItemStyleProps,
|
|
6
|
+
RadiusStyleProps,
|
|
7
|
+
WidthStyleProps,
|
|
8
|
+
} from '../../aspects'
|
|
9
|
+
|
|
10
|
+
/** @public */
|
|
11
|
+
export interface ButtonStyleProps
|
|
12
|
+
extends DisplayStyleProps,
|
|
13
|
+
FlexItemStyleProps,
|
|
14
|
+
RadiusStyleProps,
|
|
15
|
+
WidthStyleProps {
|
|
16
|
+
mode?: ThemeColorButtonModeKey
|
|
17
|
+
tone?: ThemeColorStateToneKey
|
|
18
|
+
}
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
import {ColorCardVarNames, ColorCardVars, Properties, Style, StyleRules} from '../../types'
|
|
9
9
|
import {varNames} from '../../varNames'
|
|
10
10
|
import {vars} from '../../vars'
|
|
11
|
-
import {toneMap} from './_constants'
|
|
12
11
|
|
|
13
12
|
const primitive: StyleRules = {
|
|
14
13
|
'.card': {
|
|
@@ -165,11 +164,13 @@ for (const tone of THEME_COLOR_CARD_TONES) {
|
|
|
165
164
|
'--card-shadow-umbra-color': vars.color.shadow.umbra,
|
|
166
165
|
'--card-shadow-penumbra-color': vars.color.shadow.penumbra,
|
|
167
166
|
'--card-shadow-ambient-color': vars.color.shadow.ambient,
|
|
167
|
+
|
|
168
|
+
// todo
|
|
168
169
|
// '--card-skeleton-from-color': 'var(--color-skeleton-from)',
|
|
169
170
|
// '--card-skeleton-to-color': 'var(--color-skeleton-to)',
|
|
170
171
|
})
|
|
171
172
|
|
|
172
|
-
primitive[`.card.${
|
|
173
|
+
primitive[`.card.${tone}`] = toneProps
|
|
173
174
|
}
|
|
174
175
|
|
|
175
176
|
export const cardStyle: Style = {layers: {primitive}}
|
|
@@ -179,10 +180,6 @@ function _assignToneProps(
|
|
|
179
180
|
_varNames: ColorCardVarNames,
|
|
180
181
|
_vars: ColorCardVars,
|
|
181
182
|
) {
|
|
182
|
-
Object.assign(toneProps, {
|
|
183
|
-
[_varNames.accent.fg]: _vars.accent.fg,
|
|
184
|
-
})
|
|
185
|
-
|
|
186
183
|
for (const hue of THEME_COLOR_AVATAR_COLORS) {
|
|
187
184
|
toneProps[`${_varNames.avatar[hue].bg}`] = _vars.avatar[hue].bg
|
|
188
185
|
toneProps[`${_varNames.avatar[hue].fg}`] = _vars.avatar[hue].fg
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {_comp} from '../../_comp'
|
|
2
2
|
import {shadow} from '../../aspects'
|
|
3
|
-
import {toneMap} from './_constants'
|
|
4
3
|
import {CardStyleProps} from './types'
|
|
5
4
|
|
|
5
|
+
/** @public */
|
|
6
6
|
export function card(props: CardStyleProps): string | undefined {
|
|
7
7
|
return _comp(
|
|
8
8
|
props.scheme,
|
|
9
|
-
|
|
9
|
+
props.tone ?? 'default',
|
|
10
10
|
'card',
|
|
11
11
|
props.checkered && 'card-checkered',
|
|
12
12
|
shadow(props),
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {ThemeColorCardToneKey, ThemeColorSchemeKey} from '@sanity/ui/theme'
|
|
2
2
|
|
|
3
3
|
import {ShadowStyleProps} from '../../aspects'
|
|
4
|
-
import {BoxStyleProps} from '../box'
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
/** @public */
|
|
6
|
+
export interface CardStyleProps extends ShadowStyleProps {
|
|
7
7
|
checkered?: boolean
|
|
8
8
|
scheme?: ThemeColorSchemeKey
|
|
9
9
|
tone?: ThemeColorCardToneKey | 'inherit'
|
|
@@ -2,6 +2,7 @@ import {_comp} from '../../_comp'
|
|
|
2
2
|
import {maxWidth} from '../../aspects'
|
|
3
3
|
import {ContainerStyleProps} from './types'
|
|
4
4
|
|
|
5
|
+
/** @public */
|
|
5
6
|
export function container(props: ContainerStyleProps): string | undefined {
|
|
6
7
|
return _comp('container', maxWidth({maxWidth: props.width}))
|
|
7
8
|
}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
+
import {FontLabelSize} from '@sanity/ui/theme'
|
|
2
|
+
|
|
1
3
|
import {FontStyleProps} from '../../aspects'
|
|
2
4
|
import {ResponsiveProp} from '../../types'
|
|
3
5
|
|
|
4
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* @public
|
|
8
|
+
* @deprecated Use `FontLabelSize` from `@sanity/ui/theme` instead
|
|
9
|
+
*/
|
|
5
10
|
export type LabelSize = number
|
|
6
11
|
|
|
7
12
|
/** @public */
|
|
8
13
|
export interface LabelStyleProps extends FontStyleProps {
|
|
9
14
|
accent?: boolean
|
|
10
15
|
muted?: boolean
|
|
11
|
-
size?: ResponsiveProp<
|
|
16
|
+
size?: ResponsiveProp<FontLabelSize>
|
|
12
17
|
}
|
|
@@ -3,10 +3,12 @@ import {composeClassNames} from '../../composeClassNames'
|
|
|
3
3
|
import {_input, _inputPresentation} from '../_input'
|
|
4
4
|
import {SelectStyleProps} from './types'
|
|
5
5
|
|
|
6
|
+
/** @public */
|
|
6
7
|
export function select(props: SelectStyleProps): string | undefined {
|
|
7
8
|
return composeClassNames(_comp('select'), _input(props))
|
|
8
9
|
}
|
|
9
10
|
|
|
11
|
+
/** @public */
|
|
10
12
|
export function selectPresentation(): string | undefined {
|
|
11
13
|
return composeClassNames(_comp('select-presentation'), _inputPresentation())
|
|
12
14
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import {_comp} from '../../_comp'
|
|
2
2
|
|
|
3
|
+
/** @public */
|
|
3
4
|
export function spinner(): string | undefined {
|
|
4
5
|
return _comp('spinner')
|
|
5
6
|
}
|
|
6
7
|
|
|
8
|
+
/** @public */
|
|
7
9
|
export function animatedSpinnerIcon(): string | undefined {
|
|
8
10
|
return _comp('animated-spinner-icon')
|
|
9
11
|
}
|
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
import {_comp} from '../../_comp'
|
|
2
2
|
|
|
3
|
+
/** @public */
|
|
3
4
|
export function _switch(): string | undefined {
|
|
4
5
|
return _comp('switch')
|
|
5
6
|
}
|
|
6
7
|
|
|
8
|
+
/** @public */
|
|
7
9
|
export function _switchElement(): string | undefined {
|
|
8
10
|
return _comp('switch-element')
|
|
9
11
|
}
|
|
10
12
|
|
|
13
|
+
/** @public */
|
|
11
14
|
export function _switchPresentation(): string | undefined {
|
|
12
15
|
return _comp('switch-presentation')
|
|
13
16
|
}
|
|
14
17
|
|
|
18
|
+
/** @public */
|
|
15
19
|
export function _switchThumb(): string | undefined {
|
|
16
20
|
return _comp('switch-thumb')
|
|
17
21
|
}
|
|
18
22
|
|
|
23
|
+
/** @public */
|
|
19
24
|
export function _switchTrack(): string | undefined {
|
|
20
25
|
return _comp('switch-track')
|
|
21
26
|
}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import {FlexItemStyleProps, FontStyleProps} from '../../aspects'
|
|
2
2
|
import {ResponsiveProp} from '../../types'
|
|
3
3
|
|
|
4
|
+
/** @public */
|
|
4
5
|
export type TextSize = number
|
|
5
6
|
|
|
6
7
|
/** @public */
|
|
7
8
|
export interface TextStyleProps extends FlexItemStyleProps, FontStyleProps {
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated Will be removed in next major version
|
|
11
|
+
*/
|
|
8
12
|
accent?: boolean
|
|
9
13
|
muted?: boolean
|
|
10
14
|
size?: ResponsiveProp<TextSize>
|
|
@@ -3,6 +3,7 @@ import {composeClassNames} from '../../composeClassNames'
|
|
|
3
3
|
import {_input} from '../_input'
|
|
4
4
|
import {TextAreaStyleProps} from './types'
|
|
5
5
|
|
|
6
|
+
/** @public */
|
|
6
7
|
export function textArea(props: TextAreaStyleProps): string | undefined {
|
|
7
8
|
return composeClassNames(_comp('text-area'), _input(props))
|
|
8
9
|
}
|
|
@@ -3,6 +3,7 @@ import {composeClassNames} from '../../composeClassNames'
|
|
|
3
3
|
import {_input} from '../_input'
|
|
4
4
|
import {TextInputStyleProps} from './types'
|
|
5
5
|
|
|
6
|
+
/** @public */
|
|
6
7
|
export function textInput(props: TextInputStyleProps): string | undefined {
|
|
7
8
|
return composeClassNames(_input(props), _comp('text-input'))
|
|
8
9
|
}
|
package/src/css/types.ts
CHANGED
|
@@ -128,8 +128,8 @@ export type ThemeVarName =
|
|
|
128
128
|
| `--shadow-${Shadow}-penumbra`
|
|
129
129
|
| `--shadow-${Shadow}-ambient`
|
|
130
130
|
|
|
131
|
+
/** @public */
|
|
131
132
|
export type ColorCardVarName =
|
|
132
|
-
| `--color-${Scheme}-${CardTone}-accent-fg`
|
|
133
133
|
| `--color-${Scheme}-${CardTone}-avatar-${AvatarColor}-bg`
|
|
134
134
|
| `--color-${Scheme}-${CardTone}-avatar-${AvatarColor}-fg`
|
|
135
135
|
| `--color-${Scheme}-${CardTone}-backdrop`
|
|
@@ -183,8 +183,8 @@ export type ColorCardVarName =
|
|
|
183
183
|
| `--color-${Scheme}-${CardTone}-skeleton-from`
|
|
184
184
|
| `--color-${Scheme}-${CardTone}-skeleton-to`
|
|
185
185
|
|
|
186
|
+
/** @public */
|
|
186
187
|
export type ColorCardToneScopedVarName =
|
|
187
|
-
| `--color-${CardTone}-accent-fg`
|
|
188
188
|
| `--color-${CardTone}-avatar-${AvatarColor}-bg`
|
|
189
189
|
| `--color-${CardTone}-avatar-${AvatarColor}-fg`
|
|
190
190
|
| `--color-${CardTone}-backdrop`
|
|
@@ -240,7 +240,6 @@ export type ColorCardToneScopedVarName =
|
|
|
240
240
|
|
|
241
241
|
/** @public */
|
|
242
242
|
export type CardScopedVarName =
|
|
243
|
-
| `--color-accent-fg`
|
|
244
243
|
| `--color-avatar-bg`
|
|
245
244
|
| `--color-avatar-fg`
|
|
246
245
|
| `--color-avatar-${AvatarColor}-bg`
|
|
@@ -326,12 +325,14 @@ export type CardScopedVarName =
|
|
|
326
325
|
| `--padding-bottom`
|
|
327
326
|
| `--padding-left`
|
|
328
327
|
|
|
328
|
+
/** @public */
|
|
329
329
|
export type AvatarScopedVarName =
|
|
330
330
|
| `--avatar-bg-color`
|
|
331
331
|
| `--avatar-fg-color`
|
|
332
332
|
| `--avatar-distance`
|
|
333
333
|
| `--avatar-size`
|
|
334
334
|
|
|
335
|
+
/** @public */
|
|
335
336
|
export type LegacyCardScopedVarName =
|
|
336
337
|
// legacy
|
|
337
338
|
| `--card-accent-fg-color`
|
|
@@ -371,6 +372,7 @@ export type LegacyCardScopedVarName =
|
|
|
371
372
|
export type ElementColorVariantScopedVarName =
|
|
372
373
|
`--color-${ElementColorVariant}-${ElementColorVariantKey}`
|
|
373
374
|
|
|
375
|
+
/** @public */
|
|
374
376
|
export type ButtonScopedVarName = '--button-box-shadow'
|
|
375
377
|
|
|
376
378
|
/** @public */
|
|
@@ -497,15 +499,13 @@ export interface ColorElementVarNames {
|
|
|
497
499
|
}
|
|
498
500
|
}
|
|
499
501
|
|
|
502
|
+
/** @public */
|
|
500
503
|
export interface ColorVariantVarNames
|
|
501
504
|
extends ColorElementVarNames,
|
|
502
505
|
Record<ElementTone, ColorElementVarNames> {}
|
|
503
506
|
|
|
504
507
|
/** @public */
|
|
505
508
|
export interface ColorCardVarNames {
|
|
506
|
-
accent: {
|
|
507
|
-
fg: VarName
|
|
508
|
-
}
|
|
509
509
|
avatar: Record<AvatarColor, ColorAvatarColorVarNames>
|
|
510
510
|
backdrop: VarName
|
|
511
511
|
code: {
|
|
@@ -577,10 +577,8 @@ export interface ColorCardVarNames {
|
|
|
577
577
|
/** @public */
|
|
578
578
|
export type ColorSchemeVarNames = Record<CardTone, ColorCardVarNames>
|
|
579
579
|
|
|
580
|
+
/** @public */
|
|
580
581
|
export interface ScopedColorVarNames extends Omit<ColorCardVarNames, 'avatar'> {
|
|
581
|
-
accent: {
|
|
582
|
-
fg: VarName
|
|
583
|
-
}
|
|
584
582
|
avatar: Record<AvatarColor, ColorAvatarColorVarNames> & ColorAvatarColorVarNames
|
|
585
583
|
bg: VarName
|
|
586
584
|
border: VarName
|
|
@@ -603,6 +601,7 @@ export interface FontSizeVarNames {
|
|
|
603
601
|
iconSize: VarName
|
|
604
602
|
}
|
|
605
603
|
|
|
604
|
+
/** @public */
|
|
606
605
|
export interface FontVarNames<Size extends number> {
|
|
607
606
|
family: VarName
|
|
608
607
|
featureSettings: VarName
|
|
@@ -768,9 +767,6 @@ export interface ColorVariantVars extends Record<ElementTone, ColorElementVars>,
|
|
|
768
767
|
|
|
769
768
|
/** @public */
|
|
770
769
|
export interface ColorCardVars {
|
|
771
|
-
accent: {
|
|
772
|
-
fg: CSSVar
|
|
773
|
-
}
|
|
774
770
|
avatar: ColorAvatarVars
|
|
775
771
|
backdrop: CSSVar
|
|
776
772
|
code: {
|
|
@@ -863,6 +859,7 @@ export interface ColorAvatarColorVars {
|
|
|
863
859
|
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
864
860
|
export interface ColorSchemeVars extends Record<CardTone, ColorCardVars> {}
|
|
865
861
|
|
|
862
|
+
/** @public */
|
|
866
863
|
export interface ScopedColorVars extends Omit<ColorCardVars, 'avatar'> {
|
|
867
864
|
avatar: ColorAvatarVars & ColorAvatarColorVars
|
|
868
865
|
bg: CSSVar
|
package/src/css/util.ts
CHANGED
|
@@ -1,25 +1,30 @@
|
|
|
1
1
|
import {type ThemeBoxShadow} from '@sanity/ui/theme'
|
|
2
2
|
|
|
3
|
+
/** @internal */
|
|
3
4
|
export function isRecord(value: unknown): value is Record<string, unknown> {
|
|
4
5
|
return value !== null && typeof value === 'object' && !Array.isArray(value)
|
|
5
6
|
}
|
|
6
7
|
|
|
8
|
+
/** @internal */
|
|
7
9
|
export function isArray(value: unknown): value is unknown[] {
|
|
8
10
|
return Array.isArray(value)
|
|
9
11
|
}
|
|
10
12
|
|
|
13
|
+
/** @internal */
|
|
11
14
|
export function rem(value: number): string {
|
|
12
15
|
if (value === 0) return '0'
|
|
13
16
|
|
|
14
17
|
return `${value / 16}rem`
|
|
15
18
|
}
|
|
16
19
|
|
|
20
|
+
/** @internal */
|
|
17
21
|
export function px(value: number): string {
|
|
18
22
|
if (value === 0) return '0'
|
|
19
23
|
|
|
20
24
|
return `${value}px`
|
|
21
25
|
}
|
|
22
26
|
|
|
27
|
+
/** @internal */
|
|
23
28
|
export function toBoxShadow(value: ThemeBoxShadow | undefined): string {
|
|
24
29
|
if (!value) return 'none'
|
|
25
30
|
|