@sanity/ui 2.0.0-alpha.4 → 2.0.0-alpha.6

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 (114) hide show
  1. package/dist/index.cjs.mjs +3 -1
  2. package/dist/index.d.ts +294 -407
  3. package/dist/index.esm.js +794 -2148
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/index.js +795 -2147
  6. package/dist/index.js.map +1 -1
  7. package/package.json +2 -2
  8. package/src/components/dialog/dialog.tsx +3 -3
  9. package/src/components/dialog/styles.ts +3 -4
  10. package/src/components/menu/__workshop__/closableMenuButton.tsx +2 -2
  11. package/src/components/menu/menuDivider.ts +2 -1
  12. package/src/components/menu/menuGroup.tsx +3 -0
  13. package/src/components/menu/menuItem.tsx +6 -3
  14. package/src/components/skeleton/styles.ts +8 -7
  15. package/src/components/tree/style.ts +19 -20
  16. package/src/primitives/_selectable/style.ts +27 -21
  17. package/src/primitives/avatar/avatar.tsx +8 -3
  18. package/src/primitives/avatar/avatarCounter.tsx +5 -4
  19. package/src/primitives/avatar/spotColors.ts +53 -0
  20. package/src/primitives/avatar/styles.ts +5 -7
  21. package/src/primitives/avatar/types.ts +14 -0
  22. package/src/primitives/badge/styles.ts +7 -8
  23. package/src/primitives/box/__workshop__/responsive.tsx +2 -2
  24. package/src/primitives/button/button.tsx +2 -2
  25. package/src/primitives/button/styles.ts +82 -16
  26. package/src/primitives/card/__workshop__/selected.tsx +8 -9
  27. package/src/primitives/card/card.tsx +43 -7
  28. package/src/primitives/card/styles.ts +30 -22
  29. package/src/primitives/card/types.ts +3 -1
  30. package/src/primitives/checkbox/styles.ts +20 -20
  31. package/src/primitives/code/code.tsx +15 -3
  32. package/src/primitives/code/styles.ts +51 -42
  33. package/src/primitives/heading/styles.ts +6 -5
  34. package/src/primitives/kbd/kbd.tsx +2 -1
  35. package/src/primitives/label/styles.ts +3 -2
  36. package/src/primitives/popover/popoverArrow.tsx +3 -2
  37. package/src/primitives/popover/popoverCard.tsx +6 -2
  38. package/src/primitives/radio/styles.ts +15 -15
  39. package/src/primitives/select/styles.ts +20 -22
  40. package/src/primitives/switch/styles.ts +13 -13
  41. package/src/primitives/text/__workshop__/colored.tsx +10 -11
  42. package/src/primitives/text/styles.ts +10 -9
  43. package/src/primitives/textArea/textArea.tsx +8 -12
  44. package/src/primitives/textInput/textInput.tsx +13 -13
  45. package/src/primitives/tooltip/__workshop__/props.tsx +20 -3
  46. package/src/primitives/tooltip/tooltipArrow.tsx +3 -2
  47. package/src/styles/border/borderStyle.ts +2 -1
  48. package/src/styles/colorVars/colorVarsStyle.ts +71 -32
  49. package/src/styles/focusRing/index.ts +6 -4
  50. package/src/styles/input/textInputStyle.ts +76 -93
  51. package/src/styles/margin/marginsStyle.test.ts +1 -2
  52. package/src/styles/padding/paddingStyle.test.ts +1 -2
  53. package/src/styles/shadow/shadowStyle.ts +5 -5
  54. package/src/theme/__workshop__/color.tsx +2 -2
  55. package/src/theme/__workshop__/index.ts +0 -5
  56. package/src/theme/lib/color-fns/blend/multiply.ts +2 -2
  57. package/src/theme/lib/color-fns/blend/screen.ts +2 -2
  58. package/src/theme/lib/color-fns/convert.ts +15 -1
  59. package/src/theme/lib/color-fns/parse.ts +7 -3
  60. package/src/theme/lib/color-fns/types.ts +11 -0
  61. package/src/theme/lib/theme/color/cssVariables/cardVariables.ts +92 -0
  62. package/src/theme/lib/theme/color/cssVariables/createCssVars.ts +31 -0
  63. package/src/theme/lib/theme/color/cssVariables/cssVars.test.ts +262 -0
  64. package/src/theme/lib/theme/color/cssVariables/index.ts +1 -0
  65. package/src/theme/lib/theme/color/cssVariables/tints.ts +312 -0
  66. package/src/theme/lib/theme/color/cssVariables/tones.ts +67 -0
  67. package/src/theme/lib/theme/color/cssVariables/utils.test.ts +15 -0
  68. package/src/theme/lib/theme/color/cssVariables/utils.ts +9 -0
  69. package/src/theme/lib/theme/color/index.ts +2 -12
  70. package/src/theme/lib/theme/color/types.ts +6 -37
  71. package/src/theme/studioTheme/color.ts +2 -641
  72. package/src/theme/studioTheme/helpers.ts +15 -1
  73. package/src/theme/studioTheme/theme.ts +8 -2
  74. package/src/theme/themeColorProvider.tsx +2 -0
  75. package/src/theme/themeProvider.tsx +27 -8
  76. package/src/theme/toneContext/toneContext.ts +12 -0
  77. package/src/theme/toneContext/toneProvider.tsx +31 -0
  78. package/src/theme/toneContext/types.ts +10 -0
  79. package/src/theme/toneContext/useToneContext.tsx +26 -0
  80. package/src/theme/types.ts +2 -4
  81. package/src/utils/elementQuery/__workshop__/customMedia.tsx +4 -3
  82. package/src/theme/__workshop__/canvas.tsx +0 -395
  83. package/src/theme/lib/theme/color/_generic/index.ts +0 -1
  84. package/src/theme/lib/theme/color/_generic/types.ts +0 -30
  85. package/src/theme/lib/theme/color/base/index.ts +0 -1
  86. package/src/theme/lib/theme/color/base/types.ts +0 -19
  87. package/src/theme/lib/theme/color/button/createButtonModes.ts +0 -20
  88. package/src/theme/lib/theme/color/button/createButtonTones.ts +0 -52
  89. package/src/theme/lib/theme/color/button/index.ts +0 -1
  90. package/src/theme/lib/theme/color/button/types.ts +0 -44
  91. package/src/theme/lib/theme/color/card/createCardStates.ts +0 -58
  92. package/src/theme/lib/theme/color/card/index.ts +0 -1
  93. package/src/theme/lib/theme/color/card/types.ts +0 -18
  94. package/src/theme/lib/theme/color/color.test.ts +0 -63
  95. package/src/theme/lib/theme/color/defaults.ts +0 -390
  96. package/src/theme/lib/theme/color/factory.ts +0 -138
  97. package/src/theme/lib/theme/color/input/createInputModes.ts +0 -84
  98. package/src/theme/lib/theme/color/input/index.ts +0 -1
  99. package/src/theme/lib/theme/color/input/types.ts +0 -28
  100. package/src/theme/lib/theme/color/muted/createMuted.ts +0 -56
  101. package/src/theme/lib/theme/color/muted/index.ts +0 -1
  102. package/src/theme/lib/theme/color/muted/types.ts +0 -24
  103. package/src/theme/lib/theme/color/selectable/createSelectableTones.ts +0 -73
  104. package/src/theme/lib/theme/color/selectable/index.ts +0 -1
  105. package/src/theme/lib/theme/color/selectable/types.ts +0 -29
  106. package/src/theme/lib/theme/color/solid/createSolidTones.ts +0 -56
  107. package/src/theme/lib/theme/color/solid/index.ts +0 -1
  108. package/src/theme/lib/theme/color/solid/types.ts +0 -24
  109. package/src/theme/lib/theme/color/spot/createSpot.ts +0 -21
  110. package/src/theme/lib/theme/color/spot/index.ts +0 -1
  111. package/src/theme/lib/theme/color/spot/types.ts +0 -28
  112. package/src/theme/lib/theme/color/syntax/index.ts +0 -1
  113. package/src/theme/lib/theme/color/syntax/types.ts +0 -41
  114. package/src/theme/studioTheme/tints.ts +0 -152
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ var jsxRuntime = require('react/jsx-runtime');
7
7
  var react = require('react');
8
8
  var ReactIs = require('react-is');
9
9
  var styled = require('styled-components');
10
- var color$1 = require('@sanity/color');
10
+ var color = require('@sanity/color');
11
11
  var icons = require('@sanity/icons');
12
12
  var Refractor = require('react-refractor');
13
13
  var reactDom$1 = require('@floating-ui/react-dom');
@@ -887,6 +887,15 @@ function hexToRgb(hex) {
887
887
  b: parseInt(hex.slice(5, 7), 16)
888
888
  };
889
889
  }
