@vaadin/login 24.0.0-alpha2 → 24.0.0-alpha4

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/login",
3
- "version": "24.0.0-alpha2",
3
+ "version": "24.0.0-alpha4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -37,14 +37,14 @@
37
37
  "dependencies": {
38
38
  "@open-wc/dedupe-mixin": "^1.3.0",
39
39
  "@polymer/polymer": "^3.0.0",
40
- "@vaadin/button": "24.0.0-alpha2",
41
- "@vaadin/component-base": "24.0.0-alpha2",
42
- "@vaadin/overlay": "24.0.0-alpha2",
43
- "@vaadin/password-field": "24.0.0-alpha2",
44
- "@vaadin/text-field": "24.0.0-alpha2",
45
- "@vaadin/vaadin-lumo-styles": "24.0.0-alpha2",
46
- "@vaadin/vaadin-material-styles": "24.0.0-alpha2",
47
- "@vaadin/vaadin-themable-mixin": "24.0.0-alpha2"
40
+ "@vaadin/button": "24.0.0-alpha4",
41
+ "@vaadin/component-base": "24.0.0-alpha4",
42
+ "@vaadin/overlay": "24.0.0-alpha4",
43
+ "@vaadin/password-field": "24.0.0-alpha4",
44
+ "@vaadin/text-field": "24.0.0-alpha4",
45
+ "@vaadin/vaadin-lumo-styles": "24.0.0-alpha4",
46
+ "@vaadin/vaadin-material-styles": "24.0.0-alpha4",
47
+ "@vaadin/vaadin-themable-mixin": "24.0.0-alpha4"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@esm-bundle/chai": "^4.3.4",
@@ -55,5 +55,5 @@
55
55
  "web-types.json",
56
56
  "web-types.lit.json"
57
57
  ],
58
- "gitHead": "0c16c01a6807e629a84f5a982793afecc1a7ced0"
58
+ "gitHead": "66be46e82c4d0a673859fbc9bdb1581dd89f360c"
59
59
  }
@@ -3,22 +3,17 @@
3
3
  * Copyright (c) 2018 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import '@vaadin/button/src/vaadin-button.js';
7
6
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
8
- import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
9
7
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
10
- import { LoginMixin } from './vaadin-login-mixin.js';
11
8
 
12
9
  /**
13
10
  * An element used internally by `<vaadin-login-form>`. Not intended to be used separately.
14
11
  *
15
12
  * @extends HTMLElement
16
- * @mixes ElementMixin
17
13
  * @mixes ThemableMixin
18
- * @mixes LoginMixin
19
14
  * @private
20
15
  */
