@base-framework/ui 0.0.0

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 (134) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +106 -0
  3. package/dist/aside-template-D0KANPjh.js +35 -0
  4. package/dist/atoms.es.js +39 -0
  5. package/dist/bside-template-CDbINL4X.js +15 -0
  6. package/dist/calendar-DR_svCOR.js +424 -0
  7. package/dist/confirmation-D1Y_SgzE.js +1526 -0
  8. package/dist/icon-B9QUT2NY.js +47 -0
  9. package/dist/icons.es.js +658 -0
  10. package/dist/index.es.js +154 -0
  11. package/dist/inputs-BF3C3KfF.js +204 -0
  12. package/dist/mobile-nav-wrapper-7Qul1-mt.js +578 -0
  13. package/dist/molecules.es.js +45 -0
  14. package/dist/organisms.es.js +55 -0
  15. package/dist/pages.es.js +12 -0
  16. package/dist/sidebar-menu-page-M8hr9onX.js +224 -0
  17. package/dist/style.css +1 -0
  18. package/dist/tab-C_dZb2qH.js +1425 -0
  19. package/dist/templates.es.js +10 -0
  20. package/dist/tooltip-DCszmsxe.js +324 -0
  21. package/dist/types/components/atoms/atoms.d.ts +15 -0
  22. package/dist/types/components/atoms/badges/badge.d.ts +8 -0
  23. package/dist/types/components/atoms/buttons/buttons.d.ts +17 -0
  24. package/dist/types/components/atoms/cards/card.d.ts +8 -0
  25. package/dist/types/components/atoms/form/fieldset.d.ts +9 -0
  26. package/dist/types/components/atoms/form/inputs/checkbox.d.ts +10 -0
  27. package/dist/types/components/atoms/form/inputs/input-classes.d.ts +30 -0
  28. package/dist/types/components/atoms/form/inputs/inputs.d.ts +113 -0
  29. package/dist/types/components/atoms/form/inputs/range-slider.d.ts +10 -0
  30. package/dist/types/components/atoms/form/legend.d.ts +9 -0
  31. package/dist/types/components/atoms/form/select.d.ts +8 -0
  32. package/dist/types/components/atoms/icon.d.ts +8 -0
  33. package/dist/types/components/atoms/progress/circle-graph.d.ts +7 -0
  34. package/dist/types/components/atoms/progress/progress-bar.d.ts +9 -0
  35. package/dist/types/components/atoms/progress/semi-circle-graph.d.ts +7 -0
  36. package/dist/types/components/atoms/skeleton.d.ts +2 -0
  37. package/dist/types/components/atoms/tooltip.d.ts +12 -0
  38. package/dist/types/components/atoms/veil.d.ts +26 -0
  39. package/dist/types/components/icons/icons.d.ts +10 -0
  40. package/dist/types/components/molecules/alert.d.ts +7 -0
  41. package/dist/types/components/molecules/avatars/avatar.d.ts +15 -0
  42. package/dist/types/components/molecules/avatars/static-status-indicator.d.ts +2 -0
  43. package/dist/types/components/molecules/avatars/status-indicator.d.ts +2 -0
  44. package/dist/types/components/molecules/avatars/statuses.d.ts +13 -0
  45. package/dist/types/components/molecules/breadcrumb/breadcrumb.d.ts +11 -0
  46. package/dist/types/components/molecules/breadcrumb/dots-indicator.d.ts +12 -0
  47. package/dist/types/components/molecules/combobox/combobox.d.ts +10 -0
  48. package/dist/types/components/molecules/counters/atoms.d.ts +3 -0
  49. package/dist/types/components/molecules/counters/counter.d.ts +11 -0
  50. package/dist/types/components/molecules/date-time/date-picker.d.ts +11 -0
  51. package/dist/types/components/molecules/date-time/time-frame.d.ts +1 -0
  52. package/dist/types/components/molecules/date-time/time-picker.d.ts +10 -0
  53. package/dist/types/components/molecules/delay-component.d.ts +18 -0
  54. package/dist/types/components/molecules/dialogs/confirmation.d.ts +27 -0
  55. package/dist/types/components/molecules/dialogs/dialog-container.d.ts +8 -0
  56. package/dist/types/components/molecules/dialogs/dialog.d.ts +78 -0
  57. package/dist/types/components/molecules/dropdowns/dropdown-item.d.ts +1 -0
  58. package/dist/types/components/molecules/dropdowns/dropdown-menu.d.ts +61 -0
  59. package/dist/types/components/molecules/dropdowns/dropdown.d.ts +1 -0
  60. package/dist/types/components/molecules/form/form-atoms.d.ts +40 -0
  61. package/dist/types/components/molecules/form/form-control.d.ts +10 -0
  62. package/dist/types/components/molecules/form/form-field.d.ts +10 -0
  63. package/dist/types/components/molecules/form/form.d.ts +14 -0
  64. package/dist/types/components/molecules/modals/atoms.d.ts +17 -0
  65. package/dist/types/components/molecules/modals/modal-container.d.ts +8 -0
  66. package/dist/types/components/molecules/modals/modal.d.ts +124 -0
  67. package/dist/types/components/molecules/molecules.d.ts +31 -0
  68. package/dist/types/components/molecules/notifications/notification-container.d.ts +31 -0
  69. package/dist/types/components/molecules/notifications/notification.d.ts +79 -0
  70. package/dist/types/components/molecules/popover.d.ts +57 -0
  71. package/dist/types/components/molecules/theme-toggle.d.ts +8 -0
  72. package/dist/types/components/molecules/toggle/toggle.d.ts +11 -0
  73. package/dist/types/components/organisms/button-group.d.ts +23 -0
  74. package/dist/types/components/organisms/calendar/calendar.d.ts +77 -0
  75. package/dist/types/components/organisms/calendar/month/calendar-cells.d.ts +1 -0
  76. package/dist/types/components/organisms/calendar/month/day-cell.d.ts +1 -0
  77. package/dist/types/components/organisms/calendar/month/day-header.d.ts +1 -0
  78. package/dist/types/components/organisms/calendar/month/month-calendar.d.ts +1 -0
  79. package/dist/types/components/organisms/calendar/month/navigation-button.d.ts +1 -0
  80. package/dist/types/components/organisms/calendar/utils.d.ts +3 -0
  81. package/dist/types/components/organisms/calendar/week/utils.d.ts +6 -0
  82. package/dist/types/components/organisms/calendar/week/week-calendar.d.ts +90 -0
  83. package/dist/types/components/organisms/calendar/week/week-cell.d.ts +1 -0
  84. package/dist/types/components/organisms/calendar/week/week-cells.d.ts +1 -0
  85. package/dist/types/components/organisms/calendar/week/week-header.d.ts +1 -0
  86. package/dist/types/components/organisms/lists/checkbox-col.d.ts +1 -0
  87. package/dist/types/components/organisms/lists/data-table-body.d.ts +5 -0
  88. package/dist/types/components/organisms/lists/data-table.d.ts +13 -0
  89. package/dist/types/components/organisms/lists/header-col.d.ts +2 -0
  90. package/dist/types/components/organisms/lists/table-header.d.ts +5 -0
  91. package/dist/types/components/organisms/lists/user-list.d.ts +15 -0
  92. package/dist/types/components/organisms/navigation/inline-navigation.d.ts +75 -0
  93. package/dist/types/components/organisms/navigation/main-link.d.ts +81 -0
  94. package/dist/types/components/organisms/navigation/mobile/nav-wrapper/mobile-nav-wrapper.d.ts +14 -0
  95. package/dist/types/components/organisms/navigation/mobile/nav-wrapper/navigation-popover.d.ts +36 -0
  96. package/dist/types/components/organisms/navigation/mobile/nav-wrapper/popup-header.d.ts +1 -0
  97. package/dist/types/components/organisms/navigation/mobile/nav-wrapper/title-header.d.ts +2 -0
  98. package/dist/types/components/organisms/navigation/nav-button-link.d.ts +44 -0
  99. package/dist/types/components/organisms/navigation/navigation-atoms.d.ts +8 -0
  100. package/dist/types/components/organisms/navigation/navigation-menu/navigation-menu.d.ts +58 -0
  101. package/dist/types/components/organisms/navigation/navigation.d.ts +58 -0
  102. package/dist/types/components/organisms/navigation/sidebar-menu/sidebar-menu.d.ts +2 -0
  103. package/dist/types/components/organisms/organisms.d.ts +38 -0
  104. package/dist/types/components/organisms/overlays/dockable-overlay.d.ts +38 -0
  105. package/dist/types/components/organisms/overlays/inline-overlay.d.ts +18 -0
  106. package/dist/types/components/organisms/overlays/overlay.d.ts +73 -0
  107. package/dist/types/components/organisms/panel.d.ts +22 -0
  108. package/dist/types/components/organisms/search/dropdown.d.ts +8 -0
  109. package/dist/types/components/organisms/search/search-dropdown.d.ts +10 -0
  110. package/dist/types/components/organisms/search/search-input.d.ts +7 -0
  111. package/dist/types/components/organisms/tabs/button-tab.d.ts +65 -0
  112. package/dist/types/components/organisms/tabs/tab-group.d.ts +48 -0
  113. package/dist/types/components/organisms/tabs/tab-navigation.d.ts +62 -0
  114. package/dist/types/components/organisms/tabs/tab.d.ts +35 -0
  115. package/dist/types/components/pages/basic-page.d.ts +19 -0
  116. package/dist/types/components/pages/blank-page.d.ts +17 -0
  117. package/dist/types/components/pages/center-page.d.ts +17 -0
  118. package/dist/types/components/pages/full-contain-page.d.ts +17 -0
  119. package/dist/types/components/pages/full-page.d.ts +25 -0
  120. package/dist/types/components/pages/fullscreen-page.d.ts +17 -0
  121. package/dist/types/components/pages/main-section.d.ts +8 -0
  122. package/dist/types/components/pages/page.d.ts +16 -0
  123. package/dist/types/components/pages/pages.d.ts +10 -0
  124. package/dist/types/components/pages/sidebar-menu-page.d.ts +70 -0
  125. package/dist/types/components/pages/templates/aside-template.d.ts +8 -0
  126. package/dist/types/components/pages/templates/bside-template.d.ts +8 -0
  127. package/dist/types/components/pages/templates/full-template.d.ts +8 -0
  128. package/dist/types/components/pages/templates/row.d.ts +8 -0
  129. package/dist/types/components/pages/templates/template-atoms.d.ts +16 -0
  130. package/dist/types/components/pages/templates/template.d.ts +8 -0
  131. package/dist/types/components/pages/templates/templates.d.ts +5 -0
  132. package/dist/types/ui.d.ts +6 -0
  133. package/dist/veil-B9GQfH0d.js +29 -0
  134. package/package.json +57 -0
