@sanity/ui 2.0.0-alpha.14 → 2.0.0-alpha.15
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/index.d.ts +22 -0
- package/dist/index.esm.js +248 -135
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +248 -135
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/dialog/dialog.tsx +4 -2
- package/src/theme/_internal/__workshop__/build/story.tsx +141 -31
- package/src/theme/_internal/build/buildTheme.ts +6 -5
- package/src/theme/_internal/build/colorTheme/buildColorTheme.ts +49 -107
- package/src/theme/_internal/build/colorTheme/renderColorTheme.ts +51 -35
- package/src/theme/_internal/build/colorTheme/resolveColorTokens.ts +121 -0
- package/src/theme/_internal/build/defaults/colorTokens.ts +28 -5
- package/src/theme/_internal/build/helpers.ts +5 -4
- package/src/theme/_internal/config/types.ts +11 -0
- package/src/theme/_internal/types.ts +19 -0
package/dist/index.d.ts
CHANGED
|
@@ -342,6 +342,17 @@ export declare interface BaseColorTokens {
|
|
|
342
342
|
bg?: ColorTokenValue
|
|
343
343
|
fg?: ColorTokenValue
|
|
344
344
|
border?: ColorTokenValue
|
|
345
|
+
focusRing?: ColorTokenValue
|
|
346
|
+
shadow?: {
|
|
347
|
+
outline?: ColorTokenValue
|
|
348
|
+
umbra?: ColorTokenValue
|
|
349
|
+
penumbra?: ColorTokenValue
|
|
350
|
+
ambient?: ColorTokenValue
|
|
351
|
+
}
|
|
352
|
+
skeleton?: {
|
|
353
|
+
from?: ColorTokenValue
|
|
354
|
+
to?: ColorTokenValue
|
|
355
|
+
}
|
|
345
356
|
}
|
|
346
357
|
|
|
347
358
|
/**
|
|
@@ -3237,6 +3248,17 @@ export declare interface TMP_BaseColorTheme {
|
|
|
3237
3248
|
bg: string
|
|
3238
3249
|
fg: string
|
|
3239
3250
|
border: string
|
|
3251
|
+
focusRing: string
|
|
3252
|
+
shadow: {
|
|
3253
|
+
outline: string
|
|
3254
|
+
umbra: string
|
|
3255
|
+
penumbra: string
|
|
3256
|
+
ambient: string
|
|
3257
|
+
}
|
|
3258
|
+
skeleton: {
|
|
3259
|
+
from: string
|
|
3260
|
+
to: string
|
|
3261
|
+
}
|
|
3240
3262
|
}
|
|
3241
3263
|
button: TMP_ButtonColorTheme
|
|
3242
3264
|
}
|
package/dist/index.esm.js
CHANGED
|
@@ -847,7 +847,18 @@ const defaultColorTokens = {
|
|
|
847
847
|
_blend: ["multiply", "screen"],
|
|
848
848
|
bg: ["50", "950"],
|
|
849
849
|
fg: ["800", "200"],
|
|
850
|
-
border: ["200", "800"]
|
|
850
|
+
border: ["200", "800"],
|
|
851
|
+
focusRing: ["cyan/500", "cyan/500"],
|
|
852
|
+
shadow: {
|
|
853
|
+
outline: ["500/0.25", "400/0.3"],
|
|
854
|
+
umbra: ["500/0.1", "black/0.4"],
|
|
855
|
+
penumbra: ["500/0.07", "black/0.28"],
|
|
856
|
+
ambient: ["500/0.06", "black/0.24"]
|
|
857
|
+
},
|
|
858
|
+
skeleton: {
|
|
859
|
+
from: ["100", "900"],
|
|
860
|
+
to: ["100/0.5", "900/0.5"]
|
|
861
|
+
}
|
|
851
862
|
},
|
|
852
863
|
transparent: {
|
|
853
864
|
bg: ["50", "black"],
|
|
@@ -875,7 +886,11 @@ const defaultColorTokens = {
|
|
|
875
886
|
"*": {
|
|
876
887
|
_blend: ["screen", "multiply"],
|
|
877
888
|
bg: ["500", "400"],
|
|
878
|
-
|
|
889
|
+
bg2: ["950", "50"],
|
|
890
|
+
border: ["500/0", "400/0"],
|
|
891
|
+
muted: {
|
|
892
|
+
fg: ["200", "700"]
|
|
893
|
+
}
|
|
879
894
|
},
|
|
880
895
|
hovered: {
|
|
881
896
|
bg: ["600", "300"],
|
|
@@ -889,15 +904,19 @@ const defaultColorTokens = {
|
|
|
889
904
|
},
|
|
890
905
|
disabled: {
|
|
891
906
|
_hue: "gray",
|
|
892
|
-
bg: ["
|
|
907
|
+
bg: ["200", "900"]
|
|
893
908
|
}
|
|
894
909
|
},
|
|
895
910
|
ghost: {
|
|
896
911
|
"*": {
|
|
897
912
|
_blend: ["multiply", "screen"],
|
|
898
913
|
bg: ["white", "black"],
|
|
914
|
+
bg2: ["50", "950"],
|
|
899
915
|
fg: ["600", "400"],
|
|
900
|
-
border: ["200", "800"]
|
|
916
|
+
border: ["200", "800"],
|
|
917
|
+
muted: {
|
|
918
|
+
fg: ["600/0.6", "400/0.6"]
|
|
919
|
+
}
|
|
901
920
|
},
|
|
902
921
|
hovered: {
|
|
903
922
|
bg: ["50", "950"],
|
|
@@ -913,16 +932,20 @@ const defaultColorTokens = {
|
|
|
913
932
|
},
|
|
914
933
|
disabled: {
|
|
915
934
|
_hue: "gray",
|
|
916
|
-
fg: ["
|
|
917
|
-
border: ["100", "
|
|
935
|
+
fg: ["200", "900"],
|
|
936
|
+
border: ["100", "950"]
|
|
918
937
|
}
|
|
919
938
|
},
|
|
920
939
|
bleed: {
|
|
921
940
|
"*": {
|
|
922
941
|
_blend: ["multiply", "screen"],
|
|
923
942
|
bg: ["white", "black"],
|
|
943
|
+
bg2: ["50", "950"],
|
|
924
944
|
fg: ["600", "400"],
|
|
925
|
-
border: ["white/0", "black/0"]
|
|
945
|
+
border: ["white/0", "black/0"],
|
|
946
|
+
muted: {
|
|
947
|
+
fg: ["600/0.6", "400/0.6"]
|
|
948
|
+
}
|
|
926
949
|
},
|
|
927
950
|
hovered: {
|
|
928
951
|
bg: ["50", "950"],
|
|
@@ -938,7 +961,7 @@ const defaultColorTokens = {
|
|
|
938
961
|
},
|
|
939
962
|
disabled: {
|
|
940
963
|
_hue: "gray",
|
|
941
|
-
fg: ["
|
|
964
|
+
fg: ["200", "900"]
|
|
942
965
|
}
|
|
943
966
|
}
|
|
944
967
|
},
|
|
@@ -958,7 +981,7 @@ const defaultColorTokens = {
|
|
|
958
981
|
},
|
|
959
982
|
disabled: {
|
|
960
983
|
_hue: "gray",
|
|
961
|
-
bg: ["
|
|
984
|
+
bg: ["200", "900"]
|
|
962
985
|
}
|
|
963
986
|
}
|
|
964
987
|
}
|
|
@@ -1310,12 +1333,11 @@ function isColorValue(str) {
|
|
|
1310
1333
|
function isColorOpacityValue(str) {
|
|
1311
1334
|
return str === "0" || /^0\.[0-9]+$/.test(str) || str === "1";
|
|
1312
1335
|
}
|
|
1313
|
-
function resolveColorTokenValue(
|
|
1336
|
+
function resolveColorTokenValue(context, value) {
|
|
1314
1337
|
const {
|
|
1315
1338
|
hue,
|
|
1316
|
-
scheme
|
|
1317
|
-
|
|
1318
|
-
} = options;
|
|
1339
|
+
scheme
|
|
1340
|
+
} = context;
|
|
1319
1341
|
const node = parseTokenValue(value[scheme === "light" ? 0 : 1]);
|
|
1320
1342
|
if (!node || node.type !== "color") {
|
|
1321
1343
|
throw new Error("Invalid color token: ".concat(value[0]));
|
|
@@ -1355,68 +1377,179 @@ function screen$1(bg, fg) {
|
|
|
1355
1377
|
}
|
|
1356
1378
|
return hex;
|
|
1357
1379
|
}
|
|
1380
|
+
function resolveColorTokens(sparseTokens) {
|
|
1381
|
+
const denseTokens = {
|
|
1382
|
+
...sparseTokens
|
|
1383
|
+
};
|
|
1384
|
+
for (const tone of COLOR_BASE_TONES) {
|
|
1385
|
+
denseTokens[tone] = resolveBaseColorTones(sparseTokens, tone);
|
|
1386
|
+
}
|
|
1387
|
+
denseTokens.button = resolveButtonColorTokens(sparseTokens);
|
|
1388
|
+
return denseTokens;
|
|
1389
|
+
}
|
|
1390
|
+
function resolveBaseColorTones(sparseTokens, tone) {
|
|
1391
|
+
const spec0 = sparseTokens == null ? void 0 : sparseTokens[tone];
|
|
1392
|
+
const spec1 = sparseTokens == null ? void 0 : sparseTokens["*"];
|
|
1393
|
+
return {
|
|
1394
|
+
...spec1,
|
|
1395
|
+
...spec0,
|
|
1396
|
+
shadow: {
|
|
1397
|
+
...(spec1 == null ? void 0 : spec1.shadow),
|
|
1398
|
+
...(spec0 == null ? void 0 : spec0.shadow)
|
|
1399
|
+
},
|
|
1400
|
+
skeleton: {
|
|
1401
|
+
...(spec1 == null ? void 0 : spec1.skeleton),
|
|
1402
|
+
...(spec0 == null ? void 0 : spec0.skeleton)
|
|
1403
|
+
}
|
|
1404
|
+
};
|
|
1405
|
+
}
|
|
1406
|
+
function resolveButtonColorTokens(sparseTokens) {
|
|
1407
|
+
const tokens = {};
|
|
1408
|
+
for (const tone of COLOR_STATE_TONES) {
|
|
1409
|
+
tokens[tone] = resolveButtonToneColorTokens(sparseTokens, tone);
|
|
1410
|
+
}
|
|
1411
|
+
return tokens;
|
|
1412
|
+
}
|
|
1413
|
+
function resolveButtonToneColorTokens(sparseTokens, tone) {
|
|
1414
|
+
var _a, _b;
|
|
1415
|
+
const tokens = {
|
|
1416
|
+
...((_a = sparseTokens.button) == null ? void 0 : _a[tone]),
|
|
1417
|
+
...((_b = sparseTokens.button) == null ? void 0 : _b["*"])
|
|
1418
|
+
};
|
|
1419
|
+
for (const mode of COLOR_BUTTON_MODES) {
|
|
1420
|
+
tokens[mode] = resolveButtonModeColorTokens(sparseTokens, tone, mode);
|
|
1421
|
+
}
|
|
1422
|
+
return tokens;
|
|
1423
|
+
}
|
|
1424
|
+
function resolveButtonModeColorTokens(sparseTokens, tone, mode) {
|
|
1425
|
+
var _a, _b, _c, _d;
|
|
1426
|
+
const spec0 = (_b = (_a = sparseTokens.button) == null ? void 0 : _a[tone]) == null ? void 0 : _b[mode];
|
|
1427
|
+
const spec1 = (_d = (_c = sparseTokens.button) == null ? void 0 : _c["*"]) == null ? void 0 : _d[mode];
|
|
1428
|
+
const tokens = {
|
|
1429
|
+
...spec1,
|
|
1430
|
+
...spec0
|
|
1431
|
+
};
|
|
1432
|
+
for (const state of COLOR_STATES) {
|
|
1433
|
+
tokens[state] = resolveButtonStateColorTokens(sparseTokens, tone, mode, state);
|
|
1434
|
+
}
|
|
1435
|
+
return tokens;
|
|
1436
|
+
}
|
|
1437
|
+
function resolveButtonStateColorTokens(tokens, tone, mode, state) {
|
|
1438
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
1439
|
+
const spec0 = (_c = (_b = (_a = tokens == null ? void 0 : tokens.button) == null ? void 0 : _a[tone]) == null ? void 0 : _b[mode]) == null ? void 0 : _c[state];
|
|
1440
|
+
const spec1 = (_f = (_e = (_d = tokens == null ? void 0 : tokens.button) == null ? void 0 : _d[tone]) == null ? void 0 : _e[mode]) == null ? void 0 : _f["*"];
|
|
1441
|
+
const spec2 = (_i = (_h = (_g = tokens == null ? void 0 : tokens.button) == null ? void 0 : _g["*"]) == null ? void 0 : _h[mode]) == null ? void 0 : _i[state];
|
|
1442
|
+
const spec3 = (_l = (_k = (_j = tokens == null ? void 0 : tokens.button) == null ? void 0 : _j["*"]) == null ? void 0 : _k[mode]) == null ? void 0 : _l["*"];
|
|
1443
|
+
const hue = (spec0 == null ? void 0 : spec0._hue) || (spec1 == null ? void 0 : spec1._hue) || (spec2 == null ? void 0 : spec2._hue) || (spec3 == null ? void 0 : spec3._hue) || ((_n = (_m = tokens == null ? void 0 : tokens.button) == null ? void 0 : _m[tone]) == null ? void 0 : _n._hue) || ((_o = tokens == null ? void 0 : tokens[tone]) == null ? void 0 : _o._hue);
|
|
1444
|
+
return {
|
|
1445
|
+
...spec3,
|
|
1446
|
+
...spec2,
|
|
1447
|
+
...spec1,
|
|
1448
|
+
...spec0,
|
|
1449
|
+
_hue: hue,
|
|
1450
|
+
muted: {
|
|
1451
|
+
...(spec3 == null ? void 0 : spec3.muted),
|
|
1452
|
+
...(spec2 == null ? void 0 : spec2.muted),
|
|
1453
|
+
...(spec1 == null ? void 0 : spec1.muted),
|
|
1454
|
+
...(spec0 == null ? void 0 : spec0.muted)
|
|
1455
|
+
},
|
|
1456
|
+
accent: {
|
|
1457
|
+
...(spec3 == null ? void 0 : spec3.accent),
|
|
1458
|
+
...(spec2 == null ? void 0 : spec2.accent),
|
|
1459
|
+
...(spec1 == null ? void 0 : spec1.accent),
|
|
1460
|
+
...(spec0 == null ? void 0 : spec0.accent)
|
|
1461
|
+
},
|
|
1462
|
+
link: {
|
|
1463
|
+
...(spec3 == null ? void 0 : spec3.link),
|
|
1464
|
+
...(spec2 == null ? void 0 : spec2.link),
|
|
1465
|
+
...(spec1 == null ? void 0 : spec1.link),
|
|
1466
|
+
...(spec0 == null ? void 0 : spec0.link)
|
|
1467
|
+
},
|
|
1468
|
+
code: {
|
|
1469
|
+
...(spec3 == null ? void 0 : spec3.code),
|
|
1470
|
+
...(spec2 == null ? void 0 : spec2.code),
|
|
1471
|
+
...(spec1 == null ? void 0 : spec1.code),
|
|
1472
|
+
...(spec0 == null ? void 0 : spec0.code)
|
|
1473
|
+
},
|
|
1474
|
+
skeleton: {
|
|
1475
|
+
...(spec3 == null ? void 0 : spec3.skeleton),
|
|
1476
|
+
...(spec2 == null ? void 0 : spec2.skeleton),
|
|
1477
|
+
...(spec1 == null ? void 0 : spec1.skeleton),
|
|
1478
|
+
...(spec0 == null ? void 0 : spec0.skeleton)
|
|
1479
|
+
}
|
|
1480
|
+
};
|
|
1481
|
+
}
|
|
1358
1482
|
function buildColorTheme(options, config) {
|
|
1483
|
+
var _a, _b;
|
|
1359
1484
|
const {
|
|
1360
1485
|
scheme
|
|
1361
1486
|
} = options;
|
|
1487
|
+
const resolvedConfig = {
|
|
1488
|
+
...config,
|
|
1489
|
+
color: {
|
|
1490
|
+
...(config == null ? void 0 : config.color),
|
|
1491
|
+
tokens: resolveColorTokens((_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.tokens) != null ? _b : defaultColorTokens)
|
|
1492
|
+
}
|
|
1493
|
+
};
|
|
1362
1494
|
return {
|
|
1363
1495
|
transparent: buildBaseColorTheme({
|
|
1364
1496
|
scheme,
|
|
1365
1497
|
tone: "transparent"
|
|
1366
|
-
},
|
|
1498
|
+
}, resolvedConfig),
|
|
1367
1499
|
default: buildBaseColorTheme({
|
|
1368
1500
|
scheme,
|
|
1369
1501
|
tone: "default"
|
|
1370
|
-
},
|
|
1502
|
+
}, resolvedConfig),
|
|
1371
1503
|
primary: buildBaseColorTheme({
|
|
1372
1504
|
scheme,
|
|
1373
1505
|
tone: "primary"
|
|
1374
|
-
},
|
|
1506
|
+
}, resolvedConfig),
|
|
1375
1507
|
positive: buildBaseColorTheme({
|
|
1376
1508
|
scheme,
|
|
1377
1509
|
tone: "positive"
|
|
1378
|
-
},
|
|
1510
|
+
}, resolvedConfig),
|
|
1379
1511
|
caution: buildBaseColorTheme({
|
|
1380
1512
|
scheme,
|
|
1381
1513
|
tone: "caution"
|
|
1382
|
-
},
|
|
1514
|
+
}, resolvedConfig),
|
|
1383
1515
|
critical: buildBaseColorTheme({
|
|
1384
1516
|
scheme,
|
|
1385
1517
|
tone: "critical"
|
|
1386
|
-
},
|
|
1518
|
+
}, resolvedConfig)
|
|
1387
1519
|
};
|
|
1388
1520
|
}
|
|
1389
1521
|
function buildBaseColorTheme(options, config) {
|
|
1390
|
-
var _a, _b;
|
|
1522
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1391
1523
|
const {
|
|
1392
1524
|
scheme,
|
|
1393
1525
|
tone
|
|
1394
1526
|
} = options;
|
|
1395
|
-
const tokens = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.tokens)
|
|
1396
|
-
const
|
|
1397
|
-
const
|
|
1398
|
-
const hue = (toneTokens == null ? void 0 : toneTokens._hue) || (any == null ? void 0 : any._hue) || "gray";
|
|
1399
|
-
const bg = resolveColorTokenValue({
|
|
1527
|
+
const tokens = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.tokens) == null ? void 0 : _b[tone];
|
|
1528
|
+
const hue = (tokens == null ? void 0 : tokens._hue) || "gray";
|
|
1529
|
+
const context = {
|
|
1400
1530
|
hue,
|
|
1401
|
-
scheme
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
const
|
|
1531
|
+
scheme
|
|
1532
|
+
};
|
|
1533
|
+
const bg = resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.bg) || ["gray/50", "black"]);
|
|
1534
|
+
const blendMode = (tokens == null ? void 0 : tokens._blend) || ["screen", "multiply"];
|
|
1405
1535
|
return {
|
|
1406
|
-
_blend:
|
|
1536
|
+
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
1407
1537
|
dark: scheme === "dark",
|
|
1408
1538
|
base: {
|
|
1409
1539
|
bg,
|
|
1410
|
-
fg: resolveColorTokenValue(
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1540
|
+
fg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.fg) || ["black", "white"]),
|
|
1541
|
+
border: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.border) || ["black", "white"]),
|
|
1542
|
+
focusRing: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.focusRing) || ["black", "white"]),
|
|
1543
|
+
shadow: {
|
|
1544
|
+
outline: resolveColorTokenValue(context, ((_c = tokens == null ? void 0 : tokens.shadow) == null ? void 0 : _c.outline) || ["500/0.2", "500/0.2"]),
|
|
1545
|
+
umbra: resolveColorTokenValue(context, ((_d = tokens == null ? void 0 : tokens.shadow) == null ? void 0 : _d.umbra) || ["500/0.2", "500/0.2"]),
|
|
1546
|
+
penumbra: resolveColorTokenValue(context, ((_e = tokens == null ? void 0 : tokens.shadow) == null ? void 0 : _e.penumbra) || ["500/0.2", "500/0.2"]),
|
|
1547
|
+
ambient: resolveColorTokenValue(context, ((_f = tokens == null ? void 0 : tokens.shadow) == null ? void 0 : _f.ambient) || ["500/0.2", "500/0.2"])
|
|
1548
|
+
},
|
|
1549
|
+
skeleton: {
|
|
1550
|
+
from: resolveColorTokenValue(context, ((_g = tokens == null ? void 0 : tokens.skeleton) == null ? void 0 : _g.from) || ["500/0.2", "500/0.2"]),
|
|
1551
|
+
to: resolveColorTokenValue(context, ((_h = tokens == null ? void 0 : tokens.skeleton) == null ? void 0 : _h.to) || ["500/0.2", "500/0.2"])
|
|
1552
|
+
}
|
|
1420
1553
|
},
|
|
1421
1554
|
button: buildButtonColorTheme({
|
|
1422
1555
|
scheme
|
|
@@ -1472,78 +1605,48 @@ function buildButtonModeColorTheme(options, config) {
|
|
|
1472
1605
|
return Object.assign({}, ...states);
|
|
1473
1606
|
}
|
|
1474
1607
|
function buildButtonStateColorTheme(options, config) {
|
|
1475
|
-
var _a, _b, _c, _d, _e
|
|
1608
|
+
var _a, _b, _c, _d, _e;
|
|
1476
1609
|
const {
|
|
1477
1610
|
mode,
|
|
1478
1611
|
tone,
|
|
1479
1612
|
scheme,
|
|
1480
1613
|
state
|
|
1481
1614
|
} = options;
|
|
1482
|
-
const tokens = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.tokens)
|
|
1483
|
-
const hue = (
|
|
1484
|
-
const
|
|
1485
|
-
const
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1615
|
+
const tokens = (_e = (_d = (_c = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.tokens) == null ? void 0 : _b.button) == null ? void 0 : _c[tone]) == null ? void 0 : _d[mode]) == null ? void 0 : _e[state];
|
|
1616
|
+
const hue = (tokens == null ? void 0 : tokens._hue) || "gray";
|
|
1617
|
+
const blendMode = (tokens == null ? void 0 : tokens._blend) || ["screen", "multiply"];
|
|
1618
|
+
const context = {
|
|
1619
|
+
hue,
|
|
1620
|
+
scheme
|
|
1621
|
+
};
|
|
1489
1622
|
return {
|
|
1490
|
-
_blend:
|
|
1491
|
-
bg: resolveColorTokenValue(
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
}),
|
|
1496
|
-
bg2: resolveColorTokenValue({
|
|
1497
|
-
hue,
|
|
1498
|
-
scheme,
|
|
1499
|
-
value: (spec0 == null ? void 0 : spec0.bg2) || (spec1 == null ? void 0 : spec1.bg2) || (spec2 == null ? void 0 : spec2.bg2) || (spec3 == null ? void 0 : spec3.bg2) || ["500", "400"]
|
|
1500
|
-
}),
|
|
1501
|
-
fg: resolveColorTokenValue({
|
|
1502
|
-
hue,
|
|
1503
|
-
scheme,
|
|
1504
|
-
value: (spec0 == null ? void 0 : spec0.fg) || (spec1 == null ? void 0 : spec1.fg) || (spec2 == null ? void 0 : spec2.fg) || (spec3 == null ? void 0 : spec3.fg) || ["white", "black"]
|
|
1505
|
-
}),
|
|
1506
|
-
border: resolveColorTokenValue({
|
|
1507
|
-
hue,
|
|
1508
|
-
scheme,
|
|
1509
|
-
value: (spec0 == null ? void 0 : spec0.border) || (spec1 == null ? void 0 : spec1.border) || (spec2 == null ? void 0 : spec2.border) || (spec3 == null ? void 0 : spec3.border) || ["500", "400"]
|
|
1510
|
-
}),
|
|
1623
|
+
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
1624
|
+
bg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.bg) || ["500", "400"]),
|
|
1625
|
+
bg2: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.bg2) || ["500", "400"]),
|
|
1626
|
+
fg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.fg) || ["white", "black"]),
|
|
1627
|
+
border: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.border) || ["500", "400"]),
|
|
1511
1628
|
muted: {
|
|
1512
|
-
fg: resolveColorTokenValue(
|
|
1513
|
-
hue,
|
|
1514
|
-
scheme,
|
|
1515
|
-
value: ((_z = spec0 == null ? void 0 : spec0.muted) == null ? void 0 : _z.fg) || ((_A = spec1 == null ? void 0 : spec1.muted) == null ? void 0 : _A.fg) || ((_B = spec2 == null ? void 0 : spec2.muted) == null ? void 0 : _B.fg) || ((_C = spec3 == null ? void 0 : spec3.muted) == null ? void 0 : _C.fg) || ["500", "400"]
|
|
1516
|
-
})
|
|
1629
|
+
fg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.fg) || ["500", "400"])
|
|
1517
1630
|
},
|
|
1518
1631
|
accent: {
|
|
1519
|
-
fg: resolveColorTokenValue(
|
|
1520
|
-
hue,
|
|
1521
|
-
scheme,
|
|
1522
|
-
value: ((_D = spec0 == null ? void 0 : spec0.accent) == null ? void 0 : _D.fg) || ((_E = spec1 == null ? void 0 : spec1.accent) == null ? void 0 : _E.fg) || ((_F = spec2 == null ? void 0 : spec2.accent) == null ? void 0 : _F.fg) || ((_G = spec3 == null ? void 0 : spec3.accent) == null ? void 0 : _G.fg) || ["500", "400"]
|
|
1523
|
-
})
|
|
1632
|
+
fg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.fg) || ["500", "400"])
|
|
1524
1633
|
},
|
|
1525
1634
|
link: {
|
|
1526
|
-
fg: resolveColorTokenValue(
|
|
1527
|
-
hue,
|
|
1528
|
-
scheme,
|
|
1529
|
-
value: ((_H = spec0 == null ? void 0 : spec0.link) == null ? void 0 : _H.fg) || ((_I = spec1 == null ? void 0 : spec1.link) == null ? void 0 : _I.fg) || ((_J = spec2 == null ? void 0 : spec2.link) == null ? void 0 : _J.fg) || ((_K = spec3 == null ? void 0 : spec3.link) == null ? void 0 : _K.fg) || ["500", "400"]
|
|
1530
|
-
})
|
|
1635
|
+
fg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.fg) || ["500", "400"])
|
|
1531
1636
|
},
|
|
1532
1637
|
code: {
|
|
1533
|
-
bg: resolveColorTokenValue(
|
|
1534
|
-
|
|
1535
|
-
scheme,
|
|
1536
|
-
value: ((_L = spec0 == null ? void 0 : spec0.code) == null ? void 0 : _L.bg) || ((_M = spec1 == null ? void 0 : spec1.code) == null ? void 0 : _M.bg) || ((_N = spec2 == null ? void 0 : spec2.code) == null ? void 0 : _N.bg) || ((_O = spec3 == null ? void 0 : spec3.code) == null ? void 0 : _O.bg) || ["500", "400"]
|
|
1537
|
-
}),
|
|
1538
|
-
fg: resolveColorTokenValue({
|
|
1539
|
-
hue,
|
|
1540
|
-
scheme,
|
|
1541
|
-
value: ((_P = spec0 == null ? void 0 : spec0.code) == null ? void 0 : _P.fg) || ((_Q = spec1 == null ? void 0 : spec1.code) == null ? void 0 : _Q.fg) || ((_R = spec2 == null ? void 0 : spec2.code) == null ? void 0 : _R.fg) || ((_S = spec3 == null ? void 0 : spec3.code) == null ? void 0 : _S.fg) || ["500", "400"]
|
|
1542
|
-
})
|
|
1638
|
+
bg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.bg) || ["500", "400"]),
|
|
1639
|
+
fg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.fg) || ["500", "400"])
|
|
1543
1640
|
}
|
|
1544
1641
|
};
|
|
1545
1642
|
}
|
|
1546
|
-
|
|
1643
|
+
const defaultColorPalette = {
|
|
1644
|
+
...color$1,
|
|
1645
|
+
black: "#000000"
|
|
1646
|
+
};
|
|
1647
|
+
function renderColorTheme(value, config) {
|
|
1648
|
+
var _a, _b;
|
|
1649
|
+
const colorPalette = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.palette) != null ? _b : defaultColorPalette;
|
|
1547
1650
|
return {
|
|
1548
1651
|
light: renderColorScheme(colorPalette, value.light),
|
|
1549
1652
|
dark: renderColorScheme(colorPalette, value.dark)
|
|
@@ -1577,7 +1680,18 @@ function renderColorBase(colorPalette, value, bg) {
|
|
|
1577
1680
|
base: {
|
|
1578
1681
|
bg: nestedBg,
|
|
1579
1682
|
fg: renderColorValue(colorPalette, nestedBg, value._blend, value.base.fg),
|
|
1580
|
-
border: renderColorValue(colorPalette, nestedBg, value._blend, value.base.border)
|
|
1683
|
+
border: renderColorValue(colorPalette, nestedBg, value._blend, value.base.border),
|
|
1684
|
+
focusRing: renderColorValue(colorPalette, nestedBg, value._blend, value.base.focusRing),
|
|
1685
|
+
shadow: {
|
|
1686
|
+
outline: renderColorValue(colorPalette, nestedBg, value._blend, value.base.shadow.outline),
|
|
1687
|
+
umbra: renderColorValue(colorPalette, nestedBg, value._blend, value.base.shadow.umbra),
|
|
1688
|
+
penumbra: renderColorValue(colorPalette, nestedBg, value._blend, value.base.shadow.penumbra),
|
|
1689
|
+
ambient: renderColorValue(colorPalette, nestedBg, value._blend, value.base.shadow.ambient)
|
|
1690
|
+
},
|
|
1691
|
+
skeleton: {
|
|
1692
|
+
from: renderColorValue(colorPalette, nestedBg, value._blend, value.base.skeleton.from),
|
|
1693
|
+
to: renderColorValue(colorPalette, nestedBg, value._blend, value.base.skeleton.to)
|
|
1694
|
+
}
|
|
1581
1695
|
},
|
|
1582
1696
|
button: renderButtonColorTheme(colorPalette, nestedBg, value._blend, value.button)
|
|
1583
1697
|
};
|
|
@@ -1610,41 +1724,43 @@ function renderStatesColorTheme(colorPalette, bg, baseBlendMode, value) {
|
|
|
1610
1724
|
function renderStateColorTheme(colorPalette, baseBg, rootBlendMode, value) {
|
|
1611
1725
|
const blendMode = value._blend;
|
|
1612
1726
|
const bg = rootBlendMode === "multiply" && value.bg === "white" ? "#ffffff" : rootBlendMode === "screen" && value.bg === "black" ? "#000000" : renderColorValue(colorPalette, rootBlendMode === "multiply" ? "#ffffff" : "#000000", rootBlendMode, value.bg);
|
|
1613
|
-
const bg2 = renderColorValue(colorPalette, bg, blendMode, value.bg2 || value.bg);
|
|
1614
|
-
const fg = renderColorValue(colorPalette, bg, blendMode, value.fg);
|
|
1615
|
-
const border = renderColorValue(colorPalette, bg, blendMode, value.border);
|
|
1616
|
-
const muted = {
|
|
1617
|
-
fg: renderColorValue(colorPalette, bg, blendMode, value.muted.fg)
|
|
1618
|
-
};
|
|
1619
|
-
const accent = {
|
|
1620
|
-
fg: renderColorValue(colorPalette, bg, blendMode, value.accent.fg)
|
|
1621
|
-
};
|
|
1622
|
-
const link = {
|
|
1623
|
-
fg: renderColorValue(colorPalette, bg, blendMode, value.link.fg)
|
|
1624
|
-
};
|
|
1625
|
-
const code = {
|
|
1626
|
-
bg: renderColorValue(colorPalette, bg, blendMode, value.code.bg),
|
|
1627
|
-
fg: renderColorValue(colorPalette, bg, blendMode, value.code.fg)
|
|
1628
|
-
};
|
|
1629
1727
|
const blend = rootBlendMode === "multiply" ? multiply$1 : screen$1;
|
|
1728
|
+
const unmixed = {
|
|
1729
|
+
bg2: renderColorValue(colorPalette, bg, blendMode, value.bg2 || value.bg),
|
|
1730
|
+
fg: renderColorValue(colorPalette, bg, blendMode, value.fg),
|
|
1731
|
+
border: renderColorValue(colorPalette, bg, blendMode, value.border),
|
|
1732
|
+
muted: {
|
|
1733
|
+
fg: renderColorValue(colorPalette, bg, blendMode, value.muted.fg)
|
|
1734
|
+
},
|
|
1735
|
+
accent: {
|
|
1736
|
+
fg: renderColorValue(colorPalette, bg, blendMode, value.accent.fg)
|
|
1737
|
+
},
|
|
1738
|
+
link: {
|
|
1739
|
+
fg: renderColorValue(colorPalette, bg, blendMode, value.link.fg)
|
|
1740
|
+
},
|
|
1741
|
+
code: {
|
|
1742
|
+
bg: renderColorValue(colorPalette, bg, blendMode, value.code.bg),
|
|
1743
|
+
fg: renderColorValue(colorPalette, bg, blendMode, value.code.fg)
|
|
1744
|
+
}
|
|
1745
|
+
};
|
|
1630
1746
|
return {
|
|
1631
1747
|
_blend: blendMode,
|
|
1632
1748
|
bg: blend(baseBg, bg),
|
|
1633
|
-
bg2: blend(baseBg, bg2),
|
|
1634
|
-
fg: blend(baseBg, fg),
|
|
1635
|
-
border: blend(baseBg, border),
|
|
1749
|
+
bg2: blend(baseBg, unmixed.bg2),
|
|
1750
|
+
fg: blend(baseBg, unmixed.fg),
|
|
1751
|
+
border: blend(baseBg, unmixed.border),
|
|
1636
1752
|
muted: {
|
|
1637
|
-
fg: blend(baseBg, muted.fg)
|
|
1753
|
+
fg: blend(baseBg, unmixed.muted.fg)
|
|
1638
1754
|
},
|
|
1639
1755
|
accent: {
|
|
1640
|
-
fg: blend(baseBg, accent.fg)
|
|
1756
|
+
fg: blend(baseBg, unmixed.accent.fg)
|
|
1641
1757
|
},
|
|
1642
1758
|
link: {
|
|
1643
|
-
fg: blend(baseBg, link.fg)
|
|
1759
|
+
fg: blend(baseBg, unmixed.link.fg)
|
|
1644
1760
|
},
|
|
1645
1761
|
code: {
|
|
1646
|
-
bg: blend(baseBg, code.bg),
|
|
1647
|
-
fg: blend(baseBg, code.fg)
|
|
1762
|
+
bg: blend(baseBg, unmixed.code.bg),
|
|
1763
|
+
fg: blend(baseBg, unmixed.code.fg)
|
|
1648
1764
|
}
|
|
1649
1765
|
};
|
|
1650
1766
|
}
|
|
@@ -1679,21 +1795,17 @@ function renderColorValue(colorPalette, bg, blendMode, str) {
|
|
|
1679
1795
|
function renderColorHex(color) {
|
|
1680
1796
|
return typeof color === "string" ? color : color.hex;
|
|
1681
1797
|
}
|
|
1682
|
-
const defaultColorPalette = {
|
|
1683
|
-
...color$1,
|
|
1684
|
-
black: "#000000"
|
|
1685
|
-
};
|
|
1686
1798
|
function buildTheme(config) {
|
|
1687
|
-
|
|
1799
|
+
const color = {
|
|
1800
|
+
light: buildColorTheme({
|
|
1801
|
+
scheme: "light"
|
|
1802
|
+
}, config),
|
|
1803
|
+
dark: buildColorTheme({
|
|
1804
|
+
scheme: "dark"
|
|
1805
|
+
}, config)
|
|
1806
|
+
};
|
|
1688
1807
|
return {
|
|
1689
|
-
color: renderColorTheme(
|
|
1690
|
-
light: buildColorTheme({
|
|
1691
|
-
scheme: "light"
|
|
1692
|
-
}, config),
|
|
1693
|
-
dark: buildColorTheme({
|
|
1694
|
-
scheme: "dark"
|
|
1695
|
-
}, config)
|
|
1696
|
-
})
|
|
1808
|
+
color: renderColorTheme(color, config)
|
|
1697
1809
|
};
|
|
1698
1810
|
}
|
|
1699
1811
|
function createButtonTones(opts, base, dark, solid, muted, mode) {
|
|
@@ -8735,12 +8847,13 @@ const DialogCard = forwardRef(function DialogCard2(props, ref) {
|
|
|
8735
8847
|
children: [showHeader && /* @__PURE__ */jsx(DialogHeader, {
|
|
8736
8848
|
$isContentScrollable: isContentScrollable,
|
|
8737
8849
|
$hasScrolledFromTop: hasScrolledFromTop,
|
|
8738
|
-
|
|
8850
|
+
paddingLeft: 4,
|
|
8851
|
+
paddingRight: 3,
|
|
8852
|
+
paddingY: 3,
|
|
8739
8853
|
children: /* @__PURE__ */jsxs(Flex, {
|
|
8740
8854
|
align: "center",
|
|
8741
8855
|
children: [/* @__PURE__ */jsx(Box, {
|
|
8742
8856
|
flex: 1,
|
|
8743
|
-
padding: 3,
|
|
8744
8857
|
children: header && /* @__PURE__ */jsx(Text, {
|
|
8745
8858
|
id: labelId,
|
|
8746
8859
|
size: 1,
|