@vaadin/time-picker 24.2.0-alpha4 → 24.2.0-alpha5

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/time-picker",
3
- "version": "24.2.0-alpha4",
3
+ "version": "24.2.0-alpha5",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -36,24 +36,24 @@
36
36
  ],
37
37
  "dependencies": {
38
38
  "@polymer/polymer": "^3.0.0",
39
- "@vaadin/combo-box": "24.2.0-alpha4",
40
- "@vaadin/component-base": "24.2.0-alpha4",
41
- "@vaadin/field-base": "24.2.0-alpha4",
42
- "@vaadin/input-container": "24.2.0-alpha4",
43
- "@vaadin/item": "24.2.0-alpha4",
44
- "@vaadin/overlay": "24.2.0-alpha4",
45
- "@vaadin/vaadin-lumo-styles": "24.2.0-alpha4",
46
- "@vaadin/vaadin-material-styles": "24.2.0-alpha4",
47
- "@vaadin/vaadin-themable-mixin": "24.2.0-alpha4"
39
+ "@vaadin/combo-box": "24.2.0-alpha5",
40
+ "@vaadin/component-base": "24.2.0-alpha5",
41
+ "@vaadin/field-base": "24.2.0-alpha5",
42
+ "@vaadin/input-container": "24.2.0-alpha5",
43
+ "@vaadin/item": "24.2.0-alpha5",
44
+ "@vaadin/overlay": "24.2.0-alpha5",
45
+ "@vaadin/vaadin-lumo-styles": "24.2.0-alpha5",
46
+ "@vaadin/vaadin-material-styles": "24.2.0-alpha5",
47
+ "@vaadin/vaadin-themable-mixin": "24.2.0-alpha5"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@esm-bundle/chai": "^4.3.4",
51
- "@vaadin/testing-helpers": "^0.4.2",
51
+ "@vaadin/testing-helpers": "^0.4.3",
52
52
  "sinon": "^13.0.2"
53
53
  },
54
54
  "web-types": [
55
55
  "web-types.json",
56
56
  "web-types.lit.json"
57
57
  ],
58
- "gitHead": "aaf7c5ebfea62628210eead4229be1718ac6b129"
58
+ "gitHead": "73db22a5e8993e3ce48d1e6540d30eff9cb5c257"
59
59
  }
@@ -4,12 +4,14 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { ComboBoxOverlayMixin } from '@vaadin/combo-box/src/vaadin-combo-box-overlay-mixin.js';
7
- import { Overlay } from '@vaadin/overlay/src/vaadin-overlay.js';
7
+ import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
8
+ import { OverlayMixin } from '@vaadin/overlay/src/vaadin-overlay-mixin.js';
9
+ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
8
10
 
9
11
  /**
10
12
  * An element used internally by `<vaadin-time-picker>`. Not intended to be used separately.
11
13
  */
12
- declare class TimePickerOverlay extends ComboBoxOverlayMixin(Overlay) {}
14
+ declare class TimePickerOverlay extends ComboBoxOverlayMixin(OverlayMixin(DirMixin(ThemableMixin(HTMLElement)))) {}
13
15
 
