@mhmo91/schmancy 0.4.5 → 0.4.7
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/{avatar-aJw7nOfK.js → avatar-D2CwIkLP.js} +3 -3
- package/dist/{avatar-aJw7nOfK.js.map → avatar-D2CwIkLP.js.map} +1 -1
- package/dist/{avatar-CIi1nK5D.cjs → avatar-DHkt5Sl6.cjs} +2 -2
- package/dist/{avatar-CIi1nK5D.cjs.map → avatar-DHkt5Sl6.cjs.map} +1 -1
- package/dist/badge.cjs +1 -1
- package/dist/badge.js +1 -1
- package/dist/content-drawer.cjs +1 -1
- package/dist/content-drawer.js +1 -1
- package/dist/date-range-BsCL8hQs.js +609 -0
- package/dist/date-range-BsCL8hQs.js.map +1 -0
- package/dist/date-range-DE62Ps16.cjs +117 -0
- package/dist/date-range-DE62Ps16.cjs.map +1 -0
- package/dist/date-range.cjs +1 -1
- package/dist/date-range.js +1 -1
- package/dist/{dialog-content-B3thpCG2.js → dialog-content-BUtwJ3HL.js} +2 -3
- package/dist/dialog-content-BUtwJ3HL.js.map +1 -0
- package/dist/{dialog-content-C1zsL7VE.cjs → dialog-content-SX6qtxGj.cjs} +2 -3
- package/dist/dialog-content-SX6qtxGj.cjs.map +1 -0
- package/dist/dialog.cjs +1 -1
- package/dist/dialog.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +3 -3
- package/dist/nav-drawer.cjs +1 -1
- package/dist/nav-drawer.js +1 -1
- package/dist/teleport.cjs +1 -1
- package/dist/teleport.js +1 -1
- package/package.json +1 -1
- package/dist/date-range-BTa3EHE4.cjs +0 -121
- package/dist/date-range-BTa3EHE4.cjs.map +0 -1
- package/dist/date-range-CSEw_dDa.js +0 -596
- package/dist/date-range-CSEw_dDa.js.map +0 -1
- package/dist/dialog-content-B3thpCG2.js.map +0 -1
- package/dist/dialog-content-C1zsL7VE.cjs.map +0 -1
|
@@ -0,0 +1,609 @@
|
|
|
1
|
+
import { fromEvent as st, takeUntil as X, debounceTime as mt, timer as ft } from "rxjs";
|
|
2
|
+
import "lit/directives/class-map.js";
|
|
3
|
+
import "lit/directives/style-map.js";
|
|
4
|
+
import { $ as pt } from "./litElement.mixin-DJxjDwEr.js";
|
|
5
|
+
import "./tailwind.mixin-DauVaFKt.js";
|
|
6
|
+
import { g as ht } from "./_commonjsHelpers-Dw9sPFZy.js";
|
|
7
|
+
import { html as Q } from "lit";
|
|
8
|
+
import { property as C, state as j, customElement as gt } from "lit/decorators.js";
|
|
9
|
+
import { ifDefined as B } from "lit/directives/if-defined.js";
|
|
10
|
+
import { $ as J } from "./dialog-service-CnjZCTMj.js";
|
|
11
|
+
var rt, nt = { exports: {} }, yt = (rt || (rt = 1, nt.exports = function() {
|
|
12
|
+
var e = 1e3, a = 6e4, t = 36e5, u = "millisecond", m = "second", o = "minute", f = "hour", g = "day", w = "week", D = "month", $ = "quarter", M = "year", v = "date", x = "Invalid Date", E = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, R = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, ct = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(h) {
|
|
13
|
+
var n = ["th", "st", "nd", "rd"], s = h % 100;
|
|
14
|
+
return "[" + h + (n[(s - 20) % 10] || n[s] || n[0]) + "]";
|
|
15
|
+
} }, Z = function(h, n, s) {
|
|
16
|
+
var i = String(h);
|
|
17
|
+
return !i || i.length >= n ? h : "" + Array(n + 1 - i.length).join(s) + h;
|
|
18
|
+
}, lt = { s: Z, z: function(h) {
|
|
19
|
+
var n = -h.utcOffset(), s = Math.abs(n), i = Math.floor(s / 60), r = s % 60;
|
|
20
|
+
return (n <= 0 ? "+" : "-") + Z(i, 2, "0") + ":" + Z(r, 2, "0");
|
|
21
|
+
}, m: function h(n, s) {
|
|
22
|
+
if (n.date() < s.date()) return -h(s, n);
|
|
23
|
+
var i = 12 * (s.year() - n.year()) + (s.month() - n.month()), r = n.clone().add(i, D), c = s - r < 0, l = n.clone().add(i + (c ? -1 : 1), D);
|
|
24
|
+
return +(-(i + (s - r) / (c ? r - l : l - r)) || 0);
|
|
25
|
+
}, a: function(h) {
|
|
26
|
+
return h < 0 ? Math.ceil(h) || 0 : Math.floor(h);
|
|
27
|
+
}, p: function(h) {
|
|
28
|
+
return { M: D, y: M, w, d: g, D: v, h: f, m: o, s: m, ms: u, Q: $ }[h] || String(h || "").toLowerCase().replace(/s$/, "");
|
|
29
|
+
}, u: function(h) {
|
|
30
|
+
return h === void 0;
|
|
31
|
+
} }, V = "en", _ = {};
|
|
32
|
+
_[V] = ct;
|
|
33
|
+
var et = "$isDayjsObject", G = function(h) {
|
|
34
|
+
return h instanceof I || !(!h || !h[et]);
|
|
35
|
+
}, U = function h(n, s, i) {
|
|
36
|
+
var r;
|
|
37
|
+
if (!n) return V;
|
|
38
|
+
if (typeof n == "string") {
|
|
39
|
+
var c = n.toLowerCase();
|
|
40
|
+
_[c] && (r = c), s && (_[c] = s, r = c);
|
|
41
|
+
var l = n.split("-");
|
|
42
|
+
if (!r && l.length > 1) return h(l[0]);
|
|
43
|
+
} else {
|
|
44
|
+
var y = n.name;
|
|
45
|
+
_[y] = n, r = y;
|
|
46
|
+
}
|
|
47
|
+
return !i && r && (V = r), r || !i && V;
|
|
48
|
+
}, O = function(h, n) {
|
|
49
|
+
if (G(h)) return h.clone();
|
|
50
|
+
var s = typeof n == "object" ? n : {};
|
|
51
|
+
return s.date = h, s.args = arguments, new I(s);
|
|
52
|
+
}, p = lt;
|
|
53
|
+
p.l = U, p.i = G, p.w = function(h, n) {
|
|
54
|
+
return O(h, { locale: n.$L, utc: n.$u, x: n.$x, $offset: n.$offset });
|
|
55
|
+
};
|
|
56
|
+
var I = function() {
|
|
57
|
+
function h(s) {
|
|
58
|
+
this.$L = U(s.locale, null, !0), this.parse(s), this.$x = this.$x || s.x || {}, this[et] = !0;
|
|
59
|
+
}
|
|
60
|
+
var n = h.prototype;
|
|
61
|
+
return n.parse = function(s) {
|
|
62
|
+
this.$d = function(i) {
|
|
63
|
+
var r = i.date, c = i.utc;
|
|
64
|
+
if (r === null) return /* @__PURE__ */ new Date(NaN);
|
|
65
|
+
if (p.u(r)) return /* @__PURE__ */ new Date();
|
|
66
|
+
if (r instanceof Date) return new Date(r);
|
|
67
|
+
if (typeof r == "string" && !/Z$/i.test(r)) {
|
|
68
|
+
var l = r.match(E);
|
|
69
|
+
if (l) {
|
|
70
|
+
var y = l[2] - 1 || 0, b = (l[7] || "0").substring(0, 3);
|
|
71
|
+
return c ? new Date(Date.UTC(l[1], y, l[3] || 1, l[4] || 0, l[5] || 0, l[6] || 0, b)) : new Date(l[1], y, l[3] || 1, l[4] || 0, l[5] || 0, l[6] || 0, b);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return new Date(r);
|
|
75
|
+
}(s), this.init();
|
|
76
|
+
}, n.init = function() {
|
|
77
|
+
var s = this.$d;
|
|
78
|
+
this.$y = s.getFullYear(), this.$M = s.getMonth(), this.$D = s.getDate(), this.$W = s.getDay(), this.$H = s.getHours(), this.$m = s.getMinutes(), this.$s = s.getSeconds(), this.$ms = s.getMilliseconds();
|
|
79
|
+
}, n.$utils = function() {
|
|
80
|
+
return p;
|
|
81
|
+
}, n.isValid = function() {
|
|
82
|
+
return this.$d.toString() !== x;
|
|
83
|
+
}, n.isSame = function(s, i) {
|
|
84
|
+
var r = O(s);
|
|
85
|
+
return this.startOf(i) <= r && r <= this.endOf(i);
|
|
86
|
+
}, n.isAfter = function(s, i) {
|
|
87
|
+
return O(s) < this.startOf(i);
|
|
88
|
+
}, n.isBefore = function(s, i) {
|
|
89
|
+
return this.endOf(i) < O(s);
|
|
90
|
+
}, n.$g = function(s, i, r) {
|
|
91
|
+
return p.u(s) ? this[i] : this.set(r, s);
|
|
92
|
+
}, n.unix = function() {
|
|
93
|
+
return Math.floor(this.valueOf() / 1e3);
|
|
94
|
+
}, n.valueOf = function() {
|
|
95
|
+
return this.$d.getTime();
|
|
96
|
+
}, n.startOf = function(s, i) {
|
|
97
|
+
var r = this, c = !!p.u(i) || i, l = p.p(s), y = function(A, Y) {
|
|
98
|
+
var q = p.w(r.$u ? Date.UTC(r.$y, Y, A) : new Date(r.$y, Y, A), r);
|
|
99
|
+
return c ? q : q.endOf(g);
|
|
100
|
+
}, b = function(A, Y) {
|
|
101
|
+
return p.w(r.toDate()[A].apply(r.toDate("s"), (c ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(Y)), r);
|
|
102
|
+
}, T = this.$W, k = this.$M, P = this.$D, H = "set" + (this.$u ? "UTC" : "");
|
|
103
|
+
switch (l) {
|
|
104
|
+
case M:
|
|
105
|
+
return c ? y(1, 0) : y(31, 11);
|
|
106
|
+
case D:
|
|
107
|
+
return c ? y(1, k) : y(0, k + 1);
|
|
108
|
+
case w:
|
|
109
|
+
var L = this.$locale().weekStart || 0, W = (T < L ? T + 7 : T) - L;
|
|
110
|
+
return y(c ? P - W : P + (6 - W), k);
|
|
111
|
+
case g:
|
|
112
|
+
case v:
|
|
113
|
+
return b(H + "Hours", 0);
|
|
114
|
+
case f:
|
|
115
|
+
return b(H + "Minutes", 1);
|
|
116
|
+
case o:
|
|
117
|
+
return b(H + "Seconds", 2);
|
|
118
|
+
case m:
|
|
119
|
+
return b(H + "Milliseconds", 3);
|
|
120
|
+
default:
|
|
121
|
+
return this.clone();
|
|
122
|
+
}
|
|
123
|
+
}, n.endOf = function(s) {
|
|
124
|
+
return this.startOf(s, !1);
|
|
125
|
+
}, n.$set = function(s, i) {
|
|
126
|
+
var r, c = p.p(s), l = "set" + (this.$u ? "UTC" : ""), y = (r = {}, r[g] = l + "Date", r[v] = l + "Date", r[D] = l + "Month", r[M] = l + "FullYear", r[f] = l + "Hours", r[o] = l + "Minutes", r[m] = l + "Seconds", r[u] = l + "Milliseconds", r)[c], b = c === g ? this.$D + (i - this.$W) : i;
|
|
127
|
+
if (c === D || c === M) {
|
|
128
|
+
var T = this.clone().set(v, 1);
|
|
129
|
+
T.$d[y](b), T.init(), this.$d = T.set(v, Math.min(this.$D, T.daysInMonth())).$d;
|
|
130
|
+
} else y && this.$d[y](b);
|
|
131
|
+
return this.init(), this;
|
|
132
|
+
}, n.set = function(s, i) {
|
|
133
|
+
return this.clone().$set(s, i);
|
|
134
|
+
}, n.get = function(s) {
|
|
135
|
+
return this[p.p(s)]();
|
|
136
|
+
}, n.add = function(s, i) {
|
|
137
|
+
var r, c = this;
|
|
138
|
+
s = Number(s);
|
|
139
|
+
var l = p.p(i), y = function(k) {
|
|
140
|
+
var P = O(c);
|
|
141
|
+
return p.w(P.date(P.date() + Math.round(k * s)), c);
|
|
142
|
+
};
|
|
143
|
+
if (l === D) return this.set(D, this.$M + s);
|
|
144
|
+
if (l === M) return this.set(M, this.$y + s);
|
|
145
|
+
if (l === g) return y(1);
|
|
146
|
+
if (l === w) return y(7);
|
|
147
|
+
var b = (r = {}, r[o] = a, r[f] = t, r[m] = e, r)[l] || 1, T = this.$d.getTime() + s * b;
|
|
148
|
+
return p.w(T, this);
|
|
149
|
+
}, n.subtract = function(s, i) {
|
|
150
|
+
return this.add(-1 * s, i);
|
|
151
|
+
}, n.format = function(s) {
|
|
152
|
+
var i = this, r = this.$locale();
|
|
153
|
+
if (!this.isValid()) return r.invalidDate || x;
|
|
154
|
+
var c = s || "YYYY-MM-DDTHH:mm:ssZ", l = p.z(this), y = this.$H, b = this.$m, T = this.$M, k = r.weekdays, P = r.months, H = r.meridiem, L = function(Y, q, N, z) {
|
|
155
|
+
return Y && (Y[q] || Y(i, c)) || N[q].slice(0, z);
|
|
156
|
+
}, W = function(Y) {
|
|
157
|
+
return p.s(y % 12 || 12, Y, "0");
|
|
158
|
+
}, A = H || function(Y, q, N) {
|
|
159
|
+
var z = Y < 12 ? "AM" : "PM";
|
|
160
|
+
return N ? z.toLowerCase() : z;
|
|
161
|
+
};
|
|
162
|
+
return c.replace(R, function(Y, q) {
|
|
163
|
+
return q || function(N) {
|
|
164
|
+
switch (N) {
|
|
165
|
+
case "YY":
|
|
166
|
+
return String(i.$y).slice(-2);
|
|
167
|
+
case "YYYY":
|
|
168
|
+
return p.s(i.$y, 4, "0");
|
|
169
|
+
case "M":
|
|
170
|
+
return T + 1;
|
|
171
|
+
case "MM":
|
|
172
|
+
return p.s(T + 1, 2, "0");
|
|
173
|
+
case "MMM":
|
|
174
|
+
return L(r.monthsShort, T, P, 3);
|
|
175
|
+
case "MMMM":
|
|
176
|
+
return L(P, T);
|
|
177
|
+
case "D":
|
|
178
|
+
return i.$D;
|
|
179
|
+
case "DD":
|
|
180
|
+
return p.s(i.$D, 2, "0");
|
|
181
|
+
case "d":
|
|
182
|
+
return String(i.$W);
|
|
183
|
+
case "dd":
|
|
184
|
+
return L(r.weekdaysMin, i.$W, k, 2);
|
|
185
|
+
case "ddd":
|
|
186
|
+
return L(r.weekdaysShort, i.$W, k, 3);
|
|
187
|
+
case "dddd":
|
|
188
|
+
return k[i.$W];
|
|
189
|
+
case "H":
|
|
190
|
+
return String(y);
|
|
191
|
+
case "HH":
|
|
192
|
+
return p.s(y, 2, "0");
|
|
193
|
+
case "h":
|
|
194
|
+
return W(1);
|
|
195
|
+
case "hh":
|
|
196
|
+
return W(2);
|
|
197
|
+
case "a":
|
|
198
|
+
return A(y, b, !0);
|
|
199
|
+
case "A":
|
|
200
|
+
return A(y, b, !1);
|
|
201
|
+
case "m":
|
|
202
|
+
return String(b);
|
|
203
|
+
case "mm":
|
|
204
|
+
return p.s(b, 2, "0");
|
|
205
|
+
case "s":
|
|
206
|
+
return String(i.$s);
|
|
207
|
+
case "ss":
|
|
208
|
+
return p.s(i.$s, 2, "0");
|
|
209
|
+
case "SSS":
|
|
210
|
+
return p.s(i.$ms, 3, "0");
|
|
211
|
+
case "Z":
|
|
212
|
+
return l;
|
|
213
|
+
}
|
|
214
|
+
return null;
|
|
215
|
+
}(Y) || l.replace(":", "");
|
|
216
|
+
});
|
|
217
|
+
}, n.utcOffset = function() {
|
|
218
|
+
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
|
219
|
+
}, n.diff = function(s, i, r) {
|
|
220
|
+
var c, l = this, y = p.p(i), b = O(s), T = (b.utcOffset() - this.utcOffset()) * a, k = this - b, P = function() {
|
|
221
|
+
return p.m(l, b);
|
|
222
|
+
};
|
|
223
|
+
switch (y) {
|
|
224
|
+
case M:
|
|
225
|
+
c = P() / 12;
|
|
226
|
+
break;
|
|
227
|
+
case D:
|
|
228
|
+
c = P();
|
|
229
|
+
break;
|
|
230
|
+
case $:
|
|
231
|
+
c = P() / 3;
|
|
232
|
+
break;
|
|
233
|
+
case w:
|
|
234
|
+
c = (k - T) / 6048e5;
|
|
235
|
+
break;
|
|
236
|
+
case g:
|
|
237
|
+
c = (k - T) / 864e5;
|
|
238
|
+
break;
|
|
239
|
+
case f:
|
|
240
|
+
c = k / t;
|
|
241
|
+
break;
|
|
242
|
+
case o:
|
|
243
|
+
c = k / a;
|
|
244
|
+
break;
|
|
245
|
+
case m:
|
|
246
|
+
c = k / e;
|
|
247
|
+
break;
|
|
248
|
+
default:
|
|
249
|
+
c = k;
|
|
250
|
+
}
|
|
251
|
+
return r ? c : p.a(c);
|
|
252
|
+
}, n.daysInMonth = function() {
|
|
253
|
+
return this.endOf(D).$D;
|
|
254
|
+
}, n.$locale = function() {
|
|
255
|
+
return _[this.$L];
|
|
256
|
+
}, n.locale = function(s, i) {
|
|
257
|
+
if (!s) return this.$L;
|
|
258
|
+
var r = this.clone(), c = U(s, i, !0);
|
|
259
|
+
return c && (r.$L = c), r;
|
|
260
|
+
}, n.clone = function() {
|
|
261
|
+
return p.w(this.$d, this);
|
|
262
|
+
}, n.toDate = function() {
|
|
263
|
+
return new Date(this.valueOf());
|
|
264
|
+
}, n.toJSON = function() {
|
|
265
|
+
return this.isValid() ? this.toISOString() : null;
|
|
266
|
+
}, n.toISOString = function() {
|
|
267
|
+
return this.$d.toISOString();
|
|
268
|
+
}, n.toString = function() {
|
|
269
|
+
return this.$d.toUTCString();
|
|
270
|
+
}, h;
|
|
271
|
+
}(), at = I.prototype;
|
|
272
|
+
return O.prototype = at, [["$ms", u], ["$s", m], ["$m", o], ["$H", f], ["$W", g], ["$M", D], ["$y", M], ["$D", v]].forEach(function(h) {
|
|
273
|
+
at[h[1]] = function(n) {
|
|
274
|
+
return this.$g(n, h[0], h[1]);
|
|
275
|
+
};
|
|
276
|
+
}), O.extend = function(h, n) {
|
|
277
|
+
return h.$i || (h(n, I, O), h.$i = !0), O;
|
|
278
|
+
}, O.locale = U, O.isDayjs = G, O.unix = function(h) {
|
|
279
|
+
return O(1e3 * h);
|
|
280
|
+
}, O.en = _[V], O.Ls = _, O.p = {}, O;
|
|
281
|
+
}()), nt.exports);
|
|
282
|
+
const d = ht(yt);
|
|
283
|
+
var it, K, tt, ot = { exports: {} };
|
|
284
|
+
const vt = ht(it ? ot.exports : (it = 1, ot.exports = (K = "month", tt = "quarter", function(e, a) {
|
|
285
|
+
var t = a.prototype;
|
|
286
|
+
t.quarter = function(o) {
|
|
287
|
+
return this.$utils().u(o) ? Math.ceil((this.month() + 1) / 3) : this.month(this.month() % 3 + 3 * (o - 1));
|
|
288
|
+
};
|
|
289
|
+
var u = t.add;
|
|
290
|
+
t.add = function(o, f) {
|
|
291
|
+
return o = Number(o), this.$utils().p(f) === tt ? this.add(3 * o, K) : u.bind(this)(o, f);
|
|
292
|
+
};
|
|
293
|
+
var m = t.startOf;
|
|
294
|
+
t.startOf = function(o, f) {
|
|
295
|
+
var g = this.$utils(), w = !!g.u(f) || f;
|
|
296
|
+
if (g.p(o) === tt) {
|
|
297
|
+
var D = this.quarter() - 1;
|
|
298
|
+
return w ? this.month(3 * D).startOf(K).startOf("day") : this.month(3 * D + 2).endOf(K).endOf("day");
|
|
299
|
+
}
|
|
300
|
+
return m.bind(this)(o, f);
|
|
301
|
+
};
|
|
302
|
+
})));
|
|
303
|
+
function ut(e, a) {
|
|
304
|
+
if (!e) return null;
|
|
305
|
+
const t = d(e);
|
|
306
|
+
return t.isValid() ? t.format(a) : null;
|
|
307
|
+
}
|
|
308
|
+
function $t(e, a, t) {
|
|
309
|
+
const u = ut(e, t), m = ut(a, t);
|
|
310
|
+
return { dateFrom: u, dateTo: m, isValid: u !== null && m !== null };
|
|
311
|
+
}
|
|
312
|
+
function bt(e, a) {
|
|
313
|
+
return e.map((t) => ({ label: `Last ${t} Days`, range: { dateFrom: d().subtract(t - 1, "days").startOf("day").format(a), dateTo: d().endOf("day").format(a) }, step: "day" }));
|
|
314
|
+
}
|
|
315
|
+
function Dt(e, a) {
|
|
316
|
+
return e.map((t) => ({ label: `Last ${t} Weeks`, range: { dateFrom: d().subtract(t, "weeks").startOf("week").format(a), dateTo: d().endOf("day").format(a) }, step: "week" }));
|
|
317
|
+
}
|
|
318
|
+
function Mt(e, a) {
|
|
319
|
+
return e.map((t) => ({ label: `Last ${t} Months`, range: { dateFrom: d().subtract(t, "months").startOf("month").format(a), dateTo: d().endOf("day").format(a) }, step: "month" }));
|
|
320
|
+
}
|
|
321
|
+
function Ot(e, a) {
|
|
322
|
+
return e.map((t) => ({ label: `Last ${t} Quarters`, range: { dateFrom: d().subtract(t, "quarters").startOf("quarter").format(a), dateTo: d().endOf("day").format(a) }, step: "quarter" }));
|
|
323
|
+
}
|
|
324
|
+
function dt(e, a, t) {
|
|
325
|
+
let u = e.quarter() + t * a, m = 0;
|
|
326
|
+
for (; u > 4; ) u -= 4, m += 1;
|
|
327
|
+
for (; u < 1; ) u += 4, m -= 1;
|
|
328
|
+
const o = e.add(m, "year").month(3 * (u - 1)), f = o.daysInMonth(), g = Math.min(e.date(), f);
|
|
329
|
+
return o.date(g);
|
|
330
|
+
}
|
|
331
|
+
var Tt = Object.defineProperty, Ft = Object.getOwnPropertyDescriptor, S = (e, a, t, u) => {
|
|
332
|
+
for (var m, o = u > 1 ? void 0 : u ? Ft(a, t) : a, f = e.length - 1; f >= 0; f--) (m = e[f]) && (o = (u ? m(a, t, o) : m(o)) || o);
|
|
333
|
+
return u && o && Tt(a, t, o), o;
|
|
334
|
+
};
|
|
335
|
+
d.extend(vt);
|
|
336
|
+
let F = class extends pt() {
|
|
337
|
+
constructor() {
|
|
338
|
+
super(...arguments), this.type = "date", this.dateFrom = { label: "From", value: "" }, this.dateTo = { label: "To", value: "" }, this.customPresets = [], this.disabled = !1, this.required = !1, this.placeholder = "Select date range", this.clearable = !0, this.isOpen = !1, this.selectedDateRange = "", this.activePreset = null, this.announceMessage = "", this.isMobile = !1, this.presetRanges = [], this.presetCategories = [], this.memoizedPresets = /* @__PURE__ */ new Map();
|
|
339
|
+
}
|
|
340
|
+
connectedCallback() {
|
|
341
|
+
super.connectedCallback(), this.initPresetRanges(), this.checkMobileView();
|
|
342
|
+
const e = this.getDateFormat(), a = $t(this.dateFrom.value, this.dateTo.value, e);
|
|
343
|
+
if (a.isValid) this.dateFrom.value = a.dateFrom, this.dateTo.value = a.dateTo, this.updateSelectedDateRange();
|
|
344
|
+
else {
|
|
345
|
+
const t = d().format(e);
|
|
346
|
+
this.dateFrom.value = t, this.dateTo.value = t, this.updateSelectedDateRange();
|
|
347
|
+
}
|
|
348
|
+
this.setupEventHandlers();
|
|
349
|
+
}
|
|
350
|
+
setupEventHandlers() {
|
|
351
|
+
st(document, "keydown").pipe(X(this.disconnecting)).subscribe((e) => {
|
|
352
|
+
this.handleKeyboardNavigation(e);
|
|
353
|
+
}), st(window, "resize").pipe(mt(150), X(this.disconnecting)).subscribe(() => {
|
|
354
|
+
this.checkMobileView();
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
disconnectedCallback() {
|
|
358
|
+
super.disconnectedCallback();
|
|
359
|
+
}
|
|
360
|
+
updated(e) {
|
|
361
|
+
super.updated(e), !e.has("dateFrom") && !e.has("dateTo") || this.dateFrom?.value === void 0 && this.dateTo?.value === void 0 || this.updateSelectedDateRange();
|
|
362
|
+
}
|
|
363
|
+
initPresetRanges() {
|
|
364
|
+
const e = this.getDateFormat(), a = `${this.type}-${e}-${JSON.stringify(this.customPresets)}`;
|
|
365
|
+
if (this.memoizedPresets.has(a)) {
|
|
366
|
+
const t = this.memoizedPresets.get(a);
|
|
367
|
+
return this.presetCategories = t, this.presetRanges = [], void t.forEach((u) => {
|
|
368
|
+
this.presetRanges.push(...u.presets);
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
if (this.presetCategories = function(t, u = !1) {
|
|
372
|
+
const m = [];
|
|
373
|
+
return u && m.push({ name: "Hours", presets: [{ label: "Last 24 Hours", range: { dateFrom: d().subtract(24, "hours").format(t), dateTo: d().format(t) }, step: "hour" }, { label: "Last 12 Hours", range: { dateFrom: d().subtract(12, "hours").format(t), dateTo: d().format(t) }, step: "hour" }] }), m.push({ name: "Days", presets: [{ label: "Today", range: { dateFrom: d().startOf("day").format(t), dateTo: d().endOf("day").format(t) }, step: "day" }, { label: "Yesterday", range: { dateFrom: d().subtract(1, "days").startOf("day").format(t), dateTo: d().subtract(1, "days").endOf("day").format(t) }, step: "day" }, ...bt([7, 14, 30, 60, 90], t)] }), m.push({ name: "Weeks", presets: [{ label: "This Week", range: { dateFrom: d().startOf("week").format(t), dateTo: d().endOf("week").format(t) }, step: "week" }, { label: "Last Week", range: { dateFrom: d().subtract(1, "weeks").startOf("week").format(t), dateTo: d().subtract(1, "weeks").endOf("week").format(t) }, step: "week" }, ...Dt([2, 4], t)] }), m.push({ name: "Months", presets: [{ label: "This Month", range: { dateFrom: d().startOf("month").format(t), dateTo: d().endOf("month").format(t) }, step: "month" }, { label: "Last Month", range: { dateFrom: d().subtract(1, "month").startOf("month").format(t), dateTo: d().subtract(1, "month").endOf("month").format(t) }, step: "month" }, ...Mt([3, 6], t)] }), m.push({ name: "Quarters", presets: [{ label: "This Quarter", range: { dateFrom: d().startOf("quarter").format(t), dateTo: d().endOf("quarter").format(t) }, step: "quarter" }, { label: "Last Quarter", range: { dateFrom: d().subtract(1, "quarter").startOf("quarter").format(t), dateTo: d().subtract(1, "quarter").endOf("quarter").format(t) }, step: "quarter" }, ...Ot([2, 4], t)] }), m.push({ name: "Years", presets: [{ label: "This Year", range: { dateFrom: d().startOf("year").format(t), dateTo: d().endOf("year").format(t) }, step: "year" }, { label: "Last Year", range: { dateFrom: d().subtract(1, "year").startOf("year").format(t), dateTo: d().subtract(1, "year").endOf("year").format(t) }, step: "year" }, { label: "Year to Date", range: { dateFrom: d().startOf("year").format(t), dateTo: d().endOf("day").format(t) }, step: "day" }] }), m;
|
|
374
|
+
}(e, this.type === "datetime-local"), this.presetRanges = [], this.presetCategories.forEach((t) => {
|
|
375
|
+
this.presetRanges.push(...t.presets);
|
|
376
|
+
}), this.customPresets && this.customPresets.length > 0) {
|
|
377
|
+
const t = { name: "Custom", presets: this.customPresets.map((u) => ({ label: u.label, range: { dateFrom: u.dateFrom, dateTo: u.dateTo }, step: "day" })) };
|
|
378
|
+
this.presetCategories.push(t), this.presetRanges.push(...t.presets);
|
|
379
|
+
}
|
|
380
|
+
this.memoizedPresets.set(a, [...this.presetCategories]);
|
|
381
|
+
}
|
|
382
|
+
getDateFormat() {
|
|
383
|
+
return this.format || (this.type === "date" ? "YYYY-MM-DD" : "YYYY-MM-DDTHH:mm");
|
|
384
|
+
}
|
|
385
|
+
updateSelectedDateRange() {
|
|
386
|
+
const e = this.presetRanges.find((a) => a.range.dateFrom === this.dateFrom.value && a.range.dateTo === this.dateTo.value);
|
|
387
|
+
if (e) return this.selectedDateRange = e.label, void (this.activePreset = e.label);
|
|
388
|
+
this.checkAndUpdateActivePreset(this.dateFrom.value, this.dateTo.value), this.activePreset = null, this.selectedDateRange = function(a, t, u, m) {
|
|
389
|
+
if (!a || !t) return m;
|
|
390
|
+
const o = d(a), f = d(t);
|
|
391
|
+
if (!o.isValid() || !f.isValid()) return m;
|
|
392
|
+
const g = u === "datetime-local" ? o.format(" h:mm A") : "", w = u === "datetime-local" ? f.format(" h:mm A") : "";
|
|
393
|
+
return o.isSame(f, "day") ? `${o.format("MMM D, YYYY")}${g}` : o.isSame(f, "month") && o.isSame(f, "year") ? `${o.format("MMM D")}-${f.format("D, YYYY")}${w}` : o.isSame(f, "year") ? `${o.format("MMM D")} - ${f.format("MMM D, YYYY")}${w}` : `${o.format("MMM D, YYYY")}${g} - ${f.format("MMM D, YYYY")}${w}`;
|
|
394
|
+
}(this.dateFrom.value, this.dateTo.value, this.type, this.placeholder);
|
|
395
|
+
}
|
|
396
|
+
setDateRange(e, a) {
|
|
397
|
+
this.dateFrom.value = e, this.dateTo.value = a, this.updateSelectedDateRange(), this.announceToScreenReader(`Date range updated: ${this.selectedDateRange}`), this.dispatchEvent(new CustomEvent("change", { detail: { dateFrom: e, dateTo: a }, bubbles: !0, composed: !0 }));
|
|
398
|
+
}
|
|
399
|
+
handlePresetSelection(e, a) {
|
|
400
|
+
a.stopPropagation(), this.activePreset = e.label, this.setDateRange(e.range.dateFrom, e.range.dateTo), J.dismiss();
|
|
401
|
+
}
|
|
402
|
+
toggleDropdown(e) {
|
|
403
|
+
e.stopPropagation(), this.disabled || (this.isOpen ? this.closeDropdown() : this.openDropdown());
|
|
404
|
+
}
|
|
405
|
+
openDropdown() {
|
|
406
|
+
if (this.disabled) return;
|
|
407
|
+
this.isOpen = !0;
|
|
408
|
+
const e = this.createDialogContent();
|
|
409
|
+
J.component(e, { title: "Select Date Range", width: this.isMobile ? "100vw" : "800px", hideActions: !0 }).then(() => {
|
|
410
|
+
this.isOpen = !1;
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
closeDropdown() {
|
|
414
|
+
J.dismiss(), this.isOpen = !1;
|
|
415
|
+
}
|
|
416
|
+
shiftDateRange(e, a) {
|
|
417
|
+
if (a.stopPropagation(), !this.dateFrom.value || !this.dateTo.value) return;
|
|
418
|
+
const t = d(this.dateFrom.value), u = d(this.dateTo.value);
|
|
419
|
+
if (!t.isValid() || !u.isValid()) return;
|
|
420
|
+
const m = this.getDateFormat(), o = e > 0 ? 1 : -1, f = this.presetRanges.find((v) => v.label === this.activePreset), { unit: g, amount: w } = function(v, x, E) {
|
|
421
|
+
if (E) return { unit: E, amount: 1 };
|
|
422
|
+
const R = x.diff(v, "day");
|
|
423
|
+
return R >= 360 ? { unit: "year", amount: Math.round(R / 365) } : R >= 90 ? { unit: "quarter", amount: Math.round(R / 90) } : R >= 30 ? { unit: "month", amount: Math.round(R / 30) } : R >= 7 ? { unit: "week", amount: Math.round(R / 7) } : { unit: "day", amount: R + 1 };
|
|
424
|
+
}(t, u, f?.step), D = function(v, x) {
|
|
425
|
+
return { isFullMonth: v.date() === 1 && x.isSame(v.endOf("month"), "day"), isFullQuarter: v.isSame(v.startOf("quarter"), "day") && x.isSame(x.endOf("quarter"), "day"), isFullYear: v.isSame(v.startOf("year"), "day") && x.isSame(x.endOf("year"), "day"), isFullWeek: v.day() === 0 && x.day() === 6 && x.diff(v, "days") === 6 };
|
|
426
|
+
}(t, u);
|
|
427
|
+
let $, M;
|
|
428
|
+
if (g === "quarter") $ = dt(t, w, o), M = dt(u, w, o), D.isFullQuarter && ($ = $.startOf("quarter"), M = $.endOf("quarter"));
|
|
429
|
+
else if (g === "hour") {
|
|
430
|
+
const v = u.diff(t, "hour");
|
|
431
|
+
$ = o > 0 ? t.add(v, "hour") : t.subtract(v, "hour"), M = o > 0 ? u.add(v, "hour") : u.subtract(v, "hour");
|
|
432
|
+
} else o > 0 ? ($ = t.add(w, g), M = u.add(w, g)) : ($ = t.subtract(w, g), M = u.subtract(w, g)), g === "year" && D.isFullYear ? ($ = $.startOf("year"), M = $.endOf("year")) : g === "month" && D.isFullMonth ? ($ = $.startOf("month"), M = $.endOf("month")) : g === "week" && D.isFullWeek && ($ = $.startOf("week"), M = $.endOf("week"));
|
|
433
|
+
this.setDateRange($.format(m), M.format(m)), this.checkAndUpdateActivePreset($.format(m), M.format(m));
|
|
434
|
+
}
|
|
435
|
+
handleKeyboardNavigation(e) {
|
|
436
|
+
const a = e.key;
|
|
437
|
+
if (this.dateFrom.value && this.dateTo.value && !this.disabled) switch (a) {
|
|
438
|
+
case "PageUp":
|
|
439
|
+
(e.target === this || this.contains(e.target)) && (this.shiftDateRange(-1, e), e.preventDefault());
|
|
440
|
+
break;
|
|
441
|
+
case "PageDown":
|
|
442
|
+
(e.target === this || this.contains(e.target)) && (this.shiftDateRange(1, e), e.preventDefault());
|
|
443
|
+
break;
|
|
444
|
+
case "Home":
|
|
445
|
+
if (e.ctrlKey && (e.target === this || this.contains(e.target))) {
|
|
446
|
+
const t = d(this.dateFrom.value), u = d(this.dateTo.value), m = t.startOf("month"), o = u.diff(t, "day");
|
|
447
|
+
this.setDateRange(m.format(this.getDateFormat()), m.add(o, "day").format(this.getDateFormat())), e.preventDefault();
|
|
448
|
+
}
|
|
449
|
+
break;
|
|
450
|
+
case "End":
|
|
451
|
+
if (e.ctrlKey && (e.target === this || this.contains(e.target))) {
|
|
452
|
+
const t = d(this.dateFrom.value), u = d(this.dateTo.value), m = u.diff(t, "day"), o = u.endOf("month");
|
|
453
|
+
this.setDateRange(o.subtract(m, "day").format(this.getDateFormat()), o.format(this.getDateFormat())), e.preventDefault();
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
checkAndUpdateActivePreset(e, a) {
|
|
458
|
+
const t = this.presetRanges.find((u) => u.range.dateFrom === e && u.range.dateTo === a);
|
|
459
|
+
this.activePreset = t ? t.label : null;
|
|
460
|
+
}
|
|
461
|
+
applyManualDateSelection(e) {
|
|
462
|
+
e.stopPropagation();
|
|
463
|
+
const a = d(this.dateFrom.value), t = d(this.dateTo.value);
|
|
464
|
+
a.isValid() && t.isValid() ? (a.isAfter(t) ? this.setDateRange(t.format(this.getDateFormat()), a.format(this.getDateFormat())) : this.setDateRange(this.dateFrom.value, this.dateTo.value), J.dismiss()) : this.announceToScreenReader("Invalid date format. Please check your input.");
|
|
465
|
+
}
|
|
466
|
+
checkMobileView() {
|
|
467
|
+
this.isMobile = window.innerWidth < 768;
|
|
468
|
+
}
|
|
469
|
+
handleFromDateChange(e) {
|
|
470
|
+
const a = e.target;
|
|
471
|
+
this.dateFrom.value = a.value, this.updateSelectedDateRange();
|
|
472
|
+
}
|
|
473
|
+
handleToDateChange(e) {
|
|
474
|
+
const a = e.target;
|
|
475
|
+
this.dateTo.value = a.value, this.updateSelectedDateRange();
|
|
476
|
+
}
|
|
477
|
+
createDialogContent() {
|
|
478
|
+
return Q`
|
|
479
|
+
<div class="w-full min-h-[400px] max-h-[80vh] flex flex-col p-4">
|
|
480
|
+
<!-- Custom Range Section with Inline Calendars -->
|
|
481
|
+
<schmancy-surface type="container" class="rounded-xl p-4 mb-6">
|
|
482
|
+
<div class="flex flex-col gap-4">
|
|
483
|
+
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
484
|
+
<!-- From Date Calendar -->
|
|
485
|
+
<div class="flex flex-col gap-2">
|
|
486
|
+
<schmancy-typography type="label" token="md" class="text-surface-onVariant">
|
|
487
|
+
${this.dateFrom.label || "From"}
|
|
488
|
+
</schmancy-typography>
|
|
489
|
+
<schmancy-input
|
|
490
|
+
type="${this.type}"
|
|
491
|
+
.value="${this.dateFrom.value}"
|
|
492
|
+
min="${B(this.minDate)}"
|
|
493
|
+
max="${B(this.maxDate)}"
|
|
494
|
+
@change="${this.handleFromDateChange.bind(this)}"
|
|
495
|
+
></schmancy-input>
|
|
496
|
+
</div>
|
|
497
|
+
|
|
498
|
+
<!-- To Date Calendar -->
|
|
499
|
+
<div class="flex flex-col gap-2">
|
|
500
|
+
<schmancy-typography type="label" token="md" class="text-surface-onVariant">
|
|
501
|
+
${this.dateTo.label || "To"}
|
|
502
|
+
</schmancy-typography>
|
|
503
|
+
<schmancy-input
|
|
504
|
+
type="${this.type}"
|
|
505
|
+
.value="${this.dateTo.value}"
|
|
506
|
+
min="${B(this.dateFrom.value)}"
|
|
507
|
+
max="${B(this.maxDate)}"
|
|
508
|
+
@change="${this.handleToDateChange.bind(this)}"
|
|
509
|
+
></schmancy-input>
|
|
510
|
+
</div>
|
|
511
|
+
</div>
|
|
512
|
+
|
|
513
|
+
<!-- Apply Button - Now at the bottom for logical flow -->
|
|
514
|
+
<div class="flex justify-end mt-2">
|
|
515
|
+
<schmancy-button
|
|
516
|
+
variant="filled"
|
|
517
|
+
@click="${(e) => this.applyManualDateSelection(e)}"
|
|
518
|
+
?disabled="${!this.dateFrom.value || !this.dateTo.value}"
|
|
519
|
+
>
|
|
520
|
+
Apply
|
|
521
|
+
</schmancy-button>
|
|
522
|
+
</div>
|
|
523
|
+
</div>
|
|
524
|
+
</schmancy-surface>
|
|
525
|
+
|
|
526
|
+
<!-- Presets Section -->
|
|
527
|
+
<div class="flex-1 overflow-y-auto overflow-x-hidden min-h-0">
|
|
528
|
+
<div class="grid grid-cols-2 md:grid-cols-5 gap-6">
|
|
529
|
+
${this.presetCategories.map((e) => Q`
|
|
530
|
+
<div class="space-y-3">
|
|
531
|
+
<schmancy-typography type="title" token="md" class="text-surface-onVariant font-medium">
|
|
532
|
+
${e.name}
|
|
533
|
+
</schmancy-typography>
|
|
534
|
+
<div class="space-y-1">
|
|
535
|
+
${e.presets.map((a) => Q`
|
|
536
|
+
<schmancy-button
|
|
537
|
+
variant="${this.activePreset === a.label ? "filled" : "text"}"
|
|
538
|
+
class="w-full justify-start text-left"
|
|
539
|
+
@click="${(t) => this.handlePresetSelection(a, t)}"
|
|
540
|
+
aria-pressed="${this.activePreset === a.label}"
|
|
541
|
+
aria-label="${a.label}: ${a.range.dateFrom} to ${a.range.dateTo}"
|
|
542
|
+
title="${a.range.dateFrom} to ${a.range.dateTo}"
|
|
543
|
+
>
|
|
544
|
+
<span class="truncate">${a.label}</span>
|
|
545
|
+
</schmancy-button>
|
|
546
|
+
`)}
|
|
547
|
+
</div>
|
|
548
|
+
</div>
|
|
549
|
+
`)}
|
|
550
|
+
</div>
|
|
551
|
+
</div>
|
|
552
|
+
</div>
|
|
553
|
+
`;
|
|
554
|
+
}
|
|
555
|
+
announceToScreenReader(e) {
|
|
556
|
+
this.announceMessage = e, ft(100).pipe(X(this.disconnecting)).subscribe(() => {
|
|
557
|
+
this.announceMessage = "";
|
|
558
|
+
});
|
|
559
|
+
}
|
|
560
|
+
render() {
|
|
561
|
+
return Q`
|
|
562
|
+
<div class="relative ${this.disabled ? "opacity-60 pointer-events-none" : ""}">
|
|
563
|
+
<!-- Screen reader announcements -->
|
|
564
|
+
<div class="sr-only" role="status" aria-live="polite" aria-atomic="true">
|
|
565
|
+
${this.announceMessage}
|
|
566
|
+
</div>
|
|
567
|
+
|
|
568
|
+
<!-- Trigger using the preferred schmancy-grid pattern -->
|
|
569
|
+
<section @click=${(e) => e.stopPropagation()} class="flex" >
|
|
570
|
+
<schmancy-icon-button
|
|
571
|
+
type="button"
|
|
572
|
+
aria-label="Previous ${this.activePreset ? this.activePreset.toLowerCase() : "date range"}"
|
|
573
|
+
@click=${(e) => this.shiftDateRange(-1, e)}
|
|
574
|
+
?disabled=${this.disabled || !this.dateFrom.value || !this.dateTo.value}
|
|
575
|
+
>
|
|
576
|
+
arrow_left
|
|
577
|
+
</schmancy-icon-button>
|
|
578
|
+
|
|
579
|
+
<schmancy-button
|
|
580
|
+
class="w-max"
|
|
581
|
+
variant="outlined"
|
|
582
|
+
type="button"
|
|
583
|
+
aria-haspopup="menu"
|
|
584
|
+
aria-expanded=${this.isOpen}
|
|
585
|
+
aria-label="Select date range. Current: ${this.selectedDateRange || "No date selected"}"
|
|
586
|
+
@click=${(e) => this.toggleDropdown(e)}
|
|
587
|
+
>
|
|
588
|
+
${this.selectedDateRange || this.placeholder}
|
|
589
|
+
</schmancy-button>
|
|
590
|
+
|
|
591
|
+
<schmancy-icon-button
|
|
592
|
+
type="button"
|
|
593
|
+
aria-label="Next ${this.activePreset ? this.activePreset.toLowerCase() : "date range"}"
|
|
594
|
+
@click=${(e) => this.shiftDateRange(1, e)}
|
|
595
|
+
?disabled=${this.disabled || !this.dateFrom.value || !this.dateTo.value}
|
|
596
|
+
>
|
|
597
|
+
arrow_right
|
|
598
|
+
</schmancy-icon-button>
|
|
599
|
+
</section>
|
|
600
|
+
</div>
|
|
601
|
+
`;
|
|
602
|
+
}
|
|
603
|
+
};
|
|
604
|
+
S([C({ type: String })], F.prototype, "type", 2), S([C({ type: Object })], F.prototype, "dateFrom", 2), S([C({ type: Object })], F.prototype, "dateTo", 2), S([C({ type: String })], F.prototype, "minDate", 2), S([C({ type: String })], F.prototype, "maxDate", 2), S([C({ type: Array })], F.prototype, "customPresets", 2), S([C({ type: String })], F.prototype, "format", 2), S([C({ type: Boolean })], F.prototype, "disabled", 2), S([C({ type: Boolean })], F.prototype, "required", 2), S([C({ type: String })], F.prototype, "placeholder", 2), S([C({ type: Boolean })], F.prototype, "clearable", 2), S([j()], F.prototype, "isOpen", 2), S([j()], F.prototype, "selectedDateRange", 2), S([j()], F.prototype, "activePreset", 2), S([j()], F.prototype, "announceMessage", 2), S([j()], F.prototype, "isMobile", 2), F = S([gt("schmancy-date-range")], F);
|
|
605
|
+
export {
|
|
606
|
+
F as S,
|
|
607
|
+
$t as v
|
|
608
|
+
};
|
|
609
|
+
//# sourceMappingURL=date-range-BsCL8hQs.js.map
|