@mhmo91/schmancy 0.4.41 → 0.4.43

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.
@@ -3,25 +3,25 @@ import "lit/directives/class-map.js";
3
3
  import "lit/directives/style-map.js";
4
4
  import { $ as ue } from "./litElement.mixin-BH9PTyUD.js";
5
5
  import "./tailwind.mixin-CaIkmP6j.js";
6
- import { property as T, customElement as ce, state as W } from "lit/decorators.js";
6
+ import { property as T, customElement as ce, state as j } from "lit/decorators.js";
7
7
  import { g as he } from "./_commonjsHelpers-Dw9sPFZy.js";
8
- import { html as N } from "lit";
8
+ import { html as W } from "lit";
9
9
  import { $ as J } from "./dialog-service-DFMlRcXf.js";
10
- import { ifDefined as B } from "lit/directives/if-defined.js";
10
+ import { ifDefined as z } from "lit/directives/if-defined.js";
11
11
  var re, ie = { exports: {} }, ve = (re || (re = 1, ie.exports = function() {
12
12
  var t = 1e3, a = 6e4, e = 36e5, n = "millisecond", l = "second", r = "minute", c = "hour", f = "day", v = "week", $ = "month", Y = "quarter", O = "year", L = "date", ee = "Invalid Date", le = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, me = /\[([^\]]+)]|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, pe = { 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
13
  var o = ["th", "st", "nd", "rd"], s = h % 100;
14
14
  return "[" + h + (o[(s - 20) % 10] || o[s] || o[0]) + "]";
15
15
  } }, K = function(h, o, s) {
16
- var d = String(h);
17
- return !d || d.length >= o ? h : "" + Array(o + 1 - d.length).join(s) + h;
16
+ var u = String(h);
17
+ return !u || u.length >= o ? h : "" + Array(o + 1 - u.length).join(s) + h;
18
18
  }, fe = { s: K, z: function(h) {
19
- var o = -h.utcOffset(), s = Math.abs(o), d = Math.floor(s / 60), i = s % 60;
20
- return (o <= 0 ? "+" : "-") + K(d, 2, "0") + ":" + K(i, 2, "0");
19
+ var o = -h.utcOffset(), s = Math.abs(o), u = Math.floor(s / 60), i = s % 60;
20
+ return (o <= 0 ? "+" : "-") + K(u, 2, "0") + ":" + K(i, 2, "0");
21
21
  }, m: function h(o, s) {
22
22
  if (o.date() < s.date()) return -h(s, o);
23
- var d = 12 * (s.year() - o.year()) + (s.month() - o.month()), i = o.clone().add(d, $), m = s - i < 0, p = o.clone().add(d + (m ? -1 : 1), $);
24
- return +(-(d + (s - i) / (m ? i - p : p - i)) || 0);
23
+ var u = 12 * (s.year() - o.year()) + (s.month() - o.month()), i = o.clone().add(u, $), m = s - i < 0, p = o.clone().add(u + (m ? -1 : 1), $);
24
+ return +(-(u + (s - i) / (m ? i - p : p - i)) || 0);
25
25
  }, a: function(h) {
26
26
  return h < 0 ? Math.ceil(h) || 0 : Math.floor(h);
27
27
  }, p: function(h) {
@@ -32,7 +32,7 @@ var re, ie = { exports: {} }, ve = (re || (re = 1, ie.exports = function() {
32
32
  A[E] = pe;
33
33
  var te = "$isDayjsObject", Z = function(h) {
34
34
  return h instanceof U || !(!h || !h[te]);
35
- }, I = function h(o, s, d) {
35
+ }, I = function h(o, s, u) {
36
36
  var i;
37
37
  if (!o) return E;
38
38
  if (typeof o == "string") {
@@ -44,7 +44,7 @@ var re, ie = { exports: {} }, ve = (re || (re = 1, ie.exports = function() {
44
44
  var g = o.name;
45
45
  A[g] = o, i = g;
46
46
  }
47
- return !d && i && (E = i), i || !d && E;
47
+ return !u && i && (E = i), i || !u && E;
48
48
  }, w = function(h, o) {
49
49
  if (Z(h)) return h.clone();
50
50
  var s = typeof o == "object" ? o : {};
@@ -59,8 +59,8 @@ var re, ie = { exports: {} }, ve = (re || (re = 1, ie.exports = function() {
59
59
  }
60
60
  var o = h.prototype;
61
61
  return o.parse = function(s) {
62
- this.$d = function(d) {
63
- var i = d.date, m = d.utc;
62
+ this.$d = function(u) {
63
+ var i = u.date, m = u.utc;
64
64
  if (i === null) return /* @__PURE__ */ new Date(NaN);
65
65
  if (y.u(i)) return /* @__PURE__ */ new Date();
66
66
  if (i instanceof Date) return new Date(i);
@@ -80,34 +80,34 @@ var re, ie = { exports: {} }, ve = (re || (re = 1, ie.exports = function() {
80
80
  return y;
81
81
  }, o.isValid = function() {
82
82
  return this.$d.toString() !== ee;
83
- }, o.isSame = function(s, d) {
83
+ }, o.isSame = function(s, u) {
84
84
  var i = w(s);
85
- return this.startOf(d) <= i && i <= this.endOf(d);
86
- }, o.isAfter = function(s, d) {
87
- return w(s) < this.startOf(d);
88
- }, o.isBefore = function(s, d) {
89
- return this.endOf(d) < w(s);
90
- }, o.$g = function(s, d, i) {
91
- return y.u(s) ? this[d] : this.set(i, s);
85
+ return this.startOf(u) <= i && i <= this.endOf(u);
86
+ }, o.isAfter = function(s, u) {
87
+ return w(s) < this.startOf(u);
88
+ }, o.isBefore = function(s, u) {
89
+ return this.endOf(u) < w(s);
90
+ }, o.$g = function(s, u, i) {
91
+ return y.u(s) ? this[u] : this.set(i, s);
92
92
  }, o.unix = function() {
93
93
  return Math.floor(this.valueOf() / 1e3);
94
94
  }, o.valueOf = function() {
95
95
  return this.$d.getTime();
96
- }, o.startOf = function(s, d) {
97
- var i = this, m = !!y.u(d) || d, p = y.p(s), g = function(H, k) {
98
- var C = y.w(i.$u ? Date.UTC(i.$y, k, H) : new Date(i.$y, k, H), i);
96
+ }, o.startOf = function(s, u) {
97
+ var i = this, m = !!y.u(u) || u, p = y.p(s), g = function(H, S) {
98
+ var C = y.w(i.$u ? Date.UTC(i.$y, S, H) : new Date(i.$y, S, H), i);
99
99
  return m ? C : C.endOf(f);
100
- }, b = function(H, k) {
101
- return y.w(i.toDate()[H].apply(i.toDate("s"), (m ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(k)), i);
102
- }, F = this.$W, S = this.$M, x = this.$D, q = "set" + (this.$u ? "UTC" : "");
100
+ }, b = function(H, S) {
101
+ return y.w(i.toDate()[H].apply(i.toDate("s"), (m ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(S)), i);
102
+ }, F = this.$W, k = this.$M, x = this.$D, q = "set" + (this.$u ? "UTC" : "");
103
103
  switch (p) {
104
104
  case O:
105
105
  return m ? g(1, 0) : g(31, 11);
106
106
  case $:
107
- return m ? g(1, S) : g(0, S + 1);
107
+ return m ? g(1, k) : g(0, k + 1);
108
108
  case v:
109
- var _ = this.$locale().weekStart || 0, V = (F < _ ? F + 7 : F) - _;
110
- return g(m ? x - V : x + (6 - V), S);
109
+ var _ = this.$locale().weekStart || 0, N = (F < _ ? F + 7 : F) - _;
110
+ return g(m ? x - N : x + (6 - N), k);
111
111
  case f:
112
112
  case L:
113
113
  return b(q + "Hours", 0);
@@ -122,23 +122,23 @@ var re, ie = { exports: {} }, ve = (re || (re = 1, ie.exports = function() {
122
122
  }
123
123
  }, o.endOf = function(s) {
124
124
  return this.startOf(s, !1);
125
- }, o.$set = function(s, d) {
126
- var i, m = y.p(s), p = "set" + (this.$u ? "UTC" : ""), g = (i = {}, i[f] = p + "Date", i[L] = p + "Date", i[$] = p + "Month", i[O] = p + "FullYear", i[c] = p + "Hours", i[r] = p + "Minutes", i[l] = p + "Seconds", i[n] = p + "Milliseconds", i)[m], b = m === f ? this.$D + (d - this.$W) : d;
125
+ }, o.$set = function(s, u) {
126
+ var i, m = y.p(s), p = "set" + (this.$u ? "UTC" : ""), g = (i = {}, i[f] = p + "Date", i[L] = p + "Date", i[$] = p + "Month", i[O] = p + "FullYear", i[c] = p + "Hours", i[r] = p + "Minutes", i[l] = p + "Seconds", i[n] = p + "Milliseconds", i)[m], b = m === f ? this.$D + (u - this.$W) : u;
127
127
  if (m === $ || m === O) {
128
128
  var F = this.clone().set(L, 1);
129
129
  F.$d[g](b), F.init(), this.$d = F.set(L, Math.min(this.$D, F.daysInMonth())).$d;
130
130
  } else g && this.$d[g](b);
131
131
  return this.init(), this;
132
- }, o.set = function(s, d) {
133
- return this.clone().$set(s, d);
132
+ }, o.set = function(s, u) {
133
+ return this.clone().$set(s, u);
134
134
  }, o.get = function(s) {
135
135
  return this[y.p(s)]();
136
- }, o.add = function(s, d) {
136
+ }, o.add = function(s, u) {
137
137
  var i, m = this;
138
138
  s = Number(s);
139
- var p = y.p(d), g = function(S) {
139
+ var p = y.p(u), g = function(k) {
140
140
  var x = w(m);
141
- return y.w(x.date(x.date() + Math.round(S * s)), m);
141
+ return y.w(x.date(x.date() + Math.round(k * s)), m);
142
142
  };
143
143
  if (p === $) return this.set($, this.$M + s);
144
144
  if (p === O) return this.set(O, this.$y + s);
@@ -146,26 +146,26 @@ var re, ie = { exports: {} }, ve = (re || (re = 1, ie.exports = function() {
146
146
  if (p === v) return g(7);
147
147
  var b = (i = {}, i[r] = a, i[c] = e, i[l] = t, i)[p] || 1, F = this.$d.getTime() + s * b;
148
148
  return y.w(F, this);
149
- }, o.subtract = function(s, d) {
150
- return this.add(-1 * s, d);
149
+ }, o.subtract = function(s, u) {
150
+ return this.add(-1 * s, u);
151
151
  }, o.format = function(s) {
152
- var d = this, i = this.$locale();
152
+ var u = this, i = this.$locale();
153
153
  if (!this.isValid()) return i.invalidDate || ee;
154
- var m = s || "YYYY-MM-DDTHH:mm:ssZ", p = y.z(this), g = this.$H, b = this.$m, F = this.$M, S = i.weekdays, x = i.months, q = i.meridiem, _ = function(k, C, j, z) {
155
- return k && (k[C] || k(d, m)) || j[C].slice(0, z);
156
- }, V = function(k) {
157
- return y.s(g % 12 || 12, k, "0");
158
- }, H = q || function(k, C, j) {
159
- var z = k < 12 ? "AM" : "PM";
160
- return j ? z.toLowerCase() : z;
154
+ var m = s || "YYYY-MM-DDTHH:mm:ssZ", p = y.z(this), g = this.$H, b = this.$m, F = this.$M, k = i.weekdays, x = i.months, q = i.meridiem, _ = function(S, C, V, B) {
155
+ return S && (S[C] || S(u, m)) || V[C].slice(0, B);
156
+ }, N = function(S) {
157
+ return y.s(g % 12 || 12, S, "0");
158
+ }, H = q || function(S, C, V) {
159
+ var B = S < 12 ? "AM" : "PM";
160
+ return V ? B.toLowerCase() : B;
161
161
  };
162
- return m.replace(me, function(k, C) {
163
- return C || function(j) {
164
- switch (j) {
162
+ return m.replace(me, function(S, C) {
163
+ return C || function(V) {
164
+ switch (V) {
165
165
  case "YY":
166
- return String(d.$y).slice(-2);
166
+ return String(u.$y).slice(-2);
167
167
  case "YYYY":
168
- return y.s(d.$y, 4, "0");
168
+ return y.s(u.$y, 4, "0");
169
169
  case "M":
170
170
  return F + 1;
171
171
  case "MM":
@@ -175,25 +175,25 @@ var re, ie = { exports: {} }, ve = (re || (re = 1, ie.exports = function() {
175
175
  case "MMMM":
176
176
  return _(x, F);
177
177
  case "D":
178
- return d.$D;
178
+ return u.$D;
179
179
  case "DD":
180
- return y.s(d.$D, 2, "0");
180
+ return y.s(u.$D, 2, "0");
181
181
  case "d":
182
- return String(d.$W);
182
+ return String(u.$W);
183
183
  case "dd":
184
- return _(i.weekdaysMin, d.$W, S, 2);
184
+ return _(i.weekdaysMin, u.$W, k, 2);
185
185
  case "ddd":
186
- return _(i.weekdaysShort, d.$W, S, 3);
186
+ return _(i.weekdaysShort, u.$W, k, 3);
187
187
  case "dddd":
188
- return S[d.$W];
188
+ return k[u.$W];
189
189
  case "H":
190
190
  return String(g);
191
191
  case "HH":
192
192
  return y.s(g, 2, "0");
193
193
  case "h":
194
- return V(1);
194
+ return N(1);
195
195
  case "hh":
196
- return V(2);
196
+ return N(2);
197
197
  case "a":
198
198
  return H(g, b, !0);
199
199
  case "A":
@@ -203,21 +203,21 @@ var re, ie = { exports: {} }, ve = (re || (re = 1, ie.exports = function() {
203
203
  case "mm":
204
204
  return y.s(b, 2, "0");
205
205
  case "s":
206
- return String(d.$s);
206
+ return String(u.$s);
207
207
  case "ss":
208
- return y.s(d.$s, 2, "0");
208
+ return y.s(u.$s, 2, "0");
209
209
  case "SSS":
210
- return y.s(d.$ms, 3, "0");
210
+ return y.s(u.$ms, 3, "0");
211
211
  case "Z":
212
212
  return p;
213
213
  }
214
214
  return null;
215
- }(k) || p.replace(":", "");
215
+ }(S) || p.replace(":", "");
216
216
  });
217
217
  }, o.utcOffset = function() {
218
218
  return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
219
- }, o.diff = function(s, d, i) {
220
- var m, p = this, g = y.p(d), b = w(s), F = (b.utcOffset() - this.utcOffset()) * a, S = this - b, x = function() {
219
+ }, o.diff = function(s, u, i) {
220
+ var m, p = this, g = y.p(u), b = w(s), F = (b.utcOffset() - this.utcOffset()) * a, k = this - b, x = function() {
221
221
  return y.m(p, b);
222
222
  };
223
223
  switch (g) {
@@ -231,31 +231,31 @@ var re, ie = { exports: {} }, ve = (re || (re = 1, ie.exports = function() {
231
231
  m = x() / 3;
232
232
  break;
233
233
  case v:
234
- m = (S - F) / 6048e5;
234
+ m = (k - F) / 6048e5;
235
235
  break;
236
236
  case f:
237
- m = (S - F) / 864e5;
237
+ m = (k - F) / 864e5;
238
238
  break;
239
239
  case c:
240
- m = S / e;
240
+ m = k / e;
241
241
  break;
242
242
  case r:
243
- m = S / a;
243
+ m = k / a;
244
244
  break;
245
245
  case l:
246
- m = S / t;
246
+ m = k / t;
247
247
  break;
248
248
  default:
249
- m = S;
249
+ m = k;
250
250
  }
251
251
  return i ? m : y.a(m);
252
252
  }, o.daysInMonth = function() {
253
253
  return this.endOf($).$D;
254
254
  }, o.$locale = function() {
255
255
  return A[this.$L];
256
- }, o.locale = function(s, d) {
256
+ }, o.locale = function(s, u) {
257
257
  if (!s) return this.$L;
258
- var i = this.clone(), m = I(s, d, !0);
258
+ var i = this.clone(), m = I(s, u, !0);
259
259
  return m && (i.$L = m), i;
260
260
  }, o.clone = function() {
261
261
  return y.w(this.$d, this);
@@ -279,7 +279,7 @@ var re, ie = { exports: {} }, ve = (re || (re = 1, ie.exports = function() {
279
279
  return w(1e3 * h);
280
280
  }, w.en = A[E], w.Ls = A, w.p = {}, w;
281
281
  }()), ie.exports);
282
- const u = he(ve);
282
+ const d = he(ve);
283
283
  var ne, Q, X, oe = { exports: {} };
284
284
  const be = he(ne ? oe.exports : (ne = 1, oe.exports = (Q = "month", X = "quarter", function(t, a) {
285
285
  var e = a.prototype;
@@ -301,20 +301,20 @@ const be = he(ne ? oe.exports : (ne = 1, oe.exports = (Q = "month", X = "quarter
301
301
  };
302
302
  })));
303
303
  function $e(t, a) {
304
- return t.map((e) => ({ label: `Last ${e} Days`, range: { dateFrom: u().subtract(e - 1, "days").startOf("day").format(a), dateTo: u().endOf("day").format(a) }, step: "day" }));
304
+ return t.map((e) => ({ label: `Last ${e} Days`, range: { dateFrom: d().subtract(e - 1, "days").startOf("day").format(a), dateTo: d().endOf("day").format(a) }, step: "day" }));
305
305
  }
306
306
  function De(t, a) {
307
- return t.map((e) => ({ label: `Last ${e} Weeks`, range: { dateFrom: u().subtract(e, "weeks").startOf("week").format(a), dateTo: u().endOf("day").format(a) }, step: "week" }));
307
+ return t.map((e) => ({ label: `Last ${e} Weeks`, range: { dateFrom: d().subtract(e, "weeks").startOf("week").format(a), dateTo: d().endOf("day").format(a) }, step: "week" }));
308
308
  }
309
309
  function Te(t, a) {
310
- return t.map((e) => ({ label: `Last ${e} Months`, range: { dateFrom: u().subtract(e, "months").startOf("month").format(a), dateTo: u().endOf("day").format(a) }, step: "month" }));
310
+ return t.map((e) => ({ label: `Last ${e} Months`, range: { dateFrom: d().subtract(e, "months").startOf("month").format(a), dateTo: d().endOf("day").format(a) }, step: "month" }));
311
311
  }
312
312
  function we(t, a) {
313
- return t.map((e) => ({ label: `Last ${e} Quarters`, range: { dateFrom: u().subtract(e, "quarters").startOf("quarter").format(a), dateTo: u().endOf("day").format(a) }, step: "quarter" }));
313
+ return t.map((e) => ({ label: `Last ${e} Quarters`, range: { dateFrom: d().subtract(e, "quarters").startOf("quarter").format(a), dateTo: d().endOf("day").format(a) }, step: "quarter" }));
314
314
  }
315
315
  function de(t, a) {
316
316
  if (!t) return null;
317
- const e = u(t);
317
+ const e = d(t);
318
318
  return e.isValid() ? e.format(a) : null;
319
319
  }
320
320
  function Fe(t, a, e) {
@@ -331,7 +331,7 @@ let P = class extends ue() {
331
331
  }
332
332
  handleFromDateChange(t) {
333
333
  const a = t.target;
334
- this.dateFrom = { ...this.dateFrom, value: a.value }, this.dateTo.value && u(this.dateFrom.value).isAfter(u(this.dateTo.value)) && (this.dateTo = { ...this.dateTo, value: this.dateFrom.value }), this.dispatchEvent(new CustomEvent("date-change", { detail: { dateFrom: this.dateFrom.value, dateTo: this.dateTo.value }, bubbles: !0, composed: !0 }));
334
+ this.dateFrom = { ...this.dateFrom, value: a.value }, this.dateTo.value && d(this.dateFrom.value).isAfter(d(this.dateTo.value)) && (this.dateTo = { ...this.dateTo, value: this.dateFrom.value }), this.dispatchEvent(new CustomEvent("date-change", { detail: { dateFrom: this.dateFrom.value, dateTo: this.dateTo.value }, bubbles: !0, composed: !0 }));
335
335
  }
336
336
  handleToDateChange(t) {
337
337
  const a = t.target;
@@ -342,11 +342,11 @@ let P = class extends ue() {
342
342
  }
343
343
  applyManualDateSelection(t) {
344
344
  t.stopPropagation();
345
- const a = u(this.dateFrom.value), e = u(this.dateTo.value);
345
+ const a = d(this.dateFrom.value), e = d(this.dateTo.value);
346
346
  a.isValid() && e.isValid() ? (this.dispatchEvent(new CustomEvent("apply-dates", { detail: { dateFrom: this.dateFrom.value, dateTo: this.dateTo.value, swapIfNeeded: a.isAfter(e) }, bubbles: !0, composed: !0 })), J.dismiss()) : this.dispatchEvent(new CustomEvent("announce", { detail: { message: "Invalid date format. Please check your input." }, bubbles: !0, composed: !0 }));
347
347
  }
348
348
  render() {
349
- return N`
349
+ return W`
350
350
  <div class="w-full min-h-[400px] max-h-[80vh] flex flex-col p-4">
351
351
  <!-- Custom Range Section with Inline Calendars -->
352
352
  <schmancy-surface type="container" class="rounded-xl p-4 mb-6">
@@ -360,8 +360,8 @@ let P = class extends ue() {
360
360
  <schmancy-input
361
361
  type="${this.type}"
362
362
  .value="${this.dateFrom.value}"
363
- min="${B(this.minDate)}"
364
- max="${B(this.maxDate)}"
363
+ min="${z(this.minDate)}"
364
+ max="${z(this.maxDate)}"
365
365
  @change="${this.handleFromDateChange}"
366
366
  ></schmancy-input>
367
367
  </div>
@@ -374,8 +374,8 @@ let P = class extends ue() {
374
374
  <schmancy-input
375
375
  type="${this.type}"
376
376
  .value="${this.dateTo.value}"
377
- min="${B(this.dateFrom.value)}"
378
- max="${B(this.maxDate)}"
377
+ min="${z(this.dateFrom.value)}"
378
+ max="${z(this.maxDate)}"
379
379
  @change="${this.handleToDateChange}"
380
380
  ></schmancy-input>
381
381
  </div>
@@ -397,13 +397,13 @@ let P = class extends ue() {
397
397
  <!-- Presets Section -->
398
398
  <div class="flex-1 overflow-y-auto overflow-x-hidden min-h-0">
399
399
  <div class="grid grid-cols-2 md:grid-cols-5 gap-6">
400
- ${this.presetCategories.map((t) => N`
400
+ ${this.presetCategories.map((t) => W`
401
401
  <div class="space-y-3">
402
402
  <schmancy-typography type="title" token="md" class="text-surface-onVariant font-medium">
403
403
  ${t.name}
404
404
  </schmancy-typography>
405
405
  <div class="space-y-1">
406
- ${t.presets.map((a) => N`
406
+ ${t.presets.map((a) => W`
407
407
  <schmancy-button
408
408
  variant="${this.activePreset === a.label ? "filled" : "text"}"
409
409
  class="w-full justify-start text-left"
@@ -425,11 +425,11 @@ let P = class extends ue() {
425
425
  }
426
426
  };
427
427
  R([T({ type: String })], P.prototype, "type", 2), R([T({ type: Object })], P.prototype, "dateFrom", 2), R([T({ type: Object })], P.prototype, "dateTo", 2), R([T({ type: String })], P.prototype, "minDate", 2), R([T({ type: String })], P.prototype, "maxDate", 2), R([T({ type: String })], P.prototype, "activePreset", 2), R([T({ type: Array })], P.prototype, "presetCategories", 2), P = R([ce("schmancy-date-range-dialog")], P);
428
- var Se = Object.defineProperty, ke = Object.getOwnPropertyDescriptor, M = (t, a, e, n) => {
429
- for (var l, r = n > 1 ? void 0 : n ? ke(a, e) : a, c = t.length - 1; c >= 0; c--) (l = t[c]) && (r = (n ? l(a, e, r) : l(r)) || r);
430
- return n && r && Se(a, e, r), r;
428
+ var ke = Object.defineProperty, Se = Object.getOwnPropertyDescriptor, M = (t, a, e, n) => {
429
+ for (var l, r = n > 1 ? void 0 : n ? Se(a, e) : a, c = t.length - 1; c >= 0; c--) (l = t[c]) && (r = (n ? l(a, e, r) : l(r)) || r);
430
+ return n && r && ke(a, e, r), r;
431
431
  };
432
- u.extend(be);
432
+ d.extend(be);
433
433
  let D = class extends ue() {
434
434
  constructor() {
435
435
  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();
@@ -439,7 +439,7 @@ let D = class extends ue() {
439
439
  const t = this.getDateFormat(), a = Fe(this.dateFrom.value, this.dateTo.value, t);
440
440
  if (a.isValid) this.dateFrom.value = a.dateFrom, this.dateTo.value = a.dateTo, this.updateSelectedDateRange();
441
441
  else {
442
- const e = u().format(t);
442
+ const e = d().format(t);
443
443
  this.dateFrom.value = e, this.dateTo.value = e, this.updateSelectedDateRange();
444
444
  }
445
445
  this.setupEventHandlers();
@@ -467,7 +467,7 @@ let D = class extends ue() {
467
467
  }
468
468
  if (this.presetCategories = function(e, n = !1) {
469
469
  const l = [];
470
- return n && l.push({ name: "Hours", presets: [{ label: "Last 24 Hours", range: { dateFrom: u().subtract(24, "hours").format(e), dateTo: u().format(e) }, step: "hour" }, { label: "Last 12 Hours", range: { dateFrom: u().subtract(12, "hours").format(e), dateTo: u().format(e) }, step: "hour" }] }), l.push({ name: "Days", presets: [{ label: "Today", range: { dateFrom: u().startOf("day").format(e), dateTo: u().endOf("day").format(e) }, step: "day" }, { label: "Yesterday", range: { dateFrom: u().subtract(1, "days").startOf("day").format(e), dateTo: u().subtract(1, "days").endOf("day").format(e) }, step: "day" }, ...$e([7, 14, 30, 60, 90], e)] }), l.push({ name: "Weeks", presets: [{ label: "This Week", range: { dateFrom: u().startOf("week").format(e), dateTo: u().endOf("week").format(e) }, step: "week" }, { label: "Last Week", range: { dateFrom: u().subtract(1, "weeks").startOf("week").format(e), dateTo: u().subtract(1, "weeks").endOf("week").format(e) }, step: "week" }, ...De([2, 4], e)] }), l.push({ name: "Months", presets: [{ label: "This Month", range: { dateFrom: u().startOf("month").format(e), dateTo: u().endOf("month").format(e) }, step: "month" }, { label: "Last Month", range: { dateFrom: u().subtract(1, "month").startOf("month").format(e), dateTo: u().subtract(1, "month").endOf("month").format(e) }, step: "month" }, ...Te([3, 6], e)] }), l.push({ name: "Quarters", presets: [{ label: "This Quarter", range: { dateFrom: u().startOf("quarter").format(e), dateTo: u().endOf("quarter").format(e) }, step: "quarter" }, { label: "Last Quarter", range: { dateFrom: u().subtract(1, "quarter").startOf("quarter").format(e), dateTo: u().subtract(1, "quarter").endOf("quarter").format(e) }, step: "quarter" }, ...we([2, 4], e)] }), l.push({ name: "Years", presets: [{ label: "This Year", range: { dateFrom: u().startOf("year").format(e), dateTo: u().endOf("year").format(e) }, step: "year" }, { label: "Last Year", range: { dateFrom: u().subtract(1, "year").startOf("year").format(e), dateTo: u().subtract(1, "year").endOf("year").format(e) }, step: "year" }, { label: "Year to Date", range: { dateFrom: u().startOf("year").format(e), dateTo: u().endOf("day").format(e) }, step: "day" }] }), l;
470
+ return n && l.push({ name: "Hours", presets: [{ label: "Last 24 Hours", range: { dateFrom: d().subtract(24, "hours").format(e), dateTo: d().format(e) }, step: "hour" }, { label: "Last 12 Hours", range: { dateFrom: d().subtract(12, "hours").format(e), dateTo: d().format(e) }, step: "hour" }] }), l.push({ name: "Days", presets: [{ label: "Today", range: { dateFrom: d().startOf("day").format(e), dateTo: d().endOf("day").format(e) }, step: "day" }, { label: "Yesterday", range: { dateFrom: d().subtract(1, "days").startOf("day").format(e), dateTo: d().subtract(1, "days").endOf("day").format(e) }, step: "day" }, ...$e([7, 14, 30, 60, 90], e)] }), l.push({ name: "Weeks", presets: [{ label: "This Week", range: { dateFrom: d().startOf("week").format(e), dateTo: d().endOf("week").format(e) }, step: "week" }, { label: "Last Week", range: { dateFrom: d().subtract(1, "weeks").startOf("week").format(e), dateTo: d().subtract(1, "weeks").endOf("week").format(e) }, step: "week" }, ...De([2, 4], e)] }), l.push({ name: "Months", presets: [{ label: "This Month", range: { dateFrom: d().startOf("month").format(e), dateTo: d().endOf("month").format(e) }, step: "month" }, { label: "Last Month", range: { dateFrom: d().subtract(1, "month").startOf("month").format(e), dateTo: d().subtract(1, "month").endOf("month").format(e) }, step: "month" }, ...Te([3, 6], e)] }), l.push({ name: "Quarters", presets: [{ label: "This Quarter", range: { dateFrom: d().startOf("quarter").format(e), dateTo: d().endOf("quarter").format(e) }, step: "quarter" }, { label: "Last Quarter", range: { dateFrom: d().subtract(1, "quarter").startOf("quarter").format(e), dateTo: d().subtract(1, "quarter").endOf("quarter").format(e) }, step: "quarter" }, ...we([2, 4], e)] }), l.push({ name: "Years", presets: [{ label: "This Year", range: { dateFrom: d().startOf("year").format(e), dateTo: d().endOf("year").format(e) }, step: "year" }, { label: "Last Year", range: { dateFrom: d().subtract(1, "year").startOf("year").format(e), dateTo: d().subtract(1, "year").endOf("year").format(e) }, step: "year" }, { label: "Year to Date", range: { dateFrom: d().startOf("year").format(e), dateTo: d().endOf("day").format(e) }, step: "day" }] }), l;
471
471
  }(t, this.type === "datetime-local"), this.presetRanges = [], this.presetCategories.forEach((e) => {
472
472
  this.presetRanges.push(...e.presets);
473
473
  }), this.customPresets && this.customPresets.length > 0) {
@@ -484,7 +484,7 @@ let D = class extends ue() {
484
484
  if (t) return this.selectedDateRange = t.label, void (this.activePreset = t.label);
485
485
  this.checkAndUpdateActivePreset(this.dateFrom.value, this.dateTo.value), this.activePreset = null, this.selectedDateRange = function(a, e, n, l) {
486
486
  if (!a || !e) return l;
487
- const r = u(a), c = u(e);
487
+ const r = d(a), c = d(e);
488
488
  if (!r.isValid() || !c.isValid()) return l;
489
489
  const f = n === "datetime-local" ? r.format(" h:mm A") : "", v = n === "datetime-local" ? c.format(" h:mm A") : "";
490
490
  return r.isSame(c, "day") ? `${r.format("MMM D, YYYY")}${f}` : r.isSame(c, "month") && r.isSame(c, "year") ? `${r.format("MMM D")}-${c.format("D, YYYY")}${v}` : r.isSame(c, "year") ? `${r.format("MMM D")} - ${c.format("MMM D, YYYY")}${v}` : `${r.format("MMM D, YYYY")}${f} - ${c.format("MMM D, YYYY")}${v}`;
@@ -494,12 +494,12 @@ let D = class extends ue() {
494
494
  this.dateFrom.value = t, this.dateTo.value = a, this.updateSelectedDateRange(), this.announceToScreenReader(`Date range updated: ${this.selectedDateRange}`), this.dispatchEvent(new CustomEvent("change", { detail: { dateFrom: t, dateTo: a }, bubbles: !0, composed: !0 }));
495
495
  }
496
496
  toggleDropdown(t) {
497
- t.stopPropagation(), this.disabled || (this.isOpen ? this.closeDropdown() : this.openDropdown());
497
+ t.stopPropagation(), this.disabled || this.step !== void 0 || (this.isOpen ? this.closeDropdown() : this.openDropdown());
498
498
  }
499
499
  openDropdown() {
500
500
  if (this.disabled || this.step !== void 0) return;
501
501
  this.isOpen = !0;
502
- const t = N`
502
+ const t = W`
503
503
  <schmancy-date-range-dialog
504
504
  .type="${this.type}"
505
505
  .dateFrom="${this.dateFrom}"
@@ -528,7 +528,7 @@ let D = class extends ue() {
528
528
  }
529
529
  shiftDateRange(t, a) {
530
530
  if (a.stopPropagation(), !this.dateFrom.value || !this.dateTo.value) return;
531
- const e = u(this.dateFrom.value), n = u(this.dateTo.value);
531
+ const e = d(this.dateFrom.value), n = d(this.dateTo.value);
532
532
  if (!e.isValid() || !n.isValid()) return;
533
533
  const l = this.getDateFormat(), r = t > 0 ? 1 : -1;
534
534
  let c, f;
@@ -555,11 +555,11 @@ let D = class extends ue() {
555
555
  v.isFullYear ? (c = r > 0 ? e.add(1, "year") : e.subtract(1, "year"), f = r > 0 ? n.add(1, "year") : n.subtract(1, "year")) : v.isFullMonth ? (c = r > 0 ? e.add(1, "month") : e.subtract(1, "month"), f = r > 0 ? n.add(1, "month") : n.subtract(1, "month")) : v.isFullWeek ? (c = r > 0 ? e.add(1, "week") : e.subtract(1, "week"), f = r > 0 ? n.add(1, "week") : n.subtract(1, "week")) : $ === 1 ? (c = r > 0 ? e.add(1, "day") : e.subtract(1, "day"), f = r > 0 ? n.add(1, "day") : n.subtract(1, "day")) : (c = r > 0 ? e.add($, "day") : e.subtract($, "day"), f = r > 0 ? n.add($, "day") : n.subtract($, "day"));
556
556
  }
557
557
  if (this.minDate) {
558
- const v = u(this.minDate);
558
+ const v = d(this.minDate);
559
559
  if (c.isBefore(v)) return;
560
560
  }
561
561
  if (this.maxDate) {
562
- const v = u(this.maxDate);
562
+ const v = d(this.maxDate);
563
563
  if (f.isAfter(v)) return;
564
564
  }
565
565
  this.setDateRange(c.format(l), f.format(l)), this.checkAndUpdateActivePreset(c.format(l), f.format(l));
@@ -575,13 +575,13 @@ let D = class extends ue() {
575
575
  break;
576
576
  case "Home":
577
577
  if (t.ctrlKey && (t.target === this || this.contains(t.target))) {
578
- const e = u(this.dateFrom.value), n = u(this.dateTo.value), l = e.startOf("month"), r = n.diff(e, "day");
578
+ const e = d(this.dateFrom.value), n = d(this.dateTo.value), l = e.startOf("month"), r = n.diff(e, "day");
579
579
  this.setDateRange(l.format(this.getDateFormat()), l.add(r, "day").format(this.getDateFormat())), t.preventDefault();
580
580
  }
581
581
  break;
582
582
  case "End":
583
583
  if (t.ctrlKey && (t.target === this || this.contains(t.target))) {
584
- const e = u(this.dateFrom.value), n = u(this.dateTo.value), l = n.diff(e, "day"), r = n.endOf("month");
584
+ const e = d(this.dateFrom.value), n = d(this.dateTo.value), l = n.diff(e, "day"), r = n.endOf("month");
585
585
  this.setDateRange(r.subtract(l, "day").format(this.getDateFormat()), r.format(this.getDateFormat())), t.preventDefault();
586
586
  }
587
587
  }
@@ -593,13 +593,23 @@ let D = class extends ue() {
593
593
  checkMobileView() {
594
594
  this.isMobile = window.innerWidth < 768;
595
595
  }
596
+ canNavigateBackward() {
597
+ if (!this.dateFrom.value || !this.minDate) return !0;
598
+ const t = d(this.dateFrom.value), a = d(this.minDate);
599
+ return t.isAfter(a);
600
+ }
601
+ canNavigateForward() {
602
+ if (!this.dateTo.value || !this.maxDate) return !0;
603
+ const t = d(this.dateTo.value), a = d(this.maxDate);
604
+ return t.isBefore(a);
605
+ }
596
606
  announceToScreenReader(t) {
597
607
  this.announceMessage = t, ge(100).pipe(G(this.disconnecting)).subscribe(() => {
598
608
  this.announceMessage = "";
599
609
  });
600
610
  }
601
611
  render() {
602
- return N`
612
+ return W`
603
613
  <div class="relative ${this.disabled ? "opacity-60 pointer-events-none" : ""}">
604
614
  <!-- Screen reader announcements -->
605
615
  <div class="sr-only" role="status" aria-live="polite" aria-atomic="true">
@@ -612,13 +622,13 @@ let D = class extends ue() {
612
622
  type="button"
613
623
  aria-label="Previous ${this.activePreset ? this.activePreset.toLowerCase() : "date range"}"
614
624
  @click=${(t) => this.shiftDateRange(-1, t)}
615
- ?disabled=${this.disabled || !this.dateFrom.value || !this.dateTo.value}
625
+ ?disabled=${this.disabled || !this.dateFrom.value || !this.dateTo.value || !this.canNavigateBackward()}
616
626
  >
617
627
  arrow_left
618
628
  </schmancy-icon-button>
619
629
 
620
630
  <schmancy-button
621
- class="w-max ${this.step !== void 0 ? "pointer-events-none" : ""}"
631
+ class="w-max"
622
632
  variant="outlined"
623
633
  type="button"
624
634
  aria-haspopup="menu"
@@ -627,6 +637,7 @@ let D = class extends ue() {
627
637
  aria-readonly="${this.step !== void 0}"
628
638
  @click=${(t) => this.toggleDropdown(t)}
629
639
  ?disabled=${this.disabled}
640
+ style="${this.step !== void 0 ? "cursor: default;" : ""}"
630
641
  >
631
642
  ${this.selectedDateRange || this.placeholder}
632
643
  </schmancy-button>
@@ -635,7 +646,7 @@ let D = class extends ue() {
635
646
  type="button"
636
647
  aria-label="Next ${this.activePreset ? this.activePreset.toLowerCase() : "date range"}"
637
648
  @click=${(t) => this.shiftDateRange(1, t)}
638
- ?disabled=${this.disabled || !this.dateFrom.value || !this.dateTo.value}
649
+ ?disabled=${this.disabled || !this.dateFrom.value || !this.dateTo.value || !this.canNavigateForward()}
639
650
  >
640
651
  arrow_right
641
652
  </schmancy-icon-button>
@@ -644,9 +655,9 @@ let D = class extends ue() {
644
655
  `;
645
656
  }
646
657
  };
647
- M([T({ type: String })], D.prototype, "type", 2), M([T({ type: Object })], D.prototype, "dateFrom", 2), M([T({ type: Object })], D.prototype, "dateTo", 2), M([T({ type: String })], D.prototype, "minDate", 2), M([T({ type: String })], D.prototype, "maxDate", 2), M([T({ type: Array })], D.prototype, "customPresets", 2), M([T({ type: String })], D.prototype, "format", 2), M([T({ type: Boolean })], D.prototype, "disabled", 2), M([T({ type: Boolean })], D.prototype, "required", 2), M([T({ type: String })], D.prototype, "placeholder", 2), M([T({ type: Boolean })], D.prototype, "clearable", 2), M([T()], D.prototype, "step", 2), M([W()], D.prototype, "isOpen", 2), M([W()], D.prototype, "selectedDateRange", 2), M([W()], D.prototype, "activePreset", 2), M([W()], D.prototype, "announceMessage", 2), M([W()], D.prototype, "isMobile", 2), D = M([ce("schmancy-date-range")], D);
658
+ M([T({ type: String })], D.prototype, "type", 2), M([T({ type: Object })], D.prototype, "dateFrom", 2), M([T({ type: Object })], D.prototype, "dateTo", 2), M([T({ type: String })], D.prototype, "minDate", 2), M([T({ type: String })], D.prototype, "maxDate", 2), M([T({ type: Array })], D.prototype, "customPresets", 2), M([T({ type: String })], D.prototype, "format", 2), M([T({ type: Boolean })], D.prototype, "disabled", 2), M([T({ type: Boolean })], D.prototype, "required", 2), M([T({ type: String })], D.prototype, "placeholder", 2), M([T({ type: Boolean })], D.prototype, "clearable", 2), M([T()], D.prototype, "step", 2), M([j()], D.prototype, "isOpen", 2), M([j()], D.prototype, "selectedDateRange", 2), M([j()], D.prototype, "activePreset", 2), M([j()], D.prototype, "announceMessage", 2), M([j()], D.prototype, "isMobile", 2), D = M([ce("schmancy-date-range")], D);
648
659
  export {
649
660
  D as S,
650
661
  Fe as v
651
662
  };
652
- //# sourceMappingURL=date-range-CTx08Buk.js.map
663
+ //# sourceMappingURL=date-range-B7VG8UXD.js.map