@descope/web-components-ui 1.0.334 → 1.0.336
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/index.cjs.js +186 -550
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +189 -556
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/4392.js +1 -1
- package/dist/umd/4978.js +1 -1
- package/dist/umd/DescopeDev.js +1 -1
- package/dist/umd/descope-email-field-index-js.js +4 -4
- package/dist/umd/descope-new-password-descope-new-password-internal-index-js.js +1 -1
- package/dist/umd/descope-new-password-index-js.js +1 -1
- package/dist/umd/descope-number-field-index-js.js +1 -1
- package/dist/umd/descope-passcode-index-js.js +1 -1
- package/dist/umd/descope-password-index-js.js +1 -1
- package/dist/umd/descope-radio-group-index-js.js +1 -1
- package/dist/umd/descope-text-field-index-js.js +2 -2
- package/dist/umd/index.js +1 -1
- package/dist/umd/mapping-fields-descope-mappings-field-index-js.js +1 -1
- package/dist/umd/phone-fields-descope-phone-field-descope-phone-field-internal-index-js.js +1 -1
- package/dist/umd/phone-fields-descope-phone-field-index-js.js +1 -1
- package/dist/umd/phone-fields-descope-phone-input-box-field-descope-phone-input-box-internal-index-js.js +2 -2
- package/dist/umd/phone-fields-descope-phone-input-box-field-index-js.js +1 -1
- package/package.json +1 -1
- package/src/components/descope-email-field/EmailFieldClass.js +3 -103
- package/src/components/descope-new-password/NewPasswordClass.js +0 -24
- package/src/components/descope-password/PasswordClass.js +1 -126
- package/src/components/descope-text-field/TextFieldClass.js +51 -29
- package/src/components/descope-text-field/index.js +2 -0
- package/src/components/descope-text-field/textFieldMappings.js +14 -36
- package/src/components/phone-fields/descope-phone-field/PhoneFieldClass.js +2 -11
- package/src/components/phone-fields/descope-phone-field/descope-phone-field-internal/PhoneFieldInternal.js +2 -5
- package/src/components/phone-fields/descope-phone-input-box-field/descope-phone-input-box-internal/PhoneFieldInternalInputBox.js +1 -1
- package/src/mixins/proxyInputMixin.js +2 -5
- package/src/theme/components/comboBox.js +10 -15
- package/src/theme/components/emailField.js +10 -15
- package/src/theme/components/inputWrapper.js +1 -0
- package/src/theme/components/multiSelectComboBox.js +9 -10
- package/src/theme/components/newPassword.js +1 -6
- package/src/theme/components/numberField.js +10 -15
- package/src/theme/components/password.js +9 -14
- package/src/theme/components/phoneField.js +3 -8
- package/src/theme/components/phoneInputBoxField.js +9 -14
- package/src/theme/components/textField.js +16 -15
- package/src/helpers/externalInputs.js +0 -76
@@ -9,10 +9,7 @@ const {
|
|
9
9
|
errorMessage,
|
10
10
|
disabledPlaceholder,
|
11
11
|
inputDisabled,
|
12
|
-
|
13
|
-
externalInputDisabled,
|
14
|
-
externalPlaceholder,
|
15
|
-
externalDisabledPlaceholder,
|
12
|
+
inputIcon,
|
16
13
|
} = {
|
17
14
|
host: { selector: () => ':host' },
|
18
15
|
label: { selector: '::part(label)' },
|
@@ -27,10 +24,7 @@ const {
|
|
27
24
|
inputDisabled: { selector: 'input:disabled' },
|
28
25
|
helperText: { selector: '::part(helper-text)' },
|
29
26
|
errorMessage: { selector: '::part(error-message)' },
|
30
|
-
|
31
|
-
externalInputDisabled: { selector: () => '::slotted(input:disabled)' },
|
32
|
-
externalPlaceholder: { selector: () => '::slotted(input:placeholder-shown)' },
|
33
|
-
externalDisabledPlaceholder: { selector: () => '::slotted(input:disabled::placeholder)' },
|
27
|
+
inputIcon: { selector: 'vaadin-icon' },
|
34
28
|
};
|
35
29
|
|
36
30
|
export default {
|
@@ -60,12 +54,8 @@ export default {
|
|
60
54
|
inputValueTextColor: [
|
61
55
|
{ ...inputField, property: 'color' },
|
62
56
|
{ ...inputDisabled, property: '-webkit-text-fill-color' },
|
63
|
-
{ ...externalInputDisabled, property: '-webkit-text-fill-color' },
|
64
|
-
],
|
65
|
-
inputCaretTextColor: [
|
66
|
-
{ ...input, property: 'color' },
|
67
|
-
{ ...externalInput, property: 'color' },
|
68
57
|
],
|
58
|
+
inputCaretTextColor: [{ ...input, property: 'color' }],
|
69
59
|
|
70
60
|
labelRequiredIndicator: { ...requiredIndicator, property: 'content' },
|
71
61
|
|
@@ -78,8 +68,6 @@ export default {
|
|
78
68
|
inputHorizontalPadding: [
|
79
69
|
{ ...input, property: 'padding-left' },
|
80
70
|
{ ...input, property: 'padding-right' },
|
81
|
-
{ ...externalInput, property: 'padding-left' },
|
82
|
-
{ ...externalInput, property: 'padding-right' },
|
83
71
|
],
|
84
72
|
|
85
73
|
inputOutlineColor: { ...inputField, property: 'outline-color' },
|
@@ -87,17 +75,12 @@ export default {
|
|
87
75
|
inputOutlineWidth: { ...inputField, property: 'outline-width' },
|
88
76
|
inputOutlineOffset: { ...inputField, property: 'outline-offset' },
|
89
77
|
|
90
|
-
inputTextAlign: [
|
91
|
-
{ ...input, property: 'text-align' },
|
92
|
-
{ ...externalInput, property: 'text-align' },
|
93
|
-
],
|
78
|
+
inputTextAlign: [{ ...input, property: 'text-align' }],
|
94
79
|
|
95
80
|
inputPlaceholderColor: [
|
96
81
|
{ selector: () => ':host input:placeholder-shown', property: 'color' },
|
97
82
|
{ ...placeholder, property: 'color' },
|
98
|
-
{ ...externalPlaceholder, property: 'color' },
|
99
83
|
{ ...disabledPlaceholder, property: '-webkit-text-fill-color' },
|
100
|
-
{ ...externalDisabledPlaceholder, property: '-webkit-text-fill-color' },
|
101
84
|
],
|
102
85
|
|
103
86
|
labelPosition: { ...label, property: 'position' },
|
@@ -109,20 +92,15 @@ export default {
|
|
109
92
|
inputTransformY: { ...label, property: 'transform' },
|
110
93
|
inputTransition: { ...label, property: 'transition' },
|
111
94
|
marginInlineStart: { ...label, property: 'margin-inline-start' },
|
112
|
-
placeholderOpacity: [
|
113
|
-
|
114
|
-
|
115
|
-
],
|
116
|
-
|
117
|
-
|
118
|
-
{ ...
|
119
|
-
|
120
|
-
valueInputHeight: [
|
121
|
-
{ ...input, property: 'height' },
|
122
|
-
{ ...externalInput, property: 'height' },
|
123
|
-
],
|
124
|
-
valueInputMarginBottom: [
|
125
|
-
{ ...input, property: 'margin-bottom' },
|
126
|
-
{ ...externalInput, property: 'margin-bottom' },
|
95
|
+
placeholderOpacity: [{ selector: '> input:placeholder-shown', property: 'opacity' }],
|
96
|
+
inputVerticalAlignment: [{ ...inputField, property: 'align-items' }],
|
97
|
+
valueInputHeight: [{ ...input, property: 'height' }],
|
98
|
+
valueInputMarginBottom: [{ ...input, property: 'margin-bottom' }],
|
99
|
+
|
100
|
+
inputIconOffset: [
|
101
|
+
{ ...inputIcon, property: 'margin-right' },
|
102
|
+
{ ...inputIcon, property: 'margin-left' },
|
127
103
|
],
|
104
|
+
inputIconSize: { ...inputIcon, property: 'font-size' },
|
105
|
+
inputIconColor: { ...inputIcon, property: 'color' },
|
128
106
|
};
|
@@ -68,7 +68,6 @@ const {
|
|
68
68
|
inputField,
|
69
69
|
countryCodeInput,
|
70
70
|
phoneInput,
|
71
|
-
phoneExternalInput,
|
72
71
|
separator,
|
73
72
|
errorMessage,
|
74
73
|
helperText,
|
@@ -78,7 +77,6 @@ const {
|
|
78
77
|
requiredIndicator: { selector: '[required]::part(required-indicator)::after' },
|
79
78
|
inputField: { selector: '::part(input-field)' },
|
80
79
|
phoneInput: { selector: () => 'descope-text-field' },
|
81
|
-
phoneExternalInput: { selector: () => '::slotted(input)' },
|
82
80
|
countryCodeInput: { selector: () => 'descope-combo-box' },
|
83
81
|
separator: { selector: 'descope-phone-field-internal .separator' },
|
84
82
|
helperText: { selector: '::part(helper-text)' },
|
@@ -168,17 +166,10 @@ export const PhoneFieldClass = compose(
|
|
168
166
|
inputOutlineWidth: { ...inputField, property: 'outline-width' },
|
169
167
|
inputOutlineOffset: { ...inputField, property: 'outline-offset' },
|
170
168
|
|
171
|
-
valueInputHeight: [
|
172
|
-
|
173
|
-
{ ...countryCodeInput, property: comboVars.valueInputHeight },
|
174
|
-
],
|
175
|
-
valueInputMarginBottom: [
|
176
|
-
{ ...phoneInput, property: textVars.valueInputMarginBottom },
|
177
|
-
{ ...phoneExternalInput, property: 'margin-bottom' },
|
178
|
-
],
|
169
|
+
valueInputHeight: [{ ...countryCodeInput, property: comboVars.valueInputHeight }],
|
170
|
+
valueInputMarginBottom: [{ ...phoneInput, property: textVars.valueInputMarginBottom }],
|
179
171
|
marginInlineStart: [
|
180
172
|
{ ...phoneInput, property: textVars.marginInlineStart },
|
181
|
-
{ ...phoneExternalInput, property: 'margin-inline-start' },
|
182
173
|
{ ...countryCodeInput, property: comboVars.marginInlineStart },
|
183
174
|
],
|
184
175
|
},
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { createBaseInputClass } from '../../../../baseClasses/createBaseInputClass';
|
2
|
-
import { forwardAttrs, getComponentName
|
2
|
+
import { forwardAttrs, getComponentName } from '../../../../helpers/componentHelpers';
|
3
3
|
import CountryCodes from '../../CountryCodes';
|
4
4
|
import { comboBoxItem } from '../helpers';
|
5
5
|
|
@@ -36,7 +36,7 @@ class PhoneFieldInternal extends BaseInputClass {
|
|
36
36
|
${CountryCodes.map((item) => comboBoxItem(item)).join('')}
|
37
37
|
</descope-combo-box>
|
38
38
|
<div class="separator"></div>
|
39
|
-
<descope-text-field type="tel"
|
39
|
+
<descope-text-field type="tel"></descope-text-field>
|
40
40
|
</div>
|
41
41
|
`;
|
42
42
|
|
@@ -47,9 +47,6 @@ class PhoneFieldInternal extends BaseInputClass {
|
|
47
47
|
forwardAttrs(this, this.countryCodeInput, { includeAttrs: ['label-type'] });
|
48
48
|
forwardAttrs(this, this.phoneNumberInput, { includeAttrs: ['label-type'] });
|
49
49
|
|
50
|
-
const externalInput = this.phoneNumberInput.querySelector('input');
|
51
|
-
syncAttrs(this.phoneNumberInput, externalInput, { includeAttrs: ['focused'] });
|
52
|
-
|
53
50
|
// override combo box setter to display dialCode value in input
|
54
51
|
this.countryCodeInput.customValueTransformFn = (val) => {
|
55
52
|
const [, dialCode] = val?.split?.(' ') || [];
|
@@ -42,7 +42,7 @@ const proxyInputMixin =
|
|
42
42
|
({
|
43
43
|
proxyProps = [],
|
44
44
|
// useProxyTargets flag allows to forwardProps to other targets, other than
|
45
|
-
// `this.inputElement`.
|
45
|
+
// `this.inputElement`.
|
46
46
|
// if needed
|
47
47
|
useProxyTargets = false,
|
48
48
|
// allows us to set the event that should trigger validation
|
@@ -171,10 +171,7 @@ const proxyInputMixin =
|
|
171
171
|
|
172
172
|
// sync properties
|
173
173
|
proxyProps.forEach((prop) => {
|
174
|
-
const
|
175
|
-
const proxyTargets = useProxyTargets
|
176
|
-
? [this.baseElement, externalInput].filter(Boolean)
|
177
|
-
: [];
|
174
|
+
const proxyTargets = useProxyTargets ? [this.baseElement].filter(Boolean) : [];
|
178
175
|
forwardProps(this, [this.inputElement, ...proxyTargets], prop);
|
179
176
|
});
|
180
177
|
|
@@ -35,21 +35,16 @@ export const comboBox = {
|
|
35
35
|
[vars.inputDropdownButtonOffset]: globalRefs.spacing.xs,
|
36
36
|
[vars.overlayItemPaddingInlineStart]: globalRefs.spacing.xs,
|
37
37
|
[vars.overlayItemPaddingInlineEnd]: globalRefs.spacing.lg,
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
[vars.inputVerticalAlignment]: refs.inputVerticalAlignment,
|
49
|
-
[vars.valueInputHeight]: refs.valueInputHeight,
|
50
|
-
[vars.valueInputMarginBottom]: refs.valueInputMarginBottom,
|
51
|
-
},
|
52
|
-
},
|
38
|
+
[vars.labelPosition]: refs.labelPosition,
|
39
|
+
[vars.labelTopPosition]: refs.labelTopPosition,
|
40
|
+
[vars.labelHorizontalPosition]: refs.labelHorizontalPosition,
|
41
|
+
[vars.inputTransformY]: refs.inputTransformY,
|
42
|
+
[vars.inputTransition]: refs.inputTransition,
|
43
|
+
[vars.marginInlineStart]: refs.marginInlineStart,
|
44
|
+
[vars.placeholderOpacity]: refs.placeholderOpacity,
|
45
|
+
[vars.inputVerticalAlignment]: refs.inputVerticalAlignment,
|
46
|
+
[vars.valueInputHeight]: refs.valueInputHeight,
|
47
|
+
[vars.valueInputMarginBottom]: refs.valueInputMarginBottom,
|
53
48
|
|
54
49
|
_readonly: {
|
55
50
|
[vars.inputDropdownButtonCursor]: 'default',
|
@@ -27,21 +27,16 @@ const emailField = {
|
|
27
27
|
[vars.inputBackgroundColor]: refs.backgroundColor,
|
28
28
|
[vars.inputHorizontalPadding]: refs.horizontalPadding,
|
29
29
|
[vars.inputHeight]: refs.inputHeight,
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
[vars.inputVerticalAlignment]: refs.inputVerticalAlignment,
|
41
|
-
[vars.valueInputHeight]: refs.valueInputHeight,
|
42
|
-
[vars.valueInputMarginBottom]: refs.valueInputMarginBottom,
|
43
|
-
},
|
44
|
-
},
|
30
|
+
[vars.labelPosition]: refs.labelPosition,
|
31
|
+
[vars.labelTopPosition]: refs.labelTopPosition,
|
32
|
+
[vars.labelHorizontalPosition]: refs.labelHorizontalPosition,
|
33
|
+
[vars.inputTransformY]: refs.inputTransformY,
|
34
|
+
[vars.inputTransition]: refs.inputTransition,
|
35
|
+
[vars.marginInlineStart]: refs.marginInlineStart,
|
36
|
+
[vars.placeholderOpacity]: refs.placeholderOpacity,
|
37
|
+
[vars.inputVerticalAlignment]: refs.inputVerticalAlignment,
|
38
|
+
[vars.valueInputHeight]: refs.valueInputHeight,
|
39
|
+
[vars.valueInputMarginBottom]: refs.valueInputMarginBottom,
|
45
40
|
};
|
46
41
|
|
47
42
|
export default emailField;
|
@@ -39,20 +39,19 @@ export const multiSelectComboBox = {
|
|
39
39
|
[vars.chipFontSize]: refs.chipFontSize,
|
40
40
|
[vars.chipTextColor]: globalRefs.colors.surface.contrast,
|
41
41
|
[vars.chipBackgroundColor]: globalRefs.colors.surface.light,
|
42
|
+
[vars.labelPosition]: refs.labelPosition,
|
43
|
+
[vars.labelTopPosition]: refs.labelTopPosition,
|
44
|
+
[vars.labelLeftPosition]: refs.labelLeftPosition,
|
45
|
+
[vars.labelHorizontalPosition]: refs.labelHorizontalPosition,
|
46
|
+
[vars.inputTransformY]: refs.inputTransformY,
|
47
|
+
[vars.inputTransition]: refs.inputTransition,
|
48
|
+
[vars.marginInlineStart]: refs.marginInlineStart,
|
49
|
+
[vars.placeholderOpacity]: refs.placeholderOpacity,
|
50
|
+
[vars.inputVerticalAlignment]: refs.inputVerticalAlignment,
|
42
51
|
|
43
52
|
labelType: {
|
44
53
|
floating: {
|
45
|
-
[vars.labelPosition]: refs.labelPosition,
|
46
|
-
[vars.labelTopPosition]: refs.labelTopPosition,
|
47
|
-
[vars.labelLeftPosition]: refs.labelLeftPosition,
|
48
|
-
[vars.labelHorizontalPosition]: refs.labelHorizontalPosition,
|
49
|
-
[vars.inputTransformY]: refs.inputTransformY,
|
50
|
-
[vars.inputTransition]: refs.inputTransition,
|
51
|
-
[vars.marginInlineStart]: refs.marginInlineStart,
|
52
|
-
[vars.placeholderOpacity]: refs.placeholderOpacity,
|
53
|
-
[vars.inputVerticalAlignment]: refs.inputVerticalAlignment,
|
54
54
|
[vars.inputHorizontalPadding]: '0.25em',
|
55
|
-
|
56
55
|
_hasValue: {
|
57
56
|
[vars.inputHorizontalPadding]: '0.45em',
|
58
57
|
},
|
@@ -19,12 +19,7 @@ const newPassword = {
|
|
19
19
|
[vars.errorMessageTextColor]: refs.errorMessageTextColor,
|
20
20
|
[vars.policyPreviewBackgroundColor]: 'none',
|
21
21
|
[vars.policyPreviewPadding]: globalRefs.spacing.lg,
|
22
|
-
|
23
|
-
labelType: {
|
24
|
-
floating: {
|
25
|
-
[vars.valueInputHeight]: refs.valueInputHeight,
|
26
|
-
},
|
27
|
-
},
|
22
|
+
[vars.valueInputHeight]: refs.valueInputHeight,
|
28
23
|
|
29
24
|
_required: {
|
30
25
|
// NewPassword doesn't pass `required` attribute to its Password components.
|
@@ -27,21 +27,16 @@ const numberField = {
|
|
27
27
|
[vars.labelRequiredIndicator]: refs.requiredIndicator,
|
28
28
|
[vars.inputHorizontalPadding]: refs.horizontalPadding,
|
29
29
|
[vars.inputHeight]: refs.inputHeight,
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
[vars.inputVerticalAlignment]: refs.inputVerticalAlignment,
|
41
|
-
[vars.valueInputHeight]: refs.valueInputHeight,
|
42
|
-
[vars.valueInputMarginBottom]: refs.valueInputMarginBottom,
|
43
|
-
},
|
44
|
-
},
|
30
|
+
[vars.labelPosition]: refs.labelPosition,
|
31
|
+
[vars.labelTopPosition]: refs.labelTopPosition,
|
32
|
+
[vars.labelHorizontalPosition]: refs.labelHorizontalPosition,
|
33
|
+
[vars.inputTransformY]: refs.inputTransformY,
|
34
|
+
[vars.inputTransition]: refs.inputTransition,
|
35
|
+
[vars.marginInlineStart]: refs.marginInlineStart,
|
36
|
+
[vars.placeholderOpacity]: refs.placeholderOpacity,
|
37
|
+
[vars.inputVerticalAlignment]: refs.inputVerticalAlignment,
|
38
|
+
[vars.valueInputHeight]: refs.valueInputHeight,
|
39
|
+
[vars.valueInputMarginBottom]: refs.valueInputMarginBottom,
|
45
40
|
};
|
46
41
|
|
47
42
|
export default numberField;
|
@@ -33,20 +33,15 @@ const password = {
|
|
33
33
|
[vars.revealButtonOffset]: globalRefs.spacing.md,
|
34
34
|
[vars.revealButtonSize]: refs.toggleButtonSize,
|
35
35
|
[vars.revealButtonColor]: refs.placeholderTextColor,
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
[vars.placeholderOpacity]: refs.placeholderOpacity,
|
46
|
-
[vars.inputVerticalAlignment]: refs.inputVerticalAlignment,
|
47
|
-
[vars.valueInputHeight]: refs.valueInputHeight,
|
48
|
-
},
|
49
|
-
},
|
36
|
+
[vars.labelPosition]: refs.labelPosition,
|
37
|
+
[vars.labelTopPosition]: refs.labelTopPosition,
|
38
|
+
[vars.labelHorizontalPosition]: refs.labelHorizontalPosition,
|
39
|
+
[vars.inputTransformY]: refs.inputTransformY,
|
40
|
+
[vars.inputTransition]: refs.inputTransition,
|
41
|
+
[vars.marginInlineStart]: refs.marginInlineStart,
|
42
|
+
[vars.placeholderOpacity]: refs.placeholderOpacity,
|
43
|
+
[vars.inputVerticalAlignment]: refs.inputVerticalAlignment,
|
44
|
+
[vars.valueInputHeight]: refs.valueInputHeight,
|
50
45
|
};
|
51
46
|
|
52
47
|
export default password;
|
@@ -24,14 +24,9 @@ const phoneField = {
|
|
24
24
|
[vars.phoneInputWidth]: refs.minWidth,
|
25
25
|
[vars.countryCodeInputWidth]: '5em',
|
26
26
|
[vars.countryCodeDropdownWidth]: '20em',
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
[vars.marginInlineStart]: '-0.25em',
|
31
|
-
[vars.valueInputHeight]: '1.65em',
|
32
|
-
[vars.valueInputMarginBottom]: '0.25em',
|
33
|
-
},
|
34
|
-
},
|
27
|
+
[vars.marginInlineStart]: '-0.25em',
|
28
|
+
[vars.valueInputHeight]: refs.valueInputHeight,
|
29
|
+
[vars.valueInputMarginBottom]: refs.valueInputMarginBottom,
|
35
30
|
|
36
31
|
// '@overlay': {
|
37
32
|
// overlayItemBackgroundColor: 'red'
|
@@ -24,20 +24,15 @@ const phoneInputBoxField = {
|
|
24
24
|
[vars.inputOutlineWidth]: refs.outlineWidth,
|
25
25
|
[vars.inputOutlineColor]: refs.outlineColor,
|
26
26
|
[vars.inputOutlineOffset]: refs.outlineOffset,
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
[vars.valueInputHeight]: refs.valueInputHeight,
|
37
|
-
[vars.valueInputMarginBottom]: '0.25em',
|
38
|
-
[vars.inputHorizontalPadding]: '0',
|
39
|
-
},
|
40
|
-
},
|
27
|
+
[vars.labelPosition]: refs.labelPosition,
|
28
|
+
[vars.labelTopPosition]: refs.labelTopPosition,
|
29
|
+
[vars.labelHorizontalPosition]: refs.labelHorizontalPosition,
|
30
|
+
[vars.inputTransformY]: refs.inputTransformY,
|
31
|
+
[vars.inputTransition]: refs.inputTransition,
|
32
|
+
[vars.marginInlineStart]: refs.marginInlineStart,
|
33
|
+
[vars.valueInputHeight]: refs.valueInputHeight,
|
34
|
+
[vars.valueInputMarginBottom]: refs.valueInputMarginBottom,
|
35
|
+
[vars.inputHorizontalPadding]: '0',
|
41
36
|
|
42
37
|
_fullWidth: {
|
43
38
|
[vars.hostWidth]: refs.width,
|
@@ -1,6 +1,9 @@
|
|
1
|
+
import globals from '../globals';
|
2
|
+
import { getThemeRefs } from '../../helpers/themeHelpers';
|
1
3
|
import { TextFieldClass } from '../../components/descope-text-field/TextFieldClass';
|
2
4
|
import { refs } from './inputWrapper';
|
3
5
|
|
6
|
+
const globalRefs = getThemeRefs(globals);
|
4
7
|
const vars = TextFieldClass.cssVarList;
|
5
8
|
|
6
9
|
export const textField = {
|
@@ -33,21 +36,19 @@ export const textField = {
|
|
33
36
|
left: { [vars.inputTextAlign]: 'left' },
|
34
37
|
center: { [vars.inputTextAlign]: 'center' },
|
35
38
|
},
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
},
|
50
|
-
},
|
39
|
+
[vars.labelPosition]: refs.labelPosition,
|
40
|
+
[vars.labelTopPosition]: refs.labelTopPosition,
|
41
|
+
[vars.labelHorizontalPosition]: refs.labelHorizontalPosition,
|
42
|
+
[vars.inputTransformY]: refs.inputTransformY,
|
43
|
+
[vars.inputTransition]: refs.inputTransition,
|
44
|
+
[vars.marginInlineStart]: refs.marginInlineStart,
|
45
|
+
[vars.placeholderOpacity]: refs.placeholderOpacity,
|
46
|
+
[vars.inputVerticalAlignment]: refs.inputVerticalAlignment,
|
47
|
+
[vars.valueInputHeight]: refs.valueInputHeight,
|
48
|
+
[vars.valueInputMarginBottom]: refs.valueInputMarginBottom,
|
49
|
+
[vars.inputIconOffset]: globalRefs.spacing.md,
|
50
|
+
[vars.inputIconSize]: refs.inputIconSize,
|
51
|
+
[vars.inputIconColor]: refs.placeholderTextColor,
|
51
52
|
};
|
52
53
|
|
53
54
|
export default textField;
|
@@ -1,76 +0,0 @@
|
|
1
|
-
// since on load we can only sample the color of the placeholder,
|
2
|
-
// we need to temporarily populate the input in order to sample the value color
|
3
|
-
const getValueColor = (ele, computedStyle) => {
|
4
|
-
// eslint-disable-next-line no-param-reassign
|
5
|
-
ele.value = '_';
|
6
|
-
|
7
|
-
const valueColor = computedStyle.getPropertyValue('color');
|
8
|
-
|
9
|
-
// eslint-disable-next-line no-param-reassign
|
10
|
-
ele.value = '';
|
11
|
-
|
12
|
-
return valueColor;
|
13
|
-
};
|
14
|
-
|
15
|
-
export const createExternalInputSlot = (slotName, targetSlotName) => {
|
16
|
-
const slotEle = document.createElement('slot');
|
17
|
-
|
18
|
-
slotEle.setAttribute('name', slotName);
|
19
|
-
slotEle.setAttribute('slot', targetSlotName);
|
20
|
-
|
21
|
-
return slotEle;
|
22
|
-
};
|
23
|
-
|
24
|
-
export const createExternalInputEle = (targetSlotName, type, autocompleteType) => {
|
25
|
-
const inputEle = document.createElement('input');
|
26
|
-
|
27
|
-
inputEle.setAttribute('slot', targetSlotName);
|
28
|
-
inputEle.setAttribute('type', type);
|
29
|
-
inputEle.setAttribute('data-hidden-input', 'true');
|
30
|
-
inputEle.setAttribute('autocomplete', autocompleteType);
|
31
|
-
|
32
|
-
return inputEle;
|
33
|
-
};
|
34
|
-
|
35
|
-
// We apply the original input's style to the external-input.
|
36
|
-
// Eventually, the user should interact directly with the external input.
|
37
|
-
// We keep the original input
|
38
|
-
export const applyExternalInputStyles = (sourceInputEle, targetInputEle, labelType) => {
|
39
|
-
const computedStyle = getComputedStyle(sourceInputEle);
|
40
|
-
|
41
|
-
// Get minimal set of computed theme properties to set on external input
|
42
|
-
const height = computedStyle.getPropertyValue('height');
|
43
|
-
const paddingLeft = computedStyle.getPropertyValue('padding-left');
|
44
|
-
const paddingRight = computedStyle.getPropertyValue('padding-right');
|
45
|
-
const fontSize = computedStyle.getPropertyValue('font-size');
|
46
|
-
const fontFamily = computedStyle.getPropertyValue('font-family');
|
47
|
-
const letterSpacing = computedStyle.getPropertyValue('letter-spacing');
|
48
|
-
const caretColor = computedStyle.getPropertyValue('caret-color');
|
49
|
-
|
50
|
-
const valueColor = getValueColor(sourceInputEle, computedStyle);
|
51
|
-
|
52
|
-
const commonThemeStyles = [
|
53
|
-
['all', 'unset'],
|
54
|
-
['position', 'absolute'],
|
55
|
-
['background-color', 'transparent'],
|
56
|
-
['height', height],
|
57
|
-
['left', paddingLeft],
|
58
|
-
['right', paddingRight],
|
59
|
-
['font-size', fontSize],
|
60
|
-
['font-family', fontFamily],
|
61
|
-
['letter-spacing', letterSpacing],
|
62
|
-
['width', `calc(100% - ${paddingLeft} - ${paddingRight}`],
|
63
|
-
['caret-color', caretColor], // this is for seeing caret when focusing on external input
|
64
|
-
['color', valueColor],
|
65
|
-
];
|
66
|
-
|
67
|
-
commonThemeStyles.forEach(([key, val]) =>
|
68
|
-
targetInputEle.style.setProperty(key, val, 'important')
|
69
|
-
);
|
70
|
-
|
71
|
-
// Handle floating label theme properties
|
72
|
-
if (labelType === 'floating') {
|
73
|
-
const marginBottom = computedStyle.getPropertyValue('margin-bottom');
|
74
|
-
targetInputEle.style.setProperty('margin-bottom', marginBottom, 'important');
|
75
|
-
}
|
76
|
-
};
|