@nysds/nys-datepicker 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/nys-datepicker.js +1325 -0
- package/dist/nys-datepicker.js.map +1 -0
- package/package.json +47 -0
|
@@ -0,0 +1,1325 @@
|
|
|
1
|
+
import { LitElement as ze, unsafeCSS as je, html as O } from "lit";
|
|
2
|
+
import { property as g } from "lit/decorators.js";
|
|
3
|
+
import { ifDefined as A } from "lit/directives/if-defined.js";
|
|
4
|
+
const He = ':host{--_nys-datepicker-width: fit-content;--_nys-datepicker-input-width: var(--nys-form-width-md, 200px);--_nys-datepicker-gap: var(--nys-space-100, 8px);--_nys-datepicker-height: var(--nys-size-600, 48px);--_nys-datepicker-radius: var(--nys-radius-xl, 12px);--_nys-datepicker-color: var( --nys-color-text, var(--nys-color-neutral-900, #1b1b1b) );--_nys-datepicker-color-disabled: var(--nys-color-neutral-200, #bec0c1);--_nys-datepicker--row-gap: var(--nys-space-2-px, 2px);--_nys-datepicker-space-sm: var(--nys-space-50, 4px);--_nys-datepicker-space-md: var(--nys-space-100, 8px);--_nys-datepicker-space-lg: var(--nys-space-150, 12px);--_nys-datepicker-border-width: var(--nys-border-width-sm, 1px);--_nys-datepicker-border-color: var(--nys-color-neutral-400, #909395);--_nys-datepicker-border-radius: var(--nys-radius-md, 4px);--_nys-datepicker-outline-color--hover: var(--nys-color-neutral-900, #1b1b1b);--_nys-datepicker-outline-color--focus: var(--nys-color-focus, #004dd1);--_nys-datepicker-font-size: var(--nys-font-size-ui-md, 16px);--_nys-datepicker-font-weight: var(--nys-font-weight-regular, 400);--_nys-datepicker-line-height: var(--nys-font-lineheight-ui-md, 24px);--_nys-datepicker-letterspacing: var(--nys-font-letterspacing-ui-md, .044px);--_nys-datepicker-font-family: var( --nys-font-family-ui, var( --nys-font-family-sans, "Proxima Nova", "Helvetica Neue", "Helvetica", "Arial", sans-serif ) );--_nys-datepicker-text-color: var(--nys-color-text, #1b1b1b);--_nys-datepicker-text-disabled: var(--nys-color-text-disabled, #bec0c1);--_nys-datepicker-bg: var(--nys-color-ink-reverse, #fff);--_nys-datepicker--button-active-bg: var(--nys-color-gray-100, #d0d0ce);--_nys-datepicker--wc-padding: var(--nys-space-200, 16px);--_nys-datepicker--wc-weaker-color: var(--nys-color-text-weaker, #797c7f);--_nys-datepicker--date-font-size: var(--nys-type-size-ui-sm, 14px);--_nys-datepicker--date-hover-bg: var(--nys-color-neutral-50, #ededed);--_nys-datepicker--date-active-bg: var(--nys-color-neutral-100, #d0d0ce);--_nys-datepicker--date-selected-bg: var(--nys-color-info-weak, #e5effa);--_nys-datepicker--date-focus-ring: var(--nys-color-link, #004dd1);--_nys-datepicker--date-hover-color: var(--nys-color-text, #1b1b1b);--_nys-datepicker--date-default-color: var(--nys-color-text, #1b1b1b);--_nys-datepicker--date-selected-color: var(--nys-color-info, #004dd1);--_nys-datepicker--date-disabled-color: var( --nys-color-text-disabled, #bec0c1 );--_nys-datepicker--date-border-disabled: var( --nys-color-neutral-200, #bec0c1 );--_nys-datepicker--navigation-hover-background: var( --nys-color-neutral-10, #f6f6f6 );--_nys-datepicker--navigation-pressed-background: var( --nys-color-neutral-50, #ededed );--_nys-datepicker--navigation-disabled-background: var( --nys-color-neutral-10, #f6f6f6 );--_nys-datepicker--navigation-border: var(--_nys-datepicker-border-width) solid var(--_nys-datepicker-border-color);--_nys-datepicker--navigation-hover-border: var( --_nys-datepicker-border-width ) solid var(--nys-color-neutral-900, #1b1b1b);--_nys-datepicker--navigation-pressed-border: var( --_nys-datepicker-border-width ) solid var(--nys-color-neutral-900, #1b1b1b);--_nys-datepicker--navigation-disabled-border: var( --_nys-datepicker-border-width ) solid var(--nys-color-neutral-200, #bec0c1);--_nys-datepicker--navigation-box-shadow-border: inset 0 0 0 1px var(--nys-color-neutral-900, #1b1b1b)}:host([width=lg]){--_nys-datepicker-input-width: var(--nys-form-width-lg, 384px)}:host([width=full]){--_nys-datepicker-input-width: 100%}:host([showError]){--_nys-datepicker-border-color: var(--nys-color-danger, #b52c2c)}.nys-datepicker--container{display:flex;flex-direction:column;gap:var(--_nys-datepicker-space-sm);font-family:var(--_nys-datepicker-font-family);font-size:var(--_nys-datepicker-font-size);font-weight:var(--_nys-datepicker-font-weight);line-height:var(--_nys-datepicker-line-height);width:100%}.nys-datepicker--container .nys-datepicker--input-container{position:relative;width:var(--_nys-datepicker-input-width);display:flex;cursor:pointer}.nys-datepicker--container .nys-datepicker--input-container.disabled #calendar-button{cursor:not-allowed;color:var(--_nys-datepicker--date-disabled-color)}.nys-datepicker--container .nys-datepicker--input-container #nys-datepicker--input{cursor:text;text-align:start;font-family:var(--_nys-datepicker-font-family);font-size:var(--_nys-datepicker-font-size);flex:1;height:24px;outline-color:transparent;outline-width:1px;outline-style:solid;border-radius:var(--_nys-datepicker-border-radius);border:var(--_nys-datepicker-border-width) solid var(--_nys-datepicker-border-color);background:var(--_nys-datepicker-bg);padding:var(--_nys-datepicker-space-md) var(--_nys-datepicker-space-md) var(--_nys-datepicker-space-md) var(--_nys-datepicker-space-lg);color:var(--_nys-datepicker-color)}.nys-datepicker--container .nys-datepicker--input-container #nys-datepicker--input:hover{outline-color:var(--_nys-datepicker-outline-color--hover);border-color:var(--_nys-datepicker-outline-color--hover)}.nys-datepicker--container .nys-datepicker--input-container #nys-datepicker--input:focus{outline-color:var(--_nys-datepicker-outline-color--focus);border-color:var(--_nys-datepicker-outline-color--focus)}.nys-datepicker--container .nys-datepicker--input-container #nys-datepicker--input:disabled{border:var(--_nys-datepicker--navigation-disabled-border);cursor:not-allowed;color:var(--_nys-datepicker--wc-weaker-color)}.nys-datepicker--container .nys-datepicker--input-container #nys-datepicker--input::-webkit-date-and-time-value{text-align:start}.nys-datepicker--container .nys-datepicker--input-container input[type=date]::-webkit-inner-spin-button,.nys-datepicker--container .nys-datepicker--input-container input[type=date]::-webkit-calendar-picker-indicator{display:none;-webkit-appearance:none}.nys-datepicker--container .nys-datepicker--input-container #calendar-button{display:flex;align-items:center;justify-content:center;padding:var(--_nys-datepicker-space-sm);border-radius:var(--_nys-datepicker-border-radius);border:var(--_nys-datepicker-border-width) solid var(--_nys-datepicker-bg);outline-color:transparent;outline-width:1px;outline-style:solid;background-color:var(--_nys-datepicker-bg);position:absolute;top:50%;right:var(--_nys-datepicker-space-sm);transform:translateY(-50%);cursor:pointer}.nys-datepicker--container .nys-datepicker--input-container #calendar-button:hover{outline-color:var(--_nys-datepicker--date-hover-bg);border-color:var(--_nys-datepicker--date-hover-bg);background:var(--_nys-datepicker--date-hover-bg)}.nys-datepicker--container .nys-datepicker--input-container #calendar-button:active{outline-color:var(--_nys-datepicker--button-active-bg);border-color:var(--_nys-datepicker--button-active-bg);background:var(--_nys-datepicker--button-active-bg)}.nys-datepicker--container .nys-datepicker--input-container #calendar-button:focus:not(:active):not(:disabled){outline-color:var(--_nys-datepicker-outline-color--focus);border-color:var(--_nys-datepicker-outline-color--focus)}.nys-datepicker--container .wc-datepicker--container{display:flex;width:fit-content}.nys-datepicker--container .wc-datepicker--container *{flex:1}wc-datepicker{display:none;padding:var(--_nys-datepicker--wc-padding);border-radius:var(--_nys-datepicker-border-radius);border:var(--_nys-datepicker-border-width) solid var(--nys-color-neutral-100, #d0d0ce);background:var(--_nys-datepicker-bg);box-shadow:0 4px 6px -1px var(--nys-color-black-transparent-100, rgba(27, 27, 27, .1)),0 4px 6px -1px var(--nys-color-black-transparent-50, rgba(27, 27, 27, .01));color:var(--_nys-datepicker-text-color);margin-bottom:3px}wc-datepicker.active{display:flex;flex-direction:column-reverse;position:absolute;z-index:1}wc-datepicker *,wc-datepicker *:before,wc-datepicker *:after{margin:0;box-sizing:border-box}.wc-datepicker{display:block;width:min-content;font-family:var(--_nys-datepicker-font-family);font-size:var(--_nys-datepicker--date-font-size);font-weight:400;line-height:var(--_nys-datepicker-line-height);letter-spacing:var(--_nys-datepicker-letterspacing)}.wc-datepicker--disabled *:disabled{opacity:.5;cursor:not-allowed}.wc-datepicker--disabled .wc-datepicker__date{cursor:not-allowed;opacity:.5}.wc-datepicker--disabled .wc-datepicker__date:focus{outline:none;border-color:var(--_nys-datepicker--date-border-disabled);box-shadow:none}.wc-datepicker--disabled .wc-datepicker__date:hover:not(.wc-datepicker__date--selected){background-color:transparent}.wc-datepicker--disabled .wc-datepicker__date--selected:hover{color:var(--_nys-datepicker-bg);background-color:var(--_nys-datepicker--date-selected-bg)}.wc-datepicker--disabled #wc-month-dropdown-icon{color:var(--_nys-datepicker--date-disabled-color)}.wc-datepicker__header{display:flex;align-items:center;gap:var(--_nys-datepicker-space-sm)}.wc-datepicker__current-month{display:flex;flex-grow:1;gap:var(--_nys-datepicker-space-sm)}.wc-datepicker__month-select,.wc-datepicker__year-select{display:flex;align-items:center;font-size:var(--_nys-datepicker-font-size);font-family:var(--_nys-datepicker-font-family);padding:var(--_nys-datepicker-space-md) var(--_nys-datepicker-space-lg);border:var(--_nys-datepicker--navigation-border);border-radius:.25rem;color:var(--_nys-datepicker-color);background-color:var(--_nys-datepicker-bg);line-height:var(--_nys-datepicker-line-height)}.wc-datepicker__month-select:hover:not(:disabled),.wc-datepicker__year-select:hover:not(:disabled){border:var(--_nys-datepicker--navigation-hover-border);background-color:var(--_nys-datepicker--navigation-hover-background);box-shadow:var(--_nys-datepicker--navigation-box-shadow-border)}.wc-datepicker__month-select:active:not(:disabled),.wc-datepicker__month-select[aria-pressed=true],.wc-datepicker__year-select:active:not(:disabled),.wc-datepicker__year-select[aria-pressed=true]{border:var(--_nys-datepicker--navigation-pressed-border);background-color:var(--_nys-datepicker--navigation-pressed-background);box-shadow:var(--_nys-datepicker--navigation-box-shadow-border)}.wc-datepicker__month-select:disabled,.wc-datepicker__month-select[aria-disabled=true],.wc-datepicker__year-select:disabled,.wc-datepicker__year-select[aria-disabled=true]{border:var(--_nys-datepicker--navigation-disabled-border);background-color:var(--_nys-datepicker--navigation-disabled-background);color:var(--_nys-datepicker-color-disabled)}.wc-datepicker .month-wrapper{position:relative;width:135px;display:flex;align-items:center;align-self:stretch}.wc-datepicker .month-wrapper #wc-month-dropdown-icon{position:absolute;right:10px;top:50%;transform:translateY(-50%);pointer-events:none}.wc-datepicker__month-select{width:100%;max-width:100%;flex-grow:1;cursor:pointer;appearance:none;text-overflow:ellipsis;padding-right:var(--nys-space-400, 32px)}.wc-datepicker__month-select>*{width:91px;height:24px}.wc-datepicker__year-select{border:var(--_nys-datepicker--navigation-border);border-radius:.25rem;padding-right:var(--_nys-datepicker-space-sm);max-width:5rem}.wc-datepicker__previous-month-button,.wc-datepicker__next-month-button,.wc-datepicker__previous-year-button,.wc-datepicker__next-year-button{display:inline-flex;width:40px;max-width:40px;max-height:42px;padding:var(--_nys-datepicker-space-lg);justify-content:center;align-items:center;border:var(--_nys-datepicker--navigation-border);border-radius:.25rem;color:var(--_nys-datepicker--date-default-color);background-color:var(--_nys-datepicker-bg);cursor:pointer}.wc-datepicker__previous-month-button:hover:not(:disabled),.wc-datepicker__next-month-button:hover:not(:disabled),.wc-datepicker__previous-year-button:hover:not(:disabled),.wc-datepicker__next-year-button:hover:not(:disabled){background-color:var(--_nys-datepicker--navigation-hover-background);box-shadow:var(--_nys-datepicker--navigation-box-shadow-border);border:var(--_nys-datepicker--navigation-hover-border)}.wc-datepicker__previous-month-button:active:not(:disabled),.wc-datepicker__previous-month-button[aria-pressed=true],.wc-datepicker__next-month-button:active:not(:disabled),.wc-datepicker__next-month-button[aria-pressed=true],.wc-datepicker__previous-year-button:active:not(:disabled),.wc-datepicker__previous-year-button[aria-pressed=true],.wc-datepicker__next-year-button:active:not(:disabled),.wc-datepicker__next-year-button[aria-pressed=true]{background-color:var(--_nys-datepicker--navigation-pressed-background);box-shadow:var(--_nys-datepicker--navigation-box-shadow-border);border:var(--_nys-datepicker--navigation-pressed-border)}.wc-datepicker__previous-month-button:disabled,.wc-datepicker__previous-month-button[aria-disabled=true],.wc-datepicker__next-month-button:disabled,.wc-datepicker__next-month-button[aria-disabled=true],.wc-datepicker__previous-year-button:disabled,.wc-datepicker__previous-year-button[aria-disabled=true],.wc-datepicker__next-year-button:disabled,.wc-datepicker__next-year-button[aria-disabled=true]{background-color:var(--_nys-datepicker--navigation-disabled-background);border:var(--_nys-datepicker--navigation-disabled-border);color:var(--_nys-datepicker-color-disabled)}.wc-datepicker__calendar{width:100%;table-layout:fixed;border-collapse:collapse}.wc-datepicker__weekday{padding:var(--_nys-datepicker--wc-padding) 0 var(--_nys-datepicker-space-sm) 0;min-width:var(--nys-size-500, 40px);font-weight:600;aspect-ratio:1}.wc-datepicker__weekday>span{width:42.3px;height:24px;display:flex;justify-content:center;align-items:center}.wc-datepicker__weekday[aria-label=Saturday],.wc-datepicker__weekday[aria-label=Sunday]{color:var(--_nys-datepicker--wc-weaker-color)}.wc-datepicker__date{padding:var(--_nys-datepicker-space-md);text-align:center;cursor:pointer;border-radius:var(--nys-radius-lg)}.wc-datepicker__date:focus,.wc-datepicker__date:focus-visible{outline:none}.wc-datepicker__date:focus{box-shadow:inset 0 0 0 2px var(--_nys-datepicker--date-focus-ring)}.wc-datepicker__date:hover:not(.wc-datepicker__date--selected):not(:active){color:var(--_nys-datepicker--date-hover-color);background-color:var(--_nys-datepicker--date-hover-bg)}.wc-datepicker__date:active{color:var(--_nys-datepicker--date-hover-color);background-color:var(--_nys-datepicker--date-active-bg)}.wc-datepicker__date>*{display:flex;justify-content:center;align-items:center;aspect-ratio:1;width:24.3px;height:24px}.wc-datepicker__date--today{font-weight:600;color:var(--_nys-datepicker--date-selected-color)}.wc-datepicker__date--today>*{font-style:normal;text-decoration-line:underline}.wc-datepicker__date--selected{text-decoration-line:none;background-color:var(--_nys-datepicker--date-selected-bg);color:var(--_nys-datepicker--date-selected-color)}.wc-datepicker__date--selected>*{font-weight:600}.wc-datepicker__date--disabled{color:var(--_nys-datepicker--date-disabled-color);cursor:default}.wc-datepicker__date--disabled:not(.wc-datepicker__date--disabled--selected):not(.wc-datepicker__date--disabled--in-range):hover{background-color:transparent}.wc-datepicker__date.wc-datepicker__date--overflowing{color:var(--_nys-datepicker-text-disabled)}.wc-datepicker__date.wc-datepicker__date--overflowing:hover,.wc-datepicker__date.wc-datepicker__date--overflowing:active{color:var(--_nys-datepicker-color)}.wc-datepicker--button-container{display:flex;padding-top:var(--_nys-datepicker-space-lg);align-items:flex-end;gap:var(--_nys-datepicker--wc-padding);align-self:stretch}.wc-datepicker tr.wc-datepicker__calendar-row.sc-wc-datepicker{display:flex;align-items:center;gap:var(--_nys-datepicker--row-gap);align-self:stretch}', B = {
|
|
5
|
+
allRenderFn: !1,
|
|
6
|
+
cmpDidLoad: !0,
|
|
7
|
+
cmpDidUnload: !1,
|
|
8
|
+
cmpDidUpdate: !0,
|
|
9
|
+
cmpDidRender: !0,
|
|
10
|
+
cmpWillLoad: !0,
|
|
11
|
+
cmpWillUpdate: !0,
|
|
12
|
+
cmpWillRender: !0,
|
|
13
|
+
connectedCallback: !0,
|
|
14
|
+
disconnectedCallback: !0,
|
|
15
|
+
element: !0,
|
|
16
|
+
event: !0,
|
|
17
|
+
hasRenderFn: !0,
|
|
18
|
+
lifecycle: !0,
|
|
19
|
+
hostListener: !0,
|
|
20
|
+
hostListenerTargetWindow: !0,
|
|
21
|
+
hostListenerTargetDocument: !0,
|
|
22
|
+
hostListenerTargetBody: !0,
|
|
23
|
+
hostListenerTargetParent: !1,
|
|
24
|
+
hostListenerTarget: !0,
|
|
25
|
+
member: !0,
|
|
26
|
+
method: !0,
|
|
27
|
+
mode: !0,
|
|
28
|
+
observeAttribute: !0,
|
|
29
|
+
prop: !0,
|
|
30
|
+
propMutable: !0,
|
|
31
|
+
reflect: !0,
|
|
32
|
+
scoped: !0,
|
|
33
|
+
shadowDom: !0,
|
|
34
|
+
slot: !0,
|
|
35
|
+
cssAnnotations: !0,
|
|
36
|
+
state: !0,
|
|
37
|
+
style: !0,
|
|
38
|
+
svg: !0,
|
|
39
|
+
updatable: !0,
|
|
40
|
+
vdomAttribute: !0,
|
|
41
|
+
vdomXlink: !0,
|
|
42
|
+
vdomClass: !0,
|
|
43
|
+
vdomFunctional: !0,
|
|
44
|
+
vdomKey: !0,
|
|
45
|
+
vdomListener: !0,
|
|
46
|
+
vdomRef: !0,
|
|
47
|
+
vdomPropOrAttr: !0,
|
|
48
|
+
vdomRender: !0,
|
|
49
|
+
vdomStyle: !0,
|
|
50
|
+
vdomText: !0,
|
|
51
|
+
watchCallback: !0,
|
|
52
|
+
taskQueue: !0,
|
|
53
|
+
hotModuleReplacement: !1,
|
|
54
|
+
isDebug: !1,
|
|
55
|
+
isDev: !1,
|
|
56
|
+
isTesting: !1,
|
|
57
|
+
hydrateServerSide: !1,
|
|
58
|
+
hydrateClientSide: !1,
|
|
59
|
+
lifecycleDOMEvents: !1,
|
|
60
|
+
lazyLoad: !1,
|
|
61
|
+
profile: !1,
|
|
62
|
+
slotRelocation: !0,
|
|
63
|
+
appendChildSlotFix: !1,
|
|
64
|
+
cloneNodeFix: !1,
|
|
65
|
+
hydratedAttribute: !1,
|
|
66
|
+
hydratedClass: !0,
|
|
67
|
+
safari10: !1,
|
|
68
|
+
scriptDataOpts: !1,
|
|
69
|
+
scopedSlotTextContentFix: !1,
|
|
70
|
+
shadowDomShim: !1,
|
|
71
|
+
slotChildNodesFix: !1,
|
|
72
|
+
invisiblePrehydration: !0,
|
|
73
|
+
propBoolean: !0,
|
|
74
|
+
propNumber: !0,
|
|
75
|
+
propString: !0,
|
|
76
|
+
cssVarShim: !1,
|
|
77
|
+
constructableCSS: !0,
|
|
78
|
+
cmpShouldUpdate: !0,
|
|
79
|
+
devTools: !1,
|
|
80
|
+
dynamicImportShim: !1,
|
|
81
|
+
shadowDelegatesFocus: !0,
|
|
82
|
+
initializeNextTick: !1,
|
|
83
|
+
asyncLoading: !1,
|
|
84
|
+
asyncQueue: !1,
|
|
85
|
+
transformTagName: !1,
|
|
86
|
+
attachStyles: !0
|
|
87
|
+
};
|
|
88
|
+
let R, me, G, we = !1, z = !1, ee = !1, b = !1, re = null, Z = !1;
|
|
89
|
+
const M = (t, e = "") => () => {
|
|
90
|
+
}, ne = "http://www.w3.org/1999/xlink", ie = {}, Ke = "http://www.w3.org/2000/svg", Qe = "http://www.w3.org/1999/xhtml", Ge = (t) => t != null, te = (t) => (t = typeof t, t === "object" || t === "function");
|
|
91
|
+
function Xe(t) {
|
|
92
|
+
var e, a, s;
|
|
93
|
+
return (s = (a = (e = t.head) === null || e === void 0 ? void 0 : e.querySelector('meta[name="csp-nonce"]')) === null || a === void 0 ? void 0 : a.getAttribute("content")) !== null && s !== void 0 ? s : void 0;
|
|
94
|
+
}
|
|
95
|
+
const h = (t, e, ...a) => {
|
|
96
|
+
let s = null, r = null, i = null, n = !1, o = !1;
|
|
97
|
+
const c = [], l = (d) => {
|
|
98
|
+
for (let p = 0; p < d.length; p++)
|
|
99
|
+
s = d[p], Array.isArray(s) ? l(s) : s != null && typeof s != "boolean" && ((n = typeof t != "function" && !te(s)) && (s = String(s)), n && o ? c[c.length - 1].$text$ += s : c.push(n ? j(null, s) : s), o = n);
|
|
100
|
+
};
|
|
101
|
+
if (l(a), e) {
|
|
102
|
+
e.key && (r = e.key), e.name && (i = e.name);
|
|
103
|
+
{
|
|
104
|
+
const d = e.className || e.class;
|
|
105
|
+
d && (e.class = typeof d != "object" ? d : Object.keys(d).filter((p) => d[p]).join(" "));
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (typeof t == "function")
|
|
109
|
+
return t(e === null ? {} : e, c, Ze);
|
|
110
|
+
const u = j(t, null);
|
|
111
|
+
return u.$attrs$ = e, c.length > 0 && (u.$children$ = c), u.$key$ = r, u.$name$ = i, u;
|
|
112
|
+
}, j = (t, e) => {
|
|
113
|
+
const a = {
|
|
114
|
+
$flags$: 0,
|
|
115
|
+
$tag$: t,
|
|
116
|
+
$text$: e,
|
|
117
|
+
$elm$: null,
|
|
118
|
+
$children$: null
|
|
119
|
+
};
|
|
120
|
+
return a.$attrs$ = null, a.$key$ = null, a.$name$ = null, a;
|
|
121
|
+
}, De = {}, Je = (t) => t && t.$tag$ === De, Ze = {
|
|
122
|
+
forEach: (t, e) => t.map(oe).forEach(e),
|
|
123
|
+
map: (t, e) => t.map(oe).map(e).map(Ve)
|
|
124
|
+
}, oe = (t) => ({
|
|
125
|
+
vattrs: t.$attrs$,
|
|
126
|
+
vchildren: t.$children$,
|
|
127
|
+
vkey: t.$key$,
|
|
128
|
+
vname: t.$name$,
|
|
129
|
+
vtag: t.$tag$,
|
|
130
|
+
vtext: t.$text$
|
|
131
|
+
}), Ve = (t) => {
|
|
132
|
+
if (typeof t.vtag == "function") {
|
|
133
|
+
const a = Object.assign({}, t.vattrs);
|
|
134
|
+
return t.vkey && (a.key = t.vkey), t.vname && (a.name = t.vname), h(t.vtag, a, ...t.vchildren || []);
|
|
135
|
+
}
|
|
136
|
+
const e = j(t.vtag, t.vtext);
|
|
137
|
+
return e.$attrs$ = t.vattrs, e.$children$ = t.vchildren, e.$key$ = t.vkey, e.$name$ = t.vname, e;
|
|
138
|
+
}, et = (t) => Mt.map((e) => e(t)).find((e) => !!e), tt = (t, e) => t != null && !te(t) ? e & 4 ? t === "false" ? !1 : t === "" || !!t : e & 2 ? parseFloat(t) : e & 1 ? String(t) : t : t, at = (t) => t, ce = (t, e, a) => {
|
|
139
|
+
const s = at(t);
|
|
140
|
+
return {
|
|
141
|
+
emit: (r) => st(s, e, {
|
|
142
|
+
bubbles: !0,
|
|
143
|
+
composed: !0,
|
|
144
|
+
cancelable: !0,
|
|
145
|
+
detail: r
|
|
146
|
+
})
|
|
147
|
+
};
|
|
148
|
+
}, st = (t, e, a) => {
|
|
149
|
+
const s = k.ce(e, a);
|
|
150
|
+
return t.dispatchEvent(s), s;
|
|
151
|
+
}, le = /* @__PURE__ */ new WeakMap(), rt = (t, e, a) => {
|
|
152
|
+
let s = K.get(t);
|
|
153
|
+
Rt && a ? (s = s || new CSSStyleSheet(), typeof s == "string" ? s = e : s.replaceSync(e)) : s = e, K.set(t, s);
|
|
154
|
+
}, nt = (t, e, a, s) => {
|
|
155
|
+
var r;
|
|
156
|
+
let i = xe(e, a);
|
|
157
|
+
const n = K.get(i);
|
|
158
|
+
if (t = t.nodeType === 11 ? t : m, n)
|
|
159
|
+
if (typeof n == "string") {
|
|
160
|
+
t = t.head || t;
|
|
161
|
+
let o = le.get(t), c;
|
|
162
|
+
if (o || le.set(t, o = /* @__PURE__ */ new Set()), !o.has(i)) {
|
|
163
|
+
{
|
|
164
|
+
c = m.createElement("style"), c.innerHTML = n;
|
|
165
|
+
const l = (r = k.$nonce$) !== null && r !== void 0 ? r : Xe(m);
|
|
166
|
+
l != null && c.setAttribute("nonce", l), t.insertBefore(c, t.querySelector("link"));
|
|
167
|
+
}
|
|
168
|
+
o && o.add(i);
|
|
169
|
+
}
|
|
170
|
+
} else t.adoptedStyleSheets.includes(n) || (t.adoptedStyleSheets = [...t.adoptedStyleSheets, n]);
|
|
171
|
+
return i;
|
|
172
|
+
}, it = (t) => {
|
|
173
|
+
const e = t.$cmpMeta$, a = t.$hostElement$, s = e.$flags$, r = M("attachStyles", e.$tagName$), i = nt(a.shadowRoot ? a.shadowRoot : a.getRootNode(), e, t.$modeName$);
|
|
174
|
+
s & 10 && (a["s-sc"] = i, a.classList.add(i + "-h"), s & 2 && a.classList.add(i + "-s")), r();
|
|
175
|
+
}, xe = (t, e) => "sc-" + (e && t.$flags$ & 32 ? t.$tagName$ + "-" + e : t.$tagName$), de = (t, e, a, s, r, i) => {
|
|
176
|
+
if (a !== s) {
|
|
177
|
+
let n = fe(t, e), o = e.toLowerCase();
|
|
178
|
+
if (e === "class") {
|
|
179
|
+
const c = t.classList, l = ue(a), u = ue(s);
|
|
180
|
+
c.remove(...l.filter((d) => d && !u.includes(d))), c.add(...u.filter((d) => d && !l.includes(d)));
|
|
181
|
+
} else if (e === "style") {
|
|
182
|
+
for (const c in a)
|
|
183
|
+
(!s || s[c] == null) && (c.includes("-") ? t.style.removeProperty(c) : t.style[c] = "");
|
|
184
|
+
for (const c in s)
|
|
185
|
+
(!a || s[c] !== a[c]) && (c.includes("-") ? t.style.setProperty(c, s[c]) : t.style[c] = s[c]);
|
|
186
|
+
} else if (e !== "key")
|
|
187
|
+
if (e === "ref")
|
|
188
|
+
s && s(t);
|
|
189
|
+
else if (!t.__lookupSetter__(e) && e[0] === "o" && e[1] === "n")
|
|
190
|
+
e[2] === "-" ? e = e.slice(3) : fe(J, o) ? e = o.slice(2) : e = o[2] + e.slice(3), a && k.rel(t, e, a, !1), s && k.ael(t, e, s, !1);
|
|
191
|
+
else {
|
|
192
|
+
const c = te(s);
|
|
193
|
+
if ((n || c && s !== null) && !r)
|
|
194
|
+
try {
|
|
195
|
+
if (t.tagName.includes("-"))
|
|
196
|
+
t[e] = s;
|
|
197
|
+
else {
|
|
198
|
+
const u = s ?? "";
|
|
199
|
+
e === "list" ? n = !1 : (a == null || t[e] != u) && (t[e] = u);
|
|
200
|
+
}
|
|
201
|
+
} catch {
|
|
202
|
+
}
|
|
203
|
+
let l = !1;
|
|
204
|
+
o !== (o = o.replace(/^xlink\:?/, "")) && (e = o, l = !0), s == null || s === !1 ? (s !== !1 || t.getAttribute(e) === "") && (l ? t.removeAttributeNS(ne, e) : t.removeAttribute(e)) : (!n || i & 4 || r) && !c && (s = s === !0 ? "" : s, l ? t.setAttributeNS(ne, e, s) : t.setAttribute(e, s));
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}, ot = /\s/, ue = (t) => t ? t.split(ot) : [], Se = (t, e, a, s) => {
|
|
208
|
+
const r = e.$elm$.nodeType === 11 && e.$elm$.host ? e.$elm$.host : e.$elm$, i = t && t.$attrs$ || ie, n = e.$attrs$ || ie;
|
|
209
|
+
for (s in i)
|
|
210
|
+
s in n || de(r, s, i[s], void 0, a, e.$flags$);
|
|
211
|
+
for (s in n)
|
|
212
|
+
de(r, s, i[s], n[s], a, e.$flags$);
|
|
213
|
+
}, H = (t, e, a, s) => {
|
|
214
|
+
const r = e.$children$[a];
|
|
215
|
+
let i = 0, n, o, c;
|
|
216
|
+
if (we || (ee = !0, r.$tag$ === "slot" && (R && s.classList.add(R + "-s"), r.$flags$ |= r.$children$ ? (
|
|
217
|
+
// slot element has fallback content
|
|
218
|
+
2
|
|
219
|
+
) : (
|
|
220
|
+
// slot element does not have fallback content
|
|
221
|
+
1
|
|
222
|
+
))), r.$text$ !== null)
|
|
223
|
+
n = r.$elm$ = m.createTextNode(r.$text$);
|
|
224
|
+
else if (r.$flags$ & 1)
|
|
225
|
+
n = r.$elm$ = m.createTextNode("");
|
|
226
|
+
else {
|
|
227
|
+
if (b || (b = r.$tag$ === "svg"), n = r.$elm$ = m.createElementNS(b ? Ke : Qe, r.$flags$ & 2 ? "slot-fb" : r.$tag$), b && r.$tag$ === "foreignObject" && (b = !1), Se(null, r, b), Ge(R) && n["s-si"] !== R && n.classList.add(n["s-si"] = R), r.$children$)
|
|
228
|
+
for (i = 0; i < r.$children$.length; ++i)
|
|
229
|
+
o = H(t, r, i, n), o && n.appendChild(o);
|
|
230
|
+
r.$tag$ === "svg" ? b = !1 : n.tagName === "foreignObject" && (b = !0);
|
|
231
|
+
}
|
|
232
|
+
return n["s-hn"] = G, r.$flags$ & 3 && (n["s-sr"] = !0, n["s-cr"] = me, n["s-sn"] = r.$name$ || "", c = t && t.$children$ && t.$children$[a], c && c.$tag$ === r.$tag$ && t.$elm$ && F(t.$elm$, !1)), n;
|
|
233
|
+
}, F = (t, e) => {
|
|
234
|
+
k.$flags$ |= 1;
|
|
235
|
+
const a = t.childNodes;
|
|
236
|
+
for (let s = a.length - 1; s >= 0; s--) {
|
|
237
|
+
const r = a[s];
|
|
238
|
+
r["s-hn"] !== G && r["s-ol"] && (Te(r).insertBefore(r, ae(r)), r["s-ol"].remove(), r["s-ol"] = void 0, ee = !0), e && F(r, e);
|
|
239
|
+
}
|
|
240
|
+
k.$flags$ &= -2;
|
|
241
|
+
}, Ce = (t, e, a, s, r, i) => {
|
|
242
|
+
let n = t["s-cr"] && t["s-cr"].parentNode || t, o;
|
|
243
|
+
for (n.shadowRoot && n.tagName === G && (n = n.shadowRoot); r <= i; ++r)
|
|
244
|
+
s[r] && (o = H(null, a, r, t), o && (s[r].$elm$ = o, n.insertBefore(o, ae(e))));
|
|
245
|
+
}, Me = (t, e, a, s, r) => {
|
|
246
|
+
for (; e <= a; ++e)
|
|
247
|
+
(s = t[e]) && (r = s.$elm$, Re(s), z = !0, r["s-ol"] ? r["s-ol"].remove() : F(r, !0), r.remove());
|
|
248
|
+
}, ct = (t, e, a, s) => {
|
|
249
|
+
let r = 0, i = 0, n = 0, o = 0, c = e.length - 1, l = e[0], u = e[c], d = s.length - 1, p = s[0], y = s[d], $, D;
|
|
250
|
+
for (; r <= c && i <= d; )
|
|
251
|
+
if (l == null)
|
|
252
|
+
l = e[++r];
|
|
253
|
+
else if (u == null)
|
|
254
|
+
u = e[--c];
|
|
255
|
+
else if (p == null)
|
|
256
|
+
p = s[++i];
|
|
257
|
+
else if (y == null)
|
|
258
|
+
y = s[--d];
|
|
259
|
+
else if (q(l, p))
|
|
260
|
+
N(l, p), l = e[++r], p = s[++i];
|
|
261
|
+
else if (q(u, y))
|
|
262
|
+
N(u, y), u = e[--c], y = s[--d];
|
|
263
|
+
else if (q(l, y))
|
|
264
|
+
(l.$tag$ === "slot" || y.$tag$ === "slot") && F(l.$elm$.parentNode, !1), N(l, y), t.insertBefore(l.$elm$, u.$elm$.nextSibling), l = e[++r], y = s[--d];
|
|
265
|
+
else if (q(u, p))
|
|
266
|
+
(l.$tag$ === "slot" || y.$tag$ === "slot") && F(u.$elm$.parentNode, !1), N(u, p), t.insertBefore(u.$elm$, l.$elm$), u = e[--c], p = s[++i];
|
|
267
|
+
else {
|
|
268
|
+
for (n = -1, o = r; o <= c; ++o)
|
|
269
|
+
if (e[o] && e[o].$key$ !== null && e[o].$key$ === p.$key$) {
|
|
270
|
+
n = o;
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
273
|
+
n >= 0 ? (D = e[n], D.$tag$ !== p.$tag$ ? $ = H(e && e[i], a, n, t) : (N(D, p), e[n] = void 0, $ = D.$elm$), p = s[++i]) : ($ = H(e && e[i], a, i, t), p = s[++i]), $ && Te(l.$elm$).insertBefore($, ae(l.$elm$));
|
|
274
|
+
}
|
|
275
|
+
r > c ? Ce(t, s[d + 1] == null ? null : s[d + 1].$elm$, a, s, i, d) : i > d && Me(e, r, c);
|
|
276
|
+
}, q = (t, e) => t.$tag$ === e.$tag$ ? t.$tag$ === "slot" ? t.$name$ === e.$name$ : t.$key$ === e.$key$ : !1, ae = (t) => t && t["s-ol"] || t, Te = (t) => (t["s-ol"] ? t["s-ol"] : t).parentNode, N = (t, e) => {
|
|
277
|
+
const a = e.$elm$ = t.$elm$, s = t.$children$, r = e.$children$, i = e.$tag$, n = e.$text$;
|
|
278
|
+
let o;
|
|
279
|
+
n === null ? (b = i === "svg" ? !0 : i === "foreignObject" ? !1 : b, i === "slot" || Se(t, e, b), s !== null && r !== null ? ct(a, s, e, r) : r !== null ? (t.$text$ !== null && (a.textContent = ""), Ce(a, null, e, r, 0, r.length - 1)) : s !== null && Me(s, 0, s.length - 1), b && i === "svg" && (b = !1)) : (o = a["s-cr"]) ? o.parentNode.textContent = n : t.$text$ !== n && (a.data = n);
|
|
280
|
+
}, Le = (t) => {
|
|
281
|
+
const e = t.childNodes;
|
|
282
|
+
let a, s, r, i, n, o;
|
|
283
|
+
for (s = 0, r = e.length; s < r; s++)
|
|
284
|
+
if (a = e[s], a.nodeType === 1) {
|
|
285
|
+
if (a["s-sr"]) {
|
|
286
|
+
for (n = a["s-sn"], a.hidden = !1, i = 0; i < r; i++)
|
|
287
|
+
if (o = e[i].nodeType, e[i]["s-hn"] !== a["s-hn"] || n !== "") {
|
|
288
|
+
if (o === 1 && n === e[i].getAttribute("slot")) {
|
|
289
|
+
a.hidden = !0;
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
292
|
+
} else if (o === 1 || o === 3 && e[i].textContent.trim() !== "") {
|
|
293
|
+
a.hidden = !0;
|
|
294
|
+
break;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
Le(a);
|
|
298
|
+
}
|
|
299
|
+
}, _ = [], Be = (t) => {
|
|
300
|
+
let e, a, s, r, i, n, o = 0;
|
|
301
|
+
const c = t.childNodes, l = c.length;
|
|
302
|
+
for (; o < l; o++) {
|
|
303
|
+
if (e = c[o], e["s-sr"] && (a = e["s-cr"]) && a.parentNode)
|
|
304
|
+
for (s = a.parentNode.childNodes, r = e["s-sn"], n = s.length - 1; n >= 0; n--)
|
|
305
|
+
a = s[n], !a["s-cn"] && !a["s-nr"] && a["s-hn"] !== e["s-hn"] && (he(a, r) ? (i = _.find((u) => u.$nodeToRelocate$ === a), z = !0, a["s-sn"] = a["s-sn"] || r, i ? i.$slotRefNode$ = e : _.push({
|
|
306
|
+
$slotRefNode$: e,
|
|
307
|
+
$nodeToRelocate$: a
|
|
308
|
+
}), a["s-sr"] && _.map((u) => {
|
|
309
|
+
he(u.$nodeToRelocate$, a["s-sn"]) && (i = _.find((d) => d.$nodeToRelocate$ === a), i && !u.$slotRefNode$ && (u.$slotRefNode$ = i.$slotRefNode$));
|
|
310
|
+
})) : _.some((u) => u.$nodeToRelocate$ === a) || _.push({
|
|
311
|
+
$nodeToRelocate$: a
|
|
312
|
+
}));
|
|
313
|
+
e.nodeType === 1 && Be(e);
|
|
314
|
+
}
|
|
315
|
+
}, he = (t, e) => t.nodeType === 1 ? t.getAttribute("slot") === null && e === "" || t.getAttribute("slot") === e : t["s-sn"] === e ? !0 : e === "", Re = (t) => {
|
|
316
|
+
t.$attrs$ && t.$attrs$.ref && t.$attrs$.ref(null), t.$children$ && t.$children$.map(Re);
|
|
317
|
+
}, lt = (t, e) => {
|
|
318
|
+
const a = t.$hostElement$, s = t.$cmpMeta$, r = t.$vnode$ || j(null, null), i = Je(e) ? e : h(null, null, e);
|
|
319
|
+
G = a.tagName, s.$attrsToReflect$ && (i.$attrs$ = i.$attrs$ || {}, s.$attrsToReflect$.map(([n, o]) => i.$attrs$[o] = a[n])), i.$tag$ = null, i.$flags$ |= 4, t.$vnode$ = i, i.$elm$ = r.$elm$ = a.shadowRoot || a, R = a["s-sc"], me = a["s-cr"], we = (s.$flags$ & 1) !== 0, z = !1, N(r, i);
|
|
320
|
+
{
|
|
321
|
+
if (k.$flags$ |= 1, ee) {
|
|
322
|
+
Be(i.$elm$);
|
|
323
|
+
let n, o, c, l, u, d, p = 0;
|
|
324
|
+
for (; p < _.length; p++)
|
|
325
|
+
n = _[p], o = n.$nodeToRelocate$, o["s-ol"] || (c = m.createTextNode(""), c["s-nr"] = o, o.parentNode.insertBefore(o["s-ol"] = c, o));
|
|
326
|
+
for (p = 0; p < _.length; p++)
|
|
327
|
+
if (n = _[p], o = n.$nodeToRelocate$, n.$slotRefNode$) {
|
|
328
|
+
for (l = n.$slotRefNode$.parentNode, u = n.$slotRefNode$.nextSibling, c = o["s-ol"]; c = c.previousSibling; )
|
|
329
|
+
if (d = c["s-nr"], d && d["s-sn"] === o["s-sn"] && l === d.parentNode && (d = d.nextSibling, !d || !d["s-nr"])) {
|
|
330
|
+
u = d;
|
|
331
|
+
break;
|
|
332
|
+
}
|
|
333
|
+
(!u && l !== o.parentNode || o.nextSibling !== u) && o !== u && (!o["s-hn"] && o["s-ol"] && (o["s-hn"] = o["s-ol"].parentNode.nodeName), l.insertBefore(o, u));
|
|
334
|
+
} else
|
|
335
|
+
o.nodeType === 1 && (o.hidden = !0);
|
|
336
|
+
}
|
|
337
|
+
z && Le(i.$elm$), k.$flags$ &= -2, _.length = 0;
|
|
338
|
+
}
|
|
339
|
+
}, dt = (t, e) => {
|
|
340
|
+
}, Ne = (t, e) => (t.$flags$ |= 16, dt(t, t.$ancestorComponent$), Ot(() => ut(t, e))), ut = (t, e) => {
|
|
341
|
+
const a = t.$hostElement$, s = M("scheduleUpdate", t.$cmpMeta$.$tagName$), r = a;
|
|
342
|
+
let i;
|
|
343
|
+
return e ? i = E(r, "componentWillLoad") : i = E(r, "componentWillUpdate"), i = pe(i, () => E(r, "componentWillRender")), s(), pe(i, () => ht(t, r, e));
|
|
344
|
+
}, ht = async (t, e, a) => {
|
|
345
|
+
const s = t.$hostElement$, r = M("update", t.$cmpMeta$.$tagName$);
|
|
346
|
+
s["s-rc"], a && it(t);
|
|
347
|
+
const i = M("render", t.$cmpMeta$.$tagName$);
|
|
348
|
+
pt(t, e, s), i(), r(), ft(t);
|
|
349
|
+
}, pt = (t, e, a) => {
|
|
350
|
+
try {
|
|
351
|
+
re = e, e = e.render && e.render(), t.$flags$ &= -17, t.$flags$ |= 2, (B.hasRenderFn || B.reflect) && (B.vdomRender || B.reflect) && (B.hydrateServerSide || lt(t, e));
|
|
352
|
+
} catch (o) {
|
|
353
|
+
Y(o, t.$hostElement$);
|
|
354
|
+
}
|
|
355
|
+
return re = null, null;
|
|
356
|
+
}, ft = (t) => {
|
|
357
|
+
const e = t.$cmpMeta$.$tagName$, a = t.$hostElement$, s = M("postUpdate", e), r = a;
|
|
358
|
+
t.$ancestorComponent$, E(r, "componentDidRender"), t.$flags$ & 64 ? (E(r, "componentDidUpdate"), s()) : (t.$flags$ |= 64, E(r, "componentDidLoad"), s());
|
|
359
|
+
}, E = (t, e, a) => {
|
|
360
|
+
if (t && t[e])
|
|
361
|
+
try {
|
|
362
|
+
return t[e](a);
|
|
363
|
+
} catch (s) {
|
|
364
|
+
Y(s);
|
|
365
|
+
}
|
|
366
|
+
}, pe = (t, e) => t && t.then ? t.then(e) : e(), yt = (t, e) => X(t).$instanceValues$.get(e), gt = (t, e, a, s) => {
|
|
367
|
+
const r = X(t), i = t, n = r.$instanceValues$.get(e), o = r.$flags$, c = i;
|
|
368
|
+
a = tt(a, s.$members$[e][0]);
|
|
369
|
+
const l = Number.isNaN(n) && Number.isNaN(a);
|
|
370
|
+
if (a !== n && !l) {
|
|
371
|
+
r.$instanceValues$.set(e, a);
|
|
372
|
+
{
|
|
373
|
+
if (s.$watchers$ && o & 128) {
|
|
374
|
+
const d = s.$watchers$[e];
|
|
375
|
+
d && d.map((p) => {
|
|
376
|
+
try {
|
|
377
|
+
c[p](a, n, e);
|
|
378
|
+
} catch (y) {
|
|
379
|
+
Y(y, i);
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
if ((o & 18) === 2) {
|
|
384
|
+
if (c.componentShouldUpdate && c.componentShouldUpdate(a, n, e) === !1)
|
|
385
|
+
return;
|
|
386
|
+
Ne(r, !1);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}, vt = (t, e, a) => {
|
|
391
|
+
if (e.$members$) {
|
|
392
|
+
t.watchers && (e.$watchers$ = t.watchers);
|
|
393
|
+
const s = Object.entries(e.$members$), r = t.prototype;
|
|
394
|
+
s.map(([i, [n]]) => {
|
|
395
|
+
(n & 31 || n & 32) && Object.defineProperty(r, i, {
|
|
396
|
+
get() {
|
|
397
|
+
return yt(this, i);
|
|
398
|
+
},
|
|
399
|
+
set(o) {
|
|
400
|
+
gt(this, i, o, e);
|
|
401
|
+
},
|
|
402
|
+
configurable: !0,
|
|
403
|
+
enumerable: !0
|
|
404
|
+
});
|
|
405
|
+
});
|
|
406
|
+
{
|
|
407
|
+
const i = /* @__PURE__ */ new Map();
|
|
408
|
+
r.attributeChangedCallback = function(n, o, c) {
|
|
409
|
+
k.jmp(() => {
|
|
410
|
+
const l = i.get(n);
|
|
411
|
+
if (this.hasOwnProperty(l))
|
|
412
|
+
c = this[l], delete this[l];
|
|
413
|
+
else if (r.hasOwnProperty(l) && typeof this[l] == "number" && this[l] == c)
|
|
414
|
+
return;
|
|
415
|
+
this[l] = c === null && typeof this[l] == "boolean" ? !1 : c;
|
|
416
|
+
});
|
|
417
|
+
}, t.observedAttributes = s.filter(
|
|
418
|
+
([n, o]) => o[0] & 15
|
|
419
|
+
/* MEMBER_FLAGS.HasAttribute */
|
|
420
|
+
).map(([n, o]) => {
|
|
421
|
+
const c = o[1] || n;
|
|
422
|
+
return i.set(c, n), o[0] & 512 && e.$attrsToReflect$.push([n, c]), c;
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
return t;
|
|
427
|
+
}, kt = async (t, e, a, s, r) => {
|
|
428
|
+
if ((e.$flags$ & 32) === 0 && (r = t.constructor, e.$flags$ |= 32, customElements.whenDefined(a.$tagName$).then(() => e.$flags$ |= 128), r.style)) {
|
|
429
|
+
let n = r.style;
|
|
430
|
+
typeof n != "string" && (n = n[e.$modeName$ = et(t)]);
|
|
431
|
+
const o = xe(a, e.$modeName$);
|
|
432
|
+
if (!K.has(o)) {
|
|
433
|
+
const c = M("registerStyles", a.$tagName$);
|
|
434
|
+
rt(o, n, !!(a.$flags$ & 1)), c();
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
e.$ancestorComponent$, Ne(e, !0);
|
|
438
|
+
}, bt = (t) => {
|
|
439
|
+
}, $t = (t) => {
|
|
440
|
+
if ((k.$flags$ & 1) === 0) {
|
|
441
|
+
const e = X(t), a = e.$cmpMeta$, s = M("connectedCallback", a.$tagName$);
|
|
442
|
+
e.$flags$ & 1 ? (Ee(t, e, a.$listeners$), bt(e.$lazyInstance$)) : (e.$flags$ |= 1, a.$flags$ & 12 && _t(t), a.$members$ && Object.entries(a.$members$).map(([r, [i]]) => {
|
|
443
|
+
if (i & 31 && t.hasOwnProperty(r)) {
|
|
444
|
+
const n = t[r];
|
|
445
|
+
delete t[r], t[r] = n;
|
|
446
|
+
}
|
|
447
|
+
}), kt(t, e, a)), s();
|
|
448
|
+
}
|
|
449
|
+
}, _t = (t) => {
|
|
450
|
+
const e = t["s-cr"] = m.createComment("");
|
|
451
|
+
e["s-cn"] = !0, t.insertBefore(e, t.firstChild);
|
|
452
|
+
}, mt = (t) => {
|
|
453
|
+
if ((k.$flags$ & 1) === 0) {
|
|
454
|
+
const e = X(t);
|
|
455
|
+
e.$rmListeners$ && (e.$rmListeners$.map((a) => a()), e.$rmListeners$ = void 0);
|
|
456
|
+
}
|
|
457
|
+
}, wt = (t, e) => {
|
|
458
|
+
const a = {
|
|
459
|
+
$flags$: e[0],
|
|
460
|
+
$tagName$: e[1]
|
|
461
|
+
};
|
|
462
|
+
a.$members$ = e[2], a.$listeners$ = e[3], a.$watchers$ = t.$watchers$, a.$attrsToReflect$ = [];
|
|
463
|
+
const s = t.prototype.connectedCallback, r = t.prototype.disconnectedCallback;
|
|
464
|
+
return Object.assign(t.prototype, {
|
|
465
|
+
__registerHost() {
|
|
466
|
+
Ct(this, a);
|
|
467
|
+
},
|
|
468
|
+
connectedCallback() {
|
|
469
|
+
$t(this), s && s.call(this);
|
|
470
|
+
},
|
|
471
|
+
disconnectedCallback() {
|
|
472
|
+
mt(this), r && r.call(this);
|
|
473
|
+
},
|
|
474
|
+
__attachShadow() {
|
|
475
|
+
this.attachShadow({
|
|
476
|
+
mode: "open",
|
|
477
|
+
delegatesFocus: !!(a.$flags$ & 16)
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
}), t.is = a.$tagName$, vt(t, a);
|
|
481
|
+
}, Ee = (t, e, a, s) => {
|
|
482
|
+
a && a.map(([r, i, n]) => {
|
|
483
|
+
const o = xt(t, r), c = Dt(e, n), l = St(r);
|
|
484
|
+
k.ael(o, i, c, l), (e.$rmListeners$ = e.$rmListeners$ || []).push(() => k.rel(o, i, c, l));
|
|
485
|
+
});
|
|
486
|
+
}, Dt = (t, e) => (a) => {
|
|
487
|
+
try {
|
|
488
|
+
B.lazyLoad || t.$hostElement$[e](a);
|
|
489
|
+
} catch (s) {
|
|
490
|
+
Y(s);
|
|
491
|
+
}
|
|
492
|
+
}, xt = (t, e) => e & 4 ? m : e & 8 ? J : e & 16 ? m.body : t, St = (t) => Lt ? {
|
|
493
|
+
passive: (t & 1) !== 0,
|
|
494
|
+
capture: (t & 2) !== 0
|
|
495
|
+
} : (t & 2) !== 0, Oe = /* @__PURE__ */ new WeakMap(), X = (t) => Oe.get(t), Ct = (t, e) => {
|
|
496
|
+
const a = {
|
|
497
|
+
$flags$: 0,
|
|
498
|
+
$hostElement$: t,
|
|
499
|
+
$cmpMeta$: e,
|
|
500
|
+
$instanceValues$: /* @__PURE__ */ new Map()
|
|
501
|
+
};
|
|
502
|
+
return Ee(t, a, e.$listeners$), Oe.set(t, a);
|
|
503
|
+
}, fe = (t, e) => e in t, Y = (t, e) => (0, console.error)(t, e), K = /* @__PURE__ */ new Map(), Mt = [], J = typeof window < "u" ? window : {}, m = J.document || { head: {} }, Tt = J.HTMLElement || class {
|
|
504
|
+
}, k = {
|
|
505
|
+
$flags$: 0,
|
|
506
|
+
$resourcesUrl$: "",
|
|
507
|
+
jmp: (t) => t(),
|
|
508
|
+
raf: (t) => requestAnimationFrame(t),
|
|
509
|
+
ael: (t, e, a, s) => t.addEventListener(e, a, s),
|
|
510
|
+
rel: (t, e, a, s) => t.removeEventListener(e, a, s),
|
|
511
|
+
ce: (t, e) => new CustomEvent(t, e)
|
|
512
|
+
}, Lt = /* @__PURE__ */ (() => {
|
|
513
|
+
let t = !1;
|
|
514
|
+
try {
|
|
515
|
+
m.addEventListener("e", null, Object.defineProperty({}, "passive", {
|
|
516
|
+
get() {
|
|
517
|
+
t = !0;
|
|
518
|
+
}
|
|
519
|
+
}));
|
|
520
|
+
} catch {
|
|
521
|
+
}
|
|
522
|
+
return t;
|
|
523
|
+
})(), Bt = (t) => Promise.resolve(t), Rt = /* @__PURE__ */ (() => {
|
|
524
|
+
try {
|
|
525
|
+
return new CSSStyleSheet(), typeof new CSSStyleSheet().replaceSync == "function";
|
|
526
|
+
} catch {
|
|
527
|
+
}
|
|
528
|
+
return !1;
|
|
529
|
+
})(), ye = [], Ae = [], Nt = (t, e) => (a) => {
|
|
530
|
+
t.push(a), Z || (Z = !0, e && k.$flags$ & 4 ? Et(V) : k.raf(V));
|
|
531
|
+
}, ge = (t) => {
|
|
532
|
+
for (let e = 0; e < t.length; e++)
|
|
533
|
+
try {
|
|
534
|
+
t[e](performance.now());
|
|
535
|
+
} catch (a) {
|
|
536
|
+
Y(a);
|
|
537
|
+
}
|
|
538
|
+
t.length = 0;
|
|
539
|
+
}, V = () => {
|
|
540
|
+
ge(ye), ge(Ae), (Z = ye.length > 0) && k.raf(V);
|
|
541
|
+
}, Et = (t) => Bt().then(t), Ot = /* @__PURE__ */ Nt(Ae, !0);
|
|
542
|
+
function P(t, e) {
|
|
543
|
+
const a = new Date(t);
|
|
544
|
+
return a.setDate(a.getDate() + e), a;
|
|
545
|
+
}
|
|
546
|
+
function At(t, e, a) {
|
|
547
|
+
const s = [], r = se(t), i = r.getDay() === 0 ? 7 : r.getDay(), n = U(t), o = n.getDay() === 0 ? 7 : n.getDay(), c = a === 1 ? 7 : a - 1, l = [], u = [];
|
|
548
|
+
{
|
|
549
|
+
let y = (7 - a + i) % 7, $ = Q(r);
|
|
550
|
+
for (; y > 0; )
|
|
551
|
+
l.push($), $ = Q($), y -= 1;
|
|
552
|
+
l.reverse();
|
|
553
|
+
let T = (7 - o + c) % 7, L = I(n);
|
|
554
|
+
for (; T > 0; )
|
|
555
|
+
u.push(L), L = I(L), T -= 1;
|
|
556
|
+
}
|
|
557
|
+
let d = r;
|
|
558
|
+
for (; d.getMonth() === t.getMonth(); )
|
|
559
|
+
s.push(d), d = I(d);
|
|
560
|
+
return [...l, ...s, ...u];
|
|
561
|
+
}
|
|
562
|
+
function se(t) {
|
|
563
|
+
return S(/* @__PURE__ */ new Date(`${String(Fe(t)).padStart(4, "0")}-${String(Ie(t)).padStart(2, "0")}-01`));
|
|
564
|
+
}
|
|
565
|
+
function x(t) {
|
|
566
|
+
if (t instanceof Date)
|
|
567
|
+
return `${t.getFullYear()}-${String(t.getMonth() + 1).padStart(2, "0")}-${String(t.getDate()).padStart(2, "0")}`;
|
|
568
|
+
}
|
|
569
|
+
function U(t) {
|
|
570
|
+
const e = se(t);
|
|
571
|
+
return e.setMonth(e.getMonth() + 1), e.setDate(e.getDate() - 1), e;
|
|
572
|
+
}
|
|
573
|
+
function Ie(t) {
|
|
574
|
+
return t.getMonth() + 1;
|
|
575
|
+
}
|
|
576
|
+
function It(t) {
|
|
577
|
+
return new Array(12).fill(void 0).map((e, a) => {
|
|
578
|
+
const s = S(/* @__PURE__ */ new Date(`2006-${String(a + 1).padStart(2, "0")}-01`));
|
|
579
|
+
return Intl.DateTimeFormat(t, {
|
|
580
|
+
month: "long"
|
|
581
|
+
}).format(s);
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
function I(t) {
|
|
585
|
+
return P(t, 1);
|
|
586
|
+
}
|
|
587
|
+
function ve(t) {
|
|
588
|
+
const e = new Date(t);
|
|
589
|
+
return e.setDate(1), e.setMonth(e.getMonth() + 1), e;
|
|
590
|
+
}
|
|
591
|
+
function ke(t) {
|
|
592
|
+
const e = new Date(t);
|
|
593
|
+
return e.setFullYear(e.getFullYear() + 1), e;
|
|
594
|
+
}
|
|
595
|
+
function Q(t) {
|
|
596
|
+
return W(t, 1);
|
|
597
|
+
}
|
|
598
|
+
function be(t) {
|
|
599
|
+
const e = new Date(t);
|
|
600
|
+
return e.setDate(1), e.setMonth(e.getMonth() - 1), e;
|
|
601
|
+
}
|
|
602
|
+
function $e(t) {
|
|
603
|
+
const e = new Date(t);
|
|
604
|
+
return e.setFullYear(e.getFullYear() - 1), e;
|
|
605
|
+
}
|
|
606
|
+
function Ft(t, e) {
|
|
607
|
+
return new Array(7).fill(void 0).map((a, s) => (t + s) % 7 + 1).map((a) => {
|
|
608
|
+
const s = S(/* @__PURE__ */ new Date(`2006-01-0${a}`));
|
|
609
|
+
return [
|
|
610
|
+
Intl.DateTimeFormat(e, {
|
|
611
|
+
weekday: "short"
|
|
612
|
+
}).format(s).slice(0, 3),
|
|
613
|
+
Intl.DateTimeFormat(e, {
|
|
614
|
+
weekday: "long"
|
|
615
|
+
}).format(s)
|
|
616
|
+
];
|
|
617
|
+
});
|
|
618
|
+
}
|
|
619
|
+
function Fe(t) {
|
|
620
|
+
return t.getFullYear();
|
|
621
|
+
}
|
|
622
|
+
function _e(t, e) {
|
|
623
|
+
if (!t || !e || !e.from || !e.to)
|
|
624
|
+
return !1;
|
|
625
|
+
const a = e.from < e.to ? e.from : e.to, s = e.from < e.to ? e.to : e.from;
|
|
626
|
+
return t >= a && t <= s;
|
|
627
|
+
}
|
|
628
|
+
function w(t, e) {
|
|
629
|
+
return !t || !e ? !1 : t.getFullYear() === e.getFullYear() && t.getMonth() === e.getMonth() && t.getDate() === e.getDate();
|
|
630
|
+
}
|
|
631
|
+
function S(t) {
|
|
632
|
+
const e = new Date(t);
|
|
633
|
+
return e.setMinutes(e.getMinutes() + e.getTimezoneOffset()), e;
|
|
634
|
+
}
|
|
635
|
+
function W(t, e) {
|
|
636
|
+
const a = new Date(t);
|
|
637
|
+
return a.setDate(a.getDate() - e), a;
|
|
638
|
+
}
|
|
639
|
+
const Yt = ".visually-hidden.sc-wc-datepicker{position:absolute;overflow:hidden;width:1px;height:1px;white-space:nowrap;clip:rect(0 0 0 0);clip-path:inset(50%)}", qt = {
|
|
640
|
+
clearButton: "Clear value",
|
|
641
|
+
monthSelect: "Select month",
|
|
642
|
+
nextMonthButton: "Next month",
|
|
643
|
+
nextYearButton: "Next year",
|
|
644
|
+
picker: "Choose date",
|
|
645
|
+
previousMonthButton: "Previous month",
|
|
646
|
+
previousYearButton: "Previous year",
|
|
647
|
+
todayButton: "Show today",
|
|
648
|
+
yearSelect: "Select year"
|
|
649
|
+
}, Pt = /* @__PURE__ */ wt(class extends Tt {
|
|
650
|
+
constructor() {
|
|
651
|
+
super(), this.__registerHost(), this.selectDate = ce(this, "selectDate"), this.changeMonth = ce(this, "changeMonth"), this.disabled = !1, this.disableDate = () => !1, this.elementClassName = "wc-datepicker", this.firstDayOfWeek = 0, this.labels = qt, this.locale = navigator?.language || "en-US", this.showClearButton = !1, this.showMonthStepper = !0, this.showTodayButton = !1, this.showYearStepper = !1, this.startDate = x(/* @__PURE__ */ new Date()), this.maxSearchDays = 365, this.goToRangeStartOnSelect = !0, this.init = () => {
|
|
652
|
+
this.currentDate = this.startDate ? S(new Date(this.startDate)) : /* @__PURE__ */ new Date(), this.updateWeekdays();
|
|
653
|
+
}, this.getAvailableDate = (t, e) => {
|
|
654
|
+
let a, s = !1;
|
|
655
|
+
switch (e) {
|
|
656
|
+
case "previousDay":
|
|
657
|
+
a = Q(t);
|
|
658
|
+
break;
|
|
659
|
+
case "nextDay":
|
|
660
|
+
a = I(t);
|
|
661
|
+
break;
|
|
662
|
+
case "previousSameWeekDay":
|
|
663
|
+
a = W(t, 7);
|
|
664
|
+
break;
|
|
665
|
+
case "nextSameWeekDay":
|
|
666
|
+
a = P(t, 7);
|
|
667
|
+
break;
|
|
668
|
+
case "firstOfMonth":
|
|
669
|
+
a = se(t);
|
|
670
|
+
break;
|
|
671
|
+
case "lastOfMonth":
|
|
672
|
+
a = U(t);
|
|
673
|
+
break;
|
|
674
|
+
case "previousMonth":
|
|
675
|
+
a = be(t);
|
|
676
|
+
break;
|
|
677
|
+
case "nextMonth":
|
|
678
|
+
a = ve(t);
|
|
679
|
+
break;
|
|
680
|
+
case "previousYear":
|
|
681
|
+
a = $e(t);
|
|
682
|
+
break;
|
|
683
|
+
case "nextYear":
|
|
684
|
+
a = ke(t);
|
|
685
|
+
break;
|
|
686
|
+
}
|
|
687
|
+
for (; this.disableDate(a) && !s; ) {
|
|
688
|
+
switch (e) {
|
|
689
|
+
case "previousDay":
|
|
690
|
+
case "lastOfMonth":
|
|
691
|
+
a = Q(a);
|
|
692
|
+
break;
|
|
693
|
+
case "nextDay":
|
|
694
|
+
case "firstOfMonth":
|
|
695
|
+
case "previousMonth":
|
|
696
|
+
case "nextMonth":
|
|
697
|
+
case "previousYear":
|
|
698
|
+
case "nextYear":
|
|
699
|
+
a = I(a);
|
|
700
|
+
break;
|
|
701
|
+
case "previousSameWeekDay":
|
|
702
|
+
a = W(a, 7);
|
|
703
|
+
break;
|
|
704
|
+
case "nextSameWeekDay":
|
|
705
|
+
a = P(a, 7);
|
|
706
|
+
break;
|
|
707
|
+
}
|
|
708
|
+
switch (e) {
|
|
709
|
+
case "firstOfMonth":
|
|
710
|
+
case "lastOfMonth":
|
|
711
|
+
case "previousYear":
|
|
712
|
+
case "nextYear":
|
|
713
|
+
s = a.getMonth() !== t.getMonth();
|
|
714
|
+
break;
|
|
715
|
+
case "previousMonth":
|
|
716
|
+
s = a.getMonth() !== t.getMonth() - 1;
|
|
717
|
+
break;
|
|
718
|
+
case "nextMonth":
|
|
719
|
+
s = a.getMonth() !== t.getMonth() + 1;
|
|
720
|
+
break;
|
|
721
|
+
default:
|
|
722
|
+
s = !_e(a, {
|
|
723
|
+
from: W(t, this.maxSearchDays),
|
|
724
|
+
to: P(t, this.maxSearchDays)
|
|
725
|
+
});
|
|
726
|
+
break;
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
return s ? t : a;
|
|
730
|
+
}, this.nextMonth = () => {
|
|
731
|
+
this.updateCurrentDate(ve(this.currentDate));
|
|
732
|
+
}, this.nextYear = () => {
|
|
733
|
+
this.updateCurrentDate(ke(this.currentDate));
|
|
734
|
+
}, this.previousMonth = () => {
|
|
735
|
+
this.updateCurrentDate(be(this.currentDate));
|
|
736
|
+
}, this.previousYear = () => {
|
|
737
|
+
this.updateCurrentDate($e(this.currentDate));
|
|
738
|
+
}, this.showToday = () => {
|
|
739
|
+
this.updateCurrentDate(/* @__PURE__ */ new Date());
|
|
740
|
+
}, this.clear = () => {
|
|
741
|
+
this.value = void 0, this.selectDate.emit(void 0);
|
|
742
|
+
}, this.onClick = (t) => {
|
|
743
|
+
if (this.disabled)
|
|
744
|
+
return;
|
|
745
|
+
const e = t.target.closest("[data-date]");
|
|
746
|
+
if (!e)
|
|
747
|
+
return;
|
|
748
|
+
const a = S(new Date(e.dataset.date));
|
|
749
|
+
this.updateCurrentDate(a), this.onSelectDate(a);
|
|
750
|
+
}, this.onMonthSelect = (t) => {
|
|
751
|
+
const e = +t.target.value - 1, a = this.currentDate.getDate(), s = new Date(this.currentDate.getFullYear(), e, 1), r = U(s).getDate(), i = Math.min(a, r), n = new Date(this.currentDate.getFullYear(), e, i);
|
|
752
|
+
this.updateCurrentDate(n);
|
|
753
|
+
}, this.onYearSelect = (t) => {
|
|
754
|
+
let e = +t.target.value;
|
|
755
|
+
const a = t.target;
|
|
756
|
+
isNaN(e) ? (e = (/* @__PURE__ */ new Date()).getFullYear(), a.value = String(e)) : e < 0 ? (e = 0, a.value = String(e)) : e > 9999 && (e = 9999, a.value = String(e));
|
|
757
|
+
const s = this.currentDate.getDate(), r = this.currentDate.getMonth(), i = /* @__PURE__ */ new Date();
|
|
758
|
+
i.setFullYear(e, r, 1);
|
|
759
|
+
const n = U(i).getDate(), o = Math.min(s, n), c = /* @__PURE__ */ new Date();
|
|
760
|
+
c.setFullYear(e, r, o), this.updateCurrentDate(c);
|
|
761
|
+
}, this.onKeyDown = (t) => {
|
|
762
|
+
this.disabled || (t.code === "ArrowLeft" ? (t.preventDefault(), this.updateCurrentDate(this.getAvailableDate(this.currentDate, "previousDay"), !0)) : t.code === "ArrowRight" ? (t.preventDefault(), this.updateCurrentDate(this.getAvailableDate(this.currentDate, "nextDay"), !0)) : t.code === "ArrowUp" ? (t.preventDefault(), this.updateCurrentDate(this.getAvailableDate(this.currentDate, "previousSameWeekDay"), !0)) : t.code === "ArrowDown" ? (t.preventDefault(), this.updateCurrentDate(this.getAvailableDate(this.currentDate, "nextSameWeekDay"), !0)) : t.code === "PageUp" ? (t.preventDefault(), t.shiftKey ? this.updateCurrentDate(this.getAvailableDate(this.currentDate, "previousYear"), !0) : this.updateCurrentDate(this.getAvailableDate(this.currentDate, "previousMonth"), !0)) : t.code === "PageDown" ? (t.preventDefault(), t.shiftKey ? this.updateCurrentDate(this.getAvailableDate(this.currentDate, "nextYear"), !0) : this.updateCurrentDate(this.getAvailableDate(this.currentDate, "nextMonth"), !0)) : t.code === "Home" ? (t.preventDefault(), this.updateCurrentDate(this.getAvailableDate(this.currentDate, "firstOfMonth"), !0)) : t.code === "End" ? (t.preventDefault(), this.updateCurrentDate(this.getAvailableDate(this.currentDate, "lastOfMonth"), !0)) : (t.code === "Space" || t.code === "Enter") && (t.preventDefault(), this.onSelectDate(this.currentDate)));
|
|
763
|
+
}, this.onMouseEnter = (t) => {
|
|
764
|
+
if (this.disabled)
|
|
765
|
+
return;
|
|
766
|
+
const e = S(new Date(t.target.closest("td").dataset.date));
|
|
767
|
+
this.hoveredDate = e;
|
|
768
|
+
}, this.onMouseLeave = () => {
|
|
769
|
+
this.hoveredDate = void 0;
|
|
770
|
+
};
|
|
771
|
+
}
|
|
772
|
+
componentWillLoad() {
|
|
773
|
+
this.init();
|
|
774
|
+
}
|
|
775
|
+
watchFirstDayOfWeek() {
|
|
776
|
+
this.updateWeekdays();
|
|
777
|
+
}
|
|
778
|
+
watchLocale() {
|
|
779
|
+
this.locale || (this.locale = navigator?.language || "en-US"), this.updateWeekdays();
|
|
780
|
+
}
|
|
781
|
+
watchRange() {
|
|
782
|
+
this.value = void 0, this.selectDate.emit(void 0);
|
|
783
|
+
}
|
|
784
|
+
watchStartDate() {
|
|
785
|
+
this.currentDate = this.startDate ? S(new Date(this.startDate)) : /* @__PURE__ */ new Date();
|
|
786
|
+
}
|
|
787
|
+
watchValue() {
|
|
788
|
+
this.value && (Array.isArray(this.value) ? this.currentDate = this.value.length > 1 && !this.goToRangeStartOnSelect ? this.value[1] : this.value[0] : this.value instanceof Date && (this.currentDate = this.value));
|
|
789
|
+
}
|
|
790
|
+
componentDidRender() {
|
|
791
|
+
this.moveFocusAfterMonthChanged && (this.focusDate(this.currentDate), this.moveFocusAfterMonthChanged = !1);
|
|
792
|
+
}
|
|
793
|
+
updateWeekdays() {
|
|
794
|
+
this.weekdays = Ft(this.firstDayOfWeek === 0 ? 7 : this.firstDayOfWeek, this.locale);
|
|
795
|
+
}
|
|
796
|
+
getClassName(t) {
|
|
797
|
+
return t ? `${this.elementClassName}__${t}` : this.elementClassName;
|
|
798
|
+
}
|
|
799
|
+
getCalendarRows() {
|
|
800
|
+
const t = At(this.currentDate, !0, this.firstDayOfWeek === 0 ? 7 : this.firstDayOfWeek), e = [];
|
|
801
|
+
for (let a = 0; a < t.length; a += 7) {
|
|
802
|
+
const s = t.slice(a, a + 7);
|
|
803
|
+
e.push(s);
|
|
804
|
+
}
|
|
805
|
+
return e;
|
|
806
|
+
}
|
|
807
|
+
getTitle() {
|
|
808
|
+
if (this.value)
|
|
809
|
+
if (this.isRangeValue(this.value)) {
|
|
810
|
+
const t = Intl.DateTimeFormat(this.locale, {
|
|
811
|
+
day: "numeric",
|
|
812
|
+
month: "long",
|
|
813
|
+
year: "numeric"
|
|
814
|
+
}).format(this.value[0]), e = this.value[1] ? Intl.DateTimeFormat(this.locale, {
|
|
815
|
+
day: "numeric",
|
|
816
|
+
month: "long",
|
|
817
|
+
year: "numeric"
|
|
818
|
+
}).format(this.value[1]) : void 0;
|
|
819
|
+
return e ? `${t} - ${e}` : t;
|
|
820
|
+
} else
|
|
821
|
+
return Intl.DateTimeFormat(this.locale, {
|
|
822
|
+
day: "numeric",
|
|
823
|
+
month: "long",
|
|
824
|
+
year: "numeric"
|
|
825
|
+
}).format(this.value);
|
|
826
|
+
}
|
|
827
|
+
focusDate(t) {
|
|
828
|
+
var e;
|
|
829
|
+
(e = this.el.querySelector(`[data-date="${x(t)}"]`)) === null || e === void 0 || e.focus();
|
|
830
|
+
}
|
|
831
|
+
updateCurrentDate(t, e) {
|
|
832
|
+
const a = t.getMonth(), s = t.getFullYear();
|
|
833
|
+
if (s > 9999 || s < 0)
|
|
834
|
+
return;
|
|
835
|
+
(a !== this.currentDate.getMonth() || s !== this.currentDate.getFullYear()) && (this.changeMonth.emit({
|
|
836
|
+
month: Ie(t),
|
|
837
|
+
year: Fe(t),
|
|
838
|
+
day: t.getDate()
|
|
839
|
+
}), e && (this.moveFocusAfterMonthChanged = !0)), this.currentDate = t, e && this.focusDate(this.currentDate);
|
|
840
|
+
}
|
|
841
|
+
onSelectDate(t) {
|
|
842
|
+
var e, a;
|
|
843
|
+
if (!this.disableDate(t))
|
|
844
|
+
if (this.isRangeValue(this.value)) {
|
|
845
|
+
const s = ((e = this.value) === null || e === void 0 ? void 0 : e[0]) === void 0 || this.value.length === 2 ? [t] : [this.value[0], t];
|
|
846
|
+
s.length === 2 && s[0] > s[1] && s.reverse();
|
|
847
|
+
const r = s[1] === void 0 ? [x(s[0])] : [x(s[0]), x(s[1])];
|
|
848
|
+
this.value = s, this.selectDate.emit(r);
|
|
849
|
+
} else {
|
|
850
|
+
if (((a = this.value) === null || a === void 0 ? void 0 : a.getTime()) === t.getTime())
|
|
851
|
+
return;
|
|
852
|
+
this.value = t, this.selectDate.emit(x(t));
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
// @ts-ignore
|
|
856
|
+
isRangeValue(t) {
|
|
857
|
+
return this.range;
|
|
858
|
+
}
|
|
859
|
+
render() {
|
|
860
|
+
const t = this.showTodayButton || this.showClearButton;
|
|
861
|
+
return h(De, null, h("div", { "aria-disabled": String(this.disabled), "aria-label": this.labels.picker, class: {
|
|
862
|
+
[this.getClassName()]: !0,
|
|
863
|
+
[`${this.getClassName()}--disabled`]: this.disabled
|
|
864
|
+
}, role: "group" }, h("div", { class: this.getClassName("header") }, h("span", { "aria-atomic": "true", "aria-live": "polite", class: "visually-hidden" }, this.getTitle()), this.showYearStepper && h("button", { "aria-label": this.labels.previousYearButton, class: this.getClassName("previous-year-button"), disabled: this.disabled, innerHTML: this.previousYearButtonContent || void 0, onClick: this.previousYear, type: "button" }, h("svg", { fill: "none", height: "24", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", stroke: "currentColor", viewBox: "0 0 24 24", width: "24" }, h("polyline", { points: "11 17 6 12 11 7" }), h("polyline", { points: "18 17 13 12 18 7" }))), this.showMonthStepper && h("button", { "aria-label": this.labels.previousMonthButton, class: this.getClassName("previous-month-button"), disabled: this.disabled, innerHTML: this.previousMonthButtonContent || void 0, onClick: this.previousMonth, type: "button" }, h("svg", { fill: "none", height: "24", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", stroke: "currentColor", viewBox: "0 0 24 24", width: "24" }, h("polyline", { points: "15 18 9 12 15 6" }))), h("span", { class: this.getClassName("current-month") }, h("select", { title: this.labels.monthSelect, "aria-label": this.labels.monthSelect, class: this.getClassName("month-select"), disabled: this.disabled, name: "month", onChange: this.onMonthSelect }, It(this.locale).map((e, a) => h("option", { key: e, selected: this.currentDate.getMonth() === a, value: a + 1 }, e))), h("input", { title: this.labels.yearSelect, "aria-label": this.labels.yearSelect, class: this.getClassName("year-select"), disabled: this.disabled, max: 9999, maxLength: 4, min: 1, name: "year", onChange: this.onYearSelect, type: "number", value: this.currentDate.getFullYear() })), this.showMonthStepper && h("button", { "aria-label": this.labels.nextMonthButton, class: this.getClassName("next-month-button"), disabled: this.disabled, innerHTML: this.nextMonthButtonContent || void 0, onClick: this.nextMonth, type: "button" }, h("svg", { fill: "none", height: "24", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", stroke: "currentColor", viewBox: "0 0 24 24", width: "24" }, h("polyline", { points: "9 18 15 12 9 6" }))), this.showYearStepper && h("button", { "aria-label": this.labels.nextYearButton, class: this.getClassName("next-year-button"), disabled: this.disabled, innerHTML: this.nextYearButtonContent || void 0, onClick: this.nextYear, type: "button" }, h("svg", { fill: "none", height: "24", "stroke-linecap": "round", "stroke-linejoin": "round", "stroke-width": "2", stroke: "currentColor", viewBox: "0 0 24 24", width: "24" }, h("polyline", { points: "13 17 18 12 13 7" }), h("polyline", { points: "6 17 11 12 6 7" })))), h("div", { class: this.getClassName("body") }, h("table", { class: this.getClassName("calendar"), onKeyDown: this.onKeyDown, role: "grid" }, h("thead", { class: this.getClassName("calendar-header") }, h("tr", { class: this.getClassName("weekday-row") }, this.weekdays.map((e) => h("th", { "aria-label": e[1], abbr: e[1], class: this.getClassName("weekday"), key: e[0], scope: "col" }, h("span", null, e[0]))))), h("tbody", null, this.getCalendarRows().map((e) => {
|
|
865
|
+
const a = `row-${e[0].getMonth()}-${e[0].getDate()}`;
|
|
866
|
+
return h("tr", { class: this.getClassName("calendar-row"), key: a }, e.map((s) => {
|
|
867
|
+
var r, i, n, o, c;
|
|
868
|
+
const l = w(s, this.currentDate), u = s.getMonth() !== this.currentDate.getMonth(), d = Array.isArray(this.value) ? w(s, this.value[0]) || w(s, this.value[1]) : w(s, this.value), p = this.isRangeValue ? _e(s, {
|
|
869
|
+
from: (r = this.value) === null || r === void 0 ? void 0 : r[0],
|
|
870
|
+
to: ((i = this.value) === null || i === void 0 ? void 0 : i[1]) || this.hoveredDate || this.currentDate
|
|
871
|
+
}) : !1, y = !((n = this.value) === null || n === void 0) && n[0] ? [
|
|
872
|
+
(o = this.value) === null || o === void 0 ? void 0 : o[0],
|
|
873
|
+
((c = this.value) === null || c === void 0 ? void 0 : c[1]) || this.hoveredDate
|
|
874
|
+
].sort((Ue, We) => Ue - We) : [], $ = this.range && w(y[0], s), D = this.range && w(y[1], s), T = w(s, /* @__PURE__ */ new Date()), L = this.disableDate(s), Ye = `cell-${s.getMonth()}-${s.getDate()}`, qe = {
|
|
875
|
+
[this.getClassName("date")]: !0,
|
|
876
|
+
[this.getClassName("date--current")]: l,
|
|
877
|
+
[this.getClassName("date--disabled")]: L,
|
|
878
|
+
[this.getClassName("date--overflowing")]: u,
|
|
879
|
+
[this.getClassName("date--today")]: T,
|
|
880
|
+
[this.getClassName("date--selected")]: d,
|
|
881
|
+
[this.getClassName("date--in-range")]: p,
|
|
882
|
+
[this.getClassName("date--start")]: $,
|
|
883
|
+
[this.getClassName("date--end")]: D
|
|
884
|
+
}, Pe = d ? "strong" : T ? "em" : "span";
|
|
885
|
+
return h("td", { "aria-disabled": String(L), "aria-selected": d ? "true" : void 0, "aria-current": T ? "date" : void 0, class: qe, "data-date": x(s), key: Ye, onClick: this.onClick, onMouseEnter: this.onMouseEnter, onMouseLeave: this.onMouseLeave, role: "gridcell", tabIndex: w(s, this.currentDate) && !this.disabled ? 0 : -1 }, h(Pe, { "aria-hidden": "true" }, s.getDate()), h("span", { class: "visually-hidden" }, Intl.DateTimeFormat(this.locale, {
|
|
886
|
+
day: "numeric",
|
|
887
|
+
month: "long"
|
|
888
|
+
}).format(s)));
|
|
889
|
+
}));
|
|
890
|
+
})))), t && h("div", { class: this.getClassName("footer") }, this.showTodayButton && h("button", { class: this.getClassName("today-button"), disabled: this.disabled, innerHTML: this.todayButtonContent || void 0, onClick: this.showToday, type: "button" }, this.labels.todayButton), this.showClearButton && h("button", { class: this.getClassName("clear-button"), disabled: this.disabled, innerHTML: this.clearButtonContent || void 0, onClick: this.clear, type: "button" }, this.labels.clearButton))));
|
|
891
|
+
}
|
|
892
|
+
get el() {
|
|
893
|
+
return this;
|
|
894
|
+
}
|
|
895
|
+
static get watchers() {
|
|
896
|
+
return {
|
|
897
|
+
firstDayOfWeek: ["watchFirstDayOfWeek"],
|
|
898
|
+
locale: ["watchLocale"],
|
|
899
|
+
range: ["watchRange"],
|
|
900
|
+
startDate: ["watchStartDate"],
|
|
901
|
+
value: ["watchValue"]
|
|
902
|
+
};
|
|
903
|
+
}
|
|
904
|
+
static get style() {
|
|
905
|
+
return Yt;
|
|
906
|
+
}
|
|
907
|
+
}, [2, "wc-datepicker", {
|
|
908
|
+
clearButtonContent: [1, "clear-button-content"],
|
|
909
|
+
disabled: [4],
|
|
910
|
+
disableDate: [16],
|
|
911
|
+
elementClassName: [1, "element-class-name"],
|
|
912
|
+
firstDayOfWeek: [2, "first-day-of-week"],
|
|
913
|
+
range: [4],
|
|
914
|
+
labels: [16],
|
|
915
|
+
locale: [1],
|
|
916
|
+
nextMonthButtonContent: [1, "next-month-button-content"],
|
|
917
|
+
nextYearButtonContent: [1, "next-year-button-content"],
|
|
918
|
+
previousMonthButtonContent: [1, "previous-month-button-content"],
|
|
919
|
+
previousYearButtonContent: [1, "previous-year-button-content"],
|
|
920
|
+
showClearButton: [4, "show-clear-button"],
|
|
921
|
+
showMonthStepper: [4, "show-month-stepper"],
|
|
922
|
+
showTodayButton: [4, "show-today-button"],
|
|
923
|
+
showYearStepper: [4, "show-year-stepper"],
|
|
924
|
+
startDate: [1, "start-date"],
|
|
925
|
+
todayButtonContent: [1, "today-button-content"],
|
|
926
|
+
value: [1040],
|
|
927
|
+
maxSearchDays: [2, "max-search-days"],
|
|
928
|
+
goToRangeStartOnSelect: [4, "go-to-range-start-on-select"],
|
|
929
|
+
currentDate: [32],
|
|
930
|
+
hoveredDate: [32],
|
|
931
|
+
weekdays: [32]
|
|
932
|
+
}]), Ut = Pt;
|
|
933
|
+
var Wt = Object.defineProperty, v = (t, e, a, s) => {
|
|
934
|
+
for (var r = void 0, i = t.length - 1, n; i >= 0; i--)
|
|
935
|
+
(n = t[i]) && (r = n(e, a, r) || r);
|
|
936
|
+
return r && Wt(e, a, r), r;
|
|
937
|
+
};
|
|
938
|
+
customElements.get("wc-datepicker") || customElements.define("wc-datepicker", Ut);
|
|
939
|
+
let zt = 0;
|
|
940
|
+
var C;
|
|
941
|
+
const f = (C = class extends ze {
|
|
942
|
+
// allows use of elementInternals' API
|
|
943
|
+
constructor() {
|
|
944
|
+
super(), this.id = "", this.name = "", this.width = "md", this.hideTodayButton = !1, this.hideClearButton = !1, this.disabled = !1, this.required = !1, this.optional = !1, this.showError = !1, this.errorMessage = "", this.form = null, this.tooltip = "", this.type = "date", this.label = "", this.description = "", this.startDate = "", this.inverted = !1, this.value = void 0, this._hasUserInteracted = !1, this._internals = this.attachInternals();
|
|
945
|
+
}
|
|
946
|
+
// Generate a unique ID if one is not provided
|
|
947
|
+
connectedCallback() {
|
|
948
|
+
super.connectedCallback(), this.id || (this.id = `nys-datepicker-${Date.now()}-${zt++}`), this.addEventListener("invalid", this._handleInvalid), this.addEventListener("focusout", this._handleBlur);
|
|
949
|
+
}
|
|
950
|
+
disconnectedCallback() {
|
|
951
|
+
super.disconnectedCallback(), this.removeEventListener("invalid", this._handleInvalid), this.removeEventListener("focusout", this._handleBlur);
|
|
952
|
+
}
|
|
953
|
+
async firstUpdated() {
|
|
954
|
+
this._setValue(this.value), !(this._shouldUseNativeDatepicker() || !await this._whenWcDatepickerReady()) && (setTimeout(() => this._replaceButtonSVG(), 0), setTimeout(() => this._addMonthDropdownIcon(), 0), setTimeout(() => this._handleDateChange(), 0), setTimeout(() => this._onDocumentClick(), 0));
|
|
955
|
+
}
|
|
956
|
+
async _whenWcDatepickerReady() {
|
|
957
|
+
await customElements.whenDefined("wc-datepicker");
|
|
958
|
+
const e = this.shadowRoot?.querySelector(
|
|
959
|
+
"wc-datepicker"
|
|
960
|
+
);
|
|
961
|
+
return e ? ("updateComplete" in e && await e.updateComplete, await new Promise((a) => requestAnimationFrame(a)), e) : null;
|
|
962
|
+
}
|
|
963
|
+
/**
|
|
964
|
+
* Form Integration
|
|
965
|
+
* --------------------------------------------------------------------------
|
|
966
|
+
*/
|
|
967
|
+
/**
|
|
968
|
+
* Form helper methods:
|
|
969
|
+
* - _setValue: set internal value and trigger validation
|
|
970
|
+
* - _manageRequire: handle required state
|
|
971
|
+
* - _validate: actively validate and show errors
|
|
972
|
+
* - checkValidity: passive boolean check without UI
|
|
973
|
+
* - _setValidityMessage: sync validation message with UI and internals
|
|
974
|
+
* - _handleInvalid: handle form invalid event and focus first invalid field
|
|
975
|
+
*/
|
|
976
|
+
_setValue(e) {
|
|
977
|
+
if (!e) {
|
|
978
|
+
this.value = void 0, this._internals.setFormValue(""), this._manageRequire();
|
|
979
|
+
return;
|
|
980
|
+
}
|
|
981
|
+
const a = e instanceof Date ? e : this._parseLocalDate(e), s = [
|
|
982
|
+
a.getFullYear(),
|
|
983
|
+
String(a.getMonth() + 1).padStart(2, "0"),
|
|
984
|
+
String(a.getDate()).padStart(2, "0")
|
|
985
|
+
].join("-");
|
|
986
|
+
this.value = a, this._internals.setFormValue(s);
|
|
987
|
+
const r = this.shadowRoot?.querySelector("input");
|
|
988
|
+
r && (r.value = s);
|
|
989
|
+
const i = this.shadowRoot?.querySelector("wc-datepicker");
|
|
990
|
+
i && (i.value = a), this._manageRequire();
|
|
991
|
+
}
|
|
992
|
+
// Called to internally set the initial internalElement required flag.
|
|
993
|
+
_manageRequire() {
|
|
994
|
+
const e = this.shadowRoot?.querySelector("input");
|
|
995
|
+
if (!e) return;
|
|
996
|
+
const a = this.errorMessage || "This field is required.";
|
|
997
|
+
this.required && !this.value ? (this._internals.ariaRequired = "true", this._internals.setValidity({ valueMissing: !0 }, a, e)) : (this._internals.ariaRequired = "false", this._internals.setValidity({}));
|
|
998
|
+
}
|
|
999
|
+
/**
|
|
1000
|
+
* Actively validates the component:
|
|
1001
|
+
* - Updates internal validity state
|
|
1002
|
+
* - Updates UI (e.g. showError)
|
|
1003
|
+
* - Called on blur/change or form submission
|
|
1004
|
+
*/
|
|
1005
|
+
_validate() {
|
|
1006
|
+
const e = this.shadowRoot?.querySelector("input");
|
|
1007
|
+
if (!e) return;
|
|
1008
|
+
this._manageRequire();
|
|
1009
|
+
const a = e.validationMessage;
|
|
1010
|
+
this._setValidityMessage(a);
|
|
1011
|
+
}
|
|
1012
|
+
/**
|
|
1013
|
+
* Passive check of validity:
|
|
1014
|
+
* - Returns true/false
|
|
1015
|
+
* - Does NOT update UI or show errors
|
|
1016
|
+
* - Used in form submission checks
|
|
1017
|
+
*/
|
|
1018
|
+
checkValidity() {
|
|
1019
|
+
const e = this.shadowRoot?.querySelector("input");
|
|
1020
|
+
return e ? e.checkValidity() : !0;
|
|
1021
|
+
}
|
|
1022
|
+
// Sets custom validity message
|
|
1023
|
+
_setValidityMessage(e = "") {
|
|
1024
|
+
if (!this._internals) return;
|
|
1025
|
+
const a = this.shadowRoot?.querySelector("input");
|
|
1026
|
+
a && (this.showError = !!e, this.errorMessage?.trim() && e !== "" && (e = this.errorMessage), this._internals.setValidity(
|
|
1027
|
+
e ? { customError: !0 } : {},
|
|
1028
|
+
e,
|
|
1029
|
+
a
|
|
1030
|
+
));
|
|
1031
|
+
}
|
|
1032
|
+
// Handles native 'invalid' events
|
|
1033
|
+
_handleInvalid(e) {
|
|
1034
|
+
e.preventDefault(), this._hasUserInteracted = !0, this._validate();
|
|
1035
|
+
const a = this.shadowRoot?.querySelector("input");
|
|
1036
|
+
if (a) {
|
|
1037
|
+
const s = this._internals.form;
|
|
1038
|
+
s ? Array.from(s.elements).find(
|
|
1039
|
+
(n) => typeof n.checkValidity == "function" && !n.checkValidity()
|
|
1040
|
+
) === this && a.focus() : a.focus();
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
/**
|
|
1044
|
+
* Functions
|
|
1045
|
+
* --------------------------------------------------------------------------
|
|
1046
|
+
*/
|
|
1047
|
+
/**
|
|
1048
|
+
* Replaces the default wc-datepicker month navigation buttons
|
|
1049
|
+
* with NYS icon components for previous and next month.
|
|
1050
|
+
*/
|
|
1051
|
+
_replaceButtonSVG() {
|
|
1052
|
+
const e = this.shadowRoot?.querySelector("wc-datepicker");
|
|
1053
|
+
if (!e) return;
|
|
1054
|
+
const a = e.querySelector(
|
|
1055
|
+
".wc-datepicker__next-month-button"
|
|
1056
|
+
), s = e.querySelector(
|
|
1057
|
+
".wc-datepicker__previous-month-button"
|
|
1058
|
+
);
|
|
1059
|
+
!a || !s || (s.innerHTML = `
|
|
1060
|
+
<nys-icon name="arrow_back" size="18"></nys-icon>
|
|
1061
|
+
`, a.innerHTML = `
|
|
1062
|
+
<nys-icon name="arrow_forward" size="18"></nys-icon>
|
|
1063
|
+
`);
|
|
1064
|
+
}
|
|
1065
|
+
_addMonthDropdownIcon() {
|
|
1066
|
+
const e = this.shadowRoot?.querySelector("wc-datepicker");
|
|
1067
|
+
if (!e) return;
|
|
1068
|
+
const a = e.querySelector(
|
|
1069
|
+
".wc-datepicker__month-select"
|
|
1070
|
+
);
|
|
1071
|
+
if (a && !a.parentElement?.classList.contains("month-wrapper")) {
|
|
1072
|
+
const s = document.createElement("span");
|
|
1073
|
+
s.className = "month-wrapper", a.parentNode?.insertBefore(s, a), s.appendChild(a);
|
|
1074
|
+
const r = document.createElement("nys-icon");
|
|
1075
|
+
r.setAttribute("name", "chevron_down"), r.setAttribute("id", "wc-month-dropdown-icon"), r.setAttribute("size", "20"), s.appendChild(r);
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
// Creates a Date at local midnight to avoid UTC timezone shifting
|
|
1079
|
+
_parseLocalDate(e) {
|
|
1080
|
+
const [a, s, r] = e.split("-").map(Number);
|
|
1081
|
+
return new Date(a, s - 1, r);
|
|
1082
|
+
}
|
|
1083
|
+
/**
|
|
1084
|
+
* Event Handlers
|
|
1085
|
+
* --------------------------------------------------------------------------
|
|
1086
|
+
*/
|
|
1087
|
+
_handleInputKeydown(e) {
|
|
1088
|
+
this.disabled || this._shouldUseNativeDatepicker() || (e.key == " " || e.code == "Space") && (e.preventDefault(), this._openDatepicker());
|
|
1089
|
+
}
|
|
1090
|
+
_handleBlur(e) {
|
|
1091
|
+
const a = e.relatedTarget;
|
|
1092
|
+
if (a && (this.contains(a) || this.shadowRoot?.contains(a))) return;
|
|
1093
|
+
this._hasUserInteracted || (this._hasUserInteracted = !0), this.shadowRoot?.querySelector("wc-datepicker")?.classList.remove("active"), this._validate(), this.dispatchEvent(new Event("nys-blur"));
|
|
1094
|
+
}
|
|
1095
|
+
// For when users click outside of the datepicker, we remove the calendar popup
|
|
1096
|
+
_onDocumentClick() {
|
|
1097
|
+
if (this._shouldUseNativeDatepicker()) return;
|
|
1098
|
+
const e = (a) => {
|
|
1099
|
+
const s = a.composedPath(), r = this.shadowRoot?.querySelector(
|
|
1100
|
+
".nys-datepicker--input-container"
|
|
1101
|
+
), i = this.shadowRoot?.querySelector(
|
|
1102
|
+
".wc-datepicker--container"
|
|
1103
|
+
), n = this.shadowRoot?.querySelector("wc-datepicker");
|
|
1104
|
+
r && s.includes(r) || i && s.includes(i) || n && s.includes(n) || n?.classList.remove("active");
|
|
1105
|
+
};
|
|
1106
|
+
document.addEventListener("click", e);
|
|
1107
|
+
}
|
|
1108
|
+
_toggleDatepicker() {
|
|
1109
|
+
if (this.disabled) return;
|
|
1110
|
+
if (this._shouldUseNativeDatepicker()) {
|
|
1111
|
+
const a = this.shadowRoot?.querySelector(
|
|
1112
|
+
"input"
|
|
1113
|
+
);
|
|
1114
|
+
a && a.focus();
|
|
1115
|
+
return;
|
|
1116
|
+
}
|
|
1117
|
+
this.shadowRoot?.querySelector("wc-datepicker")?.classList.toggle("active");
|
|
1118
|
+
}
|
|
1119
|
+
_openDatepicker() {
|
|
1120
|
+
if (this.disabled || this._shouldUseNativeDatepicker()) return;
|
|
1121
|
+
this.shadowRoot?.querySelector("wc-datepicker")?.classList.add("active");
|
|
1122
|
+
}
|
|
1123
|
+
_handleDateChange() {
|
|
1124
|
+
const e = this.shadowRoot?.querySelector("wc-datepicker");
|
|
1125
|
+
e && e.addEventListener("selectDate", (a) => {
|
|
1126
|
+
const s = a.detail, r = this._parseLocalDate(s);
|
|
1127
|
+
this._setValue(r), this._validate(), e.classList.remove("active");
|
|
1128
|
+
});
|
|
1129
|
+
}
|
|
1130
|
+
_handleTodayClick() {
|
|
1131
|
+
if (this.disabled) return;
|
|
1132
|
+
const e = /* @__PURE__ */ new Date();
|
|
1133
|
+
e.setHours(0, 0, 0, 0), this._setValue(e), this._hasUserInteracted && this._validate();
|
|
1134
|
+
}
|
|
1135
|
+
_handleClearClick() {
|
|
1136
|
+
if (this.disabled) return;
|
|
1137
|
+
this.value = void 0, this._internals.setFormValue("");
|
|
1138
|
+
const e = this.shadowRoot?.querySelector("input");
|
|
1139
|
+
e && (e.value = ""), this._hasUserInteracted && this._validate();
|
|
1140
|
+
}
|
|
1141
|
+
_handleInputChange(e) {
|
|
1142
|
+
const a = e.target;
|
|
1143
|
+
if (!a) return;
|
|
1144
|
+
const s = this._getValidDateFromInput(a.value);
|
|
1145
|
+
s && (this._setValue(s), this._hasUserInteracted && this._validate(), this.dispatchEvent(
|
|
1146
|
+
new CustomEvent("nys-input", {
|
|
1147
|
+
detail: { id: this.id, value: this.value },
|
|
1148
|
+
bubbles: !0,
|
|
1149
|
+
composed: !0
|
|
1150
|
+
})
|
|
1151
|
+
));
|
|
1152
|
+
}
|
|
1153
|
+
_getValidDateFromInput(e) {
|
|
1154
|
+
const s = /^(\d{4})-(\d{2})-(\d{2})$/.exec(e);
|
|
1155
|
+
return !s || Number(s[1]) < 1e3 ? null : this._parseLocalDate(e);
|
|
1156
|
+
}
|
|
1157
|
+
_isSafari() {
|
|
1158
|
+
const e = navigator.userAgent;
|
|
1159
|
+
return /Safari/.test(e) && !/Chrome|Chromium|Edg/.test(e);
|
|
1160
|
+
}
|
|
1161
|
+
/**
|
|
1162
|
+
* Determines whether the current device uses a coarse pointer.
|
|
1163
|
+
* A coarse pointer usually means touch-based input where precise pointing
|
|
1164
|
+
* is not expected, such as fingers on phones and most tablets.
|
|
1165
|
+
*
|
|
1166
|
+
* Note: This is not a guarantee of a mobile device.
|
|
1167
|
+
* Some non-mobile devices may also report a coarse pointer,
|
|
1168
|
+
* and some mobile devices may not.
|
|
1169
|
+
*
|
|
1170
|
+
* @returns `true` if the device reports a coarse pointer, otherwise `false`.
|
|
1171
|
+
*/
|
|
1172
|
+
_isMobile() {
|
|
1173
|
+
return window.matchMedia("(pointer: coarse)").matches;
|
|
1174
|
+
}
|
|
1175
|
+
_shouldUseNativeDatepicker() {
|
|
1176
|
+
return this._isSafari() || this._isMobile();
|
|
1177
|
+
}
|
|
1178
|
+
render() {
|
|
1179
|
+
const e = this._shouldUseNativeDatepicker();
|
|
1180
|
+
return O` <div class="nys-datepicker--container">
|
|
1181
|
+
<nys-label
|
|
1182
|
+
for=${this.id + "--native"}
|
|
1183
|
+
label=${this.label}
|
|
1184
|
+
description=${this.description}
|
|
1185
|
+
flag=${this.required ? "required" : this.optional ? "optional" : ""}
|
|
1186
|
+
tooltip=${this.tooltip}
|
|
1187
|
+
?inverted=${this.inverted}
|
|
1188
|
+
></nys-label>
|
|
1189
|
+
<div
|
|
1190
|
+
class="nys-datepicker--input-container ${this.disabled ? "disabled" : ""}"
|
|
1191
|
+
>
|
|
1192
|
+
<input
|
|
1193
|
+
id="nys-datepicker--input"
|
|
1194
|
+
type="date"
|
|
1195
|
+
max="9999-12-31"
|
|
1196
|
+
?required=${this.required}
|
|
1197
|
+
.value=${this.value instanceof Date ? this.value.toISOString().split("T")[0] : this.value || ""}
|
|
1198
|
+
?disabled=${this.disabled}
|
|
1199
|
+
aria-disabled=${A(this.disabled ? "true" : void 0)}
|
|
1200
|
+
aria-required=${A(this.required ? "true" : void 0)}
|
|
1201
|
+
aria-label=${A(this.label || void 0)}
|
|
1202
|
+
aria-description=${A(this.description || void 0)}
|
|
1203
|
+
@click=${this._openDatepicker}
|
|
1204
|
+
@input=${this._handleInputChange}
|
|
1205
|
+
@blur=${this._handleBlur}
|
|
1206
|
+
@keydown=${this._handleInputKeydown}
|
|
1207
|
+
/>
|
|
1208
|
+
${e ? null : O`
|
|
1209
|
+
<button
|
|
1210
|
+
id="calendar-button"
|
|
1211
|
+
@click=${this._toggleDatepicker}
|
|
1212
|
+
tabindex=${this.disabled ? "-1" : "0"}
|
|
1213
|
+
?disabled=${this.disabled}
|
|
1214
|
+
aria-label="Open calendar"
|
|
1215
|
+
>
|
|
1216
|
+
<nys-icon name="calendar_month" size="24"></nys-icon>
|
|
1217
|
+
</button>
|
|
1218
|
+
`}
|
|
1219
|
+
</div>
|
|
1220
|
+
|
|
1221
|
+
<div class="wc-datepicker--container">
|
|
1222
|
+
<wc-datepicker
|
|
1223
|
+
.value=${this.value instanceof Date ? this.value : this.value ? this._parseLocalDate(this.value) : void 0}
|
|
1224
|
+
?disabled=${this.disabled}
|
|
1225
|
+
start-date=${A(this.startDate ? this.startDate : void 0)}
|
|
1226
|
+
>
|
|
1227
|
+
${!this.hideTodayButton || !this.hideClearButton ? O`
|
|
1228
|
+
<div class="wc-datepicker--button-container">
|
|
1229
|
+
${this.hideTodayButton ? null : O`
|
|
1230
|
+
<nys-button
|
|
1231
|
+
label="Today"
|
|
1232
|
+
size="sm"
|
|
1233
|
+
fullWidth
|
|
1234
|
+
variant="outline"
|
|
1235
|
+
?disabled=${this.disabled}
|
|
1236
|
+
@nys-click=${this._handleTodayClick}
|
|
1237
|
+
></nys-button>
|
|
1238
|
+
`}
|
|
1239
|
+
${this.hideClearButton ? null : O`
|
|
1240
|
+
<nys-button
|
|
1241
|
+
label="Clear"
|
|
1242
|
+
size="sm"
|
|
1243
|
+
fullWidth
|
|
1244
|
+
variant="outline"
|
|
1245
|
+
?disabled=${this.disabled}
|
|
1246
|
+
@nys-click=${this._handleClearClick}
|
|
1247
|
+
></nys-button>
|
|
1248
|
+
`}
|
|
1249
|
+
</div>
|
|
1250
|
+
` : null}
|
|
1251
|
+
</wc-datepicker>
|
|
1252
|
+
</div>
|
|
1253
|
+
</div>
|
|
1254
|
+
<nys-errormessage
|
|
1255
|
+
?showError=${this.showError}
|
|
1256
|
+
errorMessage=${this._internals.validationMessage || this.errorMessage}
|
|
1257
|
+
></nys-errormessage>`;
|
|
1258
|
+
}
|
|
1259
|
+
}, C.styles = je(He), C.formAssociated = !0, C);
|
|
1260
|
+
v([
|
|
1261
|
+
g({ type: String, reflect: !0 })
|
|
1262
|
+
], f.prototype, "id");
|
|
1263
|
+
v([
|
|
1264
|
+
g({ type: String, reflect: !0 })
|
|
1265
|
+
], f.prototype, "name");
|
|
1266
|
+
v([
|
|
1267
|
+
g({ type: String, reflect: !0 })
|
|
1268
|
+
], f.prototype, "width");
|
|
1269
|
+
v([
|
|
1270
|
+
g({ type: Boolean })
|
|
1271
|
+
], f.prototype, "hideTodayButton");
|
|
1272
|
+
v([
|
|
1273
|
+
g({ type: Boolean })
|
|
1274
|
+
], f.prototype, "hideClearButton");
|
|
1275
|
+
v([
|
|
1276
|
+
g({ type: Boolean, reflect: !0 })
|
|
1277
|
+
], f.prototype, "disabled");
|
|
1278
|
+
v([
|
|
1279
|
+
g({ type: Boolean, reflect: !0 })
|
|
1280
|
+
], f.prototype, "required");
|
|
1281
|
+
v([
|
|
1282
|
+
g({ type: Boolean, reflect: !0 })
|
|
1283
|
+
], f.prototype, "optional");
|
|
1284
|
+
v([
|
|
1285
|
+
g({ type: Boolean, reflect: !0 })
|
|
1286
|
+
], f.prototype, "showError");
|
|
1287
|
+
v([
|
|
1288
|
+
g({ type: String })
|
|
1289
|
+
], f.prototype, "errorMessage");
|
|
1290
|
+
v([
|
|
1291
|
+
g({ type: String, reflect: !0 })
|
|
1292
|
+
], f.prototype, "form");
|
|
1293
|
+
v([
|
|
1294
|
+
g({ type: String })
|
|
1295
|
+
], f.prototype, "tooltip");
|
|
1296
|
+
v([
|
|
1297
|
+
g({ type: String })
|
|
1298
|
+
], f.prototype, "type");
|
|
1299
|
+
v([
|
|
1300
|
+
g({ type: String })
|
|
1301
|
+
], f.prototype, "label");
|
|
1302
|
+
v([
|
|
1303
|
+
g({ type: String })
|
|
1304
|
+
], f.prototype, "description");
|
|
1305
|
+
v([
|
|
1306
|
+
g({ type: String })
|
|
1307
|
+
], f.prototype, "startDate");
|
|
1308
|
+
v([
|
|
1309
|
+
g({ type: Boolean, reflect: !0 })
|
|
1310
|
+
], f.prototype, "inverted");
|
|
1311
|
+
v([
|
|
1312
|
+
g({
|
|
1313
|
+
type: Object,
|
|
1314
|
+
converter: {
|
|
1315
|
+
fromAttribute: (t) => t ? f.prototype._parseLocalDate(t) : void 0,
|
|
1316
|
+
toAttribute: (t) => t ? typeof t == "string" ? t : t.toISOString().split("T")[0] : ""
|
|
1317
|
+
}
|
|
1318
|
+
})
|
|
1319
|
+
], f.prototype, "value");
|
|
1320
|
+
let jt = f;
|
|
1321
|
+
customElements.get("nys-datepicker") || customElements.define("nys-datepicker", jt);
|
|
1322
|
+
export {
|
|
1323
|
+
jt as NysDatepicker
|
|
1324
|
+
};
|
|
1325
|
+
//# sourceMappingURL=nys-datepicker.js.map
|