react-admin-crud-manager 1.0.19 → 1.0.20
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/index.cjs.js +54 -54
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +2541 -2541
- package/dist/index.es.js.map +1 -1
- package/dist/tailwind.css +1339 -1342
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,2541 +1,2541 @@
|
|
|
1
|
-
import { jsx as e, Fragment as E, jsxs as d } from "react/jsx-runtime";
|
|
2
|
-
import Ce, { useState as S, useRef as ae, useEffect as H, useMemo as Me } from "react";
|
|
3
|
-
import { ChevronDown as Te, Search as Re, Check as Ke, X as we, Plus as ze, Filter as He, ChevronLeft as Ye, ChevronRight as Ve, EllipsisVertical as We, User as Fe, Music as qe } from "lucide-react";
|
|
4
|
-
import { createPortal as Ze } from "react-dom";
|
|
5
|
-
import { Icon as te } from "@iconify/react";
|
|
6
|
-
import { Editor as Je } from "@tinymce/tinymce-react";
|
|
7
|
-
import { SnackbarProvider as Qe, enqueueSnackbar as ke } from "notistack";
|
|
8
|
-
import a from "prop-types";
|
|
9
|
-
const Pe = (h, n = "DD MMM YYYY") => {
|
|
10
|
-
if (!h) return "N/A";
|
|
11
|
-
const i = new Date(h);
|
|
12
|
-
if (isNaN(i)) return "Invalid Date";
|
|
13
|
-
const o = (t) => String(t).padStart(2, "0"), s = {
|
|
14
|
-
YYYY: i.getFullYear(),
|
|
15
|
-
YY: String(i.getFullYear()).slice(-2),
|
|
16
|
-
MMMM: i.toLocaleString("en-US", { month: "long" }),
|
|
17
|
-
MMM: i.toLocaleString("en-US", { month: "short" }),
|
|
18
|
-
MM: o(i.getMonth() + 1),
|
|
19
|
-
M: i.getMonth() + 1,
|
|
20
|
-
DD: o(i.getDate()),
|
|
21
|
-
D: i.getDate(),
|
|
22
|
-
dddd: i.toLocaleString("en-US", { weekday: "long" }),
|
|
23
|
-
ddd: i.toLocaleString("en-US", { weekday: "short" }),
|
|
24
|
-
HH: o(i.getHours()),
|
|
25
|
-
hh: o(i.getHours() % 12 || 12),
|
|
26
|
-
mm: o(i.getMinutes()),
|
|
27
|
-
ss: o(i.getSeconds()),
|
|
28
|
-
A: i.getHours() >= 12 ? "PM" : "AM"
|
|
29
|
-
};
|
|
30
|
-
return n.replace(
|
|
31
|
-
/YYYY|YY|MMMM|MMM|MM|M|DD|D|dddd|ddd|HH|hh|mm|ss|A/g,
|
|
32
|
-
(t) => s[t]
|
|
33
|
-
);
|
|
34
|
-
}, Xe = (h, n, i = []) => {
|
|
35
|
-
if (!(n != null && n.trim())) return h;
|
|
36
|
-
const o = n.toLowerCase(), s = (t) => t == null ? [] : typeof t == "object" ? Object.values(t).flatMap(s) : [String(t)];
|
|
37
|
-
return h.filter((t) => {
|
|
38
|
-
let p = [];
|
|
39
|
-
return i.length > 0 ? i.forEach((k) => {
|
|
40
|
-
t[k] !== void 0 && p.push(...s(t[k]));
|
|
41
|
-
}) : p = s(t), p.some(
|
|
42
|
-
(k) => k.toLowerCase().includes(o)
|
|
43
|
-
);
|
|
44
|
-
});
|
|
45
|
-
}, ee = Ce.forwardRef(
|
|
46
|
-
({
|
|
47
|
-
className: h = "",
|
|
48
|
-
variant: n = "contained",
|
|
49
|
-
color: i = "default",
|
|
50
|
-
size: o = "default",
|
|
51
|
-
fullWidth: s = !1,
|
|
52
|
-
children: t,
|
|
53
|
-
...p
|
|
54
|
-
}, k) => {
|
|
55
|
-
var b;
|
|
56
|
-
const M = "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-400 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", u = {
|
|
57
|
-
sm: "h-8 px-3 rounded-md text-sm",
|
|
58
|
-
md: "h-9 px-4 rounded-md text-sm",
|
|
59
|
-
lg: "h-11 px-6 rounded-md text-base",
|
|
60
|
-
xl: "h-12 px-8 rounded-lg text-lg",
|
|
61
|
-
default: "h-9 px-4 rounded-md text-sm"
|
|
62
|
-
}, l = {
|
|
63
|
-
primary: {
|
|
64
|
-
contained: "bg-primary text-white hover:bg-primary-600 focus:ring-primary-500 shadow-sm",
|
|
65
|
-
outlined: "border border-primary bg-transparent text-primary hover:bg-primary-50 focus:ring-primary-500",
|
|
66
|
-
text: "bg-transparent text-primary hover:bg-primary-50 focus:ring-primary-500"
|
|
67
|
-
},
|
|
68
|
-
success: {
|
|
69
|
-
contained: "bg-green-600 text-white hover:bg-green-700 focus:ring-green-500 shadow-sm",
|
|
70
|
-
outlined: "border border-green-600 bg-transparent text-green-600 hover:bg-green-50 focus:ring-green-500",
|
|
71
|
-
text: "bg-transparent text-green-600 hover:bg-green-50 focus:ring-green-500"
|
|
72
|
-
},
|
|
73
|
-
error: {
|
|
74
|
-
contained: "bg-red-600 text-white hover:bg-red-700 focus:ring-red-500 shadow-sm",
|
|
75
|
-
outlined: "border border-red-600 bg-transparent text-red-600 hover:bg-red-50 focus:ring-red-500",
|
|
76
|
-
text: "bg-transparent text-red-600 hover:bg-red-50 focus:ring-red-500"
|
|
77
|
-
},
|
|
78
|
-
default: {
|
|
79
|
-
contained: "border bg-gray-200 text-gray-800 hover:bg-gray-300 focus:ring-gray-300 shadow-sm dark:border-gray-600 dark:bg-gray-700 dark:text-gray-100 dark:hover:bg-gray-600 dark:focus:ring-gray-600",
|
|
80
|
-
outlined: "border border-gray-300 bg-transparent text-gray-700 hover:bg-gray-100 focus:ring-gray-300 dark:border-gray-600 dark:text-gray-200 dark:hover:bg-gray-700 dark:focus:ring-gray-500",
|
|
81
|
-
text: "bg-transparent text-gray-700 hover:bg-gray-100 focus:ring-gray-300 dark:text-gray-200 dark:hover:bg-gray-700 dark:focus:ring-gray-500"
|
|
82
|
-
}
|
|
83
|
-
}, c = ((b = l[i]) == null ? void 0 : b[n]) || l.default.contained, g = u[o], y = `
|
|
84
|
-
${M}
|
|
85
|
-
${c}
|
|
86
|
-
${g}
|
|
87
|
-
${s ? "w-full" : ""}
|
|
88
|
-
${h}
|
|
89
|
-
`.trim();
|
|
90
|
-
return /* @__PURE__ */ e(
|
|
91
|
-
"button",
|
|
92
|
-
{
|
|
93
|
-
ref: k,
|
|
94
|
-
type: p.type || "button",
|
|
95
|
-
className: y,
|
|
96
|
-
...p,
|
|
97
|
-
children: t
|
|
98
|
-
}
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
);
|
|
102
|
-
ee.displayName = "Button";
|
|
103
|
-
function Q({ label: h, required: n = !1 }) {
|
|
104
|
-
return /* @__PURE__ */ e(E, { children: /* @__PURE__ */ d("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: [
|
|
105
|
-
h,
|
|
106
|
-
n && /* @__PURE__ */ e("span", { className: "ml-1", children: "*" })
|
|
107
|
-
] }) });
|
|
108
|
-
}
|
|
109
|
-
const ea = ({
|
|
110
|
-
options: h = [],
|
|
111
|
-
value: n = "",
|
|
112
|
-
defaultValue: i = "",
|
|
113
|
-
onChange: o,
|
|
114
|
-
placeholder: s = "Select option",
|
|
115
|
-
className: t = "",
|
|
116
|
-
disabled: p = !1,
|
|
117
|
-
search: k = !1,
|
|
118
|
-
label: M = "",
|
|
119
|
-
required: u = !1,
|
|
120
|
-
name: l = "",
|
|
121
|
-
parentClass: c = "",
|
|
122
|
-
multiple: g = !1,
|
|
123
|
-
// ✅ NEW
|
|
124
|
-
dropdownMaxHeight: y = "",
|
|
125
|
-
formData: b = {},
|
|
126
|
-
dependencyKey: v = ""
|
|
127
|
-
}) => {
|
|
128
|
-
var q;
|
|
129
|
-
const [x, N] = S(!1), [I, D] = S(""), [C, A] = S(!0), B = ae(null), F = ae(null), [R, j] = S([]);
|
|
130
|
-
let $ = n || n === !1 ? n : i;
|
|
131
|
-
const W = (w) => w == null || w === "" ? "" : String(typeof w == "boolean" ? w : w ?? "");
|
|
132
|
-
H(
|
|
133
|
-
() => {
|
|
134
|
-
(async () => {
|
|
135
|
-
if (typeof h == "function") {
|
|
136
|
-
const z = await h(b);
|
|
137
|
-
j(z);
|
|
138
|
-
} else
|
|
139
|
-
j(h || []);
|
|
140
|
-
})();
|
|
141
|
-
},
|
|
142
|
-
v ? [h, b == null ? void 0 : b[v]] : [h]
|
|
143
|
-
);
|
|
144
|
-
const G = g ? ($ || []).map(W) : W($), K = R.filter(
|
|
145
|
-
(w) => w.label.toLowerCase().includes(I.toLowerCase())
|
|
146
|
-
), U = (w) => {
|
|
147
|
-
const z = W(w);
|
|
148
|
-
return g ? G.includes(z) : z === G;
|
|
149
|
-
};
|
|
150
|
-
H(() => {
|
|
151
|
-
const w = (z) => {
|
|
152
|
-
B.current && !B.current.contains(z.target) && (N(!1), D(""));
|
|
153
|
-
};
|
|
154
|
-
return document.addEventListener("mousedown", w), () => document.removeEventListener("mousedown", w);
|
|
155
|
-
}, []), H(() => {
|
|
156
|
-
if (x && B.current) {
|
|
157
|
-
const w = B.current.getBoundingClientRect(), re = window.innerHeight - w.bottom;
|
|
158
|
-
A(re < 200);
|
|
159
|
-
}
|
|
160
|
-
}, [x]), H(() => {
|
|
161
|
-
x && F.current && F.current.focus();
|
|
162
|
-
}, [x]);
|
|
163
|
-
const O = (w) => {
|
|
164
|
-
let z = w;
|
|
165
|
-
if (w === "true" ? z = !0 : w === "false" && (z = !1), g) {
|
|
166
|
-
const re = G.includes(W(w));
|
|
167
|
-
let J;
|
|
168
|
-
re ? J = n.filter(
|
|
169
|
-
(X) => W(X) !== W(w)
|
|
170
|
-
) : J = [...n || [], z], o(J);
|
|
171
|
-
} else
|
|
172
|
-
o(z), N(!1);
|
|
173
|
-
D("");
|
|
174
|
-
}, Y = g ? R.filter((w) => U(w.value)).map((w) => w.label).join(", ") : (q = R.find((w) => U(w.value))) == null ? void 0 : q.label;
|
|
175
|
-
return H(() => {
|
|
176
|
-
($ || $ === !1) && setTimeout(() => {
|
|
177
|
-
o($);
|
|
178
|
-
}, 100);
|
|
179
|
-
}, []), /* @__PURE__ */ d("div", { className: c || "col-span-12", children: [
|
|
180
|
-
/* @__PURE__ */ e(Q, { label: M, required: u }),
|
|
181
|
-
/* @__PURE__ */ d("div", { className: `relative ${t}`, ref: B, children: [
|
|
182
|
-
/* @__PURE__ */ e(
|
|
183
|
-
"select",
|
|
184
|
-
{
|
|
185
|
-
name: "hidden_select_for_validation",
|
|
186
|
-
value: Y || "",
|
|
187
|
-
required: u,
|
|
188
|
-
multiple: g,
|
|
189
|
-
className: "absolute opacity-0 right-1/2 top-[80%] -translate-x-1/2 -translate-y-1/2 pointer-events-none h-[10px]",
|
|
190
|
-
children: /* @__PURE__ */ e("option", { hidden: !0, value: Y, children: Y })
|
|
191
|
-
}
|
|
192
|
-
),
|
|
193
|
-
/* @__PURE__ */ d(
|
|
194
|
-
"button",
|
|
195
|
-
{
|
|
196
|
-
type: "button",
|
|
197
|
-
onClick: () => !p && N(!x),
|
|
198
|
-
disabled: p,
|
|
199
|
-
className: `w-full h-10 px-3 border border-gray-300 dark:border-gray-600 rounded-md text-left text-sm flex items-center justify-between
|
|
200
|
-
${Y ? "dark:text-white" : "text-gray-500 dark:text-gray-400"}
|
|
201
|
-
${p ? "opacity-50 cursor-not-allowed" : "dark:bg-gray-700"}`,
|
|
202
|
-
children: [
|
|
203
|
-
/* @__PURE__ */ e("span", { className: "truncate", children: Y || s }),
|
|
204
|
-
/* @__PURE__ */ e(
|
|
205
|
-
Te,
|
|
206
|
-
{
|
|
207
|
-
className: `w-4 h-4 transition-transform ${x ? "rotate-180" : ""}`
|
|
208
|
-
}
|
|
209
|
-
)
|
|
210
|
-
]
|
|
211
|
-
}
|
|
212
|
-
),
|
|
213
|
-
x && /* @__PURE__ */ d(
|
|
214
|
-
"div",
|
|
215
|
-
{
|
|
216
|
-
className: `absolute z-50 w-full border rounded-md bg-white dark:bg-gray-700 shadow-lg
|
|
217
|
-
${C ? "bottom-full mb-1" : "top-full mt-1"}`,
|
|
218
|
-
children: [
|
|
219
|
-
k && /* @__PURE__ */ e("div", { className: "p-2 border-b border-gray-200 dark:border-gray-600", children: /* @__PURE__ */ d("div", { className: "relative", children: [
|
|
220
|
-
/* @__PURE__ */ e(Re, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400" }),
|
|
221
|
-
/* @__PURE__ */ e(
|
|
222
|
-
"input",
|
|
223
|
-
{
|
|
224
|
-
ref: F,
|
|
225
|
-
type: "text",
|
|
226
|
-
value: I,
|
|
227
|
-
onChange: (w) => D(w.target.value),
|
|
228
|
-
placeholder: "Search...",
|
|
229
|
-
className: "w-full pl-9 pr-3 py-2 text-sm border rounded-md bg-white dark:bg-gray-800 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none"
|
|
230
|
-
}
|
|
231
|
-
)
|
|
232
|
-
] }) }),
|
|
233
|
-
/* @__PURE__ */ e(
|
|
234
|
-
"div",
|
|
235
|
-
{
|
|
236
|
-
className: "max-h-40 overflow-y-auto",
|
|
237
|
-
style: {
|
|
238
|
-
maxHeight: y || ""
|
|
239
|
-
},
|
|
240
|
-
children: K.length > 0 ? K.map((w) => /* @__PURE__ */ d(
|
|
241
|
-
"button",
|
|
242
|
-
{
|
|
243
|
-
type: "button",
|
|
244
|
-
onClick: () => O(String(w.value)),
|
|
245
|
-
className: `w-full px-3 py-2 text-left text-sm flex items-center justify-between hover:bg-gray-100 dark:hover:bg-gray-600
|
|
246
|
-
${U(w.value) ? "bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300" : ""}`,
|
|
247
|
-
children: [
|
|
248
|
-
/* @__PURE__ */ e("span", { children: w.label }),
|
|
249
|
-
g && U(w.value) && /* @__PURE__ */ e(Ke, { className: "w-4 h-4" })
|
|
250
|
-
]
|
|
251
|
-
},
|
|
252
|
-
String(w.value)
|
|
253
|
-
)) : /* @__PURE__ */ e("div", { className: "px-3 py-2 text-sm text-gray-500 dark:text-gray-400", children: "No options found" })
|
|
254
|
-
}
|
|
255
|
-
)
|
|
256
|
-
]
|
|
257
|
-
}
|
|
258
|
-
)
|
|
259
|
-
] })
|
|
260
|
-
] }, l);
|
|
261
|
-
}, aa = ({
|
|
262
|
-
value: h = !0,
|
|
263
|
-
onChange: n,
|
|
264
|
-
text: i,
|
|
265
|
-
options: o = [],
|
|
266
|
-
label: s,
|
|
267
|
-
required: t,
|
|
268
|
-
name: p = "",
|
|
269
|
-
disabled: k = !1,
|
|
270
|
-
parentClass: M = ""
|
|
271
|
-
}) => {
|
|
272
|
-
const u = o.length > 0 ? o : [
|
|
273
|
-
{ label: "Active", value: !0 },
|
|
274
|
-
{ label: "Inactive", value: !1 }
|
|
275
|
-
];
|
|
276
|
-
return /* @__PURE__ */ e(E, { children: /* @__PURE__ */ d("div", { className: M || "col-span-12", children: [
|
|
277
|
-
/* @__PURE__ */ e(Q, { label: s, required: t }),
|
|
278
|
-
/* @__PURE__ */ d("div", { className: "flex items-center justify-between h-10 gap-4 bg-gray-100 dark:bg-gray-700 px-3 rounded-md border border-gray-100 dark:border-gray-600", children: [
|
|
279
|
-
i && /* @__PURE__ */ e("p", { className: "text-xs text-gray-600 dark:text-gray-400 flex-shrink overflow-hidden text-ellipsis whitespace-nowrap max-w-[200px]", children: i }),
|
|
280
|
-
/* @__PURE__ */ e("div", { className: "flex items-center gap-6", children: u.map((l, c) => /* @__PURE__ */ d(
|
|
281
|
-
"label",
|
|
282
|
-
{
|
|
283
|
-
className: "flex items-center gap-2 cursor-pointer select-none",
|
|
284
|
-
children: [
|
|
285
|
-
/* @__PURE__ */ e(
|
|
286
|
-
"input",
|
|
287
|
-
{
|
|
288
|
-
type: "radio",
|
|
289
|
-
name: "switch-field",
|
|
290
|
-
required: t && c === 0,
|
|
291
|
-
value: l.value,
|
|
292
|
-
disabled: k,
|
|
293
|
-
checked: h === l.value,
|
|
294
|
-
onChange: () => n(l.value),
|
|
295
|
-
className: "w-4 h-4 border-gray-300 cursor-pointer"
|
|
296
|
-
}
|
|
297
|
-
),
|
|
298
|
-
/* @__PURE__ */ e("span", { className: "text-sm text-gray-700 dark:text-white", children: l.label })
|
|
299
|
-
]
|
|
300
|
-
},
|
|
301
|
-
c
|
|
302
|
-
)) })
|
|
303
|
-
] })
|
|
304
|
-
] }, p) });
|
|
305
|
-
}, xe = [
|
|
306
|
-
{ label: "Afghanistan", code: "AF", phone: "93" },
|
|
307
|
-
{ label: "Aland Islands", code: "AX", phone: "358" },
|
|
308
|
-
{ label: "Albania", code: "AL", phone: "355" },
|
|
309
|
-
{ label: "Algeria", code: "DZ", phone: "213" },
|
|
310
|
-
{ label: "American Samoa", code: "AS", phone: "1" },
|
|
311
|
-
{ label: "Andorra", code: "AD", phone: "376" },
|
|
312
|
-
{ label: "Angola", code: "AO", phone: "244" },
|
|
313
|
-
{ label: "Anguilla", code: "AI", phone: "1" },
|
|
314
|
-
{ label: "Antarctica", code: "AQ", phone: "672" },
|
|
315
|
-
{ label: "Antigua and Barbuda", code: "AG", phone: "1" },
|
|
316
|
-
{ label: "Argentina", code: "AR", phone: "54" },
|
|
317
|
-
{ label: "Armenia", code: "AM", phone: "374" },
|
|
318
|
-
{ label: "Aruba", code: "AW", phone: "297" },
|
|
319
|
-
{ label: "Australia", code: "AU", phone: "61" },
|
|
320
|
-
{ label: "Austria", code: "AT", phone: "43" },
|
|
321
|
-
{ label: "Azerbaijan", code: "AZ", phone: "994" },
|
|
322
|
-
{ label: "Bahrain", code: "BH", phone: "973" },
|
|
323
|
-
{ label: "Bangladesh", code: "BD", phone: "880" },
|
|
324
|
-
{ label: "Barbados", code: "BB", phone: "1" },
|
|
325
|
-
{ label: "Belarus", code: "BY", phone: "375" },
|
|
326
|
-
{ label: "Belgium", code: "BE", phone: "32" },
|
|
327
|
-
{ label: "Belize", code: "BZ", phone: "501" },
|
|
328
|
-
{ label: "Benin", code: "BJ", phone: "229" },
|
|
329
|
-
{ label: "Bermuda", code: "BM", phone: "1" },
|
|
330
|
-
{ label: "Bhutan", code: "BT", phone: "975" },
|
|
331
|
-
{ label: "Bolivia", code: "BO", phone: "591" },
|
|
332
|
-
{ label: "Bonaire, Sint Eustatius and Saba", code: "BQ", phone: "599" },
|
|
333
|
-
{ label: "Bosnia and Herzegovina", code: "BA", phone: "387" },
|
|
334
|
-
{ label: "Botswana", code: "BW", phone: "267" },
|
|
335
|
-
{ label: "Bouvet Island", code: "BV", phone: "0055" },
|
|
336
|
-
{ label: "Brazil", code: "BR", phone: "55" },
|
|
337
|
-
{ label: "British Indian Ocean Territory", code: "IO", phone: "246" },
|
|
338
|
-
{ label: "Brunei", code: "BN", phone: "673" },
|
|
339
|
-
{ label: "Bulgaria", code: "BG", phone: "359" },
|
|
340
|
-
{ label: "Burkina Faso", code: "BF", phone: "226" },
|
|
341
|
-
{ label: "Burundi", code: "BI", phone: "257" },
|
|
342
|
-
{ label: "Cambodia", code: "KH", phone: "855" },
|
|
343
|
-
{ label: "Cameroon", code: "CM", phone: "237" },
|
|
344
|
-
{ label: "Canada", code: "CA", phone: "1" },
|
|
345
|
-
{ label: "Cape Verde", code: "CV", phone: "238" },
|
|
346
|
-
{ label: "Cayman Islands", code: "KY", phone: "1" },
|
|
347
|
-
{ label: "Central African Republic", code: "CF", phone: "236" },
|
|
348
|
-
{ label: "Chad", code: "TD", phone: "235" },
|
|
349
|
-
{ label: "Chile", code: "CL", phone: "56" },
|
|
350
|
-
{ label: "China", code: "CN", phone: "86" },
|
|
351
|
-
{ label: "Christmas Island", code: "CX", phone: "61" },
|
|
352
|
-
{ label: "Cocos (Keeling) Islands", code: "CC", phone: "61" },
|
|
353
|
-
{ label: "Colombia", code: "CO", phone: "57" },
|
|
354
|
-
{ label: "Comoros", code: "KM", phone: "269" },
|
|
355
|
-
{ label: "Congo", code: "CG", phone: "242" },
|
|
356
|
-
{ label: "Cook Islands", code: "CK", phone: "682" },
|
|
357
|
-
{ label: "Costa Rica", code: "CR", phone: "506" },
|
|
358
|
-
{ label: "Croatia", code: "HR", phone: "385" },
|
|
359
|
-
{ label: "Cuba", code: "CU", phone: "53" },
|
|
360
|
-
{ label: "Curaçao", code: "CW", phone: "599" },
|
|
361
|
-
{ label: "Cyprus", code: "CY", phone: "357" },
|
|
362
|
-
{ label: "Czech Republic", code: "CZ", phone: "420" },
|
|
363
|
-
{ label: "Democratic Republic of the Congo", code: "CD", phone: "243" },
|
|
364
|
-
{ label: "Denmark", code: "DK", phone: "45" },
|
|
365
|
-
{ label: "Djibouti", code: "DJ", phone: "253" },
|
|
366
|
-
{ label: "Dominica", code: "DM", phone: "1" },
|
|
367
|
-
{ label: "Dominican Republic", code: "DO", phone: "1" },
|
|
368
|
-
{ label: "Ecuador", code: "EC", phone: "593" },
|
|
369
|
-
{ label: "Egypt", code: "EG", phone: "20" },
|
|
370
|
-
{ label: "El Salvador", code: "SV", phone: "503" },
|
|
371
|
-
{ label: "Equatorial Guinea", code: "GQ", phone: "240" },
|
|
372
|
-
{ label: "Eritrea", code: "ER", phone: "291" },
|
|
373
|
-
{ label: "Estonia", code: "EE", phone: "372" },
|
|
374
|
-
{ label: "Eswatini", code: "SZ", phone: "268" },
|
|
375
|
-
{ label: "Ethiopia", code: "ET", phone: "251" },
|
|
376
|
-
{ label: "Falkland Islands", code: "FK", phone: "500" },
|
|
377
|
-
{ label: "Faroe Islands", code: "FO", phone: "298" },
|
|
378
|
-
{ label: "Fiji Islands", code: "FJ", phone: "679" },
|
|
379
|
-
{ label: "Finland", code: "FI", phone: "358" },
|
|
380
|
-
{ label: "France", code: "FR", phone: "33" },
|
|
381
|
-
{ label: "French Guiana", code: "GF", phone: "594" },
|
|
382
|
-
{ label: "French Polynesia", code: "PF", phone: "689" },
|
|
383
|
-
{ label: "French Southern Territories", code: "TF", phone: "262" },
|
|
384
|
-
{ label: "Gabon", code: "GA", phone: "241" },
|
|
385
|
-
{ label: "Georgia", code: "GE", phone: "995" },
|
|
386
|
-
{ label: "Germany", code: "DE", phone: "49" },
|
|
387
|
-
{ label: "Ghana", code: "GH", phone: "233" },
|
|
388
|
-
{ label: "Gibraltar", code: "GI", phone: "350" },
|
|
389
|
-
{ label: "Greece", code: "GR", phone: "30" },
|
|
390
|
-
{ label: "Greenland", code: "GL", phone: "299" },
|
|
391
|
-
{ label: "Grenada", code: "GD", phone: "1" },
|
|
392
|
-
{ label: "Guadeloupe", code: "GP", phone: "590" },
|
|
393
|
-
{ label: "Guam", code: "GU", phone: "1" },
|
|
394
|
-
{ label: "Guatemala", code: "GT", phone: "502" },
|
|
395
|
-
{ label: "Guernsey", code: "GG", phone: "44" },
|
|
396
|
-
{ label: "Guinea", code: "GN", phone: "224" },
|
|
397
|
-
{ label: "Guinea-Bissau", code: "GW", phone: "245" },
|
|
398
|
-
{ label: "Guyana", code: "GY", phone: "592" },
|
|
399
|
-
{ label: "Haiti", code: "HT", phone: "509" },
|
|
400
|
-
{ label: "Heard Island and McDonald Islands", code: "HM", phone: "672" },
|
|
401
|
-
{ label: "Honduras", code: "HN", phone: "504" },
|
|
402
|
-
{ label: "Hong Kong S.A.R.", code: "HK", phone: "852" },
|
|
403
|
-
{ label: "Hungary", code: "HU", phone: "36" },
|
|
404
|
-
{ label: "Iceland", code: "IS", phone: "354" },
|
|
405
|
-
{ label: "India", code: "IN", phone: "91" },
|
|
406
|
-
{ label: "Indonesia", code: "ID", phone: "62" },
|
|
407
|
-
{ label: "Iran", code: "IR", phone: "98" },
|
|
408
|
-
{ label: "Iraq", code: "IQ", phone: "964" },
|
|
409
|
-
{ label: "Ireland", code: "IE", phone: "353" },
|
|
410
|
-
{ label: "Israel", code: "IL", phone: "972" },
|
|
411
|
-
{ label: "Italy", code: "IT", phone: "39" },
|
|
412
|
-
{ label: "Ivory Coast", code: "CI", phone: "225" },
|
|
413
|
-
{ label: "Jamaica", code: "JM", phone: "1" },
|
|
414
|
-
{ label: "Japan", code: "JP", phone: "81" },
|
|
415
|
-
{ label: "Jersey", code: "JE", phone: "44" },
|
|
416
|
-
{ label: "Jordan", code: "JO", phone: "962" },
|
|
417
|
-
{ label: "Kazakhstan", code: "KZ", phone: "7" },
|
|
418
|
-
{ label: "Kenya", code: "KE", phone: "254" },
|
|
419
|
-
{ label: "Kiribati", code: "KI", phone: "686" },
|
|
420
|
-
{ label: "Kosovo", code: "XK", phone: "383" },
|
|
421
|
-
{ label: "Kuwait", code: "KW", phone: "965" },
|
|
422
|
-
{ label: "Kyrgyzstan", code: "KG", phone: "996" },
|
|
423
|
-
{ label: "Laos", code: "LA", phone: "856" },
|
|
424
|
-
{ label: "Latvia", code: "LV", phone: "371" },
|
|
425
|
-
{ label: "Lebanon", code: "LB", phone: "961" },
|
|
426
|
-
{ label: "Lesotho", code: "LS", phone: "266" },
|
|
427
|
-
{ label: "Liberia", code: "LR", phone: "231" },
|
|
428
|
-
{ label: "Libya", code: "LY", phone: "218" },
|
|
429
|
-
{ label: "Liechtenstein", code: "LI", phone: "423" },
|
|
430
|
-
{ label: "Lithuania", code: "LT", phone: "370" },
|
|
431
|
-
{ label: "Luxembourg", code: "LU", phone: "352" },
|
|
432
|
-
{ label: "Macau S.A.R.", code: "MO", phone: "853" },
|
|
433
|
-
{ label: "Madagascar", code: "MG", phone: "261" },
|
|
434
|
-
{ label: "Malawi", code: "MW", phone: "265" },
|
|
435
|
-
{ label: "Malaysia", code: "MY", phone: "60" },
|
|
436
|
-
{ label: "Maldives", code: "MV", phone: "960" },
|
|
437
|
-
{ label: "Mali", code: "ML", phone: "223" },
|
|
438
|
-
{ label: "Malta", code: "MT", phone: "356" },
|
|
439
|
-
{ label: "Man (Isle of)", code: "IM", phone: "44" },
|
|
440
|
-
{ label: "Marshall Islands", code: "MH", phone: "692" },
|
|
441
|
-
{ label: "Martinique", code: "MQ", phone: "596" },
|
|
442
|
-
{ label: "Mauritania", code: "MR", phone: "222" },
|
|
443
|
-
{ label: "Mauritius", code: "MU", phone: "230" },
|
|
444
|
-
{ label: "Mayotte", code: "YT", phone: "262" },
|
|
445
|
-
{ label: "Mexico", code: "MX", phone: "52" },
|
|
446
|
-
{ label: "Micronesia", code: "FM", phone: "691" },
|
|
447
|
-
{ label: "Moldova", code: "MD", phone: "373" },
|
|
448
|
-
{ label: "Monaco", code: "MC", phone: "377" },
|
|
449
|
-
{ label: "Mongolia", code: "MN", phone: "976" },
|
|
450
|
-
{ label: "Montenegro", code: "ME", phone: "382" },
|
|
451
|
-
{ label: "Montserrat", code: "MS", phone: "1" },
|
|
452
|
-
{ label: "Morocco", code: "MA", phone: "212" },
|
|
453
|
-
{ label: "Mozambique", code: "MZ", phone: "258" },
|
|
454
|
-
{ label: "Myanmar", code: "MM", phone: "95" },
|
|
455
|
-
{ label: "Namibia", code: "NA", phone: "264" },
|
|
456
|
-
{ label: "Nauru", code: "NR", phone: "674" },
|
|
457
|
-
{ label: "Nepal", code: "NP", phone: "977" },
|
|
458
|
-
{ label: "Netherlands", code: "NL", phone: "31" },
|
|
459
|
-
{ label: "New Caledonia", code: "NC", phone: "687" },
|
|
460
|
-
{ label: "New Zealand", code: "NZ", phone: "64" },
|
|
461
|
-
{ label: "Nicaragua", code: "NI", phone: "505" },
|
|
462
|
-
{ label: "Niger", code: "NE", phone: "227" },
|
|
463
|
-
{ label: "Nigeria", code: "NG", phone: "234" },
|
|
464
|
-
{ label: "Niue", code: "NU", phone: "683" },
|
|
465
|
-
{ label: "Norfolk Island", code: "NF", phone: "672" },
|
|
466
|
-
{ label: "North Korea", code: "KP", phone: "850" },
|
|
467
|
-
{ label: "North Macedonia", code: "MK", phone: "389" },
|
|
468
|
-
{ label: "Northern Mariana Islands", code: "MP", phone: "1" },
|
|
469
|
-
{ label: "Norway", code: "NO", phone: "47" },
|
|
470
|
-
{ label: "Oman", code: "OM", phone: "968" },
|
|
471
|
-
{ label: "Pakistan", code: "PK", phone: "92" },
|
|
472
|
-
{ label: "Palau", code: "PW", phone: "680" },
|
|
473
|
-
{ label: "Palestinian Territory Occupied", code: "PS", phone: "970" },
|
|
474
|
-
{ label: "Panama", code: "PA", phone: "507" },
|
|
475
|
-
{ label: "Papua New Guinea", code: "PG", phone: "675" },
|
|
476
|
-
{ label: "Paraguay", code: "PY", phone: "595" },
|
|
477
|
-
{ label: "Peru", code: "PE", phone: "51" },
|
|
478
|
-
{ label: "Philippines", code: "PH", phone: "63" },
|
|
479
|
-
{ label: "Pitcairn Island", code: "PN", phone: "870" },
|
|
480
|
-
{ label: "Poland", code: "PL", phone: "48" },
|
|
481
|
-
{ label: "Portugal", code: "PT", phone: "351" },
|
|
482
|
-
{ label: "Puerto Rico", code: "PR", phone: "1" },
|
|
483
|
-
{ label: "Qatar", code: "QA", phone: "974" },
|
|
484
|
-
{ label: "Reunion", code: "RE", phone: "262" },
|
|
485
|
-
{ label: "Romania", code: "RO", phone: "40" },
|
|
486
|
-
{ label: "Russia", code: "RU", phone: "7" },
|
|
487
|
-
{ label: "Rwanda", code: "RW", phone: "250" },
|
|
488
|
-
{ label: "Saint Helena", code: "SH", phone: "290" },
|
|
489
|
-
{ label: "Saint Kitts and Nevis", code: "KN", phone: "1" },
|
|
490
|
-
{ label: "Saint Lucia", code: "LC", phone: "1" },
|
|
491
|
-
{ label: "Saint Pierre and Miquelon", code: "PM", phone: "508" },
|
|
492
|
-
{ label: "Saint Vincent and the Grenadines", code: "VC", phone: "1" },
|
|
493
|
-
{ label: "Saint-Barthelemy", code: "BL", phone: "590" },
|
|
494
|
-
{ label: "Saint-Martin (French part)", code: "MF", phone: "590" },
|
|
495
|
-
{ label: "Samoa", code: "WS", phone: "685" },
|
|
496
|
-
{ label: "San Marino", code: "SM", phone: "378" },
|
|
497
|
-
{ label: "Sao Tome and Principe", code: "ST", phone: "239" },
|
|
498
|
-
{ label: "Saudi Arabia", code: "SA", phone: "966" },
|
|
499
|
-
{ label: "Senegal", code: "SN", phone: "221" },
|
|
500
|
-
{ label: "Serbia", code: "RS", phone: "381" },
|
|
501
|
-
{ label: "Seychelles", code: "SC", phone: "248" },
|
|
502
|
-
{ label: "Sierra Leone", code: "SL", phone: "232" },
|
|
503
|
-
{ label: "Singapore", code: "SG", phone: "65" },
|
|
504
|
-
{ label: "Sint Maarten (Dutch part)", code: "SX", phone: "1721" },
|
|
505
|
-
{ label: "Slovakia", code: "SK", phone: "421" },
|
|
506
|
-
{ label: "Slovenia", code: "SI", phone: "386" },
|
|
507
|
-
{ label: "Solomon Islands", code: "SB", phone: "677" },
|
|
508
|
-
{ label: "Somalia", code: "SO", phone: "252" },
|
|
509
|
-
{ label: "South Africa", code: "ZA", phone: "27" },
|
|
510
|
-
{ label: "South Georgia", code: "GS", phone: "500" },
|
|
511
|
-
{ label: "South Korea", code: "KR", phone: "82" },
|
|
512
|
-
{ label: "South Sudan", code: "SS", phone: "211" },
|
|
513
|
-
{ label: "Spain", code: "ES", phone: "34" },
|
|
514
|
-
{ label: "Sri Lanka", code: "LK", phone: "94" },
|
|
515
|
-
{ label: "Sudan", code: "SD", phone: "249" },
|
|
516
|
-
{ label: "Suriname", code: "SR", phone: "597" },
|
|
517
|
-
{ label: "Svalbard and Jan Mayen Islands", code: "SJ", phone: "47" },
|
|
518
|
-
{ label: "Sweden", code: "SE", phone: "46" },
|
|
519
|
-
{ label: "Switzerland", code: "CH", phone: "41" },
|
|
520
|
-
{ label: "Syria", code: "SY", phone: "963" },
|
|
521
|
-
{ label: "Taiwan", code: "TW", phone: "886" },
|
|
522
|
-
{ label: "Tajikistan", code: "TJ", phone: "992" },
|
|
523
|
-
{ label: "Tanzania", code: "TZ", phone: "255" },
|
|
524
|
-
{ label: "Thailand", code: "TH", phone: "66" },
|
|
525
|
-
{ label: "The Bahamas", code: "BS", phone: "1" },
|
|
526
|
-
{ label: "The Gambia", code: "GM", phone: "220" },
|
|
527
|
-
{ label: "Timor-Leste", code: "TL", phone: "670" },
|
|
528
|
-
{ label: "Togo", code: "TG", phone: "228" },
|
|
529
|
-
{ label: "Tokelau", code: "TK", phone: "690" },
|
|
530
|
-
{ label: "Tonga", code: "TO", phone: "676" },
|
|
531
|
-
{ label: "Trinidad and Tobago", code: "TT", phone: "1" },
|
|
532
|
-
{ label: "Tunisia", code: "TN", phone: "216" },
|
|
533
|
-
{ label: "Turkey", code: "TR", phone: "90" },
|
|
534
|
-
{ label: "Turkmenistan", code: "TM", phone: "993" },
|
|
535
|
-
{ label: "Turks and Caicos Islands", code: "TC", phone: "1" },
|
|
536
|
-
{ label: "Tuvalu", code: "TV", phone: "688" },
|
|
537
|
-
{ label: "Uganda", code: "UG", phone: "256" },
|
|
538
|
-
{ label: "Ukraine", code: "UA", phone: "380" },
|
|
539
|
-
{ label: "United Arab Emirates", code: "AE", phone: "971" },
|
|
540
|
-
{ label: "United Kingdom", code: "GB", phone: "44" },
|
|
541
|
-
{ label: "United States", code: "US", phone: "1" },
|
|
542
|
-
{ label: "United States Minor Outlying Islands", code: "UM", phone: "1" },
|
|
543
|
-
{ label: "Uruguay", code: "UY", phone: "598" },
|
|
544
|
-
{ label: "Uzbekistan", code: "UZ", phone: "998" },
|
|
545
|
-
{ label: "Vanuatu", code: "VU", phone: "678" },
|
|
546
|
-
{ label: "Vatican City State (Holy See)", code: "VA", phone: "379" },
|
|
547
|
-
{ label: "Venezuela", code: "VE", phone: "58" },
|
|
548
|
-
{ label: "Vietnam", code: "VN", phone: "84" },
|
|
549
|
-
{ label: "Virgin Islands (British)", code: "VG", phone: "1" },
|
|
550
|
-
{ label: "Virgin Islands (US)", code: "VI", phone: "1" },
|
|
551
|
-
{ label: "Wallis and Futuna Islands", code: "WF", phone: "681" },
|
|
552
|
-
{ label: "Western Sahara", code: "EH", phone: "212" },
|
|
553
|
-
{ label: "Yemen", code: "YE", phone: "967" },
|
|
554
|
-
{ label: "Zambia", code: "ZM", phone: "260" },
|
|
555
|
-
{ label: "Zimbabwe", code: "ZW", phone: "263" }
|
|
556
|
-
];
|
|
557
|
-
function ra({
|
|
558
|
-
label: h = "",
|
|
559
|
-
value: n = "",
|
|
560
|
-
name: i = "",
|
|
561
|
-
parentClass: o = "",
|
|
562
|
-
onChange: s,
|
|
563
|
-
disabled: t = !1,
|
|
564
|
-
required: p = !1,
|
|
565
|
-
placeholder: k = "Phone number",
|
|
566
|
-
search: M = !1,
|
|
567
|
-
countriesList: u = !1,
|
|
568
|
-
defaultCountry: l = ""
|
|
569
|
-
}) {
|
|
570
|
-
const c = (R) => xe.find((j) => j.code == R), [g, y] = S(
|
|
571
|
-
c(l) || xe[0]
|
|
572
|
-
), [b, v] = S(""), [x, N] = S(!1), [I, D] = S(""), C = ae();
|
|
573
|
-
H(() => {
|
|
574
|
-
if (typeof n == "string" && n.startsWith("+")) {
|
|
575
|
-
const R = xe.filter((j) => n.startsWith("+" + j.phone)).sort((j, $) => $.phone.length - j.phone.length)[0];
|
|
576
|
-
if (R) {
|
|
577
|
-
y(R), v(n.replace("+" + R.phone, ""));
|
|
578
|
-
return;
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
v(n);
|
|
582
|
-
}, [n]);
|
|
583
|
-
const A = (R) => {
|
|
584
|
-
const j = R.target.value.replace(/\D/g, "");
|
|
585
|
-
v(j), g && s && s("+" + g.phone + j);
|
|
586
|
-
}, B = (R) => {
|
|
587
|
-
y(R), s && s("+" + R.phone + b), N(!1), D("");
|
|
588
|
-
};
|
|
589
|
-
H(() => {
|
|
590
|
-
const R = (j) => {
|
|
591
|
-
C.current && !C.current.contains(j.target) && N(!1);
|
|
592
|
-
};
|
|
593
|
-
return document.addEventListener("mousedown", R), () => document.removeEventListener("mousedown", R);
|
|
594
|
-
}, []);
|
|
595
|
-
const F = xe.filter(
|
|
596
|
-
(R) => R.label.toLowerCase().includes(I.toLowerCase()) || R.phone.includes(I)
|
|
597
|
-
);
|
|
598
|
-
return u ? /* @__PURE__ */ e(E, { children: /* @__PURE__ */ d("div", { className: o || "col-span-12", children: [
|
|
599
|
-
/* @__PURE__ */ e(Q, { label: h, required: p }),
|
|
600
|
-
/* @__PURE__ */ d("div", { className: "relative ", ref: C, children: [
|
|
601
|
-
/* @__PURE__ */ d(
|
|
602
|
-
"div",
|
|
603
|
-
{
|
|
604
|
-
className: `h-[40px] flex items-center border rounded-md px-2 bg-white dark:bg-gray-700 transition-all
|
|
605
|
-
${x ? "ring-0.5 ring-blue-100 border-blue-300" : "border-gray-300 dark:border-gray-600"}
|
|
606
|
-
${t ? "opacity-60 cursor-not-allowed" : ""}`,
|
|
607
|
-
children: [
|
|
608
|
-
/* @__PURE__ */ d(
|
|
609
|
-
"button",
|
|
610
|
-
{
|
|
611
|
-
type: "button",
|
|
612
|
-
disabled: t,
|
|
613
|
-
onClick: () => N(!x),
|
|
614
|
-
className: "flex items-center gap-1 pr-2 border-r border-gray-300 dark:border-gray-700 focus:outline-none",
|
|
615
|
-
children: [
|
|
616
|
-
g ? /* @__PURE__ */ e(
|
|
617
|
-
"img",
|
|
618
|
-
{
|
|
619
|
-
src: `https://flagcdn.com/w20/${g.code.toLowerCase()}.png`,
|
|
620
|
-
alt: g.code,
|
|
621
|
-
className: "w-5 h-3 object-cover"
|
|
622
|
-
}
|
|
623
|
-
) : /* @__PURE__ */ e("span", { className: "text-gray-400 text-xs", children: "🌐" }),
|
|
624
|
-
/* @__PURE__ */ e(Te, { className: "w-3 h-3 text-gray-500" })
|
|
625
|
-
]
|
|
626
|
-
}
|
|
627
|
-
),
|
|
628
|
-
g && /* @__PURE__ */ d("span", { className: "ml-2 text-sm text-gray-700 dark:text-gray-200 whitespace-nowrap", children: [
|
|
629
|
-
"+",
|
|
630
|
-
g.phone
|
|
631
|
-
] }),
|
|
632
|
-
/* @__PURE__ */ e(
|
|
633
|
-
"input",
|
|
634
|
-
{
|
|
635
|
-
type: "tel",
|
|
636
|
-
value: b,
|
|
637
|
-
onChange: A,
|
|
638
|
-
required: p,
|
|
639
|
-
disabled: t || !g,
|
|
640
|
-
placeholder: g ? k : "Select a country",
|
|
641
|
-
className: "flex-1 ml-2 bg-transparent outline-none text-sm text-gray-800 dark:text-gray-100 placeholder-gray-400"
|
|
642
|
-
}
|
|
643
|
-
),
|
|
644
|
-
/* @__PURE__ */ e(
|
|
645
|
-
"input",
|
|
646
|
-
{
|
|
647
|
-
type: "tel",
|
|
648
|
-
required: p,
|
|
649
|
-
tabIndex: -1,
|
|
650
|
-
readOnly: !0,
|
|
651
|
-
value: g && b ? "+" + g.phone + b : "",
|
|
652
|
-
style: {
|
|
653
|
-
position: "absolute",
|
|
654
|
-
opacity: 0,
|
|
655
|
-
pointerEvents: "none",
|
|
656
|
-
height: 0
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
)
|
|
660
|
-
]
|
|
661
|
-
}
|
|
662
|
-
),
|
|
663
|
-
x && /* @__PURE__ */ d("div", { className: "absolute top-full left-0 w-full mt-1 border border-gray-300 dark:border-gray-700 rounded-md bg-white dark:bg-gray-700 shadow-lg z-50 max-h-60 overflow-y-auto", children: [
|
|
664
|
-
M && /* @__PURE__ */ e("div", { className: "p-2 border-b border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ d("div", { className: "relative", children: [
|
|
665
|
-
/* @__PURE__ */ e(Re, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400" }),
|
|
666
|
-
/* @__PURE__ */ e(
|
|
667
|
-
"input",
|
|
668
|
-
{
|
|
669
|
-
type: "text",
|
|
670
|
-
value: I,
|
|
671
|
-
onChange: (R) => D(R.target.value),
|
|
672
|
-
placeholder: "Search country...",
|
|
673
|
-
className: "w-full pl-9 pr-3 py-2 text-sm border rounded-md bg-white dark:bg-gray-800 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none "
|
|
674
|
-
}
|
|
675
|
-
)
|
|
676
|
-
] }) }),
|
|
677
|
-
F.map((R) => /* @__PURE__ */ d(
|
|
678
|
-
"button",
|
|
679
|
-
{
|
|
680
|
-
type: "button",
|
|
681
|
-
onClick: () => B(R),
|
|
682
|
-
className: "w-full flex items-center gap-2 px-2 py-1 text-sm hover:bg-blue-50 dark:hover:bg-gray-700 text-gray-800 dark:text-gray-100",
|
|
683
|
-
children: [
|
|
684
|
-
/* @__PURE__ */ e(
|
|
685
|
-
"img",
|
|
686
|
-
{
|
|
687
|
-
src: `https://flagcdn.com/w20/${R.code.toLowerCase()}.png`,
|
|
688
|
-
alt: R.code,
|
|
689
|
-
className: "w-5 h-3 object-cover"
|
|
690
|
-
}
|
|
691
|
-
),
|
|
692
|
-
/* @__PURE__ */ d("span", { children: [
|
|
693
|
-
R.label,
|
|
694
|
-
" (+",
|
|
695
|
-
R.phone,
|
|
696
|
-
")"
|
|
697
|
-
] })
|
|
698
|
-
]
|
|
699
|
-
},
|
|
700
|
-
R.code
|
|
701
|
-
))
|
|
702
|
-
] })
|
|
703
|
-
] })
|
|
704
|
-
] }, i) }) : /* @__PURE__ */ e(E, { children: /* @__PURE__ */ d("div", { className: o || "col-span-12", children: [
|
|
705
|
-
/* @__PURE__ */ e(Q, { label: h, required: p }),
|
|
706
|
-
/* @__PURE__ */ e(
|
|
707
|
-
"input",
|
|
708
|
-
{
|
|
709
|
-
type: "text",
|
|
710
|
-
value: n,
|
|
711
|
-
onChange: (j) => {
|
|
712
|
-
const $ = j.target.value.replace(/[^+\d]/g, ""), W = $.startsWith("+") ? "+" + $.replace(/[+]/g, "").slice(0) : $;
|
|
713
|
-
s(W);
|
|
714
|
-
},
|
|
715
|
-
placeholder: k,
|
|
716
|
-
disabled: t,
|
|
717
|
-
required: p,
|
|
718
|
-
className: `w-full h-10 px-3 text-sm border border-gray-300 dark:border-gray-600 rounded-md \r
|
|
719
|
-
bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:outline-none \r
|
|
720
|
-
focus:ring-1 focus:ring-blue-300 dark:focus:ring-blue-200`,
|
|
721
|
-
inputMode: "tel",
|
|
722
|
-
pattern: "^\\+\\d{1,15}$"
|
|
723
|
-
}
|
|
724
|
-
)
|
|
725
|
-
] }, i) });
|
|
726
|
-
}
|
|
727
|
-
const Ie = Ce.forwardRef(
|
|
728
|
-
({ className: h = "", label: n, required: i, ...o }, s) => {
|
|
729
|
-
const t = `
|
|
730
|
-
placeholder-gray-400 dark:placeholder-gray-400
|
|
731
|
-
${h}
|
|
732
|
-
`.trim();
|
|
733
|
-
return /* @__PURE__ */ e(E, { children: /* @__PURE__ */ d("div", { className: o.parentClass || "col-span-12", children: [
|
|
734
|
-
/* @__PURE__ */ e(Q, { label: n, required: i }),
|
|
735
|
-
/* @__PURE__ */ e("div", { className: "relative", children: /* @__PURE__ */ e(
|
|
736
|
-
"textarea",
|
|
737
|
-
{
|
|
738
|
-
className: t,
|
|
739
|
-
ref: s,
|
|
740
|
-
required: i,
|
|
741
|
-
...o
|
|
742
|
-
}
|
|
743
|
-
) })
|
|
744
|
-
] }, o.name) });
|
|
745
|
-
}
|
|
746
|
-
);
|
|
747
|
-
Ie.displayName = "TextArea";
|
|
748
|
-
const ta = ({
|
|
749
|
-
label: h = "",
|
|
750
|
-
value: n = null,
|
|
751
|
-
onChange: i,
|
|
752
|
-
required: o = !1,
|
|
753
|
-
accept: s = "image/*",
|
|
754
|
-
id: t,
|
|
755
|
-
dragDrop: p = !1,
|
|
756
|
-
name: k = "",
|
|
757
|
-
parentClass: M = ""
|
|
758
|
-
}) => {
|
|
759
|
-
const [u, l] = S(n), [c, g] = S(!1), y = ae(null);
|
|
760
|
-
H(() => (n instanceof File ? l({ file: n, preview: URL.createObjectURL(n) }) : (n != null && n.preview, l(n)), () => {
|
|
761
|
-
u != null && u.preview && u.preview.startsWith("blob:") && URL.revokeObjectURL(u.preview);
|
|
762
|
-
}), [n]);
|
|
763
|
-
const b = (C) => {
|
|
764
|
-
if (!C || C.length === 0)
|
|
765
|
-
return;
|
|
766
|
-
const A = C[0], B = URL.createObjectURL(A), F = { file: A, preview: B };
|
|
767
|
-
u != null && u.preview && u.preview.startsWith("blob:") && URL.revokeObjectURL(u.preview), l(F), i == null || i(A);
|
|
768
|
-
}, v = (C) => {
|
|
769
|
-
C && C.stopPropagation(), u != null && u.preview && u.preview.startsWith("blob:") && URL.revokeObjectURL(u.preview), l(null), i == null || i(null), y.current && (y.current.value = "");
|
|
770
|
-
}, x = (C) => {
|
|
771
|
-
p && (C.preventDefault(), g(!0));
|
|
772
|
-
}, N = (C) => {
|
|
773
|
-
p && (C.preventDefault(), g(!1));
|
|
774
|
-
}, I = (C) => {
|
|
775
|
-
p && (C.preventDefault(), g(!1), b(C.dataTransfer.files));
|
|
776
|
-
}, D = () => {
|
|
777
|
-
y.current.click();
|
|
778
|
-
};
|
|
779
|
-
return /* @__PURE__ */ e(E, { children: /* @__PURE__ */ d("div", { className: M || "col-span-12", children: [
|
|
780
|
-
/* @__PURE__ */ e(Q, { label: h, required: o }),
|
|
781
|
-
/* @__PURE__ */ d(
|
|
782
|
-
"div",
|
|
783
|
-
{
|
|
784
|
-
className: `relative rounded-md p-2 transition-all ${c ? "border-2 border-dashed border-blue-500 bg-blue-50 dark:bg-blue-900/20" : "border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800"}`,
|
|
785
|
-
onDragOver: x,
|
|
786
|
-
onDragLeave: N,
|
|
787
|
-
onDrop: I,
|
|
788
|
-
children: [
|
|
789
|
-
/* @__PURE__ */ e(
|
|
790
|
-
"input",
|
|
791
|
-
{
|
|
792
|
-
ref: y,
|
|
793
|
-
id: t,
|
|
794
|
-
type: "file",
|
|
795
|
-
accept: s,
|
|
796
|
-
onChange: (C) => b(C.target.files),
|
|
797
|
-
required: o && !u,
|
|
798
|
-
className: "absolute opacity-0 right-[50%] top-[80%] -translate-y-1/2 pointer-events-none h-[10px]"
|
|
799
|
-
}
|
|
800
|
-
),
|
|
801
|
-
/* @__PURE__ */ d(
|
|
802
|
-
"div",
|
|
803
|
-
{
|
|
804
|
-
className: `flex items-center space-x-4 transition-all ${c ? "opacity-50" : ""}`,
|
|
805
|
-
children: [
|
|
806
|
-
u ? (
|
|
807
|
-
// Image preview with close button
|
|
808
|
-
/* @__PURE__ */ d("div", { className: "relative group", children: [
|
|
809
|
-
/* @__PURE__ */ e(
|
|
810
|
-
"img",
|
|
811
|
-
{
|
|
812
|
-
src: u.preview || u,
|
|
813
|
-
alt: "preview",
|
|
814
|
-
className: "object-cover w-20 h-20 rounded-full shadow-md"
|
|
815
|
-
}
|
|
816
|
-
),
|
|
817
|
-
!o && /* @__PURE__ */ e(
|
|
818
|
-
"button",
|
|
819
|
-
{
|
|
820
|
-
type: "button",
|
|
821
|
-
onClick: v,
|
|
822
|
-
className: "absolute top-0 -right-2 bg-red-500 text-white rounded-full p-1 shadow-lg hover:bg-red-600 transition-colors focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2",
|
|
823
|
-
"aria-label": "Remove image",
|
|
824
|
-
children: /* @__PURE__ */ e(te, { icon: "mdi:close", className: "w-3 h-3" })
|
|
825
|
-
}
|
|
826
|
-
)
|
|
827
|
-
] })
|
|
828
|
-
) : (
|
|
829
|
-
// Placeholder icon
|
|
830
|
-
/* @__PURE__ */ e("div", { className: "rounded-full bg-gray-100 dark:bg-gray-700 h-20 w-20 flex items-center justify-center", children: /* @__PURE__ */ e(
|
|
831
|
-
te,
|
|
832
|
-
{
|
|
833
|
-
icon: "ri:image-add-fill",
|
|
834
|
-
className: "text-gray-400 w-10 h-10"
|
|
835
|
-
}
|
|
836
|
-
) })
|
|
837
|
-
),
|
|
838
|
-
/* @__PURE__ */ d("div", { className: "flex flex-col items-center space-y-1", children: [
|
|
839
|
-
/* @__PURE__ */ e(
|
|
840
|
-
ee,
|
|
841
|
-
{
|
|
842
|
-
type: "button",
|
|
843
|
-
onClick: D,
|
|
844
|
-
variant: "outlined",
|
|
845
|
-
color: "default",
|
|
846
|
-
children: u ? "Change Image" : "Select Image"
|
|
847
|
-
}
|
|
848
|
-
),
|
|
849
|
-
p && !u && /* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: "or drag and drop" })
|
|
850
|
-
] })
|
|
851
|
-
]
|
|
852
|
-
}
|
|
853
|
-
),
|
|
854
|
-
p && c && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none bg-blue-500/10 rounded-md", children: /* @__PURE__ */ e("span", { className: "text-blue-600 dark:text-blue-400 font-semibold text-lg", children: "Drop image here" }) })
|
|
855
|
-
]
|
|
856
|
-
}
|
|
857
|
-
)
|
|
858
|
-
] }, k) });
|
|
859
|
-
}, Be = Ce.forwardRef(
|
|
860
|
-
({
|
|
861
|
-
label: h,
|
|
862
|
-
required: n,
|
|
863
|
-
parentClass: i = "",
|
|
864
|
-
className: o = "",
|
|
865
|
-
type: s = "text",
|
|
866
|
-
onKeyDown: t,
|
|
867
|
-
negativeNumberAllow: p = !0,
|
|
868
|
-
...k
|
|
869
|
-
}, M) => {
|
|
870
|
-
const [u, l] = S(!1), c = (y) => {
|
|
871
|
-
if (s === "number") {
|
|
872
|
-
if (["e", "E", "+"].includes(y.key)) {
|
|
873
|
-
y.preventDefault();
|
|
874
|
-
return;
|
|
875
|
-
}
|
|
876
|
-
if (p == !1 && y.key === "-") {
|
|
877
|
-
y.preventDefault();
|
|
878
|
-
return;
|
|
879
|
-
}
|
|
880
|
-
if (["ArrowUp", "ArrowDown"].includes(y.key)) {
|
|
881
|
-
y.preventDefault();
|
|
882
|
-
return;
|
|
883
|
-
}
|
|
884
|
-
}
|
|
885
|
-
t == null || t(y);
|
|
886
|
-
}, g = `
|
|
887
|
-
h-10 placeholder-gray-400 dark:placeholder-gray-400
|
|
888
|
-
${s === "password" ? "pr-10" : ""}
|
|
889
|
-
${s === "number" ? "no-spinner" : ""}
|
|
890
|
-
${o}
|
|
891
|
-
`.trim();
|
|
892
|
-
return /* @__PURE__ */ e(E, { children: /* @__PURE__ */ d("div", { className: i || "col-span-12", children: [
|
|
893
|
-
/* @__PURE__ */ e(Q, { label: h, required: n }),
|
|
894
|
-
/* @__PURE__ */ d("div", { className: "relative", children: [
|
|
895
|
-
/* @__PURE__ */ e(
|
|
896
|
-
"input",
|
|
897
|
-
{
|
|
898
|
-
type: s === "password" && u ? "text" : s,
|
|
899
|
-
ref: M,
|
|
900
|
-
required: n,
|
|
901
|
-
onKeyDown: c,
|
|
902
|
-
className: g,
|
|
903
|
-
...k
|
|
904
|
-
}
|
|
905
|
-
),
|
|
906
|
-
s === "password" && /* @__PURE__ */ e(
|
|
907
|
-
"button",
|
|
908
|
-
{
|
|
909
|
-
type: "button",
|
|
910
|
-
tabIndex: -1,
|
|
911
|
-
onClick: () => l((y) => !y),
|
|
912
|
-
className: "absolute inset-y-0 right-3 flex items-center text-gray-400 hover:text-gray-600 dark:text-gray-400 dark:hover:text-gray-200",
|
|
913
|
-
children: /* @__PURE__ */ e(
|
|
914
|
-
te,
|
|
915
|
-
{
|
|
916
|
-
icon: u ? "mdi:eye-outline" : "mdi:eye-off-outline",
|
|
917
|
-
className: "w-5 h-5"
|
|
918
|
-
}
|
|
919
|
-
)
|
|
920
|
-
}
|
|
921
|
-
)
|
|
922
|
-
] })
|
|
923
|
-
] }, k.name) });
|
|
924
|
-
}
|
|
925
|
-
);
|
|
926
|
-
Be.displayName = "Input";
|
|
927
|
-
const na = ({
|
|
928
|
-
key: h,
|
|
929
|
-
editorKey: n = "",
|
|
930
|
-
value: i = "",
|
|
931
|
-
onChange: o,
|
|
932
|
-
label: s = "",
|
|
933
|
-
required: t = !1,
|
|
934
|
-
placeholder: p = "",
|
|
935
|
-
parentClass: k = "col-span-12",
|
|
936
|
-
height: M = 400,
|
|
937
|
-
inline: u = !1,
|
|
938
|
-
disabled: l = !1,
|
|
939
|
-
plugins: c,
|
|
940
|
-
toolbar: g,
|
|
941
|
-
menubar: y = !1,
|
|
942
|
-
fontFamily: b = "Inter, sans-serif",
|
|
943
|
-
initConfig: v = {},
|
|
944
|
-
imageUploadHandler: x
|
|
945
|
-
// ✅ Promise function passed from parent
|
|
946
|
-
}) => /* @__PURE__ */ d("div", { className: k, children: [
|
|
947
|
-
s && /* @__PURE__ */ e(Q, { label: s, required: t }),
|
|
948
|
-
/* @__PURE__ */ e(
|
|
949
|
-
Je,
|
|
950
|
-
{
|
|
951
|
-
apiKey: n,
|
|
952
|
-
value: i,
|
|
953
|
-
disabled: l,
|
|
954
|
-
init: {
|
|
955
|
-
height: M,
|
|
956
|
-
inline: u,
|
|
957
|
-
menubar: y,
|
|
958
|
-
branding: !1,
|
|
959
|
-
statusbar: !0,
|
|
960
|
-
automatic_uploads: !0,
|
|
961
|
-
images_upload_handler: (C) => new Promise((A, B) => {
|
|
962
|
-
if (!x) {
|
|
963
|
-
A(`data:${C.blob().type};base64,${C.base64()}`);
|
|
964
|
-
return;
|
|
965
|
-
}
|
|
966
|
-
x(C).then((F) => {
|
|
967
|
-
F ? A(F) : B("Upload failed: No URL returned");
|
|
968
|
-
}).catch((F) => {
|
|
969
|
-
B(
|
|
970
|
-
typeof F == "string" ? F : (F == null ? void 0 : F.message) || "Image upload failed"
|
|
971
|
-
);
|
|
972
|
-
});
|
|
973
|
-
}),
|
|
974
|
-
plugins: c ?? [
|
|
975
|
-
"advlist",
|
|
976
|
-
"autolink",
|
|
977
|
-
"lists",
|
|
978
|
-
"link",
|
|
979
|
-
"image",
|
|
980
|
-
"charmap",
|
|
981
|
-
"preview",
|
|
982
|
-
"anchor",
|
|
983
|
-
"searchreplace",
|
|
984
|
-
"visualblocks",
|
|
985
|
-
"code",
|
|
986
|
-
"fullscreen",
|
|
987
|
-
"insertdatetime",
|
|
988
|
-
"media",
|
|
989
|
-
"table",
|
|
990
|
-
"help",
|
|
991
|
-
"wordcount"
|
|
992
|
-
],
|
|
993
|
-
toolbar: g ?? "undo redo | blocks | bold italic underline forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image media table | removeformat | code fullscreen preview",
|
|
994
|
-
placeholder: p,
|
|
995
|
-
content_style: `
|
|
996
|
-
body {
|
|
997
|
-
font-family: ${b};
|
|
998
|
-
}
|
|
999
|
-
`,
|
|
1000
|
-
...v
|
|
1001
|
-
},
|
|
1002
|
-
onEditorChange: (C) => {
|
|
1003
|
-
o && o(C);
|
|
1004
|
-
}
|
|
1005
|
-
}
|
|
1006
|
-
)
|
|
1007
|
-
] }, h), la = ({
|
|
1008
|
-
name: h = "",
|
|
1009
|
-
label: n = "",
|
|
1010
|
-
// label for single checkbox
|
|
1011
|
-
options: i = [],
|
|
1012
|
-
// array of { label, value } for multiple
|
|
1013
|
-
value: o = null,
|
|
1014
|
-
// boolean for single, array for multiple, or string for single select
|
|
1015
|
-
onChange: s,
|
|
1016
|
-
disabled: t = !1,
|
|
1017
|
-
required: p = !1,
|
|
1018
|
-
parentClass: k = "col-span-12",
|
|
1019
|
-
className: M = "",
|
|
1020
|
-
multiSelect: u = !1
|
|
1021
|
-
// ✅ if true, only one option can be selected (like radio)
|
|
1022
|
-
}) => {
|
|
1023
|
-
const l = Array.isArray(i) && i.length > 0, c = (b) => l ? u ? Array.isArray(o) && o.includes(b) : o === b : !!o, g = (b) => {
|
|
1024
|
-
s == null || s(b.target.checked, h);
|
|
1025
|
-
}, y = (b, v) => {
|
|
1026
|
-
if (s)
|
|
1027
|
-
if (!u)
|
|
1028
|
-
s(v ? b : "", h);
|
|
1029
|
-
else {
|
|
1030
|
-
const x = Array.isArray(o) ? [...o] : [];
|
|
1031
|
-
if (v)
|
|
1032
|
-
x.includes(b) || x.push(b);
|
|
1033
|
-
else {
|
|
1034
|
-
const N = x.indexOf(b);
|
|
1035
|
-
N > -1 && x.splice(N, 1);
|
|
1036
|
-
}
|
|
1037
|
-
s(x, h);
|
|
1038
|
-
}
|
|
1039
|
-
};
|
|
1040
|
-
return l ? /* @__PURE__ */ e(E, { children: /* @__PURE__ */ d("div", { className: `${k}`, children: [
|
|
1041
|
-
/* @__PURE__ */ e(Q, { label: n, required: p }),
|
|
1042
|
-
/* @__PURE__ */ e("div", { className: "flex flex-col space-y-2", children: i.map((b, v) => /* @__PURE__ */ d("div", { className: "flex items-center", children: [
|
|
1043
|
-
/* @__PURE__ */ e(
|
|
1044
|
-
"input",
|
|
1045
|
-
{
|
|
1046
|
-
type: "checkbox",
|
|
1047
|
-
name: h,
|
|
1048
|
-
value: b.value,
|
|
1049
|
-
checked: c(b.value),
|
|
1050
|
-
disabled: t || b.disabled,
|
|
1051
|
-
required: p && v === 0,
|
|
1052
|
-
onChange: (x) => y(b.value, x.target.checked),
|
|
1053
|
-
className: `h-4 w-4 cursor-pointer text-blue-600 border-gray-300 rounded focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 ${M}`
|
|
1054
|
-
},
|
|
1055
|
-
h
|
|
1056
|
-
),
|
|
1057
|
-
b.label && /* @__PURE__ */ e(
|
|
1058
|
-
"label",
|
|
1059
|
-
{
|
|
1060
|
-
htmlFor: h,
|
|
1061
|
-
className: "ml-2 text-sm text-gray-700 dark:text-gray-200 select-none",
|
|
1062
|
-
children: b.label
|
|
1063
|
-
}
|
|
1064
|
-
)
|
|
1065
|
-
] }, b.value || b.label)) })
|
|
1066
|
-
] }) }) : /* @__PURE__ */ d("div", { className: `flex items-center ${k}`, children: [
|
|
1067
|
-
/* @__PURE__ */ e(
|
|
1068
|
-
"input",
|
|
1069
|
-
{
|
|
1070
|
-
type: "checkbox",
|
|
1071
|
-
name: h,
|
|
1072
|
-
checked: c(),
|
|
1073
|
-
disabled: t,
|
|
1074
|
-
required: p,
|
|
1075
|
-
onChange: g,
|
|
1076
|
-
className: `h-4 w-4 text-blue-600 cursor-pointer border-gray-300 rounded focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 ${M}`
|
|
1077
|
-
}
|
|
1078
|
-
),
|
|
1079
|
-
n && /* @__PURE__ */ e(
|
|
1080
|
-
"label",
|
|
1081
|
-
{
|
|
1082
|
-
htmlFor: h,
|
|
1083
|
-
className: "ml-2 text-sm text-gray-700 dark:text-gray-200 select-none",
|
|
1084
|
-
children: n
|
|
1085
|
-
}
|
|
1086
|
-
)
|
|
1087
|
-
] });
|
|
1088
|
-
}, oa = ({
|
|
1089
|
-
label: h = "",
|
|
1090
|
-
value: n = null,
|
|
1091
|
-
onChange: i,
|
|
1092
|
-
required: o = !1,
|
|
1093
|
-
accept: s = "audio/*",
|
|
1094
|
-
id: t,
|
|
1095
|
-
dragDrop: p = !1,
|
|
1096
|
-
name: k = "",
|
|
1097
|
-
parentClass: M = ""
|
|
1098
|
-
}) => {
|
|
1099
|
-
const [u, l] = S(null), [c, g] = S(!1), y = ae(null);
|
|
1100
|
-
H(() => {
|
|
1101
|
-
if (!n) {
|
|
1102
|
-
b(), l(null);
|
|
1103
|
-
return;
|
|
1104
|
-
}
|
|
1105
|
-
if (n instanceof File) {
|
|
1106
|
-
const A = URL.createObjectURL(n);
|
|
1107
|
-
return l({ file: n, preview: A }), () => {
|
|
1108
|
-
URL.revokeObjectURL(A);
|
|
1109
|
-
};
|
|
1110
|
-
} else typeof n == "string" ? l({ preview: n }) : n != null && n.preview && l(n);
|
|
1111
|
-
}, [n]);
|
|
1112
|
-
const b = () => {
|
|
1113
|
-
u != null && u.preview && u.preview.startsWith("blob:") && URL.revokeObjectURL(u.preview);
|
|
1114
|
-
}, v = (A) => {
|
|
1115
|
-
if (!A || A.length === 0)
|
|
1116
|
-
return;
|
|
1117
|
-
const B = A[0], F = URL.createObjectURL(B);
|
|
1118
|
-
b(), l({ file: B, preview: F }), i == null || i(B);
|
|
1119
|
-
}, x = (A) => {
|
|
1120
|
-
A && A.stopPropagation(), b(), l(null), i == null || i(null), y.current && (y.current.value = "");
|
|
1121
|
-
}, N = (A) => {
|
|
1122
|
-
p && (A.preventDefault(), g(!0));
|
|
1123
|
-
}, I = (A) => {
|
|
1124
|
-
p && (A.preventDefault(), g(!1));
|
|
1125
|
-
}, D = (A) => {
|
|
1126
|
-
p && (A.preventDefault(), g(!1), v(A.dataTransfer.files));
|
|
1127
|
-
}, C = () => {
|
|
1128
|
-
y.current.click();
|
|
1129
|
-
};
|
|
1130
|
-
return /* @__PURE__ */ d("div", { className: M || "col-span-12", children: [
|
|
1131
|
-
/* @__PURE__ */ e(Q, { label: h, required: o }),
|
|
1132
|
-
/* @__PURE__ */ d(
|
|
1133
|
-
"div",
|
|
1134
|
-
{
|
|
1135
|
-
className: `relative rounded-lg p-2 transition-all ${c ? "border-2 border-dashed border-blue-500 bg-blue-50 dark:bg-blue-900/20" : "border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800"}`,
|
|
1136
|
-
onDragOver: N,
|
|
1137
|
-
onDragLeave: I,
|
|
1138
|
-
onDrop: D,
|
|
1139
|
-
children: [
|
|
1140
|
-
/* @__PURE__ */ e(
|
|
1141
|
-
"input",
|
|
1142
|
-
{
|
|
1143
|
-
ref: y,
|
|
1144
|
-
id: t,
|
|
1145
|
-
type: "file",
|
|
1146
|
-
accept: s,
|
|
1147
|
-
onChange: (A) => v(A.target.files),
|
|
1148
|
-
required: o && !u,
|
|
1149
|
-
className: "absolute opacity-0 right-[50%] top-[80%] -translate-y-1/2 pointer-events-none h-[10px]"
|
|
1150
|
-
}
|
|
1151
|
-
),
|
|
1152
|
-
/* @__PURE__ */ e(
|
|
1153
|
-
"div",
|
|
1154
|
-
{
|
|
1155
|
-
className: `flex items-center space-x-4 transition-all ${c ? "opacity-50" : ""}`,
|
|
1156
|
-
children: u ? (
|
|
1157
|
-
// Audio player with close button and change button
|
|
1158
|
-
/* @__PURE__ */ d("div", { className: "flex items-center space-x-4", children: [
|
|
1159
|
-
/* @__PURE__ */ d("div", { className: "relative w-full", children: [
|
|
1160
|
-
!o && /* @__PURE__ */ e(
|
|
1161
|
-
"button",
|
|
1162
|
-
{
|
|
1163
|
-
type: "button",
|
|
1164
|
-
onClick: x,
|
|
1165
|
-
className: "absolute top-0 -right-2 bg-red-500 text-white rounded-full p-1 shadow-lg hover:bg-red-600 transition-colors z-10 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 dark:focus:ring-offset-gray-800",
|
|
1166
|
-
"aria-label": "Remove audio",
|
|
1167
|
-
children: /* @__PURE__ */ e(te, { icon: "mdi:close", className: "w-3 h-3" })
|
|
1168
|
-
}
|
|
1169
|
-
),
|
|
1170
|
-
/* @__PURE__ */ e(
|
|
1171
|
-
"audio",
|
|
1172
|
-
{
|
|
1173
|
-
src: u.preview,
|
|
1174
|
-
controls: !0,
|
|
1175
|
-
controlsList: "nodownload"
|
|
1176
|
-
},
|
|
1177
|
-
u.preview
|
|
1178
|
-
)
|
|
1179
|
-
] }),
|
|
1180
|
-
/* @__PURE__ */ e(ee, { type: "button", onClick: C, children: /* @__PURE__ */ e("span", { children: "Change Audio File" }) })
|
|
1181
|
-
] })
|
|
1182
|
-
) : (
|
|
1183
|
-
// Empty state with upload button
|
|
1184
|
-
/* @__PURE__ */ d("div", { className: "flex items-center justify-center space-x-4", children: [
|
|
1185
|
-
/* @__PURE__ */ e("div", { className: "rounded-full bg-gray-100 dark:bg-gray-700 h-20 w-20 flex items-center justify-center", children: /* @__PURE__ */ e(te, { icon: "mdi:music", className: "text-gray-400 w-10 h-10" }) }),
|
|
1186
|
-
/* @__PURE__ */ e(
|
|
1187
|
-
ee,
|
|
1188
|
-
{
|
|
1189
|
-
type: "button",
|
|
1190
|
-
onClick: C,
|
|
1191
|
-
variant: "outlined",
|
|
1192
|
-
children: /* @__PURE__ */ e("span", { children: "Choose Audio File" })
|
|
1193
|
-
}
|
|
1194
|
-
),
|
|
1195
|
-
p && /* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: "or drag and drop your audio file here" })
|
|
1196
|
-
] })
|
|
1197
|
-
)
|
|
1198
|
-
}
|
|
1199
|
-
),
|
|
1200
|
-
p && c && !u && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none bg-blue-500/10 rounded-lg", children: /* @__PURE__ */ e("span", { className: "text-blue-600 dark:text-blue-400 font-semibold text-lg bg-white dark:bg-gray-800 px-4 py-2 rounded-lg shadow-lg", children: "Drop audio here" }) })
|
|
1201
|
-
]
|
|
1202
|
-
}
|
|
1203
|
-
)
|
|
1204
|
-
] }, k);
|
|
1205
|
-
}, Ue = ({ field: h, formData: n, handleChange: i }) => {
|
|
1206
|
-
const {
|
|
1207
|
-
key: o,
|
|
1208
|
-
label: s,
|
|
1209
|
-
type: t,
|
|
1210
|
-
options: p,
|
|
1211
|
-
placeholder: k,
|
|
1212
|
-
rows: M,
|
|
1213
|
-
inputClass: u,
|
|
1214
|
-
search: l,
|
|
1215
|
-
accept: c,
|
|
1216
|
-
text: g,
|
|
1217
|
-
required: y = !1,
|
|
1218
|
-
minLength: b,
|
|
1219
|
-
dragDrop: v,
|
|
1220
|
-
parentClass: x,
|
|
1221
|
-
countriesList: N,
|
|
1222
|
-
defaultCountry: I,
|
|
1223
|
-
multiple: D,
|
|
1224
|
-
dropdownMaxHeight: C,
|
|
1225
|
-
editorKey: A,
|
|
1226
|
-
fontFamily: B,
|
|
1227
|
-
disabled: F,
|
|
1228
|
-
negativeNumberAllow: R,
|
|
1229
|
-
defaultValue: j,
|
|
1230
|
-
renderCondition: $,
|
|
1231
|
-
optionDependencyKey: W
|
|
1232
|
-
} = h;
|
|
1233
|
-
let G = n == null ? void 0 : n[o];
|
|
1234
|
-
G == null && (G = "");
|
|
1235
|
-
const K = k || (t === "select" ? `Select ${s}` : `Enter ${s}`), U = "w-full px-3 py-2 rounded-md border border-gray-300 dark:border-gray-600 text-sm focus:outline-none focus:ring-1 focus:ring-blue-200 bg-white text-black dark:bg-gray-700 dark:text-white";
|
|
1236
|
-
if ($ && typeof $ == "function" && !$(n))
|
|
1237
|
-
return null;
|
|
1238
|
-
switch (t) {
|
|
1239
|
-
case "select":
|
|
1240
|
-
return /* @__PURE__ */ e(
|
|
1241
|
-
ea,
|
|
1242
|
-
{
|
|
1243
|
-
options: p || [],
|
|
1244
|
-
value: G,
|
|
1245
|
-
formData: n,
|
|
1246
|
-
dependencyKey: W,
|
|
1247
|
-
onChange: (O) => i(o, O),
|
|
1248
|
-
placeholder: K,
|
|
1249
|
-
className: u || "",
|
|
1250
|
-
search: l,
|
|
1251
|
-
required: y,
|
|
1252
|
-
defaultValue: j,
|
|
1253
|
-
label: s,
|
|
1254
|
-
name: o,
|
|
1255
|
-
disabled: F,
|
|
1256
|
-
parentClass: x,
|
|
1257
|
-
multiple: D,
|
|
1258
|
-
dropdownMaxHeight: C
|
|
1259
|
-
}
|
|
1260
|
-
);
|
|
1261
|
-
case "checkbox":
|
|
1262
|
-
return /* @__PURE__ */ e(
|
|
1263
|
-
la,
|
|
1264
|
-
{
|
|
1265
|
-
name: o,
|
|
1266
|
-
label: s,
|
|
1267
|
-
options: p || [],
|
|
1268
|
-
value: G,
|
|
1269
|
-
onChange: (O) => i(o, O),
|
|
1270
|
-
required: y,
|
|
1271
|
-
parentClass: x,
|
|
1272
|
-
className: u || "",
|
|
1273
|
-
multiSelect: D,
|
|
1274
|
-
disabled: F
|
|
1275
|
-
}
|
|
1276
|
-
);
|
|
1277
|
-
case "switch":
|
|
1278
|
-
return /* @__PURE__ */ e(
|
|
1279
|
-
aa,
|
|
1280
|
-
{
|
|
1281
|
-
value: G,
|
|
1282
|
-
onChange: (O) => i(o, O),
|
|
1283
|
-
text: g,
|
|
1284
|
-
options: p || [],
|
|
1285
|
-
label: s,
|
|
1286
|
-
required: y,
|
|
1287
|
-
name: o,
|
|
1288
|
-
disabled: F,
|
|
1289
|
-
parentClass: x
|
|
1290
|
-
}
|
|
1291
|
-
);
|
|
1292
|
-
case "phone":
|
|
1293
|
-
return /* @__PURE__ */ e(
|
|
1294
|
-
ra,
|
|
1295
|
-
{
|
|
1296
|
-
value: G,
|
|
1297
|
-
onChange: (O) => i(o, O),
|
|
1298
|
-
countriesList: N,
|
|
1299
|
-
defaultCountry: I,
|
|
1300
|
-
required: y,
|
|
1301
|
-
placeholder: K,
|
|
1302
|
-
search: l,
|
|
1303
|
-
label: s,
|
|
1304
|
-
name: o,
|
|
1305
|
-
disabled: F,
|
|
1306
|
-
parentClass: x
|
|
1307
|
-
}
|
|
1308
|
-
);
|
|
1309
|
-
case "textarea":
|
|
1310
|
-
return /* @__PURE__ */ e(
|
|
1311
|
-
Ie,
|
|
1312
|
-
{
|
|
1313
|
-
value: G,
|
|
1314
|
-
onChange: (O) => i(o, O.target.value),
|
|
1315
|
-
placeholder: K,
|
|
1316
|
-
rows: M || 3,
|
|
1317
|
-
className: `${U} ${u || ""}`,
|
|
1318
|
-
required: y,
|
|
1319
|
-
name: o,
|
|
1320
|
-
label: s,
|
|
1321
|
-
disabled: F,
|
|
1322
|
-
parentClass: x
|
|
1323
|
-
}
|
|
1324
|
-
);
|
|
1325
|
-
case "image":
|
|
1326
|
-
return /* @__PURE__ */ e(
|
|
1327
|
-
ta,
|
|
1328
|
-
{
|
|
1329
|
-
value: G,
|
|
1330
|
-
onChange: (O) => i(o, O),
|
|
1331
|
-
required: y,
|
|
1332
|
-
accept: c || "image/*",
|
|
1333
|
-
id: `file-${o}`,
|
|
1334
|
-
dragDrop: v,
|
|
1335
|
-
label: s,
|
|
1336
|
-
name: o,
|
|
1337
|
-
parentClass: x
|
|
1338
|
-
}
|
|
1339
|
-
);
|
|
1340
|
-
case "audio":
|
|
1341
|
-
return /* @__PURE__ */ e(
|
|
1342
|
-
oa,
|
|
1343
|
-
{
|
|
1344
|
-
value: G,
|
|
1345
|
-
onChange: (O) => i(o, O),
|
|
1346
|
-
required: y,
|
|
1347
|
-
accept: c || "audio/*",
|
|
1348
|
-
id: `file-${o}`,
|
|
1349
|
-
dragDrop: v,
|
|
1350
|
-
label: s,
|
|
1351
|
-
name: o,
|
|
1352
|
-
parentClass: x
|
|
1353
|
-
}
|
|
1354
|
-
);
|
|
1355
|
-
case "tinyEditor":
|
|
1356
|
-
return /* @__PURE__ */ e(
|
|
1357
|
-
na,
|
|
1358
|
-
{
|
|
1359
|
-
value: G,
|
|
1360
|
-
onChange: (O) => i(o, O),
|
|
1361
|
-
required: y,
|
|
1362
|
-
placeholder: K,
|
|
1363
|
-
label: s,
|
|
1364
|
-
parentClass: x,
|
|
1365
|
-
fontFamily: B,
|
|
1366
|
-
editorKey: A,
|
|
1367
|
-
disabled: F
|
|
1368
|
-
},
|
|
1369
|
-
`editor-${o}`
|
|
1370
|
-
);
|
|
1371
|
-
default:
|
|
1372
|
-
return /* @__PURE__ */ e(
|
|
1373
|
-
Be,
|
|
1374
|
-
{
|
|
1375
|
-
type: t || "text",
|
|
1376
|
-
value: G,
|
|
1377
|
-
onChange: (O) => i(o, O.target.value),
|
|
1378
|
-
placeholder: K,
|
|
1379
|
-
className: `${U} ${u || ""}`,
|
|
1380
|
-
required: y,
|
|
1381
|
-
name: o,
|
|
1382
|
-
minLength: b,
|
|
1383
|
-
label: s,
|
|
1384
|
-
negativeNumberAllow: R,
|
|
1385
|
-
parentClass: x,
|
|
1386
|
-
disabled: F
|
|
1387
|
-
}
|
|
1388
|
-
);
|
|
1389
|
-
}
|
|
1390
|
-
}, ia = ({ isOpen: h, onClose: n, config: i, onApply: o }) => {
|
|
1391
|
-
var u;
|
|
1392
|
-
const [s, t] = S({}), p = (l, c) => {
|
|
1393
|
-
t((g) => ({ ...g, [l]: c }));
|
|
1394
|
-
}, k = () => {
|
|
1395
|
-
o == null || o(s), n();
|
|
1396
|
-
}, M = () => {
|
|
1397
|
-
t({}), o == null || o({}), n();
|
|
1398
|
-
};
|
|
1399
|
-
return /* @__PURE__ */ d(E, { children: [
|
|
1400
|
-
/* @__PURE__ */ e(
|
|
1401
|
-
"div",
|
|
1402
|
-
{
|
|
1403
|
-
className: `fixed inset-0 bg-black/50 z-40 transition-opacity duration-300 ${h ? "opacity-100 pointer-events-auto" : "opacity-0 pointer-events-none"}`,
|
|
1404
|
-
onClick: n
|
|
1405
|
-
}
|
|
1406
|
-
),
|
|
1407
|
-
/* @__PURE__ */ d(
|
|
1408
|
-
"div",
|
|
1409
|
-
{
|
|
1410
|
-
className: `fixed top-0 right-0 h-full w-[28rem] bg-white dark:bg-gray-900 shadow-2xl z-50 flex flex-col border-l border-gray-200 dark:border-gray-700
|
|
1411
|
-
transform transition-transform duration-300 ease-in-out
|
|
1412
|
-
${h ? "translate-x-0" : "translate-x-full"}
|
|
1413
|
-
`,
|
|
1414
|
-
children: [
|
|
1415
|
-
/* @__PURE__ */ d("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-700", children: [
|
|
1416
|
-
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: "Filters" }),
|
|
1417
|
-
/* @__PURE__ */ e(
|
|
1418
|
-
"button",
|
|
1419
|
-
{
|
|
1420
|
-
onClick: n,
|
|
1421
|
-
className: "p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-md transition",
|
|
1422
|
-
children: /* @__PURE__ */ e(we, { className: "w-5 h-5 text-gray-500 dark:text-gray-400" })
|
|
1423
|
-
}
|
|
1424
|
-
)
|
|
1425
|
-
] }),
|
|
1426
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto px-4 py-3", children: i != null && i.component ? /* @__PURE__ */ e(i.component, { filters: s, onFilterChange: p }) : /* @__PURE__ */ e("div", { className: "space-y-4", children: (u = i == null ? void 0 : i.fields) == null ? void 0 : u.map((l) => /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(
|
|
1427
|
-
Ue,
|
|
1428
|
-
{
|
|
1429
|
-
field: l,
|
|
1430
|
-
formData: s,
|
|
1431
|
-
handleChange: p
|
|
1432
|
-
},
|
|
1433
|
-
l.key
|
|
1434
|
-
) })) }) }),
|
|
1435
|
-
/* @__PURE__ */ d("div", { className: "flex gap-2 px-4 py-3 border-t border-gray-200 dark:border-gray-700", children: [
|
|
1436
|
-
/* @__PURE__ */ e(
|
|
1437
|
-
ee,
|
|
1438
|
-
{
|
|
1439
|
-
onClick: k,
|
|
1440
|
-
variant: "contained",
|
|
1441
|
-
color: "primary",
|
|
1442
|
-
fullWidth: !0,
|
|
1443
|
-
children: "Apply Filters"
|
|
1444
|
-
}
|
|
1445
|
-
),
|
|
1446
|
-
/* @__PURE__ */ e(
|
|
1447
|
-
ee,
|
|
1448
|
-
{
|
|
1449
|
-
onClick: M,
|
|
1450
|
-
variant: "contained",
|
|
1451
|
-
className: "min-w-[150px]",
|
|
1452
|
-
children: "Reset"
|
|
1453
|
-
}
|
|
1454
|
-
)
|
|
1455
|
-
] })
|
|
1456
|
-
]
|
|
1457
|
-
}
|
|
1458
|
-
)
|
|
1459
|
-
] });
|
|
1460
|
-
}, Oe = {
|
|
1461
|
-
blue: {
|
|
1462
|
-
bg: "bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",
|
|
1463
|
-
border: "border border-blue-300 text-blue-700 dark:border-blue-700 dark:text-blue-300"
|
|
1464
|
-
},
|
|
1465
|
-
teal: {
|
|
1466
|
-
bg: "bg-teal-100 text-teal-800 dark:bg-teal-900/30 dark:text-teal-300",
|
|
1467
|
-
border: "border border-teal-300 text-teal-700 dark:border-teal-700 dark:text-teal-300"
|
|
1468
|
-
},
|
|
1469
|
-
purple: {
|
|
1470
|
-
bg: "bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300",
|
|
1471
|
-
border: "border border-purple-300 text-purple-700 dark:border-purple-700 dark:text-purple-300"
|
|
1472
|
-
},
|
|
1473
|
-
yellow: {
|
|
1474
|
-
bg: "bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-300",
|
|
1475
|
-
border: "border border-yellow-300 text-yellow-700 dark:border-yellow-700 dark:text-yellow-300"
|
|
1476
|
-
},
|
|
1477
|
-
green: {
|
|
1478
|
-
bg: "bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300",
|
|
1479
|
-
border: "border border-green-300 text-green-700 dark:border-green-700 dark:text-green-300"
|
|
1480
|
-
},
|
|
1481
|
-
red: {
|
|
1482
|
-
bg: "bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300",
|
|
1483
|
-
border: "border border-red-300 text-red-700 dark:border-red-700 dark:text-red-300"
|
|
1484
|
-
},
|
|
1485
|
-
gray: {
|
|
1486
|
-
bg: "bg-gray-100 text-gray-800 dark:bg-gray-900/30 dark:text-gray-300",
|
|
1487
|
-
border: "border border-gray-300 text-gray-700 dark:border-gray-700 dark:text-gray-300"
|
|
1488
|
-
}
|
|
1489
|
-
}, Ae = {
|
|
1490
|
-
contained: "bg",
|
|
1491
|
-
outline: "border !bg-transparent",
|
|
1492
|
-
soft: "bg opacity-90"
|
|
1493
|
-
}, je = ({
|
|
1494
|
-
label: h,
|
|
1495
|
-
variant: n = "contained",
|
|
1496
|
-
// contained | outline | soft
|
|
1497
|
-
color: i = "green",
|
|
1498
|
-
className: o = ""
|
|
1499
|
-
}) => {
|
|
1500
|
-
const s = Oe[i] || Oe.green, t = Ae[n] || Ae.contained, p = n === "outline" ? s.border : s.bg;
|
|
1501
|
-
return /* @__PURE__ */ e(
|
|
1502
|
-
"span",
|
|
1503
|
-
{
|
|
1504
|
-
className: `inline-flex justify-center items-center rounded-sm text-xs font-semibold px-3 py-1 min-w-[78px]
|
|
1505
|
-
${p}
|
|
1506
|
-
${t}
|
|
1507
|
-
${o}`,
|
|
1508
|
-
children: h
|
|
1509
|
-
}
|
|
1510
|
-
);
|
|
1511
|
-
}, sa = ({ rows: h = 5, columns: n = 5 }) => /* @__PURE__ */ d(E, { children: [
|
|
1512
|
-
/* @__PURE__ */ e("div", { className: "w-full mb-6 inline-flex justify-end items-center", children: /* @__PURE__ */ e("div", { className: "h-8 w-80 bg-gray-300 dark:bg-gray-700 rounded animate-pulse" }) }),
|
|
1513
|
-
/* @__PURE__ */ e("div", { className: "overflow-hidden rounded-md border border-gray-200 dark:border-gray-800", children: /* @__PURE__ */ d("table", { className: "w-full border-collapse", children: [
|
|
1514
|
-
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { className: "bg-gray-50 dark:bg-gray-900", children: Array.from({ length: n }).map((i, o) => /* @__PURE__ */ e("th", { className: "px-4 py-3", children: /* @__PURE__ */ e("div", { className: "h-6 w-24 bg-gray-300 dark:bg-gray-700 rounded animate-pulse inline-flex justify-center items-center" }) }, o)) }) }),
|
|
1515
|
-
/* @__PURE__ */ e("tbody", { children: Array.from({ length: h }).map((i, o) => /* @__PURE__ */ e(
|
|
1516
|
-
"tr",
|
|
1517
|
-
{
|
|
1518
|
-
className: "border-t border-gray-200 dark:border-gray-800",
|
|
1519
|
-
children: Array.from({ length: n }).map((s, t) => /* @__PURE__ */ e("td", { className: "px-4 py-6", children: /* @__PURE__ */ e("div", { className: "h-6 w-full bg-gray-300 dark:bg-gray-700 rounded animate-pulse" }) }, t))
|
|
1520
|
-
},
|
|
1521
|
-
o
|
|
1522
|
-
)) })
|
|
1523
|
-
] }) })
|
|
1524
|
-
] }), Ee = ({ src: h, alt: n = "preview", isOpen: i, setIsOpen: o }) => {
|
|
1525
|
-
const s = () => o(!1);
|
|
1526
|
-
return H(() => {
|
|
1527
|
-
const t = (p) => {
|
|
1528
|
-
p.key === "Escape" && s();
|
|
1529
|
-
};
|
|
1530
|
-
return i && (document.body.style.overflow = "hidden", document.addEventListener("keydown", t)), () => {
|
|
1531
|
-
document.body.style.overflow = "", document.removeEventListener("keydown", t);
|
|
1532
|
-
};
|
|
1533
|
-
}, [i]), /* @__PURE__ */ e(E, { children: /* @__PURE__ */ d(
|
|
1534
|
-
"div",
|
|
1535
|
-
{
|
|
1536
|
-
className: `fixed inset-0 z-50 flex items-center justify-center bg-black/70 dark:bg-black/80 \r
|
|
1537
|
-
backdrop-blur-sm animate-in fade-in duration-200`,
|
|
1538
|
-
onClick: s,
|
|
1539
|
-
children: [
|
|
1540
|
-
/* @__PURE__ */ e(
|
|
1541
|
-
"button",
|
|
1542
|
-
{
|
|
1543
|
-
onClick: s,
|
|
1544
|
-
className: `absolute top-4 right-4 bg-white dark:bg-gray-800 text-gray-800 dark:text-gray-200\r
|
|
1545
|
-
hover:bg-gray-100 dark:hover:bg-gray-700 rounded-full p-2 shadow-lg transition`,
|
|
1546
|
-
children: /* @__PURE__ */ e(we, { size: 20 })
|
|
1547
|
-
}
|
|
1548
|
-
),
|
|
1549
|
-
/* @__PURE__ */ e(
|
|
1550
|
-
"div",
|
|
1551
|
-
{
|
|
1552
|
-
className: "max-w-5xl w-full px-4 transform transition-all duration-200 scale-95 animate-in zoom-in-95",
|
|
1553
|
-
onClick: (t) => t.stopPropagation(),
|
|
1554
|
-
children: /* @__PURE__ */ e(
|
|
1555
|
-
"img",
|
|
1556
|
-
{
|
|
1557
|
-
src: h,
|
|
1558
|
-
alt: n,
|
|
1559
|
-
className: "w-full max-h-[90vh] object-contain rounded-xl"
|
|
1560
|
-
}
|
|
1561
|
-
)
|
|
1562
|
-
}
|
|
1563
|
-
)
|
|
1564
|
-
]
|
|
1565
|
-
}
|
|
1566
|
-
) });
|
|
1567
|
-
}, da = ({ config: h, setShowAdd: n, title: i, buttonText: o, description: s }) => {
|
|
1568
|
-
const {
|
|
1569
|
-
data: t = [],
|
|
1570
|
-
table_head: p = [],
|
|
1571
|
-
loading: k = !1,
|
|
1572
|
-
search: M = {
|
|
1573
|
-
enabled: !1,
|
|
1574
|
-
placeholder: "Search...",
|
|
1575
|
-
useServerSideSearch: !1
|
|
1576
|
-
},
|
|
1577
|
-
filter: u = {
|
|
1578
|
-
enabled: !1,
|
|
1579
|
-
useServerSideFilters: !1
|
|
1580
|
-
},
|
|
1581
|
-
pagination: l = {
|
|
1582
|
-
enabled: !1,
|
|
1583
|
-
rows_per_page: 10,
|
|
1584
|
-
useServerSidePagination: !1
|
|
1585
|
-
},
|
|
1586
|
-
emptyMessage: c = "No data available",
|
|
1587
|
-
onMenuAction: g,
|
|
1588
|
-
setServerSidePaginationData: y = () => {
|
|
1589
|
-
},
|
|
1590
|
-
onFilterApply: b,
|
|
1591
|
-
filterConfig: v = null
|
|
1592
|
-
} = h, [x, N] = S(""), [I, D] = S(null), [C, A] = S([]), [B, F] = S({}), [R, j] = S(!1), [$, W] = S(null), [G, K] = S(!1), U = Me(() => !M.enabled || !x.trim() || M.useServerSideSearch ? t : Xe(t, x, M.searchKeys || []), [t, x, M]), [O, Y] = S(1), [q, w] = S((l == null ? void 0 : l.rows_per_page) || 50), [z, re] = S(U.length || 0), J = l != null && l.useServerSidePagination ? l.total_pages : Math.ceil(U.length / q), X = Me(() => {
|
|
1593
|
-
if (l.useServerSidePagination) return U;
|
|
1594
|
-
const r = (O - 1) * q;
|
|
1595
|
-
return U.slice(r, r + q);
|
|
1596
|
-
}, [U, O, q]), ne = ae(null), ie = ae({}), le = ae(null), se = (r) => {
|
|
1597
|
-
N(r), Y(1), M.useServerSideSearch && (le.current && clearTimeout(le.current), le.current = setTimeout(async () => {
|
|
1598
|
-
try {
|
|
1599
|
-
await y((f) => ({
|
|
1600
|
-
...f,
|
|
1601
|
-
search: r,
|
|
1602
|
-
current_page: 1
|
|
1603
|
-
}));
|
|
1604
|
-
} catch (f) {
|
|
1605
|
-
console.error("Search error:", f);
|
|
1606
|
-
}
|
|
1607
|
-
}, 800));
|
|
1608
|
-
}, de = (r, f, P) => {
|
|
1609
|
-
P.stopPropagation(), D(null), g == null || g(r.type, f);
|
|
1610
|
-
}, ce = (r, f, P) => {
|
|
1611
|
-
f.stopPropagation(), A(P);
|
|
1612
|
-
const _ = f.currentTarget;
|
|
1613
|
-
ie.current[r] = _;
|
|
1614
|
-
const m = _.getBoundingClientRect(), L = 192, T = P.length * 40, Z = window.innerWidth, V = window.innerHeight, Ge = Z - m.right < L ? m.left - L + m.width : m.left, _e = V - m.bottom < T && m.top > T ? m.top - T - 2 : m.bottom + 2;
|
|
1615
|
-
F({
|
|
1616
|
-
top: Math.max(8, Math.min(_e, V - T - 8)),
|
|
1617
|
-
left: Math.max(8, Math.min(Ge, Z - L - 8))
|
|
1618
|
-
}), D(I === r ? null : r);
|
|
1619
|
-
}, he = (r) => (O - 1) * q + r + 1, ue = (r) => {
|
|
1620
|
-
r && r.src instanceof File && (r = { ...r, src: URL.createObjectURL(r.src) }), W(r), K(!0);
|
|
1621
|
-
}, oe = (r, f, P, _ = null) => /* @__PURE__ */ e(E, { children: r ? /* @__PURE__ */ e(
|
|
1622
|
-
"img",
|
|
1623
|
-
{
|
|
1624
|
-
src: r instanceof File ? URL.createObjectURL(r) : r,
|
|
1625
|
-
alt: f || "Avatar",
|
|
1626
|
-
onClick: (m) => {
|
|
1627
|
-
m.stopPropagation(), m.preventDefault(), ue({ src: r, alt: f });
|
|
1628
|
-
},
|
|
1629
|
-
className: `w-10 h-10 cursor-pointer shrink-0 rounded-full object-cover border border-gray-200 dark:border-gray-700 ${P || ""}`
|
|
1630
|
-
}
|
|
1631
|
-
) : /* @__PURE__ */ e(E, { children: _ || /* @__PURE__ */ e(
|
|
1632
|
-
"div",
|
|
1633
|
-
{
|
|
1634
|
-
className: `w-10 h-10 flex items-center shrink-0 justify-center rounded-full border border-gray-300 dark:border-gray-700 bg-gray-200 dark:bg-gray-600 ${P || ""}`,
|
|
1635
|
-
children: /* @__PURE__ */ e(Fe, { className: "w-6 h-6 text-gray-400 dark:text-gray-400" })
|
|
1636
|
-
}
|
|
1637
|
-
) }) }), be = (r, f) => /* @__PURE__ */ e(E, { children: r ? /* @__PURE__ */ e(
|
|
1638
|
-
"audio",
|
|
1639
|
-
{
|
|
1640
|
-
controls: !0,
|
|
1641
|
-
src: r instanceof File ? URL.createObjectURL(r) : r,
|
|
1642
|
-
onClick: (P) => {
|
|
1643
|
-
P.stopPropagation();
|
|
1644
|
-
},
|
|
1645
|
-
className: `w-64 cursor-pointer ${f || ""}`
|
|
1646
|
-
},
|
|
1647
|
-
r instanceof File ? URL.createObjectURL(r) : r
|
|
1648
|
-
) : /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(
|
|
1649
|
-
"div",
|
|
1650
|
-
{
|
|
1651
|
-
className: `w-12 h-12 flex items-center shrink-0 justify-center rounded-full border border-gray-300 dark:border-gray-700 bg-gray-200 dark:bg-gray-600 ${f || ""}`,
|
|
1652
|
-
children: /* @__PURE__ */ e(qe, { className: "w-6 h-6 text-gray-400 dark:text-gray-400" })
|
|
1653
|
-
}
|
|
1654
|
-
) }) }), pe = (r, f) => /* @__PURE__ */ d("div", { className: `flex items-center space-x-4 ${f.className || ""}`, children: [
|
|
1655
|
-
f.imageKey ? oe(r[f.imageKey], r[f.titleKey], "group-avatar") : "",
|
|
1656
|
-
/* @__PURE__ */ d("div", { children: [
|
|
1657
|
-
/* @__PURE__ */ e("p", { className: "font-medium text-gray-900 dark:text-white group-title", children: r[f.titleKey] || "" }),
|
|
1658
|
-
/* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400 group-sub-title", children: r[f.subtitleKey] || "" })
|
|
1659
|
-
] })
|
|
1660
|
-
] }), ge = (r, f) => {
|
|
1661
|
-
var L;
|
|
1662
|
-
let P = String(r);
|
|
1663
|
-
const _ = f.variant || "contained";
|
|
1664
|
-
let m = f.defaultColor;
|
|
1665
|
-
if (((L = f == null ? void 0 : f.chipOptions) == null ? void 0 : L.length) > 0) {
|
|
1666
|
-
let T = f == null ? void 0 : f.chipOptions.find((Z) => Z.value == r);
|
|
1667
|
-
T && (P = T.label, m = T.color);
|
|
1668
|
-
}
|
|
1669
|
-
return /* @__PURE__ */ e(
|
|
1670
|
-
je,
|
|
1671
|
-
{
|
|
1672
|
-
label: P,
|
|
1673
|
-
variant: _,
|
|
1674
|
-
color: m,
|
|
1675
|
-
className: f.className || ""
|
|
1676
|
-
}
|
|
1677
|
-
);
|
|
1678
|
-
}, me = (r, f, P) => {
|
|
1679
|
-
const _ = f[r.key];
|
|
1680
|
-
return r.type === "menu_actions" ? /* @__PURE__ */ e("div", { className: `text-center ${r.className || ""}`, children: /* @__PURE__ */ e(
|
|
1681
|
-
"button",
|
|
1682
|
-
{
|
|
1683
|
-
ref: (m) => ie.current[f.id || f._id] = m,
|
|
1684
|
-
onClick: (m) => ce(f.id || f._id, m, r.menuList),
|
|
1685
|
-
className: "p-2 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-full transition text-gray-700 dark:text-gray-300",
|
|
1686
|
-
children: /* @__PURE__ */ e(We, { className: "h-4 w-4" })
|
|
1687
|
-
}
|
|
1688
|
-
) }) : r.type === "index" ? /* @__PURE__ */ e("span", { className: r.className || "", children: he(P) }) : r.type === "group" ? pe(f, r) : r.type === "chip" ? /* @__PURE__ */ e(E, { children: ge(_, r) }) : r.type === "date" ? /* @__PURE__ */ e("span", { className: r.className || "", children: Pe(_, r.format || "DD MMM YYYY") }) : r.type === "avatar" ? /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e("div", { className: "min-w-[40px]", children: oe(_, r.alt, r.className, r.fallback_icon) }) }) : r.type === "audio" ? /* @__PURE__ */ e(E, { children: be(_, r.className) }) : /* @__PURE__ */ e("span", { className: r.className || "", children: _ || "N/A" });
|
|
1689
|
-
}, fe = (r, f) => {
|
|
1690
|
-
if (r.onClickDetails)
|
|
1691
|
-
return g == null ? void 0 : g("view", f);
|
|
1692
|
-
if (typeof r.handleClick == "function")
|
|
1693
|
-
return r.handleClick(f);
|
|
1694
|
-
}, ye = (r) => r.onClickDetails || typeof r.handleClick == "function";
|
|
1695
|
-
return H(() => {
|
|
1696
|
-
const r = () => {
|
|
1697
|
-
I && D(null);
|
|
1698
|
-
};
|
|
1699
|
-
return window.addEventListener("scroll", r, !0), () => {
|
|
1700
|
-
window.removeEventListener("scroll", r, !0);
|
|
1701
|
-
};
|
|
1702
|
-
}, [I]), H(() => {
|
|
1703
|
-
const r = (f) => {
|
|
1704
|
-
ne.current && !ne.current.contains(f.target) && D(null);
|
|
1705
|
-
};
|
|
1706
|
-
return document.addEventListener("click", r), () => document.removeEventListener("click", r);
|
|
1707
|
-
}, []), H(() => {
|
|
1708
|
-
l != null && l.rows_per_page && (l != null && l.useServerSidePagination) && w((l == null ? void 0 : l.rows_per_page) || 50), l.current_page && Y(l.current_page);
|
|
1709
|
-
}, [
|
|
1710
|
-
l.rows_per_page,
|
|
1711
|
-
l == null ? void 0 : l.useServerSidePagination,
|
|
1712
|
-
l.current_page
|
|
1713
|
-
]), H(() => {
|
|
1714
|
-
re(
|
|
1715
|
-
l != null && l.useServerSidePagination ? l.total_records : U.length
|
|
1716
|
-
), U.length <= q * (O - 1) && !(l != null && l.useServerSidePagination) && Y((r) => r - 1 || 1);
|
|
1717
|
-
}, [
|
|
1718
|
-
U.length,
|
|
1719
|
-
l.total_records,
|
|
1720
|
-
l == null ? void 0 : l.useServerSidePagination
|
|
1721
|
-
]), k ? /* @__PURE__ */ e(sa, { rows: 6, columns: 6 }) : /* @__PURE__ */ d(E, { children: [
|
|
1722
|
-
/* @__PURE__ */ d("div", { className: "flex flex-col sm:flex-row sm:
|
|
1723
|
-
/* @__PURE__ */ d("div", { children: [
|
|
1724
|
-
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: i }),
|
|
1725
|
-
/* @__PURE__ */ e("p", { className: "text-md text-gray-600 dark:text-gray-400", children: s })
|
|
1726
|
-
] }),
|
|
1727
|
-
/* @__PURE__ */ d("div", { className: "flex flex-col justify-end items-end gap-2", children: [
|
|
1728
|
-
/* @__PURE__ */ d(
|
|
1729
|
-
ee,
|
|
1730
|
-
{
|
|
1731
|
-
onClick: () => n(!0),
|
|
1732
|
-
variant: "contained",
|
|
1733
|
-
color: "primary",
|
|
1734
|
-
children: [
|
|
1735
|
-
/* @__PURE__ */ e(ze, { className: "w-4 h-4 mr-2" }),
|
|
1736
|
-
o || "Add New"
|
|
1737
|
-
]
|
|
1738
|
-
}
|
|
1739
|
-
),
|
|
1740
|
-
/* @__PURE__ */ d("div", { className: "flex justify-end items-center gap-2", children: [
|
|
1741
|
-
M.enabled && /* @__PURE__ */ e("div", { className: "", children: /* @__PURE__ */ d("div", { className: "relative min-w-[300px]", children: [
|
|
1742
|
-
/* @__PURE__ */ e(Re, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-300" }),
|
|
1743
|
-
/* @__PURE__ */ e(
|
|
1744
|
-
"input",
|
|
1745
|
-
{
|
|
1746
|
-
type: "text",
|
|
1747
|
-
placeholder: M.placeholder || "Search...",
|
|
1748
|
-
value: x,
|
|
1749
|
-
onChange: (r) => se(r.target.value),
|
|
1750
|
-
className: "w-full h-[36px] pl-9 pr-4 py-3 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-gray-50 dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-blue-300 dark:ring-blue-200 disabled:opacity-50"
|
|
1751
|
-
}
|
|
1752
|
-
)
|
|
1753
|
-
] }) }),
|
|
1754
|
-
v && u.enabled && /* @__PURE__ */ d(ee, { onClick: () => j(!0), variant: "contained", children: [
|
|
1755
|
-
/* @__PURE__ */ e(He, { className: "w-4 h-4 mr-2" }),
|
|
1756
|
-
"Filters"
|
|
1757
|
-
] })
|
|
1758
|
-
] })
|
|
1759
|
-
] })
|
|
1760
|
-
] }),
|
|
1761
|
-
/* @__PURE__ */ d("div", { className: "bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden border border-gray-200 dark:border-gray-700", children: [
|
|
1762
|
-
/* @__PURE__ */ e("div", { className: "overflow-x-auto", children: /* @__PURE__ */ d("table", { className: "min-w-full divide-y divide-gray-200 dark:divide-gray-700", children: [
|
|
1763
|
-
/* @__PURE__ */ e("thead", { className: "bg-gray-50 dark:bg-gray-700/60", children: /* @__PURE__ */ e("tr", { children: p.map((r) => /* @__PURE__ */ e(
|
|
1764
|
-
"th",
|
|
1765
|
-
{
|
|
1766
|
-
className: `px-6 py-4 text-left text-xs font-medium text-black dark:text-white uppercase tracking-wider min-w-max max-w-[180px] truncate ${r.headClass || ""}`,
|
|
1767
|
-
children: r.title
|
|
1768
|
-
},
|
|
1769
|
-
r.key
|
|
1770
|
-
)) }) }),
|
|
1771
|
-
/* @__PURE__ */ e("tbody", { className: "bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700", children: X.length === 0 ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e(
|
|
1772
|
-
"td",
|
|
1773
|
-
{
|
|
1774
|
-
colSpan: p.length,
|
|
1775
|
-
className: "text-center py-10 text-gray-500 dark:text-gray-400",
|
|
1776
|
-
children: c
|
|
1777
|
-
}
|
|
1778
|
-
) }) : X.map((r, f) => /* @__PURE__ */ e(
|
|
1779
|
-
"tr",
|
|
1780
|
-
{
|
|
1781
|
-
className: "hover:bg-gray-50 dark:hover:bg-blue-800/10 transition",
|
|
1782
|
-
children: p.map((P) => /* @__PURE__ */ e(
|
|
1783
|
-
"td",
|
|
1784
|
-
{
|
|
1785
|
-
className: `px-6 py-4 text-sm text-gray-900 dark:text-gray-100 min-w-max ${P.type == "audio" ? "" : "max-w-[300px]"} truncate ${ye(P) ? "cursor-pointer" : ""}`,
|
|
1786
|
-
title: String(r[P.key] ?? ""),
|
|
1787
|
-
onClick: () => fe(P, r),
|
|
1788
|
-
children: P.render ? P.render(r, f) : me(P, r, f)
|
|
1789
|
-
},
|
|
1790
|
-
P.key
|
|
1791
|
-
))
|
|
1792
|
-
},
|
|
1793
|
-
r.id || r._id || f
|
|
1794
|
-
)) })
|
|
1795
|
-
] }) }),
|
|
1796
|
-
(l == null ? void 0 : l.enabled) && U.length > 0 && /* @__PURE__ */ d("div", { className: " bg-gray-50 dark:bg-gray-700/60 px-6 py-3 flex flex-wrap items-center justify-between border-t border-gray-200 dark:border-gray-600 gap-3", children: [
|
|
1797
|
-
/* @__PURE__ */ d("div", { className: "text-sm text-gray-700 dark:text-gray-300", children: [
|
|
1798
|
-
"Showing ",
|
|
1799
|
-
(O - 1) * q + 1,
|
|
1800
|
-
" to",
|
|
1801
|
-
" ",
|
|
1802
|
-
Math.min(O * q, z),
|
|
1803
|
-
" of ",
|
|
1804
|
-
z,
|
|
1805
|
-
" ",
|
|
1806
|
-
"results"
|
|
1807
|
-
] }),
|
|
1808
|
-
/* @__PURE__ */ d("div", { className: "flex items-center gap-4", children: [
|
|
1809
|
-
/* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
1810
|
-
/* @__PURE__ */ e("span", { className: "text-sm text-gray-700 dark:text-gray-300", children: "Rows per page:" }),
|
|
1811
|
-
/* @__PURE__ */ e(
|
|
1812
|
-
"select",
|
|
1813
|
-
{
|
|
1814
|
-
value: q,
|
|
1815
|
-
onChange: (r) => {
|
|
1816
|
-
const f = Number(r.target.value);
|
|
1817
|
-
w(f), Y(1), l.useServerSidePagination && y((P) => ({
|
|
1818
|
-
...P,
|
|
1819
|
-
current_page: 1,
|
|
1820
|
-
rows_per_page: f
|
|
1821
|
-
}));
|
|
1822
|
-
},
|
|
1823
|
-
className: "border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-sm rounded-md px-2 py-1 focus:outline-none focus:ring-1 focus:ring-blue-500",
|
|
1824
|
-
children: [2, 10, 25, 50, 100].map((r) => /* @__PURE__ */ e("option", { value: r, children: r }, r))
|
|
1825
|
-
}
|
|
1826
|
-
)
|
|
1827
|
-
] }),
|
|
1828
|
-
/* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
1829
|
-
/* @__PURE__ */ e(
|
|
1830
|
-
"button",
|
|
1831
|
-
{
|
|
1832
|
-
onClick: () => {
|
|
1833
|
-
if (O > 1) {
|
|
1834
|
-
const r = O - 1;
|
|
1835
|
-
Y(r), l.useServerSidePagination && y((f) => ({
|
|
1836
|
-
...f,
|
|
1837
|
-
current_page: r
|
|
1838
|
-
}));
|
|
1839
|
-
}
|
|
1840
|
-
},
|
|
1841
|
-
disabled: O === 1,
|
|
1842
|
-
className: "p-2 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-md transition text-gray-500 dark:text-gray-300 disabled:opacity-50",
|
|
1843
|
-
children: /* @__PURE__ */ e(Ye, { className: "h-4 w-4" })
|
|
1844
|
-
}
|
|
1845
|
-
),
|
|
1846
|
-
/* @__PURE__ */ d("span", { className: "text-sm text-gray-800 dark:text-gray-200", children: [
|
|
1847
|
-
"Page ",
|
|
1848
|
-
O,
|
|
1849
|
-
" of ",
|
|
1850
|
-
J
|
|
1851
|
-
] }),
|
|
1852
|
-
/* @__PURE__ */ e(
|
|
1853
|
-
"button",
|
|
1854
|
-
{
|
|
1855
|
-
onClick: () => {
|
|
1856
|
-
if (O < J) {
|
|
1857
|
-
const r = O + 1;
|
|
1858
|
-
Y(r), l.useServerSidePagination && y((f) => ({
|
|
1859
|
-
...f,
|
|
1860
|
-
current_page: r
|
|
1861
|
-
}));
|
|
1862
|
-
}
|
|
1863
|
-
},
|
|
1864
|
-
disabled: O === J,
|
|
1865
|
-
className: "p-2 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-md transition text-gray-500 dark:text-gray-300 disabled:opacity-50",
|
|
1866
|
-
children: /* @__PURE__ */ e(Ve, { className: "h-4 w-4" })
|
|
1867
|
-
}
|
|
1868
|
-
)
|
|
1869
|
-
] })
|
|
1870
|
-
] })
|
|
1871
|
-
] })
|
|
1872
|
-
] }),
|
|
1873
|
-
I && Ze(
|
|
1874
|
-
/* @__PURE__ */ e(
|
|
1875
|
-
"div",
|
|
1876
|
-
{
|
|
1877
|
-
ref: ne,
|
|
1878
|
-
style: {
|
|
1879
|
-
position: "fixed",
|
|
1880
|
-
top: `${B.top}px`,
|
|
1881
|
-
left: `${B.left}px`,
|
|
1882
|
-
zIndex: 9999
|
|
1883
|
-
},
|
|
1884
|
-
className: "w-48 bg-white dark:bg-gray-700 rounded-md shadow-lg border border-gray-200 dark:border-gray-600",
|
|
1885
|
-
children: C.map((r, f) => /* @__PURE__ */ d(
|
|
1886
|
-
"button",
|
|
1887
|
-
{
|
|
1888
|
-
onClick: (P) => de(
|
|
1889
|
-
r,
|
|
1890
|
-
t.find(
|
|
1891
|
-
(_) => _.id === I || _._id == I
|
|
1892
|
-
),
|
|
1893
|
-
P
|
|
1894
|
-
),
|
|
1895
|
-
className: `w-full flex items-center gap-2 px-4 py-2 text-sm text-left hover:bg-gray-100 dark:hover:bg-gray-600 ${r.variant === "danger" ? "text-red-600 dark:text-red-500" : "text-gray-700 dark:text-gray-200"}`,
|
|
1896
|
-
children: [
|
|
1897
|
-
r.icon && /* @__PURE__ */ e("span", { className: "shrink-0", children: r.icon }),
|
|
1898
|
-
r.title
|
|
1899
|
-
]
|
|
1900
|
-
},
|
|
1901
|
-
f
|
|
1902
|
-
))
|
|
1903
|
-
}
|
|
1904
|
-
),
|
|
1905
|
-
document.body
|
|
1906
|
-
),
|
|
1907
|
-
v && /* @__PURE__ */ e(
|
|
1908
|
-
ia,
|
|
1909
|
-
{
|
|
1910
|
-
isOpen: R,
|
|
1911
|
-
onClose: () => j(!1),
|
|
1912
|
-
config: v,
|
|
1913
|
-
onApply: b
|
|
1914
|
-
}
|
|
1915
|
-
),
|
|
1916
|
-
G && /* @__PURE__ */ e(
|
|
1917
|
-
Ee,
|
|
1918
|
-
{
|
|
1919
|
-
src: $.src,
|
|
1920
|
-
alt: $.alt,
|
|
1921
|
-
isOpen: G,
|
|
1922
|
-
setIsOpen: K
|
|
1923
|
-
}
|
|
1924
|
-
)
|
|
1925
|
-
] });
|
|
1926
|
-
}, ve = ({
|
|
1927
|
-
isOpen: h,
|
|
1928
|
-
onClose: n,
|
|
1929
|
-
icon: i,
|
|
1930
|
-
title: o,
|
|
1931
|
-
children: s,
|
|
1932
|
-
size: t = "md",
|
|
1933
|
-
actionButtons: p = [],
|
|
1934
|
-
actions: k,
|
|
1935
|
-
showDefaultClose: M = !0,
|
|
1936
|
-
footerConfig: u = null,
|
|
1937
|
-
hideFooter: l = !1,
|
|
1938
|
-
onFormSubmit: c = () => {
|
|
1939
|
-
},
|
|
1940
|
-
onCancel: g,
|
|
1941
|
-
loadingBtn: y = !1,
|
|
1942
|
-
executeFunction: b = () => {
|
|
1943
|
-
},
|
|
1944
|
-
selectedItem: v = null
|
|
1945
|
-
}) => {
|
|
1946
|
-
if (!h) return null;
|
|
1947
|
-
const x = {
|
|
1948
|
-
sm: "max-w-md",
|
|
1949
|
-
md: "max-w-lg",
|
|
1950
|
-
lg: "max-w-2xl",
|
|
1951
|
-
xl: "max-w-4xl",
|
|
1952
|
-
full: "max-w-full"
|
|
1953
|
-
};
|
|
1954
|
-
return /* @__PURE__ */ d("div", { className: "fixed inset-0 z-50 flex items-center justify-center p-4", children: [
|
|
1955
|
-
/* @__PURE__ */ e(
|
|
1956
|
-
"div",
|
|
1957
|
-
{
|
|
1958
|
-
className: "fixed inset-0 bg-gray-500 opacity-75",
|
|
1959
|
-
onClick: () => n()
|
|
1960
|
-
}
|
|
1961
|
-
),
|
|
1962
|
-
/* @__PURE__ */ d(
|
|
1963
|
-
"div",
|
|
1964
|
-
{
|
|
1965
|
-
className: `relative bg-white rounded-lg shadow-xl w-full ${x[t] || x.md} max-h-[90vh] flex flex-col dark:bg-gray-800`,
|
|
1966
|
-
children: [
|
|
1967
|
-
/* @__PURE__ */ d("div", { className: "flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0", children: [
|
|
1968
|
-
/* @__PURE__ */ d("div", { className: "flex items-center gap-1", children: [
|
|
1969
|
-
i && /* @__PURE__ */ e("span", { children: i }),
|
|
1970
|
-
/* @__PURE__ */ e("h3", { className: "text-lg font-medium text-gray-900 dark:text-white", children: o })
|
|
1971
|
-
] }),
|
|
1972
|
-
/* @__PURE__ */ e(
|
|
1973
|
-
"button",
|
|
1974
|
-
{
|
|
1975
|
-
onClick: () => n(),
|
|
1976
|
-
className: "text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",
|
|
1977
|
-
children: /* @__PURE__ */ e(we, { className: "w-6 h-6" })
|
|
1978
|
-
}
|
|
1979
|
-
)
|
|
1980
|
-
] }),
|
|
1981
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-4", children: s }),
|
|
1982
|
-
p.length > 0 && /* @__PURE__ */ e("div", { className: "px-4 py-3 flex justify-end gap-3 border-t border-gray-200 dark:border-gray-700 sm:px-6", children: p.map((N) => /* @__PURE__ */ e(
|
|
1983
|
-
ee,
|
|
1984
|
-
{
|
|
1985
|
-
onClick: (I) => {
|
|
1986
|
-
N.type == "submit" ? c(I) : b(
|
|
1987
|
-
() => {
|
|
1988
|
-
var D;
|
|
1989
|
-
return (D = N == null ? void 0 : N.onClick) == null ? void 0 : D.call(N, I, v);
|
|
1990
|
-
},
|
|
1991
|
-
(D) => n == null ? void 0 : n(D)
|
|
1992
|
-
);
|
|
1993
|
-
},
|
|
1994
|
-
disabled: y || N.disabled,
|
|
1995
|
-
variant: N.variant || "contained",
|
|
1996
|
-
color: N.color || "primary",
|
|
1997
|
-
className: `min-w-[100px] ${N.className}`,
|
|
1998
|
-
type: N.type || "button",
|
|
1999
|
-
children: y ? /* @__PURE__ */ d("div", { className: "flex items-center", children: [
|
|
2000
|
-
/* @__PURE__ */ e("div", { className: "animate-spin rounded-full h-4 w-4 border-2 border-white/30 border-t-2 border-t-white mr-2" }),
|
|
2001
|
-
N.label || "Submit",
|
|
2002
|
-
"..."
|
|
2003
|
-
] }) : N.label || "Submit"
|
|
2004
|
-
}
|
|
2005
|
-
)) })
|
|
2006
|
-
]
|
|
2007
|
-
}
|
|
2008
|
-
)
|
|
2009
|
-
] });
|
|
2010
|
-
}, De = ({ config: h, onSubmit: n, initialData: i = {}, type: o = "add" }) => {
|
|
2011
|
-
const { formClass: s = "grid grid-cols-12 gap-4", formFields: t = [] } = h || {}, [p, k] = S(i);
|
|
2012
|
-
H(() => {
|
|
2013
|
-
k(i);
|
|
2014
|
-
}, []);
|
|
2015
|
-
const M = (l, c) => {
|
|
2016
|
-
k((g) => ({ ...g, [l]: c }));
|
|
2017
|
-
}, u = (l) => {
|
|
2018
|
-
l.preventDefault();
|
|
2019
|
-
const c = l.target;
|
|
2020
|
-
if (!c.checkValidity()) {
|
|
2021
|
-
c.reportValidity();
|
|
2022
|
-
return;
|
|
2023
|
-
}
|
|
2024
|
-
n(p);
|
|
2025
|
-
};
|
|
2026
|
-
return /* @__PURE__ */ e(
|
|
2027
|
-
"form",
|
|
2028
|
-
{
|
|
2029
|
-
id: o == "add" ? "addForm" : o == "edit" ? "editForm" : "defaultForm",
|
|
2030
|
-
onSubmit: u,
|
|
2031
|
-
className: s,
|
|
2032
|
-
noValidate: !1,
|
|
2033
|
-
children: t.map((l) => /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(
|
|
2034
|
-
Ue,
|
|
2035
|
-
{
|
|
2036
|
-
field: l,
|
|
2037
|
-
formData: p,
|
|
2038
|
-
handleChange: M
|
|
2039
|
-
},
|
|
2040
|
-
l.key
|
|
2041
|
-
) }))
|
|
2042
|
-
}
|
|
2043
|
-
);
|
|
2044
|
-
};
|
|
2045
|
-
function ca({ data: h, config: n }) {
|
|
2046
|
-
const { fields: i, containerClass: o } = n, [s, t] = S(null), [p, k] = S(!1), M = (c) => {
|
|
2047
|
-
c && c.src instanceof File && (c = { ...c, src: URL.createObjectURL(c.src) }), t(c), k(!0);
|
|
2048
|
-
}, u = ({ col: c }) => {
|
|
2049
|
-
var I;
|
|
2050
|
-
let g = c == null ? void 0 : c.icon, y = c.label, b = h[c.key], v = c.type, x = c.variant || "outline", N = c.defaultColor;
|
|
2051
|
-
if (v === "chip" && ((I = c.chipOptions) == null ? void 0 : I.length) > 0) {
|
|
2052
|
-
let D = c == null ? void 0 : c.chipOptions.find((C) => C.value == b);
|
|
2053
|
-
D && (b = D.label, N = D.color);
|
|
2054
|
-
}
|
|
2055
|
-
return /* @__PURE__ */ d(
|
|
2056
|
-
"div",
|
|
2057
|
-
{
|
|
2058
|
-
className: `col-span-12 flex items-center space-x-4 p-4 rounded-xl
|
|
2059
|
-
bg-gray-100 dark:bg-gray-900 ${c.blockClass || ""}`,
|
|
2060
|
-
children: [
|
|
2061
|
-
g && /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: g }),
|
|
2062
|
-
/* @__PURE__ */ d("div", { className: "flex-1 min-w-0", children: [
|
|
2063
|
-
/* @__PURE__ */ e("p", { className: "text-sm font-medium text-gray-500 dark:text-gray-400", children: y }),
|
|
2064
|
-
v === "chip" ? /* @__PURE__ */ e(
|
|
2065
|
-
je,
|
|
2066
|
-
{
|
|
2067
|
-
label: b,
|
|
2068
|
-
variant: x,
|
|
2069
|
-
color: N,
|
|
2070
|
-
className: "mt-1"
|
|
2071
|
-
}
|
|
2072
|
-
) : (
|
|
2073
|
-
/* TINY EDITOR */
|
|
2074
|
-
v === "tinyEditor" ? /* @__PURE__ */ e(
|
|
2075
|
-
"p",
|
|
2076
|
-
{
|
|
2077
|
-
className: "mt-1 text-sm text-gray-900 dark:text-white break-words",
|
|
2078
|
-
dangerouslySetInnerHTML: {
|
|
2079
|
-
__html: b
|
|
2080
|
-
}
|
|
2081
|
-
}
|
|
2082
|
-
) : v === "audio" ? b ? /* @__PURE__ */ e(
|
|
2083
|
-
"audio",
|
|
2084
|
-
{
|
|
2085
|
-
controls: !0,
|
|
2086
|
-
src: b instanceof File ? URL.createObjectURL(b) : b,
|
|
2087
|
-
onClick: (D) => D.stopPropagation(),
|
|
2088
|
-
className: "shadow-md rounded-full"
|
|
2089
|
-
},
|
|
2090
|
-
b instanceof File ? URL.createObjectURL(b) : b
|
|
2091
|
-
) : /* @__PURE__ */ e("p", { className: "mt-1 text-sm text-gray-400", children: "N/A" }) : (
|
|
2092
|
-
/* DEFAULT */
|
|
2093
|
-
/* @__PURE__ */ e("p", { className: "mt-1 text-sm text-gray-900 dark:text-white break-words", children: v == "date" ? /* @__PURE__ */ e("span", { children: Pe(b, c.format || "DD MMM YYYY") }) : b || "N/A" })
|
|
2094
|
-
)
|
|
2095
|
-
)
|
|
2096
|
-
] })
|
|
2097
|
-
]
|
|
2098
|
-
}
|
|
2099
|
-
);
|
|
2100
|
-
}, l = ({ col: c }) => {
|
|
2101
|
-
let g = h[c.titleKey], y = h[c.subtitleKey], b = h[c.imageKey], v = h[c.fallback_icon];
|
|
2102
|
-
return /* @__PURE__ */ d(
|
|
2103
|
-
"div",
|
|
2104
|
-
{
|
|
2105
|
-
className: `col-span-12 flex items-center space-x-4 p-4 rounded-xl
|
|
2106
|
-
bg-gray-100 dark:bg-gray-900
|
|
2107
|
-
${c.blockClass}`,
|
|
2108
|
-
children: [
|
|
2109
|
-
b ? /* @__PURE__ */ e(
|
|
2110
|
-
"img",
|
|
2111
|
-
{
|
|
2112
|
-
src: b instanceof File ? URL.createObjectURL(b) : b,
|
|
2113
|
-
alt: g,
|
|
2114
|
-
onClick: () => M({ src: b, alt: g }),
|
|
2115
|
-
className: "w-16 h-16 cursor-pointer rounded-full object-cover border-2 border-gray-200 dark:border-gray-700"
|
|
2116
|
-
}
|
|
2117
|
-
) : v || /* @__PURE__ */ e("div", { className: "w-16 h-16 flex items-center justify-center rounded-full border-2 border-gray-300 dark:border-gray-700 bg-gray-200 dark:bg-gray-600", children: /* @__PURE__ */ e(Fe, { className: "w-8 h-8 text-gray-400" }) }),
|
|
2118
|
-
/* @__PURE__ */ d("div", { children: [
|
|
2119
|
-
/* @__PURE__ */ e("h3", { className: "text-xl font-semibold text-gray-900 dark:text-white", children: g }),
|
|
2120
|
-
/* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: y })
|
|
2121
|
-
] })
|
|
2122
|
-
]
|
|
2123
|
-
}
|
|
2124
|
-
);
|
|
2125
|
-
};
|
|
2126
|
-
return /* @__PURE__ */ d(E, { children: [
|
|
2127
|
-
p && /* @__PURE__ */ e(
|
|
2128
|
-
Ee,
|
|
2129
|
-
{
|
|
2130
|
-
src: s.src,
|
|
2131
|
-
alt: s.alt,
|
|
2132
|
-
isOpen: p,
|
|
2133
|
-
setIsOpen: k
|
|
2134
|
-
}
|
|
2135
|
-
),
|
|
2136
|
-
/* @__PURE__ */ e("div", { className: `grid grid-cols-12 gap-4 ${o || ""}`, children: i.map(
|
|
2137
|
-
(c) => c.type == "group" ? /* @__PURE__ */ e(l, { col: c }) : /* @__PURE__ */ e(u, { col: c })
|
|
2138
|
-
) })
|
|
2139
|
-
] });
|
|
2140
|
-
}
|
|
2141
|
-
const $e = ({ config: h }) => {
|
|
2142
|
-
var se, de, ce, he, ue, oe, be, pe, ge, me, fe, ye, r, f, P, _;
|
|
2143
|
-
const {
|
|
2144
|
-
title: n,
|
|
2145
|
-
fetchData: i = async () => {
|
|
2146
|
-
},
|
|
2147
|
-
isStaticData: o = !1,
|
|
2148
|
-
tableConfig: s = {},
|
|
2149
|
-
modalConfig: t = {},
|
|
2150
|
-
filterConfig: p
|
|
2151
|
-
} = h, [k, M] = S(!0), [u, l] = S(!1), [c, g] = S([]), [y, b] = S(null), [v, x] = S({
|
|
2152
|
-
search: "",
|
|
2153
|
-
rows_per_page: 50,
|
|
2154
|
-
current_page: 1
|
|
2155
|
-
}), [N, I] = S({}), [D, C] = S(!1), [A, B] = S(!1), [F, R] = S(!1), [j, $] = S(!1), [W, G] = S(!1), [K, U] = S(null), O = (m, L) => {
|
|
2156
|
-
m === "edit" ? (U(L), R(!0)) : m === "view" ? (U(L), G(!0)) : m === "delete" && (U(L), $(!0));
|
|
2157
|
-
}, Y = async (m, L, T = "", Z = "") => {
|
|
2158
|
-
l(!0);
|
|
2159
|
-
try {
|
|
2160
|
-
const V = await (m == null ? void 0 : m());
|
|
2161
|
-
(T || V.message) && ke(T || V.message, {
|
|
2162
|
-
variant: "success"
|
|
2163
|
-
}), L == null || L(V);
|
|
2164
|
-
} catch (V) {
|
|
2165
|
-
(Z || V.message) && ke(Z || V.message, { variant: "error" });
|
|
2166
|
-
} finally {
|
|
2167
|
-
l(!1);
|
|
2168
|
-
}
|
|
2169
|
-
}, q = (m) => {
|
|
2170
|
-
let L = m.newObject;
|
|
2171
|
-
o ? (g((T) => [L, ...T]), b((T) => ({
|
|
2172
|
-
...T,
|
|
2173
|
-
current_page: 1
|
|
2174
|
-
}))) : (x((T) => ({
|
|
2175
|
-
...T,
|
|
2176
|
-
current_page: 1
|
|
2177
|
-
})), v.current_page == 1 && X()), B(!1);
|
|
2178
|
-
}, w = (m) => {
|
|
2179
|
-
let L = m.newObject, T = m.targetObject;
|
|
2180
|
-
o ? g(
|
|
2181
|
-
(Z) => Z.map(
|
|
2182
|
-
(V) => V.id === T.id ? { ...V, ...L } : V
|
|
2183
|
-
)
|
|
2184
|
-
) : X(), R(!1);
|
|
2185
|
-
}, z = (m) => {
|
|
2186
|
-
if (!m) {
|
|
2187
|
-
$(!1), U(null);
|
|
2188
|
-
return;
|
|
2189
|
-
}
|
|
2190
|
-
o ? g(
|
|
2191
|
-
(L) => L.filter((T) => T.id !== m.targetObject.id)
|
|
2192
|
-
) : c.length == 1 && v.current_page > 1 ? x((L) => ({
|
|
2193
|
-
...L,
|
|
2194
|
-
current_page: L.current_page - 1
|
|
2195
|
-
})) : X(), $(!1), U(null);
|
|
2196
|
-
}, re = (m) => Y(
|
|
2197
|
-
() => {
|
|
2198
|
-
var L, T;
|
|
2199
|
-
return (T = (L = t == null ? void 0 : t.addModal) == null ? void 0 : L.handleSubmit) == null ? void 0 : T.call(L, m);
|
|
2200
|
-
},
|
|
2201
|
-
q
|
|
2202
|
-
), J = (m) => Y(
|
|
2203
|
-
() => {
|
|
2204
|
-
var L, T;
|
|
2205
|
-
return (T = (L = t == null ? void 0 : t.editModal) == null ? void 0 : L.handleSubmit) == null ? void 0 : T.call(L, m, K);
|
|
2206
|
-
},
|
|
2207
|
-
w
|
|
2208
|
-
), X = async () => {
|
|
2209
|
-
M(!0), i == null || i({ ...v, ...N }).then((m) => {
|
|
2210
|
-
g(m.data), b(m.pagination);
|
|
2211
|
-
}).catch((m) => {
|
|
2212
|
-
ke(m.message, { variant: "error" });
|
|
2213
|
-
}).finally(() => {
|
|
2214
|
-
M(!1);
|
|
2215
|
-
});
|
|
2216
|
-
}, ne = (m) => {
|
|
2217
|
-
var L;
|
|
2218
|
-
I((T) => ({
|
|
2219
|
-
...m
|
|
2220
|
-
})), (L = s == null ? void 0 : s.filter) != null && L.useServerSideFilters && C((T) => !T);
|
|
2221
|
-
}, ie = (m, L) => m.filter(
|
|
2222
|
-
(T) => Object.entries(L).every(([Z, V]) => T[Z] === V)
|
|
2223
|
-
), le = Me(() => {
|
|
2224
|
-
var m;
|
|
2225
|
-
return (m = s == null ? void 0 : s.filter) != null && m.useServerSideFilters ? c : ie(c, N);
|
|
2226
|
-
}, [c, N]);
|
|
2227
|
-
return H(() => {
|
|
2228
|
-
X();
|
|
2229
|
-
}, [
|
|
2230
|
-
v.search,
|
|
2231
|
-
v.rows_per_page,
|
|
2232
|
-
v.current_page,
|
|
2233
|
-
D
|
|
2234
|
-
]), /* @__PURE__ */ e(
|
|
2235
|
-
Qe,
|
|
2236
|
-
{
|
|
2237
|
-
maxSnack: 3,
|
|
2238
|
-
anchorOrigin: {
|
|
2239
|
-
vertical: "bottom",
|
|
2240
|
-
horizontal: "right"
|
|
2241
|
-
},
|
|
2242
|
-
autoHideDuration: 3e3,
|
|
2243
|
-
action: (m) => /* @__PURE__ */ e(
|
|
2244
|
-
"button",
|
|
2245
|
-
{
|
|
2246
|
-
onClick: () => {
|
|
2247
|
-
window.dispatchEvent(
|
|
2248
|
-
new CustomEvent("closeSnackbar", { detail: m })
|
|
2249
|
-
);
|
|
2250
|
-
},
|
|
2251
|
-
className: "p-1 hover:bg-white/20 rounded-full transition-colors duration-200 text-white flex items-center justify-center",
|
|
2252
|
-
children: /* @__PURE__ */ e(we, { className: "h-4 w-4" })
|
|
2253
|
-
}
|
|
2254
|
-
),
|
|
2255
|
-
children: /* @__PURE__ */ d("div", { children: [
|
|
2256
|
-
/* @__PURE__ */ e(
|
|
2257
|
-
da,
|
|
2258
|
-
{
|
|
2259
|
-
title: n,
|
|
2260
|
-
setShowAdd: B,
|
|
2261
|
-
description: h.description,
|
|
2262
|
-
buttonText: h.buttonText,
|
|
2263
|
-
config: {
|
|
2264
|
-
...s,
|
|
2265
|
-
pagination: {
|
|
2266
|
-
...s.pagination,
|
|
2267
|
-
...y
|
|
2268
|
-
},
|
|
2269
|
-
data: le,
|
|
2270
|
-
setServerSidePaginationData: x,
|
|
2271
|
-
onMenuAction: O,
|
|
2272
|
-
filterConfig: p,
|
|
2273
|
-
onFilterApply: ne,
|
|
2274
|
-
loading: k
|
|
2275
|
-
}
|
|
2276
|
-
}
|
|
2277
|
-
),
|
|
2278
|
-
/* @__PURE__ */ e(
|
|
2279
|
-
ve,
|
|
2280
|
-
{
|
|
2281
|
-
isOpen: A,
|
|
2282
|
-
onClose: () => {
|
|
2283
|
-
u || B(!1);
|
|
2284
|
-
},
|
|
2285
|
-
icon: (se = t.addModal) == null ? void 0 : se.icon,
|
|
2286
|
-
title: ((de = t.addModal) == null ? void 0 : de.title) || "Add New",
|
|
2287
|
-
size: ((ce = t.addModal) == null ? void 0 : ce.size) || "md",
|
|
2288
|
-
onFormSubmit: () => {
|
|
2289
|
-
var m;
|
|
2290
|
-
return (m = document.querySelector("#addForm")) == null ? void 0 : m.requestSubmit();
|
|
2291
|
-
},
|
|
2292
|
-
loadingBtn: u,
|
|
2293
|
-
actionButtons: t.addModal.actionButtons,
|
|
2294
|
-
children: /* @__PURE__ */ e(
|
|
2295
|
-
De,
|
|
2296
|
-
{
|
|
2297
|
-
config: (t == null ? void 0 : t.addModal) || [],
|
|
2298
|
-
onSubmit: re,
|
|
2299
|
-
initialData: {},
|
|
2300
|
-
type: "add",
|
|
2301
|
-
loading: u
|
|
2302
|
-
}
|
|
2303
|
-
)
|
|
2304
|
-
}
|
|
2305
|
-
),
|
|
2306
|
-
/* @__PURE__ */ e(
|
|
2307
|
-
ve,
|
|
2308
|
-
{
|
|
2309
|
-
isOpen: F,
|
|
2310
|
-
onClose: () => {
|
|
2311
|
-
u || R(!1);
|
|
2312
|
-
},
|
|
2313
|
-
icon: (he = t.editModal) == null ? void 0 : he.icon,
|
|
2314
|
-
title: ((ue = t.editModal) == null ? void 0 : ue.title) || "Edit",
|
|
2315
|
-
size: ((oe = t.editModal) == null ? void 0 : oe.size) || "md",
|
|
2316
|
-
onFormSubmit: () => {
|
|
2317
|
-
var m;
|
|
2318
|
-
return (m = document.querySelector("#editForm")) == null ? void 0 : m.requestSubmit();
|
|
2319
|
-
},
|
|
2320
|
-
actionButtons: t.editModal.actionButtons,
|
|
2321
|
-
loadingBtn: u,
|
|
2322
|
-
children: /* @__PURE__ */ e(
|
|
2323
|
-
De,
|
|
2324
|
-
{
|
|
2325
|
-
config: t.editModal || [],
|
|
2326
|
-
onSubmit: J,
|
|
2327
|
-
initialData: K,
|
|
2328
|
-
type: "edit",
|
|
2329
|
-
loading: u
|
|
2330
|
-
}
|
|
2331
|
-
)
|
|
2332
|
-
}
|
|
2333
|
-
),
|
|
2334
|
-
j && /* @__PURE__ */ e(
|
|
2335
|
-
ve,
|
|
2336
|
-
{
|
|
2337
|
-
isOpen: j,
|
|
2338
|
-
onClose: (m) => {
|
|
2339
|
-
z(m);
|
|
2340
|
-
},
|
|
2341
|
-
icon: ((be = t.deleteModal) == null ? void 0 : be.icon) || /* @__PURE__ */ e(te, { icon: "ph:warning-bold", className: "w-6 h-6 text-red-500" }),
|
|
2342
|
-
title: ((pe = t.deleteModal) == null ? void 0 : pe.title) || "Confirm Delete",
|
|
2343
|
-
size: ((ge = t.deleteModal) == null ? void 0 : ge.size) || "md",
|
|
2344
|
-
loading: u,
|
|
2345
|
-
actionButtons: t.deleteModal.actionButtons,
|
|
2346
|
-
executeFunction: Y,
|
|
2347
|
-
selectedItem: K,
|
|
2348
|
-
children: /* @__PURE__ */ e("div", { className: "flex items-center space-x-2 py-3", children: /* @__PURE__ */ d("div", { children: [
|
|
2349
|
-
/* @__PURE__ */ e("p", { className: "text-md text-gray-700 dark:text-white", children: ((me = t.deleteModal) == null ? void 0 : me.confirmText) || "Are you sure you want to delete this item?" }),
|
|
2350
|
-
((fe = t.deleteModal) == null ? void 0 : fe.referenceKey) && /* @__PURE__ */ e("p", { className: "text-md font-semibold text-gray-700 dark:text-white", children: K[(ye = t.deleteModal) == null ? void 0 : ye.referenceKey] })
|
|
2351
|
-
] }) })
|
|
2352
|
-
}
|
|
2353
|
-
),
|
|
2354
|
-
t.viewModal && /* @__PURE__ */ e(
|
|
2355
|
-
ve,
|
|
2356
|
-
{
|
|
2357
|
-
isOpen: W,
|
|
2358
|
-
onClose: () => {
|
|
2359
|
-
G(!1), U(null);
|
|
2360
|
-
},
|
|
2361
|
-
icon: (r = t.viewModal) == null ? void 0 : r.icon,
|
|
2362
|
-
title: ((f = t.viewModal) == null ? void 0 : f.title) || "View Details",
|
|
2363
|
-
size: ((P = t.viewModal) == null ? void 0 : P.size) || "lg",
|
|
2364
|
-
footerConfig: t == null ? void 0 : t.viewModal.footer,
|
|
2365
|
-
children: (_ = t.viewModal) != null && _.component ? /* @__PURE__ */ e(t.viewModal.component, { data: K }) : /* @__PURE__ */ e(
|
|
2366
|
-
ca,
|
|
2367
|
-
{
|
|
2368
|
-
data: K,
|
|
2369
|
-
config: t.viewModal || {}
|
|
2370
|
-
}
|
|
2371
|
-
)
|
|
2372
|
-
}
|
|
2373
|
-
)
|
|
2374
|
-
] })
|
|
2375
|
-
}
|
|
2376
|
-
);
|
|
2377
|
-
}, Le = a.shape({
|
|
2378
|
-
value: a.oneOfType([
|
|
2379
|
-
a.string,
|
|
2380
|
-
a.number,
|
|
2381
|
-
a.bool
|
|
2382
|
-
]).isRequired,
|
|
2383
|
-
label: a.string.isRequired,
|
|
2384
|
-
color: a.string
|
|
2385
|
-
}), Ne = a.shape({
|
|
2386
|
-
type: a.string.isRequired,
|
|
2387
|
-
label: a.string.isRequired,
|
|
2388
|
-
color: a.string,
|
|
2389
|
-
variant: a.string,
|
|
2390
|
-
onClick: a.func
|
|
2391
|
-
}), ha = a.shape({
|
|
2392
|
-
title: a.string.isRequired,
|
|
2393
|
-
type: a.string.isRequired,
|
|
2394
|
-
variant: a.string,
|
|
2395
|
-
icon: a.node
|
|
2396
|
-
}), ua = a.shape({
|
|
2397
|
-
key: a.string.isRequired,
|
|
2398
|
-
title: a.string,
|
|
2399
|
-
type: a.string,
|
|
2400
|
-
imageKey: a.string,
|
|
2401
|
-
titleKey: a.string,
|
|
2402
|
-
subtitleKey: a.string,
|
|
2403
|
-
onClickDetails: a.bool,
|
|
2404
|
-
variant: a.string,
|
|
2405
|
-
chipOptions: a.arrayOf(Le),
|
|
2406
|
-
defaultColor: a.string,
|
|
2407
|
-
className: a.string,
|
|
2408
|
-
format: a.string,
|
|
2409
|
-
menuList: a.arrayOf(ha)
|
|
2410
|
-
}), Se = a.shape({
|
|
2411
|
-
key: a.string.isRequired,
|
|
2412
|
-
label: a.string,
|
|
2413
|
-
type: a.string.isRequired,
|
|
2414
|
-
required: a.bool,
|
|
2415
|
-
minLength: a.number,
|
|
2416
|
-
parentClass: a.string,
|
|
2417
|
-
search: a.bool,
|
|
2418
|
-
multiple: a.bool,
|
|
2419
|
-
dropdownMaxHeight: a.string,
|
|
2420
|
-
dragDrop: a.bool,
|
|
2421
|
-
countriesList: a.bool,
|
|
2422
|
-
defaultCountry: a.string,
|
|
2423
|
-
placeholder: a.string,
|
|
2424
|
-
rows: a.number,
|
|
2425
|
-
text: a.string,
|
|
2426
|
-
editorKey: a.string,
|
|
2427
|
-
options: a.arrayOf(Le)
|
|
2428
|
-
}), ba = a.shape({
|
|
2429
|
-
key: a.string,
|
|
2430
|
-
label: a.string,
|
|
2431
|
-
type: a.string,
|
|
2432
|
-
imageKey: a.string,
|
|
2433
|
-
titleKey: a.string,
|
|
2434
|
-
subtitleKey: a.string,
|
|
2435
|
-
blockClass: a.string,
|
|
2436
|
-
icon: a.node,
|
|
2437
|
-
variant: a.string,
|
|
2438
|
-
chipOptions: a.arrayOf(Le),
|
|
2439
|
-
defaultColor: a.string,
|
|
2440
|
-
className: a.string,
|
|
2441
|
-
format: a.string
|
|
2442
|
-
});
|
|
2443
|
-
$e.propTypes = {
|
|
2444
|
-
config: a.shape({
|
|
2445
|
-
title: a.string.isRequired,
|
|
2446
|
-
description: a.string,
|
|
2447
|
-
buttonText: a.string,
|
|
2448
|
-
fetchData: a.func.isRequired,
|
|
2449
|
-
isStaticData: a.bool,
|
|
2450
|
-
/* ================= TABLE CONFIG ================= */
|
|
2451
|
-
tableConfig: a.shape({
|
|
2452
|
-
table_head: a.arrayOf(ua).isRequired,
|
|
2453
|
-
search: a.shape({
|
|
2454
|
-
enabled: a.bool,
|
|
2455
|
-
useServerSideSearch: a.bool,
|
|
2456
|
-
searchKeys: a.arrayOf(a.string)
|
|
2457
|
-
}),
|
|
2458
|
-
pagination: a.shape({
|
|
2459
|
-
enabled: a.bool,
|
|
2460
|
-
useServerSidePagination: a.bool
|
|
2461
|
-
}),
|
|
2462
|
-
filter: a.shape({
|
|
2463
|
-
enabled: a.bool,
|
|
2464
|
-
useServerSideFilters: a.bool
|
|
2465
|
-
})
|
|
2466
|
-
}).isRequired,
|
|
2467
|
-
/* ================= MODAL CONFIG ================= */
|
|
2468
|
-
modalConfig: a.shape({
|
|
2469
|
-
addModal: a.shape({
|
|
2470
|
-
title: a.string.isRequired,
|
|
2471
|
-
size: a.string,
|
|
2472
|
-
formClass: a.string,
|
|
2473
|
-
formFields: a.arrayOf(Se),
|
|
2474
|
-
handleSubmit: a.func.isRequired,
|
|
2475
|
-
actionButtons: a.arrayOf(Ne)
|
|
2476
|
-
}),
|
|
2477
|
-
editModal: a.shape({
|
|
2478
|
-
title: a.string.isRequired,
|
|
2479
|
-
size: a.string,
|
|
2480
|
-
formClass: a.string,
|
|
2481
|
-
formFields: a.arrayOf(Se),
|
|
2482
|
-
handleSubmit: a.func.isRequired,
|
|
2483
|
-
actionButtons: a.arrayOf(Ne)
|
|
2484
|
-
}),
|
|
2485
|
-
deleteModal: a.shape({
|
|
2486
|
-
title: a.string.isRequired,
|
|
2487
|
-
size: a.string,
|
|
2488
|
-
confirmText: a.string,
|
|
2489
|
-
referenceKey: a.string,
|
|
2490
|
-
actionButtons: a.arrayOf(Ne)
|
|
2491
|
-
}),
|
|
2492
|
-
viewModal: a.shape({
|
|
2493
|
-
title: a.string.isRequired,
|
|
2494
|
-
size: a.string,
|
|
2495
|
-
// 👇 This covers your commented code:
|
|
2496
|
-
component: a.elementType,
|
|
2497
|
-
// for custom component like TeamMemberDetail
|
|
2498
|
-
fields: a.arrayOf(ba),
|
|
2499
|
-
footer: a.shape({
|
|
2500
|
-
cancelButton: a.bool,
|
|
2501
|
-
cancelText: a.string
|
|
2502
|
-
})
|
|
2503
|
-
})
|
|
2504
|
-
}),
|
|
2505
|
-
/* ================= FILTER CONFIG ================= */
|
|
2506
|
-
filterConfig: a.shape({
|
|
2507
|
-
fields: a.arrayOf(Se)
|
|
2508
|
-
})
|
|
2509
|
-
}).isRequired
|
|
2510
|
-
};
|
|
2511
|
-
const pa = () => {
|
|
2512
|
-
if (typeof document > "u" || document.getElementById("react-admin-crud-manager-styles")) return;
|
|
2513
|
-
const h = document.createElement("style");
|
|
2514
|
-
h.id = "react-admin-crud-manager-styles";
|
|
2515
|
-
const n = `
|
|
2516
|
-
.no-spinner::-webkit-outer-spin-button,
|
|
2517
|
-
.no-spinner::-webkit-inner-spin-button {
|
|
2518
|
-
-webkit-appearance: none;
|
|
2519
|
-
margin: 0;
|
|
2520
|
-
}
|
|
2521
|
-
|
|
2522
|
-
.no-spinner {
|
|
2523
|
-
-moz-appearance: textfield;
|
|
2524
|
-
}
|
|
2525
|
-
|
|
2526
|
-
.tox.tox-tinymce .tox-edit-area::before {
|
|
2527
|
-
border: 0 !important;
|
|
2528
|
-
box-shadow: none !important;
|
|
2529
|
-
}
|
|
2530
|
-
`;
|
|
2531
|
-
h.textContent = n, document.head.appendChild(h);
|
|
2532
|
-
};
|
|
2533
|
-
function Ma(h) {
|
|
2534
|
-
return H(() => {
|
|
2535
|
-
pa();
|
|
2536
|
-
}, []), /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e($e, { config: h.config }) });
|
|
2537
|
-
}
|
|
2538
|
-
export {
|
|
2539
|
-
Ma as default
|
|
2540
|
-
};
|
|
2541
|
-
//# sourceMappingURL=index.es.js.map
|
|
1
|
+
import { jsx as e, Fragment as E, jsxs as d } from "react/jsx-runtime";
|
|
2
|
+
import Ce, { useState as S, useRef as ae, useEffect as H, useMemo as Me } from "react";
|
|
3
|
+
import { ChevronDown as Te, Search as Re, Check as Ke, X as we, Plus as ze, Filter as He, ChevronLeft as Ye, ChevronRight as Ve, EllipsisVertical as We, User as Fe, Music as qe } from "lucide-react";
|
|
4
|
+
import { createPortal as Ze } from "react-dom";
|
|
5
|
+
import { Icon as te } from "@iconify/react";
|
|
6
|
+
import { Editor as Je } from "@tinymce/tinymce-react";
|
|
7
|
+
import { SnackbarProvider as Qe, enqueueSnackbar as ke } from "notistack";
|
|
8
|
+
import a from "prop-types";
|
|
9
|
+
const Pe = (h, n = "DD MMM YYYY") => {
|
|
10
|
+
if (!h) return "N/A";
|
|
11
|
+
const i = new Date(h);
|
|
12
|
+
if (isNaN(i)) return "Invalid Date";
|
|
13
|
+
const o = (t) => String(t).padStart(2, "0"), s = {
|
|
14
|
+
YYYY: i.getFullYear(),
|
|
15
|
+
YY: String(i.getFullYear()).slice(-2),
|
|
16
|
+
MMMM: i.toLocaleString("en-US", { month: "long" }),
|
|
17
|
+
MMM: i.toLocaleString("en-US", { month: "short" }),
|
|
18
|
+
MM: o(i.getMonth() + 1),
|
|
19
|
+
M: i.getMonth() + 1,
|
|
20
|
+
DD: o(i.getDate()),
|
|
21
|
+
D: i.getDate(),
|
|
22
|
+
dddd: i.toLocaleString("en-US", { weekday: "long" }),
|
|
23
|
+
ddd: i.toLocaleString("en-US", { weekday: "short" }),
|
|
24
|
+
HH: o(i.getHours()),
|
|
25
|
+
hh: o(i.getHours() % 12 || 12),
|
|
26
|
+
mm: o(i.getMinutes()),
|
|
27
|
+
ss: o(i.getSeconds()),
|
|
28
|
+
A: i.getHours() >= 12 ? "PM" : "AM"
|
|
29
|
+
};
|
|
30
|
+
return n.replace(
|
|
31
|
+
/YYYY|YY|MMMM|MMM|MM|M|DD|D|dddd|ddd|HH|hh|mm|ss|A/g,
|
|
32
|
+
(t) => s[t]
|
|
33
|
+
);
|
|
34
|
+
}, Xe = (h, n, i = []) => {
|
|
35
|
+
if (!(n != null && n.trim())) return h;
|
|
36
|
+
const o = n.toLowerCase(), s = (t) => t == null ? [] : typeof t == "object" ? Object.values(t).flatMap(s) : [String(t)];
|
|
37
|
+
return h.filter((t) => {
|
|
38
|
+
let p = [];
|
|
39
|
+
return i.length > 0 ? i.forEach((k) => {
|
|
40
|
+
t[k] !== void 0 && p.push(...s(t[k]));
|
|
41
|
+
}) : p = s(t), p.some(
|
|
42
|
+
(k) => k.toLowerCase().includes(o)
|
|
43
|
+
);
|
|
44
|
+
});
|
|
45
|
+
}, ee = Ce.forwardRef(
|
|
46
|
+
({
|
|
47
|
+
className: h = "",
|
|
48
|
+
variant: n = "contained",
|
|
49
|
+
color: i = "default",
|
|
50
|
+
size: o = "default",
|
|
51
|
+
fullWidth: s = !1,
|
|
52
|
+
children: t,
|
|
53
|
+
...p
|
|
54
|
+
}, k) => {
|
|
55
|
+
var b;
|
|
56
|
+
const M = "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-400 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", u = {
|
|
57
|
+
sm: "h-8 px-3 rounded-md text-sm",
|
|
58
|
+
md: "h-9 px-4 rounded-md text-sm",
|
|
59
|
+
lg: "h-11 px-6 rounded-md text-base",
|
|
60
|
+
xl: "h-12 px-8 rounded-lg text-lg",
|
|
61
|
+
default: "h-9 px-4 rounded-md text-sm"
|
|
62
|
+
}, l = {
|
|
63
|
+
primary: {
|
|
64
|
+
contained: "bg-primary text-white hover:bg-primary-600 focus:ring-primary-500 shadow-sm",
|
|
65
|
+
outlined: "border border-primary bg-transparent text-primary hover:bg-primary-50 focus:ring-primary-500",
|
|
66
|
+
text: "bg-transparent text-primary hover:bg-primary-50 focus:ring-primary-500"
|
|
67
|
+
},
|
|
68
|
+
success: {
|
|
69
|
+
contained: "bg-green-600 text-white hover:bg-green-700 focus:ring-green-500 shadow-sm",
|
|
70
|
+
outlined: "border border-green-600 bg-transparent text-green-600 hover:bg-green-50 focus:ring-green-500",
|
|
71
|
+
text: "bg-transparent text-green-600 hover:bg-green-50 focus:ring-green-500"
|
|
72
|
+
},
|
|
73
|
+
error: {
|
|
74
|
+
contained: "bg-red-600 text-white hover:bg-red-700 focus:ring-red-500 shadow-sm",
|
|
75
|
+
outlined: "border border-red-600 bg-transparent text-red-600 hover:bg-red-50 focus:ring-red-500",
|
|
76
|
+
text: "bg-transparent text-red-600 hover:bg-red-50 focus:ring-red-500"
|
|
77
|
+
},
|
|
78
|
+
default: {
|
|
79
|
+
contained: "border bg-gray-200 text-gray-800 hover:bg-gray-300 focus:ring-gray-300 shadow-sm dark:border-gray-600 dark:bg-gray-700 dark:text-gray-100 dark:hover:bg-gray-600 dark:focus:ring-gray-600",
|
|
80
|
+
outlined: "border border-gray-300 bg-transparent text-gray-700 hover:bg-gray-100 focus:ring-gray-300 dark:border-gray-600 dark:text-gray-200 dark:hover:bg-gray-700 dark:focus:ring-gray-500",
|
|
81
|
+
text: "bg-transparent text-gray-700 hover:bg-gray-100 focus:ring-gray-300 dark:text-gray-200 dark:hover:bg-gray-700 dark:focus:ring-gray-500"
|
|
82
|
+
}
|
|
83
|
+
}, c = ((b = l[i]) == null ? void 0 : b[n]) || l.default.contained, g = u[o], y = `
|
|
84
|
+
${M}
|
|
85
|
+
${c}
|
|
86
|
+
${g}
|
|
87
|
+
${s ? "w-full" : ""}
|
|
88
|
+
${h}
|
|
89
|
+
`.trim();
|
|
90
|
+
return /* @__PURE__ */ e(
|
|
91
|
+
"button",
|
|
92
|
+
{
|
|
93
|
+
ref: k,
|
|
94
|
+
type: p.type || "button",
|
|
95
|
+
className: y,
|
|
96
|
+
...p,
|
|
97
|
+
children: t
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
ee.displayName = "Button";
|
|
103
|
+
function Q({ label: h, required: n = !1 }) {
|
|
104
|
+
return /* @__PURE__ */ e(E, { children: /* @__PURE__ */ d("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: [
|
|
105
|
+
h,
|
|
106
|
+
n && /* @__PURE__ */ e("span", { className: "ml-1", children: "*" })
|
|
107
|
+
] }) });
|
|
108
|
+
}
|
|
109
|
+
const ea = ({
|
|
110
|
+
options: h = [],
|
|
111
|
+
value: n = "",
|
|
112
|
+
defaultValue: i = "",
|
|
113
|
+
onChange: o,
|
|
114
|
+
placeholder: s = "Select option",
|
|
115
|
+
className: t = "",
|
|
116
|
+
disabled: p = !1,
|
|
117
|
+
search: k = !1,
|
|
118
|
+
label: M = "",
|
|
119
|
+
required: u = !1,
|
|
120
|
+
name: l = "",
|
|
121
|
+
parentClass: c = "",
|
|
122
|
+
multiple: g = !1,
|
|
123
|
+
// ✅ NEW
|
|
124
|
+
dropdownMaxHeight: y = "",
|
|
125
|
+
formData: b = {},
|
|
126
|
+
dependencyKey: v = ""
|
|
127
|
+
}) => {
|
|
128
|
+
var q;
|
|
129
|
+
const [x, N] = S(!1), [I, D] = S(""), [C, A] = S(!0), B = ae(null), F = ae(null), [R, j] = S([]);
|
|
130
|
+
let $ = n || n === !1 ? n : i;
|
|
131
|
+
const W = (w) => w == null || w === "" ? "" : String(typeof w == "boolean" ? w : w ?? "");
|
|
132
|
+
H(
|
|
133
|
+
() => {
|
|
134
|
+
(async () => {
|
|
135
|
+
if (typeof h == "function") {
|
|
136
|
+
const z = await h(b);
|
|
137
|
+
j(z);
|
|
138
|
+
} else
|
|
139
|
+
j(h || []);
|
|
140
|
+
})();
|
|
141
|
+
},
|
|
142
|
+
v ? [h, b == null ? void 0 : b[v]] : [h]
|
|
143
|
+
);
|
|
144
|
+
const G = g ? ($ || []).map(W) : W($), K = R.filter(
|
|
145
|
+
(w) => w.label.toLowerCase().includes(I.toLowerCase())
|
|
146
|
+
), U = (w) => {
|
|
147
|
+
const z = W(w);
|
|
148
|
+
return g ? G.includes(z) : z === G;
|
|
149
|
+
};
|
|
150
|
+
H(() => {
|
|
151
|
+
const w = (z) => {
|
|
152
|
+
B.current && !B.current.contains(z.target) && (N(!1), D(""));
|
|
153
|
+
};
|
|
154
|
+
return document.addEventListener("mousedown", w), () => document.removeEventListener("mousedown", w);
|
|
155
|
+
}, []), H(() => {
|
|
156
|
+
if (x && B.current) {
|
|
157
|
+
const w = B.current.getBoundingClientRect(), re = window.innerHeight - w.bottom;
|
|
158
|
+
A(re < 200);
|
|
159
|
+
}
|
|
160
|
+
}, [x]), H(() => {
|
|
161
|
+
x && F.current && F.current.focus();
|
|
162
|
+
}, [x]);
|
|
163
|
+
const O = (w) => {
|
|
164
|
+
let z = w;
|
|
165
|
+
if (w === "true" ? z = !0 : w === "false" && (z = !1), g) {
|
|
166
|
+
const re = G.includes(W(w));
|
|
167
|
+
let J;
|
|
168
|
+
re ? J = n.filter(
|
|
169
|
+
(X) => W(X) !== W(w)
|
|
170
|
+
) : J = [...n || [], z], o(J);
|
|
171
|
+
} else
|
|
172
|
+
o(z), N(!1);
|
|
173
|
+
D("");
|
|
174
|
+
}, Y = g ? R.filter((w) => U(w.value)).map((w) => w.label).join(", ") : (q = R.find((w) => U(w.value))) == null ? void 0 : q.label;
|
|
175
|
+
return H(() => {
|
|
176
|
+
($ || $ === !1) && setTimeout(() => {
|
|
177
|
+
o($);
|
|
178
|
+
}, 100);
|
|
179
|
+
}, []), /* @__PURE__ */ d("div", { className: c || "col-span-12", children: [
|
|
180
|
+
/* @__PURE__ */ e(Q, { label: M, required: u }),
|
|
181
|
+
/* @__PURE__ */ d("div", { className: `relative ${t}`, ref: B, children: [
|
|
182
|
+
/* @__PURE__ */ e(
|
|
183
|
+
"select",
|
|
184
|
+
{
|
|
185
|
+
name: "hidden_select_for_validation",
|
|
186
|
+
value: Y || "",
|
|
187
|
+
required: u,
|
|
188
|
+
multiple: g,
|
|
189
|
+
className: "absolute opacity-0 right-1/2 top-[80%] -translate-x-1/2 -translate-y-1/2 pointer-events-none h-[10px]",
|
|
190
|
+
children: /* @__PURE__ */ e("option", { hidden: !0, value: Y, children: Y })
|
|
191
|
+
}
|
|
192
|
+
),
|
|
193
|
+
/* @__PURE__ */ d(
|
|
194
|
+
"button",
|
|
195
|
+
{
|
|
196
|
+
type: "button",
|
|
197
|
+
onClick: () => !p && N(!x),
|
|
198
|
+
disabled: p,
|
|
199
|
+
className: `w-full h-10 px-3 border border-gray-300 dark:border-gray-600 rounded-md text-left text-sm flex items-center justify-between
|
|
200
|
+
${Y ? "dark:text-white" : "text-gray-500 dark:text-gray-400"}
|
|
201
|
+
${p ? "opacity-50 cursor-not-allowed" : "dark:bg-gray-700"}`,
|
|
202
|
+
children: [
|
|
203
|
+
/* @__PURE__ */ e("span", { className: "truncate", children: Y || s }),
|
|
204
|
+
/* @__PURE__ */ e(
|
|
205
|
+
Te,
|
|
206
|
+
{
|
|
207
|
+
className: `w-4 h-4 transition-transform ${x ? "rotate-180" : ""}`
|
|
208
|
+
}
|
|
209
|
+
)
|
|
210
|
+
]
|
|
211
|
+
}
|
|
212
|
+
),
|
|
213
|
+
x && /* @__PURE__ */ d(
|
|
214
|
+
"div",
|
|
215
|
+
{
|
|
216
|
+
className: `absolute z-50 w-full border rounded-md bg-white dark:bg-gray-700 shadow-lg
|
|
217
|
+
${C ? "bottom-full mb-1" : "top-full mt-1"}`,
|
|
218
|
+
children: [
|
|
219
|
+
k && /* @__PURE__ */ e("div", { className: "p-2 border-b border-gray-200 dark:border-gray-600", children: /* @__PURE__ */ d("div", { className: "relative", children: [
|
|
220
|
+
/* @__PURE__ */ e(Re, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400" }),
|
|
221
|
+
/* @__PURE__ */ e(
|
|
222
|
+
"input",
|
|
223
|
+
{
|
|
224
|
+
ref: F,
|
|
225
|
+
type: "text",
|
|
226
|
+
value: I,
|
|
227
|
+
onChange: (w) => D(w.target.value),
|
|
228
|
+
placeholder: "Search...",
|
|
229
|
+
className: "w-full pl-9 pr-3 py-2 text-sm border rounded-md bg-white dark:bg-gray-800 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none"
|
|
230
|
+
}
|
|
231
|
+
)
|
|
232
|
+
] }) }),
|
|
233
|
+
/* @__PURE__ */ e(
|
|
234
|
+
"div",
|
|
235
|
+
{
|
|
236
|
+
className: "max-h-40 overflow-y-auto",
|
|
237
|
+
style: {
|
|
238
|
+
maxHeight: y || ""
|
|
239
|
+
},
|
|
240
|
+
children: K.length > 0 ? K.map((w) => /* @__PURE__ */ d(
|
|
241
|
+
"button",
|
|
242
|
+
{
|
|
243
|
+
type: "button",
|
|
244
|
+
onClick: () => O(String(w.value)),
|
|
245
|
+
className: `w-full px-3 py-2 text-left text-sm flex items-center justify-between hover:bg-gray-100 dark:hover:bg-gray-600
|
|
246
|
+
${U(w.value) ? "bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300" : ""}`,
|
|
247
|
+
children: [
|
|
248
|
+
/* @__PURE__ */ e("span", { children: w.label }),
|
|
249
|
+
g && U(w.value) && /* @__PURE__ */ e(Ke, { className: "w-4 h-4" })
|
|
250
|
+
]
|
|
251
|
+
},
|
|
252
|
+
String(w.value)
|
|
253
|
+
)) : /* @__PURE__ */ e("div", { className: "px-3 py-2 text-sm text-gray-500 dark:text-gray-400", children: "No options found" })
|
|
254
|
+
}
|
|
255
|
+
)
|
|
256
|
+
]
|
|
257
|
+
}
|
|
258
|
+
)
|
|
259
|
+
] })
|
|
260
|
+
] }, l);
|
|
261
|
+
}, aa = ({
|
|
262
|
+
value: h = !0,
|
|
263
|
+
onChange: n,
|
|
264
|
+
text: i,
|
|
265
|
+
options: o = [],
|
|
266
|
+
label: s,
|
|
267
|
+
required: t,
|
|
268
|
+
name: p = "",
|
|
269
|
+
disabled: k = !1,
|
|
270
|
+
parentClass: M = ""
|
|
271
|
+
}) => {
|
|
272
|
+
const u = o.length > 0 ? o : [
|
|
273
|
+
{ label: "Active", value: !0 },
|
|
274
|
+
{ label: "Inactive", value: !1 }
|
|
275
|
+
];
|
|
276
|
+
return /* @__PURE__ */ e(E, { children: /* @__PURE__ */ d("div", { className: M || "col-span-12", children: [
|
|
277
|
+
/* @__PURE__ */ e(Q, { label: s, required: t }),
|
|
278
|
+
/* @__PURE__ */ d("div", { className: "flex items-center justify-between h-10 gap-4 bg-gray-100 dark:bg-gray-700 px-3 rounded-md border border-gray-100 dark:border-gray-600", children: [
|
|
279
|
+
i && /* @__PURE__ */ e("p", { className: "text-xs text-gray-600 dark:text-gray-400 flex-shrink overflow-hidden text-ellipsis whitespace-nowrap max-w-[200px]", children: i }),
|
|
280
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-6", children: u.map((l, c) => /* @__PURE__ */ d(
|
|
281
|
+
"label",
|
|
282
|
+
{
|
|
283
|
+
className: "flex items-center gap-2 cursor-pointer select-none",
|
|
284
|
+
children: [
|
|
285
|
+
/* @__PURE__ */ e(
|
|
286
|
+
"input",
|
|
287
|
+
{
|
|
288
|
+
type: "radio",
|
|
289
|
+
name: "switch-field",
|
|
290
|
+
required: t && c === 0,
|
|
291
|
+
value: l.value,
|
|
292
|
+
disabled: k,
|
|
293
|
+
checked: h === l.value,
|
|
294
|
+
onChange: () => n(l.value),
|
|
295
|
+
className: "w-4 h-4 border-gray-300 cursor-pointer"
|
|
296
|
+
}
|
|
297
|
+
),
|
|
298
|
+
/* @__PURE__ */ e("span", { className: "text-sm text-gray-700 dark:text-white", children: l.label })
|
|
299
|
+
]
|
|
300
|
+
},
|
|
301
|
+
c
|
|
302
|
+
)) })
|
|
303
|
+
] })
|
|
304
|
+
] }, p) });
|
|
305
|
+
}, xe = [
|
|
306
|
+
{ label: "Afghanistan", code: "AF", phone: "93" },
|
|
307
|
+
{ label: "Aland Islands", code: "AX", phone: "358" },
|
|
308
|
+
{ label: "Albania", code: "AL", phone: "355" },
|
|
309
|
+
{ label: "Algeria", code: "DZ", phone: "213" },
|
|
310
|
+
{ label: "American Samoa", code: "AS", phone: "1" },
|
|
311
|
+
{ label: "Andorra", code: "AD", phone: "376" },
|
|
312
|
+
{ label: "Angola", code: "AO", phone: "244" },
|
|
313
|
+
{ label: "Anguilla", code: "AI", phone: "1" },
|
|
314
|
+
{ label: "Antarctica", code: "AQ", phone: "672" },
|
|
315
|
+
{ label: "Antigua and Barbuda", code: "AG", phone: "1" },
|
|
316
|
+
{ label: "Argentina", code: "AR", phone: "54" },
|
|
317
|
+
{ label: "Armenia", code: "AM", phone: "374" },
|
|
318
|
+
{ label: "Aruba", code: "AW", phone: "297" },
|
|
319
|
+
{ label: "Australia", code: "AU", phone: "61" },
|
|
320
|
+
{ label: "Austria", code: "AT", phone: "43" },
|
|
321
|
+
{ label: "Azerbaijan", code: "AZ", phone: "994" },
|
|
322
|
+
{ label: "Bahrain", code: "BH", phone: "973" },
|
|
323
|
+
{ label: "Bangladesh", code: "BD", phone: "880" },
|
|
324
|
+
{ label: "Barbados", code: "BB", phone: "1" },
|
|
325
|
+
{ label: "Belarus", code: "BY", phone: "375" },
|
|
326
|
+
{ label: "Belgium", code: "BE", phone: "32" },
|
|
327
|
+
{ label: "Belize", code: "BZ", phone: "501" },
|
|
328
|
+
{ label: "Benin", code: "BJ", phone: "229" },
|
|
329
|
+
{ label: "Bermuda", code: "BM", phone: "1" },
|
|
330
|
+
{ label: "Bhutan", code: "BT", phone: "975" },
|
|
331
|
+
{ label: "Bolivia", code: "BO", phone: "591" },
|
|
332
|
+
{ label: "Bonaire, Sint Eustatius and Saba", code: "BQ", phone: "599" },
|
|
333
|
+
{ label: "Bosnia and Herzegovina", code: "BA", phone: "387" },
|
|
334
|
+
{ label: "Botswana", code: "BW", phone: "267" },
|
|
335
|
+
{ label: "Bouvet Island", code: "BV", phone: "0055" },
|
|
336
|
+
{ label: "Brazil", code: "BR", phone: "55" },
|
|
337
|
+
{ label: "British Indian Ocean Territory", code: "IO", phone: "246" },
|
|
338
|
+
{ label: "Brunei", code: "BN", phone: "673" },
|
|
339
|
+
{ label: "Bulgaria", code: "BG", phone: "359" },
|
|
340
|
+
{ label: "Burkina Faso", code: "BF", phone: "226" },
|
|
341
|
+
{ label: "Burundi", code: "BI", phone: "257" },
|
|
342
|
+
{ label: "Cambodia", code: "KH", phone: "855" },
|
|
343
|
+
{ label: "Cameroon", code: "CM", phone: "237" },
|
|
344
|
+
{ label: "Canada", code: "CA", phone: "1" },
|
|
345
|
+
{ label: "Cape Verde", code: "CV", phone: "238" },
|
|
346
|
+
{ label: "Cayman Islands", code: "KY", phone: "1" },
|
|
347
|
+
{ label: "Central African Republic", code: "CF", phone: "236" },
|
|
348
|
+
{ label: "Chad", code: "TD", phone: "235" },
|
|
349
|
+
{ label: "Chile", code: "CL", phone: "56" },
|
|
350
|
+
{ label: "China", code: "CN", phone: "86" },
|
|
351
|
+
{ label: "Christmas Island", code: "CX", phone: "61" },
|
|
352
|
+
{ label: "Cocos (Keeling) Islands", code: "CC", phone: "61" },
|
|
353
|
+
{ label: "Colombia", code: "CO", phone: "57" },
|
|
354
|
+
{ label: "Comoros", code: "KM", phone: "269" },
|
|
355
|
+
{ label: "Congo", code: "CG", phone: "242" },
|
|
356
|
+
{ label: "Cook Islands", code: "CK", phone: "682" },
|
|
357
|
+
{ label: "Costa Rica", code: "CR", phone: "506" },
|
|
358
|
+
{ label: "Croatia", code: "HR", phone: "385" },
|
|
359
|
+
{ label: "Cuba", code: "CU", phone: "53" },
|
|
360
|
+
{ label: "Curaçao", code: "CW", phone: "599" },
|
|
361
|
+
{ label: "Cyprus", code: "CY", phone: "357" },
|
|
362
|
+
{ label: "Czech Republic", code: "CZ", phone: "420" },
|
|
363
|
+
{ label: "Democratic Republic of the Congo", code: "CD", phone: "243" },
|
|
364
|
+
{ label: "Denmark", code: "DK", phone: "45" },
|
|
365
|
+
{ label: "Djibouti", code: "DJ", phone: "253" },
|
|
366
|
+
{ label: "Dominica", code: "DM", phone: "1" },
|
|
367
|
+
{ label: "Dominican Republic", code: "DO", phone: "1" },
|
|
368
|
+
{ label: "Ecuador", code: "EC", phone: "593" },
|
|
369
|
+
{ label: "Egypt", code: "EG", phone: "20" },
|
|
370
|
+
{ label: "El Salvador", code: "SV", phone: "503" },
|
|
371
|
+
{ label: "Equatorial Guinea", code: "GQ", phone: "240" },
|
|
372
|
+
{ label: "Eritrea", code: "ER", phone: "291" },
|
|
373
|
+
{ label: "Estonia", code: "EE", phone: "372" },
|
|
374
|
+
{ label: "Eswatini", code: "SZ", phone: "268" },
|
|
375
|
+
{ label: "Ethiopia", code: "ET", phone: "251" },
|
|
376
|
+
{ label: "Falkland Islands", code: "FK", phone: "500" },
|
|
377
|
+
{ label: "Faroe Islands", code: "FO", phone: "298" },
|
|
378
|
+
{ label: "Fiji Islands", code: "FJ", phone: "679" },
|
|
379
|
+
{ label: "Finland", code: "FI", phone: "358" },
|
|
380
|
+
{ label: "France", code: "FR", phone: "33" },
|
|
381
|
+
{ label: "French Guiana", code: "GF", phone: "594" },
|
|
382
|
+
{ label: "French Polynesia", code: "PF", phone: "689" },
|
|
383
|
+
{ label: "French Southern Territories", code: "TF", phone: "262" },
|
|
384
|
+
{ label: "Gabon", code: "GA", phone: "241" },
|
|
385
|
+
{ label: "Georgia", code: "GE", phone: "995" },
|
|
386
|
+
{ label: "Germany", code: "DE", phone: "49" },
|
|
387
|
+
{ label: "Ghana", code: "GH", phone: "233" },
|
|
388
|
+
{ label: "Gibraltar", code: "GI", phone: "350" },
|
|
389
|
+
{ label: "Greece", code: "GR", phone: "30" },
|
|
390
|
+
{ label: "Greenland", code: "GL", phone: "299" },
|
|
391
|
+
{ label: "Grenada", code: "GD", phone: "1" },
|
|
392
|
+
{ label: "Guadeloupe", code: "GP", phone: "590" },
|
|
393
|
+
{ label: "Guam", code: "GU", phone: "1" },
|
|
394
|
+
{ label: "Guatemala", code: "GT", phone: "502" },
|
|
395
|
+
{ label: "Guernsey", code: "GG", phone: "44" },
|
|
396
|
+
{ label: "Guinea", code: "GN", phone: "224" },
|
|
397
|
+
{ label: "Guinea-Bissau", code: "GW", phone: "245" },
|
|
398
|
+
{ label: "Guyana", code: "GY", phone: "592" },
|
|
399
|
+
{ label: "Haiti", code: "HT", phone: "509" },
|
|
400
|
+
{ label: "Heard Island and McDonald Islands", code: "HM", phone: "672" },
|
|
401
|
+
{ label: "Honduras", code: "HN", phone: "504" },
|
|
402
|
+
{ label: "Hong Kong S.A.R.", code: "HK", phone: "852" },
|
|
403
|
+
{ label: "Hungary", code: "HU", phone: "36" },
|
|
404
|
+
{ label: "Iceland", code: "IS", phone: "354" },
|
|
405
|
+
{ label: "India", code: "IN", phone: "91" },
|
|
406
|
+
{ label: "Indonesia", code: "ID", phone: "62" },
|
|
407
|
+
{ label: "Iran", code: "IR", phone: "98" },
|
|
408
|
+
{ label: "Iraq", code: "IQ", phone: "964" },
|
|
409
|
+
{ label: "Ireland", code: "IE", phone: "353" },
|
|
410
|
+
{ label: "Israel", code: "IL", phone: "972" },
|
|
411
|
+
{ label: "Italy", code: "IT", phone: "39" },
|
|
412
|
+
{ label: "Ivory Coast", code: "CI", phone: "225" },
|
|
413
|
+
{ label: "Jamaica", code: "JM", phone: "1" },
|
|
414
|
+
{ label: "Japan", code: "JP", phone: "81" },
|
|
415
|
+
{ label: "Jersey", code: "JE", phone: "44" },
|
|
416
|
+
{ label: "Jordan", code: "JO", phone: "962" },
|
|
417
|
+
{ label: "Kazakhstan", code: "KZ", phone: "7" },
|
|
418
|
+
{ label: "Kenya", code: "KE", phone: "254" },
|
|
419
|
+
{ label: "Kiribati", code: "KI", phone: "686" },
|
|
420
|
+
{ label: "Kosovo", code: "XK", phone: "383" },
|
|
421
|
+
{ label: "Kuwait", code: "KW", phone: "965" },
|
|
422
|
+
{ label: "Kyrgyzstan", code: "KG", phone: "996" },
|
|
423
|
+
{ label: "Laos", code: "LA", phone: "856" },
|
|
424
|
+
{ label: "Latvia", code: "LV", phone: "371" },
|
|
425
|
+
{ label: "Lebanon", code: "LB", phone: "961" },
|
|
426
|
+
{ label: "Lesotho", code: "LS", phone: "266" },
|
|
427
|
+
{ label: "Liberia", code: "LR", phone: "231" },
|
|
428
|
+
{ label: "Libya", code: "LY", phone: "218" },
|
|
429
|
+
{ label: "Liechtenstein", code: "LI", phone: "423" },
|
|
430
|
+
{ label: "Lithuania", code: "LT", phone: "370" },
|
|
431
|
+
{ label: "Luxembourg", code: "LU", phone: "352" },
|
|
432
|
+
{ label: "Macau S.A.R.", code: "MO", phone: "853" },
|
|
433
|
+
{ label: "Madagascar", code: "MG", phone: "261" },
|
|
434
|
+
{ label: "Malawi", code: "MW", phone: "265" },
|
|
435
|
+
{ label: "Malaysia", code: "MY", phone: "60" },
|
|
436
|
+
{ label: "Maldives", code: "MV", phone: "960" },
|
|
437
|
+
{ label: "Mali", code: "ML", phone: "223" },
|
|
438
|
+
{ label: "Malta", code: "MT", phone: "356" },
|
|
439
|
+
{ label: "Man (Isle of)", code: "IM", phone: "44" },
|
|
440
|
+
{ label: "Marshall Islands", code: "MH", phone: "692" },
|
|
441
|
+
{ label: "Martinique", code: "MQ", phone: "596" },
|
|
442
|
+
{ label: "Mauritania", code: "MR", phone: "222" },
|
|
443
|
+
{ label: "Mauritius", code: "MU", phone: "230" },
|
|
444
|
+
{ label: "Mayotte", code: "YT", phone: "262" },
|
|
445
|
+
{ label: "Mexico", code: "MX", phone: "52" },
|
|
446
|
+
{ label: "Micronesia", code: "FM", phone: "691" },
|
|
447
|
+
{ label: "Moldova", code: "MD", phone: "373" },
|
|
448
|
+
{ label: "Monaco", code: "MC", phone: "377" },
|
|
449
|
+
{ label: "Mongolia", code: "MN", phone: "976" },
|
|
450
|
+
{ label: "Montenegro", code: "ME", phone: "382" },
|
|
451
|
+
{ label: "Montserrat", code: "MS", phone: "1" },
|
|
452
|
+
{ label: "Morocco", code: "MA", phone: "212" },
|
|
453
|
+
{ label: "Mozambique", code: "MZ", phone: "258" },
|
|
454
|
+
{ label: "Myanmar", code: "MM", phone: "95" },
|
|
455
|
+
{ label: "Namibia", code: "NA", phone: "264" },
|
|
456
|
+
{ label: "Nauru", code: "NR", phone: "674" },
|
|
457
|
+
{ label: "Nepal", code: "NP", phone: "977" },
|
|
458
|
+
{ label: "Netherlands", code: "NL", phone: "31" },
|
|
459
|
+
{ label: "New Caledonia", code: "NC", phone: "687" },
|
|
460
|
+
{ label: "New Zealand", code: "NZ", phone: "64" },
|
|
461
|
+
{ label: "Nicaragua", code: "NI", phone: "505" },
|
|
462
|
+
{ label: "Niger", code: "NE", phone: "227" },
|
|
463
|
+
{ label: "Nigeria", code: "NG", phone: "234" },
|
|
464
|
+
{ label: "Niue", code: "NU", phone: "683" },
|
|
465
|
+
{ label: "Norfolk Island", code: "NF", phone: "672" },
|
|
466
|
+
{ label: "North Korea", code: "KP", phone: "850" },
|
|
467
|
+
{ label: "North Macedonia", code: "MK", phone: "389" },
|
|
468
|
+
{ label: "Northern Mariana Islands", code: "MP", phone: "1" },
|
|
469
|
+
{ label: "Norway", code: "NO", phone: "47" },
|
|
470
|
+
{ label: "Oman", code: "OM", phone: "968" },
|
|
471
|
+
{ label: "Pakistan", code: "PK", phone: "92" },
|
|
472
|
+
{ label: "Palau", code: "PW", phone: "680" },
|
|
473
|
+
{ label: "Palestinian Territory Occupied", code: "PS", phone: "970" },
|
|
474
|
+
{ label: "Panama", code: "PA", phone: "507" },
|
|
475
|
+
{ label: "Papua New Guinea", code: "PG", phone: "675" },
|
|
476
|
+
{ label: "Paraguay", code: "PY", phone: "595" },
|
|
477
|
+
{ label: "Peru", code: "PE", phone: "51" },
|
|
478
|
+
{ label: "Philippines", code: "PH", phone: "63" },
|
|
479
|
+
{ label: "Pitcairn Island", code: "PN", phone: "870" },
|
|
480
|
+
{ label: "Poland", code: "PL", phone: "48" },
|
|
481
|
+
{ label: "Portugal", code: "PT", phone: "351" },
|
|
482
|
+
{ label: "Puerto Rico", code: "PR", phone: "1" },
|
|
483
|
+
{ label: "Qatar", code: "QA", phone: "974" },
|
|
484
|
+
{ label: "Reunion", code: "RE", phone: "262" },
|
|
485
|
+
{ label: "Romania", code: "RO", phone: "40" },
|
|
486
|
+
{ label: "Russia", code: "RU", phone: "7" },
|
|
487
|
+
{ label: "Rwanda", code: "RW", phone: "250" },
|
|
488
|
+
{ label: "Saint Helena", code: "SH", phone: "290" },
|
|
489
|
+
{ label: "Saint Kitts and Nevis", code: "KN", phone: "1" },
|
|
490
|
+
{ label: "Saint Lucia", code: "LC", phone: "1" },
|
|
491
|
+
{ label: "Saint Pierre and Miquelon", code: "PM", phone: "508" },
|
|
492
|
+
{ label: "Saint Vincent and the Grenadines", code: "VC", phone: "1" },
|
|
493
|
+
{ label: "Saint-Barthelemy", code: "BL", phone: "590" },
|
|
494
|
+
{ label: "Saint-Martin (French part)", code: "MF", phone: "590" },
|
|
495
|
+
{ label: "Samoa", code: "WS", phone: "685" },
|
|
496
|
+
{ label: "San Marino", code: "SM", phone: "378" },
|
|
497
|
+
{ label: "Sao Tome and Principe", code: "ST", phone: "239" },
|
|
498
|
+
{ label: "Saudi Arabia", code: "SA", phone: "966" },
|
|
499
|
+
{ label: "Senegal", code: "SN", phone: "221" },
|
|
500
|
+
{ label: "Serbia", code: "RS", phone: "381" },
|
|
501
|
+
{ label: "Seychelles", code: "SC", phone: "248" },
|
|
502
|
+
{ label: "Sierra Leone", code: "SL", phone: "232" },
|
|
503
|
+
{ label: "Singapore", code: "SG", phone: "65" },
|
|
504
|
+
{ label: "Sint Maarten (Dutch part)", code: "SX", phone: "1721" },
|
|
505
|
+
{ label: "Slovakia", code: "SK", phone: "421" },
|
|
506
|
+
{ label: "Slovenia", code: "SI", phone: "386" },
|
|
507
|
+
{ label: "Solomon Islands", code: "SB", phone: "677" },
|
|
508
|
+
{ label: "Somalia", code: "SO", phone: "252" },
|
|
509
|
+
{ label: "South Africa", code: "ZA", phone: "27" },
|
|
510
|
+
{ label: "South Georgia", code: "GS", phone: "500" },
|
|
511
|
+
{ label: "South Korea", code: "KR", phone: "82" },
|
|
512
|
+
{ label: "South Sudan", code: "SS", phone: "211" },
|
|
513
|
+
{ label: "Spain", code: "ES", phone: "34" },
|
|
514
|
+
{ label: "Sri Lanka", code: "LK", phone: "94" },
|
|
515
|
+
{ label: "Sudan", code: "SD", phone: "249" },
|
|
516
|
+
{ label: "Suriname", code: "SR", phone: "597" },
|
|
517
|
+
{ label: "Svalbard and Jan Mayen Islands", code: "SJ", phone: "47" },
|
|
518
|
+
{ label: "Sweden", code: "SE", phone: "46" },
|
|
519
|
+
{ label: "Switzerland", code: "CH", phone: "41" },
|
|
520
|
+
{ label: "Syria", code: "SY", phone: "963" },
|
|
521
|
+
{ label: "Taiwan", code: "TW", phone: "886" },
|
|
522
|
+
{ label: "Tajikistan", code: "TJ", phone: "992" },
|
|
523
|
+
{ label: "Tanzania", code: "TZ", phone: "255" },
|
|
524
|
+
{ label: "Thailand", code: "TH", phone: "66" },
|
|
525
|
+
{ label: "The Bahamas", code: "BS", phone: "1" },
|
|
526
|
+
{ label: "The Gambia", code: "GM", phone: "220" },
|
|
527
|
+
{ label: "Timor-Leste", code: "TL", phone: "670" },
|
|
528
|
+
{ label: "Togo", code: "TG", phone: "228" },
|
|
529
|
+
{ label: "Tokelau", code: "TK", phone: "690" },
|
|
530
|
+
{ label: "Tonga", code: "TO", phone: "676" },
|
|
531
|
+
{ label: "Trinidad and Tobago", code: "TT", phone: "1" },
|
|
532
|
+
{ label: "Tunisia", code: "TN", phone: "216" },
|
|
533
|
+
{ label: "Turkey", code: "TR", phone: "90" },
|
|
534
|
+
{ label: "Turkmenistan", code: "TM", phone: "993" },
|
|
535
|
+
{ label: "Turks and Caicos Islands", code: "TC", phone: "1" },
|
|
536
|
+
{ label: "Tuvalu", code: "TV", phone: "688" },
|
|
537
|
+
{ label: "Uganda", code: "UG", phone: "256" },
|
|
538
|
+
{ label: "Ukraine", code: "UA", phone: "380" },
|
|
539
|
+
{ label: "United Arab Emirates", code: "AE", phone: "971" },
|
|
540
|
+
{ label: "United Kingdom", code: "GB", phone: "44" },
|
|
541
|
+
{ label: "United States", code: "US", phone: "1" },
|
|
542
|
+
{ label: "United States Minor Outlying Islands", code: "UM", phone: "1" },
|
|
543
|
+
{ label: "Uruguay", code: "UY", phone: "598" },
|
|
544
|
+
{ label: "Uzbekistan", code: "UZ", phone: "998" },
|
|
545
|
+
{ label: "Vanuatu", code: "VU", phone: "678" },
|
|
546
|
+
{ label: "Vatican City State (Holy See)", code: "VA", phone: "379" },
|
|
547
|
+
{ label: "Venezuela", code: "VE", phone: "58" },
|
|
548
|
+
{ label: "Vietnam", code: "VN", phone: "84" },
|
|
549
|
+
{ label: "Virgin Islands (British)", code: "VG", phone: "1" },
|
|
550
|
+
{ label: "Virgin Islands (US)", code: "VI", phone: "1" },
|
|
551
|
+
{ label: "Wallis and Futuna Islands", code: "WF", phone: "681" },
|
|
552
|
+
{ label: "Western Sahara", code: "EH", phone: "212" },
|
|
553
|
+
{ label: "Yemen", code: "YE", phone: "967" },
|
|
554
|
+
{ label: "Zambia", code: "ZM", phone: "260" },
|
|
555
|
+
{ label: "Zimbabwe", code: "ZW", phone: "263" }
|
|
556
|
+
];
|
|
557
|
+
function ra({
|
|
558
|
+
label: h = "",
|
|
559
|
+
value: n = "",
|
|
560
|
+
name: i = "",
|
|
561
|
+
parentClass: o = "",
|
|
562
|
+
onChange: s,
|
|
563
|
+
disabled: t = !1,
|
|
564
|
+
required: p = !1,
|
|
565
|
+
placeholder: k = "Phone number",
|
|
566
|
+
search: M = !1,
|
|
567
|
+
countriesList: u = !1,
|
|
568
|
+
defaultCountry: l = ""
|
|
569
|
+
}) {
|
|
570
|
+
const c = (R) => xe.find((j) => j.code == R), [g, y] = S(
|
|
571
|
+
c(l) || xe[0]
|
|
572
|
+
), [b, v] = S(""), [x, N] = S(!1), [I, D] = S(""), C = ae();
|
|
573
|
+
H(() => {
|
|
574
|
+
if (typeof n == "string" && n.startsWith("+")) {
|
|
575
|
+
const R = xe.filter((j) => n.startsWith("+" + j.phone)).sort((j, $) => $.phone.length - j.phone.length)[0];
|
|
576
|
+
if (R) {
|
|
577
|
+
y(R), v(n.replace("+" + R.phone, ""));
|
|
578
|
+
return;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
v(n);
|
|
582
|
+
}, [n]);
|
|
583
|
+
const A = (R) => {
|
|
584
|
+
const j = R.target.value.replace(/\D/g, "");
|
|
585
|
+
v(j), g && s && s("+" + g.phone + j);
|
|
586
|
+
}, B = (R) => {
|
|
587
|
+
y(R), s && s("+" + R.phone + b), N(!1), D("");
|
|
588
|
+
};
|
|
589
|
+
H(() => {
|
|
590
|
+
const R = (j) => {
|
|
591
|
+
C.current && !C.current.contains(j.target) && N(!1);
|
|
592
|
+
};
|
|
593
|
+
return document.addEventListener("mousedown", R), () => document.removeEventListener("mousedown", R);
|
|
594
|
+
}, []);
|
|
595
|
+
const F = xe.filter(
|
|
596
|
+
(R) => R.label.toLowerCase().includes(I.toLowerCase()) || R.phone.includes(I)
|
|
597
|
+
);
|
|
598
|
+
return u ? /* @__PURE__ */ e(E, { children: /* @__PURE__ */ d("div", { className: o || "col-span-12", children: [
|
|
599
|
+
/* @__PURE__ */ e(Q, { label: h, required: p }),
|
|
600
|
+
/* @__PURE__ */ d("div", { className: "relative ", ref: C, children: [
|
|
601
|
+
/* @__PURE__ */ d(
|
|
602
|
+
"div",
|
|
603
|
+
{
|
|
604
|
+
className: `h-[40px] flex items-center border rounded-md px-2 bg-white dark:bg-gray-700 transition-all
|
|
605
|
+
${x ? "ring-0.5 ring-blue-100 border-blue-300" : "border-gray-300 dark:border-gray-600"}
|
|
606
|
+
${t ? "opacity-60 cursor-not-allowed" : ""}`,
|
|
607
|
+
children: [
|
|
608
|
+
/* @__PURE__ */ d(
|
|
609
|
+
"button",
|
|
610
|
+
{
|
|
611
|
+
type: "button",
|
|
612
|
+
disabled: t,
|
|
613
|
+
onClick: () => N(!x),
|
|
614
|
+
className: "flex items-center gap-1 pr-2 border-r border-gray-300 dark:border-gray-700 focus:outline-none",
|
|
615
|
+
children: [
|
|
616
|
+
g ? /* @__PURE__ */ e(
|
|
617
|
+
"img",
|
|
618
|
+
{
|
|
619
|
+
src: `https://flagcdn.com/w20/${g.code.toLowerCase()}.png`,
|
|
620
|
+
alt: g.code,
|
|
621
|
+
className: "w-5 h-3 object-cover"
|
|
622
|
+
}
|
|
623
|
+
) : /* @__PURE__ */ e("span", { className: "text-gray-400 text-xs", children: "🌐" }),
|
|
624
|
+
/* @__PURE__ */ e(Te, { className: "w-3 h-3 text-gray-500" })
|
|
625
|
+
]
|
|
626
|
+
}
|
|
627
|
+
),
|
|
628
|
+
g && /* @__PURE__ */ d("span", { className: "ml-2 text-sm text-gray-700 dark:text-gray-200 whitespace-nowrap", children: [
|
|
629
|
+
"+",
|
|
630
|
+
g.phone
|
|
631
|
+
] }),
|
|
632
|
+
/* @__PURE__ */ e(
|
|
633
|
+
"input",
|
|
634
|
+
{
|
|
635
|
+
type: "tel",
|
|
636
|
+
value: b,
|
|
637
|
+
onChange: A,
|
|
638
|
+
required: p,
|
|
639
|
+
disabled: t || !g,
|
|
640
|
+
placeholder: g ? k : "Select a country",
|
|
641
|
+
className: "flex-1 ml-2 bg-transparent outline-none text-sm text-gray-800 dark:text-gray-100 placeholder-gray-400"
|
|
642
|
+
}
|
|
643
|
+
),
|
|
644
|
+
/* @__PURE__ */ e(
|
|
645
|
+
"input",
|
|
646
|
+
{
|
|
647
|
+
type: "tel",
|
|
648
|
+
required: p,
|
|
649
|
+
tabIndex: -1,
|
|
650
|
+
readOnly: !0,
|
|
651
|
+
value: g && b ? "+" + g.phone + b : "",
|
|
652
|
+
style: {
|
|
653
|
+
position: "absolute",
|
|
654
|
+
opacity: 0,
|
|
655
|
+
pointerEvents: "none",
|
|
656
|
+
height: 0
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
)
|
|
660
|
+
]
|
|
661
|
+
}
|
|
662
|
+
),
|
|
663
|
+
x && /* @__PURE__ */ d("div", { className: "absolute top-full left-0 w-full mt-1 border border-gray-300 dark:border-gray-700 rounded-md bg-white dark:bg-gray-700 shadow-lg z-50 max-h-60 overflow-y-auto", children: [
|
|
664
|
+
M && /* @__PURE__ */ e("div", { className: "p-2 border-b border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ d("div", { className: "relative", children: [
|
|
665
|
+
/* @__PURE__ */ e(Re, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400" }),
|
|
666
|
+
/* @__PURE__ */ e(
|
|
667
|
+
"input",
|
|
668
|
+
{
|
|
669
|
+
type: "text",
|
|
670
|
+
value: I,
|
|
671
|
+
onChange: (R) => D(R.target.value),
|
|
672
|
+
placeholder: "Search country...",
|
|
673
|
+
className: "w-full pl-9 pr-3 py-2 text-sm border rounded-md bg-white dark:bg-gray-800 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none "
|
|
674
|
+
}
|
|
675
|
+
)
|
|
676
|
+
] }) }),
|
|
677
|
+
F.map((R) => /* @__PURE__ */ d(
|
|
678
|
+
"button",
|
|
679
|
+
{
|
|
680
|
+
type: "button",
|
|
681
|
+
onClick: () => B(R),
|
|
682
|
+
className: "w-full flex items-center gap-2 px-2 py-1 text-sm hover:bg-blue-50 dark:hover:bg-gray-700 text-gray-800 dark:text-gray-100",
|
|
683
|
+
children: [
|
|
684
|
+
/* @__PURE__ */ e(
|
|
685
|
+
"img",
|
|
686
|
+
{
|
|
687
|
+
src: `https://flagcdn.com/w20/${R.code.toLowerCase()}.png`,
|
|
688
|
+
alt: R.code,
|
|
689
|
+
className: "w-5 h-3 object-cover"
|
|
690
|
+
}
|
|
691
|
+
),
|
|
692
|
+
/* @__PURE__ */ d("span", { children: [
|
|
693
|
+
R.label,
|
|
694
|
+
" (+",
|
|
695
|
+
R.phone,
|
|
696
|
+
")"
|
|
697
|
+
] })
|
|
698
|
+
]
|
|
699
|
+
},
|
|
700
|
+
R.code
|
|
701
|
+
))
|
|
702
|
+
] })
|
|
703
|
+
] })
|
|
704
|
+
] }, i) }) : /* @__PURE__ */ e(E, { children: /* @__PURE__ */ d("div", { className: o || "col-span-12", children: [
|
|
705
|
+
/* @__PURE__ */ e(Q, { label: h, required: p }),
|
|
706
|
+
/* @__PURE__ */ e(
|
|
707
|
+
"input",
|
|
708
|
+
{
|
|
709
|
+
type: "text",
|
|
710
|
+
value: n,
|
|
711
|
+
onChange: (j) => {
|
|
712
|
+
const $ = j.target.value.replace(/[^+\d]/g, ""), W = $.startsWith("+") ? "+" + $.replace(/[+]/g, "").slice(0) : $;
|
|
713
|
+
s(W);
|
|
714
|
+
},
|
|
715
|
+
placeholder: k,
|
|
716
|
+
disabled: t,
|
|
717
|
+
required: p,
|
|
718
|
+
className: `w-full h-10 px-3 text-sm border border-gray-300 dark:border-gray-600 rounded-md \r
|
|
719
|
+
bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:outline-none \r
|
|
720
|
+
focus:ring-1 focus:ring-blue-300 dark:focus:ring-blue-200`,
|
|
721
|
+
inputMode: "tel",
|
|
722
|
+
pattern: "^\\+\\d{1,15}$"
|
|
723
|
+
}
|
|
724
|
+
)
|
|
725
|
+
] }, i) });
|
|
726
|
+
}
|
|
727
|
+
const Ie = Ce.forwardRef(
|
|
728
|
+
({ className: h = "", label: n, required: i, ...o }, s) => {
|
|
729
|
+
const t = `
|
|
730
|
+
placeholder-gray-400 dark:placeholder-gray-400
|
|
731
|
+
${h}
|
|
732
|
+
`.trim();
|
|
733
|
+
return /* @__PURE__ */ e(E, { children: /* @__PURE__ */ d("div", { className: o.parentClass || "col-span-12", children: [
|
|
734
|
+
/* @__PURE__ */ e(Q, { label: n, required: i }),
|
|
735
|
+
/* @__PURE__ */ e("div", { className: "relative", children: /* @__PURE__ */ e(
|
|
736
|
+
"textarea",
|
|
737
|
+
{
|
|
738
|
+
className: t,
|
|
739
|
+
ref: s,
|
|
740
|
+
required: i,
|
|
741
|
+
...o
|
|
742
|
+
}
|
|
743
|
+
) })
|
|
744
|
+
] }, o.name) });
|
|
745
|
+
}
|
|
746
|
+
);
|
|
747
|
+
Ie.displayName = "TextArea";
|
|
748
|
+
const ta = ({
|
|
749
|
+
label: h = "",
|
|
750
|
+
value: n = null,
|
|
751
|
+
onChange: i,
|
|
752
|
+
required: o = !1,
|
|
753
|
+
accept: s = "image/*",
|
|
754
|
+
id: t,
|
|
755
|
+
dragDrop: p = !1,
|
|
756
|
+
name: k = "",
|
|
757
|
+
parentClass: M = ""
|
|
758
|
+
}) => {
|
|
759
|
+
const [u, l] = S(n), [c, g] = S(!1), y = ae(null);
|
|
760
|
+
H(() => (n instanceof File ? l({ file: n, preview: URL.createObjectURL(n) }) : (n != null && n.preview, l(n)), () => {
|
|
761
|
+
u != null && u.preview && u.preview.startsWith("blob:") && URL.revokeObjectURL(u.preview);
|
|
762
|
+
}), [n]);
|
|
763
|
+
const b = (C) => {
|
|
764
|
+
if (!C || C.length === 0)
|
|
765
|
+
return;
|
|
766
|
+
const A = C[0], B = URL.createObjectURL(A), F = { file: A, preview: B };
|
|
767
|
+
u != null && u.preview && u.preview.startsWith("blob:") && URL.revokeObjectURL(u.preview), l(F), i == null || i(A);
|
|
768
|
+
}, v = (C) => {
|
|
769
|
+
C && C.stopPropagation(), u != null && u.preview && u.preview.startsWith("blob:") && URL.revokeObjectURL(u.preview), l(null), i == null || i(null), y.current && (y.current.value = "");
|
|
770
|
+
}, x = (C) => {
|
|
771
|
+
p && (C.preventDefault(), g(!0));
|
|
772
|
+
}, N = (C) => {
|
|
773
|
+
p && (C.preventDefault(), g(!1));
|
|
774
|
+
}, I = (C) => {
|
|
775
|
+
p && (C.preventDefault(), g(!1), b(C.dataTransfer.files));
|
|
776
|
+
}, D = () => {
|
|
777
|
+
y.current.click();
|
|
778
|
+
};
|
|
779
|
+
return /* @__PURE__ */ e(E, { children: /* @__PURE__ */ d("div", { className: M || "col-span-12", children: [
|
|
780
|
+
/* @__PURE__ */ e(Q, { label: h, required: o }),
|
|
781
|
+
/* @__PURE__ */ d(
|
|
782
|
+
"div",
|
|
783
|
+
{
|
|
784
|
+
className: `relative rounded-md p-2 transition-all ${c ? "border-2 border-dashed border-blue-500 bg-blue-50 dark:bg-blue-900/20" : "border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800"}`,
|
|
785
|
+
onDragOver: x,
|
|
786
|
+
onDragLeave: N,
|
|
787
|
+
onDrop: I,
|
|
788
|
+
children: [
|
|
789
|
+
/* @__PURE__ */ e(
|
|
790
|
+
"input",
|
|
791
|
+
{
|
|
792
|
+
ref: y,
|
|
793
|
+
id: t,
|
|
794
|
+
type: "file",
|
|
795
|
+
accept: s,
|
|
796
|
+
onChange: (C) => b(C.target.files),
|
|
797
|
+
required: o && !u,
|
|
798
|
+
className: "absolute opacity-0 right-[50%] top-[80%] -translate-y-1/2 pointer-events-none h-[10px]"
|
|
799
|
+
}
|
|
800
|
+
),
|
|
801
|
+
/* @__PURE__ */ d(
|
|
802
|
+
"div",
|
|
803
|
+
{
|
|
804
|
+
className: `flex items-center space-x-4 transition-all ${c ? "opacity-50" : ""}`,
|
|
805
|
+
children: [
|
|
806
|
+
u ? (
|
|
807
|
+
// Image preview with close button
|
|
808
|
+
/* @__PURE__ */ d("div", { className: "relative group", children: [
|
|
809
|
+
/* @__PURE__ */ e(
|
|
810
|
+
"img",
|
|
811
|
+
{
|
|
812
|
+
src: u.preview || u,
|
|
813
|
+
alt: "preview",
|
|
814
|
+
className: "object-cover w-20 h-20 rounded-full shadow-md"
|
|
815
|
+
}
|
|
816
|
+
),
|
|
817
|
+
!o && /* @__PURE__ */ e(
|
|
818
|
+
"button",
|
|
819
|
+
{
|
|
820
|
+
type: "button",
|
|
821
|
+
onClick: v,
|
|
822
|
+
className: "absolute top-0 -right-2 bg-red-500 text-white rounded-full p-1 shadow-lg hover:bg-red-600 transition-colors focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2",
|
|
823
|
+
"aria-label": "Remove image",
|
|
824
|
+
children: /* @__PURE__ */ e(te, { icon: "mdi:close", className: "w-3 h-3" })
|
|
825
|
+
}
|
|
826
|
+
)
|
|
827
|
+
] })
|
|
828
|
+
) : (
|
|
829
|
+
// Placeholder icon
|
|
830
|
+
/* @__PURE__ */ e("div", { className: "rounded-full bg-gray-100 dark:bg-gray-700 h-20 w-20 flex items-center justify-center", children: /* @__PURE__ */ e(
|
|
831
|
+
te,
|
|
832
|
+
{
|
|
833
|
+
icon: "ri:image-add-fill",
|
|
834
|
+
className: "text-gray-400 w-10 h-10"
|
|
835
|
+
}
|
|
836
|
+
) })
|
|
837
|
+
),
|
|
838
|
+
/* @__PURE__ */ d("div", { className: "flex flex-col items-center space-y-1", children: [
|
|
839
|
+
/* @__PURE__ */ e(
|
|
840
|
+
ee,
|
|
841
|
+
{
|
|
842
|
+
type: "button",
|
|
843
|
+
onClick: D,
|
|
844
|
+
variant: "outlined",
|
|
845
|
+
color: "default",
|
|
846
|
+
children: u ? "Change Image" : "Select Image"
|
|
847
|
+
}
|
|
848
|
+
),
|
|
849
|
+
p && !u && /* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: "or drag and drop" })
|
|
850
|
+
] })
|
|
851
|
+
]
|
|
852
|
+
}
|
|
853
|
+
),
|
|
854
|
+
p && c && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none bg-blue-500/10 rounded-md", children: /* @__PURE__ */ e("span", { className: "text-blue-600 dark:text-blue-400 font-semibold text-lg", children: "Drop image here" }) })
|
|
855
|
+
]
|
|
856
|
+
}
|
|
857
|
+
)
|
|
858
|
+
] }, k) });
|
|
859
|
+
}, Be = Ce.forwardRef(
|
|
860
|
+
({
|
|
861
|
+
label: h,
|
|
862
|
+
required: n,
|
|
863
|
+
parentClass: i = "",
|
|
864
|
+
className: o = "",
|
|
865
|
+
type: s = "text",
|
|
866
|
+
onKeyDown: t,
|
|
867
|
+
negativeNumberAllow: p = !0,
|
|
868
|
+
...k
|
|
869
|
+
}, M) => {
|
|
870
|
+
const [u, l] = S(!1), c = (y) => {
|
|
871
|
+
if (s === "number") {
|
|
872
|
+
if (["e", "E", "+"].includes(y.key)) {
|
|
873
|
+
y.preventDefault();
|
|
874
|
+
return;
|
|
875
|
+
}
|
|
876
|
+
if (p == !1 && y.key === "-") {
|
|
877
|
+
y.preventDefault();
|
|
878
|
+
return;
|
|
879
|
+
}
|
|
880
|
+
if (["ArrowUp", "ArrowDown"].includes(y.key)) {
|
|
881
|
+
y.preventDefault();
|
|
882
|
+
return;
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
t == null || t(y);
|
|
886
|
+
}, g = `
|
|
887
|
+
h-10 placeholder-gray-400 dark:placeholder-gray-400
|
|
888
|
+
${s === "password" ? "pr-10" : ""}
|
|
889
|
+
${s === "number" ? "no-spinner" : ""}
|
|
890
|
+
${o}
|
|
891
|
+
`.trim();
|
|
892
|
+
return /* @__PURE__ */ e(E, { children: /* @__PURE__ */ d("div", { className: i || "col-span-12", children: [
|
|
893
|
+
/* @__PURE__ */ e(Q, { label: h, required: n }),
|
|
894
|
+
/* @__PURE__ */ d("div", { className: "relative", children: [
|
|
895
|
+
/* @__PURE__ */ e(
|
|
896
|
+
"input",
|
|
897
|
+
{
|
|
898
|
+
type: s === "password" && u ? "text" : s,
|
|
899
|
+
ref: M,
|
|
900
|
+
required: n,
|
|
901
|
+
onKeyDown: c,
|
|
902
|
+
className: g,
|
|
903
|
+
...k
|
|
904
|
+
}
|
|
905
|
+
),
|
|
906
|
+
s === "password" && /* @__PURE__ */ e(
|
|
907
|
+
"button",
|
|
908
|
+
{
|
|
909
|
+
type: "button",
|
|
910
|
+
tabIndex: -1,
|
|
911
|
+
onClick: () => l((y) => !y),
|
|
912
|
+
className: "absolute inset-y-0 right-3 flex items-center text-gray-400 hover:text-gray-600 dark:text-gray-400 dark:hover:text-gray-200",
|
|
913
|
+
children: /* @__PURE__ */ e(
|
|
914
|
+
te,
|
|
915
|
+
{
|
|
916
|
+
icon: u ? "mdi:eye-outline" : "mdi:eye-off-outline",
|
|
917
|
+
className: "w-5 h-5"
|
|
918
|
+
}
|
|
919
|
+
)
|
|
920
|
+
}
|
|
921
|
+
)
|
|
922
|
+
] })
|
|
923
|
+
] }, k.name) });
|
|
924
|
+
}
|
|
925
|
+
);
|
|
926
|
+
Be.displayName = "Input";
|
|
927
|
+
const na = ({
|
|
928
|
+
key: h,
|
|
929
|
+
editorKey: n = "",
|
|
930
|
+
value: i = "",
|
|
931
|
+
onChange: o,
|
|
932
|
+
label: s = "",
|
|
933
|
+
required: t = !1,
|
|
934
|
+
placeholder: p = "",
|
|
935
|
+
parentClass: k = "col-span-12",
|
|
936
|
+
height: M = 400,
|
|
937
|
+
inline: u = !1,
|
|
938
|
+
disabled: l = !1,
|
|
939
|
+
plugins: c,
|
|
940
|
+
toolbar: g,
|
|
941
|
+
menubar: y = !1,
|
|
942
|
+
fontFamily: b = "Inter, sans-serif",
|
|
943
|
+
initConfig: v = {},
|
|
944
|
+
imageUploadHandler: x
|
|
945
|
+
// ✅ Promise function passed from parent
|
|
946
|
+
}) => /* @__PURE__ */ d("div", { className: k, children: [
|
|
947
|
+
s && /* @__PURE__ */ e(Q, { label: s, required: t }),
|
|
948
|
+
/* @__PURE__ */ e(
|
|
949
|
+
Je,
|
|
950
|
+
{
|
|
951
|
+
apiKey: n,
|
|
952
|
+
value: i,
|
|
953
|
+
disabled: l,
|
|
954
|
+
init: {
|
|
955
|
+
height: M,
|
|
956
|
+
inline: u,
|
|
957
|
+
menubar: y,
|
|
958
|
+
branding: !1,
|
|
959
|
+
statusbar: !0,
|
|
960
|
+
automatic_uploads: !0,
|
|
961
|
+
images_upload_handler: (C) => new Promise((A, B) => {
|
|
962
|
+
if (!x) {
|
|
963
|
+
A(`data:${C.blob().type};base64,${C.base64()}`);
|
|
964
|
+
return;
|
|
965
|
+
}
|
|
966
|
+
x(C).then((F) => {
|
|
967
|
+
F ? A(F) : B("Upload failed: No URL returned");
|
|
968
|
+
}).catch((F) => {
|
|
969
|
+
B(
|
|
970
|
+
typeof F == "string" ? F : (F == null ? void 0 : F.message) || "Image upload failed"
|
|
971
|
+
);
|
|
972
|
+
});
|
|
973
|
+
}),
|
|
974
|
+
plugins: c ?? [
|
|
975
|
+
"advlist",
|
|
976
|
+
"autolink",
|
|
977
|
+
"lists",
|
|
978
|
+
"link",
|
|
979
|
+
"image",
|
|
980
|
+
"charmap",
|
|
981
|
+
"preview",
|
|
982
|
+
"anchor",
|
|
983
|
+
"searchreplace",
|
|
984
|
+
"visualblocks",
|
|
985
|
+
"code",
|
|
986
|
+
"fullscreen",
|
|
987
|
+
"insertdatetime",
|
|
988
|
+
"media",
|
|
989
|
+
"table",
|
|
990
|
+
"help",
|
|
991
|
+
"wordcount"
|
|
992
|
+
],
|
|
993
|
+
toolbar: g ?? "undo redo | blocks | bold italic underline forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image media table | removeformat | code fullscreen preview",
|
|
994
|
+
placeholder: p,
|
|
995
|
+
content_style: `
|
|
996
|
+
body {
|
|
997
|
+
font-family: ${b};
|
|
998
|
+
}
|
|
999
|
+
`,
|
|
1000
|
+
...v
|
|
1001
|
+
},
|
|
1002
|
+
onEditorChange: (C) => {
|
|
1003
|
+
o && o(C);
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
)
|
|
1007
|
+
] }, h), la = ({
|
|
1008
|
+
name: h = "",
|
|
1009
|
+
label: n = "",
|
|
1010
|
+
// label for single checkbox
|
|
1011
|
+
options: i = [],
|
|
1012
|
+
// array of { label, value } for multiple
|
|
1013
|
+
value: o = null,
|
|
1014
|
+
// boolean for single, array for multiple, or string for single select
|
|
1015
|
+
onChange: s,
|
|
1016
|
+
disabled: t = !1,
|
|
1017
|
+
required: p = !1,
|
|
1018
|
+
parentClass: k = "col-span-12",
|
|
1019
|
+
className: M = "",
|
|
1020
|
+
multiSelect: u = !1
|
|
1021
|
+
// ✅ if true, only one option can be selected (like radio)
|
|
1022
|
+
}) => {
|
|
1023
|
+
const l = Array.isArray(i) && i.length > 0, c = (b) => l ? u ? Array.isArray(o) && o.includes(b) : o === b : !!o, g = (b) => {
|
|
1024
|
+
s == null || s(b.target.checked, h);
|
|
1025
|
+
}, y = (b, v) => {
|
|
1026
|
+
if (s)
|
|
1027
|
+
if (!u)
|
|
1028
|
+
s(v ? b : "", h);
|
|
1029
|
+
else {
|
|
1030
|
+
const x = Array.isArray(o) ? [...o] : [];
|
|
1031
|
+
if (v)
|
|
1032
|
+
x.includes(b) || x.push(b);
|
|
1033
|
+
else {
|
|
1034
|
+
const N = x.indexOf(b);
|
|
1035
|
+
N > -1 && x.splice(N, 1);
|
|
1036
|
+
}
|
|
1037
|
+
s(x, h);
|
|
1038
|
+
}
|
|
1039
|
+
};
|
|
1040
|
+
return l ? /* @__PURE__ */ e(E, { children: /* @__PURE__ */ d("div", { className: `${k}`, children: [
|
|
1041
|
+
/* @__PURE__ */ e(Q, { label: n, required: p }),
|
|
1042
|
+
/* @__PURE__ */ e("div", { className: "flex flex-col space-y-2", children: i.map((b, v) => /* @__PURE__ */ d("div", { className: "flex items-center", children: [
|
|
1043
|
+
/* @__PURE__ */ e(
|
|
1044
|
+
"input",
|
|
1045
|
+
{
|
|
1046
|
+
type: "checkbox",
|
|
1047
|
+
name: h,
|
|
1048
|
+
value: b.value,
|
|
1049
|
+
checked: c(b.value),
|
|
1050
|
+
disabled: t || b.disabled,
|
|
1051
|
+
required: p && v === 0,
|
|
1052
|
+
onChange: (x) => y(b.value, x.target.checked),
|
|
1053
|
+
className: `h-4 w-4 cursor-pointer text-blue-600 border-gray-300 rounded focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 ${M}`
|
|
1054
|
+
},
|
|
1055
|
+
h
|
|
1056
|
+
),
|
|
1057
|
+
b.label && /* @__PURE__ */ e(
|
|
1058
|
+
"label",
|
|
1059
|
+
{
|
|
1060
|
+
htmlFor: h,
|
|
1061
|
+
className: "ml-2 text-sm text-gray-700 dark:text-gray-200 select-none",
|
|
1062
|
+
children: b.label
|
|
1063
|
+
}
|
|
1064
|
+
)
|
|
1065
|
+
] }, b.value || b.label)) })
|
|
1066
|
+
] }) }) : /* @__PURE__ */ d("div", { className: `flex items-center ${k}`, children: [
|
|
1067
|
+
/* @__PURE__ */ e(
|
|
1068
|
+
"input",
|
|
1069
|
+
{
|
|
1070
|
+
type: "checkbox",
|
|
1071
|
+
name: h,
|
|
1072
|
+
checked: c(),
|
|
1073
|
+
disabled: t,
|
|
1074
|
+
required: p,
|
|
1075
|
+
onChange: g,
|
|
1076
|
+
className: `h-4 w-4 text-blue-600 cursor-pointer border-gray-300 rounded focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 ${M}`
|
|
1077
|
+
}
|
|
1078
|
+
),
|
|
1079
|
+
n && /* @__PURE__ */ e(
|
|
1080
|
+
"label",
|
|
1081
|
+
{
|
|
1082
|
+
htmlFor: h,
|
|
1083
|
+
className: "ml-2 text-sm text-gray-700 dark:text-gray-200 select-none",
|
|
1084
|
+
children: n
|
|
1085
|
+
}
|
|
1086
|
+
)
|
|
1087
|
+
] });
|
|
1088
|
+
}, oa = ({
|
|
1089
|
+
label: h = "",
|
|
1090
|
+
value: n = null,
|
|
1091
|
+
onChange: i,
|
|
1092
|
+
required: o = !1,
|
|
1093
|
+
accept: s = "audio/*",
|
|
1094
|
+
id: t,
|
|
1095
|
+
dragDrop: p = !1,
|
|
1096
|
+
name: k = "",
|
|
1097
|
+
parentClass: M = ""
|
|
1098
|
+
}) => {
|
|
1099
|
+
const [u, l] = S(null), [c, g] = S(!1), y = ae(null);
|
|
1100
|
+
H(() => {
|
|
1101
|
+
if (!n) {
|
|
1102
|
+
b(), l(null);
|
|
1103
|
+
return;
|
|
1104
|
+
}
|
|
1105
|
+
if (n instanceof File) {
|
|
1106
|
+
const A = URL.createObjectURL(n);
|
|
1107
|
+
return l({ file: n, preview: A }), () => {
|
|
1108
|
+
URL.revokeObjectURL(A);
|
|
1109
|
+
};
|
|
1110
|
+
} else typeof n == "string" ? l({ preview: n }) : n != null && n.preview && l(n);
|
|
1111
|
+
}, [n]);
|
|
1112
|
+
const b = () => {
|
|
1113
|
+
u != null && u.preview && u.preview.startsWith("blob:") && URL.revokeObjectURL(u.preview);
|
|
1114
|
+
}, v = (A) => {
|
|
1115
|
+
if (!A || A.length === 0)
|
|
1116
|
+
return;
|
|
1117
|
+
const B = A[0], F = URL.createObjectURL(B);
|
|
1118
|
+
b(), l({ file: B, preview: F }), i == null || i(B);
|
|
1119
|
+
}, x = (A) => {
|
|
1120
|
+
A && A.stopPropagation(), b(), l(null), i == null || i(null), y.current && (y.current.value = "");
|
|
1121
|
+
}, N = (A) => {
|
|
1122
|
+
p && (A.preventDefault(), g(!0));
|
|
1123
|
+
}, I = (A) => {
|
|
1124
|
+
p && (A.preventDefault(), g(!1));
|
|
1125
|
+
}, D = (A) => {
|
|
1126
|
+
p && (A.preventDefault(), g(!1), v(A.dataTransfer.files));
|
|
1127
|
+
}, C = () => {
|
|
1128
|
+
y.current.click();
|
|
1129
|
+
};
|
|
1130
|
+
return /* @__PURE__ */ d("div", { className: M || "col-span-12", children: [
|
|
1131
|
+
/* @__PURE__ */ e(Q, { label: h, required: o }),
|
|
1132
|
+
/* @__PURE__ */ d(
|
|
1133
|
+
"div",
|
|
1134
|
+
{
|
|
1135
|
+
className: `relative rounded-lg p-2 transition-all ${c ? "border-2 border-dashed border-blue-500 bg-blue-50 dark:bg-blue-900/20" : "border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800"}`,
|
|
1136
|
+
onDragOver: N,
|
|
1137
|
+
onDragLeave: I,
|
|
1138
|
+
onDrop: D,
|
|
1139
|
+
children: [
|
|
1140
|
+
/* @__PURE__ */ e(
|
|
1141
|
+
"input",
|
|
1142
|
+
{
|
|
1143
|
+
ref: y,
|
|
1144
|
+
id: t,
|
|
1145
|
+
type: "file",
|
|
1146
|
+
accept: s,
|
|
1147
|
+
onChange: (A) => v(A.target.files),
|
|
1148
|
+
required: o && !u,
|
|
1149
|
+
className: "absolute opacity-0 right-[50%] top-[80%] -translate-y-1/2 pointer-events-none h-[10px]"
|
|
1150
|
+
}
|
|
1151
|
+
),
|
|
1152
|
+
/* @__PURE__ */ e(
|
|
1153
|
+
"div",
|
|
1154
|
+
{
|
|
1155
|
+
className: `flex items-center space-x-4 transition-all ${c ? "opacity-50" : ""}`,
|
|
1156
|
+
children: u ? (
|
|
1157
|
+
// Audio player with close button and change button
|
|
1158
|
+
/* @__PURE__ */ d("div", { className: "flex items-center space-x-4", children: [
|
|
1159
|
+
/* @__PURE__ */ d("div", { className: "relative w-full", children: [
|
|
1160
|
+
!o && /* @__PURE__ */ e(
|
|
1161
|
+
"button",
|
|
1162
|
+
{
|
|
1163
|
+
type: "button",
|
|
1164
|
+
onClick: x,
|
|
1165
|
+
className: "absolute top-0 -right-2 bg-red-500 text-white rounded-full p-1 shadow-lg hover:bg-red-600 transition-colors z-10 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 dark:focus:ring-offset-gray-800",
|
|
1166
|
+
"aria-label": "Remove audio",
|
|
1167
|
+
children: /* @__PURE__ */ e(te, { icon: "mdi:close", className: "w-3 h-3" })
|
|
1168
|
+
}
|
|
1169
|
+
),
|
|
1170
|
+
/* @__PURE__ */ e(
|
|
1171
|
+
"audio",
|
|
1172
|
+
{
|
|
1173
|
+
src: u.preview,
|
|
1174
|
+
controls: !0,
|
|
1175
|
+
controlsList: "nodownload"
|
|
1176
|
+
},
|
|
1177
|
+
u.preview
|
|
1178
|
+
)
|
|
1179
|
+
] }),
|
|
1180
|
+
/* @__PURE__ */ e(ee, { type: "button", onClick: C, children: /* @__PURE__ */ e("span", { children: "Change Audio File" }) })
|
|
1181
|
+
] })
|
|
1182
|
+
) : (
|
|
1183
|
+
// Empty state with upload button
|
|
1184
|
+
/* @__PURE__ */ d("div", { className: "flex items-center justify-center space-x-4", children: [
|
|
1185
|
+
/* @__PURE__ */ e("div", { className: "rounded-full bg-gray-100 dark:bg-gray-700 h-20 w-20 flex items-center justify-center", children: /* @__PURE__ */ e(te, { icon: "mdi:music", className: "text-gray-400 w-10 h-10" }) }),
|
|
1186
|
+
/* @__PURE__ */ e(
|
|
1187
|
+
ee,
|
|
1188
|
+
{
|
|
1189
|
+
type: "button",
|
|
1190
|
+
onClick: C,
|
|
1191
|
+
variant: "outlined",
|
|
1192
|
+
children: /* @__PURE__ */ e("span", { children: "Choose Audio File" })
|
|
1193
|
+
}
|
|
1194
|
+
),
|
|
1195
|
+
p && /* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: "or drag and drop your audio file here" })
|
|
1196
|
+
] })
|
|
1197
|
+
)
|
|
1198
|
+
}
|
|
1199
|
+
),
|
|
1200
|
+
p && c && !u && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none bg-blue-500/10 rounded-lg", children: /* @__PURE__ */ e("span", { className: "text-blue-600 dark:text-blue-400 font-semibold text-lg bg-white dark:bg-gray-800 px-4 py-2 rounded-lg shadow-lg", children: "Drop audio here" }) })
|
|
1201
|
+
]
|
|
1202
|
+
}
|
|
1203
|
+
)
|
|
1204
|
+
] }, k);
|
|
1205
|
+
}, Ue = ({ field: h, formData: n, handleChange: i }) => {
|
|
1206
|
+
const {
|
|
1207
|
+
key: o,
|
|
1208
|
+
label: s,
|
|
1209
|
+
type: t,
|
|
1210
|
+
options: p,
|
|
1211
|
+
placeholder: k,
|
|
1212
|
+
rows: M,
|
|
1213
|
+
inputClass: u,
|
|
1214
|
+
search: l,
|
|
1215
|
+
accept: c,
|
|
1216
|
+
text: g,
|
|
1217
|
+
required: y = !1,
|
|
1218
|
+
minLength: b,
|
|
1219
|
+
dragDrop: v,
|
|
1220
|
+
parentClass: x,
|
|
1221
|
+
countriesList: N,
|
|
1222
|
+
defaultCountry: I,
|
|
1223
|
+
multiple: D,
|
|
1224
|
+
dropdownMaxHeight: C,
|
|
1225
|
+
editorKey: A,
|
|
1226
|
+
fontFamily: B,
|
|
1227
|
+
disabled: F,
|
|
1228
|
+
negativeNumberAllow: R,
|
|
1229
|
+
defaultValue: j,
|
|
1230
|
+
renderCondition: $,
|
|
1231
|
+
optionDependencyKey: W
|
|
1232
|
+
} = h;
|
|
1233
|
+
let G = n == null ? void 0 : n[o];
|
|
1234
|
+
G == null && (G = "");
|
|
1235
|
+
const K = k || (t === "select" ? `Select ${s}` : `Enter ${s}`), U = "w-full px-3 py-2 rounded-md border border-gray-300 dark:border-gray-600 text-sm focus:outline-none focus:ring-1 focus:ring-blue-200 bg-white text-black dark:bg-gray-700 dark:text-white";
|
|
1236
|
+
if ($ && typeof $ == "function" && !$(n))
|
|
1237
|
+
return null;
|
|
1238
|
+
switch (t) {
|
|
1239
|
+
case "select":
|
|
1240
|
+
return /* @__PURE__ */ e(
|
|
1241
|
+
ea,
|
|
1242
|
+
{
|
|
1243
|
+
options: p || [],
|
|
1244
|
+
value: G,
|
|
1245
|
+
formData: n,
|
|
1246
|
+
dependencyKey: W,
|
|
1247
|
+
onChange: (O) => i(o, O),
|
|
1248
|
+
placeholder: K,
|
|
1249
|
+
className: u || "",
|
|
1250
|
+
search: l,
|
|
1251
|
+
required: y,
|
|
1252
|
+
defaultValue: j,
|
|
1253
|
+
label: s,
|
|
1254
|
+
name: o,
|
|
1255
|
+
disabled: F,
|
|
1256
|
+
parentClass: x,
|
|
1257
|
+
multiple: D,
|
|
1258
|
+
dropdownMaxHeight: C
|
|
1259
|
+
}
|
|
1260
|
+
);
|
|
1261
|
+
case "checkbox":
|
|
1262
|
+
return /* @__PURE__ */ e(
|
|
1263
|
+
la,
|
|
1264
|
+
{
|
|
1265
|
+
name: o,
|
|
1266
|
+
label: s,
|
|
1267
|
+
options: p || [],
|
|
1268
|
+
value: G,
|
|
1269
|
+
onChange: (O) => i(o, O),
|
|
1270
|
+
required: y,
|
|
1271
|
+
parentClass: x,
|
|
1272
|
+
className: u || "",
|
|
1273
|
+
multiSelect: D,
|
|
1274
|
+
disabled: F
|
|
1275
|
+
}
|
|
1276
|
+
);
|
|
1277
|
+
case "switch":
|
|
1278
|
+
return /* @__PURE__ */ e(
|
|
1279
|
+
aa,
|
|
1280
|
+
{
|
|
1281
|
+
value: G,
|
|
1282
|
+
onChange: (O) => i(o, O),
|
|
1283
|
+
text: g,
|
|
1284
|
+
options: p || [],
|
|
1285
|
+
label: s,
|
|
1286
|
+
required: y,
|
|
1287
|
+
name: o,
|
|
1288
|
+
disabled: F,
|
|
1289
|
+
parentClass: x
|
|
1290
|
+
}
|
|
1291
|
+
);
|
|
1292
|
+
case "phone":
|
|
1293
|
+
return /* @__PURE__ */ e(
|
|
1294
|
+
ra,
|
|
1295
|
+
{
|
|
1296
|
+
value: G,
|
|
1297
|
+
onChange: (O) => i(o, O),
|
|
1298
|
+
countriesList: N,
|
|
1299
|
+
defaultCountry: I,
|
|
1300
|
+
required: y,
|
|
1301
|
+
placeholder: K,
|
|
1302
|
+
search: l,
|
|
1303
|
+
label: s,
|
|
1304
|
+
name: o,
|
|
1305
|
+
disabled: F,
|
|
1306
|
+
parentClass: x
|
|
1307
|
+
}
|
|
1308
|
+
);
|
|
1309
|
+
case "textarea":
|
|
1310
|
+
return /* @__PURE__ */ e(
|
|
1311
|
+
Ie,
|
|
1312
|
+
{
|
|
1313
|
+
value: G,
|
|
1314
|
+
onChange: (O) => i(o, O.target.value),
|
|
1315
|
+
placeholder: K,
|
|
1316
|
+
rows: M || 3,
|
|
1317
|
+
className: `${U} ${u || ""}`,
|
|
1318
|
+
required: y,
|
|
1319
|
+
name: o,
|
|
1320
|
+
label: s,
|
|
1321
|
+
disabled: F,
|
|
1322
|
+
parentClass: x
|
|
1323
|
+
}
|
|
1324
|
+
);
|
|
1325
|
+
case "image":
|
|
1326
|
+
return /* @__PURE__ */ e(
|
|
1327
|
+
ta,
|
|
1328
|
+
{
|
|
1329
|
+
value: G,
|
|
1330
|
+
onChange: (O) => i(o, O),
|
|
1331
|
+
required: y,
|
|
1332
|
+
accept: c || "image/*",
|
|
1333
|
+
id: `file-${o}`,
|
|
1334
|
+
dragDrop: v,
|
|
1335
|
+
label: s,
|
|
1336
|
+
name: o,
|
|
1337
|
+
parentClass: x
|
|
1338
|
+
}
|
|
1339
|
+
);
|
|
1340
|
+
case "audio":
|
|
1341
|
+
return /* @__PURE__ */ e(
|
|
1342
|
+
oa,
|
|
1343
|
+
{
|
|
1344
|
+
value: G,
|
|
1345
|
+
onChange: (O) => i(o, O),
|
|
1346
|
+
required: y,
|
|
1347
|
+
accept: c || "audio/*",
|
|
1348
|
+
id: `file-${o}`,
|
|
1349
|
+
dragDrop: v,
|
|
1350
|
+
label: s,
|
|
1351
|
+
name: o,
|
|
1352
|
+
parentClass: x
|
|
1353
|
+
}
|
|
1354
|
+
);
|
|
1355
|
+
case "tinyEditor":
|
|
1356
|
+
return /* @__PURE__ */ e(
|
|
1357
|
+
na,
|
|
1358
|
+
{
|
|
1359
|
+
value: G,
|
|
1360
|
+
onChange: (O) => i(o, O),
|
|
1361
|
+
required: y,
|
|
1362
|
+
placeholder: K,
|
|
1363
|
+
label: s,
|
|
1364
|
+
parentClass: x,
|
|
1365
|
+
fontFamily: B,
|
|
1366
|
+
editorKey: A,
|
|
1367
|
+
disabled: F
|
|
1368
|
+
},
|
|
1369
|
+
`editor-${o}`
|
|
1370
|
+
);
|
|
1371
|
+
default:
|
|
1372
|
+
return /* @__PURE__ */ e(
|
|
1373
|
+
Be,
|
|
1374
|
+
{
|
|
1375
|
+
type: t || "text",
|
|
1376
|
+
value: G,
|
|
1377
|
+
onChange: (O) => i(o, O.target.value),
|
|
1378
|
+
placeholder: K,
|
|
1379
|
+
className: `${U} ${u || ""}`,
|
|
1380
|
+
required: y,
|
|
1381
|
+
name: o,
|
|
1382
|
+
minLength: b,
|
|
1383
|
+
label: s,
|
|
1384
|
+
negativeNumberAllow: R,
|
|
1385
|
+
parentClass: x,
|
|
1386
|
+
disabled: F
|
|
1387
|
+
}
|
|
1388
|
+
);
|
|
1389
|
+
}
|
|
1390
|
+
}, ia = ({ isOpen: h, onClose: n, config: i, onApply: o }) => {
|
|
1391
|
+
var u;
|
|
1392
|
+
const [s, t] = S({}), p = (l, c) => {
|
|
1393
|
+
t((g) => ({ ...g, [l]: c }));
|
|
1394
|
+
}, k = () => {
|
|
1395
|
+
o == null || o(s), n();
|
|
1396
|
+
}, M = () => {
|
|
1397
|
+
t({}), o == null || o({}), n();
|
|
1398
|
+
};
|
|
1399
|
+
return /* @__PURE__ */ d(E, { children: [
|
|
1400
|
+
/* @__PURE__ */ e(
|
|
1401
|
+
"div",
|
|
1402
|
+
{
|
|
1403
|
+
className: `fixed inset-0 bg-black/50 z-40 transition-opacity duration-300 ${h ? "opacity-100 pointer-events-auto" : "opacity-0 pointer-events-none"}`,
|
|
1404
|
+
onClick: n
|
|
1405
|
+
}
|
|
1406
|
+
),
|
|
1407
|
+
/* @__PURE__ */ d(
|
|
1408
|
+
"div",
|
|
1409
|
+
{
|
|
1410
|
+
className: `fixed top-0 right-0 h-full w-[28rem] bg-white dark:bg-gray-900 shadow-2xl z-50 flex flex-col border-l border-gray-200 dark:border-gray-700
|
|
1411
|
+
transform transition-transform duration-300 ease-in-out
|
|
1412
|
+
${h ? "translate-x-0" : "translate-x-full"}
|
|
1413
|
+
`,
|
|
1414
|
+
children: [
|
|
1415
|
+
/* @__PURE__ */ d("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-700", children: [
|
|
1416
|
+
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: "Filters" }),
|
|
1417
|
+
/* @__PURE__ */ e(
|
|
1418
|
+
"button",
|
|
1419
|
+
{
|
|
1420
|
+
onClick: n,
|
|
1421
|
+
className: "p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-md transition",
|
|
1422
|
+
children: /* @__PURE__ */ e(we, { className: "w-5 h-5 text-gray-500 dark:text-gray-400" })
|
|
1423
|
+
}
|
|
1424
|
+
)
|
|
1425
|
+
] }),
|
|
1426
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto px-4 py-3", children: i != null && i.component ? /* @__PURE__ */ e(i.component, { filters: s, onFilterChange: p }) : /* @__PURE__ */ e("div", { className: "space-y-4", children: (u = i == null ? void 0 : i.fields) == null ? void 0 : u.map((l) => /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(
|
|
1427
|
+
Ue,
|
|
1428
|
+
{
|
|
1429
|
+
field: l,
|
|
1430
|
+
formData: s,
|
|
1431
|
+
handleChange: p
|
|
1432
|
+
},
|
|
1433
|
+
l.key
|
|
1434
|
+
) })) }) }),
|
|
1435
|
+
/* @__PURE__ */ d("div", { className: "flex gap-2 px-4 py-3 border-t border-gray-200 dark:border-gray-700", children: [
|
|
1436
|
+
/* @__PURE__ */ e(
|
|
1437
|
+
ee,
|
|
1438
|
+
{
|
|
1439
|
+
onClick: k,
|
|
1440
|
+
variant: "contained",
|
|
1441
|
+
color: "primary",
|
|
1442
|
+
fullWidth: !0,
|
|
1443
|
+
children: "Apply Filters"
|
|
1444
|
+
}
|
|
1445
|
+
),
|
|
1446
|
+
/* @__PURE__ */ e(
|
|
1447
|
+
ee,
|
|
1448
|
+
{
|
|
1449
|
+
onClick: M,
|
|
1450
|
+
variant: "contained",
|
|
1451
|
+
className: "min-w-[150px]",
|
|
1452
|
+
children: "Reset"
|
|
1453
|
+
}
|
|
1454
|
+
)
|
|
1455
|
+
] })
|
|
1456
|
+
]
|
|
1457
|
+
}
|
|
1458
|
+
)
|
|
1459
|
+
] });
|
|
1460
|
+
}, Oe = {
|
|
1461
|
+
blue: {
|
|
1462
|
+
bg: "bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",
|
|
1463
|
+
border: "border border-blue-300 text-blue-700 dark:border-blue-700 dark:text-blue-300"
|
|
1464
|
+
},
|
|
1465
|
+
teal: {
|
|
1466
|
+
bg: "bg-teal-100 text-teal-800 dark:bg-teal-900/30 dark:text-teal-300",
|
|
1467
|
+
border: "border border-teal-300 text-teal-700 dark:border-teal-700 dark:text-teal-300"
|
|
1468
|
+
},
|
|
1469
|
+
purple: {
|
|
1470
|
+
bg: "bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300",
|
|
1471
|
+
border: "border border-purple-300 text-purple-700 dark:border-purple-700 dark:text-purple-300"
|
|
1472
|
+
},
|
|
1473
|
+
yellow: {
|
|
1474
|
+
bg: "bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-300",
|
|
1475
|
+
border: "border border-yellow-300 text-yellow-700 dark:border-yellow-700 dark:text-yellow-300"
|
|
1476
|
+
},
|
|
1477
|
+
green: {
|
|
1478
|
+
bg: "bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300",
|
|
1479
|
+
border: "border border-green-300 text-green-700 dark:border-green-700 dark:text-green-300"
|
|
1480
|
+
},
|
|
1481
|
+
red: {
|
|
1482
|
+
bg: "bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300",
|
|
1483
|
+
border: "border border-red-300 text-red-700 dark:border-red-700 dark:text-red-300"
|
|
1484
|
+
},
|
|
1485
|
+
gray: {
|
|
1486
|
+
bg: "bg-gray-100 text-gray-800 dark:bg-gray-900/30 dark:text-gray-300",
|
|
1487
|
+
border: "border border-gray-300 text-gray-700 dark:border-gray-700 dark:text-gray-300"
|
|
1488
|
+
}
|
|
1489
|
+
}, Ae = {
|
|
1490
|
+
contained: "bg",
|
|
1491
|
+
outline: "border !bg-transparent",
|
|
1492
|
+
soft: "bg opacity-90"
|
|
1493
|
+
}, je = ({
|
|
1494
|
+
label: h,
|
|
1495
|
+
variant: n = "contained",
|
|
1496
|
+
// contained | outline | soft
|
|
1497
|
+
color: i = "green",
|
|
1498
|
+
className: o = ""
|
|
1499
|
+
}) => {
|
|
1500
|
+
const s = Oe[i] || Oe.green, t = Ae[n] || Ae.contained, p = n === "outline" ? s.border : s.bg;
|
|
1501
|
+
return /* @__PURE__ */ e(
|
|
1502
|
+
"span",
|
|
1503
|
+
{
|
|
1504
|
+
className: `inline-flex justify-center items-center rounded-sm text-xs font-semibold px-3 py-1 min-w-[78px]
|
|
1505
|
+
${p}
|
|
1506
|
+
${t}
|
|
1507
|
+
${o}`,
|
|
1508
|
+
children: h
|
|
1509
|
+
}
|
|
1510
|
+
);
|
|
1511
|
+
}, sa = ({ rows: h = 5, columns: n = 5 }) => /* @__PURE__ */ d(E, { children: [
|
|
1512
|
+
/* @__PURE__ */ e("div", { className: "w-full mb-6 inline-flex justify-end items-center", children: /* @__PURE__ */ e("div", { className: "h-8 w-80 bg-gray-300 dark:bg-gray-700 rounded animate-pulse" }) }),
|
|
1513
|
+
/* @__PURE__ */ e("div", { className: "overflow-hidden rounded-md border border-gray-200 dark:border-gray-800", children: /* @__PURE__ */ d("table", { className: "w-full border-collapse", children: [
|
|
1514
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { className: "bg-gray-50 dark:bg-gray-900", children: Array.from({ length: n }).map((i, o) => /* @__PURE__ */ e("th", { className: "px-4 py-3", children: /* @__PURE__ */ e("div", { className: "h-6 w-24 bg-gray-300 dark:bg-gray-700 rounded animate-pulse inline-flex justify-center items-center" }) }, o)) }) }),
|
|
1515
|
+
/* @__PURE__ */ e("tbody", { children: Array.from({ length: h }).map((i, o) => /* @__PURE__ */ e(
|
|
1516
|
+
"tr",
|
|
1517
|
+
{
|
|
1518
|
+
className: "border-t border-gray-200 dark:border-gray-800",
|
|
1519
|
+
children: Array.from({ length: n }).map((s, t) => /* @__PURE__ */ e("td", { className: "px-4 py-6", children: /* @__PURE__ */ e("div", { className: "h-6 w-full bg-gray-300 dark:bg-gray-700 rounded animate-pulse" }) }, t))
|
|
1520
|
+
},
|
|
1521
|
+
o
|
|
1522
|
+
)) })
|
|
1523
|
+
] }) })
|
|
1524
|
+
] }), Ee = ({ src: h, alt: n = "preview", isOpen: i, setIsOpen: o }) => {
|
|
1525
|
+
const s = () => o(!1);
|
|
1526
|
+
return H(() => {
|
|
1527
|
+
const t = (p) => {
|
|
1528
|
+
p.key === "Escape" && s();
|
|
1529
|
+
};
|
|
1530
|
+
return i && (document.body.style.overflow = "hidden", document.addEventListener("keydown", t)), () => {
|
|
1531
|
+
document.body.style.overflow = "", document.removeEventListener("keydown", t);
|
|
1532
|
+
};
|
|
1533
|
+
}, [i]), /* @__PURE__ */ e(E, { children: /* @__PURE__ */ d(
|
|
1534
|
+
"div",
|
|
1535
|
+
{
|
|
1536
|
+
className: `fixed inset-0 z-50 flex items-center justify-center bg-black/70 dark:bg-black/80 \r
|
|
1537
|
+
backdrop-blur-sm animate-in fade-in duration-200`,
|
|
1538
|
+
onClick: s,
|
|
1539
|
+
children: [
|
|
1540
|
+
/* @__PURE__ */ e(
|
|
1541
|
+
"button",
|
|
1542
|
+
{
|
|
1543
|
+
onClick: s,
|
|
1544
|
+
className: `absolute top-4 right-4 bg-white dark:bg-gray-800 text-gray-800 dark:text-gray-200\r
|
|
1545
|
+
hover:bg-gray-100 dark:hover:bg-gray-700 rounded-full p-2 shadow-lg transition`,
|
|
1546
|
+
children: /* @__PURE__ */ e(we, { size: 20 })
|
|
1547
|
+
}
|
|
1548
|
+
),
|
|
1549
|
+
/* @__PURE__ */ e(
|
|
1550
|
+
"div",
|
|
1551
|
+
{
|
|
1552
|
+
className: "max-w-5xl w-full px-4 transform transition-all duration-200 scale-95 animate-in zoom-in-95",
|
|
1553
|
+
onClick: (t) => t.stopPropagation(),
|
|
1554
|
+
children: /* @__PURE__ */ e(
|
|
1555
|
+
"img",
|
|
1556
|
+
{
|
|
1557
|
+
src: h,
|
|
1558
|
+
alt: n,
|
|
1559
|
+
className: "w-full max-h-[90vh] object-contain rounded-xl"
|
|
1560
|
+
}
|
|
1561
|
+
)
|
|
1562
|
+
}
|
|
1563
|
+
)
|
|
1564
|
+
]
|
|
1565
|
+
}
|
|
1566
|
+
) });
|
|
1567
|
+
}, da = ({ config: h, setShowAdd: n, title: i, buttonText: o, description: s }) => {
|
|
1568
|
+
const {
|
|
1569
|
+
data: t = [],
|
|
1570
|
+
table_head: p = [],
|
|
1571
|
+
loading: k = !1,
|
|
1572
|
+
search: M = {
|
|
1573
|
+
enabled: !1,
|
|
1574
|
+
placeholder: "Search...",
|
|
1575
|
+
useServerSideSearch: !1
|
|
1576
|
+
},
|
|
1577
|
+
filter: u = {
|
|
1578
|
+
enabled: !1,
|
|
1579
|
+
useServerSideFilters: !1
|
|
1580
|
+
},
|
|
1581
|
+
pagination: l = {
|
|
1582
|
+
enabled: !1,
|
|
1583
|
+
rows_per_page: 10,
|
|
1584
|
+
useServerSidePagination: !1
|
|
1585
|
+
},
|
|
1586
|
+
emptyMessage: c = "No data available",
|
|
1587
|
+
onMenuAction: g,
|
|
1588
|
+
setServerSidePaginationData: y = () => {
|
|
1589
|
+
},
|
|
1590
|
+
onFilterApply: b,
|
|
1591
|
+
filterConfig: v = null
|
|
1592
|
+
} = h, [x, N] = S(""), [I, D] = S(null), [C, A] = S([]), [B, F] = S({}), [R, j] = S(!1), [$, W] = S(null), [G, K] = S(!1), U = Me(() => !M.enabled || !x.trim() || M.useServerSideSearch ? t : Xe(t, x, M.searchKeys || []), [t, x, M]), [O, Y] = S(1), [q, w] = S((l == null ? void 0 : l.rows_per_page) || 50), [z, re] = S(U.length || 0), J = l != null && l.useServerSidePagination ? l.total_pages : Math.ceil(U.length / q), X = Me(() => {
|
|
1593
|
+
if (l.useServerSidePagination) return U;
|
|
1594
|
+
const r = (O - 1) * q;
|
|
1595
|
+
return U.slice(r, r + q);
|
|
1596
|
+
}, [U, O, q]), ne = ae(null), ie = ae({}), le = ae(null), se = (r) => {
|
|
1597
|
+
N(r), Y(1), M.useServerSideSearch && (le.current && clearTimeout(le.current), le.current = setTimeout(async () => {
|
|
1598
|
+
try {
|
|
1599
|
+
await y((f) => ({
|
|
1600
|
+
...f,
|
|
1601
|
+
search: r,
|
|
1602
|
+
current_page: 1
|
|
1603
|
+
}));
|
|
1604
|
+
} catch (f) {
|
|
1605
|
+
console.error("Search error:", f);
|
|
1606
|
+
}
|
|
1607
|
+
}, 800));
|
|
1608
|
+
}, de = (r, f, P) => {
|
|
1609
|
+
P.stopPropagation(), D(null), g == null || g(r.type, f);
|
|
1610
|
+
}, ce = (r, f, P) => {
|
|
1611
|
+
f.stopPropagation(), A(P);
|
|
1612
|
+
const _ = f.currentTarget;
|
|
1613
|
+
ie.current[r] = _;
|
|
1614
|
+
const m = _.getBoundingClientRect(), L = 192, T = P.length * 40, Z = window.innerWidth, V = window.innerHeight, Ge = Z - m.right < L ? m.left - L + m.width : m.left, _e = V - m.bottom < T && m.top > T ? m.top - T - 2 : m.bottom + 2;
|
|
1615
|
+
F({
|
|
1616
|
+
top: Math.max(8, Math.min(_e, V - T - 8)),
|
|
1617
|
+
left: Math.max(8, Math.min(Ge, Z - L - 8))
|
|
1618
|
+
}), D(I === r ? null : r);
|
|
1619
|
+
}, he = (r) => (O - 1) * q + r + 1, ue = (r) => {
|
|
1620
|
+
r && r.src instanceof File && (r = { ...r, src: URL.createObjectURL(r.src) }), W(r), K(!0);
|
|
1621
|
+
}, oe = (r, f, P, _ = null) => /* @__PURE__ */ e(E, { children: r ? /* @__PURE__ */ e(
|
|
1622
|
+
"img",
|
|
1623
|
+
{
|
|
1624
|
+
src: r instanceof File ? URL.createObjectURL(r) : r,
|
|
1625
|
+
alt: f || "Avatar",
|
|
1626
|
+
onClick: (m) => {
|
|
1627
|
+
m.stopPropagation(), m.preventDefault(), ue({ src: r, alt: f });
|
|
1628
|
+
},
|
|
1629
|
+
className: `w-10 h-10 cursor-pointer shrink-0 rounded-full object-cover border border-gray-200 dark:border-gray-700 ${P || ""}`
|
|
1630
|
+
}
|
|
1631
|
+
) : /* @__PURE__ */ e(E, { children: _ || /* @__PURE__ */ e(
|
|
1632
|
+
"div",
|
|
1633
|
+
{
|
|
1634
|
+
className: `w-10 h-10 flex items-center shrink-0 justify-center rounded-full border border-gray-300 dark:border-gray-700 bg-gray-200 dark:bg-gray-600 ${P || ""}`,
|
|
1635
|
+
children: /* @__PURE__ */ e(Fe, { className: "w-6 h-6 text-gray-400 dark:text-gray-400" })
|
|
1636
|
+
}
|
|
1637
|
+
) }) }), be = (r, f) => /* @__PURE__ */ e(E, { children: r ? /* @__PURE__ */ e(
|
|
1638
|
+
"audio",
|
|
1639
|
+
{
|
|
1640
|
+
controls: !0,
|
|
1641
|
+
src: r instanceof File ? URL.createObjectURL(r) : r,
|
|
1642
|
+
onClick: (P) => {
|
|
1643
|
+
P.stopPropagation();
|
|
1644
|
+
},
|
|
1645
|
+
className: `w-64 cursor-pointer ${f || ""}`
|
|
1646
|
+
},
|
|
1647
|
+
r instanceof File ? URL.createObjectURL(r) : r
|
|
1648
|
+
) : /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(
|
|
1649
|
+
"div",
|
|
1650
|
+
{
|
|
1651
|
+
className: `w-12 h-12 flex items-center shrink-0 justify-center rounded-full border border-gray-300 dark:border-gray-700 bg-gray-200 dark:bg-gray-600 ${f || ""}`,
|
|
1652
|
+
children: /* @__PURE__ */ e(qe, { className: "w-6 h-6 text-gray-400 dark:text-gray-400" })
|
|
1653
|
+
}
|
|
1654
|
+
) }) }), pe = (r, f) => /* @__PURE__ */ d("div", { className: `flex items-center space-x-4 ${f.className || ""}`, children: [
|
|
1655
|
+
f.imageKey ? oe(r[f.imageKey], r[f.titleKey], "group-avatar") : "",
|
|
1656
|
+
/* @__PURE__ */ d("div", { children: [
|
|
1657
|
+
/* @__PURE__ */ e("p", { className: "font-medium text-gray-900 dark:text-white group-title", children: r[f.titleKey] || "" }),
|
|
1658
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400 group-sub-title", children: r[f.subtitleKey] || "" })
|
|
1659
|
+
] })
|
|
1660
|
+
] }), ge = (r, f) => {
|
|
1661
|
+
var L;
|
|
1662
|
+
let P = String(r);
|
|
1663
|
+
const _ = f.variant || "contained";
|
|
1664
|
+
let m = f.defaultColor;
|
|
1665
|
+
if (((L = f == null ? void 0 : f.chipOptions) == null ? void 0 : L.length) > 0) {
|
|
1666
|
+
let T = f == null ? void 0 : f.chipOptions.find((Z) => Z.value == r);
|
|
1667
|
+
T && (P = T.label, m = T.color);
|
|
1668
|
+
}
|
|
1669
|
+
return /* @__PURE__ */ e(
|
|
1670
|
+
je,
|
|
1671
|
+
{
|
|
1672
|
+
label: P,
|
|
1673
|
+
variant: _,
|
|
1674
|
+
color: m,
|
|
1675
|
+
className: f.className || ""
|
|
1676
|
+
}
|
|
1677
|
+
);
|
|
1678
|
+
}, me = (r, f, P) => {
|
|
1679
|
+
const _ = f[r.key];
|
|
1680
|
+
return r.type === "menu_actions" ? /* @__PURE__ */ e("div", { className: `text-center ${r.className || ""}`, children: /* @__PURE__ */ e(
|
|
1681
|
+
"button",
|
|
1682
|
+
{
|
|
1683
|
+
ref: (m) => ie.current[f.id || f._id] = m,
|
|
1684
|
+
onClick: (m) => ce(f.id || f._id, m, r.menuList),
|
|
1685
|
+
className: "p-2 bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-full transition text-gray-700 dark:text-gray-300",
|
|
1686
|
+
children: /* @__PURE__ */ e(We, { className: "h-4 w-4" })
|
|
1687
|
+
}
|
|
1688
|
+
) }) : r.type === "index" ? /* @__PURE__ */ e("span", { className: r.className || "", children: he(P) }) : r.type === "group" ? pe(f, r) : r.type === "chip" ? /* @__PURE__ */ e(E, { children: ge(_, r) }) : r.type === "date" ? /* @__PURE__ */ e("span", { className: r.className || "", children: Pe(_, r.format || "DD MMM YYYY") }) : r.type === "avatar" ? /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e("div", { className: "min-w-[40px]", children: oe(_, r.alt, r.className, r.fallback_icon) }) }) : r.type === "audio" ? /* @__PURE__ */ e(E, { children: be(_, r.className) }) : /* @__PURE__ */ e("span", { className: r.className || "", children: _ || "N/A" });
|
|
1689
|
+
}, fe = (r, f) => {
|
|
1690
|
+
if (r.onClickDetails)
|
|
1691
|
+
return g == null ? void 0 : g("view", f);
|
|
1692
|
+
if (typeof r.handleClick == "function")
|
|
1693
|
+
return r.handleClick(f);
|
|
1694
|
+
}, ye = (r) => r.onClickDetails || typeof r.handleClick == "function";
|
|
1695
|
+
return H(() => {
|
|
1696
|
+
const r = () => {
|
|
1697
|
+
I && D(null);
|
|
1698
|
+
};
|
|
1699
|
+
return window.addEventListener("scroll", r, !0), () => {
|
|
1700
|
+
window.removeEventListener("scroll", r, !0);
|
|
1701
|
+
};
|
|
1702
|
+
}, [I]), H(() => {
|
|
1703
|
+
const r = (f) => {
|
|
1704
|
+
ne.current && !ne.current.contains(f.target) && D(null);
|
|
1705
|
+
};
|
|
1706
|
+
return document.addEventListener("click", r), () => document.removeEventListener("click", r);
|
|
1707
|
+
}, []), H(() => {
|
|
1708
|
+
l != null && l.rows_per_page && (l != null && l.useServerSidePagination) && w((l == null ? void 0 : l.rows_per_page) || 50), l.current_page && Y(l.current_page);
|
|
1709
|
+
}, [
|
|
1710
|
+
l.rows_per_page,
|
|
1711
|
+
l == null ? void 0 : l.useServerSidePagination,
|
|
1712
|
+
l.current_page
|
|
1713
|
+
]), H(() => {
|
|
1714
|
+
re(
|
|
1715
|
+
l != null && l.useServerSidePagination ? l.total_records : U.length
|
|
1716
|
+
), U.length <= q * (O - 1) && !(l != null && l.useServerSidePagination) && Y((r) => r - 1 || 1);
|
|
1717
|
+
}, [
|
|
1718
|
+
U.length,
|
|
1719
|
+
l.total_records,
|
|
1720
|
+
l == null ? void 0 : l.useServerSidePagination
|
|
1721
|
+
]), k ? /* @__PURE__ */ e(sa, { rows: 6, columns: 6 }) : /* @__PURE__ */ d(E, { children: [
|
|
1722
|
+
/* @__PURE__ */ d("div", { className: "flex flex-col sm:flex-row sm:justify-between gap-4 mb-3", children: [
|
|
1723
|
+
/* @__PURE__ */ d("div", { children: [
|
|
1724
|
+
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: i }),
|
|
1725
|
+
/* @__PURE__ */ e("p", { className: "text-md text-gray-600 dark:text-gray-400", children: s })
|
|
1726
|
+
] }),
|
|
1727
|
+
/* @__PURE__ */ d("div", { className: "flex flex-col justify-end items-end gap-2", children: [
|
|
1728
|
+
/* @__PURE__ */ d(
|
|
1729
|
+
ee,
|
|
1730
|
+
{
|
|
1731
|
+
onClick: () => n(!0),
|
|
1732
|
+
variant: "contained",
|
|
1733
|
+
color: "primary",
|
|
1734
|
+
children: [
|
|
1735
|
+
/* @__PURE__ */ e(ze, { className: "w-4 h-4 mr-2" }),
|
|
1736
|
+
o || "Add New"
|
|
1737
|
+
]
|
|
1738
|
+
}
|
|
1739
|
+
),
|
|
1740
|
+
/* @__PURE__ */ d("div", { className: "flex justify-end items-center gap-2", children: [
|
|
1741
|
+
M.enabled && /* @__PURE__ */ e("div", { className: "", children: /* @__PURE__ */ d("div", { className: "relative min-w-[300px]", children: [
|
|
1742
|
+
/* @__PURE__ */ e(Re, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-300" }),
|
|
1743
|
+
/* @__PURE__ */ e(
|
|
1744
|
+
"input",
|
|
1745
|
+
{
|
|
1746
|
+
type: "text",
|
|
1747
|
+
placeholder: M.placeholder || "Search...",
|
|
1748
|
+
value: x,
|
|
1749
|
+
onChange: (r) => se(r.target.value),
|
|
1750
|
+
className: "w-full h-[36px] pl-9 pr-4 py-3 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-gray-50 dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-blue-300 dark:ring-blue-200 disabled:opacity-50"
|
|
1751
|
+
}
|
|
1752
|
+
)
|
|
1753
|
+
] }) }),
|
|
1754
|
+
v && u.enabled && /* @__PURE__ */ d(ee, { onClick: () => j(!0), variant: "contained", children: [
|
|
1755
|
+
/* @__PURE__ */ e(He, { className: "w-4 h-4 mr-2" }),
|
|
1756
|
+
"Filters"
|
|
1757
|
+
] })
|
|
1758
|
+
] })
|
|
1759
|
+
] })
|
|
1760
|
+
] }),
|
|
1761
|
+
/* @__PURE__ */ d("div", { className: "bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden border border-gray-200 dark:border-gray-700", children: [
|
|
1762
|
+
/* @__PURE__ */ e("div", { className: "overflow-x-auto", children: /* @__PURE__ */ d("table", { className: "min-w-full divide-y divide-gray-200 dark:divide-gray-700", children: [
|
|
1763
|
+
/* @__PURE__ */ e("thead", { className: "bg-gray-50 dark:bg-gray-700/60", children: /* @__PURE__ */ e("tr", { children: p.map((r) => /* @__PURE__ */ e(
|
|
1764
|
+
"th",
|
|
1765
|
+
{
|
|
1766
|
+
className: `px-6 py-4 text-left text-xs font-medium text-black dark:text-white uppercase tracking-wider min-w-max max-w-[180px] truncate ${r.headClass || ""}`,
|
|
1767
|
+
children: r.title
|
|
1768
|
+
},
|
|
1769
|
+
r.key
|
|
1770
|
+
)) }) }),
|
|
1771
|
+
/* @__PURE__ */ e("tbody", { className: "bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700", children: X.length === 0 ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e(
|
|
1772
|
+
"td",
|
|
1773
|
+
{
|
|
1774
|
+
colSpan: p.length,
|
|
1775
|
+
className: "text-center py-10 text-gray-500 dark:text-gray-400",
|
|
1776
|
+
children: c
|
|
1777
|
+
}
|
|
1778
|
+
) }) : X.map((r, f) => /* @__PURE__ */ e(
|
|
1779
|
+
"tr",
|
|
1780
|
+
{
|
|
1781
|
+
className: "hover:bg-gray-50 dark:hover:bg-blue-800/10 transition",
|
|
1782
|
+
children: p.map((P) => /* @__PURE__ */ e(
|
|
1783
|
+
"td",
|
|
1784
|
+
{
|
|
1785
|
+
className: `px-6 py-4 text-sm text-gray-900 dark:text-gray-100 min-w-max ${P.type == "audio" ? "" : "max-w-[300px]"} truncate ${ye(P) ? "cursor-pointer" : ""}`,
|
|
1786
|
+
title: String(r[P.key] ?? ""),
|
|
1787
|
+
onClick: () => fe(P, r),
|
|
1788
|
+
children: P.render ? P.render(r, f) : me(P, r, f)
|
|
1789
|
+
},
|
|
1790
|
+
P.key
|
|
1791
|
+
))
|
|
1792
|
+
},
|
|
1793
|
+
r.id || r._id || f
|
|
1794
|
+
)) })
|
|
1795
|
+
] }) }),
|
|
1796
|
+
(l == null ? void 0 : l.enabled) && U.length > 0 && /* @__PURE__ */ d("div", { className: " bg-gray-50 dark:bg-gray-700/60 px-6 py-3 flex flex-wrap items-center justify-between border-t border-gray-200 dark:border-gray-600 gap-3", children: [
|
|
1797
|
+
/* @__PURE__ */ d("div", { className: "text-sm text-gray-700 dark:text-gray-300", children: [
|
|
1798
|
+
"Showing ",
|
|
1799
|
+
(O - 1) * q + 1,
|
|
1800
|
+
" to",
|
|
1801
|
+
" ",
|
|
1802
|
+
Math.min(O * q, z),
|
|
1803
|
+
" of ",
|
|
1804
|
+
z,
|
|
1805
|
+
" ",
|
|
1806
|
+
"results"
|
|
1807
|
+
] }),
|
|
1808
|
+
/* @__PURE__ */ d("div", { className: "flex items-center gap-4", children: [
|
|
1809
|
+
/* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
1810
|
+
/* @__PURE__ */ e("span", { className: "text-sm text-gray-700 dark:text-gray-300", children: "Rows per page:" }),
|
|
1811
|
+
/* @__PURE__ */ e(
|
|
1812
|
+
"select",
|
|
1813
|
+
{
|
|
1814
|
+
value: q,
|
|
1815
|
+
onChange: (r) => {
|
|
1816
|
+
const f = Number(r.target.value);
|
|
1817
|
+
w(f), Y(1), l.useServerSidePagination && y((P) => ({
|
|
1818
|
+
...P,
|
|
1819
|
+
current_page: 1,
|
|
1820
|
+
rows_per_page: f
|
|
1821
|
+
}));
|
|
1822
|
+
},
|
|
1823
|
+
className: "border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-sm rounded-md px-2 py-1 focus:outline-none focus:ring-1 focus:ring-blue-500",
|
|
1824
|
+
children: [2, 10, 25, 50, 100].map((r) => /* @__PURE__ */ e("option", { value: r, children: r }, r))
|
|
1825
|
+
}
|
|
1826
|
+
)
|
|
1827
|
+
] }),
|
|
1828
|
+
/* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
1829
|
+
/* @__PURE__ */ e(
|
|
1830
|
+
"button",
|
|
1831
|
+
{
|
|
1832
|
+
onClick: () => {
|
|
1833
|
+
if (O > 1) {
|
|
1834
|
+
const r = O - 1;
|
|
1835
|
+
Y(r), l.useServerSidePagination && y((f) => ({
|
|
1836
|
+
...f,
|
|
1837
|
+
current_page: r
|
|
1838
|
+
}));
|
|
1839
|
+
}
|
|
1840
|
+
},
|
|
1841
|
+
disabled: O === 1,
|
|
1842
|
+
className: "p-2 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-md transition text-gray-500 dark:text-gray-300 disabled:opacity-50",
|
|
1843
|
+
children: /* @__PURE__ */ e(Ye, { className: "h-4 w-4" })
|
|
1844
|
+
}
|
|
1845
|
+
),
|
|
1846
|
+
/* @__PURE__ */ d("span", { className: "text-sm text-gray-800 dark:text-gray-200", children: [
|
|
1847
|
+
"Page ",
|
|
1848
|
+
O,
|
|
1849
|
+
" of ",
|
|
1850
|
+
J
|
|
1851
|
+
] }),
|
|
1852
|
+
/* @__PURE__ */ e(
|
|
1853
|
+
"button",
|
|
1854
|
+
{
|
|
1855
|
+
onClick: () => {
|
|
1856
|
+
if (O < J) {
|
|
1857
|
+
const r = O + 1;
|
|
1858
|
+
Y(r), l.useServerSidePagination && y((f) => ({
|
|
1859
|
+
...f,
|
|
1860
|
+
current_page: r
|
|
1861
|
+
}));
|
|
1862
|
+
}
|
|
1863
|
+
},
|
|
1864
|
+
disabled: O === J,
|
|
1865
|
+
className: "p-2 hover:bg-gray-200 dark:hover:bg-gray-600 rounded-md transition text-gray-500 dark:text-gray-300 disabled:opacity-50",
|
|
1866
|
+
children: /* @__PURE__ */ e(Ve, { className: "h-4 w-4" })
|
|
1867
|
+
}
|
|
1868
|
+
)
|
|
1869
|
+
] })
|
|
1870
|
+
] })
|
|
1871
|
+
] })
|
|
1872
|
+
] }),
|
|
1873
|
+
I && Ze(
|
|
1874
|
+
/* @__PURE__ */ e(
|
|
1875
|
+
"div",
|
|
1876
|
+
{
|
|
1877
|
+
ref: ne,
|
|
1878
|
+
style: {
|
|
1879
|
+
position: "fixed",
|
|
1880
|
+
top: `${B.top}px`,
|
|
1881
|
+
left: `${B.left}px`,
|
|
1882
|
+
zIndex: 9999
|
|
1883
|
+
},
|
|
1884
|
+
className: "w-48 bg-white dark:bg-gray-700 rounded-md shadow-lg border border-gray-200 dark:border-gray-600",
|
|
1885
|
+
children: C.map((r, f) => /* @__PURE__ */ d(
|
|
1886
|
+
"button",
|
|
1887
|
+
{
|
|
1888
|
+
onClick: (P) => de(
|
|
1889
|
+
r,
|
|
1890
|
+
t.find(
|
|
1891
|
+
(_) => _.id === I || _._id == I
|
|
1892
|
+
),
|
|
1893
|
+
P
|
|
1894
|
+
),
|
|
1895
|
+
className: `w-full flex items-center gap-2 px-4 py-2 text-sm text-left hover:bg-gray-100 dark:hover:bg-gray-600 ${r.variant === "danger" ? "text-red-600 dark:text-red-500" : "text-gray-700 dark:text-gray-200"}`,
|
|
1896
|
+
children: [
|
|
1897
|
+
r.icon && /* @__PURE__ */ e("span", { className: "shrink-0", children: r.icon }),
|
|
1898
|
+
r.title
|
|
1899
|
+
]
|
|
1900
|
+
},
|
|
1901
|
+
f
|
|
1902
|
+
))
|
|
1903
|
+
}
|
|
1904
|
+
),
|
|
1905
|
+
document.body
|
|
1906
|
+
),
|
|
1907
|
+
v && /* @__PURE__ */ e(
|
|
1908
|
+
ia,
|
|
1909
|
+
{
|
|
1910
|
+
isOpen: R,
|
|
1911
|
+
onClose: () => j(!1),
|
|
1912
|
+
config: v,
|
|
1913
|
+
onApply: b
|
|
1914
|
+
}
|
|
1915
|
+
),
|
|
1916
|
+
G && /* @__PURE__ */ e(
|
|
1917
|
+
Ee,
|
|
1918
|
+
{
|
|
1919
|
+
src: $.src,
|
|
1920
|
+
alt: $.alt,
|
|
1921
|
+
isOpen: G,
|
|
1922
|
+
setIsOpen: K
|
|
1923
|
+
}
|
|
1924
|
+
)
|
|
1925
|
+
] });
|
|
1926
|
+
}, ve = ({
|
|
1927
|
+
isOpen: h,
|
|
1928
|
+
onClose: n,
|
|
1929
|
+
icon: i,
|
|
1930
|
+
title: o,
|
|
1931
|
+
children: s,
|
|
1932
|
+
size: t = "md",
|
|
1933
|
+
actionButtons: p = [],
|
|
1934
|
+
actions: k,
|
|
1935
|
+
showDefaultClose: M = !0,
|
|
1936
|
+
footerConfig: u = null,
|
|
1937
|
+
hideFooter: l = !1,
|
|
1938
|
+
onFormSubmit: c = () => {
|
|
1939
|
+
},
|
|
1940
|
+
onCancel: g,
|
|
1941
|
+
loadingBtn: y = !1,
|
|
1942
|
+
executeFunction: b = () => {
|
|
1943
|
+
},
|
|
1944
|
+
selectedItem: v = null
|
|
1945
|
+
}) => {
|
|
1946
|
+
if (!h) return null;
|
|
1947
|
+
const x = {
|
|
1948
|
+
sm: "max-w-md",
|
|
1949
|
+
md: "max-w-lg",
|
|
1950
|
+
lg: "max-w-2xl",
|
|
1951
|
+
xl: "max-w-4xl",
|
|
1952
|
+
full: "max-w-full"
|
|
1953
|
+
};
|
|
1954
|
+
return /* @__PURE__ */ d("div", { className: "fixed inset-0 z-50 flex items-center justify-center p-4", children: [
|
|
1955
|
+
/* @__PURE__ */ e(
|
|
1956
|
+
"div",
|
|
1957
|
+
{
|
|
1958
|
+
className: "fixed inset-0 bg-gray-500 opacity-75",
|
|
1959
|
+
onClick: () => n()
|
|
1960
|
+
}
|
|
1961
|
+
),
|
|
1962
|
+
/* @__PURE__ */ d(
|
|
1963
|
+
"div",
|
|
1964
|
+
{
|
|
1965
|
+
className: `relative bg-white rounded-lg shadow-xl w-full ${x[t] || x.md} max-h-[90vh] flex flex-col dark:bg-gray-800`,
|
|
1966
|
+
children: [
|
|
1967
|
+
/* @__PURE__ */ d("div", { className: "flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0", children: [
|
|
1968
|
+
/* @__PURE__ */ d("div", { className: "flex items-center gap-1", children: [
|
|
1969
|
+
i && /* @__PURE__ */ e("span", { children: i }),
|
|
1970
|
+
/* @__PURE__ */ e("h3", { className: "text-lg font-medium text-gray-900 dark:text-white", children: o })
|
|
1971
|
+
] }),
|
|
1972
|
+
/* @__PURE__ */ e(
|
|
1973
|
+
"button",
|
|
1974
|
+
{
|
|
1975
|
+
onClick: () => n(),
|
|
1976
|
+
className: "text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",
|
|
1977
|
+
children: /* @__PURE__ */ e(we, { className: "w-6 h-6" })
|
|
1978
|
+
}
|
|
1979
|
+
)
|
|
1980
|
+
] }),
|
|
1981
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-4", children: s }),
|
|
1982
|
+
p.length > 0 && /* @__PURE__ */ e("div", { className: "px-4 py-3 flex justify-end gap-3 border-t border-gray-200 dark:border-gray-700 sm:px-6", children: p.map((N) => /* @__PURE__ */ e(
|
|
1983
|
+
ee,
|
|
1984
|
+
{
|
|
1985
|
+
onClick: (I) => {
|
|
1986
|
+
N.type == "submit" ? c(I) : b(
|
|
1987
|
+
() => {
|
|
1988
|
+
var D;
|
|
1989
|
+
return (D = N == null ? void 0 : N.onClick) == null ? void 0 : D.call(N, I, v);
|
|
1990
|
+
},
|
|
1991
|
+
(D) => n == null ? void 0 : n(D)
|
|
1992
|
+
);
|
|
1993
|
+
},
|
|
1994
|
+
disabled: y || N.disabled,
|
|
1995
|
+
variant: N.variant || "contained",
|
|
1996
|
+
color: N.color || "primary",
|
|
1997
|
+
className: `min-w-[100px] ${N.className}`,
|
|
1998
|
+
type: N.type || "button",
|
|
1999
|
+
children: y ? /* @__PURE__ */ d("div", { className: "flex items-center", children: [
|
|
2000
|
+
/* @__PURE__ */ e("div", { className: "animate-spin rounded-full h-4 w-4 border-2 border-white/30 border-t-2 border-t-white mr-2" }),
|
|
2001
|
+
N.label || "Submit",
|
|
2002
|
+
"..."
|
|
2003
|
+
] }) : N.label || "Submit"
|
|
2004
|
+
}
|
|
2005
|
+
)) })
|
|
2006
|
+
]
|
|
2007
|
+
}
|
|
2008
|
+
)
|
|
2009
|
+
] });
|
|
2010
|
+
}, De = ({ config: h, onSubmit: n, initialData: i = {}, type: o = "add" }) => {
|
|
2011
|
+
const { formClass: s = "grid grid-cols-12 gap-4", formFields: t = [] } = h || {}, [p, k] = S(i);
|
|
2012
|
+
H(() => {
|
|
2013
|
+
k(i);
|
|
2014
|
+
}, []);
|
|
2015
|
+
const M = (l, c) => {
|
|
2016
|
+
k((g) => ({ ...g, [l]: c }));
|
|
2017
|
+
}, u = (l) => {
|
|
2018
|
+
l.preventDefault();
|
|
2019
|
+
const c = l.target;
|
|
2020
|
+
if (!c.checkValidity()) {
|
|
2021
|
+
c.reportValidity();
|
|
2022
|
+
return;
|
|
2023
|
+
}
|
|
2024
|
+
n(p);
|
|
2025
|
+
};
|
|
2026
|
+
return /* @__PURE__ */ e(
|
|
2027
|
+
"form",
|
|
2028
|
+
{
|
|
2029
|
+
id: o == "add" ? "addForm" : o == "edit" ? "editForm" : "defaultForm",
|
|
2030
|
+
onSubmit: u,
|
|
2031
|
+
className: s,
|
|
2032
|
+
noValidate: !1,
|
|
2033
|
+
children: t.map((l) => /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(
|
|
2034
|
+
Ue,
|
|
2035
|
+
{
|
|
2036
|
+
field: l,
|
|
2037
|
+
formData: p,
|
|
2038
|
+
handleChange: M
|
|
2039
|
+
},
|
|
2040
|
+
l.key
|
|
2041
|
+
) }))
|
|
2042
|
+
}
|
|
2043
|
+
);
|
|
2044
|
+
};
|
|
2045
|
+
function ca({ data: h, config: n }) {
|
|
2046
|
+
const { fields: i, containerClass: o } = n, [s, t] = S(null), [p, k] = S(!1), M = (c) => {
|
|
2047
|
+
c && c.src instanceof File && (c = { ...c, src: URL.createObjectURL(c.src) }), t(c), k(!0);
|
|
2048
|
+
}, u = ({ col: c }) => {
|
|
2049
|
+
var I;
|
|
2050
|
+
let g = c == null ? void 0 : c.icon, y = c.label, b = h[c.key], v = c.type, x = c.variant || "outline", N = c.defaultColor;
|
|
2051
|
+
if (v === "chip" && ((I = c.chipOptions) == null ? void 0 : I.length) > 0) {
|
|
2052
|
+
let D = c == null ? void 0 : c.chipOptions.find((C) => C.value == b);
|
|
2053
|
+
D && (b = D.label, N = D.color);
|
|
2054
|
+
}
|
|
2055
|
+
return /* @__PURE__ */ d(
|
|
2056
|
+
"div",
|
|
2057
|
+
{
|
|
2058
|
+
className: `col-span-12 flex items-center space-x-4 p-4 rounded-xl
|
|
2059
|
+
bg-gray-100 dark:bg-gray-900 ${c.blockClass || ""}`,
|
|
2060
|
+
children: [
|
|
2061
|
+
g && /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: g }),
|
|
2062
|
+
/* @__PURE__ */ d("div", { className: "flex-1 min-w-0", children: [
|
|
2063
|
+
/* @__PURE__ */ e("p", { className: "text-sm font-medium text-gray-500 dark:text-gray-400", children: y }),
|
|
2064
|
+
v === "chip" ? /* @__PURE__ */ e(
|
|
2065
|
+
je,
|
|
2066
|
+
{
|
|
2067
|
+
label: b,
|
|
2068
|
+
variant: x,
|
|
2069
|
+
color: N,
|
|
2070
|
+
className: "mt-1"
|
|
2071
|
+
}
|
|
2072
|
+
) : (
|
|
2073
|
+
/* TINY EDITOR */
|
|
2074
|
+
v === "tinyEditor" ? /* @__PURE__ */ e(
|
|
2075
|
+
"p",
|
|
2076
|
+
{
|
|
2077
|
+
className: "mt-1 text-sm text-gray-900 dark:text-white break-words",
|
|
2078
|
+
dangerouslySetInnerHTML: {
|
|
2079
|
+
__html: b
|
|
2080
|
+
}
|
|
2081
|
+
}
|
|
2082
|
+
) : v === "audio" ? b ? /* @__PURE__ */ e(
|
|
2083
|
+
"audio",
|
|
2084
|
+
{
|
|
2085
|
+
controls: !0,
|
|
2086
|
+
src: b instanceof File ? URL.createObjectURL(b) : b,
|
|
2087
|
+
onClick: (D) => D.stopPropagation(),
|
|
2088
|
+
className: "shadow-md rounded-full"
|
|
2089
|
+
},
|
|
2090
|
+
b instanceof File ? URL.createObjectURL(b) : b
|
|
2091
|
+
) : /* @__PURE__ */ e("p", { className: "mt-1 text-sm text-gray-400", children: "N/A" }) : (
|
|
2092
|
+
/* DEFAULT */
|
|
2093
|
+
/* @__PURE__ */ e("p", { className: "mt-1 text-sm text-gray-900 dark:text-white break-words", children: v == "date" ? /* @__PURE__ */ e("span", { children: Pe(b, c.format || "DD MMM YYYY") }) : b || "N/A" })
|
|
2094
|
+
)
|
|
2095
|
+
)
|
|
2096
|
+
] })
|
|
2097
|
+
]
|
|
2098
|
+
}
|
|
2099
|
+
);
|
|
2100
|
+
}, l = ({ col: c }) => {
|
|
2101
|
+
let g = h[c.titleKey], y = h[c.subtitleKey], b = h[c.imageKey], v = h[c.fallback_icon];
|
|
2102
|
+
return /* @__PURE__ */ d(
|
|
2103
|
+
"div",
|
|
2104
|
+
{
|
|
2105
|
+
className: `col-span-12 flex items-center space-x-4 p-4 rounded-xl
|
|
2106
|
+
bg-gray-100 dark:bg-gray-900
|
|
2107
|
+
${c.blockClass}`,
|
|
2108
|
+
children: [
|
|
2109
|
+
b ? /* @__PURE__ */ e(
|
|
2110
|
+
"img",
|
|
2111
|
+
{
|
|
2112
|
+
src: b instanceof File ? URL.createObjectURL(b) : b,
|
|
2113
|
+
alt: g,
|
|
2114
|
+
onClick: () => M({ src: b, alt: g }),
|
|
2115
|
+
className: "w-16 h-16 cursor-pointer rounded-full object-cover border-2 border-gray-200 dark:border-gray-700"
|
|
2116
|
+
}
|
|
2117
|
+
) : v || /* @__PURE__ */ e("div", { className: "w-16 h-16 flex items-center justify-center rounded-full border-2 border-gray-300 dark:border-gray-700 bg-gray-200 dark:bg-gray-600", children: /* @__PURE__ */ e(Fe, { className: "w-8 h-8 text-gray-400" }) }),
|
|
2118
|
+
/* @__PURE__ */ d("div", { children: [
|
|
2119
|
+
/* @__PURE__ */ e("h3", { className: "text-xl font-semibold text-gray-900 dark:text-white", children: g }),
|
|
2120
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: y })
|
|
2121
|
+
] })
|
|
2122
|
+
]
|
|
2123
|
+
}
|
|
2124
|
+
);
|
|
2125
|
+
};
|
|
2126
|
+
return /* @__PURE__ */ d(E, { children: [
|
|
2127
|
+
p && /* @__PURE__ */ e(
|
|
2128
|
+
Ee,
|
|
2129
|
+
{
|
|
2130
|
+
src: s.src,
|
|
2131
|
+
alt: s.alt,
|
|
2132
|
+
isOpen: p,
|
|
2133
|
+
setIsOpen: k
|
|
2134
|
+
}
|
|
2135
|
+
),
|
|
2136
|
+
/* @__PURE__ */ e("div", { className: `grid grid-cols-12 gap-4 ${o || ""}`, children: i.map(
|
|
2137
|
+
(c) => c.type == "group" ? /* @__PURE__ */ e(l, { col: c }) : /* @__PURE__ */ e(u, { col: c })
|
|
2138
|
+
) })
|
|
2139
|
+
] });
|
|
2140
|
+
}
|
|
2141
|
+
const $e = ({ config: h }) => {
|
|
2142
|
+
var se, de, ce, he, ue, oe, be, pe, ge, me, fe, ye, r, f, P, _;
|
|
2143
|
+
const {
|
|
2144
|
+
title: n,
|
|
2145
|
+
fetchData: i = async () => {
|
|
2146
|
+
},
|
|
2147
|
+
isStaticData: o = !1,
|
|
2148
|
+
tableConfig: s = {},
|
|
2149
|
+
modalConfig: t = {},
|
|
2150
|
+
filterConfig: p
|
|
2151
|
+
} = h, [k, M] = S(!0), [u, l] = S(!1), [c, g] = S([]), [y, b] = S(null), [v, x] = S({
|
|
2152
|
+
search: "",
|
|
2153
|
+
rows_per_page: 50,
|
|
2154
|
+
current_page: 1
|
|
2155
|
+
}), [N, I] = S({}), [D, C] = S(!1), [A, B] = S(!1), [F, R] = S(!1), [j, $] = S(!1), [W, G] = S(!1), [K, U] = S(null), O = (m, L) => {
|
|
2156
|
+
m === "edit" ? (U(L), R(!0)) : m === "view" ? (U(L), G(!0)) : m === "delete" && (U(L), $(!0));
|
|
2157
|
+
}, Y = async (m, L, T = "", Z = "") => {
|
|
2158
|
+
l(!0);
|
|
2159
|
+
try {
|
|
2160
|
+
const V = await (m == null ? void 0 : m());
|
|
2161
|
+
(T || V.message) && ke(T || V.message, {
|
|
2162
|
+
variant: "success"
|
|
2163
|
+
}), L == null || L(V);
|
|
2164
|
+
} catch (V) {
|
|
2165
|
+
(Z || V.message) && ke(Z || V.message, { variant: "error" });
|
|
2166
|
+
} finally {
|
|
2167
|
+
l(!1);
|
|
2168
|
+
}
|
|
2169
|
+
}, q = (m) => {
|
|
2170
|
+
let L = m.newObject;
|
|
2171
|
+
o ? (g((T) => [L, ...T]), b((T) => ({
|
|
2172
|
+
...T,
|
|
2173
|
+
current_page: 1
|
|
2174
|
+
}))) : (x((T) => ({
|
|
2175
|
+
...T,
|
|
2176
|
+
current_page: 1
|
|
2177
|
+
})), v.current_page == 1 && X()), B(!1);
|
|
2178
|
+
}, w = (m) => {
|
|
2179
|
+
let L = m.newObject, T = m.targetObject;
|
|
2180
|
+
o ? g(
|
|
2181
|
+
(Z) => Z.map(
|
|
2182
|
+
(V) => V.id === T.id ? { ...V, ...L } : V
|
|
2183
|
+
)
|
|
2184
|
+
) : X(), R(!1);
|
|
2185
|
+
}, z = (m) => {
|
|
2186
|
+
if (!m) {
|
|
2187
|
+
$(!1), U(null);
|
|
2188
|
+
return;
|
|
2189
|
+
}
|
|
2190
|
+
o ? g(
|
|
2191
|
+
(L) => L.filter((T) => T.id !== m.targetObject.id)
|
|
2192
|
+
) : c.length == 1 && v.current_page > 1 ? x((L) => ({
|
|
2193
|
+
...L,
|
|
2194
|
+
current_page: L.current_page - 1
|
|
2195
|
+
})) : X(), $(!1), U(null);
|
|
2196
|
+
}, re = (m) => Y(
|
|
2197
|
+
() => {
|
|
2198
|
+
var L, T;
|
|
2199
|
+
return (T = (L = t == null ? void 0 : t.addModal) == null ? void 0 : L.handleSubmit) == null ? void 0 : T.call(L, m);
|
|
2200
|
+
},
|
|
2201
|
+
q
|
|
2202
|
+
), J = (m) => Y(
|
|
2203
|
+
() => {
|
|
2204
|
+
var L, T;
|
|
2205
|
+
return (T = (L = t == null ? void 0 : t.editModal) == null ? void 0 : L.handleSubmit) == null ? void 0 : T.call(L, m, K);
|
|
2206
|
+
},
|
|
2207
|
+
w
|
|
2208
|
+
), X = async () => {
|
|
2209
|
+
M(!0), i == null || i({ ...v, ...N }).then((m) => {
|
|
2210
|
+
g(m.data), b(m.pagination);
|
|
2211
|
+
}).catch((m) => {
|
|
2212
|
+
ke(m.message, { variant: "error" });
|
|
2213
|
+
}).finally(() => {
|
|
2214
|
+
M(!1);
|
|
2215
|
+
});
|
|
2216
|
+
}, ne = (m) => {
|
|
2217
|
+
var L;
|
|
2218
|
+
I((T) => ({
|
|
2219
|
+
...m
|
|
2220
|
+
})), (L = s == null ? void 0 : s.filter) != null && L.useServerSideFilters && C((T) => !T);
|
|
2221
|
+
}, ie = (m, L) => m.filter(
|
|
2222
|
+
(T) => Object.entries(L).every(([Z, V]) => T[Z] === V)
|
|
2223
|
+
), le = Me(() => {
|
|
2224
|
+
var m;
|
|
2225
|
+
return (m = s == null ? void 0 : s.filter) != null && m.useServerSideFilters ? c : ie(c, N);
|
|
2226
|
+
}, [c, N]);
|
|
2227
|
+
return H(() => {
|
|
2228
|
+
X();
|
|
2229
|
+
}, [
|
|
2230
|
+
v.search,
|
|
2231
|
+
v.rows_per_page,
|
|
2232
|
+
v.current_page,
|
|
2233
|
+
D
|
|
2234
|
+
]), /* @__PURE__ */ e(
|
|
2235
|
+
Qe,
|
|
2236
|
+
{
|
|
2237
|
+
maxSnack: 3,
|
|
2238
|
+
anchorOrigin: {
|
|
2239
|
+
vertical: "bottom",
|
|
2240
|
+
horizontal: "right"
|
|
2241
|
+
},
|
|
2242
|
+
autoHideDuration: 3e3,
|
|
2243
|
+
action: (m) => /* @__PURE__ */ e(
|
|
2244
|
+
"button",
|
|
2245
|
+
{
|
|
2246
|
+
onClick: () => {
|
|
2247
|
+
window.dispatchEvent(
|
|
2248
|
+
new CustomEvent("closeSnackbar", { detail: m })
|
|
2249
|
+
);
|
|
2250
|
+
},
|
|
2251
|
+
className: "p-1 hover:bg-white/20 rounded-full transition-colors duration-200 text-white flex items-center justify-center",
|
|
2252
|
+
children: /* @__PURE__ */ e(we, { className: "h-4 w-4" })
|
|
2253
|
+
}
|
|
2254
|
+
),
|
|
2255
|
+
children: /* @__PURE__ */ d("div", { children: [
|
|
2256
|
+
/* @__PURE__ */ e(
|
|
2257
|
+
da,
|
|
2258
|
+
{
|
|
2259
|
+
title: n,
|
|
2260
|
+
setShowAdd: B,
|
|
2261
|
+
description: h.description,
|
|
2262
|
+
buttonText: h.buttonText,
|
|
2263
|
+
config: {
|
|
2264
|
+
...s,
|
|
2265
|
+
pagination: {
|
|
2266
|
+
...s.pagination,
|
|
2267
|
+
...y
|
|
2268
|
+
},
|
|
2269
|
+
data: le,
|
|
2270
|
+
setServerSidePaginationData: x,
|
|
2271
|
+
onMenuAction: O,
|
|
2272
|
+
filterConfig: p,
|
|
2273
|
+
onFilterApply: ne,
|
|
2274
|
+
loading: k
|
|
2275
|
+
}
|
|
2276
|
+
}
|
|
2277
|
+
),
|
|
2278
|
+
/* @__PURE__ */ e(
|
|
2279
|
+
ve,
|
|
2280
|
+
{
|
|
2281
|
+
isOpen: A,
|
|
2282
|
+
onClose: () => {
|
|
2283
|
+
u || B(!1);
|
|
2284
|
+
},
|
|
2285
|
+
icon: (se = t.addModal) == null ? void 0 : se.icon,
|
|
2286
|
+
title: ((de = t.addModal) == null ? void 0 : de.title) || "Add New",
|
|
2287
|
+
size: ((ce = t.addModal) == null ? void 0 : ce.size) || "md",
|
|
2288
|
+
onFormSubmit: () => {
|
|
2289
|
+
var m;
|
|
2290
|
+
return (m = document.querySelector("#addForm")) == null ? void 0 : m.requestSubmit();
|
|
2291
|
+
},
|
|
2292
|
+
loadingBtn: u,
|
|
2293
|
+
actionButtons: t.addModal.actionButtons,
|
|
2294
|
+
children: /* @__PURE__ */ e(
|
|
2295
|
+
De,
|
|
2296
|
+
{
|
|
2297
|
+
config: (t == null ? void 0 : t.addModal) || [],
|
|
2298
|
+
onSubmit: re,
|
|
2299
|
+
initialData: {},
|
|
2300
|
+
type: "add",
|
|
2301
|
+
loading: u
|
|
2302
|
+
}
|
|
2303
|
+
)
|
|
2304
|
+
}
|
|
2305
|
+
),
|
|
2306
|
+
/* @__PURE__ */ e(
|
|
2307
|
+
ve,
|
|
2308
|
+
{
|
|
2309
|
+
isOpen: F,
|
|
2310
|
+
onClose: () => {
|
|
2311
|
+
u || R(!1);
|
|
2312
|
+
},
|
|
2313
|
+
icon: (he = t.editModal) == null ? void 0 : he.icon,
|
|
2314
|
+
title: ((ue = t.editModal) == null ? void 0 : ue.title) || "Edit",
|
|
2315
|
+
size: ((oe = t.editModal) == null ? void 0 : oe.size) || "md",
|
|
2316
|
+
onFormSubmit: () => {
|
|
2317
|
+
var m;
|
|
2318
|
+
return (m = document.querySelector("#editForm")) == null ? void 0 : m.requestSubmit();
|
|
2319
|
+
},
|
|
2320
|
+
actionButtons: t.editModal.actionButtons,
|
|
2321
|
+
loadingBtn: u,
|
|
2322
|
+
children: /* @__PURE__ */ e(
|
|
2323
|
+
De,
|
|
2324
|
+
{
|
|
2325
|
+
config: t.editModal || [],
|
|
2326
|
+
onSubmit: J,
|
|
2327
|
+
initialData: K,
|
|
2328
|
+
type: "edit",
|
|
2329
|
+
loading: u
|
|
2330
|
+
}
|
|
2331
|
+
)
|
|
2332
|
+
}
|
|
2333
|
+
),
|
|
2334
|
+
j && /* @__PURE__ */ e(
|
|
2335
|
+
ve,
|
|
2336
|
+
{
|
|
2337
|
+
isOpen: j,
|
|
2338
|
+
onClose: (m) => {
|
|
2339
|
+
z(m);
|
|
2340
|
+
},
|
|
2341
|
+
icon: ((be = t.deleteModal) == null ? void 0 : be.icon) || /* @__PURE__ */ e(te, { icon: "ph:warning-bold", className: "w-6 h-6 text-red-500" }),
|
|
2342
|
+
title: ((pe = t.deleteModal) == null ? void 0 : pe.title) || "Confirm Delete",
|
|
2343
|
+
size: ((ge = t.deleteModal) == null ? void 0 : ge.size) || "md",
|
|
2344
|
+
loading: u,
|
|
2345
|
+
actionButtons: t.deleteModal.actionButtons,
|
|
2346
|
+
executeFunction: Y,
|
|
2347
|
+
selectedItem: K,
|
|
2348
|
+
children: /* @__PURE__ */ e("div", { className: "flex items-center space-x-2 py-3", children: /* @__PURE__ */ d("div", { children: [
|
|
2349
|
+
/* @__PURE__ */ e("p", { className: "text-md text-gray-700 dark:text-white", children: ((me = t.deleteModal) == null ? void 0 : me.confirmText) || "Are you sure you want to delete this item?" }),
|
|
2350
|
+
((fe = t.deleteModal) == null ? void 0 : fe.referenceKey) && /* @__PURE__ */ e("p", { className: "text-md font-semibold text-gray-700 dark:text-white", children: K[(ye = t.deleteModal) == null ? void 0 : ye.referenceKey] })
|
|
2351
|
+
] }) })
|
|
2352
|
+
}
|
|
2353
|
+
),
|
|
2354
|
+
t.viewModal && /* @__PURE__ */ e(
|
|
2355
|
+
ve,
|
|
2356
|
+
{
|
|
2357
|
+
isOpen: W,
|
|
2358
|
+
onClose: () => {
|
|
2359
|
+
G(!1), U(null);
|
|
2360
|
+
},
|
|
2361
|
+
icon: (r = t.viewModal) == null ? void 0 : r.icon,
|
|
2362
|
+
title: ((f = t.viewModal) == null ? void 0 : f.title) || "View Details",
|
|
2363
|
+
size: ((P = t.viewModal) == null ? void 0 : P.size) || "lg",
|
|
2364
|
+
footerConfig: t == null ? void 0 : t.viewModal.footer,
|
|
2365
|
+
children: (_ = t.viewModal) != null && _.component ? /* @__PURE__ */ e(t.viewModal.component, { data: K }) : /* @__PURE__ */ e(
|
|
2366
|
+
ca,
|
|
2367
|
+
{
|
|
2368
|
+
data: K,
|
|
2369
|
+
config: t.viewModal || {}
|
|
2370
|
+
}
|
|
2371
|
+
)
|
|
2372
|
+
}
|
|
2373
|
+
)
|
|
2374
|
+
] })
|
|
2375
|
+
}
|
|
2376
|
+
);
|
|
2377
|
+
}, Le = a.shape({
|
|
2378
|
+
value: a.oneOfType([
|
|
2379
|
+
a.string,
|
|
2380
|
+
a.number,
|
|
2381
|
+
a.bool
|
|
2382
|
+
]).isRequired,
|
|
2383
|
+
label: a.string.isRequired,
|
|
2384
|
+
color: a.string
|
|
2385
|
+
}), Ne = a.shape({
|
|
2386
|
+
type: a.string.isRequired,
|
|
2387
|
+
label: a.string.isRequired,
|
|
2388
|
+
color: a.string,
|
|
2389
|
+
variant: a.string,
|
|
2390
|
+
onClick: a.func
|
|
2391
|
+
}), ha = a.shape({
|
|
2392
|
+
title: a.string.isRequired,
|
|
2393
|
+
type: a.string.isRequired,
|
|
2394
|
+
variant: a.string,
|
|
2395
|
+
icon: a.node
|
|
2396
|
+
}), ua = a.shape({
|
|
2397
|
+
key: a.string.isRequired,
|
|
2398
|
+
title: a.string,
|
|
2399
|
+
type: a.string,
|
|
2400
|
+
imageKey: a.string,
|
|
2401
|
+
titleKey: a.string,
|
|
2402
|
+
subtitleKey: a.string,
|
|
2403
|
+
onClickDetails: a.bool,
|
|
2404
|
+
variant: a.string,
|
|
2405
|
+
chipOptions: a.arrayOf(Le),
|
|
2406
|
+
defaultColor: a.string,
|
|
2407
|
+
className: a.string,
|
|
2408
|
+
format: a.string,
|
|
2409
|
+
menuList: a.arrayOf(ha)
|
|
2410
|
+
}), Se = a.shape({
|
|
2411
|
+
key: a.string.isRequired,
|
|
2412
|
+
label: a.string,
|
|
2413
|
+
type: a.string.isRequired,
|
|
2414
|
+
required: a.bool,
|
|
2415
|
+
minLength: a.number,
|
|
2416
|
+
parentClass: a.string,
|
|
2417
|
+
search: a.bool,
|
|
2418
|
+
multiple: a.bool,
|
|
2419
|
+
dropdownMaxHeight: a.string,
|
|
2420
|
+
dragDrop: a.bool,
|
|
2421
|
+
countriesList: a.bool,
|
|
2422
|
+
defaultCountry: a.string,
|
|
2423
|
+
placeholder: a.string,
|
|
2424
|
+
rows: a.number,
|
|
2425
|
+
text: a.string,
|
|
2426
|
+
editorKey: a.string,
|
|
2427
|
+
options: a.arrayOf(Le)
|
|
2428
|
+
}), ba = a.shape({
|
|
2429
|
+
key: a.string,
|
|
2430
|
+
label: a.string,
|
|
2431
|
+
type: a.string,
|
|
2432
|
+
imageKey: a.string,
|
|
2433
|
+
titleKey: a.string,
|
|
2434
|
+
subtitleKey: a.string,
|
|
2435
|
+
blockClass: a.string,
|
|
2436
|
+
icon: a.node,
|
|
2437
|
+
variant: a.string,
|
|
2438
|
+
chipOptions: a.arrayOf(Le),
|
|
2439
|
+
defaultColor: a.string,
|
|
2440
|
+
className: a.string,
|
|
2441
|
+
format: a.string
|
|
2442
|
+
});
|
|
2443
|
+
$e.propTypes = {
|
|
2444
|
+
config: a.shape({
|
|
2445
|
+
title: a.string.isRequired,
|
|
2446
|
+
description: a.string,
|
|
2447
|
+
buttonText: a.string,
|
|
2448
|
+
fetchData: a.func.isRequired,
|
|
2449
|
+
isStaticData: a.bool,
|
|
2450
|
+
/* ================= TABLE CONFIG ================= */
|
|
2451
|
+
tableConfig: a.shape({
|
|
2452
|
+
table_head: a.arrayOf(ua).isRequired,
|
|
2453
|
+
search: a.shape({
|
|
2454
|
+
enabled: a.bool,
|
|
2455
|
+
useServerSideSearch: a.bool,
|
|
2456
|
+
searchKeys: a.arrayOf(a.string)
|
|
2457
|
+
}),
|
|
2458
|
+
pagination: a.shape({
|
|
2459
|
+
enabled: a.bool,
|
|
2460
|
+
useServerSidePagination: a.bool
|
|
2461
|
+
}),
|
|
2462
|
+
filter: a.shape({
|
|
2463
|
+
enabled: a.bool,
|
|
2464
|
+
useServerSideFilters: a.bool
|
|
2465
|
+
})
|
|
2466
|
+
}).isRequired,
|
|
2467
|
+
/* ================= MODAL CONFIG ================= */
|
|
2468
|
+
modalConfig: a.shape({
|
|
2469
|
+
addModal: a.shape({
|
|
2470
|
+
title: a.string.isRequired,
|
|
2471
|
+
size: a.string,
|
|
2472
|
+
formClass: a.string,
|
|
2473
|
+
formFields: a.arrayOf(Se),
|
|
2474
|
+
handleSubmit: a.func.isRequired,
|
|
2475
|
+
actionButtons: a.arrayOf(Ne)
|
|
2476
|
+
}),
|
|
2477
|
+
editModal: a.shape({
|
|
2478
|
+
title: a.string.isRequired,
|
|
2479
|
+
size: a.string,
|
|
2480
|
+
formClass: a.string,
|
|
2481
|
+
formFields: a.arrayOf(Se),
|
|
2482
|
+
handleSubmit: a.func.isRequired,
|
|
2483
|
+
actionButtons: a.arrayOf(Ne)
|
|
2484
|
+
}),
|
|
2485
|
+
deleteModal: a.shape({
|
|
2486
|
+
title: a.string.isRequired,
|
|
2487
|
+
size: a.string,
|
|
2488
|
+
confirmText: a.string,
|
|
2489
|
+
referenceKey: a.string,
|
|
2490
|
+
actionButtons: a.arrayOf(Ne)
|
|
2491
|
+
}),
|
|
2492
|
+
viewModal: a.shape({
|
|
2493
|
+
title: a.string.isRequired,
|
|
2494
|
+
size: a.string,
|
|
2495
|
+
// 👇 This covers your commented code:
|
|
2496
|
+
component: a.elementType,
|
|
2497
|
+
// for custom component like TeamMemberDetail
|
|
2498
|
+
fields: a.arrayOf(ba),
|
|
2499
|
+
footer: a.shape({
|
|
2500
|
+
cancelButton: a.bool,
|
|
2501
|
+
cancelText: a.string
|
|
2502
|
+
})
|
|
2503
|
+
})
|
|
2504
|
+
}),
|
|
2505
|
+
/* ================= FILTER CONFIG ================= */
|
|
2506
|
+
filterConfig: a.shape({
|
|
2507
|
+
fields: a.arrayOf(Se)
|
|
2508
|
+
})
|
|
2509
|
+
}).isRequired
|
|
2510
|
+
};
|
|
2511
|
+
const pa = () => {
|
|
2512
|
+
if (typeof document > "u" || document.getElementById("react-admin-crud-manager-styles")) return;
|
|
2513
|
+
const h = document.createElement("style");
|
|
2514
|
+
h.id = "react-admin-crud-manager-styles";
|
|
2515
|
+
const n = `
|
|
2516
|
+
.no-spinner::-webkit-outer-spin-button,
|
|
2517
|
+
.no-spinner::-webkit-inner-spin-button {
|
|
2518
|
+
-webkit-appearance: none;
|
|
2519
|
+
margin: 0;
|
|
2520
|
+
}
|
|
2521
|
+
|
|
2522
|
+
.no-spinner {
|
|
2523
|
+
-moz-appearance: textfield;
|
|
2524
|
+
}
|
|
2525
|
+
|
|
2526
|
+
.tox.tox-tinymce .tox-edit-area::before {
|
|
2527
|
+
border: 0 !important;
|
|
2528
|
+
box-shadow: none !important;
|
|
2529
|
+
}
|
|
2530
|
+
`;
|
|
2531
|
+
h.textContent = n, document.head.appendChild(h);
|
|
2532
|
+
};
|
|
2533
|
+
function Ma(h) {
|
|
2534
|
+
return H(() => {
|
|
2535
|
+
pa();
|
|
2536
|
+
}, []), /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e($e, { config: h.config }) });
|
|
2537
|
+
}
|
|
2538
|
+
export {
|
|
2539
|
+
Ma as default
|
|
2540
|
+
};
|
|
2541
|
+
//# sourceMappingURL=index.es.js.map
|