@sanity/ui 2.0.0-alpha.5 → 2.0.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.mjs +3 -1
- package/dist/index.d.ts +294 -407
- package/dist/index.esm.js +791 -2145
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +792 -2144
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/dialog/dialog.tsx +3 -3
- package/src/components/dialog/styles.ts +3 -4
- package/src/components/menu/__workshop__/closableMenuButton.tsx +2 -2
- package/src/components/menu/menuDivider.ts +2 -1
- package/src/components/menu/menuGroup.tsx +3 -0
- package/src/components/menu/menuItem.tsx +5 -2
- package/src/components/skeleton/styles.ts +8 -7
- package/src/components/tree/style.ts +19 -20
- package/src/primitives/_selectable/style.ts +27 -21
- package/src/primitives/avatar/avatar.tsx +8 -3
- package/src/primitives/avatar/avatarCounter.tsx +5 -4
- package/src/primitives/avatar/spotColors.ts +53 -0
- package/src/primitives/avatar/styles.ts +5 -7
- package/src/primitives/avatar/types.ts +14 -0
- package/src/primitives/badge/styles.ts +7 -8
- package/src/primitives/box/__workshop__/responsive.tsx +2 -2
- package/src/primitives/button/button.tsx +2 -2
- package/src/primitives/button/styles.ts +82 -16
- package/src/primitives/card/__workshop__/selected.tsx +8 -9
- package/src/primitives/card/card.tsx +43 -7
- package/src/primitives/card/styles.ts +30 -22
- package/src/primitives/card/types.ts +3 -1
- package/src/primitives/checkbox/styles.ts +20 -20
- package/src/primitives/code/code.tsx +15 -3
- package/src/primitives/code/styles.ts +51 -42
- package/src/primitives/heading/styles.ts +6 -5
- package/src/primitives/kbd/kbd.tsx +2 -1
- package/src/primitives/label/styles.ts +3 -2
- package/src/primitives/popover/popoverArrow.tsx +3 -2
- package/src/primitives/popover/popoverCard.tsx +6 -2
- package/src/primitives/radio/styles.ts +15 -15
- package/src/primitives/select/styles.ts +20 -22
- package/src/primitives/switch/styles.ts +13 -13
- package/src/primitives/text/__workshop__/colored.tsx +10 -11
- package/src/primitives/text/styles.ts +10 -9
- package/src/primitives/textArea/textArea.tsx +7 -11
- package/src/primitives/textInput/textInput.tsx +12 -12
- package/src/primitives/tooltip/__workshop__/props.tsx +20 -3
- package/src/primitives/tooltip/tooltipArrow.tsx +3 -2
- package/src/styles/border/borderStyle.ts +2 -1
- package/src/styles/colorVars/colorVarsStyle.ts +71 -32
- package/src/styles/focusRing/index.ts +6 -4
- package/src/styles/input/textInputStyle.ts +76 -93
- package/src/styles/margin/marginsStyle.test.ts +1 -2
- package/src/styles/padding/paddingStyle.test.ts +1 -2
- package/src/styles/shadow/shadowStyle.ts +5 -5
- package/src/theme/__workshop__/color.tsx +2 -2
- package/src/theme/__workshop__/index.ts +0 -5
- 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/color/cssVariables/cardVariables.ts +92 -0
- package/src/theme/lib/theme/color/cssVariables/createCssVars.ts +31 -0
- package/src/theme/lib/theme/color/cssVariables/cssVars.test.ts +262 -0
- package/src/theme/lib/theme/color/cssVariables/index.ts +1 -0
- package/src/theme/lib/theme/color/cssVariables/tints.ts +312 -0
- package/src/theme/lib/theme/color/cssVariables/tones.ts +67 -0
- package/src/theme/lib/theme/color/cssVariables/utils.test.ts +15 -0
- package/src/theme/lib/theme/color/cssVariables/utils.ts +9 -0
- package/src/theme/lib/theme/color/index.ts +2 -12
- package/src/theme/lib/theme/color/types.ts +6 -37
- package/src/theme/studioTheme/color.ts +2 -641
- package/src/theme/studioTheme/helpers.ts +15 -1
- package/src/theme/studioTheme/theme.ts +8 -2
- package/src/theme/themeColorProvider.tsx +2 -0
- package/src/theme/themeProvider.tsx +27 -8
- package/src/theme/toneContext/toneContext.ts +12 -0
- package/src/theme/toneContext/toneProvider.tsx +31 -0
- package/src/theme/toneContext/types.ts +10 -0
- package/src/theme/toneContext/useToneContext.tsx +26 -0
- package/src/theme/types.ts +2 -4
- package/src/utils/elementQuery/__workshop__/customMedia.tsx +4 -3
- package/src/theme/__workshop__/canvas.tsx +0 -395
- package/src/theme/lib/theme/color/_generic/index.ts +0 -1
- package/src/theme/lib/theme/color/_generic/types.ts +0 -30
- package/src/theme/lib/theme/color/base/index.ts +0 -1
- package/src/theme/lib/theme/color/base/types.ts +0 -19
- package/src/theme/lib/theme/color/button/createButtonModes.ts +0 -20
- package/src/theme/lib/theme/color/button/createButtonTones.ts +0 -52
- package/src/theme/lib/theme/color/button/index.ts +0 -1
- package/src/theme/lib/theme/color/button/types.ts +0 -44
- package/src/theme/lib/theme/color/card/createCardStates.ts +0 -58
- package/src/theme/lib/theme/color/card/index.ts +0 -1
- package/src/theme/lib/theme/color/card/types.ts +0 -18
- package/src/theme/lib/theme/color/color.test.ts +0 -63
- package/src/theme/lib/theme/color/defaults.ts +0 -390
- package/src/theme/lib/theme/color/factory.ts +0 -138
- package/src/theme/lib/theme/color/input/createInputModes.ts +0 -84
- package/src/theme/lib/theme/color/input/index.ts +0 -1
- package/src/theme/lib/theme/color/input/types.ts +0 -28
- package/src/theme/lib/theme/color/muted/createMuted.ts +0 -56
- package/src/theme/lib/theme/color/muted/index.ts +0 -1
- package/src/theme/lib/theme/color/muted/types.ts +0 -24
- package/src/theme/lib/theme/color/selectable/createSelectableTones.ts +0 -73
- package/src/theme/lib/theme/color/selectable/index.ts +0 -1
- package/src/theme/lib/theme/color/selectable/types.ts +0 -29
- package/src/theme/lib/theme/color/solid/createSolidTones.ts +0 -56
- package/src/theme/lib/theme/color/solid/index.ts +0 -1
- package/src/theme/lib/theme/color/solid/types.ts +0 -24
- package/src/theme/lib/theme/color/spot/createSpot.ts +0 -21
- package/src/theme/lib/theme/color/spot/index.ts +0 -1
- package/src/theme/lib/theme/color/spot/types.ts +0 -28
- package/src/theme/lib/theme/color/syntax/index.ts +0 -1
- package/src/theme/lib/theme/color/syntax/types.ts +0 -41
- package/src/theme/studioTheme/tints.ts +0 -152
package/dist/index.esm.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { useMemo, useState, useRef, useEffect, createContext, useContext, useSyncExternalStore, useLayoutEffect, forwardRef, useId, useCallback, cloneElement, isValidElement, createElement, Component, memo, useReducer, Children, Fragment as Fragment$1, startTransition } from 'react';
|
|
3
3
|
import ReactIs, { isElement as isElement$1, isFragment, isValidElementType } from 'react-is';
|
|
4
|
-
import styled, { ThemeProvider as ThemeProvider$1, useTheme as useTheme$1, css, keyframes } from 'styled-components';
|
|
5
|
-
import {
|
|
4
|
+
import styled, { createGlobalStyle, ThemeProvider as ThemeProvider$1, useTheme as useTheme$1, css, keyframes } from 'styled-components';
|
|
5
|
+
import { white, black, hues, gray, blue, purple, magenta, red, orange, yellow, green, cyan } from '@sanity/color';
|
|
6
6
|
import { SpinnerIcon, CheckmarkIcon, RemoveIcon, SelectIcon, CloseIcon, ChevronDownIcon, ChevronRightIcon, ToggleArrowRightIcon } from '@sanity/icons';
|
|
7
7
|
import Refractor from 'react-refractor';
|
|
8
8
|
import { detectOverflow, flip, offset, shift, arrow, hide, useFloating, autoUpdate, size as size$2 } from '@floating-ui/react-dom';
|
|
@@ -874,6 +874,15 @@ function hexToRgb(hex) {
|
|
|
874
874
|
b: parseInt(hex.slice(5, 7), 16)
|
|
875
875
|
};
|
|
876
876
|
}
|
|
877
|
+
function rgbaToRGBA(rgba) {
|
|
878
|
+
const values = rgba.replace(/rgba\(|\)/g, "").split(",");
|
|
879
|
+
return {
|
|
880
|
+
r: parseInt(values[0]),
|
|
881
|
+
g: parseInt(values[1]),
|
|
882
|
+
b: parseInt(values[2]),
|
|
883
|
+
a: parseFloat(values[3])
|
|
884
|
+
};
|
|
885
|
+
}
|
|
877
886
|
function rgbToHex(_ref2) {
|
|
878
887
|
let {
|
|
879
888
|
r,
|
|
@@ -991,1915 +1000,416 @@ function parseColor(color) {
|
|
|
991
1000
|
if (color.startsWith("hsl(")) {
|
|
992
1001
|
return hslToRgb(parseHsl(color));
|
|
993
1002
|
}
|
|
1003
|
+
if (color.startsWith("rgba(")) {
|
|
1004
|
+
return rgbaToRGBA(color);
|
|
1005
|
+
}
|
|
994
1006
|
throw new Error('parseColor: unexpected color format: "'.concat(color, '"'));
|
|
995
1007
|
}
|
|
996
1008
|
function rgba(color, a) {
|
|
997
1009
|
const rgb = parseColor(color);
|
|
998
1010
|
return "rgba(".concat(rgb.r, ",").concat(rgb.g, ",").concat(rgb.b, ",").concat(a, ")");
|
|
999
1011
|
}
|
|
1000
|
-
function createButtonTones(opts, base, dark, solid, muted, mode) {
|
|
1001
|
-
return {
|
|
1002
|
-
default: opts.button({
|
|
1003
|
-
base,
|
|
1004
|
-
dark,
|
|
1005
|
-
solid: solid.default,
|
|
1006
|
-
muted: muted.default,
|
|
1007
|
-
mode
|
|
1008
|
-
}),
|
|
1009
|
-
primary: opts.button({
|
|
1010
|
-
base,
|
|
1011
|
-
dark,
|
|
1012
|
-
solid: solid.primary,
|
|
1013
|
-
muted: muted.primary,
|
|
1014
|
-
mode
|
|
1015
|
-
}),
|
|
1016
|
-
positive: opts.button({
|
|
1017
|
-
base,
|
|
1018
|
-
dark,
|
|
1019
|
-
solid: solid.positive,
|
|
1020
|
-
muted: muted.positive,
|
|
1021
|
-
mode
|
|
1022
|
-
}),
|
|
1023
|
-
caution: opts.button({
|
|
1024
|
-
base,
|
|
1025
|
-
dark,
|
|
1026
|
-
solid: solid.caution,
|
|
1027
|
-
muted: muted.caution,
|
|
1028
|
-
mode
|
|
1029
|
-
}),
|
|
1030
|
-
critical: opts.button({
|
|
1031
|
-
base,
|
|
1032
|
-
dark,
|
|
1033
|
-
solid: solid.critical,
|
|
1034
|
-
muted: muted.critical,
|
|
1035
|
-
mode
|
|
1036
|
-
})
|
|
1037
|
-
};
|
|
1038
|
-
}
|
|
1039
|
-
function createButtonModes(opts, base, dark, solid, muted) {
|
|
1040
|
-
return {
|
|
1041
|
-
default: createButtonTones(opts, base, dark, solid, muted, "default"),
|
|
1042
|
-
ghost: createButtonTones(opts, base, dark, solid, muted, "ghost"),
|
|
1043
|
-
bleed: createButtonTones(opts, base, dark, solid, muted, "bleed")
|
|
1044
|
-
};
|
|
1045
|
-
}
|
|
1046
|
-
function createCardStates(opts, base, dark, name, solid, muted) {
|
|
1047
|
-
return {
|
|
1048
|
-
enabled: opts.card({
|
|
1049
|
-
base,
|
|
1050
|
-
dark,
|
|
1051
|
-
name,
|
|
1052
|
-
state: "enabled",
|
|
1053
|
-
solid,
|
|
1054
|
-
muted
|
|
1055
|
-
}),
|
|
1056
|
-
disabled: opts.card({
|
|
1057
|
-
base,
|
|
1058
|
-
dark,
|
|
1059
|
-
name,
|
|
1060
|
-
state: "disabled",
|
|
1061
|
-
solid,
|
|
1062
|
-
muted
|
|
1063
|
-
}),
|
|
1064
|
-
hovered: opts.card({
|
|
1065
|
-
base,
|
|
1066
|
-
dark,
|
|
1067
|
-
name,
|
|
1068
|
-
state: "hovered",
|
|
1069
|
-
solid,
|
|
1070
|
-
muted
|
|
1071
|
-
}),
|
|
1072
|
-
pressed: opts.card({
|
|
1073
|
-
base,
|
|
1074
|
-
dark,
|
|
1075
|
-
name,
|
|
1076
|
-
state: "pressed",
|
|
1077
|
-
solid,
|
|
1078
|
-
muted
|
|
1079
|
-
}),
|
|
1080
|
-
selected: opts.card({
|
|
1081
|
-
base,
|
|
1082
|
-
dark,
|
|
1083
|
-
name,
|
|
1084
|
-
state: "selected",
|
|
1085
|
-
solid,
|
|
1086
|
-
muted
|
|
1087
|
-
})
|
|
1088
|
-
};
|
|
1089
|
-
}
|
|
1090
|
-
const black = "hsl(0, 0%, 0%)";
|
|
1091
|
-
const white = "hsl(0, 0%, 100%)";
|
|
1092
|
-
const colors = {
|
|
1093
|
-
default: {
|
|
1094
|
-
lightest: "hsl(0, 0%, 95%)",
|
|
1095
|
-
lighter: "hsl(0, 0%, 70%)",
|
|
1096
|
-
light: "hsl(0, 0%, 65%)",
|
|
1097
|
-
base: "hsl(0, 0%, 50%)",
|
|
1098
|
-
dark: "hsl(0, 0%, 35%)",
|
|
1099
|
-
darker: "hsl(0, 0%, 20%)",
|
|
1100
|
-
darkest: "hsl(0, 0%, 5%)"
|
|
1101
|
-
},
|
|
1102
|
-
transparent: {
|
|
1103
|
-
lightest: "hsl(240, 100%, 95%)",
|
|
1104
|
-
lighter: "hsl(240, 100%, 70%)",
|
|
1105
|
-
light: "hsl(240, 100%, 65%)",
|
|
1106
|
-
base: "hsl(240, 100%, 50%)",
|
|
1107
|
-
dark: "hsl(240, 100%, 35%)",
|
|
1108
|
-
darker: "hsl(240, 100%, 20%)",
|
|
1109
|
-
darkest: "hsl(240, 100%, 5%)"
|
|
1110
|
-
},
|
|
1111
|
-
primary: {
|
|
1112
|
-
lightest: "hsl(240, 100%, 95%)",
|
|
1113
|
-
lighter: "hsl(240, 100%, 70%)",
|
|
1114
|
-
light: "hsl(240, 100%, 65%)",
|
|
1115
|
-
base: "hsl(240, 100%, 50%)",
|
|
1116
|
-
dark: "hsl(240, 100%, 35%)",
|
|
1117
|
-
darker: "hsl(240, 100%, 20%)",
|
|
1118
|
-
darkest: "hsl(240, 100%, 5%)"
|
|
1119
|
-
},
|
|
1120
|
-
positive: {
|
|
1121
|
-
lightest: "hsl(120, 100%, 95%)",
|
|
1122
|
-
lighter: "hsl(120, 100%, 70%)",
|
|
1123
|
-
light: "hsl(120, 100%, 65%)",
|
|
1124
|
-
base: "hsl(120, 100%, 50%)",
|
|
1125
|
-
dark: "hsl(120, 100%, 35%)",
|
|
1126
|
-
darker: "hsl(120, 100%, 20%)",
|
|
1127
|
-
darkest: "hsl(120, 100%, 5%)"
|
|
1128
|
-
},
|
|
1129
|
-
caution: {
|
|
1130
|
-
lightest: "hsl(60, 100%, 95%)",
|
|
1131
|
-
lighter: "hsl(60, 100%, 70%)",
|
|
1132
|
-
light: "hsl(60, 100%, 65%)",
|
|
1133
|
-
base: "hsl(60, 100%, 50%)",
|
|
1134
|
-
dark: "hsl(60, 100%, 35%)",
|
|
1135
|
-
darker: "hsl(60, 100%, 20%)",
|
|
1136
|
-
darkest: "hsl(60, 100%, 5%)"
|
|
1137
|
-
},
|
|
1138
|
-
critical: {
|
|
1139
|
-
lightest: "hsl(0, 100%, 95%)",
|
|
1140
|
-
lighter: "hsl(0, 100%, 70%)",
|
|
1141
|
-
light: "hsl(0, 100%, 65%)",
|
|
1142
|
-
base: "hsl(0, 100%, 50%)",
|
|
1143
|
-
dark: "hsl(0, 100%, 35%)",
|
|
1144
|
-
darker: "hsl(0, 100%, 20%)",
|
|
1145
|
-
darkest: "hsl(0, 100%, 5%)"
|
|
1146
|
-
}
|
|
1147
|
-
};
|
|
1148
|
-
const spots = {
|
|
1149
|
-
gray: "hsl(0, 0%, 50%)",
|
|
1150
|
-
red: "hsl(0, 100%, 50%)",
|
|
1151
|
-
orange: "hsl(30, 100%, 50%)",
|
|
1152
|
-
yellow: "hsl(60, 100%, 50%)",
|
|
1153
|
-
green: "hsl(120, 100%, 50%)",
|
|
1154
|
-
cyan: "hsl(180, 100%, 50%)",
|
|
1155
|
-
blue: "hsl(240, 100%, 50%)",
|
|
1156
|
-
purple: "hsl(270, 100%, 50%)",
|
|
1157
|
-
magenta: "hsl(300, 100%, 50%)"
|
|
1158
|
-
};
|
|
1159
|
-
const tones$1 = {
|
|
1160
|
-
transparent: {
|
|
1161
|
-
bg: [colors.transparent.darkest, colors.transparent.lightest],
|
|
1162
|
-
fg: [colors.transparent.lightest, colors.transparent.darkest],
|
|
1163
|
-
border: [colors.transparent.darker, colors.transparent.lighter],
|
|
1164
|
-
focusRing: [colors.transparent.base, colors.transparent.base]
|
|
1165
|
-
},
|
|
1166
|
-
primary: {
|
|
1167
|
-
bg: [colors.primary.darkest, colors.primary.lightest],
|
|
1168
|
-
fg: [colors.primary.lightest, colors.primary.darkest],
|
|
1169
|
-
border: [colors.primary.darker, colors.primary.lighter],
|
|
1170
|
-
focusRing: [colors.primary.base, colors.primary.base]
|
|
1171
|
-
},
|
|
1172
|
-
positive: {
|
|
1173
|
-
bg: [colors.positive.darkest, colors.positive.lightest],
|
|
1174
|
-
fg: [colors.positive.lightest, colors.positive.darkest],
|
|
1175
|
-
border: [colors.positive.darker, colors.positive.lighter],
|
|
1176
|
-
focusRing: [colors.positive.base, colors.positive.base]
|
|
1177
|
-
},
|
|
1178
|
-
caution: {
|
|
1179
|
-
bg: [colors.caution.darkest, colors.caution.lightest],
|
|
1180
|
-
fg: [colors.caution.lightest, colors.caution.darkest],
|
|
1181
|
-
border: [colors.caution.darker, colors.caution.lighter],
|
|
1182
|
-
focusRing: [colors.caution.base, colors.caution.base]
|
|
1183
|
-
},
|
|
1184
|
-
critical: {
|
|
1185
|
-
bg: [colors.critical.darkest, colors.critical.lightest],
|
|
1186
|
-
fg: [colors.critical.lightest, colors.critical.darkest],
|
|
1187
|
-
border: [colors.critical.darker, colors.critical.lighter],
|
|
1188
|
-
focusRing: [colors.critical.base, colors.critical.base]
|
|
1189
|
-
}
|
|
1190
|
-
};
|
|
1191
|
-
const defaultOpts = {
|
|
1192
|
-
base: _ref4 => {
|
|
1193
|
-
let {
|
|
1194
|
-
dark,
|
|
1195
|
-
name
|
|
1196
|
-
} = _ref4;
|
|
1197
|
-
if (name === "default") {
|
|
1198
|
-
return {
|
|
1199
|
-
bg: dark ? black : white,
|
|
1200
|
-
fg: dark ? white : black,
|
|
1201
|
-
border: dark ? colors.default.darkest : colors.default.lightest,
|
|
1202
|
-
focusRing: colors.primary.base,
|
|
1203
|
-
shadow: {
|
|
1204
|
-
outline: black,
|
|
1205
|
-
umbra: black,
|
|
1206
|
-
penumbra: black,
|
|
1207
|
-
ambient: black
|
|
1208
|
-
},
|
|
1209
|
-
skeleton: {
|
|
1210
|
-
from: dark ? white : black,
|
|
1211
|
-
to: dark ? white : black
|
|
1212
|
-
}
|
|
1213
|
-
};
|
|
1214
|
-
}
|
|
1215
|
-
return {
|
|
1216
|
-
bg: tones$1[name].bg[dark ? 0 : 1],
|
|
1217
|
-
fg: tones$1[name].fg[dark ? 0 : 1],
|
|
1218
|
-
border: tones$1[name].border[dark ? 0 : 1],
|
|
1219
|
-
focusRing: tones$1[name].focusRing[dark ? 0 : 1],
|
|
1220
|
-
shadow: {
|
|
1221
|
-
outline: black,
|
|
1222
|
-
umbra: black,
|
|
1223
|
-
penumbra: black,
|
|
1224
|
-
ambient: black
|
|
1225
|
-
},
|
|
1226
|
-
skeleton: {
|
|
1227
|
-
from: dark ? white : black,
|
|
1228
|
-
to: dark ? white : black
|
|
1229
|
-
}
|
|
1230
|
-
};
|
|
1231
|
-
},
|
|
1232
|
-
solid: _ref5 => {
|
|
1233
|
-
let {
|
|
1234
|
-
base,
|
|
1235
|
-
dark,
|
|
1236
|
-
state,
|
|
1237
|
-
tone
|
|
1238
|
-
} = _ref5;
|
|
1239
|
-
const color = colors[tone];
|
|
1240
|
-
if (state === "hovered") {
|
|
1241
|
-
return {
|
|
1242
|
-
bg: dark ? color.light : color.dark,
|
|
1243
|
-
bg2: dark ? color.light : color.dark,
|
|
1244
|
-
border: dark ? color.lighter : color.darker,
|
|
1245
|
-
fg: dark ? color.darkest : color.lightest,
|
|
1246
|
-
iconColor: dark ? color.darkest : color.lightest,
|
|
1247
|
-
muted: {
|
|
1248
|
-
fg: black
|
|
1249
|
-
},
|
|
1250
|
-
accent: {
|
|
1251
|
-
fg: black
|
|
1252
|
-
},
|
|
1253
|
-
link: {
|
|
1254
|
-
fg: black
|
|
1255
|
-
},
|
|
1256
|
-
code: {
|
|
1257
|
-
bg: black,
|
|
1258
|
-
fg: black
|
|
1259
|
-
},
|
|
1260
|
-
skeleton: base.skeleton
|
|
1261
|
-
};
|
|
1262
|
-
}
|
|
1263
|
-
return {
|
|
1264
|
-
bg: color.base,
|
|
1265
|
-
bg2: color.base,
|
|
1266
|
-
border: dark ? color.light : color.dark,
|
|
1267
|
-
fg: dark ? color.darkest : color.lightest,
|
|
1268
|
-
iconColor: dark ? color.darkest : color.lightest,
|
|
1269
|
-
muted: {
|
|
1270
|
-
fg: black
|
|
1271
|
-
},
|
|
1272
|
-
accent: {
|
|
1273
|
-
fg: black
|
|
1274
|
-
},
|
|
1275
|
-
link: {
|
|
1276
|
-
fg: black
|
|
1277
|
-
},
|
|
1278
|
-
code: {
|
|
1279
|
-
bg: black,
|
|
1280
|
-
fg: black
|
|
1281
|
-
},
|
|
1282
|
-
skeleton: base.skeleton
|
|
1283
|
-
};
|
|
1284
|
-
},
|
|
1285
|
-
muted: _ref6 => {
|
|
1286
|
-
let {
|
|
1287
|
-
base,
|
|
1288
|
-
dark,
|
|
1289
|
-
state,
|
|
1290
|
-
tone
|
|
1291
|
-
} = _ref6;
|
|
1292
|
-
const color = colors[tone];
|
|
1293
|
-
if (state === "hovered") {
|
|
1294
|
-
return {
|
|
1295
|
-
bg: dark ? color.darker : color.lighter,
|
|
1296
|
-
bg2: dark ? color.darker : color.lighter,
|
|
1297
|
-
border: dark ? color.lighter : color.darker,
|
|
1298
|
-
fg: dark ? color.lightest : color.darkest,
|
|
1299
|
-
iconColor: dark ? color.lightest : color.darkest,
|
|
1300
|
-
muted: {
|
|
1301
|
-
fg: black
|
|
1302
|
-
},
|
|
1303
|
-
accent: {
|
|
1304
|
-
fg: black
|
|
1305
|
-
},
|
|
1306
|
-
link: {
|
|
1307
|
-
fg: black
|
|
1308
|
-
},
|
|
1309
|
-
code: {
|
|
1310
|
-
bg: black,
|
|
1311
|
-
fg: black
|
|
1312
|
-
},
|
|
1313
|
-
skeleton: base.skeleton
|
|
1314
|
-
};
|
|
1315
|
-
}
|
|
1316
|
-
return {
|
|
1317
|
-
bg: dark ? color.darkest : color.lightest,
|
|
1318
|
-
bg2: dark ? color.darkest : color.lightest,
|
|
1319
|
-
border: dark ? color.darker : color.lighter,
|
|
1320
|
-
fg: dark ? color.lighter : color.darker,
|
|
1321
|
-
iconColor: dark ? color.lighter : color.darker,
|
|
1322
|
-
muted: {
|
|
1323
|
-
fg: black
|
|
1324
|
-
},
|
|
1325
|
-
accent: {
|
|
1326
|
-
fg: black
|
|
1327
|
-
},
|
|
1328
|
-
link: {
|
|
1329
|
-
fg: black
|
|
1330
|
-
},
|
|
1331
|
-
code: {
|
|
1332
|
-
bg: black,
|
|
1333
|
-
fg: black
|
|
1334
|
-
},
|
|
1335
|
-
skeleton: base.skeleton
|
|
1336
|
-
};
|
|
1337
|
-
},
|
|
1338
|
-
button: _ref7 => {
|
|
1339
|
-
let {
|
|
1340
|
-
base,
|
|
1341
|
-
mode,
|
|
1342
|
-
muted,
|
|
1343
|
-
solid
|
|
1344
|
-
} = _ref7;
|
|
1345
|
-
if (mode === "bleed") {
|
|
1346
|
-
return {
|
|
1347
|
-
...muted,
|
|
1348
|
-
enabled: {
|
|
1349
|
-
bg: "transparent",
|
|
1350
|
-
bg2: "transparent",
|
|
1351
|
-
fg: muted.enabled.fg,
|
|
1352
|
-
iconColor: muted.enabled.fg,
|
|
1353
|
-
border: "transparent",
|
|
1354
|
-
muted: {
|
|
1355
|
-
fg: black
|
|
1356
|
-
},
|
|
1357
|
-
accent: {
|
|
1358
|
-
fg: black
|
|
1359
|
-
},
|
|
1360
|
-
link: {
|
|
1361
|
-
fg: black
|
|
1362
|
-
},
|
|
1363
|
-
code: {
|
|
1364
|
-
bg: black,
|
|
1365
|
-
fg: black
|
|
1366
|
-
},
|
|
1367
|
-
skeleton: base.skeleton
|
|
1368
|
-
},
|
|
1369
|
-
hovered: {
|
|
1370
|
-
bg: muted.enabled.bg,
|
|
1371
|
-
bg2: muted.enabled.bg,
|
|
1372
|
-
fg: muted.hovered.fg,
|
|
1373
|
-
iconColor: muted.hovered.fg,
|
|
1374
|
-
border: "transparent",
|
|
1375
|
-
muted: {
|
|
1376
|
-
fg: black
|
|
1377
|
-
},
|
|
1378
|
-
accent: {
|
|
1379
|
-
fg: black
|
|
1380
|
-
},
|
|
1381
|
-
link: {
|
|
1382
|
-
fg: black
|
|
1383
|
-
},
|
|
1384
|
-
code: {
|
|
1385
|
-
bg: black,
|
|
1386
|
-
fg: black
|
|
1387
|
-
},
|
|
1388
|
-
skeleton: base.skeleton
|
|
1389
|
-
}
|
|
1390
|
-
};
|
|
1391
|
-
}
|
|
1392
|
-
if (mode === "ghost") return {
|
|
1393
|
-
...solid,
|
|
1394
|
-
enabled: muted.enabled
|
|
1395
|
-
};
|
|
1396
|
-
return solid;
|
|
1397
|
-
},
|
|
1398
|
-
card: _ref8 => {
|
|
1399
|
-
let {
|
|
1400
|
-
base
|
|
1401
|
-
} = _ref8;
|
|
1402
|
-
return {
|
|
1403
|
-
bg: black,
|
|
1404
|
-
bg2: black,
|
|
1405
|
-
fg: black,
|
|
1406
|
-
iconColor: black,
|
|
1407
|
-
border: black,
|
|
1408
|
-
muted: {
|
|
1409
|
-
fg: black
|
|
1410
|
-
},
|
|
1411
|
-
accent: {
|
|
1412
|
-
fg: black
|
|
1413
|
-
},
|
|
1414
|
-
link: {
|
|
1415
|
-
fg: black
|
|
1416
|
-
},
|
|
1417
|
-
code: {
|
|
1418
|
-
bg: black,
|
|
1419
|
-
fg: black
|
|
1420
|
-
},
|
|
1421
|
-
skeleton: base.skeleton
|
|
1422
|
-
};
|
|
1423
|
-
},
|
|
1424
|
-
input: () => {
|
|
1425
|
-
return {
|
|
1426
|
-
bg: black,
|
|
1427
|
-
bg2: black,
|
|
1428
|
-
fg: black,
|
|
1429
|
-
border: black,
|
|
1430
|
-
placeholder: black
|
|
1431
|
-
};
|
|
1432
|
-
},
|
|
1433
|
-
selectable: _ref9 => {
|
|
1434
|
-
let {
|
|
1435
|
-
muted,
|
|
1436
|
-
state,
|
|
1437
|
-
tone
|
|
1438
|
-
} = _ref9;
|
|
1439
|
-
return muted[tone][state];
|
|
1440
|
-
},
|
|
1441
|
-
spot: _ref10 => {
|
|
1442
|
-
let {
|
|
1443
|
-
key
|
|
1444
|
-
} = _ref10;
|
|
1445
|
-
return spots[key];
|
|
1446
|
-
},
|
|
1447
|
-
syntax: () => ({
|
|
1448
|
-
atrule: black,
|
|
1449
|
-
attrName: black,
|
|
1450
|
-
attrValue: black,
|
|
1451
|
-
attribute: black,
|
|
1452
|
-
boolean: black,
|
|
1453
|
-
builtin: black,
|
|
1454
|
-
cdata: black,
|
|
1455
|
-
char: black,
|
|
1456
|
-
class: black,
|
|
1457
|
-
className: black,
|
|
1458
|
-
comment: black,
|
|
1459
|
-
constant: black,
|
|
1460
|
-
deleted: black,
|
|
1461
|
-
doctype: black,
|
|
1462
|
-
entity: black,
|
|
1463
|
-
function: black,
|
|
1464
|
-
hexcode: black,
|
|
1465
|
-
id: black,
|
|
1466
|
-
important: black,
|
|
1467
|
-
inserted: black,
|
|
1468
|
-
keyword: black,
|
|
1469
|
-
number: black,
|
|
1470
|
-
operator: black,
|
|
1471
|
-
prolog: black,
|
|
1472
|
-
property: black,
|
|
1473
|
-
pseudoClass: black,
|
|
1474
|
-
pseudoElement: black,
|
|
1475
|
-
punctuation: black,
|
|
1476
|
-
regex: black,
|
|
1477
|
-
selector: black,
|
|
1478
|
-
string: black,
|
|
1479
|
-
symbol: black,
|
|
1480
|
-
tag: black,
|
|
1481
|
-
unit: black,
|
|
1482
|
-
url: black,
|
|
1483
|
-
variable: black
|
|
1484
|
-
})
|
|
1485
|
-
};
|
|
1486
|
-
function createInputModes(opts, base, dark, solid, muted) {
|
|
1487
|
-
return {
|
|
1488
|
-
default: {
|
|
1489
|
-
enabled: opts.input({
|
|
1490
|
-
base,
|
|
1491
|
-
dark,
|
|
1492
|
-
mode: "default",
|
|
1493
|
-
state: "enabled",
|
|
1494
|
-
solid: solid.default,
|
|
1495
|
-
muted: muted.default
|
|
1496
|
-
}),
|
|
1497
|
-
disabled: opts.input({
|
|
1498
|
-
base,
|
|
1499
|
-
dark,
|
|
1500
|
-
mode: "default",
|
|
1501
|
-
state: "disabled",
|
|
1502
|
-
solid: solid.default,
|
|
1503
|
-
muted: muted.default
|
|
1504
|
-
}),
|
|
1505
|
-
hovered: opts.input({
|
|
1506
|
-
base,
|
|
1507
|
-
dark,
|
|
1508
|
-
mode: "default",
|
|
1509
|
-
state: "hovered",
|
|
1510
|
-
solid: solid.default,
|
|
1511
|
-
muted: muted.default
|
|
1512
|
-
}),
|
|
1513
|
-
readOnly: opts.input({
|
|
1514
|
-
base,
|
|
1515
|
-
dark,
|
|
1516
|
-
mode: "default",
|
|
1517
|
-
state: "readOnly",
|
|
1518
|
-
solid: solid.default,
|
|
1519
|
-
muted: muted.default
|
|
1520
|
-
})
|
|
1521
|
-
},
|
|
1522
|
-
invalid: {
|
|
1523
|
-
enabled: opts.input({
|
|
1524
|
-
base,
|
|
1525
|
-
dark,
|
|
1526
|
-
mode: "invalid",
|
|
1527
|
-
state: "enabled",
|
|
1528
|
-
solid: solid.default,
|
|
1529
|
-
muted: muted.default
|
|
1530
|
-
}),
|
|
1531
|
-
disabled: opts.input({
|
|
1532
|
-
base,
|
|
1533
|
-
dark,
|
|
1534
|
-
mode: "invalid",
|
|
1535
|
-
state: "disabled",
|
|
1536
|
-
solid: solid.default,
|
|
1537
|
-
muted: muted.default
|
|
1538
|
-
}),
|
|
1539
|
-
hovered: opts.input({
|
|
1540
|
-
base,
|
|
1541
|
-
dark,
|
|
1542
|
-
mode: "invalid",
|
|
1543
|
-
state: "hovered",
|
|
1544
|
-
solid: solid.default,
|
|
1545
|
-
muted: muted.default
|
|
1546
|
-
}),
|
|
1547
|
-
readOnly: opts.input({
|
|
1548
|
-
base,
|
|
1549
|
-
dark,
|
|
1550
|
-
mode: "invalid",
|
|
1551
|
-
state: "readOnly",
|
|
1552
|
-
solid: solid.default,
|
|
1553
|
-
muted: muted.default
|
|
1554
|
-
})
|
|
1555
|
-
}
|
|
1556
|
-
};
|
|
1557
|
-
}
|
|
1558
|
-
function createMutedTones(opts, base, dark, name) {
|
|
1559
|
-
return {
|
|
1560
|
-
default: {
|
|
1561
|
-
enabled: opts.muted({
|
|
1562
|
-
base,
|
|
1563
|
-
dark,
|
|
1564
|
-
tone: "default",
|
|
1565
|
-
name,
|
|
1566
|
-
state: "enabled"
|
|
1567
|
-
}),
|
|
1568
|
-
disabled: opts.muted({
|
|
1569
|
-
base,
|
|
1570
|
-
dark,
|
|
1571
|
-
tone: "default",
|
|
1572
|
-
name,
|
|
1573
|
-
state: "disabled"
|
|
1574
|
-
}),
|
|
1575
|
-
hovered: opts.muted({
|
|
1576
|
-
base,
|
|
1577
|
-
dark,
|
|
1578
|
-
tone: "default",
|
|
1579
|
-
name,
|
|
1580
|
-
state: "hovered"
|
|
1581
|
-
}),
|
|
1582
|
-
pressed: opts.muted({
|
|
1583
|
-
base,
|
|
1584
|
-
dark,
|
|
1585
|
-
tone: "default",
|
|
1586
|
-
name,
|
|
1587
|
-
state: "pressed"
|
|
1588
|
-
}),
|
|
1589
|
-
selected: opts.muted({
|
|
1590
|
-
base,
|
|
1591
|
-
dark,
|
|
1592
|
-
tone: "default",
|
|
1593
|
-
name,
|
|
1594
|
-
state: "selected"
|
|
1595
|
-
})
|
|
1596
|
-
},
|
|
1597
|
-
transparent: {
|
|
1598
|
-
enabled: opts.muted({
|
|
1599
|
-
base,
|
|
1600
|
-
dark,
|
|
1601
|
-
tone: "transparent",
|
|
1602
|
-
name,
|
|
1603
|
-
state: "enabled"
|
|
1604
|
-
}),
|
|
1605
|
-
disabled: opts.muted({
|
|
1606
|
-
base,
|
|
1607
|
-
dark,
|
|
1608
|
-
tone: "transparent",
|
|
1609
|
-
name,
|
|
1610
|
-
state: "disabled"
|
|
1611
|
-
}),
|
|
1612
|
-
hovered: opts.muted({
|
|
1613
|
-
base,
|
|
1614
|
-
dark,
|
|
1615
|
-
tone: "transparent",
|
|
1616
|
-
name,
|
|
1617
|
-
state: "hovered"
|
|
1618
|
-
}),
|
|
1619
|
-
pressed: opts.muted({
|
|
1620
|
-
base,
|
|
1621
|
-
dark,
|
|
1622
|
-
tone: "transparent",
|
|
1623
|
-
name,
|
|
1624
|
-
state: "pressed"
|
|
1625
|
-
}),
|
|
1626
|
-
selected: opts.muted({
|
|
1627
|
-
base,
|
|
1628
|
-
dark,
|
|
1629
|
-
tone: "transparent",
|
|
1630
|
-
name,
|
|
1631
|
-
state: "selected"
|
|
1632
|
-
})
|
|
1633
|
-
},
|
|
1634
|
-
primary: {
|
|
1635
|
-
enabled: opts.muted({
|
|
1636
|
-
base,
|
|
1637
|
-
dark,
|
|
1638
|
-
tone: "primary",
|
|
1639
|
-
name,
|
|
1640
|
-
state: "enabled"
|
|
1641
|
-
}),
|
|
1642
|
-
disabled: opts.muted({
|
|
1643
|
-
base,
|
|
1644
|
-
dark,
|
|
1645
|
-
tone: "primary",
|
|
1646
|
-
name,
|
|
1647
|
-
state: "disabled"
|
|
1648
|
-
}),
|
|
1649
|
-
hovered: opts.muted({
|
|
1650
|
-
base,
|
|
1651
|
-
dark,
|
|
1652
|
-
tone: "primary",
|
|
1653
|
-
name,
|
|
1654
|
-
state: "hovered"
|
|
1655
|
-
}),
|
|
1656
|
-
pressed: opts.muted({
|
|
1657
|
-
base,
|
|
1658
|
-
dark,
|
|
1659
|
-
tone: "primary",
|
|
1660
|
-
name,
|
|
1661
|
-
state: "pressed"
|
|
1662
|
-
}),
|
|
1663
|
-
selected: opts.muted({
|
|
1664
|
-
base,
|
|
1665
|
-
dark,
|
|
1666
|
-
tone: "primary",
|
|
1667
|
-
name,
|
|
1668
|
-
state: "selected"
|
|
1669
|
-
})
|
|
1670
|
-
},
|
|
1671
|
-
positive: {
|
|
1672
|
-
enabled: opts.muted({
|
|
1673
|
-
base,
|
|
1674
|
-
dark,
|
|
1675
|
-
tone: "positive",
|
|
1676
|
-
name,
|
|
1677
|
-
state: "enabled"
|
|
1678
|
-
}),
|
|
1679
|
-
disabled: opts.muted({
|
|
1680
|
-
base,
|
|
1681
|
-
dark,
|
|
1682
|
-
tone: "positive",
|
|
1683
|
-
name,
|
|
1684
|
-
state: "disabled"
|
|
1685
|
-
}),
|
|
1686
|
-
hovered: opts.muted({
|
|
1687
|
-
base,
|
|
1688
|
-
dark,
|
|
1689
|
-
tone: "positive",
|
|
1690
|
-
name,
|
|
1691
|
-
state: "hovered"
|
|
1692
|
-
}),
|
|
1693
|
-
pressed: opts.muted({
|
|
1694
|
-
base,
|
|
1695
|
-
dark,
|
|
1696
|
-
tone: "positive",
|
|
1697
|
-
name,
|
|
1698
|
-
state: "pressed"
|
|
1699
|
-
}),
|
|
1700
|
-
selected: opts.muted({
|
|
1701
|
-
base,
|
|
1702
|
-
dark,
|
|
1703
|
-
tone: "positive",
|
|
1704
|
-
name,
|
|
1705
|
-
state: "selected"
|
|
1706
|
-
})
|
|
1707
|
-
},
|
|
1708
|
-
caution: {
|
|
1709
|
-
enabled: opts.muted({
|
|
1710
|
-
base,
|
|
1711
|
-
dark,
|
|
1712
|
-
tone: "caution",
|
|
1713
|
-
name,
|
|
1714
|
-
state: "enabled"
|
|
1715
|
-
}),
|
|
1716
|
-
disabled: opts.muted({
|
|
1717
|
-
base,
|
|
1718
|
-
dark,
|
|
1719
|
-
tone: "caution",
|
|
1720
|
-
name,
|
|
1721
|
-
state: "disabled"
|
|
1722
|
-
}),
|
|
1723
|
-
hovered: opts.muted({
|
|
1724
|
-
base,
|
|
1725
|
-
dark,
|
|
1726
|
-
tone: "caution",
|
|
1727
|
-
name,
|
|
1728
|
-
state: "hovered"
|
|
1729
|
-
}),
|
|
1730
|
-
pressed: opts.muted({
|
|
1731
|
-
base,
|
|
1732
|
-
dark,
|
|
1733
|
-
tone: "caution",
|
|
1734
|
-
name,
|
|
1735
|
-
state: "pressed"
|
|
1736
|
-
}),
|
|
1737
|
-
selected: opts.muted({
|
|
1738
|
-
base,
|
|
1739
|
-
dark,
|
|
1740
|
-
tone: "caution",
|
|
1741
|
-
name,
|
|
1742
|
-
state: "selected"
|
|
1743
|
-
})
|
|
1744
|
-
},
|
|
1745
|
-
critical: {
|
|
1746
|
-
enabled: opts.muted({
|
|
1747
|
-
base,
|
|
1748
|
-
dark,
|
|
1749
|
-
tone: "critical",
|
|
1750
|
-
name,
|
|
1751
|
-
state: "enabled"
|
|
1752
|
-
}),
|
|
1753
|
-
disabled: opts.muted({
|
|
1754
|
-
base,
|
|
1755
|
-
dark,
|
|
1756
|
-
tone: "critical",
|
|
1757
|
-
name,
|
|
1758
|
-
state: "disabled"
|
|
1759
|
-
}),
|
|
1760
|
-
hovered: opts.muted({
|
|
1761
|
-
base,
|
|
1762
|
-
dark,
|
|
1763
|
-
tone: "critical",
|
|
1764
|
-
name,
|
|
1765
|
-
state: "hovered"
|
|
1766
|
-
}),
|
|
1767
|
-
pressed: opts.muted({
|
|
1768
|
-
base,
|
|
1769
|
-
dark,
|
|
1770
|
-
tone: "critical",
|
|
1771
|
-
name,
|
|
1772
|
-
state: "pressed"
|
|
1773
|
-
}),
|
|
1774
|
-
selected: opts.muted({
|
|
1775
|
-
base,
|
|
1776
|
-
dark,
|
|
1777
|
-
tone: "critical",
|
|
1778
|
-
name,
|
|
1779
|
-
state: "selected"
|
|
1780
|
-
})
|
|
1781
|
-
}
|
|
1782
|
-
};
|
|
1783
|
-
}
|
|
1784
|
-
function createSelectableTones(opts, base, dark, solid, muted) {
|
|
1785
|
-
return {
|
|
1786
|
-
default: _createSelectableStates(opts, base, dark, solid, muted, "default"),
|
|
1787
|
-
primary: _createSelectableStates(opts, base, dark, solid, muted, "primary"),
|
|
1788
|
-
positive: _createSelectableStates(opts, base, dark, solid, muted, "positive"),
|
|
1789
|
-
caution: _createSelectableStates(opts, base, dark, solid, muted, "caution"),
|
|
1790
|
-
critical: _createSelectableStates(opts, base, dark, solid, muted, "critical")
|
|
1791
|
-
};
|
|
1792
|
-
}
|
|
1793
|
-
function _createSelectableStates(opts, base, dark, solid, muted, tone) {
|
|
1794
|
-
return {
|
|
1795
|
-
enabled: opts.selectable({
|
|
1796
|
-
base,
|
|
1797
|
-
dark,
|
|
1798
|
-
solid,
|
|
1799
|
-
muted,
|
|
1800
|
-
state: "enabled",
|
|
1801
|
-
tone
|
|
1802
|
-
}),
|
|
1803
|
-
hovered: opts.selectable({
|
|
1804
|
-
base,
|
|
1805
|
-
dark,
|
|
1806
|
-
solid,
|
|
1807
|
-
muted,
|
|
1808
|
-
state: "hovered",
|
|
1809
|
-
tone
|
|
1810
|
-
}),
|
|
1811
|
-
pressed: opts.selectable({
|
|
1812
|
-
base,
|
|
1813
|
-
dark,
|
|
1814
|
-
solid,
|
|
1815
|
-
muted,
|
|
1816
|
-
state: "pressed",
|
|
1817
|
-
tone
|
|
1818
|
-
}),
|
|
1819
|
-
selected: opts.selectable({
|
|
1820
|
-
base,
|
|
1821
|
-
dark,
|
|
1822
|
-
solid,
|
|
1823
|
-
muted,
|
|
1824
|
-
state: "selected",
|
|
1825
|
-
tone
|
|
1826
|
-
}),
|
|
1827
|
-
disabled: opts.selectable({
|
|
1828
|
-
base,
|
|
1829
|
-
dark,
|
|
1830
|
-
solid,
|
|
1831
|
-
muted,
|
|
1832
|
-
state: "disabled",
|
|
1833
|
-
tone
|
|
1834
|
-
})
|
|
1835
|
-
};
|
|
1836
|
-
}
|
|
1837
|
-
function createSolidTones(opts, base, dark, name) {
|
|
1838
|
-
return {
|
|
1839
|
-
default: {
|
|
1840
|
-
enabled: opts.solid({
|
|
1841
|
-
base,
|
|
1842
|
-
dark,
|
|
1843
|
-
tone: "default",
|
|
1844
|
-
name,
|
|
1845
|
-
state: "enabled"
|
|
1846
|
-
}),
|
|
1847
|
-
disabled: opts.solid({
|
|
1848
|
-
base,
|
|
1849
|
-
dark,
|
|
1850
|
-
tone: "default",
|
|
1851
|
-
name,
|
|
1852
|
-
state: "disabled"
|
|
1853
|
-
}),
|
|
1854
|
-
hovered: opts.solid({
|
|
1855
|
-
base,
|
|
1856
|
-
dark,
|
|
1857
|
-
tone: "default",
|
|
1858
|
-
name,
|
|
1859
|
-
state: "hovered"
|
|
1860
|
-
}),
|
|
1861
|
-
pressed: opts.solid({
|
|
1862
|
-
base,
|
|
1863
|
-
dark,
|
|
1864
|
-
tone: "default",
|
|
1865
|
-
name,
|
|
1866
|
-
state: "pressed"
|
|
1867
|
-
}),
|
|
1868
|
-
selected: opts.solid({
|
|
1869
|
-
base,
|
|
1870
|
-
dark,
|
|
1871
|
-
tone: "default",
|
|
1872
|
-
name,
|
|
1873
|
-
state: "selected"
|
|
1874
|
-
})
|
|
1875
|
-
},
|
|
1876
|
-
transparent: {
|
|
1877
|
-
enabled: opts.solid({
|
|
1878
|
-
base,
|
|
1879
|
-
dark,
|
|
1880
|
-
tone: "transparent",
|
|
1881
|
-
name,
|
|
1882
|
-
state: "enabled"
|
|
1883
|
-
}),
|
|
1884
|
-
disabled: opts.solid({
|
|
1885
|
-
base,
|
|
1886
|
-
dark,
|
|
1887
|
-
tone: "transparent",
|
|
1888
|
-
name,
|
|
1889
|
-
state: "disabled"
|
|
1890
|
-
}),
|
|
1891
|
-
hovered: opts.solid({
|
|
1892
|
-
base,
|
|
1893
|
-
dark,
|
|
1894
|
-
tone: "transparent",
|
|
1895
|
-
name,
|
|
1896
|
-
state: "hovered"
|
|
1897
|
-
}),
|
|
1898
|
-
pressed: opts.solid({
|
|
1899
|
-
base,
|
|
1900
|
-
dark,
|
|
1901
|
-
tone: "transparent",
|
|
1902
|
-
name,
|
|
1903
|
-
state: "pressed"
|
|
1904
|
-
}),
|
|
1905
|
-
selected: opts.solid({
|
|
1906
|
-
base,
|
|
1907
|
-
dark,
|
|
1908
|
-
tone: "transparent",
|
|
1909
|
-
name,
|
|
1910
|
-
state: "selected"
|
|
1911
|
-
})
|
|
1912
|
-
},
|
|
1913
|
-
primary: {
|
|
1914
|
-
enabled: opts.solid({
|
|
1915
|
-
base,
|
|
1916
|
-
dark,
|
|
1917
|
-
tone: "primary",
|
|
1918
|
-
name,
|
|
1919
|
-
state: "enabled"
|
|
1920
|
-
}),
|
|
1921
|
-
disabled: opts.solid({
|
|
1922
|
-
base,
|
|
1923
|
-
dark,
|
|
1924
|
-
tone: "primary",
|
|
1925
|
-
name,
|
|
1926
|
-
state: "disabled"
|
|
1927
|
-
}),
|
|
1928
|
-
hovered: opts.solid({
|
|
1929
|
-
base,
|
|
1930
|
-
dark,
|
|
1931
|
-
tone: "primary",
|
|
1932
|
-
name,
|
|
1933
|
-
state: "hovered"
|
|
1934
|
-
}),
|
|
1935
|
-
pressed: opts.solid({
|
|
1936
|
-
base,
|
|
1937
|
-
dark,
|
|
1938
|
-
tone: "primary",
|
|
1939
|
-
name,
|
|
1940
|
-
state: "pressed"
|
|
1941
|
-
}),
|
|
1942
|
-
selected: opts.solid({
|
|
1943
|
-
base,
|
|
1944
|
-
dark,
|
|
1945
|
-
tone: "primary",
|
|
1946
|
-
name,
|
|
1947
|
-
state: "selected"
|
|
1948
|
-
})
|
|
1949
|
-
},
|
|
1950
|
-
positive: {
|
|
1951
|
-
enabled: opts.solid({
|
|
1952
|
-
base,
|
|
1953
|
-
dark,
|
|
1954
|
-
tone: "positive",
|
|
1955
|
-
name,
|
|
1956
|
-
state: "enabled"
|
|
1957
|
-
}),
|
|
1958
|
-
disabled: opts.solid({
|
|
1959
|
-
base,
|
|
1960
|
-
dark,
|
|
1961
|
-
tone: "positive",
|
|
1962
|
-
name,
|
|
1963
|
-
state: "disabled"
|
|
1964
|
-
}),
|
|
1965
|
-
hovered: opts.solid({
|
|
1966
|
-
base,
|
|
1967
|
-
dark,
|
|
1968
|
-
tone: "positive",
|
|
1969
|
-
name,
|
|
1970
|
-
state: "hovered"
|
|
1971
|
-
}),
|
|
1972
|
-
pressed: opts.solid({
|
|
1973
|
-
base,
|
|
1974
|
-
dark,
|
|
1975
|
-
tone: "positive",
|
|
1976
|
-
name,
|
|
1977
|
-
state: "pressed"
|
|
1978
|
-
}),
|
|
1979
|
-
selected: opts.solid({
|
|
1980
|
-
base,
|
|
1981
|
-
dark,
|
|
1982
|
-
tone: "positive",
|
|
1983
|
-
name,
|
|
1984
|
-
state: "selected"
|
|
1985
|
-
})
|
|
1986
|
-
},
|
|
1987
|
-
caution: {
|
|
1988
|
-
enabled: opts.solid({
|
|
1989
|
-
base,
|
|
1990
|
-
dark,
|
|
1991
|
-
tone: "caution",
|
|
1992
|
-
name,
|
|
1993
|
-
state: "enabled"
|
|
1994
|
-
}),
|
|
1995
|
-
disabled: opts.solid({
|
|
1996
|
-
base,
|
|
1997
|
-
dark,
|
|
1998
|
-
tone: "caution",
|
|
1999
|
-
name,
|
|
2000
|
-
state: "disabled"
|
|
2001
|
-
}),
|
|
2002
|
-
hovered: opts.solid({
|
|
2003
|
-
base,
|
|
2004
|
-
dark,
|
|
2005
|
-
tone: "caution",
|
|
2006
|
-
name,
|
|
2007
|
-
state: "hovered"
|
|
2008
|
-
}),
|
|
2009
|
-
pressed: opts.solid({
|
|
2010
|
-
base,
|
|
2011
|
-
dark,
|
|
2012
|
-
tone: "caution",
|
|
2013
|
-
name,
|
|
2014
|
-
state: "pressed"
|
|
2015
|
-
}),
|
|
2016
|
-
selected: opts.solid({
|
|
2017
|
-
base,
|
|
2018
|
-
dark,
|
|
2019
|
-
tone: "caution",
|
|
2020
|
-
name,
|
|
2021
|
-
state: "selected"
|
|
2022
|
-
})
|
|
2023
|
-
},
|
|
2024
|
-
critical: {
|
|
2025
|
-
enabled: opts.solid({
|
|
2026
|
-
base,
|
|
2027
|
-
dark,
|
|
2028
|
-
tone: "critical",
|
|
2029
|
-
name,
|
|
2030
|
-
state: "enabled"
|
|
2031
|
-
}),
|
|
2032
|
-
disabled: opts.solid({
|
|
2033
|
-
base,
|
|
2034
|
-
dark,
|
|
2035
|
-
tone: "critical",
|
|
2036
|
-
name,
|
|
2037
|
-
state: "disabled"
|
|
2038
|
-
}),
|
|
2039
|
-
hovered: opts.solid({
|
|
2040
|
-
base,
|
|
2041
|
-
dark,
|
|
2042
|
-
tone: "critical",
|
|
2043
|
-
name,
|
|
2044
|
-
state: "hovered"
|
|
2045
|
-
}),
|
|
2046
|
-
pressed: opts.solid({
|
|
2047
|
-
base,
|
|
2048
|
-
dark,
|
|
2049
|
-
tone: "critical",
|
|
2050
|
-
name,
|
|
2051
|
-
state: "pressed"
|
|
2052
|
-
}),
|
|
2053
|
-
selected: opts.solid({
|
|
2054
|
-
base,
|
|
2055
|
-
dark,
|
|
2056
|
-
tone: "critical",
|
|
2057
|
-
name,
|
|
2058
|
-
state: "selected"
|
|
2059
|
-
})
|
|
2060
|
-
}
|
|
2061
|
-
};
|
|
2062
|
-
}
|
|
2063
|
-
function createSpot(opts, base, dark) {
|
|
2064
|
-
return {
|
|
2065
|
-
gray: opts.spot({
|
|
2066
|
-
base,
|
|
2067
|
-
dark,
|
|
2068
|
-
key: "gray"
|
|
2069
|
-
}),
|
|
2070
|
-
blue: opts.spot({
|
|
2071
|
-
base,
|
|
2072
|
-
dark,
|
|
2073
|
-
key: "blue"
|
|
2074
|
-
}),
|
|
2075
|
-
purple: opts.spot({
|
|
2076
|
-
base,
|
|
2077
|
-
dark,
|
|
2078
|
-
key: "purple"
|
|
2079
|
-
}),
|
|
2080
|
-
magenta: opts.spot({
|
|
2081
|
-
base,
|
|
2082
|
-
dark,
|
|
2083
|
-
key: "magenta"
|
|
2084
|
-
}),
|
|
2085
|
-
red: opts.spot({
|
|
2086
|
-
base,
|
|
2087
|
-
dark,
|
|
2088
|
-
key: "red"
|
|
2089
|
-
}),
|
|
2090
|
-
orange: opts.spot({
|
|
2091
|
-
base,
|
|
2092
|
-
dark,
|
|
2093
|
-
key: "orange"
|
|
2094
|
-
}),
|
|
2095
|
-
yellow: opts.spot({
|
|
2096
|
-
base,
|
|
2097
|
-
dark,
|
|
2098
|
-
key: "yellow"
|
|
2099
|
-
}),
|
|
2100
|
-
green: opts.spot({
|
|
2101
|
-
base,
|
|
2102
|
-
dark,
|
|
2103
|
-
key: "green"
|
|
2104
|
-
}),
|
|
2105
|
-
cyan: opts.spot({
|
|
2106
|
-
base,
|
|
2107
|
-
dark,
|
|
2108
|
-
key: "cyan"
|
|
2109
|
-
})
|
|
2110
|
-
};
|
|
2111
|
-
}
|
|
2112
|
-
function createColorTheme() {
|
|
2113
|
-
let partialOpts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2114
|
-
const builders = {
|
|
2115
|
-
...defaultOpts,
|
|
2116
|
-
...partialOpts
|
|
2117
|
-
};
|
|
2118
|
-
return {
|
|
2119
|
-
light: _createColorScheme(builders, false),
|
|
2120
|
-
dark: _createColorScheme(builders, true)
|
|
2121
|
-
};
|
|
2122
|
-
}
|
|
2123
|
-
function _createColorScheme(opts, dark) {
|
|
2124
|
-
return {
|
|
2125
|
-
default: _createColor(opts, dark, "default"),
|
|
2126
|
-
transparent: _createColor(opts, dark, "transparent"),
|
|
2127
|
-
primary: _createColor(opts, dark, "primary"),
|
|
2128
|
-
positive: _createColor(opts, dark, "positive"),
|
|
2129
|
-
caution: _createColor(opts, dark, "caution"),
|
|
2130
|
-
critical: _createColor(opts, dark, "critical")
|
|
2131
|
-
};
|
|
2132
|
-
}
|
|
2133
|
-
function _createColor(opts, dark, name) {
|
|
2134
|
-
const base = opts.base({
|
|
2135
|
-
dark,
|
|
2136
|
-
name
|
|
2137
|
-
});
|
|
2138
|
-
const solid = createSolidTones(opts, base, dark, name);
|
|
2139
|
-
const muted = createMutedTones(opts, base, dark, name);
|
|
2140
|
-
return {
|
|
2141
|
-
base,
|
|
2142
|
-
button: createButtonModes(opts, base, dark, solid, muted),
|
|
2143
|
-
card: createCardStates(opts, base, dark, name, solid, muted),
|
|
2144
|
-
dark,
|
|
2145
|
-
input: createInputModes(opts, base, dark, solid, muted),
|
|
2146
|
-
selectable: createSelectableTones(opts, base, dark, solid, muted),
|
|
2147
|
-
spot: createSpot(opts, base, dark),
|
|
2148
|
-
syntax: opts.syntax({
|
|
2149
|
-
base,
|
|
2150
|
-
dark
|
|
2151
|
-
}),
|
|
2152
|
-
solid,
|
|
2153
|
-
muted
|
|
2154
|
-
};
|
|
2155
|
-
}
|
|
2156
1012
|
function multiply(bg, fg) {
|
|
2157
1013
|
const b = parseColor(bg);
|
|
2158
1014
|
const s = parseColor(fg);
|
|
2159
1015
|
const hex = rgbToHex(multiply$1(b, s));
|
|
1016
|
+
if (s.a) {
|
|
1017
|
+
return rgba(hex, s.a);
|
|
1018
|
+
}
|
|
2160
1019
|
return hex;
|
|
2161
1020
|
}
|
|
2162
1021
|
function screen(bg, fg) {
|
|
2163
1022
|
const b = parseColor(bg);
|
|
2164
1023
|
const s = parseColor(fg);
|
|
2165
1024
|
const hex = rgbToHex(screen$1(b, s));
|
|
1025
|
+
if (s.a) {
|
|
1026
|
+
return rgba(hex, s.a);
|
|
1027
|
+
}
|
|
2166
1028
|
return hex;
|
|
2167
1029
|
}
|
|
1030
|
+
const colorKeys = ["text-primary", "text-secondary", "text-inactive",
|
|
1031
|
+
// TODO: Can this be replaced by other of the text colors? It's used by the code html element if it's inside a text
|
|
1032
|
+
"text-code", "text-muted", "text-link", "text-accent", "bg-base", "bg-base-hover", "bg-base-active", "bg-accent", "bg-accent-hover", "bg-accent-active", "bg-tint",
|
|
1033
|
+
// TODO: Can we replace this with bg_tint? It's used by the code html element if it's inside a text
|
|
1034
|
+
"bg-tint-code", "icon-default", "icon-inverted", "border-base", "border-base-hover", "border-accent", "border-accent-inverted",
|
|
1035
|
+
// Colors starting with -base won't be affected by the mix function
|
|
1036
|
+
"base-bg-card",
|
|
1037
|
+
// This is used by the card when a tone is defined, it will also override the bg-base in the rest of the components.
|
|
1038
|
+
"base-bg-raw",
|
|
1039
|
+
// This is the same color as bg-base, but it won't be overridden by the card bg color, used in selectable items.
|
|
1040
|
+
"base-shadow-outline-color", "base-shadow-umbra-color", "base-shadow-penumbra-color", "base-shadow-ambient-color", "base-text-color",
|
|
1041
|
+
// Color used by the buttons for default mode text
|
|
1042
|
+
"skeleton-from", "skeleton-to"];
|
|
2168
1043
|
const defaultTints = {
|
|
2169
1044
|
light: {
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
bg_accent_active: "700",
|
|
2179
|
-
bg_tint: "50",
|
|
2180
|
-
icon_default: "500",
|
|
2181
|
-
icon_inverted: white$1,
|
|
2182
|
-
border_base: "100",
|
|
2183
|
-
border_accent: "500",
|
|
2184
|
-
border_accent_inverted: white$1
|
|
2185
|
-
},
|
|
2186
|
-
dark: {
|
|
2187
|
-
text_primary: "50",
|
|
2188
|
-
text_secondary: "300",
|
|
2189
|
-
text_inactive: "400",
|
|
2190
|
-
bg_base: black$1,
|
|
2191
|
-
bg_base_hover: "900",
|
|
2192
|
-
bg_base_active: "800",
|
|
2193
|
-
bg_accent: "500",
|
|
2194
|
-
bg_accent_hover: "400",
|
|
2195
|
-
bg_accent_active: "300",
|
|
2196
|
-
bg_tint: "900",
|
|
2197
|
-
icon_default: "300",
|
|
2198
|
-
icon_inverted: hues.gray[900],
|
|
2199
|
-
border_base: "800",
|
|
2200
|
-
border_accent: "300",
|
|
2201
|
-
border_accent_inverted: hues.gray[900]
|
|
2202
|
-
}
|
|
2203
|
-
};
|
|
2204
|
-
const colorTints = {
|
|
2205
|
-
light: {
|
|
2206
|
-
default: {
|
|
2207
|
-
...defaultTints.light,
|
|
2208
|
-
bg_accent: "900",
|
|
2209
|
-
bg_accent_hover: "950",
|
|
2210
|
-
bg_accent_active: black$1,
|
|
2211
|
-
border_accent: "600"
|
|
1045
|
+
"text-primary": "900",
|
|
1046
|
+
"text-secondary": "600",
|
|
1047
|
+
"text-inactive": "500",
|
|
1048
|
+
"text-code": "600",
|
|
1049
|
+
"text-muted": "600",
|
|
1050
|
+
"text-link": {
|
|
1051
|
+
type: "colorTint",
|
|
1052
|
+
value: hues.blue["600"]
|
|
2212
1053
|
},
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
bg_accent_hover: "950",
|
|
2217
|
-
bg_accent_active: black$1,
|
|
2218
|
-
border_accent: "600"
|
|
1054
|
+
"text-accent": {
|
|
1055
|
+
type: "colorTint",
|
|
1056
|
+
value: hues.red["500"]
|
|
2219
1057
|
},
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
bg_base_active: "50",
|
|
2224
|
-
bg_accent: "400",
|
|
2225
|
-
bg_accent_hover: "500",
|
|
2226
|
-
bg_accent_active: "600",
|
|
2227
|
-
border_accent: "400"
|
|
1058
|
+
"bg-base": {
|
|
1059
|
+
type: "colorTint",
|
|
1060
|
+
value: white
|
|
2228
1061
|
},
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
1062
|
+
"bg-base-hover": "50",
|
|
1063
|
+
"bg-base-active": "100",
|
|
1064
|
+
"bg-accent": "500",
|
|
1065
|
+
"bg-accent-hover": "600",
|
|
1066
|
+
"bg-accent-active": "700",
|
|
1067
|
+
"bg-tint": "50",
|
|
1068
|
+
"bg-tint-code": "50",
|
|
1069
|
+
"icon-default": "500",
|
|
1070
|
+
"icon-inverted": {
|
|
1071
|
+
type: "colorTint",
|
|
1072
|
+
value: white
|
|
2240
1073
|
},
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
1074
|
+
"border-base": "100",
|
|
1075
|
+
"border-base-hover": "200",
|
|
1076
|
+
"border-accent": "500",
|
|
1077
|
+
"border-accent-inverted": {
|
|
1078
|
+
type: "colorTint",
|
|
1079
|
+
value: white
|
|
2247
1080
|
},
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
bg_accent: "400",
|
|
2253
|
-
bg_accent_hover: "300",
|
|
2254
|
-
bg_accent_active: "200",
|
|
2255
|
-
border_accent: "400"
|
|
1081
|
+
"base-bg-card": "50",
|
|
1082
|
+
"base-bg-raw": {
|
|
1083
|
+
type: "colorTint",
|
|
1084
|
+
value: white
|
|
2256
1085
|
},
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
} = _ref11;
|
|
2287
|
-
if (name === "default") {
|
|
2288
|
-
const tints2 = hues.gray;
|
|
2289
|
-
const skeletonFrom2 = dark ? tints2[900].hex : tints2[100].hex;
|
|
2290
|
-
return {
|
|
2291
|
-
fg: dark ? white$1.hex : black$1.hex,
|
|
2292
|
-
bg: getColorHex(tones["default"], dark, "default", "bg_base"),
|
|
2293
|
-
border: getColorHex(tones["default"], dark, "default", "border_base"),
|
|
2294
|
-
focusRing: getColorHex(tones["positive"], dark, "positive", "border_accent"),
|
|
2295
|
-
shadow: {
|
|
2296
|
-
outline: rgba(tints2[500].hex, 0.4),
|
|
2297
|
-
umbra: dark ? rgba(tints2[950].hex, 0.4) : rgba(tints2[500].hex, 0.2),
|
|
2298
|
-
penumbra: dark ? rgba(tints2[950].hex, 0.28) : rgba(tints2[500].hex, 0.14),
|
|
2299
|
-
ambient: dark ? rgba(tints2[950].hex, 0.24) : rgba(tints2[500].hex, 0.12)
|
|
2300
|
-
},
|
|
2301
|
-
skeleton: {
|
|
2302
|
-
from: skeletonFrom2,
|
|
2303
|
-
to: rgba(skeletonFrom2, 0.5)
|
|
2304
|
-
}
|
|
2305
|
-
};
|
|
2306
|
-
}
|
|
2307
|
-
if (name === "transparent") {
|
|
2308
|
-
const tints2 = tones.default;
|
|
2309
|
-
const skeletonFrom2 = tints2[dark ? 800 : 200].hex;
|
|
2310
|
-
return {
|
|
2311
|
-
fg: tints2[dark ? 100 : 900].hex,
|
|
2312
|
-
bg: tints2[dark ? 950 : 50].hex,
|
|
2313
|
-
border: tints2[dark ? 800 : 300].hex,
|
|
2314
|
-
focusRing: hues.blue[500].hex,
|
|
2315
|
-
shadow: {
|
|
2316
|
-
outline: rgba(tints2[500].hex, 0.4),
|
|
2317
|
-
umbra: dark ? rgba(tints2[900].hex, 0.4) : rgba(tints2[500].hex, 0.2),
|
|
2318
|
-
penumbra: dark ? rgba(tints2[900].hex, 0.28) : rgba(tints2[500].hex, 0.14),
|
|
2319
|
-
ambient: dark ? rgba(tints2[900].hex, 0.24) : rgba(tints2[500].hex, 0.12)
|
|
2320
|
-
},
|
|
2321
|
-
skeleton: {
|
|
2322
|
-
from: skeletonFrom2,
|
|
2323
|
-
to: rgba(skeletonFrom2, 0.5)
|
|
2324
|
-
}
|
|
2325
|
-
};
|
|
2326
|
-
}
|
|
2327
|
-
const tints = tones[name] || tones.default;
|
|
2328
|
-
const skeletonFrom = tints[dark ? 800 : 200].hex;
|
|
2329
|
-
return {
|
|
2330
|
-
fg: tints[dark ? 100 : 900].hex,
|
|
2331
|
-
bg: getColorHex(tints, dark, name, "bg_base"),
|
|
2332
|
-
border: getColorHex(tints, dark, name, "border_base"),
|
|
2333
|
-
focusRing: getColorHex(tints, dark, name, "border_accent"),
|
|
2334
|
-
shadow: {
|
|
2335
|
-
outline: rgba(tints[500].hex, 0.4),
|
|
2336
|
-
umbra: dark ? rgba(tints[900].hex, 0.4) : rgba(tints[500].hex, 0.2),
|
|
2337
|
-
penumbra: dark ? rgba(tints[900].hex, 0.28) : rgba(tints[500].hex, 0.14),
|
|
2338
|
-
ambient: dark ? rgba(tints[900].hex, 0.24) : rgba(tints[500].hex, 0.12)
|
|
2339
|
-
},
|
|
2340
|
-
skeleton: {
|
|
2341
|
-
from: skeletonFrom,
|
|
2342
|
-
to: rgba(skeletonFrom, 0.5)
|
|
2343
|
-
}
|
|
2344
|
-
};
|
|
2345
|
-
},
|
|
2346
|
-
solid: _ref12 => {
|
|
2347
|
-
let {
|
|
2348
|
-
base,
|
|
2349
|
-
dark,
|
|
2350
|
-
name,
|
|
2351
|
-
state,
|
|
2352
|
-
tone
|
|
2353
|
-
} = _ref12;
|
|
2354
|
-
const mix = dark ? screen : multiply;
|
|
2355
|
-
const mix2 = dark ? multiply : screen;
|
|
2356
|
-
const defaultTints = tones[name] || tones.default;
|
|
2357
|
-
const isNeutral = NEUTRAL_TONES.includes(name) && NEUTRAL_TONES.includes(tone);
|
|
2358
|
-
let tints = tones[tone === "default" ? name : tone] || defaultTints;
|
|
2359
|
-
if (state === "disabled") {
|
|
2360
|
-
tints = defaultTints;
|
|
2361
|
-
const bg2 = getColorHex(tones.default, dark, "default", "bg_tint");
|
|
2362
|
-
const skeletonFrom2 = mix2(bg2, tints[dark ? 200 : 800].hex);
|
|
2363
|
-
return {
|
|
2364
|
-
bg: bg2,
|
|
2365
|
-
bg2: mix2(bg2, tints[dark ? 50 : 950].hex),
|
|
2366
|
-
border: getColorHex(tones.default, dark, "default", "bg_base"),
|
|
2367
|
-
fg: getColorHex(tones.default, dark, "default", "text_inactive"),
|
|
2368
|
-
iconColor: getColorHex(tones.default, dark, "default", "border_base"),
|
|
2369
|
-
muted: {
|
|
2370
|
-
fg: mix(base.bg, tints[dark ? 950 : 50].hex)
|
|
2371
|
-
},
|
|
2372
|
-
accent: {
|
|
2373
|
-
fg: mix(base.bg, tints[dark ? 950 : 50].hex)
|
|
2374
|
-
},
|
|
2375
|
-
link: {
|
|
2376
|
-
fg: mix(base.bg, tints[dark ? 950 : 50].hex)
|
|
2377
|
-
},
|
|
2378
|
-
code: {
|
|
2379
|
-
bg: bg2,
|
|
2380
|
-
fg: mix(base.bg, tints[dark ? 950 : 50].hex)
|
|
2381
|
-
},
|
|
2382
|
-
skeleton: {
|
|
2383
|
-
from: skeletonFrom2,
|
|
2384
|
-
to: rgba(skeletonFrom2, 0.5)
|
|
2385
|
-
}
|
|
2386
|
-
};
|
|
2387
|
-
}
|
|
2388
|
-
if (state === "hovered") {
|
|
2389
|
-
const bg2 = getColorHex(tints, dark, tone, "bg_accent_hover");
|
|
2390
|
-
const skeletonFrom2 = mix2(bg2, tints[dark ? 200 : 800].hex);
|
|
2391
|
-
return {
|
|
2392
|
-
bg: bg2,
|
|
2393
|
-
bg2: mix2(bg2, tints[dark ? 50 : 950].hex),
|
|
2394
|
-
border: bg2,
|
|
2395
|
-
fg: getColorHex(tints, dark, "default", "bg_base"),
|
|
2396
|
-
iconColor: getColorHex(tints, dark, "default", "icon_inverted"),
|
|
2397
|
-
muted: {
|
|
2398
|
-
fg: mix(base.bg, tints[dark ? 800 : 200].hex)
|
|
2399
|
-
},
|
|
2400
|
-
accent: {
|
|
2401
|
-
fg: mix2(bg2, hues.red[dark ? 800 : 200].hex)
|
|
2402
|
-
},
|
|
2403
|
-
link: {
|
|
2404
|
-
fg: mix2(bg2, hues.blue[dark ? 800 : 200].hex)
|
|
2405
|
-
},
|
|
2406
|
-
code: {
|
|
2407
|
-
bg: mix(bg2, tints[dark ? 950 : 50].hex),
|
|
2408
|
-
fg: mix(base.bg, tints[dark ? 800 : 200].hex)
|
|
2409
|
-
},
|
|
2410
|
-
skeleton: {
|
|
2411
|
-
from: skeletonFrom2,
|
|
2412
|
-
to: rgba(skeletonFrom2, 0.5)
|
|
2413
|
-
}
|
|
2414
|
-
};
|
|
2415
|
-
}
|
|
2416
|
-
if (state === "pressed") {
|
|
2417
|
-
const bg2 = getColorHex(tints, dark, tone, "bg_accent_active");
|
|
2418
|
-
const skeletonFrom2 = mix2(bg2, tints[dark ? 200 : 600].hex);
|
|
2419
|
-
return {
|
|
2420
|
-
bg: bg2,
|
|
2421
|
-
bg2: mix2(bg2, tints[dark ? 50 : 950].hex),
|
|
2422
|
-
border: bg2,
|
|
2423
|
-
fg: getColorHex(tints, dark, "default", "bg_base"),
|
|
2424
|
-
iconColor: getColorHex(tints, dark, "default", "icon_inverted"),
|
|
2425
|
-
muted: {
|
|
2426
|
-
fg: mix(base.bg, tints[dark ? 800 : 200].hex)
|
|
2427
|
-
},
|
|
2428
|
-
accent: {
|
|
2429
|
-
fg: mix2(bg2, hues.red[dark ? 800 : 200].hex)
|
|
2430
|
-
},
|
|
2431
|
-
link: {
|
|
2432
|
-
fg: mix2(bg2, hues.blue[dark ? 800 : 200].hex)
|
|
2433
|
-
},
|
|
2434
|
-
code: {
|
|
2435
|
-
bg: mix(bg2, tints[dark ? 950 : 50].hex),
|
|
2436
|
-
fg: mix(base.bg, tints[dark ? 800 : 200].hex)
|
|
2437
|
-
},
|
|
2438
|
-
skeleton: {
|
|
2439
|
-
from: skeletonFrom2,
|
|
2440
|
-
to: rgba(skeletonFrom2, 0.5)
|
|
2441
|
-
}
|
|
2442
|
-
};
|
|
2443
|
-
}
|
|
2444
|
-
if (state === "selected") {
|
|
2445
|
-
if (isNeutral) {
|
|
2446
|
-
tints = tones.primary;
|
|
2447
|
-
}
|
|
2448
|
-
const bg2 = mix(base.bg, tints[dark ? 200 : 800].hex);
|
|
2449
|
-
const skeletonFrom2 = mix2(bg2, tints[dark ? 200 : 800].hex);
|
|
2450
|
-
return {
|
|
2451
|
-
bg: bg2,
|
|
2452
|
-
bg2: mix2(bg2, tints[dark ? 50 : 950].hex),
|
|
2453
|
-
border: bg2,
|
|
2454
|
-
fg: getColorHex(tints, dark, "default", "bg_base"),
|
|
2455
|
-
iconColor: getColorHex(tints, dark, "default", "icon_inverted"),
|
|
2456
|
-
muted: {
|
|
2457
|
-
fg: mix(base.bg, tints[dark ? 800 : 200].hex)
|
|
2458
|
-
},
|
|
2459
|
-
accent: {
|
|
2460
|
-
fg: mix2(bg2, hues.red[dark ? 800 : 200].hex)
|
|
2461
|
-
},
|
|
2462
|
-
link: {
|
|
2463
|
-
fg: mix2(bg2, hues.blue[dark ? 800 : 200].hex)
|
|
2464
|
-
},
|
|
2465
|
-
code: {
|
|
2466
|
-
bg: mix(bg2, tints[dark ? 950 : 50].hex),
|
|
2467
|
-
fg: mix(base.bg, tints[dark ? 800 : 200].hex)
|
|
2468
|
-
},
|
|
2469
|
-
skeleton: {
|
|
2470
|
-
from: skeletonFrom2,
|
|
2471
|
-
to: rgba(skeletonFrom2, 0.5)
|
|
2472
|
-
}
|
|
2473
|
-
};
|
|
1086
|
+
"base-text-color": {
|
|
1087
|
+
type: "colorTint",
|
|
1088
|
+
value: white
|
|
1089
|
+
},
|
|
1090
|
+
"base-shadow-outline-color": {
|
|
1091
|
+
type: "colorWithOpacity",
|
|
1092
|
+
tint: "500",
|
|
1093
|
+
opacity: 0.4
|
|
1094
|
+
},
|
|
1095
|
+
"base-shadow-umbra-color": {
|
|
1096
|
+
type: "colorWithOpacity",
|
|
1097
|
+
tint: "500",
|
|
1098
|
+
opacity: 0.2
|
|
1099
|
+
},
|
|
1100
|
+
"base-shadow-penumbra-color": {
|
|
1101
|
+
type: "colorWithOpacity",
|
|
1102
|
+
tint: "500",
|
|
1103
|
+
opacity: 0.14
|
|
1104
|
+
},
|
|
1105
|
+
"base-shadow-ambient-color": {
|
|
1106
|
+
type: "colorWithOpacity",
|
|
1107
|
+
tint: "500",
|
|
1108
|
+
opacity: 0.12
|
|
1109
|
+
},
|
|
1110
|
+
"skeleton-from": "100",
|
|
1111
|
+
"skeleton-to": {
|
|
1112
|
+
type: "colorWithOpacity",
|
|
1113
|
+
tint: "50",
|
|
1114
|
+
opacity: 0.5
|
|
2474
1115
|
}
|
|
2475
|
-
const bg = getColorHex(tints, dark, tone, "bg_accent");
|
|
2476
|
-
const skeletonFrom = mix2(bg, tints[dark ? 200 : 800].hex);
|
|
2477
|
-
return {
|
|
2478
|
-
bg,
|
|
2479
|
-
bg2: mix2(bg, tints[dark ? 50 : 950].hex),
|
|
2480
|
-
border: bg,
|
|
2481
|
-
fg: getColorHex(tints, dark, "default", "bg_base"),
|
|
2482
|
-
iconColor: getColorHex(tints, dark, "default", "icon_inverted"),
|
|
2483
|
-
muted: {
|
|
2484
|
-
fg: mix(base.bg, tints[dark ? 900 : 100].hex)
|
|
2485
|
-
},
|
|
2486
|
-
accent: {
|
|
2487
|
-
fg: mix2(bg, hues.red[dark ? 900 : 100].hex)
|
|
2488
|
-
},
|
|
2489
|
-
link: {
|
|
2490
|
-
fg: mix2(bg, hues.blue[dark ? 900 : 100].hex)
|
|
2491
|
-
},
|
|
2492
|
-
code: {
|
|
2493
|
-
bg: mix(bg, tints[dark ? 950 : 50].hex),
|
|
2494
|
-
fg: mix(base.bg, tints[dark ? 900 : 100].hex)
|
|
2495
|
-
},
|
|
2496
|
-
skeleton: {
|
|
2497
|
-
from: skeletonFrom,
|
|
2498
|
-
to: rgba(skeletonFrom, 0.5)
|
|
2499
|
-
}
|
|
2500
|
-
};
|
|
2501
1116
|
},
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
tints = tones.primary;
|
|
2574
|
-
}
|
|
2575
|
-
const bg2 = getColorHex(tints, dark, name, "bg_base_active");
|
|
2576
|
-
const skeletonFrom2 = mix(bg2, getColorHex(tints, dark, name, "bg_base_active"));
|
|
2577
|
-
return {
|
|
2578
|
-
bg: bg2,
|
|
2579
|
-
bg2: mix(bg2, tints[dark ? 950 : 50].hex),
|
|
2580
|
-
border: getColorHex(tints, dark, name, "border_base"),
|
|
2581
|
-
fg: getColorHex(tints, dark, tone, "text_primary"),
|
|
2582
|
-
iconColor: getColorHex(tints, dark, name, "icon_default"),
|
|
2583
|
-
muted: {
|
|
2584
|
-
fg: getColorHex(tints, dark, tone, "text_secondary")
|
|
2585
|
-
},
|
|
2586
|
-
accent: {
|
|
2587
|
-
fg: mix(bg2, hues.red[dark ? 400 : 500].hex)
|
|
2588
|
-
},
|
|
2589
|
-
link: {
|
|
2590
|
-
fg: mix(bg2, hues.blue[dark ? 400 : 600].hex)
|
|
2591
|
-
},
|
|
2592
|
-
code: {
|
|
2593
|
-
bg: mix(bg2, tints[dark ? 950 : 50].hex),
|
|
2594
|
-
fg: getColorHex(tints, dark, tone, "text_secondary")
|
|
2595
|
-
},
|
|
2596
|
-
skeleton: {
|
|
2597
|
-
from: skeletonFrom2,
|
|
2598
|
-
to: rgba(skeletonFrom2, 0.5)
|
|
2599
|
-
}
|
|
2600
|
-
};
|
|
2601
|
-
}
|
|
2602
|
-
if (state === "selected") {
|
|
2603
|
-
if (isNeutral) {
|
|
2604
|
-
tints = tones.primary;
|
|
2605
|
-
}
|
|
2606
|
-
const bg2 = mix(base.bg, tints[dark ? 900 : 100].hex);
|
|
2607
|
-
const skeletonFrom2 = mix(bg2, tints[dark ? 900 : 100].hex);
|
|
2608
|
-
return {
|
|
2609
|
-
bg: bg2,
|
|
2610
|
-
bg2: mix(bg2, tints[dark ? 950 : 50].hex),
|
|
2611
|
-
border: getColorHex(tints, dark, name, "border_base"),
|
|
2612
|
-
fg: getColorHex(tints, dark, tone, "text_primary"),
|
|
2613
|
-
iconColor: getColorHex(tints, dark, name, "icon_default"),
|
|
2614
|
-
muted: {
|
|
2615
|
-
fg: getColorHex(tints, dark, tone, "text_secondary")
|
|
2616
|
-
},
|
|
2617
|
-
accent: {
|
|
2618
|
-
fg: mix(bg2, hues.red[dark ? 400 : 500].hex)
|
|
2619
|
-
},
|
|
2620
|
-
link: {
|
|
2621
|
-
fg: mix(bg2, hues.blue[dark ? 400 : 600].hex)
|
|
2622
|
-
},
|
|
2623
|
-
code: {
|
|
2624
|
-
bg: mix(bg2, tints[dark ? 950 : 50].hex),
|
|
2625
|
-
fg: getColorHex(tints, dark, tone, "text_secondary")
|
|
2626
|
-
},
|
|
2627
|
-
skeleton: {
|
|
2628
|
-
from: skeletonFrom2,
|
|
2629
|
-
to: rgba(skeletonFrom2, 0.5)
|
|
2630
|
-
}
|
|
2631
|
-
};
|
|
1117
|
+
dark: {
|
|
1118
|
+
"text-primary": "50",
|
|
1119
|
+
"text-secondary": "300",
|
|
1120
|
+
"text-inactive": "400",
|
|
1121
|
+
"text-code": "400",
|
|
1122
|
+
"text-muted": "400",
|
|
1123
|
+
"text-link": {
|
|
1124
|
+
type: "colorTint",
|
|
1125
|
+
value: hues.blue["400"]
|
|
1126
|
+
},
|
|
1127
|
+
"text-accent": {
|
|
1128
|
+
type: "colorTint",
|
|
1129
|
+
value: hues.red["400"]
|
|
1130
|
+
},
|
|
1131
|
+
"bg-base": {
|
|
1132
|
+
type: "colorTint",
|
|
1133
|
+
value: black
|
|
1134
|
+
},
|
|
1135
|
+
"bg-base-hover": "900",
|
|
1136
|
+
"bg-base-active": "800",
|
|
1137
|
+
"bg-accent": "500",
|
|
1138
|
+
"bg-accent-hover": "400",
|
|
1139
|
+
"bg-accent-active": "300",
|
|
1140
|
+
"bg-tint": "900",
|
|
1141
|
+
"bg-tint-code": "950",
|
|
1142
|
+
"icon-default": "300",
|
|
1143
|
+
"icon-inverted": {
|
|
1144
|
+
type: "colorTint",
|
|
1145
|
+
value: hues.gray[900]
|
|
1146
|
+
},
|
|
1147
|
+
"border-base": "800",
|
|
1148
|
+
"border-base-hover": "700",
|
|
1149
|
+
"border-accent": "300",
|
|
1150
|
+
"border-accent-inverted": {
|
|
1151
|
+
type: "colorTint",
|
|
1152
|
+
value: hues.gray[900]
|
|
1153
|
+
},
|
|
1154
|
+
"base-bg-card": "950",
|
|
1155
|
+
"base-text-color": {
|
|
1156
|
+
type: "colorTint",
|
|
1157
|
+
value: black
|
|
1158
|
+
},
|
|
1159
|
+
"base-shadow-outline-color": {
|
|
1160
|
+
type: "colorWithOpacity",
|
|
1161
|
+
tint: "500",
|
|
1162
|
+
opacity: 0.4
|
|
1163
|
+
},
|
|
1164
|
+
"base-shadow-umbra-color": {
|
|
1165
|
+
type: "colorWithOpacity",
|
|
1166
|
+
tint: "900",
|
|
1167
|
+
opacity: 0.4
|
|
1168
|
+
},
|
|
1169
|
+
"base-shadow-penumbra-color": {
|
|
1170
|
+
type: "colorWithOpacity",
|
|
1171
|
+
tint: "900",
|
|
1172
|
+
opacity: 0.28
|
|
1173
|
+
},
|
|
1174
|
+
"base-shadow-ambient-color": {
|
|
1175
|
+
type: "colorWithOpacity",
|
|
1176
|
+
tint: "900",
|
|
1177
|
+
opacity: 0.24
|
|
1178
|
+
},
|
|
1179
|
+
"base-bg-raw": {
|
|
1180
|
+
type: "colorTint",
|
|
1181
|
+
value: black
|
|
1182
|
+
},
|
|
1183
|
+
"skeleton-from": "900",
|
|
1184
|
+
"skeleton-to": {
|
|
1185
|
+
type: "colorWithOpacity",
|
|
1186
|
+
tint: "50",
|
|
1187
|
+
opacity: 0.5
|
|
2632
1188
|
}
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
fg: getColorHex(tints, dark, tone, "text_secondary")
|
|
1189
|
+
}
|
|
1190
|
+
};
|
|
1191
|
+
const colorTints = {
|
|
1192
|
+
light: {
|
|
1193
|
+
default: {
|
|
1194
|
+
...defaultTints.light,
|
|
1195
|
+
"base-bg-card": {
|
|
1196
|
+
type: "colorTint",
|
|
1197
|
+
value: white
|
|
2643
1198
|
},
|
|
2644
|
-
accent:
|
|
2645
|
-
|
|
1199
|
+
"bg-accent": "900",
|
|
1200
|
+
"bg-accent-hover": "950",
|
|
1201
|
+
"bg-accent-active": {
|
|
1202
|
+
type: "colorTint",
|
|
1203
|
+
value: black
|
|
2646
1204
|
},
|
|
2647
|
-
|
|
2648
|
-
|
|
1205
|
+
"border-accent": "600"
|
|
1206
|
+
},
|
|
1207
|
+
primary: {
|
|
1208
|
+
...defaultTints.light,
|
|
1209
|
+
"bg-accent": "900",
|
|
1210
|
+
"bg-accent-hover": "950",
|
|
1211
|
+
"bg-accent-active": {
|
|
1212
|
+
type: "colorTint",
|
|
1213
|
+
value: black
|
|
2649
1214
|
},
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
1215
|
+
"border-accent": "600"
|
|
1216
|
+
},
|
|
1217
|
+
positive: {
|
|
1218
|
+
...defaultTints.light,
|
|
1219
|
+
"bg-base-hover": {
|
|
1220
|
+
type: "colorTint",
|
|
1221
|
+
value: hues.gray[50]
|
|
2653
1222
|
},
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
solid
|
|
2666
|
-
} = _ref14;
|
|
2667
|
-
if (mode === "bleed") {
|
|
2668
|
-
return {
|
|
2669
|
-
enabled: {
|
|
2670
|
-
...muted.enabled,
|
|
2671
|
-
border: muted.enabled.bg
|
|
2672
|
-
},
|
|
2673
|
-
hovered: {
|
|
2674
|
-
...muted.hovered,
|
|
2675
|
-
border: muted.hovered.bg
|
|
2676
|
-
},
|
|
2677
|
-
pressed: {
|
|
2678
|
-
...muted.pressed,
|
|
2679
|
-
border: muted.pressed.bg
|
|
2680
|
-
},
|
|
2681
|
-
selected: {
|
|
2682
|
-
...muted.selected,
|
|
2683
|
-
border: muted.selected.bg
|
|
2684
|
-
},
|
|
2685
|
-
disabled: {
|
|
2686
|
-
...muted.disabled,
|
|
2687
|
-
border: muted.disabled.bg
|
|
2688
|
-
}
|
|
2689
|
-
};
|
|
2690
|
-
}
|
|
2691
|
-
if (mode === "ghost") {
|
|
2692
|
-
return {
|
|
2693
|
-
...muted,
|
|
2694
|
-
enabled: {
|
|
2695
|
-
...muted.enabled,
|
|
2696
|
-
border: base.border
|
|
2697
|
-
}
|
|
2698
|
-
};
|
|
1223
|
+
"bg-base-active": "50",
|
|
1224
|
+
"bg-accent": "400",
|
|
1225
|
+
"bg-accent-hover": "500",
|
|
1226
|
+
"bg-accent-active": "600",
|
|
1227
|
+
"border-accent": "400"
|
|
1228
|
+
},
|
|
1229
|
+
transparent: defaultTints.light,
|
|
1230
|
+
caution: defaultTints.light,
|
|
1231
|
+
critical: {
|
|
1232
|
+
...defaultTints.light,
|
|
1233
|
+
"text-inactive": "300"
|
|
2699
1234
|
}
|
|
2700
|
-
return solid;
|
|
2701
1235
|
},
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
solid,
|
|
2709
|
-
state
|
|
2710
|
-
} = _ref15;
|
|
2711
|
-
if (state === "hovered") {
|
|
2712
|
-
return muted[name].hovered;
|
|
2713
|
-
}
|
|
2714
|
-
if (state === "disabled") {
|
|
2715
|
-
return muted[name].disabled;
|
|
2716
|
-
}
|
|
2717
|
-
const isNeutral = NEUTRAL_TONES.includes(name);
|
|
2718
|
-
const tints = tones[name] || tones.default;
|
|
2719
|
-
const mix = dark ? screen : multiply;
|
|
2720
|
-
if (state === "pressed") {
|
|
2721
|
-
if (isNeutral) {
|
|
2722
|
-
return muted.primary.pressed;
|
|
2723
|
-
}
|
|
2724
|
-
return muted[name].pressed;
|
|
2725
|
-
}
|
|
2726
|
-
if (state === "selected") {
|
|
2727
|
-
if (isNeutral) {
|
|
2728
|
-
return solid.primary.enabled;
|
|
2729
|
-
}
|
|
2730
|
-
return solid[name].enabled;
|
|
2731
|
-
}
|
|
2732
|
-
const bg = base.bg;
|
|
2733
|
-
const skeletonFrom = mix(base.bg, tints[dark ? 900 : 100].hex);
|
|
2734
|
-
return {
|
|
2735
|
-
bg,
|
|
2736
|
-
bg2: mix(bg, tints[dark ? 950 : 50].hex),
|
|
2737
|
-
fg: base.fg,
|
|
2738
|
-
iconColor: getColorHex(tints, dark, name, "icon_default"),
|
|
2739
|
-
border: base.border,
|
|
2740
|
-
muted: {
|
|
2741
|
-
fg: mix(base.bg, tints[dark ? 400 : 600].hex)
|
|
1236
|
+
dark: {
|
|
1237
|
+
default: {
|
|
1238
|
+
...defaultTints.dark,
|
|
1239
|
+
"base-bg-card": {
|
|
1240
|
+
type: "colorTint",
|
|
1241
|
+
value: black
|
|
2742
1242
|
},
|
|
2743
|
-
|
|
2744
|
-
|
|
1243
|
+
"text-primary": {
|
|
1244
|
+
type: "colorTint",
|
|
1245
|
+
value: white
|
|
2745
1246
|
},
|
|
2746
|
-
|
|
2747
|
-
|
|
1247
|
+
"bg-accent": {
|
|
1248
|
+
type: "colorTint",
|
|
1249
|
+
value: white
|
|
2748
1250
|
},
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
1251
|
+
"bg-accent-hover": "50",
|
|
1252
|
+
"bg-accent-active": "100",
|
|
1253
|
+
"base-shadow-umbra-color": {
|
|
1254
|
+
type: "colorWithOpacity",
|
|
1255
|
+
tint: "950",
|
|
1256
|
+
opacity: 0.4
|
|
2752
1257
|
},
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
dark,
|
|
2763
|
-
mode,
|
|
2764
|
-
state
|
|
2765
|
-
} = _ref16;
|
|
2766
|
-
const mix = dark ? screen : multiply;
|
|
2767
|
-
if (mode === "invalid") {
|
|
2768
|
-
const tints = tones.critical;
|
|
2769
|
-
return {
|
|
2770
|
-
bg: mix(base.bg, tints[dark ? 950 : 50].hex),
|
|
2771
|
-
bg2: getColorHex(tints, dark, "critical", "text_secondary"),
|
|
2772
|
-
fg: mix(base.bg, tints[dark ? 400 : 600].hex),
|
|
2773
|
-
border: getColorHex(tints, dark, "critical", "border_base"),
|
|
2774
|
-
placeholder: getColorHex(tones.default, !dark, "default", "text_secondary")
|
|
2775
|
-
};
|
|
2776
|
-
}
|
|
2777
|
-
if (state === "hovered") {
|
|
2778
|
-
return {
|
|
2779
|
-
bg: base.bg,
|
|
2780
|
-
bg2: getColorHex(tones.default, dark, "default", "text_secondary"),
|
|
2781
|
-
fg: base.fg,
|
|
2782
|
-
border: mix(base.bg, hues.gray[dark ? 700 : 300].hex),
|
|
2783
|
-
placeholder: getColorHex(tones.default, !dark, "default", "text_secondary")
|
|
2784
|
-
};
|
|
2785
|
-
}
|
|
2786
|
-
if (state === "disabled") {
|
|
2787
|
-
return {
|
|
2788
|
-
bg: getColorHex(tones.default, dark, "default", "bg_tint"),
|
|
2789
|
-
bg2: getColorHex(tones.default, dark, "default", "border_base"),
|
|
2790
|
-
fg: getColorHex(tones.default, dark, "default", "text_secondary"),
|
|
2791
|
-
border: getColorHex(tones.default, dark, "default", "border_base"),
|
|
2792
|
-
placeholder: getColorHex(tones.default, !dark, "default", "text_secondary")
|
|
2793
|
-
};
|
|
2794
|
-
}
|
|
2795
|
-
if (state === "readOnly") {
|
|
2796
|
-
return {
|
|
2797
|
-
bg: getColorHex(tones.default, dark, "default", "bg_tint"),
|
|
2798
|
-
bg2: getColorHex(tones.default, dark, "default", "border_base"),
|
|
2799
|
-
fg: getColorHex(tones.default, dark, "default", "text_secondary"),
|
|
2800
|
-
border: getColorHex(tones.default, dark, "default", "border_base"),
|
|
2801
|
-
placeholder: getColorHex(tones.default, !dark, "default", "text_secondary")
|
|
2802
|
-
};
|
|
2803
|
-
}
|
|
2804
|
-
return {
|
|
2805
|
-
bg: base.bg,
|
|
2806
|
-
bg2: getColorHex(tones.default, dark, "default", "text_secondary"),
|
|
2807
|
-
fg: base.fg,
|
|
2808
|
-
border: base.border,
|
|
2809
|
-
placeholder: getColorHex(tones.default, !dark, "default", "text_secondary")
|
|
2810
|
-
};
|
|
2811
|
-
},
|
|
2812
|
-
selectable: _ref17 => {
|
|
2813
|
-
let {
|
|
2814
|
-
base,
|
|
2815
|
-
muted,
|
|
2816
|
-
tone,
|
|
2817
|
-
solid,
|
|
2818
|
-
state
|
|
2819
|
-
} = _ref17;
|
|
2820
|
-
if (state === "enabled") {
|
|
2821
|
-
return {
|
|
2822
|
-
...muted[tone].enabled,
|
|
2823
|
-
bg: base.bg
|
|
2824
|
-
};
|
|
2825
|
-
}
|
|
2826
|
-
if (state === "pressed") {
|
|
2827
|
-
if (tone === "default") {
|
|
2828
|
-
return muted.primary.pressed;
|
|
2829
|
-
}
|
|
2830
|
-
return muted[tone].pressed;
|
|
2831
|
-
}
|
|
2832
|
-
if (state === "selected") {
|
|
2833
|
-
if (tone === "default") {
|
|
2834
|
-
return solid.primary.enabled;
|
|
1258
|
+
"base-shadow-penumbra-color": {
|
|
1259
|
+
type: "colorWithOpacity",
|
|
1260
|
+
tint: "950",
|
|
1261
|
+
opacity: 0.28
|
|
1262
|
+
},
|
|
1263
|
+
"base-shadow-ambient-color": {
|
|
1264
|
+
type: "colorWithOpacity",
|
|
1265
|
+
tint: "950",
|
|
1266
|
+
opacity: 0.24
|
|
2835
1267
|
}
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
}
|
|
1268
|
+
},
|
|
1269
|
+
primary: {
|
|
1270
|
+
...defaultTints.dark,
|
|
1271
|
+
"text-primary": {
|
|
1272
|
+
type: "colorTint",
|
|
1273
|
+
value: white
|
|
1274
|
+
},
|
|
1275
|
+
"bg-accent": {
|
|
1276
|
+
type: "colorTint",
|
|
1277
|
+
value: white
|
|
1278
|
+
},
|
|
1279
|
+
"bg-accent-hover": "50",
|
|
1280
|
+
"bg-accent-active": "100"
|
|
1281
|
+
},
|
|
1282
|
+
positive: {
|
|
1283
|
+
...defaultTints.dark,
|
|
1284
|
+
"bg-base-hover": {
|
|
1285
|
+
type: "colorTint",
|
|
1286
|
+
value: hues.gray[900]
|
|
1287
|
+
},
|
|
1288
|
+
"bg-base-active": "900",
|
|
1289
|
+
"bg-accent": "400",
|
|
1290
|
+
"bg-accent-hover": "300",
|
|
1291
|
+
"bg-accent-active": "200",
|
|
1292
|
+
"border-accent": "400"
|
|
1293
|
+
},
|
|
1294
|
+
transparent: defaultTints.dark,
|
|
1295
|
+
caution: defaultTints.dark,
|
|
1296
|
+
critical: {
|
|
1297
|
+
...defaultTints.dark,
|
|
1298
|
+
"text-inactive": "700"
|
|
2843
1299
|
}
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
const
|
|
2853
|
-
return mix(base.bg, hues[key][dark ? 400 : 500].hex);
|
|
2854
|
-
},
|
|
2855
|
-
syntax: _ref19 => {
|
|
2856
|
-
let {
|
|
2857
|
-
base,
|
|
2858
|
-
dark
|
|
2859
|
-
} = _ref19;
|
|
2860
|
-
const mix = dark ? screen : multiply;
|
|
2861
|
-
const mainShade = dark ? 400 : 600;
|
|
2862
|
-
const secondaryShade = dark ? 600 : 400;
|
|
1300
|
+
}
|
|
1301
|
+
};
|
|
1302
|
+
const getColorValue = (tints, scheme, tone, key) => {
|
|
1303
|
+
const value = colorTints[scheme][tone][key];
|
|
1304
|
+
if (typeof value === "string") {
|
|
1305
|
+
return tints[value];
|
|
1306
|
+
}
|
|
1307
|
+
if (value.type === "colorWithOpacity") {
|
|
1308
|
+
const base = tints[value.tint];
|
|
2863
1309
|
return {
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
attrValue: mix(base.bg, hues.yellow[mainShade].hex),
|
|
2867
|
-
attribute: mix(base.bg, hues.yellow[mainShade].hex),
|
|
2868
|
-
boolean: mix(base.bg, hues.purple[mainShade].hex),
|
|
2869
|
-
builtin: mix(base.bg, hues.purple[mainShade].hex),
|
|
2870
|
-
cdata: mix(base.bg, hues.yellow[mainShade].hex),
|
|
2871
|
-
char: mix(base.bg, hues.yellow[mainShade].hex),
|
|
2872
|
-
class: mix(base.bg, hues.orange[mainShade].hex),
|
|
2873
|
-
className: mix(base.bg, hues.cyan[mainShade].hex),
|
|
2874
|
-
comment: mix(base.bg, hues.gray[secondaryShade].hex),
|
|
2875
|
-
constant: mix(base.bg, hues.purple[mainShade].hex),
|
|
2876
|
-
deleted: mix(base.bg, hues.red[mainShade].hex),
|
|
2877
|
-
doctype: mix(base.bg, hues.gray[secondaryShade].hex),
|
|
2878
|
-
entity: mix(base.bg, hues.red[mainShade].hex),
|
|
2879
|
-
function: mix(base.bg, hues.green[mainShade].hex),
|
|
2880
|
-
hexcode: mix(base.bg, hues.blue[mainShade].hex),
|
|
2881
|
-
id: mix(base.bg, hues.purple[mainShade].hex),
|
|
2882
|
-
important: mix(base.bg, hues.purple[mainShade].hex),
|
|
2883
|
-
inserted: mix(base.bg, hues.yellow[mainShade].hex),
|
|
2884
|
-
keyword: mix(base.bg, hues.magenta[mainShade].hex),
|
|
2885
|
-
number: mix(base.bg, hues.purple[mainShade].hex),
|
|
2886
|
-
operator: mix(base.bg, hues.magenta[mainShade].hex),
|
|
2887
|
-
prolog: mix(base.bg, hues.gray[secondaryShade].hex),
|
|
2888
|
-
property: mix(base.bg, hues.blue[mainShade].hex),
|
|
2889
|
-
pseudoClass: mix(base.bg, hues.yellow[mainShade].hex),
|
|
2890
|
-
pseudoElement: mix(base.bg, hues.yellow[mainShade].hex),
|
|
2891
|
-
punctuation: mix(base.bg, hues.gray[mainShade].hex),
|
|
2892
|
-
regex: mix(base.bg, hues.blue[mainShade].hex),
|
|
2893
|
-
selector: mix(base.bg, hues.red[mainShade].hex),
|
|
2894
|
-
string: mix(base.bg, hues.yellow[mainShade].hex),
|
|
2895
|
-
symbol: mix(base.bg, hues.purple[mainShade].hex),
|
|
2896
|
-
tag: mix(base.bg, hues.red[mainShade].hex),
|
|
2897
|
-
unit: mix(base.bg, hues.orange[mainShade].hex),
|
|
2898
|
-
url: mix(base.bg, hues.red[mainShade].hex),
|
|
2899
|
-
variable: mix(base.bg, hues.red[mainShade].hex)
|
|
1310
|
+
hex: rgba(base.hex, value.opacity),
|
|
1311
|
+
title: "".concat(base.title, " ").concat(Math.round(value.opacity * 100), "%")
|
|
2900
1312
|
};
|
|
2901
1313
|
}
|
|
2902
|
-
|
|
1314
|
+
return value.value;
|
|
1315
|
+
};
|
|
1316
|
+
const getColorHex = (tints, scheme, tone, key) => {
|
|
1317
|
+
return getColorValue(tints, scheme, tone, key).hex;
|
|
1318
|
+
};
|
|
1319
|
+
const getToneCssVar = (tone, key) => "--".concat(tone, "-").concat(key);
|
|
1320
|
+
const createTonesVariables = function (scheme, tones) {
|
|
1321
|
+
let defaultTone = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "default";
|
|
1322
|
+
let baseBg = arguments.length > 3 ? arguments[3] : undefined;
|
|
1323
|
+
const tonesVariables = {};
|
|
1324
|
+
const keys = Object.keys(tones);
|
|
1325
|
+
const mix = scheme === "dark" ? screen : multiply;
|
|
1326
|
+
const needsMixing = defaultTone !== "default";
|
|
1327
|
+
keys.forEach(_tone => {
|
|
1328
|
+
const tone = _tone == "default" ? defaultTone : _tone;
|
|
1329
|
+
const tint = tones[tone];
|
|
1330
|
+
colorKeys.forEach(key => {
|
|
1331
|
+
const colorHex = getColorHex(tint, scheme, tone, key);
|
|
1332
|
+
const varName = getToneCssVar(_tone, key);
|
|
1333
|
+
const willBeMixed = needsMixing && !key.startsWith("base-");
|
|
1334
|
+
tonesVariables[varName] = willBeMixed ? mix(baseBg, colorHex) : colorHex;
|
|
1335
|
+
});
|
|
1336
|
+
});
|
|
1337
|
+
if (defaultTone !== "default") {
|
|
1338
|
+
tonesVariables[getToneCssVar("default", "bg-base")] = tonesCssVariables.default["base-bg-card"];
|
|
1339
|
+
}
|
|
1340
|
+
return tonesVariables;
|
|
1341
|
+
};
|
|
1342
|
+
const themeNames = ["default", "transparent", "primary", "positive", "caution", "critical"];
|
|
1343
|
+
const tonesCssVariables = themeNames.reduce((acc, tone) => {
|
|
1344
|
+
acc[tone] = colorKeys.reduce((acc2, key) => {
|
|
1345
|
+
acc2[key] = "var(".concat(getToneCssVar(tone, key), ")");
|
|
1346
|
+
return acc2;
|
|
1347
|
+
}, {});
|
|
1348
|
+
return acc;
|
|
1349
|
+
}, {});
|
|
1350
|
+
const mutableCardVariables = {
|
|
1351
|
+
"bg-color": "--card-bg-color",
|
|
1352
|
+
"muted-fg-color": "--card-muted-fg-color",
|
|
1353
|
+
"icon-color": "--card-icon-color",
|
|
1354
|
+
"fg-color": "--card-fg-color",
|
|
1355
|
+
"bg-image": "--card-bg-image",
|
|
1356
|
+
"accent-color": "--card-accent-fg-color"
|
|
1357
|
+
};
|
|
1358
|
+
const mutableVariables = Object.keys(mutableCardVariables).reduce((acc, key) => {
|
|
1359
|
+
const item = key;
|
|
1360
|
+
acc[item] = "var(".concat(mutableCardVariables[item], ")");
|
|
1361
|
+
return acc;
|
|
1362
|
+
}, {});
|
|
1363
|
+
const cardVariables = {
|
|
1364
|
+
"--card-shadow-outline-color": tonesCssVariables.default["base-shadow-outline-color"],
|
|
1365
|
+
"--card-shadow-umbra-color": tonesCssVariables.default["base-shadow-umbra-color"],
|
|
1366
|
+
"--card-shadow-penumbra-color": tonesCssVariables.default["base-shadow-penumbra-color"],
|
|
1367
|
+
"--card-shadow-ambient-color": tonesCssVariables.default["base-shadow-ambient-color"],
|
|
1368
|
+
"--card-focus-ring-color": tonesCssVariables.positive["bg-accent"],
|
|
1369
|
+
"--card-icon-color": tonesCssVariables.default["icon-default"],
|
|
1370
|
+
"--card-bg-image": "inherit",
|
|
1371
|
+
// Card
|
|
1372
|
+
"--card-bg-color": tonesCssVariables.default["bg-base"],
|
|
1373
|
+
"--card-fg-color": tonesCssVariables.default["text-primary"],
|
|
1374
|
+
"--card-muted-fg-color": tonesCssVariables.default["text-secondary"],
|
|
1375
|
+
"--card-accent-fg-color": tonesCssVariables.default["text-accent"],
|
|
1376
|
+
"--card-link-fg-color": tonesCssVariables.default["text-link"],
|
|
1377
|
+
"--card-code-bg-color": tonesCssVariables.default["bg-tint-code"],
|
|
1378
|
+
"--card-code-fg-color": tonesCssVariables.default["text-code"],
|
|
1379
|
+
"--card-skeleton-color-from": tonesCssVariables.default["skeleton-from"],
|
|
1380
|
+
"--card-skeleton-color-to": tonesCssVariables.default["skeleton-to"],
|
|
1381
|
+
// @todo: deprecate
|
|
1382
|
+
"--card-link-color": tonesCssVariables.default["text-link"],
|
|
1383
|
+
"--card-hairline-soft-color": tonesCssVariables.default["border-base"],
|
|
1384
|
+
"--card-hairline-hard-color": tonesCssVariables.default["border-base"],
|
|
1385
|
+
// Card
|
|
1386
|
+
"--card-bg2-color": tonesCssVariables.default["bg-tint"]
|
|
1387
|
+
};
|
|
1388
|
+
const createCssVars = function (scheme, tones) {
|
|
1389
|
+
let defaultTone = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "default";
|
|
1390
|
+
const baseBg = getColorHex(tones[defaultTone], scheme, defaultTone, "base-bg-card");
|
|
1391
|
+
const tonesVars = createTonesVariables(scheme, tones, defaultTone, baseBg);
|
|
1392
|
+
return {
|
|
1393
|
+
...tonesVars,
|
|
1394
|
+
...cardVariables
|
|
1395
|
+
};
|
|
1396
|
+
};
|
|
1397
|
+
const cssVars = {
|
|
1398
|
+
...tonesCssVariables,
|
|
1399
|
+
/**
|
|
1400
|
+
* This variables are mutable, they can be updated by other components.
|
|
1401
|
+
* The main component that updates them is the card, these are the only ones that should be exposed for use from the cards.
|
|
1402
|
+
*/
|
|
1403
|
+
mutable: mutableVariables
|
|
1404
|
+
};
|
|
1405
|
+
const tones = {
|
|
1406
|
+
default: hues.gray,
|
|
1407
|
+
transparent: hues.gray,
|
|
1408
|
+
primary: hues.gray,
|
|
1409
|
+
positive: hues.cyan,
|
|
1410
|
+
caution: hues.yellow,
|
|
1411
|
+
critical: hues.red
|
|
1412
|
+
};
|
|
2903
1413
|
const fonts = {
|
|
2904
1414
|
code: {
|
|
2905
1415
|
family: "ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace",
|
|
@@ -3119,7 +1629,14 @@ const studioTheme = {
|
|
|
3119
1629
|
width: 1
|
|
3120
1630
|
}
|
|
3121
1631
|
},
|
|
3122
|
-
color
|
|
1632
|
+
color: {
|
|
1633
|
+
tones,
|
|
1634
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1635
|
+
// @ts-ignore This is necessary until workshop is updated.
|
|
1636
|
+
base: {
|
|
1637
|
+
bg: "#fffff"
|
|
1638
|
+
}
|
|
1639
|
+
},
|
|
3123
1640
|
container: [320, 640, 960, 1280, 1600, 1920],
|
|
3124
1641
|
focusRing: {
|
|
3125
1642
|
offset: 1,
|
|
@@ -3218,6 +1735,11 @@ const DEFAULT_THEME_LAYER = {
|
|
|
3218
1735
|
zOffset: 200
|
|
3219
1736
|
}
|
|
3220
1737
|
};
|
|
1738
|
+
function cssObjectToCssString(rules) {
|
|
1739
|
+
return Object.keys(rules).reduce((acc, key) => {
|
|
1740
|
+
return "".concat(acc).concat(key, ": ").concat(rules[key], "; ");
|
|
1741
|
+
}, "");
|
|
1742
|
+
}
|
|
3221
1743
|
function getGlobalScope() {
|
|
3222
1744
|
if (typeof globalThis !== "undefined") return globalThis;
|
|
3223
1745
|
if (typeof window !== "undefined") return window;
|
|
@@ -3226,9 +1748,41 @@ function getGlobalScope() {
|
|
|
3226
1748
|
throw new Error("@sanity/ui: could not locate global scope");
|
|
3227
1749
|
}
|
|
3228
1750
|
const globalScope = getGlobalScope();
|
|
3229
|
-
const key$
|
|
1751
|
+
const key$9 = Symbol.for("@sanity/ui/context/theme");
|
|
1752
|
+
globalScope[key$9] = globalScope[key$9] || createContext(null);
|
|
1753
|
+
const ThemeContext = globalScope[key$9];
|
|
1754
|
+
const key$8 = Symbol.for("@sanity/ui/context/toneContext");
|
|
3230
1755
|
globalScope[key$8] = globalScope[key$8] || createContext(null);
|
|
3231
|
-
const
|
|
1756
|
+
const ToneContext = globalScope[key$8];
|
|
1757
|
+
function ToneProvider(props) {
|
|
1758
|
+
const {
|
|
1759
|
+
children,
|
|
1760
|
+
scheme,
|
|
1761
|
+
tone
|
|
1762
|
+
} = props;
|
|
1763
|
+
const root = useRootTheme();
|
|
1764
|
+
const value = useMemo(() => ({
|
|
1765
|
+
version: 0,
|
|
1766
|
+
scheme: scheme || root.scheme,
|
|
1767
|
+
tone
|
|
1768
|
+
}), [root.scheme, scheme, tone]);
|
|
1769
|
+
return /* @__PURE__ */jsx(ToneContext.Provider, {
|
|
1770
|
+
value,
|
|
1771
|
+
children
|
|
1772
|
+
});
|
|
1773
|
+
}
|
|
1774
|
+
var __freeze$E = Object.freeze;
|
|
1775
|
+
var __defProp$F = Object.defineProperty;
|
|
1776
|
+
var __template$E = (cooked, raw) => __freeze$E(__defProp$F(cooked, "raw", {
|
|
1777
|
+
value: __freeze$E(raw || cooked.slice())
|
|
1778
|
+
}));
|
|
1779
|
+
var _a$E;
|
|
1780
|
+
const GlobalVariables = createGlobalStyle(_a$E || (_a$E = __template$E(["\n :root {\n ", "\n }\n"])), _ref4 => {
|
|
1781
|
+
let {
|
|
1782
|
+
$vars
|
|
1783
|
+
} = _ref4;
|
|
1784
|
+
return $vars;
|
|
1785
|
+
});
|
|
3232
1786
|
function ThemeProvider(props) {
|
|
3233
1787
|
const parentTheme = useContext(ThemeContext);
|
|
3234
1788
|
const {
|
|
@@ -3240,38 +1794,44 @@ function ThemeProvider(props) {
|
|
|
3240
1794
|
const theme = useMemo(() => {
|
|
3241
1795
|
if (!themeProp) return null;
|
|
3242
1796
|
const {
|
|
3243
|
-
color: rootColor,
|
|
3244
1797
|
layer: rootLayer,
|
|
3245
1798
|
...restTheme
|
|
3246
1799
|
} = themeProp;
|
|
3247
|
-
const colorScheme = rootColor[scheme] || rootColor.light;
|
|
3248
|
-
const color = colorScheme[tone] || colorScheme.default;
|
|
3249
1800
|
const layer = rootLayer || DEFAULT_THEME_LAYER;
|
|
3250
1801
|
return {
|
|
3251
1802
|
sanity: {
|
|
3252
1803
|
...restTheme,
|
|
3253
|
-
color,
|
|
3254
1804
|
layer
|
|
3255
1805
|
}
|
|
3256
1806
|
};
|
|
3257
|
-
}, [
|
|
1807
|
+
}, [themeProp]);
|
|
3258
1808
|
const value = useMemo(() => themeProp && {
|
|
3259
1809
|
version: 0,
|
|
3260
1810
|
theme: themeProp,
|
|
3261
1811
|
scheme,
|
|
3262
1812
|
tone
|
|
3263
1813
|
}, [themeProp, scheme, tone]);
|
|
1814
|
+
const cssVariables = useMemo(() => {
|
|
1815
|
+
if (!(themeProp == null ? void 0 : themeProp.color.tones)) return;
|
|
1816
|
+
return cssObjectToCssString(createCssVars(scheme, themeProp == null ? void 0 : themeProp.color.tones));
|
|
1817
|
+
}, [scheme, themeProp == null ? void 0 : themeProp.color.tones]);
|
|
3264
1818
|
if (!theme) {
|
|
3265
1819
|
return /* @__PURE__ */jsx("pre", {
|
|
3266
1820
|
children: 'ThemeProvider: no "theme" property provided'
|
|
3267
1821
|
});
|
|
3268
1822
|
}
|
|
3269
|
-
return /* @__PURE__ */
|
|
1823
|
+
return /* @__PURE__ */jsxs(ThemeContext.Provider, {
|
|
3270
1824
|
value,
|
|
3271
|
-
children: /* @__PURE__ */jsx(
|
|
1825
|
+
children: [/* @__PURE__ */jsx(GlobalVariables, {
|
|
1826
|
+
$vars: cssVariables
|
|
1827
|
+
}), /* @__PURE__ */jsx(ThemeProvider$1, {
|
|
3272
1828
|
theme,
|
|
3273
|
-
children
|
|
3274
|
-
|
|
1829
|
+
children: /* @__PURE__ */jsx(ToneProvider, {
|
|
1830
|
+
tone,
|
|
1831
|
+
scheme,
|
|
1832
|
+
children
|
|
1833
|
+
})
|
|
1834
|
+
})]
|
|
3275
1835
|
});
|
|
3276
1836
|
}
|
|
3277
1837
|
function isRecord(value) {
|
|
@@ -3438,7 +1998,17 @@ function useCustomValidity(ref, customValidity) {
|
|
|
3438
1998
|
}
|
|
3439
1999
|
}, [customValidity, ref]);
|
|
3440
2000
|
}
|
|
3441
|
-
|
|
2001
|
+
function useToneContext() {
|
|
2002
|
+
const value = useContext(ToneContext);
|
|
2003
|
+
if (!value) {
|
|
2004
|
+
throw new Error("useToneContext(): missing context value");
|
|
2005
|
+
}
|
|
2006
|
+
if (!isRecord(value) || value.version !== 0) {
|
|
2007
|
+
throw new Error("useToneContext(): the context value is not compatible");
|
|
2008
|
+
}
|
|
2009
|
+
return value;
|
|
2010
|
+
}
|
|
2011
|
+
const BORDER_VALUE = "1px solid ".concat(cssVars.default["border-base"]);
|
|
3442
2012
|
function responsiveBorderStyle() {
|
|
3443
2013
|
return [border, borderTop, borderRight, borderBottom, borderLeft];
|
|
3444
2014
|
}
|
|
@@ -3694,8 +2264,8 @@ function focusRingStyle(opts) {
|
|
|
3694
2264
|
} = opts;
|
|
3695
2265
|
const focusRingOutsetWidth = focusRing.offset + focusRing.width;
|
|
3696
2266
|
const focusRingInsetWidth = 0 - focusRing.offset;
|
|
3697
|
-
const bgColor = base ? base.bg : "
|
|
3698
|
-
return [focusRingInsetWidth > 0 && "inset 0 0 0 ".concat(focusRingInsetWidth, "px
|
|
2267
|
+
const bgColor = base ? base.bg : cssVars.mutable["bg-color"];
|
|
2268
|
+
return [focusRingInsetWidth > 0 && "inset 0 0 0 ".concat(focusRingInsetWidth, "px ").concat(cssVars.positive["border-accent"]), border && focusRingBorderStyle(border), focusRingInsetWidth < 0 && "0 0 0 ".concat(0 - focusRingInsetWidth, "px ").concat(bgColor), focusRingOutsetWidth > 0 && "0 0 0 ".concat(focusRingOutsetWidth, "px ").concat(cssVars.positive["border-accent"])].filter(Boolean).join(",");
|
|
3699
2269
|
}
|
|
3700
2270
|
const GRID_CSS = {
|
|
3701
2271
|
"&&:not([hidden])": {
|
|
@@ -3960,13 +2530,11 @@ function textInputRootStyle() {
|
|
|
3960
2530
|
function textInputBaseStyle(props) {
|
|
3961
2531
|
const {
|
|
3962
2532
|
theme,
|
|
3963
|
-
$scheme,
|
|
3964
2533
|
$tone,
|
|
3965
2534
|
$weight
|
|
3966
2535
|
} = props;
|
|
3967
2536
|
const font = theme.sanity.fonts.text;
|
|
3968
|
-
|
|
3969
|
-
return css(_b$m || (_b$m = __template$D(["\n appearance: none;\n background: none;\n border: 0;\n border-radius: 0;\n outline: none;\n width: 100%;\n box-sizing: border-box;\n font-family: ", ";\n font-weight: ", ";\n margin: 0;\n position: relative;\n z-index: 1;\n display: block;\n\n /* NOTE: This is a hack to disable Chrome\u2019s autofill styles */\n &:-webkit-autofill,\n &:-webkit-autofill:hover,\n &:-webkit-autofill:focus,\n &:-webkit-autofill:active {\n -webkit-text-fill-color: var(--input-fg-color) !important;\n transition: background-color 5000s;\n transition-delay: 86400s /* 24h */;\n }\n\n /* &:is(textarea) */\n &[data-as='textarea'] {\n resize: none;\n }\n\n color: var(--input-fg-color);\n\n &::placeholder {\n color: var(--input-placeholder-color);\n }\n\n &[data-scheme='", "'][data-tone='", "'] {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n\n /* enabled */\n &:not(:invalid):not(:disabled):not(:read-only) {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n\n /* disabled */\n &:not(:invalid):disabled {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n\n /* invalid */\n &:invalid {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n\n /* readOnly */\n &:read-only {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n }\n "])), font.family, $weight && font.weights[$weight] || font.weights.regular, $scheme, $tone, color.default.enabled.fg, color.default.enabled.placeholder, color.default.enabled.fg, color.default.enabled.placeholder, color.default.disabled.fg, color.default.disabled.placeholder, color.invalid.enabled.fg, color.invalid.enabled.placeholder, color.default.readOnly.fg, color.default.readOnly.placeholder);
|
|
2537
|
+
return css(_b$m || (_b$m = __template$D(["\n appearance: none;\n background: none;\n border: 0;\n border-radius: 0;\n outline: none;\n width: 100%;\n box-sizing: border-box;\n font-family: ", ";\n font-weight: ", ";\n margin: 0;\n position: relative;\n z-index: 1;\n display: block;\n\n /* NOTE: This is a hack to disable Chrome\u2019s autofill styles */\n &:-webkit-autofill,\n &:-webkit-autofill:hover,\n &:-webkit-autofill:focus,\n &:-webkit-autofill:active {\n -webkit-text-fill-color: var(--input-fg-color) !important;\n transition: background-color 5000s;\n transition-delay: 86400s /* 24h */;\n }\n\n /* &:is(textarea) */\n &[data-as='textarea'] {\n resize: none;\n }\n\n color: var(--input-fg-color);\n\n &::placeholder {\n color: var(--input-placeholder-color);\n }\n\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n\n /* enabled */\n &:not(:invalid):not(:disabled):not(:read-only) {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n\n /* disabled */\n &:not(:invalid):disabled {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n\n /* invalid */\n &:invalid {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n\n /* readOnly */\n &:read-only {\n --input-fg-color: ", ";\n --input-placeholder-color: ", ";\n }\n "])), font.family, $weight && font.weights[$weight] || font.weights.regular, cssVars[$tone]["text-primary"], cssVars[$tone]["text-inactive"], cssVars[$tone]["text-primary"], cssVars[$tone]["text-inactive"], cssVars[$tone]["text-primary"], cssVars[$tone]["text-inactive"], cssVars.critical["text-primary"], cssVars.critical["text-inactive"], cssVars[$tone]["text-primary"], cssVars[$tone]["text-inactive"]);
|
|
3970
2538
|
}
|
|
3971
2539
|
function textInputFontSizeStyle(props) {
|
|
3972
2540
|
const {
|
|
@@ -3988,7 +2556,6 @@ function textInputRepresentationStyle(props) {
|
|
|
3988
2556
|
const {
|
|
3989
2557
|
$hasPrefix,
|
|
3990
2558
|
$hasSuffix,
|
|
3991
|
-
$scheme,
|
|
3992
2559
|
$tone,
|
|
3993
2560
|
theme
|
|
3994
2561
|
} = props;
|
|
@@ -3998,26 +2565,22 @@ function textInputRepresentationStyle(props) {
|
|
|
3998
2565
|
const {
|
|
3999
2566
|
focusRing
|
|
4000
2567
|
} = input.text;
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
color: color.default.enabled.border,
|
|
2568
|
+
return css(_c$d || (_c$d = __template$D(["\n --input-box-shadow: none;\n\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: block;\n pointer-events: none;\n z-index: 0;\n\n background-color: ", ";\n box-shadow: var(--input-box-shadow);\n\n border-top-left-radius: ", ";\n border-bottom-left-radius: ", ";\n border-top-right-radius: ", ";\n border-bottom-right-radius: ", ";\n\n ", ": ", ";\n ", ": ", ";\n\n /* enabled */\n &[data-border] {\n --input-box-shadow: ", ";\n }\n\n /* invalid */\n *:not(:disabled):invalid + & {\n ", ": ", ";\n ", ": ", ";\n\n &[data-border] {\n --input-box-shadow: ", ";\n }\n }\n\n /* focused */\n *:not(:disabled):focus + & {\n &[data-border] {\n --input-box-shadow: ", ";\n }\n\n &:not([data-border]) {\n --input-box-shadow: ", ";\n }\n }\n\n /* disabled */\n *:disabled + & {\n ", ": ", " !important;\n ", ": ", " !important;\n }\n\n /* readOnly */\n *:read-only + & {\n ", ": ", " !important;\n ", ": ", " !important;\n }\n\n /* hovered */\n @media (hover: hover) {\n\n *:not(:disabled):not(:read-only):not(:invalid):not(:focus):hover + &[data-border] {\n --input-box-shadow: ", ";\n }\n }\n }\n "])), cssVars.mutable["bg-color"], $hasPrefix ? 0 : void 0, $hasPrefix ? 0 : void 0, $hasSuffix ? 0 : void 0, $hasSuffix ? 0 : void 0, mutableCardVariables["bg-color"], cssVars[$tone]["bg-base"], mutableCardVariables["fg-color"], cssVars[$tone]["text-primary"], focusRingBorderStyle({
|
|
2569
|
+
color: cssVars[$tone]["border-base"],
|
|
4004
2570
|
width: input.border.width
|
|
4005
|
-
}), color.
|
|
4006
|
-
color:
|
|
2571
|
+
}), mutableCardVariables["bg-color"], cssVars.critical["bg-tint"], mutableCardVariables["fg-color"], cssVars.critical["text-primary"], focusRingBorderStyle({
|
|
2572
|
+
color: cssVars.critical["border-base"],
|
|
4007
2573
|
width: input.border.width
|
|
4008
2574
|
}), focusRingStyle({
|
|
4009
2575
|
border: {
|
|
4010
|
-
color:
|
|
2576
|
+
color: cssVars[$tone]["border-base"],
|
|
4011
2577
|
width: input.border.width
|
|
4012
2578
|
},
|
|
4013
2579
|
focusRing
|
|
4014
2580
|
}), focusRingStyle({
|
|
4015
2581
|
focusRing
|
|
4016
|
-
}), color.default
|
|
4017
|
-
color:
|
|
4018
|
-
width: input.border.width
|
|
4019
|
-
}), color.default.readOnly.bg, color.default.readOnly.fg, color.default.hovered.bg, color.default.hovered.fg, focusRingBorderStyle({
|
|
4020
|
-
color: color.default.hovered.border,
|
|
2582
|
+
}), mutableCardVariables["bg-color"], cssVars.default["bg-tint"], mutableCardVariables["fg-color"], cssVars.default["text-primary"], mutableCardVariables["bg-color"], cssVars.default["bg-tint"], mutableCardVariables["fg-color"], cssVars.default["text-primary"], focusRingBorderStyle({
|
|
2583
|
+
color: cssVars.default["border-base-hover"],
|
|
4021
2584
|
width: input.border.width
|
|
4022
2585
|
}));
|
|
4023
2586
|
}
|
|
@@ -4059,10 +2622,10 @@ function toBoxShadow(shadow, color) {
|
|
|
4059
2622
|
}
|
|
4060
2623
|
function shadowStyle(shadow) {
|
|
4061
2624
|
if (!shadow) return EMPTY_RECORD;
|
|
4062
|
-
const outline = "0 0 0 ".concat(rem(1), "
|
|
4063
|
-
const umbra = toBoxShadow(shadow.umbra, "
|
|
4064
|
-
const penumbra = toBoxShadow(shadow.penumbra, "
|
|
4065
|
-
const ambient = toBoxShadow(shadow.ambient, "
|
|
2625
|
+
const outline = "0 0 0 ".concat(rem(1), " ").concat(cssVars.default["base-shadow-outline-color"]);
|
|
2626
|
+
const umbra = toBoxShadow(shadow.umbra, cssVars.default["base-shadow-umbra-color"]);
|
|
2627
|
+
const penumbra = toBoxShadow(shadow.penumbra, cssVars.default["base-shadow-penumbra-color"]);
|
|
2628
|
+
const ambient = toBoxShadow(shadow.ambient, cssVars.default["base-shadow-ambient-color"]);
|
|
4066
2629
|
return {
|
|
4067
2630
|
boxShadow: "".concat(outline, ", ").concat(umbra, ", ").concat(penumbra, ", ").concat(ambient)
|
|
4068
2631
|
};
|
|
@@ -4092,7 +2655,7 @@ function textBaseStyle(props) {
|
|
|
4092
2655
|
const {
|
|
4093
2656
|
weights
|
|
4094
2657
|
} = theme.sanity.fonts.text;
|
|
4095
|
-
return css(_c$c || (_c$c = __template$C(["\n color:
|
|
2658
|
+
return css(_c$c || (_c$c = __template$C(["\n color: ", ";\n\n ", "\n\n ", "\n\n & code {\n font-family: ", ";\n border-radius: 1px;\n background-color: ", ";\n color: ", ";\n }\n\n & a {\n text-decoration: none;\n border-radius: 1px;\n color: ", ";\n outline: none;\n\n @media (hover: hover) {\n &:hover {\n text-decoration: underline;\n }\n }\n\n &:focus {\n box-shadow:\n 0 0 0 1px ", ",\n 0 0 0 3px ", ";\n }\n\n &:focus:not(:focus-visible) {\n box-shadow: none;\n }\n }\n\n & strong {\n font-weight: ", ";\n }\n\n & svg {\n /* Certain popular CSS libraries changes the defaults for SVG display */\n /* Make sure SVGs are rendered as inline elements */\n display: inline;\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n color: ", ";\n }\n "])), cssVars.mutable["fg-color"], $accent && css(_a$C || (_a$C = __template$C(["\n color: ", ";\n "])), cssVars.default["text-accent"]), $muted && css(_b$l || (_b$l = __template$C(["\n color: ", ";\n "])), cssVars.mutable["muted-fg-color"]), theme.sanity.fonts.code.family, cssVars.default["bg-tint-code"], cssVars.default["text-code"], cssVars.default["text-link"], cssVars.mutable["bg-color"], cssVars.positive["border-accent"], weights.bold, cssVars.mutable["icon-color"]);
|
|
4096
2659
|
}
|
|
4097
2660
|
var __freeze$B = Object.freeze;
|
|
4098
2661
|
var __defProp$C = Object.defineProperty;
|
|
@@ -4133,6 +2696,44 @@ const Text = forwardRef(function Text2(props, ref) {
|
|
|
4133
2696
|
})
|
|
4134
2697
|
});
|
|
4135
2698
|
});
|
|
2699
|
+
const spotColor = {
|
|
2700
|
+
gray: {
|
|
2701
|
+
dark: gray["400"],
|
|
2702
|
+
light: gray["500"]
|
|
2703
|
+
},
|
|
2704
|
+
blue: {
|
|
2705
|
+
dark: blue["400"],
|
|
2706
|
+
light: blue["500"]
|
|
2707
|
+
},
|
|
2708
|
+
purple: {
|
|
2709
|
+
dark: purple["400"],
|
|
2710
|
+
light: purple["500"]
|
|
2711
|
+
},
|
|
2712
|
+
magenta: {
|
|
2713
|
+
dark: magenta["400"],
|
|
2714
|
+
light: magenta["500"]
|
|
2715
|
+
},
|
|
2716
|
+
red: {
|
|
2717
|
+
dark: red["400"],
|
|
2718
|
+
light: red["500"]
|
|
2719
|
+
},
|
|
2720
|
+
orange: {
|
|
2721
|
+
dark: orange["400"],
|
|
2722
|
+
light: orange["500"]
|
|
2723
|
+
},
|
|
2724
|
+
yellow: {
|
|
2725
|
+
dark: yellow["400"],
|
|
2726
|
+
light: yellow["500"]
|
|
2727
|
+
},
|
|
2728
|
+
green: {
|
|
2729
|
+
dark: green["400"],
|
|
2730
|
+
light: green["500"]
|
|
2731
|
+
},
|
|
2732
|
+
cyan: {
|
|
2733
|
+
dark: cyan["400"],
|
|
2734
|
+
light: cyan["500"]
|
|
2735
|
+
}
|
|
2736
|
+
};
|
|
4136
2737
|
const avatarStyle = {
|
|
4137
2738
|
root: avatarRootStyle,
|
|
4138
2739
|
arrow: avatarArrowStyle,
|
|
@@ -4191,7 +2792,7 @@ function avatarRootStyle(props) {
|
|
|
4191
2792
|
position: "relative",
|
|
4192
2793
|
boxSizing: "border-box",
|
|
4193
2794
|
userSelect: "none",
|
|
4194
|
-
boxShadow: "0 0 0 1px
|
|
2795
|
+
boxShadow: "0 0 0 1px ".concat(cssVars.mutable["bg-color"]),
|
|
4195
2796
|
'&[data-status="inactive"]': {
|
|
4196
2797
|
opacity: 0.5
|
|
4197
2798
|
},
|
|
@@ -4245,17 +2846,11 @@ function responsiveAvatarSizeStyle(props) {
|
|
|
4245
2846
|
};
|
|
4246
2847
|
});
|
|
4247
2848
|
}
|
|
4248
|
-
function avatarInitialsStyle(
|
|
4249
|
-
const {
|
|
4250
|
-
theme
|
|
4251
|
-
} = props;
|
|
4252
|
-
const {
|
|
4253
|
-
base
|
|
4254
|
-
} = theme.sanity.color;
|
|
2849
|
+
function avatarInitialsStyle() {
|
|
4255
2850
|
return {
|
|
4256
2851
|
width: "100%",
|
|
4257
2852
|
height: "100%",
|
|
4258
|
-
color:
|
|
2853
|
+
color: cssVars.default["text-primary"],
|
|
4259
2854
|
alignItems: "center",
|
|
4260
2855
|
justifyContent: "center",
|
|
4261
2856
|
textTransform: "uppercase",
|
|
@@ -4269,7 +2864,7 @@ function avatarInitialsStyle(props) {
|
|
|
4269
2864
|
function avatarBgStrokeStyle() {
|
|
4270
2865
|
return {
|
|
4271
2866
|
strokeWidth: "4px",
|
|
4272
|
-
stroke: "
|
|
2867
|
+
stroke: cssVars.mutable["bg-color"]
|
|
4273
2868
|
};
|
|
4274
2869
|
}
|
|
4275
2870
|
function avatarStrokeStyle() {
|
|
@@ -4303,7 +2898,10 @@ const Avatar = forwardRef(function Avatar2(props, ref) {
|
|
|
4303
2898
|
const as = ReactIs.isValidElementType(asProp) ? asProp : "div";
|
|
4304
2899
|
const size = useArrayProp(sizeProp);
|
|
4305
2900
|
const theme = useTheme();
|
|
4306
|
-
const
|
|
2901
|
+
const {
|
|
2902
|
+
scheme
|
|
2903
|
+
} = useToneContext();
|
|
2904
|
+
const color = spotColor[colorKey][scheme].hex;
|
|
4307
2905
|
const avatarSize = theme.sanity.avatar.sizes[size[0]] || theme.sanity.avatar.sizes[0];
|
|
4308
2906
|
const _sizeRem = avatarSize.size;
|
|
4309
2907
|
const _radius = _sizeRem / 2;
|
|
@@ -4425,7 +3023,7 @@ function _avatarCounterBaseStyle(props) {
|
|
|
4425
3023
|
const {
|
|
4426
3024
|
theme
|
|
4427
3025
|
} = props;
|
|
4428
|
-
return css(_a$A || (_a$A = __template$A(["\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n user-select: none;\n color: inherit;\n color:
|
|
3026
|
+
return css(_a$A || (_a$A = __template$A(["\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n user-select: none;\n color: inherit;\n color: ", ";\n background: ", ";\n box-shadow:\n 0 0 0 1px ", ",\n inset 0 0 0 1.5px ", ");\n padding: 0 ", ";\n\n &:not([hidden]) {\n display: flex;\n }\n "])), cssVars.mutable["fg-color"], cssVars.mutable["bg-color"], cssVars.mutable["bg-color"], cssVars.default["border-base"], rem(theme.sanity.space[2]));
|
|
4429
3027
|
}
|
|
4430
3028
|
const Root$C = styled.div(_responsiveAvatarCounterSizeStyle, _avatarCounterBaseStyle);
|
|
4431
3029
|
const AvatarCounter = forwardRef(function AvatarCounter2(props, ref) {
|
|
@@ -4596,7 +3194,7 @@ function labelBaseStyle(props) {
|
|
|
4596
3194
|
const {
|
|
4597
3195
|
fonts
|
|
4598
3196
|
} = theme.sanity;
|
|
4599
|
-
return css(_c$b || (_c$b = __template$y(["\n text-transform: uppercase;\n\n ", "\n\n ", "\n\n & code {\n font-family: ", ";\n border-radius: 1px;\n }\n\n & a {\n text-decoration: none;\n border-radius: 1px;\n }\n\n & svg {\n /* Certain popular CSS libraries changes the defaults for SVG display */\n /* Make sure SVGs are rendered as inline elements */\n display: inline;\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n }\n "])), $accent && css(_a$y || (_a$y = __template$y(["\n color:
|
|
3197
|
+
return css(_c$b || (_c$b = __template$y(["\n text-transform: uppercase;\n\n ", "\n\n ", "\n\n & code {\n font-family: ", ";\n border-radius: 1px;\n }\n\n & a {\n text-decoration: none;\n border-radius: 1px;\n }\n\n & svg {\n /* Certain popular CSS libraries changes the defaults for SVG display */\n /* Make sure SVGs are rendered as inline elements */\n display: inline;\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n }\n "])), $accent && css(_a$y || (_a$y = __template$y(["\n color: ", "};\n "])), cssVars.default["text-accent"]), $muted && css(_b$k || (_b$k = __template$y(["\n color: ", ";\n "])), cssVars.mutable["muted-fg-color"]), fonts.code.family);
|
|
4600
3198
|
}
|
|
4601
3199
|
var __freeze$x = Object.freeze;
|
|
4602
3200
|
var __defProp$y = Object.defineProperty;
|
|
@@ -4642,15 +3240,13 @@ const Label = forwardRef(function Label2(props, ref) {
|
|
|
4642
3240
|
function badgeStyle(props) {
|
|
4643
3241
|
const {
|
|
4644
3242
|
$mode,
|
|
4645
|
-
$tone
|
|
4646
|
-
theme
|
|
3243
|
+
$tone
|
|
4647
3244
|
} = props;
|
|
4648
|
-
const palette = theme.sanity.color[$mode === "outline" ? "muted" : "solid"];
|
|
4649
|
-
const color = palette[$tone] || palette.default;
|
|
4650
3245
|
return {
|
|
4651
|
-
backgroundColor: color.enabled.bg,
|
|
4652
|
-
|
|
4653
|
-
|
|
3246
|
+
// backgroundColor: color.enabled.bg,
|
|
3247
|
+
backgroundColor: $mode === "outline" ? cssVars[$tone]["bg-base"] : cssVars[$tone]["bg-tint"],
|
|
3248
|
+
color: cssVars[$tone]["text-secondary"],
|
|
3249
|
+
boxShadow: $mode === "outline" ? "inset 0 0 0 1px ".concat(cssVars[$tone]["border-base"]) : void 0,
|
|
4654
3250
|
cursor: "default",
|
|
4655
3251
|
"&:not([hidden])": {
|
|
4656
3252
|
display: "inline-block"
|
|
@@ -4725,37 +3321,6 @@ const Spinner = forwardRef(function Spinner2(props, ref) {
|
|
|
4725
3321
|
children: /* @__PURE__ */jsx(SpinnerIcon, {})
|
|
4726
3322
|
});
|
|
4727
3323
|
});
|
|
4728
|
-
function _colorVarsStyle(base, color) {
|
|
4729
|
-
let checkered = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
4730
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4731
|
-
return {
|
|
4732
|
-
// Base
|
|
4733
|
-
// @todo: rename to "--base-"?
|
|
4734
|
-
"--card-shadow-outline-color": base.shadow.outline,
|
|
4735
|
-
"--card-shadow-umbra-color": base.shadow.umbra,
|
|
4736
|
-
"--card-shadow-penumbra-color": base.shadow.penumbra,
|
|
4737
|
-
"--card-shadow-ambient-color": base.shadow.ambient,
|
|
4738
|
-
"--card-focus-ring-color": base.focusRing,
|
|
4739
|
-
"--card-icon-color": color.iconColor,
|
|
4740
|
-
// Card
|
|
4741
|
-
"--card-bg-color": color.bg,
|
|
4742
|
-
"--card-bg2-color": color.bg2,
|
|
4743
|
-
"--card-bg-image": checkered ? "repeating-conic-gradient(".concat(color.bg, " 0% 25%, ").concat(color.bg2 || color.bg, " 0% 50%)") : void 0,
|
|
4744
|
-
"--card-fg-color": color.fg,
|
|
4745
|
-
"--card-border-color": color.border,
|
|
4746
|
-
"--card-muted-fg-color": (_a = color.muted) == null ? void 0 : _a.fg,
|
|
4747
|
-
"--card-accent-fg-color": (_b = color.accent) == null ? void 0 : _b.fg,
|
|
4748
|
-
"--card-link-fg-color": (_c = color.link) == null ? void 0 : _c.fg,
|
|
4749
|
-
"--card-code-bg-color": (_d = color.code) == null ? void 0 : _d.bg,
|
|
4750
|
-
"--card-code-fg-color": (_e = color.code) == null ? void 0 : _e.fg,
|
|
4751
|
-
"--card-skeleton-color-from": (_f = color.skeleton) == null ? void 0 : _f.from,
|
|
4752
|
-
"--card-skeleton-color-to": (_g = color.skeleton) == null ? void 0 : _g.to,
|
|
4753
|
-
// @todo: deprecate
|
|
4754
|
-
"--card-link-color": (_h = color.link) == null ? void 0 : _h.fg,
|
|
4755
|
-
"--card-hairline-soft-color": color.border,
|
|
4756
|
-
"--card-hairline-hard-color": color.border
|
|
4757
|
-
};
|
|
4758
|
-
}
|
|
4759
3324
|
var __freeze$v = Object.freeze;
|
|
4760
3325
|
var __defProp$w = Object.defineProperty;
|
|
4761
3326
|
var __template$v = (cooked, raw) => __freeze$v(__defProp$w(cooked, "raw", {
|
|
@@ -4781,32 +3346,60 @@ function buttonColorStyles(props) {
|
|
|
4781
3346
|
var _a2, _b;
|
|
4782
3347
|
const {
|
|
4783
3348
|
$mode,
|
|
4784
|
-
theme
|
|
3349
|
+
theme,
|
|
3350
|
+
$tone
|
|
4785
3351
|
} = props;
|
|
4786
3352
|
const {
|
|
4787
3353
|
focusRing
|
|
4788
3354
|
} = theme.sanity.button;
|
|
4789
3355
|
const shadow = props.$mode !== "bleed";
|
|
4790
|
-
const base = theme.sanity.color.base;
|
|
4791
|
-
const mode = theme.sanity.color.button[$mode] || theme.sanity.color.button.default;
|
|
4792
|
-
const color = mode[props.$tone] || mode.default;
|
|
4793
3356
|
const border = {
|
|
4794
3357
|
width: buttonTheme.border.width,
|
|
4795
|
-
color: "
|
|
3358
|
+
color: $mode === "default" ? cssVars[$tone]["bg-accent"] : $mode === "ghost" ? cssVars[$tone]["border-base"] : cssVars[$tone]["bg-base"]
|
|
4796
3359
|
};
|
|
4797
|
-
return [
|
|
4798
|
-
|
|
4799
|
-
color: "
|
|
3360
|
+
return [{
|
|
3361
|
+
// This is going to be used by the text elements inside the button
|
|
3362
|
+
[mutableCardVariables["fg-color"]]: $mode === "default" ? cssVars[$tone]["base-text-color"] : cssVars[$tone]["text-primary"],
|
|
3363
|
+
[mutableCardVariables["muted-fg-color"]]: $mode === "default" ? cssVars[$tone]["base-text-color"] : cssVars[$tone]["text-secondary"],
|
|
3364
|
+
[mutableCardVariables["icon-color"]]: $mode === "default" ? cssVars[$tone]["icon-inverted"] : cssVars[$tone]["icon-default"],
|
|
3365
|
+
[mutableCardVariables["bg-color"]]: $mode === "default" ? cssVars[$tone]["bg-accent"] : cssVars[$tone]["bg-base"],
|
|
3366
|
+
// Override the default variables for elements used inside buttons
|
|
3367
|
+
[getToneCssVar("default", "bg-tint-code")]: $mode === "default" ? cssVars[$tone]["bg-accent"] : cssVars[$tone]["bg-tint-code"],
|
|
3368
|
+
...($mode === "default" && {
|
|
3369
|
+
[getToneCssVar("default", "text-code")]: cssVars[$tone]["base-text-color"],
|
|
3370
|
+
[getToneCssVar("default", "text-code")]: cssVars[$tone]["base-text-color"],
|
|
3371
|
+
[getToneCssVar("default", "text-link")]: cssVars[$tone]["base-text-color"],
|
|
3372
|
+
[getToneCssVar("default", "text-accent")]: cssVars[$tone]["base-text-color"]
|
|
3373
|
+
}),
|
|
3374
|
+
'&:disabled, &[data-disabled="true"]': {
|
|
3375
|
+
/* Updates the variables for the */
|
|
3376
|
+
[mutableCardVariables["fg-color"]]: cssVars.primary["text-inactive"],
|
|
3377
|
+
[mutableCardVariables["muted-fg-color"]]: cssVars.primary["text-inactive"],
|
|
3378
|
+
[mutableCardVariables["icon-color"]]: cssVars.primary["border-base"],
|
|
3379
|
+
[mutableCardVariables["bg-color"]]: $mode === "default" ? cssVars.primary["bg-tint"] : cssVars.default["bg-base"]
|
|
3380
|
+
}
|
|
3381
|
+
}, {
|
|
3382
|
+
backgroundColor: $mode === "default" ? cssVars[$tone]["bg-accent"] : cssVars[$tone]["bg-base"],
|
|
3383
|
+
color: $mode === "default" ? cssVars[$tone]["base-text-color"] : cssVars[$tone]["text-primary"],
|
|
4800
3384
|
boxShadow: focusRingBorderStyle(border),
|
|
4801
|
-
'&:disabled, &[data-disabled="true"]':
|
|
3385
|
+
'&:disabled, &[data-disabled="true"]': {
|
|
3386
|
+
backgroundColor: $mode === "default" ? cssVars.primary["bg-tint"] : cssVars.default["bg-base"],
|
|
3387
|
+
color: cssVars.primary["text-inactive"],
|
|
3388
|
+
boxShadow: focusRingBorderStyle({
|
|
3389
|
+
...border,
|
|
3390
|
+
color: $mode === "default" ? cssVars.primary["bg-tint"] : cssVars.primary["border-base"]
|
|
3391
|
+
})
|
|
3392
|
+
},
|
|
4802
3393
|
"&:not([data-disabled='true'])": {
|
|
4803
3394
|
boxShadow: combineBoxShadow(focusRingBorderStyle(border), shadow ? defaultBoxShadow : void 0),
|
|
4804
3395
|
"&:focus": {
|
|
4805
3396
|
boxShadow: focusRingStyle({
|
|
4806
|
-
base
|
|
3397
|
+
base: {
|
|
3398
|
+
bg: cssVars.positive["border-accent"]
|
|
3399
|
+
},
|
|
4807
3400
|
border: {
|
|
4808
3401
|
width: 2,
|
|
4809
|
-
color:
|
|
3402
|
+
color: cssVars.default["bg-base"]
|
|
4810
3403
|
},
|
|
4811
3404
|
focusRing
|
|
4812
3405
|
})
|
|
@@ -4815,11 +3408,19 @@ function buttonColorStyles(props) {
|
|
|
4815
3408
|
boxShadow: combineBoxShadow(focusRingBorderStyle(border), shadow ? defaultBoxShadow : void 0)
|
|
4816
3409
|
},
|
|
4817
3410
|
"@media (hover: hover)": {
|
|
4818
|
-
"&:hover":
|
|
4819
|
-
|
|
4820
|
-
|
|
3411
|
+
"&:hover": {
|
|
3412
|
+
backgroundColor: $mode === "default" ? cssVars[$tone]["bg-accent-hover"] : cssVars[$tone]["bg-base-hover"]
|
|
3413
|
+
},
|
|
3414
|
+
"&:active": {
|
|
3415
|
+
backgroundColor: $mode === "default" ? cssVars[$tone]["bg-accent-active"] : cssVars[$tone]["bg-base-active"]
|
|
3416
|
+
},
|
|
3417
|
+
"&[data-hovered]": {
|
|
3418
|
+
backgroundColor: $mode === "default" ? cssVars[$tone]["bg-accent-hover"] : cssVars[$tone]["bg-base-hover"]
|
|
3419
|
+
}
|
|
4821
3420
|
},
|
|
4822
|
-
"&[data-selected]":
|
|
3421
|
+
"&[data-selected]": {
|
|
3422
|
+
backgroundColor: $mode === "default" ? cssVars[$tone]["bg-accent-active"] : cssVars[$tone]["bg-base-active"]
|
|
3423
|
+
}
|
|
4823
3424
|
}
|
|
4824
3425
|
}, (_b = (_a2 = theme.sanity.styles) == null ? void 0 : _a2.button) == null ? void 0 : _b.root].filter(Boolean);
|
|
4825
3426
|
}
|
|
@@ -4830,7 +3431,7 @@ var __template$u = (cooked, raw) => __freeze$u(__defProp$v(cooked, "raw", {
|
|
|
4830
3431
|
}));
|
|
4831
3432
|
var _a$u;
|
|
4832
3433
|
const Root$v = styled.button(responsiveRadiusStyle, buttonBaseStyles, buttonColorStyles);
|
|
4833
|
-
const LoadingBox = styled.div(_a$u || (_a$u = __template$u(["\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color:
|
|
3434
|
+
const LoadingBox = styled.div(_a$u || (_a$u = __template$u(["\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: ", ";\n border-radius: inherit;\n z-index: 1;\n box-shadow: inherit;\n"])), cssVars.mutable["bg-color"]);
|
|
4834
3435
|
const Button = forwardRef(function Button2(props, ref) {
|
|
4835
3436
|
const {
|
|
4836
3437
|
children,
|
|
@@ -4924,6 +3525,52 @@ const Button = forwardRef(function Button2(props, ref) {
|
|
|
4924
3525
|
})]
|
|
4925
3526
|
});
|
|
4926
3527
|
});
|
|
3528
|
+
function _colorVarStyleDisabled() {
|
|
3529
|
+
let checkered = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
3530
|
+
return {
|
|
3531
|
+
[getToneCssVar("default", "text-link")]: cssVars.default["text-secondary"],
|
|
3532
|
+
[getToneCssVar("default", "text-accent")]: cssVars.default["text-secondary"],
|
|
3533
|
+
[getToneCssVar("default", "text-code")]: cssVars.default["text-secondary"],
|
|
3534
|
+
[getToneCssVar("default", "text-primary")]: cssVars.default["text-secondary"],
|
|
3535
|
+
[mutableCardVariables["fg-color"]]: cssVars.primary["text-inactive"],
|
|
3536
|
+
[mutableCardVariables["muted-fg-color"]]: cssVars.primary["text-inactive"],
|
|
3537
|
+
[mutableCardVariables["icon-color"]]: cssVars.primary["border-base"],
|
|
3538
|
+
[mutableCardVariables["accent-color"]]: cssVars.primary["base-bg-card"],
|
|
3539
|
+
[mutableCardVariables["bg-color"]]: cssVars.primary["bg-tint"],
|
|
3540
|
+
[mutableCardVariables["bg-image"]]: checkered ? "repeating-conic-gradient(".concat(cssVars.default["base-bg-card"], " 0% 25%, ").concat(cssVars.default["bg-tint"], " 0% 50%)") : void 0
|
|
3541
|
+
};
|
|
3542
|
+
}
|
|
3543
|
+
function _colorVarStyleSelected() {
|
|
3544
|
+
return {
|
|
3545
|
+
[mutableCardVariables["bg-color"]]: cssVars.default["bg-accent"],
|
|
3546
|
+
[mutableCardVariables["fg-color"]]: cssVars.default["bg-base"],
|
|
3547
|
+
[mutableCardVariables["muted-fg-color"]]: cssVars.default["base-bg-card"],
|
|
3548
|
+
[mutableCardVariables["accent-color"]]: cssVars.default["base-bg-card"],
|
|
3549
|
+
[mutableCardVariables["icon-color"]]: cssVars.primary["bg-base"]
|
|
3550
|
+
};
|
|
3551
|
+
}
|
|
3552
|
+
function _colorVarStyleHover() {
|
|
3553
|
+
return {
|
|
3554
|
+
[mutableCardVariables["bg-color"]]: cssVars.default["bg-base-hover"]
|
|
3555
|
+
};
|
|
3556
|
+
}
|
|
3557
|
+
function _colorVarStyleActive() {
|
|
3558
|
+
return {
|
|
3559
|
+
[mutableCardVariables["bg-color"]]: cssVars.default["bg-base-active"]
|
|
3560
|
+
};
|
|
3561
|
+
}
|
|
3562
|
+
function _selectableVarStyle() {
|
|
3563
|
+
return {
|
|
3564
|
+
[mutableCardVariables["bg-color"]]: "inherit",
|
|
3565
|
+
[mutableCardVariables["fg-color"]]: cssVars.default["text-secondary"]
|
|
3566
|
+
};
|
|
3567
|
+
}
|
|
3568
|
+
function _selectableVarStyleDisabled() {
|
|
3569
|
+
return {
|
|
3570
|
+
..._colorVarStyleDisabled(),
|
|
3571
|
+
[mutableCardVariables["bg-color"]]: void 0
|
|
3572
|
+
};
|
|
3573
|
+
}
|
|
4927
3574
|
var __freeze$t = Object.freeze;
|
|
4928
3575
|
var __defProp$u = Object.defineProperty;
|
|
4929
3576
|
var __template$t = (cooked, raw) => __freeze$t(__defProp$u(cooked, "raw", {
|
|
@@ -4939,38 +3586,50 @@ function cardBaseStyle(props) {
|
|
|
4939
3586
|
theme
|
|
4940
3587
|
} = props;
|
|
4941
3588
|
const space = theme.sanity.space;
|
|
4942
|
-
return css(_b$i || (_b$i = __template$t(["\n ", "\n\n &[data-as='button'] {\n -webkit-font-smoothing: inherit;\n appearance: none;\n outline: none;\n font: inherit;\n text-align: inherit;\n border: 0;\n width: stretch;\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n outline: none;\n text-decoration: none;\n }\n\n /* &:is(pre) */\n &[data-as='pre'] {\n font: inherit;\n }\n "])), $checkered && css(_a$t || (_a$t = __template$t(["\n background-size: ", "px ", "px;\n background-position: 50% 50%;\n background-image:
|
|
3589
|
+
return css(_b$i || (_b$i = __template$t(["\n ", "\n\n &[data-as='button'] {\n -webkit-font-smoothing: inherit;\n appearance: none;\n outline: none;\n font: inherit;\n text-align: inherit;\n border: 0;\n width: stretch;\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n outline: none;\n text-decoration: none;\n }\n\n /* &:is(pre) */\n &[data-as='pre'] {\n font: inherit;\n }\n "])), $checkered && css(_a$t || (_a$t = __template$t(["\n background-size: ", "px ", "px;\n background-position: 50% 50%;\n background-image: ", ";\n "])), space[3], space[3], cssVars.mutable["bg-image"]));
|
|
4943
3590
|
}
|
|
4944
3591
|
function cardColorStyle(props) {
|
|
4945
3592
|
var _a2, _b2;
|
|
4946
3593
|
const {
|
|
4947
3594
|
$checkered,
|
|
4948
3595
|
$focusRing,
|
|
4949
|
-
theme
|
|
3596
|
+
theme,
|
|
3597
|
+
$tone,
|
|
3598
|
+
$scheme,
|
|
3599
|
+
$updateCssVars
|
|
4950
3600
|
} = props;
|
|
4951
3601
|
const {
|
|
4952
3602
|
focusRing
|
|
4953
3603
|
} = theme.sanity.card;
|
|
4954
|
-
const {
|
|
4955
|
-
base,
|
|
4956
|
-
card,
|
|
4957
|
-
dark
|
|
4958
|
-
} = theme.sanity.color;
|
|
4959
3604
|
const border = {
|
|
4960
3605
|
width: 0,
|
|
4961
|
-
color: "
|
|
3606
|
+
color: cssVars.positive["border-accent"]
|
|
4962
3607
|
};
|
|
4963
|
-
return css(_c$a || (_c$a = __template$t(["\n color-scheme: ", ";\n
|
|
4964
|
-
base,
|
|
3608
|
+
return css(_c$a || (_c$a = __template$t(["\n /* A new css vars context is created, allowing for override of the default tone and changing the scheme */\n ", "\n color-scheme: ", ";\n ", "\n\n background-color: ", ";\n color: ", ";\n\n /* &:is(button) */\n &[data-as='button'] {\n --card-focus-ring-box-shadow: none;\n\n cursor: default;\n box-shadow: var(--card-focus-ring-box-shadow);\n\n &:disabled {\n ", "\n }\n\n &:not(:disabled) {\n &[data-pressed] {\n ", "\n }\n\n &[data-selected] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-pressed]):not([data-selected]) {\n &[data-hovered],\n &:hover {\n ", "\n }\n\n &:active {\n ", "\n }\n }\n }\n\n &:focus {\n --card-focus-ring-box-shadow: ", ";\n }\n\n &:focus:not(:focus-visible) {\n --card-focus-ring-box-shadow: ", ";\n }\n }\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n cursor: pointer;\n box-shadow: var(--card-focus-ring-box-shadow);\n\n &[data-disabled] {\n ", "\n }\n\n &:not([data-disabled]) {\n &[data-pressed] {\n ", "\n }\n\n &[data-selected] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-pressed]):not([data-selected]) {\n &[data-hovered],\n &:hover {\n ", "\n }\n\n &:active {\n ", "\n }\n }\n }\n\n &:focus {\n --card-focus-ring-box-shadow: ", ";\n }\n\n &:focus:not(:focus-visible) {\n --card-focus-ring-box-shadow: ", ";\n }\n }\n }\n\n ", "\n "])), $updateCssVars && createCssVars($scheme, theme.sanity.color.tones, $tone), $scheme === "dark" ? "dark" : "light", $checkered && "--card-bg-image: repeating-conic-gradient(".concat(cssVars.default["base-bg-card"], " 0% 25%, ").concat(cssVars.default["bg-tint"], " 0% 50%)"), cssVars.mutable["bg-color"], cssVars.default["text-primary"], _colorVarStyleDisabled($checkered), _colorVarStyleActive(), _colorVarStyleSelected(), _colorVarStyleHover(), _colorVarStyleActive(), $focusRing ? focusRingStyle({
|
|
4965
3609
|
border,
|
|
4966
3610
|
focusRing
|
|
4967
|
-
}) : void 0, $focusRing ? focusRingBorderStyle(border) : void 0,
|
|
4968
|
-
base,
|
|
3611
|
+
}) : void 0, $focusRing ? focusRingBorderStyle(border) : void 0, _colorVarStyleDisabled($checkered), _colorVarStyleActive(), _colorVarStyleSelected(), _colorVarStyleHover(), _colorVarStyleActive(), $focusRing ? focusRingStyle({
|
|
4969
3612
|
border,
|
|
4970
3613
|
focusRing
|
|
4971
3614
|
}) : void 0, $focusRing ? focusRingBorderStyle(border) : void 0, (_b2 = (_a2 = theme.sanity.styles) == null ? void 0 : _a2.card) == null ? void 0 : _b2.root);
|
|
4972
3615
|
}
|
|
4973
3616
|
const Root$u = styled(Box)(responsiveBorderStyle, responsiveRadiusStyle, responsiveShadowStyle, cardStyle);
|
|
3617
|
+
const Wrapper = _ref5 => {
|
|
3618
|
+
let {
|
|
3619
|
+
shouldAddContext,
|
|
3620
|
+
scheme,
|
|
3621
|
+
tone,
|
|
3622
|
+
children
|
|
3623
|
+
} = _ref5;
|
|
3624
|
+
if (shouldAddContext) {
|
|
3625
|
+
return /* @__PURE__ */jsx(ToneProvider, {
|
|
3626
|
+
scheme,
|
|
3627
|
+
tone,
|
|
3628
|
+
children
|
|
3629
|
+
});
|
|
3630
|
+
}
|
|
3631
|
+
return children;
|
|
3632
|
+
};
|
|
4974
3633
|
const Card = forwardRef(function Card2(props, ref) {
|
|
4975
3634
|
const {
|
|
4976
3635
|
__unstable_checkered: checkered = false,
|
|
@@ -4983,23 +3642,28 @@ const Card = forwardRef(function Card2(props, ref) {
|
|
|
4983
3642
|
borderLeft,
|
|
4984
3643
|
pressed,
|
|
4985
3644
|
radius = 0,
|
|
4986
|
-
scheme,
|
|
3645
|
+
scheme: schemeProp,
|
|
4987
3646
|
selected,
|
|
4988
3647
|
shadow,
|
|
4989
3648
|
tone: toneProp = "default",
|
|
3649
|
+
updateCssVars = false,
|
|
4990
3650
|
...restProps
|
|
4991
3651
|
} = props;
|
|
4992
3652
|
const as = isValidElementType(asProp) ? asProp : "div";
|
|
4993
|
-
const
|
|
4994
|
-
const tone = toneProp === "inherit" ?
|
|
4995
|
-
|
|
3653
|
+
const toneContext = useToneContext();
|
|
3654
|
+
const tone = toneProp === "inherit" ? toneContext.tone : toneProp;
|
|
3655
|
+
const scheme = schemeProp != null ? schemeProp : toneContext.scheme;
|
|
3656
|
+
const shouldAddContext = scheme !== toneContext.scheme || tone !== toneContext.tone;
|
|
3657
|
+
return /* @__PURE__ */jsx(Wrapper, {
|
|
3658
|
+
shouldAddContext,
|
|
4996
3659
|
scheme,
|
|
4997
3660
|
tone,
|
|
4998
3661
|
children: /* @__PURE__ */jsx(Root$u, {
|
|
4999
3662
|
"data-as": typeof as === "string" ? as : void 0,
|
|
5000
|
-
"data-scheme":
|
|
3663
|
+
"data-scheme": scheme,
|
|
5001
3664
|
"data-ui": "Card",
|
|
5002
3665
|
"data-tone": tone,
|
|
3666
|
+
$scheme: scheme != null ? scheme : toneContext.scheme,
|
|
5003
3667
|
...restProps,
|
|
5004
3668
|
$border: useArrayProp(border),
|
|
5005
3669
|
$borderTop: useArrayProp(borderTop),
|
|
@@ -5011,6 +3675,7 @@ const Card = forwardRef(function Card2(props, ref) {
|
|
|
5011
3675
|
$radius: useArrayProp(radius),
|
|
5012
3676
|
$shadow: useArrayProp(shadow),
|
|
5013
3677
|
$tone: tone,
|
|
3678
|
+
$updateCssVars: updateCssVars || shouldAddContext,
|
|
5014
3679
|
"data-checkered": checkered ? "" : void 0,
|
|
5015
3680
|
"data-pressed": pressed ? "" : void 0,
|
|
5016
3681
|
"data-selected": selected ? "" : void 0,
|
|
@@ -5033,7 +3698,6 @@ function inputElementStyles(props) {
|
|
|
5033
3698
|
const {
|
|
5034
3699
|
theme
|
|
5035
3700
|
} = props;
|
|
5036
|
-
const color = theme.sanity.color.input;
|
|
5037
3701
|
const {
|
|
5038
3702
|
input,
|
|
5039
3703
|
radius
|
|
@@ -5042,37 +3706,37 @@ function inputElementStyles(props) {
|
|
|
5042
3706
|
focusRing
|
|
5043
3707
|
} = input.checkbox;
|
|
5044
3708
|
return css(_b$h || (_b$h = __template$s(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n outline: none;\n opacity: 0;\n z-index: 1;\n padding: 0;\n margin: 0;\n\n & + span {\n position: relative;\n display: block;\n height: ", ";\n width: ", ";\n box-sizing: border-box;\n box-shadow: ", ";\n border-radius: ", ";\n line-height: 1;\n background-color: ", ";\n\n & > svg {\n display: block;\n position: absolute;\n opacity: 0;\n height: 100%;\n width: 100%;\n\n & > path {\n vector-effect: non-scaling-stroke;\n stroke-width: 1.2 !important;\n }\n }\n }\n &:checked + span {\n background: ", ";\n box-shadow: ", ";\n color: ", ";\n }\n\n /* focus */\n &:not(:disabled):focus:focus-visible + span {\n box-shadow: ", ";\n }\n\n /* focus when checked - uses a different offset */\n &:not(:disabled):focus:focus-visible&:checked + span {\n box-shadow: ", ";\n }\n\n &[data-error] + span {\n background-color: ", ";\n box-shadow: ", ";\n color: ", ";\n }\n &[data-error]&:checked + span {\n background-color: ", ";\n color: ", ";\n }\n &[data-error]&:checked&:not(:disabled):focus:focus-visible + span {\n box-shadow: ", ";\n }\n\n &:disabled + span {\n background-color: ", ";\n box-shadow: ", ";\n color: ", ";\n }\n &:disabled&:checked + span {\n background-color: ", ";\n }\n\n &[data-read-only] + span {\n background-color: ", ";\n box-shadow: ", ";\n color: ", ";\n }\n\n &[data-read-only]&:checked + span {\n background-color: ", ";\n }\n\n &:checked + span > svg:first-child {\n opacity: 1;\n }\n &:indeterminate + span > svg:last-child {\n opacity: 1;\n }\n "])), rem(input.checkbox.size), rem(input.checkbox.size), focusRingBorderStyle({
|
|
5045
|
-
color:
|
|
3709
|
+
color: cssVars.default["border-base"],
|
|
5046
3710
|
width: input.border.width
|
|
5047
|
-
}), rem(radius[2]),
|
|
5048
|
-
color:
|
|
3711
|
+
}), rem(radius[2]), cssVars.default["bg-base"], cssVars.default["text-secondary"], focusRingBorderStyle({
|
|
3712
|
+
color: cssVars.default["text-secondary"],
|
|
5049
3713
|
width: input.border.width
|
|
5050
|
-
}),
|
|
3714
|
+
}), cssVars.default["bg-base"], focusRingStyle({
|
|
5051
3715
|
focusRing
|
|
5052
3716
|
}), focusRingStyle({
|
|
5053
3717
|
focusRing: {
|
|
5054
3718
|
width: 1,
|
|
5055
3719
|
offset: 1
|
|
5056
3720
|
}
|
|
5057
|
-
}),
|
|
3721
|
+
}), cssVars.critical["border-base"], focusRingBorderStyle({
|
|
5058
3722
|
width: input.border.width,
|
|
5059
|
-
color:
|
|
5060
|
-
}),
|
|
3723
|
+
color: cssVars.critical["text-secondary"]
|
|
3724
|
+
}), cssVars.default["text-secondary"], cssVars.critical["text-secondary"], cssVars.default["bg-base"], focusRingStyle({
|
|
5061
3725
|
border: {
|
|
5062
3726
|
width: input.border.width,
|
|
5063
|
-
color:
|
|
3727
|
+
color: cssVars.critical["text-secondary"]
|
|
5064
3728
|
},
|
|
5065
3729
|
focusRing: {
|
|
5066
3730
|
width: 1,
|
|
5067
3731
|
offset: 1
|
|
5068
3732
|
}
|
|
5069
|
-
}),
|
|
3733
|
+
}), cssVars.default["bg-tint"], focusRingBorderStyle({
|
|
5070
3734
|
width: input.border.width,
|
|
5071
|
-
color:
|
|
5072
|
-
}),
|
|
3735
|
+
color: cssVars.default["border-base"]
|
|
3736
|
+
}), cssVars.default["text-secondary"], cssVars.default["border-base"], cssVars.default["bg-tint"], focusRingBorderStyle({
|
|
5073
3737
|
width: input.border.width,
|
|
5074
|
-
color:
|
|
5075
|
-
}),
|
|
3738
|
+
color: cssVars.default["border-base"]
|
|
3739
|
+
}), cssVars.default["text-secondary"], cssVars.default["border-base"]);
|
|
5076
3740
|
}
|
|
5077
3741
|
const Root$t = styled.div(checkboxBaseStyles);
|
|
5078
3742
|
const Input$5 = styled.input(inputElementStyles);
|
|
@@ -5118,124 +3782,123 @@ var __template$r = (cooked, raw) => __freeze$r(__defProp$s(cooked, "raw", {
|
|
|
5118
3782
|
value: __freeze$r(raw || cooked.slice())
|
|
5119
3783
|
}));
|
|
5120
3784
|
var _a$r;
|
|
5121
|
-
function codeSyntaxHighlightingStyle(
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
const color = theme.sanity.color.syntax;
|
|
3785
|
+
function codeSyntaxHighlightingStyle(scheme) {
|
|
3786
|
+
const dark = scheme === "dark";
|
|
3787
|
+
const mainShade = dark ? 400 : 600;
|
|
3788
|
+
const secondaryShade = dark ? 600 : 400;
|
|
5126
3789
|
return {
|
|
5127
3790
|
"&.atrule": {
|
|
5128
|
-
color:
|
|
3791
|
+
color: purple[mainShade].hex
|
|
5129
3792
|
},
|
|
5130
3793
|
"&.attr-name": {
|
|
5131
|
-
color:
|
|
3794
|
+
color: green[mainShade].hex
|
|
5132
3795
|
},
|
|
5133
3796
|
"&.attr-value": {
|
|
5134
|
-
color:
|
|
3797
|
+
color: yellow[mainShade].hex
|
|
5135
3798
|
},
|
|
5136
3799
|
"&.attribute": {
|
|
5137
|
-
color:
|
|
3800
|
+
color: yellow[mainShade].hex
|
|
5138
3801
|
},
|
|
5139
3802
|
"&.boolean": {
|
|
5140
|
-
color:
|
|
3803
|
+
color: purple[mainShade].hex
|
|
5141
3804
|
},
|
|
5142
3805
|
"&.builtin": {
|
|
5143
|
-
color:
|
|
3806
|
+
color: purple[mainShade].hex
|
|
5144
3807
|
},
|
|
5145
3808
|
"&.cdata": {
|
|
5146
|
-
color:
|
|
3809
|
+
color: yellow[mainShade].hex
|
|
5147
3810
|
},
|
|
5148
3811
|
"&.char": {
|
|
5149
|
-
color:
|
|
3812
|
+
color: yellow[mainShade].hex
|
|
5150
3813
|
},
|
|
5151
3814
|
"&.class": {
|
|
5152
|
-
color:
|
|
3815
|
+
color: orange[mainShade].hex
|
|
5153
3816
|
},
|
|
5154
3817
|
"&.class-name": {
|
|
5155
|
-
color:
|
|
3818
|
+
color: cyan[mainShade].hex
|
|
5156
3819
|
},
|
|
5157
3820
|
"&.comment": {
|
|
5158
|
-
color:
|
|
3821
|
+
color: gray[secondaryShade].hex
|
|
5159
3822
|
},
|
|
5160
3823
|
"&.constant": {
|
|
5161
|
-
color:
|
|
3824
|
+
color: purple[mainShade].hex
|
|
5162
3825
|
},
|
|
5163
3826
|
"&.deleted": {
|
|
5164
|
-
color:
|
|
3827
|
+
color: red[mainShade].hex
|
|
5165
3828
|
},
|
|
5166
3829
|
"&.doctype": {
|
|
5167
|
-
color:
|
|
3830
|
+
color: gray[secondaryShade].hex
|
|
5168
3831
|
},
|
|
5169
3832
|
"&.entity": {
|
|
5170
|
-
color:
|
|
3833
|
+
color: red[mainShade].hex
|
|
5171
3834
|
},
|
|
5172
3835
|
"&.function": {
|
|
5173
|
-
color:
|
|
3836
|
+
color: green[mainShade].hex
|
|
5174
3837
|
},
|
|
5175
3838
|
"&.hexcode": {
|
|
5176
|
-
color:
|
|
3839
|
+
color: blue[mainShade].hex
|
|
5177
3840
|
},
|
|
5178
3841
|
"&.id": {
|
|
5179
|
-
color:
|
|
3842
|
+
color: purple[mainShade].hex
|
|
5180
3843
|
},
|
|
5181
3844
|
"&.important": {
|
|
5182
|
-
color:
|
|
3845
|
+
color: purple[mainShade].hex
|
|
5183
3846
|
},
|
|
5184
3847
|
"&.inserted": {
|
|
5185
|
-
color:
|
|
3848
|
+
color: yellow[mainShade].hex
|
|
5186
3849
|
},
|
|
5187
3850
|
"&.keyword": {
|
|
5188
|
-
color:
|
|
3851
|
+
color: magenta[mainShade].hex
|
|
5189
3852
|
},
|
|
5190
3853
|
"&.number": {
|
|
5191
|
-
color:
|
|
3854
|
+
color: purple[mainShade].hex
|
|
5192
3855
|
},
|
|
5193
3856
|
"&.operator": {
|
|
5194
|
-
color:
|
|
3857
|
+
color: magenta[mainShade].hex
|
|
5195
3858
|
},
|
|
5196
3859
|
"&.prolog": {
|
|
5197
|
-
color:
|
|
3860
|
+
color: gray[secondaryShade].hex
|
|
5198
3861
|
},
|
|
5199
3862
|
"&.property": {
|
|
5200
|
-
color:
|
|
3863
|
+
color: blue[mainShade].hex
|
|
5201
3864
|
},
|
|
5202
3865
|
"&.pseudo-class": {
|
|
5203
|
-
color:
|
|
3866
|
+
color: yellow[mainShade].hex
|
|
5204
3867
|
},
|
|
5205
3868
|
"&.pseudo-element": {
|
|
5206
|
-
color:
|
|
3869
|
+
color: yellow[mainShade].hex
|
|
5207
3870
|
},
|
|
5208
3871
|
"&.punctuation": {
|
|
5209
|
-
color:
|
|
3872
|
+
color: gray[mainShade].hex
|
|
5210
3873
|
},
|
|
5211
3874
|
"&.regex": {
|
|
5212
|
-
color:
|
|
3875
|
+
color: blue[mainShade].hex
|
|
5213
3876
|
},
|
|
5214
3877
|
"&.selector": {
|
|
5215
|
-
color:
|
|
3878
|
+
color: red[mainShade].hex
|
|
5216
3879
|
},
|
|
5217
3880
|
"&.string": {
|
|
5218
|
-
color:
|
|
3881
|
+
color: yellow[mainShade].hex
|
|
5219
3882
|
},
|
|
5220
3883
|
"&.symbol": {
|
|
5221
|
-
color:
|
|
3884
|
+
color: purple[mainShade].hex
|
|
5222
3885
|
},
|
|
5223
3886
|
"&.tag": {
|
|
5224
|
-
color:
|
|
3887
|
+
color: red[mainShade].hex
|
|
5225
3888
|
},
|
|
5226
3889
|
"&.unit": {
|
|
5227
|
-
color:
|
|
3890
|
+
color: orange[mainShade].hex
|
|
5228
3891
|
},
|
|
5229
3892
|
"&.url": {
|
|
5230
|
-
color:
|
|
3893
|
+
color: red[mainShade].hex
|
|
5231
3894
|
},
|
|
5232
3895
|
"&.variable": {
|
|
5233
|
-
color:
|
|
3896
|
+
color: red[mainShade].hex
|
|
5234
3897
|
}
|
|
5235
3898
|
};
|
|
5236
3899
|
}
|
|
5237
|
-
function codeBaseStyle() {
|
|
5238
|
-
return css(_a$r || (_a$r = __template$r(["\n color:
|
|
3900
|
+
function codeBaseStyle(props) {
|
|
3901
|
+
return css(_a$r || (_a$r = __template$r(["\n color: ", ";\n\n & code {\n font-family: inherit;\n\n &.refractor .token {\n ", "\n }\n }\n\n & a {\n color: inherit;\n text-decoration: underline;\n border-radius: 1px;\n }\n\n & svg {\n /* Certain popular CSS libraries changes the defaults for SVG display */\n /* Make sure SVGs are rendered as inline elements */\n display: inline;\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n }\n "])), cssVars.default["text-code"], codeSyntaxHighlightingStyle(props.$scheme));
|
|
5239
3902
|
}
|
|
5240
3903
|
const Root$s = styled.pre(codeBaseStyle, responsiveCodeFontStyle);
|
|
5241
3904
|
const Code = forwardRef(function Code2(props, ref) {
|
|
@@ -5248,12 +3911,16 @@ const Code = forwardRef(function Code2(props, ref) {
|
|
|
5248
3911
|
} = props;
|
|
5249
3912
|
const language = typeof languageProp === "string" ? languageProp : void 0;
|
|
5250
3913
|
const registered = language ? Refractor.hasLanguage(language) : false;
|
|
3914
|
+
const {
|
|
3915
|
+
scheme
|
|
3916
|
+
} = useToneContext();
|
|
5251
3917
|
return /* @__PURE__ */jsxs(Root$s, {
|
|
5252
3918
|
"data-ui": "Code",
|
|
5253
3919
|
...restProps,
|
|
5254
3920
|
$size: useArrayProp(size),
|
|
5255
3921
|
$weight: weight,
|
|
5256
3922
|
ref,
|
|
3923
|
+
$scheme: scheme,
|
|
5257
3924
|
children: [!(language && registered) && /* @__PURE__ */jsx("code", {
|
|
5258
3925
|
children
|
|
5259
3926
|
}), language && registered && /* @__PURE__ */jsx(Refractor, {
|
|
@@ -5341,7 +4008,7 @@ function headingBaseStyle(props) {
|
|
|
5341
4008
|
$muted,
|
|
5342
4009
|
theme
|
|
5343
4010
|
} = props;
|
|
5344
|
-
return css(_c$9 || (_c$9 = __template$q(["\n ", "\n\n ", "\n\n & code {\n font-family: ", ";\n border-radius: 1px;\n }\n\n & a {\n text-decoration: none;\n border-radius: 1px;\n color:
|
|
4011
|
+
return css(_c$9 || (_c$9 = __template$q(["\n ", "\n\n ", "\n\n & code {\n font-family: ", ";\n border-radius: 1px;\n }\n\n & a {\n text-decoration: none;\n border-radius: 1px;\n color: ", ";\n outline: none;\n\n @media (hover: hover) {\n &:hover {\n text-decoration: underline;\n }\n }\n\n &:focus {\n box-shadow:\n 0 0 0 1px ", ",\n 0 0 0 3px ", ";\n }\n\n &:focus:not(:focus-visible) {\n box-shadow: none;\n }\n }\n\n & svg {\n /* Certain popular CSS libraries changes the defaults for SVG display */\n /* Make sure SVGs are rendered as inline elements */\n display: inline;\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n }\n "])), $accent && css(_a$q || (_a$q = __template$q(["\n color: ", "};\n "])), cssVars.default["text-accent"]), $muted && css(_b$g || (_b$g = __template$q(["\n color: ", ";\n "])), cssVars.mutable["muted-fg-color"]), theme.sanity.fonts.code.family, cssVars.default["text-link"], cssVars.mutable["bg-color"], cssVars.positive["border-accent"]);
|
|
5345
4012
|
}
|
|
5346
4013
|
var __freeze$p = Object.freeze;
|
|
5347
4014
|
var __defProp$q = Object.defineProperty;
|
|
@@ -5435,7 +4102,7 @@ var __template$o = (cooked, raw) => __freeze$o(__defProp$p(cooked, "raw", {
|
|
|
5435
4102
|
}));
|
|
5436
4103
|
var _a$o;
|
|
5437
4104
|
function kbdStyle() {
|
|
5438
|
-
return css(_a$o || (_a$o = __template$o(["\n background:
|
|
4105
|
+
return css(_a$o || (_a$o = __template$o(["\n background: ", ";\n font: inherit;\n\n &:not([hidden]) {\n display: inline-block;\n }\n "])), cssVars.default["bg-tint"]);
|
|
5439
4106
|
}
|
|
5440
4107
|
const Root$n = styled.kbd(responsiveRadiusStyle, kbdStyle);
|
|
5441
4108
|
const KBD = forwardRef(function KBD2(props, ref) {
|
|
@@ -6175,8 +4842,8 @@ var __template$l = (cooked, raw) => __freeze$l(__defProp$l(cooked, "raw", {
|
|
|
6175
4842
|
}));
|
|
6176
4843
|
var _a$l, _b$e, _c$8;
|
|
6177
4844
|
const Root$j = styled.div(_a$l || (_a$l = __template$l(["\n position: absolute;\n pointer-events: none;\n width: ", "px;\n height: ", "px;\n fill: none;\n\n :empty + & {\n display: none;\n }\n\n & > svg {\n display: block;\n transform-origin: ", "px ", "px;\n }\n\n [data-placement^='top'] > & {\n bottom: -", "px;\n }\n\n [data-placement^='right'] > & {\n left: -", "px;\n\n & > svg {\n transform: rotate(90deg);\n }\n }\n\n [data-placement^='left'] > & {\n right: -", "px;\n\n & > svg {\n transform: rotate(-90deg);\n }\n }\n\n [data-placement^='bottom'] > & {\n top: -", "px;\n\n & > svg {\n transform: rotate(180deg);\n }\n }\n"])), DEFAULT_POPOVER_ARROW_WIDTH, DEFAULT_POPOVER_ARROW_WIDTH, DEFAULT_POPOVER_ARROW_WIDTH / 2, DEFAULT_POPOVER_ARROW_WIDTH / 2, DEFAULT_POPOVER_ARROW_WIDTH, DEFAULT_POPOVER_ARROW_WIDTH, DEFAULT_POPOVER_ARROW_WIDTH, DEFAULT_POPOVER_ARROW_WIDTH);
|
|
6178
|
-
const BorderPath = styled.path(_b$e || (_b$e = __template$l(["\n fill:
|
|
6179
|
-
const ShapePath = styled.path(_c$8 || (_c$8 = __template$l(["\n fill:
|
|
4845
|
+
const BorderPath = styled.path(_b$e || (_b$e = __template$l(["\n fill: ", ";\n"])), cssVars.default["base-shadow-outline-color"]);
|
|
4846
|
+
const ShapePath = styled.path(_c$8 || (_c$8 = __template$l(["\n fill: ", ";\n"])), cssVars.mutable["bg-color"]);
|
|
6180
4847
|
const PopoverArrow = forwardRef(function PopoverArrow2(props, ref) {
|
|
6181
4848
|
return /* @__PURE__ */jsx(Root$j, {
|
|
6182
4849
|
"data-ui": "Popover__arrow",
|
|
@@ -6229,6 +4896,7 @@ const PopoverCard = memo(forwardRef(function PopoverCard2(props, ref) {
|
|
|
6229
4896
|
const {
|
|
6230
4897
|
zIndex
|
|
6231
4898
|
} = useLayer();
|
|
4899
|
+
const toneContext = useToneContext();
|
|
6232
4900
|
const margins = useMemo(() => marginsProp || DEFAULT_POPOVER_MARGINS, [marginsProp]);
|
|
6233
4901
|
const x = (xProp != null ? xProp : 0) + margins[3];
|
|
6234
4902
|
const y = (yProp != null ? yProp : 0) + margins[0];
|
|
@@ -6254,14 +4922,16 @@ const PopoverCard = memo(forwardRef(function PopoverCard2(props, ref) {
|
|
|
6254
4922
|
return /* @__PURE__ */jsxs(Root$i, {
|
|
6255
4923
|
"data-ui": "Popover",
|
|
6256
4924
|
...restProps,
|
|
4925
|
+
"data-tone": tone,
|
|
6257
4926
|
"data-placement": placement,
|
|
6258
4927
|
radius,
|
|
6259
4928
|
ref,
|
|
6260
4929
|
scheme,
|
|
6261
4930
|
shadow,
|
|
6262
4931
|
sizing: "border",
|
|
4932
|
+
updateCssVars: true,
|
|
4933
|
+
tone: tone === "inherit" ? toneContext.tone : tone,
|
|
6263
4934
|
style: rootStyle,
|
|
6264
|
-
tone,
|
|
6265
4935
|
children: [/* @__PURE__ */jsx(Flex, {
|
|
6266
4936
|
"data-ui": "Popover__wrapper",
|
|
6267
4937
|
direction: "column",
|
|
@@ -6371,13 +5041,13 @@ const Popover = memo(forwardRef(function Popover2(props, ref) {
|
|
|
6371
5041
|
}));
|
|
6372
5042
|
if (constrainSize || matchReferenceWidth) {
|
|
6373
5043
|
ret.push(size({
|
|
6374
|
-
apply(
|
|
5044
|
+
apply(_ref6) {
|
|
6375
5045
|
let {
|
|
6376
5046
|
availableWidth,
|
|
6377
5047
|
availableHeight,
|
|
6378
5048
|
elements,
|
|
6379
5049
|
referenceWidth
|
|
6380
|
-
} =
|
|
5050
|
+
} = _ref6;
|
|
6381
5051
|
referenceWidthRef.current = referenceWidth;
|
|
6382
5052
|
const _currentWidth = widthRef.current;
|
|
6383
5053
|
const _maxWidth = maxWidthRef.current;
|
|
@@ -6525,24 +5195,23 @@ function inputElementStyle(props) {
|
|
|
6525
5195
|
const {
|
|
6526
5196
|
focusRing
|
|
6527
5197
|
} = input.radio;
|
|
6528
|
-
const color = theme.sanity.color.input;
|
|
6529
5198
|
const dist = (input.radio.size - input.radio.markSize) / 2;
|
|
6530
|
-
return css(_b$d || (_b$d = __template$k(["\n appearance: none;\n position: absolute;\n top: 0;\n left: 0;\n opacity: 0;\n height: 100%;\n width: 100%;\n outline: none;\n z-index: 1;\n padding: 0;\n margin: 0;\n border-radius: ", ";\n border: none;\n\n /* enabled */\n & + span {\n display: block;\n position: relative;\n height: ", ";\n width: ", ";\n border-radius: ", ";\n background: ", ";\n box-shadow: ", ";\n\n &::after {\n content: '';\n position: absolute;\n top: ", ";\n left: ", ";\n height: ", ";\n width: ", ";\n border-radius: ", ";\n background: ", ";\n opacity: 0;\n }\n }\n\n /* focused */\n &:not(:disabled):focus + span {\n box-shadow: ", ";\n }\n\n &:not(:disabled):focus:not(:focus-visible) + span {\n box-shadow: ", ";\n }\n\n &:checked + span::after {\n opacity: 1;\n }\n\n /* customValidity */\n &[data-error] + span {\n background-color: ", ";\n box-shadow: ", ";\n &::after {\n background: ", ";\n }\n }\n\n /* read only */\n &[data-read-only] + span {\n box-shadow: 0 0 0 1px ", ";\n background: ", ";\n\n &::after {\n background: ", ";\n }\n }\n\n /* disabled */\n &:not([data-read-only]):disabled + span {\n box-shadow: 0 0 0 1px ", ";\n background: ", ";\n\n &::after {\n background: ", ";\n }\n }\n "])), rem(input.radio.size / 2), rem(input.radio.size), rem(input.radio.size), rem(input.radio.size / 2),
|
|
6531
|
-
color:
|
|
5199
|
+
return css(_b$d || (_b$d = __template$k(["\n appearance: none;\n position: absolute;\n top: 0;\n left: 0;\n opacity: 0;\n height: 100%;\n width: 100%;\n outline: none;\n z-index: 1;\n padding: 0;\n margin: 0;\n border-radius: ", ";\n border: none;\n\n /* enabled */\n & + span {\n display: block;\n position: relative;\n height: ", ";\n width: ", ";\n border-radius: ", ";\n background: ", ";\n box-shadow: ", ";\n\n &::after {\n content: '';\n position: absolute;\n top: ", ";\n left: ", ";\n height: ", ";\n width: ", ";\n border-radius: ", ";\n background: ", ";\n opacity: 0;\n }\n }\n\n /* focused */\n &:not(:disabled):focus + span {\n box-shadow: ", ";\n }\n\n &:not(:disabled):focus:not(:focus-visible) + span {\n box-shadow: ", ";\n }\n\n &:checked + span::after {\n opacity: 1;\n }\n\n /* customValidity */\n &[data-error] + span {\n background-color: ", ";\n box-shadow: ", ";\n &::after {\n background: ", ";\n }\n }\n\n /* read only */\n &[data-read-only] + span {\n box-shadow: 0 0 0 1px ", ";\n background: ", ";\n\n &::after {\n background: ", ";\n }\n }\n\n /* disabled */\n &:not([data-read-only]):disabled + span {\n box-shadow: 0 0 0 1px ", ";\n background: ", ";\n\n &::after {\n background: ", ";\n }\n }\n "])), rem(input.radio.size / 2), rem(input.radio.size), rem(input.radio.size), rem(input.radio.size / 2), cssVars.default["bg-base"], focusRingBorderStyle({
|
|
5200
|
+
color: cssVars.default["border-base"],
|
|
6532
5201
|
width: input.border.width
|
|
6533
|
-
}), rem(dist), rem(dist), rem(input.radio.markSize), rem(input.radio.markSize), rem(input.radio.markSize / 2),
|
|
5202
|
+
}), rem(dist), rem(dist), rem(input.radio.markSize), rem(input.radio.markSize), rem(input.radio.markSize / 2), cssVars.default["text-secondary"], focusRingStyle({
|
|
6534
5203
|
border: {
|
|
6535
5204
|
width: input.border.width,
|
|
6536
|
-
color:
|
|
5205
|
+
color: cssVars.default["border-base"]
|
|
6537
5206
|
},
|
|
6538
5207
|
focusRing
|
|
6539
5208
|
}), focusRingBorderStyle({
|
|
6540
|
-
color:
|
|
5209
|
+
color: cssVars.default["border-base"],
|
|
6541
5210
|
width: input.border.width
|
|
6542
|
-
}),
|
|
5211
|
+
}), cssVars.critical["border-base"], focusRingBorderStyle({
|
|
6543
5212
|
width: input.border.width,
|
|
6544
|
-
color:
|
|
6545
|
-
}),
|
|
5213
|
+
color: cssVars.critical["text-secondary"]
|
|
5214
|
+
}), cssVars.critical["text-secondary"], cssVars.default["border-base"], cssVars.default["bg-tint"], cssVars.default["border-base"], cssVars.default["border-base"], cssVars.default["bg-tint"], cssVars.default["border-base"]);
|
|
6546
5215
|
}
|
|
6547
5216
|
const Root$h = styled.div(radioBaseStyle);
|
|
6548
5217
|
const Input$4 = styled.input(inputElementStyle);
|
|
@@ -6598,24 +5267,23 @@ function inputColorStyle(props) {
|
|
|
6598
5267
|
const {
|
|
6599
5268
|
focusRing
|
|
6600
5269
|
} = input.select;
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
color: color.default.enabled.border,
|
|
5270
|
+
return css(_c$7 || (_c$7 = __template$j(["\n /* enabled */\n background-color: ", ";\n color: ", ";\n box-shadow: ", ";\n\n /* hovered */\n @media (hover: hover) {\n &:not(:disabled):hover {\n background-color: ", ";\n color: ", ";\n box-shadow: ", ";\n }\n }\n\n /* focused */\n &:not(:disabled):focus {\n box-shadow: ", ";\n }\n\n /* read-only */\n &[data-read-only] {\n background-color: ", ";\n color: ", ";\n box-shadow: ", ";\n }\n\n /* disabled */\n &:not([data-read-only]):disabled {\n background-color: ", ";\n color: ", ";\n box-shadow: ", ";\n }\n "])), cssVars.default["bg-base"], cssVars.default["text-primary"], focusRingBorderStyle({
|
|
5271
|
+
color: cssVars.default["border-base"],
|
|
6604
5272
|
width: input.border.width
|
|
6605
|
-
}),
|
|
6606
|
-
color:
|
|
5273
|
+
}), cssVars.default["bg-base-hover"], cssVars.default["text-primary"], focusRingBorderStyle({
|
|
5274
|
+
color: cssVars.default["border-base-hover"],
|
|
6607
5275
|
width: input.border.width
|
|
6608
5276
|
}), focusRingStyle({
|
|
6609
5277
|
border: {
|
|
6610
5278
|
width: input.border.width,
|
|
6611
|
-
color:
|
|
5279
|
+
color: cssVars.default["border-base"]
|
|
6612
5280
|
},
|
|
6613
5281
|
focusRing
|
|
6614
|
-
}),
|
|
6615
|
-
color:
|
|
5282
|
+
}), cssVars.default["bg-tint"], cssVars.default["text-primary"], focusRingBorderStyle({
|
|
5283
|
+
color: cssVars.default["border-base"],
|
|
6616
5284
|
width: input.border.width
|
|
6617
|
-
}),
|
|
6618
|
-
color:
|
|
5285
|
+
}), cssVars.default["bg-tint"], cssVars.default["text-primary"], focusRingBorderStyle({
|
|
5286
|
+
color: cssVars.default["border-base"],
|
|
6619
5287
|
width: input.border.width
|
|
6620
5288
|
}));
|
|
6621
5289
|
}
|
|
@@ -6638,12 +5306,8 @@ function inputTextSizeStyle(props) {
|
|
|
6638
5306
|
function inputStyle() {
|
|
6639
5307
|
return [responsiveRadiusStyle, inputBaseStyle, inputColorStyle, inputTextSizeStyle, responsiveInputPaddingIconRightStyle];
|
|
6640
5308
|
}
|
|
6641
|
-
function iconBoxStyle(
|
|
6642
|
-
|
|
6643
|
-
theme
|
|
6644
|
-
} = props;
|
|
6645
|
-
const color = theme.sanity.color.input;
|
|
6646
|
-
return css(_d$5 || (_d$5 = __template$j(["\n pointer-events: none;\n position: absolute;\n top: 0;\n right: 0;\n\n /* enabled */\n --card-fg-color: ", ";\n\n /* hover */\n @media (hover: hover) {\n select:not(disabled):not(:read-only):hover + && {\n --card-fg-color: ", ";\n }\n }\n\n /* disabled */\n select:disabled + && {\n --card-fg-color: ", ";\n }\n\n /* read-only */\n select[data-read-only] + && {\n --card-fg-color: ", ";\n }\n "])), color.default.enabled.fg, color.default.hovered.fg, color.default.disabled.fg, color.default.readOnly.fg);
|
|
5309
|
+
function iconBoxStyle() {
|
|
5310
|
+
return css(_d$5 || (_d$5 = __template$j(["\n pointer-events: none;\n position: absolute;\n top: 0;\n right: 0;\n\n /* enabled */\n ", ": ", ";\n\n /* hover */\n @media (hover: hover) {\n select:not(disabled):not(:read-only):hover + && {\n ", ": ", ";\n }\n }\n\n /* disabled */\n select:disabled + && {\n ", ": ", ";\n }\n\n /* read-only */\n select[data-read-only] + && {\n ", ": ", ";\n }\n "])), mutableCardVariables["fg-color"], cssVars.default["text-primary"], mutableCardVariables["fg-color"], cssVars.default["text-primary"], mutableCardVariables["fg-color"], cssVars.default["text-primary"], mutableCardVariables["fg-color"], cssVars.default["text-primary"]);
|
|
6647
5311
|
}
|
|
6648
5312
|
const selectStyle = {
|
|
6649
5313
|
root: rootStyle,
|
|
@@ -6752,10 +5416,9 @@ function switchRepresentationStyles(props) {
|
|
|
6752
5416
|
const {
|
|
6753
5417
|
focusRing
|
|
6754
5418
|
} = input.switch;
|
|
6755
|
-
|
|
6756
|
-
return css(_c$6 || (_c$6 = __template$i(["\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n --switch-box-shadow: none;\n\n &:not([hidden]) {\n display: block;\n }\n position: relative;\n width: ", ";\n height: ", ";\n border-radius: ", ";\n\n /* Make sure it\u2019s not possible to interact with the wrapper element */\n pointer-events: none;\n\n &:after {\n content: '';\n display: block;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 1;\n box-shadow: var(--switch-box-shadow);\n border-radius: inherit;\n }\n\n /* Focus styles */\n input:focus + && {\n --switch-box-shadow: ", ";\n }\n\n input:focus:not(:focus-visible) + && {\n --switch-box-shadow: none;\n }\n\n input:checked + && {\n --switch-bg-color: var(--card-focus-ring-color);\n --switch-fg-color: ", ";\n }\n\n @media (hover: hover) {\n input:not(:disabled):hover + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n\n input:not(:disabled):checked:hover + && {\n --switch-bg-color: var(--card-focus-ring-color);\n --switch-fg-color: ", ";\n }\n }\n\n input:not([data-read-only]):disabled + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n\n input[data-read-only]:disabled + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n "])), color.default.enabled.border, color.default.enabled.bg, rem(input.switch.width), rem(input.switch.height), rem(input.switch.height / 2), focusRingStyle({
|
|
5419
|
+
return css(_c$6 || (_c$6 = __template$i(["\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n --switch-box-shadow: none;\n\n &:not([hidden]) {\n display: block;\n }\n position: relative;\n width: ", ";\n height: ", ";\n border-radius: ", ";\n\n /* Make sure it\u2019s not possible to interact with the wrapper element */\n pointer-events: none;\n\n &:after {\n content: '';\n display: block;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 1;\n box-shadow: var(--switch-box-shadow);\n border-radius: inherit;\n }\n\n /* Focus styles */\n input:focus + && {\n --switch-box-shadow: ", ";\n }\n\n input:focus:not(:focus-visible) + && {\n --switch-box-shadow: none;\n }\n\n input:checked + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n\n @media (hover: hover) {\n input:not(:disabled):hover + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n\n input:not(:disabled):checked:hover + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n }\n\n input:not([data-read-only]):disabled + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n\n input[data-read-only]:disabled + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n "])), cssVars.default["border-base"], cssVars.default["bg-base"], rem(input.switch.width), rem(input.switch.height), rem(input.switch.height / 2), focusRingStyle({
|
|
6757
5420
|
focusRing
|
|
6758
|
-
}),
|
|
5421
|
+
}), cssVars.positive["border-accent"], cssVars.positive["bg-base"], cssVars.default["border-base"], cssVars.default["bg-base"], cssVars.positive["border-accent"], cssVars.positive["bg-base"], cssVars.default["border-base"], cssVars.default["bg-tint"], cssVars.default["border-base"], cssVars.default["bg-tint"]);
|
|
6759
5422
|
}
|
|
6760
5423
|
function switchTrackStyles(props) {
|
|
6761
5424
|
const {
|
|
@@ -6844,34 +5507,30 @@ const TextArea = forwardRef(function TextArea2(props, forwardedRef) {
|
|
|
6844
5507
|
padding = 3,
|
|
6845
5508
|
radius = 2,
|
|
6846
5509
|
weight,
|
|
5510
|
+
tone = "default",
|
|
6847
5511
|
...restProps
|
|
6848
5512
|
} = props;
|
|
6849
5513
|
const ref = useForwardedRef(forwardedRef);
|
|
6850
|
-
const rootTheme = useRootTheme();
|
|
6851
5514
|
useCustomValidity(ref, customValidity);
|
|
6852
5515
|
return /* @__PURE__ */jsx(Root$d, {
|
|
6853
5516
|
"data-ui": "TextArea",
|
|
6854
5517
|
children: /* @__PURE__ */jsxs(InputRoot$1, {
|
|
6855
5518
|
children: [/* @__PURE__ */jsx(Input$1, {
|
|
6856
5519
|
"data-as": "textarea",
|
|
6857
|
-
"data-
|
|
6858
|
-
"data-tone": rootTheme.tone,
|
|
5520
|
+
"data-tone": tone,
|
|
6859
5521
|
...restProps,
|
|
6860
5522
|
$fontSize: useArrayProp(fontSize),
|
|
6861
5523
|
$padding: useArrayProp(padding),
|
|
6862
|
-
$scheme: rootTheme.scheme,
|
|
6863
5524
|
$space: useArrayProp(0),
|
|
6864
|
-
$tone:
|
|
5525
|
+
$tone: tone,
|
|
6865
5526
|
$weight: weight,
|
|
6866
5527
|
disabled,
|
|
6867
5528
|
ref
|
|
6868
5529
|
}), /* @__PURE__ */jsx(Presentation$1, {
|
|
6869
5530
|
$radius: useArrayProp(radius),
|
|
6870
|
-
$
|
|
6871
|
-
$tone: rootTheme.tone,
|
|
5531
|
+
$tone: tone,
|
|
6872
5532
|
"data-border": border ? "" : void 0,
|
|
6873
|
-
"data-
|
|
6874
|
-
"data-tone": rootTheme.tone
|
|
5533
|
+
"data-tone": tone
|
|
6875
5534
|
})]
|
|
6876
5535
|
})
|
|
6877
5536
|
});
|
|
@@ -6923,10 +5582,12 @@ const TextInput = forwardRef(function TextInput2(props, forwardedRef) {
|
|
|
6923
5582
|
customValidity,
|
|
6924
5583
|
type = "text",
|
|
6925
5584
|
weight,
|
|
5585
|
+
tone: toneProp = "default",
|
|
6926
5586
|
...restProps
|
|
6927
5587
|
} = props;
|
|
6928
5588
|
const ref = useForwardedRef(forwardedRef);
|
|
6929
|
-
const
|
|
5589
|
+
const toneContext = useToneContext();
|
|
5590
|
+
const tone = toneProp === "default" ? toneContext.tone : toneProp;
|
|
6930
5591
|
const fontSize = useArrayProp(fontSizeProp);
|
|
6931
5592
|
const padding = useArrayProp(paddingProp);
|
|
6932
5593
|
const radius = useArrayProp(radiusProp);
|
|
@@ -6963,11 +5624,9 @@ const TextInput = forwardRef(function TextInput2(props, forwardedRef) {
|
|
|
6963
5624
|
$hasPrefix,
|
|
6964
5625
|
$hasSuffix,
|
|
6965
5626
|
$radius: radius,
|
|
6966
|
-
$
|
|
6967
|
-
$tone: rootTheme.tone,
|
|
5627
|
+
$tone: tone,
|
|
6968
5628
|
"data-border": border ? "" : void 0,
|
|
6969
|
-
"data-
|
|
6970
|
-
"data-tone": rootTheme.tone,
|
|
5629
|
+
"data-tone": tone,
|
|
6971
5630
|
children: [icon && /* @__PURE__ */jsx(LeftBox, {
|
|
6972
5631
|
padding,
|
|
6973
5632
|
children: /* @__PURE__ */jsxs(Text, {
|
|
@@ -6981,7 +5640,7 @@ const TextInput = forwardRef(function TextInput2(props, forwardedRef) {
|
|
|
6981
5640
|
children: [isValidElement(iconRight) && iconRight, isValidElementType(iconRight) && createElement(iconRight)]
|
|
6982
5641
|
})
|
|
6983
5642
|
})]
|
|
6984
|
-
}), [border, fontSize, icon, iconRight, padding, radius,
|
|
5643
|
+
}), [border, fontSize, icon, iconRight, padding, radius, $hasClearButton, $hasPrefix, $hasSuffix, tone]);
|
|
6985
5644
|
const clearButtonBoxPadding = useMemo(() => padding.map(v => {
|
|
6986
5645
|
if (v === 0) return 0;
|
|
6987
5646
|
if (v === 1) return 1;
|
|
@@ -7026,20 +5685,18 @@ const TextInput = forwardRef(function TextInput2(props, forwardedRef) {
|
|
|
7026
5685
|
}), [radius, suffix]);
|
|
7027
5686
|
return /* @__PURE__ */jsxs(Root$c, {
|
|
7028
5687
|
"data-ui": "TextInput",
|
|
7029
|
-
tone
|
|
5688
|
+
tone,
|
|
7030
5689
|
children: [prefixNode, /* @__PURE__ */jsxs(InputRoot, {
|
|
7031
5690
|
children: [/* @__PURE__ */jsx(Input, {
|
|
7032
5691
|
"data-as": "input",
|
|
7033
|
-
"data-
|
|
7034
|
-
"data-tone": rootTheme.tone,
|
|
5692
|
+
"data-tone": tone,
|
|
7035
5693
|
...restProps,
|
|
7036
5694
|
$fontSize: fontSize,
|
|
7037
5695
|
$iconLeft: $hasIcon,
|
|
7038
5696
|
$iconRight: $hasIconRight || $hasClearButton,
|
|
7039
5697
|
$padding: padding,
|
|
7040
|
-
$scheme: rootTheme.scheme,
|
|
7041
5698
|
$space: space,
|
|
7042
|
-
$tone:
|
|
5699
|
+
$tone: tone,
|
|
7043
5700
|
$weight: weight,
|
|
7044
5701
|
disabled,
|
|
7045
5702
|
readOnly,
|
|
@@ -7086,8 +5743,8 @@ var __template$f = (cooked, raw) => __freeze$f(__defProp$f(cooked, "raw", {
|
|
|
7086
5743
|
}));
|
|
7087
5744
|
var _a$f, _b$9, _c$4;
|
|
7088
5745
|
const Root$b = styled.div(_a$f || (_a$f = __template$f(["\n position: absolute;\n pointer-events: none;\n width: 15px;\n height: 15px;\n fill: none;\n\n :empty + & {\n display: none;\n }\n\n & > svg {\n display: block;\n transform-origin: 7.5px 7.5px;\n }\n\n /* position: absolute;\n width: 15px;\n height: 15px;\n fill: none;\n\n :empty + & {\n display: none;\n }\n\n & > svg {\n &:not([hidden]) {\n display: block;\n }\n transform-origin: 7.5px 7.5px;\n } */\n\n [data-placement^='top'] > & {\n bottom: -27px;\n }\n\n [data-placement^='right'] > & {\n left: -27px;\n\n & > svg {\n transform: rotate(90deg);\n }\n }\n\n [data-placement^='left'] > & {\n right: -27px;\n\n & > svg {\n transform: rotate(-90deg);\n }\n }\n\n [data-placement^='bottom'] > & {\n top: -27px;\n\n & > svg {\n transform: rotate(180deg);\n }\n }\n"])));
|
|
7089
|
-
const Border = styled.path(_b$9 || (_b$9 = __template$f(["\n fill:
|
|
7090
|
-
const Shape = styled.path(_c$4 || (_c$4 = __template$f(["\n fill:
|
|
5746
|
+
const Border = styled.path(_b$9 || (_b$9 = __template$f(["\n fill: ", ";\n"])), cssVars.default["base-shadow-outline-color"]);
|
|
5747
|
+
const Shape = styled.path(_c$4 || (_c$4 = __template$f(["\n fill: ", ";\n"])), cssVars.mutable["bg-color"]);
|
|
7091
5748
|
const TooltipArrow = forwardRef(function TooltipArrow2(props, ref) {
|
|
7092
5749
|
const {
|
|
7093
5750
|
...restProps
|
|
@@ -7186,12 +5843,12 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
|
|
|
7186
5843
|
mainAxis: 3
|
|
7187
5844
|
}));
|
|
7188
5845
|
ret.push(size$2({
|
|
7189
|
-
apply(
|
|
5846
|
+
apply(_ref7) {
|
|
7190
5847
|
let {
|
|
7191
5848
|
availableWidth,
|
|
7192
5849
|
availableHeight,
|
|
7193
5850
|
elements
|
|
7194
|
-
} =
|
|
5851
|
+
} = _ref7;
|
|
7195
5852
|
Object.assign(elements.floating.style, {
|
|
7196
5853
|
maxWidth: "".concat(availableWidth - 4 * 2, "px"),
|
|
7197
5854
|
// the padding is `4px`
|
|
@@ -7497,10 +6154,10 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete2(props, ref) {
|
|
|
7497
6154
|
query,
|
|
7498
6155
|
value
|
|
7499
6156
|
} = state;
|
|
7500
|
-
const defaultRenderOption = useCallback(
|
|
6157
|
+
const defaultRenderOption = useCallback(_ref8 => {
|
|
7501
6158
|
let {
|
|
7502
6159
|
value: value2
|
|
7503
|
-
} =
|
|
6160
|
+
} = _ref8;
|
|
7504
6161
|
return /* @__PURE__ */jsx(Card, {
|
|
7505
6162
|
"data-as": "button",
|
|
7506
6163
|
padding: paddingProp,
|
|
@@ -7954,11 +6611,7 @@ const Breadcrumbs = forwardRef(function Breadcrumbs2(props, ref) {
|
|
|
7954
6611
|
});
|
|
7955
6612
|
});
|
|
7956
6613
|
const BORDER_OFFSET_X = 12;
|
|
7957
|
-
function dialogStyle(
|
|
7958
|
-
let {
|
|
7959
|
-
theme
|
|
7960
|
-
} = _ref24;
|
|
7961
|
-
const color = theme.sanity.color.base;
|
|
6614
|
+
function dialogStyle() {
|
|
7962
6615
|
return {
|
|
7963
6616
|
"&:not([hidden])": {
|
|
7964
6617
|
display: "flex"
|
|
@@ -7970,7 +6623,7 @@ function dialogStyle(_ref24) {
|
|
|
7970
6623
|
alignItems: "center",
|
|
7971
6624
|
justifyContent: "center",
|
|
7972
6625
|
outline: "none",
|
|
7973
|
-
background:
|
|
6626
|
+
background: cssVars.default["base-shadow-umbra-color"]
|
|
7974
6627
|
};
|
|
7975
6628
|
}
|
|
7976
6629
|
function responsiveDialogPositionStyle(props) {
|
|
@@ -8008,9 +6661,9 @@ const Root$7 = styled(Layer)(responsivePaddingStyle, dialogStyle, responsiveDial
|
|
|
8008
6661
|
const DialogContainer = styled(Container)(_a$b || (_a$b = __template$b(["\n &:not([hidden]) {\n display: flex;\n }\n width: 100%;\n height: 100%;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n"])));
|
|
8009
6662
|
const DialogCardRoot = styled(Card)(_b$6 || (_b$6 = __template$b(["\n &:not([hidden]) {\n display: flex;\n }\n width: 100%;\n min-height: 0;\n max-height: 100%;\n overflow: hidden;\n overflow: clip;\n"])));
|
|
8010
6663
|
const DialogLayout = styled(Flex)(_c$2 || (_c$2 = __template$b(["\n flex: 1;\n min-height: 0;\n width: 100%;\n"])));
|
|
8011
|
-
const DialogHeader = styled(Card)(_d$1 || (_d$1 = __template$b(["\n position: relative;\n z-index: 2;\n\n &:after {\n content: '';\n display: block;\n position: absolute;\n left: ", "px;\n right: ", "px;\n bottom: -1px;\n border-bottom: 1px solid
|
|
6664
|
+
const DialogHeader = styled(Card)(_d$1 || (_d$1 = __template$b(["\n position: relative;\n z-index: 2;\n\n &:after {\n content: '';\n display: block;\n position: absolute;\n left: ", "px;\n right: ", "px;\n bottom: -1px;\n border-bottom: 1px solid ", ";\n width: auto;\n opacity: ", ";\n transition: opacity 200ms ease-in;\n }\n"])), BORDER_OFFSET_X, BORDER_OFFSET_X, cssVars.default["border-base"], props => props.$isContentScrollable && props.$hasScrolledFromTop ? 1 : 0);
|
|
8012
6665
|
const DialogContent = styled(Box)(_e || (_e = __template$b(["\n position: relative;\n z-index: 1;\n overflow: auto;\n outline: none;\n"])));
|
|
8013
|
-
const DialogFooter = styled(Box)(_f || (_f = __template$b(["\n position: relative;\n z-index: 3;\n\n &:before {\n content: '';\n display: block;\n position: absolute;\n left: ", "px;\n right: ", "px;\n top: -1px;\n border-top: 1px solid
|
|
6666
|
+
const DialogFooter = styled(Box)(_f || (_f = __template$b(["\n position: relative;\n z-index: 3;\n\n &:before {\n content: '';\n display: block;\n position: absolute;\n left: ", "px;\n right: ", "px;\n top: -1px;\n border-top: 1px solid ", ";\n width: auto;\n opacity: ", ";\n transition: opacity 200ms ease-in;\n }\n"])), BORDER_OFFSET_X, BORDER_OFFSET_X, cssVars.default["border-base"], props => props.$isContentScrollable && !props.$hasScrolledToBottom ? 1 : 0);
|
|
8014
6667
|
const DialogCard = forwardRef(function DialogCard2(props, ref) {
|
|
8015
6668
|
var _a2;
|
|
8016
6669
|
const {
|
|
@@ -8752,7 +7405,7 @@ var __template$8 = (cooked, raw) => __freeze$8(__defProp$8(cooked, "raw", {
|
|
|
8752
7405
|
value: __freeze$8(raw || cooked.slice())
|
|
8753
7406
|
}));
|
|
8754
7407
|
var _a$8;
|
|
8755
|
-
const MenuDivider = styled.hr(_a$8 || (_a$8 = __template$8(["\n height: 1px;\n border: 0;\n background:
|
|
7408
|
+
const MenuDivider = styled.hr(_a$8 || (_a$8 = __template$8(["\n height: 1px;\n border: 0;\n background: ", ";\n margin: 0;\n"])), cssVars.default["border-base"]);
|
|
8756
7409
|
var __freeze$7 = Object.freeze;
|
|
8757
7410
|
var __defProp$7 = Object.defineProperty;
|
|
8758
7411
|
var __template$7 = (cooked, raw) => __freeze$7(__defProp$7(cooked, "raw", {
|
|
@@ -8765,16 +7418,11 @@ function selectableBaseStyle() {
|
|
|
8765
7418
|
function selectableColorStyle(props) {
|
|
8766
7419
|
var _a2, _b2;
|
|
8767
7420
|
const {
|
|
7421
|
+
theme,
|
|
8768
7422
|
$tone,
|
|
8769
|
-
|
|
7423
|
+
$scheme
|
|
8770
7424
|
} = props;
|
|
8771
|
-
|
|
8772
|
-
base,
|
|
8773
|
-
muted,
|
|
8774
|
-
selectable
|
|
8775
|
-
} = theme.sanity.color;
|
|
8776
|
-
const tone = selectable ? selectable[$tone] || selectable.default : muted[$tone] || muted.default;
|
|
8777
|
-
return css(_b$4 || (_b$4 = __template$7(["\n ", "\n\n background-color: var(--card-bg-color);\n color: var(--card-fg-color);\n outline: none;\n\n /* &:is(button) */\n &[data-as='button'] {\n &:disabled {\n ", "\n }\n\n &:not(:disabled) {\n &[aria-pressed='true'] {\n ", "\n }\n\n &[data-selected],\n &[aria-selected='true'] > & {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]) {\n &[data-hovered],\n &:hover {\n ", "\n }\n\n &:active {\n ", "\n }\n }\n }\n }\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n &[data-disabled] {\n ", "\n }\n\n &:not([data-disabled]) {\n &[data-pressed] {\n ", "\n }\n\n &[data-selected] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]) {\n &[data-hovered],\n &:hover {\n ", "\n }\n\n &:active {\n ", "\n }\n }\n }\n }\n }\n\n ", "\n "])), _colorVarsStyle(base, tone.enabled), _colorVarsStyle(base, tone.disabled), _colorVarsStyle(base, tone.pressed), _colorVarsStyle(base, tone.selected), _colorVarsStyle(base, tone.hovered), _colorVarsStyle(base, tone.pressed), _colorVarsStyle(base, tone.disabled), _colorVarsStyle(base, tone.pressed), _colorVarsStyle(base, tone.selected), _colorVarsStyle(base, tone.hovered), _colorVarsStyle(base, tone.pressed), (_b2 = (_a2 = theme.sanity.styles) == null ? void 0 : _a2.card) == null ? void 0 : _b2.root);
|
|
7425
|
+
return css(_b$4 || (_b$4 = __template$7(["\n ", "\n ", "\n\n background-color: ", ";\n color: ", ";\n outline: none;\n\n /* &:is(button) - Looks like a button in default mode */\n &[data-as='button'] {\n &:disabled {\n ", "\n }\n\n &:not(:disabled) {\n &[aria-pressed='true'] {\n ", "\n }\n\n &[data-selected],\n &[aria-selected='true'] > & {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]) {\n &[data-hovered],\n &:hover {\n ", "\n }\n\n &:active {\n ", "\n }\n }\n }\n }\n }\n\n /* &:is(a) */\n &[data-as='a'] {\n &[data-disabled] {\n ", "\n }\n\n &:not([data-disabled]) {\n &[data-pressed] {\n ", "\n }\n\n &[data-selected] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]) {\n &[data-hovered],\n &:hover {\n ", "\n }\n\n &:active {\n ", "\n }\n }\n }\n }\n }\n\n ", "\n "])), $tone !== "default" && createCssVars($scheme, theme.sanity.color.tones, $tone), _selectableVarStyle(), cssVars.mutable["bg-color"], cssVars[$tone]["text-secondary"], _selectableVarStyleDisabled(), _colorVarStyleActive(), _colorVarStyleSelected(), _colorVarStyleHover(), _colorVarStyleActive(), _selectableVarStyleDisabled(), _colorVarStyleActive(), _colorVarStyleSelected(), _colorVarStyleHover(), _colorVarStyleActive(), (_b2 = (_a2 = theme.sanity.styles) == null ? void 0 : _a2.card) == null ? void 0 : _b2.root);
|
|
8778
7426
|
}
|
|
8779
7427
|
const Selectable = styled(Box)(responsiveRadiusStyle, selectableBaseStyle, selectableColorStyle);
|
|
8780
7428
|
function useMenu() {
|
|
@@ -8802,6 +7450,9 @@ function MenuGroup(props) {
|
|
|
8802
7450
|
tone = "default",
|
|
8803
7451
|
...restProps
|
|
8804
7452
|
} = props;
|
|
7453
|
+
const {
|
|
7454
|
+
scheme
|
|
7455
|
+
} = useToneContext();
|
|
8805
7456
|
const menu = useMenu();
|
|
8806
7457
|
const {
|
|
8807
7458
|
activeElement,
|
|
@@ -8891,6 +7542,7 @@ function MenuGroup(props) {
|
|
|
8891
7542
|
"data-selected": !withinMenu && active ? "" : void 0,
|
|
8892
7543
|
$radius: useArrayProp(radius),
|
|
8893
7544
|
$tone: tone,
|
|
7545
|
+
$scheme: scheme,
|
|
8894
7546
|
onClick: handleClick,
|
|
8895
7547
|
onKeyDown: handleKeyDown,
|
|
8896
7548
|
onMouseEnter: handleMouseEnter,
|
|
@@ -8948,6 +7600,9 @@ const MenuItem = forwardRef(function MenuItem2(props, forwardedRef) {
|
|
|
8948
7600
|
tone = "default",
|
|
8949
7601
|
...restProps
|
|
8950
7602
|
} = props;
|
|
7603
|
+
const {
|
|
7604
|
+
scheme
|
|
7605
|
+
} = useToneContext();
|
|
8951
7606
|
const menu = useMenu();
|
|
8952
7607
|
const {
|
|
8953
7608
|
activeElement,
|
|
@@ -8989,6 +7644,7 @@ const MenuItem = forwardRef(function MenuItem2(props, forwardedRef) {
|
|
|
8989
7644
|
$radius: useArrayProp(radius),
|
|
8990
7645
|
$padding: useArrayProp(0),
|
|
8991
7646
|
$tone: tone,
|
|
7647
|
+
$scheme: scheme,
|
|
8992
7648
|
disabled,
|
|
8993
7649
|
onClick: handleClick,
|
|
8994
7650
|
onMouseEnter: onItemMouseEnter,
|
|
@@ -9043,18 +7699,18 @@ var __template$6 = (cooked, raw) => __freeze$6(__defProp$6(cooked, "raw", {
|
|
|
9043
7699
|
}));
|
|
9044
7700
|
var _a$6, _b$3, _c$1, _d;
|
|
9045
7701
|
const keyframe = keyframes(_a$6 || (_a$6 = __template$6(["\n 0% {\n background-position: 100%;\n }\n 100% {\n background-position: -100%;\n }\n"])));
|
|
9046
|
-
const animation = css(_b$3 || (_b$3 = __template$6(["\n background-image: linear-gradient(\n to right,\n
|
|
9047
|
-
const skeletonStyle = css(_d || (_d = __template$6(["\n opacity: ", ";\n transition: opacity 200ms ease-in;\n\n @media screen and (prefers-reduced-motion: no-preference) {\n ", "\n }\n\n @media screen and (prefers-reduced-motion: reduce) {\n background-color:
|
|
7702
|
+
const animation = css(_b$3 || (_b$3 = __template$6(["\n background-image: linear-gradient(\n to right,\n ", ",\n ", ",\n ", ",\n ", ",\n ", "\n );\n background-position: 100%;\n background-size: 200% 100%;\n background-attachment: fixed;\n animation-name: ", ";\n animation-timing-function: ease-in-out;\n animation-iteration-count: infinite;\n animation-duration: 2000ms;\n"])), cssVars.default["skeleton-from"], cssVars.default["skeleton-to"], cssVars.default["skeleton-from"], cssVars.default["skeleton-from"], cssVars.default["skeleton-from"], keyframe);
|
|
7703
|
+
const skeletonStyle = css(_d || (_d = __template$6(["\n opacity: ", ";\n transition: opacity 200ms ease-in;\n\n @media screen and (prefers-reduced-motion: no-preference) {\n ", "\n }\n\n @media screen and (prefers-reduced-motion: reduce) {\n background-color: ", ";\n }\n"])), _ref9 => {
|
|
9048
7704
|
let {
|
|
9049
7705
|
$visible
|
|
9050
|
-
} =
|
|
7706
|
+
} = _ref9;
|
|
9051
7707
|
return $visible ? 1 : 0;
|
|
9052
|
-
},
|
|
7708
|
+
}, _ref10 => {
|
|
9053
7709
|
let {
|
|
9054
7710
|
$animated
|
|
9055
|
-
} =
|
|
9056
|
-
return $animated ? animation : css(_c$1 || (_c$1 = __template$6(["\n background-color:
|
|
9057
|
-
});
|
|
7711
|
+
} = _ref10;
|
|
7712
|
+
return $animated ? animation : css(_c$1 || (_c$1 = __template$6(["\n background-color: ", ";\n "])), cssVars.default["skeleton-from"]);
|
|
7713
|
+
}, cssVars.default["skeleton-from"]);
|
|
9058
7714
|
const Root$4 = styled(Box)(responsiveRadiusStyle, skeletonStyle);
|
|
9059
7715
|
const Skeleton = forwardRef(function Skeleton2(props, ref) {
|
|
9060
7716
|
const {
|
|
@@ -9083,12 +7739,12 @@ const Skeleton = forwardRef(function Skeleton2(props, ref) {
|
|
|
9083
7739
|
ref
|
|
9084
7740
|
});
|
|
9085
7741
|
});
|
|
9086
|
-
const Root$3 = styled(Skeleton)(
|
|
7742
|
+
const Root$3 = styled(Skeleton)(_ref11 => {
|
|
9087
7743
|
let {
|
|
9088
7744
|
$size,
|
|
9089
7745
|
$style,
|
|
9090
7746
|
theme
|
|
9091
|
-
} =
|
|
7747
|
+
} = _ref11;
|
|
9092
7748
|
const {
|
|
9093
7749
|
media
|
|
9094
7750
|
} = theme.sanity;
|
|
@@ -9436,12 +8092,12 @@ function ToastProvider(props) {
|
|
|
9436
8092
|
paddingY,
|
|
9437
8093
|
children: /* @__PURE__ */jsx(AnimatePresence, {
|
|
9438
8094
|
initial: false,
|
|
9439
|
-
children: state.map(
|
|
8095
|
+
children: state.map(_ref12 => {
|
|
9440
8096
|
let {
|
|
9441
8097
|
dismiss,
|
|
9442
8098
|
id,
|
|
9443
8099
|
params
|
|
9444
|
-
} =
|
|
8100
|
+
} = _ref12;
|
|
9445
8101
|
return /* @__PURE__ */jsx(motion.div, {
|
|
9446
8102
|
animate: {
|
|
9447
8103
|
opacity: 1,
|
|
@@ -9734,18 +8390,8 @@ var _a$1, _b, _c;
|
|
|
9734
8390
|
function treeItemRootStyle() {
|
|
9735
8391
|
return css(_a$1 || (_a$1 = __template$1(["\n &[role='none'] > [role='treeitem'] {\n outline: none;\n cursor: default;\n border-radius: 3px;\n\n &:focus {\n position: relative;\n }\n }\n\n &[role='treeitem'] {\n outline: none;\n\n & > div {\n cursor: default;\n border-radius: 3px;\n }\n\n &:focus > div {\n position: relative;\n }\n }\n "])));
|
|
9736
8392
|
}
|
|
9737
|
-
function treeItemRootColorStyle(
|
|
9738
|
-
|
|
9739
|
-
theme
|
|
9740
|
-
} = props;
|
|
9741
|
-
const $tone = "default";
|
|
9742
|
-
const {
|
|
9743
|
-
base,
|
|
9744
|
-
muted,
|
|
9745
|
-
selectable
|
|
9746
|
-
} = theme.sanity.color;
|
|
9747
|
-
const tone = selectable ? selectable[$tone] || selectable.default : muted[$tone] || muted.default;
|
|
9748
|
-
return css(_b || (_b = __template$1(['\n /* <div role="none"><a data-ui="TreeItem__box" role="treeitem" tabIndex="0"></div> */\n &[role=\'none\'] {\n & > [role=\'treeitem\'] {\n ', "\n\n background-color: var(--card-bg-color);\n color: var(--treeitem-fg-color);\n }\n\n &[data-selected] > [role='treeitem'] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]) > [role='treeitem']:not(:focus):hover {\n ", "\n }\n\n & > [role='treeitem']:focus {\n ", '\n }\n }\n }\n\n /* <div role="treeitem" tabIndex="0"><div data-ui="TreeItem__box"></div> */\n &[role=\'treeitem\'] {\n & > [data-ui=\'TreeItem__box\'] {\n ', "\n\n background-color: var(--card-bg-color);\n color: var(--card-fg-color);\n }\n\n &[data-selected] > [data-ui='TreeItem__box'] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]):not(:focus) > [data-ui='TreeItem__box']:hover {\n ", "\n }\n\n &:focus > [data-ui='TreeItem__box'] {\n ", "\n }\n }\n }\n "])), _colorVarsStyle(base, tone.enabled), _colorVarsStyle(base, tone.pressed), _colorVarsStyle(base, tone.hovered), _colorVarsStyle(base, tone.selected), _colorVarsStyle(base, tone.enabled), _colorVarsStyle(base, tone.pressed), _colorVarsStyle(base, tone.hovered), _colorVarsStyle(base, tone.selected));
|
|
8393
|
+
function treeItemRootColorStyle() {
|
|
8394
|
+
return css(_b || (_b = __template$1(['\n /* <div role="none"><a data-ui="TreeItem__box" role="treeitem" tabIndex="0"></div> */\n &[role=\'none\'] {\n & > [role=\'treeitem\'] {\n ', "\n\n background-color:", ";\n color: var(--treeitem-fg-color);\n }\n\n &[data-selected] > [role='treeitem'] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]) > [role='treeitem']:not(:focus):hover {\n ", "\n }\n\n & > [role='treeitem']:focus {\n ", '\n }\n }\n }\n\n /* <div role="treeitem" tabIndex="0"><div data-ui="TreeItem__box"></div> */\n &[role=\'treeitem\'] {\n & > [data-ui=\'TreeItem__box\'] {\n ', "\n background-color: ", ";\n color: ", ";\n }\n\n &[data-selected] > [data-ui='TreeItem__box'] {\n ", "\n }\n\n @media (hover: hover) {\n &:not([data-selected]):not(:focus) > [data-ui='TreeItem__box']:hover {\n ", "\n }\n\n &:focus > [data-ui='TreeItem__box'] {\n ", "\n }\n }\n }\n "])), cardVariables, cssVars.mutable["bg-color"], _colorVarStyleActive(), _colorVarStyleHover(), _colorVarStyleSelected(), cardVariables, cssVars.mutable["bg-color"], cssVars.mutable["fg-color"], _colorVarStyleActive(), _colorVarStyleHover(), _colorVarStyleSelected());
|
|
9749
8395
|
}
|
|
9750
8396
|
function treeItemBoxStyle(props) {
|
|
9751
8397
|
const {
|
|
@@ -9941,5 +8587,5 @@ const TreeItem = memo(function TreeItem2(props) {
|
|
|
9941
8587
|
})]
|
|
9942
8588
|
});
|
|
9943
8589
|
});
|
|
9944
|
-
export { Autocomplete, Avatar, AvatarCounter, AvatarStack, Badge, BoundaryElementProvider, Box, Breadcrumbs, Button, Card, Checkbox, Code, CodeSkeleton, Container, Dialog, DialogContext, DialogProvider, ElementQuery, ErrorBoundary, Flex, Grid, Heading, HeadingSkeleton, Hotkeys, Inline, KBD, Label, LabelSkeleton, Layer, LayerProvider, Menu, MenuButton, MenuDivider, MenuGroup, MenuItem, Popover, Portal, PortalProvider, Radio, Select, Skeleton, Spinner, SrOnly, Stack, Switch, Tab, TabList, TabPanel, Text, TextArea, TextInput, TextSkeleton, ThemeColorProvider, ThemeProvider, Toast, ToastProvider, Tooltip, TooltipDelayGroupContext, TooltipDelayGroupProvider, Tree, TreeItem, VirtualList, _ResizeObserver, _elementSizeObserver, _fillCSSObject, _getArrayProp, _getResponsiveSpace, _hasFocus, _isEnterToClickElement, _isScrollable, _raf, _raf2, _responsive, attemptFocus, containsOrEqualsElement,
|
|
8590
|
+
export { Autocomplete, Avatar, AvatarCounter, AvatarStack, Badge, BoundaryElementProvider, Box, Breadcrumbs, Button, Card, Checkbox, Code, CodeSkeleton, Container, Dialog, DialogContext, DialogProvider, ElementQuery, ErrorBoundary, Flex, Grid, Heading, HeadingSkeleton, Hotkeys, Inline, KBD, Label, LabelSkeleton, Layer, LayerProvider, Menu, MenuButton, MenuDivider, MenuGroup, MenuItem, Popover, Portal, PortalProvider, Radio, Select, Skeleton, Spinner, SrOnly, Stack, Switch, Tab, TabList, TabPanel, Text, TextArea, TextInput, TextSkeleton, ThemeColorProvider, ThemeProvider, Toast, ToastProvider, Tooltip, TooltipDelayGroupContext, TooltipDelayGroupProvider, Tree, TreeItem, VirtualList, _ResizeObserver, _elementSizeObserver, _fillCSSObject, _getArrayProp, _getResponsiveSpace, _hasFocus, _isEnterToClickElement, _isScrollable, _raf, _raf2, _responsive, attemptFocus, containsOrEqualsElement, createCssVars, cssVars, focusFirstDescendant, focusLastDescendant, hexToRgb, hslToRgb, isFocusable, isHTMLAnchorElement, isHTMLButtonElement, isHTMLElement, isHTMLInputElement, isHTMLSelectElement, isHTMLTextAreaElement, multiply$1 as multiply, parseColor, rem, responsiveCodeFontStyle, responsiveHeadingFont, responsiveLabelFont, responsiveTextAlignStyle, responsiveTextFont, rgbToHex, rgbToHsl, rgba, rgbaToRGBA, screen$1 as screen, studioTheme, useArrayProp, useBoundaryElement, useClickOutside, useCustomValidity, useDialog, useElementRect, useElementSize, useForwardedRef, useGlobalKeyDown, useLayer, useMediaIndex, usePortal, usePrefersDark, usePrefersReducedMotion, useRootTheme, useTheme, useToast, useTooltipDelayGroup, useTree };
|
|
9945
8591
|
//# sourceMappingURL=index.esm.js.map
|