@vaadin/password-field 25.0.0-alpha17 → 25.0.0-alpha19

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": "25.0.0-alpha17",
3
+ "version": "25.0.0-alpha19",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -34,24 +34,24 @@
34
34
  ],
35
35
  "dependencies": {
36
36
  "@open-wc/dedupe-mixin": "^1.3.0",
37
- "@vaadin/a11y-base": "25.0.0-alpha17",
38
- "@vaadin/button": "25.0.0-alpha17",
39
- "@vaadin/component-base": "25.0.0-alpha17",
40
- "@vaadin/field-base": "25.0.0-alpha17",
41
- "@vaadin/text-field": "25.0.0-alpha17",
42
- "@vaadin/vaadin-themable-mixin": "25.0.0-alpha17",
37
+ "@vaadin/a11y-base": "25.0.0-alpha19",
38
+ "@vaadin/button": "25.0.0-alpha19",
39
+ "@vaadin/component-base": "25.0.0-alpha19",
40
+ "@vaadin/field-base": "25.0.0-alpha19",
41
+ "@vaadin/text-field": "25.0.0-alpha19",
42
+ "@vaadin/vaadin-themable-mixin": "25.0.0-alpha19",
43
43
  "lit": "^3.0.0"
44
44
  },
45
45
  "devDependencies": {
46
- "@vaadin/chai-plugins": "25.0.0-alpha17",
47
- "@vaadin/test-runner-commands": "25.0.0-alpha17",
46
+ "@vaadin/chai-plugins": "25.0.0-alpha19",
47
+ "@vaadin/test-runner-commands": "25.0.0-alpha19",
48
48
  "@vaadin/testing-helpers": "^2.0.0",
49
- "@vaadin/vaadin-lumo-styles": "25.0.0-alpha17",
49
+ "@vaadin/vaadin-lumo-styles": "25.0.0-alpha19",
50
50
  "sinon": "^21.0.0"
51
51
  },
52
52
  "web-types": [
53
53
  "web-types.json",
54
54
  "web-types.lit.json"
55
55
  ],
56
- "gitHead": "8264c71309907be99368b09414f0f8d7f591e0b9"
56
+ "gitHead": "1f9af1ce5f0bae8daff044176c8a8df697763881"
57
57
  }
@@ -35,7 +35,7 @@ export declare class PasswordFieldMixinClass {
35
35
  * An object with translated strings used for localization.
36
36
  * It has the following structure and default values:
37
37
  *
38
- * ```
38
+ * ```js
39
39
  * {
40
40
  * // Translation of the reveal icon button accessible label
41
41
  * reveal: 'Show password'
@@ -26,7 +26,6 @@ export const PasswordFieldMixin = (superClass) =>
26
26
  */
27
27
  revealButtonHidden: {
28
28
  type: Boolean,
29
- observer: '_revealButtonHiddenChanged',
30
29
  value: false,
31
30
  },
32
31
 
@@ -38,7 +37,6 @@ export const PasswordFieldMixin = (superClass) =>
38
37
  type: Boolean,
39
38
  value: false,
40
39
  reflectToAttribute: true,
41
- observer: '_passwordVisibleChanged',
42
40
  readOnly: true,
43
41
  },
44
42
 
@@ -46,7 +44,7 @@ export const PasswordFieldMixin = (superClass) =>
46
44
  * An object with translated strings used for localization.
47
45
  * It has the following structure and default values:
48
46
  *
49
- * ```
47
+ * ```js
50
48
  * {
51
49
  * // Translation of the reveal icon button accessible label
52
50
  * reveal: 'Show password'
@@ -64,10 +62,6 @@ export const PasswordFieldMixin = (superClass) =>
64
62
  };
65
63
  }
66
64
 
67
- static get observers() {
68
- return ['__i18nChanged(i18n)'];
69
- }
70
-
71
65
  /** @override */
72
66
  static get delegateAttrs() {
73
67
  // Do not delegate autocapitalize as it should be always set to "off"
@@ -95,11 +89,6 @@ export const PasswordFieldMixin = (superClass) =>
95
89
  ];
96
90
  }
97
91
 
98
- /** @protected */
99
- get _revealNode() {
100
- return this._revealButtonController && this._revealButtonController.node;
101
- }
102
-
103
92
  /** @protected */
