@vaadin/vaadin-login 22.0.0-alpha6 → 22.0.0-beta1
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 +23 -32
- package/src/vaadin-login-form.d.ts +14 -59
- package/src/vaadin-login-form.js +4 -198
- package/src/vaadin-login-overlay.d.ts +14 -69
- package/src/vaadin-login-overlay.js +4 -188
- package/theme/lumo/vaadin-login-form.js +1 -5
- package/theme/lumo/vaadin-login-overlay.js +1 -7
- package/theme/material/vaadin-login-form.js +1 -5
- package/theme/material/vaadin-login-overlay.js +1 -7
- package/vaadin-login-overlay.d.ts +0 -1
- package/src/interfaces.d.ts +0 -31
- package/src/vaadin-login-form-wrapper.js +0 -85
- package/src/vaadin-login-mixin.d.ts +0 -74
- package/src/vaadin-login-mixin.js +0 -159
- package/src/vaadin-login-overlay-wrapper.js +0 -109
- package/theme/lumo/vaadin-login-form-styles.js +0 -13
- package/theme/lumo/vaadin-login-form-wrapper-styles.js +0 -83
- package/theme/lumo/vaadin-login-form-wrapper.js +0 -3
- package/theme/lumo/vaadin-login-overlay-styles.js +0 -200
- package/theme/material/vaadin-login-form-styles.js +0 -21
- package/theme/material/vaadin-login-form-wrapper-styles.js +0 -90
- package/theme/material/vaadin-login-form-wrapper.js +0 -3
- package/theme/material/vaadin-login-overlay-styles.js +0 -356
package/package.json
CHANGED
|
@@ -1,10 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/vaadin-login",
|
|
3
|
-
"version": "22.0.0-
|
|
3
|
+
"version": "22.0.0-beta1",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
4
7
|
"description": "vaadin-login",
|
|
8
|
+
"license": "Apache-2.0",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/vaadin/web-components.git",
|
|
12
|
+
"directory": "packages/vaadin-login"
|
|
13
|
+
},
|
|
14
|
+
"author": "Vaadin Ltd",
|
|
15
|
+
"homepage": "https://vaadin.com/components",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/vaadin/vaadin-login/issues"
|
|
18
|
+
},
|
|
5
19
|
"main": "vaadin-login-overlay.js",
|
|
6
20
|
"module": "vaadin-login-overlay.js",
|
|
7
|
-
"
|
|
21
|
+
"files": [
|
|
22
|
+
"src",
|
|
23
|
+
"theme",
|
|
24
|
+
"vaadin-*.d.ts",
|
|
25
|
+
"vaadin-*.js"
|
|
26
|
+
],
|
|
8
27
|
"keywords": [
|
|
9
28
|
"Vaadin",
|
|
10
29
|
"vaadin-login",
|
|
@@ -12,36 +31,8 @@
|
|
|
12
31
|
"web-component",
|
|
13
32
|
"polymer"
|
|
14
33
|
],
|
|
15
|
-
"author": "Vaadin Ltd",
|
|
16
|
-
"license": "Apache-2.0",
|
|
17
|
-
"bugs": {
|
|
18
|
-
"url": "https://github.com/vaadin/vaadin-login/issues"
|
|
19
|
-
},
|
|
20
|
-
"homepage": "https://vaadin.com/components",
|
|
21
|
-
"files": [
|
|
22
|
-
"vaadin-*.d.ts",
|
|
23
|
-
"vaadin-*.js",
|
|
24
|
-
"src",
|
|
25
|
-
"theme"
|
|
26
|
-
],
|
|
27
34
|
"dependencies": {
|
|
28
|
-
"@
|
|
29
|
-
"@vaadin/button": "^22.0.0-alpha6",
|
|
30
|
-
"@vaadin/password-field": "^22.0.0-alpha6",
|
|
31
|
-
"@vaadin/vaadin-element-mixin": "^22.0.0-alpha6",
|
|
32
|
-
"@vaadin/vaadin-lumo-styles": "^22.0.0-alpha6",
|
|
33
|
-
"@vaadin/vaadin-material-styles": "^22.0.0-alpha6",
|
|
34
|
-
"@vaadin/vaadin-overlay": "^22.0.0-alpha6",
|
|
35
|
-
"@vaadin/vaadin-text-field": "^22.0.0-alpha6",
|
|
36
|
-
"@vaadin/vaadin-themable-mixin": "^22.0.0-alpha6"
|
|
37
|
-
},
|
|
38
|
-
"devDependencies": {
|
|
39
|
-
"@esm-bundle/chai": "^4.3.4",
|
|
40
|
-
"@vaadin/testing-helpers": "^0.3.0",
|
|
41
|
-
"sinon": "^9.2.1"
|
|
42
|
-
},
|
|
43
|
-
"publishConfig": {
|
|
44
|
-
"access": "public"
|
|
35
|
+
"@vaadin/login": "22.0.0-beta1"
|
|
45
36
|
},
|
|
46
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "4cf8a9d0504994200c610e44b3676114fef49c1e"
|
|
47
38
|
}
|
|
@@ -1,64 +1,19 @@
|
|
|
1
|
-
import { ElementMixin } from '@vaadin/vaadin-element-mixin/vaadin-element-mixin.js';
|
|
2
|
-
|
|
3
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
4
|
-
|
|
5
|
-
import { LoginMixin } from './vaadin-login-mixin.js';
|
|
6
|
-
|
|
7
|
-
import { LoginEventMap } from './interfaces';
|
|
8
|
-
|
|
9
1
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* <vaadin-login-form></vaadin-login-form>
|
|
15
|
-
* ```
|
|
16
|
-
*
|
|
17
|
-
* Component has to be accessible from the `document` layer in order to allow password managers to work properly with form values.
|
|
18
|
-
* Using `<vaadin-login-overlay>` allows to always attach the component to the document body.
|
|
19
|
-
*
|
|
20
|
-
* ### Styling
|
|
21
|
-
*
|
|
22
|
-
* The component doesn't have a shadowRoot, so the `<form>` and input fields can be styled from a global scope.
|
|
23
|
-
*
|
|
24
|
-
* Use `<vaadin-login-form-wrapper>` themable component to apply styles.
|
|
25
|
-
* The following shadow DOM parts of the `<vaadin-login-form-wrapper>` are available for styling:
|
|
26
|
-
*
|
|
27
|
-
* Part name | Description
|
|
28
|
-
* ---------------|---------------------------------------------------------|
|
|
29
|
-
* `form` | Container for the entire component's content
|
|
30
|
-
* `form-title` | Title of the login form
|
|
31
|
-
* `error-message`| Container for error message, contains error-message-title and error-message-description parts. Hidden by default.
|
|
32
|
-
* `error-message-title` | Container for error message title
|
|
33
|
-
* `error-message-description` | Container for error message description
|
|
34
|
-
* `error-message-description` | Container for error message description
|
|
35
|
-
* `footer` | Container additional information text from `i18n` object
|
|
36
|
-
*
|
|
37
|
-
* See [Styling Components](https://vaadin.com/docs/latest/ds/customization/styling-components) documentation.
|
|
38
|
-
*
|
|
39
|
-
* @fires {CustomEvent} forgot-password - Fired when user clicks on the "Forgot password" button.
|
|
40
|
-
* @fires {CustomEvent} login - Fired when a user submits the login.
|
|
2
|
+
* @license
|
|
3
|
+
* Vaadin Login
|
|
4
|
+
* Copyright (C) 2020 Vaadin Ltd
|
|
5
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
41
6
|
*/
|
|
42
|
-
|
|
43
|
-
submit(): void;
|
|
44
|
-
|
|
45
|
-
addEventListener<K extends keyof LoginEventMap>(
|
|
46
|
-
type: K,
|
|
47
|
-
listener: (this: LoginFormElement, ev: LoginEventMap[K]) => void,
|
|
48
|
-
options?: boolean | AddEventListenerOptions
|
|
49
|
-
): void;
|
|
7
|
+
import { LoginForm } from '@vaadin/login/src/vaadin-login-form.js';
|
|
50
8
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
): void;
|
|
56
|
-
}
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated Import `LoginForm` from `@vaadin/login/vaadin-login-form` instead.
|
|
11
|
+
*/
|
|
12
|
+
export type LoginFormElement = LoginForm;
|
|
57
13
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated Import `LoginForm` from `@vaadin/login/vaadin-login-form` instead.
|
|
16
|
+
*/
|
|
17
|
+
export const LoginFormElement: typeof LoginForm;
|
|
63
18
|
|
|
64
|
-
export
|
|
19
|
+
export * from '@vaadin/login/src/vaadin-login-form.js';
|
package/src/vaadin-login-form.js
CHANGED
|
@@ -4,205 +4,11 @@
|
|
|
4
4
|
* Copyright (C) 2020 Vaadin Ltd
|
|
5
5
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
8
|
-
import { LoginMixin } from './vaadin-login-mixin.js';
|
|
9
|
-
import { ElementMixin } from '@vaadin/vaadin-element-mixin/vaadin-element-mixin.js';
|
|
10
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
11
|
-
import '@vaadin/vaadin-text-field/src/vaadin-text-field.js';
|
|
12
|
-
import '@vaadin/password-field/src/vaadin-password-field.js';
|
|
13
|
-
import './vaadin-login-form-wrapper.js';
|
|
7
|
+
import { LoginForm } from '@vaadin/login/src/vaadin-login-form.js';
|
|
14
8
|
|
|
15
9
|
/**
|
|
16
|
-
*
|
|
17
|
-
* to log in into an application. Note that component has no shadowRoot.
|
|
18
|
-
*
|
|
19
|
-
* ```
|
|
20
|
-
* <vaadin-login-form></vaadin-login-form>
|
|
21
|
-
* ```
|
|
22
|
-
*
|
|
23
|
-
* Component has to be accessible from the `document` layer in order to allow password managers to work properly with form values.
|
|
24
|
-
* Using `<vaadin-login-overlay>` allows to always attach the component to the document body.
|
|
25
|
-
*
|
|
26
|
-
* ### Styling
|
|
27
|
-
*
|
|
28
|
-
* The component doesn't have a shadowRoot, so the `<form>` and input fields can be styled from a global scope.
|
|
29
|
-
* Use `<vaadin-login-form-wrapper>` themable component to apply styles.
|
|
30
|
-
*
|
|
31
|
-
* The following shadow DOM parts of the `<vaadin-login-form-wrapper>` are available for styling:
|
|
32
|
-
*
|
|
33
|
-
* Part name | Description
|
|
34
|
-
* ---------------|---------------------------------------------------------|
|
|
35
|
-
* `form` | Container for the entire component's content
|
|
36
|
-
* `form-title` | Title of the login form
|
|
37
|
-
* `error-message`| Container for error message, contains error-message-title and error-message-description parts. Hidden by default.
|
|
38
|
-
* `error-message-title` | Container for error message title
|
|
39
|
-
* `error-message-description` | Container for error message description
|
|
40
|
-
* `error-message-description` | Container for error message description
|
|
41
|
-
* `footer` | Container additional information text from `i18n` object
|
|
42
|
-
*
|
|
43
|
-
* See [Styling Components](https://vaadin.com/docs/latest/ds/customization/styling-components) documentation.
|
|
44
|
-
*
|
|
45
|
-
* @fires {CustomEvent} forgot-password - Fired when user clicks on the "Forgot password" button.
|
|
46
|
-
* @fires {CustomEvent} login - Fired when a user submits the login.
|
|
47
|
-
*
|
|
48
|
-
* @extends HTMLElement
|
|
49
|
-
* @mixes ElementMixin
|
|
50
|
-
* @mixes ThemableMixin
|
|
51
|
-
* @mixes LoginMixin
|
|
10
|
+
* @deprecated Import `LoginForm` from `@vaadin/login/vaadin-login-form` instead.
|
|
52
11
|
*/
|
|
53
|
-
|
|
54
|
-
static get template() {
|
|
55
|
-
return html`
|
|
56
|
-
<style>
|
|
57
|
-
[part='vaadin-login-native-form'] * {
|
|
58
|
-
width: 100%;
|
|
59
|
-
}
|
|
60
|
-
</style>
|
|
61
|
-
<vaadin-login-form-wrapper
|
|
62
|
-
theme$="[[theme]]"
|
|
63
|
-
part="vaadin-login-native-form-wrapper"
|
|
64
|
-
action="{{action}}"
|
|
65
|
-
disabled="{{disabled}}"
|
|
66
|
-
error="{{error}}"
|
|
67
|
-
no-forgot-password="{{noForgotPassword}}"
|
|
68
|
-
i18n="{{i18n}}"
|
|
69
|
-
on-login="_retargetEvent"
|
|
70
|
-
on-forgot-password="_retargetEvent"
|
|
71
|
-
>
|
|
72
|
-
<form part="vaadin-login-native-form" method="POST" action$="[[action]]" slot="form">
|
|
73
|
-
<input id="csrf" type="hidden" />
|
|
74
|
-
<vaadin-text-field
|
|
75
|
-
name="username"
|
|
76
|
-
label="[[i18n.form.username]]"
|
|
77
|
-
id="vaadinLoginUsername"
|
|
78
|
-
required
|
|
79
|
-
on-keydown="_handleInputKeydown"
|
|
80
|
-
autocapitalize="none"
|
|
81
|
-
autocorrect="off"
|
|
82
|
-
spellcheck="false"
|
|
83
|
-
>
|
|
84
|
-
<input type="text" slot="input" on-keyup="_handleInputKeyup" />
|
|
85
|
-
</vaadin-text-field>
|
|
12
|
+
export const LoginFormElement = LoginForm;
|
|
86
13
|
|
|
87
|
-
|
|
88
|
-
name="password"
|
|
89
|
-
label="[[i18n.form.password]]"
|
|
90
|
-
id="vaadinLoginPassword"
|
|
91
|
-
required
|
|
92
|
-
on-keydown="_handleInputKeydown"
|
|
93
|
-
spellcheck="false"
|
|
94
|
-
>
|
|
95
|
-
<input type="password" slot="input" on-keyup="_handleInputKeyup" />
|
|
96
|
-
</vaadin-password-field>
|
|
97
|
-
|
|
98
|
-
<vaadin-button part="vaadin-login-submit" theme="primary contained" on-click="submit" disabled$="[[disabled]]"
|
|
99
|
-
>[[i18n.form.submit]]</vaadin-button
|
|
100
|
-
>
|
|
101
|
-
</form>
|
|
102
|
-
</vaadin-login-form-wrapper>
|
|
103
|
-
`;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
static get is() {
|
|
107
|
-
return 'vaadin-login-form';
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/** @protected */
|
|
111
|
-
connectedCallback() {
|
|
112
|
-
super.connectedCallback();
|
|
113
|
-
this._handleInputKeydown = this._handleInputKeydown.bind(this);
|
|
114
|
-
if (!this.noAutofocus) {
|
|
115
|
-
this.$.vaadinLoginUsername.focus();
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* @param {StampedTemplate} dom
|
|
121
|
-
* @return {null}
|
|
122
|
-
* @protected
|
|
123
|
-
*/
|
|
124
|
-
_attachDom(dom) {
|
|
125
|
-
this.appendChild(dom);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
static get observers() {
|
|
129
|
-
return ['_errorChanged(error)'];
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/** @private */
|
|
133
|
-
_errorChanged() {
|
|
134
|
-
if (this.error && !this._preventAutoEnable) {
|
|
135
|
-
this.disabled = false;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
submit() {
|
|
140
|
-
if (this.disabled || !(this.__isValid(this.$.vaadinLoginUsername) && this.__isValid(this.$.vaadinLoginPassword))) {
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
this.error = false;
|
|
145
|
-
this.disabled = true;
|
|
146
|
-
|
|
147
|
-
const loginEventDetails = {
|
|
148
|
-
bubbles: true,
|
|
149
|
-
cancelable: true,
|
|
150
|
-
detail: {
|
|
151
|
-
username: this.$.vaadinLoginUsername.value,
|
|
152
|
-
password: this.$.vaadinLoginPassword.value
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
const firedEvent = this.dispatchEvent(new CustomEvent('login', loginEventDetails));
|
|
157
|
-
if (this.action && firedEvent) {
|
|
158
|
-
const csrfMetaName = document.querySelector('meta[name=_csrf_parameter]');
|
|
159
|
-
const csrfMetaValue = document.querySelector('meta[name=_csrf]');
|
|
160
|
-
if (csrfMetaName && csrfMetaValue) {
|
|
161
|
-
this.$.csrf.name = csrfMetaName.content;
|
|
162
|
-
this.$.csrf.value = csrfMetaValue.content;
|
|
163
|
-
}
|
|
164
|
-
this.querySelector('[part="vaadin-login-native-form"]').submit();
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
/** @private */
|
|
169
|
-
__isValid(input) {
|
|
170
|
-
return (input.validate && input.validate()) || (input.checkValidity && input.checkValidity());
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/** @private */
|
|
174
|
-
_isEnterKey(e) {
|
|
175
|
-
return e.key === 'Enter' || e.keyCode === 13;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/** @private */
|
|
179
|
-
_handleInputKeydown(e) {
|
|
180
|
-
if (this._isEnterKey(e)) {
|
|
181
|
-
const { currentTarget: inputActive } = e;
|
|
182
|
-
const nextInput =
|
|
183
|
-
inputActive.id === 'vaadinLoginUsername' ? this.$.vaadinLoginPassword : this.$.vaadinLoginUsername;
|
|
184
|
-
if (this.__isValid(inputActive)) {
|
|
185
|
-
if (this.__isValid(nextInput)) {
|
|
186
|
-
this.submit();
|
|
187
|
-
} else {
|
|
188
|
-
nextInput.focus();
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
/** @private */
|
|
195
|
-
_handleInputKeyup(e) {
|
|
196
|
-
const isTab = e.key === 'Tab' || e.keyCode === 9;
|
|
197
|
-
const input = e.currentTarget;
|
|
198
|
-
if (isTab && input && input.select) {
|
|
199
|
-
input.select();
|
|
200
|
-
// iOS 9 workaround: https://stackoverflow.com/a/7436574
|
|
201
|
-
setTimeout(() => input.setSelectionRange(0, 9999));
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
customElements.define(LoginFormElement.is, LoginFormElement);
|
|
207
|
-
|
|
208
|
-
export { LoginFormElement };
|
|
14
|
+
export * from '@vaadin/login/src/vaadin-login-form.js';
|
|
@@ -1,74 +1,19 @@
|
|
|
1
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
2
|
-
|
|
3
|
-
import { ElementMixin } from '@vaadin/vaadin-element-mixin/vaadin-element-mixin.js';
|
|
4
|
-
|
|
5
|
-
import { LoginMixin } from './vaadin-login-mixin.js';
|
|
6
|
-
|
|
7
|
-
import { LoginEventMap } from './interfaces';
|
|
8
|
-
|
|
9
1
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* ```
|
|
15
|
-
* <vaadin-login-overlay opened></vaadin-login-overlay>
|
|
16
|
-
* ```
|
|
17
|
-
*
|
|
18
|
-
* ### Styling
|
|
19
|
-
*
|
|
20
|
-
* The component doesn't have a shadowRoot, so the `<form>` and input fields can be styled from a global scope.
|
|
21
|
-
* Use `<vaadin-login-overlay-wrapper>` and `<vaadin-login-form-wrapper>` to apply styles.
|
|
22
|
-
*
|
|
23
|
-
* The following Shadow DOM parts of the `<vaadin-login-overlay-wrapper>` are available for styling:
|
|
24
|
-
*
|
|
25
|
-
* Part name | Description
|
|
26
|
-
* ----------------|---------------------------------------------------------|
|
|
27
|
-
* `card` | Container for the entire component's content
|
|
28
|
-
* `brand` | Container for application title and description
|
|
29
|
-
* `form` | Container for the `<vaadin-login-form>` component
|
|
30
|
-
*
|
|
31
|
-
* See [Styling Components](https://vaadin.com/docs/latest/ds/customization/styling-components) documentation.
|
|
32
|
-
*
|
|
33
|
-
* See [`<vaadin-login-form>`](#/elements/vaadin-login-form)
|
|
34
|
-
* documentation for `<vaadin-login-form-wrapper>` stylable parts.
|
|
35
|
-
*
|
|
36
|
-
* @fires {CustomEvent} forgot-password - Fired when user clicks on the "Forgot password" button.
|
|
37
|
-
* @fires {CustomEvent} login - Fired when a user submits the login.
|
|
2
|
+
* @license
|
|
3
|
+
* Vaadin Login
|
|
4
|
+
* Copyright (C) 2020 Vaadin Ltd
|
|
5
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
38
6
|
*/
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Defines the application description
|
|
42
|
-
*/
|
|
43
|
-
description: string;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* True if the overlay is currently displayed.
|
|
47
|
-
*/
|
|
48
|
-
opened: boolean;
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Defines the application title
|
|
52
|
-
*/
|
|
53
|
-
title: string;
|
|
7
|
+
import { LoginOverlay } from '@vaadin/login/src/vaadin-login-overlay.js';
|
|
54
8
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
): void;
|
|
60
|
-
|
|
61
|
-
removeEventListener<K extends keyof LoginEventMap>(
|
|
62
|
-
type: K,
|
|
63
|
-
listener: (this: LoginOverlayElement, ev: LoginEventMap[K]) => void,
|
|
64
|
-
options?: boolean | EventListenerOptions
|
|
65
|
-
): void;
|
|
66
|
-
}
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated Import `LoginOverlay` from `@vaadin/login` instead.
|
|
11
|
+
*/
|
|
12
|
+
export type LoginOverlayElement = LoginOverlay;
|
|
67
13
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated Import `LoginOverlay` from `@vaadin/login` instead.
|
|
16
|
+
*/
|
|
17
|
+
export const LoginOverlayElement: typeof LoginOverlay;
|
|
73
18
|
|
|
74
|
-
export
|
|
19
|
+
export * from '@vaadin/login/src/vaadin-login-overlay.js';
|
|
@@ -4,195 +4,11 @@
|
|
|
4
4
|
* Copyright (C) 2020 Vaadin Ltd
|
|
5
5
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
8
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
9
|
-
import { ElementMixin } from '@vaadin/vaadin-element-mixin/vaadin-element-mixin.js';
|
|
10
|
-
import { LoginMixin } from './vaadin-login-mixin.js';
|
|
11
|
-
import './vaadin-login-form.js';
|
|
12
|
-
import './vaadin-login-overlay-wrapper.js';
|
|
7
|
+
import { LoginOverlay } from '@vaadin/login/src/vaadin-login-overlay.js';
|
|
13
8
|
|
|
14
9
|
/**
|
|
15
|
-
*
|
|
16
|
-
* having an additional `brand` part for application title and description. Using `<vaadin-login-overlay>` allows
|
|
17
|
-
* password managers to work with login form.
|
|
18
|
-
*
|
|
19
|
-
* ```
|
|
20
|
-
* <vaadin-login-overlay opened></vaadin-login-overlay>
|
|
21
|
-
* ```
|
|
22
|
-
*
|
|
23
|
-
* ### Styling
|
|
24
|
-
*
|
|
25
|
-
* The component doesn't have a shadowRoot, so the `<form>` and input fields can be styled from a global scope.
|
|
26
|
-
* Use `<vaadin-login-overlay-wrapper>` and `<vaadin-login-form-wrapper>` to apply styles.
|
|
27
|
-
*
|
|
28
|
-
* The following shadow DOM parts of the `<vaadin-login-overlay-wrapper>` are available for styling:
|
|
29
|
-
*
|
|
30
|
-
* Part name | Description
|
|
31
|
-
* ----------------|---------------------------------------------------------|
|
|
32
|
-
* `card` | Container for the entire component's content
|
|
33
|
-
* `brand` | Container for application title and description
|
|
34
|
-
* `form` | Container for the `<vaadin-login-form>` component
|
|
35
|
-
*
|
|
36
|
-
* See [Styling Components](https://vaadin.com/docs/latest/ds/customization/styling-components) documentation.
|
|
37
|
-
*
|
|
38
|
-
* See [`<vaadin-login-form>`](#/elements/vaadin-login-form)
|
|
39
|
-
* documentation for `<vaadin-login-form-wrapper>` stylable parts.
|
|
40
|
-
*
|
|
41
|
-
* @fires {CustomEvent} forgot-password - Fired when user clicks on the "Forgot password" button.
|
|
42
|
-
* @fires {CustomEvent} login - Fired when a user submits the login.
|
|
43
|
-
*
|
|
44
|
-
* @extends HTMLElement
|
|
45
|
-
* @mixes ElementMixin
|
|
46
|
-
* @mixes ThemableMixin
|
|
47
|
-
* @mixes LoginMixin
|
|
10
|
+
* @deprecated Import `LoginOverlay` from `@vaadin/login` instead.
|
|
48
11
|
*/
|
|
49
|
-
|
|
50
|
-
static get template() {
|
|
51
|
-
return html`
|
|
52
|
-
<vaadin-login-overlay-wrapper
|
|
53
|
-
id="vaadinLoginOverlayWrapper"
|
|
54
|
-
opened="{{opened}}"
|
|
55
|
-
focus-trap
|
|
56
|
-
with-backdrop
|
|
57
|
-
title="[[title]]"
|
|
58
|
-
description="[[description]]"
|
|
59
|
-
theme$="[[theme]]"
|
|
60
|
-
>
|
|
61
|
-
<vaadin-login-form
|
|
62
|
-
theme="with-overlay"
|
|
63
|
-
id="vaadinLoginForm"
|
|
64
|
-
action="{{action}}"
|
|
65
|
-
disabled="{{disabled}}"
|
|
66
|
-
error="{{error}}"
|
|
67
|
-
no-autofocus="[[noAutofocus]]"
|
|
68
|
-
no-forgot-password="{{noForgotPassword}}"
|
|
69
|
-
i18n="{{i18n}}"
|
|
70
|
-
on-login="_retargetEvent"
|
|
71
|
-
on-forgot-password="_retargetEvent"
|
|
72
|
-
></vaadin-login-form>
|
|
73
|
-
</vaadin-login-overlay-wrapper>
|
|
74
|
-
`;
|
|
75
|
-
}
|
|
12
|
+
export const LoginOverlayElement = LoginOverlay;
|
|
76
13
|
|
|
77
|
-
|
|
78
|
-
return 'vaadin-login-overlay';
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
static get properties() {
|
|
82
|
-
return {
|
|
83
|
-
/**
|
|
84
|
-
* Defines the application description
|
|
85
|
-
* @type {string}
|
|
86
|
-
*/
|
|
87
|
-
description: {
|
|
88
|
-
type: String,
|
|
89
|
-
value: 'Application description',
|
|
90
|
-
notify: true
|
|
91
|
-
},
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* True if the overlay is currently displayed.
|
|
95
|
-
* @type {boolean}
|
|
96
|
-
*/
|
|
97
|
-
opened: {
|
|
98
|
-
type: Boolean,
|
|
99
|
-
value: false,
|
|
100
|
-
observer: '_onOpenedChange'
|
|
101
|
-
},
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Defines the application title
|
|
105
|
-
* @type {string}
|
|
106
|
-
*/
|
|
107
|
-
title: {
|
|
108
|
-
type: String,
|
|
109
|
-
value: 'App name'
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
static get observers() {
|
|
115
|
-
return ['__i18nChanged(i18n.header.*)'];
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/** @protected */
|
|
119
|
-
ready() {
|
|
120
|
-
super.ready();
|
|
121
|
-
|
|
122
|
-
this._preventClosingLogin = this._preventClosingLogin.bind(this);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/** @protected */
|
|
126
|
-
connectedCallback() {
|
|
127
|
-
super.connectedCallback();
|
|
128
|
-
|
|
129
|
-
this.$.vaadinLoginOverlayWrapper.addEventListener('vaadin-overlay-outside-click', this._preventClosingLogin);
|
|
130
|
-
this.$.vaadinLoginOverlayWrapper.addEventListener('vaadin-overlay-escape-press', this._preventClosingLogin);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/** @protected */
|
|
134
|
-
disconnectedCallback() {
|
|
135
|
-
super.disconnectedCallback();
|
|
136
|
-
|
|
137
|
-
this.$.vaadinLoginOverlayWrapper.removeEventListener('vaadin-overlay-outside-click', this._preventClosingLogin);
|
|
138
|
-
this.$.vaadinLoginOverlayWrapper.removeEventListener('vaadin-overlay-escape-press', this._preventClosingLogin);
|
|
139
|
-
this.$.vaadinLoginOverlayWrapper.opened = false;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/** @private */
|
|
143
|
-
__i18nChanged(i18n) {
|
|
144
|
-
const header = i18n.base;
|
|
145
|
-
if (!header) {
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
this.title = header.title;
|
|
149
|
-
this.description = header.description;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
/** @private */
|
|
153
|
-
_preventClosingLogin(e) {
|
|
154
|
-
e.preventDefault();
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/** @private */
|
|
158
|
-
_onOpenedChange() {
|
|
159
|
-
if (!this.opened) {
|
|
160
|
-
this.$.vaadinLoginForm.$.vaadinLoginUsername.value = '';
|
|
161
|
-
this.$.vaadinLoginForm.$.vaadinLoginPassword.value = '';
|
|
162
|
-
this.disabled = false;
|
|
163
|
-
|
|
164
|
-
if (this._undoTeleport) {
|
|
165
|
-
this._undoTeleport();
|
|
166
|
-
}
|
|
167
|
-
} else {
|
|
168
|
-
this._undoTeleport = this._teleport(this._getElementsToTeleport());
|
|
169
|
-
|
|
170
|
-
// Overlay sets pointerEvents on body to `none`, which breaks LastPass popup
|
|
171
|
-
// Reverting it back to the previous state
|
|
172
|
-
// https://github.com/vaadin/vaadin-overlay/blob/041cde4481b6262eac68d3a699f700216d897373/src/vaadin-overlay.html#L660
|
|
173
|
-
document.body.style.pointerEvents = this.$.vaadinLoginOverlayWrapper._previousDocumentPointerEvents;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/** @private */
|
|
178
|
-
_teleport(elements) {
|
|
179
|
-
const teleported = Array.from(elements).map((e) => {
|
|
180
|
-
return this.$.vaadinLoginOverlayWrapper.appendChild(e);
|
|
181
|
-
});
|
|
182
|
-
// Function to undo the teleport
|
|
183
|
-
return () => {
|
|
184
|
-
while (teleported.length > 0) {
|
|
185
|
-
this.appendChild(teleported.shift());
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
/** @private */
|
|
191
|
-
_getElementsToTeleport() {
|
|
192
|
-
return this.querySelectorAll('[slot=title]');
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
customElements.define(LoginOverlayElement.is, LoginOverlayElement);
|
|
197
|
-
|
|
198
|
-
export { LoginOverlayElement };
|
|
14
|
+
export * from '@vaadin/login/src/vaadin-login-overlay.js';
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
import '@vaadin/
|
|
2
|
-
import '@vaadin/password-field/theme/lumo/vaadin-password-field.js';
|
|
3
|
-
import './vaadin-login-form-wrapper.js';
|
|
4
|
-
import './vaadin-login-form-styles.js';
|
|
5
|
-
import '../../src/vaadin-login-form.js';
|
|
1
|
+
import '@vaadin/login/theme/lumo/vaadin-login-form.js';
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
import '@vaadin/
|
|
2
|
-
import '@vaadin/vaadin-text-field/theme/lumo/vaadin-password-field.js';
|
|
3
|
-
import '@vaadin/button/theme/lumo/vaadin-button.js';
|
|
4
|
-
import '@vaadin/vaadin-overlay/theme/lumo/vaadin-overlay.js';
|
|
5
|
-
import './vaadin-login-form.js';
|
|
6
|
-
import './vaadin-login-overlay-styles.js';
|
|
7
|
-
import '../../src/vaadin-login-overlay.js';
|
|
1
|
+
import '@vaadin/login/theme/lumo/vaadin-login-overlay.js';
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
import '@vaadin/
|
|
2
|
-
import '@vaadin/password-field/theme/material/vaadin-password-field.js';
|
|
3
|
-
import './vaadin-login-form-wrapper.js';
|
|
4
|
-
import './vaadin-login-form-styles.js';
|
|
5
|
-
import '../../src/vaadin-login-form.js';
|
|
1
|
+
import '@vaadin/login/theme/material/vaadin-login-form.js';
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
import '@vaadin/
|
|
2
|
-
import '@vaadin/vaadin-text-field/theme/material/vaadin-password-field.js';
|
|
3
|
-
import '@vaadin/button/theme/material/vaadin-button.js';
|
|
4
|
-
import '@vaadin/vaadin-overlay/theme/material/vaadin-overlay.js';
|
|
5
|
-
import './vaadin-login-form.js';
|
|
6
|
-
import './vaadin-login-overlay-styles.js';
|
|
7
|
-
import '../../src/vaadin-login-overlay.js';
|
|
1
|
+
import '@vaadin/login/theme/material/vaadin-login-overlay.js';
|