@sanity/ui 2.0.0-alpha.2 → 2.0.0-alpha.21

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 (96) hide show
  1. package/dist/index.cjs.mjs +28 -0
  2. package/dist/index.d.ts +476 -12
  3. package/dist/index.esm.js +1326 -524
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/index.js +1353 -523
  6. package/dist/index.js.map +1 -1
  7. package/package.json +6 -8
  8. package/src/components/autocomplete/autocomplete.tsx +6 -0
  9. package/src/components/dialog/constants.ts +4 -0
  10. package/src/components/dialog/dialog.tsx +79 -15
  11. package/src/components/hotkeys/hotkeys.tsx +2 -0
  12. package/src/components/menu/menu.tsx +2 -0
  13. package/src/components/menu/menuButton.tsx +2 -0
  14. package/src/components/menu/menuGroup.tsx +22 -23
  15. package/src/components/menu/menuItem.tsx +29 -35
  16. package/src/components/tab/tab.tsx +4 -1
  17. package/src/components/toast/toast.tsx +4 -0
  18. package/src/primitives/_selectable/style.ts +2 -1
  19. package/src/primitives/avatar/avatar.tsx +16 -9
  20. package/src/primitives/avatar/avatarCounter.tsx +3 -3
  21. package/src/primitives/avatar/styles.ts +1 -1
  22. package/src/primitives/badge/badge.tsx +7 -3
  23. package/src/primitives/box/box.tsx +3 -0
  24. package/src/primitives/button/__workshop__/sanityUploadButton.tsx +2 -1
  25. package/src/primitives/button/button.tsx +7 -3
  26. package/src/primitives/button/styles.ts +9 -2
  27. package/src/primitives/card/card.tsx +4 -0
  28. package/src/primitives/card/styles.ts +2 -0
  29. package/src/primitives/checkbox/checkbox.tsx +2 -0
  30. package/src/primitives/code/code.tsx +1 -0
  31. package/src/primitives/container/container.tsx +2 -0
  32. package/src/primitives/flex/flex.tsx +2 -0
  33. package/src/primitives/grid/grid.tsx +2 -0
  34. package/src/primitives/heading/heading.tsx +2 -0
  35. package/src/primitives/inline/inline.tsx +3 -0
  36. package/src/primitives/kbd/kbd.tsx +2 -0
  37. package/src/primitives/label/label.tsx +2 -0
  38. package/src/primitives/popover/popover.tsx +6 -1
  39. package/src/primitives/radio/radio.tsx +2 -0
  40. package/src/primitives/select/select.tsx +2 -0
  41. package/src/primitives/select/styles.ts +2 -0
  42. package/src/primitives/spinner/spinner.tsx +2 -0
  43. package/src/primitives/stack/stack.tsx +2 -0
  44. package/src/primitives/switch/switch.tsx +4 -0
  45. package/src/primitives/text/text.tsx +3 -0
  46. package/src/primitives/textArea/textArea.tsx +4 -1
  47. package/src/primitives/textInput/textInput.tsx +10 -1
  48. package/src/primitives/tooltip/__workshop__/customPortal.tsx +99 -0
  49. package/src/primitives/tooltip/__workshop__/index.ts +15 -0
  50. package/src/primitives/tooltip/__workshop__/overflowingBoundary.tsx +73 -0
  51. package/src/primitives/tooltip/__workshop__/resizableBoundary.tsx +85 -0
  52. package/src/primitives/tooltip/constants.ts +1 -0
  53. package/src/primitives/tooltip/tooltip.test.tsx +192 -0
  54. package/src/primitives/tooltip/tooltip.tsx +109 -33
  55. package/src/primitives/types.ts +4 -0
  56. package/src/styles/input/textInputStyle.ts +11 -6
  57. package/src/theme/_internal/__workshop__/build/story.tsx +288 -0
  58. package/src/theme/_internal/__workshop__/build/theme.ts +3 -0
  59. package/src/theme/_internal/__workshop__/index.ts +14 -0
  60. package/src/theme/_internal/build/buildTheme.test.ts +78 -0
  61. package/src/theme/_internal/build/buildTheme.ts +16 -0
  62. package/src/theme/_internal/build/colorTheme/buildColorTheme.test.ts +185 -0
  63. package/src/theme/_internal/build/colorTheme/buildColorTheme.ts +164 -0
  64. package/src/theme/_internal/build/colorTheme/renderColorTheme.ts +242 -0
  65. package/src/theme/_internal/build/colorTheme/resolveColorTokens.ts +121 -0
  66. package/src/theme/_internal/build/defaults/colorPalette.ts +8 -0
  67. package/src/theme/_internal/build/defaults/colorTokens.ts +147 -0
  68. package/src/theme/_internal/build/helpers.ts +65 -0
  69. package/src/theme/_internal/build/index.ts +1 -0
  70. package/src/theme/_internal/config/helpers.ts +47 -0
  71. package/src/theme/_internal/config/index.ts +3 -0
  72. package/src/theme/_internal/config/token/index.ts +2 -0
  73. package/src/theme/_internal/config/token/parseTokenKey.test.ts +72 -0
  74. package/src/theme/_internal/config/token/parseTokenKey.ts +88 -0
  75. package/src/theme/_internal/config/token/parseTokenValue.test.ts +45 -0
  76. package/src/theme/_internal/config/token/parseTokenValue.ts +123 -0
  77. package/src/theme/_internal/config/types.ts +137 -0
  78. package/src/theme/_internal/constants.ts +48 -0
  79. package/src/theme/_internal/helpers.ts +19 -0
  80. package/src/theme/_internal/index.ts +5 -0
  81. package/src/theme/_internal/types.ts +91 -0
  82. package/src/theme/index.ts +1 -0
  83. package/src/theme/lib/color-fns/blend/multiply.ts +2 -2
  84. package/src/theme/lib/color-fns/blend/screen.ts +2 -2
  85. package/src/theme/lib/color-fns/convert.ts +15 -1
  86. package/src/theme/lib/color-fns/parse.ts +7 -3
  87. package/src/theme/lib/color-fns/types.ts +11 -0
  88. package/src/theme/lib/theme/avatar.ts +2 -0
  89. package/src/theme/lib/theme/color/_legacy/createColorTheme.ts +7 -0
  90. package/src/theme/lib/theme/color/_legacy/index.ts +1 -0
  91. package/src/theme/lib/theme/color/_legacy/legacyColor.ts +3997 -0
  92. package/src/theme/studioTheme/color.ts +98 -82
  93. package/src/theme/studioTheme/helpers.ts +15 -1
  94. package/src/theme/studioTheme/theme.ts +5 -5
  95. package/src/theme/studioTheme/tints.ts +244 -84
  96. package/src/types/button.ts +5 -0
package/dist/index.esm.js CHANGED
@@ -2,10 +2,10 @@ 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
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';
5
+ import { color as color$1, white as white$1, black as black$1, hues } 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
- import { detectOverflow, flip, offset, shift, arrow, hide, useFloating, autoUpdate, size as size$2 } from '@floating-ui/react-dom';
8
+ import { detectOverflow, flip, offset, shift, arrow, hide, useFloating, autoUpdate } from '@floating-ui/react-dom';
9
9
  import { createPortal } from 'react-dom';
10
10
  import { AnimatePresence, motion } from 'framer-motion';
11
11
  const EMPTY_ARRAY = [];
@@ -721,7 +721,7 @@ var ResizeObserverController = function () {
721
721
  };
722
722
  return ResizeObserverController;
723
723
  }();
