@sanity/ui 2.0.0-alpha.5 → 2.0.0-alpha.7

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 (115) hide show
  1. package/dist/index.cjs.mjs +3 -1
  2. package/dist/index.d.ts +294 -407
  3. package/dist/index.esm.js +971 -2333
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/index.js +972 -2332
  6. package/dist/index.js.map +1 -1
  7. package/package.json +1 -1
  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 +22 -23
  13. package/src/components/menu/menuItem.tsx +30 -36
  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 +25 -22
  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/badge.tsx +4 -2
  23. package/src/primitives/badge/styles.ts +7 -8
  24. package/src/primitives/box/__workshop__/responsive.tsx +2 -2
  25. package/src/primitives/button/button.tsx +2 -2
  26. package/src/primitives/button/styles.ts +82 -16
  27. package/src/primitives/card/__workshop__/selected.tsx +8 -9
  28. package/src/primitives/card/card.tsx +43 -7
  29. package/src/primitives/card/styles.ts +30 -22
  30. package/src/primitives/card/types.ts +3 -1
  31. package/src/primitives/checkbox/styles.ts +20 -20
  32. package/src/primitives/code/code.tsx +15 -3
  33. package/src/primitives/code/styles.ts +51 -42
  34. package/src/primitives/heading/styles.ts +6 -5
  35. package/src/primitives/kbd/kbd.tsx +2 -1
  36. package/src/primitives/label/styles.ts +3 -2
  37. package/src/primitives/popover/popoverArrow.tsx +3 -2
  38. package/src/primitives/popover/popoverCard.tsx +6 -2
  39. package/src/primitives/radio/styles.ts +15 -15
  40. package/src/primitives/select/styles.ts +20 -22
  41. package/src/primitives/switch/styles.ts +13 -13
  42. package/src/primitives/text/__workshop__/colored.tsx +10 -11
  43. package/src/primitives/text/styles.ts +10 -9
  44. package/src/primitives/textArea/textArea.tsx +7 -11
  45. package/src/primitives/textInput/textInput.tsx +12 -12
  46. package/src/primitives/tooltip/__workshop__/props.tsx +20 -3
  47. package/src/primitives/tooltip/tooltipArrow.tsx +3 -2
  48. package/src/styles/border/borderStyle.ts +2 -1
  49. package/src/styles/colorVars/colorVarsStyle.ts +73 -32
  50. package/src/styles/focusRing/index.ts +6 -4
  51. package/src/styles/input/textInputStyle.ts +76 -93
  52. package/src/styles/margin/marginsStyle.test.ts +1 -2
  53. package/src/styles/padding/paddingStyle.test.ts +1 -2
  54. package/src/styles/shadow/shadowStyle.ts +5 -5
  55. package/src/theme/__workshop__/color.tsx +2 -2
  56. package/src/theme/__workshop__/index.ts +0 -5
  57. package/src/theme/lib/color-fns/blend/multiply.ts +2 -2
  58. package/src/theme/lib/color-fns/blend/screen.ts +2 -2
  59. package/src/theme/lib/color-fns/convert.ts +15 -1
  60. package/src/theme/lib/color-fns/parse.ts +7 -3
  61. package/src/theme/lib/color-fns/types.ts +11 -0
  62. package/src/theme/lib/theme/color/cssVariables/cardVariables.ts +92 -0
  63. package/src/theme/lib/theme/color/cssVariables/createCssVars.ts +31 -0
  64. package/src/theme/lib/theme/color/cssVariables/cssVars.test.ts +262 -0
  65. package/src/theme/lib/theme/color/cssVariables/index.ts +1 -0
  66. package/src/theme/lib/theme/color/cssVariables/tints.ts +312 -0
  67. package/src/theme/lib/theme/color/cssVariables/tones.ts +67 -0
  68. package/src/theme/lib/theme/color/cssVariables/utils.test.ts +15 -0
  69. package/src/theme/lib/theme/color/cssVariables/utils.ts +9 -0
  70. package/src/theme/lib/theme/color/index.ts +2 -12
  71. package/src/theme/lib/theme/color/types.ts +6 -37
  72. package/src/theme/studioTheme/color.ts +2 -641
  73. package/src/theme/studioTheme/helpers.ts +15 -1
  74. package/src/theme/studioTheme/theme.ts +9 -3
  75. package/src/theme/themeColorProvider.tsx +2 -0
  76. package/src/theme/themeProvider.tsx +27 -8
  77. package/src/theme/toneContext/toneContext.ts +12 -0
  78. package/src/theme/toneContext/toneProvider.tsx +31 -0
  79. package/src/theme/toneContext/types.ts +10 -0
  80. package/src/theme/toneContext/useToneContext.tsx +26 -0
  81. package/src/theme/types.ts +2 -4
  82. package/src/utils/elementQuery/__workshop__/customMedia.tsx +4 -3
  83. package/src/theme/__workshop__/canvas.tsx +0 -395
  84. package/src/theme/lib/theme/color/_generic/index.ts +0 -1
  85. package/src/theme/lib/theme/color/_generic/types.ts +0 -30
  86. package/src/theme/lib/theme/color/base/index.ts +0 -1
  87. package/src/theme/lib/theme/color/base/types.ts +0 -19
  88. package/src/theme/lib/theme/color/button/createButtonModes.ts +0 -20
  89. package/src/theme/lib/theme/color/button/createButtonTones.ts +0 -52
  90. package/src/theme/lib/theme/color/button/index.ts +0 -1
  91. package/src/theme/lib/theme/color/button/types.ts +0 -44
  92. package/src/theme/lib/theme/color/card/createCardStates.ts +0 -58
  93. package/src/theme/lib/theme/color/card/index.ts +0 -1
  94. package/src/theme/lib/theme/color/card/types.ts +0 -18
  95. package/src/theme/lib/theme/color/color.test.ts +0 -63
  96. package/src/theme/lib/theme/color/defaults.ts +0 -390
  97. package/src/theme/lib/theme/color/factory.ts +0 -138
  98. package/src/theme/lib/theme/color/input/createInputModes.ts +0 -84
  99. package/src/theme/lib/theme/color/input/index.ts +0 -1
  100. package/src/theme/lib/theme/color/input/types.ts +0 -28
  101. package/src/theme/lib/theme/color/muted/createMuted.ts +0 -56
  102. package/src/theme/lib/theme/color/muted/index.ts +0 -1
  103. package/src/theme/lib/theme/color/muted/types.ts +0 -24
  104. package/src/theme/lib/theme/color/selectable/createSelectableTones.ts +0 -73
  105. package/src/theme/lib/theme/color/selectable/index.ts +0 -1
  106. package/src/theme/lib/theme/color/selectable/types.ts +0 -29
  107. package/src/theme/lib/theme/color/solid/createSolidTones.ts +0 -56
  108. package/src/theme/lib/theme/color/solid/index.ts +0 -1
  109. package/src/theme/lib/theme/color/solid/types.ts +0 -24
  110. package/src/theme/lib/theme/color/spot/createSpot.ts +0 -21
  111. package/src/theme/lib/theme/color/spot/index.ts +0 -1
  112. package/src/theme/lib/theme/color/spot/types.ts +0 -28
  113. package/src/theme/lib/theme/color/syntax/index.ts +0 -1
  114. package/src/theme/lib/theme/color/syntax/types.ts +0 -41
  115. package/src/theme/studioTheme/tints.ts +0 -152
package/dist/index.esm.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import { useMemo, useState, useRef, useEffect, createContext, useContext, useSyncExternalStore, useLayoutEffect, forwardRef, useId, useCallback, cloneElement, isValidElement, createElement, Component, memo, useReducer, Children, Fragment as Fragment$1, startTransition } from 'react';
3
3
  import ReactIs, { isElement as isElement$1, isFragment, isValidElementType } from 'react-is';
4
- import styled, { ThemeProvider as ThemeProvider$1, useTheme as useTheme$1, css, keyframes } from 'styled-components';
5
- import { black as black$1, hues, white as white$1 } from '@sanity/color';
4
+ import styled, { createGlobalStyle, ThemeProvider as ThemeProvider$1, useTheme as useTheme$1, css, keyframes } from 'styled-components';
5
+ import { white, black, hues, gray, blue, purple, magenta, red, orange, yellow, green, cyan } from '@sanity/color';
6
6
  import { SpinnerIcon, CheckmarkIcon, RemoveIcon, SelectIcon, CloseIcon, ChevronDownIcon, ChevronRightIcon, ToggleArrowRightIcon } from '@sanity/icons';
7
7
  import Refractor from 'react-refractor';
8
8
  import { detectOverflow, flip, offset, shift, arrow, hide, useFloating, autoUpdate, size as size$2 } from '@floating-ui/react-dom';
@@ -874,6 +874,15 @@ function hexToRgb(hex) {
874
874
  b: parseInt(hex.slice(5, 7), 16)
875
875
  };
876
876
  }
