@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
package/README.md CHANGED
@@ -26,32 +26,6 @@ Once installed, import the component in your application:
26
26
  import '@vaadin/login';
27
27
  ```
28
28
 
29
- ## Themes
30
-
31
- Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/styling), Lumo and Material.
32
- The [main entrypoint](https://github.com/vaadin/web-components/blob/main/packages/list-box/vaadin-list-box.js) of the package uses Lumo theme.
33
-
34
- To use the Material theme, import the components from the `theme/material` folder:
35
-
36
- ```js
37
- import '@vaadin/login/theme/material/vaadin-login-overlay.js';
38
- import '@vaadin/login/theme/material/vaadin-login-form.js';
39
- ```
40
-
41
- You can also import the Lumo version of the components explicitly:
42
-
43
- ```js
44
- import '@vaadin/login/theme/lumo/vaadin-login-overlay.js';
45
- import '@vaadin/login/theme/lumo/vaadin-login-form.js';
46
- ```
47
-
48
- Finally, you can import the un-themed components from the `src` folder to get a minimal starting point:
49
-
50
- ```js
51
- import '@vaadin/login/src/vaadin-login-overlay.js';
52
- import '@vaadin/login/src/vaadin-login-form.js';
53
- ```
54
-
55
29
  ## Contributing
56
30
 
57
31
  Read the [contributing guide](https://vaadin.com/docs/latest/contributing) to learn about our development process, how to propose bugfixes and improvements, and how to test your changes to Vaadin components.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/login",
3
- "version": "24.8.4",
3
+ "version": "25.0.0-alpha10",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -21,6 +21,8 @@
21
21
  "type": "module",
22
22
  "files": [
23
23
  "src",
24
+ "!src/styles/*-base-styles.d.ts",
25
+ "!src/styles/*-base-styles.js",
24
26
  "theme",
25
27
  "vaadin-*.d.ts",
26
28
  "vaadin-*.js",
@@ -31,32 +33,30 @@
31
33
  "Vaadin",
32
34
  "vaadin-login",
33
35
  "web-components",
34
- "web-component",
35
- "polymer"
36
+ "web-component"
36
37
  ],
37
38
  "dependencies": {
38
39
  "@open-wc/dedupe-mixin": "^1.3.0",
39
- "@polymer/polymer": "^3.0.0",
40
- "@vaadin/button": "~24.8.4",
41
- "@vaadin/component-base": "~24.8.4",
42
- "@vaadin/overlay": "~24.8.4",
43
- "@vaadin/password-field": "~24.8.4",
44
- "@vaadin/text-field": "~24.8.4",
45
- "@vaadin/vaadin-lumo-styles": "~24.8.4",
46
- "@vaadin/vaadin-material-styles": "~24.8.4",
47
- "@vaadin/vaadin-themable-mixin": "~24.8.4",
40
+ "@vaadin/button": "25.0.0-alpha10",
41
+ "@vaadin/component-base": "25.0.0-alpha10",
42
+ "@vaadin/overlay": "25.0.0-alpha10",
43
+ "@vaadin/password-field": "25.0.0-alpha10",
44
+ "@vaadin/text-field": "25.0.0-alpha10",
45
+ "@vaadin/vaadin-lumo-styles": "25.0.0-alpha10",
46
+ "@vaadin/vaadin-themable-mixin": "25.0.0-alpha10",
48
47
  "lit": "^3.0.0"
49
48
  },
50
49
  "devDependencies": {
51
- "@vaadin/chai-plugins": "~24.8.4",
52
- "@vaadin/checkbox": "~24.8.4",
53
- "@vaadin/test-runner-commands": "~24.8.4",
54
- "@vaadin/testing-helpers": "^1.1.0",
50
+ "@vaadin/a11y-base": "25.0.0-alpha10",
51
+ "@vaadin/chai-plugins": "25.0.0-alpha10",
52
+ "@vaadin/checkbox": "25.0.0-alpha10",
53
+ "@vaadin/test-runner-commands": "25.0.0-alpha10",
54
+ "@vaadin/testing-helpers": "^2.0.0",
55
55
  "sinon": "^18.0.0"
56
56
  },
57
57
  "web-types": [
58
58
  "web-types.json",
59
59
  "web-types.lit.json"
60
60
  ],
61
- "gitHead": "849e54e967563080a685965e2dced02060b3ab23"
61
+ "gitHead": "6cc6c94079e805fa5b2f0af4dbf3b2a7485e57d0"
62
62
  }
@@ -0,0 +1,65 @@
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/component-base/src/style-props.js';
7
+ import { css } from 'lit';
8
+
9
+ export const loginFormWrapperStyles = css`
10
+ :host {
11
+ background: var(--vaadin-login-form-background, transparent);
12
+ border-radius: var(--vaadin-login-form-border-radius, 0);
13
+ display: flex;
14
+ box-sizing: border-box;
15
+ flex-direction: column;
16
+ gap: var(--vaadin-login-form-gap, var(--vaadin-gap-container-block));
17
+ padding: var(--vaadin-login-form-padding, var(--vaadin-padding));
18
+ max-width: 100%;
19
+ width: var(--vaadin-login-form-width, 360px);
20
+ }
21
+
22
+ :host([hidden]) {
23
+ display: none !important;
24
+ }
25
+
26
+ ::slotted(form) {
27
+ display: flex;
28
+ flex-direction: column;
29
+ gap: var(--vaadin-login-form-gap, var(--vaadin-gap-container-block));
30
+ }
31
+
32
+ ::slotted([slot='form-title']) {
33
+ color: var(--vaadin-login-form-title-color, var(--vaadin-color));
34
+ font-size: var(--vaadin-login-form-title-font-size, 1.25rem);
35
+ font-weight: var(--vaadin-login-form-title-font-weight, 600);
36
+ line-height: var(--vaadin-login-form-title-line-height, inherit);
37
+ }
38
+
39
+ :host([error]) [part='error-message'] {
40
+ display: grid;
41
+ }
42
+
43
+ [part='error-message'] {
44
+ color: var(--vaadin-login-form-error-color, var(--vaadin-color));
45
+ font-size: var(--vaadin-login-form-error-font-size, inherit);
46
+ font-weight: var(--vaadin-login-form-error-font-weight, 400);
47
+ gap: var(--vaadin-login-form-error-gap, 0 var(--vaadin-gap-container-inline));
48
+ grid-template-columns: auto 1fr;
49
+ line-height: var(--vaadin-login-form-error-line-height, inherit);
50
+ }
51
+
52
+ [part='error-message']::before {
53
+ background: currentColor;
54
+ content: '';
55
+ display: inline-block;
56
+ flex: none;
57
+ height: var(--vaadin-icon-size, 1lh);
58
+ mask-image: var(--_vaadin-icon-warn);
59
+ width: var(--vaadin-icon-size, 1lh);
60
+ }
61
+
62
+ [part='error-message-description'] {
63
+ grid-column: 2;
64
+ }
65
+ `;
@@ -0,0 +1,8 @@
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 type { CSSResult } from 'lit';
7
+
8
+ export const loginFormWrapperStyles: CSSResult;
@@ -7,26 +7,25 @@ import { css } from 'lit';
7
7
 
8
8
  export const loginFormWrapperStyles = css`
