@descope/web-components-ui 1.0.308 → 1.0.310

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. package/dist/cjs/index.cjs.js +108 -48
  2. package/dist/cjs/index.cjs.js.map +1 -1
  3. package/dist/index.esm.js +113 -51
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/umd/4392.js +1 -1
  6. package/dist/umd/4978.js +1 -1
  7. package/dist/umd/DescopeDev.js +1 -1
  8. package/dist/umd/descope-email-field-index-js.js +4 -4
  9. package/dist/umd/descope-new-password-index-js.js +1 -1
  10. package/dist/umd/descope-number-field-index-js.js +1 -1
  11. package/dist/umd/descope-passcode-index-js.js +1 -1
  12. package/dist/umd/descope-recaptcha-index-js.js +1 -1
  13. package/dist/umd/descope-text-field-index-js.js +2 -2
  14. package/dist/umd/mapping-fields-descope-mappings-field-index-js.js +1 -1
  15. package/dist/umd/mapping-fields-descope-saml-group-mappings-index-js.js +1 -1
  16. package/dist/umd/phone-fields-descope-phone-field-descope-phone-field-internal-index-js.js +1 -1
  17. package/dist/umd/phone-fields-descope-phone-field-index-js.js +1 -1
  18. package/dist/umd/phone-fields-descope-phone-input-box-field-descope-phone-input-box-internal-index-js.js +2 -2
  19. package/dist/umd/phone-fields-descope-phone-input-box-field-index-js.js +1 -1
  20. package/package.json +2 -2
  21. package/src/components/descope-recaptcha/RecaptchaClass.js +50 -32
  22. package/src/components/descope-text-field/TextFieldClass.js +25 -0
  23. package/src/components/descope-text-field/textFieldMappings.js +21 -2
  24. package/src/components/phone-fields/descope-phone-field/descope-phone-field-internal/PhoneFieldInternal.js +2 -2
  25. package/src/components/phone-fields/descope-phone-input-box-field/descope-phone-input-box-internal/PhoneFieldInternalInputBox.js +3 -1
  26. package/src/mixins/componentsContextMixin.js +0 -4
  27. package/src/mixins/proxyInputMixin.js +1 -1
@@ -36,6 +36,31 @@ const customMixin = (superclass) =>
36
36
  this.baseElement._setType(newVal);
37
37
  }
38
38
  }
39
+
40
+ // webauthn is not working when the native input element is nested inside multiple shadow roots
41
+ // so we need to be able move the input outside the shadow root for some cases
42
+ get isExternalInput() {
43
+ return this.getAttribute('external-input') === 'true';
44
+ }
45
+
46
+ constructor() {
47
+ super();
48
+
49
+ if (this.isExternalInput) {
50
+ const origInput = this.baseElement.querySelector('input');
51
+ this.inputSlot = document.createElement('slot');
52
+
53
+ this.focus = () => {
54
+ origInput.focus();
55
+ };
56
+
57
+ this.inputSlot.setAttribute('name', 'input');
58
+ this.inputSlot.setAttribute('slot', 'input');
59
+ this.baseElement.appendChild(this.inputSlot);
60
+
61
+ this.appendChild(origInput);
62
+ }
63
+ }
39
64
  };
40
65
 
