@descope/web-components-ui 1.0.403 → 1.0.405

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/index.d.ts CHANGED
@@ -7,7 +7,7 @@ export {
7
7
  componentsThemeManager,
8
8
  } from './helpers/themeHelpers';
9
9
  export { genColor } from './helpers/themeHelpers/colorsHelpers';
10
- export { defaultTheme, themeVars } from './defaultTheme';
10
+ export { defaultTheme, themeVars } from './theme';
11
11
  export { default as darkTheme } from './darkTheme';
12
12
  export { ButtonClass } from './components/descope-button';
13
13
  export { CheckboxClass } from './components/boolean-fields/descope-checkbox';
@@ -49,6 +49,7 @@ export { PolicyValidationClass } from './components/descope-policy-validation/';
49
49
  export { CodeSnippetClass } from './components/descope-code-snippet/';
50
50
  export { CalendarClass } from './components/descope-date-field/descope-calendar';
51
51
  export { DateFieldClass } from './components/descope-date-field/';
52
+ export { HybridFieldClass } from './components/descope-hybrid-field';
52
53
 
53
54
  export type Theme = {
54
55
  globals: {
package/dist/index.esm.js CHANGED
@@ -15319,8 +15319,6 @@ const componentName$1 = getComponentName('hybrid-field');
15319
15319
 
15320
15320
  const attrs = {
15321
15321
  shared: [
15322
- 'label',
15323
- 'placeholder',
15324
15322
  'bordered',
15325
15323
  'full-width',
15326
15324
  'label-type',
@@ -15331,12 +15329,15 @@ const attrs = {
15331
15329
  'st-host-direction',
15332
15330
  ],
15333
15331
  email: [
15332
+ 'label',
15333
+ 'placeholder',
15334
15334
  'data-errormessage-value-missing-email',
15335
15335
  'data-errormessage-pattern-mismatch-email',
15336
15336
  'external-input',
15337
15337
  ],
15338
15338
  phone: {
15339
15339
  countryCode: [
15340
+ 'phone-input-label',
15340
15341
  'country-input-label',
15341
15342
  'country-input-placeholder',
15342
15343
  'restrict-countries',
@@ -15345,6 +15346,7 @@ const attrs = {
15345
15346
  'data-errormessage-value-missing-phone',
15346
15347
  ],
15347
15348
  inputBox: [
15349
+ 'label',
15348
15350
  'restrict-countries',
15349
15351
  'default-code',
15350
15352
  'phone-minlength',
@@ -15359,7 +15361,7 @@ const attrMap = {
15359
15361
  'data-errormessage-pattern-mismatch-email': 'data-errormessage-pattern-mismatch',
15360
15362
  },
15361
15363
  phone: {
15362
- placeholder: 'phone-input-placeholder',
15364
+ 'phone-input-label': 'label',
15363
15365
  'phone-minlength': 'minlength',
15364
15366
  'data-errormessage-value-missing-phone': 'data-errormessage-value-missing',
15365
15367
  },
@@ -15392,7 +15394,7 @@ class RawHybridField extends BaseClass {
15392
15394
  }
15393
15395
  .wrapper {
15394
15396
  display: grid;
15395
- place-content: center;
15397
+ width: 100%;
15396
15398
  }
15397
15399
  descope-email-field,
15398
15400
  descope-phone-field,
@@ -15447,11 +15449,29 @@ class RawHybridField extends BaseClass {
15447
15449
  this.activeInput.value = val;
15448
15450
  }
15449
15451
 
15450
- init() {
15452
+ async init() {
15451
15453
  super.init?.();
15454
+
15452
15455
  this.initInputs();
15453
15456
  this.updateAttrs();
15454
15457
  this.toggleInputVisibility();
15458
+
15459
+ await this.waitForInputs();
15460
+
15461
+ this.initInputEles();
15462
+ this.overrideEmailInputType();
15463
+ this.overrideEmailSetAttribute();
15464
+ }
15465
+
15466
+ waitForInputs() {
15467
+ return new Promise((resolve) => {
15468
+ const check = setInterval(() => {
15469
+ if (this.emailInputEle) {
15470
+ clearInterval(check);
15471
+ resolve();
15472
+ }
15473
+ });
15474
+ });
15455
15475
  }
15456
15476
 
15457
15477
  initInputs() {
@@ -15462,19 +15482,6 @@ class RawHybridField extends BaseClass {
15462
15482
  this.inputs = [this.emailInput, this.phoneCountryCodeInput, this.phoneInputBoxInput];
15463
15483
 
15464
15484
  this.activeInput = this.emailInput;
15465
-
15466
- this.initInputEles();
15467
- this.overrideEmailInputType();
15468
-
15469
- // We want to prevent Vaadin from changing the input type to `email`
15470
- // otherwise, we cannot get the selectionStart from the input.
15471
- const origEmailSetAttr = this.emailInput.setAttribute.bind(this.emailInputEle);
15472
- this.emailInputEle.setAttribute = (name, value) => {
15473
- if (name !== 'type' || value !== 'email' || !this.emailInput.hasAttribute('focused')) {
15474
- return origEmailSetAttr(name, value);
15475
- }
15476
- return false;
15477
- };
15478
15485
  }
15479
15486
 
15480
15487
  // we need to listen on the inner `input` element itself, otherwise we don't always get an `input` event
@@ -15486,7 +15493,7 @@ class RawHybridField extends BaseClass {
15486
15493
  ];
15487
15494
 
15488
15495
  inputEles.forEach((ele) => {
15489
- ele?.addEventListener('input', this.onValueChange.bind(this));
15496
+ ele.addEventListener('input', this.onValueChange.bind(this));
15490
15497
  });
15491
15498
  }
15492
15499
 
@@ -15496,14 +15503,24 @@ class RawHybridField extends BaseClass {
15496
15503
  });
15497
15504
  this.emailInputEle.addEventListener('blur', () => {
15498
15505
  setTimeout(() => {
15499
- this.emailInputEle?.setAttribute('type', 'email');
15506
+ this.emailInputEle.setAttribute('type', 'email');
15500
15507
  });
15501
15508
  });
15502
15509
  }
15503
15510
 
15504
- updateAttrs() {
15505
- this.inputs.forEach((input) => forwardAttrs(this, input, { includeAttrs: attrs.shared }));
15511
+ // We want to prevent Vaadin from changing the input type to `email`
15512
+ // otherwise, we cannot get the selectionStart from the input.
15513
+ overrideEmailSetAttribute() {
15514
+ const origEmailSetAttr = this.emailInput.setAttribute.bind(this.emailInputEle);
15515
+ this.emailInputEle.setAttribute = (name, value) => {
15516
+ if (name !== 'type' || value !== 'email' || !this.emailInput.hasAttribute('focused')) {
15517
+ return origEmailSetAttr(name, value);
15518
+ }
15519
+ return false;
15520
+ };
15521
+ }
15506
15522
 
15523
+ updateAttrs() {
15507
15524
  forwardAttrs(this, this.emailInput, { includeAttrs: attrs.email, mapAttrs: attrMap.email });
15508
15525
 
15509
15526
  forwardAttrs(this, this.phoneCountryCodeInput, {
@@ -15516,6 +15533,8 @@ class RawHybridField extends BaseClass {
15516
15533
  mapAttrs: attrMap.phone,
15517
15534
  });
15518
15535
 
15536
+ this.inputs.forEach((input) => forwardAttrs(this, input, { includeAttrs: attrs.shared }));
15537
+
15519
15538
  setTimeout(() => this.phoneCountryCodeInput.setAttribute('default-code', this.defaultCode));
15520
15539
  }
15521
15540