@vaadin/date-picker 22.0.0-beta2 → 22.0.2

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/date-picker",
3
- "version": "22.0.0-beta2",
3
+ "version": "22.0.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -35,21 +35,21 @@
35
35
  "@polymer/iron-a11y-announcer": "^3.0.0",
36
36
  "@polymer/iron-media-query": "^3.0.0",
37
37
  "@polymer/polymer": "^3.2.0",
38
- "@vaadin/button": "22.0.0-beta2",
39
- "@vaadin/component-base": "22.0.0-beta2",
40
- "@vaadin/field-base": "22.0.0-beta2",
41
- "@vaadin/input-container": "22.0.0-beta2",
42
- "@vaadin/vaadin-lumo-styles": "22.0.0-beta2",
43
- "@vaadin/vaadin-material-styles": "22.0.0-beta2",
44
- "@vaadin/vaadin-overlay": "22.0.0-beta2",
45
- "@vaadin/vaadin-themable-mixin": "22.0.0-beta2"
38
+ "@vaadin/button": "^22.0.2",
39
+ "@vaadin/component-base": "^22.0.2",
40
+ "@vaadin/field-base": "^22.0.2",
41
+ "@vaadin/input-container": "^22.0.2",
42
+ "@vaadin/vaadin-lumo-styles": "^22.0.2",
43
+ "@vaadin/vaadin-material-styles": "^22.0.2",
44
+ "@vaadin/vaadin-overlay": "^22.0.2",
45
+ "@vaadin/vaadin-themable-mixin": "^22.0.2"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@esm-bundle/chai": "^4.3.4",
49
- "@vaadin/dialog": "22.0.0-beta2",
50
- "@vaadin/polymer-legacy-adapter": "22.0.0-beta2",
51
- "@vaadin/testing-helpers": "^0.3.0",
49
+ "@vaadin/dialog": "^22.0.2",
50
+ "@vaadin/polymer-legacy-adapter": "^22.0.2",
51
+ "@vaadin/testing-helpers": "^0.3.2",
52
52
  "sinon": "^9.2.0"
53
53
  },
54
- "gitHead": "f13833683e6667f6ca6678452db14aa6b7eac4a4"
54
+ "gitHead": "df21370c4a655a38eac11f79686021ab3b0887ad"
55
55
  }
