@vaadin/login 25.0.0-alpha1 → 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.
Files changed (29) hide show
  1. package/package.json +16 -13
  2. package/src/styles/vaadin-login-form-wrapper-base-styles.js +65 -0
  3. package/src/styles/vaadin-login-form-wrapper-core-styles.d.ts +8 -0
  4. package/src/{vaadin-login-form-wrapper-styles.js → styles/vaadin-login-form-wrapper-core-styles.js} +8 -9
  5. package/src/styles/vaadin-login-overlay-wrapper-base-styles.js +55 -0
  6. package/src/styles/vaadin-login-overlay-wrapper-core-styles.d.ts +8 -0
  7. package/src/{vaadin-login-overlay-wrapper-styles.js → styles/vaadin-login-overlay-wrapper-core-styles.js} +5 -2
  8. package/src/title-controller.d.ts +11 -0
  9. package/src/title-controller.js +100 -0
  10. package/src/vaadin-login-form-mixin.js +93 -17
  11. package/src/vaadin-login-form-wrapper.js +16 -24
  12. package/src/vaadin-login-form.d.ts +2 -5
  13. package/src/vaadin-login-form.js +27 -69
  14. package/src/vaadin-login-overlay-mixin.d.ts +1 -2
  15. package/src/vaadin-login-overlay-mixin.js +58 -85
  16. package/src/vaadin-login-overlay-wrapper.js +30 -11
  17. package/src/vaadin-login-overlay.d.ts +29 -19
  18. package/src/vaadin-login-overlay.js +61 -45
  19. package/theme/lumo/vaadin-login-form-wrapper-styles.d.ts +3 -0
  20. package/theme/lumo/vaadin-login-form-wrapper-styles.js +11 -7
  21. package/theme/lumo/vaadin-login-overlay-styles.d.ts +2 -1
  22. package/theme/lumo/vaadin-login-overlay-styles.js +18 -33
  23. package/theme/lumo/vaadin-login-overlay.d.ts +4 -1
  24. package/theme/lumo/vaadin-login-overlay.js +4 -1
  25. package/web-types.json +7 -3
  26. package/web-types.lit.json +10 -3
  27. package/src/vaadin-login-overlay-wrapper-mixin.js +0 -78
  28. /package/src/{vaadin-login-form-wrapper-styles.d.ts → styles/vaadin-login-form-wrapper-base-styles.d.ts} +0 -0
  29. /package/src/{vaadin-login-overlay-wrapper-styles.d.ts → styles/vaadin-login-overlay-wrapper-base-styles.d.ts} +0 -0
@@ -1 +1,4 @@
1
+ import '@vaadin/vaadin-lumo-styles/color.js';
2
+ import '@vaadin/vaadin-lumo-styles/sizing.js';
1
3
  import '@vaadin/vaadin-lumo-styles/spacing.js';
4
+ import '@vaadin/vaadin-lumo-styles/typography.js';
@@ -1,19 +1,23 @@
1
+ import '@vaadin/vaadin-lumo-styles/color.js';
2
+ import '@vaadin/vaadin-lumo-styles/sizing.js';
1
3
  import '@vaadin/vaadin-lumo-styles/spacing.js';
2
- import { color } from '@vaadin/vaadin-lumo-styles/color.js';
3
- import { typography } from '@vaadin/vaadin-lumo-styles/typography.js';
4
+ import '@vaadin/vaadin-lumo-styles/typography.js';
4
5
  import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
5
6
 
