@base-framework/ui 1.1.14 → 1.1.16

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.
Files changed (35) hide show
  1. package/README.md +44 -0
  2. package/dist/atoms.es.js +37 -34
  3. package/dist/buttons-HW55zbqy.js +127 -0
  4. package/dist/{empty-state-CuciIYY7.js → empty-state-5g6Pdeeg.js} +324 -321
  5. package/dist/full-page-DccgwWsM.js +69 -0
  6. package/dist/icons.es.js +127 -1
  7. package/dist/image-BhZbKYDj.js +237 -0
  8. package/dist/index.es.js +179 -173
  9. package/dist/{mobile-nav-wrapper-C3Lvz7CH.js → mobile-nav-wrapper-DmrkMxyd.js} +77 -84
  10. package/dist/molecules.es.js +5 -5
  11. package/dist/organisms.es.js +52 -51
  12. package/dist/pages.es.js +10 -9
  13. package/dist/sidebar-menu-C5s4Cogh.js +13 -0
  14. package/dist/sidebar-menu-page-DwqCqwzG.js +153 -0
  15. package/dist/signature-panel-CDQgFxuo.js +1364 -0
  16. package/dist/simple-search-input-mCUOwYbp.js +1654 -0
  17. package/dist/skeleton-BlY3opxG.js +7 -0
  18. package/dist/{tooltip-BlFbB8yL.js → tooltip-BmvjA9XQ.js} +104 -84
  19. package/dist/types/components/atoms/atoms.d.ts +2 -0
  20. package/dist/types/components/atoms/material-icon.d.ts +17 -0
  21. package/dist/types/components/atoms/universal-icon.d.ts +3 -0
  22. package/dist/types/components/icons/icons.d.ts +1 -0
  23. package/dist/types/components/icons/material-symbols.d.ts +19 -0
  24. package/dist/types/components/molecules/breadcrumb/breadcrumb.d.ts +2 -2
  25. package/dist/types/components/molecules/image/image-uploader.d.ts +2 -2
  26. package/dist/types/components/molecules/image/logo-uploader.d.ts +2 -2
  27. package/dist/types/components/organisms/navigation/mobile/nav-wrapper/title-header.d.ts +1 -1
  28. package/package.json +1 -1
  29. package/dist/buttons-Dr-bViom.js +0 -77
  30. package/dist/form-group-BB7dLJir.js +0 -29
  31. package/dist/image-BB__4s0g.js +0 -31
  32. package/dist/inputs-CcimrM1k.js +0 -210
  33. package/dist/range-calendar-CzKIBhgb.js +0 -831
  34. package/dist/sidebar-menu-page-BtuUB_XB.js +0 -217
  35. package/dist/signature-panel-DmyPbuRi.js +0 -2186
