@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.
Files changed (54) hide show
  1. package/README.md +0 -26
  2. package/package.json +17 -17
  3. package/src/styles/vaadin-login-form-wrapper-base-styles.js +65 -0
  4. package/src/styles/vaadin-login-form-wrapper-core-styles.d.ts +8 -0
  5. package/src/{vaadin-login-form-wrapper-styles.js → styles/vaadin-login-form-wrapper-core-styles.js} +8 -9
  6. package/src/styles/vaadin-login-overlay-wrapper-base-styles.js +55 -0
  7. package/src/styles/vaadin-login-overlay-wrapper-core-styles.d.ts +8 -0
  8. package/src/{vaadin-login-overlay-wrapper-styles.js → styles/vaadin-login-overlay-wrapper-core-styles.js} +5 -2
  9. package/src/title-controller.d.ts +11 -0
  10. package/src/title-controller.js +100 -0
  11. package/src/vaadin-login-form-mixin.js +93 -17
  12. package/src/vaadin-login-form-wrapper.js +34 -40
  13. package/src/vaadin-login-form.d.ts +2 -5
  14. package/src/vaadin-login-form.js +41 -76
  15. package/src/vaadin-login-overlay-mixin.d.ts +1 -2
  16. package/src/vaadin-login-overlay-mixin.js +59 -85
  17. package/src/vaadin-login-overlay-wrapper.js +39 -18
  18. package/src/vaadin-login-overlay.d.ts +29 -19
  19. package/src/vaadin-login-overlay.js +80 -49
  20. package/theme/lumo/vaadin-login-form-wrapper-styles.d.ts +3 -0
  21. package/theme/lumo/vaadin-login-form-wrapper-styles.js +11 -7
  22. package/theme/lumo/vaadin-login-overlay-styles.d.ts +2 -1
  23. package/theme/lumo/vaadin-login-overlay-styles.js +18 -33
  24. package/theme/lumo/vaadin-login-overlay.d.ts +2 -2
  25. package/theme/lumo/vaadin-login-overlay.js +2 -2
  26. package/web-types.json +7 -3
  27. package/web-types.lit.json +10 -3
  28. package/src/vaadin-lit-login-form-wrapper.js +0 -86
  29. package/src/vaadin-lit-login-form.js +0 -112
  30. package/src/vaadin-lit-login-overlay-wrapper.js +0 -52
  31. package/src/vaadin-lit-login-overlay.js +0 -83
  32. package/src/vaadin-login-overlay-wrapper-mixin.js +0 -78
  33. package/theme/lumo/vaadin-lit-login-form.d.ts +0 -5
  34. package/theme/lumo/vaadin-lit-login-form.js +0 -5
  35. package/theme/lumo/vaadin-lit-login-overlay.d.ts +0 -3
  36. package/theme/lumo/vaadin-lit-login-overlay.js +0 -3
  37. package/theme/material/vaadin-lit-login-form.d.ts +0 -5
  38. package/theme/material/vaadin-lit-login-form.js +0 -5
  39. package/theme/material/vaadin-lit-login-overlay.d.ts +0 -3
  40. package/theme/material/vaadin-lit-login-overlay.js +0 -3
  41. package/theme/material/vaadin-login-form-wrapper-styles.d.ts +0 -1
  42. package/theme/material/vaadin-login-form-wrapper-styles.js +0 -109
  43. package/theme/material/vaadin-login-form.d.ts +0 -5
  44. package/theme/material/vaadin-login-form.js +0 -5
  45. package/theme/material/vaadin-login-overlay-styles.d.ts +0 -1
  46. package/theme/material/vaadin-login-overlay-styles.js +0 -352
  47. package/theme/material/vaadin-login-overlay.d.ts +0 -6
  48. package/theme/material/vaadin-login-overlay.js +0 -6
  49. package/vaadin-lit-login-form.d.ts +0 -1
  50. package/vaadin-lit-login-form.js +0 -3
  51. package/vaadin-lit-login-overlay.d.ts +0 -1
  52. package/vaadin-lit-login-overlay.js +0 -3
  53. /package/src/{vaadin-login-form-wrapper-styles.d.ts → styles/vaadin-login-form-wrapper-base-styles.d.ts} +0 -0
  54. /package/src/{vaadin-login-overlay-wrapper-styles.d.ts → styles/vaadin-login-overlay-wrapper-base-styles.d.ts} +0 -0
