@descope/web-components-ui 1.0.74 → 1.0.76

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 (38) hide show
  1. package/dist/index.esm.js +2550 -632
  2. package/dist/index.esm.js.map +1 -1
  3. package/dist/umd/447.js +1 -1
  4. package/dist/umd/744.js +1 -1
  5. package/dist/umd/878.js +1 -0
  6. package/dist/umd/descope-combo-box-index-js.js +1 -1
  7. package/dist/umd/descope-passcode-descope-passcode-internal-index-js.js +1 -1
  8. package/dist/umd/descope-passcode-index-js.js +1 -1
  9. package/dist/umd/descope-phone-field-descope-phone-field-internal-index-js.js +1 -0
  10. package/dist/umd/descope-phone-field-index-js.js +1 -0
  11. package/dist/umd/descope-text-area-index-js.js +1 -1
  12. package/dist/umd/descope-text-field-index-js.js +1 -1
  13. package/dist/umd/index.js +1 -1
  14. package/package.json +1 -1
  15. package/src/components/descope-combo-box/ComboBox.js +85 -50
  16. package/src/components/descope-passcode/Passcode.js +43 -12
  17. package/src/components/descope-passcode/descope-passcode-internal/PasscodeInternal.js +32 -14
  18. package/src/components/descope-phone-field/CountryCodes.js +1212 -0
  19. package/src/components/descope-phone-field/PhoneField.js +186 -0
  20. package/src/components/descope-phone-field/descope-phone-field-internal/PhoneFieldInternal.js +213 -0
  21. package/src/components/descope-phone-field/descope-phone-field-internal/index.js +6 -0
  22. package/src/components/descope-phone-field/helpers.js +23 -0
  23. package/src/components/descope-phone-field/index.js +9 -0
  24. package/src/components/descope-text-area/TextArea.js +3 -1
  25. package/src/components/descope-text-field/TextField.js +38 -3
  26. package/src/components/descope-text-field/textFieldMappings.js +22 -14
  27. package/src/index.js +1 -0
  28. package/src/mixins/inputValidationMixin.js +21 -2
  29. package/src/mixins/normalizeBooleanAttributesMixin.js +16 -7
  30. package/src/mixins/portalMixin.js +8 -3
  31. package/src/mixins/proxyInputMixin.js +1 -1
  32. package/src/theme/components/button.js +0 -3
  33. package/src/theme/components/comboBox.js +39 -9
  34. package/src/theme/components/index.js +3 -1
  35. package/src/theme/components/passcode.js +36 -3
  36. package/src/theme/components/phoneField.js +74 -0
  37. package/src/theme/components/textArea.js +5 -2
  38. package/src/theme/components/textField.js +6 -3
@@ -1,11 +1,15 @@
1
1
  import { createBaseInputClass } from '../../../baseClasses/createBaseInputClass';
2
- import { getComponentName } from '../../../helpers/componentHelpers';
2
+ import { forwardAttrs, getComponentName } from '../../../helpers/componentHelpers';
3
3
  import { createDispatchEvent } from '../../../helpers/mixinsHelpers';
4
4
  import { getSanitizedCharacters, focusElement } from './helpers';
5
5
 
6
6
  export const componentName = getComponentName('passcode-internal');
7
7
 
8
8
  const observedAttributes = [
9
+ 'digits'
10
+ ]
11
+
12
+ const forwardAttributes = [
9
13
  'disabled',
10
14
  'bordered',
11
15
  'size',
@@ -29,22 +33,35 @@ class PasscodeInternal extends BaseInputClass {
29
33
 
30
34
  constructor() {
31
35
  super();
36
+
37
+ this.innerHTML = `
38
+ <div class="wrapper"></div>
39
+ <style>
40
+ .wrapper {
41
+ display: flex;
42
+ width: 100%;
43
+ justify-content: space-between;
44
+ }
45
+ </style>
46
+ `;
47
+
48
+ this.wrapperEle = this.querySelector('div');
49
+ }
50
+
51
+ renderInputs() {
32
52
  const inputs = [...Array(this.digits).keys()].map((idx) => `
33
53
  <descope-text-field
34
- st-width="35px"
35
54
  data-id=${idx}
36
55
  type="tel"
37
56
  autocomplete="off"
38
57
  ></descope-text-field>
39
58
  `)
40
59
 
41
- this.innerHTML = `
42
- <div>
43
- ${inputs.join('')}
44
- </div>
45
- `;
60
+ this.wrapperEle.innerHTML = inputs.join('');
46
61
 
47
62
  this.inputs = Array.from(this.querySelectorAll('descope-text-field'))
63
+
64
+ this.initInputs()
48
65
  }
49
66
 
50
67
  get digits() {
@@ -52,7 +69,7 @@ class PasscodeInternal extends BaseInputClass {
52
69
  }
53
70
 
54
71
  get value() {
55
- return this.inputs.map(({ value }) => value).join('')
72
+ return this.inputs?.map(({ value }) => value).join('') || ''
56
73
  }
57
74
 
58
75
  set value(val) {
@@ -91,7 +108,8 @@ class PasscodeInternal extends BaseInputClass {
91
108
 
92
109
  super.init?.();
93
110
 
94
- this.initInputs()
111
+ this.renderInputs()
112
+
95
113
  }
96
114
 
97
115
  getInputIdx(inputEle) {
@@ -180,6 +198,8 @@ class PasscodeInternal extends BaseInputClass {
180
198
  input.value = ''; // we are clearing the previous value so we can override it with the new value
181
199
  }
182
200
  };
201
+
202
+ forwardAttrs(this, input, { includeAttrs: forwardAttributes })
183
203
  })
184
204
  }
185
205
 
@@ -189,11 +209,9 @@ class PasscodeInternal extends BaseInputClass {
189
209
  // sync attributes to inputs
190
210
  if (oldValue !== newValue) {
191
211
  if (observedAttributes.includes(attrName)) {
192
- this.inputs.forEach(
193
- (input) => newValue === null ?
194
- input.removeAttribute(attrName) :
195
- input.setAttribute(attrName, newValue)
196
- )
212
+ if (attrName === 'digits') {
213
+ this.renderInputs();
214
+ }
197
215
  }
198
216
  }
199
217
  }