@vaadin/login 23.2.7 → 23.2.9

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": "23.2.7",
3
+ "version": "23.2.9",
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": "~23.2.7",
41
- "@vaadin/component-base": "~23.2.7",
42
- "@vaadin/password-field": "~23.2.7",
43
- "@vaadin/text-field": "~23.2.7",
44
- "@vaadin/vaadin-lumo-styles": "~23.2.7",
45
- "@vaadin/vaadin-material-styles": "~23.2.7",
46
- "@vaadin/vaadin-overlay": "~23.2.7",
47
- "@vaadin/vaadin-themable-mixin": "~23.2.7"
40
+ "@vaadin/button": "~23.2.9",
41
+ "@vaadin/component-base": "~23.2.9",
42
+ "@vaadin/password-field": "~23.2.9",
43
+ "@vaadin/text-field": "~23.2.9",
44
+ "@vaadin/vaadin-lumo-styles": "~23.2.9",
45
+ "@vaadin/vaadin-material-styles": "~23.2.9",
46
+ "@vaadin/vaadin-overlay": "~23.2.9",
47
+ "@vaadin/vaadin-themable-mixin": "~23.2.9"
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": "bdaf12e4200bd68a3a9224bdf4cb41954f1b8bf1"
58
+ "gitHead": "880679b5eca131e7fbd4f651726bea5abc270493"
59
59
  }
@@ -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
  */
@@ -36,11 +36,12 @@ import { LoginMixin } from './vaadin-login-mixin.js';
36
36
  * `error-message`| Container for error message, contains error-message-title and error-message-description parts. Hidden by default.
37
37
  * `error-message-title` | Container for error message title
38
38
  * `error-message-description` | Container for error message description
39
- * `error-message-description` | Container for error message description
40
39
  * `footer` | Container additional information text from `i18n` object
41
40
  *
42
41
  * See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
43
42
  *
43
+ * @fires {CustomEvent} disabled-changed - Fired when the `disabled` property changes.
44
+ * @fires {CustomEvent} error-changed - Fired when the `error` property changes.
44
45
  * @fires {CustomEvent} forgot-password - Fired when user clicks on the "Forgot password" button.
45
46
  * @fires {CustomEvent} login - Fired when a user submits the login.
46
47
  *
@@ -60,11 +61,9 @@ class LoginForm extends LoginMixin(ElementMixin(ThemableMixin(PolymerElement)))
60
61
  <vaadin-login-form-wrapper
61
62
  theme$="[[_theme]]"
62
63
  part="vaadin-login-native-form-wrapper"
63
- action="{{action}}"
64
- disabled="{{disabled}}"
65
- error="{{error}}"
66
- no-forgot-password="{{noForgotPassword}}"
67
- i18n="{{i18n}}"
64
+ error="[[error]]"
65
+ no-forgot-password="[[noForgotPassword]]"
66
+ i18n="[[i18n]]"
68
67
  on-login="_retargetEvent"
69
68
  on-forgot-password="_retargetEvent"
70
69
  >
@@ -79,6 +78,7 @@ class LoginForm extends LoginMixin(ElementMixin(ThemableMixin(PolymerElement)))
79
78
  autocapitalize="none"
80
79
  autocorrect="off"
81
80
  spellcheck="false"
81
+ autocomplete="username"
82
82
  >
83
83
  <input type="text" slot="input" on-keyup="_handleInputKeyup" />
84
84
  </vaadin-text-field>
@@ -110,7 +110,7 @@ class LoginForm extends LoginMixin(ElementMixin(ThemableMixin(PolymerElement)))
110
110
  /** @protected */
111
111
  connectedCallback() {
112
112
  super.connectedCallback();
113
- this._handleInputKeydown = this._handleInputKeydown.bind(this);
113
+
114
114
  if (!this.noAutofocus) {
115
115
  this.$.vaadinLoginUsername.focus();
116
116
  }
@@ -137,7 +137,10 @@ class LoginForm extends LoginMixin(ElementMixin(ThemableMixin(PolymerElement)))
137
137
  }
138
138
 
139
139
  submit() {
140
- if (this.disabled || !(this.__isValid(this.$.vaadinLoginUsername) && this.__isValid(this.$.vaadinLoginPassword))) {
140
+ const userName = this.$.vaadinLoginUsername;
141
+ const password = this.$.vaadinLoginPassword;
142
+
143
+ if (this.disabled || !(userName.validate() && password.validate())) {
141
144
  return;
142
145
  }
143
146
 
@@ -148,8 +151,8 @@ class LoginForm extends LoginMixin(ElementMixin(ThemableMixin(PolymerElement)))
148
151
  bubbles: true,
149
152
  cancelable: true,
150
153
  detail: {
151
- username: this.$.vaadinLoginUsername.value,
152
- password: this.$.vaadinLoginPassword.value,
154
+ username: userName.value,
155
+ password: password.value,
153
156
  },
154
157
  };
155
158
 
@@ -165,24 +168,14 @@ class LoginForm extends LoginMixin(ElementMixin(ThemableMixin(PolymerElement)))
165
168
  }
166
169
  }
167
170
 
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
171
  /** @private */
179
172
  _handleInputKeydown(e) {
180
- if (this._isEnterKey(e)) {
173
+ if (e.key === 'Enter') {
181
174
  const { currentTarget: inputActive } = e;
182
175
  const nextInput =
183
176
  inputActive.id === 'vaadinLoginUsername' ? this.$.vaadinLoginPassword : this.$.vaadinLoginUsername;
184
- if (this.__isValid(inputActive)) {
185
- if (this.__isValid(nextInput)) {
177
+ if (inputActive.validate()) {
178
+ if (nextInput.validate()) {
186
179
  this.submit();
187
180
  } else {
188
181
  nextInput.focus();
@@ -193,12 +186,9 @@ class LoginForm extends LoginMixin(ElementMixin(ThemableMixin(PolymerElement)))
193
186
 
194
187
  /** @private */
195
188
  _handleInputKeyup(e) {
196
- const isTab = e.key === 'Tab' || e.keyCode === 9;
197
189
  const input = e.currentTarget;
198
- if (isTab && input && input.select) {
190
+ if (e.key === 'Tab' && input instanceof HTMLInputElement) {
199
191
  input.select();
200
- // IOS 9 workaround: https://stackoverflow.com/a/7436574
201
- setTimeout(() => input.setSelectionRange(0, 9999));
202
192
  }
203
193
  }
204
194
  }
@@ -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
  *
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": "23.2.7",
4
+ "version": "23.2.9",
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",
@@ -160,7 +160,7 @@
160
160
  },
161
161
  {
162
162
  "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/23.2.7/#/elements/vaadin-login-form)\ndocumentation for `<vaadin-login-form-wrapper>` stylable parts.",
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/23.2.9/#/elements/vaadin-login-form)\ndocumentation for `<vaadin-login-form-wrapper>` stylable parts.",
164
164
  "attributes": [
165
165
  {
166
166
  "name": "action",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/login",
4
- "version": "23.2.7",
4
+ "version": "23.2.9",
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
  {
@@ -114,7 +114,7 @@
114
114
  },
115
115
  {
116
116
  "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/23.2.7/#/elements/vaadin-login-form)\ndocumentation for `<vaadin-login-form-wrapper>` stylable parts.",
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/23.2.9/#/elements/vaadin-login-form)\ndocumentation for `<vaadin-login-form-wrapper>` stylable parts.",
118
118
  "extension": true,
119
119
  "attributes": [
120
120
  {