@vaadin/date-picker
Advanced tools
Comparing version 23.0.0-alpha2 to 23.0.0-alpha3
{ | ||
"name": "@vaadin/date-picker", | ||
"version": "23.0.0-alpha2", | ||
"version": "23.0.0-alpha3", | ||
"publishConfig": { | ||
@@ -35,22 +35,21 @@ "access": "public" | ||
"@open-wc/dedupe-mixin": "^1.3.0", | ||
"@polymer/iron-a11y-announcer": "^3.0.0", | ||
"@polymer/iron-media-query": "^3.0.0", | ||
"@polymer/polymer": "^3.2.0", | ||
"@vaadin/button": "23.0.0-alpha2", | ||
"@vaadin/component-base": "23.0.0-alpha2", | ||
"@vaadin/field-base": "23.0.0-alpha2", | ||
"@vaadin/input-container": "23.0.0-alpha2", | ||
"@vaadin/vaadin-lumo-styles": "23.0.0-alpha2", | ||
"@vaadin/vaadin-material-styles": "23.0.0-alpha2", | ||
"@vaadin/vaadin-overlay": "23.0.0-alpha2", | ||
"@vaadin/vaadin-themable-mixin": "23.0.0-alpha2" | ||
"@vaadin/button": "23.0.0-alpha3", | ||
"@vaadin/component-base": "23.0.0-alpha3", | ||
"@vaadin/field-base": "23.0.0-alpha3", | ||
"@vaadin/input-container": "23.0.0-alpha3", | ||
"@vaadin/vaadin-lumo-styles": "23.0.0-alpha3", | ||
"@vaadin/vaadin-material-styles": "23.0.0-alpha3", | ||
"@vaadin/vaadin-overlay": "23.0.0-alpha3", | ||
"@vaadin/vaadin-themable-mixin": "23.0.0-alpha3" | ||
}, | ||
"devDependencies": { | ||
"@esm-bundle/chai": "^4.3.4", | ||
"@vaadin/dialog": "23.0.0-alpha2", | ||
"@vaadin/polymer-legacy-adapter": "23.0.0-alpha2", | ||
"@vaadin/dialog": "23.0.0-alpha3", | ||
"@vaadin/polymer-legacy-adapter": "23.0.0-alpha3", | ||
"@vaadin/testing-helpers": "^0.3.2", | ||
"sinon": "^9.2.0" | ||
}, | ||
"gitHead": "070f586dead02ca41b66717820c647f48bf1665f" | ||
"gitHead": "490037919a9e054cc002c1b3be0c94a1603e1a44" | ||
} |
/** | ||
* @license | ||
* Copyright (c) 2021 Vaadin Ltd. | ||
* Copyright (c) 2016 - 2022 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 Vaadin Ltd. | ||
* Copyright (c) 2016 - 2022 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 Vaadin Ltd. | ||
* Copyright (c) 2016 - 2022 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 Vaadin Ltd. | ||
* Copyright (c) 2016 - 2022 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 Vaadin Ltd. | ||
* Copyright (c) 2016 - 2022 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
*/ | ||
import { isIOS } from '@vaadin/component-base/src/browser-utils.js'; | ||
import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js'; | ||
import { KeyboardMixin } from '@vaadin/component-base/src/keyboard-mixin.js'; | ||
import { DelegateFocusMixin } from '@vaadin/field-base/src/delegate-focus-mixin.js'; | ||
import { InputMixin } from '@vaadin/field-base/src/input-mixin.js'; | ||
import { VirtualKeyboardController } from '@vaadin/field-base/src/virtual-keyboard-controller.js'; | ||
import { dateAllowed, dateEquals, extractDateParts, getClosestDate } from './vaadin-date-picker-helper.js'; | ||
@@ -14,5 +16,6 @@ | ||
* @polymerMixin | ||
* @param {function(new:HTMLElement)} subclass | ||
*/ | ||
export const DatePickerMixin = (subclass) => | ||
class VaadinDatePickerMixin extends DelegateFocusMixin(InputMixin(KeyboardMixin(subclass))) { | ||
class VaadinDatePickerMixin extends ControllerMixin(DelegateFocusMixin(InputMixin(KeyboardMixin(subclass)))) { | ||
static get properties() { | ||
@@ -423,2 +426,4 @@ return { | ||
}); | ||
this.addController(new VirtualKeyboardController(this)); | ||
} | ||
@@ -425,0 +430,0 @@ |
/** | ||
* @license | ||
* Copyright (c) 2021 Vaadin Ltd. | ||
* Copyright (c) 2016 - 2022 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -10,4 +10,4 @@ */ | ||
import './vaadin-infinite-scroller.js'; | ||
import { IronA11yAnnouncer } from '@polymer/iron-a11y-announcer/iron-a11y-announcer.js'; | ||
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js'; | ||
import { announce } from '@vaadin/component-base/src/a11y-announcer.js'; | ||
import { timeOut } from '@vaadin/component-base/src/async.js'; | ||
@@ -354,12 +354,11 @@ import { Debouncer } from '@vaadin/component-base/src/debounce.js'; | ||
setTouchAction(this.$.scrollers, 'pan-y'); | ||
IronA11yAnnouncer.requestAvailability(); | ||
} | ||
announceFocusedDate() { | ||
var focusedDate = this._currentlyFocusedDate(); | ||
var announce = []; | ||
const focusedDate = this._currentlyFocusedDate(); | ||
let messages = []; | ||
if (dateEquals(focusedDate, new Date())) { | ||
announce.push(this.i18n.today); | ||
messages.push(this.i18n.today); | ||
} | ||
announce = announce.concat([ | ||
messages = messages.concat([ | ||
this.i18n.weekdays[focusedDate.getDay()], | ||
@@ -371,14 +370,6 @@ focusedDate.getDate(), | ||
if (this.showWeekNumbers && this.i18n.firstDayOfWeek === 1) { | ||
announce.push(this.i18n.week); | ||
announce.push(getISOWeekNumber(focusedDate)); | ||
messages.push(this.i18n.week); | ||
messages.push(getISOWeekNumber(focusedDate)); | ||
} | ||
this.dispatchEvent( | ||
new CustomEvent('iron-announce', { | ||
bubbles: true, | ||
composed: true, | ||
detail: { | ||
text: announce.join(' ') | ||
} | ||
}) | ||
); | ||
announce(messages.join(' ')); | ||
} | ||
@@ -417,14 +408,18 @@ | ||
*/ | ||
revealDate(date) { | ||
revealDate(date, animate = true) { | ||
if (date) { | ||
var diff = this._differenceInMonths(date, this._originDate); | ||
var scrolledAboveViewport = this.$.monthScroller.position > diff; | ||
const diff = this._differenceInMonths(date, this._originDate); | ||
const scrolledAboveViewport = this.$.monthScroller.position > diff; | ||
var visibleItems = this.$.monthScroller.clientHeight / this.$.monthScroller.itemHeight; | ||
var scrolledBelowViewport = this.$.monthScroller.position + visibleItems - 1 < diff; | ||
const visibleArea = Math.max( | ||
this.$.monthScroller.itemHeight, | ||
this.$.monthScroller.clientHeight - this.$.monthScroller.bufferOffset * 2 | ||
); | ||
const visibleItems = visibleArea / this.$.monthScroller.itemHeight; | ||
const scrolledBelowViewport = this.$.monthScroller.position + visibleItems - 1 < diff; | ||
if (scrolledAboveViewport) { | ||
this._scrollToPosition(diff, true); | ||
this._scrollToPosition(diff, animate); | ||
} else if (scrolledBelowViewport) { | ||
this._scrollToPosition(diff - visibleItems + 1, true); | ||
this._scrollToPosition(diff - visibleItems + 1, animate); | ||
} | ||
@@ -544,3 +539,3 @@ } | ||
} | ||
t--; | ||
t -= 1; | ||
return (-c / 2) * (t * (t - 2) - 1) + b; | ||
@@ -547,0 +542,0 @@ }; |
/** | ||
* @license | ||
* Copyright (c) 2021 Vaadin Ltd. | ||
* Copyright (c) 2016 - 2022 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 Vaadin Ltd. | ||
* Copyright (c) 2016 - 2022 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 Vaadin Ltd. | ||
* Copyright (c) 2016 - 2022 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
/** | ||
* @license | ||
* Copyright (c) 2021 Vaadin Ltd. | ||
* Copyright (c) 2016 - 2022 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -215,3 +215,3 @@ */ | ||
); | ||
this.addController(new LabelledInputController(this.inputElement, this._labelNode)); | ||
this.addController(new LabelledInputController(this.inputElement, this._labelController)); | ||
addListener(this.shadowRoot.querySelector('[part="toggle-button"]'), 'tap', this._toggle.bind(this)); | ||
@@ -218,0 +218,0 @@ } |
/** | ||
* @license | ||
* Copyright (c) 2021 Vaadin Ltd. | ||
* Copyright (c) 2016 - 2022 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -189,5 +189,5 @@ */ | ||
// Check if we scrolled enough to translate the buffer positions. | ||
const bufferOffset = this.root.querySelector('.buffer').offsetTop; | ||
const upperThresholdReached = scrollTop > this._buffers[1].translateY + this.itemHeight + bufferOffset; | ||
const lowerThresholdReached = scrollTop < this._buffers[0].translateY + this.itemHeight + bufferOffset; | ||
const offset = this.itemHeight + this.bufferOffset; | ||
const upperThresholdReached = scrollTop > this._buffers[1].translateY + offset; | ||
const lowerThresholdReached = scrollTop < this._buffers[0].translateY + offset; | ||
@@ -214,4 +214,11 @@ if (upperThresholdReached || lowerThresholdReached) { | ||
/** | ||
* @private | ||
* @return {number} | ||
*/ | ||
get bufferOffset() { | ||
return this._buffers[0].offsetTop; | ||
} | ||
/** | ||
* @return {number} | ||
*/ | ||
get position() { | ||
@@ -224,3 +231,3 @@ return (this.$.scroller.scrollTop - this._buffers[0].translateY) / this.itemHeight + this._firstIndex; | ||
* | ||
* @type {Number} | ||
* @type {number} | ||
*/ | ||
@@ -251,2 +258,5 @@ set position(index) { | ||
/** | ||
* @return {number} | ||
*/ | ||
get itemHeight() { | ||
@@ -253,0 +263,0 @@ if (!this._itemHeightVal) { |
/** | ||
* @license | ||
* Copyright (c) 2021 Vaadin Ltd. | ||
* Copyright (c) 2016 - 2022 Vaadin Ltd. | ||
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/ | ||
@@ -5,0 +5,0 @@ */ |
@@ -113,3 +113,3 @@ import '@vaadin/vaadin-material-styles/color.js'; | ||
[part='months'] { | ||
--vaadin-infinite-scroller-item-height: 320px; | ||
--vaadin-infinite-scroller-item-height: 328px; | ||
text-align: center; | ||
@@ -116,0 +116,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
152345
11
4048
+ Added@vaadin/button@23.0.0-alpha3(transitive)
+ Added@vaadin/component-base@23.0.0-alpha3(transitive)
+ Added@vaadin/field-base@23.0.0-alpha3(transitive)
+ Added@vaadin/icon@23.0.0-alpha3(transitive)
+ Added@vaadin/input-container@23.0.0-alpha3(transitive)
+ Added@vaadin/vaadin-lumo-styles@23.0.0-alpha3(transitive)
+ Added@vaadin/vaadin-material-styles@23.0.0-alpha3(transitive)
+ Added@vaadin/vaadin-overlay@23.0.0-alpha3(transitive)
+ Added@vaadin/vaadin-themable-mixin@23.0.0-alpha3(transitive)
- Removed@polymer/iron-a11y-announcer@^3.0.0
- Removed@polymer/iron-a11y-announcer@3.2.0(transitive)
- Removed@vaadin/button@23.0.0-alpha2(transitive)
- Removed@vaadin/component-base@23.0.0-alpha2(transitive)
- Removed@vaadin/field-base@23.0.0-alpha2(transitive)
- Removed@vaadin/icon@23.0.0-alpha2(transitive)
- Removed@vaadin/input-container@23.0.0-alpha2(transitive)
- Removed@vaadin/vaadin-lumo-styles@23.0.0-alpha2(transitive)
- Removed@vaadin/vaadin-material-styles@23.0.0-alpha2(transitive)
- Removed@vaadin/vaadin-overlay@23.0.0-alpha2(transitive)
- Removed@vaadin/vaadin-themable-mixin@23.0.0-alpha2(transitive)
Updated@vaadin/button@23.0.0-alpha3