877
+ function rgbaToRGBA(rgba) {
878
+ const values = rgba.replace(/rgba\(|\)/g, "").split(",");
879
+ return {
880
+ r: parseInt(values[0]),
881
+ g: parseInt(values[1]),
882
+ b: parseInt(values[2]),
883
+ a: parseFloat(values[3])
884
+ };
885
+ }
877
886
  function rgbToHex(_ref2) {
878
887
  let {
879
888
  r,
@@ -991,1915 +1000,416 @@ function parseColor(color) {
991
1000
  if (color.startsWith("hsl(")) {
992
1001
  return hslToRgb(parseHsl(color));
993
1002
  }
1003
+ if (color.startsWith("rgba(")) {
1004
+ return rgbaToRGBA(color);
1005
+ }
994
1006
  throw new Error('parseColor: unexpected color format: "'.concat(color, '"'));
995
1007
  }
996
1008
  function rgba(color, a) {
997
1009
  const rgb = parseColor(color);
998
1010
  return "rgba(".concat(rgb.r, ",").concat(rgb.g, ",").concat(rgb.b, ",").concat(a, ")");
999
1011
  }
1000
- function createButtonTones(opts, base, dark, solid, muted, mode) {
1001
- return {
1002
- default: opts.button({
1003
- base,
1004
- dark,
1005
- solid: solid.default,
1006
- muted: muted.default,
1007
- mode
1008
- }),
1009
- primary: opts.button({
1010
- base,
1011
- dark,
1012
- solid: solid.primary,
1013
- muted: muted.primary,
1014
- mode
1015
- }),
1016
- positive: opts.button({
1017
- base,
1018
- dark,
1019
- solid: solid.positive,
1020
- muted: muted.positive,
1021
- mode
1022
- }),
1023
- caution: opts.button({
1024
- base,
1025
- dark,
1026
- solid: solid.caution,
1027
- muted: muted.caution,
1028
- mode
1029
- }),
1030
- critical: opts.button({
1031
- base,
1032
- dark,
1033
- solid: solid.critical,
1034
- muted: muted.critical,
1035
- mode
1036
- })
1037
- };
1038
- }
1039
- function createButtonModes(opts, base, dark, solid, muted) {
1040
- return {
1041
- default: createButtonTones(opts, base, dark, solid, muted, "default"),
1042
- ghost: createButtonTones(opts, base, dark, solid, muted, "ghost"),
1043
- bleed: createButtonTones(opts, base, dark, solid, muted, "bleed")
1044
- };
1045
- }
1046
- function createCardStates(opts, base, dark, name, solid, muted) {
1047
- return {
1048
- enabled: opts.card({
1049
- base,
1050
- dark,
1051
- name,
1052
- state: "enabled",
1053
- solid,
1054
- muted
1055
- }),
1056
- disabled: opts.card({
1057
- base,
1058
- dark,
1059
- name,
1060
- state: "disabled",
1061
- solid,
1062
- muted
1063
- }),
1064
- hovered: opts.card({
1065
- base,
1066
- dark,
1067
- name,
1068
- state: "hovered",
1069
- solid,
1070
- muted
1071
- }),
1072
- pressed: opts.card({
1073
- base,
1074
- dark,
1075
- name,
1076
- state: "pressed",
1077
- solid,
1078
- muted
1079
- }),
1080
- selected: opts.card({
1081
- base,
1082
- dark,
1083
- name,
1084
- state: "selected",
1085
- solid,
1086
- muted
1087
- })
1088
- };
1089
- }
1090
- const black = "hsl(0, 0%, 0%)";
1091
- const white = "hsl(0, 0%, 100%)";
1092
- const colors = {
1093
- default: {
1094
- lightest: "hsl(0, 0%, 95%)",
1095
- lighter: "hsl(0, 0%, 70%)",
1096
- light: "hsl(0, 0%, 65%)",
1097
- base: "hsl(0, 0%, 50%)",
1098
- dark: "hsl(0, 0%, 35%)",
1099
- darker: "hsl(0, 0%, 20%)",
1100
- darkest: "hsl(0, 0%, 5%)"
1101
- },
1102
- transparent: {
1103
- lightest: "hsl(240, 100%, 95%)",
1104
- lighter: "hsl(240, 100%, 70%)",
1105
- light: "hsl(240, 100%, 65%)",
1106
- base: "hsl(240, 100%, 50%)",
1107
- dark: "hsl(240, 100%, 35%)",
1108
- darker: "hsl(240, 100%, 20%)",
1109
- darkest: "hsl(240, 100%, 5%)"
1110
- },
1111
- primary: {
1112
- lightest: "hsl(240, 100%, 95%)",
1113
- lighter: "hsl(240, 100%, 70%)",
1114
- light: "hsl(240, 100%, 65%)",
1115
- base: "hsl(240, 100%, 50%)",
1116
- dark: "hsl(240, 100%, 35%)",
1117
- darker: "hsl(240, 100%, 20%)",
1118
- darkest: "hsl(240, 100%, 5%)"
1119
- },
1120
- positive: {
1121
- lightest: "hsl(120, 100%, 95%)",
1122
- lighter: "hsl(120, 100%, 70%)",
1123
- light: "hsl(120, 100%, 65%)",
1124
- base: "hsl(120, 100%, 50%)",
1125
- dark: "hsl(120, 100%, 35%)",
1126
- darker: "hsl(120, 100%, 20%)",
1127
- darkest: "hsl(120, 100%, 5%)"
1128
- },
1129
- caution: {
1130
- lightest: "hsl(60, 100%, 95%)",
1131
- lighter: "hsl(60, 100%, 70%)",
1132
- light: "hsl(60, 100%, 65%)",
1133
- base: "hsl(60, 100%, 50%)",
1134
- dark: "hsl(60, 100%, 35%)",
1135
- darker: "hsl(60, 100%, 20%)",
1136
- darkest: "hsl(60, 100%, 5%)"
1137
- },
1138
- critical: {
1139
- lightest: "hsl(0, 100%, 95%)",
1140
- lighter: "hsl(0, 100%, 70%)",
1141
- light: "hsl(0, 100%, 65%)",
1142
- base: "hsl(0, 100%, 50%)",
1143
- dark: "hsl(0, 100%, 35%)",
1144
- darker: "hsl(0, 100%, 20%)",
1145
- darkest: "hsl(0, 100%, 5%)"
1146
- }
1147
- };
1148
- const spots = {
1149
- gray: "hsl(0, 0%, 50%)",
1150
- red: "hsl(0, 100%, 50%)",
1151
- orange: "hsl(30, 100%, 50%)",
1152
- yellow: "hsl(60, 100%, 50%)",
1153
- green: "hsl(120, 100%, 50%)",
1154
- cyan: "hsl(180, 100%, 50%)",
1155
- blue: "hsl(240, 100%, 50%)",
1156
- purple: "hsl(270, 100%, 50%)",
1157
- magenta: "hsl(300, 100%, 50%)"
1158
- };
1159
- const tones$1 = {
1160
- transparent: {
1161
- bg: [colors.transparent.darkest, colors.transparent.lightest],
1162
- fg: [colors.transparent.lightest, colors.transparent.darkest],
1163
- border: [colors.transparent.darker, colors.transparent.lighter],
1164
- focusRing: [colors.transparent.base, colors.transparent.base]
1165
- },
1166
- primary: {
1167
- bg: [colors.primary.darkest, colors.primary.lightest],
1168
- fg: [colors.primary.lightest, colors.primary.darkest],
1169
- border: [colors.primary.darker, colors.primary.lighter],
1170
- focusRing: [colors.primary.base, colors.primary.base]
1171
- },
1172
- positive: {
1173
- bg: [colors.positive.darkest, colors.positive.lightest],
1174
- fg: [colors.positive.lightest, colors.positive.darkest],
1175
- border: [colors.positive.darker, colors.positive.lighter],
1176
- focusRing: [colors.positive.base, colors.positive.base]
1177
- },
1178
- caution: {
1179
- bg: [colors.caution.darkest, colors.caution.lightest],
1180
- fg: [colors.caution.lightest, colors.caution.darkest],
1181
- border: [colors.caution.darker, colors.caution.lighter],
1182
- focusRing: [colors.caution.base, colors.caution.base]
1183
- },
1184
- critical: {
1185
- bg: [colors.critical.darkest, colors.critical.lightest],
1186
- fg: [colors.critical.lightest, colors.critical.darkest],
1187
- border: [colors.critical.darker, colors.critical.lighter],
1188
- focusRing: [colors.critical.base, colors.critical.base]
1189
- }
1190
- };
1191
- const defaultOpts = {
1192
- base: _ref4 => {
1193
- let {
1194
- dark,
1195
- name
1196
- } = _ref4;
1197
- if (name === "default") {
1198
- return {
1199
- bg: dark ? black : white,
1200
- fg: dark ? white : black,
1201
- border: dark ? colors.default.darkest : colors.default.lightest,
1202
- focusRing: colors.primary.base,
1203
- shadow: {
1204
- outline: black,
1205
- umbra: black,
1206
- penumbra: black,
1207
- ambient: black
1208
- },
1209
- skeleton: {
1210
- from: dark ? white : black,
1211
- to: dark ? white : black
1212
- }
1213
- };
1214
- }
1215
- return {
1216
- bg: tones$1[name].bg[dark ? 0 : 1],
1217
- fg: tones$1[name].fg[dark ? 0 : 1],
1218
- border: tones$1[name].border[dark ? 0 : 1],
1219
- focusRing: tones$1[name].focusRing[dark ? 0 : 1],
1220
- shadow: {
1221
- outline: black,
1222
- umbra: black,
1223
- penumbra: black,
1224
- ambient: black
1225
- },
1226
- skeleton: {
1227
- from: dark ? white : black,
1228
- to: dark ? white : black
1229
- }
1230
- };
1231
- },
1232
- solid: _ref5 => {
1233
- let {
1234
- base,
1235
- dark,
1236
- state,
1237
- tone
1238
- } = _ref5;
1239
- const color = colors[tone];
1240
- if (state === "hovered") {
1241
- return {
1242
- bg: dark ? color.light : color.dark,
1243
- bg2: dark ? color.light : color.dark,
1244
- border: dark ? color.lighter : color.darker,
1245
- fg: dark ? color.darkest : color.lightest,
1246
- iconColor: dark ? color.darkest : color.lightest,
1247
- muted: {
1248
- fg: black
1249
- },
1250
- accent: {
1251
- fg: black
1252
- },
1253
- link: {
1254
- fg: black
1255
- },
1256
- code: {
1257
- bg: black,
1258
- fg: black
1259
- },
1260
- skeleton: base.skeleton
1261
- };
1262
- }
1263
- return {
1264
- bg: color.base,
1265
- bg2: color.base,
1266
- border: dark ? color.light : color.dark,
1267
- fg: dark ? color.darkest : color.lightest,
1268
- iconColor: dark ? color.darkest : color.lightest,
1269
- muted: {
1270
- fg: black
1271
- },
1272
- accent: {
1273
- fg: black
1274
- },
1275
- link: {
1276
- fg: black
1277
- },
1278
- code: {
1279
- bg: black,
1280
- fg: black
1281
- },
1282
- skeleton: base.skeleton
1283
- };
1284
- },
1285
- muted: _ref6 => {
1286
- let {
1287
- base,
1288
- dark,
1289
- state,
1290
- tone
1291
- } = _ref6;
1292
- const color = colors[tone];
1293
- if (state === "hovered") {
1294
- return {
1295
- bg: dark ? color.darker : color.lighter,
1296
- bg2: dark ? color.darker : color.lighter,
1297
- border: dark ? color.lighter : color.darker,
1298
- fg: dark ? color.lightest : color.darkest,
1299
- iconColor: dark ? color.lightest : color.darkest,
1300
- muted: {
1301
- fg: black
1302
- },
1303
- accent: {
1304
- fg: black
1305
- },
1306
- link: {
1307
- fg: black
1308
- },
1309
- code: {
1310
- bg: black,
1311
- fg: black
1312
- },
1313
- skeleton: base.skeleton
1314
- };
1315
- }
1316
- return {
1317
- bg: dark ? color.darkest : color.lightest,
1318
- bg2: dark ? color.darkest : color.lightest,
1319
- border: dark ? color.darker : color.lighter,
1320
- fg: dark ? color.lighter : color.darker,
1321
- iconColor: dark ? color.lighter : color.darker,
1322
- muted: {
1323
- fg: black
1324
- },
1325
- accent: {
1326
- fg: black
1327
- },
1328
- link: {
1329
- fg: black
1330
- },
1331
- code: {
1332
- bg: black,
1333
- fg: black
1334
- },
1335
- skeleton: base.skeleton
1336
- };
1337
- },
1338
- button: _ref7 => {
1339
- let {
1340
- base,
1341
- mode,
1342
- muted,
1343
- solid
1344
- } = _ref7;
1345
- if (mode === "bleed") {
1346
- return {
1347
- ...muted,
1348
- enabled: {
1349
- bg: "transparent",
1350
- bg2: "transparent",
1351
- fg: muted.enabled.fg,
1352
- iconColor: muted.enabled.fg,
1353
- border: "transparent",
1354
- muted: {
1355
- fg: black
1356
- },
1357
- accent: {
1358
- fg: black
1359
- },
1360
- link: {
1361
- fg: black
1362
- },
1363
- code: {
1364
- bg: black,
1365
- fg: black
1366
- },
1367
- skeleton: base.skeleton
1368
- },
1369
- hovered: {
1370
- bg: muted.enabled.bg,
1371
- bg2: muted.enabled.bg,
1372
- fg: muted.hovered.fg,
1373
- iconColor: muted.hovered.fg,
1374
- border: "transparent",
1375
- muted: {
1376
- fg: black
1377
- },
1378
- accent: {
1379
- fg: black
1380
- },
1381
- link: {
1382
- fg: black
1383
- },
1384
- code: {
1385
- bg: black,
1386
- fg: black
1387
- },
1388
- skeleton: base.skeleton
1389
- }
1390
- };
1391
- }
1392
- if (mode === "ghost") return {
1393
- ...solid,
1394
- enabled: muted.enabled
1395
- };
1396
- return solid;
1397
- },
1398
- card: _ref8 => {
1399
- let {
1400
- base
1401
- } = _ref8;
1402
- return {
1403
- bg: black,
1404
- bg2: black,
1405
- fg: black,
1406
- iconColor: black,
1407
- border: black,
1408
- muted: {
1409
- fg: black
1410
- },
1411
- accent: {
1412
- fg: black
1413
- },
1414
- link: {
1415
- fg: black
1416
- },
1417
- code: {
1418
- bg: black,
1419
- fg: black
1420
- },
1421
- skeleton: base.skeleton
1422
- };
1423
- },
1424
- input: () => {
1425
- return {
1426
- bg: black,
1427
- bg2: black,
1428
- fg: black,
1429
- border: black,
1430
- placeholder: black
1431
- };
1432
- },
1433
- selectable: _ref9 => {
1434
- let {
1435
- muted,
1436
- state,
1437
- tone
1438
- } = _ref9;
1439
- return muted[tone][state];
1440
- },
1441
- spot: _ref10 => {
1442
- let {
1443
- key
1444
- } = _ref10;
1445
- return spots[key];
1446
- },
1447
- syntax: () => ({
1448
- atrule: black,
1449
- attrName: black,
1450
- attrValue: black,
1451
- attribute: black,
1452
- boolean: black,
1453
- builtin: black,
1454
- cdata: black,
1455
- char: black,
1456
- class: black,
1457
- className: black,
1458
- comment: black,
1459
- constant: black,
1460
- deleted: black,
1461
- doctype: black,
1462
- entity: black,
1463
- function: black,
1464
- hexcode: black,
1465
- id: black,
1466
- important: black,
1467
- inserted: black,
1468
- keyword: black,
1469
- number: black,
1470
- operator: black,
1471
- prolog: black,
1472
- property: black,
1473
- pseudoClass: black,
1474
- pseudoElement: black,
1475
- punctuation: black,
1476
- regex: black,
1477
- selector: black,
1478
- string: black,
1479
- symbol: black,
1480
- tag: black,
1481
- unit: black,
1482
- url: black,
1483
- variable: black
1484
- })
1485
- };
1486
- function createInputModes(opts, base, dark, solid, muted) {
1487
- return {
1488
- default: {
1489
- enabled: opts.input({
1490
- base,
1491
- dark,
1492
- mode: "default",
1493
- state: "enabled",
1494
- solid: solid.default,
1495
- muted: muted.default
1496
- }),
1497
- disabled: opts.input({
1498
- base,
1499
- dark,
1500
- mode: "default",
1501
- state: "disabled",
1502
- solid: solid.default,
1503
- muted: muted.default
1504
- }),
1505
- hovered: opts.input({
1506
- base,
1507
- dark,
1508
- mode: "default",
1509
- state: "hovered",
1510
- solid: solid.default,
1511
- muted: muted.default
1512
- }),
1513
- readOnly: opts.input({
1514
- base,
1515
- dark,
1516
- mode: "default",
1517
- state: "readOnly",
1518
- solid: solid.default,
1519
- muted: muted.default
1520
- })
1521
- },
1522
- invalid: {
1523
- enabled: opts.input({
1524
- base,
1525
- dark,
1526
- mode: "invalid",
1527
- state: "enabled",
1528
- solid: solid.default,
1529
- muted: muted.default
1530
- }),
1531
- disabled: opts.input({
1532
- base,
1533
- dark,
1534
- mode: "invalid",
1535
- state: "disabled",
1536
- solid: solid.default,
1537
- muted: muted.default
1538
- }),
1539
- hovered: opts.input({
1540
- base,
1541
- dark,
1542
- mode: "invalid",
1543
- state: "hovered",
1544
- solid: solid.default,
1545
- muted: muted.default
1546
- }),
1547
- readOnly: opts.input({
1548
- base,
1549
- dark,
1550
- mode: "invalid",
1551
- state: "readOnly",
1552
- solid: solid.default,
1553
- muted: muted.default
1554
- })
1555
- }
1556
- };
1557
- }
1558
- function createMutedTones(opts, base, dark, name) {
1559
- return {
1560
- default: {
1561
- enabled: opts.muted({
1562
- base,
1563
- dark,
1564
- tone: "default",
1565
- name,
1566
- state: "enabled"
1567
- }),
1568
- disabled: opts.muted({
1569
- base,
1570
- dark,
1571
- tone: "default",
1572
- name,
1573
- state: "disabled"
1574
- }),
1575
- hovered: opts.muted({
1576
- base,
1577
- dark,
1578
- tone: "default",
1579
- name,
1580
- state: "hovered"
1581
- }),
1582
- pressed: opts.muted({
1583
- base,
1584
- dark,
1585
- tone: "default",
1586
- name,
1587
- state: "pressed"
1588
- }),
1589
- selected: opts.muted({
1590
- base,
1591
- dark,
1592
- tone: "default",
1593
- name,
1594
- state: "selected"
1595
- })
1596
- },
1597
- transparent: {
1598
- enabled: opts.muted({
1599
- base,
1600
- dark,
1601
- tone: "transparent",
1602
- name,
1603
- state: "enabled"
1604
- }),
1605
- disabled: opts.muted({
1606
- base,
1607
- dark,
1608
- tone: "transparent",
1609
- name,
1610
- state: "disabled"
1611
- }),
1612
- hovered: opts.muted({
1613
- base,
1614
- dark,
1615
- tone: "transparent",
1616
- name,
1617
- state: "hovered"
1618
- }),
1619
- pressed: opts.muted({
1620
- base,
1621
- dark,
1622
- tone: "transparent",
1623
- name,
1624
- state: "pressed"
1625
- }),
1626
- selected: opts.muted({
1627
- base,
1628
- dark,
1629
- tone: "transparent",
1630
- name,
1631
- state: "selected"
1632
- })
1633
- },
1634
- primary: {
1635
- enabled: opts.muted({
1636
- base,
1637
- dark,
1638
- tone: "primary",
1639
- name,
1640
- state: "enabled"
1641
- }),
1642
- disabled: opts.muted({
1643
- base,
1644
- dark,
1645
- tone: "primary",
1646
- name,
1647
- state: "disabled"
1648
- }),
1649
- hovered: opts.muted({
1650
- base,
1651
- dark,
1652
- tone: "primary",
1653
- name,
1654
- state: "hovered"
1655
- }),
1656
- pressed: opts.muted({
1657
- base,
1658
- dark,
1659
- tone: "primary",
1660
- name,
1661
- state: "pressed"
1662
- }),
1663
- selected: opts.muted({
1664
- base,
1665
- dark,
1666
- tone: "primary",
1667
- name,
1668
- state: "selected"
1669
- })
1670
- },
1671
- positive: {
1672
- enabled: opts.muted({
1673
- base,
1674
- dark,
1675
- tone: "positive",
1676
- name,
1677
- state: "enabled"
1678
- }),
1679
- disabled: opts.muted({
1680
- base,
1681
- dark,
1682
- tone: "positive",
1683
- name,
1684
- state: "disabled"
1685
- }),
1686
- hovered: opts.muted({
1687
- base,
1688
- dark,
1689
- tone: "positive",
1690
- name,
1691
- state: "hovered"
1692
- }),
1693
- pressed: opts.muted({
1694
- base,
1695
- dark,
1696
- tone: "positive",
1697
- name,
1698
- state: "pressed"
1699
- }),
1700
- selected: opts.muted({
1701
- base,
1702
- dark,
1703
- tone: "positive",
1704
- name,
1705
- state: "selected"
1706
- })
1707
- },
1708
- caution: {
1709
- enabled: opts.muted({
1710
- base,
1711
- dark,
1712
- tone: "caution",
1713
- name,
1714
- state: "enabled"
1715
- }),
1716
- disabled: opts.muted({
1717
- base,
1718
- dark,
1719
- tone: "caution",
1720
- name,
1721
- state: "disabled"
1722
- }),
1723
- hovered: opts.muted({
1724
- base,
1725
- dark,
1726
- tone: "caution",
1727
- name,
1728
- state: "hovered"
1729
- }),
1730
- pressed: opts.muted({
1731
- base,
1732
- dark,
1733
- tone: "caution",
1734
- name,
1735
- state: "pressed"
1736
- }),
1737
- selected: opts.muted({
1738
- base,
1739
- dark,
1740
- tone: "caution",
1741
- name,
1742
- state: "selected"
1743
- })
1744
- },
1745
- critical: {
1746
- enabled: opts.muted({
1747
- base,
1748
- dark,
1749
- tone: "critical",
1750
- name,
1751
- state: "enabled"
1752
- }),
1753
- disabled: opts.muted({
1754
- base,
1755
- dark,
1756
- tone: "critical",
1757
- name,
1758
- state: "disabled"
1759
- }),
1760
- hovered: opts.muted({
1761
- base,
1762
- dark,
1763
- tone: "critical",
1764
- name,
1765
- state: "hovered"
1766
- }),
1767
- pressed: opts.muted({
1768
- base,
1769
- dark,
1770
- tone: "critical",
1771
- name,
1772
- state: "pressed"
1773
- }),
1774
- selected: opts.muted({
1775
- base,
1776
- dark,
1777
- tone: "critical",
1778
- name,
1779
- state: "selected"
1780
- })
1781
- }
1782
- };
1783
- }
1784
- function createSelectableTones(opts, base, dark, solid, muted) {
1785
- return {
1786
- default: _createSelectableStates(opts, base, dark, solid, muted, "default"),
1787
- primary: _createSelectableStates(opts, base, dark, solid, muted, "primary"),
1788
- positive: _createSelectableStates(opts, base, dark, solid, muted, "positive"),
1789
- caution: _createSelectableStates(opts, base, dark, solid, muted, "caution"),
1790
- critical: _createSelectableStates(opts, base, dark, solid, muted, "critical")
1791
- };
1792
- }
1793
- function _createSelectableStates(opts, base, dark, solid, muted, tone) {
1794
- return {
1795
- enabled: opts.selectable({
1796
- base,
1797
- dark,
1798
- solid,
1799
- muted,
1800
- state: "enabled",
1801
- tone
1802
- }),
1803
- hovered: opts.selectable({
1804
- base,
1805
- dark,
1806
- solid,
1807
- muted,
1808
- state: "hovered",
1809
- tone
1810
- }),
1811
- pressed: opts.selectable({
1812
- base,
1813
- dark,
1814
- solid,
1815
- muted,
1816
- state: "pressed",
1817
- tone
1818
- }),
1819
- selected: opts.selectable({
1820
- base,
1821
- dark,
1822
- solid,
1823
- muted,
1824
- state: "selected",
1825
- tone
1826
- }),
1827
- disabled: opts.selectable({
1828
- base,
1829
- dark,
1830
- solid,
1831
- muted,
1832
- state: "disabled",
1833
- tone
1834
- })
1835
- };
1836
- }
1837
- function createSolidTones(opts, base, dark, name) {
1838
- return {
1839
- default: {
1840
- enabled: opts.solid({
1841
- base,
1842
- dark,
1843
- tone: "default",
1844
- name,
1845
- state: "enabled"
1846
- }),
1847
- disabled: opts.solid({
1848
- base,
1849
- dark,
1850
- tone: "default",
1851
- name,
1852
- state: "disabled"
1853
- }),
1854
- hovered: opts.solid({
1855
- base,
1856
- dark,
1857
- tone: "default",
1858
- name,
1859
- state: "hovered"
1860
- }),
1861
- pressed: opts.solid({
1862
- base,
1863
- dark,
1864
- tone: "default",
1865
- name,
1866
- state: "pressed"
1867
- }),
1868
- selected: opts.solid({
1869
- base,
1870
- dark,
1871
- tone: "default",
1872
- name,
1873
- state: "selected"
1874
- })
1875
- },
1876
- transparent: {
1877
- enabled: opts.solid({
1878
- base,
1879
- dark,
1880
- tone: "transparent",
1881
- name,
1882
- state: "enabled"
1883
- }),
1884
- disabled: opts.solid({
1885
- base,
1886
- dark,
1887
- tone: "transparent",
1888
- name,
1889
- state: "disabled"
1890
- }),
1891
- hovered: opts.solid({
1892
- base,
1893
- dark,
1894
- tone: "transparent",
1895
- name,
1896
- state: "hovered"
1897
- }),
1898
- pressed: opts.solid({
1899
- base,
1900
- dark,
1901
- tone: "transparent",
1902
- name,
1903
- state: "pressed"
1904
- }),
1905
- selected: opts.solid({
1906
- base,
1907
- dark,
1908
- tone: "transparent",
1909
- name,
1910
- state: "selected"
1911
- })
1912
- },
1913
- primary: {
1914
- enabled: opts.solid({
1915
- base,
1916
- dark,
1917
- tone: "primary",
1918
- name,
1919
- state: "enabled"
1920
- }),
1921
- disabled: opts.solid({
1922
- base,
1923
- dark,
1924
- tone: "primary",
1925
- name,
1926
- state: "disabled"
1927
- }),
1928
- hovered: opts.solid({
1929
- base,
1930
- dark,
1931
- tone: "primary",
1932
- name,
1933
- state: "hovered"
1934
- }),
1935
- pressed: opts.solid({
1936
- base,
1937
- dark,
1938
- tone: "primary",
1939
- name,
1940
- state: "pressed"
1941
- }),
1942
- selected: opts.solid({
1943
- base,
1944
- dark,
1945
- tone: "primary",
1946
- name,
1947
- state: "selected"
1948
- })
1949
- },
1950
- positive: {
1951
- enabled: opts.solid({
1952
- base,
1953
- dark,
1954
- tone: "positive",
1955
- name,
1956
- state: "enabled"
1957
- }),
1958
- disabled: opts.solid({
1959
- base,
1960
- dark,
1961
- tone: "positive",
1962
- name,
1963
- state: "disabled"
1964
- }),
1965
- hovered: opts.solid({
1966
- base,
1967
- dark,
1968
- tone: "positive",
1969
- name,
1970
- state: "hovered"
1971
- }),
1972
- pressed: opts.solid({
1973
- base,
1974
- dark,
1975
- tone: "positive",
1976
- name,
1977
- state: "pressed"
1978
- }),
1979
- selected: opts.solid({
1980
- base,
1981
- dark,
1982
- tone: "positive",
1983
- name,
1984
- state: "selected"
1985
- })
1986
- },
1987
- caution: {
1988
- enabled: opts.solid({
1989
- base,
1990
- dark,
1991
- tone: "caution",
1992
- name,
1993
- state: "enabled"
1994
- }),
1995
- disabled: opts.solid({
1996
- base,
1997
- dark,
1998
- tone: "caution",
1999
- name,
2000
- state: "disabled"
2001
- }),
2002
- hovered: opts.solid({
2003
- base,
2004
- dark,
2005
- tone: "caution",
2006
- name,
2007
- state: "hovered"
2008
- }),
2009
- pressed: opts.solid({
2010
- base,
2011
- dark,
2012
- tone: "caution",
2013
- name,
2014
- state: "pressed"
2015
- }),
2016
- selected: opts.solid({
2017
- base,
2018
- dark,
2019
- tone: "caution",
2020
- name,
2021
- state: "selected"
2022
- })
2023
- },
2024
- critical: {
2025
- enabled: opts.solid({
2026
- base,
2027
- dark,
2028
- tone: "critical",
2029
- name,
2030
- state: "enabled"
2031
- }),
2032
- disabled: opts.solid({
2033
- base,
2034
- dark,
2035
- tone: "critical",
2036
- name,
2037
- state: "disabled"
2038
- }),
2039
- hovered: opts.solid({
2040
- base,
2041
- dark,
2042
- tone: "critical",
2043
- name,
2044
- state: "hovered"
2045
- }),
2046
- pressed: opts.solid({
2047
- base,
2048
- dark,
2049
- tone: "critical",
2050
- name,
2051
- state: "pressed"
2052
- }),
2053
- selected: opts.solid({
2054
- base,
2055
- dark,
2056
- tone: "critical",
2057
- name,
2058
- state: "selected"
2059
- })
2060
- }
2061
- };
2062
- }
2063
- function createSpot(opts, base, dark) {
2064
- return {
2065
- gray: opts.spot({
2066
- base,
2067
- dark,
2068
- key: "gray"
2069
- }),
2070
- blue: opts.spot({
2071
- base,
2072
- dark,
2073
- key: "blue"
2074
- }),
2075
- purple: opts.spot({
2076
- base,
2077
- dark,
2078
- key: "purple"
2079
- }),
2080
- magenta: opts.spot({
2081
- base,
2082
- dark,
2083
- key: "magenta"
2084
- }),
2085
- red: opts.spot({
2086
- base,
2087
- dark,
2088
- key: "red"
2089
- }),
2090
- orange: opts.spot({
2091
- base,
2092
- dark,
2093
- key: "orange"
2094
- }),
2095
- yellow: opts.spot({
2096
- base,
2097
- dark,
2098
- key: "yellow"
2099
- }),
2100
- green: opts.spot({
2101
- base,
2102
- dark,
2103
- key: "green"
2104
- }),
2105
- cyan: opts.spot({
2106
- base,
2107
- dark,
2108
- key: "cyan"
2109
- })
2110
- };
2111
- }
2112
- function createColorTheme() {
2113
- let partialOpts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2114
- const builders = {
2115
- ...defaultOpts,
2116
- ...partialOpts
2117
- };
2118
- return {
2119
- light: _createColorScheme(builders, false),
2120
- dark: _createColorScheme(builders, true)
2121
- };
2122
- }
2123
- function _createColorScheme(opts, dark) {
2124
- return {
2125
- default: _createColor(opts, dark, "default"),
2126
- transparent: _createColor(opts, dark, "transparent"),
2127
- primary: _createColor(opts, dark, "primary"),
2128
- positive: _createColor(opts, dark, "positive"),
2129
- caution: _createColor(opts, dark, "caution"),
2130
- critical: _createColor(opts, dark, "critical")
2131
- };
2132
- }
2133
- function _createColor(opts, dark, name) {
2134
- const base = opts.base({
2135
- dark,
2136
- name
2137
- });
2138
- const solid = createSolidTones(opts, base, dark, name);
2139
- const muted = createMutedTones(opts, base, dark, name);
2140
- return {
2141
- base,
2142
- button: createButtonModes(opts, base, dark, solid, muted),
2143
- card: createCardStates(opts, base, dark, name, solid, muted),
2144
- dark,
2145
- input: createInputModes(opts, base, dark, solid, muted),
2146
- selectable: createSelectableTones(opts, base, dark, solid, muted),
2147
- spot: createSpot(opts, base, dark),
2148
- syntax: opts.syntax({
2149
- base,
2150
- dark
2151
- }),
2152
- solid,
2153
- muted
2154
- };
2155
- }
2156
1012
  function multiply(bg, fg) {
2157
1013
  const b = parseColor(bg);
2158
1014
  const s = parseColor(fg);
2159
1015
  const hex = rgbToHex(multiply$1(b, s));
1016
+ if (s.a) {
1017
+ return rgba(hex, s.a);
1018
+ }
2160
1019
  return hex;
2161
1020
  }
2162
1021
  function screen(bg, fg) {
2163
1022
  const b = parseColor(bg);
2164
1023
  const s = parseColor(fg);
2165
1024
  const hex = rgbToHex(screen$1(b, s));
1025
+ if (s.a) {
1026
+ return rgba(hex, s.a);
1027
+ }
2166
1028
  return hex;
2167
1029
  }
1030
+ const colorKeys = ["text-primary", "text-secondary", "text-inactive",
1031
+ // 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
1032
+ "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",
1033
+ // TODO: Can we replace this with bg_tint? It's used by the code html element if it's inside a text
1034
+ "bg-tint-code", "icon-default", "icon-inverted", "border-base", "border-base-hover", "border-accent", "border-accent-inverted",
1035
+ // Colors starting with -base won't be affected by the mix function
1036
+ "base-bg-card",
1037
+ // This is used by the card when a tone is defined, it will also override the bg-base in the rest of the components.
1038
+ "base-bg-raw",
1039
+ // This is the same color as bg-base, but it won't be overridden by the card bg color, used in selectable items.
1040
+ "base-shadow-outline-color", "base-shadow-umbra-color", "base-shadow-penumbra-color", "base-shadow-ambient-color", "base-text-color",
1041
+ // Color used by the buttons for default mode text
1042
+ "skeleton-from", "skeleton-to"];
2168
1043
  const defaultTints = {
2169
1044
  light: {
2170
- text_primary: "900",
2171
- text_secondary: "600",
2172
- text_inactive: "500",
2173
- bg_base: white$1,
2174
- bg_base_hover: "50",
2175
- bg_base_active: "100",
2176
- bg_accent: "500",
2177
- bg_accent_hover: "600",
2178
- bg_accent_active: "700",
2179
- bg_tint: "50",
2180
- icon_default: "500",
2181
- icon_inverted: white$1,
2182
- border_base: "100",
2183
- border_accent: "500",
2184
- border_accent_inverted: white$1
2185
- },
2186
- dark: {
2187
- text_primary: "50",
2188
- text_secondary: "300",
2189
- text_inactive: "400",
2190
- bg_base: black$1,
2191
- bg_base_hover: "900",
2192
- bg_base_active: "800",
2193
- bg_accent: "500",
2194
- bg_accent_hover: "400",
2195
- bg_accent_active: "300",
2196
- bg_tint: "900",
2197
- icon_default: "300",
2198
- icon_inverted: hues.gray[900],
2199
- border_base: "800",
2200
- border_accent: "300",
2201
- border_accent_inverted: hues.gray[900]
2202
- }
2203
- };
2204
- const colorTints = {
2205
- light: {
2206
- default: {
2207
- ...defaultTints.light,
2208
- bg_accent: "900",
2209
- bg_accent_hover: "950",
2210
- bg_accent_active: black$1,
2211
- border_accent: "600"
1045
+ "text-primary": "900",
1046
+ "text-secondary": "600",
1047
+ "text-inactive": "500",
1048
+ "text-code": "600",
1049
+ "text-muted": "600",
1050
+ "text-link": {
1051
+ type: "colorTint",
1052
+ value: hues.blue["600"]
2212
1053
  },
2213
- primary: {
2214
- ...defaultTints.light,
2215
- bg_accent: "900",
2216
- bg_accent_hover: "950",
2217
- bg_accent_active: black$1,
2218
- border_accent: "600"
1054
+ "text-accent": {
1055
+ type: "colorTint",
1056
+ value: hues.red["500"]
2219
1057
  },
2220
- positive: {
2221
- ...defaultTints.light,
2222
- bg_base_hover: hues.gray[50],
2223
- bg_base_active: "50",
2224
- bg_accent: "400",
2225
- bg_accent_hover: "500",
2226
- bg_accent_active: "600",
2227
- border_accent: "400"
1058
+ "bg-base": {
1059
+ type: "colorTint",
1060
+ value: white
2228
1061
  },
2229
- transparent: defaultTints.light,
2230
- caution: defaultTints.light,
2231
- critical: defaultTints.light
2232
- },
2233
- dark: {
2234
- default: {
2235
- ...defaultTints.dark,
2236
- text_primary: white$1,
2237
- bg_accent: white$1,
2238
- bg_accent_hover: "50",
2239
- bg_accent_active: "100"
1062
+ "bg-base-hover": "50",
1063
+ "bg-base-active": "100",
1064
+ "bg-accent": "500",
1065
+ "bg-accent-hover": "600",
1066
+ "bg-accent-active": "700",
1067
+ "bg-tint": "50",
1068
+ "bg-tint-code": "50",
1069
+ "icon-default": "500",
1070
+ "icon-inverted": {
1071
+ type: "colorTint",
1072
+ value: white
2240
1073
  },
2241
- primary: {
2242
- ...defaultTints.dark,
2243
- text_primary: white$1,
2244
- bg_accent: white$1,
2245
- bg_accent_hover: "50",
2246
- bg_accent_active: "100"
1074
+ "border-base": "100",
1075
+ "border-base-hover": "200",
1076
+ "border-accent": "500",
1077
+ "border-accent-inverted": {
1078
+ type: "colorTint",
1079
+ value: white
2247
1080
  },
2248
- positive: {
2249
- ...defaultTints.dark,
2250
- bg_base_hover: hues.gray[900],
2251
- bg_base_active: "900",
2252
- bg_accent: "400",
2253
- bg_accent_hover: "300",
2254
- bg_accent_active: "200",
2255
- border_accent: "400"
1081
+ "base-bg-card": "50",
1082
+ "base-bg-raw": {
1083
+ type: "colorTint",
1084
+ value: white
2256
1085
  },
2257
- transparent: defaultTints.dark,
2258
- caution: defaultTints.dark,
2259
- critical: defaultTints.dark
2260
- }
2261
- };
2262
- const getColorValue = (tints, dark, tone, key) => {
2263
- const value = colorTints[dark ? "dark" : "light"][tone][key];
2264
- if (typeof value === "string") {
2265
- return tints[value];
2266
- }
2267
- return value;
2268
- };
2269
- const getColorHex = (tints, dark, tone, key) => {
2270
- return getColorValue(tints, dark, tone, key).hex;
2271
- };
2272
- const tones = {
2273
- default: hues.gray,
2274
- transparent: hues.gray,
2275
- primary: hues.gray,
2276
- positive: hues.cyan,
2277
- caution: hues.yellow,
2278
- critical: hues.red
2279
- };
2280
- const NEUTRAL_TONES = ["default", "transparent"];
2281
- const color = createColorTheme({
2282
- base: _ref11 => {
2283
- let {
2284
- dark,
2285
- name
2286
- } = _ref11;
2287
- if (name === "default") {
2288
- const tints2 = hues.gray;
2289
- const skeletonFrom2 = dark ? tints2[900].hex : tints2[100].hex;
2290
- return {
2291
- fg: dark ? white$1.hex : black$1.hex,
2292
- bg: getColorHex(tones["default"], dark, "default", "bg_base"),
2293
- border: getColorHex(tones["default"], dark, "default", "border_base"),
2294
- focusRing: getColorHex(tones["positive"], dark, "positive", "border_accent"),
2295
- shadow: {
2296
- outline: rgba(tints2[500].hex, 0.4),
2297
- umbra: dark ? rgba(tints2[950].hex, 0.4) : rgba(tints2[500].hex, 0.2),
2298
- penumbra: dark ? rgba(tints2[950].hex, 0.28) : rgba(tints2[500].hex, 0.14),
2299
- ambient: dark ? rgba(tints2[950].hex, 0.24) : rgba(tints2[500].hex, 0.12)
2300
- },
2301
- skeleton: {
2302
- from: skeletonFrom2,
2303
- to: rgba(skeletonFrom2, 0.5)
2304
- }
2305
- };
2306
- }
2307
- if (name === "transparent") {
2308
- const tints2 = tones.default;
2309
- const skeletonFrom2 = tints2[dark ? 800 : 200].hex;
2310
- return {
2311
- fg: tints2[dark ? 100 : 900].hex,
2312
- bg: tints2[dark ? 950 : 50].hex,
2313
- border: tints2[dark ? 800 : 300].hex,
2314
- focusRing: hues.blue[500].hex,
2315
- shadow: {
2316
- outline: rgba(tints2[500].hex, 0.4),
2317
- umbra: dark ? rgba(tints2[900].hex, 0.4) : rgba(tints2[500].hex, 0.2),
2318
- penumbra: dark ? rgba(tints2[900].hex, 0.28) : rgba(tints2[500].hex, 0.14),
2319
- ambient: dark ? rgba(tints2[900].hex, 0.24) : rgba(tints2[500].hex, 0.12)
2320
- },
2321
- skeleton: {
2322
- from: skeletonFrom2,
2323
- to: rgba(skeletonFrom2, 0.5)
2324
- }
2325
- };
2326
- }
2327
- const tints = tones[name] || tones.default;
2328
- const skeletonFrom = tints[dark ? 800 : 200].hex;
2329
- return {
2330
- fg: tints[dark ? 100 : 900].hex,
2331
- bg: getColorHex(tints, dark, name, "bg_base"),
2332
- border: getColorHex(tints, dark, name, "border_base"),
2333
- focusRing: getColorHex(tints, dark, name, "border_accent"),
2334
- shadow: {
2335
- outline: rgba(tints[500].hex, 0.4),
2336
- umbra: dark ? rgba(tints[900].hex, 0.4) : rgba(tints[500].hex, 0.2),
2337
- penumbra: dark ? rgba(tints[900].hex, 0.28) : rgba(tints[500].hex, 0.14),
2338
- ambient: dark ? rgba(tints[900].hex, 0.24) : rgba(tints[500].hex, 0.12)
2339
- },
2340
- skeleton: {
2341
- from: skeletonFrom,
2342
- to: rgba(skeletonFrom, 0.5)
2343
- }
2344
- };
2345
- },
2346
- solid: _ref12 => {
2347
- let {
2348
- base,
2349
- dark,
2350
- name,
2351
- state,
2352
- tone
2353
- } = _ref12;
2354
- const mix = dark ? screen : multiply;
2355
- const mix2 = dark ? multiply : screen;
2356
- const defaultTints = tones[name] || tones.default;
2357
- const isNeutral = NEUTRAL_TONES.includes(name) && NEUTRAL_TONES.includes(tone);
2358
- let tints = tones[tone === "default" ? name : tone] || defaultTints;
2359
- if (state === "disabled") {
2360
- tints = defaultTints;
2361
- const bg2 = getColorHex(tones.default, dark, "default", "bg_tint");
2362
- const skeletonFrom2 = mix2(bg2, tints[dark ? 200 : 800].hex);
2363
- return {
2364
- bg: bg2,
2365
- bg2: mix2(bg2, tints[dark ? 50 : 950].hex),
2366
- border: getColorHex(tones.default, dark, "default", "bg_base"),
2367
- fg: getColorHex(tones.default, dark, "default", "text_inactive"),
2368
- iconColor: getColorHex(tones.default, dark, "default", "border_base"),
2369
- muted: {
2370
- fg: mix(base.bg, tints[dark ? 950 : 50].hex)
2371
- },
2372
- accent: {
2373
- fg: mix(base.bg, tints[dark ? 950 : 50].hex)
2374
- },
2375
- link: {
2376
- fg: mix(base.bg, tints[dark ? 950 : 50].hex)
2377
- },
2378
- code: {
2379
- bg: bg2,
2380
- fg: mix(base.bg, tints[dark ? 950 : 50].hex)
2381
- },
2382
- skeleton: {
2383
- from: skeletonFrom2,
2384
- to: rgba(skeletonFrom2, 0.5)
2385
- }
2386
- };
2387
- }
2388
- if (state === "hovered") {
2389
- const bg2 = getColorHex(tints, dark, tone, "bg_accent_hover");
2390
- const skeletonFrom2 = mix2(bg2, tints[dark ? 200 : 800].hex);
2391
- return {
2392
- bg: bg2,
2393
- bg2: mix2(bg2, tints[dark ? 50 : 950].hex),
2394
- border: bg2,
2395
- fg: getColorHex(tints, dark, "default", "bg_base"),
2396
- iconColor: getColorHex(tints, dark, "default", "icon_inverted"),
2397
- muted: {
2398
- fg: mix(base.bg, tints[dark ? 800 : 200].hex)
2399
- },
2400
- accent: {
2401
- fg: mix2(bg2, hues.red[dark ? 800 : 200].hex)
2402
- },
2403
- link: {
2404
- fg: mix2(bg2, hues.blue[dark ? 800 : 200].hex)
2405
- },
2406
- code: {
2407
- bg: mix(bg2, tints[dark ? 950 : 50].hex),
2408
- fg: mix(base.bg, tints[dark ? 800 : 200].hex)
2409
- },
2410
- skeleton: {
2411
- from: skeletonFrom2,
2412
- to: rgba(skeletonFrom2, 0.5)
2413
- }
2414
- };
2415
- }
2416
- if (state === "pressed") {
2417
- const bg2 = getColorHex(tints, dark, tone, "bg_accent_active");
2418
- const skeletonFrom2 = mix2(bg2, tints[dark ? 200 : 600].hex);
2419
- return {
2420
- bg: bg2,
2421
- bg2: mix2(bg2, tints[dark ? 50 : 950].hex),
2422
- border: bg2,
2423
- fg: getColorHex(tints, dark, "default", "bg_base"),
2424
- iconColor: getColorHex(tints, dark, "default", "icon_inverted"),
2425
- muted: {
2426
- fg: mix(base.bg, tints[dark ? 800 : 200].hex)
2427
- },
2428
- accent: {
2429
- fg: mix2(bg2, hues.red[dark ? 800 : 200].hex)
2430
- },
2431
- link: {
2432
- fg: mix2(bg2, hues.blue[dark ? 800 : 200].hex)
2433
- },
2434
- code: {
2435
- bg: mix(bg2, tints[dark ? 950 : 50].hex),
2436
- fg: mix(base.bg, tints[dark ? 800 : 200].hex)
2437
- },
2438
- skeleton: {
2439
- from: skeletonFrom2,
2440
- to: rgba(skeletonFrom2, 0.5)
2441
- }
2442
- };
2443
- }
2444
- if (state === "selected") {
2445
- if (isNeutral) {
2446
- tints = tones.primary;
2447
- }
2448
- const bg2 = mix(base.bg, tints[dark ? 200 : 800].hex);
2449
- const skeletonFrom2 = mix2(bg2, tints[dark ? 200 : 800].hex);
2450
- return {
2451
- bg: bg2,
2452
- bg2: mix2(bg2, tints[dark ? 50 : 950].hex),
2453
- border: bg2,
2454
- fg: getColorHex(tints, dark, "default", "bg_base"),
2455
- iconColor: getColorHex(tints, dark, "default", "icon_inverted"),
2456
- muted: {
2457
- fg: mix(base.bg, tints[dark ? 800 : 200].hex)
2458
- },
2459
- accent: {
2460
- fg: mix2(bg2, hues.red[dark ? 800 : 200].hex)
2461
- },
2462
- link: {
2463
- fg: mix2(bg2, hues.blue[dark ? 800 : 200].hex)
2464
- },
2465
- code: {
2466
- bg: mix(bg2, tints[dark ? 950 : 50].hex),
2467
- fg: mix(base.bg, tints[dark ? 800 : 200].hex)
2468
- },
2469
- skeleton: {
2470
- from: skeletonFrom2,
2471
- to: rgba(skeletonFrom2, 0.5)
2472
- }
2473
- };
2474
- }
2475
- const bg = getColorHex(tints, dark, tone, "bg_accent");
2476
- const skeletonFrom = mix2(bg, tints[dark ? 200 : 800].hex);
2477
- return {
2478
- bg,
2479
- bg2: mix2(bg, tints[dark ? 50 : 950].hex),
2480
- border: bg,
2481
- fg: getColorHex(tints, dark, "default", "bg_base"),
2482
- iconColor: getColorHex(tints, dark, "default", "icon_inverted"),
2483
- muted: {
2484
- fg: mix(base.bg, tints[dark ? 900 : 100].hex)
2485
- },
2486
- accent: {
2487
- fg: mix2(bg, hues.red[dark ? 900 : 100].hex)
2488
- },
2489
- link: {
2490
- fg: mix2(bg, hues.blue[dark ? 900 : 100].hex)
2491
- },
2492
- code: {
2493
- bg: mix(bg, tints[dark ? 950 : 50].hex),
2494
- fg: mix(base.bg, tints[dark ? 900 : 100].hex)
2495
- },
2496
- skeleton: {
2497
- from: skeletonFrom,
2498
- to: rgba(skeletonFrom, 0.5)
2499
- }
2500
- };
2501
- },
2502
- muted: _ref13 => {
2503
- let {
2504
- base,
2505
- dark,
2506
- name,
2507
- state,
2508
- tone
2509
- } = _ref13;
2510
- const mix = dark ? screen : multiply;
2511
- const defaultTints = tones[name] || tones.default;
2512
- const isNeutral = NEUTRAL_TONES.includes(name) && NEUTRAL_TONES.includes(tone);
2513
- let tints = tones[tone === "default" ? name : tone] || defaultTints;
2514
- if (state === "disabled") {
2515
- tints = defaultTints;
2516
- const bg2 = base.bg;
2517
- const skeletonFrom2 = mix(bg2, tints[dark ? 900 : 100].hex);
2518
- return {
2519
- bg: bg2,
2520
- bg2: mix(bg2, tints[dark ? 950 : 50].hex),
2521
- border: getColorHex(tones.default, dark, "default", "border_base"),
2522
- fg: getColorHex(tones.default, dark, "default", "text_inactive"),
2523
- iconColor: getColorHex(tones.default, dark, "default", "border_base"),
2524
- muted: {
2525
- fg: getColorHex(tones.default, dark, "default", "text_inactive")
2526
- },
2527
- accent: {
2528
- fg: getColorHex(tints, dark, tone, "text_secondary")
2529
- },
2530
- link: {
2531
- fg: getColorHex(tints, dark, tone, "text_secondary")
2532
- },
2533
- code: {
2534
- bg: bg2,
2535
- fg: getColorHex(tints, dark, tone, "text_secondary")
2536
- },
2537
- skeleton: {
2538
- from: rgba(skeletonFrom2, 0.5),
2539
- to: rgba(skeletonFrom2, 0.25)
2540
- }
2541
- };
2542
- }
2543
- if (state === "hovered") {
2544
- const bg2 = getColorHex(tints, dark, name, "bg_base_hover");
2545
- const skeletonFrom2 = mix(bg2, tints[dark ? 900 : 100].hex);
2546
- return {
2547
- bg: bg2,
2548
- bg2: mix(bg2, tints[dark ? 950 : 50].hex),
2549
- border: mix(bg2, tints[dark ? 900 : 100].hex),
2550
- fg: getColorHex(tints, dark, tone, "text_primary"),
2551
- iconColor: getColorHex(tints, dark, name, "icon_default"),
2552
- muted: {
2553
- fg: getColorHex(tints, dark, tone, "text_secondary")
2554
- },
2555
- accent: {
2556
- fg: mix(base.bg, hues.red[dark ? 400 : 500].hex)
2557
- },
2558
- link: {
2559
- fg: mix(base.bg, hues.blue[dark ? 400 : 600].hex)
2560
- },
2561
- code: {
2562
- bg: mix(bg2, tints[dark ? 950 : 50].hex),
2563
- fg: getColorHex(tints, dark, tone, "text_secondary")
2564
- },
2565
- skeleton: {
2566
- from: skeletonFrom2,
2567
- to: rgba(skeletonFrom2, 0.5)
2568
- }
2569
- };
2570
- }
2571
- if (state === "pressed") {
2572
- if (isNeutral) {
2573
- tints = tones.primary;
2574
- }
2575
- const bg2 = getColorHex(tints, dark, name, "bg_base_active");
2576
- const skeletonFrom2 = mix(bg2, getColorHex(tints, dark, name, "bg_base_active"));
2577
- return {
2578
- bg: bg2,
2579
- bg2: mix(bg2, tints[dark ? 950 : 50].hex),
2580
- border: getColorHex(tints, dark, name, "border_base"),
2581
- fg: getColorHex(tints, dark, tone, "text_primary"),
2582
- iconColor: getColorHex(tints, dark, name, "icon_default"),
2583
- muted: {
2584
- fg: getColorHex(tints, dark, tone, "text_secondary")
2585
- },
2586
- accent: {
2587
- fg: mix(bg2, hues.red[dark ? 400 : 500].hex)
2588
- },
2589
- link: {
2590
- fg: mix(bg2, hues.blue[dark ? 400 : 600].hex)
2591
- },
2592
- code: {
2593
- bg: mix(bg2, tints[dark ? 950 : 50].hex),
2594
- fg: getColorHex(tints, dark, tone, "text_secondary")
2595
- },
2596
- skeleton: {
2597
- from: skeletonFrom2,
2598
- to: rgba(skeletonFrom2, 0.5)
2599
- }
2600
- };
2601
- }
2602
- if (state === "selected") {
2603
- if (isNeutral) {
2604
- tints = tones.primary;
2605
- }
2606
- const bg2 = mix(base.bg, tints[dark ? 900 : 100].hex);
2607
- const skeletonFrom2 = mix(bg2, tints[dark ? 900 : 100].hex);
2608
- return {
2609
- bg: bg2,
2610
- bg2: mix(bg2, tints[dark ? 950 : 50].hex),
2611
- border: getColorHex(tints, dark, name, "border_base"),
2612
- fg: getColorHex(tints, dark, tone, "text_primary"),
2613
- iconColor: getColorHex(tints, dark, name, "icon_default"),
2614
- muted: {
2615
- fg: getColorHex(tints, dark, tone, "text_secondary")
2616
- },
2617
- accent: {
2618
- fg: mix(bg2, hues.red[dark ? 400 : 500].hex)
2619
- },
2620
- link: {
2621
- fg: mix(bg2, hues.blue[dark ? 400 : 600].hex)
2622
- },
2623
- code: {
2624
- bg: mix(bg2, tints[dark ? 950 : 50].hex),
2625
- fg: getColorHex(tints, dark, tone, "text_secondary")
2626
- },
2627
- skeleton: {
2628
- from: skeletonFrom2,
2629
- to: rgba(skeletonFrom2, 0.5)
2630
- }
2631
- };
1086
+ "base-text-color": {
1087
+ type: "colorTint",
1088
+ value: white
1089
+ },
1090
+ "base-shadow-outline-color": {
1091
+ type: "colorWithOpacity",
1092
+ tint: "500",
1093
+ opacity: 0.2
1094
+ },
1095
+ "base-shadow-umbra-color": {
1096
+ type: "colorWithOpacity",
1097
+ tint: "500",
1098
+ opacity: 0.1
1099
+ },
1100
+ "base-shadow-penumbra-color": {
1101
+ type: "colorWithOpacity",
1102
+ tint: "500",
1103
+ opacity: 0.07
1104
+ },
1105
+ "base-shadow-ambient-color": {
1106
+ type: "colorWithOpacity",
1107
+ tint: "500",
1108
+ opacity: 0.06
1109
+ },
1110
+ "skeleton-from": "100",
1111
+ "skeleton-to": {
1112
+ type: "colorWithOpacity",
1113
+ tint: "50",
1114
+ opacity: 0.5
2632
1115
  }
2633
- const bg = base.bg;
2634
- const skeletonFrom = mix(bg, tints[dark ? 900 : 100].hex);
2635
- return {
2636
- bg,
2637
- bg2: mix(bg, tints[dark ? 950 : 50].hex),
2638
- border: mix(bg, getColorHex(tints, dark, name, "bg_base")),
2639
- fg: getColorHex(tints, dark, tone, "text_primary"),
2640
- iconColor: getColorHex(tints, dark, name, "icon_default"),
2641
- muted: {
2642
- fg: getColorHex(tints, dark, tone, "text_secondary")
1116
+ },
1117
+ dark: {
1118
+ "text-primary": "50",
1119
+ "text-secondary": "300",
1120
+ "text-inactive": "400",
1121
+ "text-code": "400",
1122
+ "text-muted": "400",
1123
+ "text-link": {
1124
+ type: "colorTint",
1125
+ value: hues.blue["400"]
1126
+ },
1127
+ "text-accent": {
1128
+ type: "colorTint",
1129
+ value: hues.red["400"]
1130
+ },
1131
+ "bg-base": {
1132
+ type: "colorTint",
1133
+ value: black
1134
+ },
1135
+ "bg-base-hover": "900",
1136
+ "bg-base-active": "800",
1137
+ "bg-accent": "500",
1138
+ "bg-accent-hover": "400",
1139
+ "bg-accent-active": "300",
1140
+ "bg-tint": "900",
1141
+ "bg-tint-code": "950",
1142
+ "icon-default": "300",
1143
+ "icon-inverted": {
1144
+ type: "colorTint",
1145
+ value: hues.gray[900]
1146
+ },
1147
+ "border-base": "800",
1148
+ "border-base-hover": "700",
1149
+ "border-accent": "300",
1150
+ "border-accent-inverted": {
1151
+ type: "colorTint",
1152
+ value: hues.gray[900]
1153
+ },
1154
+ "base-bg-card": "950",
1155
+ "base-text-color": {
1156
+ type: "colorTint",
1157
+ value: black
1158
+ },
1159
+ "base-shadow-outline-color": {
1160
+ type: "colorWithOpacity",
1161
+ tint: "500",
1162
+ opacity: 0.4
1163
+ },
1164
+ "base-shadow-umbra-color": {
1165
+ type: "colorWithOpacity",
1166
+ tint: "900",
1167
+ opacity: 0.4
1168
+ },
1169
+ "base-shadow-penumbra-color": {
1170
+ type: "colorWithOpacity",
1171
+ tint: "900",
1172
+ opacity: 0.28
1173
+ },
1174
+ "base-shadow-ambient-color": {
1175
+ type: "colorWithOpacity",
1176
+ tint: "900",
1177
+ opacity: 0.24
1178
+ },
1179
+ "base-bg-raw": {
1180
+ type: "colorTint",
1181
+ value: black
1182
+ },
1183
+ "skeleton-from": "900",
1184
+ "skeleton-to": {
1185
+ type: "colorWithOpacity",
1186
+ tint: "50",
1187
+ opacity: 0.5
1188
+ }
1189
+ }
1190
+ };
1191
+ const colorTints = {
1192
+ light: {
1193
+ default: {
1194
+ ...defaultTints.light,
1195
+ "base-bg-card": {
1196
+ type: "colorTint",
1197
+ value: white
2643
1198
  },
2644
- accent: {
2645
- fg: mix(base.bg, hues.red[dark ? 400 : 500].hex)
1199
+ "bg-accent": "900",
1200
+ "bg-accent-hover": "950",
1201
+ "bg-accent-active": {
1202
+ type: "colorTint",
1203
+ value: black
2646
1204
  },
2647
- link: {
2648
- fg: mix(base.bg, hues.blue[dark ? 400 : 600].hex)
1205
+ "border-accent": "600"
1206
+ },
1207
+ primary: {
1208
+ ...defaultTints.light,
1209
+ "bg-accent": "900",
1210
+ "bg-accent-hover": "950",
1211
+ "bg-accent-active": {
1212
+ type: "colorTint",
1213
+ value: black
2649
1214
  },
2650
- code: {
2651
- bg: mix(base.bg, tints[dark ? 950 : 50].hex),
2652
- fg: getColorHex(tints, dark, tone, "text_secondary")
1215
+ "border-accent": "600"
1216
+ },
1217
+ positive: {
1218
+ ...defaultTints.light,
1219
+ "bg-base-hover": {
1220
+ type: "colorTint",
1221
+ value: hues.gray[50]
2653
1222
  },
2654
- skeleton: {
2655
- from: skeletonFrom,
2656
- to: rgba(skeletonFrom, 0.5)
2657
- }
2658
- };
2659
- },
2660
- button: _ref14 => {
2661
- let {
2662
- base,
2663
- mode,
2664
- muted,
2665
- solid
2666
- } = _ref14;
2667
- if (mode === "bleed") {
2668
- return {
2669
- enabled: {
2670
- ...muted.enabled,
2671
- border: muted.enabled.bg
2672
- },
2673
- hovered: {
2674
- ...muted.hovered,
2675
- border: muted.hovered.bg
2676
- },
2677
- pressed: {
2678
- ...muted.pressed,
2679
- border: muted.pressed.bg
2680
- },
2681
- selected: {
2682
- ...muted.selected,
2683
- border: muted.selected.bg
2684
- },
2685
- disabled: {
2686
- ...muted.disabled,
2687
- border: muted.disabled.bg
2688
- }
2689
- };
2690
- }
2691
- if (mode === "ghost") {
2692
- return {
2693
- ...muted,
2694
- enabled: {
2695
- ...muted.enabled,
2696
- border: base.border
2697
- }
2698
- };
1223
+ "bg-base-active": "50",
1224
+ "bg-accent": "400",
1225
+ "bg-accent-hover": "500",
1226
+ "bg-accent-active": "600",
1227
+ "border-accent": "400"
1228
+ },
1229
+ transparent: defaultTints.light,
1230
+ caution: defaultTints.light,
1231
+ critical: {
1232
+ ...defaultTints.light,
1233
+ "text-inactive": "300"
2699
1234
  }
2700
- return solid;
2701
1235
  },
2702
- card: _ref15 => {
2703
- let {
2704
- base,
2705
- dark,
2706
- muted,
2707
- name,
2708
- solid,
2709
- state
2710
- } = _ref15;
2711
- if (state === "hovered") {
2712
- return muted[name].hovered;
2713
- }
2714
- if (state === "disabled") {
2715
- return muted[name].disabled;
2716
- }
2717
- const isNeutral = NEUTRAL_TONES.includes(name);
2718
- const tints = tones[name] || tones.default;
2719
- const mix = dark ? screen : multiply;
2720
- if (state === "pressed") {
2721
- if (isNeutral) {
2722
- return muted.primary.pressed;
2723
- }
2724
- return muted[name].pressed;
2725
- }
2726
- if (state === "selected") {
2727
- if (isNeutral) {
2728
- return solid.primary.enabled;
2729
- }
2730
- return solid[name].enabled;
2731
- }
2732
- const bg = base.bg;
2733
- const skeletonFrom = mix(base.bg, tints[dark ? 900 : 100].hex);
2734
- return {
2735
- bg,
2736
- bg2: mix(bg, tints[dark ? 950 : 50].hex),
2737
- fg: base.fg,
2738
- iconColor: getColorHex(tints, dark, name, "icon_default"),
2739
- border: base.border,
2740
- muted: {
2741
- fg: mix(base.bg, tints[dark ? 400 : 600].hex)
1236
+ dark: {
1237
+ default: {
1238
+ ...defaultTints.dark,
1239
+ "base-bg-card": {
1240
+ type: "colorTint",
1241
+ value: black
2742
1242
  },
2743
- accent: {
2744
- fg: mix(base.bg, hues.red[dark ? 400 : 500].hex)
1243
+ "text-primary": {
1244
+ type: "colorTint",
1245
+ value: white
2745
1246
  },
2746
- link: {
2747
- fg: mix(base.bg, hues.blue[dark ? 400 : 600].hex)
1247
+ "bg-accent": {
1248
+ type: "colorTint",
1249
+ value: white
2748
1250
  },
2749
- code: {
2750
- bg: mix(base.bg, tints[dark ? 950 : 50].hex),
2751
- fg: tints[dark ? 400 : 600].hex
1251
+ "bg-accent-hover": "50",
1252
+ "bg-accent-active": "100",
1253
+ "base-shadow-umbra-color": {
1254
+ type: "colorWithOpacity",
1255
+ tint: "950",
1256
+ opacity: 0.4
2752
1257
  },
2753
- skeleton: {
2754
- from: skeletonFrom,
2755
- to: rgba(skeletonFrom, 0.5)
2756
- }
2757
- };
2758
- },
2759
- input: _ref16 => {
2760
- let {
2761
- base,
2762
- dark,
2763
- mode,
2764
- state
2765
- } = _ref16;
2766
- const mix = dark ? screen : multiply;
2767
- if (mode === "invalid") {
2768
- const tints = tones.critical;
2769
- return {
2770
- bg: mix(base.bg, tints[dark ? 950 : 50].hex),
2771
- bg2: getColorHex(tints, dark, "critical", "text_secondary"),
2772
- fg: mix(base.bg, tints[dark ? 400 : 600].hex),
2773
- border: getColorHex(tints, dark, "critical", "border_base"),
2774
- placeholder: getColorHex(tones.default, !dark, "default", "text_secondary")
2775
- };
2776
- }
2777
- if (state === "hovered") {
2778
- return {
2779
- bg: base.bg,
2780
- bg2: getColorHex(tones.default, dark, "default", "text_secondary"),
2781
- fg: base.fg,
2782
- border: mix(base.bg, hues.gray[dark ? 700 : 300].hex),
2783
- placeholder: getColorHex(tones.default, !dark, "default", "text_secondary")
2784
- };
2785
- }
2786
- if (state === "disabled") {
2787
- return {
2788
- bg: getColorHex(tones.default, dark, "default", "bg_tint"),
2789
- bg2: getColorHex(tones.default, dark, "default", "border_base"),
2790
- fg: getColorHex(tones.default, dark, "default", "text_secondary"),
2791
- border: getColorHex(tones.default, dark, "default", "border_base"),
2792
- placeholder: getColorHex(tones.default, !dark, "default", "text_secondary")
2793
- };
2794
- }
2795
- if (state === "readOnly") {
2796
- return {
2797
- bg: getColorHex(tones.default, dark, "default", "bg_tint"),
2798
- bg2: getColorHex(tones.default, dark, "default", "border_base"),
2799
- fg: getColorHex(tones.default, dark, "default", "text_secondary"),
2800
- border: getColorHex(tones.default, dark, "default", "border_base"),
2801
- placeholder: getColorHex(tones.default, !dark, "default", "text_secondary")
2802
- };
2803
- }
2804
- return {
2805
- bg: base.bg,
2806
- bg2: getColorHex(tones.default, dark, "default", "text_secondary"),
2807
- fg: base.fg,
2808
- border: base.border,
2809
- placeholder: getColorHex(tones.default, !dark, "default", "text_secondary")
2810
- };
2811
- },
2812
- selectable: _ref17 => {
2813
- let {
2814
- base,
2815
- muted,
2816
- tone,
2817
- solid,
2818
- state
2819
- } = _ref17;
2820
- if (state === "enabled") {
2821
- return {
2822
- ...muted[tone].enabled,
2823
- bg: base.bg
2824
- };
2825
- }
2826
- if (state === "pressed") {
2827
- if (tone === "default") {
2828
- return muted.primary.pressed;
2829
- }
2830
- return muted[tone].pressed;
2831
- }
2832
- if (state === "selected") {
2833
- if (tone === "default") {
2834
- return solid.primary.enabled;
1258
+ "base-shadow-penumbra-color": {
1259
+ type: "colorWithOpacity",
1260
+ tint: "950",
1261
+ opacity: 0.28
1262
+ },
1263
+ "base-shadow-ambient-color": {
1264
+ type: "colorWithOpacity",
1265
+ tint: "950",
1266
+ opacity: 0.24
2835
1267
  }
2836
- return solid[tone].enabled;
2837
- }
2838
- if (state === "disabled") {
2839
- return {
2840
- ...muted[tone].disabled,
2841
- bg: base.bg
2842
- };
1268
+ },
1269
+ primary: {
1270
+ ...defaultTints.dark,
1271
+ "text-primary": {
1272
+ type: "colorTint",
1273
+ value: white
1274
+ },
1275
+ "bg-accent": {
1276
+ type: "colorTint",
1277
+ value: white
1278
+ },
1279
+ "bg-accent-hover": "50",
1280
+ "bg-accent-active": "100"
1281
+ },
1282
+ positive: {
1283
+ ...defaultTints.dark,
1284
+ "bg-base-hover": {
1285
+ type: "colorTint",
1286
+ value: hues.gray[900]
1287
+ },
1288
+ "bg-base-active": "900",
1289
+ "bg-accent": "400",
1290
+ "bg-accent-hover": "300",
1291
+ "bg-accent-active": "200",
1292
+ "border-accent": "400"
1293
+ },
1294
+ transparent: defaultTints.dark,
1295
+ caution: defaultTints.dark,
1296
+ critical: {
1297
+ ...defaultTints.dark,
1298
+ "text-inactive": "700"
2843
1299
  }
2844
- return muted[tone][state];
2845
- },
2846
- spot: _ref18 => {
2847
- let {
2848
- base,
2849
- dark,
2850
- key
2851
- } = _ref18;
2852
- const mix = dark ? screen : multiply;
2853
- return mix(base.bg, hues[key][dark ? 400 : 500].hex);
2854
- },
2855
- syntax: _ref19 => {
2856
- let {
2857
- base,
2858
- dark
2859
- } = _ref19;
2860
- const mix = dark ? screen : multiply;
2861
- const mainShade = dark ? 400 : 600;
2862
- const secondaryShade = dark ? 600 : 400;
1300
+ }
1301
+ };
1302
+ const getColorValue = (tints, scheme, tone, key) => {
1303
+ const value = colorTints[scheme][tone][key];
1304
+ if (typeof value === "string") {
1305
+ return tints[value];
1306
+ }
1307
+ if (value.type === "colorWithOpacity") {
1308
+ const base = tints[value.tint];
2863
1309
  return {
2864
- atrule: mix(base.bg, hues.purple[mainShade].hex),
2865
- attrName: mix(base.bg, hues.green[mainShade].hex),
2866
- attrValue: mix(base.bg, hues.yellow[mainShade].hex),
2867
- attribute: mix(base.bg, hues.yellow[mainShade].hex),
2868
- boolean: mix(base.bg, hues.purple[mainShade].hex),
2869
- builtin: mix(base.bg, hues.purple[mainShade].hex),
2870
- cdata: mix(base.bg, hues.yellow[mainShade].hex),
2871
- char: mix(base.bg, hues.yellow[mainShade].hex),
2872
- class: mix(base.bg, hues.orange[mainShade].hex),
2873
- className: mix(base.bg, hues.cyan[mainShade].hex),
2874
- comment: mix(base.bg, hues.gray[secondaryShade].hex),
2875
- constant: mix(base.bg, hues.purple[mainShade].hex),
2876
- deleted: mix(base.bg, hues.red[mainShade].hex),
2877
- doctype: mix(base.bg, hues.gray[secondaryShade].hex),
2878
- entity: mix(base.bg, hues.red[mainShade].hex),
2879
- function: mix(base.bg, hues.green[mainShade].hex),
2880
- hexcode: mix(base.bg, hues.blue[mainShade].hex),
2881
- id: mix(base.bg, hues.purple[mainShade].hex),
2882
- important: mix(base.bg, hues.purple[mainShade].hex),
2883
- inserted: mix(base.bg, hues.yellow[mainShade].hex),
2884
- keyword: mix(base.bg, hues.magenta[mainShade].hex),
2885
- number: mix(base.bg, hues.purple[mainShade].hex),
2886
- operator: mix(base.bg, hues.magenta[mainShade].hex),
2887
- prolog: mix(base.bg, hues.gray[secondaryShade].hex),
2888
- property: mix(base.bg, hues.blue[mainShade].hex),
2889
- pseudoClass: mix(base.bg, hues.yellow[mainShade].hex),
2890
- pseudoElement: mix(base.bg, hues.yellow[mainShade].hex),
2891
- punctuation: mix(base.bg, hues.gray[mainShade].hex),
2892
- regex: mix(base.bg, hues.blue[mainShade].hex),
2893
- selector: mix(base.bg, hues.red[mainShade].hex),
2894
- string: mix(base.bg, hues.yellow[mainShade].hex),
2895
- symbol: mix(base.bg, hues.purple[mainShade].hex),
2896
- tag: mix(base.bg, hues.red[mainShade].hex),
2897
- unit: mix(base.bg, hues.orange[mainShade].hex),
2898
- url: mix(base.bg, hues.red[mainShade].hex),
2899
- variable: mix(base.bg, hues.red[mainShade].hex)
1310
+ hex: rgba(base.hex, value.opacity),
1311
+ title: "".concat(base.title, " ").concat(Math.round(value.opacity * 100), "%")
2900
1312
  };
2901
1313
  }
2902
- });
1314
+ return value.value;
1315
+ };
1316
+ const getColorHex = (tints, scheme, tone, key) => {
1317
+ return getColorValue(tints, scheme, tone, key).hex;
1318
+ };
1319
+ const getToneCssVar = (tone, key) => "--".concat(tone, "-").concat(key);
1320
+ const createTonesVariables = function (scheme, tones) {
1321
+ let defaultTone = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "default";
1322
+ let baseBg = arguments.length > 3 ? arguments[3] : undefined;
1323
+ const tonesVariables = {};
1324
+ const keys = Object.keys(tones);
1325
+ const mix = scheme === "dark" ? screen : multiply;
1326
+ const needsMixing = defaultTone !== "default";
1327
+ keys.forEach(_tone => {
1328
+ const tone = _tone == "default" ? defaultTone : _tone;
1329
+ const tint = tones[tone];
1330
+ colorKeys.forEach(key => {
1331
+ const colorHex = getColorHex(tint, scheme, tone, key);
1332
+ const varName = getToneCssVar(_tone, key);
1333
+ const willBeMixed = needsMixing && !key.startsWith("base-");
1334
+ tonesVariables[varName] = willBeMixed ? mix(baseBg, colorHex) : colorHex;
1335
+ });
1336
+ });
1337
+ if (defaultTone !== "default") {
1338
+ tonesVariables[getToneCssVar("default", "bg-base")] = tonesCssVariables.default["base-bg-card"];
1339
+ }
1340
+ return tonesVariables;
1341
+ };
1342
+ const themeNames = ["default", "transparent", "primary", "positive", "caution", "critical"];
1343
+ const tonesCssVariables = themeNames.reduce((acc, tone) => {
1344
+ acc[tone] = colorKeys.reduce((acc2, key) => {
1345
+ acc2[key] = "var(".concat(getToneCssVar(tone, key), ")");
1346
+ return acc2;
1347
+ }, {});
1348
+ return acc;
1349
+ }, {});
1350
+ const mutableCardVariables = {
1351
+ "bg-color": "--card-bg-color",
1352
+ "muted-fg-color": "--card-muted-fg-color",
1353
+ "icon-color": "--card-icon-color",
1354
+ "fg-color": "--card-fg-color",
1355
+ "bg-image": "--card-bg-image",
1356
+ "accent-color": "--card-accent-fg-color"
1357
+ };
1358
+ const mutableVariables = Object.keys(mutableCardVariables).reduce((acc, key) => {
1359
+ const item = key;
1360
+ acc[item] = "var(".concat(mutableCardVariables[item], ")");
1361
+ return acc;
1362
+ }, {});
1363
+ const cardVariables = {
1364
+ "--card-shadow-outline-color": tonesCssVariables.default["base-shadow-outline-color"],
1365
+ "--card-shadow-umbra-color": tonesCssVariables.default["base-shadow-umbra-color"],
1366
+ "--card-shadow-penumbra-color": tonesCssVariables.default["base-shadow-penumbra-color"],
1367
+ "--card-shadow-ambient-color": tonesCssVariables.default["base-shadow-ambient-color"],
1368
+ "--card-focus-ring-color": tonesCssVariables.positive["bg-accent"],
1369
+ "--card-icon-color": tonesCssVariables.default["icon-default"],
1370
+ "--card-bg-image": "inherit",
1371
+ // Card
1372
+ "--card-bg-color": tonesCssVariables.default["bg-base"],
1373
+ "--card-fg-color": tonesCssVariables.default["text-primary"],
1374
+ "--card-muted-fg-color": tonesCssVariables.default["text-secondary"],
1375
+ "--card-accent-fg-color": tonesCssVariables.default["text-accent"],
1376
+ "--card-link-fg-color": tonesCssVariables.default["text-link"],
1377
+ "--card-code-bg-color": tonesCssVariables.default["bg-tint-code"],
1378
+ "--card-code-fg-color": tonesCssVariables.default["text-code"],
1379
+ "--card-skeleton-color-from": tonesCssVariables.default["skeleton-from"],
1380
+ "--card-skeleton-color-to": tonesCssVariables.default["skeleton-to"],
1381
+ // @todo: deprecate
1382
+ "--card-link-color": tonesCssVariables.default["text-link"],
1383
+ "--card-hairline-soft-color": tonesCssVariables.default["border-base"],
1384
+ "--card-hairline-hard-color": tonesCssVariables.default["border-base"],
1385
+ // Card
1386
+ "--card-bg2-color": tonesCssVariables.default["bg-tint"]
1387
+ };
1388
+ const createCssVars = function (scheme, tones) {
1389
+ let defaultTone = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "default";
1390
+ const baseBg = getColorHex(tones[defaultTone], scheme, defaultTone, "base-bg-card");
1391
+ const tonesVars = createTonesVariables(scheme, tones, defaultTone, baseBg);
1392
+ return {
1393
+ ...tonesVars,
1394
+ ...cardVariables
1395
+ };
1396
+ };
1397
+ const cssVars = {
1398
+ ...tonesCssVariables,
1399
+ /**
1400
+ * This variables are mutable, they can be updated by other components.
1401
+ * The main component that updates them is the card, these are the only ones that should be exposed for use from the cards.
1402
+ */
1403
+ mutable: mutableVariables
1404
+ };
1405
+ const tones = {
1406
+ default: hues.gray,
1407
+ transparent: hues.gray,
1408
+ primary: hues.gray,
1409
+ positive: hues.cyan,
1410
+ caution: hues.yellow,
1411
+ critical: hues.red
1412
+ };
2903
1413
  const fonts = {
2904
1414
  code: {
2905
1415
  family: "ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace",
@@ -3119,7 +1629,14 @@ const studioTheme = {
3119
1629
  width: 1
3120
1630
  }
3121
1631
  },
3122
- color,
1632
+ color: {
1633
+ tones,
1634
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1635
+ // @ts-ignore This is necessary until workshop is updated.
1636
+ base: {
1637
+ bg: "#fffff"
1638
+ }
1639
+ },
3123
1640
  container: [320, 640, 960, 1280, 1600, 1920],
3124
1641
  focusRing: {
3125
1642
  offset: 1,
@@ -3133,9 +1650,9 @@ const studioTheme = {
3133
1650
  penumbra: [0, 0, 0, 0],
3134
1651
  ambient: [0, 0, 0, 0]
3135
1652
  }, {
3136
- umbra: [0, 3, 5, -1],
1653
+ umbra: [0, 3, 5, -2],
3137
1654
  penumbra: [0, 6, 10, 0],
3138
- ambient: [0, 1, 18, 0]
1655
+ ambient: [0, 1, 18, 1]
3139
1656
  }, {
3140
1657
  umbra: [0, 7, 8, -4],
3141
1658
  penumbra: [0, 12, 17, 2],
@@ -3218,6 +1735,11 @@ const DEFAULT_THEME_LAYER = {
3218
1735
  zOffset: 200
3219
1736
  }
3220
1737
  };
1738
+ function cssObjectToCssString(rules) {
1739
+ return Object.keys(rules).reduce((acc, key) => {
1740
+ return "".concat(acc).concat(key, ": ").concat(rules[key], "; ");
1741
+ }, "");
1742
+ }
3221
1743
  function getGlobalScope() {
3222
1744
  if (typeof globalThis !== "undefined") return globalThis;
3223
1745
  if (typeof window !== "undefined") return window;
@@ -3226,9 +1748,41 @@ function getGlobalScope() {
3226
1748
  throw new Error("@sanity/ui: could not locate global scope");
3227
1749
  }
3228
1750
  const globalScope = getGlobalScope();
3229
- const key$8 = Symbol.for("@sanity/ui/context/theme");
1751
+ const key$9 = Symbol.for("@sanity/ui/context/theme");
1752
+ globalScope[key$9] = globalScope[key$9] || createContext(null);
1753
+ const ThemeContext = globalScope[key$9];
1754
+ const key$8 = Symbol.for("@sanity/ui/context/toneContext");
3230
1755
  globalScope[key$8] = globalScope[key$8] || createContext(null);
3231
- const ThemeContext = globalScope[key$8];
1756
+ const ToneContext = globalScope[key$8];
1757
+ function ToneProvider(props) {
1758
+ const {
1759
+ children,
1760
+ scheme,
1761
+ tone
1762
+ } = props;
1763
+ const root = useRootTheme();
1764
+ const value = useMemo(() => ({
1765
+ version: 0,
1766
+ scheme: scheme || root.scheme,
1767
+ tone
1768
+ }), [root.scheme, scheme, tone]);
1769
+ return /* @__PURE__ */jsx(ToneContext.Provider, {
1770
+ value,
1771
+ children
1772
+ });
1773
+ }
1774
+ var __freeze$E = Object.freeze;
1775
+ var __defProp$F = Object.defineProperty;
1776
+ var __template$E = (cooked, raw) => __freeze$E(__defProp$F(cooked, "raw", {
1777
+ value: __freeze$E(raw || cooked.slice())
1778
+ }));
1779
+ var _a$E;
1780
+ const GlobalVariables = createGlobalStyle(_a$E || (_a$E = __template$E(["\n :root {\n ", "\n }\n"])), _ref4 => {
1781
+ let {
1782
+ $vars
1783
+ } = _ref4;
1784
+ return $vars;
1785
+ });
3232
1786
  function ThemeProvider(props) {
3233
1787
  const parentTheme = useContext(ThemeContext);
3234
1788
  const {
@@ -3240,38 +1794,44 @@ function ThemeProvider(props) {
3240
1794
  const theme = useMemo(() => {
3241
1795
  if (!themeProp) return null;
3242
1796
  const {
3243
- color: rootColor,
3244
1797
  layer: rootLayer,
3245
1798
  ...restTheme
3246
1799
  } = themeProp;
3247
- const colorScheme = rootColor[scheme] || rootColor.light;
3248
- const color = colorScheme[tone] || colorScheme.default;
3249
1800
  const layer = rootLayer || DEFAULT_THEME_LAYER;
3250
1801
  return {
3251
1802
  sanity: {
3252
1803
  ...restTheme,
3253
- color,
3254
1804
  layer
3255
1805
  }
3256
1806
  };
3257
- }, [scheme, themeProp, tone]);
1807
+ }, [themeProp]);
3258
1808
  const value = useMemo(() => themeProp && {
3259
1809
  version: 0,
3260
1810
  theme: themeProp,
3261
1811
  scheme,
3262
1812
  tone
3263
1813
  }, [themeProp, scheme, tone]);
1814
+ const cssVariables = useMemo(() => {
1815
+ if (!(themeProp == null ? void 0 : themeProp.color.tones)) return;
1816
+ return cssObjectToCssString(createCssVars(scheme, themeProp == null ? void 0 : themeProp.color.tones));
1817
+ }, [scheme, themeProp == null ? void 0 : themeProp.color.tones]);
3264
1818
  if (!theme) {
3265
1819
  return /* @__PURE__ */jsx("pre", {
3266
1820
  children: 'ThemeProvider: no "theme" property provided'
3267
1821
  });
3268
1822
  }
3269
- return /* @__PURE__ */jsx(ThemeContext.Provider, {
1823
+ return /* @__PURE__ */jsxs(ThemeContext.Provider, {
3270
1824
  value,
3271
- children: /* @__PURE__ */jsx(ThemeProvider$1, {
1825
+ children: [/* @__PURE__ */jsx(GlobalVariables, {
1826
+ $vars: cssVariables
1827
+ }), /* @__PURE__ */jsx(ThemeProvider$1, {
3272
1828
  theme,
3273
- children
3274
- })
1829
+ children: /* @__PURE__ */jsx(ToneProvider, {
1830
+ tone,
1831
+ scheme,
1832
+ children
1833
+ })
1834
+ })]
3275
1835
  });
3276
1836
  }
3277
1837
  function isRecord(value) {
@@ -3438,7 +1998,17 @@ function useCustomValidity(ref, customValidity) {
3438
1998
  }
3439
1999
  }, [customValidity, ref]);
3440
2000
  }
3441
- const BORDER_VALUE = "1px solid var(--card-border-color)";
2001
+ function useToneContext() {
2002
+ const value = useContext(ToneContext);
2003
+ if (!value) {
2004
+ throw new Error("useToneContext(): missing context value");
2005
+ }
2006
+ if (!isRecord(value) || value.version !== 0) {
2007
+ throw new Error("useToneContext(): the context value is not compatible");
2008
+ }
2009
+ return value;
2010
+ }
2011
+ const BORDER_VALUE = "1px solid ".concat(cssVars.default["border-base"]);
3442
2012
  function responsiveBorderStyle() {
3443
2013
  return [border, borderTop, borderRight, borderBottom, borderLeft];
3444
2014
  }
@@ -3694,8 +2264,8 @@ function focusRingStyle(opts) {
3694
2264
  } = opts;
3695
2265
  const focusRingOutsetWidth = focusRing.offset + focusRing.width;
3696
2266
  const focusRingInsetWidth = 0 - focusRing.offset;
3697
- const bgColor = base ? base.bg : "var(--card-bg-color)";
3698
- 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(",");
2267
+ const bgColor = base ? base.bg : cssVars.mutable["bg-color"];
2268
+ 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(",");
3699
2269
  }
3700
2270
  const GRID_CSS = {
3701
2271
  "&&:not([hidden])": {
@@ -3960,13 +2530,11 @@ function textInputRootStyle() {
3960
2530
  function textInputBaseStyle(props) {
3961
2531
  const {
3962
2532
  theme,
3963
- $scheme,
3964
2533
  $tone,
3965
2534
  $weight
3966
2535
  } = props;
3967
2536
  const font = theme.sanity.fonts.text;
3968
- const color = theme.sanity.color.input;
3969
- return 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);
2537
+ return 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"]);
3970
2538
  }
3971
2539
  function textInputFontSizeStyle(props) {
3972
2540
  const {
@@ -3988,7 +2556,6 @@ function textInputRepresentationStyle(props) {
3988
2556
  const {
3989
2557
  $hasPrefix,
3990
2558
  $hasSuffix,
3991
- $scheme,
3992
2559
  $tone,
3993
2560
  theme
3994
2561
  } = props;
@@ -3998,26 +2565,22 @@ function textInputRepresentationStyle(props) {
3998
2565
  const {
3999
2566
  focusRing
4000
2567
  } = input.text;
4001
- const color = theme.sanity.color.input;
4002
- return 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({
4003
- color: color.default.enabled.border,
2568
+ return 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({
2569
+ color: cssVars[$tone]["border-base"],
4004
2570
  width: input.border.width
4005
- }), color.invalid.enabled.bg, color.invalid.enabled.fg, focusRingBorderStyle({
4006
- color: color.invalid.enabled.border,
2571
+ }), mutableCardVariables["bg-color"], cssVars.critical["bg-tint"], mutableCardVariables["fg-color"], cssVars.critical["text-primary"], focusRingBorderStyle({
2572
+ color: cssVars.critical["border-base"],
4007
2573
  width: input.border.width
4008
2574
  }), focusRingStyle({
4009
2575
  border: {
4010
- color: color.default.enabled.border,
2576
+ color: cssVars[$tone]["border-base"],
4011
2577
  width: input.border.width
4012
2578
  },
4013
2579
  focusRing
4014
2580
  }), focusRingStyle({
4015
2581
  focusRing
4016
- }), color.default.disabled.bg, color.default.disabled.fg, focusRingBorderStyle({
4017
- color: color.default.disabled.border,
4018
- width: input.border.width
4019
- }), color.default.readOnly.bg, color.default.readOnly.fg, color.default.hovered.bg, color.default.hovered.fg, focusRingBorderStyle({
4020
- color: color.default.hovered.border,
2582
+ }), 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({
2583
+ color: cssVars.default["border-base-hover"],
4021
2584
  width: input.border.width
4022
2585
  }));
4023
2586
  }
@@ -4059,10 +2622,10 @@ function toBoxShadow(shadow, color) {
4059
2622
  }
4060
2623
  function shadowStyle(shadow) {
4061
2624
  if (!shadow) return EMPTY_RECORD;
4062
- const outline = "0 0 0 ".concat(rem(1), " var(--card-shadow-outline-color)");
4063
- const umbra = toBoxShadow(shadow.umbra, "var(--card-shadow-umbra-color)");
4064
- const penumbra = toBoxShadow(shadow.penumbra, "var(--card-shadow-penumbra-color)");
4065
- const ambient = toBoxShadow(shadow.ambient, "var(--card-shadow-ambient-color)");
2625
+ const outline = "0 0 0 ".concat(rem(1), " ").concat(cssVars.default["base-shadow-outline-color"]);
2626
+ const umbra = toBoxShadow(shadow.umbra, cssVars.default["base-shadow-umbra-color"]);
2627
+ const penumbra = toBoxShadow(shadow.penumbra, cssVars.default["base-shadow-penumbra-color"]);
2628
+ const ambient = toBoxShadow(shadow.ambient, cssVars.default["base-shadow-ambient-color"]);
4066
2629
  return {
4067
2630
  boxShadow: "".concat(outline, ", ").concat(umbra, ", ").concat(penumbra, ", ").concat(ambient)
4068
2631
  };
@@ -4092,7 +2655,7 @@ function textBaseStyle(props) {
4092
2655
  const {
4093
2656
  weights
4094
2657
  } = theme.sanity.fonts.text;
4095
- return 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 && css(_a$C || (_a$C = __template$C(["\n color: var(--card-accent-fg-color);\n "]))), $muted && css(_b$l || (_b$l = __template$C(["\n color: var(--card-muted-fg-color);\n "]))), theme.sanity.fonts.code.family, weights.bold);
2658
+ return 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 && css(_a$C || (_a$C = __template$C(["\n color: ", ";\n "])), cssVars.default["text-accent"]), $muted && 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"]);
4096
2659
  }
4097
2660
  var __freeze$B = Object.freeze;
4098
2661
  var __defProp$C = Object.defineProperty;
@@ -4133,6 +2696,44 @@ const Text = forwardRef(function Text2(props, ref) {
4133
2696
  })
4134
2697
  });
4135
2698
  });
2699
+ const spotColor = {
2700
+ gray: {
2701
+ dark: gray["400"],
2702
+ light: gray["500"]
2703
+ },
2704
+ blue: {
2705
+ dark: blue["400"],
2706
+ light: blue["500"]
2707
+ },
2708
+ purple: {
2709
+ dark: purple["400"],
2710
+ light: purple["500"]
2711
+ },
2712
+ magenta: {
2713
+ dark: magenta["400"],
2714
+ light: magenta["500"]
2715
+ },
2716
+ red: {
2717
+ dark: red["400"],
2718
+ light: red["500"]
2719
+ },
2720
+ orange: {
2721
+ dark: orange["400"],
2722
+ light: orange["500"]
2723
+ },
2724
+ yellow: {
2725
+ dark: yellow["400"],
2726
+ light: yellow["500"]
2727
+ },
2728
+ green: {
2729
+ dark: green["400"],
2730
+ light: green["500"]
2731
+ },
2732
+ cyan: {
2733
+ dark: cyan["400"],
2734
+ light: cyan["500"]
2735
+ }
2736
+ };
4136
2737
  const avatarStyle = {
4137
2738
  root: avatarRootStyle,
4138
2739
  arrow: avatarArrowStyle,
@@ -4191,7 +2792,7 @@ function avatarRootStyle(props) {
4191
2792
  position: "relative",
4192
2793
  boxSizing: "border-box",
4193
2794
  userSelect: "none",
4194
- boxShadow: "0 0 0 1px var(--card-bg-color)",
2795
+ boxShadow: "0 0 0 1px ".concat(cssVars.mutable["bg-color"]),
4195
2796
  '&[data-status="inactive"]': {
4196
2797
  opacity: 0.5
4197
2798
  },
@@ -4245,17 +2846,11 @@ function responsiveAvatarSizeStyle(props) {
4245
2846
  };
4246
2847
  });
4247
2848
  }
4248
- function avatarInitialsStyle(props) {
4249
- const {
4250
- theme
4251
- } = props;
4252
- const {
4253
- base
4254
- } = theme.sanity.color;
2849
+ function avatarInitialsStyle() {
4255
2850
  return {
4256
2851
  width: "100%",
4257
2852
  height: "100%",
4258
- color: base.fg,
2853
+ color: cssVars.default["text-primary"],
4259
2854
  alignItems: "center",
4260
2855
  justifyContent: "center",
4261
2856
  textTransform: "uppercase",
@@ -4269,7 +2864,7 @@ function avatarInitialsStyle(props) {
4269
2864
  function avatarBgStrokeStyle() {
4270
2865
  return {
4271
2866
  strokeWidth: "4px",
4272
- stroke: "var(--card-bg-color)"
2867
+ stroke: cssVars.mutable["bg-color"]
4273
2868
  };
4274
2869
  }
4275
2870
  function avatarStrokeStyle() {
@@ -4303,7 +2898,10 @@ const Avatar = forwardRef(function Avatar2(props, ref) {
4303
2898
  const as = ReactIs.isValidElementType(asProp) ? asProp : "div";
4304
2899
  const size = useArrayProp(sizeProp);
4305
2900
  const theme = useTheme();
4306
- const color = theme.sanity.color.spot[colorKey] || theme.sanity.color.spot.gray;
2901
+ const {
2902
+ scheme
2903
+ } = useToneContext();
2904
+ const color = spotColor[colorKey][scheme].hex;
4307
2905
  const avatarSize = theme.sanity.avatar.sizes[size[0]] || theme.sanity.avatar.sizes[0];
4308
2906
  const _sizeRem = avatarSize.size;
4309
2907
  const _radius = _sizeRem / 2;
@@ -4425,7 +3023,7 @@ function _avatarCounterBaseStyle(props) {
4425
3023
  const {
4426
3024
  theme
4427
3025
  } = props;
4428
- return 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]));
3026
+ return 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]));
4429
3027
  }
4430
3028
  const Root$C = styled.div(_responsiveAvatarCounterSizeStyle, _avatarCounterBaseStyle);
4431
3029
  const AvatarCounter = forwardRef(function AvatarCounter2(props, ref) {
@@ -4581,83 +3179,22 @@ const Box = forwardRef(function Box2(props, ref) {
4581
3179
  children: props.children
4582
3180
  });
4583
3181
  });
4584
- var __freeze$y = Object.freeze;
4585
- var __defProp$z = Object.defineProperty;
4586
- var __template$y = (cooked, raw) => __freeze$y(__defProp$z(cooked, "raw", {
4587
- value: __freeze$y(raw || cooked.slice())
4588
- }));
4589
- var _a$y, _b$k, _c$b;
4590
- function labelBaseStyle(props) {
4591
- const {
4592
- $accent,
4593
- $muted,
4594
- theme
4595
- } = props;
4596
- const {
4597
- fonts
4598
- } = theme.sanity;
4599
- return 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 && css(_a$y || (_a$y = __template$y(["\n color: var(--card-accent-fg-color);\n "]))), $muted && css(_b$k || (_b$k = __template$y(["\n color: var(--card-muted-fg-color);\n "]))), fonts.code.family);
4600
- }
4601
- var __freeze$x = Object.freeze;
4602
- var __defProp$y = Object.defineProperty;
4603
- var __template$x = (cooked, raw) => __freeze$x(__defProp$y(cooked, "raw", {
4604
- value: __freeze$x(raw || cooked.slice())
4605
- }));
4606
- var _a$x;
4607
- const Root$z = styled.div(responsiveLabelFont, responsiveTextAlignStyle, labelBaseStyle);
4608
- const SpanWithTextOverflow$1 = styled.span(_a$x || (_a$x = __template$x(["\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n overflow: clip;\n"])));
4609
- const Label = forwardRef(function Label2(props, ref) {
4610
- const {
4611
- accent,
4612
- align,
4613
- children: childrenProp,
4614
- muted = false,
4615
- size = 2,
4616
- textOverflow,
4617
- weight,
4618
- ...restProps
4619
- } = props;
4620
- let children = childrenProp;
4621
- if (textOverflow === "ellipsis") {
4622
- children = /* @__PURE__ */jsx(SpanWithTextOverflow$1, {
4623
- children
4624
- });
4625
- } else {
4626
- children = /* @__PURE__ */jsx("span", {
4627
- children
4628
- });
4629
- }
4630
- return /* @__PURE__ */jsx(Root$z, {
4631
- "data-ui": "Label",
4632
- ...restProps,
4633
- $accent: accent,
4634
- $align: useArrayProp(align),
4635
- $muted: muted,
4636
- $size: useArrayProp(size),
4637
- $weight: weight,
4638
- ref,
4639
- children
4640
- });
4641
- });
4642
3182
  function badgeStyle(props) {
4643
3183
  const {
4644
3184
  $mode,
4645
- $tone,
4646
- theme
3185
+ $tone
4647
3186
  } = props;
4648
- const palette = theme.sanity.color[$mode === "outline" ? "muted" : "solid"];
4649
- const color = palette[$tone] || palette.default;
4650
3187
  return {
4651
- backgroundColor: color.enabled.bg,
4652
- color: color.enabled.fg,
4653
- boxShadow: "inset 0 0 0 1px ".concat(color.enabled.border),
3188
+ backgroundColor: $mode === "outline" ? cssVars[$tone]["bg-base"] : cssVars[$tone]["bg-tint"],
3189
+ [mutableCardVariables["fg-color"]]: cssVars[$tone]["text-secondary"],
3190
+ boxShadow: $mode === "outline" ? "inset 0 0 0 1px ".concat(cssVars[$tone]["border-base"]) : void 0,
4654
3191
  cursor: "default",
4655
3192
  "&:not([hidden])": {
4656
3193
  display: "inline-block"
4657
3194
  }
4658
3195
  };
4659
3196
  }
4660
- const Root$y = styled(Box)(responsiveRadiusStyle, badgeStyle);
3197
+ const Root$z = styled(Box)(responsiveRadiusStyle, badgeStyle);
4661
3198
  const Badge = forwardRef(function Badge2(props, ref) {
4662
3199
  const {
4663
3200
  children,
@@ -4668,7 +3205,7 @@ const Badge = forwardRef(function Badge2(props, ref) {
4668
3205
  tone = "default",
4669
3206
  ...restProps
4670
3207
  } = props;
4671
- return /* @__PURE__ */jsx(Root$y, {
3208
+ return /* @__PURE__ */jsx(Root$z, {
4672
3209
  "data-ui": "Badge",
4673
3210
  ...restProps,
4674
3211
  $mode: mode,
@@ -4676,13 +3213,14 @@ const Badge = forwardRef(function Badge2(props, ref) {
4676
3213
  $radius: useArrayProp(radius),
4677
3214
  padding: useArrayProp(padding),
4678
3215
  ref,
4679
- children: /* @__PURE__ */jsx(Label, {
3216
+ children: /* @__PURE__ */jsx(Text, {
4680
3217
  size: fontSize,
3218
+ weight: "medium",
4681
3219
  children
4682
3220
  })
4683
3221
  });
4684
3222
  });
4685
- const Root$x = styled(Box)(flexItemStyle, responsiveFlexStyle);
3223
+ const Root$y = styled(Box)(flexItemStyle, responsiveFlexStyle);
4686
3224
  const Flex = forwardRef(function Flex2(props, ref) {
4687
3225
  const {
4688
3226
  align,
@@ -4696,7 +3234,7 @@ const Flex = forwardRef(function Flex2(props, ref) {
4696
3234
  return (
4697
3235
  // @ts-expect-error -- some dollar prefixed typings aren't inferred correctly https://github.com/styled-components/styled-components/issues/4062
4698
3236
  /* @__PURE__ */
4699
- jsx(Root$x, {
3237
+ jsx(Root$y, {
4700
3238
  "data-ui": "Flex",
4701
3239
  ...restProps,
4702
3240
  $align: useArrayProp(align),
@@ -4709,61 +3247,30 @@ const Flex = forwardRef(function Flex2(props, ref) {
4709
3247
  })
4710
3248
  );
4711
3249
  });
4712
- var __freeze$w = Object.freeze;
4713
- var __defProp$x = Object.defineProperty;
4714
- var __template$w = (cooked, raw) => __freeze$w(__defProp$x(cooked, "raw", {
4715
- value: __freeze$w(raw || cooked.slice())
3250
+ var __freeze$y = Object.freeze;
3251
+ var __defProp$z = Object.defineProperty;
3252
+ var __template$y = (cooked, raw) => __freeze$y(__defProp$z(cooked, "raw", {
3253
+ value: __freeze$y(raw || cooked.slice())
4716
3254
  }));
4717
- var _a$w, _b$j;
4718
- const rotate$1 = keyframes(_a$w || (_a$w = __template$w(["\n from {\n transform: rotate(0deg);\n }\n\n to {\n transform: rotate(360deg);\n }\n"])));
4719
- const Root$w = styled(Text)(_b$j || (_b$j = __template$w(["\n & > span > svg {\n animation: ", " 500ms linear infinite;\n }\n"])), rotate$1);
3255
+ var _a$y, _b$k;
3256
+ const rotate$1 = keyframes(_a$y || (_a$y = __template$y(["\n from {\n transform: rotate(0deg);\n }\n\n to {\n transform: rotate(360deg);\n }\n"])));
3257
+ const Root$x = styled(Text)(_b$k || (_b$k = __template$y(["\n & > span > svg {\n animation: ", " 500ms linear infinite;\n }\n"])), rotate$1);
4720
3258
  const Spinner = forwardRef(function Spinner2(props, ref) {
4721
- return /* @__PURE__ */jsx(Root$w, {
3259
+ return /* @__PURE__ */jsx(Root$x, {
4722
3260
  "data-ui": "Spinner",
4723
3261
  ...props,
4724
3262
  ref,
4725
3263
  children: /* @__PURE__ */jsx(SpinnerIcon, {})
4726
3264
  });
4727
3265
  });
4728
- function _colorVarsStyle(base, color) {
4729
- let checkered = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
4730
- var _a, _b, _c, _d, _e, _f, _g, _h;
4731
- return {
4732
- // Base
4733
- // @todo: rename to "--base-"?
4734
- "--card-shadow-outline-color": base.shadow.outline,
4735
- "--card-shadow-umbra-color": base.shadow.umbra,
4736
- "--card-shadow-penumbra-color": base.shadow.penumbra,
4737
- "--card-shadow-ambient-color": base.shadow.ambient,
4738
- "--card-focus-ring-color": base.focusRing,
4739
- "--card-icon-color": color.iconColor,
4740
- // Card
4741
- "--card-bg-color": color.bg,
4742
- "--card-bg2-color": color.bg2,
4743
- "--card-bg-image": checkered ? "repeating-conic-gradient(".concat(color.bg, " 0% 25%, ").concat(color.bg2 || color.bg, " 0% 50%)") : void 0,
4744
- "--card-fg-color": color.fg,
4745
- "--card-border-color": color.border,
4746
- "--card-muted-fg-color": (_a = color.muted) == null ? void 0 : _a.fg,
4747
- "--card-accent-fg-color": (_b = color.accent) == null ? void 0 : _b.fg,
4748
- "--card-link-fg-color": (_c = color.link) == null ? void 0 : _c.fg,
4749
- "--card-code-bg-color": (_d = color.code) == null ? void 0 : _d.bg,
4750
- "--card-code-fg-color": (_e = color.code) == null ? void 0 : _e.fg,
4751
- "--card-skeleton-color-from": (_f = color.skeleton) == null ? void 0 : _f.from,
4752
- "--card-skeleton-color-to": (_g = color.skeleton) == null ? void 0 : _g.to,
4753
- // @todo: deprecate
4754
- "--card-link-color": (_h = color.link) == null ? void 0 : _h.fg,
4755
- "--card-hairline-soft-color": color.border,
4756
- "--card-hairline-hard-color": color.border
4757
- };
4758
- }
4759
- var __freeze$v = Object.freeze;
4760
- var __defProp$w = Object.defineProperty;
4761
- var __template$v = (cooked, raw) => __freeze$v(__defProp$w(cooked, "raw", {
4762
- value: __freeze$v(raw || cooked.slice())
3266
+ var __freeze$x = Object.freeze;
3267
+ var __defProp$y = Object.defineProperty;
3268
+ var __template$x = (cooked, raw) => __freeze$x(__defProp$y(cooked, "raw", {
3269
+ value: __freeze$x(raw || cooked.slice())
4763
3270
  }));
4764
- var _a$v;
3271
+ var _a$x;
4765
3272
  function buttonBaseStyles() {
4766
- return css(_a$v || (_a$v = __template$v(["\n -webkit-font-smoothing: inherit;\n appearance: none;\n display: inline-flex;\n align-items: center;\n font: inherit;\n border: 0;\n outline: none;\n user-select: none;\n text-decoration: none;\n border: 0;\n box-sizing: border-box;\n padding: 0;\n margin: 0;\n white-space: nowrap;\n text-align: left;\n position: relative;\n\n & > span {\n display: block;\n flex: 1;\n min-width: 0;\n border-radius: inherit;\n }\n\n &::-moz-focus-inner {\n border: 0;\n padding: 0;\n }\n "])));
3273
+ return css(_a$x || (_a$x = __template$x(["\n -webkit-font-smoothing: inherit;\n appearance: none;\n display: inline-flex;\n align-items: center;\n font: inherit;\n border: 0;\n outline: none;\n user-select: none;\n text-decoration: none;\n border: 0;\n box-sizing: border-box;\n padding: 0;\n margin: 0;\n white-space: nowrap;\n text-align: left;\n position: relative;\n\n & > span {\n display: block;\n flex: 1;\n min-width: 0;\n border-radius: inherit;\n }\n\n &::-moz-focus-inner {\n border: 0;\n padding: 0;\n }\n "])));
4767
3274
  }
4768
3275
  const buttonTheme = {
4769
3276
  border: {
@@ -4781,32 +3288,60 @@ function buttonColorStyles(props) {
4781
3288
  var _a2, _b;
4782
3289
  const {
4783
3290
  $mode,
4784
- theme
3291
+ theme,
3292
+ $tone
4785
3293
  } = props;
4786
3294
  const {
4787
3295
  focusRing
4788
3296
  } = theme.sanity.button;
4789
3297
  const shadow = props.$mode !== "bleed";
4790
- const base = theme.sanity.color.base;
4791
- const mode = theme.sanity.color.button[$mode] || theme.sanity.color.button.default;
4792
- const color = mode[props.$tone] || mode.default;
4793
3298
  const border = {
4794
3299
  width: buttonTheme.border.width,
4795
- color: "var(--card-border-color)"
3300
+ color: $mode === "default" ? cssVars[$tone]["bg-accent"] : $mode === "ghost" ? cssVars[$tone]["border-base"] : cssVars[$tone]["bg-base"]
4796
3301
  };
4797
- return [_colorVarsStyle(base, color.enabled), {
4798
- backgroundColor: "var(--card-bg-color)",
4799
- color: "var(--card-fg-color)",
3302
+ return [{
3303
+ // This is going to be used by the text elements inside the button
3304
+ [mutableCardVariables["fg-color"]]: $mode === "default" ? cssVars[$tone]["base-text-color"] : cssVars[$tone]["text-primary"],
3305
+ [mutableCardVariables["muted-fg-color"]]: $mode === "default" ? cssVars[$tone]["base-text-color"] : cssVars[$tone]["text-secondary"],
3306
+ [mutableCardVariables["icon-color"]]: $mode === "default" ? cssVars[$tone]["icon-inverted"] : cssVars[$tone]["icon-default"],
3307
+ [mutableCardVariables["bg-color"]]: $mode === "default" ? cssVars[$tone]["bg-accent"] : cssVars[$tone]["bg-base"],
3308
+ // Override the default variables for elements used inside buttons
3309
+ [getToneCssVar("default", "bg-tint-code")]: $mode === "default" ? cssVars[$tone]["bg-accent"] : cssVars[$tone]["bg-tint-code"],
3310
+ ...($mode === "default" && {
3311
+ [getToneCssVar("default", "text-code")]: cssVars[$tone]["base-text-color"],
3312
+ [getToneCssVar("default", "text-code")]: cssVars[$tone]["base-text-color"],
3313
+ [getToneCssVar("default", "text-link")]: cssVars[$tone]["base-text-color"],
3314
+ [getToneCssVar("default", "text-accent")]: cssVars[$tone]["base-text-color"]
3315
+ }),
3316
+ '&:disabled, &[data-disabled="true"]': {
3317
+ /* Updates the variables for the */
3318
+ [mutableCardVariables["fg-color"]]: cssVars.primary["text-inactive"],
3319
+ [mutableCardVariables["muted-fg-color"]]: cssVars.primary["text-inactive"],
3320
+ [mutableCardVariables["icon-color"]]: cssVars.primary["border-base"],
3321
+ [mutableCardVariables["bg-color"]]: $mode === "default" ? cssVars.primary["bg-tint"] : cssVars.default["bg-base"]
3322
+ }
3323
+ }, {
3324
+ backgroundColor: $mode === "default" ? cssVars[$tone]["bg-accent"] : cssVars[$tone]["bg-base"],
3325
+ color: $mode === "default" ? cssVars[$tone]["base-text-color"] : cssVars[$tone]["text-primary"],
4800
3326
  boxShadow: focusRingBorderStyle(border),
4801
- '&:disabled, &[data-disabled="true"]': _colorVarsStyle(base, color.disabled),
3327
+ '&:disabled, &[data-disabled="true"]': {
3328
+ backgroundColor: $mode === "default" ? cssVars.primary["bg-tint"] : cssVars.default["bg-base"],
3329
+ color: cssVars.primary["text-inactive"],
3330
+ boxShadow: focusRingBorderStyle({
3331
+ ...border,
3332
+ color: $mode === "default" ? cssVars.primary["bg-tint"] : cssVars.primary["border-base"]
3333
+ })
3334
+ },
4802
3335
  "&:not([data-disabled='true'])": {
4803
3336
  boxShadow: combineBoxShadow(focusRingBorderStyle(border), shadow ? defaultBoxShadow : void 0),
4804
3337
  "&:focus": {
4805
3338
  boxShadow: focusRingStyle({
4806
- base,
3339
+ base: {
3340
+ bg: cssVars.positive["border-accent"]
3341
+ },
4807
3342
  border: {
4808
3343
  width: 2,
4809
- color: base.bg
3344
+ color: cssVars.default["bg-base"]
4810
3345
  },
4811
3346
  focusRing
4812
3347
  })
@@ -4815,22 +3350,30 @@ function buttonColorStyles(props) {
4815
3350
  boxShadow: combineBoxShadow(focusRingBorderStyle(border), shadow ? defaultBoxShadow : void 0)
4816
3351
  },
4817
3352
  "@media (hover: hover)": {
4818
- "&:hover": _colorVarsStyle(base, color.hovered),
4819
- "&:active": _colorVarsStyle(base, color.pressed),
4820
- "&[data-hovered]": _colorVarsStyle(base, color.hovered)
3353
+ "&:hover": {
3354
+ backgroundColor: $mode === "default" ? cssVars[$tone]["bg-accent-hover"] : cssVars[$tone]["bg-base-hover"]
3355
+ },
3356
+ "&:active": {
3357
+ backgroundColor: $mode === "default" ? cssVars[$tone]["bg-accent-active"] : cssVars[$tone]["bg-base-active"]
3358
+ },
3359
+ "&[data-hovered]": {
3360
+ backgroundColor: $mode === "default" ? cssVars[$tone]["bg-accent-hover"] : cssVars[$tone]["bg-base-hover"]
3361
+ }
4821
3362
  },
4822
- "&[data-selected]": _colorVarsStyle(base, color.pressed)
3363
+ "&[data-selected]": {
3364
+ backgroundColor: $mode === "default" ? cssVars[$tone]["bg-accent-active"] : cssVars[$tone]["bg-base-active"]
3365
+ }
4823
3366
  }
4824
3367
  }, (_b = (_a2 = theme.sanity.styles) == null ? void 0 : _a2.button) == null ? void 0 : _b.root].filter(Boolean);
4825
3368
  }
4826
- var __freeze$u = Object.freeze;
4827
- var __defProp$v = Object.defineProperty;
4828
- var __template$u = (cooked, raw) => __freeze$u(__defProp$v(cooked, "raw", {
4829
- value: __freeze$u(raw || cooked.slice())
3369
+ var __freeze$w = Object.freeze;
3370
+ var __defProp$x = Object.defineProperty;
3371
+ var __template$w = (cooked, raw) => __freeze$w(__defProp$x(cooked, "raw", {
3372
+ value: __freeze$w(raw || cooked.slice())
4830
3373
  }));
4831
- var _a$u;
4832
- const Root$v = styled.button(responsiveRadiusStyle, buttonBaseStyles, buttonColorStyles);
4833
- const LoadingBox = styled.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"])));
3374
+ var _a$w;
3375
+ const Root$w = styled.button(responsiveRadiusStyle, buttonBaseStyles, buttonColorStyles);
3376
+ const LoadingBox = styled.div(_a$w || (_a$w = __template$w(["\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"]);
4834
3377
  const Button = forwardRef(function Button2(props, ref) {
4835
3378
  const {
4836
3379
  children,
@@ -4879,7 +3422,7 @@ const Button = forwardRef(function Button2(props, ref) {
4879
3422
  paddingLeft,
4880
3423
  paddingRight
4881
3424
  }), [padding, paddingX, paddingY, paddingTop, paddingBottom, paddingLeft, paddingRight]);
4882
- return /* @__PURE__ */jsxs(Root$v, {
3425
+ return /* @__PURE__ */jsxs(Root$w, {
4883
3426
  "data-ui": "Button",
4884
3427
  ...restProps,
4885
3428
  $mode: mode,
@@ -4924,12 +3467,59 @@ const Button = forwardRef(function Button2(props, ref) {
4924
3467
  })]
4925
3468
  });
4926
3469
  });
4927
- var __freeze$t = Object.freeze;
4928
- var __defProp$u = Object.defineProperty;
4929
- var __template$t = (cooked, raw) => __freeze$t(__defProp$u(cooked, "raw", {
4930
- value: __freeze$t(raw || cooked.slice())
3470
+ function _colorVarStyleDisabled() {
3471
+ let checkered = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
3472
+ return {
3473
+ [getToneCssVar("default", "text-link")]: cssVars.default["text-secondary"],
3474
+ [getToneCssVar("default", "text-accent")]: cssVars.default["text-secondary"],
3475
+ [getToneCssVar("default", "text-code")]: cssVars.default["text-secondary"],
3476
+ [getToneCssVar("default", "text-primary")]: cssVars.default["text-secondary"],
3477
+ [mutableCardVariables["fg-color"]]: cssVars.primary["text-secondary"],
3478
+ [mutableCardVariables["muted-fg-color"]]: cssVars.primary["text-secondary"],
3479
+ [mutableCardVariables["icon-color"]]: cssVars.primary["border-base"],
3480
+ [mutableCardVariables["accent-color"]]: cssVars.primary["base-bg-card"],
3481
+ [mutableCardVariables["bg-color"]]: cssVars.primary["bg-tint"],
3482
+ [mutableCardVariables["bg-image"]]: checkered ? "repeating-conic-gradient(".concat(cssVars.default["base-bg-card"], " 0% 25%, ").concat(cssVars.default["bg-tint"], " 0% 50%)") : void 0
3483
+ };
3484
+ }
3485
+ function _colorVarStyleSelected() {
3486
+ return {
3487
+ [mutableCardVariables["bg-color"]]: cssVars.default["bg-accent"],
3488
+ [mutableCardVariables["fg-color"]]: cssVars.default["bg-base"],
3489
+ [mutableCardVariables["muted-fg-color"]]: cssVars.default["base-bg-card"],
3490
+ [mutableCardVariables["accent-color"]]: cssVars.default["base-bg-card"],
3491
+ [mutableCardVariables["icon-color"]]: cssVars.primary["bg-base"]
3492
+ };
3493
+ }
3494
+ function _colorVarStyleHover() {
3495
+ return {
3496
+ [mutableCardVariables["bg-color"]]: cssVars.default["bg-base-hover"],
3497
+ [getToneCssVar("default", "bg-tint")]: cssVars.default["bg-base-active"]
3498
+ };
3499
+ }
3500
+ function _colorVarStyleActive() {
3501
+ return {
3502
+ [mutableCardVariables["bg-color"]]: cssVars.default["bg-base-active"]
3503
+ };
3504
+ }
3505
+ function _selectableVarStyle(tone) {
3506
+ return {
3507
+ [mutableCardVariables["bg-color"]]: "inherit",
3508
+ [mutableCardVariables["fg-color"]]: tone === "default" ? cssVars.default["text-primary"] : cssVars.default["text-secondary"]
3509
+ };
3510
+ }
3511
+ function _selectableVarStyleDisabled() {
3512
+ return {
3513
+ ..._colorVarStyleDisabled(),
3514
+ [mutableCardVariables["bg-color"]]: void 0
3515
+ };
3516
+ }
3517
+ var __freeze$v = Object.freeze;
3518
+ var __defProp$w = Object.defineProperty;
3519
+ var __template$v = (cooked, raw) => __freeze$v(__defProp$w(cooked, "raw", {
3520
+ value: __freeze$v(raw || cooked.slice())
4931
3521
  }));
4932
- var _a$t, _b$i, _c$a;
3522
+ var _a$v, _b$j, _c$b;
4933
3523
  function cardStyle(props) {
4934
3524
  return [cardBaseStyle(props), cardColorStyle(props)];
4935
3525
  }
@@ -4939,38 +3529,50 @@ function cardBaseStyle(props) {
4939
3529
  theme
4940
3530
  } = props;
4941
3531
  const space = theme.sanity.space;
4942
- return 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 && 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]));
3532
+ return css(_b$j || (_b$j = __template$v(["\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 && css(_a$v || (_a$v = __template$v(["\n background-size: ", "px ", "px;\n background-position: 50% 50%;\n background-image: ", ";\n "])), space[3], space[3], cssVars.mutable["bg-image"]));
4943
3533
  }
4944
3534
  function cardColorStyle(props) {
4945
3535
  var _a2, _b2;
4946
3536
  const {
4947
3537
  $checkered,
4948
3538
  $focusRing,
4949
- theme
3539
+ theme,
3540
+ $tone,
3541
+ $scheme,
3542
+ $updateCssVars
4950
3543
  } = props;
4951
3544
  const {
4952
3545
  focusRing
4953
3546
  } = theme.sanity.card;
4954
- const {
4955
- base,
4956
- card,
4957
- dark
4958
- } = theme.sanity.color;
4959
3547
  const border = {
4960
3548
  width: 0,
4961
- color: "var(--card-border-color)"
3549
+ color: cssVars.positive["border-accent"]
4962
3550
  };
4963
- return 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({
4964
- base,
3551
+ return css(_c$b || (_c$b = __template$v(["\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({
4965
3552
  border,
4966
3553
  focusRing
4967
- }) : 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({
4968
- base,
3554
+ }) : void 0, $focusRing ? focusRingBorderStyle(border) : void 0, _colorVarStyleDisabled($checkered), _colorVarStyleActive(), _colorVarStyleSelected(), _colorVarStyleHover(), _colorVarStyleActive(), $focusRing ? focusRingStyle({
4969
3555
  border,
4970
3556
  focusRing
4971
3557
  }) : void 0, $focusRing ? focusRingBorderStyle(border) : void 0, (_b2 = (_a2 = theme.sanity.styles) == null ? void 0 : _a2.card) == null ? void 0 : _b2.root);
4972
3558
  }
4973
- const Root$u = styled(Box)(responsiveBorderStyle, responsiveRadiusStyle, responsiveShadowStyle, cardStyle);
3559
+ const Root$v = styled(Box)(responsiveBorderStyle, responsiveRadiusStyle, responsiveShadowStyle, cardStyle);
3560
+ const Wrapper = _ref5 => {
3561
+ let {
3562
+ shouldAddContext,
3563
+ scheme,
3564
+ tone,
3565
+ children
3566
+ } = _ref5;
3567
+ if (shouldAddContext) {
3568
+ return /* @__PURE__ */jsx(ToneProvider, {
3569
+ scheme,
3570
+ tone,
3571
+ children
3572
+ });
3573
+ }
3574
+ return children;
3575
+ };
4974
3576
  const Card = forwardRef(function Card2(props, ref) {
4975
3577
  const {
4976
3578
  __unstable_checkered: checkered = false,
@@ -4983,23 +3585,28 @@ const Card = forwardRef(function Card2(props, ref) {
4983
3585
  borderLeft,
4984
3586
  pressed,
4985
3587
  radius = 0,
4986
- scheme,
3588
+ scheme: schemeProp,
4987
3589
  selected,
4988
3590
  shadow,
4989
3591
  tone: toneProp = "default",
3592
+ updateCssVars = false,
4990
3593
  ...restProps
4991
3594
  } = props;
4992
3595
  const as = isValidElementType(asProp) ? asProp : "div";
4993
- const rootTheme = useRootTheme();
4994
- const tone = toneProp === "inherit" ? rootTheme.tone : toneProp;
4995
- return /* @__PURE__ */jsx(ThemeColorProvider, {
3596
+ const toneContext = useToneContext();
3597
+ const tone = toneProp === "inherit" ? toneContext.tone : toneProp;
3598
+ const scheme = schemeProp != null ? schemeProp : toneContext.scheme;
3599
+ const shouldAddContext = scheme !== toneContext.scheme || tone !== toneContext.tone;
3600
+ return /* @__PURE__ */jsx(Wrapper, {
3601
+ shouldAddContext,
4996
3602
  scheme,
4997
3603
  tone,
4998
- children: /* @__PURE__ */jsx(Root$u, {
3604
+ children: /* @__PURE__ */jsx(Root$v, {
4999
3605
  "data-as": typeof as === "string" ? as : void 0,
5000
- "data-scheme": rootTheme.scheme,
3606
+ "data-scheme": scheme,
5001
3607
  "data-ui": "Card",
5002
3608
  "data-tone": tone,
3609
+ $scheme: scheme != null ? scheme : toneContext.scheme,
5003
3610
  ...restProps,
5004
3611
  $border: useArrayProp(border),
5005
3612
  $borderTop: useArrayProp(borderTop),
@@ -5011,6 +3618,7 @@ const Card = forwardRef(function Card2(props, ref) {
5011
3618
  $radius: useArrayProp(radius),
5012
3619
  $shadow: useArrayProp(shadow),
5013
3620
  $tone: tone,
3621
+ $updateCssVars: updateCssVars || shouldAddContext,
5014
3622
  "data-checkered": checkered ? "" : void 0,
5015
3623
  "data-pressed": pressed ? "" : void 0,
5016
3624
  "data-selected": selected ? "" : void 0,
@@ -5020,20 +3628,19 @@ const Card = forwardRef(function Card2(props, ref) {
5020
3628
  })
5021
3629
  });
5022
3630
  });
5023
- var __freeze$s = Object.freeze;
5024
- var __defProp$t = Object.defineProperty;
5025
- var __template$s = (cooked, raw) => __freeze$s(__defProp$t(cooked, "raw", {
5026
- value: __freeze$s(raw || cooked.slice())
3631
+ var __freeze$u = Object.freeze;
3632
+ var __defProp$v = Object.defineProperty;
3633
+ var __template$u = (cooked, raw) => __freeze$u(__defProp$v(cooked, "raw", {
3634
+ value: __freeze$u(raw || cooked.slice())
5027
3635
  }));
5028
- var _a$s, _b$h;
3636
+ var _a$u, _b$i;
5029
3637
  function checkboxBaseStyles() {
5030
- return css(_a$s || (_a$s = __template$s(["\n position: relative;\n display: inline-block;\n "])));
3638
+ return css(_a$u || (_a$u = __template$u(["\n position: relative;\n display: inline-block;\n "])));
5031
3639
  }
5032
3640
  function inputElementStyles(props) {
5033
3641
  const {
5034
3642
  theme
5035
3643
  } = props;
5036
- const color = theme.sanity.color.input;
5037
3644
  const {
5038
3645
  input,
5039
3646
  radius
@@ -5041,40 +3648,40 @@ function inputElementStyles(props) {
5041
3648
  const {
5042
3649
  focusRing
5043
3650
  } = input.checkbox;
5044
- return 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({
5045
- color: color.default.enabled.border,
3651
+ return css(_b$i || (_b$i = __template$u(["\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({
3652
+ color: cssVars.default["border-base"],
5046
3653
  width: input.border.width
5047
- }), rem(radius[2]), color.default.enabled.bg, color.default.enabled.bg2, focusRingBorderStyle({
5048
- color: color.default.enabled.bg2,
3654
+ }), rem(radius[2]), cssVars.default["bg-base"], cssVars.default["text-secondary"], focusRingBorderStyle({
3655
+ color: cssVars.default["text-secondary"],
5049
3656
  width: input.border.width
5050
- }), color.default.enabled.bg, focusRingStyle({
3657
+ }), cssVars.default["bg-base"], focusRingStyle({
5051
3658
  focusRing
5052
3659
  }), focusRingStyle({
5053
3660
  focusRing: {
5054
3661
  width: 1,
5055
3662
  offset: 1
5056
3663
  }
5057
- }), color.invalid.enabled.border, focusRingBorderStyle({
3664
+ }), cssVars.critical["border-base"], focusRingBorderStyle({
5058
3665
  width: input.border.width,
5059
- color: color.invalid.enabled.bg2
5060
- }), color.default.disabled.fg, color.invalid.enabled.bg2, color.default.enabled.bg, focusRingStyle({
3666
+ color: cssVars.critical["text-secondary"]
3667
+ }), cssVars.default["text-secondary"], cssVars.critical["text-secondary"], cssVars.default["bg-base"], focusRingStyle({
5061
3668
  border: {
5062
3669
  width: input.border.width,
5063
- color: color.invalid.readOnly.bg2
3670
+ color: cssVars.critical["text-secondary"]
5064
3671
  },
5065
3672
  focusRing: {
5066
3673
  width: 1,
5067
3674
  offset: 1
5068
3675
  }
5069
- }), color.default.disabled.bg, focusRingBorderStyle({
3676
+ }), cssVars.default["bg-tint"], focusRingBorderStyle({
5070
3677
  width: input.border.width,
5071
- color: color.default.disabled.border
5072
- }), color.default.disabled.fg, color.default.disabled.bg2, color.default.readOnly.bg, focusRingBorderStyle({
3678
+ color: cssVars.default["border-base"]
3679
+ }), cssVars.default["text-secondary"], cssVars.default["border-base"], cssVars.default["bg-tint"], focusRingBorderStyle({
5073
3680
  width: input.border.width,
5074
- color: color.default.readOnly.border
5075
- }), color.default.readOnly.fg, color.default.readOnly.bg2);
3681
+ color: cssVars.default["border-base"]
3682
+ }), cssVars.default["text-secondary"], cssVars.default["border-base"]);
5076
3683
  }
5077
- const Root$t = styled.div(checkboxBaseStyles);
3684
+ const Root$u = styled.div(checkboxBaseStyles);
5078
3685
  const Input$5 = styled.input(inputElementStyles);
5079
3686
  const Checkbox = forwardRef(function Checkbox2(props, forwardedRef) {
5080
3687
  const {
@@ -5094,7 +3701,7 @@ const Checkbox = forwardRef(function Checkbox2(props, forwardedRef) {
5094
3701
  ref.current.indeterminate = indeterminate || false;
5095
3702
  }
5096
3703
  }, [indeterminate, ref]);
5097
- return /* @__PURE__ */jsxs(Root$t, {
3704
+ return /* @__PURE__ */jsxs(Root$u, {
5098
3705
  className,
5099
3706
  "data-ui": "Checkbox",
5100
3707
  style,
@@ -5112,132 +3719,131 @@ const Checkbox = forwardRef(function Checkbox2(props, forwardedRef) {
5112
3719
  })]
5113
3720
  });
5114
3721
  });
5115
- var __freeze$r = Object.freeze;
5116
- var __defProp$s = Object.defineProperty;
5117
- var __template$r = (cooked, raw) => __freeze$r(__defProp$s(cooked, "raw", {
5118
- value: __freeze$r(raw || cooked.slice())
3722
+ var __freeze$t = Object.freeze;
3723
+ var __defProp$u = Object.defineProperty;
3724
+ var __template$t = (cooked, raw) => __freeze$t(__defProp$u(cooked, "raw", {
3725
+ value: __freeze$t(raw || cooked.slice())
5119
3726
  }));
5120
- var _a$r;
5121
- function codeSyntaxHighlightingStyle(_ref20) {
5122
- let {
5123
- theme
5124
- } = _ref20;
5125
- const color = theme.sanity.color.syntax;
3727
+ var _a$t;
3728
+ function codeSyntaxHighlightingStyle(scheme) {
3729
+ const dark = scheme === "dark";
3730
+ const mainShade = dark ? 400 : 600;
3731
+ const secondaryShade = dark ? 600 : 400;
5126
3732
  return {
5127
3733
  "&.atrule": {
5128
- color: color.atrule
3734
+ color: purple[mainShade].hex
5129
3735
  },
5130
3736
  "&.attr-name": {
5131
- color: color.attrName
3737
+ color: green[mainShade].hex
5132
3738
  },
5133
3739
  "&.attr-value": {
5134
- color: color.attrValue
3740
+ color: yellow[mainShade].hex
5135
3741
  },
5136
3742
  "&.attribute": {
5137
- color: color.attribute
3743
+ color: yellow[mainShade].hex
5138
3744
  },
5139
3745
  "&.boolean": {
5140
- color: color.boolean
3746
+ color: purple[mainShade].hex
5141
3747
  },
5142
3748
  "&.builtin": {
5143
- color: color.builtin
3749
+ color: purple[mainShade].hex
5144
3750
  },
5145
3751
  "&.cdata": {
5146
- color: color.cdata
3752
+ color: yellow[mainShade].hex
5147
3753
  },
5148
3754
  "&.char": {
5149
- color: color.char
3755
+ color: yellow[mainShade].hex
5150
3756
  },
5151
3757
  "&.class": {
5152
- color: color.class
3758
+ color: orange[mainShade].hex
5153
3759
  },
5154
3760
  "&.class-name": {
5155
- color: color.className
3761
+ color: cyan[mainShade].hex
5156
3762
  },
5157
3763
  "&.comment": {
5158
- color: color.comment
3764
+ color: gray[secondaryShade].hex
5159
3765
  },
5160
3766
  "&.constant": {
5161
- color: color.constant
3767
+ color: purple[mainShade].hex
5162
3768
  },
5163
3769
  "&.deleted": {
5164
- color: color.deleted
3770
+ color: red[mainShade].hex
5165
3771
  },
5166
3772
  "&.doctype": {
5167
- color: color.doctype
3773
+ color: gray[secondaryShade].hex
5168
3774
  },
5169
3775
  "&.entity": {
5170
- color: color.entity
3776
+ color: red[mainShade].hex
5171
3777
  },
5172
3778
  "&.function": {
5173
- color: color.function
3779
+ color: green[mainShade].hex
5174
3780
  },
5175
3781
  "&.hexcode": {
5176
- color: color.hexcode
3782
+ color: blue[mainShade].hex
5177
3783
  },
5178
3784
  "&.id": {
5179
- color: color.id
3785
+ color: purple[mainShade].hex
5180
3786
  },
5181
3787
  "&.important": {
5182
- color: color.important
3788
+ color: purple[mainShade].hex
5183
3789
  },
5184
3790
  "&.inserted": {
5185
- color: color.inserted
3791
+ color: yellow[mainShade].hex
5186
3792
  },
5187
3793
  "&.keyword": {
5188
- color: color.keyword
3794
+ color: magenta[mainShade].hex
5189
3795
  },
5190
3796
  "&.number": {
5191
- color: color.number
3797
+ color: purple[mainShade].hex
5192
3798
  },
5193
3799
  "&.operator": {
5194
- color: color.operator
3800
+ color: magenta[mainShade].hex
5195
3801
  },
5196
3802
  "&.prolog": {
5197
- color: color.prolog
3803
+ color: gray[secondaryShade].hex
5198
3804
  },
5199
3805
  "&.property": {
5200
- color: color.property
3806
+ color: blue[mainShade].hex
5201
3807
  },
5202
3808
  "&.pseudo-class": {
5203
- color: color.pseudoClass
3809
+ color: yellow[mainShade].hex
5204
3810
  },
5205
3811
  "&.pseudo-element": {
5206
- color: color.pseudoElement
3812
+ color: yellow[mainShade].hex
5207
3813
  },
5208
3814
  "&.punctuation": {
5209
- color: color.punctuation
3815
+ color: gray[mainShade].hex
5210
3816
  },
5211
3817
  "&.regex": {
5212
- color: color.regex
3818
+ color: blue[mainShade].hex
5213
3819
  },
5214
3820
  "&.selector": {
5215
- color: color.selector
3821
+ color: red[mainShade].hex
5216
3822
  },
5217
3823
  "&.string": {
5218
- color: color.string
3824
+ color: yellow[mainShade].hex
5219
3825
  },
5220
3826
  "&.symbol": {
5221
- color: color.symbol
3827
+ color: purple[mainShade].hex
5222
3828
  },
5223
3829
  "&.tag": {
5224
- color: color.tag
3830
+ color: red[mainShade].hex
5225
3831
  },
5226
3832
  "&.unit": {
5227
- color: color.unit
3833
+ color: orange[mainShade].hex
5228
3834
  },
5229
3835
  "&.url": {
5230
- color: color.url
3836
+ color: red[mainShade].hex
5231
3837
  },
5232
3838
  "&.variable": {
5233
- color: color.variable
3839
+ color: red[mainShade].hex
5234
3840
  }
5235
3841
  };
5236
3842
  }
5237
- function codeBaseStyle() {
5238
- return 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);
3843
+ function codeBaseStyle(props) {
3844
+ return css(_a$t || (_a$t = __template$t(["\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));
5239
3845
  }
5240
- const Root$s = styled.pre(codeBaseStyle, responsiveCodeFontStyle);
3846
+ const Root$t = styled.pre(codeBaseStyle, responsiveCodeFontStyle);
5241
3847
  const Code = forwardRef(function Code2(props, ref) {
5242
3848
  const {
5243
3849
  children,
@@ -5248,12 +3854,16 @@ const Code = forwardRef(function Code2(props, ref) {
5248
3854
  } = props;
5249
3855
  const language = typeof languageProp === "string" ? languageProp : void 0;
5250
3856
  const registered = language ? Refractor.hasLanguage(language) : false;
5251
- return /* @__PURE__ */jsxs(Root$s, {
3857
+ const {
3858
+ scheme
3859
+ } = useToneContext();
3860
+ return /* @__PURE__ */jsxs(Root$t, {
5252
3861
  "data-ui": "Code",
5253
3862
  ...restProps,
5254
3863
  $size: useArrayProp(size),
5255
3864
  $weight: weight,
5256
3865
  ref,
3866
+ $scheme: scheme,
5257
3867
  children: [!(language && registered) && /* @__PURE__ */jsx("code", {
5258
3868
  children
5259
3869
  }), language && registered && /* @__PURE__ */jsx(Refractor, {
@@ -5282,14 +3892,14 @@ function responsiveContainerWidthStyle(props) {
5282
3892
  maxWidth: val === "auto" ? "none" : rem(container[val])
5283
3893
  }));
5284
3894
  }
5285
- const Root$r = styled(Box)(containerBaseStyle, responsiveContainerWidthStyle);
3895
+ const Root$s = styled(Box)(containerBaseStyle, responsiveContainerWidthStyle);
5286
3896
  const Container = forwardRef(function Container2(props, ref) {
5287
3897
  const {
5288
3898
  as,
5289
3899
  width = 2,
5290
3900
  ...restProps
5291
3901
  } = props;
5292
- return /* @__PURE__ */jsx(Root$r, {
3902
+ return /* @__PURE__ */jsx(Root$s, {
5293
3903
  "data-ui": "Container",
5294
3904
  ...restProps,
5295
3905
  $width: useArrayProp(width),
@@ -5297,7 +3907,7 @@ const Container = forwardRef(function Container2(props, ref) {
5297
3907
  ref
5298
3908
  });
5299
3909
  });
5300
- const Root$q = styled(Box)(responsiveGridStyle);
3910
+ const Root$r = styled(Box)(responsiveGridStyle);
5301
3911
  const Grid = forwardRef(function Grid2(props, ref) {
5302
3912
  const {
5303
3913
  as,
@@ -5312,7 +3922,7 @@ const Grid = forwardRef(function Grid2(props, ref) {
5312
3922
  children,
5313
3923
  ...restProps
5314
3924
  } = props;
5315
- return /* @__PURE__ */jsx(Root$q, {
3925
+ return /* @__PURE__ */jsx(Root$r, {
5316
3926
  "data-as": typeof as === "string" ? as : void 0,
5317
3927
  "data-ui": "Grid",
5318
3928
  ...restProps,
@@ -5329,28 +3939,28 @@ const Grid = forwardRef(function Grid2(props, ref) {
5329
3939
  children
5330
3940
  });
5331
3941
  });
5332
- var __freeze$q = Object.freeze;
5333
- var __defProp$r = Object.defineProperty;
5334
- var __template$q = (cooked, raw) => __freeze$q(__defProp$r(cooked, "raw", {
5335
- value: __freeze$q(raw || cooked.slice())
3942
+ var __freeze$s = Object.freeze;
3943
+ var __defProp$t = Object.defineProperty;
3944
+ var __template$s = (cooked, raw) => __freeze$s(__defProp$t(cooked, "raw", {
3945
+ value: __freeze$s(raw || cooked.slice())
5336
3946
  }));
5337
- var _a$q, _b$g, _c$9;
3947
+ var _a$s, _b$h, _c$a;
5338
3948
  function headingBaseStyle(props) {
5339
3949
  const {
5340
3950
  $accent,
5341
3951
  $muted,
5342
3952
  theme
5343
3953
  } = props;
5344
- return 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 && css(_a$q || (_a$q = __template$q(["\n color: var(--card-accent-fg-color);\n "]))), $muted && css(_b$g || (_b$g = __template$q(["\n color: var(--card-muted-fg-color);\n "]))), theme.sanity.fonts.code.family);
3954
+ return css(_c$a || (_c$a = __template$s(["\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 && css(_a$s || (_a$s = __template$s(["\n color: ", "};\n "])), cssVars.default["text-accent"]), $muted && css(_b$h || (_b$h = __template$s(["\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"]);
5345
3955
  }
5346
- var __freeze$p = Object.freeze;
5347
- var __defProp$q = Object.defineProperty;
5348
- var __template$p = (cooked, raw) => __freeze$p(__defProp$q(cooked, "raw", {
5349
- value: __freeze$p(raw || cooked.slice())
3956
+ var __freeze$r = Object.freeze;
3957
+ var __defProp$s = Object.defineProperty;
3958
+ var __template$r = (cooked, raw) => __freeze$r(__defProp$s(cooked, "raw", {
3959
+ value: __freeze$r(raw || cooked.slice())
5350
3960
  }));
5351
- var _a$p;
5352
- const Root$p = styled.div(headingBaseStyle, responsiveTextAlignStyle, responsiveHeadingFont);
5353
- const SpanWithTextOverflow = styled.span(_a$p || (_a$p = __template$p(["\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n overflow: clip;\n"])));
3961
+ var _a$r;
3962
+ const Root$q = styled.div(headingBaseStyle, responsiveTextAlignStyle, responsiveHeadingFont);
3963
+ const SpanWithTextOverflow$1 = styled.span(_a$r || (_a$r = __template$r(["\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n overflow: clip;\n"])));
5354
3964
  const Heading = forwardRef(function Heading2(props, ref) {
5355
3965
  const {
5356
3966
  accent = false,
@@ -5364,11 +3974,11 @@ const Heading = forwardRef(function Heading2(props, ref) {
5364
3974
  } = props;
5365
3975
  let children = childrenProp;
5366
3976
  if (textOverflow === "ellipsis") {
5367
- children = /* @__PURE__ */jsx(SpanWithTextOverflow, {
3977
+ children = /* @__PURE__ */jsx(SpanWithTextOverflow$1, {
5368
3978
  children
5369
3979
  });
5370
3980
  }
5371
- return /* @__PURE__ */jsx(Root$p, {
3981
+ return /* @__PURE__ */jsx(Root$q, {
5372
3982
  "data-ui": "Heading",
5373
3983
  ...restProps,
5374
3984
  $accent: accent,
@@ -5408,7 +4018,7 @@ function inlineSpaceStyle(props) {
5408
4018
  };
5409
4019
  });
5410
4020
  }
5411
- const Root$o = styled(Box)(inlineBaseStyle, inlineSpaceStyle);
4021
+ const Root$p = styled(Box)(inlineBaseStyle, inlineSpaceStyle);
5412
4022
  const Inline = forwardRef(function Inline2(props, ref) {
5413
4023
  const {
5414
4024
  as,
@@ -5419,7 +4029,7 @@ const Inline = forwardRef(function Inline2(props, ref) {
5419
4029
  const children = useMemo(() => childrenToElementArray(childrenProp).filter(Boolean).map((child, idx) => /* @__PURE__ */jsx("div", {
5420
4030
  children: child
5421
4031
  }, idx)), [childrenProp]);
5422
- return /* @__PURE__ */jsx(Root$o, {
4032
+ return /* @__PURE__ */jsx(Root$p, {
5423
4033
  "data-ui": "Inline",
5424
4034
  ...restProps,
5425
4035
  $space: useArrayProp(space),
@@ -5428,16 +4038,16 @@ const Inline = forwardRef(function Inline2(props, ref) {
5428
4038
  children
5429
4039
  });
5430
4040
  });
5431
- var __freeze$o = Object.freeze;
5432
- var __defProp$p = Object.defineProperty;
5433
- var __template$o = (cooked, raw) => __freeze$o(__defProp$p(cooked, "raw", {
5434
- value: __freeze$o(raw || cooked.slice())
4041
+ var __freeze$q = Object.freeze;
4042
+ var __defProp$r = Object.defineProperty;
4043
+ var __template$q = (cooked, raw) => __freeze$q(__defProp$r(cooked, "raw", {
4044
+ value: __freeze$q(raw || cooked.slice())
5435
4045
  }));
5436
- var _a$o;
4046
+ var _a$q;
5437
4047
  function kbdStyle() {
5438
- return 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 "])));
4048
+ return css(_a$q || (_a$q = __template$q(["\n background: ", ";\n font: inherit;\n\n &:not([hidden]) {\n display: inline-block;\n }\n "])), cssVars.default["bg-tint"]);
5439
4049
  }
5440
- const Root$n = styled.kbd(responsiveRadiusStyle, kbdStyle);
4050
+ const Root$o = styled.kbd(responsiveRadiusStyle, kbdStyle);
5441
4051
  const KBD = forwardRef(function KBD2(props, ref) {
5442
4052
  const {
5443
4053
  children,
@@ -5446,7 +4056,7 @@ const KBD = forwardRef(function KBD2(props, ref) {
5446
4056
  radius = 2,
5447
4057
  ...restProps
5448
4058
  } = props;
5449
- return /* @__PURE__ */jsx(Root$n, {
4059
+ return /* @__PURE__ */jsx(Root$o, {
5450
4060
  "data-ui": "KBD",
5451
4061
  ...restProps,
5452
4062
  $radius: useArrayProp(radius),
@@ -5464,6 +4074,64 @@ const KBD = forwardRef(function KBD2(props, ref) {
5464
4074
  })
5465
4075
  });
5466
4076
  });
4077
+ var __freeze$p = Object.freeze;
4078
+ var __defProp$q = Object.defineProperty;
4079
+ var __template$p = (cooked, raw) => __freeze$p(__defProp$q(cooked, "raw", {
4080
+ value: __freeze$p(raw || cooked.slice())
4081
+ }));
4082
+ var _a$p, _b$g, _c$9;
4083
+ function labelBaseStyle(props) {
4084
+ const {
4085
+ $accent,
4086
+ $muted,
4087
+ theme
4088
+ } = props;
4089
+ const {
4090
+ fonts
4091
+ } = theme.sanity;
4092
+ return css(_c$9 || (_c$9 = __template$p(["\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 && css(_a$p || (_a$p = __template$p(["\n color: ", "};\n "])), cssVars.default["text-accent"]), $muted && css(_b$g || (_b$g = __template$p(["\n color: ", ";\n "])), cssVars.mutable["muted-fg-color"]), fonts.code.family);
4093
+ }
4094
+ var __freeze$o = Object.freeze;
4095
+ var __defProp$p = Object.defineProperty;
4096
+ var __template$o = (cooked, raw) => __freeze$o(__defProp$p(cooked, "raw", {
4097
+ value: __freeze$o(raw || cooked.slice())
4098
+ }));
4099
+ var _a$o;
4100
+ const Root$n = styled.div(responsiveLabelFont, responsiveTextAlignStyle, labelBaseStyle);
4101
+ const SpanWithTextOverflow = styled.span(_a$o || (_a$o = __template$o(["\n display: block;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n overflow: clip;\n"])));
4102
+ const Label = forwardRef(function Label2(props, ref) {
4103
+ const {
4104
+ accent,
4105
+ align,
4106
+ children: childrenProp,
4107
+ muted = false,
4108
+ size = 2,
4109
+ textOverflow,
4110
+ weight,
4111
+ ...restProps
4112
+ } = props;
4113
+ let children = childrenProp;
4114
+ if (textOverflow === "ellipsis") {
4115
+ children = /* @__PURE__ */jsx(SpanWithTextOverflow, {
4116
+ children
4117
+ });
4118
+ } else {
4119
+ children = /* @__PURE__ */jsx("span", {
4120
+ children
4121
+ });
4122
+ }
4123
+ return /* @__PURE__ */jsx(Root$n, {
4124
+ "data-ui": "Label",
4125
+ ...restProps,
4126
+ $accent: accent,
4127
+ $align: useArrayProp(align),
4128
+ $muted: muted,
4129
+ $size: useArrayProp(size),
4130
+ $weight: weight,
4131
+ ref,
4132
+ children
4133
+ });
4134
+ });
5467
4135
  const key$7 = Symbol.for("@sanity/ui/context/boundaryElement");
5468
4136
  globalScope[key$7] = globalScope[key$7] || createContext(null);
5469
4137
  const BoundaryElementContext = globalScope[key$7];
@@ -6175,8 +4843,8 @@ var __template$l = (cooked, raw) => __freeze$l(__defProp$l(cooked, "raw", {
6175
4843
  }));
6176
4844
  var _a$l, _b$e, _c$8;
6177
4845
  const Root$j = styled.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);
6178
- const BorderPath = styled.path(_b$e || (_b$e = __template$l(["\n fill: var(--card-shadow-outline-color);\n"])));
6179
- const ShapePath = styled.path(_c$8 || (_c$8 = __template$l(["\n fill: var(--card-bg-color);\n"])));
4846
+ const BorderPath = styled.path(_b$e || (_b$e = __template$l(["\n fill: ", ";\n"])), cssVars.default["base-shadow-outline-color"]);
4847
+ const ShapePath = styled.path(_c$8 || (_c$8 = __template$l(["\n fill: ", ";\n"])), cssVars.mutable["bg-color"]);
6180
4848
  const PopoverArrow = forwardRef(function PopoverArrow2(props, ref) {
6181
4849
  return /* @__PURE__ */jsx(Root$j, {
6182
4850
  "data-ui": "Popover__arrow",
@@ -6229,6 +4897,7 @@ const PopoverCard = memo(forwardRef(function PopoverCard2(props, ref) {
6229
4897
  const {
6230
4898
  zIndex
6231
4899
  } = useLayer();
4900
+ const toneContext = useToneContext();
6232
4901
  const margins = useMemo(() => marginsProp || DEFAULT_POPOVER_MARGINS, [marginsProp]);
6233
4902
  const x = (xProp != null ? xProp : 0) + margins[3];
6234
4903
  const y = (yProp != null ? yProp : 0) + margins[0];
@@ -6254,14 +4923,16 @@ const PopoverCard = memo(forwardRef(function PopoverCard2(props, ref) {
6254
4923
  return /* @__PURE__ */jsxs(Root$i, {
6255
4924
  "data-ui": "Popover",
6256
4925
  ...restProps,
4926
+ "data-tone": tone,
6257
4927
  "data-placement": placement,
6258
4928
  radius,
6259
4929
  ref,
6260
4930
  scheme,
6261
4931
  shadow,
6262
4932
  sizing: "border",
4933
+ updateCssVars: true,
4934
+ tone: tone === "inherit" ? toneContext.tone : tone,
6263
4935
  style: rootStyle,
6264
- tone,
6265
4936
  children: [/* @__PURE__ */jsx(Flex, {
6266
4937
  "data-ui": "Popover__wrapper",
6267
4938
  direction: "column",
@@ -6371,13 +5042,13 @@ const Popover = memo(forwardRef(function Popover2(props, ref) {
6371
5042
  }));
6372
5043
  if (constrainSize || matchReferenceWidth) {
6373
5044
  ret.push(size({
6374
- apply(_ref21) {
5045
+ apply(_ref6) {
6375
5046
  let {
6376
5047
  availableWidth,
6377
5048
  availableHeight,
6378
5049
  elements,
6379
5050
  referenceWidth
6380
- } = _ref21;
5051
+ } = _ref6;
6381
5052
  referenceWidthRef.current = referenceWidth;
6382
5053
  const _currentWidth = widthRef.current;
6383
5054
  const _maxWidth = maxWidthRef.current;
@@ -6525,24 +5196,23 @@ function inputElementStyle(props) {
6525
5196
  const {
6526
5197
  focusRing
6527
5198
  } = input.radio;
6528
- const color = theme.sanity.color.input;
6529
5199
  const dist = (input.radio.size - input.radio.markSize) / 2;
6530
- return 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({
6531
- color: color.default.enabled.border,
5200
+ return 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({
5201
+ color: cssVars.default["border-base"],
6532
5202
  width: input.border.width
6533
- }), rem(dist), rem(dist), rem(input.radio.markSize), rem(input.radio.markSize), rem(input.radio.markSize / 2), color.default.enabled.bg2, focusRingStyle({
5203
+ }), rem(dist), rem(dist), rem(input.radio.markSize), rem(input.radio.markSize), rem(input.radio.markSize / 2), cssVars.default["text-secondary"], focusRingStyle({
6534
5204
  border: {
6535
5205
  width: input.border.width,
6536
- color: color.default.enabled.border
5206
+ color: cssVars.default["border-base"]
6537
5207
  },
6538
5208
  focusRing
6539
5209
  }), focusRingBorderStyle({
6540
- color: color.default.enabled.border,
5210
+ color: cssVars.default["border-base"],
6541
5211
  width: input.border.width
6542
- }), color.invalid.enabled.border, focusRingBorderStyle({
5212
+ }), cssVars.critical["border-base"], focusRingBorderStyle({
6543
5213
  width: input.border.width,
6544
- color: color.invalid.enabled.bg2
6545
- }), 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);
5214
+ color: cssVars.critical["text-secondary"]
5215
+ }), 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"]);
6546
5216
  }
6547
5217
  const Root$h = styled.div(radioBaseStyle);
6548
5218
  const Input$4 = styled.input(inputElementStyle);
@@ -6598,24 +5268,23 @@ function inputColorStyle(props) {
6598
5268
  const {
6599
5269
  focusRing
6600
5270
  } = input.select;
6601
- const color = theme.sanity.color.input;
6602
- return 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({
6603
- color: color.default.enabled.border,
5271
+ return 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({
5272
+ color: cssVars.default["border-base"],
6604
5273
  width: input.border.width
6605
- }), color.default.hovered.bg, color.default.hovered.fg, focusRingBorderStyle({
6606
- color: color.default.hovered.border,
5274
+ }), cssVars.default["bg-base-hover"], cssVars.default["text-primary"], focusRingBorderStyle({
5275
+ color: cssVars.default["border-base-hover"],
6607
5276
  width: input.border.width
6608
5277
  }), focusRingStyle({
6609
5278
  border: {
6610
5279
  width: input.border.width,
6611
- color: color.default.enabled.border
5280
+ color: cssVars.default["border-base"]
6612
5281
  },
6613
5282
  focusRing
6614
- }), color.default.readOnly.bg, color.default.readOnly.fg, focusRingBorderStyle({
6615
- color: color.default.readOnly.border,
5283
+ }), cssVars.default["bg-tint"], cssVars.default["text-primary"], focusRingBorderStyle({
5284
+ color: cssVars.default["border-base"],
6616
5285
  width: input.border.width
6617
- }), color.default.disabled.bg, color.default.disabled.fg, focusRingBorderStyle({
6618
- color: color.default.disabled.border,
5286
+ }), cssVars.default["bg-tint"], cssVars.default["text-primary"], focusRingBorderStyle({
5287
+ color: cssVars.default["border-base"],
6619
5288
  width: input.border.width
6620
5289
  }));
6621
5290
  }
@@ -6638,12 +5307,8 @@ function inputTextSizeStyle(props) {
6638
5307
  function inputStyle() {
6639
5308
  return [responsiveRadiusStyle, inputBaseStyle, inputColorStyle, inputTextSizeStyle, responsiveInputPaddingIconRightStyle];
6640
5309
  }
6641
- function iconBoxStyle(props) {
6642
- const {
6643
- theme
6644
- } = props;
6645
- const color = theme.sanity.color.input;
6646
- return 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);
5310
+ function iconBoxStyle() {
5311
+ return 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"]);
6647
5312
  }
6648
5313
  const selectStyle = {
6649
5314
  root: rootStyle,
@@ -6752,10 +5417,9 @@ function switchRepresentationStyles(props) {
6752
5417
  const {
6753
5418
  focusRing
6754
5419
  } = input.switch;
6755
- const color = theme.sanity.color.input;
6756
- return 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({
5420
+ return 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({
6757
5421
  focusRing
6758
- }), 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);
5422
+ }), 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"]);
6759
5423
  }
6760
5424
  function switchTrackStyles(props) {
6761
5425
  const {
@@ -6844,34 +5508,30 @@ const TextArea = forwardRef(function TextArea2(props, forwardedRef) {
6844
5508
  padding = 3,
6845
5509
  radius = 2,
6846
5510
  weight,
5511
+ tone = "default",
6847
5512
  ...restProps
6848
5513
  } = props;
6849
5514
  const ref = useForwardedRef(forwardedRef);
6850
- const rootTheme = useRootTheme();
6851
5515
  useCustomValidity(ref, customValidity);
6852
5516
  return /* @__PURE__ */jsx(Root$d, {
6853
5517
  "data-ui": "TextArea",
6854
5518
  children: /* @__PURE__ */jsxs(InputRoot$1, {
6855
5519
  children: [/* @__PURE__ */jsx(Input$1, {
6856
5520
  "data-as": "textarea",
6857
- "data-scheme": rootTheme.scheme,
6858
- "data-tone": rootTheme.tone,
5521
+ "data-tone": tone,
6859
5522
  ...restProps,
6860
5523
  $fontSize: useArrayProp(fontSize),
6861
5524
  $padding: useArrayProp(padding),
6862
- $scheme: rootTheme.scheme,
6863
5525
  $space: useArrayProp(0),
6864
- $tone: rootTheme.tone,
5526
+ $tone: tone,
6865
5527
  $weight: weight,
6866
5528
  disabled,
6867
5529
  ref
6868
5530
  }), /* @__PURE__ */jsx(Presentation$1, {
6869
5531
  $radius: useArrayProp(radius),
6870
- $scheme: rootTheme.scheme,
6871
- $tone: rootTheme.tone,
5532
+ $tone: tone,
6872
5533
  "data-border": border ? "" : void 0,
6873
- "data-scheme": rootTheme.scheme,
6874
- "data-tone": rootTheme.tone
5534
+ "data-tone": tone
6875
5535
  })]
6876
5536
  })
6877
5537
  });
@@ -6923,10 +5583,12 @@ const TextInput = forwardRef(function TextInput2(props, forwardedRef) {
6923
5583
  customValidity,
6924
5584
  type = "text",
6925
5585
  weight,
5586
+ tone: toneProp = "default",
6926
5587
  ...restProps
6927
5588
  } = props;
6928
5589
  const ref = useForwardedRef(forwardedRef);
6929
- const rootTheme = useRootTheme();
5590
+ const toneContext = useToneContext();
5591
+ const tone = toneProp === "default" ? toneContext.tone : toneProp;
6930
5592
  const fontSize = useArrayProp(fontSizeProp);
6931
5593
  const padding = useArrayProp(paddingProp);
6932
5594
  const radius = useArrayProp(radiusProp);
@@ -6963,11 +5625,9 @@ const TextInput = forwardRef(function TextInput2(props, forwardedRef) {
6963
5625
  $hasPrefix,
6964
5626
  $hasSuffix,
6965
5627
  $radius: radius,
6966
- $scheme: rootTheme.scheme,
6967
- $tone: rootTheme.tone,
5628
+ $tone: tone,
6968
5629
  "data-border": border ? "" : void 0,
6969
- "data-scheme": rootTheme.scheme,
6970
- "data-tone": rootTheme.tone,
5630
+ "data-tone": tone,
6971
5631
  children: [icon && /* @__PURE__ */jsx(LeftBox, {
6972
5632
  padding,
6973
5633
  children: /* @__PURE__ */jsxs(Text, {
@@ -6981,7 +5641,7 @@ const TextInput = forwardRef(function TextInput2(props, forwardedRef) {
6981
5641
  children: [isValidElement(iconRight) && iconRight, isValidElementType(iconRight) && createElement(iconRight)]
6982
5642
  })
6983
5643
  })]
6984
- }), [border, fontSize, icon, iconRight, padding, radius, rootTheme, $hasClearButton, $hasPrefix, $hasSuffix]);
5644
+ }), [border, fontSize, icon, iconRight, padding, radius, $hasClearButton, $hasPrefix, $hasSuffix, tone]);
6985
5645
  const clearButtonBoxPadding = useMemo(() => padding.map(v => {
6986
5646
  if (v === 0) return 0;
6987
5647
  if (v === 1) return 1;
@@ -7026,20 +5686,18 @@ const TextInput = forwardRef(function TextInput2(props, forwardedRef) {
7026
5686
  }), [radius, suffix]);
7027
5687
  return /* @__PURE__ */jsxs(Root$c, {
7028
5688
  "data-ui": "TextInput",
7029
- tone: rootTheme.tone,
5689
+ tone,
7030
5690
  children: [prefixNode, /* @__PURE__ */jsxs(InputRoot, {
7031
5691
  children: [/* @__PURE__ */jsx(Input, {
7032
5692
  "data-as": "input",
7033
- "data-scheme": rootTheme.scheme,
7034
- "data-tone": rootTheme.tone,
5693
+ "data-tone": tone,
7035
5694
  ...restProps,
7036
5695
  $fontSize: fontSize,
7037
5696
  $iconLeft: $hasIcon,
7038
5697
  $iconRight: $hasIconRight || $hasClearButton,
7039
5698
  $padding: padding,
7040
- $scheme: rootTheme.scheme,
7041
5699
  $space: space,
7042
- $tone: rootTheme.tone,
5700
+ $tone: tone,
7043
5701
  $weight: weight,
7044
5702
  disabled,
7045
5703
  readOnly,
@@ -7086,8 +5744,8 @@ var __template$f = (cooked, raw) => __freeze$f(__defProp$f(cooked, "raw", {
7086
5744
  }));
7087
5745
  var _a$f, _b$9, _c$4;
7088
5746
  const Root$b = styled.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"])));
7089
- const Border = styled.path(_b$9 || (_b$9 = __template$f(["\n fill: var(--card-shadow-outline-color);\n"])));
7090
- const Shape = styled.path(_c$4 || (_c$4 = __template$f(["\n fill: var(--card-bg-color);\n"])));
5747
+ const Border = styled.path(_b$9 || (_b$9 = __template$f(["\n fill: ", ";\n"])), cssVars.default["base-shadow-outline-color"]);
5748
+ const Shape = styled.path(_c$4 || (_c$4 = __template$f(["\n fill: ", ";\n"])), cssVars.mutable["bg-color"]);
7091
5749
  const TooltipArrow = forwardRef(function TooltipArrow2(props, ref) {
7092
5750
  const {
7093
5751
  ...restProps
@@ -7186,12 +5844,12 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
7186
5844
  mainAxis: 3
7187
5845
  }));
7188
5846
  ret.push(size$2({
7189
- apply(_ref22) {
5847
+ apply(_ref7) {
7190
5848
  let {
7191
5849
  availableWidth,
7192
5850
  availableHeight,
7193
5851
  elements
7194
- } = _ref22;
5852
+ } = _ref7;
7195
5853
  Object.assign(elements.floating.style, {
7196
5854
  maxWidth: "".concat(availableWidth - 4 * 2, "px"),
7197
5855
  // the padding is `4px`
@@ -7497,10 +6155,10 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete2(props, ref) {
7497
6155
  query,
7498
6156
  value
7499
6157
  } = state;
7500
- const defaultRenderOption = useCallback(_ref23 => {
6158
+ const defaultRenderOption = useCallback(_ref8 => {
7501
6159
  let {
7502
6160
  value: value2
7503
- } = _ref23;
6161
+ } = _ref8;
7504
6162
  return /* @__PURE__ */jsx(Card, {
7505
6163
  "data-as": "button",
7506
6164
  padding: paddingProp,
@@ -7954,11 +6612,7 @@ const Breadcrumbs = forwardRef(function Breadcrumbs2(props, ref) {
7954
6612
  });
7955
6613
  });
7956
6614
  const BORDER_OFFSET_X = 12;
7957
- function dialogStyle(_ref24) {
7958
- let {
7959
- theme
7960
- } = _ref24;
7961
- const color = theme.sanity.color.base;
6615
+ function dialogStyle() {
7962
6616
  return {
7963
6617
  "&:not([hidden])": {
7964
6618
  display: "flex"
@@ -7970,7 +6624,7 @@ function dialogStyle(_ref24) {
7970
6624
  alignItems: "center",
7971
6625
  justifyContent: "center",
7972
6626
  outline: "none",
7973
- background: color.shadow.umbra
6627
+ background: cssVars.default["base-shadow-umbra-color"]
7974
6628
  };
7975
6629
  }
7976
6630
  function responsiveDialogPositionStyle(props) {
@@ -8008,9 +6662,9 @@ const Root$7 = styled(Layer)(responsivePaddingStyle, dialogStyle, responsiveDial
8008
6662
  const DialogContainer = styled(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"])));
8009
6663
  const DialogCardRoot = styled(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"])));
8010
6664
  const DialogLayout = styled(Flex)(_c$2 || (_c$2 = __template$b(["\n flex: 1;\n min-height: 0;\n width: 100%;\n"])));
8011
- const DialogHeader = styled(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);
6665
+ const DialogHeader = styled(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);
8012
6666
  const DialogContent = styled(Box)(_e || (_e = __template$b(["\n position: relative;\n z-index: 1;\n overflow: auto;\n outline: none;\n"])));
8013
- const DialogFooter = styled(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);
6667
+ const DialogFooter = styled(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);
8014
6668
  const DialogCard = forwardRef(function DialogCard2(props, ref) {
8015
6669
  var _a2;
8016
6670
  const {
@@ -8752,7 +7406,7 @@ var __template$8 = (cooked, raw) => __freeze$8(__defProp$8(cooked, "raw", {
8752
7406
  value: __freeze$8(raw || cooked.slice())
8753
7407
  }));
8754
7408
  var _a$8;
8755
- const MenuDivider = styled.hr(_a$8 || (_a$8 = __template$8(["\n height: 1px;\n border: 0;\n background: var(--card-hairline-soft-color);\n margin: 0;\n"])));
7409
+ const MenuDivider = styled.hr(_a$8 || (_a$8 = __template$8(["\n height: 1px;\n border: 0;\n background: ", ";\n margin: 0;\n"])), cssVars.default["border-base"]);
8756
7410
  var __freeze$7 = Object.freeze;
8757
7411
  var __defProp$7 = Object.defineProperty;
8758
7412
  var __template$7 = (cooked, raw) => __freeze$7(__defProp$7(cooked, "raw", {
@@ -8765,16 +7419,11 @@ function selectableBaseStyle() {
8765
7419
  function selectableColorStyle(props) {
8766
7420
  var _a2, _b2;
8767
7421
  const {
7422
+ theme,
8768
7423
  $tone,
8769
- theme
7424
+ $scheme
8770
7425
  } = props;
8771
- const {
8772
- base,
8773
- muted,
8774
- selectable
8775
- } = theme.sanity.color;
8776
- const tone = selectable ? selectable[$tone] || selectable.default : muted[$tone] || muted.default;
8777
- return 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);
7426
+ return 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 &:active {\n ", "\n }\n }\n }\n }\n }\n\n ", "\n "])), $tone !== "default" && createCssVars($scheme, theme.sanity.color.tones, $tone), _selectableVarStyle($tone), cssVars.mutable["bg-color"], cssVars[$tone]["text-secondary"], _selectableVarStyleDisabled(), _colorVarStyleHover(), _colorVarStyleHover(), _colorVarStyleHover(), _colorVarStyleHover(), _selectableVarStyleDisabled(), _colorVarStyleHover(), _colorVarStyleHover(), _colorVarStyleHover(), _colorVarStyleHover(), (_b2 = (_a2 = theme.sanity.styles) == null ? void 0 : _a2.card) == null ? void 0 : _b2.root);
8778
7427
  }
8779
7428
  const Selectable = styled(Box)(responsiveRadiusStyle, selectableBaseStyle, selectableColorStyle);
8780
7429
  function useMenu() {
@@ -8791,7 +7440,7 @@ function MenuGroup(props) {
8791
7440
  const {
8792
7441
  as = "button",
8793
7442
  children,
8794
- fontSize,
7443
+ fontSize = 1,
8795
7444
  icon,
8796
7445
  onClick,
8797
7446
  padding = 3,
@@ -8802,6 +7451,9 @@ function MenuGroup(props) {
8802
7451
  tone = "default",
8803
7452
  ...restProps
8804
7453
  } = props;
7454
+ const {
7455
+ scheme
7456
+ } = useToneContext();
8805
7457
  const menu = useMenu();
8806
7458
  const {
8807
7459
  activeElement,
@@ -8891,34 +7543,31 @@ function MenuGroup(props) {
8891
7543
  "data-selected": !withinMenu && active ? "" : void 0,
8892
7544
  $radius: useArrayProp(radius),
8893
7545
  $tone: tone,
7546
+ $scheme: scheme,
8894
7547
  onClick: handleClick,
8895
7548
  onKeyDown: handleKeyDown,
8896
7549
  onMouseEnter: handleMouseEnter,
8897
7550
  ref: setRootElement,
8898
7551
  tabIndex: -1,
8899
7552
  type: as === "button" ? "button" : void 0,
8900
- children: /* @__PURE__ */jsx(Box, {
7553
+ children: /* @__PURE__ */jsxs(Flex, {
7554
+ gap: space,
8901
7555
  padding,
8902
- children: /* @__PURE__ */jsxs(Flex, {
8903
- children: [icon && /* @__PURE__ */jsxs(Text, {
7556
+ children: [icon && /* @__PURE__ */jsxs(Text, {
7557
+ size: fontSize,
7558
+ children: [isValidElement(icon) && icon, isValidElementType(icon) && createElement(icon)]
7559
+ }), /* @__PURE__ */jsx(Box, {
7560
+ flex: 1,
7561
+ children: /* @__PURE__ */jsx(Text, {
8904
7562
  size: fontSize,
8905
- children: [isValidElement(icon) && icon, isValidElementType(icon) && createElement(icon)]
8906
- }), /* @__PURE__ */jsx(Box, {
8907
- flex: 1,
8908
- marginLeft: icon ? space : void 0,
8909
- children: /* @__PURE__ */jsx(Text, {
8910
- size: fontSize,
8911
- textOverflow: "ellipsis",
8912
- children: text
8913
- })
8914
- }), /* @__PURE__ */jsx(Box, {
8915
- marginLeft: space,
8916
- children: /* @__PURE__ */jsx(Text, {
8917
- size: fontSize,
8918
- children: /* @__PURE__ */jsx(ChevronRightIcon, {})
8919
- })
8920
- })]
8921
- })
7563
+ textOverflow: "ellipsis",
7564
+ weight: "medium",
7565
+ children: text
7566
+ })
7567
+ }), /* @__PURE__ */jsx(Text, {
7568
+ size: fontSize,
7569
+ children: /* @__PURE__ */jsx(ChevronRightIcon, {})
7570
+ })]
8922
7571
  })
8923
7572
  })
8924
7573
  });
@@ -8948,6 +7597,9 @@ const MenuItem = forwardRef(function MenuItem2(props, forwardedRef) {
8948
7597
  tone = "default",
8949
7598
  ...restProps
8950
7599
  } = props;
7600
+ const {
7601
+ scheme
7602
+ } = useToneContext();
8951
7603
  const menu = useMenu();
8952
7604
  const {
8953
7605
  activeElement,
@@ -8988,7 +7640,8 @@ const MenuItem = forwardRef(function MenuItem2(props, forwardedRef) {
8988
7640
  forwardedAs: as,
8989
7641
  $radius: useArrayProp(radius),
8990
7642
  $padding: useArrayProp(0),
8991
- $tone: tone,
7643
+ $tone: disabled ? "default" : tone,
7644
+ $scheme: scheme,
8992
7645
  disabled,
8993
7646
  onClick: handleClick,
8994
7647
  onMouseEnter: onItemMouseEnter,
@@ -8997,38 +7650,33 @@ const MenuItem = forwardRef(function MenuItem2(props, forwardedRef) {
8997
7650
  role: "menuitem",
8998
7651
  tabIndex: -1,
8999
7652
  type: as === "button" ? "button" : void 0,
9000
- children: [(icon || text || iconRight) && /* @__PURE__ */jsx(Box, {
7653
+ children: [(icon || text || iconRight) && /* @__PURE__ */jsxs(Flex, {
9001
7654
  as: "span",
7655
+ gap: space,
7656
+ align: "center",
9002
7657
  ...paddingProps,
9003
- children: /* @__PURE__ */jsxs(Flex, {
9004
- as: "span",
9005
- children: [icon && /* @__PURE__ */jsxs(Text, {
9006
- size: fontSize,
9007
- children: [isValidElement(icon) && icon, isValidElementType(icon) && createElement(icon)]
9008
- }), text && /* @__PURE__ */jsx(Box, {
9009
- flex: 1,
9010
- marginLeft: icon ? space : void 0,
9011
- marginRight: iconRight ? space : void 0,
9012
- children: /* @__PURE__ */jsx(Text, {
9013
- size: fontSize,
9014
- textOverflow: "ellipsis",
9015
- children: text
9016
- })
9017
- }), hotkeys && /* @__PURE__ */jsx(Box, {
9018
- marginLeft: space,
9019
- style: {
9020
- marginTop: -4,
9021
- marginBottom: -4
9022
- },
9023
- children: /* @__PURE__ */jsx(Hotkeys, {
9024
- fontSize,
9025
- keys: hotkeys
9026
- })
9027
- }), iconRight && /* @__PURE__ */jsxs(Text, {
7658
+ children: [icon && /* @__PURE__ */jsxs(Text, {
7659
+ size: fontSize,
7660
+ children: [isValidElement(icon) && icon, isValidElementType(icon) && createElement(icon)]
7661
+ }), text && /* @__PURE__ */jsx(Box, {
7662
+ flex: 1,
7663
+ children: /* @__PURE__ */jsx(Text, {
9028
7664
  size: fontSize,
9029
- children: [isValidElement(iconRight) && iconRight, isValidElementType(iconRight) && createElement(iconRight)]
9030
- })]
9031
- })
7665
+ textOverflow: "ellipsis",
7666
+ weight: "medium",
7667
+ children: text
7668
+ })
7669
+ }), hotkeys && /* @__PURE__ */jsx(Hotkeys, {
7670
+ fontSize,
7671
+ keys: hotkeys,
7672
+ style: {
7673
+ marginTop: -4,
7674
+ marginBottom: -4
7675
+ }
7676
+ }), iconRight && /* @__PURE__ */jsxs(Text, {
7677
+ size: fontSize,
7678
+ children: [isValidElement(iconRight) && iconRight, isValidElementType(iconRight) && createElement(iconRight)]
7679
+ })]
9032
7680
  }), children && /* @__PURE__ */jsx(Box, {
9033
7681
  as: "span",
9034
7682
  ...paddingProps,
@@ -9043,18 +7691,18 @@ var __template$6 = (cooked, raw) => __freeze$6(__defProp$6(cooked, "raw", {
9043
7691
  }));
9044
7692
  var _a$6, _b$3, _c$1, _d;
9045
7693
  const keyframe = keyframes(_a$6 || (_a$6 = __template$6(["\n 0% {\n background-position: 100%;\n }\n 100% {\n background-position: -100%;\n }\n"])));
9046
- const animation = 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);
9047
- const skeletonStyle = 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 => {
7694
+ const animation = 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);
7695
+ const skeletonStyle = 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 => {
9048
7696
  let {
9049
7697
  $visible
9050
- } = _ref25;
7698
+ } = _ref9;
9051
7699
  return $visible ? 1 : 0;
9052
- }, _ref26 => {
7700
+ }, _ref10 => {
9053
7701
  let {
9054
7702
  $animated
9055
- } = _ref26;
9056
- return $animated ? animation : css(_c$1 || (_c$1 = __template$6(["\n background-color: var(--card-skeleton-color-from);\n "])));
9057
- });
7703
+ } = _ref10;
7704
+ return $animated ? animation : css(_c$1 || (_c$1 = __template$6(["\n background-color: ", ";\n "])), cssVars.default["skeleton-from"]);
7705
+ }, cssVars.default["skeleton-from"]);
9058
7706
  const Root$4 = styled(Box)(responsiveRadiusStyle, skeletonStyle);
9059
7707
  const Skeleton = forwardRef(function Skeleton2(props, ref) {
9060
7708
  const {
@@ -9083,12 +7731,12 @@ const Skeleton = forwardRef(function Skeleton2(props, ref) {
9083
7731
  ref
9084
7732
  });
9085
7733
  });
9086
- const Root$3 = styled(Skeleton)(_ref27 => {
7734
+ const Root$3 = styled(Skeleton)(_ref11 => {
9087
7735
  let {
9088
7736
  $size,
9089
7737
  $style,
9090
7738
  theme
9091
- } = _ref27;
7739
+ } = _ref11;
9092
7740
  const {
9093
7741
  media
9094
7742
  } = theme.sanity;
@@ -9436,12 +8084,12 @@ function ToastProvider(props) {
9436
8084
  paddingY,
9437
8085
  children: /* @__PURE__ */jsx(AnimatePresence, {
9438
8086
  initial: false,
9439
- children: state.map(_ref28 => {
8087
+ children: state.map(_ref12 => {
9440
8088
  let {
9441
8089
  dismiss,
9442
8090
  id,
9443
8091
  params
9444
- } = _ref28;
8092
+ } = _ref12;
9445
8093
  return /* @__PURE__ */jsx(motion.div, {
9446
8094
  animate: {
9447
8095
  opacity: 1,
@@ -9734,18 +8382,8 @@ var _a$1, _b, _c;
9734
8382
  function treeItemRootStyle() {
9735
8383
  return 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 "])));
9736
8384
  }
9737
- function treeItemRootColorStyle(props) {
9738
- const {
9739
- theme
9740
- } = props;
9741
- const $tone = "default";
9742
- const {
9743
- base,
9744
- muted,
9745
- selectable
9746
- } = theme.sanity.color;
9747
- const tone = selectable ? selectable[$tone] || selectable.default : muted[$tone] || muted.default;
9748
- return 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));
8385
+ function treeItemRootColorStyle() {
8386
+ return 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());
9749
8387
  }
9750
8388
  function treeItemBoxStyle(props) {
9751
8389
  const {
@@ -9941,5 +8579,5 @@ const TreeItem = memo(function TreeItem2(props) {
9941
8579
  })]
9942
8580
  });
9943
8581
  });
9944
- export { Autocomplete, Avatar, AvatarCounter, AvatarStack, Badge, BoundaryElementProvider, Box, Breadcrumbs, Button, Card, Checkbox, Code, CodeSkeleton, Container, Dialog, DialogContext, DialogProvider, ElementQuery, ErrorBoundary, Flex, Grid, Heading, HeadingSkeleton, Hotkeys, Inline, KBD, Label, LabelSkeleton, Layer, LayerProvider, Menu, MenuButton, MenuDivider, MenuGroup, MenuItem, Popover, Portal, PortalProvider, Radio, Select, Skeleton, Spinner, SrOnly, Stack, Switch, Tab, TabList, TabPanel, Text, TextArea, TextInput, TextSkeleton, ThemeColorProvider, ThemeProvider, Toast, ToastProvider, Tooltip, TooltipDelayGroupContext, TooltipDelayGroupProvider, Tree, TreeItem, VirtualList, _ResizeObserver, _elementSizeObserver, _fillCSSObject, _getArrayProp, _getResponsiveSpace, _hasFocus, _isEnterToClickElement, _isScrollable, _raf, _raf2, _responsive, attemptFocus, containsOrEqualsElement, createColorTheme, focusFirstDescendant, focusLastDescendant, hexToRgb, hslToRgb, isFocusable, isHTMLAnchorElement, isHTMLButtonElement, isHTMLElement, isHTMLInputElement, isHTMLSelectElement, isHTMLTextAreaElement, multiply$1 as multiply, parseColor, rem, responsiveCodeFontStyle, responsiveHeadingFont, responsiveLabelFont, responsiveTextAlignStyle, responsiveTextFont, rgbToHex, rgbToHsl, rgba, screen$1 as screen, studioTheme, useArrayProp, useBoundaryElement, useClickOutside, useCustomValidity, useDialog, useElementRect, useElementSize, useForwardedRef, useGlobalKeyDown, useLayer, useMediaIndex, usePortal, usePrefersDark, usePrefersReducedMotion, useRootTheme, useTheme, useToast, useTooltipDelayGroup, useTree };
8582
+ export { Autocomplete, Avatar, AvatarCounter, AvatarStack, Badge, BoundaryElementProvider, Box, Breadcrumbs, Button, Card, Checkbox, Code, CodeSkeleton, Container, Dialog, DialogContext, DialogProvider, ElementQuery, ErrorBoundary, Flex, Grid, Heading, HeadingSkeleton, Hotkeys, Inline, KBD, Label, LabelSkeleton, Layer, LayerProvider, Menu, MenuButton, MenuDivider, MenuGroup, MenuItem, Popover, Portal, PortalProvider, Radio, Select, Skeleton, Spinner, SrOnly, Stack, Switch, Tab, TabList, TabPanel, Text, TextArea, TextInput, TextSkeleton, ThemeColorProvider, ThemeProvider, Toast, ToastProvider, Tooltip, TooltipDelayGroupContext, TooltipDelayGroupProvider, Tree, TreeItem, VirtualList, _ResizeObserver, _elementSizeObserver, _fillCSSObject, _getArrayProp, _getResponsiveSpace, _hasFocus, _isEnterToClickElement, _isScrollable, _raf, _raf2, _responsive, attemptFocus, containsOrEqualsElement, createCssVars, cssVars, focusFirstDescendant, focusLastDescendant, hexToRgb, hslToRgb, isFocusable, isHTMLAnchorElement, isHTMLButtonElement, isHTMLElement, isHTMLInputElement, isHTMLSelectElement, isHTMLTextAreaElement, multiply$1 as multiply, parseColor, rem, responsiveCodeFontStyle, responsiveHeadingFont, responsiveLabelFont, responsiveTextAlignStyle, responsiveTextFont, rgbToHex, rgbToHsl, rgba, rgbaToRGBA, screen$1 as screen, studioTheme, useArrayProp, useBoundaryElement, useClickOutside, useCustomValidity, useDialog, useElementRect, useElementSize, useForwardedRef, useGlobalKeyDown, useLayer, useMediaIndex, usePortal, usePrefersDark, usePrefersReducedMotion, useRootTheme, useTheme, useToast, useTooltipDelayGroup, useTree };
9945
8583
  //# sourceMappingURL=index.esm.js.map