@sanity/ui 2.0.0-alpha.12 → 2.0.0-alpha.14

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.
Files changed (36) hide show
  1. package/dist/index.cjs.mjs +27 -0
  2. package/dist/index.d.ts +348 -8
  3. package/dist/index.esm.js +759 -67
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/index.js +786 -67
  6. package/dist/index.js.map +1 -1
  7. package/package.json +2 -2
  8. package/src/components/tab/tab.tsx +4 -1
  9. package/src/primitives/button/button.tsx +7 -3
  10. package/src/primitives/button/styles.ts +8 -2
  11. package/src/theme/_internal/__workshop__/build/story.tsx +178 -0
  12. package/src/theme/_internal/__workshop__/build/theme.ts +3 -0
  13. package/src/theme/_internal/__workshop__/index.ts +14 -0
  14. package/src/theme/_internal/build/buildTheme.test.ts +78 -0
  15. package/src/theme/_internal/build/buildTheme.ts +15 -0
  16. package/src/theme/_internal/build/colorTheme/buildColorTheme.test.ts +185 -0
  17. package/src/theme/_internal/build/colorTheme/buildColorTheme.ts +222 -0
  18. package/src/theme/_internal/build/colorTheme/renderColorTheme.ts +226 -0
  19. package/src/theme/_internal/build/defaults/colorPalette.ts +8 -0
  20. package/src/theme/_internal/build/defaults/colorTokens.ts +124 -0
  21. package/src/theme/_internal/build/helpers.ts +64 -0
  22. package/src/theme/_internal/build/index.ts +1 -0
  23. package/src/theme/_internal/config/helpers.ts +47 -0
  24. package/src/theme/_internal/config/index.ts +3 -0
  25. package/src/theme/_internal/config/token/index.ts +2 -0
  26. package/src/theme/_internal/config/token/parseTokenKey.test.ts +72 -0
  27. package/src/theme/_internal/config/token/parseTokenKey.ts +88 -0
  28. package/src/theme/_internal/config/token/parseTokenValue.test.ts +45 -0
  29. package/src/theme/_internal/config/token/parseTokenValue.ts +123 -0
  30. package/src/theme/_internal/config/types.ts +126 -0
  31. package/src/theme/_internal/constants.ts +48 -0
  32. package/src/theme/_internal/helpers.ts +19 -0
  33. package/src/theme/_internal/index.ts +5 -0
  34. package/src/theme/_internal/types.ts +72 -0
  35. package/src/theme/index.ts +1 -0
  36. package/src/types/button.ts +5 -0
package/dist/index.js CHANGED
@@ -844,10 +844,143 @@ function useGlobalKeyDown(onKeyDown) {
844
844
  return () => removeEventListener("keydown", onKeyDown);
845
845
  }, [onKeyDown]);
846
846
  }
