@descope/web-components-ui 1.0.136 → 1.0.148

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.
Files changed (175) hide show
  1. package/package.json +77 -56
  2. package/src/baseClasses/createBaseClass.js +18 -16
  3. package/src/baseClasses/createBaseInputClass.js +14 -8
  4. package/src/baseClasses/createCssVarImageClass.js +27 -23
  5. package/src/components/boolean-fields/booleanFieldMixin.js +18 -29
  6. package/src/components/boolean-fields/commonStyles.js +1 -1
  7. package/src/components/boolean-fields/descope-boolean-field-internal/BooleanFieldInternal.js +46 -51
  8. package/src/components/boolean-fields/descope-boolean-field-internal/index.js +1 -1
  9. package/src/components/boolean-fields/descope-checkbox/CheckboxClass.js +80 -85
  10. package/src/components/boolean-fields/descope-checkbox/index.js +2 -2
  11. package/src/components/boolean-fields/descope-switch-toggle/SwitchToggleClass.js +88 -95
  12. package/src/components/boolean-fields/descope-switch-toggle/index.js +2 -2
  13. package/src/components/descope-button/ButtonClass.js +57 -47
  14. package/src/components/descope-button/clickableMixin.js +10 -0
  15. package/src/components/descope-combo-box/ComboBoxClass.js +156 -160
  16. package/src/components/descope-container/ContainerClass.js +32 -42
  17. package/src/components/descope-date-picker/index.js +9 -14
  18. package/src/components/descope-divider/DividerClass.js +52 -62
  19. package/src/components/descope-email-field/EmailFieldClass.js +25 -20
  20. package/src/components/descope-image/ImageClass.js +21 -24
  21. package/src/components/descope-link/LinkClass.js +31 -35
  22. package/src/components/descope-loader-linear/LoaderLinearClass.js +31 -36
  23. package/src/components/descope-loader-radial/LoaderRadialClass.js +23 -30
  24. package/src/components/descope-logo/LogoClass.js +5 -1
  25. package/src/components/descope-new-password/NewPasswordClass.js +63 -81
  26. package/src/components/descope-new-password/descope-new-password-internal/NewPasswordInternal.js +157 -162
  27. package/src/components/descope-new-password/descope-new-password-internal/componentName.js +1 -1
  28. package/src/components/descope-new-password/descope-new-password-internal/index.js +3 -3
  29. package/src/components/descope-new-password/index.js +3 -3
  30. package/src/components/descope-number-field/NumberFieldClass.js +25 -20
  31. package/src/components/descope-passcode/PasscodeClass.js +95 -95
  32. package/src/components/descope-passcode/descope-passcode-internal/PasscodeInternal.js +151 -157
  33. package/src/components/descope-passcode/descope-passcode-internal/helpers.js +7 -8
  34. package/src/components/descope-passcode/descope-passcode-internal/index.js +2 -2
  35. package/src/components/descope-passcode/index.js +2 -2
  36. package/src/components/descope-password/PasswordClass.js +75 -83
  37. package/src/components/descope-password/passwordDraggableMixin.js +28 -27
  38. package/src/components/descope-phone-field/CountryCodes.js +1210 -1210
  39. package/src/components/descope-phone-field/PhoneFieldClass.js +139 -141
  40. package/src/components/descope-phone-field/descope-phone-field-internal/PhoneFieldInternal.js +157 -173
  41. package/src/components/descope-phone-field/helpers.js +3 -3
  42. package/src/components/descope-text/TextClass.js +25 -29
  43. package/src/components/descope-text-area/TextAreaClass.js +68 -67
  44. package/src/components/descope-text-field/TextFieldClass.js +42 -37
  45. package/src/components/descope-text-field/textFieldMappings.js +40 -55
  46. package/src/components/descope-totp-image/TotpImageClass.js +5 -1
  47. package/src/components/descope-upload-file/UploadFileClass.js +202 -0
  48. package/src/components/descope-upload-file/helpers.js +11 -0
  49. package/src/components/descope-upload-file/index.js +6 -0
  50. package/src/constants.js +3 -3
  51. package/src/helpers/componentHelpers.js +68 -74
  52. package/src/helpers/index.js +17 -16
  53. package/src/helpers/mixinsHelpers.js +21 -10
  54. package/src/helpers/themeHelpers/colorsHelpers.js +18 -18
  55. package/src/helpers/themeHelpers/componentsThemeManager.js +7 -6
  56. package/src/helpers/themeHelpers/index.js +114 -124
  57. package/src/helpers/themeHelpers/resetHelpers.js +16 -16
  58. package/src/index.cjs.js +3 -3
  59. package/src/index.d.ts +22 -21
  60. package/src/index.js +5 -4
  61. package/src/index.umd.js +14 -13
  62. package/src/mixins/changeMixin.js +18 -17
  63. package/src/mixins/componentNameValidationMixin.js +19 -19
  64. package/src/mixins/createProxy.js +33 -33
  65. package/src/mixins/createStyleMixin/helpers.js +54 -64
  66. package/src/mixins/createStyleMixin/index.js +155 -141
  67. package/src/mixins/draggableMixin.js +61 -61
  68. package/src/mixins/hoverableMixin.js +11 -13
  69. package/src/mixins/index.js +6 -6
  70. package/src/mixins/inputEventsDispatchingMixin.js +61 -60
  71. package/src/mixins/inputValidationMixin.js +153 -148
  72. package/src/mixins/lifecycleEventsMixin.js +17 -15
  73. package/src/mixins/normalizeBooleanAttributesMixin.js +31 -23
  74. package/src/mixins/portalMixin.js +58 -52
  75. package/src/mixins/proxyInputMixin.js +138 -132
  76. package/src/theme/components/button.js +86 -81
  77. package/src/theme/components/checkbox.js +26 -28
  78. package/src/theme/components/comboBox.js +32 -31
  79. package/src/theme/components/container.js +99 -89
  80. package/src/theme/components/divider.js +30 -31
  81. package/src/theme/components/emailField.js +20 -19
  82. package/src/theme/components/image.js +3 -3
  83. package/src/theme/components/index.js +33 -25
  84. package/src/theme/components/inputWrapper.js +28 -25
  85. package/src/theme/components/link.js +29 -36
  86. package/src/theme/components/loader/index.js +3 -3
  87. package/src/theme/components/loader/loaderLinear.js +34 -34
  88. package/src/theme/components/loader/loaderRadial.js +40 -34
  89. package/src/theme/components/logo.js +4 -4
  90. package/src/theme/components/newPassword.js +14 -13
  91. package/src/theme/components/numberField.js +20 -19
  92. package/src/theme/components/passcode.js +20 -22
  93. package/src/theme/components/password.js +22 -21
  94. package/src/theme/components/phoneField.js +23 -23
  95. package/src/theme/components/switchToggle.js +47 -46
  96. package/src/theme/components/text.js +72 -72
  97. package/src/theme/components/textArea.js +27 -25
  98. package/src/theme/components/textField.js +23 -22
  99. package/src/theme/components/totpImage.js +4 -4
  100. package/src/theme/components/uploadFile.js +60 -0
  101. package/src/theme/globals.js +123 -124
  102. package/src/theme/index.js +1 -1
  103. package/dist/cjs/index.cjs.js +0 -5924
  104. package/dist/cjs/index.cjs.js.map +0 -1
  105. package/dist/cjs/package.json +0 -1
  106. package/dist/index.d.ts +0 -51
  107. package/dist/index.esm.js +0 -6606
  108. package/dist/index.esm.js.map +0 -1
  109. package/dist/umd/1018.js +0 -577
  110. package/dist/umd/1018.js.LICENSE.txt +0 -23
  111. package/dist/umd/2481.js +0 -1
  112. package/dist/umd/3208.js +0 -2
  113. package/dist/umd/3208.js.LICENSE.txt +0 -5
  114. package/dist/umd/3585.js +0 -1
  115. package/dist/umd/3878.js +0 -1
  116. package/dist/umd/4201.js +0 -1
  117. package/dist/umd/422.js +0 -2
  118. package/dist/umd/422.js.LICENSE.txt +0 -5
  119. package/dist/umd/4447.js +0 -1
  120. package/dist/umd/4513.js +0 -1
  121. package/dist/umd/4803.js +0 -1
  122. package/dist/umd/541.js +0 -744
  123. package/dist/umd/541.js.LICENSE.txt +0 -21
  124. package/dist/umd/5767.js +0 -2
  125. package/dist/umd/5767.js.LICENSE.txt +0 -15
  126. package/dist/umd/5806.js +0 -109
  127. package/dist/umd/5806.js.LICENSE.txt +0 -5
  128. package/dist/umd/7056.js +0 -48
  129. package/dist/umd/7056.js.LICENSE.txt +0 -5
  130. package/dist/umd/7101.js +0 -148
  131. package/dist/umd/7101.js.LICENSE.txt +0 -11
  132. package/dist/umd/729.js +0 -1
  133. package/dist/umd/7824.js +0 -229
  134. package/dist/umd/7824.js.LICENSE.txt +0 -27
  135. package/dist/umd/7840.js +0 -356
  136. package/dist/umd/7840.js.LICENSE.txt +0 -61
  137. package/dist/umd/8725.js +0 -37
  138. package/dist/umd/8725.js.LICENSE.txt +0 -11
  139. package/dist/umd/9211.js +0 -312
  140. package/dist/umd/9211.js.LICENSE.txt +0 -5
  141. package/dist/umd/9241.js +0 -1
  142. package/dist/umd/9314.js +0 -283
  143. package/dist/umd/9314.js.LICENSE.txt +0 -27
  144. package/dist/umd/9437.js +0 -19
  145. package/dist/umd/9437.js.LICENSE.txt +0 -5
  146. package/dist/umd/9515.js +0 -202
  147. package/dist/umd/9515.js.LICENSE.txt +0 -11
  148. package/dist/umd/9789.js +0 -1
  149. package/dist/umd/boolean-fields-descope-boolean-field-internal-index-js.js +0 -1
  150. package/dist/umd/boolean-fields-descope-checkbox-index-js.js +0 -1
  151. package/dist/umd/boolean-fields-descope-switch-toggle-index-js.js +0 -1
  152. package/dist/umd/descope-button-index-js.js +0 -1
  153. package/dist/umd/descope-combo-box-index-js.js +0 -1
  154. package/dist/umd/descope-container-index-js.js +0 -1
  155. package/dist/umd/descope-date-picker-index-js.js +0 -1
  156. package/dist/umd/descope-divider-index-js.js +0 -1
  157. package/dist/umd/descope-email-field-index-js.js +0 -1
  158. package/dist/umd/descope-image-index-js.js +0 -1
  159. package/dist/umd/descope-link-index-js.js +0 -1
  160. package/dist/umd/descope-loader-linear-index-js.js +0 -1
  161. package/dist/umd/descope-loader-radial-index-js.js +0 -1
  162. package/dist/umd/descope-logo-index-js.js +0 -1
  163. package/dist/umd/descope-new-password-descope-new-password-internal-index-js.js +0 -1
  164. package/dist/umd/descope-new-password-index-js.js +0 -1
  165. package/dist/umd/descope-number-field-index-js.js +0 -1
  166. package/dist/umd/descope-passcode-descope-passcode-internal-index-js.js +0 -1
  167. package/dist/umd/descope-passcode-index-js.js +0 -1
  168. package/dist/umd/descope-password-index-js.js +0 -1
  169. package/dist/umd/descope-phone-field-descope-phone-field-internal-index-js.js +0 -1
  170. package/dist/umd/descope-phone-field-index-js.js +0 -1
  171. package/dist/umd/descope-text-area-index-js.js +0 -1
  172. package/dist/umd/descope-text-field-index-js.js +0 -1
  173. package/dist/umd/descope-text-index-js.js +0 -1
  174. package/dist/umd/descope-totp-image-index-js.js +0 -1
  175. package/dist/umd/index.js +0 -1
