react-admin-crud-manager 1.0.14 → 1.0.15

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