@descope/web-components-ui 1.0.64 → 1.0.66

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. package/dist/cjs/index.cjs.js +6 -4
  2. package/dist/cjs/index.cjs.js.map +1 -1
  3. package/dist/index.esm.js +706 -464
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/umd/233.js +5 -1
  6. package/dist/umd/314.js +283 -0
  7. package/dist/umd/314.js.LICENSE.txt +27 -0
  8. package/dist/umd/541.js +744 -0
  9. package/dist/umd/541.js.LICENSE.txt +21 -0
  10. package/dist/umd/725.js +37 -1
  11. package/dist/umd/786.js +1 -1
  12. package/dist/umd/824.js +229 -0
  13. package/dist/umd/{54.js.LICENSE.txt → 824.js.LICENSE.txt} +0 -6
  14. package/dist/umd/840.js +9 -9
  15. package/dist/umd/860.js +1 -0
  16. package/dist/umd/descope-button-index-js.js +1 -1
  17. package/dist/umd/descope-checkbox-index-js.js +1 -1
  18. package/dist/umd/descope-combo-box-index-js.js +1 -0
  19. package/dist/umd/descope-container-index-js.js +1 -1
  20. package/dist/umd/descope-date-picker-index-js.js +1 -1
  21. package/dist/umd/descope-divider-index-js.js +1 -1
  22. package/dist/umd/descope-email-field-index-js.js +1 -1
  23. package/dist/umd/descope-link-index-js.js +1 -1
  24. package/dist/umd/descope-loader-linear-index-js.js +1 -1
  25. package/dist/umd/descope-loader-radial-index-js.js +1 -1
  26. package/dist/umd/descope-logo-index-js.js +1 -1
  27. package/dist/umd/descope-number-field-index-js.js +1 -1
  28. package/dist/umd/descope-passcode-descope-passcode-internal-index-js.js +1 -1
  29. package/dist/umd/descope-passcode-index-js.js +1 -1
  30. package/dist/umd/descope-password-field-index-js.js +1 -1
  31. package/dist/umd/descope-switch-toggle-index-js.js +1 -1
  32. package/dist/umd/descope-text-area-index-js.js +1 -1
  33. package/dist/umd/descope-text-field-index-js.js +1 -1
  34. package/dist/umd/descope-text-index-js.js +1 -1
  35. package/dist/umd/index.js +1 -1
  36. package/package.json +2 -1
  37. package/src/components/descope-combo-box/ComboBox.js +111 -0
  38. package/src/components/descope-combo-box/index.js +6 -0
  39. package/src/components/descope-passcode/Passcode.js +1 -0
  40. package/src/components/descope-passcode/descope-passcode-internal/PasscodeInternal.js +9 -5
  41. package/src/constants.js +3 -1
  42. package/src/helpers/componentHelpers.js +55 -36
  43. package/src/helpers/index.js +2 -1
  44. package/src/helpers/themeHelpers/index.js +3 -3
  45. package/src/mixins/createStyleMixin/index.js +116 -90
  46. package/src/mixins/index.js +1 -0
  47. package/src/mixins/inputMixin.js +12 -7
  48. package/src/mixins/portalMixin.js +62 -0
  49. package/src/mixins/proxyInputMixin.js +23 -22
  50. package/src/theme/components/comboBox.js +32 -0
  51. package/src/theme/components/index.js +3 -1
  52. package/dist/umd/54.js +0 -971
  53. package/dist/umd/666.js +0 -37
  54. /package/dist/umd/{666.js.LICENSE.txt → 725.js.LICENSE.txt} +0 -0