6
7
  const loginFormWrapper = css`
7
8
  :host {
8
- max-width: calc(var(--lumo-size-m) * 10);
9
+ width: calc(var(--lumo-size-m) * 10);
10
+ padding: var(--lumo-space-l);
11
+ max-width: 100%;
9
12
  background: var(--lumo-base-color) linear-gradient(var(--lumo-tint-5pct), var(--lumo-tint-5pct));
10
13
  }
11
14
 
12
- [part='form'] {
13
- padding: var(--lumo-space-l);
15
+ ::slotted(form) {
16
+ display: flex;
17
+ flex-direction: column;
14
18
  }
15
19
 
16
- [part='form-title'] {
20
+ ::slotted([slot='form-title']) {
17
21
  margin-top: calc(var(--lumo-font-size-xxxl) - var(--lumo-font-size-xxl));
18
22
  color: var(--lumo-header-text-color);
19
23
  font-size: var(--lumo-font-size-xxl);
@@ -89,6 +93,6 @@ const loginFormWrapper = css`
89
93
  }
90
94
  `;
91
95
 
92
- registerStyles('vaadin-login-form-wrapper', [color, typography, loginFormWrapper], {
96
+ registerStyles('vaadin-login-form-wrapper', loginFormWrapper, {
93
97
  moduleId: 'lumo-login-form-wrapper',
94
98
  });
@@ -1,2 +1,3 @@
1
+ import '@vaadin/vaadin-lumo-styles/color.js';
1
2
  import '@vaadin/vaadin-lumo-styles/spacing.js';
2
- import './vaadin-login-form-wrapper-styles.js';
3
+ import '@vaadin/vaadin-lumo-styles/typography.js';
@@ -1,8 +1,7 @@
1
+ import '@vaadin/vaadin-lumo-styles/color.js';
1
2
  import '@vaadin/vaadin-lumo-styles/spacing.js';
2
- import './vaadin-login-form-wrapper-styles.js';
3
- import { color } from '@vaadin/vaadin-lumo-styles/color.js';
3
+ import '@vaadin/vaadin-lumo-styles/typography.js';
4
4
  import { overlay } from '@vaadin/vaadin-lumo-styles/mixins/overlay.js';
5
- import { typography } from '@vaadin/vaadin-lumo-styles/typography.js';
6
5
  import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
7
6
 
8
7
  const loginOverlayWrapper = css`
@@ -29,7 +28,7 @@ const loginOverlayWrapper = css`
29
28
  min-height: calc(var(--lumo-size-m) * 5);
30
29
  }
31
30
 
32
- [part='title'] {
31
+ ::slotted([slot='title']) {
33
32
  font-size: var(--lumo-font-size-xxxl);
34
33
  font-weight: 600;
35
34
  line-height: var(--lumo-line-height-xs);
@@ -38,7 +37,7 @@ const loginOverlayWrapper = css`
38
37
  [part='description'] {
39
38
  line-height: var(--lumo-line-height-s);
40
39
  color: var(--lumo-tint-70pct);
41
- margin-bottom: 0;
40
+ margin: 0.5em 0 0;
42
41
  }
43
42
 
44
43
  [part='content'] {
@@ -58,6 +57,11 @@ const loginOverlayWrapper = css`
58
57
  height: auto;
59
58
  }
60
59
 
60
+ ::slotted(vaadin-login-form-wrapper) {
61
+ min-height: 100%;
62
+ max-width: 100%;
63
+ }
64
+
61
65
  /* Small screen */
62
66
  @media only screen and (max-width: 500px) {
63
67
  [part='overlay'],
@@ -95,7 +99,7 @@ const loginOverlayWrapper = css`
95
99
  }
96
100
 
97
101
  [part='brand'],
