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.es.js CHANGED
@@ -1,65 +1,65 @@
1
- import { jsx as e, Fragment as j, jsxs as u } from "react/jsx-runtime";
2
- import Fe, { useState as R, useRef as X, useEffect as _, useMemo as Ae } from "react";
3
- import { Info as qe, ChevronDown as Ee, Search as Te, Check as Ze, X as Me, Plus as Je, Filter as Qe, ChevronLeft as Xe, ChevronRight as ea, EllipsisVertical as aa, User as De, Music as ta } from "lucide-react";
4
- import { createPortal as ra } from "react-dom";
5
- import { Icon as re } from "@iconify/react";
6
- import { Editor as na } from "@tinymce/tinymce-react";
7
- import { SnackbarProvider as la, enqueueSnackbar as Re } from "notistack";
8
- import t from "prop-types";
9
- const $e = (b, o = "DD MMM YYYY") => {
10
- if (!b) return "N/A";
11
- const l = new Date(b);
12
- if (isNaN(l)) return "Invalid Date";
13
- const s = (r) => String(r).padStart(2, "0"), c = {
14
- YYYY: l.getFullYear(),
15
- YY: String(l.getFullYear()).slice(-2),
16
- MMMM: l.toLocaleString("en-US", { month: "long" }),
17
- MMM: l.toLocaleString("en-US", { month: "short" }),
18
- MM: s(l.getMonth() + 1),
19
- M: l.getMonth() + 1,
20
- DD: s(l.getDate()),
21
- D: l.getDate(),
22
- dddd: l.toLocaleString("en-US", { weekday: "long" }),
23
- ddd: l.toLocaleString("en-US", { weekday: "short" }),
24
- HH: s(l.getHours()),
25
- hh: s(l.getHours() % 12 || 12),
26
- mm: s(l.getMinutes()),
27
- ss: s(l.getSeconds()),
28
- A: l.getHours() >= 12 ? "PM" : "AM"
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
- (r) => c[r]
32
+ (d) => i[d]
33
33
  );
34
- }, oa = (b, o, l = []) => {
35
- if (!(o != null && o.trim())) return b;
36
- const s = o.toLowerCase(), c = (r) => r == null ? [] : typeof r == "object" ? Object.values(r).flatMap(c) : [String(r)];
37
- return b.filter((r) => {
38
- let g = [];
39
- return l.length > 0 ? l.forEach((M) => {
40
- r[M] !== void 0 && g.push(...c(r[M]));
41
- }) : g = c(r), g.some(
42
- (M) => M.toLowerCase().includes(s)
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
- }, Z = Fe.forwardRef(
45
+ }, Q = Me.forwardRef(
46
46
  ({
47
- className: b = "",
47
+ className: n = "",
48
48
  variant: o = "contained",
49
- color: l = "default",
49
+ color: t = "default",
50
50
  size: s = "default",
51
- fullWidth: c = !1,
52
- children: r,
53
- ...g
54
- }, M) => {
55
- var y;
56
- const O = "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", h = {
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
- }, v = {
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
- }, d = ((y = v[l]) == null ? void 0 : y[o]) || v.default.contained, i = h[s], x = `
84
- ${O}
85
- ${d}
86
- ${i}
87
- ${c ? "w-full" : ""}
88
- ${b}
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: M,
94
- type: g.type || "button",
95
- className: x,
96
- ...g,
97
- children: r
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
- Z.displayName = "Button";
103
- function W({ label: b, required: o = !1, infoText: l = "" }) {
104
- return /* @__PURE__ */ e(j, { children: /* @__PURE__ */ u("label", { className: "flex text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: [
105
- b,
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
- l && /* @__PURE__ */ u("span", { className: "ml-2 relative group inline-flex items-center cursor-pointer", children: [
108
- /* @__PURE__ */ e(qe, { className: "w-4 h-4 text-gray-500 dark:text-gray-400" }),
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: l
117
+ children: t
118
118
  }
119
119
  )
120
120
  ] })
121
121
  ] }) });
122
122
  }
123
- const ia = ({
124
- options: b = [],
123
+ const ha = ({
124
+ options: n = [],
125
125
  value: o = "",
126
- defaultValue: l = "",
126
+ defaultValue: t = "",
127
127
  onChange: s,
128
- placeholder: c = "Select option",
129
- className: r = "",
130
- disabled: g = !1,
131
- search: M = !1,
132
- label: O = "",
133
- required: h = !1,
134
- name: v = "",
135
- parentClass: d = "",
136
- multiple: i = !1,
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: x = "",
139
- formData: y = {},
140
- dependencyKey: p = ""
138
+ dropdownMaxHeight: f = "",
139
+ formData: g = {},
140
+ dependencyKey: N = ""
141
141
  }) => {
142
- var ee;
143
- const [m, N] = R(!1), [A, I] = R(""), [k, C] = R(!0), P = X(null), F = X(null), [L, E] = R([]);
144
- let G = o || o === !1 ? o : l;
145
- const H = (w) => w == null || w === "" ? "" : String(typeof w == "boolean" ? w : w ?? "");
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 b == "function") {
150
- const T = await b(y);
151
- E(T);
149
+ if (typeof n == "function") {
150
+ const P = await n(g);
151
+ B(P);
152
152
  } else
153
- E(b || []);
153
+ B(n || []);
154
154
  })();
155
155
  },
156
- p ? [b, y == null ? void 0 : y[p]] : [b]
156
+ N ? [n, g == null ? void 0 : g[N]] : [n]
157
157
  );
158
- const V = i ? (G || []).map(H) : H(G), B = L.filter(
159
- (w) => w.label.toLowerCase().includes(A.toLowerCase())
160
- ), K = (w) => {
161
- const T = H(w);
162
- return i ? V.includes(T) : T === V;
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 = (T) => {
166
- P.current && !P.current.contains(T.target) && (N(!1), I(""));
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 (m && P.current) {
171
- const w = P.current.getBoundingClientRect(), Y = window.innerHeight - w.bottom;
172
- C(Y < 200);
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
- }, [m]), _(() => {
175
- m && F.current && F.current.focus();
176
- }, [m]);
177
- const J = (w) => {
178
- let T = w;
179
- if (w === "true" ? T = !0 : w === "false" && (T = !1), i) {
180
- const Y = V.includes(H(w));
181
- let z;
182
- Y ? z = o.filter(
183
- (q) => H(q) !== H(w)
184
- ) : z = [...o || [], T], s(z);
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(T), N(!1);
187
- I("");
188
- }, D = i ? L.filter((w) => K(w.value)).map((w) => w.label).join(", ") : (ee = L.find((w) => K(w.value))) == null ? void 0 : ee.label;
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__ */ u("div", { className: d || "col-span-12", children: [
194
- /* @__PURE__ */ e(W, { label: O, required: h }),
195
- /* @__PURE__ */ u("div", { className: `relative ${r}`, ref: P, children: [
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: D || "",
201
- required: h,
202
- multiple: i,
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: D, children: D })
204
+ children: /* @__PURE__ */ e("option", { hidden: !0, value: V, children: V })
205
205
  }
206
206
  ),
207
- /* @__PURE__ */ u(
207
+ /* @__PURE__ */ h(
208
208
  "button",
209
209
  {
210
210
  type: "button",
211
- onClick: () => !g && N(!m),
212
- disabled: g,
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
- ${D ? "dark:text-white" : "text-gray-500 dark:text-gray-400"}
215
- ${g ? "opacity-50 cursor-not-allowed" : "dark:bg-gray-700"}`,
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: D || c }),
217
+ /* @__PURE__ */ e("span", { className: "truncate", children: V || i }),
218
218
  /* @__PURE__ */ e(
219
- Ee,
219
+ $e,
220
220
  {
221
- className: `w-4 h-4 transition-transform ${m ? "rotate-180" : ""}`
221
+ className: `w-4 h-4 transition-transform ${y ? "rotate-180" : ""}`
222
222
  }
223
223
  )
224
224
  ]
225
225
  }
226
226
  ),