21
- class LoginFormWrapper extends LoginMixin(ElementMixin(ThemableMixin(PolymerElement))) {
16
+ class LoginFormWrapper extends ThemableMixin(PolymerElement) {
22
17
  static get template() {
23
18
  return html`
24
19
  <style>
@@ -55,13 +50,7 @@ class LoginFormWrapper extends LoginMixin(ElementMixin(ThemableMixin(PolymerElem
55
50
 
56
51
  <slot name="form"></slot>
57
52
 
58
- <vaadin-button
59
- id="forgotPasswordButton"
60
- theme="tertiary small forgot-password"
61
- on-click="_forgotPassword"
62
- hidden$="[[noForgotPassword]]"
63
- >[[i18n.form.forgotPassword]]</vaadin-button
64
- >
53
+ <slot name="forgot-password"></slot>
65
54
 
66
55
  <div part="footer">
67
56
  <p>[[i18n.additionalInformation]]</p>
@@ -74,8 +63,26 @@ class LoginFormWrapper extends LoginMixin(ElementMixin(ThemableMixin(PolymerElem
74
63
  return 'vaadin-login-form-wrapper';
75
64
  }
76
65
 
77
- _forgotPassword() {
78
- this.dispatchEvent(new CustomEvent('forgot-password'));
66
+ static get properties() {
67
+ return {
68
+ /**
69
+ * If set, the error message is shown. The message is hidden by default.
70
+ * When set, it changes the disabled state of the submit button.
71
+ * @type {boolean}
72
+ */
73
+ error: {
74
+ type: Boolean,
75
+ value: false,
76
+ reflectToAttribute: true,
77
+ },
78
+
79
+ /**
80
+ * The object used to localize this component.
81
+ */
82
+ i18n: {
83
+ type: Object,
84
+ },
85
+ };
79
86
  }
80
87
  }
81
88
 
@@ -3,6 +3,7 @@
3
3
  * Copyright (c) 2018 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
+ import '@vaadin/button/src/vaadin-button.js';
6
7
  import '@vaadin/text-field/src/vaadin-text-field.js';
7
8
  import '@vaadin/password-field/src/vaadin-password-field.js';
8
9
  import './vaadin-login-form-wrapper.js';
@@ -58,14 +59,7 @@ class LoginForm extends LoginMixin(ElementMixin(ThemableMixin(PolymerElement)))
58
59
  width: 100%;
59
60
  }
60
61
  </style>
61
- <vaadin-login-form-wrapper
62
- theme$="[[_theme]]"
63
- error="[[error]]"
64
- no-forgot-password="[[noForgotPassword]]"
65
- i18n="[[i18n]]"
66
- on-login="_retargetEvent"
67
- on-forgot-password="_retargetEvent"
68
- >
62
+ <vaadin-login-form-wrapper theme$="[[_theme]]" error="[[error]]" i18n="[[i18n]]">
69
63
  <form method="POST" action$="[[action]]" slot="form">
70
64
  <input id="csrf" type="hidden" />
71
65
  <vaadin-text-field
@@ -97,6 +91,15 @@ class LoginForm extends LoginMixin(ElementMixin(ThemableMixin(PolymerElement)))
97
91
  [[i18n.form.submit]]
98
92
  </vaadin-button>
99
93
  </form>
94
+
95
+ <vaadin-button
96
+ slot="forgot-password"
97
+ theme="tertiary small"
98
+ on-click="_onForgotPasswordClick"
99
+ hidden$="[[noForgotPassword]]"
100
+ >
101
+ [[i18n.form.forgotPassword]]
102
+ </vaadin-button>
100
103
  </vaadin-login-form-wrapper>
101
104
  `;
102
105
  }
@@ -189,6 +192,11 @@ class LoginForm extends LoginMixin(ElementMixin(ThemableMixin(PolymerElement)))
189
192
  input.select();
190
193
  }
191
194
  }
195
+
196
+ /** @private */
197
+ _onForgotPasswordClick() {
198
+ this.dispatchEvent(new CustomEvent('forgot-password'));
199
+ }
192
200
  }
193
201
 
194
202
  customElements.define(LoginForm.is, LoginForm);
