@descope/web-components-ui 1.0.113 → 1.0.114
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/index.cjs.js +5566 -1
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.d.ts +21 -21
- package/dist/index.esm.js +562 -424
- package/dist/index.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/dev/index.js +1 -1
- package/src/helpers/themeHelpers/index.js +6 -1
- package/src/index.cjs.js +23 -2
- package/src/index.d.ts +49 -0
- package/src/index.js +1 -1
- package/src/theme/components/button.js +30 -29
- package/src/theme/components/checkbox.js +1 -0
- package/src/theme/components/comboBox.js +1 -0
- package/src/theme/components/container.js +33 -32
- package/src/theme/components/divider.js +20 -19
- package/src/theme/components/emailField.js +1 -0
- package/src/theme/components/image.js +1 -0
- package/src/theme/components/index.js +27 -20
- package/src/theme/components/link.js +1 -0
- package/src/theme/components/loader/index.js +4 -2
- package/src/theme/components/loader/loaderLinear.js +1 -0
- package/src/theme/components/loader/loaderRadial.js +1 -0
- package/src/theme/components/logo.js +1 -0
- package/src/theme/components/newPassword.js +1 -0
- package/src/theme/components/numberField.js +1 -0
- package/src/theme/components/passcode.js +1 -0
- package/src/theme/components/passwordField.js +1 -0
- package/src/theme/components/phoneField.js +1 -1
- package/src/theme/components/switchToggle.js +1 -0
- package/src/theme/components/text.js +1 -0
- package/src/theme/components/textArea.js +1 -0
- package/src/theme/components/textField.js +1 -0
- package/src/theme/globals.js +6 -2
- package/src/theme/index.js +4 -3
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@descope/web-components-ui",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.114",
|
4
4
|
"description": "",
|
5
5
|
"main": "dist/cjs/index.cjs.js",
|
6
6
|
"module": "dist/index.esm.js",
|
@@ -19,7 +19,7 @@
|
|
19
19
|
"lint": "echo \"Error: no lint specified\" && exit 0",
|
20
20
|
"build:umd": "webpack -c webpack.prod.js",
|
21
21
|
"build:lib": "rollup -c",
|
22
|
-
"build": "npm run build:umd && npm run build:lib && cp index.d.ts dist",
|
22
|
+
"build": "npm run build:umd && npm run build:lib && cp src/index.d.ts dist",
|
23
23
|
"start": "webpack serve -c webpack.dev.js --port=8888",
|
24
24
|
"format": "prettier . -w --ignore-path .gitignore"
|
25
25
|
},
|
package/src/dev/index.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
export {
|
1
|
+
export { defaultTheme } from '../theme';
|
2
2
|
export { themeToStyle } from '../helpers/themeHelpers';
|
@@ -40,6 +40,11 @@ export const getThemeRefs = (theme, prefix) =>
|
|
40
40
|
set({}, path, `var(${getVarName(prefix ? [prefix, ...path] : path)})`)
|
41
41
|
);
|
42
42
|
|
43
|
+
export const getThemeVars = (theme, prefix) =>
|
44
|
+
transformTheme(theme, [], (path) =>
|
45
|
+
set({}, path, getVarName(prefix ? [prefix, ...path] : path))
|
46
|
+
);
|
47
|
+
|
43
48
|
export const globalsThemeToStyle = (theme, themeName = '') => `
|
44
49
|
*[data-theme="${themeName}"] {
|
45
50
|
${Object.entries(themeToCSSVarsObj(theme)).reduce(
|
@@ -55,7 +60,7 @@ const componentsThemeToStyleObj = (componentsTheme) =>
|
|
55
60
|
const property = restPath.pop();
|
56
61
|
const componentName = getComponentName(component);
|
57
62
|
|
58
|
-
if(property === 'undefined'){
|
63
|
+
if (property === 'undefined') {
|
59
64
|
console.warn(componentName, `theme value: "${val}" is mapped to an invalid property`)
|
60
65
|
}
|
61
66
|
|
package/src/index.cjs.js
CHANGED
@@ -1,4 +1,25 @@
|
|
1
|
-
// CJS is used by screen-renderer-service, we cannot export client stuff here (
|
2
|
-
|
1
|
+
// CJS is used by screen-renderer-service, we cannot export client stuff here (except HTMLElement class),
|
2
|
+
|
3
3
|
export * from './helpers/themeHelpers';
|
4
4
|
export * from './helpers/themeHelpers/colorsHelpers';
|
5
|
+
export { defaultTheme, themeVars } from './theme';
|
6
|
+
|
7
|
+
export { CheckboxClass } from './components/boolean-fields/descope-checkbox/CheckboxClass'
|
8
|
+
export { SwitchToggleClass } from './components/boolean-fields/descope-switch-toggle/SwitchToggleClass'
|
9
|
+
export { ButtonClass } from './components/descope-button/ButtonClass';
|
10
|
+
export { LoaderLinearClass } from './components/descope-loader-linear/LoaderLinearClass';
|
11
|
+
export { LoaderRadialClass } from './components/descope-loader-radial/LoaderRadialClass';
|
12
|
+
export { ContainerClass } from './components/descope-container/ContainerClass';
|
13
|
+
export { DividerClass } from './components/descope-divider/DividerClass';
|
14
|
+
export { EmailFieldClass } from './components/descope-email-field/EmailFieldClass';
|
15
|
+
export { LinkClass } from './components/descope-link/LinkClass';
|
16
|
+
export { LogoClass } from './components/descope-logo/LogoClass';
|
17
|
+
export { NumberFieldClass } from './components/descope-number-field/NumberFieldClass';
|
18
|
+
export { PasscodeClass } from './components/descope-passcode/PasscodeClass';
|
19
|
+
export { PasswordFieldClass } from './components/descope-password-field/PasswordFieldClass';
|
20
|
+
export { TextClass } from './components/descope-text/TextClass';
|
21
|
+
export { TextAreaClass } from './components/descope-text-area/TextAreaClass';
|
22
|
+
export { TextFieldClass } from './components/descope-text-field/TextFieldClass';
|
23
|
+
export { ImageClass } from './components/descope-image/ImageClass';
|
24
|
+
export { PhoneFieldClass } from './components/descope-phone-field/PhoneFieldClass';
|
25
|
+
export { NewPasswordClass } from './components/descope-new-password/NewPasswordClass';
|
package/src/index.d.ts
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
declare module '@descope/web-components-ui';
|
2
|
+
|
3
|
+
export {
|
4
|
+
globalsThemeToStyle,
|
5
|
+
createComponentsTheme,
|
6
|
+
themeToStyle,
|
7
|
+
componentsThemeManager,
|
8
|
+
} from './helpers/themeHelpers';
|
9
|
+
export { genColor } from './helpers/themeHelpers/colorsHelpers';
|
10
|
+
export { defaultTheme, themeVars } from './theme';
|
11
|
+
|
12
|
+
export { ButtonClass } from './components/descope-button';
|
13
|
+
export { CheckboxClass } from './components/boolean-fields/descope-checkbox';
|
14
|
+
export { SwitchToggleClass } from './components/boolean-fields/descope-switch-toggle';
|
15
|
+
export { LoaderLinearClass } from './components/descope-loader-linear';
|
16
|
+
export { LoaderRadialClass } from './components/descope-loader-radial';
|
17
|
+
export { ContainerClass } from './components/descope-container';
|
18
|
+
export { DividerClass } from './components/descope-divider';
|
19
|
+
export { EmailFieldClass } from './components/descope-email-field';
|
20
|
+
export { LinkClass } from './components/descope-link';
|
21
|
+
export { LogoClass } from './components/descope-logo';
|
22
|
+
export { NumberFieldClass } from './components/descope-number-field';
|
23
|
+
export { PasscodeClass } from './components/descope-passcode';
|
24
|
+
export { PasswordFieldClass } from './components/descope-password-field';
|
25
|
+
export { TextClass } from './components/descope-text';
|
26
|
+
export { TextAreaClass } from './components/descope-text-area';
|
27
|
+
export { TextFieldClass } from './components/descope-text-field';
|
28
|
+
export { ImageClass } from './components/descope-image';
|
29
|
+
export { PhoneFieldClass } from './components/descope-phone-field';
|
30
|
+
export { NewPasswordClass } from './components/descope-new-password';
|
31
|
+
|
32
|
+
export type Theme = {
|
33
|
+
globals: {
|
34
|
+
colors: Record<string, string>;
|
35
|
+
fonts: Record<string, any>;
|
36
|
+
typography: Record<string, any>;
|
37
|
+
shadow: Record<string, string>;
|
38
|
+
spacing: Record<string, string>;
|
39
|
+
};
|
40
|
+
components: {
|
41
|
+
button: Record<string, any>;
|
42
|
+
textField: Record<string, any>;
|
43
|
+
logo: Record<string, any>;
|
44
|
+
container: Record<string, any>;
|
45
|
+
link: Record<string, any>;
|
46
|
+
button: Record<string, any>;
|
47
|
+
text: Record<string, any>;
|
48
|
+
};
|
49
|
+
};
|
package/src/index.js
CHANGED
@@ -3,7 +3,7 @@ import { getThemeRefs, createHelperVars } from '../../helpers/themeHelpers';
|
|
3
3
|
import { componentName, ButtonClass } from '../../components/descope-button/ButtonClass';
|
4
4
|
|
5
5
|
const globalRefs = getThemeRefs(globals);
|
6
|
-
const
|
6
|
+
const compVars = ButtonClass.cssVarList;
|
7
7
|
|
8
8
|
const mode = {
|
9
9
|
primary: globalRefs.colors.primary,
|
@@ -13,7 +13,7 @@ const mode = {
|
|
13
13
|
surface: globalRefs.colors.surface
|
14
14
|
};
|
15
15
|
|
16
|
-
const [helperTheme, helperRefs] = createHelperVars({ mode }, componentName);
|
16
|
+
const [helperTheme, helperRefs, helperVars] = createHelperVars({ mode }, componentName);
|
17
17
|
|
18
18
|
const verticalPaddingRatio = 3;
|
19
19
|
const horizontalPaddingRatio = 2;
|
@@ -21,68 +21,69 @@ const horizontalPaddingRatio = 2;
|
|
21
21
|
const button = {
|
22
22
|
...helperTheme,
|
23
23
|
|
24
|
-
[
|
24
|
+
[compVars.cursor]: 'pointer',
|
25
25
|
|
26
|
-
[
|
27
|
-
[
|
28
|
-
[
|
29
|
-
[
|
26
|
+
[compVars.borderRadius]: globalRefs.radius.sm,
|
27
|
+
[compVars.borderWidth]: '2px',
|
28
|
+
[compVars.borderStyle]: 'solid',
|
29
|
+
[compVars.borderColor]: 'transparent',
|
30
30
|
|
31
|
-
[
|
31
|
+
[compVars.gap]: '0.25em',
|
32
32
|
|
33
|
-
[
|
34
|
-
[
|
33
|
+
[compVars.verticalPadding]: `calc(var(${compVars.fontSize}) / ${verticalPaddingRatio})`,
|
34
|
+
[compVars.horizontalPadding]: `calc(var(${compVars.fontSize}) / ${horizontalPaddingRatio})`,
|
35
35
|
|
36
36
|
size: {
|
37
|
-
xs: { [
|
38
|
-
sm: { [
|
39
|
-
md: { [
|
40
|
-
lg: { [
|
41
|
-
xl: { [
|
37
|
+
xs: { [compVars.fontSize]: '12px' },
|
38
|
+
sm: { [compVars.fontSize]: '14px' },
|
39
|
+
md: { [compVars.fontSize]: '18px' },
|
40
|
+
lg: { [compVars.fontSize]: '22px' },
|
41
|
+
xl: { [compVars.fontSize]: '26px' }
|
42
42
|
},
|
43
43
|
|
44
44
|
_fullWidth: {
|
45
|
-
[
|
45
|
+
[compVars.width]: '100%'
|
46
46
|
},
|
47
47
|
|
48
48
|
_loading: {
|
49
|
-
[
|
49
|
+
[compVars.cursor]: 'wait'
|
50
50
|
},
|
51
51
|
|
52
52
|
variant: {
|
53
53
|
contained: {
|
54
|
-
[
|
55
|
-
[
|
54
|
+
[compVars.color]: helperRefs.contrast,
|
55
|
+
[compVars.backgroundColor]: helperRefs.main,
|
56
56
|
_hover: {
|
57
|
-
[
|
57
|
+
[compVars.backgroundColor]: helperRefs.dark
|
58
58
|
},
|
59
59
|
_active: {
|
60
|
-
[
|
60
|
+
[compVars.backgroundColor]: helperRefs.dark
|
61
61
|
}
|
62
62
|
},
|
63
63
|
|
64
64
|
outline: {
|
65
|
-
[
|
66
|
-
[
|
65
|
+
[compVars.color]: helperRefs.main,
|
66
|
+
[compVars.borderColor]: 'currentColor',
|
67
67
|
_hover: {
|
68
|
-
[
|
68
|
+
[compVars.color]: helperRefs.dark,
|
69
69
|
},
|
70
70
|
_active: {
|
71
|
-
[
|
71
|
+
[compVars.color]: helperRefs.light,
|
72
72
|
}
|
73
73
|
},
|
74
74
|
|
75
75
|
link: {
|
76
|
-
[
|
76
|
+
[compVars.color]: helperRefs.main,
|
77
77
|
_hover: {
|
78
|
-
[
|
79
|
-
[
|
78
|
+
[compVars.color]: helperRefs.main,
|
79
|
+
[compVars.textDecoration]: 'underline'
|
80
80
|
},
|
81
81
|
_active: {
|
82
|
-
[
|
82
|
+
[compVars.color]: helperRefs.dark
|
83
83
|
}
|
84
84
|
}
|
85
85
|
}
|
86
86
|
};
|
87
87
|
|
88
88
|
export default button;
|
89
|
+
export const vars = { ...compVars, ...helperVars }
|
@@ -4,7 +4,7 @@ import { ContainerClass, componentName } from "../../components/descope-containe
|
|
4
4
|
|
5
5
|
const globalRefs = getThemeRefs(globals);
|
6
6
|
|
7
|
-
const
|
7
|
+
const compVars = ContainerClass.cssVarList
|
8
8
|
|
9
9
|
const verticalAlignment = {
|
10
10
|
start: { verticalAlignment: 'start' },
|
@@ -27,35 +27,35 @@ const [helperTheme, helperRefs, helperVars] =
|
|
27
27
|
|
28
28
|
const container = {
|
29
29
|
...helperTheme,
|
30
|
-
[
|
31
|
-
[
|
32
|
-
[
|
33
|
-
[
|
30
|
+
[compVars.width]: '100%',
|
31
|
+
[compVars.boxShadow]: 'none',
|
32
|
+
[compVars.backgroundColor]: globalRefs.colors.surface.light,
|
33
|
+
[compVars.color]: globalRefs.colors.surface.contrast,
|
34
34
|
verticalPadding: {
|
35
|
-
sm: { [
|
36
|
-
md: { [
|
37
|
-
lg: { [
|
35
|
+
sm: { [compVars.verticalPadding]: '5px' },
|
36
|
+
md: { [compVars.verticalPadding]: '10px' },
|
37
|
+
lg: { [compVars.verticalPadding]: '20px' },
|
38
38
|
},
|
39
39
|
horizontalPadding: {
|
40
|
-
sm: { [
|
41
|
-
md: { [
|
42
|
-
lg: { [
|
40
|
+
sm: { [compVars.horizontalPadding]: '5px' },
|
41
|
+
md: { [compVars.horizontalPadding]: '10px' },
|
42
|
+
lg: { [compVars.horizontalPadding]: '20px' },
|
43
43
|
},
|
44
44
|
direction: {
|
45
45
|
row: {
|
46
|
-
[
|
47
|
-
[
|
48
|
-
[
|
49
|
-
[
|
46
|
+
[compVars.flexDirection]: 'row',
|
47
|
+
[compVars.alignItems]: helperRefs.verticalAlignment,
|
48
|
+
[compVars.justifyContent]: helperRefs.horizontalAlignment,
|
49
|
+
[compVars.flexWrap]: 'wrap',
|
50
50
|
horizontalAlignment: {
|
51
51
|
spaceBetween: { [helperVars.horizontalAlignment]: 'space-between' },
|
52
52
|
}
|
53
53
|
},
|
54
54
|
|
55
55
|
column: {
|
56
|
-
[
|
57
|
-
[
|
58
|
-
[
|
56
|
+
[compVars.flexDirection]: 'column',
|
57
|
+
[compVars.alignItems]: helperRefs.horizontalAlignment,
|
58
|
+
[compVars.justifyContent]: helperRefs.verticalAlignment,
|
59
59
|
verticalAlignment: {
|
60
60
|
spaceBetween: { [helperVars.verticalAlignment]: 'space-between' }
|
61
61
|
}
|
@@ -64,55 +64,56 @@ const container = {
|
|
64
64
|
|
65
65
|
spaceBetween: {
|
66
66
|
sm: {
|
67
|
-
[
|
67
|
+
[compVars.gap]: '10px'
|
68
68
|
},
|
69
69
|
md: {
|
70
|
-
[
|
70
|
+
[compVars.gap]: '20px'
|
71
71
|
},
|
72
72
|
lg: {
|
73
|
-
[
|
73
|
+
[compVars.gap]: '30px'
|
74
74
|
}
|
75
75
|
},
|
76
76
|
|
77
77
|
shadow: {
|
78
78
|
sm: {
|
79
|
-
[
|
79
|
+
[compVars.boxShadow]: `${globalRefs.shadow.wide.sm} ${helperRefs.shadowColor}, ${globalRefs.shadow.narrow.sm} ${helperRefs.shadowColor}`
|
80
80
|
},
|
81
81
|
md: {
|
82
|
-
[
|
82
|
+
[compVars.boxShadow]: `${globalRefs.shadow.wide.md} ${helperRefs.shadowColor}, ${globalRefs.shadow.narrow.md} ${helperRefs.shadowColor}`
|
83
83
|
},
|
84
84
|
lg: {
|
85
|
-
[
|
85
|
+
[compVars.boxShadow]: `${globalRefs.shadow.wide.lg} ${helperRefs.shadowColor}, ${globalRefs.shadow.narrow.lg} ${helperRefs.shadowColor}`
|
86
86
|
},
|
87
87
|
xl: {
|
88
|
-
[
|
88
|
+
[compVars.boxShadow]: `${globalRefs.shadow.wide.xl} ${helperRefs.shadowColor}, ${globalRefs.shadow.narrow.xl} ${helperRefs.shadowColor}`
|
89
89
|
},
|
90
90
|
'2xl': {
|
91
91
|
[helperVars.shadowColor]: '#00000050', // mimic daisyUI shadow settings
|
92
|
-
[
|
92
|
+
[compVars.boxShadow]: `${globalRefs.shadow.wide['2xl']} ${helperRefs.shadowColor}`
|
93
93
|
},
|
94
94
|
},
|
95
95
|
|
96
96
|
borderRadius: {
|
97
97
|
sm: {
|
98
|
-
[
|
98
|
+
[compVars.borderRadius]: globalRefs.radius.sm
|
99
99
|
},
|
100
100
|
md: {
|
101
|
-
[
|
101
|
+
[compVars.borderRadius]: globalRefs.radius.md
|
102
102
|
},
|
103
103
|
lg: {
|
104
|
-
[
|
104
|
+
[compVars.borderRadius]: globalRefs.radius.lg
|
105
105
|
},
|
106
106
|
xl: {
|
107
|
-
[
|
107
|
+
[compVars.borderRadius]: globalRefs.radius.xl
|
108
108
|
},
|
109
109
|
'2xl': {
|
110
|
-
[
|
110
|
+
[compVars.borderRadius]: globalRefs.radius['2xl']
|
111
111
|
},
|
112
112
|
'3xl': {
|
113
|
-
[
|
113
|
+
[compVars.borderRadius]: globalRefs.radius['3xl']
|
114
114
|
},
|
115
115
|
}
|
116
116
|
};
|
117
117
|
|
118
118
|
export default container;
|
119
|
+
export const vars = { ...compVars, ...helperVars }
|
@@ -4,33 +4,34 @@ import globals from '../globals';
|
|
4
4
|
|
5
5
|
const globalRefs = getThemeRefs(globals);
|
6
6
|
|
7
|
-
const
|
7
|
+
const compVars = DividerClass.cssVarList;
|
8
8
|
|
9
9
|
const thickness = '2px'
|
10
10
|
const textPaddingSize = '10px'
|
11
|
-
const [helperTheme, helperRefs] = createHelperVars({ thickness, textPaddingSize }, componentName);
|
11
|
+
const [helperTheme, helperRefs, helperVars] = createHelperVars({ thickness, textPaddingSize }, componentName);
|
12
12
|
|
13
13
|
const divider = {
|
14
14
|
...helperTheme,
|
15
|
-
[
|
16
|
-
[
|
17
|
-
[
|
18
|
-
[
|
19
|
-
[
|
20
|
-
[
|
21
|
-
[
|
22
|
-
[
|
23
|
-
[
|
15
|
+
[compVars.alignItems]: 'center',
|
16
|
+
[compVars.dividerHeight]: helperRefs.thickness,
|
17
|
+
[compVars.backgroundColor]: globalRefs.colors.surface.main,
|
18
|
+
[compVars.textPadding]: `0 ${helperRefs.textPaddingSize}`,
|
19
|
+
[compVars.width]: '100%',
|
20
|
+
[compVars.flexDirection]: 'row',
|
21
|
+
[compVars.alignSelf]: 'strech',
|
22
|
+
[compVars.textWidth]: 'fit-content',
|
23
|
+
[compVars.maxTextWidth]: 'calc(100% - 100px)',
|
24
24
|
_vertical: {
|
25
|
-
[
|
26
|
-
[
|
27
|
-
[
|
28
|
-
[
|
29
|
-
[
|
30
|
-
[
|
31
|
-
[
|
32
|
-
[
|
25
|
+
[compVars.padding]: `0 calc(${thickness} * 3)`,
|
26
|
+
[compVars.width]: 'fit-content',
|
27
|
+
[compVars.textPadding]: `${helperRefs.textPaddingSize} 0`,
|
28
|
+
[compVars.flexDirection]: 'column',
|
29
|
+
[compVars.minHeight]: '200px',
|
30
|
+
[compVars.textWidth]: 'fit-content',
|
31
|
+
[compVars.dividerWidth]: helperRefs.thickness,
|
32
|
+
[compVars.maxTextWidth]: '100%',
|
33
33
|
}
|
34
34
|
};
|
35
35
|
|
36
36
|
export default divider;
|
37
|
+
export const vars = { ...compVars, ...helperVars }
|
@@ -1,24 +1,24 @@
|
|
1
|
-
import button from './button';
|
2
|
-
import textField from './textField';
|
3
|
-
import passwordField from './passwordField';
|
4
|
-
import numberField from './numberField';
|
5
|
-
import emailField from './emailField';
|
6
|
-
import textArea from './textArea';
|
7
|
-
import checkbox from './checkbox';
|
8
|
-
import switchToggle from './switchToggle';
|
9
|
-
import container from './container';
|
10
|
-
import logo from './logo';
|
11
|
-
import text from './text';
|
12
|
-
import link from './link';
|
13
|
-
import divider from './divider';
|
14
|
-
import passcode from './passcode';
|
1
|
+
import * as button from './button';
|
2
|
+
import * as textField from './textField';
|
3
|
+
import * as passwordField from './passwordField';
|
4
|
+
import * as numberField from './numberField';
|
5
|
+
import * as emailField from './emailField';
|
6
|
+
import * as textArea from './textArea';
|
7
|
+
import * as checkbox from './checkbox';
|
8
|
+
import * as switchToggle from './switchToggle';
|
9
|
+
import * as container from './container';
|
10
|
+
import * as logo from './logo';
|
11
|
+
import * as text from './text';
|
12
|
+
import * as link from './link';
|
13
|
+
import * as divider from './divider';
|
14
|
+
import * as passcode from './passcode';
|
15
15
|
import { loaderRadial, loaderLinear } from './loader';
|
16
|
-
import comboBox from './comboBox';
|
17
|
-
import image from './image';
|
18
|
-
import phoneField from './phoneField';
|
19
|
-
import newPassword from './newPassword';
|
16
|
+
import * as comboBox from './comboBox';
|
17
|
+
import * as image from './image';
|
18
|
+
import * as phoneField from './phoneField';
|
19
|
+
import * as newPassword from './newPassword';
|
20
20
|
|
21
|
-
|
21
|
+
const components = {
|
22
22
|
button,
|
23
23
|
textField,
|
24
24
|
passwordField,
|
@@ -39,4 +39,11 @@ export default {
|
|
39
39
|
image,
|
40
40
|
phoneField,
|
41
41
|
newPassword,
|
42
|
-
}
|
42
|
+
}
|
43
|
+
|
44
|
+
|
45
|
+
const theme = Object.keys(components).reduce((acc, comp) => ({ ...acc, [comp]: components[comp].default }), {});
|
46
|
+
const vars = Object.keys(components).reduce((acc, comp) => ({ ...acc, [comp]: components[comp].vars }), {});
|
47
|
+
|
48
|
+
export default theme;
|
49
|
+
export { vars }
|
package/src/theme/globals.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
import { getThemeRefs } from '../helpers/themeHelpers';
|
1
|
+
import { getThemeRefs, getThemeVars } from '../helpers/themeHelpers';
|
2
2
|
import { genColors } from '../helpers/themeHelpers/colorsHelpers';
|
3
3
|
|
4
|
+
|
4
5
|
export const colors = genColors({
|
5
6
|
surface: {
|
6
7
|
main: 'lightgray',
|
@@ -138,7 +139,7 @@ const shadow = {
|
|
138
139
|
}
|
139
140
|
};
|
140
141
|
|
141
|
-
|
142
|
+
const globals = {
|
142
143
|
colors,
|
143
144
|
typography,
|
144
145
|
spacing,
|
@@ -147,3 +148,6 @@ export default {
|
|
147
148
|
shadow,
|
148
149
|
fonts
|
149
150
|
};
|
151
|
+
|
152
|
+
export default globals
|
153
|
+
export const vars = getThemeVars(globals)
|
package/src/theme/index.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
import globals from './globals';
|
2
|
-
import components from './components';
|
1
|
+
import globals, { vars as globalsVars } from './globals';
|
2
|
+
import components, { vars as componentsVars } from './components';
|
3
3
|
|
4
|
-
export
|
4
|
+
export const defaultTheme = { globals, components };
|
5
|
+
export const themeVars = { globals: globalsVars, components: componentsVars }
|