@vaadin/login 24.0.0-alpha1 → 24.0.0-alpha3

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-alpha1",
3
+ "version": "24.0.0-alpha3",
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-alpha1",
41
- "@vaadin/component-base": "24.0.0-alpha1",
42
- "@vaadin/overlay": "24.0.0-alpha1",
43
- "@vaadin/password-field": "24.0.0-alpha1",
44
- "@vaadin/text-field": "24.0.0-alpha1",
45
- "@vaadin/vaadin-lumo-styles": "24.0.0-alpha1",
46
- "@vaadin/vaadin-material-styles": "24.0.0-alpha1",
47
- "@vaadin/vaadin-themable-mixin": "24.0.0-alpha1"
40
+ "@vaadin/button": "24.0.0-alpha3",
41
+ "@vaadin/component-base": "24.0.0-alpha3",
42
+ "@vaadin/overlay": "24.0.0-alpha3",
43
+ "@vaadin/password-field": "24.0.0-alpha3",
44
+ "@vaadin/text-field": "24.0.0-alpha3",
45
+ "@vaadin/vaadin-lumo-styles": "24.0.0-alpha3",
46
+ "@vaadin/vaadin-material-styles": "24.0.0-alpha3",
47
+ "@vaadin/vaadin-themable-mixin": "24.0.0-alpha3"
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": "427527c27c4b27822d61fd41d38d7b170134770b"
58
+ "gitHead": "7a013a3c5a56abd61dd4f7773c6ec77c3541bdf2"
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
 
@@ -8,12 +8,26 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
8
8
  import { LoginMixin } from './vaadin-login-mixin.js';
9
9
  export { LoginI18n } from './vaadin-login-mixin.js';
10
10
 
11
+ /**
12
+ * Fired when the `disabled` property changes.
13
+ */
14
+ export type LoginFormDisabledChangedEvent = CustomEvent<{ value: boolean }>;
15
+
16
+ /**
17
+ * Fired when the `error` property changes.
18
+ */
19
+ export type LoginFormErrorChangedEvent = CustomEvent<{ value: boolean }>;
20
+
11
21
  /**
12
22
  * Fired when a user submits the login.
13
23
  */
14
24
  export type LoginFormLoginEvent = CustomEvent<{ username: string; password: string }>;
15
25
 