package/dist/umd/54.js DELETED
@@ -1,971 +0,0 @@
1
- /*! For license information please see 54.js.LICENSE.txt */
2
- "use strict";(self.webpackChunkDescopeUI=self.webpackChunkDescopeUI||[]).push([[54],{3054:(e,t,s)=>{s(3787),s(9098),s(9416),s(1195),s(9849),s(4173);var i=s(5128);const o=i.iv`
3
- :host {
4
- top: var(--lumo-space-m);
5
- right: var(--lumo-space-m);
6
- bottom: var(--lumo-space-m);
7
- left: var(--lumo-space-m);
8
- /* Workaround for Edge issue (only on Surface), where an overflowing vaadin-list-box inside vaadin-select-overlay makes the overlay transparent */
9
- /* stylelint-disable-next-line */
10
- outline: 0px solid transparent;
11
- }
12
-
13
- [part='overlay'] {
14
- background-color: var(--lumo-base-color);
15
- background-image: linear-gradient(var(--lumo-tint-5pct), var(--lumo-tint-5pct));
16
- border-radius: var(--lumo-border-radius-m);
17
- box-shadow: 0 0 0 1px var(--lumo-shade-5pct), var(--lumo-box-shadow-m);
18
- color: var(--lumo-body-text-color);
19
- font-family: var(--lumo-font-family);
20
- font-size: var(--lumo-font-size-m);
21
- font-weight: 400;
22
- line-height: var(--lumo-line-height-m);
23
- letter-spacing: 0;
24
- text-transform: none;
25
- -webkit-text-size-adjust: 100%;
26
- -webkit-font-smoothing: antialiased;
27
- -moz-osx-font-smoothing: grayscale;
28
- }
29
-
30
- [part='content'] {
31
- padding: var(--lumo-space-xs);
32
- }
33
-
34
- [part='backdrop'] {
35
- background-color: var(--lumo-shade-20pct);
36
- animation: 0.2s lumo-overlay-backdrop-enter both;
37
- will-change: opacity;
38
- }
39
-
40
- @keyframes lumo-overlay-backdrop-enter {
41
- 0% {
42
- opacity: 0;
43
- }
44
- }
45
-
46
- :host([closing]) [part='backdrop'] {
47
- animation: 0.2s lumo-overlay-backdrop-exit both;
48
- }
49
-
50
- @keyframes lumo-overlay-backdrop-exit {
51
- 100% {
52
- opacity: 0;
53
- }
54
- }
55
-
56
- @keyframes lumo-overlay-dummy-animation {
57
- 0% {
58
- opacity: 1;
59
- }
60
-
61
- 100% {
62
- opacity: 1;
63
- }
64
- }
65
- `;(0,i.hC)("",o,{moduleId:"lumo-overlay"}),(0,i.hC)("vaadin-overlay",o,{moduleId:"lumo-vaadin-overlay"}),s(7894);let n=!1,a=[],r=[];function l(){n=!0,requestAnimationFrame((function(){n=!1,function(e){for(;e.length;)h(e.shift())}(a),setTimeout((function(){!function(e){for(let t=0,s=e.length;t<s;t++)h(e.shift())}(r)}))}))}function h(e){const t=e[0],s=e[1],i=e[2];try{s.apply(t,i)}catch(e){setTimeout((()=>{throw e}))}}function d(e,t,s){n||l(),r.push([e,t,s])}var c=s(4241);const u=e=>e.test(navigator.userAgent),_=e=>e.test(navigator.platform);u(/Android/u),u(/Chrome/u)&&/Google Inc/u.test(navigator.vendor);const p=u(/Firefox/u),m=_(/^iPad/u)||_(/^Mac/u)&&navigator.maxTouchPoints>1,f=_(/^iPhone/u)||m;u(/^((?!chrome|android).)*safari/iu),(()=>{try{return document.createEvent("TouchEvent"),!0}catch(e){return!1}})();var y=s(6155),g=s(1914),v=s(4530);const b=[];class D{constructor(e){this.host=e,this.__trapNode=null,this.__onKeyDown=this.__onKeyDown.bind(this)}get __focusableElements(){return(0,v.GO)(this.__trapNode)}get __focusedElementIndex(){const e=this.__focusableElements;return e.indexOf(e.filter(v.Qw).pop())}hostConnected(){document.addEventListener("keydown",this.__onKeyDown)}hostDisconnected(){document.removeEventListener("keydown",this.__onKeyDown)}trapFocus(e){if(this.__trapNode=e,0===this.__focusableElements.length)throw this.__trapNode=null,new Error("The trap node should have at least one focusable descendant or be focusable itself.");b.push(this),-1===this.__focusedElementIndex&&this.__focusableElements[0].focus()}releaseFocus(){this.__trapNode=null,b.pop()}__onKeyDown(e){if(this.__trapNode&&this===Array.from(b).pop()&&"Tab"===e.key){e.preventDefault();const t=e.shiftKey;this.__focusNextElement(t)}}__focusNextElement(e=!1){const t=this.__focusableElements,s=e?-1:1,i=this.__focusedElementIndex,o=t[(t.length+i+s)%t.length];o.focus(),"input"===o.localName&&o.select()}}class w extends((0,i.Tb)((0,g.U)((0,y.k)(c.H3)))){static get template(){return c.dy`
66
- <style>
67
- :host {
68
- z-index: 200;
69
- position: fixed;
70
-
71
- /* Despite of what the names say, <vaadin-overlay> is just a container
72
- for position/sizing/alignment. The actual overlay is the overlay part. */
73
-
74
- /* Default position constraints: the entire viewport. Note: themes can
75
- override this to introduce gaps between the overlay and the viewport. */
76
- top: 0;
77
- right: 0;
78
- bottom: var(--vaadin-overlay-viewport-bottom);
79
- left: 0;
80
-
81
- /* Use flexbox alignment for the overlay part. */
82
- display: flex;
83
- flex-direction: column; /* makes dropdowns sizing easier */
84
- /* Align to center by default. */
85
- align-items: center;
86
- justify-content: center;
87
-
88
- /* Allow centering when max-width/max-height applies. */
89
- margin: auto;
90
-
91
- /* The host is not clickable, only the overlay part is. */
92
- pointer-events: none;
93
-
94
- /* Remove tap highlight on touch devices. */
95
- -webkit-tap-highlight-color: transparent;
96
-
97
- /* CSS API for host */
98
- --vaadin-overlay-viewport-bottom: 0;
99
- }
100
-
101
- :host([hidden]),
102
- :host(:not([opened]):not([closing])) {
103
- display: none !important;
104
- }
105
-
106
- [part='overlay'] {
107
- -webkit-overflow-scrolling: touch;
108
- overflow: auto;
109
- pointer-events: auto;
110
-
111
- /* Prevent overflowing the host in MSIE 11 */
112
- max-width: 100%;
113
- box-sizing: border-box;
114
-
115
- -webkit-tap-highlight-color: initial; /* reenable tap highlight inside */
116
- }
117
-
118
- [part='backdrop'] {
119
- z-index: -1;
120
- content: '';
121
- background: rgba(0, 0, 0, 0.5);
122
- position: fixed;
123
- top: 0;
124
- left: 0;
125
- bottom: 0;
126
- right: 0;
127
- pointer-events: auto;
128
- }
129
- </style>
130
-
131
- <div id="backdrop" part="backdrop" hidden$="[[!withBackdrop]]"></div>
132
- <div part="overlay" id="overlay" tabindex="0">
133
- <div part="content" id="content">
134
- <slot></slot>
135
- </div>
136
- </div>
137
- `}static get is(){return"vaadin-overlay"}static get properties(){return{opened:{type:Boolean,notify:!0,observer:"_openedChanged",reflectToAttribute:!0},owner:Element,renderer:Function,withBackdrop:{type:Boolean,value:!1,reflectToAttribute:!0},model:Object,modeless:{type:Boolean,value:!1,reflectToAttribute:!0,observer:"_modelessChanged"},hidden:{type:Boolean,reflectToAttribute:!0,observer:"_hiddenChanged"},focusTrap:{type:Boolean,value:!1},restoreFocusOnClose:{type:Boolean,value:!1},restoreFocusNode:{type:HTMLElement},_mouseDownInside:{type:Boolean},_mouseUpInside:{type:Boolean},_oldOwner:Element,_oldModel:Object,_oldRenderer:Object,_oldOpened:Boolean}}static get observers(){return["_rendererOrDataChanged(renderer, owner, model, opened)"]}static get __attachedInstances(){return Array.from(document.body.children).filter((e=>e instanceof w&&!e.hasAttribute("closing"))).sort(((e,t)=>e.__zIndex-t.__zIndex||0))}constructor(){super(),this._boundMouseDownListener=this._mouseDownListener.bind(this),this._boundMouseUpListener=this._mouseUpListener.bind(this),this._boundOutsideClickListener=this._outsideClickListener.bind(this),this._boundKeydownListener=this._keydownListener.bind(this),f&&(this._boundIosResizeListener=()=>this._detectIosNavbar()),this.__focusTrapController=new D(this)}get _last(){return this===w.__attachedInstances.pop()}ready(){var e;super.ready(),this.addEventListener("click",(()=>{})),this.$.backdrop.addEventListener("click",(()=>{})),this.addController(this.__focusTrapController),e=this,window.Vaadin&&window.Vaadin.templateRendererCallback?window.Vaadin.templateRendererCallback(e):e.querySelector("template")&&console.warn(`WARNING: <template> inside <${e.localName}> is no longer supported. Import @vaadin/polymer-legacy-adapter/template-renderer.js to enable compatibility.`)}_detectIosNavbar(){if(!this.opened)return;const e=window.innerHeight,t=window.innerWidth>e,s=document.documentElement.clientHeight;t&&s>e?this.style.setProperty("--vaadin-overlay-viewport-bottom",s-e+"px"):this.style.setProperty("--vaadin-overlay-viewport-bottom","0")}close(e){const t=new CustomEvent("vaadin-overlay-close",{bubbles:!0,cancelable:!0,detail:{sourceEvent:e}});this.dispatchEvent(t),t.defaultPrevented||(this.opened=!1)}connectedCallback(){super.connectedCallback(),this._boundIosResizeListener&&(this._detectIosNavbar(),window.addEventListener("resize",this._boundIosResizeListener))}disconnectedCallback(){super.disconnectedCallback(),this._boundIosResizeListener&&window.removeEventListener("resize",this._boundIosResizeListener)}requestContentUpdate(){this.renderer&&this.renderer.call(this.owner,this,this.owner,this.model)}_mouseDownListener(e){this._mouseDownInside=e.composedPath().indexOf(this.$.overlay)>=0}_mouseUpListener(e){this._mouseUpInside=e.composedPath().indexOf(this.$.overlay)>=0}_shouldCloseOnOutsideClick(e){return this._last}_outsideClickListener(e){if(e.composedPath().includes(this.$.overlay)||this._mouseDownInside||this._mouseUpInside)return this._mouseDownInside=!1,void(this._mouseUpInside=!1);if(!this._shouldCloseOnOutsideClick(e))return;const t=new CustomEvent("vaadin-overlay-outside-click",{bubbles:!0,cancelable:!0,detail:{sourceEvent:e}});this.dispatchEvent(t),this.opened&&!t.defaultPrevented&&this.close(e)}_keydownListener(e){if(this._last&&(!this.modeless||e.composedPath().includes(this.$.overlay))&&"Escape"===e.key){const t=new CustomEvent("vaadin-overlay-escape-press",{bubbles:!0,cancelable:!0,detail:{sourceEvent:e}});this.dispatchEvent(t),this.opened&&!t.defaultPrevented&&this.close(e)}}_openedChanged(e,t){e?(this.__restoreFocusNode=this._getActiveElement(),this._animatedOpening(),d(this,(()=>{this.focusTrap&&this.__focusTrapController.trapFocus(this.$.overlay);const e=new CustomEvent("vaadin-overlay-open",{bubbles:!0});this.dispatchEvent(e)})),document.addEventListener("keydown",this._boundKeydownListener),this.modeless||this._addGlobalListeners()):t&&(this.focusTrap&&this.__focusTrapController.releaseFocus(),this._animatedClosing(),document.removeEventListener("keydown",this._boundKeydownListener),this.modeless||this._removeGlobalListeners())}_hiddenChanged(e){e&&this.hasAttribute("closing")&&this._flushAnimation("closing")}_shouldAnimate(){const e=getComputedStyle(this),t=e.getPropertyValue("animation-name");return!("none"===e.getPropertyValue("display"))&&t&&"none"!==t}_enqueueAnimation(e,t){const s=`__${e}Handler`,i=e=>{e&&e.target!==this||(t(),this.removeEventListener("animationend",i),delete this[s])};this[s]=i,this.addEventListener("animationend",i)}_flushAnimation(e){const t=`__${e}Handler`;"function"==typeof this[t]&&this[t]()}_animatedOpening(){this.parentNode===document.body&&this.hasAttribute("closing")&&this._flushAnimation("closing"),this._attachOverlay(),this.modeless||this._enterModalState(),this.setAttribute("opening",""),this._shouldAnimate()?this._enqueueAnimation("opening",(()=>{this._finishOpening()})):this._finishOpening()}_attachOverlay(){this._placeholder=document.createComment("vaadin-overlay-placeholder"),this.parentNode.insertBefore(this._placeholder,this),document.body.appendChild(this),this.bringToFront()}_finishOpening(){this.removeAttribute("opening")}_finishClosing(){this._detachOverlay(),this.$.overlay.style.removeProperty("pointer-events"),this.removeAttribute("closing"),this.dispatchEvent(new CustomEvent("vaadin-overlay-closed"))}_animatedClosing(){if(this.hasAttribute("opening")&&this._flushAnimation("opening"),this._placeholder){this._exitModalState();const e=this.restoreFocusNode||this.__restoreFocusNode;if(this.restoreFocusOnClose&&e){const t=this._getActiveElement();(t===document.body||this._deepContains(t))&&setTimeout((()=>e.focus())),this.__restoreFocusNode=null}this.setAttribute("closing",""),this.dispatchEvent(new CustomEvent("vaadin-overlay-closing")),this._shouldAnimate()?this._enqueueAnimation("closing",(()=>{this._finishClosing()})):this._finishClosing()}}_detachOverlay(){this._placeholder.parentNode.insertBefore(this,this._placeholder),this._placeholder.parentNode.removeChild(this._placeholder)}_modelessChanged(e){e?(this._removeGlobalListeners(),this._exitModalState()):this.opened&&(this._addGlobalListeners(),this._enterModalState())}_addGlobalListeners(){document.addEventListener("mousedown",this._boundMouseDownListener),document.addEventListener("mouseup",this._boundMouseUpListener),document.documentElement.addEventListener("click",this._boundOutsideClickListener,!0)}_enterModalState(){"none"!==document.body.style.pointerEvents&&(this._previousDocumentPointerEvents=document.body.style.pointerEvents,document.body.style.pointerEvents="none"),w.__attachedInstances.forEach((e=>{e!==this&&(e.shadowRoot.querySelector('[part="overlay"]').style.pointerEvents="none")}))}_removeGlobalListeners(){document.removeEventListener("mousedown",this._boundMouseDownListener),document.removeEventListener("mouseup",this._boundMouseUpListener),document.documentElement.removeEventListener("click",this._boundOutsideClickListener,!0)}_exitModalState(){void 0!==this._previousDocumentPointerEvents&&(document.body.style.pointerEvents=this._previousDocumentPointerEvents,delete this._previousDocumentPointerEvents);const e=w.__attachedInstances;let t;for(;(t=e.pop())&&(t===this||(t.shadowRoot.querySelector('[part="overlay"]').style.removeProperty("pointer-events"),t.modeless)););}_rendererOrDataChanged(e,t,s,i){const o=this._oldOwner!==t||this._oldModel!==s;this._oldModel=s,this._oldOwner=t;const n=this._oldRenderer!==e;this._oldRenderer=e;const a=this._oldOpened!==i;this._oldOpened=i,n&&(this.innerHTML="",delete this._$litPart$),i&&e&&(n||a||o)&&this.requestContentUpdate()}_getActiveElement(){let e=document.activeElement||document.body;for(;e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}_deepContains(e){if(this.contains(e))return!0;let t=e;const s=e.ownerDocument;for(;t&&t!==s&&t!==this;)t=t.parentNode||t.host;return t===this}bringToFront(){let e="";const t=w.__attachedInstances.filter((e=>e!==this)).pop();t&&(e=t.__zIndex+1),this.style.zIndex=e,this.__zIndex=e||parseFloat(getComputedStyle(this).zIndex)}}customElements.define(w.is,w);const C=i.iv`
138
- :host([opening]),
139
- :host([closing]) {
140
- animation: 0.14s lumo-overlay-dummy-animation;
141
- }
142
-
143
- [part='overlay'] {
144
- will-change: opacity, transform;
145
- }
146
-
147
- :host([opening]) [part='overlay'] {
148
- animation: 0.1s lumo-menu-overlay-enter ease-out both;
149
- }
150
-
151
- @keyframes lumo-menu-overlay-enter {
152
- 0% {
153
- opacity: 0;
154
- transform: translateY(-4px);
155
- }
156
- }
157
-
158
- :host([closing]) [part='overlay'] {
159
- animation: 0.1s lumo-menu-overlay-exit both;
160
- }
161
-
162
- @keyframes lumo-menu-overlay-exit {
163
- 100% {
164
- opacity: 0;
165
- }
166
- }
167
- `;(0,i.hC)("",C,{moduleId:"lumo-menu-overlay-core"});const k=[o,C,i.iv`
168
- /* Small viewport (bottom sheet) styles */
169
- /* Use direct media queries instead of the state attributes ([phone] and [fullscreen]) provided by the elements */
170
- @media (max-width: 420px), (max-height: 420px) {
171
- :host {
172
- top: 0 !important;
173
- right: 0 !important;
174
- bottom: var(--vaadin-overlay-viewport-bottom, 0) !important;
175
- left: 0 !important;
176
- align-items: stretch !important;
177
- justify-content: flex-end !important;
178
- }
179
-
180
- [part='overlay'] {
181
- max-height: 50vh;
182
- width: 100vw;
183
- border-radius: 0;
184
- box-shadow: var(--lumo-box-shadow-xl);
185
- }
186
-
187
- /* The content part scrolls instead of the overlay part, because of the gradient fade-out */
188
- [part='content'] {
189
- padding: 30px var(--lumo-space-m);
190
- max-height: inherit;
191
- box-sizing: border-box;
192
- -webkit-overflow-scrolling: touch;
193
- overflow: auto;
194
- -webkit-mask-image: linear-gradient(transparent, #000 40px, #000 calc(100% - 40px), transparent);
195
- mask-image: linear-gradient(transparent, #000 40px, #000 calc(100% - 40px), transparent);
196
- }
197
-
198
- [part='backdrop'] {
199
- display: block;
200
- }
201
-
202
- /* Animations */
203
-
204
- :host([opening]) [part='overlay'] {
205
- animation: 0.2s lumo-mobile-menu-overlay-enter cubic-bezier(0.215, 0.61, 0.355, 1) both;
206
- }
207
-
208
- :host([closing]),
209
- :host([closing]) [part='backdrop'] {
210
- animation-delay: 0.14s;
211
- }
212
-
213
- :host([closing]) [part='overlay'] {
214
- animation: 0.14s 0.14s lumo-mobile-menu-overlay-exit cubic-bezier(0.55, 0.055, 0.675, 0.19) both;
215
- }
216
- }
217
-
218
- @keyframes lumo-mobile-menu-overlay-enter {
219
- 0% {
220
- transform: translateY(150%);
221
- }
222
- }
223
-
224
- @keyframes lumo-mobile-menu-overlay-exit {
225
- 100% {
226
- transform: translateY(150%);
227
- }
228
- }
229
- `];(0,i.hC)("",k,{moduleId:"lumo-menu-overlay"});const x=i.iv`
230
- [part='overlay'] {
231
- /*
232
- Width:
233
- date cell widths
234
- + month calendar side padding
235
- + year scroller width
236
- */
237
- /* prettier-ignore */
238
- width:
239
- calc(
240
- var(--lumo-size-m) * 7
241
- + var(--lumo-space-xs) * 2
242
- + 57px
243
- );
244
- height: 100%;
245
- max-height: calc(var(--lumo-size-m) * 14);
246
- overflow: hidden;
247
- -webkit-tap-highlight-color: transparent;
248
- }
249
-
250
- [part='overlay'] {
251
- flex-direction: column;
252
- }
253
-
254
- [part='content'] {
255
- padding: 0;
256
- height: 100%;
257
- overflow: hidden;
258
- -webkit-mask-image: none;
259
- mask-image: none;
260
- }
261
-
262
- :host([top-aligned]) [part~='overlay'] {
263
- margin-top: var(--lumo-space-xs);
264
- }
265
-
266
- :host([bottom-aligned]) [part~='overlay'] {
267
- margin-bottom: var(--lumo-space-xs);
268
- }
269
-
270
- @media (max-width: 420px), (max-height: 420px) {
271
- [part='overlay'] {
272
- width: 100vw;
273
- height: 70vh;
274
- max-height: 70vh;
275
- }
276
- }
277
- `;(0,i.hC)("vaadin-date-picker-overlay",[k,x],{moduleId:"lumo-date-picker-overlay"}),s(4513),(0,i.hC)("vaadin-date-picker-year",i.iv`
278
- :host([current]) [part='year-number'] {
279
- color: var(--lumo-primary-text-color);
280
- }
281
-
282
- :host(:not([current])) [part='year-number'],
283
- [part='year-separator'] {
284
- opacity: var(--_lumo-date-picker-year-opacity, 0.7);
285
- transition: 0.2s opacity;
286
- }
287
-
288
- [part='year-number'],
289
- [part='year-separator'] {
290
- display: flex;
291
- align-items: center;
292
- justify-content: center;
293
- height: 50%;
294
- transform: translateY(-50%);
295
- }
296
-
297
- [part='year-separator']::after {
298
- color: var(--lumo-disabled-text-color);
299
- content: '\\2022';
300
- }
301
- `,{moduleId:"lumo-date-picker-year"}),(0,i.hC)("vaadin-date-picker-overlay-content",i.iv`
302
- :host {
303
- position: relative;
304
- /* Background for the year scroller, placed here as we are using a mask image on the actual years part */
305
- background-image: linear-gradient(var(--lumo-shade-5pct), var(--lumo-shade-5pct));
306
- background-size: 57px 100%;
307
- background-position: top right;
308
- background-repeat: no-repeat;
309
- cursor: default;
310
- }
311
-
312
- ::slotted([slot='months']) {
313
- /* Month calendar height:
314
- header height + margin-bottom
315
- + weekdays height + margin-bottom
316
- + date cell heights
317
- + small margin between month calendars
318
- */
319
- /* prettier-ignore */
320
- --vaadin-infinite-scroller-item-height:
321
- calc(
322
- var(--lumo-font-size-l) + var(--lumo-space-m)
323
- + var(--lumo-font-size-xs) + var(--lumo-space-s)
324
- + var(--lumo-size-m) * 6
325
- + var(--lumo-space-s)
326
- );
327
- --vaadin-infinite-scroller-buffer-offset: 10%;
328
- -webkit-mask-image: linear-gradient(transparent, #000 10%, #000 85%, transparent);
329
- mask-image: linear-gradient(transparent, #000 10%, #000 85%, transparent);
330
- position: relative;
331
- margin-right: 57px;
332
- }
333
-
334
- ::slotted([slot='years']) {
335
- /* TODO get rid of fixed magic number */
336
- --vaadin-infinite-scroller-buffer-width: 97px;
337
- width: 57px;
338
- height: auto;
339
- top: 0;
340
- bottom: 0;
341
- font-size: var(--lumo-font-size-s);
342
- box-shadow: inset 2px 0 4px 0 var(--lumo-shade-5pct);
343
- -webkit-mask-image: linear-gradient(transparent, #000 35%, #000 65%, transparent);
344
- mask-image: linear-gradient(transparent, #000 35%, #000 65%, transparent);
345
- cursor: var(--lumo-clickable-cursor);
346
- }
347
-
348
- ::slotted([slot='years']:hover) {
349
- --_lumo-date-picker-year-opacity: 1;
350
- }
351
-
352
- /* TODO unsupported selector */
353
- #scrollers {
354
- position: static;
355
- display: block;
356
- }
357
-
358
- /* TODO fix this in vaadin-date-picker that it adapts to the width of the year scroller */
359
- :host([desktop]) ::slotted([slot='months']) {
360
- right: auto;
361
- }
362
-
363
- /* Year scroller position indicator */
364
- ::slotted([slot='years'])::before {
365
- border: none;
366
- width: 1em;
367
- height: 1em;
368
- background-color: var(--lumo-base-color);
369
- background-image: linear-gradient(var(--lumo-tint-5pct), var(--lumo-tint-5pct));
370
- transform: translate(-75%, -50%) rotate(45deg);
371
- border-top-right-radius: var(--lumo-border-radius-s);
372
- box-shadow: 2px -2px 6px 0 var(--lumo-shade-5pct);
373
- z-index: 1;
374
- }
375
-
376
- [part='toolbar'] {
377
- padding: var(--lumo-space-s);
378
- border-bottom-left-radius: var(--lumo-border-radius-l);
379
- margin-right: 57px;
380
- }
381
-
382
- [part='toolbar'] ::slotted(vaadin-button) {
383
- margin: 0;
384
- }
385
-
386
- /* Narrow viewport mode (fullscreen) */
387
-
388
- :host([fullscreen]) [part='toolbar'] {
389
- order: -1;
390
- background-color: var(--lumo-base-color);
391
- }
392
-
393
- :host([fullscreen]) [part='overlay-header'] {
394
- order: -2;
395
- height: var(--lumo-size-m);
396
- padding: var(--lumo-space-s);
397
- position: absolute;
398
- left: 0;
399
- right: 0;
400
- justify-content: center;
401
- }
402
-
403
- :host([fullscreen]) [part='toggle-button'],
404
- :host([fullscreen]) [part='clear-button'],
405
- [part='overlay-header'] [part='label'] {
406
- display: none;
407
- }
408
-
409
- /* Very narrow screen (year scroller initially hidden) */
410
-
411
- [part='years-toggle-button'] {
412
- display: flex;
413
- align-items: center;
414
- height: var(--lumo-size-s);
415
- padding: 0 0.5em;
416
- border-radius: var(--lumo-border-radius-m);
417
- z-index: 3;
418
- color: var(--lumo-primary-text-color);
419
- font-weight: 500;
420
- -webkit-font-smoothing: antialiased;
421
- -moz-osx-font-smoothing: grayscale;
422
- }
423
-
424
- :host([years-visible]) [part='years-toggle-button'] {
425
- background-color: var(--lumo-primary-color);
426
- color: var(--lumo-primary-contrast-color);
427
- }
428
-
429
- /* TODO magic number (same as used for media-query in vaadin-date-picker-overlay-content) */
430
- @media screen and (max-width: 374px) {
431
- :host {
432
- background-image: none;
433
- }
434
-
435
- [part='toolbar'],
436
- ::slotted([slot='months']) {
437
- margin-right: 0;
438
- }
439
-
440
- /* TODO make date-picker adapt to the width of the years part */
441
- ::slotted([slot='years']) {
442
- --vaadin-infinite-scroller-buffer-width: 90px;
443
- width: 50px;
444
- background-color: var(--lumo-shade-5pct);
445
- }
446
-
447
- :host([years-visible]) ::slotted([slot='months']) {
448
- padding-left: 50px;
449
- }
450
- }
451
- `,{moduleId:"lumo-date-picker-overlay-content"}),(0,i.hC)("vaadin-month-calendar",i.iv`
452
- :host {
453
- -moz-user-select: none;
454
- -webkit-user-select: none;
455
- -webkit-tap-highlight-color: transparent;
456
- user-select: none;
457
- font-size: var(--lumo-font-size-m);
458
- color: var(--lumo-body-text-color);
459
- text-align: center;
460
- padding: 0 var(--lumo-space-xs);
461
- }
462
-
463
- /* Month header */
464
-
465
- [part='month-header'] {
466
- color: var(--lumo-header-text-color);
467
- font-size: var(--lumo-font-size-l);
468
- line-height: 1;
469
- font-weight: 500;
470
- margin-bottom: var(--lumo-space-m);
471
- }
472
-
473
- /* Week days and numbers */
474
-
475
- [part='weekdays'],
476
- [part='weekday'],
477
- [part='week-number'] {
478
- font-size: var(--lumo-font-size-xxs);
479
- line-height: 1;
480
- color: var(--lumo-secondary-text-color);
481
- }
482
-
483
- [part='weekdays'] {
484
- margin-bottom: var(--lumo-space-s);
485
- }
486
-
487
- [part='weekday']:empty,
488
- [part='week-number'] {
489
- width: var(--lumo-size-xs);
490
- }
491
-
492
- /* Date and week number cells */
493
-
494
- [part~='date'],
495
- [part='week-number'] {
496
- box-sizing: border-box;
497
- display: inline-flex;
498
- align-items: center;
499
- justify-content: center;
500
- height: var(--lumo-size-m);
501
- position: relative;
502
- }
503
-
504
- [part~='date'] {
505
- transition: color 0.1s;
506
- }
507
-
508
- [part~='date']:not(:empty) {
509
- cursor: var(--lumo-clickable-cursor);
510
- }
511
-
512
- :host([week-numbers]) [part='weekday']:not(:empty),
513
- :host([week-numbers]) [part~='date'] {
514
- width: calc((100% - var(--lumo-size-xs)) / 7);
515
- }
516
-
517
- /* Today date */
518
-
519
- [part~='date'][part~='today'] {
520
- color: var(--lumo-primary-text-color);
521
- }
522
-
523
- /* Focused date */
524
-
525
- [part~='date']::before {
526
- content: '';
527
- position: absolute;
528
- z-index: -1;
529
- top: 50%;
530
- left: 50%;
531
- transform: translate(-50%, -50%);
532
- min-width: 2em;
533
- min-height: 2em;
534
- width: 80%;
535
- height: 80%;
536
- max-height: 100%;
537
- max-width: 100%;
538
- border-radius: var(--lumo-border-radius-m);
539
- }
540
-
541
- [part~='date'][part~='focused']::before {
542
- box-shadow: 0 0 0 1px var(--lumo-base-color), 0 0 0 3px var(--lumo-primary-color-50pct);
543
- }
544
-
545
- :host(:not([focused])) [part~='date'][part~='focused']::before {
546
- animation: vaadin-date-picker-month-calendar-focus-date 1.4s infinite;
547
- }
548
-
549
- @keyframes vaadin-date-picker-month-calendar-focus-date {
550
- 50% {
551
- box-shadow: 0 0 0 1px var(--lumo-base-color), 0 0 0 3px transparent;
552
- }
553
- }
554
-
555
- [part~='date']:not(:empty):not([part~='disabled']):not([part~='selected']):hover::before {
556
- background-color: var(--lumo-primary-color-10pct);
557
- }
558
-
559
- [part~='date'][part~='selected'] {
560
- color: var(--lumo-primary-contrast-color);
561
- }
562
-
563
- [part~='date'][part~='selected']::before {
564
- background-color: var(--lumo-primary-color);
565
- }
566
-
567
- [part~='date'][part~='disabled'] {
568
- color: var(--lumo-disabled-text-color);
569
- }
570
-
571
- @media (pointer: coarse) {
572
- [part~='date']:hover:not([part~='selected'])::before,
573
- [part~='focused']:not([part~='selected'])::before {
574
- display: none;
575
- }
576
-
577
- [part~='date']:not(:empty):not([part~='disabled']):active::before {
578
- display: block;
579
- }
580
-
581
- [part~='date'][part~='selected']::before {
582
- box-shadow: none;
583
- }
584
- }
585
-
586
- /* Disabled */
587
-
588
- :host([disabled]) * {
589
- color: var(--lumo-disabled-text-color) !important;
590
- }
591
- `,{moduleId:"lumo-month-calendar"});const E=document.createElement("template");E.innerHTML="\n <style>\n @keyframes vaadin-date-picker-month-calendar-focus-date {\n 50% {\n box-shadow: 0 0 0 2px transparent;\n }\n }\n </style>\n",document.head.appendChild(E.content),s(1735);var S=s(2279);const T=i.iv`
592
- :host {
593
- outline: none;
594
- }
595
-
596
- [part='toggle-button']::before {
597
- content: var(--lumo-icons-calendar);
598
- }
599
-
600
- [part='clear-button']::before {
601
- content: var(--lumo-icons-cross);
602
- }
603
-
604
- @media (max-width: 420px), (max-height: 420px) {
605
- [part='overlay-content'] {
606
- height: 70vh;
607
- }
608
- }
609
-
610
- :host([dir='rtl']) [part='input-field'] ::slotted(input) {
611
- --_lumo-text-field-overflow-mask-image: linear-gradient(to left, transparent, #000 1.25em);
612
- }
613
-
614
- :host([dir='rtl']) [part='input-field'] ::slotted(input:placeholder-shown) {
615
- --_lumo-text-field-overflow-mask-image: none;
616
- }
617
- `;(0,i.hC)("vaadin-date-picker",[S.J,T],{moduleId:"lumo-date-picker"}),s(3130);var P=s(3726);const I={start:"top",end:"bottom"},A={start:"left",end:"right"},O=new ResizeObserver((e=>{setTimeout((()=>{e.forEach((e=>{e.target.__overlay&&e.target.__overlay._updatePosition()}))}))})),M=e=>class extends e{static get properties(){return{positionTarget:{type:Object,value:null},horizontalAlign:{type:String,value:"start"},verticalAlign:{type:String,value:"top"},noHorizontalOverlap:{type:Boolean,value:!1},noVerticalOverlap:{type:Boolean,value:!1},requiredVerticalSpace:{type:Number,value:0}}}static get observers(){return["__positionSettingsChanged(horizontalAlign, verticalAlign, noHorizontalOverlap, noVerticalOverlap, requiredVerticalSpace)","__overlayOpenedChanged(opened, positionTarget)"]}constructor(){super(),this.__onScroll=this.__onScroll.bind(this),this._updatePosition=this._updatePosition.bind(this)}connectedCallback(){super.connectedCallback(),this.opened&&this.__addUpdatePositionEventListeners()}disconnectedCallback(){super.disconnectedCallback(),this.__removeUpdatePositionEventListeners()}__addUpdatePositionEventListeners(){window.addEventListener("resize",this._updatePosition),this.__positionTargetAncestorRootNodes=(0,P.AD)(this.positionTarget),this.__positionTargetAncestorRootNodes.forEach((e=>{e.addEventListener("scroll",this.__onScroll,!0)}))}__removeUpdatePositionEventListeners(){window.removeEventListener("resize",this._updatePosition),this.__positionTargetAncestorRootNodes&&(this.__positionTargetAncestorRootNodes.forEach((e=>{e.removeEventListener("scroll",this.__onScroll,!0)})),this.__positionTargetAncestorRootNodes=null)}__overlayOpenedChanged(e,t){if(this.__removeUpdatePositionEventListeners(),t&&(t.__overlay=null,O.unobserve(t),e&&(this.__addUpdatePositionEventListeners(),t.__overlay=this,O.observe(t))),e){const e=getComputedStyle(this);this.__margins||(this.__margins={},["top","bottom","left","right"].forEach((t=>{this.__margins[t]=parseInt(e[t],10)}))),this.setAttribute("dir",e.direction),this._updatePosition(),requestAnimationFrame((()=>this._updatePosition()))}}__positionSettingsChanged(){this._updatePosition()}__onScroll(e){this.contains(e.target)||this._updatePosition()}_updatePosition(){if(!this.positionTarget||!this.opened)return;const e=this.positionTarget.getBoundingClientRect(),t=this.__shouldAlignStartVertically(e);this.style.justifyContent=t?"flex-start":"flex-end";const s=this.__isRTL,i=this.__shouldAlignStartHorizontally(e,s),o=!s&&i||s&&!i;this.style.alignItems=o?"flex-start":"flex-end";const n=this.getBoundingClientRect(),a=this.__calculatePositionInOneDimension(e,n,this.noVerticalOverlap,I,this,t),r=this.__calculatePositionInOneDimension(e,n,this.noHorizontalOverlap,A,this,i);Object.assign(this.style,a,r),this.toggleAttribute("bottom-aligned",!t),this.toggleAttribute("top-aligned",t),this.toggleAttribute("end-aligned",!o),this.toggleAttribute("start-aligned",o)}__shouldAlignStartHorizontally(e,t){const s=Math.max(this.__oldContentWidth||0,this.$.overlay.offsetWidth);this.__oldContentWidth=this.$.overlay.offsetWidth;const i=Math.min(window.innerWidth,document.documentElement.clientWidth),o=!t&&"start"===this.horizontalAlign||t&&"end"===this.horizontalAlign;return this.__shouldAlignStart(e,s,i,this.__margins,o,this.noHorizontalOverlap,A)}__shouldAlignStartVertically(e){const t=this.requiredVerticalSpace||Math.max(this.__oldContentHeight||0,this.$.overlay.offsetHeight);this.__oldContentHeight=this.$.overlay.offsetHeight;const s=Math.min(window.innerHeight,document.documentElement.clientHeight),i="top"===this.verticalAlign;return this.__shouldAlignStart(e,t,s,this.__margins,i,this.noVerticalOverlap,I)}__shouldAlignStart(e,t,s,i,o,n,a){const r=s-e[n?a.end:a.start]-i[a.end],l=e[n?a.start:a.end]-i[a.start],h=o?r:l;return o===(h>(o?l:r)||h>t)}__adjustBottomProperty(e,t,s){let i;if(e===t.end){if(t.end===I.end){const e=Math.min(window.innerHeight,document.documentElement.clientHeight);s>e&&this.__oldViewportHeight&&(i=s-(this.__oldViewportHeight-e)),this.__oldViewportHeight=e}if(t.end===A.end){const e=Math.min(window.innerWidth,document.documentElement.clientWidth);s>e&&this.__oldViewportWidth&&(i=s-(this.__oldViewportWidth-e)),this.__oldViewportWidth=e}}return i}__calculatePositionInOneDimension(e,t,s,i,o,n){const a=n?i.start:i.end,r=n?i.end:i.start,l=parseFloat(o.style[a]||getComputedStyle(o)[a]),h=this.__adjustBottomProperty(a,i,l),d=t[n?i.start:i.end]-e[s===n?i.end:i.start];return{[a]:h?`${h}px`:`${l+d*(n?-1:1)}px`,[r]:""}}};let F;(0,i.hC)("vaadin-date-picker-overlay",i.iv`
618
- [part='overlay'] {
619
- display: flex;
620
- flex: auto;
621
- }
622
-
623
- [part~='content'] {
624
- flex: auto;
625
- }
626
- `,{moduleId:"vaadin-date-picker-overlay-styles"});class H extends(M(w)){static get is(){return"vaadin-date-picker-overlay"}static get template(){return F||(F=super.template.cloneNode(!0),F.content.querySelector('[part~="overlay"]').removeAttribute("tabindex")),F}}customElements.define(H.is,H),s(7078);var L=s(4933),z=s(1014);function N(e,t,s,i,o){let n;o&&(n="object"==typeof s&&null!==s,n&&(i=e.__dataTemp[t]));let a=i!==s&&(i==i||s==s);return n&&a&&(e.__dataTemp[t]=s),a}const B=(0,z.o)((e=>class extends e{_shouldPropertyChange(e,t,s){return N(this,e,t,s,!0)}})),Y=(0,z.o)((e=>class extends e{static get properties(){return{mutableData:Boolean}}_shouldPropertyChange(e,t,s){return N(this,e,t,s,this.mutableData)}}));B._mutablePropertyChange=N;var $=s(9387),V=s(1342);let R=null;function W(){return R}W.prototype=Object.create(HTMLTemplateElement.prototype,{constructor:{value:W,writable:!0}});const q=(0,L.q)(W),j=B(q),U=(0,L.q)(class{});class K extends U{constructor(e){super(),this._configureProperties(e),this.root=this._stampTemplate(this.__dataHost);let t=[];this.children=t;for(let e=this.root.firstChild;e;e=e.nextSibling)t.push(e),e.__templatizeInstance=this;this.__templatizeOwner&&this.__templatizeOwner.__hideTemplateChildren__&&this._showHideChildren(!0);let s=this.__templatizeOptions;(e&&s.instanceProps||!s.instanceProps)&&this._enableProperties()}_configureProperties(e){if(this.__templatizeOptions.forwardHostProp)for(let e in this.__hostProps)this._setPendingProperty(e,this.__dataHost["_host_"+e]);for(let t in e)this._setPendingProperty(t,e[t])}forwardHostProp(e,t){this._setPendingPropertyOrPath(e,t,!1,!0)&&this.__dataHost._enqueueClient(this)}_addEventListenerToNode(e,t,s){if(this._methodHost&&this.__templatizeOptions.parentModel)this._methodHost._addEventListenerToNode(e,t,(e=>{e.model=this,s(e)}));else{let i=this.__dataHost.__dataHost;i&&i._addEventListenerToNode(e,t,s)}}_showHideChildren(e){!function(e,t){for(let s=0;s<t.length;s++){let i=t[s];if(Boolean(e)!=Boolean(i.__hideTemplateChildren__))if(i.nodeType===Node.TEXT_NODE)e?(i.__polymerTextContent__=i.textContent,i.textContent=""):i.textContent=i.__polymerTextContent__;else if("slot"===i.localName)if(e)i.__polymerReplaced__=document.createComment("hidden-slot"),(0,V.r)((0,V.r)(i).parentNode).replaceChild(i.__polymerReplaced__,i);else{const e=i.__polymerReplaced__;e&&(0,V.r)((0,V.r)(e).parentNode).replaceChild(i,e)}else i.style&&(e?(i.__polymerDisplay__=i.style.display,i.style.display="none"):i.style.display=i.__polymerDisplay__);i.__hideTemplateChildren__=e,i._showHideChildren&&i._showHideChildren(e)}}(e,this.children)}_setUnmanagedPropertyToNode(e,t,s){e.__hideTemplateChildren__&&e.nodeType==Node.TEXT_NODE&&"textContent"==t?e.__polymerTextContent__=s:super._setUnmanagedPropertyToNode(e,t,s)}get parentModel(){let e=this.__parentModel;if(!e){let t;e=this;do{e=e.__dataHost.__dataHost}while((t=e.__templatizeOptions)&&!t.parentModel);this.__parentModel=e}return e}dispatchEvent(e){return!0}}K.prototype.__dataHost,K.prototype.__templatizeOptions,K.prototype._methodHost,K.prototype.__templatizeOwner,K.prototype.__hostProps;const X=B(K);function G(e){let t=e.__dataHost;return t&&t._methodHost||t}function Q(e,t){return function(e,s,i){t.call(e.__templatizeOwner,s.substring(6),i[s])}}function J(e,t){return function(e,s,i){t.call(e.__templatizeOwner,e,s,i[s])}}function Z(e,t,s){if($.XN&&!G(e))throw new Error("strictTemplatePolicy: template owner not trusted");if(s=s||{},e.__templatizeOwner)throw new Error("A <template> can only be templatized once");e.__templatizeOwner=t;let i=(t?t.constructor:K)._parseTemplate(e),o=i.templatizeInstanceClass;o||(o=function(e,t,s){let i=s.mutableData?X:K;Z.mixin&&(i=Z.mixin(i));let o=class extends i{};return o.prototype.__templatizeOptions=s,o.prototype._bindTemplate(e),function(e,t,s,i){let o=s.hostProps||{};for(let t in i.instanceProps){delete o[t];let s=i.notifyInstanceProp;s&&e.prototype._addPropertyEffect(t,e.prototype.PROPERTY_EFFECT_TYPES.NOTIFY,{fn:J(0,s)})}if(i.forwardHostProp&&t.__dataHost)for(let t in o)s.hasHostProps||(s.hasHostProps=!0),e.prototype._addPropertyEffect(t,e.prototype.PROPERTY_EFFECT_TYPES.NOTIFY,{fn:function(e,t,s){e.__dataHost._setPendingPropertyOrPath("_host_"+t,s[t],!0,!0)}})}(o,e,t,s),o}(e,i,s),i.templatizeInstanceClass=o);const n=G(e);!function(e,t,s,i){let o=s.forwardHostProp;if(o&&t.hasHostProps){const n="template"==e.localName;let a=t.templatizeTemplateClass;if(!a){if(n){let e=s.mutableData?j:q;class i extends e{}a=t.templatizeTemplateClass=i}else{const s=e.constructor;class i extends s{}a=t.templatizeTemplateClass=i}let r=t.hostProps;for(let e in r)a.prototype._addPropertyEffect("_host_"+e,a.prototype.PROPERTY_EFFECT_TYPES.PROPAGATE,{fn:Q(0,o)}),a.prototype._createNotifyingProperty("_host_"+e);$.a2&&i&&function(e,t,s){const i=s.constructor._properties,{propertyEffects:o}=e,{instanceProps:n}=t;for(let e in o)if(!(i[e]||n&&n[e])){const t=o[e];for(let s=0;s<t.length;s++){const{part:i}=t[s].info;if(!i.signature||!i.signature.static){console.warn(`Property '${e}' used in template but not declared in 'properties'; attribute will not be observed.`);break}}}}(t,s,i)}if(e.__dataProto&&Object.assign(e.__data,e.__dataProto),n)!function(e,t){R=e,Object.setPrototypeOf(e,t.prototype),new t,R=null}(e,a),e.__dataTemp={},e.__dataPending=null,e.__dataOld=null,e._enableProperties();else{Object.setPrototypeOf(e,a.prototype);const s=t.hostProps;for(let t in s)if(t="_host_"+t,t in e){const s=e[t];delete e[t],e.__data[t]=s}}}}(e,i,s,n);let a=class extends o{};return a.prototype._methodHost=n,a.prototype.__dataHost=e,a.prototype.__templatizeOwner=t,a.prototype.__hostProps=i.hostProps,a}var ee=s(2224);class te{constructor(){this._asyncModule=null,this._callback=null,this._timer=null}setConfig(e,t){this._asyncModule=e,this._callback=t,this._timer=this._asyncModule.run((()=>{this._timer=null,se.delete(this),this._callback()}))}cancel(){this.isActive()&&(this._cancelAsync(),se.delete(this))}_cancelAsync(){this.isActive()&&(this._asyncModule.cancel(this._timer),this._timer=null)}flush(){this.isActive()&&(this.cancel(),this._callback())}isActive(){return null!=this._timer}static debounce(e,t,s){return e instanceof te?e._cancelAsync():e=new te,e.setConfig(t,s),e}}let se=new Set;const ie=function(){const e=Boolean(se.size);return se.forEach((e=>{try{e.flush()}catch(e){setTimeout((()=>{throw e}))}})),e},oe=function(){let e,t;do{e=window.ShadyDOM&&ShadyDOM.flush(),window.ShadyCSS&&window.ShadyCSS.ScopingShim&&window.ShadyCSS.ScopingShim.flush(),t=ie()}while(e||t)};var ne=s(1446);let ae=!1;const re=Y(c.H3);class le extends re{static get is(){return"dom-repeat"}static get template(){return null}static get properties(){return{items:{type:Array},as:{type:String,value:"item"},indexAs:{type:String,value:"index"},itemsIndexAs:{type:String,value:"itemsIndex"},sort:{type:Function,observer:"__sortChanged"},filter:{type:Function,observer:"__filterChanged"},observe:{type:String,observer:"__observeChanged"},delay:Number,renderedItemCount:{type:Number,notify:!$.dJ,readOnly:!0},initialCount:{type:Number},targetFramerate:{type:Number,value:20},_targetFrameTime:{type:Number,computed:"__computeFrameTime(targetFramerate)"},notifyDomChange:{type:Boolean},reuseChunkedInstances:{type:Boolean}}}static get observers(){return["__itemsChanged(items.*)"]}constructor(){super(),this.__instances=[],this.__renderDebouncer=null,this.__itemsIdxToInstIdx={},this.__chunkCount=null,this.__renderStartTime=null,this.__itemsArrayChanged=!1,this.__shouldMeasureChunk=!1,this.__shouldContinueChunking=!1,this.__chunkingId=0,this.__sortFn=null,this.__filterFn=null,this.__observePaths=null,this.__ctor=null,this.__isDetached=!0,this.template=null,this._templateInfo}disconnectedCallback(){super.disconnectedCallback(),this.__isDetached=!0;for(let e=0;e<this.__instances.length;e++)this.__detachInstance(e);this.__chunkingId&&cancelAnimationFrame(this.__chunkingId)}connectedCallback(){if(super.connectedCallback(),function(){if($.nL&&!$.my){if(!ae){ae=!0;const e=document.createElement("style");e.textContent="dom-bind,dom-if,dom-repeat{display:none;}",document.head.appendChild(e)}return!0}return!1}()||(this.style.display="none"),this.__isDetached){this.__isDetached=!1;let e=(0,V.r)((0,V.r)(this).parentNode);for(let t=0;t<this.__instances.length;t++)this.__attachInstance(t,e);this.__chunkingId&&this.__render()}}__ensureTemplatized(){if(!this.__ctor){const e=this;let t=this.template=e._templateInfo?e:this.querySelector("template");if(!t){let e=new MutationObserver((()=>{if(!this.querySelector("template"))throw new Error("dom-repeat requires a <template> child");e.disconnect(),this.__render()}));return e.observe(this,{childList:!0}),!1}let s={};s[this.as]=!0,s[this.indexAs]=!0,s[this.itemsIndexAs]=!0,this.__ctor=Z(t,this,{mutableData:this.mutableData,parentModel:!0,instanceProps:s,forwardHostProp:function(e,t){let s=this.__instances;for(let i,o=0;o<s.length&&(i=s[o]);o++)i.forwardHostProp(e,t)},notifyInstanceProp:function(e,t,s){if((0,ne.wB)(this.as,t)){let i=e[this.itemsIndexAs];t==this.as&&(this.items[i]=s);let o=(0,ne.Iu)(this.as,`${JSCompiler_renameProperty("items",this)}.${i}`,t);this.notifyPath(o,s)}}})}return!0}__getMethodHost(){return this.__dataHost._methodHost||this.__dataHost}__functionFromPropertyValue(e){if("string"==typeof e){let t=e,s=this.__getMethodHost();return function(){return s[t].apply(s,arguments)}}return e}__sortChanged(e){this.__sortFn=this.__functionFromPropertyValue(e),this.items&&this.__debounceRender(this.__render)}__filterChanged(e){this.__filterFn=this.__functionFromPropertyValue(e),this.items&&this.__debounceRender(this.__render)}__computeFrameTime(e){return Math.ceil(1e3/e)}__observeChanged(){this.__observePaths=this.observe&&this.observe.replace(".*",".").split(" ")}__handleObservedPaths(e){if(this.__sortFn||this.__filterFn)if(e){if(this.__observePaths){let t=this.__observePaths;for(let s=0;s<t.length;s++)0===e.indexOf(t[s])&&this.__debounceRender(this.__render,this.delay)}}else this.__debounceRender(this.__render,this.delay)}__itemsChanged(e){this.items&&!Array.isArray(this.items)&&console.warn("dom-repeat expected array for `items`, found",this.items),this.__handleItemPath(e.path,e.value)||("items"===e.path&&(this.__itemsArrayChanged=!0),this.__debounceRender(this.__render))}__debounceRender(e,t=0){var s;this.__renderDebouncer=te.debounce(this.__renderDebouncer,t>0?ee.Wc.after(t):ee.YA,e.bind(this)),s=this.__renderDebouncer,se.add(s)}render(){this.__debounceRender(this.__render),oe()}__render(){if(!this.__ensureTemplatized())return;let e=this.items||[];const t=this.__sortAndFilterItems(e),s=this.__calculateLimit(t.length);this.__updateInstances(e,s,t),this.initialCount&&(this.__shouldMeasureChunk||this.__shouldContinueChunking)&&(cancelAnimationFrame(this.__chunkingId),this.__chunkingId=requestAnimationFrame((()=>{this.__chunkingId=null,this.__continueChunking()}))),this._setRenderedItemCount(this.__instances.length),$.dJ&&!this.notifyDomChange||this.dispatchEvent(new CustomEvent("dom-change",{bubbles:!0,composed:!0}))}__sortAndFilterItems(e){let t=new Array(e.length);for(let s=0;s<e.length;s++)t[s]=s;return this.__filterFn&&(t=t.filter(((t,s,i)=>this.__filterFn(e[t],s,i)))),this.__sortFn&&t.sort(((t,s)=>this.__sortFn(e[t],e[s]))),t}__calculateLimit(e){let t=e;const s=this.__instances.length;if(this.initialCount){let i;!this.__chunkCount||this.__itemsArrayChanged&&!this.reuseChunkedInstances?(t=Math.min(e,this.initialCount),i=Math.max(t-s,0),this.__chunkCount=i||1):(i=Math.min(Math.max(e-s,0),this.__chunkCount),t=Math.min(s+i,e)),this.__shouldMeasureChunk=i===this.__chunkCount,this.__shouldContinueChunking=t<e,this.__renderStartTime=performance.now()}return this.__itemsArrayChanged=!1,t}__continueChunking(){if(this.__shouldMeasureChunk){const e=performance.now()-this.__renderStartTime,t=this._targetFrameTime/e;this.__chunkCount=Math.round(this.__chunkCount*t)||1}this.__shouldContinueChunking&&this.__debounceRender(this.__render)}__updateInstances(e,t,s){const i=this.__itemsIdxToInstIdx={};let o;for(o=0;o<t;o++){let t=this.__instances[o],n=s[o],a=e[n];i[n]=o,t?(t._setPendingProperty(this.as,a),t._setPendingProperty(this.indexAs,o),t._setPendingProperty(this.itemsIndexAs,n),t._flushProperties()):this.__insertInstance(a,o,n)}for(let e=this.__instances.length-1;e>=o;e--)this.__detachAndRemoveInstance(e)}__detachInstance(e){let t=this.__instances[e];const s=(0,V.r)(t.root);for(let e=0;e<t.children.length;e++){let i=t.children[e];s.appendChild(i)}return t}__attachInstance(e,t){let s=this.__instances[e];t.insertBefore(s.root,this)}__detachAndRemoveInstance(e){this.__detachInstance(e),this.__instances.splice(e,1)}__stampInstance(e,t,s){let i={};return i[this.as]=e,i[this.indexAs]=t,i[this.itemsIndexAs]=s,new this.__ctor(i)}__insertInstance(e,t,s){const i=this.__stampInstance(e,t,s);let o=this.__instances[t+1],n=o?o.children[0]:this;return(0,V.r)((0,V.r)(this).parentNode).insertBefore(i.root,n),this.__instances[t]=i,i}_showHideChildren(e){for(let t=0;t<this.__instances.length;t++)this.__instances[t]._showHideChildren(e)}__handleItemPath(e,t){let s=e.slice(6),i=s.indexOf("."),o=i<0?s:s.substring(0,i);if(o==parseInt(o,10)){let e=i<0?"":s.substring(i+1);this.__handleObservedPaths(e);let n=this.__itemsIdxToInstIdx[o],a=this.__instances[n];if(a){let s=this.as+(e?"."+e:"");a._setPendingPropertyOrPath(s,t,!1,!0),a._flushProperties()}return!0}}itemForElement(e){let t=this.modelForElement(e);return t&&t[this.as]}indexForElement(e){let t=this.modelForElement(e);return t&&t[this.indexAs]}modelForElement(e){return function(e,t){let s;for(;t;)if(s=t.__dataHost?t:t.__templatizeInstance){if(s.__dataHost==e)return s;t=s.__dataHost}else t=(0,V.r)(t).parentNode;return null}(this.template,e)}}customElements.define(le.is,le);var he=s(2527),de=s(9109);function ce(e,t){return e instanceof Date&&t instanceof Date&&e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function ue(e,t,s){return(!t||e>=t)&&(!s||e<=s)}function _e(e,t){return t.filter((e=>void 0!==e)).reduce(((t,s)=>s?t?Math.abs(e.getTime()-s.getTime())<Math.abs(t.getTime()-e.getTime())?s:t:s:t))}function pe(e){return{day:e.getDate(),month:e.getMonth(),year:e.getFullYear()}}function me(e){const t=new Date,s=new Date(t);return s.setDate(1),s.setMonth(parseInt(e)+t.getMonth()),s}function fe(e){const t=/^([-+]\d{1}|\d{2,4}|[-+]\d{6})-(\d{1,2})-(\d{1,2})$/u.exec(e);if(!t)return;const s=new Date(0,0);return s.setFullYear(parseInt(t[1],10)),s.setMonth(parseInt(t[2],10)-1),s.setDate(parseInt(t[3],10)),s}class ye extends((0,he.W)((0,i.Tb)(c.H3))){static get template(){return c.dy`
627
- <style>
628
- :host {
629
- display: block;
630
- }
631
-
632
- #monthGrid {
633
- width: 100%;
634
- border-collapse: collapse;
635
- }
636
-
637
- #days-container tr,
638
- #weekdays-container tr {
639
- display: flex;
640
- }
641
-
642
- [part~='date'] {
643
- outline: none;
644
- }
645
-
646
- [part~='disabled'] {
647
- pointer-events: none;
648
- }
649
-
650
- [part='week-number'][hidden],
651
- [part='weekday'][hidden] {
652
- display: none;
653
- }
654
-
655
- [part='weekday'],
656
- [part~='date'] {
657
- width: calc(100% / 7);
658
- padding: 0;
659
- font-weight: normal;
660
- }
661
-
662
- [part='weekday']:empty,
663
- [part='week-number'] {
664
- width: 12.5%;
665
- flex-shrink: 0;
666
- padding: 0;
667
- }
668
-
669
- :host([week-numbers]) [part='weekday']:not(:empty),
670
- :host([week-numbers]) [part~='date'] {
671
- width: 12.5%;
672
- }
673
- </style>
674
-
675
- <div part="month-header" id="month-header" aria-hidden="true">[[_getTitle(month, i18n.monthNames)]]</div>
676
- <table
677
- id="monthGrid"
678
- role="grid"
679
- aria-labelledby="month-header"
680
- on-touchend="_preventDefault"
681
- on-touchstart="_onMonthGridTouchStart"
682
- >
683
- <thead id="weekdays-container">
684
- <tr role="row" part="weekdays">
685
- <th
686
- part="weekday"
687
- aria-hidden="true"
688
- hidden$="[[!_showWeekSeparator(showWeekNumbers, i18n.firstDayOfWeek)]]"
689
- ></th>
690
- <template
691
- is="dom-repeat"
692
- items="[[_getWeekDayNames(i18n.weekdays, i18n.weekdaysShort, showWeekNumbers, i18n.firstDayOfWeek)]]"
693
- >
694
- <th role="columnheader" part="weekday" scope="col" abbr$="[[item.weekDay]]" aria-hidden="true">
695
- [[item.weekDayShort]]
696
- </th>
697
- </template>
698
- </tr>
699
- </thead>
700
- <tbody id="days-container">
701
- <template is="dom-repeat" items="[[_weeks]]" as="week">
702
- <tr role="row">
703
- <td
704
- part="week-number"
705
- aria-hidden="true"
706
- hidden$="[[!_showWeekSeparator(showWeekNumbers, i18n.firstDayOfWeek)]]"
707
- >
708
- [[__getWeekNumber(week)]]
709
- </td>
710
- <template is="dom-repeat" items="[[week]]">
711
- <td
712
- role="gridcell"
713
- part$="[[__getDatePart(item, focusedDate, selectedDate, minDate, maxDate)]]"
714
- date="[[item]]"
715
- tabindex$="[[__getDayTabindex(item, focusedDate)]]"
716
- disabled$="[[__isDayDisabled(item, minDate, maxDate)]]"
717
- aria-selected$="[[__getDayAriaSelected(item, selectedDate)]]"
718
- aria-disabled$="[[__getDayAriaDisabled(item, minDate, maxDate)]]"
719
- aria-label$="[[__getDayAriaLabel(item)]]"
720
- >[[_getDate(item)]]</td
721
- >
722
- </template>
723
- </tr>
724
- </template>
725
- </tbody>
726
- </table>
727
- `}static get is(){return"vaadin-month-calendar"}static get properties(){return{month:{type:Date,value:new Date},selectedDate:{type:Date,notify:!0},focusedDate:Date,showWeekNumbers:{type:Boolean,value:!1},i18n:{type:Object},ignoreTaps:Boolean,_notTapping:Boolean,minDate:{type:Date,value:null},maxDate:{type:Date,value:null},_days:{type:Array,computed:"_getDays(month, i18n.firstDayOfWeek, minDate, maxDate)"},_weeks:{type:Array,computed:"_getWeeks(_days)"},disabled:{type:Boolean,reflectToAttribute:!0,computed:"_isDisabled(month, minDate, maxDate)"}}}static get observers(){return["_showWeekNumbersChanged(showWeekNumbers, i18n.firstDayOfWeek)","__focusedDateChanged(focusedDate, _days)"]}get focusableDateElement(){return[...this.shadowRoot.querySelectorAll("[part~=date]")].find((e=>ce(e.date,this.focusedDate)))}ready(){super.ready(),(0,de.NH)(this.$.monthGrid,"tap",this._handleTap.bind(this))}_isDisabled(e,t,s){const i=new Date(0,0);i.setFullYear(e.getFullYear()),i.setMonth(e.getMonth()),i.setDate(1);const o=new Date(0,0);return o.setFullYear(e.getFullYear()),o.setMonth(e.getMonth()+1),o.setDate(0),!(t&&s&&t.getMonth()===s.getMonth()&&t.getMonth()===e.getMonth()&&s.getDate()-t.getDate()>=0||ue(i,t,s)||ue(o,t,s))}_getTitle(e,t){if(void 0!==e&&void 0!==t)return this.i18n.formatTitle(t[e.getMonth()],e.getFullYear())}_onMonthGridTouchStart(){this._notTapping=!1,setTimeout((()=>{this._notTapping=!0}),300)}_dateAdd(e,t){e.setDate(e.getDate()+t)}_applyFirstDayOfWeek(e,t){if(void 0!==e&&void 0!==t)return e.slice(t).concat(e.slice(0,t))}_getWeekDayNames(e,t,s,i){if(void 0!==e&&void 0!==t&&void 0!==s&&void 0!==i)return e=this._applyFirstDayOfWeek(e,i),t=this._applyFirstDayOfWeek(t,i),e.map(((e,s)=>({weekDay:e,weekDayShort:t[s]})))}__focusedDateChanged(e,t){t.some((t=>ce(t,e)))?this.removeAttribute("aria-hidden"):this.setAttribute("aria-hidden","true")}_getDate(e){return e?e.getDate():""}_showWeekNumbersChanged(e,t){e&&1===t?this.setAttribute("week-numbers",""):this.removeAttribute("week-numbers")}_showWeekSeparator(e,t){return e&&1===t}_isToday(e){return ce(new Date,e)}_getDays(e,t){if(void 0===e||void 0===t)return;const s=new Date(0,0);for(s.setFullYear(e.getFullYear()),s.setMonth(e.getMonth()),s.setDate(1);s.getDay()!==t;)this._dateAdd(s,-1);const i=[],o=s.getMonth(),n=e.getMonth();for(;s.getMonth()===n||s.getMonth()===o;)i.push(s.getMonth()===n?new Date(s.getTime()):null),this._dateAdd(s,1);return i}_getWeeks(e){return e.reduce(((e,t,s)=>(s%7==0&&e.push([]),e[e.length-1].push(t),e)),[])}_handleTap(e){this.ignoreTaps||this._notTapping||!e.target.date||e.target.hasAttribute("disabled")||(this.selectedDate=e.target.date,this.dispatchEvent(new CustomEvent("date-tap",{detail:{date:e.target.date},bubbles:!0,composed:!0})))}_preventDefault(e){e.preventDefault()}__getDatePart(e,t,s,i,o){const n=["date"];return this.__isDayDisabled(e,i,o)&&n.push("disabled"),this.__isDayFocused(e,t)&&n.push("focused"),this.__isDaySelected(e,s)&&n.push("selected"),this._isToday(e)&&n.push("today"),n.join(" ")}__getWeekNumber(e){return function(e){let t=e.getDay();0===t&&(t=7);const s=4-t,i=new Date(e.getTime()+24*s*3600*1e3),o=new Date(0,0);o.setFullYear(i.getFullYear());const n=i.getTime()-o.getTime(),a=Math.round(n/864e5);return Math.floor(a/7+1)}(e.reduce(((e,t)=>!e&&t?t:e)))}__isDayFocused(e,t){return ce(e,t)}__isDaySelected(e,t){return ce(e,t)}__getDayAriaSelected(e,t){if(this.__isDaySelected(e,t))return"true"}__isDayDisabled(e,t,s){return!ue(e,t,s)}__getDayAriaDisabled(e,t,s){if(void 0!==e&&void 0!==t&&void 0!==s)return this.__isDayDisabled(e,t,s)?"true":void 0}__getDayAriaLabel(e){if(!e)return"";let t=`${this._getDate(e)} ${this.i18n.monthNames[e.getMonth()]} ${e.getFullYear()}, ${this.i18n.weekdays[e.getDay()]}`;return this._isToday(e)&&(t+=`, ${this.i18n.today}`),t}__getDayTabindex(e,t){return this.__isDayFocused(e,t)?"0":"-1"}}customElements.define(ye.is,ye);var ge=s(1121),ve=s(7913),be=s(6139),De=s(3971);class we extends c.H3{static get template(){return c.dy`
728
- <style>
729
- :host {
730
- display: block;
731
- overflow: hidden;
732
- height: 500px;
733
- }
734
-
735
- #scroller {
736
- position: relative;
737
- height: 100%;
738
- overflow: auto;
739
- outline: none;
740
- margin-right: -40px;
741
- -webkit-overflow-scrolling: touch;
742
- overflow-x: hidden;
743
- }
744
-
745
- #scroller.notouchscroll {
746
- -webkit-overflow-scrolling: auto;
747
- }
748
-
749
- #scroller::-webkit-scrollbar {
750
- display: none;
751
- }
752
-
753
- .buffer {
754
- position: absolute;
755
- width: var(--vaadin-infinite-scroller-buffer-width, 100%);
756
- box-sizing: border-box;
757
- padding-right: 40px;
758
- top: var(--vaadin-infinite-scroller-buffer-offset, 0);
759
- animation: fadein 0.2s;
760
- }
761
-
762
- @keyframes fadein {
763
- from {
764
- opacity: 0;
765
- }
766
- to {
767
- opacity: 1;
768
- }
769
- }
770
- </style>
771
-
772
- <div id="scroller" on-scroll="_scroll">
773
- <div class="buffer"></div>
774
- <div class="buffer"></div>
775
- <div id="fullHeight"></div>
776
- </div>
777
- `}static get properties(){return{bufferSize:{type:Number,value:20},_initialScroll:{value:5e5},_initialIndex:{value:0},_buffers:Array,_preventScrollEvent:Boolean,_mayHaveMomentum:Boolean,_initialized:Boolean,active:{type:Boolean,observer:"_activated"}}}get bufferOffset(){return this._buffers[0].offsetTop}get itemHeight(){if(!this._itemHeightVal){const e=getComputedStyle(this).getPropertyValue("--vaadin-infinite-scroller-item-height"),t="background-position";this.$.fullHeight.style.setProperty(t,e);const s=getComputedStyle(this.$.fullHeight).getPropertyValue(t);this.$.fullHeight.style.removeProperty(t),this._itemHeightVal=parseFloat(s)}return this._itemHeightVal}get _bufferHeight(){return this.itemHeight*this.bufferSize}get position(){return(this.$.scroller.scrollTop-this._buffers[0].translateY)/this.itemHeight+this._firstIndex}set position(e){this._preventScrollEvent=!0,e>this._firstIndex&&e<this._firstIndex+2*this.bufferSize?this.$.scroller.scrollTop=this.itemHeight*(e-this._firstIndex)+this._buffers[0].translateY:(this._initialIndex=~~e,this._reset(),this._scrollDisabled=!0,this.$.scroller.scrollTop+=e%1*this.itemHeight,this._scrollDisabled=!1),this._mayHaveMomentum&&(this.$.scroller.classList.add("notouchscroll"),this._mayHaveMomentum=!1,setTimeout((()=>{this.$.scroller.classList.remove("notouchscroll")}),10))}ready(){super.ready(),this._buffers=[...this.shadowRoot.querySelectorAll(".buffer")],this.$.fullHeight.style.height=2*this._initialScroll+"px",p&&(this.$.scroller.tabIndex=-1)}forceUpdate(){this._debouncerUpdateClones&&(this._buffers[0].updated=this._buffers[1].updated=!1,this._updateClones(),this._debouncerUpdateClones.cancel())}_createElement(){}_updateElement(e,t){}_activated(e){e&&!this._initialized&&(this._createPool(),this._initialized=!0)}_finishInit(){this._initDone||(this._buffers.forEach((e=>{[...e.children].forEach((e=>{this._ensureStampedInstance(e._itemWrapper)}))})),this._buffers[0].translateY||this._reset(),this._initDone=!0,this.dispatchEvent(new CustomEvent("init-done")))}_translateBuffer(e){const t=e?1:0;this._buffers[t].translateY=this._buffers[t?0:1].translateY+this._bufferHeight*(t?-1:1),this._buffers[t].style.transform=`translate3d(0, ${this._buffers[t].translateY}px, 0)`,this._buffers[t].updated=!1,this._buffers.reverse()}_scroll(){if(this._scrollDisabled)return;const e=this.$.scroller.scrollTop;(e<this._bufferHeight||e>2*this._initialScroll-this._bufferHeight)&&(this._initialIndex=~~this.position,this._reset());const t=this.itemHeight+this.bufferOffset,s=e>this._buffers[1].translateY+t,i=e<this._buffers[0].translateY+t;(s||i)&&(this._translateBuffer(i),this._updateClones()),this._preventScrollEvent||(this.dispatchEvent(new CustomEvent("custom-scroll",{bubbles:!1,composed:!0})),this._mayHaveMomentum=!0),this._preventScrollEvent=!1,this._debouncerScrollFinish=be.dx.debounce(this._debouncerScrollFinish,ve.Wc.after(200),(()=>{const e=this.$.scroller.getBoundingClientRect();this._isVisible(this._buffers[0],e)||this._isVisible(this._buffers[1],e)||(this.position=this.position)}))}_reset(){this._scrollDisabled=!0,this.$.scroller.scrollTop=this._initialScroll,this._buffers[0].translateY=this._initialScroll-this._bufferHeight,this._buffers[1].translateY=this._initialScroll,this._buffers.forEach((e=>{e.style.transform=`translate3d(0, ${e.translateY}px, 0)`})),this._buffers[0].updated=this._buffers[1].updated=!1,this._updateClones(!0),this._debouncerUpdateClones=be.dx.debounce(this._debouncerUpdateClones,ve.Wc.after(200),(()=>{this._buffers[0].updated=this._buffers[1].updated=!1,this._updateClones()})),this._scrollDisabled=!1}_createPool(){const e=this.getBoundingClientRect();this._buffers.forEach((t=>{for(let s=0;s<this.bufferSize;s++){const s=document.createElement("div");s.style.height=`${this.itemHeight}px`,s.instance={};const i=`vaadin-infinite-scroller-item-content-${(0,De.l)()}`,o=document.createElement("slot");o.setAttribute("name",i),o._itemWrapper=s,t.appendChild(o),s.setAttribute("slot",i),this.appendChild(s),this._isVisible(s,e)&&this._ensureStampedInstance(s)}})),d(this,(()=>{this._finishInit()}))}_ensureStampedInstance(e){if(e.firstElementChild)return;const t=e.instance;e.instance=this._createElement(),e.appendChild(e.instance),Object.keys(t).forEach((s=>{e.instance.set(s,t[s])}))}_updateClones(e){this._firstIndex=~~((this._buffers[0].translateY-this._initialScroll)/this.itemHeight)+this._initialIndex;const t=e?this.$.scroller.getBoundingClientRect():void 0;this._buffers.forEach(((s,i)=>{if(!s.updated){const o=this._firstIndex+this.bufferSize*i;[...s.children].forEach(((s,i)=>{const n=s._itemWrapper;e&&!this._isVisible(n,t)||this._updateElement(n.instance,o+i)})),s.updated=!0}}))}_isVisible(e,t){const s=e.getBoundingClientRect();return s.bottom>t.top&&s.top<t.bottom}}const Ce=ge.d`
778
- <style>
779
- :host {
780
- --vaadin-infinite-scroller-item-height: 270px;
781
- position: absolute;
782
- top: 0;
783
- left: 0;
784
- right: 0;
785
- bottom: 0;
786
- height: 100%;
787
- }
788
- </style>
789
- `;let ke;class xe extends we{static get is(){return"vaadin-date-picker-month-scroller"}static get template(){return ke||(ke=super.template.cloneNode(!0),ke.content.appendChild(Ce.content.cloneNode(!0))),ke}static get properties(){return{bufferSize:{type:Number,value:3}}}_createElement(){return document.createElement("vaadin-month-calendar")}_updateElement(e,t){e.month=me(t)}}customElements.define(xe.is,xe);const Ee=ge.d`
790
- <style>
791
- :host {
792
- --vaadin-infinite-scroller-item-height: 80px;
793
- width: 50px;
794
- display: block;
795
- height: 100%;
796
- position: absolute;
797
- right: 0;
798
- transform: translateX(100%);
799
- -webkit-tap-highlight-color: transparent;
800
- -webkit-user-select: none;
801
- -moz-user-select: none;
802
- user-select: none;
803
- /* Center the year scroller position. */
804
- --vaadin-infinite-scroller-buffer-offset: 50%;
805
- }
806
-
807
- :host::before {
808
- content: '';
809
- display: block;
810
- background: transparent;
811
- width: 0;
812
- height: 0;
813
- position: absolute;
814
- left: 0;
815
- top: 50%;
816
- transform: translateY(-50%);
817
- border-width: 6px;
818
- border-style: solid;
819
- border-color: transparent;
820
- border-left-color: #000;
821
- }
822
- </style>
823
- `;let Se;class Te extends we{static get is(){return"vaadin-date-picker-year-scroller"}static get template(){return Se||(Se=super.template.cloneNode(!0),Se.content.appendChild(Ee.content.cloneNode(!0))),Se}static get properties(){return{bufferSize:{type:Number,value:12}}}_createElement(){return document.createElement("vaadin-date-picker-year")}_updateElement(e,t){e.year=this._yearAfterXYears(t)}_yearAfterXYears(e){const t=new Date,s=new Date(t);return s.setFullYear(parseInt(e)+t.getFullYear()),s.getFullYear()}}customElements.define(Te.is,Te);class Pe extends((0,i.Tb)(c.H3)){static get is(){return"vaadin-date-picker-year"}static get template(){return c.dy`
824
- <style>
825
- :host {
826
- display: block;
827
- height: 100%;
828
- }
829
- </style>
830
- <div part="year-number">[[year]]</div>
831
- <div part="year-separator" aria-hidden="true"></div>
832
- `}static get properties(){return{year:{type:String},selectedDate:{type:Object}}}static get observers(){return["__updateSelected(year, selectedDate)"]}__updateSelected(e,t){this.toggleAttribute("selected",t&&t.getFullYear()===e),this.toggleAttribute("current",e===(new Date).getFullYear())}}customElements.define(Pe.is,Pe);class Ie{constructor(e,t){this.query=e,this.callback=t,this._boundQueryHandler=this._queryHandler.bind(this)}hostConnected(){this._removeListener(),this._mediaQuery=window.matchMedia(this.query),this._addListener(),this._queryHandler(this._mediaQuery)}hostDisconnected(){this._removeListener()}_addListener(){this._mediaQuery&&this._mediaQuery.addListener(this._boundQueryHandler)}_removeListener(){this._mediaQuery&&this._mediaQuery.removeListener(this._boundQueryHandler),this._mediaQuery=null}_queryHandler(e){"function"==typeof this.callback&&this.callback(e.matches)}}var Ae=s(4271);class Oe extends((0,y.k)((0,i.Tb)((0,g.U)(c.H3)))){static get template(){return c.dy`
833
- <style>
834
- :host {
835
- display: flex;
836
- flex-direction: column;
837
- height: 100%;
838
- width: 100%;
839
- outline: none;
840
- }
841
-
842
- [part='overlay-header'] {
843
- display: flex;
844
- flex-shrink: 0;
845
- flex-wrap: nowrap;
846
- align-items: center;
847
- }
848
-
849
- :host(:not([fullscreen])) [part='overlay-header'] {
850
- display: none;
851
- }
852
-
853
- [part='label'] {
854
- flex-grow: 1;
855
- }
856
-
857
- [hidden] {
858
- display: none !important;
859
- }
860
-
861
- [part='years-toggle-button'] {
862
- display: flex;
863
- }
864
-
865
- #scrollers {
866
- display: flex;
867
- height: 100%;
868
- width: 100%;
869
- position: relative;
870
- overflow: hidden;
871
- }
872
-
873
- :host([desktop]) ::slotted([slot='months']) {
874
- right: 50px;
875
- transform: none !important;
876
- }
877
-
878
- :host([desktop]) ::slotted([slot='years']) {
879
- transform: none !important;
880
- }
881
-
882
- :host(.animate) ::slotted([slot='months']),
883
- :host(.animate) ::slotted([slot='years']) {
884
- transition: all 200ms;
885
- }
886
-
887
- [part='toolbar'] {
888
- display: flex;
889
- justify-content: space-between;
890
- z-index: 2;
891
- flex-shrink: 0;
892
- }
893
- </style>
894
-
895
- <div part="overlay-header" on-touchend="_preventDefault" aria-hidden="true">
896
- <div part="label">[[_formatDisplayed(selectedDate, i18n.formatDate, label)]]</div>
897
- <div part="clear-button" hidden$="[[!selectedDate]]"></div>
898
- <div part="toggle-button"></div>
899
-
900
- <div part="years-toggle-button" hidden$="[[_desktopMode]]" aria-hidden="true">
901
- [[_yearAfterXMonths(_visibleMonthIndex)]]
902
- </div>
903
- </div>
904
-
905
- <div id="scrollers">
906
- <slot name="months"></slot>
907
- <slot name="years"></slot>
908
- </div>
909
-
910
- <div on-touchend="_preventDefault" role="toolbar" part="toolbar">
911
- <slot name="today-button"></slot>
912
- <slot name="cancel-button"></slot>
913
- </div>
914
- `}static get is(){return"vaadin-date-picker-overlay-content"}static get properties(){return{scrollDuration:{type:Number,value:300},selectedDate:{type:Date,value:null},focusedDate:{type:Date,notify:!0,observer:"_focusedDateChanged"},_focusedMonthDate:Number,initialPosition:{type:Date,observer:"_initialPositionChanged"},_originDate:{value:new Date},_visibleMonthIndex:Number,_desktopMode:{type:Boolean,observer:"_desktopModeChanged"},_desktopMediaQuery:{type:String,value:"(min-width: 375px)"},_translateX:{observer:"_translateXChanged"},_yearScrollerWidth:{value:50},i18n:{type:Object},showWeekNumbers:{type:Boolean,value:!1},_ignoreTaps:Boolean,_notTapping:Boolean,minDate:Date,maxDate:Date,label:String,_cancelButton:{type:Object},_todayButton:{type:Object},calendars:{type:Array,value:()=>[]},years:{type:Array,value:()=>[]}}}static get observers(){return["__updateCalendars(calendars, i18n, minDate, maxDate, selectedDate, focusedDate, showWeekNumbers, _ignoreTaps, _theme)","__updateCancelButton(_cancelButton, i18n)","__updateTodayButton(_todayButton, i18n, minDate, maxDate)","__updateYears(years, selectedDate, _theme)"]}get __useSubMonthScrolling(){return this._monthScroller.clientHeight<this._monthScroller.itemHeight+this._monthScroller.bufferOffset}get focusableDateElement(){return this.calendars.map((e=>e.focusableDateElement)).find(Boolean)}ready(){super.ready(),this.setAttribute("role","dialog"),(0,de.NH)(this.$.scrollers,"track",this._track.bind(this)),(0,de.NH)(this.shadowRoot.querySelector('[part="clear-button"]'),"tap",this._clear.bind(this)),(0,de.NH)(this.shadowRoot.querySelector('[part="toggle-button"]'),"tap",this._cancel.bind(this)),(0,de.NH)(this.shadowRoot.querySelector('[part="years-toggle-button"]'),"tap",this._toggleYearScroller.bind(this)),this.addController(new Ie(this._desktopMediaQuery,(e=>{this._desktopMode=e}))),this.addController(new Ae.n(this,"today-button","vaadin-button",{observe:!1,initializer:e=>{e.setAttribute("theme","tertiary"),e.addEventListener("keydown",(e=>this.__onTodayButtonKeyDown(e))),(0,de.NH)(e,"tap",this._onTodayTap.bind(this)),this._todayButton=e}})),this.addController(new Ae.n(this,"cancel-button","vaadin-button",{observe:!1,initializer:e=>{e.setAttribute("theme","tertiary"),e.addEventListener("keydown",(e=>this.__onCancelButtonKeyDown(e))),(0,de.NH)(e,"tap",this._cancel.bind(this)),this._cancelButton=e}})),this.__initMonthScroller(),this.__initYearScroller()}connectedCallback(){super.connectedCallback(),this._closeYearScroller(),this._toggleAnimateClass(!0),(0,de.BP)(this.$.scrollers,"pan-y")}focusCancel(){this._cancelButton.focus()}scrollToDate(e,t){const s=this.__useSubMonthScrolling?this._calculateWeekScrollOffset(e):0;this._scrollToPosition(this._differenceInMonths(e,this._originDate)+s,t),this._monthScroller.forceUpdate()}__initMonthScroller(){this.addController(new Ae.n(this,"months","vaadin-date-picker-month-scroller",{observe:!1,initializer:e=>{e.addEventListener("custom-scroll",(()=>{this._onMonthScroll()})),e.addEventListener("touchstart",(()=>{this._onMonthScrollTouchStart()})),e.addEventListener("keydown",(e=>{this.__onMonthCalendarKeyDown(e)})),e.addEventListener("init-done",(()=>{const e=[...this.querySelectorAll("vaadin-month-calendar")];e.forEach((e=>{e.addEventListener("selected-date-changed",(e=>{this.selectedDate=e.detail.value}))})),this.calendars=e})),this._monthScroller=e}}))}__initYearScroller(){this.addController(new Ae.n(this,"years","vaadin-date-picker-year-scroller",{observe:!1,initializer:e=>{e.setAttribute("aria-hidden","true"),(0,de.NH)(e,"tap",(e=>{this._onYearTap(e)})),e.addEventListener("custom-scroll",(()=>{this._onYearScroll()})),e.addEventListener("touchstart",(()=>{this._onYearScrollTouchStart()})),e.addEventListener("init-done",(()=>{this.years=[...this.querySelectorAll("vaadin-date-picker-year")]})),this._yearScroller=e}}))}__updateCancelButton(e,t){e&&(e.textContent=t&&t.cancel)}__updateTodayButton(e,t,s,i){e&&(e.textContent=t&&t.today,e.disabled=!this._isTodayAllowed(s,i))}__updateCalendars(e,t,s,i,o,n,a,r,l){e&&e.length&&e.forEach((e=>{e.setProperties({i18n:t,minDate:s,maxDate:i,focusedDate:n,selectedDate:o,showWeekNumbers:a,ignoreTaps:r}),l?e.setAttribute("theme",l):e.removeAttribute("theme")}))}__updateYears(e,t,s){e&&e.length&&e.forEach((e=>{e.selectedDate=t,s?e.setAttribute("theme",s):e.removeAttribute("theme")}))}_selectDate(e){this.selectedDate=e,this.dispatchEvent(new CustomEvent("date-selected",{detail:{date:e},bubbles:!0,composed:!0}))}_desktopModeChanged(e){this.toggleAttribute("desktop",e)}_focusedDateChanged(e){this.revealDate(e)}revealDate(e,t=!0){if(!e)return;const s=this._differenceInMonths(e,this._originDate);if(this.__useSubMonthScrolling){const i=this._calculateWeekScrollOffset(e);return void this._scrollToPosition(s+i,t)}const i=this._monthScroller.position>s,o=Math.max(this._monthScroller.itemHeight,this._monthScroller.clientHeight-2*this._monthScroller.bufferOffset)/this._monthScroller.itemHeight,n=this._monthScroller.position+o-1<s;i?this._scrollToPosition(s,t):n&&this._scrollToPosition(s-o+1,t)}_calculateWeekScrollOffset(e){const t=new Date(0,0);t.setFullYear(e.getFullYear()),t.setMonth(e.getMonth()),t.setDate(1);let s=0;for(;t.getDate()<e.getDate();)t.setDate(t.getDate()+1),t.getDay()===this.i18n.firstDayOfWeek&&(s+=1);return s/6}_initialPositionChanged(e){this._monthScroller&&this._yearScroller&&(this._monthScroller.active=!0,this._yearScroller.active=!0),this.scrollToDate(e)}_repositionYearScroller(){const e=this._monthScroller.position;this._visibleMonthIndex=Math.floor(e),this._yearScroller.position=(e+this._originDate.getMonth())/12}_repositionMonthScroller(){this._monthScroller.position=12*this._yearScroller.position-this._originDate.getMonth(),this._visibleMonthIndex=Math.floor(this._monthScroller.position)}_onMonthScroll(){this._repositionYearScroller(),this._doIgnoreTaps()}_onYearScroll(){this._repositionMonthScroller(),this._doIgnoreTaps()}_onYearScrollTouchStart(){this._notTapping=!1,setTimeout((()=>{this._notTapping=!0}),300),this._repositionMonthScroller()}_onMonthScrollTouchStart(){this._repositionYearScroller()}_doIgnoreTaps(){this._ignoreTaps=!0,this._debouncer=be.dx.debounce(this._debouncer,ve.Wc.after(300),(()=>{this._ignoreTaps=!1}))}_formatDisplayed(e,t,s){return e?t(pe(e)):s}_onTodayTap(){const e=new Date;Math.abs(this._monthScroller.position-this._differenceInMonths(e,this._originDate))<.001?(this._selectDate(e),this._close()):this._scrollToCurrentMonth()}_scrollToCurrentMonth(){this.focusedDate&&(this.focusedDate=new Date),this.scrollToDate(new Date,!0)}_onYearTap(e){if(!this._ignoreTaps&&!this._notTapping){const t=(e.detail.y-(this._yearScroller.getBoundingClientRect().top+this._yearScroller.clientHeight/2))/this._yearScroller.itemHeight;this._scrollToPosition(this._monthScroller.position+12*t,!0)}}_scrollToPosition(e,t){if(void 0!==this._targetPosition)return void(this._targetPosition=e);if(!t)return this._monthScroller.position=e,this._targetPosition=void 0,this._repositionYearScroller(),void this.__tryFocusDate();let s;this._targetPosition=e,this._revealPromise=new Promise((e=>{s=e}));let i=0;const o=this._monthScroller.position,n=e=>{i||(i=e);const t=e-i;if(t<this.scrollDuration){const e=(a=t,r=o,l=this._targetPosition-o,(a/=this.scrollDuration/2)<1?l/2*a*a+r:-l/2*((a-=1)*(a-2)-1)+r);this._monthScroller.position=e,window.requestAnimationFrame(n)}else this.dispatchEvent(new CustomEvent("scroll-animation-finished",{bubbles:!0,composed:!0,detail:{position:this._targetPosition,oldPosition:o}})),this._monthScroller.position=this._targetPosition,this._targetPosition=void 0,s(),this._revealPromise=void 0;var a,r,l;setTimeout(this._repositionYearScroller.bind(this),1)};window.requestAnimationFrame(n)}_limit(e,t){return Math.min(t.max,Math.max(t.min,e))}_handleTrack(e){if(Math.abs(e.detail.dx)<10||Math.abs(e.detail.ddy)>10)return;Math.abs(e.detail.ddx)>this._yearScrollerWidth/3&&this._toggleAnimateClass(!0);const t=this._translateX+e.detail.ddx;this._translateX=this._limit(t,{min:0,max:this._yearScrollerWidth})}_track(e){if(!this._desktopMode)switch(e.detail.state){case"start":this._toggleAnimateClass(!1);break;case"track":this._handleTrack(e);break;case"end":this._toggleAnimateClass(!0),this._translateX>=this._yearScrollerWidth/2?this._closeYearScroller():this._openYearScroller()}}_toggleAnimateClass(e){e?this.classList.add("animate"):this.classList.remove("animate")}_toggleYearScroller(){this._isYearScrollerVisible()?this._closeYearScroller():this._openYearScroller()}_openYearScroller(){this._translateX=0,this.setAttribute("years-visible","")}_closeYearScroller(){this.removeAttribute("years-visible"),this._translateX=this._yearScrollerWidth}_isYearScrollerVisible(){return this._translateX<this._yearScrollerWidth/2}_translateXChanged(e){this._desktopMode||(this._monthScroller.style.transform=`translateX(${e-this._yearScrollerWidth}px)`,this._yearScroller.style.transform=`translateX(${e}px)`)}_yearAfterXMonths(e){return me(e).getFullYear()}_differenceInMonths(e,t){return 12*(e.getFullYear()-t.getFullYear())-t.getMonth()+e.getMonth()}_clear(){this._selectDate("")}_close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}_cancel(){this.focusedDate=this.selectedDate,this._close()}_preventDefault(e){e.preventDefault()}__toggleDate(e){ce(e,this.selectedDate)?(this._clear(),this.focusedDate=e):this._selectDate(e)}__onMonthCalendarKeyDown(e){let t=!1;switch(e.key){case"ArrowDown":this._moveFocusByDays(7),t=!0;break;case"ArrowUp":this._moveFocusByDays(-7),t=!0;break;case"ArrowRight":this._moveFocusByDays(this.__isRTL?-1:1),t=!0;break;case"ArrowLeft":this._moveFocusByDays(this.__isRTL?1:-1),t=!0;break;case"Enter":this._selectDate(this.focusedDate),this._close(),t=!0;break;case" ":this.__toggleDate(this.focusedDate),t=!0;break;case"Home":this._moveFocusInsideMonth(this.focusedDate,"minDate"),t=!0;break;case"End":this._moveFocusInsideMonth(this.focusedDate,"maxDate"),t=!0;break;case"PageDown":this._moveFocusByMonths(e.shiftKey?12:1),t=!0;break;case"PageUp":this._moveFocusByMonths(e.shiftKey?-12:-1),t=!0;break;case"Tab":this._onTabKeyDown(e,"calendar")}t&&(e.preventDefault(),e.stopPropagation())}_onTabKeyDown(e,t){switch(e.stopPropagation(),t){case"calendar":e.shiftKey&&(e.preventDefault(),this.hasAttribute("fullscreen")?this.focusCancel():this.__focusInput());break;case"today":e.shiftKey&&(e.preventDefault(),this.focusDateElement());break;case"cancel":e.shiftKey||(e.preventDefault(),this.hasAttribute("fullscreen")?this.focusDateElement():this.__focusInput())}}__onTodayButtonKeyDown(e){"Tab"===e.key&&this._onTabKeyDown(e,"today")}__onCancelButtonKeyDown(e){"Tab"===e.key&&this._onTabKeyDown(e,"cancel")}__focusInput(){this.dispatchEvent(new CustomEvent("focus-input",{bubbles:!0,composed:!0}))}__tryFocusDate(){if(this.__pendingDateFocus){const e=this.focusableDateElement;e&&ce(e.date,this.__pendingDateFocus)&&(delete this.__pendingDateFocus,e.focus())}}async focusDate(e,t){const s=e||this.selectedDate||this.initialPosition||new Date;this.focusedDate=s,t||(this._focusedMonthDate=s.getDate()),await this.focusDateElement(!1)}async focusDateElement(e=!0){this.__pendingDateFocus=this.focusedDate,this.calendars.length||await new Promise((e=>{d(this,(()=>{oe(),e()}))})),e&&this.revealDate(this.focusedDate),this._revealPromise&&await this._revealPromise,this.__tryFocusDate()}_focusClosestDate(e){this.focusDate(_e(e,[this.minDate,this.maxDate]))}_focusAllowedDate(e,t,s){this._dateAllowed(e)?this.focusDate(e,s):this._dateAllowed(this.focusedDate)?t>0?this.focusDate(this.maxDate):this.focusDate(this.minDate):this._focusClosestDate(this.focusedDate)}_getDateDiff(e,t){const s=new Date(0,0);return s.setFullYear(this.focusedDate.getFullYear()),s.setMonth(this.focusedDate.getMonth()+e),t&&s.setDate(this.focusedDate.getDate()+t),s}_moveFocusByDays(e){const t=this._getDateDiff(0,e);this._focusAllowedDate(t,e,!1)}_moveFocusByMonths(e){const t=this._getDateDiff(e),s=t.getMonth();this._focusedMonthDate||(this._focusedMonthDate=this.focusedDate.getDate()),t.setDate(this._focusedMonthDate),t.getMonth()!==s&&t.setDate(0),this._focusAllowedDate(t,e,!0)}_moveFocusInsideMonth(e,t){const s=new Date(0,0);s.setFullYear(e.getFullYear()),"minDate"===t?(s.setMonth(e.getMonth()),s.setDate(1)):(s.setMonth(e.getMonth()+1),s.setDate(0)),this._dateAllowed(s)?this.focusDate(s):this._dateAllowed(e)?this.focusDate(this[t]):this._focusClosestDate(e)}_dateAllowed(e,t=this.minDate,s=this.maxDate){return(!t||e>=t)&&(!s||e<=s)}_isTodayAllowed(e,t){const s=new Date,i=new Date(0,0);return i.setFullYear(s.getFullYear()),i.setMonth(s.getMonth()),i.setDate(s.getDate()),this._dateAllowed(i,e,t)}}customElements.define(Oe.is,Oe);var Me=s(1402),Fe=s(4463),He=s(2006),Le=s(3208),ze=s(6729),Ne=s(2743),Be=s(6634),Ye=s(602);const $e=e=>class extends e{static get properties(){return{overlayClass:{type:String},_overlayElement:{type:Object}}}static get observers(){return["__updateOverlayClassNames(overlayClass, _overlayElement)"]}__updateOverlayClassNames(e,t){if(!t)return;if(void 0===e)return;const{classList:s}=t;if(this.__initialClasses||(this.__initialClasses=new Set(s)),Array.isArray(this.__previousClasses)){const e=this.__previousClasses.filter((e=>!this.__initialClasses.has(e)));e.length>0&&s.remove(...e)}const i="string"==typeof e?e.split(" "):[];i.length>0&&s.add(...i),this.__previousClasses=i}};var Ve=s(9091);class Re{constructor(e){this.host=e,e.addEventListener("opened-changed",(()=>{e.opened||this.__setVirtualKeyboardEnabled(!1)})),e.addEventListener("blur",(()=>this.__setVirtualKeyboardEnabled(!0))),e.addEventListener("touchstart",(()=>this.__setVirtualKeyboardEnabled(!0)))}__setVirtualKeyboardEnabled(e){this.host.inputElement&&(this.host.inputElement.inputMode=e?"":"none")}}const We=e=>class extends($e((0,y.k)((0,Be.B)((0,Ve.t)((0,Ye.L)(e)))))){static get properties(){return{_selectedDate:{type:Date},_focusedDate:Date,value:{type:String,notify:!0,value:""},initialPosition:String,opened:{type:Boolean,reflectToAttribute:!0,notify:!0,observer:"_openedChanged"},autoOpenDisabled:Boolean,showWeekNumbers:{type:Boolean,value:!1},_fullscreen:{type:Boolean,value:!1},_fullscreenMediaQuery:{value:"(max-width: 420px), (max-height: 420px)"},i18n:{type:Object,value:()=>({monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],weekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],firstDayOfWeek:0,today:"Today",cancel:"Cancel",referenceDate:"",formatDate(e){const t=String(e.year).replace(/\d+/u,(e=>"0000".substr(e.length)+e));return[e.month+1,e.day,t].join("/")},parseDate(e){const t=e.split("/"),s=new Date;let i,o=s.getMonth(),n=s.getFullYear();if(3===t.length?(o=parseInt(t[0])-1,i=parseInt(t[1]),n=parseInt(t[2]),t[2].length<3&&n>=0&&(n=function(e,t,s=0,i=1){if(t>99)throw new Error("The provided year cannot have more than 2 digits.");if(t<0)throw new Error("The provided year cannot be negative.");let o=t+100*Math.floor(e.getFullYear()/100);return e<new Date(o-50,s,i)?o-=100:e>new Date(o+50,s,i)&&(o+=100),o}(this.referenceDate?fe(this.referenceDate):new Date,n,o,i))):2===t.length?(o=parseInt(t[0])-1,i=parseInt(t[1])):1===t.length&&(i=parseInt(t[0])),void 0!==i)return{day:i,month:o,year:n}},formatTitle:(e,t)=>`${e} ${t}`})},min:{type:String},max:{type:String},_minDate:{type:Date,computed:"__computeMinOrMaxDate(min)"},_maxDate:{type:Date,computed:"__computeMinOrMaxDate(max)"},_noInput:{type:Boolean,computed:"_isNoInput(inputElement, _fullscreen, _ios, i18n, opened, autoOpenDisabled)"},_ios:{type:Boolean,value:f},_focusOverlayOnOpen:Boolean,_overlayContent:Object,_hasInputValue:{type:Boolean}}}static get observers(){return["_selectedDateChanged(_selectedDate, i18n.formatDate)","_focusedDateChanged(_focusedDate, i18n.formatDate)","__updateOverlayContent(_overlayContent, i18n, label, _minDate, _maxDate, _focusedDate, _selectedDate, showWeekNumbers)","__updateOverlayContentTheme(_overlayContent, _theme)","__updateOverlayContentFullScreen(_overlayContent, _fullscreen)"]}static get constraints(){return[...super.constraints,"min","max"]}constructor(){super(),this._boundOnClick=this._onClick.bind(this),this._boundOnScroll=this._onScroll.bind(this),this._boundOverlayRenderer=this._overlayRenderer.bind(this)}get _inputElementValue(){return super._inputElementValue}set _inputElementValue(e){super._inputElementValue=e,this._hasInputValue=!1}get clearElement(){return null}get _nativeInput(){return this.inputElement?this.inputElement.focusElement||this.inputElement:null}_onFocus(e){super._onFocus(e),this._noInput&&e.target.blur()}_onBlur(e){super._onBlur(e),this.opened||(this.autoOpenDisabled&&this._selectParsedOrFocusedDate(),this.validate(),""===this._inputElementValue&&""!==this.value&&(this.value=""))}ready(){super.ready(),this.addEventListener("click",this._boundOnClick),this.addController(new Ie(this._fullscreenMediaQuery,(e=>{this._fullscreen=e}))),this.addController(new Re(this));const e=this.$.overlay;this._overlayElement=e,e.renderer=this._boundOverlayRenderer,this.addEventListener("mousedown",(()=>this.__bringToFront())),this.addEventListener("touchstart",(()=>this.__bringToFront()))}disconnectedCallback(){super.disconnectedCallback(),this.opened=!1}_propertiesChanged(e,t,s){super._propertiesChanged(e,t,s),"value"in t&&this.__dispatchChange&&(this.dispatchEvent(new CustomEvent("change",{bubbles:!0})),this.__dispatchChange=!1)}open(){this.disabled||this.readonly||(this.opened=!0)}close(){this.$.overlay.close()}_overlayRenderer(e){if(e.firstChild)return;const t=document.createElement("vaadin-date-picker-overlay-content");e.appendChild(t),this._overlayContent=t,t.addEventListener("close",(()=>{this._close()})),t.addEventListener("focus-input",this._focusAndSelect.bind(this)),t.addEventListener("date-tap",(e=>{this.__userConfirmedDate=!0,this._selectDate(e.detail.date),this._close()})),t.addEventListener("date-selected",(e=>{this.__userConfirmedDate=!!e.detail.date,this._selectDate(e.detail.date)})),t.addEventListener("focusin",(()=>{this._keyboardActive&&this._setFocused(!0)})),t.addEventListener("focused-date-changed",(e=>{this._focusedDate=e.detail.value}))}checkValidity(){const e=this._inputElementValue,t=!e||!!this._selectedDate&&e===this._getFormattedDate(this.i18n.formatDate,this._selectedDate),s=!this._selectedDate||ue(this._selectedDate,this._minDate,this._maxDate);let i=!0;return this.inputElement&&(this.inputElement.checkValidity?i=this.inputElement.checkValidity():this.inputElement.validate&&(i=this.inputElement.validate())),t&&s&&i}_shouldSetFocus(e){return!this._shouldKeepFocusRing}_shouldRemoveFocus(e){return!this.opened}_setFocused(e){super._setFocused(e),this._shouldKeepFocusRing=e&&this._keyboardActive}_selectDate(e){const t=this._formatISO(e);this.value!==t&&(this.__dispatchChange=!0),this._selectedDate=e}_close(){this._focus(),this.close()}__bringToFront(){requestAnimationFrame((()=>{this.$.overlay.bringToFront()}))}_isNoInput(e,t,s,i,o,n){return!e||t&&(!n||o)||s&&o||!i.parseDate}_formatISO(e){if(!(e instanceof Date))return"";const t=(e,t="00")=>(t+e).substr((t+e).length-t.length);let s="",i="0000",o=e.getFullYear();return o<0?(o=-o,s="-",i="000000"):e.getFullYear()>=1e4&&(s="+",i="000000"),[s+t(o,i),t(e.getMonth()+1),t(e.getDate())].join("-")}_inputElementChanged(e){super._inputElementChanged(e),e&&(e.autocomplete="off",e.setAttribute("role","combobox"),e.setAttribute("aria-haspopup","dialog"),e.setAttribute("aria-expanded",!!this.opened),this._applyInputValue(this._selectedDate))}_openedChanged(e){this.inputElement&&this.inputElement.setAttribute("aria-expanded",e)}_selectedDateChanged(e,t){if(void 0===e||void 0===t)return;const s=this._formatISO(e);this.__keepInputValue||this._applyInputValue(e),s!==this.value&&(this.validate(),this.value=s),this._ignoreFocusedDateChange=!0,this._focusedDate=e,this._ignoreFocusedDateChange=!1}_focusedDateChanged(e,t){void 0!==e&&void 0!==t&&(this._ignoreFocusedDateChange||this._noInput||this._applyInputValue(e))}_valueChanged(e,t){const s=fe(e);!e||s?(e?ce(this._selectedDate,s)||(this._selectedDate=s,void 0!==t&&this.validate()):this._selectedDate=null,this._toggleHasValue(this._hasValue)):this.value=t}__updateOverlayContent(e,t,s,i,o,n,a,r){e&&e.setProperties({i18n:t,label:s,minDate:i,maxDate:o,focusedDate:n,selectedDate:a,showWeekNumbers:r})}__updateOverlayContentTheme(e,t){e&&(t?e.setAttribute("theme",t):e.removeAttribute("theme"))}__updateOverlayContentFullScreen(e,t){e&&e.toggleAttribute("fullscreen",t)}_onOverlayEscapePress(){this._focusedDate=this._selectedDate,this._close()}_onOverlayOpened(){const e=this._getInitialPosition();this._overlayContent.initialPosition=e;const t=this._overlayContent.focusedDate||e;this._overlayContent.scrollToDate(t),this._ignoreFocusedDateChange=!0,this._overlayContent.focusedDate=t,this._ignoreFocusedDateChange=!1,window.addEventListener("scroll",this._boundOnScroll,!0),this._focusOverlayOnOpen?(this._overlayContent.focusDateElement(),this._focusOverlayOnOpen=!1):this._focus(),this._noInput&&this.focusElement&&(this.focusElement.blur(),this._overlayContent.focusDateElement())}_getInitialPosition(){const e=fe(this.initialPosition),t=this._selectedDate||this._overlayContent.initialPosition||e||new Date;return e||ue(t,this._minDate,this._maxDate)?t:_e(t,[this._minDate,this._maxDate])}_selectParsedOrFocusedDate(){if(this._ignoreFocusedDateChange=!0,this.i18n.parseDate){const e=this._inputElementValue||"",t=this._getParsedDate(e);this._isValidDate(t)?this._selectDate(t):(this.__keepInputValue=!0,this._selectDate(null),this._selectedDate=null,this.__keepInputValue=!1)}else this._focusedDate&&this._selectDate(this._focusedDate);this._ignoreFocusedDateChange=!1}_onOverlayClosed(){window.removeEventListener("scroll",this._boundOnScroll,!0),this.__userConfirmedDate?this.__userConfirmedDate=!1:this._selectParsedOrFocusedDate(),this._nativeInput&&this._nativeInput.selectionStart&&(this._nativeInput.selectionStart=this._nativeInput.selectionEnd),this.value||this.validate()}_onScroll(e){e.target!==window&&this._overlayContent.contains(e.target)||this._overlayContent._repositionYearScroller()}_focus(){this._noInput||this.inputElement.focus()}_focusAndSelect(){this._focus(),this._setSelectionRange(0,this._inputElementValue.length)}_applyInputValue(e){this._inputElementValue=e?this._getFormattedDate(this.i18n.formatDate,e):""}_getFormattedDate(e,t){return e(pe(t))}_setSelectionRange(e,t){this._nativeInput&&this._nativeInput.setSelectionRange&&this._nativeInput.setSelectionRange(e,t)}_isValidDate(e){return e&&!isNaN(e.getTime())}_onChange(e){""===this._inputElementValue&&(this.__dispatchChange=!0),e.stopPropagation()}_onClick(e){this._isClearButton(e)||this._onHostClick(e)}_onHostClick(e){this.autoOpenDisabled&&!this._noInput||(e.preventDefault(),this.open())}_onClearButtonClick(e){e.preventDefault(),this._inputElementValue="",this.value="",this.validate(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0}))}_onKeyDown(e){switch(super._onKeyDown(e),this._noInput&&-1===[9].indexOf(e.keyCode)&&e.preventDefault(),e.key){case"ArrowDown":case"ArrowUp":e.preventDefault(),this.opened?this._overlayContent.focusDateElement():(this._focusOverlayOnOpen=!0,this.open());break;case"Tab":this.opened&&(e.preventDefault(),e.stopPropagation(),this._setSelectionRange(0,0),e.shiftKey?this._overlayContent.focusCancel():this._overlayContent.focusDateElement())}}_onEnter(e){const t=this.value;this.opened?this.close():this._selectParsedOrFocusedDate(),t===this.value&&this.validate()}_onEscape(e){if(!this.opened)return this.clearButtonVisible&&this.value?(e.stopPropagation(),void this._onClearButtonClick(e)):void(this.autoOpenDisabled?(""===this.inputElement.value&&this._selectDate(null),this._applyInputValue(this._selectedDate)):(this._focusedDate=this._selectedDate,this._selectParsedOrFocusedDate()))}_getParsedDate(e=this._inputElementValue){const t=this.i18n.parseDate&&this.i18n.parseDate(e);return t&&fe(`${t.year}-${t.month+1}-${t.day}`)}_isClearButton(e){return e.composedPath()[0]===this.clearElement}_onInput(){this.opened||!this.inputElement.value||this.autoOpenDisabled||this.open(),this._userInputValueChanged()}_userInputValueChanged(){if(this._inputElementValue){const e=this._getParsedDate();this._isValidDate(e)&&(this._ignoreFocusedDateChange=!0,ce(e,this._focusedDate)||(this._focusedDate=e),this._ignoreFocusedDateChange=!1)}}__computeMinOrMaxDate(e){return fe(e)}};(0,i.hC)("vaadin-date-picker",Ne.J,{moduleId:"vaadin-date-picker-styles"});class qe extends(We((0,He.L)((0,i.Tb)((0,Me.S)(c.H3))))){static get is(){return"vaadin-date-picker"}static get template(){return c.dy`
915
- <style>
916
- :host([opened]) {
917
- pointer-events: auto;
918
- }
919
-
920
- :host([dir='rtl']) [part='input-field'] {
921
- direction: ltr;
922
- }
923
-
924
- :host([dir='rtl']) [part='input-field'] ::slotted(input)::placeholder {
925
- direction: rtl;
926
- text-align: left;
927
- }
928
- </style>
929
-
930
- <div class="vaadin-date-picker-container">
931
- <div part="label">
932
- <slot name="label"></slot>
933
- <span part="required-indicator" aria-hidden="true" on-click="focus"></span>
934
- </div>
935
-
936
- <vaadin-input-container
937
- part="input-field"
938
- readonly="[[readonly]]"
939
- disabled="[[disabled]]"
940
- invalid="[[invalid]]"
941
- theme$="[[_theme]]"
942
- >
943
- <slot name="prefix" slot="prefix"></slot>
944
- <slot name="input"></slot>
945
- <div id="clearButton" part="clear-button" slot="suffix" aria-hidden="true"></div>
946
- <div part="toggle-button" slot="suffix" aria-hidden="true" on-click="_toggle"></div>
947
- </vaadin-input-container>
948
-
949
- <div part="helper-text">
950
- <slot name="helper"></slot>
951
- </div>
952
-
953
- <div part="error-message">
954
- <slot name="error-message"></slot>
955
- </div>
956
- </div>
957
-
958
- <vaadin-date-picker-overlay
959
- id="overlay"
960
- fullscreen$="[[_fullscreen]]"
961
- theme$="[[_theme]]"
962
- opened="{{opened}}"
963
- on-vaadin-overlay-escape-press="_onOverlayEscapePress"
964
- on-vaadin-overlay-open="_onOverlayOpened"
965
- on-vaadin-overlay-closing="_onOverlayClosed"
966
- restore-focus-on-close
967
- restore-focus-node="[[inputElement]]"
968
- ></vaadin-date-picker-overlay>
969
-
970
- <slot name="tooltip"></slot>
971
- `}get clearElement(){return this.$.clearButton}ready(){super.ready(),this.addController(new Le.b(this,(e=>{this._setInputElement(e),this._setFocusElement(e),this.stateTarget=e,this.ariaTarget=e}))),this.addController(new ze.v(this.inputElement,this._labelController)),this._tooltipController=new Fe.f(this),this.addController(this._tooltipController),this._tooltipController.setPosition("top"),this._tooltipController.setShouldShow((e=>!e.opened)),this.shadowRoot.querySelector('[part="toggle-button"]').addEventListener("mousedown",(e=>e.preventDefault())),this.$.overlay.addEventListener("vaadin-overlay-close",this._onVaadinOverlayClose.bind(this))}_onVaadinOverlayClose(e){e.detail.sourceEvent&&e.detail.sourceEvent.composedPath().includes(this)&&e.preventDefault()}_toggle(e){e.stopPropagation(),this.$.overlay.opened?this.close():this.open()}_openedChanged(e){super._openedChanged(e),this.$.overlay.positionTarget=this.shadowRoot.querySelector('[part="input-field"]'),this.$.overlay.noVerticalOverlap=!0}}customElements.define(qe.is,qe)}}]);