@vaadin/password-field 22.0.2 → 23.0.0-alpha4
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 +7 -5
- package/src/vaadin-password-field-button.js +35 -0
- package/src/vaadin-password-field.d.ts +11 -2
- package/src/vaadin-password-field.js +3 -4
- package/theme/lumo/vaadin-password-field-button-styles.js +26 -0
- package/theme/lumo/vaadin-password-field-styles.js +1 -18
- package/theme/lumo/vaadin-password-field.js +2 -1
- package/theme/material/vaadin-password-field-button-styles.js +37 -0
- package/theme/material/vaadin-password-field-styles.js +1 -45
- package/theme/material/vaadin-password-field.js +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/password-field",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "23.0.0-alpha4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"main": "vaadin-password-field.js",
|
|
20
20
|
"module": "vaadin-password-field.js",
|
|
21
|
+
"type": "module",
|
|
21
22
|
"files": [
|
|
22
23
|
"src",
|
|
23
24
|
"theme",
|
|
@@ -32,14 +33,15 @@
|
|
|
32
33
|
],
|
|
33
34
|
"dependencies": {
|
|
34
35
|
"@polymer/polymer": "^3.0.0",
|
|
35
|
-
"@vaadin/
|
|
36
|
-
"@vaadin/
|
|
37
|
-
"@vaadin/vaadin-
|
|
36
|
+
"@vaadin/button": "23.0.0-alpha4",
|
|
37
|
+
"@vaadin/text-field": "23.0.0-alpha4",
|
|
38
|
+
"@vaadin/vaadin-lumo-styles": "23.0.0-alpha4",
|
|
39
|
+
"@vaadin/vaadin-material-styles": "23.0.0-alpha4"
|
|
38
40
|
},
|
|
39
41
|
"devDependencies": {
|
|
40
42
|
"@esm-bundle/chai": "^4.3.4",
|
|
41
43
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
42
44
|
"sinon": "^9.2.1"
|
|
43
45
|
},
|
|
44
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "81e2deee5147bb7c1f4884760f4598613306f1fb"
|
|
45
47
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2021 - 2022 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { html } from '@polymer/polymer/polymer-element.js';
|
|
7
|
+
import { Button } from '@vaadin/button/src/vaadin-button.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* An element used internally by `<vaadin-password-field>`. Not intended to be used separately.
|
|
11
|
+
*
|
|
12
|
+
* @extends Button
|
|
13
|
+
* @private
|
|
14
|
+
*/
|
|
15
|
+
class PasswordFieldButton extends Button {
|
|
16
|
+
static get is() {
|
|
17
|
+
return 'vaadin-password-field-button';
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static get template() {
|
|
21
|
+
return html`
|
|
22
|
+
<style>
|
|
23
|
+
:host {
|
|
24
|
+
display: block;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
:host([hidden]) {
|
|
28
|
+
display: none !important;
|
|
29
|
+
}
|
|
30
|
+
</style>
|
|
31
|
+
`;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
customElements.define(PasswordFieldButton.is, PasswordFieldButton);
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 Vaadin Ltd.
|
|
3
|
+
* Copyright (c) 2021 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { SlotStylesMixin } from '@vaadin/field-base/src/slot-styles-mixin.js';
|
|
7
7
|
import { TextField } from '@vaadin/text-field/src/vaadin-text-field.js';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Fired when the user commits a value change.
|
|
11
|
+
*/
|
|
12
|
+
export type PasswordFieldChangeEvent = Event & {
|
|
13
|
+
target: PasswordField;
|
|
14
|
+
};
|
|
15
|
+
|
|
9
16
|
/**
|
|
10
17
|
* Fired when the `invalid` property changes.
|
|
11
18
|
*/
|
|
@@ -22,7 +29,9 @@ export interface PasswordFieldCustomEventMap {
|
|
|
22
29
|
'value-changed': PasswordFieldValueChangedEvent;
|
|
23
30
|
}
|
|
24
31
|
|
|
25
|
-
export interface PasswordFieldEventMap extends HTMLElementEventMap, PasswordFieldCustomEventMap {
|
|
32
|
+
export interface PasswordFieldEventMap extends HTMLElementEventMap, PasswordFieldCustomEventMap {
|
|
33
|
+
change: PasswordFieldChangeEvent;
|
|
34
|
+
}
|
|
26
35
|
|
|
27
36
|
/**
|
|
28
37
|
* `<vaadin-password-field>` is an extension of `<vaadin-text-field>` component for entering passwords.
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 Vaadin Ltd.
|
|
3
|
+
* Copyright (c) 2021 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
+
import './vaadin-password-field-button.js';
|
|
6
7
|
import { html } from '@polymer/polymer/lib/utils/html-tag.js';
|
|
7
8
|
import { SlotStylesMixin } from '@vaadin/field-base/src/slot-styles-mixin.js';
|
|
8
9
|
import { TextField } from '@vaadin/text-field/src/vaadin-text-field.js';
|
|
@@ -125,8 +126,7 @@ export class PasswordField extends SlotStylesMixin(TextField) {
|
|
|
125
126
|
return {
|
|
126
127
|
...super.slots,
|
|
127
128
|
reveal: () => {
|
|
128
|
-
const btn = document.createElement('button');
|
|
129
|
-
btn.setAttribute('type', 'button');
|
|
129
|
+
const btn = document.createElement('vaadin-password-field-button');
|
|
130
130
|
btn.disabled = this.disabled;
|
|
131
131
|
return btn;
|
|
132
132
|
}
|
|
@@ -170,7 +170,6 @@ export class PasswordField extends SlotStylesMixin(TextField) {
|
|
|
170
170
|
|
|
171
171
|
if (this._revealNode) {
|
|
172
172
|
this.__updateAriaLabel(this.i18n);
|
|
173
|
-
this._revealNode.setAttribute('aria-label', 'Show password');
|
|
174
173
|
this._revealNode.addEventListener('click', this.__boundRevealButtonClick);
|
|
175
174
|
this._revealNode.addEventListener('touchend', this.__boundRevealButtonTouchend);
|
|
176
175
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2021 - 2022 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { button } from '@vaadin/button/theme/lumo/vaadin-button-styles.js';
|
|
7
|
+
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
8
|
+
|
|
9
|
+
const passwordFieldButton = css`
|
|
10
|
+
:host {
|
|
11
|
+
position: absolute;
|
|
12
|
+
right: 0;
|
|
13
|
+
top: 0;
|
|
14
|
+
margin: 0;
|
|
15
|
+
padding: 0;
|
|
16
|
+
width: 100%;
|
|
17
|
+
height: 100%;
|
|
18
|
+
min-width: auto;
|
|
19
|
+
background: transparent;
|
|
20
|
+
outline: none;
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
registerStyles('vaadin-password-field-button', [button, passwordFieldButton], {
|
|
25
|
+
moduleId: 'lumo-password-field-button'
|
|
26
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 Vaadin Ltd.
|
|
3
|
+
* Copyright (c) 2021 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import '@vaadin/vaadin-lumo-styles/font-icons.js';
|
|
@@ -27,23 +27,6 @@ const passwordField = css`
|
|
|
27
27
|
[part='reveal-button'][hidden] {
|
|
28
28
|
display: none !important;
|
|
29
29
|
}
|
|
30
|
-
|
|
31
|
-
::slotted([slot='reveal']) {
|
|
32
|
-
position: absolute;
|
|
33
|
-
top: 0;
|
|
34
|
-
bottom: 0;
|
|
35
|
-
left: 0;
|
|
36
|
-
right: 0;
|
|
37
|
-
width: 100%;
|
|
38
|
-
background: transparent;
|
|
39
|
-
border: none;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
::slotted([slot='reveal']:focus) {
|
|
43
|
-
border-radius: var(--lumo-border-radius-s);
|
|
44
|
-
box-shadow: 0 0 0 2px var(--lumo-primary-color-50pct);
|
|
45
|
-
outline: none;
|
|
46
|
-
}
|
|
47
30
|
`;
|
|
48
31
|
|
|
49
32
|
registerStyles('vaadin-password-field', [inputFieldShared, passwordField], { moduleId: 'lumo-password-field' });
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 Vaadin Ltd.
|
|
3
|
+
* Copyright (c) 2021 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import '@vaadin/text-field/theme/lumo/vaadin-text-field.js';
|
|
7
|
+
import './vaadin-password-field-button-styles.js';
|
|
7
8
|
import './vaadin-password-field-styles.js';
|
|
8
9
|
import '../../src/vaadin-password-field.js';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2021 - 2022 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { button } from '@vaadin/button/theme/material/vaadin-button-styles.js';
|
|
7
|
+
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
8
|
+
|
|
9
|
+
const passwordFieldButton = css`
|
|
10
|
+
:host {
|
|
11
|
+
position: absolute;
|
|
12
|
+
right: 0;
|
|
13
|
+
top: 0;
|
|
14
|
+
margin: 0;
|
|
15
|
+
padding: 0;
|
|
16
|
+
width: 100%;
|
|
17
|
+
height: 100%;
|
|
18
|
+
min-width: auto;
|
|
19
|
+
background: transparent;
|
|
20
|
+
outline: none;
|
|
21
|
+
border-radius: 50%;
|
|
22
|
+
overflow: visible;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
:host::before {
|
|
26
|
+
transform: scale(1.5);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* Disable ripple */
|
|
30
|
+
:host::after {
|
|
31
|
+
display: none;
|
|
32
|
+
}
|
|
33
|
+
`;
|
|
34
|
+
|
|
35
|
+
registerStyles('vaadin-password-field-button', [button, passwordFieldButton], {
|
|
36
|
+
moduleId: 'material-password-field-button'
|
|
37
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 Vaadin Ltd.
|
|
3
|
+
* Copyright (c) 2021 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import '@vaadin/vaadin-material-styles/color.js';
|
|
@@ -35,53 +35,9 @@ const passwordField = css`
|
|
|
35
35
|
display: none !important;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
::slotted([slot='reveal']) {
|
|
39
|
-
position: absolute;
|
|
40
|
-
top: 0;
|
|
41
|
-
bottom: 0;
|
|
42
|
-
left: 0;
|
|
43
|
-
right: 0;
|
|
44
|
-
width: 100%;
|
|
45
|
-
background: transparent;
|
|
46
|
-
border: none;
|
|
47
|
-
outline: none;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
::slotted([slot='reveal'])::before {
|
|
51
|
-
position: absolute;
|
|
52
|
-
content: '';
|
|
53
|
-
top: 0;
|
|
54
|
-
left: 0;
|
|
55
|
-
width: 32px;
|
|
56
|
-
height: 32px;
|
|
57
|
-
border-radius: 50%;
|
|
58
|
-
background-color: var(--material-body-text-color);
|
|
59
|
-
transform: scale(0);
|
|
60
|
-
opacity: 0;
|
|
61
|
-
transition: transform 0.08s, opacity 0.01s;
|
|
62
|
-
will-change: transform, opacity;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
38
|
:host([focused]) ::slotted([slot='reveal'])::before {
|
|
66
39
|
background-color: var(--material-primary-text-color);
|
|
67
40
|
}
|
|
68
|
-
|
|
69
|
-
::slotted([slot='reveal']:hover)::before {
|
|
70
|
-
opacity: 0.08;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
::slotted([slot='reveal']:focus)::before {
|
|
74
|
-
opacity: 0.12;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
::slotted([slot='reveal']:active)::before {
|
|
78
|
-
opacity: 0.16;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
::slotted([slot='reveal']:hover)::before,
|
|
82
|
-
::slotted([slot='reveal']:focus)::before {
|
|
83
|
-
transform: scale(1.5);
|
|
84
|
-
}
|
|
85
41
|
`;
|
|
86
42
|
|
|
87
43
|
registerStyles('vaadin-password-field', [inputFieldShared, passwordField], { moduleId: 'material-password-field' });
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c) 2021 Vaadin Ltd.
|
|
3
|
+
* Copyright (c) 2021 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import '@vaadin/text-field/theme/material/vaadin-text-field.js';
|
|
7
|
+
import './vaadin-password-field-button-styles.js';
|
|
7
8
|
import './vaadin-password-field-styles.js';
|
|
8
9
|
import '../../src/vaadin-password-field.js';
|