16
26
  export interface LoginFormCustomEventMap {
27
+ 'disabled-changed': LoginFormDisabledChangedEvent;
28
+
29
+ 'error-changed': LoginFormErrorChangedEvent;
30
+
17
31
  'forgot-password': Event;
18
32
 
19
33
  login: LoginFormLoginEvent;
@@ -46,11 +60,12 @@ export interface LoginFormEventMap extends HTMLElementEventMap, LoginFormCustomE
46
60
  * `error-message`| Container for error message, contains error-message-title and error-message-description parts. Hidden by default.
47
61
  * `error-message-title` | Container for error message title
48
62
  * `error-message-description` | Container for error message description
49
- * `error-message-description` | Container for error message description
50
63
  * `footer` | Container additional information text from `i18n` object
51
64
  *
52
65
  * See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
53
66
  *
67
+ * @fires {CustomEvent} disabled-changed - Fired when the `disabled` property changes.
68
+ * @fires {CustomEvent} error-changed - Fired when the `error` property changes.
54
69
  * @fires {CustomEvent} forgot-password - Fired when user clicks on the "Forgot password" button.
55
70
  * @fires {CustomEvent} login - Fired when a user submits the login.
56
71
  */
@@ -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';
@@ -36,11 +37,12 @@ import { LoginMixin } from './vaadin-login-mixin.js';
36
37
  * `error-message`| Container for error message, contains error-message-title and error-message-description parts. Hidden by default.
37
38
  * `error-message-title` | Container for error message title
38
39
  * `error-message-description` | Container for error message description
39
- * `error-message-description` | Container for error message description
40
40
  * `footer` | Container additional information text from `i18n` object
41
41
  *
42
42
  * See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
43
43
  *
44
+ * @fires {CustomEvent} disabled-changed - Fired when the `disabled` property changes.
45
+ * @fires {CustomEvent} error-changed - Fired when the `error` property changes.
44
46
  * @fires {CustomEvent} forgot-password - Fired when user clicks on the "Forgot password" button.
45
47
  * @fires {CustomEvent} login - Fired when a user submits the login.
46
48
  *
@@ -53,22 +55,12 @@ class LoginForm extends LoginMixin(ElementMixin(ThemableMixin(PolymerElement)))
53
55
  static get template() {
54
56
  return html`
55
57
  <style>
56
- [part='vaadin-login-native-form'] * {
58
+ vaadin-login-form-wrapper > form > * {
57
59
  width: 100%;
58
60
  }
59
61
  </style>
60
- <vaadin-login-form-wrapper
61
- theme$="[[_theme]]"
62
- part="vaadin-login-native-form-wrapper"
63
- action="{{action}}"
64
- disabled="{{disabled}}"
65
- error="{{error}}"
66
- no-forgot-password="{{noForgotPassword}}"
67
- i18n="{{i18n}}"
68
- on-login="_retargetEvent"
69
- on-forgot-password="_retargetEvent"
70
- >
71
- <form part="vaadin-login-native-form" method="POST" action$="[[action]]" slot="form">
62
+ <vaadin-login-form-wrapper theme$="[[_theme]]" error="[[error]]" i18n="[[i18n]]">
63
+ <form method="POST" action$="[[action]]" slot="form">
72
64
  <input id="csrf" type="hidden" />
73
65
  <vaadin-text-field
74
66
  name="username"
@@ -95,10 +87,19 @@ class LoginForm extends LoginMixin(ElementMixin(ThemableMixin(PolymerElement)))
95
87
  <input type="password" slot="input" on-keyup="_handleInputKeyup" />
96
88
  </vaadin-password-field>
97
89
 
98
- <vaadin-button part="vaadin-login-submit" theme="primary contained" on-click="submit" disabled$="[[disabled]]"
99
- >[[i18n.form.submit]]</vaadin-button
100
- >
90
+ <vaadin-button theme="primary contained submit" on-click="submit" disabled$="[[disabled]]">
91
+ [[i18n.form.submit]]
92
+ </vaadin-button>
101
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>
102
103
  </vaadin-login-form-wrapper>
103
104
  `;
104
105
  }
@@ -110,7 +111,7 @@ class LoginForm extends LoginMixin(ElementMixin(ThemableMixin(PolymerElement)))
110
111
  /** @protected */
111
112
  connectedCallback() {
112
113
  super.connectedCallback();
113
- this._handleInputKeydown = this._handleInputKeydown.bind(this);
114
+
114
115
  if (!this.noAutofocus) {
115
116
  this.$.vaadinLoginUsername.focus();
116
117
  }
@@ -137,7 +138,10 @@ class LoginForm extends LoginMixin(ElementMixin(ThemableMixin(PolymerElement)))
137
138
  }
138
139
 
139
140
  submit() {
140
- if (this.disabled || !(this.__isValid(this.$.vaadinLoginUsername) && this.__isValid(this.$.vaadinLoginPassword))) {
141
+ const userName = this.$.vaadinLoginUsername;
142
+ const password = this.$.vaadinLoginPassword;
143
+
144
+ if (this.disabled || !(userName.validate() && password.validate())) {
141
145
  return;
142
146
  }
143
147
 
@@ -148,8 +152,8 @@ class LoginForm extends LoginMixin(ElementMixin(ThemableMixin(PolymerElement)))
148
152
  bubbles: true,
149
153
  cancelable: true,
150
154
  detail: {
151
- username: this.$.vaadinLoginUsername.value,
152
- password: this.$.vaadinLoginPassword.value,
155
+ username: userName.value,
156
+ password: password.value,
153
157
  },
154
158
  };
155
159
 
@@ -161,28 +165,18 @@ class LoginForm extends LoginMixin(ElementMixin(ThemableMixin(PolymerElement)))
161
165
  this.$.csrf.name = csrfMetaName.content;
162
166
  this.$.csrf.value = csrfMetaValue.content;
163
167
  }
164
- this.querySelector('[part="vaadin-login-native-form"]').submit();
168
+ this.querySelector('form').submit();
165
169
  }
166
170
  }
167
171
 
168
- /** @private */
169
- __isValid(input) {
170
- return (input.validate && input.validate()) || (input.checkValidity && input.checkValidity());
171
- }
172
-
173
- /** @private */
174
- _isEnterKey(e) {
175
- return e.key === 'Enter' || e.keyCode === 13;
176
- }
177
-
178
172
  /** @private */
