react-admin-crud-manager 1.0.24 → 1.0.26

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