@descope/web-components-ui 1.0.39 → 1.0.41
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/index.cjs.js +35 -18
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1128 -481
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/101.js +148 -0
- package/dist/umd/208.js +2 -0
- package/dist/umd/208.js.LICENSE.txt +5 -0
- package/dist/umd/211.js +312 -0
- package/dist/umd/211.js.LICENSE.txt +5 -0
- package/dist/umd/233.js +573 -0
- package/dist/umd/{511.js.LICENSE.txt → 233.js.LICENSE.txt} +0 -6
- package/dist/umd/422.js +2 -0
- package/dist/umd/422.js.LICENSE.txt +5 -0
- package/dist/umd/437.js +19 -0
- package/dist/umd/437.js.LICENSE.txt +5 -0
- package/dist/umd/513.js +1 -0
- package/dist/umd/515.js +202 -0
- package/dist/umd/515.js.LICENSE.txt +11 -0
- package/dist/umd/54.js +4 -4
- package/dist/umd/56.js +48 -0
- package/dist/umd/56.js.LICENSE.txt +5 -0
- package/dist/umd/599.js +1 -1
- package/dist/umd/63.js +1 -0
- package/dist/umd/725.js +37 -0
- package/dist/umd/725.js.LICENSE.txt +11 -0
- package/dist/umd/729.js +1 -1
- package/dist/umd/767.js +2 -0
- package/dist/umd/{9.js.LICENSE.txt → 767.js.LICENSE.txt} +0 -6
- package/dist/umd/786.js +2 -0
- package/dist/umd/786.js.LICENSE.txt +17 -0
- package/dist/umd/789.js +1 -0
- package/dist/umd/806.js +109 -0
- package/dist/umd/806.js.LICENSE.txt +5 -0
- package/dist/umd/938.js +1 -0
- package/dist/umd/97.js +1 -1
- package/dist/umd/descope-button-index-js.js +1 -1
- package/dist/umd/descope-checkbox-index-js.js +1 -0
- package/dist/umd/descope-combo-index-js.js +1 -1
- package/dist/umd/descope-container-index-js.js +1 -1
- package/dist/umd/descope-email-field-index-js.js +1 -0
- package/dist/umd/descope-number-field-index-js.js +1 -0
- package/dist/umd/descope-password-field-index-js.js +1 -0
- package/dist/umd/descope-switch-toggle-index-js.js +1 -0
- package/dist/umd/descope-text-area-index-js.js +1 -0
- package/dist/umd/descope-text-field-index-js.js +1 -1
- package/dist/umd/index.js +1 -1
- package/package.json +9 -2
- package/src/components/descope-button/Button.js +90 -30
- package/src/components/descope-button/index.js +3 -3
- package/src/components/descope-checkbox/Checkbox.js +33 -0
- package/src/components/descope-checkbox/index.js +6 -0
- package/src/components/descope-combo/index.js +12 -12
- package/src/components/descope-container/Container.js +57 -51
- package/src/components/descope-container/index.js +1 -1
- package/src/components/descope-date-picker/index.js +13 -7
- package/src/components/descope-email-field/EmailField.js +72 -0
- package/src/components/descope-email-field/index.js +6 -0
- package/src/components/descope-number-field/NumberField.js +72 -0
- package/src/components/descope-number-field/index.js +6 -0
- package/src/components/descope-password-field/PasswordField.js +79 -0
- package/src/components/descope-password-field/index.js +6 -0
- package/src/components/descope-switch-toggle/SwitchToggle.js +81 -0
- package/src/components/descope-switch-toggle/index.js +6 -0
- package/src/components/descope-text-area/TextArea.js +66 -0
- package/src/components/descope-text-area/index.js +6 -0
- package/src/components/descope-text-field/TextField.js +98 -28
- package/src/components/descope-text-field/index.js +3 -3
- package/src/componentsHelpers/componentNameValidationMixin.js +21 -17
- package/src/componentsHelpers/createProxy/helpers.js +31 -27
- package/src/componentsHelpers/createProxy/index.js +27 -17
- package/src/componentsHelpers/createStyleMixin/helpers.js +65 -47
- package/src/componentsHelpers/createStyleMixin/index.js +64 -55
- package/src/componentsHelpers/draggableMixin.js +25 -26
- package/src/componentsHelpers/index.js +12 -9
- package/src/componentsHelpers/inputMixin.js +38 -37
- package/src/constants.js +1 -1
- package/src/dev/index.js +4 -3
- package/src/helpers.js +8 -6
- package/src/index.cjs.js +1 -1
- package/src/index.js +16 -8
- package/src/index.umd.js +11 -5
- package/src/theme/components/button.js +32 -21
- package/src/theme/components/checkbox.js +9 -0
- package/src/theme/components/container.js +32 -27
- package/src/theme/components/emailField.js +8 -0
- package/src/theme/components/index.js +19 -7
- package/src/theme/components/input.js +106 -0
- package/src/theme/components/numberField.js +8 -0
- package/src/theme/components/passwordField.js +11 -0
- package/src/theme/components/switchToggle.js +10 -0
- package/src/theme/components/textArea.js +44 -0
- package/src/theme/components/textField.js +69 -45
- package/src/theme/globals.js +27 -26
- package/src/theme/index.js +2 -2
- package/src/themeHelpers/index.js +45 -30
- package/src/themeHelpers/processColors.js +10 -7
- package/dist/umd/221.js +0 -37
- package/dist/umd/511.js +0 -573
- package/dist/umd/9.js +0 -312
- /package/dist/umd/{221.js.LICENSE.txt → 101.js.LICENSE.txt} +0 -0
@@ -1,12 +1,15 @@
|
|
1
|
-
import { DESCOPE_PREFIX } from
|
2
|
-
import { kebabCaseJoin } from
|
1
|
+
import { DESCOPE_PREFIX } from '../constants';
|
2
|
+
import { kebabCaseJoin } from '../helpers';
|
3
3
|
|
4
|
-
export const getComponentName = (name) => kebabCaseJoin(DESCOPE_PREFIX, name)
|
4
|
+
export const getComponentName = (name) => kebabCaseJoin(DESCOPE_PREFIX, name);
|
5
5
|
|
6
|
-
export const compose =
|
6
|
+
export const compose =
|
7
|
+
(...fns) =>
|
8
|
+
(val) =>
|
9
|
+
fns.reduceRight((res, fn) => fn(res), val);
|
7
10
|
|
8
|
-
export { createStyleMixin } from './createStyleMixin'
|
9
|
-
export { draggableMixin } from './draggableMixin'
|
10
|
-
export { createProxy } from './createProxy'
|
11
|
-
export { inputMixin } from './inputMixin'
|
12
|
-
export { componentNameValidationMixin } from './componentNameValidationMixin'
|
11
|
+
export { createStyleMixin } from './createStyleMixin';
|
12
|
+
export { draggableMixin } from './draggableMixin';
|
13
|
+
export { createProxy } from './createProxy';
|
14
|
+
export { inputMixin } from './inputMixin';
|
15
|
+
export { componentNameValidationMixin } from './componentNameValidationMixin';
|
@@ -1,46 +1,47 @@
|
|
1
1
|
export const inputMixin = (superclass) =>
|
2
|
-
|
2
|
+
class InputMixinClass extends superclass {
|
3
3
|
static get formAssociated() {
|
4
4
|
return true;
|
5
5
|
}
|
6
|
-
|
7
|
-
#internals
|
8
6
|
|
9
|
-
|
10
|
-
super();
|
7
|
+
#internals;
|
11
8
|
|
12
|
-
|
9
|
+
constructor() {
|
10
|
+
super();
|
13
11
|
|
14
|
-
|
15
|
-
|
16
|
-
this.setAttribute('tabindex', 0);
|
17
|
-
}
|
18
|
-
}
|
19
|
-
|
20
|
-
formAssociatedCallback() {
|
21
|
-
this.setValidity?.();
|
22
|
-
}
|
23
|
-
|
24
|
-
connectedCallback() {
|
25
|
-
super.connectedCallback?.();
|
26
|
-
|
27
|
-
// vaadin does not expose all those validation attributes so we need to take it from the input
|
28
|
-
// https://github.com/vaadin/web-components/issues/1177
|
29
|
-
const input = this.proxyElement.querySelector('input')
|
30
|
-
if (!input) throw Error('no input was found')
|
31
|
-
|
32
|
-
this.checkValidity = () => input.checkValidity()
|
33
|
-
this.reportValidity = () => input.reportValidity()
|
34
|
-
this.validity = input.validity
|
35
|
-
|
36
|
-
this.setValidity = () => {
|
37
|
-
this.#internals.setValidity(input.validity, input.validationMessage);
|
38
|
-
}
|
12
|
+
this.#internals = this.attachInternals();
|
13
|
+
}
|
39
14
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
}
|
15
|
+
formAssociatedCallback() {
|
16
|
+
this.setValidity?.();
|
17
|
+
}
|
44
18
|
|
45
|
-
|
46
|
-
|
19
|
+
connectedCallback() {
|
20
|
+
super.connectedCallback?.();
|
21
|
+
|
22
|
+
// this is needed in order to make sure the form input validation is working
|
23
|
+
if (!this.hasAttribute('tabindex')) {
|
24
|
+
this.setAttribute('tabindex', 0);
|
25
|
+
}
|
26
|
+
|
27
|
+
// vaadin does not expose all those validation attributes so we need to take it from the input
|
28
|
+
// https://github.com/vaadin/web-components/issues/1177
|
29
|
+
const input =
|
30
|
+
this.proxyElement.querySelector('input') ||
|
31
|
+
this.proxyElement.querySelector('textarea');
|
32
|
+
if (!input) throw Error('no input was found');
|
33
|
+
|
34
|
+
this.checkValidity = () => input.checkValidity();
|
35
|
+
this.reportValidity = () => input.reportValidity();
|
36
|
+
this.validity = input.validity;
|
37
|
+
|
38
|
+
this.setValidity = () => {
|
39
|
+
this.#internals.setValidity(input.validity, input.validationMessage);
|
40
|
+
};
|
41
|
+
|
42
|
+
input.oninput = () => {
|
43
|
+
this.value = input.value;
|
44
|
+
this.setValidity();
|
45
|
+
};
|
46
|
+
}
|
47
|
+
};
|
package/src/constants.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const DESCOPE_PREFIX = 'descope'
|
1
|
+
export const DESCOPE_PREFIX = 'descope';
|
package/src/dev/index.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
import theme from '../theme'
|
2
|
-
import { themeToStyle } from
|
1
|
+
import theme from '../theme';
|
2
|
+
import { themeToStyle } from '../themeHelpers';
|
3
3
|
|
4
4
|
// this file is used for exposing stuff to the dev env only
|
5
5
|
|
6
|
-
export const getDefaultThemeStyles = (themeName) =>
|
6
|
+
export const getDefaultThemeStyles = (themeName) =>
|
7
|
+
themeToStyle(theme, themeName);
|
package/src/helpers.js
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
-
export const kebabCase = str =>
|
2
|
-
|
3
|
-
.replace(/[
|
4
|
-
.
|
1
|
+
export const kebabCase = (str) =>
|
2
|
+
str
|
3
|
+
.replace(/([a-z])([A-Z])/g, '$1-$2')
|
4
|
+
.replace(/[\s_.]+/g, '-')
|
5
|
+
.toLowerCase();
|
5
6
|
|
6
|
-
export const kebabCaseJoin = (...args) => kebabCase(args.join('-'))
|
7
|
+
export const kebabCaseJoin = (...args) => kebabCase(args.join('-'));
|
7
8
|
|
8
|
-
export const getCssVarName = (...args) =>
|
9
|
+
export const getCssVarName = (...args) =>
|
10
|
+
`--${kebabCaseJoin(...args.filter((arg) => !!arg))}`;
|
package/src/index.cjs.js
CHANGED
package/src/index.js
CHANGED
@@ -1,9 +1,17 @@
|
|
1
|
-
import
|
2
|
-
import
|
3
|
-
import
|
4
|
-
import
|
5
|
-
import
|
1
|
+
import './components/descope-button';
|
2
|
+
import './components/descope-combo';
|
3
|
+
import './components/descope-text-field';
|
4
|
+
import './components/descope-number-field';
|
5
|
+
import './components/descope-email-field';
|
6
|
+
import './components/descope-password-field';
|
7
|
+
import './components/descope-text-area';
|
8
|
+
import './components/descope-date-picker';
|
9
|
+
import './components/descope-container';
|
6
10
|
|
7
|
-
export {
|
8
|
-
|
9
|
-
|
11
|
+
export {
|
12
|
+
globalsThemeToStyle,
|
13
|
+
componentsThemeToStyle,
|
14
|
+
themeToStyle
|
15
|
+
} from './themeHelpers';
|
16
|
+
export { genColor } from './themeHelpers/processColors';
|
17
|
+
export { default as defaultTheme } from './theme';
|
package/src/index.umd.js
CHANGED
@@ -1,10 +1,16 @@
|
|
1
|
-
const components = import.meta.webpackContext('./components', {
|
1
|
+
const components = import.meta.webpackContext('./components', {
|
2
|
+
recursive: true,
|
3
|
+
regExp: /index.js$/,
|
4
|
+
mode: 'lazy',
|
5
|
+
chunkName: '[request]',
|
6
|
+
prefetch: true
|
7
|
+
});
|
2
8
|
|
3
9
|
// all components must be in a folder with the component name, and have an index.js file
|
4
10
|
// e.g. ./descope-button/index.js
|
5
11
|
module.exports = components.keys().reduce((acc, key) => {
|
6
|
-
|
7
|
-
|
12
|
+
const componentName = key.replace(/.*?([^\/]+)\/index\.js$/, '$1');
|
13
|
+
acc[componentName] = () => components(key);
|
8
14
|
|
9
|
-
|
10
|
-
}, {})
|
15
|
+
return acc;
|
16
|
+
}, {});
|
@@ -1,29 +1,22 @@
|
|
1
|
-
import globals from
|
2
|
-
import { getThemeRefs, createHelperVars } from
|
3
|
-
import Button, { componentName } from
|
1
|
+
import globals from '../globals';
|
2
|
+
import { getThemeRefs, createHelperVars } from '../../themeHelpers';
|
3
|
+
import Button, { componentName } from '../../components/descope-button/Button';
|
4
4
|
|
5
5
|
const globalRefs = getThemeRefs(globals);
|
6
|
-
const vars = Button.cssVarList
|
6
|
+
const vars = Button.cssVarList;
|
7
7
|
|
8
8
|
const mode = {
|
9
|
-
primary:
|
10
|
-
main: globalRefs.colors.primary.main,
|
11
|
-
dark: 'darkblue',
|
12
|
-
light: 'lightblue',
|
13
|
-
contrast: 'white'
|
14
|
-
},
|
9
|
+
primary: globalRefs.colors.primary,
|
15
10
|
secondary: globalRefs.colors.secondary,
|
16
11
|
success: globalRefs.colors.success,
|
17
12
|
error: globalRefs.colors.error,
|
18
|
-
surface: globalRefs.colors.surface
|
19
|
-
}
|
13
|
+
surface: globalRefs.colors.surface
|
14
|
+
};
|
20
15
|
|
21
|
-
const [helperTheme, helperRefs] = createHelperVars({ mode }, componentName)
|
16
|
+
const [helperTheme, helperRefs] = createHelperVars({ mode }, componentName);
|
22
17
|
|
23
18
|
const button = {
|
24
19
|
...helperTheme,
|
25
|
-
[vars.borderRadius]: globalRefs.radius.lg,
|
26
|
-
[vars.cursor]: 'pointer',
|
27
20
|
|
28
21
|
size: {
|
29
22
|
xs: {
|
@@ -50,37 +43,55 @@ const button = {
|
|
50
43
|
[vars.height]: '50px',
|
51
44
|
[vars.fontSize]: '25px',
|
52
45
|
[vars.padding]: `0 ${globalRefs.spacing.xl}`
|
53
|
-
}
|
46
|
+
}
|
54
47
|
},
|
55
48
|
|
49
|
+
[vars.borderRadius]: globalRefs.radius.lg,
|
50
|
+
[vars.cursor]: 'pointer',
|
51
|
+
[vars.borderWidth]: '2px',
|
52
|
+
[vars.borderStyle]: 'solid',
|
53
|
+
[vars.borderColor]: 'transparent',
|
54
|
+
|
56
55
|
_fullWidth: {
|
57
56
|
[vars.width]: '100%'
|
58
57
|
},
|
58
|
+
_loading: {
|
59
|
+
[vars.cursor]: 'wait'
|
60
|
+
},
|
59
61
|
|
60
62
|
variant: {
|
61
63
|
contained: {
|
62
64
|
[vars.color]: helperRefs.contrast,
|
63
65
|
[vars.backgroundColor]: helperRefs.main,
|
64
66
|
_hover: {
|
65
|
-
[vars.backgroundColor]: helperRefs.dark
|
67
|
+
[vars.backgroundColor]: helperRefs.dark
|
66
68
|
},
|
69
|
+
_loading: {
|
70
|
+
[vars.backgroundColor]: helperRefs.main
|
71
|
+
}
|
67
72
|
},
|
68
73
|
outline: {
|
69
74
|
[vars.color]: helperRefs.main,
|
70
75
|
[vars.borderColor]: helperRefs.main,
|
71
|
-
[vars.borderWidth]: '2px',
|
72
|
-
[vars.borderStyle]: 'solid',
|
73
76
|
_hover: {
|
74
77
|
[vars.color]: helperRefs.dark,
|
75
78
|
[vars.borderColor]: helperRefs.dark,
|
76
79
|
_error: {
|
77
|
-
[vars.color]:
|
80
|
+
[vars.color]: helperRefs.error
|
78
81
|
}
|
79
82
|
}
|
80
83
|
},
|
81
84
|
link: {
|
82
85
|
[vars.color]: helperRefs.main,
|
83
|
-
|
86
|
+
[vars.padding]: 0,
|
87
|
+
[vars.margin]: 0,
|
88
|
+
[vars.lineHeight]: helperRefs.height,
|
89
|
+
[vars.borderRadius]: 0,
|
90
|
+
_hover: {
|
91
|
+
[vars.color]: helperRefs.main,
|
92
|
+
[vars.textDecoration]: 'underline'
|
93
|
+
}
|
94
|
+
}
|
84
95
|
}
|
85
96
|
};
|
86
97
|
|
@@ -1,38 +1,41 @@
|
|
1
|
-
import globals from
|
2
|
-
import { getThemeRefs, createHelperVars } from
|
3
|
-
import Container from
|
1
|
+
import globals from '../globals';
|
2
|
+
import { getThemeRefs, createHelperVars } from '../../themeHelpers';
|
3
|
+
import Container from '../../components/descope-container/Container';
|
4
4
|
|
5
5
|
const globalRefs = getThemeRefs(globals);
|
6
6
|
|
7
|
-
const vars = Container.cssVarList
|
7
|
+
const vars = Container.cssVarList;
|
8
8
|
|
9
9
|
const verticalAlignment = {
|
10
10
|
start: { verticalAlignment: 'start' },
|
11
11
|
center: { verticalAlignment: 'center' },
|
12
|
-
end: { verticalAlignment: 'end' }
|
13
|
-
}
|
12
|
+
end: { verticalAlignment: 'end' }
|
13
|
+
};
|
14
14
|
|
15
15
|
const horizontalAlignment = {
|
16
16
|
start: { horizontalAlignment: 'start' },
|
17
17
|
center: { horizontalAlignment: 'center' },
|
18
|
-
end: { horizontalAlignment: 'end' }
|
19
|
-
}
|
18
|
+
end: { horizontalAlignment: 'end' }
|
19
|
+
};
|
20
20
|
|
21
|
-
const [helperTheme,
|
22
|
-
|
21
|
+
const [helperTheme, helperRefs, helperVars] = createHelperVars(
|
22
|
+
{ verticalAlignment, horizontalAlignment },
|
23
|
+
'container'
|
24
|
+
);
|
23
25
|
|
24
26
|
const container = {
|
25
27
|
...helperTheme,
|
26
28
|
[vars.display]: 'flex',
|
29
|
+
[vars.backgroundColor]: globalRefs.colors.surface.main,
|
27
30
|
verticalPadding: {
|
28
31
|
sm: { [vars.verticalPadding]: '5px' },
|
29
32
|
md: { [vars.verticalPadding]: '10px' },
|
30
|
-
lg: { [vars.verticalPadding]: '20px' }
|
33
|
+
lg: { [vars.verticalPadding]: '20px' }
|
31
34
|
},
|
32
35
|
horizontalPadding: {
|
33
36
|
sm: { [vars.horizontalPadding]: '5px' },
|
34
37
|
md: { [vars.horizontalPadding]: '10px' },
|
35
|
-
lg: { [vars.horizontalPadding]: '20px' }
|
38
|
+
lg: { [vars.horizontalPadding]: '20px' }
|
36
39
|
},
|
37
40
|
direction: {
|
38
41
|
row: {
|
@@ -40,7 +43,7 @@ const container = {
|
|
40
43
|
[vars.alignItems]: helperRefs.verticalAlignment,
|
41
44
|
[vars.justifyContent]: helperRefs.horizontalAlignment,
|
42
45
|
horizontalAlignment: {
|
43
|
-
spaceBetween: { [helperVars.horizontalAlignment]: 'space-between' }
|
46
|
+
spaceBetween: { [helperVars.horizontalAlignment]: 'space-between' }
|
44
47
|
}
|
45
48
|
},
|
46
49
|
|
@@ -49,9 +52,11 @@ const container = {
|
|
49
52
|
[vars.alignItems]: helperRefs.horizontalAlignment,
|
50
53
|
[vars.justifyContent]: helperRefs.verticalAlignment,
|
51
54
|
verticalAlignment: {
|
52
|
-
spaceBetween: {
|
55
|
+
spaceBetween: {
|
56
|
+
[helperVars.verticalAlignment]: 'space-between'
|
57
|
+
}
|
53
58
|
}
|
54
|
-
}
|
59
|
+
}
|
55
60
|
},
|
56
61
|
|
57
62
|
spaceBetween: {
|
@@ -67,27 +72,27 @@ const container = {
|
|
67
72
|
},
|
68
73
|
|
69
74
|
shadow: {
|
70
|
-
sm: {
|
71
|
-
[vars.boxShadow]: `${globalRefs.shadow.size.sm} ${globalRefs.shadow.color}`
|
72
|
-
},
|
73
|
-
md: {
|
74
|
-
[vars.boxShadow]: `${globalRefs.shadow.size.md} ${globalRefs.shadow.color}`
|
75
|
-
},
|
76
|
-
lg: {
|
77
|
-
[vars.boxShadow]: `${globalRefs.shadow.size.lg} ${globalRefs.shadow.color}`
|
75
|
+
sm: {
|
76
|
+
[vars.boxShadow]: `${globalRefs.shadow.size.sm} ${globalRefs.shadow.color}`
|
77
|
+
},
|
78
|
+
md: {
|
79
|
+
[vars.boxShadow]: `${globalRefs.shadow.size.md} ${globalRefs.shadow.color}`
|
78
80
|
},
|
81
|
+
lg: {
|
82
|
+
[vars.boxShadow]: `${globalRefs.shadow.size.lg} ${globalRefs.shadow.color}`
|
83
|
+
}
|
79
84
|
},
|
80
85
|
|
81
86
|
borderRadius: {
|
82
|
-
sm: {
|
87
|
+
sm: {
|
83
88
|
[vars.borderRadius]: globalRefs.radius.sm
|
84
89
|
},
|
85
|
-
md: {
|
90
|
+
md: {
|
86
91
|
[vars.borderRadius]: globalRefs.radius.md
|
87
92
|
},
|
88
|
-
lg: {
|
93
|
+
lg: {
|
89
94
|
[vars.borderRadius]: globalRefs.radius.lg
|
90
|
-
}
|
95
|
+
}
|
91
96
|
}
|
92
97
|
};
|
93
98
|
|
@@ -1,9 +1,21 @@
|
|
1
|
-
import button
|
2
|
-
import textField
|
3
|
-
import
|
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';
|
4
10
|
|
5
11
|
export default {
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
12
|
+
button,
|
13
|
+
textField,
|
14
|
+
passwordField,
|
15
|
+
numberField,
|
16
|
+
emailField,
|
17
|
+
textArea,
|
18
|
+
checkbox,
|
19
|
+
switchToggle,
|
20
|
+
container
|
21
|
+
};
|
@@ -0,0 +1,106 @@
|
|
1
|
+
import {
|
2
|
+
getComponentName,
|
3
|
+
createStyleMixin,
|
4
|
+
draggableMixin,
|
5
|
+
createProxy,
|
6
|
+
inputMixin,
|
7
|
+
compose,
|
8
|
+
componentNameValidationMixin
|
9
|
+
} from '../../componentsHelpers';
|
10
|
+
import { matchHostStyle } from '../../componentsHelpers/createStyleMixin/helpers';
|
11
|
+
|
12
|
+
export const componentName = getComponentName('text-field');
|
13
|
+
|
14
|
+
const selectors = {
|
15
|
+
label: '::part(label)',
|
16
|
+
input: '::part(input-field)',
|
17
|
+
readOnlyInput: '[readonly]::part(input-field)::after',
|
18
|
+
placeholder: '> input:placeholder-shown'
|
19
|
+
};
|
20
|
+
|
21
|
+
let overrides = ``;
|
22
|
+
|
23
|
+
export const textFieldMappings = {
|
24
|
+
color: { selector: selectors.input },
|
25
|
+
backgroundColor: { selector: selectors.input },
|
26
|
+
width: [matchHostStyle()],
|
27
|
+
color: { selector: selectors.input },
|
28
|
+
borderColor: [
|
29
|
+
{ selector: selectors.input },
|
30
|
+
{ selector: selectors.readOnlyInput }
|
31
|
+
],
|
32
|
+
borderWidth: [
|
33
|
+
{ selector: selectors.input },
|
34
|
+
{ selector: selectors.readOnlyInput }
|
35
|
+
],
|
36
|
+
borderStyle: [
|
37
|
+
{ selector: selectors.input },
|
38
|
+
{ selector: selectors.readOnlyInput }
|
39
|
+
],
|
40
|
+
borderRadius: { selector: selectors.input },
|
41
|
+
boxShadow: { selector: selectors.input },
|
42
|
+
fontSize: {},
|
43
|
+
height: { selector: selectors.input },
|
44
|
+
padding: { selector: selectors.input },
|
45
|
+
outline: { selector: selectors.input },
|
46
|
+
outlineOffset: { selector: selectors.input },
|
47
|
+
|
48
|
+
placeholderColor: { selector: selectors.placeholder, property: 'color' }
|
49
|
+
// borderWidthReadOnly: [borderWidth('[readonly]::part(input-field)::after')]
|
50
|
+
};
|
51
|
+
|
52
|
+
const TextField = compose(
|
53
|
+
createStyleMixin({
|
54
|
+
mappings: textFieldMappings
|
55
|
+
}),
|
56
|
+
draggableMixin,
|
57
|
+
inputMixin,
|
58
|
+
componentNameValidationMixin
|
59
|
+
)(
|
60
|
+
createProxy({
|
61
|
+
slots: ['prefix', 'suffix'],
|
62
|
+
wrappedEleName: 'vaadin-text-field',
|
63
|
+
style: () => overrides,
|
64
|
+
excludeAttrsSync: ['tabindex'],
|
65
|
+
componentName
|
66
|
+
})
|
67
|
+
);
|
68
|
+
|
69
|
+
overrides = `
|
70
|
+
vaadin-text-field {
|
71
|
+
margin: 0;
|
72
|
+
padding: 0;
|
73
|
+
}
|
74
|
+
vaadin-text-field::part(input-field) {
|
75
|
+
overflow: hidden;
|
76
|
+
}
|
77
|
+
vaadin-text-field[readonly] > input:placeholder-shown {
|
78
|
+
opacity: 1;
|
79
|
+
}
|
80
|
+
vaadin-text-field input:-webkit-autofill,
|
81
|
+
vaadin-text-field input:-webkit-autofill::first-line,
|
82
|
+
vaadin-text-field input:-webkit-autofill:hover,
|
83
|
+
vaadin-text-field input:-webkit-autofill:active,
|
84
|
+
vaadin-text-field input:-webkit-autofill:focus {
|
85
|
+
-webkit-text-fill-color: var(${TextField.cssVarList.color});
|
86
|
+
box-shadow: 0 0 0 var(${TextField.cssVarList.height}) var(${TextField.cssVarList.backgroundColor}) inset;
|
87
|
+
}
|
88
|
+
vaadin-text-field > label,
|
89
|
+
vaadin-text-field::part(input-field) {
|
90
|
+
cursor: pointer;
|
91
|
+
color: var(${TextField.cssVarList.color});
|
92
|
+
}
|
93
|
+
vaadin-text-field::part(input-field):focus {
|
94
|
+
cursor: text;
|
95
|
+
}
|
96
|
+
vaadin-text-field[required]::part(required-indicator)::after {
|
97
|
+
font-size: "12px";
|
98
|
+
content: "*";
|
99
|
+
color: var(${TextField.cssVarList.color});
|
100
|
+
}
|
101
|
+
vaadin-text-field[readonly]::part(input-field)::after {
|
102
|
+
border: 0 solid;
|
103
|
+
}
|
104
|
+
`;
|
105
|
+
|
106
|
+
export default TextField;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import PasswordField from '../../components/descope-password-field/PasswordField';
|
2
|
+
import { textField } from './textField';
|
3
|
+
|
4
|
+
const vars = PasswordField.cssVarList;
|
5
|
+
|
6
|
+
const passwordField = {
|
7
|
+
...textField(vars),
|
8
|
+
[vars.revealCursor]: 'pointer'
|
9
|
+
};
|
10
|
+
|
11
|
+
export default passwordField;
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import globals from '../globals';
|
2
|
+
import { getThemeRefs } from '../../themeHelpers';
|
3
|
+
import TextArea from '../../components/descope-text-area/TextArea';
|
4
|
+
|
5
|
+
const globalRefs = getThemeRefs(globals);
|
6
|
+
const vars = TextArea.cssVarList;
|
7
|
+
|
8
|
+
const textArea = {
|
9
|
+
[vars.color]: globalRefs.colors.primary.main,
|
10
|
+
[vars.backgroundColor]: globalRefs.colors.surface.light,
|
11
|
+
[vars.resize]: 'vertical',
|
12
|
+
|
13
|
+
[vars.borderRadius]: globalRefs.radius.sm,
|
14
|
+
[vars.borderWidth]: '1px',
|
15
|
+
[vars.borderStyle]: 'solid',
|
16
|
+
[vars.borderColor]: 'transparent',
|
17
|
+
|
18
|
+
_borderOffset: {
|
19
|
+
[vars.outlineOffset]: '2px'
|
20
|
+
},
|
21
|
+
|
22
|
+
_bordered: {
|
23
|
+
[vars.borderColor]: globalRefs.colors.surface.main
|
24
|
+
},
|
25
|
+
|
26
|
+
_focused: {
|
27
|
+
[vars.focusInputCursor]: 'text',
|
28
|
+
[vars.outline]: `2px solid ${globalRefs.colors.surface.main}`
|
29
|
+
},
|
30
|
+
|
31
|
+
_fullWidth: {
|
32
|
+
[vars.width]: '100%'
|
33
|
+
},
|
34
|
+
|
35
|
+
_disabled: {
|
36
|
+
[vars.cursor]: 'not-allowed'
|
37
|
+
},
|
38
|
+
|
39
|
+
_invalid: {
|
40
|
+
[vars.outline]: `2px solid ${globalRefs.colors.error.main}`
|
41
|
+
}
|
42
|
+
};
|
43
|
+
|
44
|
+
export default textArea;
|