98
- [part='form'] {
102
+ [part='form-wrapper'] {
99
103
  flex: auto;
100
104
  flex-basis: 0;
101
105
  box-sizing: border-box;
@@ -105,10 +109,15 @@ const loginOverlayWrapper = css`
105
109
  justify-content: flex-start;
106
110
  }
107
111
 
108
- [part='form'] {
112
+ [part='form-wrapper'] {
109
113
  padding: var(--lumo-space-l);
110
114
  overflow: auto;
111
115
  }
116
+
117
+ ::slotted(vaadin-login-form-wrapper) {
118
+ flex: 1;
119
+ padding: 2px;
120
+ }
112
121
  }
113
122
 
114
123
  /* Landscape really small screen */
@@ -128,10 +137,9 @@ const loginOverlayWrapper = css`
128
137
  box-shadow: none;
129
138
  }
130
139
 
131
- [part='form'] {
140
+ [part='form-wrapper'] {
132
141
  height: 100%;
133
142
  overflow: auto;
134
- -webkit-overflow-scrolling: touch;
135
143
  }
136
144
  }
137
145
 
@@ -160,29 +168,6 @@ const loginOverlayWrapper = css`
160
168
  }
161
169
  `;
162
170
 
163
- registerStyles('vaadin-login-overlay-wrapper', [color, typography, overlay, loginOverlayWrapper], {
171
+ registerStyles('vaadin-login-overlay-wrapper', [overlay, loginOverlayWrapper], {
164
172
  moduleId: 'lumo-login-overlay-wrapper',
165
173
  });
166
-
167
- const loginFormWrapper = css`
168
- :host([theme~='with-overlay']) {
169
- min-height: 100%;
170
- display: flex;
171
- justify-content: center;
172
- max-width: 100%;
173
- }
174
-
175
- /* Landscape small screen */
176
- @media only screen and (max-height: 600px) and (min-width: 600px) and (orientation: landscape) {
177
- :host([theme~='with-overlay']) [part='form'] {
178
- height: 100%;
179
- -webkit-overflow-scrolling: touch;
180
- flex: 1;
181
- padding: 2px;
182
- }
183
- }
184
- `;
185
-
186
- registerStyles('vaadin-login-form-wrapper', [loginFormWrapper], {
187
- moduleId: 'lumo-login-overlay',
188
- });
@@ -1,3 +1,6 @@
1
+ import '@vaadin/button/theme/lumo/vaadin-button.js';
2
+ import '@vaadin/text-field/theme/lumo/vaadin-text-field.js';
3
+ import '@vaadin/password-field/theme/lumo/vaadin-password-field.js';
4
+ import './vaadin-login-form-wrapper-styles.js';
1
5
  import './vaadin-login-overlay-styles.js';
2
- import './vaadin-login-form.js';
3
6
  import '../../src/vaadin-login-overlay.js';
@@ -1,3 +1,6 @@
1
+ import '@vaadin/button/theme/lumo/vaadin-button.js';
2
+ import '@vaadin/text-field/theme/lumo/vaadin-text-field.js';
3
+ import '@vaadin/password-field/theme/lumo/vaadin-password-field.js';
4
+ import './vaadin-login-form-wrapper-styles.js';
1
5
  import './vaadin-login-overlay-styles.js';
2
- import './vaadin-login-form.js';
3
6
  import '../../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-alpha1",
4
+ "version": "25.0.0-alpha10",
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```\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 component doesn't have a shadowRoot, so the `<form>` and input fields can be styled from a global scope.\nUse `<vaadin-login-form-wrapper>` themable component to apply styles.\n\nThe following shadow DOM parts of the `<vaadin-login-form-wrapper>` 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.",
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 wrapper of the `<vaadin-login-form>` which opens a login form in an overlay and\nhaving an additional `brand` part for application title and description. Using `<vaadin-login-overlay>` allows\npassword managers to work with login form.\n\n```\n<vaadin-login-overlay opened></vaadin-login-overlay>\n```\n\n### Styling\n\nThe component doesn't have a shadowRoot, so the `<form>` and input fields can be styled from a global scope.\nUse `<vaadin-login-overlay-wrapper>` and `<vaadin-login-form-wrapper>` to apply styles.\n\nThe following shadow DOM parts of the `<vaadin-login-overlay-wrapper>` are available for styling:\n\nPart name | Description\n----------------|---------------------------------------------------------|\n`card` | Container for the entire component's content\n`brand` | Container for application title and description\n`form` | Container for the `<vaadin-login-form>` component\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\nSee [`<vaadin-login-form>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha1/#/elements/vaadin-login-form)\ndocumentation for `<vaadin-login-form-wrapper>` stylable parts.",
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."
@@ -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-alpha1",
4
+ "version": "25.0.0-alpha10",
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```\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 component doesn't have a shadowRoot, so the `<form>` and input fields can be styled from a global scope.\nUse `<vaadin-login-form-wrapper>` themable component to apply styles.\n\nThe following shadow DOM parts of the `<vaadin-login-form-wrapper>` 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.",
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 wrapper of the `<vaadin-login-form>` which opens a login form in an overlay and\nhaving an additional `brand` part for application title and description. Using `<vaadin-login-overlay>` allows\npassword managers to work with login form.\n\n```\n<vaadin-login-overlay opened></vaadin-login-overlay>\n```\n\n### Styling\n\nThe component doesn't have a shadowRoot, so the `<form>` and input fields can be styled from a global scope.\nUse `<vaadin-login-overlay-wrapper>` and `<vaadin-login-form-wrapper>` to apply styles.\n\nThe following shadow DOM parts of the `<vaadin-login-overlay-wrapper>` are available for styling:\n\nPart name | Description\n----------------|---------------------------------------------------------|\n`card` | Container for the entire component's content\n`brand` | Container for application title and description\n`form` | Container for the `<vaadin-login-form>` component\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.\n\nSee [`<vaadin-login-form>`](https://cdn.vaadin.com/vaadin-web-components/25.0.0-alpha1/#/elements/vaadin-login-form)\ndocumentation for `<vaadin-login-form-wrapper>` stylable parts.",
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.",
@@ -1,78 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2018 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
7
- import { SlotObserver } from '@vaadin/component-base/src/slot-observer.js';
8
- import { generateUniqueId } from '@vaadin/component-base/src/unique-id-utils.js';
9
- import { OverlayMixin } from '@vaadin/overlay/src/vaadin-overlay-mixin.js';
10
-
11
- /**
12
- * @polymerMixin
13
- * @mixes DirMixin
14
- * @mixes OverlayMixin
15
- */
16
- export const LoginOverlayWrapperMixin = (superClass) =>
17
- class LoginOverlayWrapperMixin extends OverlayMixin(DirMixin(superClass)) {
18
- static get properties() {
19
- return {
20
- /**
21
- * Title of the application.
22
- */
23
- title: {
24
- type: String,
25
- observer: '_titleChanged',
26
- },
27
-
28
- /**
29
- * Application description. Displayed under the title.
30
- */
31
- description: {
32
- type: String,
33
- },
34
-
35
- /**
36
- * Used to customize the `aria-level` attribute on the heading element.
37
- */
38
- headingLevel: {
39
- type: Number,
40
- },
41
- };
42
- }
43
-
44
- /** @protected */
45
- ready() {
46
- super.ready();
47
-
48
- // Use slot observer instead of slot controller since the latter
49
- // does not work well with teleporting (it removes custom title).
50
- const slot = this.shadowRoot.querySelector('slot[name="title"]');
51
- this._titleSlotObserver = new SlotObserver(slot, () => {
52
- const title = slot.assignedElements({ flatten: true })[0];
53
- if (!title) {
54
- return;
55
- }
56
-
57
- // Only set ID on the custom slotted title and link it using
58
- // aria-labelledby as the default title is in the shadow DOM.
59
- if (title.getAttribute('part') === 'title') {
60
- this.setAttribute('aria-label', this.title);
61
- this.removeAttribute('aria-labelledby');
62
- } else {
63
- if (!title.id) {
64
- title.id = `login-overlay-title-${generateUniqueId()}`;
65
- }
66
- this.removeAttribute('aria-label');
67
- this.setAttribute('aria-labelledby', title.id);
68
- }
69
- });
70
- }
71
-
72
- /** @private */
73
- _titleChanged(title) {
74
- if (title && this.hasAttribute('aria-label')) {
75
- this.setAttribute('aria-label', title);
76
- }
77
- }
78
- };