@@ -0,0 +1,1526 @@
1
+ var W = Object.defineProperty;
2
+ var G = (e, t, o) => t in e ? W(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o;
3
+ var i = (e, t, o) => G(e, typeof t != "symbol" ? t + "" : t, o);
4
+ import { Div as n, I as f, H5 as J, P as p, Li as V, Span as c, Ul as Y, Button as h, OnState as v, Label as K, Form as Q, H2 as $, Footer as M, Header as L, A as q, H3 as X, Checkbox as Z, Nav as ee, Input as C, Time as te, Dialog as oe } from "@base-framework/atoms";
5
+ import { Atom as d, Component as x, Html as N, Dom as se, base as ne, Data as k, Builder as H, Jot as S, DateTime as B } from "@base-framework/base";
6
+ import { P as D, b as le } from "./calendar-DR_svCOR.js";
7
+ import { B as m, I } from "./icon-B9QUT2NY.js";
8
+ import { Icons as u } from "./icons.es.js";
9
+ import { a as w } from "./veil-B9GQfH0d.js";
10
+ import { Timer as re, List as ae, DynamicTime as ie } from "@base-framework/organisms";
11
+ const z = {
12
+ info: {
13
+ borderColor: "border-blue-500",
14
+ bgColor: "bg-muted/10",
15
+ iconColor: "text-blue-500"
16
+ },
17
+ warning: {
18
+ bgColor: "bg-muted/10",
19
+ borderColor: "border-warning",
20
+ iconColor: "text-warning"
21
+ },
22
+ destructive: {
23
+ bgColor: "bg-muted/10",
24
+ borderColor: "border-destructive",
25
+ iconColor: "text-red-500"
26
+ },
27
+ success: {
28
+ bgColor: "bg-muted/10",
29
+ borderColor: "border-emerald-500",
30
+ iconColor: "text-emerald-500"
31
+ },
32
+ default: {
33
+ borderColor: "border",
34
+ bgColor: "bg-muted/10",
35
+ iconColor: "text-muted-foreground"
36
+ }
37
+ }, ce = (e, t) => n({ class: `flex items-center justify-center h-6 w-6 mr-3 ${t}` }, [
38
+ f({ html: e })
39
+ ]), de = (e) => J({ class: "font-semibold" }, e), ue = (e) => p({ class: "text-sm text-muted-foreground" }, e), pt = d(({ title: e, description: t, icon: o, type: s = "default" }) => {
40
+ const { borderColor: a, bgColor: l, iconColor: r } = z[s] || z.default;
41
+ return n({ class: `flex items-start p-4 border rounded-lg ${l} ${a}` }, [
42
+ // Icon and content
43
+ o && ce(o, r),
44
+ n({ class: "flex flex-col" }, [
45
+ de(e),
46
+ ue(t)
47
+ ])
48
+ ]);
49
+ });
50
+ class me extends x {
51
+ constructor() {
52
+ super(...arguments);
53
+ /**
54
+ * @member {string} removingClass
55
+ * @default ''
56
+ */
57
+ i(this, "removingClass", "");
58
+ }
59
+ /**
60
+ * This will remove the component from the DOM after a delay.
61
+ *
62
+ * @returns {void}
63
+ */
64
+ remove() {
65
+ this.prepareDestroy(), this.removeContext();
66
+ const o = this.panel, s = this.removingClass;
67
+ if (!s) {
68
+ N.removeElement(o);
69
+ return;
70
+ }
71
+ se.addClass(o, s), ne.on("animationend", o, (a) => N.removeElement(o));
72
+ }
73
+ }
74
+ const fe = (e) => c({ class: "ml-auto text-xs tracking-widest opacity-60" }, e), he = (e) => c({ class: "flex w-4 h-4", html: e }), ge = (e) => c({ class: "flex-auto" }, e), be = (e, t) => V({
75
+ 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",
76
+ click: () => t(e)
77
+ }, [
78
+ e.icon && he(e.icon),
79
+ ge(e.label),
80
+ e.shortcut && fe(e.shortcut)
81
+ ]), pe = (e, t) => Y({ class: "grid gap-2" }, [
82
+ e.map((o) => be(o, t))
83
+ ]), xe = (e) => n({ class: "w-full z-10" }, [
84
+ n({
85
+ class: "max-h-60 border rounded-md overflow-y-auto p-1 grid gap-2 divide-y divide-border",
86
+ for: ["groups", (t) => pe(t, e)]
87
+ })
88
+ ]), we = ({ label: e, icon: t, toggleDropdown: o }) => h({
89
+ cache: "button",
90
+ class: `inline-flex items-center justify-between rounded-md border border-input
91
+ bg-background px-2 py-2 text-sm font-medium hover:bg-muted
92
+ focus:outline-none transition duration-150 ease-in-out`,
93
+ click: o
94
+ }, [
95
+ e && c(e),
96
+ t && f({ html: t })
97
+ ]), ye = ({ onSelect: e }) => n([
98
+ v(
99
+ "open",
100
+ (t, o, s) => t ? new D({
101
+ cache: "dropdown",
102
+ parent: s,
103
+ button: s.button
104
+ }, [
105
+ xe(e)
106
+ ]) : null
107
+ )
108
+ ]);
109
+ class xt extends x {
110
+ constructor() {
111
+ super(...arguments);
112
+ /**
113
+ * @member {string} label
114
+ */
115
+ i(this, "label", null);
116
+ /**
117
+ * @member {string} icon
118
+ * @default null
119
+ */
120
+ i(this, "icon", null);
121
+ /**
122
+ * @member {function} onSelect
123
+ */
124
+ i(this, "onSelect", null);
125
+ /**
126
+ * @member {array} groups
127
+ */
128
+ i(this, "groups", []);
129
+ }
130
+ /**
131
+ * Initializes component data.
132
+ *
133
+ * @returns {Data}
134
+ */
135
+ setData() {
136
+ return new k({
137
+ groups: this.groups || []
138
+ });
139
+ }
140
+ /**
141
+ * Initializes the component state.
142
+ *
143
+ * @returns {object}
144
+ */
145
+ setupStates() {
146
+ return {
147
+ open: !1,
148
+ selectedItem: null
149
+ };
150
+ }
151
+ /**
152
+ * Toggles the dropdown open state.
153
+ *
154
+ * @returns {void}
155
+ */
156
+ toggleDropdown() {
157
+ this.state.toggle("open");
158
+ }
159
+ /**
160
+ * Handles item selection within the dropdown.
161
+ *
162
+ * @param {object} item - The selected item object
163
+ * @returns {void}
164
+ */
165
+ handleSelect(o) {
166
+ this.state.selectedItem = o, this.state.open = !1, typeof this.onSelect == "function" && this.onSelect(o);
167
+ }
168
+ /**
169
+ * Renders the Dropdown component.
170
+ *
171
+ * @returns {object}
172
+ */
173
+ render() {
174
+ return n({ class: "relative" }, [
175
+ we({
176
+ label: this.label,
177
+ icon: this.icon,
178
+ toggleDropdown: this.toggleDropdown.bind(this)
179
+ }),
180
+ ye({ onSelect: this.handleSelect.bind(this) })
181
+ ]);
182
+ }
183
+ }
184
+ const ve = d((e, t) => n({ ...e, class: "flex flex-auto flex-col space-y-2" }, t)), Ce = d((e, t) => K({ ...e, class: "flex auto text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70" }, t)), ke = d((e, t) => p({ ...e, class: "text-sm text-muted-foreground italic" }, t)), Se = d((e, t) => p({ ...e, class: "text-sm text-destructive" }, t)), De = (e) => e.tag === "input" || e.tag === "select" || e.tag === "textarea", U = (e, t, o) => e.map((s) => (s.children && s.children.length > 0 && (s.children = U(s.children, t, o)), s.required && De(s) ? {
185
+ ...s,
186
+ aria: {
187
+ invalid: ["hasError"]
188
+ },
189
+ invalid: o,
190
+ input: t
191
+ } : s)), Ie = d((e, t) => {
192
+ const a = U(t, (l) => {
193
+ l.target.checkValidity() && e.setError(null);
194
+ }, (l) => {
195
+ e.setError(l.target.validationMessage);
196
+ });
197
+ return n({
198
+ ...e,
199
+ class: "w-full"
200
+ }, a);
201
+ }), wt = w(
202
+ {
203
+ /**
204
+ * The initial state of the FormField.
205
+ *
206
+ * @member {object} state
207
+ * @returns {object}
208
+ */
209
+ state() {
210
+ return {
211
+ error: null,
212
+ hasError: !1,
213
+ value: this.defaultValue ?? ""
214
+ };
215
+ },
216
+ /**
217
+ * Renders the FormField component.
218
+ *
219
+ * @returns {object}
220
+ */
221
+ render() {
222
+ const e = this.name, t = this.getId(`${e}`), { label: o, description: s } = this, a = (l) => {
223
+ this.state.error = l, this.state.hasError = !!l;
224
+ };
225
+ return n({ class: "flex flex-auto space-y-4" }, [
226
+ ve([
227
+ Ce({ htmlFor: t }, o),
228
+ Ie({
229
+ id: t,
230
+ name: e,
231
+ value: this.state.value,
232
+ setError: a
233
+ }, this.children),
234
+ s && ke({ id: this.getId("description") }, s),
235
+ n({ onState: ["error", (l) => l && Se(l)] })
236
+ ])
237
+ ]);
238
+ }
239
+ }
240
+ ), Te = (e, t = null) => {
241
+ e.target.checkValidity() && (e.preventDefault(), t && t(e));
242
+ }, Ae = d(
243
+ (e, t) => Q({ ...e, submit: (o) => Te(o, e.submit), class: `w-full ${e.class ?? ""}` }, t)
244
+ ), yt = d((e, t) => n({ ...e, class: `space-y-6 p-4 md:p-6 divide-y ${e.class || ""}` }, t)), vt = d((e, t = []) => n({ class: "space-y-3 py-4" }, [
245
+ e.title && $({ class: "font-semibold" }, e.title),
246
+ ...t
247
+ ])), Ct = (e, t) => n({ class: "flex justify-between" }, [
248
+ c({ class: "text-muted-foreground" }, e),
249
+ c(t)
250
+ ]), Be = ({ title: e, description: t, back: o, icon: s, options: a = [] }) => L({ class: "modal-header bg-background/80 backdrop-blur-md sticky flex flex-none items-center py-4 px-6 z-10" }, [
251
+ /**
252
+ * Back Button
253
+ */
254
+ o && m({ variant: "icon", icon: u.arrows.left, class: "mr-2 p-0 flex sm:hidden", click: (l, r) => r.close() }),
255
+ /**
256
+ * Icon
257
+ */
258
+ s && n({ class: "mr-2 w-12 h-12 rounded-full bg-muted flex flex-none items-center justify-center" }, [I(s)]),
259
+ /**
260
+ * Title and Description
261
+ */
262
+ n({ class: "flex flex-auto flex-row justify-between w-full ml-2 gap-2" }, [
263
+ n({ class: "flex flex-auto flex-col" }, [
264
+ $({ class: "text-lg font-semibold m-0" }, e),
265
+ t && n({ class: "text-sm text-muted-foreground" }, t)
266
+ ]),
267
+ ...a
268
+ ])
269
+ ]), $e = d((e, t) => n({
270
+ popover: "manual",
271
+ class: `modal m-auto top-0 right-0 bottom-0 left-0 fixed z-20 grid w-full h-full max-h-screen gap-2 lg:border bg-background text-foreground shadow-xl break-words p-0 ${e.class}`,
272
+ click: (o, s) => {
273
+ o.target === s.panel && (o.preventDefault(), o.stopPropagation(), s.state.open = !1);
274
+ }
275
+ }, [
276
+ Ae({ class: "modal-content relative bg-background z-[1] flex flex-auto flex-col space-y-4", submit: (o) => e.onSubmit && e.onSubmit() }, [
277
+ Be(e),
278
+ n({ class: "modal-body flex flex-grow flex-col overflow-y-auto py-0 px-6 z-0" }, t),
279
+ M({ class: "modal-footer sticky bg-background/80 backdrop-blur-md flex flex-none justify-between py-4 px-6 z-10" }, e.buttons)
280
+ ])
281
+ ])), Me = (e) => H.render(e, app.root);
282
+ class kt extends x {
283
+ constructor() {
284
+ super(...arguments);
285
+ /**
286
+ * @member {string} title
287
+ */
288
+ i(this, "title", null);
289
+ /**
290
+ * @member {string} description
291
+ */
292
+ i(this, "description", null);
293
+ /**
294
+ * @member {string} size
295
+ * @default 'md'
296
+ * @values 'sm', 'md', 'lg', 'xl'
297
+ */
298
+ i(this, "size", "md");
299
+ /**
300
+ * @member {string} type
301
+ * @default ''
302
+ * @values 'right', 'left'
303
+ * @description This will set the type of modal.
304
+ */
305
+ i(this, "type", "");
306
+ /**
307
+ * @member {boolean} hidePrimaryButton
308
+ * @default false
309
+ * @description This will hide the primary button.
310
+ * @values true, false
311
+ */
312
+ i(this, "hidePrimaryButton", !1);
313
+ /**
314
+ * @member {string} icon
315
+ */
316
+ i(this, "icon", null);
317
+ /**
318
+ * @member {function|nll} onSubmit
319
+ */
320
+ i(this, "onSubmit", null);
321
+ /**
322
+ * @member {function|null} onClose
323
+ */
324
+ i(this, "onClose", null);
325
+ /**
326
+ * @member {boolean} back
327
+ */
328
+ i(this, "back", !1);
329
+ }
330
+ /**
331
+ * This will render the modal component.
332
+ *
333
+ * @returns {object}
334
+ */
335
+ render() {
336
+ const o = this.getMainClass(), s = this.title || "", a = this.description || null;
337
+ return $e(
338
+ {
339
+ class: o,
340
+ title: s,
341
+ description: a,
342
+ options: this.headerOptions(),
343
+ buttons: this.getButtons(),
344
+ onSubmit: () => {
345
+ this.onSubmit && this.onSubmit(), this.destroy();
346
+ },
347
+ icon: this.icon,
348
+ back: this.back ?? !1,
349
+ aria: { expanded: ["open"] }
350
+ },
351
+ this.children
352
+ );
353
+ }
354
+ /**
355
+ * This will setup the states.
356
+ *
357
+ * @returns {object}
358
+ */
359
+ setupStates() {
360
+ return {
361
+ open: {
362
+ state: !1,
363
+ callBack: (o) => {
364
+ o || this.destroy();
365
+ }
366
+ }
367
+ };
368
+ }
369
+ /**
370
+ * This will get the header options.
371
+ *
372
+ * @returns {Array<object>}
373
+ */
374
+ headerOptions() {
375
+ return [];
376
+ }
377
+ /**
378
+ * This will get the buttons for the modal.
379
+ *
380
+ * @returns {array}
381
+ */
382
+ getButtons() {
383
+ return [
384
+ m({ variant: "outline", click: () => this.destroy() }, "Cancel"),
385
+ this.hidePrimaryButton !== !0 && m({ variant: "primary", type: "submit" }, "Save")
386
+ ];
387
+ }
388
+ /**
389
+ * This will check if the click was outside the component.
390
+ *
391
+ * @param {object} element
392
+ * @returns {boolean}
393
+ */
394
+ isOutsideClick(o) {
395
+ return !this.panel.contains(o);
396
+ }
397
+ /**
398
+ * This will get the size class.
399
+ *
400
+ * @returns {string}
401
+ */
402
+ getSizeClass() {
403
+ switch (this.size) {
404
+ case "lg":
405
+ return "lg max-w-[900px]";
406
+ case "xl":
407
+ return "xl max-w-[1400px]";
408
+ default:
409
+ return "md max-w-[760px]";
410
+ }
411
+ }
412
+ /**
413
+ * This will get the type class.
414
+ *
415
+ * @returns {string}
416
+ */
417
+ getTypeClass() {
418
+ switch (this.type) {
419
+ case "right":
420
+ return "right right-0";
421
+ case "left":
422
+ return "left left-0";
423
+ default:
424
+ return "";
425
+ }
426
+ }
427
+ /**
428
+ * This will get the modal class.
429
+ *
430
+ * @returns {string}
431
+ */
432
+ getMainClass() {
433
+ return this.getSizeClass() + " " + this.getTypeClass();
434
+ }
435
+ /**
436
+ * This will override the set up to use the app shell.
437
+ *
438
+ * @param {object} container
439
+ */
440
+ setContainer(o) {
441
+ this.container = app.root;
442
+ }
443
+ /**
444
+ * This will open the modal.
445
+ *
446
+ * @returns {void}
447
+ */
448
+ open() {
449
+ Me(this), this.showModal();
450
+ }
451
+ /**
452
+ * This will show the modal.
453
+ *
454
+ * @protected
455
+ * @returns {void}
456
+ */
457
+ showModal() {
458
+ window.setTimeout(() => this.panel.showPopover(), 10), this.state.open = !0, document.documentElement.style.overflowY = "hidden";
459
+ }
460
+ /**
461
+ * This will hide the modal.
462
+ *
463
+ * @protected
464
+ * @returns {void}
465
+ */
466
+ beforeDestroy() {
467
+ this.panel.hidePopover(), this.state.open = !1, typeof this.onClose == "function" && this.onClose(), document.documentElement.style.overflowY = "auto";
468
+ }
469
+ }
470
+ const F = {
471
+ info: {
472
+ bgColor: "bg-muted/10",
473
+ borderColor: "border-blue-500",
474
+ iconColor: "text-blue-500"
475
+ },
476
+ warning: {
477
+ bgColor: "bg-muted/10",
478
+ borderColor: "border-warning",
479
+ iconColor: "text-warning"
480
+ },
481
+ destructive: {
482
+ bgColor: "bg-muted/10",
483
+ borderColor: "border-destructive",
484
+ iconColor: "text-red-500"
485
+ },
486
+ success: {
487
+ bgColor: "bg-muted/10",
488
+ borderColor: "border-emerald-500",
489
+ iconColor: "text-emerald-500"
490
+ },
491
+ default: {
492
+ bgColor: "bg-muted/10",
493
+ borderColor: "border",
494
+ iconColor: "text-muted-foreground"
495
+ }
496
+ }, Le = (e) => L({ class: "flex justify-center" }, [
497
+ X({ class: "text-lg font-bold mb-0" }, e)
498
+ ]), Ne = d(({ href: e, class: t }, o) => q({
499
+ 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 ${t}`,
500
+ href: e,
501
+ role: "alert"
502
+ }, o)), ze = d(({ close: e, class: t }, o) => n({
503
+ 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 ${t}`,
504
+ click: () => e(),
505
+ role: "alert"
506
+ }, o));
507
+ class Fe extends me {
508
+ constructor() {
509
+ super(...arguments);
510
+ /**
511
+ * @member {stirng} removingClass}
512
+ */
513
+ i(this, "removingClass", "pullRight");
514
+ /**
515
+ * @member {function|null} secondaryAction
516
+ */
517
+ i(this, "secondaryAction", null);
518
+ /**
519
+ * @member {function|null} primaryAction
520
+ */
521
+ i(this, "primaryAction", null);
522
+ /**
523
+ * @member {boolean} primary
524
+ */
525
+ i(this, "primary", !1);
526
+ /**
527
+ * @member {boolean} secondary
528
+ */
529
+ i(this, "secondary", !1);
530
+ /**
531
+ * @member {string} title
532
+ */
533
+ i(this, "title", null);
534
+ /**
535
+ * @member {string} description
536
+ */
537
+ i(this, "description", null);
538
+ /**
539
+ * @member {string} icon
540
+ */
541
+ i(this, "icon", null);
542
+ /**
543
+ * @member {function} onClick
544
+ */
545
+ i(this, "onClick", null);
546
+ }
547
+ /**
548
+ * This will be called when the component is created.
549
+ *
550
+ * @returns {void}
551
+ */
552
+ onCreated() {
553
+ this.duration = this.duration || 4e3;
554
+ }
555
+ /**
556
+ * This will render the component.
557
+ *
558
+ * @returns {object}
559
+ */
560
+ render() {
561
+ const { bgColor: o, borderColor: s, iconColor: a } = this.getTypeStyles(), l = this.href || null, r = this.getChildren(a);
562
+ return l ? Ne({
563
+ href: l,
564
+ class: `${o} ${s}`
565
+ }, r) : ze({
566
+ close: this.close.bind(this),
567
+ class: `${o} ${s}`
568
+ }, r);
569
+ }
570
+ /**
571
+ * This will be called after the component is set up.
572
+ *
573
+ * @returns {void}
574
+ */
575
+ afterSetup() {
576
+ const o = this.duration;
577
+ o !== "infinite" && (this.timer = new re(o, this.close.bind(this)), this.timer.start());
578
+ }
579
+ /**
580
+ * This will get the style properties based on the notification type.
581
+ *
582
+ * @returns {object}
583
+ */
584
+ getTypeStyles() {
585
+ const o = this.type || "default";
586
+ return F[o] || F.default;
587
+ }
588
+ /**
589
+ * This will get the buttons for the notification.
590
+ *
591
+ * @returns {array}
592
+ */
593
+ getButtons() {
594
+ return [
595
+ n({ class: "flex flex-row mt-6 gap-2" }, [
596
+ this.secondary && m({ variant: "outline", click: () => this.secondaryAction && this.secondaryAction() }, this.secondary),
597
+ this.primary && m({ click: () => this.primaryAction && this.primaryAction() }, this.primary)
598
+ ])
599
+ ];
600
+ }
601
+ /**
602
+ * This will get the children for the notification.
603
+ *
604
+ * @param {string} iconColor
605
+ * @returns {array}
606
+ */
607
+ getChildren(o) {
608
+ return [
609
+ n({ class: "flex items-start" }, [
610
+ this.icon && f({ class: `mr-4 ${o}`, html: this.icon }),
611
+ n({ class: "flex flex-auto flex-col" }, [
612
+ n({ class: "flex flex-auto flex-row items-center w-full pr-12" }, [
613
+ this.title && Le(this.title)
614
+ ]),
615
+ p({ class: "text-base text-muted-foreground m-0 pr-12" }, this.description),
616
+ (this.primary || this.secondary) && M({ class: "margin-top-24 flex align-center" }, this.getButtons())
617
+ ])
618
+ ]),
619
+ m({
620
+ class: "absolute top-[12px] right-[12px]",
621
+ variant: "icon",
622
+ icon: u.x,
623
+ click: this.close.bind(this)
624
+ })
625
+ ];
626
+ }
627
+ /**
628
+ * This will close the notification.
629
+ *
630
+ * @param {object} e The event object.
631
+ * @returns {void}
632
+ */
633
+ close(o) {
634
+ o && o.stopPropagation(), this.duration !== "infinite" && this.timer.stop(), this.onClick && this.onClick(), this.destroy();
635
+ }
636
+ }
637
+ let Ee = 0;
638
+ class St extends x {
639
+ /**
640
+ * This will render the component.
641
+ *
642
+ * @returns {object}
643
+ */
644
+ render() {
645
+ 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" }, [
646
+ new ae({
647
+ cache: "list",
648
+ key: "id",
649
+ role: "list",
650
+ rowItem: (t) => new Fe(t)
651
+ })
652
+ ]);
653
+ }
654
+ /**
655
+ * This will add a notification.
656
+ *
657
+ * @param {object} props
658
+ * @returns {void}
659
+ */
660
+ addNotice(t = {}) {
661
+ t.id = Ee++, t.callBack = () => this.removeNotice(t), this.list.append([t]), this.panel.hidePopover(), this.panel.showPopover();
662
+ }
663
+ /**
664
+ * This will remove a notification.
665
+ *
666
+ * @param {object} notice
667
+ * @returns {void}
668
+ */
669
+ removeNotice(t) {
670
+ this.list.delete(t.id);
671
+ }
672
+ }
673
+ const E = window.matchMedia, T = d(({ value: e, label: t, icon: o }) => h({
674
+ 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',
675
+ onState: ["method", { active: e }],
676
+ dataSet: ["method", ["state", e, "active"]],
677
+ click: (s, { state: a }) => {
678
+ a.method = e, localStorage.setItem("theme", e), e === "system" && localStorage.removeItem("theme"), Pe(e);
679
+ }
680
+ }, [
681
+ I(o),
682
+ c(t)
683
+ ])), Pe = (e) => {
684
+ var s;
685
+ const t = document.documentElement;
686
+ if (e === "system" && (e = (s = window.matchMedia) != null && s.call(window, "(prefers-color-scheme: dark)").matches ? "dark" : "light"), E && !E("(prefers-color-scheme: " + e + ")").matches) {
687
+ t.classList.add(e);
688
+ return;
689
+ }
690
+ const o = e === "light" ? "dark" : "light";
691
+ t.classList.remove(o);
692
+ }, Dt = S(
693
+ {
694
+ /**
695
+ * This will render the component.
696
+ *
697
+ * @returns {object}
698
+ */
699
+ render() {
700
+ return n({ class: "flex flex-auto flex-col" }, [
701
+ n({ class: "grid grid-cols-3 gap-4" }, [
702
+ T({ label: "System", value: "system", icon: u.adjustments.horizontal }),
703
+ T({ label: "Light", value: "light", icon: u.sun }),
704
+ T({ label: "Dark", value: "dark", icon: u.moon })
705
+ ])
706
+ ]);
707
+ },
708
+ /**
709
+ * This will setup the states.
710
+ *
711
+ * @returns {object}
712
+ */
713
+ state() {
714
+ return {
715
+ method: window.localStorage.getItem("theme") ?? "system"
716
+ };
717
+ }
718
+ }
719
+ ), It = w(
720
+ {
721
+ /**
722
+ * The initial state of the Toggle.
723
+ *
724
+ * @returns {object}
725
+ */
726
+ state() {
727
+ return {
728
+ active: this.active ?? !1
729
+ };
730
+ },
731
+ /**
732
+ * This is added to check the checkbox after the component is rendered.
733
+ * to see if the bind updated the checked value.
734
+ *
735
+ * @returns {void}
736
+ */
737
+ after() {
738
+ this.state.active = this.checkbox.checked;
739
+ },
740
+ /**
741
+ * Renders the Toggle component.
742
+ *
743
+ * @returns {object}
744
+ */
745
+ render() {
746
+ return h({
747
+ class: "relative inline-flex h-6 w-11 min-w-11 items-center rounded-full bg-muted transition-colors focus:outline-none",
748
+ onState: ["active", { "bg-primary": !0, "bg-muted": !1 }],
749
+ click: (t, { state: o }) => {
750
+ o.toggle("active"), this.checkbox.checked = o.active;
751
+ }
752
+ }, [
753
+ Z({
754
+ cache: "checkbox",
755
+ class: "opacity-0 absolute top-0 left-0 bottom-0 right-0 w-full h-full",
756
+ /**
757
+ * This will add the default checked before binding.
758
+ * If binding it will override the default checked value.
759
+ */
760
+ checked: this.state.active,
761
+ bind: this.bind,
762
+ required: this.required
763
+ }),
764
+ c({
765
+ class: "absolute h-5 w-5 bg-background rounded-full shadow-md transform transition-transform",
766
+ onState: ["active", { "translate-x-[22px]": !0, "translate-x-[2px]": !1 }]
767
+ })
768
+ ]);
769
+ }
770
+ }
771
+ ), y = {
772
+ ONLINE: "online",
773
+ OFFLINE: "offline",
774
+ BUSY: "busy",
775
+ AWAY: "away"
776
+ }, g = {
777
+ ONLINE: "bg-green-500",
778
+ OFFLINE: "bg-gray-500",
779
+ BUSY: "bg-red-500",
780
+ AWAY: "bg-yellow-500"
781
+ }, je = (e = "") => (e = e.toUpperCase(), g[e] || g.OFFLINE), Tt = (e) => n({
782
+ class: `absolute bottom-0 right-0 w-3 h-3 border-2 rounded-full ${je(e)}`
783
+ }), At = ({ propName: e = "status" } = {}) => n({
784
+ class: "absolute bottom-0 right-0 w-3 h-3 border-2 rounded-full",
785
+ onSet: [e, {
786
+ [g.ONLINE]: y.ONLINE,
787
+ [g.OFFLINE]: y.OFFLINE,
788
+ [g.BUSY]: y.BUSY,
789
+ [g.AWAY]: y.AWAY
790
+ }]
791
+ }), Oe = (e, t) => q(
792
+ {
793
+ href: e,
794
+ "aria-current": t === "Breadcrumb" && "page",
795
+ // Only set aria-current on the last item
796
+ class: "text-muted-foreground font-medium hover:text-foreground"
797
+ },
798
+ [c(t)]
799
+ ), Ve = () => I({
800
+ class: "mx-3 text-muted-foreground",
801
+ "aria-hidden": !0,
802
+ size: "xs"
803
+ }, u.chevron.single.right), Ye = (e) => n({ class: "flex items-center" }, [
804
+ e.href ? Oe(e.href, e.label) : c(e.label),
805
+ e.separator && Ve()
806
+ ]), Bt = S(
807
+ {
808
+ /**
809
+ * Set initial data
810
+ *
811
+ * @returns {Data}
812
+ */
813
+ setData() {
814
+ return new k({
815
+ // @ts-ignore
816
+ items: this.items || []
817
+ });
818
+ },
819
+ /**
820
+ * Render Breadcrumb Component
821
+ *
822
+ * @returns {object}
823
+ */
824
+ render() {
825
+ const e = this.data.items.length - 1;
826
+ return ee(
827
+ {
828
+ "aria-label": "Breadcrumb",
829
+ class: "flex items-center space-x-1 text-sm"
830
+ },
831
+ [
832
+ n({
833
+ role: "list",
834
+ class: "flex items-center",
835
+ for: ["items", (t, o) => Ye({
836
+ href: t.href,
837
+ label: t.label,
838
+ separator: o < e
839
+ })]
840
+ })
841
+ ]
842
+ );
843
+ }
844
+ }
845
+ ), P = {
846
+ xs: "h-1 w-1",
847
+ sm: "h-2 w-2",
848
+ md: "h-4 w-4",
849
+ lg: "h-8 w-8",
850
+ xl: "h-12 w-12",
851
+ "2xl": "h-16 w-16",
852
+ "3xl": "h-24 w-24",
853
+ default: "h-4 w-4"
854
+ }, qe = (e) => P[e] || P.default, He = ({ index: e, size: t }) => n({ class: `${t} rounded-full bg-muted cursor-pointer` }, [
855
+ c({
856
+ class: "block w-full h-full rounded-full transition-colors",
857
+ onSet: ["activeIndex", {
858
+ "bg-primary": e,
859
+ "shadow-md": e
860
+ }],
861
+ click: (o, { data: s, onClick: a }) => {
862
+ s.activeIndex = e, a && a(e);
863
+ }
864
+ })
865
+ ]), Ue = (e, t) => Array.from({ length: e }, (o, s) => He({
866
+ index: s,
867
+ size: t
868
+ })), $t = S(
869
+ {
870
+ /**
871
+ * Defines component data (props).
872
+ *
873
+ * @returns {Data}
874
+ */
875
+ setData() {
876
+ return new k({
877
+ // @ts-ignore
878
+ count: this.count || 4,
879
+ // total dots
880
+ // @ts-ignore
881
+ activeIndex: this.activeIndex || 0
882
+ });
883
+ },
884
+ /**
885
+ * Renders the dots.
886
+ *
887
+ * @returns {object}
888
+ */
889
+ render() {
890
+ const e = this.gap || "gap-2", t = qe(this.size || "sm"), o = Ue(this.data.count, t);
891
+ return n(
892
+ { class: "flex justify-center items-center py-2" },
893
+ [
894
+ n({ class: `flex ${e}` }, o)
895
+ ]
896
+ );
897
+ }
898
+ }
899
+ ), _e = ({ toggleDropdown: e }) => h(
900
+ {
901
+ cache: "button",
902
+ 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 border-input bg-background hover:bg-muted h-10 px-4 py-2 justify-between",
903
+ click: e
904
+ },
905
+ [
906
+ c({ onState: ["selectedLabel", (t) => t || "Select item..."] }),
907
+ f({ html: u.chevron.upDown })
908
+ ]
909
+ ), Re = (e, t) => V({
910
+ class: "flex flex-auto items-center cursor-pointer p-2 hover:bg-muted/50 rounded-sm",
911
+ click: () => t(e),
912
+ onState: ["selectedValue", { "bg-secondary": e.value }]
913
+ }, [
914
+ e.icon && c({ class: "mr-2 flex items-baseline" }, [f({ class: "flex w-4 h-4", html: e.icon })]),
915
+ c(e.label)
916
+ ]), We = (e) => n({ class: "w-full border rounded-md" }, [
917
+ Y({ class: "max-h-60 overflow-y-auto p-2 grid gap-1", for: ["items", (t) => Re(t, e)] })
918
+ ]), Ge = ({ onSelect: e }) => n({ class: "flex flex-auto flex-col" }, [
919
+ v(
920
+ "open",
921
+ (t, o, s) => t ? new D({
922
+ cache: "dropdown",
923
+ parent: s,
924
+ button: s.button
925
+ }, [
926
+ We(e)
927
+ ]) : null
928
+ )
929
+ ]), Mt = S(
930
+ {
931
+ /**
932
+ * This will set up the data.
933
+ *
934
+ * @returns {Data}
935
+ */
936
+ setData() {
937
+ return new k({
938
+ // @ts-ignore
939
+ items: this.items || []
940
+ });
941
+ },
942
+ /**
943
+ * This will set up the states.
944
+ *
945
+ * @returns {object}
946
+ */
947
+ state: {
948
+ open: !1,
949
+ selectedLabel: "",
950
+ selectedValue: ""
951
+ },
952
+ /**
953
+ * Handles the selection of an item.
954
+ *
955
+ * @param {object} item
956
+ * @returns {void}
957
+ */
958
+ handleSelect(e) {
959
+ const t = this.state;
960
+ t.selectedValue = e.value, t.selectedLabel = e.label, t.open = !1, typeof this.onSelect == "function" && this.onSelect(e);
961
+ },
962
+ /**
963
+ * Toggles the dropdown open state.
964
+ *
965
+ * @returns {void}
966
+ */
967
+ toggleDropdown() {
968
+ this.state.toggle("open");
969
+ },
970
+ /**
971
+ * This will render the component.
972
+ *
973
+ * @returns {object}
974
+ */
975
+ render() {
976
+ const e = (t) => {
977
+ const o = this.state;
978
+ o.selectedValue = t.value, o.selectedLabel = t.label, o.open = !1;
979
+ };
980
+ return n({ class: "relative w-full flex flex-auto flex-col max-w-[250px]" }, [
981
+ // @ts-ignore
982
+ _e({ toggleDropdown: this.toggleDropdown.bind(this) }),
983
+ Ge({ onSelect: e }),
984
+ // Hidden required input for form validation
985
+ // @ts-ignore
986
+ this.required && C({
987
+ class: "opacity-0 absolute top-0 left-0 z-[1]",
988
+ type: "text",
989
+ // @ts-ignore
990
+ name: this.name,
991
+ required: !0,
992
+ // @ts-ignore
993
+ value: ["[[selectedValue]]", this.state]
994
+ })
995
+ ]);
996
+ }
997
+ }
998
+ ), _ = ({ icon: e, click: t, ariaLabel: o }) => m({
999
+ variant: "icon",
1000
+ class: "flex flex-none",
1001
+ click: t,
1002
+ icon: e,
1003
+ "aria-label": o
1004
+ }), Je = ({ click: e }) => _({
1005
+ icon: u.circleMinus,
1006
+ click: e,
1007
+ ariaLabel: "Decrement"
1008
+ }), Ke = ({ click: e }) => _({
1009
+ icon: u.circlePlus,
1010
+ click: e,
1011
+ ariaLabel: "Increment"
1012
+ }), Qe = ({ bind: e, min: t, max: o, readonly: s = !1 }) => C({
1013
+ value: "[[count]]",
1014
+ bind: e,
1015
+ blur: (a, { state: l }) => {
1016
+ let r = parseInt(a.target.value, 10);
1017
+ isNaN(r) && (r = t ?? 0), t !== void 0 && (r = Math.max(r, t)), o !== void 0 && (r = Math.min(r, o)), l.count = r;
1018
+ },
1019
+ class: "flex flex-auto text-lg font-medium bg-transparent text-center border min-w-0",
1020
+ readonly: s,
1021
+ min: t,
1022
+ max: o,
1023
+ type: "number",
1024
+ "aria-label": "Counter"
1025
+ }), Lt = w(
1026
+ {
1027
+ /**
1028
+ * Initial state for the counter component.
1029
+ *
1030
+ * @member {object} state
1031
+ */
1032
+ state() {
1033
+ return {
1034
+ count: {
1035
+ state: this.initialCount ?? 0,
1036
+ callBack: (e) => this.change && this.change(e)
1037
+ }
1038
+ };
1039
+ },
1040
+ /**
1041
+ * Renders the Counter component.
1042
+ *
1043
+ * @returns {object}
1044
+ */
1045
+ render() {
1046
+ const e = this.class ?? "";
1047
+ return n({ class: `flex flex-auto items-center justify-between space-x-4 p-4 ${e}` }, [
1048
+ Je({ click: () => this.state.decrement("count") }),
1049
+ Qe({
1050
+ bind: this.bind,
1051
+ readonly: this.readonly,
1052
+ min: this.min,
1053
+ max: this.max
1054
+ }),
1055
+ Ke({ click: () => this.state.increment("count") })
1056
+ ]);
1057
+ }
1058
+ }
1059
+ ), Xe = ({ bind: e, required: t }) => C({
1060
+ cache: "input",
1061
+ class: "opacity-0 absolute top-0 left-0 w-full h-full pointer-events-none",
1062
+ bind: e,
1063
+ required: t
1064
+ }), Ze = ({ bind: e, required: t, toggleOpen: o }) => h({
1065
+ class: "relative flex items-center gap-2 w-full justify-between border border-input bg-background hover:bg-muted rounded-md h-10 px-4 py-2",
1066
+ click: o
1067
+ }, [
1068
+ Xe({ bind: e, required: t }),
1069
+ c({
1070
+ onState: ["selectedDate", (s) => s ? B.format("standard", s) : "Pick a date"]
1071
+ }),
1072
+ f({ html: u.calendar.days })
1073
+ ]), et = ({ handleDateSelect: e }) => n({ class: "absolute mt-1 z-10 bg-background rounded-md shadow-lg" }, [
1074
+ v(
1075
+ "open",
1076
+ (t, o, s) => t ? new D({
1077
+ cache: "dropdown",
1078
+ parent: s,
1079
+ button: s.panel,
1080
+ size: "fit"
1081
+ }, [
1082
+ new le({
1083
+ selectedDate: s.state.selectedDate,
1084
+ selectedCallBack: e
1085
+ })
1086
+ ]) : null
1087
+ )
1088
+ ]), Nt = w(
1089
+ {
1090
+ /**
1091
+ * The initial state of the DatePicker.
1092
+ *
1093
+ * @member {object} state
1094
+ */
1095
+ state() {
1096
+ return {
1097
+ selectedDate: this.selectedDate ?? null,
1098
+ open: !1
1099
+ };
1100
+ },
1101
+ /**
1102
+ * This is added to check the input after the component is rendered.
1103
+ * to see if the bind updated the input value.
1104
+ *
1105
+ * @returns {void}
1106
+ */
1107
+ after() {
1108
+ this.state.selectedDate = this.input.value;
1109
+ },
1110
+ /**
1111
+ * Renders the DatePicker component.
1112
+ *
1113
+ * @returns {object}
1114
+ */
1115
+ render() {
1116
+ const e = (o, { state: s }) => s.toggle("open"), t = (o) => {
1117
+ this.state.selectedDate = o, this.state.open = !1, this.input.value = o, typeof this.onChange == "function" && this.onChange(o);
1118
+ };
1119
+ return n({ class: "relative w-full max-w-[320px]" }, [
1120
+ Ze({
1121
+ toggleOpen: e,
1122
+ bind: this.bind,
1123
+ required: this.required
1124
+ }),
1125
+ et({
1126
+ handleDateSelect: t
1127
+ })
1128
+ ]);
1129
+ }
1130
+ }
1131
+ ), zt = ({ dateTime: e = "", remoteTimeZone: t = "America/Denver", filter: o = null }) => te([
1132
+ new ie({
1133
+ dateTime: e,
1134
+ filter: o || ((s) => {
1135
+ const a = B.getLocalTime(s, !0, !1, t);
1136
+ return B.getTimeFrame(a);
1137
+ })
1138
+ })
1139
+ ]);
1140
+ function tt({ bind: e, required: t }) {
1141
+ return C({
1142
+ cache: "input",
1143
+ class: "opacity-0 absolute top-0 left-0 w-full h-full pointer-events-none",
1144
+ bind: e,
1145
+ required: t
1146
+ });
1147
+ }
1148
+ function ot({ bind: e, required: t, toggleOpen: o }) {
1149
+ return h(
1150
+ {
1151
+ class: "relative flex items-center gap-2 w-full justify-between border border-input bg-background hover:bg-muted rounded-md h-10 px-4 py-2",
1152
+ click: o
1153
+ },
1154
+ [
1155
+ tt({ bind: e, required: t }),
1156
+ c({
1157
+ onState: ["selectedTime", (s) => s || "Pick a time"]
1158
+ }),
1159
+ f({ html: u.clock })
1160
+ ]
1161
+ );
1162
+ }
1163
+ function A({ items: e, handleTimeSelect: t, state: o, stateValue: s, pad: a = !1 }) {
1164
+ return n(
1165
+ { class: "flex flex-col max-h-[200px] overflow-y-auto" },
1166
+ e.map((l) => {
1167
+ let r = a ? l.toString().padStart(2, "0") : l.toString();
1168
+ return h({
1169
+ text: r,
1170
+ class: "hover:bg-muted/50 rounded-md px-2 py-1",
1171
+ click: () => t({ [s]: r }),
1172
+ onState: [o, s, { "bg-muted": r }]
1173
+ });
1174
+ })
1175
+ );
1176
+ }
1177
+ function st({ handleTimeSelect: e }) {
1178
+ return n(
1179
+ { class: "absolute mt-1 z-10 bg-background rounded-md shadow-lg" },
1180
+ [
1181
+ v(
1182
+ "open",
1183
+ (t, o, s) => t ? new D(
1184
+ {
1185
+ cache: "dropdown",
1186
+ parent: s,
1187
+ button: s.panel,
1188
+ size: "fit"
1189
+ },
1190
+ [
1191
+ n(
1192
+ { class: "flex flex-auto flex-col border rounded-md shadow-md" },
1193
+ [
1194
+ n(
1195
+ { class: "grid grid-cols-3 gap-2 p-4 text-center max-h-[220px] min-w-[240px]" },
1196
+ [
1197
+ // Hours column
1198
+ A({
1199
+ items: Array.from({ length: 12 }, (a, l) => l + 1),
1200
+ handleTimeSelect: e,
1201
+ state: s.state,
1202
+ stateValue: "hour",
1203
+ pad: !0
1204
+ }),
1205
+ // Minutes column
1206
+ A({
1207
+ items: Array.from({ length: 60 }, (a, l) => l),
1208
+ handleTimeSelect: e,
1209
+ state: s.state,
1210
+ stateValue: "minute",
1211
+ pad: !0
1212
+ }),
1213
+ // AM/PM column
1214
+ A({
1215
+ items: ["AM", "PM"],
1216
+ handleTimeSelect: e,
1217
+ state: s.state,
1218
+ stateValue: "meridian"
1219
+ })
1220
+ ]
1221
+ )
1222
+ ]
1223
+ )
1224
+ ]
1225
+ ) : null
1226
+ )
1227
+ ]
1228
+ );
1229
+ }
1230
+ function j(e) {
1231
+ if (!e)
1232
+ return { hour: null, minute: null, meridian: null };
1233
+ const t = /^(\d{1,2}):(\d{2})(?::(\d{2}))?\s?(AM|PM)?$/i, o = e.match(t);
1234
+ if (!o)
1235
+ return { hour: null, minute: null, meridian: null };
1236
+ let [, s, a, , l] = o, r = parseInt(s, 10), b = parseInt(a, 10);
1237
+ return r < 0 || r > 23 || b < 0 || b > 59 ? { hour: null, minute: null, meridian: null } : (l ? (l = l.toUpperCase(), l === "PM" && r < 12 ? r += 12 : l === "AM" && r === 12 && (r = 12)) : r === 0 ? (l = "AM", r = 12) : r < 12 ? l = "AM" : r === 12 ? l = "PM" : (l = "PM", r -= 12), {
1238
+ hour: r.toString().padStart(2, "0"),
1239
+ minute: b.toString().padStart(2, "0"),
1240
+ meridian: l
1241
+ });
1242
+ }
1243
+ const Ft = w(
1244
+ {
1245
+ /**
1246
+ * The initial shallow state of the TimePicker.
1247
+ *
1248
+ * @member {object} state
1249
+ */
1250
+ state() {
1251
+ const e = this.selectedTime ?? null, { hour: t, minute: o, meridian: s } = j(e);
1252
+ return {
1253
+ selectedTime: e,
1254
+ open: !1,
1255
+ hour: t,
1256
+ minute: o,
1257
+ meridian: s
1258
+ };
1259
+ },
1260
+ /**
1261
+ * Updates the state after the input is rendered.
1262
+ *
1263
+ * @returns {void}
1264
+ */
1265
+ after() {
1266
+ if (this.input.value) {
1267
+ const { hour: e, minute: t, meridian: o } = j(this.input.value);
1268
+ this.state.set({
1269
+ hour: e,
1270
+ minute: t,
1271
+ meridian: o,
1272
+ selectedTime: this.input.value
1273
+ });
1274
+ }
1275
+ },
1276
+ /**
1277
+ * Renders the TimePicker component.
1278
+ *
1279
+ * @returns {object}
1280
+ */
1281
+ render() {
1282
+ const e = (o, { state: s }) => s.toggle("open"), t = ({ hour: o, minute: s, meridian: a }) => {
1283
+ if (o && (this.state.hour = o), s && (this.state.minute = s), a && (this.state.meridian = a), this.state.hour && this.state.minute && this.state.meridian) {
1284
+ const l = `${this.state.hour}:${this.state.minute} ${this.state.meridian}`;
1285
+ this.state.selectedTime = l, this.state.open = !1, this.input.value = l, typeof this.change == "function" && this.change(l);
1286
+ }
1287
+ };
1288
+ return n(
1289
+ { class: "relative w-full max-w-[320px]" },
1290
+ [
1291
+ ot({
1292
+ toggleOpen: e,
1293
+ bind: this.bind,
1294
+ required: this.required
1295
+ }),
1296
+ st({
1297
+ handleTimeSelect: t
1298
+ })
1299
+ ]
1300
+ );
1301
+ }
1302
+ }
1303
+ ), nt = (e, t) => n({ class: `hidden md:flex items-start justify-center w-6 h-6 mr-3 ${t}` }, [
1304
+ I({ size: "lg" }, e)
1305
+ ]), lt = ({ title: e }) => L({ class: "flex flex-auto items-center" }, [
1306
+ $({ class: "text-lg font-semibold" }, e)
1307
+ ]), rt = d((e, t) => oe(
1308
+ {
1309
+ class: `fixed pullUpIn z-30 w-[98%] border md:w-full max-w-lg bg-popover text-foreground shadow-lg duration-200
1310
+ rounded-lg flex flex-auto flex-col
1311
+ bottom-4 top-auto inset-auto m-auto md:bottom-0 md:top-0 left-0 right-0 ${e.class}`,
1312
+ click: e.click,
1313
+ aria: { expanded: ["open"] }
1314
+ },
1315
+ [
1316
+ n({ class: "flex flex-auto p-6 pb-12 md:pb-6" }, [
1317
+ // Icon and content
1318
+ e.icon && nt(e.icon, e.iconColor),
1319
+ n({ class: "flex flex-auto flex-col gap-4" }, [
1320
+ n({ class: "flex flex-auto flex-col space-y-2" }, [
1321
+ lt(e),
1322
+ e.description && p({ class: "flex flex-auto flex-col text-sm text-muted-foreground" }, e.description),
1323
+ n({ class: "flex flex-auto flex-col text-sm text-muted-foreground" }, t)
1324
+ ]),
1325
+ e.buttons && M({ class: "flex flex-col-reverse sm:flex-row sm:justify-end mt-6 gap-2 sm:gap-0 sm:space-x-2" }, e.buttons)
1326
+ ])
1327
+ ])
1328
+ ]
1329
+ )), at = (e) => H.render(e, app.root), O = {
1330
+ info: {
1331
+ borderColor: "border-blue-500",
1332
+ bgColor: "bg-muted/10",
1333
+ iconColor: "text-blue-500"
1334
+ },
1335
+ warning: {
1336
+ bgColor: "bg-muted/10",
1337
+ borderColor: "border-warning",
1338
+ iconColor: "text-warning"
1339
+ },
1340
+ destructive: {
1341
+ bgColor: "bg-muted/10",
1342
+ borderColor: "border-destructive",
1343
+ iconColor: "text-red-500"
1344
+ },
1345
+ success: {
1346
+ bgColor: "bg-muted/10",
1347
+ borderColor: "border-emerald-500",
1348
+ iconColor: "text-emerald-500"
1349
+ },
1350
+ default: {
1351
+ borderColor: "border",
1352
+ bgColor: "bg-muted/10",
1353
+ iconColor: "text-muted-foreground"
1354
+ }
1355
+ };
1356
+ class it extends x {
1357
+ constructor() {
1358
+ super(...arguments);
1359
+ /**
1360
+ * @member {string} title
1361
+ */
1362
+ i(this, "title", null);
1363
+ /**
1364
+ * @member {string} description
1365
+ */
1366
+ i(this, "description", null);
1367
+ /**
1368
+ * @member {string} Type
1369
+ * @default ''
1370
+ * @values 'info', 'warning', 'destructive', 'success', 'default'
1371
+ */
1372
+ i(this, "type", "");
1373
+ /**
1374
+ * @member {string} icon
1375
+ */
1376
+ i(this, "icon", null);
1377
+ /**
1378
+ * @member {function|null} onClose
1379
+ */
1380
+ i(this, "onClose", null);
1381
+ /**
1382
+ * @member {boolean} hideFooter
1383
+ */
1384
+ i(this, "hideFooter", !1);
1385
+ /**
1386
+ * @member {Array|null} buttons
1387
+ */
1388
+ i(this, "buttons", null);
1389
+ }
1390
+ /**
1391
+ * This will render the modal component.
1392
+ *
1393
+ * @returns {object}
1394
+ */
1395
+ render() {
1396
+ const o = (R) => {
1397
+ R.target === this.panel && this.close();
1398
+ }, { borderColor: s, bgColor: a, iconColor: l } = O[this.type] || O.default, r = `${this.getMainClass()} ${a} ${s}`, b = this.title || "Dialog Title";
1399
+ return rt({
1400
+ class: r,
1401
+ title: b,
1402
+ click: o,
1403
+ icon: this.icon,
1404
+ iconColor: l,
1405
+ description: this.description,
1406
+ buttons: this.getButtons()
1407
+ }, this.children);
1408
+ }
1409
+ /**
1410
+ * This will get the buttons for the modal.
1411
+ *
1412
+ * @returns {array}
1413
+ */
1414
+ getButtons() {
1415
+ return this.hideFooter ? null : this.buttons ? this.buttons : [
1416
+ m({ variant: "outline", click: () => this.close() }, "Close")
1417
+ ];
1418
+ }
1419
+ /**
1420
+ * This will setup the states.
1421
+ *
1422
+ * @returns {object}
1423
+ */
1424
+ setupStates() {
1425
+ return {
1426
+ open: !1
1427
+ };
1428
+ }
1429
+ /**
1430
+ * This will get the modal class.
1431
+ *
1432
+ * @returns {string}
1433
+ */
1434
+ getMainClass() {
1435
+ return "";
1436
+ }
1437
+ /**
1438
+ * This will open the modal.
1439
+ *
1440
+ * @returns {void}
1441
+ */
1442
+ open() {
1443
+ at(this), this.panel.showModal(), this.state.open = !0;
1444
+ }
1445
+ /**
1446
+ * This will close the modal.
1447
+ *
1448
+ * @returns {void}
1449
+ */
1450
+ close() {
1451
+ this.state.open = !1, this.panel.close(), typeof this.onClose == "function" && this.onClose(), this.destroy();
1452
+ }
1453
+ }
1454
+ class Et extends it {
1455
+ constructor() {
1456
+ super(...arguments);
1457
+ /**
1458
+ * @member {string} confirmTextLabel
1459
+ */
1460
+ i(this, "confirmTextLabel", null);
1461
+ /**
1462
+ * @member {function} confirmed
1463
+ */
1464
+ i(this, "confirmed", null);
1465
+ }
1466
+ /**
1467
+ * This will get the buttons for the modal.
1468
+ *
1469
+ * @returns {array}
1470
+ */
1471
+ getButtons() {
1472
+ const o = this.confirmTextLabel || "Confirm";
1473
+ return [
1474
+ m({ variant: "outline", click: () => this.close() }, "Cancel"),
1475
+ m({ variant: "primary", click: () => this.confirm() }, o)
1476
+ ];
1477
+ }
1478
+ /**
1479
+ * This will confirm the action.
1480
+ *
1481
+ * @returns {void}
1482
+ */
1483
+ confirm() {
1484
+ this.confirmed && this.confirmed(), this.close();
1485
+ }
1486
+ }
1487
+ export {
1488
+ pt as A,
1489
+ Bt as B,
1490
+ Mt as C,
1491
+ me as D,
1492
+ rt as E,
1493
+ ve as F,
1494
+ it as G,
1495
+ kt as M,
1496
+ St as N,
1497
+ Ke as P,
1498
+ Ct as S,
1499
+ Dt as T,
1500
+ be as a,
1501
+ xt as b,
1502
+ xe as c,
1503
+ Ce as d,
1504
+ ke as e,
1505
+ Se as f,
1506
+ Ie as g,
1507
+ wt as h,
1508
+ Ae as i,
1509
+ yt as j,
1510
+ vt as k,
1511
+ Fe as l,
1512
+ It as m,
1513
+ Tt as n,
1514
+ At as o,
1515
+ y as p,
1516
+ g as q,
1517
+ je as r,
1518
+ $t as s,
1519
+ Je as t,
1520
+ Qe as u,
1521
+ Lt as v,
1522
+ Nt as w,
1523
+ zt as x,
1524
+ Ft as y,
1525
+ Et as z
1526
+ };