@@ -74,6 +74,7 @@ class DatePickerLight extends ThemableMixin(DatePickerMixin(PolymerElement)) {
74
74
  opened="{{opened}}"
75
75
  on-vaadin-overlay-open="_onOverlayOpened"
76
76
  on-vaadin-overlay-close="_onOverlayClosed"
77
+ on-vaadin-overlay-outside-click="focus"
77
78
  theme$="[[__getOverlayTheme(theme, _overlayInitialized)]]"
78
79
  >
79
80
  <template>
@@ -3,7 +3,7 @@
3
3
  * Copyright (c) 2021 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { addListener } from '@polymer/polymer/lib/utils/gestures.js';
6
+ import { isIOS } from '@vaadin/component-base/src/browser-utils.js';
7
7
  import { KeyboardMixin } from '@vaadin/component-base/src/keyboard-mixin.js';
8
8
  import { DelegateFocusMixin } from '@vaadin/field-base/src/delegate-focus-mixin.js';
9
9
  import { InputMixin } from '@vaadin/field-base/src/input-mixin.js';
@@ -301,13 +301,13 @@ export const DatePickerMixin = (subclass) =>
301
301
  /** @private */
302
302
  _noInput: {
303
303
  type: Boolean,
304
- computed: '_isNoInput(inputElement, _fullscreen, _ios, i18n, i18n.*)'
304
+ computed: '_isNoInput(inputElement, _fullscreen, _ios, i18n, opened, autoOpenDisabled)'
305
305
  },
306
306
 
307
307
  /** @private */
308
308
  _ios: {
309
309
  type: Boolean,
310
- value: navigator.userAgent.match(/iP(?:hone|ad;(?: U;)? CPU) OS (\d+)/)
310
+ value: isIOS
311
311
  },
312
312
 
313
313
  /** @private */
@@ -414,17 +414,11 @@ export const DatePickerMixin = (subclass) =>
414
414
  ready() {
415
415
  super.ready();
416
416
 
417
- addListener(this, 'tap', (e) => {
417
+ this.addEventListener('click', (e) => {
418
418
  if (!this._isClearButton(e) && (!this.autoOpenDisabled || this._noInput)) {
419
419
  this.open();
420
420
  }
421
421
  });
422
-
423
- this.addEventListener('touchend', (e) => {
424
- if (!this._isClearButton(e)) {
425
- e.preventDefault();
426
- }
427
- });
428
422
  }
429
423
 
430
424
  /** @protected */
@@ -540,8 +534,17 @@ export const DatePickerMixin = (subclass) =>
540
534
  }
541
535
 
542
536
  /** @private */
543
- _isNoInput(inputElement, fullscreen, ios, i18n) {
544
- return !inputElement || fullscreen || ios || !i18n.parseDate;
537
+ // eslint-disable-next-line max-params
538
+ _isNoInput(inputElement, fullscreen, ios, i18n, opened, autoOpenDisabled) {
539
+ // On fullscreen mode, text input is disabled if auto-open isn't disabled or
540
+ // whenever the dropdown is opened
541
+ const noInputOnFullscreenMode = fullscreen && (!autoOpenDisabled || opened);
542
+ // On iOS, text input is disabled whenever the dropdown is opened, because
543
+ // the virtual keyboard doesn't affect the viewport metrics and thus the
544
+ // dropdown could get covered by the keyboard.
545
+ const noInputOnIos = ios && opened;
546
+
547
+ return !inputElement || noInputOnFullscreenMode || noInputOnIos || !i18n.parseDate;
545
548
  }
546
549
 
547
550
  /** @private */
@@ -10,9 +10,9 @@ import './vaadin-date-picker-overlay-content.js';
10
10
  import { GestureEventListeners } from '@polymer/polymer/lib/mixins/gesture-event-listeners.js';
11
11
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
12
12
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
13
- import { AriaLabelController } from '@vaadin/field-base/src/aria-label-controller.js';
14
13
  import { InputControlMixin } from '@vaadin/field-base/src/input-control-mixin.js';
15
14
  import { InputController } from '@vaadin/field-base/src/input-controller.js';
15
+ import { LabelledInputController } from '@vaadin/field-base/src/labelled-input-controller.js';
16
16
  import { inputFieldShared } from '@vaadin/field-base/src/styles/input-field-shared-styles.js';
17
17
  import { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
18
18
  import { DatePickerMixin } from './vaadin-date-picker-mixin.js';
@@ -165,6 +165,7 @@ class DatePicker extends DatePickerMixin(
165
165
  theme$="[[__getOverlayTheme(theme, _overlayInitialized)]]"
166
166
  on-vaadin-overlay-open="_onOverlayOpened"
167
167
  on-vaadin-overlay-close="_onOverlayClosed"
168
+ on-vaadin-overlay-outside-click="focus"
168
169
  disable-upgrade
169
170
  >
170
171
  <template>
@@ -212,7 +213,7 @@ class DatePicker extends DatePickerMixin(
212
213
  this.ariaTarget = input;
213
214
  })
214
215
  );
215
- this.addController(new AriaLabelController(this, this.inputElement, this._labelNode));
216
+ this.addController(new LabelledInputController(this.inputElement, this._labelNode));
216
217
  }
217
218
 
218
219
  /** @private */
@@ -7,6 +7,7 @@ import { afterNextRender } from '@polymer/polymer/lib/utils/render-status.js';
7
7
  import { templatize } from '@polymer/polymer/lib/utils/templatize.js';
8
8
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
9
9
  import { timeOut } from '@vaadin/component-base/src/async.js';
10
+ import { isFirefox } from '@vaadin/component-base/src/browser-utils.js';
10
11
  import { Debouncer } from '@vaadin/component-base/src/debounce.js';
11
12
 
12
13
  /**
@@ -137,7 +138,6 @@ class InfiniteScroller extends PolymerElement {
137
138
 
138
139
  // Firefox interprets elements with overflow:auto as focusable
139
140
  // https://bugzilla.mozilla.org/show_bug.cgi?id=1069739
140
- var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
141
141
  if (isFirefox) {
142
142
  this.$.scroller.tabIndex = -1;
143
143
  }