@descope/web-components-ui 1.0.39 → 1.0.41
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/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,53 +1,77 @@
|
|
|
1
|
-
import globals from
|
|
2
|
-
import { getThemeRefs } from
|
|
1
|
+
import globals from '../globals';
|
|
2
|
+
import { getThemeRefs } from '../../themeHelpers';
|
|
3
3
|
import TextField from '../../components/descope-text-field/TextField';
|
|
4
4
|
|
|
5
5
|
const globalRefs = getThemeRefs(globals);
|
|
6
6
|
|
|
7
7
|
const vars = TextField.cssVarList;
|
|
8
8
|
|
|
9
|
-
const textField = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
[vars.padding]: `0 ${globalRefs.spacing.sm}`
|
|
38
|
-
},
|
|
39
|
-
xl: {
|
|
40
|
-
[vars.height]: '50px',
|
|
41
|
-
[vars.fontSize]: '25px',
|
|
42
|
-
[vars.padding]: `0 ${globalRefs.spacing.md}`
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
_fullWidth: {
|
|
47
|
-
[vars.width]: '100%'
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export default textField
|
|
9
|
+
export const textField = (vars) => ({
|
|
10
|
+
size: {
|
|
11
|
+
xs: {
|
|
12
|
+
[vars.height]: '14px',
|
|
13
|
+
[vars.fontSize]: '8px',
|
|
14
|
+
[vars.padding]: `0 ${globalRefs.spacing.xs}`
|
|
15
|
+
},
|
|
16
|
+
sm: {
|
|
17
|
+
[vars.height]: '20px',
|
|
18
|
+
[vars.fontSize]: '10px',
|
|
19
|
+
[vars.padding]: `0 ${globalRefs.spacing.sm}`
|
|
20
|
+
},
|
|
21
|
+
md: {
|
|
22
|
+
[vars.height]: '30px',
|
|
23
|
+
[vars.fontSize]: '14px',
|
|
24
|
+
[vars.padding]: `0 ${globalRefs.spacing.md}`
|
|
25
|
+
},
|
|
26
|
+
lg: {
|
|
27
|
+
[vars.height]: '40px',
|
|
28
|
+
[vars.fontSize]: '16px',
|
|
29
|
+
[vars.padding]: `0 ${globalRefs.spacing.lg}`
|
|
30
|
+
},
|
|
31
|
+
xl: {
|
|
32
|
+
[vars.height]: '50px',
|
|
33
|
+
[vars.fontSize]: '25px',
|
|
34
|
+
[vars.padding]: `0 ${globalRefs.spacing.xl}`
|
|
35
|
+
}
|
|
36
|
+
},
|
|
52
37
|
|
|
38
|
+
[vars.color]: globalRefs.colors.surface.contrast,
|
|
39
|
+
[vars.placeholderColor]: globalRefs.colors.surface.contrast,
|
|
53
40
|
|
|
41
|
+
[vars.backgroundColor]: globalRefs.colors.surface.light,
|
|
42
|
+
|
|
43
|
+
[vars.borderWidth]: '1px',
|
|
44
|
+
[vars.borderStyle]: 'solid',
|
|
45
|
+
[vars.borderColor]: 'transparent',
|
|
46
|
+
[vars.borderWidthReadOnly]: '0',
|
|
47
|
+
[vars.borderRadius]: globalRefs.radius.sm,
|
|
48
|
+
|
|
49
|
+
_borderoffset: {
|
|
50
|
+
[vars.outlineOffset]: '2px'
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
_invalid: {
|
|
54
|
+
[vars.borderColor]: globalRefs.colors.error.main,
|
|
55
|
+
[vars.color]: globalRefs.colors.error.main
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
_disabled: {
|
|
59
|
+
[vars.color]: globalRefs.colors.surface.dark,
|
|
60
|
+
[vars.placeholderColor]: globalRefs.colors.surface.light,
|
|
61
|
+
[vars.backgroundColor]: globalRefs.colors.surface.main
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
_fullWidth: {
|
|
65
|
+
[vars.width]: '100%'
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
_focused: {
|
|
69
|
+
[vars.outline]: `2px solid ${globalRefs.colors.surface.main}`
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
_bordered: {
|
|
73
|
+
[vars.borderColor]: globalRefs.colors.surface.main
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
export default textField(vars);
|
package/src/theme/globals.js
CHANGED
|
@@ -1,32 +1,33 @@
|
|
|
1
|
-
import { genColors } from
|
|
1
|
+
import { genColors } from '../themeHelpers/processColors';
|
|
2
2
|
|
|
3
3
|
export const colors = genColors({
|
|
4
4
|
surface: {
|
|
5
5
|
main: 'lightgray',
|
|
6
|
-
light: '#
|
|
6
|
+
light: '#fff',
|
|
7
|
+
dark: '#000'
|
|
7
8
|
},
|
|
8
|
-
primary:
|
|
9
|
-
secondary:
|
|
10
|
-
success:
|
|
11
|
-
error:
|
|
9
|
+
primary: '#0082B5',
|
|
10
|
+
secondary: '#7D14EB',
|
|
11
|
+
success: 'green',
|
|
12
|
+
error: 'red'
|
|
12
13
|
});
|
|
13
14
|
|
|
14
15
|
const typography = {
|
|
15
16
|
h1: {
|
|
16
|
-
font: [
|
|
17
|
-
weight:
|
|
18
|
-
size:
|
|
17
|
+
font: ['Courier New', 'Arial', 'sans-serif'],
|
|
18
|
+
weight: '700',
|
|
19
|
+
size: '48px'
|
|
19
20
|
},
|
|
20
21
|
h2: {
|
|
21
|
-
font: [
|
|
22
|
-
weight:
|
|
23
|
-
size:
|
|
22
|
+
font: ['Courier New', 'sans-serif'],
|
|
23
|
+
weight: '500',
|
|
24
|
+
size: '38px'
|
|
24
25
|
},
|
|
25
26
|
h3: {
|
|
26
|
-
font: [
|
|
27
|
-
weight:
|
|
28
|
-
size:
|
|
29
|
-
}
|
|
27
|
+
font: ['Courier New', 'sans-serif'],
|
|
28
|
+
weight: '300',
|
|
29
|
+
size: '28px'
|
|
30
|
+
}
|
|
30
31
|
};
|
|
31
32
|
|
|
32
33
|
const spacing = {
|
|
@@ -34,19 +35,19 @@ const spacing = {
|
|
|
34
35
|
sm: '4px',
|
|
35
36
|
md: '8px',
|
|
36
37
|
lg: '16px',
|
|
37
|
-
xl: '32px'
|
|
38
|
+
xl: '32px'
|
|
38
39
|
};
|
|
39
40
|
|
|
40
41
|
const border = {
|
|
41
|
-
sm:
|
|
42
|
-
md:
|
|
43
|
-
lg:
|
|
42
|
+
sm: '1px',
|
|
43
|
+
md: '2px',
|
|
44
|
+
lg: '3px'
|
|
44
45
|
};
|
|
45
46
|
|
|
46
47
|
const radius = {
|
|
47
|
-
sm:
|
|
48
|
-
md:
|
|
49
|
-
lg:
|
|
48
|
+
sm: '5px',
|
|
49
|
+
md: '25px',
|
|
50
|
+
lg: '50px'
|
|
50
51
|
};
|
|
51
52
|
|
|
52
53
|
const shadow = {
|
|
@@ -54,8 +55,8 @@ const shadow = {
|
|
|
54
55
|
size: {
|
|
55
56
|
sm: `0 0 10px`,
|
|
56
57
|
md: `0 0 20px`,
|
|
57
|
-
lg: `0 0 30px
|
|
58
|
-
}
|
|
58
|
+
lg: `0 0 30px`
|
|
59
|
+
}
|
|
59
60
|
};
|
|
60
61
|
|
|
61
62
|
export default {
|
|
@@ -64,5 +65,5 @@ export default {
|
|
|
64
65
|
spacing,
|
|
65
66
|
border,
|
|
66
67
|
radius,
|
|
67
|
-
shadow
|
|
68
|
+
shadow
|
|
68
69
|
};
|
package/src/theme/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import merge from
|
|
2
|
-
import set from
|
|
3
|
-
import { DESCOPE_PREFIX } from
|
|
4
|
-
import { getCssVarName, kebabCase } from
|
|
5
|
-
import { getComponentName } from
|
|
1
|
+
import merge from 'lodash.merge';
|
|
2
|
+
import set from 'lodash.set';
|
|
3
|
+
import { DESCOPE_PREFIX } from '../constants';
|
|
4
|
+
import { getCssVarName, kebabCase } from '../helpers';
|
|
5
|
+
import { getComponentName } from '../componentsHelpers';
|
|
6
6
|
|
|
7
|
-
const getVarName = (path) => getCssVarName(DESCOPE_PREFIX, ...path)
|
|
7
|
+
const getVarName = (path) => getCssVarName(DESCOPE_PREFIX, ...path);
|
|
8
8
|
|
|
9
9
|
const transformTheme = (theme, path, getTransformation) => {
|
|
10
10
|
return Object.entries(theme).reduce((acc, [key, val]) => {
|
|
@@ -16,79 +16,94 @@ const transformTheme = (theme, path, getTransformation) => {
|
|
|
16
16
|
}, {});
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
const stringifyArray = (strArr) =>
|
|
19
|
+
const stringifyArray = (strArr) =>
|
|
20
|
+
strArr.map((str) => (str.includes(' ') ? `"${str}"` : str)).join(', ');
|
|
20
21
|
|
|
21
22
|
export const themeToCSSVarsObj = (theme) =>
|
|
22
23
|
transformTheme(theme, [], (path, val) => ({
|
|
23
|
-
[getVarName(path)]: Array.isArray(val) ? stringifyArray(val) : val
|
|
24
|
+
[getVarName(path)]: Array.isArray(val) ? stringifyArray(val) : val
|
|
24
25
|
}));
|
|
25
26
|
|
|
26
27
|
export const getThemeRefs = (theme, prefix) =>
|
|
27
|
-
transformTheme(theme, [], (path) =>
|
|
28
|
+
transformTheme(theme, [], (path) =>
|
|
29
|
+
set({}, path, `var(${getVarName(prefix ? [prefix, ...path] : path)})`)
|
|
30
|
+
);
|
|
28
31
|
|
|
29
32
|
export const globalsThemeToStyle = (theme, themeName = '') => `
|
|
30
33
|
*[data-theme="${themeName}"] {
|
|
31
34
|
${Object.entries(themeToCSSVarsObj(theme)).reduce(
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
(acc, entry) => (acc += `${entry.join(':')};\n`),
|
|
36
|
+
''
|
|
37
|
+
)}
|
|
34
38
|
}
|
|
35
|
-
|
|
39
|
+
`;
|
|
36
40
|
|
|
37
41
|
const componentsThemeToStyleObj = (componentsTheme) =>
|
|
38
42
|
transformTheme(componentsTheme, [], (path, val) => {
|
|
39
|
-
const [component, ...restPath] = path
|
|
40
|
-
const property = restPath.pop()
|
|
43
|
+
const [component, ...restPath] = path;
|
|
44
|
+
const property = restPath.pop();
|
|
41
45
|
|
|
42
46
|
// do not start with underscore -> key:value, must have 2 no underscore attrs in a row
|
|
43
47
|
// starts with underscore -> attribute selector
|
|
44
48
|
|
|
45
49
|
const attrsSelector = restPath.reduce((acc, section, idx) => {
|
|
46
|
-
if (section.startsWith('_'))
|
|
50
|
+
if (section.startsWith('_'))
|
|
51
|
+
return (acc += `[${kebabCase(section.replace(/^_/, ''))}="true"]`);
|
|
47
52
|
|
|
48
53
|
const nextSection = restPath[idx + 1];
|
|
49
54
|
|
|
50
55
|
if (typeof nextSection !== 'string' || nextSection.startsWith('_')) {
|
|
51
|
-
console.error(
|
|
56
|
+
console.error(
|
|
57
|
+
'theme generator',
|
|
58
|
+
`your theme structure is invalid, attribute "${section}" is followed by "${nextSection}" which is not allowed`
|
|
59
|
+
);
|
|
52
60
|
return acc;
|
|
53
61
|
}
|
|
54
62
|
|
|
55
|
-
return acc += `[${kebabCase(section)}="${restPath
|
|
63
|
+
return (acc += `[${kebabCase(section)}="${restPath
|
|
64
|
+
.splice(idx + 1, 1)
|
|
65
|
+
.join('')}"]`);
|
|
56
66
|
}, '');
|
|
57
67
|
|
|
58
|
-
let selector = `${getComponentName(component)}${attrsSelector}
|
|
68
|
+
let selector = `${getComponentName(component)}${attrsSelector}`;
|
|
59
69
|
|
|
60
70
|
return {
|
|
61
71
|
[selector]: {
|
|
62
72
|
[property]: val
|
|
63
73
|
}
|
|
64
|
-
}
|
|
74
|
+
};
|
|
65
75
|
});
|
|
66
76
|
|
|
67
77
|
export const componentsThemeToStyle = (componentsTheme, themeName = '') =>
|
|
68
78
|
Object.entries(componentsThemeToStyleObj(componentsTheme)).reduce(
|
|
69
|
-
(acc, [selector, vars]) =>
|
|
79
|
+
(acc, [selector, vars]) =>
|
|
80
|
+
(acc += `*[data-theme="${themeName}"] ${selector} { \n${Object.entries(
|
|
81
|
+
vars
|
|
82
|
+
)
|
|
83
|
+
.map(([key, val]) => `${key}: ${val}`)
|
|
84
|
+
.join(';\n')} \n}\n\n`),
|
|
70
85
|
''
|
|
71
86
|
);
|
|
72
87
|
|
|
73
88
|
export const themeToStyle = ({ globals, components }, themeName) => `
|
|
74
89
|
${globalsThemeToStyle(globals, themeName)}
|
|
75
90
|
${componentsThemeToStyle(components, themeName)}
|
|
76
|
-
|
|
91
|
+
`;
|
|
77
92
|
|
|
78
|
-
const useVar = varName => `var(${varName})
|
|
93
|
+
const useVar = (varName) => `var(${varName})`;
|
|
79
94
|
|
|
80
95
|
export const createHelperVars = (theme, prefix) => {
|
|
81
96
|
const res = transformTheme(theme, [], (path, value) => {
|
|
82
97
|
const modifiedPath = [...path];
|
|
83
|
-
const property = modifiedPath.splice(-1)
|
|
84
|
-
const varName = getCssVarName(prefix, property)
|
|
98
|
+
const property = modifiedPath.splice(-1);
|
|
99
|
+
const varName = getCssVarName(prefix, property);
|
|
85
100
|
|
|
86
|
-
const vars = { [property]: varName }
|
|
87
|
-
const theme = set({}, [...modifiedPath, varName], value)
|
|
88
|
-
const useVars = { [property]: useVar(varName) }
|
|
101
|
+
const vars = { [property]: varName };
|
|
102
|
+
const theme = set({}, [...modifiedPath, varName], value);
|
|
103
|
+
const useVars = { [property]: useVar(varName) };
|
|
89
104
|
|
|
90
|
-
return { theme, useVars, vars }
|
|
91
|
-
})
|
|
105
|
+
return { theme, useVars, vars };
|
|
106
|
+
});
|
|
92
107
|
|
|
93
|
-
return [res.theme, res.useVars, res.vars]
|
|
108
|
+
return [res.theme, res.useVars, res.vars];
|
|
94
109
|
};
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import Color from
|
|
1
|
+
import Color from 'color';
|
|
2
2
|
|
|
3
3
|
const genDark = (c, percentage = 0.5) => c.darken(percentage).hex();
|
|
4
4
|
const genLight = (c, percentage = 0.5) => c.lighten(percentage).hex();
|
|
5
5
|
const genContrast = (c, percentage = 0.9) => {
|
|
6
6
|
const isDark = c.isDark();
|
|
7
|
-
return c
|
|
7
|
+
return c
|
|
8
|
+
.mix(Color(isDark ? 'white' : 'black'), percentage)
|
|
9
|
+
.saturate(1)
|
|
10
|
+
.hex();
|
|
8
11
|
};
|
|
9
12
|
|
|
10
13
|
export const genColor = (color) => {
|
|
@@ -14,16 +17,16 @@ export const genColor = (color) => {
|
|
|
14
17
|
main: mainColor.hex(),
|
|
15
18
|
dark: color.dark || genDark(mainColor),
|
|
16
19
|
light: color.light || genLight(mainColor),
|
|
17
|
-
contrast: color.contrast || genContrast(mainColor)
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
+
contrast: color.contrast || genContrast(mainColor)
|
|
21
|
+
};
|
|
22
|
+
};
|
|
20
23
|
|
|
21
24
|
export const genColors = (colors) => {
|
|
22
25
|
return Object.keys(colors).reduce((acc, colorName) => {
|
|
23
26
|
const currentColor = colors[colorName];
|
|
24
27
|
|
|
25
28
|
return Object.assign(acc, {
|
|
26
|
-
[colorName]: genColor(currentColor)
|
|
27
|
-
})
|
|
29
|
+
[colorName]: genColor(currentColor)
|
|
30
|
+
});
|
|
28
31
|
}, {});
|
|
29
32
|
};
|
package/dist/umd/221.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 221.js.LICENSE.txt */
|
|
2
|
-
"use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[221],{6221:(t,e,a)=>{a(3787);var s=a(692),i=a(5128);(0,i.hC)("vaadin-text-field",s.J,{moduleId:"lumo-text-field-styles"}),a(3130);var l=a(4241),r=a(1402),n=a(4463),o=a(2743),d=a(3208),u=a(3690);const p=t=>class extends((0,u.L)(t)){static get properties(){return{autocomplete:{type:String},autocorrect:{type:String},autocapitalize:{type:String,reflectToAttribute:!0}}}static get delegateAttrs(){return[...super.delegateAttrs,"autocapitalize","autocomplete","autocorrect"]}get __data(){return this.__dataValue||{}}set __data(t){this.__dataValue=t}_inputElementChanged(t){super._inputElementChanged(t),t&&(t.value&&t.value!==this.value&&(console.warn(`Please define value on the <${this.localName}> component!`),t.value=""),this.value&&(t.value=this.value))}_setFocused(t){super._setFocused(t),t||this.validate()}_onInput(t){super._onInput(t),this.invalid&&this.validate()}_valueChanged(t,e){super._valueChanged(t,e),void 0!==e&&this.invalid&&this.validate()}};var h=a(6729);const c=t=>class extends(p(t)){static get properties(){return{maxlength:{type:Number},minlength:{type:Number},pattern:{type:String}}}static get delegateAttrs(){return[...super.delegateAttrs,"maxlength","minlength","pattern"]}static get constraints(){return[...super.constraints,"maxlength","minlength","pattern"]}constructor(){super(),this._setType("text")}get clearElement(){return this.$.clearButton}ready(){super.ready(),this.addController(new d.b(this,(t=>{this._setInputElement(t),this._setFocusElement(t),this.stateTarget=t,this.ariaTarget=t}))),this.addController(new h.v(this.inputElement,this._labelController))}};(0,i.hC)("vaadin-text-field",o.J,{moduleId:"vaadin-text-field-styles"});class m extends(c((0,i.Tb)((0,r.S)(l.H3)))){static get is(){return"vaadin-text-field"}static get template(){return l.dy`
|
|
3
|
-
<style>
|
|
4
|
-
[part='input-field'] {
|
|
5
|
-
flex-grow: 0;
|
|
6
|
-
}
|
|
7
|
-
</style>
|
|
8
|
-
|
|
9
|
-
<div class="vaadin-field-container">
|
|
10
|
-
<div part="label">
|
|
11
|
-
<slot name="label"></slot>
|
|
12
|
-
<span part="required-indicator" aria-hidden="true" on-click="focus"></span>
|
|
13
|
-
</div>
|
|
14
|
-
|
|
15
|
-
<vaadin-input-container
|
|
16
|
-
part="input-field"
|
|
17
|
-
readonly="[[readonly]]"
|
|
18
|
-
disabled="[[disabled]]"
|
|
19
|
-
invalid="[[invalid]]"
|
|
20
|
-
theme$="[[_theme]]"
|
|
21
|
-
>
|
|
22
|
-
<slot name="prefix" slot="prefix"></slot>
|
|
23
|
-
<slot name="input"></slot>
|
|
24
|
-
<slot name="suffix" slot="suffix"></slot>
|
|
25
|
-
<div id="clearButton" part="clear-button" slot="suffix" aria-hidden="true"></div>
|
|
26
|
-
</vaadin-input-container>
|
|
27
|
-
|
|
28
|
-
<div part="helper-text">
|
|
29
|
-
<slot name="helper"></slot>
|
|
30
|
-
</div>
|
|
31
|
-
|
|
32
|
-
<div part="error-message">
|
|
33
|
-
<slot name="error-message"></slot>
|
|
34
|
-
</div>
|
|
35
|
-
</div>
|
|
36
|
-
<slot name="tooltip"></slot>
|
|
37
|
-
`}static get properties(){return{maxlength:{type:Number},minlength:{type:Number}}}ready(){super.ready(),this._tooltipController=new n.f(this),this._tooltipController.setPosition("top"),this.addController(this._tooltipController)}}customElements.define(m.is,m)}}]);
|