@sanity/ui 3.0.0-static.3 → 3.0.0-static.4
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 +31 -43
- package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
- package/dist/_chunks-cjs/buildCommand.js +1 -1
- package/dist/_chunks-cjs/buildCommand.js.map +1 -1
- package/dist/_chunks-es/_visual-editing.mjs +31 -43
- package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/css.d.mts +2 -42
- package/dist/css.d.ts +2 -42
- package/dist/css.js +30 -53
- package/dist/css.js.map +1 -1
- package/dist/css.mjs +30 -52
- package/dist/css.mjs.map +1 -1
- package/dist/index.js +12 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -14
- package/dist/index.mjs.map +1 -1
- package/dist/sanity-palette.css +1 -9
- package/dist/sanity-theme.css +1 -1
- package/dist/system.css +60 -60
- package/dist/theme.d.mts +1 -43
- package/dist/theme.d.ts +1 -43
- package/dist/theme.js +22 -71
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +22 -71
- package/dist/theme.mjs.map +1 -1
- package/package.json +1 -1
- package/src/cli/buildCommand.ts +2 -2
- package/src/css/_comp.ts +1 -0
- package/src/css/aspects/textOverflow/textOverflow.ts +2 -2
- package/src/css/compile/compilePalette.ts +8 -41
- package/src/css/compile/compileTheme_v3.ts +0 -18
- package/src/css/primitives/_selectable/_contants.ts +1 -1
- package/src/css/primitives/box/box.ts +3 -0
- package/src/css/primitives/button/_constants.ts +1 -1
- package/src/css/primitives/button/button.style.ts +6 -9
- package/src/css/primitives/card/_constants.ts +2 -2
- package/src/css/primitives/card/card.ts +1 -1
- package/src/theme/defaults/config.ts +2 -2
- package/src/theme/defaults/fonts.ts +4 -4
- package/src/theme/palette/constants.ts +1 -3
- package/src/theme/palette/types.ts +0 -12
- package/src/theme/v3/buildTheme_v3.ts +1 -2
- package/src/theme/v3/defaults.ts +12 -31
- package/src/theme/v3/types.ts +0 -3
- package/src/ui/StyleTags.tsx +1 -1
- package/src/ui/primitives/button/button.tsx +4 -4
- package/src/ui/primitives/card/card.tsx +5 -2
- package/src/ui/primitives/heading/heading.tsx +1 -1
- package/src/ui/primitives/select/select.tsx +3 -3
- package/src/ui/primitives/text/text.tsx +1 -1
package/package.json
CHANGED
package/src/cli/buildCommand.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {compilePalette, compileSystem, compileTheme} from '@sanity/ui/css'
|
|
2
|
-
import {buildTheme_v3,
|
|
2
|
+
import {buildTheme_v3, RootTheme} from '@sanity/ui/theme'
|
|
3
3
|
import fs from 'fs/promises'
|
|
4
4
|
import path from 'path'
|
|
5
5
|
|
|
6
6
|
async function buildPalette(outDir: string) {
|
|
7
|
-
const css = compilePalette(
|
|
7
|
+
const css = compilePalette()
|
|
8
8
|
|
|
9
9
|
await fs.mkdir(outDir, {recursive: true})
|
|
10
10
|
|
package/src/css/_comp.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {_comp} from '../../_comp'
|
|
2
2
|
import {TextOverflowStyleProps} from './types'
|
|
3
3
|
|
|
4
4
|
export function textOverflow(props: TextOverflowStyleProps): string | undefined {
|
|
5
|
-
return
|
|
5
|
+
return _comp(props.textOverflow && `text-overflow-${props.textOverflow}`)
|
|
6
6
|
}
|
|
@@ -1,58 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {color} from '@sanity/color'
|
|
2
|
+
import {HUES, TINTS} from '@sanity/ui/theme'
|
|
2
3
|
|
|
3
4
|
import {compileRule} from './compileRule'
|
|
4
5
|
|
|
5
|
-
export function compilePalette(
|
|
6
|
+
export function compilePalette(): string {
|
|
6
7
|
const props: Record<string, string> = {
|
|
7
|
-
|
|
8
|
-
'--l-max': `${config.luminosity.max * 100}%`,
|
|
9
|
-
'--l-range': `calc(var(--l-max) - var(--l-min))`,
|
|
8
|
+
...compileHues(),
|
|
10
9
|
|
|
11
|
-
'--
|
|
12
|
-
'--
|
|
13
|
-
'--c-range': `calc(var(--c-max) - var(--c-min))`,
|
|
14
|
-
|
|
15
|
-
...compileHues(config.hues),
|
|
16
|
-
|
|
17
|
-
'--black': `oklch(
|
|
18
|
-
calc(var(--l-min) + 0.0 * var(--l-range))
|
|
19
|
-
calc(var(--c-min) + 0.0 * var(--gray-c-range))
|
|
20
|
-
var(--gray-h)
|
|
21
|
-
)`,
|
|
22
|
-
|
|
23
|
-
'--white': `oklch(
|
|
24
|
-
calc(var(--l-min) + 1.0 * var(--l-range))
|
|
25
|
-
calc(var(--c-min) + 0.0 * var(--gray-c-range))
|
|
26
|
-
var(--gray-h)
|
|
27
|
-
)`,
|
|
10
|
+
'--black': color.black.hex,
|
|
11
|
+
'--white': color.white.hex,
|
|
28
12
|
}
|
|
29
13
|
|
|
30
14
|
return compileRule(':root', props, {keyframes: {}, media: {}})
|
|
31
15
|
}
|
|
32
16
|
|
|
33
|
-
function compileHues(
|
|
17
|
+
function compileHues() {
|
|
34
18
|
const rules: Record<string, string> = {}
|
|
35
19
|
|
|
36
20
|
for (const hue of HUES) {
|
|
37
|
-
const {c, h} = hues[hue]
|
|
38
|
-
|
|
39
|
-
rules[`--${hue}-h`] = `${h}`
|
|
40
|
-
rules[`--${hue}-c`] = `${c}`
|
|
41
|
-
rules[`--${hue}-c-max`] = `min(var(--c-max), var(--${hue}-c))`
|
|
42
|
-
rules[`--${hue}-c-range`] = `calc(var(--${hue}-c-max) - var(--c-min))`
|
|
43
|
-
|
|
44
21
|
for (const tint of TINTS) {
|
|
45
|
-
|
|
46
|
-
const c_offset_tmp = tint / 500
|
|
47
|
-
const c_offset = parseFloat((c_offset_tmp < 1 ? c_offset_tmp : 2 - c_offset_tmp).toFixed(1))
|
|
48
|
-
|
|
49
|
-
rules[`--${hue}-${tint}`] = [
|
|
50
|
-
`oklch(`,
|
|
51
|
-
`calc(var(--l-min) + ${l_offset} * var(--l-range)) `,
|
|
52
|
-
`calc(var(--c-min) + ${c_offset} * var(--${hue}-c-range)) `,
|
|
53
|
-
`var(--${hue}-h)`,
|
|
54
|
-
`)`,
|
|
55
|
-
].join('')
|
|
22
|
+
rules[`--${hue}-${tint}`] = color[hue][tint].hex
|
|
56
23
|
}
|
|
57
24
|
}
|
|
58
25
|
|
|
@@ -22,8 +22,6 @@ export function compileTheme_v3(theme: Theme_v3): string {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
function compileThemeProperties(theme: Theme_v3): Properties {
|
|
25
|
-
// const palette = defaultPalette
|
|
26
|
-
|
|
27
25
|
return {
|
|
28
26
|
...buildAvatarThemeProperties(theme),
|
|
29
27
|
...buildButtonThemeProperties(theme),
|
|
@@ -36,26 +34,10 @@ function compileThemeProperties(theme: Theme_v3): Properties {
|
|
|
36
34
|
...buildRadiusThemeProperties(theme),
|
|
37
35
|
...buildShadowThemeProperties(theme),
|
|
38
36
|
...buildSpaceThemeProperties(theme),
|
|
39
|
-
// ...buildColorPaletteProperties(palette),
|
|
40
37
|
...buildColorThemeProperties(theme),
|
|
41
38
|
}
|
|
42
39
|
}
|
|
43
40
|
|
|
44
|
-
// function buildColorPaletteProperties(palette: Color): Properties {
|
|
45
|
-
// const props: Properties = {
|
|
46
|
-
// '--black': palette.black.hex,
|
|
47
|
-
// '--white': palette.white.hex,
|
|
48
|
-
// }
|
|
49
|
-
|
|
50
|
-
// for (const hue of COLOR_HUES) {
|
|
51
|
-
// for (const tint of COLOR_TINTS) {
|
|
52
|
-
// props[`--${hue}-${tint}`] = palette[hue][tint].hex
|
|
53
|
-
// }
|
|
54
|
-
// }
|
|
55
|
-
|
|
56
|
-
// return props
|
|
57
|
-
// }
|
|
58
|
-
|
|
59
41
|
function buildAvatarThemeProperties(theme: Theme_v3): Properties {
|
|
60
42
|
return {
|
|
61
43
|
[`--avatar-focus-ring-offset`]: px(theme.avatar.focusRing.offset),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {ThemeColorButtonModeKey, ThemeColorStateToneKey} from '@sanity/ui/theme'
|
|
2
2
|
|
|
3
3
|
export const toneMap: Record<ThemeColorStateToneKey, string | undefined> = {
|
|
4
|
-
default: '
|
|
4
|
+
default: 'default',
|
|
5
5
|
neutral: 'neutral',
|
|
6
6
|
suggest: 'suggest',
|
|
7
7
|
primary: 'accent',
|
|
@@ -100,38 +100,35 @@ for (const tone of THEME_COLOR_STATE_TONES) {
|
|
|
100
100
|
|
|
101
101
|
// mode: ghost
|
|
102
102
|
primitive[`.button.${variantMap.ghost}.${toneMap[tone]}`] = {
|
|
103
|
-
[varNames.color.bg]: tinted.bg[
|
|
103
|
+
[varNames.color.bg]: tinted.bg[1],
|
|
104
104
|
[varNames.color.border]: tinted.border[1],
|
|
105
105
|
[varNames.color.fg]: tinted.fg[2],
|
|
106
|
-
'--button-box-shadow':
|
|
107
|
-
`inset 0 0 0 var(--button-border-width) var(--color-border)`,
|
|
108
|
-
`inset 0 -1.5px 0 0.5px var(--color-shadow-umbra)`,
|
|
109
|
-
].join(','),
|
|
106
|
+
'--button-box-shadow': `inset 0 0 0 var(--button-border-width) var(--color-border)`,
|
|
110
107
|
|
|
111
108
|
'@nest': {
|
|
112
109
|
'&:not([data-disabled]):hover': {
|
|
113
|
-
[varNames.color.bg]: tinted.bg[
|
|
110
|
+
[varNames.color.bg]: tinted.bg[2],
|
|
114
111
|
[varNames.color.border]: tinted.border[2],
|
|
115
112
|
[varNames.color.fg]: tinted.fg[1],
|
|
116
113
|
// '--button-box-shadow': `inset 0 0 0 var(--button-border-width) var(--color-border)`,
|
|
117
114
|
},
|
|
118
115
|
|
|
119
116
|
'&:not([data-disabled]):active': {
|
|
120
|
-
[varNames.color.bg]: tinted.bg[
|
|
117
|
+
[varNames.color.bg]: tinted.bg[3],
|
|
121
118
|
[varNames.color.border]: tinted.border[3],
|
|
122
119
|
[varNames.color.fg]: tinted.fg[1],
|
|
123
120
|
'--button-box-shadow': `inset 0 0 0 var(--button-border-width) var(--color-border)`,
|
|
124
121
|
},
|
|
125
122
|
|
|
126
123
|
'&:not([data-disabled])[data-selected]': {
|
|
127
|
-
[varNames.color.bg]: tinted.bg[
|
|
124
|
+
[varNames.color.bg]: tinted.bg[3],
|
|
128
125
|
[varNames.color.border]: tinted.border[3],
|
|
129
126
|
[varNames.color.fg]: tinted.fg[1],
|
|
130
127
|
'--button-box-shadow': `inset 0 0 0 var(--button-border-width) var(--color-border)`,
|
|
131
128
|
},
|
|
132
129
|
|
|
133
130
|
'&[data-disabled]': {
|
|
134
|
-
[varNames.color.bg]: vars.color.default.tinted.bg[
|
|
131
|
+
[varNames.color.bg]: vars.color.default.tinted.bg[1],
|
|
135
132
|
[varNames.color.border]: vars.color.default.tinted.border[0],
|
|
136
133
|
[varNames.color.fg]: vars.color.default.tinted.fg[2],
|
|
137
134
|
},
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {ThemeColorCardToneKey} from '@sanity/ui/theme'
|
|
2
2
|
|
|
3
3
|
export const toneMap: Record<ThemeColorCardToneKey | 'inherit', string | undefined> = {
|
|
4
|
-
transparent: '
|
|
5
|
-
default: '
|
|
4
|
+
transparent: 'transparent',
|
|
5
|
+
default: 'default',
|
|
6
6
|
neutral: 'neutral',
|
|
7
7
|
suggest: 'suggest',
|
|
8
8
|
primary: 'accent',
|
|
@@ -6,7 +6,7 @@ import {CardStyleProps} from './types'
|
|
|
6
6
|
export function card(props: CardStyleProps): string | undefined {
|
|
7
7
|
return _comp(
|
|
8
8
|
props.scheme,
|
|
9
|
-
toneMap[props.tone ?? '
|
|
9
|
+
toneMap[props.tone ?? 'default'],
|
|
10
10
|
'card',
|
|
11
11
|
props.checkered && 'card-checkered',
|
|
12
12
|
shadow(props),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {RootTheme_v2} from '../v2'
|
|
2
2
|
|
|
3
|
-
const BORDER_WIDTH =
|
|
3
|
+
const BORDER_WIDTH = 1
|
|
4
4
|
const OUTLINE_WIDTH = 0.5
|
|
5
5
|
|
|
6
6
|
export const defaultThemeConfig: Omit<RootTheme_v2, 'color' | 'font'> = {
|
|
@@ -31,7 +31,7 @@ export const defaultThemeConfig: Omit<RootTheme_v2, 'color' | 'font'> = {
|
|
|
31
31
|
popover: {zOffset: 400},
|
|
32
32
|
tooltip: {zOffset: 200},
|
|
33
33
|
},
|
|
34
|
-
radius: [0, 1,
|
|
34
|
+
radius: [0, 1, 3, 7, 11, 15, 23, 43, 75, 127],
|
|
35
35
|
shadow: [
|
|
36
36
|
null,
|
|
37
37
|
{umbra: [0, 0, 0, 0], penumbra: [0, 0, 0, 0], ambient: [0, 0, 0, 0]},
|
|
@@ -57,10 +57,10 @@ export const defaultThemeFonts: ThemeFonts = {
|
|
|
57
57
|
'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", Helvetica, Arial, system-ui, sans-serif',
|
|
58
58
|
featureSettings: `'liga' 1, 'calt' 1, 'ss01' 1, 'ss03' 1, 'zero' 1`,
|
|
59
59
|
weights: {
|
|
60
|
-
regular:
|
|
61
|
-
medium:
|
|
62
|
-
semibold:
|
|
63
|
-
bold:
|
|
60
|
+
regular: 600,
|
|
61
|
+
medium: 700,
|
|
62
|
+
semibold: 800,
|
|
63
|
+
bold: 900,
|
|
64
64
|
},
|
|
65
65
|
sizes: [
|
|
66
66
|
{
|
|
@@ -10,6 +10,4 @@ export const HUES = [
|
|
|
10
10
|
'cyan',
|
|
11
11
|
] as const
|
|
12
12
|
|
|
13
|
-
export const TINTS = [
|
|
14
|
-
50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950,
|
|
15
|
-
] as const
|
|
13
|
+
export const TINTS = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950] as const
|
|
@@ -2,15 +2,3 @@ import {type HUES, type TINTS} from './constants'
|
|
|
2
2
|
|
|
3
3
|
export type Hue = (typeof HUES)[number]
|
|
4
4
|
export type Tint = (typeof TINTS)[number]
|
|
5
|
-
|
|
6
|
-
export type PaletteConfig = {
|
|
7
|
-
chroma: {
|
|
8
|
-
min: number
|
|
9
|
-
max: number
|
|
10
|
-
}
|
|
11
|
-
luminosity: {
|
|
12
|
-
min: number
|
|
13
|
-
max: number
|
|
14
|
-
}
|
|
15
|
-
hues: Record<Hue, {h: number; c: number}>
|
|
16
|
-
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {defaultThemeConfig} from '../defaults/config'
|
|
2
2
|
import {defaultThemeFonts} from '../defaults/fonts'
|
|
3
3
|
import {buildColor_v3} from './color/buildColor_v3'
|
|
4
|
-
import {
|
|
4
|
+
import {defaultTokens} from './defaults'
|
|
5
5
|
import {resolveTokens} from './resolveTokens'
|
|
6
6
|
import {Theme_v3, ThemeOptions} from './types'
|
|
7
7
|
|
|
@@ -12,7 +12,6 @@ export function buildTheme_v3(options?: ThemeOptions): Theme_v3 {
|
|
|
12
12
|
|
|
13
13
|
return {
|
|
14
14
|
_version: 3,
|
|
15
|
-
_palette: options?.palette ?? defaultPalette,
|
|
16
15
|
_tokens: tokens,
|
|
17
16
|
avatar: v2?.avatar ?? defaultThemeConfig.avatar,
|
|
18
17
|
button: v2?.button ?? defaultThemeConfig.button,
|
package/src/theme/v3/defaults.ts
CHANGED
|
@@ -1,22 +1,5 @@
|
|
|
1
|
-
import {PaletteConfig} from '../palette'
|
|
2
1
|
import {PartialTokens, Tokens} from './tokens'
|
|
3
2
|
|
|
4
|
-
export const defaultPalette: PaletteConfig = {
|
|
5
|
-
chroma: {min: 0.005, max: 0.2325},
|
|
6
|
-
luminosity: {min: 0.1875, max: 1},
|
|
7
|
-
hues: {
|
|
8
|
-
gray: {h: 277, c: 0.04},
|
|
9
|
-
blue: {h: 273, c: 0.185},
|
|
10
|
-
purple: {h: 295, c: 0.4},
|
|
11
|
-
magenta: {h: 12, c: 0.4},
|
|
12
|
-
red: {h: 30, c: 0.4},
|
|
13
|
-
orange: {h: 68, c: 0.4},
|
|
14
|
-
yellow: {h: 90, c: 0.4},
|
|
15
|
-
green: {h: 171, c: 0.4},
|
|
16
|
-
cyan: {h: 194, c: 0.4},
|
|
17
|
-
},
|
|
18
|
-
}
|
|
19
|
-
|
|
20
3
|
export const defaultTokens: PartialTokens<Tokens> = {
|
|
21
4
|
color: {
|
|
22
5
|
'*': {
|
|
@@ -73,12 +56,12 @@ export const defaultTokens: PartialTokens<Tokens> = {
|
|
|
73
56
|
tinted: {
|
|
74
57
|
'*': {
|
|
75
58
|
bg: {
|
|
76
|
-
0: ['
|
|
77
|
-
4: ['800', '
|
|
59
|
+
0: ['950', '50'],
|
|
60
|
+
4: ['800', '100'],
|
|
78
61
|
},
|
|
79
62
|
border: {
|
|
80
|
-
0: ['800', '
|
|
81
|
-
4: ['600', '
|
|
63
|
+
0: ['800', '100'],
|
|
64
|
+
4: ['600', '300'],
|
|
82
65
|
},
|
|
83
66
|
fg: {
|
|
84
67
|
0: ['100', '900'],
|
|
@@ -150,15 +133,15 @@ export const defaultTokens: PartialTokens<Tokens> = {
|
|
|
150
133
|
'*': {
|
|
151
134
|
bg: {
|
|
152
135
|
0: ['black', 'gray/50'],
|
|
153
|
-
4: ['
|
|
136
|
+
4: ['800', '300 50%'],
|
|
154
137
|
},
|
|
155
138
|
border: {
|
|
156
|
-
0: ['900', '
|
|
157
|
-
4: ['700', '
|
|
139
|
+
0: ['900', '100'],
|
|
140
|
+
4: ['700', '300'],
|
|
158
141
|
},
|
|
159
142
|
fg: {
|
|
160
|
-
0: ['
|
|
161
|
-
4: ['
|
|
143
|
+
0: ['100', 'black'],
|
|
144
|
+
4: ['500', '600'],
|
|
162
145
|
},
|
|
163
146
|
},
|
|
164
147
|
},
|
|
@@ -170,11 +153,11 @@ export const defaultTokens: PartialTokens<Tokens> = {
|
|
|
170
153
|
'*': {
|
|
171
154
|
bg: {
|
|
172
155
|
0: ['gray/950', 'white'],
|
|
173
|
-
4: ['
|
|
156
|
+
4: ['800', '200'],
|
|
174
157
|
},
|
|
175
158
|
border: {
|
|
176
|
-
0: ['
|
|
177
|
-
4: ['
|
|
159
|
+
0: ['800', '100'],
|
|
160
|
+
4: ['600', '300'],
|
|
178
161
|
},
|
|
179
162
|
fg: {
|
|
180
163
|
0: ['white', 'black'],
|
|
@@ -201,5 +184,3 @@ export const defaultTokens: PartialTokens<Tokens> = {
|
|
|
201
184
|
},
|
|
202
185
|
},
|
|
203
186
|
}
|
|
204
|
-
|
|
205
|
-
// export const defaultTheme = buildTheme_v3()
|
package/src/theme/v3/types.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {ThemeConfig} from '../config'
|
|
2
|
-
import {PaletteConfig} from '../palette'
|
|
3
2
|
import {ThemeFocusRing, ThemeFonts, ThemeFontWeightKey, ThemeLayer, ThemeShadow} from '../v0'
|
|
4
3
|
import {ThemeAvatar_v2, ThemeInput_v2} from '../v2'
|
|
5
4
|
import {ThemeColor_v3} from './color'
|
|
@@ -11,7 +10,6 @@ export type ThemeEntry = [`--${string}`, string]
|
|
|
11
10
|
/** @public */
|
|
12
11
|
export interface ThemeOptions {
|
|
13
12
|
v2?: ThemeConfig
|
|
14
|
-
palette?: PaletteConfig
|
|
15
13
|
tokens?: PartialTokens<Tokens>
|
|
16
14
|
}
|
|
17
15
|
|
|
@@ -22,7 +20,6 @@ export interface ThemeOptions {
|
|
|
22
20
|
*/
|
|
23
21
|
export interface Theme_v3 {
|
|
24
22
|
_version: 3
|
|
25
|
-
_palette: PaletteConfig
|
|
26
23
|
_tokens: Tokens
|
|
27
24
|
avatar: ThemeAvatar_v2
|
|
28
25
|
button: {
|
package/src/ui/StyleTags.tsx
CHANGED
|
@@ -11,7 +11,7 @@ export function StyleTags(props: {theme?: Theme_v3}): ReactNode {
|
|
|
11
11
|
return (
|
|
12
12
|
<>
|
|
13
13
|
<style href="sanity-palette" precedence="palette">
|
|
14
|
-
{compilePalette(
|
|
14
|
+
{compilePalette()}
|
|
15
15
|
</style>
|
|
16
16
|
<style href="sanity-theme" precedence="theme">
|
|
17
17
|
{compileTheme({v3: theme} as RootTheme)}
|
|
@@ -14,7 +14,6 @@ import {FontTextSize, Space} from '@sanity/ui/theme'
|
|
|
14
14
|
import {ElementType, ForwardedRef, forwardRef, isValidElement, ReactNode} from 'react'
|
|
15
15
|
import {isValidElementType} from 'react-is'
|
|
16
16
|
|
|
17
|
-
// import {useTheme_v2} from '../../_compat'
|
|
18
17
|
import {ButtonMode, ButtonTextAlign, ButtonTone, Props} from '../../types'
|
|
19
18
|
import {Box} from '../box'
|
|
20
19
|
import {Spinner} from '../spinner'
|
|
@@ -84,7 +83,7 @@ export const Button = forwardRef(function Button(
|
|
|
84
83
|
paddingBottom,
|
|
85
84
|
paddingLeft,
|
|
86
85
|
paddingRight,
|
|
87
|
-
radius =
|
|
86
|
+
radius = 2,
|
|
88
87
|
selected,
|
|
89
88
|
space = props.gap ?? props.space ?? props.padding ?? 3, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
90
89
|
text,
|
|
@@ -114,7 +113,6 @@ export const Button = forwardRef(function Button(
|
|
|
114
113
|
>
|
|
115
114
|
{Boolean(loading) && (
|
|
116
115
|
<Box
|
|
117
|
-
align={align}
|
|
118
116
|
as="span"
|
|
119
117
|
className={buttonLoadingBox()}
|
|
120
118
|
display="flex"
|
|
@@ -129,6 +127,7 @@ export const Button = forwardRef(function Button(
|
|
|
129
127
|
{(IconComponent || text || IconRightComponent) && (
|
|
130
128
|
<Box
|
|
131
129
|
as="span"
|
|
130
|
+
align={align}
|
|
132
131
|
direction={direction}
|
|
133
132
|
display="flex"
|
|
134
133
|
flex={1}
|
|
@@ -161,7 +160,6 @@ export const Button = forwardRef(function Button(
|
|
|
161
160
|
muted={muted}
|
|
162
161
|
size={fontSize}
|
|
163
162
|
textOverflow={textOverflow}
|
|
164
|
-
// weight={textWeight ?? buttonTheme.textWeight}
|
|
165
163
|
weight={textWeight}
|
|
166
164
|
>
|
|
167
165
|
{text}
|
|
@@ -179,6 +177,7 @@ export const Button = forwardRef(function Button(
|
|
|
179
177
|
|
|
180
178
|
{children && (
|
|
181
179
|
<Box
|
|
180
|
+
align={align}
|
|
182
181
|
as="span"
|
|
183
182
|
direction={direction}
|
|
184
183
|
display="flex"
|
|
@@ -186,6 +185,7 @@ export const Button = forwardRef(function Button(
|
|
|
186
185
|
gap={gap}
|
|
187
186
|
gapX={gapX}
|
|
188
187
|
gapY={gapY}
|
|
188
|
+
justify={justify}
|
|
189
189
|
padding={padding}
|
|
190
190
|
paddingX={paddingX}
|
|
191
191
|
paddingY={paddingY}
|
|
@@ -50,7 +50,7 @@ export const Card = forwardRef(function Card(
|
|
|
50
50
|
selected,
|
|
51
51
|
shadow,
|
|
52
52
|
style,
|
|
53
|
-
tone: toneProp = '
|
|
53
|
+
tone: toneProp = 'default',
|
|
54
54
|
...restProps
|
|
55
55
|
} = props
|
|
56
56
|
|
|
@@ -76,14 +76,17 @@ export const Card = forwardRef(function Card(
|
|
|
76
76
|
card({
|
|
77
77
|
scheme: scheme === context.scheme ? undefined : scheme,
|
|
78
78
|
shadow,
|
|
79
|
-
tone
|
|
79
|
+
tone,
|
|
80
80
|
}),
|
|
81
81
|
selectable && _selectable({radius}),
|
|
82
82
|
)}
|
|
83
|
+
data-context-tone={context.tone}
|
|
84
|
+
data-context-scheme={context.scheme}
|
|
83
85
|
data-checkered={checkered ? '' : undefined}
|
|
84
86
|
data-focus-ring={focusRing ? '' : undefined}
|
|
85
87
|
data-pressed={pressed ? '' : undefined}
|
|
86
88
|
data-selected={selected ? '' : undefined}
|
|
89
|
+
data-tone={tone}
|
|
87
90
|
radius={radius}
|
|
88
91
|
ref={ref}
|
|
89
92
|
style={style}
|