@base-framework/ui 1.0.1726 → 1.0.2000
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/copilot.md +80 -0
- package/dist/aside-template-sUm-F2f0.js +44 -0
- package/dist/atoms.es.js +31 -30
- package/dist/{bside-template-Du2m3rsE.js → bside-template-do_hXebn.js} +1 -1
- package/dist/{buttons-Cm9etaEG.js → buttons-CHEs54Wl.js} +23 -24
- package/dist/{confirmation-BxmDhBjv.js → empty-state-BfT4MKkN.js} +721 -335
- package/dist/form-group-CJzpq9Us.js +29 -0
- package/dist/format-BLolnx9j.js +122 -0
- package/dist/icons.es.js +4 -1
- package/dist/image-scaler-1G-JzJVG.js +530 -0
- package/dist/index.es.js +170 -151
- package/dist/inputs-9udyzkHR.js +210 -0
- package/dist/{mobile-nav-wrapper-Dj67Pb8l.js → mobile-nav-wrapper-Dm9DinRD.js} +2 -2
- package/dist/molecules.es.js +46 -39
- package/dist/organisms.es.js +55 -49
- package/dist/pages.es.js +1 -1
- package/dist/range-calendar-BMWSJTE0.js +833 -0
- package/dist/{sidebar-menu-page-BVryQj2Z.js → sidebar-menu-page-D4WMgz5U.js} +6 -6
- package/dist/{signature-panel-BMKPAG1c.js → signature-panel-CcRmukPe.js} +598 -252
- package/dist/templates.es.js +2 -2
- package/dist/{tooltip-CESEqMCU.js → tooltip-PupzYM1r.js} +27 -34
- package/dist/types/components/atoms/atoms.d.ts +1 -0
- package/dist/types/components/atoms/form/form-group.d.ts +12 -0
- package/dist/types/components/atoms/form/inputs/input-classes.d.ts +2 -2
- package/dist/types/components/atoms/form/inputs/inputs.d.ts +0 -7
- package/dist/types/components/molecules/date-time/date-range-picker.d.ts +10 -0
- package/dist/types/components/molecules/empty/empty-state.d.ts +9 -0
- package/dist/types/components/molecules/files/attachment/attachment-input.d.ts +9 -0
- package/dist/types/components/molecules/files/attachment/attachment.d.ts +10 -0
- package/dist/types/components/molecules/files/attachment/orientation.d.ts +1 -0
- package/dist/types/components/molecules/files/attachment/type.d.ts +1 -0
- package/dist/types/components/molecules/form/form-card.d.ts +31 -0
- package/dist/types/components/molecules/image/image-uploader.d.ts +9 -0
- package/dist/types/components/molecules/image/logo-uploader.d.ts +9 -0
- package/dist/types/components/molecules/molecules.d.ts +5 -0
- package/dist/types/components/molecules/notifications/notification.d.ts +3 -3
- package/dist/types/components/organisms/calendar/calendar.d.ts +6 -0
- package/dist/types/components/organisms/calendar/month/calendar-header.d.ts +7 -0
- package/dist/types/components/organisms/calendar/month-selector.d.ts +5 -0
- package/dist/types/components/organisms/calendar/range/calendar-header.d.ts +7 -0
- package/dist/types/components/organisms/calendar/range/day-header.d.ts +1 -0
- package/dist/types/components/organisms/calendar/range/days-of-week-header.d.ts +1 -0
- package/dist/types/components/organisms/calendar/range/month-calendar.d.ts +17 -0
- package/dist/types/components/organisms/calendar/range/month-selector.d.ts +5 -0
- package/dist/types/components/organisms/calendar/range/navigation-button.d.ts +1 -0
- package/dist/types/components/organisms/calendar/range/range-calendar.d.ts +72 -0
- package/dist/types/components/organisms/calendar/range/range-day-cell.d.ts +10 -0
- package/dist/types/components/organisms/calendar/range/range-days-grid.d.ts +6 -0
- package/dist/types/components/organisms/calendar/range/range-toggle.d.ts +7 -0
- package/dist/types/components/organisms/calendar/range/year-selector.d.ts +4 -0
- package/dist/types/components/organisms/calendar/year-selector.d.ts +5 -0
- package/dist/types/components/organisms/lists/data-table-body.d.ts +1 -1
- package/dist/types/components/organisms/lists/data-table.d.ts +7 -0
- package/dist/types/components/organisms/lists/dynamic-data-table.d.ts +2 -0
- package/dist/types/components/organisms/lists/dynamic-table.d.ts +2 -0
- package/dist/types/components/organisms/lists/scrollable-data-table.d.ts +2 -0
- package/dist/types/components/organisms/lists/scrollable-table.d.ts +2 -0
- package/dist/types/components/organisms/lists/skeleton-examples.d.ts +12 -0
- package/dist/types/components/organisms/lists/skeleton-table-row.d.ts +6 -0
- package/dist/types/components/organisms/organisms.d.ts +6 -0
- package/dist/types/components/organisms/tabs/button-tab.d.ts +2 -2
- package/dist/types/components/organisms/tabs/tab-group.d.ts +3 -3
- package/dist/types/components/organisms/tabs/tab-navigation.d.ts +2 -2
- package/dist/types/components/organisms/tabs/tab.d.ts +2 -2
- package/dist/types/components/organisms/tabs/underlined-button-tab.d.ts +60 -0
- package/dist/types/components/organisms/tabs/underlined-tab-group.d.ts +48 -0
- package/dist/types/components/organisms/tabs/underlined-tab-navigation.d.ts +63 -0
- package/dist/types/components/organisms/tabs/underlined-tab.d.ts +36 -0
- package/dist/types/demo.d.ts +0 -0
- package/dist/types/ui.d.ts +1 -0
- package/dist/types/utils/format/format.d.ts +78 -0
- package/dist/types/utils/utils.d.ts +2 -0
- package/dist/utils.es.js +7 -1
- package/dist/veil-CqnAmj-D.js +20 -0
- package/package.json +85 -85
- package/dist/aside-template-McEj_Gxc.js +0 -35
- package/dist/calendar-DQXME-2u.js +0 -440
- package/dist/inputs-Dmu4Z-7-.js +0 -209
- package/dist/veil-D4dRxILB.js +0 -21
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { Div as n, H5 as
|
|
2
|
-
import { Atom as c, Component as
|
|
3
|
-
import { P as
|
|
4
|
-
import {
|
|
1
|
+
import { Div as n, H5 as X, P as b, I as x, Li as q, Span as a, Ul as Y, Button as m, OnState as D, Label as A, H2 as S, Form as Z, Header as T, Footer as M, A as V, H3 as ee, Checkbox as te, Input as f, Img as _, Nav as se, UseParent as W, OnStateOpen as P, Time as oe, Dialog as ne } from "@base-framework/atoms";
|
|
2
|
+
import { Atom as c, Component as y, Html as O, Dom as re, base as le, Data as F, Builder as G, Jot as w, Events as p, DateTime as L } from "@base-framework/base";
|
|
3
|
+
import { P as I, b as ie, R as ae } from "./range-calendar-BMWSJTE0.js";
|
|
4
|
+
import { C as ce, F as ue } from "./form-group-CJzpq9Us.js";
|
|
5
|
+
import { B as h, I as g } from "./buttons-CHEs54Wl.js";
|
|
5
6
|
import { Icons as u } from "./icons.es.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
7
|
+
import { Timer as de, List as he, DynamicTime as fe } from "@base-framework/organisms";
|
|
8
|
+
import { a as C } from "./veil-CqnAmj-D.js";
|
|
9
|
+
import { F as j } from "./format-BLolnx9j.js";
|
|
10
|
+
const z = {
|
|
9
11
|
info: {
|
|
10
12
|
borderColor: "border-blue-500",
|
|
11
13
|
bgColor: "bg-muted/10",
|
|
@@ -31,20 +33,20 @@ const P = {
|
|
|
31
33
|
bgColor: "bg-muted/10",
|
|
32
34
|
iconColor: "text-muted-foreground"
|
|
33
35
|
}
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
]),
|
|
37
|
-
const { borderColor:
|
|
38
|
-
return n({ class: `flex items-start p-4 border rounded-lg ${
|
|
36
|
+
}, me = (e, t) => n({ class: `flex items-center justify-center h-6 w-6 mr-3 ${t}` }, [
|
|
37
|
+
x({ html: e })
|
|
38
|
+
]), ge = (e) => X({ class: "font-semibold" }, e), pe = (e) => b({ class: "text-sm text-muted-foreground" }, e), Lt = c(({ title: e, description: t, icon: s, type: o = "default" }) => {
|
|
39
|
+
const { borderColor: r, bgColor: l, iconColor: i } = z[o] || z.default;
|
|
40
|
+
return n({ class: `flex items-start p-4 border rounded-lg ${l} ${r}` }, [
|
|
39
41
|
// Icon and content
|
|
40
|
-
s &&
|
|
42
|
+
s && me(s, i),
|
|
41
43
|
n({ class: "flex flex-col" }, [
|
|
42
|
-
|
|
43
|
-
|
|
44
|
+
ge(e),
|
|
45
|
+
pe(t)
|
|
44
46
|
])
|
|
45
47
|
]);
|
|
46
48
|
});
|
|
47
|
-
class
|
|
49
|
+
class At extends y {
|
|
48
50
|
/**
|
|
49
51
|
* This will declare the props for the compiler.
|
|
50
52
|
*
|
|
@@ -62,48 +64,48 @@ class ce extends p {
|
|
|
62
64
|
this.prepareDestroy(), this.removeContext();
|
|
63
65
|
const t = this.panel, s = this.removingClass;
|
|
64
66
|
if (!s) {
|
|
65
|
-
|
|
67
|
+
O.removeElement(t);
|
|
66
68
|
return;
|
|
67
69
|
}
|
|
68
|
-
|
|
70
|
+
re.addClass(t, s), le.on("animationend", t, (o) => O.removeElement(t));
|
|
69
71
|
}
|
|
70
72
|
}
|
|
71
|
-
const
|
|
73
|
+
const be = (e) => a({ class: "ml-auto text-xs tracking-widest opacity-60" }, e), xe = (e) => a({ class: "flex w-4 h-4", html: e }), ve = (e) => a({ class: "flex-auto" }, e), ye = (e, t) => q({
|
|
72
74
|
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",
|
|
73
75
|
click: () => t(e)
|
|
74
76
|
}, [
|
|
75
|
-
e.icon &&
|
|
76
|
-
|
|
77
|
-
e.shortcut &&
|
|
78
|
-
]),
|
|
79
|
-
e.map((s) =>
|
|
80
|
-
]),
|
|
77
|
+
e.icon && xe(e.icon),
|
|
78
|
+
ve(e.label),
|
|
79
|
+
e.shortcut && be(e.shortcut)
|
|
80
|
+
]), we = (e, t) => Y({ class: "grid gap-2" }, [
|
|
81
|
+
e.map((s) => ye(s, t))
|
|
82
|
+
]), Ce = (e) => n({ class: "w-full z-10" }, [
|
|
81
83
|
n({
|
|
82
84
|
class: "max-h-60 border rounded-md overflow-y-auto p-1 grid gap-2 divide-y divide-border",
|
|
83
|
-
for: ["groups", (t) =>
|
|
85
|
+
for: ["groups", (t) => we(t, e)]
|
|
84
86
|
})
|
|
85
|
-
]),
|
|
87
|
+
]), Se = ({ label: e, icon: t, toggleDropdown: s }) => m({
|
|
86
88
|
cache: "button",
|
|
87
|
-
class: `inline-flex items-center justify-between rounded-md border
|
|
88
|
-
|
|
89
|
+
class: `inline-flex items-center justify-between rounded-md border
|
|
90
|
+
px-2 py-2 text-sm font-medium hover:bg-muted
|
|
89
91
|
focus:outline-none transition duration-150 ease-in-out`,
|
|
90
92
|
click: s
|
|
91
93
|
}, [
|
|
92
94
|
e && a(e),
|
|
93
|
-
t &&
|
|
94
|
-
]),
|
|
95
|
-
|
|
95
|
+
t && x({ html: t })
|
|
96
|
+
]), Ie = ({ onSelect: e }) => n([
|
|
97
|
+
D(
|
|
96
98
|
"open",
|
|
97
|
-
(t, s, o) => t ? new
|
|
99
|
+
(t, s, o) => t ? new I({
|
|
98
100
|
cache: "dropdown",
|
|
99
101
|
parent: o,
|
|
100
102
|
button: o.button
|
|
101
103
|
}, [
|
|
102
|
-
|
|
104
|
+
Ce(e)
|
|
103
105
|
]) : null
|
|
104
106
|
)
|
|
105
107
|
]);
|
|
106
|
-
class
|
|
108
|
+
class Mt extends y {
|
|
107
109
|
/**
|
|
108
110
|
* This will declare the props for the compiler.
|
|
109
111
|
*
|
|
@@ -118,7 +120,7 @@ class ft extends p {
|
|
|
118
120
|
* @returns {Data}
|
|
119
121
|
*/
|
|
120
122
|
setData() {
|
|
121
|
-
return new
|
|
123
|
+
return new F({
|
|
122
124
|
groups: this.groups || []
|
|
123
125
|
});
|
|
124
126
|
}
|
|
@@ -157,33 +159,42 @@ class ft extends p {
|
|
|
157
159
|
*/
|
|
158
160
|
render() {
|
|
159
161
|
return n({ class: "relative" }, [
|
|
160
|
-
|
|
162
|
+
Se({
|
|
161
163
|
label: this.label,
|
|
162
164
|
icon: this.icon,
|
|
163
165
|
toggleDropdown: this.toggleDropdown.bind(this)
|
|
164
166
|
}),
|
|
165
|
-
|
|
167
|
+
Ie({ onSelect: this.handleSelect.bind(this) })
|
|
166
168
|
]);
|
|
167
169
|
}
|
|
168
170
|
}
|
|
169
|
-
const
|
|
171
|
+
const ke = c((e, t) => n({ ...e, class: "flex flex-auto flex-col gap-y-2" }, t)), De = c((e, t) => A({ ...e, class: "flex auto text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70" }, t)), Te = c((e, t) => b({ ...e, class: "text-sm text-muted-foreground italic" }, t)), Fe = c((e, t) => b({ ...e, class: "text-sm text-destructive" }, t)), Pt = c((e, t = []) => ce({ class: "flex flex-auto flex-col gap-y-0", margin: "m-0", padding: "p-0" }, [
|
|
172
|
+
e.title && S({ class: "text-lg font-semibold py-4 px-6" }, e.title),
|
|
173
|
+
e.description && b({ class: "text-sm text-muted-foreground pb-4 px-6 max-w-[700px]" }, e.description),
|
|
174
|
+
...t
|
|
175
|
+
])), Ot = c((e, t = []) => ue({ label: e.label, description: e.description, class: "py-4 px-6", border: e.border }, [
|
|
176
|
+
n({ class: "flex flex-col gap-y-6" }, t)
|
|
177
|
+
])), jt = c((e, t = []) => {
|
|
178
|
+
const s = e.border ? "border-t" : "";
|
|
179
|
+
return n({ ...e, class: `flex flex-col pb-4 px-6 gap-y-4 ${s} ${e.class || ""}` }, t);
|
|
180
|
+
}), $e = (e) => e.tag === "input" || e.tag === "select" || e.tag === "textarea", J = (e, t, s) => e.map((o) => !o || (o.children && o.children.length > 0 && (o.children = J(o.children, t, s)), !o.required) ? o : $e(o) ? {
|
|
170
181
|
...o,
|
|
171
182
|
aria: {
|
|
172
183
|
invalid: ["hasError"]
|
|
173
184
|
},
|
|
174
185
|
invalid: s,
|
|
175
186
|
input: t
|
|
176
|
-
} : o)
|
|
177
|
-
const
|
|
178
|
-
|
|
179
|
-
}, (
|
|
180
|
-
e.setError(
|
|
187
|
+
} : o), Be = c((e, t) => {
|
|
188
|
+
const r = J(t, (l) => {
|
|
189
|
+
l.target.checkValidity() && e.setError(null);
|
|
190
|
+
}, (l) => {
|
|
191
|
+
e.setError(l.target.validationMessage);
|
|
181
192
|
});
|
|
182
193
|
return n({
|
|
183
194
|
...e,
|
|
184
195
|
class: "w-full"
|
|
185
|
-
},
|
|
186
|
-
}),
|
|
196
|
+
}, r);
|
|
197
|
+
}), zt = C(
|
|
187
198
|
{
|
|
188
199
|
/**
|
|
189
200
|
* The initial state of the FormField.
|
|
@@ -204,70 +215,70 @@ const xe = c((e, t) => n({ ...e, class: "flex flex-auto flex-col space-y-2" }, t
|
|
|
204
215
|
* @returns {object}
|
|
205
216
|
*/
|
|
206
217
|
render() {
|
|
207
|
-
const e = this.name, t = this.getId(`${e}`), { label: s, description: o } = this,
|
|
208
|
-
this.state.error =
|
|
218
|
+
const e = this.name, t = this.getId(`${e}`), { label: s, description: o } = this, r = (l) => {
|
|
219
|
+
this.state.error = l, this.state.hasError = !!l;
|
|
209
220
|
};
|
|
210
|
-
return n({ class: "flex flex-auto
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
221
|
+
return n({ class: "flex flex-auto gap-y-4" }, [
|
|
222
|
+
ke([
|
|
223
|
+
De({ htmlFor: t }, s),
|
|
224
|
+
Be({
|
|
214
225
|
id: t,
|
|
215
226
|
name: e,
|
|
216
227
|
value: this.state.value,
|
|
217
|
-
setError:
|
|
228
|
+
setError: r
|
|
218
229
|
}, this.children),
|
|
219
|
-
o &&
|
|
220
|
-
n({ onState: ["error", (
|
|
230
|
+
o && Te({ id: this.getId("description") }, o),
|
|
231
|
+
n({ onState: ["error", (l) => l && Fe(l)] })
|
|
221
232
|
])
|
|
222
233
|
]);
|
|
223
234
|
}
|
|
224
235
|
}
|
|
225
|
-
),
|
|
236
|
+
), Le = (e, t, s = null) => {
|
|
226
237
|
e.target.checkValidity() && (e.preventDefault(), s && s(e, t));
|
|
227
|
-
},
|
|
228
|
-
(e, t) =>
|
|
229
|
-
),
|
|
230
|
-
e.title &&
|
|
238
|
+
}, K = c(
|
|
239
|
+
(e, t) => Z({ ...e, submit: (s, o) => Le(s, o, e.submit), class: `w-full ${e.class ?? ""}` }, t)
|
|
240
|
+
), Et = c((e, t) => n({ ...e, class: `flex flex-auto flex-col gap-y-6 p-4 md:p-6 divide-y ${e.class || ""}` }, t)), Nt = c((e, t = []) => n({ class: "flex flex-col gap-y-3 py-4" }, [
|
|
241
|
+
e.title && S({ class: "font-semibold" }, e.title),
|
|
231
242
|
...t
|
|
232
|
-
])),
|
|
243
|
+
])), Ut = (e, t) => n({ class: "flex justify-between" }, [
|
|
233
244
|
a({ class: "text-muted-foreground" }, e),
|
|
234
245
|
a(t)
|
|
235
|
-
]),
|
|
246
|
+
]), Rt = (e, t) => n({ class: "flex" }, [
|
|
236
247
|
a({ class: "text-muted-foreground mr-8 w-24 truncate text-nowrap" }, e),
|
|
237
248
|
a(t)
|
|
238
|
-
]),
|
|
249
|
+
]), Ae = ({ title: e, description: t, back: s, icon: o, options: r = [] }) => T({ class: "modal-header bg-background/80 backdrop-blur-md sticky flex flex-none items-center py-4 px-6 z-10 min-w-0" }, [
|
|
239
250
|
/**
|
|
240
251
|
* Back Button
|
|
241
252
|
*/
|
|
242
|
-
s && h({ variant: "icon", icon: u.arrows.left, class: "mr-2 p-0 flex sm:hidden", click: (
|
|
253
|
+
s && h({ variant: "icon", icon: u.arrows.left, class: "mr-2 p-0 flex sm:hidden", click: (l, i) => i.close() }),
|
|
243
254
|
/**
|
|
244
255
|
* Icon
|
|
245
256
|
*/
|
|
246
|
-
o && n({ class: "mr-2 w-12 h-12 rounded-full bg-muted flex flex-none items-center justify-center" }, [
|
|
257
|
+
o && n({ class: "mr-2 w-12 h-12 rounded-full bg-muted flex flex-none items-center justify-center" }, [g(o)]),
|
|
247
258
|
/**
|
|
248
259
|
* Title and Description
|
|
249
260
|
*/
|
|
250
|
-
n({ class: "flex flex-auto flex-row justify-between
|
|
251
|
-
n({ class: "flex flex-auto flex-col" }, [
|
|
252
|
-
|
|
261
|
+
n({ class: "flex flex-auto flex-row justify-between ml-2 gap-2 min-w-0" }, [
|
|
262
|
+
n({ class: "flex flex-auto flex-col min-w-0" }, [
|
|
263
|
+
S({ class: "text-lg font-semibold m-0 truncate" }, e),
|
|
253
264
|
t && n({ class: "text-sm text-muted-foreground truncate" }, t)
|
|
254
265
|
]),
|
|
255
|
-
|
|
266
|
+
n({ class: "flex flex-none items-center gap-2" }, r)
|
|
256
267
|
])
|
|
257
|
-
]),
|
|
268
|
+
]), Me = c((e, t) => n({
|
|
258
269
|
popover: "manual",
|
|
259
|
-
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}`,
|
|
270
|
+
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 overflow-hidden ${e.class}`,
|
|
260
271
|
click: (s, o) => {
|
|
261
272
|
s.target === o.panel && (s.preventDefault(), s.stopPropagation(), o.state.open = !1);
|
|
262
273
|
}
|
|
263
274
|
}, [
|
|
264
|
-
|
|
265
|
-
|
|
275
|
+
K({ class: "modal-content relative bg-background z-[1] flex flex-auto flex-col gap-y-4 overflow-hidden", submit: (s, o) => e.onSubmit && e.onSubmit(o) }, [
|
|
276
|
+
Ae(e),
|
|
266
277
|
n({ class: "modal-body flex flex-grow flex-col overflow-y-auto py-0 px-6 z-0" }, t),
|
|
267
278
|
M({ class: "modal-footer sticky bg-background/80 backdrop-blur-md flex flex-none justify-between py-4 px-6 z-10" }, e.buttons)
|
|
268
279
|
])
|
|
269
|
-
])),
|
|
270
|
-
class
|
|
280
|
+
])), Pe = (e) => G.render(e, app.root);
|
|
281
|
+
class Ht extends y {
|
|
271
282
|
/**
|
|
272
283
|
* This will declare the props for the compiler.
|
|
273
284
|
*
|
|
@@ -283,16 +294,16 @@ class yt extends p {
|
|
|
283
294
|
*/
|
|
284
295
|
render() {
|
|
285
296
|
const t = this.getMainClass(), s = this.title || "", o = this.description || null;
|
|
286
|
-
return
|
|
297
|
+
return Me(
|
|
287
298
|
{
|
|
288
299
|
class: t,
|
|
289
300
|
title: s,
|
|
290
301
|
description: o,
|
|
291
302
|
options: this.headerOptions(),
|
|
292
303
|
buttons: this.getButtons(),
|
|
293
|
-
onSubmit: (
|
|
294
|
-
let
|
|
295
|
-
this.onSubmit && (
|
|
304
|
+
onSubmit: (r) => {
|
|
305
|
+
let l = !0;
|
|
306
|
+
this.onSubmit && (l = this.onSubmit(r)), l !== !1 && this.destroy();
|
|
296
307
|
},
|
|
297
308
|
icon: this.icon,
|
|
298
309
|
back: this.back ?? !1,
|
|
@@ -398,7 +409,7 @@ class yt extends p {
|
|
|
398
409
|
* @returns {void}
|
|
399
410
|
*/
|
|
400
411
|
open() {
|
|
401
|
-
|
|
412
|
+
Pe(this), this.showModal();
|
|
402
413
|
}
|
|
403
414
|
/**
|
|
404
415
|
* This will destroy the modal.
|
|
@@ -427,7 +438,7 @@ class yt extends p {
|
|
|
427
438
|
this.panel.hidePopover(), this.state.open = !1, typeof this.onClose == "function" && this.onClose(this), document.documentElement.style.overflowY = "auto";
|
|
428
439
|
}
|
|
429
440
|
}
|
|
430
|
-
const
|
|
441
|
+
const E = {
|
|
431
442
|
info: {
|
|
432
443
|
bgColor: "bg-muted/10",
|
|
433
444
|
borderColor: "border-blue-500",
|
|
@@ -453,25 +464,29 @@ const F = {
|
|
|
453
464
|
borderColor: "border",
|
|
454
465
|
iconColor: "text-muted-foreground"
|
|
455
466
|
}
|
|
456
|
-
},
|
|
457
|
-
|
|
458
|
-
]),
|
|
459
|
-
class: `
|
|
467
|
+
}, Oe = (e) => T({ class: "flex justify-center" }, [
|
|
468
|
+
ee({ class: "text-lg font-bold mb-0" }, e)
|
|
469
|
+
]), je = c(({ href: e, class: t }, s) => V({
|
|
470
|
+
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 ${t}`,
|
|
460
471
|
href: e,
|
|
472
|
+
animateIn: "pullRightIn",
|
|
473
|
+
animateOut: "pullRight",
|
|
461
474
|
role: "alert"
|
|
462
|
-
}, s)),
|
|
475
|
+
}, s)), ze = c(({ close: e, class: t }, s) => n({
|
|
463
476
|
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}`,
|
|
464
477
|
click: () => e(),
|
|
478
|
+
animateIn: "pullRightIn",
|
|
479
|
+
animateOut: "pullRight",
|
|
465
480
|
role: "alert"
|
|
466
481
|
}, s));
|
|
467
|
-
class
|
|
482
|
+
class Ee extends y {
|
|
468
483
|
/**
|
|
469
484
|
* This will declare the props for the compiler.
|
|
470
485
|
*
|
|
471
486
|
* @returns {void}
|
|
472
487
|
*/
|
|
473
488
|
declareProps() {
|
|
474
|
-
this.
|
|
489
|
+
this.secondaryAction = null, this.primaryAction = null, this.primary = !1, this.secondary = !1, this.title = null, this.description = null, this.icon = null, this.onClick = null;
|
|
475
490
|
}
|
|
476
491
|
/**
|
|
477
492
|
* This will be called when the component is created.
|
|
@@ -487,14 +502,14 @@ class Le extends ce {
|
|
|
487
502
|
* @returns {object}
|
|
488
503
|
*/
|
|
489
504
|
render() {
|
|
490
|
-
const { bgColor: t, borderColor: s, iconColor: o } = this.getTypeStyles(),
|
|
491
|
-
return
|
|
492
|
-
href:
|
|
505
|
+
const { bgColor: t, borderColor: s, iconColor: o } = this.getTypeStyles(), r = this.href || null, l = this.getChildren(o);
|
|
506
|
+
return r ? je({
|
|
507
|
+
href: r,
|
|
493
508
|
class: `${t} ${s}`
|
|
494
|
-
},
|
|
509
|
+
}, l) : ze({
|
|
495
510
|
close: this.close.bind(this),
|
|
496
511
|
class: `${t} ${s}`
|
|
497
|
-
},
|
|
512
|
+
}, l);
|
|
498
513
|
}
|
|
499
514
|
/**
|
|
500
515
|
* This will be called after the component is set up.
|
|
@@ -503,7 +518,7 @@ class Le extends ce {
|
|
|
503
518
|
*/
|
|
504
519
|
afterSetup() {
|
|
505
520
|
const t = this.duration;
|
|
506
|
-
t !== "infinite" && (this.timer = new
|
|
521
|
+
t !== "infinite" && (this.timer = new de(t, this.close.bind(this)), this.timer.start());
|
|
507
522
|
}
|
|
508
523
|
/**
|
|
509
524
|
* This will get the style properties based on the notification type.
|
|
@@ -512,7 +527,7 @@ class Le extends ce {
|
|
|
512
527
|
*/
|
|
513
528
|
getTypeStyles() {
|
|
514
529
|
const t = this.type || "default";
|
|
515
|
-
return
|
|
530
|
+
return E[t] || E.default;
|
|
516
531
|
}
|
|
517
532
|
/**
|
|
518
533
|
* This will get the buttons for the notification.
|
|
@@ -536,10 +551,10 @@ class Le extends ce {
|
|
|
536
551
|
getChildren(t) {
|
|
537
552
|
return [
|
|
538
553
|
n({ class: "flex items-start" }, [
|
|
539
|
-
this.icon &&
|
|
554
|
+
this.icon && x({ class: `mr-4 ${t}`, html: this.icon }),
|
|
540
555
|
n({ class: "flex flex-auto flex-col" }, [
|
|
541
556
|
n({ class: "flex flex-auto flex-row items-center w-full pr-12" }, [
|
|
542
|
-
this.title &&
|
|
557
|
+
this.title && Oe(this.title)
|
|
543
558
|
]),
|
|
544
559
|
b({ class: "text-base text-muted-foreground m-0 pr-12" }, this.description),
|
|
545
560
|
(this.primary || this.secondary) && M({ class: "margin-top-24 flex align-center" }, this.getButtons())
|
|
@@ -563,8 +578,8 @@ class Le extends ce {
|
|
|
563
578
|
t && t.stopPropagation(), this.duration !== "infinite" && this.timer.stop(), this.onClick && this.onClick(), this.destroy();
|
|
564
579
|
}
|
|
565
580
|
}
|
|
566
|
-
let
|
|
567
|
-
class
|
|
581
|
+
let Ne = 0;
|
|
582
|
+
class qt extends y {
|
|
568
583
|
/**
|
|
569
584
|
* This will render the component.
|
|
570
585
|
*
|
|
@@ -572,11 +587,11 @@ class vt extends p {
|
|
|
572
587
|
*/
|
|
573
588
|
render() {
|
|
574
589
|
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" }, [
|
|
575
|
-
new
|
|
590
|
+
new he({
|
|
576
591
|
cache: "list",
|
|
577
592
|
key: "id",
|
|
578
593
|
role: "list",
|
|
579
|
-
rowItem: (t) => new
|
|
594
|
+
rowItem: (t) => new Ee(t)
|
|
580
595
|
})
|
|
581
596
|
]);
|
|
582
597
|
}
|
|
@@ -587,7 +602,7 @@ class vt extends p {
|
|
|
587
602
|
* @returns {void}
|
|
588
603
|
*/
|
|
589
604
|
addNotice(t = {}) {
|
|
590
|
-
t.id =
|
|
605
|
+
t.id = Ne++, t.callBack = () => this.removeNotice(t), this.list.append([t]), this.panel.hidePopover(), this.panel.showPopover();
|
|
591
606
|
}
|
|
592
607
|
/**
|
|
593
608
|
* This will remove a notification.
|
|
@@ -596,29 +611,28 @@ class vt extends p {
|
|
|
596
611
|
* @returns {void}
|
|
597
612
|
*/
|
|
598
613
|
removeNotice(t) {
|
|
599
|
-
this.list.delete(t.id);
|
|
614
|
+
this.list.delete(t.id), this.list.isEmpty() && this.panel.hidePopover();
|
|
600
615
|
}
|
|
601
616
|
}
|
|
602
|
-
const N = globalThis.matchMedia,
|
|
617
|
+
const N = globalThis.matchMedia, $ = c(({ value: e, label: t, icon: s }) => m({
|
|
603
618
|
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',
|
|
604
619
|
onState: ["method", { active: e }],
|
|
605
620
|
dataSet: ["method", ["state", e, "active"]],
|
|
606
|
-
click: (o, { state:
|
|
607
|
-
|
|
621
|
+
click: (o, { state: r }) => {
|
|
622
|
+
r.method = e, localStorage.setItem("theme", e), e === "system" && localStorage.removeItem("theme"), Ue(e);
|
|
608
623
|
}
|
|
609
624
|
}, [
|
|
610
|
-
|
|
625
|
+
g(s),
|
|
611
626
|
a(t)
|
|
612
|
-
])),
|
|
613
|
-
var o;
|
|
627
|
+
])), Ue = (e) => {
|
|
614
628
|
const t = document.documentElement;
|
|
615
|
-
if (e === "system" && (e =
|
|
629
|
+
if (e === "system" && (e = globalThis.matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light"), N && !N("(prefers-color-scheme: " + e + ")").matches) {
|
|
616
630
|
t.classList.add(e);
|
|
617
631
|
return;
|
|
618
632
|
}
|
|
619
633
|
const s = e === "light" ? "dark" : "light";
|
|
620
634
|
t.classList.remove(s);
|
|
621
|
-
},
|
|
635
|
+
}, Yt = w(
|
|
622
636
|
{
|
|
623
637
|
/**
|
|
624
638
|
* This will render the component.
|
|
@@ -628,9 +642,9 @@ const N = globalThis.matchMedia, I = c(({ value: e, label: t, icon: s }) => m({
|
|
|
628
642
|
render() {
|
|
629
643
|
return n({ class: "flex flex-auto flex-col" }, [
|
|
630
644
|
n({ class: "grid grid-cols-3 gap-4" }, [
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
645
|
+
$({ label: "System", value: "system", icon: u.adjustments.horizontal }),
|
|
646
|
+
$({ label: "Light", value: "light", icon: u.sun }),
|
|
647
|
+
$({ label: "Dark", value: "dark", icon: u.moon })
|
|
634
648
|
])
|
|
635
649
|
]);
|
|
636
650
|
},
|
|
@@ -645,7 +659,7 @@ const N = globalThis.matchMedia, I = c(({ value: e, label: t, icon: s }) => m({
|
|
|
645
659
|
};
|
|
646
660
|
}
|
|
647
661
|
}
|
|
648
|
-
),
|
|
662
|
+
), Vt = C(
|
|
649
663
|
{
|
|
650
664
|
/**
|
|
651
665
|
* The initial state of the Toggle.
|
|
@@ -676,10 +690,10 @@ const N = globalThis.matchMedia, I = c(({ value: e, label: t, icon: s }) => m({
|
|
|
676
690
|
class: "relative inline-flex h-6 w-11 min-w-11 items-center rounded-full bg-muted transition-colors focus:outline-none",
|
|
677
691
|
onState: ["active", { "bg-primary": !0, "bg-muted": !1 }],
|
|
678
692
|
click: (t, { state: s }) => {
|
|
679
|
-
s.toggle("active"), this.checkbox.checked = s.active;
|
|
693
|
+
s.toggle("active"), this.checkbox.checked = s.active, this.change && this.change(s.active, t, this);
|
|
680
694
|
}
|
|
681
695
|
}, [
|
|
682
|
-
|
|
696
|
+
te({
|
|
683
697
|
cache: "checkbox",
|
|
684
698
|
class: "opacity-0 absolute top-0 left-0 bottom-0 right-0 w-full h-full",
|
|
685
699
|
/**
|
|
@@ -697,27 +711,172 @@ const N = globalThis.matchMedia, I = c(({ value: e, label: t, icon: s }) => m({
|
|
|
697
711
|
]);
|
|
698
712
|
}
|
|
699
713
|
}
|
|
700
|
-
),
|
|
714
|
+
), k = {
|
|
701
715
|
ONLINE: "online",
|
|
702
716
|
OFFLINE: "offline",
|
|
703
717
|
BUSY: "busy",
|
|
704
718
|
AWAY: "away"
|
|
705
|
-
},
|
|
719
|
+
}, v = {
|
|
706
720
|
ONLINE: "bg-green-500",
|
|
707
721
|
OFFLINE: "bg-gray-500",
|
|
708
722
|
BUSY: "bg-red-500",
|
|
709
723
|
AWAY: "bg-yellow-500"
|
|
710
|
-
},
|
|
711
|
-
class: `absolute bottom-0 right-0 w-3 h-3 border-2 rounded-full ${
|
|
712
|
-
}),
|
|
724
|
+
}, Re = (e = "") => (e = e.toUpperCase(), v[e] || v.OFFLINE), _t = (e) => n({
|
|
725
|
+
class: `absolute bottom-0 right-0 w-3 h-3 border-2 rounded-full ${Re(e)}`
|
|
726
|
+
}), Wt = ({ propName: e = "status" } = {}) => n({
|
|
713
727
|
class: "absolute bottom-0 right-0 w-3 h-3 border-2 rounded-full",
|
|
714
728
|
onSet: [e, {
|
|
715
|
-
[
|
|
716
|
-
[
|
|
717
|
-
[
|
|
718
|
-
[
|
|
729
|
+
[v.ONLINE]: k.ONLINE,
|
|
730
|
+
[v.OFFLINE]: k.OFFLINE,
|
|
731
|
+
[v.BUSY]: k.BUSY,
|
|
732
|
+
[v.AWAY]: k.AWAY
|
|
719
733
|
}]
|
|
720
|
-
}),
|
|
734
|
+
}), He = (e) => e.indexOf(".") === -1 && e.indexOf("[[") === -1 && e.indexOf("blob:") === -1, Gt = w(
|
|
735
|
+
{
|
|
736
|
+
/**
|
|
737
|
+
* Get the initial state for the component.
|
|
738
|
+
*
|
|
739
|
+
* @returns {object} Initial state for the component
|
|
740
|
+
*/
|
|
741
|
+
state() {
|
|
742
|
+
return {
|
|
743
|
+
// @ts-ignore
|
|
744
|
+
loaded: !!this.src
|
|
745
|
+
};
|
|
746
|
+
},
|
|
747
|
+
/**
|
|
748
|
+
* This will open the file browse dialog.
|
|
749
|
+
*
|
|
750
|
+
* @returns {void}
|
|
751
|
+
*/
|
|
752
|
+
openFileBrowse() {
|
|
753
|
+
const e = this.input;
|
|
754
|
+
e && (e.value = "", p.trigger("click", e));
|
|
755
|
+
},
|
|
756
|
+
/**
|
|
757
|
+
* Get the URL for the uploaded file.
|
|
758
|
+
*
|
|
759
|
+
* @param {File} file - The file to get the URL for.
|
|
760
|
+
* @returns {string} The object URL for the file.
|
|
761
|
+
*/
|
|
762
|
+
getFileUrl(e) {
|
|
763
|
+
return this.url && URL.revokeObjectURL(this.url), this.url = URL.createObjectURL(e);
|
|
764
|
+
},
|
|
765
|
+
/**
|
|
766
|
+
* Render the component.
|
|
767
|
+
*
|
|
768
|
+
* @returns {object} Rendered component
|
|
769
|
+
*/
|
|
770
|
+
render() {
|
|
771
|
+
const e = "image-upload", t = this.onChange || null;
|
|
772
|
+
return n({ class: "flex-none items-center" }, [
|
|
773
|
+
f({
|
|
774
|
+
id: e,
|
|
775
|
+
cache: "input",
|
|
776
|
+
type: "file",
|
|
777
|
+
accept: "image/*",
|
|
778
|
+
class: "hidden",
|
|
779
|
+
change: (s) => {
|
|
780
|
+
const o = s.target.files?.[0];
|
|
781
|
+
o && t && (this.state.loaded = !1, t(o, this.parent), this.src = this.getFileUrl(o), this.state.loaded = !0);
|
|
782
|
+
}
|
|
783
|
+
}),
|
|
784
|
+
n({
|
|
785
|
+
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",
|
|
786
|
+
click: (s) => {
|
|
787
|
+
s.preventDefault(), s.stopPropagation(), this.openFileBrowse();
|
|
788
|
+
}
|
|
789
|
+
}, [
|
|
790
|
+
D("loaded", (s) => s === !1 || He(this.src) ? A({
|
|
791
|
+
htmlFor: e,
|
|
792
|
+
class: "z-10 flex flex-col items-center justify-center text-sm text-muted-foreground group-hover:text-primary"
|
|
793
|
+
}, [
|
|
794
|
+
g(u.upload),
|
|
795
|
+
n("Upload Image")
|
|
796
|
+
]) : _({
|
|
797
|
+
// @ts-ignore
|
|
798
|
+
src: this.src,
|
|
799
|
+
class: "absolute inset-0 w-full h-full object-cover rounded-full"
|
|
800
|
+
}))
|
|
801
|
+
])
|
|
802
|
+
]);
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
), Jt = w(
|
|
806
|
+
{
|
|
807
|
+
/**
|
|
808
|
+
* Get the initial state for the component.
|
|
809
|
+
*
|
|
810
|
+
* @returns {object} Initial state for the component
|
|
811
|
+
*/
|
|
812
|
+
state() {
|
|
813
|
+
return {
|
|
814
|
+
// @ts-ignore
|
|
815
|
+
loaded: !!this.src
|
|
816
|
+
};
|
|
817
|
+
},
|
|
818
|
+
/**
|
|
819
|
+
* This will open the file browse dialog.
|
|
820
|
+
*
|
|
821
|
+
* @returns {void}
|
|
822
|
+
*/
|
|
823
|
+
openFileBrowse() {
|
|
824
|
+
const e = this.input;
|
|
825
|
+
e && (e.value = "", p.trigger("click", e));
|
|
826
|
+
},
|
|
827
|
+
/**
|
|
828
|
+
* Get the URL for the uploaded file.
|
|
829
|
+
*
|
|
830
|
+
* @param {File} file - The file to get the URL for.
|
|
831
|
+
* @returns {string} The object URL for the file.
|
|
832
|
+
*/
|
|
833
|
+
getFileUrl(e) {
|
|
834
|
+
return this.url && URL.revokeObjectURL(this.url), this.url = URL.createObjectURL(e);
|
|
835
|
+
},
|
|
836
|
+
/**
|
|
837
|
+
* Render the component.
|
|
838
|
+
*
|
|
839
|
+
* @returns {object} Rendered component
|
|
840
|
+
*/
|
|
841
|
+
render() {
|
|
842
|
+
const e = "logo-upload", t = this.onChange || null;
|
|
843
|
+
return n({ class: "flex-none items-center" }, [
|
|
844
|
+
f({
|
|
845
|
+
id: e,
|
|
846
|
+
cache: "input",
|
|
847
|
+
type: "file",
|
|
848
|
+
accept: "image/*",
|
|
849
|
+
class: "hidden",
|
|
850
|
+
change: (s) => {
|
|
851
|
+
const o = s.target.files?.[0];
|
|
852
|
+
o && t && (this.state.loaded = !1, t(o, this.parent), this.src = this.getFileUrl(o), this.state.loaded = !0);
|
|
853
|
+
}
|
|
854
|
+
}),
|
|
855
|
+
n({
|
|
856
|
+
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",
|
|
857
|
+
click: (s) => {
|
|
858
|
+
s.preventDefault(), s.stopPropagation(), this.openFileBrowse();
|
|
859
|
+
}
|
|
860
|
+
}, [
|
|
861
|
+
D(
|
|
862
|
+
"loaded",
|
|
863
|
+
(s) => s ? _({
|
|
864
|
+
// @ts-ignore
|
|
865
|
+
src: this.src,
|
|
866
|
+
class: "absolute inset-0 w-full h-full object-cover rounded-full"
|
|
867
|
+
}) : A({
|
|
868
|
+
htmlFor: e,
|
|
869
|
+
class: "z-10 flex flex-col items-center justify-center text-sm text-muted-foreground group-hover:text-primary"
|
|
870
|
+
}, [
|
|
871
|
+
g(u.upload),
|
|
872
|
+
n("Upload logo")
|
|
873
|
+
])
|
|
874
|
+
)
|
|
875
|
+
])
|
|
876
|
+
]);
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
), qe = (e, t) => V(
|
|
721
880
|
{
|
|
722
881
|
href: e,
|
|
723
882
|
"aria-current": t === "Breadcrumb" && "page",
|
|
@@ -725,14 +884,14 @@ const N = globalThis.matchMedia, I = c(({ value: e, label: t, icon: s }) => m({
|
|
|
725
884
|
class: "text-muted-foreground font-medium hover:text-foreground"
|
|
726
885
|
},
|
|
727
886
|
[a(t)]
|
|
728
|
-
),
|
|
887
|
+
), Ye = () => g({
|
|
729
888
|
class: "mx-3 text-muted-foreground",
|
|
730
889
|
"aria-hidden": !0,
|
|
731
890
|
size: "xs"
|
|
732
|
-
}, u.chevron.single.right),
|
|
733
|
-
e.href ?
|
|
734
|
-
e.separator &&
|
|
735
|
-
]),
|
|
891
|
+
}, u.chevron.single.right), Ve = (e) => n({ class: "flex items-center" }, [
|
|
892
|
+
e.href ? qe(e.href, e.label) : a(e.label),
|
|
893
|
+
e.separator && Ye()
|
|
894
|
+
]), Kt = w(
|
|
736
895
|
{
|
|
737
896
|
/**
|
|
738
897
|
* Set initial data
|
|
@@ -740,7 +899,7 @@ const N = globalThis.matchMedia, I = c(({ value: e, label: t, icon: s }) => m({
|
|
|
740
899
|
* @returns {Data}
|
|
741
900
|
*/
|
|
742
901
|
setData() {
|
|
743
|
-
return new
|
|
902
|
+
return new F({
|
|
744
903
|
// @ts-ignore
|
|
745
904
|
items: this.items || []
|
|
746
905
|
});
|
|
@@ -752,16 +911,16 @@ const N = globalThis.matchMedia, I = c(({ value: e, label: t, icon: s }) => m({
|
|
|
752
911
|
*/
|
|
753
912
|
render() {
|
|
754
913
|
const e = this.data.items.length - 1;
|
|
755
|
-
return
|
|
914
|
+
return se(
|
|
756
915
|
{
|
|
757
916
|
"aria-label": "Breadcrumb",
|
|
758
|
-
class: "flex items-center
|
|
917
|
+
class: "flex items-center gap-x-1 text-sm"
|
|
759
918
|
},
|
|
760
919
|
[
|
|
761
920
|
n({
|
|
762
921
|
role: "list",
|
|
763
922
|
class: "flex items-center",
|
|
764
|
-
for: ["items", (t, s) =>
|
|
923
|
+
for: ["items", (t, s) => Ve({
|
|
765
924
|
href: t.href,
|
|
766
925
|
label: t.label,
|
|
767
926
|
separator: s < e
|
|
@@ -771,7 +930,7 @@ const N = globalThis.matchMedia, I = c(({ value: e, label: t, icon: s }) => m({
|
|
|
771
930
|
);
|
|
772
931
|
}
|
|
773
932
|
}
|
|
774
|
-
),
|
|
933
|
+
), U = {
|
|
775
934
|
xs: "h-1 w-1",
|
|
776
935
|
sm: "h-2 w-2",
|
|
777
936
|
md: "h-4 w-4",
|
|
@@ -780,21 +939,21 @@ const N = globalThis.matchMedia, I = c(({ value: e, label: t, icon: s }) => m({
|
|
|
780
939
|
"2xl": "h-16 w-16",
|
|
781
940
|
"3xl": "h-24 w-24",
|
|
782
941
|
default: "h-4 w-4"
|
|
783
|
-
},
|
|
942
|
+
}, _e = (e) => U[e] || U.default, We = ({ index: e, size: t }) => n({ class: `${t} rounded-full bg-muted cursor-pointer` }, [
|
|
784
943
|
a({
|
|
785
944
|
class: "block w-full h-full rounded-full transition-colors",
|
|
786
945
|
onSet: ["activeIndex", {
|
|
787
946
|
"bg-primary": e,
|
|
788
947
|
"shadow-md": e
|
|
789
948
|
}],
|
|
790
|
-
click: (s, { data: o, onClick:
|
|
791
|
-
o.activeIndex = e,
|
|
949
|
+
click: (s, { data: o, onClick: r }) => {
|
|
950
|
+
o.activeIndex = e, r && r(e);
|
|
792
951
|
}
|
|
793
952
|
})
|
|
794
|
-
]),
|
|
953
|
+
]), Ge = (e, t) => Array.from({ length: e }, (s, o) => We({
|
|
795
954
|
index: o,
|
|
796
955
|
size: t
|
|
797
|
-
})),
|
|
956
|
+
})), Qt = w(
|
|
798
957
|
{
|
|
799
958
|
/**
|
|
800
959
|
* Defines component data (props).
|
|
@@ -802,7 +961,7 @@ const N = globalThis.matchMedia, I = c(({ value: e, label: t, icon: s }) => m({
|
|
|
802
961
|
* @returns {Data}
|
|
803
962
|
*/
|
|
804
963
|
setData() {
|
|
805
|
-
return new
|
|
964
|
+
return new F({
|
|
806
965
|
// @ts-ignore
|
|
807
966
|
count: this.count || 4,
|
|
808
967
|
// total dots
|
|
@@ -816,7 +975,7 @@ const N = globalThis.matchMedia, I = c(({ value: e, label: t, icon: s }) => m({
|
|
|
816
975
|
* @returns {object}
|
|
817
976
|
*/
|
|
818
977
|
render() {
|
|
819
|
-
const e = this.gap || "gap-2", t =
|
|
978
|
+
const e = this.gap || "gap-2", t = _e(this.size || "sm"), s = Ge(this.data.count, t);
|
|
820
979
|
return n(
|
|
821
980
|
{ class: "flex justify-center items-center py-2" },
|
|
822
981
|
[
|
|
@@ -825,37 +984,37 @@ const N = globalThis.matchMedia, I = c(({ value: e, label: t, icon: s }) => m({
|
|
|
825
984
|
);
|
|
826
985
|
}
|
|
827
986
|
}
|
|
828
|
-
),
|
|
987
|
+
), Je = ({ toggleDropdown: e }) => m(
|
|
829
988
|
{
|
|
830
989
|
cache: "button",
|
|
831
|
-
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
|
|
990
|
+
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",
|
|
832
991
|
click: e
|
|
833
992
|
},
|
|
834
993
|
[
|
|
835
994
|
a({ onState: ["selectedLabel", (t) => t || "Select item..."] }),
|
|
836
|
-
|
|
995
|
+
x({ html: u.chevron.upDown })
|
|
837
996
|
]
|
|
838
|
-
),
|
|
997
|
+
), Ke = (e, t, s) => q({
|
|
839
998
|
class: "flex flex-auto items-center cursor-pointer p-2 hover:bg-muted/50 rounded-sm",
|
|
840
999
|
click: () => t(e),
|
|
841
1000
|
onState: [s, "selectedValue", { "bg-secondary": e.value }]
|
|
842
1001
|
}, [
|
|
843
|
-
e.icon && a({ class: "mr-2 flex items-baseline" }, [
|
|
1002
|
+
e.icon && a({ class: "mr-2 flex items-baseline" }, [g({ size: "xs" }, e.icon)]),
|
|
844
1003
|
a({ class: "text-base font-normal" }, e.label)
|
|
845
|
-
]),
|
|
846
|
-
|
|
847
|
-
]),
|
|
848
|
-
|
|
1004
|
+
]), Qe = (e, t) => n({ class: "w-full border rounded-md" }, [
|
|
1005
|
+
Y({ class: "max-h-60 overflow-y-auto p-2 grid gap-1", for: ["items", (s) => Ke(s, e, t)] })
|
|
1006
|
+
]), Xe = ({ onSelect: e, state: t }) => n({ class: "flex flex-auto flex-col" }, [
|
|
1007
|
+
D(
|
|
849
1008
|
"open",
|
|
850
|
-
(s, o,
|
|
1009
|
+
(s, o, r) => s ? new I({
|
|
851
1010
|
cache: "dropdown",
|
|
852
|
-
parent:
|
|
853
|
-
button:
|
|
1011
|
+
parent: r,
|
|
1012
|
+
button: r.button
|
|
854
1013
|
}, [
|
|
855
|
-
|
|
1014
|
+
Qe(e, t)
|
|
856
1015
|
]) : null
|
|
857
1016
|
)
|
|
858
|
-
]),
|
|
1017
|
+
]), Xt = w(
|
|
859
1018
|
{
|
|
860
1019
|
/**
|
|
861
1020
|
* This will set up the data.
|
|
@@ -863,7 +1022,7 @@ const N = globalThis.matchMedia, I = c(({ value: e, label: t, icon: s }) => m({
|
|
|
863
1022
|
* @returns {Data}
|
|
864
1023
|
*/
|
|
865
1024
|
setData() {
|
|
866
|
-
return new
|
|
1025
|
+
return new F({
|
|
867
1026
|
// @ts-ignore
|
|
868
1027
|
items: this.items || []
|
|
869
1028
|
});
|
|
@@ -936,8 +1095,8 @@ const N = globalThis.matchMedia, I = c(({ value: e, label: t, icon: s }) => m({
|
|
|
936
1095
|
const e = this.class || "", t = this.maxWidth || "max-w-[250px]", s = this.width || "w-full";
|
|
937
1096
|
return n({ class: `relative ${s} flex flex-auto flex-col ${t} ${e}` }, [
|
|
938
1097
|
// @ts-ignore
|
|
939
|
-
|
|
940
|
-
|
|
1098
|
+
Je({ toggleDropdown: this.toggleDropdown.bind(this) }),
|
|
1099
|
+
Xe({
|
|
941
1100
|
// @ts-ignore
|
|
942
1101
|
state: this.state,
|
|
943
1102
|
// @ts-ignore
|
|
@@ -945,7 +1104,7 @@ const N = globalThis.matchMedia, I = c(({ value: e, label: t, icon: s }) => m({
|
|
|
945
1104
|
}),
|
|
946
1105
|
// Hidden required input for form validation
|
|
947
1106
|
// @ts-ignore
|
|
948
|
-
this.required &&
|
|
1107
|
+
this.required && f({
|
|
949
1108
|
class: "opacity-0 absolute top-0 left-0 z-[1]",
|
|
950
1109
|
type: "text",
|
|
951
1110
|
// @ts-ignore
|
|
@@ -957,34 +1116,34 @@ const N = globalThis.matchMedia, I = c(({ value: e, label: t, icon: s }) => m({
|
|
|
957
1116
|
]);
|
|
958
1117
|
}
|
|
959
1118
|
}
|
|
960
|
-
),
|
|
1119
|
+
), Q = ({ icon: e, click: t, ariaLabel: s }) => h({
|
|
961
1120
|
variant: "icon",
|
|
962
1121
|
class: "flex flex-none",
|
|
963
1122
|
click: t,
|
|
964
1123
|
icon: e,
|
|
965
1124
|
"aria-label": s
|
|
966
|
-
}),
|
|
1125
|
+
}), Ze = ({ click: e }) => Q({
|
|
967
1126
|
icon: u.circleMinus,
|
|
968
1127
|
click: e,
|
|
969
1128
|
ariaLabel: "Decrement"
|
|
970
|
-
}),
|
|
1129
|
+
}), et = ({ click: e }) => Q({
|
|
971
1130
|
icon: u.circlePlus,
|
|
972
1131
|
click: e,
|
|
973
1132
|
ariaLabel: "Increment"
|
|
974
|
-
}),
|
|
975
|
-
value: ["[[count]]",
|
|
1133
|
+
}), tt = ({ bind: e, min: t, max: s, readonly: o = !1 }) => W(({ state: r }) => f({
|
|
1134
|
+
value: ["[[count]]", r],
|
|
976
1135
|
bind: e,
|
|
977
|
-
blur: (
|
|
978
|
-
let d = parseInt(
|
|
1136
|
+
blur: (l, { state: i }) => {
|
|
1137
|
+
let d = parseInt(l.target.value, 10);
|
|
979
1138
|
isNaN(d) && (d = t ?? 0), t !== void 0 && (d = Math.max(d, t)), s !== void 0 && (d = Math.min(d, s)), i.count = d;
|
|
980
1139
|
},
|
|
981
|
-
class: "flex flex-auto text-lg font-medium bg-
|
|
1140
|
+
class: "flex flex-auto text-lg font-medium bg-input text-center border min-w-0",
|
|
982
1141
|
readonly: o,
|
|
983
1142
|
min: t,
|
|
984
1143
|
max: s,
|
|
985
1144
|
type: "number",
|
|
986
1145
|
"aria-label": "Counter"
|
|
987
|
-
})),
|
|
1146
|
+
})), Zt = C(
|
|
988
1147
|
{
|
|
989
1148
|
/**
|
|
990
1149
|
* Initial state for the counter component.
|
|
@@ -1006,47 +1165,69 @@ const N = globalThis.matchMedia, I = c(({ value: e, label: t, icon: s }) => m({
|
|
|
1006
1165
|
*/
|
|
1007
1166
|
render() {
|
|
1008
1167
|
const e = this.class ?? "";
|
|
1009
|
-
return n({ class: `flex flex-auto items-center justify-between
|
|
1010
|
-
|
|
1011
|
-
|
|
1168
|
+
return n({ class: `flex flex-auto items-center justify-between gap-x-4 p-4 ${e}` }, [
|
|
1169
|
+
Ze({ click: () => this.state.decrement("count") }),
|
|
1170
|
+
tt({
|
|
1012
1171
|
bind: this.bind,
|
|
1013
1172
|
readonly: this.readonly,
|
|
1014
1173
|
min: this.min,
|
|
1015
1174
|
max: this.max
|
|
1016
1175
|
}),
|
|
1017
|
-
|
|
1176
|
+
et({ click: () => this.state.increment("count") })
|
|
1018
1177
|
]);
|
|
1019
1178
|
}
|
|
1020
1179
|
}
|
|
1021
|
-
),
|
|
1180
|
+
), st = (e) => {
|
|
1181
|
+
let t = "";
|
|
1182
|
+
return e.length > 0 && (t = e.substring(0, 2), e.length > 2 && (t += "/" + e.substring(2, 4), e.length > 4 && (t += "/" + e.substring(4, 8)))), t;
|
|
1183
|
+
}, ot = (e) => {
|
|
1184
|
+
if (e.length !== 8)
|
|
1185
|
+
return null;
|
|
1186
|
+
const t = parseInt(e.substring(0, 2), 10), s = parseInt(e.substring(2, 4), 10), o = parseInt(e.substring(4, 8), 10);
|
|
1187
|
+
return t >= 1 && t <= 12 && s >= 1 && s <= 31 && o >= 1900 ? `${o}-${t.toString().padStart(2, "0")}-${s.toString().padStart(2, "0")}` : null;
|
|
1188
|
+
}, nt = ({ bind: e, required: t }) => f({
|
|
1022
1189
|
cache: "input",
|
|
1023
1190
|
class: "opacity-0 absolute top-0 left-0 w-full h-full pointer-events-none",
|
|
1024
1191
|
bind: e,
|
|
1025
1192
|
required: t
|
|
1026
|
-
}),
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1193
|
+
}), rt = ({ placeholder: e, handleInputChange: t, handleInputFocus: s }) => f({
|
|
1194
|
+
cache: "dateInput",
|
|
1195
|
+
class: "flex-1 bg-transparent outline-none placeholder:text-muted-foreground border-0",
|
|
1196
|
+
placeholder: e || "mm/dd/yyyy",
|
|
1197
|
+
input: t,
|
|
1198
|
+
focus: s,
|
|
1199
|
+
onState: ["selectedDate", (o) => o ? L.format("standard", o) : ""]
|
|
1200
|
+
}), lt = ({ bind: e, required: t, toggleOpen: s, handleInputChange: o, handleInputFocus: r, placeholder: l }) => n(
|
|
1201
|
+
{
|
|
1202
|
+
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"
|
|
1203
|
+
},
|
|
1204
|
+
[
|
|
1205
|
+
nt({ bind: e, required: t }),
|
|
1206
|
+
rt({ placeholder: l, handleInputChange: o, handleInputFocus: r }),
|
|
1207
|
+
m(
|
|
1208
|
+
{
|
|
1209
|
+
class: "flex-shrink-0 hover:bg-muted/50 rounded p-1 cursor-pointer",
|
|
1210
|
+
click: s
|
|
1211
|
+
},
|
|
1212
|
+
[
|
|
1213
|
+
x({ html: u.calendar.days })
|
|
1214
|
+
]
|
|
1215
|
+
)
|
|
1216
|
+
]
|
|
1217
|
+
), it = ({ handleDateSelect: e, blockPriorDates: t }) => P(
|
|
1218
|
+
(s, o, r) => new I({
|
|
1038
1219
|
cache: "dropdown",
|
|
1039
|
-
parent:
|
|
1040
|
-
button:
|
|
1220
|
+
parent: r,
|
|
1221
|
+
button: r.panel,
|
|
1041
1222
|
size: "fit"
|
|
1042
1223
|
}, [
|
|
1043
|
-
new
|
|
1044
|
-
selectedDate:
|
|
1224
|
+
new ie({
|
|
1225
|
+
selectedDate: r.state.selectedDate,
|
|
1045
1226
|
selectedCallBack: e,
|
|
1046
1227
|
blockPriorDates: t
|
|
1047
1228
|
})
|
|
1048
|
-
])
|
|
1049
|
-
),
|
|
1229
|
+
])
|
|
1230
|
+
), es = C(
|
|
1050
1231
|
{
|
|
1051
1232
|
/**
|
|
1052
1233
|
* The initial state of the DatePicker.
|
|
@@ -1068,141 +1249,283 @@ const N = globalThis.matchMedia, I = c(({ value: e, label: t, icon: s }) => m({
|
|
|
1068
1249
|
after() {
|
|
1069
1250
|
this.input.value && (this.state.selectedDate = this.input.value);
|
|
1070
1251
|
},
|
|
1252
|
+
/**
|
|
1253
|
+
* Handles direct input changes and formats the date.
|
|
1254
|
+
*
|
|
1255
|
+
* @param {Event} e
|
|
1256
|
+
*/
|
|
1257
|
+
handleInputChange(e) {
|
|
1258
|
+
const s = e.target.value.replace(/\D/g, "");
|
|
1259
|
+
e.target.value = st(s);
|
|
1260
|
+
const o = ot(s);
|
|
1261
|
+
o && (this.state.selectedDate = o, this.input.value = o, p.trigger("change", this.input), typeof this.onChange == "function" && this.onChange(o));
|
|
1262
|
+
},
|
|
1263
|
+
/**
|
|
1264
|
+
* Handles input focus - select all text for easy editing.
|
|
1265
|
+
*
|
|
1266
|
+
* @param {Event} e
|
|
1267
|
+
*/
|
|
1268
|
+
handleInputFocus(e) {
|
|
1269
|
+
e.target.select();
|
|
1270
|
+
},
|
|
1271
|
+
/**
|
|
1272
|
+
* Handles date selection from calendar.
|
|
1273
|
+
*
|
|
1274
|
+
* @param {string} date
|
|
1275
|
+
*/
|
|
1276
|
+
handleDateSelect(e) {
|
|
1277
|
+
this.state.selectedDate = e, this.state.open = !1, this.input.value = e, p.trigger("change", this.input), typeof this.onChange == "function" && this.onChange(e);
|
|
1278
|
+
},
|
|
1279
|
+
/**
|
|
1280
|
+
* Toggles the calendar popover.
|
|
1281
|
+
*
|
|
1282
|
+
* @param {Event} e
|
|
1283
|
+
* @param {object} context
|
|
1284
|
+
*/
|
|
1285
|
+
toggleOpen(e, { state: t }) {
|
|
1286
|
+
t.toggle("open");
|
|
1287
|
+
},
|
|
1071
1288
|
/**
|
|
1072
1289
|
* Renders the DatePicker component.
|
|
1073
1290
|
*
|
|
1074
1291
|
* @returns {object}
|
|
1075
1292
|
*/
|
|
1076
1293
|
render() {
|
|
1077
|
-
|
|
1078
|
-
|
|
1294
|
+
return n(
|
|
1295
|
+
{ class: "relative w-full max-w-[320px]" },
|
|
1296
|
+
[
|
|
1297
|
+
lt({
|
|
1298
|
+
toggleOpen: this.toggleOpen.bind(this),
|
|
1299
|
+
bind: this.bind,
|
|
1300
|
+
required: this.required,
|
|
1301
|
+
handleInputChange: this.handleInputChange.bind(this),
|
|
1302
|
+
handleInputFocus: this.handleInputFocus.bind(this),
|
|
1303
|
+
placeholder: this.placeholder
|
|
1304
|
+
}),
|
|
1305
|
+
it({
|
|
1306
|
+
handleDateSelect: this.handleDateSelect.bind(this),
|
|
1307
|
+
blockPriorDates: this.blockPriorDates || !1
|
|
1308
|
+
})
|
|
1309
|
+
]
|
|
1310
|
+
);
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
), at = ({ bind: e, required: t }) => f({
|
|
1314
|
+
cache: "input",
|
|
1315
|
+
class: "opacity-0 absolute top-0 left-0 w-full h-full pointer-events-none",
|
|
1316
|
+
bind: e,
|
|
1317
|
+
required: t
|
|
1318
|
+
}), ct = ({ bind: e, required: t, toggleOpen: s }) => m({
|
|
1319
|
+
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",
|
|
1320
|
+
click: s
|
|
1321
|
+
}, [
|
|
1322
|
+
at({ bind: e, required: t }),
|
|
1323
|
+
W(({ state: o }) => [
|
|
1324
|
+
a(j.date(["[[start]]", o], "Start Date")),
|
|
1325
|
+
a(" - "),
|
|
1326
|
+
a(j.date(["[[end]]", o], "End Date"))
|
|
1327
|
+
]),
|
|
1328
|
+
x({ html: u.calendar.days })
|
|
1329
|
+
]), ut = ({ handleDateSelect: e, blockPriorDates: t }) => P((s, o, r) => new I({
|
|
1330
|
+
cache: "dropdown",
|
|
1331
|
+
parent: r,
|
|
1332
|
+
button: r.panel,
|
|
1333
|
+
size: "xl"
|
|
1334
|
+
}, [
|
|
1335
|
+
new ae({
|
|
1336
|
+
startDate: r.state.start,
|
|
1337
|
+
endDate: r.state.end,
|
|
1338
|
+
onRangeSelect: e,
|
|
1339
|
+
blockPriorDates: t
|
|
1340
|
+
})
|
|
1341
|
+
])), ts = C(
|
|
1342
|
+
{
|
|
1343
|
+
/**
|
|
1344
|
+
* The initial state of the DateRangePicker.
|
|
1345
|
+
*
|
|
1346
|
+
* @member {object} state
|
|
1347
|
+
*/
|
|
1348
|
+
state() {
|
|
1349
|
+
return {
|
|
1350
|
+
start: this.start ?? null,
|
|
1351
|
+
end: this.end ?? null,
|
|
1352
|
+
open: !1
|
|
1353
|
+
};
|
|
1354
|
+
},
|
|
1355
|
+
/**
|
|
1356
|
+
* This is added to check the input after the component is rendered.
|
|
1357
|
+
* to see if the bind updated the input value.
|
|
1358
|
+
*
|
|
1359
|
+
* @returns {void}
|
|
1360
|
+
*/
|
|
1361
|
+
after() {
|
|
1362
|
+
if (this.input.value) {
|
|
1363
|
+
const e = this.input.value.split("-");
|
|
1364
|
+
this.state.start = e[0], this.state.end = e[1];
|
|
1365
|
+
}
|
|
1366
|
+
},
|
|
1367
|
+
/**
|
|
1368
|
+
* Renders the DatePicker component.
|
|
1369
|
+
*
|
|
1370
|
+
* @returns {object}
|
|
1371
|
+
*/
|
|
1372
|
+
render() {
|
|
1373
|
+
const e = (s, { state: o }) => o.toggle("open"), t = (s, o) => {
|
|
1374
|
+
this.state.start = s, this.state.end = o, this.state.open = !1, this.input.value = `${s}-${o}`, p.trigger("change", this.input), typeof this.onChange == "function" && this.onChange({ start: s, end: o }, this.parent);
|
|
1079
1375
|
};
|
|
1080
1376
|
return n({ class: "relative w-full max-w-[320px]" }, [
|
|
1081
|
-
|
|
1377
|
+
ct({
|
|
1082
1378
|
toggleOpen: e,
|
|
1083
1379
|
bind: this.bind,
|
|
1084
1380
|
required: this.required
|
|
1085
1381
|
}),
|
|
1086
|
-
|
|
1382
|
+
ut({
|
|
1087
1383
|
handleDateSelect: t,
|
|
1088
1384
|
blockPriorDates: this.blockPriorDates || !1
|
|
1089
1385
|
})
|
|
1090
1386
|
]);
|
|
1091
1387
|
}
|
|
1092
1388
|
}
|
|
1093
|
-
),
|
|
1094
|
-
new
|
|
1389
|
+
), ss = ({ dateTime: e = "", remoteTimeZone: t = "America/Denver", filter: s = null }) => oe([
|
|
1390
|
+
new fe({
|
|
1095
1391
|
dateTime: e,
|
|
1096
1392
|
filter: s || ((o) => {
|
|
1097
|
-
const
|
|
1098
|
-
return
|
|
1393
|
+
const r = L.getLocalTime(o, !0, !1, t);
|
|
1394
|
+
return L.getTimeFrame(r);
|
|
1099
1395
|
})
|
|
1100
1396
|
})
|
|
1101
1397
|
]);
|
|
1102
|
-
function
|
|
1103
|
-
|
|
1398
|
+
function dt(e) {
|
|
1399
|
+
let t = "";
|
|
1400
|
+
return e.length > 0 && (t = e.substring(0, 2), e.length > 2 && (t += ":" + e.substring(2, 4))), t;
|
|
1401
|
+
}
|
|
1402
|
+
function ht(e) {
|
|
1403
|
+
if (e.length < 4)
|
|
1404
|
+
return { formattedTime: null, hour: null, minute: null, meridian: null };
|
|
1405
|
+
const t = parseInt(e.substring(0, 2), 10), s = parseInt(e.substring(2, 4), 10);
|
|
1406
|
+
if (t < 0 || t > 23 || s < 0 || s > 59)
|
|
1407
|
+
return { formattedTime: null, hour: null, minute: null, meridian: null };
|
|
1408
|
+
let o = t, r = "AM";
|
|
1409
|
+
return t === 0 ? o = 12 : t > 12 ? (o = t - 12, r = "PM") : t === 12 && (r = "PM"), {
|
|
1410
|
+
formattedTime: `${o.toString().padStart(2, "0")}:${s.toString().padStart(2, "0")} ${r}`,
|
|
1411
|
+
hour: o.toString().padStart(2, "0"),
|
|
1412
|
+
minute: s.toString().padStart(2, "0"),
|
|
1413
|
+
meridian: r
|
|
1414
|
+
};
|
|
1415
|
+
}
|
|
1416
|
+
function ft({ bind: e, required: t }) {
|
|
1417
|
+
return f({
|
|
1104
1418
|
cache: "input",
|
|
1105
1419
|
class: "opacity-0 absolute top-0 left-0 w-full h-full pointer-events-none",
|
|
1106
1420
|
bind: e,
|
|
1107
1421
|
required: t
|
|
1108
1422
|
});
|
|
1109
1423
|
}
|
|
1110
|
-
function
|
|
1111
|
-
return
|
|
1424
|
+
function mt({ placeholder: e, handleInputChange: t, handleInputFocus: s }) {
|
|
1425
|
+
return f({
|
|
1426
|
+
cache: "timeInput",
|
|
1427
|
+
class: "flex-1 bg-transparent outline-none placeholder:text-muted-foreground border-0",
|
|
1428
|
+
placeholder: e || "hh:mm AM/PM",
|
|
1429
|
+
input: t,
|
|
1430
|
+
focus: s,
|
|
1431
|
+
onState: ["selectedTime", (o) => o || ""]
|
|
1432
|
+
});
|
|
1433
|
+
}
|
|
1434
|
+
function gt({ bind: e, required: t, toggleOpen: s, handleInputChange: o, handleInputFocus: r, placeholder: l }) {
|
|
1435
|
+
return n(
|
|
1112
1436
|
{
|
|
1113
|
-
class: "relative flex items-center gap-2 w-full justify-between border
|
|
1114
|
-
click: s
|
|
1437
|
+
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"
|
|
1115
1438
|
},
|
|
1116
1439
|
[
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1440
|
+
ft({ bind: e, required: t }),
|
|
1441
|
+
mt({ placeholder: l, handleInputChange: o, handleInputFocus: r }),
|
|
1442
|
+
m(
|
|
1443
|
+
{
|
|
1444
|
+
class: "flex-shrink-0 hover:bg-muted/50 rounded p-1 cursor-pointer",
|
|
1445
|
+
click: s
|
|
1446
|
+
},
|
|
1447
|
+
[
|
|
1448
|
+
x({ html: u.clock })
|
|
1449
|
+
]
|
|
1450
|
+
)
|
|
1122
1451
|
]
|
|
1123
1452
|
);
|
|
1124
1453
|
}
|
|
1125
|
-
function
|
|
1454
|
+
function B({ items: e, handleTimeSelect: t, state: s, stateValue: o, pad: r = !1 }) {
|
|
1126
1455
|
return n(
|
|
1127
1456
|
{ class: "flex flex-col max-h-[200px] overflow-y-auto" },
|
|
1128
|
-
e.map((
|
|
1129
|
-
let i =
|
|
1457
|
+
e.map((l) => {
|
|
1458
|
+
let i = r ? l.toString().padStart(2, "0") : l.toString();
|
|
1130
1459
|
return m({
|
|
1131
1460
|
text: i,
|
|
1132
|
-
class: "hover:bg-muted/50 rounded-md
|
|
1461
|
+
class: "hover:bg-muted/50 rounded-md pr-2 py-1",
|
|
1133
1462
|
click: () => t({ [o]: i }),
|
|
1134
1463
|
onState: [s, o, { "bg-muted": i }]
|
|
1135
1464
|
});
|
|
1136
1465
|
})
|
|
1137
1466
|
);
|
|
1138
1467
|
}
|
|
1139
|
-
function
|
|
1140
|
-
return
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
},
|
|
1468
|
+
function pt({ handleTimeSelect: e }) {
|
|
1469
|
+
return P(
|
|
1470
|
+
(t, s, o) => new I(
|
|
1471
|
+
{
|
|
1472
|
+
cache: "dropdown",
|
|
1473
|
+
parent: o,
|
|
1474
|
+
button: o.panel,
|
|
1475
|
+
size: "fit"
|
|
1476
|
+
},
|
|
1477
|
+
[
|
|
1478
|
+
n(
|
|
1479
|
+
{ class: "flex flex-auto flex-col border rounded-md shadow-md" },
|
|
1152
1480
|
[
|
|
1153
1481
|
n(
|
|
1154
|
-
{ class: "
|
|
1482
|
+
{ class: "grid grid-cols-3 gap-2 p-4 text-center max-h-[220px] min-w-[240px]" },
|
|
1155
1483
|
[
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
state: o.state,
|
|
1180
|
-
stateValue: "meridian"
|
|
1181
|
-
})
|
|
1182
|
-
]
|
|
1183
|
-
)
|
|
1484
|
+
// Hours column
|
|
1485
|
+
B({
|
|
1486
|
+
items: Array.from({ length: 12 }, (r, l) => l + 1),
|
|
1487
|
+
handleTimeSelect: e,
|
|
1488
|
+
state: o.state,
|
|
1489
|
+
stateValue: "hour",
|
|
1490
|
+
pad: !0
|
|
1491
|
+
}),
|
|
1492
|
+
// Minutes column
|
|
1493
|
+
B({
|
|
1494
|
+
items: Array.from({ length: 60 }, (r, l) => l),
|
|
1495
|
+
handleTimeSelect: e,
|
|
1496
|
+
state: o.state,
|
|
1497
|
+
stateValue: "minute",
|
|
1498
|
+
pad: !0
|
|
1499
|
+
}),
|
|
1500
|
+
// AM/PM column
|
|
1501
|
+
B({
|
|
1502
|
+
items: ["AM", "PM"],
|
|
1503
|
+
handleTimeSelect: e,
|
|
1504
|
+
state: o.state,
|
|
1505
|
+
stateValue: "meridian"
|
|
1506
|
+
})
|
|
1184
1507
|
]
|
|
1185
1508
|
)
|
|
1186
1509
|
]
|
|
1187
|
-
)
|
|
1188
|
-
|
|
1189
|
-
|
|
1510
|
+
)
|
|
1511
|
+
]
|
|
1512
|
+
)
|
|
1190
1513
|
);
|
|
1191
1514
|
}
|
|
1192
|
-
function
|
|
1515
|
+
function R(e) {
|
|
1193
1516
|
if (!e)
|
|
1194
1517
|
return { hour: null, minute: null, meridian: null };
|
|
1195
1518
|
const t = /^(\d{1,2}):(\d{2})(?::(\d{2}))?\s?(AM|PM)?$/i, s = e.match(t);
|
|
1196
1519
|
if (!s)
|
|
1197
1520
|
return { hour: null, minute: null, meridian: null };
|
|
1198
|
-
let [, o,
|
|
1199
|
-
return i < 0 || i > 23 || d < 0 || d > 59 ? { hour: null, minute: null, meridian: null } : (
|
|
1521
|
+
let [, o, r, , l] = s, i = parseInt(o, 10), d = parseInt(r, 10);
|
|
1522
|
+
return i < 0 || i > 23 || d < 0 || d > 59 ? { hour: null, minute: null, meridian: null } : (l ? (l = l.toUpperCase(), l === "PM" && i < 12 ? i += 12 : l === "AM" && i === 12 && (i = 12)) : i === 0 ? (l = "AM", i = 12) : i < 12 ? l = "AM" : i === 12 ? l = "PM" : (l = "PM", i -= 12), {
|
|
1200
1523
|
hour: i.toString().padStart(2, "0"),
|
|
1201
1524
|
minute: d.toString().padStart(2, "0"),
|
|
1202
|
-
meridian:
|
|
1525
|
+
meridian: l
|
|
1203
1526
|
});
|
|
1204
1527
|
}
|
|
1205
|
-
const
|
|
1528
|
+
const os = C(
|
|
1206
1529
|
{
|
|
1207
1530
|
/**
|
|
1208
1531
|
* The initial shallow state of the TimePicker.
|
|
@@ -1210,7 +1533,7 @@ const Lt = w(
|
|
|
1210
1533
|
* @member {object} state
|
|
1211
1534
|
*/
|
|
1212
1535
|
state() {
|
|
1213
|
-
const e = this.selectedTime ?? null, { hour: t, minute: s, meridian: o } =
|
|
1536
|
+
const e = this.selectedTime ?? null, { hour: t, minute: s, meridian: o } = R(e);
|
|
1214
1537
|
return {
|
|
1215
1538
|
selectedTime: e,
|
|
1216
1539
|
open: !1,
|
|
@@ -1226,7 +1549,7 @@ const Lt = w(
|
|
|
1226
1549
|
*/
|
|
1227
1550
|
after() {
|
|
1228
1551
|
if (this.input.value) {
|
|
1229
|
-
const { hour: e, minute: t, meridian: s } =
|
|
1552
|
+
const { hour: e, minute: t, meridian: s } = R(this.input.value);
|
|
1230
1553
|
this.state.set({
|
|
1231
1554
|
hour: e,
|
|
1232
1555
|
minute: t,
|
|
@@ -1235,38 +1558,78 @@ const Lt = w(
|
|
|
1235
1558
|
});
|
|
1236
1559
|
}
|
|
1237
1560
|
},
|
|
1561
|
+
/**
|
|
1562
|
+
* Toggles the time picker popover.
|
|
1563
|
+
*
|
|
1564
|
+
* @param {Event} e
|
|
1565
|
+
* @param {object} context
|
|
1566
|
+
*/
|
|
1567
|
+
toggleOpen(e, { state: t }) {
|
|
1568
|
+
t.toggle("open");
|
|
1569
|
+
},
|
|
1570
|
+
/**
|
|
1571
|
+
* Handles direct input changes and formats the time.
|
|
1572
|
+
*
|
|
1573
|
+
* @param {Event} e
|
|
1574
|
+
*/
|
|
1575
|
+
handleInputChange(e) {
|
|
1576
|
+
let t = e.target.value.replace(/[^\d]/g, ""), s = dt(t);
|
|
1577
|
+
const o = ht(t);
|
|
1578
|
+
o.formattedTime && (s = o.formattedTime, this.state.set({
|
|
1579
|
+
hour: o.hour,
|
|
1580
|
+
minute: o.minute,
|
|
1581
|
+
meridian: o.meridian,
|
|
1582
|
+
selectedTime: o.formattedTime
|
|
1583
|
+
}), this.input.value = o.formattedTime, p.trigger("change", this.input), typeof this.change == "function" && this.change(o.formattedTime)), e.target.value = s;
|
|
1584
|
+
},
|
|
1585
|
+
/**
|
|
1586
|
+
* Handles input focus - select all text for easy editing.
|
|
1587
|
+
*
|
|
1588
|
+
* @param {Event} e
|
|
1589
|
+
*/
|
|
1590
|
+
handleInputFocus(e) {
|
|
1591
|
+
e.target.select();
|
|
1592
|
+
},
|
|
1593
|
+
/**
|
|
1594
|
+
* Handles time selection from the picker columns.
|
|
1595
|
+
*
|
|
1596
|
+
* @param {object} params
|
|
1597
|
+
*/
|
|
1598
|
+
handleTimeSelect({ hour: e, minute: t, meridian: s }) {
|
|
1599
|
+
if (e && (this.state.hour = e), t && (this.state.minute = t), s && (this.state.meridian = s), this.state.hour && this.state.minute && this.state.meridian) {
|
|
1600
|
+
const o = `${this.state.hour}:${this.state.minute} ${this.state.meridian}`;
|
|
1601
|
+
this.state.selectedTime = o, this.state.open = !1, this.input.value = o, p.trigger("change", this.input), typeof this.change == "function" && this.change(o);
|
|
1602
|
+
}
|
|
1603
|
+
},
|
|
1238
1604
|
/**
|
|
1239
1605
|
* Renders the TimePicker component.
|
|
1240
1606
|
*
|
|
1241
1607
|
* @returns {object}
|
|
1242
1608
|
*/
|
|
1243
1609
|
render() {
|
|
1244
|
-
const e = (s, { state: o }) => o.toggle("open"), t = ({ hour: s, minute: o, meridian: l }) => {
|
|
1245
|
-
if (s && (this.state.hour = s), o && (this.state.minute = o), l && (this.state.meridian = l), this.state.hour && this.state.minute && this.state.meridian) {
|
|
1246
|
-
const r = `${this.state.hour}:${this.state.minute} ${this.state.meridian}`;
|
|
1247
|
-
this.state.selectedTime = r, this.state.open = !1, this.input.value = r, typeof this.change == "function" && this.change(r);
|
|
1248
|
-
}
|
|
1249
|
-
};
|
|
1250
1610
|
return n(
|
|
1251
1611
|
{ class: "relative w-full max-w-[320px]" },
|
|
1252
1612
|
[
|
|
1253
|
-
|
|
1254
|
-
toggleOpen:
|
|
1613
|
+
gt({
|
|
1614
|
+
toggleOpen: this.toggleOpen.bind(this),
|
|
1255
1615
|
bind: this.bind,
|
|
1256
|
-
required: this.required
|
|
1616
|
+
required: this.required,
|
|
1617
|
+
handleInputChange: this.handleInputChange.bind(this),
|
|
1618
|
+
handleInputFocus: this.handleInputFocus.bind(this),
|
|
1619
|
+
placeholder: this.placeholder
|
|
1257
1620
|
}),
|
|
1258
|
-
|
|
1259
|
-
handleTimeSelect:
|
|
1621
|
+
pt({
|
|
1622
|
+
handleTimeSelect: this.handleTimeSelect.bind(this)
|
|
1260
1623
|
})
|
|
1261
1624
|
]
|
|
1262
1625
|
);
|
|
1263
1626
|
}
|
|
1264
1627
|
}
|
|
1265
|
-
),
|
|
1266
|
-
|
|
1267
|
-
]),
|
|
1268
|
-
|
|
1269
|
-
]),
|
|
1628
|
+
), bt = (e, t) => n({ class: `hidden md:flex items-start justify-center w-6 h-6 mr-3 ${t}` }, [
|
|
1629
|
+
g({ size: "lg" }, e)
|
|
1630
|
+
]), xt = ({ title: e }) => T({ class: "flex flex-auto items-center" }, [
|
|
1631
|
+
S({ class: "text-lg font-semibold" }, e)
|
|
1632
|
+
]), vt = c((e, t) => ne(
|
|
1270
1633
|
{
|
|
1271
1634
|
class: `fixed pullUpIn z-30 w-[98%] border md:w-full max-w-lg bg-popover text-foreground shadow-lg duration-200
|
|
1272
1635
|
rounded-lg flex flex-auto flex-col
|
|
@@ -1277,18 +1640,18 @@ const Lt = w(
|
|
|
1277
1640
|
[
|
|
1278
1641
|
n({ class: "flex flex-auto p-6 pb-12 md:pb-6" }, [
|
|
1279
1642
|
// Icon and content
|
|
1280
|
-
e.icon &&
|
|
1643
|
+
e.icon && bt(e.icon, e.iconColor),
|
|
1281
1644
|
n({ class: "flex flex-auto flex-col gap-4" }, [
|
|
1282
|
-
n({ class: "flex flex-auto flex-col
|
|
1283
|
-
|
|
1645
|
+
n({ class: "flex flex-auto flex-col gap-y-2" }, [
|
|
1646
|
+
xt(e),
|
|
1284
1647
|
e.description && b({ class: "flex flex-auto flex-col text-sm text-muted-foreground" }, e.description),
|
|
1285
1648
|
n({ class: "flex flex-auto flex-col text-sm text-muted-foreground" }, t)
|
|
1286
1649
|
]),
|
|
1287
|
-
e.buttons && M({ class: "flex flex-col-reverse sm:flex-row sm:justify-end mt-6 gap-2 sm:gap-0 sm:
|
|
1650
|
+
e.buttons && M({ class: "flex flex-col-reverse sm:flex-row sm:justify-end mt-6 gap-2 sm:gap-0 sm:gap-x-2" }, e.buttons)
|
|
1288
1651
|
])
|
|
1289
1652
|
])
|
|
1290
1653
|
]
|
|
1291
|
-
)),
|
|
1654
|
+
)), yt = (e) => G.render(e, app.root), H = {
|
|
1292
1655
|
info: {
|
|
1293
1656
|
borderColor: "border-blue-500",
|
|
1294
1657
|
bgColor: "bg-muted/10",
|
|
@@ -1315,7 +1678,7 @@ const Lt = w(
|
|
|
1315
1678
|
iconColor: "text-muted-foreground"
|
|
1316
1679
|
}
|
|
1317
1680
|
};
|
|
1318
|
-
class
|
|
1681
|
+
class wt extends y {
|
|
1319
1682
|
/**
|
|
1320
1683
|
* This will declare the props for the compiler.
|
|
1321
1684
|
*
|
|
@@ -1332,13 +1695,13 @@ class rt extends p {
|
|
|
1332
1695
|
render() {
|
|
1333
1696
|
const t = (d) => {
|
|
1334
1697
|
d.target === this.panel && this.close();
|
|
1335
|
-
}, { borderColor: s, bgColor: o, iconColor:
|
|
1336
|
-
return
|
|
1337
|
-
class:
|
|
1698
|
+
}, { borderColor: s, bgColor: o, iconColor: r } = H[this.type] || H.default, l = `${this.getMainClass()} ${o} ${s}`, i = this.title || "Dialog Title";
|
|
1699
|
+
return vt({
|
|
1700
|
+
class: l,
|
|
1338
1701
|
title: i,
|
|
1339
1702
|
click: t,
|
|
1340
1703
|
icon: this.icon,
|
|
1341
|
-
iconColor:
|
|
1704
|
+
iconColor: r,
|
|
1342
1705
|
description: this.description,
|
|
1343
1706
|
buttons: this.getButtons()
|
|
1344
1707
|
}, this.children);
|
|
@@ -1377,7 +1740,7 @@ class rt extends p {
|
|
|
1377
1740
|
* @returns {void}
|
|
1378
1741
|
*/
|
|
1379
1742
|
open() {
|
|
1380
|
-
|
|
1743
|
+
yt(this), this.panel.showModal(), this.state.open = !0;
|
|
1381
1744
|
}
|
|
1382
1745
|
/**
|
|
1383
1746
|
* This will close the modal.
|
|
@@ -1388,7 +1751,7 @@ class rt extends p {
|
|
|
1388
1751
|
this.state.open = !1, this.panel.close(), typeof this.onClose == "function" && this.onClose(), this.destroy();
|
|
1389
1752
|
}
|
|
1390
1753
|
}
|
|
1391
|
-
class
|
|
1754
|
+
class ns extends wt {
|
|
1392
1755
|
/**
|
|
1393
1756
|
* This will declare the props for the compiler.
|
|
1394
1757
|
*
|
|
@@ -1418,44 +1781,67 @@ class Pt extends rt {
|
|
|
1418
1781
|
this.confirmed && this.confirmed(), this.close();
|
|
1419
1782
|
}
|
|
1420
1783
|
}
|
|
1784
|
+
const rs = c((e, t = []) => n({ class: "w-full max-w-md p-6 m-auto" }, [
|
|
1785
|
+
K({ class: "flex flex-auto flex-col" }, [
|
|
1786
|
+
n({ class: "flex flex-auto flex-col gap-y-4" }, [
|
|
1787
|
+
n({ class: "flex flex-auto items-center justify-center" }, [
|
|
1788
|
+
e.icon && n({ class: "w-16 h-16 mb-2 text-primary" }, [
|
|
1789
|
+
g(e.icon)
|
|
1790
|
+
])
|
|
1791
|
+
]),
|
|
1792
|
+
T({ class: "py-4 text-center" }, [
|
|
1793
|
+
S({ class: "text-xl font-bold" }, e.title),
|
|
1794
|
+
b({ class: "pb-8 text-muted-foreground" }, e.description || ""),
|
|
1795
|
+
...t
|
|
1796
|
+
])
|
|
1797
|
+
])
|
|
1798
|
+
])
|
|
1799
|
+
]));
|
|
1421
1800
|
export {
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1801
|
+
Lt as A,
|
|
1802
|
+
Kt as B,
|
|
1803
|
+
Rt as C,
|
|
1804
|
+
At as D,
|
|
1805
|
+
es as E,
|
|
1806
|
+
ke as F,
|
|
1807
|
+
ts as G,
|
|
1808
|
+
ss as H,
|
|
1809
|
+
Gt as I,
|
|
1810
|
+
os as J,
|
|
1811
|
+
ns as K,
|
|
1812
|
+
Jt as L,
|
|
1813
|
+
Ht as M,
|
|
1814
|
+
qt as N,
|
|
1815
|
+
vt as O,
|
|
1816
|
+
et as P,
|
|
1817
|
+
wt as Q,
|
|
1818
|
+
rs as R,
|
|
1819
|
+
Ut as S,
|
|
1820
|
+
Yt as T,
|
|
1821
|
+
ye as a,
|
|
1822
|
+
Mt as b,
|
|
1823
|
+
Ce as c,
|
|
1824
|
+
De as d,
|
|
1825
|
+
Te as e,
|
|
1826
|
+
Fe as f,
|
|
1827
|
+
Pt as g,
|
|
1828
|
+
Ot as h,
|
|
1829
|
+
jt as i,
|
|
1830
|
+
Be as j,
|
|
1831
|
+
zt as k,
|
|
1832
|
+
K as l,
|
|
1833
|
+
Et as m,
|
|
1834
|
+
Nt as n,
|
|
1835
|
+
Ee as o,
|
|
1836
|
+
Vt as p,
|
|
1837
|
+
_t as q,
|
|
1838
|
+
Wt as r,
|
|
1839
|
+
k as s,
|
|
1840
|
+
v as t,
|
|
1455
1841
|
Re as u,
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1842
|
+
Qt as v,
|
|
1843
|
+
Xt as w,
|
|
1844
|
+
Ze as x,
|
|
1845
|
+
tt as y,
|
|
1846
|
+
Zt as z
|
|
1461
1847
|
};
|