@descope/web-components-ui 3.26.4 → 3.27.0

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.esm.js CHANGED
@@ -10265,6 +10265,7 @@ const PasswordClass = compose(
10265
10265
  ${useHostExternalPadding(PasswordClass.cssVarList)}
10266
10266
  ${resetInputCursor('vaadin-password-field')}
10267
10267
  ${resetInputLabelPosition('vaadin-password-field')}
10268
+ ${resetInputAutoFill('vaadin-password-field', PasswordClass.cssVarList)}
10268
10269
 
10269
10270
  vaadin-password-field {
10270
10271
  width: 100%;
@@ -19357,6 +19358,20 @@ const asciiPattern =
19357
19358
  const unicodePattern =
19358
19359
  "^[\\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}\\-]+$";
19359
19360
 
19361
+ // The autocomplete grammar is ordered (section-*, shipping/billing, field name, webauthn) and on/off can't be
19362
+ // combined with a field name, so `email` takes the field name's place, before webauthn
19363
+ const emailVerificationAutocomplete = (autocomplete) => {
19364
+ const tokens = (autocomplete || '')
19365
+ .split(/\s+/)
19366
+ .filter(
19367
+ (token) => token && !['username', 'email', 'on', 'off'].includes(token),
19368
+ );
19369
+ const webauthn = tokens.indexOf('webauthn');
19370
+ tokens.splice(webauthn === -1 ? tokens.length : webauthn, 0, 'email');
19371
+
19372
+ return tokens.join(' ');
19373
+ };
19374
+
19360
19375
  const componentName$B = getComponentName$1('email-field');
19361
19376
 
19362
19377
  const defaultAutocomplete = 'username';
@@ -19405,6 +19420,38 @@ const customMixin$6 = (superclass) =>
19405
19420
  if (!this.validatesFormat) {
19406
19421
  this.disableFormatValidation();
19407
19422
  }
19423
+
19424
+ if (this.emailVerification) {
19425
+ this.enableEmailVerification();
19426
+ }
19427
+ }
19428
+
19429
+ // Read once, in `init`: descope-wc renders the screen html once
19430
+ get emailVerification() {
19431
+ return this.getAttribute('email-verification') === 'true';
19432
+ }
19433
+
19434
+ // Browser email verification needs the native input to be an email field (autocomplete `email`).
19435
+ // The host keeps its own autocomplete: descope-wc finds the passkey autofill field by an exact
19436
+ // `[autocomplete="webauthn"]` match on it, so changing the host would break passkeys
19437
+ enableEmailVerification() {
19438
+ const { baseElement } = this;
19439
+ const delegate = baseElement._delegateAttribute.bind(baseElement);
19440
+ // vaadin writes the native autocomplete only through here, so it writes ours
19441
+ baseElement._delegateAttribute = (name, value) =>
19442
+ delegate(
19443
+ name,
19444
+ name === 'autocomplete'
19445
+ ? emailVerificationAutocomplete(value)
19446
+ : value,
19447
+ );
19448
+ baseElement._delegateAttribute('autocomplete', baseElement.autocomplete);
19449
+
19450
+ // the external input copies the host autocomplete once, when it is created
19451
+ this.externalInput?.setAttribute(
19452
+ 'autocomplete',
19453
+ emailVerificationAutocomplete(this.getAttribute('autocomplete')),
19454
+ );
19408
19455
  }
19409
19456
 
19410
19457
  enableUnicode() {