@sanity/ui 2.0.0-beta.9 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/dist/index.esm.js +53 -30
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +53 -30
- package/dist/index.js.map +1 -1
- package/dist/theme.d.ts +12 -1
- package/dist/theme.esm.js +99 -78
- package/dist/theme.esm.js.map +1 -1
- package/dist/theme.js +99 -78
- package/dist/theme.js.map +1 -1
- package/package.json +2 -2
- package/src/core/__workshop__/fontsPlugin.tsx +48 -8
- package/src/core/components/dialog/dialog.tsx +1 -1
- package/src/core/components/dialog/styles.ts +2 -2
- package/src/core/components/toast/toast.tsx +17 -2
- package/src/core/components/toast/toastProvider.tsx +20 -3
- package/src/core/constants.ts +22 -3
- package/src/core/primitives/button/button.tsx +10 -12
- package/src/core/primitives/heading/styles.ts +4 -0
- package/src/core/primitives/popover/popoverCard.tsx +7 -2
- package/src/core/primitives/switch/styles.ts +5 -0
- package/src/core/primitives/textInput/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/textInput/__workshop__/states.tsx +10 -2
- package/src/core/primitives/tooltip/tooltipCard.tsx +9 -3
- package/src/core/styles/input/textInputStyle.ts +33 -2
- package/src/core/theme/__workshop__/debug/story.tsx +65 -28
- package/src/theme/build/buildColorTheme.test.ts +2 -2
- package/src/theme/defaults/colorTokens.ts +90 -72
- package/src/theme/defaults/config.ts +1 -1
- package/src/theme/getScopedTheme.ts +1 -0
- package/src/theme/system/color/state.ts +6 -0
- package/src/theme/system/theme.ts +9 -1
- package/src/theme/system/v0/color/color.ts +0 -1
- package/src/theme/versioning/getTheme_v2.ts +2 -1
- package/src/theme/versioning/v2_v0.ts +1 -0
package/dist/theme.js
CHANGED
|
@@ -1205,7 +1205,7 @@ const defaultThemeConfig = {
|
|
|
1205
1205
|
outline: OUTLINE_WIDTH
|
|
1206
1206
|
}
|
|
1207
1207
|
},
|
|
1208
|
-
container: [
|
|
1208
|
+
container: [320, 640, 960, 1280, 1600, 1920],
|
|
1209
1209
|
media: [360, 600, 900, 1200, 1800, 2400],
|
|
1210
1210
|
layer: {
|
|
1211
1211
|
dialog: {
|
|
@@ -1687,12 +1687,13 @@ function inputStateThemeColor_v0_v2(state) {
|
|
|
1687
1687
|
}
|
|
1688
1688
|
const cache$3 = /* @__PURE__ */new WeakMap();
|
|
1689
1689
|
function getTheme_v2(theme) {
|
|
1690
|
-
var _a;
|
|
1691
|
-
if (theme.sanity.v2) return theme.sanity.v2;
|
|
1690
|
+
var _a, _b;
|
|
1691
|
+
if ((_a = theme.sanity.v2) == null ? void 0 : _a._resolved) return theme.sanity.v2;
|
|
1692
1692
|
const cached_v2 = cache$3.get(theme);
|
|
1693
1693
|
if (cached_v2) return cached_v2;
|
|
1694
1694
|
const v2 = {
|
|
1695
1695
|
_version: 2,
|
|
1696
|
+
_resolved: true,
|
|
1696
1697
|
avatar: {
|
|
1697
1698
|
...defaultThemeConfig.avatar,
|
|
1698
1699
|
...theme.sanity.avatar
|
|
@@ -1721,7 +1722,7 @@ function getTheme_v2(theme) {
|
|
|
1721
1722
|
...theme.sanity.input.switch
|
|
1722
1723
|
}
|
|
1723
1724
|
},
|
|
1724
|
-
layer: (
|
|
1725
|
+
layer: (_b = theme.sanity.layer) != null ? _b : defaultThemeConfig.layer,
|
|
1725
1726
|
media: theme.sanity.media,
|
|
1726
1727
|
radius: theme.sanity.radius,
|
|
1727
1728
|
shadow: theme.sanity.shadows,
|
|
@@ -1890,6 +1891,7 @@ function themeColor_v2_v0(color_v2) {
|
|
|
1890
1891
|
...color_v2.button.default,
|
|
1891
1892
|
transparent: color_v2.button.default.default
|
|
1892
1893
|
},
|
|
1894
|
+
selectable: color_v2.selectable,
|
|
1893
1895
|
spot: {
|
|
1894
1896
|
gray: color_v2.avatar.gray.bg,
|
|
1895
1897
|
blue: color_v2.avatar.blue.bg,
|
|
@@ -2168,7 +2170,7 @@ const defaultColorTokens = {
|
|
|
2168
2170
|
fg: ["white", "black"]
|
|
2169
2171
|
}
|
|
2170
2172
|
},
|
|
2171
|
-
backdrop: ["gray/200/0.
|
|
2173
|
+
backdrop: ["gray/200/0.5", "black/0.5"],
|
|
2172
2174
|
badge: {
|
|
2173
2175
|
"*": {
|
|
2174
2176
|
bg: ["100", "900"],
|
|
@@ -2189,10 +2191,11 @@ const defaultColorTokens = {
|
|
|
2189
2191
|
border: ["200", "800"],
|
|
2190
2192
|
code: {
|
|
2191
2193
|
bg: ["50", "950"],
|
|
2192
|
-
fg: ["600", "
|
|
2194
|
+
fg: ["600", "400"]
|
|
2193
2195
|
},
|
|
2194
2196
|
fg: ["800", "200"],
|
|
2195
2197
|
focusRing: ["blue/500", "blue/500"],
|
|
2198
|
+
icon: ["600", "400"],
|
|
2196
2199
|
kbd: {
|
|
2197
2200
|
bg: ["white", "black"],
|
|
2198
2201
|
fg: ["600", "400"],
|
|
@@ -2203,7 +2206,7 @@ const defaultColorTokens = {
|
|
|
2203
2206
|
},
|
|
2204
2207
|
muted: {
|
|
2205
2208
|
bg: ["50", "950"],
|
|
2206
|
-
fg: ["700
|
|
2209
|
+
fg: ["700 75%", "300 75%"]
|
|
2207
2210
|
},
|
|
2208
2211
|
shadow: {
|
|
2209
2212
|
outline: ["500/0.3", "500/0.4"],
|
|
@@ -2217,15 +2220,11 @@ const defaultColorTokens = {
|
|
|
2217
2220
|
}
|
|
2218
2221
|
},
|
|
2219
2222
|
transparent: {
|
|
2220
|
-
bg: ["50", "black"]
|
|
2221
|
-
fg: ["600", "400"],
|
|
2222
|
-
muted: {
|
|
2223
|
-
fg: ["600", "400"]
|
|
2224
|
-
}
|
|
2223
|
+
bg: ["50", "black"]
|
|
2225
2224
|
},
|
|
2226
2225
|
default: {
|
|
2227
2226
|
bg: ["white", "950"],
|
|
2228
|
-
fg: ["
|
|
2227
|
+
fg: ["800", "200"],
|
|
2229
2228
|
muted: {
|
|
2230
2229
|
fg: ["600", "400"]
|
|
2231
2230
|
}
|
|
@@ -2257,6 +2256,13 @@ const defaultColorTokens = {
|
|
|
2257
2256
|
accent: {
|
|
2258
2257
|
fg: ["purple/300", "purple/700"]
|
|
2259
2258
|
},
|
|
2259
|
+
avatar: {
|
|
2260
|
+
"*": {
|
|
2261
|
+
_blend: ["multiply", "screen"],
|
|
2262
|
+
bg: ["white", "black"],
|
|
2263
|
+
fg: ["black", "white"]
|
|
2264
|
+
}
|
|
2265
|
+
},
|
|
2260
2266
|
badge: {
|
|
2261
2267
|
"*": {
|
|
2262
2268
|
bg: ["900", "100"],
|
|
@@ -2272,18 +2278,18 @@ const defaultColorTokens = {
|
|
|
2272
2278
|
fg: ["200", "600"]
|
|
2273
2279
|
},
|
|
2274
2280
|
fg: ["white", "black"],
|
|
2275
|
-
icon: ["
|
|
2281
|
+
icon: ["100 70%", "900 70%"],
|
|
2276
2282
|
kbd: {
|
|
2277
2283
|
bg: ["black", "white"],
|
|
2278
|
-
fg: ["200", "
|
|
2284
|
+
fg: ["200", "600"],
|
|
2279
2285
|
border: ["800", "200"]
|
|
2280
2286
|
},
|
|
2281
2287
|
link: {
|
|
2282
|
-
fg: ["blue/200", "blue/
|
|
2288
|
+
fg: ["blue/200", "blue/600"]
|
|
2283
2289
|
},
|
|
2284
2290
|
muted: {
|
|
2285
2291
|
bg: ["950", "50"],
|
|
2286
|
-
fg: ["100 70%", "
|
|
2292
|
+
fg: ["100 70%", "900 70%"]
|
|
2287
2293
|
},
|
|
2288
2294
|
skeleton: {
|
|
2289
2295
|
from: ["900", "100"],
|
|
@@ -2302,6 +2308,9 @@ const defaultColorTokens = {
|
|
|
2302
2308
|
},
|
|
2303
2309
|
disabled: {
|
|
2304
2310
|
_hue: "gray",
|
|
2311
|
+
accent: {
|
|
2312
|
+
fg: ["100 70%", "900 70%"]
|
|
2313
|
+
},
|
|
2305
2314
|
badge: {
|
|
2306
2315
|
"*": {
|
|
2307
2316
|
bg: ["gray/700", "gray/300"],
|
|
@@ -2311,11 +2320,13 @@ const defaultColorTokens = {
|
|
|
2311
2320
|
}
|
|
2312
2321
|
},
|
|
2313
2322
|
bg: ["200", "800"],
|
|
2314
|
-
icon: ["white", "black"],
|
|
2315
2323
|
kbd: {
|
|
2316
2324
|
bg: ["black", "white"],
|
|
2317
2325
|
fg: ["white", "black"],
|
|
2318
2326
|
border: ["700", "300"]
|
|
2327
|
+
},
|
|
2328
|
+
link: {
|
|
2329
|
+
fg: ["100 70%", "900 70%"]
|
|
2319
2330
|
}
|
|
2320
2331
|
}
|
|
2321
2332
|
},
|
|
@@ -2360,7 +2371,7 @@ const defaultColorTokens = {
|
|
|
2360
2371
|
fg: ["700 60%", "400 60%"]
|
|
2361
2372
|
},
|
|
2362
2373
|
fg: ["600", "400"],
|
|
2363
|
-
icon: ["
|
|
2374
|
+
icon: ["700 60%", "300 60%"],
|
|
2364
2375
|
kbd: {
|
|
2365
2376
|
bg: ["white", "black"],
|
|
2366
2377
|
fg: ["600", "400"],
|
|
@@ -2453,14 +2464,14 @@ const defaultColorTokens = {
|
|
|
2453
2464
|
bg: ["white", "black"],
|
|
2454
2465
|
border: ["white/0", "black/0"],
|
|
2455
2466
|
code: {
|
|
2456
|
-
bg: ["
|
|
2457
|
-
fg: ["
|
|
2467
|
+
bg: ["50", "950"],
|
|
2468
|
+
fg: ["700 75%", "300 75%"]
|
|
2458
2469
|
},
|
|
2459
2470
|
fg: ["700", "300"],
|
|
2460
|
-
icon: ["700
|
|
2471
|
+
icon: ["700 75%", "300 75%"],
|
|
2461
2472
|
kbd: {
|
|
2462
2473
|
bg: ["white", "black"],
|
|
2463
|
-
fg: ["
|
|
2474
|
+
fg: ["700", "300"],
|
|
2464
2475
|
border: ["200", "800"]
|
|
2465
2476
|
},
|
|
2466
2477
|
link: {
|
|
@@ -2468,7 +2479,7 @@ const defaultColorTokens = {
|
|
|
2468
2479
|
},
|
|
2469
2480
|
muted: {
|
|
2470
2481
|
bg: ["100", "950"],
|
|
2471
|
-
fg: ["700
|
|
2482
|
+
fg: ["700 75%", "300 75%"]
|
|
2472
2483
|
},
|
|
2473
2484
|
skeleton: {
|
|
2474
2485
|
from: ["100", "900"],
|
|
@@ -2477,7 +2488,6 @@ const defaultColorTokens = {
|
|
|
2477
2488
|
},
|
|
2478
2489
|
hovered: {
|
|
2479
2490
|
bg: ["50", "950"],
|
|
2480
|
-
fg: ["700", "300"],
|
|
2481
2491
|
icon: ["700 70%", "400 70%"]
|
|
2482
2492
|
},
|
|
2483
2493
|
pressed: {
|
|
@@ -2492,6 +2502,9 @@ const defaultColorTokens = {
|
|
|
2492
2502
|
},
|
|
2493
2503
|
disabled: {
|
|
2494
2504
|
_hue: "gray",
|
|
2505
|
+
accent: {
|
|
2506
|
+
fg: ["200", "800"]
|
|
2507
|
+
},
|
|
2495
2508
|
badge: {
|
|
2496
2509
|
"*": {
|
|
2497
2510
|
_hue: "gray",
|
|
@@ -2501,13 +2514,12 @@ const defaultColorTokens = {
|
|
|
2501
2514
|
icon: ["gray/200", "gray/800"]
|
|
2502
2515
|
}
|
|
2503
2516
|
},
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
fg: ["200", "800"]
|
|
2507
|
-
},
|
|
2508
|
-
accent: {
|
|
2517
|
+
code: {
|
|
2518
|
+
bg: ["50", "950"],
|
|
2509
2519
|
fg: ["200", "800"]
|
|
2510
2520
|
},
|
|
2521
|
+
fg: ["200", "800"],
|
|
2522
|
+
icon: ["200", "800"],
|
|
2511
2523
|
kbd: {
|
|
2512
2524
|
bg: ["white", "black"],
|
|
2513
2525
|
fg: ["200", "800"],
|
|
@@ -2516,8 +2528,7 @@ const defaultColorTokens = {
|
|
|
2516
2528
|
link: {
|
|
2517
2529
|
fg: ["200", "800"]
|
|
2518
2530
|
},
|
|
2519
|
-
|
|
2520
|
-
bg: ["50", "950"],
|
|
2531
|
+
muted: {
|
|
2521
2532
|
fg: ["200", "800"]
|
|
2522
2533
|
}
|
|
2523
2534
|
}
|
|
@@ -2560,15 +2571,8 @@ const defaultColorTokens = {
|
|
|
2560
2571
|
"*": {
|
|
2561
2572
|
"*": {
|
|
2562
2573
|
_blend: ["multiply", "screen"],
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
icon: ["700 70%", "300 70%"],
|
|
2566
|
-
avatar: {
|
|
2567
|
-
"*": {
|
|
2568
|
-
_blend: ["screen", "multiply"],
|
|
2569
|
-
bg: ["500", "400"],
|
|
2570
|
-
fg: ["white", "black"]
|
|
2571
|
-
}
|
|
2574
|
+
accent: {
|
|
2575
|
+
fg: ["purple/700 70%", "purple/300 70%"]
|
|
2572
2576
|
},
|
|
2573
2577
|
badge: {
|
|
2574
2578
|
"*": {
|
|
@@ -2578,25 +2582,25 @@ const defaultColorTokens = {
|
|
|
2578
2582
|
icon: ["500", "500"]
|
|
2579
2583
|
}
|
|
2580
2584
|
},
|
|
2585
|
+
bg: ["white", "black"],
|
|
2581
2586
|
border: ["200", "800"],
|
|
2582
|
-
|
|
2587
|
+
code: {
|
|
2583
2588
|
bg: ["50", "950"],
|
|
2584
|
-
fg: ["
|
|
2585
|
-
},
|
|
2586
|
-
accent: {
|
|
2587
|
-
fg: ["purple/600", "purple/400"]
|
|
2589
|
+
fg: ["600", "400"]
|
|
2588
2590
|
},
|
|
2591
|
+
fg: ["700", "300"],
|
|
2592
|
+
icon: ["700 75%", "300 75%"],
|
|
2589
2593
|
kbd: {
|
|
2590
2594
|
bg: ["white", "black"],
|
|
2591
2595
|
fg: ["600", "400"],
|
|
2592
2596
|
border: ["200", "800"]
|
|
2593
2597
|
},
|
|
2594
2598
|
link: {
|
|
2595
|
-
fg: ["blue/700", "blue/300"]
|
|
2599
|
+
fg: ["blue/700 70%", "blue/300 70%"]
|
|
2596
2600
|
},
|
|
2597
|
-
|
|
2598
|
-
bg: ["
|
|
2599
|
-
fg: ["700", "300"]
|
|
2601
|
+
muted: {
|
|
2602
|
+
bg: ["100", "950"],
|
|
2603
|
+
fg: ["700 75%", "300 75%"]
|
|
2600
2604
|
},
|
|
2601
2605
|
skeleton: {
|
|
2602
2606
|
from: ["100", "900"],
|
|
@@ -2611,9 +2615,9 @@ const defaultColorTokens = {
|
|
|
2611
2615
|
},
|
|
2612
2616
|
selected: {
|
|
2613
2617
|
_blend: ["screen", "multiply"],
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2618
|
+
accent: {
|
|
2619
|
+
fg: ["purple/300", "purple/700"]
|
|
2620
|
+
},
|
|
2617
2621
|
avatar: {
|
|
2618
2622
|
"*": {
|
|
2619
2623
|
_blend: ["multiply", "screen"],
|
|
@@ -2623,31 +2627,31 @@ const defaultColorTokens = {
|
|
|
2623
2627
|
},
|
|
2624
2628
|
badge: {
|
|
2625
2629
|
"*": {
|
|
2626
|
-
bg: ["
|
|
2627
|
-
fg: ["
|
|
2628
|
-
dot: ["
|
|
2629
|
-
icon: ["
|
|
2630
|
+
bg: ["900", "100"],
|
|
2631
|
+
fg: ["400", "600"],
|
|
2632
|
+
dot: ["500", "500"],
|
|
2633
|
+
icon: ["500", "500"]
|
|
2630
2634
|
}
|
|
2631
2635
|
},
|
|
2636
|
+
bg: ["500", "400"],
|
|
2632
2637
|
border: ["500 20%", "400 20%"],
|
|
2633
|
-
|
|
2634
|
-
bg: ["
|
|
2635
|
-
fg: ["200", "
|
|
2636
|
-
},
|
|
2637
|
-
accent: {
|
|
2638
|
-
fg: ["purple/200", "purple/800"]
|
|
2638
|
+
code: {
|
|
2639
|
+
bg: ["500 20%", "400 20%"],
|
|
2640
|
+
fg: ["200", "600"]
|
|
2639
2641
|
},
|
|
2642
|
+
fg: ["white", "black"],
|
|
2643
|
+
icon: ["100 70%", "900 70%"],
|
|
2640
2644
|
kbd: {
|
|
2641
|
-
bg: ["black
|
|
2642
|
-
fg: ["
|
|
2643
|
-
border: ["
|
|
2645
|
+
bg: ["black", "white"],
|
|
2646
|
+
fg: ["200", "600"],
|
|
2647
|
+
border: ["800", "200"]
|
|
2644
2648
|
},
|
|
2645
2649
|
link: {
|
|
2646
|
-
fg: ["blue/200", "blue/
|
|
2650
|
+
fg: ["blue/200", "blue/600"]
|
|
2647
2651
|
},
|
|
2648
|
-
|
|
2649
|
-
bg: ["
|
|
2650
|
-
fg: ["
|
|
2652
|
+
muted: {
|
|
2653
|
+
bg: ["950", "50"],
|
|
2654
|
+
fg: ["100 70%", "900 70%"]
|
|
2651
2655
|
},
|
|
2652
2656
|
skeleton: {
|
|
2653
2657
|
from: ["900", "100"],
|
|
@@ -2655,20 +2659,36 @@ const defaultColorTokens = {
|
|
|
2655
2659
|
}
|
|
2656
2660
|
},
|
|
2657
2661
|
disabled: {
|
|
2658
|
-
|
|
2659
|
-
icon: ["200", "800"],
|
|
2660
|
-
muted: {
|
|
2661
|
-
fg: ["200", "800"]
|
|
2662
|
-
},
|
|
2662
|
+
_hue: "gray",
|
|
2663
2663
|
accent: {
|
|
2664
|
-
fg: ["
|
|
2664
|
+
fg: ["200", "800"]
|
|
2665
2665
|
},
|
|
2666
|
-
|
|
2667
|
-
|
|
2666
|
+
badge: {
|
|
2667
|
+
"*": {
|
|
2668
|
+
_hue: "gray",
|
|
2669
|
+
bg: ["50", "950"],
|
|
2670
|
+
fg: ["gray/200", "gray/800"],
|
|
2671
|
+
dot: ["gray/200", "gray/800"],
|
|
2672
|
+
icon: ["gray/200", "gray/800"]
|
|
2673
|
+
}
|
|
2668
2674
|
},
|
|
2675
|
+
border: ["100", "900"],
|
|
2669
2676
|
code: {
|
|
2670
2677
|
bg: ["50", "950"],
|
|
2671
2678
|
fg: ["200", "800"]
|
|
2679
|
+
},
|
|
2680
|
+
fg: ["200", "800"],
|
|
2681
|
+
icon: ["200", "800"],
|
|
2682
|
+
kbd: {
|
|
2683
|
+
bg: ["white", "black"],
|
|
2684
|
+
fg: ["200", "800"],
|
|
2685
|
+
border: ["100", "900"]
|
|
2686
|
+
},
|
|
2687
|
+
link: {
|
|
2688
|
+
fg: ["200", "800"]
|
|
2689
|
+
},
|
|
2690
|
+
muted: {
|
|
2691
|
+
fg: ["200", "800"]
|
|
2672
2692
|
}
|
|
2673
2693
|
}
|
|
2674
2694
|
},
|
|
@@ -4361,6 +4381,7 @@ function getScopedTheme(themeProp, scheme, tone) {
|
|
|
4361
4381
|
layer: layer_v0,
|
|
4362
4382
|
v2: {
|
|
4363
4383
|
...v2,
|
|
4384
|
+
_resolved: true,
|
|
4364
4385
|
color: color_v2,
|
|
4365
4386
|
layer: layer_v2
|
|
4366
4387
|
}
|