react-admin-crud-manager 1.0.14 → 1.0.16

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