@vaadin/password-field 25.0.0-alpha16 → 25.0.0-alpha18
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 +12 -12
- package/src/styles/vaadin-password-field-button-base-styles.js +1 -1
- package/src/vaadin-password-field-mixin.js +24 -69
- package/src/vaadin-password-field.d.ts +26 -10
- package/src/vaadin-password-field.js +26 -10
- package/web-types.json +2 -2
- package/web-types.lit.json +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/password-field",
|
|
3
|
-
"version": "25.0.0-
|
|
3
|
+
"version": "25.0.0-alpha18",
|
|
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-
|
|
38
|
-
"@vaadin/button": "25.0.0-
|
|
39
|
-
"@vaadin/component-base": "25.0.0-
|
|
40
|
-
"@vaadin/field-base": "25.0.0-
|
|
41
|
-
"@vaadin/text-field": "25.0.0-
|
|
42
|
-
"@vaadin/vaadin-themable-mixin": "25.0.0-
|
|
37
|
+
"@vaadin/a11y-base": "25.0.0-alpha18",
|
|
38
|
+
"@vaadin/button": "25.0.0-alpha18",
|
|
39
|
+
"@vaadin/component-base": "25.0.0-alpha18",
|
|
40
|
+
"@vaadin/field-base": "25.0.0-alpha18",
|
|
41
|
+
"@vaadin/text-field": "25.0.0-alpha18",
|
|
42
|
+
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha18",
|
|
43
43
|
"lit": "^3.0.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@vaadin/chai-plugins": "25.0.0-
|
|
47
|
-
"@vaadin/test-runner-commands": "25.0.0-
|
|
46
|
+
"@vaadin/chai-plugins": "25.0.0-alpha18",
|
|
47
|
+
"@vaadin/test-runner-commands": "25.0.0-alpha18",
|
|
48
48
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
49
|
-
"@vaadin/vaadin-lumo-styles": "25.0.0-
|
|
50
|
-
"sinon": "^
|
|
49
|
+
"@vaadin/vaadin-lumo-styles": "25.0.0-alpha18",
|
|
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": "
|
|
56
|
+
"gitHead": "cb5cafb5687a117ebead1b81e2116991cec13abe"
|
|
57
57
|
}
|
|
@@ -10,10 +10,10 @@ import { buttonStyles } from '@vaadin/button/src/styles/vaadin-button-base-style
|
|
|
10
10
|
const passwordFieldBase = css`
|
|
11
11
|
:host {
|
|
12
12
|
--vaadin-button-background: transparent;
|
|
13
|
-
--vaadin-button-border: none;
|
|
14
13
|
--vaadin-button-padding: 0;
|
|
15
14
|
color: var(--vaadin-input-field-button-color, inherit);
|
|
16
15
|
display: block;
|
|
16
|
+
border: none;
|
|
17
17
|
cursor: var(--vaadin-clickable-cursor);
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -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
|
|
|
@@ -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
|
-
|
|
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.
|
|
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
|
};
|
|
@@ -49,20 +49,36 @@ export interface PasswordFieldEventMap extends HTMLElementEventMap, PasswordFiel
|
|
|
49
49
|
*
|
|
50
50
|
* ### Styling
|
|
51
51
|
*
|
|
52
|
-
*
|
|
53
|
-
* See [`<vaadin-text-field>`](#/elements/vaadin-text-field) for the styling documentation.
|
|
52
|
+
* The following shadow DOM parts are available for styling:
|
|
54
53
|
*
|
|
55
|
-
*
|
|
54
|
+
* Part name | Description
|
|
55
|
+
* ---------------------|----------------
|
|
56
|
+
* `label` | The label element
|
|
57
|
+
* `input-field` | The element that wraps prefix, value and suffix
|
|
58
|
+
* `clear-button` | The clear button
|
|
59
|
+
* `error-message` | The error message element
|
|
60
|
+
* `helper-text` | The helper text element wrapper
|
|
61
|
+
* `required-indicator` | The `required` state indicator element
|
|
62
|
+
* `reveal-button` | The eye icon which toggles the password visibility
|
|
56
63
|
*
|
|
57
|
-
*
|
|
58
|
-
* ----------------|----------------------------------------------------
|
|
59
|
-
* `reveal-button` | The eye icon which toggles the password visibility
|
|
64
|
+
* The following state attributes are available for styling:
|
|
60
65
|
*
|
|
61
|
-
*
|
|
66
|
+
* Attribute | Description
|
|
67
|
+
* ---------------------|---------------------------------
|
|
68
|
+
* `disabled` | Set when the element is disabled
|
|
69
|
+
* `has-value` | Set when the element has a value
|
|
70
|
+
* `has-label` | Set when the element has a label
|
|
71
|
+
* `has-helper` | Set when the element has helper text or slot
|
|
72
|
+
* `has-error-message` | Set when the element has an error message
|
|
73
|
+
* `has-tooltip` | Set when the element has a slotted tooltip
|
|
74
|
+
* `invalid` | Set when the element is invalid
|
|
75
|
+
* `input-prevented` | Temporarily set when invalid input is prevented
|
|
76
|
+
* `focused` | Set when the element is focused
|
|
77
|
+
* `focus-ring` | Set when the element is keyboard focused
|
|
78
|
+
* `readonly` | Set when the element is readonly
|
|
79
|
+
* `password-visible` | Set when the password is visible
|
|
62
80
|
*
|
|
63
|
-
*
|
|
64
|
-
* -------------------|---------------------------------
|
|
65
|
-
* `password-visible` | Set when the password is visible
|
|
81
|
+
* Note, the `input-prevented` state attribute is only supported when `allowedCharPattern` is set.
|
|
66
82
|
*
|
|
67
83
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
68
84
|
*
|
|
@@ -19,20 +19,36 @@ import { PasswordFieldMixin } from './vaadin-password-field-mixin.js';
|
|
|
19
19
|
*
|
|
20
20
|
* ### Styling
|
|
21
21
|
*
|
|
22
|
-
*
|
|
23
|
-
* See [`<vaadin-text-field>`](#/elements/vaadin-text-field) for the styling documentation.
|
|
22
|
+
* The following shadow DOM parts are available for styling:
|
|
24
23
|
*
|
|
25
|
-
*
|
|
24
|
+
* Part name | Description
|
|
25
|
+
* ---------------------|----------------
|
|
26
|
+
* `label` | The label element
|
|
27
|
+
* `input-field` | The element that wraps prefix, value and suffix
|
|
28
|
+
* `clear-button` | The clear button
|
|
29
|
+
* `error-message` | The error message element
|
|
30
|
+
* `helper-text` | The helper text element wrapper
|
|
31
|
+
* `required-indicator` | The `required` state indicator element
|
|
32
|
+
* `reveal-button` | The eye icon which toggles the password visibility
|
|
26
33
|
*
|
|
27
|
-
*
|
|
28
|
-
* ----------------|----------------------------------------------------
|
|
29
|
-
* `reveal-button` | The eye icon which toggles the password visibility
|
|
34
|
+
* The following state attributes are available for styling:
|
|
30
35
|
*
|
|
31
|
-
*
|
|
36
|
+
* Attribute | Description
|
|
37
|
+
* ---------------------|---------------------------------
|
|
38
|
+
* `disabled` | Set when the element is disabled
|
|
39
|
+
* `has-value` | Set when the element has a value
|
|
40
|
+
* `has-label` | Set when the element has a label
|
|
41
|
+
* `has-helper` | Set when the element has helper text or slot
|
|
42
|
+
* `has-error-message` | Set when the element has an error message
|
|
43
|
+
* `has-tooltip` | Set when the element has a slotted tooltip
|
|
44
|
+
* `invalid` | Set when the element is invalid
|
|
45
|
+
* `input-prevented` | Temporarily set when invalid input is prevented
|
|
46
|
+
* `focused` | Set when the element is focused
|
|
47
|
+
* `focus-ring` | Set when the element is keyboard focused
|
|
48
|
+
* `readonly` | Set when the element is readonly
|
|
49
|
+
* `password-visible` | Set when the password is visible
|
|
32
50
|
*
|
|
33
|
-
*
|
|
34
|
-
* -------------------|---------------------------------
|
|
35
|
-
* `password-visible` | Set when the password is visible
|
|
51
|
+
* Note, the `input-prevented` state attribute is only supported when `allowedCharPattern` is set.
|
|
36
52
|
*
|
|
37
53
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
38
54
|
*
|
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": "25.0.0-
|
|
4
|
+
"version": "25.0.0-alpha18",
|
|
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\
|
|
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\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|----------------\n`label` | The label element\n`input-field` | The element that wraps prefix, value and suffix\n`clear-button` | The clear button\n`error-message` | The error message element\n`helper-text` | The helper text element wrapper\n`required-indicator` | The `required` state indicator element\n`reveal-button` | The eye icon which toggles the password visibility\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------------|---------------------------------\n`disabled` | Set when the element is disabled\n`has-value` | Set when the element has a value\n`has-label` | Set when the element has a label\n`has-helper` | Set when the element has helper text or slot\n`has-error-message` | Set when the element has an error message\n`has-tooltip` | Set when the element has a slotted tooltip\n`invalid` | Set when the element is invalid\n`input-prevented` | Temporarily set when invalid input is prevented\n`focused` | Set when the element is focused\n`focus-ring` | Set when the element is keyboard focused\n`readonly` | Set when the element is readonly\n`password-visible` | Set when the password is visible\n\nNote, the `input-prevented` state attribute is only supported when `allowedCharPattern` is set.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
12
12
|
"attributes": [
|
|
13
13
|
{
|
|
14
14
|
"name": "disabled",
|
package/web-types.lit.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-
|
|
4
|
+
"version": "25.0.0-alpha18",
|
|
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\
|
|
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\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------------|----------------\n`label` | The label element\n`input-field` | The element that wraps prefix, value and suffix\n`clear-button` | The clear button\n`error-message` | The error message element\n`helper-text` | The helper text element wrapper\n`required-indicator` | The `required` state indicator element\n`reveal-button` | The eye icon which toggles the password visibility\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------------|---------------------------------\n`disabled` | Set when the element is disabled\n`has-value` | Set when the element has a value\n`has-label` | Set when the element has a label\n`has-helper` | Set when the element has helper text or slot\n`has-error-message` | Set when the element has an error message\n`has-tooltip` | Set when the element has a slotted tooltip\n`invalid` | Set when the element is invalid\n`input-prevented` | Temporarily set when invalid input is prevented\n`focused` | Set when the element is focused\n`focus-ring` | Set when the element is keyboard focused\n`readonly` | Set when the element is readonly\n`password-visible` | Set when the password is visible\n\nNote, the `input-prevented` state attribute is only supported when `allowedCharPattern` is set.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
22
|
{
|