9
9
  :host {
10
+ display: flex;
11
+ flex-direction: column;
12
+ box-sizing: border-box;
10
13
  overflow: hidden;
11
- display: inline-block;
12
14
  }
13
15
 
14
16
  :host([hidden]) {
15
17
  display: none !important;
16
18
  }
17
19
 
18
- [part='form'] {
19
- flex: 1;
20
- display: flex;
21
- flex-direction: column;
22
- box-sizing: border-box;
23
- }
24
-
25
- [part='form-title'] {
20
+ ::slotted([slot='form-title']) {
26
21
  margin: 0;
27
22
  }
28
23
 
29
24
  [part='error-message'] {
30
25
  position: relative;
31
26
  }
27
+
28
+ strong {
29
+ font-weight: 600;
30
+ }
32
31
  `;
@@ -0,0 +1,55 @@
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/component-base/src/style-props.js';
7
+ import { css } from 'lit';
8
+ import { overlayStyles } from '@vaadin/overlay/src/styles/vaadin-overlay-base-styles.js';
9
+
10
+ const loginOverlayWrapper = css`
11
+ [part='overlay'] {
12
+ background: var(
13
+ --vaadin-login-overlay-background,
14
+ var(--vaadin-overlay-background, var(--vaadin-background-color))
15
+ );
16
+ border: var(--vaadin-login-overlay-border-width, var(--vaadin-overlay-border-width, 1px)) solid
17
+ var(--vaadin-login-overlay-border-color, var(--vaadin-overlay-border-color, var(--vaadin-border-color)));
18
+ border-radius: var(--vaadin-login-overlay-border-radius, var(--vaadin-radius-l));
19
+ box-shadow: var(
20
+ --vaadin-login-overlay-box-shadow,
21
+ var(--vaadin-overlay-box-shadow, 0 8px 24px -4px rgba(0, 0, 0, 0.3))
22
+ );
23
+ }
24
+
25
+ [part='card'] {
26
+ box-sizing: border-box;
27
+ display: flex;
28
+ flex-direction: column;
29
+ max-width: 100%;
30
+ overflow: hidden;
31
+ }
32
+
33
+ [part='brand'] {
34
+ background: var(--vaadin-login-overlay-brand-background, var(--vaadin-background-container));
35
+ display: flex;
36
+ flex-direction: column;
37
+ padding: var(--vaadin-login-overlay-brand-padding, var(--vaadin-padding));
38
+ }
39
+
40
+ ::slotted([slot='title']) {
41
+ color: var(--vaadin-login-overlay-title-color, var(--vaadin-color));
42
+ font-size: var(--vaadin-login-overlay-title-font-size, inherit);
43
+ font-weight: var(--vaadin-login-overlay-title-font-weight, 600);
44
+ line-height: var(--vaadin-login-overlay-title-line-height, inherit);
45
+ }
46
+
47
+ [part='description'] {
48
+ color: var(--vaadin-login-overlay-description-color, var(--vaadin-color-subtle));
49
+ font-size: var(--vaadin-login-overlay-description-font-size, inherit);
50
+ font-weight: var(--vaadin-login-overlay-description-font-weight, inherit);
51
+ line-height: var(--vaadin-login-overlay-description-line-height, inherit);
52
+ }
53
+ `;
54
+
55
+ export const loginOverlayWrapperStyles = [overlayStyles, loginOverlayWrapper];
@@ -0,0 +1,8 @@
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 type { CSSResult } from 'lit';
7
+
8
+ export const loginOverlayWrapperStyles: CSSResult;
@@ -4,8 +4,9 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { css } from 'lit';
7
+ import { overlayStyles } from '@vaadin/overlay/src/styles/vaadin-overlay-core-styles.js';
7
8
 
8
- export const loginOverlayWrapperStyles = css`
9
+ const loginOverlayWrapper = css`
9
10
  [part='overlay'] {
10
11
  outline: none;
11
12
  }
@@ -28,8 +29,10 @@ export const loginOverlayWrapperStyles = css`
28
29
  justify-content: flex-end;
29
30
  }
