@vaadin/time-picker 24.5.0-alpha1 → 24.5.0-alpha11
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/README.md +1 -1
- package/package.json +14 -14
- package/src/vaadin-time-picker.js +35 -10
- package/web-types.json +2 -2
- package/web-types.lit.json +2 -2
package/README.md
CHANGED
|
@@ -51,7 +51,7 @@ import '@vaadin/time-picker/src/vaadin-time-picker.js';
|
|
|
51
51
|
|
|
52
52
|
## Contributing
|
|
53
53
|
|
|
54
|
-
Read the [contributing guide](https://vaadin.com/docs/latest/contributing
|
|
54
|
+
Read the [contributing guide](https://vaadin.com/docs/latest/contributing) to learn about our development process, how to propose bugfixes and improvements, and how to test your changes to Vaadin components.
|
|
55
55
|
|
|
56
56
|
## License
|
|
57
57
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/time-picker",
|
|
3
|
-
"version": "24.5.0-
|
|
3
|
+
"version": "24.5.0-alpha11",
|
|
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.5.0-
|
|
40
|
-
"@vaadin/component-base": "24.5.0-
|
|
41
|
-
"@vaadin/field-base": "24.5.0-
|
|
42
|
-
"@vaadin/input-container": "24.5.0-
|
|
43
|
-
"@vaadin/item": "24.5.0-
|
|
44
|
-
"@vaadin/overlay": "24.5.0-
|
|
45
|
-
"@vaadin/vaadin-lumo-styles": "24.5.0-
|
|
46
|
-
"@vaadin/vaadin-material-styles": "24.5.0-
|
|
47
|
-
"@vaadin/vaadin-themable-mixin": "24.5.0-
|
|
39
|
+
"@vaadin/combo-box": "24.5.0-alpha11",
|
|
40
|
+
"@vaadin/component-base": "24.5.0-alpha11",
|
|
41
|
+
"@vaadin/field-base": "24.5.0-alpha11",
|
|
42
|
+
"@vaadin/input-container": "24.5.0-alpha11",
|
|
43
|
+
"@vaadin/item": "24.5.0-alpha11",
|
|
44
|
+
"@vaadin/overlay": "24.5.0-alpha11",
|
|
45
|
+
"@vaadin/vaadin-lumo-styles": "24.5.0-alpha11",
|
|
46
|
+
"@vaadin/vaadin-material-styles": "24.5.0-alpha11",
|
|
47
|
+
"@vaadin/vaadin-themable-mixin": "24.5.0-alpha11"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@
|
|
51
|
-
"@vaadin/testing-helpers": "^0.
|
|
52
|
-
"sinon": "^
|
|
50
|
+
"@vaadin/chai-plugins": "24.5.0-alpha11",
|
|
51
|
+
"@vaadin/testing-helpers": "^1.0.0",
|
|
52
|
+
"sinon": "^18.0.0"
|
|
53
53
|
},
|
|
54
54
|
"web-types": [
|
|
55
55
|
"web-types.json",
|
|
56
56
|
"web-types.lit.json"
|
|
57
57
|
],
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "8426cea2803a10db518fc85752eeea4c5c755687"
|
|
59
59
|
}
|
|
@@ -355,7 +355,10 @@ class TimePicker extends PatternMixin(InputControlMixin(ThemableMixin(ElementMix
|
|
|
355
355
|
}
|
|
356
356
|
|
|
357
357
|
static get observers() {
|
|
358
|
-
return [
|
|
358
|
+
return [
|
|
359
|
+
'__updateAriaAttributes(__dropdownItems, opened, inputElement)',
|
|
360
|
+
'__updateDropdownItems(i18n.*, min, max, step)',
|
|
361
|
+
];
|
|
359
362
|
}
|
|
360
363
|
|
|
361
364
|
static get constraints() {
|
|
@@ -390,12 +393,21 @@ class TimePicker extends PatternMixin(InputControlMixin(ThemableMixin(ElementMix
|
|
|
390
393
|
super.ready();
|
|
391
394
|
|
|
392
395
|
this.addController(
|
|
393
|
-
new InputController(
|
|
394
|
-
this
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
396
|
+
new InputController(
|
|
397
|
+
this,
|
|
398
|
+
(input) => {
|
|
399
|
+
this._setInputElement(input);
|
|
400
|
+
this._setFocusElement(input);
|
|
401
|
+
this.stateTarget = input;
|
|
402
|
+
this.ariaTarget = input;
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
// The "search" word is a trick to prevent Safari from enabling AutoFill,
|
|
406
|
+
// which is causing click issues:
|
|
407
|
+
// https://github.com/vaadin/web-components/issues/6817#issuecomment-2268229567
|
|
408
|
+
uniqueIdPrefix: 'search-input',
|
|
409
|
+
},
|
|
410
|
+
),
|
|
399
411
|
);
|
|
400
412
|
this.addController(new LabelledInputController(this.inputElement, this._labelController));
|
|
401
413
|
this._inputContainer = this.shadowRoot.querySelector('[part~="input-field"]');
|
|
@@ -459,8 +471,6 @@ class TimePicker extends PatternMixin(InputControlMixin(ThemableMixin(ElementMix
|
|
|
459
471
|
super._setFocused(focused);
|
|
460
472
|
|
|
461
473
|
if (!focused) {
|
|
462
|
-
this.__commitValueChange();
|
|
463
|
-
|
|
464
474
|
// Do not validate when focusout is caused by document
|
|
465
475
|
// losing focus, which happens on browser tab switch.
|
|
466
476
|
if (document.hasFocus()) {
|
|
@@ -613,7 +623,7 @@ class TimePicker extends PatternMixin(InputControlMixin(ThemableMixin(ElementMix
|
|
|
613
623
|
}
|
|
614
624
|
|
|
615
625
|
/** @private */
|
|
616
|
-
__updateDropdownItems(
|
|
626
|
+
__updateDropdownItems(_i18n, min, max, step) {
|
|
617
627
|
const minTimeObj = this.__validateTime(this.__parseISO(min || MIN_ALLOWED_TIME));
|
|
618
628
|
const minSec = this.__getSec(minTimeObj);
|
|
619
629
|
|
|
@@ -633,6 +643,21 @@ class TimePicker extends PatternMixin(InputControlMixin(ThemableMixin(ElementMix
|
|
|
633
643
|
}
|
|
634
644
|
}
|
|
635
645
|
|
|
646
|
+
/** @private */
|
|
647
|
+
__updateAriaAttributes(items, opened, input) {
|
|
648
|
+
if (items === undefined || input === undefined) {
|
|
649
|
+
return;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
if (items.length === 0) {
|
|
653
|
+
input.removeAttribute('role');
|
|
654
|
+
input.removeAttribute('aria-expanded');
|
|
655
|
+
} else {
|
|
656
|
+
input.setAttribute('role', 'combobox');
|
|
657
|
+
input.setAttribute('aria-expanded', !!opened);
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
|
|
636
661
|
/** @private */
|
|
637
662
|
__generateDropdownList(minSec, maxSec, step) {
|
|
638
663
|
if (step < 15 * 60 || !this.__validDayDivisor(step)) {
|
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.5.0-
|
|
4
|
+
"version": "24.5.0-alpha11",
|
|
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.5.0-
|
|
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.5.0-alpha11/#/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.5.0-alpha11/#/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.5.0-alpha11/#/elements/vaadin-overlay).\n- `<vaadin-time-picker-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.5.0-alpha11/#/elements/vaadin-item).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.5.0-alpha11/#/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.\n\n### Change events\n\nDepending on the nature of the value change that the user attempts to commit e.g. by pressing Enter,\nthe component can fire either a `change` event or an `unparsable-change` event:\n\nValue change | Event\n:------------------------|:------------------\nempty => parsable | change\nempty => unparsable | unparsable-change\nparsable => empty | change\nparsable => parsable | change\nparsable => unparsable | change\nunparsable => empty | unparsable-change\nunparsable => parsable | change\nunparsable => unparsable | unparsable-change",
|
|
12
12
|
"attributes": [
|
|
13
13
|
{
|
|
14
14
|
"name": "disabled",
|
package/web-types.lit.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/time-picker",
|
|
4
|
-
"version": "24.5.0-
|
|
4
|
+
"version": "24.5.0-alpha11",
|
|
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.5.0-
|
|
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.5.0-alpha11/#/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.5.0-alpha11/#/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.5.0-alpha11/#/elements/vaadin-overlay).\n- `<vaadin-time-picker-item>` - has the same API as [`<vaadin-item>`](https://cdn.vaadin.com/vaadin-web-components/24.5.0-alpha11/#/elements/vaadin-item).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.5.0-alpha11/#/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.\n\n### Change events\n\nDepending on the nature of the value change that the user attempts to commit e.g. by pressing Enter,\nthe component can fire either a `change` event or an `unparsable-change` event:\n\nValue change | Event\n:------------------------|:------------------\nempty => parsable | change\nempty => unparsable | unparsable-change\nparsable => empty | change\nparsable => parsable | change\nparsable => unparsable | change\nunparsable => empty | unparsable-change\nunparsable => parsable | change\nunparsable => unparsable | unparsable-change",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
22
|
{
|