@sanity/ui 3.0.0-static.10 → 3.0.0-static.11
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 +160 -207
- package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
- package/dist/_chunks-es/_visual-editing.mjs +161 -208
- package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
- package/dist/_visual-editing.d.mts +1 -3
- package/dist/_visual-editing.d.ts +1 -3
- package/dist/cli.js +1 -1
- package/dist/css.d.mts +115 -2
- package/dist/css.d.ts +115 -2
- package/dist/css.js +539 -402
- package/dist/css.js.map +1 -1
- package/dist/css.mjs +541 -404
- package/dist/css.mjs.map +1 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +50 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45 -12
- package/dist/index.mjs.map +1 -1
- package/dist/sanity-theme.css +1 -1
- package/dist/system.css +418 -182
- package/dist/theme.js +10 -11
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +10 -11
- package/dist/theme.mjs.map +1 -1
- package/package.json +1 -1
- package/src/css/_resp.ts +0 -1
- package/src/css/aspects/font/font.style.ts +7 -66
- package/src/css/aspects/shadow/shadow.style.ts +16 -41
- package/src/css/compile/compilePalette.ts +4 -3
- package/src/css/compile/compileSystem.ts +0 -3
- package/src/css/compile/compileTheme_v3.ts +233 -219
- package/src/css/components/skeleton/skeleton.style.ts +8 -4
- package/src/css/constants.ts +9 -0
- package/src/css/index.ts +1 -0
- package/src/css/primitives/_arrow/_arrow.style.ts +6 -8
- package/src/css/primitives/_arrow/_arrow.ts +4 -0
- package/src/css/primitives/_selectable/_selectable.style.ts +23 -23
- package/src/css/primitives/button/button.style.ts +48 -15
- package/src/css/primitives/card/card.style.ts +1 -1
- package/src/css/primitives/token/token.style.ts +37 -36
- package/src/css/responsiveRules.ts +12 -19
- package/src/css/types.ts +106 -3
- package/src/css/varNames.ts +101 -4
- package/src/css/vars.ts +52 -16
- package/src/theme/v3/buildTheme_v3.ts +1 -1
- package/src/theme/v3/{defaults.ts → defaultTokens.ts} +1 -2
- package/src/theme/v3/index.ts +1 -1
- package/src/theme/v3/resolveTokens.ts +9 -9
- package/src/ui/RootClassNames.tsx +41 -0
- package/src/ui/_compat/helpers.ts +72 -0
- package/src/ui/_compat/index.ts +2 -6
- package/src/ui/_compat/studioTheme.ts +7 -0
- package/src/ui/_compat/types.ts +0 -83
- package/src/ui/index.ts +1 -0
- package/src/ui/primitives/button/button.tsx +5 -6
- package/src/ui/primitives/popover/popover.tsx +25 -7
- package/src/ui/primitives/popover/popoverCard.tsx +46 -45
- package/src/ui/primitives/tooltip/tooltip.tsx +9 -2
- package/src/ui/primitives/tooltip/tooltipCard.tsx +1 -1
- package/src/ui/utils/arrow/arrow.tsx +3 -11
- package/src/ui/utils/elementQuery/elementQuery.tsx +10 -8
- package/src/ui/utils/virtualList/virtualList.tsx +37 -32
- package/src/css/components/breadcrumbs/rules.ts +0 -25
- package/src/css/components/dialog/rules.ts +0 -78
- package/src/css/components/skeleton/rules.ts +0 -113
- package/src/css/components/toast/rules.ts +0 -18
- package/src/css/components/tree/rules.ts +0 -168
- package/src/css/primitives/popover/rules.ts +0 -5
- package/src/css/primitives/spinner/rules.ts +0 -21
- package/src/css/primitives/token/rules.ts +0 -45
package/src/css/varNames.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {COLOR_HUES, COLOR_TINTS, ColorHueKey, ColorTintKey} from '@sanity/color'
|
|
1
2
|
import {
|
|
2
3
|
AVATAR_SIZE,
|
|
3
4
|
AvatarSize,
|
|
@@ -11,6 +12,8 @@ import {
|
|
|
11
12
|
type FontTextSize,
|
|
12
13
|
RADIUS,
|
|
13
14
|
Radius,
|
|
15
|
+
SHADOW,
|
|
16
|
+
Shadow,
|
|
14
17
|
SPACE,
|
|
15
18
|
type Space,
|
|
16
19
|
THEME_COLOR_STATE_TONES,
|
|
@@ -47,6 +50,20 @@ export const varNames: VarNames = {
|
|
|
47
50
|
{} as Record<AvatarSize, {distance: VarName; size: VarName}>,
|
|
48
51
|
),
|
|
49
52
|
},
|
|
53
|
+
button: {
|
|
54
|
+
border: {
|
|
55
|
+
width: `--button-border-width`,
|
|
56
|
+
},
|
|
57
|
+
focusRing: {
|
|
58
|
+
offset: `--button-focus-ring-offset`,
|
|
59
|
+
width: `--button-focus-ring-width`,
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
card: {
|
|
63
|
+
shadow: {
|
|
64
|
+
outline: `--card-shadow-outline`,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
50
67
|
color: {
|
|
51
68
|
// card scope
|
|
52
69
|
accent: {
|
|
@@ -211,6 +228,7 @@ export const varNames: VarNames = {
|
|
|
211
228
|
font: {
|
|
212
229
|
code: {
|
|
213
230
|
family: `--font-code-family`,
|
|
231
|
+
featureSettings: `--font-code-feature-settings`,
|
|
214
232
|
sizes: FONT_CODE_SIZE.reduce(
|
|
215
233
|
(acc, size) => {
|
|
216
234
|
return {
|
|
@@ -227,7 +245,7 @@ export const varNames: VarNames = {
|
|
|
227
245
|
},
|
|
228
246
|
{} as Record<FontCodeSize, FontSizeVarNames>,
|
|
229
247
|
),
|
|
230
|
-
|
|
248
|
+
weights: {
|
|
231
249
|
regular: `--font-code-weight-regular`,
|
|
232
250
|
medium: `--font-code-weight-medium`,
|
|
233
251
|
semibold: `--font-code-weight-semibold`,
|
|
@@ -236,6 +254,7 @@ export const varNames: VarNames = {
|
|
|
236
254
|
},
|
|
237
255
|
heading: {
|
|
238
256
|
family: `--font-heading-family`,
|
|
257
|
+
featureSettings: `--font-heading-feature-settings`,
|
|
239
258
|
sizes: FONT_HEADING_SIZE.reduce(
|
|
240
259
|
(acc, size) => {
|
|
241
260
|
return {
|
|
@@ -252,7 +271,7 @@ export const varNames: VarNames = {
|
|
|
252
271
|
},
|
|
253
272
|
{} as Record<FontHeadingSize, FontSizeVarNames>,
|
|
254
273
|
),
|
|
255
|
-
|
|
274
|
+
weights: {
|
|
256
275
|
regular: `--font-heading-weight-regular`,
|
|
257
276
|
medium: `--font-heading-weight-medium`,
|
|
258
277
|
semibold: `--font-heading-weight-semibold`,
|
|
@@ -261,6 +280,7 @@ export const varNames: VarNames = {
|
|
|
261
280
|
},
|
|
262
281
|
label: {
|
|
263
282
|
family: `--font-label-family`,
|
|
283
|
+
featureSettings: `--font-label-feature-settings`,
|
|
264
284
|
sizes: FONT_LABEL_SIZE.reduce(
|
|
265
285
|
(acc, size) => {
|
|
266
286
|
return {
|
|
@@ -277,7 +297,7 @@ export const varNames: VarNames = {
|
|
|
277
297
|
},
|
|
278
298
|
{} as Record<FontLabelSize, FontSizeVarNames>,
|
|
279
299
|
),
|
|
280
|
-
|
|
300
|
+
weights: {
|
|
281
301
|
regular: `--font-label-weight-regular`,
|
|
282
302
|
medium: `--font-label-weight-medium`,
|
|
283
303
|
semibold: `--font-label-weight-semibold`,
|
|
@@ -286,6 +306,7 @@ export const varNames: VarNames = {
|
|
|
286
306
|
},
|
|
287
307
|
text: {
|
|
288
308
|
family: `--font-text-family`,
|
|
309
|
+
featureSettings: `--font-text-feature-settings`,
|
|
289
310
|
sizes: FONT_TEXT_SIZE.reduce(
|
|
290
311
|
(acc, size) => {
|
|
291
312
|
return {
|
|
@@ -302,7 +323,7 @@ export const varNames: VarNames = {
|
|
|
302
323
|
},
|
|
303
324
|
{} as Record<FontTextSize, FontSizeVarNames>,
|
|
304
325
|
),
|
|
305
|
-
|
|
326
|
+
weights: {
|
|
306
327
|
regular: `--font-text-weight-regular`,
|
|
307
328
|
medium: `--font-text-weight-medium`,
|
|
308
329
|
semibold: `--font-text-weight-semibold`,
|
|
@@ -311,7 +332,55 @@ export const varNames: VarNames = {
|
|
|
311
332
|
},
|
|
312
333
|
},
|
|
313
334
|
input: {
|
|
335
|
+
border: {
|
|
336
|
+
width: `--input-border-width`,
|
|
337
|
+
},
|
|
338
|
+
|
|
339
|
+
checkbox: {
|
|
340
|
+
focusRing: {
|
|
341
|
+
offset: `--input-checkbox-focus-ring-offset`,
|
|
342
|
+
width: `--input-checkbox-focus-ring-width`,
|
|
343
|
+
},
|
|
344
|
+
size: `--input-checkbox-size`,
|
|
345
|
+
},
|
|
346
|
+
|
|
347
|
+
radio: {
|
|
348
|
+
focusRing: {
|
|
349
|
+
offset: `--input-radio-focus-ring-offset`,
|
|
350
|
+
width: `--input-radio-focus-ring-width`,
|
|
351
|
+
},
|
|
352
|
+
markSize: `--input-radio-mark-size`,
|
|
353
|
+
size: `--input-radio-size`,
|
|
354
|
+
},
|
|
355
|
+
|
|
356
|
+
select: {
|
|
357
|
+
focusRing: {
|
|
358
|
+
offset: `--input-select-focus-ring-offset`,
|
|
359
|
+
width: `--input-select-focus-ring-width`,
|
|
360
|
+
},
|
|
361
|
+
},
|
|
362
|
+
|
|
363
|
+
switch: {
|
|
364
|
+
focusRing: {
|
|
365
|
+
offset: `--input-switch-focus-ring-offset`,
|
|
366
|
+
width: `--input-switch-focus-ring-width`,
|
|
367
|
+
},
|
|
368
|
+
height: `--input-switch-height`,
|
|
369
|
+
padding: `--input-switch-padding`,
|
|
370
|
+
transitionDurationMs: `--input-switch-transition-duration-ms`,
|
|
371
|
+
transitionTimingFunction: `--input-switch-transition-timing-function`,
|
|
372
|
+
width: `--input-switch-width`,
|
|
373
|
+
},
|
|
374
|
+
|
|
375
|
+
text: {
|
|
376
|
+
focusRing: {
|
|
377
|
+
offset: `--input-text-focus-ring-offset`,
|
|
378
|
+
width: `--input-text-focus-ring-width`,
|
|
379
|
+
},
|
|
380
|
+
},
|
|
381
|
+
|
|
314
382
|
fontSize: `--input-font-size`,
|
|
383
|
+
|
|
315
384
|
lineHeight: `--input-line-height`,
|
|
316
385
|
letterSpacing: `--input-letter-spacing`,
|
|
317
386
|
ascenderHeight: `--input-ascender-height`,
|
|
@@ -324,9 +393,37 @@ export const varNames: VarNames = {
|
|
|
324
393
|
radius: Object.fromEntries(
|
|
325
394
|
RADIUS.map((radius) => [radius, `--radius-${radius}` as VarName]),
|
|
326
395
|
) as Record<Radius, VarName>,
|
|
396
|
+
shadow: Object.fromEntries(
|
|
397
|
+
SHADOW.map((shadow) => [
|
|
398
|
+
shadow,
|
|
399
|
+
{
|
|
400
|
+
umbra: `--shadow-${shadow}-umbra`,
|
|
401
|
+
penumbra: `--shadow-${shadow}-penumbra`,
|
|
402
|
+
ambient: `--shadow-${shadow}-ambient`,
|
|
403
|
+
},
|
|
404
|
+
]),
|
|
405
|
+
) as Record<Shadow, {umbra: VarName; penumbra: VarName; ambient: VarName}>,
|
|
327
406
|
space: Object.fromEntries(
|
|
328
407
|
SPACE.map((space) => [space, `--space-${String(space).replace('.', '_')}` as VarName]),
|
|
329
408
|
) as Record<Space, VarName>,
|
|
409
|
+
|
|
410
|
+
// color
|
|
411
|
+
black: `--black`,
|
|
412
|
+
white: `--white`,
|
|
413
|
+
...COLOR_HUES.reduce(
|
|
414
|
+
(acc, hue) => {
|
|
415
|
+
const tints = {} as Record<ColorTintKey, VarName>
|
|
416
|
+
|
|
417
|
+
for (const tint of COLOR_TINTS) {
|
|
418
|
+
tints[tint] = `--${hue}-${tint}`
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
acc[hue] = tints
|
|
422
|
+
|
|
423
|
+
return acc
|
|
424
|
+
},
|
|
425
|
+
{} as Record<ColorHueKey, Record<ColorTintKey, VarName>>,
|
|
426
|
+
),
|
|
330
427
|
} as const
|
|
331
428
|
|
|
332
429
|
function buildColorCardVarNames(props: {scheme?: Scheme; tone: CardTone}): ColorCardVarNames {
|
package/src/css/vars.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import {COLOR_HUES, COLOR_TINTS, ColorHueKey, ColorTintKey} from '@sanity/color'
|
|
1
2
|
import {
|
|
2
3
|
AVATAR_SIZE,
|
|
3
4
|
AvatarSize,
|
|
@@ -11,6 +12,8 @@ import {
|
|
|
11
12
|
type FontTextSize,
|
|
12
13
|
RADIUS,
|
|
13
14
|
Radius,
|
|
15
|
+
SHADOW,
|
|
16
|
+
Shadow,
|
|
14
17
|
SPACE,
|
|
15
18
|
type Space,
|
|
16
19
|
THEME_COLOR_AVATAR_COLORS,
|
|
@@ -190,6 +193,11 @@ export const vars: Vars = {
|
|
|
190
193
|
{} as Record<AvatarSize, {distance: CSSVar; size: CSSVar}>,
|
|
191
194
|
),
|
|
192
195
|
},
|
|
196
|
+
card: {
|
|
197
|
+
shadow: {
|
|
198
|
+
outline: `var(${varNames.card.shadow.outline})`,
|
|
199
|
+
},
|
|
200
|
+
},
|
|
193
201
|
color: colorVars,
|
|
194
202
|
container: {
|
|
195
203
|
0: `var(${varNames.container[0]})`,
|
|
@@ -219,10 +227,10 @@ export const vars: Vars = {
|
|
|
219
227
|
{} as Record<FontCodeSize, FontSizeVars>,
|
|
220
228
|
),
|
|
221
229
|
weight: {
|
|
222
|
-
regular: `var(${varNames.font.code.
|
|
223
|
-
medium: `var(${varNames.font.code.
|
|
224
|
-
semibold: `var(${varNames.font.code.
|
|
225
|
-
bold: `var(${varNames.font.code.
|
|
230
|
+
regular: `var(${varNames.font.code.weights.regular})`,
|
|
231
|
+
medium: `var(${varNames.font.code.weights.medium})`,
|
|
232
|
+
semibold: `var(${varNames.font.code.weights.semibold})`,
|
|
233
|
+
bold: `var(${varNames.font.code.weights.bold})`,
|
|
226
234
|
},
|
|
227
235
|
},
|
|
228
236
|
heading: {
|
|
@@ -244,10 +252,10 @@ export const vars: Vars = {
|
|
|
244
252
|
{} as Record<FontHeadingSize, FontSizeVars>,
|
|
245
253
|
),
|
|
246
254
|
weight: {
|
|
247
|
-
regular: `var(${varNames.font.heading.
|
|
248
|
-
medium: `var(${varNames.font.heading.
|
|
249
|
-
semibold: `var(${varNames.font.heading.
|
|
250
|
-
bold: `var(${varNames.font.heading.
|
|
255
|
+
regular: `var(${varNames.font.heading.weights.regular})`,
|
|
256
|
+
medium: `var(${varNames.font.heading.weights.medium})`,
|
|
257
|
+
semibold: `var(${varNames.font.heading.weights.semibold})`,
|
|
258
|
+
bold: `var(${varNames.font.heading.weights.bold})`,
|
|
251
259
|
},
|
|
252
260
|
},
|
|
253
261
|
label: {
|
|
@@ -269,10 +277,10 @@ export const vars: Vars = {
|
|
|
269
277
|
{} as Record<FontLabelSize, FontSizeVars>,
|
|
270
278
|
),
|
|
271
279
|
weight: {
|
|
272
|
-
regular: `var(${varNames.font.label.
|
|
273
|
-
medium: `var(${varNames.font.label.
|
|
274
|
-
semibold: `var(${varNames.font.label.
|
|
275
|
-
bold: `var(${varNames.font.label.
|
|
280
|
+
regular: `var(${varNames.font.label.weights.regular})`,
|
|
281
|
+
medium: `var(${varNames.font.label.weights.medium})`,
|
|
282
|
+
semibold: `var(${varNames.font.label.weights.semibold})`,
|
|
283
|
+
bold: `var(${varNames.font.label.weights.bold})`,
|
|
276
284
|
},
|
|
277
285
|
},
|
|
278
286
|
text: {
|
|
@@ -294,10 +302,10 @@ export const vars: Vars = {
|
|
|
294
302
|
{} as Record<FontTextSize, FontSizeVars>,
|
|
295
303
|
),
|
|
296
304
|
weight: {
|
|
297
|
-
regular: `var(${varNames.font.text.
|
|
298
|
-
medium: `var(${varNames.font.text.
|
|
299
|
-
semibold: `var(${varNames.font.text.
|
|
300
|
-
bold: `var(${varNames.font.text.
|
|
305
|
+
regular: `var(${varNames.font.text.weights.regular})`,
|
|
306
|
+
medium: `var(${varNames.font.text.weights.medium})`,
|
|
307
|
+
semibold: `var(${varNames.font.text.weights.semibold})`,
|
|
308
|
+
bold: `var(${varNames.font.text.weights.bold})`,
|
|
301
309
|
},
|
|
302
310
|
},
|
|
303
311
|
},
|
|
@@ -322,9 +330,37 @@ export const vars: Vars = {
|
|
|
322
330
|
radius: Object.fromEntries(
|
|
323
331
|
RADIUS.map((radius) => [radius, `var(${varNames.radius[radius]})` as const]),
|
|
324
332
|
) as Record<Radius, CSSVar>,
|
|
333
|
+
shadow: Object.fromEntries(
|
|
334
|
+
SHADOW.map((shadow) => [
|
|
335
|
+
shadow,
|
|
336
|
+
{
|
|
337
|
+
umbra: `var(${varNames.shadow[shadow].umbra})`,
|
|
338
|
+
penumbra: `var(${varNames.shadow[shadow].penumbra})`,
|
|
339
|
+
ambient: `var(${varNames.shadow[shadow].ambient})`,
|
|
340
|
+
},
|
|
341
|
+
]),
|
|
342
|
+
) as Record<Shadow, {umbra: CSSVar; penumbra: CSSVar; ambient: CSSVar}>,
|
|
325
343
|
space: Object.fromEntries(
|
|
326
344
|
SPACE.map((space) => [space, `var(${varNames.space[space]})` as const]),
|
|
327
345
|
) as Record<Space, CSSVar>,
|
|
346
|
+
|
|
347
|
+
// color
|
|
348
|
+
black: `var(${varNames.black})`,
|
|
349
|
+
white: `var(${varNames.white})`,
|
|
350
|
+
...COLOR_HUES.reduce(
|
|
351
|
+
(acc, hue) => {
|
|
352
|
+
const tints = {} as Record<ColorTintKey, CSSVar>
|
|
353
|
+
|
|
354
|
+
for (const tint of COLOR_TINTS) {
|
|
355
|
+
tints[tint] = `var(--${hue}-${tint})`
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
acc[hue] = tints
|
|
359
|
+
|
|
360
|
+
return acc
|
|
361
|
+
},
|
|
362
|
+
{} as Record<ColorHueKey, Record<ColorTintKey, CSSVar>>,
|
|
363
|
+
),
|
|
328
364
|
} as const
|
|
329
365
|
|
|
330
366
|
function buildColorCardVars(props: {scheme?: Scheme; tone: CardTone}): ColorCardVars {
|
|
@@ -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 {defaultTokens} from './
|
|
4
|
+
import {defaultTokens} from './defaultTokens'
|
|
5
5
|
import {resolveTokens} from './resolveTokens'
|
|
6
6
|
import {Theme_v3, ThemeOptions} from './types'
|
|
7
7
|
|
|
@@ -3,7 +3,6 @@ import {PartialTokens, Tokens} from './tokens'
|
|
|
3
3
|
export const defaultTokens: PartialTokens<Tokens> = {
|
|
4
4
|
color: {
|
|
5
5
|
'*': {
|
|
6
|
-
// backdrop: ['black/0.2', '200/0.2'],
|
|
7
6
|
backdrop: ['black/0.5', 'gray/100/0.5'],
|
|
8
7
|
code: {
|
|
9
8
|
bg: ['950', '50'],
|
|
@@ -61,7 +60,7 @@ export const defaultTokens: PartialTokens<Tokens> = {
|
|
|
61
60
|
'*': {
|
|
62
61
|
bg: {
|
|
63
62
|
0: ['950', '50'],
|
|
64
|
-
4: ['
|
|
63
|
+
4: ['700', '300'],
|
|
65
64
|
},
|
|
66
65
|
border: {
|
|
67
66
|
0: ['700', '100'],
|
package/src/theme/v3/index.ts
CHANGED
|
@@ -52,47 +52,47 @@ function resolveCardColorTokens(
|
|
|
52
52
|
avatar: {
|
|
53
53
|
gray: {
|
|
54
54
|
_hue: tokens?.avatar?.gray?._hue ?? 'gray',
|
|
55
|
-
bg: tokens?.avatar?.gray?.bg ?? ['400', '
|
|
55
|
+
bg: tokens?.avatar?.gray?.bg ?? ['400', '500'],
|
|
56
56
|
fg: tokens?.avatar?.gray?.fg ?? ['900', '900'],
|
|
57
57
|
},
|
|
58
58
|
blue: {
|
|
59
59
|
_hue: tokens?.avatar?.blue?._hue ?? 'blue',
|
|
60
|
-
bg: tokens?.avatar?.blue?.bg ?? ['400', '
|
|
60
|
+
bg: tokens?.avatar?.blue?.bg ?? ['400', '500'],
|
|
61
61
|
fg: tokens?.avatar?.blue?.fg ?? ['900', '900'],
|
|
62
62
|
},
|
|
63
63
|
purple: {
|
|
64
64
|
_hue: tokens?.avatar?.purple?._hue ?? 'purple',
|
|
65
|
-
bg: tokens?.avatar?.purple?.bg ?? ['400', '
|
|
65
|
+
bg: tokens?.avatar?.purple?.bg ?? ['400', '500'],
|
|
66
66
|
fg: tokens?.avatar?.purple?.fg ?? ['900', '900'],
|
|
67
67
|
},
|
|
68
68
|
magenta: {
|
|
69
69
|
_hue: tokens?.avatar?.magenta?._hue ?? 'magenta',
|
|
70
|
-
bg: tokens?.avatar?.magenta?.bg ?? ['400', '
|
|
70
|
+
bg: tokens?.avatar?.magenta?.bg ?? ['400', '500'],
|
|
71
71
|
fg: tokens?.avatar?.magenta?.fg ?? ['900', '900'],
|
|
72
72
|
},
|
|
73
73
|
red: {
|
|
74
74
|
_hue: tokens?.avatar?.red?._hue ?? 'red',
|
|
75
|
-
bg: tokens?.avatar?.red?.bg ?? ['400', '
|
|
75
|
+
bg: tokens?.avatar?.red?.bg ?? ['400', '500'],
|
|
76
76
|
fg: tokens?.avatar?.red?.fg ?? ['900', '900'],
|
|
77
77
|
},
|
|
78
78
|
orange: {
|
|
79
79
|
_hue: tokens?.avatar?.orange?._hue ?? 'orange',
|
|
80
|
-
bg: tokens?.avatar?.orange?.bg ?? ['400', '
|
|
80
|
+
bg: tokens?.avatar?.orange?.bg ?? ['400', '500'],
|
|
81
81
|
fg: tokens?.avatar?.orange?.fg ?? ['900', '900'],
|
|
82
82
|
},
|
|
83
83
|
yellow: {
|
|
84
84
|
_hue: tokens?.avatar?.yellow?._hue ?? 'yellow',
|
|
85
|
-
bg: tokens?.avatar?.yellow?.bg ?? ['400', '
|
|
85
|
+
bg: tokens?.avatar?.yellow?.bg ?? ['400', '500'],
|
|
86
86
|
fg: tokens?.avatar?.yellow?.fg ?? ['900', '900'],
|
|
87
87
|
},
|
|
88
88
|
green: {
|
|
89
89
|
_hue: tokens?.avatar?.green?._hue ?? 'green',
|
|
90
|
-
bg: tokens?.avatar?.green?.bg ?? ['400', '
|
|
90
|
+
bg: tokens?.avatar?.green?.bg ?? ['400', '500'],
|
|
91
91
|
fg: tokens?.avatar?.green?.fg ?? ['900', '900'],
|
|
92
92
|
},
|
|
93
93
|
cyan: {
|
|
94
94
|
_hue: tokens?.avatar?.cyan?._hue ?? 'cyan',
|
|
95
|
-
bg: tokens?.avatar?.cyan?.bg ?? ['400', '
|
|
95
|
+
bg: tokens?.avatar?.cyan?.bg ?? ['400', '500'],
|
|
96
96
|
fg: tokens?.avatar?.cyan?.fg ?? ['900', '900'],
|
|
97
97
|
},
|
|
98
98
|
},
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import {card, scopeClassName as _} from '@sanity/ui/css'
|
|
2
|
+
import {useEffect} from 'react'
|
|
3
|
+
|
|
4
|
+
import {_raf2} from './helpers'
|
|
5
|
+
import {useCard} from './primitives'
|
|
6
|
+
|
|
7
|
+
export function RootClassNames(props: {element: HTMLElement}) {
|
|
8
|
+
const {element} = props
|
|
9
|
+
const {scheme, tone} = useCard() ?? {}
|
|
10
|
+
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
const els = document.querySelectorAll(
|
|
13
|
+
[_('button'), _('card'), _('font')].map((n) => `.${n}`).join(', '),
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
// temporarily disable all transitions when the theme changes
|
|
17
|
+
for (const el of els) {
|
|
18
|
+
if (el instanceof HTMLElement) {
|
|
19
|
+
el.style.transition = 'none'
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
_raf2(() => {
|
|
24
|
+
document.documentElement.className = card({scheme, tone}) ?? ''
|
|
25
|
+
|
|
26
|
+
_raf2(() => {
|
|
27
|
+
for (const el of els) {
|
|
28
|
+
if (el instanceof HTMLElement) {
|
|
29
|
+
el.style.transition = ''
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
return () => {
|
|
36
|
+
document.documentElement.className = ''
|
|
37
|
+
}
|
|
38
|
+
}, [element, scheme, tone])
|
|
39
|
+
|
|
40
|
+
return null
|
|
41
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createColorTheme as _createColorTheme,
|
|
3
|
+
hexToRgb as _hexToRgb,
|
|
4
|
+
hslToRgb as _hslToRgb,
|
|
5
|
+
multiply as _multiply,
|
|
6
|
+
parseColor as _parseColor,
|
|
7
|
+
rgba as _rgba,
|
|
8
|
+
rgbToHex as _rgbToHex,
|
|
9
|
+
rgbToHsl as _rgbToHsl,
|
|
10
|
+
screen as _screen,
|
|
11
|
+
} from '@sanity/ui/theme'
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
/** @deprecated use `px` from `@sanity/ui/css` */
|
|
15
|
+
px,
|
|
16
|
+
/** @deprecated use `rem` from `@sanity/ui/css` */
|
|
17
|
+
rem,
|
|
18
|
+
} from '@sanity/ui/css'
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @public
|
|
22
|
+
* @deprecated Use `createColorTheme` from `@sanity/ui/theme` instead.
|
|
23
|
+
*/
|
|
24
|
+
export const createColorTheme = _createColorTheme
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @public
|
|
28
|
+
* @deprecated Use `hexToRgb` from `@sanity/ui/theme` instead.
|
|
29
|
+
*/
|
|
30
|
+
export const hexToRgb = _hexToRgb
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @public
|
|
34
|
+
* @deprecated Use `hslToRgb` from `@sanity/ui/theme` instead.
|
|
35
|
+
*/
|
|
36
|
+
export const hslToRgb = _hslToRgb
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @public
|
|
40
|
+
* @deprecated Use `multiply` from `@sanity/ui/theme` instead.
|
|
41
|
+
*/
|
|
42
|
+
export const multiply = _multiply
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @public
|
|
46
|
+
* @deprecated Use `parseColor` from `@sanity/ui/theme` instead.
|
|
47
|
+
*/
|
|
48
|
+
export const parseColor = _parseColor
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @public
|
|
52
|
+
* @deprecated Use `rgbToHex` from `@sanity/ui/theme` instead.
|
|
53
|
+
*/
|
|
54
|
+
export const rgbToHex = _rgbToHex
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @public
|
|
58
|
+
* @deprecated Use `rgbToHsl` from `@sanity/ui/theme` instead.
|
|
59
|
+
*/
|
|
60
|
+
export const rgbToHsl = _rgbToHsl
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @public
|
|
64
|
+
* @deprecated Use `rgba` from `@sanity/ui/theme` instead.
|
|
65
|
+
*/
|
|
66
|
+
export const rgba = _rgba
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @public
|
|
70
|
+
* @deprecated Use `screen` from `@sanity/ui/theme` instead.
|
|
71
|
+
*/
|
|
72
|
+
export const screen = _screen
|
package/src/ui/_compat/index.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
|
+
export * from './helpers'
|
|
2
|
+
export * from './studioTheme'
|
|
1
3
|
export * from './styles'
|
|
2
4
|
export * from './theme'
|
|
3
5
|
export * from './types'
|
|
4
|
-
export {
|
|
5
|
-
/** @deprecated use `px` from `@sanity/ui/css` */
|
|
6
|
-
px,
|
|
7
|
-
/** @deprecated use `rem` from `@sanity/ui/css` */
|
|
8
|
-
rem,
|
|
9
|
-
} from '@sanity/ui/css'
|
package/src/ui/_compat/types.ts
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
type BaseTheme as _BaseTheme,
|
|
5
|
-
buildTheme,
|
|
6
5
|
type HSL as _HSL,
|
|
7
6
|
type PartialThemeColorBuilderOpts,
|
|
8
7
|
type RGB as _RGB,
|
|
@@ -190,85 +189,3 @@ export {
|
|
|
190
189
|
type ThemeColorToneKey,
|
|
191
190
|
type ThemeInput,
|
|
192
191
|
}
|
|
193
|
-
|
|
194
|
-
import {
|
|
195
|
-
createColorTheme as _createColorTheme,
|
|
196
|
-
hexToRgb as _hexToRgb,
|
|
197
|
-
hslToRgb as _hslToRgb,
|
|
198
|
-
multiply as _multiply,
|
|
199
|
-
parseColor as _parseColor,
|
|
200
|
-
rgba as _rgba,
|
|
201
|
-
rgbToHex as _rgbToHex,
|
|
202
|
-
rgbToHsl as _rgbToHsl,
|
|
203
|
-
screen as _screen,
|
|
204
|
-
} from '@sanity/ui/theme'
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* @public
|
|
208
|
-
* @deprecated Use `createColorTheme` from `@sanity/ui/theme` instead.
|
|
209
|
-
*/
|
|
210
|
-
export const createColorTheme = _createColorTheme
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* @public
|
|
214
|
-
* @deprecated Use `hexToRgb` from `@sanity/ui/theme` instead.
|
|
215
|
-
*/
|
|
216
|
-
export const hexToRgb = _hexToRgb
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* @public
|
|
220
|
-
* @deprecated Use `hslToRgb` from `@sanity/ui/theme` instead.
|
|
221
|
-
*/
|
|
222
|
-
export const hslToRgb = _hslToRgb
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* @public
|
|
226
|
-
* @deprecated Use `multiply` from `@sanity/ui/theme` instead.
|
|
227
|
-
*/
|
|
228
|
-
export const multiply = _multiply
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* @public
|
|
232
|
-
* @deprecated Use `parseColor` from `@sanity/ui/theme` instead.
|
|
233
|
-
*/
|
|
234
|
-
export const parseColor = _parseColor
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* @public
|
|
238
|
-
* @deprecated Use `rgbToHex` from `@sanity/ui/theme` instead.
|
|
239
|
-
*/
|
|
240
|
-
export const rgbToHex = _rgbToHex
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
* @public
|
|
244
|
-
* @deprecated Use `rgbToHsl` from `@sanity/ui/theme` instead.
|
|
245
|
-
*/
|
|
246
|
-
export const rgbToHsl = _rgbToHsl
|
|
247
|
-
|
|
248
|
-
/**
|
|
249
|
-
* @public
|
|
250
|
-
* @deprecated Use `rgba` from `@sanity/ui/theme` instead.
|
|
251
|
-
*/
|
|
252
|
-
export const rgba = _rgba
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* @public
|
|
256
|
-
* @deprecated Use `screen` from `@sanity/ui/theme` instead.
|
|
257
|
-
*/
|
|
258
|
-
export const screen = _screen
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* @public
|
|
262
|
-
* @deprecated Use `buildTheme` from `@sanity/ui/theme` instead.
|
|
263
|
-
*/
|
|
264
|
-
export const studioTheme = (() => {
|
|
265
|
-
let theme: ReturnType<typeof buildTheme> | undefined
|
|
266
|
-
return {
|
|
267
|
-
get value() {
|
|
268
|
-
if (!theme) {
|
|
269
|
-
theme = buildTheme()
|
|
270
|
-
}
|
|
271
|
-
return theme
|
|
272
|
-
},
|
|
273
|
-
}
|
|
274
|
-
})()
|
package/src/ui/index.ts
CHANGED
|
@@ -58,7 +58,7 @@ export const Button = forwardRef(function Button(
|
|
|
58
58
|
ref: ForwardedRef<HTMLButtonElement>,
|
|
59
59
|
) {
|
|
60
60
|
const {
|
|
61
|
-
align = 'center',
|
|
61
|
+
// align = 'center',
|
|
62
62
|
as: As = 'button',
|
|
63
63
|
children,
|
|
64
64
|
className,
|
|
@@ -94,10 +94,9 @@ export const Button = forwardRef(function Button(
|
|
|
94
94
|
type = 'button',
|
|
95
95
|
muted = false,
|
|
96
96
|
width,
|
|
97
|
-
wrap,
|
|
97
|
+
// wrap,
|
|
98
98
|
...restProps
|
|
99
99
|
} = props
|
|
100
|
-
// const {button: buttonTheme} = useTheme_v2()
|
|
101
100
|
|
|
102
101
|
return (
|
|
103
102
|
<As
|
|
@@ -183,9 +182,9 @@ export const Button = forwardRef(function Button(
|
|
|
183
182
|
// direction={direction}
|
|
184
183
|
// display="flex"
|
|
185
184
|
flex={1}
|
|
186
|
-
gap={gap}
|
|
187
|
-
gapX={gapX}
|
|
188
|
-
gapY={gapY}
|
|
185
|
+
// gap={gap}
|
|
186
|
+
// gapX={gapX}
|
|
187
|
+
// gapY={gapY}
|
|
189
188
|
// justify={justify}
|
|
190
189
|
padding={padding}
|
|
191
190
|
paddingX={paddingX}
|