@vaadin/login 25.0.0-alpha2 → 25.0.0-alpha21
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 +14 -14
- package/src/styles/vaadin-login-form-wrapper-base-styles.js +65 -0
- package/src/styles/vaadin-login-overlay-wrapper-base-styles.js +52 -0
- 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 +16 -24
- package/src/vaadin-login-form.d.ts +2 -5
- package/src/vaadin-login-form.js +27 -64
- package/src/vaadin-login-mixin.d.ts +1 -1
- package/src/vaadin-login-mixin.js +1 -1
- package/src/vaadin-login-overlay-mixin.d.ts +1 -3
- package/src/vaadin-login-overlay-mixin.js +60 -87
- package/src/vaadin-login-overlay-wrapper.js +32 -12
- package/src/vaadin-login-overlay.d.ts +29 -19
- package/src/vaadin-login-overlay.js +70 -45
- package/vaadin-login-form.js +1 -1
- package/vaadin-login-overlay.js +1 -1
- package/web-types.json +9 -27
- package/web-types.lit.json +12 -12
- package/src/vaadin-login-form-wrapper-styles.js +0 -32
- package/src/vaadin-login-overlay-wrapper-mixin.js +0 -78
- package/src/vaadin-login-overlay-wrapper-styles.js +0 -35
- package/theme/lumo/vaadin-login-form-wrapper-styles.d.ts +0 -1
- package/theme/lumo/vaadin-login-form-wrapper-styles.js +0 -94
- package/theme/lumo/vaadin-login-form.d.ts +0 -5
- package/theme/lumo/vaadin-login-form.js +0 -5
- package/theme/lumo/vaadin-login-overlay-styles.d.ts +0 -1
- package/theme/lumo/vaadin-login-overlay-styles.js +0 -187
- package/theme/lumo/vaadin-login-overlay.d.ts +0 -6
- package/theme/lumo/vaadin-login-overlay.js +0 -6
- /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
|
@@ -129,7 +129,7 @@ export const LoginMixin = (superClass) =>
|
|
|
129
129
|
* and `header` sections, `header` can be added to override `title` and `description` properties
|
|
130
130
|
* in `vaadin-login-overlay`):
|
|
131
131
|
*
|
|
132
|
-
* ```
|
|
132
|
+
* ```js
|
|
133
133
|
* {
|
|
134
134
|
* header: {
|
|
135
135
|
* title: 'App name',
|
|
@@ -4,12 +4,10 @@
|
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
|
-
import type { OverlayClassMixinClass } from '@vaadin/component-base/src/overlay-class-mixin.js';
|
|
8
|
-
import type { LoginMixinClass } from './vaadin-login-mixin.js';
|
|
9
7
|
|
|
10
8
|
export declare function LoginOverlayMixin<T extends Constructor<HTMLElement>>(
|
|
11
9
|
base: T,
|
|
12
|
-
): Constructor<
|
|
10
|
+
): Constructor<LoginOverlayMixinClass> & T;
|
|
13
11
|
|
|
14
12
|
export declare class LoginOverlayMixinClass {
|
|
15
13
|
/**
|
|
@@ -3,16 +3,13 @@
|
|
|
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 {
|
|
7
|
-
import { LoginMixin } from './vaadin-login-mixin.js';
|
|
6
|
+
import { TitleController } from './title-controller.js';
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* @polymerMixin
|
|
11
|
-
* @mixes LoginMixin
|
|
12
|
-
* @mixes OverlayClassMixin
|
|
13
10
|
*/
|
|
14
11
|
export const LoginOverlayMixin = (superClass) =>
|
|
15
|
-
class LoginOverlayMixin extends
|
|
12
|
+
class LoginOverlayMixin extends superClass {
|
|
16
13
|
static get properties() {
|
|
17
14
|
return {
|
|
18
15
|
/**
|
|
@@ -32,8 +29,8 @@ export const LoginOverlayMixin = (superClass) =>
|
|
|
32
29
|
opened: {
|
|
33
30
|
type: Boolean,
|
|
34
31
|
value: false,
|
|
32
|
+
reflectToAttribute: true,
|
|
35
33
|
sync: true,
|
|
36
|
-
observer: '_onOpenedChange',
|
|
37
34
|
},
|
|
38
35
|
|
|
39
36
|
/**
|
|
@@ -47,15 +44,45 @@ export const LoginOverlayMixin = (superClass) =>
|
|
|
47
44
|
};
|
|
48
45
|
}
|
|
49
46
|
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
/** @protected */
|
|
48
|
+
firstUpdated() {
|
|
49
|
+
super.firstUpdated();
|
|
50
|
+
|
|
51
|
+
this.setAttribute('role', 'dialog');
|
|
52
|
+
this.setAttribute('aria-modal', 'true');
|
|
53
|
+
this.setAttribute('tabindex', '0');
|
|
54
|
+
|
|
55
|
+
this.__titleController = new TitleController(this);
|
|
56
|
+
this.addController(this.__titleController);
|
|
57
|
+
|
|
58
|
+
this._overlayElement = this.$.overlay;
|
|
52
59
|
}
|
|
53
60
|
|
|
54
61
|
/** @protected */
|
|
55
|
-
|
|
56
|
-
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
|
+
}
|
|
57
78
|
|
|
58
|
-
|
|
79
|
+
if (props.has('headingLevel')) {
|
|
80
|
+
this.__titleController.setLevel(this.headingLevel);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (props.has('opened')) {
|
|
84
|
+
this._openedChanged(this.opened);
|
|
85
|
+
}
|
|
59
86
|
}
|
|
60
87
|
|
|
61
88
|
/** @protected */
|
|
@@ -72,19 +99,14 @@ export const LoginOverlayMixin = (superClass) =>
|
|
|
72
99
|
disconnectedCallback() {
|
|
73
100
|
super.disconnectedCallback();
|
|
74
101
|
|
|
75
|
-
//
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
if (!header) {
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
this.title = header.title;
|
|
87
|
-
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
|
+
});
|
|
88
110
|
}
|
|
89
111
|
|
|
90
112
|
/** @protected */
|
|
@@ -92,77 +114,28 @@ export const LoginOverlayMixin = (superClass) =>
|
|
|
92
114
|
e.preventDefault();
|
|
93
115
|
}
|
|
94
116
|
|
|
95
|
-
/**
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
*/
|
|
99
|
-
_retargetEvent(e) {
|
|
100
|
-
e.stopPropagation();
|
|
101
|
-
const { detail, composed, cancelable, bubbles } = e;
|
|
102
|
-
|
|
103
|
-
const firedEvent = this.dispatchEvent(new CustomEvent(e.type, { bubbles, cancelable, composed, detail }));
|
|
104
|
-
// Check if `eventTarget.preventDefault()` was called to prevent default in the original event
|
|
105
|
-
if (!firedEvent) {
|
|
106
|
-
e.preventDefault();
|
|
107
|
-
}
|
|
117
|
+
/** @private */
|
|
118
|
+
__handleOverlayClosed() {
|
|
119
|
+
this.dispatchEvent(new CustomEvent('closed'));
|
|
108
120
|
}
|
|
109
121
|
|
|
110
122
|
/** @private */
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
form.$.vaadinLoginUsername.value = '';
|
|
116
|
-
form.$.vaadinLoginPassword.value = '';
|
|
123
|
+
_openedChanged(opened, oldOpened) {
|
|
124
|
+
if (oldOpened) {
|
|
125
|
+
this._userNameField.value = '';
|
|
126
|
+
this._passwordField.value = '';
|
|
117
127
|
this.disabled = false;
|
|
118
|
-
|
|
119
|
-
if (this._undoTitleTeleport) {
|
|
120
|
-
this._undoTitleTeleport();
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
if (this._undoFieldsTeleport) {
|
|
124
|
-
this._undoFieldsTeleport();
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if (this._undoFooterTeleport) {
|
|
128
|
-
this._undoFooterTeleport();
|
|
129
|
-
}
|
|
130
|
-
} else {
|
|
131
|
-
this._undoTitleTeleport = this._teleport('title', this.$.vaadinLoginOverlayWrapper);
|
|
132
|
-
|
|
133
|
-
this._undoFieldsTeleport = this._teleport(
|
|
134
|
-
'custom-form-area',
|
|
135
|
-
form.$.vaadinLoginFormWrapper,
|
|
136
|
-
form.querySelector('vaadin-button'),
|
|
137
|
-
);
|
|
138
|
-
|
|
139
|
-
this._undoFooterTeleport = this._teleport('footer', form.$.vaadinLoginFormWrapper);
|
|
140
|
-
|
|
128
|
+
} else if (opened) {
|
|
141
129
|
// Overlay sets pointerEvents on body to `none`, which breaks LastPass popup
|
|
142
130
|
// Reverting it back to the previous state
|
|
143
131
|
// https://github.com/vaadin/vaadin-overlay/blob/041cde4481b6262eac68d3a699f700216d897373/src/vaadin-overlay.html#L660
|
|
144
|
-
document.body.style.pointerEvents = this.$.
|
|
132
|
+
document.body.style.pointerEvents = this.$.overlay._previousDocumentPointerEvents;
|
|
145
133
|
}
|
|
146
134
|
}
|
|
147
135
|
|
|
148
|
-
/**
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
} else {
|
|
154
|
-
target.appendChild(el);
|
|
155
|
-
}
|
|
156
|
-
return el;
|
|
157
|
-
});
|
|
158
|
-
// Function to undo the teleport
|
|
159
|
-
return () => {
|
|
160
|
-
this.append(...teleported);
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/** @private */
|
|
165
|
-
__computeHeadingLevel(headingLevel) {
|
|
166
|
-
return headingLevel + 1;
|
|
167
|
-
}
|
|
136
|
+
/**
|
|
137
|
+
* Fired when the overlay is closed.
|
|
138
|
+
*
|
|
139
|
+
* @event closed
|
|
140
|
+
*/
|
|
168
141
|
};
|
|
@@ -5,43 +5,63 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { html, LitElement } from 'lit';
|
|
7
7
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
8
|
+
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
8
9
|
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
9
|
-
import {
|
|
10
|
+
import { OverlayMixin } from '@vaadin/overlay/src/vaadin-overlay-mixin.js';
|
|
11
|
+
import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
|
|
10
12
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
11
|
-
import {
|
|
12
|
-
import { loginOverlayWrapperStyles } from './vaadin-login-overlay-wrapper-styles.js';
|
|
13
|
+
import { loginOverlayWrapperStyles } from './styles/vaadin-login-overlay-wrapper-base-styles.js';
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* An element used internally by `<vaadin-login-overlay>`. Not intended to be used separately.
|
|
16
17
|
*
|
|
17
18
|
* @extends HTMLElement
|
|
18
|
-
* @mixes
|
|
19
|
+
* @mixes DirMixin
|
|
20
|
+
* @mixes OverlayMixin
|
|
19
21
|
* @mixes ThemableMixin
|
|
20
22
|
* @private
|
|
21
23
|
*/
|
|
22
|
-
class LoginOverlayWrapper extends
|
|
24
|
+
class LoginOverlayWrapper extends OverlayMixin(DirMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement))))) {
|
|
23
25
|
static get is() {
|
|
24
26
|
return 'vaadin-login-overlay-wrapper';
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
static get styles() {
|
|
28
|
-
return
|
|
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
|
+
* Override method from OverlayFocusMixin to use owner as focus trap root
|
|
46
|
+
* @protected
|
|
47
|
+
* @override
|
|
48
|
+
*/
|
|
49
|
+
get _focusTrapRoot() {
|
|
50
|
+
return this.owner;
|
|
29
51
|
}
|
|
30
52
|
|
|
31
53
|
/** @protected */
|
|
32
54
|
render() {
|
|
33
55
|
return html`
|
|
34
56
|
<div id="backdrop" part="backdrop" ?hidden="${!this.withBackdrop}"></div>
|
|
35
|
-
<div part="overlay" id="overlay"
|
|
57
|
+
<div part="overlay" id="overlay">
|
|
36
58
|
<div part="content" id="content">
|
|
37
59
|
<section part="card">
|
|
38
60
|
<div part="brand">
|
|
39
|
-
<slot name="title">
|
|
40
|
-
|
|
41
|
-
</slot>
|
|
42
|
-
<p part="description">${this.description}</p>
|
|
61
|
+
<slot name="title"></slot>
|
|
62
|
+
<div part="description">${this.description}</div>
|
|
43
63
|
</div>
|
|
44
|
-
<div part="form">
|
|
64
|
+
<div part="form-wrapper">
|
|
45
65
|
<slot></slot>
|
|
46
66
|
</div>
|
|
47
67
|
</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,
|
|
@@ -3,97 +3,127 @@
|
|
|
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 '
|
|
6
|
+
import '@vaadin/button/src/vaadin-button.js';
|
|
7
|
+
import '@vaadin/text-field/src/vaadin-text-field.js';
|
|
8
|
+
import '@vaadin/password-field/src/vaadin-password-field.js';
|
|
9
|
+
import './vaadin-login-form-wrapper.js';
|
|
7
10
|
import './vaadin-login-overlay-wrapper.js';
|
|
8
|
-
import { html, LitElement } from 'lit';
|
|
11
|
+
import { css, html, LitElement } from 'lit';
|
|
9
12
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
10
13
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
11
14
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
12
15
|
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
13
16
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
17
|
+
import { LoginFormMixin } from './vaadin-login-form-mixin.js';
|
|
14
18
|
import { LoginOverlayMixin } from './vaadin-login-overlay-mixin.js';
|
|
15
19
|
|
|
16
20
|
/**
|
|
17
|
-
* `<vaadin-login-overlay>` is a
|
|
18
|
-
*
|
|
19
|
-
* password managers to work with login form.
|
|
21
|
+
* `<vaadin-login-overlay>` is a web component which renders a login form in an overlay and
|
|
22
|
+
* provides an additional `brand` part for application title and description.
|
|
20
23
|
*
|
|
21
|
-
* ```
|
|
24
|
+
* ```html
|
|
22
25
|
* <vaadin-login-overlay opened></vaadin-login-overlay>
|
|
23
26
|
* ```
|
|
24
27
|
*
|
|
25
28
|
* ### Styling
|
|
26
29
|
*
|
|
27
|
-
* The
|
|
28
|
-
* Use `<vaadin-login-overlay-wrapper>` and `<vaadin-login-form-wrapper>` to apply styles.
|
|
29
|
-
*
|
|
30
|
-
* The following shadow DOM parts of the `<vaadin-login-overlay-wrapper>` are available for styling:
|
|
30
|
+
* The following shadow DOM parts are available for styling:
|
|
31
31
|
*
|
|
32
|
-
* Part name
|
|
33
|
-
*
|
|
34
|
-
* `
|
|
35
|
-
* `
|
|
36
|
-
* `
|
|
32
|
+
* Part name | Description
|
|
33
|
+
* -----------------------------|--------------------------------
|
|
34
|
+
* `backdrop` | Backdrop of the overlay
|
|
35
|
+
* `overlay` | The overlay container element
|
|
36
|
+
* `content` | The overlay content element
|
|
37
|
+
* `card` | Container for the brand and form wrapper
|
|
38
|
+
* `brand` | Container for application title and description
|
|
39
|
+
* `description` | The application description
|
|
40
|
+
* `form-wrapper` | The login form wrapper element
|
|
41
|
+
* `form` | The login form element
|
|
42
|
+
* `form-title` | Title of the login form
|
|
43
|
+
* `error-message` | Container for error message
|
|
44
|
+
* `error-message-title` | Container for error message title
|
|
45
|
+
* `error-message-description` | Container for error message description
|
|
46
|
+
* `footer` | Container for the footer element
|
|
37
47
|
*
|
|
38
48
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
39
49
|
*
|
|
40
|
-
* See [`<vaadin-login-form>`](#/elements/vaadin-login-form)
|
|
41
|
-
* documentation for `<vaadin-login-form-wrapper>` stylable parts.
|
|
42
|
-
*
|
|
43
50
|
* @fires {CustomEvent} description-changed - Fired when the `description` property changes.
|
|
44
51
|
* @fires {CustomEvent} disabled-changed - Fired when the `disabled` property changes.
|
|
45
52
|
* @fires {CustomEvent} error-changed - Fired when the `error` property changes.
|
|
46
53
|
* @fires {CustomEvent} forgot-password - Fired when user clicks on the "Forgot password" button.
|
|
47
54
|
* @fires {CustomEvent} login - Fired when a user submits the login.
|
|
55
|
+
* @fires {CustomEvent} closed - Fired when the overlay is closed.
|
|
48
56
|
*
|
|
49
57
|
* @customElement
|
|
50
58
|
* @extends HTMLElement
|
|
51
59
|
* @mixes ElementMixin
|
|
52
60
|
* @mixes ThemableMixin
|
|
61
|
+
* @mixes LoginFormMixin
|
|
53
62
|
* @mixes LoginOverlayMixin
|
|
54
63
|
*/
|
|
55
|
-
class LoginOverlay extends LoginOverlayMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement)))) {
|
|
64
|
+
class LoginOverlay extends LoginFormMixin(LoginOverlayMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement))))) {
|
|
56
65
|
static get is() {
|
|
57
66
|
return 'vaadin-login-overlay';
|
|
58
67
|
}
|
|
59
68
|
|
|
69
|
+
static get styles() {
|
|
70
|
+
return css`
|
|
71
|
+
:host([opened]),
|
|
72
|
+
:host([opening]),
|
|
73
|
+
:host([closing]) {
|
|
74
|
+
display: block !important;
|
|
75
|
+
position: absolute;
|
|
76
|
+
outline: none;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
:host,
|
|
80
|
+
:host([hidden]) {
|
|
81
|
+
display: none !important;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
:host(:focus-visible) ::part(overlay) {
|
|
85
|
+
outline: var(--vaadin-focus-ring-width) solid var(--vaadin-focus-ring-color);
|
|
86
|
+
}
|
|
87
|
+
`;
|
|
88
|
+
}
|
|
89
|
+
|
|
60
90
|
/** @protected */
|
|
61
91
|
render() {
|
|
62
92
|
return html`
|
|
63
93
|
<vaadin-login-overlay-wrapper
|
|
64
|
-
id="
|
|
94
|
+
id="overlay"
|
|
95
|
+
.owner="${this}"
|
|
65
96
|
.opened="${this.opened}"
|
|
66
|
-
.title="${this.title}"
|
|
67
97
|
.description="${this.description}"
|
|
68
|
-
.headingLevel="${this.headingLevel}"
|
|
69
|
-
role="dialog"
|
|
70
98
|
focus-trap
|
|
71
99
|
with-backdrop
|
|
72
100
|
theme="${ifDefined(this._theme)}"
|
|
73
101
|
@vaadin-overlay-escape-press="${this._preventClosingLogin}"
|
|
74
102
|
@vaadin-overlay-outside-click="${this._preventClosingLogin}"
|
|
103
|
+
@vaadin-overlay-closed="${this.__handleOverlayClosed}"
|
|
75
104
|
@opened-changed="${this._onOpenedChanged}"
|
|
105
|
+
exportparts="backdrop, overlay, content, card, brand, description, form-wrapper"
|
|
76
106
|
>
|
|
77
|
-
<
|
|
78
|
-
|
|
79
|
-
id="
|
|
80
|
-
.action="${this.action}"
|
|
81
|
-
.disabled="${this.disabled}"
|
|
107
|
+
<slot name="title" slot="title"></slot>
|
|
108
|
+
<vaadin-login-form-wrapper
|
|
109
|
+
id="form"
|
|
82
110
|
.error="${this.error}"
|
|
83
|
-
.noAutofocus="${this.noAutofocus}"
|
|
84
|
-
.noForgotPassword="${this.noForgotPassword}"
|
|
85
|
-
.headingLevel="${this.__computeHeadingLevel(this.headingLevel)}"
|
|
86
111
|
.i18n="${this.__effectiveI18n}"
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
112
|
+
part="form"
|
|
113
|
+
role="region"
|
|
114
|
+
aria-labelledby="title"
|
|
115
|
+
exportparts="error-message, error-message-title, error-message-description, footer"
|
|
116
|
+
>
|
|
117
|
+
<div id="title" slot="form-title" part="form-title" role="heading" aria-level="${this.headingLevel + 1}">
|
|
118
|
+
${this.__effectiveI18n.form.title}
|
|
119
|
+
</div>
|
|
120
|
+
<slot name="form" slot="form"></slot>
|
|
121
|
+
<slot name="custom-form-area" slot="custom-form-area"></slot>
|
|
122
|
+
<slot name="submit" slot="submit"></slot>
|
|
123
|
+
<slot name="forgot-password" slot="forgot-password"></slot>
|
|
124
|
+
<slot name="footer" slot="footer"></slot>
|
|
125
|
+
</vaadin-login-form-wrapper>
|
|
91
126
|
</vaadin-login-overlay-wrapper>
|
|
92
|
-
|
|
93
|
-
<div hidden>
|
|
94
|
-
<slot name="custom-form-area"></slot>
|
|
95
|
-
<slot name="footer"></slot>
|
|
96
|
-
</div>
|
|
97
127
|
`;
|
|
98
128
|
}
|
|
99
129
|
|
|
@@ -101,11 +131,6 @@ class LoginOverlay extends LoginOverlayMixin(ElementMixin(ThemableMixin(PolylitM
|
|
|
101
131
|
_onOpenedChanged(event) {
|
|
102
132
|
this.opened = event.detail.value;
|
|
103
133
|
}
|
|
104
|
-
|
|
105
|
-
/** @private */
|
|
106
|
-
_onDisabledChanged(event) {
|
|
107
|
-
this.disabled = event.detail.value;
|
|
108
|
-
}
|
|
109
134
|
}
|
|
110
135
|
|
|
111
136
|
defineCustomElement(LoginOverlay);
|
package/vaadin-login-form.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import './
|
|
1
|
+
import './src/vaadin-login-form.js';
|
|
2
2
|
export * from './src/vaadin-login-form.js';
|
package/vaadin-login-overlay.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import './
|
|
1
|
+
import './src/vaadin-login-overlay.js';
|
|
2
2
|
export * from './src/vaadin-login-overlay.js';
|