@aminnausin/cedar-ui 0.0.2 → 0.0.4

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/cedar-ui.mjs CHANGED
@@ -1,298 +1,298 @@
1
- var me = Object.defineProperty;
2
- var ve = (l, t, s) => t in l ? me(l, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : l[t] = s;
3
- var O = (l, t, s) => ve(l, typeof t != "symbol" ? t + "" : t, s);
4
- import { reactive as _, watch as $, ref as r, computed as K, onMounted as W, nextTick as ae, onBeforeUnmount as re, shallowRef as pe, defineComponent as ue, createElementBlock as L, openBlock as B, unref as S, normalizeStyle as he, normalizeClass as N, createVNode as ge, Transition as we, withCtx as ye, withDirectives as V, createElementVNode as P, createCommentVNode as G, vShow as F, toDisplayString as Z, watchEffect as be, createBlock as ee, Teleport as Te, Fragment as xe, renderList as Ie, mergeProps as Ce } from "vue";
5
- function Qe({ options: l, defaultItems: t }, s) {
6
- const e = _({
1
+ var Z = Object.defineProperty;
2
+ var ee = (i, e, t) => e in i ? Z(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t;
3
+ var p = (i, e, t) => ee(i, typeof e != "symbol" ? e + "" : e, t);
4
+ import { reactive as P, watch as O, ref as u, computed as F, onMounted as te, nextTick as se, onBeforeUnmount as ne, shallowRef as ie } from "vue";
5
+ function ge({ options: i, defaultItems: e }, t) {
6
+ const o = P({
7
7
  selectOpen: !1,
8
- selectedItems: t,
9
- selectableItems: l,
8
+ selectedItems: e,
9
+ selectableItems: i,
10
10
  selectableItemActive: null,
11
11
  selectId: "select-12",
12
12
  selectKeydownValue: "",
13
13
  selectKeydownTimeout: 1e3,
14
14
  selectKeydownClearTimeout: null,
15
15
  selectDropdownPosition: "bottom",
16
- selectableItemsList: s.selectableItemsList,
17
- selectButton: s.selectButton,
18
- toggleSelect(i) {
19
- i !== void 0 ? this.selectOpen = i === !0 : this.selectOpen = !this.selectOpen;
16
+ selectableItemsList: t.selectableItemsList,
17
+ selectButton: t.selectButton,
18
+ toggleSelect(s) {
19
+ s !== void 0 ? this.selectOpen = s === !0 : this.selectOpen = !this.selectOpen;
20
20
  },
21
- updateRefs(i) {
22
- this.selectButton = i.selectButton, this.selectableItemsList = i.selectableItemsList, this.selectPositionUpdate();
21
+ updateRefs(s) {
22
+ this.selectButton = s.selectButton, this.selectableItemsList = s.selectableItemsList, this.selectPositionUpdate();
23
23
  },
24
24
  // In a multiselect (combobox) nothing is ever selected in the list. It appears elsewhere and is removed from the list
25
25
  selectableItemIsActive() {
26
26
  return !1;
27
27
  },
28
- async selectScrollToActiveItem(i, o = !0) {
29
- let a = document.getElementById(i + "-" + this.selectId);
30
- a && (a.scrollIntoView({ behavior: "smooth", block: "center" }), o && a.focus({ preventScroll: !1 }));
28
+ async selectScrollToActiveItem(s, a = !0) {
29
+ let l = document.getElementById(s + "-" + this.selectId);
30
+ l && (l.scrollIntoView({ behavior: "smooth", block: "center" }), a && l.focus({ preventScroll: !1 }));
31
31
  },
32
- selectKeydown(i) {
33
- if (i.keyCode < 65 || i.keyCode > 90) return;
34
- this.selectKeydownValue += i.key;
35
- let o = this.selectItemsFindBestMatch();
36
- o && this.selectOpen && (this.selectableItemActive = o), this.selectKeydownValue !== "" && (clearTimeout(this.selectKeydownClearTimeout), this.selectKeydownClearTimeout = window.setTimeout(() => {
32
+ selectKeydown(s) {
33
+ if (s.keyCode < 65 || s.keyCode > 90) return;
34
+ this.selectKeydownValue += s.key;
35
+ let a = this.selectItemsFindBestMatch();
36
+ a && this.selectOpen && (this.selectableItemActive = a), this.selectKeydownValue !== "" && (clearTimeout(this.selectKeydownClearTimeout), this.selectKeydownClearTimeout = window.setTimeout(() => {
37
37
  this.selectKeydownValue = "";
38
38
  }, this.selectKeydownTimeout));
39
39
  },
40
40
  selectItemsFindBestMatch() {
41
- let i = this.selectKeydownValue.toLowerCase(), o = null, a = -1;
42
- for (const c of this.selectableItems) {
43
- let b = c.name.toLowerCase().indexOf(i);
44
- b > -1 && (a == -1 || b < a) && !c.disabled && (o = c, a = b);
41
+ let s = this.selectKeydownValue.toLowerCase(), a = null, l = -1;
42
+ for (const r of this.selectableItems) {
43
+ let h = r.name.toLowerCase().indexOf(s);
44
+ h > -1 && (l == -1 || h < l) && !r.disabled && (a = r, l = h);
45
45
  }
46
- return o;
46
+ return a;
47
47
  },
48
48
  selectPositionUpdate() {
49
- var o;
49
+ var a;
50
50
  if (!this.selectButton || !this.selectableItemsList) return;
51
- let i = ((o = this.selectButton) == null ? void 0 : o.getBoundingClientRect().top) + this.selectButton.offsetHeight + parseInt(window.getComputedStyle(this.selectableItemsList).maxHeight);
52
- this.selectDropdownPosition = window.innerHeight < i ? "top" : "bottom";
51
+ let s = ((a = this.selectButton) == null ? void 0 : a.getBoundingClientRect().top) + this.selectButton.offsetHeight + parseInt(window.getComputedStyle(this.selectableItemsList).maxHeight);
52
+ this.selectDropdownPosition = window.innerHeight < s ? "top" : "bottom";
53
53
  },
54
- setOptions(i) {
55
- Array.isArray(i) && (this.selectableItems = i);
54
+ setOptions(s) {
55
+ Array.isArray(s) && (this.selectableItems = s);
56
56
  }
57
57
  }), n = () => {
58
- e.selectOpen && e.selectPositionUpdate();
58
+ o.selectOpen && o.selectPositionUpdate();
59
59
  };
60
- return $(
61
- () => e.selectOpen,
62
- function(i) {
63
- if (e.selectedItems ? e.selectableItemActive = e.selectedItem : e.selectableItemActive = e.selectableItems[0], !i) {
60
+ return O(
61
+ () => o.selectOpen,
62
+ function(s) {
63
+ if (o.selectedItems ? o.selectableItemActive = o.selectedItem : o.selectableItemActive = o.selectableItems[0], !s) {
64
64
  window.removeEventListener("resize", n);
65
65
  return;
66
66
  }
67
67
  n(), window.addEventListener("resize", n);
68
68
  },
69
69
  { immediate: !1 }
70
- ), e;
70
+ ), o;
71
71
  }
72
- function Ge(l, t, s) {
73
- var Q;
74
- const e = r(!1), n = r(((Q = l.model) == null ? void 0 : Q.value) ?? l.defaultDate ?? ""), i = r("F d, Y"), o = r(0), a = r(0), c = r(0), m = r([]), b = r([]), v = r("bottom"), T = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], C = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], x = r("D"), f = K(() => {
75
- let d = Math.max(o.value, 0);
76
- return d >= T.length && (d = 0), T[d];
77
- }), h = K(() => {
78
- const d = Math.floor(a.value / 10) * 10;
79
- return Array.from({ length: 10 }, (E, D) => d + D);
72
+ function be(i, e, t) {
73
+ var _;
74
+ const o = u(!1), n = u(((_ = i.model) == null ? void 0 : _.value) ?? i.defaultDate ?? ""), s = u("F d, Y"), a = u(0), l = u(0), r = u(0), f = u([]), h = u([]), d = u("bottom"), m = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], g = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], v = u("D"), I = F(() => {
75
+ let c = Math.max(a.value, 0);
76
+ return c >= m.length && (c = 0), m[c];
77
+ }), U = F(() => {
78
+ const c = Math.floor(l.value / 10) * 10;
79
+ return Array.from({ length: 10 }, (b, w) => c + w);
80
80
  });
81
- function w(d) {
82
- e.value = d ?? !e.value, x.value = "D";
81
+ function q(c) {
82
+ o.value = c ?? !o.value, v.value = "D";
83
83
  }
84
- function p(d = "D") {
85
- x.value = d;
84
+ function z(c = "D") {
85
+ v.value = c;
86
86
  }
87
- function y(d) {
88
- const E = C[d.getDay()], D = ("0" + d.getDate()).slice(-2), Y = T[d.getMonth()], z = Y.substring(0, 3), j = ("0" + (d.getMonth() + 1)).slice(-2), A = d.getFullYear();
89
- switch (i.value) {
87
+ function M(c) {
88
+ const b = g[c.getDay()], w = ("0" + c.getDate()).slice(-2), T = m[c.getMonth()], x = T.substring(0, 3), C = ("0" + (c.getMonth() + 1)).slice(-2), y = c.getFullYear();
89
+ switch (s.value) {
90
90
  case "F d, Y":
91
- return `${Y} ${D}, ${A}`;
91
+ return `${T} ${w}, ${y}`;
92
92
  case "d M, Y":
93
- return `${D} ${z}, ${A}`;
93
+ return `${w} ${x}, ${y}`;
94
94
  case "Y M d":
95
- return `${A} ${z} ${D}`;
95
+ return `${y} ${x} ${w}`;
96
96
  case "MM-DD-YYYY":
97
- return `${j}-${D}-${A}`;
97
+ return `${C}-${w}-${y}`;
98
98
  case "DD-MM-YYYY":
99
- return `${D}-${j}-${A}`;
99
+ return `${w}-${C}-${y}`;
100
100
  case "YYYY-MM-DD":
101
- return `${A}-${j}-${D}`;
101
+ return `${y}-${C}-${w}`;
102
102
  case "D d M, Y":
103
- return `${E} ${D} ${z} ${A}`;
103
+ return `${b} ${w} ${x} ${y}`;
104
104
  default:
105
- return `${Y} ${D}, ${A}`;
105
+ return `${T} ${w}, ${y}`;
106
106
  }
107
107
  }
108
- function M(d) {
109
- switch (x.value) {
108
+ function W(c) {
109
+ switch (v.value) {
110
110
  case "Y":
111
- a.value = d, x.value = "M";
111
+ l.value = c, v.value = "M";
112
112
  break;
113
113
  case "M":
114
- o.value = d, x.value = "D", H();
114
+ a.value = c, v.value = "D", A();
115
115
  break;
116
116
  default:
117
- c.value = d, n.value = y(new Date(a.value, o.value, d)), e.value = !1, l.model && (l.model.value = n.value);
117
+ r.value = c, n.value = M(new Date(l.value, a.value, c)), o.value = !1, i.model && (i.model.value = n.value);
118
118
  break;
119
119
  }
120
120
  }
121
- function g() {
122
- switch (x.value) {
121
+ function J() {
122
+ switch (v.value) {
123
123
  case "Y":
124
- a.value -= 10;
124
+ l.value -= 10;
125
125
  break;
126
126
  case "M":
127
- a.value -= 1;
127
+ l.value -= 1;
128
128
  break;
129
129
  default:
130
- o.value === 0 ? (a.value--, o.value = 11) : o.value--, H();
130
+ a.value === 0 ? (l.value--, a.value = 11) : a.value--, A();
131
131
  break;
132
132
  }
133
133
  }
134
- function u() {
135
- switch (x.value) {
134
+ function X() {
135
+ switch (v.value) {
136
136
  case "Y":
137
- a.value += 10;
137
+ l.value += 10;
138
138
  break;
139
139
  case "M":
140
- a.value += 1;
140
+ l.value += 1;
141
141
  break;
142
142
  default:
143
- o.value === 11 ? (o.value = 0, a.value++) : o.value++, H();
143
+ a.value === 11 ? (a.value = 0, l.value++) : a.value++, A();
144
144
  break;
145
145
  }
146
146
  }
147
- function I(d) {
148
- const E = new Date(a.value, o.value, d);
149
- return n.value === y(E);
147
+ function Q(c) {
148
+ const b = new Date(l.value, a.value, c);
149
+ return n.value === M(b);
150
150
  }
151
- function de(d) {
152
- const E = /* @__PURE__ */ new Date(), D = new Date(a.value, o.value, d);
153
- return E.toDateString() === D.toDateString();
151
+ function G(c) {
152
+ const b = /* @__PURE__ */ new Date(), w = new Date(l.value, a.value, c);
153
+ return b.toDateString() === w.toDateString();
154
154
  }
155
- function H() {
156
- const d = new Date(a.value, o.value + 1, 0).getDate(), E = new Date(a.value, o.value).getDay();
157
- b.value = Array.from({ length: E }, (D, Y) => Y + 1), m.value = Array.from({ length: d }, (D, Y) => Y + 1);
155
+ function A() {
156
+ const c = new Date(l.value, a.value + 1, 0).getDate(), b = new Date(l.value, a.value).getDay();
157
+ h.value = Array.from({ length: b }, (w, T) => T + 1), f.value = Array.from({ length: c }, (w, T) => T + 1);
158
158
  }
159
- function R() {
160
- if (!t.value || !s.value || !e.value) return;
161
- const d = t.value.getBoundingClientRect(), E = s.value.offsetHeight, D = d.top + d.height + E;
162
- v.value = D > window.innerHeight ? "top" : "bottom";
159
+ function B() {
160
+ if (!e.value || !t.value || !o.value) return;
161
+ const c = e.value.getBoundingClientRect(), b = t.value.offsetHeight, w = c.top + c.height + b;
162
+ d.value = w > window.innerHeight ? "top" : "bottom";
163
163
  }
164
- function J(d, E = !0) {
165
- o.value = d.getMonth(), a.value = d.getFullYear(), c.value = d.getDate(), E && (n.value = y(d)), H();
164
+ function N(c, b = !0) {
165
+ a.value = c.getMonth(), l.value = c.getFullYear(), r.value = c.getDate(), b && (n.value = M(c)), A();
166
166
  }
167
- function X() {
167
+ function $() {
168
168
  if (n.value)
169
- return J(new Date(Date.parse(n.value)));
170
- J(/* @__PURE__ */ new Date(), l.useDefaultDate);
169
+ return N(new Date(Date.parse(n.value)));
170
+ N(/* @__PURE__ */ new Date(), i.useDefaultDate);
171
171
  }
172
- return W(() => {
173
- X();
174
- }), $(e, async (d) => {
175
- if (!d) {
176
- window.removeEventListener("resize", R);
172
+ return te(() => {
173
+ $();
174
+ }), O(o, async (c) => {
175
+ if (!c) {
176
+ window.removeEventListener("resize", B);
177
177
  return;
178
178
  }
179
- await ae(), X(), R(), window.addEventListener("resize", R);
179
+ await se(), $(), B(), window.addEventListener("resize", B);
180
180
  }), {
181
- datePickerInput: t,
182
- datePickerCalendar: s,
183
- datePickerOpen: e,
181
+ datePickerInput: e,
182
+ datePickerCalendar: t,
183
+ datePickerOpen: o,
184
184
  datePickerValue: n,
185
- datePickerPanel: x,
186
- datePickerFormat: i,
187
- datePickerMonth: o,
188
- datePickerMonthVerbose: f,
189
- datePickerYear: a,
190
- datePickerDecade: h,
191
- datePickerDay: c,
192
- datePickerDaysInMonth: m,
193
- datePickerBlankDaysInMonth: b,
194
- datePickerMonthNames: T,
195
- datePickerDays: C,
196
- datePickerPosition: v,
197
- toggleDatePicker: w,
198
- datePickerValueClicked: M,
199
- datePickerPrevious: g,
200
- datePickerNext: u,
201
- datePickerIsSelectedDate: I,
202
- datePickerIsToday: de,
203
- showDatePickerPanel: p
185
+ datePickerPanel: v,
186
+ datePickerFormat: s,
187
+ datePickerMonth: a,
188
+ datePickerMonthVerbose: I,
189
+ datePickerYear: l,
190
+ datePickerDecade: U,
191
+ datePickerDay: r,
192
+ datePickerDaysInMonth: f,
193
+ datePickerBlankDaysInMonth: h,
194
+ datePickerMonthNames: m,
195
+ datePickerDays: g,
196
+ datePickerPosition: d,
197
+ toggleDatePicker: q,
198
+ datePickerValueClicked: W,
199
+ datePickerPrevious: J,
200
+ datePickerNext: X,
201
+ datePickerIsSelectedDate: Q,
202
+ datePickerIsToday: G,
203
+ showDatePickerPanel: z
204
204
  };
205
205
  }
206
- function ce(l = "pv_id_") {
207
- return l + Math.random().toString(16).slice(2);
206
+ function j(i = "pv_id_") {
207
+ return i + Math.random().toString(16).slice(2);
208
208
  }
209
- class De {
209
+ class ae {
210
210
  constructor() {
211
- O(this, "subscribers");
212
- O(this, "toasts");
211
+ p(this, "subscribers");
212
+ p(this, "toasts");
213
213
  // We use arrow functions to maintain the correct `this` reference
214
- O(this, "subscribe", (t) => (this.subscribers.push(t), () => {
215
- const s = this.subscribers.indexOf(t);
216
- this.subscribers.splice(s, 1);
214
+ p(this, "subscribe", (e) => (this.subscribers.push(e), () => {
215
+ const t = this.subscribers.indexOf(e);
216
+ this.subscribers.splice(t, 1);
217
217
  }));
218
- O(this, "publish", (t) => {
219
- this.subscribers.forEach((s) => s(t));
218
+ p(this, "publish", (e) => {
219
+ this.subscribers.forEach((t) => t(e));
220
220
  });
221
- O(this, "addToast", (t) => {
222
- this.publish(t), this.toasts = [...this.toasts, t];
221
+ p(this, "addToast", (e) => {
222
+ this.publish(e), this.toasts = [...this.toasts, e];
223
223
  });
224
- O(this, "create", (t, s) => {
225
- const e = s.id ?? ce("toast_");
226
- return this.toasts.find((i) => i.id === e) ? this.toasts = this.toasts.map((i) => i.id === e ? (this.publish({ ...i, ...s, id: e, title: t }), {
227
- ...i,
224
+ p(this, "create", (e, t) => {
225
+ const o = t.id ?? j("toast_");
226
+ return this.toasts.find((s) => s.id === o) ? this.toasts = this.toasts.map((s) => s.id === o ? (this.publish({ ...s, ...t, id: o, title: e }), {
228
227
  ...s,
229
- id: e,
230
- title: t
231
- }) : i) : this.addToast({
232
- title: t,
233
- id: e,
228
+ ...t,
229
+ id: o,
230
+ title: e
231
+ }) : s) : this.addToast({
232
+ title: e,
233
+ id: o,
234
234
  scale: 1,
235
235
  zIndex: 200,
236
236
  offsetY: 0,
237
- ...s
238
- }), e;
237
+ ...t
238
+ }), o;
239
239
  });
240
- O(this, "dismiss", (t) => {
241
- t ? (this.publish({ id: t, dismiss: !0 }), this.toasts = this.toasts.filter((s) => s.id !== t)) : (this.toasts.forEach((s) => {
242
- this.publish({ id: s.id, dismiss: !0 });
240
+ p(this, "dismiss", (e) => {
241
+ e ? (this.publish({ id: e, dismiss: !0 }), this.toasts = this.toasts.filter((t) => t.id !== e)) : (this.toasts.forEach((t) => {
242
+ this.publish({ id: t.id, dismiss: !0 });
243
243
  }), this.toasts = []);
244
244
  });
245
- O(this, "add", (t, s) => this.create(t, { ...s }));
246
- O(this, "success", (t, s) => this.create(t, { type: "success", ...s }));
247
- O(this, "error", (t, s) => this.create(t, { type: "danger", ...s }));
248
- O(this, "info", (t, s) => this.create(t, { type: "info", ...s }));
249
- O(this, "warning", (t, s) => this.create(t, { type: "warning", ...s }));
245
+ p(this, "add", (e, t) => this.create(e, { ...t }));
246
+ p(this, "success", (e, t) => this.create(e, { type: "success", ...t }));
247
+ p(this, "error", (e, t) => this.create(e, { type: "danger", ...t }));
248
+ p(this, "info", (e, t) => this.create(e, { type: "info", ...t }));
249
+ p(this, "warning", (e, t) => this.create(e, { type: "warning", ...t }));
250
250
  this.subscribers = [], this.toasts = [];
251
251
  }
252
252
  }
253
- const k = new De();
254
- function Me(l, t) {
255
- const s = ce("toast_");
256
- return k.create(l, { ...t, id: s }), s;
253
+ const D = new ae();
254
+ function le(i, e) {
255
+ const t = j("toast_");
256
+ return D.create(i, { ...e, id: t }), t;
257
257
  }
258
- const Oe = Object.assign(Me, {
259
- add: k.add,
260
- success: k.success,
261
- error: k.error,
262
- info: k.info,
263
- warning: k.warning,
264
- dismiss: k.dismiss
258
+ const oe = Object.assign(le, {
259
+ add: D.add,
260
+ success: D.success,
261
+ error: D.error,
262
+ info: D.info,
263
+ warning: D.warning,
264
+ dismiss: D.dismiss
265
265
  });
266
- function et(l) {
267
- const t = r(!1);
266
+ function ye(i) {
267
+ const e = u(!1);
268
268
  return {
269
- copyNotification: t,
269
+ copyNotification: e,
270
270
  copyToClipboard: async () => {
271
271
  try {
272
- await navigator.clipboard.writeText(l.value), t.value = !0, setTimeout(() => {
273
- t.value = !1;
272
+ await navigator.clipboard.writeText(i.value), e.value = !0, setTimeout(() => {
273
+ e.value = !1;
274
274
  }, 3e3);
275
- } catch (e) {
276
- console.error(e), Oe.error("Error", {
275
+ } catch (o) {
276
+ console.error(o), oe.error("Error", {
277
277
  description: "Unable to copy. Network is not secure."
278
278
  });
279
279
  }
280
280
  }
281
281
  };
282
282
  }
283
- function tt(l, t) {
284
- const s = _({
283
+ function Ie(i, e) {
284
+ const t = P({
285
285
  selectOpen: !1,
286
286
  selectedItem: "",
287
- selectableItems: l,
287
+ selectableItems: i,
288
288
  selectableItemActive: null,
289
289
  selectId: "select-12",
290
290
  selectKeydownValue: "",
291
291
  selectKeydownTimeout: 1e3,
292
292
  selectKeydownClearTimeout: null,
293
293
  selectDropdownPosition: "bottom",
294
- selectableItemsList: t.selectableItemsList,
295
- selectButton: t.selectButton,
294
+ selectableItemsList: e.selectableItemsList,
295
+ selectButton: e.selectButton,
296
296
  toggleSelect(n) {
297
297
  n !== void 0 ? this.selectOpen = n === !0 : this.selectOpen = !this.selectOpen;
298
298
  },
@@ -318,696 +318,329 @@ function tt(l, t) {
318
318
  selectKeydown(n) {
319
319
  if (n.keyCode >= 65 && n.keyCode <= 90) {
320
320
  this.selectKeydownValue += n.key;
321
- let i = this.selectItemsFindBestMatch();
322
- i && (this.selectOpen ? (this.selectableItemActive = i, this.selectScrollToActiveItem()) : this.selectedItem = this.selectableItemActive === i), this.selectKeydownValue != "" && (clearTimeout(this.selectKeydownClearTimeout), this.selectKeydownClearTimeout = window.setTimeout(() => {
321
+ let s = this.selectItemsFindBestMatch();
322
+ s && (this.selectOpen ? (this.selectableItemActive = s, this.selectScrollToActiveItem()) : this.selectedItem = this.selectableItemActive === s), this.selectKeydownValue != "" && (clearTimeout(this.selectKeydownClearTimeout), this.selectKeydownClearTimeout = window.setTimeout(() => {
323
323
  this.selectKeydownValue = "";
324
324
  }, this.selectKeydownTimeout));
325
325
  }
326
326
  },
327
327
  selectItemsFindBestMatch() {
328
- let n = this.selectKeydownValue.toLowerCase(), i = null, o = -1;
329
- for (const a of this.selectableItems) {
330
- let m = a.title.toLowerCase().indexOf(n);
331
- m > -1 && (o == -1 || m < o) && !a.disabled && (i = a, o = m);
328
+ let n = this.selectKeydownValue.toLowerCase(), s = null, a = -1;
329
+ for (const l of this.selectableItems) {
330
+ let f = l.title.toLowerCase().indexOf(n);
331
+ f > -1 && (a == -1 || f < a) && !l.disabled && (s = l, a = f);
332
332
  }
333
- return i;
333
+ return s;
334
334
  },
335
335
  selectPositionUpdate() {
336
- var i;
336
+ var s;
337
337
  if (!this.selectableItemsList || !this.selectButton) return;
338
- let n = ((i = this.selectButton) == null ? void 0 : i.getBoundingClientRect().top) + this.selectButton.offsetHeight + parseInt(window.getComputedStyle(this.selectableItemsList).maxHeight);
338
+ let n = ((s = this.selectButton) == null ? void 0 : s.getBoundingClientRect().top) + this.selectButton.offsetHeight + parseInt(window.getComputedStyle(this.selectableItemsList).maxHeight);
339
339
  window.innerHeight < n ? this.selectDropdownPosition = "top" : this.selectDropdownPosition = "bottom";
340
340
  }
341
- }), e = () => {
342
- s.selectOpen && s.selectPositionUpdate();
341
+ }), o = () => {
342
+ t.selectOpen && t.selectPositionUpdate();
343
343
  };
344
- return $(
345
- () => s.selectOpen,
344
+ return O(
345
+ () => t.selectOpen,
346
346
  function(n) {
347
- if (s.selectedItem ? s.selectableItemActive = s.selectedItem : s.selectableItemActive = s.selectableItems[0], !n) {
348
- window.removeEventListener("resize", e);
347
+ if (t.selectedItem ? t.selectableItemActive = t.selectedItem : t.selectableItemActive = t.selectableItems[0], !n) {
348
+ window.removeEventListener("resize", o);
349
349
  return;
350
350
  }
351
351
  window.setTimeout(function() {
352
- s.selectScrollToActiveItem();
353
- }, 10), e(), window.addEventListener("resize", e);
352
+ t.selectScrollToActiveItem();
353
+ }, 10), o(), window.addEventListener("resize", o);
354
354
  },
355
355
  { immediate: !1 }
356
- ), s;
356
+ ), t;
357
357
  }
358
- function st(l) {
359
- const t = r(null);
360
- return _({
358
+ function Te(i) {
359
+ const e = u(null);
360
+ return P({
361
361
  title: "",
362
- ...l,
362
+ ...i,
363
363
  modalOpen: !1,
364
364
  isAnimating: !1,
365
- animationTime: l.animationTime ?? 300,
366
- toggleModal(s = null) {
367
- this.isAnimating || (t.value && clearTimeout(t.value), s != null ? this.modalOpen = s : this.modalOpen = !this.modalOpen, this.isAnimating = !0, t.value = window.setTimeout(() => {
365
+ animationTime: i.animationTime ?? 300,
366
+ toggleModal(t = null) {
367
+ this.isAnimating || (e.value && clearTimeout(e.value), t != null ? this.modalOpen = t : this.modalOpen = !this.modalOpen, this.isAnimating = !0, e.value = window.setTimeout(() => {
368
368
  this.isAnimating = !1;
369
369
  }, this.animationTime));
370
370
  },
371
- setTitle(s) {
372
- this.title = s;
371
+ setTitle(t) {
372
+ this.title = t;
373
373
  }
374
374
  });
375
375
  }
376
- function nt(l) {
377
- const t = r(1), s = r(l.itemsPerPage ?? 10), e = r(l.searchQuery ?? ""), n = _({
378
- filteredPage: K(() => {
379
- const i = s.value * (t.value - 1), o = Math.min(s.value * t.value, l.data.length);
380
- return l.data.slice(i, o);
376
+ function De(i) {
377
+ const e = u(1), t = u(i.itemsPerPage ?? 10), o = u(i.searchQuery ?? ""), n = P({
378
+ filteredPage: F(() => {
379
+ const s = t.value * (e.value - 1), a = Math.min(t.value * e.value, i.data.length);
380
+ return i.data.slice(s, a);
381
381
  }),
382
- props: l,
383
- fields: { currentPage: t, itemsPerPage: s, searchQuery: e },
384
- handlePageChange(i) {
385
- t.value = i;
382
+ props: i,
383
+ fields: { currentPage: e, itemsPerPage: t, searchQuery: o },
384
+ handlePageChange(s) {
385
+ e.value = s;
386
386
  },
387
387
  handlePageReset() {
388
- t.value = 1;
388
+ e.value = 1;
389
389
  }
390
390
  });
391
- return $(
392
- () => l.data,
393
- (i, o) => {
394
- var a, c;
395
- ((i == null ? void 0 : i.length) !== (o == null ? void 0 : o.length) || i[0] && o[0] && ((a = i[0]) == null ? void 0 : a.id) !== ((c = o[0]) == null ? void 0 : c.id)) && n.handlePageReset();
391
+ return O(
392
+ () => i.data,
393
+ (s, a) => {
394
+ var l, r;
395
+ ((s == null ? void 0 : s.length) !== (a == null ? void 0 : a.length) || s[0] && a[0] && ((l = s[0]) == null ? void 0 : l.id) !== ((r = a[0]) == null ? void 0 : r.id)) && n.handlePageReset();
396
396
  },
397
397
  { immediate: !0 }
398
398
  ), n;
399
399
  }
400
- function Se(l) {
401
- return l && l.__esModule && Object.prototype.hasOwnProperty.call(l, "default") ? l.default : l;
400
+ function ce(i) {
401
+ return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
402
402
  }
403
- var U, te;
404
- function Ee() {
405
- return te || (te = 1, U = function l(t, s) {
406
- if (t === s) return !0;
407
- if (t && s && typeof t == "object" && typeof s == "object") {
408
- if (t.constructor !== s.constructor) return !1;
409
- var e, n, i;
410
- if (Array.isArray(t)) {
411
- if (e = t.length, e != s.length) return !1;
412
- for (n = e; n-- !== 0; )
413
- if (!l(t[n], s[n])) return !1;
403
+ var k, K;
404
+ function re() {
405
+ return K || (K = 1, k = function i(e, t) {
406
+ if (e === t) return !0;
407
+ if (e && t && typeof e == "object" && typeof t == "object") {
408
+ if (e.constructor !== t.constructor) return !1;
409
+ var o, n, s;
410
+ if (Array.isArray(e)) {
411
+ if (o = e.length, o != t.length) return !1;
412
+ for (n = o; n-- !== 0; )
413
+ if (!i(e[n], t[n])) return !1;
414
414
  return !0;
415
415
  }
416
- if (t.constructor === RegExp) return t.source === s.source && t.flags === s.flags;
417
- if (t.valueOf !== Object.prototype.valueOf) return t.valueOf() === s.valueOf();
418
- if (t.toString !== Object.prototype.toString) return t.toString() === s.toString();
419
- if (i = Object.keys(t), e = i.length, e !== Object.keys(s).length) return !1;
420
- for (n = e; n-- !== 0; )
421
- if (!Object.prototype.hasOwnProperty.call(s, i[n])) return !1;
422
- for (n = e; n-- !== 0; ) {
423
- var o = i[n];
424
- if (!l(t[o], s[o])) return !1;
416
+ if (e.constructor === RegExp) return e.source === t.source && e.flags === t.flags;
417
+ if (e.valueOf !== Object.prototype.valueOf) return e.valueOf() === t.valueOf();
418
+ if (e.toString !== Object.prototype.toString) return e.toString() === t.toString();
419
+ if (s = Object.keys(e), o = s.length, o !== Object.keys(t).length) return !1;
420
+ for (n = o; n-- !== 0; )
421
+ if (!Object.prototype.hasOwnProperty.call(t, s[n])) return !1;
422
+ for (n = o; n-- !== 0; ) {
423
+ var a = s[n];
424
+ if (!i(e[a], t[a])) return !1;
425
425
  }
426
426
  return !0;
427
427
  }
428
- return t !== t && s !== s;
429
- }), U;
428
+ return e !== e && t !== t;
429
+ }), k;
430
430
  }
431
- var Pe = Ee();
432
- const Be = /* @__PURE__ */ Se(Pe);
433
- function it(l) {
434
- let t = l, s;
435
- const e = _({
436
- fields: structuredClone(l),
431
+ var ue = re();
432
+ const fe = /* @__PURE__ */ ce(ue);
433
+ function Se(i) {
434
+ let e = i, t;
435
+ const o = P({
436
+ fields: structuredClone(i),
437
437
  errors: {},
438
438
  dirty: !1,
439
439
  hasErrors: !1,
440
440
  processing: !1,
441
441
  wasSuccessful: !1,
442
442
  recentlySuccessful: !1,
443
- async submit(n, i = {}) {
443
+ async submit(n, s = {}) {
444
444
  if (this.processing) return;
445
- const o = {
445
+ const a = {
446
446
  onBefore: async () => {
447
- this.processing = !0, this.wasSuccessful = !1, this.recentlySuccessful = !1, clearTimeout(s), i.onBefore && await i.onBefore();
447
+ this.processing = !0, this.wasSuccessful = !1, this.recentlySuccessful = !1, clearTimeout(t), s.onBefore && await s.onBefore();
448
448
  },
449
- onSuccess: async (a) => {
450
- this.clearErrors(), this.wasSuccessful = !0, this.recentlySuccessful = !0, s = window.setTimeout(() => {
449
+ onSuccess: async (l) => {
450
+ this.clearErrors(), this.wasSuccessful = !0, this.recentlySuccessful = !0, t = window.setTimeout(() => {
451
451
  this.recentlySuccessful = !1;
452
- }, 2e3), i.onSuccess && await i.onSuccess(a), t = structuredClone(this.fields);
452
+ }, 2e3), s.onSuccess && await s.onSuccess(l), e = structuredClone(this.fields);
453
453
  },
454
- onError: async (a) => {
455
- var c, m, b, v, T;
456
- this.hasErrors = !0, (((c = a == null ? void 0 : a.response) == null ? void 0 : c.status) === 422 || ((m = a == null ? void 0 : a.response) == null ? void 0 : m.status) === 401) && (this.clearErrors(), this.setErrors({
457
- message: (b = a == null ? void 0 : a.response) == null ? void 0 : b.data.message,
458
- ...(T = (v = a == null ? void 0 : a.response) == null ? void 0 : v.data) == null ? void 0 : T.errors
459
- })), i.onError && await i.onError(a);
454
+ onError: async (l) => {
455
+ var r, f, h, d, m;
456
+ this.hasErrors = !0, (((r = l == null ? void 0 : l.response) == null ? void 0 : r.status) === 422 || ((f = l == null ? void 0 : l.response) == null ? void 0 : f.status) === 401) && (this.clearErrors(), this.setErrors({
457
+ message: (h = l == null ? void 0 : l.response) == null ? void 0 : h.data.message,
458
+ ...(m = (d = l == null ? void 0 : l.response) == null ? void 0 : d.data) == null ? void 0 : m.errors
459
+ })), s.onError && await s.onError(l);
460
460
  },
461
461
  onFinish: async () => {
462
- this.processing = !1, i.onFinish && await i.onFinish();
462
+ this.processing = !1, s.onFinish && await s.onFinish();
463
463
  }
464
464
  };
465
- await o.onBefore();
465
+ await a.onBefore();
466
466
  try {
467
- const a = await n(this.fields);
468
- await o.onSuccess(a);
469
- } catch (a) {
470
- await o.onError(a);
467
+ const l = await n(this.fields);
468
+ await a.onSuccess(l);
469
+ } catch (l) {
470
+ await a.onError(l);
471
471
  } finally {
472
- await o.onFinish();
472
+ await a.onFinish();
473
473
  }
474
474
  },
475
475
  reset(...n) {
476
- const i = structuredClone(t);
477
- n.length === 0 ? this.fields = i : n.forEach((o) => {
478
- i[o] !== void 0 && (this.fields[o] = i[o]);
476
+ const s = structuredClone(e);
477
+ n.length === 0 ? this.fields = s : n.forEach((a) => {
478
+ s[a] !== void 0 && (this.fields[a] = s[a]);
479
479
  });
480
480
  },
481
481
  clearErrors(...n) {
482
- n.length === 0 ? this.errors = {} : n.forEach((i) => delete this.errors[i]), this.hasErrors = Object.keys(this.errors).length > 0;
482
+ n.length === 0 ? this.errors = {} : n.forEach((s) => delete this.errors[s]), this.hasErrors = Object.keys(this.errors).length > 0;
483
483
  },
484
484
  setErrors(n) {
485
485
  this.errors = { ...this.errors, ...n }, this.hasErrors = Object.keys(this.errors).length > 0;
486
486
  }
487
487
  });
488
- return $(
489
- () => e.fields,
488
+ return O(
489
+ () => o.fields,
490
490
  () => {
491
- e.dirty = !Be(e.fields, t);
491
+ o.dirty = !fe(o.fields, e);
492
492
  },
493
493
  { immediate: !0, deep: !0 }
494
- ), e;
494
+ ), o;
495
495
  }
496
- function ke({ directions: l, threshold: t, onSwipeOut: s }) {
497
- const e = r(!1), n = r({ x: 0, y: 0 }), i = r(), o = r({ x: 0, y: 0 }), a = (v) => 1 / (1.5 + Math.abs(v) / 20);
498
- function c(v) {
499
- i.value = Date.now(), v.target.setPointerCapture(v.pointerId), !v.target.closest("button, a, input, textarea, select") && (o.value = { x: v.clientX, y: v.clientY }, e.value = !0);
496
+ function Pe({ directions: i, threshold: e, onSwipeOut: t }) {
497
+ const o = u(!1), n = u({ x: 0, y: 0 }), s = u(), a = u({ x: 0, y: 0 }), l = (d) => 1 / (1.5 + Math.abs(d) / 20);
498
+ function r(d) {
499
+ s.value = Date.now(), d.target.setPointerCapture(d.pointerId), !d.target.closest("button, a, input, textarea, select") && (a.value = { x: d.clientX, y: d.clientY }, o.value = !0);
500
500
  }
501
- function m(v) {
502
- if (!e.value) return;
503
- const T = { x: 0, y: 0 }, C = v.clientX - o.value.x, x = v.clientY - o.value.y;
504
- if (l.value.includes("left") && C < 0 || l.value.includes("right") && C > 0)
505
- T.x = C;
501
+ function f(d) {
502
+ if (!o.value) return;
503
+ const m = { x: 0, y: 0 }, g = d.clientX - a.value.x, v = d.clientY - a.value.y;
504
+ if (i.value.includes("left") && g < 0 || i.value.includes("right") && g > 0)
505
+ m.x = g;
506
506
  else {
507
- const f = C * a(C);
508
- T.x = Math.abs(f) < Math.abs(C) ? f : C;
507
+ const I = g * l(g);
508
+ m.x = Math.abs(I) < Math.abs(g) ? I : g;
509
509
  }
510
- if (l.value.includes("top") && x < 0 || l.value.includes("bottom") && x > 0)
511
- T.y = x;
510
+ if (i.value.includes("top") && v < 0 || i.value.includes("bottom") && v > 0)
511
+ m.y = v;
512
512
  else {
513
- const f = x * a(x);
514
- T.y = Math.abs(f) < Math.abs(x) ? f : x;
513
+ const I = v * l(v);
514
+ m.y = Math.abs(I) < Math.abs(v) ? I : v;
515
515
  }
516
- n.value = T;
516
+ n.value = m;
517
517
  }
518
- function b() {
519
- if (!e.value) return;
520
- const v = Date.now() - (i.value ?? 0), T = n.value.x, C = Math.abs(T) / v;
521
- if (Math.abs(T) >= t || C > 0.11) {
522
- s();
518
+ function h() {
519
+ if (!o.value) return;
520
+ const d = Date.now() - (s.value ?? 0), m = n.value.x, g = Math.abs(m) / d;
521
+ if (Math.abs(m) >= e || g > 0.11) {
522
+ t();
523
523
  return;
524
524
  }
525
- e.value = !1, n.value = { x: 0, y: 0 };
525
+ o.value = !1, n.value = { x: 0, y: 0 };
526
526
  }
527
527
  return {
528
528
  offset: n,
529
- isSwiping: e,
530
- onPointerDown: c,
531
- onPointerMove: m,
532
- onPointerUp: b
529
+ isSwiping: o,
530
+ onPointerDown: r,
531
+ onPointerMove: f,
532
+ onPointerUp: h
533
533
  };
534
534
  }
535
- function Ae({ duration: l, isPaused: t, onTimeout: s, immediate: e = !0 }) {
536
- const n = r(), i = r(0), o = r(l);
537
- function a() {
538
- o.value === 1 / 0 || t() || (i.value = Date.now(), n.value = window.setTimeout(() => {
539
- s();
540
- }, o.value));
535
+ function Oe({ duration: i, isPaused: e, onTimeout: t, immediate: o = !0 }) {
536
+ const n = u(), s = u(0), a = u(i);
537
+ function l() {
538
+ a.value === 1 / 0 || e() || (s.value = Date.now(), n.value = window.setTimeout(() => {
539
+ t();
540
+ }, a.value));
541
541
  }
542
- function c() {
543
- m();
544
- const b = Date.now() - i.value;
545
- o.value -= b;
542
+ function r() {
543
+ f();
544
+ const h = Date.now() - s.value;
545
+ a.value -= h;
546
546
  }
547
- function m() {
547
+ function f() {
548
548
  n.value && (clearTimeout(n.value), n.value = null);
549
549
  }
550
- return $(
551
- t,
552
- (b) => {
553
- if (b) {
554
- c();
550
+ return O(
551
+ e,
552
+ (h) => {
553
+ if (h) {
554
+ r();
555
555
  return;
556
556
  }
557
- a();
557
+ l();
558
558
  },
559
- { immediate: e }
560
- ), re(() => {
561
- m();
562
- }), { cancel: m };
559
+ { immediate: o }
560
+ ), ne(() => {
561
+ f();
562
+ }), { cancel: f };
563
563
  }
564
- function lt() {
565
- const l = r(!1), t = r(!1), s = r(300), e = r(null), n = _({}), i = pe(null);
566
- function o(c, m = {}) {
567
- e.value && clearTimeout(e.value), i.value = c, Object.assign(n, m), t.value = !0, l.value = !0, e.value = window.setTimeout(() => {
568
- l.value = !1;
569
- }, s.value);
570
- }
571
- function a() {
572
- e.value && clearTimeout(e.value), t.value = !1, l.value = !0, e.value = window.setTimeout(() => {
573
- l.value = !1;
574
- }, s.value);
575
- }
576
- return { isOpen: t, isAnimating: l, animationTime: s, props: n, component: i, open: o, close: a };
564
+ const E = u(!1), L = u(!1), Y = u(300), S = u(null), R = P({}), H = ie(null);
565
+ function de(i, e = {}) {
566
+ S.value && clearTimeout(S.value), H.value = i, Object.assign(R, e), L.value = !0, E.value = !0, S.value = window.setTimeout(() => {
567
+ E.value = !1;
568
+ }, Y.value);
577
569
  }
578
- function ot(l, t) {
579
- if (!l) return !1;
580
- let s = ["INPUT", "TEXTAREA", "SELECT"];
581
- return (t === " " || t === "Enter") && (s = [...s, "BUTTON"]), s.includes(l.tagName);
570
+ function me() {
571
+ S.value && clearTimeout(S.value), L.value = !1, E.value = !0, S.value = window.setTimeout(() => {
572
+ E.value = !1;
573
+ }, Y.value);
582
574
  }
583
- const fe = 3, Le = "24px", $e = "16px", se = 0, ne = 3e3, Ye = 16, Ve = 45, ie = 10, le = 0.06, q = 16, Fe = ["id", "data-isSwiping"], Ne = {
584
- class: "w-[18px] h-[18px] mr-1.5 -ml-1",
585
- viewBox: "0 0 24 24",
586
- fill: "none",
587
- xmlns: "http://www.w3.org/2000/svg"
588
- }, _e = {
589
- class: "w-[18px] h-[18px] mr-1.5 -ml-1",
590
- viewBox: "0 0 24 24",
591
- fill: "none",
592
- xmlns: "http://www.w3.org/2000/svg"
593
- }, Ke = {
594
- class: "w-[18px] h-[18px] mr-1.5 -ml-1",
595
- viewBox: "0 0 24 24",
596
- fill: "none",
597
- xmlns: "http://www.w3.org/2000/svg"
598
- }, He = {
599
- class: "w-[18px] h-[18px] mr-1.5 -ml-1",
600
- viewBox: "0 0 24 24",
601
- fill: "none",
602
- xmlns: "http://www.w3.org/2000/svg"
603
- }, Re = ["title"], ze = /* @__PURE__ */ ue({
604
- __name: "ToastNotification",
605
- props: {
606
- id: {},
607
- index: {},
608
- stack: {},
609
- position: { default: "bottom-center" },
610
- toastCount: {},
611
- expanded: { type: Boolean },
612
- maxVisibleToasts: { default: fe },
613
- swipeDirections: { default: () => [] },
614
- style: { default: "" },
615
- title: { default: "Title" },
616
- description: {},
617
- type: { default: "default" },
618
- life: { default: ne },
619
- html: { default: "" },
620
- component: {},
621
- scale: {},
622
- zIndex: {},
623
- offsetY: {},
624
- positionY: {}
625
- },
626
- emits: ["close"],
627
- setup(l, { emit: t }) {
628
- const s = t, e = l, n = r("translate-y-0"), i = K(() => {
629
- if (e.swipeDirections.length > 0) return e.swipeDirections;
630
- const [g, u] = e.position.split("-"), I = [];
631
- return M(g) && I.push(g), M(u) && I.push(u), u === "center" && I.push("left", "right"), I;
632
- }), o = K(() => e.position.includes("bottom")), a = r(null), c = r(null), m = r(!1), b = r(!1), { offset: v, isSwiping: T, onPointerDown: C, onPointerMove: x, onPointerUp: f } = ke({
633
- directions: i,
634
- threshold: Ve,
635
- onSwipeOut: p
636
- }), { cancel: h } = Ae({
637
- duration: e.life || ne,
638
- isPaused: () => e.expanded || e.type === "loading" || !e.life || e.life === 1 / 0 || m.value,
639
- onTimeout: p
640
- });
641
- function w() {
642
- return T.value ? v.value.x > 0 ? "translate-x-full" : "-translate-x-full" : e.toastCount === 1 ? o.value ? "translate-y-full" : "-translate-y-full" : "translate-y-0";
643
- }
644
- function p() {
645
- a.value || (n.value = w(), b.value = !1, h(), a.value = window.setTimeout(() => {
646
- s("close", e.id);
647
- }, 350));
648
- }
649
- function y() {
650
- c.value && (clearTimeout(c.value), c.value = null), a.value && (clearTimeout(a.value), a.value = null);
651
- }
652
- function M(g) {
653
- return ["top", "right", "bottom", "left"].includes(g);
654
- }
655
- return W(() => {
656
- b.value = !0, c.value && clearTimeout(c.value), c.value = window.setTimeout(() => {
657
- e.stack();
658
- });
659
- }), re(() => {
660
- y();
661
- }), (g, u) => (B(), L("li", {
662
- ref: "toastEl",
663
- id: e.id,
664
- class: N([
665
- "toast w-full absolute duration-300 transition-all ease-out",
666
- { "toast-no-description": !g.description },
667
- { "opacity-0 pointer-events-none": g.index >= g.maxVisibleToasts },
668
- g.style
669
- ]),
670
- style: he({
671
- "--offset-x": `${S(v).x}px`,
672
- "--offset-y": `${g.offsetY}px`,
673
- "--scale": g.scale,
674
- "--z-index": g.zIndex,
675
- "--position-top": `${g.expanded ? o.value ? "auto" : g.positionY : "inherit"}`,
676
- "--position-bottom": `${o.value && g.expanded ? g.positionY : "inherit"}`
677
- }),
678
- "data-isSwiping": S(T),
679
- onMouseover: u[0] || (u[0] = (I) => m.value = !0),
680
- onMouseout: u[1] || (u[1] = (I) => m.value = !1),
681
- onDragend: u[2] || (u[2] = //@ts-ignore
682
- (...I) => S(f) && S(f)(...I)),
683
- onPointerdown: u[3] || (u[3] = //@ts-ignore
684
- (...I) => S(C) && S(C)(...I)),
685
- onPointermove: u[4] || (u[4] = //@ts-ignore
686
- (...I) => S(x) && S(x)(...I)),
687
- onPointerup: u[5] || (u[5] = //@ts-ignore
688
- (...I) => S(f) && S(f)(...I)),
689
- role: "alert"
690
- }, [
691
- ge(we, {
692
- "enter-active-class": "",
693
- "enter-from-class": `opacity-0 ${o.value ? "translate-y-full" : "-translate-y-full"}`,
694
- "enter-to-class": "opacity-100 translate-y-0",
695
- "leave-active-class": "",
696
- "leave-from-class": "opacity-100 translate-y-0",
697
- "leave-to-class": `opacity-0 ${n.value}`
698
- }, {
699
- default: ye(() => [
700
- V(P("span", {
701
- class: N([
702
- { "p-4": !e.html, "p-0": e.html },
703
- "flex flex-col items-start backdrop-blur-lg rounded-md ",
704
- "group relative select-text",
705
- "transition-all duration-300 ease-out",
706
- "bg-white dark:bg-primary-dark-700/70 text-gray-800 dark:text-neutral-100 shadow-[0_5px_15px_-3px_rgb(0_0_0_/_0.08)]",
707
- "ring-inset ring-1 ring-gray-100 dark:ring-neutral-800/50",
708
- "!outline-none focus:ring-gray-400 dark:focus:ring-purple-500 focus:ring-2"
709
- ])
710
- }, [
711
- e.html ? G("", !0) : (B(), L("div", {
712
- key: 0,
713
- class: N(["flex items-center", {
714
- "text-green-500": e.type === "success",
715
- "text-blue-500": e.type === "info",
716
- "text-orange-400": e.type === "warning",
717
- "text-rose-500": e.type === "danger",
718
- "dark:text-neutral-100 text-gray-800": e.type === "default"
719
- }])
720
- }, [
721
- V((B(), L("svg", Ne, u[6] || (u[6] = [
722
- P("path", {
723
- "fill-rule": "evenodd",
724
- "clip-rule": "evenodd",
725
- d: "M12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2ZM16.7744 9.63269C17.1238 9.20501 17.0604 8.57503 16.6327 8.22559C16.2051 7.87615 15.5751 7.93957 15.2256 8.36725L10.6321 13.9892L8.65936 12.2524C8.24484 11.8874 7.61295 11.9276 7.248 12.3421C6.88304 12.7566 6.92322 13.3885 7.33774 13.7535L9.31046 15.4903C10.1612 16.2393 11.4637 16.1324 12.1808 15.2547L16.7744 9.63269Z",
726
- fill: "currentColor"
727
- }, null, -1)
728
- ]), 512)), [
729
- [F, e.type === "success"]
730
- ]),
731
- V((B(), L("svg", _e, u[7] || (u[7] = [
732
- P("path", {
733
- "fill-rule": "evenodd",
734
- "clip-rule": "evenodd",
735
- d: "M12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2ZM12 9C12.5523 9 13 8.55228 13 8C13 7.44772 12.5523 7 12 7C11.4477 7 11 7.44772 11 8C11 8.55228 11.4477 9 12 9ZM13 12C13 11.4477 12.5523 11 12 11C11.4477 11 11 11.4477 11 12V16C11 16.5523 11.4477 17 12 17C12.5523 17 13 16.5523 13 16V12Z",
736
- fill: "currentColor"
737
- }, null, -1)
738
- ]), 512)), [
739
- [F, e.type === "info"]
740
- ]),
741
- V((B(), L("svg", Ke, u[8] || (u[8] = [
742
- P("path", {
743
- "fill-rule": "evenodd",
744
- "clip-rule": "evenodd",
745
- d: "M9.44829 4.46472C10.5836 2.51208 13.4105 2.51168 14.5464 4.46401L21.5988 16.5855C22.7423 18.5509 21.3145 21 19.05 21L4.94967 21C2.68547 21 1.25762 18.5516 2.4004 16.5862L9.44829 4.46472ZM11.9995 8C12.5518 8 12.9995 8.44772 12.9995 9V13C12.9995 13.5523 12.5518 14 11.9995 14C11.4473 14 10.9995 13.5523 10.9995 13V9C10.9995 8.44772 11.4473 8 11.9995 8ZM12.0009 15.99C11.4486 15.9892 11.0003 16.4363 10.9995 16.9886L10.9995 16.9986C10.9987 17.5509 11.4458 17.9992 11.9981 18C12.5504 18.0008 12.9987 17.5537 12.9995 17.0014L12.9995 16.9914C13.0003 16.4391 12.5532 15.9908 12.0009 15.99Z",
746
- fill: "currentColor"
747
- }, null, -1)
748
- ]), 512)), [
749
- [F, e.type === "warning"]
750
- ]),
751
- V((B(), L("svg", He, u[9] || (u[9] = [
752
- P("path", {
753
- "fill-rule": "evenodd",
754
- "clip-rule": "evenodd",
755
- d: "M2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12ZM11.9996 7C12.5519 7 12.9996 7.44772 12.9996 8V12C12.9996 12.5523 12.5519 13 11.9996 13C11.4474 13 10.9996 12.5523 10.9996 12V8C10.9996 7.44772 11.4474 7 11.9996 7ZM12.001 14.99C11.4488 14.9892 11.0004 15.4363 10.9997 15.9886L10.9996 15.9986C10.9989 16.5509 11.446 16.9992 11.9982 17C12.5505 17.0008 12.9989 16.5537 12.9996 16.0014L12.9996 15.9914C13.0004 15.4391 12.5533 14.9908 12.001 14.99Z",
756
- fill: "currentColor"
757
- }, null, -1)
758
- ]), 512)), [
759
- [F, e.type === "danger"]
760
- ]),
761
- P("p", {
762
- class: "text-[13px] font-medium leading-none",
763
- title: e.title
764
- }, Z(S(q) + " : " + e.title), 9, Re)
765
- ], 2)),
766
- V(P("p", {
767
- class: N([{ "pl-5": e.type !== "default" }, "mt-1.5 text-xs leading-tight opacity-70 w-full whitespace-pre-wrap break-words overflow-y-auto scrollbar-minimal max-h-32 min-h-3 pe-2"])
768
- }, Z(g.description), 3), [
769
- [F, e.description]
770
- ]),
771
- e.html ? G("", !0) : (B(), L("span", {
772
- key: 1,
773
- onClick: p,
774
- class: N(["absolute right-0 p-1.5 mr-2.5 text-gray-400 dark:text-rose-700 duration-100 ease-in-out rounded-full opacity-0 cursor-pointer hover:bg-gray-50 dark:bg-gray-800/50 hover:text-gray-500 dark:hover:text-rose-600", {
775
- "top-1/2 -translate-y-1/2": !e.description && !e.html,
776
- "top-0 mt-2.5": e.description || e.html,
777
- "opacity-100": m.value,
778
- "opacity-0": !m.value
779
- }])
780
- }, u[10] || (u[10] = [
781
- P("svg", {
782
- class: "w-3 h-3",
783
- fill: "currentColor",
784
- viewBox: "0 0 20 20",
785
- xmlns: "http://www.w3.org/2000/svg"
786
- }, [
787
- P("path", {
788
- "fill-rule": "evenodd",
789
- d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",
790
- "clip-rule": "evenodd"
791
- })
792
- ], -1)
793
- ]), 2))
794
- ], 2), [
795
- [F, b.value]
796
- ])
797
- ]),
798
- _: 1
799
- }, 8, ["enter-from-class", "leave-to-class"])
800
- ], 46, Fe));
801
- }
802
- }), je = (l, t) => {
803
- const s = l.__vccOpts || l;
804
- for (const [e, n] of t)
805
- s[e] = n;
806
- return s;
807
- }, Ue = /* @__PURE__ */ je(ze, [["__scopeId", "data-v-68f0a34c"]]), Ze = { class: "absolute top-0 left-0 text-3xl p-4 bg-amber-400/50 text-white" }, at = /* @__PURE__ */ ue({
808
- __name: "ToastController",
809
- props: {
810
- layout: { default: "default" },
811
- position: { default: "bottom-right" },
812
- defaultLife: { default: 3e3 },
813
- viewportOffset: { default: Le },
814
- mobileViewportOffset: { default: $e },
815
- paddingBetweenToasts: { default: Ye },
816
- maxVisibleToasts: { default: fe },
817
- closeButton: { type: Boolean },
818
- icons: {}
819
- },
820
- setup(l) {
821
- const t = l, s = r(), e = r([]), n = r(t.position), i = r(t.layout), o = r(!1), a = r(t.layout === "expanded"), c = r(t.paddingBetweenToasts), m = r(null);
822
- r(null);
823
- function b(f) {
824
- e.value = e.value.filter((h) => h.id !== f), k.dismiss(f), v();
825
- }
826
- function v(f) {
827
- e.value.length > 0 && T(), C(), m.value && clearTimeout(m.value), a.value && (m.value = window.setTimeout(() => {
828
- C();
829
- }, 100));
830
- }
831
- function T(f) {
832
- try {
833
- const h = n.value.includes("bottom"), w = [];
834
- let p = 0, y = 1 + le, M = -q, g = 200 + ie;
835
- for (const u of e.value) {
836
- const I = document.getElementById(u.id);
837
- if (!I) return;
838
- if (g -= ie, y -= le, M += q, u.scale = y, u.offsetY = M, u.zIndex = g, w.push(I), a.value) {
839
- p = p + (p ? c.value : 0), u.positionY = p + "px", u.scale = 1, u.offsetY = 0, p += I.offsetHeight;
840
- continue;
841
- }
842
- u.scale = y, h ? u.offsetY *= -1 : x(w[0], u);
843
- }
844
- } catch (h) {
845
- console.log(h);
846
- }
847
- }
848
- function C() {
849
- var y, M;
850
- if (!s.value) return;
851
- if (e.value.length == 0) {
852
- s.value.style.height = "0px";
853
- return;
854
- }
855
- const f = e.value[Math.max(Math.min(e.value.length - 1, t.maxVisibleToasts - 1), 0)], h = (y = document.getElementById(`${f == null ? void 0 : f.id}`)) == null ? void 0 : y.getBoundingClientRect(), w = e.value[0], p = (M = document.getElementById(`${w == null ? void 0 : w.id}`)) == null ? void 0 : M.getBoundingClientRect();
856
- if (!(!p || !h)) {
857
- if (!o.value) {
858
- s.value.style.height = p.height + "px";
859
- return;
860
- }
861
- if (n.value.includes("bottom")) {
862
- s.value.style.height = p.top + p.height - h.top + "px";
863
- return;
864
- }
865
- s.value.style.height = h.top + h.height - p.top + "px";
866
- }
867
- }
868
- function x(f, h) {
869
- const w = document.getElementById(h.id);
870
- if (!w) return;
871
- const p = f.offsetTop, y = f.offsetHeight, M = w.offsetHeight, g = p + (y - M);
872
- h.positionY = g + "px";
873
- }
874
- return W(() => {
875
- v();
876
- }), $(
877
- () => o.value,
878
- (f) => {
879
- if (i.value === "default") {
880
- if (f) {
881
- a.value = !0, v();
882
- return;
883
- }
884
- a.value = !1, v();
885
- }
886
- }
887
- ), $(
888
- () => e.value,
889
- () => {
890
- e.value.length <= 1 && (a.value = !1);
891
- }
892
- ), be((f) => {
893
- const h = k.subscribe((w) => {
894
- w.dismiss || ae(() => {
895
- const p = e.value.findIndex((M) => M.id === w.id);
896
- if (p !== -1) {
897
- e.value = [
898
- ...e.value.slice(0, p),
899
- { ...e.value[p], ...w },
900
- ...e.value.slice(p + 1)
901
- ];
902
- return;
903
- }
904
- const y = w;
905
- y.position && (n.value = y.position), e.value.unshift({
906
- ...y,
907
- id: y.id,
908
- type: y.type ?? "default",
909
- position: y.position ?? n.value,
910
- life: y.life ?? t.defaultLife,
911
- title: y.title
912
- });
913
- });
914
- });
915
- f(h);
916
- }), (f, h) => (B(), ee(Te, { to: "body" }, [
917
- P("p", Ze, "toastsHovered: " + Z(o.value), 1),
918
- P("ol", {
919
- ref_key: "container",
920
- ref: s,
921
- class: N([
922
- `fixed w-full group z-[500] [&>*]:px-4 [&>*]:px-[${f.mobileViewportOffset ?? f.viewportOffset}] [&>*]:sm:px-6 [&>*]:sm:px-[${f.viewportOffset}] my-4 sm:my-6 my-[${f.mobileViewportOffset ?? f.viewportOffset}] sm:my-[${f.viewportOffset}]`,
923
- `${S(se) ? `sm:w-[${S(se)}px]` : "sm:max-w-sm"}`,
924
- `${n.value == "top-right" ? "right-0 top-0" : ""}`,
925
- `${n.value == "top-left" ? "left-0 top-0" : ""}`,
926
- `${n.value == "top-center" ? "left-1/2 -translate-x-1/2 top-0" : ""}`,
927
- `${n.value == "bottom-right" ? "right-0 bottom-0" : ""}`,
928
- `${n.value == "bottom-left" ? "left-0 bottom-0" : ""}`,
929
- `${n.value == "bottom-center" ? "left-1/2 -translate-x-1/2 bottom-0" : ""}`
930
- ]),
931
- onMouseenter: h[0] || (h[0] = (w) => o.value = !0),
932
- onMouseleave: h[1] || (h[1] = (w) => o.value = !1)
933
- }, [
934
- (B(!0), L(xe, null, Ie(e.value, (w, p) => (B(), ee(Ue, Ce({ ref_for: !0 }, w, {
935
- key: w.id,
936
- stack: () => {
937
- v();
938
- },
939
- toastCount: e.value.length,
940
- position: n.value,
941
- expanded: a.value,
942
- index: p,
943
- maxVisibleToasts: f.maxVisibleToasts,
944
- onClose: b
945
- }), null, 16, ["stack", "toastCount", "position", "expanded", "index", "maxVisibleToasts"]))), 128))
946
- ], 34)
947
- ]));
948
- }
949
- }), qe = {
950
- stringInsensitive: (l, t) => oe(l).localeCompare(oe(t)),
951
- date: (l, t) => new Date(l).getTime() - new Date(t).getTime(),
952
- number: (l, t) => parseFloat(l) - parseFloat(t)
575
+ function Ee() {
576
+ return { isOpen: L, isAnimating: E, animationTime: Y, props: R, component: H, open: de, close: me };
577
+ }
578
+ function Ae(i, e) {
579
+ if (!i) return !1;
580
+ let t = ["INPUT", "TEXTAREA", "SELECT"];
581
+ return (e === " " || e === "Enter") && (t = [...t, "BUTTON"]), t.includes(i.tagName);
582
+ }
583
+ const Me = 3, Be = "24px", xe = "16px", Ce = 0, ke = 3e3, Fe = 16, Le = 45, Ye = 10, Ne = 0.06, $e = 16, he = {
584
+ stringInsensitive: (i, e) => V(i).localeCompare(V(e)),
585
+ date: (i, e) => new Date(i).getTime() - new Date(e).getTime(),
586
+ number: (i, e) => parseFloat(i) - parseFloat(e)
953
587
  };
954
- function oe(l) {
955
- return String(l ?? "").toLowerCase().replace(/\s+/g, " ").trim();
588
+ function V(i) {
589
+ return String(i ?? "").toLowerCase().replace(/\s+/g, " ").trim();
956
590
  }
957
- function rt(l, t = 1, s = ["date", "date_released"]) {
958
- return (e, n) => {
959
- const i = e[l], o = n[l];
960
- if (i instanceof Date && o instanceof Date || s.includes(String(l))) {
961
- const m = new Date(String(i));
962
- return (new Date(String(o)).getTime() - m.getTime()) * t;
591
+ function _e(i, e = 1, t = ["date", "date_released"]) {
592
+ return (o, n) => {
593
+ const s = o[i], a = n[i];
594
+ if (s instanceof Date && a instanceof Date || t.includes(String(i))) {
595
+ const f = new Date(String(s));
596
+ return (new Date(String(a)).getTime() - f.getTime()) * e;
963
597
  }
964
- const a = parseFloat(i), c = parseFloat(o);
965
- return !isNaN(a) && !isNaN(c) ? (a - c) * t : String(i).toLowerCase().replace(/\s+/g, " ").localeCompare(String(o).toLowerCase().replace(/\s+/g, " ")) * t;
598
+ const l = parseFloat(s), r = parseFloat(a);
599
+ return !isNaN(l) && !isNaN(r) ? (l - r) * e : String(s).toLowerCase().replace(/\s+/g, " ").localeCompare(String(a).toLowerCase().replace(/\s+/g, " ")) * e;
966
600
  };
967
601
  }
968
- function ut(l, t = 1) {
969
- return (s, e) => {
970
- for (const { key: n, compareFn: i } of l) {
971
- const o = n ? s[n] ?? "" : void 0, a = n ? e[n] ?? "" : void 0;
972
- let c;
973
- if (i ? c = n ? i(o, a) : i(s, e) : c = We(o, a), c !== 0) return c * t;
602
+ function Ke(i, e = 1) {
603
+ return (t, o) => {
604
+ for (const { key: n, compareFn: s } of i) {
605
+ const a = n ? t[n] ?? "" : void 0, l = n ? o[n] ?? "" : void 0;
606
+ let r;
607
+ if (s ? r = n ? s(a, l) : s(t, o) : r = ve(a, l), r !== 0) return r * e;
974
608
  }
975
609
  return 0;
976
610
  };
977
611
  }
978
- function We(l, t) {
979
- const s = parseFloat(l), e = parseFloat(t);
980
- if (!isNaN(s) && !isNaN(e))
981
- return s - e;
982
- const n = new Date(l), i = new Date(t);
983
- return !isNaN(n.getTime()) && !isNaN(i.getTime()) ? n.getTime() - i.getTime() : qe.stringInsensitive(l, t);
612
+ function ve(i, e) {
613
+ const t = parseFloat(i), o = parseFloat(e);
614
+ if (!isNaN(t) && !isNaN(o))
615
+ return t - o;
616
+ const n = new Date(i), s = new Date(e);
617
+ return !isNaN(n.getTime()) && !isNaN(s.getTime()) ? n.getTime() - s.getTime() : he.stringInsensitive(i, e);
984
618
  }
985
619
  export {
986
- qe as CompareStrategies,
987
- Ye as DEFAULT_GAP,
988
- $e as MOBILE_VIEWPORT_OFFSET,
989
- le as SCALE_STEP,
990
- Ve as SWIPE_THRESHOLD,
991
- ne as TOAST_LIFE,
992
- se as TOAST_WIDTH,
993
- at as ToastController,
994
- k as ToastState,
995
- Le as VIEWPORT_OFFSET,
996
- fe as VISIBLE_TOASTS_AMOUNT,
997
- q as Y_OFFSET_STEP,
998
- ie as Z_STEP,
999
- lt as createModalCore,
1000
- ot as isInputLikeElement,
1001
- rt as sortObject,
1002
- ut as sortObjectNew,
1003
- Oe as toast,
1004
- et as useClipboard,
1005
- Ge as useDatePicker,
1006
- it as useForm,
1007
- st as useModal,
1008
- Qe as useMultiSelect,
1009
- tt as useSelect,
1010
- ke as useSwipeHandler,
1011
- nt as useTable,
1012
- Ae as useToastTimer
620
+ he as CompareStrategies,
621
+ Fe as DEFAULT_GAP,
622
+ xe as MOBILE_VIEWPORT_OFFSET,
623
+ Ne as SCALE_STEP,
624
+ Le as SWIPE_THRESHOLD,
625
+ ke as TOAST_LIFE,
626
+ Ce as TOAST_WIDTH,
627
+ D as ToastState,
628
+ Be as VIEWPORT_OFFSET,
629
+ Me as VISIBLE_TOASTS_AMOUNT,
630
+ $e as Y_OFFSET_STEP,
631
+ Ye as Z_STEP,
632
+ Ae as isInputLikeElement,
633
+ _e as sortObject,
634
+ Ke as sortObjectNew,
635
+ oe as toast,
636
+ ye as useClipboard,
637
+ be as useDatePicker,
638
+ Se as useForm,
639
+ Te as useModal,
640
+ Ee as useModalCore,
641
+ ge as useMultiSelect,
642
+ Ie as useSelect,
643
+ Pe as useSwipeHandler,
644
+ De as useTable,
645
+ Oe as useToastTimer
1013
646
  };