@base-framework/ui 1.2.14 → 1.2.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.
@@ -1,2151 +0,0 @@
1
- import { Atom as c, Component as y, Html as A, Dom as Z, base as tt, Data as k, Builder as H, Jot as w, Events as g, DateTime as M } from "@base-framework/base";
2
- import { Div as n, H5 as et, P as b, Li as q, Span as a, Ul as V, Button as p, I as T, OnState as I, Label as P, H2 as v, Form as st, Header as B, Footer as L, A as G, H3 as ot, Checkbox as nt, Input as f, Img as W, Nav as it, UseParent as _, OnStateOpen as O, Time as rt, Dialog as lt } from "@base-framework/atoms";
3
- import { P as S, C as at, R as ct } from "./simple-search-input-DBNmoBCn.js";
4
- import { U as m, B as h, I as dt } from "./buttons-C-_NH7ie.js";
5
- import { Timer as ut, List as ht, DynamicTime as mt } from "@base-framework/organisms";
6
- import { C as ft, b as pt } from "./tooltip-BG73cjI2.js";
7
- import { f as C } from "./image-XjAp5NjV.js";
8
- import { Icons as u } from "./icons.es.js";
9
- import { F as z } from "./format-DE4rFWuD.js";
10
- import "./mobile-nav-wrapper-C7cKTxaV.js";
11
- import "./aside-template-B9V-0xle.js";
12
- import "./full-page-CgVI1G7F.js";
13
- import "./bside-template-oLChzjxQ.js";
14
- const Y = {
15
- info: {
16
- borderColor: "border-blue-500",
17
- bgColor: "bg-muted/10",
18
- iconColor: "text-blue-500"
19
- },
20
- warning: {
21
- bgColor: "bg-muted/10",
22
- borderColor: "border-warning",
23
- iconColor: "text-warning"
24
- },
25
- destructive: {
26
- bgColor: "bg-muted/10",
27
- borderColor: "border-destructive",
28
- iconColor: "text-red-500"
29
- },
30
- success: {
31
- bgColor: "bg-muted/10",
32
- borderColor: "border-emerald-500",
33
- iconColor: "text-emerald-500"
34
- },
35
- default: {
36
- borderColor: "border",
37
- bgColor: "bg-muted/10",
38
- iconColor: "text-muted-foreground"
39
- }
40
- }, gt = (t, e) => n({ class: `flex items-center justify-center h-6 w-6 mr-3 ${e}` }, [
41
- m({ size: "sm" }, t)
42
- ]), bt = (t) => et({ class: "font-semibold" }, t), xt = (t) => b({ class: "text-sm text-muted-foreground" }, t), je = c(({ title: t, description: e, icon: s, type: o = "default" }) => {
43
- const { borderColor: i, bgColor: r, iconColor: l } = Y[o] || Y.default;
44
- return n({ class: `flex items-start p-4 border rounded-lg ${r} ${i}` }, [
45
- // Icon and content
46
- s && gt(s, l),
47
- n({ class: "flex flex-col" }, [
48
- bt(t),
49
- xt(e)
50
- ])
51
- ]);
52
- });
53
- class Ee extends y {
54
- /**
55
- * This will declare the props for the compiler.
56
- *
57
- * @returns {void}
58
- */
59
- declareProps() {
60
- this.removingClass = "";
61
- }
62
- /**
63
- * This will remove the component from the DOM after a delay.
64
- *
65
- * @returns {void}
66
- */
67
- remove() {
68
- this.prepareDestroy(), this.removeContext();
69
- const e = this.panel, s = this.removingClass;
70
- if (!s) {
71
- A.removeElement(e);
72
- return;
73
- }
74
- Z.addClass(e, s), tt.on("animationend", e, (o) => A.removeElement(e));
75
- }
76
- }
77
- const yt = (t) => a({ class: "ml-auto text-xs tracking-widest opacity-60" }, t), wt = (t) => a({ class: "flex w-4 h-4", html: t }), Ct = (t) => a({ class: "flex-auto" }, t), vt = (t, e) => q({
78
- class: "relative flex cursor-pointer hover:bg-muted/50 select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
79
- click: () => e(t)
80
- }, [
81
- t.icon && wt(t.icon),
82
- Ct(t.label),
83
- t.shortcut && yt(t.shortcut)
84
- ]), St = (t, e) => V({ class: "grid gap-2" }, [
85
- t.map((s) => vt(s, e))
86
- ]), Dt = (t) => n({ class: "w-full z-10" }, [
87
- n({
88
- class: "max-h-60 border rounded-md overflow-y-auto p-1 grid gap-2 divide-y divide-border",
89
- for: ["groups", (e) => St(e, t)]
90
- })
91
- ]), kt = ({ label: t, icon: e, toggleDropdown: s }) => p({
92
- cache: "button",
93
- class: `inline-flex items-center justify-between rounded-md border
94
- px-2 py-2 text-sm font-medium hover:bg-muted
95
- focus:outline-none transition duration-150 ease-in-out`,
96
- click: s
97
- }, [
98
- t && a(t),
99
- e && T({ html: e })
100
- ]), Tt = ({ onSelect: t }) => n([
101
- I(
102
- "open",
103
- (e, s, o) => e ? new S({
104
- cache: "dropdown",
105
- parent: o,
106
- button: o.button
107
- }, [
108
- Dt(t)
109
- ]) : null
110
- )
111
- ]);
112
- class Ne extends y {
113
- /**
114
- * This will declare the props for the compiler.
115
- *
116
- * @returns {void}
117
- */
118
- declareProps() {
119
- this.label = null, this.icon = null, this.onSelect = null, this.groups = [];
120
- }
121
- /**
122
- * Initializes component data.
123
- *
124
- * @returns {Data}
125
- */
126
- setData() {
127
- return new k({
128
- groups: this.groups || []
129
- });
130
- }
131
- /**
132
- * Initializes the component state.
133
- *
134
- * @returns {object}
135
- */
136
- setupStates() {
137
- return {
138
- open: !1,
139
- selectedItem: null
140
- };
141
- }
142
- /**
143
- * Toggles the dropdown open state.
144
- *
145
- * @returns {void}
146
- */
147
- toggleDropdown() {
148
- this.state.toggle("open");
149
- }
150
- /**
151
- * Handles item selection within the dropdown.
152
- *
153
- * @param {object} item - The selected item object
154
- * @returns {void}
155
- */
156
- handleSelect(e) {
157
- this.state.selectedItem = e, this.state.open = !1, typeof this.onSelect == "function" && this.onSelect(e);
158
- }
159
- /**
160
- * Renders the Dropdown component.
161
- *
162
- * @returns {object}
163
- */
164
- render() {
165
- return n({ class: "relative" }, [
166
- kt({
167
- label: this.label,
168
- icon: this.icon,
169
- toggleDropdown: this.toggleDropdown.bind(this)
170
- }),
171
- Tt({ onSelect: this.handleSelect.bind(this) })
172
- ]);
173
- }
174
- }
175
- const It = c((t, e) => n({ ...t, class: "flex flex-auto flex-col gap-y-2" }, e)), Bt = c((t, e) => P({ ...t, class: "flex auto text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70" }, e)), Ft = c((t, e) => b({ ...t, class: "text-sm text-muted-foreground italic" }, e)), $t = c((t, e) => b({ ...t, class: "text-sm text-destructive" }, e)), Ue = c((t, e = []) => ft({ class: "flex flex-auto flex-col gap-y-0", margin: "m-0", padding: "p-0" }, [
176
- // @ts-ignore
177
- t.title && v({ class: "text-lg font-semibold py-4 px-6" }, t.title),
178
- // @ts-ignore
179
- t.description && b({ class: "text-sm text-muted-foreground pb-4 px-6 max-w-[700px]" }, t.description),
180
- ...e
181
- ])), Re = c((t, e = []) => (
182
- // @ts-ignore
183
- pt({ label: t.label, description: t.description, class: "py-4 px-6", border: t.border }, [
184
- n({ class: "flex flex-col gap-y-6" }, e)
185
- ])
186
- )), He = c((t, e = []) => {
187
- const s = t.border ? "border-t" : "";
188
- return n({ ...t, class: `flex flex-col pb-4 px-6 gap-y-4 ${s} ${t.class || ""}` }, e);
189
- }), Mt = (t) => t.tag === "input" || t.tag === "select" || t.tag === "textarea", J = (t, e, s) => t.map((o) => !o || (o.children && o.children.length > 0 && (o.children = J(o.children, e, s)), !o.required) ? o : Mt(o) ? {
190
- ...o,
191
- aria: {
192
- invalid: ["hasError"]
193
- },
194
- invalid: s,
195
- input: e
196
- } : o), Pt = c((t, e) => {
197
- const i = J(e, (r) => {
198
- r.target.checkValidity() && t.setError(null);
199
- }, (r) => {
200
- t.setError(r.target.validationMessage);
201
- });
202
- return n({
203
- ...t,
204
- class: "w-full"
205
- }, i);
206
- }), qe = C(
207
- {
208
- /**
209
- * The initial state of the FormField.
210
- *
211
- * @member {object} state
212
- * @returns {object}
213
- */
214
- state() {
215
- return {
216
- error: null,
217
- hasError: !1,
218
- value: this.defaultValue ?? ""
219
- };
220
- },
221
- /**
222
- * Renders the FormField component.
223
- *
224
- * @returns {object}
225
- */
226
- render() {
227
- const t = this.name, e = this.getId(`${t}`), { label: s, description: o } = this, i = (r) => {
228
- this.state.error = r, this.state.hasError = !!r;
229
- };
230
- return n({ class: "flex flex-auto gap-y-4" }, [
231
- It([
232
- Bt({ htmlFor: e }, s),
233
- Pt({
234
- id: e,
235
- name: t,
236
- value: this.state.value,
237
- setError: i
238
- }, this.children),
239
- o && Ft({ id: this.getId("description") }, o),
240
- n({ onState: ["error", (r) => r && $t(r)] })
241
- ])
242
- ]);
243
- }
244
- }
245
- ), Lt = (t, e, s = null) => {
246
- t.target.checkValidity() && (t.preventDefault(), s && s(t, e));
247
- }, K = c(
248
- (t, e) => (
249
- // @ts-ignore
250
- st({ ...t, submit: (s, o) => Lt(s, o, t.submit), class: `w-full ${t.class ?? ""}` }, e)
251
- )
252
- ), Ve = c((t, e) => (
253
- // @ts-ignore
254
- n({ ...t, class: `flex flex-auto flex-col gap-y-6 p-4 md:p-6 divide-y ${t.class || ""}` }, e)
255
- )), Ge = c((t, e = []) => n({ class: "flex flex-col gap-y-3 py-4" }, [
256
- // @ts-ignore
257
- t.title && v({ class: "font-semibold" }, t.title),
258
- ...e
259
- ])), We = (t, e) => n({ class: "flex justify-between" }, [
260
- a({ class: "text-muted-foreground" }, t),
261
- a(e)
262
- ]), _e = (t, e) => n({ class: "flex" }, [
263
- a({ class: "text-muted-foreground mr-8 w-24 truncate text-nowrap" }, t),
264
- a(e)
265
- ]), Ot = c(({ title: t, description: e, back: s, icon: o, options: i = [] }) => B({ class: "modal-header bg-background/80 backdrop-blur-md sticky flex flex-none items-center py-4 px-6 z-10 min-w-0" }, [
266
- /**
267
- * Back Button (Mobile Only)
268
- */
269
- s && h({
270
- variant: "icon",
271
- icon: u.arrows.left,
272
- class: "mr-2 p-0 flex sm:hidden",
273
- click: (r, l) => l.close()
274
- }),
275
- /**
276
- * Icon Container
277
- */
278
- o && n({ class: "mr-2 w-12 h-12 rounded-full bg-muted flex flex-none items-center justify-center" }, [
279
- m({ size: "md" }, o)
280
- ]),
281
- n({ class: "flex flex-auto flex-row justify-between ml-2 gap-2 min-w-0" }, [
282
- n({ class: "flex flex-auto flex-col min-w-0" }, [
283
- v({ class: "text-lg font-semibold m-0 truncate" }, t),
284
- e && n({ class: "text-sm text-muted-foreground truncate" }, e)
285
- ]),
286
- n({ class: "flex flex-none items-center gap-2" }, i)
287
- ])
288
- ])), Q = c((t, e) => {
289
- const s = t.class?.includes("drawer");
290
- return n({
291
- popover: "manual",
292
- // @ts-ignore
293
- class: `modal ${s ? "" : "m-auto top-0 right-0 bottom-0 left-0"} ${s ? "" : "h-full max-h-screen"} fixed z-20 grid w-full gap-2 lg:border bg-background text-foreground shadow-xl wrap-break-words p-0 overflow-y-auto ${t.class}`,
294
- click: (r, l) => {
295
- r.target === l.panel && (r.preventDefault(), r.stopPropagation(), l.state.open = !1);
296
- }
297
- }, [
298
- K({
299
- class: "modal-content relative bg-background z-1 flex flex-auto flex-col gap-y-4 min-w-0",
300
- // @ts-ignore
301
- submit: (r, l) => t.onSubmit && t.onSubmit(l),
302
- cache: "modalContent",
303
- // @ts-ignore
304
- ...t.gestureHandlers
305
- }, [
306
- Ot(t),
307
- n({ class: "modal-body flex grow flex-col py-0 px-6 z-0", cache: "modalBody" }, e),
308
- // @ts-ignore
309
- !t.hideFooter && L({ class: "modal-footer sticky bottom-0 bg-background/80 backdrop-blur-md flex flex-none justify-between py-4 px-6 z-10" }, t.buttons)
310
- ])
311
- ]);
312
- }), At = (t) => H.render(t, app.root);
313
- class zt extends y {
314
- /**
315
- * This will declare the props for the compiler.
316
- *
317
- * @returns {void}
318
- */
319
- declareProps() {
320
- this.title = null, this.description = null, this.size = null, this.type = null, this.hidePrimaryButton = !1, this.hideFooter = !1, this.icon = null, this.onSubmit = null, this.onClose = null, this.back = !1;
321
- }
322
- /**
323
- * This will render the modal component.
324
- *
325
- * @returns {object}
326
- */
327
- render() {
328
- const e = this.getMainClass(), s = this.title || "", o = this.description || null;
329
- return Q(
330
- {
331
- class: e,
332
- title: s,
333
- description: o,
334
- options: this.headerOptions(),
335
- buttons: this.getButtons(),
336
- hideFooter: this.hideFooter,
337
- onSubmit: (i) => {
338
- let r = !0;
339
- this.onSubmit && (r = this.onSubmit(i)), r !== !1 && this.destroy();
340
- },
341
- icon: this.icon,
342
- back: this.back ?? !1,
343
- aria: { expanded: ["open"] }
344
- },
345
- this.children
346
- );
347
- }
348
- /**
349
- * This will setup the states.
350
- *
351
- * @returns {object}
352
- */
353
- setupStates() {
354
- return {
355
- open: {
356
- state: !1,
357
- callBack: (e) => {
358
- e || this.destroy();
359
- }
360
- }
361
- };
362
- }
363
- /**
364
- * This will get the header options.
365
- *
366
- * @returns {Array<object>}
367
- */
368
- headerOptions() {
369
- return [];
370
- }
371
- /**
372
- * This will get the buttons for the modal.
373
- *
374
- * @returns {array}
375
- */
376
- getButtons() {
377
- return [
378
- h({ variant: "outline", click: () => this.destroy() }, "Cancel"),
379
- this.hidePrimaryButton !== !0 && h({ variant: "primary", type: "submit" }, "Save")
380
- ];
381
- }
382
- /**
383
- * This will check if the click was outside the component.
384
- *
385
- * @param {object} element
386
- * @returns {boolean}
387
- */
388
- isOutsideClick(e) {
389
- return !this.panel.contains(e);
390
- }
391
- /**
392
- * This will get the size class.
393
- *
394
- * @returns {string}
395
- */
396
- getSizeClass() {
397
- switch (this.size) {
398
- // case 'sm':
399
- // return 'sm max-w-[646px]';
400
- case "lg":
401
- return "lg max-w-[900px]";
402
- case "xl":
403
- return "xl max-w-[1400px]";
404
- default:
405
- return "md max-w-[760px]";
406
- }
407
- }
408
- /**
409
- * This will get the type class.
410
- *
411
- * @returns {string}
412
- */
413
- getTypeClass() {
414
- switch (this.type) {
415
- case "right":
416
- return "right right-0";
417
- case "left":
418
- return "left left-0";
419
- case "drawer":
420
- return "drawer";
421
- default:
422
- return "";
423
- }
424
- }
425
- /**
426
- * This will get the modal class.
427
- *
428
- * @returns {string}
429
- */
430
- getMainClass() {
431
- return this.getSizeClass() + " " + this.getTypeClass();
432
- }
433
- /**
434
- * This will override the set up to use the app shell.
435
- *
436
- * @param {object} container
437
- */
438
- setContainer(e) {
439
- this.container = app.root;
440
- }
441
- /**
442
- * This will open the modal.
443
- *
444
- * @returns {void}
445
- */
446
- open() {
447
- At(this), this.showModal();
448
- }
449
- /**
450
- * This will destroy the modal.
451
- *
452
- * @returns {void}
453
- */
454
- close() {
455
- this.destroy();
456
- }
457
- /**
458
- * This will show the modal.
459
- *
460
- * @protected
461
- * @returns {void}
462
- */
463
- showModal() {
464
- globalThis.setTimeout(() => this.panel.showPopover(), 10), this.state.open = !0, document.documentElement.style.overflowY = "hidden";
465
- }
466
- /**
467
- * This will hide the modal.
468
- *
469
- * @protected
470
- * @returns {void}
471
- */
472
- beforeDestroy() {
473
- this?.panel?.hidePopover(), this.state.open = !1, typeof this.onClose == "function" && this.onClose(this), document.documentElement.style.overflowY = "auto";
474
- }
475
- }
476
- class Yt {
477
- /**
478
- * Creates an instance of DrawerGesture.
479
- *
480
- * @param {object} [options={}]
481
- * @param {HTMLElement} [options.modal=null] - The modal element (panel) reference
482
- * @param {HTMLElement} [options.modalContent=null] - The modal content element reference
483
- * @param {HTMLElement} [options.modalBody=null] - The scrollable body element reference
484
- * @param {number} [options.closeThreshold=150] - Pixels to drag before closing
485
- * @param {number} [options.snapThreshold=50] - Pixels to drag before snapping
486
- * @param {Function} [options.onClose=null] - Callback when drawer should close
487
- */
488
- constructor(e = {}) {
489
- const {
490
- modal: s = null,
491
- modalContent: o = null,
492
- modalBody: i = null,
493
- closeThreshold: r = 150,
494
- snapThreshold: l = 50,
495
- onClose: d = null
496
- } = e;
497
- this.modal = s, this.modalContent = o, this.modalBody = i, this.closeThreshold = r, this.snapThreshold = l, this.onClose = d, this.reset();
498
- }
499
- /**
500
- * Resets the drag state to initial values
501
- *
502
- * @returns {void}
503
- */
504
- reset() {
505
- this.state = {
506
- isDragging: !1,
507
- startY: 0,
508
- currentY: 0,
509
- startScrollTop: 0,
510
- canDrag: !1
511
- };
512
- }
513
- /**
514
- * Checks if the viewport is mobile size
515
- *
516
- * @returns {boolean}
517
- */
518
- isMobile() {
519
- return window.innerWidth < 1024;
520
- }
521
- /**
522
- * Handles touch start event
523
- *
524
- * @param {TouchEvent} e - The touch event
525
- * @returns {void}
526
- */
527
- handleTouchStart(e) {
528
- if (!this.modalBody)
529
- return;
530
- const s = e.touches[0];
531
- this.state.startY = s.clientY, this.state.currentY = s.clientY, this.state.startScrollTop = this.modalBody.scrollTop, this.state.canDrag = this.modalBody.scrollTop === 0;
532
- }
533
- /**
534
- * Handles touch move event
535
- *
536
- * @param {TouchEvent} e - The touch event
537
- * @returns {void}
538
- */
539
- handleTouchMove(e) {
540
- if (!this.modalContent || !this.modalBody)
541
- return;
542
- const s = e.touches[0];
543
- this.state.currentY = s.clientY;
544
- const o = this.getDeltaY();
545
- if (!this.state.isDragging && this.state.canDrag && o > 0 && this.modalBody.scrollTop === 0 && (this.state.isDragging = !0), this.state.isDragging && o > 0) {
546
- e.preventDefault();
547
- const i = this.calculateTranslateY(o);
548
- this.modalContent.style.transform = `translateY(${i}px)`, this.modalContent.style.transition = "none";
549
- const r = this.calculateBackdropOpacity(o);
550
- this.updateBackdropOpacity(r);
551
- } else this.modalBody.scrollTop > 0 && (this.state.canDrag = !1);
552
- }
553
- /**
554
- * Handles touch end event
555
- *
556
- * @param {TouchEvent} e - The touch event
557
- * @returns {void}
558
- */
559
- handleTouchEnd(e) {
560
- if (!this.modalContent)
561
- return;
562
- const s = this.getDeltaY();
563
- this.state.isDragging && (this.modalContent.style.transition = "transform 0.3s ease-out, opacity 0.3s ease-out", s > this.closeThreshold ? this.animateClose() : this.snapBack()), this.state.isDragging = !1, this.state.canDrag = !1;
564
- }
565
- /**
566
- * Gets current drag delta Y
567
- *
568
- * @returns {number} The vertical drag distance in pixels
569
- */
570
- getDeltaY() {
571
- return this.state.currentY - this.state.startY;
572
- }
573
- /**
574
- * Calculates translateY with rubber band damping effect.
575
- * The further you drag, the more resistance is applied.
576
- *
577
- * @param {number} deltaY - The raw drag distance
578
- * @returns {number} The damped translation distance
579
- */
580
- calculateTranslateY(e) {
581
- const s = 1 - e / (window.innerHeight * 2);
582
- return e * Math.max(s, 0.5);
583
- }
584
- /**
585
- * Calculates backdrop opacity based on drag distance.
586
- * Opacity decreases as the drawer is dragged down.
587
- *
588
- * @param {number} deltaY - The drag distance
589
- * @returns {number} Opacity value between 0 and 1
590
- */
591
- calculateBackdropOpacity(e) {
592
- return Math.max(0, 1 - e / this.closeThreshold);
593
- }
594
- /**
595
- * Updates the backdrop opacity via CSS custom property
596
- *
597
- * @param {number} opacity - The opacity value (0-1)
598
- * @returns {void}
599
- */
600
- updateBackdropOpacity(e) {
601
- this.modal && this.modal.style.setProperty("--backdrop-opacity", e.toString());
602
- }
603
- /**
604
- * Animates the drawer closing by translating the entire modal off-screen
605
- *
606
- * @returns {void}
607
- */
608
- animateClose() {
609
- !this.modal || !this.modalContent || (this.modalContent.style.transform = "translateY(0)", this.modalContent.style.transition = "none", this.modal.style.transition = "transform 0.3s ease-out, opacity 0.3s ease-out", this.modal.style.transform = "translateY(100%)", this.updateBackdropOpacity(0), setTimeout(() => {
610
- this.onClose && this.onClose();
611
- }, 300));
612
- }
613
- /**
614
- * Snaps the drawer back to its original position
615
- *
616
- * @returns {void}
617
- */
618
- snapBack() {
619
- this.modalContent && (this.modalContent.style.transform = "translateY(0)", this.updateBackdropOpacity(1));
620
- }
621
- /**
622
- * Checks if currently dragging
623
- *
624
- * @returns {boolean}
625
- */
626
- isDragging() {
627
- return this.state.isDragging;
628
- }
629
- /**
630
- * Cleans up resources and resets state
631
- *
632
- * @returns {void}
633
- */
634
- destroy() {
635
- this.reset(), this.modal = null, this.onClose = null;
636
- }
637
- }
638
- class Je extends zt {
639
- /**
640
- * Declares the component props
641
- *
642
- * @returns {void}
643
- */
644
- declareProps() {
645
- super.declareProps(), this.type = "drawer", this.swipeToClose = !0, this.closeThreshold = 150, this.snapThreshold = 50, this.gesture = null, this.modalContent = null, this.modalBody = null;
646
- }
647
- /**
648
- * Gets extra props to pass to ModalContainer
649
- *
650
- * @returns {object}
651
- */
652
- getContainerProps() {
653
- const e = {};
654
- return this.swipeToClose && (e.gestureHandlers = this.getGestureHandlers()), e;
655
- }
656
- /**
657
- * Renders the drawer with gesture handlers
658
- *
659
- * @returns {object}
660
- */
661
- render() {
662
- const e = this.getMainClass(), s = this.title || "", o = this.description || null, i = this.getContainerProps();
663
- return Q(
664
- {
665
- class: e,
666
- title: s,
667
- description: o,
668
- options: this.headerOptions(),
669
- buttons: this.getButtons(),
670
- hideFooter: this.hideFooter,
671
- onSubmit: (r) => {
672
- let l = !0;
673
- this.onSubmit && (l = this.onSubmit(r)), l !== !1 && this.destroy();
674
- },
675
- icon: this.icon,
676
- back: this.back ?? !1,
677
- aria: { expanded: ["open"] },
678
- ...i
679
- },
680
- this.children
681
- );
682
- }
683
- /**
684
- * Shows the modal and initializes gesture handling
685
- *
686
- * @protected
687
- * @returns {void}
688
- */
689
- showModal() {
690
- super.showModal(), this.swipeToClose && !this.gesture && (this.gesture = new Yt({
691
- // @ts-ignore
692
- modal: this.panel,
693
- // @ts-ignore
694
- modalContent: this.modalContent,
695
- // @ts-ignore
696
- modalBody: this.modalBody,
697
- closeThreshold: this.closeThreshold,
698
- snapThreshold: this.snapThreshold,
699
- onClose: () => this.destroy()
700
- }));
701
- }
702
- /**
703
- * Gets gesture event handlers for modal content.
704
- * Returns event props to be spread onto the modal-content element.
705
- * Handlers are bound methods that will work once gesture is initialized.
706
- *
707
- * @returns {object}
708
- */
709
- getGestureHandlers() {
710
- return this.swipeToClose ? {
711
- touchstart: (e) => this.gesture?.handleTouchStart(e),
712
- touchmove: (e) => this.gesture?.handleTouchMove(e),
713
- touchend: (e) => this.gesture?.handleTouchEnd(e)
714
- } : {};
715
- }
716
- /**
717
- * Cleans up before destroy
718
- *
719
- * @protected
720
- * @returns {void}
721
- */
722
- beforeDestroy() {
723
- this.gesture && (this.gesture.destroy(), this.gesture = null), super.beforeDestroy();
724
- }
725
- }
726
- const j = {
727
- info: {
728
- bgColor: "bg-muted/10",
729
- borderColor: "border-blue-500",
730
- iconColor: "text-blue-500"
731
- },
732
- warning: {
733
- bgColor: "bg-muted/10",
734
- borderColor: "border-warning",
735
- iconColor: "text-warning"
736
- },
737
- destructive: {
738
- bgColor: "bg-muted/10",
739
- borderColor: "border-destructive",
740
- iconColor: "text-red-500"
741
- },
742
- success: {
743
- bgColor: "bg-muted/10",
744
- borderColor: "border-emerald-500",
745
- iconColor: "text-emerald-500"
746
- },
747
- default: {
748
- bgColor: "bg-muted/10",
749
- borderColor: "border",
750
- iconColor: "text-muted-foreground"
751
- }
752
- }, jt = (t) => B({ class: "flex justify-center" }, [
753
- ot({ class: "text-lg font-bold mb-0" }, t)
754
- ]), Et = c(({ href: t, class: e }, s) => G({
755
- class: `bg-popover text-popover-foreground relative flex flex-auto flex-col justify-start shadow-lg pointer-events-auto p-4 border rounded-md min-w-[340px] max-w-[450px] mt-4 ${e}`,
756
- href: t,
757
- animateIn: "pullRightIn",
758
- animateOut: "pullRight",
759
- role: "alert"
760
- }, s)), Nt = c(({ close: t, class: e }, s) => n({
761
- class: `pullRightIn bg-popover text-popover-foreground relative flex flex-auto flex-col justify-start shadow-lg pointer-events-auto p-4 border rounded-md min-w-[340px] max-w-[450px] mt-4 ${e}`,
762
- click: () => t(),
763
- animateIn: "pullRightIn",
764
- animateOut: "pullRight",
765
- role: "alert"
766
- }, s));
767
- class Ut extends y {
768
- /**
769
- * This will declare the props for the compiler.
770
- *
771
- * @returns {void}
772
- */
773
- declareProps() {
774
- this.secondaryAction = null, this.primaryAction = null, this.primary = !1, this.secondary = !1, this.title = null, this.description = null, this.icon = null, this.onClick = null;
775
- }
776
- /**
777
- * This will be called when the component is created.
778
- *
779
- * @returns {void}
780
- */
781
- onCreated() {
782
- this.duration = this.duration || 4e3;
783
- }
784
- /**
785
- * This will render the component.
786
- *
787
- * @returns {object}
788
- */
789
- render() {
790
- const { bgColor: e, borderColor: s, iconColor: o } = this.getTypeStyles(), i = this.href || null, r = this.getChildren(o);
791
- return i ? Et({
792
- href: i,
793
- class: `${e} ${s}`
794
- }, r) : Nt({
795
- close: this.close.bind(this),
796
- class: `${e} ${s}`
797
- }, r);
798
- }
799
- /**
800
- * This will be called after the component is set up.
801
- *
802
- * @returns {void}
803
- */
804
- afterSetup() {
805
- const e = this.duration;
806
- e !== "infinite" && (this.timer = new ut(e, this.close.bind(this)), this.timer.start());
807
- }
808
- /**
809
- * This will get the style properties based on the notification type.
810
- *
811
- * @returns {object}
812
- */
813
- getTypeStyles() {
814
- const e = this.type || "default";
815
- return j[e] || j.default;
816
- }
817
- /**
818
- * This will get the buttons for the notification.
819
- *
820
- * @returns {array}
821
- */
822
- getButtons() {
823
- return [
824
- n({ class: "flex flex-row mt-6 gap-2" }, [
825
- this.secondary && h({ variant: "outline", click: () => this.secondaryAction && this.secondaryAction() }, this.secondary),
826
- this.primary && h({ click: () => this.primaryAction && this.primaryAction() }, this.primary)
827
- ])
828
- ];
829
- }
830
- /**
831
- * This will get the children for the notification.
832
- *
833
- * @param {string} iconColor
834
- * @returns {array}
835
- */
836
- getChildren(e) {
837
- return [
838
- n({ class: "flex items-start" }, [
839
- this.icon && n({ class: `mr-4 ${e}` }, [
840
- m({ size: "md" }, this.icon)
841
- ]),
842
- n({ class: "flex flex-auto flex-col" }, [
843
- n({ class: "flex flex-auto flex-row items-center w-full pr-12" }, [
844
- this.title && jt(this.title)
845
- ]),
846
- b({ class: "text-base text-muted-foreground m-0 pr-12" }, this.description),
847
- (this.primary || this.secondary) && L({ class: "margin-top-24 flex align-center" }, this.getButtons())
848
- ])
849
- ]),
850
- h({
851
- class: "absolute top-[12px] right-[12px]",
852
- variant: "icon",
853
- icon: u.x,
854
- click: this.close.bind(this)
855
- })
856
- ];
857
- }
858
- /**
859
- * This will close the notification.
860
- *
861
- * @param {object} e The event object.
862
- * @returns {void}
863
- */
864
- close(e) {
865
- e && e.stopPropagation(), this.duration !== "infinite" && this.timer.stop(), this.onClick && this.onClick(), this.destroy();
866
- }
867
- }
868
- let Rt = 0;
869
- class Ke extends y {
870
- /**
871
- * This will render the component.
872
- *
873
- * @returns {object}
874
- */
875
- render() {
876
- return n({ class: "notification-container pointer-events-none inset-auto bg-transparent backdrop:bg-transparent overflow-visible fixed bottom-[80px] right-0 z-50 p-5", popover: "manual" }, [
877
- new ht({
878
- cache: "list",
879
- key: "id",
880
- role: "list",
881
- rowItem: (e) => new Ut(e)
882
- })
883
- ]);
884
- }
885
- /**
886
- * This will add a notification.
887
- *
888
- * @param {object} props
889
- * @returns {void}
890
- */
891
- addNotice(e = {}) {
892
- e.id = Rt++, e.callBack = () => this.removeNotice(e), this?.list?.append([e]), this?.panel?.hidePopover(), this?.panel?.showPopover();
893
- }
894
- /**
895
- * This will remove a notification.
896
- *
897
- * @param {object} notice
898
- * @returns {void}
899
- */
900
- removeNotice(e) {
901
- this?.list?.delete(e.id), this?.list?.isEmpty() && this?.panel?.hidePopover();
902
- }
903
- }
904
- const E = globalThis.matchMedia, F = c(({ value: t, label: e, icon: s }) => p({
905
- class: 'text-sm gap-1 font-medium leading-none disabled:cursor-not-allowed disabled:opacity-70 flex flex-col items-center justify-between rounded-md border-2 bg-popover p-4 hover:bg-accent hover:text-accent-foreground data-[state="active"]:border-primary [&:has([data-state="active"])]:border-primary',
906
- onState: ["method", { active: t }],
907
- dataSet: ["method", ["state", t, "active"]],
908
- click: (o, { state: i }) => {
909
- i.method = t, localStorage.setItem("theme", t), t === "system" && localStorage.removeItem("theme"), Ht(t);
910
- }
911
- }, [
912
- m({}, s),
913
- a(e)
914
- ])), Ht = (t) => {
915
- const e = document.documentElement;
916
- if (t === "system" && (t = globalThis.matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light"), E && !E("(prefers-color-scheme: " + t + ")").matches) {
917
- e.classList.add(t);
918
- return;
919
- }
920
- const s = t === "light" ? "dark" : "light";
921
- e.classList.remove(s);
922
- }, Qe = w(
923
- {
924
- /**
925
- * This will render the component.
926
- *
927
- * @returns {object}
928
- */
929
- render() {
930
- return n({ class: "flex flex-auto flex-col" }, [
931
- n({ class: "grid grid-cols-3 gap-4" }, [
932
- F({ label: "System", value: "system", icon: u.adjustments.horizontal }),
933
- F({ label: "Light", value: "light", icon: u.sun }),
934
- F({ label: "Dark", value: "dark", icon: u.moon })
935
- ])
936
- ]);
937
- },
938
- /**
939
- * This will setup the states.
940
- *
941
- * @returns {object}
942
- */
943
- state() {
944
- return {
945
- method: globalThis.localStorage.getItem("theme") ?? "system"
946
- };
947
- }
948
- }
949
- ), Xe = C(
950
- {
951
- /**
952
- * The initial state of the Toggle.
953
- *
954
- * @returns {object}
955
- */
956
- state() {
957
- return {
958
- active: this.active ?? !1
959
- };
960
- },
961
- /**
962
- * This is added to check the checkbox after the component is rendered.
963
- * to see if the bind updated the checked value.
964
- *
965
- * @returns {void}
966
- */
967
- after() {
968
- this.state.active = this.checkbox.checked;
969
- },
970
- /**
971
- * Renders the Toggle component.
972
- *
973
- * @returns {object}
974
- */
975
- render() {
976
- return p({
977
- class: "relative inline-flex h-6 w-11 min-w-11 items-center rounded-full bg-muted transition-colors focus:outline-none",
978
- onState: ["active", { "bg-primary": !0, "bg-muted": !1 }],
979
- click: (e, { state: s }) => {
980
- s.toggle("active"), this.checkbox.checked = s.active, this.change && this.change(s.active, e, this);
981
- }
982
- }, [
983
- nt({
984
- cache: "checkbox",
985
- class: "opacity-0 absolute top-0 left-0 bottom-0 right-0 w-full h-full",
986
- /**
987
- * This will add the default checked before binding.
988
- * If binding it will override the default checked value.
989
- */
990
- checked: this.state.active,
991
- bind: this.bind,
992
- required: this.required
993
- }),
994
- a({
995
- class: "absolute h-5 w-5 bg-background rounded-full shadow-md transform transition-transform",
996
- onState: ["active", { "translate-x-[22px]": !0, "translate-x-[2px]": !1 }]
997
- })
998
- ]);
999
- }
1000
- }
1001
- ), D = {
1002
- ONLINE: "online",
1003
- OFFLINE: "offline",
1004
- BUSY: "busy",
1005
- AWAY: "away"
1006
- }, x = {
1007
- ONLINE: "bg-green-500",
1008
- OFFLINE: "bg-gray-500",
1009
- BUSY: "bg-red-500",
1010
- AWAY: "bg-yellow-500"
1011
- }, qt = (t = "") => (t = t.toUpperCase(), x[t] || x.OFFLINE), Ze = (t) => n({
1012
- class: `absolute bottom-0 right-0 w-3 h-3 border-2 rounded-full ${qt(t)}`
1013
- }), ts = ({ propName: t = "status" } = {}) => n({
1014
- class: "absolute bottom-0 right-0 w-3 h-3 border-2 rounded-full",
1015
- onSet: [t, {
1016
- [x.ONLINE]: D.ONLINE,
1017
- [x.OFFLINE]: D.OFFLINE,
1018
- [x.BUSY]: D.BUSY,
1019
- [x.AWAY]: D.AWAY
1020
- }]
1021
- }), Vt = (t) => t.indexOf(".") === -1 && t.indexOf("[[") === -1 && t.indexOf("blob:") === -1, es = w(
1022
- {
1023
- /**
1024
- * Get the initial state for the component.
1025
- *
1026
- * @returns {object} Initial state for the component
1027
- */
1028
- state() {
1029
- return {
1030
- // @ts-ignore
1031
- loaded: !!this.src
1032
- };
1033
- },
1034
- /**
1035
- * This will open the file browse dialog.
1036
- *
1037
- * @returns {void}
1038
- */
1039
- openFileBrowse() {
1040
- const t = this.input;
1041
- t && (t.value = "", g.trigger("click", t));
1042
- },
1043
- /**
1044
- * Get the URL for the uploaded file.
1045
- *
1046
- * @param {File} file - The file to get the URL for.
1047
- * @returns {string} The object URL for the file.
1048
- */
1049
- getFileUrl(t) {
1050
- return this.url && URL.revokeObjectURL(this.url), this.url = URL.createObjectURL(t);
1051
- },
1052
- /**
1053
- * Render the component.
1054
- *
1055
- * @returns {object} Rendered component
1056
- */
1057
- render() {
1058
- const t = "image-upload", e = this.onChange || null;
1059
- return n({ class: "flex-none items-center" }, [
1060
- f({
1061
- id: t,
1062
- cache: "input",
1063
- type: "file",
1064
- accept: "image/*",
1065
- class: "hidden",
1066
- change: (s) => {
1067
- const o = s.target.files?.[0];
1068
- o && e && (this.state.loaded = !1, e(o, this.parent), this.src = this.getFileUrl(o), this.state.loaded = !0);
1069
- }
1070
- }),
1071
- n({
1072
- class: "relative w-32 h-32 rounded-full border flex items-center justify-center cursor-pointer hover:bg-muted transition-colors duration-150 overflow-hidden group",
1073
- click: (s) => {
1074
- s.preventDefault(), s.stopPropagation(), this.openFileBrowse();
1075
- }
1076
- }, [
1077
- I("loaded", (s) => s === !1 || Vt(this.src) ? P({
1078
- htmlFor: t,
1079
- class: "z-10 flex flex-col items-center justify-center text-sm text-muted-foreground group-hover:text-primary"
1080
- }, [
1081
- dt(u.upload),
1082
- n("Upload Image")
1083
- ]) : W({
1084
- // @ts-ignore
1085
- src: this.src,
1086
- class: "absolute inset-0 w-full h-full object-cover rounded-full"
1087
- }))
1088
- ])
1089
- ]);
1090
- }
1091
- }
1092
- ), ss = w(
1093
- {
1094
- /**
1095
- * Get the initial state for the component.
1096
- *
1097
- * @returns {object} Initial state for the component
1098
- */
1099
- state() {
1100
- return {
1101
- // @ts-ignore
1102
- loaded: !!this.src
1103
- };
1104
- },
1105
- /**
1106
- * This will open the file browse dialog.
1107
- *
1108
- * @returns {void}
1109
- */
1110
- openFileBrowse() {
1111
- const t = this.input;
1112
- t && (t.value = "", g.trigger("click", t));
1113
- },
1114
- /**
1115
- * Get the URL for the uploaded file.
1116
- *
1117
- * @param {File} file - The file to get the URL for.
1118
- * @returns {string} The object URL for the file.
1119
- */
1120
- getFileUrl(t) {
1121
- return this.url && URL.revokeObjectURL(this.url), this.url = URL.createObjectURL(t);
1122
- },
1123
- /**
1124
- * Render the component.
1125
- *
1126
- * @returns {object} Rendered component
1127
- */
1128
- render() {
1129
- const t = "logo-upload", e = this.onChange || null;
1130
- return n({ class: "flex-none items-center" }, [
1131
- f({
1132
- id: t,
1133
- cache: "input",
1134
- type: "file",
1135
- accept: "image/*",
1136
- class: "hidden",
1137
- change: (s) => {
1138
- const o = s.target.files?.[0];
1139
- o && e && (this.state.loaded = !1, e(o, this.parent), this.src = this.getFileUrl(o), this.state.loaded = !0);
1140
- }
1141
- }),
1142
- n({
1143
- class: "relative w-32 h-32 rounded-full border flex items-center justify-center cursor-pointer hover:bg-muted transition-colors duration-150 overflow-hidden group",
1144
- click: (s) => {
1145
- s.preventDefault(), s.stopPropagation(), this.openFileBrowse();
1146
- }
1147
- }, [
1148
- I(
1149
- "loaded",
1150
- (s) => s ? W({
1151
- // @ts-ignore
1152
- src: this.src,
1153
- class: "absolute inset-0 w-full h-full object-cover rounded-full"
1154
- }) : P({
1155
- htmlFor: t,
1156
- class: "z-10 flex flex-col items-center justify-center text-sm text-muted-foreground group-hover:text-primary"
1157
- }, [
1158
- m({}, u.upload),
1159
- n("Upload logo")
1160
- ])
1161
- )
1162
- ])
1163
- ]);
1164
- },
1165
- /**
1166
- * Cleanup before destroying the component.
1167
- *
1168
- * @returns {void}
1169
- */
1170
- destroy() {
1171
- this.input = null;
1172
- }
1173
- }
1174
- ), Gt = (t, e) => G(
1175
- {
1176
- href: t,
1177
- "aria-current": e === "Breadcrumb" && "page",
1178
- // Only set aria-current on the last item
1179
- class: "text-muted-foreground font-medium hover:text-foreground"
1180
- },
1181
- [a(e)]
1182
- ), Wt = () => m({
1183
- class: "mx-3 text-muted-foreground",
1184
- "aria-hidden": !0,
1185
- size: "xs"
1186
- }, u.chevron.single.right), _t = (t) => n({ class: "flex items-center" }, [
1187
- t.href ? Gt(t.href, t.label) : a(t.label),
1188
- t.separator && Wt()
1189
- ]), os = w(
1190
- {
1191
- /**
1192
- * Set initial data
1193
- *
1194
- * @returns {Data}
1195
- */
1196
- setData() {
1197
- return new k({
1198
- // @ts-ignore
1199
- items: this.items || []
1200
- });
1201
- },
1202
- /**
1203
- * Render Breadcrumb Component
1204
- *
1205
- * @returns {object}
1206
- */
1207
- render() {
1208
- const t = this.data.items.length - 1;
1209
- return it(
1210
- {
1211
- "aria-label": "Breadcrumb",
1212
- class: "flex items-center gap-x-1 text-sm"
1213
- },
1214
- [
1215
- n({
1216
- role: "list",
1217
- class: "flex items-center",
1218
- for: ["items", (e, s) => _t({
1219
- href: e.href,
1220
- label: e.label,
1221
- separator: s < t
1222
- })]
1223
- })
1224
- ]
1225
- );
1226
- }
1227
- }
1228
- ), N = {
1229
- xs: "h-1 w-1",
1230
- sm: "h-2 w-2",
1231
- md: "h-4 w-4",
1232
- lg: "h-8 w-8",
1233
- xl: "h-12 w-12",
1234
- "2xl": "h-16 w-16",
1235
- "3xl": "h-24 w-24",
1236
- default: "h-4 w-4"
1237
- }, Jt = (t) => N[t] || N.default, Kt = ({ index: t, size: e }) => n({ class: `${e} rounded-full bg-muted cursor-pointer` }, [
1238
- a({
1239
- class: "block w-full h-full rounded-full transition-colors",
1240
- onSet: ["activeIndex", {
1241
- "bg-primary": t,
1242
- "shadow-md": t
1243
- }],
1244
- click: (s, { data: o, onClick: i }) => {
1245
- o.activeIndex = t, i && i(t);
1246
- }
1247
- })
1248
- ]), Qt = (t, e) => Array.from({ length: t }, (s, o) => Kt({
1249
- index: o,
1250
- size: e
1251
- })), ns = w(
1252
- {
1253
- /**
1254
- * Defines component data (props).
1255
- *
1256
- * @returns {Data}
1257
- */
1258
- setData() {
1259
- return new k({
1260
- // @ts-ignore
1261
- count: this.count || 4,
1262
- // total dots
1263
- // @ts-ignore
1264
- activeIndex: this.activeIndex || 0
1265
- });
1266
- },
1267
- /**
1268
- * Renders the dots.
1269
- *
1270
- * @returns {object}
1271
- */
1272
- render() {
1273
- const t = this.gap || "gap-2", e = Jt(this.size || "sm"), s = Qt(this.data.count, e);
1274
- return n(
1275
- { class: "flex justify-center items-center py-2" },
1276
- [
1277
- n({ class: `flex ${t}` }, s)
1278
- ]
1279
- );
1280
- }
1281
- }
1282
- ), Xt = ({ toggleDropdown: t }) => p(
1283
- {
1284
- cache: "button",
1285
- class: "relative z-2 inline-flex items-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 border bg-input hover:bg-muted h-10 px-4 py-2 justify-between",
1286
- click: t
1287
- },
1288
- [
1289
- a({ onState: ["selectedLabel", (e) => e || "Select item..."] }),
1290
- m({ size: "sm" }, u.chevron.upDown)
1291
- ]
1292
- ), Zt = (t, e, s) => q({
1293
- class: "flex flex-auto items-center cursor-pointer p-2 hover:bg-muted/50 rounded-sm",
1294
- click: () => e(t),
1295
- onState: [s, "selectedValue", { "bg-secondary": t.value }]
1296
- }, [
1297
- t.icon && a({ class: "mr-2 flex items-baseline" }, [m({ size: "xs" }, t.icon)]),
1298
- a({ class: "text-base font-normal" }, t.label)
1299
- ]), te = (t, e) => n({ class: "w-full border rounded-md" }, [
1300
- V({ class: "max-h-60 overflow-y-auto p-2 grid gap-1", for: ["items", (s) => Zt(s, t, e)] })
1301
- ]), ee = ({ onSelect: t, state: e }) => n({ class: "flex flex-auto flex-col" }, [
1302
- I(
1303
- "open",
1304
- (s, o, i) => s ? new S({
1305
- cache: "dropdown",
1306
- parent: i,
1307
- button: i.button
1308
- }, [
1309
- te(t, e)
1310
- ]) : null
1311
- )
1312
- ]), is = w(
1313
- {
1314
- /**
1315
- * This will set up the data.
1316
- *
1317
- * @returns {Data}
1318
- */
1319
- setData() {
1320
- return new k({
1321
- // @ts-ignore
1322
- items: this.items || []
1323
- });
1324
- },
1325
- /**
1326
- * This will set up the states.
1327
- *
1328
- * @returns {object}
1329
- */
1330
- state() {
1331
- return {
1332
- open: !1,
1333
- selectedLabel: "",
1334
- selectedValue: ""
1335
- };
1336
- },
1337
- /**
1338
- * This will set the state item.
1339
- *
1340
- * @param {object} item
1341
- * @returns {void}
1342
- */
1343
- setStateItem(t) {
1344
- const e = this.state;
1345
- e.selectedValue = t.value, e.selectedLabel = t.label, e.open = !1;
1346
- },
1347
- /**
1348
- * Handles the selection of an item.
1349
- *
1350
- * @param {object} item
1351
- * @returns {void}
1352
- */
1353
- select(t) {
1354
- this.setStateItem(t), typeof this.onSelect == "function" && this.onSelect(t, this.parent);
1355
- },
1356
- /**
1357
- * Selects the first item in the list.
1358
- *
1359
- * @returns {void}
1360
- */
1361
- selectFirstItem() {
1362
- const t = this.data.items[0];
1363
- this.select(t);
1364
- },
1365
- /**
1366
- * Toggles the dropdown open state.
1367
- *
1368
- * @returns {void}
1369
- */
1370
- toggleDropdown() {
1371
- this.state.toggle("open");
1372
- },
1373
- /**
1374
- * This will run after the component is set up.
1375
- *
1376
- * @returns {void}
1377
- */
1378
- after() {
1379
- if (this.selectFirst === !0 && this.state.selectedValue === "") {
1380
- const t = this.data.items[0];
1381
- t && this.setStateItem(t);
1382
- }
1383
- },
1384
- /**
1385
- * This will render the component.
1386
- *
1387
- * @returns {object}
1388
- */
1389
- render() {
1390
- const t = this.class || "", e = this.maxWidth || "max-w-[250px]", s = this.width || "w-full";
1391
- return n({ class: `relative ${s} flex flex-auto flex-col ${e} ${t}` }, [
1392
- // @ts-ignore
1393
- Xt({ toggleDropdown: this.toggleDropdown.bind(this) }),
1394
- ee({
1395
- // @ts-ignore
1396
- state: this.state,
1397
- // @ts-ignore
1398
- onSelect: this.select.bind(this)
1399
- }),
1400
- // Hidden required input for form validation
1401
- // @ts-ignore
1402
- this.required && f({
1403
- class: "opacity-0 absolute top-0 left-0 z-1",
1404
- type: "text",
1405
- // @ts-ignore
1406
- name: this.name,
1407
- required: !0,
1408
- // @ts-ignore
1409
- value: ["[[selectedValue]]", this.state]
1410
- })
1411
- ]);
1412
- }
1413
- }
1414
- ), X = ({ icon: t, click: e, ariaLabel: s }) => h({
1415
- variant: "icon",
1416
- class: "flex flex-none",
1417
- click: e,
1418
- icon: t,
1419
- "aria-label": s
1420
- }), se = ({ click: t }) => X({
1421
- icon: u.circleMinus,
1422
- click: t,
1423
- ariaLabel: "Decrement"
1424
- }), oe = ({ click: t }) => X({
1425
- icon: u.circlePlus,
1426
- click: t,
1427
- ariaLabel: "Increment"
1428
- }), ne = ({ bind: t, min: e, max: s, readonly: o = !1 }) => _(({ state: i }) => f({
1429
- value: ["[[count]]", i],
1430
- bind: t,
1431
- blur: (r, { state: l }) => {
1432
- let d = parseInt(r.target.value, 10);
1433
- isNaN(d) && (d = e ?? 0), e !== void 0 && (d = Math.max(d, e)), s !== void 0 && (d = Math.min(d, s)), l.count = d;
1434
- },
1435
- class: "flex flex-auto text-lg font-medium bg-input text-center border min-w-0",
1436
- readonly: o,
1437
- min: e,
1438
- max: s,
1439
- type: "number",
1440
- "aria-label": "Counter"
1441
- })), rs = C(
1442
- {
1443
- /**
1444
- * Initial state for the counter component.
1445
- *
1446
- * @member {object} state
1447
- */
1448
- state() {
1449
- return {
1450
- count: {
1451
- state: this.initialCount ?? 0,
1452
- callBack: (t) => this.change && this.change(t)
1453
- }
1454
- };
1455
- },
1456
- /**
1457
- * Renders the Counter component.
1458
- *
1459
- * @returns {object}
1460
- */
1461
- render() {
1462
- const t = this.class ?? "";
1463
- return n({ class: `flex flex-auto items-center justify-between gap-x-4 p-4 ${t}` }, [
1464
- se({ click: () => this.state.decrement("count") }),
1465
- ne({
1466
- bind: this.bind,
1467
- readonly: this.readonly,
1468
- min: this.min,
1469
- max: this.max
1470
- }),
1471
- oe({ click: () => this.state.increment("count") })
1472
- ]);
1473
- }
1474
- }
1475
- ), ie = (t) => {
1476
- let e = "";
1477
- return t.length > 0 && (e = t.substring(0, 2), t.length > 2 && (e += "/" + t.substring(2, 4), t.length > 4 && (e += "/" + t.substring(4, 8)))), e;
1478
- }, re = (t) => {
1479
- if (t.length !== 8)
1480
- return null;
1481
- const e = parseInt(t.substring(0, 2), 10), s = parseInt(t.substring(2, 4), 10), o = parseInt(t.substring(4, 8), 10);
1482
- return e >= 1 && e <= 12 && s >= 1 && s <= 31 && o >= 1900 ? `${o}-${e.toString().padStart(2, "0")}-${s.toString().padStart(2, "0")}` : null;
1483
- }, le = ({ bind: t, required: e }) => f({
1484
- cache: "input",
1485
- class: "opacity-0 absolute top-0 left-0 w-full h-full pointer-events-none",
1486
- bind: t,
1487
- required: e
1488
- }), ae = ({ placeholder: t, handleInputChange: e, handleInputFocus: s }) => f({
1489
- cache: "dateInput",
1490
- class: "flex-1 bg-transparent outline-none placeholder:text-muted-foreground border-0",
1491
- placeholder: t || "mm/dd/yyyy",
1492
- input: e,
1493
- focus: s,
1494
- onState: ["selectedDate", (o) => o ? M.format("standard", o) : ""]
1495
- }), ce = ({ bind: t, required: e, toggleOpen: s, handleInputChange: o, handleInputFocus: i, placeholder: r }) => n(
1496
- {
1497
- class: "relative flex items-center gap-2 w-full justify-between border bg-input hover:bg-muted rounded-md h-10 pr-4 py-2"
1498
- },
1499
- [
1500
- le({ bind: t, required: e }),
1501
- ae({ placeholder: r, handleInputChange: o, handleInputFocus: i }),
1502
- p(
1503
- {
1504
- class: "shrink-0 hover:bg-muted/50 rounded p-1 cursor-pointer",
1505
- click: s
1506
- },
1507
- [
1508
- T({ html: u.calendar.days })
1509
- ]
1510
- )
1511
- ]
1512
- ), de = ({ handleDateSelect: t, blockPriorDates: e }) => O(
1513
- (s, o, i) => new S({
1514
- cache: "dropdown",
1515
- parent: i,
1516
- button: i.panel,
1517
- size: "fit"
1518
- }, [
1519
- new at({
1520
- selectedDate: i.state.selectedDate,
1521
- selectedCallBack: t,
1522
- blockPriorDates: e
1523
- })
1524
- ])
1525
- ), ls = C(
1526
- {
1527
- /**
1528
- * The initial state of the DatePicker.
1529
- *
1530
- * @member {object} state
1531
- */
1532
- state() {
1533
- return {
1534
- selectedDate: this.selectedDate ?? null,
1535
- open: !1
1536
- };
1537
- },
1538
- /**
1539
- * This is added to check the input after the component is rendered.
1540
- * to see if the bind updated the input value.
1541
- *
1542
- * @returns {void}
1543
- */
1544
- after() {
1545
- this.input.value && (this.state.selectedDate = this.input.value);
1546
- },
1547
- /**
1548
- * Handles direct input changes and formats the date.
1549
- *
1550
- * @param {Event} e
1551
- */
1552
- handleInputChange(t) {
1553
- const s = t.target.value.replace(/\D/g, "");
1554
- t.target.value = ie(s);
1555
- const o = re(s);
1556
- o && (this.state.selectedDate = o, this.input.value = o, g.trigger("change", this.input), typeof this.onChange == "function" && this.onChange(o));
1557
- },
1558
- /**
1559
- * Handles input focus - select all text for easy editing.
1560
- *
1561
- * @param {Event} e
1562
- */
1563
- handleInputFocus(t) {
1564
- t.target.select();
1565
- },
1566
- /**
1567
- * Handles date selection from calendar.
1568
- *
1569
- * @param {string} date
1570
- */
1571
- handleDateSelect(t) {
1572
- this.state.selectedDate = t, this.state.open = !1, this.input.value = t, g.trigger("change", this.input), typeof this.onChange == "function" && this.onChange(t);
1573
- },
1574
- /**
1575
- * Toggles the calendar popover.
1576
- *
1577
- * @param {Event} e
1578
- * @param {object} context
1579
- */
1580
- toggleOpen(t, { state: e }) {
1581
- e.toggle("open");
1582
- },
1583
- /**
1584
- * Renders the DatePicker component.
1585
- *
1586
- * @returns {object}
1587
- */
1588
- render() {
1589
- return n(
1590
- { class: "relative w-full max-w-[320px]" },
1591
- [
1592
- ce({
1593
- toggleOpen: this.toggleOpen.bind(this),
1594
- bind: this.bind,
1595
- required: this.required,
1596
- handleInputChange: this.handleInputChange.bind(this),
1597
- handleInputFocus: this.handleInputFocus.bind(this),
1598
- placeholder: this.placeholder
1599
- }),
1600
- de({
1601
- handleDateSelect: this.handleDateSelect.bind(this),
1602
- blockPriorDates: this.blockPriorDates || !1
1603
- })
1604
- ]
1605
- );
1606
- }
1607
- }
1608
- ), ue = ({ bind: t, required: e }) => f({
1609
- cache: "input",
1610
- class: "opacity-0 absolute top-0 left-0 w-full h-full pointer-events-none",
1611
- bind: t,
1612
- required: e
1613
- }), he = ({ bind: t, required: e, toggleOpen: s }) => p({
1614
- class: "relative flex items-center gap-2 w-full justify-between border bg-input hover:bg-muted rounded-md h-10 px-4 py-2",
1615
- click: s
1616
- }, [
1617
- ue({ bind: t, required: e }),
1618
- _(({ state: o }) => [
1619
- a(z.date(["[[start]]", o], "Start Date")),
1620
- a(" - "),
1621
- a(z.date(["[[end]]", o], "End Date"))
1622
- ]),
1623
- T({ html: u.calendar.days })
1624
- ]), me = ({ handleDateSelect: t, blockPriorDates: e }) => O((s, o, i) => new S({
1625
- cache: "dropdown",
1626
- parent: i,
1627
- button: i.panel,
1628
- size: "xl"
1629
- }, [
1630
- new ct({
1631
- startDate: i.state.start,
1632
- endDate: i.state.end,
1633
- onRangeSelect: t,
1634
- blockPriorDates: e
1635
- })
1636
- ])), as = C(
1637
- {
1638
- /**
1639
- * The initial state of the DateRangePicker.
1640
- *
1641
- * @member {object} state
1642
- */
1643
- state() {
1644
- return {
1645
- start: this.start ?? null,
1646
- end: this.end ?? null,
1647
- open: !1
1648
- };
1649
- },
1650
- /**
1651
- * This is added to check the input after the component is rendered.
1652
- * to see if the bind updated the input value.
1653
- *
1654
- * @returns {void}
1655
- */
1656
- after() {
1657
- if (this.input.value) {
1658
- const t = this.input.value.split("-");
1659
- this.state.start = t[0], this.state.end = t[1];
1660
- }
1661
- },
1662
- /**
1663
- * Renders the DatePicker component.
1664
- *
1665
- * @returns {object}
1666
- */
1667
- render() {
1668
- const t = (s, { state: o }) => o.toggle("open"), e = (s, o) => {
1669
- this.state.start = s, this.state.end = o, this.state.open = !1, this.input.value = `${s}-${o}`, g.trigger("change", this.input), typeof this.onChange == "function" && this.onChange({ start: s, end: o }, this.parent);
1670
- };
1671
- return n({ class: "relative w-full max-w-[320px]" }, [
1672
- he({
1673
- toggleOpen: t,
1674
- bind: this.bind,
1675
- required: this.required
1676
- }),
1677
- me({
1678
- handleDateSelect: e,
1679
- blockPriorDates: this.blockPriorDates || !1
1680
- })
1681
- ]);
1682
- }
1683
- }
1684
- ), cs = ({ dateTime: t = "", remoteTimeZone: e = "America/Denver", filter: s = null }) => rt([
1685
- new mt({
1686
- dateTime: t,
1687
- filter: s || ((o) => {
1688
- const i = M.getLocalTime(o, !0, !1, e);
1689
- return M.getTimeFrame(i);
1690
- })
1691
- })
1692
- ]);
1693
- function fe(t) {
1694
- let e = "";
1695
- return t.length > 0 && (e = t.substring(0, 2), t.length > 2 && (e += ":" + t.substring(2, 4))), e;
1696
- }
1697
- function pe(t) {
1698
- if (t.length < 4)
1699
- return { formattedTime: null, hour: null, minute: null, meridian: null };
1700
- const e = parseInt(t.substring(0, 2), 10), s = parseInt(t.substring(2, 4), 10);
1701
- if (e < 0 || e > 23 || s < 0 || s > 59)
1702
- return { formattedTime: null, hour: null, minute: null, meridian: null };
1703
- let o = e, i = "AM";
1704
- return e === 0 ? o = 12 : e > 12 ? (o = e - 12, i = "PM") : e === 12 && (i = "PM"), {
1705
- formattedTime: `${o.toString().padStart(2, "0")}:${s.toString().padStart(2, "0")} ${i}`,
1706
- hour: o.toString().padStart(2, "0"),
1707
- minute: s.toString().padStart(2, "0"),
1708
- meridian: i
1709
- };
1710
- }
1711
- function ge({ bind: t, required: e }) {
1712
- return f({
1713
- cache: "input",
1714
- class: "opacity-0 absolute top-0 left-0 w-full h-full pointer-events-none",
1715
- bind: t,
1716
- required: e
1717
- });
1718
- }
1719
- function be({ placeholder: t, handleInputChange: e, handleInputFocus: s }) {
1720
- return f({
1721
- cache: "timeInput",
1722
- class: "flex-1 bg-transparent outline-none placeholder:text-muted-foreground border-0",
1723
- placeholder: t || "hh:mm AM/PM",
1724
- input: e,
1725
- focus: s,
1726
- onState: ["selectedTime", (o) => o || ""]
1727
- });
1728
- }
1729
- function xe({ bind: t, required: e, toggleOpen: s, handleInputChange: o, handleInputFocus: i, placeholder: r }) {
1730
- return n(
1731
- {
1732
- class: "relative flex items-center gap-2 w-full justify-between border bg-input hover:bg-muted rounded-md h-10 pr-4 py-2"
1733
- },
1734
- [
1735
- ge({ bind: t, required: e }),
1736
- be({ placeholder: r, handleInputChange: o, handleInputFocus: i }),
1737
- p(
1738
- {
1739
- class: "shrink-0 hover:bg-muted/50 rounded p-1 cursor-pointer",
1740
- click: s
1741
- },
1742
- [
1743
- T({ html: u.clock })
1744
- ]
1745
- )
1746
- ]
1747
- );
1748
- }
1749
- function $({ items: t, handleTimeSelect: e, state: s, stateValue: o, pad: i = !1 }) {
1750
- return n(
1751
- { class: "flex flex-col max-h-[200px] overflow-y-auto" },
1752
- t.map((r) => {
1753
- let l = i ? r.toString().padStart(2, "0") : r.toString();
1754
- return p({
1755
- text: l,
1756
- class: "hover:bg-muted/50 rounded-md pr-2 py-1",
1757
- click: () => e({ [o]: l }),
1758
- onState: [s, o, { "bg-muted": l }]
1759
- });
1760
- })
1761
- );
1762
- }
1763
- function ye({ handleTimeSelect: t }) {
1764
- return O(
1765
- (e, s, o) => new S(
1766
- {
1767
- cache: "dropdown",
1768
- parent: o,
1769
- button: o.panel,
1770
- size: "fit"
1771
- },
1772
- [
1773
- n(
1774
- { class: "flex flex-auto flex-col border rounded-md shadow-md" },
1775
- [
1776
- n(
1777
- { class: "grid grid-cols-3 gap-2 p-4 text-center max-h-[220px] min-w-[240px]" },
1778
- [
1779
- // Hours column
1780
- $({
1781
- items: Array.from({ length: 12 }, (i, r) => r + 1),
1782
- handleTimeSelect: t,
1783
- state: o.state,
1784
- stateValue: "hour",
1785
- pad: !0
1786
- }),
1787
- // Minutes column
1788
- $({
1789
- items: Array.from({ length: 60 }, (i, r) => r),
1790
- handleTimeSelect: t,
1791
- state: o.state,
1792
- stateValue: "minute",
1793
- pad: !0
1794
- }),
1795
- // AM/PM column
1796
- $({
1797
- items: ["AM", "PM"],
1798
- handleTimeSelect: t,
1799
- state: o.state,
1800
- stateValue: "meridian"
1801
- })
1802
- ]
1803
- )
1804
- ]
1805
- )
1806
- ]
1807
- )
1808
- );
1809
- }
1810
- function U(t) {
1811
- if (!t)
1812
- return { hour: null, minute: null, meridian: null };
1813
- const e = /^(\d{1,2}):(\d{2})(?::(\d{2}))?\s?(AM|PM)?$/i, s = t.match(e);
1814
- if (!s)
1815
- return { hour: null, minute: null, meridian: null };
1816
- let [, o, i, , r] = s, l = parseInt(o, 10), d = parseInt(i, 10);
1817
- return l < 0 || l > 23 || d < 0 || d > 59 ? { hour: null, minute: null, meridian: null } : (r ? (r = r.toUpperCase(), r === "PM" && l < 12 ? l += 12 : r === "AM" && l === 12 && (l = 12)) : l === 0 ? (r = "AM", l = 12) : l < 12 ? r = "AM" : l === 12 ? r = "PM" : (r = "PM", l -= 12), {
1818
- hour: l.toString().padStart(2, "0"),
1819
- minute: d.toString().padStart(2, "0"),
1820
- meridian: r
1821
- });
1822
- }
1823
- const ds = C(
1824
- {
1825
- /**
1826
- * The initial shallow state of the TimePicker.
1827
- *
1828
- * @member {object} state
1829
- */
1830
- state() {
1831
- const t = this.selectedTime ?? null, { hour: e, minute: s, meridian: o } = U(t);
1832
- return {
1833
- selectedTime: t,
1834
- open: !1,
1835
- hour: e,
1836
- minute: s,
1837
- meridian: o
1838
- };
1839
- },
1840
- /**
1841
- * Updates the state after the input is rendered.
1842
- *
1843
- * @returns {void}
1844
- */
1845
- after() {
1846
- if (this.input.value) {
1847
- const { hour: t, minute: e, meridian: s } = U(this.input.value);
1848
- this.state.set({
1849
- hour: t,
1850
- minute: e,
1851
- meridian: s,
1852
- selectedTime: this.input.value
1853
- });
1854
- }
1855
- },
1856
- /**
1857
- * Toggles the time picker popover.
1858
- *
1859
- * @param {Event} e
1860
- * @param {object} context
1861
- */
1862
- toggleOpen(t, { state: e }) {
1863
- e.toggle("open");
1864
- },
1865
- /**
1866
- * Handles direct input changes and formats the time.
1867
- *
1868
- * @param {Event} e
1869
- */
1870
- handleInputChange(t) {
1871
- let e = t.target.value.replace(/[^\d]/g, ""), s = fe(e);
1872
- const o = pe(e);
1873
- o.formattedTime && (s = o.formattedTime, this.state.set({
1874
- hour: o.hour,
1875
- minute: o.minute,
1876
- meridian: o.meridian,
1877
- selectedTime: o.formattedTime
1878
- }), this.input.value = o.formattedTime, g.trigger("change", this.input), typeof this.change == "function" && this.change(o.formattedTime)), t.target.value = s;
1879
- },
1880
- /**
1881
- * Handles input focus - select all text for easy editing.
1882
- *
1883
- * @param {Event} e
1884
- */
1885
- handleInputFocus(t) {
1886
- t.target.select();
1887
- },
1888
- /**
1889
- * Handles time selection from the picker columns.
1890
- *
1891
- * @param {object} params
1892
- */
1893
- handleTimeSelect({ hour: t, minute: e, meridian: s }) {
1894
- if (t && (this.state.hour = t), e && (this.state.minute = e), s && (this.state.meridian = s), this.state.hour && this.state.minute && this.state.meridian) {
1895
- const o = `${this.state.hour}:${this.state.minute} ${this.state.meridian}`;
1896
- this.state.selectedTime = o, this.state.open = !1, this.input.value = o, g.trigger("change", this.input), typeof this.change == "function" && this.change(o);
1897
- }
1898
- },
1899
- /**
1900
- * Renders the TimePicker component.
1901
- *
1902
- * @returns {object}
1903
- */
1904
- render() {
1905
- return n(
1906
- { class: "relative w-full max-w-[320px]" },
1907
- [
1908
- xe({
1909
- toggleOpen: this.toggleOpen.bind(this),
1910
- bind: this.bind,
1911
- required: this.required,
1912
- handleInputChange: this.handleInputChange.bind(this),
1913
- handleInputFocus: this.handleInputFocus.bind(this),
1914
- placeholder: this.placeholder
1915
- }),
1916
- ye({
1917
- handleTimeSelect: this.handleTimeSelect.bind(this)
1918
- })
1919
- ]
1920
- );
1921
- }
1922
- }
1923
- ), we = (t, e) => n({ class: `hidden md:flex items-start justify-center w-6 h-6 mr-3 ${e}` }, [
1924
- m({ size: "lg" }, t)
1925
- ]), Ce = ({ title: t }) => B({ class: "flex flex-auto items-center" }, [
1926
- v({ class: "text-lg font-semibold" }, t)
1927
- ]), ve = c((t, e) => lt(
1928
- {
1929
- class: `fixed pullUpIn z-30 w-[98%] border md:w-full max-w-lg bg-popover text-foreground shadow-lg duration-200
1930
- rounded-lg flex flex-auto flex-col
1931
- bottom-4 top-auto inset-auto m-auto md:bottom-0 md:top-0 left-0 right-0 ${t.class}`,
1932
- // @ts-ignore
1933
- click: t.click,
1934
- aria: { expanded: ["open"] }
1935
- },
1936
- [
1937
- n({ class: "flex flex-auto p-6 pb-12 md:pb-6" }, [
1938
- // Icon and content
1939
- // @ts-ignore
1940
- t.icon && we(t.icon, t.iconColor),
1941
- n({ class: "flex flex-auto flex-col gap-4" }, [
1942
- n({ class: "flex flex-auto flex-col gap-y-2" }, [
1943
- Ce(t),
1944
- // @ts-ignore
1945
- t.description && b({ class: "flex flex-auto flex-col text-sm text-muted-foreground" }, t.description),
1946
- n({ class: "flex flex-auto flex-col text-sm text-muted-foreground" }, e)
1947
- ]),
1948
- // @ts-ignore
1949
- t.buttons && L({ class: "flex flex-col-reverse sm:flex-row sm:justify-end mt-6 gap-2 sm:gap-0 sm:gap-x-2" }, t.buttons)
1950
- ])
1951
- ])
1952
- ]
1953
- )), Se = (t) => H.render(t, app.root), R = {
1954
- info: {
1955
- borderColor: "border-blue-500",
1956
- bgColor: "bg-muted/10",
1957
- iconColor: "text-blue-500"
1958
- },
1959
- warning: {
1960
- bgColor: "bg-muted/10",
1961
- borderColor: "border-warning",
1962
- iconColor: "text-warning"
1963
- },
1964
- destructive: {
1965
- bgColor: "bg-muted/10",
1966
- borderColor: "border-destructive",
1967
- iconColor: "text-red-500"
1968
- },
1969
- success: {
1970
- bgColor: "bg-muted/10",
1971
- borderColor: "border-emerald-500",
1972
- iconColor: "text-emerald-500"
1973
- },
1974
- default: {
1975
- borderColor: "border",
1976
- bgColor: "bg-muted/10",
1977
- iconColor: "text-muted-foreground"
1978
- }
1979
- };
1980
- class De extends y {
1981
- /**
1982
- * This will declare the props for the compiler.
1983
- *
1984
- * @returns {void}
1985
- */
1986
- declareProps() {
1987
- this.title = null, this.description = null, this.type = "", this.icon = null, this.onClose = null, this.hideFooter = !1, this.buttons = null;
1988
- }
1989
- /**
1990
- * This will render the modal component.
1991
- *
1992
- * @returns {object}
1993
- */
1994
- render() {
1995
- const e = (d) => {
1996
- d.target === this.panel && this.close();
1997
- }, { borderColor: s, bgColor: o, iconColor: i } = R[this.type] || R.default, r = `${this.getMainClass()} ${o} ${s}`, l = this.title || "Dialog Title";
1998
- return ve({
1999
- class: r,
2000
- title: l,
2001
- click: e,
2002
- icon: this.icon,
2003
- iconColor: i,
2004
- description: this.description,
2005
- buttons: this.getButtons()
2006
- }, this.children);
2007
- }
2008
- /**
2009
- * This will get the buttons for the modal.
2010
- *
2011
- * @returns {array|null}
2012
- */
2013
- getButtons() {
2014
- return this.hideFooter ? null : this.buttons ? this.buttons : [
2015
- h({ variant: "outline", click: () => this.close() }, "Close")
2016
- ];
2017
- }
2018
- /**
2019
- * This will setup the states.
2020
- *
2021
- * @returns {object}
2022
- */
2023
- setupStates() {
2024
- return {
2025
- open: !1
2026
- };
2027
- }
2028
- /**
2029
- * This will get the modal class.
2030
- *
2031
- * @returns {string}
2032
- */
2033
- getMainClass() {
2034
- return "";
2035
- }
2036
- /**
2037
- * This will open the modal.
2038
- *
2039
- * @returns {void}
2040
- */
2041
- open() {
2042
- Se(this), this.panel.showModal(), this.state.open = !0;
2043
- }
2044
- /**
2045
- * This will close the modal.
2046
- *
2047
- * @returns {void}
2048
- */
2049
- close() {
2050
- this.state.open = !1, this.panel.close(), typeof this.onClose == "function" && this.onClose(), this.destroy();
2051
- }
2052
- }
2053
- class us extends De {
2054
- /**
2055
- * This will declare the props for the compiler.
2056
- *
2057
- * @returns {void}
2058
- */
2059
- declareProps() {
2060
- this.confirmTextLabel = null, this.confirmed = null;
2061
- }
2062
- /**
2063
- * This will get the buttons for the modal.
2064
- *
2065
- * @returns {array}
2066
- */
2067
- getButtons() {
2068
- const e = this.confirmTextLabel || "Confirm";
2069
- return [
2070
- h({ variant: "outline", click: () => this.close() }, "Cancel"),
2071
- h({ variant: "primary", click: () => this.confirm() }, e)
2072
- ];
2073
- }
2074
- /**
2075
- * This will confirm the action.
2076
- *
2077
- * @returns {void}
2078
- */
2079
- confirm() {
2080
- this.confirmed && this.confirmed(), this.close();
2081
- }
2082
- }
2083
- const hs = c((t, e = []) => n({ class: "w-full max-w-md p-6 m-auto" }, [
2084
- K({ class: "flex flex-auto flex-col" }, [
2085
- n({ class: "flex flex-auto flex-col gap-y-4" }, [
2086
- n({ class: "flex flex-auto items-center justify-center" }, [
2087
- // @ts-ignore
2088
- t.icon && n({ class: "w-16 h-16 mb-2 text-primary" }, [
2089
- // @ts-ignore
2090
- m({ size: "lg" }, t.icon)
2091
- ])
2092
- ]),
2093
- B({ class: "py-4 text-center" }, [
2094
- // @ts-ignore
2095
- v({ class: "text-xl font-bold" }, t.title),
2096
- // @ts-ignore
2097
- b({ class: "pb-8 text-muted-foreground" }, t.description || ""),
2098
- ...e
2099
- ])
2100
- ])
2101
- ])
2102
- ]));
2103
- export {
2104
- je as A,
2105
- os as B,
2106
- _e as C,
2107
- ls as D,
2108
- hs as E,
2109
- K as F,
2110
- x as G,
2111
- We as H,
2112
- es as I,
2113
- Ze as J,
2114
- ts as K,
2115
- ss as L,
2116
- se as M,
2117
- Ut as N,
2118
- cs as O,
2119
- oe as P,
2120
- ds as Q,
2121
- Xe as R,
2122
- D as S,
2123
- Qe as T,
2124
- qt as U,
2125
- is as a,
2126
- us as b,
2127
- ne as c,
2128
- rs as d,
2129
- as as e,
2130
- Ee as f,
2131
- Ve as g,
2132
- Ge as h,
2133
- De as i,
2134
- ve as j,
2135
- ns as k,
2136
- Je as l,
2137
- Dt as m,
2138
- vt as n,
2139
- Ne as o,
2140
- Ue as p,
2141
- He as q,
2142
- Re as r,
2143
- Pt as s,
2144
- Ft as t,
2145
- qe as u,
2146
- It as v,
2147
- Bt as w,
2148
- $t as x,
2149
- zt as y,
2150
- Ke as z
2151
- };