890
+ function rgbaToRGBA(rgba) {
891
+ const values = rgba.replace(/rgba\(|\)/g, "").split(",");
892
+ return {
893
+ r: parseInt(values[0]),
894
+ g: parseInt(values[1]),
895
+ b: parseInt(values[2]),
896
+ a: parseFloat(values[3])
897
+ };
898
+ }
890
899
  function rgbToHex(_ref2) {
891
900
  let {
892
901
  r,
@@ -1004,1915 +1013,416 @@ function parseColor(color) {
1004
1013
  if (color.startsWith("hsl(")) {
1005
1014
  return hslToRgb(parseHsl(color));
1006
1015
  }
1016
+ if (color.startsWith("rgba(")) {
1017
+ return rgbaToRGBA(color);
1018
+ }
1007
1019
  throw new Error('parseColor: unexpected color format: "'.concat(color, '"'));
1008
1020
  }
1009
1021
  function rgba(color, a) {
1010
1022
  const rgb = parseColor(color);
1011
1023
  return "rgba(".concat(rgb.r, ",").concat(rgb.g, ",").concat(rgb.b, ",").concat(a, ")");
1012
1024
  }
1013
- function createButtonTones(opts, base, dark, solid, muted, mode) {
1014
- return {
1015
- default: opts.button({
1016
- base,
1017
- dark,
1018
- solid: solid.default,
1019
- muted: muted.default,
1020
- mode
1021
- }),
1022
- primary: opts.button({
1023
- base,
1024
- dark,
1025
- solid: solid.primary,
1026
- muted: muted.primary,
1027
- mode
1028
- }),
1029
- positive: opts.button({
1030
- base,
1031
- dark,
1032
- solid: solid.positive,
1033
- muted: muted.positive,
1034
- mode
1035
- }),
1036
- caution: opts.button({
1037
- base,
1038
- dark,
1039
- solid: solid.caution,
1040
- muted: muted.caution,
1041
- mode
1042
- }),
1043
- critical: opts.button({
1044
- base,
1045
- dark,
1046
- solid: solid.critical,
1047
- muted: muted.critical,
1048
- mode
1049
- })
1050
- };
1051
- }
1052
- function createButtonModes(opts, base, dark, solid, muted) {
1053
- return {
1054
- default: createButtonTones(opts, base, dark, solid, muted, "default"),
1055
- ghost: createButtonTones(opts, base, dark, solid, muted, "ghost"),
1056
- bleed: createButtonTones(opts, base, dark, solid, muted, "bleed")
1057
- };
1058
- }
1059
- function createCardStates(opts, base, dark, name, solid, muted) {
1060
- return {
1061
- enabled: opts.card({
1062
- base,
1063
- dark,
1064
- name,
1065
- state: "enabled",
1066
- solid,
1067
- muted
1068
- }),
1069
- disabled: opts.card({
1070
- base,
1071
- dark,
1072
- name,
1073
- state: "disabled",
1074
- solid,
1075
- muted
1076
- }),
1077
- hovered: opts.card({
1078
- base,
1079
- dark,
1080
- name,
1081
- state: "hovered",
1082
- solid,
1083
- muted
1084
- }),
1085
- pressed: opts.card({
1086
- base,
1087
- dark,
1088
- name,
1089
- state: "pressed",
1090
- solid,
1091
- muted
1092
- }),
1093
- selected: opts.card({
1094
- base,
1095
- dark,
1096
- name,
1097
- state: "selected",
1098
- solid,
1099
- muted
1100
- })
1101
- };
1102
- }
1103
- const black = "hsl(0, 0%, 0%)";
1104
- const white = "hsl(0, 0%, 100%)";
1105
- const colors = {
1106
- default: {
1107
- lightest: "hsl(0, 0%, 95%)",
1108
- lighter: "hsl(0, 0%, 70%)",
1109
- light: "hsl(0, 0%, 65%)",
1110
- base: "hsl(0, 0%, 50%)",
1111
- dark: "hsl(0, 0%, 35%)",
1112
- darker: "hsl(0, 0%, 20%)",
1113
- darkest: "hsl(0, 0%, 5%)"
1114
- },
1115
- transparent: {
1116
- lightest: "hsl(240, 100%, 95%)",
1117
- lighter: "hsl(240, 100%, 70%)",
1118
- light: "hsl(240, 100%, 65%)",
1119
- base: "hsl(240, 100%, 50%)",
1120
- dark: "hsl(240, 100%, 35%)",
1121
- darker: "hsl(240, 100%, 20%)",
1122
- darkest: "hsl(240, 100%, 5%)"
1123
- },
1124
- primary: {
1125
- lightest: "hsl(240, 100%, 95%)",
1126
- lighter: "hsl(240, 100%, 70%)",
1127
- light: "hsl(240, 100%, 65%)",
1128
- base: "hsl(240, 100%, 50%)",
1129
- dark: "hsl(240, 100%, 35%)",
1130
- darker: "hsl(240, 100%, 20%)",
1131
- darkest: "hsl(240, 100%, 5%)"
1132
- },
1133
- positive: {
1134
- lightest: "hsl(120, 100%, 95%)",
1135
- lighter: "hsl(120, 100%, 70%)",
1136
- light: "hsl(120, 100%, 65%)",
1137
- base: "hsl(120, 100%, 50%)",
1138
- dark: "hsl(120, 100%, 35%)",
1139
- darker: "hsl(120, 100%, 20%)",
1140
- darkest: "hsl(120, 100%, 5%)"
1141
- },
1142
- caution: {
1143
- lightest: "hsl(60, 100%, 95%)",
1144
- lighter: "hsl(60, 100%, 70%)",
1145
- light: "hsl(60, 100%, 65%)",
1146
- base: "hsl(60, 100%, 50%)",
1147
- dark: "hsl(60, 100%, 35%)",
1148
- darker: "hsl(60, 100%, 20%)",
1149
- darkest: "hsl(60, 100%, 5%)"
1150
- },
1151
- critical: {
1152
- lightest: "hsl(0, 100%, 95%)",
1153
- lighter: "hsl(0, 100%, 70%)",
1154
- light: "hsl(0, 100%, 65%)",
1155
- base: "hsl(0, 100%, 50%)",
1156
- dark: "hsl(0, 100%, 35%)",
1157
- darker: "hsl(0, 100%, 20%)",
1158
- darkest: "hsl(0, 100%, 5%)"
1159
- }
1160
- };
1161
- const spots = {
1162
- gray: "hsl(0, 0%, 50%)",
1163
- red: "hsl(0, 100%, 50%)",
1164
- orange: "hsl(30, 100%, 50%)",
1165
- yellow: "hsl(60, 100%, 50%)",
1166
- green: "hsl(120, 100%, 50%)",
1167
- cyan: "hsl(180, 100%, 50%)",
1168
- blue: "hsl(240, 100%, 50%)",
1169
- purple: "hsl(270, 100%, 50%)",
1170
- magenta: "hsl(300, 100%, 50%)"
1171
- };
1172
- const tones$1 = {
1173
- transparent: {
1174
- bg: [colors.transparent.darkest, colors.transparent.lightest],
1175
- fg: [colors.transparent.lightest, colors.transparent.darkest],
1176
- border: [colors.transparent.darker, colors.transparent.lighter],
1177
- focusRing: [colors.transparent.base, colors.transparent.base]
1178
- },
1179
- primary: {
1180
- bg: [colors.primary.darkest, colors.primary.lightest],
1181
- fg: [colors.primary.lightest, colors.primary.darkest],
1182
- border: [colors.primary.darker, colors.primary.lighter],
1183
- focusRing: [colors.primary.base, colors.primary.base]
1184
- },
1185
- positive: {
1186
- bg: [colors.positive.darkest, colors.positive.lightest],
1187
- fg: [colors.positive.lightest, colors.positive.darkest],
1188
- border: [colors.positive.darker, colors.positive.lighter],
1189
- focusRing: [colors.positive.base, colors.positive.base]
1190
- },
1191
- caution: {
1192
- bg: [colors.caution.darkest, colors.caution.lightest],
1193
- fg: [colors.caution.lightest, colors.caution.darkest],
1194
- border: [colors.caution.darker, colors.caution.lighter],
1195
- focusRing: [colors.caution.base, colors.caution.base]
1196
- },
1197
- critical: {
1198
- bg: [colors.critical.darkest, colors.critical.lightest],
1199
- fg: [colors.critical.lightest, colors.critical.darkest],
1200
- border: [colors.critical.darker, colors.critical.lighter],
1201
- focusRing: [colors.critical.base, colors.critical.base]
1202
- }
1203
- };
1204
- const defaultOpts = {
1205
- base: _ref4 => {
1206
- let {
1207
- dark,
1208
- name
1209
- } = _ref4;
1210
- if (name === "default") {
1211
- return {
1212
- bg: dark ? black : white,
1213
- fg: dark ? white : black,
1214
- border: dark ? colors.default.darkest : colors.default.lightest,
1215
- focusRing: colors.primary.base,
1216
- shadow: {
1217
- outline: black,
1218
- umbra: black,
1219
- penumbra: black,
1220
- ambient: black
1221
- },
1222
- skeleton: {
1223
- from: dark ? white : black,
1224
- to: dark ? white : black
1225
- }
1226
- };
1227
- }
1228
- return {
1229
- bg: tones$1[name].bg[dark ? 0 : 1],
1230
- fg: tones$1[name].fg[dark ? 0 : 1],
1231
- border: tones$1[name].border[dark ? 0 : 1],
1232
- focusRing: tones$1[name].focusRing[dark ? 0 : 1],
1233
- shadow: {
1234
- outline: black,
1235
- umbra: black,
1236
- penumbra: black,
1237
- ambient: black
1238
- },
1239
- skeleton: {
1240
- from: dark ? white : black,
1241
- to: dark ? white : black
1242
- }
1243
- };
1244
- },
1245
- solid: _ref5 => {
1246
- let {
1247
- base,
1248
- dark,
1249
- state,
1250
- tone
1251
- } = _ref5;
1252
- const color = colors[tone];
1253
- if (state === "hovered") {
1254
- return {
1255
- bg: dark ? color.light : color.dark,
1256
- bg2: dark ? color.light : color.dark,
1257
- border: dark ? color.lighter : color.darker,
1258
- fg: dark ? color.darkest : color.lightest,
1259
- iconColor: dark ? color.darkest : color.lightest,
1260
- muted: {
1261
- fg: black
1262
- },
1263
- accent: {
1264
- fg: black
1265
- },
1266
- link: {
1267
- fg: black
1268
- },
1269
- code: {
1270
- bg: black,
1271
- fg: black
1272
- },
1273
- skeleton: base.skeleton
1274
- };
1275
- }
1276
- return {
1277
- bg: color.base,
1278
- bg2: color.base,
1279
- border: dark ? color.light : color.dark,
1280
- fg: dark ? color.darkest : color.lightest,
1281
- iconColor: dark ? color.darkest : color.lightest,
1282
- muted: {
1283
- fg: black
1284
- },
1285
- accent: {
1286
- fg: black
1287
- },
1288
- link: {
1289
- fg: black
1290
- },
1291
- code: {
1292
- bg: black,
1293
- fg: black
1294
- },
1295
- skeleton: base.skeleton
1296
- };
1297
- },
1298
- muted: _ref6 => {
1299
- let {
1300
- base,
1301
- dark,
1302
- state,
1303
- tone
1304
- } = _ref6;
1305
- const color = colors[tone];
1306
- if (state === "hovered") {
1307
- return {
1308
- bg: dark ? color.darker : color.lighter,
1309
- bg2: dark ? color.darker : color.lighter,
1310
- border: dark ? color.lighter : color.darker,
1311
- fg: dark ? color.lightest : color.darkest,
1312
- iconColor: dark ? color.lightest : color.darkest,
1313
- muted: {
1314
- fg: black
1315
- },
1316
- accent: {
1317
- fg: black
1318
- },
1319
- link: {
1320
- fg: black
1321
- },
1322
- code: {
1323
- bg: black,
1324
- fg: black
1325
- },
1326
- skeleton: base.skeleton
1327
- };
1328
- }
1329
- return {
1330
- bg: dark ? color.darkest : color.lightest,
1331
- bg2: dark ? color.darkest : color.lightest,
1332
- border: dark ? color.darker : color.lighter,
1333
- fg: dark ? color.lighter : color.darker,
1334
- iconColor: dark ? color.lighter : color.darker,
1335
- muted: {
1336
- fg: black
1337
- },
1338
- accent: {
1339
- fg: black
1340
- },
1341
- link: {
1342
- fg: black
1343
- },
1344
- code: {
1345
- bg: black,
1346
- fg: black
1347
- },
1348
- skeleton: base.skeleton
1349
- };
1350
- },
1351
- button: _ref7 => {
1352
- let {
1353
- base,
1354
- mode,
1355
- muted,
1356
- solid
1357
- } = _ref7;
1358
- if (mode === "bleed") {
1359
- return {
1360
- ...muted,
1361
- enabled: {
1362
- bg: "transparent",
1363
- bg2: "transparent",
1364
- fg: muted.enabled.fg,
1365
- iconColor: muted.enabled.fg,
1366
- border: "transparent",
1367
- muted: {
1368
- fg: black
1369
- },
1370
- accent: {
1371
- fg: black
1372
- },
1373
- link: {
1374
- fg: black
1375
- },
1376
- code: {
1377
- bg: black,
1378
- fg: black
1379
- },
1380
- skeleton: base.skeleton
1381
- },
1382
- hovered: {
1383
- bg: muted.enabled.bg,
1384
- bg2: muted.enabled.bg,
1385
- fg: muted.hovered.fg,
1386
- iconColor: muted.hovered.fg,
1387
- border: "transparent",
1388
- muted: {
1389
- fg: black
1390
- },
1391
- accent: {
1392
- fg: black
1393
- },
1394
- link: {
1395
- fg: black
1396
- },
1397
- code: {
1398
- bg: black,
1399
- fg: black
1400
- },
1401
- skeleton: base.skeleton
1402
- }
1403
- };
1404
- }
1405
- if (mode === "ghost") return {
1406
- ...solid,
1407
- enabled: muted.enabled
1408
- };
1409
- return solid;
1410
- },
1411
- card: _ref8 => {
1412
- let {
1413
- base
1414
- } = _ref8;
1415
- return {
1416
- bg: black,
1417
- bg2: black,
1418
- fg: black,
1419
- iconColor: black,
1420
- border: black,
1421
- muted: {
1422
- fg: black
1423
- },
1424
- accent: {
1425
- fg: black
1426
- },
1427
- link: {
1428
- fg: black
1429
- },
1430
- code: {
1431
- bg: black,
1432
- fg: black
1433
- },
1434
- skeleton: base.skeleton
1435
- };
1436
- },
1437
- input: () => {
1438
- return {
1439
- bg: black,
1440
- bg2: black,
1441
- fg: black,
1442
- border: black,
1443
- placeholder: black
1444
- };
1445
- },
1446
- selectable: _ref9 => {
1447
- let {
1448
- muted,
1449
- state,
1450
- tone
1451
- } = _ref9;
1452
- return muted[tone][state];
1453
- },
1454
- spot: _ref10 => {
1455
- let {
1456
- key
1457
- } = _ref10;
1458
- return spots[key];
1459
- },
1460
- syntax: () => ({
1461
- atrule: black,
1462
- attrName: black,
1463
- attrValue: black,
1464
- attribute: black,
1465
- boolean: black,
1466
- builtin: black,
1467
- cdata: black,
1468
- char: black,
1469
- class: black,
1470
- className: black,
1471
- comment: black,
1472
- constant: black,
1473
- deleted: black,
1474
- doctype: black,
1475
- entity: black,
1476
- function: black,
1477
- hexcode: black,
1478
- id: black,
1479
- important: black,
1480
- inserted: black,
1481
- keyword: black,
1482
- number: black,
1483
- operator: black,
1484
- prolog: black,
1485
- property: black,
1486
- pseudoClass: black,
1487
- pseudoElement: black,
1488
- punctuation: black,
1489
- regex: black,
1490
- selector: black,
1491
- string: black,
1492
- symbol: black,
1493
- tag: black,
1494
- unit: black,
1495
- url: black,
1496
- variable: black
1497
- })
1498
- };
1499
- function createInputModes(opts, base, dark, solid, muted) {
1500
- return {
1501
- default: {
1502
- enabled: opts.input({
1503
- base,
1504
- dark,
1505
- mode: "default",
1506
- state: "enabled",
1507
- solid: solid.default,
1508
- muted: muted.default
1509
- }),
1510
- disabled: opts.input({
1511
- base,
1512
- dark,
1513
- mode: "default",
1514
- state: "disabled",
1515
- solid: solid.default,
1516
- muted: muted.default
1517
- }),
1518
- hovered: opts.input({
1519
- base,
1520
- dark,
1521
- mode: "default",
1522
- state: "hovered",
1523
- solid: solid.default,
1524
- muted: muted.default
1525
- }),
1526
- readOnly: opts.input({
1527
- base,
1528
- dark,
1529
- mode: "default",
1530
- state: "readOnly",
1531
- solid: solid.default,
1532
- muted: muted.default
1533
- })
1534
- },
1535
- invalid: {
1536
- enabled: opts.input({
1537
- base,
1538
- dark,
1539
- mode: "invalid",
1540
- state: "enabled",
1541
- solid: solid.default,
1542
- muted: muted.default
1543
- }),
1544
- disabled: opts.input({
1545
- base,
1546
- dark,
1547
- mode: "invalid",
1548
- state: "disabled",
1549
- solid: solid.default,
1550
- muted: muted.default
1551
- }),
1552
- hovered: opts.input({
1553
- base,
1554
- dark,
1555
- mode: "invalid",
1556
- state: "hovered",
1557
- solid: solid.default,
1558
- muted: muted.default
1559
- }),
1560
- readOnly: opts.input({
1561
- base,
1562
- dark,
1563
- mode: "invalid",
1564
- state: "readOnly",
1565
- solid: solid.default,
1566
- muted: muted.default
1567
- })
1568
- }
1569
- };
1570
- }
1571
- function createMutedTones(opts, base, dark, name) {
1572
- return {
1573
- default: {
1574
- enabled: opts.muted({
1575
- base,
1576
- dark,
1577
- tone: "default",
1578
- name,
1579
- state: "enabled"
1580
- }),
1581
- disabled: opts.muted({
1582
- base,
1583
- dark,
1584
- tone: "default",
1585
- name,
1586
- state: "disabled"
1587
- }),
1588
- hovered: opts.muted({
1589
- base,
1590
- dark,
1591
- tone: "default",
1592
- name,
1593
- state: "hovered"
1594
- }),
1595
- pressed: opts.muted({
1596
- base,
1597
- dark,
1598
- tone: "default",
1599
- name,
1600
- state: "pressed"
1601
- }),
1602
- selected: opts.muted({
1603
- base,
1604
- dark,
1605
- tone: "default",
1606
- name,
1607
- state: "selected"
1608
- })
1609
- },
1610
- transparent: {
1611
- enabled: opts.muted({
1612
- base,
1613
- dark,
1614
- tone: "transparent",
1615
- name,
1616
- state: "enabled"
1617
- }),
1618
- disabled: opts.muted({
1619
- base,
1620
- dark,
1621
- tone: "transparent",
1622
- name,
1623
- state: "disabled"
1624
- }),
1625
- hovered: opts.muted({
1626
- base,
1627
- dark,
1628
- tone: "transparent",
1629
- name,
1630
- state: "hovered"
1631
- }),
1632
- pressed: opts.muted({
1633
- base,
1634
- dark,
1635
- tone: "transparent",
1636
- name,
1637
- state: "pressed"
1638
- }),
1639
- selected: opts.muted({
1640
- base,
1641
- dark,
1642
- tone: "transparent",
1643
- name,
1644
- state: "selected"
1645
- })
1646
- },
1647
- primary: {
1648
- enabled: opts.muted({
1649
- base,
1650
- dark,
1651
- tone: "primary",
1652
- name,
1653
- state: "enabled"
1654
- }),
1655
- disabled: opts.muted({
1656
- base,
1657
- dark,
1658
- tone: "primary",
1659
- name,
1660
- state: "disabled"
1661
- }),
1662
- hovered: opts.muted({
1663
- base,
1664
- dark,
1665
- tone: "primary",
1666
- name,
1667
- state: "hovered"
1668
- }),
1669
- pressed: opts.muted({
1670
- base,
1671
- dark,
1672
- tone: "primary",
1673
- name,
1674
- state: "pressed"
1675
- }),
1676
- selected: opts.muted({
1677
- base,
1678
- dark,
1679
- tone: "primary",
1680
- name,
1681
- state: "selected"
1682
- })
1683
- },
1684
- positive: {
1685
- enabled: opts.muted({
1686
- base,
1687
- dark,
1688
- tone: "positive",
1689
- name,
1690
- state: "enabled"
1691
- }),
1692
- disabled: opts.muted({
1693
- base,
1694
- dark,
1695
- tone: "positive",
1696
- name,
1697
- state: "disabled"
1698
- }),
1699
- hovered: opts.muted({
1700
- base,
1701
- dark,
1702
- tone: "positive",
1703
- name,
1704
- state: "hovered"
1705
- }),
1706
- pressed: opts.muted({
1707
- base,
1708
- dark,
1709
- tone: "positive",
1710
- name,
1711
- state: "pressed"
1712
- }),
1713
- selected: opts.muted({
1714
- base,
1715
- dark,
1716
- tone: "positive",
1717
- name,
1718
- state: "selected"
1719
- })
1720
- },
1721
- caution: {
1722
- enabled: opts.muted({
1723
- base,
1724
- dark,
1725
- tone: "caution",
1726
- name,
1727
- state: "enabled"
1728
- }),
1729
- disabled: opts.muted({
1730
- base,
1731
- dark,
1732
- tone: "caution",
1733
- name,
1734
- state: "disabled"
1735
- }),
1736
- hovered: opts.muted({
1737
- base,
1738
- dark,
1739
- tone: "caution",
1740
- name,
1741
- state: "hovered"
1742
- }),
1743
- pressed: opts.muted({
1744
- base,
1745
- dark,
1746
- tone: "caution",
1747
- name,
1748
- state: "pressed"
1749
- }),
1750
- selected: opts.muted({
1751
- base,
1752
- dark,
1753
- tone: "caution",
1754
- name,
1755
- state: "selected"
1756
- })
1757
- },
1758
- critical: {
1759
- enabled: opts.muted({
1760
- base,
1761
- dark,
1762
- tone: "critical",
1763
- name,
1764
- state: "enabled"
1765
- }),
1766
- disabled: opts.muted({
1767
- base,
1768
- dark,
1769
- tone: "critical",
1770
- name,
1771
- state: "disabled"
1772
- }),
1773
- hovered: opts.muted({
1774
- base,
1775
- dark,
1776
- tone: "critical",
1777
- name,
1778
- state: "hovered"
1779
- }),
1780
- pressed: opts.muted({
1781
- base,
1782
- dark,
1783
- tone: "critical",
1784
- name,
1785
- state: "pressed"
1786
- }),
1787
- selected: opts.muted({
1788
- base,
1789
- dark,
1790
- tone: "critical",
1791
- name,
1792
- state: "selected"
1793
- })
1794
- }
1795
- };
1796
- }
1797
- function createSelectableTones(opts, base, dark, solid, muted) {
1798
- return {
1799
- default: _createSelectableStates(opts, base, dark, solid, muted, "default"),
1800
- primary: _createSelectableStates(opts, base, dark, solid, muted, "primary"),
1801
- positive: _createSelectableStates(opts, base, dark, solid, muted, "positive"),
1802
- caution: _createSelectableStates(opts, base, dark, solid, muted, "caution"),
1803
- critical: _createSelectableStates(opts, base, dark, solid, muted, "critical")
1804
- };
1805
- }
1806
- function _createSelectableStates(opts, base, dark, solid, muted, tone) {
1807
- return {
1808
- enabled: opts.selectable({
1809
- base,
1810
- dark,
1811
- solid,
1812
- muted,
1813
- state: "enabled",
1814
- tone
1815
- }),
1816
- hovered: opts.selectable({
1817
- base,
1818
- dark,
1819
- solid,
1820
- muted,
1821
- state: "hovered",
1822
- tone
1823
- }),
1824
- pressed: opts.selectable({
1825
- base,
1826
- dark,
1827
- solid,
1828
- muted,
1829
- state: "pressed",
1830
- tone
1831
- }),
1832
- selected: opts.selectable({
1833
- base,
1834
- dark,
1835
- solid,
1836
- muted,
1837
- state: "selected",
1838
- tone
1839
- }),
1840
- disabled: opts.selectable({
1841
- base,
1842
- dark,
1843
- solid,
1844
- muted,
1845
- state: "disabled",
1846
- tone
1847
- })
1848
- };
1849
- }
1850
- function createSolidTones(opts, base, dark, name) {
1851
- return {
1852
- default: {
1853
- enabled: opts.solid({
1854
- base,
1855
- dark,
1856
- tone: "default",
1857
- name,
1858
- state: "enabled"
1859
- }),
1860
- disabled: opts.solid({
1861
- base,
1862
- dark,
1863
- tone: "default",
1864
- name,
1865
- state: "disabled"
1866
- }),
1867
- hovered: opts.solid({
1868
- base,
1869
- dark,
1870
- tone: "default",
1871
- name,
1872
- state: "hovered"
1873
- }),
1874
- pressed: opts.solid({
1875
- base,
1876
- dark,
1877
- tone: "default",
1878
- name,
1879
- state: "pressed"
1880
- }),
1881
- selected: opts.solid({
1882
- base,
1883
- dark,
1884
- tone: "default",
1885
- name,
1886
- state: "selected"
1887
- })
1888
- },
1889
- transparent: {
1890
- enabled: opts.solid({
1891
- base,
1892
- dark,
1893
- tone: "transparent",
1894
- name,
1895
- state: "enabled"
1896
- }),
1897
- disabled: opts.solid({
1898
- base,
1899
- dark,
1900
- tone: "transparent",
1901
- name,
1902
- state: "disabled"
1903
- }),
1904
- hovered: opts.solid({
1905
- base,
1906
- dark,
1907
- tone: "transparent",
1908
- name,
1909
- state: "hovered"
1910
- }),
1911
- pressed: opts.solid({
1912
- base,
1913
- dark,
1914
- tone: "transparent",
1915
- name,
1916
- state: "pressed"
1917
- }),
1918
- selected: opts.solid({
1919
- base,
1920
- dark,
1921
- tone: "transparent",
1922
- name,
1923
- state: "selected"
1924
- })
1925
- },
1926
- primary: {
1927
- enabled: opts.solid({
1928
- base,
1929
- dark,
1930
- tone: "primary",
1931
- name,
1932
- state: "enabled"
1933
- }),
1934
- disabled: opts.solid({
1935
- base,
1936
- dark,
1937
- tone: "primary",
1938
- name,
1939
- state: "disabled"
1940
- }),
1941
- hovered: opts.solid({
1942
- base,
1943
- dark,
1944
- tone: "primary",
1945
- name,
1946
- state: "hovered"
1947
- }),
1948
- pressed: opts.solid({
1949
- base,
1950
- dark,
1951
- tone: "primary",
1952
- name,
1953
- state: "pressed"
1954
- }),
1955
- selected: opts.solid({
1956
- base,
1957
- dark,
1958
- tone: "primary",
1959
- name,
1960
- state: "selected"
1961
- })
1962
- },
1963
- positive: {
1964
- enabled: opts.solid({
1965
- base,
1966
- dark,
1967
- tone: "positive",
1968
- name,
1969
- state: "enabled"
1970
- }),
1971
- disabled: opts.solid({
1972
- base,
1973
- dark,
1974
- tone: "positive",
1975
- name,
1976
- state: "disabled"
1977
- }),
1978
- hovered: opts.solid({
1979
- base,
1980
- dark,
1981
- tone: "positive",
1982
- name,
1983
- state: "hovered"
1984
- }),
1985
- pressed: opts.solid({
1986
- base,
1987
- dark,
1988
- tone: "positive",
1989
- name,
1990
- state: "pressed"
1991
- }),
1992
- selected: opts.solid({
1993
- base,
1994
- dark,
1995
- tone: "positive",
1996
- name,
1997
- state: "selected"
1998
- })
1999
- },
2000
- caution: {
2001
- enabled: opts.solid({
2002
- base,
2003
- dark,
2004
- tone: "caution",
2005
- name,
2006
- state: "enabled"
2007
- }),
2008
- disabled: opts.solid({
2009
- base,
2010
- dark,
2011
- tone: "caution",
2012
- name,
2013
- state: "disabled"
2014
- }),
2015
- hovered: opts.solid({
2016
- base,
2017
- dark,
2018
- tone: "caution",
2019
- name,
2020
- state: "hovered"
2021
- }),
2022
- pressed: opts.solid({
2023
- base,
2024
- dark,
2025
- tone: "caution",
2026
- name,
2027
- state: "pressed"
2028
- }),
2029
- selected: opts.solid({
2030
- base,
2031
- dark,
2032
- tone: "caution",
2033
- name,
2034
- state: "selected"
2035
- })
2036
- },
2037
- critical: {
2038
- enabled: opts.solid({
2039
- base,
2040
- dark,
2041
- tone: "critical",
2042
- name,
2043
- state: "enabled"
2044
- }),
2045
- disabled: opts.solid({
2046
- base,
2047
- dark,
2048
- tone: "critical",
2049
- name,
2050
- state: "disabled"
2051
- }),
2052
- hovered: opts.solid({
2053
- base,
2054
- dark,
2055
- tone: "critical",
2056
- name,
2057
- state: "hovered"
2058
- }),
2059
- pressed: opts.solid({
2060
- base,
2061
- dark,
2062
- tone: "critical",
2063
- name,
2064
- state: "pressed"
2065
- }),
2066
- selected: opts.solid({
2067
- base,
2068
- dark,
2069
- tone: "critical",
2070
- name,
2071
- state: "selected"
2072
- })
2073
- }
2074
- };
2075
- }
2076
- function createSpot(opts, base, dark) {
2077
- return {
2078
- gray: opts.spot({
2079
- base,
2080
- dark,
2081
- key: "gray"
2082
- }),
2083
- blue: opts.spot({
2084
- base,
2085
- dark,
2086
- key: "blue"
2087
- }),
2088
- purple: opts.spot({
2089
- base,
2090
- dark,
2091
- key: "purple"
2092
- }),
2093
- magenta: opts.spot({
2094
- base,
2095
- dark,
2096
- key: "magenta"
2097
- }),
2098
- red: opts.spot({
2099
- base,
2100
- dark,
2101
- key: "red"
2102
- }),
2103
- orange: opts.spot({
2104
- base,
2105
- dark,
2106
- key: "orange"
2107
- }),
2108
- yellow: opts.spot({
2109
- base,
2110
- dark,
2111
- key: "yellow"
2112
- }),
2113
- green: opts.spot({
2114
- base,
2115
- dark,
2116
- key: "green"
2117
- }),
2118
- cyan: opts.spot({
2119
- base,
2120
- dark,
2121
- key: "cyan"
2122
- })
2123
- };
2124
- }
2125
- function createColorTheme() {
2126
- let partialOpts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2127
- const builders = {
2128
- ...defaultOpts,
2129
- ...partialOpts
2130
- };
2131
- return {
2132
- light: _createColorScheme(builders, false),
2133
- dark: _createColorScheme(builders, true)
2134
- };
2135
- }
2136
- function _createColorScheme(opts, dark) {
2137
- return {
2138
- default: _createColor(opts, dark, "default"),
2139
- transparent: _createColor(opts, dark, "transparent"),
2140
- primary: _createColor(opts, dark, "primary"),
2141
- positive: _createColor(opts, dark, "positive"),
2142
- caution: _createColor(opts, dark, "caution"),
2143
- critical: _createColor(opts, dark, "critical")
2144
- };
2145
- }
2146
- function _createColor(opts, dark, name) {
2147
- const base = opts.base({
2148
- dark,
2149
- name
2150
- });
2151
- const solid = createSolidTones(opts, base, dark, name);
2152
- const muted = createMutedTones(opts, base, dark, name);
2153
- return {
2154
- base,
2155
- button: createButtonModes(opts, base, dark, solid, muted),
2156
- card: createCardStates(opts, base, dark, name, solid, muted),
2157
- dark,
2158
- input: createInputModes(opts, base, dark, solid, muted),
2159
- selectable: createSelectableTones(opts, base, dark, solid, muted),
2160
- spot: createSpot(opts, base, dark),
2161
- syntax: opts.syntax({
2162
- base,
2163
- dark
2164
- }),
2165
- solid,
2166
- muted
2167
- };
2168
- }
2169
1025
  function multiply(bg, fg) {
2170
1026
  const b = parseColor(bg);
2171
1027
  const s = parseColor(fg);
2172
1028
  const hex = rgbToHex(multiply$1(b, s));
1029
+ if (s.a) {
1030
+ return rgba(hex, s.a);
1031
+ }
2173
1032
  return hex;
2174
1033
  }
2175
1034
  function screen(bg, fg) {
2176
1035
  const b = parseColor(bg);
2177
1036
  const s = parseColor(fg);
2178
1037
  const hex = rgbToHex(screen$1(b, s));
1038
+ if (s.a) {
1039
+ return rgba(hex, s.a);
1040
+ }
2179
1041
  return hex;
2180
1042
  }
1043
+ const colorKeys = ["text-primary", "text-secondary", "text-inactive",
1044
+ // TODO: Can this be replaced by other of the text colors? It's used by the code html element if it's inside a text
1045
+ "text-code", "text-muted", "text-link", "text-accent", "bg-base", "bg-base-hover", "bg-base-active", "bg-accent", "bg-accent-hover", "bg-accent-active", "bg-tint",
1046
+ // TODO: Can we replace this with bg_tint? It's used by the code html element if it's inside a text
1047
+ "bg-tint-code", "icon-default", "icon-inverted", "border-base", "border-base-hover", "border-accent", "border-accent-inverted",
1048
+ // Colors starting with -base won't be affected by the mix function
1049
+ "base-bg-card",
1050
+ // This is used by the card when a tone is defined, it will also override the bg-base in the rest of the components.
1051
+ "base-bg-raw",
1052
+ // This is the same color as bg-base, but it won't be overridden by the card bg color, used in selectable items.
1053
+ "base-shadow-outline-color", "base-shadow-umbra-color", "base-shadow-penumbra-color", "base-shadow-ambient-color", "base-text-color",
1054
+ // Color used by the buttons for default mode text
1055
+ "skeleton-from", "skeleton-to"];
2181
1056
  const defaultTints = {
2182
1057
  light: {
2183
- text_primary: "900",
2184
- text_secondary: "600",
2185
- text_inactive: "500",
2186
- bg_base: color$1.white,
2187
- bg_base_hover: "50",
2188
- bg_base_active: "100",
2189
- bg_accent: "500",
2190
- bg_accent_hover: "600",
2191
- bg_accent_active: "700",
2192
- bg_tint: "50",
2193
- icon_default: "500",
2194
- icon_inverted: color$1.white,
2195
- border_base: "100",
2196
- border_accent: "500",
2197
- border_accent_inverted: color$1.white
2198
- },
2199
- dark: {
2200
- text_primary: "50",
2201
- text_secondary: "300",
2202
- text_inactive: "400",
2203
- bg_base: color$1.black,
2204
- bg_base_hover: "900",
2205
- bg_base_active: "800",
2206
- bg_accent: "500",
2207
- bg_accent_hover: "400",
2208
- bg_accent_active: "300",
2209
- bg_tint: "900",
2210
- icon_default: "300",
2211
- icon_inverted: color$1.hues.gray[900],
2212
- border_base: "800",
2213
- border_accent: "300",
2214
- border_accent_inverted: color$1.hues.gray[900]
2215
- }
2216
- };
2217
- const colorTints = {
2218
- light: {
2219
- default: {
2220
- ...defaultTints.light,
2221
- bg_accent: "900",
2222
- bg_accent_hover: "950",
2223
- bg_accent_active: color$1.black,
2224
- border_accent: "600"
1058
+ "text-primary": "900",
1059
+ "text-secondary": "600",
1060
+ "text-inactive": "500",
1061
+ "text-code": "600",
1062
+ "text-muted": "600",
1063
+ "text-link": {
1064
+ type: "colorTint",
1065
+ value: color.hues.blue["600"]
2225
1066
  },
2226
- primary: {
2227
- ...defaultTints.light,
2228
- bg_accent: "900",
2229
- bg_accent_hover: "950",
2230
- bg_accent_active: color$1.black,
2231
- border_accent: "600"
1067
+ "text-accent": {
1068
+ type: "colorTint",
1069
+ value: color.hues.red["500"]
2232
1070
  },
2233
- positive: {
2234
- ...defaultTints.light,
2235
- bg_base_hover: color$1.hues.gray[50],
2236
- bg_base_active: "50",
2237
- bg_accent: "400",
2238
- bg_accent_hover: "500",
2239
- bg_accent_active: "600",
2240
- border_accent: "400"
1071
+ "bg-base": {
1072
+ type: "colorTint",
1073
+ value: color.white
2241
1074
  },
2242
- transparent: defaultTints.light,
2243
- caution: defaultTints.light,
2244
- critical: defaultTints.light
2245
- },
2246
- dark: {
2247
- default: {
2248
- ...defaultTints.dark,
2249
- text_primary: color$1.white,
2250
- bg_accent: color$1.white,
2251
- bg_accent_hover: "50",
2252
- bg_accent_active: "100"
1075
+ "bg-base-hover": "50",
1076
+ "bg-base-active": "100",
1077
+ "bg-accent": "500",
1078
+ "bg-accent-hover": "600",
1079
+ "bg-accent-active": "700",
1080
+ "bg-tint": "50",
1081
+ "bg-tint-code": "50",
1082
+ "icon-default": "500",
1083
+ "icon-inverted": {
1084
+ type: "colorTint",
1085
+ value: color.white
2253
1086
  },
2254
- primary: {
2255
- ...defaultTints.dark,
2256
- text_primary: color$1.white,
2257
- bg_accent: color$1.white,
2258
- bg_accent_hover: "50",
2259
- bg_accent_active: "100"
1087
+ "border-base": "100",
1088
+ "border-base-hover": "200",
1089
+ "border-accent": "500",
1090
+ "border-accent-inverted": {
1091
+ type: "colorTint",
1092
+ value: color.white
2260
1093
  },
2261
- positive: {
2262
- ...defaultTints.dark,
2263
- bg_base_hover: color$1.hues.gray[900],
2264
- bg_base_active: "900",
2265
- bg_accent: "400",
2266
- bg_accent_hover: "300",
2267
- bg_accent_active: "200",
2268
- border_accent: "400"
1094
+ "base-bg-card": "50",
1095
+ "base-bg-raw": {
1096
+ type: "colorTint",
1097
+ value: color.white
2269
1098
  },
2270
- transparent: defaultTints.dark,
2271
- caution: defaultTints.dark,
2272
- critical: defaultTints.dark
2273
- }
2274
- };
2275
- const getColorValue = (tints, dark, tone, key) => {
2276
- const value = colorTints[dark ? "dark" : "light"][tone][key];
2277
- if (typeof value === "string") {
2278
- return tints[value];
2279
- }
2280
- return value;
2281
- };
2282
- const getColorHex = (tints, dark, tone, key) => {
2283
- return getColorValue(tints, dark, tone, key).hex;
2284
- };
2285
- const tones = {
2286
- default: color$1.hues.gray,
2287
- transparent: color$1.hues.gray,
2288
- primary: color$1.hues.gray,
2289
- positive: color$1.hues.cyan,
2290
- caution: color$1.hues.yellow,
2291
- critical: color$1.hues.red
2292
- };
2293
- const NEUTRAL_TONES = ["default", "transparent"];
2294
- const color = createColorTheme({
2295
- base: _ref11 => {
2296
- let {
2297
- dark,
2298
- name
2299
- } = _ref11;
2300
- if (name === "default") {
2301
- const tints2 = color$1.hues.gray;
2302
- const skeletonFrom2 = dark ? tints2[900].hex : tints2[100].hex;
2303
- return {
2304
- fg: dark ? color$1.white.hex : color$1.black.hex,
2305
- bg: getColorHex(tones["default"], dark, "default", "bg_base"),
2306
- border: getColorHex(tones["default"], dark, "default", "border_base"),
2307
- focusRing: getColorHex(tones["positive"], dark, "positive", "border_accent"),
2308
- shadow: {
2309
- outline: rgba(tints2[500].hex, 0.4),
2310
- umbra: dark ? rgba(tints2[950].hex, 0.4) : rgba(tints2[500].hex, 0.2),
2311
- penumbra: dark ? rgba(tints2[950].hex, 0.28) : rgba(tints2[500].hex, 0.14),
2312
- ambient: dark ? rgba(tints2[950].hex, 0.24) : rgba(tints2[500].hex, 0.12)
2313
- },
2314
- skeleton: {
2315
- from: skeletonFrom2,
2316
- to: rgba(skeletonFrom2, 0.5)
2317
- }
2318
- };
2319
- }
2320
- if (name === "transparent") {
2321
- const tints2 = tones.default;
2322
- const skeletonFrom2 = tints2[dark ? 800 : 200].hex;
2323
- return {
2324
- fg: tints2[dark ? 100 : 900].hex,
2325
- bg: tints2[dark ? 950 : 50].hex,
2326
- border: tints2[dark ? 800 : 300].hex,
2327
- focusRing: color$1.hues.blue[500].hex,
2328
- shadow: {
2329
- outline: rgba(tints2[500].hex, 0.4),
2330
- umbra: dark ? rgba(tints2[900].hex, 0.4) : rgba(tints2[500].hex, 0.2),
2331
- penumbra: dark ? rgba(tints2[900].hex, 0.28) : rgba(tints2[500].hex, 0.14),
2332
- ambient: dark ? rgba(tints2[900].hex, 0.24) : rgba(tints2[500].hex, 0.12)
2333
- },
2334
- skeleton: {
2335
- from: skeletonFrom2,
2336
- to: rgba(skeletonFrom2, 0.5)
2337
- }
2338
- };
2339
- }
2340
- const tints = tones[name] || tones.default;
2341
- const skeletonFrom = tints[dark ? 800 : 200].hex;
2342
- return {
2343
- fg: tints[dark ? 100 : 900].hex,
2344
- bg: getColorHex(tints, dark, name, "bg_base"),
2345
- border: getColorHex(tints, dark, name, "border_base"),
2346
- focusRing: getColorHex(tints, dark, name, "border_accent"),
2347
- shadow: {
2348
- outline: rgba(tints[500].hex, 0.4),
2349
- umbra: dark ? rgba(tints[900].hex, 0.4) : rgba(tints[500].hex, 0.2),
2350
- penumbra: dark ? rgba(tints[900].hex, 0.28) : rgba(tints[500].hex, 0.14),
2351
- ambient: dark ? rgba(tints[900].hex, 0.24) : rgba(tints[500].hex, 0.12)
2352
- },
2353
- skeleton: {
2354
- from: skeletonFrom,
2355
- to: rgba(skeletonFrom, 0.5)
2356
- }
2357
- };
2358
- },
2359
- solid: _ref12 => {
2360
- let {
2361
- base,
2362
- dark,
2363
- name,
2364
- state,
2365
- tone
2366
- } = _ref12;
2367
- const mix = dark ? screen : multiply;
2368
- const mix2 = dark ? multiply : screen;
2369
- const defaultTints = tones[name] || tones.default;
2370
- const isNeutral = NEUTRAL_TONES.includes(name) && NEUTRAL_TONES.includes(tone);
2371
- let tints = tones[tone === "default" ? name : tone] || defaultTints;
2372
- if (state === "disabled") {
2373
- tints = defaultTints;
2374
- const bg2 = getColorHex(tones.default, dark, "default", "bg_tint");
2375
- const skeletonFrom2 = mix2(bg2, tints[dark ? 200 : 800].hex);
2376
- return {
2377
- bg: bg2,
2378
- bg2: mix2(bg2, tints[dark ? 50 : 950].hex),
2379
- border: getColorHex(tones.default, dark, "default", "bg_base"),
2380
- fg: getColorHex(tones.default, dark, "default", "text_inactive"),
2381
- iconColor: getColorHex(tones.default, dark, "default", "border_base"),
2382
- muted: {
2383
- fg: mix(base.bg, tints[dark ? 950 : 50].hex)
2384
- },
2385
- accent: {
2386
- fg: mix(base.bg, tints[dark ? 950 : 50].hex)
2387
- },
2388
- link: {
2389
- fg: mix(base.bg, tints[dark ? 950 : 50].hex)
2390
- },
2391
- code: {
2392
- bg: bg2,
2393
- fg: mix(base.bg, tints[dark ? 950 : 50].hex)
2394
- },
2395
- skeleton: {
2396
- from: skeletonFrom2,
2397
- to: rgba(skeletonFrom2, 0.5)
2398
- }
2399
- };
2400
- }
2401
- if (state === "hovered") {
2402
- const bg2 = getColorHex(tints, dark, tone, "bg_accent_hover");
2403
- const skeletonFrom2 = mix2(bg2, tints[dark ? 200 : 800].hex);
2404
- return {
2405
- bg: bg2,
2406
- bg2: mix2(bg2, tints[dark ? 50 : 950].hex),
2407
- border: bg2,
2408
- fg: getColorHex(tints, dark, "default", "bg_base"),
2409
- iconColor: getColorHex(tints, dark, "default", "icon_inverted"),
2410
- muted: {
2411
- fg: mix(base.bg, tints[dark ? 800 : 200].hex)
2412
- },
2413
- accent: {
2414
- fg: mix2(bg2, color$1.hues.red[dark ? 800 : 200].hex)
2415
- },
2416
- link: {
2417
- fg: mix2(bg2, color$1.hues.blue[dark ? 800 : 200].hex)
2418
- },
2419
- code: {
2420
- bg: mix(bg2, tints[dark ? 950 : 50].hex),
2421
- fg: mix(base.bg, tints[dark ? 800 : 200].hex)
2422
- },
2423
- skeleton: {
2424
- from: skeletonFrom2,
2425
- to: rgba(skeletonFrom2, 0.5)
2426
- }
2427
- };
2428
- }
2429
- if (state === "pressed") {
2430
- const bg2 = getColorHex(tints, dark, tone, "bg_accent_active");
2431
- const skeletonFrom2 = mix2(bg2, tints[dark ? 200 : 600].hex);
2432
- return {
2433
- bg: bg2,
2434
- bg2: mix2(bg2, tints[dark ? 50 : 950].hex),
2435
- border: bg2,
2436
- fg: getColorHex(tints, dark, "default", "bg_base"),
2437
- iconColor: getColorHex(tints, dark, "default", "icon_inverted"),
2438
- muted: {
2439
- fg: mix(base.bg, tints[dark ? 800 : 200].hex)
2440
- },
2441
- accent: {
2442
- fg: mix2(bg2, color$1.hues.red[dark ? 800 : 200].hex)
2443
- },
2444
- link: {
2445
- fg: mix2(bg2, color$1.hues.blue[dark ? 800 : 200].hex)
2446
- },
2447
- code: {
2448
- bg: mix(bg2, tints[dark ? 950 : 50].hex),
2449
- fg: mix(base.bg, tints[dark ? 800 : 200].hex)
2450
- },
2451
- skeleton: {
2452
- from: skeletonFrom2,
2453
- to: rgba(skeletonFrom2, 0.5)
2454
- }
2455
- };
2456
- }
2457
- if (state === "selected") {
2458
- if (isNeutral) {
2459
- tints = tones.primary;
2460
- }
2461
- const bg2 = mix(base.bg, tints[dark ? 200 : 800].hex);
2462
- const skeletonFrom2 = mix2(bg2, tints[dark ? 200 : 800].hex);
2463
- return {
2464
- bg: bg2,
2465
- bg2: mix2(bg2, tints[dark ? 50 : 950].hex),
2466
- border: bg2,
2467
- fg: getColorHex(tints, dark, "default", "bg_base"),
2468
- iconColor: getColorHex(tints, dark, "default", "icon_inverted"),
2469
- muted: {
2470
- fg: mix(base.bg, tints[dark ? 800 : 200].hex)
2471
- },
2472
- accent: {
2473
- fg: mix2(bg2, color$1.hues.red[dark ? 800 : 200].hex)
2474
- },
2475
- link: {
2476
- fg: mix2(bg2, color$1.hues.blue[dark ? 800 : 200].hex)
2477
- },
2478
- code: {
2479
- bg: mix(bg2, tints[dark ? 950 : 50].hex),
2480
- fg: mix(base.bg, tints[dark ? 800 : 200].hex)
2481
- },
2482
- skeleton: {
2483
- from: skeletonFrom2,
2484
- to: rgba(skeletonFrom2, 0.5)
2485
- }
2486
- };
1099
+ "base-text-color": {
1100
+ type: "colorTint",
1101
+ value: color.white
1102
+ },
1103
+ "base-shadow-outline-color": {
1104
+ type: "colorWithOpacity",
1105
+ tint: "500",
1106
+ opacity: 0.4
1107
+ },
1108
+ "base-shadow-umbra-color": {
1109
+ type: "colorWithOpacity",
1110
+ tint: "500",
1111
+ opacity: 0.2
1112
+ },
1113
+ "base-shadow-penumbra-color": {
1114
+ type: "colorWithOpacity",
1115
+ tint: "500",
1116
+ opacity: 0.14
1117
+ },
1118
+ "base-shadow-ambient-color": {
1119
+ type: "colorWithOpacity",
1120
+ tint: "500",
1121
+ opacity: 0.12
1122
+ },
1123
+ "skeleton-from": "100",
1124
+ "skeleton-to": {
1125
+ type: "colorWithOpacity",
1126
+ tint: "50",
1127
+ opacity: 0.5
2487
1128
  }
2488
- const bg = getColorHex(tints, dark, tone, "bg_accent");
2489
- const skeletonFrom = mix2(bg, tints[dark ? 200 : 800].hex);
2490
- return {
2491
- bg,
2492
- bg2: mix2(bg, tints[dark ? 50 : 950].hex),
2493
- border: bg,
2494
- fg: getColorHex(tints, dark, "default", "bg_base"),
2495
- iconColor: getColorHex(tints, dark, "default", "icon_inverted"),
2496
- muted: {
2497
- fg: mix(base.bg, tints[dark ? 900 : 100].hex)
2498
- },
2499
- accent: {
2500
- fg: mix2(bg, color$1.hues.red[dark ? 900 : 100].hex)
2501
- },
2502
- link: {
2503
- fg: mix2(bg, color$1.hues.blue[dark ? 900 : 100].hex)
2504
- },
2505
- code: {
2506
- bg: mix(bg, tints[dark ? 950 : 50].hex),
2507
- fg: mix(base.bg, tints[dark ? 900 : 100].hex)
2508
- },
2509
- skeleton: {
2510
- from: skeletonFrom,
2511
- to: rgba(skeletonFrom, 0.5)
2512
- }
2513
- };
2514
1129
  },
2515
- muted: _ref13 => {
2516
- let {
2517
- base,
2518
- dark,
2519
- name,
2520
- state,
2521
- tone
2522
- } = _ref13;
2523
- const mix = dark ? screen : multiply;
2524
- const defaultTints = tones[name] || tones.default;
2525
- const isNeutral = NEUTRAL_TONES.includes(name) && NEUTRAL_TONES.includes(tone);
2526
- let tints = tones[tone === "default" ? name : tone] || defaultTints;
2527
- if (state === "disabled") {
2528
- tints = defaultTints;
2529
- const bg2 = base.bg;
2530
- const skeletonFrom2 = mix(bg2, tints[dark ? 900 : 100].hex);
2531
- return {
2532
- bg: bg2,
2533
- bg2: mix(bg2, tints[dark ? 950 : 50].hex),
2534
- border: getColorHex(tones.default, dark, "default", "border_base"),
2535
- fg: getColorHex(tones.default, dark, "default", "text_inactive"),
2536
- iconColor: getColorHex(tones.default, dark, "default", "border_base"),
2537
- muted: {
2538
- fg: getColorHex(tones.default, dark, "default", "text_inactive")
2539
- },
2540
- accent: {
2541
- fg: getColorHex(tints, dark, tone, "text_secondary")
2542
- },
2543
- link: {
2544
- fg: getColorHex(tints, dark, tone, "text_secondary")
2545
- },
2546
- code: {
2547
- bg: bg2,
2548
- fg: getColorHex(tints, dark, tone, "text_secondary")
2549
- },
2550
- skeleton: {
2551
- from: rgba(skeletonFrom2, 0.5),
2552
- to: rgba(skeletonFrom2, 0.25)
2553
- }
2554
- };
2555
- }
2556
- if (state === "hovered") {
2557
- const bg2 = getColorHex(tints, dark, name, "bg_base_hover");
2558
- const skeletonFrom2 = mix(bg2, tints[dark ? 900 : 100].hex);
2559
- return {
2560
- bg: bg2,
2561
- bg2: mix(bg2, tints[dark ? 950 : 50].hex),
2562
- border: mix(bg2, tints[dark ? 900 : 100].hex),
2563
- fg: getColorHex(tints, dark, tone, "text_primary"),
2564
- iconColor: getColorHex(tints, dark, name, "icon_default"),
2565
- muted: {
2566
- fg: getColorHex(tints, dark, tone, "text_secondary")
2567
- },
2568
- accent: {
2569
- fg: mix(base.bg, color$1.hues.red[dark ? 400 : 500].hex)
2570
- },
2571
- link: {
2572
- fg: mix(base.bg, color$1.hues.blue[dark ? 400 : 600].hex)
2573
- },
2574
- code: {
2575
- bg: mix(bg2, tints[dark ? 950 : 50].hex),
2576
- fg: getColorHex(tints, dark, tone, "text_secondary")
2577
- },
2578
- skeleton: {
2579
- from: skeletonFrom2,
2580
- to: rgba(skeletonFrom2, 0.5)
2581
- }
2582
- };
2583
- }
2584
- if (state === "pressed") {
2585
- if (isNeutral) {
2586
- tints = tones.primary;
2587
- }
2588
- const bg2 = getColorHex(tints, dark, name, "bg_base_active");
2589
- const skeletonFrom2 = mix(bg2, getColorHex(tints, dark, name, "bg_base_active"));
2590
- return {
2591
- bg: bg2,
2592
- bg2: mix(bg2, tints[dark ? 950 : 50].hex),
2593
- border: getColorHex(tints, dark, name, "border_base"),
2594
- fg: getColorHex(tints, dark, tone, "text_primary"),
2595
- iconColor: getColorHex(tints, dark, name, "icon_default"),
2596
- muted: {
2597
- fg: getColorHex(tints, dark, tone, "text_secondary")
2598
- },
2599
- accent: {
2600
- fg: mix(bg2, color$1.hues.red[dark ? 400 : 500].hex)
2601
- },
2602
- link: {
2603
- fg: mix(bg2, color$1.hues.blue[dark ? 400 : 600].hex)
2604
- },
2605
- code: {
2606
- bg: mix(bg2, tints[dark ? 950 : 50].hex),
2607
- fg: getColorHex(tints, dark, tone, "text_secondary")
2608
- },
2609
- skeleton: {
2610
- from: skeletonFrom2,
2611
- to: rgba(skeletonFrom2, 0.5)
2612
- }
2613
- };
2614
- }
2615
- if (state === "selected") {
2616
- if (isNeutral) {
2617
- tints = tones.primary;
2618
- }
2619
- const bg2 = mix(base.bg, tints[dark ? 900 : 100].hex);
2620
- const skeletonFrom2 = mix(bg2, tints[dark ? 900 : 100].hex);
2621
- return {
2622
- bg: bg2,
2623
- bg2: mix(bg2, tints[dark ? 950 : 50].hex),
2624
- border: getColorHex(tints, dark, name, "border_base"),
2625
- fg: getColorHex(tints, dark, tone, "text_primary"),
2626
- iconColor: getColorHex(tints, dark, name, "icon_default"),
2627
- muted: {
2628
- fg: getColorHex(tints, dark, tone, "text_secondary")
2629
- },
2630
- accent: {
2631
- fg: mix(bg2, color$1.hues.red[dark ? 400 : 500].hex)
2632
- },
2633
- link: {
2634
- fg: mix(bg2, color$1.hues.blue[dark ? 400 : 600].hex)
2635
- },
2636
- code: {
2637
- bg: mix(bg2, tints[dark ? 950 : 50].hex),
2638
- fg: getColorHex(tints, dark, tone, "text_secondary")
2639
- },
2640
- skeleton: {
2641
- from: skeletonFrom2,
2642
- to: rgba(skeletonFrom2, 0.5)
2643
- }
2644
- };
1130
+ dark: {
1131
+ "text-primary": "50",
1132
+ "text-secondary": "300",
1133
+ "text-inactive": "400",
1134
+ "text-code": "400",
1135
+ "text-muted": "400",
1136
+ "text-link": {
1137
+ type: "colorTint",
1138
+ value: color.hues.blue["400"]
1139
+ },
1140
+ "text-accent": {
1141
+ type: "colorTint",
1142
+ value: color.hues.red["400"]
1143
+ },
1144
+ "bg-base": {
1145
+ type: "colorTint",
1146
+ value: color.black
1147
+ },
1148
+ "bg-base-hover": "900",
1149
+ "bg-base-active": "800",
1150
+ "bg-accent": "500",
1151
+ "bg-accent-hover": "400",
1152
+ "bg-accent-active": "300",
1153
+ "bg-tint": "900",
1154
+ "bg-tint-code": "950",
1155
+ "icon-default": "300",
1156
+ "icon-inverted": {
1157
+ type: "colorTint",
1158
+ value: color.hues.gray[900]
1159
+ },
1160
+ "border-base": "800",
1161
+ "border-base-hover": "700",
1162
+ "border-accent": "300",
1163
+ "border-accent-inverted": {
1164
+ type: "colorTint",
1165
+ value: color.hues.gray[900]
1166
+ },
1167
+ "base-bg-card": "950",
1168
+ "base-text-color": {
1169
+ type: "colorTint",
1170
+ value: color.black
1171
+ },
1172
+ "base-shadow-outline-color": {
1173
+ type: "colorWithOpacity",
1174
+ tint: "500",
1175
+ opacity: 0.4
1176
+ },
1177
+ "base-shadow-umbra-color": {
1178
+ type: "colorWithOpacity",
1179
+ tint: "900",
1180
+ opacity: 0.4
1181
+ },
1182
+ "base-shadow-penumbra-color": {
1183
+ type: "colorWithOpacity",
1184
+ tint: "900",
1185
+ opacity: 0.28
1186
+ },
1187
+ "base-shadow-ambient-color": {
1188
+ type: "colorWithOpacity",
1189
+ tint: "900",
1190
+ opacity: 0.24
1191
+ },
1192
+ "base-bg-raw": {
1193
+ type: "colorTint",
1194
+ value: color.black
1195
+ },
1196
+ "skeleton-from": "900",
1197
+ "skeleton-to": {
1198
+ type: "colorWithOpacity",
1199
+ tint: "50",
1200
+ opacity: 0.5
2645
1201
  }
2646
- const bg = base.bg;
2647
- const skeletonFrom = mix(bg, tints[dark ? 900 : 100].hex);
2648
- return {
2649
- bg,
2650
- bg2: mix(bg, tints[dark ? 950 : 50].hex),
2651
- border: mix(bg, getColorHex(tints, dark, name, "bg_base")),
2652
- fg: getColorHex(tints, dark, tone, "text_primary"),
2653
- iconColor: getColorHex(tints, dark, name, "icon_default"),
2654
- muted: {
2655
- fg: getColorHex(tints, dark, tone, "text_secondary")
1202
+ }
1203
+ };
1204
+ const colorTints = {
1205
+ light: {
1206
+ default: {
1207
+ ...defaultTints.light,
1208
+ "base-bg-card": {
1209
+ type: "colorTint",
1210
+ value: color.white
2656
1211
  },
2657
- accent: {
2658
- fg: mix(base.bg, color$1.hues.red[dark ? 400 : 500].hex)
1212
+ "bg-accent": "900",
1213
+ "bg-accent-hover": "950",
1214
+ "bg-accent-active": {
1215
+ type: "colorTint",
1216
+ value: color.black
2659
1217
  },
2660
- link: {
2661
- fg: mix(base.bg, color$1.hues.blue[dark ? 400 : 600].hex)
1218
+ "border-accent": "600"
1219
+ },
1220
+ primary: {
1221
+ ...defaultTints.light,
1222
+ "bg-accent": "900",
1223
+ "bg-accent-hover": "950",
1224
+ "bg-accent-active": {
1225
+ type: "colorTint",
1226
+ value: color.black
2662
1227
  },
2663
- code: {
2664
- bg: mix(base.bg, tints[dark ? 950 : 50].hex),
2665
- fg: getColorHex(tints, dark, tone, "text_secondary")
1228
+ "border-accent": "600"
1229
+ },
1230
+ positive: {
1231
+ ...defaultTints.light,
1232
+ "bg-base-hover": {
1233
+ type: "colorTint",
1234
+ value: color.hues.gray[50]
2666
1235
  },
2667
- skeleton: {
2668
- from: skeletonFrom,
2669
- to: rgba(skeletonFrom, 0.5)
2670
- }
2671
- };
2672
- },
2673
- button: _ref14 => {
2674
- let {
2675
- base,
2676
- mode,
2677
- muted,
2678
- solid
2679
- } = _ref14;
2680
- if (mode === "bleed") {
2681
- return {
2682
- enabled: {
2683
- ...muted.enabled,
2684
- border: muted.enabled.bg
2685
- },
2686
- hovered: {
2687
- ...muted.hovered,
2688
- border: muted.hovered.bg
2689
- },
2690
- pressed: {
2691
- ...muted.pressed,
2692
- border: muted.pressed.bg
2693
- },
2694
- selected: {
2695
- ...muted.selected,
2696
- border: muted.selected.bg
2697
- },
2698
- disabled: {
2699
- ...muted.disabled,
2700
- border: muted.disabled.bg
2701
- }
2702
- };
2703
- }
2704
- if (mode === "ghost") {
2705
- return {
2706
- ...muted,
2707
- enabled: {
2708
- ...muted.enabled,
2709
- border: base.border
2710
- }
2711
- };
1236
+ "bg-base-active": "50",
1237
+ "bg-accent": "400",
1238
+ "bg-accent-hover": "500",
1239
+ "bg-accent-active": "600",
1240
+ "border-accent": "400"
1241
+ },
1242
+ transparent: defaultTints.light,
1243
+ caution: defaultTints.light,
1244
+ critical: {
1245
+ ...defaultTints.light,
1246
+ "text-inactive": "300"
2712
1247
  }
2713
- return solid;
2714
1248
  },
2715
- card: _ref15 => {
2716
- let {
2717
- base,
2718
- dark,
2719
- muted,
2720
- name,
2721
- solid,
2722
- state
2723
- } = _ref15;
2724
- if (state === "hovered") {
2725
- return muted[name].hovered;
2726
- }
2727
- if (state === "disabled") {
2728
- return muted[name].disabled;
2729
- }
2730
- const isNeutral = NEUTRAL_TONES.includes(name);
2731
- const tints = tones[name] || tones.default;
2732
- const mix = dark ? screen : multiply;
2733
- if (state === "pressed") {
2734
- if (isNeutral) {
2735
- return muted.primary.pressed;
2736
- }
2737
- return muted[name].pressed;
2738
- }
2739
- if (state === "selected") {
2740
- if (isNeutral) {
2741
- return solid.primary.enabled;
2742
- }
2743
- return solid[name].enabled;
2744
- }
2745
- const bg = base.bg;
2746
- const skeletonFrom = mix(base.bg, tints[dark ? 900 : 100].hex);
2747
- return {
2748
- bg,
2749
- bg2: mix(bg, tints[dark ? 950 : 50].hex),
2750
- fg: base.fg,
2751
- iconColor: getColorHex(tints, dark, name, "icon_default"),
2752
- border: base.border,
2753
- muted: {
2754
- fg: mix(base.bg, tints[dark ? 400 : 600].hex)
1249
+ dark: {
1250
+ default: {
1251
+ ...defaultTints.dark,
1252
+ "base-bg-card": {
1253
+ type: "colorTint",
1254
+ value: color.black
2755
1255
  },
2756
- accent: {
2757
- fg: mix(base.bg, color$1.hues.red[dark ? 400 : 500].hex)
1256
+ "text-primary": {
1257
+ type: "colorTint",
1258
+ value: color.white
2758
1259
  },
2759
- link: {
2760
- fg: mix(base.bg, color$1.hues.blue[dark ? 400 : 600].hex)
1260
+ "bg-accent": {
1261
+ type: "colorTint",
1262
+ value: color.white
2761
1263
  },
2762
- code: {
2763
- bg: mix(base.bg, tints[dark ? 950 : 50].hex),
2764
- fg: tints[dark ? 400 : 600].hex
1264
+ "bg-accent-hover": "50",
1265
+ "bg-accent-active": "100",
1266
+ "base-shadow-umbra-color": {
1267
+ type: "colorWithOpacity",
1268
+ tint: "950",
1269
+ opacity: 0.4
2765
1270
  },
2766
- skeleton: {
2767
- from: skeletonFrom,
2768
- to: rgba(skeletonFrom, 0.5)
2769
- }
2770
- };
2771
- },
2772
- input: _ref16 => {
2773
- let {
2774
- base,
2775
- dark,
2776
- mode,
2777
- state
2778
- } = _ref16;
2779
- const mix = dark ? screen : multiply;
2780
- if (mode === "invalid") {
2781
- const tints = tones.critical;
2782
- return {
2783
- bg: mix(base.bg, tints[dark ? 950 : 50].hex),
2784
- bg2: getColorHex(tints, dark, "critical", "text_secondary"),
2785
- fg: mix(base.bg, tints[dark ? 400 : 600].hex),
2786
- border: getColorHex(tints, dark, "critical", "border_base"),
2787
- placeholder: getColorHex(tones.default, !dark, "default", "text_secondary")
2788
- };
2789
- }
2790
- if (state === "hovered") {
2791
- return {
2792
- bg: base.bg,
2793
- bg2: getColorHex(tones.default, dark, "default", "text_secondary"),
2794
- fg: base.fg,
2795
- border: mix(base.bg, color$1.hues.gray[dark ? 700 : 300].hex),
2796
- placeholder: getColorHex(tones.default, !dark, "default", "text_secondary")
2797
- };
2798
- }
2799
- if (state === "disabled") {
2800
- return {
2801
- bg: getColorHex(tones.default, dark, "default", "bg_tint"),
2802
- bg2: getColorHex(tones.default, dark, "default", "border_base"),
2803
- fg: getColorHex(tones.default, dark, "default", "text_secondary"),
2804
- border: getColorHex(tones.default, dark, "default", "border_base"),
2805
- placeholder: getColorHex(tones.default, !dark, "default", "text_secondary")
2806
- };
2807
- }
2808
- if (state === "readOnly") {
2809
- return {
2810
- bg: getColorHex(tones.default, dark, "default", "bg_tint"),
2811
- bg2: getColorHex(tones.default, dark, "default", "border_base"),
2812
- fg: getColorHex(tones.default, dark, "default", "text_secondary"),
2813
- border: getColorHex(tones.default, dark, "default", "border_base"),
2814
- placeholder: getColorHex(tones.default, !dark, "default", "text_secondary")
2815
- };
2816
- }
2817
- return {
2818
- bg: base.bg,
2819
- bg2: getColorHex(tones.default, dark, "default", "text_secondary"),
2820
- fg: base.fg,
2821
- border: base.border,
2822
- placeholder: getColorHex(tones.default, !dark, "default", "text_secondary")
2823
- };
2824
- },
2825
- selectable: _ref17 => {
2826
- let {
2827
- base,
2828
- muted,
2829
- tone,
2830
- solid,
2831
- state
2832
- } = _ref17;
2833
- if (state === "enabled") {
2834
- return {
2835
- ...muted[tone].enabled,
2836
- bg: base.bg
2837
- };
2838
- }
2839
- if (state === "pressed") {
2840
- if (tone === "default") {
2841
- return muted.primary.pressed;
2842
- }
2843
- return muted[tone].pressed;
2844
- }
2845
- if (state === "selected") {
2846
- if (tone === "default") {
2847
- return solid.primary.enabled;
1271
+ "base-shadow-penumbra-color": {
1272
+ type: "colorWithOpacity",
1273
+ tint: "950",
1274
+ opacity: 0.28
1275
+ },
1276
+ "base-shadow-ambient-color": {
1277
+ type: "colorWithOpacity",
1278
+ tint: "950",
1279
+ opacity: 0.24
2848
1280
  }
2849
- return solid[tone].enabled;
2850
- }
2851
- if (state === "disabled") {
2852
- return {
2853
- ...muted[tone].disabled,
2854
- bg: base.bg
2855
- };
1281
+ },
1282
+ primary: {
1283
+ ...defaultTints.dark,
1284
+ "text-primary": {
1285
+ type: "colorTint",
1286
+ value: color.white
1287
+ },
1288
+ "bg-accent": {
1289
+ type: "colorTint",
1290
+ value: color.white
1291
+ },
1292
+ "bg-accent-hover": "50",
1293
+ "bg-accent-active": "100"
1294
+ },
1295
+ positive: {
1296
+ ...defaultTints.dark,
1297
+ "bg-base-hover": {
1298
+ type: "colorTint",
1299
+ value: color.hues.gray[900]
1300
+ },
1301
+ "bg-base-active": "900",
1302
+ "bg-accent": "400",
1303
+ "bg-accent-hover": "300",
1304
+ "bg-accent-active": "200",
1305
+ "border-accent": "400"
1306
+ },
1307
+ transparent: defaultTints.dark,
1308
+ caution: defaultTints.dark,
1309
+ critical: {
1310
+ ...defaultTints.dark,
1311
+ "text-inactive": "700"
2856
1312
  }
2857
- return muted[tone][state];
2858
- },
2859
- spot: _ref18 => {
2860
- let {
2861
- base,
2862
- dark,
2863
- key
2864
- } = _ref18;
2865
- const mix = dark ? screen : multiply;
2866
- return mix(base.bg, color$1.hues[key][dark ? 400 : 500].hex);
2867
- },
2868
- syntax: _ref19 => {
2869
- let {
2870
- base,
2871
- dark
2872
- } = _ref19;
2873
- const mix = dark ? screen : multiply;
2874
- const mainShade = dark ? 400 : 600;
2875
- const secondaryShade = dark ? 600 : 400;
1313
+ }
1314
+ };
1315
+ const getColorValue = (tints, scheme, tone, key) => {
1316
+ const value = colorTints[scheme][tone][key];
1317
+ if (typeof value === "string") {
1318
+ return tints[value];
1319
+ }
1320
+ if (value.type === "colorWithOpacity") {
1321
+ const base = tints[value.tint];
2876
1322
  return {
2877
- atrule: mix(base.bg, color$1.hues.purple[mainShade].hex),
2878
- attrName: mix(base.bg, color$1.hues.green[mainShade].hex),
2879
- attrValue: mix(base.bg, color$1.hues.yellow[mainShade].hex),
2880
- attribute: mix(base.bg, color$1.hues.yellow[mainShade].hex),
2881
- boolean: mix(base.bg, color$1.hues.purple[mainShade].hex),
2882
- builtin: mix(base.bg, color$1.hues.purple[mainShade].hex),
2883
- cdata: mix(base.bg, color$1.hues.yellow[mainShade].hex),
2884
- char: mix(base.bg, color$1.hues.yellow[mainShade].hex),
2885
- class: mix(base.bg, color$1.hues.orange[mainShade].hex),
2886
- className: mix(base.bg, color$1.hues.cyan[mainShade].hex),
2887
- comment: mix(base.bg, color$1.hues.gray[secondaryShade].hex),
2888
- constant: mix(base.bg, color$1.hues.purple[mainShade].hex),
2889
- deleted: mix(base.bg, color$1.hues.red[mainShade].hex),
2890
- doctype: mix(base.bg, color$1.hues.gray[secondaryShade].hex),
2891
- entity: mix(base.bg, color$1.hues.red[mainShade].hex),
2892
- function: mix(base.bg, color$1.hues.green[mainShade].hex),
2893
- hexcode: mix(base.bg, color$1.hues.blue[mainShade].hex),
2894
- id: mix(base.bg, color$1.hues.purple[mainShade].hex),
2895
- important: mix(base.bg, color$1.hues.purple[mainShade].hex),
2896
- inserted: mix(base.bg, color$1.hues.yellow[mainShade].hex),
2897
- keyword: mix(base.bg, color$1.hues.magenta[mainShade].hex),
2898
- number: mix(base.bg, color$1.hues.purple[mainShade].hex),
2899
- operator: mix(base.bg, color$1.hues.magenta[mainShade].hex),
2900
- prolog: mix(base.bg, color$1.hues.gray[secondaryShade].hex),
2901
- property: mix(base.bg, color$1.hues.blue[mainShade].hex),
2902
- pseudoClass: mix(base.bg, color$1.hues.yellow[mainShade].hex),
2903
- pseudoElement: mix(base.bg, color$1.hues.yellow[mainShade].hex),
2904
- punctuation: mix(base.bg, color$1.hues.gray[mainShade].hex),
2905
- regex: mix(base.bg, color$1.hues.blue[mainShade].hex),
2906
- selector: mix(base.bg, color$1.hues.red[mainShade].hex),
2907
- string: mix(base.bg, color$1.hues.yellow[mainShade].hex),
2908
- symbol: mix(base.bg, color$1.hues.purple[mainShade].hex),
2909
- tag: mix(base.bg, color$1.hues.red[mainShade].hex),
2910
- unit: mix(base.bg, color$1.hues.orange[mainShade].hex),
2911
- url: mix(base.bg, color$1.hues.red[mainShade].hex),
2912
- variable: mix(base.bg, color$1.hues.red[mainShade].hex)
1323
+ hex: rgba(base.hex, value.opacity),
1324
+ title: "".concat(base.title, " ").concat(Math.round(value.opacity * 100), "%")
2913
1325
  };
2914
1326
  }
2915
- });
1327
+ return value.value;
1328
+ };
1329
+ const getColorHex = (tints, scheme, tone, key) => {
1330
+ return getColorValue(tints, scheme, tone, key).hex;
1331
+ };
1332
+ const getToneCssVar = (tone, key) => "--".concat(tone, "-").concat(key);
1333
+ const createTonesVariables = function (scheme, tones) {
1334
+ let defaultTone = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "default";
1335
+ let baseBg = arguments.length > 3 ? arguments[3] : undefined;
1336
+ const tonesVariables = {};
1337
+ const keys = Object.keys(tones);
1338
+ const mix = scheme === "dark" ? screen : multiply;
1339
+ const needsMixing = defaultTone !== "default";
1340
+ keys.forEach(_tone => {
1341
+ const tone = _tone == "default" ? defaultTone : _tone;
1342
+ const tint = tones[tone];
1343
+ colorKeys.forEach(key => {
1344
+ const colorHex = getColorHex(tint, scheme, tone, key);
1345
+ const varName = getToneCssVar(_tone, key);
1346
+ const willBeMixed = needsMixing && !key.startsWith("base-");
1347
+ tonesVariables[varName] = willBeMixed ? mix(baseBg, colorHex) : colorHex;
1348
+ });
1349
+ });
1350
+ if (defaultTone !== "default") {
1351
+ tonesVariables[getToneCssVar("default", "bg-base")] = tonesCssVariables.default["base-bg-card"];
1352
+ }
1353
+ return tonesVariables;
1354
+ };
1355
+ const themeNames = ["default", "transparent", "primary", "positive", "caution", "critical"];
1356
+ const tonesCssVariables = themeNames.reduce((acc, tone) => {
1357
+ acc[tone] = colorKeys.reduce((acc2, key) => {
1358
+ acc2[key] = "var(".concat(getToneCssVar(tone, key), ")");
1359
+ return acc2;
1360
+ }, {});
1361
+ return acc;
1362
+ }, {});
1363
+ const mutableCardVariables = {
1364
+ "bg-color": "--card-bg-color",
1365
+ "muted-fg-color": "--card-muted-fg-color",
1366
+ "icon-color": "--card-icon-color",
1367
+ "fg-color": "--card-fg-color",
1368
+ "bg-image": "--card-bg-image",
1369
+ "accent-color": "--card-accent-fg-color"
1370
+ };
1371
+ const mutableVariables = Object.keys(mutableCardVariables).reduce((acc, key) => {
1372
+ const item = key;
1373
+ acc[item] = "var(".concat(mutableCardVariables[item], ")");
1374
+ return acc;
1375
+ }, {});
1376
+ const cardVariables = {
1377
+ "--card-shadow-outline-color": tonesCssVariables.default["base-shadow-outline-color"],
1378
+ "--card-shadow-umbra-color": tonesCssVariables.default["base-shadow-umbra-color"],
1379
+ "--card-shadow-penumbra-color": tonesCssVariables.default["base-shadow-penumbra-color"],
1380
+ "--card-shadow-ambient-color": tonesCssVariables.default["base-shadow-ambient-color"],
1381
+ "--card-focus-ring-color": tonesCssVariables.positive["bg-accent"],
1382
+ "--card-icon-color": tonesCssVariables.default["icon-default"],
1383
+ "--card-bg-image": "inherit",
1384
+ // Card
1385
+ "--card-bg-color": tonesCssVariables.default["bg-base"],
1386
+ "--card-fg-color": tonesCssVariables.default["text-primary"],
1387
+ "--card-muted-fg-color": tonesCssVariables.default["text-secondary"],
1388
+ "--card-accent-fg-color": tonesCssVariables.default["text-accent"],
1389
+ "--card-link-fg-color": tonesCssVariables.default["text-link"],
1390
+ "--card-code-bg-color": tonesCssVariables.default["bg-tint-code"],
1391
+ "--card-code-fg-color": tonesCssVariables.default["text-code"],
1392
+ "--card-skeleton-color-from": tonesCssVariables.default["skeleton-from"],
1393
+ "--card-skeleton-color-to": tonesCssVariables.default["skeleton-to"],
1394
+ // @todo: deprecate
1395
+ "--card-link-color": tonesCssVariables.default["text-link"],
1396
+ "--card-hairline-soft-color": tonesCssVariables.default["border-base"],
1397
+ "--card-hairline-hard-color": tonesCssVariables.default["border-base"],
1398
+ // Card
1399
+ "--card-bg2-color": tonesCssVariables.default["bg-tint"]
1400
+ };
1401
+ const createCssVars = function (scheme, tones) {
1402
+ let defaultTone = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "default";
1403
+ const baseBg = getColorHex(tones[defaultTone], scheme, defaultTone, "base-bg-card");
1404
+ const tonesVars = createTonesVariables(scheme, tones, defaultTone, baseBg);
1405
+ return {
1406
+ ...tonesVars,
1407
+ ...cardVariables
1408
+ };
1409
+ };
1410
+ const cssVars = {
1411
+ ...tonesCssVariables,
1412
+ /**
1413
+ * This variables are mutable, they can be updated by other components.
1414
+ * The main component that updates them is the card, these are the only ones that should be exposed for use from the cards.
1415
+ */
1416
+ mutable: mutableVariables
1417
+ };
1418
+ const tones = {
1419
+ default: color.hues.gray,
1420
+ transparent: color.hues.gray,
1421
+ primary: color.hues.gray,
1422
+ positive: color.hues.cyan,
1423
+ caution: color.hues.yellow,
1424
+ critical: color.hues.red
1425
+ };
2916
1426
  const fonts = {
2917
1427
  code: {
2918
1428
  family: "ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace",
@@ -3132,7 +1642,14 @@ const studioTheme = {
3132
1642
  width: 1
3133
1643
  }
3134
1644
  },
3135
- color,
1645
+ color: {
1646
+ tones,
1647
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1648
+ // @ts-ignore This is necessary until workshop is updated.
1649
+ base: {
1650
+ bg: "#fffff"
1651
+ }
1652
+ },
3136
1653
  container: [320, 640, 960, 1280, 1600, 1920],
3137
1654
  focusRing: {
3138
1655
  offset: 1,
@@ -3231,6 +1748,11 @@ const DEFAULT_THEME_LAYER = {
3231
1748
  zOffset: 200
3232
1749
  }
3233
1750
  };
1751
+ function cssObjectToCssString(rules) {
1752
+ return Object.keys(rules).reduce((acc, key) => {
1753
+ return "".concat(acc).concat(key, ": ").concat(rules[key], "; ");
1754
+ }, "");
1755
+ }
3234
1756
  function getGlobalScope() {
3235
1757
  if (typeof globalThis !== "undefined") return globalThis;
3236
1758
  if (typeof window !== "undefined") return window;
@@ -3239,9 +1761,41 @@ function getGlobalScope() {
3239
1761
  throw new Error("@sanity/ui: could not locate global scope");
3240
1762
  }
3241
1763
  const globalScope = getGlobalScope();
3242
- const key$8 = Symbol.for("@sanity/ui/context/theme");
1764
+ const key$9 = Symbol.for("@sanity/ui/context/theme");
1765
+ globalScope[key$9] = globalScope[key$9] || react.createContext(null);
1766
+ const ThemeContext = globalScope[key$9];
1767
+ const key$8 = Symbol.for("@sanity/ui/context/toneContext");
3243
1768
  globalScope[key$8] = globalScope[key$8] || react.createContext(null);
3244
- const ThemeContext = globalScope[key$8];
1769
+ const ToneContext = globalScope[key$8];
1770
+ function ToneProvider(props) {
1771
+ const {
1772
+ children,
1773
+ scheme,
1774
+ tone
1775
+ } = props;
1776
+ const root = useRootTheme();
1777
+ const value = react.useMemo(() => ({
1778
+ version: 0,
1779
+ scheme: scheme || root.scheme,
1780
+ tone
1781
+ }), [root.scheme, scheme, tone]);
1782
+ return /* @__PURE__ */jsxRuntime.jsx(ToneContext.Provider, {
1783
+ value,
1784
+ children
1785
+ });
1786
+ }
1787
+ var __freeze$E = Object.freeze;
1788
+ var __defProp$F = Object.defineProperty;
1789
+ var __template$E = (cooked, raw) => __freeze$E(__defProp$F(cooked, "raw", {
1790
+ value: __freeze$E(raw || cooked.slice())
1791
+ }));
1792
+ var _a$E;
1793
+ const GlobalVariables = styled.createGlobalStyle(_a$E || (_a$E = __template$E(["\n :root {\n ", "\n }\n"])), _ref4 => {
1794
+ let {
1795
+ $vars
1796
+ } = _ref4;
1797
+ return $vars;
1798
+ });
3245
1799
  function ThemeProvider(props) {
3246
1800
  const parentTheme = react.useContext(ThemeContext);
3247
1801
  const {
@@ -3253,38 +1807,44 @@ function ThemeProvider(props) {
3253
1807
  const theme = react.useMemo(() => {
3254
1808
  if (!themeProp) return null;
3255
1809
  const {
3256
- color: rootColor,
3257
1810
  layer: rootLayer,
3258
1811
  ...restTheme
3259
1812
  } = themeProp;
3260
- const colorScheme = rootColor[scheme] || rootColor.light;
3261
- const color = colorScheme[tone] || colorScheme.default;
3262
1813
  const layer = rootLayer || DEFAULT_THEME_LAYER;
3263
1814
  return {
3264
1815
  sanity: {
3265
1816
  ...restTheme,
3266
- color,
3267
1817
  layer
3268
1818
  }
3269
1819
  };
3270
- }, [scheme, themeProp, tone]);
1820
+ }, [themeProp]);
3271
1821
  const value = react.useMemo(() => themeProp && {
3272
1822
  version: 0,
3273
1823
  theme: themeProp,
3274
1824
  scheme,
3275
1825
  tone
3276
1826
  }, [themeProp, scheme, tone]);
1827
+ const cssVariables = react.useMemo(() => {
1828
+ if (!(themeProp == null ? void 0 : themeProp.color.tones)) return;
1829
+ return cssObjectToCssString(createCssVars(scheme, themeProp == null ? void 0 : themeProp.color.tones));
1830
+ }, [scheme, themeProp == null ? void 0 : themeProp.color.tones]);
3277
1831
  if (!theme) {
3278
1832
  return /* @__PURE__ */jsxRuntime.jsx("pre", {
3279
1833
  children: 'ThemeProvider: no "theme" property provided'
3280
1834
  });
3281
1835
  }
3282
- return /* @__PURE__ */jsxRuntime.jsx(ThemeContext.Provider, {
1836
+ return /* @__PURE__ */jsxRuntime.jsxs(ThemeContext.Provider, {
3283
1837
  value,
3284
- children: /* @__PURE__ */jsxRuntime.jsx(styled.ThemeProvider, {
1838
+ children: [/* @__PURE__ */jsxRuntime.jsx(GlobalVariables, {
1839
+ $vars: cssVariables
1840
+ }), /* @__PURE__ */jsxRuntime.jsx(styled.ThemeProvider, {
3285
1841
  theme,
3286
- children
3287
- })
1842
+ children: /* @__PURE__ */jsxRuntime.jsx(ToneProvider, {
1843
+ tone,
1844
+ scheme,
1845
+ children
1846
+ })
1847
+ })]
3288
1848
  });
3289
1849
  }
3290
1850
  function isRecord(value) {
@@ -3451,7 +2011,17 @@ function useCustomValidity(ref, customValidity) {
3451
2011
  }
3452
2012
  }, [customValidity, ref]);
3453
2013
  }
3454
- const BORDER_VALUE = "1px solid var(--card-border-color)";
2014
+ function useToneContext() {
2015
+ const value = react.useContext(ToneContext);
2016
+ if (!value) {
2017
+ throw new Error("useToneContext(): missing context value");
2018
+ }
2019
+ if (!isRecord(value) || value.version !== 0) {
2020
+ throw new Error("useToneContext(): the context value is not compatible");
2021
+ }
2022
+ return value;
2023
+ }
2024
+ const BORDER_VALUE = "1px solid ".concat(cssVars.default["border-base"]);
3455
2025
  function responsiveBorderStyle() {
3456
2026
  return [border, borderTop, borderRight, borderBottom, borderLeft];
3457
2027
  }
@@ -3707,8 +2277,8 @@ function focusRingStyle(opts) {
3707
2277
  } = opts;
3708
2278
  const focusRingOutsetWidth = focusRing.offset + focusRing.width;
3709
2279
  const focusRingInsetWidth = 0 - focusRing.offset;
3710
- const bgColor = base ? base.bg : "var(--card-bg-color)";
3711
- return [focusRingInsetWidth > 0 && "inset 0 0 0 ".concat(focusRingInsetWidth, "px var(--card-focus-ring-color)"), border && focusRingBorderStyle(border), focusRingInsetWidth < 0 && "0 0 0 ".concat(0 - focusRingInsetWidth, "px ").concat(bgColor), focusRingOutsetWidth > 0 && "0 0 0 ".concat(focusRingOutsetWidth, "px var(--card-focus-ring-color)")].filter(Boolean).join(",");
2280
+ const bgColor = base ? base.bg : cssVars.mutable["bg-color"];
2281
+ return [focusRingInsetWidth > 0 && "inset 0 0 0 ".concat(focusRingInsetWidth, "px ").concat(cssVars.positive["border-accent"]), border && focusRingBorderStyle(border), focusRingInsetWidth < 0 && "0 0 0 ".concat(0 - focusRingInsetWidth, "px ").concat(bgColor), focusRingOutsetWidth > 0 && "0 0 0 ".concat(focusRingOutsetWidth, "px ").concat(cssVars.positive["border-accent"])].filter(Boolean).join(",");
3712
2282
  }
3713
2283
  const GRID_CSS = {
3714
2284
  "&&:not([hidden])": {
@@ -3973,13 +2543,11 @@ function textInputRootStyle() {
3973
2543
  function textInputBaseStyle(props) {
3974
2544
  const {
3975
2545
  theme,
3976
- $scheme,
3977
2546
  $tone,
3978
2547
  $weight
3979
2548
  } = props;
3980
2549
  const font = theme.sanity.fonts.text;
3981
- const color = theme.sanity.color.input;
3982
- 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);
2550
+ 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 --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 "])), font.family, $weight && font.weights[$weight] || font.weights.regular, cssVars[$tone]["text-primary"], cssVars[$tone]["text-inactive"], cssVars[$tone]["text-primary"], cssVars[$tone]["text-inactive"], cssVars[$tone]["text-primary"], cssVars[$tone]["text-inactive"], cssVars.critical["text-primary"], cssVars.critical["text-inactive"], cssVars[$tone]["text-primary"], cssVars[$tone]["text-inactive"]);
3983
2551
  }
3984
2552
  function textInputFontSizeStyle(props) {
3985
2553
  const {
@@ -4001,7 +2569,6 @@ function textInputRepresentationStyle(props) {
4001
2569
  const {
4002
2570
  $hasPrefix,
4003
2571
  $hasSuffix,
4004
- $scheme,
4005
2572
  $tone,
4006
2573
  theme
4007
2574
  } = props;
@@ -4011,26 +2578,22 @@ function textInputRepresentationStyle(props) {
4011
2578
  const {
4012
2579
  focusRing
4013
2580
  } = input.text;
4014
- const color = theme.sanity.color.input;
4015
- return styled.css(_c$d || (_c$d = __template$D(["\n --input-box-shadow: none;\n\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: block;\n pointer-events: none;\n z-index: 0;\n\n background-color: var(--card-bg-color);\n box-shadow: var(--input-box-shadow);\n\n border-top-left-radius: ", ";\n border-bottom-left-radius: ", ";\n border-top-right-radius: ", ";\n border-bottom-right-radius: ", ";\n\n &[data-scheme='", "'][data-tone='", "'] {\n --card-bg-color: ", ";\n --card-fg-color: ", ";\n\n /* enabled */\n *:not(:disabled) + &[data-border] {\n --input-box-shadow: ", ";\n }\n\n /* invalid */\n *:not(:disabled):invalid + & {\n --card-bg-color: ", ";\n --card-fg-color: ", ";\n\n &[data-border] {\n --input-box-shadow: ", ";\n }\n }\n\n /* focused */\n *:not(:disabled):focus + & {\n &[data-border] {\n --input-box-shadow: ", ";\n }\n\n &:not([data-border]) {\n --input-box-shadow: ", ";\n }\n }\n\n /* disabled */\n *:disabled + & {\n --card-bg-color: ", " !important;\n --card-fg-color: ", " !important;\n\n &[data-border] {\n --input-box-shadow: ", ";\n }\n }\n\n /* readOnly */\n *:read-only + & {\n --card-bg-color: ", " !important;\n --card-fg-color: ", " !important;\n }\n\n /* hovered */\n @media (hover: hover) {\n *:not(:disabled):not(:read-only):not(:invalid):hover + & {\n --card-bg-color: ", ";\n --card-fg-color: ", ";\n }\n\n *:not(:disabled):not(:read-only):not(:invalid):not(:focus):hover + &[data-border] {\n --input-box-shadow: ", ";\n }\n }\n }\n "])), $hasPrefix ? 0 : void 0, $hasPrefix ? 0 : void 0, $hasSuffix ? 0 : void 0, $hasSuffix ? 0 : void 0, $scheme, $tone, color.default.enabled.bg, color.default.enabled.fg, focusRingBorderStyle({
4016
- color: color.default.enabled.border,
2581
+ return styled.css(_c$d || (_c$d = __template$D(["\n --input-box-shadow: none;\n\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: block;\n pointer-events: none;\n z-index: 0;\n\n background-color: ", ";\n box-shadow: var(--input-box-shadow);\n\n border-top-left-radius: ", ";\n border-bottom-left-radius: ", ";\n border-top-right-radius: ", ";\n border-bottom-right-radius: ", ";\n\n ", ": ", ";\n ", ": ", ";\n\n /* enabled */\n &[data-border] {\n --input-box-shadow: ", ";\n }\n\n /* invalid */\n *:not(:disabled):invalid + & {\n ", ": ", ";\n ", ": ", ";\n\n &[data-border] {\n --input-box-shadow: ", ";\n }\n }\n\n /* focused */\n *:not(:disabled):focus + & {\n &[data-border] {\n --input-box-shadow: ", ";\n }\n\n &:not([data-border]) {\n --input-box-shadow: ", ";\n }\n }\n\n /* disabled */\n *:disabled + & {\n ", ": ", " !important;\n ", ": ", " !important;\n }\n\n /* readOnly */\n *:read-only + & {\n ", ": ", " !important;\n ", ": ", " !important;\n }\n\n /* hovered */\n @media (hover: hover) {\n\n *:not(:disabled):not(:read-only):not(:invalid):not(:focus):hover + &[data-border] {\n --input-box-shadow: ", ";\n }\n }\n }\n "])), cssVars.mutable["bg-color"], $hasPrefix ? 0 : void 0, $hasPrefix ? 0 : void 0, $hasSuffix ? 0 : void 0, $hasSuffix ? 0 : void 0, mutableCardVariables["bg-color"], cssVars[$tone]["bg-base"], mutableCardVariables["fg-color"], cssVars[$tone]["text-primary"], focusRingBorderStyle({
2582
+ color: cssVars[$tone]["border-base"],
4017
2583
  width: input.border.width
4018
- }), color.invalid.enabled.bg, color.invalid.enabled.fg, focusRingBorderStyle({
4019
- color: color.invalid.enabled.border,
2584
+ }), mutableCardVariables["bg-color"], cssVars.critical["bg-tint"], mutableCardVariables["fg-color"], cssVars.critical["text-primary"], focusRingBorderStyle({
2585
+ color: cssVars.critical["border-base"],
4020
2586
  width: input.border.width
4021
2587
  }), focusRingStyle({
4022
2588
  border: {
4023
- color: color.default.enabled.border,
2589
+ color: cssVars[$tone]["border-base"],
4024
2590
  width: input.border.width
4025
2591
  },
4026
2592
  focusRing
4027
2593
  }), focusRingStyle({
4028
2594
  focusRing
4029
- }), color.default.disabled.bg, color.default.disabled.fg, focusRingBorderStyle({
4030
- color: color.default.disabled.border,
4031
- width: input.border.width
4032
- }), color.default.readOnly.bg, color.default.readOnly.fg, color.default.hovered.bg, color.default.hovered.fg, focusRingBorderStyle({
4033
- color: color.default.hovered.border,
2595
+ }), mutableCardVariables["bg-color"], cssVars.default["bg-tint"], mutableCardVariables["fg-color"], cssVars.default["text-primary"], mutableCardVariables["bg-color"], cssVars.default["bg-tint"], mutableCardVariables["fg-color"], cssVars.default["text-primary"], focusRingBorderStyle({
2596
+ color: cssVars.default["border-base-hover"],
4034
2597
  width: input.border.width
4035
2598
  }));
4036
2599
  }
@@ -4072,10 +2635,10 @@ function toBoxShadow(shadow, color) {
4072
2635
  }
4073
2636
  function shadowStyle(shadow) {
4074
2637
  if (!shadow) return EMPTY_RECORD;
4075
- const outline = "0 0 0 ".concat(rem(1), " var(--card-shadow-outline-color)");
4076
- const umbra = toBoxShadow(shadow.umbra, "var(--card-shadow-umbra-color)");
4077
- const penumbra = toBoxShadow(shadow.penumbra, "var(--card-shadow-penumbra-color)");
4078
- const ambient = toBoxShadow(shadow.ambient, "var(--card-shadow-ambient-color)");
2638
+ const outline = "0 0 0 ".concat(rem(1), " ").concat(cssVars.default["base-shadow-outline-color"]);
2639
+ const umbra = toBoxShadow(shadow.umbra, cssVars.default["base-shadow-umbra-color"]);
2640
+ const penumbra = toBoxShadow(shadow.penumbra, cssVars.default["base-shadow-penumbra-color"]);
2641
+ const ambient = toBoxShadow(shadow.ambient, cssVars.default["base-shadow-ambient-color"]);
4079
2642
  return {
4080
2643
  boxShadow: "".concat(outline, ", ").concat(umbra, ", ").concat(penumbra, ", ").concat(ambient)
4081
2644
  };
@@ -4105,7 +2668,7 @@ function textBaseStyle(props) {
4105
2668
  const {
4106
2669
  weights
4107
2670
  } = theme.sanity.fonts.text;
4108
- 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);
2671
+ return styled.css(_c$c || (_c$c = __template$C(["\n color: ", ";\n\n ", "\n\n ", "\n\n & code {\n font-family: ", ";\n border-radius: 1px;\n background-color: ", ";\n color: ", ";\n }\n\n & a {\n text-decoration: none;\n border-radius: 1px;\n 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 ", ",\n 0 0 0 3px ", ";\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: ", ";\n }\n "])), cssVars.mutable["fg-color"], $accent && styled.css(_a$C || (_a$C = __template$C(["\n color: ", ";\n "])), cssVars.default["text-accent"]), $muted && styled.css(_b$l || (_b$l = __template$C(["\n color: ", ";\n "])), cssVars.mutable["muted-fg-color"]), theme.sanity.fonts.code.family, cssVars.default["bg-tint-code"], cssVars.default["text-code"], cssVars.default["text-link"], cssVars.mutable["bg-color"], cssVars.positive["border-accent"], weights.bold, cssVars.mutable["icon-color"]);
4109
2672
  }
4110
2673
  var __freeze$B = Object.freeze;
4111
2674
  var __defProp$C = Object.defineProperty;
@@ -4146,6 +2709,44 @@ const Text = react.forwardRef(function Text2(props, ref) {
4146
2709
  })
4147
2710
  });
4148
2711
  });
2712
+ const spotColor = {
2713
+ gray: {
2714
+ dark: color.gray["400"],
2715
+ light: color.gray["500"]
2716
+ },
2717
+ blue: {
2718
+ dark: color.blue["400"],
2719
+ light: color.blue["500"]
2720
+ },
2721
+ purple: {
2722
+ dark: color.purple["400"],
2723
+ light: color.purple["500"]
2724
+ },
2725
+ magenta: {
2726
+ dark: color.magenta["400"],
2727
+ light: color.magenta["500"]
2728
+ },
2729
+ red: {
2730
+ dark: color.red["400"],
2731
+ light: color.red["500"]
2732
+ },
2733
+ orange: {
2734
+ dark: color.orange["400"],
2735
+ light: color.orange["500"]
2736
+ },
2737
+ yellow: {
2738
+ dark: color.yellow["400"],
2739
+ light: color.yellow["500"]
2740
+ },
2741
+ green: {
2742
+ dark: color.green["400"],
2743
+ light: color.green["500"]
2744
+ },
2745
+ cyan: {
2746
+ dark: color.cyan["400"],
2747
+ light: color.cyan["500"]
2748
+ }
2749
+ };
4149
2750
  const avatarStyle = {
4150
2751
  root: avatarRootStyle,
4151
2752
  arrow: avatarArrowStyle,
@@ -4204,7 +2805,7 @@ function avatarRootStyle(props) {
4204
2805
  position: "relative",
4205
2806
  boxSizing: "border-box",
4206
2807
  userSelect: "none",
4207
- boxShadow: "0 0 0 1px var(--card-bg-color)",
2808
+ boxShadow: "0 0 0 1px ".concat(cssVars.mutable["bg-color"]),
4208
2809
  '&[data-status="inactive"]': {
4209
2810
  opacity: 0.5
4210
2811
  },
@@ -4258,17 +2859,11 @@ function responsiveAvatarSizeStyle(props) {
4258
2859
  };
4259
2860
  });
4260
2861
  }
4261
- function avatarInitialsStyle(props) {
4262
- const {
4263
- theme
4264
- } = props;
4265
- const {
4266
- base
4267
- } = theme.sanity.color;
2862
+ function avatarInitialsStyle() {
4268
2863
  return {
4269
2864
  width: "100%",
4270
2865
  height: "100%",
4271
- color: base.fg,
2866
+ color: cssVars.default["text-primary"],
4272
2867
  alignItems: "center",
4273
2868
  justifyContent: "center",
4274
2869
  textTransform: "uppercase",
@@ -4282,7 +2877,7 @@ function avatarInitialsStyle(props) {
4282
2877
  function avatarBgStrokeStyle() {
4283
2878
  return {
4284
2879
  strokeWidth: "4px",
4285
- stroke: "var(--card-bg-color)"
2880
+ stroke: cssVars.mutable["bg-color"]
4286
2881
  };
4287
2882
  }
4288
2883
  function avatarStrokeStyle() {
@@ -4316,7 +2911,10 @@ const Avatar = react.forwardRef(function Avatar2(props, ref) {
4316
2911
  const as = ReactIs__default.default.isValidElementType(asProp) ? asProp : "div";
4317
2912
  const size = useArrayProp(sizeProp);
4318
2913
  const theme = useTheme();
4319
- const color = theme.sanity.color.spot[colorKey] || theme.sanity.color.spot.gray;
2914
+ const {
2915
+ scheme
2916
+ } = useToneContext();
2917
+ const color = spotColor[colorKey][scheme].hex;
4320
2918
  const avatarSize = theme.sanity.avatar.sizes[size[0]] || theme.sanity.avatar.sizes[0];
4321
2919
  const _sizeRem = avatarSize.size;
4322
2920
  const _radius = _sizeRem / 2;
@@ -4438,7 +3036,7 @@ function _avatarCounterBaseStyle(props) {
4438
3036
  const {
4439
3037
  theme
4440
3038
  } = props;
4441
- return styled.css(_a$A || (_a$A = __template$A(["\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n user-select: none;\n color: inherit;\n color: var(--card-fg-color);\n background: var(--card-bg-color);\n box-shadow:\n 0 0 0 1px var(--card-bg-color),\n inset 0 0 0 1.5px var(--card-hairline-hard-color);\n padding: 0 ", ";\n\n &:not([hidden]) {\n display: flex;\n }\n "])), rem(theme.sanity.space[2]));
3039
+ return styled.css(_a$A || (_a$A = __template$A(["\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n user-select: none;\n color: inherit;\n color: ", ";\n background: ", ";\n box-shadow:\n 0 0 0 1px ", ",\n inset 0 0 0 1.5px ", ");\n padding: 0 ", ";\n\n &:not([hidden]) {\n display: flex;\n }\n "])), cssVars.mutable["fg-color"], cssVars.mutable["bg-color"], cssVars.mutable["bg-color"], cssVars.default["border-base"], rem(theme.sanity.space[2]));
4442
3040
  }
4443
3041
  const Root$C = styled__default.default.div(_responsiveAvatarCounterSizeStyle, _avatarCounterBaseStyle);
4444
3042
  const AvatarCounter = react.forwardRef(function AvatarCounter2(props, ref) {
@@ -4609,7 +3207,7 @@ function labelBaseStyle(props) {
4609
3207
  const {
4610
3208
  fonts
4611
3209
  } = theme.sanity;
4612
- return styled.css(_c$b || (_c$b = __template$y(["\n text-transform: uppercase;\n\n ", "\n\n ", "\n\n & code {\n font-family: ", ";\n border-radius: 1px;\n }\n\n & a {\n text-decoration: none;\n border-radius: 1px;\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 }\n "])), $accent && styled.css(_a$y || (_a$y = __template$y(["\n color: var(--card-accent-fg-color);\n "]))), $muted && styled.css(_b$k || (_b$k = __template$y(["\n color: var(--card-muted-fg-color);\n "]))), fonts.code.family);
3210
+ return styled.css(_c$b || (_c$b = __template$y(["\n text-transform: uppercase;\n\n ", "\n\n ", "\n\n & code {\n font-family: ", ";\n border-radius: 1px;\n }\n\n & a {\n text-decoration: none;\n border-radius: 1px;\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 }\n "])), $accent && styled.css(_a$y || (_a$y = __template$y(["\n color: ", "};\n "])), cssVars.default["text-accent"]), $muted && styled.css(_b$k || (_b$k = __template$y(["\n color: ", ";\n "])), cssVars.mutable["muted-fg-color"]), fonts.code.family);
4613
3211
  }
4614
3212
  var __freeze$x = Object.freeze;
4615
3213
  var __defProp$y = Object.defineProperty;
@@ -4655,15 +3253,13 @@ const Label = react.forwardRef(function Label2(props, ref) {
4655
3253
  function badgeStyle(props) {
4656
3254
  const {
4657
3255
  $mode,
4658
- $tone,
4659
- theme
3256
+ $tone
4660
3257
  } = props;
4661
- const palette = theme.sanity.color[$mode === "outline" ? "muted" : "solid"];
4662
- const color = palette[$tone] || palette.default;
4663
3258
  return {
4664
- backgroundColor: color.enabled.bg,
4665
- color: color.enabled.fg,
4666
- boxShadow: "inset 0 0 0 1px ".concat(color.enabled.border),
3259
+ // backgroundColor: color.enabled.bg,
3260
+ backgroundColor: $mode === "outline" ? cssVars[$tone]["bg-base"] : cssVars[$tone]["bg-tint"],
3261
+ color: cssVars[$tone]["text-secondary"],
3262
+ boxShadow: $mode === "outline" ? "inset 0 0 0 1px ".concat(cssVars[$tone]["border-base"]) : void 0,
4667
3263
  cursor: "default",
4668
3264
  "&:not([hidden])": {
4669
3265
  display: "inline-block"
@@ -4738,37 +3334,6 @@ const Spinner = react.forwardRef(function Spinner2(props, ref) {
4738
3334
  children: /* @__PURE__ */jsxRuntime.jsx(icons.SpinnerIcon, {})
4739
3335
  });
4740
3336
  });
4741
- function _colorVarsStyle(base, color) {
4742
- let checkered = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
4743
- var _a, _b, _c, _d, _e, _f, _g, _h;
4744
- return {
4745
- // Base
4746
- // @todo: rename to "--base-"?
4747
- "--card-shadow-outline-color": base.shadow.outline,
4748
- "--card-shadow-umbra-color": base.shadow.umbra,
4749
- "--card-shadow-penumbra-color": base.shadow.penumbra,
4750
- "--card-shadow-ambient-color": base.shadow.ambient,
4751
- "--card-focus-ring-color": base.focusRing,
4752
- "--card-icon-color": color.iconColor,
4753
- // Card
4754
- "--card-bg-color": color.bg,
4755
- "--card-bg2-color": color.bg2,
4756
- "--card-bg-image": checkered ? "repeating-conic-gradient(".concat(color.bg, " 0% 25%, ").concat(color.bg2 || color.bg, " 0% 50%)") : void 0,
4757
- "--card-fg-color": color.fg,
4758
- "--card-border-color": color.border,
4759
- "--card-muted-fg-color": (_a = color.muted) == null ? void 0 : _a.fg,
4760
- "--card-accent-fg-color": (_b = color.accent) == null ? void 0 : _b.fg,
4761
- "--card-link-fg-color": (_c = color.link) == null ? void 0 : _c.fg,
4762
- "--card-code-bg-color": (_d = color.code) == null ? void 0 : _d.bg,
4763
- "--card-code-fg-color": (_e = color.code) == null ? void 0 : _e.fg,
4764
- "--card-skeleton-color-from": (_f = color.skeleton) == null ? void 0 : _f.from,
4765
- "--card-skeleton-color-to": (_g = color.skeleton) == null ? void 0 : _g.to,
4766
- // @todo: deprecate
4767
- "--card-link-color": (_h = color.link) == null ? void 0 : _h.fg,
4768
- "--card-hairline-soft-color": color.border,
4769
- "--card-hairline-hard-color": color.border
4770
- };
4771
- }
4772
3337
  var __freeze$v = Object.freeze;
4773
3338
  var __defProp$w = Object.defineProperty;
4774
3339
  var __template$v = (cooked, raw) => __freeze$v(__defProp$w(cooked, "raw", {
@@ -4794,32 +3359,60 @@ function buttonColorStyles(props) {
4794
3359
  var _a2, _b;
4795
3360
  const {
4796
3361
  $mode,
4797
- theme
3362
+ theme,
3363
+ $tone
4798
3364
  } = props;
4799
3365
  const {
4800
3366
  focusRing
4801
3367
  } = theme.sanity.button;
4802
3368
  const shadow = props.$mode !== "bleed";
4803
- const base = theme.sanity.color.base;
4804
- const mode = theme.sanity.color.button[$mode] || theme.sanity.color.button.default;
4805
- const color = mode[props.$tone] || mode.default;
4806
3369
  const border = {
4807
3370
  width: buttonTheme.border.width,
4808
- color: "var(--card-border-color)"
3371
+ color: $mode === "default" ? cssVars[$tone]["bg-accent"] : $mode === "ghost" ? cssVars[$tone]["border-base"] : cssVars[$tone]["bg-base"]
4809
3372
  };
4810
- return [_colorVarsStyle(base, color.enabled), {
4811
- backgroundColor: "var(--card-bg-color)",
4812
- color: "var(--card-fg-color)",
3373
+ return [{
3374
+ // This is going to be used by the text elements inside the button
3375
+ [mutableCardVariables["fg-color"]]: $mode === "default" ? cssVars[$tone]["base-text-color"] : cssVars[$tone]["text-primary"],
3376
+ [mutableCardVariables["muted-fg-color"]]: $mode === "default" ? cssVars[$tone]["base-text-color"] : cssVars[$tone]["text-secondary"],
3377
+ [mutableCardVariables["icon-color"]]: $mode === "default" ? cssVars[$tone]["icon-inverted"] : cssVars[$tone]["icon-default"],
3378
+ [mutableCardVariables["bg-color"]]: $mode === "default" ? cssVars[$tone]["bg-accent"] : cssVars[$tone]["bg-base"],
3379
+ // Override the default variables for elements used inside buttons
3380
+ [getToneCssVar("default", "bg-tint-code")]: $mode === "default" ? cssVars[$tone]["bg-accent"] : cssVars[$tone]["bg-tint-code"],
3381
+ ...($mode === "default" && {
3382
+ [getToneCssVar("default", "text-code")]: cssVars[$tone]["base-text-color"],
3383
+ [getToneCssVar("default", "text-code")]: cssVars[$tone]["base-text-color"],
3384
+ [getToneCssVar("default", "text-link")]: cssVars[$tone]["base-text-color"],
3385
+ [getToneCssVar("default", "text-accent")]: cssVars[$tone]["base-text-color"]
3386
+ }),
3387
+ '&:disabled, &[data-disabled="true"]': {
3388
+ /* Updates the variables for the */
3389
+ [mutableCardVariables["fg-color"]]: cssVars.primary["text-inactive"],
3390
+ [mutableCardVariables["muted-fg-color"]]: cssVars.primary["text-inactive"],
3391
+ [mutableCardVariables["icon-color"]]: cssVars.primary["border-base"],
3392
+ [mutableCardVariables["bg-color"]]: $mode === "default" ? cssVars.primary["bg-tint"] : cssVars.default["bg-base"]
3393
+ }
3394
+ }, {
3395
+ backgroundColor: $mode === "default" ? cssVars[$tone]["bg-accent"] : cssVars[$tone]["bg-base"],
3396
+ color: $mode === "default" ? cssVars[$tone]["base-text-color"] : cssVars[$tone]["text-primary"],
4813
3397
  boxShadow: focusRingBorderStyle(border),
4814
- '&:disabled, &[data-disabled="true"]': _colorVarsStyle(base, color.disabled),
3398
+ '&:disabled, &[data-disabled="true"]': {
3399
+ backgroundColor: $mode === "default" ? cssVars.primary["bg-tint"] : cssVars.default["bg-base"],
3400
+ color: cssVars.primary["text-inactive"],
3401
+ boxShadow: focusRingBorderStyle({
3402
+ ...border,
3403
+ color: $mode === "default" ? cssVars.primary["bg-tint"] : cssVars.primary["border-base"]
3404
+ })
3405
+ },
4815
3406
  "&:not([data-disabled='true'])": {
4816
3407
  boxShadow: combineBoxShadow(focusRingBorderStyle(border), shadow ? defaultBoxShadow : void 0),
4817
3408
  "&:focus": {
4818
3409
  boxShadow: focusRingStyle({
4819
- base,
3410
+ base: {
3411
+ bg: cssVars.positive["border-accent"]
3412
+ },
4820
3413
  border: {
4821
3414
  width: 2,
4822
- color: base.bg
3415
+ color: cssVars.default["bg-base"]
4823
3416
  },
4824
3417
  focusRing
4825
3418
  })
@@ -4828,11 +3421,19 @@ function buttonColorStyles(props) {
4828
3421
  boxShadow: combineBoxShadow(focusRingBorderStyle(border), shadow ? defaultBoxShadow : void 0)
4829
3422
  },
4830
3423
  "@media (hover: hover)": {
4831
- "&:hover": _colorVarsStyle(base, color.hovered),
4832
- "&:active": _colorVarsStyle(base, color.pressed),
4833
- "&[data-hovered]": _colorVarsStyle(base, color.hovered)
3424
+ "&:hover": {
3425
+ backgroundColor: $mode === "default" ? cssVars[$tone]["bg-accent-hover"] : cssVars[$tone]["bg-base-hover"]
3426
+ },
3427
+ "&:active": {
3428
+ backgroundColor: $mode === "default" ? cssVars[$tone]["bg-accent-active"] : cssVars[$tone]["bg-base-active"]
3429
+ },
3430
+ "&[data-hovered]": {
3431
+ backgroundColor: $mode === "default" ? cssVars[$tone]["bg-accent-hover"] : cssVars[$tone]["bg-base-hover"]
3432
+ }
4834
3433
  },
4835
- "&[data-selected]": _colorVarsStyle(base, color.pressed)
3434
+ "&[data-selected]": {
3435
+ backgroundColor: $mode === "default" ? cssVars[$tone]["bg-accent-active"] : cssVars[$tone]["bg-base-active"]
3436
+ }
4836
3437
  }
4837
3438
  }, (_b = (_a2 = theme.sanity.styles) == null ? void 0 : _a2.button) == null ? void 0 : _b.root].filter(Boolean);
4838
3439
  }
@@ -4843,7 +3444,7 @@ var __template$u = (cooked, raw) => __freeze$u(__defProp$v(cooked, "raw", {
4843
3444
  }));
4844
3445
  var _a$u;
4845
3446
  const Root$v = styled__default.default.button(responsiveRadiusStyle, buttonBaseStyles, buttonColorStyles);
4846
- const LoadingBox = styled__default.default.div(_a$u || (_a$u = __template$u(["\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: var(--card-bg-color);\n border-radius: inherit;\n z-index: 1;\n box-shadow: inherit;\n"])));
3447
+ const LoadingBox = styled__default.default.div(_a$u || (_a$u = __template$u(["\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: ", ";\n border-radius: inherit;\n z-index: 1;\n box-shadow: inherit;\n"])), cssVars.mutable["bg-color"]);
4847
3448
  const Button = react.forwardRef(function Button2(props, ref) {
4848
3449
  const {
4849
3450
  children,
@@ -4937,6 +3538,52 @@ const Button = react.forwardRef(function Button2(props, ref) {
4937
3538
  })]
4938
3539
  });
4939
3540
  });
3541
+ function _colorVarStyleDisabled() {
3542
+ let checkered = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
3543
+ return {
3544
+ [getToneCssVar("default", "text-link")]: cssVars.default["text-secondary"],
3545
+ [getToneCssVar("default", "text-accent")]: cssVars.default["text-secondary"],
3546
+ [getToneCssVar("default", "text-code")]: cssVars.default["text-secondary"],
3547
+ [getToneCssVar("default", "text-primary")]: cssVars.default["text-secondary"],
3548
+ [mutableCardVariables["fg-color"]]: cssVars.primary["text-inactive"],
3549
+ [mutableCardVariables["muted-fg-color"]]: cssVars.primary["text-inactive"],
3550
+ [mutableCardVariables["icon-color"]]: cssVars.primary["border-base"],
3551
+ [mutableCardVariables["accent-color"]]: cssVars.primary["base-bg-card"],
3552
+ [mutableCardVariables["bg-color"]]: cssVars.primary["bg-tint"],
3553
+ [mutableCardVariables["bg-image"]]: checkered ? "repeating-conic-gradient(".concat(cssVars.default["base-bg-card"], " 0% 25%, ").concat(cssVars.default["bg-tint"], " 0% 50%)") : void 0
3554
+ };
3555
+ }
3556
+ function _colorVarStyleSelected() {
3557
+ return {
3558
+ [mutableCardVariables["bg-color"]]: cssVars.default["bg-accent"],
3559
+ [mutableCardVariables["fg-color"]]: cssVars.default["bg-base"],
3560
+ [mutableCardVariables["muted-fg-color"]]: cssVars.default["base-bg-card"],
3561
+ [mutableCardVariables["accent-color"]]: cssVars.default["base-bg-card"],
3562
+ [mutableCardVariables["icon-color"]]: cssVars.primary["bg-base"]
3563
+ };
3564
+ }
3565
+ function _colorVarStyleHover() {
3566
+ return {
3567
+ [mutableCardVariables["bg-color"]]: cssVars.default["bg-base-hover"]
3568
+ };
3569
+ }
3570
+ function _colorVarStyleActive() {
3571
+ return {
3572
+ [mutableCardVariables["bg-color"]]: cssVars.default["bg-base-active"]
3573
+ };
3574
+ }
3575
+ function _selectableVarStyle() {
3576
+ return {
3577
+ [mutableCardVariables["bg-color"]]: "inherit",
3578
+ [mutableCardVariables["fg-color"]]: cssVars.default["text-secondary"]
3579
+ };
3580
+ }
3581
+ function _selectableVarStyleDisabled() {
3582
+ return {
3583
+ ..._colorVarStyleDisabled(),
3584
+ [mutableCardVariables["bg-color"]]: void 0
3585
+ };
3586
+ }
4940
3587
  var __freeze$t = Object.freeze;
4941
3588
  var __defProp$u = Object.defineProperty;
4942
3589
  var __template$t = (cooked, raw) => __freeze$t(__defProp$u(cooked, "raw", {
@@ -4952,38 +3599,50 @@ function cardBaseStyle(props) {
4952
3599
  theme
4953
3600
  } = props;
4954
3601
  const space = theme.sanity.space;
4955
- return styled.css(_b$i || (_b$i = __template$t(["\n ", "\n\n &[data-as='button'] {\n -webkit-font-smoothing: inherit;\n appearance: none;\n outline: none;\n font: inherit;\n text-align: inherit;\n border: 0;\n width: stretch;\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n outline: none;\n text-decoration: none;\n }\n\n /* &:is(pre) */\n &[data-as='pre'] {\n font: inherit;\n }\n "])), $checkered && styled.css(_a$t || (_a$t = __template$t(["\n background-size: ", "px ", "px;\n background-position: 50% 50%;\n background-image: var(--card-bg-image);\n "])), space[3], space[3]));
3602
+ return styled.css(_b$i || (_b$i = __template$t(["\n ", "\n\n &[data-as='button'] {\n -webkit-font-smoothing: inherit;\n appearance: none;\n outline: none;\n font: inherit;\n text-align: inherit;\n border: 0;\n width: stretch;\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n outline: none;\n text-decoration: none;\n }\n\n /* &:is(pre) */\n &[data-as='pre'] {\n font: inherit;\n }\n "])), $checkered && styled.css(_a$t || (_a$t = __template$t(["\n background-size: ", "px ", "px;\n background-position: 50% 50%;\n background-image: ", ";\n "])), space[3], space[3], cssVars.mutable["bg-image"]));
4956
3603
  }
4957
3604
  function cardColorStyle(props) {
4958
3605
  var _a2, _b2;
4959
3606
  const {
4960
3607
  $checkered,
4961
3608
  $focusRing,
4962
- theme
3609
+ theme,
3610
+ $tone,
3611
+ $scheme,
3612
+ $updateCssVars
4963
3613
  } = props;
4964
3614
  const {
4965
3615
  focusRing
4966
3616
  } = theme.sanity.card;
4967
- const {
4968
- base,
4969
- card,
4970
- dark
4971
- } = theme.sanity.color;
4972
3617
  const border = {
4973
3618
  width: 0,
4974
- color: "var(--card-border-color)"
3619
+ color: cssVars.positive["border-accent"]
4975
3620
  };
4976
- return styled.css(_c$a || (_c$a = __template$t(["\n color-scheme: ", ";\n\n ", "\n\n background-color: var(--card-bg-color);\n color: var(--card-fg-color);\n\n /* &:is(button) */\n &[data-as='button'] {\n --card-focus-ring-box-shadow: none;\n\n cursor: default;\n box-shadow: var(--card-focus-ring-box-shadow);\n\n &:disabled {\n ", "\n }\n\n &:not(:disabled) {\n &[data-pressed] {\n ", "\n }\n\n &[data-selected] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-pressed]):not([data-selected]) {\n &[data-hovered],\n &:hover {\n ", "\n }\n\n &:active {\n ", "\n }\n }\n }\n\n &:focus {\n --card-focus-ring-box-shadow: ", ";\n }\n\n &:focus:not(:focus-visible) {\n --card-focus-ring-box-shadow: ", ";\n }\n }\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n cursor: pointer;\n box-shadow: var(--card-focus-ring-box-shadow);\n\n &[data-disabled] {\n ", "\n }\n\n &:not([data-disabled]) {\n &[data-pressed] {\n ", "\n }\n\n &[data-selected] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-pressed]):not([data-selected]) {\n &[data-hovered],\n &:hover {\n ", "\n }\n\n &:active {\n ", "\n }\n }\n }\n\n &:focus {\n --card-focus-ring-box-shadow: ", ";\n }\n\n &:focus:not(:focus-visible) {\n --card-focus-ring-box-shadow: ", ";\n }\n }\n }\n\n ", "\n "])), dark ? "dark" : "light", _colorVarsStyle(base, card.enabled, $checkered), _colorVarsStyle(base, card.disabled, $checkered), _colorVarsStyle(base, card.pressed, $checkered), _colorVarsStyle(base, card.selected, $checkered), _colorVarsStyle(base, card.hovered, $checkered), _colorVarsStyle(base, card.pressed, $checkered), $focusRing ? focusRingStyle({
4977
- base,
3621
+ return styled.css(_c$a || (_c$a = __template$t(["\n /* A new css vars context is created, allowing for override of the default tone and changing the scheme */\n ", "\n color-scheme: ", ";\n ", "\n\n background-color: ", ";\n color: ", ";\n\n /* &:is(button) */\n &[data-as='button'] {\n --card-focus-ring-box-shadow: none;\n\n cursor: default;\n box-shadow: var(--card-focus-ring-box-shadow);\n\n &:disabled {\n ", "\n }\n\n &:not(:disabled) {\n &[data-pressed] {\n ", "\n }\n\n &[data-selected] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-pressed]):not([data-selected]) {\n &[data-hovered],\n &:hover {\n ", "\n }\n\n &:active {\n ", "\n }\n }\n }\n\n &:focus {\n --card-focus-ring-box-shadow: ", ";\n }\n\n &:focus:not(:focus-visible) {\n --card-focus-ring-box-shadow: ", ";\n }\n }\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n cursor: pointer;\n box-shadow: var(--card-focus-ring-box-shadow);\n\n &[data-disabled] {\n ", "\n }\n\n &:not([data-disabled]) {\n &[data-pressed] {\n ", "\n }\n\n &[data-selected] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-pressed]):not([data-selected]) {\n &[data-hovered],\n &:hover {\n ", "\n }\n\n &:active {\n ", "\n }\n }\n }\n\n &:focus {\n --card-focus-ring-box-shadow: ", ";\n }\n\n &:focus:not(:focus-visible) {\n --card-focus-ring-box-shadow: ", ";\n }\n }\n }\n\n ", "\n "])), $updateCssVars && createCssVars($scheme, theme.sanity.color.tones, $tone), $scheme === "dark" ? "dark" : "light", $checkered && "--card-bg-image: repeating-conic-gradient(".concat(cssVars.default["base-bg-card"], " 0% 25%, ").concat(cssVars.default["bg-tint"], " 0% 50%)"), cssVars.mutable["bg-color"], cssVars.default["text-primary"], _colorVarStyleDisabled($checkered), _colorVarStyleActive(), _colorVarStyleSelected(), _colorVarStyleHover(), _colorVarStyleActive(), $focusRing ? focusRingStyle({
4978
3622
  border,
4979
3623
  focusRing
4980
- }) : void 0, $focusRing ? focusRingBorderStyle(border) : void 0, _colorVarsStyle(base, card.disabled, $checkered), _colorVarsStyle(base, card.pressed, $checkered), _colorVarsStyle(base, card.selected, $checkered), _colorVarsStyle(base, card.hovered, $checkered), _colorVarsStyle(base, card.pressed, $checkered), $focusRing ? focusRingStyle({
4981
- base,
3624
+ }) : void 0, $focusRing ? focusRingBorderStyle(border) : void 0, _colorVarStyleDisabled($checkered), _colorVarStyleActive(), _colorVarStyleSelected(), _colorVarStyleHover(), _colorVarStyleActive(), $focusRing ? focusRingStyle({
4982
3625
  border,
4983
3626
  focusRing
4984
3627
  }) : void 0, $focusRing ? focusRingBorderStyle(border) : void 0, (_b2 = (_a2 = theme.sanity.styles) == null ? void 0 : _a2.card) == null ? void 0 : _b2.root);
4985
3628
  }
4986
3629
  const Root$u = styled__default.default(Box)(responsiveBorderStyle, responsiveRadiusStyle, responsiveShadowStyle, cardStyle);
3630
+ const Wrapper = _ref5 => {
3631
+ let {
3632
+ shouldAddContext,
3633
+ scheme,
3634
+ tone,
3635
+ children
3636
+ } = _ref5;
3637
+ if (shouldAddContext) {
3638
+ return /* @__PURE__ */jsxRuntime.jsx(ToneProvider, {
3639
+ scheme,
3640
+ tone,
3641
+ children
3642
+ });
3643
+ }
3644
+ return children;
3645
+ };
4987
3646
  const Card = react.forwardRef(function Card2(props, ref) {
4988
3647
  const {
4989
3648
  __unstable_checkered: checkered = false,
@@ -4996,23 +3655,28 @@ const Card = react.forwardRef(function Card2(props, ref) {
4996
3655
  borderLeft,
4997
3656
  pressed,
4998
3657
  radius = 0,
4999
- scheme,
3658
+ scheme: schemeProp,
5000
3659
  selected,
5001
3660
  shadow,
5002
3661
  tone: toneProp = "default",
3662
+ updateCssVars = false,
5003
3663
  ...restProps
5004
3664
  } = props;
5005
3665
  const as = ReactIs.isValidElementType(asProp) ? asProp : "div";
5006
- const rootTheme = useRootTheme();
5007
- const tone = toneProp === "inherit" ? rootTheme.tone : toneProp;
5008
- return /* @__PURE__ */jsxRuntime.jsx(ThemeColorProvider, {
3666
+ const toneContext = useToneContext();
3667
+ const tone = toneProp === "inherit" ? toneContext.tone : toneProp;
3668
+ const scheme = schemeProp != null ? schemeProp : toneContext.scheme;
3669
+ const shouldAddContext = scheme !== toneContext.scheme || tone !== toneContext.tone;
3670
+ return /* @__PURE__ */jsxRuntime.jsx(Wrapper, {
3671
+ shouldAddContext,
5009
3672
  scheme,
5010
3673
  tone,
5011
3674
  children: /* @__PURE__ */jsxRuntime.jsx(Root$u, {
5012
3675
  "data-as": typeof as === "string" ? as : void 0,
5013
- "data-scheme": rootTheme.scheme,
3676
+ "data-scheme": scheme,
5014
3677
  "data-ui": "Card",
5015
3678
  "data-tone": tone,
3679
+ $scheme: scheme != null ? scheme : toneContext.scheme,
5016
3680
  ...restProps,
5017
3681
  $border: useArrayProp(border),
5018
3682
  $borderTop: useArrayProp(borderTop),
@@ -5024,6 +3688,7 @@ const Card = react.forwardRef(function Card2(props, ref) {
5024
3688
  $radius: useArrayProp(radius),
5025
3689
  $shadow: useArrayProp(shadow),
5026
3690
  $tone: tone,
3691
+ $updateCssVars: updateCssVars || shouldAddContext,
5027
3692
  "data-checkered": checkered ? "" : void 0,
5028
3693
  "data-pressed": pressed ? "" : void 0,
5029
3694
  "data-selected": selected ? "" : void 0,
@@ -5046,7 +3711,6 @@ function inputElementStyles(props) {
5046
3711
  const {
5047
3712
  theme
5048
3713
  } = props;
5049
- const color = theme.sanity.color.input;
5050
3714
  const {
5051
3715
  input,
5052
3716
  radius
@@ -5055,37 +3719,37 @@ function inputElementStyles(props) {
5055
3719
  focusRing
5056
3720
  } = input.checkbox;
5057
3721
  return styled.css(_b$h || (_b$h = __template$s(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n outline: none;\n opacity: 0;\n z-index: 1;\n padding: 0;\n margin: 0;\n\n & + span {\n position: relative;\n display: block;\n height: ", ";\n width: ", ";\n box-sizing: border-box;\n box-shadow: ", ";\n border-radius: ", ";\n line-height: 1;\n background-color: ", ";\n\n & > svg {\n display: block;\n position: absolute;\n opacity: 0;\n height: 100%;\n width: 100%;\n\n & > path {\n vector-effect: non-scaling-stroke;\n stroke-width: 1.2 !important;\n }\n }\n }\n &:checked + span {\n background: ", ";\n box-shadow: ", ";\n color: ", ";\n }\n\n /* focus */\n &:not(:disabled):focus:focus-visible + span {\n box-shadow: ", ";\n }\n\n /* focus when checked - uses a different offset */\n &:not(:disabled):focus:focus-visible&:checked + span {\n box-shadow: ", ";\n }\n\n &[data-error] + span {\n background-color: ", ";\n box-shadow: ", ";\n color: ", ";\n }\n &[data-error]&:checked + span {\n background-color: ", ";\n color: ", ";\n }\n &[data-error]&:checked&:not(:disabled):focus:focus-visible + span {\n box-shadow: ", ";\n }\n\n &:disabled + span {\n background-color: ", ";\n box-shadow: ", ";\n color: ", ";\n }\n &:disabled&:checked + span {\n background-color: ", ";\n }\n\n &[data-read-only] + span {\n background-color: ", ";\n box-shadow: ", ";\n color: ", ";\n }\n\n &[data-read-only]&:checked + span {\n background-color: ", ";\n }\n\n &:checked + span > svg:first-child {\n opacity: 1;\n }\n &:indeterminate + span > svg:last-child {\n opacity: 1;\n }\n "])), rem(input.checkbox.size), rem(input.checkbox.size), focusRingBorderStyle({
5058
- color: color.default.enabled.border,
3722
+ color: cssVars.default["border-base"],
5059
3723
  width: input.border.width
5060
- }), rem(radius[2]), color.default.enabled.bg, color.default.enabled.bg2, focusRingBorderStyle({
5061
- color: color.default.enabled.bg2,
3724
+ }), rem(radius[2]), cssVars.default["bg-base"], cssVars.default["text-secondary"], focusRingBorderStyle({
3725
+ color: cssVars.default["text-secondary"],
5062
3726
  width: input.border.width
5063
- }), color.default.enabled.bg, focusRingStyle({
3727
+ }), cssVars.default["bg-base"], focusRingStyle({
5064
3728
  focusRing
5065
3729
  }), focusRingStyle({
5066
3730
  focusRing: {
5067
3731
  width: 1,
5068
3732
  offset: 1
5069
3733
  }
5070
- }), color.invalid.enabled.border, focusRingBorderStyle({
3734
+ }), cssVars.critical["border-base"], focusRingBorderStyle({
5071
3735
  width: input.border.width,
5072
- color: color.invalid.enabled.bg2
5073
- }), color.default.disabled.fg, color.invalid.enabled.bg2, color.default.enabled.bg, focusRingStyle({
3736
+ color: cssVars.critical["text-secondary"]
3737
+ }), cssVars.default["text-secondary"], cssVars.critical["text-secondary"], cssVars.default["bg-base"], focusRingStyle({
5074
3738
  border: {
5075
3739
  width: input.border.width,
5076
- color: color.invalid.readOnly.bg2
3740
+ color: cssVars.critical["text-secondary"]
5077
3741
  },
5078
3742
  focusRing: {
5079
3743
  width: 1,
5080
3744
  offset: 1
5081
3745
  }
5082
- }), color.default.disabled.bg, focusRingBorderStyle({
3746
+ }), cssVars.default["bg-tint"], focusRingBorderStyle({
5083
3747
  width: input.border.width,
5084
- color: color.default.disabled.border
5085
- }), color.default.disabled.fg, color.default.disabled.bg2, color.default.readOnly.bg, focusRingBorderStyle({
3748
+ color: cssVars.default["border-base"]
3749
+ }), cssVars.default["text-secondary"], cssVars.default["border-base"], cssVars.default["bg-tint"], focusRingBorderStyle({
5086
3750
  width: input.border.width,
5087
- color: color.default.readOnly.border
5088
- }), color.default.readOnly.fg, color.default.readOnly.bg2);
3751
+ color: cssVars.default["border-base"]
3752
+ }), cssVars.default["text-secondary"], cssVars.default["border-base"]);
5089
3753
  }
5090
3754
  const Root$t = styled__default.default.div(checkboxBaseStyles);
5091
3755
  const Input$5 = styled__default.default.input(inputElementStyles);
@@ -5131,124 +3795,123 @@ var __template$r = (cooked, raw) => __freeze$r(__defProp$s(cooked, "raw", {
5131
3795
  value: __freeze$r(raw || cooked.slice())
5132
3796
  }));
5133
3797
  var _a$r;
5134
- function codeSyntaxHighlightingStyle(_ref20) {
5135
- let {
5136
- theme
5137
- } = _ref20;
5138
- const color = theme.sanity.color.syntax;
3798
+ function codeSyntaxHighlightingStyle(scheme) {
3799
+ const dark = scheme === "dark";
3800
+ const mainShade = dark ? 400 : 600;
3801
+ const secondaryShade = dark ? 600 : 400;
5139
3802
  return {
5140
3803
  "&.atrule": {
5141
- color: color.atrule
3804
+ color: color.purple[mainShade].hex
5142
3805
  },
5143
3806
  "&.attr-name": {
5144
- color: color.attrName
3807
+ color: color.green[mainShade].hex
5145
3808
  },
5146
3809
  "&.attr-value": {
5147
- color: color.attrValue
3810
+ color: color.yellow[mainShade].hex
5148
3811
  },
5149
3812
  "&.attribute": {
5150
- color: color.attribute
3813
+ color: color.yellow[mainShade].hex
5151
3814
  },
5152
3815
  "&.boolean": {
5153
- color: color.boolean
3816
+ color: color.purple[mainShade].hex
5154
3817
  },
5155
3818
  "&.builtin": {
5156
- color: color.builtin
3819
+ color: color.purple[mainShade].hex
5157
3820
  },
5158
3821
  "&.cdata": {
5159
- color: color.cdata
3822
+ color: color.yellow[mainShade].hex
5160
3823
  },
5161
3824
  "&.char": {
5162
- color: color.char
3825
+ color: color.yellow[mainShade].hex
5163
3826
  },
5164
3827
  "&.class": {
5165
- color: color.class
3828
+ color: color.orange[mainShade].hex
5166
3829
  },
5167
3830
  "&.class-name": {
5168
- color: color.className
3831
+ color: color.cyan[mainShade].hex
5169
3832
  },
5170
3833
  "&.comment": {
5171
- color: color.comment
3834
+ color: color.gray[secondaryShade].hex
5172
3835
  },
5173
3836
  "&.constant": {
5174
- color: color.constant
3837
+ color: color.purple[mainShade].hex
5175
3838
  },
5176
3839
  "&.deleted": {
5177
- color: color.deleted
3840
+ color: color.red[mainShade].hex
5178
3841
  },
5179
3842
  "&.doctype": {
5180
- color: color.doctype
3843
+ color: color.gray[secondaryShade].hex
5181
3844
  },
5182
3845
  "&.entity": {
5183
- color: color.entity
3846
+ color: color.red[mainShade].hex
5184
3847
  },
5185
3848
  "&.function": {
5186
- color: color.function
3849
+ color: color.green[mainShade].hex
5187
3850
  },
5188
3851
  "&.hexcode": {
5189
- color: color.hexcode
3852
+ color: color.blue[mainShade].hex
5190
3853
  },
5191
3854
  "&.id": {
5192
- color: color.id
3855
+ color: color.purple[mainShade].hex
5193
3856
  },
5194
3857
  "&.important": {
5195
- color: color.important
3858
+ color: color.purple[mainShade].hex
5196
3859
  },
5197
3860
  "&.inserted": {
5198
- color: color.inserted
3861
+ color: color.yellow[mainShade].hex
5199
3862
  },
5200
3863
  "&.keyword": {
5201
- color: color.keyword
3864
+ color: color.magenta[mainShade].hex
5202
3865
  },
5203
3866
  "&.number": {
5204
- color: color.number
3867
+ color: color.purple[mainShade].hex
5205
3868
  },
5206
3869
  "&.operator": {
5207
- color: color.operator
3870
+ color: color.magenta[mainShade].hex
5208
3871
  },
5209
3872
  "&.prolog": {
5210
- color: color.prolog
3873
+ color: color.gray[secondaryShade].hex
5211
3874
  },
5212
3875
  "&.property": {
5213
- color: color.property
3876
+ color: color.blue[mainShade].hex
5214
3877
  },
5215
3878
  "&.pseudo-class": {
5216
- color: color.pseudoClass
3879
+ color: color.yellow[mainShade].hex
5217
3880
  },
5218
3881
  "&.pseudo-element": {
5219
- color: color.pseudoElement
3882
+ color: color.yellow[mainShade].hex
5220
3883
  },
5221
3884
  "&.punctuation": {
5222
- color: color.punctuation
3885
+ color: color.gray[mainShade].hex
5223
3886
  },
5224
3887
  "&.regex": {
5225
- color: color.regex
3888
+ color: color.blue[mainShade].hex
5226
3889
  },
5227
3890
  "&.selector": {
5228
- color: color.selector
3891
+ color: color.red[mainShade].hex
5229
3892
  },
5230
3893
  "&.string": {
5231
- color: color.string
3894
+ color: color.yellow[mainShade].hex
5232
3895
  },
5233
3896
  "&.symbol": {
5234
- color: color.symbol
3897
+ color: color.purple[mainShade].hex
5235
3898
  },
5236
3899
  "&.tag": {
5237
- color: color.tag
3900
+ color: color.red[mainShade].hex
5238
3901
  },
5239
3902
  "&.unit": {
5240
- color: color.unit
3903
+ color: color.orange[mainShade].hex
5241
3904
  },
5242
3905
  "&.url": {
5243
- color: color.url
3906
+ color: color.red[mainShade].hex
5244
3907
  },
5245
3908
  "&.variable": {
5246
- color: color.variable
3909
+ color: color.red[mainShade].hex
5247
3910
  }
5248
3911
  };
5249
3912
  }
5250
- function codeBaseStyle() {
5251
- return styled.css(_a$r || (_a$r = __template$r(["\n color: var(--card-code-fg-color);\n\n & code {\n font-family: inherit;\n\n &.refractor .token {\n ", "\n }\n }\n\n & a {\n color: inherit;\n text-decoration: underline;\n border-radius: 1px;\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 }\n "])), codeSyntaxHighlightingStyle);
3913
+ function codeBaseStyle(props) {
3914
+ return styled.css(_a$r || (_a$r = __template$r(["\n color: ", ";\n\n & code {\n font-family: inherit;\n\n &.refractor .token {\n ", "\n }\n }\n\n & a {\n color: inherit;\n text-decoration: underline;\n border-radius: 1px;\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 }\n "])), cssVars.default["text-code"], codeSyntaxHighlightingStyle(props.$scheme));
5252
3915
  }
5253
3916
  const Root$s = styled__default.default.pre(codeBaseStyle, responsiveCodeFontStyle);
5254
3917
  const Code = react.forwardRef(function Code2(props, ref) {
@@ -5261,12 +3924,16 @@ const Code = react.forwardRef(function Code2(props, ref) {
5261
3924
  } = props;
5262
3925
  const language = typeof languageProp === "string" ? languageProp : void 0;
5263
3926
  const registered = language ? Refractor__default.default.hasLanguage(language) : false;
3927
+ const {
3928
+ scheme
3929
+ } = useToneContext();
5264
3930
  return /* @__PURE__ */jsxRuntime.jsxs(Root$s, {
5265
3931
  "data-ui": "Code",
5266
3932
  ...restProps,
5267
3933
  $size: useArrayProp(size),
5268
3934
  $weight: weight,
5269
3935
  ref,
3936
+ $scheme: scheme,
5270
3937
  children: [!(language && registered) && /* @__PURE__ */jsxRuntime.jsx("code", {
5271
3938
  children
5272
3939
  }), language && registered && /* @__PURE__ */jsxRuntime.jsx(Refractor__default.default, {
@@ -5354,7 +4021,7 @@ function headingBaseStyle(props) {
5354
4021
  $muted,
5355
4022
  theme
5356
4023
  } = props;
5357
- return styled.css(_c$9 || (_c$9 = __template$q(["\n ", "\n\n ", "\n\n & code {\n font-family: ", ";\n border-radius: 1px;\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 & 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 }\n "])), $accent && styled.css(_a$q || (_a$q = __template$q(["\n color: var(--card-accent-fg-color);\n "]))), $muted && styled.css(_b$g || (_b$g = __template$q(["\n color: var(--card-muted-fg-color);\n "]))), theme.sanity.fonts.code.family);
4024
+ return styled.css(_c$9 || (_c$9 = __template$q(["\n ", "\n\n ", "\n\n & code {\n font-family: ", ";\n border-radius: 1px;\n }\n\n & a {\n text-decoration: none;\n border-radius: 1px;\n 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 ", ",\n 0 0 0 3px ", ";\n }\n\n &:focus:not(:focus-visible) {\n box-shadow: none;\n }\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 }\n "])), $accent && styled.css(_a$q || (_a$q = __template$q(["\n color: ", "};\n "])), cssVars.default["text-accent"]), $muted && styled.css(_b$g || (_b$g = __template$q(["\n color: ", ";\n "])), cssVars.mutable["muted-fg-color"]), theme.sanity.fonts.code.family, cssVars.default["text-link"], cssVars.mutable["bg-color"], cssVars.positive["border-accent"]);
5358
4025
  }
5359
4026
  var __freeze$p = Object.freeze;
5360
4027
  var __defProp$q = Object.defineProperty;
@@ -5448,7 +4115,7 @@ var __template$o = (cooked, raw) => __freeze$o(__defProp$p(cooked, "raw", {
5448
4115
  }));
5449
4116
  var _a$o;
5450
4117
  function kbdStyle() {
5451
- return styled.css(_a$o || (_a$o = __template$o(["\n background: var(--card-bg2-color);\n font: inherit;\n\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
4118
+ return styled.css(_a$o || (_a$o = __template$o(["\n background: ", ";\n font: inherit;\n\n &:not([hidden]) {\n display: inline-block;\n }\n "])), cssVars.default["bg-tint"]);
5452
4119
  }
5453
4120
  const Root$n = styled__default.default.kbd(responsiveRadiusStyle, kbdStyle);
5454
4121
  const KBD = react.forwardRef(function KBD2(props, ref) {
@@ -6188,8 +4855,8 @@ var __template$l = (cooked, raw) => __freeze$l(__defProp$l(cooked, "raw", {
6188
4855
  }));
6189
4856
  var _a$l, _b$e, _c$8;
6190
4857
  const Root$j = styled__default.default.div(_a$l || (_a$l = __template$l(["\n position: absolute;\n pointer-events: none;\n width: ", "px;\n height: ", "px;\n fill: none;\n\n :empty + & {\n display: none;\n }\n\n & > svg {\n display: block;\n transform-origin: ", "px ", "px;\n }\n\n [data-placement^='top'] > & {\n bottom: -", "px;\n }\n\n [data-placement^='right'] > & {\n left: -", "px;\n\n & > svg {\n transform: rotate(90deg);\n }\n }\n\n [data-placement^='left'] > & {\n right: -", "px;\n\n & > svg {\n transform: rotate(-90deg);\n }\n }\n\n [data-placement^='bottom'] > & {\n top: -", "px;\n\n & > svg {\n transform: rotate(180deg);\n }\n }\n"])), DEFAULT_POPOVER_ARROW_WIDTH, DEFAULT_POPOVER_ARROW_WIDTH, DEFAULT_POPOVER_ARROW_WIDTH / 2, DEFAULT_POPOVER_ARROW_WIDTH / 2, DEFAULT_POPOVER_ARROW_WIDTH, DEFAULT_POPOVER_ARROW_WIDTH, DEFAULT_POPOVER_ARROW_WIDTH, DEFAULT_POPOVER_ARROW_WIDTH);
6191
- const BorderPath = styled__default.default.path(_b$e || (_b$e = __template$l(["\n fill: var(--card-shadow-outline-color);\n"])));
6192
- const ShapePath = styled__default.default.path(_c$8 || (_c$8 = __template$l(["\n fill: var(--card-bg-color);\n"])));
4858
+ const BorderPath = styled__default.default.path(_b$e || (_b$e = __template$l(["\n fill: ", ";\n"])), cssVars.default["base-shadow-outline-color"]);
4859
+ const ShapePath = styled__default.default.path(_c$8 || (_c$8 = __template$l(["\n fill: ", ";\n"])), cssVars.mutable["bg-color"]);
6193
4860
  const PopoverArrow = react.forwardRef(function PopoverArrow2(props, ref) {
6194
4861
  return /* @__PURE__ */jsxRuntime.jsx(Root$j, {
6195
4862
  "data-ui": "Popover__arrow",
@@ -6242,6 +4909,7 @@ const PopoverCard = react.memo(react.forwardRef(function PopoverCard2(props, ref
6242
4909
  const {
6243
4910
  zIndex
6244
4911
  } = useLayer();
4912
+ const toneContext = useToneContext();
6245
4913
  const margins = react.useMemo(() => marginsProp || DEFAULT_POPOVER_MARGINS, [marginsProp]);
6246
4914
  const x = (xProp != null ? xProp : 0) + margins[3];
6247
4915
  const y = (yProp != null ? yProp : 0) + margins[0];
@@ -6267,14 +4935,16 @@ const PopoverCard = react.memo(react.forwardRef(function PopoverCard2(props, ref
6267
4935
  return /* @__PURE__ */jsxRuntime.jsxs(Root$i, {
6268
4936
  "data-ui": "Popover",
6269
4937
  ...restProps,
4938
+ "data-tone": tone,
6270
4939
  "data-placement": placement,
6271
4940
  radius,
6272
4941
  ref,
6273
4942
  scheme,
6274
4943
  shadow,
6275
4944
  sizing: "border",
4945
+ updateCssVars: true,
4946
+ tone: tone === "inherit" ? toneContext.tone : tone,
6276
4947
  style: rootStyle,
6277
- tone,
6278
4948
  children: [/* @__PURE__ */jsxRuntime.jsx(Flex, {
6279
4949
  "data-ui": "Popover__wrapper",
6280
4950
  direction: "column",
@@ -6384,13 +5054,13 @@ const Popover = react.memo(react.forwardRef(function Popover2(props, ref) {
6384
5054
  }));
6385
5055
  if (constrainSize || matchReferenceWidth) {
6386
5056
  ret.push(size({
6387
- apply(_ref21) {
5057
+ apply(_ref6) {
6388
5058
  let {
6389
5059
  availableWidth,
6390
5060
  availableHeight,
6391
5061
  elements,
6392
5062
  referenceWidth
6393
- } = _ref21;
5063
+ } = _ref6;
6394
5064
  referenceWidthRef.current = referenceWidth;
6395
5065
  const _currentWidth = widthRef.current;
6396
5066
  const _maxWidth = maxWidthRef.current;
@@ -6538,24 +5208,23 @@ function inputElementStyle(props) {
6538
5208
  const {
6539
5209
  focusRing
6540
5210
  } = input.radio;
6541
- const color = theme.sanity.color.input;
6542
5211
  const dist = (input.radio.size - input.radio.markSize) / 2;
6543
- return styled.css(_b$d || (_b$d = __template$k(["\n appearance: none;\n position: absolute;\n top: 0;\n left: 0;\n opacity: 0;\n height: 100%;\n width: 100%;\n outline: none;\n z-index: 1;\n padding: 0;\n margin: 0;\n border-radius: ", ";\n border: none;\n\n /* enabled */\n & + span {\n display: block;\n position: relative;\n height: ", ";\n width: ", ";\n border-radius: ", ";\n background: ", ";\n box-shadow: ", ";\n\n &::after {\n content: '';\n position: absolute;\n top: ", ";\n left: ", ";\n height: ", ";\n width: ", ";\n border-radius: ", ";\n background: ", ";\n opacity: 0;\n }\n }\n\n /* focused */\n &:not(:disabled):focus + span {\n box-shadow: ", ";\n }\n\n &:not(:disabled):focus:not(:focus-visible) + span {\n box-shadow: ", ";\n }\n\n &:checked + span::after {\n opacity: 1;\n }\n\n /* customValidity */\n &[data-error] + span {\n background-color: ", ";\n box-shadow: ", ";\n &::after {\n background: ", ";\n }\n }\n\n /* read only */\n &[data-read-only] + span {\n box-shadow: 0 0 0 1px ", ";\n background: ", ";\n\n &::after {\n background: ", ";\n }\n }\n\n /* disabled */\n &:not([data-read-only]):disabled + span {\n box-shadow: 0 0 0 1px ", ";\n background: ", ";\n\n &::after {\n background: ", ";\n }\n }\n "])), rem(input.radio.size / 2), rem(input.radio.size), rem(input.radio.size), rem(input.radio.size / 2), color.default.enabled.bg, focusRingBorderStyle({
6544
- color: color.default.enabled.border,
5212
+ return styled.css(_b$d || (_b$d = __template$k(["\n appearance: none;\n position: absolute;\n top: 0;\n left: 0;\n opacity: 0;\n height: 100%;\n width: 100%;\n outline: none;\n z-index: 1;\n padding: 0;\n margin: 0;\n border-radius: ", ";\n border: none;\n\n /* enabled */\n & + span {\n display: block;\n position: relative;\n height: ", ";\n width: ", ";\n border-radius: ", ";\n background: ", ";\n box-shadow: ", ";\n\n &::after {\n content: '';\n position: absolute;\n top: ", ";\n left: ", ";\n height: ", ";\n width: ", ";\n border-radius: ", ";\n background: ", ";\n opacity: 0;\n }\n }\n\n /* focused */\n &:not(:disabled):focus + span {\n box-shadow: ", ";\n }\n\n &:not(:disabled):focus:not(:focus-visible) + span {\n box-shadow: ", ";\n }\n\n &:checked + span::after {\n opacity: 1;\n }\n\n /* customValidity */\n &[data-error] + span {\n background-color: ", ";\n box-shadow: ", ";\n &::after {\n background: ", ";\n }\n }\n\n /* read only */\n &[data-read-only] + span {\n box-shadow: 0 0 0 1px ", ";\n background: ", ";\n\n &::after {\n background: ", ";\n }\n }\n\n /* disabled */\n &:not([data-read-only]):disabled + span {\n box-shadow: 0 0 0 1px ", ";\n background: ", ";\n\n &::after {\n background: ", ";\n }\n }\n "])), rem(input.radio.size / 2), rem(input.radio.size), rem(input.radio.size), rem(input.radio.size / 2), cssVars.default["bg-base"], focusRingBorderStyle({
5213
+ color: cssVars.default["border-base"],
6545
5214
  width: input.border.width
6546
- }), rem(dist), rem(dist), rem(input.radio.markSize), rem(input.radio.markSize), rem(input.radio.markSize / 2), color.default.enabled.bg2, focusRingStyle({
5215
+ }), rem(dist), rem(dist), rem(input.radio.markSize), rem(input.radio.markSize), rem(input.radio.markSize / 2), cssVars.default["text-secondary"], focusRingStyle({
6547
5216
  border: {
6548
5217
  width: input.border.width,
6549
- color: color.default.enabled.border
5218
+ color: cssVars.default["border-base"]
6550
5219
  },
6551
5220
  focusRing
6552
5221
  }), focusRingBorderStyle({
6553
- color: color.default.enabled.border,
5222
+ color: cssVars.default["border-base"],
6554
5223
  width: input.border.width
6555
- }), color.invalid.enabled.border, focusRingBorderStyle({
5224
+ }), cssVars.critical["border-base"], focusRingBorderStyle({
6556
5225
  width: input.border.width,
6557
- color: color.invalid.enabled.bg2
6558
- }), color.invalid.enabled.bg2, color.default.readOnly.border, color.default.readOnly.bg, color.default.readOnly.border, color.default.disabled.border, color.default.disabled.bg, color.default.disabled.border);
5226
+ color: cssVars.critical["text-secondary"]
5227
+ }), cssVars.critical["text-secondary"], cssVars.default["border-base"], cssVars.default["bg-tint"], cssVars.default["border-base"], cssVars.default["border-base"], cssVars.default["bg-tint"], cssVars.default["border-base"]);
6559
5228
  }
6560
5229
  const Root$h = styled__default.default.div(radioBaseStyle);
6561
5230
  const Input$4 = styled__default.default.input(inputElementStyle);
@@ -6611,24 +5280,23 @@ function inputColorStyle(props) {
6611
5280
  const {
6612
5281
  focusRing
6613
5282
  } = input.select;
6614
- const color = theme.sanity.color.input;
6615
- return styled.css(_c$7 || (_c$7 = __template$j(["\n /* enabled */\n background-color: ", ";\n color: ", ";\n box-shadow: ", ";\n\n /* hovered */\n @media (hover: hover) {\n &:not(:disabled):hover {\n background-color: ", ";\n color: ", ";\n box-shadow: ", ";\n }\n }\n\n /* focused */\n &:not(:disabled):focus {\n box-shadow: ", ";\n }\n\n /* read-only */\n &[data-read-only] {\n background-color: ", ";\n color: ", ";\n box-shadow: ", ";\n }\n\n /* disabled */\n &:not([data-read-only]):disabled {\n background-color: ", ";\n color: ", ";\n box-shadow: ", ";\n }\n "])), color.default.enabled.bg, color.default.enabled.fg, focusRingBorderStyle({
6616
- color: color.default.enabled.border,
5283
+ return styled.css(_c$7 || (_c$7 = __template$j(["\n /* enabled */\n background-color: ", ";\n color: ", ";\n box-shadow: ", ";\n\n /* hovered */\n @media (hover: hover) {\n &:not(:disabled):hover {\n background-color: ", ";\n color: ", ";\n box-shadow: ", ";\n }\n }\n\n /* focused */\n &:not(:disabled):focus {\n box-shadow: ", ";\n }\n\n /* read-only */\n &[data-read-only] {\n background-color: ", ";\n color: ", ";\n box-shadow: ", ";\n }\n\n /* disabled */\n &:not([data-read-only]):disabled {\n background-color: ", ";\n color: ", ";\n box-shadow: ", ";\n }\n "])), cssVars.default["bg-base"], cssVars.default["text-primary"], focusRingBorderStyle({
5284
+ color: cssVars.default["border-base"],
6617
5285
  width: input.border.width
6618
- }), color.default.hovered.bg, color.default.hovered.fg, focusRingBorderStyle({
6619
- color: color.default.hovered.border,
5286
+ }), cssVars.default["bg-base-hover"], cssVars.default["text-primary"], focusRingBorderStyle({
5287
+ color: cssVars.default["border-base-hover"],
6620
5288
  width: input.border.width
6621
5289
  }), focusRingStyle({
6622
5290
  border: {
6623
5291
  width: input.border.width,
6624
- color: color.default.enabled.border
5292
+ color: cssVars.default["border-base"]
6625
5293
  },
6626
5294
  focusRing
6627
- }), color.default.readOnly.bg, color.default.readOnly.fg, focusRingBorderStyle({
6628
- color: color.default.readOnly.border,
5295
+ }), cssVars.default["bg-tint"], cssVars.default["text-primary"], focusRingBorderStyle({
5296
+ color: cssVars.default["border-base"],
6629
5297
  width: input.border.width
6630
- }), color.default.disabled.bg, color.default.disabled.fg, focusRingBorderStyle({
6631
- color: color.default.disabled.border,
5298
+ }), cssVars.default["bg-tint"], cssVars.default["text-primary"], focusRingBorderStyle({
5299
+ color: cssVars.default["border-base"],
6632
5300
  width: input.border.width
6633
5301
  }));
6634
5302
  }
@@ -6651,12 +5319,8 @@ function inputTextSizeStyle(props) {
6651
5319
  function inputStyle() {
6652
5320
  return [responsiveRadiusStyle, inputBaseStyle, inputColorStyle, inputTextSizeStyle, responsiveInputPaddingIconRightStyle];
6653
5321
  }
6654
- function iconBoxStyle(props) {
6655
- const {
6656
- theme
6657
- } = props;
6658
- const color = theme.sanity.color.input;
6659
- return styled.css(_d$5 || (_d$5 = __template$j(["\n pointer-events: none;\n position: absolute;\n top: 0;\n right: 0;\n\n /* enabled */\n --card-fg-color: ", ";\n\n /* hover */\n @media (hover: hover) {\n select:not(disabled):not(:read-only):hover + && {\n --card-fg-color: ", ";\n }\n }\n\n /* disabled */\n select:disabled + && {\n --card-fg-color: ", ";\n }\n\n /* read-only */\n select[data-read-only] + && {\n --card-fg-color: ", ";\n }\n "])), color.default.enabled.fg, color.default.hovered.fg, color.default.disabled.fg, color.default.readOnly.fg);
5322
+ function iconBoxStyle() {
5323
+ return styled.css(_d$5 || (_d$5 = __template$j(["\n pointer-events: none;\n position: absolute;\n top: 0;\n right: 0;\n\n /* enabled */\n ", ": ", ";\n\n /* hover */\n @media (hover: hover) {\n select:not(disabled):not(:read-only):hover + && {\n ", ": ", ";\n }\n }\n\n /* disabled */\n select:disabled + && {\n ", ": ", ";\n }\n\n /* read-only */\n select[data-read-only] + && {\n ", ": ", ";\n }\n "])), mutableCardVariables["fg-color"], cssVars.default["text-primary"], mutableCardVariables["fg-color"], cssVars.default["text-primary"], mutableCardVariables["fg-color"], cssVars.default["text-primary"], mutableCardVariables["fg-color"], cssVars.default["text-primary"]);
6660
5324
  }
6661
5325
  const selectStyle = {
6662
5326
  root: rootStyle,
@@ -6765,10 +5429,9 @@ function switchRepresentationStyles(props) {
6765
5429
  const {
6766
5430
  focusRing
6767
5431
  } = input.switch;
6768
- const color = theme.sanity.color.input;
6769
- return styled.css(_c$6 || (_c$6 = __template$i(["\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n --switch-box-shadow: none;\n\n &:not([hidden]) {\n display: block;\n }\n position: relative;\n width: ", ";\n height: ", ";\n border-radius: ", ";\n\n /* Make sure it\u2019s not possible to interact with the wrapper element */\n pointer-events: none;\n\n &:after {\n content: '';\n display: block;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 1;\n box-shadow: var(--switch-box-shadow);\n border-radius: inherit;\n }\n\n /* Focus styles */\n input:focus + && {\n --switch-box-shadow: ", ";\n }\n\n input:focus:not(:focus-visible) + && {\n --switch-box-shadow: none;\n }\n\n input:checked + && {\n --switch-bg-color: var(--card-focus-ring-color);\n --switch-fg-color: ", ";\n }\n\n @media (hover: hover) {\n input:not(:disabled):hover + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n\n input:not(:disabled):checked:hover + && {\n --switch-bg-color: var(--card-focus-ring-color);\n --switch-fg-color: ", ";\n }\n }\n\n input:not([data-read-only]):disabled + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n\n input[data-read-only]:disabled + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n "])), color.default.enabled.border, color.default.enabled.bg, rem(input.switch.width), rem(input.switch.height), rem(input.switch.height / 2), focusRingStyle({
5432
+ return styled.css(_c$6 || (_c$6 = __template$i(["\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n --switch-box-shadow: none;\n\n &:not([hidden]) {\n display: block;\n }\n position: relative;\n width: ", ";\n height: ", ";\n border-radius: ", ";\n\n /* Make sure it\u2019s not possible to interact with the wrapper element */\n pointer-events: none;\n\n &:after {\n content: '';\n display: block;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 1;\n box-shadow: var(--switch-box-shadow);\n border-radius: inherit;\n }\n\n /* Focus styles */\n input:focus + && {\n --switch-box-shadow: ", ";\n }\n\n input:focus:not(:focus-visible) + && {\n --switch-box-shadow: none;\n }\n\n input:checked + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n\n @media (hover: hover) {\n input:not(:disabled):hover + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n\n input:not(:disabled):checked:hover + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n }\n\n input:not([data-read-only]):disabled + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n\n input[data-read-only]:disabled + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n "])), cssVars.default["border-base"], cssVars.default["bg-base"], rem(input.switch.width), rem(input.switch.height), rem(input.switch.height / 2), focusRingStyle({
6770
5433
  focusRing
6771
- }), color.default.enabled.bg, color.default.hovered.border, color.default.hovered.bg, color.default.enabled.bg, color.default.disabled.border, color.default.disabled.bg, color.default.readOnly.border, color.default.readOnly.bg);
5434
+ }), cssVars.positive["border-accent"], cssVars.positive["bg-base"], cssVars.default["border-base"], cssVars.default["bg-base"], cssVars.positive["border-accent"], cssVars.positive["bg-base"], cssVars.default["border-base"], cssVars.default["bg-tint"], cssVars.default["border-base"], cssVars.default["bg-tint"]);
6772
5435
  }
6773
5436
  function switchTrackStyles(props) {
6774
5437
  const {
@@ -6855,36 +5518,32 @@ const TextArea = react.forwardRef(function TextArea2(props, forwardedRef) {
6855
5518
  disabled = false,
6856
5519
  fontSize = 2,
6857
5520
  padding = 3,
6858
- radius = 1,
5521
+ radius = 2,
6859
5522
  weight,
5523
+ tone = "default",
6860
5524
  ...restProps
6861
5525
  } = props;
6862
5526
  const ref = useForwardedRef(forwardedRef);
6863
- const rootTheme = useRootTheme();
6864
5527
  useCustomValidity(ref, customValidity);
6865
5528
  return /* @__PURE__ */jsxRuntime.jsx(Root$d, {
6866
5529
  "data-ui": "TextArea",
6867
5530
  children: /* @__PURE__ */jsxRuntime.jsxs(InputRoot$1, {
6868
5531
  children: [/* @__PURE__ */jsxRuntime.jsx(Input$1, {
6869
5532
  "data-as": "textarea",
6870
- "data-scheme": rootTheme.scheme,
6871
- "data-tone": rootTheme.tone,
5533
+ "data-tone": tone,
6872
5534
  ...restProps,
6873
5535
  $fontSize: useArrayProp(fontSize),
6874
5536
  $padding: useArrayProp(padding),
6875
- $scheme: rootTheme.scheme,
6876
5537
  $space: useArrayProp(0),
6877
- $tone: rootTheme.tone,
5538
+ $tone: tone,
6878
5539
  $weight: weight,
6879
5540
  disabled,
6880
5541
  ref
6881
5542
  }), /* @__PURE__ */jsxRuntime.jsx(Presentation$1, {
6882
5543
  $radius: useArrayProp(radius),
6883
- $scheme: rootTheme.scheme,
6884
- $tone: rootTheme.tone,
5544
+ $tone: tone,
6885
5545
  "data-border": border ? "" : void 0,
6886
- "data-scheme": rootTheme.scheme,
6887
- "data-tone": rootTheme.tone
5546
+ "data-tone": tone
6888
5547
  })]
6889
5548
  })
6890
5549
  });
@@ -6929,17 +5588,19 @@ const TextInput = react.forwardRef(function TextInput2(props, forwardedRef) {
6929
5588
  onClear,
6930
5589
  padding: paddingProp = 3,
6931
5590
  prefix,
6932
- radius: radiusProp = 1,
5591
+ radius: radiusProp = 2,
6933
5592
  readOnly,
6934
5593
  space: spaceProp = 3,
6935
5594
  suffix,
6936
5595
  customValidity,
6937
5596
  type = "text",
6938
5597
  weight,
5598
+ tone: toneProp = "default",
6939
5599
  ...restProps
6940
5600
  } = props;
6941
5601
  const ref = useForwardedRef(forwardedRef);
6942
- const rootTheme = useRootTheme();
5602
+ const toneContext = useToneContext();
5603
+ const tone = toneProp === "default" ? toneContext.tone : toneProp;
6943
5604
  const fontSize = useArrayProp(fontSizeProp);
6944
5605
  const padding = useArrayProp(paddingProp);
6945
5606
  const radius = useArrayProp(radiusProp);
@@ -6976,11 +5637,9 @@ const TextInput = react.forwardRef(function TextInput2(props, forwardedRef) {
6976
5637
  $hasPrefix,
6977
5638
  $hasSuffix,
6978
5639
  $radius: radius,
6979
- $scheme: rootTheme.scheme,
6980
- $tone: rootTheme.tone,
5640
+ $tone: tone,
6981
5641
  "data-border": border ? "" : void 0,
6982
- "data-scheme": rootTheme.scheme,
6983
- "data-tone": rootTheme.tone,
5642
+ "data-tone": tone,
6984
5643
  children: [icon && /* @__PURE__ */jsxRuntime.jsx(LeftBox, {
6985
5644
  padding,
6986
5645
  children: /* @__PURE__ */jsxRuntime.jsxs(Text, {
@@ -6994,7 +5653,7 @@ const TextInput = react.forwardRef(function TextInput2(props, forwardedRef) {
6994
5653
  children: [react.isValidElement(iconRight) && iconRight, ReactIs.isValidElementType(iconRight) && react.createElement(iconRight)]
6995
5654
  })
6996
5655
  })]
6997
- }), [border, fontSize, icon, iconRight, padding, radius, rootTheme, $hasClearButton, $hasPrefix, $hasSuffix]);
5656
+ }), [border, fontSize, icon, iconRight, padding, radius, $hasClearButton, $hasPrefix, $hasSuffix, tone]);
6998
5657
  const clearButtonBoxPadding = react.useMemo(() => padding.map(v => {
6999
5658
  if (v === 0) return 0;
7000
5659
  if (v === 1) return 1;
@@ -7039,20 +5698,18 @@ const TextInput = react.forwardRef(function TextInput2(props, forwardedRef) {
7039
5698
  }), [radius, suffix]);
7040
5699
  return /* @__PURE__ */jsxRuntime.jsxs(Root$c, {
7041
5700
  "data-ui": "TextInput",
7042
- tone: rootTheme.tone,
5701
+ tone,
7043
5702
  children: [prefixNode, /* @__PURE__ */jsxRuntime.jsxs(InputRoot, {
7044
5703
  children: [/* @__PURE__ */jsxRuntime.jsx(Input, {
7045
5704
  "data-as": "input",
7046
- "data-scheme": rootTheme.scheme,
7047
- "data-tone": rootTheme.tone,
5705
+ "data-tone": tone,
7048
5706
  ...restProps,
7049
5707
  $fontSize: fontSize,
7050
5708
  $iconLeft: $hasIcon,
7051
5709
  $iconRight: $hasIconRight || $hasClearButton,
7052
5710
  $padding: padding,
7053
- $scheme: rootTheme.scheme,
7054
5711
  $space: space,
7055
- $tone: rootTheme.tone,
5712
+ $tone: tone,
7056
5713
  $weight: weight,
7057
5714
  disabled,
7058
5715
  readOnly,
@@ -7099,8 +5756,8 @@ var __template$f = (cooked, raw) => __freeze$f(__defProp$f(cooked, "raw", {
7099
5756
  }));
7100
5757
  var _a$f, _b$9, _c$4;
7101
5758
  const Root$b = styled__default.default.div(_a$f || (_a$f = __template$f(["\n position: absolute;\n pointer-events: none;\n width: 15px;\n height: 15px;\n fill: none;\n\n :empty + & {\n display: none;\n }\n\n & > svg {\n display: block;\n transform-origin: 7.5px 7.5px;\n }\n\n /* position: absolute;\n width: 15px;\n height: 15px;\n fill: none;\n\n :empty + & {\n display: none;\n }\n\n & > svg {\n &:not([hidden]) {\n display: block;\n }\n transform-origin: 7.5px 7.5px;\n } */\n\n [data-placement^='top'] > & {\n bottom: -27px;\n }\n\n [data-placement^='right'] > & {\n left: -27px;\n\n & > svg {\n transform: rotate(90deg);\n }\n }\n\n [data-placement^='left'] > & {\n right: -27px;\n\n & > svg {\n transform: rotate(-90deg);\n }\n }\n\n [data-placement^='bottom'] > & {\n top: -27px;\n\n & > svg {\n transform: rotate(180deg);\n }\n }\n"])));
7102
- const Border = styled__default.default.path(_b$9 || (_b$9 = __template$f(["\n fill: var(--card-shadow-outline-color);\n"])));
7103
- const Shape = styled__default.default.path(_c$4 || (_c$4 = __template$f(["\n fill: var(--card-bg-color);\n"])));
5759
+ const Border = styled__default.default.path(_b$9 || (_b$9 = __template$f(["\n fill: ", ";\n"])), cssVars.default["base-shadow-outline-color"]);
5760
+ const Shape = styled__default.default.path(_c$4 || (_c$4 = __template$f(["\n fill: ", ";\n"])), cssVars.mutable["bg-color"]);
7104
5761
  const TooltipArrow = react.forwardRef(function TooltipArrow2(props, ref) {
7105
5762
  const {
7106
5763
  ...restProps
@@ -7199,12 +5856,12 @@ const Tooltip = react.forwardRef(function Tooltip2(props, ref) {
7199
5856
  mainAxis: 3
7200
5857
  }));
7201
5858
  ret.push(reactDom$1.size({
7202
- apply(_ref22) {
5859
+ apply(_ref7) {
7203
5860
  let {
7204
5861
  availableWidth,
7205
5862
  availableHeight,
7206
5863
  elements
7207
- } = _ref22;
5864
+ } = _ref7;
7208
5865
  Object.assign(elements.floating.style, {
7209
5866
  maxWidth: "".concat(availableWidth - 4 * 2, "px"),
7210
5867
  // the padding is `4px`
@@ -7510,10 +6167,10 @@ const InnerAutocomplete = react.forwardRef(function InnerAutocomplete2(props, re
7510
6167
  query,
7511
6168
  value
7512
6169
  } = state;
7513
- const defaultRenderOption = react.useCallback(_ref23 => {
6170
+ const defaultRenderOption = react.useCallback(_ref8 => {
7514
6171
  let {
7515
6172
  value: value2
7516
- } = _ref23;
6173
+ } = _ref8;
7517
6174
  return /* @__PURE__ */jsxRuntime.jsx(Card, {
7518
6175
  "data-as": "button",
7519
6176
  padding: paddingProp,
@@ -7967,11 +6624,7 @@ const Breadcrumbs = react.forwardRef(function Breadcrumbs2(props, ref) {
7967
6624
  });
7968
6625
  });
7969
6626
  const BORDER_OFFSET_X = 12;
7970
- function dialogStyle(_ref24) {
7971
- let {
7972
- theme
7973
- } = _ref24;
7974
- const color = theme.sanity.color.base;
6627
+ function dialogStyle() {
7975
6628
  return {
7976
6629
  "&:not([hidden])": {
7977
6630
  display: "flex"
@@ -7983,7 +6636,7 @@ function dialogStyle(_ref24) {
7983
6636
  alignItems: "center",
7984
6637
  justifyContent: "center",
7985
6638
  outline: "none",
7986
- background: color.shadow.umbra
6639
+ background: cssVars.default["base-shadow-umbra-color"]
7987
6640
  };
7988
6641
  }
7989
6642
  function responsiveDialogPositionStyle(props) {
@@ -8021,9 +6674,9 @@ const Root$7 = styled__default.default(Layer)(responsivePaddingStyle, dialogStyl
8021
6674
  const DialogContainer = styled__default.default(Container)(_a$b || (_a$b = __template$b(["\n &:not([hidden]) {\n display: flex;\n }\n width: 100%;\n height: 100%;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n"])));
8022
6675
  const DialogCardRoot = styled__default.default(Card)(_b$6 || (_b$6 = __template$b(["\n &:not([hidden]) {\n display: flex;\n }\n width: 100%;\n min-height: 0;\n max-height: 100%;\n overflow: hidden;\n overflow: clip;\n"])));
8023
6676
  const DialogLayout = styled__default.default(Flex)(_c$2 || (_c$2 = __template$b(["\n flex: 1;\n min-height: 0;\n width: 100%;\n"])));
8024
- const DialogHeader = styled__default.default(Card)(_d$1 || (_d$1 = __template$b(["\n position: relative;\n z-index: 2;\n\n &:after {\n content: '';\n display: block;\n position: absolute;\n left: ", "px;\n right: ", "px;\n bottom: -1px;\n border-bottom: 1px solid var(--card-border-color);\n width: auto;\n opacity: ", ";\n transition: opacity 200ms ease-in;\n }\n"])), BORDER_OFFSET_X, BORDER_OFFSET_X, props => props.$isContentScrollable && props.$hasScrolledFromTop ? 1 : 0);
6677
+ const DialogHeader = styled__default.default(Card)(_d$1 || (_d$1 = __template$b(["\n position: relative;\n z-index: 2;\n\n &:after {\n content: '';\n display: block;\n position: absolute;\n left: ", "px;\n right: ", "px;\n bottom: -1px;\n border-bottom: 1px solid ", ";\n width: auto;\n opacity: ", ";\n transition: opacity 200ms ease-in;\n }\n"])), BORDER_OFFSET_X, BORDER_OFFSET_X, cssVars.default["border-base"], props => props.$isContentScrollable && props.$hasScrolledFromTop ? 1 : 0);
8025
6678
  const DialogContent = styled__default.default(Box)(_e || (_e = __template$b(["\n position: relative;\n z-index: 1;\n overflow: auto;\n outline: none;\n"])));
8026
- const DialogFooter = styled__default.default(Box)(_f || (_f = __template$b(["\n position: relative;\n z-index: 3;\n\n &:before {\n content: '';\n display: block;\n position: absolute;\n left: ", "px;\n right: ", "px;\n top: -1px;\n border-top: 1px solid var(--card-border-color);\n width: auto;\n opacity: ", ";\n transition: opacity 200ms ease-in;\n }\n"])), BORDER_OFFSET_X, BORDER_OFFSET_X, props => props.$isContentScrollable && !props.$hasScrolledToBottom ? 1 : 0);
6679
+ const DialogFooter = styled__default.default(Box)(_f || (_f = __template$b(["\n position: relative;\n z-index: 3;\n\n &:before {\n content: '';\n display: block;\n position: absolute;\n left: ", "px;\n right: ", "px;\n top: -1px;\n border-top: 1px solid ", ";\n width: auto;\n opacity: ", ";\n transition: opacity 200ms ease-in;\n }\n"])), BORDER_OFFSET_X, BORDER_OFFSET_X, cssVars.default["border-base"], props => props.$isContentScrollable && !props.$hasScrolledToBottom ? 1 : 0);
8027
6680
  const DialogCard = react.forwardRef(function DialogCard2(props, ref) {
8028
6681
  var _a2;
8029
6682
  const {
@@ -8765,7 +7418,7 @@ var __template$8 = (cooked, raw) => __freeze$8(__defProp$8(cooked, "raw", {
8765
7418
  value: __freeze$8(raw || cooked.slice())
8766
7419
  }));
8767
7420
  var _a$8;
8768
- const MenuDivider = styled__default.default.hr(_a$8 || (_a$8 = __template$8(["\n height: 1px;\n border: 0;\n background: var(--card-hairline-soft-color);\n margin: 0;\n"])));
7421
+ const MenuDivider = styled__default.default.hr(_a$8 || (_a$8 = __template$8(["\n height: 1px;\n border: 0;\n background: ", ";\n margin: 0;\n"])), cssVars.default["border-base"]);
8769
7422
  var __freeze$7 = Object.freeze;
8770
7423
  var __defProp$7 = Object.defineProperty;
8771
7424
  var __template$7 = (cooked, raw) => __freeze$7(__defProp$7(cooked, "raw", {
@@ -8778,16 +7431,11 @@ function selectableBaseStyle() {
8778
7431
  function selectableColorStyle(props) {
8779
7432
  var _a2, _b2;
8780
7433
  const {
7434
+ theme,
8781
7435
  $tone,
8782
- theme
7436
+ $scheme
8783
7437
  } = props;
8784
- const {
8785
- base,
8786
- muted,
8787
- selectable
8788
- } = theme.sanity.color;
8789
- const tone = selectable ? selectable[$tone] || selectable.default : muted[$tone] || muted.default;
8790
- return styled.css(_b$4 || (_b$4 = __template$7(["\n ", "\n\n background-color: var(--card-bg-color);\n color: var(--card-fg-color);\n outline: none;\n\n /* &:is(button) */\n &[data-as='button'] {\n &:disabled {\n ", "\n }\n\n &:not(:disabled) {\n &[aria-pressed='true'] {\n ", "\n }\n\n &[data-selected],\n &[aria-selected='true'] > & {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]) {\n &[data-hovered],\n &:hover {\n ", "\n }\n\n &:active {\n ", "\n }\n }\n }\n }\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n &[data-disabled] {\n ", "\n }\n\n &:not([data-disabled]) {\n &[data-pressed] {\n ", "\n }\n\n &[data-selected] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]) {\n &[data-hovered],\n &:hover {\n ", "\n }\n\n &:active {\n ", "\n }\n }\n }\n }\n }\n\n ", "\n "])), _colorVarsStyle(base, tone.enabled), _colorVarsStyle(base, tone.disabled), _colorVarsStyle(base, tone.pressed), _colorVarsStyle(base, tone.selected), _colorVarsStyle(base, tone.hovered), _colorVarsStyle(base, tone.pressed), _colorVarsStyle(base, tone.disabled), _colorVarsStyle(base, tone.pressed), _colorVarsStyle(base, tone.selected), _colorVarsStyle(base, tone.hovered), _colorVarsStyle(base, tone.pressed), (_b2 = (_a2 = theme.sanity.styles) == null ? void 0 : _a2.card) == null ? void 0 : _b2.root);
7438
+ return styled.css(_b$4 || (_b$4 = __template$7(["\n ", "\n ", "\n\n background-color: ", ";\n color: ", ";\n outline: none;\n\n /* &:is(button) - Looks like a button in default mode */\n &[data-as='button'] {\n &:disabled {\n ", "\n }\n\n &:not(:disabled) {\n &[aria-pressed='true'] {\n ", "\n }\n\n &[data-selected],\n &[aria-selected='true'] > & {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]) {\n &[data-hovered],\n &:hover {\n ", "\n }\n\n &:active {\n ", "\n }\n }\n }\n }\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n &[data-disabled] {\n ", "\n }\n\n &:not([data-disabled]) {\n &[data-pressed] {\n ", "\n }\n\n &[data-selected] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]) {\n &[data-hovered],\n &:hover {\n ", "\n }\n\n &:active {\n ", "\n }\n }\n }\n }\n }\n\n ", "\n "])), $tone !== "default" && createCssVars($scheme, theme.sanity.color.tones, $tone), _selectableVarStyle(), cssVars.mutable["bg-color"], cssVars[$tone]["text-secondary"], _selectableVarStyleDisabled(), _colorVarStyleActive(), _colorVarStyleSelected(), _colorVarStyleHover(), _colorVarStyleActive(), _selectableVarStyleDisabled(), _colorVarStyleActive(), _colorVarStyleSelected(), _colorVarStyleHover(), _colorVarStyleActive(), (_b2 = (_a2 = theme.sanity.styles) == null ? void 0 : _a2.card) == null ? void 0 : _b2.root);
8791
7439
  }
8792
7440
  const Selectable = styled__default.default(Box)(responsiveRadiusStyle, selectableBaseStyle, selectableColorStyle);
8793
7441
  function useMenu() {
@@ -8815,6 +7463,9 @@ function MenuGroup(props) {
8815
7463
  tone = "default",
8816
7464
  ...restProps
8817
7465
  } = props;
7466
+ const {
7467
+ scheme
7468
+ } = useToneContext();
8818
7469
  const menu = useMenu();
8819
7470
  const {
8820
7471
  activeElement,
@@ -8904,6 +7555,7 @@ function MenuGroup(props) {
8904
7555
  "data-selected": !withinMenu && active ? "" : void 0,
8905
7556
  $radius: useArrayProp(radius),
8906
7557
  $tone: tone,
7558
+ $scheme: scheme,
8907
7559
  onClick: handleClick,
8908
7560
  onKeyDown: handleKeyDown,
8909
7561
  onMouseEnter: handleMouseEnter,
@@ -8941,7 +7593,7 @@ const MenuItem = react.forwardRef(function MenuItem2(props, forwardedRef) {
8941
7593
  as = "button",
8942
7594
  children,
8943
7595
  disabled,
8944
- fontSize = 2,
7596
+ fontSize = 1,
8945
7597
  hotkeys,
8946
7598
  icon,
8947
7599
  iconRight,
@@ -8961,6 +7613,9 @@ const MenuItem = react.forwardRef(function MenuItem2(props, forwardedRef) {
8961
7613
  tone = "default",
8962
7614
  ...restProps
8963
7615
  } = props;
7616
+ const {
7617
+ scheme
7618
+ } = useToneContext();
8964
7619
  const menu = useMenu();
8965
7620
  const {
8966
7621
  activeElement,
@@ -9002,6 +7657,7 @@ const MenuItem = react.forwardRef(function MenuItem2(props, forwardedRef) {
9002
7657
  $radius: useArrayProp(radius),
9003
7658
  $padding: useArrayProp(0),
9004
7659
  $tone: tone,
7660
+ $scheme: scheme,
9005
7661
  disabled,
9006
7662
  onClick: handleClick,
9007
7663
  onMouseEnter: onItemMouseEnter,
@@ -9056,18 +7712,18 @@ var __template$6 = (cooked, raw) => __freeze$6(__defProp$6(cooked, "raw", {
9056
7712
  }));
9057
7713
  var _a$6, _b$3, _c$1, _d;
9058
7714
  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"])));
9059
- 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);
9060
- 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 => {
7715
+ const animation = styled.css(_b$3 || (_b$3 = __template$6(["\n background-image: linear-gradient(\n to right,\n ", ",\n ", ",\n ", ",\n ", ",\n ", "\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"])), cssVars.default["skeleton-from"], cssVars.default["skeleton-to"], cssVars.default["skeleton-from"], cssVars.default["skeleton-from"], cssVars.default["skeleton-from"], keyframe);
7716
+ 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: ", ";\n }\n"])), _ref9 => {
9061
7717
  let {
9062
7718
  $visible
9063
- } = _ref25;
7719
+ } = _ref9;
9064
7720
  return $visible ? 1 : 0;
9065
- }, _ref26 => {
7721
+ }, _ref10 => {
9066
7722
  let {
9067
7723
  $animated
9068
- } = _ref26;
9069
- return $animated ? animation : styled.css(_c$1 || (_c$1 = __template$6(["\n background-color: var(--card-skeleton-color-from);\n "])));
9070
- });
7724
+ } = _ref10;
7725
+ return $animated ? animation : styled.css(_c$1 || (_c$1 = __template$6(["\n background-color: ", ";\n "])), cssVars.default["skeleton-from"]);
7726
+ }, cssVars.default["skeleton-from"]);
9071
7727
  const Root$4 = styled__default.default(Box)(responsiveRadiusStyle, skeletonStyle);
9072
7728
  const Skeleton = react.forwardRef(function Skeleton2(props, ref) {
9073
7729
  const {
@@ -9096,12 +7752,12 @@ const Skeleton = react.forwardRef(function Skeleton2(props, ref) {
9096
7752
  ref
9097
7753
  });
9098
7754
  });
9099
- const Root$3 = styled__default.default(Skeleton)(_ref27 => {
7755
+ const Root$3 = styled__default.default(Skeleton)(_ref11 => {
9100
7756
  let {
9101
7757
  $size,
9102
7758
  $style,
9103
7759
  theme
9104
- } = _ref27;
7760
+ } = _ref11;
9105
7761
  const {
9106
7762
  media
9107
7763
  } = theme.sanity;
@@ -9449,12 +8105,12 @@ function ToastProvider(props) {
9449
8105
  paddingY,
9450
8106
  children: /* @__PURE__ */jsxRuntime.jsx(framerMotion.AnimatePresence, {
9451
8107
  initial: false,
9452
- children: state.map(_ref28 => {
8108
+ children: state.map(_ref12 => {
9453
8109
  let {
9454
8110
  dismiss,
9455
8111
  id,
9456
8112
  params
9457
- } = _ref28;
8113
+ } = _ref12;
9458
8114
  return /* @__PURE__ */jsxRuntime.jsx(framerMotion.motion.div, {
9459
8115
  animate: {
9460
8116
  opacity: 1,
@@ -9747,18 +8403,8 @@ var _a$1, _b, _c;
9747
8403
  function treeItemRootStyle() {
9748
8404
  return styled.css(_a$1 || (_a$1 = __template$1(["\n &[role='none'] > [role='treeitem'] {\n outline: none;\n cursor: default;\n border-radius: 3px;\n\n &:focus {\n position: relative;\n }\n }\n\n &[role='treeitem'] {\n outline: none;\n\n & > div {\n cursor: default;\n border-radius: 3px;\n }\n\n &:focus > div {\n position: relative;\n }\n }\n "])));
9749
8405
  }
9750
- function treeItemRootColorStyle(props) {
9751
- const {
9752
- theme
9753
- } = props;
9754
- const $tone = "default";
9755
- const {
9756
- base,
9757
- muted,
9758
- selectable
9759
- } = theme.sanity.color;
9760
- const tone = selectable ? selectable[$tone] || selectable.default : muted[$tone] || muted.default;
9761
- return styled.css(_b || (_b = __template$1(['\n /* <div role="none"><a data-ui="TreeItem__box" role="treeitem" tabIndex="0"></div> */\n &[role=\'none\'] {\n & > [role=\'treeitem\'] {\n ', "\n\n background-color: var(--card-bg-color);\n color: var(--treeitem-fg-color);\n }\n\n &[data-selected] > [role='treeitem'] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]) > [role='treeitem']:not(:focus):hover {\n ", "\n }\n\n & > [role='treeitem']:focus {\n ", '\n }\n }\n }\n\n /* <div role="treeitem" tabIndex="0"><div data-ui="TreeItem__box"></div> */\n &[role=\'treeitem\'] {\n & > [data-ui=\'TreeItem__box\'] {\n ', "\n\n background-color: var(--card-bg-color);\n color: var(--card-fg-color);\n }\n\n &[data-selected] > [data-ui='TreeItem__box'] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]):not(:focus) > [data-ui='TreeItem__box']:hover {\n ", "\n }\n\n &:focus > [data-ui='TreeItem__box'] {\n ", "\n }\n }\n }\n "])), _colorVarsStyle(base, tone.enabled), _colorVarsStyle(base, tone.pressed), _colorVarsStyle(base, tone.hovered), _colorVarsStyle(base, tone.selected), _colorVarsStyle(base, tone.enabled), _colorVarsStyle(base, tone.pressed), _colorVarsStyle(base, tone.hovered), _colorVarsStyle(base, tone.selected));
8406
+ function treeItemRootColorStyle() {
8407
+ return styled.css(_b || (_b = __template$1(['\n /* <div role="none"><a data-ui="TreeItem__box" role="treeitem" tabIndex="0"></div> */\n &[role=\'none\'] {\n & > [role=\'treeitem\'] {\n ', "\n\n background-color:", ";\n color: var(--treeitem-fg-color);\n }\n\n &[data-selected] > [role='treeitem'] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]) > [role='treeitem']:not(:focus):hover {\n ", "\n }\n\n & > [role='treeitem']:focus {\n ", '\n }\n }\n }\n\n /* <div role="treeitem" tabIndex="0"><div data-ui="TreeItem__box"></div> */\n &[role=\'treeitem\'] {\n & > [data-ui=\'TreeItem__box\'] {\n ', "\n background-color: ", ";\n color: ", ";\n }\n\n &[data-selected] > [data-ui='TreeItem__box'] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]):not(:focus) > [data-ui='TreeItem__box']:hover {\n ", "\n }\n\n &:focus > [data-ui='TreeItem__box'] {\n ", "\n }\n }\n }\n "])), cardVariables, cssVars.mutable["bg-color"], _colorVarStyleActive(), _colorVarStyleHover(), _colorVarStyleSelected(), cardVariables, cssVars.mutable["bg-color"], cssVars.mutable["fg-color"], _colorVarStyleActive(), _colorVarStyleHover(), _colorVarStyleSelected());
9762
8408
  }
9763
8409
  function treeItemBoxStyle(props) {
9764
8410
  const {
@@ -10029,7 +8675,8 @@ exports._raf2 = _raf2;
10029
8675
  exports._responsive = _responsive;
10030
8676
  exports.attemptFocus = attemptFocus;
10031
8677
  exports.containsOrEqualsElement = containsOrEqualsElement;
10032
- exports.createColorTheme = createColorTheme;
8678
+ exports.createCssVars = createCssVars;
8679
+ exports.cssVars = cssVars;
10033
8680
  exports.focusFirstDescendant = focusFirstDescendant;
10034
8681
  exports.focusLastDescendant = focusLastDescendant;
10035
8682
  exports.hexToRgb = hexToRgb;
@@ -10052,6 +8699,7 @@ exports.responsiveTextFont = responsiveTextFont;
10052
8699
  exports.rgbToHex = rgbToHex;
10053
8700
  exports.rgbToHsl = rgbToHsl;
10054
8701
  exports.rgba = rgba;
8702
+ exports.rgbaToRGBA = rgbaToRGBA;
10055
8703
  exports.screen = screen$1;
10056
8704
  exports.studioTheme = studioTheme;
10057
8705
  exports.useArrayProp = useArrayProp;