@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
package/dist/cjs/Button/index.js
CHANGED
|
@@ -13,19 +13,21 @@ require('../styles/css-vars.js');
|
|
|
13
13
|
var cx = require('../styles/cx.js');
|
|
14
14
|
require('../styles/defaultTheme.js');
|
|
15
15
|
require('@mui/system');
|
|
16
|
+
var palette = require('../styles/palette.js');
|
|
16
17
|
require('../styles/styled.js');
|
|
17
18
|
|
|
18
19
|
const Button = React.forwardRef(
|
|
19
20
|
({
|
|
20
21
|
variant = "primary",
|
|
22
|
+
palette: paletteInput = variant === "primary" ? "action.primary" : "action.text",
|
|
21
23
|
size = "large",
|
|
22
24
|
disabled = false,
|
|
23
25
|
loading = false,
|
|
24
|
-
destructive = false,
|
|
25
26
|
active = false,
|
|
26
27
|
...props
|
|
27
28
|
}, ref) => {
|
|
28
29
|
const variantCn = styles_module.default[variant];
|
|
30
|
+
const palette$1 = palette.resolvePaletteValue(paletteInput);
|
|
29
31
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
30
32
|
"button",
|
|
31
33
|
{
|
|
@@ -35,13 +37,22 @@ const Button = React.forwardRef(
|
|
|
35
37
|
"data-loading": loading,
|
|
36
38
|
"data-active": active,
|
|
37
39
|
disabled: loading || disabled,
|
|
38
|
-
"data-destructive": destructive,
|
|
39
40
|
onClick: props.onClick,
|
|
40
41
|
"data-testid": props["data-testid"],
|
|
41
|
-
style:
|
|
42
|
+
style: {
|
|
43
|
+
...{
|
|
44
|
+
"--vt-ce-button-palette-base-surface": palette$1.base.surface,
|
|
45
|
+
"--vt-ce-button-palette-base-on": palette$1.base.on,
|
|
46
|
+
"--vt-ce-button-palette-hover-surface": palette$1.hover.surface,
|
|
47
|
+
"--vt-ce-button-palette-hover-on": palette$1.hover.on,
|
|
48
|
+
"--vt-ce-button-palette-disabled-surface": palette$1.disabled.surface,
|
|
49
|
+
"--vt-ce-button-palette-disabled-on": palette$1.disabled.on
|
|
50
|
+
},
|
|
51
|
+
...props.style
|
|
52
|
+
},
|
|
42
53
|
className: cx.cx(styles_module.default["button"], variantCn, props.className),
|
|
43
54
|
children: [
|
|
44
|
-
loading && /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles_module.default["loading-container"], children: /* @__PURE__ */ jsxRuntime.jsx(index.default, { size: "1.4em"
|
|
55
|
+
loading && /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles_module.default["loading-container"], children: /* @__PURE__ */ jsxRuntime.jsx(index.default, { size: "1.4em" }) }),
|
|
45
56
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: styles_module.default["inner-container"], children: [
|
|
46
57
|
props.startIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles_module.default["button-icon"], children: props.startIcon }),
|
|
47
58
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: props.children }),
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var modules_efc4e723 = {"button":"
|
|
5
|
+
var modules_efc4e723 = {"button":"vt_ce_Button_button__83b29f90","primary":"vt_ce_Button_primary__83b29f90","secondary":"vt_ce_Button_secondary__83b29f90","tertiary":"vt_ce_Button_tertiary__83b29f90","inner-container":"vt_ce_Button_innerContainer__83b29f90","loading-container":"vt_ce_Button_loadingContainer__83b29f90","button-icon":"vt_ce_Button_buttonIcon__83b29f90"};
|
|
6
6
|
|
|
7
7
|
exports.default = modules_efc4e723;
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
8
8
|
var React = require('react');
|
|
9
9
|
var react = require('@floating-ui/react');
|
|
10
|
+
var reactRemoveScroll = require('react-remove-scroll');
|
|
10
11
|
var styles_module = require('./styles.module.scss.js');
|
|
11
12
|
var state = require('./state.js');
|
|
12
13
|
require('color2k');
|
|
@@ -14,6 +15,7 @@ require('../styles/css-vars.js');
|
|
|
14
15
|
var cx = require('../styles/cx.js');
|
|
15
16
|
require('../styles/defaultTheme.js');
|
|
16
17
|
require('@mui/system');
|
|
18
|
+
var palette = require('../styles/palette.js');
|
|
17
19
|
require('../styles/styled.js');
|
|
18
20
|
var index$1 = require('../Button/index.js');
|
|
19
21
|
var index = require('../Typography/index.js');
|
|
@@ -43,25 +45,37 @@ const Drawer = React__namespace.forwardRef(function Drawer2({
|
|
|
43
45
|
portalEl,
|
|
44
46
|
style,
|
|
45
47
|
className,
|
|
48
|
+
overlay = true,
|
|
49
|
+
strategy = "fixed",
|
|
46
50
|
overlayStyle,
|
|
47
51
|
overlayClassName,
|
|
48
52
|
lockScroll = true,
|
|
49
53
|
"data-testid": dataTestId,
|
|
50
54
|
...options
|
|
51
55
|
}, propRef) {
|
|
52
|
-
const drawer = state.useDrawer(
|
|
56
|
+
const drawer = state.useDrawer({
|
|
57
|
+
...options,
|
|
58
|
+
dismissEnabled: overlay
|
|
59
|
+
});
|
|
53
60
|
const ref = react.useMergeRefs([drawer.context.refs.setFloating, propRef]);
|
|
61
|
+
const strategyCn = styles_module.default[`drawer-overlay-strategy-${strategy}`];
|
|
54
62
|
let content = null;
|
|
55
63
|
if (drawer.context.open) {
|
|
56
64
|
content = /* @__PURE__ */ jsxRuntime.jsx(react.FloatingPortal, { root: portalEl, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
57
|
-
|
|
65
|
+
"div",
|
|
58
66
|
{
|
|
59
67
|
style: overlayStyle,
|
|
60
|
-
className: cx.cx(
|
|
61
|
-
|
|
68
|
+
className: cx.cx(
|
|
69
|
+
styles_module.default["drawer-overlay"],
|
|
70
|
+
strategyCn,
|
|
71
|
+
overlay && styles_module.default["drawer-overlay-enabled"],
|
|
72
|
+
overlayClassName
|
|
73
|
+
),
|
|
62
74
|
children: /* @__PURE__ */ jsxRuntime.jsx(react.FloatingFocusManager, { context: drawer.context, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
63
|
-
|
|
75
|
+
reactRemoveScroll.RemoveScroll,
|
|
64
76
|
{
|
|
77
|
+
as: "div",
|
|
78
|
+
enabled: overlay && lockScroll,
|
|
65
79
|
ref,
|
|
66
80
|
"aria-labelledby": drawer.labelId,
|
|
67
81
|
"aria-describedby": drawer.descriptionId,
|
|
@@ -114,25 +128,48 @@ const DrawerEnd = React__namespace.forwardRef(
|
|
|
114
128
|
);
|
|
115
129
|
}
|
|
116
130
|
);
|
|
117
|
-
const DrawerTitle = React__namespace.forwardRef(function DrawerTitle2({
|
|
131
|
+
const DrawerTitle = React__namespace.forwardRef(function DrawerTitle2({
|
|
132
|
+
children,
|
|
133
|
+
actions,
|
|
134
|
+
container = "text",
|
|
135
|
+
palette: paletteInput = "brand.1.base",
|
|
136
|
+
...props
|
|
137
|
+
}, ref) {
|
|
138
|
+
const palette$1 = palette.resolvePaletteValue(paletteInput);
|
|
118
139
|
const { setLabelId } = state.useDrawerContext();
|
|
119
140
|
const id = React__namespace.useId();
|
|
120
141
|
React__namespace.useLayoutEffect(() => {
|
|
121
142
|
setLabelId(id);
|
|
122
143
|
return () => setLabelId(void 0);
|
|
123
144
|
}, [id, setLabelId]);
|
|
124
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
125
|
-
|
|
145
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
146
|
+
DrawerStart,
|
|
126
147
|
{
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
148
|
+
"data-container": container,
|
|
149
|
+
style: {
|
|
150
|
+
...{
|
|
151
|
+
"--vt-ce-drawer-palette-surface": palette$1.surface,
|
|
152
|
+
"--vt-ce-drawer-palette-on": palette$1.on
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
className: styles_module.default["drawer-title-container"],
|
|
156
|
+
children: [
|
|
157
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
158
|
+
index.default,
|
|
159
|
+
{
|
|
160
|
+
variant: "title",
|
|
161
|
+
ref,
|
|
162
|
+
id,
|
|
163
|
+
color: "inherit",
|
|
164
|
+
...props,
|
|
165
|
+
className: cx.cx(styles_module.default["drawer-title"], props.className),
|
|
166
|
+
children
|
|
167
|
+
}
|
|
168
|
+
),
|
|
169
|
+
actions && /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles_module.default["drawer-title-actions"], children: actions })
|
|
170
|
+
]
|
|
134
171
|
}
|
|
135
|
-
)
|
|
172
|
+
);
|
|
136
173
|
});
|
|
137
174
|
const DrawerTypography = React__namespace.forwardRef(function DrawerTypography2({ children, ...props }, ref) {
|
|
138
175
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5,10 +5,10 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var components = require('./components.js');
|
|
7
7
|
|
|
8
|
-
function createDrawerComponent(
|
|
8
|
+
function createDrawerComponent(overrides) {
|
|
9
9
|
return React.forwardRef(
|
|
10
10
|
function ScopedDrawer(props, ref) {
|
|
11
|
-
return /* @__PURE__ */ jsxRuntime.jsx(components.default, {
|
|
11
|
+
return /* @__PURE__ */ jsxRuntime.jsx(components.default, { ...overrides, ref, ...props });
|
|
12
12
|
}
|
|
13
13
|
);
|
|
14
14
|
}
|
package/dist/cjs/Drawer/state.js
CHANGED
|
@@ -24,7 +24,11 @@ function _interopNamespaceDefault(e) {
|
|
|
24
24
|
|
|
25
25
|
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
26
26
|
|
|
27
|
-
function useDrawer({
|
|
27
|
+
function useDrawer({
|
|
28
|
+
open,
|
|
29
|
+
dismissEnabled,
|
|
30
|
+
onDismiss: dismissDrawer
|
|
31
|
+
}) {
|
|
28
32
|
const [labelId, setLabelId] = React__namespace.useState();
|
|
29
33
|
const [descriptionId, setDescriptionId] = React__namespace.useState();
|
|
30
34
|
const data = react.useFloating({
|
|
@@ -32,7 +36,10 @@ function useDrawer({ open, onDismiss: dismissDrawer }) {
|
|
|
32
36
|
onOpenChange: (newOpen) => !newOpen && dismissDrawer()
|
|
33
37
|
});
|
|
34
38
|
const context = data.context;
|
|
35
|
-
const dismiss = react.useDismiss(context, {
|
|
39
|
+
const dismiss = react.useDismiss(context, {
|
|
40
|
+
enabled: dismissEnabled,
|
|
41
|
+
outsidePressEvent: "mousedown"
|
|
42
|
+
});
|
|
36
43
|
const role = react.useRole(context);
|
|
37
44
|
const interactions = react.useInteractions([dismiss, role]);
|
|
38
45
|
return React__namespace.useMemo(
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var modules_efc4e723 = {"drawer-overlay":"
|
|
5
|
+
var modules_efc4e723 = {"drawer-overlay":"vt_ce_Drawer_drawerOverlay__15fba194","drawer-overlay-enabled":"vt_ce_Drawer_drawerOverlayEnabled__15fba194","drawer-overlay-strategy-fixed":"vt_ce_Drawer_drawerOverlayStrategyFixed__15fba194","drawer-overlay-strategy-absolute":"vt_ce_Drawer_drawerOverlayStrategyAbsolute__15fba194","drawer":"vt_ce_Drawer_drawer__15fba194","drawer-start":"vt_ce_Drawer_drawerStart__15fba194","drawer-end":"vt_ce_Drawer_drawerEnd__15fba194","drawer-content":"vt_ce_Drawer_drawerContent__15fba194","drawer-title-container":"vt_ce_Drawer_drawerTitleContainer__15fba194","drawer-title":"vt_ce_Drawer_drawerTitle__15fba194","drawer-title-actions":"vt_ce_Drawer_drawerTitleActions__15fba194","drawer-typography":"vt_ce_Drawer_drawerTypography__15fba194","drawer-actions":"vt_ce_Drawer_drawerActions__15fba194"};
|
|
6
6
|
|
|
7
7
|
exports.default = modules_efc4e723;
|
|
@@ -13,24 +13,42 @@ require('../styles/css-vars.js');
|
|
|
13
13
|
var cx = require('../styles/cx.js');
|
|
14
14
|
require('../styles/defaultTheme.js');
|
|
15
15
|
require('@mui/system');
|
|
16
|
+
var palette = require('../styles/palette.js');
|
|
16
17
|
require('../styles/styled.js');
|
|
17
18
|
|
|
18
19
|
const IconButton = React.forwardRef(
|
|
19
|
-
(
|
|
20
|
+
({
|
|
21
|
+
variant = "primary",
|
|
22
|
+
palette: paletteInput = "action.text",
|
|
23
|
+
loading = false,
|
|
24
|
+
disabled = false,
|
|
25
|
+
...props
|
|
26
|
+
}, ref) => {
|
|
27
|
+
const variantCn = styles_module.default[variant];
|
|
28
|
+
const palette$1 = palette.resolvePaletteValue(paletteInput);
|
|
20
29
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
21
30
|
"button",
|
|
22
31
|
{
|
|
23
32
|
ref,
|
|
24
33
|
type: props.type,
|
|
25
|
-
"data-loading":
|
|
26
|
-
disabled:
|
|
27
|
-
"data-destructive": props.destructive ?? false,
|
|
34
|
+
"data-loading": loading,
|
|
35
|
+
disabled: loading || disabled,
|
|
28
36
|
onClick: props.onClick,
|
|
29
37
|
"data-testid": props["data-testid"],
|
|
30
|
-
style:
|
|
31
|
-
|
|
38
|
+
style: {
|
|
39
|
+
...{
|
|
40
|
+
"--vt-ce-icon-button-palette-base-surface": palette$1.base.surface,
|
|
41
|
+
"--vt-ce-icon-button-palette-base-on": palette$1.base.on,
|
|
42
|
+
"--vt-ce-icon-button-palette-hover-surface": palette$1.hover.surface,
|
|
43
|
+
"--vt-ce-icon-button-palette-hover-on": palette$1.hover.on,
|
|
44
|
+
"--vt-ce-icon-button-palette-disabled-surface": palette$1.disabled.surface,
|
|
45
|
+
"--vt-ce-icon-button-palette-disabled-on": palette$1.disabled.on
|
|
46
|
+
},
|
|
47
|
+
...props.style
|
|
48
|
+
},
|
|
49
|
+
className: cx.cx(styles_module.default["button"], variantCn, props.className),
|
|
32
50
|
children: [
|
|
33
|
-
|
|
51
|
+
loading && /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles_module.default["loading-container"], children: /* @__PURE__ */ jsxRuntime.jsx(index.default, { fillParentHeight: true }) }),
|
|
34
52
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: styles_module.default["inner-icon"], children: props.children })
|
|
35
53
|
]
|
|
36
54
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var modules_efc4e723 = {"button":"
|
|
5
|
+
var modules_efc4e723 = {"button":"vt_ce_IconButton_button__b93e4a21","primary":"vt_ce_IconButton_primary__b93e4a21","secondary":"vt_ce_IconButton_secondary__b93e4a21","inner-icon":"vt_ce_IconButton_innerIcon__b93e4a21","loading-container":"vt_ce_IconButton_loadingContainer__b93e4a21"};
|
|
6
6
|
|
|
7
7
|
exports.default = modules_efc4e723;
|
|
@@ -30,11 +30,12 @@ function TablePagination({
|
|
|
30
30
|
{
|
|
31
31
|
defaultValue: rowsPerPage,
|
|
32
32
|
clearable: false,
|
|
33
|
-
size: rowsPerPageOptions.length > 0 ? getDigits(Math.max(...rowsPerPageOptions))
|
|
33
|
+
size: rowsPerPageOptions.length > 0 ? getDigits(Math.max(...rowsPerPageOptions)) : 3,
|
|
34
34
|
options: rowsPerPageOptions.map((option) => ({
|
|
35
35
|
label: option.toLocaleString(),
|
|
36
36
|
value: option
|
|
37
37
|
})),
|
|
38
|
+
onChange: (_, newRowsPerPage) => props.onRowsPerPageChange?.(newRowsPerPage),
|
|
38
39
|
className: styles_module.default["rows-per-page-select"]
|
|
39
40
|
}
|
|
40
41
|
)
|
|
@@ -18,14 +18,15 @@ function Tooltip({
|
|
|
18
18
|
placement = "bottom",
|
|
19
19
|
showArrow = true,
|
|
20
20
|
strategy = "absolute",
|
|
21
|
+
disabled = false,
|
|
21
22
|
...props
|
|
22
23
|
}) {
|
|
23
|
-
const [
|
|
24
|
-
const
|
|
24
|
+
const [_open, setOpen] = React.useState(false);
|
|
25
|
+
const open = !disabled && (props.open ?? _open);
|
|
25
26
|
const arrowRef = React.useRef(null);
|
|
26
27
|
const { refs, floatingStyles, context } = react.useFloating({
|
|
27
|
-
open
|
|
28
|
-
onOpenChange:
|
|
28
|
+
open,
|
|
29
|
+
onOpenChange: setOpen,
|
|
29
30
|
placement,
|
|
30
31
|
strategy,
|
|
31
32
|
middleware: [
|
|
@@ -64,7 +65,7 @@ function Tooltip({
|
|
|
64
65
|
children: props.children
|
|
65
66
|
}
|
|
66
67
|
),
|
|
67
|
-
|
|
68
|
+
open && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
68
69
|
"div",
|
|
69
70
|
{
|
|
70
71
|
ref: refs.setFloating,
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var modules_efc4e723 = {"tooltip-anchor":"
|
|
5
|
+
var modules_efc4e723 = {"tooltip-anchor":"vt_ce_Tooltip_tooltipAnchor__4170edb1","tooltip-body":"vt_ce_Tooltip_tooltipBody__4170edb1"};
|
|
6
6
|
|
|
7
7
|
exports.default = modules_efc4e723;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var modules_b5c3b63b = {"t-title":"
|
|
5
|
+
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"};
|
|
6
6
|
|
|
7
7
|
exports.default = modules_b5c3b63b;
|
package/dist/cjs/index.js
CHANGED
|
@@ -8,6 +8,7 @@ var cx = require('./styles/cx.js');
|
|
|
8
8
|
var defaultTheme = require('./styles/defaultTheme.js');
|
|
9
9
|
var useTheme = require('./styles/useTheme.js');
|
|
10
10
|
var palette = require('./styles/palette.js');
|
|
11
|
+
var createPalette = require('./styles/createPalette.js');
|
|
11
12
|
var styled = require('./styles/styled.js');
|
|
12
13
|
var provider_client = require('./styles/provider.client.js');
|
|
13
14
|
var provider_cssVars = require('./styles/provider.css-vars.js');
|
|
@@ -53,7 +54,8 @@ exports.ThemeVars = defaultTheme.defaultThemeCssVariableUsages;
|
|
|
53
54
|
exports.defaultDarkTheme = defaultTheme.defaultDarkTheme;
|
|
54
55
|
exports.defaultTheme = defaultTheme.default;
|
|
55
56
|
exports.useTheme = useTheme.default;
|
|
56
|
-
exports.
|
|
57
|
+
exports.resolvePaletteValue = palette.resolvePaletteValue;
|
|
58
|
+
exports.createPalette = createPalette.createPalette;
|
|
57
59
|
exports.experimentalStyled = styled.default;
|
|
58
60
|
exports.styled = styled.default;
|
|
59
61
|
exports.ThemeContextProvider = provider_client.ThemeContextProvider;
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var color2k = require('color2k');
|
|
5
|
+
|
|
6
|
+
function isPaletteColorOptions(obj) {
|
|
7
|
+
return typeof obj === "string";
|
|
8
|
+
}
|
|
9
|
+
function createPaletteColor(options) {
|
|
10
|
+
return options;
|
|
11
|
+
}
|
|
12
|
+
function contrastColor(surface) {
|
|
13
|
+
return color2k.readableColor(surface);
|
|
14
|
+
}
|
|
15
|
+
function isPaletteSurfaceColorsOptions(obj) {
|
|
16
|
+
return typeof obj === "string" || obj["surface"] !== void 0;
|
|
17
|
+
}
|
|
18
|
+
function createPaletteSurfaceColors(options) {
|
|
19
|
+
if (typeof options === "string") {
|
|
20
|
+
const surface = createPaletteColor(options);
|
|
21
|
+
return {
|
|
22
|
+
surface,
|
|
23
|
+
on: contrastColor(surface)
|
|
24
|
+
};
|
|
25
|
+
} else {
|
|
26
|
+
const surface = createPaletteColor(options.surface);
|
|
27
|
+
return {
|
|
28
|
+
surface,
|
|
29
|
+
on: options.on ? createPaletteColor(options.on) : contrastColor(surface)
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function isPaletteActionVariantsColorsOptions(obj) {
|
|
34
|
+
return isPaletteSurfaceColorsOptions(obj) || obj["base"] !== void 0;
|
|
35
|
+
}
|
|
36
|
+
function createPaletteActionVariantsColors(options, disabled) {
|
|
37
|
+
const hoverFromBase = (b) => ({
|
|
38
|
+
surface: color2k.toHex(color2k.desaturate(color2k.darken(b.surface, 1 / 10), 1 / 4)),
|
|
39
|
+
on: b.on
|
|
40
|
+
});
|
|
41
|
+
if (isPaletteSurfaceColorsOptions(options)) {
|
|
42
|
+
const resolved = createPaletteSurfaceColors(options);
|
|
43
|
+
return {
|
|
44
|
+
base: resolved,
|
|
45
|
+
hover: hoverFromBase(resolved),
|
|
46
|
+
disabled
|
|
47
|
+
};
|
|
48
|
+
} else {
|
|
49
|
+
const base = createPaletteSurfaceColors(options.base);
|
|
50
|
+
return {
|
|
51
|
+
base,
|
|
52
|
+
hover: options.hover ? createPaletteSurfaceColors(options.hover) : hoverFromBase(base),
|
|
53
|
+
disabled
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function createPaletteBrand(options, disabled) {
|
|
58
|
+
const brandColorStepFromBase = (b, step) => createPaletteActionVariantsColors(
|
|
59
|
+
step >= 1 ? color2k.toHex(color2k.darken(b.base.surface, step / 20)) : color2k.toHex(color2k.lighten(b.base.surface, step / 2)),
|
|
60
|
+
disabled
|
|
61
|
+
);
|
|
62
|
+
if (isPaletteActionVariantsColorsOptions(options)) {
|
|
63
|
+
const resolved = createPaletteActionVariantsColors(options, disabled);
|
|
64
|
+
return {
|
|
65
|
+
1: resolved,
|
|
66
|
+
2: brandColorStepFromBase(resolved, 1),
|
|
67
|
+
3: brandColorStepFromBase(resolved, 2),
|
|
68
|
+
4: brandColorStepFromBase(resolved, 0.5),
|
|
69
|
+
5: brandColorStepFromBase(resolved, 0.25)
|
|
70
|
+
};
|
|
71
|
+
} else {
|
|
72
|
+
const base = createPaletteActionVariantsColors(options[1], disabled);
|
|
73
|
+
return {
|
|
74
|
+
1: base,
|
|
75
|
+
2: options[2] ? createPaletteActionVariantsColors(options[2], disabled) : brandColorStepFromBase(base, 1),
|
|
76
|
+
3: options[3] ? createPaletteActionVariantsColors(options[3], disabled) : brandColorStepFromBase(base, 2),
|
|
77
|
+
4: options[4] ? createPaletteActionVariantsColors(options[4], disabled) : brandColorStepFromBase(base, 0.5),
|
|
78
|
+
5: options[5] ? createPaletteActionVariantsColors(options[5], disabled) : brandColorStepFromBase(base, 0.25)
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function createPaletteText(options) {
|
|
83
|
+
const textColorStepFromBase = (b, _step) => {
|
|
84
|
+
return b;
|
|
85
|
+
};
|
|
86
|
+
if (isPaletteColorOptions(options)) {
|
|
87
|
+
const resolved = createPaletteColor(options);
|
|
88
|
+
return {
|
|
89
|
+
primary: resolved,
|
|
90
|
+
secondary: textColorStepFromBase(resolved),
|
|
91
|
+
tertiary: textColorStepFromBase(resolved)
|
|
92
|
+
};
|
|
93
|
+
} else {
|
|
94
|
+
const base = createPaletteColor(options.primary);
|
|
95
|
+
return {
|
|
96
|
+
primary: base,
|
|
97
|
+
secondary: options.secondary ? createPaletteColor(options.secondary) : textColorStepFromBase(base),
|
|
98
|
+
tertiary: options.tertiary ? createPaletteColor(options.tertiary) : textColorStepFromBase(base)
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function createPaletteAction(options, disabled, text) {
|
|
103
|
+
const destructiveDefault = createPaletteActionVariantsColors(
|
|
104
|
+
{
|
|
105
|
+
base: {
|
|
106
|
+
surface: "#EB0000",
|
|
107
|
+
on: "#FFFFFF"
|
|
108
|
+
},
|
|
109
|
+
hover: {
|
|
110
|
+
surface: "#a63737",
|
|
111
|
+
on: "#FFFFFF"
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
disabled
|
|
115
|
+
);
|
|
116
|
+
const primary = createPaletteActionVariantsColors(options.primary, disabled);
|
|
117
|
+
return {
|
|
118
|
+
primary,
|
|
119
|
+
destructive: options.destructive ? createPaletteActionVariantsColors(options.destructive, disabled) : destructiveDefault,
|
|
120
|
+
text: options.text ? createPaletteActionVariantsColors(options.text, disabled) : createPaletteActionVariantsColors(
|
|
121
|
+
{
|
|
122
|
+
...primary,
|
|
123
|
+
base: {
|
|
124
|
+
surface: text,
|
|
125
|
+
on: contrastColor(text)
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
disabled
|
|
129
|
+
)
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
function createPaletteIndicator(options, disabled) {
|
|
133
|
+
return {
|
|
134
|
+
success: options.success ? createPaletteActionVariantsColors(options.success, disabled) : createPaletteActionVariantsColors("#28BA3F", disabled),
|
|
135
|
+
info: options.info ? createPaletteActionVariantsColors(options.info, disabled) : createPaletteActionVariantsColors("#335B89", disabled),
|
|
136
|
+
warning: options.warning ? createPaletteActionVariantsColors(options.warning, disabled) : createPaletteActionVariantsColors("#FFBB0A", disabled),
|
|
137
|
+
error: options.error ? createPaletteActionVariantsColors(options.error, disabled) : createPaletteActionVariantsColors("#EB0000", disabled)
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
function createPaletteTable(options, disabled) {
|
|
141
|
+
return createPaletteActionVariantsColors(options, disabled);
|
|
142
|
+
}
|
|
143
|
+
function createPaletteBackground(options) {
|
|
144
|
+
const backgroundStepFromBase = (b, step) => {
|
|
145
|
+
return color2k.toHex(color2k.darken(b, step / 20));
|
|
146
|
+
};
|
|
147
|
+
if (isPaletteColorOptions(options)) {
|
|
148
|
+
const resolved = createPaletteColor(options);
|
|
149
|
+
return {
|
|
150
|
+
primary: resolved,
|
|
151
|
+
secondary: backgroundStepFromBase(resolved, 1)
|
|
152
|
+
};
|
|
153
|
+
} else {
|
|
154
|
+
const base = createPaletteColor(options.primary);
|
|
155
|
+
return {
|
|
156
|
+
primary: base,
|
|
157
|
+
secondary: options.secondary ? createPaletteColor(options.secondary) : backgroundStepFromBase(base, 1)
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
function createPalette(options = {}) {
|
|
162
|
+
const disabled = options.disabled ? createPaletteSurfaceColors(options.disabled) : createPaletteSurfaceColors({
|
|
163
|
+
surface: "#FAFAFA",
|
|
164
|
+
on: "#7C848D"
|
|
165
|
+
});
|
|
166
|
+
const text = createPaletteText(
|
|
167
|
+
options.text ?? {
|
|
168
|
+
primary: "#2A323C",
|
|
169
|
+
secondary: "#5C6269",
|
|
170
|
+
tertiary: "#465364"
|
|
171
|
+
}
|
|
172
|
+
);
|
|
173
|
+
return {
|
|
174
|
+
brand: createPaletteBrand(
|
|
175
|
+
options.brand ?? {
|
|
176
|
+
1: "#214167",
|
|
177
|
+
2: "#335B89"
|
|
178
|
+
},
|
|
179
|
+
disabled
|
|
180
|
+
),
|
|
181
|
+
text,
|
|
182
|
+
action: createPaletteAction(
|
|
183
|
+
options.action ?? {
|
|
184
|
+
primary: {
|
|
185
|
+
base: {
|
|
186
|
+
surface: "#1871E8",
|
|
187
|
+
on: "#FFFFFF"
|
|
188
|
+
},
|
|
189
|
+
hover: {
|
|
190
|
+
surface: "#335B89",
|
|
191
|
+
on: "#FFFFFF"
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
disabled,
|
|
196
|
+
text.tertiary
|
|
197
|
+
),
|
|
198
|
+
indicator: createPaletteIndicator(options.indicator ?? {}, disabled),
|
|
199
|
+
disabled,
|
|
200
|
+
background: createPaletteBackground(
|
|
201
|
+
options.background ?? {
|
|
202
|
+
primary: "#FFFFFF",
|
|
203
|
+
secondary: "#E0E8F0"
|
|
204
|
+
}
|
|
205
|
+
),
|
|
206
|
+
table: createPaletteTable(
|
|
207
|
+
options.table ?? {
|
|
208
|
+
base: {
|
|
209
|
+
surface: "#FFFFFF",
|
|
210
|
+
on: "#2A323C"
|
|
211
|
+
},
|
|
212
|
+
hover: "#EAF1FA"
|
|
213
|
+
},
|
|
214
|
+
disabled
|
|
215
|
+
)
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
exports.createPalette = createPalette;
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
var palette = require('./palette.js');
|
|
7
6
|
var typography = require('./typography.js');
|
|
7
|
+
var createPalette = require('./createPalette.js');
|
|
8
8
|
|
|
9
9
|
const defaultThemeOptions = {};
|
|
10
10
|
function createTheme(options = defaultThemeOptions) {
|
|
11
11
|
return {
|
|
12
|
-
palette:
|
|
12
|
+
palette: createPalette.createPalette(options.palette),
|
|
13
13
|
typography: typography.createTypography(options.typography)
|
|
14
14
|
};
|
|
15
15
|
}
|