@sanity/ui 2.0.0-alpha.12 → 2.0.0-alpha.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.mjs +27 -0
- package/dist/index.d.ts +348 -8
- package/dist/index.esm.js +759 -67
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +786 -67
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/tab/tab.tsx +4 -1
- package/src/primitives/button/button.tsx +7 -3
- package/src/primitives/button/styles.ts +8 -2
- package/src/theme/_internal/__workshop__/build/story.tsx +178 -0
- package/src/theme/_internal/__workshop__/build/theme.ts +3 -0
- package/src/theme/_internal/__workshop__/index.ts +14 -0
- package/src/theme/_internal/build/buildTheme.test.ts +78 -0
- package/src/theme/_internal/build/buildTheme.ts +15 -0
- package/src/theme/_internal/build/colorTheme/buildColorTheme.test.ts +185 -0
- package/src/theme/_internal/build/colorTheme/buildColorTheme.ts +222 -0
- package/src/theme/_internal/build/colorTheme/renderColorTheme.ts +226 -0
- package/src/theme/_internal/build/defaults/colorPalette.ts +8 -0
- package/src/theme/_internal/build/defaults/colorTokens.ts +124 -0
- package/src/theme/_internal/build/helpers.ts +64 -0
- package/src/theme/_internal/build/index.ts +1 -0
- package/src/theme/_internal/config/helpers.ts +47 -0
- package/src/theme/_internal/config/index.ts +3 -0
- package/src/theme/_internal/config/token/index.ts +2 -0
- package/src/theme/_internal/config/token/parseTokenKey.test.ts +72 -0
- package/src/theme/_internal/config/token/parseTokenKey.ts +88 -0
- package/src/theme/_internal/config/token/parseTokenValue.test.ts +45 -0
- package/src/theme/_internal/config/token/parseTokenValue.ts +123 -0
- package/src/theme/_internal/config/types.ts +126 -0
- package/src/theme/_internal/constants.ts +48 -0
- package/src/theme/_internal/helpers.ts +19 -0
- package/src/theme/_internal/index.ts +5 -0
- package/src/theme/_internal/types.ts +72 -0
- package/src/theme/index.ts +1 -0
- package/src/types/button.ts +5 -0
package/dist/index.esm.js
CHANGED
|
@@ -2,7 +2,7 @@ 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 { white as white$1, black as black$1, hues } 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
8
|
import { detectOverflow, flip, offset, shift, arrow, hide, useFloating, autoUpdate, size as size$2 } from '@floating-ui/react-dom';
|
|
@@ -831,10 +831,143 @@ 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
|
+
},
|
|
852
|
+
transparent: {
|
|
853
|
+
bg: ["50", "black"],
|
|
854
|
+
fg: ["600", "400"]
|
|
855
|
+
},
|
|
856
|
+
default: {
|
|
857
|
+
bg: ["white", "950"],
|
|
858
|
+
fg: ["black", "200"]
|
|
859
|
+
},
|
|
860
|
+
primary: {
|
|
861
|
+
_hue: "cyan"
|
|
862
|
+
},
|
|
863
|
+
positive: {
|
|
864
|
+
_hue: "cyan"
|
|
865
|
+
},
|
|
866
|
+
caution: {
|
|
867
|
+
_hue: "yellow"
|
|
868
|
+
},
|
|
869
|
+
critical: {
|
|
870
|
+
_hue: "red"
|
|
871
|
+
},
|
|
872
|
+
button: {
|
|
873
|
+
"*": {
|
|
874
|
+
default: {
|
|
875
|
+
"*": {
|
|
876
|
+
_blend: ["screen", "multiply"],
|
|
877
|
+
bg: ["500", "400"],
|
|
878
|
+
border: ["500/0", "400/0"]
|
|
879
|
+
},
|
|
880
|
+
hovered: {
|
|
881
|
+
bg: ["600", "300"],
|
|
882
|
+
border: ["600/0", "300/0"]
|
|
883
|
+
},
|
|
884
|
+
pressed: {
|
|
885
|
+
bg: ["700", "200"]
|
|
886
|
+
},
|
|
887
|
+
selected: {
|
|
888
|
+
bg: ["700", "200"]
|
|
889
|
+
},
|
|
890
|
+
disabled: {
|
|
891
|
+
_hue: "gray",
|
|
892
|
+
bg: ["100", "900"]
|
|
893
|
+
}
|
|
894
|
+
},
|
|
895
|
+
ghost: {
|
|
896
|
+
"*": {
|
|
897
|
+
_blend: ["multiply", "screen"],
|
|
898
|
+
bg: ["white", "black"],
|
|
899
|
+
fg: ["600", "400"],
|
|
900
|
+
border: ["200", "800"]
|
|
901
|
+
},
|
|
902
|
+
hovered: {
|
|
903
|
+
bg: ["50", "950"],
|
|
904
|
+
fg: ["700", "300"]
|
|
905
|
+
},
|
|
906
|
+
pressed: {
|
|
907
|
+
bg: ["100", "900"],
|
|
908
|
+
fg: ["800", "200"]
|
|
909
|
+
},
|
|
910
|
+
selected: {
|
|
911
|
+
bg: ["100", "900"],
|
|
912
|
+
fg: ["800", "200"]
|
|
913
|
+
},
|
|
914
|
+
disabled: {
|
|
915
|
+
_hue: "gray",
|
|
916
|
+
fg: ["100", "900"],
|
|
917
|
+
border: ["100", "900"]
|
|
918
|
+
}
|
|
919
|
+
},
|
|
920
|
+
bleed: {
|
|
921
|
+
"*": {
|
|
922
|
+
_blend: ["multiply", "screen"],
|
|
923
|
+
bg: ["white", "black"],
|
|
924
|
+
fg: ["600", "400"],
|
|
925
|
+
border: ["white/0", "black/0"]
|
|
926
|
+
},
|
|
927
|
+
hovered: {
|
|
928
|
+
bg: ["50", "950"],
|
|
929
|
+
fg: ["700", "300"]
|
|
930
|
+
},
|
|
931
|
+
pressed: {
|
|
932
|
+
bg: ["100", "900"],
|
|
933
|
+
fg: ["800", "200"]
|
|
934
|
+
},
|
|
935
|
+
selected: {
|
|
936
|
+
bg: ["100", "900"],
|
|
937
|
+
fg: ["800", "200"]
|
|
938
|
+
},
|
|
939
|
+
disabled: {
|
|
940
|
+
_hue: "gray",
|
|
941
|
+
fg: ["100", "900"]
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
},
|
|
945
|
+
default: {
|
|
946
|
+
default: {
|
|
947
|
+
"*": {
|
|
948
|
+
bg: ["900", "200"]
|
|
949
|
+
},
|
|
950
|
+
hovered: {
|
|
951
|
+
bg: ["black", "100"]
|
|
952
|
+
},
|
|
953
|
+
pressed: {
|
|
954
|
+
bg: ["900", "200"]
|
|
955
|
+
},
|
|
956
|
+
selected: {
|
|
957
|
+
bg: ["black", "200"]
|
|
958
|
+
},
|
|
959
|
+
disabled: {
|
|
960
|
+
_hue: "gray",
|
|
961
|
+
bg: ["100", "900"]
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
};
|
|
834
967
|
function multiplyChannel(b, s) {
|
|
835
968
|
return b * s;
|
|
836
969
|
}
|
|
837
|
-
function multiply$
|
|
970
|
+
function multiply$2(b, s) {
|
|
838
971
|
return {
|
|
839
972
|
r: Math.round(clamp$1(multiplyChannel(b.r / 255, s.r / 255) * 255)),
|
|
840
973
|
g: Math.round(clamp$1(multiplyChannel(b.g / 255, s.g / 255) * 255)),
|
|
@@ -847,7 +980,7 @@ function clamp$1(num) {
|
|
|
847
980
|
function screenChannel(b, s) {
|
|
848
981
|
return b + s - b * s;
|
|
849
982
|
}
|
|
850
|
-
function screen$
|
|
983
|
+
function screen$2(b, s) {
|
|
851
984
|
return {
|
|
852
985
|
r: Math.round(clamp(screenChannel(b.r / 255, s.r / 255) * 255)),
|
|
853
986
|
g: Math.round(clamp(screenChannel(b.g / 255, s.g / 255) * 255)),
|
|
@@ -1009,6 +1142,560 @@ function rgba(color, a) {
|
|
|
1009
1142
|
const rgb = parseColor(color);
|
|
1010
1143
|
return "rgba(".concat(rgb.r, ",").concat(rgb.g, ",").concat(rgb.b, ",").concat(a, ")");
|
|
1011
1144
|
}
|
|
1145
|
+
function isColorBlendModeValue(str) {
|
|
1146
|
+
return COLOR_BLEND_MODES.includes(str);
|
|
1147
|
+
}
|
|
1148
|
+
function isColorHueValue(str) {
|
|
1149
|
+
return COLOR_HUES.includes(str);
|
|
1150
|
+
}
|
|
1151
|
+
function isColorTintValue(str) {
|
|
1152
|
+
return COLOR_TINTS.includes(str);
|
|
1153
|
+
}
|
|
1154
|
+
function isColorButtonMode(str) {
|
|
1155
|
+
return COLOR_BUTTON_MODES.includes(str);
|
|
1156
|
+
}
|
|
1157
|
+
function parseTokenKey(str) {
|
|
1158
|
+
const segments = str.split("/");
|
|
1159
|
+
const segment0 = segments.shift() || "";
|
|
1160
|
+
if (isColorConfigBaseTone(segment0)) {
|
|
1161
|
+
const key = segments.join("/");
|
|
1162
|
+
if (isColorConfigBaseKey(key)) {
|
|
1163
|
+
return {
|
|
1164
|
+
type: "base",
|
|
1165
|
+
tone: segment0,
|
|
1166
|
+
key
|
|
1167
|
+
};
|
|
1168
|
+
}
|
|
1169
|
+
if (isColorConfigBlendKey(key)) {
|
|
1170
|
+
return {
|
|
1171
|
+
type: "base",
|
|
1172
|
+
tone: segment0,
|
|
1173
|
+
key
|
|
1174
|
+
};
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
if (segment0 === "button") {
|
|
1178
|
+
const segment1 = segments.shift() || "";
|
|
1179
|
+
if (isColorConfigStateTone(segment1)) {
|
|
1180
|
+
const segment2 = segments.shift() || "";
|
|
1181
|
+
if (isColorButtonMode(segment2)) {
|
|
1182
|
+
const key = segments.join("/");
|
|
1183
|
+
if (isColorConfigStateKey(key)) {
|
|
1184
|
+
return {
|
|
1185
|
+
type: "button",
|
|
1186
|
+
tone: segment1,
|
|
1187
|
+
mode: segment2,
|
|
1188
|
+
key
|
|
1189
|
+
};
|
|
1190
|
+
}
|
|
1191
|
+
if (isColorConfigBlendKey(key)) {
|
|
1192
|
+
return {
|
|
1193
|
+
type: "button",
|
|
1194
|
+
tone: segment1,
|
|
1195
|
+
mode: segment2,
|
|
1196
|
+
key
|
|
1197
|
+
};
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
return void 0;
|
|
1203
|
+
}
|
|
1204
|
+
function parseTokenValue(str) {
|
|
1205
|
+
const segments = str.split("/");
|
|
1206
|
+
const segment0 = segments.shift() || "";
|
|
1207
|
+
if (isColorTintValue(segment0)) {
|
|
1208
|
+
const tint = segment0;
|
|
1209
|
+
const segment1 = segments.shift() || "";
|
|
1210
|
+
if (isColorOpacityValue(segment1)) {
|
|
1211
|
+
const opacity = Number(segment1);
|
|
1212
|
+
return {
|
|
1213
|
+
type: "color",
|
|
1214
|
+
tint,
|
|
1215
|
+
opacity
|
|
1216
|
+
};
|
|
1217
|
+
}
|
|
1218
|
+
return {
|
|
1219
|
+
type: "color",
|
|
1220
|
+
tint
|
|
1221
|
+
};
|
|
1222
|
+
}
|
|
1223
|
+
if (isColorValue(segment0)) {
|
|
1224
|
+
const key = segment0;
|
|
1225
|
+
const segment1 = segments.shift() || "";
|
|
1226
|
+
if (isColorOpacityValue(segment1)) {
|
|
1227
|
+
const opacity = Number(segment1);
|
|
1228
|
+
return {
|
|
1229
|
+
type: "color",
|
|
1230
|
+
key,
|
|
1231
|
+
opacity
|
|
1232
|
+
};
|
|
1233
|
+
}
|
|
1234
|
+
return {
|
|
1235
|
+
type: "color",
|
|
1236
|
+
key
|
|
1237
|
+
};
|
|
1238
|
+
}
|
|
1239
|
+
if (isColorHueValue(segment0)) {
|
|
1240
|
+
const hue = segment0;
|
|
1241
|
+
const segment1 = segments.shift() || "";
|
|
1242
|
+
if (isColorTintValue(segment1)) {
|
|
1243
|
+
const tint = segment1;
|
|
1244
|
+
const segment2 = segments.shift() || "";
|
|
1245
|
+
if (isColorOpacityValue(segment2)) {
|
|
1246
|
+
const opacity = Number(segment2);
|
|
1247
|
+
return {
|
|
1248
|
+
type: "color",
|
|
1249
|
+
key: "".concat(hue, "/").concat(tint),
|
|
1250
|
+
hue,
|
|
1251
|
+
tint,
|
|
1252
|
+
opacity
|
|
1253
|
+
};
|
|
1254
|
+
}
|
|
1255
|
+
return {
|
|
1256
|
+
type: "color",
|
|
1257
|
+
key: "".concat(hue, "/").concat(tint),
|
|
1258
|
+
hue,
|
|
1259
|
+
tint
|
|
1260
|
+
};
|
|
1261
|
+
}
|
|
1262
|
+
return {
|
|
1263
|
+
type: "hue",
|
|
1264
|
+
value: "".concat(hue)
|
|
1265
|
+
};
|
|
1266
|
+
}
|
|
1267
|
+
if (isColorOpacityValue(segment0)) {
|
|
1268
|
+
const opacity = Number(segment0);
|
|
1269
|
+
return {
|
|
1270
|
+
type: "color",
|
|
1271
|
+
opacity
|
|
1272
|
+
};
|
|
1273
|
+
}
|
|
1274
|
+
if (isColorBlendModeValue(segment0)) {
|
|
1275
|
+
const value = segment0;
|
|
1276
|
+
return {
|
|
1277
|
+
type: "blendMode",
|
|
1278
|
+
value
|
|
1279
|
+
};
|
|
1280
|
+
}
|
|
1281
|
+
return void 0;
|
|
1282
|
+
}
|
|
1283
|
+
const COLOR_CONFIG_BASE_TONES = ["*", ...COLOR_BASE_TONES];
|
|
1284
|
+
const COLOR_CONFIG_STATE_TONES = ["*", ...COLOR_STATE_TONES];
|
|
1285
|
+
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"];
|
|
1286
|
+
const COLOR_CONFIG_STATE_KEYS = ["_hue", "bg", "fg", "border", "focusRing", "muted/fg", "link/fg", "code/bg", "code/fg", "skeleton/from", "skeleton/to"];
|
|
1287
|
+
const COLOR_CONFIG_BLEND_KEYS = ["_blend"];
|
|
1288
|
+
function isColorConfigBaseTone(str) {
|
|
1289
|
+
return COLOR_CONFIG_BASE_TONES.includes(str);
|
|
1290
|
+
}
|
|
1291
|
+
function isColorConfigBaseKey(str) {
|
|
1292
|
+
return COLOR_CONFIG_BASE_KEYS.includes(str);
|
|
1293
|
+
}
|
|
1294
|
+
function isColorConfigStateKey(str) {
|
|
1295
|
+
return COLOR_CONFIG_STATE_KEYS.includes(str);
|
|
1296
|
+
}
|
|
1297
|
+
function isColorConfigStateTone(str) {
|
|
1298
|
+
return COLOR_CONFIG_STATE_TONES.includes(str);
|
|
1299
|
+
}
|
|
1300
|
+
function isColorConfigBlendKey(str) {
|
|
1301
|
+
return COLOR_CONFIG_BLEND_KEYS.includes(str);
|
|
1302
|
+
}
|
|
1303
|
+
function isColorTokenValue(str) {
|
|
1304
|
+
var _a, _b;
|
|
1305
|
+
return ((_a = parseTokenValue(str)) == null ? void 0 : _a.type) === "color" || ((_b = parseTokenValue(str)) == null ? void 0 : _b.type) === "hue";
|
|
1306
|
+
}
|
|
1307
|
+
function isColorValue(str) {
|
|
1308
|
+
return str === "black" || str === "white";
|
|
1309
|
+
}
|
|
1310
|
+
function isColorOpacityValue(str) {
|
|
1311
|
+
return str === "0" || /^0\.[0-9]+$/.test(str) || str === "1";
|
|
1312
|
+
}
|
|
1313
|
+
function resolveColorTokenValue(options) {
|
|
1314
|
+
const {
|
|
1315
|
+
hue,
|
|
1316
|
+
scheme,
|
|
1317
|
+
value
|
|
1318
|
+
} = options;
|
|
1319
|
+
const node = parseTokenValue(value[scheme === "light" ? 0 : 1]);
|
|
1320
|
+
if (!node || node.type !== "color") {
|
|
1321
|
+
throw new Error("Invalid color token: ".concat(value[0]));
|
|
1322
|
+
}
|
|
1323
|
+
return compileColorTokenValue({
|
|
1324
|
+
...node,
|
|
1325
|
+
hue: node.hue || hue
|
|
1326
|
+
});
|
|
1327
|
+
}
|
|
1328
|
+
function compileColorTokenValue(node) {
|
|
1329
|
+
let key = "";
|
|
1330
|
+
if (node.key === "black" || node.key === "white") {
|
|
1331
|
+
key = node.key;
|
|
1332
|
+
} else {
|
|
1333
|
+
key = "".concat(node.hue, "/").concat(node.tint);
|
|
1334
|
+
}
|
|
1335
|
+
if (node.opacity !== void 0) {
|
|
1336
|
+
key += "/".concat(node.opacity);
|
|
1337
|
+
}
|
|
1338
|
+
return key;
|
|
1339
|
+
}
|
|
1340
|
+
function multiply$1(bg, fg) {
|
|
1341
|
+
const b = parseColor(bg);
|
|
1342
|
+
const s = parseColor(fg);
|
|
1343
|
+
const hex = rgbToHex(multiply$2(b, s));
|
|
1344
|
+
if (s.a !== void 0) {
|
|
1345
|
+
return rgba(hex, s.a);
|
|
1346
|
+
}
|
|
1347
|
+
return hex;
|
|
1348
|
+
}
|
|
1349
|
+
function screen$1(bg, fg) {
|
|
1350
|
+
const b = parseColor(bg);
|
|
1351
|
+
const s = parseColor(fg);
|
|
1352
|
+
const hex = rgbToHex(screen$2(b, s));
|
|
1353
|
+
if (s.a !== void 0) {
|
|
1354
|
+
return rgba(hex, s.a);
|
|
1355
|
+
}
|
|
1356
|
+
return hex;
|
|
1357
|
+
}
|
|
1358
|
+
function buildColorTheme(options, config) {
|
|
1359
|
+
const {
|
|
1360
|
+
scheme
|
|
1361
|
+
} = options;
|
|
1362
|
+
return {
|
|
1363
|
+
transparent: buildBaseColorTheme({
|
|
1364
|
+
scheme,
|
|
1365
|
+
tone: "transparent"
|
|
1366
|
+
}, config),
|
|
1367
|
+
default: buildBaseColorTheme({
|
|
1368
|
+
scheme,
|
|
1369
|
+
tone: "default"
|
|
1370
|
+
}, config),
|
|
1371
|
+
primary: buildBaseColorTheme({
|
|
1372
|
+
scheme,
|
|
1373
|
+
tone: "primary"
|
|
1374
|
+
}, config),
|
|
1375
|
+
positive: buildBaseColorTheme({
|
|
1376
|
+
scheme,
|
|
1377
|
+
tone: "positive"
|
|
1378
|
+
}, config),
|
|
1379
|
+
caution: buildBaseColorTheme({
|
|
1380
|
+
scheme,
|
|
1381
|
+
tone: "caution"
|
|
1382
|
+
}, config),
|
|
1383
|
+
critical: buildBaseColorTheme({
|
|
1384
|
+
scheme,
|
|
1385
|
+
tone: "critical"
|
|
1386
|
+
}, config)
|
|
1387
|
+
};
|
|
1388
|
+
}
|
|
1389
|
+
function buildBaseColorTheme(options, config) {
|
|
1390
|
+
var _a, _b;
|
|
1391
|
+
const {
|
|
1392
|
+
scheme,
|
|
1393
|
+
tone
|
|
1394
|
+
} = options;
|
|
1395
|
+
const tokens = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.tokens) != null ? _b : defaultColorTokens;
|
|
1396
|
+
const any = tokens == null ? void 0 : tokens["*"];
|
|
1397
|
+
const toneTokens = tokens == null ? void 0 : tokens[tone];
|
|
1398
|
+
const hue = (toneTokens == null ? void 0 : toneTokens._hue) || (any == null ? void 0 : any._hue) || "gray";
|
|
1399
|
+
const bg = resolveColorTokenValue({
|
|
1400
|
+
hue,
|
|
1401
|
+
scheme,
|
|
1402
|
+
value: (toneTokens == null ? void 0 : toneTokens.bg) || (any == null ? void 0 : any.bg) || ["gray/50", "black"]
|
|
1403
|
+
});
|
|
1404
|
+
const _blend = (toneTokens == null ? void 0 : toneTokens._blend) || (any == null ? void 0 : any._blend) || ["screen", "multiply"];
|
|
1405
|
+
return {
|
|
1406
|
+
_blend: _blend[scheme === "light" ? 0 : 1],
|
|
1407
|
+
dark: scheme === "dark",
|
|
1408
|
+
base: {
|
|
1409
|
+
bg,
|
|
1410
|
+
fg: resolveColorTokenValue({
|
|
1411
|
+
hue,
|
|
1412
|
+
scheme,
|
|
1413
|
+
value: (toneTokens == null ? void 0 : toneTokens.fg) || (any == null ? void 0 : any.fg) || ["black", "white"]
|
|
1414
|
+
}),
|
|
1415
|
+
border: resolveColorTokenValue({
|
|
1416
|
+
hue,
|
|
1417
|
+
scheme,
|
|
1418
|
+
value: (toneTokens == null ? void 0 : toneTokens.border) || (any == null ? void 0 : any.border) || ["black", "white"]
|
|
1419
|
+
})
|
|
1420
|
+
},
|
|
1421
|
+
button: buildButtonColorTheme({
|
|
1422
|
+
scheme
|
|
1423
|
+
}, config)
|
|
1424
|
+
};
|
|
1425
|
+
}
|
|
1426
|
+
function buildButtonColorTheme(options, config) {
|
|
1427
|
+
const {
|
|
1428
|
+
scheme
|
|
1429
|
+
} = options;
|
|
1430
|
+
const tones = COLOR_STATE_TONES.map(tone => {
|
|
1431
|
+
return {
|
|
1432
|
+
[tone]: buildButtonColorToneTheme({
|
|
1433
|
+
scheme,
|
|
1434
|
+
tone
|
|
1435
|
+
}, config)
|
|
1436
|
+
};
|
|
1437
|
+
});
|
|
1438
|
+
return Object.assign({}, ...tones);
|
|
1439
|
+
}
|
|
1440
|
+
function buildButtonColorToneTheme(options, config) {
|
|
1441
|
+
const {
|
|
1442
|
+
scheme,
|
|
1443
|
+
tone
|
|
1444
|
+
} = options;
|
|
1445
|
+
const modes = COLOR_BUTTON_MODES.map(mode => {
|
|
1446
|
+
return {
|
|
1447
|
+
[mode]: buildButtonModeColorTheme({
|
|
1448
|
+
mode,
|
|
1449
|
+
scheme,
|
|
1450
|
+
tone
|
|
1451
|
+
}, config)
|
|
1452
|
+
};
|
|
1453
|
+
});
|
|
1454
|
+
return Object.assign({}, ...modes);
|
|
1455
|
+
}
|
|
1456
|
+
function buildButtonModeColorTheme(options, config) {
|
|
1457
|
+
const {
|
|
1458
|
+
mode,
|
|
1459
|
+
scheme,
|
|
1460
|
+
tone
|
|
1461
|
+
} = options;
|
|
1462
|
+
const states = COLOR_STATES.map(state => {
|
|
1463
|
+
return {
|
|
1464
|
+
[state]: buildButtonStateColorTheme({
|
|
1465
|
+
mode,
|
|
1466
|
+
tone,
|
|
1467
|
+
scheme,
|
|
1468
|
+
state
|
|
1469
|
+
}, config)
|
|
1470
|
+
};
|
|
1471
|
+
});
|
|
1472
|
+
return Object.assign({}, ...states);
|
|
1473
|
+
}
|
|
1474
|
+
function buildButtonStateColorTheme(options, config) {
|
|
1475
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S;
|
|
1476
|
+
const {
|
|
1477
|
+
mode,
|
|
1478
|
+
tone,
|
|
1479
|
+
scheme,
|
|
1480
|
+
state
|
|
1481
|
+
} = options;
|
|
1482
|
+
const tokens = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.tokens) != null ? _b : defaultColorTokens;
|
|
1483
|
+
const hue = ((_f = (_e = (_d = (_c = tokens == null ? void 0 : tokens.button) == null ? void 0 : _c[tone]) == null ? void 0 : _d[mode]) == null ? void 0 : _e[state]) == null ? void 0 : _f._hue) || ((_j = (_i = (_h = (_g = tokens == null ? void 0 : tokens.button) == null ? void 0 : _g["*"]) == null ? void 0 : _h[mode]) == null ? void 0 : _i[state]) == null ? void 0 : _j._hue) || ((_l = (_k = tokens == null ? void 0 : tokens.button) == null ? void 0 : _k[tone]) == null ? void 0 : _l._hue) || ((_m = tokens == null ? void 0 : tokens[tone]) == null ? void 0 : _m._hue) || "gray";
|
|
1484
|
+
const spec3 = (_p = (_o = (_n = tokens == null ? void 0 : tokens.button) == null ? void 0 : _n["*"]) == null ? void 0 : _o[mode]) == null ? void 0 : _p["*"];
|
|
1485
|
+
const spec2 = (_s = (_r = (_q = tokens == null ? void 0 : tokens.button) == null ? void 0 : _q["*"]) == null ? void 0 : _r[mode]) == null ? void 0 : _s[state];
|
|
1486
|
+
const spec1 = (_v = (_u = (_t = tokens == null ? void 0 : tokens.button) == null ? void 0 : _t[tone]) == null ? void 0 : _u[mode]) == null ? void 0 : _v["*"];
|
|
1487
|
+
const spec0 = (_y = (_x = (_w = tokens == null ? void 0 : tokens.button) == null ? void 0 : _w[tone]) == null ? void 0 : _x[mode]) == null ? void 0 : _y[state];
|
|
1488
|
+
const _blend = (spec0 == null ? void 0 : spec0._blend) || (spec1 == null ? void 0 : spec1._blend) || (spec2 == null ? void 0 : spec2._blend) || (spec3 == null ? void 0 : spec3._blend) || ["screen", "multiply"];
|
|
1489
|
+
return {
|
|
1490
|
+
_blend: _blend[scheme === "light" ? 0 : 1],
|
|
1491
|
+
bg: resolveColorTokenValue({
|
|
1492
|
+
hue,
|
|
1493
|
+
scheme,
|
|
1494
|
+
value: (spec0 == null ? void 0 : spec0.bg) || (spec1 == null ? void 0 : spec1.bg) || (spec2 == null ? void 0 : spec2.bg) || (spec3 == null ? void 0 : spec3.bg) || ["500", "400"]
|
|
1495
|
+
}),
|
|
1496
|
+
bg2: resolveColorTokenValue({
|
|
1497
|
+
hue,
|
|
1498
|
+
scheme,
|
|
1499
|
+
value: (spec0 == null ? void 0 : spec0.bg2) || (spec1 == null ? void 0 : spec1.bg2) || (spec2 == null ? void 0 : spec2.bg2) || (spec3 == null ? void 0 : spec3.bg2) || ["500", "400"]
|
|
1500
|
+
}),
|
|
1501
|
+
fg: resolveColorTokenValue({
|
|
1502
|
+
hue,
|
|
1503
|
+
scheme,
|
|
1504
|
+
value: (spec0 == null ? void 0 : spec0.fg) || (spec1 == null ? void 0 : spec1.fg) || (spec2 == null ? void 0 : spec2.fg) || (spec3 == null ? void 0 : spec3.fg) || ["white", "black"]
|
|
1505
|
+
}),
|
|
1506
|
+
border: resolveColorTokenValue({
|
|
1507
|
+
hue,
|
|
1508
|
+
scheme,
|
|
1509
|
+
value: (spec0 == null ? void 0 : spec0.border) || (spec1 == null ? void 0 : spec1.border) || (spec2 == null ? void 0 : spec2.border) || (spec3 == null ? void 0 : spec3.border) || ["500", "400"]
|
|
1510
|
+
}),
|
|
1511
|
+
muted: {
|
|
1512
|
+
fg: resolveColorTokenValue({
|
|
1513
|
+
hue,
|
|
1514
|
+
scheme,
|
|
1515
|
+
value: ((_z = spec0 == null ? void 0 : spec0.muted) == null ? void 0 : _z.fg) || ((_A = spec1 == null ? void 0 : spec1.muted) == null ? void 0 : _A.fg) || ((_B = spec2 == null ? void 0 : spec2.muted) == null ? void 0 : _B.fg) || ((_C = spec3 == null ? void 0 : spec3.muted) == null ? void 0 : _C.fg) || ["500", "400"]
|
|
1516
|
+
})
|
|
1517
|
+
},
|
|
1518
|
+
accent: {
|
|
1519
|
+
fg: resolveColorTokenValue({
|
|
1520
|
+
hue,
|
|
1521
|
+
scheme,
|
|
1522
|
+
value: ((_D = spec0 == null ? void 0 : spec0.accent) == null ? void 0 : _D.fg) || ((_E = spec1 == null ? void 0 : spec1.accent) == null ? void 0 : _E.fg) || ((_F = spec2 == null ? void 0 : spec2.accent) == null ? void 0 : _F.fg) || ((_G = spec3 == null ? void 0 : spec3.accent) == null ? void 0 : _G.fg) || ["500", "400"]
|
|
1523
|
+
})
|
|
1524
|
+
},
|
|
1525
|
+
link: {
|
|
1526
|
+
fg: resolveColorTokenValue({
|
|
1527
|
+
hue,
|
|
1528
|
+
scheme,
|
|
1529
|
+
value: ((_H = spec0 == null ? void 0 : spec0.link) == null ? void 0 : _H.fg) || ((_I = spec1 == null ? void 0 : spec1.link) == null ? void 0 : _I.fg) || ((_J = spec2 == null ? void 0 : spec2.link) == null ? void 0 : _J.fg) || ((_K = spec3 == null ? void 0 : spec3.link) == null ? void 0 : _K.fg) || ["500", "400"]
|
|
1530
|
+
})
|
|
1531
|
+
},
|
|
1532
|
+
code: {
|
|
1533
|
+
bg: resolveColorTokenValue({
|
|
1534
|
+
hue,
|
|
1535
|
+
scheme,
|
|
1536
|
+
value: ((_L = spec0 == null ? void 0 : spec0.code) == null ? void 0 : _L.bg) || ((_M = spec1 == null ? void 0 : spec1.code) == null ? void 0 : _M.bg) || ((_N = spec2 == null ? void 0 : spec2.code) == null ? void 0 : _N.bg) || ((_O = spec3 == null ? void 0 : spec3.code) == null ? void 0 : _O.bg) || ["500", "400"]
|
|
1537
|
+
}),
|
|
1538
|
+
fg: resolveColorTokenValue({
|
|
1539
|
+
hue,
|
|
1540
|
+
scheme,
|
|
1541
|
+
value: ((_P = spec0 == null ? void 0 : spec0.code) == null ? void 0 : _P.fg) || ((_Q = spec1 == null ? void 0 : spec1.code) == null ? void 0 : _Q.fg) || ((_R = spec2 == null ? void 0 : spec2.code) == null ? void 0 : _R.fg) || ((_S = spec3 == null ? void 0 : spec3.code) == null ? void 0 : _S.fg) || ["500", "400"]
|
|
1542
|
+
})
|
|
1543
|
+
}
|
|
1544
|
+
};
|
|
1545
|
+
}
|
|
1546
|
+
function renderColorTheme(colorPalette, value) {
|
|
1547
|
+
return {
|
|
1548
|
+
light: renderColorScheme(colorPalette, value.light),
|
|
1549
|
+
dark: renderColorScheme(colorPalette, value.dark)
|
|
1550
|
+
};
|
|
1551
|
+
}
|
|
1552
|
+
function renderColorScheme(colorPalette, value) {
|
|
1553
|
+
const toneEntries = Object.entries(value);
|
|
1554
|
+
const [, transparentTone] = toneEntries.find(_ref4 => {
|
|
1555
|
+
let [k] = _ref4;
|
|
1556
|
+
return k === "transparent";
|
|
1557
|
+
});
|
|
1558
|
+
const [, defaultTone] = toneEntries.find(_ref5 => {
|
|
1559
|
+
let [k] = _ref5;
|
|
1560
|
+
return k === "default";
|
|
1561
|
+
});
|
|
1562
|
+
const renderedTransparentTone = renderColorBase(colorPalette, transparentTone, transparentTone._blend === "multiply" ? "#ffffff" : "#000000");
|
|
1563
|
+
const renderedDefaultTone = renderColorBase(colorPalette, defaultTone, defaultTone._blend === "multiply" ? "#ffffff" : "#000000");
|
|
1564
|
+
return Object.fromEntries([["transparent", renderedTransparentTone], ["default", renderedDefaultTone], ...toneEntries.filter(_ref6 => {
|
|
1565
|
+
let [k] = _ref6;
|
|
1566
|
+
return k !== "default" && k !== "transparent";
|
|
1567
|
+
}).map(_ref7 => {
|
|
1568
|
+
let [k, v] = _ref7;
|
|
1569
|
+
return [k, renderColorBase(colorPalette, v, renderedDefaultTone.base.bg)];
|
|
1570
|
+
})]);
|
|
1571
|
+
}
|
|
1572
|
+
function renderColorBase(colorPalette, value, bg) {
|
|
1573
|
+
const nestedBg = renderColorValue(colorPalette, bg, value._blend, value.base.bg);
|
|
1574
|
+
return {
|
|
1575
|
+
_blend: value._blend,
|
|
1576
|
+
dark: value.dark,
|
|
1577
|
+
base: {
|
|
1578
|
+
bg: nestedBg,
|
|
1579
|
+
fg: renderColorValue(colorPalette, nestedBg, value._blend, value.base.fg),
|
|
1580
|
+
border: renderColorValue(colorPalette, nestedBg, value._blend, value.base.border)
|
|
1581
|
+
},
|
|
1582
|
+
button: renderButtonColorTheme(colorPalette, nestedBg, value._blend, value.button)
|
|
1583
|
+
};
|
|
1584
|
+
}
|
|
1585
|
+
function renderButtonColorTheme(colorPalette, bg, baseBlendMode, value) {
|
|
1586
|
+
return {
|
|
1587
|
+
default: renderButtonStateColorTheme(colorPalette, bg, baseBlendMode, value.default),
|
|
1588
|
+
primary: renderButtonStateColorTheme(colorPalette, bg, baseBlendMode, value.primary),
|
|
1589
|
+
positive: renderButtonStateColorTheme(colorPalette, bg, baseBlendMode, value.positive),
|
|
1590
|
+
caution: renderButtonStateColorTheme(colorPalette, bg, baseBlendMode, value.caution),
|
|
1591
|
+
critical: renderButtonStateColorTheme(colorPalette, bg, baseBlendMode, value.critical)
|
|
1592
|
+
};
|
|
1593
|
+
}
|
|
1594
|
+
function renderButtonStateColorTheme(colorPalette, bg, baseBlendMode, value) {
|
|
1595
|
+
return {
|
|
1596
|
+
default: renderStatesColorTheme(colorPalette, bg, baseBlendMode, value.default),
|
|
1597
|
+
ghost: renderStatesColorTheme(colorPalette, bg, baseBlendMode, value.ghost),
|
|
1598
|
+
bleed: renderStatesColorTheme(colorPalette, bg, baseBlendMode, value.bleed)
|
|
1599
|
+
};
|
|
1600
|
+
}
|
|
1601
|
+
function renderStatesColorTheme(colorPalette, bg, baseBlendMode, value) {
|
|
1602
|
+
return {
|
|
1603
|
+
enabled: renderStateColorTheme(colorPalette, bg, baseBlendMode, value.enabled),
|
|
1604
|
+
hovered: renderStateColorTheme(colorPalette, bg, baseBlendMode, value.hovered),
|
|
1605
|
+
pressed: renderStateColorTheme(colorPalette, bg, baseBlendMode, value.pressed),
|
|
1606
|
+
selected: renderStateColorTheme(colorPalette, bg, baseBlendMode, value.selected),
|
|
1607
|
+
disabled: renderStateColorTheme(colorPalette, bg, baseBlendMode, value.disabled)
|
|
1608
|
+
};
|
|
1609
|
+
}
|
|
1610
|
+
function renderStateColorTheme(colorPalette, baseBg, rootBlendMode, value) {
|
|
1611
|
+
const blendMode = value._blend;
|
|
1612
|
+
const bg = rootBlendMode === "multiply" && value.bg === "white" ? "#ffffff" : rootBlendMode === "screen" && value.bg === "black" ? "#000000" : renderColorValue(colorPalette, rootBlendMode === "multiply" ? "#ffffff" : "#000000", rootBlendMode, value.bg);
|
|
1613
|
+
const bg2 = renderColorValue(colorPalette, bg, blendMode, value.bg2 || value.bg);
|
|
1614
|
+
const fg = renderColorValue(colorPalette, bg, blendMode, value.fg);
|
|
1615
|
+
const border = renderColorValue(colorPalette, bg, blendMode, value.border);
|
|
1616
|
+
const muted = {
|
|
1617
|
+
fg: renderColorValue(colorPalette, bg, blendMode, value.muted.fg)
|
|
1618
|
+
};
|
|
1619
|
+
const accent = {
|
|
1620
|
+
fg: renderColorValue(colorPalette, bg, blendMode, value.accent.fg)
|
|
1621
|
+
};
|
|
1622
|
+
const link = {
|
|
1623
|
+
fg: renderColorValue(colorPalette, bg, blendMode, value.link.fg)
|
|
1624
|
+
};
|
|
1625
|
+
const code = {
|
|
1626
|
+
bg: renderColorValue(colorPalette, bg, blendMode, value.code.bg),
|
|
1627
|
+
fg: renderColorValue(colorPalette, bg, blendMode, value.code.fg)
|
|
1628
|
+
};
|
|
1629
|
+
const blend = rootBlendMode === "multiply" ? multiply$1 : screen$1;
|
|
1630
|
+
return {
|
|
1631
|
+
_blend: blendMode,
|
|
1632
|
+
bg: blend(baseBg, bg),
|
|
1633
|
+
bg2: blend(baseBg, bg2),
|
|
1634
|
+
fg: blend(baseBg, fg),
|
|
1635
|
+
border: blend(baseBg, border),
|
|
1636
|
+
muted: {
|
|
1637
|
+
fg: blend(baseBg, muted.fg)
|
|
1638
|
+
},
|
|
1639
|
+
accent: {
|
|
1640
|
+
fg: blend(baseBg, accent.fg)
|
|
1641
|
+
},
|
|
1642
|
+
link: {
|
|
1643
|
+
fg: blend(baseBg, link.fg)
|
|
1644
|
+
},
|
|
1645
|
+
code: {
|
|
1646
|
+
bg: blend(baseBg, code.bg),
|
|
1647
|
+
fg: blend(baseBg, code.fg)
|
|
1648
|
+
}
|
|
1649
|
+
};
|
|
1650
|
+
}
|
|
1651
|
+
function renderColorValue(colorPalette, bg, blendMode, str) {
|
|
1652
|
+
const node = parseTokenValue(str);
|
|
1653
|
+
if (!node || node.type !== "color") {
|
|
1654
|
+
throw new Error("Invalid color token value: ".concat(str));
|
|
1655
|
+
}
|
|
1656
|
+
let hex = "";
|
|
1657
|
+
if (node.key === "black") {
|
|
1658
|
+
hex = renderColorHex(colorPalette.black);
|
|
1659
|
+
}
|
|
1660
|
+
if (node.key === "white") {
|
|
1661
|
+
hex = renderColorHex(colorPalette.white);
|
|
1662
|
+
}
|
|
1663
|
+
if (node.hue && node.tint) {
|
|
1664
|
+
hex = renderColorHex(colorPalette[node.hue][node.tint]);
|
|
1665
|
+
}
|
|
1666
|
+
if (!hex) {
|
|
1667
|
+
throw new Error("Invalid color token value: ".concat(str));
|
|
1668
|
+
}
|
|
1669
|
+
try {
|
|
1670
|
+
hex = blendMode === "multiply" ? multiply$1(bg, hex) : screen$1(bg, hex);
|
|
1671
|
+
} catch (err) {
|
|
1672
|
+
console.log("could not blend", hex);
|
|
1673
|
+
}
|
|
1674
|
+
if (node.opacity !== void 0) {
|
|
1675
|
+
hex = rgba(hex, node.opacity);
|
|
1676
|
+
}
|
|
1677
|
+
return hex;
|
|
1678
|
+
}
|
|
1679
|
+
function renderColorHex(color) {
|
|
1680
|
+
return typeof color === "string" ? color : color.hex;
|
|
1681
|
+
}
|
|
1682
|
+
const defaultColorPalette = {
|
|
1683
|
+
...color$1,
|
|
1684
|
+
black: "#000000"
|
|
1685
|
+
};
|
|
1686
|
+
function buildTheme(config) {
|
|
1687
|
+
var _a, _b;
|
|
1688
|
+
return {
|
|
1689
|
+
color: renderColorTheme((_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.palette) != null ? _b : defaultColorPalette, {
|
|
1690
|
+
light: buildColorTheme({
|
|
1691
|
+
scheme: "light"
|
|
1692
|
+
}, config),
|
|
1693
|
+
dark: buildColorTheme({
|
|
1694
|
+
scheme: "dark"
|
|
1695
|
+
}, config)
|
|
1696
|
+
})
|
|
1697
|
+
};
|
|
1698
|
+
}
|
|
1012
1699
|
function createButtonTones(opts, base, dark, solid, muted, mode) {
|
|
1013
1700
|
return {
|
|
1014
1701
|
default: opts.button({
|
|
@@ -1201,11 +1888,11 @@ const tones$1 = {
|
|
|
1201
1888
|
}
|
|
1202
1889
|
};
|
|
1203
1890
|
const defaultOpts = {
|
|
1204
|
-
base:
|
|
1891
|
+
base: _ref8 => {
|
|
1205
1892
|
let {
|
|
1206
1893
|
dark,
|
|
1207
1894
|
name
|
|
1208
|
-
} =
|
|
1895
|
+
} = _ref8;
|
|
1209
1896
|
if (name === "default") {
|
|
1210
1897
|
return {
|
|
1211
1898
|
bg: dark ? black : white,
|
|
@@ -1241,13 +1928,13 @@ const defaultOpts = {
|
|
|
1241
1928
|
}
|
|
1242
1929
|
};
|
|
1243
1930
|
},
|
|
1244
|
-
solid:
|
|
1931
|
+
solid: _ref9 => {
|
|
1245
1932
|
let {
|
|
1246
1933
|
base,
|
|
1247
1934
|
dark,
|
|
1248
1935
|
state,
|
|
1249
1936
|
tone
|
|
1250
|
-
} =
|
|
1937
|
+
} = _ref9;
|
|
1251
1938
|
const color = colors[tone];
|
|
1252
1939
|
if (state === "hovered") {
|
|
1253
1940
|
return {
|
|
@@ -1294,13 +1981,13 @@ const defaultOpts = {
|
|
|
1294
1981
|
skeleton: base.skeleton
|
|
1295
1982
|
};
|
|
1296
1983
|
},
|
|
1297
|
-
muted:
|
|
1984
|
+
muted: _ref10 => {
|
|
1298
1985
|
let {
|
|
1299
1986
|
base,
|
|
1300
1987
|
dark,
|
|
1301
1988
|
state,
|
|
1302
1989
|
tone
|
|
1303
|
-
} =
|
|
1990
|
+
} = _ref10;
|
|
1304
1991
|
const color = colors[tone];
|
|
1305
1992
|
if (state === "hovered") {
|
|
1306
1993
|
return {
|
|
@@ -1347,13 +2034,13 @@ const defaultOpts = {
|
|
|
1347
2034
|
skeleton: base.skeleton
|
|
1348
2035
|
};
|
|
1349
2036
|
},
|
|
1350
|
-
button:
|
|
2037
|
+
button: _ref11 => {
|
|
1351
2038
|
let {
|
|
1352
2039
|
base,
|
|
1353
2040
|
mode,
|
|
1354
2041
|
muted,
|
|
1355
2042
|
solid
|
|
1356
|
-
} =
|
|
2043
|
+
} = _ref11;
|
|
1357
2044
|
if (mode === "bleed") {
|
|
1358
2045
|
return {
|
|
1359
2046
|
...muted,
|
|
@@ -1407,10 +2094,10 @@ const defaultOpts = {
|
|
|
1407
2094
|
};
|
|
1408
2095
|
return solid;
|
|
1409
2096
|
},
|
|
1410
|
-
card:
|
|
2097
|
+
card: _ref12 => {
|
|
1411
2098
|
let {
|
|
1412
2099
|
base
|
|
1413
|
-
} =
|
|
2100
|
+
} = _ref12;
|
|
1414
2101
|
return {
|
|
1415
2102
|
bg: black,
|
|
1416
2103
|
bg2: black,
|
|
@@ -1442,18 +2129,18 @@ const defaultOpts = {
|
|
|
1442
2129
|
placeholder: black
|
|
1443
2130
|
};
|
|
1444
2131
|
},
|
|
1445
|
-
selectable:
|
|
2132
|
+
selectable: _ref13 => {
|
|
1446
2133
|
let {
|
|
1447
2134
|
muted,
|
|
1448
2135
|
state,
|
|
1449
2136
|
tone
|
|
1450
|
-
} =
|
|
2137
|
+
} = _ref13;
|
|
1451
2138
|
return muted[tone][state];
|
|
1452
2139
|
},
|
|
1453
|
-
spot:
|
|
2140
|
+
spot: _ref14 => {
|
|
1454
2141
|
let {
|
|
1455
2142
|
key
|
|
1456
|
-
} =
|
|
2143
|
+
} = _ref14;
|
|
1457
2144
|
return spots[key];
|
|
1458
2145
|
},
|
|
1459
2146
|
syntax: () => ({
|
|
@@ -2168,7 +2855,7 @@ function _createColor(opts, dark, name) {
|
|
|
2168
2855
|
function multiply(bg, fg) {
|
|
2169
2856
|
const b = parseColor(bg);
|
|
2170
2857
|
const s = parseColor(fg);
|
|
2171
|
-
const hex = rgbToHex(multiply$
|
|
2858
|
+
const hex = rgbToHex(multiply$2(b, s));
|
|
2172
2859
|
if (s.a) {
|
|
2173
2860
|
return rgba(hex, s.a);
|
|
2174
2861
|
}
|
|
@@ -2177,7 +2864,7 @@ function multiply(bg, fg) {
|
|
|
2177
2864
|
function screen(bg, fg) {
|
|
2178
2865
|
const b = parseColor(bg);
|
|
2179
2866
|
const s = parseColor(fg);
|
|
2180
|
-
const hex = rgbToHex(screen$
|
|
2867
|
+
const hex = rgbToHex(screen$2(b, s));
|
|
2181
2868
|
if (s.a) {
|
|
2182
2869
|
return rgba(hex, s.a);
|
|
2183
2870
|
}
|
|
@@ -2193,11 +2880,11 @@ const tones = {
|
|
|
2193
2880
|
};
|
|
2194
2881
|
const NEUTRAL_TONES = ["default", "transparent"];
|
|
2195
2882
|
const color = createColorTheme({
|
|
2196
|
-
base:
|
|
2883
|
+
base: _ref15 => {
|
|
2197
2884
|
let {
|
|
2198
2885
|
dark,
|
|
2199
2886
|
name
|
|
2200
|
-
} =
|
|
2887
|
+
} = _ref15;
|
|
2201
2888
|
if (name === "default") {
|
|
2202
2889
|
const tints2 = hues.gray;
|
|
2203
2890
|
const skeletonFrom2 = dark ? tints2[900].hex : tints2[100].hex;
|
|
@@ -2257,14 +2944,14 @@ const color = createColorTheme({
|
|
|
2257
2944
|
}
|
|
2258
2945
|
};
|
|
2259
2946
|
},
|
|
2260
|
-
solid:
|
|
2947
|
+
solid: _ref16 => {
|
|
2261
2948
|
let {
|
|
2262
2949
|
base,
|
|
2263
2950
|
dark,
|
|
2264
2951
|
name,
|
|
2265
2952
|
state,
|
|
2266
2953
|
tone
|
|
2267
|
-
} =
|
|
2954
|
+
} = _ref16;
|
|
2268
2955
|
const mix = dark ? screen : multiply;
|
|
2269
2956
|
const mix2 = dark ? multiply : screen;
|
|
2270
2957
|
const defaultTints = tones[name] || tones.default;
|
|
@@ -2418,14 +3105,14 @@ const color = createColorTheme({
|
|
|
2418
3105
|
}
|
|
2419
3106
|
};
|
|
2420
3107
|
},
|
|
2421
|
-
muted:
|
|
3108
|
+
muted: _ref17 => {
|
|
2422
3109
|
let {
|
|
2423
3110
|
base,
|
|
2424
3111
|
dark,
|
|
2425
3112
|
name,
|
|
2426
3113
|
state,
|
|
2427
3114
|
tone
|
|
2428
|
-
} =
|
|
3115
|
+
} = _ref17;
|
|
2429
3116
|
const mix = dark ? screen : multiply;
|
|
2430
3117
|
const defaultTints = tones[name] || tones.default;
|
|
2431
3118
|
const isNeutral = NEUTRAL_TONES.includes(name) && NEUTRAL_TONES.includes(tone);
|
|
@@ -2581,13 +3268,13 @@ const color = createColorTheme({
|
|
|
2581
3268
|
}
|
|
2582
3269
|
};
|
|
2583
3270
|
},
|
|
2584
|
-
button:
|
|
3271
|
+
button: _ref18 => {
|
|
2585
3272
|
let {
|
|
2586
3273
|
base,
|
|
2587
3274
|
mode,
|
|
2588
3275
|
muted,
|
|
2589
3276
|
solid
|
|
2590
|
-
} =
|
|
3277
|
+
} = _ref18;
|
|
2591
3278
|
if (mode === "bleed") {
|
|
2592
3279
|
return {
|
|
2593
3280
|
enabled: {
|
|
@@ -2624,7 +3311,7 @@ const color = createColorTheme({
|
|
|
2624
3311
|
}
|
|
2625
3312
|
return solid;
|
|
2626
3313
|
},
|
|
2627
|
-
card:
|
|
3314
|
+
card: _ref19 => {
|
|
2628
3315
|
let {
|
|
2629
3316
|
base,
|
|
2630
3317
|
dark,
|
|
@@ -2632,7 +3319,7 @@ const color = createColorTheme({
|
|
|
2632
3319
|
name,
|
|
2633
3320
|
solid,
|
|
2634
3321
|
state
|
|
2635
|
-
} =
|
|
3322
|
+
} = _ref19;
|
|
2636
3323
|
if (state === "hovered") {
|
|
2637
3324
|
return muted[name].hovered;
|
|
2638
3325
|
}
|
|
@@ -2682,13 +3369,13 @@ const color = createColorTheme({
|
|
|
2682
3369
|
}
|
|
2683
3370
|
};
|
|
2684
3371
|
},
|
|
2685
|
-
input:
|
|
3372
|
+
input: _ref20 => {
|
|
2686
3373
|
let {
|
|
2687
3374
|
base,
|
|
2688
3375
|
dark,
|
|
2689
3376
|
mode,
|
|
2690
3377
|
state
|
|
2691
|
-
} =
|
|
3378
|
+
} = _ref20;
|
|
2692
3379
|
const mix = dark ? screen : multiply;
|
|
2693
3380
|
if (mode === "invalid") {
|
|
2694
3381
|
const tints = tones.critical;
|
|
@@ -2740,14 +3427,14 @@ const color = createColorTheme({
|
|
|
2740
3427
|
placeholder: mix(base.bg, hues.gray[dark ? 600 : 400].hex)
|
|
2741
3428
|
};
|
|
2742
3429
|
},
|
|
2743
|
-
selectable:
|
|
3430
|
+
selectable: _ref21 => {
|
|
2744
3431
|
let {
|
|
2745
3432
|
base,
|
|
2746
3433
|
muted,
|
|
2747
3434
|
tone,
|
|
2748
3435
|
solid,
|
|
2749
3436
|
state
|
|
2750
|
-
} =
|
|
3437
|
+
} = _ref21;
|
|
2751
3438
|
if (state === "enabled") {
|
|
2752
3439
|
return {
|
|
2753
3440
|
...muted[tone].enabled,
|
|
@@ -2774,20 +3461,20 @@ const color = createColorTheme({
|
|
|
2774
3461
|
}
|
|
2775
3462
|
return muted[tone][state];
|
|
2776
3463
|
},
|
|
2777
|
-
spot:
|
|
3464
|
+
spot: _ref22 => {
|
|
2778
3465
|
let {
|
|
2779
3466
|
base,
|
|
2780
3467
|
dark,
|
|
2781
3468
|
key
|
|
2782
|
-
} =
|
|
3469
|
+
} = _ref22;
|
|
2783
3470
|
const mix = dark ? screen : multiply;
|
|
2784
3471
|
return mix(base.bg, hues[key][dark ? 400 : 500].hex);
|
|
2785
3472
|
},
|
|
2786
|
-
syntax:
|
|
3473
|
+
syntax: _ref23 => {
|
|
2787
3474
|
let {
|
|
2788
3475
|
base,
|
|
2789
3476
|
dark
|
|
2790
|
-
} =
|
|
3477
|
+
} = _ref23;
|
|
2791
3478
|
const mix = dark ? screen : multiply;
|
|
2792
3479
|
const mainShade = dark ? 400 : 600;
|
|
2793
3480
|
const secondaryShade = dark ? 600 : 400;
|
|
@@ -3883,7 +4570,7 @@ var __defProp$E = Object.defineProperty;
|
|
|
3883
4570
|
var __template$D = (cooked, raw) => __freeze$D(__defProp$E(cooked, "raw", {
|
|
3884
4571
|
value: __freeze$D(raw || cooked.slice())
|
|
3885
4572
|
}));
|
|
3886
|
-
var _a$D, _b$
|
|
4573
|
+
var _a$D, _b$n, _c$d;
|
|
3887
4574
|
const ROOT_STYLE = css(_a$D || (_a$D = __template$D(["\n &:not([hidden]) {\n display: flex;\n }\n\n align-items: center;\n"])));
|
|
3888
4575
|
function textInputRootStyle() {
|
|
3889
4576
|
return ROOT_STYLE;
|
|
@@ -3897,7 +4584,7 @@ function textInputBaseStyle(props) {
|
|
|
3897
4584
|
} = props;
|
|
3898
4585
|
const font = theme.sanity.fonts.text;
|
|
3899
4586
|
const color = theme.sanity.color.input;
|
|
3900
|
-
return css(_b$
|
|
4587
|
+
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);
|
|
3901
4588
|
}
|
|
3902
4589
|
function textInputFontSizeStyle(props) {
|
|
3903
4590
|
const {
|
|
@@ -4013,7 +4700,7 @@ var __defProp$D = Object.defineProperty;
|
|
|
4013
4700
|
var __template$C = (cooked, raw) => __freeze$C(__defProp$D(cooked, "raw", {
|
|
4014
4701
|
value: __freeze$C(raw || cooked.slice())
|
|
4015
4702
|
}));
|
|
4016
|
-
var _a$C, _b$
|
|
4703
|
+
var _a$C, _b$m, _c$c;
|
|
4017
4704
|
function textBaseStyle(props) {
|
|
4018
4705
|
const {
|
|
4019
4706
|
$accent,
|
|
@@ -4023,7 +4710,7 @@ function textBaseStyle(props) {
|
|
|
4023
4710
|
const {
|
|
4024
4711
|
weights
|
|
4025
4712
|
} = theme.sanity.fonts.text;
|
|
4026
|
-
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$
|
|
4713
|
+
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);
|
|
4027
4714
|
}
|
|
4028
4715
|
var __freeze$B = Object.freeze;
|
|
4029
4716
|
var __defProp$C = Object.defineProperty;
|
|
@@ -4588,9 +5275,9 @@ var __defProp$z = Object.defineProperty;
|
|
|
4588
5275
|
var __template$y = (cooked, raw) => __freeze$y(__defProp$z(cooked, "raw", {
|
|
4589
5276
|
value: __freeze$y(raw || cooked.slice())
|
|
4590
5277
|
}));
|
|
4591
|
-
var _a$y, _b$
|
|
5278
|
+
var _a$y, _b$l;
|
|
4592
5279
|
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"])));
|
|
4593
|
-
const Root$x = styled(Text)(_b$
|
|
5280
|
+
const Root$x = styled(Text)(_b$l || (_b$l = __template$y(["\n & > span > svg {\n animation: ", " 500ms linear infinite;\n }\n"])), rotate$1);
|
|
4594
5281
|
const Spinner = forwardRef(function Spinner2(props, ref) {
|
|
4595
5282
|
return /* @__PURE__ */jsx(Root$x, {
|
|
4596
5283
|
"data-ui": "Spinner",
|
|
@@ -4635,9 +5322,12 @@ var __defProp$y = Object.defineProperty;
|
|
|
4635
5322
|
var __template$x = (cooked, raw) => __freeze$x(__defProp$y(cooked, "raw", {
|
|
4636
5323
|
value: __freeze$x(raw || cooked.slice())
|
|
4637
5324
|
}));
|
|
4638
|
-
var _a$x;
|
|
4639
|
-
function buttonBaseStyles() {
|
|
4640
|
-
|
|
5325
|
+
var _a$x, _b$k;
|
|
5326
|
+
function buttonBaseStyles(_ref24) {
|
|
5327
|
+
let {
|
|
5328
|
+
$width
|
|
5329
|
+
} = _ref24;
|
|
5330
|
+
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: -webkit-fill-available;\n width: stretch;\n "]))));
|
|
4641
5331
|
}
|
|
4642
5332
|
const buttonTheme = {
|
|
4643
5333
|
border: {
|
|
@@ -4652,7 +5342,7 @@ function combineBoxShadow() {
|
|
|
4652
5342
|
return boxShadows.filter(Boolean).join(",");
|
|
4653
5343
|
}
|
|
4654
5344
|
function buttonColorStyles(props) {
|
|
4655
|
-
var _a2,
|
|
5345
|
+
var _a2, _b2;
|
|
4656
5346
|
const {
|
|
4657
5347
|
$mode,
|
|
4658
5348
|
theme
|
|
@@ -4695,7 +5385,7 @@ function buttonColorStyles(props) {
|
|
|
4695
5385
|
},
|
|
4696
5386
|
"&[data-selected]": _colorVarsStyle(base, color.pressed)
|
|
4697
5387
|
}
|
|
4698
|
-
}, (
|
|
5388
|
+
}, (_b2 = (_a2 = theme.sanity.styles) == null ? void 0 : _a2.button) == null ? void 0 : _b2.root].filter(Boolean);
|
|
4699
5389
|
}
|
|
4700
5390
|
var __freeze$w = Object.freeze;
|
|
4701
5391
|
var __defProp$x = Object.defineProperty;
|
|
@@ -4730,6 +5420,7 @@ const Button = forwardRef(function Button2(props, ref) {
|
|
|
4730
5420
|
tone = "default",
|
|
4731
5421
|
type = "button",
|
|
4732
5422
|
muted = false,
|
|
5423
|
+
width,
|
|
4733
5424
|
...restProps
|
|
4734
5425
|
} = props;
|
|
4735
5426
|
const justify = useArrayProp(justifyProp);
|
|
@@ -4764,6 +5455,7 @@ const Button = forwardRef(function Button2(props, ref) {
|
|
|
4764
5455
|
disabled: Boolean(loading || disabled),
|
|
4765
5456
|
ref,
|
|
4766
5457
|
type,
|
|
5458
|
+
$width: width,
|
|
4767
5459
|
children: [Boolean(loading) && /* @__PURE__ */jsx(LoadingBox, {
|
|
4768
5460
|
children: /* @__PURE__ */jsx(Spinner, {})
|
|
4769
5461
|
}), (icon || text || iconRight) && /* @__PURE__ */jsx(Box, {
|
|
@@ -4992,10 +5684,10 @@ var __template$t = (cooked, raw) => __freeze$t(__defProp$u(cooked, "raw", {
|
|
|
4992
5684
|
value: __freeze$t(raw || cooked.slice())
|
|
4993
5685
|
}));
|
|
4994
5686
|
var _a$t;
|
|
4995
|
-
function codeSyntaxHighlightingStyle(
|
|
5687
|
+
function codeSyntaxHighlightingStyle(_ref25) {
|
|
4996
5688
|
let {
|
|
4997
5689
|
theme
|
|
4998
|
-
} =
|
|
5690
|
+
} = _ref25;
|
|
4999
5691
|
const color = theme.sanity.color.syntax;
|
|
5000
5692
|
return {
|
|
5001
5693
|
"&.atrule": {
|
|
@@ -6303,13 +6995,13 @@ const Popover = memo(forwardRef(function Popover2(props, ref) {
|
|
|
6303
6995
|
}));
|
|
6304
6996
|
if (constrainSize || matchReferenceWidth) {
|
|
6305
6997
|
ret.push(size({
|
|
6306
|
-
apply(
|
|
6998
|
+
apply(_ref26) {
|
|
6307
6999
|
let {
|
|
6308
7000
|
availableWidth,
|
|
6309
7001
|
availableHeight,
|
|
6310
7002
|
elements,
|
|
6311
7003
|
referenceWidth
|
|
6312
|
-
} =
|
|
7004
|
+
} = _ref26;
|
|
6313
7005
|
referenceWidthRef.current = referenceWidth;
|
|
6314
7006
|
const _currentWidth = widthRef.current;
|
|
6315
7007
|
const _maxWidth = maxWidthRef.current;
|
|
@@ -7118,12 +7810,12 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
|
|
|
7118
7810
|
mainAxis: 3
|
|
7119
7811
|
}));
|
|
7120
7812
|
ret.push(size$2({
|
|
7121
|
-
apply(
|
|
7813
|
+
apply(_ref27) {
|
|
7122
7814
|
let {
|
|
7123
7815
|
availableWidth,
|
|
7124
7816
|
availableHeight,
|
|
7125
7817
|
elements
|
|
7126
|
-
} =
|
|
7818
|
+
} = _ref27;
|
|
7127
7819
|
Object.assign(elements.floating.style, {
|
|
7128
7820
|
maxWidth: "".concat(availableWidth - 4 * 2, "px"),
|
|
7129
7821
|
// the padding is `4px`
|
|
@@ -7429,10 +8121,10 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete2(props, ref) {
|
|
|
7429
8121
|
query,
|
|
7430
8122
|
value
|
|
7431
8123
|
} = state;
|
|
7432
|
-
const defaultRenderOption = useCallback(
|
|
8124
|
+
const defaultRenderOption = useCallback(_ref28 => {
|
|
7433
8125
|
let {
|
|
7434
8126
|
value: value2
|
|
7435
|
-
} =
|
|
8127
|
+
} = _ref28;
|
|
7436
8128
|
return /* @__PURE__ */jsx(Card, {
|
|
7437
8129
|
"data-as": "button",
|
|
7438
8130
|
padding: paddingProp,
|
|
@@ -7886,10 +8578,10 @@ const Breadcrumbs = forwardRef(function Breadcrumbs2(props, ref) {
|
|
|
7886
8578
|
});
|
|
7887
8579
|
});
|
|
7888
8580
|
const BORDER_OFFSET_X = 12;
|
|
7889
|
-
function dialogStyle(
|
|
8581
|
+
function dialogStyle(_ref29) {
|
|
7890
8582
|
let {
|
|
7891
8583
|
theme
|
|
7892
|
-
} =
|
|
8584
|
+
} = _ref29;
|
|
7893
8585
|
const color = theme.sanity.color.base;
|
|
7894
8586
|
return {
|
|
7895
8587
|
"&:not([hidden])": {
|
|
@@ -8974,15 +9666,15 @@ var __template$6 = (cooked, raw) => __freeze$6(__defProp$6(cooked, "raw", {
|
|
|
8974
9666
|
var _a$6, _b$3, _c$1, _d;
|
|
8975
9667
|
const keyframe = keyframes(_a$6 || (_a$6 = __template$6(["\n 0% {\n background-position: 100%;\n }\n 100% {\n background-position: -100%;\n }\n"])));
|
|
8976
9668
|
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);
|
|
8977
|
-
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"])),
|
|
9669
|
+
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 => {
|
|
8978
9670
|
let {
|
|
8979
9671
|
$visible
|
|
8980
|
-
} =
|
|
9672
|
+
} = _ref30;
|
|
8981
9673
|
return $visible ? 1 : 0;
|
|
8982
|
-
},
|
|
9674
|
+
}, _ref31 => {
|
|
8983
9675
|
let {
|
|
8984
9676
|
$animated
|
|
8985
|
-
} =
|
|
9677
|
+
} = _ref31;
|
|
8986
9678
|
return $animated ? animation : css(_c$1 || (_c$1 = __template$6(["\n background-color: var(--card-skeleton-color-from);\n "])));
|
|
8987
9679
|
});
|
|
8988
9680
|
const Root$4 = styled(Box)(responsiveRadiusStyle, skeletonStyle);
|
|
@@ -9013,12 +9705,12 @@ const Skeleton = forwardRef(function Skeleton2(props, ref) {
|
|
|
9013
9705
|
ref
|
|
9014
9706
|
});
|
|
9015
9707
|
});
|
|
9016
|
-
const Root$3 = styled(Skeleton)(
|
|
9708
|
+
const Root$3 = styled(Skeleton)(_ref32 => {
|
|
9017
9709
|
let {
|
|
9018
9710
|
$size,
|
|
9019
9711
|
$style,
|
|
9020
9712
|
theme
|
|
9021
|
-
} =
|
|
9713
|
+
} = _ref32;
|
|
9022
9714
|
const {
|
|
9023
9715
|
media
|
|
9024
9716
|
} = theme.sanity;
|
|
@@ -9366,12 +10058,12 @@ function ToastProvider(props) {
|
|
|
9366
10058
|
paddingY,
|
|
9367
10059
|
children: /* @__PURE__ */jsx(AnimatePresence, {
|
|
9368
10060
|
initial: false,
|
|
9369
|
-
children: state.map(
|
|
10061
|
+
children: state.map(_ref33 => {
|
|
9370
10062
|
let {
|
|
9371
10063
|
dismiss,
|
|
9372
10064
|
id,
|
|
9373
10065
|
params
|
|
9374
|
-
} =
|
|
10066
|
+
} = _ref33;
|
|
9375
10067
|
return /* @__PURE__ */jsx(motion.div, {
|
|
9376
10068
|
animate: {
|
|
9377
10069
|
opacity: 1,
|
|
@@ -9871,5 +10563,5 @@ const TreeItem = memo(function TreeItem2(props) {
|
|
|
9871
10563
|
})]
|
|
9872
10564
|
});
|
|
9873
10565
|
});
|
|
9874
|
-
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$
|
|
10566
|
+
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 };
|
|
9875
10567
|
//# sourceMappingURL=index.esm.js.map
|