104
93
  ready() {
105
94
  super.ready();
@@ -108,7 +97,7 @@ export const PasswordFieldMixin = (superClass) =>
108
97
 
109
98
  this._revealButtonController = new SlotController(this, 'reveal', 'vaadin-password-field-button', {
110
99
  initializer: (btn) => {
111
- btn.disabled = this.disabled;
100
+ this._revealNode = btn;
112
101
 
113
102
  btn.addEventListener('click', this.__boundRevealButtonClick);
114
103
  btn.addEventListener('mousedown', this.__boundRevealButtonMouseDown);
@@ -116,16 +105,33 @@ export const PasswordFieldMixin = (superClass) =>
116
105
  });
117
106
  this.addController(this._revealButtonController);
118
107
 
119
- this.__updateAriaLabel(this.i18n);
120
-
121
- this._updateToggleState(false);
122
- this._toggleRevealHidden(this.revealButtonHidden);
123
-
124
108
  if (this.inputElement) {
125
109
  this.inputElement.autocapitalize = 'off';
126
110
  }
127
111
  }
128
112
 
113
+ /** @protected */
114
+ updated(props) {
115
+ super.updated(props);
116
+
117
+ if (props.has('disabled')) {
118
+ this._revealNode.disabled = this.disabled;
119
+ }
120
+
121
+ if (props.has('revealButtonHidden')) {
122
+ this._toggleRevealHidden(this.revealButtonHidden);
123
+ }
124
+
125
+ if (props.has('passwordVisible')) {
126
+ this._setType(this.passwordVisible ? 'text' : 'password');
127
+ this._revealNode.setAttribute('aria-pressed', this.passwordVisible ? 'true' : 'false');
128
+ }
129
+
130
+ if (props.has('i18n') && this.i18n && this.i18n.reveal) {
131
+ this._revealNode.setAttribute('aria-label', this.i18n.reveal);
132
+ }
133
+ }
134
+
129
135
  /**
130
136
  * Override an event listener inherited from `InputControlMixin`
131
137
  * to store the value at the moment of the native `change` event.
@@ -188,31 +194,9 @@ export const PasswordFieldMixin = (superClass) =>
188
194
  }
189
195
  }
190
196
 
191
- /** @private */
192
- __updateAriaLabel(i18n) {
193
- if (i18n && i18n.reveal && this._revealNode) {
194
- this._revealNode.setAttribute('aria-label', i18n.reveal);
195
- }
196
- }
197
-
198
- /** @private */
199
- __i18nChanged(i18n) {
200
- this.__updateAriaLabel(i18n);
201
- }
202
-
203
- /** @private */
204
- _revealButtonHiddenChanged(hidden) {
205
- this._toggleRevealHidden(hidden);
206
- }
207
-
208
- /** @private */
209
- _togglePasswordVisibility() {
210
- this._setPasswordVisible(!this.passwordVisible);
211
- }
212
-
213
197
  /** @private */
214
198
  _onRevealButtonClick() {
215
- this._togglePasswordVisibility();
199
+ this._setPasswordVisible(!this.passwordVisible);
216
200
  }
217
201
 
218
202
  /** @private */
@@ -239,33 +223,4 @@ export const PasswordFieldMixin = (superClass) =>
239
223
  }
240
224
  }
241
225
  }
242
-
243
- /** @private */
244
- _updateToggleState(passwordVisible) {
245
- if (this._revealNode) {
246
- this._revealNode.setAttribute('aria-pressed', passwordVisible ? 'true' : 'false');
247
- }
248
- }
249
-
250
- /** @private */
251
- _passwordVisibleChanged(passwordVisible) {
252
- this._setType(passwordVisible ? 'text' : 'password');
253
-
254
- this._updateToggleState(passwordVisible);
255
- }
256
-
257
- /**
258
- * Override method inherited from `DisabledMixin` to synchronize the reveal button
259
- * disabled state with the password field disabled state.
260
- * @param {boolean} disabled
261
- * @param {boolean} oldDisabled
262
- * @protected
263
- */
264
- _disabledChanged(disabled, oldDisabled) {
265
- super._disabledChanged(disabled, oldDisabled);
266
-
267
- if (this._revealNode) {
268
- this._revealNode.disabled = disabled;
269
- }
270
- }
271
226
  };
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/password-field",
4
- "version": "25.0.0-alpha17",
4
+ "version": "25.0.0-alpha19",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -576,7 +576,7 @@
576
576
  },
577
577
  {
578
578
  "name": "i18n",
579
- "description": "An object with translated strings used for localization.\nIt has the following structure and default values:\n\n```\n{\n // Translation of the reveal icon button accessible label\n reveal: 'Show password'\n}\n```",
579
+ "description": "An object with translated strings used for localization.\nIt has the following structure and default values:\n\n```js\n{\n // Translation of the reveal icon button accessible label\n reveal: 'Show password'\n}\n```",
580
580
  "value": {
581
581
  "type": [
582
582
  "Object",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/password-field",
4
- "version": "25.0.0-alpha17",
4
+ "version": "25.0.0-alpha19",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -196,7 +196,7 @@
196
196
  },
197
197
  {
198
198
  "name": ".i18n",
199
- "description": "An object with translated strings used for localization.\nIt has the following structure and default values:\n\n```\n{\n // Translation of the reveal icon button accessible label\n reveal: 'Show password'\n}\n```",
199
+ "description": "An object with translated strings used for localization.\nIt has the following structure and default values:\n\n```js\n{\n // Translation of the reveal icon button accessible label\n reveal: 'Show password'\n}\n```",
200
200
  "value": {
201
201
  "kind": "expression"
202
202
  }