41
66
  export const TextFieldClass = compose(
@@ -9,6 +9,10 @@ const {
9
9
  errorMessage,
10
10
  disabledPlaceholder,
11
11
  inputDisabled,
12
+ externalInput,
13
+ externalInputDisabled,
14
+ externalPlaceholder,
15
+ externalDisabledPlaceholder,
12
16
  } = {
13
17
  host: { selector: () => ':host' },
14
18
  label: { selector: '::part(label)' },
@@ -20,6 +24,10 @@ const {
20
24
  inputDisabled: { selector: 'input:disabled' },
21
25
  helperText: { selector: '::part(helper-text)' },
22
26
  errorMessage: { selector: '::part(error-message)' },
27
+ externalInput: { selector: () => '::slotted(input)' },
28
+ externalInputDisabled: { selector: () => '::slotted(input:disabled)' },
29
+ externalPlaceholder: { selector: () => '::slotted(input:placeholder-shown)' },
30
+ externalDisabledPlaceholder: { selector: () => '::slotted(input:disabled::placeholder)' },
23
31
  };
24
32
 
25
33
  export default {
@@ -45,8 +53,12 @@ export default {
45
53
  inputValueTextColor: [
46
54
  { ...inputField, property: 'color' },
47
55
  { ...inputDisabled, property: '-webkit-text-fill-color' },
56
+ { ...externalInputDisabled, property: '-webkit-text-fill-color' },
57
+ ],
58
+ inputCaretTextColor: [
59
+ { ...input, property: 'color' },
60
+ { ...externalInput, property: 'color' },
48
61
  ],
49
- inputCaretTextColor: { ...input, property: 'color' },
50
62
 
51
63
  labelRequiredIndicator: { ...requiredIndicator, property: 'content' },
52
64
 
@@ -59,6 +71,8 @@ export default {
59
71
  inputHorizontalPadding: [
60
72
  { ...input, property: 'padding-left' },
61
73
  { ...input, property: 'padding-right' },
74
+ { ...externalInput, property: 'padding-left' },
75
+ { ...externalInput, property: 'padding-right' },
62
76
  ],
63
77
 
64
78
  inputOutlineColor: { ...inputField, property: 'outline-color' },
@@ -66,10 +80,15 @@ export default {
66
80
  inputOutlineWidth: { ...inputField, property: 'outline-width' },
67
81
  inputOutlineOffset: { ...inputField, property: 'outline-offset' },
68
82
 
69
- inputTextAlign: { ...input, property: 'text-align' },
83
+ inputTextAlign: [
84
+ { ...input, property: 'text-align' },
85
+ { ...externalInput, property: 'text-align' },
86
+ ],
70
87
 
71
88
  inputPlaceholderColor: [
72
89
  { ...placeholder, property: 'color' },
90
+ { ...externalPlaceholder, property: 'color' },
73
91
  { ...disabledPlaceholder, property: '-webkit-text-fill-color' },
92
+ { ...externalDisabledPlaceholder, property: '-webkit-text-fill-color' },
74
93
  ],
75
94
  };
@@ -7,7 +7,7 @@ export const componentName = getComponentName('phone-field-internal');
7
7
 
8
8
  const commonAttrs = ['disabled', 'size', 'bordered', 'invalid', 'readonly'];
9
9
  const countryAttrs = ['country-input-placeholder', 'default-code', 'restrict-countries'];
10
- const phoneAttrs = ['phone-input-placeholder', 'maxlength'];
10
+ const phoneAttrs = ['phone-input-placeholder', 'maxlength', 'autocomplete', 'name'];
11
11
  const mapAttrs = {
12
12
  'country-input-placeholder': 'placeholder',
13
13
  'phone-input-placeholder': 'placeholder',
@@ -34,7 +34,7 @@ class PhoneFieldInternal extends BaseInputClass {
34
34
  ${CountryCodes.map((item) => comboBoxItem(item)).join('')}
35
35
  </descope-combo-box>
36
36
  <div class="separator"></div>
37
- <descope-text-field type="tel"></descope-text-field>
37
+ <descope-text-field type="tel" external-input="true"></descope-text-field>
38
38
  </div>
39
39
  `;
40
40
 
@@ -11,6 +11,8 @@ const observedAttributes = [
11
11
  'invalid',
12
12
  'readonly',
13
13
  'phone-input-placeholder',
14
+ 'name',
15
+ 'autocomplete',
14
16
  ];
15
17
  const mapAttrs = {
16
18
  'phone-input-placeholder': 'placeholder',
@@ -28,7 +30,7 @@ class PhoneFieldInternal extends BaseInputClass {
28
30
 
29
31
  this.innerHTML = `
30
32
  <div>
31
- <descope-text-field tabindex="1"></descope-text-field>
33
+ <descope-text-field tabindex="1" external-input="true"></descope-text-field>
32
34
  </div>
33
35
  `;
34
36
 
@@ -1,9 +1,5 @@
1
- import { createDispatchEvent } from '../helpers/mixinsHelpers';
2
-
3
1
  export const componentsContextMixin = (superclass) =>
4
2
  class ComponentsContextMixinClass extends superclass {
5
- #dispatchComponentsContext = createDispatchEvent.bind(this, 'components-context');
6
-
7
3
  updateComponentsContext(componentsContext) {
8
4
  this.dispatchEvent(
9
5
  new CustomEvent('components-context', {
@@ -29,7 +29,7 @@ const getNestedInput = (ele) => {
29
29
  let nonSlotEle = ele;
30
30
  for (let i = 0; i < nestingLevel; i++) {
31
31
  [nonSlotEle] = nonSlotEle.assignedElements();
32
- if (nonSlotEle.localName !== 'slot') return nonSlotEle;
32
+ if (nonSlotEle?.localName !== 'slot') return nonSlotEle;
33
33
  }
34
34
  return undefined;
35
35
  };