@descope/web-components-ui 3.26.5 → 3.27.1

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.
@@ -10416,6 +10416,10 @@ const recoveryCodes = {
10416
10416
  center: { [vars$V.textAlign]: 'center' },
10417
10417
  },
10418
10418
 
10419
+ displayVariant: {
10420
+ buttons: { [vars$V.hostMinWidth]: '100px' },
10421
+ },
10422
+
10419
10423
  _fullWidth: {
10420
10424
  [vars$V.hostWidth]: '100%',
10421
10425
  },
@@ -18465,6 +18469,20 @@ const asciiPattern =
18465
18469
  const unicodePattern =
18466
18470
  "^[\\p{L}\\p{M}\\p{N}._%+'\\-]+@(?:[\\p{L}\\p{M}\\p{N}](?:[\\p{L}\\p{M}\\p{N}\\-]*[\\p{L}\\p{M}\\p{N}])?\\.)+[\\p{L}\\p{M}][\\p{L}\\p{M}\\p{N}\\-]+$";
18467
18471
 
18472
+ // The autocomplete grammar is ordered (section-*, shipping/billing, field name, webauthn) and on/off can't be
18473
+ // combined with a field name, so `email` takes the field name's place, before webauthn
18474
+ const emailVerificationAutocomplete = (autocomplete) => {
18475
+ const tokens = (autocomplete || '')
18476
+ .split(/\s+/)
18477
+ .filter(
18478
+ (token) => token && !['username', 'email', 'on', 'off'].includes(token),
18479
+ );
18480
+ const webauthn = tokens.indexOf('webauthn');
18481
+ tokens.splice(webauthn === -1 ? tokens.length : webauthn, 0, 'email');
18482
+
18483
+ return tokens.join(' ');
18484
+ };
18485
+
18468
18486
  const componentName$U = getComponentName('email-field');
18469
18487
 
18470
18488
  const defaultAutocomplete = 'username';
@@ -18513,6 +18531,38 @@ const customMixin$a = (superclass) =>
18513
18531
  if (!this.validatesFormat) {
18514
18532
  this.disableFormatValidation();
18515
18533
  }
18534
+
18535
+ if (this.emailVerification) {
18536
+ this.enableEmailVerification();
18537
+ }
18538
+ }
18539
+
18540
+ // Read once, in `init`: descope-wc renders the screen html once
18541
+ get emailVerification() {
18542
+ return this.getAttribute('email-verification') === 'true';
18543
+ }
18544
+
18545
+ // Browser email verification needs the native input to be an email field (autocomplete `email`).
18546
+ // The host keeps its own autocomplete: descope-wc finds the passkey autofill field by an exact
18547
+ // `[autocomplete="webauthn"]` match on it, so changing the host would break passkeys
18548
+ enableEmailVerification() {
18549
+ const { baseElement } = this;
18550
+ const delegate = baseElement._delegateAttribute.bind(baseElement);
18551
+ // vaadin writes the native autocomplete only through here, so it writes ours
18552
+ baseElement._delegateAttribute = (name, value) =>
18553
+ delegate(
18554
+ name,
18555
+ name === 'autocomplete'
18556
+ ? emailVerificationAutocomplete(value)
18557
+ : value,
18558
+ );
18559
+ baseElement._delegateAttribute('autocomplete', baseElement.autocomplete);
18560
+
18561
+ // the external input copies the host autocomplete once, when it is created
18562
+ this.externalInput?.setAttribute(
18563
+ 'autocomplete',
18564
+ emailVerificationAutocomplete(this.getAttribute('autocomplete')),
18565
+ );
18516
18566
  }
18517
18567
 
18518
18568
  enableUnicode() {