@@ -0,0 +1,1654 @@
1
+ import { Div as r, Span as N, Button as K, OnState as J, On as $, Th as G, UseParent as et, I as st, Thead as at, Tr as nt, Table as j, P as O, Li as X, Time as ot, Ul as rt, Input as lt } from "@base-framework/atoms";
2
+ import { Component as R, Data as P, Atom as m, DateTime as H, DataTracker as _, Jot as it } from "@base-framework/base";
3
+ import { B as y, U as q } from "./buttons-HW55zbqy.js";
4
+ import { Icons as S } from "./icons.es.js";
5
+ import { TableBody as ct, DataTableBody as dt, ScrollableTableBody as ht, List as ut } from "@base-framework/organisms";
6
+ import { I as ft, C as mt, c as gt } from "./image-BhZbKYDj.js";
7
+ const yt = (t, e) => {
8
+ const s = t ? t.getBoundingClientRect() : { top: 0, bottom: 0, left: 0 }, a = e.getBoundingClientRect(), n = 10, o = globalThis.scrollX, c = globalThis.scrollY;
9
+ let l = s.left + o, u = s.bottom + c;
10
+ const f = globalThis.innerHeight - s.bottom, g = s.top;
11
+ return l + a.width > globalThis.innerWidth && (l = globalThis.innerWidth - a.width - n), f < a.height && g > f ? u = s.top + c - a.height - n : f < a.height && (u = s.bottom + c - (a.height - f) - n), { x: l, y: u };
12
+ };
13
+ class wt extends R {
14
+ /**
15
+ * This will set up the data.
16
+ *
17
+ * @returns {object}
18
+ */
19
+ setData() {
20
+ const e = this.parent.data || new P();
21
+ return e.set({
22
+ position: { x: 0, y: 0 }
23
+ }), e;
24
+ }
25
+ /**
26
+ * This will get the class size.
27
+ *
28
+ * @returns {string}
29
+ */
30
+ getSize() {
31
+ switch (this.size || "lg") {
32
+ // @ts-ignore
33
+ case "sm":
34
+ return "w-48";
35
+ // @ts-ignore
36
+ case "md":
37
+ return "w-64";
38
+ case "lg":
39
+ return "w-[250px]";
40
+ // @ts-ignore
41
+ case "xl":
42
+ return "w-96";
43
+ // @ts-ignore
44
+ case "2xl":
45
+ return "w-[400px]";
46
+ // @ts-ignore
47
+ case "fit":
48
+ return "w-fit";
49
+ // @ts-ignore
50
+ case "full":
51
+ return "w-full";
52
+ }
53
+ }
54
+ /**
55
+ * This will render the modal component.
56
+ *
57
+ * @returns {object}
58
+ */
59
+ render() {
60
+ const e = this.getSize();
61
+ return r({
62
+ class: `absolute inset-auto fadeIn mt-2 rounded-md p-0 shadow-lg bg-popover min-h-12 backdrop:bg-transparent text-inherit r z-30 ${e}`,
63
+ popover: "manual",
64
+ toggle: (s, { state: a }) => s.newState === "closed" ? a.open = !1 : null,
65
+ style: "top: [[position.y]]px; left: [[position.x]]px"
66
+ // @ts-ignore
67
+ }, this.children);
68
+ }
69
+ /**
70
+ * This will setup the states.
71
+ *
72
+ * @returns {object}
73
+ */
74
+ setupStates() {
75
+ return {
76
+ open: {
77
+ id: this.parent.getId(),
78
+ callBack: (a) => {
79
+ this.state.open === !1 && this.destroy();
80
+ }
81
+ }
82
+ };
83
+ }
84
+ /**
85
+ * Updates the dropdown position.
86
+ *
87
+ * @returns {void}
88
+ */
89
+ updatePosition() {
90
+ const e = this.button ?? null, s = this.panel, a = yt(e, s);
91
+ this.data.position = a;
92
+ }
93
+ /**
94
+ * This will run after the setup.
95
+ *
96
+ * @returns {void}
97
+ */
98
+ afterSetup() {
99
+ this.panel.showPopover(), this.updatePosition();
100
+ }
101
+ /**
102
+ * This will check if the element clicked was in the
103
+ * component of the button.
104
+ *
105
+ * @param {object} element
106
+ * @returns {boolean}
107
+ */
108
+ isOutsideClick(e) {
109
+ return !this.panel.contains(e) && this.button && !this.button.contains(e);
110
+ }
111
+ /**
112
+ * This will set up the events.
113
+ *
114
+ * @returns {array}
115
+ */
116
+ setupEvents() {
117
+ return [
118
+ ["click", document, (e) => {
119
+ this.isOutsideClick(e.target) && (this.state.open = !1);
120
+ }],
121
+ ["resize", globalThis, (e) => this.updatePosition()],
122
+ ["scroll", document, (e) => this.updatePosition()]
123
+ ];
124
+ }
125
+ /**
126
+ * This will override the set up to use the app shell.
127
+ *
128
+ * @param {object} container
129
+ */
130
+ setContainer(e) {
131
+ this.container = app.root;
132
+ }
133
+ /**
134
+ * This will hide the popover before destroying.
135
+ *
136
+ * @returns {void}
137
+ */
138
+ beforeDestroy() {
139
+ this.panel.hidePopover();
140
+ }
141
+ }
142
+ const xt = m(({ src: t, alt: e }) => !t || t.indexOf(".") === -1 && t.indexOf("[[") === -1 ? null : ft({
143
+ src: t,
144
+ alt: e,
145
+ class: "rounded-full"
146
+ })), bt = (t) => t && (Array.isArray(t) && (t = t.join(" ")), typeof t != "string" && (t = String(t)), t.split(" ").map((e) => e.charAt(0)).join("").toUpperCase()), V = (t) => !t || t.length < 2 ? t : bt(t), Dt = (t) => N([t, (e, s) => {
147
+ s.textContent = V(e);
148
+ }]), L = {
149
+ xs: "h-6 w-6",
150
+ sm: "h-8 w-8",
151
+ md: "h-12 w-12",
152
+ lg: "h-16 w-16",
153
+ xl: "h-24 w-24",
154
+ "2xl": "h-32 w-32",
155
+ "3xl": "h-48 w-48",
156
+ "4xl": "h-64 w-64",
157
+ default: "h-12 w-12"
158
+ }, U = {
159
+ xs: "text-[7px]",
160
+ sm: "text-xs",
161
+ md: "text-base",
162
+ lg: "text-xl",
163
+ xl: "text-2xl",
164
+ "2xl": "text-3xl",
165
+ "3xl": "text-4xl",
166
+ "4xl": "text-5xl",
167
+ default: "text-base"
168
+ }, pt = (t) => L[t] || L.default, vt = (t) => U[t] || U.default, kt = (t, e = null, s = "md") => {
169
+ const a = V(t), n = vt(s);
170
+ return r(
171
+ {
172
+ class: `
173
+ flex items-center justify-center w-full h-full rounded-full
174
+ bg-muted text-muted-foreground font-medium
175
+ ${n}
176
+ `
177
+ },
178
+ [
179
+ e ? Dt(e) : N({ class: "uppercase" }, a)
180
+ ]
181
+ );
182
+ }, St = m(({ src: t, alt: e, fallbackText: s, watcherFallback: a, size: n }) => {
183
+ const o = pt(n);
184
+ return r(
185
+ {
186
+ class: `relative flex items-center justify-center ${o}`
187
+ },
188
+ [
189
+ xt({ src: t, alt: e }),
190
+ kt(s, a, n)
191
+ ]
192
+ );
193
+ }), Ct = ({ currentMonth: t, currentYear: e, onSelect: s }) => r(
194
+ { class: "grid grid-cols-3 gap-2" },
195
+ H.monthNames.map(
196
+ (a, n) => y(
197
+ {
198
+ click: (o) => {
199
+ o.preventDefault(), o.stopPropagation(), s(n);
200
+ },
201
+ variant: t === n ? "primary" : "ghost",
202
+ "aria-label": `Select ${a} ${e}`
203
+ },
204
+ a.substring(0, 3)
205
+ )
206
+ )
207
+ ), b = (t) => (t *= 1, t < 10 ? `0${t}` : String(t)), Mt = (t) => (t.indexOf("T") === -1 && t.indexOf(" ") === -1 && (t += "T00:00:01"), t.replace(" ", "T"), t), p = (t, e, s) => `${t}-${b(e + 1)}-${b(s)}`, It = (t) => t ? "bg-accent text-primary" : "", Tt = (t) => t ? "text-muted-foreground opacity-50" : "", $t = (t, e) => t === e, Ot = (t, e) => $t(t, e) ? "bg-primary text-primary-foreground" : "", Rt = (t, e, s, a) => {
208
+ const n = Ot(e, a);
209
+ return n || (t ? It(t) : s ? Tt(s) : "text-foreground");
210
+ }, Y = (t) => {
211
+ const {
212
+ day: e,
213
+ currentDate: s,
214
+ date: a,
215
+ isToday: n,
216
+ isOutsideMonth: o,
217
+ select: c,
218
+ disabled: l
219
+ } = t;
220
+ return K(
221
+ {
222
+ class: `
223
+ flex items-center justify-center h-9 w-auto p-0 font-normal text-sm rounded-md cursor-pointer
224
+ ${Rt(n, s, o, a)}
225
+ hover:bg-muted/50 hover:text-muted-foreground focus:z-10
226
+ disabled:pointer-events-none disabled:opacity-50
227
+ `,
228
+ disabled: l || e === null,
229
+ "aria-label": e ? `Day ${e}` : null,
230
+ // Only call select if it's not disabled.
231
+ click: () => !l && c(a)
232
+ },
233
+ e.toString()
234
+ );
235
+ }, z = (t, e, s, a) => t === a.date && e === a.month && s === a.year, Pt = (t, e, s, a = !1) => {
236
+ const { year: n, month: o } = t, c = p(n, o, t.date), l = new Date(n, o, 1).getDay(), u = new Date(n, o + 1, 0).getDate(), f = new Date(n, o, 0).getDate(), g = [], C = o === 0 ? 11 : o - 1, v = o === 0 ? n - 1 : n;
237
+ for (let i = l - 1; i >= 0; i--) {
238
+ const h = f - i, w = z(h, C, v, e), x = new Date(v, C, h) < new Date(e.year, e.month, e.date), D = a && x;
239
+ g.push(
240
+ Y({
241
+ day: h,
242
+ currentDate: c,
243
+ date: p(v, C, h),
244
+ isToday: w,
245
+ isOutsideMonth: !0,
246
+ select: s,
247
+ disabled: D
248
+ })
249
+ );
250
+ }
251
+ for (let i = 1; i <= u; i++) {
252
+ const h = z(i, o, n, e), w = new Date(n, o, i) < new Date(e.year, e.month, e.date), x = a && w;
253
+ g.push(
254
+ Y({
255
+ day: i,
256
+ currentDate: c,
257
+ date: p(n, o, i),
258
+ isToday: h,
259
+ isOutsideMonth: !1,
260
+ select: s,
261
+ disabled: x
262
+ })
263
+ );
264
+ }
265
+ const k = o === 11 ? 0 : o + 1, B = o === 11 ? n + 1 : n, d = (7 - g.length % 7) % 7;
266
+ for (let i = 1; i <= d; i++) {
267
+ const h = z(i, k, B, e), w = new Date(B, k, i) < new Date(e.year, e.month, e.date), x = a && w;
268
+ g.push(
269
+ Y({
270
+ day: i,
271
+ currentDate: c,
272
+ date: p(B, k, i),
273
+ isToday: h,
274
+ isOutsideMonth: !0,
275
+ select: s,
276
+ disabled: x
277
+ })
278
+ );
279
+ }
280
+ return g;
281
+ }, E = ({ label: t, click: e }) => y(
282
+ {
283
+ class: `
284
+ inline-flex items-center justify-center h-7 w-7 bg-transparent p-0
285
+ opacity-50 hover:opacity-100 text-muted-foreground absolute
286
+ ${t === "Previous" ? "left-1" : "right-1"}
287
+ focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2
288
+ `,
289
+ click: e,
290
+ "aria-label": `${t} month`,
291
+ variant: "icon",
292
+ icon: t === "Previous" ? S.chevron.single.left : S.chevron.single.right
293
+ }
294
+ ), Bt = ({ onMonthClick: t, onYearClick: e, next: s, previous: a }) => r({ class: "flex items-center justify-center gap-x-2 relative min-h-12 text-sm font-medium" }, [
295
+ y({ click: t, variant: "ghost", "aria-label": "Select month" }, "[[monthName]]"),
296
+ y({ click: e, variant: "ghost", "aria-label": "Select year" }, "[[current.year]]"),
297
+ E({ label: "Previous", click: a }),
298
+ E({ label: "Next", click: s })
299
+ ]), Nt = (t) => r(
300
+ { class: "flex items-center justify-center h-9 w-auto text-[0.8rem] font-normal text-muted-foreground" },
301
+ t
302
+ ), Ht = () => ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"].map(Nt), Yt = (t) => r({ class: "rdp flex flex-auto flex-col w-full gap-y-1" }, [
303
+ Bt({
304
+ onMonthClick: t.onMonthClick,
305
+ onYearClick: t.onYearClick,
306
+ next: t.next,
307
+ previous: t.previous
308
+ }),
309
+ r({
310
+ class: "flex flex-auto flex-col w-full",
311
+ onSet: [
312
+ "currentDate",
313
+ () => [
314
+ r({ class: "grid grid-cols-7" }, Ht()),
315
+ r(
316
+ { class: "grid grid-cols-7" },
317
+ Pt(
318
+ t.current,
319
+ t.today,
320
+ t.select,
321
+ t.blockPriorDates
322
+ )
323
+ )
324
+ ]
325
+ ]
326
+ })
327
+ ]), zt = ({ currentMonth: t, currentYear: e, onSelect: s }) => {
328
+ const a = e - 50, n = Array.from({ length: 101 }, (o, c) => a + c);
329
+ return r(
330
+ { class: "grid grid-cols-4 gap-2 overflow-y-auto max-h-72" },
331
+ n.map(
332
+ (o) => y(
333
+ {
334
+ click: (c) => {
335
+ c.preventDefault(), c.stopPropagation(), s(o);
336
+ },
337
+ variant: o === e ? "primary" : "ghost",
338
+ "aria-label": `Select ${o}`
339
+ },
340
+ o.toString()
341
+ )
342
+ )
343
+ );
344
+ };
345
+ class De extends R {
346
+ /**
347
+ * This will declare the props for the compiler.
348
+ *
349
+ * @returns {void}
350
+ */
351
+ declareProps() {
352
+ this.selectedDate = null, this.selectedCallBack = null, this.blockPriorDates = !1;
353
+ }
354
+ /**
355
+ * This will get the selected data.
356
+ *
357
+ * @param {object} today
358
+ * @returns {Date}
359
+ */
360
+ getSelectedDate(e) {
361
+ const s = this.selectedDate ? new Date(Mt(this.selectedDate)) : e;
362
+ return new Date(s.getFullYear(), s.getMonth(), s.getDate());
363
+ }
364
+ /**
365
+ * This will set up the data for the calendar.
366
+ *
367
+ * @returns {Data}
368
+ */
369
+ setData() {
370
+ const e = /* @__PURE__ */ new Date(), s = this.getSelectedDate(e), a = s.getMonth();
371
+ return new P({
372
+ monthName: this.getMonthName(a),
373
+ currentDate: `${s.getFullYear()}-${a + 1}-${s.getDate()}`,
374
+ current: {
375
+ date: s.getDate(),
376
+ year: s.getFullYear(),
377
+ month: a
378
+ },
379
+ today: {
380
+ date: e.getDate(),
381
+ month: e.getMonth(),
382
+ year: e.getFullYear()
383
+ }
384
+ });
385
+ }
386
+ /**
387
+ * This will set up the states for the calendar.
388
+ *
389
+ * @return {object}
390
+ */
391
+ setupStates() {
392
+ return {
393
+ view: "calendar"
394
+ // 'calendar' | 'months' | 'years'
395
+ };
396
+ }
397
+ /**
398
+ * This will get the name of the month.
399
+ *
400
+ * @param {number} month
401
+ * @returns {string}
402
+ */
403
+ getMonthName(e) {
404
+ return H.monthNames[e];
405
+ }
406
+ /**
407
+ * This will go to the previous month.
408
+ *
409
+ * @returns {void}
410
+ */
411
+ goToPreviousMonth() {
412
+ const e = this.data;
413
+ let s = e.current.month, a = e.current.year;
414
+ s === 0 ? (s = 11, a--) : s--, this.setCurrentDate(s, a);
415
+ }
416
+ /**
417
+ * This will go to the next month.
418
+ *
419
+ * @returns {void}
420
+ */
421
+ goToNextMonth() {
422
+ const e = this.data;
423
+ let s = e.current.month, a = e.current.year;
424
+ s === 11 ? (s = 0, a++) : s++, this.setCurrentDate(s, a);
425
+ }
426
+ /**
427
+ * This will set the current month and year.
428
+ *
429
+ * @param {number} month
430
+ * @param {number} year
431
+ * @param {number} [date=null]
432
+ * @returns {void}
433
+ */
434
+ setCurrentDate(e, s, a = null) {
435
+ const n = this.data;
436
+ n.current.month = e, n.current.year = s, typeof a == "number" && (n.current.date = b(a)), n.currentDate = `${s}-${b(e + 1)}-${n.current.date}`, n.monthName = this.getMonthName(e);
437
+ }
438
+ /**
439
+ * This will select a date.
440
+ *
441
+ * @param {string} date
442
+ * @returns {void}
443
+ */
444
+ selectDate(e) {
445
+ const s = /* @__PURE__ */ new Date(e + "T00:00:00");
446
+ this.setCurrentDate(s.getMonth(), s.getFullYear(), s.getDate()), typeof this.selectedCallBack == "function" && this.selectedCallBack(this.data.currentDate);
447
+ }
448
+ /**
449
+ * This will render the calendar.
450
+ *
451
+ * @returns {object}
452
+ */
453
+ render() {
454
+ return r({ class: "calendar-container p-3 rounded-md border min-w-80" }, [
455
+ J("view", (e) => {
456
+ switch (e) {
457
+ case "months":
458
+ return Ct(
459
+ {
460
+ currentMonth: this.data.current.month,
461
+ currentYear: this.data.current.year,
462
+ onSelect: (s) => {
463
+ this.setCurrentDate(s, this.data.current.year), this.state.view = "calendar";
464
+ }
465
+ }
466
+ );
467
+ case "years":
468
+ return zt(
469
+ {
470
+ currentMonth: this.data.current.month,
471
+ currentYear: this.data.current.year,
472
+ onSelect: (s) => {
473
+ this.setCurrentDate(this.data.current.month, s), this.state.view = "calendar";
474
+ }
475
+ }
476
+ );
477
+ default:
478
+ return Yt({
479
+ current: this.data.current,
480
+ today: this.data.today,
481
+ select: (s) => this.selectDate(s),
482
+ next: () => this.goToNextMonth(),
483
+ previous: () => this.goToPreviousMonth(),
484
+ blockPriorDates: this.blockPriorDates || !1,
485
+ onMonthClick: (s) => {
486
+ s.preventDefault(), s.stopPropagation(), this.state.view = "months";
487
+ },
488
+ onYearClick: (s) => {
489
+ s.preventDefault(), s.stopPropagation(), this.state.view = "years";
490
+ }
491
+ });
492
+ }
493
+ })
494
+ ]);
495
+ }
496
+ }
497
+ const W = ({ label: t, click: e }) => y(
498
+ {
499
+ class: `
500
+ inline-flex items-center justify-center h-7 w-7 bg-transparent p-0
501
+ opacity-50 hover:opacity-100 text-muted-foreground absolute
502
+ ${t === "Previous" ? "left-1" : "right-1"}
503
+ focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2
504
+ `,
505
+ click: e,
506
+ "aria-label": `${t} month`,
507
+ variant: "icon",
508
+ icon: t === "Previous" ? S.chevron.single.left : S.chevron.single.right
509
+ }
510
+ ), jt = ({ onMonthClick: t, onYearClick: e, next: s, previous: a }) => r({ class: "flex items-center justify-center gap-x-2 relative min-h-12 text-sm font-medium" }, [
511
+ y({ click: t, variant: "ghost", "aria-label": "Select month" }, "[[monthName]]"),
512
+ y({ click: e, variant: "ghost", "aria-label": "Select year" }, "[[current.year]]"),
513
+ W({ label: "Previous", click: a }),
514
+ W({ label: "Next", click: s })
515
+ ]), At = (t) => r({ class: "h-9 flex items-center justify-center font-medium" }, t), Ft = () => r(
516
+ { class: "grid grid-cols-7 gap-1 text-center text-xs font-medium text-muted-foreground mb-2" },
517
+ ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"].map(At)
518
+ ), Lt = ({ day: t, iso: e, disabled: s, isStart: a, isEnd: n, isBetween: o, isOtherMonth: c, click: l }) => {
519
+ let u = "ghost", f = "";
520
+ return a || n ? (u = "default", f = "bg-primary text-primary-foreground hover:bg-primary/90") : o && (f = "bg-accent text-accent-foreground hover:bg-accent/80"), s && (f += " opacity-50 cursor-not-allowed"), c && (f += " text-muted-foreground opacity-50"), y(
521
+ {
522
+ class: `flex items-center justify-center p-0 text-sm font-medium rounded-md transition-colors ${f}`,
523
+ variant: u,
524
+ disabled: s,
525
+ click: (g) => {
526
+ g.preventDefault(), g.stopPropagation(), s || l();
527
+ }
528
+ },
529
+ t.toString()
530
+ );
531
+ }, Ut = ({ today: t, current: e, blockPriorDates: s, onDateClick: a }) => {
532
+ const { start: n, end: o } = e, c = new Date(e.year, e.month, 1).getDay(), l = new Date(e.year, e.month + 1, 0).getDate(), u = [], f = e.month === 0 ? 11 : e.month - 1, g = e.month === 0 ? e.year - 1 : e.year, C = new Date(g, f + 1, 0).getDate(), v = e.month === 11 ? 0 : e.month + 1, k = e.month === 11 ? e.year + 1 : e.year;
533
+ for (let d = c - 1; d >= 0; d--) {
534
+ const i = C - d, h = p(g, f, i), w = new Date(g, f, i), x = new Date(t.year, t.month, t.date), D = w < x, M = s && D, I = n === h, T = o === h, tt = n && o && h > n && h < o;
535
+ u.push({
536
+ day: i,
537
+ iso: h,
538
+ disabled: M,
539
+ isStart: I,
540
+ isEnd: T,
541
+ isBetween: tt,
542
+ isOtherMonth: !0,
543
+ click: () => a(h)
544
+ });
545
+ }
546
+ for (let d = 1; d <= l; d++) {
547
+ const i = p(e.year, e.month, d), h = new Date(e.year, e.month, d), w = new Date(t.year, t.month, t.date), x = h < w, D = s && x, M = n === i, I = o === i, T = n && o && i > n && i < o;
548
+ u.push({
549
+ day: d,
550
+ iso: i,
551
+ disabled: D,
552
+ isStart: M,
553
+ isEnd: I,
554
+ isBetween: T,
555
+ isOtherMonth: !1,
556
+ click: () => {
557
+ a(i);
558
+ }
559
+ });
560
+ }
561
+ const F = (7 - u.length % 7) % 7;
562
+ for (let d = 1; d <= F; d++) {
563
+ const i = p(k, v, d), h = new Date(k, v, d), w = new Date(t.year, t.month, t.date), x = h < w, D = s && x, M = n === i, I = o === i, T = n && o && i > n && i < o;
564
+ u.push({
565
+ day: d,
566
+ iso: i,
567
+ disabled: D,
568
+ isStart: M,
569
+ isEnd: I,
570
+ isBetween: T,
571
+ isOtherMonth: !0,
572
+ click: () => a(i)
573
+ });
574
+ }
575
+ return r(
576
+ { class: "grid grid-cols-7 gap-1" },
577
+ u.map(
578
+ (d, i) => Lt({
579
+ day: d.day,
580
+ iso: d.iso,
581
+ disabled: d.disabled,
582
+ isStart: d.isStart,
583
+ isEnd: d.isEnd,
584
+ isBetween: d.isBetween,
585
+ isOtherMonth: d.isOtherMonth,
586
+ click: d.click
587
+ })
588
+ )
589
+ );
590
+ }, Et = m((t, e) => r({ class: "flex flex-auto flex-col" }, [
591
+ jt({
592
+ onMonthClick: t.onMonthClick,
593
+ onYearClick: t.onYearClick,
594
+ next: t.next,
595
+ previous: t.previous
596
+ }),
597
+ r({
598
+ class: "flex flex-auto flex-col w-full",
599
+ onSet: [
600
+ "currentDate",
601
+ () => [
602
+ Ft(),
603
+ Ut({
604
+ today: t.today,
605
+ current: t.current,
606
+ blockPriorDates: t.blockPriorDates,
607
+ onDateClick: t.onDateClick
608
+ })
609
+ ]
610
+ ]
611
+ })
612
+ ])), Wt = ({ currentMonth: t, currentYear: e, onSelect: s }) => r(
613
+ { class: "grid grid-cols-3 gap-2" },
614
+ H.monthNames.map(
615
+ (a, n) => y(
616
+ {
617
+ click: (o) => {
618
+ o.preventDefault(), o.stopPropagation(), s(n);
619
+ },
620
+ variant: t === n ? "primary" : "ghost",
621
+ "aria-label": `Select ${a} ${e}`
622
+ },
623
+ a.substring(0, 3)
624
+ )
625
+ )
626
+ ), Qt = ({ start: t, end: e, selecting: s, onSelectStart: a, onSelectEnd: n }) => r({ class: "flex gap-x-2 mb-4" }, [
627
+ $("selecting", (o) => y({
628
+ click: a,
629
+ variant: o === "start" ? "primary" : "outline",
630
+ class: "flex-1"
631
+ }, [
632
+ r({ class: "font-medium" }, Q("current.start", "Start Date"))
633
+ ])),
634
+ $("selecting", (o) => y({
635
+ click: n,
636
+ variant: o === "end" ? "primary" : "outline",
637
+ class: "flex-1"
638
+ }, [
639
+ r({ class: "font-medium" }, Q("current.end", "End Date"))
640
+ ]))
641
+ ]), Q = (t, e) => [`[[${t}]]`, (s) => s == null ? e : Kt(s)], Kt = (t) => {
642
+ const e = /* @__PURE__ */ new Date(t + "T00:00:00"), s = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], a = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
643
+ return `${s[e.getDay()]}, ${e.getDate()} ${a[e.getMonth()]}`;
644
+ }, Jt = ({ currentYear: t, onSelect: e }) => {
645
+ const s = t - 50, a = Array.from({ length: 101 }, (n, o) => s + o);
646
+ return r(
647
+ { class: "grid grid-cols-4 gap-2 overflow-y-auto max-h-72" },
648
+ a.map(
649
+ (n) => y(
650
+ {
651
+ click: (o) => {
652
+ o.preventDefault(), o.stopPropagation(), e(n);
653
+ },
654
+ variant: n === t ? "primary" : "ghost",
655
+ "aria-label": `Select ${n}`
656
+ },
657
+ n.toString()
658
+ )
659
+ )
660
+ );
661
+ };
662
+ class pe extends R {
663
+ /**
664
+ * Declare compiler props.
665
+ *
666
+ * @returns {void}
667
+ */
668
+ declareProps() {
669
+ this.startDate = null, this.endDate = null, this.onRangeSelect = null, this.blockPriorDates = !1;
670
+ }
671
+ /**
672
+ * Initialize reactive data for today and current view.
673
+ *
674
+ * @returns {Data}
675
+ */
676
+ setData() {
677
+ const e = /* @__PURE__ */ new Date(), s = this.startDate ? /* @__PURE__ */ new Date(this.startDate + "T00:00:00") : e, a = s.getMonth(), n = s.getFullYear();
678
+ return new P({
679
+ today: {
680
+ date: e.getDate(),
681
+ month: e.getMonth(),
682
+ year: e.getFullYear()
683
+ },
684
+ monthName: this.getMonthName(a),
685
+ currentData: `${s.getFullYear()}-${b(s.getMonth() + 1)}-${b(s.getDate())}`,
686
+ current: {
687
+ date: e.getDate(),
688
+ month: a,
689
+ year: n,
690
+ start: this.startDate,
691
+ end: this.endDate
692
+ },
693
+ selecting: "start"
694
+ });
695
+ }
696
+ /**
697
+ * This will get the name of the month.
698
+ *
699
+ * @param {number} month
700
+ * @returns {string}
701
+ */
702
+ getMonthName(e) {
703
+ return H.monthNames[e];
704
+ }
705
+ /**
706
+ * Initialize component state.
707
+ *
708
+ * @returns {{view:string}}
709
+ */
710
+ setupStates() {
711
+ return {
712
+ view: "calendar"
713
+ // 'calendar', 'months', or 'years'
714
+ };
715
+ }
716
+ /**
717
+ * Handle a date cell click.
718
+ *
719
+ * @param {string} isoDate
720
+ * @returns {void}
721
+ */
722
+ handleClick(e) {
723
+ if (this.data.selecting === "start") {
724
+ this.data.current.start = e, this.data.current.end = null, this.data.selecting = "end";
725
+ const s = /* @__PURE__ */ new Date(e + "T00:00:00");
726
+ this.setCurrent({
727
+ month: s.getMonth(),
728
+ year: s.getFullYear(),
729
+ date: s.getDate()
730
+ });
731
+ } else {
732
+ this.data.current.start && e < this.data.current.start ? (this.data.current.end = this.data.current.start, this.data.current.start = e) : this.data.current.end = e, this.data.selecting = "start";
733
+ const s = /* @__PURE__ */ new Date(e + "T00:00:00");
734
+ this.setCurrent({
735
+ month: s.getMonth(),
736
+ year: s.getFullYear(),
737
+ date: s.getDate()
738
+ }), typeof this.onRangeSelect == "function" && this.onRangeSelect(this.data.current.start, this.data.current.end);
739
+ }
740
+ }
741
+ /**
742
+ * Update current month/year in data.
743
+ *
744
+ * @param {object} obj
745
+ * @returns {void}
746
+ */
747
+ setCurrent({ month: e, year: s, date: a = null }) {
748
+ const n = this.data.current;
749
+ n.month = (e + 12) % 12, n.year = s + (e < 0 ? -1 : e > 11 ? 1 : 0), a !== null && (n.date = a), this.data.monthName = this.getMonthName(n.month), this.data.currentDate = `${s}-${b(e + 1)}-${b(n.date)}`;
750
+ }
751
+ /**
752
+ * Render the range calendar.
753
+ *
754
+ * @returns {object}
755
+ */
756
+ render() {
757
+ const { today: e, current: s, selecting: a } = this.data, { start: n, end: o } = s;
758
+ return r({ class: "range-calendar border border-border rounded-lg shadow-md p-4 w-full max-w-sm min-w-80" }, [
759
+ Qt({
760
+ start: n,
761
+ end: o,
762
+ selecting: a,
763
+ onSelectStart: (c) => {
764
+ c.preventDefault(), c.stopPropagation(), this.data.selecting = "start";
765
+ },
766
+ onSelectEnd: (c) => {
767
+ c.preventDefault(), c.stopPropagation(), this.data.selecting = "end";
768
+ }
769
+ }),
770
+ J("view", (c) => {
771
+ switch (c) {
772
+ case "months":
773
+ return Wt(
774
+ {
775
+ currentMonth: s.month,
776
+ currentYear: s.year,
777
+ onSelect: (l) => {
778
+ this.setCurrent({ month: l, year: s.year }), this.state.view = "calendar";
779
+ }
780
+ }
781
+ );
782
+ case "years":
783
+ return Jt(
784
+ {
785
+ currentYear: s.year,
786
+ onSelect: (l) => {
787
+ this.setCurrent({ month: s.month, year: l }), this.state.view = "calendar";
788
+ }
789
+ }
790
+ );
791
+ default:
792
+ return Et({
793
+ monthName: this.data.monthName,
794
+ year: s.year,
795
+ today: e,
796
+ current: s,
797
+ blockPriorDates: this.blockPriorDates,
798
+ onDateClick: (l) => this.handleClick(l),
799
+ onMonthClick: (l) => {
800
+ l.preventDefault(), l.stopPropagation(), this.state.view = "months";
801
+ },
802
+ onYearClick: (l) => {
803
+ l.preventDefault(), l.stopPropagation(), this.state.view = "years";
804
+ },
805
+ next: () => {
806
+ const l = this.data.current, u = l.month === 11 ? { month: 0, year: l.year + 1 } : { month: l.month + 1, year: l.year };
807
+ this.setCurrent(u);
808
+ },
809
+ previous: () => {
810
+ const l = this.data.current, u = l.month === 0 ? { month: 11, year: l.year - 1 } : { month: l.month - 1, year: l.year };
811
+ this.setCurrent(u);
812
+ }
813
+ });
814
+ }
815
+ })
816
+ ]);
817
+ }
818
+ }
819
+ m((t, e) => ({
820
+ class: "flex items-center px-4 py-2",
821
+ ...t,
822
+ children: e
823
+ }));
824
+ m(({ value: t, label: e }) => K({
825
+ class: "inline-flex flex-auto items-center justify-center whitespace-nowrap rounded-md px-8 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",
826
+ onState: ["performance", { active: t }],
827
+ dataSet: ["performance", ["state", t, "active"]],
828
+ click: (s, { state: a }) => a.performance = t
829
+ }, e));
830
+ const Gt = (t, e) => {
831
+ const s = t.toggleAllSelectedRows();
832
+ e.state.checked = !s;
833
+ }, Xt = (t) => G({ class: `cursor-pointer py-3 px-4 text-base w-10 ${t.class || ""}` }, [
834
+ et((e) => new mt({ class: "mr-2", onChange: (s, a) => Gt(e, a) }))
835
+ ]), _t = ({ align: t, sortable: e, key: s, label: a, sort: n, class: o }) => {
836
+ const c = t || "justify-start";
837
+ return G({
838
+ class: `cursor-pointer py-3 px-4 text-base ${o || ""}`,
839
+ click: e && (() => n(s))
840
+ }, [
841
+ r({ class: `flex flex-auto w-full items-center ${c}` }, [
842
+ N(a),
843
+ e && st({ class: "ml-2", html: S.arrows.upDown })
844
+ ])
845
+ ]);
846
+ }, A = (t) => at([
847
+ nt({
848
+ class: "text-muted-foreground border-b",
849
+ map: [
850
+ t.headers,
851
+ (e) => e.label === "checkbox" ? Xt({ toggle: t.toggle }) : _t({
852
+ align: e.align,
853
+ sortable: e.sortable,
854
+ key: e.key,
855
+ label: e.label,
856
+ sort: t.sort
857
+ })
858
+ ]
859
+ })
860
+ ]), qt = ({ key: t, rows: e, selectRow: s, rowItem: a, emptyState: n, skeleton: o, columnCount: c }) => new ct({
861
+ cache: "list",
862
+ key: t,
863
+ items: e,
864
+ rowItem: (l) => a(l, s),
865
+ class: "divide-y divide-border",
866
+ emptyState: n,
867
+ skeleton: o,
868
+ columnCount: c
869
+ });
870
+ class Z extends R {
871
+ /**
872
+ * Initializes component data.
873
+ *
874
+ * @returns {Data}
875
+ */
876
+ setData() {
877
+ let e = this.rows && this.rows.length > 0;
878
+ return (this.loadMoreItems || this.tableData) && !e && (e = null), new P({
879
+ selectedRows: [],
880
+ // @ts-ignore
881
+ hasItems: e,
882
+ selected: !1
883
+ });
884
+ }
885
+ /**
886
+ * This will toggle all selected rows.
887
+ *
888
+ * @returns {boolean}
889
+ */
890
+ toggleAllSelectedRows() {
891
+ const e = this.list.getRows(), s = this.data.selectedRows.length === e.length, a = s ? [] : e;
892
+ return this.data.selectedRows = a, this.updateSelected(), this.updateTable(!s), s;
893
+ }
894
+ /**
895
+ * This will update the selected state.
896
+ *
897
+ * @returns {void}
898
+ */
899
+ updateSelected() {
900
+ const e = this.data.get("selectedRows");
901
+ this.data.selected = e.length > 0;
902
+ }
903
+ /**
904
+ * This will get the selected rows.
905
+ *
906
+ * @returns {Array<object>}
907
+ */
908
+ getSelectedRows() {
909
+ return this.data.get("selectedRows");
910
+ }
911
+ /**
912
+ * This will update the table rows.
913
+ *
914
+ * @protected
915
+ * @param {boolean} selected
916
+ * @returns {void}
917
+ */
918
+ updateTable(e) {
919
+ const s = this.list.getRows();
920
+ s.forEach((a) => a.selected = e), this.list.setRows(s);
921
+ }
922
+ /**
923
+ * Handles row selection.
924
+ *
925
+ * @param {object} row
926
+ */
927
+ selectRow(e) {
928
+ const s = e.selected ?? !1;
929
+ e.selected = !s;
930
+ const a = this.data.get("selectedRows"), n = e.selected ? [...a, e] : a.filter((o) => o !== e);
931
+ this.data.selectedRows = n, this.updateSelected();
932
+ }
933
+ /**
934
+ * Gets the number of header columns.
935
+ *
936
+ * @returns {number}
937
+ */
938
+ getHeaderColCount() {
939
+ return this.customHeader ? this.customHeader?.children[0]?.children?.length : this.headers ? this.headers.length : 3;
940
+ }
941
+ /**
942
+ * Renders the DataTable component.
943
+ *
944
+ * @returns {object}
945
+ */
946
+ render() {
947
+ const e = this.border !== !1 ? "border" : "", s = this.getHeaderColCount();
948
+ return r({ class: "w-full flex flex-auto flex-col" }, [
949
+ $("hasItems", (a) => a === !1 && this.emptyState ? this.emptyState() : null),
950
+ r({ class: `w-full rounded-md ${e} overflow-x-auto`, onSet: ["hasItems", { hidden: !1 }] }, [
951
+ j({ class: "w-full" }, [
952
+ // @ts-ignore
953
+ this.headers && A({ headers: this.headers, sort: (a) => this.sortRows(a) }),
954
+ // @ts-ignore
955
+ this.customHeader ?? null,
956
+ qt({
957
+ // @ts-ignore
958
+ key: this.key,
959
+ // @ts-ignore
960
+ rows: this.rows,
961
+ // @ts-ignore
962
+ selectRow: this.selectRow.bind(this),
963
+ // @ts-ignore
964
+ rowItem: this.rowItem,
965
+ // @ts-ignore
966
+ emptyState: this.emptyState,
967
+ // @ts-ignore
968
+ skeleton: this.skeleton,
969
+ columnCount: s
970
+ })
971
+ ])
972
+ ])
973
+ ]);
974
+ }
975
+ /**
976
+ * This will remove items from the list.
977
+ *
978
+ * @public
979
+ * @param {array} items
980
+ * @returns {void}
981
+ */
982
+ remove(e) {
983
+ this.list.remove(e);
984
+ }
985
+ /**
986
+ * This will set the items in the list.
987
+ *
988
+ * @public
989
+ * @param {array} rows
990
+ * @returns {void}
991
+ */
992
+ setRows(e) {
993
+ this.list.setRows(e);
994
+ }
995
+ /**
996
+ * This will append items to the list.
997
+ *
998
+ * @public
999
+ * @param {array|object} items
1000
+ * @returns {void}
1001
+ */
1002
+ append(e) {
1003
+ this.list.append(e);
1004
+ }
1005
+ /**
1006
+ * This will mingle the new items with the old items.
1007
+ *
1008
+ * @public
1009
+ * @param {Array<Object>} newItems
1010
+ * @param {boolean} withDelete
1011
+ * @returns {void}
1012
+ */
1013
+ mingle(e, s = !1) {
1014
+ this.list.mingle(e, s);
1015
+ }
1016
+ /**
1017
+ * This will prepend items to the list.
1018
+ *
1019
+ * @public
1020
+ * @param {array|object} items
1021
+ * @returns {void}
1022
+ */
1023
+ prepend(e) {
1024
+ this.list.prepend(e);
1025
+ }
1026
+ /**
1027
+ * This will remove the selected rows.
1028
+ *
1029
+ * @returns {void}
1030
+ */
1031
+ beforeDestroy() {
1032
+ this.data.selectedRows = [];
1033
+ }
1034
+ }
1035
+ const Vt = (t) => new dt({
1036
+ cache: "list",
1037
+ loadMoreItems: t.loadMoreItems,
1038
+ offset: t.offset,
1039
+ limit: t.limit,
1040
+ key: t.key,
1041
+ tableData: t.tableData,
1042
+ items: t.items,
1043
+ rowItem: (e) => t.rowItem(e, t.selectRow),
1044
+ class: "divide-y divide-border",
1045
+ skeleton: t.skeleton,
1046
+ columnCount: t.columnCount
1047
+ });
1048
+ class Zt extends Z {
1049
+ /**
1050
+ * Renders the DataTable component.
1051
+ *
1052
+ * @returns {object}
1053
+ */
1054
+ render() {
1055
+ const e = this.border !== !1 ? "border" : "", s = this.getHeaderColCount();
1056
+ return r({ class: "w-full flex flex-auto flex-col" }, [
1057
+ $("hasItems", (a) => a === !1 && this.emptyState ? this.emptyState() : null),
1058
+ r({ class: `w-full rounded-md ${e} overflow-x-auto`, onSet: ["hasItems", { hidden: !1 }] }, [
1059
+ j({ class: "w-full" }, [
1060
+ // @ts-ignore
1061
+ this.headers && A({ headers: this.headers, sort: (a) => this.sortRows(a) }),
1062
+ // @ts-ignore
1063
+ this.customHeader ?? null,
1064
+ Vt({
1065
+ // @ts-ignore
1066
+ loadMoreItems: this.loadMoreItems,
1067
+ // @ts-ignore
1068
+ offset: this.offset,
1069
+ // @ts-ignore
1070
+ limit: this.limit,
1071
+ // @ts-ignore
1072
+ class: this.class,
1073
+ // @ts-ignore
1074
+ tableData: this.tableData,
1075
+ // @ts-ignore
1076
+ key: this.key,
1077
+ // @ts-ignore
1078
+ items: this.rows,
1079
+ // @ts-ignore
1080
+ selectRow: this.selectRow.bind(this),
1081
+ // @ts-ignore
1082
+ rowItem: this.rowItem,
1083
+ // @ts-ignore
1084
+ skeleton: this.skeleton,
1085
+ columnCount: s
1086
+ })
1087
+ ])
1088
+ ])
1089
+ ]);
1090
+ }
1091
+ /**
1092
+ * Refreshes the list.
1093
+ *
1094
+ * @returns {void}
1095
+ */
1096
+ refresh() {
1097
+ this.list.refresh();
1098
+ }
1099
+ }
1100
+ const ve = m((t) => new Zt(
1101
+ {
1102
+ cache: t.cache ?? "list",
1103
+ tableData: t.data,
1104
+ loadMoreItems: t.loadMoreItems,
1105
+ offset: t.offset,
1106
+ limit: t.limit,
1107
+ class: t.class,
1108
+ key: t.key,
1109
+ rows: t.rows,
1110
+ rowItem: t.rowItem,
1111
+ headers: t.headers,
1112
+ customHeader: t.customHeader,
1113
+ border: t.border,
1114
+ emptyState: t.emptyState,
1115
+ skeleton: t.skeleton
1116
+ }
1117
+ )), te = (t) => new ht({
1118
+ cache: "list",
1119
+ scrollContainer: t.scrollContainer,
1120
+ loadMoreItems: t.loadMoreItems,
1121
+ offset: t.offset,
1122
+ limit: t.limit,
1123
+ key: t.key,
1124
+ tableData: t.tableData,
1125
+ items: t.items,
1126
+ rowItem: (e) => t.rowItem(e, t.selectRow),
1127
+ class: "divide-y divide-border",
1128
+ skeleton: t.skeleton,
1129
+ columnCount: t.columnCount
1130
+ });
1131
+ class ee extends Z {
1132
+ /**
1133
+ * Renders the DataTable component.
1134
+ *
1135
+ * @returns {object}
1136
+ */
1137
+ render() {
1138
+ const e = this.border !== !1 ? "border" : "", s = this.getHeaderColCount();
1139
+ return r({ class: "w-full flex flex-auto flex-col" }, [
1140
+ $("hasItems", (a) => a === !1 && this.emptyState ? this.emptyState() : null),
1141
+ r({ class: `w-full rounded-md ${e} overflow-x-auto`, onSet: ["hasItems", { hidden: !1 }] }, [
1142
+ j({ class: "w-full" }, [
1143
+ // @ts-ignore
1144
+ this.headers && A({ headers: this.headers, sort: (a) => this.sortRows(a) }),
1145
+ // @ts-ignore
1146
+ this.customHeader ?? null,
1147
+ te({
1148
+ // @ts-ignore
1149
+ scrollContainer: this.scrollContainer,
1150
+ // @ts-ignore
1151
+ loadMoreItems: this.loadMoreItems,
1152
+ // @ts-ignore
1153
+ offset: this.offset,
1154
+ // @ts-ignore
1155
+ limit: this.limit,
1156
+ // @ts-ignore
1157
+ class: this.class,
1158
+ // @ts-ignore
1159
+ tableData: this.tableData,
1160
+ // @ts-ignore
1161
+ key: this.key,
1162
+ // @ts-ignore
1163
+ items: this.rows,
1164
+ // @ts-ignore
1165
+ selectRow: this.selectRow.bind(this),
1166
+ // @ts-ignore
1167
+ rowItem: this.rowItem,
1168
+ // @ts-ignore
1169
+ skeleton: this.skeleton,
1170
+ columnCount: s
1171
+ })
1172
+ ])
1173
+ ])
1174
+ ]);
1175
+ }
1176
+ /**
1177
+ * Refreshes the list.
1178
+ *
1179
+ * @returns {void}
1180
+ */
1181
+ refresh() {
1182
+ this.list.refresh();
1183
+ }
1184
+ }
1185
+ const ke = m((t) => new ee(
1186
+ {
1187
+ cache: t.cache ?? "list",
1188
+ tableData: t.data,
1189
+ scrollContainer: t.scrollContainer,
1190
+ loadMoreItems: t.loadMoreItems,
1191
+ offset: t.offset,
1192
+ limit: t.limit,
1193
+ class: t.class,
1194
+ key: t.key,
1195
+ rows: t.rows,
1196
+ rowItem: t.rowItem,
1197
+ headers: t.headers,
1198
+ customHeader: t.customHeader,
1199
+ border: t.border,
1200
+ emptyState: t.emptyState,
1201
+ skeleton: t.skeleton
1202
+ }
1203
+ )), se = m(({ name: t, email: e }) => r({ class: "min-w-0 flex-auto" }, [
1204
+ O({ class: "text-base font-semibold leading-6 m-0" }, t),
1205
+ O({ class: "truncate text-sm leading-5 text-muted-foreground m-0" }, e)
1206
+ ])), ae = () => r({ class: "flex items-center gap-x-1.5" }, [
1207
+ r({ class: "flex-none rounded-full bg-emerald-500/20 p-1" }, [
1208
+ r({ class: "h-1.5 w-1.5 rounded-full bg-emerald-500" })
1209
+ ]),
1210
+ O({ class: "text-xs leading-5 text-gray-500" }, "Online")
1211
+ ]), ne = (t) => O({ class: "text-xs leading-5 text-muted-foreground" }, [
1212
+ N("Last seen "),
1213
+ ot({ datetime: t }, "3h ago")
1214
+ ]), oe = (t, e) => t === "online" ? ae() : ne(e), re = m(({ role: t, lastSeen: e, status: s }) => r({ class: "hidden shrink-0 sm:flex sm:flex-col sm:items-end" }, [
1215
+ O({ class: "text-sm leading-6 m-0" }, t),
1216
+ oe(s, e)
1217
+ ])), le = (t) => t.split(" ").map((s) => s[0]).join(""), ie = m((t) => X({ class: "fadeIn flex justify-between gap-x-6 py-4 px-4 rounded-md hover:bg-muted/50" }, [
1218
+ r({ class: "flex min-w-0 gap-x-4" }, [
1219
+ St({ src: t.image, alt: t.name, fallbackText: le(t.name) }),
1220
+ se({ name: t.name, email: t.email })
1221
+ ]),
1222
+ re({
1223
+ role: t.role,
1224
+ lastSeen: t.lastSeen,
1225
+ status: t.status
1226
+ })
1227
+ ])), Se = m((t) => new ut({
1228
+ cache: "list",
1229
+ key: "name",
1230
+ items: t.users,
1231
+ role: "list",
1232
+ class: "divide-y divide-border",
1233
+ rowItem: ie
1234
+ })), Ce = m((t) => {
1235
+ const e = t.margin || "m-4 ml-0";
1236
+ return t.allowHistory = t.allowHistory === !0, r({ class: `flex-none ${e}` }, [
1237
+ y({ variant: "back", class: "ghost", ...t })
1238
+ ]);
1239
+ });
1240
+ class ce extends R {
1241
+ /**
1242
+ * This will declare the props for the compiler.
1243
+ *
1244
+ * @returns {void}
1245
+ */
1246
+ declareProps() {
1247
+ this.class = "";
1248
+ }
1249
+ /**
1250
+ * This will render the component.
1251
+ *
1252
+ * @returns {object}
1253
+ */
1254
+ render() {
1255
+ return r(
1256
+ {
1257
+ class: this.getClassName(),
1258
+ onSet: ["loading", {
1259
+ loading: !0
1260
+ }]
1261
+ },
1262
+ [
1263
+ this.addBody()
1264
+ ]
1265
+ );
1266
+ }
1267
+ /**
1268
+ * This will get the overlay className.
1269
+ *
1270
+ * @returns {string}
1271
+ */
1272
+ getClassName() {
1273
+ return `absolute flex flex-auto flex-col overlay left-0 top-0 right-0 z-20
1274
+ h-svh max-h-svh min-h-svh
1275
+ bg-background pointer-events-auto
1276
+ lg:left-16
1277
+ will-change-contents ${this.class || ""}`;
1278
+ }
1279
+ /**
1280
+ * This will setup and render the component.
1281
+ *
1282
+ * @param {object} container
1283
+ * @returns {void}
1284
+ */
1285
+ setContainer(e) {
1286
+ this.container = app.root;
1287
+ }
1288
+ /**
1289
+ * This will setup the overlay states.
1290
+ *
1291
+ * @returns {object}
1292
+ */
1293
+ setupStates() {
1294
+ return {
1295
+ loading: !1
1296
+ };
1297
+ }
1298
+ /**
1299
+ * This will set the loading state.= to true.
1300
+ *
1301
+ * @returns {void}
1302
+ */
1303
+ addLoading() {
1304
+ this.state.loading = !0;
1305
+ }
1306
+ /**
1307
+ * This will set the loading state to false.
1308
+ *
1309
+ * @returns {void}
1310
+ */
1311
+ removeLoading() {
1312
+ this.state.loading = !1;
1313
+ }
1314
+ /**
1315
+ * This will add the body of the overlay.
1316
+ *
1317
+ * @returns {object}
1318
+ */
1319
+ addBody() {
1320
+ return r({ class: "body fadeIn flex flex-auto flex-col bg-background" }, this.getContents());
1321
+ }
1322
+ /**
1323
+ * This will get the body contents.
1324
+ *
1325
+ * @returns {array|null}
1326
+ */
1327
+ getContents() {
1328
+ return this.children;
1329
+ }
1330
+ }
1331
+ _.addType("dockableOverlay", (t) => {
1332
+ if (!t)
1333
+ return;
1334
+ const e = t.component;
1335
+ e && e.rendered === !0 && e.state.docked === !1 && e.destroy();
1336
+ });
1337
+ class Me extends ce {
1338
+ /**
1339
+ * This will stop presistence.
1340
+ *
1341
+ * @returns {void}
1342
+ */
1343
+ onCreated() {
1344
+ this.dockSize = this.maxSize || 1024;
1345
+ }
1346
+ /**
1347
+ * This will render the component.
1348
+ *
1349
+ * @returns {object}
1350
+ */
1351
+ render() {
1352
+ const e = this.container;
1353
+ return r(
1354
+ {
1355
+ onState: [
1356
+ ["loading", {
1357
+ loading: !0
1358
+ }],
1359
+ ["docked", (s, a) => {
1360
+ s ? (a.className = this.getDockedClassName(), e.appendChild(a)) : (a.className = this.getClassName(), app.root.appendChild(a));
1361
+ }]
1362
+ ]
1363
+ },
1364
+ [
1365
+ this.addBody()
1366
+ ]
1367
+ );
1368
+ }
1369
+ /**
1370
+ * This will get the docked className.
1371
+ *
1372
+ * @returns {string}
1373
+ */
1374
+ getDockedClassName() {
1375
+ return "flex flex-auto flex-col bg-background flex will-change-contents " + (this.class || "");
1376
+ }
1377
+ /**
1378
+ * This will setup and render the component.
1379
+ *
1380
+ * @param {object} container
1381
+ * @returns {void}
1382
+ */
1383
+ setup(e) {
1384
+ this.container = e, this.initialize();
1385
+ }
1386
+ /**
1387
+ * This will setup the overlay states.
1388
+ *
1389
+ * @returns {object}
1390
+ */
1391
+ setupStates() {
1392
+ return {
1393
+ loading: !1,
1394
+ docked: this.canDock()
1395
+ };
1396
+ }
1397
+ /**
1398
+ * This will check the dock size.
1399
+ *
1400
+ * @returns {void}
1401
+ */
1402
+ afterSetup() {
1403
+ _.add(
1404
+ this.container,
1405
+ "dockableOverlay",
1406
+ {
1407
+ component: this
1408
+ }
1409
+ ), this.onResize();
1410
+ }
1411
+ /**
1412
+ * This will setup the overlay events.
1413
+ *
1414
+ * @returns {Array<object>}
1415
+ */
1416
+ setupEvents() {
1417
+ return [
1418
+ ["resize", globalThis, () => this.onResize()]
1419
+ ];
1420
+ }
1421
+ /**
1422
+ * This will check if the overlay can dock.
1423
+ *
1424
+ * @returns {boolean}
1425
+ */
1426
+ canDock() {
1427
+ return globalThis.innerWidth >= this.dockSize;
1428
+ }
1429
+ /**
1430
+ * This will handle the overlay resize.
1431
+ *
1432
+ * @returns {void}
1433
+ */
1434
+ onResize() {
1435
+ this.state.docked = this.canDock();
1436
+ }
1437
+ }
1438
+ const de = m(({ index: t, click: e, state: s }, a) => X({
1439
+ class: "p-2 cursor-pointer hover:bg-muted/50",
1440
+ onState: [
1441
+ [s, "selectedIndex", {
1442
+ "bg-accent": t,
1443
+ "text-white": t
1444
+ }]
1445
+ ],
1446
+ click: () => e(t)
1447
+ }, a)), he = m(({ selectOption: t, state: e }) => rt({
1448
+ class: "border rounded-md list-none m-0 p-0 max-h-[400px] overflow-y-auto",
1449
+ for: ["filteredOptions", (s, a) => de({ index: a, click: t, state: e }, s.label)]
1450
+ })), ue = m((t) => r({ class: "relative flex flex-auto items-center" }, [
1451
+ gt({
1452
+ cache: "input",
1453
+ class: t.class ?? "",
1454
+ placeholder: t.placeholder ?? "Search...",
1455
+ bind: t.bind ?? [t.state, "searchQuery"],
1456
+ keyup: (e, s) => {
1457
+ s.state && (s.state.open = !1), typeof t.filterOptions == "function" && t.filterOptions(), s.dropdown && s.dropdown.updatePosition(), t.keyup && t.keyup(e, s);
1458
+ },
1459
+ pointerup: (e, s) => {
1460
+ typeof s.toggleDropdown == "function" && s.toggleDropdown();
1461
+ },
1462
+ keydown: (e) => [
1463
+ typeof t.handleKeyDown == "function" && t.handleKeyDown(e)
1464
+ ]
1465
+ }),
1466
+ t.icon && r({ class: "absolute flex right-0 mr-2" }, [
1467
+ q({ size: "sm" }, t.icon)
1468
+ ])
1469
+ ])), fe = (t) => r({
1470
+ class: "relative flex fle-auto flex-col",
1471
+ onState: ["open", (e, s, a) => {
1472
+ if (e)
1473
+ return new wt({
1474
+ cache: "dropdown",
1475
+ parent: a,
1476
+ button: a.input,
1477
+ size: "xl"
1478
+ }, [
1479
+ he(t)
1480
+ ]);
1481
+ }]
1482
+ }), Ie = it(
1483
+ {
1484
+ /**
1485
+ * This will set up the data object.
1486
+ *
1487
+ * @returns {object} - The data object.
1488
+ */
1489
+ setData() {
1490
+ const t = this.options || [];
1491
+ return new P({
1492
+ options: t,
1493
+ filteredOptions: t
1494
+ });
1495
+ },
1496
+ /**
1497
+ * This will set up the state object.
1498
+ *
1499
+ * @returns {object} - The state object.
1500
+ */
1501
+ state() {
1502
+ return {
1503
+ searchQuery: "",
1504
+ selectedIndex: -1,
1505
+ open: !1
1506
+ };
1507
+ },
1508
+ /**
1509
+ * This will set the selected index by query.
1510
+ *
1511
+ * @returns {void}
1512
+ */
1513
+ setSelectedIndexByQuery() {
1514
+ const t = this.data.filteredOptions;
1515
+ let { searchQuery: e } = this.state;
1516
+ e = e.toLowerCase();
1517
+ const s = t.findIndex((a) => a.label.toLowerCase() === e);
1518
+ s >= 0 && (this.state.selectedIndex = s);
1519
+ },
1520
+ /**
1521
+ * This will filter the options.
1522
+ *
1523
+ * @returns {void}
1524
+ */
1525
+ filterOptions() {
1526
+ const t = this.state.searchQuery.toLowerCase();
1527
+ if (t === "" || t.length === 0) {
1528
+ this.data.filteredOptions = this.data.options;
1529
+ return;
1530
+ }
1531
+ const e = this.data.get("options");
1532
+ this.data.filteredOptions = e.filter(
1533
+ (s) => s.label.toLowerCase().includes(t)
1534
+ );
1535
+ },
1536
+ /**
1537
+ * This will get the selected value.
1538
+ *
1539
+ * @returns {object}
1540
+ */
1541
+ getValue() {
1542
+ const { selectedIndex: t } = this.state;
1543
+ return t < 0 ? null : this.data.get(`filteredOptions[${t}]`);
1544
+ },
1545
+ /**
1546
+ * This will select an option.
1547
+ *
1548
+ * @param {number} index - The index of the option.
1549
+ * @returns {void}
1550
+ */
1551
+ selectOption(t) {
1552
+ this.state.selectedIndex = t;
1553
+ const e = this.data.get(`filteredOptions[${t}]`);
1554
+ this.state.searchQuery = e.label, this.state.open = !1, typeof this.onSelect == "function" && this.onSelect(e);
1555
+ },
1556
+ /**
1557
+ * Toggles the dropdown open state.
1558
+ */
1559
+ toggleDropdown() {
1560
+ this.state.toggle("open"), this.state.open && this.setSelectedIndexByQuery();
1561
+ },
1562
+ /**
1563
+ * This will handle key down events.
1564
+ *
1565
+ * @param {object} event - The event object.
1566
+ * @returns {void}
1567
+ */
1568
+ handleKeyDown(t) {
1569
+ const e = this.data.filteredOptions, { selectedIndex: s } = this.state;
1570
+ t.key === "ArrowDown" ? (t.preventDefault(), this.state.selectedIndex = Math.min(s + 1, e.length - 1)) : t.key === "ArrowUp" ? (t.preventDefault(), this.state.selectedIndex = Math.max(s - 1, 0)) : t.key === "Enter" && s >= 0 && (t.preventDefault(), this.selectOption(s));
1571
+ },
1572
+ /**
1573
+ * This will render the component.
1574
+ *
1575
+ * @returns {object} - The rendered component.
1576
+ */
1577
+ render() {
1578
+ return r({ class: "relative w-full max-w-md" }, [
1579
+ ue({
1580
+ // @ts-ignore
1581
+ state: this.state,
1582
+ // @ts-ignore
1583
+ icon: this.icon,
1584
+ // @ts-ignore
1585
+ placeholder: this.placeholder,
1586
+ // @ts-ignore
1587
+ filterOptions: this.filterOptions.bind(this),
1588
+ // @ts-ignore
1589
+ handleKeyDown: this.handleKeyDown.bind(this)
1590
+ }),
1591
+ fe({
1592
+ // @ts-ignore
1593
+ state: this.state,
1594
+ // @ts-ignore
1595
+ setSelected: this.setSelectedIndexByQuery.bind(this),
1596
+ // @ts-ignore
1597
+ selectOption: this.selectOption.bind(this)
1598
+ })
1599
+ ]);
1600
+ }
1601
+ }
1602
+ ), Te = m((t) => {
1603
+ const e = t.icon ?? S.magnifyingGlass.default;
1604
+ return r({
1605
+ class: `relative flex items-center w-full rounded-xl bg-muted/30 focus-within:ring-2 focus-within:ring-ring transition-all ${t.containerClass || ""}`
1606
+ }, [
1607
+ r({ class: "absolute left-4 flex items-center pointer-events-none text-muted-foreground" }, [
1608
+ q({ size: "sm" }, e)
1609
+ ]),
1610
+ lt({
1611
+ type: "text",
1612
+ cache: t.cache ?? "input",
1613
+ class: `w-full bg-transparent border-none outline-none pl-12 pr-4 py-4 text-base text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-0 ${t.class || ""}`,
1614
+ placeholder: t.placeholder ?? "Search...",
1615
+ bind: t.bind,
1616
+ value: t.value,
1617
+ keyup: t.keyup,
1618
+ keydown: t.keydown,
1619
+ input: t.input,
1620
+ change: t.change,
1621
+ focus: t.focus,
1622
+ blur: t.blur
1623
+ })
1624
+ ]);
1625
+ });
1626
+ export {
1627
+ St as A,
1628
+ Ce as B,
1629
+ De as C,
1630
+ Z as D,
1631
+ p as F,
1632
+ _t as H,
1633
+ Yt as M,
1634
+ ce as O,
1635
+ wt as P,
1636
+ pe as R,
1637
+ ke as S,
1638
+ A as T,
1639
+ Se as U,
1640
+ Pt as a,
1641
+ Xt as b,
1642
+ qt as c,
1643
+ Y as d,
1644
+ Nt as e,
1645
+ Me as f,
1646
+ ve as g,
1647
+ Ie as h,
1648
+ ue as i,
1649
+ Te as j,
1650
+ ie as k,
1651
+ Mt as l,
1652
+ yt as m,
1653
+ b as p
1654
+ };