@@ -5,200 +5,184 @@ import { comboBoxItem } from '../helpers';
5
5
 
6
6
  export const componentName = getComponentName('phone-field-internal');
7
7
 
8
- const commonAttrs = [
9
- 'disabled',
10
- 'size',
11
- 'bordered',
12
- 'invalid',
13
- 'readonly',
14
- ];
8
+ const commonAttrs = ['disabled', 'size', 'bordered', 'invalid', 'readonly'];
15
9
  const countryAttrs = ['country-input-placeholder', 'default-code'];
16
10
  const phoneAttrs = ['phone-input-placeholder', 'maxlength'];
17
11
  const mapAttrs = {
18
- 'country-input-placeholder': 'placeholder',
19
- 'phone-input-placeholder': 'placeholder',
20
- }
12
+ 'country-input-placeholder': 'placeholder',
13
+ 'phone-input-placeholder': 'placeholder',
14
+ };
21
15
 
22
16
  const inputRelatedAttrs = [].concat(commonAttrs, countryAttrs, phoneAttrs);
23
17
 
24
18
  const BaseInputClass = createBaseInputClass({ componentName, baseSelector: 'div' });
25
19
 
26
20
  class PhoneFieldInternal extends BaseInputClass {
27
- static get observedAttributes() {
28
- return [].concat(
29
- BaseInputClass.observedAttributes || [],
30
- inputRelatedAttrs,
31
- );
32
- }
21
+ static get observedAttributes() {
22
+ return [].concat(BaseInputClass.observedAttributes || [], inputRelatedAttrs);
23
+ }
33
24
 
34
- constructor() {
35
- super();
25
+ constructor() {
26
+ super();
36
27
 
37
- this.innerHTML = `
28
+ this.innerHTML = `
38
29
  <div>
39
30
  <descope-combo-box
40
31
  item-label-path="data-name"
41
32
  item-value-path="data-id"
42
33
  >
43
- ${CountryCodes.map(item => comboBoxItem(item)).join('')}
34
+ ${CountryCodes.map((item) => comboBoxItem(item)).join('')}
44
35
  </descope-combo-box>
45
36
  <div class="separator"></div>
46
37
  <descope-text-field type="tel"></descope-text-field>
47
38
  </div>`;
48
39
 
49
- this.countryCodeInput = this.querySelector('descope-combo-box');
50
- this.phoneNumberInput = this.querySelector('descope-text-field');
51
- this.inputs = [
52
- this.countryCodeInput,
53
- this.phoneNumberInput
54
- ];
55
- }
56
-
57
- get value() {
58
- return this.inputs.map(({ value }) => value).join('-');
59
- }
60
-
61
- set value(val) {
62
- const [countryCode = '', phoneNumber = ''] = val.split('-');
63
- const countryCodeItem = this.getCountryByDialCode(countryCode);
64
- if (countryCodeItem) {
65
- this.countryCodeInput.selectedItem = countryCodeItem;
66
- }
67
- this.phoneNumberInput.value = phoneNumber;
68
- }
69
-
70
- get phoneNumberValue() {
71
- return this.phoneNumberInput.value;
72
- }
73
-
74
- get countryCodeValue() {
75
- return this.countryCodeInput.shadowRoot.querySelector('input').value;
76
- }
77
-
78
- get minLength() {
79
- return parseInt(this.getAttribute('minlength'), 10) || 0;
80
- }
81
-
82
- getValidity() {
83
- const hasCode = this.countryCodeInput.value;
84
- const hasPhone = this.phoneNumberInput.value;
85
- const emptyValue = !hasCode || !hasPhone;
86
- const hasMinPhoneLength = this.phoneNumberInput.value.length && this.phoneNumberInput.value.length < this.minLength;
87
-
88
- if (this.isRequired && emptyValue) {
89
- return { valueMissing: true };
90
- }
91
- if (hasMinPhoneLength) {
92
- return { tooShort: true };
93
- }
94
- if ((hasCode && !hasPhone) || (!hasCode && hasPhone)) {
95
- return { valueMissing: true };
96
- }
97
- return {}
98
- };
99
-
100
- init() {
101
- this.addEventListener('focus', (e) => {
102
- // we want to ignore focus events we are dispatching
103
- if (e.isTrusted)
104
- this.inputs[0].focus()
105
- })
106
-
107
- super.init?.();
108
- this.initInputs();
109
- this.setComboBoxDescriptor();
110
- }
111
-
112
- getCountryByDialCode(countryDialCode) {
113
- return this.countryCodeInput.items.find(c => c.getAttribute('data-dial-code') === countryDialCode);
114
- }
115
-
116
- getCountryByCodeId(countryCode) {
117
- return this.countryCodeInput.items.find(c => c['data-id'] === countryCode)?.['data-name'];
118
- }
119
-
120
- handleDefaultCountryCode(countryCode) {
121
- if (!this.countryCodeInput.value) {
122
- const countryCodeItem = this.getCountryByCodeId(countryCode);
123
- // When replacing the input component (inserting internal component into text-field) -
124
- // Vaadin resets the input's value. We use setTimeout in order to make sure this happens
125
- // after the reset.
126
- if (countryCodeItem) {
127
- setTimeout(() => {
128
- this.countryCodeInput.selectedItem = countryCodeItem;
129
- });
130
- }
131
- }
132
- }
133
-
134
- // We want to override Vaadin's Combo Box value setter. This is needed since Vaadin couples between the
135
- // field that it searches the value, and the finaly display value of the input. We want to search ALL
136
- // the values (so we made a field with all the values), but display ONLY the dial code, so we added
137
- // this setter, which does that.
138
- setComboBoxDescriptor() {
139
- const comboBox = this.countryCodeInput;
140
- const input = comboBox.shadowRoot.querySelector('input');
141
- const valueDescriptor = Object.getOwnPropertyDescriptor(
142
- input.constructor.prototype,
143
- 'value'
144
- );
145
- Object.defineProperties(input, {
146
- value: {
147
- ...valueDescriptor,
148
- set(val) {
149
- if (!comboBox.items?.length) {
150
- return;
151
- }
152
-
153
- const [_code, dialCode] = val.split(' ');
154
-
155
- if (val === this.value) {
156
- return;
157
- }
158
-
159
- valueDescriptor.set.call(this, dialCode || '');
160
- }
161
- }
162
- });
163
- }
164
-
165
- initInputs() {
166
- // Sanitize phone input value to filter everything but digits
167
- this.phoneNumberInput.addEventListener('input', (e) => {
168
- const telDigitsRegExp = /^\d$/;
169
- const sanitizedInput = e.target.value
170
- .split('')
171
- .filter(char => telDigitsRegExp.test(char))
172
- .join('');
173
- e.target.value = sanitizedInput;
174
- });
175
-
176
- this.handleFocusEventsDispatching(this.inputs)
177
- this.handleInputEventDispatching()
178
- }
179
-
180
- attributeChangedCallback(attrName, oldValue, newValue) {
181
- super.attributeChangedCallback(attrName, oldValue, newValue);
182
-
183
- if (oldValue !== newValue) {
184
- if (attrName === 'default-code' && newValue) {
185
- this.handleDefaultCountryCode(newValue);
186
- }
187
- else if (inputRelatedAttrs.includes(attrName)) {
188
- const attr = mapAttrs[attrName] || attrName;
189
-
190
- if (commonAttrs.includes(attrName)) {
191
- this.inputs.forEach(input => input.setAttribute(attr, newValue));
192
- }
193
- else if (countryAttrs.includes(attrName)) {
194
- this.countryCodeInput.setAttribute(attr, newValue);
195
- }
196
- else if (phoneAttrs.includes(attrName)) {
197
- this.phoneNumberInput.setAttribute(attr, newValue);
198
- }
199
- }
200
- }
201
- }
40
+ this.countryCodeInput = this.querySelector('descope-combo-box');
41
+ this.phoneNumberInput = this.querySelector('descope-text-field');
42
+ this.inputs = [this.countryCodeInput, this.phoneNumberInput];
43
+ }
44
+
45
+ get value() {
46
+ return this.inputs.map(({ value }) => value).join('-');
47
+ }
48
+
49
+ set value(val) {
50
+ const [countryCode = '', phoneNumber = ''] = val.split('-');
51
+ const countryCodeItem = this.getCountryByDialCode(countryCode);
52
+ if (countryCodeItem) {
53
+ this.countryCodeInput.selectedItem = countryCodeItem;
54
+ }
55
+ this.phoneNumberInput.value = phoneNumber;
56
+ }
57
+
58
+ get phoneNumberValue() {
59
+ return this.phoneNumberInput.value;
60
+ }
61
+
62
+ get countryCodeValue() {
63
+ return this.countryCodeInput.shadowRoot.querySelector('input').value;
64
+ }
65
+
66
+ get minLength() {
67
+ return parseInt(this.getAttribute('minlength'), 10) || 0;
68
+ }
69
+
70
+ getValidity() {
71
+ const hasCode = this.countryCodeInput.value;
72
+ const hasPhone = this.phoneNumberInput.value;
73
+ const emptyValue = !hasCode || !hasPhone;
74
+ const hasMinPhoneLength =
75
+ this.phoneNumberInput.value.length && this.phoneNumberInput.value.length < this.minLength;
76
+
77
+ if (this.isRequired && emptyValue) {
78
+ return { valueMissing: true };
79
+ }
80
+ if (hasMinPhoneLength) {
81
+ return { tooShort: true };
82
+ }
83
+ if ((hasCode && !hasPhone) || (!hasCode && hasPhone)) {
84
+ return { valueMissing: true };
85
+ }
86
+ return {};
87
+ }
88
+
89
+ init() {
90
+ this.addEventListener('focus', (e) => {
91
+ // we want to ignore focus events we are dispatching
92
+ if (e.isTrusted) this.inputs[0].focus();
93
+ });
94
+
95
+ super.init?.();
96
+ this.initInputs();
97
+ this.setComboBoxDescriptor();
98
+ }
99
+
100
+ getCountryByDialCode(countryDialCode) {
101
+ return this.countryCodeInput.items.find(
102
+ (c) => c.getAttribute('data-dial-code') === countryDialCode
103
+ );
104
+ }
105
+
106
+ getCountryByCodeId(countryCode) {
107
+ return this.countryCodeInput.items.find((c) => c['data-id'] === countryCode)?.['data-name'];
108
+ }
109
+
110
+ handleDefaultCountryCode(countryCode) {
111
+ if (!this.countryCodeInput.value) {
112
+ const countryCodeItem = this.getCountryByCodeId(countryCode);
113
+ // When replacing the input component (inserting internal component into text-field) -
114
+ // Vaadin resets the input's value. We use setTimeout in order to make sure this happens
115
+ // after the reset.
116
+ if (countryCodeItem) {
117
+ setTimeout(() => {
118
+ this.countryCodeInput.selectedItem = countryCodeItem;
119
+ });
120
+ }
121
+ }
122
+ }
123
+
124
+ // We want to override Vaadin's Combo Box value setter. This is needed since Vaadin couples between the
125
+ // field that it searches the value, and the finaly display value of the input. We want to search ALL
126
+ // the values (so we made a field with all the values), but display ONLY the dial code, so we added
127
+ // this setter, which does that.
128
+ setComboBoxDescriptor() {
129
+ const comboBox = this.countryCodeInput;
130
+ const input = comboBox.shadowRoot.querySelector('input');
131
+ const valueDescriptor = Object.getOwnPropertyDescriptor(input.constructor.prototype, 'value');
132
+ Object.defineProperties(input, {
133
+ value: {
134
+ ...valueDescriptor,
135
+ set(val) {
136
+ if (!comboBox.items?.length) {
137
+ return;
138
+ }
139
+
140
+ const [, dialCode] = val.split(' ');
141
+
142
+ if (val === this.value) {
143
+ return;
144
+ }
145
+
146
+ valueDescriptor.set.call(this, dialCode || '');
147
+ },
148
+ },
149
+ });
150
+ }
151
+
152
+ initInputs() {
153
+ // Sanitize phone input value to filter everything but digits
154
+ this.phoneNumberInput.addEventListener('input', (e) => {
155
+ const telDigitsRegExp = /^\d$/;
156
+ const sanitizedInput = e.target.value
157
+ .split('')
158
+ .filter((char) => telDigitsRegExp.test(char))
159
+ .join('');
160
+ e.target.value = sanitizedInput;
161
+ });
162
+
163
+ this.handleFocusEventsDispatching(this.inputs);
164
+ this.handleInputEventDispatching();
165
+ }
166
+
167
+ attributeChangedCallback(attrName, oldValue, newValue) {
168
+ super.attributeChangedCallback(attrName, oldValue, newValue);
169
+
170
+ if (oldValue !== newValue) {
171
+ if (attrName === 'default-code' && newValue) {
172
+ this.handleDefaultCountryCode(newValue);
173
+ } else if (inputRelatedAttrs.includes(attrName)) {
174
+ const attr = mapAttrs[attrName] || attrName;
175
+
176
+ if (commonAttrs.includes(attrName)) {
177
+ this.inputs.forEach((input) => input.setAttribute(attr, newValue));
178
+ } else if (countryAttrs.includes(attrName)) {
179
+ this.countryCodeInput.setAttribute(attr, newValue);
180
+ } else if (phoneAttrs.includes(attrName)) {
181
+ this.phoneNumberInput.setAttribute(attr, newValue);
182
+ }
183
+ }
184
+ }
185
+ }
202
186
  }
203
187
 
204
188
  export default PhoneFieldInternal;
@@ -1,9 +1,9 @@
1
1
  // We use JSDelivr in order to fetch the images as image file from this library (svg-country-flags)
2
2
  // This reduces our bundle size, and we use it as a static remote resource.
3
3
  export const getCountryFlag = (code) =>
4
- `https://cdn.jsdelivr.net/npm/svg-country-flags@1.2.10/svg/${code.toLowerCase()}.svg`;
4
+ `https://cdn.jsdelivr.net/npm/svg-country-flags@1.2.10/svg/${code.toLowerCase()}.svg`;
5
5
 
6
- export const comboBoxItem = ({ code, dialCode, name: country }) => (`
6
+ export const comboBoxItem = ({ code, dialCode, name: country }) => `
7
7
  <div
8
8
  style="display:flex; flex-direction: column;"
9
9
  data-id="${code}"
@@ -21,4 +21,4 @@ export const comboBoxItem = ({ code, dialCode, name: country }) => (`
21
21
  <span>${dialCode}</span>
22
22
  </div>
23
23
  </div>
24
- `);
24
+ `;
@@ -1,8 +1,4 @@
1
- import {
2
- createStyleMixin,
3
- draggableMixin,
4
- componentNameValidationMixin
5
- } from '../../mixins';
1
+ import { createStyleMixin, draggableMixin, componentNameValidationMixin } from '../../mixins';
6
2
  import { createBaseClass } from '../../baseClasses/createBaseClass';
7
3
  import { compose } from '../../helpers';
8
4
  import { getComponentName } from '../../helpers/componentHelpers';
@@ -10,10 +6,10 @@ import { getComponentName } from '../../helpers/componentHelpers';
10
6
  export const componentName = getComponentName('text');
11
7
 
12
8
  class RawText extends createBaseClass({ componentName, baseSelector: ':host > slot' }) {
13
- constructor() {
14
- super();
9
+ constructor() {
10
+ super();
15
11
 
16
- this.attachShadow({ mode: 'open' }).innerHTML = `
12
+ this.attachShadow({ mode: 'open' }).innerHTML = `
17
13
  <style>
18
14
  :host {
19
15
  display: inline-block;
@@ -25,28 +21,28 @@ class RawText extends createBaseClass({ componentName, baseSelector: ':host > sl
25
21
  </style>
26
22
  <slot></slot>
27
23
  `;
28
- }
24
+ }
29
25
  }
30
26
 
31
27
  export const TextClass = compose(
32
- createStyleMixin({
33
- mappings: {
34
- hostWidth: { selector: () => ':host', property: 'width' },
35
- fontSize: {},
36
- textColor: { property: 'color' },
37
- textLineHeight: { property: 'line-height' },
38
- textLetterSpacing: { property: 'letter-spacing' },
39
- textShadow: {},
40
- textAlign: {},
41
- textTransform: {},
42
- fontFamily: {},
43
- fontStyle: {},
44
- fontWeight: {},
45
- borderWidth: {},
46
- borderStyle: {},
47
- borderColor: {},
48
- },
49
- }),
50
- draggableMixin,
51
- componentNameValidationMixin
28
+ createStyleMixin({
29
+ mappings: {
30
+ hostWidth: { selector: () => ':host', property: 'width' },
31
+ fontSize: {},
32
+ textColor: { property: 'color' },
33
+ textLineHeight: { property: 'line-height' },
34
+ textLetterSpacing: { property: 'letter-spacing' },
35
+ textShadow: {},
36
+ textAlign: {},
37
+ textTransform: {},
38
+ fontFamily: {},
39
+ fontStyle: {},
40
+ fontWeight: {},
41
+ borderWidth: {},
42
+ borderStyle: {},
43
+ borderColor: {},
44
+ },
45
+ }),
46
+ draggableMixin,
47
+ componentNameValidationMixin
52
48
  )(RawText);
@@ -1,91 +1,92 @@
1
1
  import {
2
- createStyleMixin,
3
- draggableMixin,
4
- createProxy,
5
- proxyInputMixin,
6
- componentNameValidationMixin
2
+ createStyleMixin,
3
+ draggableMixin,
4
+ createProxy,
5
+ proxyInputMixin,
6
+ componentNameValidationMixin,
7
7
  } from '../../mixins';
8
8
  import { compose } from '../../helpers';
9
9
  import { getComponentName } from '../../helpers/componentHelpers';
10
- import { resetInputContainer, resetInputCursor, resetInputField, resetInputPlaceholder, useHostExternalPadding } from '../../helpers/themeHelpers/resetHelpers';
10
+ import {
11
+ resetInputContainer,
12
+ resetInputCursor,
13
+ resetInputField,
14
+ resetInputPlaceholder,
15
+ useHostExternalPadding,
16
+ } from '../../helpers/themeHelpers/resetHelpers';
11
17
 
12
18
  export const componentName = getComponentName('text-area');
13
19
 
14
20
  const {
15
- host,
16
- label,
17
- placeholder,
18
- inputField,
19
- textArea,
20
- requiredIndicator,
21
- helperText,
22
- errorMessage
21
+ host,
22
+ label,
23
+ placeholder,
24
+ inputField,
25
+ textArea,
26
+ requiredIndicator,
27
+ helperText,
28
+ errorMessage,
23
29
  } = {
24
- host: { selector: () => ':host' },
25
- label: { selector: '::part(label)' },
26
- placeholder: { selector: 'textarea:placeholder-shown' },
27
- inputField: { selector: '::part(input-field)' },
28
- textArea: { selector: '> textarea' },
29
- requiredIndicator: { selector: '[required]::part(required-indicator)::after' },
30
- helperText: { selector: '::part(helper-text)' },
31
- errorMessage: { selector: '::part(error-message)' }
30
+ host: { selector: () => ':host' },
31
+ label: { selector: '::part(label)' },
32
+ placeholder: { selector: 'textarea:placeholder-shown' },
33
+ inputField: { selector: '::part(input-field)' },
34
+ textArea: { selector: '> textarea' },
35
+ requiredIndicator: { selector: '[required]::part(required-indicator)::after' },
36
+ helperText: { selector: '::part(helper-text)' },
37
+ errorMessage: { selector: '::part(error-message)' },
32
38
  };
33
39
 
34
40
  export const TextAreaClass = compose(
35
- createStyleMixin({
36
- mappings: {
37
- hostWidth: { ...host, property: 'width' },
38
- hostMinWidth: { ...host, property: 'min-width' },
39
- fontSize: [
40
- host,
41
- textArea,
42
- ],
43
- fontFamily: [
44
- label,
45
- inputField,
46
- helperText,
47
- errorMessage,
48
- ],
49
- labelTextColor: [
50
- { ...label, property: 'color' },
51
- { ...requiredIndicator, property: 'color' }
52
- ],
53
- labelRequiredIndicator: { ...requiredIndicator, property: 'content' },
54
- inputBackgroundColor: { ...inputField, property: 'background-color' },
55
- inputValueTextColor: { ...textArea, property: 'color' },
56
- inputPlaceholderTextColor: { ...placeholder, property: 'color' },
57
- inputBorderWidth: { ...inputField, property: 'border-width' },
58
- inputBorderStyle: { ...inputField, property: 'border-style' },
59
- inputBorderColor: { ...inputField, property: 'border-color' },
60
- inputBorderRadius: { ...inputField, property: 'border-radius' },
61
- inputOutlineStyle: { ...inputField, property: 'outline-Style' },
62
- inputOutlineColor: { ...inputField, property: 'outline-color' },
63
- inputOutlineOffset: { ...inputField, property: 'outline-offset' },
64
- inputOutlineWidth: { ...inputField, property: 'outline-width' },
65
- inputResizeType: { ...textArea, property: 'resize' },
66
- }
67
- }),
68
- draggableMixin,
69
- proxyInputMixin,
70
- componentNameValidationMixin
41
+ createStyleMixin({
42
+ mappings: {
43
+ hostWidth: { ...host, property: 'width' },
44
+ hostMinWidth: { ...host, property: 'min-width' },
45
+ fontSize: [host, textArea],
46
+ fontFamily: [label, inputField, helperText, errorMessage],
47
+ labelTextColor: [
48
+ { ...label, property: 'color' },
49
+ { ...requiredIndicator, property: 'color' },
50
+ ],
51
+ labelRequiredIndicator: { ...requiredIndicator, property: 'content' },
52
+ errorMessageTextColor: { ...errorMessage, property: 'color' },
53
+ inputBackgroundColor: { ...inputField, property: 'background-color' },
54
+ inputValueTextColor: { ...textArea, property: 'color' },
55
+ inputPlaceholderTextColor: { ...placeholder, property: 'color' },
56
+ inputBorderWidth: { ...inputField, property: 'border-width' },
57
+ inputBorderStyle: { ...inputField, property: 'border-style' },
58
+ inputBorderColor: { ...inputField, property: 'border-color' },
59
+ inputBorderRadius: { ...inputField, property: 'border-radius' },
60
+ inputOutlineStyle: { ...inputField, property: 'outline-Style' },
61
+ inputOutlineColor: { ...inputField, property: 'outline-color' },
62
+ inputOutlineOffset: { ...inputField, property: 'outline-offset' },
63
+ inputOutlineWidth: { ...inputField, property: 'outline-width' },
64
+ inputResizeType: { ...textArea, property: 'resize' },
65
+ inputMinHeight: { ...textArea, property: 'min-height' },
66
+ },
67
+ }),
68
+ draggableMixin,
69
+ proxyInputMixin,
70
+ componentNameValidationMixin
71
71
  )(
72
- createProxy({
73
- slots: [],
74
- wrappedEleName: 'vaadin-text-area',
75
- style: () => `
72
+ createProxy({
73
+ slots: [],
74
+ wrappedEleName: 'vaadin-text-area',
75
+ style: () => `
76
76
  :host {
77
77
  display: inline-block;
78
78
  max-width: 100%;
79
79
  }
80
+ textarea {
81
+ height: 100%;
82
+ }
80
83
  ${useHostExternalPadding(TextAreaClass.cssVarList)}
81
84
  ${resetInputContainer('vaadin-text-area')}
82
85
  ${resetInputField('vaadin-text-area')}
83
86
  ${resetInputPlaceholder('vaadin-text-area', 'textarea')}
84
87
  ${resetInputCursor('vaadin-text-area')}
85
88
  `,
86
- excludeAttrsSync: ['tabindex'],
87
- componentName
88
- })
89
+ excludeAttrsSync: ['tabindex'],
90
+ componentName,
91
+ })
89
92
  );
90
-
91
-