@vaadin/login 24.8.4 → 25.0.0-alpha10
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/README.md +0 -26
- package/package.json +17 -17
- package/src/styles/vaadin-login-form-wrapper-base-styles.js +65 -0
- package/src/styles/vaadin-login-form-wrapper-core-styles.d.ts +8 -0
- package/src/{vaadin-login-form-wrapper-styles.js → styles/vaadin-login-form-wrapper-core-styles.js} +8 -9
- package/src/styles/vaadin-login-overlay-wrapper-base-styles.js +55 -0
- package/src/styles/vaadin-login-overlay-wrapper-core-styles.d.ts +8 -0
- package/src/{vaadin-login-overlay-wrapper-styles.js → styles/vaadin-login-overlay-wrapper-core-styles.js} +5 -2
- package/src/title-controller.d.ts +11 -0
- package/src/title-controller.js +100 -0
- package/src/vaadin-login-form-mixin.js +93 -17
- package/src/vaadin-login-form-wrapper.js +34 -40
- package/src/vaadin-login-form.d.ts +2 -5
- package/src/vaadin-login-form.js +41 -76
- package/src/vaadin-login-overlay-mixin.d.ts +1 -2
- package/src/vaadin-login-overlay-mixin.js +59 -85
- package/src/vaadin-login-overlay-wrapper.js +39 -18
- package/src/vaadin-login-overlay.d.ts +29 -19
- package/src/vaadin-login-overlay.js +80 -49
- package/theme/lumo/vaadin-login-form-wrapper-styles.d.ts +3 -0
- package/theme/lumo/vaadin-login-form-wrapper-styles.js +11 -7
- package/theme/lumo/vaadin-login-overlay-styles.d.ts +2 -1
- package/theme/lumo/vaadin-login-overlay-styles.js +18 -33
- package/theme/lumo/vaadin-login-overlay.d.ts +2 -2
- package/theme/lumo/vaadin-login-overlay.js +2 -2
- package/web-types.json +7 -3
- package/web-types.lit.json +10 -3
- package/src/vaadin-lit-login-form-wrapper.js +0 -86
- package/src/vaadin-lit-login-form.js +0 -112
- package/src/vaadin-lit-login-overlay-wrapper.js +0 -52
- package/src/vaadin-lit-login-overlay.js +0 -83
- package/src/vaadin-login-overlay-wrapper-mixin.js +0 -78
- package/theme/lumo/vaadin-lit-login-form.d.ts +0 -5
- package/theme/lumo/vaadin-lit-login-form.js +0 -5
- package/theme/lumo/vaadin-lit-login-overlay.d.ts +0 -3
- package/theme/lumo/vaadin-lit-login-overlay.js +0 -3
- package/theme/material/vaadin-lit-login-form.d.ts +0 -5
- package/theme/material/vaadin-lit-login-form.js +0 -5
- package/theme/material/vaadin-lit-login-overlay.d.ts +0 -3
- package/theme/material/vaadin-lit-login-overlay.js +0 -3
- package/theme/material/vaadin-login-form-wrapper-styles.d.ts +0 -1
- package/theme/material/vaadin-login-form-wrapper-styles.js +0 -109
- package/theme/material/vaadin-login-form.d.ts +0 -5
- package/theme/material/vaadin-login-form.js +0 -5
- package/theme/material/vaadin-login-overlay-styles.d.ts +0 -1
- package/theme/material/vaadin-login-overlay-styles.js +0 -352
- package/theme/material/vaadin-login-overlay.d.ts +0 -6
- package/theme/material/vaadin-login-overlay.js +0 -6
- package/vaadin-lit-login-form.d.ts +0 -1
- package/vaadin-lit-login-form.js +0 -3
- package/vaadin-lit-login-overlay.d.ts +0 -1
- package/vaadin-lit-login-overlay.js +0 -3
- /package/src/{vaadin-login-form-wrapper-styles.d.ts → styles/vaadin-login-form-wrapper-base-styles.d.ts} +0 -0
- /package/src/{vaadin-login-overlay-wrapper-styles.d.ts → styles/vaadin-login-overlay-wrapper-base-styles.d.ts} +0 -0
|
@@ -39,7 +39,7 @@ export interface LoginFormEventMap extends HTMLElementEventMap, LoginFormCustomE
|
|
|
39
39
|
* `<vaadin-login-form>` is a Web Component providing an easy way to require users
|
|
40
40
|
* to log in into an application. Note that component has no shadowRoot.
|
|
41
41
|
*
|
|
42
|
-
* ```
|
|
42
|
+
* ```html
|
|
43
43
|
* <vaadin-login-form></vaadin-login-form>
|
|
44
44
|
* ```
|
|
45
45
|
*
|
|
@@ -48,10 +48,7 @@ export interface LoginFormEventMap extends HTMLElementEventMap, LoginFormCustomE
|
|
|
48
48
|
*
|
|
49
49
|
* ### Styling
|
|
50
50
|
*
|
|
51
|
-
* The
|
|
52
|
-
*
|
|
53
|
-
* Use `<vaadin-login-form-wrapper>` themable component to apply styles.
|
|
54
|
-
* The following shadow DOM parts of the `<vaadin-login-form-wrapper>` are available for styling:
|
|
51
|
+
* The following shadow DOM parts are available for styling:
|
|
55
52
|
*
|
|
56
53
|
* Part name | Description
|
|
57
54
|
* ---------------|---------------------------------------------------------|
|
package/src/vaadin-login-form.js
CHANGED
|
@@ -7,9 +7,11 @@ import '@vaadin/button/src/vaadin-button.js';
|
|
|
7
7
|
import '@vaadin/text-field/src/vaadin-text-field.js';
|
|
8
8
|
import '@vaadin/password-field/src/vaadin-password-field.js';
|
|
9
9
|
import './vaadin-login-form-wrapper.js';
|
|
10
|
-
import { html,
|
|
10
|
+
import { css, html, LitElement } from 'lit';
|
|
11
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
11
12
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
12
13
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
14
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
13
15
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
14
16
|
import { LoginFormMixin } from './vaadin-login-form-mixin.js';
|
|
15
17
|
|
|
@@ -17,7 +19,7 @@ import { LoginFormMixin } from './vaadin-login-form-mixin.js';
|
|
|
17
19
|
* `<vaadin-login-form>` is a Web Component providing an easy way to require users
|
|
18
20
|
* to log in into an application. Note that component has no shadowRoot.
|
|
19
21
|
*
|
|
20
|
-
* ```
|
|
22
|
+
* ```html
|
|
21
23
|
* <vaadin-login-form></vaadin-login-form>
|
|
22
24
|
* ```
|
|
23
25
|
*
|
|
@@ -26,10 +28,7 @@ import { LoginFormMixin } from './vaadin-login-form-mixin.js';
|
|
|
26
28
|
*
|
|
27
29
|
* ### Styling
|
|
28
30
|
*
|
|
29
|
-
* The
|
|
30
|
-
* Use `<vaadin-login-form-wrapper>` themable component to apply styles.
|
|
31
|
-
*
|
|
32
|
-
* The following shadow DOM parts of the `<vaadin-login-form-wrapper>` are available for styling:
|
|
31
|
+
* The following shadow DOM parts are available for styling:
|
|
33
32
|
*
|
|
34
33
|
* Part name | Description
|
|
35
34
|
* ---------------|---------------------------------------------------------|
|
|
@@ -53,81 +52,47 @@ import { LoginFormMixin } from './vaadin-login-form-mixin.js';
|
|
|
53
52
|
* @mixes ThemableMixin
|
|
54
53
|
* @mixes LoginFormMixin
|
|
55
54
|
*/
|
|
56
|
-
class LoginForm extends LoginFormMixin(ElementMixin(ThemableMixin(
|
|
57
|
-
static get
|
|
58
|
-
return
|
|
59
|
-
|
|
60
|
-
vaadin-login-form-wrapper > form > * {
|
|
61
|
-
width: 100%;
|
|
62
|
-
}
|
|
63
|
-
</style>
|
|
64
|
-
<vaadin-login-form-wrapper
|
|
65
|
-
id="vaadinLoginFormWrapper"
|
|
66
|
-
theme$="[[_theme]]"
|
|
67
|
-
error="[[error]]"
|
|
68
|
-
i18n="[[__effectiveI18n]]"
|
|
69
|
-
heading-level="[[headingLevel]]"
|
|
70
|
-
>
|
|
71
|
-
<form method="POST" action$="[[action]]" on-formdata="_onFormData" slot="form">
|
|
72
|
-
<input id="csrf" type="hidden" />
|
|
73
|
-
<vaadin-text-field
|
|
74
|
-
name="username"
|
|
75
|
-
label="[[__effectiveI18n.form.username]]"
|
|
76
|
-
error-message="[[__effectiveI18n.errorMessage.username]]"
|
|
77
|
-
id="vaadinLoginUsername"
|
|
78
|
-
required
|
|
79
|
-
on-keydown="_handleInputKeydown"
|
|
80
|
-
autocapitalize="none"
|
|
81
|
-
autocorrect="off"
|
|
82
|
-
spellcheck="false"
|
|
83
|
-
autocomplete="username"
|
|
84
|
-
manual-validation
|
|
85
|
-
>
|
|
86
|
-
<input type="text" slot="input" on-keyup="_handleInputKeyup" />
|
|
87
|
-
</vaadin-text-field>
|
|
88
|
-
|
|
89
|
-
<vaadin-password-field
|
|
90
|
-
name="password"
|
|
91
|
-
label="[[__effectiveI18n.form.password]]"
|
|
92
|
-
error-message="[[__effectiveI18n.errorMessage.password]]"
|
|
93
|
-
id="vaadinLoginPassword"
|
|
94
|
-
required
|
|
95
|
-
on-keydown="_handleInputKeydown"
|
|
96
|
-
spellcheck="false"
|
|
97
|
-
autocomplete="current-password"
|
|
98
|
-
manual-validation
|
|
99
|
-
>
|
|
100
|
-
<input type="password" slot="input" on-keyup="_handleInputKeyup" />
|
|
101
|
-
</vaadin-password-field>
|
|
102
|
-
</form>
|
|
55
|
+
class LoginForm extends LoginFormMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement)))) {
|
|
56
|
+
static get is() {
|
|
57
|
+
return 'vaadin-login-form';
|
|
58
|
+
}
|
|
103
59
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
60
|
+
static get styles() {
|
|
61
|
+
return css`
|
|
62
|
+
:host {
|
|
63
|
+
display: block;
|
|
64
|
+
max-width: max-content;
|
|
65
|
+
}
|
|
107
66
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
on-click="_onForgotPasswordClick"
|
|
112
|
-
hidden$="[[noForgotPassword]]"
|
|
113
|
-
>
|
|
114
|
-
[[__effectiveI18n.form.forgotPassword]]
|
|
115
|
-
</vaadin-button>
|
|
116
|
-
</vaadin-login-form-wrapper>
|
|
67
|
+
:host([hidden]) {
|
|
68
|
+
display: none !important;
|
|
69
|
+
}
|
|
117
70
|
`;
|
|
118
71
|
}
|
|
119
72
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
73
|
+
/** @protected */
|
|
74
|
+
render() {
|
|
75
|
+
return html`
|
|
76
|
+
<vaadin-login-form-wrapper
|
|
77
|
+
id="form"
|
|
78
|
+
theme="${ifDefined(this._theme)}"
|
|
79
|
+
.error="${this.error}"
|
|
80
|
+
.i18n="${this.__effectiveI18n}"
|
|
81
|
+
part="form"
|
|
82
|
+
role="region"
|
|
83
|
+
aria-labelledby="title"
|
|
84
|
+
exportparts="error-message, error-message-title, error-message-description, footer"
|
|
85
|
+
>
|
|
86
|
+
<div id="title" slot="form-title" part="form-title" role="heading" aria-level="${this.headingLevel}">
|
|
87
|
+
${this.__effectiveI18n.form.title}
|
|
88
|
+
</div>
|
|
89
|
+
<slot name="form" slot="form"></slot>
|
|
90
|
+
<slot name="custom-form-area" slot="custom-form-area"></slot>
|
|
91
|
+
<slot name="submit" slot="submit"></slot>
|
|
92
|
+
<slot name="forgot-password" slot="forgot-password"></slot>
|
|
93
|
+
<slot name="footer" slot="footer"></slot>
|
|
94
|
+
</vaadin-login-form-wrapper>
|
|
95
|
+
`;
|
|
131
96
|
}
|
|
132
97
|
}
|
|
133
98
|
|
|
@@ -5,11 +5,10 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
7
|
import type { OverlayClassMixinClass } from '@vaadin/component-base/src/overlay-class-mixin.js';
|
|
8
|
-
import type { LoginMixinClass } from './vaadin-login-mixin.js';
|
|
9
8
|
|
|
10
9
|
export declare function LoginOverlayMixin<T extends Constructor<HTMLElement>>(
|
|
11
10
|
base: T,
|
|
12
|
-
): Constructor<
|
|
11
|
+
): Constructor<LoginOverlayMixinClass> & Constructor<OverlayClassMixinClass> & T;
|
|
13
12
|
|
|
14
13
|
export declare class LoginOverlayMixinClass {
|
|
15
14
|
/**
|
|
@@ -4,15 +4,14 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { OverlayClassMixin } from '@vaadin/component-base/src/overlay-class-mixin.js';
|
|
7
|
-
import {
|
|
7
|
+
import { TitleController } from './title-controller.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @polymerMixin
|
|
11
|
-
* @mixes LoginMixin
|
|
12
11
|
* @mixes OverlayClassMixin
|
|
13
12
|
*/
|
|
14
13
|
export const LoginOverlayMixin = (superClass) =>
|
|
15
|
-
class LoginOverlayMixin extends OverlayClassMixin(
|
|
14
|
+
class LoginOverlayMixin extends OverlayClassMixin(superClass) {
|
|
16
15
|
static get properties() {
|
|
17
16
|
return {
|
|
18
17
|
/**
|
|
@@ -32,7 +31,8 @@ export const LoginOverlayMixin = (superClass) =>
|
|
|
32
31
|
opened: {
|
|
33
32
|
type: Boolean,
|
|
34
33
|
value: false,
|
|
35
|
-
|
|
34
|
+
reflectToAttribute: true,
|
|
35
|
+
sync: true,
|
|
36
36
|
},
|
|
37
37
|
|
|
38
38
|
/**
|
|
@@ -46,15 +46,43 @@ export const LoginOverlayMixin = (superClass) =>
|
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
/** @protected */
|
|
50
|
+
firstUpdated() {
|
|
51
|
+
super.firstUpdated();
|
|
52
|
+
|
|
53
|
+
this.setAttribute('role', 'dialog');
|
|
54
|
+
|
|
55
|
+
this.__titleController = new TitleController(this);
|
|
56
|
+
this.addController(this.__titleController);
|
|
57
|
+
|
|
58
|
+
this._overlayElement = this.$.overlay;
|
|
51
59
|
}
|
|
52
60
|
|
|
53
61
|
/** @protected */
|
|
54
|
-
|
|
55
|
-
super.
|
|
62
|
+
willUpdate(props) {
|
|
63
|
+
super.willUpdate(props);
|
|
64
|
+
|
|
65
|
+
if (props.has('__effectiveI18n') && this.__effectiveI18n.header) {
|
|
66
|
+
this.title = this.__effectiveI18n.header.title;
|
|
67
|
+
this.description = this.__effectiveI18n.header.description;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** @protected */
|
|
72
|
+
updated(props) {
|
|
73
|
+
super.updated(props);
|
|
74
|
+
|
|
75
|
+
if (props.has('title') || props.has('__effectiveI18n')) {
|
|
76
|
+
this.__titleController.setTitle(this.title);
|
|
77
|
+
}
|
|
56
78
|
|
|
57
|
-
|
|
79
|
+
if (props.has('headingLevel')) {
|
|
80
|
+
this.__titleController.setLevel(this.headingLevel);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (props.has('opened')) {
|
|
84
|
+
this._openedChanged(this.opened);
|
|
85
|
+
}
|
|
58
86
|
}
|
|
59
87
|
|
|
60
88
|
/** @protected */
|
|
@@ -71,19 +99,14 @@ export const LoginOverlayMixin = (superClass) =>
|
|
|
71
99
|
disconnectedCallback() {
|
|
72
100
|
super.disconnectedCallback();
|
|
73
101
|
|
|
74
|
-
//
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
if (!header) {
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
this.title = header.title;
|
|
86
|
-
this.description = header.description;
|
|
102
|
+
// Using a timeout to avoid toggling opened state
|
|
103
|
+
// when just moving the overlay in the DOM
|
|
104
|
+
setTimeout(() => {
|
|
105
|
+
if (!this.isConnected) {
|
|
106
|
+
this.__restoreOpened = this.opened;
|
|
107
|
+
this.opened = false;
|
|
108
|
+
}
|
|
109
|
+
});
|
|
87
110
|
}
|
|
88
111
|
|
|
89
112
|
/** @protected */
|
|
@@ -91,77 +114,28 @@ export const LoginOverlayMixin = (superClass) =>
|
|
|
91
114
|
e.preventDefault();
|
|
92
115
|
}
|
|
93
116
|
|
|
94
|
-
/**
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
*/
|
|
98
|
-
_retargetEvent(e) {
|
|
99
|
-
e.stopPropagation();
|
|
100
|
-
const { detail, composed, cancelable, bubbles } = e;
|
|
101
|
-
|
|
102
|
-
const firedEvent = this.dispatchEvent(new CustomEvent(e.type, { bubbles, cancelable, composed, detail }));
|
|
103
|
-
// Check if `eventTarget.preventDefault()` was called to prevent default in the original event
|
|
104
|
-
if (!firedEvent) {
|
|
105
|
-
e.preventDefault();
|
|
106
|
-
}
|
|
117
|
+
/** @private */
|
|
118
|
+
__handleOverlayClosed() {
|
|
119
|
+
this.dispatchEvent(new CustomEvent('closed'));
|
|
107
120
|
}
|
|
108
121
|
|
|
109
122
|
/** @private */
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
form.$.vaadinLoginUsername.value = '';
|
|
115
|
-
form.$.vaadinLoginPassword.value = '';
|
|
123
|
+
_openedChanged(opened, oldOpened) {
|
|
124
|
+
if (oldOpened) {
|
|
125
|
+
this._userNameField.value = '';
|
|
126
|
+
this._passwordField.value = '';
|
|
116
127
|
this.disabled = false;
|
|
117
|
-
|
|
118
|
-
if (this._undoTitleTeleport) {
|
|
119
|
-
this._undoTitleTeleport();
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if (this._undoFieldsTeleport) {
|
|
123
|
-
this._undoFieldsTeleport();
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
if (this._undoFooterTeleport) {
|
|
127
|
-
this._undoFooterTeleport();
|
|
128
|
-
}
|
|
129
|
-
} else {
|
|
130
|
-
this._undoTitleTeleport = this._teleport('title', this.$.vaadinLoginOverlayWrapper);
|
|
131
|
-
|
|
132
|
-
this._undoFieldsTeleport = this._teleport(
|
|
133
|
-
'custom-form-area',
|
|
134
|
-
form.$.vaadinLoginFormWrapper,
|
|
135
|
-
form.querySelector('vaadin-button'),
|
|
136
|
-
);
|
|
137
|
-
|
|
138
|
-
this._undoFooterTeleport = this._teleport('footer', form.$.vaadinLoginFormWrapper);
|
|
139
|
-
|
|
128
|
+
} else if (opened) {
|
|
140
129
|
// Overlay sets pointerEvents on body to `none`, which breaks LastPass popup
|
|
141
130
|
// Reverting it back to the previous state
|
|
142
131
|
// https://github.com/vaadin/vaadin-overlay/blob/041cde4481b6262eac68d3a699f700216d897373/src/vaadin-overlay.html#L660
|
|
143
|
-
document.body.style.pointerEvents = this.$.
|
|
132
|
+
document.body.style.pointerEvents = this.$.overlay._previousDocumentPointerEvents;
|
|
144
133
|
}
|
|
145
134
|
}
|
|
146
135
|
|
|
147
|
-
/**
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
} else {
|
|
153
|
-
target.appendChild(el);
|
|
154
|
-
}
|
|
155
|
-
return el;
|
|
156
|
-
});
|
|
157
|
-
// Function to undo the teleport
|
|
158
|
-
return () => {
|
|
159
|
-
this.append(...teleported);
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
/** @private */
|
|
164
|
-
__computeHeadingLevel(headingLevel) {
|
|
165
|
-
return headingLevel + 1;
|
|
166
|
-
}
|
|
136
|
+
/**
|
|
137
|
+
* Fired when the overlay is closed.
|
|
138
|
+
*
|
|
139
|
+
* @event closed
|
|
140
|
+
*/
|
|
167
141
|
};
|
|
@@ -3,43 +3,64 @@
|
|
|
3
3
|
* Copyright (c) 2018 - 2025 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
import { html,
|
|
6
|
+
import { html, LitElement } from 'lit';
|
|
7
7
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
moduleId: 'vaadin-login-overlay-wrapper-styles',
|
|
15
|
-
});
|
|
8
|
+
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
9
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
10
|
+
import { OverlayMixin } from '@vaadin/overlay/src/vaadin-overlay-mixin.js';
|
|
11
|
+
import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
|
|
12
|
+
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
13
|
+
import { loginOverlayWrapperStyles } from './styles/vaadin-login-overlay-wrapper-core-styles.js';
|
|
16
14
|
|
|
17
15
|
/**
|
|
18
16
|
* An element used internally by `<vaadin-login-overlay>`. Not intended to be used separately.
|
|
19
17
|
*
|
|
20
18
|
* @extends HTMLElement
|
|
21
|
-
* @mixes
|
|
19
|
+
* @mixes DirMixin
|
|
20
|
+
* @mixes OverlayMixin
|
|
22
21
|
* @mixes ThemableMixin
|
|
23
22
|
* @private
|
|
24
23
|
*/
|
|
25
|
-
class LoginOverlayWrapper extends
|
|
24
|
+
class LoginOverlayWrapper extends OverlayMixin(DirMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement))))) {
|
|
26
25
|
static get is() {
|
|
27
26
|
return 'vaadin-login-overlay-wrapper';
|
|
28
27
|
}
|
|
29
28
|
|
|
30
|
-
static get
|
|
29
|
+
static get styles() {
|
|
30
|
+
return loginOverlayWrapperStyles;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
static get properties() {
|
|
34
|
+
return {
|
|
35
|
+
/**
|
|
36
|
+
* Application description. Displayed under the title.
|
|
37
|
+
*/
|
|
38
|
+
description: {
|
|
39
|
+
type: String,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @protected
|
|
46
|
+
* @override
|
|
47
|
+
*/
|
|
48
|
+
get _modalRoot() {
|
|
49
|
+
return this.owner;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** @protected */
|
|
53
|
+
render() {
|
|
31
54
|
return html`
|
|
32
|
-
<div id="backdrop" part="backdrop" hidden
|
|
55
|
+
<div id="backdrop" part="backdrop" ?hidden="${!this.withBackdrop}"></div>
|
|
33
56
|
<div part="overlay" id="overlay" tabindex="0">
|
|
34
57
|
<div part="content" id="content">
|
|
35
58
|
<section part="card">
|
|
36
59
|
<div part="brand">
|
|
37
|
-
<slot name="title">
|
|
38
|
-
|
|
39
|
-
</slot>
|
|
40
|
-
<p part="description">[[description]]</p>
|
|
60
|
+
<slot name="title"></slot>
|
|
61
|
+
<div part="description">${this.description}</div>
|
|
41
62
|
</div>
|
|
42
|
-
<div part="form">
|
|
63
|
+
<div part="form-wrapper">
|
|
43
64
|
<slot></slot>
|
|
44
65
|
</div>
|
|
45
66
|
</section>
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
7
7
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
8
|
+
import { LoginFormMixin } from './vaadin-login-form-mixin.js';
|
|
8
9
|
import { LoginOverlayMixin } from './vaadin-login-overlay-mixin.js';
|
|
9
10
|
|
|
10
11
|
export { LoginI18n } from './vaadin-login-mixin.js';
|
|
@@ -33,6 +34,11 @@ export type LoginOverlayLoginEvent = CustomEvent<{
|
|
|
33
34
|
custom?: Record<string, unknown>;
|
|
34
35
|
}>;
|
|
35
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Fired when the overlay is closed.
|
|
39
|
+
*/
|
|
40
|
+
export type LoginOverlayClosedEvent = CustomEvent;
|
|
41
|
+
|
|
36
42
|
export interface LoginOverlayCustomEventMap {
|
|
37
43
|
'description-changed': LoginOverlayDescriptionChangedEvent;
|
|
38
44
|
|
|
@@ -43,44 +49,48 @@ export interface LoginOverlayCustomEventMap {
|
|
|
43
49
|
'forgot-password': Event;
|
|
44
50
|
|
|
45
51
|
login: LoginOverlayLoginEvent;
|
|
52
|
+
|
|
53
|
+
closed: LoginOverlayClosedEvent;
|
|
46
54
|
}
|
|
47
55
|
|
|
48
56
|
export interface LoginOverlayEventMap extends HTMLElementEventMap, LoginOverlayCustomEventMap {}
|
|
49
57
|
|
|
50
58
|
/**
|
|
51
|
-
* `<vaadin-login-overlay>` is a
|
|
52
|
-
*
|
|
53
|
-
* password managers to work with login form.
|
|
59
|
+
* `<vaadin-login-overlay>` is a web component which renders a login form in an overlay and
|
|
60
|
+
* provides an additional `brand` part for application title and description.
|
|
54
61
|
*
|
|
55
|
-
* ```
|
|
62
|
+
* ```html
|
|
56
63
|
* <vaadin-login-overlay opened></vaadin-login-overlay>
|
|
57
64
|
* ```
|
|
58
65
|
*
|
|
59
66
|
* ### Styling
|
|
60
67
|
*
|
|
61
|
-
* The
|
|
62
|
-
* Use `<vaadin-login-overlay-wrapper>` and `<vaadin-login-form-wrapper>` to apply styles.
|
|
63
|
-
*
|
|
64
|
-
* The following Shadow DOM parts of the `<vaadin-login-overlay-wrapper>` are available for styling:
|
|
65
|
-
*
|
|
66
|
-
* Part name | Description
|
|
67
|
-
* ----------------|---------------------------------------------------------|
|
|
68
|
-
* `card` | Container for the entire component's content
|
|
69
|
-
* `brand` | Container for application title and description
|
|
70
|
-
* `form` | Container for the `<vaadin-login-form>` component
|
|
71
|
-
*
|
|
72
|
-
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
68
|
+
* The following shadow DOM parts are available for styling:
|
|
73
69
|
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
70
|
+
* Part name | Description
|
|
71
|
+
* -----------------------------|--------------------------------
|
|
72
|
+
* `backdrop` | Backdrop of the overlay
|
|
73
|
+
* `overlay` | The overlay container element
|
|
74
|
+
* `content` | The overlay content element
|
|
75
|
+
* `card` | Container for the brand and form wrapper
|
|
76
|
+
* `brand` | Container for application title and description
|
|
77
|
+
* `description` | The application description
|
|
78
|
+
* `form-wrapper` | The login form wrapper element
|
|
79
|
+
* `form` | The login form element
|
|
80
|
+
* `form-title` | Title of the login form
|
|
81
|
+
* `error-message` | Container for error message
|
|
82
|
+
* `error-message-title` | Container for error message title
|
|
83
|
+
* `error-message-description` | Container for error message description
|
|
84
|
+
* `footer` | Container for the footer element
|
|
76
85
|
*
|
|
77
86
|
* @fires {CustomEvent} description-changed - Fired when the `description` property changes.
|
|
78
87
|
* @fires {CustomEvent} disabled-changed - Fired when the `disabled` property changes.
|
|
79
88
|
* @fires {CustomEvent} error-changed - Fired when the `error` property changes.
|
|
80
89
|
* @fires {CustomEvent} forgot-password - Fired when user clicks on the "Forgot password" button.
|
|
81
90
|
* @fires {CustomEvent} login - Fired when a user submits the login.
|
|
91
|
+
* @fires {CustomEvent} closed - Fired when the overlay is closed.
|
|
82
92
|
*/
|
|
83
|
-
declare class LoginOverlay extends LoginOverlayMixin(ElementMixin(ThemableMixin(HTMLElement))) {
|
|
93
|
+
declare class LoginOverlay extends LoginFormMixin(LoginOverlayMixin(ElementMixin(ThemableMixin(HTMLElement)))) {
|
|
84
94
|
addEventListener<K extends keyof LoginOverlayEventMap>(
|
|
85
95
|
type: K,
|
|
86
96
|
listener: (this: LoginOverlay, ev: LoginOverlayEventMap[K]) => void,
|