227
- m && /* @__PURE__ */ u(
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
- ${k ? "bottom-full mb-1" : "top-full mt-1"}`,
231
+ ${L ? "bottom-full mb-1" : "top-full mt-1"}`,
232
232
  children: [
233
- M && /* @__PURE__ */ e("div", { className: "p-2 border-b border-gray-200 dark:border-gray-600", children: /* @__PURE__ */ u("div", { className: "relative", children: [
234
- /* @__PURE__ */ e(Te, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400" }),
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: A,
241
- onChange: (w) => I(w.target.value),
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: x || ""
252
+ maxHeight: f || ""
253
253
  },
254
- children: B.length > 0 ? B.map((w) => /* @__PURE__ */ u(
254
+ children: Z.length > 0 ? Z.map((w) => /* @__PURE__ */ h(
255
255
  "button",
256
256
  {
257
257
  type: "button",
258
- onClick: () => J(String(w.value)),
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
- ${K(w.value) ? "bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300" : ""}`,
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
- i && K(w.value) && /* @__PURE__ */ e(Ze, { className: "w-4 h-4" })
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
- ] }, v);
275
- }, sa = ({
276
- value: b = !0,
277
- onChange: o,
278
- text: l,
279
- options: s = [],
280
- label: c,
281
- required: r,
282
- name: g = "",
283
- disabled: M = !1,
284
- parentClass: O = ""
285
- }) => {
286
- const h = s.length > 0 ? s : [
287
- { label: "Active", value: !0 },
288
- { label: "Inactive", value: !1 }
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
- className: "flex items-center gap-2 cursor-pointer select-none",
298
- children: [
299
- /* @__PURE__ */ e(
300
- "input",
301
- {
302
- type: "radio",
303
- name: "switch-field",
304
- required: r && d === 0,
305
- value: v.value,
306
- disabled: M,
307
- checked: b === v.value,
308
- onChange: () => o(v.value),
309
- className: "w-4 h-4 border-gray-300 cursor-pointer"
310
- }
311
- ),
312
- /* @__PURE__ */ e("span", { className: "text-sm text-gray-700 dark:text-white", children: v.label })
313
- ]
314
- },
315
- d
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
- ] }, g) });
319
- }, Ne = [
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 da({
572
- label: b = "",
580
+ function ba({
581
+ label: n = "",
573
582
  value: o = "",
574
- name: l = "",
583
+ name: t = "",
575
584
  parentClass: s = "",
576
- onChange: c,
577
- disabled: r = !1,
578
- required: g = !1,
579
- placeholder: M = "Phone number",
580
- search: O = !1,
581
- countriesList: h = !1,
582
- defaultCountry: v = ""
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 d = (L) => Ne.find((E) => E.code == L), [i, x] = R(
585
- d(v) || Ne[0]
586
- ), [y, p] = R(""), [m, N] = R(!1), [A, I] = R(""), k = X();
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 L = Ne.filter((E) => o.startsWith("+" + E.phone)).sort((E, G) => G.phone.length - E.phone.length)[0];
590
- if (L) {
591
- x(L), p(o.replace("+" + L.phone, ""));
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
- p(o);
604
+ N(o);
596
605
  }, [o]);
597
- const C = (L) => {
598
- const E = L.target.value.replace(/\D/g, "");
599
- p(E), i && c && c("+" + i.phone + E);
600
- }, P = (L) => {
601
- x(L), c && c("+" + L.phone + y), N(!1), I("");
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 L = (E) => {
605
- k.current && !k.current.contains(E.target) && N(!1);
612
+ K(() => {
613
+ const T = (B) => {
614
+ L.current && !L.current.contains(B.target) && M(!1);
606
615
  };
607
- return document.addEventListener("mousedown", L), () => document.removeEventListener("mousedown", L);
616
+ return document.addEventListener("mousedown", T), () => document.removeEventListener("mousedown", T);
608
617
  }, []);
609
- const F = Ne.filter(
610
- (L) => L.label.toLowerCase().includes(A.toLowerCase()) || L.phone.includes(A)
618
+ const F = Se.filter(
619
+ (T) => T.label.toLowerCase().includes(D.toLowerCase()) || T.phone.includes(D)
611
620
  );
612
- return h ? /* @__PURE__ */ e(j, { children: /* @__PURE__ */ u("div", { className: s || "col-span-12", children: [
613
- /* @__PURE__ */ e(W, { label: b, required: g }),
614
- /* @__PURE__ */ u("div", { className: "relative ", ref: k, children: [
615
- /* @__PURE__ */ u(
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
- ${m ? "ring-0.5 ring-blue-100 border-blue-300" : "border-gray-300 dark:border-gray-600"}
620
- ${r ? "opacity-60 cursor-not-allowed" : ""}`,
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__ */ u(
631
+ /* @__PURE__ */ h(
623
632
  "button",
624
633
  {
625
634
  type: "button",
626
- disabled: r,
627
- onClick: () => N(!m),
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
- i ? /* @__PURE__ */ e(
639
+ k ? /* @__PURE__ */ e(
631
640
  "img",
632
641
  {
633
- src: `https://flagcdn.com/w20/${i.code.toLowerCase()}.png`,
634
- alt: i.code,
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(Ee, { className: "w-3 h-3 text-gray-500" })
647
+ /* @__PURE__ */ e($e, { className: "w-3 h-3 text-gray-500" })
639
648
  ]
640
649
  }
641
650
  ),
642
- i && /* @__PURE__ */ u("span", { className: "ml-2 text-sm text-gray-700 dark:text-gray-200 whitespace-nowrap", children: [
651
+ k && /* @__PURE__ */ h("span", { className: "ml-2 text-sm text-gray-700 dark:text-gray-200 whitespace-nowrap", children: [
643
652
  "+",
644
- i.phone
653
+ k.phone
645
654
  ] }),
646
655
  /* @__PURE__ */ e(
647
656
  "input",
648
657
  {
649
658
  type: "tel",
650
- value: y,
651
- onChange: C,
652
- required: g,
653
- disabled: r || !i,
654
- placeholder: i ? M : "Select a country",
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: g,
671
+ required: r,
663
672
  tabIndex: -1,
664
673
  readOnly: !0,
665
- value: i && y ? "+" + i.phone + y : "",
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
- m && /* @__PURE__ */ u("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: [
678
- O && /* @__PURE__ */ e("div", { className: "p-2 border-b border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ u("div", { className: "relative", children: [
679
- /* @__PURE__ */ e(Te, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400" }),
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: A,
685
- onChange: (L) => I(L.target.value),
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((L) => /* @__PURE__ */ u(
700
+ F.map((T) => /* @__PURE__ */ h(
692
701
  "button",
693
702
  {
694
703
  type: "button",
695
- onClick: () => P(L),
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/${L.code.toLowerCase()}.png`,
702
- alt: L.code,
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__ */ u("span", { children: [
707
- L.label,
715
+ /* @__PURE__ */ h("span", { children: [
716
+ T.label,
708
717
  " (+",
709
- L.phone,
718
+ T.phone,
710
719
  ")"
711
720
  ] })
712
721
  ]
713
722
  },
714
- L.code
723
+ T.code
715
724
  ))
716
725
  ] })
717
726
  ] })
718
- ] }, l) }) : /* @__PURE__ */ e(j, { children: /* @__PURE__ */ u("div", { className: s || "col-span-12", children: [
719
- /* @__PURE__ */ e(W, { label: b, required: g }),
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: (E) => {
726
- const G = E.target.value.replace(/[^+\d]/g, ""), H = G.startsWith("+") ? "+" + G.replace(/[+]/g, "").slice(0) : G;
727
- c(H);
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: M,
730
- disabled: r,
731
- required: g,
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
- ] }, l) });
748
+ ] }, t) });
740
749
  }
741
- const Ge = Fe.forwardRef(
742
- ({ className: b = "", label: o, required: l, ...s }, c) => {
743
- const r = `
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
- ${b}
754
+ ${n}
746
755
  `.trim();
747
- return /* @__PURE__ */ e(j, { children: /* @__PURE__ */ u("div", { className: s.parentClass || "col-span-12", children: [
748
- /* @__PURE__ */ e(W, { label: o, required: l }),
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: r,
753
- ref: c,
754
- required: l,
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
- Ge.displayName = "TextArea";
762
- const ca = ({
763
- label: b = "",
770
+ _e.displayName = "TextArea";
771
+ const pa = ({
772
+ label: n = "",
764
773
  value: o = null,
765
- onChange: l,
774
+ onChange: t,
766
775
  required: s = !1,
767
- accept: c = "image/*",
768
- id: r,
769
- dragDrop: g = !1,
770
- name: M = "",
771
- parentClass: O = ""
776
+ accept: i = "image/*",
777
+ id: d,
778
+ dragDrop: r = !1,
779
+ name: x = "",
780
+ parentClass: S = ""
772
781
  }) => {
773
- const [h, v] = R(o), [d, i] = R(!1), x = X(null);
774
- _(() => (o instanceof File ? v({ file: o, preview: URL.createObjectURL(o) }) : (o != null && o.preview, v(o)), () => {
775
- h != null && h.preview && h.preview.startsWith("blob:") && URL.revokeObjectURL(h.preview);
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 y = (k) => {
778
- if (!k || k.length === 0)
786
+ const g = (L) => {
787
+ if (!L || L.length === 0)
779
788
  return;
780
- const C = k[0], P = URL.createObjectURL(C), F = { file: C, preview: P };
781
- h != null && h.preview && h.preview.startsWith("blob:") && URL.revokeObjectURL(h.preview), v(F), l == null || l(C);
782
- }, p = (k) => {
783
- k && k.stopPropagation(), h != null && h.preview && h.preview.startsWith("blob:") && URL.revokeObjectURL(h.preview), v(null), l == null || l(null), x.current && (x.current.value = "");
784
- }, m = (k) => {
785
- g && (k.preventDefault(), i(!0));
786
- }, N = (k) => {
787
- g && (k.preventDefault(), i(!1));
788
- }, A = (k) => {
789
- g && (k.preventDefault(), i(!1), y(k.dataTransfer.files));
790
- }, I = () => {
791
- x.current.click();
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__ */ u("div", { className: O || "col-span-12", children: [
794
- /* @__PURE__ */ e(W, { label: b, required: s }),
795
- /* @__PURE__ */ u(
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 ${d ? "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"}`,
799
- onDragOver: m,
800
- onDragLeave: N,
801
- onDrop: A,
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: x,
807
- id: r,
815
+ ref: f,
816
+ id: d,
808
817
  type: "file",
809
- accept: c,
810
- onChange: (k) => y(k.target.files),
811
- required: s && !h,
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__ */ u(
824
+ /* @__PURE__ */ h(
816
825
  "div",
817
826
  {
818
- className: `flex items-center space-x-4 transition-all ${d ? "opacity-50" : ""}`,
827
+ className: `flex items-center space-x-4 transition-all ${u ? "opacity-50" : ""}`,
819
828
  children: [
820
- h ? (
829
+ c ? (
821
830
  // Image preview with close button
822
- /* @__PURE__ */ u("div", { className: "relative group", children: [
831
+ /* @__PURE__ */ h("div", { className: "relative group", children: [
823
832
  /* @__PURE__ */ e(
824
833
  "img",
825
834
  {
826
- src: h.preview || h,
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: p,
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(re, { icon: "mdi:close", className: "w-3 h-3" })
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
- re,
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__ */ u("div", { className: "flex flex-col items-center space-y-1", children: [
861
+ /* @__PURE__ */ h("div", { className: "flex flex-col items-center space-y-1", children: [
853
862
  /* @__PURE__ */ e(
854
- Z,
863
+ Q,
855
864
  {
856
865
  type: "button",
857
- onClick: I,
866
+ onClick: U,
858
867
  variant: "outlined",
859
868
  color: "default",
860
- children: h ? "Change Image" : "Select Image"
869
+ children: c ? "Change Image" : "Select Image"
861
870
  }
862
871
  ),
863
- g && !h && /* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: "or drag and drop" })
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
- g && d && /* @__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" }) })
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
- ] }, M) });
873
- }, Ke = Fe.forwardRef(
881
+ ] }, x) });
882
+ }, ze = Me.forwardRef(
874
883
  ({
875
- label: b,
884
+ label: n,
876
885
  required: o,
877
- parentClass: l = "",
886
+ parentClass: t = "",
878
887
  className: s = "",
879
- type: c = "text",
880
- onKeyDown: r,
881
- negativeNumberAllow: g = !0,
882
- defaultValue: M = "",
883
- field: O = {},
884
- ...h
885
- }, v) => {
886
- const [d, i] = R(!1), x = (p) => {
887
- if (c === "number") {
888
- if (["e", "E", "+"].includes(p.key)) {
889
- p.preventDefault();
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 (g == !1 && p.key === "-") {
893
- p.preventDefault();
901
+ if (r == !1 && N.key === "-") {
902
+ N.preventDefault();
894
903
  return;
895
904
  }
896
- if (["ArrowUp", "ArrowDown"].includes(p.key)) {
897
- p.preventDefault();
905
+ if (["ArrowUp", "ArrowDown"].includes(N.key)) {
906
+ N.preventDefault();
898
907
  return;
899
908
  }
900
909
  }
901
- r == null || r(p);
902
- }, y = `
910
+ d == null || d(N);
911
+ }, g = `
903
912
  h-10 placeholder-gray-400 dark:placeholder-gray-400
904
- ${c === "password" ? "pr-10" : ""}
905
- ${c === "number" ? "no-spinner" : ""}
913
+ ${i === "password" ? "pr-10" : ""}
914
+ ${i === "number" ? "no-spinner" : ""}
906
915
  ${s}
907
916
  `.trim();
908
- return _(() => {
909
- if (M) {
910
- let p = h.value || M;
917
+ return K(() => {
918
+ if (x) {
919
+ let N = c.value || x;
911
920
  setTimeout(() => {
912
- var m;
913
- (m = h.onChange) == null || m.call(h, { target: { value: p } });
921
+ var y;
922
+ (y = c.onChange) == null || y.call(c, { target: { value: N } });
914
923
  }, 100);
915
924
  }
916
- }, [M]), /* @__PURE__ */ e(j, { children: /* @__PURE__ */ u("div", { className: l || "col-span-12", children: [
925
+ }, [x]), /* @__PURE__ */ e(j, { children: /* @__PURE__ */ h("div", { className: t || "col-span-12", children: [
917
926
  /* @__PURE__ */ e(
918
- W,
927
+ q,
919
928
  {
920
- label: b,
929
+ label: n,
921
930
  required: o,
922
- infoText: O.infoText
931
+ infoText: S.infoText
923
932
  }
924
933
  ),
925
- /* @__PURE__ */ u("div", { className: "relative", children: [
934
+ /* @__PURE__ */ h("div", { className: "relative", children: [
926
935
  /* @__PURE__ */ e(
927
936
  "input",
928
937
  {
929
- type: c === "password" && d ? "text" : c,
930
- ref: v,
938
+ type: i === "password" && u ? "text" : i,
939
+ ref: b,
931
940
  required: o,
932
- onKeyDown: x,
933
- className: y,
934
- ...h
941
+ onKeyDown: f,
942
+ className: g,
943
+ ...c
935
944
  }
936
945
  ),
937
- c === "password" && /* @__PURE__ */ e(
946
+ i === "password" && /* @__PURE__ */ e(
938
947
  "button",
939
948
  {
940
949
  type: "button",
941
950
  tabIndex: -1,
942
- onClick: () => i((p) => !p),
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
- re,
954
+ ne,
946
955
  {
947
- icon: d ? "mdi:eye-outline" : "mdi:eye-off-outline",
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
- ] }, h.name) });
963
+ ] }, c.name) });
955
964
  }
956
965
  );
957
- Ke.displayName = "Input";
958
- const ha = ({
959
- key: b,
966
+ ze.displayName = "Input";
967
+ const ga = ({
968
+ key: n,
960
969
  editorKey: o = "",
961
- value: l = "",
970
+ value: t = "",
962
971
  onChange: s,
963
- label: c = "",
964
- required: r = !1,
965
- placeholder: g = "",
966
- parentClass: M = "col-span-12",
967
- height: O = 400,
968
- inline: h = !1,
969
- disabled: v = !1,
970
- plugins: d,
971
- toolbar: i,
972
- menubar: x = !1,
973
- fontFamily: y = "Inter, sans-serif",
974
- initConfig: p = {},
975
- imageUploadHandler: m
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__ */ u("div", { className: M, children: [
978
- c && /* @__PURE__ */ e(W, { label: c, required: r }),
986
+ }) => /* @__PURE__ */ h("div", { className: x, children: [
987
+ i && /* @__PURE__ */ e(q, { label: i, required: d }),
979
988
  /* @__PURE__ */ e(
980
- na,
989
+ sa,
981
990
  {
982
991
  apiKey: o,
983
- value: l,
984
- disabled: v,
992
+ value: t,
993
+ disabled: b,
985
994
  init: {
986
- height: O,
987
- inline: h,
988
- menubar: x,
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: (k) => new Promise((C, P) => {
993
- if (!m) {
994
- C(`data:${k.blob().type};base64,${k.base64()}`);
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
- m(k).then((F) => {
998
- F ? C(F) : P("Upload failed: No URL returned");
1006
+ y(L).then((F) => {
1007
+ F ? O(F) : E("Upload failed: No URL returned");
999
1008
  }).catch((F) => {
1000
- P(
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: d ?? [
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: i ?? "undo redo | blocks | bold italic underline forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image media table | removeformat | code fullscreen preview",
1025
- placeholder: g,
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: ${y};
1037
+ font-family: ${g};
1029
1038
  }
1030
1039
  `,
1031
- ...p
1040
+ ...N
1032
1041
  },
1033
- onEditorChange: (k) => {
1034
- s && s(k);
1042
+ onEditorChange: (L) => {
1043
+ s && s(L);
1035
1044
  }
1036
1045
  }
1037
1046
  )
1038
- ] }, b), ua = ({
1039
- name: b = "",
1047
+ ] }, n), ma = ({
1048
+ name: n = "",
1040
1049
  label: o = "",
1041
1050
  // label for single checkbox
1042
- options: l = [],
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: c,
1047
- disabled: r = !1,
1048
- required: g = !1,
1049
- parentClass: M = "col-span-12",
1050
- className: O = "",
1051
- multiSelect: h = !1
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 v = Array.isArray(l) && l.length > 0, d = (y) => v ? h ? Array.isArray(s) && s.includes(y) : s === y : !!s, i = (y) => {
1055
- c == null || c(y.target.checked, b);
1056
- }, x = (y, p) => {
1057
- if (c)
1058
- if (!h)
1059
- c(p ? y : "", b);
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 m = Array.isArray(s) ? [...s] : [];
1062
- if (p)
1063
- m.includes(y) || m.push(y);
1070
+ const y = Array.isArray(s) ? [...s] : [];
1071
+ if (N)
1072
+ y.includes(g) || y.push(g);
1064
1073
  else {
1065
- const N = m.indexOf(y);
1066
- N > -1 && m.splice(N, 1);
1074
+ const M = y.indexOf(g);
1075
+ M > -1 && y.splice(M, 1);
1067
1076
  }
1068
- c(m, b);
1077
+ i(y, n);
1069
1078
  }
1070
1079
  };
1071
- return v ? /* @__PURE__ */ e(j, { children: /* @__PURE__ */ u("div", { className: `${M}`, children: [
1072
- /* @__PURE__ */ e(W, { label: o, required: g }),
1073
- /* @__PURE__ */ e("div", { className: "flex flex-col space-y-2", children: l.map((y, p) => /* @__PURE__ */ u("div", { className: "flex items-center", 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: b,
1079
- value: y.value,
1080
- checked: d(y.value),
1081
- disabled: r || y.disabled,
1082
- required: g && p === 0,
1083
- onChange: (m) => x(y.value, m.target.checked),
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 ${O}`
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
- b
1095
+ n
1087
1096
  ),
1088
- y.label && /* @__PURE__ */ e(
1097
+ g.label && /* @__PURE__ */ e(
1089
1098
  "label",
1090
1099
  {
1091
- htmlFor: b,
1100
+ htmlFor: n,
1092
1101
  className: "ml-2 text-sm text-gray-700 dark:text-gray-200 select-none",
1093
- children: y.label
1102
+ children: g.label
1094
1103
  }
1095
1104
  )
1096
- ] }, y.value || y.label)) })
1097
- ] }) }) : /* @__PURE__ */ u("div", { className: `flex items-center ${M}`, children: [
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: b,
1103
- checked: d(),
1104
- disabled: r,
1105
- required: g,
1106
- onChange: i,
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 ${O}`
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: b,
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
- }, ba = ({
1120
- label: b = "",
1128
+ }, fa = ({
1129
+ label: n = "",
1121
1130
  value: o = null,
1122
- onChange: l,
1131
+ onChange: t,
1123
1132
  required: s = !1,
1124
- accept: c = "audio/*",
1125
- id: r,
1126
- dragDrop: g = !1,
1127
- name: M = "",
1128
- parentClass: O = ""
1133
+ accept: i = "audio/*",
1134
+ id: d,
1135
+ dragDrop: r = !1,
1136
+ name: x = "",
1137
+ parentClass: S = ""
1129
1138
  }) => {
1130
- const [h, v] = R(null), [d, i] = R(!1), x = X(null);
1131
- _(() => {
1139
+ const [c, b] = C(null), [u, k] = C(!1), f = X(null);
1140
+ K(() => {
1132
1141
  if (!o) {
1133
- y(), v(null);
1142
+ g(), b(null);
1134
1143
  return;
1135
1144
  }
1136
1145
  if (o instanceof File) {
1137
- const C = URL.createObjectURL(o);
1138
- return v({ file: o, preview: C }), () => {
1139
- URL.revokeObjectURL(C);
1146
+ const O = URL.createObjectURL(o);
1147
+ return b({ file: o, preview: O }), () => {
1148
+ URL.revokeObjectURL(O);
1140
1149
  };
1141
- } else typeof o == "string" ? v({ preview: o }) : o != null && o.preview && v(o);
1150
+ } else typeof o == "string" ? b({ preview: o }) : o != null && o.preview && b(o);
1142
1151
  }, [o]);
1143
- const y = () => {
1144
- h != null && h.preview && h.preview.startsWith("blob:") && URL.revokeObjectURL(h.preview);
1145
- }, p = (C) => {
1146
- if (!C || C.length === 0)
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 P = C[0], F = URL.createObjectURL(P);
1149
- y(), v({ file: P, preview: F }), l == null || l(P);
1150
- }, m = (C) => {
1151
- C && C.stopPropagation(), y(), v(null), l == null || l(null), x.current && (x.current.value = "");
1152
- }, N = (C) => {
1153
- g && (C.preventDefault(), i(!0));
1154
- }, A = (C) => {
1155
- g && (C.preventDefault(), i(!1));
1156
- }, I = (C) => {
1157
- g && (C.preventDefault(), i(!1), p(C.dataTransfer.files));
1158
- }, k = () => {
1159
- x.current.click();
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__ */ u("div", { className: O || "col-span-12", children: [
1162
- /* @__PURE__ */ e(W, { label: b, required: s }),
1163
- /* @__PURE__ */ u(
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 ${d ? "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"}`,
1167
- onDragOver: N,
1168
- onDragLeave: A,
1169
- onDrop: I,
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: x,
1175
- id: r,
1183
+ ref: f,
1184
+ id: d,
1176
1185
  type: "file",
1177
- accept: c,
1178
- onChange: (C) => p(C.target.files),
1179
- required: s && !h,
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 ${d ? "opacity-50" : ""}`,
1187
- children: h ? (
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__ */ u("div", { className: "flex items-center space-x-4", children: [
1190
- /* @__PURE__ */ u("div", { className: "relative w-full", children: [
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: m,
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(re, { icon: "mdi:close", className: "w-3 h-3" })
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: h.preview,
1213
+ src: c.preview,
1205
1214
  controls: !0,
1206
1215
  controlsList: "nodownload"
1207
1216
  },
1208
- h.preview
1217
+ c.preview
1209
1218
  )
1210
1219
  ] }),
1211
- /* @__PURE__ */ e(Z, { type: "button", onClick: k, children: /* @__PURE__ */ e("span", { children: "Change Audio File" }) })
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__ */ u("div", { className: "flex items-center justify-center space-x-4", children: [
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(re, { icon: "mdi:music", className: "text-gray-400 w-10 h-10" }) }),
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
- Z,
1227
+ Q,
1219
1228
  {
1220
1229
  type: "button",
1221
- onClick: k,
1230
+ onClick: L,
1222
1231
  variant: "outlined",
1223
1232
  children: /* @__PURE__ */ e("span", { children: "Choose Audio File" })
1224
1233
  }
1225
1234
  ),
1226
- g && /* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: "or drag and drop your audio file here" })
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
- g && d && !h && /* @__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" }) })
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
- ] }, M);
1236
- }, _e = ({ field: b, formData: o, handleChange: l }) => {
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: c,
1240
- type: r,
1241
- options: g,
1242
- placeholder: M,
1243
- rows: O,
1244
- inputClass: h,
1245
- search: v,
1246
- accept: d,
1247
- text: i,
1248
- required: x = !1,
1249
- minLength: y,
1250
- dragDrop: p,
1251
- parentClass: m,
1252
- countriesList: N,
1253
- defaultCountry: A,
1254
- multiple: I,
1255
- dropdownMaxHeight: k,
1256
- editorKey: C,
1257
- fontFamily: P,
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: L,
1260
- defaultValue: E,
1542
+ negativeNumberAllow: T,
1543
+ defaultValue: B,
1261
1544
  renderCondition: G,
1262
- optionDependencyKey: H,
1263
- pattern: V
1264
- } = b;
1265
- let B = o == null ? void 0 : o[s];
1266
- B == null && (B = "");
1267
- const K = M || (r === "select" ? `Select ${c}` : `Enter ${c}`), J = "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";
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
- switch (r) {
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
- ia,
1566
+ ha,
1274
1567
  {
1275
- options: g || [],
1276
- value: B,
1568
+ options: r || [],
1569
+ value: A,
1277
1570
  formData: o,
1278
- dependencyKey: H,
1279
- onChange: (D) => l(s, D),
1280
- placeholder: K,
1281
- className: h || "",
1282
- search: v,
1283
- required: x,
1284
- defaultValue: E,
1285
- label: c,
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: m,
1289
- multiple: I,
1290
- dropdownMaxHeight: k
1581
+ parentClass: y,
1582
+ multiple: U,
1583
+ dropdownMaxHeight: L
1291
1584
  }
1292
1585
  );
1293
1586
  case "checkbox":
1294
1587
  return /* @__PURE__ */ e(
1295
- ua,
1588
+ ma,
1296
1589
  {
1297
1590
  name: s,
1298
- label: c,
1299
- options: g || [],
1300
- value: B,
1301
- onChange: (D) => l(s, D),
1302
- required: x,
1303
- parentClass: m,
1304
- className: h || "",
1305
- multiSelect: I,
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
- sa,
1619
+ Ke,
1312
1620
  {
1313
- value: B,
1314
- onChange: (D) => l(s, D),
1315
- text: i,
1316
- options: g || [],
1317
- label: c,
1318
- required: x,
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: m
1629
+ parentClass: y
1322
1630
  }
1323
1631
  );
1324
1632
  case "phone":
1325
1633
  return /* @__PURE__ */ e(
1326
- da,
1634
+ ba,
1327
1635
  {
1328
- value: B,
1329
- onChange: (D) => l(s, D),
1330
- countriesList: N,
1331
- defaultCountry: A,
1332
- required: x,
1333
- placeholder: K,
1334
- search: v,
1335
- label: c,
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: m
1646
+ parentClass: y
1339
1647
  }
1340
1648
  );
1341
1649
  case "textarea":
1342
1650
  return /* @__PURE__ */ e(
1343
- Ge,
1651
+ _e,
1344
1652
  {
1345
- value: B,
1346
- onChange: (D) => l(s, D.target.value),
1347
- placeholder: K,
1348
- rows: O || 3,
1349
- className: `${J} ${h || ""}`,
1350
- required: x,
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: c,
1660
+ label: i,
1353
1661
  disabled: F,
1354
- parentClass: m
1662
+ parentClass: y
1355
1663
  }
1356
1664
  );
1357
1665
  case "image":
1358
1666
  return /* @__PURE__ */ e(
1359
- ca,
1667
+ pa,
1360
1668
  {
1361
- value: B,
1362
- onChange: (D) => l(s, D),
1363
- required: x,
1364
- accept: d || "image/*",
1669
+ value: A,
1670
+ onChange: (I) => t(s, I),
1671
+ required: f,
1672
+ accept: u || "image/*",
1365
1673
  id: `file-${s}`,
1366
- dragDrop: p,
1367
- label: c,
1674
+ dragDrop: N,
1675
+ label: i,
1368
1676
  name: s,
1369
- parentClass: m
1677
+ parentClass: y
1370
1678
  }
1371
1679
  );
1372
1680
  case "audio":
1373
1681
  return /* @__PURE__ */ e(
1374
- ba,
1682
+ fa,
1375
1683
  {
1376
- value: B,
1377
- onChange: (D) => l(s, D),
1378
- required: x,
1379
- accept: d || "audio/*",
1684
+ value: A,
1685
+ onChange: (I) => t(s, I),
1686
+ required: f,
1687
+ accept: u || "audio/*",
1380
1688
  id: `file-${s}`,
1381
- dragDrop: p,
1382
- label: c,
1689
+ dragDrop: N,
1690
+ label: i,
1383
1691
  name: s,
1384
- parentClass: m
1692
+ parentClass: y
1385
1693
  }
1386
1694
  );
1387
1695
  case "tinyEditor":
1388
1696
  return /* @__PURE__ */ e(
1389
- ha,
1697
+ ga,
1390
1698
  {
1391
- value: B,
1392
- onChange: (D) => l(s, D),
1393
- required: x,
1394
- placeholder: K,
1395
- label: c,
1396
- parentClass: m,
1397
- fontFamily: P,
1398
- editorKey: C,
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
- Ke,
1713
+ ze,
1406
1714
  {
1407
- field: b,
1408
- type: r || "text",
1409
- defaultValue: E,
1410
- value: B,
1411
- onChange: (D) => l(s, D.target.value),
1412
- placeholder: K,
1413
- className: `${J} ${h || ""}`,
1414
- required: x,
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: y,
1417
- label: c,
1418
- negativeNumberAllow: L,
1419
- parentClass: m,
1724
+ minLength: g,
1725
+ label: i,
1726
+ negativeNumberAllow: T,
1727
+ parentClass: y,
1420
1728
  disabled: F,
1421
- pattern: V
1729
+ pattern: J
1422
1730
  }
1423
1731
  );
1424
1732
  }
1425
- }, pa = ({ isOpen: b, onClose: o, config: l, onApply: s }) => {
1426
- var h;
1427
- const [c, r] = R({}), g = (v, d) => {
1428
- r((i) => ({ ...i, [v]: d }));
1429
- }, M = () => {
1430
- s == null || s(c), o();
1431
- }, O = () => {
1432
- r({}), s == null || s({}), o();
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__ */ u(j, { children: [
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 ${b ? "opacity-100 pointer-events-auto" : "opacity-0 pointer-events-none"}`,
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__ */ u(
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
- ${b ? "translate-x-0" : "translate-x-full"}
1755
+ ${n ? "translate-x-0" : "translate-x-full"}
1448
1756
  `,
1449
1757
  children: [
1450
- /* @__PURE__ */ u("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-700", children: [
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(Me, { className: "w-5 h-5 text-gray-500 dark:text-gray-400" })
1765
+ children: /* @__PURE__ */ e(Le, { className: "w-5 h-5 text-gray-500 dark:text-gray-400" })
1458
1766
  }
1459
1767
  )
1460
1768
  ] }),
1461
- b && /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto px-4 py-3", children: l != null && l.component ? /* @__PURE__ */ e(
1462
- l.component,
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: c,
1465
- onFilterChange: g
1772
+ filters: i,
1773
+ onFilterChange: r
1466
1774
  }
1467
- ) : /* @__PURE__ */ e("div", { className: "space-y-4", children: (h = l == null ? void 0 : l.fields) == null ? void 0 : h.map((v) => /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e(
1468
- _e,
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: v,
1471
- formData: c,
1472
- handleChange: g
1778
+ field: b,
1779
+ formData: i,
1780
+ handleChange: r
1473
1781
  },
1474
- v.key
1782
+ b.key
1475
1783
  ) })) }) }),
1476
- /* @__PURE__ */ u("div", { className: "flex gap-2 px-4 py-3 border-t border-gray-200 dark:border-gray-700", children: [
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
- Z,
1786
+ Q,
1479
1787
  {
1480
- onClick: M,
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
- Z,
1796
+ Q,
1489
1797
  {
1490
- onClick: O,
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
- }, Be = {
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__ */ u("table", { className: "w-full border-collapse", children: [
1555
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { className: "bg-gray-50 dark:bg-gray-900", children: Array.from({ length: o }).map((l, 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)) }) }),
1556
- /* @__PURE__ */ e("tbody", { children: Array.from({ length: b }).map((l, s) => /* @__PURE__ */ e(
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((c, r) => /* @__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" }) }, r))
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
- ] }), He = ({ src: b, alt: o = "preview", isOpen: l, setIsOpen: s }) => {
1566
- const c = () => s(!1);
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: l,
1825
+ title: t,
1612
1826
  buttonText: s,
1613
- description: c,
1614
- showAddButton: r
1827
+ description: i,
1828
+ showAddButton: d
1615
1829
  }) => {
1616
1830
  const {
1617
- data: g = [],
1618
- table_head: M = [],
1619
- loading: O = !1,
1620
- search: h = {
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: v = {
1839
+ filter: b = {
1626
1840
  enabled: !1,
1627
1841
  useServerSideFilters: !1
1628
1842
  },
1629
- pagination: d = {
1843
+ pagination: u = {
1630
1844
  enabled: !1,
1631
1845
  rows_per_page: 10,
1632
1846
  useServerSidePagination: !1
1633
1847
  },
1634
- emptyMessage: i = "No data available",
1635
- onMenuAction: x,
1636
- setServerSidePaginationData: y = () => {
1848
+ emptyMessage: k = "No data available",
1849
+ onMenuAction: f,
1850
+ setServerSidePaginationData: g = () => {
1637
1851
  },
1638
- onFilterApply: p,
1639
- filterConfig: m = null,
1640
- rowClick: N = null
1641
- } = b, [A, I] = R(""), [k, C] = R(null), [P, F] = R([]), [L, E] = R({}), [G, H] = R(!1), [V, B] = R({}), [K, J] = R(null), [D, ee] = R(!1), w = Ae(() => !h.enabled || !A.trim() || h.useServerSideSearch ? g : oa(g, A, h.searchKeys || []), [g, A, h]), [T, Y] = R(1), [z, q] = R((d == null ? void 0 : d.rows_per_page) || 50), [ce, Ce] = R(w.length || 0), ne = d != null && d.useServerSidePagination ? d.total_pages : Math.ceil(w.length / z), le = Ae(() => {
1642
- if (d.useServerSidePagination) return w;
1643
- const a = (T - 1) * z;
1644
- return w.slice(a, a + z);
1645
- }, [w, T, z]), ae = X(null), oe = X({}), te = X(null), he = (a) => {
1646
- I(a), Y(1), h.useServerSideSearch && (te.current && clearTimeout(te.current), te.current = setTimeout(async () => {
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 y((n) => ({
1649
- ...n,
1862
+ await g((m) => ({
1863
+ ...m,
1650
1864
  search: a,
1651
1865
  current_page: 1
1652
1866
  }));
1653
- } catch (n) {
1654
- console.error("Search error:", n);
1867
+ } catch (m) {
1868
+ console.error("Search error:", m);
1655
1869
  }
1656
1870
  }, 800));
1657
- }, ue = (a, n, f) => {
1658
- f.stopPropagation(), C(null), x == null || x(a.type, n);
1659
- }, be = (a, n, f) => {
1660
- n.stopPropagation(), F(f);
1661
- const S = n.currentTarget;
1662
- oe.current[a] = S;
1663
- const U = S.getBoundingClientRect(), $ = 192, Q = f.length * 40, ke = window.innerWidth, Pe = window.innerHeight, Ve = ke - U.right < $ ? U.left - $ + U.width : U.left, We = Pe - U.bottom < Q && U.top > Q ? U.top - Q - 2 : U.bottom + 2;
1664
- E({
1665
- top: Math.max(8, Math.min(We, Pe - Q - 8)),
1666
- left: Math.max(8, Math.min(Ve, ke - $ - 8))
1667
- }), C(k === a ? null : a);
1668
- }, pe = (a) => (T - 1) * z + a + 1, ge = (a) => {
1669
- a && a.src instanceof File && (a = { ...a, src: URL.createObjectURL(a.src) }), J(a), ee(!0);
1670
- }, ie = (a, n, f, S = null, U = null) => /* @__PURE__ */ e(j, { children: a ? /* @__PURE__ */ e(
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: n || "Avatar",
1675
- onClick: ($) => {
1676
- $.stopPropagation(), $.preventDefault(), ge({ src: a, alt: n });
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 ${f || ""}`
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: S ? typeof S == "function" ? S(U) : S : /* @__PURE__ */ e(
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 ${f || ""}`,
1684
- children: /* @__PURE__ */ e(De, { className: "w-6 h-6 text-gray-400 dark:text-gray-400" })
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
- ) }) }), me = (a, n) => /* @__PURE__ */ e(j, { children: a ? /* @__PURE__ */ e(
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: (f) => {
1692
- f.stopPropagation();
1905
+ onClick: (p) => {
1906
+ p.stopPropagation();
1693
1907
  },
1694
- className: `w-64 cursor-pointer ${n || ""}`
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 ${n || ""}`,
1701
- children: /* @__PURE__ */ e(ta, { className: "w-6 h-6 text-gray-400 dark:text-gray-400" })
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
- ) }) }), fe = (a, n) => /* @__PURE__ */ u("div", { className: `flex items-center space-x-4 ${n.className || ""}`, children: [
1704
- n.imageKey ? ie(
1705
- a[n.imageKey],
1706
- a[n.titleKey],
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
- n.fallback_icon,
1922
+ m.fallback_icon,
1709
1923
  a
1710
1924
  ) : "",
1711
- /* @__PURE__ */ u("div", { children: [
1712
- /* @__PURE__ */ e("p", { className: "font-medium text-gray-900 dark:text-white group-title", children: a[n.titleKey] || "" }),
1713
- /* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400 group-sub-title", children: a[n.subtitleKey] || "" })
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
- ] }), ye = (a, n) => {
1716
- var $;
1717
- let f = String(a);
1718
- const S = n.variant || "contained";
1719
- let U = n.defaultColor;
1720
- if ((($ = n == null ? void 0 : n.chipOptions) == null ? void 0 : $.length) > 0) {
1721
- let Q = n == null ? void 0 : n.chipOptions.find((ke) => ke.value == a);
1722
- Q && (f = Q.label, U = Q.color);
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
- ze,
1939
+ Ve,
1726
1940
  {
1727
- label: f,
1728
- variant: S,
1729
- color: U,
1730
- className: n.className || ""
1941
+ label: p,
1942
+ variant: v,
1943
+ color: R,
1944
+ className: m.className || ""
1731
1945
  }
1732
1946
  );
1733
- }, xe = (a, n, f) => {
1734
- const S = n[a.key];
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: (U) => oe.current[n.id || n._id] = U,
1739
- onClick: (U) => be(n.id || n._id, U, a.menuList),
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(aa, { className: "h-4 w-4" })
1955
+ children: /* @__PURE__ */ e(la, { className: "h-4 w-4" })
1742
1956
  }
1743
- ) }) : a.type === "index" ? /* @__PURE__ */ e("span", { className: a.className || "", children: pe(f) }) : a.type === "group" ? fe(n, a) : a.type === "chip" ? /* @__PURE__ */ e(j, { children: ye(S, a) }) : a.type === "date" ? /* @__PURE__ */ e("span", { className: a.className || "", children: $e(S, a.format || "DD MMM YYYY") }) : a.type === "avatar" ? /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e("div", { className: "min-w-[40px]", children: ie(
1744
- S,
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
- n
1749
- ) }) }) : a.type === "audio" ? /* @__PURE__ */ e(j, { children: me(S, a.className) }) : /* @__PURE__ */ e("span", { className: a.className || "", children: S || "N/A" });
1750
- }, ve = (a) => {
1751
- if (typeof N == "function")
1752
- return N(a);
1753
- if (N)
1754
- return x == null ? void 0 : x("view", a);
1755
- }, we = (a, n) => {
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 x == null ? void 0 : x("view", n);
1971
+ return f == null ? void 0 : f("view", m);
1758
1972
  if (typeof a.handleClick == "function")
1759
- return a.handleClick(n);
1760
- }, se = () => N || typeof N == "function", de = (a) => a.onClickDetails || typeof a.handleClick == "function";
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
- k && C(null);
1977
+ L && O(null);
1764
1978
  };
1765
1979
  return window.addEventListener("scroll", a, !0), () => {
1766
1980
  window.removeEventListener("scroll", a, !0);
1767
1981
  };
1768
- }, [k]), _(() => {
1769
- const a = (n) => {
1770
- ae.current && !ae.current.contains(n.target) && C(null);
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
- d != null && d.rows_per_page && (d != null && d.useServerSidePagination) && q((d == null ? void 0 : d.rows_per_page) || 50), d.current_page && Y(d.current_page);
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
- d.rows_per_page,
1777
- d == null ? void 0 : d.useServerSidePagination,
1778
- d.current_page
1779
- ]), _(() => {
1780
- Ce(
1781
- d != null && d.useServerSidePagination ? d.total_records : w.length
1782
- ), w.length <= z * (T - 1) && !(d != null && d.useServerSidePagination) && Y((a) => a - 1 || 1);
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
- d.total_records,
1786
- d == null ? void 0 : d.useServerSidePagination
1787
- ]), /* @__PURE__ */ u(j, { children: [
1788
- O ? /* @__PURE__ */ e(ga, { rows: 6, columns: 6 }) : /* @__PURE__ */ u(j, { children: [
1789
- /* @__PURE__ */ u("div", { className: "flex flex-col sm:flex-row sm:justify-between gap-4 mb-3", children: [
1790
- /* @__PURE__ */ u("div", { children: [
1791
- /* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: l }),
1792
- /* @__PURE__ */ e("p", { className: "text-md text-gray-600 dark:text-gray-400", children: c })
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__ */ u("div", { className: "flex flex-col justify-end items-end gap-2", children: [
1795
- r && /* @__PURE__ */ u(
1796
- Z,
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(Je, { className: "w-4 h-4 mr-2" }),
2016
+ /* @__PURE__ */ e(aa, { className: "w-4 h-4 mr-2" }),
1803
2017
  s || "Add New"
1804
2018
  ]
1805
2019
  }
1806
2020
  ),
1807
- /* @__PURE__ */ u("div", { className: "flex justify-end items-center gap-2", children: [
1808
- h.enabled && /* @__PURE__ */ e("div", { className: "", children: /* @__PURE__ */ u("div", { className: "relative min-w-[300px]", children: [
1809
- /* @__PURE__ */ e(Te, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-300" }),
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: h.placeholder || "Search...",
1815
- value: A,
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
- m && v.enabled && // add red dot if filter are applied
1822
- /* @__PURE__ */ u("div", { className: "relative", children: [
1823
- /* @__PURE__ */ u(
1824
- Z,
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: () => H(!0),
2040
+ onClick: () => _(!0),
1827
2041
  variant: "contained",
1828
2042
  children: [
1829
- /* @__PURE__ */ e(Qe, { className: "w-4 h-4 mr-2" }),
2043
+ /* @__PURE__ */ e(ra, { className: "w-4 h-4 mr-2" }),
1830
2044
  "Filters"
1831
2045
  ]
1832
2046
  }
1833
2047
  ),
1834
- Object.keys(V).length > 0 && /* @__PURE__ */ e("span", { className: "absolute top-1 right-1 w-2 h-2 bg-red-500 rounded-full" })
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__ */ u("div", { className: "bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden border border-gray-200 dark:border-gray-700", children: [
1840
- /* @__PURE__ */ e("div", { className: "overflow-x-auto", children: /* @__PURE__ */ u("table", { className: "min-w-full divide-y divide-gray-200 dark:divide-gray-700", children: [
1841
- /* @__PURE__ */ e("thead", { className: "bg-gray-50 dark:bg-gray-700/60", children: /* @__PURE__ */ e("tr", { children: M.map((a) => /* @__PURE__ */ e(
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: le.length === 0 ? /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e(
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: M.length,
2066
+ colSpan: x.length,
1853
2067
  className: "text-center py-10 text-gray-500 dark:text-gray-400",
1854
- children: i
2068
+ children: k
1855
2069
  }
1856
- ) }) : le.map((a, n) => /* @__PURE__ */ e(
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: (f) => {
1861
- se() && ve(a);
2074
+ onClick: (p) => {
2075
+ se() && ke(a);
1862
2076
  },
1863
- children: M.map((f) => /* @__PURE__ */ e(
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 ${f.type == "audio" ? "" : "max-w-[300px]"} truncate ${de(f) ? "cursor-pointer" : ""}`,
1867
- title: String(a[f.key] ?? ""),
1868
- onClick: (S) => {
1869
- de(f) && (S.stopPropagation(), S.preventDefault(), we(f, a));
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: f.render ? f.render(a, n) : xe(f, a, n)
2085
+ children: p.render ? p.render(a, m) : ve(p, a, m)
1872
2086
  },
1873
- f.key
2087
+ p.key
1874
2088
  ))
1875
2089
  },
1876
- a.id || a._id || n
2090
+ a.id || a._id || m
1877
2091
  )) })
1878
2092
  ] }) }),
1879
- (d == null ? void 0 : d.enabled) && w.length > 0 && /* @__PURE__ */ u("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: [
1880
- /* @__PURE__ */ u("div", { className: "text-sm text-gray-700 dark:text-gray-300", children: [
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
- (T - 1) * z + 1,
2096
+ (P - 1) * H + 1,
1883
2097
  " to",
1884
2098
  " ",
1885
- Math.min(T * z, ce),
2099
+ Math.min(P * H, ee),
1886
2100
  " of",
1887
2101
  " ",
1888
- ce,
2102
+ ee,
1889
2103
  " results"
1890
2104
  ] }),
1891
- /* @__PURE__ */ u("div", { className: "flex items-center gap-4", children: [
1892
- /* @__PURE__ */ u("div", { className: "flex items-center gap-2", children: [
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: z,
2111
+ value: H,
1898
2112
  onChange: (a) => {
1899
- const n = Number(a.target.value);
1900
- q(n), Y(1), d.useServerSidePagination && y((f) => ({
1901
- ...f,
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: n
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__ */ u("div", { className: "flex items-center gap-2", children: [
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 (T > 1) {
1917
- const a = T - 1;
1918
- Y(a), d.useServerSidePagination && y((n) => ({
1919
- ...n,
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: T === 1,
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(Xe, { className: "h-4 w-4" })
2140
+ children: /* @__PURE__ */ e(ta, { className: "h-4 w-4" })
1927
2141
  }
1928
2142
  ),
1929
- /* @__PURE__ */ u("span", { className: "text-sm text-gray-800 dark:text-gray-200", children: [
2143
+ /* @__PURE__ */ h("span", { className: "text-sm text-gray-800 dark:text-gray-200", children: [
1930
2144
  "Page ",
1931
- T,
2145
+ P,
1932
2146
  " of ",
1933
- ne
2147
+ le
1934
2148
  ] }),
1935
2149
  /* @__PURE__ */ e(
1936
2150
  "button",
1937
2151
  {
1938
2152
  onClick: () => {
1939
- if (T < ne) {
1940
- const a = T + 1;
1941
- Y(a), d.useServerSidePagination && y((n) => ({
1942
- ...n,
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: T === ne,
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(ea, { className: "h-4 w-4" })
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
- k && ra(
2171
+ L && ia(
1958
2172
  /* @__PURE__ */ e(
1959
2173
  "div",
1960
2174
  {
1961
- ref: ae,
2175
+ ref: re,
1962
2176
  style: {
1963
2177
  position: "fixed",
1964
- top: `${L.top}px`,
1965
- left: `${L.left}px`,
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: P.map((a, n) => /* @__PURE__ */ u(
2183
+ children: E.map((a, m) => /* @__PURE__ */ h(
1970
2184
  "button",
1971
2185
  {
1972
- onClick: (f) => ue(
2186
+ onClick: (p) => be(
1973
2187
  a,
1974
- g.find(
1975
- (S) => S.id === k || S._id == k
2188
+ r.find(
2189
+ (v) => v.id === L || v._id == L
1976
2190
  ),
1977
- f
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
- n
2199
+ m
1986
2200
  ))
1987
2201
  }
1988
2202
  ),
1989
2203
  document.body
1990
2204
  ),
1991
- m && /* @__PURE__ */ e(
1992
- pa,
2205
+ y && /* @__PURE__ */ e(
2206
+ xa,
1993
2207
  {
1994
2208
  isOpen: G,
1995
- onClose: () => H(!1),
1996
- config: m,
2209
+ onClose: () => _(!1),
2210
+ config: y,
1997
2211
  onApply: (a) => {
1998
- B(a), p == null || p(a);
2212
+ Z(a), N == null || N(a);
1999
2213
  }
2000
2214
  }
2001
2215
  ),
2002
- D && /* @__PURE__ */ e(
2003
- He,
2216
+ V && /* @__PURE__ */ e(
2217
+ Pe,
2004
2218
  {
2005
- src: K.src,
2006
- alt: K.alt,
2007
- isOpen: D,
2008
- setIsOpen: ee
2219
+ src: A.src,
2220
+ alt: A.alt,
2221
+ isOpen: V,
2222
+ setIsOpen: I
2009
2223
  }
2010
2224
  )
2011
2225
  ] });
2012
- }, Se = ({
2013
- isOpen: b,
2226
+ }, Ce = ({
2227
+ isOpen: n,
2014
2228
  onClose: o,
2015
- icon: l,
2229
+ icon: t,
2016
2230
  title: s,
2017
- children: c,
2018
- size: r = "md",
2019
- actionButtons: g = [],
2020
- actions: M,
2021
- showDefaultClose: O = !0,
2022
- footerConfig: h = null,
2023
- hideFooter: v = !1,
2024
- onFormSubmit: d = () => {
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: i,
2027
- loadingBtn: x = !1,
2028
- executeFunction: y = () => {
2240
+ onCancel: k,
2241
+ loadingBtn: f = !1,
2242
+ executeFunction: g = () => {
2029
2243
  },
2030
- selectedItem: p = null
2244
+ selectedItem: N = null
2031
2245
  }) => {
2032
- if (!b) return null;
2033
- const m = {
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__ */ u("div", { className: "fixed inset-0 z-50 flex items-center justify-center p-4", children: [
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__ */ u(
2262
+ /* @__PURE__ */ h(
2049
2263
  "div",
2050
2264
  {
2051
- className: `relative bg-white rounded-lg shadow-xl w-full ${m[r] || m.md} max-h-[90vh] flex flex-col dark:bg-gray-800`,
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__ */ u("div", { className: "flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0", children: [
2054
- /* @__PURE__ */ u("div", { className: "flex items-center gap-1", children: [
2055
- l && /* @__PURE__ */ e("span", { children: l }),
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(Me, { className: "w-6 h-6" })
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: c }),
2068
- g.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: g.map((N) => /* @__PURE__ */ e(
2069
- Z,
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: (A) => {
2072
- N.type == "submit" ? d(A) : y(
2285
+ onClick: (D) => {
2286
+ M.type == "submit" ? u(D) : g(
2073
2287
  () => {
2074
- var I;
2075
- return (I = N == null ? void 0 : N.onClick) == null ? void 0 : I.call(N, A, p);
2288
+ var U;
2289
+ return (U = M == null ? void 0 : M.onClick) == null ? void 0 : U.call(M, D, N);
2076
2290
  },
2077
- (I) => o == null ? void 0 : o(I)
2291
+ (U) => o == null ? void 0 : o(U)
2078
2292
  );
2079
2293
  },
2080
- disabled: x || N.disabled,
2081
- variant: N.variant || "contained",
2082
- color: N.color || "primary",
2083
- className: `min-w-[100px] ${N.className}`,
2084
- type: N.type || "button",
2085
- children: x ? /* @__PURE__ */ u("div", { className: "flex items-center", 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
- N.label || "Submit",
2301
+ M.label || "Submit",
2088
2302
  "..."
2089
- ] }) : N.label || "Submit"
2303
+ ] }) : M.label || "Submit"
2090
2304
  }
2091
2305
  )) })
2092
2306
  ]
2093
2307
  }
2094
2308
  )
2095
2309
  ] });
2096
- }, je = ({ config: b, onSubmit: o, initialData: l = {}, type: s = "add" }) => {
2097
- const { formClass: c = "grid grid-cols-12 gap-4", formFields: r = [] } = b || {}, [g, M] = R(l);
2098
- _(() => {
2099
- M(l);
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 O = (v, d) => {
2102
- M((i) => ({ ...i, [v]: d }));
2103
- }, h = (v) => {
2104
- v.preventDefault();
2105
- const d = v.target;
2106
- if (!d.checkValidity()) {
2107
- d.reportValidity();
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(g);
2338
+ o(x);
2111
2339
  };
2112
- return /* @__PURE__ */ e(
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: s == "add" ? "addForm" : s == "edit" ? "editForm" : "defaultForm",
2116
- onSubmit: h,
2117
- className: c,
2354
+ id: i == "add" ? "addForm" : i == "edit" ? "editForm" : "defaultForm",
2355
+ onSubmit: f,
2356
+ className: d,
2118
2357
  noValidate: !1,
2119
- children: r.map((v) => /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e(
2120
- _e,
2358
+ children: r.map((g) => /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e(
2359
+ qe,
2121
2360
  {
2122
- field: v,
2123
- formData: g,
2124
- handleChange: O
2361
+ field: g,
2362
+ formData: x,
2363
+ handleChange: k
2125
2364
  },
2126
- v.key
2365
+ g.key
2127
2366
  ) }))
2128
2367
  }
2129
2368
  );
2130
2369
  };
2131
- function fa({ data: b, config: o }) {
2132
- const { fields: l, containerClass: s } = o, [c, r] = R(null), [g, M] = R(!1), O = (i) => {
2133
- i && i.src instanceof File && (i = { ...i, src: URL.createObjectURL(i.src) }), r(i), M(!0);
2134
- }, h = ({ col: i }) => {
2135
- var I;
2136
- let x = i == null ? void 0 : i.icon, y = i.label, p = b[i.key], m = i.type, N = i.variant || "outline", A = i.defaultColor;
2137
- if (m === "chip" && ((I = i.chipOptions) == null ? void 0 : I.length) > 0) {
2138
- let k = i == null ? void 0 : i.chipOptions.find((C) => C.value == p);
2139
- k && (p = k.label, A = k.color);
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 /* @__PURE__ */ u(j, { children: [
2244
- g && /* @__PURE__ */ e(
2245
- He,
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
- src: c.src,
2248
- alt: c.alt,
2249
- isOpen: g,
2250
- setIsOpen: M
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
- /* @__PURE__ */ e("div", { className: `grid grid-cols-12 gap-4 ${s || ""}`, children: l.map((i) => i.renderCondition && typeof i.renderCondition == "function" && !i.renderCondition(b) ? null : i.type == "group" ? /* @__PURE__ */ e(v, { col: i }) : i.type == "cardGroup" ? /* @__PURE__ */ e(d, { col: i }) : /* @__PURE__ */ e(h, { col: i })) })
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 Ye = ({ config: b }) => {
2257
- var le, ae, oe, te, he, ue, be, pe, ge, ie, me, fe, ye, xe, ve, we, se, de, a;
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: l = async () => {
2399
+ fetchData: t = async () => {
2261
2400
  },
2262
- isStaticData: s = !1,
2263
- tableConfig: c = {},
2401
+ fetchRowDetails: s = null,
2402
+ isStaticData: i = !1,
2403
+ tableConfig: d = {},
2264
2404
  modalConfig: r = {},
2265
- filterConfig: g
2266
- } = b, [M, O] = R(!0), [h, v] = R(!1), [d, i] = R([]), [x, y] = R(null), [p, m] = R({
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
- }), [N, A] = R({}), [I, k] = R(!1), [C, P] = R(!1), [F, L] = R(!1), [E, G] = R(!1), [H, V] = R(!1), [B, K] = R(null), J = (n, f) => {
2271
- n === "edit" ? (K(f), L(!0)) : n === "view" ? (K(f), V(!0)) : n === "delete" && (K(f), G(!0));
2272
- }, D = async (n, f, S = "", U = "") => {
2273
- v(!0);
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 (n == null ? void 0 : n());
2276
- (S || $.message) && Re(S || $.message, {
2415
+ const $ = await (p == null ? void 0 : p());
2416
+ (R || $.message) && ce(R || $.message, {
2277
2417
  variant: "success"
2278
- }), f == null || f($);
2418
+ }), v == null || v($);
2279
2419
  } catch ($) {
2280
- (U || $.message) && Re(U || $.message, { variant: "error" });
2420
+ (Y || $.message) && ce(Y || $.message, { variant: "error" });
2281
2421
  } finally {
2282
- v(!1);
2422
+ u(!1);
2283
2423
  }
2284
- }, ee = (n) => {
2285
- let f = n.newObject;
2286
- s ? (i((S) => [f, ...S]), y((S) => ({
2287
- ...S,
2424
+ }, w = (p) => {
2425
+ let v = p.newObject;
2426
+ i ? (f((R) => [v, ...R]), N((R) => ({
2427
+ ...R,
2288
2428
  current_page: 1
2289
- }))) : (m((S) => ({
2290
- ...S,
2429
+ }))) : (M((R) => ({
2430
+ ...R,
2291
2431
  current_page: 1
2292
- })), p.current_page == 1 && q()), P(!1);
2293
- }, w = (n) => {
2294
- let f = n.newObject, S = n.targetObject;
2295
- s ? i(
2296
- (U) => U.map(
2297
- ($) => $.id === S.id ? { ...$, ...f } : $
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
- ) : q(), L(!1);
2300
- }, T = (n) => {
2301
- if (!n) {
2302
- G(!1), K(null);
2439
+ ) : ee(), B(!1);
2440
+ }, W = (p) => {
2441
+ if (!p) {
2442
+ _(!1), z(null);
2303
2443
  return;
2304
2444
  }
2305
- s ? i(
2306
- (f) => f.filter((S) => S.id !== n.targetObject.id)
2307
- ) : d.length == 1 && p.current_page > 1 ? m((f) => ({
2308
- ...f,
2309
- current_page: f.current_page - 1
2310
- })) : q(), G(!1), K(null);
2311
- }, Y = (n) => D(
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 f, S;
2314
- return (S = (f = r == null ? void 0 : r.addModal) == null ? void 0 : f.handleSubmit) == null ? void 0 : S.call(f, n);
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
- ee
2317
- ), z = (n) => D(
2456
+ w
2457
+ ), ae = (p) => I(
2318
2458
  () => {
2319
- var f, S;
2320
- return (S = (f = r == null ? void 0 : r.editModal) == null ? void 0 : f.handleSubmit) == null ? void 0 : S.call(f, n, B);
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
- w
2323
- ), q = async () => {
2324
- O(!0), l == null || l({ ...p, ...N }).then((n) => {
2325
- i(n.data), y(n.pagination);
2326
- }).catch((n) => {
2327
- Re(n.message, { variant: "error" });
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
- O(!1);
2469
+ c(!1);
2330
2470
  });
2331
- }, ce = (n) => {
2332
- var f;
2333
- A((S) => ({
2334
- ...n
2335
- })), (f = c == null ? void 0 : c.filter) != null && f.useServerSideFilters && k((S) => !S);
2336
- }, Ce = (n, f) => n.filter(
2337
- (S) => Object.entries(f).every(([U, $]) => S[U] === $)
2338
- ), ne = Ae(() => {
2339
- var n;
2340
- return (n = c == null ? void 0 : c.filter) != null && n.useServerSideFilters ? d : Ce(d, N);
2341
- }, [d, N]);
2342
- return _(() => {
2343
- q();
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
- p.search,
2346
- p.rows_per_page,
2347
- p.current_page,
2348
- I
2349
- ]), /* @__PURE__ */ e(
2350
- la,
2351
- {
2352
- maxSnack: 3,
2353
- anchorOrigin: {
2354
- vertical: "bottom",
2355
- horizontal: "right"
2356
- },
2357
- autoHideDuration: 3e3,
2358
- action: (n) => /* @__PURE__ */ e(
2359
- "button",
2360
- {
2361
- onClick: () => {
2362
- window.dispatchEvent(
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
- className: "p-1 hover:bg-white/20 rounded-full transition-colors duration-200 text-white flex items-center justify-center",
2367
- children: /* @__PURE__ */ e(Me, { className: "h-4 w-4" })
2504
+ data: ue,
2505
+ setServerSidePaginationData: M,
2506
+ onMenuAction: V,
2507
+ filterConfig: x,
2508
+ onFilterApply: Re,
2509
+ loading: S
2368
2510
  }
2369
- ),
2370
- children: /* @__PURE__ */ u("div", { children: [
2371
- /* @__PURE__ */ e(
2372
- ma,
2373
- {
2374
- title: o,
2375
- setShowAdd: P,
2376
- description: b.description,
2377
- buttonText: b.buttonText,
2378
- showAddButton: !!r.addModal,
2379
- config: {
2380
- ...c,
2381
- pagination: {
2382
- ...c.pagination,
2383
- ...x
2384
- },
2385
- data: ne,
2386
- setServerSidePaginationData: m,
2387
- onMenuAction: J,
2388
- filterConfig: g,
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
- isOpen: F,
2426
- onClose: () => {
2427
- h || L(!1);
2428
- },
2429
- icon: (he = r.editModal) == null ? void 0 : he.icon,
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
- E && /* @__PURE__ */ e(
2451
- Se,
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
- isOpen: E,
2454
- onClose: (n) => {
2455
- T(n);
2456
- },
2457
- icon: ((ge = r.deleteModal) == null ? void 0 : ge.icon) || /* @__PURE__ */ e(re, { icon: "ph:warning-bold", className: "w-6 h-6 text-red-500" }),
2458
- title: ((ie = r.deleteModal) == null ? void 0 : ie.title) || "Confirm Delete",
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
- r.viewModal && /* @__PURE__ */ e(
2471
- Se,
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
- isOpen: H,
2474
- onClose: () => {
2475
- V(!1), K(null);
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
- }, Ie = t.shape({
2494
- value: t.oneOfType([
2495
- t.string,
2496
- t.number,
2497
- t.bool
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: t.string.isRequired,
2500
- color: t.string
2501
- }), Le = t.shape({
2502
- type: t.string.isRequired,
2503
- label: t.string.isRequired,
2504
- color: t.string,
2505
- variant: t.string,
2506
- onClick: t.func
2507
- }), ya = t.shape({
2508
- title: t.string.isRequired,
2509
- type: t.string.isRequired,
2510
- variant: t.string,
2511
- icon: t.node
2512
- }), xa = t.shape({
2513
- key: t.string.isRequired,
2514
- title: t.string,
2515
- type: t.string,
2516
- imageKey: t.string,
2517
- titleKey: t.string,
2518
- subtitleKey: t.string,
2519
- onClickDetails: t.bool,
2520
- variant: t.string,
2521
- chipOptions: t.arrayOf(Ie),
2522
- defaultColor: t.string,
2523
- className: t.string,
2524
- format: t.string,
2525
- menuList: t.arrayOf(ya)
2526
- }), Oe = t.shape({
2527
- key: t.string.isRequired,
2528
- label: t.string,
2529
- type: t.string.isRequired,
2530
- required: t.bool,
2531
- minLength: t.number,
2532
- parentClass: t.string,
2533
- search: t.bool,
2534
- multiple: t.bool,
2535
- dropdownMaxHeight: t.string,
2536
- dragDrop: t.bool,
2537
- countriesList: t.bool,
2538
- defaultCountry: t.string,
2539
- placeholder: t.string,
2540
- rows: t.number,
2541
- text: t.string,
2542
- editorKey: t.string,
2543
- options: t.arrayOf(Ie)
2544
- }), va = t.shape({
2545
- key: t.string,
2546
- label: t.string,
2547
- type: t.string,
2548
- imageKey: t.string,
2549
- titleKey: t.string,
2550
- subtitleKey: t.string,
2551
- blockClass: t.string,
2552
- icon: t.node,
2553
- variant: t.string,
2554
- chipOptions: t.arrayOf(Ie),
2555
- defaultColor: t.string,
2556
- className: t.string,
2557
- format: t.string
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
- Ye.propTypes = {
2560
- config: t.shape({
2561
- title: t.string.isRequired,
2562
- description: t.string,
2563
- buttonText: t.string,
2564
- fetchData: t.func.isRequired,
2565
- isStaticData: t.bool,
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: t.shape({
2568
- table_head: t.arrayOf(xa).isRequired,
2569
- search: t.shape({
2570
- enabled: t.bool,
2571
- useServerSideSearch: t.bool,
2572
- searchKeys: t.arrayOf(t.string)
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: t.shape({
2575
- enabled: t.bool,
2576
- useServerSidePagination: t.bool
2693
+ pagination: l.shape({
2694
+ enabled: l.bool,
2695
+ useServerSidePagination: l.bool
2577
2696
  }),
2578
- filter: t.shape({
2579
- enabled: t.bool,
2580
- useServerSideFilters: t.bool
2697
+ filter: l.shape({
2698
+ enabled: l.bool,
2699
+ useServerSideFilters: l.bool
2581
2700
  })
2582
2701
  }).isRequired,
2583
2702
  /* ================= MODAL CONFIG ================= */
2584
- modalConfig: t.shape({
2585
- addModal: t.shape({
2586
- title: t.string.isRequired,
2587
- size: t.string,
2588
- formClass: t.string,
2589
- formFields: t.arrayOf(Oe),
2590
- handleSubmit: t.func.isRequired,
2591
- actionButtons: t.arrayOf(Le)
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: t.shape({
2594
- title: t.string.isRequired,
2595
- size: t.string,
2596
- formClass: t.string,
2597
- formFields: t.arrayOf(Oe),
2598
- handleSubmit: t.func.isRequired,
2599
- actionButtons: t.arrayOf(Le)
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: t.shape({
2602
- title: t.string.isRequired,
2603
- size: t.string,
2604
- confirmText: t.string,
2605
- referenceKey: t.string,
2606
- actionButtons: t.arrayOf(Le)
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: t.shape({
2609
- title: t.string.isRequired,
2610
- size: t.string,
2727
+ viewModal: l.shape({
2728
+ title: l.string.isRequired,
2729
+ size: l.string,
2611
2730
  // 👇 This covers your commented code:
2612
- component: t.elementType,
2731
+ component: l.elementType,
2613
2732
  // for custom component like TeamMemberDetail
2614
- fields: t.arrayOf(va),
2615
- footer: t.shape({
2616
- cancelButton: t.bool,
2617
- cancelText: t.string
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: t.shape({
2623
- fields: t.arrayOf(Oe)
2741
+ filterConfig: l.shape({
2742
+ fields: l.arrayOf(Te)
2624
2743
  })
2625
2744
  }).isRequired
2626
2745
  };
2627
- const wa = () => {
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 b = document.createElement("style");
2630
- b.id = "react-admin-crud-manager-styles";
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 Fa(b) {
2650
- return _(() => {
2651
- wa();
2652
- }, []), /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e(Ye, { config: b.config }) });
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
- Fa as default
2805
+ Ea as default
2656
2806
  };
2657
2807
  //# sourceMappingURL=index.es.js.map