847
+ const COLOR_HUES = ["gray", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow", "green"];
848
+ const COLOR_TINTS = ["50", "100", "200", "300", "400", "500", "600", "700", "800", "900", "950"];
849
+ const COLOR_BASE_TONES = ["transparent", "default", "primary",
850
+ // todo: rename to `accent`
851
+ "positive", "caution", "critical"];
852
+ const COLOR_STATE_TONES = ["default", "primary",
853
+ // todo: rename to `accent`
854
+ "positive", "caution", "critical"];
855
+ const COLOR_STATES = ["enabled", "hovered", "pressed", "selected", "disabled"];
856
+ const COLOR_BUTTON_MODES = ["default", "ghost", "bleed"];
857
+ const COLOR_BLEND_MODES = ["multiply", "screen"];
858
+ const defaultColorTokens = {
859
+ "*": {
860
+ _blend: ["multiply", "screen"],
861
+ bg: ["50", "950"],
862
+ fg: ["800", "200"],
863
+ border: ["200", "800"]
864
+ },
865
+ transparent: {
866
+ bg: ["50", "black"],
867
+ fg: ["600", "400"]
868
+ },
869
+ default: {
870
+ bg: ["white", "950"],
871
+ fg: ["black", "200"]
872
+ },
873
+ primary: {
874
+ _hue: "cyan"
875
+ },
876
+ positive: {
877
+ _hue: "cyan"
878
+ },
879
+ caution: {
880
+ _hue: "yellow"
881
+ },
882
+ critical: {
883
+ _hue: "red"
884
+ },
885
+ button: {
886
+ "*": {
887
+ default: {
888
+ "*": {
889
+ _blend: ["screen", "multiply"],
890
+ bg: ["500", "400"],
891
+ border: ["500/0", "400/0"]
892
+ },
893
+ hovered: {
894
+ bg: ["600", "300"],
895
+ border: ["600/0", "300/0"]
896
+ },
897
+ pressed: {
898
+ bg: ["700", "200"]
899
+ },
900
+ selected: {
901
+ bg: ["700", "200"]
902
+ },
903
+ disabled: {
904
+ _hue: "gray",
905
+ bg: ["100", "900"]
906
+ }
907
+ },
908
+ ghost: {
909
+ "*": {
910
+ _blend: ["multiply", "screen"],
911
+ bg: ["white", "black"],
912
+ fg: ["600", "400"],
913
+ border: ["200", "800"]
914
+ },
915
+ hovered: {
916
+ bg: ["50", "950"],
917
+ fg: ["700", "300"]
918
+ },
919
+ pressed: {
920
+ bg: ["100", "900"],
921
+ fg: ["800", "200"]
922
+ },
923
+ selected: {
924
+ bg: ["100", "900"],
925
+ fg: ["800", "200"]
926
+ },
927
+ disabled: {
928
+ _hue: "gray",
929
+ fg: ["100", "900"],
930
+ border: ["100", "900"]
931
+ }
932
+ },
933
+ bleed: {
934
+ "*": {
935
+ _blend: ["multiply", "screen"],
936
+ bg: ["white", "black"],
937
+ fg: ["600", "400"],
938
+ border: ["white/0", "black/0"]
939
+ },
940
+ hovered: {
941
+ bg: ["50", "950"],
942
+ fg: ["700", "300"]
943
+ },
944
+ pressed: {
945
+ bg: ["100", "900"],
946
+ fg: ["800", "200"]
947
+ },
948
+ selected: {
949
+ bg: ["100", "900"],
950
+ fg: ["800", "200"]
951
+ },
952
+ disabled: {
953
+ _hue: "gray",
954
+ fg: ["100", "900"]
955
+ }
956
+ }
957
+ },
958
+ default: {
959
+ default: {
960
+ "*": {
961
+ bg: ["900", "200"]
962
+ },
963
+ hovered: {
964
+ bg: ["black", "100"]
965
+ },
966
+ pressed: {
967
+ bg: ["900", "200"]
968
+ },
969
+ selected: {
970
+ bg: ["black", "200"]
971
+ },
972
+ disabled: {
973
+ _hue: "gray",
974
+ bg: ["100", "900"]
975
+ }
976
+ }
977
+ }
978
+ }
979
+ };
847
980
  function multiplyChannel(b, s) {
848
981
  return b * s;
849
982
  }
850
- function multiply$1(b, s) {
983
+ function multiply$2(b, s) {
851
984
  return {
852
985
  r: Math.round(clamp$1(multiplyChannel(b.r / 255, s.r / 255) * 255)),
853
986
  g: Math.round(clamp$1(multiplyChannel(b.g / 255, s.g / 255) * 255)),
@@ -860,7 +993,7 @@ function clamp$1(num) {
860
993
  function screenChannel(b, s) {
861
994
  return b + s - b * s;
862
995
  }
863
- function screen$1(b, s) {
996
+ function screen$2(b, s) {
864
997
  return {
865
998
  r: Math.round(clamp(screenChannel(b.r / 255, s.r / 255) * 255)),
866
999
  g: Math.round(clamp(screenChannel(b.g / 255, s.g / 255) * 255)),
@@ -1022,6 +1155,560 @@ function rgba(color, a) {
1022
1155
  const rgb = parseColor(color);
1023
1156
  return "rgba(".concat(rgb.r, ",").concat(rgb.g, ",").concat(rgb.b, ",").concat(a, ")");
1024
1157
  }
1158
+ function isColorBlendModeValue(str) {
1159
+ return COLOR_BLEND_MODES.includes(str);
1160
+ }
1161
+ function isColorHueValue(str) {
1162
+ return COLOR_HUES.includes(str);
1163
+ }
1164
+ function isColorTintValue(str) {
1165
+ return COLOR_TINTS.includes(str);
1166
+ }
1167
+ function isColorButtonMode(str) {
1168
+ return COLOR_BUTTON_MODES.includes(str);
1169
+ }
1170
+ function parseTokenKey(str) {
1171
+ const segments = str.split("/");
1172
+ const segment0 = segments.shift() || "";
1173
+ if (isColorConfigBaseTone(segment0)) {
1174
+ const key = segments.join("/");
1175
+ if (isColorConfigBaseKey(key)) {
1176
+ return {
1177
+ type: "base",
1178
+ tone: segment0,
1179
+ key
1180
+ };
1181
+ }
1182
+ if (isColorConfigBlendKey(key)) {
1183
+ return {
1184
+ type: "base",
1185
+ tone: segment0,
1186
+ key
1187
+ };
1188
+ }
1189
+ }
1190
+ if (segment0 === "button") {
1191
+ const segment1 = segments.shift() || "";
1192
+ if (isColorConfigStateTone(segment1)) {
1193
+ const segment2 = segments.shift() || "";
1194
+ if (isColorButtonMode(segment2)) {
1195
+ const key = segments.join("/");
1196
+ if (isColorConfigStateKey(key)) {
1197
+ return {
1198
+ type: "button",
1199
+ tone: segment1,
1200
+ mode: segment2,
1201
+ key
1202
+ };
1203
+ }
1204
+ if (isColorConfigBlendKey(key)) {
1205
+ return {
1206
+ type: "button",
1207
+ tone: segment1,
1208
+ mode: segment2,
1209
+ key
1210
+ };
1211
+ }
1212
+ }
1213
+ }
1214
+ }
1215
+ return void 0;
1216
+ }
1217
+ function parseTokenValue(str) {
1218
+ const segments = str.split("/");
1219
+ const segment0 = segments.shift() || "";
1220
+ if (isColorTintValue(segment0)) {
1221
+ const tint = segment0;
1222
+ const segment1 = segments.shift() || "";
1223
+ if (isColorOpacityValue(segment1)) {
1224
+ const opacity = Number(segment1);
1225
+ return {
1226
+ type: "color",
1227
+ tint,
1228
+ opacity
1229
+ };
1230
+ }
1231
+ return {
1232
+ type: "color",
1233
+ tint
1234
+ };
1235
+ }
1236
+ if (isColorValue(segment0)) {
1237
+ const key = segment0;
1238
+ const segment1 = segments.shift() || "";
1239
+ if (isColorOpacityValue(segment1)) {
1240
+ const opacity = Number(segment1);
1241
+ return {
1242
+ type: "color",
1243
+ key,
1244
+ opacity
1245
+ };
1246
+ }
1247
+ return {
1248
+ type: "color",
1249
+ key
1250
+ };
1251
+ }
1252
+ if (isColorHueValue(segment0)) {
1253
+ const hue = segment0;
1254
+ const segment1 = segments.shift() || "";
1255
+ if (isColorTintValue(segment1)) {
1256
+ const tint = segment1;
1257
+ const segment2 = segments.shift() || "";
1258
+ if (isColorOpacityValue(segment2)) {
1259
+ const opacity = Number(segment2);
1260
+ return {
1261
+ type: "color",
1262
+ key: "".concat(hue, "/").concat(tint),
1263
+ hue,
1264
+ tint,
1265
+ opacity
1266
+ };
1267
+ }
1268
+ return {
1269
+ type: "color",
1270
+ key: "".concat(hue, "/").concat(tint),
1271
+ hue,
1272
+ tint
1273
+ };
1274
+ }
1275
+ return {
1276
+ type: "hue",
1277
+ value: "".concat(hue)
1278
+ };
1279
+ }
1280
+ if (isColorOpacityValue(segment0)) {
1281
+ const opacity = Number(segment0);
1282
+ return {
1283
+ type: "color",
1284
+ opacity
1285
+ };
1286
+ }
1287
+ if (isColorBlendModeValue(segment0)) {
1288
+ const value = segment0;
1289
+ return {
1290
+ type: "blendMode",
1291
+ value
1292
+ };
1293
+ }
1294
+ return void 0;
1295
+ }
1296
+ const COLOR_CONFIG_BASE_TONES = ["*", ...COLOR_BASE_TONES];
1297
+ const COLOR_CONFIG_STATE_TONES = ["*", ...COLOR_STATE_TONES];
1298
+ const COLOR_CONFIG_BASE_KEYS = ["_hue", "bg", "fg", "border", "focusRing", "muted/fg", "link/fg", "code/bg", "code/fg", "shadow/outline", "shadow/umbra", "shadow/penumbra", "shadow/ambient", "skeleton/from", "skeleton/to"];
1299
+ const COLOR_CONFIG_STATE_KEYS = ["_hue", "bg", "fg", "border", "focusRing", "muted/fg", "link/fg", "code/bg", "code/fg", "skeleton/from", "skeleton/to"];
1300
+ const COLOR_CONFIG_BLEND_KEYS = ["_blend"];
1301
+ function isColorConfigBaseTone(str) {
1302
+ return COLOR_CONFIG_BASE_TONES.includes(str);
1303
+ }
1304
+ function isColorConfigBaseKey(str) {
1305
+ return COLOR_CONFIG_BASE_KEYS.includes(str);
1306
+ }
1307
+ function isColorConfigStateKey(str) {
1308
+ return COLOR_CONFIG_STATE_KEYS.includes(str);
1309
+ }
1310
+ function isColorConfigStateTone(str) {
1311
+ return COLOR_CONFIG_STATE_TONES.includes(str);
1312
+ }
1313
+ function isColorConfigBlendKey(str) {
1314
+ return COLOR_CONFIG_BLEND_KEYS.includes(str);
1315
+ }
1316
+ function isColorTokenValue(str) {
1317
+ var _a, _b;
1318
+ return ((_a = parseTokenValue(str)) == null ? void 0 : _a.type) === "color" || ((_b = parseTokenValue(str)) == null ? void 0 : _b.type) === "hue";
1319
+ }
1320
+ function isColorValue(str) {
1321
+ return str === "black" || str === "white";
1322
+ }
1323
+ function isColorOpacityValue(str) {
1324
+ return str === "0" || /^0\.[0-9]+$/.test(str) || str === "1";
1325
+ }
1326
+ function resolveColorTokenValue(options) {
1327
+ const {
1328
+ hue,
1329
+ scheme,
1330
+ value
1331
+ } = options;
1332
+ const node = parseTokenValue(value[scheme === "light" ? 0 : 1]);
1333
+ if (!node || node.type !== "color") {
1334
+ throw new Error("Invalid color token: ".concat(value[0]));
1335
+ }
1336
+ return compileColorTokenValue({
1337
+ ...node,
1338
+ hue: node.hue || hue
1339
+ });
1340
+ }
1341
+ function compileColorTokenValue(node) {
1342
+ let key = "";
1343
+ if (node.key === "black" || node.key === "white") {
1344
+ key = node.key;
1345
+ } else {
1346
+ key = "".concat(node.hue, "/").concat(node.tint);
1347
+ }
1348
+ if (node.opacity !== void 0) {
1349
+ key += "/".concat(node.opacity);
1350
+ }
1351
+ return key;
1352
+ }
1353
+ function multiply$1(bg, fg) {
1354
+ const b = parseColor(bg);
1355
+ const s = parseColor(fg);
1356
+ const hex = rgbToHex(multiply$2(b, s));
1357
+ if (s.a !== void 0) {
1358
+ return rgba(hex, s.a);
1359
+ }
1360
+ return hex;
1361
+ }
1362
+ function screen$1(bg, fg) {
1363
+ const b = parseColor(bg);
1364
+ const s = parseColor(fg);
1365
+ const hex = rgbToHex(screen$2(b, s));
1366
+ if (s.a !== void 0) {
1367
+ return rgba(hex, s.a);
1368
+ }
1369
+ return hex;
1370
+ }
1371
+ function buildColorTheme(options, config) {
1372
+ const {
1373
+ scheme
1374
+ } = options;
1375
+ return {
1376
+ transparent: buildBaseColorTheme({
1377
+ scheme,
1378
+ tone: "transparent"
1379
+ }, config),
1380
+ default: buildBaseColorTheme({
1381
+ scheme,
1382
+ tone: "default"
1383
+ }, config),
1384
+ primary: buildBaseColorTheme({
1385
+ scheme,
1386
+ tone: "primary"
1387
+ }, config),
1388
+ positive: buildBaseColorTheme({
1389
+ scheme,
1390
+ tone: "positive"
1391
+ }, config),
1392
+ caution: buildBaseColorTheme({
1393
+ scheme,
1394
+ tone: "caution"
1395
+ }, config),
1396
+ critical: buildBaseColorTheme({
1397
+ scheme,
1398
+ tone: "critical"
1399
+ }, config)
1400
+ };
1401
+ }
1402
+ function buildBaseColorTheme(options, config) {
1403
+ var _a, _b;
1404
+ const {
1405
+ scheme,
1406
+ tone
1407
+ } = options;
1408
+ const tokens = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.tokens) != null ? _b : defaultColorTokens;
1409
+ const any = tokens == null ? void 0 : tokens["*"];
1410
+ const toneTokens = tokens == null ? void 0 : tokens[tone];
1411
+ const hue = (toneTokens == null ? void 0 : toneTokens._hue) || (any == null ? void 0 : any._hue) || "gray";
1412
+ const bg = resolveColorTokenValue({
1413
+ hue,
1414
+ scheme,
1415
+ value: (toneTokens == null ? void 0 : toneTokens.bg) || (any == null ? void 0 : any.bg) || ["gray/50", "black"]
1416
+ });
1417
+ const _blend = (toneTokens == null ? void 0 : toneTokens._blend) || (any == null ? void 0 : any._blend) || ["screen", "multiply"];
1418
+ return {
1419
+ _blend: _blend[scheme === "light" ? 0 : 1],
1420
+ dark: scheme === "dark",
1421
+ base: {
1422
+ bg,
1423
+ fg: resolveColorTokenValue({
1424
+ hue,
1425
+ scheme,
1426
+ value: (toneTokens == null ? void 0 : toneTokens.fg) || (any == null ? void 0 : any.fg) || ["black", "white"]
1427
+ }),
1428
+ border: resolveColorTokenValue({
1429
+ hue,
1430
+ scheme,
1431
+ value: (toneTokens == null ? void 0 : toneTokens.border) || (any == null ? void 0 : any.border) || ["black", "white"]
1432
+ })
1433
+ },
1434
+ button: buildButtonColorTheme({
1435
+ scheme
1436
+ }, config)
1437
+ };
1438
+ }
1439
+ function buildButtonColorTheme(options, config) {
1440
+ const {
1441
+ scheme
1442
+ } = options;
1443
+ const tones = COLOR_STATE_TONES.map(tone => {
1444
+ return {
1445
+ [tone]: buildButtonColorToneTheme({
1446
+ scheme,
1447
+ tone
1448
+ }, config)
1449
+ };
1450
+ });
1451
+ return Object.assign({}, ...tones);
1452
+ }
1453
+ function buildButtonColorToneTheme(options, config) {
1454
+ const {
1455
+ scheme,
1456
+ tone
1457
+ } = options;
1458
+ const modes = COLOR_BUTTON_MODES.map(mode => {
1459
+ return {
1460
+ [mode]: buildButtonModeColorTheme({
1461
+ mode,
1462
+ scheme,
1463
+ tone
1464
+ }, config)
1465
+ };
1466
+ });
1467
+ return Object.assign({}, ...modes);
1468
+ }
1469
+ function buildButtonModeColorTheme(options, config) {
1470
+ const {
1471
+ mode,
1472
+ scheme,
1473
+ tone
1474
+ } = options;
1475
+ const states = COLOR_STATES.map(state => {
1476
+ return {
1477
+ [state]: buildButtonStateColorTheme({
1478
+ mode,
1479
+ tone,
1480
+ scheme,
1481
+ state
1482
+ }, config)
1483
+ };
1484
+ });
1485
+ return Object.assign({}, ...states);
1486
+ }
1487
+ function buildButtonStateColorTheme(options, config) {
1488
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S;
1489
+ const {
1490
+ mode,
1491
+ tone,
1492
+ scheme,
1493
+ state
1494
+ } = options;
1495
+ const tokens = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.tokens) != null ? _b : defaultColorTokens;
1496
+ const hue = ((_f = (_e = (_d = (_c = tokens == null ? void 0 : tokens.button) == null ? void 0 : _c[tone]) == null ? void 0 : _d[mode]) == null ? void 0 : _e[state]) == null ? void 0 : _f._hue) || ((_j = (_i = (_h = (_g = tokens == null ? void 0 : tokens.button) == null ? void 0 : _g["*"]) == null ? void 0 : _h[mode]) == null ? void 0 : _i[state]) == null ? void 0 : _j._hue) || ((_l = (_k = tokens == null ? void 0 : tokens.button) == null ? void 0 : _k[tone]) == null ? void 0 : _l._hue) || ((_m = tokens == null ? void 0 : tokens[tone]) == null ? void 0 : _m._hue) || "gray";
1497
+ const spec3 = (_p = (_o = (_n = tokens == null ? void 0 : tokens.button) == null ? void 0 : _n["*"]) == null ? void 0 : _o[mode]) == null ? void 0 : _p["*"];
1498
+ const spec2 = (_s = (_r = (_q = tokens == null ? void 0 : tokens.button) == null ? void 0 : _q["*"]) == null ? void 0 : _r[mode]) == null ? void 0 : _s[state];
1499
+ const spec1 = (_v = (_u = (_t = tokens == null ? void 0 : tokens.button) == null ? void 0 : _t[tone]) == null ? void 0 : _u[mode]) == null ? void 0 : _v["*"];
1500
+ const spec0 = (_y = (_x = (_w = tokens == null ? void 0 : tokens.button) == null ? void 0 : _w[tone]) == null ? void 0 : _x[mode]) == null ? void 0 : _y[state];
1501
+ const _blend = (spec0 == null ? void 0 : spec0._blend) || (spec1 == null ? void 0 : spec1._blend) || (spec2 == null ? void 0 : spec2._blend) || (spec3 == null ? void 0 : spec3._blend) || ["screen", "multiply"];
1502
+ return {
1503
+ _blend: _blend[scheme === "light" ? 0 : 1],
1504
+ bg: resolveColorTokenValue({
1505
+ hue,
1506
+ scheme,
1507
+ value: (spec0 == null ? void 0 : spec0.bg) || (spec1 == null ? void 0 : spec1.bg) || (spec2 == null ? void 0 : spec2.bg) || (spec3 == null ? void 0 : spec3.bg) || ["500", "400"]
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
+ }),
1524
+ 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
+ })
1530
+ },
1531
+ 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
+ })
1537
+ },
1538
+ 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
+ })
1544
+ },
1545
+ code: {
1546
+ bg: resolveColorTokenValue({
1547
+ hue,
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
+ })
1556
+ }
1557
+ };
1558
+ }
1559
+ function renderColorTheme(colorPalette, value) {
1560
+ return {
1561
+ light: renderColorScheme(colorPalette, value.light),
1562
+ dark: renderColorScheme(colorPalette, value.dark)
1563
+ };
1564
+ }
1565
+ function renderColorScheme(colorPalette, value) {
1566
+ const toneEntries = Object.entries(value);
1567
+ const [, transparentTone] = toneEntries.find(_ref4 => {
1568
+ let [k] = _ref4;
1569
+ return k === "transparent";
1570
+ });
1571
+ const [, defaultTone] = toneEntries.find(_ref5 => {
1572
+ let [k] = _ref5;
1573
+ return k === "default";
1574
+ });
1575
+ const renderedTransparentTone = renderColorBase(colorPalette, transparentTone, transparentTone._blend === "multiply" ? "#ffffff" : "#000000");
1576
+ const renderedDefaultTone = renderColorBase(colorPalette, defaultTone, defaultTone._blend === "multiply" ? "#ffffff" : "#000000");
1577
+ return Object.fromEntries([["transparent", renderedTransparentTone], ["default", renderedDefaultTone], ...toneEntries.filter(_ref6 => {
1578
+ let [k] = _ref6;
1579
+ return k !== "default" && k !== "transparent";
1580
+ }).map(_ref7 => {
1581
+ let [k, v] = _ref7;
1582
+ return [k, renderColorBase(colorPalette, v, renderedDefaultTone.base.bg)];
1583
+ })]);
1584
+ }
1585
+ function renderColorBase(colorPalette, value, bg) {
1586
+ const nestedBg = renderColorValue(colorPalette, bg, value._blend, value.base.bg);
1587
+ return {
1588
+ _blend: value._blend,
1589
+ dark: value.dark,
1590
+ base: {
1591
+ bg: nestedBg,
1592
+ fg: renderColorValue(colorPalette, nestedBg, value._blend, value.base.fg),
1593
+ border: renderColorValue(colorPalette, nestedBg, value._blend, value.base.border)
1594
+ },
1595
+ button: renderButtonColorTheme(colorPalette, nestedBg, value._blend, value.button)
1596
+ };
1597
+ }
1598
+ function renderButtonColorTheme(colorPalette, bg, baseBlendMode, value) {
1599
+ return {
1600
+ default: renderButtonStateColorTheme(colorPalette, bg, baseBlendMode, value.default),
1601
+ primary: renderButtonStateColorTheme(colorPalette, bg, baseBlendMode, value.primary),
1602
+ positive: renderButtonStateColorTheme(colorPalette, bg, baseBlendMode, value.positive),
1603
+ caution: renderButtonStateColorTheme(colorPalette, bg, baseBlendMode, value.caution),
1604
+ critical: renderButtonStateColorTheme(colorPalette, bg, baseBlendMode, value.critical)
1605
+ };
1606
+ }
1607
+ function renderButtonStateColorTheme(colorPalette, bg, baseBlendMode, value) {
1608
+ return {
1609
+ default: renderStatesColorTheme(colorPalette, bg, baseBlendMode, value.default),
1610
+ ghost: renderStatesColorTheme(colorPalette, bg, baseBlendMode, value.ghost),
1611
+ bleed: renderStatesColorTheme(colorPalette, bg, baseBlendMode, value.bleed)
1612
+ };
1613
+ }
1614
+ function renderStatesColorTheme(colorPalette, bg, baseBlendMode, value) {
1615
+ return {
1616
+ enabled: renderStateColorTheme(colorPalette, bg, baseBlendMode, value.enabled),
1617
+ hovered: renderStateColorTheme(colorPalette, bg, baseBlendMode, value.hovered),
1618
+ pressed: renderStateColorTheme(colorPalette, bg, baseBlendMode, value.pressed),
1619
+ selected: renderStateColorTheme(colorPalette, bg, baseBlendMode, value.selected),
1620
+ disabled: renderStateColorTheme(colorPalette, bg, baseBlendMode, value.disabled)
1621
+ };
1622
+ }
1623
+ function renderStateColorTheme(colorPalette, baseBg, rootBlendMode, value) {
1624
+ const blendMode = value._blend;
1625
+ 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
+ const blend = rootBlendMode === "multiply" ? multiply$1 : screen$1;
1643
+ return {
1644
+ _blend: blendMode,
1645
+ bg: blend(baseBg, bg),
1646
+ bg2: blend(baseBg, bg2),
1647
+ fg: blend(baseBg, fg),
1648
+ border: blend(baseBg, border),
1649
+ muted: {
1650
+ fg: blend(baseBg, muted.fg)
1651
+ },
1652
+ accent: {
1653
+ fg: blend(baseBg, accent.fg)
1654
+ },
1655
+ link: {
1656
+ fg: blend(baseBg, link.fg)
1657
+ },
1658
+ code: {
1659
+ bg: blend(baseBg, code.bg),
1660
+ fg: blend(baseBg, code.fg)
1661
+ }
1662
+ };
1663
+ }
1664
+ function renderColorValue(colorPalette, bg, blendMode, str) {
1665
+ const node = parseTokenValue(str);
1666
+ if (!node || node.type !== "color") {
1667
+ throw new Error("Invalid color token value: ".concat(str));
1668
+ }
1669
+ let hex = "";
1670
+ if (node.key === "black") {
1671
+ hex = renderColorHex(colorPalette.black);
1672
+ }
1673
+ if (node.key === "white") {
1674
+ hex = renderColorHex(colorPalette.white);
1675
+ }
1676
+ if (node.hue && node.tint) {
1677
+ hex = renderColorHex(colorPalette[node.hue][node.tint]);
1678
+ }
1679
+ if (!hex) {
1680
+ throw new Error("Invalid color token value: ".concat(str));
1681
+ }
1682
+ try {
1683
+ hex = blendMode === "multiply" ? multiply$1(bg, hex) : screen$1(bg, hex);
1684
+ } catch (err) {
1685
+ console.log("could not blend", hex);
1686
+ }
1687
+ if (node.opacity !== void 0) {
1688
+ hex = rgba(hex, node.opacity);
1689
+ }
1690
+ return hex;
1691
+ }
1692
+ function renderColorHex(color) {
1693
+ return typeof color === "string" ? color : color.hex;
1694
+ }
1695
+ const defaultColorPalette = {
1696
+ ...color$1.color,
1697
+ black: "#000000"
1698
+ };
1699
+ function buildTheme(config) {
1700
+ var _a, _b;
1701
+ return {
1702
+ color: renderColorTheme((_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.palette) != null ? _b : defaultColorPalette, {
1703
+ light: buildColorTheme({
1704
+ scheme: "light"
1705
+ }, config),
1706
+ dark: buildColorTheme({
1707
+ scheme: "dark"
1708
+ }, config)
1709
+ })
1710
+ };
1711
+ }
1025
1712
  function createButtonTones(opts, base, dark, solid, muted, mode) {
1026
1713
  return {
1027
1714
  default: opts.button({
@@ -1214,11 +1901,11 @@ const tones$1 = {
1214
1901
  }
1215
1902
  };
1216
1903
  const defaultOpts = {
1217
- base: _ref4 => {
1904
+ base: _ref8 => {
1218
1905
  let {
1219
1906
  dark,
1220
1907
  name
1221
- } = _ref4;
1908
+ } = _ref8;
1222
1909
  if (name === "default") {
1223
1910
  return {
1224
1911
  bg: dark ? black : white,
@@ -1254,13 +1941,13 @@ const defaultOpts = {
1254
1941
  }
1255
1942
  };
1256
1943
  },
1257
- solid: _ref5 => {
1944
+ solid: _ref9 => {
1258
1945
  let {
1259
1946
  base,
1260
1947
  dark,
1261
1948
  state,
1262
1949
  tone
1263
- } = _ref5;
1950
+ } = _ref9;
1264
1951
  const color = colors[tone];
1265
1952
  if (state === "hovered") {
1266
1953
  return {
@@ -1307,13 +1994,13 @@ const defaultOpts = {
1307
1994
  skeleton: base.skeleton
1308
1995
  };
1309
1996
  },
1310
- muted: _ref6 => {
1997
+ muted: _ref10 => {
1311
1998
  let {
1312
1999
  base,
1313
2000
  dark,
1314
2001
  state,
1315
2002
  tone
1316
- } = _ref6;
2003
+ } = _ref10;
1317
2004
  const color = colors[tone];
1318
2005
  if (state === "hovered") {
1319
2006
  return {
@@ -1360,13 +2047,13 @@ const defaultOpts = {
1360
2047
  skeleton: base.skeleton
1361
2048
  };
1362
2049
  },
1363
- button: _ref7 => {
2050
+ button: _ref11 => {
1364
2051
  let {
1365
2052
  base,
1366
2053
  mode,
1367
2054
  muted,
1368
2055
  solid
1369
- } = _ref7;
2056
+ } = _ref11;
1370
2057
  if (mode === "bleed") {
1371
2058
  return {
1372
2059
  ...muted,
@@ -1420,10 +2107,10 @@ const defaultOpts = {
1420
2107
  };
1421
2108
  return solid;
1422
2109
  },
1423
- card: _ref8 => {
2110
+ card: _ref12 => {
1424
2111
  let {
1425
2112
  base
1426
- } = _ref8;
2113
+ } = _ref12;
1427
2114
  return {
1428
2115
  bg: black,
1429
2116
  bg2: black,
@@ -1455,18 +2142,18 @@ const defaultOpts = {
1455
2142
  placeholder: black
1456
2143
  };
1457
2144
  },
1458
- selectable: _ref9 => {
2145
+ selectable: _ref13 => {
1459
2146
  let {
1460
2147
  muted,
1461
2148
  state,
1462
2149
  tone
1463
- } = _ref9;
2150
+ } = _ref13;
1464
2151
  return muted[tone][state];
1465
2152
  },
1466
- spot: _ref10 => {
2153
+ spot: _ref14 => {
1467
2154
  let {
1468
2155
  key
1469
- } = _ref10;
2156
+ } = _ref14;
1470
2157
  return spots[key];
1471
2158
  },
1472
2159
  syntax: () => ({
@@ -2181,7 +2868,7 @@ function _createColor(opts, dark, name) {
2181
2868
  function multiply(bg, fg) {
2182
2869
  const b = parseColor(bg);
2183
2870
  const s = parseColor(fg);
2184
- const hex = rgbToHex(multiply$1(b, s));
2871
+ const hex = rgbToHex(multiply$2(b, s));
2185
2872
  if (s.a) {
2186
2873
  return rgba(hex, s.a);
2187
2874
  }
@@ -2190,7 +2877,7 @@ function multiply(bg, fg) {
2190
2877
  function screen(bg, fg) {
2191
2878
  const b = parseColor(bg);
2192
2879
  const s = parseColor(fg);
2193
- const hex = rgbToHex(screen$1(b, s));
2880
+ const hex = rgbToHex(screen$2(b, s));
2194
2881
  if (s.a) {
2195
2882
  return rgba(hex, s.a);
2196
2883
  }
@@ -2206,11 +2893,11 @@ const tones = {
2206
2893
  };
2207
2894
  const NEUTRAL_TONES = ["default", "transparent"];
2208
2895
  const color = createColorTheme({
2209
- base: _ref11 => {
2896
+ base: _ref15 => {
2210
2897
  let {
2211
2898
  dark,
2212
2899
  name
2213
- } = _ref11;
2900
+ } = _ref15;
2214
2901
  if (name === "default") {
2215
2902
  const tints2 = color$1.hues.gray;
2216
2903
  const skeletonFrom2 = dark ? tints2[900].hex : tints2[100].hex;
@@ -2270,14 +2957,14 @@ const color = createColorTheme({
2270
2957
  }
2271
2958
  };
2272
2959
  },
2273
- solid: _ref12 => {
2960
+ solid: _ref16 => {
2274
2961
  let {
2275
2962
  base,
2276
2963
  dark,
2277
2964
  name,
2278
2965
  state,
2279
2966
  tone
2280
- } = _ref12;
2967
+ } = _ref16;
2281
2968
  const mix = dark ? screen : multiply;
2282
2969
  const mix2 = dark ? multiply : screen;
2283
2970
  const defaultTints = tones[name] || tones.default;
@@ -2431,14 +3118,14 @@ const color = createColorTheme({
2431
3118
  }
2432
3119
  };
2433
3120
  },
2434
- muted: _ref13 => {
3121
+ muted: _ref17 => {
2435
3122
  let {
2436
3123
  base,
2437
3124
  dark,
2438
3125
  name,
2439
3126
  state,
2440
3127
  tone
2441
- } = _ref13;
3128
+ } = _ref17;
2442
3129
  const mix = dark ? screen : multiply;
2443
3130
  const defaultTints = tones[name] || tones.default;
2444
3131
  const isNeutral = NEUTRAL_TONES.includes(name) && NEUTRAL_TONES.includes(tone);
@@ -2594,13 +3281,13 @@ const color = createColorTheme({
2594
3281
  }
2595
3282
  };
2596
3283
  },
2597
- button: _ref14 => {
3284
+ button: _ref18 => {
2598
3285
  let {
2599
3286
  base,
2600
3287
  mode,
2601
3288
  muted,
2602
3289
  solid
2603
- } = _ref14;
3290
+ } = _ref18;
2604
3291
  if (mode === "bleed") {
2605
3292
  return {
2606
3293
  enabled: {
@@ -2637,7 +3324,7 @@ const color = createColorTheme({
2637
3324
  }
2638
3325
  return solid;
2639
3326
  },
2640
- card: _ref15 => {
3327
+ card: _ref19 => {
2641
3328
  let {
2642
3329
  base,
2643
3330
  dark,
@@ -2645,7 +3332,7 @@ const color = createColorTheme({
2645
3332
  name,
2646
3333
  solid,
2647
3334
  state
2648
- } = _ref15;
3335
+ } = _ref19;
2649
3336
  if (state === "hovered") {
2650
3337
  return muted[name].hovered;
2651
3338
  }
@@ -2695,13 +3382,13 @@ const color = createColorTheme({
2695
3382
  }
2696
3383
  };
2697
3384
  },
2698
- input: _ref16 => {
3385
+ input: _ref20 => {
2699
3386
  let {
2700
3387
  base,
2701
3388
  dark,
2702
3389
  mode,
2703
3390
  state
2704
- } = _ref16;
3391
+ } = _ref20;
2705
3392
  const mix = dark ? screen : multiply;
2706
3393
  if (mode === "invalid") {
2707
3394
  const tints = tones.critical;
@@ -2753,14 +3440,14 @@ const color = createColorTheme({
2753
3440
  placeholder: mix(base.bg, color$1.hues.gray[dark ? 600 : 400].hex)
2754
3441
  };
2755
3442
  },
2756
- selectable: _ref17 => {
3443
+ selectable: _ref21 => {
2757
3444
  let {
2758
3445
  base,
2759
3446
  muted,
2760
3447
  tone,
2761
3448
  solid,
2762
3449
  state
2763
- } = _ref17;
3450
+ } = _ref21;
2764
3451
  if (state === "enabled") {
2765
3452
  return {
2766
3453
  ...muted[tone].enabled,
@@ -2787,20 +3474,20 @@ const color = createColorTheme({
2787
3474
  }
2788
3475
  return muted[tone][state];
2789
3476
  },
2790
- spot: _ref18 => {
3477
+ spot: _ref22 => {
2791
3478
  let {
2792
3479
  base,
2793
3480
  dark,
2794
3481
  key
2795
- } = _ref18;
3482
+ } = _ref22;
2796
3483
  const mix = dark ? screen : multiply;
2797
3484
  return mix(base.bg, color$1.hues[key][dark ? 400 : 500].hex);
2798
3485
  },
2799
- syntax: _ref19 => {
3486
+ syntax: _ref23 => {
2800
3487
  let {
2801
3488
  base,
2802
3489
  dark
2803
- } = _ref19;
3490
+ } = _ref23;
2804
3491
  const mix = dark ? screen : multiply;
2805
3492
  const mainShade = dark ? 400 : 600;
2806
3493
  const secondaryShade = dark ? 600 : 400;
@@ -3896,7 +4583,7 @@ var __defProp$E = Object.defineProperty;
3896
4583
  var __template$D = (cooked, raw) => __freeze$D(__defProp$E(cooked, "raw", {
3897
4584
  value: __freeze$D(raw || cooked.slice())
3898
4585
  }));
3899
- var _a$D, _b$m, _c$d;
4586
+ var _a$D, _b$n, _c$d;
3900
4587
  const ROOT_STYLE = styled.css(_a$D || (_a$D = __template$D(["\n &:not([hidden]) {\n display: flex;\n }\n\n align-items: center;\n"])));
3901
4588
  function textInputRootStyle() {
3902
4589
  return ROOT_STYLE;
@@ -3910,7 +4597,7 @@ function textInputBaseStyle(props) {
3910
4597
  } = props;
3911
4598
  const font = theme.sanity.fonts.text;
3912
4599
  const color = theme.sanity.color.input;
3913
- return styled.css(_b$m || (_b$m = __template$D(["\n appearance: none;\n background: none;\n border: 0;\n border-radius: 0;\n outline: none;\n width: 100%;\n box-sizing: border-box;\n font-family: ", ";\n font-weight: ", ";\n margin: 0;\n position: relative;\n z-index: 1;\n display: block;\n\n /* NOTE: This is a hack to disable Chrome\u2019s autofill styles */\n &:-webkit-autofill,\n &:-webkit-autofill:hover,\n &:-webkit-autofill:focus,\n &:-webkit-autofill:active {\n -webkit-text-fill-color: var(--input-fg-color) !important;\n transition: background-color 5000s;\n transition-delay: 86400s /* 24h */;\n }\n\n /* &:is(textarea) */\n &[data-as='textarea'] {\n resize: none;\n }\n\n color: var(--input-fg-color);\n\n &::placeholder {\n color: var(--input-placeholder-color);\n }\n\n &[data-scheme='", "'][data-tone='", "'] {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n\n /* enabled */\n &:not(:invalid):not(:disabled):not(:read-only) {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n\n /* disabled */\n &:not(:invalid):disabled {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n\n /* invalid */\n &:invalid {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n\n /* readOnly */\n &:read-only {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n }\n "])), font.family, $weight && font.weights[$weight] || font.weights.regular, $scheme, $tone, color.default.enabled.fg, color.default.enabled.placeholder, color.default.enabled.fg, color.default.enabled.placeholder, color.default.disabled.fg, color.default.disabled.placeholder, color.invalid.enabled.fg, color.invalid.enabled.placeholder, color.default.readOnly.fg, color.default.readOnly.placeholder);
4600
+ return styled.css(_b$n || (_b$n = __template$D(["\n appearance: none;\n background: none;\n border: 0;\n border-radius: 0;\n outline: none;\n width: 100%;\n box-sizing: border-box;\n font-family: ", ";\n font-weight: ", ";\n margin: 0;\n position: relative;\n z-index: 1;\n display: block;\n\n /* NOTE: This is a hack to disable Chrome\u2019s autofill styles */\n &:-webkit-autofill,\n &:-webkit-autofill:hover,\n &:-webkit-autofill:focus,\n &:-webkit-autofill:active {\n -webkit-text-fill-color: var(--input-fg-color) !important;\n transition: background-color 5000s;\n transition-delay: 86400s /* 24h */;\n }\n\n /* &:is(textarea) */\n &[data-as='textarea'] {\n resize: none;\n }\n\n color: var(--input-fg-color);\n\n &::placeholder {\n color: var(--input-placeholder-color);\n }\n\n &[data-scheme='", "'][data-tone='", "'] {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n\n /* enabled */\n &:not(:invalid):not(:disabled):not(:read-only) {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n\n /* disabled */\n &:not(:invalid):disabled {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n\n /* invalid */\n &:invalid {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n\n /* readOnly */\n &:read-only {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n }\n "])), font.family, $weight && font.weights[$weight] || font.weights.regular, $scheme, $tone, color.default.enabled.fg, color.default.enabled.placeholder, color.default.enabled.fg, color.default.enabled.placeholder, color.default.disabled.fg, color.default.disabled.placeholder, color.invalid.enabled.fg, color.invalid.enabled.placeholder, color.default.readOnly.fg, color.default.readOnly.placeholder);
3914
4601
  }
3915
4602
  function textInputFontSizeStyle(props) {
3916
4603
  const {
@@ -4026,7 +4713,7 @@ var __defProp$D = Object.defineProperty;
4026
4713
  var __template$C = (cooked, raw) => __freeze$C(__defProp$D(cooked, "raw", {
4027
4714
  value: __freeze$C(raw || cooked.slice())
4028
4715
  }));
4029
- var _a$C, _b$l, _c$c;
4716
+ var _a$C, _b$m, _c$c;
4030
4717
  function textBaseStyle(props) {
4031
4718
  const {
4032
4719
  $accent,
@@ -4036,7 +4723,7 @@ function textBaseStyle(props) {
4036
4723
  const {
4037
4724
  weights
4038
4725
  } = theme.sanity.fonts.text;
4039
- return styled.css(_c$c || (_c$c = __template$C(["\n color: var(--card-fg-color);\n\n ", "\n\n ", "\n\n & code {\n font-family: ", ";\n border-radius: 1px;\n background-color: var(--card-code-bg-color);\n color: var(--card-code-fg-color);\n }\n\n & a {\n text-decoration: none;\n border-radius: 1px;\n color: var(--card-link-color);\n outline: none;\n\n @media (hover: hover) {\n &:hover {\n text-decoration: underline;\n }\n }\n\n &:focus {\n box-shadow:\n 0 0 0 1px var(--card-bg-color),\n 0 0 0 3px var(--card-focus-ring-color);\n }\n\n &:focus:not(:focus-visible) {\n box-shadow: none;\n }\n }\n\n & strong {\n font-weight: ", ";\n }\n\n & svg {\n /* Certain popular CSS libraries changes the defaults for SVG display */\n /* Make sure SVGs are rendered as inline elements */\n display: inline;\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n color: var(--card-icon-color);\n }\n "])), $accent && styled.css(_a$C || (_a$C = __template$C(["\n color: var(--card-accent-fg-color);\n "]))), $muted && styled.css(_b$l || (_b$l = __template$C(["\n color: var(--card-muted-fg-color);\n "]))), theme.sanity.fonts.code.family, weights.bold);
4726
+ return styled.css(_c$c || (_c$c = __template$C(["\n color: var(--card-fg-color);\n\n ", "\n\n ", "\n\n & code {\n font-family: ", ";\n border-radius: 1px;\n background-color: var(--card-code-bg-color);\n color: var(--card-code-fg-color);\n }\n\n & a {\n text-decoration: none;\n border-radius: 1px;\n color: var(--card-link-color);\n outline: none;\n\n @media (hover: hover) {\n &:hover {\n text-decoration: underline;\n }\n }\n\n &:focus {\n box-shadow:\n 0 0 0 1px var(--card-bg-color),\n 0 0 0 3px var(--card-focus-ring-color);\n }\n\n &:focus:not(:focus-visible) {\n box-shadow: none;\n }\n }\n\n & strong {\n font-weight: ", ";\n }\n\n & svg {\n /* Certain popular CSS libraries changes the defaults for SVG display */\n /* Make sure SVGs are rendered as inline elements */\n display: inline;\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n color: var(--card-icon-color);\n }\n "])), $accent && styled.css(_a$C || (_a$C = __template$C(["\n color: var(--card-accent-fg-color);\n "]))), $muted && styled.css(_b$m || (_b$m = __template$C(["\n color: var(--card-muted-fg-color);\n "]))), theme.sanity.fonts.code.family, weights.bold);
4040
4727
  }
4041
4728
  var __freeze$B = Object.freeze;
4042
4729
  var __defProp$C = Object.defineProperty;
@@ -4601,9 +5288,9 @@ var __defProp$z = Object.defineProperty;
4601
5288
  var __template$y = (cooked, raw) => __freeze$y(__defProp$z(cooked, "raw", {
4602
5289
  value: __freeze$y(raw || cooked.slice())
4603
5290
  }));
4604
- var _a$y, _b$k;
5291
+ var _a$y, _b$l;
4605
5292
  const rotate$1 = styled.keyframes(_a$y || (_a$y = __template$y(["\n from {\n transform: rotate(0deg);\n }\n\n to {\n transform: rotate(360deg);\n }\n"])));
4606
- const Root$x = styled__default.default(Text)(_b$k || (_b$k = __template$y(["\n & > span > svg {\n animation: ", " 500ms linear infinite;\n }\n"])), rotate$1);
5293
+ const Root$x = styled__default.default(Text)(_b$l || (_b$l = __template$y(["\n & > span > svg {\n animation: ", " 500ms linear infinite;\n }\n"])), rotate$1);
4607
5294
  const Spinner = react.forwardRef(function Spinner2(props, ref) {
4608
5295
  return /* @__PURE__ */jsxRuntime.jsx(Root$x, {
4609
5296
  "data-ui": "Spinner",
@@ -4648,9 +5335,12 @@ var __defProp$y = Object.defineProperty;
4648
5335
  var __template$x = (cooked, raw) => __freeze$x(__defProp$y(cooked, "raw", {
4649
5336
  value: __freeze$x(raw || cooked.slice())
4650
5337
  }));
4651
- var _a$x;
4652
- function buttonBaseStyles() {
4653
- return styled.css(_a$x || (_a$x = __template$x(["\n -webkit-font-smoothing: inherit;\n appearance: none;\n display: inline-flex;\n align-items: center;\n font: inherit;\n border: 0;\n outline: none;\n user-select: none;\n text-decoration: none;\n border: 0;\n box-sizing: border-box;\n padding: 0;\n margin: 0;\n white-space: nowrap;\n text-align: left;\n position: relative;\n\n & > span {\n display: block;\n flex: 1;\n min-width: 0;\n border-radius: inherit;\n }\n\n &::-moz-focus-inner {\n border: 0;\n padding: 0;\n }\n "])));
5338
+ var _a$x, _b$k;
5339
+ function buttonBaseStyles(_ref24) {
5340
+ let {
5341
+ $width
5342
+ } = _ref24;
5343
+ return styled.css(_b$k || (_b$k = __template$x(["\n -webkit-font-smoothing: inherit;\n appearance: none;\n display: inline-flex;\n align-items: center;\n font: inherit;\n border: 0;\n outline: none;\n user-select: none;\n text-decoration: none;\n border: 0;\n box-sizing: border-box;\n padding: 0;\n margin: 0;\n white-space: nowrap;\n text-align: left;\n position: relative;\n\n ", "\n\n & > span {\n display: block;\n flex: 1;\n min-width: 0;\n border-radius: inherit;\n }\n\n &::-moz-focus-inner {\n border: 0;\n padding: 0;\n }\n "])), $width === "fill" && styled.css(_a$x || (_a$x = __template$x(["\n width: -webkit-fill-available;\n width: stretch;\n "]))));
4654
5344
  }
4655
5345
  const buttonTheme = {
4656
5346
  border: {
@@ -4665,7 +5355,7 @@ function combineBoxShadow() {
4665
5355
  return boxShadows.filter(Boolean).join(",");
4666
5356
  }
4667
5357
  function buttonColorStyles(props) {
4668
- var _a2, _b;
5358
+ var _a2, _b2;
4669
5359
  const {
4670
5360
  $mode,
4671
5361
  theme
@@ -4708,7 +5398,7 @@ function buttonColorStyles(props) {
4708
5398
  },
4709
5399
  "&[data-selected]": _colorVarsStyle(base, color.pressed)
4710
5400
  }
4711
- }, (_b = (_a2 = theme.sanity.styles) == null ? void 0 : _a2.button) == null ? void 0 : _b.root].filter(Boolean);
5401
+ }, (_b2 = (_a2 = theme.sanity.styles) == null ? void 0 : _a2.button) == null ? void 0 : _b2.root].filter(Boolean);
4712
5402
  }
4713
5403
  var __freeze$w = Object.freeze;
4714
5404
  var __defProp$x = Object.defineProperty;
@@ -4743,6 +5433,7 @@ const Button = react.forwardRef(function Button2(props, ref) {
4743
5433
  tone = "default",
4744
5434
  type = "button",
4745
5435
  muted = false,
5436
+ width,
4746
5437
  ...restProps
4747
5438
  } = props;
4748
5439
  const justify = useArrayProp(justifyProp);
@@ -4777,6 +5468,7 @@ const Button = react.forwardRef(function Button2(props, ref) {
4777
5468
  disabled: Boolean(loading || disabled),
4778
5469
  ref,
4779
5470
  type,
5471
+ $width: width,
4780
5472
  children: [Boolean(loading) && /* @__PURE__ */jsxRuntime.jsx(LoadingBox, {
4781
5473
  children: /* @__PURE__ */jsxRuntime.jsx(Spinner, {})
4782
5474
  }), (icon || text || iconRight) && /* @__PURE__ */jsxRuntime.jsx(Box, {
@@ -5005,10 +5697,10 @@ var __template$t = (cooked, raw) => __freeze$t(__defProp$u(cooked, "raw", {
5005
5697
  value: __freeze$t(raw || cooked.slice())
5006
5698
  }));
5007
5699
  var _a$t;
5008
- function codeSyntaxHighlightingStyle(_ref20) {
5700
+ function codeSyntaxHighlightingStyle(_ref25) {
5009
5701
  let {
5010
5702
  theme
5011
- } = _ref20;
5703
+ } = _ref25;
5012
5704
  const color = theme.sanity.color.syntax;
5013
5705
  return {
5014
5706
  "&.atrule": {
@@ -6316,13 +7008,13 @@ const Popover = react.memo(react.forwardRef(function Popover2(props, ref) {
6316
7008
  }));
6317
7009
  if (constrainSize || matchReferenceWidth) {
6318
7010
  ret.push(size({
6319
- apply(_ref21) {
7011
+ apply(_ref26) {
6320
7012
  let {
6321
7013
  availableWidth,
6322
7014
  availableHeight,
6323
7015
  elements,
6324
7016
  referenceWidth
6325
- } = _ref21;
7017
+ } = _ref26;
6326
7018
  referenceWidthRef.current = referenceWidth;
6327
7019
  const _currentWidth = widthRef.current;
6328
7020
  const _maxWidth = maxWidthRef.current;
@@ -7131,12 +7823,12 @@ const Tooltip = react.forwardRef(function Tooltip2(props, ref) {
7131
7823
  mainAxis: 3
7132
7824
  }));
7133
7825
  ret.push(reactDom$1.size({
7134
- apply(_ref22) {
7826
+ apply(_ref27) {
7135
7827
  let {
7136
7828
  availableWidth,
7137
7829
  availableHeight,
7138
7830
  elements
7139
- } = _ref22;
7831
+ } = _ref27;
7140
7832
  Object.assign(elements.floating.style, {
7141
7833
  maxWidth: "".concat(availableWidth - 4 * 2, "px"),
7142
7834
  // the padding is `4px`
@@ -7442,10 +8134,10 @@ const InnerAutocomplete = react.forwardRef(function InnerAutocomplete2(props, re
7442
8134
  query,
7443
8135
  value
7444
8136
  } = state;
7445
- const defaultRenderOption = react.useCallback(_ref23 => {
8137
+ const defaultRenderOption = react.useCallback(_ref28 => {
7446
8138
  let {
7447
8139
  value: value2
7448
- } = _ref23;
8140
+ } = _ref28;
7449
8141
  return /* @__PURE__ */jsxRuntime.jsx(Card, {
7450
8142
  "data-as": "button",
7451
8143
  padding: paddingProp,
@@ -7899,10 +8591,10 @@ const Breadcrumbs = react.forwardRef(function Breadcrumbs2(props, ref) {
7899
8591
  });
7900
8592
  });
7901
8593
  const BORDER_OFFSET_X = 12;
7902
- function dialogStyle(_ref24) {
8594
+ function dialogStyle(_ref29) {
7903
8595
  let {
7904
8596
  theme
7905
- } = _ref24;
8597
+ } = _ref29;
7906
8598
  const color = theme.sanity.color.base;
7907
8599
  return {
7908
8600
  "&:not([hidden])": {
@@ -8987,15 +9679,15 @@ var __template$6 = (cooked, raw) => __freeze$6(__defProp$6(cooked, "raw", {
8987
9679
  var _a$6, _b$3, _c$1, _d;
8988
9680
  const keyframe = styled.keyframes(_a$6 || (_a$6 = __template$6(["\n 0% {\n background-position: 100%;\n }\n 100% {\n background-position: -100%;\n }\n"])));
8989
9681
  const animation = styled.css(_b$3 || (_b$3 = __template$6(["\n background-image: linear-gradient(\n to right,\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-to),\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-from)\n );\n background-position: 100%;\n background-size: 200% 100%;\n background-attachment: fixed;\n animation-name: ", ";\n animation-timing-function: ease-in-out;\n animation-iteration-count: infinite;\n animation-duration: 2000ms;\n"])), keyframe);
8990
- const skeletonStyle = styled.css(_d || (_d = __template$6(["\n opacity: ", ";\n transition: opacity 200ms ease-in;\n\n @media screen and (prefers-reduced-motion: no-preference) {\n ", "\n }\n\n @media screen and (prefers-reduced-motion: reduce) {\n background-color: var(--card-skeleton-color-from);\n }\n"])), _ref25 => {
9682
+ const skeletonStyle = styled.css(_d || (_d = __template$6(["\n opacity: ", ";\n transition: opacity 200ms ease-in;\n\n @media screen and (prefers-reduced-motion: no-preference) {\n ", "\n }\n\n @media screen and (prefers-reduced-motion: reduce) {\n background-color: var(--card-skeleton-color-from);\n }\n"])), _ref30 => {
8991
9683
  let {
8992
9684
  $visible
8993
- } = _ref25;
9685
+ } = _ref30;
8994
9686
  return $visible ? 1 : 0;
8995
- }, _ref26 => {
9687
+ }, _ref31 => {
8996
9688
  let {
8997
9689
  $animated
8998
- } = _ref26;
9690
+ } = _ref31;
8999
9691
  return $animated ? animation : styled.css(_c$1 || (_c$1 = __template$6(["\n background-color: var(--card-skeleton-color-from);\n "])));
9000
9692
  });
9001
9693
  const Root$4 = styled__default.default(Box)(responsiveRadiusStyle, skeletonStyle);
@@ -9026,12 +9718,12 @@ const Skeleton = react.forwardRef(function Skeleton2(props, ref) {
9026
9718
  ref
9027
9719
  });
9028
9720
  });
9029
- const Root$3 = styled__default.default(Skeleton)(_ref27 => {
9721
+ const Root$3 = styled__default.default(Skeleton)(_ref32 => {
9030
9722
  let {
9031
9723
  $size,
9032
9724
  $style,
9033
9725
  theme
9034
- } = _ref27;
9726
+ } = _ref32;
9035
9727
  const {
9036
9728
  media
9037
9729
  } = theme.sanity;
@@ -9379,12 +10071,12 @@ function ToastProvider(props) {
9379
10071
  paddingY,
9380
10072
  children: /* @__PURE__ */jsxRuntime.jsx(framerMotion.AnimatePresence, {
9381
10073
  initial: false,
9382
- children: state.map(_ref28 => {
10074
+ children: state.map(_ref33 => {
9383
10075
  let {
9384
10076
  dismiss,
9385
10077
  id,
9386
10078
  params
9387
- } = _ref28;
10079
+ } = _ref33;
9388
10080
  return /* @__PURE__ */jsxRuntime.jsx(framerMotion.motion.div, {
9389
10081
  animate: {
9390
10082
  opacity: 1,
@@ -9893,6 +10585,18 @@ exports.BoundaryElementProvider = BoundaryElementProvider;
9893
10585
  exports.Box = Box;
9894
10586
  exports.Breadcrumbs = Breadcrumbs;
9895
10587
  exports.Button = Button;
10588
+ exports.COLOR_BASE_TONES = COLOR_BASE_TONES;
10589
+ exports.COLOR_BLEND_MODES = COLOR_BLEND_MODES;
10590
+ exports.COLOR_BUTTON_MODES = COLOR_BUTTON_MODES;
10591
+ exports.COLOR_CONFIG_BASE_KEYS = COLOR_CONFIG_BASE_KEYS;
10592
+ exports.COLOR_CONFIG_BASE_TONES = COLOR_CONFIG_BASE_TONES;
10593
+ exports.COLOR_CONFIG_BLEND_KEYS = COLOR_CONFIG_BLEND_KEYS;
10594
+ exports.COLOR_CONFIG_STATE_KEYS = COLOR_CONFIG_STATE_KEYS;
10595
+ exports.COLOR_CONFIG_STATE_TONES = COLOR_CONFIG_STATE_TONES;
10596
+ exports.COLOR_HUES = COLOR_HUES;
10597
+ exports.COLOR_STATES = COLOR_STATES;
10598
+ exports.COLOR_STATE_TONES = COLOR_STATE_TONES;
10599
+ exports.COLOR_TINTS = COLOR_TINTS;
9896
10600
  exports.Card = Card;
9897
10601
  exports.Checkbox = Checkbox;
9898
10602
  exports.Code = Code;
@@ -9958,12 +10662,25 @@ exports._raf = _raf;
9958
10662
  exports._raf2 = _raf2;
9959
10663
  exports._responsive = _responsive;
9960
10664
  exports.attemptFocus = attemptFocus;
10665
+ exports.buildTheme = buildTheme;
9961
10666
  exports.containsOrEqualsElement = containsOrEqualsElement;
9962
10667
  exports.createColorTheme = createColorTheme;
9963
10668
  exports.focusFirstDescendant = focusFirstDescendant;
9964
10669
  exports.focusLastDescendant = focusLastDescendant;
9965
10670
  exports.hexToRgb = hexToRgb;
9966
10671
  exports.hslToRgb = hslToRgb;
10672
+ exports.isColorBlendModeValue = isColorBlendModeValue;
10673
+ exports.isColorButtonMode = isColorButtonMode;
10674
+ exports.isColorConfigBaseKey = isColorConfigBaseKey;
10675
+ exports.isColorConfigBaseTone = isColorConfigBaseTone;
10676
+ exports.isColorConfigBlendKey = isColorConfigBlendKey;
10677
+ exports.isColorConfigStateKey = isColorConfigStateKey;
10678
+ exports.isColorConfigStateTone = isColorConfigStateTone;
10679
+ exports.isColorHueValue = isColorHueValue;
10680
+ exports.isColorOpacityValue = isColorOpacityValue;
10681
+ exports.isColorTintValue = isColorTintValue;
10682
+ exports.isColorTokenValue = isColorTokenValue;
10683
+ exports.isColorValue = isColorValue;
9967
10684
  exports.isFocusable = isFocusable;
9968
10685
  exports.isHTMLAnchorElement = isHTMLAnchorElement;
9969
10686
  exports.isHTMLButtonElement = isHTMLButtonElement;
@@ -9971,8 +10688,10 @@ exports.isHTMLElement = isHTMLElement;
9971
10688
  exports.isHTMLInputElement = isHTMLInputElement;
9972
10689
  exports.isHTMLSelectElement = isHTMLSelectElement;
9973
10690
  exports.isHTMLTextAreaElement = isHTMLTextAreaElement;
9974
- exports.multiply = multiply$1;
10691
+ exports.multiply = multiply$2;
9975
10692
  exports.parseColor = parseColor;
10693
+ exports.parseTokenKey = parseTokenKey;
10694
+ exports.parseTokenValue = parseTokenValue;
9976
10695
  exports.rem = rem;
9977
10696
  exports.responsiveCodeFontStyle = responsiveCodeFontStyle;
9978
10697
  exports.responsiveHeadingFont = responsiveHeadingFont;
@@ -9983,7 +10702,7 @@ exports.rgbToHex = rgbToHex;
9983
10702
  exports.rgbToHsl = rgbToHsl;
9984
10703
  exports.rgba = rgba;
9985
10704
  exports.rgbaToRGBA = rgbaToRGBA;
9986
- exports.screen = screen$1;
10705
+ exports.screen = screen$2;
9987
10706
  exports.studioTheme = studioTheme;
9988
10707
  exports.useArrayProp = useArrayProp;
9989
10708
  exports.useBoundaryElement = useBoundaryElement;