react-admin-crud-manager 1.0.20 → 1.0.21

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,14 +1,14 @@
1
- import { jsx as e, Fragment as E, jsxs as d } from "react/jsx-runtime";
2
- import Ce, { useState as S, useRef as ae, useEffect as H, useMemo as Me } from "react";
1
+ import { jsx as e, Fragment as E, jsxs as c } from "react/jsx-runtime";
2
+ import Ce, { useState as M, useRef as ae, useEffect as z, useMemo as Me } from "react";
3
3
  import { ChevronDown as Te, Search as Re, Check as Ke, X as we, Plus as ze, Filter as He, ChevronLeft as Ye, ChevronRight as Ve, EllipsisVertical as We, User as Fe, Music as qe } from "lucide-react";
4
4
  import { createPortal as Ze } from "react-dom";
5
5
  import { Icon as te } from "@iconify/react";
6
6
  import { Editor as Je } from "@tinymce/tinymce-react";
7
7
  import { SnackbarProvider as Qe, enqueueSnackbar as ke } from "notistack";
8
8
  import a from "prop-types";
9
- const Pe = (h, n = "DD MMM YYYY") => {
10
- if (!h) return "N/A";
11
- const i = new Date(h);
9
+ const Pe = (u, l = "DD MMM YYYY") => {
10
+ if (!u) return "N/A";
11
+ const i = new Date(u);
12
12
  if (isNaN(i)) return "Invalid Date";
13
13
  const o = (t) => String(t).padStart(2, "0"), s = {
14
14
  YYYY: i.getFullYear(),
@@ -27,14 +27,14 @@ const Pe = (h, n = "DD MMM YYYY") => {
27
27
  ss: o(i.getSeconds()),
28
28
  A: i.getHours() >= 12 ? "PM" : "AM"
29
29
  };
30
- return n.replace(
30
+ return l.replace(
31
31
  /YYYY|YY|MMMM|MMM|MM|M|DD|D|dddd|ddd|HH|hh|mm|ss|A/g,
32
32
  (t) => s[t]
33
33
  );
34
- }, Xe = (h, n, i = []) => {
35
- if (!(n != null && n.trim())) return h;
36
- const o = n.toLowerCase(), s = (t) => t == null ? [] : typeof t == "object" ? Object.values(t).flatMap(s) : [String(t)];
37
- return h.filter((t) => {
34
+ }, Xe = (u, l, i = []) => {
35
+ if (!(l != null && l.trim())) return u;
36
+ const o = l.toLowerCase(), s = (t) => t == null ? [] : typeof t == "object" ? Object.values(t).flatMap(s) : [String(t)];
37
+ return u.filter((t) => {
38
38
  let p = [];
39
39
  return i.length > 0 ? i.forEach((k) => {
40
40
  t[k] !== void 0 && p.push(...s(t[k]));
@@ -44,22 +44,22 @@ const Pe = (h, n = "DD MMM YYYY") => {
44
44
  });
45
45
  }, ee = Ce.forwardRef(
46
46
  ({
47
- className: h = "",
48
- variant: n = "contained",
47
+ className: u = "",
48
+ variant: l = "contained",
49
49
  color: i = "default",
50
50
  size: o = "default",
51
51
  fullWidth: s = !1,
52
52
  children: t,
53
53
  ...p
54
54
  }, k) => {
55
- var b;
56
- const M = "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-400 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", u = {
55
+ var d;
56
+ const w = "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", b = {
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
- }, l = {
62
+ }, n = {
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,19 +80,19 @@ const Pe = (h, n = "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
- }, c = ((b = l[i]) == null ? void 0 : b[n]) || l.default.contained, g = u[o], y = `
84
- ${M}
85
- ${c}
83
+ }, h = ((d = n[i]) == null ? void 0 : d[l]) || n.default.contained, g = b[o], x = `
84
+ ${w}
85
+ ${h}
86
86
  ${g}
87
87
  ${s ? "w-full" : ""}
88
- ${h}
88
+ ${u}
89
89
  `.trim();
90
90
  return /* @__PURE__ */ e(
91
91
  "button",
92
92
  {
93
93
  ref: k,
94
94
  type: p.type || "button",
95
- className: y,
95
+ className: x,
96
96
  ...p,
97
97
  children: t
98
98
  }
@@ -100,101 +100,101 @@ const Pe = (h, n = "DD MMM YYYY") => {
100
100
  }
101
101
  );
102
102
  ee.displayName = "Button";
103
- function Q({ label: h, required: n = !1 }) {
104
- return /* @__PURE__ */ e(E, { children: /* @__PURE__ */ d("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: [
105
- h,
106
- n && /* @__PURE__ */ e("span", { className: "ml-1", children: "*" })
103
+ function Q({ label: u, required: l = !1 }) {
104
+ return /* @__PURE__ */ e(E, { children: /* @__PURE__ */ c("label", { className: "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1", children: [
105
+ u,
106
+ l && /* @__PURE__ */ e("span", { className: "ml-1", children: "*" })
107
107
  ] }) });
108
108
  }
109
109
  const ea = ({
110
- options: h = [],
111
- value: n = "",
110
+ options: u = [],
111
+ value: l = "",
112
112
  defaultValue: i = "",
113
113
  onChange: o,
114
114
  placeholder: s = "Select option",
115
115
  className: t = "",
116
116
  disabled: p = !1,
117
117
  search: k = !1,
118
- label: M = "",
119
- required: u = !1,
120
- name: l = "",
121
- parentClass: c = "",
118
+ label: w = "",
119
+ required: b = !1,
120
+ name: n = "",
121
+ parentClass: h = "",
122
122
  multiple: g = !1,
123
123
  // ✅ NEW
124
- dropdownMaxHeight: y = "",
125
- formData: b = {},
124
+ dropdownMaxHeight: x = "",
125
+ formData: d = {},
126
126
  dependencyKey: v = ""
127
127
  }) => {
128
128
  var q;
129
- const [x, N] = S(!1), [I, D] = S(""), [C, A] = S(!0), B = ae(null), F = ae(null), [R, j] = S([]);
130
- let $ = n || n === !1 ? n : i;
131
- const W = (w) => w == null || w === "" ? "" : String(typeof w == "boolean" ? w : w ?? "");
132
- H(
129
+ const [y, S] = M(!1), [I, D] = M(""), [C, A] = M(!0), B = ae(null), F = ae(null), [R, U] = M([]);
130
+ let $ = l || l === !1 ? l : i;
131
+ const W = (N) => N == null || N === "" ? "" : String(typeof N == "boolean" ? N : N ?? "");
132
+ z(
133
133
  () => {
134
134
  (async () => {
135
- if (typeof h == "function") {
136
- const z = await h(b);
137
- j(z);
135
+ if (typeof u == "function") {
136
+ const H = await u(d);
137
+ U(H);
138
138
  } else
139
- j(h || []);
139
+ U(u || []);
140
140
  })();
141
141
  },
142
- v ? [h, b == null ? void 0 : b[v]] : [h]
142
+ v ? [u, d == null ? void 0 : d[v]] : [u]
143
143
  );
144
144
  const G = g ? ($ || []).map(W) : W($), K = R.filter(
145
- (w) => w.label.toLowerCase().includes(I.toLowerCase())
146
- ), U = (w) => {
147
- const z = W(w);
148
- return g ? G.includes(z) : z === G;
145
+ (N) => N.label.toLowerCase().includes(I.toLowerCase())
146
+ ), j = (N) => {
147
+ const H = W(N);
148
+ return g ? G.includes(H) : H === G;
149
149
  };
150
- H(() => {
151
- const w = (z) => {
152
- B.current && !B.current.contains(z.target) && (N(!1), D(""));
150
+ z(() => {
151
+ const N = (H) => {
152
+ B.current && !B.current.contains(H.target) && (S(!1), D(""));
153
153
  };
154
- return document.addEventListener("mousedown", w), () => document.removeEventListener("mousedown", w);
155
- }, []), H(() => {
156
- if (x && B.current) {
157
- const w = B.current.getBoundingClientRect(), re = window.innerHeight - w.bottom;
154
+ return document.addEventListener("mousedown", N), () => document.removeEventListener("mousedown", N);
155
+ }, []), z(() => {
156
+ if (y && B.current) {
157
+ const N = B.current.getBoundingClientRect(), re = window.innerHeight - N.bottom;
158
158
  A(re < 200);
159
159
  }
160
- }, [x]), H(() => {
161
- x && F.current && F.current.focus();
162
- }, [x]);
163
- const O = (w) => {
164
- let z = w;
165
- if (w === "true" ? z = !0 : w === "false" && (z = !1), g) {
166
- const re = G.includes(W(w));
160
+ }, [y]), z(() => {
161
+ y && F.current && F.current.focus();
162
+ }, [y]);
163
+ const O = (N) => {
164
+ let H = N;
165
+ if (N === "true" ? H = !0 : N === "false" && (H = !1), g) {
166
+ const re = G.includes(W(N));
167
167
  let J;
168
- re ? J = n.filter(
169
- (X) => W(X) !== W(w)
170
- ) : J = [...n || [], z], o(J);
168
+ re ? J = l.filter(
169
+ (X) => W(X) !== W(N)
170
+ ) : J = [...l || [], H], o(J);
171
171
  } else
172
- o(z), N(!1);
172
+ o(H), S(!1);
173
173
  D("");
174
- }, Y = g ? R.filter((w) => U(w.value)).map((w) => w.label).join(", ") : (q = R.find((w) => U(w.value))) == null ? void 0 : q.label;
175
- return H(() => {
174
+ }, Y = g ? R.filter((N) => j(N.value)).map((N) => N.label).join(", ") : (q = R.find((N) => j(N.value))) == null ? void 0 : q.label;
175
+ return z(() => {
176
176
  ($ || $ === !1) && setTimeout(() => {
177
177
  o($);
178
178
  }, 100);
179
- }, []), /* @__PURE__ */ d("div", { className: c || "col-span-12", children: [
180
- /* @__PURE__ */ e(Q, { label: M, required: u }),
181
- /* @__PURE__ */ d("div", { className: `relative ${t}`, ref: B, children: [
179
+ }, []), /* @__PURE__ */ c("div", { className: h || "col-span-12", children: [
180
+ /* @__PURE__ */ e(Q, { label: w, required: b }),
181
+ /* @__PURE__ */ c("div", { className: `relative ${t}`, ref: B, children: [
182
182
  /* @__PURE__ */ e(
183
183
  "select",
184
184
  {
185
185
  name: "hidden_select_for_validation",
186
186
  value: Y || "",
187
- required: u,
187
+ required: b,
188
188
  multiple: g,
189
189
  className: "absolute opacity-0 right-1/2 top-[80%] -translate-x-1/2 -translate-y-1/2 pointer-events-none h-[10px]",
190
190
  children: /* @__PURE__ */ e("option", { hidden: !0, value: Y, children: Y })
191
191
  }
192
192
  ),
193
- /* @__PURE__ */ d(
193
+ /* @__PURE__ */ c(
194
194
  "button",
195
195
  {
196
196
  type: "button",
197
- onClick: () => !p && N(!x),
197
+ onClick: () => !p && S(!y),
198
198
  disabled: p,
199
199
  className: `w-full h-10 px-3 border border-gray-300 dark:border-gray-600 rounded-md text-left text-sm flex items-center justify-between
200
200
  ${Y ? "dark:text-white" : "text-gray-500 dark:text-gray-400"}
@@ -204,19 +204,19 @@ const ea = ({
204
204
  /* @__PURE__ */ e(
205
205
  Te,
206
206
  {
207
- className: `w-4 h-4 transition-transform ${x ? "rotate-180" : ""}`
207
+ className: `w-4 h-4 transition-transform ${y ? "rotate-180" : ""}`
208
208
  }
209
209
  )
210
210
  ]
211
211
  }
212
212
  ),
213
- x && /* @__PURE__ */ d(
213
+ y && /* @__PURE__ */ c(
214
214
  "div",
215
215
  {
216
216
  className: `absolute z-50 w-full border rounded-md bg-white dark:bg-gray-700 shadow-lg
217
217
  ${C ? "bottom-full mb-1" : "top-full mt-1"}`,
218
218
  children: [
219
- k && /* @__PURE__ */ e("div", { className: "p-2 border-b border-gray-200 dark:border-gray-600", children: /* @__PURE__ */ d("div", { className: "relative", children: [
219
+ k && /* @__PURE__ */ e("div", { className: "p-2 border-b border-gray-200 dark:border-gray-600", children: /* @__PURE__ */ c("div", { className: "relative", children: [
220
220
  /* @__PURE__ */ e(Re, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400" }),
221
221
  /* @__PURE__ */ e(
222
222
  "input",
@@ -224,7 +224,7 @@ const ea = ({
224
224
  ref: F,
225
225
  type: "text",
226
226
  value: I,
227
- onChange: (w) => D(w.target.value),
227
+ onChange: (N) => D(N.target.value),
228
228
  placeholder: "Search...",
229
229
  className: "w-full pl-9 pr-3 py-2 text-sm border rounded-md bg-white dark:bg-gray-800 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none"
230
230
  }
@@ -235,21 +235,21 @@ const ea = ({
235
235
  {
236
236
  className: "max-h-40 overflow-y-auto",
237
237
  style: {
238
- maxHeight: y || ""
238
+ maxHeight: x || ""
239
239
  },
240
- children: K.length > 0 ? K.map((w) => /* @__PURE__ */ d(
240
+ children: K.length > 0 ? K.map((N) => /* @__PURE__ */ c(
241
241
  "button",
242
242
  {
243
243
  type: "button",
244
- onClick: () => O(String(w.value)),
244
+ onClick: () => O(String(N.value)),
245
245
  className: `w-full px-3 py-2 text-left text-sm flex items-center justify-between hover:bg-gray-100 dark:hover:bg-gray-600
246
- ${U(w.value) ? "bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300" : ""}`,
246
+ ${j(N.value) ? "bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300" : ""}`,
247
247
  children: [
248
- /* @__PURE__ */ e("span", { children: w.label }),
249
- g && U(w.value) && /* @__PURE__ */ e(Ke, { className: "w-4 h-4" })
248
+ /* @__PURE__ */ e("span", { children: N.label }),
249
+ g && j(N.value) && /* @__PURE__ */ e(Ke, { className: "w-4 h-4" })
250
250
  ]
251
251
  },
252
- String(w.value)
252
+ String(N.value)
253
253
  )) : /* @__PURE__ */ e("div", { className: "px-3 py-2 text-sm text-gray-500 dark:text-gray-400", children: "No options found" })
254
254
  }
255
255
  )
@@ -257,27 +257,27 @@ const ea = ({
257
257
  }
258
258
  )
259
259
  ] })
260
- ] }, l);
260
+ ] }, n);
261
261
  }, aa = ({
262
- value: h = !0,
263
- onChange: n,
262
+ value: u = !0,
263
+ onChange: l,
264
264
  text: i,
265
265
  options: o = [],
266
266
  label: s,
267
267
  required: t,
268
268
  name: p = "",
269
269
  disabled: k = !1,
270
- parentClass: M = ""
270
+ parentClass: w = ""
271
271
  }) => {
272
- const u = o.length > 0 ? o : [
272
+ const b = o.length > 0 ? o : [
273
273
  { label: "Active", value: !0 },
274
274
  { label: "Inactive", value: !1 }
275
275
  ];
276
- return /* @__PURE__ */ e(E, { children: /* @__PURE__ */ d("div", { className: M || "col-span-12", children: [
276
+ return /* @__PURE__ */ e(E, { children: /* @__PURE__ */ c("div", { className: w || "col-span-12", children: [
277
277
  /* @__PURE__ */ e(Q, { label: s, required: t }),
278
- /* @__PURE__ */ d("div", { className: "flex items-center justify-between h-10 gap-4 bg-gray-100 dark:bg-gray-700 px-3 rounded-md border border-gray-100 dark:border-gray-600", children: [
278
+ /* @__PURE__ */ c("div", { className: "flex items-center justify-between h-10 gap-4 bg-gray-100 dark:bg-gray-700 px-3 rounded-md border border-gray-100 dark:border-gray-600", children: [
279
279
  i && /* @__PURE__ */ e("p", { className: "text-xs text-gray-600 dark:text-gray-400 flex-shrink overflow-hidden text-ellipsis whitespace-nowrap max-w-[200px]", children: i }),
280
- /* @__PURE__ */ e("div", { className: "flex items-center gap-6", children: u.map((l, c) => /* @__PURE__ */ d(
280
+ /* @__PURE__ */ e("div", { className: "flex items-center gap-6", children: b.map((n, h) => /* @__PURE__ */ c(
281
281
  "label",
282
282
  {
283
283
  className: "flex items-center gap-2 cursor-pointer select-none",
@@ -287,18 +287,18 @@ const ea = ({
287
287
  {
288
288
  type: "radio",
289
289
  name: "switch-field",
290
- required: t && c === 0,
291
- value: l.value,
290
+ required: t && h === 0,
291
+ value: n.value,
292
292
  disabled: k,
293
- checked: h === l.value,
294
- onChange: () => n(l.value),
293
+ checked: u === n.value,
294
+ onChange: () => l(n.value),
295
295
  className: "w-4 h-4 border-gray-300 cursor-pointer"
296
296
  }
297
297
  ),
298
- /* @__PURE__ */ e("span", { className: "text-sm text-gray-700 dark:text-white", children: l.label })
298
+ /* @__PURE__ */ e("span", { className: "text-sm text-gray-700 dark:text-white", children: n.label })
299
299
  ]
300
300
  },
301
- c
301
+ h
302
302
  )) })
303
303
  ] })
304
304
  ] }, p) });
@@ -555,62 +555,62 @@ const ea = ({
555
555
  { label: "Zimbabwe", code: "ZW", phone: "263" }
556
556
  ];
557
557
  function ra({
558
- label: h = "",
559
- value: n = "",
558
+ label: u = "",
559
+ value: l = "",
560
560
  name: i = "",
561
561
  parentClass: o = "",
562
562
  onChange: s,
563
563
  disabled: t = !1,
564
564
  required: p = !1,
565
565
  placeholder: k = "Phone number",
566
- search: M = !1,
567
- countriesList: u = !1,
568
- defaultCountry: l = ""
566
+ search: w = !1,
567
+ countriesList: b = !1,
568
+ defaultCountry: n = ""
569
569
  }) {
570
- const c = (R) => xe.find((j) => j.code == R), [g, y] = S(
571
- c(l) || xe[0]
572
- ), [b, v] = S(""), [x, N] = S(!1), [I, D] = S(""), C = ae();
573
- H(() => {
574
- if (typeof n == "string" && n.startsWith("+")) {
575
- const R = xe.filter((j) => n.startsWith("+" + j.phone)).sort((j, $) => $.phone.length - j.phone.length)[0];
570
+ const h = (R) => xe.find((U) => U.code == R), [g, x] = M(
571
+ h(n) || xe[0]
572
+ ), [d, v] = M(""), [y, S] = M(!1), [I, D] = M(""), C = ae();
573
+ z(() => {
574
+ if (typeof l == "string" && l.startsWith("+")) {
575
+ const R = xe.filter((U) => l.startsWith("+" + U.phone)).sort((U, $) => $.phone.length - U.phone.length)[0];
576
576
  if (R) {
577
- y(R), v(n.replace("+" + R.phone, ""));
577
+ x(R), v(l.replace("+" + R.phone, ""));
578
578
  return;
579
579
  }
580
580
  }
581
- v(n);
582
- }, [n]);
581
+ v(l);
582
+ }, [l]);
583
583
  const A = (R) => {
584
- const j = R.target.value.replace(/\D/g, "");
585
- v(j), g && s && s("+" + g.phone + j);
584
+ const U = R.target.value.replace(/\D/g, "");
585
+ v(U), g && s && s("+" + g.phone + U);
586
586
  }, B = (R) => {
587
- y(R), s && s("+" + R.phone + b), N(!1), D("");
587
+ x(R), s && s("+" + R.phone + d), S(!1), D("");
588
588
  };
589
- H(() => {
590
- const R = (j) => {
591
- C.current && !C.current.contains(j.target) && N(!1);
589
+ z(() => {
590
+ const R = (U) => {
591
+ C.current && !C.current.contains(U.target) && S(!1);
592
592
  };
593
593
  return document.addEventListener("mousedown", R), () => document.removeEventListener("mousedown", R);
594
594
  }, []);
595
595
  const F = xe.filter(
596
596
  (R) => R.label.toLowerCase().includes(I.toLowerCase()) || R.phone.includes(I)
597
597
  );
598
- return u ? /* @__PURE__ */ e(E, { children: /* @__PURE__ */ d("div", { className: o || "col-span-12", children: [
599
- /* @__PURE__ */ e(Q, { label: h, required: p }),
600
- /* @__PURE__ */ d("div", { className: "relative ", ref: C, children: [
601
- /* @__PURE__ */ d(
598
+ return b ? /* @__PURE__ */ e(E, { children: /* @__PURE__ */ c("div", { className: o || "col-span-12", children: [
599
+ /* @__PURE__ */ e(Q, { label: u, required: p }),
600
+ /* @__PURE__ */ c("div", { className: "relative ", ref: C, children: [
601
+ /* @__PURE__ */ c(
602
602
  "div",
603
603
  {
604
604
  className: `h-[40px] flex items-center border rounded-md px-2 bg-white dark:bg-gray-700 transition-all
605
- ${x ? "ring-0.5 ring-blue-100 border-blue-300" : "border-gray-300 dark:border-gray-600"}
605
+ ${y ? "ring-0.5 ring-blue-100 border-blue-300" : "border-gray-300 dark:border-gray-600"}
606
606
  ${t ? "opacity-60 cursor-not-allowed" : ""}`,
607
607
  children: [
608
- /* @__PURE__ */ d(
608
+ /* @__PURE__ */ c(
609
609
  "button",
610
610
  {
611
611
  type: "button",
612
612
  disabled: t,
613
- onClick: () => N(!x),
613
+ onClick: () => S(!y),
614
614
  className: "flex items-center gap-1 pr-2 border-r border-gray-300 dark:border-gray-700 focus:outline-none",
615
615
  children: [
616
616
  g ? /* @__PURE__ */ e(
@@ -625,7 +625,7 @@ function ra({
625
625
  ]
626
626
  }
627
627
  ),
628
- g && /* @__PURE__ */ d("span", { className: "ml-2 text-sm text-gray-700 dark:text-gray-200 whitespace-nowrap", children: [
628
+ g && /* @__PURE__ */ c("span", { className: "ml-2 text-sm text-gray-700 dark:text-gray-200 whitespace-nowrap", children: [
629
629
  "+",
630
630
  g.phone
631
631
  ] }),
@@ -633,7 +633,7 @@ function ra({
633
633
  "input",
634
634
  {
635
635
  type: "tel",
636
- value: b,
636
+ value: d,
637
637
  onChange: A,
638
638
  required: p,
639
639
  disabled: t || !g,
@@ -648,7 +648,7 @@ function ra({
648
648
  required: p,
649
649
  tabIndex: -1,
650
650
  readOnly: !0,
651
- value: g && b ? "+" + g.phone + b : "",
651
+ value: g && d ? "+" + g.phone + d : "",
652
652
  style: {
653
653
  position: "absolute",
654
654
  opacity: 0,
@@ -660,8 +660,8 @@ function ra({
660
660
  ]
661
661
  }
662
662
  ),
663
- x && /* @__PURE__ */ d("div", { className: "absolute top-full left-0 w-full mt-1 border border-gray-300 dark:border-gray-700 rounded-md bg-white dark:bg-gray-700 shadow-lg z-50 max-h-60 overflow-y-auto", children: [
664
- M && /* @__PURE__ */ e("div", { className: "p-2 border-b border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ d("div", { className: "relative", children: [
663
+ y && /* @__PURE__ */ c("div", { className: "absolute top-full left-0 w-full mt-1 border border-gray-300 dark:border-gray-700 rounded-md bg-white dark:bg-gray-700 shadow-lg z-50 max-h-60 overflow-y-auto", children: [
664
+ w && /* @__PURE__ */ e("div", { className: "p-2 border-b border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ c("div", { className: "relative", children: [
665
665
  /* @__PURE__ */ e(Re, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400" }),
666
666
  /* @__PURE__ */ e(
667
667
  "input",
@@ -674,7 +674,7 @@ function ra({
674
674
  }
675
675
  )
676
676
  ] }) }),
677
- F.map((R) => /* @__PURE__ */ d(
677
+ F.map((R) => /* @__PURE__ */ c(
678
678
  "button",
679
679
  {
680
680
  type: "button",
@@ -689,7 +689,7 @@ function ra({
689
689
  className: "w-5 h-3 object-cover"
690
690
  }
691
691
  ),
692
- /* @__PURE__ */ d("span", { children: [
692
+ /* @__PURE__ */ c("span", { children: [
693
693
  R.label,
694
694
  " (+",
695
695
  R.phone,
@@ -701,15 +701,15 @@ function ra({
701
701
  ))
702
702
  ] })
703
703
  ] })
704
- ] }, i) }) : /* @__PURE__ */ e(E, { children: /* @__PURE__ */ d("div", { className: o || "col-span-12", children: [
705
- /* @__PURE__ */ e(Q, { label: h, required: p }),
704
+ ] }, i) }) : /* @__PURE__ */ e(E, { children: /* @__PURE__ */ c("div", { className: o || "col-span-12", children: [
705
+ /* @__PURE__ */ e(Q, { label: u, required: p }),
706
706
  /* @__PURE__ */ e(
707
707
  "input",
708
708
  {
709
709
  type: "text",
710
- value: n,
711
- onChange: (j) => {
712
- const $ = j.target.value.replace(/[^+\d]/g, ""), W = $.startsWith("+") ? "+" + $.replace(/[+]/g, "").slice(0) : $;
710
+ value: l,
711
+ onChange: (U) => {
712
+ const $ = U.target.value.replace(/[^+\d]/g, ""), W = $.startsWith("+") ? "+" + $.replace(/[+]/g, "").slice(0) : $;
713
713
  s(W);
714
714
  },
715
715
  placeholder: k,
@@ -725,13 +725,13 @@ function ra({
725
725
  ] }, i) });
726
726
  }
727
727
  const Ie = Ce.forwardRef(
728
- ({ className: h = "", label: n, required: i, ...o }, s) => {
728
+ ({ className: u = "", label: l, required: i, ...o }, s) => {
729
729
  const t = `
730
730
  placeholder-gray-400 dark:placeholder-gray-400
731
- ${h}
731
+ ${u}
732
732
  `.trim();
733
- return /* @__PURE__ */ e(E, { children: /* @__PURE__ */ d("div", { className: o.parentClass || "col-span-12", children: [
734
- /* @__PURE__ */ e(Q, { label: n, required: i }),
733
+ return /* @__PURE__ */ e(E, { children: /* @__PURE__ */ c("div", { className: o.parentClass || "col-span-12", children: [
734
+ /* @__PURE__ */ e(Q, { label: l, required: i }),
735
735
  /* @__PURE__ */ e("div", { className: "relative", children: /* @__PURE__ */ e(
736
736
  "textarea",
737
737
  {
@@ -746,70 +746,70 @@ const Ie = Ce.forwardRef(
746
746
  );
747
747
  Ie.displayName = "TextArea";
748
748
  const ta = ({
749
- label: h = "",
750
- value: n = null,
749
+ label: u = "",
750
+ value: l = null,
751
751
  onChange: i,
752
752
  required: o = !1,
753
753
  accept: s = "image/*",
754
754
  id: t,
755
755
  dragDrop: p = !1,
756
756
  name: k = "",
757
- parentClass: M = ""
757
+ parentClass: w = ""
758
758
  }) => {
759
- const [u, l] = S(n), [c, g] = S(!1), y = ae(null);
760
- H(() => (n instanceof File ? l({ file: n, preview: URL.createObjectURL(n) }) : (n != null && n.preview, l(n)), () => {
761
- u != null && u.preview && u.preview.startsWith("blob:") && URL.revokeObjectURL(u.preview);
762
- }), [n]);
763
- const b = (C) => {
759
+ const [b, n] = M(l), [h, g] = M(!1), x = ae(null);
760
+ z(() => (l instanceof File ? n({ file: l, preview: URL.createObjectURL(l) }) : (l != null && l.preview, n(l)), () => {
761
+ b != null && b.preview && b.preview.startsWith("blob:") && URL.revokeObjectURL(b.preview);
762
+ }), [l]);
763
+ const d = (C) => {
764
764
  if (!C || C.length === 0)
765
765
  return;
766
766
  const A = C[0], B = URL.createObjectURL(A), F = { file: A, preview: B };
767
- u != null && u.preview && u.preview.startsWith("blob:") && URL.revokeObjectURL(u.preview), l(F), i == null || i(A);
767
+ b != null && b.preview && b.preview.startsWith("blob:") && URL.revokeObjectURL(b.preview), n(F), i == null || i(A);
768
768
  }, v = (C) => {
769
- C && C.stopPropagation(), u != null && u.preview && u.preview.startsWith("blob:") && URL.revokeObjectURL(u.preview), l(null), i == null || i(null), y.current && (y.current.value = "");
770
- }, x = (C) => {
769
+ C && C.stopPropagation(), b != null && b.preview && b.preview.startsWith("blob:") && URL.revokeObjectURL(b.preview), n(null), i == null || i(null), x.current && (x.current.value = "");
770
+ }, y = (C) => {
771
771
  p && (C.preventDefault(), g(!0));
772
- }, N = (C) => {
772
+ }, S = (C) => {
773
773
  p && (C.preventDefault(), g(!1));
774
774
  }, I = (C) => {
775
- p && (C.preventDefault(), g(!1), b(C.dataTransfer.files));
775
+ p && (C.preventDefault(), g(!1), d(C.dataTransfer.files));
776
776
  }, D = () => {
777
- y.current.click();
777
+ x.current.click();
778
778
  };
779
- return /* @__PURE__ */ e(E, { children: /* @__PURE__ */ d("div", { className: M || "col-span-12", children: [
780
- /* @__PURE__ */ e(Q, { label: h, required: o }),
781
- /* @__PURE__ */ d(
779
+ return /* @__PURE__ */ e(E, { children: /* @__PURE__ */ c("div", { className: w || "col-span-12", children: [
780
+ /* @__PURE__ */ e(Q, { label: u, required: o }),
781
+ /* @__PURE__ */ c(
782
782
  "div",
783
783
  {
784
- className: `relative rounded-md p-2 transition-all ${c ? "border-2 border-dashed border-blue-500 bg-blue-50 dark:bg-blue-900/20" : "border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800"}`,
785
- onDragOver: x,
786
- onDragLeave: N,
784
+ className: `relative rounded-md p-2 transition-all ${h ? "border-2 border-dashed border-blue-500 bg-blue-50 dark:bg-blue-900/20" : "border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800"}`,
785
+ onDragOver: y,
786
+ onDragLeave: S,
787
787
  onDrop: I,
788
788
  children: [
789
789
  /* @__PURE__ */ e(
790
790
  "input",
791
791
  {
792
- ref: y,
792
+ ref: x,
793
793
  id: t,
794
794
  type: "file",
795
795
  accept: s,
796
- onChange: (C) => b(C.target.files),
797
- required: o && !u,
796
+ onChange: (C) => d(C.target.files),
797
+ required: o && !b,
798
798
  className: "absolute opacity-0 right-[50%] top-[80%] -translate-y-1/2 pointer-events-none h-[10px]"
799
799
  }
800
800
  ),
801
- /* @__PURE__ */ d(
801
+ /* @__PURE__ */ c(
802
802
  "div",
803
803
  {
804
- className: `flex items-center space-x-4 transition-all ${c ? "opacity-50" : ""}`,
804
+ className: `flex items-center space-x-4 transition-all ${h ? "opacity-50" : ""}`,
805
805
  children: [
806
- u ? (
806
+ b ? (
807
807
  // Image preview with close button
808
- /* @__PURE__ */ d("div", { className: "relative group", children: [
808
+ /* @__PURE__ */ c("div", { className: "relative group", children: [
809
809
  /* @__PURE__ */ e(
810
810
  "img",
811
811
  {
812
- src: u.preview || u,
812
+ src: b.preview || b,
813
813
  alt: "preview",
814
814
  className: "object-cover w-20 h-20 rounded-full shadow-md"
815
815
  }
@@ -835,7 +835,7 @@ const ta = ({
835
835
  }
836
836
  ) })
837
837
  ),
838
- /* @__PURE__ */ d("div", { className: "flex flex-col items-center space-y-1", children: [
838
+ /* @__PURE__ */ c("div", { className: "flex flex-col items-center space-y-1", children: [
839
839
  /* @__PURE__ */ e(
840
840
  ee,
841
841
  {
@@ -843,64 +843,70 @@ const ta = ({
843
843
  onClick: D,
844
844
  variant: "outlined",
845
845
  color: "default",
846
- children: u ? "Change Image" : "Select Image"
846
+ children: b ? "Change Image" : "Select Image"
847
847
  }
848
848
  ),
849
- p && !u && /* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: "or drag and drop" })
849
+ p && !b && /* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: "or drag and drop" })
850
850
  ] })
851
851
  ]
852
852
  }
853
853
  ),
854
- p && c && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none bg-blue-500/10 rounded-md", children: /* @__PURE__ */ e("span", { className: "text-blue-600 dark:text-blue-400 font-semibold text-lg", children: "Drop image here" }) })
854
+ p && h && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none bg-blue-500/10 rounded-md", children: /* @__PURE__ */ e("span", { className: "text-blue-600 dark:text-blue-400 font-semibold text-lg", children: "Drop image here" }) })
855
855
  ]
856
856
  }
857
857
  )
858
858
  ] }, k) });
859
859
  }, Be = Ce.forwardRef(
860
860
  ({
861
- label: h,
862
- required: n,
861
+ label: u,
862
+ required: l,
863
863
  parentClass: i = "",
864
864
  className: o = "",
865
865
  type: s = "text",
866
866
  onKeyDown: t,
867
867
  negativeNumberAllow: p = !0,
868
- ...k
869
- }, M) => {
870
- const [u, l] = S(!1), c = (y) => {
868
+ defaultValue: k = "",
869
+ ...w
870
+ }, b) => {
871
+ const [n, h] = M(!1), g = (d) => {
871
872
  if (s === "number") {
872
- if (["e", "E", "+"].includes(y.key)) {
873
- y.preventDefault();
873
+ if (["e", "E", "+"].includes(d.key)) {
874
+ d.preventDefault();
874
875
  return;
875
876
  }
876
- if (p == !1 && y.key === "-") {
877
- y.preventDefault();
877
+ if (p == !1 && d.key === "-") {
878
+ d.preventDefault();
878
879
  return;
879
880
  }
880
- if (["ArrowUp", "ArrowDown"].includes(y.key)) {
881
- y.preventDefault();
881
+ if (["ArrowUp", "ArrowDown"].includes(d.key)) {
882
+ d.preventDefault();
882
883
  return;
883
884
  }
884
885
  }
885
- t == null || t(y);
886
- }, g = `
886
+ t == null || t(d);
887
+ }, x = `
887
888
  h-10 placeholder-gray-400 dark:placeholder-gray-400
888
889
  ${s === "password" ? "pr-10" : ""}
889
890
  ${s === "number" ? "no-spinner" : ""}
890
891
  ${o}
891
892
  `.trim();
892
- return /* @__PURE__ */ e(E, { children: /* @__PURE__ */ d("div", { className: i || "col-span-12", children: [
893
- /* @__PURE__ */ e(Q, { label: h, required: n }),
894
- /* @__PURE__ */ d("div", { className: "relative", children: [
893
+ return z(() => {
894
+ k && setTimeout(() => {
895
+ var d;
896
+ (d = w.onChange) == null || d.call(w, { target: { value: k } });
897
+ }, 100);
898
+ }, [k]), /* @__PURE__ */ e(E, { children: /* @__PURE__ */ c("div", { className: i || "col-span-12", children: [
899
+ /* @__PURE__ */ e(Q, { label: u, required: l }),
900
+ /* @__PURE__ */ c("div", { className: "relative", children: [
895
901
  /* @__PURE__ */ e(
896
902
  "input",
897
903
  {
898
- type: s === "password" && u ? "text" : s,
899
- ref: M,
900
- required: n,
901
- onKeyDown: c,
902
- className: g,
903
- ...k
904
+ type: s === "password" && n ? "text" : s,
905
+ ref: b,
906
+ required: l,
907
+ onKeyDown: g,
908
+ className: x,
909
+ ...w
904
910
  }
905
911
  ),
906
912
  s === "password" && /* @__PURE__ */ e(
@@ -908,62 +914,62 @@ const ta = ({
908
914
  {
909
915
  type: "button",
910
916
  tabIndex: -1,
911
- onClick: () => l((y) => !y),
917
+ onClick: () => h((d) => !d),
912
918
  className: "absolute inset-y-0 right-3 flex items-center text-gray-400 hover:text-gray-600 dark:text-gray-400 dark:hover:text-gray-200",
913
919
  children: /* @__PURE__ */ e(
914
920
  te,
915
921
  {
916
- icon: u ? "mdi:eye-outline" : "mdi:eye-off-outline",
922
+ icon: n ? "mdi:eye-outline" : "mdi:eye-off-outline",
917
923
  className: "w-5 h-5"
918
924
  }
919
925
  )
920
926
  }
921
927
  )
922
928
  ] })
923
- ] }, k.name) });
929
+ ] }, w.name) });
924
930
  }
925
931
  );
926
932
  Be.displayName = "Input";
927
933
  const na = ({
928
- key: h,
929
- editorKey: n = "",
934
+ key: u,
935
+ editorKey: l = "",
930
936
  value: i = "",
931
937
  onChange: o,
932
938
  label: s = "",
933
939
  required: t = !1,
934
940
  placeholder: p = "",
935
941
  parentClass: k = "col-span-12",
936
- height: M = 400,
937
- inline: u = !1,
938
- disabled: l = !1,
939
- plugins: c,
942
+ height: w = 400,
943
+ inline: b = !1,
944
+ disabled: n = !1,
945
+ plugins: h,
940
946
  toolbar: g,
941
- menubar: y = !1,
942
- fontFamily: b = "Inter, sans-serif",
947
+ menubar: x = !1,
948
+ fontFamily: d = "Inter, sans-serif",
943
949
  initConfig: v = {},
944
- imageUploadHandler: x
950
+ imageUploadHandler: y
945
951
  // ✅ Promise function passed from parent
946
- }) => /* @__PURE__ */ d("div", { className: k, children: [
952
+ }) => /* @__PURE__ */ c("div", { className: k, children: [
947
953
  s && /* @__PURE__ */ e(Q, { label: s, required: t }),
948
954
  /* @__PURE__ */ e(
949
955
  Je,
950
956
  {
951
- apiKey: n,
957
+ apiKey: l,
952
958
  value: i,
953
- disabled: l,
959
+ disabled: n,
954
960
  init: {
955
- height: M,
956
- inline: u,
957
- menubar: y,
961
+ height: w,
962
+ inline: b,
963
+ menubar: x,
958
964
  branding: !1,
959
965
  statusbar: !0,
960
966
  automatic_uploads: !0,
961
967
  images_upload_handler: (C) => new Promise((A, B) => {
962
- if (!x) {
968
+ if (!y) {
963
969
  A(`data:${C.blob().type};base64,${C.base64()}`);
964
970
  return;
965
971
  }
966
- x(C).then((F) => {
972
+ y(C).then((F) => {
967
973
  F ? A(F) : B("Upload failed: No URL returned");
968
974
  }).catch((F) => {
969
975
  B(
@@ -971,7 +977,7 @@ const na = ({
971
977
  );
972
978
  });
973
979
  }),
974
- plugins: c ?? [
980
+ plugins: h ?? [
975
981
  "advlist",
976
982
  "autolink",
977
983
  "lists",
@@ -994,7 +1000,7 @@ const na = ({
994
1000
  placeholder: p,
995
1001
  content_style: `
996
1002
  body {
997
- font-family: ${b};
1003
+ font-family: ${d};
998
1004
  }
999
1005
  `,
1000
1006
  ...v
@@ -1004,9 +1010,9 @@ const na = ({
1004
1010
  }
1005
1011
  }
1006
1012
  )
1007
- ] }, h), la = ({
1008
- name: h = "",
1009
- label: n = "",
1013
+ ] }, u), la = ({
1014
+ name: u = "",
1015
+ label: l = "",
1010
1016
  // label for single checkbox
1011
1017
  options: i = [],
1012
1018
  // array of { label, value } for multiple
@@ -1016,152 +1022,152 @@ const na = ({
1016
1022
  disabled: t = !1,
1017
1023
  required: p = !1,
1018
1024
  parentClass: k = "col-span-12",
1019
- className: M = "",
1020
- multiSelect: u = !1
1025
+ className: w = "",
1026
+ multiSelect: b = !1
1021
1027
  // ✅ if true, only one option can be selected (like radio)
1022
1028
  }) => {
1023
- const l = Array.isArray(i) && i.length > 0, c = (b) => l ? u ? Array.isArray(o) && o.includes(b) : o === b : !!o, g = (b) => {
1024
- s == null || s(b.target.checked, h);
1025
- }, y = (b, v) => {
1029
+ const n = Array.isArray(i) && i.length > 0, h = (d) => n ? b ? Array.isArray(o) && o.includes(d) : o === d : !!o, g = (d) => {
1030
+ s == null || s(d.target.checked, u);
1031
+ }, x = (d, v) => {
1026
1032
  if (s)
1027
- if (!u)
1028
- s(v ? b : "", h);
1033
+ if (!b)
1034
+ s(v ? d : "", u);
1029
1035
  else {
1030
- const x = Array.isArray(o) ? [...o] : [];
1036
+ const y = Array.isArray(o) ? [...o] : [];
1031
1037
  if (v)
1032
- x.includes(b) || x.push(b);
1038
+ y.includes(d) || y.push(d);
1033
1039
  else {
1034
- const N = x.indexOf(b);
1035
- N > -1 && x.splice(N, 1);
1040
+ const S = y.indexOf(d);
1041
+ S > -1 && y.splice(S, 1);
1036
1042
  }
1037
- s(x, h);
1043
+ s(y, u);
1038
1044
  }
1039
1045
  };
1040
- return l ? /* @__PURE__ */ e(E, { children: /* @__PURE__ */ d("div", { className: `${k}`, children: [
1041
- /* @__PURE__ */ e(Q, { label: n, required: p }),
1042
- /* @__PURE__ */ e("div", { className: "flex flex-col space-y-2", children: i.map((b, v) => /* @__PURE__ */ d("div", { className: "flex items-center", children: [
1046
+ return n ? /* @__PURE__ */ e(E, { children: /* @__PURE__ */ c("div", { className: `${k}`, children: [
1047
+ /* @__PURE__ */ e(Q, { label: l, required: p }),
1048
+ /* @__PURE__ */ e("div", { className: "flex flex-col space-y-2", children: i.map((d, v) => /* @__PURE__ */ c("div", { className: "flex items-center", children: [
1043
1049
  /* @__PURE__ */ e(
1044
1050
  "input",
1045
1051
  {
1046
1052
  type: "checkbox",
1047
- name: h,
1048
- value: b.value,
1049
- checked: c(b.value),
1050
- disabled: t || b.disabled,
1053
+ name: u,
1054
+ value: d.value,
1055
+ checked: h(d.value),
1056
+ disabled: t || d.disabled,
1051
1057
  required: p && v === 0,
1052
- onChange: (x) => y(b.value, x.target.checked),
1053
- className: `h-4 w-4 cursor-pointer text-blue-600 border-gray-300 rounded focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 ${M}`
1058
+ onChange: (y) => x(d.value, y.target.checked),
1059
+ 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 ${w}`
1054
1060
  },
1055
- h
1061
+ u
1056
1062
  ),
1057
- b.label && /* @__PURE__ */ e(
1063
+ d.label && /* @__PURE__ */ e(
1058
1064
  "label",
1059
1065
  {
1060
- htmlFor: h,
1066
+ htmlFor: u,
1061
1067
  className: "ml-2 text-sm text-gray-700 dark:text-gray-200 select-none",
1062
- children: b.label
1068
+ children: d.label
1063
1069
  }
1064
1070
  )
1065
- ] }, b.value || b.label)) })
1066
- ] }) }) : /* @__PURE__ */ d("div", { className: `flex items-center ${k}`, children: [
1071
+ ] }, d.value || d.label)) })
1072
+ ] }) }) : /* @__PURE__ */ c("div", { className: `flex items-center ${k}`, children: [
1067
1073
  /* @__PURE__ */ e(
1068
1074
  "input",
1069
1075
  {
1070
1076
  type: "checkbox",
1071
- name: h,
1072
- checked: c(),
1077
+ name: u,
1078
+ checked: h(),
1073
1079
  disabled: t,
1074
1080
  required: p,
1075
1081
  onChange: g,
1076
- className: `h-4 w-4 text-blue-600 cursor-pointer border-gray-300 rounded focus:ring-2 focus:ring-blue-500 dark:focus:ring-blue-400 ${M}`
1082
+ 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 ${w}`
1077
1083
  }
1078
1084
  ),
1079
- n && /* @__PURE__ */ e(
1085
+ l && /* @__PURE__ */ e(
1080
1086
  "label",
1081
1087
  {
1082
- htmlFor: h,
1088
+ htmlFor: u,
1083
1089
  className: "ml-2 text-sm text-gray-700 dark:text-gray-200 select-none",
1084
- children: n
1090
+ children: l
1085
1091
  }
1086
1092
  )
1087
1093
  ] });
1088
1094
  }, oa = ({
1089
- label: h = "",
1090
- value: n = null,
1095
+ label: u = "",
1096
+ value: l = null,
1091
1097
  onChange: i,
1092
1098
  required: o = !1,
1093
1099
  accept: s = "audio/*",
1094
1100
  id: t,
1095
1101
  dragDrop: p = !1,
1096
1102
  name: k = "",
1097
- parentClass: M = ""
1103
+ parentClass: w = ""
1098
1104
  }) => {
1099
- const [u, l] = S(null), [c, g] = S(!1), y = ae(null);
1100
- H(() => {
1101
- if (!n) {
1102
- b(), l(null);
1105
+ const [b, n] = M(null), [h, g] = M(!1), x = ae(null);
1106
+ z(() => {
1107
+ if (!l) {
1108
+ d(), n(null);
1103
1109
  return;
1104
1110
  }
1105
- if (n instanceof File) {
1106
- const A = URL.createObjectURL(n);
1107
- return l({ file: n, preview: A }), () => {
1111
+ if (l instanceof File) {
1112
+ const A = URL.createObjectURL(l);
1113
+ return n({ file: l, preview: A }), () => {
1108
1114
  URL.revokeObjectURL(A);
1109
1115
  };
1110
- } else typeof n == "string" ? l({ preview: n }) : n != null && n.preview && l(n);
1111
- }, [n]);
1112
- const b = () => {
1113
- u != null && u.preview && u.preview.startsWith("blob:") && URL.revokeObjectURL(u.preview);
1116
+ } else typeof l == "string" ? n({ preview: l }) : l != null && l.preview && n(l);
1117
+ }, [l]);
1118
+ const d = () => {
1119
+ b != null && b.preview && b.preview.startsWith("blob:") && URL.revokeObjectURL(b.preview);
1114
1120
  }, v = (A) => {
1115
1121
  if (!A || A.length === 0)
1116
1122
  return;
1117
1123
  const B = A[0], F = URL.createObjectURL(B);
1118
- b(), l({ file: B, preview: F }), i == null || i(B);
1119
- }, x = (A) => {
1120
- A && A.stopPropagation(), b(), l(null), i == null || i(null), y.current && (y.current.value = "");
1121
- }, N = (A) => {
1124
+ d(), n({ file: B, preview: F }), i == null || i(B);
1125
+ }, y = (A) => {
1126
+ A && A.stopPropagation(), d(), n(null), i == null || i(null), x.current && (x.current.value = "");
1127
+ }, S = (A) => {
1122
1128
  p && (A.preventDefault(), g(!0));
1123
1129
  }, I = (A) => {
1124
1130
  p && (A.preventDefault(), g(!1));
1125
1131
  }, D = (A) => {
1126
1132
  p && (A.preventDefault(), g(!1), v(A.dataTransfer.files));
1127
1133
  }, C = () => {
1128
- y.current.click();
1134
+ x.current.click();
1129
1135
  };
1130
- return /* @__PURE__ */ d("div", { className: M || "col-span-12", children: [
1131
- /* @__PURE__ */ e(Q, { label: h, required: o }),
1132
- /* @__PURE__ */ d(
1136
+ return /* @__PURE__ */ c("div", { className: w || "col-span-12", children: [
1137
+ /* @__PURE__ */ e(Q, { label: u, required: o }),
1138
+ /* @__PURE__ */ c(
1133
1139
  "div",
1134
1140
  {
1135
- className: `relative rounded-lg p-2 transition-all ${c ? "border-2 border-dashed border-blue-500 bg-blue-50 dark:bg-blue-900/20" : "border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800"}`,
1136
- onDragOver: N,
1141
+ className: `relative rounded-lg p-2 transition-all ${h ? "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"}`,
1142
+ onDragOver: S,
1137
1143
  onDragLeave: I,
1138
1144
  onDrop: D,
1139
1145
  children: [
1140
1146
  /* @__PURE__ */ e(
1141
1147
  "input",
1142
1148
  {
1143
- ref: y,
1149
+ ref: x,
1144
1150
  id: t,
1145
1151
  type: "file",
1146
1152
  accept: s,
1147
1153
  onChange: (A) => v(A.target.files),
1148
- required: o && !u,
1154
+ required: o && !b,
1149
1155
  className: "absolute opacity-0 right-[50%] top-[80%] -translate-y-1/2 pointer-events-none h-[10px]"
1150
1156
  }
1151
1157
  ),
1152
1158
  /* @__PURE__ */ e(
1153
1159
  "div",
1154
1160
  {
1155
- className: `flex items-center space-x-4 transition-all ${c ? "opacity-50" : ""}`,
1156
- children: u ? (
1161
+ className: `flex items-center space-x-4 transition-all ${h ? "opacity-50" : ""}`,
1162
+ children: b ? (
1157
1163
  // Audio player with close button and change button
1158
- /* @__PURE__ */ d("div", { className: "flex items-center space-x-4", children: [
1159
- /* @__PURE__ */ d("div", { className: "relative w-full", children: [
1164
+ /* @__PURE__ */ c("div", { className: "flex items-center space-x-4", children: [
1165
+ /* @__PURE__ */ c("div", { className: "relative w-full", children: [
1160
1166
  !o && /* @__PURE__ */ e(
1161
1167
  "button",
1162
1168
  {
1163
1169
  type: "button",
1164
- onClick: x,
1170
+ onClick: y,
1165
1171
  className: "absolute top-0 -right-2 bg-red-500 text-white rounded-full p-1 shadow-lg hover:bg-red-600 transition-colors z-10 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 dark:focus:ring-offset-gray-800",
1166
1172
  "aria-label": "Remove audio",
1167
1173
  children: /* @__PURE__ */ e(te, { icon: "mdi:close", className: "w-3 h-3" })
@@ -1170,18 +1176,18 @@ const na = ({
1170
1176
  /* @__PURE__ */ e(
1171
1177
  "audio",
1172
1178
  {
1173
- src: u.preview,
1179
+ src: b.preview,
1174
1180
  controls: !0,
1175
1181
  controlsList: "nodownload"
1176
1182
  },
1177
- u.preview
1183
+ b.preview
1178
1184
  )
1179
1185
  ] }),
1180
1186
  /* @__PURE__ */ e(ee, { type: "button", onClick: C, children: /* @__PURE__ */ e("span", { children: "Change Audio File" }) })
1181
1187
  ] })
1182
1188
  ) : (
1183
1189
  // Empty state with upload button
1184
- /* @__PURE__ */ d("div", { className: "flex items-center justify-center space-x-4", children: [
1190
+ /* @__PURE__ */ c("div", { className: "flex items-center justify-center space-x-4", children: [
1185
1191
  /* @__PURE__ */ e("div", { className: "rounded-full bg-gray-100 dark:bg-gray-700 h-20 w-20 flex items-center justify-center", children: /* @__PURE__ */ e(te, { icon: "mdi:music", className: "text-gray-400 w-10 h-10" }) }),
1186
1192
  /* @__PURE__ */ e(
1187
1193
  ee,
@@ -1197,28 +1203,28 @@ const na = ({
1197
1203
  )
1198
1204
  }
1199
1205
  ),
1200
- p && c && !u && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none bg-blue-500/10 rounded-lg", children: /* @__PURE__ */ e("span", { className: "text-blue-600 dark:text-blue-400 font-semibold text-lg bg-white dark:bg-gray-800 px-4 py-2 rounded-lg shadow-lg", children: "Drop audio here" }) })
1206
+ p && h && !b && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none bg-blue-500/10 rounded-lg", children: /* @__PURE__ */ e("span", { className: "text-blue-600 dark:text-blue-400 font-semibold text-lg bg-white dark:bg-gray-800 px-4 py-2 rounded-lg shadow-lg", children: "Drop audio here" }) })
1201
1207
  ]
1202
1208
  }
1203
1209
  )
1204
1210
  ] }, k);
1205
- }, Ue = ({ field: h, formData: n, handleChange: i }) => {
1211
+ }, Ue = ({ field: u, formData: l, handleChange: i }) => {
1206
1212
  const {
1207
1213
  key: o,
1208
1214
  label: s,
1209
1215
  type: t,
1210
1216
  options: p,
1211
1217
  placeholder: k,
1212
- rows: M,
1213
- inputClass: u,
1214
- search: l,
1215
- accept: c,
1218
+ rows: w,
1219
+ inputClass: b,
1220
+ search: n,
1221
+ accept: h,
1216
1222
  text: g,
1217
- required: y = !1,
1218
- minLength: b,
1223
+ required: x = !1,
1224
+ minLength: d,
1219
1225
  dragDrop: v,
1220
- parentClass: x,
1221
- countriesList: N,
1226
+ parentClass: y,
1227
+ countriesList: S,
1222
1228
  defaultCountry: I,
1223
1229
  multiple: D,
1224
1230
  dropdownMaxHeight: C,
@@ -1226,14 +1232,14 @@ const na = ({
1226
1232
  fontFamily: B,
1227
1233
  disabled: F,
1228
1234
  negativeNumberAllow: R,
1229
- defaultValue: j,
1235
+ defaultValue: U,
1230
1236
  renderCondition: $,
1231
1237
  optionDependencyKey: W
1232
- } = h;
1233
- let G = n == null ? void 0 : n[o];
1238
+ } = u;
1239
+ let G = l == null ? void 0 : l[o];
1234
1240
  G == null && (G = "");
1235
- const K = k || (t === "select" ? `Select ${s}` : `Enter ${s}`), U = "w-full px-3 py-2 rounded-md border border-gray-300 dark:border-gray-600 text-sm focus:outline-none focus:ring-1 focus:ring-blue-200 bg-white text-black dark:bg-gray-700 dark:text-white";
1236
- if ($ && typeof $ == "function" && !$(n))
1241
+ const K = k || (t === "select" ? `Select ${s}` : `Enter ${s}`), 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";
1242
+ if ($ && typeof $ == "function" && !$(l))
1237
1243
  return null;
1238
1244
  switch (t) {
1239
1245
  case "select":
@@ -1242,18 +1248,18 @@ const na = ({
1242
1248
  {
1243
1249
  options: p || [],
1244
1250
  value: G,
1245
- formData: n,
1251
+ formData: l,
1246
1252
  dependencyKey: W,
1247
1253
  onChange: (O) => i(o, O),
1248
1254
  placeholder: K,
1249
- className: u || "",
1250
- search: l,
1251
- required: y,
1252
- defaultValue: j,
1255
+ className: b || "",
1256
+ search: n,
1257
+ required: x,
1258
+ defaultValue: U,
1253
1259
  label: s,
1254
1260
  name: o,
1255
1261
  disabled: F,
1256
- parentClass: x,
1262
+ parentClass: y,
1257
1263
  multiple: D,
1258
1264
  dropdownMaxHeight: C
1259
1265
  }
@@ -1267,9 +1273,9 @@ const na = ({
1267
1273
  options: p || [],
1268
1274
  value: G,
1269
1275
  onChange: (O) => i(o, O),
1270
- required: y,
1271
- parentClass: x,
1272
- className: u || "",
1276
+ required: x,
1277
+ parentClass: y,
1278
+ className: b || "",
1273
1279
  multiSelect: D,
1274
1280
  disabled: F
1275
1281
  }
@@ -1283,10 +1289,10 @@ const na = ({
1283
1289
  text: g,
1284
1290
  options: p || [],
1285
1291
  label: s,
1286
- required: y,
1292
+ required: x,
1287
1293
  name: o,
1288
1294
  disabled: F,
1289
- parentClass: x
1295
+ parentClass: y
1290
1296
  }
1291
1297
  );
1292
1298
  case "phone":
@@ -1295,15 +1301,15 @@ const na = ({
1295
1301
  {
1296
1302
  value: G,
1297
1303
  onChange: (O) => i(o, O),
1298
- countriesList: N,
1304
+ countriesList: S,
1299
1305
  defaultCountry: I,
1300
- required: y,
1306
+ required: x,
1301
1307
  placeholder: K,
1302
- search: l,
1308
+ search: n,
1303
1309
  label: s,
1304
1310
  name: o,
1305
1311
  disabled: F,
1306
- parentClass: x
1312
+ parentClass: y
1307
1313
  }
1308
1314
  );
1309
1315
  case "textarea":
@@ -1313,13 +1319,13 @@ const na = ({
1313
1319
  value: G,
1314
1320
  onChange: (O) => i(o, O.target.value),
1315
1321
  placeholder: K,
1316
- rows: M || 3,
1317
- className: `${U} ${u || ""}`,
1318
- required: y,
1322
+ rows: w || 3,
1323
+ className: `${j} ${b || ""}`,
1324
+ required: x,
1319
1325
  name: o,
1320
1326
  label: s,
1321
1327
  disabled: F,
1322
- parentClass: x
1328
+ parentClass: y
1323
1329
  }
1324
1330
  );
1325
1331
  case "image":
@@ -1328,13 +1334,13 @@ const na = ({
1328
1334
  {
1329
1335
  value: G,
1330
1336
  onChange: (O) => i(o, O),
1331
- required: y,
1332
- accept: c || "image/*",
1337
+ required: x,
1338
+ accept: h || "image/*",
1333
1339
  id: `file-${o}`,
1334
1340
  dragDrop: v,
1335
1341
  label: s,
1336
1342
  name: o,
1337
- parentClass: x
1343
+ parentClass: y
1338
1344
  }
1339
1345
  );
1340
1346
  case "audio":
@@ -1343,13 +1349,13 @@ const na = ({
1343
1349
  {
1344
1350
  value: G,
1345
1351
  onChange: (O) => i(o, O),
1346
- required: y,
1347
- accept: c || "audio/*",
1352
+ required: x,
1353
+ accept: h || "audio/*",
1348
1354
  id: `file-${o}`,
1349
1355
  dragDrop: v,
1350
1356
  label: s,
1351
1357
  name: o,
1352
- parentClass: x
1358
+ parentClass: y
1353
1359
  }
1354
1360
  );
1355
1361
  case "tinyEditor":
@@ -1358,10 +1364,10 @@ const na = ({
1358
1364
  {
1359
1365
  value: G,
1360
1366
  onChange: (O) => i(o, O),
1361
- required: y,
1367
+ required: x,
1362
1368
  placeholder: K,
1363
1369
  label: s,
1364
- parentClass: x,
1370
+ parentClass: y,
1365
1371
  fontFamily: B,
1366
1372
  editorKey: A,
1367
1373
  disabled: F
@@ -1373,66 +1379,67 @@ const na = ({
1373
1379
  Be,
1374
1380
  {
1375
1381
  type: t || "text",
1382
+ defaultValue: U,
1376
1383
  value: G,
1377
1384
  onChange: (O) => i(o, O.target.value),
1378
1385
  placeholder: K,
1379
- className: `${U} ${u || ""}`,
1380
- required: y,
1386
+ className: `${j} ${b || ""}`,
1387
+ required: x,
1381
1388
  name: o,
1382
- minLength: b,
1389
+ minLength: d,
1383
1390
  label: s,
1384
1391
  negativeNumberAllow: R,
1385
- parentClass: x,
1392
+ parentClass: y,
1386
1393
  disabled: F
1387
1394
  }
1388
1395
  );
1389
1396
  }
1390
- }, ia = ({ isOpen: h, onClose: n, config: i, onApply: o }) => {
1391
- var u;
1392
- const [s, t] = S({}), p = (l, c) => {
1393
- t((g) => ({ ...g, [l]: c }));
1397
+ }, ia = ({ isOpen: u, onClose: l, config: i, onApply: o }) => {
1398
+ var b;
1399
+ const [s, t] = M({}), p = (n, h) => {
1400
+ t((g) => ({ ...g, [n]: h }));
1394
1401
  }, k = () => {
1395
- o == null || o(s), n();
1396
- }, M = () => {
1397
- t({}), o == null || o({}), n();
1402
+ o == null || o(s), l();
1403
+ }, w = () => {
1404
+ t({}), o == null || o({}), l();
1398
1405
  };
1399
- return /* @__PURE__ */ d(E, { children: [
1406
+ return /* @__PURE__ */ c(E, { children: [
1400
1407
  /* @__PURE__ */ e(
1401
1408
  "div",
1402
1409
  {
1403
- className: `fixed inset-0 bg-black/50 z-40 transition-opacity duration-300 ${h ? "opacity-100 pointer-events-auto" : "opacity-0 pointer-events-none"}`,
1404
- onClick: n
1410
+ className: `fixed inset-0 bg-black/50 z-40 transition-opacity duration-300 ${u ? "opacity-100 pointer-events-auto" : "opacity-0 pointer-events-none"}`,
1411
+ onClick: l
1405
1412
  }
1406
1413
  ),
1407
- /* @__PURE__ */ d(
1414
+ /* @__PURE__ */ c(
1408
1415
  "div",
1409
1416
  {
1410
1417
  className: `fixed top-0 right-0 h-full w-[28rem] bg-white dark:bg-gray-900 shadow-2xl z-50 flex flex-col border-l border-gray-200 dark:border-gray-700
1411
1418
  transform transition-transform duration-300 ease-in-out
1412
- ${h ? "translate-x-0" : "translate-x-full"}
1419
+ ${u ? "translate-x-0" : "translate-x-full"}
1413
1420
  `,
1414
1421
  children: [
1415
- /* @__PURE__ */ d("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-700", children: [
1422
+ /* @__PURE__ */ c("div", { className: "flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-700", children: [
1416
1423
  /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: "Filters" }),
1417
1424
  /* @__PURE__ */ e(
1418
1425
  "button",
1419
1426
  {
1420
- onClick: n,
1427
+ onClick: l,
1421
1428
  className: "p-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded-md transition",
1422
1429
  children: /* @__PURE__ */ e(we, { className: "w-5 h-5 text-gray-500 dark:text-gray-400" })
1423
1430
  }
1424
1431
  )
1425
1432
  ] }),
1426
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto px-4 py-3", children: i != null && i.component ? /* @__PURE__ */ e(i.component, { filters: s, onFilterChange: p }) : /* @__PURE__ */ e("div", { className: "space-y-4", children: (u = i == null ? void 0 : i.fields) == null ? void 0 : u.map((l) => /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(
1433
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto px-4 py-3", children: i != null && i.component ? /* @__PURE__ */ e(i.component, { filters: s, onFilterChange: p }) : /* @__PURE__ */ e("div", { className: "space-y-4", children: (b = i == null ? void 0 : i.fields) == null ? void 0 : b.map((n) => /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(
1427
1434
  Ue,
1428
1435
  {
1429
- field: l,
1436
+ field: n,
1430
1437
  formData: s,
1431
1438
  handleChange: p
1432
1439
  },
1433
- l.key
1440
+ n.key
1434
1441
  ) })) }) }),
1435
- /* @__PURE__ */ d("div", { className: "flex gap-2 px-4 py-3 border-t border-gray-200 dark:border-gray-700", children: [
1442
+ /* @__PURE__ */ c("div", { className: "flex gap-2 px-4 py-3 border-t border-gray-200 dark:border-gray-700", children: [
1436
1443
  /* @__PURE__ */ e(
1437
1444
  ee,
1438
1445
  {
@@ -1446,7 +1453,7 @@ const na = ({
1446
1453
  /* @__PURE__ */ e(
1447
1454
  ee,
1448
1455
  {
1449
- onClick: M,
1456
+ onClick: w,
1450
1457
  variant: "contained",
1451
1458
  className: "min-w-[150px]",
1452
1459
  children: "Reset"
@@ -1491,13 +1498,13 @@ const na = ({
1491
1498
  outline: "border !bg-transparent",
1492
1499
  soft: "bg opacity-90"
1493
1500
  }, je = ({
1494
- label: h,
1495
- variant: n = "contained",
1501
+ label: u,
1502
+ variant: l = "contained",
1496
1503
  // contained | outline | soft
1497
1504
  color: i = "green",
1498
1505
  className: o = ""
1499
1506
  }) => {
1500
- const s = Oe[i] || Oe.green, t = Ae[n] || Ae.contained, p = n === "outline" ? s.border : s.bg;
1507
+ const s = Oe[i] || Oe.green, t = Ae[l] || Ae.contained, p = l === "outline" ? s.border : s.bg;
1501
1508
  return /* @__PURE__ */ e(
1502
1509
  "span",
1503
1510
  {
@@ -1505,32 +1512,32 @@ const na = ({
1505
1512
  ${p}
1506
1513
  ${t}
1507
1514
  ${o}`,
1508
- children: h
1515
+ children: u
1509
1516
  }
1510
1517
  );
1511
- }, sa = ({ rows: h = 5, columns: n = 5 }) => /* @__PURE__ */ d(E, { children: [
1518
+ }, sa = ({ rows: u = 5, columns: l = 5 }) => /* @__PURE__ */ c(E, { children: [
1512
1519
  /* @__PURE__ */ e("div", { className: "w-full mb-6 inline-flex justify-end items-center", children: /* @__PURE__ */ e("div", { className: "h-8 w-80 bg-gray-300 dark:bg-gray-700 rounded animate-pulse" }) }),
1513
- /* @__PURE__ */ e("div", { className: "overflow-hidden rounded-md border border-gray-200 dark:border-gray-800", children: /* @__PURE__ */ d("table", { className: "w-full border-collapse", children: [
1514
- /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { className: "bg-gray-50 dark:bg-gray-900", children: Array.from({ length: n }).map((i, o) => /* @__PURE__ */ e("th", { className: "px-4 py-3", children: /* @__PURE__ */ e("div", { className: "h-6 w-24 bg-gray-300 dark:bg-gray-700 rounded animate-pulse inline-flex justify-center items-center" }) }, o)) }) }),
1515
- /* @__PURE__ */ e("tbody", { children: Array.from({ length: h }).map((i, o) => /* @__PURE__ */ e(
1520
+ /* @__PURE__ */ e("div", { className: "overflow-hidden rounded-md border border-gray-200 dark:border-gray-800", children: /* @__PURE__ */ c("table", { className: "w-full border-collapse", children: [
1521
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ e("tr", { className: "bg-gray-50 dark:bg-gray-900", children: Array.from({ length: l }).map((i, o) => /* @__PURE__ */ e("th", { className: "px-4 py-3", children: /* @__PURE__ */ e("div", { className: "h-6 w-24 bg-gray-300 dark:bg-gray-700 rounded animate-pulse inline-flex justify-center items-center" }) }, o)) }) }),
1522
+ /* @__PURE__ */ e("tbody", { children: Array.from({ length: u }).map((i, o) => /* @__PURE__ */ e(
1516
1523
  "tr",
1517
1524
  {
1518
1525
  className: "border-t border-gray-200 dark:border-gray-800",
1519
- children: Array.from({ length: n }).map((s, t) => /* @__PURE__ */ e("td", { className: "px-4 py-6", children: /* @__PURE__ */ e("div", { className: "h-6 w-full bg-gray-300 dark:bg-gray-700 rounded animate-pulse" }) }, t))
1526
+ children: Array.from({ length: l }).map((s, t) => /* @__PURE__ */ e("td", { className: "px-4 py-6", children: /* @__PURE__ */ e("div", { className: "h-6 w-full bg-gray-300 dark:bg-gray-700 rounded animate-pulse" }) }, t))
1520
1527
  },
1521
1528
  o
1522
1529
  )) })
1523
1530
  ] }) })
1524
- ] }), Ee = ({ src: h, alt: n = "preview", isOpen: i, setIsOpen: o }) => {
1531
+ ] }), Ee = ({ src: u, alt: l = "preview", isOpen: i, setIsOpen: o }) => {
1525
1532
  const s = () => o(!1);
1526
- return H(() => {
1533
+ return z(() => {
1527
1534
  const t = (p) => {
1528
1535
  p.key === "Escape" && s();
1529
1536
  };
1530
1537
  return i && (document.body.style.overflow = "hidden", document.addEventListener("keydown", t)), () => {
1531
1538
  document.body.style.overflow = "", document.removeEventListener("keydown", t);
1532
1539
  };
1533
- }, [i]), /* @__PURE__ */ e(E, { children: /* @__PURE__ */ d(
1540
+ }, [i]), /* @__PURE__ */ e(E, { children: /* @__PURE__ */ c(
1534
1541
  "div",
1535
1542
  {
1536
1543
  className: `fixed inset-0 z-50 flex items-center justify-center bg-black/70 dark:bg-black/80 \r
@@ -1554,8 +1561,8 @@ const na = ({
1554
1561
  children: /* @__PURE__ */ e(
1555
1562
  "img",
1556
1563
  {
1557
- src: h,
1558
- alt: n,
1564
+ src: u,
1565
+ alt: l,
1559
1566
  className: "w-full max-h-[90vh] object-contain rounded-xl"
1560
1567
  }
1561
1568
  )
@@ -1564,39 +1571,39 @@ const na = ({
1564
1571
  ]
1565
1572
  }
1566
1573
  ) });
1567
- }, da = ({ config: h, setShowAdd: n, title: i, buttonText: o, description: s }) => {
1574
+ }, da = ({ config: u, setShowAdd: l, title: i, buttonText: o, description: s }) => {
1568
1575
  const {
1569
1576
  data: t = [],
1570
1577
  table_head: p = [],
1571
1578
  loading: k = !1,
1572
- search: M = {
1579
+ search: w = {
1573
1580
  enabled: !1,
1574
1581
  placeholder: "Search...",
1575
1582
  useServerSideSearch: !1
1576
1583
  },
1577
- filter: u = {
1584
+ filter: b = {
1578
1585
  enabled: !1,
1579
1586
  useServerSideFilters: !1
1580
1587
  },
1581
- pagination: l = {
1588
+ pagination: n = {
1582
1589
  enabled: !1,
1583
1590
  rows_per_page: 10,
1584
1591
  useServerSidePagination: !1
1585
1592
  },
1586
- emptyMessage: c = "No data available",
1593
+ emptyMessage: h = "No data available",
1587
1594
  onMenuAction: g,
1588
- setServerSidePaginationData: y = () => {
1595
+ setServerSidePaginationData: x = () => {
1589
1596
  },
1590
- onFilterApply: b,
1597
+ onFilterApply: d,
1591
1598
  filterConfig: v = null
1592
- } = h, [x, N] = S(""), [I, D] = S(null), [C, A] = S([]), [B, F] = S({}), [R, j] = S(!1), [$, W] = S(null), [G, K] = S(!1), U = Me(() => !M.enabled || !x.trim() || M.useServerSideSearch ? t : Xe(t, x, M.searchKeys || []), [t, x, M]), [O, Y] = S(1), [q, w] = S((l == null ? void 0 : l.rows_per_page) || 50), [z, re] = S(U.length || 0), J = l != null && l.useServerSidePagination ? l.total_pages : Math.ceil(U.length / q), X = Me(() => {
1593
- if (l.useServerSidePagination) return U;
1599
+ } = u, [y, S] = M(""), [I, D] = M(null), [C, A] = M([]), [B, F] = M({}), [R, U] = M(!1), [$, W] = M(null), [G, K] = M(!1), j = Me(() => !w.enabled || !y.trim() || w.useServerSideSearch ? t : Xe(t, y, w.searchKeys || []), [t, y, w]), [O, Y] = M(1), [q, N] = M((n == null ? void 0 : n.rows_per_page) || 50), [H, re] = M(j.length || 0), J = n != null && n.useServerSidePagination ? n.total_pages : Math.ceil(j.length / q), X = Me(() => {
1600
+ if (n.useServerSidePagination) return j;
1594
1601
  const r = (O - 1) * q;
1595
- return U.slice(r, r + q);
1596
- }, [U, O, q]), ne = ae(null), ie = ae({}), le = ae(null), se = (r) => {
1597
- N(r), Y(1), M.useServerSideSearch && (le.current && clearTimeout(le.current), le.current = setTimeout(async () => {
1602
+ return j.slice(r, r + q);
1603
+ }, [j, O, q]), ne = ae(null), ie = ae({}), le = ae(null), se = (r) => {
1604
+ S(r), Y(1), w.useServerSideSearch && (le.current && clearTimeout(le.current), le.current = setTimeout(async () => {
1598
1605
  try {
1599
- await y((f) => ({
1606
+ await x((f) => ({
1600
1607
  ...f,
1601
1608
  search: r,
1602
1609
  current_page: 1
@@ -1651,9 +1658,9 @@ const na = ({
1651
1658
  className: `w-12 h-12 flex items-center shrink-0 justify-center rounded-full border border-gray-300 dark:border-gray-700 bg-gray-200 dark:bg-gray-600 ${f || ""}`,
1652
1659
  children: /* @__PURE__ */ e(qe, { className: "w-6 h-6 text-gray-400 dark:text-gray-400" })
1653
1660
  }
1654
- ) }) }), pe = (r, f) => /* @__PURE__ */ d("div", { className: `flex items-center space-x-4 ${f.className || ""}`, children: [
1661
+ ) }) }), pe = (r, f) => /* @__PURE__ */ c("div", { className: `flex items-center space-x-4 ${f.className || ""}`, children: [
1655
1662
  f.imageKey ? oe(r[f.imageKey], r[f.titleKey], "group-avatar") : "",
1656
- /* @__PURE__ */ d("div", { children: [
1663
+ /* @__PURE__ */ c("div", { children: [
1657
1664
  /* @__PURE__ */ e("p", { className: "font-medium text-gray-900 dark:text-white group-title", children: r[f.titleKey] || "" }),
1658
1665
  /* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400 group-sub-title", children: r[f.subtitleKey] || "" })
1659
1666
  ] })
@@ -1692,43 +1699,43 @@ const na = ({
1692
1699
  if (typeof r.handleClick == "function")
1693
1700
  return r.handleClick(f);
1694
1701
  }, ye = (r) => r.onClickDetails || typeof r.handleClick == "function";
1695
- return H(() => {
1702
+ return z(() => {
1696
1703
  const r = () => {
1697
1704
  I && D(null);
1698
1705
  };
1699
1706
  return window.addEventListener("scroll", r, !0), () => {
1700
1707
  window.removeEventListener("scroll", r, !0);
1701
1708
  };
1702
- }, [I]), H(() => {
1709
+ }, [I]), z(() => {
1703
1710
  const r = (f) => {
1704
1711
  ne.current && !ne.current.contains(f.target) && D(null);
1705
1712
  };
1706
1713
  return document.addEventListener("click", r), () => document.removeEventListener("click", r);
1707
- }, []), H(() => {
1708
- l != null && l.rows_per_page && (l != null && l.useServerSidePagination) && w((l == null ? void 0 : l.rows_per_page) || 50), l.current_page && Y(l.current_page);
1714
+ }, []), z(() => {
1715
+ n != null && n.rows_per_page && (n != null && n.useServerSidePagination) && N((n == null ? void 0 : n.rows_per_page) || 50), n.current_page && Y(n.current_page);
1709
1716
  }, [
1710
- l.rows_per_page,
1711
- l == null ? void 0 : l.useServerSidePagination,
1712
- l.current_page
1713
- ]), H(() => {
1717
+ n.rows_per_page,
1718
+ n == null ? void 0 : n.useServerSidePagination,
1719
+ n.current_page
1720
+ ]), z(() => {
1714
1721
  re(
1715
- l != null && l.useServerSidePagination ? l.total_records : U.length
1716
- ), U.length <= q * (O - 1) && !(l != null && l.useServerSidePagination) && Y((r) => r - 1 || 1);
1722
+ n != null && n.useServerSidePagination ? n.total_records : j.length
1723
+ ), j.length <= q * (O - 1) && !(n != null && n.useServerSidePagination) && Y((r) => r - 1 || 1);
1717
1724
  }, [
1718
- U.length,
1719
- l.total_records,
1720
- l == null ? void 0 : l.useServerSidePagination
1721
- ]), k ? /* @__PURE__ */ e(sa, { rows: 6, columns: 6 }) : /* @__PURE__ */ d(E, { children: [
1722
- /* @__PURE__ */ d("div", { className: "flex flex-col sm:flex-row sm:justify-between gap-4 mb-3", children: [
1723
- /* @__PURE__ */ d("div", { children: [
1725
+ j.length,
1726
+ n.total_records,
1727
+ n == null ? void 0 : n.useServerSidePagination
1728
+ ]), k ? /* @__PURE__ */ e(sa, { rows: 6, columns: 6 }) : /* @__PURE__ */ c(E, { children: [
1729
+ /* @__PURE__ */ c("div", { className: "flex flex-col sm:flex-row sm:justify-between gap-4 mb-3", children: [
1730
+ /* @__PURE__ */ c("div", { children: [
1724
1731
  /* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-gray-900 dark:text-white", children: i }),
1725
1732
  /* @__PURE__ */ e("p", { className: "text-md text-gray-600 dark:text-gray-400", children: s })
1726
1733
  ] }),
1727
- /* @__PURE__ */ d("div", { className: "flex flex-col justify-end items-end gap-2", children: [
1728
- /* @__PURE__ */ d(
1734
+ /* @__PURE__ */ c("div", { className: "flex flex-col justify-end items-end gap-2", children: [
1735
+ /* @__PURE__ */ c(
1729
1736
  ee,
1730
1737
  {
1731
- onClick: () => n(!0),
1738
+ onClick: () => l(!0),
1732
1739
  variant: "contained",
1733
1740
  color: "primary",
1734
1741
  children: [
@@ -1737,29 +1744,29 @@ const na = ({
1737
1744
  ]
1738
1745
  }
1739
1746
  ),
1740
- /* @__PURE__ */ d("div", { className: "flex justify-end items-center gap-2", children: [
1741
- M.enabled && /* @__PURE__ */ e("div", { className: "", children: /* @__PURE__ */ d("div", { className: "relative min-w-[300px]", children: [
1747
+ /* @__PURE__ */ c("div", { className: "flex justify-end items-center gap-2", children: [
1748
+ w.enabled && /* @__PURE__ */ e("div", { className: "", children: /* @__PURE__ */ c("div", { className: "relative min-w-[300px]", children: [
1742
1749
  /* @__PURE__ */ e(Re, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 dark:text-gray-300" }),
1743
1750
  /* @__PURE__ */ e(
1744
1751
  "input",
1745
1752
  {
1746
1753
  type: "text",
1747
- placeholder: M.placeholder || "Search...",
1748
- value: x,
1754
+ placeholder: w.placeholder || "Search...",
1755
+ value: y,
1749
1756
  onChange: (r) => se(r.target.value),
1750
1757
  className: "w-full h-[36px] pl-9 pr-4 py-3 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-gray-50 dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none focus:ring-1 focus:ring-blue-300 dark:ring-blue-200 disabled:opacity-50"
1751
1758
  }
1752
1759
  )
1753
1760
  ] }) }),
1754
- v && u.enabled && /* @__PURE__ */ d(ee, { onClick: () => j(!0), variant: "contained", children: [
1761
+ v && b.enabled && /* @__PURE__ */ c(ee, { onClick: () => U(!0), variant: "contained", children: [
1755
1762
  /* @__PURE__ */ e(He, { className: "w-4 h-4 mr-2" }),
1756
1763
  "Filters"
1757
1764
  ] })
1758
1765
  ] })
1759
1766
  ] })
1760
1767
  ] }),
1761
- /* @__PURE__ */ d("div", { className: "bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden border border-gray-200 dark:border-gray-700", children: [
1762
- /* @__PURE__ */ e("div", { className: "overflow-x-auto", children: /* @__PURE__ */ d("table", { className: "min-w-full divide-y divide-gray-200 dark:divide-gray-700", children: [
1768
+ /* @__PURE__ */ c("div", { className: "bg-white dark:bg-gray-800 rounded-lg shadow overflow-hidden border border-gray-200 dark:border-gray-700", children: [
1769
+ /* @__PURE__ */ e("div", { className: "overflow-x-auto", children: /* @__PURE__ */ c("table", { className: "min-w-full divide-y divide-gray-200 dark:divide-gray-700", children: [
1763
1770
  /* @__PURE__ */ e("thead", { className: "bg-gray-50 dark:bg-gray-700/60", children: /* @__PURE__ */ e("tr", { children: p.map((r) => /* @__PURE__ */ e(
1764
1771
  "th",
1765
1772
  {
@@ -1773,7 +1780,7 @@ const na = ({
1773
1780
  {
1774
1781
  colSpan: p.length,
1775
1782
  className: "text-center py-10 text-gray-500 dark:text-gray-400",
1776
- children: c
1783
+ children: h
1777
1784
  }
1778
1785
  ) }) : X.map((r, f) => /* @__PURE__ */ e(
1779
1786
  "tr",
@@ -1793,20 +1800,20 @@ const na = ({
1793
1800
  r.id || r._id || f
1794
1801
  )) })
1795
1802
  ] }) }),
1796
- (l == null ? void 0 : l.enabled) && U.length > 0 && /* @__PURE__ */ d("div", { className: " bg-gray-50 dark:bg-gray-700/60 px-6 py-3 flex flex-wrap items-center justify-between border-t border-gray-200 dark:border-gray-600 gap-3", children: [
1797
- /* @__PURE__ */ d("div", { className: "text-sm text-gray-700 dark:text-gray-300", children: [
1803
+ (n == null ? void 0 : n.enabled) && j.length > 0 && /* @__PURE__ */ c("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: [
1804
+ /* @__PURE__ */ c("div", { className: "text-sm text-gray-700 dark:text-gray-300", children: [
1798
1805
  "Showing ",
1799
1806
  (O - 1) * q + 1,
1800
1807
  " to",
1801
1808
  " ",
1802
- Math.min(O * q, z),
1809
+ Math.min(O * q, H),
1803
1810
  " of ",
1804
- z,
1811
+ H,
1805
1812
  " ",
1806
1813
  "results"
1807
1814
  ] }),
1808
- /* @__PURE__ */ d("div", { className: "flex items-center gap-4", children: [
1809
- /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
1815
+ /* @__PURE__ */ c("div", { className: "flex items-center gap-4", children: [
1816
+ /* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
1810
1817
  /* @__PURE__ */ e("span", { className: "text-sm text-gray-700 dark:text-gray-300", children: "Rows per page:" }),
1811
1818
  /* @__PURE__ */ e(
1812
1819
  "select",
@@ -1814,7 +1821,7 @@ const na = ({
1814
1821
  value: q,
1815
1822
  onChange: (r) => {
1816
1823
  const f = Number(r.target.value);
1817
- w(f), Y(1), l.useServerSidePagination && y((P) => ({
1824
+ N(f), Y(1), n.useServerSidePagination && x((P) => ({
1818
1825
  ...P,
1819
1826
  current_page: 1,
1820
1827
  rows_per_page: f
@@ -1825,14 +1832,14 @@ const na = ({
1825
1832
  }
1826
1833
  )
1827
1834
  ] }),
1828
- /* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
1835
+ /* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
1829
1836
  /* @__PURE__ */ e(
1830
1837
  "button",
1831
1838
  {
1832
1839
  onClick: () => {
1833
1840
  if (O > 1) {
1834
1841
  const r = O - 1;
1835
- Y(r), l.useServerSidePagination && y((f) => ({
1842
+ Y(r), n.useServerSidePagination && x((f) => ({
1836
1843
  ...f,
1837
1844
  current_page: r
1838
1845
  }));
@@ -1843,7 +1850,7 @@ const na = ({
1843
1850
  children: /* @__PURE__ */ e(Ye, { className: "h-4 w-4" })
1844
1851
  }
1845
1852
  ),
1846
- /* @__PURE__ */ d("span", { className: "text-sm text-gray-800 dark:text-gray-200", children: [
1853
+ /* @__PURE__ */ c("span", { className: "text-sm text-gray-800 dark:text-gray-200", children: [
1847
1854
  "Page ",
1848
1855
  O,
1849
1856
  " of ",
@@ -1855,7 +1862,7 @@ const na = ({
1855
1862
  onClick: () => {
1856
1863
  if (O < J) {
1857
1864
  const r = O + 1;
1858
- Y(r), l.useServerSidePagination && y((f) => ({
1865
+ Y(r), n.useServerSidePagination && x((f) => ({
1859
1866
  ...f,
1860
1867
  current_page: r
1861
1868
  }));
@@ -1882,7 +1889,7 @@ const na = ({
1882
1889
  zIndex: 9999
1883
1890
  },
1884
1891
  className: "w-48 bg-white dark:bg-gray-700 rounded-md shadow-lg border border-gray-200 dark:border-gray-600",
1885
- children: C.map((r, f) => /* @__PURE__ */ d(
1892
+ children: C.map((r, f) => /* @__PURE__ */ c(
1886
1893
  "button",
1887
1894
  {
1888
1895
  onClick: (P) => de(
@@ -1908,9 +1915,9 @@ const na = ({
1908
1915
  ia,
1909
1916
  {
1910
1917
  isOpen: R,
1911
- onClose: () => j(!1),
1918
+ onClose: () => U(!1),
1912
1919
  config: v,
1913
- onApply: b
1920
+ onApply: d
1914
1921
  }
1915
1922
  ),
1916
1923
  G && /* @__PURE__ */ e(
@@ -1924,149 +1931,149 @@ const na = ({
1924
1931
  )
1925
1932
  ] });
1926
1933
  }, ve = ({
1927
- isOpen: h,
1928
- onClose: n,
1934
+ isOpen: u,
1935
+ onClose: l,
1929
1936
  icon: i,
1930
1937
  title: o,
1931
1938
  children: s,
1932
1939
  size: t = "md",
1933
1940
  actionButtons: p = [],
1934
1941
  actions: k,
1935
- showDefaultClose: M = !0,
1936
- footerConfig: u = null,
1937
- hideFooter: l = !1,
1938
- onFormSubmit: c = () => {
1942
+ showDefaultClose: w = !0,
1943
+ footerConfig: b = null,
1944
+ hideFooter: n = !1,
1945
+ onFormSubmit: h = () => {
1939
1946
  },
1940
1947
  onCancel: g,
1941
- loadingBtn: y = !1,
1942
- executeFunction: b = () => {
1948
+ loadingBtn: x = !1,
1949
+ executeFunction: d = () => {
1943
1950
  },
1944
1951
  selectedItem: v = null
1945
1952
  }) => {
1946
- if (!h) return null;
1947
- const x = {
1953
+ if (!u) return null;
1954
+ const y = {
1948
1955
  sm: "max-w-md",
1949
1956
  md: "max-w-lg",
1950
1957
  lg: "max-w-2xl",
1951
1958
  xl: "max-w-4xl",
1952
1959
  full: "max-w-full"
1953
1960
  };
1954
- return /* @__PURE__ */ d("div", { className: "fixed inset-0 z-50 flex items-center justify-center p-4", children: [
1961
+ return /* @__PURE__ */ c("div", { className: "fixed inset-0 z-50 flex items-center justify-center p-4", children: [
1955
1962
  /* @__PURE__ */ e(
1956
1963
  "div",
1957
1964
  {
1958
1965
  className: "fixed inset-0 bg-gray-500 opacity-75",
1959
- onClick: () => n()
1966
+ onClick: () => l()
1960
1967
  }
1961
1968
  ),
1962
- /* @__PURE__ */ d(
1969
+ /* @__PURE__ */ c(
1963
1970
  "div",
1964
1971
  {
1965
- className: `relative bg-white rounded-lg shadow-xl w-full ${x[t] || x.md} max-h-[90vh] flex flex-col dark:bg-gray-800`,
1972
+ className: `relative bg-white rounded-lg shadow-xl w-full ${y[t] || y.md} max-h-[90vh] flex flex-col dark:bg-gray-800`,
1966
1973
  children: [
1967
- /* @__PURE__ */ d("div", { className: "flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0", children: [
1968
- /* @__PURE__ */ d("div", { className: "flex items-center gap-1", children: [
1974
+ /* @__PURE__ */ c("div", { className: "flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700 flex-shrink-0", children: [
1975
+ /* @__PURE__ */ c("div", { className: "flex items-center gap-1", children: [
1969
1976
  i && /* @__PURE__ */ e("span", { children: i }),
1970
1977
  /* @__PURE__ */ e("h3", { className: "text-lg font-medium text-gray-900 dark:text-white", children: o })
1971
1978
  ] }),
1972
1979
  /* @__PURE__ */ e(
1973
1980
  "button",
1974
1981
  {
1975
- onClick: () => n(),
1982
+ onClick: () => l(),
1976
1983
  className: "text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",
1977
1984
  children: /* @__PURE__ */ e(we, { className: "w-6 h-6" })
1978
1985
  }
1979
1986
  )
1980
1987
  ] }),
1981
1988
  /* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-4", children: s }),
1982
- p.length > 0 && /* @__PURE__ */ e("div", { className: "px-4 py-3 flex justify-end gap-3 border-t border-gray-200 dark:border-gray-700 sm:px-6", children: p.map((N) => /* @__PURE__ */ e(
1989
+ p.length > 0 && /* @__PURE__ */ e("div", { className: "px-4 py-3 flex justify-end gap-3 border-t border-gray-200 dark:border-gray-700 sm:px-6", children: p.map((S) => /* @__PURE__ */ e(
1983
1990
  ee,
1984
1991
  {
1985
1992
  onClick: (I) => {
1986
- N.type == "submit" ? c(I) : b(
1993
+ S.type == "submit" ? h(I) : d(
1987
1994
  () => {
1988
1995
  var D;
1989
- return (D = N == null ? void 0 : N.onClick) == null ? void 0 : D.call(N, I, v);
1996
+ return (D = S == null ? void 0 : S.onClick) == null ? void 0 : D.call(S, I, v);
1990
1997
  },
1991
- (D) => n == null ? void 0 : n(D)
1998
+ (D) => l == null ? void 0 : l(D)
1992
1999
  );
1993
2000
  },
1994
- disabled: y || N.disabled,
1995
- variant: N.variant || "contained",
1996
- color: N.color || "primary",
1997
- className: `min-w-[100px] ${N.className}`,
1998
- type: N.type || "button",
1999
- children: y ? /* @__PURE__ */ d("div", { className: "flex items-center", children: [
2001
+ disabled: x || S.disabled,
2002
+ variant: S.variant || "contained",
2003
+ color: S.color || "primary",
2004
+ className: `min-w-[100px] ${S.className}`,
2005
+ type: S.type || "button",
2006
+ children: x ? /* @__PURE__ */ c("div", { className: "flex items-center", children: [
2000
2007
  /* @__PURE__ */ e("div", { className: "animate-spin rounded-full h-4 w-4 border-2 border-white/30 border-t-2 border-t-white mr-2" }),
2001
- N.label || "Submit",
2008
+ S.label || "Submit",
2002
2009
  "..."
2003
- ] }) : N.label || "Submit"
2010
+ ] }) : S.label || "Submit"
2004
2011
  }
2005
2012
  )) })
2006
2013
  ]
2007
2014
  }
2008
2015
  )
2009
2016
  ] });
2010
- }, De = ({ config: h, onSubmit: n, initialData: i = {}, type: o = "add" }) => {
2011
- const { formClass: s = "grid grid-cols-12 gap-4", formFields: t = [] } = h || {}, [p, k] = S(i);
2012
- H(() => {
2017
+ }, De = ({ config: u, onSubmit: l, initialData: i = {}, type: o = "add" }) => {
2018
+ const { formClass: s = "grid grid-cols-12 gap-4", formFields: t = [] } = u || {}, [p, k] = M(i);
2019
+ z(() => {
2013
2020
  k(i);
2014
2021
  }, []);
2015
- const M = (l, c) => {
2016
- k((g) => ({ ...g, [l]: c }));
2017
- }, u = (l) => {
2018
- l.preventDefault();
2019
- const c = l.target;
2020
- if (!c.checkValidity()) {
2021
- c.reportValidity();
2022
+ const w = (n, h) => {
2023
+ k((g) => ({ ...g, [n]: h }));
2024
+ }, b = (n) => {
2025
+ n.preventDefault();
2026
+ const h = n.target;
2027
+ if (!h.checkValidity()) {
2028
+ h.reportValidity();
2022
2029
  return;
2023
2030
  }
2024
- n(p);
2031
+ l(p);
2025
2032
  };
2026
2033
  return /* @__PURE__ */ e(
2027
2034
  "form",
2028
2035
  {
2029
2036
  id: o == "add" ? "addForm" : o == "edit" ? "editForm" : "defaultForm",
2030
- onSubmit: u,
2037
+ onSubmit: b,
2031
2038
  className: s,
2032
2039
  noValidate: !1,
2033
- children: t.map((l) => /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(
2040
+ children: t.map((n) => /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(
2034
2041
  Ue,
2035
2042
  {
2036
- field: l,
2043
+ field: n,
2037
2044
  formData: p,
2038
- handleChange: M
2045
+ handleChange: w
2039
2046
  },
2040
- l.key
2047
+ n.key
2041
2048
  ) }))
2042
2049
  }
2043
2050
  );
2044
2051
  };
2045
- function ca({ data: h, config: n }) {
2046
- const { fields: i, containerClass: o } = n, [s, t] = S(null), [p, k] = S(!1), M = (c) => {
2047
- c && c.src instanceof File && (c = { ...c, src: URL.createObjectURL(c.src) }), t(c), k(!0);
2048
- }, u = ({ col: c }) => {
2052
+ function ca({ data: u, config: l }) {
2053
+ const { fields: i, containerClass: o } = l, [s, t] = M(null), [p, k] = M(!1), w = (h) => {
2054
+ h && h.src instanceof File && (h = { ...h, src: URL.createObjectURL(h.src) }), t(h), k(!0);
2055
+ }, b = ({ col: h }) => {
2049
2056
  var I;
2050
- let g = c == null ? void 0 : c.icon, y = c.label, b = h[c.key], v = c.type, x = c.variant || "outline", N = c.defaultColor;
2051
- if (v === "chip" && ((I = c.chipOptions) == null ? void 0 : I.length) > 0) {
2052
- let D = c == null ? void 0 : c.chipOptions.find((C) => C.value == b);
2053
- D && (b = D.label, N = D.color);
2057
+ let g = h == null ? void 0 : h.icon, x = h.label, d = u[h.key], v = h.type, y = h.variant || "outline", S = h.defaultColor;
2058
+ if (v === "chip" && ((I = h.chipOptions) == null ? void 0 : I.length) > 0) {
2059
+ let D = h == null ? void 0 : h.chipOptions.find((C) => C.value == d);
2060
+ D && (d = D.label, S = D.color);
2054
2061
  }
2055
- return /* @__PURE__ */ d(
2062
+ return /* @__PURE__ */ c(
2056
2063
  "div",
2057
2064
  {
2058
2065
  className: `col-span-12 flex items-center space-x-4 p-4 rounded-xl
2059
- bg-gray-100 dark:bg-gray-900 ${c.blockClass || ""}`,
2066
+ bg-gray-100 dark:bg-gray-900 ${h.blockClass || ""}`,
2060
2067
  children: [
2061
2068
  g && /* @__PURE__ */ e("div", { className: "flex-shrink-0", children: g }),
2062
- /* @__PURE__ */ d("div", { className: "flex-1 min-w-0", children: [
2063
- /* @__PURE__ */ e("p", { className: "text-sm font-medium text-gray-500 dark:text-gray-400", children: y }),
2069
+ /* @__PURE__ */ c("div", { className: "flex-1 min-w-0", children: [
2070
+ /* @__PURE__ */ e("p", { className: "text-sm font-medium text-gray-500 dark:text-gray-400", children: x }),
2064
2071
  v === "chip" ? /* @__PURE__ */ e(
2065
2072
  je,
2066
2073
  {
2067
- label: b,
2068
- variant: x,
2069
- color: N,
2074
+ label: d,
2075
+ variant: y,
2076
+ color: S,
2070
2077
  className: "mt-1"
2071
2078
  }
2072
2079
  ) : (
@@ -2076,54 +2083,54 @@ function ca({ data: h, config: n }) {
2076
2083
  {
2077
2084
  className: "mt-1 text-sm text-gray-900 dark:text-white break-words",
2078
2085
  dangerouslySetInnerHTML: {
2079
- __html: b
2086
+ __html: d
2080
2087
  }
2081
2088
  }
2082
- ) : v === "audio" ? b ? /* @__PURE__ */ e(
2089
+ ) : v === "audio" ? d ? /* @__PURE__ */ e(
2083
2090
  "audio",
2084
2091
  {
2085
2092
  controls: !0,
2086
- src: b instanceof File ? URL.createObjectURL(b) : b,
2093
+ src: d instanceof File ? URL.createObjectURL(d) : d,
2087
2094
  onClick: (D) => D.stopPropagation(),
2088
2095
  className: "shadow-md rounded-full"
2089
2096
  },
2090
- b instanceof File ? URL.createObjectURL(b) : b
2097
+ d instanceof File ? URL.createObjectURL(d) : d
2091
2098
  ) : /* @__PURE__ */ e("p", { className: "mt-1 text-sm text-gray-400", children: "N/A" }) : (
2092
2099
  /* DEFAULT */
2093
- /* @__PURE__ */ e("p", { className: "mt-1 text-sm text-gray-900 dark:text-white break-words", children: v == "date" ? /* @__PURE__ */ e("span", { children: Pe(b, c.format || "DD MMM YYYY") }) : b || "N/A" })
2100
+ /* @__PURE__ */ e("p", { className: "mt-1 text-sm text-gray-900 dark:text-white break-words", children: v == "date" ? /* @__PURE__ */ e("span", { children: Pe(d, h.format || "DD MMM YYYY") }) : d || "N/A" })
2094
2101
  )
2095
2102
  )
2096
2103
  ] })
2097
2104
  ]
2098
2105
  }
2099
2106
  );
2100
- }, l = ({ col: c }) => {
2101
- let g = h[c.titleKey], y = h[c.subtitleKey], b = h[c.imageKey], v = h[c.fallback_icon];
2102
- return /* @__PURE__ */ d(
2107
+ }, n = ({ col: h }) => {
2108
+ let g = u[h.titleKey], x = u[h.subtitleKey], d = u[h.imageKey], v = u[h.fallback_icon];
2109
+ return /* @__PURE__ */ c(
2103
2110
  "div",
2104
2111
  {
2105
2112
  className: `col-span-12 flex items-center space-x-4 p-4 rounded-xl
2106
2113
  bg-gray-100 dark:bg-gray-900
2107
- ${c.blockClass}`,
2114
+ ${h.blockClass}`,
2108
2115
  children: [
2109
- b ? /* @__PURE__ */ e(
2116
+ d ? /* @__PURE__ */ e(
2110
2117
  "img",
2111
2118
  {
2112
- src: b instanceof File ? URL.createObjectURL(b) : b,
2119
+ src: d instanceof File ? URL.createObjectURL(d) : d,
2113
2120
  alt: g,
2114
- onClick: () => M({ src: b, alt: g }),
2121
+ onClick: () => w({ src: d, alt: g }),
2115
2122
  className: "w-16 h-16 cursor-pointer rounded-full object-cover border-2 border-gray-200 dark:border-gray-700"
2116
2123
  }
2117
2124
  ) : v || /* @__PURE__ */ e("div", { className: "w-16 h-16 flex items-center justify-center rounded-full border-2 border-gray-300 dark:border-gray-700 bg-gray-200 dark:bg-gray-600", children: /* @__PURE__ */ e(Fe, { className: "w-8 h-8 text-gray-400" }) }),
2118
- /* @__PURE__ */ d("div", { children: [
2125
+ /* @__PURE__ */ c("div", { children: [
2119
2126
  /* @__PURE__ */ e("h3", { className: "text-xl font-semibold text-gray-900 dark:text-white", children: g }),
2120
- /* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: y })
2127
+ /* @__PURE__ */ e("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: x })
2121
2128
  ] })
2122
2129
  ]
2123
2130
  }
2124
2131
  );
2125
2132
  };
2126
- return /* @__PURE__ */ d(E, { children: [
2133
+ return /* @__PURE__ */ c(E, { children: [
2127
2134
  p && /* @__PURE__ */ e(
2128
2135
  Ee,
2129
2136
  {
@@ -2134,28 +2141,28 @@ function ca({ data: h, config: n }) {
2134
2141
  }
2135
2142
  ),
2136
2143
  /* @__PURE__ */ e("div", { className: `grid grid-cols-12 gap-4 ${o || ""}`, children: i.map(
2137
- (c) => c.type == "group" ? /* @__PURE__ */ e(l, { col: c }) : /* @__PURE__ */ e(u, { col: c })
2144
+ (h) => h.type == "group" ? /* @__PURE__ */ e(n, { col: h }) : /* @__PURE__ */ e(b, { col: h })
2138
2145
  ) })
2139
2146
  ] });
2140
2147
  }
2141
- const $e = ({ config: h }) => {
2148
+ const $e = ({ config: u }) => {
2142
2149
  var se, de, ce, he, ue, oe, be, pe, ge, me, fe, ye, r, f, P, _;
2143
2150
  const {
2144
- title: n,
2151
+ title: l,
2145
2152
  fetchData: i = async () => {
2146
2153
  },
2147
2154
  isStaticData: o = !1,
2148
2155
  tableConfig: s = {},
2149
2156
  modalConfig: t = {},
2150
2157
  filterConfig: p
2151
- } = h, [k, M] = S(!0), [u, l] = S(!1), [c, g] = S([]), [y, b] = S(null), [v, x] = S({
2158
+ } = u, [k, w] = M(!0), [b, n] = M(!1), [h, g] = M([]), [x, d] = M(null), [v, y] = M({
2152
2159
  search: "",
2153
2160
  rows_per_page: 50,
2154
2161
  current_page: 1
2155
- }), [N, I] = S({}), [D, C] = S(!1), [A, B] = S(!1), [F, R] = S(!1), [j, $] = S(!1), [W, G] = S(!1), [K, U] = S(null), O = (m, L) => {
2156
- m === "edit" ? (U(L), R(!0)) : m === "view" ? (U(L), G(!0)) : m === "delete" && (U(L), $(!0));
2162
+ }), [S, I] = M({}), [D, C] = M(!1), [A, B] = M(!1), [F, R] = M(!1), [U, $] = M(!1), [W, G] = M(!1), [K, j] = M(null), O = (m, L) => {
2163
+ m === "edit" ? (j(L), R(!0)) : m === "view" ? (j(L), G(!0)) : m === "delete" && (j(L), $(!0));
2157
2164
  }, Y = async (m, L, T = "", Z = "") => {
2158
- l(!0);
2165
+ n(!0);
2159
2166
  try {
2160
2167
  const V = await (m == null ? void 0 : m());
2161
2168
  (T || V.message) && ke(T || V.message, {
@@ -2164,35 +2171,35 @@ const $e = ({ config: h }) => {
2164
2171
  } catch (V) {
2165
2172
  (Z || V.message) && ke(Z || V.message, { variant: "error" });
2166
2173
  } finally {
2167
- l(!1);
2174
+ n(!1);
2168
2175
  }
2169
2176
  }, q = (m) => {
2170
2177
  let L = m.newObject;
2171
- o ? (g((T) => [L, ...T]), b((T) => ({
2178
+ o ? (g((T) => [L, ...T]), d((T) => ({
2172
2179
  ...T,
2173
2180
  current_page: 1
2174
- }))) : (x((T) => ({
2181
+ }))) : (y((T) => ({
2175
2182
  ...T,
2176
2183
  current_page: 1
2177
2184
  })), v.current_page == 1 && X()), B(!1);
2178
- }, w = (m) => {
2185
+ }, N = (m) => {
2179
2186
  let L = m.newObject, T = m.targetObject;
2180
2187
  o ? g(
2181
2188
  (Z) => Z.map(
2182
2189
  (V) => V.id === T.id ? { ...V, ...L } : V
2183
2190
  )
2184
2191
  ) : X(), R(!1);
2185
- }, z = (m) => {
2192
+ }, H = (m) => {
2186
2193
  if (!m) {
2187
- $(!1), U(null);
2194
+ $(!1), j(null);
2188
2195
  return;
2189
2196
  }
2190
2197
  o ? g(
2191
2198
  (L) => L.filter((T) => T.id !== m.targetObject.id)
2192
- ) : c.length == 1 && v.current_page > 1 ? x((L) => ({
2199
+ ) : h.length == 1 && v.current_page > 1 ? y((L) => ({
2193
2200
  ...L,
2194
2201
  current_page: L.current_page - 1
2195
- })) : X(), $(!1), U(null);
2202
+ })) : X(), $(!1), j(null);
2196
2203
  }, re = (m) => Y(
2197
2204
  () => {
2198
2205
  var L, T;
@@ -2204,14 +2211,14 @@ const $e = ({ config: h }) => {
2204
2211
  var L, T;
2205
2212
  return (T = (L = t == null ? void 0 : t.editModal) == null ? void 0 : L.handleSubmit) == null ? void 0 : T.call(L, m, K);
2206
2213
  },
2207
- w
2214
+ N
2208
2215
  ), X = async () => {
2209
- M(!0), i == null || i({ ...v, ...N }).then((m) => {
2210
- g(m.data), b(m.pagination);
2216
+ w(!0), i == null || i({ ...v, ...S }).then((m) => {
2217
+ g(m.data), d(m.pagination);
2211
2218
  }).catch((m) => {
2212
2219
  ke(m.message, { variant: "error" });
2213
2220
  }).finally(() => {
2214
- M(!1);
2221
+ w(!1);
2215
2222
  });
2216
2223
  }, ne = (m) => {
2217
2224
  var L;
@@ -2222,9 +2229,9 @@ const $e = ({ config: h }) => {
2222
2229
  (T) => Object.entries(L).every(([Z, V]) => T[Z] === V)
2223
2230
  ), le = Me(() => {
2224
2231
  var m;
2225
- return (m = s == null ? void 0 : s.filter) != null && m.useServerSideFilters ? c : ie(c, N);
2226
- }, [c, N]);
2227
- return H(() => {
2232
+ return (m = s == null ? void 0 : s.filter) != null && m.useServerSideFilters ? h : ie(h, S);
2233
+ }, [h, S]);
2234
+ return z(() => {
2228
2235
  X();
2229
2236
  }, [
2230
2237
  v.search,
@@ -2252,22 +2259,22 @@ const $e = ({ config: h }) => {
2252
2259
  children: /* @__PURE__ */ e(we, { className: "h-4 w-4" })
2253
2260
  }
2254
2261
  ),
2255
- children: /* @__PURE__ */ d("div", { children: [
2262
+ children: /* @__PURE__ */ c("div", { children: [
2256
2263
  /* @__PURE__ */ e(
2257
2264
  da,
2258
2265
  {
2259
- title: n,
2266
+ title: l,
2260
2267
  setShowAdd: B,
2261
- description: h.description,
2262
- buttonText: h.buttonText,
2268
+ description: u.description,
2269
+ buttonText: u.buttonText,
2263
2270
  config: {
2264
2271
  ...s,
2265
2272
  pagination: {
2266
2273
  ...s.pagination,
2267
- ...y
2274
+ ...x
2268
2275
  },
2269
2276
  data: le,
2270
- setServerSidePaginationData: x,
2277
+ setServerSidePaginationData: y,
2271
2278
  onMenuAction: O,
2272
2279
  filterConfig: p,
2273
2280
  onFilterApply: ne,
@@ -2280,7 +2287,7 @@ const $e = ({ config: h }) => {
2280
2287
  {
2281
2288
  isOpen: A,
2282
2289
  onClose: () => {
2283
- u || B(!1);
2290
+ b || B(!1);
2284
2291
  },
2285
2292
  icon: (se = t.addModal) == null ? void 0 : se.icon,
2286
2293
  title: ((de = t.addModal) == null ? void 0 : de.title) || "Add New",
@@ -2289,7 +2296,7 @@ const $e = ({ config: h }) => {
2289
2296
  var m;
2290
2297
  return (m = document.querySelector("#addForm")) == null ? void 0 : m.requestSubmit();
2291
2298
  },
2292
- loadingBtn: u,
2299
+ loadingBtn: b,
2293
2300
  actionButtons: t.addModal.actionButtons,
2294
2301
  children: /* @__PURE__ */ e(
2295
2302
  De,
@@ -2298,7 +2305,7 @@ const $e = ({ config: h }) => {
2298
2305
  onSubmit: re,
2299
2306
  initialData: {},
2300
2307
  type: "add",
2301
- loading: u
2308
+ loading: b
2302
2309
  }
2303
2310
  )
2304
2311
  }
@@ -2308,7 +2315,7 @@ const $e = ({ config: h }) => {
2308
2315
  {
2309
2316
  isOpen: F,
2310
2317
  onClose: () => {
2311
- u || R(!1);
2318
+ b || R(!1);
2312
2319
  },
2313
2320
  icon: (he = t.editModal) == null ? void 0 : he.icon,
2314
2321
  title: ((ue = t.editModal) == null ? void 0 : ue.title) || "Edit",
@@ -2318,7 +2325,7 @@ const $e = ({ config: h }) => {
2318
2325
  return (m = document.querySelector("#editForm")) == null ? void 0 : m.requestSubmit();
2319
2326
  },
2320
2327
  actionButtons: t.editModal.actionButtons,
2321
- loadingBtn: u,
2328
+ loadingBtn: b,
2322
2329
  children: /* @__PURE__ */ e(
2323
2330
  De,
2324
2331
  {
@@ -2326,26 +2333,26 @@ const $e = ({ config: h }) => {
2326
2333
  onSubmit: J,
2327
2334
  initialData: K,
2328
2335
  type: "edit",
2329
- loading: u
2336
+ loading: b
2330
2337
  }
2331
2338
  )
2332
2339
  }
2333
2340
  ),
2334
- j && /* @__PURE__ */ e(
2341
+ U && /* @__PURE__ */ e(
2335
2342
  ve,
2336
2343
  {
2337
- isOpen: j,
2344
+ isOpen: U,
2338
2345
  onClose: (m) => {
2339
- z(m);
2346
+ H(m);
2340
2347
  },
2341
2348
  icon: ((be = t.deleteModal) == null ? void 0 : be.icon) || /* @__PURE__ */ e(te, { icon: "ph:warning-bold", className: "w-6 h-6 text-red-500" }),
2342
2349
  title: ((pe = t.deleteModal) == null ? void 0 : pe.title) || "Confirm Delete",
2343
2350
  size: ((ge = t.deleteModal) == null ? void 0 : ge.size) || "md",
2344
- loading: u,
2351
+ loading: b,
2345
2352
  actionButtons: t.deleteModal.actionButtons,
2346
2353
  executeFunction: Y,
2347
2354
  selectedItem: K,
2348
- children: /* @__PURE__ */ e("div", { className: "flex items-center space-x-2 py-3", children: /* @__PURE__ */ d("div", { children: [
2355
+ children: /* @__PURE__ */ e("div", { className: "flex items-center space-x-2 py-3", children: /* @__PURE__ */ c("div", { children: [
2349
2356
  /* @__PURE__ */ e("p", { className: "text-md text-gray-700 dark:text-white", children: ((me = t.deleteModal) == null ? void 0 : me.confirmText) || "Are you sure you want to delete this item?" }),
2350
2357
  ((fe = t.deleteModal) == null ? void 0 : fe.referenceKey) && /* @__PURE__ */ e("p", { className: "text-md font-semibold text-gray-700 dark:text-white", children: K[(ye = t.deleteModal) == null ? void 0 : ye.referenceKey] })
2351
2358
  ] }) })
@@ -2356,7 +2363,7 @@ const $e = ({ config: h }) => {
2356
2363
  {
2357
2364
  isOpen: W,
2358
2365
  onClose: () => {
2359
- G(!1), U(null);
2366
+ G(!1), j(null);
2360
2367
  },
2361
2368
  icon: (r = t.viewModal) == null ? void 0 : r.icon,
2362
2369
  title: ((f = t.viewModal) == null ? void 0 : f.title) || "View Details",
@@ -2510,9 +2517,9 @@ $e.propTypes = {
2510
2517
  };
2511
2518
  const pa = () => {
2512
2519
  if (typeof document > "u" || document.getElementById("react-admin-crud-manager-styles")) return;
2513
- const h = document.createElement("style");
2514
- h.id = "react-admin-crud-manager-styles";
2515
- const n = `
2520
+ const u = document.createElement("style");
2521
+ u.id = "react-admin-crud-manager-styles";
2522
+ const l = `
2516
2523
  .no-spinner::-webkit-outer-spin-button,
2517
2524
  .no-spinner::-webkit-inner-spin-button {
2518
2525
  -webkit-appearance: none;
@@ -2528,12 +2535,12 @@ const pa = () => {
2528
2535
  box-shadow: none !important;
2529
2536
  }
2530
2537
  `;
2531
- h.textContent = n, document.head.appendChild(h);
2538
+ u.textContent = l, document.head.appendChild(u);
2532
2539
  };
2533
- function Ma(h) {
2534
- return H(() => {
2540
+ function Ma(u) {
2541
+ return z(() => {
2535
2542
  pa();
2536
- }, []), /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e($e, { config: h.config }) });
2543
+ }, []), /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e($e, { config: u.config }) });
2537
2544
  }
2538
2545
  export {
2539
2546
  Ma as default