react-admin-crud-manager 1.0.17 → 1.0.19

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