react-admin-crud-manager 1.0.23 → 1.0.25

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