@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.
- package/dist/index.cjs.mjs +28 -0
- package/dist/index.d.ts +476 -12
- package/dist/index.esm.js +1326 -524
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1353 -523
- package/dist/index.js.map +1 -1
- package/package.json +6 -8
- package/src/components/autocomplete/autocomplete.tsx +6 -0
- package/src/components/dialog/constants.ts +4 -0
- package/src/components/dialog/dialog.tsx +79 -15
- package/src/components/hotkeys/hotkeys.tsx +2 -0
- package/src/components/menu/menu.tsx +2 -0
- package/src/components/menu/menuButton.tsx +2 -0
- package/src/components/menu/menuGroup.tsx +22 -23
- package/src/components/menu/menuItem.tsx +29 -35
- package/src/components/tab/tab.tsx +4 -1
- package/src/components/toast/toast.tsx +4 -0
- package/src/primitives/_selectable/style.ts +2 -1
- package/src/primitives/avatar/avatar.tsx +16 -9
- package/src/primitives/avatar/avatarCounter.tsx +3 -3
- package/src/primitives/avatar/styles.ts +1 -1
- package/src/primitives/badge/badge.tsx +7 -3
- package/src/primitives/box/box.tsx +3 -0
- package/src/primitives/button/__workshop__/sanityUploadButton.tsx +2 -1
- package/src/primitives/button/button.tsx +7 -3
- package/src/primitives/button/styles.ts +9 -2
- package/src/primitives/card/card.tsx +4 -0
- package/src/primitives/card/styles.ts +2 -0
- package/src/primitives/checkbox/checkbox.tsx +2 -0
- package/src/primitives/code/code.tsx +1 -0
- package/src/primitives/container/container.tsx +2 -0
- package/src/primitives/flex/flex.tsx +2 -0
- package/src/primitives/grid/grid.tsx +2 -0
- package/src/primitives/heading/heading.tsx +2 -0
- package/src/primitives/inline/inline.tsx +3 -0
- package/src/primitives/kbd/kbd.tsx +2 -0
- package/src/primitives/label/label.tsx +2 -0
- package/src/primitives/popover/popover.tsx +6 -1
- package/src/primitives/radio/radio.tsx +2 -0
- package/src/primitives/select/select.tsx +2 -0
- package/src/primitives/select/styles.ts +2 -0
- package/src/primitives/spinner/spinner.tsx +2 -0
- package/src/primitives/stack/stack.tsx +2 -0
- package/src/primitives/switch/switch.tsx +4 -0
- package/src/primitives/text/text.tsx +3 -0
- package/src/primitives/textArea/textArea.tsx +4 -1
- package/src/primitives/textInput/textInput.tsx +10 -1
- package/src/primitives/tooltip/__workshop__/customPortal.tsx +99 -0
- package/src/primitives/tooltip/__workshop__/index.ts +15 -0
- package/src/primitives/tooltip/__workshop__/overflowingBoundary.tsx +73 -0
- package/src/primitives/tooltip/__workshop__/resizableBoundary.tsx +85 -0
- package/src/primitives/tooltip/constants.ts +1 -0
- package/src/primitives/tooltip/tooltip.test.tsx +192 -0
- package/src/primitives/tooltip/tooltip.tsx +109 -33
- package/src/primitives/types.ts +4 -0
- package/src/styles/input/textInputStyle.ts +11 -6
- package/src/theme/_internal/__workshop__/build/story.tsx +288 -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 +16 -0
- package/src/theme/_internal/build/colorTheme/buildColorTheme.test.ts +185 -0
- package/src/theme/_internal/build/colorTheme/buildColorTheme.ts +164 -0
- package/src/theme/_internal/build/colorTheme/renderColorTheme.ts +242 -0
- package/src/theme/_internal/build/colorTheme/resolveColorTokens.ts +121 -0
- package/src/theme/_internal/build/defaults/colorPalette.ts +8 -0
- package/src/theme/_internal/build/defaults/colorTokens.ts +147 -0
- package/src/theme/_internal/build/helpers.ts +65 -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 +137 -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 +91 -0
- package/src/theme/index.ts +1 -0
- package/src/theme/lib/color-fns/blend/multiply.ts +2 -2
- package/src/theme/lib/color-fns/blend/screen.ts +2 -2
- package/src/theme/lib/color-fns/convert.ts +15 -1
- package/src/theme/lib/color-fns/parse.ts +7 -3
- package/src/theme/lib/color-fns/types.ts +11 -0
- package/src/theme/lib/theme/avatar.ts +2 -0
- package/src/theme/lib/theme/color/_legacy/createColorTheme.ts +7 -0
- package/src/theme/lib/theme/color/_legacy/index.ts +1 -0
- package/src/theme/lib/theme/color/_legacy/legacyColor.ts +3997 -0
- package/src/theme/studioTheme/color.ts +98 -82
- package/src/theme/studioTheme/helpers.ts +15 -1
- package/src/theme/studioTheme/theme.ts +5 -5
- package/src/theme/studioTheme/tints.ts +244 -84
- package/src/types/button.ts +5 -0
package/dist/index.js
CHANGED
|
@@ -734,7 +734,7 @@ var ResizeObserverController = function () {
|
|
|
734
734
|
};
|
|
735
735
|
return ResizeObserverController;
|
|
736
736
|
}();
|
|
737
|
-
var ResizeObserver = function () {
|
|
737
|
+
var ResizeObserver$1 = function () {
|
|
738
738
|
function ResizeObserver(callback) {
|
|
739
739
|
if (arguments.length === 0) {
|
|
740
740
|
throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");
|
|
@@ -770,7 +770,7 @@ var ResizeObserver = function () {
|
|
|
770
770
|
};
|
|
771
771
|
return ResizeObserver;
|
|
772
772
|
}();
|
|
773
|
-
const _ResizeObserver = typeof document !== "undefined" && typeof window !== "undefined" && window.ResizeObserver ? window.ResizeObserver : ResizeObserver;
|
|
773
|
+
const _ResizeObserver = typeof document !== "undefined" && typeof window !== "undefined" && window.ResizeObserver ? window.ResizeObserver : ResizeObserver$1;
|
|
774
774
|
const _elementSizeObserver = _createElementSizeObserver();
|
|
775
775
|
function _createElementRectValueListener() {
|
|
776
776
|
return {
|
|
@@ -844,10 +844,166 @@ function useGlobalKeyDown(onKeyDown) {
|
|
|
844
844
|
return () => removeEventListener("keydown", onKeyDown);
|
|
845
845
|
}, [onKeyDown]);
|
|
846
846
|
}
|
|
847
|
+
const COLOR_HUES = ["gray", "cyan", "blue", "purple", "magenta", "red", "orange", "yellow", "green"];
|
|
848
|
+
const COLOR_TINTS = ["50", "100", "200", "300", "400", "500", "600", "700", "800", "900", "950"];
|
|
849
|
+
const COLOR_BASE_TONES = ["transparent", "default", "primary",
|
|
850
|
+
// todo: rename to `accent`
|
|
851
|
+
"positive", "caution", "critical"];
|
|
852
|
+
const COLOR_STATE_TONES = ["default", "primary",
|
|
853
|
+
// todo: rename to `accent`
|
|
854
|
+
"positive", "caution", "critical"];
|
|
855
|
+
const COLOR_STATES = ["enabled", "hovered", "pressed", "selected", "disabled"];
|
|
856
|
+
const COLOR_BUTTON_MODES = ["default", "ghost", "bleed"];
|
|
857
|
+
const COLOR_BLEND_MODES = ["multiply", "screen"];
|
|
858
|
+
const defaultColorTokens = {
|
|
859
|
+
"*": {
|
|
860
|
+
_blend: ["multiply", "screen"],
|
|
861
|
+
bg: ["50", "950"],
|
|
862
|
+
fg: ["800", "200"],
|
|
863
|
+
border: ["200", "800"],
|
|
864
|
+
focusRing: ["cyan/500", "cyan/500"],
|
|
865
|
+
shadow: {
|
|
866
|
+
outline: ["500/0.25", "400/0.3"],
|
|
867
|
+
umbra: ["500/0.1", "black/0.4"],
|
|
868
|
+
penumbra: ["500/0.07", "black/0.28"],
|
|
869
|
+
ambient: ["500/0.06", "black/0.24"]
|
|
870
|
+
},
|
|
871
|
+
skeleton: {
|
|
872
|
+
from: ["100", "900"],
|
|
873
|
+
to: ["100/0.5", "900/0.5"]
|
|
874
|
+
}
|
|
875
|
+
},
|
|
876
|
+
transparent: {
|
|
877
|
+
bg: ["50", "black"],
|
|
878
|
+
fg: ["600", "400"]
|
|
879
|
+
},
|
|
880
|
+
default: {
|
|
881
|
+
bg: ["white", "950"],
|
|
882
|
+
fg: ["black", "200"]
|
|
883
|
+
},
|
|
884
|
+
primary: {
|
|
885
|
+
_hue: "cyan"
|
|
886
|
+
},
|
|
887
|
+
positive: {
|
|
888
|
+
_hue: "cyan"
|
|
889
|
+
},
|
|
890
|
+
caution: {
|
|
891
|
+
_hue: "yellow"
|
|
892
|
+
},
|
|
893
|
+
critical: {
|
|
894
|
+
_hue: "red"
|
|
895
|
+
},
|
|
896
|
+
button: {
|
|
897
|
+
"*": {
|
|
898
|
+
default: {
|
|
899
|
+
"*": {
|
|
900
|
+
_blend: ["screen", "multiply"],
|
|
901
|
+
bg: ["500", "400"],
|
|
902
|
+
bg2: ["950", "50"],
|
|
903
|
+
border: ["500/0", "400/0"],
|
|
904
|
+
muted: {
|
|
905
|
+
fg: ["200", "700"]
|
|
906
|
+
}
|
|
907
|
+
},
|
|
908
|
+
hovered: {
|
|
909
|
+
bg: ["600", "300"],
|
|
910
|
+
border: ["600/0", "300/0"]
|
|
911
|
+
},
|
|
912
|
+
pressed: {
|
|
913
|
+
bg: ["700", "200"]
|
|
914
|
+
},
|
|
915
|
+
selected: {
|
|
916
|
+
bg: ["700", "200"]
|
|
917
|
+
},
|
|
918
|
+
disabled: {
|
|
919
|
+
_hue: "gray",
|
|
920
|
+
bg: ["200", "900"]
|
|
921
|
+
}
|
|
922
|
+
},
|
|
923
|
+
ghost: {
|
|
924
|
+
"*": {
|
|
925
|
+
_blend: ["multiply", "screen"],
|
|
926
|
+
bg: ["white", "black"],
|
|
927
|
+
bg2: ["50", "950"],
|
|
928
|
+
fg: ["600", "400"],
|
|
929
|
+
border: ["200", "800"],
|
|
930
|
+
muted: {
|
|
931
|
+
fg: ["600/0.6", "400/0.6"]
|
|
932
|
+
}
|
|
933
|
+
},
|
|
934
|
+
hovered: {
|
|
935
|
+
bg: ["50", "950"],
|
|
936
|
+
fg: ["700", "300"]
|
|
937
|
+
},
|
|
938
|
+
pressed: {
|
|
939
|
+
bg: ["100", "900"],
|
|
940
|
+
fg: ["800", "200"]
|
|
941
|
+
},
|
|
942
|
+
selected: {
|
|
943
|
+
bg: ["100", "900"],
|
|
944
|
+
fg: ["800", "200"]
|
|
945
|
+
},
|
|
946
|
+
disabled: {
|
|
947
|
+
_hue: "gray",
|
|
948
|
+
fg: ["200", "900"],
|
|
949
|
+
border: ["100", "950"]
|
|
950
|
+
}
|
|
951
|
+
},
|
|
952
|
+
bleed: {
|
|
953
|
+
"*": {
|
|
954
|
+
_blend: ["multiply", "screen"],
|
|
955
|
+
bg: ["white", "black"],
|
|
956
|
+
bg2: ["50", "950"],
|
|
957
|
+
fg: ["600", "400"],
|
|
958
|
+
border: ["white/0", "black/0"],
|
|
959
|
+
muted: {
|
|
960
|
+
fg: ["600/0.6", "400/0.6"]
|
|
961
|
+
}
|
|
962
|
+
},
|
|
963
|
+
hovered: {
|
|
964
|
+
bg: ["50", "950"],
|
|
965
|
+
fg: ["700", "300"]
|
|
966
|
+
},
|
|
967
|
+
pressed: {
|
|
968
|
+
bg: ["100", "900"],
|
|
969
|
+
fg: ["800", "200"]
|
|
970
|
+
},
|
|
971
|
+
selected: {
|
|
972
|
+
bg: ["100", "900"],
|
|
973
|
+
fg: ["800", "200"]
|
|
974
|
+
},
|
|
975
|
+
disabled: {
|
|
976
|
+
_hue: "gray",
|
|
977
|
+
fg: ["200", "900"]
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
},
|
|
981
|
+
default: {
|
|
982
|
+
default: {
|
|
983
|
+
"*": {
|
|
984
|
+
bg: ["900", "200"]
|
|
985
|
+
},
|
|
986
|
+
hovered: {
|
|
987
|
+
bg: ["black", "100"]
|
|
988
|
+
},
|
|
989
|
+
pressed: {
|
|
990
|
+
bg: ["900", "200"]
|
|
991
|
+
},
|
|
992
|
+
selected: {
|
|
993
|
+
bg: ["black", "200"]
|
|
994
|
+
},
|
|
995
|
+
disabled: {
|
|
996
|
+
_hue: "gray",
|
|
997
|
+
bg: ["200", "900"]
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
};
|
|
847
1003
|
function multiplyChannel(b, s) {
|
|
848
1004
|
return b * s;
|
|
849
1005
|
}
|
|
850
|
-
function multiply$
|
|
1006
|
+
function multiply$2(b, s) {
|
|
851
1007
|
return {
|
|
852
1008
|
r: Math.round(clamp$1(multiplyChannel(b.r / 255, s.r / 255) * 255)),
|
|
853
1009
|
g: Math.round(clamp$1(multiplyChannel(b.g / 255, s.g / 255) * 255)),
|
|
@@ -860,7 +1016,7 @@ function clamp$1(num) {
|
|
|
860
1016
|
function screenChannel(b, s) {
|
|
861
1017
|
return b + s - b * s;
|
|
862
1018
|
}
|
|
863
|
-
function screen$
|
|
1019
|
+
function screen$2(b, s) {
|
|
864
1020
|
return {
|
|
865
1021
|
r: Math.round(clamp(screenChannel(b.r / 255, s.r / 255) * 255)),
|
|
866
1022
|
g: Math.round(clamp(screenChannel(b.g / 255, s.g / 255) * 255)),
|
|
@@ -887,6 +1043,15 @@ function hexToRgb(hex) {
|
|
|
887
1043
|
b: parseInt(hex.slice(5, 7), 16)
|
|
888
1044
|
};
|
|
889
1045
|
}
|
|
1046
|
+
function rgbaToRGBA(rgba) {
|
|
1047
|
+
const values = rgba.replace(/rgba\(|\)/g, "").split(",");
|
|
1048
|
+
return {
|
|
1049
|
+
r: parseInt(values[0]),
|
|
1050
|
+
g: parseInt(values[1]),
|
|
1051
|
+
b: parseInt(values[2]),
|
|
1052
|
+
a: parseFloat(values[3])
|
|
1053
|
+
};
|
|
1054
|
+
}
|
|
890
1055
|
function rgbToHex(_ref2) {
|
|
891
1056
|
let {
|
|
892
1057
|
r,
|
|
@@ -1004,12 +1169,658 @@ function parseColor(color) {
|
|
|
1004
1169
|
if (color.startsWith("hsl(")) {
|
|
1005
1170
|
return hslToRgb(parseHsl(color));
|
|
1006
1171
|
}
|
|
1172
|
+
if (color.startsWith("rgba(")) {
|
|
1173
|
+
return rgbaToRGBA(color);
|
|
1174
|
+
}
|
|
1007
1175
|
throw new Error('parseColor: unexpected color format: "'.concat(color, '"'));
|
|
1008
1176
|
}
|
|
1009
1177
|
function rgba(color, a) {
|
|
1010
1178
|
const rgb = parseColor(color);
|
|
1011
1179
|
return "rgba(".concat(rgb.r, ",").concat(rgb.g, ",").concat(rgb.b, ",").concat(a, ")");
|
|
1012
1180
|
}
|
|
1181
|
+
function isColorBlendModeValue(str) {
|
|
1182
|
+
return COLOR_BLEND_MODES.includes(str);
|
|
1183
|
+
}
|
|
1184
|
+
function isColorHueValue(str) {
|
|
1185
|
+
return COLOR_HUES.includes(str);
|
|
1186
|
+
}
|
|
1187
|
+
function isColorTintValue(str) {
|
|
1188
|
+
return COLOR_TINTS.includes(str);
|
|
1189
|
+
}
|
|
1190
|
+
function isColorButtonMode(str) {
|
|
1191
|
+
return COLOR_BUTTON_MODES.includes(str);
|
|
1192
|
+
}
|
|
1193
|
+
function parseTokenKey(str) {
|
|
1194
|
+
const segments = str.split("/");
|
|
1195
|
+
const segment0 = segments.shift() || "";
|
|
1196
|
+
if (isColorConfigBaseTone(segment0)) {
|
|
1197
|
+
const key = segments.join("/");
|
|
1198
|
+
if (isColorConfigBaseKey(key)) {
|
|
1199
|
+
return {
|
|
1200
|
+
type: "base",
|
|
1201
|
+
tone: segment0,
|
|
1202
|
+
key
|
|
1203
|
+
};
|
|
1204
|
+
}
|
|
1205
|
+
if (isColorConfigBlendKey(key)) {
|
|
1206
|
+
return {
|
|
1207
|
+
type: "base",
|
|
1208
|
+
tone: segment0,
|
|
1209
|
+
key
|
|
1210
|
+
};
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
if (segment0 === "button") {
|
|
1214
|
+
const segment1 = segments.shift() || "";
|
|
1215
|
+
if (isColorConfigStateTone(segment1)) {
|
|
1216
|
+
const segment2 = segments.shift() || "";
|
|
1217
|
+
if (isColorButtonMode(segment2)) {
|
|
1218
|
+
const key = segments.join("/");
|
|
1219
|
+
if (isColorConfigStateKey(key)) {
|
|
1220
|
+
return {
|
|
1221
|
+
type: "button",
|
|
1222
|
+
tone: segment1,
|
|
1223
|
+
mode: segment2,
|
|
1224
|
+
key
|
|
1225
|
+
};
|
|
1226
|
+
}
|
|
1227
|
+
if (isColorConfigBlendKey(key)) {
|
|
1228
|
+
return {
|
|
1229
|
+
type: "button",
|
|
1230
|
+
tone: segment1,
|
|
1231
|
+
mode: segment2,
|
|
1232
|
+
key
|
|
1233
|
+
};
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
return void 0;
|
|
1239
|
+
}
|
|
1240
|
+
function parseTokenValue(str) {
|
|
1241
|
+
const segments = str.split("/");
|
|
1242
|
+
const segment0 = segments.shift() || "";
|
|
1243
|
+
if (isColorTintValue(segment0)) {
|
|
1244
|
+
const tint = segment0;
|
|
1245
|
+
const segment1 = segments.shift() || "";
|
|
1246
|
+
if (isColorOpacityValue(segment1)) {
|
|
1247
|
+
const opacity = Number(segment1);
|
|
1248
|
+
return {
|
|
1249
|
+
type: "color",
|
|
1250
|
+
tint,
|
|
1251
|
+
opacity
|
|
1252
|
+
};
|
|
1253
|
+
}
|
|
1254
|
+
return {
|
|
1255
|
+
type: "color",
|
|
1256
|
+
tint
|
|
1257
|
+
};
|
|
1258
|
+
}
|
|
1259
|
+
if (isColorValue(segment0)) {
|
|
1260
|
+
const key = segment0;
|
|
1261
|
+
const segment1 = segments.shift() || "";
|
|
1262
|
+
if (isColorOpacityValue(segment1)) {
|
|
1263
|
+
const opacity = Number(segment1);
|
|
1264
|
+
return {
|
|
1265
|
+
type: "color",
|
|
1266
|
+
key,
|
|
1267
|
+
opacity
|
|
1268
|
+
};
|
|
1269
|
+
}
|
|
1270
|
+
return {
|
|
1271
|
+
type: "color",
|
|
1272
|
+
key
|
|
1273
|
+
};
|
|
1274
|
+
}
|
|
1275
|
+
if (isColorHueValue(segment0)) {
|
|
1276
|
+
const hue = segment0;
|
|
1277
|
+
const segment1 = segments.shift() || "";
|
|
1278
|
+
if (isColorTintValue(segment1)) {
|
|
1279
|
+
const tint = segment1;
|
|
1280
|
+
const segment2 = segments.shift() || "";
|
|
1281
|
+
if (isColorOpacityValue(segment2)) {
|
|
1282
|
+
const opacity = Number(segment2);
|
|
1283
|
+
return {
|
|
1284
|
+
type: "color",
|
|
1285
|
+
key: "".concat(hue, "/").concat(tint),
|
|
1286
|
+
hue,
|
|
1287
|
+
tint,
|
|
1288
|
+
opacity
|
|
1289
|
+
};
|
|
1290
|
+
}
|
|
1291
|
+
return {
|
|
1292
|
+
type: "color",
|
|
1293
|
+
key: "".concat(hue, "/").concat(tint),
|
|
1294
|
+
hue,
|
|
1295
|
+
tint
|
|
1296
|
+
};
|
|
1297
|
+
}
|
|
1298
|
+
return {
|
|
1299
|
+
type: "hue",
|
|
1300
|
+
value: "".concat(hue)
|
|
1301
|
+
};
|
|
1302
|
+
}
|
|
1303
|
+
if (isColorOpacityValue(segment0)) {
|
|
1304
|
+
const opacity = Number(segment0);
|
|
1305
|
+
return {
|
|
1306
|
+
type: "color",
|
|
1307
|
+
opacity
|
|
1308
|
+
};
|
|
1309
|
+
}
|
|
1310
|
+
if (isColorBlendModeValue(segment0)) {
|
|
1311
|
+
const value = segment0;
|
|
1312
|
+
return {
|
|
1313
|
+
type: "blendMode",
|
|
1314
|
+
value
|
|
1315
|
+
};
|
|
1316
|
+
}
|
|
1317
|
+
return void 0;
|
|
1318
|
+
}
|
|
1319
|
+
const COLOR_CONFIG_BASE_TONES = ["*", ...COLOR_BASE_TONES];
|
|
1320
|
+
const COLOR_CONFIG_STATE_TONES = ["*", ...COLOR_STATE_TONES];
|
|
1321
|
+
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"];
|
|
1322
|
+
const COLOR_CONFIG_STATE_KEYS = ["_hue", "bg", "fg", "border", "focusRing", "muted/fg", "link/fg", "code/bg", "code/fg", "skeleton/from", "skeleton/to"];
|
|
1323
|
+
const COLOR_CONFIG_BLEND_KEYS = ["_blend"];
|
|
1324
|
+
function isColorConfigBaseTone(str) {
|
|
1325
|
+
return COLOR_CONFIG_BASE_TONES.includes(str);
|
|
1326
|
+
}
|
|
1327
|
+
function isColorConfigBaseKey(str) {
|
|
1328
|
+
return COLOR_CONFIG_BASE_KEYS.includes(str);
|
|
1329
|
+
}
|
|
1330
|
+
function isColorConfigStateKey(str) {
|
|
1331
|
+
return COLOR_CONFIG_STATE_KEYS.includes(str);
|
|
1332
|
+
}
|
|
1333
|
+
function isColorConfigStateTone(str) {
|
|
1334
|
+
return COLOR_CONFIG_STATE_TONES.includes(str);
|
|
1335
|
+
}
|
|
1336
|
+
function isColorConfigBlendKey(str) {
|
|
1337
|
+
return COLOR_CONFIG_BLEND_KEYS.includes(str);
|
|
1338
|
+
}
|
|
1339
|
+
function isColorTokenValue(str) {
|
|
1340
|
+
var _a, _b;
|
|
1341
|
+
return ((_a = parseTokenValue(str)) == null ? void 0 : _a.type) === "color" || ((_b = parseTokenValue(str)) == null ? void 0 : _b.type) === "hue";
|
|
1342
|
+
}
|
|
1343
|
+
function isColorValue(str) {
|
|
1344
|
+
return str === "black" || str === "white";
|
|
1345
|
+
}
|
|
1346
|
+
function isColorOpacityValue(str) {
|
|
1347
|
+
return str === "0" || /^0\.[0-9]+$/.test(str) || str === "1";
|
|
1348
|
+
}
|
|
1349
|
+
function resolveColorTokenValue(context, value) {
|
|
1350
|
+
const {
|
|
1351
|
+
hue,
|
|
1352
|
+
scheme
|
|
1353
|
+
} = context;
|
|
1354
|
+
const node = parseTokenValue(value[scheme === "light" ? 0 : 1]);
|
|
1355
|
+
if (!node || node.type !== "color") {
|
|
1356
|
+
throw new Error("Invalid color token: ".concat(value[0]));
|
|
1357
|
+
}
|
|
1358
|
+
return compileColorTokenValue({
|
|
1359
|
+
...node,
|
|
1360
|
+
hue: node.hue || hue
|
|
1361
|
+
});
|
|
1362
|
+
}
|
|
1363
|
+
function compileColorTokenValue(node) {
|
|
1364
|
+
let key = "";
|
|
1365
|
+
if (node.key === "black" || node.key === "white") {
|
|
1366
|
+
key = node.key;
|
|
1367
|
+
} else {
|
|
1368
|
+
key = "".concat(node.hue, "/").concat(node.tint);
|
|
1369
|
+
}
|
|
1370
|
+
if (node.opacity !== void 0) {
|
|
1371
|
+
key += "/".concat(node.opacity);
|
|
1372
|
+
}
|
|
1373
|
+
return key;
|
|
1374
|
+
}
|
|
1375
|
+
function multiply$1(bg, fg) {
|
|
1376
|
+
const b = parseColor(bg);
|
|
1377
|
+
const s = parseColor(fg);
|
|
1378
|
+
const hex = rgbToHex(multiply$2(b, s));
|
|
1379
|
+
if (s.a !== void 0) {
|
|
1380
|
+
return rgba(hex, s.a);
|
|
1381
|
+
}
|
|
1382
|
+
return hex;
|
|
1383
|
+
}
|
|
1384
|
+
function screen$1(bg, fg) {
|
|
1385
|
+
const b = parseColor(bg);
|
|
1386
|
+
const s = parseColor(fg);
|
|
1387
|
+
const hex = rgbToHex(screen$2(b, s));
|
|
1388
|
+
if (s.a !== void 0) {
|
|
1389
|
+
return rgba(hex, s.a);
|
|
1390
|
+
}
|
|
1391
|
+
return hex;
|
|
1392
|
+
}
|
|
1393
|
+
function resolveColorTokens(sparseTokens) {
|
|
1394
|
+
const denseTokens = {
|
|
1395
|
+
...sparseTokens
|
|
1396
|
+
};
|
|
1397
|
+
for (const tone of COLOR_BASE_TONES) {
|
|
1398
|
+
denseTokens[tone] = resolveBaseColorTones(sparseTokens, tone);
|
|
1399
|
+
}
|
|
1400
|
+
denseTokens.button = resolveButtonColorTokens(sparseTokens);
|
|
1401
|
+
return denseTokens;
|
|
1402
|
+
}
|
|
1403
|
+
function resolveBaseColorTones(sparseTokens, tone) {
|
|
1404
|
+
const spec0 = sparseTokens == null ? void 0 : sparseTokens[tone];
|
|
1405
|
+
const spec1 = sparseTokens == null ? void 0 : sparseTokens["*"];
|
|
1406
|
+
return {
|
|
1407
|
+
...spec1,
|
|
1408
|
+
...spec0,
|
|
1409
|
+
shadow: {
|
|
1410
|
+
...(spec1 == null ? void 0 : spec1.shadow),
|
|
1411
|
+
...(spec0 == null ? void 0 : spec0.shadow)
|
|
1412
|
+
},
|
|
1413
|
+
skeleton: {
|
|
1414
|
+
...(spec1 == null ? void 0 : spec1.skeleton),
|
|
1415
|
+
...(spec0 == null ? void 0 : spec0.skeleton)
|
|
1416
|
+
}
|
|
1417
|
+
};
|
|
1418
|
+
}
|
|
1419
|
+
function resolveButtonColorTokens(sparseTokens) {
|
|
1420
|
+
const tokens = {};
|
|
1421
|
+
for (const tone of COLOR_STATE_TONES) {
|
|
1422
|
+
tokens[tone] = resolveButtonToneColorTokens(sparseTokens, tone);
|
|
1423
|
+
}
|
|
1424
|
+
return tokens;
|
|
1425
|
+
}
|
|
1426
|
+
function resolveButtonToneColorTokens(sparseTokens, tone) {
|
|
1427
|
+
var _a, _b;
|
|
1428
|
+
const tokens = {
|
|
1429
|
+
...((_a = sparseTokens.button) == null ? void 0 : _a[tone]),
|
|
1430
|
+
...((_b = sparseTokens.button) == null ? void 0 : _b["*"])
|
|
1431
|
+
};
|
|
1432
|
+
for (const mode of COLOR_BUTTON_MODES) {
|
|
1433
|
+
tokens[mode] = resolveButtonModeColorTokens(sparseTokens, tone, mode);
|
|
1434
|
+
}
|
|
1435
|
+
return tokens;
|
|
1436
|
+
}
|
|
1437
|
+
function resolveButtonModeColorTokens(sparseTokens, tone, mode) {
|
|
1438
|
+
var _a, _b, _c, _d;
|
|
1439
|
+
const spec0 = (_b = (_a = sparseTokens.button) == null ? void 0 : _a[tone]) == null ? void 0 : _b[mode];
|
|
1440
|
+
const spec1 = (_d = (_c = sparseTokens.button) == null ? void 0 : _c["*"]) == null ? void 0 : _d[mode];
|
|
1441
|
+
const tokens = {
|
|
1442
|
+
...spec1,
|
|
1443
|
+
...spec0
|
|
1444
|
+
};
|
|
1445
|
+
for (const state of COLOR_STATES) {
|
|
1446
|
+
tokens[state] = resolveButtonStateColorTokens(sparseTokens, tone, mode, state);
|
|
1447
|
+
}
|
|
1448
|
+
return tokens;
|
|
1449
|
+
}
|
|
1450
|
+
function resolveButtonStateColorTokens(tokens, tone, mode, state) {
|
|
1451
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
1452
|
+
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];
|
|
1453
|
+
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["*"];
|
|
1454
|
+
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];
|
|
1455
|
+
const spec3 = (_l = (_k = (_j = tokens == null ? void 0 : tokens.button) == null ? void 0 : _j["*"]) == null ? void 0 : _k[mode]) == null ? void 0 : _l["*"];
|
|
1456
|
+
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);
|
|
1457
|
+
return {
|
|
1458
|
+
...spec3,
|
|
1459
|
+
...spec2,
|
|
1460
|
+
...spec1,
|
|
1461
|
+
...spec0,
|
|
1462
|
+
_hue: hue,
|
|
1463
|
+
muted: {
|
|
1464
|
+
...(spec3 == null ? void 0 : spec3.muted),
|
|
1465
|
+
...(spec2 == null ? void 0 : spec2.muted),
|
|
1466
|
+
...(spec1 == null ? void 0 : spec1.muted),
|
|
1467
|
+
...(spec0 == null ? void 0 : spec0.muted)
|
|
1468
|
+
},
|
|
1469
|
+
accent: {
|
|
1470
|
+
...(spec3 == null ? void 0 : spec3.accent),
|
|
1471
|
+
...(spec2 == null ? void 0 : spec2.accent),
|
|
1472
|
+
...(spec1 == null ? void 0 : spec1.accent),
|
|
1473
|
+
...(spec0 == null ? void 0 : spec0.accent)
|
|
1474
|
+
},
|
|
1475
|
+
link: {
|
|
1476
|
+
...(spec3 == null ? void 0 : spec3.link),
|
|
1477
|
+
...(spec2 == null ? void 0 : spec2.link),
|
|
1478
|
+
...(spec1 == null ? void 0 : spec1.link),
|
|
1479
|
+
...(spec0 == null ? void 0 : spec0.link)
|
|
1480
|
+
},
|
|
1481
|
+
code: {
|
|
1482
|
+
...(spec3 == null ? void 0 : spec3.code),
|
|
1483
|
+
...(spec2 == null ? void 0 : spec2.code),
|
|
1484
|
+
...(spec1 == null ? void 0 : spec1.code),
|
|
1485
|
+
...(spec0 == null ? void 0 : spec0.code)
|
|
1486
|
+
},
|
|
1487
|
+
skeleton: {
|
|
1488
|
+
...(spec3 == null ? void 0 : spec3.skeleton),
|
|
1489
|
+
...(spec2 == null ? void 0 : spec2.skeleton),
|
|
1490
|
+
...(spec1 == null ? void 0 : spec1.skeleton),
|
|
1491
|
+
...(spec0 == null ? void 0 : spec0.skeleton)
|
|
1492
|
+
}
|
|
1493
|
+
};
|
|
1494
|
+
}
|
|
1495
|
+
function buildColorTheme(options, config) {
|
|
1496
|
+
var _a, _b;
|
|
1497
|
+
const {
|
|
1498
|
+
scheme
|
|
1499
|
+
} = options;
|
|
1500
|
+
const resolvedConfig = {
|
|
1501
|
+
...config,
|
|
1502
|
+
color: {
|
|
1503
|
+
...(config == null ? void 0 : config.color),
|
|
1504
|
+
tokens: resolveColorTokens((_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.tokens) != null ? _b : defaultColorTokens)
|
|
1505
|
+
}
|
|
1506
|
+
};
|
|
1507
|
+
return {
|
|
1508
|
+
transparent: buildBaseColorTheme({
|
|
1509
|
+
scheme,
|
|
1510
|
+
tone: "transparent"
|
|
1511
|
+
}, resolvedConfig),
|
|
1512
|
+
default: buildBaseColorTheme({
|
|
1513
|
+
scheme,
|
|
1514
|
+
tone: "default"
|
|
1515
|
+
}, resolvedConfig),
|
|
1516
|
+
primary: buildBaseColorTheme({
|
|
1517
|
+
scheme,
|
|
1518
|
+
tone: "primary"
|
|
1519
|
+
}, resolvedConfig),
|
|
1520
|
+
positive: buildBaseColorTheme({
|
|
1521
|
+
scheme,
|
|
1522
|
+
tone: "positive"
|
|
1523
|
+
}, resolvedConfig),
|
|
1524
|
+
caution: buildBaseColorTheme({
|
|
1525
|
+
scheme,
|
|
1526
|
+
tone: "caution"
|
|
1527
|
+
}, resolvedConfig),
|
|
1528
|
+
critical: buildBaseColorTheme({
|
|
1529
|
+
scheme,
|
|
1530
|
+
tone: "critical"
|
|
1531
|
+
}, resolvedConfig)
|
|
1532
|
+
};
|
|
1533
|
+
}
|
|
1534
|
+
function buildBaseColorTheme(options, config) {
|
|
1535
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1536
|
+
const {
|
|
1537
|
+
scheme,
|
|
1538
|
+
tone
|
|
1539
|
+
} = options;
|
|
1540
|
+
const tokens = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.tokens) == null ? void 0 : _b[tone];
|
|
1541
|
+
const hue = (tokens == null ? void 0 : tokens._hue) || "gray";
|
|
1542
|
+
const context = {
|
|
1543
|
+
hue,
|
|
1544
|
+
scheme
|
|
1545
|
+
};
|
|
1546
|
+
const bg = resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.bg) || ["gray/50", "black"]);
|
|
1547
|
+
const blendMode = (tokens == null ? void 0 : tokens._blend) || ["screen", "multiply"];
|
|
1548
|
+
return {
|
|
1549
|
+
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
1550
|
+
dark: scheme === "dark",
|
|
1551
|
+
base: {
|
|
1552
|
+
bg,
|
|
1553
|
+
fg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.fg) || ["black", "white"]),
|
|
1554
|
+
border: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.border) || ["black", "white"]),
|
|
1555
|
+
focusRing: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.focusRing) || ["black", "white"]),
|
|
1556
|
+
shadow: {
|
|
1557
|
+
outline: resolveColorTokenValue(context, ((_c = tokens == null ? void 0 : tokens.shadow) == null ? void 0 : _c.outline) || ["500/0.2", "500/0.2"]),
|
|
1558
|
+
umbra: resolveColorTokenValue(context, ((_d = tokens == null ? void 0 : tokens.shadow) == null ? void 0 : _d.umbra) || ["500/0.2", "500/0.2"]),
|
|
1559
|
+
penumbra: resolveColorTokenValue(context, ((_e = tokens == null ? void 0 : tokens.shadow) == null ? void 0 : _e.penumbra) || ["500/0.2", "500/0.2"]),
|
|
1560
|
+
ambient: resolveColorTokenValue(context, ((_f = tokens == null ? void 0 : tokens.shadow) == null ? void 0 : _f.ambient) || ["500/0.2", "500/0.2"])
|
|
1561
|
+
},
|
|
1562
|
+
skeleton: {
|
|
1563
|
+
from: resolveColorTokenValue(context, ((_g = tokens == null ? void 0 : tokens.skeleton) == null ? void 0 : _g.from) || ["500/0.2", "500/0.2"]),
|
|
1564
|
+
to: resolveColorTokenValue(context, ((_h = tokens == null ? void 0 : tokens.skeleton) == null ? void 0 : _h.to) || ["500/0.2", "500/0.2"])
|
|
1565
|
+
}
|
|
1566
|
+
},
|
|
1567
|
+
button: buildButtonColorTheme({
|
|
1568
|
+
scheme
|
|
1569
|
+
}, config)
|
|
1570
|
+
};
|
|
1571
|
+
}
|
|
1572
|
+
function buildButtonColorTheme(options, config) {
|
|
1573
|
+
const {
|
|
1574
|
+
scheme
|
|
1575
|
+
} = options;
|
|
1576
|
+
const tones = COLOR_STATE_TONES.map(tone => {
|
|
1577
|
+
return {
|
|
1578
|
+
[tone]: buildButtonColorToneTheme({
|
|
1579
|
+
scheme,
|
|
1580
|
+
tone
|
|
1581
|
+
}, config)
|
|
1582
|
+
};
|
|
1583
|
+
});
|
|
1584
|
+
return Object.assign({}, ...tones);
|
|
1585
|
+
}
|
|
1586
|
+
function buildButtonColorToneTheme(options, config) {
|
|
1587
|
+
const {
|
|
1588
|
+
scheme,
|
|
1589
|
+
tone
|
|
1590
|
+
} = options;
|
|
1591
|
+
const modes = COLOR_BUTTON_MODES.map(mode => {
|
|
1592
|
+
return {
|
|
1593
|
+
[mode]: buildButtonModeColorTheme({
|
|
1594
|
+
mode,
|
|
1595
|
+
scheme,
|
|
1596
|
+
tone
|
|
1597
|
+
}, config)
|
|
1598
|
+
};
|
|
1599
|
+
});
|
|
1600
|
+
return Object.assign({}, ...modes);
|
|
1601
|
+
}
|
|
1602
|
+
function buildButtonModeColorTheme(options, config) {
|
|
1603
|
+
const {
|
|
1604
|
+
mode,
|
|
1605
|
+
scheme,
|
|
1606
|
+
tone
|
|
1607
|
+
} = options;
|
|
1608
|
+
const states = COLOR_STATES.map(state => {
|
|
1609
|
+
return {
|
|
1610
|
+
[state]: buildButtonStateColorTheme({
|
|
1611
|
+
mode,
|
|
1612
|
+
tone,
|
|
1613
|
+
scheme,
|
|
1614
|
+
state
|
|
1615
|
+
}, config)
|
|
1616
|
+
};
|
|
1617
|
+
});
|
|
1618
|
+
return Object.assign({}, ...states);
|
|
1619
|
+
}
|
|
1620
|
+
function buildButtonStateColorTheme(options, config) {
|
|
1621
|
+
var _a, _b, _c, _d, _e;
|
|
1622
|
+
const {
|
|
1623
|
+
mode,
|
|
1624
|
+
tone,
|
|
1625
|
+
scheme,
|
|
1626
|
+
state
|
|
1627
|
+
} = options;
|
|
1628
|
+
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];
|
|
1629
|
+
const hue = (tokens == null ? void 0 : tokens._hue) || "gray";
|
|
1630
|
+
const blendMode = (tokens == null ? void 0 : tokens._blend) || ["screen", "multiply"];
|
|
1631
|
+
const context = {
|
|
1632
|
+
hue,
|
|
1633
|
+
scheme
|
|
1634
|
+
};
|
|
1635
|
+
return {
|
|
1636
|
+
_blend: blendMode[scheme === "light" ? 0 : 1],
|
|
1637
|
+
bg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.bg) || ["500", "400"]),
|
|
1638
|
+
bg2: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.bg2) || ["500", "400"]),
|
|
1639
|
+
fg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.fg) || ["white", "black"]),
|
|
1640
|
+
border: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.border) || ["500", "400"]),
|
|
1641
|
+
muted: {
|
|
1642
|
+
fg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.fg) || ["500", "400"])
|
|
1643
|
+
},
|
|
1644
|
+
accent: {
|
|
1645
|
+
fg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.fg) || ["500", "400"])
|
|
1646
|
+
},
|
|
1647
|
+
link: {
|
|
1648
|
+
fg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.fg) || ["500", "400"])
|
|
1649
|
+
},
|
|
1650
|
+
code: {
|
|
1651
|
+
bg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.bg) || ["500", "400"]),
|
|
1652
|
+
fg: resolveColorTokenValue(context, (tokens == null ? void 0 : tokens.fg) || ["500", "400"])
|
|
1653
|
+
}
|
|
1654
|
+
};
|
|
1655
|
+
}
|
|
1656
|
+
const defaultColorPalette = {
|
|
1657
|
+
...color$1.color,
|
|
1658
|
+
black: "#000000"
|
|
1659
|
+
};
|
|
1660
|
+
function renderColorTheme(value, config) {
|
|
1661
|
+
var _a, _b;
|
|
1662
|
+
const colorPalette = (_b = (_a = config == null ? void 0 : config.color) == null ? void 0 : _a.palette) != null ? _b : defaultColorPalette;
|
|
1663
|
+
return {
|
|
1664
|
+
light: renderColorScheme(colorPalette, value.light),
|
|
1665
|
+
dark: renderColorScheme(colorPalette, value.dark)
|
|
1666
|
+
};
|
|
1667
|
+
}
|
|
1668
|
+
function renderColorScheme(colorPalette, value) {
|
|
1669
|
+
const toneEntries = Object.entries(value);
|
|
1670
|
+
const [, transparentTone] = toneEntries.find(_ref4 => {
|
|
1671
|
+
let [k] = _ref4;
|
|
1672
|
+
return k === "transparent";
|
|
1673
|
+
});
|
|
1674
|
+
const [, defaultTone] = toneEntries.find(_ref5 => {
|
|
1675
|
+
let [k] = _ref5;
|
|
1676
|
+
return k === "default";
|
|
1677
|
+
});
|
|
1678
|
+
const renderedTransparentTone = renderColorBase(colorPalette, transparentTone, transparentTone._blend === "multiply" ? "#ffffff" : "#000000");
|
|
1679
|
+
const renderedDefaultTone = renderColorBase(colorPalette, defaultTone, defaultTone._blend === "multiply" ? "#ffffff" : "#000000");
|
|
1680
|
+
return Object.fromEntries([["transparent", renderedTransparentTone], ["default", renderedDefaultTone], ...toneEntries.filter(_ref6 => {
|
|
1681
|
+
let [k] = _ref6;
|
|
1682
|
+
return k !== "default" && k !== "transparent";
|
|
1683
|
+
}).map(_ref7 => {
|
|
1684
|
+
let [k, v] = _ref7;
|
|
1685
|
+
return [k, renderColorBase(colorPalette, v, renderedDefaultTone.base.bg)];
|
|
1686
|
+
})]);
|
|
1687
|
+
}
|
|
1688
|
+
function renderColorBase(colorPalette, value, bg) {
|
|
1689
|
+
const nestedBg = renderColorValue(colorPalette, bg, value._blend, value.base.bg);
|
|
1690
|
+
return {
|
|
1691
|
+
_blend: value._blend,
|
|
1692
|
+
dark: value.dark,
|
|
1693
|
+
base: {
|
|
1694
|
+
bg: nestedBg,
|
|
1695
|
+
fg: renderColorValue(colorPalette, nestedBg, value._blend, value.base.fg),
|
|
1696
|
+
border: renderColorValue(colorPalette, nestedBg, value._blend, value.base.border),
|
|
1697
|
+
focusRing: renderColorValue(colorPalette, nestedBg, value._blend, value.base.focusRing),
|
|
1698
|
+
shadow: {
|
|
1699
|
+
outline: renderColorValue(colorPalette, nestedBg, value._blend, value.base.shadow.outline),
|
|
1700
|
+
umbra: renderColorValue(colorPalette, nestedBg, value._blend, value.base.shadow.umbra),
|
|
1701
|
+
penumbra: renderColorValue(colorPalette, nestedBg, value._blend, value.base.shadow.penumbra),
|
|
1702
|
+
ambient: renderColorValue(colorPalette, nestedBg, value._blend, value.base.shadow.ambient)
|
|
1703
|
+
},
|
|
1704
|
+
skeleton: {
|
|
1705
|
+
from: renderColorValue(colorPalette, nestedBg, value._blend, value.base.skeleton.from),
|
|
1706
|
+
to: renderColorValue(colorPalette, nestedBg, value._blend, value.base.skeleton.to)
|
|
1707
|
+
}
|
|
1708
|
+
},
|
|
1709
|
+
button: renderButtonColorTheme(colorPalette, nestedBg, value._blend, value.button)
|
|
1710
|
+
};
|
|
1711
|
+
}
|
|
1712
|
+
function renderButtonColorTheme(colorPalette, bg, baseBlendMode, value) {
|
|
1713
|
+
return {
|
|
1714
|
+
default: renderButtonStateColorTheme(colorPalette, bg, baseBlendMode, value.default),
|
|
1715
|
+
primary: renderButtonStateColorTheme(colorPalette, bg, baseBlendMode, value.primary),
|
|
1716
|
+
positive: renderButtonStateColorTheme(colorPalette, bg, baseBlendMode, value.positive),
|
|
1717
|
+
caution: renderButtonStateColorTheme(colorPalette, bg, baseBlendMode, value.caution),
|
|
1718
|
+
critical: renderButtonStateColorTheme(colorPalette, bg, baseBlendMode, value.critical)
|
|
1719
|
+
};
|
|
1720
|
+
}
|
|
1721
|
+
function renderButtonStateColorTheme(colorPalette, bg, baseBlendMode, value) {
|
|
1722
|
+
return {
|
|
1723
|
+
default: renderStatesColorTheme(colorPalette, bg, baseBlendMode, value.default),
|
|
1724
|
+
ghost: renderStatesColorTheme(colorPalette, bg, baseBlendMode, value.ghost),
|
|
1725
|
+
bleed: renderStatesColorTheme(colorPalette, bg, baseBlendMode, value.bleed)
|
|
1726
|
+
};
|
|
1727
|
+
}
|
|
1728
|
+
function renderStatesColorTheme(colorPalette, bg, baseBlendMode, value) {
|
|
1729
|
+
return {
|
|
1730
|
+
enabled: renderStateColorTheme(colorPalette, bg, baseBlendMode, value.enabled),
|
|
1731
|
+
hovered: renderStateColorTheme(colorPalette, bg, baseBlendMode, value.hovered),
|
|
1732
|
+
pressed: renderStateColorTheme(colorPalette, bg, baseBlendMode, value.pressed),
|
|
1733
|
+
selected: renderStateColorTheme(colorPalette, bg, baseBlendMode, value.selected),
|
|
1734
|
+
disabled: renderStateColorTheme(colorPalette, bg, baseBlendMode, value.disabled)
|
|
1735
|
+
};
|
|
1736
|
+
}
|
|
1737
|
+
function renderStateColorTheme(colorPalette, baseBg, rootBlendMode, value) {
|
|
1738
|
+
const blendMode = value._blend;
|
|
1739
|
+
const bg = rootBlendMode === "multiply" && value.bg === "white" ? "#ffffff" : rootBlendMode === "screen" && value.bg === "black" ? "#000000" : renderColorValue(colorPalette, rootBlendMode === "multiply" ? "#ffffff" : "#000000", rootBlendMode, value.bg);
|
|
1740
|
+
const blend = rootBlendMode === "multiply" ? multiply$1 : screen$1;
|
|
1741
|
+
const unmixed = {
|
|
1742
|
+
bg2: renderColorValue(colorPalette, bg, blendMode, value.bg2 || value.bg),
|
|
1743
|
+
fg: renderColorValue(colorPalette, bg, blendMode, value.fg),
|
|
1744
|
+
border: renderColorValue(colorPalette, bg, blendMode, value.border),
|
|
1745
|
+
muted: {
|
|
1746
|
+
fg: renderColorValue(colorPalette, bg, blendMode, value.muted.fg)
|
|
1747
|
+
},
|
|
1748
|
+
accent: {
|
|
1749
|
+
fg: renderColorValue(colorPalette, bg, blendMode, value.accent.fg)
|
|
1750
|
+
},
|
|
1751
|
+
link: {
|
|
1752
|
+
fg: renderColorValue(colorPalette, bg, blendMode, value.link.fg)
|
|
1753
|
+
},
|
|
1754
|
+
code: {
|
|
1755
|
+
bg: renderColorValue(colorPalette, bg, blendMode, value.code.bg),
|
|
1756
|
+
fg: renderColorValue(colorPalette, bg, blendMode, value.code.fg)
|
|
1757
|
+
}
|
|
1758
|
+
};
|
|
1759
|
+
return {
|
|
1760
|
+
_blend: blendMode,
|
|
1761
|
+
bg: blend(baseBg, bg),
|
|
1762
|
+
bg2: blend(baseBg, unmixed.bg2),
|
|
1763
|
+
fg: blend(baseBg, unmixed.fg),
|
|
1764
|
+
border: blend(baseBg, unmixed.border),
|
|
1765
|
+
muted: {
|
|
1766
|
+
fg: blend(baseBg, unmixed.muted.fg)
|
|
1767
|
+
},
|
|
1768
|
+
accent: {
|
|
1769
|
+
fg: blend(baseBg, unmixed.accent.fg)
|
|
1770
|
+
},
|
|
1771
|
+
link: {
|
|
1772
|
+
fg: blend(baseBg, unmixed.link.fg)
|
|
1773
|
+
},
|
|
1774
|
+
code: {
|
|
1775
|
+
bg: blend(baseBg, unmixed.code.bg),
|
|
1776
|
+
fg: blend(baseBg, unmixed.code.fg)
|
|
1777
|
+
}
|
|
1778
|
+
};
|
|
1779
|
+
}
|
|
1780
|
+
function renderColorValue(colorPalette, bg, blendMode, str) {
|
|
1781
|
+
const node = parseTokenValue(str);
|
|
1782
|
+
if (!node || node.type !== "color") {
|
|
1783
|
+
throw new Error("Invalid color token value: ".concat(str));
|
|
1784
|
+
}
|
|
1785
|
+
let hex = "";
|
|
1786
|
+
if (node.key === "black") {
|
|
1787
|
+
hex = renderColorHex(colorPalette.black);
|
|
1788
|
+
}
|
|
1789
|
+
if (node.key === "white") {
|
|
1790
|
+
hex = renderColorHex(colorPalette.white);
|
|
1791
|
+
}
|
|
1792
|
+
if (node.hue && node.tint) {
|
|
1793
|
+
hex = renderColorHex(colorPalette[node.hue][node.tint]);
|
|
1794
|
+
}
|
|
1795
|
+
if (!hex) {
|
|
1796
|
+
throw new Error("Invalid color token value: ".concat(str));
|
|
1797
|
+
}
|
|
1798
|
+
try {
|
|
1799
|
+
hex = blendMode === "multiply" ? multiply$1(bg, hex) : screen$1(bg, hex);
|
|
1800
|
+
} catch (err) {
|
|
1801
|
+
console.log("could not blend", hex);
|
|
1802
|
+
}
|
|
1803
|
+
if (node.opacity !== void 0) {
|
|
1804
|
+
hex = rgba(hex, node.opacity);
|
|
1805
|
+
}
|
|
1806
|
+
return hex;
|
|
1807
|
+
}
|
|
1808
|
+
function renderColorHex(color) {
|
|
1809
|
+
return typeof color === "string" ? color : color.hex;
|
|
1810
|
+
}
|
|
1811
|
+
function buildTheme(config) {
|
|
1812
|
+
const color = {
|
|
1813
|
+
light: buildColorTheme({
|
|
1814
|
+
scheme: "light"
|
|
1815
|
+
}, config),
|
|
1816
|
+
dark: buildColorTheme({
|
|
1817
|
+
scheme: "dark"
|
|
1818
|
+
}, config)
|
|
1819
|
+
};
|
|
1820
|
+
return {
|
|
1821
|
+
color: renderColorTheme(color, config)
|
|
1822
|
+
};
|
|
1823
|
+
}
|
|
1013
1824
|
function createButtonTones(opts, base, dark, solid, muted, mode) {
|
|
1014
1825
|
return {
|
|
1015
1826
|
default: opts.button({
|
|
@@ -1202,11 +2013,11 @@ const tones$1 = {
|
|
|
1202
2013
|
}
|
|
1203
2014
|
};
|
|
1204
2015
|
const defaultOpts = {
|
|
1205
|
-
base:
|
|
2016
|
+
base: _ref8 => {
|
|
1206
2017
|
let {
|
|
1207
2018
|
dark,
|
|
1208
2019
|
name
|
|
1209
|
-
} =
|
|
2020
|
+
} = _ref8;
|
|
1210
2021
|
if (name === "default") {
|
|
1211
2022
|
return {
|
|
1212
2023
|
bg: dark ? black : white,
|
|
@@ -1242,13 +2053,13 @@ const defaultOpts = {
|
|
|
1242
2053
|
}
|
|
1243
2054
|
};
|
|
1244
2055
|
},
|
|
1245
|
-
solid:
|
|
2056
|
+
solid: _ref9 => {
|
|
1246
2057
|
let {
|
|
1247
2058
|
base,
|
|
1248
2059
|
dark,
|
|
1249
2060
|
state,
|
|
1250
2061
|
tone
|
|
1251
|
-
} =
|
|
2062
|
+
} = _ref9;
|
|
1252
2063
|
const color = colors[tone];
|
|
1253
2064
|
if (state === "hovered") {
|
|
1254
2065
|
return {
|
|
@@ -1295,13 +2106,13 @@ const defaultOpts = {
|
|
|
1295
2106
|
skeleton: base.skeleton
|
|
1296
2107
|
};
|
|
1297
2108
|
},
|
|
1298
|
-
muted:
|
|
2109
|
+
muted: _ref10 => {
|
|
1299
2110
|
let {
|
|
1300
2111
|
base,
|
|
1301
2112
|
dark,
|
|
1302
2113
|
state,
|
|
1303
2114
|
tone
|
|
1304
|
-
} =
|
|
2115
|
+
} = _ref10;
|
|
1305
2116
|
const color = colors[tone];
|
|
1306
2117
|
if (state === "hovered") {
|
|
1307
2118
|
return {
|
|
@@ -1348,13 +2159,13 @@ const defaultOpts = {
|
|
|
1348
2159
|
skeleton: base.skeleton
|
|
1349
2160
|
};
|
|
1350
2161
|
},
|
|
1351
|
-
button:
|
|
2162
|
+
button: _ref11 => {
|
|
1352
2163
|
let {
|
|
1353
2164
|
base,
|
|
1354
2165
|
mode,
|
|
1355
2166
|
muted,
|
|
1356
2167
|
solid
|
|
1357
|
-
} =
|
|
2168
|
+
} = _ref11;
|
|
1358
2169
|
if (mode === "bleed") {
|
|
1359
2170
|
return {
|
|
1360
2171
|
...muted,
|
|
@@ -1408,10 +2219,10 @@ const defaultOpts = {
|
|
|
1408
2219
|
};
|
|
1409
2220
|
return solid;
|
|
1410
2221
|
},
|
|
1411
|
-
card:
|
|
2222
|
+
card: _ref12 => {
|
|
1412
2223
|
let {
|
|
1413
2224
|
base
|
|
1414
|
-
} =
|
|
2225
|
+
} = _ref12;
|
|
1415
2226
|
return {
|
|
1416
2227
|
bg: black,
|
|
1417
2228
|
bg2: black,
|
|
@@ -1443,18 +2254,18 @@ const defaultOpts = {
|
|
|
1443
2254
|
placeholder: black
|
|
1444
2255
|
};
|
|
1445
2256
|
},
|
|
1446
|
-
selectable:
|
|
2257
|
+
selectable: _ref13 => {
|
|
1447
2258
|
let {
|
|
1448
2259
|
muted,
|
|
1449
2260
|
state,
|
|
1450
2261
|
tone
|
|
1451
|
-
} =
|
|
2262
|
+
} = _ref13;
|
|
1452
2263
|
return muted[tone][state];
|
|
1453
2264
|
},
|
|
1454
|
-
spot:
|
|
2265
|
+
spot: _ref14 => {
|
|
1455
2266
|
let {
|
|
1456
2267
|
key
|
|
1457
|
-
} =
|
|
2268
|
+
} = _ref14;
|
|
1458
2269
|
return spots[key];
|
|
1459
2270
|
},
|
|
1460
2271
|
syntax: () => ({
|
|
@@ -2169,142 +2980,44 @@ function _createColor(opts, dark, name) {
|
|
|
2169
2980
|
function multiply(bg, fg) {
|
|
2170
2981
|
const b = parseColor(bg);
|
|
2171
2982
|
const s = parseColor(fg);
|
|
2172
|
-
const hex = rgbToHex(multiply$
|
|
2983
|
+
const hex = rgbToHex(multiply$2(b, s));
|
|
2984
|
+
if (s.a) {
|
|
2985
|
+
return rgba(hex, s.a);
|
|
2986
|
+
}
|
|
2173
2987
|
return hex;
|
|
2174
2988
|
}
|
|
2175
2989
|
function screen(bg, fg) {
|
|
2176
2990
|
const b = parseColor(bg);
|
|
2177
2991
|
const s = parseColor(fg);
|
|
2178
|
-
const hex = rgbToHex(screen$
|
|
2992
|
+
const hex = rgbToHex(screen$2(b, s));
|
|
2993
|
+
if (s.a) {
|
|
2994
|
+
return rgba(hex, s.a);
|
|
2995
|
+
}
|
|
2179
2996
|
return hex;
|
|
2180
2997
|
}
|
|
2181
|
-
const defaultTints = {
|
|
2182
|
-
light: {
|
|
2183
|
-
text_primary: "900",
|
|
2184
|
-
text_secondary: "600",
|
|
2185
|
-
text_inactive: "500",
|
|
2186
|
-
bg_base: color$1.white,
|
|
2187
|
-
bg_base_hover: "50",
|
|
2188
|
-
bg_base_active: "100",
|
|
2189
|
-
bg_accent: "500",
|
|
2190
|
-
bg_accent_hover: "600",
|
|
2191
|
-
bg_accent_active: "700",
|
|
2192
|
-
bg_tint: "50",
|
|
2193
|
-
icon_default: "500",
|
|
2194
|
-
icon_inverted: color$1.white,
|
|
2195
|
-
border_base: "100",
|
|
2196
|
-
border_accent: "500",
|
|
2197
|
-
border_accent_inverted: color$1.white
|
|
2198
|
-
},
|
|
2199
|
-
dark: {
|
|
2200
|
-
text_primary: "50",
|
|
2201
|
-
text_secondary: "300",
|
|
2202
|
-
text_inactive: "400",
|
|
2203
|
-
bg_base: color$1.black,
|
|
2204
|
-
bg_base_hover: "900",
|
|
2205
|
-
bg_base_active: "800",
|
|
2206
|
-
bg_accent: "500",
|
|
2207
|
-
bg_accent_hover: "400",
|
|
2208
|
-
bg_accent_active: "300",
|
|
2209
|
-
bg_tint: "900",
|
|
2210
|
-
icon_default: "300",
|
|
2211
|
-
icon_inverted: color$1.hues.gray[900],
|
|
2212
|
-
border_base: "800",
|
|
2213
|
-
border_accent: "300",
|
|
2214
|
-
border_accent_inverted: color$1.hues.gray[900]
|
|
2215
|
-
}
|
|
2216
|
-
};
|
|
2217
|
-
const colorTints = {
|
|
2218
|
-
light: {
|
|
2219
|
-
default: {
|
|
2220
|
-
...defaultTints.light,
|
|
2221
|
-
bg_accent: "900",
|
|
2222
|
-
bg_accent_hover: "950",
|
|
2223
|
-
bg_accent_active: color$1.black,
|
|
2224
|
-
border_accent: "600"
|
|
2225
|
-
},
|
|
2226
|
-
primary: {
|
|
2227
|
-
...defaultTints.light,
|
|
2228
|
-
bg_accent: "900",
|
|
2229
|
-
bg_accent_hover: "950",
|
|
2230
|
-
bg_accent_active: color$1.black,
|
|
2231
|
-
border_accent: "600"
|
|
2232
|
-
},
|
|
2233
|
-
positive: {
|
|
2234
|
-
...defaultTints.light,
|
|
2235
|
-
bg_base_hover: color$1.hues.gray[50],
|
|
2236
|
-
bg_base_active: "50",
|
|
2237
|
-
bg_accent: "400",
|
|
2238
|
-
bg_accent_hover: "500",
|
|
2239
|
-
bg_accent_active: "600",
|
|
2240
|
-
border_accent: "400"
|
|
2241
|
-
},
|
|
2242
|
-
transparent: defaultTints.light,
|
|
2243
|
-
caution: defaultTints.light,
|
|
2244
|
-
critical: defaultTints.light
|
|
2245
|
-
},
|
|
2246
|
-
dark: {
|
|
2247
|
-
default: {
|
|
2248
|
-
...defaultTints.dark,
|
|
2249
|
-
text_primary: color$1.white,
|
|
2250
|
-
bg_accent: color$1.white,
|
|
2251
|
-
bg_accent_hover: "50",
|
|
2252
|
-
bg_accent_active: "100"
|
|
2253
|
-
},
|
|
2254
|
-
primary: {
|
|
2255
|
-
...defaultTints.dark,
|
|
2256
|
-
text_primary: color$1.white,
|
|
2257
|
-
bg_accent: color$1.white,
|
|
2258
|
-
bg_accent_hover: "50",
|
|
2259
|
-
bg_accent_active: "100"
|
|
2260
|
-
},
|
|
2261
|
-
positive: {
|
|
2262
|
-
...defaultTints.dark,
|
|
2263
|
-
bg_base_hover: color$1.hues.gray[900],
|
|
2264
|
-
bg_base_active: "900",
|
|
2265
|
-
bg_accent: "400",
|
|
2266
|
-
bg_accent_hover: "300",
|
|
2267
|
-
bg_accent_active: "200",
|
|
2268
|
-
border_accent: "400"
|
|
2269
|
-
},
|
|
2270
|
-
transparent: defaultTints.dark,
|
|
2271
|
-
caution: defaultTints.dark,
|
|
2272
|
-
critical: defaultTints.dark
|
|
2273
|
-
}
|
|
2274
|
-
};
|
|
2275
|
-
const getColorValue = (tints, dark, tone, key) => {
|
|
2276
|
-
const value = colorTints[dark ? "dark" : "light"][tone][key];
|
|
2277
|
-
if (typeof value === "string") {
|
|
2278
|
-
return tints[value];
|
|
2279
|
-
}
|
|
2280
|
-
return value;
|
|
2281
|
-
};
|
|
2282
|
-
const getColorHex = (tints, dark, tone, key) => {
|
|
2283
|
-
return getColorValue(tints, dark, tone, key).hex;
|
|
2284
|
-
};
|
|
2285
2998
|
const tones = {
|
|
2286
2999
|
default: color$1.hues.gray,
|
|
2287
3000
|
transparent: color$1.hues.gray,
|
|
2288
|
-
primary: color$1.hues.
|
|
2289
|
-
positive: color$1.hues.
|
|
3001
|
+
primary: color$1.hues.blue,
|
|
3002
|
+
positive: color$1.hues.green,
|
|
2290
3003
|
caution: color$1.hues.yellow,
|
|
2291
3004
|
critical: color$1.hues.red
|
|
2292
3005
|
};
|
|
2293
3006
|
const NEUTRAL_TONES = ["default", "transparent"];
|
|
2294
3007
|
const color = createColorTheme({
|
|
2295
|
-
base:
|
|
3008
|
+
base: _ref15 => {
|
|
2296
3009
|
let {
|
|
2297
3010
|
dark,
|
|
2298
3011
|
name
|
|
2299
|
-
} =
|
|
3012
|
+
} = _ref15;
|
|
2300
3013
|
if (name === "default") {
|
|
2301
3014
|
const tints2 = color$1.hues.gray;
|
|
2302
3015
|
const skeletonFrom2 = dark ? tints2[900].hex : tints2[100].hex;
|
|
2303
3016
|
return {
|
|
2304
3017
|
fg: dark ? color$1.white.hex : color$1.black.hex,
|
|
2305
|
-
bg:
|
|
2306
|
-
border:
|
|
2307
|
-
focusRing:
|
|
3018
|
+
bg: dark ? color$1.black.hex : color$1.white.hex,
|
|
3019
|
+
border: tints2[dark ? 800 : 200].hex,
|
|
3020
|
+
focusRing: color$1.hues.blue[dark ? 500 : 500].hex,
|
|
2308
3021
|
shadow: {
|
|
2309
3022
|
outline: rgba(tints2[500].hex, 0.4),
|
|
2310
3023
|
umbra: dark ? rgba(tints2[950].hex, 0.4) : rgba(tints2[500].hex, 0.2),
|
|
@@ -2341,9 +3054,9 @@ const color = createColorTheme({
|
|
|
2341
3054
|
const skeletonFrom = tints[dark ? 800 : 200].hex;
|
|
2342
3055
|
return {
|
|
2343
3056
|
fg: tints[dark ? 100 : 900].hex,
|
|
2344
|
-
bg:
|
|
2345
|
-
border:
|
|
2346
|
-
focusRing:
|
|
3057
|
+
bg: tints[dark ? 950 : 50].hex,
|
|
3058
|
+
border: tints[dark ? 800 : 200].hex,
|
|
3059
|
+
focusRing: tints[500].hex,
|
|
2347
3060
|
shadow: {
|
|
2348
3061
|
outline: rgba(tints[500].hex, 0.4),
|
|
2349
3062
|
umbra: dark ? rgba(tints[900].hex, 0.4) : rgba(tints[500].hex, 0.2),
|
|
@@ -2356,14 +3069,14 @@ const color = createColorTheme({
|
|
|
2356
3069
|
}
|
|
2357
3070
|
};
|
|
2358
3071
|
},
|
|
2359
|
-
solid:
|
|
3072
|
+
solid: _ref16 => {
|
|
2360
3073
|
let {
|
|
2361
3074
|
base,
|
|
2362
3075
|
dark,
|
|
2363
3076
|
name,
|
|
2364
3077
|
state,
|
|
2365
3078
|
tone
|
|
2366
|
-
} =
|
|
3079
|
+
} = _ref16;
|
|
2367
3080
|
const mix = dark ? screen : multiply;
|
|
2368
3081
|
const mix2 = dark ? multiply : screen;
|
|
2369
3082
|
const defaultTints = tones[name] || tones.default;
|
|
@@ -2371,14 +3084,15 @@ const color = createColorTheme({
|
|
|
2371
3084
|
let tints = tones[tone === "default" ? name : tone] || defaultTints;
|
|
2372
3085
|
if (state === "disabled") {
|
|
2373
3086
|
tints = defaultTints;
|
|
2374
|
-
const bg2 =
|
|
3087
|
+
const bg2 = mix(base.bg, tints[dark ? 800 : 200].hex);
|
|
2375
3088
|
const skeletonFrom2 = mix2(bg2, tints[dark ? 200 : 800].hex);
|
|
2376
3089
|
return {
|
|
2377
3090
|
bg: bg2,
|
|
2378
3091
|
bg2: mix2(bg2, tints[dark ? 50 : 950].hex),
|
|
2379
|
-
border:
|
|
2380
|
-
|
|
2381
|
-
|
|
3092
|
+
border: mix(base.bg, tints[dark ? 800 : 200].hex),
|
|
3093
|
+
iconColor: "",
|
|
3094
|
+
// Add color
|
|
3095
|
+
fg: mix(base.bg, dark ? color$1.black.hex : color$1.white.hex),
|
|
2382
3096
|
muted: {
|
|
2383
3097
|
fg: mix(base.bg, tints[dark ? 950 : 50].hex)
|
|
2384
3098
|
},
|
|
@@ -2399,14 +3113,15 @@ const color = createColorTheme({
|
|
|
2399
3113
|
};
|
|
2400
3114
|
}
|
|
2401
3115
|
if (state === "hovered") {
|
|
2402
|
-
const bg2 =
|
|
3116
|
+
const bg2 = mix(base.bg, tints[dark ? 300 : 600].hex);
|
|
2403
3117
|
const skeletonFrom2 = mix2(bg2, tints[dark ? 200 : 800].hex);
|
|
2404
3118
|
return {
|
|
2405
3119
|
bg: bg2,
|
|
2406
3120
|
bg2: mix2(bg2, tints[dark ? 50 : 950].hex),
|
|
2407
|
-
border:
|
|
2408
|
-
fg:
|
|
2409
|
-
iconColor:
|
|
3121
|
+
border: mix(base.bg, tints[dark ? 300 : 600].hex),
|
|
3122
|
+
fg: mix(base.bg, dark ? color$1.black.hex : color$1.white.hex),
|
|
3123
|
+
iconColor: "",
|
|
3124
|
+
// Add color
|
|
2410
3125
|
muted: {
|
|
2411
3126
|
fg: mix(base.bg, tints[dark ? 800 : 200].hex)
|
|
2412
3127
|
},
|
|
@@ -2427,14 +3142,15 @@ const color = createColorTheme({
|
|
|
2427
3142
|
};
|
|
2428
3143
|
}
|
|
2429
3144
|
if (state === "pressed") {
|
|
2430
|
-
const bg2 =
|
|
2431
|
-
const skeletonFrom2 = mix2(bg2, tints[dark ? 200 :
|
|
3145
|
+
const bg2 = mix(base.bg, tints[dark ? 200 : 800].hex);
|
|
3146
|
+
const skeletonFrom2 = mix2(bg2, tints[dark ? 200 : 800].hex);
|
|
2432
3147
|
return {
|
|
2433
|
-
bg:
|
|
3148
|
+
bg: mix(base.bg, tints[dark ? 200 : 800].hex),
|
|
2434
3149
|
bg2: mix2(bg2, tints[dark ? 50 : 950].hex),
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
3150
|
+
iconColor: "",
|
|
3151
|
+
// Add color
|
|
3152
|
+
border: mix(base.bg, tints[dark ? 200 : 800].hex),
|
|
3153
|
+
fg: mix(base.bg, dark ? color$1.black.hex : color$1.white.hex),
|
|
2438
3154
|
muted: {
|
|
2439
3155
|
fg: mix(base.bg, tints[dark ? 800 : 200].hex)
|
|
2440
3156
|
},
|
|
@@ -2463,9 +3179,10 @@ const color = createColorTheme({
|
|
|
2463
3179
|
return {
|
|
2464
3180
|
bg: bg2,
|
|
2465
3181
|
bg2: mix2(bg2, tints[dark ? 50 : 950].hex),
|
|
2466
|
-
border:
|
|
2467
|
-
fg:
|
|
2468
|
-
iconColor:
|
|
3182
|
+
border: mix(base.bg, tints[dark ? 200 : 800].hex),
|
|
3183
|
+
fg: mix(base.bg, dark ? color$1.black.hex : color$1.white.hex),
|
|
3184
|
+
iconColor: "",
|
|
3185
|
+
// Add color
|
|
2469
3186
|
muted: {
|
|
2470
3187
|
fg: mix(base.bg, tints[dark ? 800 : 200].hex)
|
|
2471
3188
|
},
|
|
@@ -2485,14 +3202,15 @@ const color = createColorTheme({
|
|
|
2485
3202
|
}
|
|
2486
3203
|
};
|
|
2487
3204
|
}
|
|
2488
|
-
const bg =
|
|
3205
|
+
const bg = mix(base.bg, tints[dark ? 400 : 500].hex);
|
|
2489
3206
|
const skeletonFrom = mix2(bg, tints[dark ? 200 : 800].hex);
|
|
2490
3207
|
return {
|
|
2491
3208
|
bg,
|
|
2492
3209
|
bg2: mix2(bg, tints[dark ? 50 : 950].hex),
|
|
2493
|
-
border: bg,
|
|
2494
|
-
|
|
2495
|
-
|
|
3210
|
+
border: mix(base.bg, tints[dark ? 400 : 500].hex),
|
|
3211
|
+
iconColor: "",
|
|
3212
|
+
// Add color
|
|
3213
|
+
fg: mix(base.bg, dark ? color$1.black.hex : color$1.white.hex),
|
|
2496
3214
|
muted: {
|
|
2497
3215
|
fg: mix(base.bg, tints[dark ? 900 : 100].hex)
|
|
2498
3216
|
},
|
|
@@ -2512,14 +3230,14 @@ const color = createColorTheme({
|
|
|
2512
3230
|
}
|
|
2513
3231
|
};
|
|
2514
3232
|
},
|
|
2515
|
-
muted:
|
|
3233
|
+
muted: _ref17 => {
|
|
2516
3234
|
let {
|
|
2517
3235
|
base,
|
|
2518
3236
|
dark,
|
|
2519
3237
|
name,
|
|
2520
3238
|
state,
|
|
2521
3239
|
tone
|
|
2522
|
-
} =
|
|
3240
|
+
} = _ref17;
|
|
2523
3241
|
const mix = dark ? screen : multiply;
|
|
2524
3242
|
const defaultTints = tones[name] || tones.default;
|
|
2525
3243
|
const isNeutral = NEUTRAL_TONES.includes(name) && NEUTRAL_TONES.includes(tone);
|
|
@@ -2531,21 +3249,22 @@ const color = createColorTheme({
|
|
|
2531
3249
|
return {
|
|
2532
3250
|
bg: bg2,
|
|
2533
3251
|
bg2: mix(bg2, tints[dark ? 950 : 50].hex),
|
|
2534
|
-
border:
|
|
2535
|
-
|
|
2536
|
-
|
|
3252
|
+
border: mix(bg2, tints[dark ? 950 : 50].hex),
|
|
3253
|
+
iconColor: "",
|
|
3254
|
+
// Add color
|
|
3255
|
+
fg: mix(bg2, tints[dark ? 800 : 200].hex),
|
|
2537
3256
|
muted: {
|
|
2538
|
-
fg:
|
|
3257
|
+
fg: mix(bg2, tints[dark ? 900 : 100].hex)
|
|
2539
3258
|
},
|
|
2540
3259
|
accent: {
|
|
2541
|
-
fg:
|
|
3260
|
+
fg: mix(bg2, tints[dark ? 900 : 100].hex)
|
|
2542
3261
|
},
|
|
2543
3262
|
link: {
|
|
2544
|
-
fg:
|
|
3263
|
+
fg: mix(bg2, tints[dark ? 900 : 100].hex)
|
|
2545
3264
|
},
|
|
2546
3265
|
code: {
|
|
2547
3266
|
bg: bg2,
|
|
2548
|
-
fg:
|
|
3267
|
+
fg: mix(bg2, tints[dark ? 900 : 100].hex)
|
|
2549
3268
|
},
|
|
2550
3269
|
skeleton: {
|
|
2551
3270
|
from: rgba(skeletonFrom2, 0.5),
|
|
@@ -2554,16 +3273,17 @@ const color = createColorTheme({
|
|
|
2554
3273
|
};
|
|
2555
3274
|
}
|
|
2556
3275
|
if (state === "hovered") {
|
|
2557
|
-
const bg2 =
|
|
3276
|
+
const bg2 = mix(base.bg, tints[dark ? 950 : 50].hex);
|
|
2558
3277
|
const skeletonFrom2 = mix(bg2, tints[dark ? 900 : 100].hex);
|
|
2559
3278
|
return {
|
|
2560
3279
|
bg: bg2,
|
|
2561
3280
|
bg2: mix(bg2, tints[dark ? 950 : 50].hex),
|
|
2562
3281
|
border: mix(bg2, tints[dark ? 900 : 100].hex),
|
|
2563
|
-
fg:
|
|
2564
|
-
iconColor:
|
|
3282
|
+
fg: mix(base.bg, tints[dark ? 200 : 800].hex),
|
|
3283
|
+
iconColor: "",
|
|
3284
|
+
// Add color
|
|
2565
3285
|
muted: {
|
|
2566
|
-
fg:
|
|
3286
|
+
fg: mix(base.bg, tints[dark ? 400 : 600].hex)
|
|
2567
3287
|
},
|
|
2568
3288
|
accent: {
|
|
2569
3289
|
fg: mix(base.bg, color$1.hues.red[dark ? 400 : 500].hex)
|
|
@@ -2573,7 +3293,7 @@ const color = createColorTheme({
|
|
|
2573
3293
|
},
|
|
2574
3294
|
code: {
|
|
2575
3295
|
bg: mix(bg2, tints[dark ? 950 : 50].hex),
|
|
2576
|
-
fg:
|
|
3296
|
+
fg: mix(base.bg, tints[dark ? 400 : 600].hex)
|
|
2577
3297
|
},
|
|
2578
3298
|
skeleton: {
|
|
2579
3299
|
from: skeletonFrom2,
|
|
@@ -2585,16 +3305,17 @@ const color = createColorTheme({
|
|
|
2585
3305
|
if (isNeutral) {
|
|
2586
3306
|
tints = tones.primary;
|
|
2587
3307
|
}
|
|
2588
|
-
const bg2 =
|
|
2589
|
-
const skeletonFrom2 = mix(bg2,
|
|
3308
|
+
const bg2 = mix(base.bg, tints[dark ? 900 : 100].hex);
|
|
3309
|
+
const skeletonFrom2 = mix(bg2, tints[dark ? 900 : 100].hex);
|
|
2590
3310
|
return {
|
|
2591
3311
|
bg: bg2,
|
|
2592
3312
|
bg2: mix(bg2, tints[dark ? 950 : 50].hex),
|
|
2593
|
-
border:
|
|
2594
|
-
|
|
2595
|
-
|
|
3313
|
+
border: mix(bg2, tints[dark ? 900 : 100].hex),
|
|
3314
|
+
iconColor: "",
|
|
3315
|
+
// Add color
|
|
3316
|
+
fg: mix(base.bg, tints[dark ? 200 : 800].hex),
|
|
2596
3317
|
muted: {
|
|
2597
|
-
fg:
|
|
3318
|
+
fg: mix(base.bg, tints[dark ? 400 : 600].hex)
|
|
2598
3319
|
},
|
|
2599
3320
|
accent: {
|
|
2600
3321
|
fg: mix(bg2, color$1.hues.red[dark ? 400 : 500].hex)
|
|
@@ -2604,7 +3325,7 @@ const color = createColorTheme({
|
|
|
2604
3325
|
},
|
|
2605
3326
|
code: {
|
|
2606
3327
|
bg: mix(bg2, tints[dark ? 950 : 50].hex),
|
|
2607
|
-
fg:
|
|
3328
|
+
fg: mix(base.bg, tints[dark ? 400 : 600].hex)
|
|
2608
3329
|
},
|
|
2609
3330
|
skeleton: {
|
|
2610
3331
|
from: skeletonFrom2,
|
|
@@ -2621,11 +3342,12 @@ const color = createColorTheme({
|
|
|
2621
3342
|
return {
|
|
2622
3343
|
bg: bg2,
|
|
2623
3344
|
bg2: mix(bg2, tints[dark ? 950 : 50].hex),
|
|
2624
|
-
border:
|
|
2625
|
-
fg:
|
|
2626
|
-
iconColor:
|
|
3345
|
+
border: mix(bg2, tints[dark ? 900 : 100].hex),
|
|
3346
|
+
fg: mix(base.bg, tints[dark ? 200 : 800].hex),
|
|
3347
|
+
iconColor: "",
|
|
3348
|
+
// Add color
|
|
2627
3349
|
muted: {
|
|
2628
|
-
fg:
|
|
3350
|
+
fg: mix(base.bg, tints[dark ? 400 : 600].hex)
|
|
2629
3351
|
},
|
|
2630
3352
|
accent: {
|
|
2631
3353
|
fg: mix(bg2, color$1.hues.red[dark ? 400 : 500].hex)
|
|
@@ -2635,7 +3357,7 @@ const color = createColorTheme({
|
|
|
2635
3357
|
},
|
|
2636
3358
|
code: {
|
|
2637
3359
|
bg: mix(bg2, tints[dark ? 950 : 50].hex),
|
|
2638
|
-
fg:
|
|
3360
|
+
fg: mix(base.bg, tints[dark ? 400 : 600].hex)
|
|
2639
3361
|
},
|
|
2640
3362
|
skeleton: {
|
|
2641
3363
|
from: skeletonFrom2,
|
|
@@ -2648,11 +3370,12 @@ const color = createColorTheme({
|
|
|
2648
3370
|
return {
|
|
2649
3371
|
bg,
|
|
2650
3372
|
bg2: mix(bg, tints[dark ? 950 : 50].hex),
|
|
2651
|
-
border: mix(bg,
|
|
2652
|
-
fg:
|
|
2653
|
-
iconColor:
|
|
3373
|
+
border: mix(bg, tints[dark ? 900 : 100].hex),
|
|
3374
|
+
fg: mix(base.bg, tints[dark ? 300 : 700].hex),
|
|
3375
|
+
iconColor: "",
|
|
3376
|
+
// Add color
|
|
2654
3377
|
muted: {
|
|
2655
|
-
fg:
|
|
3378
|
+
fg: mix(base.bg, tints[dark ? 400 : 600].hex)
|
|
2656
3379
|
},
|
|
2657
3380
|
accent: {
|
|
2658
3381
|
fg: mix(base.bg, color$1.hues.red[dark ? 400 : 500].hex)
|
|
@@ -2662,7 +3385,7 @@ const color = createColorTheme({
|
|
|
2662
3385
|
},
|
|
2663
3386
|
code: {
|
|
2664
3387
|
bg: mix(base.bg, tints[dark ? 950 : 50].hex),
|
|
2665
|
-
fg:
|
|
3388
|
+
fg: mix(base.bg, tints[dark ? 400 : 600].hex)
|
|
2666
3389
|
},
|
|
2667
3390
|
skeleton: {
|
|
2668
3391
|
from: skeletonFrom,
|
|
@@ -2670,13 +3393,13 @@ const color = createColorTheme({
|
|
|
2670
3393
|
}
|
|
2671
3394
|
};
|
|
2672
3395
|
},
|
|
2673
|
-
button:
|
|
3396
|
+
button: _ref18 => {
|
|
2674
3397
|
let {
|
|
2675
3398
|
base,
|
|
2676
3399
|
mode,
|
|
2677
3400
|
muted,
|
|
2678
3401
|
solid
|
|
2679
|
-
} =
|
|
3402
|
+
} = _ref18;
|
|
2680
3403
|
if (mode === "bleed") {
|
|
2681
3404
|
return {
|
|
2682
3405
|
enabled: {
|
|
@@ -2703,16 +3426,17 @@ const color = createColorTheme({
|
|
|
2703
3426
|
}
|
|
2704
3427
|
if (mode === "ghost") {
|
|
2705
3428
|
return {
|
|
2706
|
-
...
|
|
3429
|
+
...solid,
|
|
2707
3430
|
enabled: {
|
|
2708
3431
|
...muted.enabled,
|
|
2709
3432
|
border: base.border
|
|
2710
|
-
}
|
|
3433
|
+
},
|
|
3434
|
+
disabled: muted.disabled
|
|
2711
3435
|
};
|
|
2712
3436
|
}
|
|
2713
3437
|
return solid;
|
|
2714
3438
|
},
|
|
2715
|
-
card:
|
|
3439
|
+
card: _ref19 => {
|
|
2716
3440
|
let {
|
|
2717
3441
|
base,
|
|
2718
3442
|
dark,
|
|
@@ -2720,7 +3444,7 @@ const color = createColorTheme({
|
|
|
2720
3444
|
name,
|
|
2721
3445
|
solid,
|
|
2722
3446
|
state
|
|
2723
|
-
} =
|
|
3447
|
+
} = _ref19;
|
|
2724
3448
|
if (state === "hovered") {
|
|
2725
3449
|
return muted[name].hovered;
|
|
2726
3450
|
}
|
|
@@ -2748,8 +3472,9 @@ const color = createColorTheme({
|
|
|
2748
3472
|
bg,
|
|
2749
3473
|
bg2: mix(bg, tints[dark ? 950 : 50].hex),
|
|
2750
3474
|
fg: base.fg,
|
|
2751
|
-
iconColor: getColorHex(tints, dark, name, "icon_default"),
|
|
2752
3475
|
border: base.border,
|
|
3476
|
+
iconColor: "",
|
|
3477
|
+
// Add color
|
|
2753
3478
|
muted: {
|
|
2754
3479
|
fg: mix(base.bg, tints[dark ? 400 : 600].hex)
|
|
2755
3480
|
},
|
|
@@ -2769,67 +3494,72 @@ const color = createColorTheme({
|
|
|
2769
3494
|
}
|
|
2770
3495
|
};
|
|
2771
3496
|
},
|
|
2772
|
-
input:
|
|
3497
|
+
input: _ref20 => {
|
|
2773
3498
|
let {
|
|
2774
3499
|
base,
|
|
2775
3500
|
dark,
|
|
2776
3501
|
mode,
|
|
2777
3502
|
state
|
|
2778
|
-
} =
|
|
3503
|
+
} = _ref20;
|
|
2779
3504
|
const mix = dark ? screen : multiply;
|
|
2780
3505
|
if (mode === "invalid") {
|
|
2781
3506
|
const tints = tones.critical;
|
|
2782
3507
|
return {
|
|
2783
3508
|
bg: mix(base.bg, tints[dark ? 950 : 50].hex),
|
|
2784
|
-
bg2:
|
|
3509
|
+
bg2: "",
|
|
3510
|
+
// Add color
|
|
2785
3511
|
fg: mix(base.bg, tints[dark ? 400 : 600].hex),
|
|
2786
|
-
border:
|
|
2787
|
-
placeholder:
|
|
3512
|
+
border: mix(base.bg, tints[dark ? 800 : 200].hex),
|
|
3513
|
+
placeholder: mix(base.bg, tints[dark ? 600 : 400].hex)
|
|
2788
3514
|
};
|
|
2789
3515
|
}
|
|
2790
3516
|
if (state === "hovered") {
|
|
2791
3517
|
return {
|
|
2792
3518
|
bg: base.bg,
|
|
2793
|
-
bg2:
|
|
3519
|
+
bg2: "",
|
|
3520
|
+
// Add color
|
|
2794
3521
|
fg: base.fg,
|
|
2795
3522
|
border: mix(base.bg, color$1.hues.gray[dark ? 700 : 300].hex),
|
|
2796
|
-
placeholder:
|
|
3523
|
+
placeholder: mix(base.bg, color$1.hues.gray[dark ? 600 : 400].hex)
|
|
2797
3524
|
};
|
|
2798
3525
|
}
|
|
2799
3526
|
if (state === "disabled") {
|
|
2800
3527
|
return {
|
|
2801
|
-
bg:
|
|
2802
|
-
bg2:
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
3528
|
+
bg: mix(base.bg, color$1.hues.gray[dark ? 950 : 50].hex),
|
|
3529
|
+
bg2: "",
|
|
3530
|
+
// Add color
|
|
3531
|
+
fg: mix(base.bg, color$1.hues.gray[dark ? 700 : 300].hex),
|
|
3532
|
+
border: mix(base.bg, color$1.hues.gray[dark ? 900 : 100].hex),
|
|
3533
|
+
placeholder: mix(base.bg, color$1.hues.gray[dark ? 800 : 200].hex)
|
|
2806
3534
|
};
|
|
2807
3535
|
}
|
|
2808
3536
|
if (state === "readOnly") {
|
|
2809
3537
|
return {
|
|
2810
|
-
bg:
|
|
2811
|
-
bg2:
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
3538
|
+
bg: mix(base.bg, color$1.hues.gray[dark ? 950 : 50].hex),
|
|
3539
|
+
bg2: "",
|
|
3540
|
+
// Add color
|
|
3541
|
+
fg: mix(base.bg, color$1.hues.gray[dark ? 200 : 800].hex),
|
|
3542
|
+
border: mix(base.bg, color$1.hues.gray[dark ? 800 : 200].hex),
|
|
3543
|
+
placeholder: mix(base.bg, color$1.hues.gray[dark ? 600 : 400].hex)
|
|
2815
3544
|
};
|
|
2816
3545
|
}
|
|
2817
3546
|
return {
|
|
2818
3547
|
bg: base.bg,
|
|
2819
|
-
bg2:
|
|
3548
|
+
bg2: "",
|
|
3549
|
+
// Add color
|
|
2820
3550
|
fg: base.fg,
|
|
2821
3551
|
border: base.border,
|
|
2822
|
-
placeholder:
|
|
3552
|
+
placeholder: mix(base.bg, color$1.hues.gray[dark ? 600 : 400].hex)
|
|
2823
3553
|
};
|
|
2824
3554
|
},
|
|
2825
|
-
selectable:
|
|
3555
|
+
selectable: _ref21 => {
|
|
2826
3556
|
let {
|
|
2827
3557
|
base,
|
|
2828
3558
|
muted,
|
|
2829
3559
|
tone,
|
|
2830
3560
|
solid,
|
|
2831
3561
|
state
|
|
2832
|
-
} =
|
|
3562
|
+
} = _ref21;
|
|
2833
3563
|
if (state === "enabled") {
|
|
2834
3564
|
return {
|
|
2835
3565
|
...muted[tone].enabled,
|
|
@@ -2856,20 +3586,20 @@ const color = createColorTheme({
|
|
|
2856
3586
|
}
|
|
2857
3587
|
return muted[tone][state];
|
|
2858
3588
|
},
|
|
2859
|
-
spot:
|
|
3589
|
+
spot: _ref22 => {
|
|
2860
3590
|
let {
|
|
2861
3591
|
base,
|
|
2862
3592
|
dark,
|
|
2863
3593
|
key
|
|
2864
|
-
} =
|
|
3594
|
+
} = _ref22;
|
|
2865
3595
|
const mix = dark ? screen : multiply;
|
|
2866
3596
|
return mix(base.bg, color$1.hues[key][dark ? 400 : 500].hex);
|
|
2867
3597
|
},
|
|
2868
|
-
syntax:
|
|
3598
|
+
syntax: _ref23 => {
|
|
2869
3599
|
let {
|
|
2870
3600
|
base,
|
|
2871
3601
|
dark
|
|
2872
|
-
} =
|
|
3602
|
+
} = _ref23;
|
|
2873
3603
|
const mix = dark ? screen : multiply;
|
|
2874
3604
|
const mainShade = dark ? 400 : 600;
|
|
2875
3605
|
const secondaryShade = dark ? 600 : 400;
|
|
@@ -3106,16 +3836,16 @@ const studioTheme = {
|
|
|
3106
3836
|
avatar: {
|
|
3107
3837
|
sizes: [{
|
|
3108
3838
|
distance: -3,
|
|
3109
|
-
size:
|
|
3839
|
+
size: 23
|
|
3110
3840
|
}, {
|
|
3111
3841
|
distance: -6,
|
|
3112
|
-
size:
|
|
3842
|
+
size: 33
|
|
3113
3843
|
}, {
|
|
3114
3844
|
distance: -9,
|
|
3115
|
-
size:
|
|
3845
|
+
size: 53
|
|
3116
3846
|
}],
|
|
3117
3847
|
focusRing: {
|
|
3118
|
-
offset:
|
|
3848
|
+
offset: 0,
|
|
3119
3849
|
width: 1
|
|
3120
3850
|
}
|
|
3121
3851
|
},
|
|
@@ -3146,9 +3876,9 @@ const studioTheme = {
|
|
|
3146
3876
|
penumbra: [0, 0, 0, 0],
|
|
3147
3877
|
ambient: [0, 0, 0, 0]
|
|
3148
3878
|
}, {
|
|
3149
|
-
umbra: [0, 3, 5, -
|
|
3879
|
+
umbra: [0, 3, 5, -2],
|
|
3150
3880
|
penumbra: [0, 6, 10, 0],
|
|
3151
|
-
ambient: [0, 1, 18,
|
|
3881
|
+
ambient: [0, 1, 18, 1]
|
|
3152
3882
|
}, {
|
|
3153
3883
|
umbra: [0, 7, 8, -4],
|
|
3154
3884
|
penumbra: [0, 12, 17, 2],
|
|
@@ -3965,7 +4695,7 @@ var __defProp$E = Object.defineProperty;
|
|
|
3965
4695
|
var __template$D = (cooked, raw) => __freeze$D(__defProp$E(cooked, "raw", {
|
|
3966
4696
|
value: __freeze$D(raw || cooked.slice())
|
|
3967
4697
|
}));
|
|
3968
|
-
var _a$D, _b$
|
|
4698
|
+
var _a$D, _b$n, _c$d;
|
|
3969
4699
|
const ROOT_STYLE = styled.css(_a$D || (_a$D = __template$D(["\n &:not([hidden]) {\n display: flex;\n }\n\n align-items: center;\n"])));
|
|
3970
4700
|
function textInputRootStyle() {
|
|
3971
4701
|
return ROOT_STYLE;
|
|
@@ -3979,7 +4709,7 @@ function textInputBaseStyle(props) {
|
|
|
3979
4709
|
} = props;
|
|
3980
4710
|
const font = theme.sanity.fonts.text;
|
|
3981
4711
|
const color = theme.sanity.color.input;
|
|
3982
|
-
return styled.css(_b$
|
|
4712
|
+
return styled.css(_b$n || (_b$n = __template$D(["\n appearance: none;\n background: none;\n border: 0;\n border-radius: 0;\n outline: none;\n width: 100%;\n box-sizing: border-box;\n font-family: ", ";\n font-weight: ", ";\n margin: 0;\n position: relative;\n z-index: 1;\n display: block;\n\n /* NOTE: This is a hack to disable Chrome\u2019s autofill styles */\n &:-webkit-autofill,\n &:-webkit-autofill:hover,\n &:-webkit-autofill:focus,\n &:-webkit-autofill:active {\n -webkit-text-fill-color: var(--input-fg-color) !important;\n transition: background-color 5000s;\n transition-delay: 86400s /* 24h */;\n }\n\n /* &:is(textarea) */\n &[data-as='textarea'] {\n resize: none;\n }\n\n color: var(--input-fg-color);\n\n &::placeholder {\n color: var(--input-placeholder-color);\n }\n\n &[data-scheme='", "'][data-tone='", "'] {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n\n /* enabled */\n &:not(:invalid):not(:disabled):not(:read-only) {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n\n /* disabled */\n &:not(:invalid):disabled {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n\n /* invalid */\n &:invalid {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n\n /* readOnly */\n &:read-only {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n }\n "])), font.family, $weight && font.weights[$weight] || font.weights.regular, $scheme, $tone, color.default.enabled.fg, color.default.enabled.placeholder, color.default.enabled.fg, color.default.enabled.placeholder, color.default.disabled.fg, color.default.disabled.placeholder, color.invalid.enabled.fg, color.invalid.enabled.placeholder, color.default.readOnly.fg, color.default.readOnly.placeholder);
|
|
3983
4713
|
}
|
|
3984
4714
|
function textInputFontSizeStyle(props) {
|
|
3985
4715
|
const {
|
|
@@ -4003,6 +4733,7 @@ function textInputRepresentationStyle(props) {
|
|
|
4003
4733
|
$hasSuffix,
|
|
4004
4734
|
$scheme,
|
|
4005
4735
|
$tone,
|
|
4736
|
+
$unstableDisableFocusRing,
|
|
4006
4737
|
theme
|
|
4007
4738
|
} = props;
|
|
4008
4739
|
const {
|
|
@@ -4018,13 +4749,13 @@ function textInputRepresentationStyle(props) {
|
|
|
4018
4749
|
}), color.invalid.enabled.bg, color.invalid.enabled.fg, focusRingBorderStyle({
|
|
4019
4750
|
color: color.invalid.enabled.border,
|
|
4020
4751
|
width: input.border.width
|
|
4021
|
-
}), focusRingStyle({
|
|
4752
|
+
}), $unstableDisableFocusRing ? void 0 : focusRingStyle({
|
|
4022
4753
|
border: {
|
|
4023
4754
|
color: color.default.enabled.border,
|
|
4024
4755
|
width: input.border.width
|
|
4025
4756
|
},
|
|
4026
4757
|
focusRing
|
|
4027
|
-
}), focusRingStyle({
|
|
4758
|
+
}), $unstableDisableFocusRing ? void 0 : focusRingStyle({
|
|
4028
4759
|
focusRing
|
|
4029
4760
|
}), color.default.disabled.bg, color.default.disabled.fg, focusRingBorderStyle({
|
|
4030
4761
|
color: color.default.disabled.border,
|
|
@@ -4095,7 +4826,7 @@ var __defProp$D = Object.defineProperty;
|
|
|
4095
4826
|
var __template$C = (cooked, raw) => __freeze$C(__defProp$D(cooked, "raw", {
|
|
4096
4827
|
value: __freeze$C(raw || cooked.slice())
|
|
4097
4828
|
}));
|
|
4098
|
-
var _a$C, _b$
|
|
4829
|
+
var _a$C, _b$m, _c$c;
|
|
4099
4830
|
function textBaseStyle(props) {
|
|
4100
4831
|
const {
|
|
4101
4832
|
$accent,
|
|
@@ -4105,7 +4836,7 @@ function textBaseStyle(props) {
|
|
|
4105
4836
|
const {
|
|
4106
4837
|
weights
|
|
4107
4838
|
} = theme.sanity.fonts.text;
|
|
4108
|
-
return styled.css(_c$c || (_c$c = __template$C(["\n color: var(--card-fg-color);\n\n ", "\n\n ", "\n\n & code {\n font-family: ", ";\n border-radius: 1px;\n background-color: var(--card-code-bg-color);\n color: var(--card-code-fg-color);\n }\n\n & a {\n text-decoration: none;\n border-radius: 1px;\n color: var(--card-link-color);\n outline: none;\n\n @media (hover: hover) {\n &:hover {\n text-decoration: underline;\n }\n }\n\n &:focus {\n box-shadow:\n 0 0 0 1px var(--card-bg-color),\n 0 0 0 3px var(--card-focus-ring-color);\n }\n\n &:focus:not(:focus-visible) {\n box-shadow: none;\n }\n }\n\n & strong {\n font-weight: ", ";\n }\n\n & svg {\n /* Certain popular CSS libraries changes the defaults for SVG display */\n /* Make sure SVGs are rendered as inline elements */\n display: inline;\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n color: var(--card-icon-color);\n }\n "])), $accent && styled.css(_a$C || (_a$C = __template$C(["\n color: var(--card-accent-fg-color);\n "]))), $muted && styled.css(_b$
|
|
4839
|
+
return styled.css(_c$c || (_c$c = __template$C(["\n color: var(--card-fg-color);\n\n ", "\n\n ", "\n\n & code {\n font-family: ", ";\n border-radius: 1px;\n background-color: var(--card-code-bg-color);\n color: var(--card-code-fg-color);\n }\n\n & a {\n text-decoration: none;\n border-radius: 1px;\n color: var(--card-link-color);\n outline: none;\n\n @media (hover: hover) {\n &:hover {\n text-decoration: underline;\n }\n }\n\n &:focus {\n box-shadow:\n 0 0 0 1px var(--card-bg-color),\n 0 0 0 3px var(--card-focus-ring-color);\n }\n\n &:focus:not(:focus-visible) {\n box-shadow: none;\n }\n }\n\n & strong {\n font-weight: ", ";\n }\n\n & svg {\n /* Certain popular CSS libraries changes the defaults for SVG display */\n /* Make sure SVGs are rendered as inline elements */\n display: inline;\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n color: var(--card-icon-color);\n }\n "])), $accent && styled.css(_a$C || (_a$C = __template$C(["\n color: var(--card-accent-fg-color);\n "]))), $muted && styled.css(_b$m || (_b$m = __template$C(["\n color: var(--card-muted-fg-color);\n "]))), theme.sanity.fonts.code.family, weights.bold);
|
|
4109
4840
|
}
|
|
4110
4841
|
var __freeze$B = Object.freeze;
|
|
4111
4842
|
var __defProp$C = Object.defineProperty;
|
|
@@ -4287,7 +5018,7 @@ function avatarBgStrokeStyle() {
|
|
|
4287
5018
|
}
|
|
4288
5019
|
function avatarStrokeStyle() {
|
|
4289
5020
|
return {
|
|
4290
|
-
strokeWidth: "
|
|
5021
|
+
strokeWidth: "2px",
|
|
4291
5022
|
'[data-status="editing"] &': {
|
|
4292
5023
|
strokeDasharray: "2 4",
|
|
4293
5024
|
strokeLinecap: "round"
|
|
@@ -4301,6 +5032,7 @@ const Stroke = styled__default.default.ellipse(avatarStyle.stroke);
|
|
|
4301
5032
|
const Initials = styled__default.default.div(avatarStyle.initials);
|
|
4302
5033
|
const Avatar = react.forwardRef(function Avatar2(props, ref) {
|
|
4303
5034
|
const {
|
|
5035
|
+
__unstable_hideInnerStroke,
|
|
4304
5036
|
as: asProp,
|
|
4305
5037
|
color: colorKey = "gray",
|
|
4306
5038
|
src,
|
|
@@ -4383,7 +5115,7 @@ const Avatar = react.forwardRef(function Avatar2(props, ref) {
|
|
|
4383
5115
|
cy: _radius,
|
|
4384
5116
|
r: _radius,
|
|
4385
5117
|
fill: "url(#".concat(imageId, ")")
|
|
4386
|
-
}), /* @__PURE__ */jsxRuntime.jsx(BgStroke, {
|
|
5118
|
+
}), !__unstable_hideInnerStroke && /* @__PURE__ */jsxRuntime.jsx(BgStroke, {
|
|
4387
5119
|
cx: _radius,
|
|
4388
5120
|
cy: _radius,
|
|
4389
5121
|
rx: _radius,
|
|
@@ -4402,9 +5134,8 @@ const Avatar = react.forwardRef(function Avatar2(props, ref) {
|
|
|
4402
5134
|
children: /* @__PURE__ */jsxRuntime.jsx(Text, {
|
|
4403
5135
|
as: "span",
|
|
4404
5136
|
size: initialsSize,
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
})
|
|
5137
|
+
weight: "medium",
|
|
5138
|
+
children: initials
|
|
4408
5139
|
})
|
|
4409
5140
|
})
|
|
4410
5141
|
})]
|
|
@@ -4438,7 +5169,7 @@ function _avatarCounterBaseStyle(props) {
|
|
|
4438
5169
|
const {
|
|
4439
5170
|
theme
|
|
4440
5171
|
} = props;
|
|
4441
|
-
return styled.css(_a$A || (_a$A = __template$A(["\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n user-select: none;\n color: inherit;\n color: var(--card-fg-color);\n background: var(--card-bg-color);\n box-shadow:\n 0 0 0 1px var(--card-bg-color),\n inset 0 0 0
|
|
5172
|
+
return styled.css(_a$A || (_a$A = __template$A(["\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n user-select: none;\n color: inherit;\n color: var(--card-fg-color);\n background: var(--card-bg-color);\n box-shadow:\n 0 0 0 1px var(--card-bg-color),\n inset 0 0 0 1px var(--card-hairline-hard-color);\n padding: 0 ", ";\n\n &:not([hidden]) {\n display: flex;\n }\n "])), rem(theme.sanity.space[2]));
|
|
4442
5173
|
}
|
|
4443
5174
|
const Root$C = styled__default.default.div(_responsiveAvatarCounterSizeStyle, _avatarCounterBaseStyle);
|
|
4444
5175
|
const AvatarCounter = react.forwardRef(function AvatarCounter2(props, ref) {
|
|
@@ -4455,9 +5186,8 @@ const AvatarCounter = react.forwardRef(function AvatarCounter2(props, ref) {
|
|
|
4455
5186
|
children: /* @__PURE__ */jsxRuntime.jsx(Text, {
|
|
4456
5187
|
as: "span",
|
|
4457
5188
|
size: counterSize,
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
})
|
|
5189
|
+
weight: "medium",
|
|
5190
|
+
children: count
|
|
4461
5191
|
})
|
|
4462
5192
|
});
|
|
4463
5193
|
});
|
|
@@ -4572,84 +5302,26 @@ const Box = react.forwardRef(function Box2(props, ref) {
|
|
|
4572
5302
|
$height: useArrayProp(height),
|
|
4573
5303
|
$margin: useArrayProp(margin),
|
|
4574
5304
|
$marginX: useArrayProp(marginX),
|
|
4575
|
-
$marginY: useArrayProp(marginY),
|
|
4576
|
-
$marginTop: useArrayProp(marginTop),
|
|
4577
|
-
$marginRight: useArrayProp(marginRight),
|
|
4578
|
-
$marginBottom: useArrayProp(marginBottom),
|
|
4579
|
-
$marginLeft: useArrayProp(marginLeft),
|
|
4580
|
-
$overflow: useArrayProp(overflow),
|
|
4581
|
-
$padding: useArrayProp(padding),
|
|
4582
|
-
$paddingX: useArrayProp(paddingX),
|
|
4583
|
-
$paddingY: useArrayProp(paddingY),
|
|
4584
|
-
$paddingTop: useArrayProp(paddingTop),
|
|
4585
|
-
$paddingRight: useArrayProp(paddingRight),
|
|
4586
|
-
$paddingBottom: useArrayProp(paddingBottom),
|
|
4587
|
-
$paddingLeft: useArrayProp(paddingLeft),
|
|
4588
|
-
$row: useArrayProp(row),
|
|
4589
|
-
$rowStart: useArrayProp(rowStart),
|
|
4590
|
-
$rowEnd: useArrayProp(rowEnd),
|
|
4591
|
-
$sizing: useArrayProp(sizing),
|
|
4592
|
-
as: asProp,
|
|
4593
|
-
ref,
|
|
4594
|
-
children: props.children
|
|
4595
|
-
});
|
|
4596
|
-
});
|
|
4597
|
-
var __freeze$y = Object.freeze;
|
|
4598
|
-
var __defProp$z = Object.defineProperty;
|
|
4599
|
-
var __template$y = (cooked, raw) => __freeze$y(__defProp$z(cooked, "raw", {
|
|
4600
|
-
value: __freeze$y(raw || cooked.slice())
|
|
4601
|
-
}));
|
|
4602
|
-
var _a$y, _b$k, _c$b;
|
|
4603
|
-
function labelBaseStyle(props) {
|
|
4604
|
-
const {
|
|
4605
|
-
$accent,
|
|
4606
|
-
$muted,
|
|
4607
|
-
theme
|
|
4608
|
-
} = props;
|
|
4609
|
-
const {
|
|
4610
|
-
fonts
|
|
4611
|
-
} = theme.sanity;
|
|
4612
|
-
return styled.css(_c$b || (_c$b = __template$y(["\n text-transform: uppercase;\n\n ", "\n\n ", "\n\n & code {\n font-family: ", ";\n border-radius: 1px;\n }\n\n & a {\n text-decoration: none;\n border-radius: 1px;\n }\n\n & svg {\n /* Certain popular CSS libraries changes the defaults for SVG display */\n /* Make sure SVGs are rendered as inline elements */\n display: inline;\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n }\n "])), $accent && styled.css(_a$y || (_a$y = __template$y(["\n color: var(--card-accent-fg-color);\n "]))), $muted && styled.css(_b$k || (_b$k = __template$y(["\n color: var(--card-muted-fg-color);\n "]))), fonts.code.family);
|
|
4613
|
-
}
|
|
4614
|
-
var __freeze$x = Object.freeze;
|
|
4615
|
-
var __defProp$y = Object.defineProperty;
|
|
4616
|
-
var __template$x = (cooked, raw) => __freeze$x(__defProp$y(cooked, "raw", {
|
|
4617
|
-
value: __freeze$x(raw || cooked.slice())
|
|
4618
|
-
}));
|
|
4619
|
-
var _a$x;
|
|
4620
|
-
const Root$z = styled__default.default.div(responsiveLabelFont, responsiveTextAlignStyle, labelBaseStyle);
|
|
4621
|
-
const SpanWithTextOverflow$1 = styled__default.default.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"])));
|
|
4622
|
-
const Label = react.forwardRef(function Label2(props, ref) {
|
|
4623
|
-
const {
|
|
4624
|
-
accent,
|
|
4625
|
-
align,
|
|
4626
|
-
children: childrenProp,
|
|
4627
|
-
muted = false,
|
|
4628
|
-
size = 2,
|
|
4629
|
-
textOverflow,
|
|
4630
|
-
weight,
|
|
4631
|
-
...restProps
|
|
4632
|
-
} = props;
|
|
4633
|
-
let children = childrenProp;
|
|
4634
|
-
if (textOverflow === "ellipsis") {
|
|
4635
|
-
children = /* @__PURE__ */jsxRuntime.jsx(SpanWithTextOverflow$1, {
|
|
4636
|
-
children
|
|
4637
|
-
});
|
|
4638
|
-
} else {
|
|
4639
|
-
children = /* @__PURE__ */jsxRuntime.jsx("span", {
|
|
4640
|
-
children
|
|
4641
|
-
});
|
|
4642
|
-
}
|
|
4643
|
-
return /* @__PURE__ */jsxRuntime.jsx(Root$z, {
|
|
4644
|
-
"data-ui": "Label",
|
|
4645
|
-
...restProps,
|
|
4646
|
-
$accent: accent,
|
|
4647
|
-
$align: useArrayProp(align),
|
|
4648
|
-
$muted: muted,
|
|
4649
|
-
$size: useArrayProp(size),
|
|
4650
|
-
$weight: weight,
|
|
5305
|
+
$marginY: useArrayProp(marginY),
|
|
5306
|
+
$marginTop: useArrayProp(marginTop),
|
|
5307
|
+
$marginRight: useArrayProp(marginRight),
|
|
5308
|
+
$marginBottom: useArrayProp(marginBottom),
|
|
5309
|
+
$marginLeft: useArrayProp(marginLeft),
|
|
5310
|
+
$overflow: useArrayProp(overflow),
|
|
5311
|
+
$padding: useArrayProp(padding),
|
|
5312
|
+
$paddingX: useArrayProp(paddingX),
|
|
5313
|
+
$paddingY: useArrayProp(paddingY),
|
|
5314
|
+
$paddingTop: useArrayProp(paddingTop),
|
|
5315
|
+
$paddingRight: useArrayProp(paddingRight),
|
|
5316
|
+
$paddingBottom: useArrayProp(paddingBottom),
|
|
5317
|
+
$paddingLeft: useArrayProp(paddingLeft),
|
|
5318
|
+
$row: useArrayProp(row),
|
|
5319
|
+
$rowStart: useArrayProp(rowStart),
|
|
5320
|
+
$rowEnd: useArrayProp(rowEnd),
|
|
5321
|
+
$sizing: useArrayProp(sizing),
|
|
5322
|
+
as: asProp,
|
|
4651
5323
|
ref,
|
|
4652
|
-
children
|
|
5324
|
+
children: props.children
|
|
4653
5325
|
});
|
|
4654
5326
|
});
|
|
4655
5327
|
function badgeStyle(props) {
|
|
@@ -4670,18 +5342,18 @@ function badgeStyle(props) {
|
|
|
4670
5342
|
}
|
|
4671
5343
|
};
|
|
4672
5344
|
}
|
|
4673
|
-
const Root$
|
|
5345
|
+
const Root$z = styled__default.default(Box)(responsiveRadiusStyle, badgeStyle);
|
|
4674
5346
|
const Badge = react.forwardRef(function Badge2(props, ref) {
|
|
4675
5347
|
const {
|
|
4676
5348
|
children,
|
|
4677
|
-
fontSize,
|
|
5349
|
+
fontSize = 1,
|
|
4678
5350
|
mode = "default",
|
|
4679
5351
|
padding = 1,
|
|
4680
5352
|
radius = 2,
|
|
4681
5353
|
tone = "default",
|
|
4682
5354
|
...restProps
|
|
4683
5355
|
} = props;
|
|
4684
|
-
return /* @__PURE__ */jsxRuntime.jsx(Root$
|
|
5356
|
+
return /* @__PURE__ */jsxRuntime.jsx(Root$z, {
|
|
4685
5357
|
"data-ui": "Badge",
|
|
4686
5358
|
...restProps,
|
|
4687
5359
|
$mode: mode,
|
|
@@ -4689,13 +5361,14 @@ const Badge = react.forwardRef(function Badge2(props, ref) {
|
|
|
4689
5361
|
$radius: useArrayProp(radius),
|
|
4690
5362
|
padding: useArrayProp(padding),
|
|
4691
5363
|
ref,
|
|
4692
|
-
children: /* @__PURE__ */jsxRuntime.jsx(
|
|
5364
|
+
children: /* @__PURE__ */jsxRuntime.jsx(Text, {
|
|
4693
5365
|
size: fontSize,
|
|
5366
|
+
weight: "medium",
|
|
4694
5367
|
children
|
|
4695
5368
|
})
|
|
4696
5369
|
});
|
|
4697
5370
|
});
|
|
4698
|
-
const Root$
|
|
5371
|
+
const Root$y = styled__default.default(Box)(flexItemStyle, responsiveFlexStyle);
|
|
4699
5372
|
const Flex = react.forwardRef(function Flex2(props, ref) {
|
|
4700
5373
|
const {
|
|
4701
5374
|
align,
|
|
@@ -4709,7 +5382,7 @@ const Flex = react.forwardRef(function Flex2(props, ref) {
|
|
|
4709
5382
|
return (
|
|
4710
5383
|
// @ts-expect-error -- some dollar prefixed typings aren't inferred correctly https://github.com/styled-components/styled-components/issues/4062
|
|
4711
5384
|
/* @__PURE__ */
|
|
4712
|
-
jsxRuntime.jsx(Root$
|
|
5385
|
+
jsxRuntime.jsx(Root$y, {
|
|
4713
5386
|
"data-ui": "Flex",
|
|
4714
5387
|
...restProps,
|
|
4715
5388
|
$align: useArrayProp(align),
|
|
@@ -4722,16 +5395,16 @@ const Flex = react.forwardRef(function Flex2(props, ref) {
|
|
|
4722
5395
|
})
|
|
4723
5396
|
);
|
|
4724
5397
|
});
|
|
4725
|
-
var __freeze$
|
|
4726
|
-
var __defProp$
|
|
4727
|
-
var __template$
|
|
4728
|
-
value: __freeze$
|
|
5398
|
+
var __freeze$y = Object.freeze;
|
|
5399
|
+
var __defProp$z = Object.defineProperty;
|
|
5400
|
+
var __template$y = (cooked, raw) => __freeze$y(__defProp$z(cooked, "raw", {
|
|
5401
|
+
value: __freeze$y(raw || cooked.slice())
|
|
4729
5402
|
}));
|
|
4730
|
-
var _a$
|
|
4731
|
-
const rotate$1 = styled.keyframes(_a$
|
|
4732
|
-
const Root$
|
|
5403
|
+
var _a$y, _b$l;
|
|
5404
|
+
const rotate$1 = styled.keyframes(_a$y || (_a$y = __template$y(["\n from {\n transform: rotate(0deg);\n }\n\n to {\n transform: rotate(360deg);\n }\n"])));
|
|
5405
|
+
const Root$x = styled__default.default(Text)(_b$l || (_b$l = __template$y(["\n & > span > svg {\n animation: ", " 500ms linear infinite;\n }\n"])), rotate$1);
|
|
4733
5406
|
const Spinner = react.forwardRef(function Spinner2(props, ref) {
|
|
4734
|
-
return /* @__PURE__ */jsxRuntime.jsx(Root$
|
|
5407
|
+
return /* @__PURE__ */jsxRuntime.jsx(Root$x, {
|
|
4735
5408
|
"data-ui": "Spinner",
|
|
4736
5409
|
...props,
|
|
4737
5410
|
ref,
|
|
@@ -4769,14 +5442,17 @@ function _colorVarsStyle(base, color) {
|
|
|
4769
5442
|
"--card-hairline-hard-color": color.border
|
|
4770
5443
|
};
|
|
4771
5444
|
}
|
|
4772
|
-
var __freeze$
|
|
4773
|
-
var __defProp$
|
|
4774
|
-
var __template$
|
|
4775
|
-
value: __freeze$
|
|
5445
|
+
var __freeze$x = Object.freeze;
|
|
5446
|
+
var __defProp$y = Object.defineProperty;
|
|
5447
|
+
var __template$x = (cooked, raw) => __freeze$x(__defProp$y(cooked, "raw", {
|
|
5448
|
+
value: __freeze$x(raw || cooked.slice())
|
|
4776
5449
|
}));
|
|
4777
|
-
var _a$
|
|
4778
|
-
function buttonBaseStyles() {
|
|
4779
|
-
|
|
5450
|
+
var _a$x, _b$k;
|
|
5451
|
+
function buttonBaseStyles(_ref24) {
|
|
5452
|
+
let {
|
|
5453
|
+
$width
|
|
5454
|
+
} = _ref24;
|
|
5455
|
+
return styled.css(_b$k || (_b$k = __template$x(["\n -webkit-font-smoothing: inherit;\n appearance: none;\n display: inline-flex;\n align-items: center;\n font: inherit;\n border: 0;\n outline: none;\n user-select: none;\n text-decoration: none;\n border: 0;\n box-sizing: border-box;\n padding: 0;\n margin: 0;\n white-space: nowrap;\n text-align: left;\n position: relative;\n\n ", "\n\n & > span {\n display: block;\n flex: 1;\n min-width: 0;\n border-radius: inherit;\n }\n\n &::-moz-focus-inner {\n border: 0;\n padding: 0;\n }\n "])), $width === "fill" && styled.css(_a$x || (_a$x = __template$x(["\n width: -moz-available;\n width: -webkit-fill-available;\n width: stretch;\n "]))));
|
|
4780
5456
|
}
|
|
4781
5457
|
const buttonTheme = {
|
|
4782
5458
|
border: {
|
|
@@ -4791,7 +5467,7 @@ function combineBoxShadow() {
|
|
|
4791
5467
|
return boxShadows.filter(Boolean).join(",");
|
|
4792
5468
|
}
|
|
4793
5469
|
function buttonColorStyles(props) {
|
|
4794
|
-
var _a2,
|
|
5470
|
+
var _a2, _b2;
|
|
4795
5471
|
const {
|
|
4796
5472
|
$mode,
|
|
4797
5473
|
theme
|
|
@@ -4834,16 +5510,16 @@ function buttonColorStyles(props) {
|
|
|
4834
5510
|
},
|
|
4835
5511
|
"&[data-selected]": _colorVarsStyle(base, color.pressed)
|
|
4836
5512
|
}
|
|
4837
|
-
}, (
|
|
5513
|
+
}, (_b2 = (_a2 = theme.sanity.styles) == null ? void 0 : _a2.button) == null ? void 0 : _b2.root].filter(Boolean);
|
|
4838
5514
|
}
|
|
4839
|
-
var __freeze$
|
|
4840
|
-
var __defProp$
|
|
4841
|
-
var __template$
|
|
4842
|
-
value: __freeze$
|
|
5515
|
+
var __freeze$w = Object.freeze;
|
|
5516
|
+
var __defProp$x = Object.defineProperty;
|
|
5517
|
+
var __template$w = (cooked, raw) => __freeze$w(__defProp$x(cooked, "raw", {
|
|
5518
|
+
value: __freeze$w(raw || cooked.slice())
|
|
4843
5519
|
}));
|
|
4844
|
-
var _a$
|
|
4845
|
-
const Root$
|
|
4846
|
-
const LoadingBox = styled__default.default.div(_a$
|
|
5520
|
+
var _a$w;
|
|
5521
|
+
const Root$w = styled__default.default.button(responsiveRadiusStyle, buttonBaseStyles, buttonColorStyles);
|
|
5522
|
+
const LoadingBox = styled__default.default.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"])));
|
|
4847
5523
|
const Button = react.forwardRef(function Button2(props, ref) {
|
|
4848
5524
|
const {
|
|
4849
5525
|
children,
|
|
@@ -4869,6 +5545,7 @@ const Button = react.forwardRef(function Button2(props, ref) {
|
|
|
4869
5545
|
tone = "default",
|
|
4870
5546
|
type = "button",
|
|
4871
5547
|
muted = false,
|
|
5548
|
+
width,
|
|
4872
5549
|
...restProps
|
|
4873
5550
|
} = props;
|
|
4874
5551
|
const justify = useArrayProp(justifyProp);
|
|
@@ -4892,7 +5569,7 @@ const Button = react.forwardRef(function Button2(props, ref) {
|
|
|
4892
5569
|
paddingLeft,
|
|
4893
5570
|
paddingRight
|
|
4894
5571
|
}), [padding, paddingX, paddingY, paddingTop, paddingBottom, paddingLeft, paddingRight]);
|
|
4895
|
-
return /* @__PURE__ */jsxRuntime.jsxs(Root$
|
|
5572
|
+
return /* @__PURE__ */jsxRuntime.jsxs(Root$w, {
|
|
4896
5573
|
"data-ui": "Button",
|
|
4897
5574
|
...restProps,
|
|
4898
5575
|
$mode: mode,
|
|
@@ -4903,6 +5580,7 @@ const Button = react.forwardRef(function Button2(props, ref) {
|
|
|
4903
5580
|
disabled: Boolean(loading || disabled),
|
|
4904
5581
|
ref,
|
|
4905
5582
|
type,
|
|
5583
|
+
$width: width,
|
|
4906
5584
|
children: [Boolean(loading) && /* @__PURE__ */jsxRuntime.jsx(LoadingBox, {
|
|
4907
5585
|
children: /* @__PURE__ */jsxRuntime.jsx(Spinner, {})
|
|
4908
5586
|
}), (icon || text || iconRight) && /* @__PURE__ */jsxRuntime.jsx(Box, {
|
|
@@ -4937,12 +5615,12 @@ const Button = react.forwardRef(function Button2(props, ref) {
|
|
|
4937
5615
|
})]
|
|
4938
5616
|
});
|
|
4939
5617
|
});
|
|
4940
|
-
var __freeze$
|
|
4941
|
-
var __defProp$
|
|
4942
|
-
var __template$
|
|
4943
|
-
value: __freeze$
|
|
5618
|
+
var __freeze$v = Object.freeze;
|
|
5619
|
+
var __defProp$w = Object.defineProperty;
|
|
5620
|
+
var __template$v = (cooked, raw) => __freeze$v(__defProp$w(cooked, "raw", {
|
|
5621
|
+
value: __freeze$v(raw || cooked.slice())
|
|
4944
5622
|
}));
|
|
4945
|
-
var _a$
|
|
5623
|
+
var _a$v, _b$j, _c$b;
|
|
4946
5624
|
function cardStyle(props) {
|
|
4947
5625
|
return [cardBaseStyle(props), cardColorStyle(props)];
|
|
4948
5626
|
}
|
|
@@ -4952,7 +5630,7 @@ function cardBaseStyle(props) {
|
|
|
4952
5630
|
theme
|
|
4953
5631
|
} = props;
|
|
4954
5632
|
const space = theme.sanity.space;
|
|
4955
|
-
return styled.css(_b$
|
|
5633
|
+
return styled.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 && styled.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]));
|
|
4956
5634
|
}
|
|
4957
5635
|
function cardColorStyle(props) {
|
|
4958
5636
|
var _a2, _b2;
|
|
@@ -4973,7 +5651,7 @@ function cardColorStyle(props) {
|
|
|
4973
5651
|
width: 0,
|
|
4974
5652
|
color: "var(--card-border-color)"
|
|
4975
5653
|
};
|
|
4976
|
-
return styled.css(_c$
|
|
5654
|
+
return styled.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({
|
|
4977
5655
|
base,
|
|
4978
5656
|
border,
|
|
4979
5657
|
focusRing
|
|
@@ -4983,7 +5661,7 @@ function cardColorStyle(props) {
|
|
|
4983
5661
|
focusRing
|
|
4984
5662
|
}) : void 0, $focusRing ? focusRingBorderStyle(border) : void 0, (_b2 = (_a2 = theme.sanity.styles) == null ? void 0 : _a2.card) == null ? void 0 : _b2.root);
|
|
4985
5663
|
}
|
|
4986
|
-
const Root$
|
|
5664
|
+
const Root$v = styled__default.default(Box)(responsiveBorderStyle, responsiveRadiusStyle, responsiveShadowStyle, cardStyle);
|
|
4987
5665
|
const Card = react.forwardRef(function Card2(props, ref) {
|
|
4988
5666
|
const {
|
|
4989
5667
|
__unstable_checkered: checkered = false,
|
|
@@ -5008,7 +5686,7 @@ const Card = react.forwardRef(function Card2(props, ref) {
|
|
|
5008
5686
|
return /* @__PURE__ */jsxRuntime.jsx(ThemeColorProvider, {
|
|
5009
5687
|
scheme,
|
|
5010
5688
|
tone,
|
|
5011
|
-
children: /* @__PURE__ */jsxRuntime.jsx(Root$
|
|
5689
|
+
children: /* @__PURE__ */jsxRuntime.jsx(Root$v, {
|
|
5012
5690
|
"data-as": typeof as === "string" ? as : void 0,
|
|
5013
5691
|
"data-scheme": rootTheme.scheme,
|
|
5014
5692
|
"data-ui": "Card",
|
|
@@ -5033,14 +5711,14 @@ const Card = react.forwardRef(function Card2(props, ref) {
|
|
|
5033
5711
|
})
|
|
5034
5712
|
});
|
|
5035
5713
|
});
|
|
5036
|
-
var __freeze$
|
|
5037
|
-
var __defProp$
|
|
5038
|
-
var __template$
|
|
5039
|
-
value: __freeze$
|
|
5714
|
+
var __freeze$u = Object.freeze;
|
|
5715
|
+
var __defProp$v = Object.defineProperty;
|
|
5716
|
+
var __template$u = (cooked, raw) => __freeze$u(__defProp$v(cooked, "raw", {
|
|
5717
|
+
value: __freeze$u(raw || cooked.slice())
|
|
5040
5718
|
}));
|
|
5041
|
-
var _a$
|
|
5719
|
+
var _a$u, _b$i;
|
|
5042
5720
|
function checkboxBaseStyles() {
|
|
5043
|
-
return styled.css(_a$
|
|
5721
|
+
return styled.css(_a$u || (_a$u = __template$u(["\n position: relative;\n display: inline-block;\n "])));
|
|
5044
5722
|
}
|
|
5045
5723
|
function inputElementStyles(props) {
|
|
5046
5724
|
const {
|
|
@@ -5054,7 +5732,7 @@ function inputElementStyles(props) {
|
|
|
5054
5732
|
const {
|
|
5055
5733
|
focusRing
|
|
5056
5734
|
} = input.checkbox;
|
|
5057
|
-
return styled.css(_b$
|
|
5735
|
+
return styled.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({
|
|
5058
5736
|
color: color.default.enabled.border,
|
|
5059
5737
|
width: input.border.width
|
|
5060
5738
|
}), rem(radius[2]), color.default.enabled.bg, color.default.enabled.bg2, focusRingBorderStyle({
|
|
@@ -5087,7 +5765,7 @@ function inputElementStyles(props) {
|
|
|
5087
5765
|
color: color.default.readOnly.border
|
|
5088
5766
|
}), color.default.readOnly.fg, color.default.readOnly.bg2);
|
|
5089
5767
|
}
|
|
5090
|
-
const Root$
|
|
5768
|
+
const Root$u = styled__default.default.div(checkboxBaseStyles);
|
|
5091
5769
|
const Input$5 = styled__default.default.input(inputElementStyles);
|
|
5092
5770
|
const Checkbox = react.forwardRef(function Checkbox2(props, forwardedRef) {
|
|
5093
5771
|
const {
|
|
@@ -5107,7 +5785,7 @@ const Checkbox = react.forwardRef(function Checkbox2(props, forwardedRef) {
|
|
|
5107
5785
|
ref.current.indeterminate = indeterminate || false;
|
|
5108
5786
|
}
|
|
5109
5787
|
}, [indeterminate, ref]);
|
|
5110
|
-
return /* @__PURE__ */jsxRuntime.jsxs(Root$
|
|
5788
|
+
return /* @__PURE__ */jsxRuntime.jsxs(Root$u, {
|
|
5111
5789
|
className,
|
|
5112
5790
|
"data-ui": "Checkbox",
|
|
5113
5791
|
style,
|
|
@@ -5125,16 +5803,16 @@ const Checkbox = react.forwardRef(function Checkbox2(props, forwardedRef) {
|
|
|
5125
5803
|
})]
|
|
5126
5804
|
});
|
|
5127
5805
|
});
|
|
5128
|
-
var __freeze$
|
|
5129
|
-
var __defProp$
|
|
5130
|
-
var __template$
|
|
5131
|
-
value: __freeze$
|
|
5806
|
+
var __freeze$t = Object.freeze;
|
|
5807
|
+
var __defProp$u = Object.defineProperty;
|
|
5808
|
+
var __template$t = (cooked, raw) => __freeze$t(__defProp$u(cooked, "raw", {
|
|
5809
|
+
value: __freeze$t(raw || cooked.slice())
|
|
5132
5810
|
}));
|
|
5133
|
-
var _a$
|
|
5134
|
-
function codeSyntaxHighlightingStyle(
|
|
5811
|
+
var _a$t;
|
|
5812
|
+
function codeSyntaxHighlightingStyle(_ref25) {
|
|
5135
5813
|
let {
|
|
5136
5814
|
theme
|
|
5137
|
-
} =
|
|
5815
|
+
} = _ref25;
|
|
5138
5816
|
const color = theme.sanity.color.syntax;
|
|
5139
5817
|
return {
|
|
5140
5818
|
"&.atrule": {
|
|
@@ -5248,9 +5926,9 @@ function codeSyntaxHighlightingStyle(_ref20) {
|
|
|
5248
5926
|
};
|
|
5249
5927
|
}
|
|
5250
5928
|
function codeBaseStyle() {
|
|
5251
|
-
return styled.css(_a$
|
|
5929
|
+
return styled.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);
|
|
5252
5930
|
}
|
|
5253
|
-
const Root$
|
|
5931
|
+
const Root$t = styled__default.default.pre(codeBaseStyle, responsiveCodeFontStyle);
|
|
5254
5932
|
const Code = react.forwardRef(function Code2(props, ref) {
|
|
5255
5933
|
const {
|
|
5256
5934
|
children,
|
|
@@ -5261,7 +5939,7 @@ const Code = react.forwardRef(function Code2(props, ref) {
|
|
|
5261
5939
|
} = props;
|
|
5262
5940
|
const language = typeof languageProp === "string" ? languageProp : void 0;
|
|
5263
5941
|
const registered = language ? Refractor__default.default.hasLanguage(language) : false;
|
|
5264
|
-
return /* @__PURE__ */jsxRuntime.jsxs(Root$
|
|
5942
|
+
return /* @__PURE__ */jsxRuntime.jsxs(Root$t, {
|
|
5265
5943
|
"data-ui": "Code",
|
|
5266
5944
|
...restProps,
|
|
5267
5945
|
$size: useArrayProp(size),
|
|
@@ -5295,14 +5973,14 @@ function responsiveContainerWidthStyle(props) {
|
|
|
5295
5973
|
maxWidth: val === "auto" ? "none" : rem(container[val])
|
|
5296
5974
|
}));
|
|
5297
5975
|
}
|
|
5298
|
-
const Root$
|
|
5976
|
+
const Root$s = styled__default.default(Box)(containerBaseStyle, responsiveContainerWidthStyle);
|
|
5299
5977
|
const Container = react.forwardRef(function Container2(props, ref) {
|
|
5300
5978
|
const {
|
|
5301
5979
|
as,
|
|
5302
5980
|
width = 2,
|
|
5303
5981
|
...restProps
|
|
5304
5982
|
} = props;
|
|
5305
|
-
return /* @__PURE__ */jsxRuntime.jsx(Root$
|
|
5983
|
+
return /* @__PURE__ */jsxRuntime.jsx(Root$s, {
|
|
5306
5984
|
"data-ui": "Container",
|
|
5307
5985
|
...restProps,
|
|
5308
5986
|
$width: useArrayProp(width),
|
|
@@ -5310,7 +5988,7 @@ const Container = react.forwardRef(function Container2(props, ref) {
|
|
|
5310
5988
|
ref
|
|
5311
5989
|
});
|
|
5312
5990
|
});
|
|
5313
|
-
const Root$
|
|
5991
|
+
const Root$r = styled__default.default(Box)(responsiveGridStyle);
|
|
5314
5992
|
const Grid = react.forwardRef(function Grid2(props, ref) {
|
|
5315
5993
|
const {
|
|
5316
5994
|
as,
|
|
@@ -5325,7 +6003,7 @@ const Grid = react.forwardRef(function Grid2(props, ref) {
|
|
|
5325
6003
|
children,
|
|
5326
6004
|
...restProps
|
|
5327
6005
|
} = props;
|
|
5328
|
-
return /* @__PURE__ */jsxRuntime.jsx(Root$
|
|
6006
|
+
return /* @__PURE__ */jsxRuntime.jsx(Root$r, {
|
|
5329
6007
|
"data-as": typeof as === "string" ? as : void 0,
|
|
5330
6008
|
"data-ui": "Grid",
|
|
5331
6009
|
...restProps,
|
|
@@ -5342,28 +6020,28 @@ const Grid = react.forwardRef(function Grid2(props, ref) {
|
|
|
5342
6020
|
children
|
|
5343
6021
|
});
|
|
5344
6022
|
});
|
|
5345
|
-
var __freeze$
|
|
5346
|
-
var __defProp$
|
|
5347
|
-
var __template$
|
|
5348
|
-
value: __freeze$
|
|
6023
|
+
var __freeze$s = Object.freeze;
|
|
6024
|
+
var __defProp$t = Object.defineProperty;
|
|
6025
|
+
var __template$s = (cooked, raw) => __freeze$s(__defProp$t(cooked, "raw", {
|
|
6026
|
+
value: __freeze$s(raw || cooked.slice())
|
|
5349
6027
|
}));
|
|
5350
|
-
var _a$
|
|
6028
|
+
var _a$s, _b$h, _c$a;
|
|
5351
6029
|
function headingBaseStyle(props) {
|
|
5352
6030
|
const {
|
|
5353
6031
|
$accent,
|
|
5354
6032
|
$muted,
|
|
5355
6033
|
theme
|
|
5356
6034
|
} = props;
|
|
5357
|
-
return styled.css(_c$
|
|
6035
|
+
return styled.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 && styled.css(_a$s || (_a$s = __template$s(["\n color: var(--card-accent-fg-color);\n "]))), $muted && styled.css(_b$h || (_b$h = __template$s(["\n color: var(--card-muted-fg-color);\n "]))), theme.sanity.fonts.code.family);
|
|
5358
6036
|
}
|
|
5359
|
-
var __freeze$
|
|
5360
|
-
var __defProp$
|
|
5361
|
-
var __template$
|
|
5362
|
-
value: __freeze$
|
|
6037
|
+
var __freeze$r = Object.freeze;
|
|
6038
|
+
var __defProp$s = Object.defineProperty;
|
|
6039
|
+
var __template$r = (cooked, raw) => __freeze$r(__defProp$s(cooked, "raw", {
|
|
6040
|
+
value: __freeze$r(raw || cooked.slice())
|
|
5363
6041
|
}));
|
|
5364
|
-
var _a$
|
|
5365
|
-
const Root$
|
|
5366
|
-
const SpanWithTextOverflow = styled__default.default.span(_a$
|
|
6042
|
+
var _a$r;
|
|
6043
|
+
const Root$q = styled__default.default.div(headingBaseStyle, responsiveTextAlignStyle, responsiveHeadingFont);
|
|
6044
|
+
const SpanWithTextOverflow$1 = styled__default.default.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"])));
|
|
5367
6045
|
const Heading = react.forwardRef(function Heading2(props, ref) {
|
|
5368
6046
|
const {
|
|
5369
6047
|
accent = false,
|
|
@@ -5377,11 +6055,11 @@ const Heading = react.forwardRef(function Heading2(props, ref) {
|
|
|
5377
6055
|
} = props;
|
|
5378
6056
|
let children = childrenProp;
|
|
5379
6057
|
if (textOverflow === "ellipsis") {
|
|
5380
|
-
children = /* @__PURE__ */jsxRuntime.jsx(SpanWithTextOverflow, {
|
|
6058
|
+
children = /* @__PURE__ */jsxRuntime.jsx(SpanWithTextOverflow$1, {
|
|
5381
6059
|
children
|
|
5382
6060
|
});
|
|
5383
6061
|
}
|
|
5384
|
-
return /* @__PURE__ */jsxRuntime.jsx(Root$
|
|
6062
|
+
return /* @__PURE__ */jsxRuntime.jsx(Root$q, {
|
|
5385
6063
|
"data-ui": "Heading",
|
|
5386
6064
|
...restProps,
|
|
5387
6065
|
$accent: accent,
|
|
@@ -5421,7 +6099,7 @@ function inlineSpaceStyle(props) {
|
|
|
5421
6099
|
};
|
|
5422
6100
|
});
|
|
5423
6101
|
}
|
|
5424
|
-
const Root$
|
|
6102
|
+
const Root$p = styled__default.default(Box)(inlineBaseStyle, inlineSpaceStyle);
|
|
5425
6103
|
const Inline = react.forwardRef(function Inline2(props, ref) {
|
|
5426
6104
|
const {
|
|
5427
6105
|
as,
|
|
@@ -5432,7 +6110,7 @@ const Inline = react.forwardRef(function Inline2(props, ref) {
|
|
|
5432
6110
|
const children = react.useMemo(() => childrenToElementArray(childrenProp).filter(Boolean).map((child, idx) => /* @__PURE__ */jsxRuntime.jsx("div", {
|
|
5433
6111
|
children: child
|
|
5434
6112
|
}, idx)), [childrenProp]);
|
|
5435
|
-
return /* @__PURE__ */jsxRuntime.jsx(Root$
|
|
6113
|
+
return /* @__PURE__ */jsxRuntime.jsx(Root$p, {
|
|
5436
6114
|
"data-ui": "Inline",
|
|
5437
6115
|
...restProps,
|
|
5438
6116
|
$space: useArrayProp(space),
|
|
@@ -5441,16 +6119,16 @@ const Inline = react.forwardRef(function Inline2(props, ref) {
|
|
|
5441
6119
|
children
|
|
5442
6120
|
});
|
|
5443
6121
|
});
|
|
5444
|
-
var __freeze$
|
|
5445
|
-
var __defProp$
|
|
5446
|
-
var __template$
|
|
5447
|
-
value: __freeze$
|
|
6122
|
+
var __freeze$q = Object.freeze;
|
|
6123
|
+
var __defProp$r = Object.defineProperty;
|
|
6124
|
+
var __template$q = (cooked, raw) => __freeze$q(__defProp$r(cooked, "raw", {
|
|
6125
|
+
value: __freeze$q(raw || cooked.slice())
|
|
5448
6126
|
}));
|
|
5449
|
-
var _a$
|
|
6127
|
+
var _a$q;
|
|
5450
6128
|
function kbdStyle() {
|
|
5451
|
-
return styled.css(_a$
|
|
6129
|
+
return styled.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 "])));
|
|
5452
6130
|
}
|
|
5453
|
-
const Root$
|
|
6131
|
+
const Root$o = styled__default.default.kbd(responsiveRadiusStyle, kbdStyle);
|
|
5454
6132
|
const KBD = react.forwardRef(function KBD2(props, ref) {
|
|
5455
6133
|
const {
|
|
5456
6134
|
children,
|
|
@@ -5459,7 +6137,7 @@ const KBD = react.forwardRef(function KBD2(props, ref) {
|
|
|
5459
6137
|
radius = 2,
|
|
5460
6138
|
...restProps
|
|
5461
6139
|
} = props;
|
|
5462
|
-
return /* @__PURE__ */jsxRuntime.jsx(Root$
|
|
6140
|
+
return /* @__PURE__ */jsxRuntime.jsx(Root$o, {
|
|
5463
6141
|
"data-ui": "KBD",
|
|
5464
6142
|
...restProps,
|
|
5465
6143
|
$radius: useArrayProp(radius),
|
|
@@ -5477,6 +6155,64 @@ const KBD = react.forwardRef(function KBD2(props, ref) {
|
|
|
5477
6155
|
})
|
|
5478
6156
|
});
|
|
5479
6157
|
});
|
|
6158
|
+
var __freeze$p = Object.freeze;
|
|
6159
|
+
var __defProp$q = Object.defineProperty;
|
|
6160
|
+
var __template$p = (cooked, raw) => __freeze$p(__defProp$q(cooked, "raw", {
|
|
6161
|
+
value: __freeze$p(raw || cooked.slice())
|
|
6162
|
+
}));
|
|
6163
|
+
var _a$p, _b$g, _c$9;
|
|
6164
|
+
function labelBaseStyle(props) {
|
|
6165
|
+
const {
|
|
6166
|
+
$accent,
|
|
6167
|
+
$muted,
|
|
6168
|
+
theme
|
|
6169
|
+
} = props;
|
|
6170
|
+
const {
|
|
6171
|
+
fonts
|
|
6172
|
+
} = theme.sanity;
|
|
6173
|
+
return styled.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 && styled.css(_a$p || (_a$p = __template$p(["\n color: var(--card-accent-fg-color);\n "]))), $muted && styled.css(_b$g || (_b$g = __template$p(["\n color: var(--card-muted-fg-color);\n "]))), fonts.code.family);
|
|
6174
|
+
}
|
|
6175
|
+
var __freeze$o = Object.freeze;
|
|
6176
|
+
var __defProp$p = Object.defineProperty;
|
|
6177
|
+
var __template$o = (cooked, raw) => __freeze$o(__defProp$p(cooked, "raw", {
|
|
6178
|
+
value: __freeze$o(raw || cooked.slice())
|
|
6179
|
+
}));
|
|
6180
|
+
var _a$o;
|
|
6181
|
+
const Root$n = styled__default.default.div(responsiveLabelFont, responsiveTextAlignStyle, labelBaseStyle);
|
|
6182
|
+
const SpanWithTextOverflow = styled__default.default.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"])));
|
|
6183
|
+
const Label = react.forwardRef(function Label2(props, ref) {
|
|
6184
|
+
const {
|
|
6185
|
+
accent,
|
|
6186
|
+
align,
|
|
6187
|
+
children: childrenProp,
|
|
6188
|
+
muted = false,
|
|
6189
|
+
size = 2,
|
|
6190
|
+
textOverflow,
|
|
6191
|
+
weight,
|
|
6192
|
+
...restProps
|
|
6193
|
+
} = props;
|
|
6194
|
+
let children = childrenProp;
|
|
6195
|
+
if (textOverflow === "ellipsis") {
|
|
6196
|
+
children = /* @__PURE__ */jsxRuntime.jsx(SpanWithTextOverflow, {
|
|
6197
|
+
children
|
|
6198
|
+
});
|
|
6199
|
+
} else {
|
|
6200
|
+
children = /* @__PURE__ */jsxRuntime.jsx("span", {
|
|
6201
|
+
children
|
|
6202
|
+
});
|
|
6203
|
+
}
|
|
6204
|
+
return /* @__PURE__ */jsxRuntime.jsx(Root$n, {
|
|
6205
|
+
"data-ui": "Label",
|
|
6206
|
+
...restProps,
|
|
6207
|
+
$accent: accent,
|
|
6208
|
+
$align: useArrayProp(align),
|
|
6209
|
+
$muted: muted,
|
|
6210
|
+
$size: useArrayProp(size),
|
|
6211
|
+
$weight: weight,
|
|
6212
|
+
ref,
|
|
6213
|
+
children
|
|
6214
|
+
});
|
|
6215
|
+
});
|
|
5480
6216
|
const key$7 = Symbol.for("@sanity/ui/context/boundaryElement");
|
|
5481
6217
|
globalScope[key$7] = globalScope[key$7] || react.createContext(null);
|
|
5482
6218
|
const BoundaryElementContext = globalScope[key$7];
|
|
@@ -6384,13 +7120,13 @@ const Popover = react.memo(react.forwardRef(function Popover2(props, ref) {
|
|
|
6384
7120
|
}));
|
|
6385
7121
|
if (constrainSize || matchReferenceWidth) {
|
|
6386
7122
|
ret.push(size({
|
|
6387
|
-
apply(
|
|
7123
|
+
apply(_ref26) {
|
|
6388
7124
|
let {
|
|
6389
7125
|
availableWidth,
|
|
6390
7126
|
availableHeight,
|
|
6391
7127
|
elements,
|
|
6392
7128
|
referenceWidth
|
|
6393
|
-
} =
|
|
7129
|
+
} = _ref26;
|
|
6394
7130
|
referenceWidthRef.current = referenceWidth;
|
|
6395
7131
|
const _currentWidth = widthRef.current;
|
|
6396
7132
|
const _maxWidth = maxWidthRef.current;
|
|
@@ -6592,7 +7328,7 @@ var __template$j = (cooked, raw) => __freeze$j(__defProp$j(cooked, "raw", {
|
|
|
6592
7328
|
}));
|
|
6593
7329
|
var _a$j, _b$c, _c$7, _d$5;
|
|
6594
7330
|
function rootStyle() {
|
|
6595
|
-
return styled.css(_a$j || (_a$j = __template$j(["\n position: relative;\n width: stretch;\n\n &:not([hidden]) {\n display: inline-block;\n }\n "])));
|
|
7331
|
+
return styled.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 "])));
|
|
6596
7332
|
}
|
|
6597
7333
|
function inputBaseStyle(props) {
|
|
6598
7334
|
const {
|
|
@@ -6855,7 +7591,7 @@ const TextArea = react.forwardRef(function TextArea2(props, forwardedRef) {
|
|
|
6855
7591
|
disabled = false,
|
|
6856
7592
|
fontSize = 2,
|
|
6857
7593
|
padding = 3,
|
|
6858
|
-
radius =
|
|
7594
|
+
radius = 2,
|
|
6859
7595
|
weight,
|
|
6860
7596
|
...restProps
|
|
6861
7597
|
} = props;
|
|
@@ -6920,6 +7656,7 @@ const TextInputClearButton = styled__default.default(Button)({
|
|
|
6920
7656
|
});
|
|
6921
7657
|
const TextInput = react.forwardRef(function TextInput2(props, forwardedRef) {
|
|
6922
7658
|
const {
|
|
7659
|
+
__unstable_disableFocusRing,
|
|
6923
7660
|
border = true,
|
|
6924
7661
|
clearButton,
|
|
6925
7662
|
disabled = false,
|
|
@@ -6929,7 +7666,7 @@ const TextInput = react.forwardRef(function TextInput2(props, forwardedRef) {
|
|
|
6929
7666
|
onClear,
|
|
6930
7667
|
padding: paddingProp = 3,
|
|
6931
7668
|
prefix,
|
|
6932
|
-
radius: radiusProp =
|
|
7669
|
+
radius: radiusProp = 2,
|
|
6933
7670
|
readOnly,
|
|
6934
7671
|
space: spaceProp = 3,
|
|
6935
7672
|
suffix,
|
|
@@ -6974,6 +7711,7 @@ const TextInput = react.forwardRef(function TextInput2(props, forwardedRef) {
|
|
|
6974
7711
|
}), [prefix, radius]);
|
|
6975
7712
|
const presentationNode = react.useMemo(() => /* @__PURE__ */jsxRuntime.jsxs(Presentation, {
|
|
6976
7713
|
$hasPrefix,
|
|
7714
|
+
$unstableDisableFocusRing: __unstable_disableFocusRing,
|
|
6977
7715
|
$hasSuffix,
|
|
6978
7716
|
$radius: radius,
|
|
6979
7717
|
$scheme: rootTheme.scheme,
|
|
@@ -6994,7 +7732,7 @@ const TextInput = react.forwardRef(function TextInput2(props, forwardedRef) {
|
|
|
6994
7732
|
children: [react.isValidElement(iconRight) && iconRight, ReactIs.isValidElementType(iconRight) && react.createElement(iconRight)]
|
|
6995
7733
|
})
|
|
6996
7734
|
})]
|
|
6997
|
-
}), [border, fontSize, icon, iconRight, padding, radius, rootTheme, $hasClearButton, $hasPrefix, $hasSuffix]);
|
|
7735
|
+
}), [__unstable_disableFocusRing, border, fontSize, icon, iconRight, padding, radius, rootTheme, $hasClearButton, $hasPrefix, $hasSuffix]);
|
|
6998
7736
|
const clearButtonBoxPadding = react.useMemo(() => padding.map(v => {
|
|
6999
7737
|
if (v === 0) return 0;
|
|
7000
7738
|
if (v === 1) return 1;
|
|
@@ -7078,6 +7816,7 @@ function useDelayedState(initialState) {
|
|
|
7078
7816
|
}, []);
|
|
7079
7817
|
return [state, onStateChange];
|
|
7080
7818
|
}
|
|
7819
|
+
const DEFAULT_TOOLTIP_PADDING = 4;
|
|
7081
7820
|
const DEFAULT_FALLBACK_PLACEMENTS = {
|
|
7082
7821
|
top: ["bottom", "left", "right"],
|
|
7083
7822
|
"top-start": ["bottom-start", "left-start", "right-start"],
|
|
@@ -7161,9 +7900,14 @@ var __template$e = (cooked, raw) => __freeze$e(__defProp$e(cooked, "raw", {
|
|
|
7161
7900
|
value: __freeze$e(raw || cooked.slice())
|
|
7162
7901
|
}));
|
|
7163
7902
|
var _a$e;
|
|
7164
|
-
const Root$a = styled__default.default(Layer)(_a$e || (_a$e = __template$e(["\n pointer-events: none;\n"]))
|
|
7903
|
+
const Root$a = styled__default.default(Layer)(_a$e || (_a$e = __template$e(["\n pointer-events: none;\n max-width: ", "px;\n"])), _ref27 => {
|
|
7904
|
+
let {
|
|
7905
|
+
$maxWidth
|
|
7906
|
+
} = _ref27;
|
|
7907
|
+
return $maxWidth;
|
|
7908
|
+
});
|
|
7165
7909
|
const Tooltip = react.forwardRef(function Tooltip2(props, ref) {
|
|
7166
|
-
var _a2, _b, _c, _d, _e;
|
|
7910
|
+
var _a2, _b, _c, _d, _e, _f;
|
|
7167
7911
|
const boundaryElementContext = useBoundaryElement();
|
|
7168
7912
|
const theme = useTheme();
|
|
7169
7913
|
const {
|
|
@@ -7174,7 +7918,7 @@ const Tooltip = react.forwardRef(function Tooltip2(props, ref) {
|
|
|
7174
7918
|
fallbackPlacements: fallbackPlacementsProp = (_b = props.fallbackPlacements) != null ? _b : DEFAULT_FALLBACK_PLACEMENTS[(_a2 = props.placement) != null ? _a2 : "bottom"],
|
|
7175
7919
|
padding = 3,
|
|
7176
7920
|
placement: placementProp = "bottom",
|
|
7177
|
-
portal,
|
|
7921
|
+
portal: portalProp,
|
|
7178
7922
|
scheme,
|
|
7179
7923
|
shadow = 2,
|
|
7180
7924
|
zOffset = (_c = theme.sanity.layer) == null ? void 0 : _c.tooltip.zOffset,
|
|
@@ -7186,38 +7930,27 @@ const Tooltip = react.forwardRef(function Tooltip2(props, ref) {
|
|
|
7186
7930
|
const [referenceElement, setReferenceElement] = react.useState(null);
|
|
7187
7931
|
const arrowRef = react.useRef(null);
|
|
7188
7932
|
const rootBoundary = "viewport";
|
|
7933
|
+
const portal = usePortal();
|
|
7934
|
+
const portalElement = typeof portalProp === "string" ? ((_d = portal.elements) == null ? void 0 : _d[portalProp]) || null : portal.element;
|
|
7935
|
+
const tooltipWidth = react.useMemo(() => {
|
|
7936
|
+
const availableWidths = [...(boundaryElement ? [boundaryElement.offsetWidth] : []), (portalElement == null ? void 0 : portalElement.offsetWidth) || document.body.offsetWidth];
|
|
7937
|
+
return Math.min(...availableWidths) - DEFAULT_TOOLTIP_PADDING * 2;
|
|
7938
|
+
}, [boundaryElement, portalElement == null ? void 0 : portalElement.offsetWidth]);
|
|
7189
7939
|
const middleware = react.useMemo(() => {
|
|
7190
7940
|
const ret = [];
|
|
7191
7941
|
ret.push(reactDom$1.flip({
|
|
7192
7942
|
boundary: boundaryElement || void 0,
|
|
7193
7943
|
fallbackPlacements,
|
|
7194
|
-
padding:
|
|
7195
|
-
rootBoundary
|
|
7196
|
-
mainAxis: false
|
|
7944
|
+
padding: DEFAULT_TOOLTIP_PADDING,
|
|
7945
|
+
rootBoundary
|
|
7197
7946
|
}));
|
|
7198
7947
|
ret.push(reactDom$1.offset({
|
|
7199
7948
|
mainAxis: 3
|
|
7200
7949
|
}));
|
|
7201
|
-
ret.push(reactDom$1.size({
|
|
7202
|
-
apply(_ref22) {
|
|
7203
|
-
let {
|
|
7204
|
-
availableWidth,
|
|
7205
|
-
availableHeight,
|
|
7206
|
-
elements
|
|
7207
|
-
} = _ref22;
|
|
7208
|
-
Object.assign(elements.floating.style, {
|
|
7209
|
-
maxWidth: "".concat(availableWidth - 4 * 2, "px"),
|
|
7210
|
-
// the padding is `4px`
|
|
7211
|
-
maxHeight: "".concat(availableHeight - 4 * 2, "px")
|
|
7212
|
-
// the padding is `4px`
|
|
7213
|
-
});
|
|
7214
|
-
}
|
|
7215
|
-
}));
|
|
7216
|
-
|
|
7217
7950
|
ret.push(reactDom$1.shift({
|
|
7218
7951
|
boundary: boundaryElement || void 0,
|
|
7219
7952
|
rootBoundary,
|
|
7220
|
-
padding:
|
|
7953
|
+
padding: DEFAULT_TOOLTIP_PADDING
|
|
7221
7954
|
}));
|
|
7222
7955
|
ret.push(reactDom$1.arrow({
|
|
7223
7956
|
element: arrowRef,
|
|
@@ -7237,8 +7970,8 @@ const Tooltip = react.forwardRef(function Tooltip2(props, ref) {
|
|
|
7237
7970
|
whileElementsMounted: reactDom$1.autoUpdate
|
|
7238
7971
|
});
|
|
7239
7972
|
const staticSide = placement && FLOATING_STATIC_SIDES[placement.split("-")[0]];
|
|
7240
|
-
const arrowX = (
|
|
7241
|
-
const arrowY = (
|
|
7973
|
+
const arrowX = (_e = middlewareData.arrow) == null ? void 0 : _e.x;
|
|
7974
|
+
const arrowY = (_f = middlewareData.arrow) == null ? void 0 : _f.y;
|
|
7242
7975
|
const arrowStyle = react.useMemo(() => {
|
|
7243
7976
|
const style = {
|
|
7244
7977
|
left: arrowX !== null ? arrowX : void 0,
|
|
@@ -7258,25 +7991,53 @@ const Tooltip = react.forwardRef(function Tooltip2(props, ref) {
|
|
|
7258
7991
|
const closeDelayProp = typeof delay === "number" ? delay : (delay == null ? void 0 : delay.close) || 0;
|
|
7259
7992
|
const openDelay = isInsideGroup ? delayGroupContext.openDelay : openDelayProp;
|
|
7260
7993
|
const closeDelay = isInsideGroup ? delayGroupContext.closeDelay : closeDelayProp;
|
|
7261
|
-
const handleIsOpenChange = react.useCallback(open => {
|
|
7994
|
+
const handleIsOpenChange = react.useCallback((open, immediate) => {
|
|
7262
7995
|
if (isInsideGroup) {
|
|
7263
7996
|
if (open) {
|
|
7264
|
-
|
|
7265
|
-
delayGroupContext.
|
|
7997
|
+
const groupedOpenDelay = immediate ? 0 : openDelay;
|
|
7998
|
+
delayGroupContext.setIsGroupActive(open, groupedOpenDelay);
|
|
7999
|
+
delayGroupContext.setOpenTooltipId(tooltipId, groupedOpenDelay);
|
|
7266
8000
|
} else {
|
|
7267
8001
|
const minimumGroupDeactivateDelay = 200;
|
|
7268
8002
|
const groupDeactivateDelay = closeDelay > minimumGroupDeactivateDelay ? closeDelay : minimumGroupDeactivateDelay;
|
|
7269
8003
|
delayGroupContext.setIsGroupActive(open, groupDeactivateDelay);
|
|
7270
|
-
delayGroupContext.setOpenTooltipId(null, closeDelay);
|
|
8004
|
+
delayGroupContext.setOpenTooltipId(null, immediate ? 0 : closeDelay);
|
|
7271
8005
|
}
|
|
7272
8006
|
} else {
|
|
7273
|
-
|
|
8007
|
+
const standaloneDelay = immediate ? 0 : open ? openDelay : closeDelay;
|
|
8008
|
+
setIsOpen(open, standaloneDelay);
|
|
7274
8009
|
}
|
|
7275
8010
|
}, [isInsideGroup, delayGroupContext, openDelay, tooltipId, closeDelay, setIsOpen]);
|
|
7276
|
-
const handleBlur = react.useCallback(
|
|
7277
|
-
|
|
7278
|
-
|
|
7279
|
-
|
|
8011
|
+
const handleBlur = react.useCallback(e => {
|
|
8012
|
+
var _a3, _b2;
|
|
8013
|
+
handleIsOpenChange(false);
|
|
8014
|
+
(_b2 = (_a3 = childProp == null ? void 0 : childProp.props) == null ? void 0 : _a3.onBlur) == null ? void 0 : _b2.call(_a3, e);
|
|
8015
|
+
}, [childProp == null ? void 0 : childProp.props, handleIsOpenChange]);
|
|
8016
|
+
const handleClick = react.useCallback(e => {
|
|
8017
|
+
var _a3, _b2;
|
|
8018
|
+
handleIsOpenChange(false, true);
|
|
8019
|
+
(_b2 = childProp == null ? void 0 : (_a3 = childProp.props).onClick) == null ? void 0 : _b2.call(_a3, e);
|
|
8020
|
+
}, [childProp == null ? void 0 : childProp.props, handleIsOpenChange]);
|
|
8021
|
+
const handleContextMenu = react.useCallback(e => {
|
|
8022
|
+
var _a3, _b2;
|
|
8023
|
+
handleIsOpenChange(false, true);
|
|
8024
|
+
(_b2 = childProp == null ? void 0 : (_a3 = childProp.props).onContextMenu) == null ? void 0 : _b2.call(_a3, e);
|
|
8025
|
+
}, [childProp == null ? void 0 : childProp.props, handleIsOpenChange]);
|
|
8026
|
+
const handleFocus = react.useCallback(e => {
|
|
8027
|
+
var _a3, _b2;
|
|
8028
|
+
handleIsOpenChange(true);
|
|
8029
|
+
(_b2 = (_a3 = childProp == null ? void 0 : childProp.props) == null ? void 0 : _a3.onFocus) == null ? void 0 : _b2.call(_a3, e);
|
|
8030
|
+
}, [childProp == null ? void 0 : childProp.props, handleIsOpenChange]);
|
|
8031
|
+
const handleMouseEnter = react.useCallback(e => {
|
|
8032
|
+
var _a3, _b2;
|
|
8033
|
+
handleIsOpenChange(true);
|
|
8034
|
+
(_b2 = (_a3 = childProp == null ? void 0 : childProp.props) == null ? void 0 : _a3.onMouseEnter) == null ? void 0 : _b2.call(_a3, e);
|
|
8035
|
+
}, [childProp == null ? void 0 : childProp.props, handleIsOpenChange]);
|
|
8036
|
+
const handleMouseLeave = react.useCallback(e => {
|
|
8037
|
+
var _a3, _b2;
|
|
8038
|
+
handleIsOpenChange(false);
|
|
8039
|
+
(_b2 = (_a3 = childProp == null ? void 0 : childProp.props) == null ? void 0 : _a3.onMouseLeave) == null ? void 0 : _b2.call(_a3, e);
|
|
8040
|
+
}, [childProp == null ? void 0 : childProp.props, handleIsOpenChange]);
|
|
7280
8041
|
react.useEffect(() => {
|
|
7281
8042
|
if (!isOpen) return;
|
|
7282
8043
|
function handleWindowMouseMove(event) {
|
|
@@ -7299,6 +8060,18 @@ const Tooltip = react.forwardRef(function Tooltip2(props, ref) {
|
|
|
7299
8060
|
if (!content) handleIsOpenChange(false);
|
|
7300
8061
|
}, [content, handleIsOpenChange]);
|
|
7301
8062
|
react.useEffect(() => refs.setReference(referenceElement), [referenceElement, refs]);
|
|
8063
|
+
react.useEffect(() => {
|
|
8064
|
+
if (!showTooltip) return;
|
|
8065
|
+
function handleWindowKeyDown(event) {
|
|
8066
|
+
if (event.key === "Escape") {
|
|
8067
|
+
handleIsOpenChange(false, true);
|
|
8068
|
+
}
|
|
8069
|
+
}
|
|
8070
|
+
window.addEventListener("keydown", handleWindowKeyDown);
|
|
8071
|
+
return () => {
|
|
8072
|
+
window.removeEventListener("keydown", handleWindowKeyDown);
|
|
8073
|
+
};
|
|
8074
|
+
}, [handleIsOpenChange, showTooltip]);
|
|
7302
8075
|
const setArrow = react.useCallback(arrowEl => {
|
|
7303
8076
|
arrowRef.current = arrowEl;
|
|
7304
8077
|
update();
|
|
@@ -7323,9 +8096,11 @@ const Tooltip = react.forwardRef(function Tooltip2(props, ref) {
|
|
|
7323
8096
|
onFocus: handleFocus,
|
|
7324
8097
|
onMouseEnter: handleMouseEnter,
|
|
7325
8098
|
onMouseLeave: handleMouseLeave,
|
|
8099
|
+
onClick: handleClick,
|
|
8100
|
+
onContextMenu: handleContextMenu,
|
|
7326
8101
|
ref: setReference
|
|
7327
8102
|
});
|
|
7328
|
-
}, [childProp, handleBlur, handleFocus, handleMouseEnter, handleMouseLeave, setReference]);
|
|
8103
|
+
}, [childProp, handleBlur, handleClick, handleContextMenu, handleFocus, handleMouseEnter, handleMouseLeave, setReference]);
|
|
7329
8104
|
if (!child) return /* @__PURE__ */jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
7330
8105
|
if (disabled) return child;
|
|
7331
8106
|
const root = /* @__PURE__ */jsxRuntime.jsx(Root$a, {
|
|
@@ -7334,6 +8109,7 @@ const Tooltip = react.forwardRef(function Tooltip2(props, ref) {
|
|
|
7334
8109
|
ref: setFloating,
|
|
7335
8110
|
style: floatingStyles,
|
|
7336
8111
|
zOffset,
|
|
8112
|
+
$maxWidth: tooltipWidth,
|
|
7337
8113
|
children: /* @__PURE__ */jsxRuntime.jsxs(Card, {
|
|
7338
8114
|
"data-ui": "Tooltip__card",
|
|
7339
8115
|
"data-placement": placement,
|
|
@@ -7349,8 +8125,8 @@ const Tooltip = react.forwardRef(function Tooltip2(props, ref) {
|
|
|
7349
8125
|
});
|
|
7350
8126
|
return /* @__PURE__ */jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
7351
8127
|
children: [child, showTooltip && /* @__PURE__ */jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
7352
|
-
children:
|
|
7353
|
-
__unstable_name: typeof
|
|
8128
|
+
children: portalProp ? /* @__PURE__ */jsxRuntime.jsx(Portal, {
|
|
8129
|
+
__unstable_name: typeof portalProp === "string" ? portalProp : void 0,
|
|
7354
8130
|
children: root
|
|
7355
8131
|
}) : root
|
|
7356
8132
|
})]
|
|
@@ -7510,10 +8286,10 @@ const InnerAutocomplete = react.forwardRef(function InnerAutocomplete2(props, re
|
|
|
7510
8286
|
query,
|
|
7511
8287
|
value
|
|
7512
8288
|
} = state;
|
|
7513
|
-
const defaultRenderOption = react.useCallback(
|
|
8289
|
+
const defaultRenderOption = react.useCallback(_ref28 => {
|
|
7514
8290
|
let {
|
|
7515
8291
|
value: value2
|
|
7516
|
-
} =
|
|
8292
|
+
} = _ref28;
|
|
7517
8293
|
return /* @__PURE__ */jsxRuntime.jsx(Card, {
|
|
7518
8294
|
"data-as": "button",
|
|
7519
8295
|
padding: paddingProp,
|
|
@@ -7966,10 +8742,11 @@ const Breadcrumbs = react.forwardRef(function Breadcrumbs2(props, ref) {
|
|
|
7966
8742
|
}, itemIndex))
|
|
7967
8743
|
});
|
|
7968
8744
|
});
|
|
7969
|
-
|
|
8745
|
+
const BORDER_OFFSET_X = 12;
|
|
8746
|
+
function dialogStyle(_ref29) {
|
|
7970
8747
|
let {
|
|
7971
8748
|
theme
|
|
7972
|
-
} =
|
|
8749
|
+
} = _ref29;
|
|
7973
8750
|
const color = theme.sanity.color.base;
|
|
7974
8751
|
return {
|
|
7975
8752
|
"&:not([hidden])": {
|
|
@@ -8020,9 +8797,9 @@ const Root$7 = styled__default.default(Layer)(responsivePaddingStyle, dialogStyl
|
|
|
8020
8797
|
const DialogContainer = styled__default.default(Container)(_a$b || (_a$b = __template$b(["\n &:not([hidden]) {\n display: flex;\n }\n width: 100%;\n height: 100%;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n"])));
|
|
8021
8798
|
const DialogCardRoot = styled__default.default(Card)(_b$6 || (_b$6 = __template$b(["\n &:not([hidden]) {\n display: flex;\n }\n width: 100%;\n min-height: 0;\n max-height: 100%;\n overflow: hidden;\n overflow: clip;\n"])));
|
|
8022
8799
|
const DialogLayout = styled__default.default(Flex)(_c$2 || (_c$2 = __template$b(["\n flex: 1;\n min-height: 0;\n width: 100%;\n"])));
|
|
8023
|
-
const DialogHeader = styled__default.default(
|
|
8800
|
+
const DialogHeader = styled__default.default(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);
|
|
8024
8801
|
const DialogContent = styled__default.default(Box)(_e || (_e = __template$b(["\n position: relative;\n z-index: 1;\n overflow: auto;\n outline: none;\n"])));
|
|
8025
|
-
const DialogFooter = styled__default.default(Box)(_f || (_f = __template$b(["\n position: relative;\n z-index: 3;\n border-top: 1px solid var(--card-
|
|
8802
|
+
const DialogFooter = styled__default.default(Box)(_f || (_f = __template$b(["\n position: relative;\n z-index: 3;\n\n &:before {\n content: '';\n display: block;\n position: absolute;\n left: ", "px;\n right: ", "px;\n top: -1px;\n border-top: 1px solid var(--card-border-color);\n width: auto;\n opacity: ", ";\n transition: opacity 200ms ease-in;\n }\n"])), BORDER_OFFSET_X, BORDER_OFFSET_X, props => props.$isContentScrollable && !props.$hasScrolledToBottom ? 1 : 0);
|
|
8026
8803
|
const DialogCard = react.forwardRef(function DialogCard2(props, ref) {
|
|
8027
8804
|
var _a2;
|
|
8028
8805
|
const {
|
|
@@ -8057,6 +8834,9 @@ const DialogCard = react.forwardRef(function DialogCard2(props, ref) {
|
|
|
8057
8834
|
const labelId = "".concat(id, "_label");
|
|
8058
8835
|
const showCloseButton = Boolean(onClose) && hideCloseButton === false;
|
|
8059
8836
|
const showHeader = Boolean(header) || showCloseButton;
|
|
8837
|
+
const [isContentScrollable, setIsContentScrollable] = react.useState(false);
|
|
8838
|
+
const [hasScrolledFromTop, setHasScrolledFromTop] = react.useState(false);
|
|
8839
|
+
const [hasScrolledToBottom, setHasScrolledToBottom] = react.useState(false);
|
|
8060
8840
|
react.useEffect(() => {
|
|
8061
8841
|
if (!autoFocus) return;
|
|
8062
8842
|
if (forwardedRef.current) {
|
|
@@ -8091,6 +8871,22 @@ const DialogCard = react.forwardRef(function DialogCard2(props, ref) {
|
|
|
8091
8871
|
localContentRef.current = el;
|
|
8092
8872
|
if (typeof contentRef === "function") contentRef(el);else if (contentRef) contentRef.current = el;
|
|
8093
8873
|
}, [contentRef]);
|
|
8874
|
+
const handleContentUpdate = react.useCallback(() => {
|
|
8875
|
+
if (localContentRef.current) {
|
|
8876
|
+
setIsContentScrollable(localContentRef.current.clientHeight < localContentRef.current.scrollHeight);
|
|
8877
|
+
setHasScrolledFromTop(localContentRef.current.scrollTop > 0);
|
|
8878
|
+
setHasScrolledToBottom(localContentRef.current.scrollTop >= localContentRef.current.scrollHeight - localContentRef.current.clientHeight);
|
|
8879
|
+
}
|
|
8880
|
+
}, []);
|
|
8881
|
+
react.useEffect(() => {
|
|
8882
|
+
const resizeObserver = new ResizeObserver(handleContentUpdate);
|
|
8883
|
+
if (localContentRef.current) {
|
|
8884
|
+
resizeObserver.observe(localContentRef.current);
|
|
8885
|
+
}
|
|
8886
|
+
return () => {
|
|
8887
|
+
resizeObserver.disconnect();
|
|
8888
|
+
};
|
|
8889
|
+
}, [contentRef, handleContentUpdate]);
|
|
8094
8890
|
return /* @__PURE__ */jsxRuntime.jsx(DialogContainer, {
|
|
8095
8891
|
"data-ui": "DialogCard",
|
|
8096
8892
|
width,
|
|
@@ -8102,24 +8898,28 @@ const DialogCard = react.forwardRef(function DialogCard2(props, ref) {
|
|
|
8102
8898
|
children: /* @__PURE__ */jsxRuntime.jsxs(DialogLayout, {
|
|
8103
8899
|
direction: "column",
|
|
8104
8900
|
children: [showHeader && /* @__PURE__ */jsxRuntime.jsx(DialogHeader, {
|
|
8901
|
+
$isContentScrollable: isContentScrollable,
|
|
8902
|
+
$hasScrolledFromTop: hasScrolledFromTop,
|
|
8105
8903
|
children: /* @__PURE__ */jsxRuntime.jsxs(Flex, {
|
|
8904
|
+
align: "center",
|
|
8106
8905
|
children: [/* @__PURE__ */jsxRuntime.jsx(Box, {
|
|
8107
8906
|
flex: 1,
|
|
8907
|
+
margin: 1,
|
|
8108
8908
|
padding: 4,
|
|
8109
8909
|
children: header && /* @__PURE__ */jsxRuntime.jsx(Text, {
|
|
8110
8910
|
id: labelId,
|
|
8111
|
-
|
|
8911
|
+
size: 1,
|
|
8912
|
+
weight: "medium",
|
|
8112
8913
|
children: header
|
|
8113
8914
|
})
|
|
8114
8915
|
}), showCloseButton && /* @__PURE__ */jsxRuntime.jsx(Box, {
|
|
8115
|
-
padding:
|
|
8916
|
+
padding: 3,
|
|
8116
8917
|
children: /* @__PURE__ */jsxRuntime.jsx(Button, {
|
|
8117
8918
|
"aria-label": "Close dialog",
|
|
8118
8919
|
disabled: !onClose,
|
|
8119
8920
|
icon: icons.CloseIcon,
|
|
8120
8921
|
mode: "bleed",
|
|
8121
|
-
onClick: onClose
|
|
8122
|
-
padding: 3
|
|
8922
|
+
onClick: onClose
|
|
8123
8923
|
})
|
|
8124
8924
|
})]
|
|
8125
8925
|
})
|
|
@@ -8127,8 +8927,11 @@ const DialogCard = react.forwardRef(function DialogCard2(props, ref) {
|
|
|
8127
8927
|
flex: 1,
|
|
8128
8928
|
ref: setContentRef,
|
|
8129
8929
|
tabIndex: -1,
|
|
8930
|
+
onScroll: handleContentUpdate,
|
|
8130
8931
|
children
|
|
8131
8932
|
}), footer && /* @__PURE__ */jsxRuntime.jsx(DialogFooter, {
|
|
8933
|
+
$isContentScrollable: isContentScrollable,
|
|
8934
|
+
$hasScrolledToBottom: hasScrolledToBottom,
|
|
8132
8935
|
children: footer
|
|
8133
8936
|
})]
|
|
8134
8937
|
})
|
|
@@ -8747,7 +9550,7 @@ var __template$7 = (cooked, raw) => __freeze$7(__defProp$7(cooked, "raw", {
|
|
|
8747
9550
|
}));
|
|
8748
9551
|
var _a$7, _b$4;
|
|
8749
9552
|
function selectableBaseStyle() {
|
|
8750
|
-
return styled.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 "])));
|
|
9553
|
+
return styled.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 "])));
|
|
8751
9554
|
}
|
|
8752
9555
|
function selectableColorStyle(props) {
|
|
8753
9556
|
var _a2, _b2;
|
|
@@ -8761,7 +9564,7 @@ function selectableColorStyle(props) {
|
|
|
8761
9564
|
selectable
|
|
8762
9565
|
} = theme.sanity.color;
|
|
8763
9566
|
const tone = selectable ? selectable[$tone] || selectable.default : muted[$tone] || muted.default;
|
|
8764
|
-
return styled.css(_b$4 || (_b$4 = __template$7(["\n ", "\n\n background-color: var(--card-bg-color);\n color: var(--card-fg-color);\n outline: none;\n\n /* &:is(button) */\n &[data-as='button'] {\n &:disabled {\n ", "\n }\n\n &:not(:disabled) {\n &[aria-pressed='true'] {\n ", "\n }\n\n &[data-selected],\n &[aria-selected='true'] > & {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]) {\n &[data-hovered],\n &:hover {\n ", "\n }\n\n &:active {\n ", "\n }\n }\n }\n }\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n &[data-disabled] {\n ", "\n }\n\n &:not([data-disabled]) {\n &[data-pressed] {\n ", "\n }\n\n &[data-selected] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]) {\n &[data-hovered],\n &:hover {\n ", "\n }\n
|
|
9567
|
+
return styled.css(_b$4 || (_b$4 = __template$7(["\n ", "\n\n background-color: var(--card-bg-color);\n color: var(--card-fg-color);\n outline: none;\n\n /* &:is(button) */\n &[data-as='button'] {\n &:disabled {\n ", "\n }\n\n &:not(:disabled) {\n &[aria-pressed='true'] {\n ", "\n }\n\n &[data-selected],\n &[aria-selected='true'] > & {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]) {\n &[data-hovered],\n &:hover {\n ", "\n }\n\n &:active {\n ", "\n }\n }\n }\n }\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n &[data-disabled] {\n ", "\n }\n\n &:not([data-disabled]) {\n &[data-pressed] {\n ", "\n }\n\n &[data-selected] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]) {\n &[data-hovered],\n &:hover {\n ", "\n }\n &: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);
|
|
8765
9568
|
}
|
|
8766
9569
|
const Selectable = styled__default.default(Box)(responsiveRadiusStyle, selectableBaseStyle, selectableColorStyle);
|
|
8767
9570
|
function useMenu() {
|
|
@@ -8778,7 +9581,7 @@ function MenuGroup(props) {
|
|
|
8778
9581
|
const {
|
|
8779
9582
|
as = "button",
|
|
8780
9583
|
children,
|
|
8781
|
-
fontSize,
|
|
9584
|
+
fontSize = 1,
|
|
8782
9585
|
icon,
|
|
8783
9586
|
onClick,
|
|
8784
9587
|
padding = 3,
|
|
@@ -8790,6 +9593,9 @@ function MenuGroup(props) {
|
|
|
8790
9593
|
...restProps
|
|
8791
9594
|
} = props;
|
|
8792
9595
|
const menu = useMenu();
|
|
9596
|
+
const {
|
|
9597
|
+
scheme
|
|
9598
|
+
} = useRootTheme();
|
|
8793
9599
|
const {
|
|
8794
9600
|
activeElement,
|
|
8795
9601
|
mount,
|
|
@@ -8878,34 +9684,31 @@ function MenuGroup(props) {
|
|
|
8878
9684
|
"data-selected": !withinMenu && active ? "" : void 0,
|
|
8879
9685
|
$radius: useArrayProp(radius),
|
|
8880
9686
|
$tone: tone,
|
|
9687
|
+
$scheme: scheme,
|
|
8881
9688
|
onClick: handleClick,
|
|
8882
9689
|
onKeyDown: handleKeyDown,
|
|
8883
9690
|
onMouseEnter: handleMouseEnter,
|
|
8884
9691
|
ref: setRootElement,
|
|
8885
9692
|
tabIndex: -1,
|
|
8886
9693
|
type: as === "button" ? "button" : void 0,
|
|
8887
|
-
children: /* @__PURE__ */jsxRuntime.
|
|
9694
|
+
children: /* @__PURE__ */jsxRuntime.jsxs(Flex, {
|
|
9695
|
+
gap: space,
|
|
8888
9696
|
padding,
|
|
8889
|
-
children: /* @__PURE__ */jsxRuntime.jsxs(
|
|
8890
|
-
|
|
9697
|
+
children: [icon && /* @__PURE__ */jsxRuntime.jsxs(Text, {
|
|
9698
|
+
size: fontSize,
|
|
9699
|
+
children: [react.isValidElement(icon) && icon, ReactIs.isValidElementType(icon) && react.createElement(icon)]
|
|
9700
|
+
}), /* @__PURE__ */jsxRuntime.jsx(Box, {
|
|
9701
|
+
flex: 1,
|
|
9702
|
+
children: /* @__PURE__ */jsxRuntime.jsx(Text, {
|
|
8891
9703
|
size: fontSize,
|
|
8892
|
-
|
|
8893
|
-
|
|
8894
|
-
|
|
8895
|
-
|
|
8896
|
-
|
|
8897
|
-
|
|
8898
|
-
|
|
8899
|
-
|
|
8900
|
-
})
|
|
8901
|
-
}), /* @__PURE__ */jsxRuntime.jsx(Box, {
|
|
8902
|
-
marginLeft: space,
|
|
8903
|
-
children: /* @__PURE__ */jsxRuntime.jsx(Text, {
|
|
8904
|
-
size: fontSize,
|
|
8905
|
-
children: /* @__PURE__ */jsxRuntime.jsx(icons.ChevronRightIcon, {})
|
|
8906
|
-
})
|
|
8907
|
-
})]
|
|
8908
|
-
})
|
|
9704
|
+
textOverflow: "ellipsis",
|
|
9705
|
+
weight: "medium",
|
|
9706
|
+
children: text
|
|
9707
|
+
})
|
|
9708
|
+
}), /* @__PURE__ */jsxRuntime.jsx(Text, {
|
|
9709
|
+
size: fontSize,
|
|
9710
|
+
children: /* @__PURE__ */jsxRuntime.jsx(icons.ChevronRightIcon, {})
|
|
9711
|
+
})]
|
|
8909
9712
|
})
|
|
8910
9713
|
})
|
|
8911
9714
|
});
|
|
@@ -8915,7 +9718,7 @@ const MenuItem = react.forwardRef(function MenuItem2(props, forwardedRef) {
|
|
|
8915
9718
|
as = "button",
|
|
8916
9719
|
children,
|
|
8917
9720
|
disabled,
|
|
8918
|
-
fontSize =
|
|
9721
|
+
fontSize = 1,
|
|
8919
9722
|
hotkeys,
|
|
8920
9723
|
icon,
|
|
8921
9724
|
iconRight,
|
|
@@ -8935,6 +9738,9 @@ const MenuItem = react.forwardRef(function MenuItem2(props, forwardedRef) {
|
|
|
8935
9738
|
tone = "default",
|
|
8936
9739
|
...restProps
|
|
8937
9740
|
} = props;
|
|
9741
|
+
const {
|
|
9742
|
+
scheme
|
|
9743
|
+
} = useRootTheme();
|
|
8938
9744
|
const menu = useMenu();
|
|
8939
9745
|
const {
|
|
8940
9746
|
activeElement,
|
|
@@ -8975,7 +9781,8 @@ const MenuItem = react.forwardRef(function MenuItem2(props, forwardedRef) {
|
|
|
8975
9781
|
forwardedAs: as,
|
|
8976
9782
|
$radius: useArrayProp(radius),
|
|
8977
9783
|
$padding: useArrayProp(0),
|
|
8978
|
-
$tone: tone,
|
|
9784
|
+
$tone: disabled ? "default" : tone,
|
|
9785
|
+
$scheme: scheme,
|
|
8979
9786
|
disabled,
|
|
8980
9787
|
onClick: handleClick,
|
|
8981
9788
|
onMouseEnter: onItemMouseEnter,
|
|
@@ -8984,38 +9791,33 @@ const MenuItem = react.forwardRef(function MenuItem2(props, forwardedRef) {
|
|
|
8984
9791
|
role: "menuitem",
|
|
8985
9792
|
tabIndex: -1,
|
|
8986
9793
|
type: as === "button" ? "button" : void 0,
|
|
8987
|
-
children: [(icon || text || iconRight) && /* @__PURE__ */jsxRuntime.
|
|
9794
|
+
children: [(icon || text || iconRight) && /* @__PURE__ */jsxRuntime.jsxs(Flex, {
|
|
8988
9795
|
as: "span",
|
|
9796
|
+
gap: space,
|
|
9797
|
+
align: "center",
|
|
8989
9798
|
...paddingProps,
|
|
8990
|
-
children: /* @__PURE__ */jsxRuntime.jsxs(
|
|
8991
|
-
|
|
8992
|
-
children: [icon &&
|
|
8993
|
-
|
|
8994
|
-
|
|
8995
|
-
|
|
8996
|
-
flex: 1,
|
|
8997
|
-
marginLeft: icon ? space : void 0,
|
|
8998
|
-
marginRight: iconRight ? space : void 0,
|
|
8999
|
-
children: /* @__PURE__ */jsxRuntime.jsx(Text, {
|
|
9000
|
-
size: fontSize,
|
|
9001
|
-
textOverflow: "ellipsis",
|
|
9002
|
-
children: text
|
|
9003
|
-
})
|
|
9004
|
-
}), hotkeys && /* @__PURE__ */jsxRuntime.jsx(Box, {
|
|
9005
|
-
marginLeft: space,
|
|
9006
|
-
style: {
|
|
9007
|
-
marginTop: -4,
|
|
9008
|
-
marginBottom: -4
|
|
9009
|
-
},
|
|
9010
|
-
children: /* @__PURE__ */jsxRuntime.jsx(Hotkeys, {
|
|
9011
|
-
fontSize,
|
|
9012
|
-
keys: hotkeys
|
|
9013
|
-
})
|
|
9014
|
-
}), iconRight && /* @__PURE__ */jsxRuntime.jsxs(Text, {
|
|
9799
|
+
children: [icon && /* @__PURE__ */jsxRuntime.jsxs(Text, {
|
|
9800
|
+
size: fontSize,
|
|
9801
|
+
children: [react.isValidElement(icon) && icon, ReactIs.isValidElementType(icon) && react.createElement(icon)]
|
|
9802
|
+
}), text && /* @__PURE__ */jsxRuntime.jsx(Box, {
|
|
9803
|
+
flex: 1,
|
|
9804
|
+
children: /* @__PURE__ */jsxRuntime.jsx(Text, {
|
|
9015
9805
|
size: fontSize,
|
|
9016
|
-
|
|
9017
|
-
|
|
9018
|
-
|
|
9806
|
+
textOverflow: "ellipsis",
|
|
9807
|
+
weight: "medium",
|
|
9808
|
+
children: text
|
|
9809
|
+
})
|
|
9810
|
+
}), hotkeys && /* @__PURE__ */jsxRuntime.jsx(Hotkeys, {
|
|
9811
|
+
fontSize,
|
|
9812
|
+
keys: hotkeys,
|
|
9813
|
+
style: {
|
|
9814
|
+
marginTop: -4,
|
|
9815
|
+
marginBottom: -4
|
|
9816
|
+
}
|
|
9817
|
+
}), iconRight && /* @__PURE__ */jsxRuntime.jsxs(Text, {
|
|
9818
|
+
size: fontSize,
|
|
9819
|
+
children: [react.isValidElement(iconRight) && iconRight, ReactIs.isValidElementType(iconRight) && react.createElement(iconRight)]
|
|
9820
|
+
})]
|
|
9019
9821
|
}), children && /* @__PURE__ */jsxRuntime.jsx(Box, {
|
|
9020
9822
|
as: "span",
|
|
9021
9823
|
...paddingProps,
|
|
@@ -9031,15 +9833,15 @@ var __template$6 = (cooked, raw) => __freeze$6(__defProp$6(cooked, "raw", {
|
|
|
9031
9833
|
var _a$6, _b$3, _c$1, _d;
|
|
9032
9834
|
const keyframe = styled.keyframes(_a$6 || (_a$6 = __template$6(["\n 0% {\n background-position: 100%;\n }\n 100% {\n background-position: -100%;\n }\n"])));
|
|
9033
9835
|
const animation = styled.css(_b$3 || (_b$3 = __template$6(["\n background-image: linear-gradient(\n to right,\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-to),\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-from),\n var(--card-skeleton-color-from)\n );\n background-position: 100%;\n background-size: 200% 100%;\n background-attachment: fixed;\n animation-name: ", ";\n animation-timing-function: ease-in-out;\n animation-iteration-count: infinite;\n animation-duration: 2000ms;\n"])), keyframe);
|
|
9034
|
-
const skeletonStyle = styled.css(_d || (_d = __template$6(["\n opacity: ", ";\n transition: opacity 200ms ease-in;\n\n @media screen and (prefers-reduced-motion: no-preference) {\n ", "\n }\n\n @media screen and (prefers-reduced-motion: reduce) {\n background-color: var(--card-skeleton-color-from);\n }\n"])),
|
|
9836
|
+
const skeletonStyle = styled.css(_d || (_d = __template$6(["\n opacity: ", ";\n transition: opacity 200ms ease-in;\n\n @media screen and (prefers-reduced-motion: no-preference) {\n ", "\n }\n\n @media screen and (prefers-reduced-motion: reduce) {\n background-color: var(--card-skeleton-color-from);\n }\n"])), _ref30 => {
|
|
9035
9837
|
let {
|
|
9036
9838
|
$visible
|
|
9037
|
-
} =
|
|
9839
|
+
} = _ref30;
|
|
9038
9840
|
return $visible ? 1 : 0;
|
|
9039
|
-
},
|
|
9841
|
+
}, _ref31 => {
|
|
9040
9842
|
let {
|
|
9041
9843
|
$animated
|
|
9042
|
-
} =
|
|
9844
|
+
} = _ref31;
|
|
9043
9845
|
return $animated ? animation : styled.css(_c$1 || (_c$1 = __template$6(["\n background-color: var(--card-skeleton-color-from);\n "])));
|
|
9044
9846
|
});
|
|
9045
9847
|
const Root$4 = styled__default.default(Box)(responsiveRadiusStyle, skeletonStyle);
|
|
@@ -9070,12 +9872,12 @@ const Skeleton = react.forwardRef(function Skeleton2(props, ref) {
|
|
|
9070
9872
|
ref
|
|
9071
9873
|
});
|
|
9072
9874
|
});
|
|
9073
|
-
const Root$3 = styled__default.default(Skeleton)(
|
|
9875
|
+
const Root$3 = styled__default.default(Skeleton)(_ref32 => {
|
|
9074
9876
|
let {
|
|
9075
9877
|
$size,
|
|
9076
9878
|
$style,
|
|
9077
9879
|
theme
|
|
9078
|
-
} =
|
|
9880
|
+
} = _ref32;
|
|
9079
9881
|
const {
|
|
9080
9882
|
media
|
|
9081
9883
|
} = theme.sanity;
|
|
@@ -9423,12 +10225,12 @@ function ToastProvider(props) {
|
|
|
9423
10225
|
paddingY,
|
|
9424
10226
|
children: /* @__PURE__ */jsxRuntime.jsx(framerMotion.AnimatePresence, {
|
|
9425
10227
|
initial: false,
|
|
9426
|
-
children: state.map(
|
|
10228
|
+
children: state.map(_ref33 => {
|
|
9427
10229
|
let {
|
|
9428
10230
|
dismiss,
|
|
9429
10231
|
id,
|
|
9430
10232
|
params
|
|
9431
|
-
} =
|
|
10233
|
+
} = _ref33;
|
|
9432
10234
|
return /* @__PURE__ */jsxRuntime.jsx(framerMotion.motion.div, {
|
|
9433
10235
|
animate: {
|
|
9434
10236
|
opacity: 1,
|
|
@@ -9937,6 +10739,18 @@ exports.BoundaryElementProvider = BoundaryElementProvider;
|
|
|
9937
10739
|
exports.Box = Box;
|
|
9938
10740
|
exports.Breadcrumbs = Breadcrumbs;
|
|
9939
10741
|
exports.Button = Button;
|
|
10742
|
+
exports.COLOR_BASE_TONES = COLOR_BASE_TONES;
|
|
10743
|
+
exports.COLOR_BLEND_MODES = COLOR_BLEND_MODES;
|
|
10744
|
+
exports.COLOR_BUTTON_MODES = COLOR_BUTTON_MODES;
|
|
10745
|
+
exports.COLOR_CONFIG_BASE_KEYS = COLOR_CONFIG_BASE_KEYS;
|
|
10746
|
+
exports.COLOR_CONFIG_BASE_TONES = COLOR_CONFIG_BASE_TONES;
|
|
10747
|
+
exports.COLOR_CONFIG_BLEND_KEYS = COLOR_CONFIG_BLEND_KEYS;
|
|
10748
|
+
exports.COLOR_CONFIG_STATE_KEYS = COLOR_CONFIG_STATE_KEYS;
|
|
10749
|
+
exports.COLOR_CONFIG_STATE_TONES = COLOR_CONFIG_STATE_TONES;
|
|
10750
|
+
exports.COLOR_HUES = COLOR_HUES;
|
|
10751
|
+
exports.COLOR_STATES = COLOR_STATES;
|
|
10752
|
+
exports.COLOR_STATE_TONES = COLOR_STATE_TONES;
|
|
10753
|
+
exports.COLOR_TINTS = COLOR_TINTS;
|
|
9940
10754
|
exports.Card = Card;
|
|
9941
10755
|
exports.Checkbox = Checkbox;
|
|
9942
10756
|
exports.Code = Code;
|
|
@@ -10002,12 +10816,25 @@ exports._raf = _raf;
|
|
|
10002
10816
|
exports._raf2 = _raf2;
|
|
10003
10817
|
exports._responsive = _responsive;
|
|
10004
10818
|
exports.attemptFocus = attemptFocus;
|
|
10819
|
+
exports.buildTheme = buildTheme;
|
|
10005
10820
|
exports.containsOrEqualsElement = containsOrEqualsElement;
|
|
10006
10821
|
exports.createColorTheme = createColorTheme;
|
|
10007
10822
|
exports.focusFirstDescendant = focusFirstDescendant;
|
|
10008
10823
|
exports.focusLastDescendant = focusLastDescendant;
|
|
10009
10824
|
exports.hexToRgb = hexToRgb;
|
|
10010
10825
|
exports.hslToRgb = hslToRgb;
|
|
10826
|
+
exports.isColorBlendModeValue = isColorBlendModeValue;
|
|
10827
|
+
exports.isColorButtonMode = isColorButtonMode;
|
|
10828
|
+
exports.isColorConfigBaseKey = isColorConfigBaseKey;
|
|
10829
|
+
exports.isColorConfigBaseTone = isColorConfigBaseTone;
|
|
10830
|
+
exports.isColorConfigBlendKey = isColorConfigBlendKey;
|
|
10831
|
+
exports.isColorConfigStateKey = isColorConfigStateKey;
|
|
10832
|
+
exports.isColorConfigStateTone = isColorConfigStateTone;
|
|
10833
|
+
exports.isColorHueValue = isColorHueValue;
|
|
10834
|
+
exports.isColorOpacityValue = isColorOpacityValue;
|
|
10835
|
+
exports.isColorTintValue = isColorTintValue;
|
|
10836
|
+
exports.isColorTokenValue = isColorTokenValue;
|
|
10837
|
+
exports.isColorValue = isColorValue;
|
|
10011
10838
|
exports.isFocusable = isFocusable;
|
|
10012
10839
|
exports.isHTMLAnchorElement = isHTMLAnchorElement;
|
|
10013
10840
|
exports.isHTMLButtonElement = isHTMLButtonElement;
|
|
@@ -10015,8 +10842,10 @@ exports.isHTMLElement = isHTMLElement;
|
|
|
10015
10842
|
exports.isHTMLInputElement = isHTMLInputElement;
|
|
10016
10843
|
exports.isHTMLSelectElement = isHTMLSelectElement;
|
|
10017
10844
|
exports.isHTMLTextAreaElement = isHTMLTextAreaElement;
|
|
10018
|
-
exports.multiply = multiply$
|
|
10845
|
+
exports.multiply = multiply$2;
|
|
10019
10846
|
exports.parseColor = parseColor;
|
|
10847
|
+
exports.parseTokenKey = parseTokenKey;
|
|
10848
|
+
exports.parseTokenValue = parseTokenValue;
|
|
10020
10849
|
exports.rem = rem;
|
|
10021
10850
|
exports.responsiveCodeFontStyle = responsiveCodeFontStyle;
|
|
10022
10851
|
exports.responsiveHeadingFont = responsiveHeadingFont;
|
|
@@ -10026,7 +10855,8 @@ exports.responsiveTextFont = responsiveTextFont;
|
|
|
10026
10855
|
exports.rgbToHex = rgbToHex;
|
|
10027
10856
|
exports.rgbToHsl = rgbToHsl;
|
|
10028
10857
|
exports.rgba = rgba;
|
|
10029
|
-
exports.
|
|
10858
|
+
exports.rgbaToRGBA = rgbaToRGBA;
|
|
10859
|
+
exports.screen = screen$2;
|
|
10030
10860
|
exports.studioTheme = studioTheme;
|
|
10031
10861
|
exports.useArrayProp = useArrayProp;
|
|
10032
10862
|
exports.useBoundaryElement = useBoundaryElement;
|