14
16
  declare global {
15
17
  interface HTMLElementTagNameMap {
@@ -3,46 +3,53 @@
3
3
  * Copyright (c) 2018 - 2023 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
7
  import { ComboBoxOverlayMixin } from '@vaadin/combo-box/src/vaadin-combo-box-overlay-mixin.js';
7
- import { Overlay } from '@vaadin/overlay/src/vaadin-overlay.js';
8
- import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
8
+ import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
9
+ import { OverlayMixin } from '@vaadin/overlay/src/vaadin-overlay-mixin.js';
10
+ import { overlayStyles } from '@vaadin/overlay/src/vaadin-overlay-styles.js';
11
+ import { css, registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
9
12
 
10
- registerStyles(
11
- 'vaadin-time-picker-overlay',
12
- css`
13
- #overlay {
14
- width: var(--vaadin-time-picker-overlay-width, var(--_vaadin-time-picker-overlay-default-width, auto));
15
- }
13
+ const timePickerOverlayStyles = css`
14
+ #overlay {
15
+ width: var(--vaadin-time-picker-overlay-width, var(--_vaadin-time-picker-overlay-default-width, auto));
16
+ }
16
17
 
17
- [part='content'] {
18
- display: flex;
19
- flex-direction: column;
20
- height: 100%;
21
- }
22
- `,
23
- { moduleId: 'vaadin-time-picker-overlay-styles' },
24
- );
18
+ [part='content'] {
19
+ display: flex;
20
+ flex-direction: column;
21
+ height: 100%;
22
+ }
23
+ `;
25
24
 
26
- let memoizedTemplate;
25
+ registerStyles('vaadin-time-picker-overlay', [overlayStyles, timePickerOverlayStyles], {
26
+ moduleId: 'vaadin-time-picker-overlay-styles',
27
+ });
27
28
 
28
29
  /**
29
30
  * An element used internally by `<vaadin-time-picker>`. Not intended to be used separately.
30
31
  *
31
- * @extends ComboBoxOverlay
32
+ * @extends HTMLElement
33
+ * @mixes ComboBoxOverlayMixin
34
+ * @mixes DirMixin
35
+ * @mixes OverlayMixin
36
+ * @mixes ThemableMixin
32
37
  * @private
33
38
  */
34
- class TimePickerOverlay extends ComboBoxOverlayMixin(Overlay) {
39
+ export class TimePickerOverlay extends ComboBoxOverlayMixin(OverlayMixin(DirMixin(ThemableMixin(PolymerElement)))) {
35
40
  static get is() {
36
41
  return 'vaadin-time-picker-overlay';
37
42
  }
38
43
 
39
44
  static get template() {
40
- if (!memoizedTemplate) {
41
- memoizedTemplate = super.template.cloneNode(true);
42
- memoizedTemplate.content.querySelector('[part~="overlay"]').removeAttribute('tabindex');
43
- }
44
-
45
- return memoizedTemplate;
45
+ return html`
46
+ <div id="backdrop" part="backdrop" hidden></div>
47
+ <div part="overlay" id="overlay">
48
+ <div part="content" id="content">
49
+ <slot></slot>
50
+ </div>
51
+ </div>
52
+ `;
46
53
  }
47
54
  }
48
55
 
@@ -125,6 +125,7 @@ class TimePicker extends PatternMixin(InputControlMixin(ThemableMixin(ElementMix
125
125
  position-target="[[_inputContainer]]"
126
126
  theme$="[[_theme]]"
127
127
  on-change="__onComboBoxChange"
128
+ on-validated="__onComboBoxValidated"
128
129
  on-has-input-value-changed="__onComboBoxHasInputValueChanged"
129
130
  >
130
131
  <vaadin-input-container
@@ -417,19 +418,6 @@ class TimePicker extends PatternMixin(InputControlMixin(ThemableMixin(ElementMix
417
418
  );
418
419
  }
419
420
 
420
- /**
421
- * Override method inherited from `FocusMixin` to validate on blur.
422
- * @param {boolean} focused
423
- * @protected
424
- */
425
- _setFocused(focused) {
426
- super._setFocused(focused);
427
-
428
- if (!focused) {
429
- this.validate();
430
- }
431
- }
432
-
433
421
  /** @private */
434
422
  __validDayDivisor(step) {
435
423
  // Valid if undefined, or exact divides a day, or has millisecond resolution
@@ -640,9 +628,6 @@ class TimePicker extends PatternMixin(InputControlMixin(ThemableMixin(ElementMix
640
628
  /** @private */
641
629
  __onComboBoxChange(event) {
642
630
  event.stopPropagation();
643
-
644
- this.validate();
645
-
646
631
  this.__dispatchChange();
647
632
  }
648
633
 
@@ -655,6 +640,11 @@ class TimePicker extends PatternMixin(InputControlMixin(ThemableMixin(ElementMix
655
640
  this._hasInputValue = this.$.comboBox._hasInputValue;
656
641
  }
657
642
 
643
+ /** @private */
644
+ __onComboBoxValidated() {
645
+ this.validate();
646
+ }
647
+
658
648
  /** @private */
659
649
  __updateValue(obj) {
660
650
  const timeString = this.__formatISO(this.__validateTime(obj)) || '';
@@ -4,6 +4,5 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import '@vaadin/input-container/theme/lumo/vaadin-input-container.js';
7
- import '@vaadin/overlay/theme/lumo/vaadin-overlay.js';
8
7
  import './vaadin-time-picker-styles.js';
9
8
  import '../../src/vaadin-time-picker.js';
@@ -4,6 +4,5 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import '@vaadin/input-container/theme/material/vaadin-input-container.js';
7
- import '@vaadin/overlay/theme/material/vaadin-overlay.js';
8
7
  import './vaadin-time-picker-styles.js';
9
8
  import '../../src/vaadin-time-picker.js';
package/web-types.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/time-picker",
4
- "version": "24.2.0-alpha4",
4
+ "version": "24.2.0-alpha5",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "elements": [
9
9
  {
10
10
  "name": "vaadin-time-picker",
11
- "description": "`<vaadin-time-picker>` is a Web Component providing a time-selection field.\n\n```html\n<vaadin-time-picker></vaadin-time-picker>\n```\n```js\ntimePicker.value = '14:30';\n```\n\nWhen the selected `value` is changed, a `value-changed` event is triggered.\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Default\n----------------------------------------|----------------------------|---------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n`--vaadin-combo-box-overlay-max-height` | Max height of the overlay | `65vh`\n\n`<vaadin-time-picker>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha4/#/elements/vaadin-text-field) for the styling documentation.\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n----------------|----------------\n`toggle-button` | The toggle button\n\nIn addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:\n\nAttribute | Description\n----------|------------------------------------------\n`opened` | Set when the time-picker dropdown is open\n\n### Internal components\n\nIn addition to `<vaadin-time-picker>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-time-picker-combo-box>` - has the same API as [`<vaadin-combo-box-light>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha4/#/elements/vaadin-combo-box-light).\n- `<vaadin-time-picker-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha4/#/elements/vaadin-overlay).\n- `<vaadin-time-picker-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha4/#/elements/vaadin-item).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha4/#/elements/vaadin-input-container) - an internal element wrapping the input.\n\nNote: the `theme` attribute value set on `<vaadin-time-picker>` is\npropagated to the internal components listed above.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
11
+ "description": "`<vaadin-time-picker>` is a Web Component providing a time-selection field.\n\n```html\n<vaadin-time-picker></vaadin-time-picker>\n```\n```js\ntimePicker.value = '14:30';\n```\n\nWhen the selected `value` is changed, a `value-changed` event is triggered.\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Default\n----------------------------------------|----------------------------|---------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n`--vaadin-combo-box-overlay-max-height` | Max height of the overlay | `65vh`\n\n`<vaadin-time-picker>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha5/#/elements/vaadin-text-field) for the styling documentation.\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n----------------|----------------\n`toggle-button` | The toggle button\n\nIn addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:\n\nAttribute | Description\n----------|------------------------------------------\n`opened` | Set when the time-picker dropdown is open\n\n### Internal components\n\nIn addition to `<vaadin-time-picker>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-time-picker-combo-box>` - has the same API as [`<vaadin-combo-box-light>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha5/#/elements/vaadin-combo-box-light).\n- `<vaadin-time-picker-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha5/#/elements/vaadin-overlay).\n- `<vaadin-time-picker-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha5/#/elements/vaadin-item).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha5/#/elements/vaadin-input-container) - an internal element wrapping the input.\n\nNote: the `theme` attribute value set on `<vaadin-time-picker>` is\npropagated to the internal components listed above.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
12
12
  "attributes": [
13
13
  {
14
14
  "name": "disabled",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/time-picker",
4
- "version": "24.2.0-alpha4",
4
+ "version": "24.2.0-alpha5",
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-time-picker",
19
- "description": "`<vaadin-time-picker>` is a Web Component providing a time-selection field.\n\n```html\n<vaadin-time-picker></vaadin-time-picker>\n```\n```js\ntimePicker.value = '14:30';\n```\n\nWhen the selected `value` is changed, a `value-changed` event is triggered.\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Default\n----------------------------------------|----------------------------|---------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n`--vaadin-combo-box-overlay-max-height` | Max height of the overlay | `65vh`\n\n`<vaadin-time-picker>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha4/#/elements/vaadin-text-field) for the styling documentation.\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n----------------|----------------\n`toggle-button` | The toggle button\n\nIn addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:\n\nAttribute | Description\n----------|------------------------------------------\n`opened` | Set when the time-picker dropdown is open\n\n### Internal components\n\nIn addition to `<vaadin-time-picker>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-time-picker-combo-box>` - has the same API as [`<vaadin-combo-box-light>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha4/#/elements/vaadin-combo-box-light).\n- `<vaadin-time-picker-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha4/#/elements/vaadin-overlay).\n- `<vaadin-time-picker-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha4/#/elements/vaadin-item).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha4/#/elements/vaadin-input-container) - an internal element wrapping the input.\n\nNote: the `theme` attribute value set on `<vaadin-time-picker>` is\npropagated to the internal components listed above.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
19
+ "description": "`<vaadin-time-picker>` is a Web Component providing a time-selection field.\n\n```html\n<vaadin-time-picker></vaadin-time-picker>\n```\n```js\ntimePicker.value = '14:30';\n```\n\nWhen the selected `value` is changed, a `value-changed` event is triggered.\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Default\n----------------------------------------|----------------------------|---------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n`--vaadin-combo-box-overlay-max-height` | Max height of the overlay | `65vh`\n\n`<vaadin-time-picker>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha5/#/elements/vaadin-text-field) for the styling documentation.\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n----------------|----------------\n`toggle-button` | The toggle button\n\nIn addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:\n\nAttribute | Description\n----------|------------------------------------------\n`opened` | Set when the time-picker dropdown is open\n\n### Internal components\n\nIn addition to `<vaadin-time-picker>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-time-picker-combo-box>` - has the same API as [`<vaadin-combo-box-light>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha5/#/elements/vaadin-combo-box-light).\n- `<vaadin-time-picker-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha5/#/elements/vaadin-overlay).\n- `<vaadin-time-picker-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha5/#/elements/vaadin-item).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.2.0-alpha5/#/elements/vaadin-input-container) - an internal element wrapping the input.\n\nNote: the `theme` attribute value set on `<vaadin-time-picker>` is\npropagated to the internal components listed above.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
20
20
  "extension": true,
21
21
  "attributes": [
22
22
  {