react-admin-crud-manager 1.0.26 → 1.0.28
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 +48 -36
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +1613 -1463
- package/dist/index.es.js.map +1 -1
- package/dist/tailwind.css +45 -18
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
import { jsx as e, Fragment as j, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { Info as
|
|
4
|
-
import { createPortal as
|
|
5
|
-
import { Icon as
|
|
6
|
-
import { Editor as
|
|
7
|
-
import { SnackbarProvider as
|
|
8
|
-
import
|
|
9
|
-
const
|
|
10
|
-
if (!
|
|
11
|
-
const
|
|
12
|
-
if (isNaN(
|
|
13
|
-
const s = (
|
|
14
|
-
YYYY:
|
|
15
|
-
YY: String(
|
|
16
|
-
MMMM:
|
|
17
|
-
MMM:
|
|
18
|
-
MM: s(
|
|
19
|
-
M:
|
|
20
|
-
DD: s(
|
|
21
|
-
D:
|
|
22
|
-
dddd:
|
|
23
|
-
ddd:
|
|
24
|
-
HH: s(
|
|
25
|
-
hh: s(
|
|
26
|
-
mm: s(
|
|
27
|
-
ss: s(
|
|
28
|
-
A:
|
|
1
|
+
import { jsx as e, Fragment as j, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import Me, { useState as C, useRef as X, useEffect as K, useMemo as Fe } from "react";
|
|
3
|
+
import { Info as Xe, ChevronDown as $e, Search as Ie, Check as ea, X as Le, User as Ae, Plus as aa, Filter as ra, ChevronLeft as ta, ChevronRight as na, EllipsisVertical as la, Music as oa } from "lucide-react";
|
|
4
|
+
import { createPortal as ia } from "react-dom";
|
|
5
|
+
import { Icon as ne } from "@iconify/react";
|
|
6
|
+
import { Editor as sa } from "@tinymce/tinymce-react";
|
|
7
|
+
import { enqueueSnackbar as ce, SnackbarProvider as da, useSnackbar as ca } from "notistack";
|
|
8
|
+
import l from "prop-types";
|
|
9
|
+
const Ge = (n, o = "DD MMM YYYY") => {
|
|
10
|
+
if (!n) return "N/A";
|
|
11
|
+
const t = new Date(n);
|
|
12
|
+
if (isNaN(t)) return "Invalid Date";
|
|
13
|
+
const s = (d) => String(d).padStart(2, "0"), i = {
|
|
14
|
+
YYYY: t.getFullYear(),
|
|
15
|
+
YY: String(t.getFullYear()).slice(-2),
|
|
16
|
+
MMMM: t.toLocaleString("en-US", { month: "long" }),
|
|
17
|
+
MMM: t.toLocaleString("en-US", { month: "short" }),
|
|
18
|
+
MM: s(t.getMonth() + 1),
|
|
19
|
+
M: t.getMonth() + 1,
|
|
20
|
+
DD: s(t.getDate()),
|
|
21
|
+
D: t.getDate(),
|
|
22
|
+
dddd: t.toLocaleString("en-US", { weekday: "long" }),
|
|
23
|
+
ddd: t.toLocaleString("en-US", { weekday: "short" }),
|
|
24
|
+
HH: s(t.getHours()),
|
|
25
|
+
hh: s(t.getHours() % 12 || 12),
|
|
26
|
+
mm: s(t.getMinutes()),
|
|
27
|
+
ss: s(t.getSeconds()),
|
|
28
|
+
A: t.getHours() >= 12 ? "PM" : "AM"
|
|
29
29
|
};
|
|
30
30
|
return o.replace(
|
|
31
31
|
/YYYY|YY|MMMM|MMM|MM|M|DD|D|dddd|ddd|HH|hh|mm|ss|A/g,
|
|
32
|
-
(
|
|
32
|
+
(d) => i[d]
|
|
33
33
|
);
|
|
34
|
-
},
|
|
35
|
-
if (!(o != null && o.trim())) return
|
|
36
|
-
const s = o.toLowerCase(),
|
|
37
|
-
return
|
|
38
|
-
let
|
|
39
|
-
return
|
|
40
|
-
|
|
41
|
-
}) :
|
|
42
|
-
(
|
|
34
|
+
}, ua = (n, o, t = []) => {
|
|
35
|
+
if (!(o != null && o.trim())) return n;
|
|
36
|
+
const s = o.toLowerCase(), i = (d) => d == null ? [] : typeof d == "object" ? Object.values(d).flatMap(i) : [String(d)];
|
|
37
|
+
return n.filter((d) => {
|
|
38
|
+
let r = [];
|
|
39
|
+
return t.length > 0 ? t.forEach((x) => {
|
|
40
|
+
d[x] !== void 0 && r.push(...i(d[x]));
|
|
41
|
+
}) : r = i(d), r.some(
|
|
42
|
+
(x) => x.toLowerCase().includes(s)
|
|
43
43
|
);
|
|
44
44
|
});
|
|
45
|
-
},
|
|
45
|
+
}, Q = Me.forwardRef(
|
|
46
46
|
({
|
|
47
|
-
className:
|
|
47
|
+
className: n = "",
|
|
48
48
|
variant: o = "contained",
|
|
49
|
-
color:
|
|
49
|
+
color: t = "default",
|
|
50
50
|
size: s = "default",
|
|
51
|
-
fullWidth:
|
|
52
|
-
children:
|
|
53
|
-
...
|
|
54
|
-
},
|
|
55
|
-
var
|
|
56
|
-
const
|
|
51
|
+
fullWidth: i = !1,
|
|
52
|
+
children: d,
|
|
53
|
+
...r
|
|
54
|
+
}, x) => {
|
|
55
|
+
var g;
|
|
56
|
+
const S = "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", c = {
|
|
57
57
|
sm: "h-8 px-3 rounded-md text-sm",
|
|
58
58
|
md: "h-9 px-4 rounded-md text-sm",
|
|
59
59
|
lg: "h-11 px-6 rounded-md text-base",
|
|
60
60
|
xl: "h-12 px-8 rounded-lg text-lg",
|
|
61
61
|
default: "h-9 px-4 rounded-md text-sm"
|
|
62
|
-
},
|
|
62
|
+
}, b = {
|
|
63
63
|
primary: {
|
|
64
64
|
contained: "bg-primary text-white hover:bg-primary-600 focus:ring-primary-500 shadow-sm",
|
|
65
65
|
outlined: "border border-primary bg-transparent text-primary hover:bg-primary-50 focus:ring-primary-500",
|
|
@@ -80,32 +80,32 @@ const $e = (b, o = "DD MMM YYYY") => {
|
|
|
80
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
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
82
|
}
|
|
83
|
-
},
|
|
84
|
-
${
|
|
85
|
-
${
|
|
86
|
-
${
|
|
87
|
-
${
|
|
88
|
-
${
|
|
83
|
+
}, u = ((g = b[t]) == null ? void 0 : g[o]) || b.default.contained, k = c[s], f = `
|
|
84
|
+
${S}
|
|
85
|
+
${u}
|
|
86
|
+
${k}
|
|
87
|
+
${i ? "w-full" : ""}
|
|
88
|
+
${n}
|
|
89
89
|
`.trim();
|
|
90
90
|
return /* @__PURE__ */ e(
|
|
91
91
|
"button",
|
|
92
92
|
{
|
|
93
|
-
ref:
|
|
94
|
-
type:
|
|
95
|
-
className:
|
|
96
|
-
...
|
|
97
|
-
children:
|
|
93
|
+
ref: x,
|
|
94
|
+
type: r.type || "button",
|
|
95
|
+
className: f,
|
|
96
|
+
...r,
|
|
97
|
+
children: d
|
|
98
98
|
}
|
|
99
99
|
);
|
|
100
100
|
}
|
|
101
101
|
);
|
|
102
|
-
|
|
103
|
-
function
|
|
104
|
-
return /* @__PURE__ */ e(j, { children: /* @__PURE__ */
|
|
105
|
-
|
|
102
|
+
Q.displayName = "Button";
|
|
103
|
+
function q({ label: n, required: o = !1, infoText: t = "" }) {
|
|
104
|
+
return /* @__PURE__ */ e(j, { children: /* @__PURE__ */ h("label", { className: "flex text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: [
|
|
105
|
+
n,
|
|
106
106
|
o && /* @__PURE__ */ e("span", { className: "ml-1", children: "*" }),
|
|
107
|
-
|
|
108
|
-
/* @__PURE__ */ e(
|
|
107
|
+
t && /* @__PURE__ */ h("span", { className: "ml-2 relative group inline-flex items-center cursor-pointer", children: [
|
|
108
|
+
/* @__PURE__ */ e(Xe, { className: "w-4 h-4 text-gray-500 dark:text-gray-400" }),
|
|
109
109
|
/* @__PURE__ */ e(
|
|
110
110
|
"span",
|
|
111
111
|
{
|
|
@@ -114,131 +114,131 @@ function W({ label: b, required: o = !1, infoText: l = "" }) {
|
|
|
114
114
|
rounded px-2 py-1 opacity-0 shadow-lg\r
|
|
115
115
|
group-hover:opacity-100 transition-opacity\r
|
|
116
116
|
duration-200 pointer-events-none z-50`,
|
|
117
|
-
children:
|
|
117
|
+
children: t
|
|
118
118
|
}
|
|
119
119
|
)
|
|
120
120
|
] })
|
|
121
121
|
] }) });
|
|
122
122
|
}
|
|
123
|
-
const
|
|
124
|
-
options:
|
|
123
|
+
const ha = ({
|
|
124
|
+
options: n = [],
|
|
125
125
|
value: o = "",
|
|
126
|
-
defaultValue:
|
|
126
|
+
defaultValue: t = "",
|
|
127
127
|
onChange: s,
|
|
128
|
-
placeholder:
|
|
129
|
-
className:
|
|
130
|
-
disabled:
|
|
131
|
-
search:
|
|
132
|
-
label:
|
|
133
|
-
required:
|
|
134
|
-
name:
|
|
135
|
-
parentClass:
|
|
136
|
-
multiple:
|
|
128
|
+
placeholder: i = "Select option",
|
|
129
|
+
className: d = "",
|
|
130
|
+
disabled: r = !1,
|
|
131
|
+
search: x = !1,
|
|
132
|
+
label: S = "",
|
|
133
|
+
required: c = !1,
|
|
134
|
+
name: b = "",
|
|
135
|
+
parentClass: u = "",
|
|
136
|
+
multiple: k = !1,
|
|
137
137
|
// ✅ NEW
|
|
138
|
-
dropdownMaxHeight:
|
|
139
|
-
formData:
|
|
140
|
-
dependencyKey:
|
|
138
|
+
dropdownMaxHeight: f = "",
|
|
139
|
+
formData: g = {},
|
|
140
|
+
dependencyKey: N = ""
|
|
141
141
|
}) => {
|
|
142
|
-
var
|
|
143
|
-
const [
|
|
144
|
-
let G = o || o === !1 ? o :
|
|
145
|
-
const
|
|
146
|
-
|
|
142
|
+
var I;
|
|
143
|
+
const [y, M] = C(!1), [D, U] = C(""), [L, O] = C(!0), E = X(null), F = X(null), [T, B] = C([]);
|
|
144
|
+
let G = o || o === !1 ? o : t;
|
|
145
|
+
const _ = (w) => w == null || w === "" ? "" : String(typeof w == "boolean" ? w : w ?? "");
|
|
146
|
+
K(
|
|
147
147
|
() => {
|
|
148
148
|
(async () => {
|
|
149
|
-
if (typeof
|
|
150
|
-
const
|
|
151
|
-
|
|
149
|
+
if (typeof n == "function") {
|
|
150
|
+
const P = await n(g);
|
|
151
|
+
B(P);
|
|
152
152
|
} else
|
|
153
|
-
|
|
153
|
+
B(n || []);
|
|
154
154
|
})();
|
|
155
155
|
},
|
|
156
|
-
|
|
156
|
+
N ? [n, g == null ? void 0 : g[N]] : [n]
|
|
157
157
|
);
|
|
158
|
-
const
|
|
159
|
-
(w) => w.label.toLowerCase().includes(
|
|
160
|
-
),
|
|
161
|
-
const
|
|
162
|
-
return
|
|
158
|
+
const J = k ? (G || []).map(_) : _(G), Z = T.filter(
|
|
159
|
+
(w) => w.label.toLowerCase().includes(D.toLowerCase())
|
|
160
|
+
), A = (w) => {
|
|
161
|
+
const P = _(w);
|
|
162
|
+
return k ? J.includes(P) : P === J;
|
|
163
163
|
};
|
|
164
|
-
|
|
165
|
-
const w = (
|
|
166
|
-
|
|
164
|
+
K(() => {
|
|
165
|
+
const w = (P) => {
|
|
166
|
+
E.current && !E.current.contains(P.target) && (M(!1), U(""));
|
|
167
167
|
};
|
|
168
168
|
return document.addEventListener("mousedown", w), () => document.removeEventListener("mousedown", w);
|
|
169
|
-
}, []),
|
|
170
|
-
if (
|
|
171
|
-
const w =
|
|
172
|
-
|
|
169
|
+
}, []), K(() => {
|
|
170
|
+
if (y && E.current) {
|
|
171
|
+
const w = E.current.getBoundingClientRect(), W = window.innerHeight - w.bottom;
|
|
172
|
+
O(W < 200);
|
|
173
173
|
}
|
|
174
|
-
}, [
|
|
175
|
-
|
|
176
|
-
}, [
|
|
177
|
-
const
|
|
178
|
-
let
|
|
179
|
-
if (w === "true" ?
|
|
180
|
-
const
|
|
181
|
-
let
|
|
182
|
-
|
|
183
|
-
(
|
|
184
|
-
) :
|
|
174
|
+
}, [y]), K(() => {
|
|
175
|
+
y && F.current && F.current.focus();
|
|
176
|
+
}, [y]);
|
|
177
|
+
const z = (w) => {
|
|
178
|
+
let P = w;
|
|
179
|
+
if (w === "true" ? P = !0 : w === "false" && (P = !1), k) {
|
|
180
|
+
const W = J.includes(_(w));
|
|
181
|
+
let H;
|
|
182
|
+
W ? H = o.filter(
|
|
183
|
+
(ae) => _(ae) !== _(w)
|
|
184
|
+
) : H = [...o || [], P], s(H);
|
|
185
185
|
} else
|
|
186
|
-
s(
|
|
187
|
-
|
|
188
|
-
},
|
|
189
|
-
return
|
|
186
|
+
s(P), M(!1);
|
|
187
|
+
U("");
|
|
188
|
+
}, V = k ? T.filter((w) => A(w.value)).map((w) => w.label).join(", ") : (I = T.find((w) => A(w.value))) == null ? void 0 : I.label;
|
|
189
|
+
return K(() => {
|
|
190
190
|
(G || G === !1) && setTimeout(() => {
|
|
191
191
|
s(G);
|
|
192
192
|
}, 100);
|
|
193
|
-
}, []), /* @__PURE__ */
|
|
194
|
-
/* @__PURE__ */ e(
|
|
195
|
-
/* @__PURE__ */
|
|
193
|
+
}, []), /* @__PURE__ */ h("div", { className: u || "col-span-12", children: [
|
|
194
|
+
/* @__PURE__ */ e(q, { label: S, required: c }),
|
|
195
|
+
/* @__PURE__ */ h("div", { className: `relative ${d}`, ref: E, children: [
|
|
196
196
|
/* @__PURE__ */ e(
|
|
197
197
|
"select",
|
|
198
198
|
{
|
|
199
199
|
name: "hidden_select_for_validation",
|
|
200
|
-
value:
|
|
201
|
-
required:
|
|
202
|
-
multiple:
|
|
200
|
+
value: V || "",
|
|
201
|
+
required: c,
|
|
202
|
+
multiple: k,
|
|
203
203
|
className: "absolute opacity-0 right-1/2 top-[80%] -translate-x-1/2 -translate-y-1/2 pointer-events-none h-[10px]",
|
|
204
|
-
children: /* @__PURE__ */ e("option", { hidden: !0, value:
|
|
204
|
+
children: /* @__PURE__ */ e("option", { hidden: !0, value: V, children: V })
|
|
205
205
|
}
|
|
206
206
|
),
|
|
207
|
-
/* @__PURE__ */
|
|
207
|
+
/* @__PURE__ */ h(
|
|
208
208
|
"button",
|
|
209
209
|
{
|
|
210
210
|
type: "button",
|
|
211
|
-
onClick: () => !
|
|
212
|
-
disabled:
|
|
211
|
+
onClick: () => !r && M(!y),
|
|
212
|
+
disabled: r,
|
|
213
213
|
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
|
|
214
|
-
${
|
|
215
|
-
${
|
|
214
|
+
${V ? "dark:text-white" : "text-gray-500 dark:text-gray-400"}
|
|
215
|
+
${r ? "opacity-50 cursor-not-allowed" : "dark:bg-gray-700"}`,
|
|
216
216
|
children: [
|
|
217
|
-
/* @__PURE__ */ e("span", { className: "truncate", children:
|
|
217
|
+
/* @__PURE__ */ e("span", { className: "truncate", children: V || i }),
|
|
218
218
|
/* @__PURE__ */ e(
|
|
219
|
-
|
|
219
|
+
$e,
|
|
220
220
|
{
|
|
221
|
-
className: `w-4 h-4 transition-transform ${
|
|
221
|
+
className: `w-4 h-4 transition-transform ${y ? "rotate-180" : ""}`
|
|
222
222
|
}
|
|
223
223
|
)
|
|
224
224
|
]
|
|
225
225
|
}
|
|
226
226
|
),
|
|
227
|
-
|
|
227
|
+
y && /* @__PURE__ */ h(
|
|
228
228
|
"div",
|
|
229
229
|
{
|
|
230
230
|
className: `absolute z-50 w-full border rounded-md bg-white dark:bg-gray-700 shadow-lg
|
|
231
|
-
${
|
|
231
|
+
${L ? "bottom-full mb-1" : "top-full mt-1"}`,
|
|
232
232
|
children: [
|
|
233
|
-
|
|
234
|
-
/* @__PURE__ */ e(
|
|
233
|
+
x && /* @__PURE__ */ e("div", { className: "p-2 border-b border-gray-200 dark:border-gray-600", children: /* @__PURE__ */ h("div", { className: "relative", children: [
|
|
234
|
+
/* @__PURE__ */ e(Ie, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400" }),
|
|
235
235
|
/* @__PURE__ */ e(
|
|
236
236
|
"input",
|
|
237
237
|
{
|
|
238
238
|
ref: F,
|
|
239
239
|
type: "text",
|
|
240
|
-
value:
|
|
241
|
-
onChange: (w) =>
|
|
240
|
+
value: D,
|
|
241
|
+
onChange: (w) => U(w.target.value),
|
|
242
242
|
placeholder: "Search...",
|
|
243
243
|
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"
|
|
244
244
|
}
|
|
@@ -249,18 +249,18 @@ const ia = ({
|
|
|
249
249
|
{
|
|
250
250
|
className: "max-h-40 overflow-y-auto",
|
|
251
251
|
style: {
|
|
252
|
-
maxHeight:
|
|
252
|
+
maxHeight: f || ""
|
|
253
253
|
},
|
|
254
|
-
children:
|
|
254
|
+
children: Z.length > 0 ? Z.map((w) => /* @__PURE__ */ h(
|
|
255
255
|
"button",
|
|
256
256
|
{
|
|
257
257
|
type: "button",
|
|
258
|
-
onClick: () =>
|
|
258
|
+
onClick: () => z(String(w.value)),
|
|
259
259
|
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
|
|
260
|
-
${
|
|
260
|
+
${A(w.value) ? "bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300" : ""}`,
|
|
261
261
|
children: [
|
|
262
262
|
/* @__PURE__ */ e("span", { children: w.label }),
|
|
263
|
-
|
|
263
|
+
k && A(w.value) && /* @__PURE__ */ e(ea, { className: "w-4 h-4" })
|
|
264
264
|
]
|
|
265
265
|
},
|
|
266
266
|
String(w.value)
|
|
@@ -271,52 +271,61 @@ const ia = ({
|
|
|
271
271
|
}
|
|
272
272
|
)
|
|
273
273
|
] })
|
|
274
|
-
] },
|
|
275
|
-
},
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
}) => {
|
|
286
|
-
|
|
287
|
-
{
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
return /* @__PURE__ */ e(j, { children: /* @__PURE__ */ u("div", { className: O || "col-span-12", children: [
|
|
291
|
-
/* @__PURE__ */ e(W, { label: c, required: r }),
|
|
292
|
-
/* @__PURE__ */ u("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: [
|
|
293
|
-
l && /* @__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: l }),
|
|
294
|
-
/* @__PURE__ */ e("div", { className: "flex items-center gap-6", children: h.map((v, d) => /* @__PURE__ */ u(
|
|
295
|
-
"label",
|
|
274
|
+
] }, b);
|
|
275
|
+
}, Ke = Me.forwardRef(
|
|
276
|
+
({
|
|
277
|
+
label: n,
|
|
278
|
+
required: o,
|
|
279
|
+
parentClass: t = "col-span-12",
|
|
280
|
+
className: s = "",
|
|
281
|
+
value: i,
|
|
282
|
+
onChange: d,
|
|
283
|
+
disabled: r = !1,
|
|
284
|
+
...x
|
|
285
|
+
}, S) => /* @__PURE__ */ h("div", { className: `flex justify-between ${t}`, children: [
|
|
286
|
+
n && /* @__PURE__ */ e(q, { label: n, required: o }),
|
|
287
|
+
/* @__PURE__ */ h("label", { className: "relative inline-flex items-center cursor-pointer", children: [
|
|
288
|
+
/* @__PURE__ */ e(
|
|
289
|
+
"input",
|
|
296
290
|
{
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
291
|
+
type: "checkbox",
|
|
292
|
+
ref: S,
|
|
293
|
+
className: "sr-only peer",
|
|
294
|
+
checked: i,
|
|
295
|
+
onChange: (c) => d(c.target.checked),
|
|
296
|
+
disabled: r,
|
|
297
|
+
...x
|
|
298
|
+
}
|
|
299
|
+
),
|
|
300
|
+
/* @__PURE__ */ e(
|
|
301
|
+
"div",
|
|
302
|
+
{
|
|
303
|
+
className: `
|
|
304
|
+
w-11 h-6 bg-gray-200 peer-focus:outline-none
|
|
305
|
+
rounded-full peer dark:bg-gray-700
|
|
306
|
+
peer-checked:bg-primary-600
|
|
307
|
+
peer-disabled:opacity-50 peer-disabled:cursor-not-allowed
|
|
308
|
+
transition-colors duration-200
|
|
309
|
+
${s}
|
|
310
|
+
`
|
|
311
|
+
}
|
|
312
|
+
),
|
|
313
|
+
/* @__PURE__ */ e(
|
|
314
|
+
"div",
|
|
315
|
+
{
|
|
316
|
+
className: `\r
|
|
317
|
+
absolute left-1 top-1\r
|
|
318
|
+
w-4 h-4 bg-white rounded-full\r
|
|
319
|
+
transition-transform duration-200\r
|
|
320
|
+
peer-checked:translate-x-5\r
|
|
321
|
+
`
|
|
322
|
+
}
|
|
323
|
+
)
|
|
317
324
|
] })
|
|
318
|
-
] }
|
|
319
|
-
|
|
325
|
+
] })
|
|
326
|
+
);
|
|
327
|
+
Ke.displayName = "Switch";
|
|
328
|
+
const Se = [
|
|
320
329
|
{ label: "Afghanistan", code: "AF", phone: "93" },
|
|
321
330
|
{ label: "Aland Islands", code: "AX", phone: "358" },
|
|
322
331
|
{ label: "Albania", code: "AL", phone: "355" },
|
|
@@ -568,90 +577,90 @@ const ia = ({
|
|
|
568
577
|
{ label: "Zambia", code: "ZM", phone: "260" },
|
|
569
578
|
{ label: "Zimbabwe", code: "ZW", phone: "263" }
|
|
570
579
|
];
|
|
571
|
-
function
|
|
572
|
-
label:
|
|
580
|
+
function ba({
|
|
581
|
+
label: n = "",
|
|
573
582
|
value: o = "",
|
|
574
|
-
name:
|
|
583
|
+
name: t = "",
|
|
575
584
|
parentClass: s = "",
|
|
576
|
-
onChange:
|
|
577
|
-
disabled:
|
|
578
|
-
required:
|
|
579
|
-
placeholder:
|
|
580
|
-
search:
|
|
581
|
-
countriesList:
|
|
582
|
-
defaultCountry:
|
|
585
|
+
onChange: i,
|
|
586
|
+
disabled: d = !1,
|
|
587
|
+
required: r = !1,
|
|
588
|
+
placeholder: x = "Phone number",
|
|
589
|
+
search: S = !1,
|
|
590
|
+
countriesList: c = !1,
|
|
591
|
+
defaultCountry: b = ""
|
|
583
592
|
}) {
|
|
584
|
-
const
|
|
585
|
-
|
|
586
|
-
), [
|
|
587
|
-
|
|
593
|
+
const u = (T) => Se.find((B) => B.code == T), [k, f] = C(
|
|
594
|
+
u(b) || Se[0]
|
|
595
|
+
), [g, N] = C(""), [y, M] = C(!1), [D, U] = C(""), L = X();
|
|
596
|
+
K(() => {
|
|
588
597
|
if (typeof o == "string" && o.startsWith("+")) {
|
|
589
|
-
const
|
|
590
|
-
if (
|
|
591
|
-
|
|
598
|
+
const T = Se.filter((B) => o.startsWith("+" + B.phone)).sort((B, G) => G.phone.length - B.phone.length)[0];
|
|
599
|
+
if (T) {
|
|
600
|
+
f(T), N(o.replace("+" + T.phone, ""));
|
|
592
601
|
return;
|
|
593
602
|
}
|
|
594
603
|
}
|
|
595
|
-
|
|
604
|
+
N(o);
|
|
596
605
|
}, [o]);
|
|
597
|
-
const
|
|
598
|
-
const
|
|
599
|
-
|
|
600
|
-
},
|
|
601
|
-
|
|
606
|
+
const O = (T) => {
|
|
607
|
+
const B = T.target.value.replace(/\D/g, "");
|
|
608
|
+
N(B), k && i && i("+" + k.phone + B);
|
|
609
|
+
}, E = (T) => {
|
|
610
|
+
f(T), i && i("+" + T.phone + g), M(!1), U("");
|
|
602
611
|
};
|
|
603
|
-
|
|
604
|
-
const
|
|
605
|
-
|
|
612
|
+
K(() => {
|
|
613
|
+
const T = (B) => {
|
|
614
|
+
L.current && !L.current.contains(B.target) && M(!1);
|
|
606
615
|
};
|
|
607
|
-
return document.addEventListener("mousedown",
|
|
616
|
+
return document.addEventListener("mousedown", T), () => document.removeEventListener("mousedown", T);
|
|
608
617
|
}, []);
|
|
609
|
-
const F =
|
|
610
|
-
(
|
|
618
|
+
const F = Se.filter(
|
|
619
|
+
(T) => T.label.toLowerCase().includes(D.toLowerCase()) || T.phone.includes(D)
|
|
611
620
|
);
|
|
612
|
-
return
|
|
613
|
-
/* @__PURE__ */ e(
|
|
614
|
-
/* @__PURE__ */
|
|
615
|
-
/* @__PURE__ */
|
|
621
|
+
return c ? /* @__PURE__ */ e(j, { children: /* @__PURE__ */ h("div", { className: s || "col-span-12", children: [
|
|
622
|
+
/* @__PURE__ */ e(q, { label: n, required: r }),
|
|
623
|
+
/* @__PURE__ */ h("div", { className: "relative ", ref: L, children: [
|
|
624
|
+
/* @__PURE__ */ h(
|
|
616
625
|
"div",
|
|
617
626
|
{
|
|
618
627
|
className: `h-[40px] flex items-center border rounded-md px-2 bg-white dark:bg-gray-700 transition-all
|
|
619
|
-
${
|
|
620
|
-
${
|
|
628
|
+
${y ? "ring-0.5 ring-blue-100 border-blue-300" : "border-gray-300 dark:border-gray-600"}
|
|
629
|
+
${d ? "opacity-60 cursor-not-allowed" : ""}`,
|
|
621
630
|
children: [
|
|
622
|
-
/* @__PURE__ */
|
|
631
|
+
/* @__PURE__ */ h(
|
|
623
632
|
"button",
|
|
624
633
|
{
|
|
625
634
|
type: "button",
|
|
626
|
-
disabled:
|
|
627
|
-
onClick: () =>
|
|
635
|
+
disabled: d,
|
|
636
|
+
onClick: () => M(!y),
|
|
628
637
|
className: "flex items-center gap-1 pr-2 border-r border-gray-300 dark:border-gray-700 focus:outline-none",
|
|
629
638
|
children: [
|
|
630
|
-
|
|
639
|
+
k ? /* @__PURE__ */ e(
|
|
631
640
|
"img",
|
|
632
641
|
{
|
|
633
|
-
src: `https://flagcdn.com/w20/${
|
|
634
|
-
alt:
|
|
642
|
+
src: `https://flagcdn.com/w20/${k.code.toLowerCase()}.png`,
|
|
643
|
+
alt: k.code,
|
|
635
644
|
className: "w-5 h-3 object-cover"
|
|
636
645
|
}
|
|
637
646
|
) : /* @__PURE__ */ e("span", { className: "text-gray-400 text-xs", children: "🌐" }),
|
|
638
|
-
/* @__PURE__ */ e(
|
|
647
|
+
/* @__PURE__ */ e($e, { className: "w-3 h-3 text-gray-500" })
|
|
639
648
|
]
|
|
640
649
|
}
|
|
641
650
|
),
|
|
642
|
-
|
|
651
|
+
k && /* @__PURE__ */ h("span", { className: "ml-2 text-sm text-gray-700 dark:text-gray-200 whitespace-nowrap", children: [
|
|
643
652
|
"+",
|
|
644
|
-
|
|
653
|
+
k.phone
|
|
645
654
|
] }),
|
|
646
655
|
/* @__PURE__ */ e(
|
|
647
656
|
"input",
|
|
648
657
|
{
|
|
649
658
|
type: "tel",
|
|
650
|
-
value:
|
|
651
|
-
onChange:
|
|
652
|
-
required:
|
|
653
|
-
disabled:
|
|
654
|
-
placeholder:
|
|
659
|
+
value: g,
|
|
660
|
+
onChange: O,
|
|
661
|
+
required: r,
|
|
662
|
+
disabled: d || !k,
|
|
663
|
+
placeholder: k ? x : "Select a country",
|
|
655
664
|
className: "flex-1 ml-2 bg-transparent outline-none text-sm text-gray-800 dark:text-gray-100 placeholder-gray-400"
|
|
656
665
|
}
|
|
657
666
|
),
|
|
@@ -659,10 +668,10 @@ function da({
|
|
|
659
668
|
"input",
|
|
660
669
|
{
|
|
661
670
|
type: "tel",
|
|
662
|
-
required:
|
|
671
|
+
required: r,
|
|
663
672
|
tabIndex: -1,
|
|
664
673
|
readOnly: !0,
|
|
665
|
-
value:
|
|
674
|
+
value: k && g ? "+" + k.phone + g : "",
|
|
666
675
|
style: {
|
|
667
676
|
position: "absolute",
|
|
668
677
|
opacity: 0,
|
|
@@ -674,61 +683,61 @@ function da({
|
|
|
674
683
|
]
|
|
675
684
|
}
|
|
676
685
|
),
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
/* @__PURE__ */ e(
|
|
686
|
+
y && /* @__PURE__ */ h("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: [
|
|
687
|
+
S && /* @__PURE__ */ e("div", { className: "p-2 border-b border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ h("div", { className: "relative", children: [
|
|
688
|
+
/* @__PURE__ */ e(Ie, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400" }),
|
|
680
689
|
/* @__PURE__ */ e(
|
|
681
690
|
"input",
|
|
682
691
|
{
|
|
683
692
|
type: "text",
|
|
684
|
-
value:
|
|
685
|
-
onChange: (
|
|
693
|
+
value: D,
|
|
694
|
+
onChange: (T) => U(T.target.value),
|
|
686
695
|
placeholder: "Search country...",
|
|
687
696
|
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 "
|
|
688
697
|
}
|
|
689
698
|
)
|
|
690
699
|
] }) }),
|
|
691
|
-
F.map((
|
|
700
|
+
F.map((T) => /* @__PURE__ */ h(
|
|
692
701
|
"button",
|
|
693
702
|
{
|
|
694
703
|
type: "button",
|
|
695
|
-
onClick: () =>
|
|
704
|
+
onClick: () => E(T),
|
|
696
705
|
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",
|
|
697
706
|
children: [
|
|
698
707
|
/* @__PURE__ */ e(
|
|
699
708
|
"img",
|
|
700
709
|
{
|
|
701
|
-
src: `https://flagcdn.com/w20/${
|
|
702
|
-
alt:
|
|
710
|
+
src: `https://flagcdn.com/w20/${T.code.toLowerCase()}.png`,
|
|
711
|
+
alt: T.code,
|
|
703
712
|
className: "w-5 h-3 object-cover"
|
|
704
713
|
}
|
|
705
714
|
),
|
|
706
|
-
/* @__PURE__ */
|
|
707
|
-
|
|
715
|
+
/* @__PURE__ */ h("span", { children: [
|
|
716
|
+
T.label,
|
|
708
717
|
" (+",
|
|
709
|
-
|
|
718
|
+
T.phone,
|
|
710
719
|
")"
|
|
711
720
|
] })
|
|
712
721
|
]
|
|
713
722
|
},
|
|
714
|
-
|
|
723
|
+
T.code
|
|
715
724
|
))
|
|
716
725
|
] })
|
|
717
726
|
] })
|
|
718
|
-
] },
|
|
719
|
-
/* @__PURE__ */ e(
|
|
727
|
+
] }, t) }) : /* @__PURE__ */ e(j, { children: /* @__PURE__ */ h("div", { className: s || "col-span-12", children: [
|
|
728
|
+
/* @__PURE__ */ e(q, { label: n, required: r }),
|
|
720
729
|
/* @__PURE__ */ e(
|
|
721
730
|
"input",
|
|
722
731
|
{
|
|
723
732
|
type: "text",
|
|
724
733
|
value: o,
|
|
725
|
-
onChange: (
|
|
726
|
-
const G =
|
|
727
|
-
|
|
734
|
+
onChange: (B) => {
|
|
735
|
+
const G = B.target.value.replace(/[^+\d]/g, ""), _ = G.startsWith("+") ? "+" + G.replace(/[+]/g, "").slice(0) : G;
|
|
736
|
+
i(_);
|
|
728
737
|
},
|
|
729
|
-
placeholder:
|
|
730
|
-
disabled:
|
|
731
|
-
required:
|
|
738
|
+
placeholder: x,
|
|
739
|
+
disabled: d,
|
|
740
|
+
required: r,
|
|
732
741
|
className: `w-full h-10 px-3 text-sm border border-gray-300 dark:border-gray-600 rounded-md \r
|
|
733
742
|
bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:outline-none \r
|
|
734
743
|
focus:ring-1 focus:ring-blue-300 dark:focus:ring-blue-200`,
|
|
@@ -736,94 +745,94 @@ function da({
|
|
|
736
745
|
pattern: "^\\+\\d{1,15}$"
|
|
737
746
|
}
|
|
738
747
|
)
|
|
739
|
-
] },
|
|
748
|
+
] }, t) });
|
|
740
749
|
}
|
|
741
|
-
const
|
|
742
|
-
({ className:
|
|
743
|
-
const
|
|
750
|
+
const _e = Me.forwardRef(
|
|
751
|
+
({ className: n = "", label: o, required: t, ...s }, i) => {
|
|
752
|
+
const d = `
|
|
744
753
|
placeholder-gray-400 dark:placeholder-gray-400
|
|
745
|
-
${
|
|
754
|
+
${n}
|
|
746
755
|
`.trim();
|
|
747
|
-
return /* @__PURE__ */ e(j, { children: /* @__PURE__ */
|
|
748
|
-
/* @__PURE__ */ e(
|
|
756
|
+
return /* @__PURE__ */ e(j, { children: /* @__PURE__ */ h("div", { className: s.parentClass || "col-span-12", children: [
|
|
757
|
+
/* @__PURE__ */ e(q, { label: o, required: t }),
|
|
749
758
|
/* @__PURE__ */ e("div", { className: "relative", children: /* @__PURE__ */ e(
|
|
750
759
|
"textarea",
|
|
751
760
|
{
|
|
752
|
-
className:
|
|
753
|
-
ref:
|
|
754
|
-
required:
|
|
761
|
+
className: d,
|
|
762
|
+
ref: i,
|
|
763
|
+
required: t,
|
|
755
764
|
...s
|
|
756
765
|
}
|
|
757
766
|
) })
|
|
758
767
|
] }, s.name) });
|
|
759
768
|
}
|
|
760
769
|
);
|
|
761
|
-
|
|
762
|
-
const
|
|
763
|
-
label:
|
|
770
|
+
_e.displayName = "TextArea";
|
|
771
|
+
const pa = ({
|
|
772
|
+
label: n = "",
|
|
764
773
|
value: o = null,
|
|
765
|
-
onChange:
|
|
774
|
+
onChange: t,
|
|
766
775
|
required: s = !1,
|
|
767
|
-
accept:
|
|
768
|
-
id:
|
|
769
|
-
dragDrop:
|
|
770
|
-
name:
|
|
771
|
-
parentClass:
|
|
776
|
+
accept: i = "image/*",
|
|
777
|
+
id: d,
|
|
778
|
+
dragDrop: r = !1,
|
|
779
|
+
name: x = "",
|
|
780
|
+
parentClass: S = ""
|
|
772
781
|
}) => {
|
|
773
|
-
const [
|
|
774
|
-
|
|
775
|
-
|
|
782
|
+
const [c, b] = C(o), [u, k] = C(!1), f = X(null);
|
|
783
|
+
K(() => (o instanceof File ? b({ file: o, preview: URL.createObjectURL(o) }) : (o != null && o.preview, b(o)), () => {
|
|
784
|
+
c != null && c.preview && c.preview.startsWith("blob:") && URL.revokeObjectURL(c.preview);
|
|
776
785
|
}), [o]);
|
|
777
|
-
const
|
|
778
|
-
if (!
|
|
786
|
+
const g = (L) => {
|
|
787
|
+
if (!L || L.length === 0)
|
|
779
788
|
return;
|
|
780
|
-
const
|
|
781
|
-
|
|
782
|
-
},
|
|
783
|
-
|
|
784
|
-
},
|
|
785
|
-
|
|
786
|
-
},
|
|
787
|
-
|
|
788
|
-
},
|
|
789
|
-
|
|
790
|
-
},
|
|
791
|
-
|
|
789
|
+
const O = L[0], E = URL.createObjectURL(O), F = { file: O, preview: E };
|
|
790
|
+
c != null && c.preview && c.preview.startsWith("blob:") && URL.revokeObjectURL(c.preview), b(F), t == null || t(O);
|
|
791
|
+
}, N = (L) => {
|
|
792
|
+
L && L.stopPropagation(), c != null && c.preview && c.preview.startsWith("blob:") && URL.revokeObjectURL(c.preview), b(null), t == null || t(null), f.current && (f.current.value = "");
|
|
793
|
+
}, y = (L) => {
|
|
794
|
+
r && (L.preventDefault(), k(!0));
|
|
795
|
+
}, M = (L) => {
|
|
796
|
+
r && (L.preventDefault(), k(!1));
|
|
797
|
+
}, D = (L) => {
|
|
798
|
+
r && (L.preventDefault(), k(!1), g(L.dataTransfer.files));
|
|
799
|
+
}, U = () => {
|
|
800
|
+
f.current.click();
|
|
792
801
|
};
|
|
793
|
-
return /* @__PURE__ */ e(j, { children: /* @__PURE__ */
|
|
794
|
-
/* @__PURE__ */ e(
|
|
795
|
-
/* @__PURE__ */
|
|
802
|
+
return /* @__PURE__ */ e(j, { children: /* @__PURE__ */ h("div", { className: S || "col-span-12", children: [
|
|
803
|
+
/* @__PURE__ */ e(q, { label: n, required: s }),
|
|
804
|
+
/* @__PURE__ */ h(
|
|
796
805
|
"div",
|
|
797
806
|
{
|
|
798
|
-
className: `relative rounded-md p-2 transition-all ${
|
|
799
|
-
onDragOver:
|
|
800
|
-
onDragLeave:
|
|
801
|
-
onDrop:
|
|
807
|
+
className: `relative rounded-md p-2 transition-all ${u ? "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"}`,
|
|
808
|
+
onDragOver: y,
|
|
809
|
+
onDragLeave: M,
|
|
810
|
+
onDrop: D,
|
|
802
811
|
children: [
|
|
803
812
|
/* @__PURE__ */ e(
|
|
804
813
|
"input",
|
|
805
814
|
{
|
|
806
|
-
ref:
|
|
807
|
-
id:
|
|
815
|
+
ref: f,
|
|
816
|
+
id: d,
|
|
808
817
|
type: "file",
|
|
809
|
-
accept:
|
|
810
|
-
onChange: (
|
|
811
|
-
required: s && !
|
|
818
|
+
accept: i,
|
|
819
|
+
onChange: (L) => g(L.target.files),
|
|
820
|
+
required: s && !c,
|
|
812
821
|
className: "absolute opacity-0 right-[50%] top-[80%] -translate-y-1/2 pointer-events-none h-[10px]"
|
|
813
822
|
}
|
|
814
823
|
),
|
|
815
|
-
/* @__PURE__ */
|
|
824
|
+
/* @__PURE__ */ h(
|
|
816
825
|
"div",
|
|
817
826
|
{
|
|
818
|
-
className: `flex items-center space-x-4 transition-all ${
|
|
827
|
+
className: `flex items-center space-x-4 transition-all ${u ? "opacity-50" : ""}`,
|
|
819
828
|
children: [
|
|
820
|
-
|
|
829
|
+
c ? (
|
|
821
830
|
// Image preview with close button
|
|
822
|
-
/* @__PURE__ */
|
|
831
|
+
/* @__PURE__ */ h("div", { className: "relative group", children: [
|
|
823
832
|
/* @__PURE__ */ e(
|
|
824
833
|
"img",
|
|
825
834
|
{
|
|
826
|
-
src:
|
|
835
|
+
src: c.preview || c,
|
|
827
836
|
alt: "preview",
|
|
828
837
|
className: "object-cover w-20 h-20 rounded-full shadow-md"
|
|
829
838
|
}
|
|
@@ -832,177 +841,177 @@ const ca = ({
|
|
|
832
841
|
"button",
|
|
833
842
|
{
|
|
834
843
|
type: "button",
|
|
835
|
-
onClick:
|
|
844
|
+
onClick: N,
|
|
836
845
|
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",
|
|
837
846
|
"aria-label": "Remove image",
|
|
838
|
-
children: /* @__PURE__ */ e(
|
|
847
|
+
children: /* @__PURE__ */ e(ne, { icon: "mdi:close", className: "w-3 h-3" })
|
|
839
848
|
}
|
|
840
849
|
)
|
|
841
850
|
] })
|
|
842
851
|
) : (
|
|
843
852
|
// Placeholder icon
|
|
844
853
|
/* @__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(
|
|
845
|
-
|
|
854
|
+
ne,
|
|
846
855
|
{
|
|
847
856
|
icon: "ri:image-add-fill",
|
|
848
857
|
className: "text-gray-400 w-10 h-10"
|
|
849
858
|
}
|
|
850
859
|
) })
|
|
851
860
|
),
|
|
852
|
-
/* @__PURE__ */
|
|
861
|
+
/* @__PURE__ */ h("div", { className: "flex flex-col items-center space-y-1", children: [
|
|
853
862
|
/* @__PURE__ */ e(
|
|
854
|
-
|
|
863
|
+
Q,
|
|
855
864
|
{
|
|
856
865
|
type: "button",
|
|
857
|
-
onClick:
|
|
866
|
+
onClick: U,
|
|
858
867
|
variant: "outlined",
|
|
859
868
|
color: "default",
|
|
860
|
-
children:
|
|
869
|
+
children: c ? "Change Image" : "Select Image"
|
|
861
870
|
}
|
|
862
871
|
),
|
|
863
|
-
|
|
872
|
+
r && !c && /* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: "or drag and drop" })
|
|
864
873
|
] })
|
|
865
874
|
]
|
|
866
875
|
}
|
|
867
876
|
),
|
|
868
|
-
|
|
877
|
+
r && u && /* @__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" }) })
|
|
869
878
|
]
|
|
870
879
|
}
|
|
871
880
|
)
|
|
872
|
-
] },
|
|
873
|
-
},
|
|
881
|
+
] }, x) });
|
|
882
|
+
}, ze = Me.forwardRef(
|
|
874
883
|
({
|
|
875
|
-
label:
|
|
884
|
+
label: n,
|
|
876
885
|
required: o,
|
|
877
|
-
parentClass:
|
|
886
|
+
parentClass: t = "",
|
|
878
887
|
className: s = "",
|
|
879
|
-
type:
|
|
880
|
-
onKeyDown:
|
|
881
|
-
negativeNumberAllow:
|
|
882
|
-
defaultValue:
|
|
883
|
-
field:
|
|
884
|
-
...
|
|
885
|
-
},
|
|
886
|
-
const [
|
|
887
|
-
if (
|
|
888
|
-
if (["e", "E", "+"].includes(
|
|
889
|
-
|
|
888
|
+
type: i = "text",
|
|
889
|
+
onKeyDown: d,
|
|
890
|
+
negativeNumberAllow: r = !0,
|
|
891
|
+
defaultValue: x = "",
|
|
892
|
+
field: S = {},
|
|
893
|
+
...c
|
|
894
|
+
}, b) => {
|
|
895
|
+
const [u, k] = C(!1), f = (N) => {
|
|
896
|
+
if (i === "number") {
|
|
897
|
+
if (["e", "E", "+"].includes(N.key)) {
|
|
898
|
+
N.preventDefault();
|
|
890
899
|
return;
|
|
891
900
|
}
|
|
892
|
-
if (
|
|
893
|
-
|
|
901
|
+
if (r == !1 && N.key === "-") {
|
|
902
|
+
N.preventDefault();
|
|
894
903
|
return;
|
|
895
904
|
}
|
|
896
|
-
if (["ArrowUp", "ArrowDown"].includes(
|
|
897
|
-
|
|
905
|
+
if (["ArrowUp", "ArrowDown"].includes(N.key)) {
|
|
906
|
+
N.preventDefault();
|
|
898
907
|
return;
|
|
899
908
|
}
|
|
900
909
|
}
|
|
901
|
-
|
|
902
|
-
},
|
|
910
|
+
d == null || d(N);
|
|
911
|
+
}, g = `
|
|
903
912
|
h-10 placeholder-gray-400 dark:placeholder-gray-400
|
|
904
|
-
${
|
|
905
|
-
${
|
|
913
|
+
${i === "password" ? "pr-10" : ""}
|
|
914
|
+
${i === "number" ? "no-spinner" : ""}
|
|
906
915
|
${s}
|
|
907
916
|
`.trim();
|
|
908
|
-
return
|
|
909
|
-
if (
|
|
910
|
-
let
|
|
917
|
+
return K(() => {
|
|
918
|
+
if (x) {
|
|
919
|
+
let N = c.value || x;
|
|
911
920
|
setTimeout(() => {
|
|
912
|
-
var
|
|
913
|
-
(
|
|
921
|
+
var y;
|
|
922
|
+
(y = c.onChange) == null || y.call(c, { target: { value: N } });
|
|
914
923
|
}, 100);
|
|
915
924
|
}
|
|
916
|
-
}, [
|
|
925
|
+
}, [x]), /* @__PURE__ */ e(j, { children: /* @__PURE__ */ h("div", { className: t || "col-span-12", children: [
|
|
917
926
|
/* @__PURE__ */ e(
|
|
918
|
-
|
|
927
|
+
q,
|
|
919
928
|
{
|
|
920
|
-
label:
|
|
929
|
+
label: n,
|
|
921
930
|
required: o,
|
|
922
|
-
infoText:
|
|
931
|
+
infoText: S.infoText
|
|
923
932
|
}
|
|
924
933
|
),
|
|
925
|
-
/* @__PURE__ */
|
|
934
|
+
/* @__PURE__ */ h("div", { className: "relative", children: [
|
|
926
935
|
/* @__PURE__ */ e(
|
|
927
936
|
"input",
|
|
928
937
|
{
|
|
929
|
-
type:
|
|
930
|
-
ref:
|
|
938
|
+
type: i === "password" && u ? "text" : i,
|
|
939
|
+
ref: b,
|
|
931
940
|
required: o,
|
|
932
|
-
onKeyDown:
|
|
933
|
-
className:
|
|
934
|
-
...
|
|
941
|
+
onKeyDown: f,
|
|
942
|
+
className: g,
|
|
943
|
+
...c
|
|
935
944
|
}
|
|
936
945
|
),
|
|
937
|
-
|
|
946
|
+
i === "password" && /* @__PURE__ */ e(
|
|
938
947
|
"button",
|
|
939
948
|
{
|
|
940
949
|
type: "button",
|
|
941
950
|
tabIndex: -1,
|
|
942
|
-
onClick: () =>
|
|
951
|
+
onClick: () => k((N) => !N),
|
|
943
952
|
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",
|
|
944
953
|
children: /* @__PURE__ */ e(
|
|
945
|
-
|
|
954
|
+
ne,
|
|
946
955
|
{
|
|
947
|
-
icon:
|
|
956
|
+
icon: u ? "mdi:eye-outline" : "mdi:eye-off-outline",
|
|
948
957
|
className: "w-5 h-5"
|
|
949
958
|
}
|
|
950
959
|
)
|
|
951
960
|
}
|
|
952
961
|
)
|
|
953
962
|
] })
|
|
954
|
-
] },
|
|
963
|
+
] }, c.name) });
|
|
955
964
|
}
|
|
956
965
|
);
|
|
957
|
-
|
|
958
|
-
const
|
|
959
|
-
key:
|
|
966
|
+
ze.displayName = "Input";
|
|
967
|
+
const ga = ({
|
|
968
|
+
key: n,
|
|
960
969
|
editorKey: o = "",
|
|
961
|
-
value:
|
|
970
|
+
value: t = "",
|
|
962
971
|
onChange: s,
|
|
963
|
-
label:
|
|
964
|
-
required:
|
|
965
|
-
placeholder:
|
|
966
|
-
parentClass:
|
|
967
|
-
height:
|
|
968
|
-
inline:
|
|
969
|
-
disabled:
|
|
970
|
-
plugins:
|
|
971
|
-
toolbar:
|
|
972
|
-
menubar:
|
|
973
|
-
fontFamily:
|
|
974
|
-
initConfig:
|
|
975
|
-
imageUploadHandler:
|
|
972
|
+
label: i = "",
|
|
973
|
+
required: d = !1,
|
|
974
|
+
placeholder: r = "",
|
|
975
|
+
parentClass: x = "col-span-12",
|
|
976
|
+
height: S = 400,
|
|
977
|
+
inline: c = !1,
|
|
978
|
+
disabled: b = !1,
|
|
979
|
+
plugins: u,
|
|
980
|
+
toolbar: k,
|
|
981
|
+
menubar: f = !1,
|
|
982
|
+
fontFamily: g = "Inter, sans-serif",
|
|
983
|
+
initConfig: N = {},
|
|
984
|
+
imageUploadHandler: y
|
|
976
985
|
// ✅ Promise function passed from parent
|
|
977
|
-
}) => /* @__PURE__ */
|
|
978
|
-
|
|
986
|
+
}) => /* @__PURE__ */ h("div", { className: x, children: [
|
|
987
|
+
i && /* @__PURE__ */ e(q, { label: i, required: d }),
|
|
979
988
|
/* @__PURE__ */ e(
|
|
980
|
-
|
|
989
|
+
sa,
|
|
981
990
|
{
|
|
982
991
|
apiKey: o,
|
|
983
|
-
value:
|
|
984
|
-
disabled:
|
|
992
|
+
value: t,
|
|
993
|
+
disabled: b,
|
|
985
994
|
init: {
|
|
986
|
-
height:
|
|
987
|
-
inline:
|
|
988
|
-
menubar:
|
|
995
|
+
height: S,
|
|
996
|
+
inline: c,
|
|
997
|
+
menubar: f,
|
|
989
998
|
branding: !1,
|
|
990
999
|
statusbar: !0,
|
|
991
1000
|
automatic_uploads: !0,
|
|
992
|
-
images_upload_handler: (
|
|
993
|
-
if (!
|
|
994
|
-
|
|
1001
|
+
images_upload_handler: (L) => new Promise((O, E) => {
|
|
1002
|
+
if (!y) {
|
|
1003
|
+
O(`data:${L.blob().type};base64,${L.base64()}`);
|
|
995
1004
|
return;
|
|
996
1005
|
}
|
|
997
|
-
|
|
998
|
-
F ?
|
|
1006
|
+
y(L).then((F) => {
|
|
1007
|
+
F ? O(F) : E("Upload failed: No URL returned");
|
|
999
1008
|
}).catch((F) => {
|
|
1000
|
-
|
|
1009
|
+
E(
|
|
1001
1010
|
typeof F == "string" ? F : (F == null ? void 0 : F.message) || "Image upload failed"
|
|
1002
1011
|
);
|
|
1003
1012
|
});
|
|
1004
1013
|
}),
|
|
1005
|
-
plugins:
|
|
1014
|
+
plugins: u ?? [
|
|
1006
1015
|
"advlist",
|
|
1007
1016
|
"autolink",
|
|
1008
1017
|
"lists",
|
|
@@ -1021,463 +1030,762 @@ const ha = ({
|
|
|
1021
1030
|
"help",
|
|
1022
1031
|
"wordcount"
|
|
1023
1032
|
],
|
|
1024
|
-
toolbar:
|
|
1025
|
-
placeholder:
|
|
1033
|
+
toolbar: k ?? "undo redo | blocks | bold italic underline forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image media table | removeformat | code fullscreen preview",
|
|
1034
|
+
placeholder: r,
|
|
1026
1035
|
content_style: `
|
|
1027
1036
|
body {
|
|
1028
|
-
font-family: ${
|
|
1037
|
+
font-family: ${g};
|
|
1029
1038
|
}
|
|
1030
1039
|
`,
|
|
1031
|
-
...
|
|
1040
|
+
...N
|
|
1032
1041
|
},
|
|
1033
|
-
onEditorChange: (
|
|
1034
|
-
s && s(
|
|
1042
|
+
onEditorChange: (L) => {
|
|
1043
|
+
s && s(L);
|
|
1035
1044
|
}
|
|
1036
1045
|
}
|
|
1037
1046
|
)
|
|
1038
|
-
] },
|
|
1039
|
-
name:
|
|
1047
|
+
] }, n), ma = ({
|
|
1048
|
+
name: n = "",
|
|
1040
1049
|
label: o = "",
|
|
1041
1050
|
// label for single checkbox
|
|
1042
|
-
options:
|
|
1051
|
+
options: t = [],
|
|
1043
1052
|
// array of { label, value } for multiple
|
|
1044
1053
|
value: s = null,
|
|
1045
1054
|
// boolean for single, array for multiple, or string for single select
|
|
1046
|
-
onChange:
|
|
1047
|
-
disabled:
|
|
1048
|
-
required:
|
|
1049
|
-
parentClass:
|
|
1050
|
-
className:
|
|
1051
|
-
multiSelect:
|
|
1055
|
+
onChange: i,
|
|
1056
|
+
disabled: d = !1,
|
|
1057
|
+
required: r = !1,
|
|
1058
|
+
parentClass: x = "col-span-12",
|
|
1059
|
+
className: S = "",
|
|
1060
|
+
multiSelect: c = !1
|
|
1052
1061
|
// ✅ if true, only one option can be selected (like radio)
|
|
1053
1062
|
}) => {
|
|
1054
|
-
const
|
|
1055
|
-
|
|
1056
|
-
},
|
|
1057
|
-
if (
|
|
1058
|
-
if (!
|
|
1059
|
-
|
|
1063
|
+
const b = Array.isArray(t) && t.length > 0, u = (g) => b ? c ? Array.isArray(s) && s.includes(g) : s === g : !!s, k = (g) => {
|
|
1064
|
+
i == null || i(g.target.checked, n);
|
|
1065
|
+
}, f = (g, N) => {
|
|
1066
|
+
if (i)
|
|
1067
|
+
if (!c)
|
|
1068
|
+
i(N ? g : "", n);
|
|
1060
1069
|
else {
|
|
1061
|
-
const
|
|
1062
|
-
if (
|
|
1063
|
-
|
|
1070
|
+
const y = Array.isArray(s) ? [...s] : [];
|
|
1071
|
+
if (N)
|
|
1072
|
+
y.includes(g) || y.push(g);
|
|
1064
1073
|
else {
|
|
1065
|
-
const
|
|
1066
|
-
|
|
1074
|
+
const M = y.indexOf(g);
|
|
1075
|
+
M > -1 && y.splice(M, 1);
|
|
1067
1076
|
}
|
|
1068
|
-
|
|
1077
|
+
i(y, n);
|
|
1069
1078
|
}
|
|
1070
1079
|
};
|
|
1071
|
-
return
|
|
1072
|
-
/* @__PURE__ */ e(
|
|
1073
|
-
/* @__PURE__ */ e("div", { className: "flex flex-col space-y-2", children:
|
|
1080
|
+
return b ? /* @__PURE__ */ e(j, { children: /* @__PURE__ */ h("div", { className: `${x}`, children: [
|
|
1081
|
+
/* @__PURE__ */ e(q, { label: o, required: r }),
|
|
1082
|
+
/* @__PURE__ */ e("div", { className: "flex flex-col space-y-2", children: t.map((g, N) => /* @__PURE__ */ h("div", { className: "flex items-center", children: [
|
|
1074
1083
|
/* @__PURE__ */ e(
|
|
1075
1084
|
"input",
|
|
1076
1085
|
{
|
|
1077
1086
|
type: "checkbox",
|
|
1078
|
-
name:
|
|
1079
|
-
value:
|
|
1080
|
-
checked:
|
|
1081
|
-
disabled:
|
|
1082
|
-
required:
|
|
1083
|
-
onChange: (
|
|
1084
|
-
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 ${
|
|
1087
|
+
name: n,
|
|
1088
|
+
value: g.value,
|
|
1089
|
+
checked: u(g.value),
|
|
1090
|
+
disabled: d || g.disabled,
|
|
1091
|
+
required: r && N === 0,
|
|
1092
|
+
onChange: (y) => f(g.value, y.target.checked),
|
|
1093
|
+
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 ${S}`
|
|
1085
1094
|
},
|
|
1086
|
-
|
|
1095
|
+
n
|
|
1087
1096
|
),
|
|
1088
|
-
|
|
1097
|
+
g.label && /* @__PURE__ */ e(
|
|
1089
1098
|
"label",
|
|
1090
1099
|
{
|
|
1091
|
-
htmlFor:
|
|
1100
|
+
htmlFor: n,
|
|
1092
1101
|
className: "ml-2 text-sm text-gray-700 dark:text-gray-200 select-none",
|
|
1093
|
-
children:
|
|
1102
|
+
children: g.label
|
|
1094
1103
|
}
|
|
1095
1104
|
)
|
|
1096
|
-
] },
|
|
1097
|
-
] }) }) : /* @__PURE__ */
|
|
1105
|
+
] }, g.value || g.label)) })
|
|
1106
|
+
] }) }) : /* @__PURE__ */ h("div", { className: `flex items-center ${x}`, children: [
|
|
1098
1107
|
/* @__PURE__ */ e(
|
|
1099
1108
|
"input",
|
|
1100
1109
|
{
|
|
1101
1110
|
type: "checkbox",
|
|
1102
|
-
name:
|
|
1103
|
-
checked:
|
|
1104
|
-
disabled:
|
|
1105
|
-
required:
|
|
1106
|
-
onChange:
|
|
1107
|
-
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 ${
|
|
1111
|
+
name: n,
|
|
1112
|
+
checked: u(),
|
|
1113
|
+
disabled: d,
|
|
1114
|
+
required: r,
|
|
1115
|
+
onChange: k,
|
|
1116
|
+
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 ${S}`
|
|
1108
1117
|
}
|
|
1109
1118
|
),
|
|
1110
1119
|
o && /* @__PURE__ */ e(
|
|
1111
1120
|
"label",
|
|
1112
1121
|
{
|
|
1113
|
-
htmlFor:
|
|
1122
|
+
htmlFor: n,
|
|
1114
1123
|
className: "ml-2 text-sm text-gray-700 dark:text-gray-200 select-none",
|
|
1115
1124
|
children: o
|
|
1116
1125
|
}
|
|
1117
1126
|
)
|
|
1118
1127
|
] });
|
|
1119
|
-
},
|
|
1120
|
-
label:
|
|
1128
|
+
}, fa = ({
|
|
1129
|
+
label: n = "",
|
|
1121
1130
|
value: o = null,
|
|
1122
|
-
onChange:
|
|
1131
|
+
onChange: t,
|
|
1123
1132
|
required: s = !1,
|
|
1124
|
-
accept:
|
|
1125
|
-
id:
|
|
1126
|
-
dragDrop:
|
|
1127
|
-
name:
|
|
1128
|
-
parentClass:
|
|
1133
|
+
accept: i = "audio/*",
|
|
1134
|
+
id: d,
|
|
1135
|
+
dragDrop: r = !1,
|
|
1136
|
+
name: x = "",
|
|
1137
|
+
parentClass: S = ""
|
|
1129
1138
|
}) => {
|
|
1130
|
-
const [
|
|
1131
|
-
|
|
1139
|
+
const [c, b] = C(null), [u, k] = C(!1), f = X(null);
|
|
1140
|
+
K(() => {
|
|
1132
1141
|
if (!o) {
|
|
1133
|
-
|
|
1142
|
+
g(), b(null);
|
|
1134
1143
|
return;
|
|
1135
1144
|
}
|
|
1136
1145
|
if (o instanceof File) {
|
|
1137
|
-
const
|
|
1138
|
-
return
|
|
1139
|
-
URL.revokeObjectURL(
|
|
1146
|
+
const O = URL.createObjectURL(o);
|
|
1147
|
+
return b({ file: o, preview: O }), () => {
|
|
1148
|
+
URL.revokeObjectURL(O);
|
|
1140
1149
|
};
|
|
1141
|
-
} else typeof o == "string" ?
|
|
1150
|
+
} else typeof o == "string" ? b({ preview: o }) : o != null && o.preview && b(o);
|
|
1142
1151
|
}, [o]);
|
|
1143
|
-
const
|
|
1144
|
-
|
|
1145
|
-
},
|
|
1146
|
-
if (!
|
|
1152
|
+
const g = () => {
|
|
1153
|
+
c != null && c.preview && c.preview.startsWith("blob:") && URL.revokeObjectURL(c.preview);
|
|
1154
|
+
}, N = (O) => {
|
|
1155
|
+
if (!O || O.length === 0)
|
|
1147
1156
|
return;
|
|
1148
|
-
const
|
|
1149
|
-
|
|
1150
|
-
},
|
|
1151
|
-
|
|
1152
|
-
},
|
|
1153
|
-
|
|
1154
|
-
},
|
|
1155
|
-
|
|
1156
|
-
},
|
|
1157
|
-
|
|
1158
|
-
},
|
|
1159
|
-
|
|
1157
|
+
const E = O[0], F = URL.createObjectURL(E);
|
|
1158
|
+
g(), b({ file: E, preview: F }), t == null || t(E);
|
|
1159
|
+
}, y = (O) => {
|
|
1160
|
+
O && O.stopPropagation(), g(), b(null), t == null || t(null), f.current && (f.current.value = "");
|
|
1161
|
+
}, M = (O) => {
|
|
1162
|
+
r && (O.preventDefault(), k(!0));
|
|
1163
|
+
}, D = (O) => {
|
|
1164
|
+
r && (O.preventDefault(), k(!1));
|
|
1165
|
+
}, U = (O) => {
|
|
1166
|
+
r && (O.preventDefault(), k(!1), N(O.dataTransfer.files));
|
|
1167
|
+
}, L = () => {
|
|
1168
|
+
f.current.click();
|
|
1160
1169
|
};
|
|
1161
|
-
return /* @__PURE__ */
|
|
1162
|
-
/* @__PURE__ */ e(
|
|
1163
|
-
/* @__PURE__ */
|
|
1170
|
+
return /* @__PURE__ */ h("div", { className: S || "col-span-12", children: [
|
|
1171
|
+
/* @__PURE__ */ e(q, { label: n, required: s }),
|
|
1172
|
+
/* @__PURE__ */ h(
|
|
1164
1173
|
"div",
|
|
1165
1174
|
{
|
|
1166
|
-
className: `relative rounded-lg p-2 transition-all ${
|
|
1167
|
-
onDragOver:
|
|
1168
|
-
onDragLeave:
|
|
1169
|
-
onDrop:
|
|
1175
|
+
className: `relative rounded-lg p-2 transition-all ${u ? "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"}`,
|
|
1176
|
+
onDragOver: M,
|
|
1177
|
+
onDragLeave: D,
|
|
1178
|
+
onDrop: U,
|
|
1170
1179
|
children: [
|
|
1171
1180
|
/* @__PURE__ */ e(
|
|
1172
1181
|
"input",
|
|
1173
1182
|
{
|
|
1174
|
-
ref:
|
|
1175
|
-
id:
|
|
1183
|
+
ref: f,
|
|
1184
|
+
id: d,
|
|
1176
1185
|
type: "file",
|
|
1177
|
-
accept:
|
|
1178
|
-
onChange: (
|
|
1179
|
-
required: s && !
|
|
1186
|
+
accept: i,
|
|
1187
|
+
onChange: (O) => N(O.target.files),
|
|
1188
|
+
required: s && !c,
|
|
1180
1189
|
className: "absolute opacity-0 right-[50%] top-[80%] -translate-y-1/2 pointer-events-none h-[10px]"
|
|
1181
1190
|
}
|
|
1182
1191
|
),
|
|
1183
1192
|
/* @__PURE__ */ e(
|
|
1184
1193
|
"div",
|
|
1185
1194
|
{
|
|
1186
|
-
className: `flex items-center space-x-4 transition-all ${
|
|
1187
|
-
children:
|
|
1195
|
+
className: `flex items-center space-x-4 transition-all ${u ? "opacity-50" : ""}`,
|
|
1196
|
+
children: c ? (
|
|
1188
1197
|
// Audio player with close button and change button
|
|
1189
|
-
/* @__PURE__ */
|
|
1190
|
-
/* @__PURE__ */
|
|
1198
|
+
/* @__PURE__ */ h("div", { className: "flex items-center space-x-4", children: [
|
|
1199
|
+
/* @__PURE__ */ h("div", { className: "relative w-full", children: [
|
|
1191
1200
|
!s && /* @__PURE__ */ e(
|
|
1192
1201
|
"button",
|
|
1193
1202
|
{
|
|
1194
1203
|
type: "button",
|
|
1195
|
-
onClick:
|
|
1204
|
+
onClick: y,
|
|
1196
1205
|
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",
|
|
1197
1206
|
"aria-label": "Remove audio",
|
|
1198
|
-
children: /* @__PURE__ */ e(
|
|
1207
|
+
children: /* @__PURE__ */ e(ne, { icon: "mdi:close", className: "w-3 h-3" })
|
|
1199
1208
|
}
|
|
1200
1209
|
),
|
|
1201
1210
|
/* @__PURE__ */ e(
|
|
1202
1211
|
"audio",
|
|
1203
1212
|
{
|
|
1204
|
-
src:
|
|
1213
|
+
src: c.preview,
|
|
1205
1214
|
controls: !0,
|
|
1206
1215
|
controlsList: "nodownload"
|
|
1207
1216
|
},
|
|
1208
|
-
|
|
1217
|
+
c.preview
|
|
1209
1218
|
)
|
|
1210
1219
|
] }),
|
|
1211
|
-
/* @__PURE__ */ e(
|
|
1220
|
+
/* @__PURE__ */ e(Q, { type: "button", onClick: L, children: /* @__PURE__ */ e("span", { children: "Change Audio File" }) })
|
|
1212
1221
|
] })
|
|
1213
1222
|
) : (
|
|
1214
1223
|
// Empty state with upload button
|
|
1215
|
-
/* @__PURE__ */
|
|
1216
|
-
/* @__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(
|
|
1224
|
+
/* @__PURE__ */ h("div", { className: "flex items-center justify-center space-x-4", children: [
|
|
1225
|
+
/* @__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(ne, { icon: "mdi:music", className: "text-gray-400 w-10 h-10" }) }),
|
|
1217
1226
|
/* @__PURE__ */ e(
|
|
1218
|
-
|
|
1227
|
+
Q,
|
|
1219
1228
|
{
|
|
1220
1229
|
type: "button",
|
|
1221
|
-
onClick:
|
|
1230
|
+
onClick: L,
|
|
1222
1231
|
variant: "outlined",
|
|
1223
1232
|
children: /* @__PURE__ */ e("span", { children: "Choose Audio File" })
|
|
1224
1233
|
}
|
|
1225
1234
|
),
|
|
1226
|
-
|
|
1235
|
+
r && /* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: "or drag and drop your audio file here" })
|
|
1227
1236
|
] })
|
|
1228
1237
|
)
|
|
1229
1238
|
}
|
|
1230
1239
|
),
|
|
1231
|
-
|
|
1240
|
+
r && u && !c && /* @__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" }) })
|
|
1232
1241
|
]
|
|
1233
1242
|
}
|
|
1234
1243
|
)
|
|
1235
|
-
] },
|
|
1236
|
-
},
|
|
1244
|
+
] }, x);
|
|
1245
|
+
}, Pe = ({ src: n, alt: o = "preview", isOpen: t, setIsOpen: s }) => {
|
|
1246
|
+
const i = () => s(!1);
|
|
1247
|
+
return K(() => {
|
|
1248
|
+
const d = (r) => {
|
|
1249
|
+
r.key === "Escape" && i();
|
|
1250
|
+
};
|
|
1251
|
+
return t && (document.body.style.overflow = "hidden", document.addEventListener("keydown", d)), () => {
|
|
1252
|
+
document.body.style.overflow = "", document.removeEventListener("keydown", d);
|
|
1253
|
+
};
|
|
1254
|
+
}, [t]), /* @__PURE__ */ e(j, { children: /* @__PURE__ */ h(
|
|
1255
|
+
"div",
|
|
1256
|
+
{
|
|
1257
|
+
className: `fixed inset-0 z-50 flex items-center justify-center bg-black/70 dark:bg-black/80 \r
|
|
1258
|
+
backdrop-blur-sm animate-in fade-in duration-200`,
|
|
1259
|
+
onClick: i,
|
|
1260
|
+
children: [
|
|
1261
|
+
/* @__PURE__ */ e(
|
|
1262
|
+
"button",
|
|
1263
|
+
{
|
|
1264
|
+
onClick: i,
|
|
1265
|
+
className: `absolute top-4 right-4 bg-white dark:bg-gray-800 text-gray-800 dark:text-gray-200\r
|
|
1266
|
+
hover:bg-gray-100 dark:hover:bg-gray-700 rounded-full p-2 shadow-lg transition`,
|
|
1267
|
+
children: /* @__PURE__ */ e(Le, { size: 20 })
|
|
1268
|
+
}
|
|
1269
|
+
),
|
|
1270
|
+
/* @__PURE__ */ e(
|
|
1271
|
+
"div",
|
|
1272
|
+
{
|
|
1273
|
+
className: "max-w-5xl w-full px-4 transform transition-all duration-200 scale-95 animate-in zoom-in-95",
|
|
1274
|
+
onClick: (d) => d.stopPropagation(),
|
|
1275
|
+
children: /* @__PURE__ */ e(
|
|
1276
|
+
"img",
|
|
1277
|
+
{
|
|
1278
|
+
src: n,
|
|
1279
|
+
alt: o,
|
|
1280
|
+
className: "w-full max-h-[90vh] object-contain rounded-xl"
|
|
1281
|
+
}
|
|
1282
|
+
)
|
|
1283
|
+
}
|
|
1284
|
+
)
|
|
1285
|
+
]
|
|
1286
|
+
}
|
|
1287
|
+
) });
|
|
1288
|
+
}, He = ({ col: n, data: o }) => {
|
|
1289
|
+
let t = o[n.titleKey], s = o[n.subtitleKey], i = o[n.imageKey], d = n.fallback_icon;
|
|
1290
|
+
const [r, x] = C(null), [S, c] = C(!1), b = (u) => {
|
|
1291
|
+
u && u.src instanceof File && (u = { ...u, src: URL.createObjectURL(u.src) }), x(u), c(!0);
|
|
1292
|
+
};
|
|
1293
|
+
return /* @__PURE__ */ h(j, { children: [
|
|
1294
|
+
S && /* @__PURE__ */ e(
|
|
1295
|
+
Pe,
|
|
1296
|
+
{
|
|
1297
|
+
src: r.src,
|
|
1298
|
+
alt: r.alt,
|
|
1299
|
+
isOpen: S,
|
|
1300
|
+
setIsOpen: c
|
|
1301
|
+
}
|
|
1302
|
+
),
|
|
1303
|
+
/* @__PURE__ */ h(
|
|
1304
|
+
"div",
|
|
1305
|
+
{
|
|
1306
|
+
className: `col-span-12 flex items-center space-x-4 p-4 rounded-xl
|
|
1307
|
+
bg-gray-100 dark:bg-gray-900
|
|
1308
|
+
${n.blockClass}`,
|
|
1309
|
+
children: [
|
|
1310
|
+
i ? /* @__PURE__ */ e(
|
|
1311
|
+
"img",
|
|
1312
|
+
{
|
|
1313
|
+
src: i instanceof File ? URL.createObjectURL(i) : i,
|
|
1314
|
+
alt: t,
|
|
1315
|
+
onClick: () => b({ src: i, alt: t }),
|
|
1316
|
+
className: "w-16 h-16 cursor-pointer rounded-full object-cover border-2 border-gray-200 dark:border-gray-700"
|
|
1317
|
+
}
|
|
1318
|
+
) : d ? d instanceof Function ? d(o) : d : /* @__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(Ae, { className: "w-8 h-8 text-gray-400" }) }),
|
|
1319
|
+
/* @__PURE__ */ h("div", { children: [
|
|
1320
|
+
/* @__PURE__ */ e("h3", { className: "text-xl font-semibold text-gray-900 dark:text-white", children: t }),
|
|
1321
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: s })
|
|
1322
|
+
] })
|
|
1323
|
+
]
|
|
1324
|
+
}
|
|
1325
|
+
)
|
|
1326
|
+
] });
|
|
1327
|
+
}, Ye = ({ col: n, data: o }) => {
|
|
1328
|
+
let t = o[n.titleKey], s = o[n.subtitleKey], i = o[n.imageKey], d = n.label, r = n == null ? void 0 : n.icon, x = n.fallback_icon;
|
|
1329
|
+
const [S, c] = C(null), [b, u] = C(!1), k = (f) => {
|
|
1330
|
+
f && f.src instanceof File && (f = { ...f, src: URL.createObjectURL(f.src) }), c(f), u(!0);
|
|
1331
|
+
};
|
|
1332
|
+
return /* @__PURE__ */ h(j, { children: [
|
|
1333
|
+
b && /* @__PURE__ */ e(
|
|
1334
|
+
Pe,
|
|
1335
|
+
{
|
|
1336
|
+
src: S.src,
|
|
1337
|
+
alt: S.alt,
|
|
1338
|
+
isOpen: b,
|
|
1339
|
+
setIsOpen: u
|
|
1340
|
+
}
|
|
1341
|
+
),
|
|
1342
|
+
/* @__PURE__ */ h(
|
|
1343
|
+
"div",
|
|
1344
|
+
{
|
|
1345
|
+
className: `col-span-12 flex items-center space-x-4 p-4 rounded-xl
|
|
1346
|
+
bg-gray-100 dark:bg-gray-900
|
|
1347
|
+
${n.blockClass}`,
|
|
1348
|
+
children: [
|
|
1349
|
+
r && /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: r }),
|
|
1350
|
+
/* @__PURE__ */ h("div", { className: "flex-1 min-w-0", children: [
|
|
1351
|
+
/* @__PURE__ */ e("p", { className: "text-sm font-medium text-gray-500 dark:text-gray-400", children: d }),
|
|
1352
|
+
/* @__PURE__ */ h("div", { className: "flex items-center", children: [
|
|
1353
|
+
i ? /* @__PURE__ */ e(
|
|
1354
|
+
"img",
|
|
1355
|
+
{
|
|
1356
|
+
src: i instanceof File ? URL.createObjectURL(i) : i,
|
|
1357
|
+
alt: t,
|
|
1358
|
+
onClick: () => k({ src: i, alt: t }),
|
|
1359
|
+
className: "w-8 h-8 cursor-pointer rounded-full object-cover border-2 border-gray-200 dark:border-gray-700"
|
|
1360
|
+
}
|
|
1361
|
+
) : x ? x instanceof Function ? x(o) : x : /* @__PURE__ */ e("div", { className: "w-8 h-8 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(Ae, { className: "w-6 h-6 text-gray-400" }) }),
|
|
1362
|
+
/* @__PURE__ */ h("div", { className: "ml-2", children: [
|
|
1363
|
+
/* @__PURE__ */ e("p", { className: "mb-0 text-sm text-gray-900 dark:text-white break-words", children: t }),
|
|
1364
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: s })
|
|
1365
|
+
] })
|
|
1366
|
+
] })
|
|
1367
|
+
] })
|
|
1368
|
+
]
|
|
1369
|
+
}
|
|
1370
|
+
)
|
|
1371
|
+
] });
|
|
1372
|
+
}, Be = {
|
|
1373
|
+
blue: {
|
|
1374
|
+
bg: "bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",
|
|
1375
|
+
border: "border border-blue-300 text-blue-700 dark:border-blue-700 dark:text-blue-300"
|
|
1376
|
+
},
|
|
1377
|
+
teal: {
|
|
1378
|
+
bg: "bg-teal-100 text-teal-800 dark:bg-teal-900/30 dark:text-teal-300",
|
|
1379
|
+
border: "border border-teal-300 text-teal-700 dark:border-teal-700 dark:text-teal-300"
|
|
1380
|
+
},
|
|
1381
|
+
purple: {
|
|
1382
|
+
bg: "bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300",
|
|
1383
|
+
border: "border border-purple-300 text-purple-700 dark:border-purple-700 dark:text-purple-300"
|
|
1384
|
+
},
|
|
1385
|
+
yellow: {
|
|
1386
|
+
bg: "bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-300",
|
|
1387
|
+
border: "border border-yellow-300 text-yellow-700 dark:border-yellow-700 dark:text-yellow-300"
|
|
1388
|
+
},
|
|
1389
|
+
green: {
|
|
1390
|
+
bg: "bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300",
|
|
1391
|
+
border: "border border-green-300 text-green-700 dark:border-green-700 dark:text-green-300"
|
|
1392
|
+
},
|
|
1393
|
+
red: {
|
|
1394
|
+
bg: "bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300",
|
|
1395
|
+
border: "border border-red-300 text-red-700 dark:border-red-700 dark:text-red-300"
|
|
1396
|
+
},
|
|
1397
|
+
gray: {
|
|
1398
|
+
bg: "bg-gray-100 text-gray-800 dark:bg-gray-900/30 dark:text-gray-300",
|
|
1399
|
+
border: "border border-gray-300 text-gray-700 dark:border-gray-700 dark:text-gray-300"
|
|
1400
|
+
}
|
|
1401
|
+
}, Ue = {
|
|
1402
|
+
contained: "bg",
|
|
1403
|
+
outline: "border !bg-transparent",
|
|
1404
|
+
soft: "bg opacity-90"
|
|
1405
|
+
}, Ve = ({
|
|
1406
|
+
label: n,
|
|
1407
|
+
variant: o = "contained",
|
|
1408
|
+
// contained | outline | soft
|
|
1409
|
+
color: t = "green",
|
|
1410
|
+
className: s = ""
|
|
1411
|
+
}) => {
|
|
1412
|
+
const i = Be[t] || Be.green, d = Ue[o] || Ue.contained, r = o === "outline" ? i.border : i.bg;
|
|
1413
|
+
return /* @__PURE__ */ e(
|
|
1414
|
+
"span",
|
|
1415
|
+
{
|
|
1416
|
+
className: `inline-flex justify-center items-center rounded-sm text-xs font-semibold px-3 py-1 min-w-[78px]
|
|
1417
|
+
${r}
|
|
1418
|
+
${d}
|
|
1419
|
+
${s}`,
|
|
1420
|
+
children: n
|
|
1421
|
+
}
|
|
1422
|
+
);
|
|
1423
|
+
}, We = ({ col: n, data: o }) => {
|
|
1424
|
+
var S;
|
|
1425
|
+
let t = n == null ? void 0 : n.icon, s = n.label, i = o[n.key], d = n.type, r = n.variant || "outline", x = n.defaultColor;
|
|
1426
|
+
if (d === "chip" && ((S = n.chipOptions) == null ? void 0 : S.length) > 0) {
|
|
1427
|
+
let c = n == null ? void 0 : n.chipOptions.find((b) => b.value == i);
|
|
1428
|
+
c && (i = c.label, x = c.color);
|
|
1429
|
+
}
|
|
1430
|
+
return /* @__PURE__ */ h(
|
|
1431
|
+
"div",
|
|
1432
|
+
{
|
|
1433
|
+
className: `col-span-12 flex items-center space-x-4 p-4 rounded-xl
|
|
1434
|
+
bg-gray-100 dark:bg-gray-900 ${n.blockClass || ""}`,
|
|
1435
|
+
children: [
|
|
1436
|
+
t && /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: t }),
|
|
1437
|
+
/* @__PURE__ */ h("div", { className: "flex-1 min-w-0", children: [
|
|
1438
|
+
/* @__PURE__ */ e("p", { className: "text-sm font-medium text-gray-500 dark:text-gray-400", children: s }),
|
|
1439
|
+
d === "chip" ? /* @__PURE__ */ e(
|
|
1440
|
+
Ve,
|
|
1441
|
+
{
|
|
1442
|
+
label: i,
|
|
1443
|
+
variant: r,
|
|
1444
|
+
color: x,
|
|
1445
|
+
className: "mt-1"
|
|
1446
|
+
}
|
|
1447
|
+
) : (
|
|
1448
|
+
/* TINY EDITOR */
|
|
1449
|
+
d === "tinyEditor" ? /* @__PURE__ */ e(
|
|
1450
|
+
"p",
|
|
1451
|
+
{
|
|
1452
|
+
className: "mt-1 text-sm text-gray-900 dark:text-white break-words",
|
|
1453
|
+
dangerouslySetInnerHTML: {
|
|
1454
|
+
__html: i
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
) : d === "audio" ? i ? /* @__PURE__ */ e(
|
|
1458
|
+
"audio",
|
|
1459
|
+
{
|
|
1460
|
+
controls: !0,
|
|
1461
|
+
src: i instanceof File ? URL.createObjectURL(i) : i,
|
|
1462
|
+
onClick: (c) => c.stopPropagation(),
|
|
1463
|
+
className: "shadow-md rounded-full mt-1"
|
|
1464
|
+
},
|
|
1465
|
+
i instanceof File ? URL.createObjectURL(i) : i
|
|
1466
|
+
) : /* @__PURE__ */ e("p", { className: "mt-1 text-sm text-gray-400", children: "N/A" }) : (
|
|
1467
|
+
/* DEFAULT */
|
|
1468
|
+
/* @__PURE__ */ e("p", { className: "mt-1 text-sm text-gray-900 dark:text-white break-words", children: d == "date" ? /* @__PURE__ */ e("span", { children: Ge(i, n.format || "DD MMM YYYY") }) : i || "N/A" })
|
|
1469
|
+
)
|
|
1470
|
+
)
|
|
1471
|
+
] })
|
|
1472
|
+
]
|
|
1473
|
+
}
|
|
1474
|
+
);
|
|
1475
|
+
}, ya = ({
|
|
1476
|
+
value: n = !0,
|
|
1477
|
+
onChange: o,
|
|
1478
|
+
text: t,
|
|
1479
|
+
options: s = [],
|
|
1480
|
+
label: i,
|
|
1481
|
+
required: d,
|
|
1482
|
+
name: r = "",
|
|
1483
|
+
disabled: x = !1,
|
|
1484
|
+
parentClass: S = ""
|
|
1485
|
+
}) => {
|
|
1486
|
+
const c = s.length > 0 ? s : [
|
|
1487
|
+
{ label: "Active", value: !0 },
|
|
1488
|
+
{ label: "Inactive", value: !1 }
|
|
1489
|
+
];
|
|
1490
|
+
return /* @__PURE__ */ e(j, { children: /* @__PURE__ */ h("div", { className: S || "col-span-12", children: [
|
|
1491
|
+
/* @__PURE__ */ e(q, { label: i, required: d }),
|
|
1492
|
+
/* @__PURE__ */ h("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: [
|
|
1493
|
+
t && /* @__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: t }),
|
|
1494
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-6", children: c.map((b, u) => /* @__PURE__ */ h(
|
|
1495
|
+
"label",
|
|
1496
|
+
{
|
|
1497
|
+
className: "flex items-center gap-2 cursor-pointer select-none",
|
|
1498
|
+
children: [
|
|
1499
|
+
/* @__PURE__ */ e(
|
|
1500
|
+
"input",
|
|
1501
|
+
{
|
|
1502
|
+
type: "radio",
|
|
1503
|
+
name: "switch-field",
|
|
1504
|
+
required: d && u === 0,
|
|
1505
|
+
value: b.value,
|
|
1506
|
+
disabled: x,
|
|
1507
|
+
checked: n === b.value,
|
|
1508
|
+
onChange: () => o(b.value),
|
|
1509
|
+
className: "w-4 h-4 border-gray-300 cursor-pointer"
|
|
1510
|
+
}
|
|
1511
|
+
),
|
|
1512
|
+
/* @__PURE__ */ e("span", { className: "text-sm text-gray-700 dark:text-white", children: b.label })
|
|
1513
|
+
]
|
|
1514
|
+
},
|
|
1515
|
+
u
|
|
1516
|
+
)) })
|
|
1517
|
+
] })
|
|
1518
|
+
] }, r) });
|
|
1519
|
+
}, qe = ({ field: n, formData: o, handleChange: t }) => {
|
|
1237
1520
|
const {
|
|
1238
1521
|
key: s,
|
|
1239
|
-
label:
|
|
1240
|
-
type:
|
|
1241
|
-
options:
|
|
1242
|
-
placeholder:
|
|
1243
|
-
rows:
|
|
1244
|
-
inputClass:
|
|
1245
|
-
search:
|
|
1246
|
-
accept:
|
|
1247
|
-
text:
|
|
1248
|
-
required:
|
|
1249
|
-
minLength:
|
|
1250
|
-
dragDrop:
|
|
1251
|
-
parentClass:
|
|
1252
|
-
countriesList:
|
|
1253
|
-
defaultCountry:
|
|
1254
|
-
multiple:
|
|
1255
|
-
dropdownMaxHeight:
|
|
1256
|
-
editorKey:
|
|
1257
|
-
fontFamily:
|
|
1522
|
+
label: i,
|
|
1523
|
+
type: d,
|
|
1524
|
+
options: r,
|
|
1525
|
+
placeholder: x,
|
|
1526
|
+
rows: S,
|
|
1527
|
+
inputClass: c,
|
|
1528
|
+
search: b,
|
|
1529
|
+
accept: u,
|
|
1530
|
+
text: k,
|
|
1531
|
+
required: f = !1,
|
|
1532
|
+
minLength: g,
|
|
1533
|
+
dragDrop: N,
|
|
1534
|
+
parentClass: y,
|
|
1535
|
+
countriesList: M,
|
|
1536
|
+
defaultCountry: D,
|
|
1537
|
+
multiple: U,
|
|
1538
|
+
dropdownMaxHeight: L,
|
|
1539
|
+
editorKey: O,
|
|
1540
|
+
fontFamily: E,
|
|
1258
1541
|
disabled: F,
|
|
1259
|
-
negativeNumberAllow:
|
|
1260
|
-
defaultValue:
|
|
1542
|
+
negativeNumberAllow: T,
|
|
1543
|
+
defaultValue: B,
|
|
1261
1544
|
renderCondition: G,
|
|
1262
|
-
optionDependencyKey:
|
|
1263
|
-
pattern:
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1545
|
+
optionDependencyKey: _,
|
|
1546
|
+
pattern: J,
|
|
1547
|
+
renderType: Z
|
|
1548
|
+
} = n;
|
|
1549
|
+
let A = o == null ? void 0 : o[s];
|
|
1550
|
+
A == null && (A = "");
|
|
1551
|
+
const z = x || (d === "select" ? `Select ${i}` : `Enter ${i}`), V = "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";
|
|
1268
1552
|
if (G && typeof G == "function" && !G(o))
|
|
1269
1553
|
return null;
|
|
1270
|
-
|
|
1554
|
+
if (Z && Z == "details")
|
|
1555
|
+
switch (d) {
|
|
1556
|
+
case "group":
|
|
1557
|
+
return /* @__PURE__ */ e(He, { col: n, data: o });
|
|
1558
|
+
case "cardGroup":
|
|
1559
|
+
return /* @__PURE__ */ e(Ye, { col: n, data: o });
|
|
1560
|
+
default:
|
|
1561
|
+
return /* @__PURE__ */ e(We, { col: n, data: o });
|
|
1562
|
+
}
|
|
1563
|
+
switch (d) {
|
|
1271
1564
|
case "select":
|
|
1272
1565
|
return /* @__PURE__ */ e(
|
|
1273
|
-
|
|
1566
|
+
ha,
|
|
1274
1567
|
{
|
|
1275
|
-
options:
|
|
1276
|
-
value:
|
|
1568
|
+
options: r || [],
|
|
1569
|
+
value: A,
|
|
1277
1570
|
formData: o,
|
|
1278
|
-
dependencyKey:
|
|
1279
|
-
onChange: (
|
|
1280
|
-
placeholder:
|
|
1281
|
-
className:
|
|
1282
|
-
search:
|
|
1283
|
-
required:
|
|
1284
|
-
defaultValue:
|
|
1285
|
-
label:
|
|
1571
|
+
dependencyKey: _,
|
|
1572
|
+
onChange: (I) => t(s, I),
|
|
1573
|
+
placeholder: z,
|
|
1574
|
+
className: c || "",
|
|
1575
|
+
search: b,
|
|
1576
|
+
required: f,
|
|
1577
|
+
defaultValue: B,
|
|
1578
|
+
label: i,
|
|
1286
1579
|
name: s,
|
|
1287
1580
|
disabled: F,
|
|
1288
|
-
parentClass:
|
|
1289
|
-
multiple:
|
|
1290
|
-
dropdownMaxHeight:
|
|
1581
|
+
parentClass: y,
|
|
1582
|
+
multiple: U,
|
|
1583
|
+
dropdownMaxHeight: L
|
|
1291
1584
|
}
|
|
1292
1585
|
);
|
|
1293
1586
|
case "checkbox":
|
|
1294
1587
|
return /* @__PURE__ */ e(
|
|
1295
|
-
|
|
1588
|
+
ma,
|
|
1296
1589
|
{
|
|
1297
1590
|
name: s,
|
|
1298
|
-
label:
|
|
1299
|
-
options:
|
|
1300
|
-
value:
|
|
1301
|
-
onChange: (
|
|
1302
|
-
required:
|
|
1303
|
-
parentClass:
|
|
1304
|
-
className:
|
|
1305
|
-
multiSelect:
|
|
1591
|
+
label: i,
|
|
1592
|
+
options: r || [],
|
|
1593
|
+
value: A,
|
|
1594
|
+
onChange: (I) => t(s, I),
|
|
1595
|
+
required: f,
|
|
1596
|
+
parentClass: y,
|
|
1597
|
+
className: c || "",
|
|
1598
|
+
multiSelect: U,
|
|
1306
1599
|
disabled: F
|
|
1307
1600
|
}
|
|
1308
1601
|
);
|
|
1602
|
+
case "radio":
|
|
1603
|
+
return /* @__PURE__ */ e(
|
|
1604
|
+
ya,
|
|
1605
|
+
{
|
|
1606
|
+
value: A,
|
|
1607
|
+
onChange: (I) => t(s, I),
|
|
1608
|
+
text: k,
|
|
1609
|
+
options: r || [],
|
|
1610
|
+
label: i,
|
|
1611
|
+
required: f,
|
|
1612
|
+
name: s,
|
|
1613
|
+
disabled: F,
|
|
1614
|
+
parentClass: y
|
|
1615
|
+
}
|
|
1616
|
+
);
|
|
1309
1617
|
case "switch":
|
|
1310
1618
|
return /* @__PURE__ */ e(
|
|
1311
|
-
|
|
1619
|
+
Ke,
|
|
1312
1620
|
{
|
|
1313
|
-
value:
|
|
1314
|
-
onChange: (
|
|
1315
|
-
text:
|
|
1316
|
-
options:
|
|
1317
|
-
label:
|
|
1318
|
-
required:
|
|
1621
|
+
value: A,
|
|
1622
|
+
onChange: (I) => t(s, I),
|
|
1623
|
+
text: k,
|
|
1624
|
+
options: r || [],
|
|
1625
|
+
label: i,
|
|
1626
|
+
required: f,
|
|
1319
1627
|
name: s,
|
|
1320
1628
|
disabled: F,
|
|
1321
|
-
parentClass:
|
|
1629
|
+
parentClass: y
|
|
1322
1630
|
}
|
|
1323
1631
|
);
|
|
1324
1632
|
case "phone":
|
|
1325
1633
|
return /* @__PURE__ */ e(
|
|
1326
|
-
|
|
1634
|
+
ba,
|
|
1327
1635
|
{
|
|
1328
|
-
value:
|
|
1329
|
-
onChange: (
|
|
1330
|
-
countriesList:
|
|
1331
|
-
defaultCountry:
|
|
1332
|
-
required:
|
|
1333
|
-
placeholder:
|
|
1334
|
-
search:
|
|
1335
|
-
label:
|
|
1636
|
+
value: A,
|
|
1637
|
+
onChange: (I) => t(s, I),
|
|
1638
|
+
countriesList: M,
|
|
1639
|
+
defaultCountry: D,
|
|
1640
|
+
required: f,
|
|
1641
|
+
placeholder: z,
|
|
1642
|
+
search: b,
|
|
1643
|
+
label: i,
|
|
1336
1644
|
name: s,
|
|
1337
1645
|
disabled: F,
|
|
1338
|
-
parentClass:
|
|
1646
|
+
parentClass: y
|
|
1339
1647
|
}
|
|
1340
1648
|
);
|
|
1341
1649
|
case "textarea":
|
|
1342
1650
|
return /* @__PURE__ */ e(
|
|
1343
|
-
|
|
1651
|
+
_e,
|
|
1344
1652
|
{
|
|
1345
|
-
value:
|
|
1346
|
-
onChange: (
|
|
1347
|
-
placeholder:
|
|
1348
|
-
rows:
|
|
1349
|
-
className: `${
|
|
1350
|
-
required:
|
|
1653
|
+
value: A,
|
|
1654
|
+
onChange: (I) => t(s, I.target.value),
|
|
1655
|
+
placeholder: z,
|
|
1656
|
+
rows: S || 3,
|
|
1657
|
+
className: `${V} ${c || ""}`,
|
|
1658
|
+
required: f,
|
|
1351
1659
|
name: s,
|
|
1352
|
-
label:
|
|
1660
|
+
label: i,
|
|
1353
1661
|
disabled: F,
|
|
1354
|
-
parentClass:
|
|
1662
|
+
parentClass: y
|
|
1355
1663
|
}
|
|
1356
1664
|
);
|
|
1357
1665
|
case "image":
|
|
1358
1666
|
return /* @__PURE__ */ e(
|
|
1359
|
-
|
|
1667
|
+
pa,
|
|
1360
1668
|
{
|
|
1361
|
-
value:
|
|
1362
|
-
onChange: (
|
|
1363
|
-
required:
|
|
1364
|
-
accept:
|
|
1669
|
+
value: A,
|
|
1670
|
+
onChange: (I) => t(s, I),
|
|
1671
|
+
required: f,
|
|
1672
|
+
accept: u || "image/*",
|
|
1365
1673
|
id: `file-${s}`,
|
|
1366
|
-
dragDrop:
|
|
1367
|
-
label:
|
|
1674
|
+
dragDrop: N,
|
|
1675
|
+
label: i,
|
|
1368
1676
|
name: s,
|
|
1369
|
-
parentClass:
|
|
1677
|
+
parentClass: y
|
|
1370
1678
|
}
|
|
1371
1679
|
);
|
|
1372
1680
|
case "audio":
|
|
1373
1681
|
return /* @__PURE__ */ e(
|
|
1374
|
-
|
|
1682
|
+
fa,
|
|
1375
1683
|
{
|
|
1376
|
-
value:
|
|
1377
|
-
onChange: (
|
|
1378
|
-
required:
|
|
1379
|
-
accept:
|
|
1684
|
+
value: A,
|
|
1685
|
+
onChange: (I) => t(s, I),
|
|
1686
|
+
required: f,
|
|
1687
|
+
accept: u || "audio/*",
|
|
1380
1688
|
id: `file-${s}`,
|
|
1381
|
-
dragDrop:
|
|
1382
|
-
label:
|
|
1689
|
+
dragDrop: N,
|
|
1690
|
+
label: i,
|
|
1383
1691
|
name: s,
|
|
1384
|
-
parentClass:
|
|
1692
|
+
parentClass: y
|
|
1385
1693
|
}
|
|
1386
1694
|
);
|
|
1387
1695
|
case "tinyEditor":
|
|
1388
1696
|
return /* @__PURE__ */ e(
|
|
1389
|
-
|
|
1697
|
+
ga,
|
|
1390
1698
|
{
|
|
1391
|
-
value:
|
|
1392
|
-
onChange: (
|
|
1393
|
-
required:
|
|
1394
|
-
placeholder:
|
|
1395
|
-
label:
|
|
1396
|
-
parentClass:
|
|
1397
|
-
fontFamily:
|
|
1398
|
-
editorKey:
|
|
1699
|
+
value: A,
|
|
1700
|
+
onChange: (I) => t(s, I),
|
|
1701
|
+
required: f,
|
|
1702
|
+
placeholder: z,
|
|
1703
|
+
label: i,
|
|
1704
|
+
parentClass: y,
|
|
1705
|
+
fontFamily: E,
|
|
1706
|
+
editorKey: O,
|
|
1399
1707
|
disabled: F
|
|
1400
1708
|
},
|
|
1401
1709
|
`editor-${s}`
|
|
1402
1710
|
);
|
|
1403
1711
|
default:
|
|
1404
1712
|
return /* @__PURE__ */ e(
|
|
1405
|
-
|
|
1713
|
+
ze,
|
|
1406
1714
|
{
|
|
1407
|
-
field:
|
|
1408
|
-
type:
|
|
1409
|
-
defaultValue:
|
|
1410
|
-
value:
|
|
1411
|
-
onChange: (
|
|
1412
|
-
placeholder:
|
|
1413
|
-
className: `${
|
|
1414
|
-
required:
|
|
1715
|
+
field: n,
|
|
1716
|
+
type: d || "text",
|
|
1717
|
+
defaultValue: B,
|
|
1718
|
+
value: A,
|
|
1719
|
+
onChange: (I) => t(s, I.target.value),
|
|
1720
|
+
placeholder: z,
|
|
1721
|
+
className: `${V} ${c || ""}`,
|
|
1722
|
+
required: f,
|
|
1415
1723
|
name: s,
|
|
1416
|
-
minLength:
|
|
1417
|
-
label:
|
|
1418
|
-
negativeNumberAllow:
|
|
1419
|
-
parentClass:
|
|
1724
|
+
minLength: g,
|
|
1725
|
+
label: i,
|
|
1726
|
+
negativeNumberAllow: T,
|
|
1727
|
+
parentClass: y,
|
|
1420
1728
|
disabled: F,
|
|
1421
|
-
pattern:
|
|
1729
|
+
pattern: J
|
|
1422
1730
|
}
|
|
1423
1731
|
);
|
|
1424
1732
|
}
|
|
1425
|
-
},
|
|
1426
|
-
var
|
|
1427
|
-
const [
|
|
1428
|
-
|
|
1429
|
-
},
|
|
1430
|
-
s == null || s(
|
|
1431
|
-
},
|
|
1432
|
-
|
|
1733
|
+
}, xa = ({ isOpen: n, onClose: o, config: t, onApply: s }) => {
|
|
1734
|
+
var c;
|
|
1735
|
+
const [i, d] = C({}), r = (b, u) => {
|
|
1736
|
+
d((k) => ({ ...k, [b]: u }));
|
|
1737
|
+
}, x = () => {
|
|
1738
|
+
s == null || s(i), o();
|
|
1739
|
+
}, S = () => {
|
|
1740
|
+
d({}), s == null || s({}), o();
|
|
1433
1741
|
};
|
|
1434
|
-
return /* @__PURE__ */
|
|
1742
|
+
return /* @__PURE__ */ h(j, { children: [
|
|
1435
1743
|
/* @__PURE__ */ e(
|
|
1436
1744
|
"div",
|
|
1437
1745
|
{
|
|
1438
|
-
className: `fixed inset-0 bg-black/50 z-40 transition-opacity duration-300 ${
|
|
1746
|
+
className: `fixed inset-0 bg-black/50 z-40 transition-opacity duration-300 ${n ? "opacity-100 pointer-events-auto" : "opacity-0 pointer-events-none"}`,
|
|
1439
1747
|
onClick: o
|
|
1440
1748
|
}
|
|
1441
1749
|
),
|
|
1442
|
-
/* @__PURE__ */
|
|
1750
|
+
/* @__PURE__ */ h(
|
|
1443
1751
|
"div",
|
|
1444
1752
|
{
|
|
1445
1753
|
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
|
|
1446
1754
|
transform transition-transform duration-300 ease-in-out
|
|
1447
|
-
${
|
|
1755
|
+
${n ? "translate-x-0" : "translate-x-full"}
|
|
1448
1756
|
`,
|
|
1449
1757
|
children: [
|
|
1450
|
-
/* @__PURE__ */
|
|
1758
|
+
/* @__PURE__ */ h("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-700", children: [
|
|
1451
1759
|
/* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: "Filters" }),
|
|
1452
1760
|
/* @__PURE__ */ e(
|
|
1453
1761
|
"button",
|
|
1454
1762
|
{
|
|
1455
1763
|
onClick: o,
|
|
1456
1764
|
className: "p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-md transition",
|
|
1457
|
-
children: /* @__PURE__ */ e(
|
|
1765
|
+
children: /* @__PURE__ */ e(Le, { className: "w-5 h-5 text-gray-500 dark:text-gray-400" })
|
|
1458
1766
|
}
|
|
1459
1767
|
)
|
|
1460
1768
|
] }),
|
|
1461
|
-
|
|
1462
|
-
|
|
1769
|
+
n && /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto px-4 py-3", children: t != null && t.component ? /* @__PURE__ */ e(
|
|
1770
|
+
t.component,
|
|
1463
1771
|
{
|
|
1464
|
-
filters:
|
|
1465
|
-
onFilterChange:
|
|
1772
|
+
filters: i,
|
|
1773
|
+
onFilterChange: r
|
|
1466
1774
|
}
|
|
1467
|
-
) : /* @__PURE__ */ e("div", { className: "space-y-4", children: (
|
|
1468
|
-
|
|
1775
|
+
) : /* @__PURE__ */ e("div", { className: "space-y-4", children: (c = t == null ? void 0 : t.fields) == null ? void 0 : c.map((b) => /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e(
|
|
1776
|
+
qe,
|
|
1469
1777
|
{
|
|
1470
|
-
field:
|
|
1471
|
-
formData:
|
|
1472
|
-
handleChange:
|
|
1778
|
+
field: b,
|
|
1779
|
+
formData: i,
|
|
1780
|
+
handleChange: r
|
|
1473
1781
|
},
|
|
1474
|
-
|
|
1782
|
+
b.key
|
|
1475
1783
|
) })) }) }),
|
|
1476
|
-
/* @__PURE__ */
|
|
1784
|
+
/* @__PURE__ */ h("div", { className: "flex gap-2 px-4 py-3 border-t border-gray-200 dark:border-gray-700", children: [
|
|
1477
1785
|
/* @__PURE__ */ e(
|
|
1478
|
-
|
|
1786
|
+
Q,
|
|
1479
1787
|
{
|
|
1480
|
-
onClick:
|
|
1788
|
+
onClick: x,
|
|
1481
1789
|
variant: "contained",
|
|
1482
1790
|
color: "primary",
|
|
1483
1791
|
fullWidth: !0,
|
|
@@ -1485,9 +1793,9 @@ const ha = ({
|
|
|
1485
1793
|
}
|
|
1486
1794
|
),
|
|
1487
1795
|
/* @__PURE__ */ e(
|
|
1488
|
-
|
|
1796
|
+
Q,
|
|
1489
1797
|
{
|
|
1490
|
-
onClick:
|
|
1798
|
+
onClick: S,
|
|
1491
1799
|
variant: "contained",
|
|
1492
1800
|
className: "min-w-[150px]",
|
|
1493
1801
|
children: "Reset"
|
|
@@ -1498,347 +1806,253 @@ const ha = ({
|
|
|
1498
1806
|
}
|
|
1499
1807
|
)
|
|
1500
1808
|
] });
|
|
1501
|
-
},
|
|
1502
|
-
blue: {
|
|
1503
|
-
bg: "bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",
|
|
1504
|
-
border: "border border-blue-300 text-blue-700 dark:border-blue-700 dark:text-blue-300"
|
|
1505
|
-
},
|
|
1506
|
-
teal: {
|
|
1507
|
-
bg: "bg-teal-100 text-teal-800 dark:bg-teal-900/30 dark:text-teal-300",
|
|
1508
|
-
border: "border border-teal-300 text-teal-700 dark:border-teal-700 dark:text-teal-300"
|
|
1509
|
-
},
|
|
1510
|
-
purple: {
|
|
1511
|
-
bg: "bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300",
|
|
1512
|
-
border: "border border-purple-300 text-purple-700 dark:border-purple-700 dark:text-purple-300"
|
|
1513
|
-
},
|
|
1514
|
-
yellow: {
|
|
1515
|
-
bg: "bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-300",
|
|
1516
|
-
border: "border border-yellow-300 text-yellow-700 dark:border-yellow-700 dark:text-yellow-300"
|
|
1517
|
-
},
|
|
1518
|
-
green: {
|
|
1519
|
-
bg: "bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300",
|
|
1520
|
-
border: "border border-green-300 text-green-700 dark:border-green-700 dark:text-green-300"
|
|
1521
|
-
},
|
|
1522
|
-
red: {
|
|
1523
|
-
bg: "bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300",
|
|
1524
|
-
border: "border border-red-300 text-red-700 dark:border-red-700 dark:text-red-300"
|
|
1525
|
-
},
|
|
1526
|
-
gray: {
|
|
1527
|
-
bg: "bg-gray-100 text-gray-800 dark:bg-gray-900/30 dark:text-gray-300",
|
|
1528
|
-
border: "border border-gray-300 text-gray-700 dark:border-gray-700 dark:text-gray-300"
|
|
1529
|
-
}
|
|
1530
|
-
}, Ue = {
|
|
1531
|
-
contained: "bg",
|
|
1532
|
-
outline: "border !bg-transparent",
|
|
1533
|
-
soft: "bg opacity-90"
|
|
1534
|
-
}, ze = ({
|
|
1535
|
-
label: b,
|
|
1536
|
-
variant: o = "contained",
|
|
1537
|
-
// contained | outline | soft
|
|
1538
|
-
color: l = "green",
|
|
1539
|
-
className: s = ""
|
|
1540
|
-
}) => {
|
|
1541
|
-
const c = Be[l] || Be.green, r = Ue[o] || Ue.contained, g = o === "outline" ? c.border : c.bg;
|
|
1542
|
-
return /* @__PURE__ */ e(
|
|
1543
|
-
"span",
|
|
1544
|
-
{
|
|
1545
|
-
className: `inline-flex justify-center items-center rounded-sm text-xs font-semibold px-3 py-1 min-w-[78px]
|
|
1546
|
-
${g}
|
|
1547
|
-
${r}
|
|
1548
|
-
${s}`,
|
|
1549
|
-
children: b
|
|
1550
|
-
}
|
|
1551
|
-
);
|
|
1552
|
-
}, ga = ({ rows: b = 5, columns: o = 5 }) => /* @__PURE__ */ u(j, { children: [
|
|
1809
|
+
}, va = ({ rows: n = 5, columns: o = 5 }) => /* @__PURE__ */ h(j, { children: [
|
|
1553
1810
|
/* @__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" }) }),
|
|
1554
|
-
/* @__PURE__ */ e("div", { className: "overflow-hidden rounded-md border border-gray-200 dark:border-gray-800", children: /* @__PURE__ */
|
|
1555
|
-
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { className: "bg-gray-50 dark:bg-gray-900", children: Array.from({ length: o }).map((
|
|
1556
|
-
/* @__PURE__ */ e("tbody", { children: Array.from({ length:
|
|
1811
|
+
/* @__PURE__ */ e("div", { className: "overflow-hidden rounded-md border border-gray-200 dark:border-gray-800", children: /* @__PURE__ */ h("table", { className: "w-full border-collapse", children: [
|
|
1812
|
+
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { className: "bg-gray-50 dark:bg-gray-900", children: Array.from({ length: o }).map((t, s) => /* @__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" }) }, s)) }) }),
|
|
1813
|
+
/* @__PURE__ */ e("tbody", { children: Array.from({ length: n }).map((t, s) => /* @__PURE__ */ e(
|
|
1557
1814
|
"tr",
|
|
1558
1815
|
{
|
|
1559
1816
|
className: "border-t border-gray-200 dark:border-gray-800",
|
|
1560
|
-
children: Array.from({ length: o }).map((
|
|
1817
|
+
children: Array.from({ length: o }).map((i, d) => /* @__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" }) }, d))
|
|
1561
1818
|
},
|
|
1562
1819
|
s
|
|
1563
1820
|
)) })
|
|
1564
1821
|
] }) })
|
|
1565
|
-
] }),
|
|
1566
|
-
|
|
1567
|
-
return _(() => {
|
|
1568
|
-
const r = (g) => {
|
|
1569
|
-
g.key === "Escape" && c();
|
|
1570
|
-
};
|
|
1571
|
-
return l && (document.body.style.overflow = "hidden", document.addEventListener("keydown", r)), () => {
|
|
1572
|
-
document.body.style.overflow = "", document.removeEventListener("keydown", r);
|
|
1573
|
-
};
|
|
1574
|
-
}, [l]), /* @__PURE__ */ e(j, { children: /* @__PURE__ */ u(
|
|
1575
|
-
"div",
|
|
1576
|
-
{
|
|
1577
|
-
className: `fixed inset-0 z-50 flex items-center justify-center bg-black/70 dark:bg-black/80 \r
|
|
1578
|
-
backdrop-blur-sm animate-in fade-in duration-200`,
|
|
1579
|
-
onClick: c,
|
|
1580
|
-
children: [
|
|
1581
|
-
/* @__PURE__ */ e(
|
|
1582
|
-
"button",
|
|
1583
|
-
{
|
|
1584
|
-
onClick: c,
|
|
1585
|
-
className: `absolute top-4 right-4 bg-white dark:bg-gray-800 text-gray-800 dark:text-gray-200\r
|
|
1586
|
-
hover:bg-gray-100 dark:hover:bg-gray-700 rounded-full p-2 shadow-lg transition`,
|
|
1587
|
-
children: /* @__PURE__ */ e(Me, { size: 20 })
|
|
1588
|
-
}
|
|
1589
|
-
),
|
|
1590
|
-
/* @__PURE__ */ e(
|
|
1591
|
-
"div",
|
|
1592
|
-
{
|
|
1593
|
-
className: "max-w-5xl w-full px-4 transform transition-all duration-200 scale-95 animate-in zoom-in-95",
|
|
1594
|
-
onClick: (r) => r.stopPropagation(),
|
|
1595
|
-
children: /* @__PURE__ */ e(
|
|
1596
|
-
"img",
|
|
1597
|
-
{
|
|
1598
|
-
src: b,
|
|
1599
|
-
alt: o,
|
|
1600
|
-
className: "w-full max-h-[90vh] object-contain rounded-xl"
|
|
1601
|
-
}
|
|
1602
|
-
)
|
|
1603
|
-
}
|
|
1604
|
-
)
|
|
1605
|
-
]
|
|
1606
|
-
}
|
|
1607
|
-
) });
|
|
1608
|
-
}, ma = ({
|
|
1609
|
-
config: b,
|
|
1822
|
+
] }), ka = ({
|
|
1823
|
+
config: n,
|
|
1610
1824
|
setShowAdd: o,
|
|
1611
|
-
title:
|
|
1825
|
+
title: t,
|
|
1612
1826
|
buttonText: s,
|
|
1613
|
-
description:
|
|
1614
|
-
showAddButton:
|
|
1827
|
+
description: i,
|
|
1828
|
+
showAddButton: d
|
|
1615
1829
|
}) => {
|
|
1616
1830
|
const {
|
|
1617
|
-
data:
|
|
1618
|
-
table_head:
|
|
1619
|
-
loading:
|
|
1620
|
-
search:
|
|
1831
|
+
data: r = [],
|
|
1832
|
+
table_head: x = [],
|
|
1833
|
+
loading: S = !1,
|
|
1834
|
+
search: c = {
|
|
1621
1835
|
enabled: !1,
|
|
1622
1836
|
placeholder: "Search...",
|
|
1623
1837
|
useServerSideSearch: !1
|
|
1624
1838
|
},
|
|
1625
|
-
filter:
|
|
1839
|
+
filter: b = {
|
|
1626
1840
|
enabled: !1,
|
|
1627
1841
|
useServerSideFilters: !1
|
|
1628
1842
|
},
|
|
1629
|
-
pagination:
|
|
1843
|
+
pagination: u = {
|
|
1630
1844
|
enabled: !1,
|
|
1631
1845
|
rows_per_page: 10,
|
|
1632
1846
|
useServerSidePagination: !1
|
|
1633
1847
|
},
|
|
1634
|
-
emptyMessage:
|
|
1635
|
-
onMenuAction:
|
|
1636
|
-
setServerSidePaginationData:
|
|
1848
|
+
emptyMessage: k = "No data available",
|
|
1849
|
+
onMenuAction: f,
|
|
1850
|
+
setServerSidePaginationData: g = () => {
|
|
1637
1851
|
},
|
|
1638
|
-
onFilterApply:
|
|
1639
|
-
filterConfig:
|
|
1640
|
-
rowClick:
|
|
1641
|
-
} =
|
|
1642
|
-
if (
|
|
1643
|
-
const a = (
|
|
1644
|
-
return w.slice(a, a +
|
|
1645
|
-
}, [w,
|
|
1646
|
-
|
|
1852
|
+
onFilterApply: N,
|
|
1853
|
+
filterConfig: y = null,
|
|
1854
|
+
rowClick: M = null
|
|
1855
|
+
} = n, [D, U] = C(""), [L, O] = C(null), [E, F] = C([]), [T, B] = C({}), [G, _] = C(!1), [J, Z] = C({}), [A, z] = C(null), [V, I] = C(!1), w = Fe(() => !c.enabled || !D.trim() || c.useServerSideSearch ? r : ua(r, D, c.searchKeys || []), [r, D, c]), [P, W] = C(1), [H, ae] = C((u == null ? void 0 : u.rows_per_page) || 50), [ee, Re] = C(w.length || 0), le = u != null && u.useServerSidePagination ? u.total_pages : Math.ceil(w.length / H), ue = Fe(() => {
|
|
1856
|
+
if (u.useServerSidePagination) return w;
|
|
1857
|
+
const a = (P - 1) * H;
|
|
1858
|
+
return w.slice(a, a + H);
|
|
1859
|
+
}, [w, P, H]), re = X(null), oe = X({}), te = X(null), he = (a) => {
|
|
1860
|
+
U(a), W(1), c.useServerSideSearch && (te.current && clearTimeout(te.current), te.current = setTimeout(async () => {
|
|
1647
1861
|
try {
|
|
1648
|
-
await
|
|
1649
|
-
...
|
|
1862
|
+
await g((m) => ({
|
|
1863
|
+
...m,
|
|
1650
1864
|
search: a,
|
|
1651
1865
|
current_page: 1
|
|
1652
1866
|
}));
|
|
1653
|
-
} catch (
|
|
1654
|
-
console.error("Search error:",
|
|
1867
|
+
} catch (m) {
|
|
1868
|
+
console.error("Search error:", m);
|
|
1655
1869
|
}
|
|
1656
1870
|
}, 800));
|
|
1657
|
-
},
|
|
1658
|
-
|
|
1659
|
-
},
|
|
1660
|
-
|
|
1661
|
-
const
|
|
1662
|
-
oe.current[a] =
|
|
1663
|
-
const
|
|
1664
|
-
|
|
1665
|
-
top: Math.max(8, Math.min(
|
|
1666
|
-
left: Math.max(8, Math.min(
|
|
1667
|
-
}),
|
|
1668
|
-
},
|
|
1669
|
-
a && a.src instanceof File && (a = { ...a, src: URL.createObjectURL(a.src) }),
|
|
1670
|
-
}, ie = (a,
|
|
1871
|
+
}, be = (a, m, p) => {
|
|
1872
|
+
p.stopPropagation(), O(null), f == null || f(a.type, m);
|
|
1873
|
+
}, pe = (a, m, p) => {
|
|
1874
|
+
m.stopPropagation(), F(p);
|
|
1875
|
+
const v = m.currentTarget;
|
|
1876
|
+
oe.current[a] = v;
|
|
1877
|
+
const R = v.getBoundingClientRect(), Y = 192, $ = p.length * 40, Ne = window.innerWidth, je = window.innerHeight, Je = Ne - R.right < Y ? R.left - Y + R.width : R.left, Qe = je - R.bottom < $ && R.top > $ ? R.top - $ - 2 : R.bottom + 2;
|
|
1878
|
+
B({
|
|
1879
|
+
top: Math.max(8, Math.min(Qe, je - $ - 8)),
|
|
1880
|
+
left: Math.max(8, Math.min(Je, Ne - Y - 8))
|
|
1881
|
+
}), O(L === a ? null : a);
|
|
1882
|
+
}, ge = (a) => (P - 1) * H + a + 1, me = (a) => {
|
|
1883
|
+
a && a.src instanceof File && (a = { ...a, src: URL.createObjectURL(a.src) }), z(a), I(!0);
|
|
1884
|
+
}, ie = (a, m, p, v = null, R = null) => /* @__PURE__ */ e(j, { children: a ? /* @__PURE__ */ e(
|
|
1671
1885
|
"img",
|
|
1672
1886
|
{
|
|
1673
1887
|
src: a instanceof File ? URL.createObjectURL(a) : a,
|
|
1674
|
-
alt:
|
|
1675
|
-
onClick: (
|
|
1676
|
-
|
|
1888
|
+
alt: m || "Avatar",
|
|
1889
|
+
onClick: (Y) => {
|
|
1890
|
+
Y.stopPropagation(), Y.preventDefault(), me({ src: a, alt: m });
|
|
1677
1891
|
},
|
|
1678
|
-
className: `w-10 h-10 cursor-pointer shrink-0 rounded-full object-cover border border-gray-200 dark:border-gray-700 ${
|
|
1892
|
+
className: `w-10 h-10 cursor-pointer shrink-0 rounded-full object-cover border border-gray-200 dark:border-gray-700 ${p || ""}`
|
|
1679
1893
|
}
|
|
1680
|
-
) : /* @__PURE__ */ e(j, { children:
|
|
1894
|
+
) : /* @__PURE__ */ e(j, { children: v ? typeof v == "function" ? v(R) : v : /* @__PURE__ */ e(
|
|
1681
1895
|
"div",
|
|
1682
1896
|
{
|
|
1683
|
-
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 ${
|
|
1684
|
-
children: /* @__PURE__ */ e(
|
|
1897
|
+
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 || ""}`,
|
|
1898
|
+
children: /* @__PURE__ */ e(Ae, { className: "w-6 h-6 text-gray-400 dark:text-gray-400" })
|
|
1685
1899
|
}
|
|
1686
|
-
) }) }),
|
|
1900
|
+
) }) }), fe = (a, m) => /* @__PURE__ */ e(j, { children: a ? /* @__PURE__ */ e(
|
|
1687
1901
|
"audio",
|
|
1688
1902
|
{
|
|
1689
1903
|
controls: !0,
|
|
1690
1904
|
src: a instanceof File ? URL.createObjectURL(a) : a,
|
|
1691
|
-
onClick: (
|
|
1692
|
-
|
|
1905
|
+
onClick: (p) => {
|
|
1906
|
+
p.stopPropagation();
|
|
1693
1907
|
},
|
|
1694
|
-
className: `w-64 cursor-pointer ${
|
|
1908
|
+
className: `w-64 cursor-pointer ${m || ""}`
|
|
1695
1909
|
},
|
|
1696
1910
|
a instanceof File ? URL.createObjectURL(a) : a
|
|
1697
1911
|
) : /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e(
|
|
1698
1912
|
"div",
|
|
1699
1913
|
{
|
|
1700
|
-
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 ${
|
|
1701
|
-
children: /* @__PURE__ */ e(
|
|
1914
|
+
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 ${m || ""}`,
|
|
1915
|
+
children: /* @__PURE__ */ e(oa, { className: "w-6 h-6 text-gray-400 dark:text-gray-400" })
|
|
1702
1916
|
}
|
|
1703
|
-
) }) }),
|
|
1704
|
-
|
|
1705
|
-
a[
|
|
1706
|
-
a[
|
|
1917
|
+
) }) }), ye = (a, m) => /* @__PURE__ */ h("div", { className: `flex items-center space-x-4 ${m.className || ""}`, children: [
|
|
1918
|
+
m.imageKey ? ie(
|
|
1919
|
+
a[m.imageKey],
|
|
1920
|
+
a[m.titleKey],
|
|
1707
1921
|
"group-avatar",
|
|
1708
|
-
|
|
1922
|
+
m.fallback_icon,
|
|
1709
1923
|
a
|
|
1710
1924
|
) : "",
|
|
1711
|
-
/* @__PURE__ */
|
|
1712
|
-
/* @__PURE__ */ e("p", { className: "font-medium text-gray-900 dark:text-white group-title", children: a[
|
|
1713
|
-
/* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400 group-sub-title", children: a[
|
|
1925
|
+
/* @__PURE__ */ h("div", { children: [
|
|
1926
|
+
/* @__PURE__ */ e("p", { className: "font-medium text-gray-900 dark:text-white group-title", children: a[m.titleKey] || "" }),
|
|
1927
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400 group-sub-title", children: a[m.subtitleKey] || "" })
|
|
1714
1928
|
] })
|
|
1715
|
-
] }),
|
|
1716
|
-
var
|
|
1717
|
-
let
|
|
1718
|
-
const
|
|
1719
|
-
let
|
|
1720
|
-
if (((
|
|
1721
|
-
let
|
|
1722
|
-
|
|
1929
|
+
] }), xe = (a, m) => {
|
|
1930
|
+
var Y;
|
|
1931
|
+
let p = String(a);
|
|
1932
|
+
const v = m.variant || "contained";
|
|
1933
|
+
let R = m.defaultColor;
|
|
1934
|
+
if (((Y = m == null ? void 0 : m.chipOptions) == null ? void 0 : Y.length) > 0) {
|
|
1935
|
+
let $ = m == null ? void 0 : m.chipOptions.find((Ne) => Ne.value == a);
|
|
1936
|
+
$ && (p = $.label, R = $.color);
|
|
1723
1937
|
}
|
|
1724
1938
|
return /* @__PURE__ */ e(
|
|
1725
|
-
|
|
1939
|
+
Ve,
|
|
1726
1940
|
{
|
|
1727
|
-
label:
|
|
1728
|
-
variant:
|
|
1729
|
-
color:
|
|
1730
|
-
className:
|
|
1941
|
+
label: p,
|
|
1942
|
+
variant: v,
|
|
1943
|
+
color: R,
|
|
1944
|
+
className: m.className || ""
|
|
1731
1945
|
}
|
|
1732
1946
|
);
|
|
1733
|
-
},
|
|
1734
|
-
const
|
|
1947
|
+
}, ve = (a, m, p) => {
|
|
1948
|
+
const v = m[a.key];
|
|
1735
1949
|
return a.type === "menu_actions" ? /* @__PURE__ */ e("div", { className: `text-center ${a.className || ""}`, children: /* @__PURE__ */ e(
|
|
1736
1950
|
"button",
|
|
1737
1951
|
{
|
|
1738
|
-
ref: (
|
|
1739
|
-
onClick: (
|
|
1952
|
+
ref: (R) => oe.current[m.id || m._id] = R,
|
|
1953
|
+
onClick: (R) => pe(m.id || m._id, R, a.menuList),
|
|
1740
1954
|
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",
|
|
1741
|
-
children: /* @__PURE__ */ e(
|
|
1955
|
+
children: /* @__PURE__ */ e(la, { className: "h-4 w-4" })
|
|
1742
1956
|
}
|
|
1743
|
-
) }) : a.type === "index" ? /* @__PURE__ */ e("span", { className: a.className || "", children:
|
|
1744
|
-
|
|
1957
|
+
) }) : a.type === "index" ? /* @__PURE__ */ e("span", { className: a.className || "", children: ge(p) }) : a.type === "group" ? ye(m, a) : a.type === "chip" ? /* @__PURE__ */ e(j, { children: xe(v, a) }) : a.type === "date" ? /* @__PURE__ */ e("span", { className: a.className || "", children: Ge(v, a.format || "DD MMM YYYY") }) : a.type === "avatar" ? /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e("div", { className: "min-w-[40px]", children: ie(
|
|
1958
|
+
v,
|
|
1745
1959
|
a.alt,
|
|
1746
1960
|
a.className,
|
|
1747
1961
|
a.fallback_icon,
|
|
1748
|
-
|
|
1749
|
-
) }) }) : a.type === "audio" ? /* @__PURE__ */ e(j, { children:
|
|
1750
|
-
},
|
|
1751
|
-
if (typeof
|
|
1752
|
-
return
|
|
1753
|
-
if (
|
|
1754
|
-
return
|
|
1755
|
-
}, we = (a,
|
|
1962
|
+
m
|
|
1963
|
+
) }) }) : a.type === "audio" ? /* @__PURE__ */ e(j, { children: fe(v, a.className) }) : /* @__PURE__ */ e("span", { className: a.className || "", children: v || "N/A" });
|
|
1964
|
+
}, ke = (a) => {
|
|
1965
|
+
if (typeof M == "function")
|
|
1966
|
+
return M(a);
|
|
1967
|
+
if (M)
|
|
1968
|
+
return f == null ? void 0 : f("view", a);
|
|
1969
|
+
}, we = (a, m) => {
|
|
1756
1970
|
if (a.onClickDetails)
|
|
1757
|
-
return
|
|
1971
|
+
return f == null ? void 0 : f("view", m);
|
|
1758
1972
|
if (typeof a.handleClick == "function")
|
|
1759
|
-
return a.handleClick(
|
|
1760
|
-
}, se = () =>
|
|
1761
|
-
return
|
|
1973
|
+
return a.handleClick(m);
|
|
1974
|
+
}, se = () => M || typeof M == "function", de = (a) => a.onClickDetails || typeof a.handleClick == "function";
|
|
1975
|
+
return K(() => {
|
|
1762
1976
|
const a = () => {
|
|
1763
|
-
|
|
1977
|
+
L && O(null);
|
|
1764
1978
|
};
|
|
1765
1979
|
return window.addEventListener("scroll", a, !0), () => {
|
|
1766
1980
|
window.removeEventListener("scroll", a, !0);
|
|
1767
1981
|
};
|
|
1768
|
-
}, [
|
|
1769
|
-
const a = (
|
|
1770
|
-
|
|
1982
|
+
}, [L]), K(() => {
|
|
1983
|
+
const a = (m) => {
|
|
1984
|
+
re.current && !re.current.contains(m.target) && O(null);
|
|
1771
1985
|
};
|
|
1772
1986
|
return document.addEventListener("click", a), () => document.removeEventListener("click", a);
|
|
1773
|
-
}, []),
|
|
1774
|
-
|
|
1987
|
+
}, []), K(() => {
|
|
1988
|
+
u != null && u.rows_per_page && (u != null && u.useServerSidePagination) && ae((u == null ? void 0 : u.rows_per_page) || 50), u.current_page && W(u.current_page);
|
|
1775
1989
|
}, [
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
]),
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
), w.length <=
|
|
1990
|
+
u.rows_per_page,
|
|
1991
|
+
u == null ? void 0 : u.useServerSidePagination,
|
|
1992
|
+
u.current_page
|
|
1993
|
+
]), K(() => {
|
|
1994
|
+
Re(
|
|
1995
|
+
u != null && u.useServerSidePagination ? u.total_records : w.length
|
|
1996
|
+
), w.length <= H * (P - 1) && !(u != null && u.useServerSidePagination) && W((a) => a - 1 || 1);
|
|
1783
1997
|
}, [
|
|
1784
1998
|
w.length,
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
]), /* @__PURE__ */
|
|
1788
|
-
|
|
1789
|
-
/* @__PURE__ */
|
|
1790
|
-
/* @__PURE__ */
|
|
1791
|
-
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-gray-900 dark:text-white", children:
|
|
1792
|
-
/* @__PURE__ */ e("p", { className: "text-md text-gray-600 dark:text-gray-400", children:
|
|
1999
|
+
u.total_records,
|
|
2000
|
+
u == null ? void 0 : u.useServerSidePagination
|
|
2001
|
+
]), /* @__PURE__ */ h(j, { children: [
|
|
2002
|
+
S ? /* @__PURE__ */ e(va, { rows: 6, columns: 6 }) : /* @__PURE__ */ h(j, { children: [
|
|
2003
|
+
/* @__PURE__ */ h("div", { className: "flex flex-col sm:flex-row sm:justify-between gap-4 mb-3", children: [
|
|
2004
|
+
/* @__PURE__ */ h("div", { children: [
|
|
2005
|
+
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: t }),
|
|
2006
|
+
/* @__PURE__ */ e("p", { className: "text-md text-gray-600 dark:text-gray-400", children: i })
|
|
1793
2007
|
] }),
|
|
1794
|
-
/* @__PURE__ */
|
|
1795
|
-
|
|
1796
|
-
|
|
2008
|
+
/* @__PURE__ */ h("div", { className: "flex flex-col justify-end items-end gap-2", children: [
|
|
2009
|
+
d && /* @__PURE__ */ h(
|
|
2010
|
+
Q,
|
|
1797
2011
|
{
|
|
1798
2012
|
onClick: () => o(!0),
|
|
1799
2013
|
variant: "contained",
|
|
1800
2014
|
color: "primary",
|
|
1801
2015
|
children: [
|
|
1802
|
-
/* @__PURE__ */ e(
|
|
2016
|
+
/* @__PURE__ */ e(aa, { className: "w-4 h-4 mr-2" }),
|
|
1803
2017
|
s || "Add New"
|
|
1804
2018
|
]
|
|
1805
2019
|
}
|
|
1806
2020
|
),
|
|
1807
|
-
/* @__PURE__ */
|
|
1808
|
-
|
|
1809
|
-
/* @__PURE__ */ e(
|
|
2021
|
+
/* @__PURE__ */ h("div", { className: "flex justify-end items-center gap-2", children: [
|
|
2022
|
+
c.enabled && /* @__PURE__ */ e("div", { className: "", children: /* @__PURE__ */ h("div", { className: "relative min-w-[300px]", children: [
|
|
2023
|
+
/* @__PURE__ */ e(Ie, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-300" }),
|
|
1810
2024
|
/* @__PURE__ */ e(
|
|
1811
2025
|
"input",
|
|
1812
2026
|
{
|
|
1813
2027
|
type: "text",
|
|
1814
|
-
placeholder:
|
|
1815
|
-
value:
|
|
2028
|
+
placeholder: c.placeholder || "Search...",
|
|
2029
|
+
value: D,
|
|
1816
2030
|
onChange: (a) => he(a.target.value),
|
|
1817
2031
|
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"
|
|
1818
2032
|
}
|
|
1819
2033
|
)
|
|
1820
2034
|
] }) }),
|
|
1821
|
-
|
|
1822
|
-
/* @__PURE__ */
|
|
1823
|
-
/* @__PURE__ */
|
|
1824
|
-
|
|
2035
|
+
y && b.enabled && // add red dot if filter are applied
|
|
2036
|
+
/* @__PURE__ */ h("div", { className: "relative", children: [
|
|
2037
|
+
/* @__PURE__ */ h(
|
|
2038
|
+
Q,
|
|
1825
2039
|
{
|
|
1826
|
-
onClick: () =>
|
|
2040
|
+
onClick: () => _(!0),
|
|
1827
2041
|
variant: "contained",
|
|
1828
2042
|
children: [
|
|
1829
|
-
/* @__PURE__ */ e(
|
|
2043
|
+
/* @__PURE__ */ e(ra, { className: "w-4 h-4 mr-2" }),
|
|
1830
2044
|
"Filters"
|
|
1831
2045
|
]
|
|
1832
2046
|
}
|
|
1833
2047
|
),
|
|
1834
|
-
Object.keys(
|
|
2048
|
+
Object.keys(J).length > 0 && /* @__PURE__ */ e("span", { className: "absolute top-1 right-1 w-2 h-2 bg-red-500 rounded-full" })
|
|
1835
2049
|
] })
|
|
1836
2050
|
] })
|
|
1837
2051
|
] })
|
|
1838
2052
|
] }),
|
|
1839
|
-
/* @__PURE__ */
|
|
1840
|
-
/* @__PURE__ */ e("div", { className: "overflow-x-auto", children: /* @__PURE__ */
|
|
1841
|
-
/* @__PURE__ */ e("thead", { className: "bg-gray-50 dark:bg-gray-700/60", children: /* @__PURE__ */ e("tr", { children:
|
|
2053
|
+
/* @__PURE__ */ h("div", { className: "bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden border border-gray-200 dark:border-gray-700", children: [
|
|
2054
|
+
/* @__PURE__ */ e("div", { className: "overflow-x-auto", children: /* @__PURE__ */ h("table", { className: "min-w-full divide-y divide-gray-200 dark:divide-gray-700", children: [
|
|
2055
|
+
/* @__PURE__ */ e("thead", { className: "bg-gray-50 dark:bg-gray-700/60", children: /* @__PURE__ */ e("tr", { children: x.map((a) => /* @__PURE__ */ e(
|
|
1842
2056
|
"th",
|
|
1843
2057
|
{
|
|
1844
2058
|
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 ${a.headClass || ""}`,
|
|
@@ -1846,61 +2060,61 @@ const ha = ({
|
|
|
1846
2060
|
},
|
|
1847
2061
|
a.key
|
|
1848
2062
|
)) }) }),
|
|
1849
|
-
/* @__PURE__ */ e("tbody", { className: "bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700", children:
|
|
2063
|
+
/* @__PURE__ */ e("tbody", { className: "bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700", children: ue.length === 0 ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e(
|
|
1850
2064
|
"td",
|
|
1851
2065
|
{
|
|
1852
|
-
colSpan:
|
|
2066
|
+
colSpan: x.length,
|
|
1853
2067
|
className: "text-center py-10 text-gray-500 dark:text-gray-400",
|
|
1854
|
-
children:
|
|
2068
|
+
children: k
|
|
1855
2069
|
}
|
|
1856
|
-
) }) :
|
|
2070
|
+
) }) : ue.map((a, m) => /* @__PURE__ */ e(
|
|
1857
2071
|
"tr",
|
|
1858
2072
|
{
|
|
1859
2073
|
className: `hover:bg-gray-50 dark:hover:bg-blue-800/10 transition ${se() ? "cursor-pointer" : ""}`,
|
|
1860
|
-
onClick: (
|
|
1861
|
-
se() &&
|
|
2074
|
+
onClick: (p) => {
|
|
2075
|
+
se() && ke(a);
|
|
1862
2076
|
},
|
|
1863
|
-
children:
|
|
2077
|
+
children: x.map((p) => /* @__PURE__ */ e(
|
|
1864
2078
|
"td",
|
|
1865
2079
|
{
|
|
1866
|
-
className: `px-6 py-4 text-sm text-gray-900 dark:text-gray-100 min-w-max ${
|
|
1867
|
-
title: String(a[
|
|
1868
|
-
onClick: (
|
|
1869
|
-
de(
|
|
2080
|
+
className: `px-6 py-4 text-sm text-gray-900 dark:text-gray-100 min-w-max ${p.type == "audio" ? "" : "max-w-[300px]"} truncate ${de(p) ? "cursor-pointer" : ""}`,
|
|
2081
|
+
title: String(a[p.key] ?? ""),
|
|
2082
|
+
onClick: (v) => {
|
|
2083
|
+
de(p) && (v.stopPropagation(), v.preventDefault(), we(p, a));
|
|
1870
2084
|
},
|
|
1871
|
-
children:
|
|
2085
|
+
children: p.render ? p.render(a, m) : ve(p, a, m)
|
|
1872
2086
|
},
|
|
1873
|
-
|
|
2087
|
+
p.key
|
|
1874
2088
|
))
|
|
1875
2089
|
},
|
|
1876
|
-
a.id || a._id ||
|
|
2090
|
+
a.id || a._id || m
|
|
1877
2091
|
)) })
|
|
1878
2092
|
] }) }),
|
|
1879
|
-
(
|
|
1880
|
-
/* @__PURE__ */
|
|
2093
|
+
(u == null ? void 0 : u.enabled) && w.length > 0 && /* @__PURE__ */ h("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: [
|
|
2094
|
+
/* @__PURE__ */ h("div", { className: "text-sm text-gray-700 dark:text-gray-300", children: [
|
|
1881
2095
|
"Showing ",
|
|
1882
|
-
(
|
|
2096
|
+
(P - 1) * H + 1,
|
|
1883
2097
|
" to",
|
|
1884
2098
|
" ",
|
|
1885
|
-
Math.min(
|
|
2099
|
+
Math.min(P * H, ee),
|
|
1886
2100
|
" of",
|
|
1887
2101
|
" ",
|
|
1888
|
-
|
|
2102
|
+
ee,
|
|
1889
2103
|
" results"
|
|
1890
2104
|
] }),
|
|
1891
|
-
/* @__PURE__ */
|
|
1892
|
-
/* @__PURE__ */
|
|
2105
|
+
/* @__PURE__ */ h("div", { className: "flex items-center gap-4", children: [
|
|
2106
|
+
/* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
|
|
1893
2107
|
/* @__PURE__ */ e("span", { className: "text-sm text-gray-700 dark:text-gray-300", children: "Rows per page:" }),
|
|
1894
2108
|
/* @__PURE__ */ e(
|
|
1895
2109
|
"select",
|
|
1896
2110
|
{
|
|
1897
|
-
value:
|
|
2111
|
+
value: H,
|
|
1898
2112
|
onChange: (a) => {
|
|
1899
|
-
const
|
|
1900
|
-
|
|
1901
|
-
...
|
|
2113
|
+
const m = Number(a.target.value);
|
|
2114
|
+
ae(m), W(1), u.useServerSidePagination && g((p) => ({
|
|
2115
|
+
...p,
|
|
1902
2116
|
current_page: 1,
|
|
1903
|
-
rows_per_page:
|
|
2117
|
+
rows_per_page: m
|
|
1904
2118
|
}));
|
|
1905
2119
|
},
|
|
1906
2120
|
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",
|
|
@@ -1908,45 +2122,45 @@ const ha = ({
|
|
|
1908
2122
|
}
|
|
1909
2123
|
)
|
|
1910
2124
|
] }),
|
|
1911
|
-
/* @__PURE__ */
|
|
2125
|
+
/* @__PURE__ */ h("div", { className: "flex items-center gap-2", children: [
|
|
1912
2126
|
/* @__PURE__ */ e(
|
|
1913
2127
|
"button",
|
|
1914
2128
|
{
|
|
1915
2129
|
onClick: () => {
|
|
1916
|
-
if (
|
|
1917
|
-
const a =
|
|
1918
|
-
|
|
1919
|
-
...
|
|
2130
|
+
if (P > 1) {
|
|
2131
|
+
const a = P - 1;
|
|
2132
|
+
W(a), u.useServerSidePagination && g((m) => ({
|
|
2133
|
+
...m,
|
|
1920
2134
|
current_page: a
|
|
1921
2135
|
}));
|
|
1922
2136
|
}
|
|
1923
2137
|
},
|
|
1924
|
-
disabled:
|
|
2138
|
+
disabled: P === 1,
|
|
1925
2139
|
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",
|
|
1926
|
-
children: /* @__PURE__ */ e(
|
|
2140
|
+
children: /* @__PURE__ */ e(ta, { className: "h-4 w-4" })
|
|
1927
2141
|
}
|
|
1928
2142
|
),
|
|
1929
|
-
/* @__PURE__ */
|
|
2143
|
+
/* @__PURE__ */ h("span", { className: "text-sm text-gray-800 dark:text-gray-200", children: [
|
|
1930
2144
|
"Page ",
|
|
1931
|
-
|
|
2145
|
+
P,
|
|
1932
2146
|
" of ",
|
|
1933
|
-
|
|
2147
|
+
le
|
|
1934
2148
|
] }),
|
|
1935
2149
|
/* @__PURE__ */ e(
|
|
1936
2150
|
"button",
|
|
1937
2151
|
{
|
|
1938
2152
|
onClick: () => {
|
|
1939
|
-
if (
|
|
1940
|
-
const a =
|
|
1941
|
-
|
|
1942
|
-
...
|
|
2153
|
+
if (P < le) {
|
|
2154
|
+
const a = P + 1;
|
|
2155
|
+
W(a), u.useServerSidePagination && g((m) => ({
|
|
2156
|
+
...m,
|
|
1943
2157
|
current_page: a
|
|
1944
2158
|
}));
|
|
1945
2159
|
}
|
|
1946
2160
|
},
|
|
1947
|
-
disabled:
|
|
2161
|
+
disabled: P === le,
|
|
1948
2162
|
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",
|
|
1949
|
-
children: /* @__PURE__ */ e(
|
|
2163
|
+
children: /* @__PURE__ */ e(na, { className: "h-4 w-4" })
|
|
1950
2164
|
}
|
|
1951
2165
|
)
|
|
1952
2166
|
] })
|
|
@@ -1954,27 +2168,27 @@ const ha = ({
|
|
|
1954
2168
|
] })
|
|
1955
2169
|
] })
|
|
1956
2170
|
] }),
|
|
1957
|
-
|
|
2171
|
+
L && ia(
|
|
1958
2172
|
/* @__PURE__ */ e(
|
|
1959
2173
|
"div",
|
|
1960
2174
|
{
|
|
1961
|
-
ref:
|
|
2175
|
+
ref: re,
|
|
1962
2176
|
style: {
|
|
1963
2177
|
position: "fixed",
|
|
1964
|
-
top: `${
|
|
1965
|
-
left: `${
|
|
2178
|
+
top: `${T.top}px`,
|
|
2179
|
+
left: `${T.left}px`,
|
|
1966
2180
|
zIndex: 9999
|
|
1967
2181
|
},
|
|
1968
2182
|
className: "w-48 bg-white dark:bg-gray-700 rounded-md shadow-lg border border-gray-200 dark:border-gray-600",
|
|
1969
|
-
children:
|
|
2183
|
+
children: E.map((a, m) => /* @__PURE__ */ h(
|
|
1970
2184
|
"button",
|
|
1971
2185
|
{
|
|
1972
|
-
onClick: (
|
|
2186
|
+
onClick: (p) => be(
|
|
1973
2187
|
a,
|
|
1974
|
-
|
|
1975
|
-
(
|
|
2188
|
+
r.find(
|
|
2189
|
+
(v) => v.id === L || v._id == L
|
|
1976
2190
|
),
|
|
1977
|
-
|
|
2191
|
+
p
|
|
1978
2192
|
),
|
|
1979
2193
|
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 ${a.variant === "danger" ? "text-red-600 dark:text-red-500" : "text-gray-700 dark:text-gray-200"}`,
|
|
1980
2194
|
children: [
|
|
@@ -1982,62 +2196,62 @@ const ha = ({
|
|
|
1982
2196
|
a.title
|
|
1983
2197
|
]
|
|
1984
2198
|
},
|
|
1985
|
-
|
|
2199
|
+
m
|
|
1986
2200
|
))
|
|
1987
2201
|
}
|
|
1988
2202
|
),
|
|
1989
2203
|
document.body
|
|
1990
2204
|
),
|
|
1991
|
-
|
|
1992
|
-
|
|
2205
|
+
y && /* @__PURE__ */ e(
|
|
2206
|
+
xa,
|
|
1993
2207
|
{
|
|
1994
2208
|
isOpen: G,
|
|
1995
|
-
onClose: () =>
|
|
1996
|
-
config:
|
|
2209
|
+
onClose: () => _(!1),
|
|
2210
|
+
config: y,
|
|
1997
2211
|
onApply: (a) => {
|
|
1998
|
-
|
|
2212
|
+
Z(a), N == null || N(a);
|
|
1999
2213
|
}
|
|
2000
2214
|
}
|
|
2001
2215
|
),
|
|
2002
|
-
|
|
2003
|
-
|
|
2216
|
+
V && /* @__PURE__ */ e(
|
|
2217
|
+
Pe,
|
|
2004
2218
|
{
|
|
2005
|
-
src:
|
|
2006
|
-
alt:
|
|
2007
|
-
isOpen:
|
|
2008
|
-
setIsOpen:
|
|
2219
|
+
src: A.src,
|
|
2220
|
+
alt: A.alt,
|
|
2221
|
+
isOpen: V,
|
|
2222
|
+
setIsOpen: I
|
|
2009
2223
|
}
|
|
2010
2224
|
)
|
|
2011
2225
|
] });
|
|
2012
|
-
},
|
|
2013
|
-
isOpen:
|
|
2226
|
+
}, Ce = ({
|
|
2227
|
+
isOpen: n,
|
|
2014
2228
|
onClose: o,
|
|
2015
|
-
icon:
|
|
2229
|
+
icon: t,
|
|
2016
2230
|
title: s,
|
|
2017
|
-
children:
|
|
2018
|
-
size:
|
|
2019
|
-
actionButtons:
|
|
2020
|
-
actions:
|
|
2021
|
-
showDefaultClose:
|
|
2022
|
-
footerConfig:
|
|
2023
|
-
hideFooter:
|
|
2024
|
-
onFormSubmit:
|
|
2231
|
+
children: i,
|
|
2232
|
+
size: d = "md",
|
|
2233
|
+
actionButtons: r = [],
|
|
2234
|
+
actions: x,
|
|
2235
|
+
showDefaultClose: S = !0,
|
|
2236
|
+
footerConfig: c = null,
|
|
2237
|
+
hideFooter: b = !1,
|
|
2238
|
+
onFormSubmit: u = () => {
|
|
2025
2239
|
},
|
|
2026
|
-
onCancel:
|
|
2027
|
-
loadingBtn:
|
|
2028
|
-
executeFunction:
|
|
2240
|
+
onCancel: k,
|
|
2241
|
+
loadingBtn: f = !1,
|
|
2242
|
+
executeFunction: g = () => {
|
|
2029
2243
|
},
|
|
2030
|
-
selectedItem:
|
|
2244
|
+
selectedItem: N = null
|
|
2031
2245
|
}) => {
|
|
2032
|
-
if (!
|
|
2033
|
-
const
|
|
2246
|
+
if (!n) return null;
|
|
2247
|
+
const y = {
|
|
2034
2248
|
sm: "max-w-md",
|
|
2035
2249
|
md: "max-w-lg",
|
|
2036
2250
|
lg: "max-w-2xl",
|
|
2037
2251
|
xl: "max-w-4xl",
|
|
2038
2252
|
full: "max-w-full"
|
|
2039
2253
|
};
|
|
2040
|
-
return /* @__PURE__ */
|
|
2254
|
+
return /* @__PURE__ */ h("div", { className: "fixed inset-0 z-50 flex items-center justify-center p-4", children: [
|
|
2041
2255
|
/* @__PURE__ */ e(
|
|
2042
2256
|
"div",
|
|
2043
2257
|
{
|
|
@@ -2045,14 +2259,14 @@ const ha = ({
|
|
|
2045
2259
|
onClick: () => o()
|
|
2046
2260
|
}
|
|
2047
2261
|
),
|
|
2048
|
-
/* @__PURE__ */
|
|
2262
|
+
/* @__PURE__ */ h(
|
|
2049
2263
|
"div",
|
|
2050
2264
|
{
|
|
2051
|
-
className: `relative bg-white rounded-lg shadow-xl w-full ${
|
|
2265
|
+
className: `relative bg-white rounded-lg shadow-xl w-full ${y[d] || y.md} max-h-[90vh] flex flex-col dark:bg-gray-800`,
|
|
2052
2266
|
children: [
|
|
2053
|
-
/* @__PURE__ */
|
|
2054
|
-
/* @__PURE__ */
|
|
2055
|
-
|
|
2267
|
+
/* @__PURE__ */ h("div", { className: "flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0", children: [
|
|
2268
|
+
/* @__PURE__ */ h("div", { className: "flex items-center gap-1", children: [
|
|
2269
|
+
t && /* @__PURE__ */ e("span", { children: t }),
|
|
2056
2270
|
/* @__PURE__ */ e("h3", { className: "text-lg font-medium text-gray-900 dark:text-white", children: s })
|
|
2057
2271
|
] }),
|
|
2058
2272
|
/* @__PURE__ */ e(
|
|
@@ -2060,598 +2274,534 @@ const ha = ({
|
|
|
2060
2274
|
{
|
|
2061
2275
|
onClick: () => o(),
|
|
2062
2276
|
className: "text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",
|
|
2063
|
-
children: /* @__PURE__ */ e(
|
|
2277
|
+
children: /* @__PURE__ */ e(Le, { className: "w-6 h-6" })
|
|
2064
2278
|
}
|
|
2065
2279
|
)
|
|
2066
2280
|
] }),
|
|
2067
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-4", children:
|
|
2068
|
-
|
|
2069
|
-
|
|
2281
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-4", children: i }),
|
|
2282
|
+
r.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: r.map((M) => /* @__PURE__ */ e(
|
|
2283
|
+
Q,
|
|
2070
2284
|
{
|
|
2071
|
-
onClick: (
|
|
2072
|
-
|
|
2285
|
+
onClick: (D) => {
|
|
2286
|
+
M.type == "submit" ? u(D) : g(
|
|
2073
2287
|
() => {
|
|
2074
|
-
var
|
|
2075
|
-
return (
|
|
2288
|
+
var U;
|
|
2289
|
+
return (U = M == null ? void 0 : M.onClick) == null ? void 0 : U.call(M, D, N);
|
|
2076
2290
|
},
|
|
2077
|
-
(
|
|
2291
|
+
(U) => o == null ? void 0 : o(U)
|
|
2078
2292
|
);
|
|
2079
2293
|
},
|
|
2080
|
-
disabled:
|
|
2081
|
-
variant:
|
|
2082
|
-
color:
|
|
2083
|
-
className: `min-w-[100px] ${
|
|
2084
|
-
type:
|
|
2085
|
-
children:
|
|
2294
|
+
disabled: f || M.disabled,
|
|
2295
|
+
variant: M.variant || "contained",
|
|
2296
|
+
color: M.color || "primary",
|
|
2297
|
+
className: `min-w-[100px] ${M.className}`,
|
|
2298
|
+
type: M.type || "button",
|
|
2299
|
+
children: f ? /* @__PURE__ */ h("div", { className: "flex items-center", children: [
|
|
2086
2300
|
/* @__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" }),
|
|
2087
|
-
|
|
2301
|
+
M.label || "Submit",
|
|
2088
2302
|
"..."
|
|
2089
|
-
] }) :
|
|
2303
|
+
] }) : M.label || "Submit"
|
|
2090
2304
|
}
|
|
2091
2305
|
)) })
|
|
2092
2306
|
]
|
|
2093
2307
|
}
|
|
2094
2308
|
)
|
|
2095
2309
|
] });
|
|
2096
|
-
},
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2310
|
+
}, Ee = ({
|
|
2311
|
+
config: n,
|
|
2312
|
+
onSubmit: o,
|
|
2313
|
+
initialData: t = {},
|
|
2314
|
+
fetchRowDetails: s,
|
|
2315
|
+
type: i = "add"
|
|
2316
|
+
}) => {
|
|
2317
|
+
const { formClass: d = "grid grid-cols-12 gap-4", formFields: r = [] } = n || {}, [x, S] = C(t), [c, b] = C(!0), u = async () => {
|
|
2318
|
+
s == null || s(t).then((g) => {
|
|
2319
|
+
S(g.data);
|
|
2320
|
+
}).catch((g) => {
|
|
2321
|
+
ce(g.message, { variant: "error" });
|
|
2322
|
+
}).finally(() => {
|
|
2323
|
+
b(!1);
|
|
2324
|
+
});
|
|
2325
|
+
};
|
|
2326
|
+
K(() => {
|
|
2327
|
+
s instanceof Function ? u() : (S(t), b(!1));
|
|
2100
2328
|
}, []);
|
|
2101
|
-
const
|
|
2102
|
-
|
|
2103
|
-
},
|
|
2104
|
-
|
|
2105
|
-
const
|
|
2106
|
-
if (!
|
|
2107
|
-
|
|
2329
|
+
const k = (g, N) => {
|
|
2330
|
+
S((y) => ({ ...y, [g]: N }));
|
|
2331
|
+
}, f = (g) => {
|
|
2332
|
+
g.preventDefault();
|
|
2333
|
+
const N = g.target;
|
|
2334
|
+
if (!N.checkValidity()) {
|
|
2335
|
+
N.reportValidity();
|
|
2108
2336
|
return;
|
|
2109
2337
|
}
|
|
2110
|
-
o(
|
|
2338
|
+
o(x);
|
|
2111
2339
|
};
|
|
2112
|
-
return
|
|
2340
|
+
return c ? (
|
|
2341
|
+
// spinner loader
|
|
2342
|
+
/* @__PURE__ */ e("div", { className: "flex items-center justify-center h-64", children: /* @__PURE__ */ e(
|
|
2343
|
+
"div",
|
|
2344
|
+
{
|
|
2345
|
+
className: "rounded-full border-4 border-blue-500 border-t-gray-200 animate-spin w-8 h-8 border-4",
|
|
2346
|
+
style: {
|
|
2347
|
+
borderTopColor: "border-primary-500"
|
|
2348
|
+
}
|
|
2349
|
+
}
|
|
2350
|
+
) })
|
|
2351
|
+
) : /* @__PURE__ */ e(
|
|
2113
2352
|
"form",
|
|
2114
2353
|
{
|
|
2115
|
-
id:
|
|
2116
|
-
onSubmit:
|
|
2117
|
-
className:
|
|
2354
|
+
id: i == "add" ? "addForm" : i == "edit" ? "editForm" : "defaultForm",
|
|
2355
|
+
onSubmit: f,
|
|
2356
|
+
className: d,
|
|
2118
2357
|
noValidate: !1,
|
|
2119
|
-
children: r.map((
|
|
2120
|
-
|
|
2358
|
+
children: r.map((g) => /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e(
|
|
2359
|
+
qe,
|
|
2121
2360
|
{
|
|
2122
|
-
field:
|
|
2123
|
-
formData:
|
|
2124
|
-
handleChange:
|
|
2361
|
+
field: g,
|
|
2362
|
+
formData: x,
|
|
2363
|
+
handleChange: k
|
|
2125
2364
|
},
|
|
2126
|
-
|
|
2365
|
+
g.key
|
|
2127
2366
|
) }))
|
|
2128
2367
|
}
|
|
2129
2368
|
);
|
|
2130
2369
|
};
|
|
2131
|
-
function
|
|
2132
|
-
const { fields:
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
}
|
|
2141
|
-
return /* @__PURE__ */ u(
|
|
2142
|
-
"div",
|
|
2143
|
-
{
|
|
2144
|
-
className: `col-span-12 flex items-center space-x-4 p-4 rounded-xl
|
|
2145
|
-
bg-gray-100 dark:bg-gray-900 ${i.blockClass || ""}`,
|
|
2146
|
-
children: [
|
|
2147
|
-
x && /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: x }),
|
|
2148
|
-
/* @__PURE__ */ u("div", { className: "flex-1 min-w-0", children: [
|
|
2149
|
-
/* @__PURE__ */ e("p", { className: "text-sm font-medium text-gray-500 dark:text-gray-400", children: y }),
|
|
2150
|
-
m === "chip" ? /* @__PURE__ */ e(
|
|
2151
|
-
ze,
|
|
2152
|
-
{
|
|
2153
|
-
label: p,
|
|
2154
|
-
variant: N,
|
|
2155
|
-
color: A,
|
|
2156
|
-
className: "mt-1"
|
|
2157
|
-
}
|
|
2158
|
-
) : (
|
|
2159
|
-
/* TINY EDITOR */
|
|
2160
|
-
m === "tinyEditor" ? /* @__PURE__ */ e(
|
|
2161
|
-
"p",
|
|
2162
|
-
{
|
|
2163
|
-
className: "mt-1 text-sm text-gray-900 dark:text-white break-words",
|
|
2164
|
-
dangerouslySetInnerHTML: {
|
|
2165
|
-
__html: p
|
|
2166
|
-
}
|
|
2167
|
-
}
|
|
2168
|
-
) : m === "audio" ? p ? /* @__PURE__ */ e(
|
|
2169
|
-
"audio",
|
|
2170
|
-
{
|
|
2171
|
-
controls: !0,
|
|
2172
|
-
src: p instanceof File ? URL.createObjectURL(p) : p,
|
|
2173
|
-
onClick: (k) => k.stopPropagation(),
|
|
2174
|
-
className: "shadow-md rounded-full mt-1"
|
|
2175
|
-
},
|
|
2176
|
-
p instanceof File ? URL.createObjectURL(p) : p
|
|
2177
|
-
) : /* @__PURE__ */ e("p", { className: "mt-1 text-sm text-gray-400", children: "N/A" }) : (
|
|
2178
|
-
/* DEFAULT */
|
|
2179
|
-
/* @__PURE__ */ e("p", { className: "mt-1 text-sm text-gray-900 dark:text-white break-words", children: m == "date" ? /* @__PURE__ */ e("span", { children: $e(p, i.format || "DD MMM YYYY") }) : p || "N/A" })
|
|
2180
|
-
)
|
|
2181
|
-
)
|
|
2182
|
-
] })
|
|
2183
|
-
]
|
|
2184
|
-
}
|
|
2185
|
-
);
|
|
2186
|
-
}, v = ({ col: i }) => {
|
|
2187
|
-
let x = b[i.titleKey], y = b[i.subtitleKey], p = b[i.imageKey], m = i.fallback_icon;
|
|
2188
|
-
return /* @__PURE__ */ u(
|
|
2189
|
-
"div",
|
|
2190
|
-
{
|
|
2191
|
-
className: `col-span-12 flex items-center space-x-4 p-4 rounded-xl
|
|
2192
|
-
bg-gray-100 dark:bg-gray-900
|
|
2193
|
-
${i.blockClass}`,
|
|
2194
|
-
children: [
|
|
2195
|
-
p ? /* @__PURE__ */ e(
|
|
2196
|
-
"img",
|
|
2197
|
-
{
|
|
2198
|
-
src: p instanceof File ? URL.createObjectURL(p) : p,
|
|
2199
|
-
alt: x,
|
|
2200
|
-
onClick: () => O({ src: p, alt: x }),
|
|
2201
|
-
className: "w-16 h-16 cursor-pointer rounded-full object-cover border-2 border-gray-200 dark:border-gray-700"
|
|
2202
|
-
}
|
|
2203
|
-
) : m ? m instanceof Function ? m(b) : m : /* @__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(De, { className: "w-8 h-8 text-gray-400" }) }),
|
|
2204
|
-
/* @__PURE__ */ u("div", { children: [
|
|
2205
|
-
/* @__PURE__ */ e("h3", { className: "text-xl font-semibold text-gray-900 dark:text-white", children: x }),
|
|
2206
|
-
/* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: y })
|
|
2207
|
-
] })
|
|
2208
|
-
]
|
|
2209
|
-
}
|
|
2210
|
-
);
|
|
2211
|
-
}, d = ({ col: i }) => {
|
|
2212
|
-
let x = b[i.titleKey], y = b[i.subtitleKey], p = b[i.imageKey], m = i.label, N = i == null ? void 0 : i.icon, A = i.fallback_icon;
|
|
2213
|
-
return /* @__PURE__ */ u(
|
|
2214
|
-
"div",
|
|
2215
|
-
{
|
|
2216
|
-
className: `col-span-12 flex items-center space-x-4 p-4 rounded-xl
|
|
2217
|
-
bg-gray-100 dark:bg-gray-900
|
|
2218
|
-
${i.blockClass}`,
|
|
2219
|
-
children: [
|
|
2220
|
-
N && /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: N }),
|
|
2221
|
-
/* @__PURE__ */ u("div", { className: "flex-1 min-w-0", children: [
|
|
2222
|
-
/* @__PURE__ */ e("p", { className: "text-sm font-medium text-gray-500 dark:text-gray-400", children: m }),
|
|
2223
|
-
/* @__PURE__ */ u("div", { className: "flex items-center", children: [
|
|
2224
|
-
p ? /* @__PURE__ */ e(
|
|
2225
|
-
"img",
|
|
2226
|
-
{
|
|
2227
|
-
src: p instanceof File ? URL.createObjectURL(p) : p,
|
|
2228
|
-
alt: x,
|
|
2229
|
-
onClick: () => O({ src: p, alt: x }),
|
|
2230
|
-
className: "w-8 h-8 cursor-pointer rounded-full object-cover border-2 border-gray-200 dark:border-gray-700"
|
|
2231
|
-
}
|
|
2232
|
-
) : A ? A instanceof Function ? A(b) : A : /* @__PURE__ */ e("div", { className: "w-8 h-8 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(De, { className: "w-6 h-6 text-gray-400" }) }),
|
|
2233
|
-
/* @__PURE__ */ u("div", { className: "ml-2", children: [
|
|
2234
|
-
/* @__PURE__ */ e("p", { className: "mb-0 text-sm text-gray-900 dark:text-white break-words", children: x }),
|
|
2235
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: y })
|
|
2236
|
-
] })
|
|
2237
|
-
] })
|
|
2238
|
-
] })
|
|
2239
|
-
]
|
|
2240
|
-
}
|
|
2241
|
-
);
|
|
2370
|
+
function wa({ data: n, config: o, fetchRowDetails: t }) {
|
|
2371
|
+
const { fields: s, containerClass: i } = o, [d, r] = C(n), [x, S] = C(!0), c = async () => {
|
|
2372
|
+
t == null || t(n).then((b) => {
|
|
2373
|
+
r(b.data);
|
|
2374
|
+
}).catch((b) => {
|
|
2375
|
+
ce(b.message, { variant: "error" });
|
|
2376
|
+
}).finally(() => {
|
|
2377
|
+
S(!1);
|
|
2378
|
+
});
|
|
2242
2379
|
};
|
|
2243
|
-
return
|
|
2244
|
-
|
|
2245
|
-
|
|
2380
|
+
return K(() => {
|
|
2381
|
+
t instanceof Function ? c() : (r(n), S(!1));
|
|
2382
|
+
}, []), x ? (
|
|
2383
|
+
// spinner loader
|
|
2384
|
+
/* @__PURE__ */ e("div", { className: "flex items-center justify-center h-64", children: /* @__PURE__ */ e(
|
|
2385
|
+
"div",
|
|
2246
2386
|
{
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2387
|
+
className: "rounded-full border-4 border-blue-500 border-t-gray-200 animate-spin w-8 h-8 border-4",
|
|
2388
|
+
style: {
|
|
2389
|
+
borderTopColor: "border-primary-500"
|
|
2390
|
+
}
|
|
2251
2391
|
}
|
|
2252
|
-
)
|
|
2253
|
-
|
|
2254
|
-
] });
|
|
2392
|
+
) })
|
|
2393
|
+
) : /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e("div", { className: `grid grid-cols-12 gap-4 ${i || ""}`, children: s.map((b) => b.renderCondition && typeof b.renderCondition == "function" && !b.renderCondition(d) ? null : b.type == "group" ? /* @__PURE__ */ e(He, { col: b, data: d }) : b.type == "cardGroup" ? /* @__PURE__ */ e(Ye, { col: b, data: d }) : /* @__PURE__ */ e(We, { col: b, data: d })) }) });
|
|
2255
2394
|
}
|
|
2256
|
-
const
|
|
2257
|
-
var
|
|
2395
|
+
const Ze = ({ config: n }) => {
|
|
2396
|
+
var re, oe, te, he, be, pe, ge, me, ie, fe, ye, xe, ve, ke, we, se, de, a, m;
|
|
2258
2397
|
const {
|
|
2259
2398
|
title: o,
|
|
2260
|
-
fetchData:
|
|
2399
|
+
fetchData: t = async () => {
|
|
2261
2400
|
},
|
|
2262
|
-
|
|
2263
|
-
|
|
2401
|
+
fetchRowDetails: s = null,
|
|
2402
|
+
isStaticData: i = !1,
|
|
2403
|
+
tableConfig: d = {},
|
|
2264
2404
|
modalConfig: r = {},
|
|
2265
|
-
filterConfig:
|
|
2266
|
-
} =
|
|
2405
|
+
filterConfig: x
|
|
2406
|
+
} = n, [S, c] = C(!0), [b, u] = C(!1), [k, f] = C([]), [g, N] = C(null), [y, M] = C({
|
|
2267
2407
|
search: "",
|
|
2268
2408
|
rows_per_page: 50,
|
|
2269
2409
|
current_page: 1
|
|
2270
|
-
}), [
|
|
2271
|
-
|
|
2272
|
-
},
|
|
2273
|
-
|
|
2410
|
+
}), [D, U] = C({}), [L, O] = C(!1), [E, F] = C(!1), [T, B] = C(!1), [G, _] = C(!1), [J, Z] = C(!1), [A, z] = C(null), V = (p, v) => {
|
|
2411
|
+
p === "edit" ? (z(v), B(!0)) : p === "view" ? (z(v), Z(!0)) : p === "delete" && (z(v), _(!0));
|
|
2412
|
+
}, I = async (p, v, R = "", Y = "") => {
|
|
2413
|
+
u(!0);
|
|
2274
2414
|
try {
|
|
2275
|
-
const $ = await (
|
|
2276
|
-
(
|
|
2415
|
+
const $ = await (p == null ? void 0 : p());
|
|
2416
|
+
(R || $.message) && ce(R || $.message, {
|
|
2277
2417
|
variant: "success"
|
|
2278
|
-
}),
|
|
2418
|
+
}), v == null || v($);
|
|
2279
2419
|
} catch ($) {
|
|
2280
|
-
(
|
|
2420
|
+
(Y || $.message) && ce(Y || $.message, { variant: "error" });
|
|
2281
2421
|
} finally {
|
|
2282
|
-
|
|
2422
|
+
u(!1);
|
|
2283
2423
|
}
|
|
2284
|
-
},
|
|
2285
|
-
let
|
|
2286
|
-
|
|
2287
|
-
...
|
|
2424
|
+
}, w = (p) => {
|
|
2425
|
+
let v = p.newObject;
|
|
2426
|
+
i ? (f((R) => [v, ...R]), N((R) => ({
|
|
2427
|
+
...R,
|
|
2288
2428
|
current_page: 1
|
|
2289
|
-
}))) : (
|
|
2290
|
-
...
|
|
2429
|
+
}))) : (M((R) => ({
|
|
2430
|
+
...R,
|
|
2291
2431
|
current_page: 1
|
|
2292
|
-
})),
|
|
2293
|
-
},
|
|
2294
|
-
let
|
|
2295
|
-
|
|
2296
|
-
(
|
|
2297
|
-
($) => $.id ===
|
|
2432
|
+
})), y.current_page == 1 && ee()), F(!1);
|
|
2433
|
+
}, P = (p) => {
|
|
2434
|
+
let v = p.newObject, R = p.targetObject;
|
|
2435
|
+
i ? f(
|
|
2436
|
+
(Y) => Y.map(
|
|
2437
|
+
($) => $.id === R.id ? { ...$, ...v } : $
|
|
2298
2438
|
)
|
|
2299
|
-
) :
|
|
2300
|
-
},
|
|
2301
|
-
if (!
|
|
2302
|
-
|
|
2439
|
+
) : ee(), B(!1);
|
|
2440
|
+
}, W = (p) => {
|
|
2441
|
+
if (!p) {
|
|
2442
|
+
_(!1), z(null);
|
|
2303
2443
|
return;
|
|
2304
2444
|
}
|
|
2305
|
-
|
|
2306
|
-
(
|
|
2307
|
-
) :
|
|
2308
|
-
...
|
|
2309
|
-
current_page:
|
|
2310
|
-
})) :
|
|
2311
|
-
},
|
|
2445
|
+
i ? f(
|
|
2446
|
+
(v) => v.filter((R) => R.id !== p.targetObject.id)
|
|
2447
|
+
) : k.length == 1 && y.current_page > 1 ? M((v) => ({
|
|
2448
|
+
...v,
|
|
2449
|
+
current_page: v.current_page - 1
|
|
2450
|
+
})) : ee(), _(!1), z(null);
|
|
2451
|
+
}, H = (p) => I(
|
|
2312
2452
|
() => {
|
|
2313
|
-
var
|
|
2314
|
-
return (
|
|
2453
|
+
var v, R;
|
|
2454
|
+
return (R = (v = r == null ? void 0 : r.addModal) == null ? void 0 : v.handleSubmit) == null ? void 0 : R.call(v, p);
|
|
2315
2455
|
},
|
|
2316
|
-
|
|
2317
|
-
),
|
|
2456
|
+
w
|
|
2457
|
+
), ae = (p) => I(
|
|
2318
2458
|
() => {
|
|
2319
|
-
var
|
|
2320
|
-
return (
|
|
2459
|
+
var v, R;
|
|
2460
|
+
return (R = (v = r == null ? void 0 : r.editModal) == null ? void 0 : v.handleSubmit) == null ? void 0 : R.call(v, p, A);
|
|
2321
2461
|
},
|
|
2322
|
-
|
|
2323
|
-
),
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
}).catch((
|
|
2327
|
-
|
|
2462
|
+
P
|
|
2463
|
+
), ee = async () => {
|
|
2464
|
+
c(!0), t == null || t({ ...y, ...D }).then((p) => {
|
|
2465
|
+
f(p.data), N(p.pagination);
|
|
2466
|
+
}).catch((p) => {
|
|
2467
|
+
ce(p.message, { variant: "error" });
|
|
2328
2468
|
}).finally(() => {
|
|
2329
|
-
|
|
2469
|
+
c(!1);
|
|
2330
2470
|
});
|
|
2331
|
-
},
|
|
2332
|
-
var
|
|
2333
|
-
|
|
2334
|
-
...
|
|
2335
|
-
})), (
|
|
2336
|
-
},
|
|
2337
|
-
(
|
|
2338
|
-
),
|
|
2339
|
-
var
|
|
2340
|
-
return (
|
|
2341
|
-
}, [
|
|
2342
|
-
return
|
|
2343
|
-
|
|
2471
|
+
}, Re = (p) => {
|
|
2472
|
+
var v;
|
|
2473
|
+
U((R) => ({
|
|
2474
|
+
...p
|
|
2475
|
+
})), (v = d == null ? void 0 : d.filter) != null && v.useServerSideFilters && O((R) => !R);
|
|
2476
|
+
}, le = (p, v) => p.filter(
|
|
2477
|
+
(R) => Object.entries(v).every(([Y, $]) => R[Y] === $)
|
|
2478
|
+
), ue = Fe(() => {
|
|
2479
|
+
var p;
|
|
2480
|
+
return (p = d == null ? void 0 : d.filter) != null && p.useServerSideFilters ? k : le(k, D);
|
|
2481
|
+
}, [k, D]);
|
|
2482
|
+
return K(() => {
|
|
2483
|
+
ee();
|
|
2344
2484
|
}, [
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
]), /* @__PURE__ */
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
new CustomEvent("closeSnackbar", { detail: n })
|
|
2364
|
-
);
|
|
2485
|
+
y.search,
|
|
2486
|
+
y.rows_per_page,
|
|
2487
|
+
y.current_page,
|
|
2488
|
+
L
|
|
2489
|
+
]), /* @__PURE__ */ h("div", { children: [
|
|
2490
|
+
/* @__PURE__ */ e(
|
|
2491
|
+
ka,
|
|
2492
|
+
{
|
|
2493
|
+
title: o,
|
|
2494
|
+
setShowAdd: F,
|
|
2495
|
+
description: n.description,
|
|
2496
|
+
buttonText: n.buttonText,
|
|
2497
|
+
showAddButton: !!r.addModal,
|
|
2498
|
+
config: {
|
|
2499
|
+
...d,
|
|
2500
|
+
pagination: {
|
|
2501
|
+
...d.pagination,
|
|
2502
|
+
...g
|
|
2365
2503
|
},
|
|
2366
|
-
|
|
2367
|
-
|
|
2504
|
+
data: ue,
|
|
2505
|
+
setServerSidePaginationData: M,
|
|
2506
|
+
onMenuAction: V,
|
|
2507
|
+
filterConfig: x,
|
|
2508
|
+
onFilterApply: Re,
|
|
2509
|
+
loading: S
|
|
2368
2510
|
}
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
onFilterApply: ce,
|
|
2390
|
-
loading: M
|
|
2391
|
-
}
|
|
2392
|
-
}
|
|
2393
|
-
),
|
|
2394
|
-
/* @__PURE__ */ e(
|
|
2395
|
-
Se,
|
|
2396
|
-
{
|
|
2397
|
-
isOpen: C,
|
|
2398
|
-
onClose: () => {
|
|
2399
|
-
h || P(!1);
|
|
2400
|
-
},
|
|
2401
|
-
icon: (le = r.addModal) == null ? void 0 : le.icon,
|
|
2402
|
-
title: ((ae = r.addModal) == null ? void 0 : ae.title) || "Add New",
|
|
2403
|
-
size: ((oe = r.addModal) == null ? void 0 : oe.size) || "md",
|
|
2404
|
-
onFormSubmit: () => {
|
|
2405
|
-
var n;
|
|
2406
|
-
return (n = document.querySelector("#addForm")) == null ? void 0 : n.requestSubmit();
|
|
2407
|
-
},
|
|
2408
|
-
loadingBtn: h,
|
|
2409
|
-
actionButtons: ((te = r == null ? void 0 : r.addModal) == null ? void 0 : te.actionButtons) || [],
|
|
2410
|
-
children: /* @__PURE__ */ e(
|
|
2411
|
-
je,
|
|
2412
|
-
{
|
|
2413
|
-
config: (r == null ? void 0 : r.addModal) || {},
|
|
2414
|
-
onSubmit: Y,
|
|
2415
|
-
initialData: {},
|
|
2416
|
-
type: "add",
|
|
2417
|
-
loading: h
|
|
2418
|
-
}
|
|
2419
|
-
)
|
|
2420
|
-
}
|
|
2421
|
-
),
|
|
2422
|
-
/* @__PURE__ */ e(
|
|
2423
|
-
Se,
|
|
2511
|
+
}
|
|
2512
|
+
),
|
|
2513
|
+
/* @__PURE__ */ e(
|
|
2514
|
+
Ce,
|
|
2515
|
+
{
|
|
2516
|
+
isOpen: E,
|
|
2517
|
+
onClose: () => {
|
|
2518
|
+
b || F(!1);
|
|
2519
|
+
},
|
|
2520
|
+
icon: (re = r.addModal) == null ? void 0 : re.icon,
|
|
2521
|
+
title: ((oe = r.addModal) == null ? void 0 : oe.title) || "Add New",
|
|
2522
|
+
size: ((te = r.addModal) == null ? void 0 : te.size) || "md",
|
|
2523
|
+
onFormSubmit: () => {
|
|
2524
|
+
var p;
|
|
2525
|
+
return (p = document.querySelector("#addForm")) == null ? void 0 : p.requestSubmit();
|
|
2526
|
+
},
|
|
2527
|
+
loadingBtn: b,
|
|
2528
|
+
actionButtons: ((he = r == null ? void 0 : r.addModal) == null ? void 0 : he.actionButtons) || [],
|
|
2529
|
+
children: /* @__PURE__ */ e(
|
|
2530
|
+
Ee,
|
|
2424
2531
|
{
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
title: ((ue = r.editModal) == null ? void 0 : ue.title) || "Edit",
|
|
2431
|
-
size: ((be = r.editModal) == null ? void 0 : be.size) || "md",
|
|
2432
|
-
onFormSubmit: () => {
|
|
2433
|
-
var n;
|
|
2434
|
-
return (n = document.querySelector("#editForm")) == null ? void 0 : n.requestSubmit();
|
|
2435
|
-
},
|
|
2436
|
-
actionButtons: ((pe = r == null ? void 0 : r.editModal) == null ? void 0 : pe.actionButtons) || [],
|
|
2437
|
-
loadingBtn: h,
|
|
2438
|
-
children: /* @__PURE__ */ e(
|
|
2439
|
-
je,
|
|
2440
|
-
{
|
|
2441
|
-
config: r.editModal || {},
|
|
2442
|
-
onSubmit: z,
|
|
2443
|
-
initialData: B,
|
|
2444
|
-
type: "edit",
|
|
2445
|
-
loading: h
|
|
2446
|
-
}
|
|
2447
|
-
)
|
|
2532
|
+
config: (r == null ? void 0 : r.addModal) || {},
|
|
2533
|
+
onSubmit: H,
|
|
2534
|
+
initialData: {},
|
|
2535
|
+
type: "add",
|
|
2536
|
+
loading: b
|
|
2448
2537
|
}
|
|
2449
|
-
)
|
|
2450
|
-
|
|
2451
|
-
|
|
2538
|
+
)
|
|
2539
|
+
}
|
|
2540
|
+
),
|
|
2541
|
+
/* @__PURE__ */ e(
|
|
2542
|
+
Ce,
|
|
2543
|
+
{
|
|
2544
|
+
isOpen: T,
|
|
2545
|
+
onClose: () => {
|
|
2546
|
+
b || B(!1);
|
|
2547
|
+
},
|
|
2548
|
+
icon: (be = r.editModal) == null ? void 0 : be.icon,
|
|
2549
|
+
title: ((pe = r.editModal) == null ? void 0 : pe.title) || "Edit",
|
|
2550
|
+
size: ((ge = r.editModal) == null ? void 0 : ge.size) || "md",
|
|
2551
|
+
onFormSubmit: () => {
|
|
2552
|
+
var p;
|
|
2553
|
+
return (p = document.querySelector("#editForm")) == null ? void 0 : p.requestSubmit();
|
|
2554
|
+
},
|
|
2555
|
+
actionButtons: ((me = r == null ? void 0 : r.editModal) == null ? void 0 : me.actionButtons) || [],
|
|
2556
|
+
loadingBtn: b,
|
|
2557
|
+
children: /* @__PURE__ */ e(
|
|
2558
|
+
Ee,
|
|
2452
2559
|
{
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
size: ((me = r.deleteModal) == null ? void 0 : me.size) || "md",
|
|
2460
|
-
loading: h,
|
|
2461
|
-
actionButtons: ((fe = r == null ? void 0 : r.deleteModal) == null ? void 0 : fe.actionButtons) || [],
|
|
2462
|
-
executeFunction: D,
|
|
2463
|
-
selectedItem: B,
|
|
2464
|
-
children: /* @__PURE__ */ e("div", { className: "flex items-center space-x-2 py-3", children: /* @__PURE__ */ u("div", { children: [
|
|
2465
|
-
/* @__PURE__ */ e("p", { className: "text-md text-gray-700 dark:text-white", children: ((ye = r.deleteModal) == null ? void 0 : ye.confirmText) || "Are you sure you want to delete this item?" }),
|
|
2466
|
-
((xe = r.deleteModal) == null ? void 0 : xe.referenceKey) && /* @__PURE__ */ e("p", { className: "text-md font-semibold text-gray-700 dark:text-white", children: B[(ve = r.deleteModal) == null ? void 0 : ve.referenceKey] })
|
|
2467
|
-
] }) })
|
|
2560
|
+
config: r.editModal || {},
|
|
2561
|
+
onSubmit: ae,
|
|
2562
|
+
initialData: A,
|
|
2563
|
+
type: "edit",
|
|
2564
|
+
loading: b,
|
|
2565
|
+
fetchRowDetails: s
|
|
2468
2566
|
}
|
|
2469
|
-
)
|
|
2470
|
-
|
|
2471
|
-
|
|
2567
|
+
)
|
|
2568
|
+
}
|
|
2569
|
+
),
|
|
2570
|
+
G && /* @__PURE__ */ e(
|
|
2571
|
+
Ce,
|
|
2572
|
+
{
|
|
2573
|
+
isOpen: G,
|
|
2574
|
+
onClose: (p) => {
|
|
2575
|
+
W(p);
|
|
2576
|
+
},
|
|
2577
|
+
icon: ((ie = r.deleteModal) == null ? void 0 : ie.icon) || /* @__PURE__ */ e(ne, { icon: "ph:warning-bold", className: "w-6 h-6 text-red-500" }),
|
|
2578
|
+
title: ((fe = r.deleteModal) == null ? void 0 : fe.title) || "Confirm Delete",
|
|
2579
|
+
size: ((ye = r.deleteModal) == null ? void 0 : ye.size) || "md",
|
|
2580
|
+
loading: b,
|
|
2581
|
+
actionButtons: ((xe = r == null ? void 0 : r.deleteModal) == null ? void 0 : xe.actionButtons) || [],
|
|
2582
|
+
executeFunction: I,
|
|
2583
|
+
selectedItem: A,
|
|
2584
|
+
children: /* @__PURE__ */ e("div", { className: "flex items-center space-x-2 py-3", children: /* @__PURE__ */ h("div", { children: [
|
|
2585
|
+
/* @__PURE__ */ e("p", { className: "text-md text-gray-700 dark:text-white", children: ((ve = r.deleteModal) == null ? void 0 : ve.confirmText) || "Are you sure you want to delete this item?" }),
|
|
2586
|
+
((ke = r.deleteModal) == null ? void 0 : ke.referenceKey) && /* @__PURE__ */ e("p", { className: "text-md font-semibold text-gray-700 dark:text-white", children: A[(we = r.deleteModal) == null ? void 0 : we.referenceKey] })
|
|
2587
|
+
] }) })
|
|
2588
|
+
}
|
|
2589
|
+
),
|
|
2590
|
+
r.viewModal && /* @__PURE__ */ e(
|
|
2591
|
+
Ce,
|
|
2592
|
+
{
|
|
2593
|
+
isOpen: J,
|
|
2594
|
+
onClose: () => {
|
|
2595
|
+
Z(!1), z(null);
|
|
2596
|
+
},
|
|
2597
|
+
icon: (se = r.viewModal) == null ? void 0 : se.icon,
|
|
2598
|
+
title: ((de = r.viewModal) == null ? void 0 : de.title) || "View Details",
|
|
2599
|
+
size: ((a = r.viewModal) == null ? void 0 : a.size) || "lg",
|
|
2600
|
+
footerConfig: r == null ? void 0 : r.viewModal.footer,
|
|
2601
|
+
children: (m = r.viewModal) != null && m.component ? /* @__PURE__ */ e(r.viewModal.component, { data: A }) : /* @__PURE__ */ e(
|
|
2602
|
+
wa,
|
|
2472
2603
|
{
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
},
|
|
2477
|
-
icon: (we = r.viewModal) == null ? void 0 : we.icon,
|
|
2478
|
-
title: ((se = r.viewModal) == null ? void 0 : se.title) || "View Details",
|
|
2479
|
-
size: ((de = r.viewModal) == null ? void 0 : de.size) || "lg",
|
|
2480
|
-
footerConfig: r == null ? void 0 : r.viewModal.footer,
|
|
2481
|
-
children: (a = r.viewModal) != null && a.component ? /* @__PURE__ */ e(r.viewModal.component, { data: B }) : /* @__PURE__ */ e(
|
|
2482
|
-
fa,
|
|
2483
|
-
{
|
|
2484
|
-
data: B,
|
|
2485
|
-
config: r.viewModal || {}
|
|
2486
|
-
}
|
|
2487
|
-
)
|
|
2604
|
+
data: A,
|
|
2605
|
+
fetchRowDetails: s,
|
|
2606
|
+
config: r.viewModal || {}
|
|
2488
2607
|
}
|
|
2489
2608
|
)
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
);
|
|
2493
|
-
},
|
|
2494
|
-
value:
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2609
|
+
}
|
|
2610
|
+
)
|
|
2611
|
+
] });
|
|
2612
|
+
}, De = l.shape({
|
|
2613
|
+
value: l.oneOfType([
|
|
2614
|
+
l.string,
|
|
2615
|
+
l.number,
|
|
2616
|
+
l.bool
|
|
2498
2617
|
]).isRequired,
|
|
2499
|
-
label:
|
|
2500
|
-
color:
|
|
2501
|
-
}),
|
|
2502
|
-
type:
|
|
2503
|
-
label:
|
|
2504
|
-
color:
|
|
2505
|
-
variant:
|
|
2506
|
-
onClick:
|
|
2507
|
-
}),
|
|
2508
|
-
title:
|
|
2509
|
-
type:
|
|
2510
|
-
variant:
|
|
2511
|
-
icon:
|
|
2512
|
-
}),
|
|
2513
|
-
key:
|
|
2514
|
-
title:
|
|
2515
|
-
type:
|
|
2516
|
-
imageKey:
|
|
2517
|
-
titleKey:
|
|
2518
|
-
subtitleKey:
|
|
2519
|
-
onClickDetails:
|
|
2520
|
-
variant:
|
|
2521
|
-
chipOptions:
|
|
2522
|
-
defaultColor:
|
|
2523
|
-
className:
|
|
2524
|
-
format:
|
|
2525
|
-
menuList:
|
|
2526
|
-
}),
|
|
2527
|
-
key:
|
|
2528
|
-
label:
|
|
2529
|
-
type:
|
|
2530
|
-
required:
|
|
2531
|
-
minLength:
|
|
2532
|
-
parentClass:
|
|
2533
|
-
search:
|
|
2534
|
-
multiple:
|
|
2535
|
-
dropdownMaxHeight:
|
|
2536
|
-
dragDrop:
|
|
2537
|
-
countriesList:
|
|
2538
|
-
defaultCountry:
|
|
2539
|
-
placeholder:
|
|
2540
|
-
rows:
|
|
2541
|
-
text:
|
|
2542
|
-
editorKey:
|
|
2543
|
-
options:
|
|
2544
|
-
}),
|
|
2545
|
-
key:
|
|
2546
|
-
label:
|
|
2547
|
-
type:
|
|
2548
|
-
imageKey:
|
|
2549
|
-
titleKey:
|
|
2550
|
-
subtitleKey:
|
|
2551
|
-
blockClass:
|
|
2552
|
-
icon:
|
|
2553
|
-
variant:
|
|
2554
|
-
chipOptions:
|
|
2555
|
-
defaultColor:
|
|
2556
|
-
className:
|
|
2557
|
-
format:
|
|
2618
|
+
label: l.string.isRequired,
|
|
2619
|
+
color: l.string
|
|
2620
|
+
}), Oe = l.shape({
|
|
2621
|
+
type: l.string.isRequired,
|
|
2622
|
+
label: l.string.isRequired,
|
|
2623
|
+
color: l.string,
|
|
2624
|
+
variant: l.string,
|
|
2625
|
+
onClick: l.func
|
|
2626
|
+
}), Na = l.shape({
|
|
2627
|
+
title: l.string.isRequired,
|
|
2628
|
+
type: l.string.isRequired,
|
|
2629
|
+
variant: l.string,
|
|
2630
|
+
icon: l.node
|
|
2631
|
+
}), Sa = l.shape({
|
|
2632
|
+
key: l.string.isRequired,
|
|
2633
|
+
title: l.string,
|
|
2634
|
+
type: l.string,
|
|
2635
|
+
imageKey: l.string,
|
|
2636
|
+
titleKey: l.string,
|
|
2637
|
+
subtitleKey: l.string,
|
|
2638
|
+
onClickDetails: l.bool,
|
|
2639
|
+
variant: l.string,
|
|
2640
|
+
chipOptions: l.arrayOf(De),
|
|
2641
|
+
defaultColor: l.string,
|
|
2642
|
+
className: l.string,
|
|
2643
|
+
format: l.string,
|
|
2644
|
+
menuList: l.arrayOf(Na)
|
|
2645
|
+
}), Te = l.shape({
|
|
2646
|
+
key: l.string.isRequired,
|
|
2647
|
+
label: l.string,
|
|
2648
|
+
type: l.string.isRequired,
|
|
2649
|
+
required: l.bool,
|
|
2650
|
+
minLength: l.number,
|
|
2651
|
+
parentClass: l.string,
|
|
2652
|
+
search: l.bool,
|
|
2653
|
+
multiple: l.bool,
|
|
2654
|
+
dropdownMaxHeight: l.string,
|
|
2655
|
+
dragDrop: l.bool,
|
|
2656
|
+
countriesList: l.bool,
|
|
2657
|
+
defaultCountry: l.string,
|
|
2658
|
+
placeholder: l.string,
|
|
2659
|
+
rows: l.number,
|
|
2660
|
+
text: l.string,
|
|
2661
|
+
editorKey: l.string,
|
|
2662
|
+
options: l.arrayOf(De)
|
|
2663
|
+
}), Ca = l.shape({
|
|
2664
|
+
key: l.string,
|
|
2665
|
+
label: l.string,
|
|
2666
|
+
type: l.string,
|
|
2667
|
+
imageKey: l.string,
|
|
2668
|
+
titleKey: l.string,
|
|
2669
|
+
subtitleKey: l.string,
|
|
2670
|
+
blockClass: l.string,
|
|
2671
|
+
icon: l.node,
|
|
2672
|
+
variant: l.string,
|
|
2673
|
+
chipOptions: l.arrayOf(De),
|
|
2674
|
+
defaultColor: l.string,
|
|
2675
|
+
className: l.string,
|
|
2676
|
+
format: l.string
|
|
2558
2677
|
});
|
|
2559
|
-
|
|
2560
|
-
config:
|
|
2561
|
-
title:
|
|
2562
|
-
description:
|
|
2563
|
-
buttonText:
|
|
2564
|
-
fetchData:
|
|
2565
|
-
isStaticData:
|
|
2678
|
+
Ze.propTypes = {
|
|
2679
|
+
config: l.shape({
|
|
2680
|
+
title: l.string.isRequired,
|
|
2681
|
+
description: l.string,
|
|
2682
|
+
buttonText: l.string,
|
|
2683
|
+
fetchData: l.func.isRequired,
|
|
2684
|
+
isStaticData: l.bool,
|
|
2566
2685
|
/* ================= TABLE CONFIG ================= */
|
|
2567
|
-
tableConfig:
|
|
2568
|
-
table_head:
|
|
2569
|
-
search:
|
|
2570
|
-
enabled:
|
|
2571
|
-
useServerSideSearch:
|
|
2572
|
-
searchKeys:
|
|
2686
|
+
tableConfig: l.shape({
|
|
2687
|
+
table_head: l.arrayOf(Sa).isRequired,
|
|
2688
|
+
search: l.shape({
|
|
2689
|
+
enabled: l.bool,
|
|
2690
|
+
useServerSideSearch: l.bool,
|
|
2691
|
+
searchKeys: l.arrayOf(l.string)
|
|
2573
2692
|
}),
|
|
2574
|
-
pagination:
|
|
2575
|
-
enabled:
|
|
2576
|
-
useServerSidePagination:
|
|
2693
|
+
pagination: l.shape({
|
|
2694
|
+
enabled: l.bool,
|
|
2695
|
+
useServerSidePagination: l.bool
|
|
2577
2696
|
}),
|
|
2578
|
-
filter:
|
|
2579
|
-
enabled:
|
|
2580
|
-
useServerSideFilters:
|
|
2697
|
+
filter: l.shape({
|
|
2698
|
+
enabled: l.bool,
|
|
2699
|
+
useServerSideFilters: l.bool
|
|
2581
2700
|
})
|
|
2582
2701
|
}).isRequired,
|
|
2583
2702
|
/* ================= MODAL CONFIG ================= */
|
|
2584
|
-
modalConfig:
|
|
2585
|
-
addModal:
|
|
2586
|
-
title:
|
|
2587
|
-
size:
|
|
2588
|
-
formClass:
|
|
2589
|
-
formFields:
|
|
2590
|
-
handleSubmit:
|
|
2591
|
-
actionButtons:
|
|
2703
|
+
modalConfig: l.shape({
|
|
2704
|
+
addModal: l.shape({
|
|
2705
|
+
title: l.string.isRequired,
|
|
2706
|
+
size: l.string,
|
|
2707
|
+
formClass: l.string,
|
|
2708
|
+
formFields: l.arrayOf(Te),
|
|
2709
|
+
handleSubmit: l.func.isRequired,
|
|
2710
|
+
actionButtons: l.arrayOf(Oe)
|
|
2592
2711
|
}),
|
|
2593
|
-
editModal:
|
|
2594
|
-
title:
|
|
2595
|
-
size:
|
|
2596
|
-
formClass:
|
|
2597
|
-
formFields:
|
|
2598
|
-
handleSubmit:
|
|
2599
|
-
actionButtons:
|
|
2712
|
+
editModal: l.shape({
|
|
2713
|
+
title: l.string.isRequired,
|
|
2714
|
+
size: l.string,
|
|
2715
|
+
formClass: l.string,
|
|
2716
|
+
formFields: l.arrayOf(Te),
|
|
2717
|
+
handleSubmit: l.func.isRequired,
|
|
2718
|
+
actionButtons: l.arrayOf(Oe)
|
|
2600
2719
|
}),
|
|
2601
|
-
deleteModal:
|
|
2602
|
-
title:
|
|
2603
|
-
size:
|
|
2604
|
-
confirmText:
|
|
2605
|
-
referenceKey:
|
|
2606
|
-
actionButtons:
|
|
2720
|
+
deleteModal: l.shape({
|
|
2721
|
+
title: l.string.isRequired,
|
|
2722
|
+
size: l.string,
|
|
2723
|
+
confirmText: l.string,
|
|
2724
|
+
referenceKey: l.string,
|
|
2725
|
+
actionButtons: l.arrayOf(Oe)
|
|
2607
2726
|
}),
|
|
2608
|
-
viewModal:
|
|
2609
|
-
title:
|
|
2610
|
-
size:
|
|
2727
|
+
viewModal: l.shape({
|
|
2728
|
+
title: l.string.isRequired,
|
|
2729
|
+
size: l.string,
|
|
2611
2730
|
// 👇 This covers your commented code:
|
|
2612
|
-
component:
|
|
2731
|
+
component: l.elementType,
|
|
2613
2732
|
// for custom component like TeamMemberDetail
|
|
2614
|
-
fields:
|
|
2615
|
-
footer:
|
|
2616
|
-
cancelButton:
|
|
2617
|
-
cancelText:
|
|
2733
|
+
fields: l.arrayOf(Ca),
|
|
2734
|
+
footer: l.shape({
|
|
2735
|
+
cancelButton: l.bool,
|
|
2736
|
+
cancelText: l.string
|
|
2618
2737
|
})
|
|
2619
2738
|
})
|
|
2620
2739
|
}),
|
|
2621
2740
|
/* ================= FILTER CONFIG ================= */
|
|
2622
|
-
filterConfig:
|
|
2623
|
-
fields:
|
|
2741
|
+
filterConfig: l.shape({
|
|
2742
|
+
fields: l.arrayOf(Te)
|
|
2624
2743
|
})
|
|
2625
2744
|
}).isRequired
|
|
2626
2745
|
};
|
|
2627
|
-
|
|
2746
|
+
function Ma({ children: n }) {
|
|
2747
|
+
return ca(), n;
|
|
2748
|
+
}
|
|
2749
|
+
function La({ children: n }) {
|
|
2750
|
+
try {
|
|
2751
|
+
return /* @__PURE__ */ e(Ma, { children: n });
|
|
2752
|
+
} catch {
|
|
2753
|
+
return /* @__PURE__ */ e(
|
|
2754
|
+
da,
|
|
2755
|
+
{
|
|
2756
|
+
anchorOrigin: {
|
|
2757
|
+
vertical: "bottom",
|
|
2758
|
+
horizontal: "right"
|
|
2759
|
+
},
|
|
2760
|
+
action: (t) => /* @__PURE__ */ e(
|
|
2761
|
+
"button",
|
|
2762
|
+
{
|
|
2763
|
+
onClick: () => {
|
|
2764
|
+
window.dispatchEvent(
|
|
2765
|
+
new CustomEvent("closeSnackbar", { detail: t })
|
|
2766
|
+
);
|
|
2767
|
+
},
|
|
2768
|
+
className: "p-1 hover:bg-white/20 rounded-full transition-colors duration-200 text-white flex items-center justify-center",
|
|
2769
|
+
children: /* @__PURE__ */ e(Le, { className: "h-4 w-4" })
|
|
2770
|
+
}
|
|
2771
|
+
),
|
|
2772
|
+
maxSnack: 3,
|
|
2773
|
+
autoHideDuration: 3e3,
|
|
2774
|
+
children: n
|
|
2775
|
+
}
|
|
2776
|
+
);
|
|
2777
|
+
}
|
|
2778
|
+
}
|
|
2779
|
+
const Ra = () => {
|
|
2628
2780
|
if (typeof document > "u" || document.getElementById("react-admin-crud-manager-styles")) return;
|
|
2629
|
-
const
|
|
2630
|
-
|
|
2631
|
-
const o = `
|
|
2781
|
+
const n = document.createElement("style");
|
|
2782
|
+
n.id = "react-admin-crud-manager-styles", n.textContent = `
|
|
2632
2783
|
.no-spinner::-webkit-outer-spin-button,
|
|
2633
2784
|
.no-spinner::-webkit-inner-spin-button {
|
|
2634
2785
|
-webkit-appearance: none;
|
|
2635
2786
|
margin: 0;
|
|
2636
2787
|
}
|
|
2637
|
-
|
|
2788
|
+
|
|
2638
2789
|
.no-spinner {
|
|
2639
2790
|
-moz-appearance: textfield;
|
|
2640
2791
|
}
|
|
2641
|
-
|
|
2792
|
+
|
|
2642
2793
|
.tox.tox-tinymce .tox-edit-area::before {
|
|
2643
2794
|
border: 0 !important;
|
|
2644
2795
|
box-shadow: none !important;
|
|
2645
2796
|
}
|
|
2646
|
-
|
|
2647
|
-
b.textContent = o, document.head.appendChild(b);
|
|
2797
|
+
`, document.head.appendChild(n);
|
|
2648
2798
|
};
|
|
2649
|
-
function
|
|
2650
|
-
return
|
|
2651
|
-
|
|
2652
|
-
}, []), /* @__PURE__ */ e(
|
|
2799
|
+
function Ea(n) {
|
|
2800
|
+
return K(() => {
|
|
2801
|
+
Ra();
|
|
2802
|
+
}, []), /* @__PURE__ */ e(La, { children: /* @__PURE__ */ e(Ze, { config: n.config }) });
|
|
2653
2803
|
}
|
|
2654
2804
|
export {
|
|
2655
|
-
|
|
2805
|
+
Ea as default
|
|
2656
2806
|
};
|
|
2657
2807
|
//# sourceMappingURL=index.es.js.map
|