@veritone-ce/design-system 2.1.5 → 2.2.1
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/cjs/Button/index.js +15 -4
- package/dist/cjs/Button/styles.module.scss.js +1 -1
- package/dist/cjs/Drawer/components.js +53 -16
- package/dist/cjs/Drawer/factory.js +2 -2
- package/dist/cjs/Drawer/state.js +9 -2
- package/dist/cjs/Drawer/styles.module.scss.js +1 -1
- package/dist/cjs/IconButton/index.js +25 -7
- package/dist/cjs/IconButton/styles.module.scss.js +1 -1
- package/dist/cjs/TablePagination/index.js +2 -1
- package/dist/cjs/Tooltip/index.js +6 -5
- package/dist/cjs/Tooltip/styles.module.scss.js +1 -1
- package/dist/cjs/Typography/variants.module.scss.js +1 -1
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/styles/createPalette.js +219 -0
- package/dist/cjs/styles/createTheme.js +2 -2
- package/dist/cjs/styles/palette.js +13 -196
- package/dist/cjs/styles.css +7 -7
- package/dist/cjs/utils/recursive.js +25 -0
- package/dist/esm/Button/index.js +15 -4
- package/dist/esm/Button/styles.module.scss.js +1 -1
- package/dist/esm/Drawer/components.js +55 -18
- package/dist/esm/Drawer/factory.js +2 -2
- package/dist/esm/Drawer/state.js +9 -2
- package/dist/esm/Drawer/styles.module.scss.js +1 -1
- package/dist/esm/IconButton/index.js +25 -7
- package/dist/esm/IconButton/styles.module.scss.js +1 -1
- package/dist/esm/TablePagination/index.js +2 -1
- package/dist/esm/Tooltip/index.js +6 -5
- package/dist/esm/Tooltip/styles.module.scss.js +1 -1
- package/dist/esm/Typography/variants.module.scss.js +1 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/styles/createPalette.js +217 -0
- package/dist/esm/styles/createTheme.js +1 -1
- package/dist/esm/styles/palette.js +13 -196
- package/dist/esm/styles/scss/theme.generated.scss +72 -20
- package/dist/esm/styles.css +7 -7
- package/dist/esm/utils/recursive.js +23 -0
- package/dist/types/Button/index.d.ts +3 -1
- package/dist/types/Drawer/components.d.ts +20 -3
- package/dist/types/Drawer/factory.d.ts +5 -5
- package/dist/types/Drawer/state.d.ts +2 -1
- package/dist/types/IconButton/index.d.ts +5 -1
- package/dist/types/Tooltip/index.d.ts +3 -2
- package/dist/types/styles/createPalette.d.ts +50 -0
- package/dist/types/styles/createTheme.d.ts +2 -1
- package/dist/types/styles/css-vars.d.ts +4 -2
- package/dist/types/styles/index.d.ts +3 -2
- package/dist/types/styles/palette.d.ts +13 -55
- package/dist/types/utils/recursive.d.ts +10 -0
- package/package.json +3 -2
|
@@ -26,11 +26,12 @@ function TablePagination({
|
|
|
26
26
|
{
|
|
27
27
|
defaultValue: rowsPerPage,
|
|
28
28
|
clearable: false,
|
|
29
|
-
size: rowsPerPageOptions.length > 0 ? getDigits(Math.max(...rowsPerPageOptions))
|
|
29
|
+
size: rowsPerPageOptions.length > 0 ? getDigits(Math.max(...rowsPerPageOptions)) : 3,
|
|
30
30
|
options: rowsPerPageOptions.map((option) => ({
|
|
31
31
|
label: option.toLocaleString(),
|
|
32
32
|
value: option
|
|
33
33
|
})),
|
|
34
|
+
onChange: (_, newRowsPerPage) => props.onRowsPerPageChange?.(newRowsPerPage),
|
|
34
35
|
className: modules_efc4e723["rows-per-page-select"]
|
|
35
36
|
}
|
|
36
37
|
)
|
|
@@ -14,14 +14,15 @@ function Tooltip({
|
|
|
14
14
|
placement = "bottom",
|
|
15
15
|
showArrow = true,
|
|
16
16
|
strategy = "absolute",
|
|
17
|
+
disabled = false,
|
|
17
18
|
...props
|
|
18
19
|
}) {
|
|
19
|
-
const [
|
|
20
|
-
const
|
|
20
|
+
const [_open, setOpen] = React__default.useState(false);
|
|
21
|
+
const open = !disabled && (props.open ?? _open);
|
|
21
22
|
const arrowRef = React__default.useRef(null);
|
|
22
23
|
const { refs, floatingStyles, context } = useFloating({
|
|
23
|
-
open
|
|
24
|
-
onOpenChange:
|
|
24
|
+
open,
|
|
25
|
+
onOpenChange: setOpen,
|
|
25
26
|
placement,
|
|
26
27
|
strategy,
|
|
27
28
|
middleware: [
|
|
@@ -60,7 +61,7 @@ function Tooltip({
|
|
|
60
61
|
children: props.children
|
|
61
62
|
}
|
|
62
63
|
),
|
|
63
|
-
|
|
64
|
+
open && /* @__PURE__ */ jsxs(
|
|
64
65
|
"div",
|
|
65
66
|
{
|
|
66
67
|
ref: refs.setFloating,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var modules_efc4e723 = {"tooltip-anchor":"
|
|
1
|
+
var modules_efc4e723 = {"tooltip-anchor":"vt_ce_Tooltip_tooltipAnchor__4170edb1","tooltip-body":"vt_ce_Tooltip_tooltipBody__4170edb1"};
|
|
2
2
|
|
|
3
3
|
export { modules_efc4e723 as default };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var modules_b5c3b63b = {"t-title":"
|
|
1
|
+
var modules_b5c3b63b = {"t-title":"vt_ce_Typography_tTitle__56e154f0","t-h1":"vt_ce_Typography_tH1__56e154f0","t-h2":"vt_ce_Typography_tH2__56e154f0","t-h3":"vt_ce_Typography_tH3__56e154f0","t-h4":"vt_ce_Typography_tH4__56e154f0","t-label":"vt_ce_Typography_tLabel__56e154f0","t-paragraph1":"vt_ce_Typography_tParagraph1__56e154f0","t-paragraph2":"vt_ce_Typography_tParagraph2__56e154f0","t-paragraph3":"vt_ce_Typography_tParagraph3__56e154f0","t-button":"vt_ce_Typography_tButton__56e154f0","t-buttonSmall":"vt_ce_Typography_tButtonSmall__56e154f0","c-primary":"vt_ce_Typography_cPrimary__56e154f0","c-secondary":"vt_ce_Typography_cSecondary__56e154f0","c-tertiary":"vt_ce_Typography_cTertiary__56e154f0","c-disabled":"vt_ce_Typography_cDisabled__56e154f0","c-inherit":"vt_ce_Typography_cInherit__56e154f0"};
|
|
2
2
|
|
|
3
3
|
export { modules_b5c3b63b as default };
|
package/dist/esm/index.js
CHANGED
|
@@ -5,7 +5,8 @@ export { createThemeCssVariableDefinitions, themeCSSVariableNames } from './styl
|
|
|
5
5
|
export { cx } from './styles/cx.js';
|
|
6
6
|
export { defaultThemeCssVariableUsages as ThemeVars, defaultDarkTheme, default as defaultTheme } from './styles/defaultTheme.js';
|
|
7
7
|
export { default as useTheme } from './styles/useTheme.js';
|
|
8
|
-
export {
|
|
8
|
+
export { resolvePaletteValue } from './styles/palette.js';
|
|
9
|
+
export { createPalette } from './styles/createPalette.js';
|
|
9
10
|
export { default as experimentalStyled, default as styled } from './styles/styled.js';
|
|
10
11
|
export { ThemeContextProvider } from './styles/provider.client.js';
|
|
11
12
|
export { ThemeCssVarsProvider } from './styles/provider.css-vars.js';
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
import { readableColor, toHex, darken, lighten, desaturate } from 'color2k';
|
|
3
|
+
|
|
4
|
+
function isPaletteColorOptions(obj) {
|
|
5
|
+
return typeof obj === "string";
|
|
6
|
+
}
|
|
7
|
+
function createPaletteColor(options) {
|
|
8
|
+
return options;
|
|
9
|
+
}
|
|
10
|
+
function contrastColor(surface) {
|
|
11
|
+
return readableColor(surface);
|
|
12
|
+
}
|
|
13
|
+
function isPaletteSurfaceColorsOptions(obj) {
|
|
14
|
+
return typeof obj === "string" || obj["surface"] !== void 0;
|
|
15
|
+
}
|
|
16
|
+
function createPaletteSurfaceColors(options) {
|
|
17
|
+
if (typeof options === "string") {
|
|
18
|
+
const surface = createPaletteColor(options);
|
|
19
|
+
return {
|
|
20
|
+
surface,
|
|
21
|
+
on: contrastColor(surface)
|
|
22
|
+
};
|
|
23
|
+
} else {
|
|
24
|
+
const surface = createPaletteColor(options.surface);
|
|
25
|
+
return {
|
|
26
|
+
surface,
|
|
27
|
+
on: options.on ? createPaletteColor(options.on) : contrastColor(surface)
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function isPaletteActionVariantsColorsOptions(obj) {
|
|
32
|
+
return isPaletteSurfaceColorsOptions(obj) || obj["base"] !== void 0;
|
|
33
|
+
}
|
|
34
|
+
function createPaletteActionVariantsColors(options, disabled) {
|
|
35
|
+
const hoverFromBase = (b) => ({
|
|
36
|
+
surface: toHex(desaturate(darken(b.surface, 1 / 10), 1 / 4)),
|
|
37
|
+
on: b.on
|
|
38
|
+
});
|
|
39
|
+
if (isPaletteSurfaceColorsOptions(options)) {
|
|
40
|
+
const resolved = createPaletteSurfaceColors(options);
|
|
41
|
+
return {
|
|
42
|
+
base: resolved,
|
|
43
|
+
hover: hoverFromBase(resolved),
|
|
44
|
+
disabled
|
|
45
|
+
};
|
|
46
|
+
} else {
|
|
47
|
+
const base = createPaletteSurfaceColors(options.base);
|
|
48
|
+
return {
|
|
49
|
+
base,
|
|
50
|
+
hover: options.hover ? createPaletteSurfaceColors(options.hover) : hoverFromBase(base),
|
|
51
|
+
disabled
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function createPaletteBrand(options, disabled) {
|
|
56
|
+
const brandColorStepFromBase = (b, step) => createPaletteActionVariantsColors(
|
|
57
|
+
step >= 1 ? toHex(darken(b.base.surface, step / 20)) : toHex(lighten(b.base.surface, step / 2)),
|
|
58
|
+
disabled
|
|
59
|
+
);
|
|
60
|
+
if (isPaletteActionVariantsColorsOptions(options)) {
|
|
61
|
+
const resolved = createPaletteActionVariantsColors(options, disabled);
|
|
62
|
+
return {
|
|
63
|
+
1: resolved,
|
|
64
|
+
2: brandColorStepFromBase(resolved, 1),
|
|
65
|
+
3: brandColorStepFromBase(resolved, 2),
|
|
66
|
+
4: brandColorStepFromBase(resolved, 0.5),
|
|
67
|
+
5: brandColorStepFromBase(resolved, 0.25)
|
|
68
|
+
};
|
|
69
|
+
} else {
|
|
70
|
+
const base = createPaletteActionVariantsColors(options[1], disabled);
|
|
71
|
+
return {
|
|
72
|
+
1: base,
|
|
73
|
+
2: options[2] ? createPaletteActionVariantsColors(options[2], disabled) : brandColorStepFromBase(base, 1),
|
|
74
|
+
3: options[3] ? createPaletteActionVariantsColors(options[3], disabled) : brandColorStepFromBase(base, 2),
|
|
75
|
+
4: options[4] ? createPaletteActionVariantsColors(options[4], disabled) : brandColorStepFromBase(base, 0.5),
|
|
76
|
+
5: options[5] ? createPaletteActionVariantsColors(options[5], disabled) : brandColorStepFromBase(base, 0.25)
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function createPaletteText(options) {
|
|
81
|
+
const textColorStepFromBase = (b, _step) => {
|
|
82
|
+
return b;
|
|
83
|
+
};
|
|
84
|
+
if (isPaletteColorOptions(options)) {
|
|
85
|
+
const resolved = createPaletteColor(options);
|
|
86
|
+
return {
|
|
87
|
+
primary: resolved,
|
|
88
|
+
secondary: textColorStepFromBase(resolved),
|
|
89
|
+
tertiary: textColorStepFromBase(resolved)
|
|
90
|
+
};
|
|
91
|
+
} else {
|
|
92
|
+
const base = createPaletteColor(options.primary);
|
|
93
|
+
return {
|
|
94
|
+
primary: base,
|
|
95
|
+
secondary: options.secondary ? createPaletteColor(options.secondary) : textColorStepFromBase(base),
|
|
96
|
+
tertiary: options.tertiary ? createPaletteColor(options.tertiary) : textColorStepFromBase(base)
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function createPaletteAction(options, disabled, text) {
|
|
101
|
+
const destructiveDefault = createPaletteActionVariantsColors(
|
|
102
|
+
{
|
|
103
|
+
base: {
|
|
104
|
+
surface: "#EB0000",
|
|
105
|
+
on: "#FFFFFF"
|
|
106
|
+
},
|
|
107
|
+
hover: {
|
|
108
|
+
surface: "#a63737",
|
|
109
|
+
on: "#FFFFFF"
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
disabled
|
|
113
|
+
);
|
|
114
|
+
const primary = createPaletteActionVariantsColors(options.primary, disabled);
|
|
115
|
+
return {
|
|
116
|
+
primary,
|
|
117
|
+
destructive: options.destructive ? createPaletteActionVariantsColors(options.destructive, disabled) : destructiveDefault,
|
|
118
|
+
text: options.text ? createPaletteActionVariantsColors(options.text, disabled) : createPaletteActionVariantsColors(
|
|
119
|
+
{
|
|
120
|
+
...primary,
|
|
121
|
+
base: {
|
|
122
|
+
surface: text,
|
|
123
|
+
on: contrastColor(text)
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
disabled
|
|
127
|
+
)
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function createPaletteIndicator(options, disabled) {
|
|
131
|
+
return {
|
|
132
|
+
success: options.success ? createPaletteActionVariantsColors(options.success, disabled) : createPaletteActionVariantsColors("#28BA3F", disabled),
|
|
133
|
+
info: options.info ? createPaletteActionVariantsColors(options.info, disabled) : createPaletteActionVariantsColors("#335B89", disabled),
|
|
134
|
+
warning: options.warning ? createPaletteActionVariantsColors(options.warning, disabled) : createPaletteActionVariantsColors("#FFBB0A", disabled),
|
|
135
|
+
error: options.error ? createPaletteActionVariantsColors(options.error, disabled) : createPaletteActionVariantsColors("#EB0000", disabled)
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
function createPaletteTable(options, disabled) {
|
|
139
|
+
return createPaletteActionVariantsColors(options, disabled);
|
|
140
|
+
}
|
|
141
|
+
function createPaletteBackground(options) {
|
|
142
|
+
const backgroundStepFromBase = (b, step) => {
|
|
143
|
+
return toHex(darken(b, step / 20));
|
|
144
|
+
};
|
|
145
|
+
if (isPaletteColorOptions(options)) {
|
|
146
|
+
const resolved = createPaletteColor(options);
|
|
147
|
+
return {
|
|
148
|
+
primary: resolved,
|
|
149
|
+
secondary: backgroundStepFromBase(resolved, 1)
|
|
150
|
+
};
|
|
151
|
+
} else {
|
|
152
|
+
const base = createPaletteColor(options.primary);
|
|
153
|
+
return {
|
|
154
|
+
primary: base,
|
|
155
|
+
secondary: options.secondary ? createPaletteColor(options.secondary) : backgroundStepFromBase(base, 1)
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
function createPalette(options = {}) {
|
|
160
|
+
const disabled = options.disabled ? createPaletteSurfaceColors(options.disabled) : createPaletteSurfaceColors({
|
|
161
|
+
surface: "#FAFAFA",
|
|
162
|
+
on: "#7C848D"
|
|
163
|
+
});
|
|
164
|
+
const text = createPaletteText(
|
|
165
|
+
options.text ?? {
|
|
166
|
+
primary: "#2A323C",
|
|
167
|
+
secondary: "#5C6269",
|
|
168
|
+
tertiary: "#465364"
|
|
169
|
+
}
|
|
170
|
+
);
|
|
171
|
+
return {
|
|
172
|
+
brand: createPaletteBrand(
|
|
173
|
+
options.brand ?? {
|
|
174
|
+
1: "#214167",
|
|
175
|
+
2: "#335B89"
|
|
176
|
+
},
|
|
177
|
+
disabled
|
|
178
|
+
),
|
|
179
|
+
text,
|
|
180
|
+
action: createPaletteAction(
|
|
181
|
+
options.action ?? {
|
|
182
|
+
primary: {
|
|
183
|
+
base: {
|
|
184
|
+
surface: "#1871E8",
|
|
185
|
+
on: "#FFFFFF"
|
|
186
|
+
},
|
|
187
|
+
hover: {
|
|
188
|
+
surface: "#335B89",
|
|
189
|
+
on: "#FFFFFF"
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
disabled,
|
|
194
|
+
text.tertiary
|
|
195
|
+
),
|
|
196
|
+
indicator: createPaletteIndicator(options.indicator ?? {}, disabled),
|
|
197
|
+
disabled,
|
|
198
|
+
background: createPaletteBackground(
|
|
199
|
+
options.background ?? {
|
|
200
|
+
primary: "#FFFFFF",
|
|
201
|
+
secondary: "#E0E8F0"
|
|
202
|
+
}
|
|
203
|
+
),
|
|
204
|
+
table: createPaletteTable(
|
|
205
|
+
options.table ?? {
|
|
206
|
+
base: {
|
|
207
|
+
surface: "#FFFFFF",
|
|
208
|
+
on: "#2A323C"
|
|
209
|
+
},
|
|
210
|
+
hover: "#EAF1FA"
|
|
211
|
+
},
|
|
212
|
+
disabled
|
|
213
|
+
)
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export { createPalette };
|
|
@@ -1,202 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
import {
|
|
2
|
+
import { deepGetValue } from '../utils/recursive.js';
|
|
3
|
+
import 'color2k';
|
|
4
|
+
import './css-vars.js';
|
|
5
|
+
import { defaultThemeCssVariableUsages } from './defaultTheme.js';
|
|
6
|
+
import 'react';
|
|
7
|
+
import '@mui/system';
|
|
8
|
+
import './styled.js';
|
|
9
|
+
import 'react/jsx-runtime';
|
|
3
10
|
|
|
4
|
-
function
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
function createPaletteColor(options) {
|
|
8
|
-
return options;
|
|
9
|
-
}
|
|
10
|
-
function contrastColor(surface) {
|
|
11
|
-
return readableColor(surface);
|
|
12
|
-
}
|
|
13
|
-
function isPaletteSurfaceColorsOptions(obj) {
|
|
14
|
-
return typeof obj === "string" || obj["surface"] !== void 0;
|
|
15
|
-
}
|
|
16
|
-
function createPaletteSurfaceColors(options) {
|
|
17
|
-
if (typeof options === "string") {
|
|
18
|
-
const surface = createPaletteColor(options);
|
|
19
|
-
return {
|
|
20
|
-
surface,
|
|
21
|
-
on: contrastColor(surface)
|
|
22
|
-
};
|
|
23
|
-
} else {
|
|
24
|
-
const surface = createPaletteColor(options.surface);
|
|
25
|
-
return {
|
|
26
|
-
surface,
|
|
27
|
-
on: options.on ? createPaletteColor(options.on) : contrastColor(surface)
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
function createPaletteActionVariantsColors(options, disabled) {
|
|
32
|
-
const hoverFromBase = (b) => ({
|
|
33
|
-
surface: toHex(desaturate(darken(b.surface, 1 / 10), 1 / 4)),
|
|
34
|
-
on: b.on
|
|
35
|
-
});
|
|
36
|
-
if (isPaletteSurfaceColorsOptions(options)) {
|
|
37
|
-
const resolved = createPaletteSurfaceColors(options);
|
|
38
|
-
return {
|
|
39
|
-
base: resolved,
|
|
40
|
-
hover: hoverFromBase(resolved),
|
|
41
|
-
disabled
|
|
42
|
-
};
|
|
43
|
-
} else {
|
|
44
|
-
const base = createPaletteSurfaceColors(options.base);
|
|
45
|
-
return {
|
|
46
|
-
base,
|
|
47
|
-
hover: options.hover ? createPaletteSurfaceColors(options.hover) : hoverFromBase(base),
|
|
48
|
-
disabled
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
function createPaletteBrand(options) {
|
|
53
|
-
const brandColorStepFromBase = (b, step) => {
|
|
54
|
-
return {
|
|
55
|
-
surface: step >= 1 ? toHex(darken(b.surface, step / 20)) : toHex(lighten(b.surface, step / 2)),
|
|
56
|
-
on: b.on
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
if (isPaletteSurfaceColorsOptions(options)) {
|
|
60
|
-
const resolved = createPaletteSurfaceColors(options);
|
|
61
|
-
return {
|
|
62
|
-
1: resolved,
|
|
63
|
-
2: brandColorStepFromBase(resolved, 1),
|
|
64
|
-
3: brandColorStepFromBase(resolved, 2),
|
|
65
|
-
4: brandColorStepFromBase(resolved, 0.5),
|
|
66
|
-
5: brandColorStepFromBase(resolved, 0.25)
|
|
67
|
-
};
|
|
11
|
+
function resolvePaletteValue(input, palette = defaultThemeCssVariableUsages.palette) {
|
|
12
|
+
if (typeof input === "string") {
|
|
13
|
+
return deepGetValue(palette, input);
|
|
68
14
|
} else {
|
|
69
|
-
|
|
70
|
-
return {
|
|
71
|
-
1: base,
|
|
72
|
-
2: options[2] ? createPaletteSurfaceColors(options[2]) : brandColorStepFromBase(base, 1),
|
|
73
|
-
3: options[3] ? createPaletteSurfaceColors(options[3]) : brandColorStepFromBase(base, 2),
|
|
74
|
-
4: options[4] ? createPaletteSurfaceColors(options[4]) : brandColorStepFromBase(base, 0.5),
|
|
75
|
-
5: options[5] ? createPaletteSurfaceColors(options[5]) : brandColorStepFromBase(base, 0.25)
|
|
76
|
-
};
|
|
15
|
+
return input;
|
|
77
16
|
}
|
|
78
17
|
}
|
|
79
|
-
function createPaletteText(options) {
|
|
80
|
-
const textColorStepFromBase = (b, _step) => {
|
|
81
|
-
return b;
|
|
82
|
-
};
|
|
83
|
-
if (isPaletteColorOptions(options)) {
|
|
84
|
-
const resolved = createPaletteColor(options);
|
|
85
|
-
return {
|
|
86
|
-
primary: resolved,
|
|
87
|
-
secondary: textColorStepFromBase(resolved),
|
|
88
|
-
tertiary: textColorStepFromBase(resolved)
|
|
89
|
-
};
|
|
90
|
-
} else {
|
|
91
|
-
const base = createPaletteColor(options.primary);
|
|
92
|
-
return {
|
|
93
|
-
primary: base,
|
|
94
|
-
secondary: options.secondary ? createPaletteColor(options.secondary) : textColorStepFromBase(base),
|
|
95
|
-
tertiary: options.tertiary ? createPaletteColor(options.tertiary) : textColorStepFromBase(base)
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
function createPaletteAction(options, disabled) {
|
|
100
|
-
const destructiveDefault = createPaletteActionVariantsColors(
|
|
101
|
-
{
|
|
102
|
-
base: {
|
|
103
|
-
surface: "#EB0000",
|
|
104
|
-
on: "#FFFFFF"
|
|
105
|
-
},
|
|
106
|
-
hover: {
|
|
107
|
-
surface: "#a63737",
|
|
108
|
-
on: "#FFFFFF"
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
disabled
|
|
112
|
-
);
|
|
113
|
-
return {
|
|
114
|
-
primary: createPaletteActionVariantsColors(options.primary, disabled),
|
|
115
|
-
destructive: options.destructive ? createPaletteActionVariantsColors(options.destructive, disabled) : destructiveDefault
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
function createPaletteIndicator(options, disabled) {
|
|
119
|
-
return {
|
|
120
|
-
success: options.success ? createPaletteActionVariantsColors(options.success, disabled) : createPaletteActionVariantsColors("#28BA3F", disabled),
|
|
121
|
-
info: options.info ? createPaletteActionVariantsColors(options.info, disabled) : createPaletteActionVariantsColors("#335B89", disabled),
|
|
122
|
-
warning: options.warning ? createPaletteActionVariantsColors(options.warning, disabled) : createPaletteActionVariantsColors("#FFBB0A", disabled),
|
|
123
|
-
error: options.error ? createPaletteActionVariantsColors(options.error, disabled) : createPaletteActionVariantsColors("#EB0000", disabled)
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
function createPaletteTable(options, disabled) {
|
|
127
|
-
return createPaletteActionVariantsColors(options, disabled);
|
|
128
|
-
}
|
|
129
|
-
function createPaletteBackground(options) {
|
|
130
|
-
const backgroundStepFromBase = (b, step) => {
|
|
131
|
-
return toHex(darken(b, step / 20));
|
|
132
|
-
};
|
|
133
|
-
if (isPaletteColorOptions(options)) {
|
|
134
|
-
const resolved = createPaletteColor(options);
|
|
135
|
-
return {
|
|
136
|
-
primary: resolved,
|
|
137
|
-
secondary: backgroundStepFromBase(resolved, 1)
|
|
138
|
-
};
|
|
139
|
-
} else {
|
|
140
|
-
const base = createPaletteColor(options.primary);
|
|
141
|
-
return {
|
|
142
|
-
primary: base,
|
|
143
|
-
secondary: options.secondary ? createPaletteColor(options.secondary) : backgroundStepFromBase(base, 1)
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
function createPalette(options = {}) {
|
|
148
|
-
const disabled = options.disabled ? createPaletteSurfaceColors(options.disabled) : createPaletteSurfaceColors({
|
|
149
|
-
surface: "#FAFAFA",
|
|
150
|
-
on: "#7C848D"
|
|
151
|
-
});
|
|
152
|
-
return {
|
|
153
|
-
brand: createPaletteBrand(
|
|
154
|
-
options.brand ?? {
|
|
155
|
-
1: "#214167",
|
|
156
|
-
2: "#335B89"
|
|
157
|
-
}
|
|
158
|
-
),
|
|
159
|
-
text: createPaletteText(
|
|
160
|
-
options.text ?? {
|
|
161
|
-
primary: "#2A323C",
|
|
162
|
-
secondary: "#5C6269",
|
|
163
|
-
tertiary: "#465364"
|
|
164
|
-
}
|
|
165
|
-
),
|
|
166
|
-
action: createPaletteAction(
|
|
167
|
-
options.action ?? {
|
|
168
|
-
primary: {
|
|
169
|
-
base: {
|
|
170
|
-
surface: "#1871E8",
|
|
171
|
-
on: "#FFFFFF"
|
|
172
|
-
},
|
|
173
|
-
hover: {
|
|
174
|
-
surface: "#335B89",
|
|
175
|
-
on: "#FFFFFF"
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
},
|
|
179
|
-
disabled
|
|
180
|
-
),
|
|
181
|
-
indicator: createPaletteIndicator(options.indicator ?? {}, disabled),
|
|
182
|
-
disabled,
|
|
183
|
-
background: createPaletteBackground(
|
|
184
|
-
options.background ?? {
|
|
185
|
-
primary: "#FFFFFF",
|
|
186
|
-
secondary: "#E0E8F0"
|
|
187
|
-
}
|
|
188
|
-
),
|
|
189
|
-
table: createPaletteTable(
|
|
190
|
-
options.table ?? {
|
|
191
|
-
base: {
|
|
192
|
-
surface: "#FFFFFF",
|
|
193
|
-
on: "#2A323C"
|
|
194
|
-
},
|
|
195
|
-
hover: "#EAF1FA"
|
|
196
|
-
},
|
|
197
|
-
disabled
|
|
198
|
-
)
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
18
|
|
|
202
|
-
export {
|
|
19
|
+
export { resolvePaletteValue };
|
|
@@ -2,16 +2,36 @@
|
|
|
2
2
|
@use "sass:map";
|
|
3
3
|
|
|
4
4
|
$default-theme: (
|
|
5
|
-
"palette-brand-1-surface": (#214167),
|
|
6
|
-
"palette-brand-1-on": (#fff),
|
|
7
|
-
"palette-brand-
|
|
8
|
-
"palette-brand-
|
|
9
|
-
"palette-brand-
|
|
10
|
-
"palette-brand-
|
|
11
|
-
"palette-brand-
|
|
12
|
-
"palette-brand-
|
|
13
|
-
"palette-brand-
|
|
14
|
-
"palette-brand-
|
|
5
|
+
"palette-brand-1-base-surface": (#214167),
|
|
6
|
+
"palette-brand-1-base-on": (#fff),
|
|
7
|
+
"palette-brand-1-hover-surface": (#202a37),
|
|
8
|
+
"palette-brand-1-hover-on": (#fff),
|
|
9
|
+
"palette-brand-1-disabled-surface": (#FAFAFA),
|
|
10
|
+
"palette-brand-1-disabled-on": (#7C848D),
|
|
11
|
+
"palette-brand-2-base-surface": (#335B89),
|
|
12
|
+
"palette-brand-2-base-on": (#fff),
|
|
13
|
+
"palette-brand-2-hover-surface": (#364453),
|
|
14
|
+
"palette-brand-2-hover-on": (#fff),
|
|
15
|
+
"palette-brand-2-disabled-surface": (#FAFAFA),
|
|
16
|
+
"palette-brand-2-disabled-on": (#7C848D),
|
|
17
|
+
"palette-brand-3-base-surface": (#152941),
|
|
18
|
+
"palette-brand-3-base-on": (#fff),
|
|
19
|
+
"palette-brand-3-hover-surface": (#0d1116),
|
|
20
|
+
"palette-brand-3-hover-on": (#fff),
|
|
21
|
+
"palette-brand-3-disabled-surface": (#FAFAFA),
|
|
22
|
+
"palette-brand-3-disabled-on": (#7C848D),
|
|
23
|
+
"palette-brand-4-base-surface": (#467ec3),
|
|
24
|
+
"palette-brand-4-base-on": (#000),
|
|
25
|
+
"palette-brand-4-hover-surface": (#4f6887),
|
|
26
|
+
"palette-brand-4-hover-on": (#000),
|
|
27
|
+
"palette-brand-4-disabled-surface": (#FAFAFA),
|
|
28
|
+
"palette-brand-4-disabled-on": (#7C848D),
|
|
29
|
+
"palette-brand-5-base-surface": (#315e96),
|
|
30
|
+
"palette-brand-5-base-on": (#fff),
|
|
31
|
+
"palette-brand-5-hover-surface": (#37485d),
|
|
32
|
+
"palette-brand-5-hover-on": (#fff),
|
|
33
|
+
"palette-brand-5-disabled-surface": (#FAFAFA),
|
|
34
|
+
"palette-brand-5-disabled-on": (#7C848D),
|
|
15
35
|
"palette-text-primary": (#2A323C),
|
|
16
36
|
"palette-text-secondary": (#5C6269),
|
|
17
37
|
"palette-text-tertiary": (#465364),
|
|
@@ -27,6 +47,12 @@ $default-theme: (
|
|
|
27
47
|
"palette-action-destructive-hover-on": (#FFFFFF),
|
|
28
48
|
"palette-action-destructive-disabled-surface": (#FAFAFA),
|
|
29
49
|
"palette-action-destructive-disabled-on": (#7C848D),
|
|
50
|
+
"palette-action-text-base-surface": (#465364),
|
|
51
|
+
"palette-action-text-base-on": (#fff),
|
|
52
|
+
"palette-action-text-hover-surface": (#335B89),
|
|
53
|
+
"palette-action-text-hover-on": (#FFFFFF),
|
|
54
|
+
"palette-action-text-disabled-surface": (#FAFAFA),
|
|
55
|
+
"palette-action-text-disabled-on": (#7C848D),
|
|
30
56
|
"palette-indicator-success-base-surface": (#28BA3F),
|
|
31
57
|
"palette-indicator-success-base-on": (#000),
|
|
32
58
|
"palette-indicator-success-hover-surface": (#34793e),
|
|
@@ -144,16 +170,36 @@ $default-theme: (
|
|
|
144
170
|
"typography-buttonSmall-lineHeight": (18px)
|
|
145
171
|
);
|
|
146
172
|
|
|
147
|
-
$theme-palette-brand-1-surface: var(--vt-ce-theme-palette-brand-1-surface, (#214167));
|
|
148
|
-
$theme-palette-brand-1-on: var(--vt-ce-theme-palette-brand-1-on, (#fff));
|
|
149
|
-
$theme-palette-brand-
|
|
150
|
-
$theme-palette-brand-
|
|
151
|
-
$theme-palette-brand-
|
|
152
|
-
$theme-palette-brand-
|
|
153
|
-
$theme-palette-brand-
|
|
154
|
-
$theme-palette-brand-
|
|
155
|
-
$theme-palette-brand-
|
|
156
|
-
$theme-palette-brand-
|
|
173
|
+
$theme-palette-brand-1-base-surface: var(--vt-ce-theme-palette-brand-1-base-surface, (#214167));
|
|
174
|
+
$theme-palette-brand-1-base-on: var(--vt-ce-theme-palette-brand-1-base-on, (#fff));
|
|
175
|
+
$theme-palette-brand-1-hover-surface: var(--vt-ce-theme-palette-brand-1-hover-surface, (#202a37));
|
|
176
|
+
$theme-palette-brand-1-hover-on: var(--vt-ce-theme-palette-brand-1-hover-on, (#fff));
|
|
177
|
+
$theme-palette-brand-1-disabled-surface: var(--vt-ce-theme-palette-brand-1-disabled-surface, (#FAFAFA));
|
|
178
|
+
$theme-palette-brand-1-disabled-on: var(--vt-ce-theme-palette-brand-1-disabled-on, (#7C848D));
|
|
179
|
+
$theme-palette-brand-2-base-surface: var(--vt-ce-theme-palette-brand-2-base-surface, (#335B89));
|
|
180
|
+
$theme-palette-brand-2-base-on: var(--vt-ce-theme-palette-brand-2-base-on, (#fff));
|
|
181
|
+
$theme-palette-brand-2-hover-surface: var(--vt-ce-theme-palette-brand-2-hover-surface, (#364453));
|
|
182
|
+
$theme-palette-brand-2-hover-on: var(--vt-ce-theme-palette-brand-2-hover-on, (#fff));
|
|
183
|
+
$theme-palette-brand-2-disabled-surface: var(--vt-ce-theme-palette-brand-2-disabled-surface, (#FAFAFA));
|
|
184
|
+
$theme-palette-brand-2-disabled-on: var(--vt-ce-theme-palette-brand-2-disabled-on, (#7C848D));
|
|
185
|
+
$theme-palette-brand-3-base-surface: var(--vt-ce-theme-palette-brand-3-base-surface, (#152941));
|
|
186
|
+
$theme-palette-brand-3-base-on: var(--vt-ce-theme-palette-brand-3-base-on, (#fff));
|
|
187
|
+
$theme-palette-brand-3-hover-surface: var(--vt-ce-theme-palette-brand-3-hover-surface, (#0d1116));
|
|
188
|
+
$theme-palette-brand-3-hover-on: var(--vt-ce-theme-palette-brand-3-hover-on, (#fff));
|
|
189
|
+
$theme-palette-brand-3-disabled-surface: var(--vt-ce-theme-palette-brand-3-disabled-surface, (#FAFAFA));
|
|
190
|
+
$theme-palette-brand-3-disabled-on: var(--vt-ce-theme-palette-brand-3-disabled-on, (#7C848D));
|
|
191
|
+
$theme-palette-brand-4-base-surface: var(--vt-ce-theme-palette-brand-4-base-surface, (#467ec3));
|
|
192
|
+
$theme-palette-brand-4-base-on: var(--vt-ce-theme-palette-brand-4-base-on, (#000));
|
|
193
|
+
$theme-palette-brand-4-hover-surface: var(--vt-ce-theme-palette-brand-4-hover-surface, (#4f6887));
|
|
194
|
+
$theme-palette-brand-4-hover-on: var(--vt-ce-theme-palette-brand-4-hover-on, (#000));
|
|
195
|
+
$theme-palette-brand-4-disabled-surface: var(--vt-ce-theme-palette-brand-4-disabled-surface, (#FAFAFA));
|
|
196
|
+
$theme-palette-brand-4-disabled-on: var(--vt-ce-theme-palette-brand-4-disabled-on, (#7C848D));
|
|
197
|
+
$theme-palette-brand-5-base-surface: var(--vt-ce-theme-palette-brand-5-base-surface, (#315e96));
|
|
198
|
+
$theme-palette-brand-5-base-on: var(--vt-ce-theme-palette-brand-5-base-on, (#fff));
|
|
199
|
+
$theme-palette-brand-5-hover-surface: var(--vt-ce-theme-palette-brand-5-hover-surface, (#37485d));
|
|
200
|
+
$theme-palette-brand-5-hover-on: var(--vt-ce-theme-palette-brand-5-hover-on, (#fff));
|
|
201
|
+
$theme-palette-brand-5-disabled-surface: var(--vt-ce-theme-palette-brand-5-disabled-surface, (#FAFAFA));
|
|
202
|
+
$theme-palette-brand-5-disabled-on: var(--vt-ce-theme-palette-brand-5-disabled-on, (#7C848D));
|
|
157
203
|
$theme-palette-text-primary: var(--vt-ce-theme-palette-text-primary, (#2A323C));
|
|
158
204
|
$theme-palette-text-secondary: var(--vt-ce-theme-palette-text-secondary, (#5C6269));
|
|
159
205
|
$theme-palette-text-tertiary: var(--vt-ce-theme-palette-text-tertiary, (#465364));
|
|
@@ -169,6 +215,12 @@ $theme-palette-action-destructive-hover-surface: var(--vt-ce-theme-palette-actio
|
|
|
169
215
|
$theme-palette-action-destructive-hover-on: var(--vt-ce-theme-palette-action-destructive-hover-on, (#FFFFFF));
|
|
170
216
|
$theme-palette-action-destructive-disabled-surface: var(--vt-ce-theme-palette-action-destructive-disabled-surface, (#FAFAFA));
|
|
171
217
|
$theme-palette-action-destructive-disabled-on: var(--vt-ce-theme-palette-action-destructive-disabled-on, (#7C848D));
|
|
218
|
+
$theme-palette-action-text-base-surface: var(--vt-ce-theme-palette-action-text-base-surface, (#465364));
|
|
219
|
+
$theme-palette-action-text-base-on: var(--vt-ce-theme-palette-action-text-base-on, (#fff));
|
|
220
|
+
$theme-palette-action-text-hover-surface: var(--vt-ce-theme-palette-action-text-hover-surface, (#335B89));
|
|
221
|
+
$theme-palette-action-text-hover-on: var(--vt-ce-theme-palette-action-text-hover-on, (#FFFFFF));
|
|
222
|
+
$theme-palette-action-text-disabled-surface: var(--vt-ce-theme-palette-action-text-disabled-surface, (#FAFAFA));
|
|
223
|
+
$theme-palette-action-text-disabled-on: var(--vt-ce-theme-palette-action-text-disabled-on, (#7C848D));
|
|
172
224
|
$theme-palette-indicator-success-base-surface: var(--vt-ce-theme-palette-indicator-success-base-surface, (#28BA3F));
|
|
173
225
|
$theme-palette-indicator-success-base-on: var(--vt-ce-theme-palette-indicator-success-base-on, (#000));
|
|
174
226
|
$theme-palette-indicator-success-hover-surface: var(--vt-ce-theme-palette-indicator-success-hover-surface, (#34793e));
|