@@ -1,52 +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 { html, LitElement } from 'lit';
7
- import { defineCustomElement } from '@vaadin/component-base/src/define.js';
8
- import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
9
- import { overlayStyles } from '@vaadin/overlay/src/vaadin-overlay-styles.js';
10
- import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
11
- import { LoginOverlayWrapperMixin } from './vaadin-login-overlay-wrapper-mixin.js';
12
- import { loginOverlayWrapperStyles } from './vaadin-login-overlay-wrapper-styles.js';
13
-
14
- /**
15
- * An element used internally by `<vaadin-login-overlay>`. Not intended to be used separately.
16
- *
17
- * @extends HTMLElement
18
- * @private
19
- */
20
- class LoginOverlayWrapper extends LoginOverlayWrapperMixin(ThemableMixin(PolylitMixin(LitElement))) {
21
- static get is() {
22
- return 'vaadin-login-overlay-wrapper';
23
- }
24
-
25
- static get styles() {
26
- return [overlayStyles, loginOverlayWrapperStyles];
27
- }
28
-
29
- /** @protected */
30
- render() {
31
- return html`
32
- <div id="backdrop" part="backdrop" ?hidden="${!this.withBackdrop}"></div>
33
- <div part="overlay" id="overlay" tabindex="0">
34
- <div part="content" id="content">
35
- <section part="card">
36
- <div part="brand">
37
- <slot name="title">
38
- <div part="title" role="heading" aria-level="${this.headingLevel}">${this.title}</div>
39
- </slot>
40
- <p part="description">${this.description}</p>
41
- </div>
42
- <div part="form">
43
- <slot></slot>
44
- </div>
45
- </section>
46
- </div>
47
- </div>
48
- `;
49
- }
50
- }
51
-
52
- defineCustomElement(LoginOverlayWrapper);
@@ -1,83 +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 './vaadin-lit-login-form.js';
7
- import './vaadin-lit-login-overlay-wrapper.js';
8
- import { html, LitElement } from 'lit';
9
- import { ifDefined } from 'lit/directives/if-defined.js';
10
- import { defineCustomElement } from '@vaadin/component-base/src/define.js';
11
- import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
12
- import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
13
- import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
14
- import { LoginOverlayMixin } from './vaadin-login-overlay-mixin.js';
15
-
16
- /**
17
- * LitElement based version of `<vaadin-login-overlay>` web component.
18
- *
19
- * ## Disclaimer
20
- *
21
- * This component is an experiment and not yet a part of Vaadin platform.
22
- * There is no ETA regarding specific Vaadin version where it'll land.
23
- * Feel free to try this code in your apps as per Apache 2.0 license.
24
- */
25
- class LoginOverlay extends LoginOverlayMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement)))) {
26
- static get is() {
27
- return 'vaadin-login-overlay';
28
- }
29
-
30
- /** @protected */
31
- render() {
32
- return html`
33
- <vaadin-login-overlay-wrapper
34
- id="vaadinLoginOverlayWrapper"
35
- .opened="${this.opened}"
36
- .title="${this.title}"
37
- .description="${this.description}"
38
- .headingLevel="${this.headingLevel}"
39
- role="dialog"
40
- focus-trap
41
- with-backdrop
42
- theme="${ifDefined(this._theme)}"
43
- @vaadin-overlay-escape-press="${this._preventClosingLogin}"
44
- @vaadin-overlay-outside-click="${this._preventClosingLogin}"
45
- @opened-changed="${this._onOpenedChanged}"
46
- >
47
- <vaadin-login-form
48
- theme="with-overlay"
49
- id="vaadinLoginForm"
50
- .action="${this.action}"
51
- .disabled="${this.disabled}"
52
- .error="${this.error}"
53
- .noAutofocus="${this.noAutofocus}"
54
- .noForgotPassword="${this.noForgotPassword}"
55
- .headingLevel="${this.__computeHeadingLevel(this.headingLevel)}"
56
- .i18n="${this.__effectiveI18n}"
57
- @login="${this._retargetEvent}"
58
- @forgot-password="${this._retargetEvent}"
59
- @disabled-changed="${this._onDisabledChanged}"
60
- ></vaadin-login-form>
61
- </vaadin-login-overlay-wrapper>
62
-
63
- <div hidden>
64
- <slot name="custom-form-area"></slot>
65
- <slot name="footer"></slot>
66
- </div>
67
- `;
68
- }
69
-
70
- /** @private */
71
- _onOpenedChanged(event) {
72
- this.opened = event.detail.value;
73
- }
74
-
75
- /** @private */
76
- _onDisabledChanged(event) {
77
- this.disabled = event.detail.value;
78
- }
79
- }
80
-
81
- defineCustomElement(LoginOverlay);
82
-
83
- export { LoginOverlay };
@@ -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
- };
@@ -1,5 +0,0 @@
1
- import '@vaadin/button/theme/lumo/vaadin-button-styles.js';
2
- import '@vaadin/text-field/theme/lumo/vaadin-text-field-styles.js';
3
- import '@vaadin/password-field/theme/lumo/vaadin-password-field-styles.js';
4
- import './vaadin-login-form-wrapper-styles.js';
5
- import '../../src/vaadin-lit-login-form.js';
@@ -1,5 +0,0 @@
1
- import '@vaadin/button/theme/lumo/vaadin-button-styles.js';
2
- import '@vaadin/text-field/theme/lumo/vaadin-text-field-styles.js';
3
- import '@vaadin/password-field/theme/lumo/vaadin-password-field-styles.js';
4
- import './vaadin-login-form-wrapper-styles.js';
5
- import '../../src/vaadin-lit-login-form.js';
@@ -1,3 +0,0 @@
1
- import './vaadin-login-overlay-styles.js';
2
- import './vaadin-lit-login-form.js';
3
- import '../../src/vaadin-lit-login-overlay.js';
@@ -1,3 +0,0 @@
1
- import './vaadin-login-overlay-styles.js';
2
- import './vaadin-lit-login-form.js';
3
- import '../../src/vaadin-lit-login-overlay.js';
@@ -1,5 +0,0 @@
1
- import '@vaadin/button/theme/material/vaadin-button-styles.js';
2
- import '@vaadin/text-field/theme/material/vaadin-text-field-styles.js';
3
- import '@vaadin/password-field/theme/material/vaadin-password-field-styles.js';
4
- import './vaadin-login-form-wrapper-styles.js';
5
- import '../../src/vaadin-lit-login-form.js';
@@ -1,5 +0,0 @@
1
- import '@vaadin/button/theme/material/vaadin-button-styles.js';
2
- import '@vaadin/text-field/theme/material/vaadin-text-field-styles.js';
3
- import '@vaadin/password-field/theme/material/vaadin-password-field-styles.js';
4
- import './vaadin-login-form-wrapper-styles.js';
5
- import '../../src/vaadin-lit-login-form.js';
@@ -1,3 +0,0 @@
1
- import './vaadin-login-overlay-styles.js';
2
- import './vaadin-lit-login-form.js';
3
- import '../../src/vaadin-lit-login-overlay.js';
@@ -1,3 +0,0 @@
1
- import './vaadin-login-overlay-styles.js';
2
- import './vaadin-lit-login-form.js';
3
- import '../../src/vaadin-lit-login-overlay.js';
@@ -1 +0,0 @@
1
- import '@vaadin/vaadin-material-styles/color.js';
@@ -1,109 +0,0 @@
1
- import '@vaadin/vaadin-material-styles/color.js';
2
- import { typography } from '@vaadin/vaadin-material-styles/typography.js';
3
- import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
4
-
5
- const loginFormWrapper = css`
6
- :host {
7
- background: var(--material-background-color) linear-gradient(hsla(0, 0%, 100%, 0.3), hsla(0, 0%, 100%, 0.3));
8
- }
9
-
10
- [part='form'] {
11
- padding: 1.5rem;
12
- flex: 1;
13
- display: flex;
14
- flex-direction: column;
15
- box-sizing: border-box;
16
- justify-content: center;
17
- }
18
-
19
- [part='form-title'] {
20
- margin-top: calc(var(--material-h3-font-size) - var(--material-h4-font-size));
21
- font-size: var(--material-h5-font-size);
22
- font-weight: 300;
23
- line-height: 1.1;
24
- letter-spacing: -0.01em;
25
- text-indent: -0.07em;
26
- }
27
-
28
- ::slotted([slot='submit']) {
29
- margin-top: 3em;
30
- margin-bottom: 2em;
31
- flex-grow: 0;
32
- }
33
-
34
- @media only screen and (max-width: 1023px) {
35
- ::slotted([slot='submit']) {
36
- margin-top: 2.5em;
37
- margin-bottom: 1em;
38
- }
39
- }
40
-
41
- ::slotted([slot='forgot-password']) {
42
- margin: 0.5rem auto;
43
- padding-bottom: 12px;
44
- padding-top: 12px;
45
- text-transform: none;
46
- }
47
-
48
- [part='error-message'] {
49
- background-color: hsla(3, 100%, 60%, 0.1);
50
- padding: 1rem;
51
- border-radius: 0.25em;
52
- margin-top: 1rem;
53
- margin-bottom: 0.5rem;
54
- color: var(--material-error-text-color);
55
- }
56
-
57
- :host(:not([dir='rtl'])) [part='error-message'] {
58
- padding-left: 2.25rem;
59
- }
60
-
61
- :host([dir='rtl']) [part='error-message'] {
62
- padding-right: 2.25rem;
63
- }
64
-
65
- [part='error-message']::before {
66
- content: '!';
67
- font-size: 1.3em;
68
- font-weight: 500;
69
- position: absolute;
70
- width: 2.25rem;
71
- height: 1em;
72
- line-height: 1;
73
- text-align: center;
74
- }
75
-
76
- /* Visual centering */
77
- :host(:not([dir='rtl'])) [part='error-message']::before {
78
- margin-left: calc(2.25rem * -0.95);
79
- }
80
-
81
- :host([dir='rtl']) [part='error-message']::before {
82
- margin-right: calc(2.25rem * -0.95);
83
- }
84
-
85
- [part='error-message-title'] {
86
- display: block;
87
- margin: 0 0 0.25em;
88
- color: inherit;
89
- line-height: 1.1;
90
- text-indent: -0.025em;
91
- }
92
-
93
- [part='error-message'] p {
94
- font-size: var(--material-small-font-size);
95
- line-height: 1.375;
96
- margin: 0;
97
- opacity: 0.9;
98
- }
99
-
100
- [part='footer'] {
101
- font-size: var(--material-small-font-size);
102
- line-height: 1.375;
103
- color: var(--material-secondary-text-color);
104
- }
105
- `;
106
-
107
- registerStyles('vaadin-login-form-wrapper', [typography, loginFormWrapper], {
108
- moduleId: 'material-login-form-wrapper',
109
- });
@@ -1,5 +0,0 @@
1
- import '@vaadin/button/theme/material/vaadin-button.js';
2
- import '@vaadin/text-field/theme/material/vaadin-text-field.js';
3
- import '@vaadin/password-field/theme/material/vaadin-password-field.js';
4
- import './vaadin-login-form-wrapper-styles.js';
5
- import '../../src/vaadin-login-form.js';
@@ -1,5 +0,0 @@
1
- import '@vaadin/button/theme/material/vaadin-button.js';
2
- import '@vaadin/text-field/theme/material/vaadin-text-field.js';
3
- import '@vaadin/password-field/theme/material/vaadin-password-field.js';
4
- import './vaadin-login-form-wrapper-styles.js';
5
- import '../../src/vaadin-login-form.js';
@@ -1 +0,0 @@
1
- import '@vaadin/vaadin-material-styles/color.js';