724
- var ResizeObserver = function () {
724
+ var ResizeObserver$1 = function () {
725
725
  function ResizeObserver(callback) {
726
726
  if (arguments.length === 0) {
727
727
  throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");
@@ -757,7 +757,7 @@ var ResizeObserver = function () {
757
757
  };
758
758
  return ResizeObserver;
759
759
  }();
760
- const _ResizeObserver = typeof document !== "undefined" && typeof window !== "undefined" && window.ResizeObserver ? window.ResizeObserver : ResizeObserver;
760
+ const _ResizeObserver = typeof document !== "undefined" && typeof window !== "undefined" && window.ResizeObserver ? window.ResizeObserver : ResizeObserver$1;
761
761
  const _elementSizeObserver = _createElementSizeObserver();
762
762
  function _createElementRectValueListener() {
763
763
  return {
@@ -831,10 +831,166 @@ function useGlobalKeyDown(onKeyDown) {
831
831
  return () => removeEventListener("keydown", onKeyDown);
832
832
  }, [onKeyDown]);
833
833
  }
834
+ const COLOR_HUES = ["gray", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow", "green"];
835
+ const COLOR_TINTS = ["50", "100", "200", "300", "400", "500", "600", "700", "800", "900", "950"];
836
+ const COLOR_BASE_TONES = ["transparent", "default", "primary",
837
+ // todo: rename to `accent`
838
+ "positive", "caution", "critical"];
839
+ const COLOR_STATE_TONES = ["default", "primary",
840
+ // todo: rename to `accent`
841
+ "positive", "caution", "critical"];
842
+ const COLOR_STATES = ["enabled", "hovered", "pressed", "selected", "disabled"];
843
+ const COLOR_BUTTON_MODES = ["default", "ghost", "bleed"];
844
+ const COLOR_BLEND_MODES = ["multiply", "screen"];
845
+ const defaultColorTokens = {
846
+ "*": {
847
+ _blend: ["multiply", "screen"],
848
+ bg: ["50", "950"],
849
+ fg: ["800", "200"],
850
+ border: ["200", "800"],
851
+ focusRing: ["cyan/500", "cyan/500"],
852
+ shadow: {
853
+ outline: ["500/0.25", "400/0.3"],
854
+ umbra: ["500/0.1", "black/0.4"],
855
+ penumbra: ["500/0.07", "black/0.28"],
856
+ ambient: ["500/0.06", "black/0.24"]
857
+ },
858
+ skeleton: {
859
+ from: ["100", "900"],
860
+ to: ["100/0.5", "900/0.5"]
861
+ }
862
+ },
863
+ transparent: {
864
+ bg: ["50", "black"],
865
+ fg: ["600", "400"]
866
+ },
867
+ default: {
868
+ bg: ["white", "950"],
869
+ fg: ["black", "200"]
870
+ },
871
+ primary: {
872
+ _hue: "cyan"
873
+ },
874
+ positive: {
875
+ _hue: "cyan"
876
+ },
877
+ caution: {
878
+ _hue: "yellow"
879
+ },
880
+ critical: {
881
+ _hue: "red"
882
+ },
883
+ button: {
884
+ "*": {
885
+ default: {
886
+ "*": {
887
+ _blend: ["screen", "multiply"],
888
+ bg: ["500", "400"],
889
+ bg2: ["950", "50"],
890
+ border: ["500/0", "400/0"],
891
+ muted: {
892
+ fg: ["200", "700"]
893
+ }
894
+ },
895
+ hovered: {
896
+ bg: ["600", "300"],
897
+ border: ["600/0", "300/0"]
898
+ },
899
+ pressed: {
900
+ bg: ["700", "200"]
901
+ },
902
+ selected: {
903
+ bg: ["700", "200"]
904
+ },
905
+ disabled: {
906
+ _hue: "gray",
907
+ bg: ["200", "900"]
908
+ }
909
+ },
910
+ ghost: {
911
+ "*": {
912
+ _blend: ["multiply", "screen"],
913
+ bg: ["white", "black"],
914
+ bg2: ["50", "950"],
915
+ fg: ["600", "400"],
916
+ border: ["200", "800"],
917
+ muted: {
918
+ fg: ["600/0.6", "400/0.6"]
919
+ }
920
+ },
921
+ hovered: {
922
+ bg: ["50", "950"],
923
+ fg: ["700", "300"]
924
+ },
925
+ pressed: {
926
+ bg: ["100", "900"],
927
+ fg: ["800", "200"]
928
+ },
929
+ selected: {
930
+ bg: ["100", "900"],
931
+ fg: ["800", "200"]
932
+ },
933
+ disabled: {
934
+ _hue: "gray",
935
+ fg: ["200", "900"],
936
+ border: ["100", "950"]
937
+ }
938
+ },
939
+ bleed: {
940
+ "*": {
941
+ _blend: ["multiply", "screen"],
942
+ bg: ["white", "black"],
943
+ bg2: ["50", "950"],
944
+ fg: ["600", "400"],
945
+ border: ["white/0", "black/0"],
946
+ muted: {
947
+ fg: ["600/0.6", "400/0.6"]
948
+ }
949
+ },
950
+ hovered: {
951
+ bg: ["50", "950"],
952
+ fg: ["700", "300"]
953
+ },
954
+ pressed: {
955
+ bg: ["100", "900"],
956
+ fg: ["800", "200"]
957
+ },
958
+ selected: {
959
+ bg: ["100", "900"],
960
+ fg: ["800", "200"]
961
+ },
962
+ disabled: {
963
+ _hue: "gray",
964
+ fg: ["200", "900"]
965
+ }
966
+ }
967
+ },
968
+ default: {
969
+ default: {
970
+ "*": {
971
+ bg: ["900", "200"]
972
+ },
973
+ hovered: {
974
+ bg: ["black", "100"]
975
+ },
976
+ pressed: {
977
+ bg: ["900", "200"]
978
+ },
979
+ selected: {
980
+ bg: ["black", "200"]
981
+ },
982
+ disabled: {
983
+ _hue: "gray",
984
+ bg: ["200", "900"]
985
+ }
986
+ }
987
+ }
988
+ }
989
+ };
834
990
  function multiplyChannel(b, s) {
835
991
  return b * s;
836
992
  }
837
- function multiply$1(b, s) {
993
+ function multiply$2(b, s) {
838
994
  return {
839
995
  r: Math.round(clamp$1(multiplyChannel(b.r / 255, s.r / 255) * 255)),
840
996
  g: Math.round(clamp$1(multiplyChannel(b.g / 255, s.g / 255) * 255)),
@@ -847,7 +1003,7 @@ function clamp$1(num) {
847
1003
  function screenChannel(b, s) {
848
1004
  return b + s - b * s;
849
1005
  }
850
- function screen$1(b, s) {
1006
+ function screen$2(b, s) {
851
1007
  return {
852
1008
  r: Math.round(clamp(screenChannel(b.r / 255, s.r / 255) * 255)),
853
1009
  g: Math.round(clamp(screenChannel(b.g / 255, s.g / 255) * 255)),
@@ -874,6 +1030,15 @@ function hexToRgb(hex) {
874
1030
  b: parseInt(hex.slice(5, 7), 16)
875
1031
  };
876
1032
  }
1033
+ function rgbaToRGBA(rgba) {
1034
+ const values = rgba.replace(/rgba\(|\)/g, "").split(",");
1035
+ return {
1036
+ r: parseInt(values[0]),
1037
+ g: parseInt(values[1]),
1038
+ b: parseInt(values[2]),
1039
+ a: parseFloat(values[3])
1040
+ };
1041
+ }
877
1042
  function rgbToHex(_ref2) {
878
1043
  let {
879
1044
  r,
@@ -991,12 +1156,658 @@ function parseColor(color) {
991
1156
  if (color.startsWith("hsl(")) {
992
1157
  return hslToRgb(parseHsl(color));
993
1158
  }
1159
+ if (color.startsWith("rgba(")) {
1160
+ return rgbaToRGBA(color);
1161
+ }
994
1162
  throw new Error('parseColor: unexpected color format: "'.concat(color, '"'));
995
1163
  }
996
1164
  function rgba(color, a) {
997
1165
  const rgb = parseColor(color);
998
1166
  return "rgba(".concat(rgb.r, ",").concat(rgb.g, ",").concat(rgb.b, ",").concat(a, ")");
999
1167
  }
1168
+ function isColorBlendModeValue(str) {
1169
+ return COLOR_BLEND_MODES.includes(str);
1170
+ }
1171
+ function isColorHueValue(str) {
1172
+ return COLOR_HUES.includes(str);
1173
+ }
1174
+ function isColorTintValue(str) {
1175
+ return COLOR_TINTS.includes(str);
1176
+ }
1177
+ function isColorButtonMode(str) {
1178
+ return COLOR_BUTTON_MODES.includes(str);
1179
+ }
1180
+ function parseTokenKey(str) {
1181
+ const segments = str.split("/");
1182
+ const segment0 = segments.shift() || "";
1183
+ if (isColorConfigBaseTone(segment0)) {
1184
+ const key = segments.join("/");
1185
+ if (isColorConfigBaseKey(key)) {
1186
+ return {
1187
+ type: "base",
1188
+ tone: segment0,
1189
+ key
1190
+ };
1191
+ }
1192
+ if (isColorConfigBlendKey(key)) {
1193
+ return {
1194
+ type: "base",
1195
+ tone: segment0,
1196
+ key
1197
+ };
1198
+ }
1199
+ }
1200
+ if (segment0 === "button") {
1201
+ const segment1 = segments.shift() || "";
1202
+ if (isColorConfigStateTone(segment1)) {
1203
+ const segment2 = segments.shift() || "";
1204
+ if (isColorButtonMode(segment2)) {
1205
+ const key = segments.join("/");
1206
+ if (isColorConfigStateKey(key)) {
1207
+ return {
1208
+ type: "button",
1209
+ tone: segment1,
1210
+ mode: segment2,
1211
+ key
1212
+ };
1213
+ }
1214
+ if (isColorConfigBlendKey(key)) {
1215
+ return {
1216
+ type: "button",
1217
+ tone: segment1,
1218
+ mode: segment2,
1219
+ key
1220
+ };
1221
+ }
1222
+ }
1223
+ }
1224
+ }
1225
+ return void 0;
1226
+ }
1227
+ function parseTokenValue(str) {
1228
+ const segments = str.split("/");
1229
+ const segment0 = segments.shift() || "";
1230
+ if (isColorTintValue(segment0)) {
1231
+ const tint = segment0;
1232
+ const segment1 = segments.shift() || "";
1233
+ if (isColorOpacityValue(segment1)) {
1234
+ const opacity = Number(segment1);
1235
+ return {
1236
+ type: "color",
1237
+ tint,
1238
+ opacity
1239
+ };
1240
+ }
1241
+ return {
1242
+ type: "color",
1243
+ tint
1244
+ };
1245
+ }
1246
+ if (isColorValue(segment0)) {
1247
+ const key = segment0;
1248
+ const segment1 = segments.shift() || "";
1249
+ if (isColorOpacityValue(segment1)) {
1250
+ const opacity = Number(segment1);
1251
+ return {
1252
+ type: "color",
1253
+ key,
1254
+ opacity
1255
+ };
1256
+ }
1257
+ return {
1258
+ type: "color",
1259
+ key
1260
+ };
1261
+ }
1262
+ if (isColorHueValue(segment0)) {
1263
+ const hue = segment0;
1264
+ const segment1 = segments.shift() || "";
1265
+ if (isColorTintValue(segment1)) {
1266
+ const tint = segment1;
1267
+ const segment2 = segments.shift() || "";
1268
+ if (isColorOpacityValue(segment2)) {
1269
+ const opacity = Number(segment2);
1270
+ return {
1271
+ type: "color",
1272
+ key: "".concat(hue, "/").concat(tint),
1273
+ hue,
1274
+ tint,
1275
+ opacity
1276
+ };
1277
+ }
1278
+ return {
1279
+ type: "color",
1280
+ key: "".concat(hue, "/").concat(tint),
1281
+ hue,
1282
+ tint
1283
+ };
1284
+ }
1285
+ return {
1286
+ type: "hue",
1287
+ value: "".concat(hue)
1288
+ };
1289
+ }
1290
+ if (isColorOpacityValue(segment0)) {
1291
+ const opacity = Number(segment0);
1292
+ return {
1293
+ type: "color",
1294
+ opacity
1295
+ };
1296
+ }
1297
+ if (isColorBlendModeValue(segment0)) {
1298
+ const value = segment0;
1299
+ return {
1300
+ type: "blendMode",
1301
+ value
1302
+ };
1303
+ }
1304
+ return void 0;
1305
+ }
1306
+ const COLOR_CONFIG_BASE_TONES = ["*", ...COLOR_BASE_TONES];
1307
+ const COLOR_CONFIG_STATE_TONES = ["*", ...COLOR_STATE_TONES];
1308
+ const COLOR_CONFIG_BASE_KEYS = ["_hue", "bg", "fg", "border", "focusRing", "muted/fg", "link/fg", "code/bg", "code/fg", "shadow/outline", "shadow/umbra", "shadow/penumbra", "shadow/ambient", "skeleton/from", "skeleton/to"];
1309
+ const COLOR_CONFIG_STATE_KEYS = ["_hue", "bg", "fg", "border", "focusRing", "muted/fg", "link/fg", "code/bg", "code/fg", "skeleton/from", "skeleton/to"];
1310
+ const COLOR_CONFIG_BLEND_KEYS = ["_blend"];
1311
+ function isColorConfigBaseTone(str) {
1312
+ return COLOR_CONFIG_BASE_TONES.includes(str);
1313
+ }
1314
+ function isColorConfigBaseKey(str) {
1315
+ return COLOR_CONFIG_BASE_KEYS.includes(str);
1316
+ }
1317
+ function isColorConfigStateKey(str) {
1318
+ return COLOR_CONFIG_STATE_KEYS.includes(str);
1319
+ }
1320
+ function isColorConfigStateTone(str) {
1321
+ return COLOR_CONFIG_STATE_TONES.includes(str);
1322
+ }
1323
+ function isColorConfigBlendKey(str) {
1324
+ return COLOR_CONFIG_BLEND_KEYS.includes(str);
1325
+ }
1326
+ function isColorTokenValue(str) {
1327
+ var _a, _b;
1328
+ return ((_a = parseTokenValue(str)) == null ? void 0 : _a.type) === "color" || ((_b = parseTokenValue(str)) == null ? void 0 : _b.type) === "hue";
1329
+ }
1330
+ function isColorValue(str) {
1331
+ return str === "black" || str === "white";
1332
+ }
1333
+ function isColorOpacityValue(str) {
1334
+ return str === "0" || /^0\.[0-9]+$/.test(str) || str === "1";
1335
+ }
1336
+ function resolveColorTokenValue(context, value) {
1337
+ const {
1338
+ hue,
1339
+ scheme
1340
+ } = context;
1341
+ const node = parseTokenValue(value[scheme === "light" ? 0 : 1]);
1342
+ if (!node || node.type !== "color") {
1343
+ throw new Error("Invalid color token: ".concat(value[0]));
1344
+ }
1345
+ return compileColorTokenValue({
1346
+ ...node,
1347
+ hue: node.hue || hue
1348
+ });
1349
+ }
1350
+ function compileColorTokenValue(node) {
1351
+ let key = "";
1352
+ if (node.key === "black" || node.key === "white") {
1353
+ key = node.key;
1354
+ } else {
1355
+ key = "".concat(node.hue, "/").concat(node.tint);
1356
+ }
1357
+ if (node.opacity !== void 0) {
1358
+ key += "/".concat(node.opacity);
1359
+ }
1360
+ return key;
1361
+ }
1362
+ function multiply$1(bg, fg) {
1363
+ const b = parseColor(bg);
1364
+ const s = parseColor(fg);
1365
+ const hex = rgbToHex(multiply$2(b, s));
1366
+ if (s.a !== void 0) {
1367
+ return rgba(hex, s.a);
1368
+ }
1369
+ return hex;
1370
+ }
1371
+ function screen$1(bg, fg) {
1372
+ const b = parseColor(bg);
1373
+ const s = parseColor(fg);
1374
+ const hex = rgbToHex(screen$2(b, s));
1375
+ if (s.a !== void 0) {
1376
+ return rgba(hex, s.a);
1377
+ }
1378
+ return hex;
1379
+ }
1380
+ function resolveColorTokens(sparseTokens) {
1381
+ const denseTokens = {
1382
+ ...sparseTokens
1383
+ };
1384
+ for (const tone of COLOR_BASE_TONES) {
1385
+ denseTokens[tone] = resolveBaseColorTones(sparseTokens, tone);
1386
+ }
1387
+ denseTokens.button = resolveButtonColorTokens(sparseTokens);
1388
+ return denseTokens;
1389
+ }
1390
+ function resolveBaseColorTones(sparseTokens, tone) {
1391
+ const spec0 = sparseTokens == null ? void 0 : sparseTokens[tone];
1392
+ const spec1 = sparseTokens == null ? void 0 : sparseTokens["*"];
1393
+ return {
1394
+ ...spec1,
1395
+ ...spec0,
1396
+ shadow: {
1397
+ ...(spec1 == null ? void 0 : spec1.shadow),
1398
+ ...(spec0 == null ? void 0 : spec0.shadow)
1399
+ },
1400
+ skeleton: {
1401
+ ...(spec1 == null ? void 0 : spec1.skeleton),
1402
+ ...(spec0 == null ? void 0 : spec0.skeleton)
1403
+ }
1404
+ };
1405
+ }
1406
+ function resolveButtonColorTokens(sparseTokens) {
1407
+ const tokens = {};
1408
+ for (const tone of COLOR_STATE_TONES) {
1409
+ tokens[tone] = resolveButtonToneColorTokens(sparseTokens, tone);
1410
+ }
1411
+ return tokens;
1412
+ }
1413
+ function resolveButtonToneColorTokens(sparseTokens, tone) {
1414
+ var _a, _b;
1415
+ const tokens = {
1416
+ ...((_a = sparseTokens.button) == null ? void 0 : _a[tone]),
1417
+ ...((_b = sparseTokens.button) == null ? void 0 : _b["*"])
1418
+ };
1419
+ for (const mode of COLOR_BUTTON_MODES) {
1420
+ tokens[mode] = resolveButtonModeColorTokens(sparseTokens, tone, mode);
1421
+ }
1422
+ return tokens;
1423
+ }
1424
+ function resolveButtonModeColorTokens(sparseTokens, tone, mode) {
1425
+ var _a, _b, _c, _d;
1426
+ const spec0 = (_b = (_a = sparseTokens.button) == null ? void 0 : _a[tone]) == null ? void 0 : _b[mode];
1427
+ const spec1 = (_d = (_c = sparseTokens.button) == null ? void 0 : _c["*"]) == null ? void 0 : _d[mode];
1428
+ const tokens = {
1429
+ ...spec1,
1430
+ ...spec0
1431
+ };
1432
+ for (const state of COLOR_STATES) {
1433
+ tokens[state] = resolveButtonStateColorTokens(sparseTokens, tone, mode, state);
1434
+ }
1435
+ return tokens;
1436
+ }
1437
+ function resolveButtonStateColorTokens(tokens, tone, mode, state) {
1438
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
1439
+ const spec0 = (_c = (_b = (_a = tokens == null ? void 0 : tokens.button) == null ? void 0 : _a[tone]) == null ? void 0 : _b[mode]) == null ? void 0 : _c[state];
1440
+ const spec1 = (_f = (_e = (_d = tokens == null ? void 0 : tokens.button) == null ? void 0 : _d[tone]) == null ? void 0 : _e[mode]) == null ? void 0 : _f["*"];
1441
+ const spec2 = (_i = (_h = (_g = tokens == null ? void 0 : tokens.button) == null ? void 0 : _g["*"]) == null ? void 0 : _h[mode]) == null ? void 0 : _i[state];
1442
+ const spec3 = (_l = (_k = (_j = tokens == null ? void 0 : tokens.button) == null ? void 0 : _j["*"]) == null ? void 0 : _k[mode]) == null ? void 0 : _l["*"];
1443
+ const hue = (spec0 == null ? void 0 : spec0._hue) || (spec1 == null ? void 0 : spec1._hue) || (spec2 == null ? void 0 : spec2._hue) || (spec3 == null ? void 0 : spec3._hue) || ((_n = (_m = tokens == null ? void 0 : tokens.button) == null ? void 0 : _m[tone]) == null ? void 0 : _n._hue) || ((_o = tokens == null ? void 0 : tokens[tone]) == null ? void 0 : _o._hue);
1444
+ return {
1445
+ ...spec3,
1446
+ ...spec2,
1447
+ ...spec1,
1448
+ ...spec0,
1449
+ _hue: hue,
1450
+ muted: {
1451
+ ...(spec3 == null ? void 0 : spec3.muted),
1452
+ ...(spec2 == null ? void 0 : spec2.muted),
1453
+ ...(spec1 == null ? void 0 : spec1.muted),
1454
+ ...(spec0 == null ? void 0 : spec0.muted)
1455
+ },
1456
+ accent: {
1457
+ ...(spec3 == null ? void 0 : spec3.accent),
1458
+ ...(spec2 == null ? void 0 : spec2.accent),
1459
+ ...(spec1 == null ? void 0 : spec1.accent),
1460
+ ...(spec0 == null ? void 0 : spec0.accent)
1461
+ },
1462
+ link: {
1463
+ ...(spec3 == null ? void 0 : spec3.link),
1464
+ ...(spec2 == null ? void 0 : spec2.link),
1465
+ ...(spec1 == null ? void 0 : spec1.link),
1466
+ ...(spec0 == null ? void 0 : spec0.link)
1467
+ },
1468
+ code: {
1469
+ ...(spec3 == null ? void 0 : spec3.code),
1470
+ ...(spec2 == null ? void 0 : spec2.code),
1471
+ ...(spec1 == null ? void 0 : spec1.code),
1472
+ ...(spec0 == null ? void 0 : spec0.code)
1473
+ },
1474
+ skeleton: {
1475
+ ...(spec3 == null ? void 0 : spec3.skeleton),
1476
+ ...(spec2 == null ? void 0 : spec2.skeleton),
1477
+ ...(spec1 == null ? void 0 : spec1.skeleton),
1478
+ ...(spec0 == null ? void 0 : spec0.skeleton)
1479
+ }
1480
+ };
1481
+ }
1482
+ function buildColorTheme(options, config) {
1483
+ var _a, _b;
1484
+ const {
1485
+ scheme
1486
+ } = options;
1487
+ const resolvedConfig = {
1488
+ ...config,
1489
+ color: {
1490
+ ...(config == null ? void 0 : config.color),
1491
+ tokens: resolveColorTokens((_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.tokens) != null ? _b : defaultColorTokens)
1492
+ }
1493
+ };
1494
+ return {
1495
+ transparent: buildBaseColorTheme({
1496
+ scheme,
1497
+ tone: "transparent"
1498
+ }, resolvedConfig),
1499
+ default: buildBaseColorTheme({
1500
+ scheme,
1501
+ tone: "default"
1502
+ }, resolvedConfig),
1503
+ primary: buildBaseColorTheme({
1504
+ scheme,
1505
+ tone: "primary"
1506
+ }, resolvedConfig),
1507
+ positive: buildBaseColorTheme({
1508
+ scheme,
1509
+ tone: "positive"
1510
+ }, resolvedConfig),
1511
+ caution: buildBaseColorTheme({
1512
+ scheme,
1513
+ tone: "caution"
1514
+ }, resolvedConfig),
1515
+ critical: buildBaseColorTheme({
1516
+ scheme,
1517
+ tone: "critical"
1518
+ }, resolvedConfig)
1519
+ };
1520
+ }
1521
+ function buildBaseColorTheme(options, config) {
1522
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1523
+ const {
1524
+ scheme,
1525
+ tone
1526
+ } = options;
1527
+ const tokens = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.tokens) == null ? void 0 : _b[tone];
1528
+ const hue = (tokens == null ? void 0 : tokens._hue) || "gray";
1529
+ const context = {
1530
+ hue,
1531
+ scheme
1532
+ };
1533
+ const bg = resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.bg) || ["gray/50", "black"]);
1534
+ const blendMode = (tokens == null ? void 0 : tokens._blend) || ["screen", "multiply"];
1535
+ return {
1536
+ _blend: blendMode[scheme === "light" ? 0 : 1],
1537
+ dark: scheme === "dark",
1538
+ base: {
1539
+ bg,
1540
+ fg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.fg) || ["black", "white"]),
1541
+ border: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.border) || ["black", "white"]),
1542
+ focusRing: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.focusRing) || ["black", "white"]),
1543
+ shadow: {
1544
+ outline: resolveColorTokenValue(context, ((_c = tokens == null ? void 0 : tokens.shadow) == null ? void 0 : _c.outline) || ["500/0.2", "500/0.2"]),
1545
+ umbra: resolveColorTokenValue(context, ((_d = tokens == null ? void 0 : tokens.shadow) == null ? void 0 : _d.umbra) || ["500/0.2", "500/0.2"]),
1546
+ penumbra: resolveColorTokenValue(context, ((_e = tokens == null ? void 0 : tokens.shadow) == null ? void 0 : _e.penumbra) || ["500/0.2", "500/0.2"]),
1547
+ ambient: resolveColorTokenValue(context, ((_f = tokens == null ? void 0 : tokens.shadow) == null ? void 0 : _f.ambient) || ["500/0.2", "500/0.2"])
1548
+ },
1549
+ skeleton: {
1550
+ from: resolveColorTokenValue(context, ((_g = tokens == null ? void 0 : tokens.skeleton) == null ? void 0 : _g.from) || ["500/0.2", "500/0.2"]),
1551
+ to: resolveColorTokenValue(context, ((_h = tokens == null ? void 0 : tokens.skeleton) == null ? void 0 : _h.to) || ["500/0.2", "500/0.2"])
1552
+ }
1553
+ },
1554
+ button: buildButtonColorTheme({
1555
+ scheme
1556
+ }, config)
1557
+ };
1558
+ }
1559
+ function buildButtonColorTheme(options, config) {
1560
+ const {
1561
+ scheme
1562
+ } = options;
1563
+ const tones = COLOR_STATE_TONES.map(tone => {
1564
+ return {
1565
+ [tone]: buildButtonColorToneTheme({
1566
+ scheme,
1567
+ tone
1568
+ }, config)
1569
+ };
1570
+ });
1571
+ return Object.assign({}, ...tones);
1572
+ }
1573
+ function buildButtonColorToneTheme(options, config) {
1574
+ const {
1575
+ scheme,
1576
+ tone
1577
+ } = options;
1578
+ const modes = COLOR_BUTTON_MODES.map(mode => {
1579
+ return {
1580
+ [mode]: buildButtonModeColorTheme({
1581
+ mode,
1582
+ scheme,
1583
+ tone
1584
+ }, config)
1585
+ };
1586
+ });
1587
+ return Object.assign({}, ...modes);
1588
+ }
1589
+ function buildButtonModeColorTheme(options, config) {
1590
+ const {
1591
+ mode,
1592
+ scheme,
1593
+ tone
1594
+ } = options;
1595
+ const states = COLOR_STATES.map(state => {
1596
+ return {
1597
+ [state]: buildButtonStateColorTheme({
1598
+ mode,
1599
+ tone,
1600
+ scheme,
1601
+ state
1602
+ }, config)
1603
+ };
1604
+ });
1605
+ return Object.assign({}, ...states);
1606
+ }
1607
+ function buildButtonStateColorTheme(options, config) {
1608
+ var _a, _b, _c, _d, _e;
1609
+ const {
1610
+ mode,
1611
+ tone,
1612
+ scheme,
1613
+ state
1614
+ } = options;
1615
+ const tokens = (_e = (_d = (_c = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.tokens) == null ? void 0 : _b.button) == null ? void 0 : _c[tone]) == null ? void 0 : _d[mode]) == null ? void 0 : _e[state];
1616
+ const hue = (tokens == null ? void 0 : tokens._hue) || "gray";
1617
+ const blendMode = (tokens == null ? void 0 : tokens._blend) || ["screen", "multiply"];
1618
+ const context = {
1619
+ hue,
1620
+ scheme
1621
+ };
1622
+ return {
1623
+ _blend: blendMode[scheme === "light" ? 0 : 1],
1624
+ bg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.bg) || ["500", "400"]),
1625
+ bg2: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.bg2) || ["500", "400"]),
1626
+ fg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.fg) || ["white", "black"]),
1627
+ border: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.border) || ["500", "400"]),
1628
+ muted: {
1629
+ fg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.fg) || ["500", "400"])
1630
+ },
1631
+ accent: {
1632
+ fg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.fg) || ["500", "400"])
1633
+ },
1634
+ link: {
1635
+ fg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.fg) || ["500", "400"])
1636
+ },
1637
+ code: {
1638
+ bg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.bg) || ["500", "400"]),
1639
+ fg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.fg) || ["500", "400"])
1640
+ }
1641
+ };
1642
+ }
1643
+ const defaultColorPalette = {
1644
+ ...color$1,
1645
+ black: "#000000"
1646
+ };
1647
+ function renderColorTheme(value, config) {
1648
+ var _a, _b;
1649
+ const colorPalette = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.palette) != null ? _b : defaultColorPalette;
1650
+ return {
1651
+ light: renderColorScheme(colorPalette, value.light),
1652
+ dark: renderColorScheme(colorPalette, value.dark)
1653
+ };
1654
+ }
1655
+ function renderColorScheme(colorPalette, value) {
1656
+ const toneEntries = Object.entries(value);
1657
+ const [, transparentTone] = toneEntries.find(_ref4 => {
1658
+ let [k] = _ref4;
1659
+ return k === "transparent";
1660
+ });
1661
+ const [, defaultTone] = toneEntries.find(_ref5 => {
1662
+ let [k] = _ref5;
1663
+ return k === "default";
1664
+ });
1665
+ const renderedTransparentTone = renderColorBase(colorPalette, transparentTone, transparentTone._blend === "multiply" ? "#ffffff" : "#000000");
1666
+ const renderedDefaultTone = renderColorBase(colorPalette, defaultTone, defaultTone._blend === "multiply" ? "#ffffff" : "#000000");
1667
+ return Object.fromEntries([["transparent", renderedTransparentTone], ["default", renderedDefaultTone], ...toneEntries.filter(_ref6 => {
1668
+ let [k] = _ref6;
1669
+ return k !== "default" && k !== "transparent";
1670
+ }).map(_ref7 => {
1671
+ let [k, v] = _ref7;
1672
+ return [k, renderColorBase(colorPalette, v, renderedDefaultTone.base.bg)];
1673
+ })]);
1674
+ }
1675
+ function renderColorBase(colorPalette, value, bg) {
1676
+ const nestedBg = renderColorValue(colorPalette, bg, value._blend, value.base.bg);
1677
+ return {
1678
+ _blend: value._blend,
1679
+ dark: value.dark,
1680
+ base: {
1681
+ bg: nestedBg,
1682
+ fg: renderColorValue(colorPalette, nestedBg, value._blend, value.base.fg),
1683
+ border: renderColorValue(colorPalette, nestedBg, value._blend, value.base.border),
1684
+ focusRing: renderColorValue(colorPalette, nestedBg, value._blend, value.base.focusRing),
1685
+ shadow: {
1686
+ outline: renderColorValue(colorPalette, nestedBg, value._blend, value.base.shadow.outline),
1687
+ umbra: renderColorValue(colorPalette, nestedBg, value._blend, value.base.shadow.umbra),
1688
+ penumbra: renderColorValue(colorPalette, nestedBg, value._blend, value.base.shadow.penumbra),
1689
+ ambient: renderColorValue(colorPalette, nestedBg, value._blend, value.base.shadow.ambient)
1690
+ },
1691
+ skeleton: {
1692
+ from: renderColorValue(colorPalette, nestedBg, value._blend, value.base.skeleton.from),
1693
+ to: renderColorValue(colorPalette, nestedBg, value._blend, value.base.skeleton.to)
1694
+ }
1695
+ },
1696
+ button: renderButtonColorTheme(colorPalette, nestedBg, value._blend, value.button)
1697
+ };
1698
+ }
1699
+ function renderButtonColorTheme(colorPalette, bg, baseBlendMode, value) {
1700
+ return {
1701
+ default: renderButtonStateColorTheme(colorPalette, bg, baseBlendMode, value.default),
1702
+ primary: renderButtonStateColorTheme(colorPalette, bg, baseBlendMode, value.primary),
1703
+ positive: renderButtonStateColorTheme(colorPalette, bg, baseBlendMode, value.positive),
1704
+ caution: renderButtonStateColorTheme(colorPalette, bg, baseBlendMode, value.caution),
1705
+ critical: renderButtonStateColorTheme(colorPalette, bg, baseBlendMode, value.critical)
1706
+ };
1707
+ }
1708
+ function renderButtonStateColorTheme(colorPalette, bg, baseBlendMode, value) {
1709
+ return {
1710
+ default: renderStatesColorTheme(colorPalette, bg, baseBlendMode, value.default),
1711
+ ghost: renderStatesColorTheme(colorPalette, bg, baseBlendMode, value.ghost),
1712
+ bleed: renderStatesColorTheme(colorPalette, bg, baseBlendMode, value.bleed)
1713
+ };
1714
+ }
1715
+ function renderStatesColorTheme(colorPalette, bg, baseBlendMode, value) {
1716
+ return {
1717
+ enabled: renderStateColorTheme(colorPalette, bg, baseBlendMode, value.enabled),
1718
+ hovered: renderStateColorTheme(colorPalette, bg, baseBlendMode, value.hovered),
1719
+ pressed: renderStateColorTheme(colorPalette, bg, baseBlendMode, value.pressed),
1720
+ selected: renderStateColorTheme(colorPalette, bg, baseBlendMode, value.selected),
1721
+ disabled: renderStateColorTheme(colorPalette, bg, baseBlendMode, value.disabled)
1722
+ };
1723
+ }
1724
+ function renderStateColorTheme(colorPalette, baseBg, rootBlendMode, value) {
1725
+ const blendMode = value._blend;
1726
+ const bg = rootBlendMode === "multiply" && value.bg === "white" ? "#ffffff" : rootBlendMode === "screen" && value.bg === "black" ? "#000000" : renderColorValue(colorPalette, rootBlendMode === "multiply" ? "#ffffff" : "#000000", rootBlendMode, value.bg);
1727
+ const blend = rootBlendMode === "multiply" ? multiply$1 : screen$1;
1728
+ const unmixed = {
1729
+ bg2: renderColorValue(colorPalette, bg, blendMode, value.bg2 || value.bg),
1730
+ fg: renderColorValue(colorPalette, bg, blendMode, value.fg),
1731
+ border: renderColorValue(colorPalette, bg, blendMode, value.border),
1732
+ muted: {
1733
+ fg: renderColorValue(colorPalette, bg, blendMode, value.muted.fg)
1734
+ },
1735
+ accent: {
1736
+ fg: renderColorValue(colorPalette, bg, blendMode, value.accent.fg)
1737
+ },
1738
+ link: {
1739
+ fg: renderColorValue(colorPalette, bg, blendMode, value.link.fg)
1740
+ },
1741
+ code: {
1742
+ bg: renderColorValue(colorPalette, bg, blendMode, value.code.bg),
1743
+ fg: renderColorValue(colorPalette, bg, blendMode, value.code.fg)
1744
+ }
1745
+ };
1746
+ return {
1747
+ _blend: blendMode,
1748
+ bg: blend(baseBg, bg),
1749
+ bg2: blend(baseBg, unmixed.bg2),
1750
+ fg: blend(baseBg, unmixed.fg),
1751
+ border: blend(baseBg, unmixed.border),
1752
+ muted: {
1753
+ fg: blend(baseBg, unmixed.muted.fg)
1754
+ },
1755
+ accent: {
1756
+ fg: blend(baseBg, unmixed.accent.fg)
1757
+ },
1758
+ link: {
1759
+ fg: blend(baseBg, unmixed.link.fg)
1760
+ },
1761
+ code: {
1762
+ bg: blend(baseBg, unmixed.code.bg),
1763
+ fg: blend(baseBg, unmixed.code.fg)
1764
+ }
1765
+ };
1766
+ }
1767
+ function renderColorValue(colorPalette, bg, blendMode, str) {
1768
+ const node = parseTokenValue(str);
1769
+ if (!node || node.type !== "color") {
1770
+ throw new Error("Invalid color token value: ".concat(str));
1771
+ }
1772
+ let hex = "";
1773
+ if (node.key === "black") {
1774
+ hex = renderColorHex(colorPalette.black);
1775
+ }
1776
+ if (node.key === "white") {
1777
+ hex = renderColorHex(colorPalette.white);
1778
+ }
1779
+ if (node.hue && node.tint) {
1780
+ hex = renderColorHex(colorPalette[node.hue][node.tint]);
1781
+ }
1782
+ if (!hex) {
1783
+ throw new Error("Invalid color token value: ".concat(str));
1784
+ }
1785
+ try {
1786
+ hex = blendMode === "multiply" ? multiply$1(bg, hex) : screen$1(bg, hex);
1787
+ } catch (err) {
1788
+ console.log("could not blend", hex);
1789
+ }
1790
+ if (node.opacity !== void 0) {
1791
+ hex = rgba(hex, node.opacity);
1792
+ }
1793
+ return hex;
1794
+ }
1795
+ function renderColorHex(color) {
1796
+ return typeof color === "string" ? color : color.hex;
1797
+ }
1798
+ function buildTheme(config) {
1799
+ const color = {
1800
+ light: buildColorTheme({
1801
+ scheme: "light"
1802
+ }, config),
1803
+ dark: buildColorTheme({
1804
+ scheme: "dark"
1805
+ }, config)
1806
+ };
1807
+ return {
1808
+ color: renderColorTheme(color, config)
1809
+ };
1810
+ }
1000
1811
  function createButtonTones(opts, base, dark, solid, muted, mode) {
1001
1812
  return {
1002
1813
  default: opts.button({
@@ -1189,11 +2000,11 @@ const tones$1 = {
1189
2000
  }
1190
2001
  };
1191
2002
  const defaultOpts = {
1192
- base: _ref4 => {
2003
+ base: _ref8 => {
1193
2004
  let {
1194
2005
  dark,
1195
2006
  name
1196
- } = _ref4;
2007
+ } = _ref8;
1197
2008
  if (name === "default") {
1198
2009
  return {
1199
2010
  bg: dark ? black : white,
@@ -1229,13 +2040,13 @@ const defaultOpts = {
1229
2040
  }
1230
2041
  };
1231
2042
  },
1232
- solid: _ref5 => {
2043
+ solid: _ref9 => {
1233
2044
  let {
1234
2045
  base,
1235
2046
  dark,
1236
2047
  state,
1237
2048
  tone
1238
- } = _ref5;
2049
+ } = _ref9;
1239
2050
  const color = colors[tone];
1240
2051
  if (state === "hovered") {
1241
2052
  return {
@@ -1282,13 +2093,13 @@ const defaultOpts = {
1282
2093
  skeleton: base.skeleton
1283
2094
  };
1284
2095
  },
1285
- muted: _ref6 => {
2096
+ muted: _ref10 => {
1286
2097
  let {
1287
2098
  base,
1288
2099
  dark,
1289
2100
  state,
1290
2101
  tone
1291
- } = _ref6;
2102
+ } = _ref10;
1292
2103
  const color = colors[tone];
1293
2104
  if (state === "hovered") {
1294
2105
  return {
@@ -1335,13 +2146,13 @@ const defaultOpts = {
1335
2146
  skeleton: base.skeleton
1336
2147
  };
1337
2148
  },
1338
- button: _ref7 => {
2149
+ button: _ref11 => {
1339
2150
  let {
1340
2151
  base,
1341
2152
  mode,
1342
2153
  muted,
1343
2154
  solid
1344
- } = _ref7;
2155
+ } = _ref11;
1345
2156
  if (mode === "bleed") {
1346
2157
  return {
1347
2158
  ...muted,
@@ -1395,10 +2206,10 @@ const defaultOpts = {
1395
2206
  };
1396
2207
  return solid;
1397
2208
  },
1398
- card: _ref8 => {
2209
+ card: _ref12 => {
1399
2210
  let {
1400
2211
  base
1401
- } = _ref8;
2212
+ } = _ref12;
1402
2213
  return {
1403
2214
  bg: black,
1404
2215
  bg2: black,
@@ -1430,18 +2241,18 @@ const defaultOpts = {
1430
2241
  placeholder: black
1431
2242
  };
1432
2243
  },
1433
- selectable: _ref9 => {
2244
+ selectable: _ref13 => {
1434
2245
  let {
1435
2246
  muted,
1436
2247
  state,
1437
2248
  tone
1438
- } = _ref9;
2249
+ } = _ref13;
1439
2250
  return muted[tone][state];
1440
2251
  },
1441
- spot: _ref10 => {
2252
+ spot: _ref14 => {
1442
2253
  let {
1443
2254
  key
1444
- } = _ref10;
2255
+ } = _ref14;
1445
2256
  return spots[key];
1446
2257
  },
1447
2258
  syntax: () => ({
@@ -2156,142 +2967,44 @@ function _createColor(opts, dark, name) {
2156
2967
  function multiply(bg, fg) {
2157
2968
  const b = parseColor(bg);
2158
2969
  const s = parseColor(fg);
2159
- const hex = rgbToHex(multiply$1(b, s));
2970
+ const hex = rgbToHex(multiply$2(b, s));
2971
+ if (s.a) {
2972
+ return rgba(hex, s.a);
2973
+ }
2160
2974
  return hex;
2161
2975
  }
2162
2976
  function screen(bg, fg) {
2163
2977
  const b = parseColor(bg);
2164
2978
  const s = parseColor(fg);
2165
- const hex = rgbToHex(screen$1(b, s));
2979
+ const hex = rgbToHex(screen$2(b, s));
2980
+ if (s.a) {
2981
+ return rgba(hex, s.a);
2982
+ }
2166
2983
  return hex;
2167
2984
  }
2168
- const defaultTints = {
2169
- 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"
2212
- },
2213
- primary: {
2214
- ...defaultTints.light,
2215
- bg_accent: "900",
2216
- bg_accent_hover: "950",
2217
- bg_accent_active: black$1,
2218
- border_accent: "600"
2219
- },
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"
2228
- },
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"
2240
- },
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"
2247
- },
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"
2256
- },
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
2985
  const tones = {
2273
2986
  default: hues.gray,
2274
2987
  transparent: hues.gray,
2275
- primary: hues.gray,
2276
- positive: hues.cyan,
2988
+ primary: hues.blue,
2989
+ positive: hues.green,
2277
2990
  caution: hues.yellow,
2278
2991
  critical: hues.red
2279
2992
  };
2280
2993
  const NEUTRAL_TONES = ["default", "transparent"];
2281
2994
  const color = createColorTheme({
2282
- base: _ref11 => {
2995
+ base: _ref15 => {
2283
2996
  let {
2284
2997
  dark,
2285
2998
  name
2286
- } = _ref11;
2999
+ } = _ref15;
2287
3000
  if (name === "default") {
2288
3001
  const tints2 = hues.gray;
2289
3002
  const skeletonFrom2 = dark ? tints2[900].hex : tints2[100].hex;
2290
3003
  return {
2291
3004
  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"),
3005
+ bg: dark ? black$1.hex : white$1.hex,
3006
+ border: tints2[dark ? 800 : 200].hex,
3007
+ focusRing: hues.blue[dark ? 500 : 500].hex,
2295
3008
  shadow: {
2296
3009
  outline: rgba(tints2[500].hex, 0.4),
2297
3010
  umbra: dark ? rgba(tints2[950].hex, 0.4) : rgba(tints2[500].hex, 0.2),
@@ -2328,9 +3041,9 @@ const color = createColorTheme({
2328
3041
  const skeletonFrom = tints[dark ? 800 : 200].hex;
2329
3042
  return {
2330
3043
  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"),
3044
+ bg: tints[dark ? 950 : 50].hex,
3045
+ border: tints[dark ? 800 : 200].hex,
3046
+ focusRing: tints[500].hex,
2334
3047
  shadow: {
2335
3048
  outline: rgba(tints[500].hex, 0.4),
2336
3049
  umbra: dark ? rgba(tints[900].hex, 0.4) : rgba(tints[500].hex, 0.2),
@@ -2343,14 +3056,14 @@ const color = createColorTheme({
2343
3056
  }
2344
3057
  };
2345
3058
  },
2346
- solid: _ref12 => {
3059
+ solid: _ref16 => {
2347
3060
  let {
2348
3061
  base,
2349
3062
  dark,
2350
3063
  name,
2351
3064
  state,
2352
3065
  tone
2353
- } = _ref12;
3066
+ } = _ref16;
2354
3067
  const mix = dark ? screen : multiply;
2355
3068
  const mix2 = dark ? multiply : screen;
2356
3069
  const defaultTints = tones[name] || tones.default;
@@ -2358,14 +3071,15 @@ const color = createColorTheme({
2358
3071
  let tints = tones[tone === "default" ? name : tone] || defaultTints;
2359
3072
  if (state === "disabled") {
2360
3073
  tints = defaultTints;
2361
- const bg2 = getColorHex(tones.default, dark, "default", "bg_tint");
3074
+ const bg2 = mix(base.bg, tints[dark ? 800 : 200].hex);
2362
3075
  const skeletonFrom2 = mix2(bg2, tints[dark ? 200 : 800].hex);
2363
3076
  return {
2364
3077
  bg: bg2,
2365
3078
  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"),
3079
+ border: mix(base.bg, tints[dark ? 800 : 200].hex),
3080
+ iconColor: "",
3081
+ // Add color
3082
+ fg: mix(base.bg, dark ? black$1.hex : white$1.hex),
2369
3083
  muted: {
2370
3084
  fg: mix(base.bg, tints[dark ? 950 : 50].hex)
2371
3085
  },
@@ -2386,14 +3100,15 @@ const color = createColorTheme({
2386
3100
  };
2387
3101
  }
2388
3102
  if (state === "hovered") {
2389
- const bg2 = getColorHex(tints, dark, tone, "bg_accent_hover");
3103
+ const bg2 = mix(base.bg, tints[dark ? 300 : 600].hex);
2390
3104
  const skeletonFrom2 = mix2(bg2, tints[dark ? 200 : 800].hex);
2391
3105
  return {
2392
3106
  bg: bg2,
2393
3107
  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"),
3108
+ border: mix(base.bg, tints[dark ? 300 : 600].hex),
3109
+ fg: mix(base.bg, dark ? black$1.hex : white$1.hex),
3110
+ iconColor: "",
3111
+ // Add color
2397
3112
  muted: {
2398
3113
  fg: mix(base.bg, tints[dark ? 800 : 200].hex)
2399
3114
  },
@@ -2414,14 +3129,15 @@ const color = createColorTheme({
2414
3129
  };
2415
3130
  }
2416
3131
  if (state === "pressed") {
2417
- const bg2 = getColorHex(tints, dark, tone, "bg_accent_active");
2418
- const skeletonFrom2 = mix2(bg2, tints[dark ? 200 : 600].hex);
3132
+ const bg2 = mix(base.bg, tints[dark ? 200 : 800].hex);
3133
+ const skeletonFrom2 = mix2(bg2, tints[dark ? 200 : 800].hex);
2419
3134
  return {
2420
- bg: bg2,
3135
+ bg: mix(base.bg, tints[dark ? 200 : 800].hex),
2421
3136
  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"),
3137
+ iconColor: "",
3138
+ // Add color
3139
+ border: mix(base.bg, tints[dark ? 200 : 800].hex),
3140
+ fg: mix(base.bg, dark ? black$1.hex : white$1.hex),
2425
3141
  muted: {
2426
3142
  fg: mix(base.bg, tints[dark ? 800 : 200].hex)
2427
3143
  },
@@ -2450,9 +3166,10 @@ const color = createColorTheme({
2450
3166
  return {
2451
3167
  bg: bg2,
2452
3168
  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"),
3169
+ border: mix(base.bg, tints[dark ? 200 : 800].hex),
3170
+ fg: mix(base.bg, dark ? black$1.hex : white$1.hex),
3171
+ iconColor: "",
3172
+ // Add color
2456
3173
  muted: {
2457
3174
  fg: mix(base.bg, tints[dark ? 800 : 200].hex)
2458
3175
  },
@@ -2472,14 +3189,15 @@ const color = createColorTheme({
2472
3189
  }
2473
3190
  };
2474
3191
  }
2475
- const bg = getColorHex(tints, dark, tone, "bg_accent");
3192
+ const bg = mix(base.bg, tints[dark ? 400 : 500].hex);
2476
3193
  const skeletonFrom = mix2(bg, tints[dark ? 200 : 800].hex);
2477
3194
  return {
2478
3195
  bg,
2479
3196
  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"),
3197
+ border: mix(base.bg, tints[dark ? 400 : 500].hex),
3198
+ iconColor: "",
3199
+ // Add color
3200
+ fg: mix(base.bg, dark ? black$1.hex : white$1.hex),
2483
3201
  muted: {
2484
3202
  fg: mix(base.bg, tints[dark ? 900 : 100].hex)
2485
3203
  },
@@ -2499,14 +3217,14 @@ const color = createColorTheme({
2499
3217
  }
2500
3218
  };
2501
3219
  },
2502
- muted: _ref13 => {
3220
+ muted: _ref17 => {
2503
3221
  let {
2504
3222
  base,
2505
3223
  dark,
2506
3224
  name,
2507
3225
  state,
2508
3226
  tone
2509
- } = _ref13;
3227
+ } = _ref17;
2510
3228
  const mix = dark ? screen : multiply;
2511
3229
  const defaultTints = tones[name] || tones.default;
2512
3230
  const isNeutral = NEUTRAL_TONES.includes(name) && NEUTRAL_TONES.includes(tone);
@@ -2518,21 +3236,22 @@ const color = createColorTheme({
2518
3236
  return {
2519
3237
  bg: bg2,
2520
3238
  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"),
3239
+ border: mix(bg2, tints[dark ? 950 : 50].hex),
3240
+ iconColor: "",
3241
+ // Add color
3242
+ fg: mix(bg2, tints[dark ? 800 : 200].hex),
2524
3243
  muted: {
2525
- fg: getColorHex(tones.default, dark, "default", "text_inactive")
3244
+ fg: mix(bg2, tints[dark ? 900 : 100].hex)
2526
3245
  },
2527
3246
  accent: {
2528
- fg: getColorHex(tints, dark, tone, "text_secondary")
3247
+ fg: mix(bg2, tints[dark ? 900 : 100].hex)
2529
3248
  },
2530
3249
  link: {
2531
- fg: getColorHex(tints, dark, tone, "text_secondary")
3250
+ fg: mix(bg2, tints[dark ? 900 : 100].hex)
2532
3251
  },
2533
3252
  code: {
2534
3253
  bg: bg2,
2535
- fg: getColorHex(tints, dark, tone, "text_secondary")
3254
+ fg: mix(bg2, tints[dark ? 900 : 100].hex)
2536
3255
  },
2537
3256
  skeleton: {
2538
3257
  from: rgba(skeletonFrom2, 0.5),
@@ -2541,16 +3260,17 @@ const color = createColorTheme({
2541
3260
  };
2542
3261
  }
2543
3262
  if (state === "hovered") {
2544
- const bg2 = getColorHex(tints, dark, name, "bg_base_hover");
3263
+ const bg2 = mix(base.bg, tints[dark ? 950 : 50].hex);
2545
3264
  const skeletonFrom2 = mix(bg2, tints[dark ? 900 : 100].hex);
2546
3265
  return {
2547
3266
  bg: bg2,
2548
3267
  bg2: mix(bg2, tints[dark ? 950 : 50].hex),
2549
3268
  border: mix(bg2, tints[dark ? 900 : 100].hex),
2550
- fg: getColorHex(tints, dark, tone, "text_primary"),
2551
- iconColor: getColorHex(tints, dark, name, "icon_default"),
3269
+ fg: mix(base.bg, tints[dark ? 200 : 800].hex),
3270
+ iconColor: "",
3271
+ // Add color
2552
3272
  muted: {
2553
- fg: getColorHex(tints, dark, tone, "text_secondary")
3273
+ fg: mix(base.bg, tints[dark ? 400 : 600].hex)
2554
3274
  },
2555
3275
  accent: {
2556
3276
  fg: mix(base.bg, hues.red[dark ? 400 : 500].hex)
@@ -2560,7 +3280,7 @@ const color = createColorTheme({
2560
3280
  },
2561
3281
  code: {
2562
3282
  bg: mix(bg2, tints[dark ? 950 : 50].hex),
2563
- fg: getColorHex(tints, dark, tone, "text_secondary")
3283
+ fg: mix(base.bg, tints[dark ? 400 : 600].hex)
2564
3284
  },
2565
3285
  skeleton: {
2566
3286
  from: skeletonFrom2,
@@ -2572,16 +3292,17 @@ const color = createColorTheme({
2572
3292
  if (isNeutral) {
2573
3293
  tints = tones.primary;
2574
3294
  }
2575
- const bg2 = getColorHex(tints, dark, name, "bg_base_active");
2576
- const skeletonFrom2 = mix(bg2, getColorHex(tints, dark, name, "bg_base_active"));
3295
+ const bg2 = mix(base.bg, tints[dark ? 900 : 100].hex);
3296
+ const skeletonFrom2 = mix(bg2, tints[dark ? 900 : 100].hex);
2577
3297
  return {
2578
3298
  bg: bg2,
2579
3299
  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"),
3300
+ border: mix(bg2, tints[dark ? 900 : 100].hex),
3301
+ iconColor: "",
3302
+ // Add color
3303
+ fg: mix(base.bg, tints[dark ? 200 : 800].hex),
2583
3304
  muted: {
2584
- fg: getColorHex(tints, dark, tone, "text_secondary")
3305
+ fg: mix(base.bg, tints[dark ? 400 : 600].hex)
2585
3306
  },
2586
3307
  accent: {
2587
3308
  fg: mix(bg2, hues.red[dark ? 400 : 500].hex)
@@ -2591,7 +3312,7 @@ const color = createColorTheme({
2591
3312
  },
2592
3313
  code: {
2593
3314
  bg: mix(bg2, tints[dark ? 950 : 50].hex),
2594
- fg: getColorHex(tints, dark, tone, "text_secondary")
3315
+ fg: mix(base.bg, tints[dark ? 400 : 600].hex)
2595
3316
  },
2596
3317
  skeleton: {
2597
3318
  from: skeletonFrom2,
@@ -2608,11 +3329,12 @@ const color = createColorTheme({
2608
3329
  return {
2609
3330
  bg: bg2,
2610
3331
  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"),
3332
+ border: mix(bg2, tints[dark ? 900 : 100].hex),
3333
+ fg: mix(base.bg, tints[dark ? 200 : 800].hex),
3334
+ iconColor: "",
3335
+ // Add color
2614
3336
  muted: {
2615
- fg: getColorHex(tints, dark, tone, "text_secondary")
3337
+ fg: mix(base.bg, tints[dark ? 400 : 600].hex)
2616
3338
  },
2617
3339
  accent: {
2618
3340
  fg: mix(bg2, hues.red[dark ? 400 : 500].hex)
@@ -2622,7 +3344,7 @@ const color = createColorTheme({
2622
3344
  },
2623
3345
  code: {
2624
3346
  bg: mix(bg2, tints[dark ? 950 : 50].hex),
2625
- fg: getColorHex(tints, dark, tone, "text_secondary")
3347
+ fg: mix(base.bg, tints[dark ? 400 : 600].hex)
2626
3348
  },
2627
3349
  skeleton: {
2628
3350
  from: skeletonFrom2,
@@ -2635,11 +3357,12 @@ const color = createColorTheme({
2635
3357
  return {
2636
3358
  bg,
2637
3359
  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"),
3360
+ border: mix(bg, tints[dark ? 900 : 100].hex),
3361
+ fg: mix(base.bg, tints[dark ? 300 : 700].hex),
3362
+ iconColor: "",
3363
+ // Add color
2641
3364
  muted: {
2642
- fg: getColorHex(tints, dark, tone, "text_secondary")
3365
+ fg: mix(base.bg, tints[dark ? 400 : 600].hex)
2643
3366
  },
2644
3367
  accent: {
2645
3368
  fg: mix(base.bg, hues.red[dark ? 400 : 500].hex)
@@ -2649,7 +3372,7 @@ const color = createColorTheme({
2649
3372
  },
2650
3373
  code: {
2651
3374
  bg: mix(base.bg, tints[dark ? 950 : 50].hex),
2652
- fg: getColorHex(tints, dark, tone, "text_secondary")
3375
+ fg: mix(base.bg, tints[dark ? 400 : 600].hex)
2653
3376
  },
2654
3377
  skeleton: {
2655
3378
  from: skeletonFrom,
@@ -2657,13 +3380,13 @@ const color = createColorTheme({
2657
3380
  }
2658
3381
  };
2659
3382
  },
2660
- button: _ref14 => {
3383
+ button: _ref18 => {
2661
3384
  let {
2662
3385
  base,
2663
3386
  mode,
2664
3387
  muted,
2665
3388
  solid
2666
- } = _ref14;
3389
+ } = _ref18;
2667
3390
  if (mode === "bleed") {
2668
3391
  return {
2669
3392
  enabled: {
@@ -2690,16 +3413,17 @@ const color = createColorTheme({
2690
3413
  }
2691
3414
  if (mode === "ghost") {
2692
3415
  return {
2693
- ...muted,
3416
+ ...solid,
2694
3417
  enabled: {
2695
3418
  ...muted.enabled,
2696
3419
  border: base.border
2697
- }
3420
+ },
3421
+ disabled: muted.disabled
2698
3422
  };
2699
3423
  }
2700
3424
  return solid;
2701
3425
  },
2702
- card: _ref15 => {
3426
+ card: _ref19 => {
2703
3427
  let {
2704
3428
  base,
2705
3429
  dark,
@@ -2707,7 +3431,7 @@ const color = createColorTheme({
2707
3431
  name,
2708
3432
  solid,
2709
3433
  state
2710
- } = _ref15;
3434
+ } = _ref19;
2711
3435
  if (state === "hovered") {
2712
3436
  return muted[name].hovered;
2713
3437
  }
@@ -2735,8 +3459,9 @@ const color = createColorTheme({
2735
3459
  bg,
2736
3460
  bg2: mix(bg, tints[dark ? 950 : 50].hex),
2737
3461
  fg: base.fg,
2738
- iconColor: getColorHex(tints, dark, name, "icon_default"),
2739
3462
  border: base.border,
3463
+ iconColor: "",
3464
+ // Add color
2740
3465
  muted: {
2741
3466
  fg: mix(base.bg, tints[dark ? 400 : 600].hex)
2742
3467
  },
@@ -2756,67 +3481,72 @@ const color = createColorTheme({
2756
3481
  }
2757
3482
  };
2758
3483
  },
2759
- input: _ref16 => {
3484
+ input: _ref20 => {
2760
3485
  let {
2761
3486
  base,
2762
3487
  dark,
2763
3488
  mode,
2764
3489
  state
2765
- } = _ref16;
3490
+ } = _ref20;
2766
3491
  const mix = dark ? screen : multiply;
2767
3492
  if (mode === "invalid") {
2768
3493
  const tints = tones.critical;
2769
3494
  return {
2770
3495
  bg: mix(base.bg, tints[dark ? 950 : 50].hex),
2771
- bg2: getColorHex(tints, dark, "critical", "text_secondary"),
3496
+ bg2: "",
3497
+ // Add color
2772
3498
  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")
3499
+ border: mix(base.bg, tints[dark ? 800 : 200].hex),
3500
+ placeholder: mix(base.bg, tints[dark ? 600 : 400].hex)
2775
3501
  };
2776
3502
  }
2777
3503
  if (state === "hovered") {
2778
3504
  return {
2779
3505
  bg: base.bg,
2780
- bg2: getColorHex(tones.default, dark, "default", "text_secondary"),
3506
+ bg2: "",
3507
+ // Add color
2781
3508
  fg: base.fg,
2782
3509
  border: mix(base.bg, hues.gray[dark ? 700 : 300].hex),
2783
- placeholder: getColorHex(tones.default, !dark, "default", "text_secondary")
3510
+ placeholder: mix(base.bg, hues.gray[dark ? 600 : 400].hex)
2784
3511
  };
2785
3512
  }
2786
3513
  if (state === "disabled") {
2787
3514
  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")
3515
+ bg: mix(base.bg, hues.gray[dark ? 950 : 50].hex),
3516
+ bg2: "",
3517
+ // Add color
3518
+ fg: mix(base.bg, hues.gray[dark ? 700 : 300].hex),
3519
+ border: mix(base.bg, hues.gray[dark ? 900 : 100].hex),
3520
+ placeholder: mix(base.bg, hues.gray[dark ? 800 : 200].hex)
2793
3521
  };
2794
3522
  }
2795
3523
  if (state === "readOnly") {
2796
3524
  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")
3525
+ bg: mix(base.bg, hues.gray[dark ? 950 : 50].hex),
3526
+ bg2: "",
3527
+ // Add color
3528
+ fg: mix(base.bg, hues.gray[dark ? 200 : 800].hex),
3529
+ border: mix(base.bg, hues.gray[dark ? 800 : 200].hex),
3530
+ placeholder: mix(base.bg, hues.gray[dark ? 600 : 400].hex)
2802
3531
  };
2803
3532
  }
2804
3533
  return {
2805
3534
  bg: base.bg,
2806
- bg2: getColorHex(tones.default, dark, "default", "text_secondary"),
3535
+ bg2: "",
3536
+ // Add color
2807
3537
  fg: base.fg,
2808
3538
  border: base.border,
2809
- placeholder: getColorHex(tones.default, !dark, "default", "text_secondary")
3539
+ placeholder: mix(base.bg, hues.gray[dark ? 600 : 400].hex)
2810
3540
  };
2811
3541
  },
2812
- selectable: _ref17 => {
3542
+ selectable: _ref21 => {
2813
3543
  let {
2814
3544
  base,
2815
3545
  muted,
2816
3546
  tone,
2817
3547
  solid,
2818
3548
  state
2819
- } = _ref17;
3549
+ } = _ref21;
2820
3550
  if (state === "enabled") {
2821
3551
  return {
2822
3552
  ...muted[tone].enabled,
@@ -2843,20 +3573,20 @@ const color = createColorTheme({
2843
3573
  }
2844
3574
  return muted[tone][state];
2845
3575
  },
2846
- spot: _ref18 => {
3576
+ spot: _ref22 => {
2847
3577
  let {
2848
3578
  base,
2849
3579
  dark,
2850
3580
  key
2851
- } = _ref18;
3581
+ } = _ref22;
2852
3582
  const mix = dark ? screen : multiply;
2853
3583
  return mix(base.bg, hues[key][dark ? 400 : 500].hex);
2854
3584
  },
2855
- syntax: _ref19 => {
3585
+ syntax: _ref23 => {
2856
3586
  let {
2857
3587
  base,
2858
3588
  dark
2859
- } = _ref19;
3589
+ } = _ref23;
2860
3590
  const mix = dark ? screen : multiply;
2861
3591
  const mainShade = dark ? 400 : 600;
2862
3592
  const secondaryShade = dark ? 600 : 400;
@@ -3093,16 +3823,16 @@ const studioTheme = {
3093
3823
  avatar: {
3094
3824
  sizes: [{
3095
3825
  distance: -3,
3096
- size: 25
3826
+ size: 23
3097
3827
  }, {
3098
3828
  distance: -6,
3099
- size: 35
3829
+ size: 33
3100
3830
  }, {
3101
3831
  distance: -9,
3102
- size: 55
3832
+ size: 53
3103
3833
  }],
3104
3834
  focusRing: {
3105
- offset: 1,
3835
+ offset: 0,
3106
3836
  width: 1
3107
3837
  }
3108
3838
  },
@@ -3133,9 +3863,9 @@ const studioTheme = {
3133
3863
  penumbra: [0, 0, 0, 0],
3134
3864
  ambient: [0, 0, 0, 0]
3135
3865
  }, {
3136
- umbra: [0, 3, 5, -1],
3866
+ umbra: [0, 3, 5, -2],
3137
3867
  penumbra: [0, 6, 10, 0],
3138
- ambient: [0, 1, 18, 0]
3868
+ ambient: [0, 1, 18, 1]
3139
3869
  }, {
3140
3870
  umbra: [0, 7, 8, -4],
3141
3871
  penumbra: [0, 12, 17, 2],
@@ -3952,7 +4682,7 @@ var __defProp$E = Object.defineProperty;
3952
4682
  var __template$D = (cooked, raw) => __freeze$D(__defProp$E(cooked, "raw", {
3953
4683
  value: __freeze$D(raw || cooked.slice())
3954
4684
  }));
3955
- var _a$D, _b$m, _c$d;
4685
+ var _a$D, _b$n, _c$d;
3956
4686
  const ROOT_STYLE = css(_a$D || (_a$D = __template$D(["\n &:not([hidden]) {\n display: flex;\n }\n\n align-items: center;\n"])));
3957
4687
  function textInputRootStyle() {
3958
4688
  return ROOT_STYLE;
@@ -3966,7 +4696,7 @@ function textInputBaseStyle(props) {
3966
4696
  } = props;
3967
4697
  const font = theme.sanity.fonts.text;
3968
4698
  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);
4699
+ return css(_b$n || (_b$n = __template$D(["\n appearance: none;\n background: none;\n border: 0;\n border-radius: 0;\n outline: none;\n width: 100%;\n box-sizing: border-box;\n font-family: ", ";\n font-weight: ", ";\n margin: 0;\n position: relative;\n z-index: 1;\n display: block;\n\n /* NOTE: This is a hack to disable Chrome\u2019s autofill styles */\n &:-webkit-autofill,\n &:-webkit-autofill:hover,\n &:-webkit-autofill:focus,\n &:-webkit-autofill:active {\n -webkit-text-fill-color: var(--input-fg-color) !important;\n transition: background-color 5000s;\n transition-delay: 86400s /* 24h */;\n }\n\n /* &:is(textarea) */\n &[data-as='textarea'] {\n resize: none;\n }\n\n color: var(--input-fg-color);\n\n &::placeholder {\n color: var(--input-placeholder-color);\n }\n\n &[data-scheme='", "'][data-tone='", "'] {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n\n /* enabled */\n &:not(:invalid):not(:disabled):not(:read-only) {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n\n /* disabled */\n &:not(:invalid):disabled {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n\n /* invalid */\n &:invalid {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n\n /* readOnly */\n &:read-only {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n }\n "])), font.family, $weight && font.weights[$weight] || font.weights.regular, $scheme, $tone, color.default.enabled.fg, color.default.enabled.placeholder, color.default.enabled.fg, color.default.enabled.placeholder, color.default.disabled.fg, color.default.disabled.placeholder, color.invalid.enabled.fg, color.invalid.enabled.placeholder, color.default.readOnly.fg, color.default.readOnly.placeholder);
3970
4700
  }
3971
4701
  function textInputFontSizeStyle(props) {
3972
4702
  const {
@@ -3990,6 +4720,7 @@ function textInputRepresentationStyle(props) {
3990
4720
  $hasSuffix,
3991
4721
  $scheme,
3992
4722
  $tone,
4723
+ $unstableDisableFocusRing,
3993
4724
  theme
3994
4725
  } = props;
3995
4726
  const {
@@ -4005,13 +4736,13 @@ function textInputRepresentationStyle(props) {
4005
4736
  }), color.invalid.enabled.bg, color.invalid.enabled.fg, focusRingBorderStyle({
4006
4737
  color: color.invalid.enabled.border,
4007
4738
  width: input.border.width
4008
- }), focusRingStyle({
4739
+ }), $unstableDisableFocusRing ? void 0 : focusRingStyle({
4009
4740
  border: {
4010
4741
  color: color.default.enabled.border,
4011
4742
  width: input.border.width
4012
4743
  },
4013
4744
  focusRing
4014
- }), focusRingStyle({
4745
+ }), $unstableDisableFocusRing ? void 0 : focusRingStyle({
4015
4746
  focusRing
4016
4747
  }), color.default.disabled.bg, color.default.disabled.fg, focusRingBorderStyle({
4017
4748
  color: color.default.disabled.border,
@@ -4082,7 +4813,7 @@ var __defProp$D = Object.defineProperty;
4082
4813
  var __template$C = (cooked, raw) => __freeze$C(__defProp$D(cooked, "raw", {
4083
4814
  value: __freeze$C(raw || cooked.slice())
4084
4815
  }));
4085
- var _a$C, _b$l, _c$c;
4816
+ var _a$C, _b$m, _c$c;
4086
4817
  function textBaseStyle(props) {
4087
4818
  const {
4088
4819
  $accent,
@@ -4092,7 +4823,7 @@ function textBaseStyle(props) {
4092
4823
  const {
4093
4824
  weights
4094
4825
  } = 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);
4826
+ 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$m || (_b$m = __template$C(["\n color: var(--card-muted-fg-color);\n "]))), theme.sanity.fonts.code.family, weights.bold);
4096
4827
  }
4097
4828
  var __freeze$B = Object.freeze;
4098
4829
  var __defProp$C = Object.defineProperty;
@@ -4274,7 +5005,7 @@ function avatarBgStrokeStyle() {
4274
5005
  }
4275
5006
  function avatarStrokeStyle() {
4276
5007
  return {
4277
- strokeWidth: "3px",
5008
+ strokeWidth: "2px",
4278
5009
  '[data-status="editing"] &': {
4279
5010
  strokeDasharray: "2 4",
4280
5011
  strokeLinecap: "round"
@@ -4288,6 +5019,7 @@ const Stroke = styled.ellipse(avatarStyle.stroke);
4288
5019
  const Initials = styled.div(avatarStyle.initials);
4289
5020
  const Avatar = forwardRef(function Avatar2(props, ref) {
4290
5021
  const {
5022
+ __unstable_hideInnerStroke,
4291
5023
  as: asProp,
4292
5024
  color: colorKey = "gray",
4293
5025
  src,
@@ -4370,7 +5102,7 @@ const Avatar = forwardRef(function Avatar2(props, ref) {
4370
5102
  cy: _radius,
4371
5103
  r: _radius,
4372
5104
  fill: "url(#".concat(imageId, ")")
4373
- }), /* @__PURE__ */jsx(BgStroke, {
5105
+ }), !__unstable_hideInnerStroke && /* @__PURE__ */jsx(BgStroke, {
4374
5106
  cx: _radius,
4375
5107
  cy: _radius,
4376
5108
  rx: _radius,
@@ -4389,9 +5121,8 @@ const Avatar = forwardRef(function Avatar2(props, ref) {
4389
5121
  children: /* @__PURE__ */jsx(Text, {
4390
5122
  as: "span",
4391
5123
  size: initialsSize,
4392
- children: /* @__PURE__ */jsx("strong", {
4393
- children: initials
4394
- })
5124
+ weight: "medium",
5125
+ children: initials
4395
5126
  })
4396
5127
  })
4397
5128
  })]
@@ -4425,7 +5156,7 @@ function _avatarCounterBaseStyle(props) {
4425
5156
  const {
4426
5157
  theme
4427
5158
  } = 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]));
5159
+ 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 1px var(--card-hairline-hard-color);\n padding: 0 ", ";\n\n &:not([hidden]) {\n display: flex;\n }\n "])), rem(theme.sanity.space[2]));
4429
5160
  }
4430
5161
  const Root$C = styled.div(_responsiveAvatarCounterSizeStyle, _avatarCounterBaseStyle);
4431
5162
  const AvatarCounter = forwardRef(function AvatarCounter2(props, ref) {
@@ -4442,9 +5173,8 @@ const AvatarCounter = forwardRef(function AvatarCounter2(props, ref) {
4442
5173
  children: /* @__PURE__ */jsx(Text, {
4443
5174
  as: "span",
4444
5175
  size: counterSize,
4445
- children: /* @__PURE__ */jsx("strong", {
4446
- children: count
4447
- })
5176
+ weight: "medium",
5177
+ children: count
4448
5178
  })
4449
5179
  });
4450
5180
  });
@@ -4559,84 +5289,26 @@ const Box = forwardRef(function Box2(props, ref) {
4559
5289
  $height: useArrayProp(height),
4560
5290
  $margin: useArrayProp(margin),
4561
5291
  $marginX: useArrayProp(marginX),
4562
- $marginY: useArrayProp(marginY),
4563
- $marginTop: useArrayProp(marginTop),
4564
- $marginRight: useArrayProp(marginRight),
4565
- $marginBottom: useArrayProp(marginBottom),
4566
- $marginLeft: useArrayProp(marginLeft),
4567
- $overflow: useArrayProp(overflow),
4568
- $padding: useArrayProp(padding),
4569
- $paddingX: useArrayProp(paddingX),
4570
- $paddingY: useArrayProp(paddingY),
4571
- $paddingTop: useArrayProp(paddingTop),
4572
- $paddingRight: useArrayProp(paddingRight),
4573
- $paddingBottom: useArrayProp(paddingBottom),
4574
- $paddingLeft: useArrayProp(paddingLeft),
4575
- $row: useArrayProp(row),
4576
- $rowStart: useArrayProp(rowStart),
4577
- $rowEnd: useArrayProp(rowEnd),
4578
- $sizing: useArrayProp(sizing),
4579
- as: asProp,
4580
- ref,
4581
- children: props.children
4582
- });
4583
- });
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,
5292
+ $marginY: useArrayProp(marginY),
5293
+ $marginTop: useArrayProp(marginTop),
5294
+ $marginRight: useArrayProp(marginRight),
5295
+ $marginBottom: useArrayProp(marginBottom),
5296
+ $marginLeft: useArrayProp(marginLeft),
5297
+ $overflow: useArrayProp(overflow),
5298
+ $padding: useArrayProp(padding),
5299
+ $paddingX: useArrayProp(paddingX),
5300
+ $paddingY: useArrayProp(paddingY),
5301
+ $paddingTop: useArrayProp(paddingTop),
5302
+ $paddingRight: useArrayProp(paddingRight),
5303
+ $paddingBottom: useArrayProp(paddingBottom),
5304
+ $paddingLeft: useArrayProp(paddingLeft),
5305
+ $row: useArrayProp(row),
5306
+ $rowStart: useArrayProp(rowStart),
5307
+ $rowEnd: useArrayProp(rowEnd),
5308
+ $sizing: useArrayProp(sizing),
5309
+ as: asProp,
4638
5310
  ref,
4639
- children
5311
+ children: props.children
4640
5312
  });
4641
5313
  });
4642
5314
  function badgeStyle(props) {
@@ -4657,18 +5329,18 @@ function badgeStyle(props) {
4657
5329
  }
4658
5330
  };
4659
5331
  }
4660
- const Root$y = styled(Box)(responsiveRadiusStyle, badgeStyle);
5332
+ const Root$z = styled(Box)(responsiveRadiusStyle, badgeStyle);
4661
5333
  const Badge = forwardRef(function Badge2(props, ref) {
4662
5334
  const {
4663
5335
  children,
4664
- fontSize,
5336
+ fontSize = 1,
4665
5337
  mode = "default",
4666
5338
  padding = 1,
4667
5339
  radius = 2,
4668
5340
  tone = "default",
4669
5341
  ...restProps
4670
5342
  } = props;
4671
- return /* @__PURE__ */jsx(Root$y, {
5343
+ return /* @__PURE__ */jsx(Root$z, {
4672
5344
  "data-ui": "Badge",
4673
5345
  ...restProps,
4674
5346
  $mode: mode,
@@ -4676,13 +5348,14 @@ const Badge = forwardRef(function Badge2(props, ref) {
4676
5348
  $radius: useArrayProp(radius),
4677
5349
  padding: useArrayProp(padding),
4678
5350
  ref,
4679
- children: /* @__PURE__ */jsx(Label, {
5351
+ children: /* @__PURE__ */jsx(Text, {
4680
5352
  size: fontSize,
5353
+ weight: "medium",
4681
5354
  children
4682
5355
  })
4683
5356
  });
4684
5357
  });
4685
- const Root$x = styled(Box)(flexItemStyle, responsiveFlexStyle);
5358
+ const Root$y = styled(Box)(flexItemStyle, responsiveFlexStyle);
4686
5359
  const Flex = forwardRef(function Flex2(props, ref) {
4687
5360
  const {
4688
5361
  align,
@@ -4696,7 +5369,7 @@ const Flex = forwardRef(function Flex2(props, ref) {
4696
5369
  return (
4697
5370
  // @ts-expect-error -- some dollar prefixed typings aren't inferred correctly https://github.com/styled-components/styled-components/issues/4062
4698
5371
  /* @__PURE__ */
4699
- jsx(Root$x, {
5372
+ jsx(Root$y, {
4700
5373
  "data-ui": "Flex",
4701
5374
  ...restProps,
4702
5375
  $align: useArrayProp(align),
@@ -4709,16 +5382,16 @@ const Flex = forwardRef(function Flex2(props, ref) {
4709
5382
  })
4710
5383
  );
4711
5384
  });
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())
5385
+ var __freeze$y = Object.freeze;
5386
+ var __defProp$z = Object.defineProperty;
5387
+ var __template$y = (cooked, raw) => __freeze$y(__defProp$z(cooked, "raw", {
5388
+ value: __freeze$y(raw || cooked.slice())
4716
5389
  }));
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);
5390
+ var _a$y, _b$l;
5391
+ 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"])));
5392
+ const Root$x = styled(Text)(_b$l || (_b$l = __template$y(["\n & > span > svg {\n animation: ", " 500ms linear infinite;\n }\n"])), rotate$1);
4720
5393
  const Spinner = forwardRef(function Spinner2(props, ref) {
4721
- return /* @__PURE__ */jsx(Root$w, {
5394
+ return /* @__PURE__ */jsx(Root$x, {
4722
5395
  "data-ui": "Spinner",
4723
5396
  ...props,
4724
5397
  ref,
@@ -4756,14 +5429,17 @@ function _colorVarsStyle(base, color) {
4756
5429
  "--card-hairline-hard-color": color.border
4757
5430
  };
4758
5431
  }
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())
5432
+ var __freeze$x = Object.freeze;
5433
+ var __defProp$y = Object.defineProperty;
5434
+ var __template$x = (cooked, raw) => __freeze$x(__defProp$y(cooked, "raw", {
5435
+ value: __freeze$x(raw || cooked.slice())
4763
5436
  }));
4764
- var _a$v;
4765
- 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 "])));
5437
+ var _a$x, _b$k;
5438
+ function buttonBaseStyles(_ref24) {
5439
+ let {
5440
+ $width
5441
+ } = _ref24;
5442
+ return css(_b$k || (_b$k = __template$x(["\n -webkit-font-smoothing: inherit;\n appearance: none;\n display: inline-flex;\n align-items: center;\n font: inherit;\n border: 0;\n outline: none;\n user-select: none;\n text-decoration: none;\n border: 0;\n box-sizing: border-box;\n padding: 0;\n margin: 0;\n white-space: nowrap;\n text-align: left;\n position: relative;\n\n ", "\n\n & > span {\n display: block;\n flex: 1;\n min-width: 0;\n border-radius: inherit;\n }\n\n &::-moz-focus-inner {\n border: 0;\n padding: 0;\n }\n "])), $width === "fill" && css(_a$x || (_a$x = __template$x(["\n width: -moz-available;\n width: -webkit-fill-available;\n width: stretch;\n "]))));
4767
5443
  }
4768
5444
  const buttonTheme = {
4769
5445
  border: {
@@ -4778,7 +5454,7 @@ function combineBoxShadow() {
4778
5454
  return boxShadows.filter(Boolean).join(",");
4779
5455
  }
4780
5456
  function buttonColorStyles(props) {
4781
- var _a2, _b;
5457
+ var _a2, _b2;
4782
5458
  const {
4783
5459
  $mode,
4784
5460
  theme
@@ -4821,16 +5497,16 @@ function buttonColorStyles(props) {
4821
5497
  },
4822
5498
  "&[data-selected]": _colorVarsStyle(base, color.pressed)
4823
5499
  }
4824
- }, (_b = (_a2 = theme.sanity.styles) == null ? void 0 : _a2.button) == null ? void 0 : _b.root].filter(Boolean);
5500
+ }, (_b2 = (_a2 = theme.sanity.styles) == null ? void 0 : _a2.button) == null ? void 0 : _b2.root].filter(Boolean);
4825
5501
  }
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())
5502
+ var __freeze$w = Object.freeze;
5503
+ var __defProp$x = Object.defineProperty;
5504
+ var __template$w = (cooked, raw) => __freeze$w(__defProp$x(cooked, "raw", {
5505
+ value: __freeze$w(raw || cooked.slice())
4830
5506
  }));
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"])));
5507
+ var _a$w;
5508
+ const Root$w = styled.button(responsiveRadiusStyle, buttonBaseStyles, buttonColorStyles);
5509
+ 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: var(--card-bg-color);\n border-radius: inherit;\n z-index: 1;\n box-shadow: inherit;\n"])));
4834
5510
  const Button = forwardRef(function Button2(props, ref) {
4835
5511
  const {
4836
5512
  children,
@@ -4856,6 +5532,7 @@ const Button = forwardRef(function Button2(props, ref) {
4856
5532
  tone = "default",
4857
5533
  type = "button",
4858
5534
  muted = false,
5535
+ width,
4859
5536
  ...restProps
4860
5537
  } = props;
4861
5538
  const justify = useArrayProp(justifyProp);
@@ -4879,7 +5556,7 @@ const Button = forwardRef(function Button2(props, ref) {
4879
5556
  paddingLeft,
4880
5557
  paddingRight
4881
5558
  }), [padding, paddingX, paddingY, paddingTop, paddingBottom, paddingLeft, paddingRight]);
4882
- return /* @__PURE__ */jsxs(Root$v, {
5559
+ return /* @__PURE__ */jsxs(Root$w, {
4883
5560
  "data-ui": "Button",
4884
5561
  ...restProps,
4885
5562
  $mode: mode,
@@ -4890,6 +5567,7 @@ const Button = forwardRef(function Button2(props, ref) {
4890
5567
  disabled: Boolean(loading || disabled),
4891
5568
  ref,
4892
5569
  type,
5570
+ $width: width,
4893
5571
  children: [Boolean(loading) && /* @__PURE__ */jsx(LoadingBox, {
4894
5572
  children: /* @__PURE__ */jsx(Spinner, {})
4895
5573
  }), (icon || text || iconRight) && /* @__PURE__ */jsx(Box, {
@@ -4924,12 +5602,12 @@ const Button = forwardRef(function Button2(props, ref) {
4924
5602
  })]
4925
5603
  });
4926
5604
  });
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())
5605
+ var __freeze$v = Object.freeze;
5606
+ var __defProp$w = Object.defineProperty;
5607
+ var __template$v = (cooked, raw) => __freeze$v(__defProp$w(cooked, "raw", {
5608
+ value: __freeze$v(raw || cooked.slice())
4931
5609
  }));
4932
- var _a$t, _b$i, _c$a;
5610
+ var _a$v, _b$j, _c$b;
4933
5611
  function cardStyle(props) {
4934
5612
  return [cardBaseStyle(props), cardColorStyle(props)];
4935
5613
  }
@@ -4939,7 +5617,7 @@ function cardBaseStyle(props) {
4939
5617
  theme
4940
5618
  } = props;
4941
5619
  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]));
5620
+ 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: -moz-available;\n width: -webkit-fill-available;\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: var(--card-bg-image);\n "])), space[3], space[3]));
4943
5621
  }
4944
5622
  function cardColorStyle(props) {
4945
5623
  var _a2, _b2;
@@ -4960,7 +5638,7 @@ function cardColorStyle(props) {
4960
5638
  width: 0,
4961
5639
  color: "var(--card-border-color)"
4962
5640
  };
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({
5641
+ return css(_c$b || (_c$b = __template$v(["\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
5642
  base,
4965
5643
  border,
4966
5644
  focusRing
@@ -4970,7 +5648,7 @@ function cardColorStyle(props) {
4970
5648
  focusRing
4971
5649
  }) : void 0, $focusRing ? focusRingBorderStyle(border) : void 0, (_b2 = (_a2 = theme.sanity.styles) == null ? void 0 : _a2.card) == null ? void 0 : _b2.root);
4972
5650
  }
4973
- const Root$u = styled(Box)(responsiveBorderStyle, responsiveRadiusStyle, responsiveShadowStyle, cardStyle);
5651
+ const Root$v = styled(Box)(responsiveBorderStyle, responsiveRadiusStyle, responsiveShadowStyle, cardStyle);
4974
5652
  const Card = forwardRef(function Card2(props, ref) {
4975
5653
  const {
4976
5654
  __unstable_checkered: checkered = false,
@@ -4995,7 +5673,7 @@ const Card = forwardRef(function Card2(props, ref) {
4995
5673
  return /* @__PURE__ */jsx(ThemeColorProvider, {
4996
5674
  scheme,
4997
5675
  tone,
4998
- children: /* @__PURE__ */jsx(Root$u, {
5676
+ children: /* @__PURE__ */jsx(Root$v, {
4999
5677
  "data-as": typeof as === "string" ? as : void 0,
5000
5678
  "data-scheme": rootTheme.scheme,
5001
5679
  "data-ui": "Card",
@@ -5020,14 +5698,14 @@ const Card = forwardRef(function Card2(props, ref) {
5020
5698
  })
5021
5699
  });
5022
5700
  });
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())
5701
+ var __freeze$u = Object.freeze;
5702
+ var __defProp$v = Object.defineProperty;
5703
+ var __template$u = (cooked, raw) => __freeze$u(__defProp$v(cooked, "raw", {
5704
+ value: __freeze$u(raw || cooked.slice())
5027
5705
  }));
5028
- var _a$s, _b$h;
5706
+ var _a$u, _b$i;
5029
5707
  function checkboxBaseStyles() {
5030
- return css(_a$s || (_a$s = __template$s(["\n position: relative;\n display: inline-block;\n "])));
5708
+ return css(_a$u || (_a$u = __template$u(["\n position: relative;\n display: inline-block;\n "])));
5031
5709
  }
5032
5710
  function inputElementStyles(props) {
5033
5711
  const {
@@ -5041,7 +5719,7 @@ function inputElementStyles(props) {
5041
5719
  const {
5042
5720
  focusRing
5043
5721
  } = 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({
5722
+ 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({
5045
5723
  color: color.default.enabled.border,
5046
5724
  width: input.border.width
5047
5725
  }), rem(radius[2]), color.default.enabled.bg, color.default.enabled.bg2, focusRingBorderStyle({
@@ -5074,7 +5752,7 @@ function inputElementStyles(props) {
5074
5752
  color: color.default.readOnly.border
5075
5753
  }), color.default.readOnly.fg, color.default.readOnly.bg2);
5076
5754
  }
5077
- const Root$t = styled.div(checkboxBaseStyles);
5755
+ const Root$u = styled.div(checkboxBaseStyles);
5078
5756
  const Input$5 = styled.input(inputElementStyles);
5079
5757
  const Checkbox = forwardRef(function Checkbox2(props, forwardedRef) {
5080
5758
  const {
@@ -5094,7 +5772,7 @@ const Checkbox = forwardRef(function Checkbox2(props, forwardedRef) {
5094
5772
  ref.current.indeterminate = indeterminate || false;
5095
5773
  }
5096
5774
  }, [indeterminate, ref]);
5097
- return /* @__PURE__ */jsxs(Root$t, {
5775
+ return /* @__PURE__ */jsxs(Root$u, {
5098
5776
  className,
5099
5777
  "data-ui": "Checkbox",
5100
5778
  style,
@@ -5112,16 +5790,16 @@ const Checkbox = forwardRef(function Checkbox2(props, forwardedRef) {
5112
5790
  })]
5113
5791
  });
5114
5792
  });
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())
5793
+ var __freeze$t = Object.freeze;
5794
+ var __defProp$u = Object.defineProperty;
5795
+ var __template$t = (cooked, raw) => __freeze$t(__defProp$u(cooked, "raw", {
5796
+ value: __freeze$t(raw || cooked.slice())
5119
5797
  }));
5120
- var _a$r;
5121
- function codeSyntaxHighlightingStyle(_ref20) {
5798
+ var _a$t;
5799
+ function codeSyntaxHighlightingStyle(_ref25) {
5122
5800
  let {
5123
5801
  theme
5124
- } = _ref20;
5802
+ } = _ref25;
5125
5803
  const color = theme.sanity.color.syntax;
5126
5804
  return {
5127
5805
  "&.atrule": {
@@ -5235,9 +5913,9 @@ function codeSyntaxHighlightingStyle(_ref20) {
5235
5913
  };
5236
5914
  }
5237
5915
  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);
5916
+ return css(_a$t || (_a$t = __template$t(["\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);
5239
5917
  }
5240
- const Root$s = styled.pre(codeBaseStyle, responsiveCodeFontStyle);
5918
+ const Root$t = styled.pre(codeBaseStyle, responsiveCodeFontStyle);
5241
5919
  const Code = forwardRef(function Code2(props, ref) {
5242
5920
  const {
5243
5921
  children,
@@ -5248,7 +5926,7 @@ const Code = forwardRef(function Code2(props, ref) {
5248
5926
  } = props;
5249
5927
  const language = typeof languageProp === "string" ? languageProp : void 0;
5250
5928
  const registered = language ? Refractor.hasLanguage(language) : false;
5251
- return /* @__PURE__ */jsxs(Root$s, {
5929
+ return /* @__PURE__ */jsxs(Root$t, {
5252
5930
  "data-ui": "Code",
5253
5931
  ...restProps,
5254
5932
  $size: useArrayProp(size),
@@ -5282,14 +5960,14 @@ function responsiveContainerWidthStyle(props) {
5282
5960
  maxWidth: val === "auto" ? "none" : rem(container[val])
5283
5961
  }));
5284
5962
  }
5285
- const Root$r = styled(Box)(containerBaseStyle, responsiveContainerWidthStyle);
5963
+ const Root$s = styled(Box)(containerBaseStyle, responsiveContainerWidthStyle);
5286
5964
  const Container = forwardRef(function Container2(props, ref) {
5287
5965
  const {
5288
5966
  as,
5289
5967
  width = 2,
5290
5968
  ...restProps
5291
5969
  } = props;
5292
- return /* @__PURE__ */jsx(Root$r, {
5970
+ return /* @__PURE__ */jsx(Root$s, {
5293
5971
  "data-ui": "Container",
5294
5972
  ...restProps,
5295
5973
  $width: useArrayProp(width),
@@ -5297,7 +5975,7 @@ const Container = forwardRef(function Container2(props, ref) {
5297
5975
  ref
5298
5976
  });
5299
5977
  });
5300
- const Root$q = styled(Box)(responsiveGridStyle);
5978
+ const Root$r = styled(Box)(responsiveGridStyle);
5301
5979
  const Grid = forwardRef(function Grid2(props, ref) {
5302
5980
  const {
5303
5981
  as,
@@ -5312,7 +5990,7 @@ const Grid = forwardRef(function Grid2(props, ref) {
5312
5990
  children,
5313
5991
  ...restProps
5314
5992
  } = props;
5315
- return /* @__PURE__ */jsx(Root$q, {
5993
+ return /* @__PURE__ */jsx(Root$r, {
5316
5994
  "data-as": typeof as === "string" ? as : void 0,
5317
5995
  "data-ui": "Grid",
5318
5996
  ...restProps,
@@ -5329,28 +6007,28 @@ const Grid = forwardRef(function Grid2(props, ref) {
5329
6007
  children
5330
6008
  });
5331
6009
  });
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())
6010
+ var __freeze$s = Object.freeze;
6011
+ var __defProp$t = Object.defineProperty;
6012
+ var __template$s = (cooked, raw) => __freeze$s(__defProp$t(cooked, "raw", {
6013
+ value: __freeze$s(raw || cooked.slice())
5336
6014
  }));
5337
- var _a$q, _b$g, _c$9;
6015
+ var _a$s, _b$h, _c$a;
5338
6016
  function headingBaseStyle(props) {
5339
6017
  const {
5340
6018
  $accent,
5341
6019
  $muted,
5342
6020
  theme
5343
6021
  } = 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);
6022
+ 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: 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$s || (_a$s = __template$s(["\n color: var(--card-accent-fg-color);\n "]))), $muted && css(_b$h || (_b$h = __template$s(["\n color: var(--card-muted-fg-color);\n "]))), theme.sanity.fonts.code.family);
5345
6023
  }
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())
6024
+ var __freeze$r = Object.freeze;
6025
+ var __defProp$s = Object.defineProperty;
6026
+ var __template$r = (cooked, raw) => __freeze$r(__defProp$s(cooked, "raw", {
6027
+ value: __freeze$r(raw || cooked.slice())
5350
6028
  }));
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"])));
6029
+ var _a$r;
6030
+ const Root$q = styled.div(headingBaseStyle, responsiveTextAlignStyle, responsiveHeadingFont);
6031
+ 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
6032
  const Heading = forwardRef(function Heading2(props, ref) {
5355
6033
  const {
5356
6034
  accent = false,
@@ -5364,11 +6042,11 @@ const Heading = forwardRef(function Heading2(props, ref) {
5364
6042
  } = props;
5365
6043
  let children = childrenProp;
5366
6044
  if (textOverflow === "ellipsis") {
5367
- children = /* @__PURE__ */jsx(SpanWithTextOverflow, {
6045
+ children = /* @__PURE__ */jsx(SpanWithTextOverflow$1, {
5368
6046
  children
5369
6047
  });
5370
6048
  }
5371
- return /* @__PURE__ */jsx(Root$p, {
6049
+ return /* @__PURE__ */jsx(Root$q, {
5372
6050
  "data-ui": "Heading",
5373
6051
  ...restProps,
5374
6052
  $accent: accent,
@@ -5408,7 +6086,7 @@ function inlineSpaceStyle(props) {
5408
6086
  };
5409
6087
  });
5410
6088
  }
5411
- const Root$o = styled(Box)(inlineBaseStyle, inlineSpaceStyle);
6089
+ const Root$p = styled(Box)(inlineBaseStyle, inlineSpaceStyle);
5412
6090
  const Inline = forwardRef(function Inline2(props, ref) {
5413
6091
  const {
5414
6092
  as,
@@ -5419,7 +6097,7 @@ const Inline = forwardRef(function Inline2(props, ref) {
5419
6097
  const children = useMemo(() => childrenToElementArray(childrenProp).filter(Boolean).map((child, idx) => /* @__PURE__ */jsx("div", {
5420
6098
  children: child
5421
6099
  }, idx)), [childrenProp]);
5422
- return /* @__PURE__ */jsx(Root$o, {
6100
+ return /* @__PURE__ */jsx(Root$p, {
5423
6101
  "data-ui": "Inline",
5424
6102
  ...restProps,
5425
6103
  $space: useArrayProp(space),
@@ -5428,16 +6106,16 @@ const Inline = forwardRef(function Inline2(props, ref) {
5428
6106
  children
5429
6107
  });
5430
6108
  });
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())
6109
+ var __freeze$q = Object.freeze;
6110
+ var __defProp$r = Object.defineProperty;
6111
+ var __template$q = (cooked, raw) => __freeze$q(__defProp$r(cooked, "raw", {
6112
+ value: __freeze$q(raw || cooked.slice())
5435
6113
  }));
5436
- var _a$o;
6114
+ var _a$q;
5437
6115
  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 "])));
6116
+ return css(_a$q || (_a$q = __template$q(["\n background: var(--card-bg2-color);\n font: inherit;\n\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
5439
6117
  }
5440
- const Root$n = styled.kbd(responsiveRadiusStyle, kbdStyle);
6118
+ const Root$o = styled.kbd(responsiveRadiusStyle, kbdStyle);
5441
6119
  const KBD = forwardRef(function KBD2(props, ref) {
5442
6120
  const {
5443
6121
  children,
@@ -5446,7 +6124,7 @@ const KBD = forwardRef(function KBD2(props, ref) {
5446
6124
  radius = 2,
5447
6125
  ...restProps
5448
6126
  } = props;
5449
- return /* @__PURE__ */jsx(Root$n, {
6127
+ return /* @__PURE__ */jsx(Root$o, {
5450
6128
  "data-ui": "KBD",
5451
6129
  ...restProps,
5452
6130
  $radius: useArrayProp(radius),
@@ -5464,6 +6142,64 @@ const KBD = forwardRef(function KBD2(props, ref) {
5464
6142
  })
5465
6143
  });
5466
6144
  });
6145
+ var __freeze$p = Object.freeze;
6146
+ var __defProp$q = Object.defineProperty;
6147
+ var __template$p = (cooked, raw) => __freeze$p(__defProp$q(cooked, "raw", {
6148
+ value: __freeze$p(raw || cooked.slice())
6149
+ }));
6150
+ var _a$p, _b$g, _c$9;
6151
+ function labelBaseStyle(props) {
6152
+ const {
6153
+ $accent,
6154
+ $muted,
6155
+ theme
6156
+ } = props;
6157
+ const {
6158
+ fonts
6159
+ } = theme.sanity;
6160
+ 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: var(--card-accent-fg-color);\n "]))), $muted && css(_b$g || (_b$g = __template$p(["\n color: var(--card-muted-fg-color);\n "]))), fonts.code.family);
6161
+ }
6162
+ var __freeze$o = Object.freeze;
6163
+ var __defProp$p = Object.defineProperty;
6164
+ var __template$o = (cooked, raw) => __freeze$o(__defProp$p(cooked, "raw", {
6165
+ value: __freeze$o(raw || cooked.slice())
6166
+ }));
6167
+ var _a$o;
6168
+ const Root$n = styled.div(responsiveLabelFont, responsiveTextAlignStyle, labelBaseStyle);
6169
+ 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"])));
6170
+ const Label = forwardRef(function Label2(props, ref) {
6171
+ const {
6172
+ accent,
6173
+ align,
6174
+ children: childrenProp,
6175
+ muted = false,
6176
+ size = 2,
6177
+ textOverflow,
6178
+ weight,
6179
+ ...restProps
6180
+ } = props;
6181
+ let children = childrenProp;
6182
+ if (textOverflow === "ellipsis") {
6183
+ children = /* @__PURE__ */jsx(SpanWithTextOverflow, {
6184
+ children
6185
+ });
6186
+ } else {
6187
+ children = /* @__PURE__ */jsx("span", {
6188
+ children
6189
+ });
6190
+ }
6191
+ return /* @__PURE__ */jsx(Root$n, {
6192
+ "data-ui": "Label",
6193
+ ...restProps,
6194
+ $accent: accent,
6195
+ $align: useArrayProp(align),
6196
+ $muted: muted,
6197
+ $size: useArrayProp(size),
6198
+ $weight: weight,
6199
+ ref,
6200
+ children
6201
+ });
6202
+ });
5467
6203
  const key$7 = Symbol.for("@sanity/ui/context/boundaryElement");
5468
6204
  globalScope[key$7] = globalScope[key$7] || createContext(null);
5469
6205
  const BoundaryElementContext = globalScope[key$7];
@@ -6371,13 +7107,13 @@ const Popover = memo(forwardRef(function Popover2(props, ref) {
6371
7107
  }));
6372
7108
  if (constrainSize || matchReferenceWidth) {
6373
7109
  ret.push(size({
6374
- apply(_ref21) {
7110
+ apply(_ref26) {
6375
7111
  let {
6376
7112
  availableWidth,
6377
7113
  availableHeight,
6378
7114
  elements,
6379
7115
  referenceWidth
6380
- } = _ref21;
7116
+ } = _ref26;
6381
7117
  referenceWidthRef.current = referenceWidth;
6382
7118
  const _currentWidth = widthRef.current;
6383
7119
  const _maxWidth = maxWidthRef.current;
@@ -6579,7 +7315,7 @@ var __template$j = (cooked, raw) => __freeze$j(__defProp$j(cooked, "raw", {
6579
7315
  }));
6580
7316
  var _a$j, _b$c, _c$7, _d$5;
6581
7317
  function rootStyle() {
6582
- return css(_a$j || (_a$j = __template$j(["\n position: relative;\n width: stretch;\n\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
7318
+ return css(_a$j || (_a$j = __template$j(["\n position: relative;\n width: -moz-available;\n width: -webkit-fill-available;\n width: stretch;\n\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
6583
7319
  }
6584
7320
  function inputBaseStyle(props) {
6585
7321
  const {
@@ -6842,7 +7578,7 @@ const TextArea = forwardRef(function TextArea2(props, forwardedRef) {
6842
7578
  disabled = false,
6843
7579
  fontSize = 2,
6844
7580
  padding = 3,
6845
- radius = 1,
7581
+ radius = 2,
6846
7582
  weight,
6847
7583
  ...restProps
6848
7584
  } = props;
@@ -6907,6 +7643,7 @@ const TextInputClearButton = styled(Button)({
6907
7643
  });
6908
7644
  const TextInput = forwardRef(function TextInput2(props, forwardedRef) {
6909
7645
  const {
7646
+ __unstable_disableFocusRing,
6910
7647
  border = true,
6911
7648
  clearButton,
6912
7649
  disabled = false,
@@ -6916,7 +7653,7 @@ const TextInput = forwardRef(function TextInput2(props, forwardedRef) {
6916
7653
  onClear,
6917
7654
  padding: paddingProp = 3,
6918
7655
  prefix,
6919
- radius: radiusProp = 1,
7656
+ radius: radiusProp = 2,
6920
7657
  readOnly,
6921
7658
  space: spaceProp = 3,
6922
7659
  suffix,
@@ -6961,6 +7698,7 @@ const TextInput = forwardRef(function TextInput2(props, forwardedRef) {
6961
7698
  }), [prefix, radius]);
6962
7699
  const presentationNode = useMemo(() => /* @__PURE__ */jsxs(Presentation, {
6963
7700
  $hasPrefix,
7701
+ $unstableDisableFocusRing: __unstable_disableFocusRing,
6964
7702
  $hasSuffix,
6965
7703
  $radius: radius,
6966
7704
  $scheme: rootTheme.scheme,
@@ -6981,7 +7719,7 @@ const TextInput = forwardRef(function TextInput2(props, forwardedRef) {
6981
7719
  children: [isValidElement(iconRight) && iconRight, isValidElementType(iconRight) && createElement(iconRight)]
6982
7720
  })
6983
7721
  })]
6984
- }), [border, fontSize, icon, iconRight, padding, radius, rootTheme, $hasClearButton, $hasPrefix, $hasSuffix]);
7722
+ }), [__unstable_disableFocusRing, border, fontSize, icon, iconRight, padding, radius, rootTheme, $hasClearButton, $hasPrefix, $hasSuffix]);
6985
7723
  const clearButtonBoxPadding = useMemo(() => padding.map(v => {
6986
7724
  if (v === 0) return 0;
6987
7725
  if (v === 1) return 1;
@@ -7065,6 +7803,7 @@ function useDelayedState(initialState) {
7065
7803
  }, []);
7066
7804
  return [state, onStateChange];
7067
7805
  }
7806
+ const DEFAULT_TOOLTIP_PADDING = 4;
7068
7807
  const DEFAULT_FALLBACK_PLACEMENTS = {
7069
7808
  top: ["bottom", "left", "right"],
7070
7809
  "top-start": ["bottom-start", "left-start", "right-start"],
@@ -7148,9 +7887,14 @@ var __template$e = (cooked, raw) => __freeze$e(__defProp$e(cooked, "raw", {
7148
7887
  value: __freeze$e(raw || cooked.slice())
7149
7888
  }));
7150
7889
  var _a$e;
7151
- const Root$a = styled(Layer)(_a$e || (_a$e = __template$e(["\n pointer-events: none;\n"])));
7890
+ const Root$a = styled(Layer)(_a$e || (_a$e = __template$e(["\n pointer-events: none;\n max-width: ", "px;\n"])), _ref27 => {
7891
+ let {
7892
+ $maxWidth
7893
+ } = _ref27;
7894
+ return $maxWidth;
7895
+ });
7152
7896
  const Tooltip = forwardRef(function Tooltip2(props, ref) {
7153
- var _a2, _b, _c, _d, _e;
7897
+ var _a2, _b, _c, _d, _e, _f;
7154
7898
  const boundaryElementContext = useBoundaryElement();
7155
7899
  const theme = useTheme();
7156
7900
  const {
@@ -7161,7 +7905,7 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
7161
7905
  fallbackPlacements: fallbackPlacementsProp = (_b = props.fallbackPlacements) != null ? _b : DEFAULT_FALLBACK_PLACEMENTS[(_a2 = props.placement) != null ? _a2 : "bottom"],
7162
7906
  padding = 3,
7163
7907
  placement: placementProp = "bottom",
7164
- portal,
7908
+ portal: portalProp,
7165
7909
  scheme,
7166
7910
  shadow = 2,
7167
7911
  zOffset = (_c = theme.sanity.layer) == null ? void 0 : _c.tooltip.zOffset,
@@ -7173,38 +7917,27 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
7173
7917
  const [referenceElement, setReferenceElement] = useState(null);
7174
7918
  const arrowRef = useRef(null);
7175
7919
  const rootBoundary = "viewport";
7920
+ const portal = usePortal();
7921
+ const portalElement = typeof portalProp === "string" ? ((_d = portal.elements) == null ? void 0 : _d[portalProp]) || null : portal.element;
7922
+ const tooltipWidth = useMemo(() => {
7923
+ const availableWidths = [...(boundaryElement ? [boundaryElement.offsetWidth] : []), (portalElement == null ? void 0 : portalElement.offsetWidth) || document.body.offsetWidth];
7924
+ return Math.min(...availableWidths) - DEFAULT_TOOLTIP_PADDING * 2;
7925
+ }, [boundaryElement, portalElement == null ? void 0 : portalElement.offsetWidth]);
7176
7926
  const middleware = useMemo(() => {
7177
7927
  const ret = [];
7178
7928
  ret.push(flip({
7179
7929
  boundary: boundaryElement || void 0,
7180
7930
  fallbackPlacements,
7181
- padding: 4,
7182
- rootBoundary,
7183
- mainAxis: false
7931
+ padding: DEFAULT_TOOLTIP_PADDING,
7932
+ rootBoundary
7184
7933
  }));
7185
7934
  ret.push(offset({
7186
7935
  mainAxis: 3
7187
7936
  }));
7188
- ret.push(size$2({
7189
- apply(_ref22) {
7190
- let {
7191
- availableWidth,
7192
- availableHeight,
7193
- elements
7194
- } = _ref22;
7195
- Object.assign(elements.floating.style, {
7196
- maxWidth: "".concat(availableWidth - 4 * 2, "px"),
7197
- // the padding is `4px`
7198
- maxHeight: "".concat(availableHeight - 4 * 2, "px")
7199
- // the padding is `4px`
7200
- });
7201
- }
7202
- }));
7203
-
7204
7937
  ret.push(shift({
7205
7938
  boundary: boundaryElement || void 0,
7206
7939
  rootBoundary,
7207
- padding: 4
7940
+ padding: DEFAULT_TOOLTIP_PADDING
7208
7941
  }));
7209
7942
  ret.push(arrow({
7210
7943
  element: arrowRef,
@@ -7224,8 +7957,8 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
7224
7957
  whileElementsMounted: autoUpdate
7225
7958
  });
7226
7959
  const staticSide = placement && FLOATING_STATIC_SIDES[placement.split("-")[0]];
7227
- const arrowX = (_d = middlewareData.arrow) == null ? void 0 : _d.x;
7228
- const arrowY = (_e = middlewareData.arrow) == null ? void 0 : _e.y;
7960
+ const arrowX = (_e = middlewareData.arrow) == null ? void 0 : _e.x;
7961
+ const arrowY = (_f = middlewareData.arrow) == null ? void 0 : _f.y;
7229
7962
  const arrowStyle = useMemo(() => {
7230
7963
  const style = {
7231
7964
  left: arrowX !== null ? arrowX : void 0,
@@ -7245,25 +7978,53 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
7245
7978
  const closeDelayProp = typeof delay === "number" ? delay : (delay == null ? void 0 : delay.close) || 0;
7246
7979
  const openDelay = isInsideGroup ? delayGroupContext.openDelay : openDelayProp;
7247
7980
  const closeDelay = isInsideGroup ? delayGroupContext.closeDelay : closeDelayProp;
7248
- const handleIsOpenChange = useCallback(open => {
7981
+ const handleIsOpenChange = useCallback((open, immediate) => {
7249
7982
  if (isInsideGroup) {
7250
7983
  if (open) {
7251
- delayGroupContext.setIsGroupActive(open, openDelay);
7252
- delayGroupContext.setOpenTooltipId(tooltipId, openDelay);
7984
+ const groupedOpenDelay = immediate ? 0 : openDelay;
7985
+ delayGroupContext.setIsGroupActive(open, groupedOpenDelay);
7986
+ delayGroupContext.setOpenTooltipId(tooltipId, groupedOpenDelay);
7253
7987
  } else {
7254
7988
  const minimumGroupDeactivateDelay = 200;
7255
7989
  const groupDeactivateDelay = closeDelay > minimumGroupDeactivateDelay ? closeDelay : minimumGroupDeactivateDelay;
7256
7990
  delayGroupContext.setIsGroupActive(open, groupDeactivateDelay);
7257
- delayGroupContext.setOpenTooltipId(null, closeDelay);
7991
+ delayGroupContext.setOpenTooltipId(null, immediate ? 0 : closeDelay);
7258
7992
  }
7259
7993
  } else {
7260
- setIsOpen(open, open ? openDelay : closeDelay);
7994
+ const standaloneDelay = immediate ? 0 : open ? openDelay : closeDelay;
7995
+ setIsOpen(open, standaloneDelay);
7261
7996
  }
7262
7997
  }, [isInsideGroup, delayGroupContext, openDelay, tooltipId, closeDelay, setIsOpen]);
7263
- const handleBlur = useCallback(() => handleIsOpenChange(false), [handleIsOpenChange]);
7264
- const handleFocus = useCallback(() => handleIsOpenChange(true), [handleIsOpenChange]);
7265
- const handleMouseEnter = useCallback(() => handleIsOpenChange(true), [handleIsOpenChange]);
7266
- const handleMouseLeave = useCallback(() => handleIsOpenChange(false), [handleIsOpenChange]);
7998
+ const handleBlur = useCallback(e => {
7999
+ var _a3, _b2;
8000
+ handleIsOpenChange(false);
8001
+ (_b2 = (_a3 = childProp == null ? void 0 : childProp.props) == null ? void 0 : _a3.onBlur) == null ? void 0 : _b2.call(_a3, e);
8002
+ }, [childProp == null ? void 0 : childProp.props, handleIsOpenChange]);
8003
+ const handleClick = useCallback(e => {
8004
+ var _a3, _b2;
8005
+ handleIsOpenChange(false, true);
8006
+ (_b2 = childProp == null ? void 0 : (_a3 = childProp.props).onClick) == null ? void 0 : _b2.call(_a3, e);
8007
+ }, [childProp == null ? void 0 : childProp.props, handleIsOpenChange]);
8008
+ const handleContextMenu = useCallback(e => {
8009
+ var _a3, _b2;
8010
+ handleIsOpenChange(false, true);
8011
+ (_b2 = childProp == null ? void 0 : (_a3 = childProp.props).onContextMenu) == null ? void 0 : _b2.call(_a3, e);
8012
+ }, [childProp == null ? void 0 : childProp.props, handleIsOpenChange]);
8013
+ const handleFocus = useCallback(e => {
8014
+ var _a3, _b2;
8015
+ handleIsOpenChange(true);
8016
+ (_b2 = (_a3 = childProp == null ? void 0 : childProp.props) == null ? void 0 : _a3.onFocus) == null ? void 0 : _b2.call(_a3, e);
8017
+ }, [childProp == null ? void 0 : childProp.props, handleIsOpenChange]);
8018
+ const handleMouseEnter = useCallback(e => {
8019
+ var _a3, _b2;
8020
+ handleIsOpenChange(true);
8021
+ (_b2 = (_a3 = childProp == null ? void 0 : childProp.props) == null ? void 0 : _a3.onMouseEnter) == null ? void 0 : _b2.call(_a3, e);
8022
+ }, [childProp == null ? void 0 : childProp.props, handleIsOpenChange]);
8023
+ const handleMouseLeave = useCallback(e => {
8024
+ var _a3, _b2;
8025
+ handleIsOpenChange(false);
8026
+ (_b2 = (_a3 = childProp == null ? void 0 : childProp.props) == null ? void 0 : _a3.onMouseLeave) == null ? void 0 : _b2.call(_a3, e);
8027
+ }, [childProp == null ? void 0 : childProp.props, handleIsOpenChange]);
7267
8028
  useEffect(() => {
7268
8029
  if (!isOpen) return;
7269
8030
  function handleWindowMouseMove(event) {
@@ -7286,6 +8047,18 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
7286
8047
  if (!content) handleIsOpenChange(false);
7287
8048
  }, [content, handleIsOpenChange]);
7288
8049
  useEffect(() => refs.setReference(referenceElement), [referenceElement, refs]);
8050
+ useEffect(() => {
8051
+ if (!showTooltip) return;
8052
+ function handleWindowKeyDown(event) {
8053
+ if (event.key === "Escape") {
8054
+ handleIsOpenChange(false, true);
8055
+ }
8056
+ }
8057
+ window.addEventListener("keydown", handleWindowKeyDown);
8058
+ return () => {
8059
+ window.removeEventListener("keydown", handleWindowKeyDown);
8060
+ };
8061
+ }, [handleIsOpenChange, showTooltip]);
7289
8062
  const setArrow = useCallback(arrowEl => {
7290
8063
  arrowRef.current = arrowEl;
7291
8064
  update();
@@ -7310,9 +8083,11 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
7310
8083
  onFocus: handleFocus,
7311
8084
  onMouseEnter: handleMouseEnter,
7312
8085
  onMouseLeave: handleMouseLeave,
8086
+ onClick: handleClick,
8087
+ onContextMenu: handleContextMenu,
7313
8088
  ref: setReference
7314
8089
  });
7315
- }, [childProp, handleBlur, handleFocus, handleMouseEnter, handleMouseLeave, setReference]);
8090
+ }, [childProp, handleBlur, handleClick, handleContextMenu, handleFocus, handleMouseEnter, handleMouseLeave, setReference]);
7316
8091
  if (!child) return /* @__PURE__ */jsx(Fragment, {});
7317
8092
  if (disabled) return child;
7318
8093
  const root = /* @__PURE__ */jsx(Root$a, {
@@ -7321,6 +8096,7 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
7321
8096
  ref: setFloating,
7322
8097
  style: floatingStyles,
7323
8098
  zOffset,
8099
+ $maxWidth: tooltipWidth,
7324
8100
  children: /* @__PURE__ */jsxs(Card, {
7325
8101
  "data-ui": "Tooltip__card",
7326
8102
  "data-placement": placement,
@@ -7336,8 +8112,8 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
7336
8112
  });
7337
8113
  return /* @__PURE__ */jsxs(Fragment, {
7338
8114
  children: [child, showTooltip && /* @__PURE__ */jsx(Fragment, {
7339
- children: portal ? /* @__PURE__ */jsx(Portal, {
7340
- __unstable_name: typeof portal === "string" ? portal : void 0,
8115
+ children: portalProp ? /* @__PURE__ */jsx(Portal, {
8116
+ __unstable_name: typeof portalProp === "string" ? portalProp : void 0,
7341
8117
  children: root
7342
8118
  }) : root
7343
8119
  })]
@@ -7497,10 +8273,10 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete2(props, ref) {
7497
8273
  query,
7498
8274
  value
7499
8275
  } = state;
7500
- const defaultRenderOption = useCallback(_ref23 => {
8276
+ const defaultRenderOption = useCallback(_ref28 => {
7501
8277
  let {
7502
8278
  value: value2
7503
- } = _ref23;
8279
+ } = _ref28;
7504
8280
  return /* @__PURE__ */jsx(Card, {
7505
8281
  "data-as": "button",
7506
8282
  padding: paddingProp,
@@ -7953,10 +8729,11 @@ const Breadcrumbs = forwardRef(function Breadcrumbs2(props, ref) {
7953
8729
  }, itemIndex))
7954
8730
  });
7955
8731
  });
7956
- function dialogStyle(_ref24) {
8732
+ const BORDER_OFFSET_X = 12;
8733
+ function dialogStyle(_ref29) {
7957
8734
  let {
7958
8735
  theme
7959
- } = _ref24;
8736
+ } = _ref29;
7960
8737
  const color = theme.sanity.color.base;
7961
8738
  return {
7962
8739
  "&:not([hidden])": {
@@ -8007,9 +8784,9 @@ const Root$7 = styled(Layer)(responsivePaddingStyle, dialogStyle, responsiveDial
8007
8784
  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"])));
8008
8785
  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"])));
8009
8786
  const DialogLayout = styled(Flex)(_c$2 || (_c$2 = __template$b(["\n flex: 1;\n min-height: 0;\n width: 100%;\n"])));
8010
- 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: 0;\n right: 0;\n bottom: -1px;\n border-bottom: 1px solid var(--card-hairline-soft-color);\n }\n"])));
8787
+ const DialogHeader = styled(Box)(_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);
8011
8788
  const DialogContent = styled(Box)(_e || (_e = __template$b(["\n position: relative;\n z-index: 1;\n overflow: auto;\n outline: none;\n"])));
8012
- const DialogFooter = styled(Box)(_f || (_f = __template$b(["\n position: relative;\n z-index: 3;\n border-top: 1px solid var(--card-hairline-soft-color);\n"])));
8789
+ 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);
8013
8790
  const DialogCard = forwardRef(function DialogCard2(props, ref) {
8014
8791
  var _a2;
8015
8792
  const {
@@ -8044,6 +8821,9 @@ const DialogCard = forwardRef(function DialogCard2(props, ref) {
8044
8821
  const labelId = "".concat(id, "_label");
8045
8822
  const showCloseButton = Boolean(onClose) && hideCloseButton === false;
8046
8823
  const showHeader = Boolean(header) || showCloseButton;
8824
+ const [isContentScrollable, setIsContentScrollable] = useState(false);
8825
+ const [hasScrolledFromTop, setHasScrolledFromTop] = useState(false);
8826
+ const [hasScrolledToBottom, setHasScrolledToBottom] = useState(false);
8047
8827
  useEffect(() => {
8048
8828
  if (!autoFocus) return;
8049
8829
  if (forwardedRef.current) {
@@ -8078,6 +8858,22 @@ const DialogCard = forwardRef(function DialogCard2(props, ref) {
8078
8858
  localContentRef.current = el;
8079
8859
  if (typeof contentRef === "function") contentRef(el);else if (contentRef) contentRef.current = el;
8080
8860
  }, [contentRef]);
8861
+ const handleContentUpdate = useCallback(() => {
8862
+ if (localContentRef.current) {
8863
+ setIsContentScrollable(localContentRef.current.clientHeight < localContentRef.current.scrollHeight);
8864
+ setHasScrolledFromTop(localContentRef.current.scrollTop > 0);
8865
+ setHasScrolledToBottom(localContentRef.current.scrollTop >= localContentRef.current.scrollHeight - localContentRef.current.clientHeight);
8866
+ }
8867
+ }, []);
8868
+ useEffect(() => {
8869
+ const resizeObserver = new ResizeObserver(handleContentUpdate);
8870
+ if (localContentRef.current) {
8871
+ resizeObserver.observe(localContentRef.current);
8872
+ }
8873
+ return () => {
8874
+ resizeObserver.disconnect();
8875
+ };
8876
+ }, [contentRef, handleContentUpdate]);
8081
8877
  return /* @__PURE__ */jsx(DialogContainer, {
8082
8878
  "data-ui": "DialogCard",
8083
8879
  width,
@@ -8089,24 +8885,28 @@ const DialogCard = forwardRef(function DialogCard2(props, ref) {
8089
8885
  children: /* @__PURE__ */jsxs(DialogLayout, {
8090
8886
  direction: "column",
8091
8887
  children: [showHeader && /* @__PURE__ */jsx(DialogHeader, {
8888
+ $isContentScrollable: isContentScrollable,
8889
+ $hasScrolledFromTop: hasScrolledFromTop,
8092
8890
  children: /* @__PURE__ */jsxs(Flex, {
8891
+ align: "center",
8093
8892
  children: [/* @__PURE__ */jsx(Box, {
8094
8893
  flex: 1,
8894
+ margin: 1,
8095
8895
  padding: 4,
8096
8896
  children: header && /* @__PURE__ */jsx(Text, {
8097
8897
  id: labelId,
8098
- weight: "semibold",
8898
+ size: 1,
8899
+ weight: "medium",
8099
8900
  children: header
8100
8901
  })
8101
8902
  }), showCloseButton && /* @__PURE__ */jsx(Box, {
8102
- padding: 2,
8903
+ padding: 3,
8103
8904
  children: /* @__PURE__ */jsx(Button, {
8104
8905
  "aria-label": "Close dialog",
8105
8906
  disabled: !onClose,
8106
8907
  icon: CloseIcon,
8107
8908
  mode: "bleed",
8108
- onClick: onClose,
8109
- padding: 3
8909
+ onClick: onClose
8110
8910
  })
8111
8911
  })]
8112
8912
  })
@@ -8114,8 +8914,11 @@ const DialogCard = forwardRef(function DialogCard2(props, ref) {
8114
8914
  flex: 1,
8115
8915
  ref: setContentRef,
8116
8916
  tabIndex: -1,
8917
+ onScroll: handleContentUpdate,
8117
8918
  children
8118
8919
  }), footer && /* @__PURE__ */jsx(DialogFooter, {
8920
+ $isContentScrollable: isContentScrollable,
8921
+ $hasScrolledToBottom: hasScrolledToBottom,
8119
8922
  children: footer
8120
8923
  })]
8121
8924
  })
@@ -8734,7 +9537,7 @@ var __template$7 = (cooked, raw) => __freeze$7(__defProp$7(cooked, "raw", {
8734
9537
  }));
8735
9538
  var _a$7, _b$4;
8736
9539
  function selectableBaseStyle() {
8737
- return css(_a$7 || (_a$7 = __template$7(["\n background-color: inherit;\n color: inherit;\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 text-decoration: none;\n }\n "])));
9540
+ return css(_a$7 || (_a$7 = __template$7(["\n background-color: inherit;\n color: inherit;\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: -moz-available;\n width: -webkit-fill-available;\n width: stretch;\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n text-decoration: none;\n }\n "])));
8738
9541
  }
8739
9542
  function selectableColorStyle(props) {
8740
9543
  var _a2, _b2;
@@ -8748,7 +9551,7 @@ function selectableColorStyle(props) {
8748
9551
  selectable
8749
9552
  } = theme.sanity.color;
8750
9553
  const tone = selectable ? selectable[$tone] || selectable.default : muted[$tone] || muted.default;
8751
- 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);
9554
+ 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 &: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);
8752
9555
  }
8753
9556
  const Selectable = styled(Box)(responsiveRadiusStyle, selectableBaseStyle, selectableColorStyle);
8754
9557
  function useMenu() {
@@ -8765,7 +9568,7 @@ function MenuGroup(props) {
8765
9568
  const {
8766
9569
  as = "button",
8767
9570
  children,
8768
- fontSize,
9571
+ fontSize = 1,
8769
9572
  icon,
8770
9573
  onClick,
8771
9574
  padding = 3,
@@ -8777,6 +9580,9 @@ function MenuGroup(props) {
8777
9580
  ...restProps
8778
9581
  } = props;
8779
9582
  const menu = useMenu();
9583
+ const {
9584
+ scheme
9585
+ } = useRootTheme();
8780
9586
  const {
8781
9587
  activeElement,
8782
9588
  mount,
@@ -8865,34 +9671,31 @@ function MenuGroup(props) {
8865
9671
  "data-selected": !withinMenu && active ? "" : void 0,
8866
9672
  $radius: useArrayProp(radius),
8867
9673
  $tone: tone,
9674
+ $scheme: scheme,
8868
9675
  onClick: handleClick,
8869
9676
  onKeyDown: handleKeyDown,
8870
9677
  onMouseEnter: handleMouseEnter,
8871
9678
  ref: setRootElement,
8872
9679
  tabIndex: -1,
8873
9680
  type: as === "button" ? "button" : void 0,
8874
- children: /* @__PURE__ */jsx(Box, {
9681
+ children: /* @__PURE__ */jsxs(Flex, {
9682
+ gap: space,
8875
9683
  padding,
8876
- children: /* @__PURE__ */jsxs(Flex, {
8877
- children: [icon && /* @__PURE__ */jsxs(Text, {
9684
+ children: [icon && /* @__PURE__ */jsxs(Text, {
9685
+ size: fontSize,
9686
+ children: [isValidElement(icon) && icon, isValidElementType(icon) && createElement(icon)]
9687
+ }), /* @__PURE__ */jsx(Box, {
9688
+ flex: 1,
9689
+ children: /* @__PURE__ */jsx(Text, {
8878
9690
  size: fontSize,
8879
- children: [isValidElement(icon) && icon, isValidElementType(icon) && createElement(icon)]
8880
- }), /* @__PURE__ */jsx(Box, {
8881
- flex: 1,
8882
- marginLeft: icon ? space : void 0,
8883
- children: /* @__PURE__ */jsx(Text, {
8884
- size: fontSize,
8885
- textOverflow: "ellipsis",
8886
- children: text
8887
- })
8888
- }), /* @__PURE__ */jsx(Box, {
8889
- marginLeft: space,
8890
- children: /* @__PURE__ */jsx(Text, {
8891
- size: fontSize,
8892
- children: /* @__PURE__ */jsx(ChevronRightIcon, {})
8893
- })
8894
- })]
8895
- })
9691
+ textOverflow: "ellipsis",
9692
+ weight: "medium",
9693
+ children: text
9694
+ })
9695
+ }), /* @__PURE__ */jsx(Text, {
9696
+ size: fontSize,
9697
+ children: /* @__PURE__ */jsx(ChevronRightIcon, {})
9698
+ })]
8896
9699
  })
8897
9700
  })
8898
9701
  });
@@ -8902,7 +9705,7 @@ const MenuItem = forwardRef(function MenuItem2(props, forwardedRef) {
8902
9705
  as = "button",
8903
9706
  children,
8904
9707
  disabled,
8905
- fontSize = 2,
9708
+ fontSize = 1,
8906
9709
  hotkeys,
8907
9710
  icon,
8908
9711
  iconRight,
@@ -8922,6 +9725,9 @@ const MenuItem = forwardRef(function MenuItem2(props, forwardedRef) {
8922
9725
  tone = "default",
8923
9726
  ...restProps
8924
9727
  } = props;
9728
+ const {
9729
+ scheme
9730
+ } = useRootTheme();
8925
9731
  const menu = useMenu();
8926
9732
  const {
8927
9733
  activeElement,
@@ -8962,7 +9768,8 @@ const MenuItem = forwardRef(function MenuItem2(props, forwardedRef) {
8962
9768
  forwardedAs: as,
8963
9769
  $radius: useArrayProp(radius),
8964
9770
  $padding: useArrayProp(0),
8965
- $tone: tone,
9771
+ $tone: disabled ? "default" : tone,
9772
+ $scheme: scheme,
8966
9773
  disabled,
8967
9774
  onClick: handleClick,
8968
9775
  onMouseEnter: onItemMouseEnter,
@@ -8971,38 +9778,33 @@ const MenuItem = forwardRef(function MenuItem2(props, forwardedRef) {
8971
9778
  role: "menuitem",
8972
9779
  tabIndex: -1,
8973
9780
  type: as === "button" ? "button" : void 0,
8974
- children: [(icon || text || iconRight) && /* @__PURE__ */jsx(Box, {
9781
+ children: [(icon || text || iconRight) && /* @__PURE__ */jsxs(Flex, {
8975
9782
  as: "span",
9783
+ gap: space,
9784
+ align: "center",
8976
9785
  ...paddingProps,
8977
- children: /* @__PURE__ */jsxs(Flex, {
8978
- as: "span",
8979
- children: [icon && /* @__PURE__ */jsxs(Text, {
8980
- size: fontSize,
8981
- children: [isValidElement(icon) && icon, isValidElementType(icon) && createElement(icon)]
8982
- }), text && /* @__PURE__ */jsx(Box, {
8983
- flex: 1,
8984
- marginLeft: icon ? space : void 0,
8985
- marginRight: iconRight ? space : void 0,
8986
- children: /* @__PURE__ */jsx(Text, {
8987
- size: fontSize,
8988
- textOverflow: "ellipsis",
8989
- children: text
8990
- })
8991
- }), hotkeys && /* @__PURE__ */jsx(Box, {
8992
- marginLeft: space,
8993
- style: {
8994
- marginTop: -4,
8995
- marginBottom: -4
8996
- },
8997
- children: /* @__PURE__ */jsx(Hotkeys, {
8998
- fontSize,
8999
- keys: hotkeys
9000
- })
9001
- }), iconRight && /* @__PURE__ */jsxs(Text, {
9786
+ children: [icon && /* @__PURE__ */jsxs(Text, {
9787
+ size: fontSize,
9788
+ children: [isValidElement(icon) && icon, isValidElementType(icon) && createElement(icon)]
9789
+ }), text && /* @__PURE__ */jsx(Box, {
9790
+ flex: 1,
9791
+ children: /* @__PURE__ */jsx(Text, {
9002
9792
  size: fontSize,
9003
- children: [isValidElement(iconRight) && iconRight, isValidElementType(iconRight) && createElement(iconRight)]
9004
- })]
9005
- })
9793
+ textOverflow: "ellipsis",
9794
+ weight: "medium",
9795
+ children: text
9796
+ })
9797
+ }), hotkeys && /* @__PURE__ */jsx(Hotkeys, {
9798
+ fontSize,
9799
+ keys: hotkeys,
9800
+ style: {
9801
+ marginTop: -4,
9802
+ marginBottom: -4
9803
+ }
9804
+ }), iconRight && /* @__PURE__ */jsxs(Text, {
9805
+ size: fontSize,
9806
+ children: [isValidElement(iconRight) && iconRight, isValidElementType(iconRight) && createElement(iconRight)]
9807
+ })]
9006
9808
  }), children && /* @__PURE__ */jsx(Box, {
9007
9809
  as: "span",
9008
9810
  ...paddingProps,
@@ -9018,15 +9820,15 @@ var __template$6 = (cooked, raw) => __freeze$6(__defProp$6(cooked, "raw", {
9018
9820
  var _a$6, _b$3, _c$1, _d;
9019
9821
  const keyframe = keyframes(_a$6 || (_a$6 = __template$6(["\n 0% {\n background-position: 100%;\n }\n 100% {\n background-position: -100%;\n }\n"])));
9020
9822
  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);
9021
- 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 => {
9823
+ 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"])), _ref30 => {
9022
9824
  let {
9023
9825
  $visible
9024
- } = _ref25;
9826
+ } = _ref30;
9025
9827
  return $visible ? 1 : 0;
9026
- }, _ref26 => {
9828
+ }, _ref31 => {
9027
9829
  let {
9028
9830
  $animated
9029
- } = _ref26;
9831
+ } = _ref31;
9030
9832
  return $animated ? animation : css(_c$1 || (_c$1 = __template$6(["\n background-color: var(--card-skeleton-color-from);\n "])));
9031
9833
  });
9032
9834
  const Root$4 = styled(Box)(responsiveRadiusStyle, skeletonStyle);
@@ -9057,12 +9859,12 @@ const Skeleton = forwardRef(function Skeleton2(props, ref) {
9057
9859
  ref
9058
9860
  });
9059
9861
  });
9060
- const Root$3 = styled(Skeleton)(_ref27 => {
9862
+ const Root$3 = styled(Skeleton)(_ref32 => {
9061
9863
  let {
9062
9864
  $size,
9063
9865
  $style,
9064
9866
  theme
9065
- } = _ref27;
9867
+ } = _ref32;
9066
9868
  const {
9067
9869
  media
9068
9870
  } = theme.sanity;
@@ -9410,12 +10212,12 @@ function ToastProvider(props) {
9410
10212
  paddingY,
9411
10213
  children: /* @__PURE__ */jsx(AnimatePresence, {
9412
10214
  initial: false,
9413
- children: state.map(_ref28 => {
10215
+ children: state.map(_ref33 => {
9414
10216
  let {
9415
10217
  dismiss,
9416
10218
  id,
9417
10219
  params
9418
- } = _ref28;
10220
+ } = _ref33;
9419
10221
  return /* @__PURE__ */jsx(motion.div, {
9420
10222
  animate: {
9421
10223
  opacity: 1,
@@ -9915,5 +10717,5 @@ const TreeItem = memo(function TreeItem2(props) {
9915
10717
  })]
9916
10718
  });
9917
10719
  });
9918
- 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 };
10720
+ export { Autocomplete, Avatar, AvatarCounter, AvatarStack, Badge, BoundaryElementProvider, Box, Breadcrumbs, Button, COLOR_BASE_TONES, COLOR_BLEND_MODES, COLOR_BUTTON_MODES, COLOR_CONFIG_BASE_KEYS, COLOR_CONFIG_BASE_TONES, COLOR_CONFIG_BLEND_KEYS, COLOR_CONFIG_STATE_KEYS, COLOR_CONFIG_STATE_TONES, COLOR_HUES, COLOR_STATES, COLOR_STATE_TONES, COLOR_TINTS, 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, buildTheme, containsOrEqualsElement, createColorTheme, focusFirstDescendant, focusLastDescendant, hexToRgb, hslToRgb, isColorBlendModeValue, isColorButtonMode, isColorConfigBaseKey, isColorConfigBaseTone, isColorConfigBlendKey, isColorConfigStateKey, isColorConfigStateTone, isColorHueValue, isColorOpacityValue, isColorTintValue, isColorTokenValue, isColorValue, isFocusable, isHTMLAnchorElement, isHTMLButtonElement, isHTMLElement, isHTMLInputElement, isHTMLSelectElement, isHTMLTextAreaElement, multiply$2 as multiply, parseColor, parseTokenKey, parseTokenValue, rem, responsiveCodeFontStyle, responsiveHeadingFont, responsiveLabelFont, responsiveTextAlignStyle, responsiveTextFont, rgbToHex, rgbToHsl, rgba, rgbaToRGBA, screen$2 as screen, studioTheme, useArrayProp, useBoundaryElement, useClickOutside, useCustomValidity, useDialog, useElementRect, useElementSize, useForwardedRef, useGlobalKeyDown, useLayer, useMediaIndex, usePortal, usePrefersDark, usePrefersReducedMotion, useRootTheme, useTheme, useToast, useTooltipDelayGroup, useTree };
9919
10721
  //# sourceMappingURL=index.esm.js.map