@descope/flow-components 3.20.3 → 3.20.4

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.
@@ -5,7 +5,7 @@
5
5
  "name": "flowComponents",
6
6
  "type": "app",
7
7
  "buildInfo": {
8
- "buildVersion": "3.20.3",
8
+ "buildVersion": "3.20.4",
9
9
  "buildName": "@descope/flow-components"
10
10
  },
11
11
  "remoteEntry": {
@@ -5,7 +5,7 @@
5
5
  "name": "flowComponents",
6
6
  "type": "app",
7
7
  "buildInfo": {
8
- "buildVersion": "3.20.3",
8
+ "buildVersion": "3.20.4",
9
9
  "buildName": "@descope/flow-components"
10
10
  },
11
11
  "remoteEntry": {
package/dist/index.cjs.js CHANGED
@@ -99122,25 +99122,80 @@ function requireIndex_cjs () {
99122
99122
  vars: vars$E
99123
99123
  });
99124
99124
 
99125
+ // Kept in its own module (with no imports) so it can be unit tested without
99126
+ // pulling in the whole component / vaadin dependency chain.
99127
+
99128
+ const asciiPattern = "^[\\w\\.\\%\\+\\-']+@[\\w\\.\\-]+\\.[A-Za-z]{2,}$";
99129
+
99130
+ const unicodePattern =
99131
+ "^[\\p{L}\\p{M}\\p{N}._%+'\\-]+@[\\p{L}\\p{M}\\p{N}.\\-]+\\.[\\p{L}\\p{M}][\\p{L}\\p{M}\\p{N}\\-]+$";
99132
+
99125
99133
  const componentName$P = getComponentName$1('email-field');
99126
99134
 
99127
- const defaultPattern = "^[\\w\\.\\%\\+\\-']+@[\\w\\.\\-]+\\.[A-Za-z]{2,}$";
99128
99135
  const defaultAutocomplete = 'username';
99136
+ const defaultInputMode = 'email';
99129
99137
 
99130
99138
  const customMixin$8 = (superclass) =>
99131
99139
  class EmailFieldMixinClass extends superclass {
99140
+ // On by default - `accept-unicode="false"` restores the pre-unicode field:
99141
+ // native `type="email"` validation and the ASCII pattern.
99142
+ //
99143
+ // Read once, in `init`. Changing the attribute afterwards has no effect; it
99144
+ // is static configuration, which is how every consumer sets it.
99145
+ get acceptsUnicode() {
99146
+ return this.getAttribute('accept-unicode') !== 'false';
99147
+ }
99148
+
99132
99149
  init() {
99133
99150
  super.init?.();
99134
99151
 
99135
99152
  // we need to set the pattern on the base element because vaadin-email-field is overriding it
99136
- this.baseElement.setAttribute('pattern', defaultPattern);
99153
+ this.baseElement.setAttribute('pattern', asciiPattern);
99137
99154
 
99138
99155
  if (!this.getAttribute('autocomplete')) {
99139
99156
  this.setAttribute('autocomplete', defaultAutocomplete);
99140
99157
  }
99141
99158
 
99142
99159
  this.createExternalInput();
99160
+
99161
+ [this.inputElement, this.externalInput].filter(Boolean).forEach((input) => {
99162
+ input.addEventListener('change', this.stripSurroundingWhitespace);
99163
+ });
99164
+
99165
+ if (this.acceptsUnicode) {
99166
+ this.enableUnicode();
99167
+ }
99143
99168
  }
99169
+
99170
+ enableUnicode() {
99171
+ this.baseElement.setAttribute('pattern', unicodePattern);
99172
+
99173
+ // native `type="email"` validation is ASCII only and sets typeMismatch
99174
+ // before `pattern` is consulted, so `text` is what lets the pattern decide.
99175
+ // Through vaadin's `_setType` because `type` is a readOnly property bound
99176
+ // to the inner input - assigning `input.type` is re-applied over.
99177
+ this.baseElement._setType('text');
99178
+
99179
+ if (this.externalInput) {
99180
+ this.externalInput.type = 'text';
99181
+ }
99182
+
99183
+ // `type="text"` loses the email keyboard on mobile
99184
+ if (!this.getAttribute('inputmode')) {
99185
+ this.setAttribute('inputmode', defaultInputMode);
99186
+ }
99187
+
99188
+ this.externalInput?.setAttribute('inputmode', defaultInputMode);
99189
+ }
99190
+
99191
+ stripSurroundingWhitespace = (e) => {
99192
+ const trimmed = e.target.value.trim();
99193
+ if (trimmed === e.target.value) return;
99194
+ this.value = trimmed;
99195
+
99196
+ // validity is cached and was computed against the untrimmed value
99197
+ this.inputElement.dispatchEvent(new Event('input', { bubbles: true, composed: true }));
99198
+ };
99144
99199
  };
99145
99200
 
99146
99201
  const EmailFieldClass = compose$1(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@descope/flow-components",
3
- "version": "3.20.3",
3
+ "version": "3.20.4",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -98,7 +98,7 @@
98
98
  "webpack-subresource-integrity": "5.2.0-rc.1"
99
99
  },
100
100
  "dependencies": {
101
- "@descope/web-components-ui": "3.20.3"
101
+ "@descope/web-components-ui": "3.20.4"
102
102
  },
103
103
  "peerDependencies": {
104
104
  "react": ">= 18"