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