@vaadin/password-field 24.1.3 → 24.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/password-field",
3
- "version": "24.1.3",
3
+ "version": "24.1.4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -35,12 +35,12 @@
35
35
  ],
36
36
  "dependencies": {
37
37
  "@polymer/polymer": "^3.0.0",
38
- "@vaadin/button": "~24.1.3",
39
- "@vaadin/component-base": "~24.1.3",
40
- "@vaadin/text-field": "~24.1.3",
41
- "@vaadin/vaadin-lumo-styles": "~24.1.3",
42
- "@vaadin/vaadin-material-styles": "~24.1.3",
43
- "@vaadin/vaadin-themable-mixin": "~24.1.3"
38
+ "@vaadin/button": "~24.1.4",
39
+ "@vaadin/component-base": "~24.1.4",
40
+ "@vaadin/text-field": "~24.1.4",
41
+ "@vaadin/vaadin-lumo-styles": "~24.1.4",
42
+ "@vaadin/vaadin-material-styles": "~24.1.4",
43
+ "@vaadin/vaadin-themable-mixin": "~24.1.4"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@esm-bundle/chai": "^4.3.4",
@@ -51,5 +51,5 @@
51
51
  "web-types.json",
52
52
  "web-types.lit.json"
53
53
  ],
54
- "gitHead": "161d7de3f22afa4b67723493555c0512ce2acfe3"
54
+ "gitHead": "1853b0a2aa3fac786ab9e5094af67fa3b99e5a0d"
55
55
  }
@@ -125,7 +125,8 @@ export class PasswordField extends TextField {
125
125
  super();
126
126
  this._setType('password');
127
127
  this.__boundRevealButtonClick = this._onRevealButtonClick.bind(this);
128
- this.__boundRevealButtonTouchend = this._onRevealButtonTouchend.bind(this);
128
+ this.__boundRevealButtonMouseDown = this._onRevealButtonMouseDown.bind(this);
129
+ this.__lastChange = '';
129
130
  }
130
131
 
131
132
  /** @protected */
@@ -157,7 +158,7 @@ export class PasswordField extends TextField {
157
158
  btn.disabled = this.disabled;
158
159
 
159
160
  btn.addEventListener('click', this.__boundRevealButtonClick);
160
- btn.addEventListener('touchend', this.__boundRevealButtonTouchend);
161
+ btn.addEventListener('mousedown', this.__boundRevealButtonMouseDown);
161
162
  },
162
163
  });
163
164
  this.addController(this._revealButtonController);
@@ -172,6 +173,19 @@ export class PasswordField extends TextField {
172
173
  }
173
174
  }
174
175
 
176
+ /**
177
+ * Override an event listener inherited from `InputControlMixin`
178
+ * to store the value at the moment of the native `change` event.
179
+ * @param {Event} event
180
+ * @protected
181
+ * @override
182
+ */
183
+ _onChange(event) {
184
+ super._onChange(event);
185
+
186
+ this.__lastChange = this.inputElement.value;
187
+ }
188
+
175
189
  /**
176
190
  * Override method inherited from `FocusMixin` to mark field as focused
177
191
  * when focus moves to the reveal button using Shift Tab.
@@ -208,6 +222,12 @@ export class PasswordField extends TextField {
208
222
 
209
223
  if (!focused) {
210
224
  this._setPasswordVisible(false);
225
+
226
+ // Detect if `focusout` was prevented and if so, dispatch `change` event manually.
227
+ if (this.__lastChange !== this.inputElement.value) {
228
+ this.__lastChange = this.inputElement.value;
229
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true }));
230
+ }
211
231
  } else {
212
232
  const isButtonFocused = this.getRootNode().activeElement === this._revealNode;
213
233
  // Remove focus-ring from the field when the reveal button gets focused
@@ -243,10 +263,10 @@ export class PasswordField extends TextField {
243
263
  }
244
264
 
245
265
  /** @private */
246
- _onRevealButtonTouchend(e) {
247
- // Cancel the following click event
266
+ _onRevealButtonMouseDown(e) {
267
+ // Cancel the following focusout event
248
268
  e.preventDefault();
249
- this._togglePasswordVisibility();
269
+
250
270
  // Focus the input to avoid problem with password still visible
251
271
  // when user clicks the reveal button and then clicks outside.
252
272
  this.inputElement.focus();
package/web-types.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/password-field",
4
- "version": "24.1.3",
4
+ "version": "24.1.4",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "elements": [
9
9
  {
10
10
  "name": "vaadin-password-field",
11
- "description": "`<vaadin-password-field>` is an extension of `<vaadin-text-field>` component for entering passwords.\n\n```html\n<vaadin-password-field label=\"Password\"></vaadin-password-field>\n```\n\n### Styling\n\n`<vaadin-password-field>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.1.3/#/elements/vaadin-text-field) for the styling documentation.\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n----------------|----------------------------------------------------\n`reveal-button` | The eye icon which toggles the password visibility\n\nIn addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:\n\nAttribute | Description\n-------------------|---------------------------------\n`password-visible` | Set when the password is visible\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
11
+ "description": "`<vaadin-password-field>` is an extension of `<vaadin-text-field>` component for entering passwords.\n\n```html\n<vaadin-password-field label=\"Password\"></vaadin-password-field>\n```\n\n### Styling\n\n`<vaadin-password-field>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.1.4/#/elements/vaadin-text-field) for the styling documentation.\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n----------------|----------------------------------------------------\n`reveal-button` | The eye icon which toggles the password visibility\n\nIn addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:\n\nAttribute | Description\n-------------------|---------------------------------\n`password-visible` | Set when the password is visible\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
12
12
  "attributes": [
13
13
  {
14
14
  "name": "disabled",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/password-field",
4
- "version": "24.1.3",
4
+ "version": "24.1.4",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -16,7 +16,7 @@
16
16
  "elements": [
17
17
  {
18
18
  "name": "vaadin-password-field",
19
- "description": "`<vaadin-password-field>` is an extension of `<vaadin-text-field>` component for entering passwords.\n\n```html\n<vaadin-password-field label=\"Password\"></vaadin-password-field>\n```\n\n### Styling\n\n`<vaadin-password-field>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.1.3/#/elements/vaadin-text-field) for the styling documentation.\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n----------------|----------------------------------------------------\n`reveal-button` | The eye icon which toggles the password visibility\n\nIn addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:\n\nAttribute | Description\n-------------------|---------------------------------\n`password-visible` | Set when the password is visible\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
19
+ "description": "`<vaadin-password-field>` is an extension of `<vaadin-text-field>` component for entering passwords.\n\n```html\n<vaadin-password-field label=\"Password\"></vaadin-password-field>\n```\n\n### Styling\n\n`<vaadin-password-field>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.1.4/#/elements/vaadin-text-field) for the styling documentation.\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n----------------|----------------------------------------------------\n`reveal-button` | The eye icon which toggles the password visibility\n\nIn addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:\n\nAttribute | Description\n-------------------|---------------------------------\n`password-visible` | Set when the password is visible\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
20
20
  "extension": true,
21
21
  "attributes": [
22
22
  {