179
173
  _handleInputKeydown(e) {
180
- if (this._isEnterKey(e)) {
174
+ if (e.key === 'Enter') {
181
175
  const { currentTarget: inputActive } = e;
182
176
  const nextInput =
183
177
  inputActive.id === 'vaadinLoginUsername' ? this.$.vaadinLoginPassword : this.$.vaadinLoginUsername;
184
- if (this.__isValid(inputActive)) {
185
- if (this.__isValid(nextInput)) {
178
+ if (inputActive.validate()) {
179
+ if (nextInput.validate()) {
186
180
  this.submit();
187
181
  } else {
188
182
  nextInput.focus();
@@ -193,14 +187,16 @@ class LoginForm extends LoginMixin(ElementMixin(ThemableMixin(PolymerElement)))
193
187
 
194
188
  /** @private */
195
189
  _handleInputKeyup(e) {
196
- const isTab = e.key === 'Tab' || e.keyCode === 9;
197
190
  const input = e.currentTarget;
198
- if (isTab && input && input.select) {
191
+ if (e.key === 'Tab' && input instanceof HTMLInputElement) {
199
192
  input.select();
200
- // IOS 9 workaround: https://stackoverflow.com/a/7436574
201
- setTimeout(() => input.setSelectionRange(0, 9999));
202
193
  }
203
194
  }
195
+
196
+ /** @private */
197
+ _onForgotPasswordClick() {
198
+ this.dispatchEvent(new CustomEvent('forgot-password'));
199
+ }
204
200
  }
205
201
 
206
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
  }
@@ -32,7 +32,6 @@ export const LoginMixin = (superClass) =>
32
32
  action: {
33
33
  type: String,
34
34
  value: null,
35
- notify: true,
36
35
  },
37
36
 
38
37
  /**
@@ -67,7 +66,6 @@ export const LoginMixin = (superClass) =>
67
66
  noForgotPassword: {
68
67
  type: Boolean,
69
68
  value: false,
70
- notify: true,
71
69
  },
72
70
 
73
71
  /**
@@ -130,7 +128,6 @@ export const LoginMixin = (superClass) =>
130
128
  },
131
129
  };
132
130
  },
133
- notify: true,
134
131
  },
135
132
 
136
133
  /**
@@ -143,19 +140,4 @@ export const LoginMixin = (superClass) =>
143
140
  },
144
141
  };
145
142
  }
146
-
147
- /**
148
- * @param {!Event} e
149
- * @protected
150
- */
151
- _retargetEvent(e) {
152
- e.stopPropagation();
153
- const { detail, composed, cancelable, bubbles } = e;
154
-
155
- const firedEvent = this.dispatchEvent(new CustomEvent(e.type, { bubbles, cancelable, composed, detail }));
156
- // Check if `eventTarget.preventDefault()` was called to prevent default in the original event
157
- if (!firedEvent) {
158
- e.preventDefault();
159
- }
160
- }
161
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;
@@ -8,12 +8,33 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
8
8
  import { LoginMixin } from './vaadin-login-mixin.js';
9
9
  export { LoginI18n } from './vaadin-login-mixin.js';
10
10
 
11
+ /**
12
+ * Fired when the `description` property changes.
13
+ */
14
+ export type LoginOverlayDescriptionChangedEvent = CustomEvent<{ value: string }>;
15
+
16
+ /**
17
+ * Fired when the `disabled` property changes.
18
+ */
19
+ export type LoginOverlayDisabledChangedEvent = CustomEvent<{ value: boolean }>;
20
+
21
+ /**
22
+ * Fired when the `error` property changes.
23
+ */
24
+ export type LoginOverlayErrorChangedEvent = CustomEvent<{ value: boolean }>;
25
+
11
26
  /**
12
27
  * Fired when a user submits the login.
13
28
  */
14
29
  export type LoginOverlayLoginEvent = CustomEvent<{ username: string; password: string }>;
15
30
 
16
31
  export interface LoginOverlayCustomEventMap {
32
+ 'description-changed': LoginOverlayDescriptionChangedEvent;
33
+
34
+ 'disabled-changed': LoginOverlayDisabledChangedEvent;
35
+
36
+ 'error-changed': LoginOverlayErrorChangedEvent;
37
+
17
38
  'forgot-password': Event;
18
39
 
19
40
  login: LoginOverlayLoginEvent;
@@ -48,6 +69,9 @@ export interface LoginOverlayEventMap extends HTMLElementEventMap, LoginOverlayC
48
69
  * See [`<vaadin-login-form>`](#/elements/vaadin-login-form)
49
70
  * documentation for `<vaadin-login-form-wrapper>` stylable parts.
50
71
  *
72
+ * @fires {CustomEvent} description-changed - Fired when the `description` property changes.
73
+ * @fires {CustomEvent} disabled-changed - Fired when the `disabled` property changes.
74
+ * @fires {CustomEvent} error-changed - Fired when the `error` property changes.
51
75
  * @fires {CustomEvent} forgot-password - Fired when user clicks on the "Forgot password" button.
52
76
  * @fires {CustomEvent} login - Fired when a user submits the login.
53
77
  */
@@ -37,6 +37,9 @@ import { LoginMixin } from './vaadin-login-mixin.js';
37
37
  * See [`<vaadin-login-form>`](#/elements/vaadin-login-form)
38
38
  * documentation for `<vaadin-login-form-wrapper>` stylable parts.
39
39
  *
40
+ * @fires {CustomEvent} description-changed - Fired when the `description` property changes.
41
+ * @fires {CustomEvent} disabled-changed - Fired when the `disabled` property changes.
42
+ * @fires {CustomEvent} error-changed - Fired when the `error` property changes.
40
43
  * @fires {CustomEvent} forgot-password - Fired when user clicks on the "Forgot password" button.
41
44
  * @fires {CustomEvent} login - Fired when a user submits the login.
42
45
  *
@@ -60,11 +63,11 @@ class LoginOverlay extends LoginMixin(ElementMixin(ThemableMixin(PolymerElement)
60
63
  <vaadin-login-form
61
64
  theme="with-overlay"
62
65
  id="vaadinLoginForm"
63
- action="{{action}}"
66
+ action="[[action]]"
64
67
  disabled="{{disabled}}"
65
68
  error="{{error}}"
66
69
  no-autofocus="[[noAutofocus]]"
67
- no-forgot-password="{{noForgotPassword}}"
70
+ no-forgot-password="[[noForgotPassword]]"
68
71
  i18n="{{i18n}}"
69
72
  on-login="_retargetEvent"
70
73
  on-forgot-password="_retargetEvent"
@@ -161,6 +164,21 @@ class LoginOverlay extends LoginMixin(ElementMixin(ThemableMixin(PolymerElement)
161
164
  e.preventDefault();
162
165
  }
163
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
+
164
182
  /** @private */
165
183
  _onOpenedChange() {
166
184
  if (!this.opened) {
@@ -4,7 +4,7 @@ import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themab
4
4
  registerStyles(
5
5
  'vaadin-login-form',
6
6
  css`
7
- vaadin-button[part='vaadin-login-submit'] {
7
+ form > vaadin-button[theme~='submit'] {
8
8
  margin-top: var(--lumo-space-l);
9
9
  margin-bottom: var(--lumo-space-s);
10
10
  }
@@ -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';
@@ -3,7 +3,7 @@ import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themab
3
3
  registerStyles(
4
4
  'vaadin-login-form',
5
5
  css`
6
- vaadin-button[part='vaadin-login-submit'] {
6
+ form > vaadin-button[theme~='submit'] {
7
7
  margin-top: 3em;
8
8
  margin-bottom: 2em;
9
9
  flex-grow: 0;
@@ -11,7 +11,7 @@ registerStyles(
11
11
 
12
12
  /* Small screen */
13
13
  @media only screen and (max-width: 1023px) {
14
- vaadin-button[part='vaadin-login-submit'] {
14
+ form > vaadin-button[theme~='submit'] {
15
15
  margin-top: 2.5em;
16
16
  margin-bottom: 1em;
17
17
  }
@@ -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,14 +1,14 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/login",
4
- "version": "24.0.0-alpha1",
4
+ "version": "24.0.0-alpha3",
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`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/custom-theme/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```\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/custom-theme/styling-components) documentation.",
12
12
  "attributes": [
13
13
  {
14
14
  "name": "action",
@@ -135,10 +135,6 @@
135
135
  "name": "login",
136
136
  "description": "Fired when an user submits the login.\nThe event contains `username` and `password` values in the `detail` property."
137
137
  },
138
- {
139
- "name": "action-changed",
140
- "description": "Fired when the `action` property changes."
141
- },
142
138
  {
143
139
  "name": "disabled-changed",
144
140
  "description": "Fired when the `disabled` property changes."
@@ -146,21 +142,13 @@
146
142
  {
147
143
  "name": "error-changed",
148
144
  "description": "Fired when the `error` property changes."
149
- },
150
- {
151
- "name": "no-forgot-password-changed",
152
- "description": "Fired when the `noForgotPassword` property changes."
153
- },
154
- {
155
- "name": "i18n-changed",
156
- "description": "Fired when the `i18n` property changes."
157
145
  }
158
146
  ]
159
147
  }
160
148
  },
161
149
  {
162
150
  "name": "vaadin-login-overlay",
163
- "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-alpha1/#/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-alpha3/#/elements/vaadin-login-form)\ndocumentation for `<vaadin-login-form-wrapper>` stylable parts.",
164
152
  "attributes": [
165
153
  {
166
154
  "name": "action",
@@ -345,10 +333,6 @@
345
333
  "name": "description-changed",
346
334
  "description": "Fired when the `description` property changes."
347
335
  },
348
- {
349
- "name": "action-changed",
350
- "description": "Fired when the `action` property changes."
351
- },
352
336
  {
353
337
  "name": "disabled-changed",
354
338
  "description": "Fired when the `disabled` property changes."
@@ -356,14 +340,6 @@
356
340
  {
357
341
  "name": "error-changed",
358
342
  "description": "Fired when the `error` property changes."
359
- },
360
- {
361
- "name": "no-forgot-password-changed",
362
- "description": "Fired when the `noForgotPassword` property changes."
363
- },
364
- {
365
- "name": "i18n-changed",
366
- "description": "Fired when the `i18n` property changes."
367
343
  }
368
344
  ]
369
345
  }
@@ -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-alpha1",
4
+ "version": "24.0.0-alpha3",
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`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/custom-theme/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```\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/custom-theme/styling-components) documentation.",
20
20
  "extension": true,
21
21
  "attributes": [
22
22
  {
@@ -75,13 +75,6 @@
75
75
  "kind": "expression"
76
76
  }
77
77
  },
78
- {
79
- "name": "@action-changed",
80
- "description": "Fired when the `action` property changes.",
81
- "value": {
82
- "kind": "expression"
83
- }
84
- },
85
78
  {
86
79
  "name": "@disabled-changed",
87
80
  "description": "Fired when the `disabled` property changes.",
@@ -95,26 +88,12 @@
95
88
  "value": {
96
89
  "kind": "expression"
97
90
  }
98
- },
99
- {
100
- "name": "@no-forgot-password-changed",
101
- "description": "Fired when the `noForgotPassword` property changes.",
102
- "value": {
103
- "kind": "expression"
104
- }
105
- },
106
- {
107
- "name": "@i18n-changed",
108
- "description": "Fired when the `i18n` property changes.",
109
- "value": {
110
- "kind": "expression"
111
- }
112
91
  }
113
92
  ]
114
93
  },
115
94
  {
116
95
  "name": "vaadin-login-overlay",
117
- "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-alpha1/#/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-alpha3/#/elements/vaadin-login-form)\ndocumentation for `<vaadin-login-form-wrapper>` stylable parts.",
118
97
  "extension": true,
119
98
  "attributes": [
120
99
  {
@@ -201,13 +180,6 @@
201
180
  "kind": "expression"
202
181
  }
203
182
  },
204
- {
205
- "name": "@action-changed",
206
- "description": "Fired when the `action` property changes.",
207
- "value": {
208
- "kind": "expression"
209
- }
210
- },
211
183
  {
212
184
  "name": "@disabled-changed",
213
185
  "description": "Fired when the `disabled` property changes.",
@@ -221,20 +193,6 @@
221
193
  "value": {
222
194
  "kind": "expression"
223
195
  }
224
- },
225
- {
226
- "name": "@no-forgot-password-changed",
227
- "description": "Fired when the `noForgotPassword` property changes.",
228
- "value": {
229
- "kind": "expression"
230
- }
231
- },
232
- {
233
- "name": "@i18n-changed",
234
- "description": "Fired when the `i18n` property changes.",
235
- "value": {
236
- "kind": "expression"
237
- }
238
196
  }
239
197
  ]
240
198
  }
@@ -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';