react-admin-crud-manager 1.0.11 → 1.0.12

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