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