@@ -89,6 +89,4 @@ export declare class LoginMixinClass {
89
89
  * ```
90
90
  */
91
91
  i18n: LoginI18n;
92
-
93
- protected _retargetEvent(e: Event): void;
94
92
  }
@@ -140,19 +140,4 @@ export const LoginMixin = (superClass) =>
140
140
  },
141
141
  };
142
142
  }
143
-
144
- /**
145
- * @param {!Event} e
146
- * @protected
147
- */
148
- _retargetEvent(e) {
149
- e.stopPropagation();
150
- const { detail, composed, cancelable, bubbles } = e;
151
-
152
- const firedEvent = this.dispatchEvent(new CustomEvent(e.type, { bubbles, cancelable, composed, detail }));
153
- // Check if `eventTarget.preventDefault()` was called to prevent default in the original event
154
- if (!firedEvent) {
155
- e.preventDefault();
156
- }
157
- }
158
143
  };
@@ -3,56 +3,56 @@
3
3
  * Copyright (c) 2018 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { DomModule } from '@polymer/polymer/lib/elements/dom-module.js';
6
+ import { html } from '@polymer/polymer/lib/utils/html-tag.js';
7
7
  import { Overlay } from '@vaadin/overlay/src/vaadin-overlay.js';
8
+ import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
8
9
 
9
- const template = document.createElement('template');
10
-
11
- template.innerHTML = `<dom-module id="vaadin-login-overlay-wrapper-template">
12
- <template>
13
- <style>
14
- [part="overlay"] {
15
- outline: none;
16
- }
10
+ registerStyles(
11
+ 'vaadin-login-overlay-wrapper',
12
+ css`
13
+ [part='overlay'] {
14
+ outline: none;
15
+ }
17
16
 
18
- [part="card"] {
19
- max-width: 100%;
20
- box-sizing: border-box;
21
- overflow: hidden;
22
- display: flex;
23
- flex-direction: column;
24
- }
17
+ [part='card'] {
18
+ max-width: 100%;
19
+ box-sizing: border-box;
20
+ overflow: hidden;
21
+ display: flex;
22
+ flex-direction: column;
23
+ }
25
24
 
26
- [part="brand"] {
27
- box-sizing: border-box;
28
- overflow: hidden;
29
- flex-grow: 1;
30
- flex-shrink: 0;
31
- display: flex;
32
- flex-direction: column;
33
- justify-content: flex-end;
34
- }
25
+ [part='brand'] {
26
+ box-sizing: border-box;
27
+ overflow: hidden;
28
+ flex-grow: 1;
29
+ flex-shrink: 0;
30
+ display: flex;
31
+ flex-direction: column;
32
+ justify-content: flex-end;
33
+ }
35
34
 
36
- [part="brand"] h1 {
37
- color: inherit;
38
- margin: 0;
39
- }
40
- </style>
41
- <section part="card">
42
- <div part="brand">
43
- <slot name="title">
44
- <h1 part="title">[[title]]</h1>
45
- </slot>
46
- <p part="description">[[description]]</p>
47
- </div>
48
- <div part="form">
49
- <slot></slot>
50
- </div>
51
- </section>
52
- </template>
53
- </dom-module>`;
35
+ [part='brand'] h1 {
36
+ color: inherit;
37
+ margin: 0;
38
+ }
39
+ `,
40
+ { moduleId: 'vaadin-login-overlay-wrapper-styles' },
41
+ );
54
42
 
55
- document.head.appendChild(template.content);
43
+ const template = html`
44
+ <section part="card">
45
+ <div part="brand">
46
+ <slot name="title">
47
+ <h1 part="title">[[title]]</h1>
48
+ </slot>
49
+ <p part="description">[[description]]</p>
50
+ </div>
51
+ <div part="form">
52
+ <slot></slot>
53
+ </div>
54
+ </section>
55
+ `;
56
56
 
57
57
  let memoizedTemplate;
58
58
 
@@ -90,15 +90,10 @@ class LoginOverlayWrapper extends Overlay {
90
90
  // Clone the superclass template
91
91
  memoizedTemplate = super.template.cloneNode(true);
92
92
 
93
- // Retrieve the elements from component's template
94
- const thisTemplate = DomModule.import(`${this.is}-template`, 'template');
95
- const card = thisTemplate.content.querySelector('[part=card]');
96
- const styles = thisTemplate.content.querySelector('style');
97
-
98
- // Append elements to cloned template
93
+ // Replace overlay slot with card
94
+ const card = template.content.querySelector('[part=card]');
99
95
  const content = memoizedTemplate.content.querySelector('#content');
100
96
  content.replaceChild(card, content.children[0]);
101
- content.appendChild(styles);
102
97
  }
103
98
 
104
99
  return memoizedTemplate;
@@ -164,6 +164,21 @@ class LoginOverlay extends LoginMixin(ElementMixin(ThemableMixin(PolymerElement)
164
164
  e.preventDefault();
165
165
  }
166
166
 
167
+ /**
168
+ * @param {!Event} e
169
+ * @private
170
+ */
171
+ _retargetEvent(e) {
172
+ e.stopPropagation();
173
+ const { detail, composed, cancelable, bubbles } = e;
174
+
175
+ const firedEvent = this.dispatchEvent(new CustomEvent(e.type, { bubbles, cancelable, composed, detail }));
176
+ // Check if `eventTarget.preventDefault()` was called to prevent default in the original event
177
+ if (!firedEvent) {
178
+ e.preventDefault();
179
+ }
180
+ }
181
+
167
182
  /** @private */
168
183
  _onOpenedChange() {
169
184
  if (!this.opened) {
@@ -17,7 +17,7 @@ const loginFormWrapper = css`
17
17
  margin-top: calc(var(--lumo-font-size-xxxl) - var(--lumo-font-size-xxl));
18
18
  }
19
19
 
20
- #forgotPasswordButton {
20
+ ::slotted([slot='forgot-password']) {
21
21
  margin: var(--lumo-space-s) auto;
22
22
  }
23
23
 
@@ -1,5 +1,6 @@
1
+ import '@vaadin/button/theme/lumo/vaadin-button.js';
1
2
  import '@vaadin/text-field/theme/lumo/vaadin-text-field.js';
2
3
  import '@vaadin/password-field/theme/lumo/vaadin-password-field.js';
3
- import './vaadin-login-form-wrapper.js';
4
+ import './vaadin-login-form-wrapper-styles.js';
4
5
  import './vaadin-login-form-styles.js';
5
6
  import '../../src/vaadin-login-form.js';
@@ -22,7 +22,7 @@ const loginFormWrapper = css`
22
22
  font-size: var(--material-h5-font-size);
23
23
  }
24
24
 
25
- #forgotPasswordButton {
25
+ ::slotted([slot='forgot-password']) {
26
26
  margin: 0.5rem auto;
27
27
  padding-bottom: 12px;
28
28
  padding-top: 12px;
@@ -1,5 +1,6 @@
1
+ import '@vaadin/button/theme/material/vaadin-button.js';
1
2
  import '@vaadin/text-field/theme/material/vaadin-text-field.js';
2
3
  import '@vaadin/password-field/theme/material/vaadin-password-field.js';
3
- import './vaadin-login-form-wrapper.js';
4
+ import './vaadin-login-form-wrapper-styles.js';
4
5
  import './vaadin-login-form-styles.js';
5
6
  import '../../src/vaadin-login-form.js';
@@ -302,7 +302,7 @@ const loginOverlayWrapper = css`
302
302
  `;
303
303
 
304
304
  registerStyles('vaadin-login-overlay-wrapper', [overlay, typography, loginOverlayWrapper], {
305
- moduleId: 'vaadin-login-overlay-wrapper-material-styles',
305
+ moduleId: 'material-login-overlay-wrapper',
306
306
  });
307
307
 
308
308
  const loginFormWrapper = css`
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/login",
4
- "version": "24.0.0-alpha2",
4
+ "version": "24.0.0-alpha4",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -148,7 +148,7 @@
148
148
  },
