@vaadin/password-field 23.3.18 → 23.3.19

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": "23.3.18",
3
+ "version": "23.3.19",
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": "~23.3.18",
39
- "@vaadin/component-base": "~23.3.18",
40
- "@vaadin/text-field": "~23.3.18",
41
- "@vaadin/vaadin-lumo-styles": "~23.3.18",
42
- "@vaadin/vaadin-material-styles": "~23.3.18",
43
- "@vaadin/vaadin-themable-mixin": "~23.3.18"
38
+ "@vaadin/button": "~23.3.19",
39
+ "@vaadin/component-base": "~23.3.19",
40
+ "@vaadin/text-field": "~23.3.19",
41
+ "@vaadin/vaadin-lumo-styles": "~23.3.19",
42
+ "@vaadin/vaadin-material-styles": "~23.3.19",
43
+ "@vaadin/vaadin-themable-mixin": "~23.3.19"
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": "930a0e53312d950acc507b62a7e03bbea8a81aa2"
54
+ "gitHead": "2ef4452124034616fb9f7e99fa3c381a600986ba"
55
55
  }
@@ -143,7 +143,8 @@ export class PasswordField extends TextField {
143
143
  super();
144
144
  this._setType('password');
145
145
  this.__boundRevealButtonClick = this._onRevealButtonClick.bind(this);
146
- this.__boundRevealButtonTouchend = this._onRevealButtonTouchend.bind(this);
146
+ this.__boundRevealButtonMouseDown = this._onRevealButtonMouseDown.bind(this);
147
+ this.__lastChange = '';
147
148
  }
148
149
 
149
150
  /** @protected */
@@ -160,7 +161,7 @@ export class PasswordField extends TextField {
160
161
  btn.disabled = host.disabled;
161
162
 
162
163
  btn.addEventListener('click', host.__boundRevealButtonClick);
163
- btn.addEventListener('touchend', host.__boundRevealButtonTouchend);
164
+ btn.addEventListener('mousedown', host.__boundRevealButtonMouseDown);
164
165
  },
165
166
  );
166
167
  this.addController(this._revealButtonController);
@@ -175,6 +176,19 @@ export class PasswordField extends TextField {
175
176
  }
176
177
  }
177
178
 
179
+ /**
180
+ * Override an event listener inherited from `InputControlMixin`
181
+ * to store the value at the moment of the native `change` event.
182
+ * @param {Event} event
183
+ * @protected
184
+ * @override
185
+ */
186
+ _onChange(event) {
187
+ super._onChange(event);
188
+
189
+ this.__lastChange = this.inputElement.value;
190
+ }
191
+
178
192
  /**
179
193
  * Override method inherited from `FocusMixin` to mark field as focused
180
194
  * when focus moves to the reveal button using Shift Tab.
@@ -211,6 +225,12 @@ export class PasswordField extends TextField {
211
225
 
212
226
  if (!focused) {
213
227
  this._setPasswordVisible(false);
228
+
229
+ // Detect if `focusout` was prevented and if so, dispatch `change` event manually.
230
+ if (this.__lastChange !== this.inputElement.value) {
231
+ this.__lastChange = this.inputElement.value;
232
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true }));
233
+ }
214
234
  } else {
215
235
  const isButtonFocused = this.getRootNode().activeElement === this._revealNode;
216
236
  // Remove focus-ring from the field when the reveal button gets focused
@@ -246,10 +266,10 @@ export class PasswordField extends TextField {
246
266
  }
247
267
 
248
268
  /** @private */
249
- _onRevealButtonTouchend(e) {
250
- // Cancel the following click event
269
+ _onRevealButtonMouseDown(e) {
270
+ // Cancel the following focusout event
251
271
  e.preventDefault();
252
- this._togglePasswordVisibility();
272
+
253
273
  // Focus the input to avoid problem with password still visible
254
274
  // when user clicks the reveal button and then clicks outside.
255
275
  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": "23.3.18",
4
+ "version": "23.3.19",
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/23.3.18/#/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/custom-theme/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/23.3.19/#/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/custom-theme/styling-components) documentation.",
12
12
  "attributes": [
13
13
  {
14
14
  "name": "value",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/password-field",
4
- "version": "23.3.18",
4
+ "version": "23.3.19",
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/23.3.18/#/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/custom-theme/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/23.3.19/#/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/custom-theme/styling-components) documentation.",
20
20
  "extension": true,
21
21
  "attributes": [
22
22
  {