30
31
 
31
- [part='title'] {
32
+ ::slotted([slot='title']) {
32
33
  color: inherit;
33
34
  margin: 0;
34
35
  }
35
36
  `;
37
+
38
+ export const loginOverlayWrapperStyles = [overlayStyles, loginOverlayWrapper];
@@ -0,0 +1,11 @@
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 { SlotChildObserveController } from '@vaadin/component-base/src/slot-child-observe-controller.js';
7
+
8
+ /**
9
+ * A controller to manage the title element.
10
+ */
11
+ export class TitleController extends SlotChildObserveController {}
@@ -0,0 +1,100 @@
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 { SlotChildObserveController } from '@vaadin/component-base/src/slot-child-observe-controller.js';
7
+
8
+ /**
9
+ * A controller to manage the title element.
10
+ */
11
+ export class TitleController extends SlotChildObserveController {
12
+ constructor(host) {
13
+ super(host, 'title', 'div');
14
+ }
15
+
16
+ /**
17
+ * Set title based on corresponding host property.
18
+ *
19
+ * @param {string} title
20
+ */
21
+ setTitle(title) {
22
+ this.title = title;
23
+
24
+ // Restore the default title, if needed.
25
+ const titleNode = this.getSlotChild();
26
+ if (!titleNode) {
27
+ this.restoreDefaultNode();
28
+ }
29
+
30
+ // When default title is used, update it.
31
+ if (this.node === this.defaultNode) {
32
+ this.updateDefaultNode(this.node);
33
+ }
34
+ }
35
+
36
+ /**
37
+ * Set level based on corresponding host property.
38
+ *
39
+ * @param {string} level
40
+ */
41
+ setLevel(level) {
42
+ this.level = level;
43
+
44
+ // When default title is used, update it.
45
+ if (this.node === this.defaultNode) {
46
+ this.updateDefaultNode(this.node);
47
+ }
48
+ }
49
+
50
+ /**
51
+ * Override method inherited from `SlotController`
52
+ * to customize heading on the default title node.
53
+ *
54
+ * @param {Node} node
55
+ * @protected
56
+ * @override
57
+ */
58
+ initNode(node) {
59
+ if (node === this.defaultNode) {
60
+ node.setAttribute('role', 'heading');
61
+ }
62
+
63
+ this.host.setAttribute('aria-labelledby', node.id);
64
+ }
65
+
66
+ /**
67
+ * Override method inherited from `SlotChildObserveController`
68
+ * to restore the default title element.
69
+ *
70
+ * @protected
71
+ * @override
72
+ */
73
+ restoreDefaultNode() {
74
+ const { title } = this;
75
+
76
+ // Restore the default title.
77
+ if (title && title.trim() !== '') {
78
+ const node = this.attachDefaultNode();
79
+ this.initNode(node);
80
+ }
81
+ }
82
+
83
+ /**
84
+ * Override method inherited from `SlotChildObserveController`
85
+ * to update the default title element.
86
+ *
87
+ * @param {Node | undefined} node
88
+ * @protected
89
+ * @override
90
+ */
91
+ updateDefaultNode(node) {
92
+ if (node) {
93
+ node.textContent = this.title;
94
+ node.setAttribute('aria-level', this.level);
95
+ }
96
+
97
+ // Notify the host after update.
98
+ super.updateDefaultNode(node);
99
+ }
100
+ }
@@ -3,6 +3,8 @@
3
3
  * Copyright (c) 2018 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
+ import { html, render } from 'lit';
7
+ import { ifDefined } from 'lit/directives/if-defined.js';
6
8
  import { LoginMixin } from './vaadin-login-mixin.js';
7
9
 
8
10
  function isCheckbox(field) {
@@ -15,16 +17,43 @@ function isCheckbox(field) {
15
17
  */
16
18
  export const LoginFormMixin = (superClass) =>
17
19
  class LoginFormMixin extends LoginMixin(superClass) {
18
- static get observers() {
19
- return ['_errorChanged(error)'];
20
- }
21
-
20
+ /** @protected */
22
21
  get _customFields() {
23
- return [...this.$.vaadinLoginFormWrapper.children].filter((node) => {
22
+ return [...this.children].filter((node) => {
24
23
  return node.getAttribute('slot') === 'custom-form-area' && node.hasAttribute('name');
25
24
  });
26
25
  }
27
26
 
27
+ /** @protected */
28
+ get _userNameField() {
29
+ return this.querySelector('#vaadinLoginUsername');
30
+ }
31
+
32
+ /** @protected */
33
+ get _passwordField() {
34
+ return this.querySelector('#vaadinLoginPassword');
35
+ }
36
+
37
+ /**
38
+ * Override update to render slotted form and buttons
39
+ * into light DOM after rendering shadow DOM.
40
+ * @protected
41
+ */
42
+ update(props) {
43
+ super.update(props);
44
+
45
+ this.__renderSlottedForm();
46
+ }
47
+
48
+ /** @protected */
49
+ updated(props) {
50
+ super.updated(props);
51
+
52
+ if (props.has('error') && this.error && !this._preventAutoEnable) {
53
+ this.disabled = false;
54
+ }
55
+ }
56
+
28
57
  /** @protected */
29
58
  async connectedCallback() {
30
59
  super.connectedCallback();
@@ -32,23 +61,70 @@ export const LoginFormMixin = (superClass) =>
32
61
  if (!this.noAutofocus) {
33
62
  // Wait for the form to fully render.
34
63
  await new Promise(requestAnimationFrame);
35
- this.$.vaadinLoginUsername.focus();
64
+ this._userNameField.focus();
36
65
  }
37
66
  }
38
67
 
39
- /** @private */
40
- _errorChanged() {
41
- if (this.error && !this._preventAutoEnable) {
42
- this.disabled = false;
43
- }
68
+ __renderSlottedForm() {
69
+ render(
70
+ html`
71
+ <form method="POST" action="${ifDefined(this.action)}" @formdata="${this._onFormData}" slot="form">
72
+ <input id="csrf" type="hidden" />
73
+ <vaadin-text-field
74
+ name="username"
75
+ .label="${this.__effectiveI18n.form.username}"
76
+ .errorMessage="${this.__effectiveI18n.errorMessage.username}"
77
+ id="vaadinLoginUsername"
78
+ required
79
+ @keydown="${this._handleInputKeydown}"
80
+ autocapitalize="none"
81
+ autocorrect="off"
82
+ spellcheck="false"
83
+ autocomplete="username"
84
+ manual-validation
85
+ >
86
+ <input type="text" slot="input" @keyup="${this._handleInputKeyup}" />
87
+ </vaadin-text-field>
88
+
89
+ <vaadin-password-field
90
+ name="password"
91
+ .label="${this.__effectiveI18n.form.password}"
92
+ .errorMessage="${this.__effectiveI18n.errorMessage.password}"
93
+ id="vaadinLoginPassword"
94
+ required
95
+ @keydown="${this._handleInputKeydown}"
96
+ spellcheck="false"
97
+ autocomplete="current-password"
98
+ manual-validation
99
+ >
100
+ <input type="password" slot="input" @keyup="${this._handleInputKeyup}" />
101
+ </vaadin-password-field>
102
+ </form>
103
+
104
+ <vaadin-button slot="submit" theme="primary submit" @click="${this.submit}" .disabled="${this.disabled}">
105
+ ${this.__effectiveI18n.form.submit}
106
+ </vaadin-button>
107
+
108
+ <vaadin-button
109
+ slot="forgot-password"
110
+ theme="tertiary small"
111
+ @click="${this._onForgotPasswordClick}"
112
+ ?hidden="${this.noForgotPassword}"
113
+ >
114
+ ${this.__effectiveI18n.form.forgotPassword}
115
+ </vaadin-button>
116
+ `,
117
+ this,
118
+ { host: this },
119
+ );
44
120
  }
45
121
 
46
122
  /**
47
123
  * Submits the form.
48
124
  */
49
125
  submit() {
50
- const userName = this.$.vaadinLoginUsername;
51
- const password = this.$.vaadinLoginPassword;
126
+ const userName = this._userNameField;
127
+ const password = this._passwordField;
52
128
 
53
129
  // eslint-disable-next-line no-restricted-syntax
54
130
  userName.validate();
@@ -91,8 +167,9 @@ export const LoginFormMixin = (superClass) =>
91
167
  const csrfMetaName = document.querySelector('meta[name=_csrf_parameter]');
92
168
  const csrfMetaValue = document.querySelector('meta[name=_csrf]');
93
169
  if (csrfMetaName && csrfMetaValue) {
94
- this.$.csrf.name = csrfMetaName.content;
95
- this.$.csrf.value = csrfMetaValue.content;
170
+ const csrf = this.querySelector('#csrf');
171
+ csrf.name = csrfMetaName.content;
172
+ csrf.value = csrfMetaValue.content;
96
173
  }
97
174
  this.querySelector('form').submit();
98
175
  }
@@ -117,8 +194,7 @@ export const LoginFormMixin = (superClass) =>
117
194
  _handleInputKeydown(e) {
118
195
  if (e.key === 'Enter') {
119
196
  const { currentTarget: inputActive } = e;
120
- const nextInput =
121
- inputActive.id === 'vaadinLoginUsername' ? this.$.vaadinLoginPassword : this.$.vaadinLoginUsername;
197
+ const nextInput = inputActive.id === 'vaadinLoginUsername' ? this._passwordField : this._userNameField;
122
198
  // eslint-disable-next-line no-restricted-syntax
123
199
  if (inputActive.validate()) {
124
200
  if (nextInput.checkValidity()) {
@@ -3,14 +3,12 @@
3
3
  * Copyright (c) 2018 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
6
+ import { html, LitElement } from 'lit';
7
7
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
8
- import { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
9
- import { loginFormWrapperStyles } from './vaadin-login-form-wrapper-styles.js';
10
-
11
- registerStyles('vaadin-login-form-wrapper', loginFormWrapperStyles, {
12
- moduleId: 'vaadin-login-form-wrapper-styles',
13
- });
8
+ import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
9
+ import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
10
+ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
11
+ import { loginFormWrapperStyles } from './styles/vaadin-login-form-wrapper-core-styles.js';
14
12
 
15
13
  /**
16
14
  * An element used internally by `<vaadin-login-form>`. Not intended to be used separately.
@@ -19,36 +17,15 @@ registerStyles('vaadin-login-form-wrapper', loginFormWrapperStyles, {
19
17
  * @mixes ThemableMixin
20
18
  * @private
21
19
  */
22
- class LoginFormWrapper extends ThemableMixin(PolymerElement) {
23
- static get template() {
24
- return html`
25
- <section part="form">
26
- <div part="form-title" part="form-title" role="heading" aria-level$="[[headingLevel]]">[[i18n.form.title]]</div>
27
- <div part="error-message" hidden$="[[!error]]">
28
- <strong part="error-message-title">[[i18n.errorMessage.title]]</strong>
29
- <p part="error-message-description">[[i18n.errorMessage.message]]</p>
30
- </div>
31
-
32
- <slot name="form"></slot>
33
-
34
- <slot name="custom-form-area"></slot>
35
-
36
- <slot name="submit"></slot>
37
-
38
- <slot name="forgot-password"></slot>
39
-
40
- <div part="footer">
41
- <slot name="footer"></slot>
42
- <p>[[i18n.additionalInformation]]</p>
43
- </div>
44
- </section>
45
- `;
46
- }
47
-
20
+ class LoginFormWrapper extends ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement))) {
48
21
  static get is() {
49
22
  return 'vaadin-login-form-wrapper';
50
23
  }
51
24
 
25
+ static get styles() {
26
+ return loginFormWrapperStyles;
27
+ }
28
+
52
29
  static get properties() {
53
30
  return {
54
31
  /**
@@ -68,15 +45,32 @@ class LoginFormWrapper extends ThemableMixin(PolymerElement) {
68
45
  i18n: {
69
46
  type: Object,
70
47
  },
71
-
72
- /**
73
- * Used to customize the `aria-level` attribute on the heading element.
74
- */
75
- headingLevel: {
76
- type: Number,
77
- },
78
48
  };
79
49
  }
50
+
51
+ /** @protected */
52
+ render() {
53
+ return html`
54
+ <slot name="form-title"></slot>
55
+ <div part="error-message" ?hidden="${!this.error}">
56
+ <strong part="error-message-title">${this.i18n.errorMessage.title}</strong>
57
+ <div part="error-message-description">${this.i18n.errorMessage.message}</div>
58
+ </div>
59
+
60
+ <slot name="form"></slot>
61
+
62
+ <slot name="custom-form-area"></slot>
63
+
64
+ <slot name="submit"></slot>
65
+
66
+ <slot name="forgot-password"></slot>
67
+
68
+ <div part="footer">
69
+ <slot name="footer"></slot>
70
+ <div>${this.i18n.additionalInformation}</div>
71
+ </div>
72
+ `;
73
+ }
80
74
  }
81
75
 
82
76
  defineCustomElement(LoginFormWrapper);