calkit 0.1.0 → 0.2.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/README.md +1 -1
- package/dist/booking.es.js +421 -318
- package/dist/booking.es.js.map +1 -1
- package/dist/booking.umd.js +12 -12
- package/dist/booking.umd.js.map +1 -1
- package/dist/calkit.d.ts +453 -0
- package/dist/calkit.es.js +1101 -898
- package/dist/calkit.es.js.map +1 -1
- package/dist/calkit.umd.js +34 -34
- package/dist/calkit.umd.js.map +1 -1
- package/dist/datepicker.es.js +333 -241
- package/dist/datepicker.es.js.map +1 -1
- package/dist/datepicker.umd.js +12 -12
- package/dist/datepicker.umd.js.map +1 -1
- package/dist/scheduler.es.js +705 -638
- package/dist/scheduler.es.js.map +1 -1
- package/dist/scheduler.umd.js +20 -20
- package/dist/scheduler.umd.js.map +1 -1
- package/dist/timepicker.es.js +146 -116
- package/dist/timepicker.es.js.map +1 -1
- package/dist/timepicker.umd.js +6 -6
- package/dist/timepicker.umd.js.map +1 -1
- package/llms.txt +1 -1
- package/package.json +4 -2
package/dist/booking.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class ge extends HTMLElement {
|
|
2
2
|
constructor() {
|
|
3
3
|
super(), this.attachShadow({ mode: "open" }), this._initialized = !1;
|
|
4
4
|
}
|
|
@@ -27,6 +27,9 @@ class ce extends HTMLElement {
|
|
|
27
27
|
/** Subclasses override to update Shadow DOM. */
|
|
28
28
|
render() {
|
|
29
29
|
}
|
|
30
|
+
/** Reset selection state. Subclasses should override with specific logic. */
|
|
31
|
+
clear() {
|
|
32
|
+
}
|
|
30
33
|
/** Dispatch a composed, bubbling custom event. */
|
|
31
34
|
emit(e, a = {}) {
|
|
32
35
|
this.dispatchEvent(
|
|
@@ -36,8 +39,8 @@ class ce extends HTMLElement {
|
|
|
36
39
|
/** Show an inline status banner. */
|
|
37
40
|
showStatus(e, a, t = {}) {
|
|
38
41
|
if (!this._store) return;
|
|
39
|
-
const { autoDismiss: n, dismissible:
|
|
40
|
-
clearTimeout(this._statusTimer), this._store.set({ statusType: e, statusMessage: a, statusDismissible:
|
|
42
|
+
const { autoDismiss: n, dismissible: r = !0 } = t;
|
|
43
|
+
clearTimeout(this._statusTimer), this._store.set({ statusType: e, statusMessage: a, statusDismissible: r }), this.emit("cal:status", { type: e, message: a }), n && n > 0 && (this._statusTimer = setTimeout(() => this.clearStatus(), n));
|
|
41
44
|
}
|
|
42
45
|
/** Clear the status banner. */
|
|
43
46
|
clearStatus() {
|
|
@@ -51,7 +54,7 @@ class ce extends HTMLElement {
|
|
|
51
54
|
return this.shadowRoot.querySelectorAll(e);
|
|
52
55
|
}
|
|
53
56
|
}
|
|
54
|
-
function
|
|
57
|
+
function he(s) {
|
|
55
58
|
let e = { ...s };
|
|
56
59
|
const a = /* @__PURE__ */ new Set();
|
|
57
60
|
return {
|
|
@@ -61,14 +64,14 @@ function de(s) {
|
|
|
61
64
|
set(t) {
|
|
62
65
|
const n = e;
|
|
63
66
|
e = { ...e, ...t };
|
|
64
|
-
let
|
|
65
|
-
for (const
|
|
66
|
-
if (n[
|
|
67
|
-
|
|
67
|
+
let r = !1;
|
|
68
|
+
for (const i of Object.keys(t))
|
|
69
|
+
if (n[i] !== e[i]) {
|
|
70
|
+
r = !0;
|
|
68
71
|
break;
|
|
69
72
|
}
|
|
70
|
-
if (
|
|
71
|
-
for (const
|
|
73
|
+
if (r)
|
|
74
|
+
for (const i of a) i(e, n);
|
|
72
75
|
},
|
|
73
76
|
getState() {
|
|
74
77
|
return e;
|
|
@@ -78,7 +81,7 @@ function de(s) {
|
|
|
78
81
|
}
|
|
79
82
|
};
|
|
80
83
|
}
|
|
81
|
-
const
|
|
84
|
+
const Q = [
|
|
82
85
|
"January",
|
|
83
86
|
"February",
|
|
84
87
|
"March",
|
|
@@ -91,17 +94,78 @@ const J = [
|
|
|
91
94
|
"October",
|
|
92
95
|
"November",
|
|
93
96
|
"December"
|
|
94
|
-
],
|
|
95
|
-
function
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
e.
|
|
99
|
-
|
|
97
|
+
], be = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
|
|
98
|
+
function me(s) {
|
|
99
|
+
if (!s) return Q;
|
|
100
|
+
try {
|
|
101
|
+
const e = new Intl.DateTimeFormat(s, { month: "long" });
|
|
102
|
+
return Array.from({ length: 12 }, (a, t) => {
|
|
103
|
+
const n = e.format(new Date(2024, t, 1));
|
|
104
|
+
return n.charAt(0).toUpperCase() + n.slice(1);
|
|
105
|
+
});
|
|
106
|
+
} catch {
|
|
107
|
+
return Q;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function se(s) {
|
|
111
|
+
if (!s)
|
|
112
|
+
return [
|
|
113
|
+
"Jan",
|
|
114
|
+
"Feb",
|
|
115
|
+
"Mar",
|
|
116
|
+
"Apr",
|
|
117
|
+
"May",
|
|
118
|
+
"Jun",
|
|
119
|
+
"Jul",
|
|
120
|
+
"Aug",
|
|
121
|
+
"Sep",
|
|
122
|
+
"Oct",
|
|
123
|
+
"Nov",
|
|
124
|
+
"Dec"
|
|
125
|
+
];
|
|
126
|
+
try {
|
|
127
|
+
const e = new Intl.DateTimeFormat(s, { month: "short" });
|
|
128
|
+
return Array.from({ length: 12 }, (a, t) => {
|
|
129
|
+
const n = e.format(new Date(2024, t, 1));
|
|
130
|
+
return n.charAt(0).toUpperCase() + n.slice(1);
|
|
131
|
+
});
|
|
132
|
+
} catch {
|
|
133
|
+
return [
|
|
134
|
+
"Jan",
|
|
135
|
+
"Feb",
|
|
136
|
+
"Mar",
|
|
137
|
+
"Apr",
|
|
138
|
+
"May",
|
|
139
|
+
"Jun",
|
|
140
|
+
"Jul",
|
|
141
|
+
"Aug",
|
|
142
|
+
"Sep",
|
|
143
|
+
"Oct",
|
|
144
|
+
"Nov",
|
|
145
|
+
"Dec"
|
|
146
|
+
];
|
|
147
|
+
}
|
|
100
148
|
}
|
|
101
|
-
function
|
|
149
|
+
function fe(s = 0, e) {
|
|
150
|
+
if (e)
|
|
151
|
+
try {
|
|
152
|
+
const t = new Intl.DateTimeFormat(e, { weekday: "short" }), n = [];
|
|
153
|
+
for (let r = 0; r < 7; r++) {
|
|
154
|
+
const i = new Date(2024, 0, 7 + (s + r) % 7), o = t.format(i);
|
|
155
|
+
n.push(o.charAt(0).toUpperCase() + o.slice(1));
|
|
156
|
+
}
|
|
157
|
+
return n;
|
|
158
|
+
} catch {
|
|
159
|
+
}
|
|
160
|
+
const a = [];
|
|
161
|
+
for (let t = 0; t < 7; t++)
|
|
162
|
+
a.push(be[(s + t) % 7]);
|
|
163
|
+
return a;
|
|
164
|
+
}
|
|
165
|
+
function Z(s, e) {
|
|
102
166
|
return new Date(s, e + 1, 0).getDate();
|
|
103
167
|
}
|
|
104
|
-
function
|
|
168
|
+
function pe(s, e) {
|
|
105
169
|
return new Date(s, e, 1).getDay();
|
|
106
170
|
}
|
|
107
171
|
function T(s) {
|
|
@@ -109,7 +173,7 @@ function T(s) {
|
|
|
109
173
|
const e = s instanceof Date ? s : new Date(s.year, s.month, s.day), a = e.getFullYear(), t = String(e.getMonth() + 1).padStart(2, "0"), n = String(e.getDate()).padStart(2, "0");
|
|
110
174
|
return `${a}-${t}-${n}`;
|
|
111
175
|
}
|
|
112
|
-
function
|
|
176
|
+
function D(s) {
|
|
113
177
|
if (!s) return null;
|
|
114
178
|
if (s instanceof Date) return s;
|
|
115
179
|
if (typeof s == "string") {
|
|
@@ -118,55 +182,55 @@ function M(s) {
|
|
|
118
182
|
}
|
|
119
183
|
return null;
|
|
120
184
|
}
|
|
121
|
-
function
|
|
185
|
+
function z(s, e) {
|
|
122
186
|
if (!s || !e) return !1;
|
|
123
|
-
const a =
|
|
187
|
+
const a = D(s), t = D(e);
|
|
124
188
|
return !a || !t ? !1 : a.getFullYear() === t.getFullYear() && a.getMonth() === t.getMonth() && a.getDate() === t.getDate();
|
|
125
189
|
}
|
|
126
|
-
function
|
|
190
|
+
function ve(s, e, a) {
|
|
127
191
|
if (!s || !e || !a) return !1;
|
|
128
|
-
const t =
|
|
129
|
-
if (!t || !n || !
|
|
130
|
-
const
|
|
131
|
-
return
|
|
192
|
+
const t = D(s), n = D(e), r = D(a);
|
|
193
|
+
if (!t || !n || !r) return !1;
|
|
194
|
+
const i = t.getTime(), o = Math.min(n.getTime(), r.getTime()), l = Math.max(n.getTime(), r.getTime());
|
|
195
|
+
return i >= o && i <= l;
|
|
132
196
|
}
|
|
133
|
-
function
|
|
197
|
+
function re() {
|
|
134
198
|
return T(/* @__PURE__ */ new Date());
|
|
135
199
|
}
|
|
136
|
-
function
|
|
200
|
+
function O(s, e, a) {
|
|
137
201
|
const t = new Date(s, e + a, 1);
|
|
138
202
|
return { year: t.getFullYear(), month: t.getMonth() };
|
|
139
203
|
}
|
|
140
|
-
function
|
|
141
|
-
const t =
|
|
142
|
-
for (let c =
|
|
143
|
-
const
|
|
144
|
-
|
|
204
|
+
function ye(s, e, a = 0) {
|
|
205
|
+
const t = Z(s, e), r = (pe(s, e) - a + 7) % 7, i = [], o = re(), l = O(s, e, -1), g = Z(l.year, l.month);
|
|
206
|
+
for (let c = r - 1; c >= 0; c--) {
|
|
207
|
+
const u = g - c, m = T({ year: l.year, month: l.month, day: u });
|
|
208
|
+
i.push({ year: l.year, month: l.month, day: u, dateString: m, isCurrentMonth: !1, isToday: m === o });
|
|
145
209
|
}
|
|
146
210
|
for (let c = 1; c <= t; c++) {
|
|
147
|
-
const
|
|
148
|
-
|
|
211
|
+
const u = T({ year: s, month: e, day: c });
|
|
212
|
+
i.push({ year: s, month: e, day: c, dateString: u, isCurrentMonth: !0, isToday: u === o });
|
|
149
213
|
}
|
|
150
|
-
const
|
|
151
|
-
let
|
|
152
|
-
for (;
|
|
153
|
-
const c = T({ year:
|
|
154
|
-
|
|
214
|
+
const h = O(s, e, 1);
|
|
215
|
+
let d = 1;
|
|
216
|
+
for (; i.length < 42; ) {
|
|
217
|
+
const c = T({ year: h.year, month: h.month, day: d });
|
|
218
|
+
i.push({ year: h.year, month: h.month, day: d, dateString: c, isCurrentMonth: !1, isToday: c === o }), d++;
|
|
155
219
|
}
|
|
156
|
-
return
|
|
220
|
+
return i;
|
|
157
221
|
}
|
|
158
|
-
function
|
|
222
|
+
function U(s) {
|
|
159
223
|
if (!s || typeof s != "string") return null;
|
|
160
224
|
const e = s.trim().toUpperCase(), a = e.match(/^(\d{1,2}):(\d{2})\s*(AM|PM)$/);
|
|
161
225
|
if (a) {
|
|
162
226
|
let n = parseInt(a[1], 10);
|
|
163
|
-
const
|
|
164
|
-
return
|
|
227
|
+
const r = parseInt(a[2], 10), i = a[3];
|
|
228
|
+
return i === "AM" && n === 12 && (n = 0), i === "PM" && n !== 12 && (n += 12), { hours: n, minutes: r };
|
|
165
229
|
}
|
|
166
230
|
const t = e.match(/^(\d{1,2}):(\d{2})$/);
|
|
167
231
|
return t ? { hours: parseInt(t[1], 10), minutes: parseInt(t[2], 10) } : null;
|
|
168
232
|
}
|
|
169
|
-
function
|
|
233
|
+
function X(s, e, a = "24h") {
|
|
170
234
|
const t = String(e).padStart(2, "0");
|
|
171
235
|
if (a === "12h") {
|
|
172
236
|
const n = s >= 12 ? "PM" : "AM";
|
|
@@ -175,32 +239,36 @@ function K(s, e, a = "24h") {
|
|
|
175
239
|
return `${String(s).padStart(2, "0")}:${t}`;
|
|
176
240
|
}
|
|
177
241
|
function A(s) {
|
|
178
|
-
const e =
|
|
242
|
+
const e = U(s);
|
|
179
243
|
return e ? e.hours * 60 + e.minutes : 0;
|
|
180
244
|
}
|
|
181
|
-
function
|
|
245
|
+
function q(s) {
|
|
182
246
|
const e = Math.floor(s / 60) % 24, a = s % 60;
|
|
183
247
|
return `${String(e).padStart(2, "0")}:${String(a).padStart(2, "0")}`;
|
|
184
248
|
}
|
|
185
|
-
function
|
|
186
|
-
const t = [], n = A(s)
|
|
187
|
-
|
|
188
|
-
|
|
249
|
+
function ke(s, e, a) {
|
|
250
|
+
const t = [], n = A(s);
|
|
251
|
+
let r = A(e);
|
|
252
|
+
r <= n && (r += 1440);
|
|
253
|
+
for (let i = n; i <= r; i += a)
|
|
254
|
+
t.push(q(i % 1440));
|
|
189
255
|
return t;
|
|
190
256
|
}
|
|
191
|
-
function
|
|
192
|
-
const n = [],
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
257
|
+
function _e(s, e, a, t = "24h") {
|
|
258
|
+
const n = [], r = A(s);
|
|
259
|
+
let i = A(e);
|
|
260
|
+
i <= r && (i += 1440);
|
|
261
|
+
for (let o = r; o <= i; o += a) {
|
|
262
|
+
const l = q(o % 1440), g = o + a, h = q(Math.min(g, i + a) % 1440), d = U(l), c = U(h), u = d ? X(d.hours, d.minutes, t) : l, m = c ? X(c.hours, c.minutes, t) : h;
|
|
263
|
+
n.push({ time: l, displayText: `${u}–${m}` });
|
|
196
264
|
}
|
|
197
265
|
return n;
|
|
198
266
|
}
|
|
199
|
-
function
|
|
200
|
-
const t = A(s), n = A(e),
|
|
201
|
-
return t >=
|
|
267
|
+
function ee(s, e, a) {
|
|
268
|
+
const t = A(s), n = A(e), r = A(a);
|
|
269
|
+
return r >= n ? t >= n && t <= r : t >= n || t <= r;
|
|
202
270
|
}
|
|
203
|
-
const
|
|
271
|
+
const we = `
|
|
204
272
|
:host {
|
|
205
273
|
/* Light theme (default) */
|
|
206
274
|
--cal-bg: 0 0% 100%;
|
|
@@ -368,7 +436,7 @@ const ve = `
|
|
|
368
436
|
--cal-status-success-border: 152 40% 28%;
|
|
369
437
|
}
|
|
370
438
|
}
|
|
371
|
-
`,
|
|
439
|
+
`, xe = `
|
|
372
440
|
:host {
|
|
373
441
|
display: inline-block;
|
|
374
442
|
font-family: inherit;
|
|
@@ -409,7 +477,7 @@ const ve = `
|
|
|
409
477
|
[hidden] {
|
|
410
478
|
display: none !important;
|
|
411
479
|
}
|
|
412
|
-
`,
|
|
480
|
+
`, Se = `
|
|
413
481
|
@keyframes cal-fade-in {
|
|
414
482
|
from { opacity: 0; }
|
|
415
483
|
to { opacity: 1; }
|
|
@@ -473,18 +541,18 @@ const ve = `
|
|
|
473
541
|
.cal-skeleton--rect {
|
|
474
542
|
border-radius: var(--cal-radius-sm);
|
|
475
543
|
}
|
|
476
|
-
`,
|
|
477
|
-
function
|
|
544
|
+
`, ie = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M10 12L6 8l4-4"/></svg>', oe = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M6 4l4 4-4 4"/></svg>';
|
|
545
|
+
function te({ year: s, month: e, onPrev: a, onNext: t, onTitleClick: n, locale: r }) {
|
|
478
546
|
const i = document.createElement("div");
|
|
479
547
|
i.classList.add("cal-nav");
|
|
480
|
-
const
|
|
481
|
-
|
|
482
|
-
const
|
|
483
|
-
|
|
484
|
-
const
|
|
485
|
-
return
|
|
548
|
+
const o = document.createElement("button");
|
|
549
|
+
o.classList.add("cal-nav__btn", "cal-nav__btn--prev"), o.innerHTML = ie, o.setAttribute("aria-label", "Previous month"), o.addEventListener("click", a);
|
|
550
|
+
const l = me(r), g = n ? "button" : "div", h = document.createElement(g);
|
|
551
|
+
h.classList.add("cal-nav__title"), n && (h.classList.add("cal-nav__title--interactive"), h.setAttribute("aria-label", `Select month and year, currently ${l[e]} ${s}`), h.addEventListener("click", n)), h.setAttribute("aria-live", "polite"), h.textContent = `${l[e]} ${s}`;
|
|
552
|
+
const d = document.createElement("button");
|
|
553
|
+
return d.classList.add("cal-nav__btn", "cal-nav__btn--next"), d.innerHTML = oe, d.setAttribute("aria-label", "Next month"), d.addEventListener("click", t), i.appendChild(o), i.appendChild(h), i.appendChild(d), i;
|
|
486
554
|
}
|
|
487
|
-
const
|
|
555
|
+
const Le = `
|
|
488
556
|
.cal-nav {
|
|
489
557
|
display: flex;
|
|
490
558
|
align-items: center;
|
|
@@ -525,51 +593,39 @@ const _e = `
|
|
|
525
593
|
.cal-nav__title--interactive:hover {
|
|
526
594
|
background: hsl(var(--cal-hover));
|
|
527
595
|
}
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
"Feb",
|
|
531
|
-
"Mar",
|
|
532
|
-
"Apr",
|
|
533
|
-
"May",
|
|
534
|
-
"Jun",
|
|
535
|
-
"Jul",
|
|
536
|
-
"Aug",
|
|
537
|
-
"Sep",
|
|
538
|
-
"Oct",
|
|
539
|
-
"Nov",
|
|
540
|
-
"Dec"
|
|
541
|
-
];
|
|
542
|
-
function we({
|
|
596
|
+
`;
|
|
597
|
+
function De({
|
|
543
598
|
pickerYear: s,
|
|
544
599
|
viewMonth: e,
|
|
545
600
|
viewYear: a,
|
|
546
601
|
onMonthSelect: t,
|
|
547
602
|
onYearPrev: n,
|
|
548
|
-
onYearNext:
|
|
549
|
-
onClose:
|
|
603
|
+
onYearNext: r,
|
|
604
|
+
onClose: i,
|
|
605
|
+
locale: o
|
|
550
606
|
}) {
|
|
551
|
-
const o = document.createElement("div");
|
|
552
|
-
o.classList.add("cal-myp", "cal-animate-fade");
|
|
553
607
|
const l = document.createElement("div");
|
|
554
|
-
l.classList.add("cal-
|
|
555
|
-
const
|
|
556
|
-
|
|
557
|
-
const
|
|
558
|
-
|
|
559
|
-
const
|
|
560
|
-
|
|
561
|
-
const c = document.createElement("
|
|
562
|
-
c.classList.add("cal-
|
|
563
|
-
const
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
608
|
+
l.classList.add("cal-myp", "cal-animate-fade");
|
|
609
|
+
const g = document.createElement("div");
|
|
610
|
+
g.classList.add("cal-myp__year-nav");
|
|
611
|
+
const h = document.createElement("button");
|
|
612
|
+
h.classList.add("cal-nav__btn"), h.innerHTML = ie, h.setAttribute("aria-label", "Previous year"), h.addEventListener("click", n);
|
|
613
|
+
const d = document.createElement("div");
|
|
614
|
+
d.classList.add("cal-myp__year-label"), d.textContent = s;
|
|
615
|
+
const c = document.createElement("button");
|
|
616
|
+
c.classList.add("cal-nav__btn"), c.innerHTML = oe, c.setAttribute("aria-label", "Next year"), c.addEventListener("click", r), g.appendChild(h), g.appendChild(d), g.appendChild(c), l.appendChild(g);
|
|
617
|
+
const u = document.createElement("div");
|
|
618
|
+
u.classList.add("cal-myp__grid");
|
|
619
|
+
const m = se(o), f = /* @__PURE__ */ new Date(), E = f.getMonth(), P = f.getFullYear();
|
|
620
|
+
for (let w = 0; w < 12; w++) {
|
|
621
|
+
const v = document.createElement("button");
|
|
622
|
+
v.classList.add("cal-myp__cell"), v.textContent = m[w], w === e && s === a && v.classList.add("cal-myp__cell--active"), w === E && s === P && v.classList.add("cal-myp__cell--today"), v.addEventListener("click", () => t(w, s)), u.appendChild(v);
|
|
623
|
+
}
|
|
624
|
+
return l.appendChild(u), l.addEventListener("keydown", (w) => {
|
|
625
|
+
w.key === "Escape" && (w.stopPropagation(), i());
|
|
626
|
+
}), l;
|
|
571
627
|
}
|
|
572
|
-
const
|
|
628
|
+
const Ee = `
|
|
573
629
|
.cal-myp {
|
|
574
630
|
width: calc(7 * var(--cal-cell-size));
|
|
575
631
|
}
|
|
@@ -628,37 +684,37 @@ const Se = `
|
|
|
628
684
|
font-weight: 600;
|
|
629
685
|
}
|
|
630
686
|
`;
|
|
631
|
-
function
|
|
687
|
+
function Me({ trigger: s, content: e, onClose: a }) {
|
|
632
688
|
const t = document.createElement("div");
|
|
633
689
|
t.classList.add("cal-popover"), t.setAttribute("role", "dialog"), t.setAttribute("aria-modal", "false"), t.style.display = "none", t.appendChild(e);
|
|
634
690
|
let n = !1;
|
|
635
|
-
function
|
|
691
|
+
function r() {
|
|
636
692
|
t.classList.remove("cal-popover--above");
|
|
637
|
-
const
|
|
638
|
-
|
|
693
|
+
const d = s.getBoundingClientRect(), c = t.offsetHeight, u = window.innerHeight - d.bottom, m = d.top;
|
|
694
|
+
u < c + 8 && m > u ? (t.classList.add("cal-popover--above"), t.style.top = "auto", t.style.bottom = "100%", t.style.marginBottom = "4px", t.style.marginTop = "0") : (t.style.top = "100%", t.style.bottom = "auto", t.style.marginTop = "4px", t.style.marginBottom = "0");
|
|
639
695
|
}
|
|
640
|
-
function
|
|
641
|
-
n || (n = !0, t.style.display = "", t.classList.add("cal-animate-slide-up"), requestAnimationFrame(() =>
|
|
696
|
+
function i() {
|
|
697
|
+
n || (n = !0, t.style.display = "", t.classList.add("cal-animate-slide-up"), requestAnimationFrame(() => r()), document.addEventListener("click", l, !0), document.addEventListener("keydown", g, !0));
|
|
642
698
|
}
|
|
643
699
|
function o() {
|
|
644
|
-
n && (n = !1, t.style.display = "none", t.classList.remove("cal-animate-slide-up"), document.removeEventListener("click", l, !0), document.removeEventListener("keydown",
|
|
700
|
+
n && (n = !1, t.style.display = "none", t.classList.remove("cal-animate-slide-up"), document.removeEventListener("click", l, !0), document.removeEventListener("keydown", g, !0), a == null || a());
|
|
645
701
|
}
|
|
646
|
-
function l(
|
|
647
|
-
var
|
|
648
|
-
const c = (
|
|
649
|
-
c && !c.contains(
|
|
702
|
+
function l(d) {
|
|
703
|
+
var u;
|
|
704
|
+
const c = (u = s.getRootNode()) == null ? void 0 : u.host;
|
|
705
|
+
c && !c.contains(d.target) && d.target !== c && o();
|
|
650
706
|
}
|
|
651
|
-
function
|
|
652
|
-
|
|
707
|
+
function g(d) {
|
|
708
|
+
d.key === "Escape" && (d.stopPropagation(), o());
|
|
653
709
|
}
|
|
654
|
-
function
|
|
655
|
-
n && (n = !1, t.style.display = "none", t.classList.remove("cal-animate-slide-up")), document.removeEventListener("click", l, !0), document.removeEventListener("keydown",
|
|
710
|
+
function h() {
|
|
711
|
+
n && (n = !1, t.style.display = "none", t.classList.remove("cal-animate-slide-up")), document.removeEventListener("click", l, !0), document.removeEventListener("keydown", g, !0);
|
|
656
712
|
}
|
|
657
|
-
return { panel: t, open:
|
|
713
|
+
return { panel: t, open: i, close: o, destroy: h, get isOpen() {
|
|
658
714
|
return n;
|
|
659
715
|
} };
|
|
660
716
|
}
|
|
661
|
-
const
|
|
717
|
+
const Ce = `
|
|
662
718
|
.cal-popover-wrapper {
|
|
663
719
|
position: relative;
|
|
664
720
|
display: inline-block;
|
|
@@ -703,124 +759,137 @@ const Ee = `
|
|
|
703
759
|
display: flex;
|
|
704
760
|
color: hsl(var(--cal-fg-muted));
|
|
705
761
|
}
|
|
706
|
-
`,
|
|
762
|
+
`, ae = {
|
|
707
763
|
blue: { bg: "var(--cal-booking-blue-bg)", fg: "var(--cal-booking-blue-fg)", hover: "var(--cal-booking-blue-hover)" },
|
|
708
764
|
green: { bg: "var(--cal-booking-green-bg)", fg: "var(--cal-booking-green-fg)", hover: "var(--cal-booking-green-hover)" },
|
|
709
765
|
red: { bg: "var(--cal-booking-red-bg)", fg: "var(--cal-booking-red-fg)", hover: "var(--cal-booking-red-hover)" },
|
|
710
766
|
orange: { bg: "var(--cal-booking-orange-bg)", fg: "var(--cal-booking-orange-fg)", hover: "var(--cal-booking-orange-hover)" },
|
|
711
767
|
gray: { bg: "var(--cal-booking-gray-bg)", fg: "var(--cal-booking-gray-fg)", hover: "var(--cal-booking-gray-hover)" }
|
|
712
|
-
},
|
|
713
|
-
function
|
|
714
|
-
return
|
|
768
|
+
}, Y = "blue";
|
|
769
|
+
function F(s, e) {
|
|
770
|
+
return e && e[s] ? e[s] : ae[s] || ae[Y];
|
|
715
771
|
}
|
|
716
|
-
function
|
|
717
|
-
|
|
718
|
-
|
|
772
|
+
function Te(s) {
|
|
773
|
+
if (!Array.isArray(s) || !s.length) return null;
|
|
774
|
+
const e = {};
|
|
775
|
+
for (const a of s)
|
|
776
|
+
!a.name || !a.bg || !a.fg || (e[a.name] = {
|
|
777
|
+
bg: a.bg,
|
|
778
|
+
fg: a.fg,
|
|
779
|
+
hover: a.hover || a.bg
|
|
780
|
+
});
|
|
781
|
+
return Object.keys(e).length ? e : null;
|
|
782
|
+
}
|
|
783
|
+
function Ae(s, e = [], a = {}, t = null, n = null) {
|
|
784
|
+
const r = e.find((f) => f.end === s), i = e.find((f) => f.start === s), o = e.find(
|
|
785
|
+
(f) => f.start < s && f.end > s
|
|
719
786
|
);
|
|
720
|
-
let
|
|
721
|
-
|
|
722
|
-
const
|
|
723
|
-
if (
|
|
724
|
-
const
|
|
725
|
-
|
|
726
|
-
}
|
|
727
|
-
return { status:
|
|
787
|
+
let l = "available", g = null, h = !1, d = null, c = null, u = null;
|
|
788
|
+
r && i ? (l = "half-day", h = !0, d = F(r.color || Y, n), c = F(i.color || Y, n)) : o ? (l = "booked", u = F(o.color || Y, n)) : i && !r ? (l = "checkin-only", c = F(i.color || Y, n)) : r && !i && (l = "checkout-only", d = F(r.color || Y, n));
|
|
789
|
+
const m = a[s];
|
|
790
|
+
if (m && (m.status && (l = m.status), m.label !== void 0 && (g = m.label)), t) {
|
|
791
|
+
const f = t(s);
|
|
792
|
+
f && (f.status && (l = f.status), f.label !== void 0 && (g = f.label));
|
|
793
|
+
}
|
|
794
|
+
return { status: l, label: g, checkoutBooking: r, checkinBooking: i, halfDay: h, colorOut: d, colorIn: c, colorFull: u };
|
|
728
795
|
}
|
|
729
|
-
function
|
|
796
|
+
function le(s, e, a = []) {
|
|
730
797
|
if (!s || !e) return !0;
|
|
731
798
|
const t = s < e ? s : e, n = s < e ? e : s;
|
|
732
|
-
for (const
|
|
733
|
-
if (t <
|
|
799
|
+
for (const r of a)
|
|
800
|
+
if (t < r.end && n > r.start)
|
|
734
801
|
return !1;
|
|
735
802
|
return !0;
|
|
736
803
|
}
|
|
737
|
-
function
|
|
738
|
-
return !s || !e ? !1 : !
|
|
804
|
+
function Pe(s, e, a = []) {
|
|
805
|
+
return !s || !e ? !1 : !le(s, e, a);
|
|
739
806
|
}
|
|
740
|
-
function
|
|
807
|
+
function $e(s) {
|
|
741
808
|
const {
|
|
742
809
|
year: e,
|
|
743
810
|
month: a,
|
|
744
811
|
firstDay: t = 0,
|
|
745
812
|
selectedDates: n = [],
|
|
746
|
-
rangeStart:
|
|
747
|
-
rangeEnd:
|
|
813
|
+
rangeStart: r,
|
|
814
|
+
rangeEnd: i,
|
|
748
815
|
hoverDate: o,
|
|
749
816
|
minDate: l,
|
|
750
|
-
maxDate:
|
|
751
|
-
disabledDates:
|
|
752
|
-
mode:
|
|
817
|
+
maxDate: g,
|
|
818
|
+
disabledDates: h = [],
|
|
819
|
+
mode: d = "single",
|
|
753
820
|
focusedDate: c,
|
|
754
|
-
onSelect:
|
|
755
|
-
onHover:
|
|
821
|
+
onSelect: u,
|
|
822
|
+
onHover: m,
|
|
756
823
|
// Booking-specific params
|
|
757
|
-
bookings:
|
|
758
|
-
dayData:
|
|
759
|
-
labelFormula:
|
|
760
|
-
showLabelsOnHover:
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
824
|
+
bookings: f = null,
|
|
825
|
+
dayData: E = null,
|
|
826
|
+
labelFormula: P = null,
|
|
827
|
+
showLabelsOnHover: w = !1,
|
|
828
|
+
locale: v,
|
|
829
|
+
customColors: M = null
|
|
830
|
+
} = s, k = f !== null, $ = document.createElement("div");
|
|
831
|
+
$.setAttribute("role", "grid"), $.classList.add("cal-grid");
|
|
832
|
+
const I = document.createElement("div");
|
|
833
|
+
I.setAttribute("role", "row"), I.classList.add("cal-weekdays");
|
|
834
|
+
for (const x of fe(t, v)) {
|
|
766
835
|
const C = document.createElement("div");
|
|
767
|
-
C.setAttribute("role", "columnheader"), C.setAttribute("aria-label",
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
const
|
|
771
|
-
let
|
|
772
|
-
return
|
|
773
|
-
C % 7 === 0 && (
|
|
774
|
-
const
|
|
775
|
-
|
|
776
|
-
const p =
|
|
777
|
-
|
|
778
|
-
const
|
|
779
|
-
|
|
836
|
+
C.setAttribute("role", "columnheader"), C.setAttribute("aria-label", x), C.classList.add("cal-weekday"), C.textContent = x, I.appendChild(C);
|
|
837
|
+
}
|
|
838
|
+
$.appendChild(I);
|
|
839
|
+
const ce = ye(e, a, t), K = d === "range" && r && !i && o || k && r && !i && o ? o : i, de = k ? Pe(r, o, f) : !1;
|
|
840
|
+
let B;
|
|
841
|
+
return ce.forEach((x, C) => {
|
|
842
|
+
C % 7 === 0 && (B = document.createElement("div"), B.setAttribute("role", "row"), B.classList.add("cal-row"), $.appendChild(B));
|
|
843
|
+
const b = document.createElement("button");
|
|
844
|
+
b.setAttribute("role", "gridcell"), b.setAttribute("part", "day"), b.classList.add("cal-day");
|
|
845
|
+
const p = x.dateString;
|
|
846
|
+
b.dataset.date = p;
|
|
847
|
+
const ue = new Date(x.year, x.month, x.day);
|
|
848
|
+
b.setAttribute("aria-label", ue.toLocaleDateString("en-US", {
|
|
780
849
|
weekday: "long",
|
|
781
850
|
year: "numeric",
|
|
782
851
|
month: "long",
|
|
783
852
|
day: "numeric"
|
|
784
|
-
})),
|
|
785
|
-
let
|
|
786
|
-
if (
|
|
787
|
-
|
|
788
|
-
const { status:
|
|
789
|
-
if (
|
|
790
|
-
let
|
|
791
|
-
if (
|
|
792
|
-
|
|
793
|
-
else if (
|
|
794
|
-
const
|
|
795
|
-
|
|
796
|
-
} else
|
|
797
|
-
|
|
853
|
+
})), x.isCurrentMonth || b.classList.add("cal-day--outside"), x.isToday && b.classList.add("cal-day--today");
|
|
854
|
+
let _ = null, R = !1;
|
|
855
|
+
if (k) {
|
|
856
|
+
_ = Ae(p, f, E || {}, P, M);
|
|
857
|
+
const { status: y, label: S, halfDay: j, colorOut: H, colorIn: N, colorFull: G } = _;
|
|
858
|
+
if (y === "booked" && (b.classList.add("cal-day--booked"), G && (b.style.setProperty("--booking-bg", `hsl(${G.bg})`), b.style.setProperty("--booking-fg", `hsl(${G.fg})`), b.style.setProperty("--booking-hover", `hsl(${G.hover})`)), R = !0), y === "blocked" && (b.classList.add("cal-day--blocked"), R = !0), j && (b.classList.add("cal-day--half-day"), H && b.style.setProperty("--half-day-color-out", `hsl(${H.bg})`), N && b.style.setProperty("--half-day-color-in", `hsl(${N.bg})`), R = !0), y === "checkout-only" && (b.classList.add("cal-day--checkout-only"), H && b.style.setProperty("--half-day-color-out", `hsl(${H.bg})`)), y === "checkin-only" && (b.classList.add("cal-day--checkin-only"), N && b.style.setProperty("--half-day-color-in", `hsl(${N.bg})`)), w) {
|
|
859
|
+
let L = null;
|
|
860
|
+
if (j && _.checkoutBooking && _.checkinBooking)
|
|
861
|
+
L = `${_.checkoutBooking.label || ""} / ${_.checkinBooking.label || ""}`;
|
|
862
|
+
else if (y === "booked") {
|
|
863
|
+
const J = f.find((V) => V.start <= p && V.end > p);
|
|
864
|
+
J && (L = J.label);
|
|
865
|
+
} else y === "checkout-only" && _.checkoutBooking ? L = _.checkoutBooking.label : y === "checkin-only" && _.checkinBooking && (L = _.checkinBooking.label);
|
|
866
|
+
L && b.setAttribute("data-booking-label", L);
|
|
798
867
|
}
|
|
799
|
-
if (
|
|
800
|
-
const
|
|
801
|
-
p >=
|
|
868
|
+
if (de && r && !i && o) {
|
|
869
|
+
const L = r < o ? r : o, J = r < o ? o : r;
|
|
870
|
+
p >= L && p <= J && b.classList.add("cal-day--invalid-range");
|
|
802
871
|
}
|
|
803
872
|
}
|
|
804
|
-
if (
|
|
805
|
-
const
|
|
806
|
-
|
|
873
|
+
if (k ? r && i && (z(p, r) || z(p, i)) ? (b.classList.add("cal-day--selected"), b.setAttribute("aria-selected", "true")) : b.setAttribute("aria-selected", "false") : n.some((S) => z(S, p)) ? (b.classList.add("cal-day--selected"), b.setAttribute("aria-selected", "true")) : b.setAttribute("aria-selected", "false"), (d === "range" || k) && r && K) {
|
|
874
|
+
const y = z(p, r), S = z(p, K), j = ve(p, r, K);
|
|
875
|
+
y && b.classList.add("cal-day--range-start"), S && b.classList.add("cal-day--range-end"), j && !y && !S && b.classList.add("cal-day--in-range");
|
|
807
876
|
}
|
|
808
|
-
const
|
|
809
|
-
if (
|
|
810
|
-
|
|
811
|
-
const
|
|
812
|
-
|
|
813
|
-
const
|
|
814
|
-
|
|
877
|
+
const W = ze(p, l, g, h) || R;
|
|
878
|
+
if (W && (b.classList.add("cal-day--disabled"), b.disabled = !0, b.setAttribute("aria-disabled", "true")), c && z(p, c) ? b.setAttribute("tabindex", "0") : b.setAttribute("tabindex", "-1"), k && _ && _.label != null) {
|
|
879
|
+
b.classList.add("cal-day--with-label");
|
|
880
|
+
const y = document.createElement("span");
|
|
881
|
+
y.classList.add("cal-day__number"), y.textContent = x.day, b.appendChild(y);
|
|
882
|
+
const S = document.createElement("span");
|
|
883
|
+
S.classList.add("cal-day__label"), S.textContent = _.label, b.appendChild(S);
|
|
815
884
|
} else
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
}),
|
|
885
|
+
b.textContent = x.day;
|
|
886
|
+
W ? k && b.addEventListener("mouseenter", () => m == null ? void 0 : m(p)) : (b.addEventListener("click", () => u == null ? void 0 : u(p)), b.addEventListener("mouseenter", () => m == null ? void 0 : m(p))), B.appendChild(b);
|
|
887
|
+
}), $.addEventListener("mouseleave", () => m == null ? void 0 : m(null)), $;
|
|
819
888
|
}
|
|
820
|
-
function
|
|
889
|
+
function ze(s, e, a, t) {
|
|
821
890
|
return !!(t.includes(s) || e && s < e || a && s > a);
|
|
822
891
|
}
|
|
823
|
-
const
|
|
892
|
+
const Ye = `
|
|
824
893
|
.cal-grid {
|
|
825
894
|
display: flex;
|
|
826
895
|
flex-direction: column;
|
|
@@ -1079,47 +1148,47 @@ const Ae = `
|
|
|
1079
1148
|
z-index: 10;
|
|
1080
1149
|
}
|
|
1081
1150
|
`;
|
|
1082
|
-
function
|
|
1151
|
+
function Be(s) {
|
|
1083
1152
|
const {
|
|
1084
1153
|
slots: e = [],
|
|
1085
1154
|
mode: a = "single",
|
|
1086
1155
|
format: t = "24h",
|
|
1087
1156
|
selected: n,
|
|
1088
|
-
hoverTime:
|
|
1089
|
-
rangeStart:
|
|
1157
|
+
hoverTime: r,
|
|
1158
|
+
rangeStart: i,
|
|
1090
1159
|
unavailableTimes: o = [],
|
|
1091
1160
|
onSelect: l,
|
|
1092
|
-
onHover:
|
|
1093
|
-
durationLabels:
|
|
1094
|
-
} = s,
|
|
1095
|
-
|
|
1161
|
+
onHover: g,
|
|
1162
|
+
durationLabels: h = !1
|
|
1163
|
+
} = s, d = document.createElement("div");
|
|
1164
|
+
d.classList.add("cal-time-grid"), h && d.classList.add("cal-time-grid--duration"), d.setAttribute("role", "listbox"), a === "multi" && d.setAttribute("aria-multiselectable", "true");
|
|
1096
1165
|
for (const c of e) {
|
|
1097
|
-
const
|
|
1098
|
-
|
|
1099
|
-
const
|
|
1100
|
-
if (
|
|
1101
|
-
const
|
|
1102
|
-
|
|
1166
|
+
const u = document.createElement("button");
|
|
1167
|
+
u.classList.add("cal-time-slot"), u.setAttribute("role", "option"), u.dataset.time = c.time;
|
|
1168
|
+
const m = U(c.time), f = c.displayText ? c.displayText : m ? X(m.hours, m.minutes, t) : c.time, E = document.createElement("span");
|
|
1169
|
+
if (E.classList.add("cal-time-slot__time"), E.textContent = f, u.appendChild(E), c.label) {
|
|
1170
|
+
const v = document.createElement("span");
|
|
1171
|
+
v.classList.add("cal-time-slot__label"), v.textContent = c.label, u.appendChild(v);
|
|
1103
1172
|
}
|
|
1104
|
-
const
|
|
1105
|
-
if (
|
|
1106
|
-
const
|
|
1107
|
-
|
|
1173
|
+
const P = c.available === !1 || o.includes(c.time);
|
|
1174
|
+
if (P && (u.classList.add("cal-time-slot--unavailable"), u.disabled = !0, u.setAttribute("aria-disabled", "true")), Fe(c.time, n, a) ? (u.classList.add("cal-time-slot--selected"), u.setAttribute("aria-selected", "true")) : u.setAttribute("aria-selected", "false"), a === "range" && i && !Oe(n) && r) {
|
|
1175
|
+
const v = ee(c.time, i, r), M = c.time === i, k = c.time === r;
|
|
1176
|
+
v && !M && !k && u.classList.add("cal-time-slot--in-range"), M && u.classList.add("cal-time-slot--range-start"), k && u.classList.add("cal-time-slot--range-end");
|
|
1108
1177
|
} else if (a === "range" && n && typeof n == "object" && n.start && n.end) {
|
|
1109
|
-
const
|
|
1110
|
-
|
|
1178
|
+
const v = ee(c.time, n.start, n.end), M = c.time === n.start, k = c.time === n.end;
|
|
1179
|
+
M && u.classList.add("cal-time-slot--range-start", "cal-time-slot--selected"), k && u.classList.add("cal-time-slot--range-end", "cal-time-slot--selected"), v && !M && !k && u.classList.add("cal-time-slot--in-range");
|
|
1111
1180
|
}
|
|
1112
|
-
|
|
1181
|
+
P || (u.addEventListener("click", () => l == null ? void 0 : l(c.time)), u.addEventListener("mouseenter", () => g == null ? void 0 : g(c.time))), d.appendChild(u);
|
|
1113
1182
|
}
|
|
1114
|
-
return
|
|
1183
|
+
return d.addEventListener("mouseleave", () => g == null ? void 0 : g(null)), d;
|
|
1115
1184
|
}
|
|
1116
|
-
function
|
|
1185
|
+
function Fe(s, e, a) {
|
|
1117
1186
|
return e ? a === "single" ? e === s : a === "multi" ? Array.isArray(e) && e.includes(s) : a === "range" && typeof e == "object" && e.start && e.end ? e.start === s || e.end === s : !1 : !1;
|
|
1118
1187
|
}
|
|
1119
|
-
function
|
|
1188
|
+
function Oe(s) {
|
|
1120
1189
|
return s && typeof s == "object" && s.start && s.end;
|
|
1121
1190
|
}
|
|
1122
|
-
const
|
|
1191
|
+
const Ie = `
|
|
1123
1192
|
.cal-time-grid {
|
|
1124
1193
|
display: grid;
|
|
1125
1194
|
grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
|
|
@@ -1202,17 +1271,17 @@ const Pe = `
|
|
|
1202
1271
|
font-size: 12px;
|
|
1203
1272
|
}
|
|
1204
1273
|
`;
|
|
1205
|
-
function
|
|
1274
|
+
function Re({ columns: s = 3, rows: e = 4, durationLabels: a = !1 } = {}) {
|
|
1206
1275
|
const t = document.createElement("div");
|
|
1207
1276
|
t.setAttribute("role", "status"), t.setAttribute("aria-label", "Loading..."), t.classList.add("cal-skeleton-time-grid"), a && t.classList.add("cal-skeleton-time-grid--duration");
|
|
1208
1277
|
const n = s * e;
|
|
1209
|
-
for (let
|
|
1210
|
-
const
|
|
1211
|
-
|
|
1278
|
+
for (let r = 0; r < n; r++) {
|
|
1279
|
+
const i = document.createElement("div");
|
|
1280
|
+
i.classList.add("cal-skeleton"), t.appendChild(i);
|
|
1212
1281
|
}
|
|
1213
1282
|
return t;
|
|
1214
1283
|
}
|
|
1215
|
-
function
|
|
1284
|
+
function je({ rows: s = 5 } = {}) {
|
|
1216
1285
|
const e = document.createElement("div");
|
|
1217
1286
|
e.setAttribute("role", "status"), e.setAttribute("aria-label", "Loading..."), e.classList.add("cal-skeleton-calendar-grid");
|
|
1218
1287
|
for (let t = 0; t < 7; t++) {
|
|
@@ -1226,7 +1295,7 @@ function Oe({ rows: s = 5 } = {}) {
|
|
|
1226
1295
|
}
|
|
1227
1296
|
return e;
|
|
1228
1297
|
}
|
|
1229
|
-
const
|
|
1298
|
+
const He = `
|
|
1230
1299
|
.cal-skeleton-time-grid {
|
|
1231
1300
|
display: grid;
|
|
1232
1301
|
grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
|
|
@@ -1259,25 +1328,25 @@ const Fe = `
|
|
|
1259
1328
|
aspect-ratio: 1;
|
|
1260
1329
|
border-radius: var(--cal-radius-sm) !important;
|
|
1261
1330
|
}
|
|
1262
|
-
`,
|
|
1331
|
+
`, ne = {
|
|
1263
1332
|
error: '<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="7" cy="7" r="6"/><path d="M7 4v3M7 9.5v.01"/></svg>',
|
|
1264
1333
|
warning: '<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M7 1.5L1 12.5h12L7 1.5zM7 6v2.5M7 10.5v.01"/></svg>',
|
|
1265
1334
|
info: '<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="7" cy="7" r="6"/><path d="M7 6.5V10M7 4.5v.01"/></svg>',
|
|
1266
1335
|
success: '<svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="7" cy="7" r="6"/><path d="M4.5 7l2 2L9.5 5"/></svg>'
|
|
1267
1336
|
};
|
|
1268
|
-
function
|
|
1337
|
+
function Ne({ type: s = "info", message: e, dismissible: a = !0, onDismiss: t }) {
|
|
1269
1338
|
const n = document.createElement("div");
|
|
1270
1339
|
n.classList.add("cal-status", `cal-status--${s}`, "cal-animate-slide-up"), n.setAttribute("role", s === "error" ? "alert" : "status"), n.setAttribute("aria-live", s === "error" ? "assertive" : "polite");
|
|
1271
|
-
const i = document.createElement("span");
|
|
1272
|
-
i.classList.add("cal-status__icon"), i.innerHTML = te[s] || te.info, n.appendChild(i);
|
|
1273
1340
|
const r = document.createElement("span");
|
|
1274
|
-
|
|
1341
|
+
r.classList.add("cal-status__icon"), r.innerHTML = ne[s] || ne.info, n.appendChild(r);
|
|
1342
|
+
const i = document.createElement("span");
|
|
1343
|
+
if (i.classList.add("cal-status__text"), i.textContent = e, n.appendChild(i), a) {
|
|
1275
1344
|
const o = document.createElement("button");
|
|
1276
1345
|
o.classList.add("cal-status__close"), o.setAttribute("aria-label", "Dismiss"), o.innerHTML = '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><path d="M3 3l6 6M9 3l-6 6"/></svg>', o.addEventListener("click", () => t == null ? void 0 : t()), n.appendChild(o);
|
|
1277
1346
|
}
|
|
1278
1347
|
return n;
|
|
1279
1348
|
}
|
|
1280
|
-
const
|
|
1349
|
+
const Ge = `
|
|
1281
1350
|
.cal-status {
|
|
1282
1351
|
display: flex;
|
|
1283
1352
|
align-items: center;
|
|
@@ -1339,7 +1408,7 @@ const Ie = `
|
|
|
1339
1408
|
color: hsl(var(--cal-status-success-fg));
|
|
1340
1409
|
border: 1px solid hsl(var(--cal-status-success-border));
|
|
1341
1410
|
}
|
|
1342
|
-
`,
|
|
1411
|
+
`, Je = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="3" width="12" height="11" rx="2"/><path d="M5 1v3M11 1v3M2 7h12"/></svg>', Ue = `
|
|
1343
1412
|
.cal-picker {
|
|
1344
1413
|
background: hsl(var(--cal-bg));
|
|
1345
1414
|
border-radius: var(--cal-radius);
|
|
@@ -1374,9 +1443,9 @@ const Ie = `
|
|
|
1374
1443
|
margin-bottom: 8px;
|
|
1375
1444
|
}
|
|
1376
1445
|
`;
|
|
1377
|
-
class
|
|
1446
|
+
class Ke extends ge {
|
|
1378
1447
|
static get styles() {
|
|
1379
|
-
return [
|
|
1448
|
+
return [we, xe, Se, Ye, Ie, Le, Ee, Ce, He, Ge, Ue];
|
|
1380
1449
|
}
|
|
1381
1450
|
static get observedAttributes() {
|
|
1382
1451
|
return [
|
|
@@ -1385,6 +1454,7 @@ class Ne extends ce {
|
|
|
1385
1454
|
"min-date",
|
|
1386
1455
|
"max-date",
|
|
1387
1456
|
"first-day",
|
|
1457
|
+
"locale",
|
|
1388
1458
|
"placeholder",
|
|
1389
1459
|
"dual",
|
|
1390
1460
|
"show-labels-on-hover",
|
|
@@ -1400,14 +1470,14 @@ class Ne extends ce {
|
|
|
1400
1470
|
constructor() {
|
|
1401
1471
|
super();
|
|
1402
1472
|
const e = /* @__PURE__ */ new Date();
|
|
1403
|
-
this._store =
|
|
1473
|
+
this._store = he({
|
|
1404
1474
|
viewYear: e.getFullYear(),
|
|
1405
1475
|
viewMonth: e.getMonth(),
|
|
1406
1476
|
rangeStart: null,
|
|
1407
1477
|
rangeEnd: null,
|
|
1408
1478
|
hoverDate: null,
|
|
1409
1479
|
isOpen: !1,
|
|
1410
|
-
focusedDate:
|
|
1480
|
+
focusedDate: re(),
|
|
1411
1481
|
navDirection: null,
|
|
1412
1482
|
pickingMonth: !1,
|
|
1413
1483
|
pickerYear: e.getFullYear(),
|
|
@@ -1420,7 +1490,7 @@ class Ne extends ce {
|
|
|
1420
1490
|
statusType: null,
|
|
1421
1491
|
statusMessage: null,
|
|
1422
1492
|
statusDismissible: !0
|
|
1423
|
-
}), this._bookings = [], this._dayData = {}, this._labelFormula = null, this._timeSlots = null, this._popover = null, this._unsubscribe = null, this._rendering = !1;
|
|
1493
|
+
}), this._bookings = [], this._dayData = {}, this._labelFormula = null, this._colors = null, this._customColorMap = null, this._timeSlots = null, this._popover = null, this._unsubscribe = null, this._rendering = !1;
|
|
1424
1494
|
}
|
|
1425
1495
|
// -- Attribute getters --
|
|
1426
1496
|
get display() {
|
|
@@ -1438,6 +1508,9 @@ class Ne extends ce {
|
|
|
1438
1508
|
get maxDate() {
|
|
1439
1509
|
return this.getAttribute("max-date") || null;
|
|
1440
1510
|
}
|
|
1511
|
+
get locale() {
|
|
1512
|
+
return this.getAttribute("locale") || void 0;
|
|
1513
|
+
}
|
|
1441
1514
|
get showLabelsOnHover() {
|
|
1442
1515
|
return this.hasAttribute("show-labels-on-hover");
|
|
1443
1516
|
}
|
|
@@ -1490,6 +1563,15 @@ class Ne extends ce {
|
|
|
1490
1563
|
set timeSlots(e) {
|
|
1491
1564
|
this._timeSlots = Array.isArray(e) ? e : null, this._initialized && this.render();
|
|
1492
1565
|
}
|
|
1566
|
+
get colors() {
|
|
1567
|
+
return this._colors;
|
|
1568
|
+
}
|
|
1569
|
+
set colors(e) {
|
|
1570
|
+
if (this._colors = Array.isArray(e) ? e : null, this._customColorMap = Te(this._colors), this._customColorMap)
|
|
1571
|
+
for (const [a, t] of Object.entries(this._customColorMap))
|
|
1572
|
+
this.style.setProperty(`--cal-booking-${a}-bg`, t.bg), this.style.setProperty(`--cal-booking-${a}-fg`, t.fg), this.style.setProperty(`--cal-booking-${a}-hover`, t.hover);
|
|
1573
|
+
this._initialized && this.render();
|
|
1574
|
+
}
|
|
1493
1575
|
get value() {
|
|
1494
1576
|
const e = this._store.getState();
|
|
1495
1577
|
if (!e.rangeStart || !e.rangeEnd) return null;
|
|
@@ -1510,7 +1592,7 @@ class Ne extends ce {
|
|
|
1510
1592
|
});
|
|
1511
1593
|
}
|
|
1512
1594
|
_navigateToDate(e) {
|
|
1513
|
-
const a =
|
|
1595
|
+
const a = D(e);
|
|
1514
1596
|
a && this._store.set({ viewYear: a.getFullYear(), viewMonth: a.getMonth() });
|
|
1515
1597
|
}
|
|
1516
1598
|
connectedCallback() {
|
|
@@ -1547,7 +1629,7 @@ class Ne extends ce {
|
|
|
1547
1629
|
});
|
|
1548
1630
|
else {
|
|
1549
1631
|
let t = a.rangeStart, n = e;
|
|
1550
|
-
if (t > n && ([t, n] = [n, t]), !
|
|
1632
|
+
if (t > n && ([t, n] = [n, t]), !le(t, n, this._bookings)) {
|
|
1551
1633
|
this.emit("cal:selection-invalid", { start: t, end: n }), this._store.set({
|
|
1552
1634
|
rangeStart: null,
|
|
1553
1635
|
rangeEnd: null,
|
|
@@ -1592,39 +1674,39 @@ class Ne extends ce {
|
|
|
1592
1674
|
}
|
|
1593
1675
|
// -- Lightweight hover highlight --
|
|
1594
1676
|
_updateGridHighlight(e) {
|
|
1595
|
-
const a = this.$$(".cal-day"), { rangeStart: t, hoverDate: n } = e,
|
|
1596
|
-
let
|
|
1677
|
+
const a = this.$$(".cal-day"), { rangeStart: t, hoverDate: n } = e, r = t && !e.rangeEnd && n ? n : e.rangeEnd;
|
|
1678
|
+
let i = !1;
|
|
1597
1679
|
if (t && !e.rangeEnd && n) {
|
|
1598
1680
|
const o = t < n ? t : n, l = t < n ? n : t;
|
|
1599
|
-
for (const
|
|
1600
|
-
if (o <
|
|
1601
|
-
|
|
1681
|
+
for (const g of this._bookings)
|
|
1682
|
+
if (o < g.end && l > g.start) {
|
|
1683
|
+
i = !0;
|
|
1602
1684
|
break;
|
|
1603
1685
|
}
|
|
1604
1686
|
}
|
|
1605
1687
|
for (const o of a) {
|
|
1606
1688
|
const l = o.dataset.date;
|
|
1607
1689
|
if (!l) continue;
|
|
1608
|
-
const
|
|
1609
|
-
let
|
|
1610
|
-
if (t &&
|
|
1611
|
-
const
|
|
1612
|
-
|
|
1690
|
+
const g = l === t && !!r, h = l === r && !!r;
|
|
1691
|
+
let d = !1;
|
|
1692
|
+
if (t && r) {
|
|
1693
|
+
const u = t < r ? t : r, m = t < r ? r : t;
|
|
1694
|
+
d = l >= u && l <= m && !g && !h;
|
|
1613
1695
|
}
|
|
1614
|
-
const c =
|
|
1615
|
-
const
|
|
1616
|
-
return l >=
|
|
1696
|
+
const c = i && t && !e.rangeEnd && n && (() => {
|
|
1697
|
+
const u = t < n ? t : n, m = t < n ? n : t;
|
|
1698
|
+
return l >= u && l <= m;
|
|
1617
1699
|
})();
|
|
1618
|
-
o.classList.toggle("cal-day--range-start",
|
|
1700
|
+
o.classList.toggle("cal-day--range-start", g), o.classList.toggle("cal-day--range-end", h), o.classList.toggle("cal-day--in-range", d), o.classList.toggle("cal-day--invalid-range", !!c);
|
|
1619
1701
|
}
|
|
1620
1702
|
}
|
|
1621
1703
|
// -- Navigation --
|
|
1622
1704
|
_prevMonth() {
|
|
1623
|
-
const { viewYear: e, viewMonth: a } = this._store.getState(), { year: t, month: n } =
|
|
1705
|
+
const { viewYear: e, viewMonth: a } = this._store.getState(), { year: t, month: n } = O(e, a, -1);
|
|
1624
1706
|
this._store.set({ viewYear: t, viewMonth: n, navDirection: "prev" }), this.emit("cal:month-change", { year: t, month: n });
|
|
1625
1707
|
}
|
|
1626
1708
|
_nextMonth() {
|
|
1627
|
-
const { viewYear: e, viewMonth: a } = this._store.getState(), { year: t, month: n } =
|
|
1709
|
+
const { viewYear: e, viewMonth: a } = this._store.getState(), { year: t, month: n } = O(e, a, 1);
|
|
1628
1710
|
this._store.set({ viewYear: t, viewMonth: n, navDirection: "next" }), this.emit("cal:month-change", { year: t, month: n });
|
|
1629
1711
|
}
|
|
1630
1712
|
// -- Month picker --
|
|
@@ -1648,7 +1730,7 @@ class Ne extends ce {
|
|
|
1648
1730
|
e.stopPropagation(), this._store.set({ pickingMonth: !1 });
|
|
1649
1731
|
return;
|
|
1650
1732
|
}
|
|
1651
|
-
const a = this._store.getState(), t =
|
|
1733
|
+
const a = this._store.getState(), t = D(a.focusedDate);
|
|
1652
1734
|
if (!t) return;
|
|
1653
1735
|
let n = null;
|
|
1654
1736
|
switch (e.key) {
|
|
@@ -1676,15 +1758,15 @@ class Ne extends ce {
|
|
|
1676
1758
|
}
|
|
1677
1759
|
if (n) {
|
|
1678
1760
|
e.preventDefault();
|
|
1679
|
-
const
|
|
1761
|
+
const r = T(n);
|
|
1680
1762
|
n.getMonth() !== a.viewMonth || n.getFullYear() !== a.viewYear ? this._store.set({
|
|
1681
1763
|
viewYear: n.getFullYear(),
|
|
1682
1764
|
viewMonth: n.getMonth(),
|
|
1683
|
-
focusedDate:
|
|
1765
|
+
focusedDate: r,
|
|
1684
1766
|
navDirection: n > t ? "next" : "prev"
|
|
1685
|
-
}) : this._store.set({ focusedDate:
|
|
1686
|
-
const
|
|
1687
|
-
|
|
1767
|
+
}) : this._store.set({ focusedDate: r }), requestAnimationFrame(() => {
|
|
1768
|
+
const i = this.$(`[data-date="${r}"]`);
|
|
1769
|
+
i == null || i.focus();
|
|
1688
1770
|
});
|
|
1689
1771
|
}
|
|
1690
1772
|
}
|
|
@@ -1698,34 +1780,44 @@ class Ne extends ce {
|
|
|
1698
1780
|
goToMonth(e, a) {
|
|
1699
1781
|
this._store.set({ viewYear: a, viewMonth: e });
|
|
1700
1782
|
}
|
|
1783
|
+
clear() {
|
|
1784
|
+
this._store.set({
|
|
1785
|
+
rangeStart: null,
|
|
1786
|
+
rangeEnd: null,
|
|
1787
|
+
hoverDate: null,
|
|
1788
|
+
startTime: null,
|
|
1789
|
+
endTime: null,
|
|
1790
|
+
timeSelectPhase: null
|
|
1791
|
+
}), this.emit("cal:change", { value: null });
|
|
1792
|
+
}
|
|
1701
1793
|
// -- Time slots generation --
|
|
1702
1794
|
_getTimeSlotArray() {
|
|
1703
|
-
return this._timeSlots ? this._timeSlots : this.durationLabels ?
|
|
1795
|
+
return this._timeSlots ? this._timeSlots : this.durationLabels ? _e(this.timeStartTime, this.timeEndTime, this.timeInterval, this.timeFormat).map((a) => ({ ...a, available: !0 })) : ke(this.timeStartTime, this.timeEndTime, this.timeInterval).map((a) => ({ time: a, available: !0 }));
|
|
1704
1796
|
}
|
|
1705
1797
|
// -- Render --
|
|
1706
1798
|
_renderCalendarContent() {
|
|
1707
1799
|
const e = this._store.getState(), a = document.createElement("div");
|
|
1708
|
-
if (a.classList.add("cal-picker"), e.statusType && e.statusMessage && a.appendChild(
|
|
1800
|
+
if (a.classList.add("cal-picker"), e.statusType && e.statusMessage && a.appendChild(Ne({
|
|
1709
1801
|
type: e.statusType,
|
|
1710
1802
|
message: e.statusMessage,
|
|
1711
1803
|
dismissible: e.statusDismissible,
|
|
1712
1804
|
onDismiss: () => this.clearStatus()
|
|
1713
1805
|
})), this.loading) {
|
|
1714
|
-
const
|
|
1715
|
-
|
|
1806
|
+
const i = document.createElement("div");
|
|
1807
|
+
i.classList.add("cal-months");
|
|
1716
1808
|
const o = document.createElement("div");
|
|
1717
|
-
if (o.classList.add("cal-month"), o.appendChild(
|
|
1809
|
+
if (o.classList.add("cal-month"), o.appendChild(je()), i.appendChild(o), a.appendChild(i), this.timeSlotsEnabled) {
|
|
1718
1810
|
const l = document.createElement("div");
|
|
1719
|
-
l.classList.add("cal-booking-time-section"), l.appendChild(
|
|
1811
|
+
l.classList.add("cal-booking-time-section"), l.appendChild(Re({ durationLabels: this.durationLabels })), a.appendChild(l);
|
|
1720
1812
|
}
|
|
1721
1813
|
return a.addEventListener("keydown", (l) => this._handleKeydown(l)), a;
|
|
1722
1814
|
}
|
|
1723
1815
|
const t = document.createElement("div");
|
|
1724
1816
|
t.classList.add("cal-months");
|
|
1725
|
-
const n = this.hasAttribute("dual"),
|
|
1726
|
-
for (let
|
|
1727
|
-
const { year: o, month: l } =
|
|
1728
|
-
if (
|
|
1817
|
+
const n = this.hasAttribute("dual"), r = n ? 2 : 1;
|
|
1818
|
+
for (let i = 0; i < r; i++) {
|
|
1819
|
+
const { year: o, month: l } = i === 0 ? { year: e.viewYear, month: e.viewMonth } : O(e.viewYear, e.viewMonth, 1), g = document.createElement("div");
|
|
1820
|
+
if (g.classList.add("cal-month"), i === 0 && g.appendChild(te({
|
|
1729
1821
|
year: o,
|
|
1730
1822
|
month: l,
|
|
1731
1823
|
onPrev: e.pickingMonth ? () => {
|
|
@@ -1734,26 +1826,29 @@ class Ne extends ce {
|
|
|
1734
1826
|
} : () => {
|
|
1735
1827
|
n || this._nextMonth();
|
|
1736
1828
|
},
|
|
1737
|
-
onTitleClick: () => this._toggleMonthPicker()
|
|
1738
|
-
|
|
1829
|
+
onTitleClick: () => this._toggleMonthPicker(),
|
|
1830
|
+
locale: this.locale
|
|
1831
|
+
})), i === 1 && g.appendChild(te({
|
|
1739
1832
|
year: o,
|
|
1740
1833
|
month: l,
|
|
1741
1834
|
onPrev: () => {
|
|
1742
1835
|
},
|
|
1743
|
-
onNext: () => this._nextMonth()
|
|
1744
|
-
|
|
1745
|
-
|
|
1836
|
+
onNext: () => this._nextMonth(),
|
|
1837
|
+
locale: this.locale
|
|
1838
|
+
})), e.pickingMonth && i === 0) {
|
|
1839
|
+
const h = De({
|
|
1746
1840
|
pickerYear: e.pickerYear,
|
|
1747
1841
|
viewMonth: e.viewMonth,
|
|
1748
1842
|
viewYear: e.viewYear,
|
|
1749
|
-
onMonthSelect: (
|
|
1843
|
+
onMonthSelect: (d, c) => this._selectMonthFromPicker(d, c),
|
|
1750
1844
|
onYearPrev: () => this._store.set({ pickerYear: e.pickerYear - 1 }),
|
|
1751
1845
|
onYearNext: () => this._store.set({ pickerYear: e.pickerYear + 1 }),
|
|
1752
|
-
onClose: () => this._store.set({ pickingMonth: !1 })
|
|
1846
|
+
onClose: () => this._store.set({ pickingMonth: !1 }),
|
|
1847
|
+
locale: this.locale
|
|
1753
1848
|
});
|
|
1754
|
-
|
|
1849
|
+
g.appendChild(h);
|
|
1755
1850
|
} else {
|
|
1756
|
-
const
|
|
1851
|
+
const h = e.navDirection === "next" ? "cal-animate-slide-left" : e.navDirection === "prev" ? "cal-animate-slide-right" : "", d = $e({
|
|
1757
1852
|
year: o,
|
|
1758
1853
|
month: l,
|
|
1759
1854
|
firstDay: this.firstDay,
|
|
@@ -1770,30 +1865,32 @@ class Ne extends ce {
|
|
|
1770
1865
|
bookings: this._bookings,
|
|
1771
1866
|
dayData: this._dayData,
|
|
1772
1867
|
labelFormula: this._labelFormula,
|
|
1773
|
-
showLabelsOnHover: this.showLabelsOnHover
|
|
1868
|
+
showLabelsOnHover: this.showLabelsOnHover,
|
|
1869
|
+
locale: this.locale,
|
|
1870
|
+
customColors: this._customColorMap
|
|
1774
1871
|
});
|
|
1775
|
-
|
|
1872
|
+
h && d.classList.add(h), g.appendChild(d);
|
|
1776
1873
|
}
|
|
1777
|
-
t.appendChild(
|
|
1874
|
+
t.appendChild(g);
|
|
1778
1875
|
}
|
|
1779
1876
|
if (a.appendChild(t), this.timeSlotsEnabled && e.timeSelectPhase && !e.pickingMonth) {
|
|
1780
|
-
const
|
|
1781
|
-
|
|
1877
|
+
const i = document.createElement("div");
|
|
1878
|
+
i.classList.add("cal-booking-time-section");
|
|
1782
1879
|
const o = document.createElement("div");
|
|
1783
|
-
o.classList.add("cal-booking-time-header"), o.textContent = e.timeSelectPhase === "start" ? "Select check-in time" : "Select check-out time",
|
|
1784
|
-
const l = this._getTimeSlotArray(),
|
|
1880
|
+
o.classList.add("cal-booking-time-header"), o.textContent = e.timeSelectPhase === "start" ? "Select check-in time" : "Select check-out time", i.appendChild(o);
|
|
1881
|
+
const l = this._getTimeSlotArray(), g = Be({
|
|
1785
1882
|
slots: l,
|
|
1786
1883
|
mode: "single",
|
|
1787
1884
|
format: this.timeFormat,
|
|
1788
1885
|
selected: e.timeSelectPhase === "end" ? e.startTime : null,
|
|
1789
|
-
onSelect: (
|
|
1886
|
+
onSelect: (h) => this._handleTimeSelect(h),
|
|
1790
1887
|
onHover: () => {
|
|
1791
1888
|
},
|
|
1792
1889
|
durationLabels: this.durationLabels
|
|
1793
1890
|
});
|
|
1794
|
-
|
|
1891
|
+
i.appendChild(g), a.appendChild(i);
|
|
1795
1892
|
}
|
|
1796
|
-
return a.addEventListener("keydown", (
|
|
1893
|
+
return a.addEventListener("keydown", (i) => this._handleKeydown(i)), a;
|
|
1797
1894
|
}
|
|
1798
1895
|
_formatTriggerText() {
|
|
1799
1896
|
const e = this._store.getState();
|
|
@@ -1804,8 +1901,14 @@ class Ne extends ce {
|
|
|
1804
1901
|
return null;
|
|
1805
1902
|
}
|
|
1806
1903
|
_formatShortDate(e) {
|
|
1807
|
-
const a =
|
|
1808
|
-
|
|
1904
|
+
const a = D(e);
|
|
1905
|
+
if (!a) return e;
|
|
1906
|
+
if (this.locale)
|
|
1907
|
+
try {
|
|
1908
|
+
return new Intl.DateTimeFormat(this.locale, { month: "short", day: "numeric", year: "numeric" }).format(a);
|
|
1909
|
+
} catch {
|
|
1910
|
+
}
|
|
1911
|
+
return `${se(this.locale)[a.getMonth()]} ${a.getDate()}, ${a.getFullYear()}`;
|
|
1809
1912
|
}
|
|
1810
1913
|
render() {
|
|
1811
1914
|
var t;
|
|
@@ -1817,29 +1920,29 @@ class Ne extends ce {
|
|
|
1817
1920
|
if ((t = this._popover) == null || t.destroy(), this._popover = null, this.display === "popover") {
|
|
1818
1921
|
const n = document.createElement("div");
|
|
1819
1922
|
n.classList.add("cal-popover-wrapper");
|
|
1820
|
-
const
|
|
1821
|
-
|
|
1822
|
-
const
|
|
1823
|
-
|
|
1923
|
+
const r = document.createElement("button");
|
|
1924
|
+
r.classList.add("cal-trigger");
|
|
1925
|
+
const i = document.createElement("span");
|
|
1926
|
+
i.classList.add("cal-trigger__icon"), i.innerHTML = Je, r.appendChild(i);
|
|
1824
1927
|
const o = this._formatTriggerText(), l = document.createElement("span");
|
|
1825
|
-
o ? l.textContent = o : (l.textContent = this.placeholder, l.classList.add("cal-trigger--placeholder")),
|
|
1826
|
-
const
|
|
1827
|
-
trigger:
|
|
1828
|
-
content:
|
|
1928
|
+
o ? l.textContent = o : (l.textContent = this.placeholder, l.classList.add("cal-trigger--placeholder")), r.appendChild(l), n.appendChild(r);
|
|
1929
|
+
const g = this._renderCalendarContent(), h = Me({
|
|
1930
|
+
trigger: r,
|
|
1931
|
+
content: g,
|
|
1829
1932
|
onClose: () => {
|
|
1830
1933
|
this._store.set({ isOpen: !1 }), this.emit("cal:close");
|
|
1831
1934
|
}
|
|
1832
1935
|
});
|
|
1833
|
-
n.appendChild(
|
|
1834
|
-
|
|
1835
|
-
}), this._popover =
|
|
1936
|
+
n.appendChild(h.panel), e.appendChild(n), r.addEventListener("click", (d) => {
|
|
1937
|
+
d.stopPropagation(), h.isOpen ? this.close() : this.open();
|
|
1938
|
+
}), this._popover = h, this._store.get("isOpen") && h.open();
|
|
1836
1939
|
} else
|
|
1837
1940
|
e.appendChild(this._renderCalendarContent());
|
|
1838
1941
|
this._store.set({ navDirection: null }), this._rendering = !1;
|
|
1839
1942
|
}
|
|
1840
1943
|
}
|
|
1841
|
-
customElements.get("cal-booking") || customElements.define("cal-booking",
|
|
1944
|
+
customElements.get("cal-booking") || customElements.define("cal-booking", Ke);
|
|
1842
1945
|
export {
|
|
1843
|
-
|
|
1946
|
+
Ke as CalBooking
|
|
1844
1947
|
};
|
|
1845
1948
|
//# sourceMappingURL=booking.es.js.map
|