149
149
  {
150
150
  "name": "vaadin-login-overlay",
151
- "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/custom-theme/styling-components) documentation.\n\nSee [`<vaadin-login-form>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha2/#/elements/vaadin-login-form)\ndocumentation for `<vaadin-login-form-wrapper>` stylable parts.",
151
+ "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/custom-theme/styling-components) documentation.\n\nSee [`<vaadin-login-form>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha4/#/elements/vaadin-login-form)\ndocumentation for `<vaadin-login-form-wrapper>` stylable parts.",
152
152
  "attributes": [
153
153
  {
154
154
  "name": "action",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/login",
4
- "version": "24.0.0-alpha2",
4
+ "version": "24.0.0-alpha4",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -93,7 +93,7 @@
93
93
  },
94
94
  {
95
95
  "name": "vaadin-login-overlay",
96
- "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/custom-theme/styling-components) documentation.\n\nSee [`<vaadin-login-form>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha2/#/elements/vaadin-login-form)\ndocumentation for `<vaadin-login-form-wrapper>` stylable parts.",
96
+ "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/custom-theme/styling-components) documentation.\n\nSee [`<vaadin-login-form>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-alpha4/#/elements/vaadin-login-form)\ndocumentation for `<vaadin-login-form-wrapper>` stylable parts.",
97
97
  "extension": true,
98
98
  "attributes": [
99
99
  {
@@ -1,3 +0,0 @@
1
- import '@vaadin/button/theme/lumo/vaadin-button.js';
2
- import './vaadin-login-form-wrapper-styles.js';
3
- import '../../src/vaadin-login-form-wrapper.js';
@@ -1,3 +0,0 @@
1
- import '@vaadin/button/theme/material/vaadin-button.js';
2
- import './vaadin-login-form-wrapper-styles.js';
3
- import '../../src/vaadin-login-form-wrapper.js';