@sanity/ui 2.0.0-alpha.14 → 2.0.0-alpha.16
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 +256 -142
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +256 -142
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/dialog/dialog.tsx +10 -10
- 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.js
CHANGED
|
@@ -860,7 +860,18 @@ const defaultColorTokens = {
|
|
|
860
860
|
_blend: ["multiply", "screen"],
|
|
861
861
|
bg: ["50", "950"],
|
|
862
862
|
fg: ["800", "200"],
|
|
863
|
-
border: ["200", "800"]
|
|
863
|
+
border: ["200", "800"],
|
|
864
|
+
focusRing: ["cyan/500", "cyan/500"],
|
|
865
|
+
shadow: {
|
|
866
|
+
outline: ["500/0.25", "400/0.3"],
|
|
867
|
+
umbra: ["500/0.1", "black/0.4"],
|
|
868
|
+
penumbra: ["500/0.07", "black/0.28"],
|
|
869
|
+
ambient: ["500/0.06", "black/0.24"]
|
|
870
|
+
},
|
|
871
|
+
skeleton: {
|
|
872
|
+
from: ["100", "900"],
|
|
873
|
+
to: ["100/0.5", "900/0.5"]
|
|
874
|
+
}
|
|
864
875
|
},
|
|
865
876
|
transparent: {
|
|
866
877
|
bg: ["50", "black"],
|
|
@@ -888,7 +899,11 @@ const defaultColorTokens = {
|
|
|
888
899
|
"*": {
|
|
889
900
|
_blend: ["screen", "multiply"],
|
|
890
901
|
bg: ["500", "400"],
|
|
891
|
-
|
|
902
|
+
bg2: ["950", "50"],
|
|
903
|
+
border: ["500/0", "400/0"],
|
|
904
|
+
muted: {
|
|
905
|
+
fg: ["200", "700"]
|
|
906
|
+
}
|
|
892
907
|
},
|
|
893
908
|
hovered: {
|
|
894
909
|
bg: ["600", "300"],
|
|
@@ -902,15 +917,19 @@ const defaultColorTokens = {
|
|
|
902
917
|
},
|
|
903
918
|
disabled: {
|
|
904
919
|
_hue: "gray",
|
|
905
|
-
bg: ["
|
|
920
|
+
bg: ["200", "900"]
|
|
906
921
|
}
|
|
907
922
|
},
|
|
908
923
|
ghost: {
|
|
909
924
|
"*": {
|
|
910
925
|
_blend: ["multiply", "screen"],
|
|
911
926
|
bg: ["white", "black"],
|
|
927
|
+
bg2: ["50", "950"],
|
|
912
928
|
fg: ["600", "400"],
|
|
913
|
-
border: ["200", "800"]
|
|
929
|
+
border: ["200", "800"],
|
|
930
|
+
muted: {
|
|
931
|
+
fg: ["600/0.6", "400/0.6"]
|
|
932
|
+
}
|
|
914
933
|
},
|
|
915
934
|
hovered: {
|
|
916
935
|
bg: ["50", "950"],
|
|
@@ -926,16 +945,20 @@ const defaultColorTokens = {
|
|
|
926
945
|
},
|
|
927
946
|
disabled: {
|
|
928
947
|
_hue: "gray",
|
|
929
|
-
fg: ["
|
|
930
|
-
border: ["100", "
|
|
948
|
+
fg: ["200", "900"],
|
|
949
|
+
border: ["100", "950"]
|
|
931
950
|
}
|
|
932
951
|
},
|
|
933
952
|
bleed: {
|
|
934
953
|
"*": {
|
|
935
954
|
_blend: ["multiply", "screen"],
|
|
936
955
|
bg: ["white", "black"],
|
|
956
|
+
bg2: ["50", "950"],
|
|
937
957
|
fg: ["600", "400"],
|
|
938
|
-
border: ["white/0", "black/0"]
|
|
958
|
+
border: ["white/0", "black/0"],
|
|
959
|
+
muted: {
|
|
960
|
+
fg: ["600/0.6", "400/0.6"]
|
|
961
|
+
}
|
|
939
962
|
},
|
|
940
963
|
hovered: {
|
|
941
964
|
bg: ["50", "950"],
|
|
@@ -951,7 +974,7 @@ const defaultColorTokens = {
|
|
|
951
974
|
},
|
|
952
975
|
disabled: {
|
|
953
976
|
_hue: "gray",
|
|
954
|
-
fg: ["
|
|
977
|
+
fg: ["200", "900"]
|
|
955
978
|
}
|
|
956
979
|
}
|
|
957
980
|
},
|
|
@@ -971,7 +994,7 @@ const defaultColorTokens = {
|
|
|
971
994
|
},
|
|
972
995
|
disabled: {
|
|
973
996
|
_hue: "gray",
|
|
974
|
-
bg: ["
|
|
997
|
+
bg: ["200", "900"]
|
|
975
998
|
}
|
|
976
999
|
}
|
|
977
1000
|
}
|
|
@@ -1323,12 +1346,11 @@ function isColorValue(str) {
|
|
|
1323
1346
|
function isColorOpacityValue(str) {
|
|
1324
1347
|
return str === "0" || /^0\.[0-9]+$/.test(str) || str === "1";
|
|
1325
1348
|
}
|
|
1326
|
-
function resolveColorTokenValue(
|
|
1349
|
+
function resolveColorTokenValue(context, value) {
|
|
1327
1350
|
const {
|
|
1328
1351
|
hue,
|
|
1329
|
-
scheme
|
|
1330
|
-
|
|
1331
|
-
} = options;
|
|
1352
|
+
scheme
|
|
1353
|
+
} = context;
|
|
1332
1354
|
const node = parseTokenValue(value[scheme === "light" ? 0 : 1]);
|
|
1333
1355
|
if (!node || node.type !== "color") {
|
|
1334
1356
|
throw new Error("Invalid color token: ".concat(value[0]));
|
|
@@ -1368,68 +1390,179 @@ function screen$1(bg, fg) {
|
|
|
1368
1390
|
}
|
|
1369
1391
|
return hex;
|
|
1370
1392
|
}
|
|
1393
|
+
function resolveColorTokens(sparseTokens) {
|
|
1394
|
+
const denseTokens = {
|
|
1395
|
+
...sparseTokens
|
|
1396
|
+
};
|
|
1397
|
+
for (const tone of COLOR_BASE_TONES) {
|
|
1398
|
+
denseTokens[tone] = resolveBaseColorTones(sparseTokens, tone);
|
|
1399
|
+
}
|
|
1400
|
+
denseTokens.button = resolveButtonColorTokens(sparseTokens);
|
|
1401
|
+
return denseTokens;
|
|
1402
|
+
}
|
|
1403
|
+
function resolveBaseColorTones(sparseTokens, tone) {
|
|
1404
|
+
const spec0 = sparseTokens == null ? void 0 : sparseTokens[tone];
|
|
1405
|
+
const spec1 = sparseTokens == null ? void 0 : sparseTokens["*"];
|
|
1406
|
+
return {
|
|
1407
|
+
...spec1,
|
|
1408
|
+
...spec0,
|
|
1409
|
+
shadow: {
|
|
1410
|
+
...(spec1 == null ? void 0 : spec1.shadow),
|
|
1411
|
+
...(spec0 == null ? void 0 : spec0.shadow)
|
|
1412
|
+
},
|
|
1413
|
+
skeleton: {
|
|
1414
|
+
...(spec1 == null ? void 0 : spec1.skeleton),
|
|
1415
|
+
...(spec0 == null ? void 0 : spec0.skeleton)
|
|
1416
|
+
}
|
|
1417
|
+
};
|
|
1418
|
+
}
|
|
1419
|
+
function resolveButtonColorTokens(sparseTokens) {
|
|
1420
|
+
const tokens = {};
|
|
1421
|
+
for (const tone of COLOR_STATE_TONES) {
|
|
1422
|
+
tokens[tone] = resolveButtonToneColorTokens(sparseTokens, tone);
|
|
1423
|
+
}
|
|
1424
|
+
return tokens;
|
|
1425
|
+
}
|
|
1426
|
+
function resolveButtonToneColorTokens(sparseTokens, tone) {
|
|
1427
|
+
var _a, _b;
|
|
1428
|
+
const tokens = {
|
|
1429
|
+
...((_a = sparseTokens.button) == null ? void 0 : _a[tone]),
|
|
1430
|
+
...((_b = sparseTokens.button) == null ? void 0 : _b["*"])
|
|
1431
|
+
};
|
|
1432
|
+
for (const mode of COLOR_BUTTON_MODES) {
|
|
1433
|
+
tokens[mode] = resolveButtonModeColorTokens(sparseTokens, tone, mode);
|
|
1434
|
+
}
|
|
1435
|
+
return tokens;
|
|
1436
|
+
}
|
|
1437
|
+
function resolveButtonModeColorTokens(sparseTokens, tone, mode) {
|
|
1438
|
+
var _a, _b, _c, _d;
|
|
1439
|
+
const spec0 = (_b = (_a = sparseTokens.button) == null ? void 0 : _a[tone]) == null ? void 0 : _b[mode];
|
|
1440
|
+
const spec1 = (_d = (_c = sparseTokens.button) == null ? void 0 : _c["*"]) == null ? void 0 : _d[mode];
|
|
1441
|
+
const tokens = {
|
|
1442
|
+
...spec1,
|
|
1443
|
+
...spec0
|
|
1444
|
+
};
|
|
1445
|
+
for (const state of COLOR_STATES) {
|
|
1446
|
+
tokens[state] = resolveButtonStateColorTokens(sparseTokens, tone, mode, state);
|
|
1447
|
+
}
|
|
1448
|
+
return tokens;
|
|
1449
|
+
}
|
|
1450
|
+
function resolveButtonStateColorTokens(tokens, tone, mode, state) {
|
|
1451
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
1452
|
+
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];
|
|
1453
|
+
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["*"];
|
|
1454
|
+
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];
|
|
1455
|
+
const spec3 = (_l = (_k = (_j = tokens == null ? void 0 : tokens.button) == null ? void 0 : _j["*"]) == null ? void 0 : _k[mode]) == null ? void 0 : _l["*"];
|
|
1456
|
+
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);
|
|
1457
|
+
return {
|
|
1458
|
+
...spec3,
|
|
1459
|
+
...spec2,
|
|
1460
|
+
...spec1,
|
|
1461
|
+
...spec0,
|
|
1462
|
+
_hue: hue,
|
|
1463
|
+
muted: {
|
|
1464
|
+
...(spec3 == null ? void 0 : spec3.muted),
|
|
1465
|
+
...(spec2 == null ? void 0 : spec2.muted),
|
|
1466
|
+
...(spec1 == null ? void 0 : spec1.muted),
|
|
1467
|
+
...(spec0 == null ? void 0 : spec0.muted)
|
|
1468
|
+
},
|
|
1469
|
+
accent: {
|
|
1470
|
+
...(spec3 == null ? void 0 : spec3.accent),
|
|
1471
|
+
...(spec2 == null ? void 0 : spec2.accent),
|
|
1472
|
+
...(spec1 == null ? void 0 : spec1.accent),
|
|
1473
|
+
...(spec0 == null ? void 0 : spec0.accent)
|
|
1474
|
+
},
|
|
1475
|
+
link: {
|
|
1476
|
+
...(spec3 == null ? void 0 : spec3.link),
|
|
1477
|
+
...(spec2 == null ? void 0 : spec2.link),
|
|
1478
|
+
...(spec1 == null ? void 0 : spec1.link),
|
|
1479
|
+
...(spec0 == null ? void 0 : spec0.link)
|
|
1480
|
+
},
|
|
1481
|
+
code: {
|
|
1482
|
+
...(spec3 == null ? void 0 : spec3.code),
|
|
1483
|
+
...(spec2 == null ? void 0 : spec2.code),
|
|
1484
|
+
...(spec1 == null ? void 0 : spec1.code),
|
|
1485
|
+
...(spec0 == null ? void 0 : spec0.code)
|
|
1486
|
+
},
|
|
1487
|
+
skeleton: {
|
|
1488
|
+
...(spec3 == null ? void 0 : spec3.skeleton),
|
|
1489
|
+
...(spec2 == null ? void 0 : spec2.skeleton),
|
|
1490
|
+
...(spec1 == null ? void 0 : spec1.skeleton),
|
|
1491
|
+
...(spec0 == null ? void 0 : spec0.skeleton)
|
|
1492
|
+
}
|
|
1493
|
+
};
|
|
1494
|
+
}
|
|
1371
1495
|
function buildColorTheme(options, config) {
|
|
1496
|
+
var _a, _b;
|
|
1372
1497
|
const {
|
|
1373
1498
|
scheme
|
|
1374
1499
|
} = options;
|
|
1500
|
+
const resolvedConfig = {
|
|
1501
|
+
...config,
|
|
1502
|
+
color: {
|
|
1503
|
+
...(config == null ? void 0 : config.color),
|
|
1504
|
+
tokens: resolveColorTokens((_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.tokens) != null ? _b : defaultColorTokens)
|
|
1505
|
+
}
|
|
1506
|
+
};
|
|
1375
1507
|
return {
|
|
1376
1508
|
transparent: buildBaseColorTheme({
|
|
1377
1509
|
scheme,
|
|
1378
1510
|
tone: "transparent"
|
|
1379
|
-
},
|
|
1511
|
+
}, resolvedConfig),
|
|
1380
1512
|
default: buildBaseColorTheme({
|
|
1381
1513
|
scheme,
|
|
1382
1514
|
tone: "default"
|
|
1383
|
-
},
|
|
1515
|
+
}, resolvedConfig),
|
|
1384
1516
|
primary: buildBaseColorTheme({
|
|
1385
1517
|
scheme,
|
|
1386
1518
|
tone: "primary"
|
|
1387
|
-
},
|
|
1519
|
+
}, resolvedConfig),
|
|
1388
1520
|
positive: buildBaseColorTheme({
|
|
1389
1521
|
scheme,
|
|
1390
1522
|
tone: "positive"
|
|
1391
|
-
},
|
|
1523
|
+
}, resolvedConfig),
|
|
1392
1524
|
caution: buildBaseColorTheme({
|
|
1393
1525
|
scheme,
|
|
1394
1526
|
tone: "caution"
|
|
1395
|
-
},
|
|
1527
|
+
}, resolvedConfig),
|
|
1396
1528
|
critical: buildBaseColorTheme({
|
|
1397
1529
|
scheme,
|
|
1398
1530
|
tone: "critical"
|
|
1399
|
-
},
|
|
1531
|
+
}, resolvedConfig)
|
|
1400
1532
|
};
|
|
1401
1533
|
}
|
|
1402
1534
|
function buildBaseColorTheme(options, config) {
|
|
1403
|
-
var _a, _b;
|
|
1535
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1404
1536
|
const {
|
|
1405
1537
|
scheme,
|
|
1406
1538
|
tone
|
|
1407
1539
|
} = options;
|
|
1408
|
-
const tokens = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.tokens)
|
|
1409
|
-
const
|
|
1410
|
-
const
|
|
1411
|
-
const hue = (toneTokens == null ? void 0 : toneTokens._hue) || (any == null ? void 0 : any._hue) || "gray";
|
|
1412
|
-
const bg = resolveColorTokenValue({
|
|
1540
|
+
const tokens = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.tokens) == null ? void 0 : _b[tone];
|
|
1541
|
+
const hue = (tokens == null ? void 0 : tokens._hue) || "gray";
|
|
1542
|
+
const context = {
|
|
1413
1543
|
hue,
|
|
1414
|
-
scheme
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
const
|
|
1544
|
+
scheme
|
|
1545
|
+
};
|
|
1546
|
+
const bg = resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.bg) || ["gray/50", "black"]);
|
|
1547
|
+
const blendMode = (tokens == null ? void 0 : tokens._blend) || ["screen", "multiply"];
|
|
1418
1548
|
return {
|
|
1419
|
-
_blend:
|
|
1549
|
+
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
1420
1550
|
dark: scheme === "dark",
|
|
1421
1551
|
base: {
|
|
1422
1552
|
bg,
|
|
1423
|
-
fg: resolveColorTokenValue(
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1553
|
+
fg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.fg) || ["black", "white"]),
|
|
1554
|
+
border: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.border) || ["black", "white"]),
|
|
1555
|
+
focusRing: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.focusRing) || ["black", "white"]),
|
|
1556
|
+
shadow: {
|
|
1557
|
+
outline: resolveColorTokenValue(context, ((_c = tokens == null ? void 0 : tokens.shadow) == null ? void 0 : _c.outline) || ["500/0.2", "500/0.2"]),
|
|
1558
|
+
umbra: resolveColorTokenValue(context, ((_d = tokens == null ? void 0 : tokens.shadow) == null ? void 0 : _d.umbra) || ["500/0.2", "500/0.2"]),
|
|
1559
|
+
penumbra: resolveColorTokenValue(context, ((_e = tokens == null ? void 0 : tokens.shadow) == null ? void 0 : _e.penumbra) || ["500/0.2", "500/0.2"]),
|
|
1560
|
+
ambient: resolveColorTokenValue(context, ((_f = tokens == null ? void 0 : tokens.shadow) == null ? void 0 : _f.ambient) || ["500/0.2", "500/0.2"])
|
|
1561
|
+
},
|
|
1562
|
+
skeleton: {
|
|
1563
|
+
from: resolveColorTokenValue(context, ((_g = tokens == null ? void 0 : tokens.skeleton) == null ? void 0 : _g.from) || ["500/0.2", "500/0.2"]),
|
|
1564
|
+
to: resolveColorTokenValue(context, ((_h = tokens == null ? void 0 : tokens.skeleton) == null ? void 0 : _h.to) || ["500/0.2", "500/0.2"])
|
|
1565
|
+
}
|
|
1433
1566
|
},
|
|
1434
1567
|
button: buildButtonColorTheme({
|
|
1435
1568
|
scheme
|
|
@@ -1485,78 +1618,48 @@ function buildButtonModeColorTheme(options, config) {
|
|
|
1485
1618
|
return Object.assign({}, ...states);
|
|
1486
1619
|
}
|
|
1487
1620
|
function buildButtonStateColorTheme(options, config) {
|
|
1488
|
-
var _a, _b, _c, _d, _e
|
|
1621
|
+
var _a, _b, _c, _d, _e;
|
|
1489
1622
|
const {
|
|
1490
1623
|
mode,
|
|
1491
1624
|
tone,
|
|
1492
1625
|
scheme,
|
|
1493
1626
|
state
|
|
1494
1627
|
} = options;
|
|
1495
|
-
const tokens = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.tokens)
|
|
1496
|
-
const hue = (
|
|
1497
|
-
const
|
|
1498
|
-
const
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1628
|
+
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];
|
|
1629
|
+
const hue = (tokens == null ? void 0 : tokens._hue) || "gray";
|
|
1630
|
+
const blendMode = (tokens == null ? void 0 : tokens._blend) || ["screen", "multiply"];
|
|
1631
|
+
const context = {
|
|
1632
|
+
hue,
|
|
1633
|
+
scheme
|
|
1634
|
+
};
|
|
1502
1635
|
return {
|
|
1503
|
-
_blend:
|
|
1504
|
-
bg: resolveColorTokenValue(
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
}),
|
|
1509
|
-
bg2: resolveColorTokenValue({
|
|
1510
|
-
hue,
|
|
1511
|
-
scheme,
|
|
1512
|
-
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"]
|
|
1513
|
-
}),
|
|
1514
|
-
fg: resolveColorTokenValue({
|
|
1515
|
-
hue,
|
|
1516
|
-
scheme,
|
|
1517
|
-
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"]
|
|
1518
|
-
}),
|
|
1519
|
-
border: resolveColorTokenValue({
|
|
1520
|
-
hue,
|
|
1521
|
-
scheme,
|
|
1522
|
-
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"]
|
|
1523
|
-
}),
|
|
1636
|
+
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
1637
|
+
bg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.bg) || ["500", "400"]),
|
|
1638
|
+
bg2: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.bg2) || ["500", "400"]),
|
|
1639
|
+
fg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.fg) || ["white", "black"]),
|
|
1640
|
+
border: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.border) || ["500", "400"]),
|
|
1524
1641
|
muted: {
|
|
1525
|
-
fg: resolveColorTokenValue(
|
|
1526
|
-
hue,
|
|
1527
|
-
scheme,
|
|
1528
|
-
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"]
|
|
1529
|
-
})
|
|
1642
|
+
fg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.fg) || ["500", "400"])
|
|
1530
1643
|
},
|
|
1531
1644
|
accent: {
|
|
1532
|
-
fg: resolveColorTokenValue(
|
|
1533
|
-
hue,
|
|
1534
|
-
scheme,
|
|
1535
|
-
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"]
|
|
1536
|
-
})
|
|
1645
|
+
fg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.fg) || ["500", "400"])
|
|
1537
1646
|
},
|
|
1538
1647
|
link: {
|
|
1539
|
-
fg: resolveColorTokenValue(
|
|
1540
|
-
hue,
|
|
1541
|
-
scheme,
|
|
1542
|
-
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"]
|
|
1543
|
-
})
|
|
1648
|
+
fg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.fg) || ["500", "400"])
|
|
1544
1649
|
},
|
|
1545
1650
|
code: {
|
|
1546
|
-
bg: resolveColorTokenValue(
|
|
1547
|
-
|
|
1548
|
-
scheme,
|
|
1549
|
-
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"]
|
|
1550
|
-
}),
|
|
1551
|
-
fg: resolveColorTokenValue({
|
|
1552
|
-
hue,
|
|
1553
|
-
scheme,
|
|
1554
|
-
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"]
|
|
1555
|
-
})
|
|
1651
|
+
bg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.bg) || ["500", "400"]),
|
|
1652
|
+
fg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.fg) || ["500", "400"])
|
|
1556
1653
|
}
|
|
1557
1654
|
};
|
|
1558
1655
|
}
|
|
1559
|
-
|
|
1656
|
+
const defaultColorPalette = {
|
|
1657
|
+
...color$1.color,
|
|
1658
|
+
black: "#000000"
|
|
1659
|
+
};
|
|
1660
|
+
function renderColorTheme(value, config) {
|
|
1661
|
+
var _a, _b;
|
|
1662
|
+
const colorPalette = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.palette) != null ? _b : defaultColorPalette;
|
|
1560
1663
|
return {
|
|
1561
1664
|
light: renderColorScheme(colorPalette, value.light),
|
|
1562
1665
|
dark: renderColorScheme(colorPalette, value.dark)
|
|
@@ -1590,7 +1693,18 @@ function renderColorBase(colorPalette, value, bg) {
|
|
|
1590
1693
|
base: {
|
|
1591
1694
|
bg: nestedBg,
|
|
1592
1695
|
fg: renderColorValue(colorPalette, nestedBg, value._blend, value.base.fg),
|
|
1593
|
-
border: renderColorValue(colorPalette, nestedBg, value._blend, value.base.border)
|
|
1696
|
+
border: renderColorValue(colorPalette, nestedBg, value._blend, value.base.border),
|
|
1697
|
+
focusRing: renderColorValue(colorPalette, nestedBg, value._blend, value.base.focusRing),
|
|
1698
|
+
shadow: {
|
|
1699
|
+
outline: renderColorValue(colorPalette, nestedBg, value._blend, value.base.shadow.outline),
|
|
1700
|
+
umbra: renderColorValue(colorPalette, nestedBg, value._blend, value.base.shadow.umbra),
|
|
1701
|
+
penumbra: renderColorValue(colorPalette, nestedBg, value._blend, value.base.shadow.penumbra),
|
|
1702
|
+
ambient: renderColorValue(colorPalette, nestedBg, value._blend, value.base.shadow.ambient)
|
|
1703
|
+
},
|
|
1704
|
+
skeleton: {
|
|
1705
|
+
from: renderColorValue(colorPalette, nestedBg, value._blend, value.base.skeleton.from),
|
|
1706
|
+
to: renderColorValue(colorPalette, nestedBg, value._blend, value.base.skeleton.to)
|
|
1707
|
+
}
|
|
1594
1708
|
},
|
|
1595
1709
|
button: renderButtonColorTheme(colorPalette, nestedBg, value._blend, value.button)
|
|
1596
1710
|
};
|
|
@@ -1623,41 +1737,43 @@ function renderStatesColorTheme(colorPalette, bg, baseBlendMode, value) {
|
|
|
1623
1737
|
function renderStateColorTheme(colorPalette, baseBg, rootBlendMode, value) {
|
|
1624
1738
|
const blendMode = value._blend;
|
|
1625
1739
|
const bg = rootBlendMode === "multiply" && value.bg === "white" ? "#ffffff" : rootBlendMode === "screen" && value.bg === "black" ? "#000000" : renderColorValue(colorPalette, rootBlendMode === "multiply" ? "#ffffff" : "#000000", rootBlendMode, value.bg);
|
|
1626
|
-
const bg2 = renderColorValue(colorPalette, bg, blendMode, value.bg2 || value.bg);
|
|
1627
|
-
const fg = renderColorValue(colorPalette, bg, blendMode, value.fg);
|
|
1628
|
-
const border = renderColorValue(colorPalette, bg, blendMode, value.border);
|
|
1629
|
-
const muted = {
|
|
1630
|
-
fg: renderColorValue(colorPalette, bg, blendMode, value.muted.fg)
|
|
1631
|
-
};
|
|
1632
|
-
const accent = {
|
|
1633
|
-
fg: renderColorValue(colorPalette, bg, blendMode, value.accent.fg)
|
|
1634
|
-
};
|
|
1635
|
-
const link = {
|
|
1636
|
-
fg: renderColorValue(colorPalette, bg, blendMode, value.link.fg)
|
|
1637
|
-
};
|
|
1638
|
-
const code = {
|
|
1639
|
-
bg: renderColorValue(colorPalette, bg, blendMode, value.code.bg),
|
|
1640
|
-
fg: renderColorValue(colorPalette, bg, blendMode, value.code.fg)
|
|
1641
|
-
};
|
|
1642
1740
|
const blend = rootBlendMode === "multiply" ? multiply$1 : screen$1;
|
|
1741
|
+
const unmixed = {
|
|
1742
|
+
bg2: renderColorValue(colorPalette, bg, blendMode, value.bg2 || value.bg),
|
|
1743
|
+
fg: renderColorValue(colorPalette, bg, blendMode, value.fg),
|
|
1744
|
+
border: renderColorValue(colorPalette, bg, blendMode, value.border),
|
|
1745
|
+
muted: {
|
|
1746
|
+
fg: renderColorValue(colorPalette, bg, blendMode, value.muted.fg)
|
|
1747
|
+
},
|
|
1748
|
+
accent: {
|
|
1749
|
+
fg: renderColorValue(colorPalette, bg, blendMode, value.accent.fg)
|
|
1750
|
+
},
|
|
1751
|
+
link: {
|
|
1752
|
+
fg: renderColorValue(colorPalette, bg, blendMode, value.link.fg)
|
|
1753
|
+
},
|
|
1754
|
+
code: {
|
|
1755
|
+
bg: renderColorValue(colorPalette, bg, blendMode, value.code.bg),
|
|
1756
|
+
fg: renderColorValue(colorPalette, bg, blendMode, value.code.fg)
|
|
1757
|
+
}
|
|
1758
|
+
};
|
|
1643
1759
|
return {
|
|
1644
1760
|
_blend: blendMode,
|
|
1645
1761
|
bg: blend(baseBg, bg),
|
|
1646
|
-
bg2: blend(baseBg, bg2),
|
|
1647
|
-
fg: blend(baseBg, fg),
|
|
1648
|
-
border: blend(baseBg, border),
|
|
1762
|
+
bg2: blend(baseBg, unmixed.bg2),
|
|
1763
|
+
fg: blend(baseBg, unmixed.fg),
|
|
1764
|
+
border: blend(baseBg, unmixed.border),
|
|
1649
1765
|
muted: {
|
|
1650
|
-
fg: blend(baseBg, muted.fg)
|
|
1766
|
+
fg: blend(baseBg, unmixed.muted.fg)
|
|
1651
1767
|
},
|
|
1652
1768
|
accent: {
|
|
1653
|
-
fg: blend(baseBg, accent.fg)
|
|
1769
|
+
fg: blend(baseBg, unmixed.accent.fg)
|
|
1654
1770
|
},
|
|
1655
1771
|
link: {
|
|
1656
|
-
fg: blend(baseBg, link.fg)
|
|
1772
|
+
fg: blend(baseBg, unmixed.link.fg)
|
|
1657
1773
|
},
|
|
1658
1774
|
code: {
|
|
1659
|
-
bg: blend(baseBg, code.bg),
|
|
1660
|
-
fg: blend(baseBg, code.fg)
|
|
1775
|
+
bg: blend(baseBg, unmixed.code.bg),
|
|
1776
|
+
fg: blend(baseBg, unmixed.code.fg)
|
|
1661
1777
|
}
|
|
1662
1778
|
};
|
|
1663
1779
|
}
|
|
@@ -1692,21 +1808,17 @@ function renderColorValue(colorPalette, bg, blendMode, str) {
|
|
|
1692
1808
|
function renderColorHex(color) {
|
|
1693
1809
|
return typeof color === "string" ? color : color.hex;
|
|
1694
1810
|
}
|
|
1695
|
-
const defaultColorPalette = {
|
|
1696
|
-
...color$1.color,
|
|
1697
|
-
black: "#000000"
|
|
1698
|
-
};
|
|
1699
1811
|
function buildTheme(config) {
|
|
1700
|
-
|
|
1812
|
+
const color = {
|
|
1813
|
+
light: buildColorTheme({
|
|
1814
|
+
scheme: "light"
|
|
1815
|
+
}, config),
|
|
1816
|
+
dark: buildColorTheme({
|
|
1817
|
+
scheme: "dark"
|
|
1818
|
+
}, config)
|
|
1819
|
+
};
|
|
1701
1820
|
return {
|
|
1702
|
-
color: renderColorTheme(
|
|
1703
|
-
light: buildColorTheme({
|
|
1704
|
-
scheme: "light"
|
|
1705
|
-
}, config),
|
|
1706
|
-
dark: buildColorTheme({
|
|
1707
|
-
scheme: "dark"
|
|
1708
|
-
}, config)
|
|
1709
|
-
})
|
|
1821
|
+
color: renderColorTheme(color, config)
|
|
1710
1822
|
};
|
|
1711
1823
|
}
|
|
1712
1824
|
function createButtonTones(opts, base, dark, solid, muted, mode) {
|
|
@@ -8748,25 +8860,27 @@ const DialogCard = react.forwardRef(function DialogCard2(props, ref) {
|
|
|
8748
8860
|
children: [showHeader && /* @__PURE__ */jsxRuntime.jsx(DialogHeader, {
|
|
8749
8861
|
$isContentScrollable: isContentScrollable,
|
|
8750
8862
|
$hasScrolledFromTop: hasScrolledFromTop,
|
|
8751
|
-
padding: 3,
|
|
8752
8863
|
children: /* @__PURE__ */jsxRuntime.jsxs(Flex, {
|
|
8753
8864
|
align: "center",
|
|
8754
8865
|
children: [/* @__PURE__ */jsxRuntime.jsx(Box, {
|
|
8755
8866
|
flex: 1,
|
|
8756
|
-
|
|
8867
|
+
margin: 1,
|
|
8868
|
+
padding: 4,
|
|
8757
8869
|
children: header && /* @__PURE__ */jsxRuntime.jsx(Text, {
|
|
8758
8870
|
id: labelId,
|
|
8759
8871
|
size: 1,
|
|
8760
8872
|
weight: "medium",
|
|
8761
8873
|
children: header
|
|
8762
8874
|
})
|
|
8763
|
-
}), showCloseButton && /* @__PURE__ */jsxRuntime.jsx(
|
|
8764
|
-
|
|
8765
|
-
|
|
8766
|
-
|
|
8767
|
-
|
|
8768
|
-
|
|
8769
|
-
|
|
8875
|
+
}), showCloseButton && /* @__PURE__ */jsxRuntime.jsx(Box, {
|
|
8876
|
+
padding: 3,
|
|
8877
|
+
children: /* @__PURE__ */jsxRuntime.jsx(Button, {
|
|
8878
|
+
"aria-label": "Close dialog",
|
|
8879
|
+
disabled: !onClose,
|
|
8880
|
+
icon: icons.CloseIcon,
|
|
8881
|
+
mode: "bleed",
|
|
8882
|
+
onClick: onClose
|
|
8883
|
+
})
|
|
8770
8884
|
})]
|
|
8771
8885
|
})
|
|
8772
8886
|
}), /* @__PURE__ */jsxRuntime.jsx(DialogContent, {
|