@glatam/calendar-ui 1.0.1 → 1.0.3
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/components/calendar-modal.d.ts +2 -0
- package/dist/components/calendar-modal.d.ts.map +1 -1
- package/dist/glatam-calendar.cjs +188 -182
- package/dist/glatam-calendar.d.ts.map +1 -1
- package/dist/glatam-calendar.js +394 -371
- package/dist/styles/calendar-modal.css.d.ts +2 -0
- package/dist/styles/calendar-modal.css.d.ts.map +1 -0
- package/dist/views/month-view.d.ts.map +1 -1
- package/package.json +6 -2
- package/src/components/calendar-modal.ts +0 -297
- package/src/glatam-calendar-mini.ts +0 -147
- package/src/glatam-calendar.ts +0 -197
- package/src/index.ts +0 -9
- package/src/styles/calendar.css.ts +0 -259
- package/src/styles/variables.css.ts +0 -91
- package/src/utils/timezone-utils.ts +0 -87
- package/src/views/day-view.ts +0 -130
- package/src/views/month-view.ts +0 -116
- package/src/views/week-view.ts +0 -158
- package/tsconfig.json +0 -8
- package/vite.config.ts +0 -35
package/dist/glatam-calendar.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { css as E, LitElement as O, html as d } from "lit";
|
|
2
|
-
import { property as s, customElement as T, state as
|
|
3
|
-
import { isTimeBlocked as
|
|
4
|
-
import { formatISODate as
|
|
5
|
-
import { classMap as
|
|
6
|
-
const
|
|
2
|
+
import { property as s, customElement as T, state as u } from "lit/decorators.js";
|
|
3
|
+
import { isTimeBlocked as I, formatISODate as _, generateMonthDays as A, generateWeekDays as j } from "@glatam/calendar-core";
|
|
4
|
+
import { formatISODate as nt, isTimeBlocked as dt, parseISODate as ct } from "@glatam/calendar-core";
|
|
5
|
+
import { classMap as N } from "lit/directives/class-map.js";
|
|
6
|
+
const P = E`
|
|
7
7
|
:host {
|
|
8
8
|
/* Fonts */
|
|
9
9
|
--glatam-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
@@ -91,7 +91,7 @@ const A = E`
|
|
|
91
91
|
--glatam-padding: 24px;
|
|
92
92
|
font-size: 1.1rem;
|
|
93
93
|
}
|
|
94
|
-
`,
|
|
94
|
+
`, W = E`
|
|
95
95
|
:host {
|
|
96
96
|
display: grid;
|
|
97
97
|
min-width: 0;
|
|
@@ -361,14 +361,14 @@ function C(e, t, a) {
|
|
|
361
361
|
hour12: !1
|
|
362
362
|
};
|
|
363
363
|
l !== "local" && (o.timeZone = l);
|
|
364
|
-
const n = new Intl.DateTimeFormat("en-US", o).formatToParts(r),
|
|
364
|
+
const n = new Intl.DateTimeFormat("en-US", o).formatToParts(r), c = new Map(n.map(($) => [$.type, $.value])), m = Number(c.get("hour")), y = m === 24 ? 0 : m;
|
|
365
365
|
return new Date(
|
|
366
|
-
Number(
|
|
367
|
-
Number(
|
|
368
|
-
Number(
|
|
369
|
-
|
|
370
|
-
Number(
|
|
371
|
-
Number(
|
|
366
|
+
Number(c.get("year")),
|
|
367
|
+
Number(c.get("month")) - 1,
|
|
368
|
+
Number(c.get("day")),
|
|
369
|
+
y,
|
|
370
|
+
Number(c.get("minute")),
|
|
371
|
+
Number(c.get("second"))
|
|
372
372
|
);
|
|
373
373
|
};
|
|
374
374
|
try {
|
|
@@ -378,29 +378,29 @@ function C(e, t, a) {
|
|
|
378
378
|
return 0;
|
|
379
379
|
}
|
|
380
380
|
}
|
|
381
|
-
function
|
|
381
|
+
function U(e, t) {
|
|
382
382
|
if (t === 0)
|
|
383
383
|
return { start: e.start, end: e.end, dayShift: 0 };
|
|
384
|
-
const a = (
|
|
385
|
-
const [
|
|
386
|
-
return
|
|
387
|
-
}, i = (
|
|
388
|
-
let
|
|
389
|
-
|
|
390
|
-
const
|
|
391
|
-
return `${
|
|
392
|
-
}, r = a(e.start), l = a(e.end), o = r + t,
|
|
384
|
+
const a = (c) => {
|
|
385
|
+
const [m, y] = c.split(":").map(Number);
|
|
386
|
+
return m * 60 + y;
|
|
387
|
+
}, i = (c) => {
|
|
388
|
+
let m = c % 1440;
|
|
389
|
+
m < 0 && (m += 1440);
|
|
390
|
+
const y = String(Math.floor(m / 60)).padStart(2, "0"), $ = String(m % 60).padStart(2, "0");
|
|
391
|
+
return `${y}:${$}`;
|
|
392
|
+
}, r = a(e.start), l = a(e.end), o = r + t, h = l + t;
|
|
393
393
|
let n = 0;
|
|
394
394
|
return o < 0 ? n = -1 : o >= 1440 && (n = 1), {
|
|
395
395
|
start: i(o),
|
|
396
|
-
end: i(
|
|
396
|
+
end: i(h),
|
|
397
397
|
dayShift: n
|
|
398
398
|
};
|
|
399
399
|
}
|
|
400
|
-
var
|
|
401
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
400
|
+
var L = Object.defineProperty, F = Object.getOwnPropertyDescriptor, D = (e, t, a, i) => {
|
|
401
|
+
for (var r = i > 1 ? void 0 : i ? F(t, a) : t, l = e.length - 1, o; l >= 0; l--)
|
|
402
402
|
(o = e[l]) && (r = (i ? o(t, a, r) : o(r)) || r);
|
|
403
|
-
return i && r &&
|
|
403
|
+
return i && r && L(t, a, r), r;
|
|
404
404
|
};
|
|
405
405
|
let f = class extends O {
|
|
406
406
|
constructor() {
|
|
@@ -413,7 +413,8 @@ let f = class extends O {
|
|
|
413
413
|
return e;
|
|
414
414
|
}
|
|
415
415
|
handleDayClick(e) {
|
|
416
|
-
this.
|
|
416
|
+
const t = this.minDate && e.dateString < this.minDate || this.maxDate && e.dateString > this.maxDate;
|
|
417
|
+
this.role === "buyer" && (e.isBlocked || t) || this.dispatchEvent(new CustomEvent("day-select", {
|
|
417
418
|
detail: { dateString: e.dateString, isBlocked: e.isBlocked },
|
|
418
419
|
bubbles: !0,
|
|
419
420
|
composed: !0
|
|
@@ -425,13 +426,13 @@ let f = class extends O {
|
|
|
425
426
|
${e.map((t) => d`<div class="weekday">${t}</div>`)}
|
|
426
427
|
|
|
427
428
|
${this.days.map((t) => {
|
|
428
|
-
var
|
|
429
|
+
var h;
|
|
429
430
|
if (!t.isCurrentMonth && !this.showNeighboringMonth)
|
|
430
431
|
return d`<div class="day-cell empty"></div>`;
|
|
431
432
|
const a = t.dateString === (/* @__PURE__ */ new Date()).toISOString().split("T")[0], i = this.selectedDates.includes(t.dateString), r = t.slots.filter((n) => n.isBlocked), l = this.minDate && t.dateString < this.minDate || this.maxDate && t.dateString > this.maxDate, o = this.tileClassName ? this.tileClassName({ date: t.date, dateString: t.dateString }) : "";
|
|
432
433
|
return d`
|
|
433
434
|
<div
|
|
434
|
-
class=${
|
|
435
|
+
class=${N({
|
|
435
436
|
"day-cell": !0,
|
|
436
437
|
padding: !t.isCurrentMonth,
|
|
437
438
|
blocked: t.isBlocked,
|
|
@@ -446,11 +447,11 @@ let f = class extends O {
|
|
|
446
447
|
<div class="day-number">${t.dayNumber}</div>
|
|
447
448
|
|
|
448
449
|
<div class="slot-indicator">
|
|
449
|
-
${t.isBlocked ? d`<div class="badge blocked-day">${((
|
|
450
|
-
var
|
|
450
|
+
${t.isBlocked ? d`<div class="badge blocked-day">${((h = t.rule) == null ? void 0 : h.description) || "Bloqueado"}</div>` : r.slice(0, 2).map((n) => {
|
|
451
|
+
var c, m;
|
|
451
452
|
return d`
|
|
452
|
-
<div class="badge blocked-slot" title=${((
|
|
453
|
-
🚫 ${((
|
|
453
|
+
<div class="badge blocked-slot" title=${((c = n.rule) == null ? void 0 : c.description) || ""}>
|
|
454
|
+
🚫 ${((m = n.rule) == null ? void 0 : m.description) || n.start}
|
|
454
455
|
</div>
|
|
455
456
|
`;
|
|
456
457
|
})}
|
|
@@ -495,43 +496,43 @@ f.styles = E`
|
|
|
495
496
|
.day-number { margin-bottom: 0; font-size: 0.8rem; }
|
|
496
497
|
}
|
|
497
498
|
`;
|
|
498
|
-
|
|
499
|
+
D([
|
|
499
500
|
s({ type: Array })
|
|
500
501
|
], f.prototype, "days", 2);
|
|
501
|
-
|
|
502
|
+
D([
|
|
502
503
|
s({ type: String })
|
|
503
504
|
], f.prototype, "locale", 2);
|
|
504
|
-
|
|
505
|
+
D([
|
|
505
506
|
s({ type: Number })
|
|
506
507
|
], f.prototype, "startOfWeekDay", 2);
|
|
507
|
-
|
|
508
|
+
D([
|
|
508
509
|
s({ type: Array })
|
|
509
510
|
], f.prototype, "selectedDates", 2);
|
|
510
|
-
|
|
511
|
+
D([
|
|
511
512
|
s({ type: String })
|
|
512
513
|
], f.prototype, "role", 2);
|
|
513
|
-
|
|
514
|
+
D([
|
|
514
515
|
s({ type: String, reflect: !0 })
|
|
515
516
|
], f.prototype, "size", 2);
|
|
516
|
-
|
|
517
|
+
D([
|
|
517
518
|
s({ type: String })
|
|
518
519
|
], f.prototype, "minDate", 2);
|
|
519
|
-
|
|
520
|
+
D([
|
|
520
521
|
s({ type: String })
|
|
521
522
|
], f.prototype, "maxDate", 2);
|
|
522
|
-
|
|
523
|
+
D([
|
|
523
524
|
s({ type: Boolean })
|
|
524
525
|
], f.prototype, "showNeighboringMonth", 2);
|
|
525
|
-
|
|
526
|
+
D([
|
|
526
527
|
s({ attribute: !1 })
|
|
527
528
|
], f.prototype, "tileClassName", 2);
|
|
528
|
-
f =
|
|
529
|
+
f = D([
|
|
529
530
|
T("glatam-calendar-month-view")
|
|
530
531
|
], f);
|
|
531
|
-
var
|
|
532
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
532
|
+
var H = Object.defineProperty, q = Object.getOwnPropertyDescriptor, R = (e, t, a, i) => {
|
|
533
|
+
for (var r = i > 1 ? void 0 : i ? q(t, a) : t, l = e.length - 1, o; l >= 0; l--)
|
|
533
534
|
(o = e[l]) && (r = (i ? o(t, a, r) : o(r)) || r);
|
|
534
|
-
return i && r &&
|
|
535
|
+
return i && r && H(t, a, r), r;
|
|
535
536
|
};
|
|
536
537
|
let w = class extends O {
|
|
537
538
|
constructor() {
|
|
@@ -596,22 +597,22 @@ let w = class extends O {
|
|
|
596
597
|
</div>
|
|
597
598
|
|
|
598
599
|
${t.slots.map((l, o) => {
|
|
599
|
-
var
|
|
600
|
-
const
|
|
600
|
+
var m, y;
|
|
601
|
+
const h = l.isBlocked, n = this.isSlotSelected(t.dateString, l), c = this.isSlotDragSelecting(a, o);
|
|
601
602
|
return d`
|
|
602
603
|
<div
|
|
603
|
-
class=${
|
|
604
|
+
class=${N({
|
|
604
605
|
"slot-cell": !0,
|
|
605
|
-
available: !
|
|
606
|
-
blocked:
|
|
606
|
+
available: !h,
|
|
607
|
+
blocked: h,
|
|
607
608
|
selected: n,
|
|
608
|
-
"drag-selecting":
|
|
609
|
+
"drag-selecting": c
|
|
609
610
|
})}
|
|
610
|
-
@mousedown=${() => this.handleMouseDown(a, o,
|
|
611
|
-
@mouseenter=${() => this.handleMouseEnter(a, o,
|
|
612
|
-
title=${
|
|
611
|
+
@mousedown=${() => this.handleMouseDown(a, o, h)}
|
|
612
|
+
@mouseenter=${() => this.handleMouseEnter(a, o, h)}
|
|
613
|
+
title=${h && ((m = l.rule) != null && m.description) ? l.rule.description : ""}
|
|
613
614
|
>
|
|
614
|
-
${
|
|
615
|
+
${h ? ((y = l.rule) == null ? void 0 : y.description) || "Ocupado" : n ? "Reservado" : ""}
|
|
615
616
|
</div>
|
|
616
617
|
`;
|
|
617
618
|
})}
|
|
@@ -690,26 +691,26 @@ R([
|
|
|
690
691
|
s({ type: String })
|
|
691
692
|
], w.prototype, "role", 2);
|
|
692
693
|
R([
|
|
693
|
-
|
|
694
|
+
u()
|
|
694
695
|
], w.prototype, "isDragging", 2);
|
|
695
696
|
R([
|
|
696
|
-
|
|
697
|
+
u()
|
|
697
698
|
], w.prototype, "dragDayIndex", 2);
|
|
698
699
|
R([
|
|
699
|
-
|
|
700
|
+
u()
|
|
700
701
|
], w.prototype, "dragStartSlotIndex", 2);
|
|
701
702
|
R([
|
|
702
|
-
|
|
703
|
+
u()
|
|
703
704
|
], w.prototype, "dragEndSlotIndex", 2);
|
|
704
705
|
w = R([
|
|
705
706
|
T("glatam-calendar-week-view")
|
|
706
707
|
], w);
|
|
707
|
-
var
|
|
708
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
708
|
+
var G = Object.defineProperty, V = Object.getOwnPropertyDescriptor, z = (e, t, a, i) => {
|
|
709
|
+
for (var r = i > 1 ? void 0 : i ? V(t, a) : t, l = e.length - 1, o; l >= 0; l--)
|
|
709
710
|
(o = e[l]) && (r = (i ? o(t, a, r) : o(r)) || r);
|
|
710
|
-
return i && r &&
|
|
711
|
+
return i && r && G(t, a, r), r;
|
|
711
712
|
};
|
|
712
|
-
let
|
|
713
|
+
let S = class extends O {
|
|
713
714
|
constructor() {
|
|
714
715
|
super(...arguments), this.day = null, this.slots = [], this.locale = "es", this.selectedRange = null, this.role = "provider", this.isDragging = !1, this.dragStartSlotIndex = null, this.dragEndSlotIndex = null, this.handleMouseUp = () => {
|
|
715
716
|
if (!this.isDragging || !this.day || this.dragStartSlotIndex === null || this.dragEndSlotIndex === null) {
|
|
@@ -769,11 +770,11 @@ let D = class extends O {
|
|
|
769
770
|
</div>
|
|
770
771
|
|
|
771
772
|
${this.day.slots.map((a, i) => {
|
|
772
|
-
var
|
|
773
|
+
var h, n;
|
|
773
774
|
const r = a.isBlocked, l = this.isSlotSelected(a), o = this.isSlotDragSelecting(i);
|
|
774
775
|
return d`
|
|
775
776
|
<div
|
|
776
|
-
class=${
|
|
777
|
+
class=${N({
|
|
777
778
|
"slot-cell": !0,
|
|
778
779
|
available: !r,
|
|
779
780
|
blocked: r,
|
|
@@ -782,7 +783,7 @@ let D = class extends O {
|
|
|
782
783
|
})}
|
|
783
784
|
@mousedown=${() => this.handleMouseDown(i, r)}
|
|
784
785
|
@mouseenter=${() => this.handleMouseEnter(i, r)}
|
|
785
|
-
title=${r && ((
|
|
786
|
+
title=${r && ((h = a.rule) != null && h.description) ? a.rule.description : ""}
|
|
786
787
|
>
|
|
787
788
|
${r ? ((n = a.rule) == null ? void 0 : n.description) || "Ocupado" : l ? "Reservado" : ""}
|
|
788
789
|
</div>
|
|
@@ -792,7 +793,7 @@ let D = class extends O {
|
|
|
792
793
|
`;
|
|
793
794
|
}
|
|
794
795
|
};
|
|
795
|
-
|
|
796
|
+
S.styles = E`
|
|
796
797
|
:host {
|
|
797
798
|
display: grid; grid-template-columns: var(--glatam-time-col-width) 1fr; gap: 2px;
|
|
798
799
|
width: 100%; background-color: var(--glatam-border); border: 1px solid var(--glatam-border);
|
|
@@ -824,35 +825,191 @@ D.styles = E`
|
|
|
824
825
|
`;
|
|
825
826
|
z([
|
|
826
827
|
s({ type: Object })
|
|
827
|
-
],
|
|
828
|
+
], S.prototype, "day", 2);
|
|
828
829
|
z([
|
|
829
830
|
s({ type: Array })
|
|
830
|
-
],
|
|
831
|
+
], S.prototype, "slots", 2);
|
|
831
832
|
z([
|
|
832
833
|
s({ type: String })
|
|
833
|
-
],
|
|
834
|
+
], S.prototype, "locale", 2);
|
|
834
835
|
z([
|
|
835
836
|
s({ type: Object })
|
|
836
|
-
],
|
|
837
|
+
], S.prototype, "selectedRange", 2);
|
|
837
838
|
z([
|
|
838
839
|
s({ type: String })
|
|
839
|
-
],
|
|
840
|
+
], S.prototype, "role", 2);
|
|
840
841
|
z([
|
|
841
|
-
|
|
842
|
-
],
|
|
842
|
+
u()
|
|
843
|
+
], S.prototype, "isDragging", 2);
|
|
843
844
|
z([
|
|
844
|
-
|
|
845
|
-
],
|
|
845
|
+
u()
|
|
846
|
+
], S.prototype, "dragStartSlotIndex", 2);
|
|
846
847
|
z([
|
|
847
|
-
|
|
848
|
-
],
|
|
849
|
-
|
|
848
|
+
u()
|
|
849
|
+
], S.prototype, "dragEndSlotIndex", 2);
|
|
850
|
+
S = z([
|
|
850
851
|
T("glatam-calendar-day-view")
|
|
851
|
-
],
|
|
852
|
-
|
|
853
|
-
|
|
852
|
+
], S);
|
|
853
|
+
const Y = E`
|
|
854
|
+
dialog {
|
|
855
|
+
background: transparent;
|
|
856
|
+
border: none;
|
|
857
|
+
padding: 0;
|
|
858
|
+
overflow: visible;
|
|
859
|
+
outline: none;
|
|
860
|
+
max-width: 100vw;
|
|
861
|
+
max-height: 100vh;
|
|
862
|
+
}
|
|
863
|
+
dialog::backdrop {
|
|
864
|
+
background: rgba(0, 0, 0, 0.35);
|
|
865
|
+
backdrop-filter: blur(10px);
|
|
866
|
+
-webkit-backdrop-filter: blur(10px);
|
|
867
|
+
}
|
|
868
|
+
.modal-content {
|
|
869
|
+
background: var(--glatam-bg);
|
|
870
|
+
color: var(--glatam-text);
|
|
871
|
+
border-radius: 24px;
|
|
872
|
+
padding: 28px;
|
|
873
|
+
width: 90vw;
|
|
874
|
+
max-width: 400px;
|
|
875
|
+
box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
|
|
876
|
+
border: 1px solid var(--glatam-border);
|
|
877
|
+
display: flex;
|
|
878
|
+
flex-direction: column;
|
|
879
|
+
gap: 18px;
|
|
880
|
+
box-sizing: border-box;
|
|
881
|
+
animation: zoomIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
|
|
882
|
+
}
|
|
883
|
+
@keyframes zoomIn {
|
|
884
|
+
from {
|
|
885
|
+
transform: scale(0.92) translateY(10px);
|
|
886
|
+
opacity: 0;
|
|
887
|
+
}
|
|
888
|
+
to {
|
|
889
|
+
transform: scale(1) translateY(0);
|
|
890
|
+
opacity: 1;
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
h3 { margin: 0; font-size: 1.3rem; font-weight: 700; letter-spacing: -0.02em; }
|
|
894
|
+
.form-group { display: flex; flex-direction: column; gap: 6px; }
|
|
895
|
+
label { font-size: 0.8rem; color: var(--glatam-text-secondary); font-weight: 600; }
|
|
896
|
+
input[type="text"] {
|
|
897
|
+
background: var(--glatam-surface);
|
|
898
|
+
border: 1px solid var(--glatam-border);
|
|
899
|
+
border-radius: 10px;
|
|
900
|
+
padding: 10px 14px;
|
|
901
|
+
color: var(--glatam-text);
|
|
902
|
+
font-family: inherit;
|
|
903
|
+
font-size: 0.9rem;
|
|
904
|
+
outline: none;
|
|
905
|
+
transition: border-color var(--glatam-transition-fast);
|
|
906
|
+
}
|
|
907
|
+
input[type="text"]:focus {
|
|
908
|
+
border-color: var(--glatam-primary);
|
|
909
|
+
}
|
|
910
|
+
.switch-row {
|
|
911
|
+
display: flex;
|
|
912
|
+
justify-content: space-between;
|
|
913
|
+
align-items: center;
|
|
914
|
+
padding: 4px 0;
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
/* Apple Switch Style */
|
|
918
|
+
.switch {
|
|
919
|
+
position: relative;
|
|
920
|
+
display: inline-block;
|
|
921
|
+
width: 46px;
|
|
922
|
+
height: 26px;
|
|
923
|
+
}
|
|
924
|
+
.switch input { opacity: 0; width: 0; height: 0; }
|
|
925
|
+
.slider {
|
|
926
|
+
position: absolute;
|
|
927
|
+
cursor: pointer;
|
|
928
|
+
top: 0; left: 0; right: 0; bottom: 0;
|
|
929
|
+
background-color: var(--glatam-border);
|
|
930
|
+
transition: .25s cubic-bezier(0.16, 1, 0.3, 1);
|
|
931
|
+
border-radius: 26px;
|
|
932
|
+
}
|
|
933
|
+
.slider:before {
|
|
934
|
+
position: absolute;
|
|
935
|
+
content: "";
|
|
936
|
+
height: 20px;
|
|
937
|
+
width: 20px;
|
|
938
|
+
left: 3px;
|
|
939
|
+
bottom: 3px;
|
|
940
|
+
background-color: white;
|
|
941
|
+
transition: .25s cubic-bezier(0.16, 1, 0.3, 1);
|
|
942
|
+
border-radius: 50%;
|
|
943
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
|
|
944
|
+
}
|
|
945
|
+
input:checked + .slider {
|
|
946
|
+
background-color: var(--glatam-primary);
|
|
947
|
+
}
|
|
948
|
+
input:checked + .slider:before {
|
|
949
|
+
transform: translateX(20px);
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
.days-grid {
|
|
953
|
+
display: grid;
|
|
954
|
+
grid-template-columns: repeat(7, 1fr);
|
|
955
|
+
gap: 6px;
|
|
956
|
+
margin-top: 4px;
|
|
957
|
+
}
|
|
958
|
+
.day-btn {
|
|
959
|
+
width: 36px;
|
|
960
|
+
height: 36px;
|
|
961
|
+
margin: 0 auto;
|
|
962
|
+
border-radius: 50%;
|
|
963
|
+
border: 1px solid var(--glatam-border);
|
|
964
|
+
background: var(--glatam-bg);
|
|
965
|
+
color: var(--glatam-text);
|
|
966
|
+
font-size: 0.8rem;
|
|
967
|
+
font-weight: 600;
|
|
968
|
+
cursor: pointer;
|
|
969
|
+
display: flex;
|
|
970
|
+
align-items: center;
|
|
971
|
+
justify-content: center;
|
|
972
|
+
transition: background-color var(--glatam-transition-fast), color var(--glatam-transition-fast), border-color var(--glatam-transition-fast);
|
|
973
|
+
}
|
|
974
|
+
.day-btn:hover {
|
|
975
|
+
background-color: var(--glatam-surface);
|
|
976
|
+
}
|
|
977
|
+
.day-btn.selected {
|
|
978
|
+
background: var(--glatam-primary);
|
|
979
|
+
color: var(--glatam-text-light);
|
|
980
|
+
border-color: var(--glatam-primary);
|
|
981
|
+
}
|
|
982
|
+
.btn-actions { display: flex; gap: 10px; margin-top: 10px; justify-content: flex-end; }
|
|
983
|
+
.btn {
|
|
984
|
+
padding: 10px 18px;
|
|
985
|
+
border-radius: 20px;
|
|
986
|
+
font-size: 0.875rem;
|
|
987
|
+
font-weight: 600;
|
|
988
|
+
cursor: pointer;
|
|
989
|
+
border: none;
|
|
990
|
+
transition: opacity var(--glatam-transition-fast), transform var(--glatam-transition-fast);
|
|
991
|
+
display: inline-flex;
|
|
992
|
+
align-items: center;
|
|
993
|
+
justify-content: center;
|
|
994
|
+
}
|
|
995
|
+
.btn:active { transform: scale(0.97); }
|
|
996
|
+
.btn-cancel { background: transparent; color: var(--glatam-text); border: 1px solid var(--glatam-border); }
|
|
997
|
+
.btn-cancel:hover { background-color: var(--glatam-surface); }
|
|
998
|
+
.btn-save { background: var(--glatam-primary); color: var(--glatam-text-light); }
|
|
999
|
+
.btn-save:hover { opacity: 0.95; }
|
|
1000
|
+
.btn-danger {
|
|
1001
|
+
background: rgba(255, 69, 58, 0.12);
|
|
1002
|
+
color: #ff453a;
|
|
1003
|
+
margin-right: auto;
|
|
1004
|
+
}
|
|
1005
|
+
.btn-danger:hover {
|
|
1006
|
+
background: rgba(255, 69, 58, 0.18);
|
|
1007
|
+
}
|
|
1008
|
+
`;
|
|
1009
|
+
var Z = Object.defineProperty, J = Object.getOwnPropertyDescriptor, k = (e, t, a, i) => {
|
|
1010
|
+
for (var r = i > 1 ? void 0 : i ? J(t, a) : t, l = e.length - 1, o; l >= 0; l--)
|
|
854
1011
|
(o = e[l]) && (r = (i ? o(t, a, r) : o(r)) || r);
|
|
855
|
-
return i && r &&
|
|
1012
|
+
return i && r && Z(t, a, r), r;
|
|
856
1013
|
};
|
|
857
1014
|
let x = class extends O {
|
|
858
1015
|
constructor() {
|
|
@@ -861,8 +1018,19 @@ let x = class extends O {
|
|
|
861
1018
|
willUpdate(e) {
|
|
862
1019
|
e.has("open") && this.open && (this.existingRule ? (this.description = "Bloqueo", this.blockAllDay = !this.existingRule.slots || this.existingRule.slots.length === 0, this.isRecurring = this.existingRule.type === "weekly", this.selectedDays = this.existingRule.daysOfWeek || []) : (this.description = "", this.blockAllDay = !this.isRange, this.isRecurring = !1, this.selectedDays = [(/* @__PURE__ */ new Date(this.dateString + "T00:00:00")).getDay()]));
|
|
863
1020
|
}
|
|
1021
|
+
updated(e) {
|
|
1022
|
+
var t;
|
|
1023
|
+
if (e.has("open")) {
|
|
1024
|
+
const a = (t = this.shadowRoot) == null ? void 0 : t.getElementById("booking-dialog");
|
|
1025
|
+
a && (this.open ? a.open || a.showModal() : a.open && a.close());
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
handleDialogClose() {
|
|
1029
|
+
this.open && this.dispatchEvent(new CustomEvent("close", { bubbles: !0, composed: !0 }));
|
|
1030
|
+
}
|
|
864
1031
|
toggleDay(e) {
|
|
865
|
-
|
|
1032
|
+
const t = this.selectedDays.indexOf(e);
|
|
1033
|
+
this.selectedDays = t > -1 ? this.selectedDays.filter((a) => a !== e) : [...this.selectedDays, e];
|
|
866
1034
|
}
|
|
867
1035
|
handleSave() {
|
|
868
1036
|
const e = {
|
|
@@ -886,7 +1054,7 @@ let x = class extends O {
|
|
|
886
1054
|
render() {
|
|
887
1055
|
const e = ["D", "L", "M", "M", "J", "V", "S"], t = this.isRange ? `${this.dateString} (${this.startTime} - ${this.endTime})` : this.dateString;
|
|
888
1056
|
return d`
|
|
889
|
-
<
|
|
1057
|
+
<dialog id="booking-dialog" @close=${this.handleDialogClose}>
|
|
890
1058
|
<div class="modal-content">
|
|
891
1059
|
<h3>${this.existingRule ? "Gestionar Bloqueo" : "Crear Bloqueo"}</h3>
|
|
892
1060
|
|
|
@@ -950,199 +1118,50 @@ let x = class extends O {
|
|
|
950
1118
|
<button class="btn btn-save" @click=${this.handleSave}>Guardar</button>
|
|
951
1119
|
</div>
|
|
952
1120
|
</div>
|
|
953
|
-
</
|
|
1121
|
+
</dialog>
|
|
954
1122
|
`;
|
|
955
1123
|
}
|
|
956
1124
|
};
|
|
957
|
-
x.styles =
|
|
958
|
-
|
|
959
|
-
position: fixed;
|
|
960
|
-
top: 0; left: 0; right: 0; bottom: 0;
|
|
961
|
-
background: rgba(0, 0, 0, 0.35);
|
|
962
|
-
backdrop-filter: blur(10px);
|
|
963
|
-
display: flex;
|
|
964
|
-
align-items: center;
|
|
965
|
-
justify-content: center;
|
|
966
|
-
z-index: 1000;
|
|
967
|
-
opacity: 0; pointer-events: none;
|
|
968
|
-
transition: opacity var(--glatam-transition-normal);
|
|
969
|
-
}
|
|
970
|
-
.modal-overlay.open {
|
|
971
|
-
opacity: 1; pointer-events: auto;
|
|
972
|
-
}
|
|
973
|
-
.modal-content {
|
|
974
|
-
background: var(--glatam-bg);
|
|
975
|
-
color: var(--glatam-text);
|
|
976
|
-
border-radius: 24px;
|
|
977
|
-
padding: 28px;
|
|
978
|
-
width: 90%;
|
|
979
|
-
max-width: 400px;
|
|
980
|
-
box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
|
|
981
|
-
border: 1px solid var(--glatam-border);
|
|
982
|
-
transform: scale(0.92) translateY(10px);
|
|
983
|
-
transition: transform var(--glatam-transition-normal), background-color var(--glatam-transition-normal);
|
|
984
|
-
display: flex;
|
|
985
|
-
flex-direction: column;
|
|
986
|
-
gap: 18px;
|
|
987
|
-
}
|
|
988
|
-
.modal-overlay.open .modal-content {
|
|
989
|
-
transform: scale(1) translateY(0);
|
|
990
|
-
}
|
|
991
|
-
h3 { margin: 0; font-size: 1.3rem; font-weight: 700; letter-spacing: -0.02em; }
|
|
992
|
-
.form-group { display: flex; flex-direction: column; gap: 6px; }
|
|
993
|
-
label { font-size: 0.8rem; color: var(--glatam-text-secondary); font-weight: 600; }
|
|
994
|
-
input[type="text"] {
|
|
995
|
-
background: var(--glatam-surface);
|
|
996
|
-
border: 1px solid var(--glatam-border);
|
|
997
|
-
border-radius: 10px;
|
|
998
|
-
padding: 10px 14px;
|
|
999
|
-
color: var(--glatam-text);
|
|
1000
|
-
font-family: inherit;
|
|
1001
|
-
font-size: 0.9rem;
|
|
1002
|
-
outline: none;
|
|
1003
|
-
transition: border-color var(--glatam-transition-fast);
|
|
1004
|
-
}
|
|
1005
|
-
input[type="text"]:focus {
|
|
1006
|
-
border-color: var(--glatam-primary);
|
|
1007
|
-
}
|
|
1008
|
-
.switch-row {
|
|
1009
|
-
display: flex;
|
|
1010
|
-
justify-content: space-between;
|
|
1011
|
-
align-items: center;
|
|
1012
|
-
padding: 4px 0;
|
|
1013
|
-
}
|
|
1014
|
-
|
|
1015
|
-
/* Apple Switch Style */
|
|
1016
|
-
.switch {
|
|
1017
|
-
position: relative;
|
|
1018
|
-
display: inline-block;
|
|
1019
|
-
width: 46px;
|
|
1020
|
-
height: 26px;
|
|
1021
|
-
}
|
|
1022
|
-
.switch input { opacity: 0; width: 0; height: 0; }
|
|
1023
|
-
.slider {
|
|
1024
|
-
position: absolute;
|
|
1025
|
-
cursor: pointer;
|
|
1026
|
-
top: 0; left: 0; right: 0; bottom: 0;
|
|
1027
|
-
background-color: var(--glatam-border);
|
|
1028
|
-
transition: .25s cubic-bezier(0.16, 1, 0.3, 1);
|
|
1029
|
-
border-radius: 26px;
|
|
1030
|
-
}
|
|
1031
|
-
.slider:before {
|
|
1032
|
-
position: absolute;
|
|
1033
|
-
content: "";
|
|
1034
|
-
height: 20px;
|
|
1035
|
-
width: 20px;
|
|
1036
|
-
left: 3px;
|
|
1037
|
-
bottom: 3px;
|
|
1038
|
-
background-color: white;
|
|
1039
|
-
transition: .25s cubic-bezier(0.16, 1, 0.3, 1);
|
|
1040
|
-
border-radius: 50%;
|
|
1041
|
-
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
|
|
1042
|
-
}
|
|
1043
|
-
input:checked + .slider {
|
|
1044
|
-
background-color: var(--glatam-primary);
|
|
1045
|
-
}
|
|
1046
|
-
input:checked + .slider:before {
|
|
1047
|
-
transform: translateX(20px);
|
|
1048
|
-
}
|
|
1049
|
-
|
|
1050
|
-
.days-grid {
|
|
1051
|
-
display: grid;
|
|
1052
|
-
grid-template-columns: repeat(7, 1fr);
|
|
1053
|
-
gap: 6px;
|
|
1054
|
-
margin-top: 4px;
|
|
1055
|
-
}
|
|
1056
|
-
.day-btn {
|
|
1057
|
-
width: 36px;
|
|
1058
|
-
height: 36px;
|
|
1059
|
-
margin: 0 auto;
|
|
1060
|
-
border-radius: 50%;
|
|
1061
|
-
border: 1px solid var(--glatam-border);
|
|
1062
|
-
background: var(--glatam-bg);
|
|
1063
|
-
color: var(--glatam-text);
|
|
1064
|
-
font-size: 0.8rem;
|
|
1065
|
-
font-weight: 600;
|
|
1066
|
-
cursor: pointer;
|
|
1067
|
-
display: flex;
|
|
1068
|
-
align-items: center;
|
|
1069
|
-
justify-content: center;
|
|
1070
|
-
transition: background-color var(--glatam-transition-fast), color var(--glatam-transition-fast), border-color var(--glatam-transition-fast);
|
|
1071
|
-
}
|
|
1072
|
-
.day-btn:hover {
|
|
1073
|
-
background-color: var(--glatam-surface);
|
|
1074
|
-
}
|
|
1075
|
-
.day-btn.selected {
|
|
1076
|
-
background: var(--glatam-primary);
|
|
1077
|
-
color: var(--glatam-text-light);
|
|
1078
|
-
border-color: var(--glatam-primary);
|
|
1079
|
-
}
|
|
1080
|
-
.btn-actions { display: flex; gap: 10px; margin-top: 10px; justify-content: flex-end; }
|
|
1081
|
-
.btn {
|
|
1082
|
-
padding: 10px 18px;
|
|
1083
|
-
border-radius: 20px;
|
|
1084
|
-
font-size: 0.875rem;
|
|
1085
|
-
font-weight: 600;
|
|
1086
|
-
cursor: pointer;
|
|
1087
|
-
border: none;
|
|
1088
|
-
transition: opacity var(--glatam-transition-fast), transform var(--glatam-transition-fast);
|
|
1089
|
-
display: inline-flex;
|
|
1090
|
-
align-items: center;
|
|
1091
|
-
justify-content: center;
|
|
1092
|
-
}
|
|
1093
|
-
.btn:active { transform: scale(0.97); }
|
|
1094
|
-
.btn-cancel { background: transparent; color: var(--glatam-text); border: 1px solid var(--glatam-border); }
|
|
1095
|
-
.btn-cancel:hover { background-color: var(--glatam-surface); }
|
|
1096
|
-
.btn-save { background: var(--glatam-primary); color: var(--glatam-text-light); }
|
|
1097
|
-
.btn-save:hover { opacity: 0.95; }
|
|
1098
|
-
.btn-danger {
|
|
1099
|
-
background: rgba(255, 69, 58, 0.12);
|
|
1100
|
-
color: #ff453a;
|
|
1101
|
-
margin-right: auto;
|
|
1102
|
-
}
|
|
1103
|
-
.btn-danger:hover {
|
|
1104
|
-
background: rgba(255, 69, 58, 0.18);
|
|
1105
|
-
}
|
|
1106
|
-
`;
|
|
1107
|
-
$([
|
|
1125
|
+
x.styles = Y;
|
|
1126
|
+
k([
|
|
1108
1127
|
s({ type: Boolean })
|
|
1109
1128
|
], x.prototype, "open", 2);
|
|
1110
|
-
|
|
1129
|
+
k([
|
|
1111
1130
|
s({ type: String })
|
|
1112
1131
|
], x.prototype, "dateString", 2);
|
|
1113
|
-
|
|
1132
|
+
k([
|
|
1114
1133
|
s({ type: String })
|
|
1115
1134
|
], x.prototype, "startTime", 2);
|
|
1116
|
-
|
|
1135
|
+
k([
|
|
1117
1136
|
s({ type: String })
|
|
1118
1137
|
], x.prototype, "endTime", 2);
|
|
1119
|
-
|
|
1138
|
+
k([
|
|
1120
1139
|
s({ type: Boolean })
|
|
1121
1140
|
], x.prototype, "isRange", 2);
|
|
1122
|
-
|
|
1141
|
+
k([
|
|
1123
1142
|
s({ type: Object })
|
|
1124
1143
|
], x.prototype, "existingRule", 2);
|
|
1125
|
-
|
|
1126
|
-
|
|
1144
|
+
k([
|
|
1145
|
+
u()
|
|
1127
1146
|
], x.prototype, "description", 2);
|
|
1128
|
-
|
|
1129
|
-
|
|
1147
|
+
k([
|
|
1148
|
+
u()
|
|
1130
1149
|
], x.prototype, "blockAllDay", 2);
|
|
1131
|
-
|
|
1132
|
-
|
|
1150
|
+
k([
|
|
1151
|
+
u()
|
|
1133
1152
|
], x.prototype, "isRecurring", 2);
|
|
1134
|
-
|
|
1135
|
-
|
|
1153
|
+
k([
|
|
1154
|
+
u()
|
|
1136
1155
|
], x.prototype, "selectedDays", 2);
|
|
1137
|
-
x =
|
|
1156
|
+
x = k([
|
|
1138
1157
|
T("glatam-calendar-modal")
|
|
1139
1158
|
], x);
|
|
1140
|
-
var
|
|
1141
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
1159
|
+
var X = Object.defineProperty, K = Object.getOwnPropertyDescriptor, p = (e, t, a, i) => {
|
|
1160
|
+
for (var r = i > 1 ? void 0 : i ? K(t, a) : t, l = e.length - 1, o; l >= 0; l--)
|
|
1142
1161
|
(o = e[l]) && (r = (i ? o(t, a, r) : o(r)) || r);
|
|
1143
|
-
return i && r &&
|
|
1162
|
+
return i && r && X(t, a, r), r;
|
|
1144
1163
|
};
|
|
1145
|
-
const
|
|
1164
|
+
const Q = [
|
|
1146
1165
|
{ start: "09:00", end: "10:00" },
|
|
1147
1166
|
{ start: "10:00", end: "11:00" },
|
|
1148
1167
|
{ start: "11:00", end: "12:00" },
|
|
@@ -1153,9 +1172,9 @@ const X = [
|
|
|
1153
1172
|
{ start: "16:00", end: "17:00" },
|
|
1154
1173
|
{ start: "17:00", end: "18:00" }
|
|
1155
1174
|
];
|
|
1156
|
-
let
|
|
1175
|
+
let g = class extends O {
|
|
1157
1176
|
constructor() {
|
|
1158
|
-
super(...arguments), this.role = "provider", this.size = "medium", this.view = "month", this.locale = "es", this.startOfWeekDay = 0, this.rules = [], this.selectedDates = [], this.selectedRange = null, this.hostTimezone = "America/Bogota", this.activeTimezone = "local", this.slots =
|
|
1177
|
+
super(...arguments), this.role = "provider", this.size = "medium", this.view = "month", this.locale = "es", this.startOfWeekDay = 0, this.rules = [], this.selectedDates = [], this.selectedRange = null, this.hostTimezone = "America/Bogota", this.activeTimezone = "local", this.slots = Q, this.minDate = "", this.maxDate = "", this.showNeighboringMonth = !0, this.tileClassName = null, this.activeDate = /* @__PURE__ */ new Date(), this.localRules = [], this.darkMode = !1, this.modalOpen = !1, this.modalDateString = "", this.modalStartTime = "", this.modalEndTime = "", this.modalIsRange = !1, this.modalExistingRule = null;
|
|
1159
1178
|
}
|
|
1160
1179
|
firstUpdated() {
|
|
1161
1180
|
this.darkMode = window.matchMedia("(prefers-color-scheme: dark)").matches, this.localRules = [...this.rules];
|
|
@@ -1183,25 +1202,29 @@ let p = class extends O {
|
|
|
1183
1202
|
this.role === "buyer" && a || (this.activeDate = /* @__PURE__ */ new Date(t + "T00:00:00"), this.view = "day", this.dispatchEvent(new CustomEvent("date-selected", { detail: { dateString: t }, bubbles: !0, composed: !0 })));
|
|
1184
1203
|
}
|
|
1185
1204
|
handleRangeSelect(e) {
|
|
1186
|
-
var
|
|
1187
|
-
const { dateString: t, start: a, end: i } = e.detail, r = this.activeTimezone === "local" ? C(this.activeDate, this.hostTimezone, "local") : 0, l =
|
|
1205
|
+
var $, M;
|
|
1206
|
+
const { dateString: t, start: a, end: i } = e.detail, r = this.activeTimezone === "local" ? C(this.activeDate, this.hostTimezone, "local") : 0, l = (/* @__PURE__ */ new Date()).toISOString().split("T")[0], o = this.minDate || (this.role === "buyer" ? l : "");
|
|
1207
|
+
if (this.role === "buyer" && o && t < o) return;
|
|
1208
|
+
const h = this.getDisplaySlots(r), n = h.findIndex((B) => B.start === a), c = h.findIndex((B) => B.end === i), m = (($ = this.slots[n]) == null ? void 0 : $.start) || a, y = ((M = this.slots[c]) == null ? void 0 : M.end) || i;
|
|
1188
1209
|
if (this.role === "buyer") {
|
|
1189
|
-
this.selectedRange = { dateString: t, start: a, end: i }, this.dispatchEvent(new CustomEvent("booking-selected", { detail: { dateString: t, start: a, end: i, hostStart:
|
|
1210
|
+
this.selectedRange = { dateString: t, start: a, end: i }, this.dispatchEvent(new CustomEvent("booking-selected", { detail: { dateString: t, start: a, end: i, hostStart: m, hostEnd: y }, bubbles: !0, composed: !0 }));
|
|
1190
1211
|
return;
|
|
1191
1212
|
}
|
|
1192
|
-
this.openModal(t,
|
|
1213
|
+
this.openModal(t, m, y, !0, null);
|
|
1193
1214
|
}
|
|
1194
1215
|
handleSlotClick(e) {
|
|
1195
|
-
const { dateString: t, slot: a } = e.detail, i = /* @__PURE__ */ new Date(t + "T00:00:00"), r = this.activeTimezone === "local" ? C(this.activeDate, this.hostTimezone, "local") : 0, l =
|
|
1216
|
+
const { dateString: t, slot: a } = e.detail, i = /* @__PURE__ */ new Date(t + "T00:00:00"), r = this.activeTimezone === "local" ? C(this.activeDate, this.hostTimezone, "local") : 0, l = (/* @__PURE__ */ new Date()).toISOString().split("T")[0], o = this.minDate || (this.role === "buyer" ? l : "");
|
|
1217
|
+
if (this.role === "buyer" && (a.isBlocked || o && t < o)) return;
|
|
1218
|
+
const h = this.getDisplaySlots(r), n = h.findIndex((y) => y.start === a.start), c = this.slots[n] || a;
|
|
1196
1219
|
if (this.role === "buyer") {
|
|
1197
1220
|
this.selectedRange = { dateString: t, start: a.start, end: a.end }, this.dispatchEvent(new CustomEvent("booking-selected", { detail: { dateString: t, start: a.start, end: a.end, hostStart: c.start, hostEnd: c.end }, bubbles: !0, composed: !0 }));
|
|
1198
1221
|
return;
|
|
1199
1222
|
}
|
|
1200
|
-
const
|
|
1201
|
-
this.openModal(t, c.start, c.end, !0,
|
|
1223
|
+
const m = this.localRules.find((y) => I(i, c, [y]));
|
|
1224
|
+
this.openModal(t, c.start, c.end, !0, m || null);
|
|
1202
1225
|
}
|
|
1203
1226
|
handleBlockDayAction() {
|
|
1204
|
-
const e =
|
|
1227
|
+
const e = _(this.activeDate), t = this.localRules.find((a) => I(this.activeDate, void 0, [a]));
|
|
1205
1228
|
this.openModal(e, "", "", !1, t || null);
|
|
1206
1229
|
}
|
|
1207
1230
|
openModal(e, t, a, i, r) {
|
|
@@ -1224,16 +1247,16 @@ let p = class extends O {
|
|
|
1224
1247
|
}
|
|
1225
1248
|
getDisplaySlots(e) {
|
|
1226
1249
|
return e === 0 ? this.slots : this.slots.map((t) => {
|
|
1227
|
-
const a =
|
|
1250
|
+
const a = U(t, e), i = a.dayShift > 0 ? " (+1d)" : a.dayShift < 0 ? " (-1d)" : "";
|
|
1228
1251
|
return { start: a.start + i, end: a.end + i };
|
|
1229
1252
|
});
|
|
1230
1253
|
}
|
|
1231
1254
|
render() {
|
|
1232
|
-
var
|
|
1233
|
-
const e = this.activeDate.getFullYear(), t = this.activeDate.getMonth(), a =
|
|
1234
|
-
var
|
|
1235
|
-
return { ...
|
|
1236
|
-
}) })), o = ((
|
|
1255
|
+
var h;
|
|
1256
|
+
const e = this.activeDate.getFullYear(), t = this.activeDate.getMonth(), a = I(this.activeDate, void 0, this.localRules), i = this.activeTimezone === "local" ? C(this.activeDate, this.hostTimezone, "local") : 0, r = this.getDisplaySlots(i), l = (n) => n.map((c) => ({ ...c, slots: c.slots.map((m, y) => {
|
|
1257
|
+
var $, M;
|
|
1258
|
+
return { ...m, start: (($ = r[y]) == null ? void 0 : $.start) || m.start, end: ((M = r[y]) == null ? void 0 : M.end) || m.end };
|
|
1259
|
+
}) })), o = ((h = this.hostTimezone.split("/").pop()) == null ? void 0 : h.replace("_", " ")) || "Anfitrión";
|
|
1237
1260
|
return d`
|
|
1238
1261
|
<div class="calendar-header">
|
|
1239
1262
|
<div class="nav-group">
|
|
@@ -1264,7 +1287,7 @@ let p = class extends O {
|
|
|
1264
1287
|
</div>
|
|
1265
1288
|
|
|
1266
1289
|
<div class="calendar-body">
|
|
1267
|
-
${this.view === "month" ? d`<glatam-calendar-month-view .days=${
|
|
1290
|
+
${this.view === "month" ? d`<glatam-calendar-month-view .days=${A(e, t, this.localRules, this.slots, this.startOfWeekDay)} .locale=${this.locale} .startOfWeekDay=${this.startOfWeekDay} .role=${this.role} .size=${this.size} .minDate=${this.minDate || (this.role === "buyer" ? (/* @__PURE__ */ new Date()).toISOString().split("T")[0] : "")} .maxDate=${this.maxDate} .showNeighboringMonth=${this.showNeighboringMonth} .tileClassName=${this.tileClassName} @day-select=${this.handleDaySelect}></glatam-calendar-month-view>` : this.view === "week" ? d`<glatam-calendar-week-view .days=${l(j(this.activeDate, this.localRules, this.slots, this.startOfWeekDay))} .slots=${r} .locale=${this.locale} .selectedRange=${this.selectedRange} .role=${this.role} @range-select=${this.handleRangeSelect} @slot-click=${this.handleSlotClick}></glatam-calendar-week-view>` : d`<glatam-calendar-day-view .day=${l(j(this.activeDate, this.localRules, this.slots, this.startOfWeekDay)).find((n) => n.dateString === _(this.activeDate)) || null} .slots=${r} .locale=${this.locale} .selectedRange=${this.selectedRange} .role=${this.role} @range-select=${this.handleRangeSelect} @slot-click=${this.handleSlotClick}></glatam-calendar-day-view>`}
|
|
1268
1291
|
</div>
|
|
1269
1292
|
|
|
1270
1293
|
<glatam-calendar-modal
|
|
@@ -1275,86 +1298,86 @@ let p = class extends O {
|
|
|
1275
1298
|
`;
|
|
1276
1299
|
}
|
|
1277
1300
|
};
|
|
1278
|
-
|
|
1279
|
-
|
|
1301
|
+
g.styles = [P, W];
|
|
1302
|
+
p([
|
|
1280
1303
|
s({ type: String })
|
|
1281
|
-
],
|
|
1282
|
-
|
|
1304
|
+
], g.prototype, "role", 2);
|
|
1305
|
+
p([
|
|
1283
1306
|
s({ type: String, reflect: !0 })
|
|
1284
|
-
],
|
|
1285
|
-
|
|
1307
|
+
], g.prototype, "size", 2);
|
|
1308
|
+
p([
|
|
1286
1309
|
s({ type: String })
|
|
1287
|
-
],
|
|
1288
|
-
|
|
1310
|
+
], g.prototype, "view", 2);
|
|
1311
|
+
p([
|
|
1289
1312
|
s({ type: String })
|
|
1290
|
-
],
|
|
1291
|
-
|
|
1313
|
+
], g.prototype, "locale", 2);
|
|
1314
|
+
p([
|
|
1292
1315
|
s({ type: Number })
|
|
1293
|
-
],
|
|
1294
|
-
|
|
1316
|
+
], g.prototype, "startOfWeekDay", 2);
|
|
1317
|
+
p([
|
|
1295
1318
|
s({ type: Array })
|
|
1296
|
-
],
|
|
1297
|
-
|
|
1319
|
+
], g.prototype, "rules", 2);
|
|
1320
|
+
p([
|
|
1298
1321
|
s({ type: Array })
|
|
1299
|
-
],
|
|
1300
|
-
|
|
1322
|
+
], g.prototype, "selectedDates", 2);
|
|
1323
|
+
p([
|
|
1301
1324
|
s({ type: Object })
|
|
1302
|
-
],
|
|
1303
|
-
|
|
1325
|
+
], g.prototype, "selectedRange", 2);
|
|
1326
|
+
p([
|
|
1304
1327
|
s({ type: String })
|
|
1305
|
-
],
|
|
1306
|
-
|
|
1328
|
+
], g.prototype, "hostTimezone", 2);
|
|
1329
|
+
p([
|
|
1307
1330
|
s({ type: String })
|
|
1308
|
-
],
|
|
1309
|
-
|
|
1331
|
+
], g.prototype, "activeTimezone", 2);
|
|
1332
|
+
p([
|
|
1310
1333
|
s({ type: Array })
|
|
1311
|
-
],
|
|
1312
|
-
|
|
1334
|
+
], g.prototype, "slots", 2);
|
|
1335
|
+
p([
|
|
1313
1336
|
s({ type: String })
|
|
1314
|
-
],
|
|
1315
|
-
|
|
1337
|
+
], g.prototype, "minDate", 2);
|
|
1338
|
+
p([
|
|
1316
1339
|
s({ type: String })
|
|
1317
|
-
],
|
|
1318
|
-
|
|
1340
|
+
], g.prototype, "maxDate", 2);
|
|
1341
|
+
p([
|
|
1319
1342
|
s({ type: Boolean })
|
|
1320
|
-
],
|
|
1321
|
-
|
|
1343
|
+
], g.prototype, "showNeighboringMonth", 2);
|
|
1344
|
+
p([
|
|
1322
1345
|
s({ attribute: !1 })
|
|
1323
|
-
],
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
],
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
],
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
],
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
],
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
],
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
],
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
],
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
],
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
],
|
|
1351
|
-
|
|
1346
|
+
], g.prototype, "tileClassName", 2);
|
|
1347
|
+
p([
|
|
1348
|
+
u()
|
|
1349
|
+
], g.prototype, "activeDate", 2);
|
|
1350
|
+
p([
|
|
1351
|
+
u()
|
|
1352
|
+
], g.prototype, "localRules", 2);
|
|
1353
|
+
p([
|
|
1354
|
+
u()
|
|
1355
|
+
], g.prototype, "darkMode", 2);
|
|
1356
|
+
p([
|
|
1357
|
+
u()
|
|
1358
|
+
], g.prototype, "modalOpen", 2);
|
|
1359
|
+
p([
|
|
1360
|
+
u()
|
|
1361
|
+
], g.prototype, "modalDateString", 2);
|
|
1362
|
+
p([
|
|
1363
|
+
u()
|
|
1364
|
+
], g.prototype, "modalStartTime", 2);
|
|
1365
|
+
p([
|
|
1366
|
+
u()
|
|
1367
|
+
], g.prototype, "modalEndTime", 2);
|
|
1368
|
+
p([
|
|
1369
|
+
u()
|
|
1370
|
+
], g.prototype, "modalIsRange", 2);
|
|
1371
|
+
p([
|
|
1372
|
+
u()
|
|
1373
|
+
], g.prototype, "modalExistingRule", 2);
|
|
1374
|
+
g = p([
|
|
1352
1375
|
T("glatam-calendar")
|
|
1353
|
-
],
|
|
1354
|
-
var
|
|
1355
|
-
for (var r = i > 1 ? void 0 : i ?
|
|
1376
|
+
], g);
|
|
1377
|
+
var tt = Object.defineProperty, et = Object.getOwnPropertyDescriptor, v = (e, t, a, i) => {
|
|
1378
|
+
for (var r = i > 1 ? void 0 : i ? et(t, a) : t, l = e.length - 1, o; l >= 0; l--)
|
|
1356
1379
|
(o = e[l]) && (r = (i ? o(t, a, r) : o(r)) || r);
|
|
1357
|
-
return i && r &&
|
|
1380
|
+
return i && r && tt(t, a, r), r;
|
|
1358
1381
|
};
|
|
1359
1382
|
let b = class extends O {
|
|
1360
1383
|
constructor() {
|
|
@@ -1385,12 +1408,12 @@ let b = class extends O {
|
|
|
1385
1408
|
}
|
|
1386
1409
|
render() {
|
|
1387
1410
|
const e = this.selectedRange ? `Reserva: ${this.selectedRange.dateString} (${this.selectedRange.start} - ${this.selectedRange.end})` : "Seleccionar Fecha y Hora", t = this.activeDate.getFullYear(), a = this.activeDate.getMonth(), i = this.dropdownSelectedDateString ? /* @__PURE__ */ new Date(this.dropdownSelectedDateString + "T00:00:00") : null, r = i && this.activeTimezone === "local" ? C(i, this.hostTimezone, "local") : 0, l = i ? this.slots.map((o) => {
|
|
1388
|
-
const
|
|
1411
|
+
const h = I(i, o, this.rules), n = U(o, r), c = n.dayShift > 0 ? " (+1d)" : n.dayShift < 0 ? " (-1d)" : "";
|
|
1389
1412
|
return {
|
|
1390
1413
|
...o,
|
|
1391
|
-
displayStart: n.start +
|
|
1392
|
-
displayEnd: n.end +
|
|
1393
|
-
isBlocked:
|
|
1414
|
+
displayStart: n.start + c,
|
|
1415
|
+
displayEnd: n.end + c,
|
|
1416
|
+
isBlocked: h
|
|
1394
1417
|
};
|
|
1395
1418
|
}) : [];
|
|
1396
1419
|
return d`
|
|
@@ -1420,7 +1443,7 @@ let b = class extends O {
|
|
|
1420
1443
|
` : d`
|
|
1421
1444
|
<div style="font-weight:600; font-size:0.9rem; text-align:center; color: var(--glatam-text);">Selecciona un Día</div>
|
|
1422
1445
|
<glatam-calendar-month-view
|
|
1423
|
-
.days=${
|
|
1446
|
+
.days=${A(t, a, this.rules, this.slots, this.startOfWeekDay)}
|
|
1424
1447
|
.locale=${this.locale}
|
|
1425
1448
|
.startOfWeekDay=${this.startOfWeekDay}
|
|
1426
1449
|
.role=${this.role}
|
|
@@ -1439,8 +1462,8 @@ let b = class extends O {
|
|
|
1439
1462
|
}
|
|
1440
1463
|
};
|
|
1441
1464
|
b.styles = [
|
|
1442
|
-
A,
|
|
1443
1465
|
P,
|
|
1466
|
+
W,
|
|
1444
1467
|
E`
|
|
1445
1468
|
:host {
|
|
1446
1469
|
display: inline-block;
|
|
@@ -1452,67 +1475,67 @@ b.styles = [
|
|
|
1452
1475
|
}
|
|
1453
1476
|
`
|
|
1454
1477
|
];
|
|
1455
|
-
|
|
1478
|
+
v([
|
|
1456
1479
|
s({ type: String })
|
|
1457
1480
|
], b.prototype, "role", 2);
|
|
1458
|
-
|
|
1481
|
+
v([
|
|
1459
1482
|
s({ type: String })
|
|
1460
1483
|
], b.prototype, "locale", 2);
|
|
1461
|
-
|
|
1484
|
+
v([
|
|
1462
1485
|
s({ type: Number })
|
|
1463
1486
|
], b.prototype, "startOfWeekDay", 2);
|
|
1464
|
-
|
|
1487
|
+
v([
|
|
1465
1488
|
s({ type: Array })
|
|
1466
1489
|
], b.prototype, "rules", 2);
|
|
1467
|
-
|
|
1490
|
+
v([
|
|
1468
1491
|
s({ type: Object })
|
|
1469
1492
|
], b.prototype, "selectedRange", 2);
|
|
1470
|
-
|
|
1493
|
+
v([
|
|
1471
1494
|
s({ type: String, reflect: !0 })
|
|
1472
1495
|
], b.prototype, "size", 2);
|
|
1473
|
-
|
|
1496
|
+
v([
|
|
1474
1497
|
s({ type: String })
|
|
1475
1498
|
], b.prototype, "hostTimezone", 2);
|
|
1476
|
-
|
|
1499
|
+
v([
|
|
1477
1500
|
s({ type: String })
|
|
1478
1501
|
], b.prototype, "activeTimezone", 2);
|
|
1479
|
-
|
|
1502
|
+
v([
|
|
1480
1503
|
s({ type: String })
|
|
1481
1504
|
], b.prototype, "minDate", 2);
|
|
1482
|
-
|
|
1505
|
+
v([
|
|
1483
1506
|
s({ type: String })
|
|
1484
1507
|
], b.prototype, "maxDate", 2);
|
|
1485
|
-
|
|
1508
|
+
v([
|
|
1486
1509
|
s({ type: Boolean })
|
|
1487
1510
|
], b.prototype, "showNeighboringMonth", 2);
|
|
1488
|
-
|
|
1511
|
+
v([
|
|
1489
1512
|
s({ attribute: !1 })
|
|
1490
1513
|
], b.prototype, "tileClassName", 2);
|
|
1491
|
-
|
|
1514
|
+
v([
|
|
1492
1515
|
s({ type: Array })
|
|
1493
1516
|
], b.prototype, "slots", 2);
|
|
1494
|
-
|
|
1495
|
-
|
|
1517
|
+
v([
|
|
1518
|
+
u()
|
|
1496
1519
|
], b.prototype, "activeDate", 2);
|
|
1497
|
-
|
|
1498
|
-
|
|
1520
|
+
v([
|
|
1521
|
+
u()
|
|
1499
1522
|
], b.prototype, "dropdownOpen", 2);
|
|
1500
|
-
|
|
1501
|
-
|
|
1523
|
+
v([
|
|
1524
|
+
u()
|
|
1502
1525
|
], b.prototype, "dropdownSelectedDateString", 2);
|
|
1503
|
-
b =
|
|
1526
|
+
b = v([
|
|
1504
1527
|
T("glatam-calendar-mini")
|
|
1505
1528
|
], b);
|
|
1506
1529
|
export {
|
|
1507
|
-
|
|
1508
|
-
|
|
1530
|
+
g as GlatamCalendar,
|
|
1531
|
+
S as GlatamCalendarDayView,
|
|
1509
1532
|
b as GlatamCalendarMini,
|
|
1510
1533
|
x as GlatamCalendarModal,
|
|
1511
1534
|
f as GlatamCalendarMonthView,
|
|
1512
1535
|
w as GlatamCalendarWeekView,
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1536
|
+
W as calendarStyles,
|
|
1537
|
+
nt as formatISODate,
|
|
1538
|
+
dt as isTimeBlocked,
|
|
1539
|
+
ct as parseISODate,
|
|
1540
|
+
P as variablesStyles
|
|
1518
1541
|
};
|