@vaadin/login 25.0.0-alpha1 → 25.0.0-alpha11
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 +55 -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 -69
- package/src/vaadin-login-overlay-mixin.d.ts +1 -2
- package/src/vaadin-login-overlay-mixin.js +58 -85
- package/src/vaadin-login-overlay-wrapper.js +30 -11
- package/src/vaadin-login-overlay.d.ts +29 -19
- package/src/vaadin-login-overlay.js +61 -45
- package/vaadin-login-form.js +1 -1
- package/vaadin-login-overlay.js +1 -1
- package/web-types.json +7 -3
- package/web-types.lit.json +10 -3
- 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 -2
- package/theme/lumo/vaadin-login-overlay-styles.js +0 -188
- package/theme/lumo/vaadin-login-overlay.d.ts +0 -3
- package/theme/lumo/vaadin-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
|
@@ -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,8 +31,8 @@ export const LoginOverlayMixin = (superClass) =>
|
|
|
32
31
|
opened: {
|
|
33
32
|
type: Boolean,
|
|
34
33
|
value: false,
|
|
34
|
+
reflectToAttribute: true,
|
|
35
35
|
sync: true,
|
|
36
|
-
observer: '_onOpenedChange',
|
|
37
36
|
},
|
|
38
37
|
|
|
39
38
|
/**
|
|
@@ -47,15 +46,43 @@ export const LoginOverlayMixin = (superClass) =>
|
|
|
47
46
|
};
|
|
48
47
|
}
|
|
49
48
|
|
|
50
|
-
|
|
51
|
-
|
|
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;
|
|
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,27 +5,48 @@
|
|
|
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
|
+
* @protected
|
|
46
|
+
* @override
|
|
47
|
+
*/
|
|
48
|
+
get _modalRoot() {
|
|
49
|
+
return this.owner;
|
|
29
50
|
}
|
|
30
51
|
|
|
31
52
|
/** @protected */
|
|
@@ -36,12 +57,10 @@ class LoginOverlayWrapper extends LoginOverlayWrapperMixin(ThemableMixin(Polylit
|
|
|
36
57
|
<div part="content" id="content">
|
|
37
58
|
<section part="card">
|
|
38
59
|
<div part="brand">
|
|
39
|
-
<slot name="title">
|
|
40
|
-
|
|
41
|
-
</slot>
|
|
42
|
-
<p part="description">${this.description}</p>
|
|
60
|
+
<slot name="title"></slot>
|
|
61
|
+
<div part="description">${this.description}</div>
|
|
43
62
|
</div>
|
|
44
|
-
<div part="form">
|
|
63
|
+
<div part="form-wrapper">
|
|
45
64
|
<slot></slot>
|
|
46
65
|
</div>
|
|
47
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,
|
|
@@ -3,97 +3,118 @@
|
|
|
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 {
|
|
72
|
+
display: block;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
:host([hidden]) {
|
|
76
|
+
display: none !important;
|
|
77
|
+
}
|
|
78
|
+
`;
|
|
79
|
+
}
|
|
80
|
+
|
|
60
81
|
/** @protected */
|
|
61
82
|
render() {
|
|
62
83
|
return html`
|
|
63
84
|
<vaadin-login-overlay-wrapper
|
|
64
|
-
id="
|
|
85
|
+
id="overlay"
|
|
86
|
+
.owner="${this}"
|
|
65
87
|
.opened="${this.opened}"
|
|
66
|
-
.title="${this.title}"
|
|
67
88
|
.description="${this.description}"
|
|
68
|
-
.headingLevel="${this.headingLevel}"
|
|
69
|
-
role="dialog"
|
|
70
89
|
focus-trap
|
|
71
90
|
with-backdrop
|
|
72
91
|
theme="${ifDefined(this._theme)}"
|
|
73
92
|
@vaadin-overlay-escape-press="${this._preventClosingLogin}"
|
|
74
93
|
@vaadin-overlay-outside-click="${this._preventClosingLogin}"
|
|
94
|
+
@vaadin-overlay-closed="${this.__handleOverlayClosed}"
|
|
75
95
|
@opened-changed="${this._onOpenedChanged}"
|
|
96
|
+
exportparts="backdrop, overlay, content, card, brand, description, form-wrapper"
|
|
76
97
|
>
|
|
77
|
-
<
|
|
78
|
-
|
|
79
|
-
id="
|
|
80
|
-
.action="${this.action}"
|
|
81
|
-
.disabled="${this.disabled}"
|
|
98
|
+
<slot name="title" slot="title"></slot>
|
|
99
|
+
<vaadin-login-form-wrapper
|
|
100
|
+
id="form"
|
|
82
101
|
.error="${this.error}"
|
|
83
|
-
.noAutofocus="${this.noAutofocus}"
|
|
84
|
-
.noForgotPassword="${this.noForgotPassword}"
|
|
85
|
-
.headingLevel="${this.__computeHeadingLevel(this.headingLevel)}"
|
|
86
102
|
.i18n="${this.__effectiveI18n}"
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
103
|
+
part="form"
|
|
104
|
+
role="region"
|
|
105
|
+
aria-labelledby="title"
|
|
106
|
+
exportparts="error-message, error-message-title, error-message-description, footer"
|
|
107
|
+
>
|
|
108
|
+
<div id="title" slot="form-title" part="form-title" role="heading" aria-level="${this.headingLevel + 1}">
|
|
109
|
+
${this.__effectiveI18n.form.title}
|
|
110
|
+
</div>
|
|
111
|
+
<slot name="form" slot="form"></slot>
|
|
112
|
+
<slot name="custom-form-area" slot="custom-form-area"></slot>
|
|
113
|
+
<slot name="submit" slot="submit"></slot>
|
|
114
|
+
<slot name="forgot-password" slot="forgot-password"></slot>
|
|
115
|
+
<slot name="footer" slot="footer"></slot>
|
|
116
|
+
</vaadin-login-form-wrapper>
|
|
91
117
|
</vaadin-login-overlay-wrapper>
|
|
92
|
-
|
|
93
|
-
<div hidden>
|
|
94
|
-
<slot name="custom-form-area"></slot>
|
|
95
|
-
<slot name="footer"></slot>
|
|
96
|
-
</div>
|
|
97
118
|
`;
|
|
98
119
|
}
|
|
99
120
|
|
|
@@ -101,11 +122,6 @@ class LoginOverlay extends LoginOverlayMixin(ElementMixin(ThemableMixin(PolylitM
|
|
|
101
122
|
_onOpenedChanged(event) {
|
|
102
123
|
this.opened = event.detail.value;
|
|
103
124
|
}
|
|
104
|
-
|
|
105
|
-
/** @private */
|
|
106
|
-
_onDisabledChanged(event) {
|
|
107
|
-
this.disabled = event.detail.value;
|
|
108
|
-
}
|
|
109
125
|
}
|
|
110
126
|
|
|
111
127
|
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';
|
package/web-types.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/login",
|
|
4
|
-
"version": "25.0.0-
|
|
4
|
+
"version": "25.0.0-alpha11",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
8
8
|
"elements": [
|
|
9
9
|
{
|
|
10
10
|
"name": "vaadin-login-form",
|
|
11
|
-
"description": "`<vaadin-login-form>` is a Web Component providing an easy way to require users\nto log in into an application. Note that component has no shadowRoot.\n\n
|
|
11
|
+
"description": "`<vaadin-login-form>` is a Web Component providing an easy way to require users\nto log in into an application. Note that component has no shadowRoot.\n\n```html\n<vaadin-login-form></vaadin-login-form>\n```\n\nComponent has to be accessible from the `document` layer in order to allow password managers to work properly with form values.\nUsing `<vaadin-login-overlay>` allows to always attach the component to the document body.\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------|---------------------------------------------------------|\n`form` | Container for the entire component's content\n`form-title` | Title of the login form\n`error-message`| Container for error message, contains error-message-title and error-message-description parts. Hidden by default.\n`error-message-title` | Container for error message title\n`error-message-description` | Container for error message description\n`footer` | Container additional information text from `i18n` object\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
12
12
|
"attributes": [
|
|
13
13
|
{
|
|
14
14
|
"name": "action",
|
|
@@ -170,7 +170,7 @@
|
|
|
170
170
|
},
|
|
171
171
|
{
|
|
172
172
|
"name": "vaadin-login-overlay",
|
|
173
|
-
"description": "`<vaadin-login-overlay>` is a
|
|
173
|
+
"description": "`<vaadin-login-overlay>` is a web component which renders a login form in an overlay and\nprovides an additional `brand` part for application title and description.\n\n```html\n<vaadin-login-overlay opened></vaadin-login-overlay>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n-----------------------------|--------------------------------\n`backdrop` | Backdrop of the overlay\n`overlay` | The overlay container element\n`content` | The overlay content element\n`card` | Container for the brand and form wrapper\n`brand` | Container for application title and description\n`description` | The application description\n`form-wrapper` | The login form wrapper element\n`form` | The login form element\n`form-title` | Title of the login form\n`error-message` | Container for error message\n`error-message-title` | Container for error message title\n`error-message-description` | Container for error message description\n`footer` | Container for the footer element\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
174
174
|
"attributes": [
|
|
175
175
|
{
|
|
176
176
|
"name": "action",
|
|
@@ -395,6 +395,10 @@
|
|
|
395
395
|
"name": "login",
|
|
396
396
|
"description": "Fired when an user submits the login.\nThe event contains `username` and `password` values in the `detail` property."
|
|
397
397
|
},
|
|
398
|
+
{
|
|
399
|
+
"name": "closed",
|
|
400
|
+
"description": "Fired when the overlay is closed."
|
|
401
|
+
},
|
|
398
402
|
{
|
|
399
403
|
"name": "disabled-changed",
|
|
400
404
|
"description": "Fired when the `disabled` property changes."
|
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/login",
|
|
4
|
-
"version": "25.0.0-
|
|
4
|
+
"version": "25.0.0-alpha11",
|
|
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-login-form",
|
|
19
|
-
"description": "`<vaadin-login-form>` is a Web Component providing an easy way to require users\nto log in into an application. Note that component has no shadowRoot.\n\n
|
|
19
|
+
"description": "`<vaadin-login-form>` is a Web Component providing an easy way to require users\nto log in into an application. Note that component has no shadowRoot.\n\n```html\n<vaadin-login-form></vaadin-login-form>\n```\n\nComponent has to be accessible from the `document` layer in order to allow password managers to work properly with form values.\nUsing `<vaadin-login-overlay>` allows to always attach the component to the document body.\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n---------------|---------------------------------------------------------|\n`form` | Container for the entire component's content\n`form-title` | Title of the login form\n`error-message`| Container for error message, contains error-message-title and error-message-description parts. Hidden by default.\n`error-message-title` | Container for error message title\n`error-message-description` | Container for error message description\n`footer` | Container additional information text from `i18n` object\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
22
|
{
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
},
|
|
101
101
|
{
|
|
102
102
|
"name": "vaadin-login-overlay",
|
|
103
|
-
"description": "`<vaadin-login-overlay>` is a
|
|
103
|
+
"description": "`<vaadin-login-overlay>` is a web component which renders a login form in an overlay and\nprovides an additional `brand` part for application title and description.\n\n```html\n<vaadin-login-overlay opened></vaadin-login-overlay>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n-----------------------------|--------------------------------\n`backdrop` | Backdrop of the overlay\n`overlay` | The overlay container element\n`content` | The overlay content element\n`card` | Container for the brand and form wrapper\n`brand` | Container for application title and description\n`description` | The application description\n`form-wrapper` | The login form wrapper element\n`form` | The login form element\n`form-title` | Title of the login form\n`error-message` | Container for error message\n`error-message-title` | Container for error message title\n`error-message-description` | Container for error message description\n`footer` | Container for the footer element\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
104
104
|
"extension": true,
|
|
105
105
|
"attributes": [
|
|
106
106
|
{
|
|
@@ -194,6 +194,13 @@
|
|
|
194
194
|
"kind": "expression"
|
|
195
195
|
}
|
|
196
196
|
},
|
|
197
|
+
{
|
|
198
|
+
"name": "@closed",
|
|
199
|
+
"description": "Fired when the overlay is closed.",
|
|
200
|
+
"value": {
|
|
201
|
+
"kind": "expression"
|
|
202
|
+
}
|
|
203
|
+
},
|
|
197
204
|
{
|
|
198
205
|
"name": "@disabled-changed",
|
|
199
206
|
"description": "Fired when the `disabled` property changes.",
|