rharuow-ds 1.5.4 → 1.6.0

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.
@@ -1,243 +1,244 @@
1
1
  import * as e from "react";
2
- import M, { useState as pe, useRef as be, useEffect as Le } from "react";
2
+ import k, { useState as me, useRef as be, useEffect as Be } from "react";
3
3
  import { useFormContext as ie, useWatch as ce } from "react-hook-form";
4
- function ve(t) {
5
- var o, r, s = "";
6
- if (typeof t == "string" || typeof t == "number") s += t;
4
+ import { createPortal as ve } from "react-dom";
5
+ function xe(t) {
6
+ var o, r, n = "";
7
+ if (typeof t == "string" || typeof t == "number") n += t;
7
8
  else if (typeof t == "object") if (Array.isArray(t)) {
8
- var f = t.length;
9
- for (o = 0; o < f; o++) t[o] && (r = ve(t[o])) && (s && (s += " "), s += r);
10
- } else for (r in t) t[r] && (s && (s += " "), s += r);
11
- return s;
9
+ var c = t.length;
10
+ for (o = 0; o < c; o++) t[o] && (r = xe(t[o])) && (n && (n += " "), n += r);
11
+ } else for (r in t) t[r] && (n && (n += " "), n += r);
12
+ return n;
12
13
  }
13
- function Be() {
14
- for (var t, o, r = 0, s = "", f = arguments.length; r < f; r++) (t = arguments[r]) && (o = ve(t)) && (s && (s += " "), s += o);
15
- return s;
14
+ function Me() {
15
+ for (var t, o, r = 0, n = "", c = arguments.length; r < c; r++) (t = arguments[r]) && (o = xe(t)) && (n && (n += " "), n += o);
16
+ return n;
16
17
  }
17
- function u(...t) {
18
- return Be(...t);
18
+ function i(...t) {
19
+ return Me(...t);
19
20
  }
20
- const He = ({
21
+ const je = ({
21
22
  children: t,
22
23
  variant: o = "default",
23
24
  className: r = "",
24
- ...s
25
+ ...n
25
26
  }) => {
26
- const f = "px-4 py-2 rounded font-medium transition", y = {
27
+ const c = "px-4 py-2 rounded font-medium transition", N = {
27
28
  default: "bg-[var(--primary,#2563eb)] text-[var(--primary-text,#fff)] hover:bg-[var(--primary-hover,#1d4ed8)]",
28
29
  outline: "border border-[var(--primary,#2563eb)] text-[var(--primary,#2563eb)] bg-white hover:bg-[var(--primary-hover,#e0e7ff)]",
29
30
  secondary: "bg-[var(--secondary,#fbbf24)] text-[var(--secondary-text,#222)] hover:bg-[var(--secondary-hover,#f59e42)]"
30
31
  };
31
- return /* @__PURE__ */ M.createElement("button", { className: u(f, y[o], r), ...s }, t);
32
+ return /* @__PURE__ */ k.createElement("button", { className: i(c, N[o], r), ...n }, t);
32
33
  }, _e = e.forwardRef(
33
34
  ({
34
35
  name: t,
35
36
  className: o,
36
37
  type: r = "text",
37
- label: s,
38
- onFocus: f,
39
- onBlur: y,
40
- Icon: m,
41
- iconClassName: z,
42
- iconAction: T,
43
- containerClassName: E,
44
- ...v
45
- }, w) => {
46
- var q, D, I;
47
- const [p, B] = e.useState(!1), [h, S] = e.useState(!1), c = ie(), i = c == null ? void 0 : c.control, x = c == null ? void 0 : c.register, _ = i && t ? ce({ control: i, name: t }) : void 0, k = v.value ?? _ ?? "", g = (I = (D = (q = c == null ? void 0 : c.formState) == null ? void 0 : q.errors) == null ? void 0 : D[t]) == null ? void 0 : I.message, $ = ["date", "datetime-local", "time", "month", "week"].includes(r), b = p || !!k || $, H = r === "password" ? h ? "text" : "password" : r, V = () => /* @__PURE__ */ e.createElement("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ e.createElement(
38
+ label: n,
39
+ onFocus: c,
40
+ onBlur: N,
41
+ Icon: p,
42
+ iconClassName: T,
43
+ iconAction: F,
44
+ containerClassName: S,
45
+ ...x
46
+ }, h) => {
47
+ var q, D, A;
48
+ const [f, B] = e.useState(!1), [y, M] = e.useState(!1), d = ie(), v = d == null ? void 0 : d.control, g = d == null ? void 0 : d.register, E = v && t ? ce({ control: v, name: t }) : void 0, b = x.value ?? E ?? "", w = (A = (D = (q = d == null ? void 0 : d.formState) == null ? void 0 : q.errors) == null ? void 0 : D[t]) == null ? void 0 : A.message, z = ["date", "datetime-local", "time", "month", "week"].includes(r), m = f || !!b || z, H = r === "password" ? y ? "text" : "password" : r, V = () => /* @__PURE__ */ e.createElement("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ e.createElement(
48
49
  "path",
49
50
  {
50
51
  d: "M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z",
51
52
  fill: "currentColor"
52
53
  }
53
- )), C = () => /* @__PURE__ */ e.createElement("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ e.createElement(
54
+ )), R = () => /* @__PURE__ */ e.createElement("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ e.createElement(
54
55
  "path",
55
56
  {
56
57
  d: "M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z",
57
58
  fill: "currentColor"
58
59
  }
59
60
  )), G = () => {
60
- S(!h);
61
+ M(!y);
61
62
  };
62
- return /* @__PURE__ */ e.createElement("div", { className: u("relative", E) }, /* @__PURE__ */ e.createElement(
63
+ return /* @__PURE__ */ e.createElement("div", { className: i("relative", S) }, /* @__PURE__ */ e.createElement(
63
64
  "input",
64
65
  {
65
- id: v.id || t,
66
+ id: x.id || t,
66
67
  type: H,
67
- className: u(
68
+ className: i(
68
69
  "peer flex h-12 w-full border border-[var(--primary,#2563eb)] rounded-md bg-[var(--input-bg,#fff)] text-[var(--input-text,#222)] px-3 pt-6 pb-2 text-sm placeholder-transparent transition focus:outline-none focus:border-[var(--primary,#2563eb)] disabled:cursor-not-allowed disabled:opacity-50",
69
- r === "password" || m ? "pr-12" : "",
70
+ r === "password" || p ? "pr-12" : "",
70
71
  // espaço extra para qualquer ícone (password ou customizado)
71
72
  o
72
73
  ),
73
- onFocus: (N) => {
74
- B(!0), f && f(N);
74
+ onFocus: (L) => {
75
+ B(!0), c && c(L);
75
76
  },
76
- ...c && t ? (() => {
77
- const N = x(t), J = N.onBlur;
77
+ ...d && t ? (() => {
78
+ const L = g(t), J = L.onBlur;
78
79
  return {
79
- ...N,
80
- ref: (A) => {
81
- typeof w == "function" ? w(A) : w && (w.current = A), N.ref && N.ref(A);
80
+ ...L,
81
+ ref: (O) => {
82
+ typeof h == "function" ? h(O) : h && (h.current = O), L.ref && L.ref(O);
82
83
  },
83
- onBlur: (A) => {
84
- B(!1), y && y(A), J && J(A);
84
+ onBlur: (O) => {
85
+ B(!1), N && N(O), J && J(O);
85
86
  }
86
87
  };
87
88
  })() : {
88
- ref: w,
89
- onBlur: (N) => {
90
- B(!1), y && y(N);
89
+ ref: h,
90
+ onBlur: (L) => {
91
+ B(!1), N && N(L);
91
92
  }
92
93
  },
93
- ...v
94
+ ...x
94
95
  }
95
- ), s && /* @__PURE__ */ e.createElement(
96
+ ), n && /* @__PURE__ */ e.createElement(
96
97
  "label",
97
98
  {
98
- htmlFor: v.id || t,
99
- className: u(
99
+ htmlFor: x.id || t,
100
+ className: i(
100
101
  "absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",
101
- b ? "top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white" : "top-3 scale-100 translate-y-0.5"
102
+ m ? "top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white" : "top-3 scale-100 translate-y-0.5"
102
103
  )
103
104
  },
104
- s
105
+ n
105
106
  ), r === "password" && /* @__PURE__ */ e.createElement(
106
107
  "button",
107
108
  {
108
109
  type: "button",
109
110
  className: "absolute top-1/2 right-3 -translate-y-1/2 text-gray-400 hover:text-[var(--primary,#2563eb)] transition-colors duration-200 focus:outline-none focus:text-[var(--primary,#2563eb)]",
110
111
  onClick: G,
111
- "aria-label": h ? "Esconder senha" : "Mostrar senha",
112
+ "aria-label": y ? "Esconder senha" : "Mostrar senha",
112
113
  tabIndex: -1
113
114
  },
114
- h ? /* @__PURE__ */ e.createElement(C, null) : /* @__PURE__ */ e.createElement(V, null)
115
- ), m && r !== "password" && /* @__PURE__ */ e.createElement(
115
+ y ? /* @__PURE__ */ e.createElement(R, null) : /* @__PURE__ */ e.createElement(V, null)
116
+ ), p && r !== "password" && /* @__PURE__ */ e.createElement(
116
117
  "div",
117
118
  {
118
- className: u(
119
+ className: i(
119
120
  "absolute top-1/2 right-3 -translate-y-1/2 text-gray-400 cursor-pointer hover:text-[var(--primary,#2563eb)] transition-colors duration-200",
120
- z
121
+ T
121
122
  ),
122
- onClick: T
123
+ onClick: F
123
124
  },
124
- /* @__PURE__ */ e.createElement(m, null)
125
- ), g && /* @__PURE__ */ e.createElement("span", { className: "text-red-500 text-xs mt-1 block" }, g));
125
+ /* @__PURE__ */ e.createElement(p, null)
126
+ ), w && /* @__PURE__ */ e.createElement("span", { className: "text-red-500 text-xs mt-1 block" }, w));
126
127
  }
127
128
  );
128
129
  _e.displayName = "Input";
129
- const Me = e.forwardRef(
130
+ const Fe = e.forwardRef(
130
131
  ({
131
132
  name: t,
132
133
  label: o,
133
134
  options: r,
134
- className: s,
135
- containerClassName: f,
136
- isClearable: y,
137
- searchable: m = !1,
138
- filterPlaceholder: z = "Digite para filtrar...",
139
- caseSensitive: T = !1,
140
- filterFunction: E,
141
- onFocus: v,
142
- onBlur: w,
143
- ...p
135
+ className: n,
136
+ containerClassName: c,
137
+ isClearable: N,
138
+ searchable: p = !1,
139
+ filterPlaceholder: T = "Digite para filtrar...",
140
+ caseSensitive: F = !1,
141
+ filterFunction: S,
142
+ onFocus: x,
143
+ onBlur: h,
144
+ ...f
144
145
  }, B) => {
145
- var ee, re, n, F;
146
- const [h, S] = e.useState(!1), [c, i] = e.useState(!1), [x, _] = e.useState(""), [k, g] = e.useState({
146
+ var ee, re, l, P;
147
+ const [y, M] = e.useState(!1), [d, v] = e.useState(!1), [g, E] = e.useState(""), [b, w] = e.useState({
147
148
  top: 0,
148
149
  left: 0,
149
150
  width: 0
150
- }), R = e.useRef(null), $ = e.useRef(null), b = ie(), H = b == null ? void 0 : b.control, V = H && t ? ce({ control: H, name: t }) : void 0, C = p.value ?? V ?? "", G = (n = (re = (ee = b == null ? void 0 : b.formState) == null ? void 0 : ee.errors) == null ? void 0 : re[t]) == null ? void 0 : n.message, D = E || ((a, P) => {
151
- const j = T ? a.label : a.label.toLowerCase(), Q = T ? P : P.toLowerCase();
151
+ }), C = e.useRef(null), z = e.useRef(null), m = ie(), H = m == null ? void 0 : m.control, V = H && t ? ce({ control: H, name: t }) : void 0, R = f.value ?? V ?? "", G = (l = (re = (ee = m == null ? void 0 : m.formState) == null ? void 0 : ee.errors) == null ? void 0 : re[t]) == null ? void 0 : l.message, D = S || ((a, I) => {
152
+ const j = F ? a.label : a.label.toLowerCase(), Q = F ? I : I.toLowerCase();
152
153
  return j.includes(Q);
153
- }), I = x.trim() ? r.filter((a) => D(a, x.trim())) : r, N = r.find((a) => a.value === C), J = m && c ? x : (N == null ? void 0 : N.label) || "", A = h || !!C || m && !!x, O = e.useCallback(() => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || window.innerWidth <= 768, []), U = e.useCallback(() => {
154
- if (R.current && c) {
155
- const a = R.current.getBoundingClientRect(), P = O(), j = window.innerHeight, Q = window.innerWidth, Y = 152;
156
- let d = a.bottom + 4, W = a.left;
157
- if (P) {
158
- const te = j - a.bottom, l = a.top;
159
- te < Y && l > Y && (d = a.top - Y - 4);
160
- const L = 16, K = Q - a.width - L;
161
- W = Math.min(Math.max(W, L), K);
154
+ }), A = g.trim() ? r.filter((a) => D(a, g.trim())) : r, L = r.find((a) => a.value === R), J = p && d ? g : (L == null ? void 0 : L.label) || "", O = y || !!R || p && !!g, $ = e.useCallback(() => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || window.innerWidth <= 768, []), U = e.useCallback(() => {
155
+ if (C.current && d) {
156
+ const a = C.current.getBoundingClientRect(), I = $(), j = window.innerHeight, Q = window.innerWidth, Y = 152;
157
+ let u = a.bottom + 4, W = a.left;
158
+ if (I) {
159
+ const te = j - a.bottom, s = a.top;
160
+ te < Y && s > Y && (u = a.top - Y - 4);
161
+ const _ = 16, K = Q - a.width - _;
162
+ W = Math.min(Math.max(W, _), K);
162
163
  } else
163
- j - a.bottom < Y && (d = a.top - Y - 4);
164
- g({
165
- top: d,
164
+ j - a.bottom < Y && (u = a.top - Y - 4);
165
+ w({
166
+ top: u,
166
167
  left: W,
167
168
  width: a.width
168
169
  });
169
170
  }
170
- }, [c, O]);
171
+ }, [d, $]);
171
172
  e.useEffect(() => {
172
- if (U(), c) {
173
- const a = () => U(), P = () => U();
174
- return window.addEventListener("resize", a), window.addEventListener("scroll", P, !0), () => {
175
- window.removeEventListener("resize", a), window.removeEventListener("scroll", P, !0);
173
+ if (U(), d) {
174
+ const a = () => U(), I = () => U();
175
+ return window.addEventListener("resize", a), window.addEventListener("scroll", I, !0), () => {
176
+ window.removeEventListener("resize", a), window.removeEventListener("scroll", I, !0);
176
177
  };
177
178
  }
178
- }, [c, U]), e.useEffect(() => {
179
- const a = (P) => {
180
- R.current && !R.current.contains(P.target) && (i(!1), S(!1));
179
+ }, [d, U]), e.useEffect(() => {
180
+ const a = (I) => {
181
+ C.current && !C.current.contains(I.target) && (v(!1), M(!1));
181
182
  };
182
183
  return document.addEventListener("mousedown", a), () => {
183
184
  document.removeEventListener("mousedown", a);
184
185
  };
185
186
  }, []);
186
187
  const oe = () => {
187
- i((a) => !a), S(!0);
188
+ v((a) => !a), M(!0);
188
189
  }, X = (a) => {
189
- S(!0), v && v(a);
190
+ M(!0), x && x(a);
190
191
  }, Z = (a) => {
191
- w && w(a);
192
+ h && h(a);
192
193
  }, ne = (a) => {
193
- _(a.target.value);
194
+ E(a.target.value);
194
195
  }, ae = (a) => {
195
- if (b && t && b.setValue(t, a), p.onChange) {
196
- const P = {
196
+ if (m && t && m.setValue(t, a), f.onChange) {
197
+ const I = {
197
198
  target: { value: a }
198
199
  };
199
- p.onChange(P);
200
+ f.onChange(I);
200
201
  }
201
- i(!1), S(!1), _("");
202
+ v(!1), M(!1), E("");
202
203
  };
203
- return /* @__PURE__ */ e.createElement("div", { className: u("relative", f), ref: R }, /* @__PURE__ */ e.createElement(
204
+ return /* @__PURE__ */ e.createElement("div", { className: i("relative", c), ref: C }, /* @__PURE__ */ e.createElement(
204
205
  "div",
205
206
  {
206
- id: p.id || t,
207
+ id: f.id || t,
207
208
  tabIndex: 0,
208
209
  role: "button",
209
210
  "aria-haspopup": "listbox",
210
- "aria-expanded": c,
211
- className: u(
211
+ "aria-expanded": d,
212
+ className: i(
212
213
  "peer flex items-center h-12 w-full border border-[var(--primary,#2563eb)] rounded-md bg-[var(--input-bg,#fff)] text-[var(--input-text,#222)] px-3 py-3 text-sm transition focus:outline-none focus:border-[var(--primary,#2563eb)] disabled:cursor-not-allowed disabled:opacity-50 appearance-none cursor-pointer relative",
213
- s
214
+ n
214
215
  ),
215
- onClick: m ? void 0 : oe,
216
- onFocus: m ? void 0 : X,
217
- onBlur: m ? void 0 : Z,
216
+ onClick: p ? void 0 : oe,
217
+ onFocus: p ? void 0 : X,
218
+ onBlur: p ? void 0 : Z,
218
219
  ref: B
219
220
  },
220
- m ? /* @__PURE__ */ e.createElement(
221
+ p ? /* @__PURE__ */ e.createElement(
221
222
  "input",
222
223
  {
223
- ref: $,
224
+ ref: z,
224
225
  type: "text",
225
226
  value: J,
226
227
  onChange: ne,
227
- onFocus: m ? (a) => {
228
- S(!0), i(!0), v && v(a);
228
+ onFocus: p ? (a) => {
229
+ M(!0), v(!0), x && x(a);
229
230
  } : void 0,
230
- onBlur: m ? (a) => {
231
- w && w(a);
231
+ onBlur: p ? (a) => {
232
+ h && h(a);
232
233
  } : void 0,
233
- placeholder: o ? "" : z || "Selecione...",
234
- className: u(
234
+ placeholder: o ? "" : T || "Selecione...",
235
+ className: i(
235
236
  "w-full bg-transparent border-none outline-none text-sm",
236
- !C && !x && "text-gray-400"
237
+ !R && !g && "text-gray-400"
237
238
  )
238
239
  }
239
- ) : /* @__PURE__ */ e.createElement("span", { className: u("block truncate", !C && "text-gray-400") }, ((F = r.find((a) => a.value === C)) == null ? void 0 : F.label) || !o && "Selecione..."),
240
- y && C && /* @__PURE__ */ e.createElement(
240
+ ) : /* @__PURE__ */ e.createElement("span", { className: i("block truncate", !R && "text-gray-400") }, ((P = r.find((a) => a.value === R)) == null ? void 0 : P.label) || !o && "Selecione..."),
241
+ N && R && /* @__PURE__ */ e.createElement(
241
242
  "button",
242
243
  {
243
244
  type: "button",
@@ -245,13 +246,13 @@ const Me = e.forwardRef(
245
246
  "aria-label": "Limpar seleção",
246
247
  className: "absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-red-500 bg-transparent p-1 rounded-full focus:outline-none",
247
248
  onClick: (a) => {
248
- if (a.stopPropagation(), b && t && b.setValue(t, ""), p.onChange) {
249
- const P = {
249
+ if (a.stopPropagation(), m && t && m.setValue(t, ""), f.onChange) {
250
+ const I = {
250
251
  target: { value: "" }
251
252
  };
252
- p.onChange(P);
253
+ f.onChange(I);
253
254
  }
254
- i(!1), S(!1);
255
+ v(!1), M(!1);
255
256
  }
256
257
  },
257
258
  "✕"
@@ -259,42 +260,42 @@ const Me = e.forwardRef(
259
260
  ), o && /* @__PURE__ */ e.createElement(
260
261
  "label",
261
262
  {
262
- htmlFor: p.id || t,
263
- className: u(
263
+ htmlFor: f.id || t,
264
+ className: i(
264
265
  "absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",
265
- A ? "top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white" : "top-3 scale-100 translate-y-0.5"
266
+ O ? "top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white" : "top-3 scale-100 translate-y-0.5"
266
267
  )
267
268
  },
268
269
  o
269
270
  ), /* @__PURE__ */ e.createElement(
270
271
  "div",
271
272
  {
272
- className: u(
273
+ className: i(
273
274
  "absolute left-0 w-full mt-1 rounded-md transition-all duration-200 overflow-hidden",
274
275
  "bg-[var(--select-dropdown-bg)] border-[var(--select-dropdown-border)] text-[var(--select-dropdown-text)]",
275
- c ? "border max-h-36 opacity-100 scale-100" : "max-h-0 opacity-0 scale-95 pointer-events-none"
276
+ d ? "border max-h-36 opacity-100 scale-100" : "max-h-0 opacity-0 scale-95 pointer-events-none"
276
277
  ),
277
278
  style: {
278
- maxHeight: c ? "9.5rem" : "0",
279
+ maxHeight: d ? "9.5rem" : "0",
279
280
  // 3 options * 2.5rem + padding
280
281
  overflowY: r.length > 3 ? "auto" : "hidden",
281
282
  position: "fixed",
282
283
  // Use fixed positioning to escape container overflow
283
- top: c ? `${k.top}px` : "auto",
284
- left: c ? `${k.left}px` : "auto",
285
- width: c ? `${k.width}px` : "auto",
284
+ top: d ? `${b.top}px` : "auto",
285
+ left: d ? `${b.left}px` : "auto",
286
+ width: d ? `${b.width}px` : "auto",
286
287
  zIndex: 9999,
287
- boxShadow: c ? "var(--select-dropdown-shadow)" : "none"
288
+ boxShadow: d ? "var(--select-dropdown-shadow)" : "none"
288
289
  }
289
290
  },
290
- I.length === 0 ? /* @__PURE__ */ e.createElement("div", { className: "px-3 py-2 text-sm text-gray-500 text-center" }, "Nenhuma opção encontrada") : I.map((a) => /* @__PURE__ */ e.createElement(
291
+ A.length === 0 ? /* @__PURE__ */ e.createElement("div", { className: "px-3 py-2 text-sm text-gray-500 text-center" }, "Nenhuma opção encontrada") : A.map((a) => /* @__PURE__ */ e.createElement(
291
292
  "div",
292
293
  {
293
294
  key: a.value,
294
- className: u(
295
+ className: i(
295
296
  "px-3 py-2 cursor-pointer text-sm transition-colors duration-150",
296
297
  "hover:bg-[var(--select-dropdown-hover)]",
297
- C === a.value && "bg-[var(--select-dropdown-selected)]"
298
+ R === a.value && "bg-[var(--select-dropdown-selected)]"
298
299
  ),
299
300
  onMouseDown: () => ae(a.value)
300
301
  },
@@ -303,226 +304,226 @@ const Me = e.forwardRef(
303
304
  ), G && /* @__PURE__ */ e.createElement("span", { className: "text-red-500 text-xs mt-1 block" }, G));
304
305
  }
305
306
  );
306
- Me.displayName = "Select";
307
- const Fe = e.forwardRef(
307
+ Fe.displayName = "Select";
308
+ const Pe = e.forwardRef(
308
309
  ({
309
310
  name: t,
310
311
  className: o,
311
312
  label: r,
312
- onFocus: s,
313
- onBlur: f,
314
- Icon: y,
315
- iconClassName: m,
316
- iconAction: z,
317
- containerClassName: T,
318
- rows: E = 4,
319
- ...v
320
- }, w) => {
321
- var g, R, $;
322
- const [p, B] = e.useState(!1), h = ie(), S = h == null ? void 0 : h.control, c = h == null ? void 0 : h.register, i = S && t ? ce({ control: S, name: t }) : void 0, x = v.value ?? i ?? "", _ = ($ = (R = (g = h == null ? void 0 : h.formState) == null ? void 0 : g.errors) == null ? void 0 : R[t]) == null ? void 0 : $.message, k = p || !!x;
323
- return /* @__PURE__ */ e.createElement("div", { className: u("relative", T) }, /* @__PURE__ */ e.createElement(
313
+ onFocus: n,
314
+ onBlur: c,
315
+ Icon: N,
316
+ iconClassName: p,
317
+ iconAction: T,
318
+ containerClassName: F,
319
+ rows: S = 4,
320
+ ...x
321
+ }, h) => {
322
+ var w, C, z;
323
+ const [f, B] = e.useState(!1), y = ie(), M = y == null ? void 0 : y.control, d = y == null ? void 0 : y.register, v = M && t ? ce({ control: M, name: t }) : void 0, g = x.value ?? v ?? "", E = (z = (C = (w = y == null ? void 0 : y.formState) == null ? void 0 : w.errors) == null ? void 0 : C[t]) == null ? void 0 : z.message, b = f || !!g;
324
+ return /* @__PURE__ */ e.createElement("div", { className: i("relative", F) }, /* @__PURE__ */ e.createElement(
324
325
  "textarea",
325
326
  {
326
- id: v.id || t,
327
- rows: E,
328
- className: u(
327
+ id: x.id || t,
328
+ rows: S,
329
+ className: i(
329
330
  "peer flex min-h-[80px] w-full border border-[var(--primary,#2563eb)] rounded-md bg-[var(--input-bg,#fff)] text-[var(--input-text,#222)] px-3 pt-6 pb-2 text-sm placeholder-transparent transition focus:outline-none focus:border-[var(--primary,#2563eb)] disabled:cursor-not-allowed disabled:opacity-50 resize-vertical",
330
- y ? "pr-12" : "",
331
+ N ? "pr-12" : "",
331
332
  // espaço extra para ícone customizado
332
333
  o
333
334
  ),
334
- onFocus: (b) => {
335
- B(!0), s && s(b);
335
+ onFocus: (m) => {
336
+ B(!0), n && n(m);
336
337
  },
337
- ...h && t ? (() => {
338
- const b = c(t), H = b.onBlur;
338
+ ...y && t ? (() => {
339
+ const m = d(t), H = m.onBlur;
339
340
  return {
340
- ...b,
341
+ ...m,
341
342
  ref: (V) => {
342
- typeof w == "function" ? w(V) : w && (w.current = V), b.ref && b.ref(V);
343
+ typeof h == "function" ? h(V) : h && (h.current = V), m.ref && m.ref(V);
343
344
  },
344
345
  onBlur: (V) => {
345
- B(!1), f && f(V), H && H(V);
346
+ B(!1), c && c(V), H && H(V);
346
347
  }
347
348
  };
348
349
  })() : {
349
- ref: w,
350
- onBlur: (b) => {
351
- B(!1), f && f(b);
350
+ ref: h,
351
+ onBlur: (m) => {
352
+ B(!1), c && c(m);
352
353
  }
353
354
  },
354
- ...v
355
+ ...x
355
356
  }
356
357
  ), r && /* @__PURE__ */ e.createElement(
357
358
  "label",
358
359
  {
359
- htmlFor: v.id || t,
360
- className: u(
360
+ htmlFor: x.id || t,
361
+ className: i(
361
362
  "absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",
362
- k ? "top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white" : "top-3 scale-100 translate-y-0.5"
363
+ b ? "top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white" : "top-3 scale-100 translate-y-0.5"
363
364
  )
364
365
  },
365
366
  r
366
- ), y && /* @__PURE__ */ e.createElement(
367
+ ), N && /* @__PURE__ */ e.createElement(
367
368
  "div",
368
369
  {
369
- className: u(
370
+ className: i(
370
371
  "absolute top-3 right-3 text-gray-400 cursor-pointer hover:text-[var(--primary,#2563eb)] transition-colors duration-200",
371
- m
372
+ p
372
373
  ),
373
- onClick: z
374
+ onClick: T
374
375
  },
375
- /* @__PURE__ */ e.createElement(y, null)
376
- ), _ && /* @__PURE__ */ e.createElement("span", { className: "text-red-500 text-xs mt-1 block" }, _));
376
+ /* @__PURE__ */ e.createElement(N, null)
377
+ ), E && /* @__PURE__ */ e.createElement("span", { className: "text-red-500 text-xs mt-1 block" }, E));
377
378
  }
378
379
  );
379
- Fe.displayName = "Textarea";
380
- const Pe = e.forwardRef(
380
+ Pe.displayName = "Textarea";
381
+ const Te = e.forwardRef(
381
382
  ({
382
383
  name: t,
383
384
  label: o,
384
385
  loadOptions: r,
385
- className: s,
386
- containerClassName: f,
387
- isClearable: y,
388
- defaultOptions: m = !1,
389
- loadingMessage: z = "Carregando...",
390
- noOptionsMessage: T = "Nenhuma opção encontrada",
391
- searchable: E = !1,
392
- debounceMs: v = 300,
393
- onFocus: w,
394
- onBlur: p,
386
+ className: n,
387
+ containerClassName: c,
388
+ isClearable: N,
389
+ defaultOptions: p = !1,
390
+ loadingMessage: T = "Carregando...",
391
+ noOptionsMessage: F = "Nenhuma opção encontrada",
392
+ searchable: S = !1,
393
+ debounceMs: x = 300,
394
+ onFocus: h,
395
+ onBlur: f,
395
396
  ...B
396
- }, h) => {
397
+ }, y) => {
397
398
  var j, Q, Y;
398
- const [S, c] = e.useState(!1), [i, x] = e.useState(!1), [_, k] = e.useState([]), [g, R] = e.useState(!1), [$, b] = e.useState(""), [H, V] = e.useState(""), [C, G] = e.useState({
399
+ const [M, d] = e.useState(!1), [v, g] = e.useState(!1), [E, b] = e.useState([]), [w, C] = e.useState(!1), [z, m] = e.useState(""), [H, V] = e.useState(""), [R, G] = e.useState({
399
400
  top: 0,
400
401
  left: 0,
401
402
  width: 0
402
- }), q = e.useRef(null), D = e.useRef(null), I = ie(), N = I == null ? void 0 : I.control, J = N && t ? ce({ control: N, name: t }) : void 0, A = B.value ?? J ?? "", O = (Y = (Q = (j = I == null ? void 0 : I.formState) == null ? void 0 : j.errors) == null ? void 0 : Q[t]) == null ? void 0 : Y.message, U = S || !!A, oe = e.useCallback(() => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || window.innerWidth <= 768, []), X = e.useCallback(() => {
403
- if (q.current && i) {
404
- const d = q.current.getBoundingClientRect(), W = oe(), te = window.innerHeight, l = window.innerWidth, L = 152;
405
- let K = d.bottom + 4, le = d.left;
403
+ }), q = e.useRef(null), D = e.useRef(null), A = ie(), L = A == null ? void 0 : A.control, J = L && t ? ce({ control: L, name: t }) : void 0, O = B.value ?? J ?? "", $ = (Y = (Q = (j = A == null ? void 0 : A.formState) == null ? void 0 : j.errors) == null ? void 0 : Q[t]) == null ? void 0 : Y.message, U = M || !!O, oe = e.useCallback(() => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || window.innerWidth <= 768, []), X = e.useCallback(() => {
404
+ if (q.current && v) {
405
+ const u = q.current.getBoundingClientRect(), W = oe(), te = window.innerHeight, s = window.innerWidth, _ = 152;
406
+ let K = u.bottom + 4, se = u.left;
406
407
  if (W) {
407
- const se = te - d.bottom, ue = d.top;
408
- se < L && ue > L && (K = d.top - L - 4);
409
- const de = 16, fe = l - d.width - de;
410
- le = Math.min(Math.max(le, de), fe);
408
+ const le = te - u.bottom, ue = u.top;
409
+ le < _ && ue > _ && (K = u.top - _ - 4);
410
+ const de = 16, fe = s - u.width - de;
411
+ se = Math.min(Math.max(se, de), fe);
411
412
  } else
412
- te - d.bottom < L && (K = d.top - L - 4);
413
+ te - u.bottom < _ && (K = u.top - _ - 4);
413
414
  G({
414
415
  top: K,
415
- left: le,
416
- width: d.width
416
+ left: se,
417
+ width: u.width
417
418
  });
418
419
  }
419
- }, [i, oe]);
420
+ }, [v, oe]);
420
421
  e.useEffect(() => {
421
- if (X(), i) {
422
- const d = () => X(), W = () => X();
423
- return window.addEventListener("resize", d), window.addEventListener("scroll", W, !0), () => {
424
- window.removeEventListener("resize", d), window.removeEventListener("scroll", W, !0);
422
+ if (X(), v) {
423
+ const u = () => X(), W = () => X();
424
+ return window.addEventListener("resize", u), window.addEventListener("scroll", W, !0), () => {
425
+ window.removeEventListener("resize", u), window.removeEventListener("scroll", W, !0);
425
426
  };
426
427
  }
427
- }, [i, X]), e.useEffect(() => {
428
- const d = setTimeout(() => {
429
- V($);
430
- }, v);
431
- return () => clearTimeout(d);
432
- }, [$, v]), e.useEffect(() => {
433
- (i || m && _.length === 0) && Z(E ? H : void 0);
434
- }, [H, i]), e.useEffect(() => {
435
- m === !0 ? Z() : Array.isArray(m) && k(m);
428
+ }, [v, X]), e.useEffect(() => {
429
+ const u = setTimeout(() => {
430
+ V(z);
431
+ }, x);
432
+ return () => clearTimeout(u);
433
+ }, [z, x]), e.useEffect(() => {
434
+ (v || p && E.length === 0) && Z(S ? H : void 0);
435
+ }, [H, v]), e.useEffect(() => {
436
+ p === !0 ? Z() : Array.isArray(p) && b(p);
436
437
  }, []);
437
- const Z = async (d) => {
438
+ const Z = async (u) => {
438
439
  try {
439
- R(!0);
440
- const W = await r(d);
441
- k(W);
440
+ C(!0);
441
+ const W = await r(u);
442
+ b(W);
442
443
  } catch (W) {
443
- console.error("Error loading options:", W), k([]);
444
+ console.error("Error loading options:", W), b([]);
444
445
  } finally {
445
- R(!1);
446
+ C(!1);
446
447
  }
447
448
  };
448
449
  e.useEffect(() => {
449
- const d = (W) => {
450
- q.current && !q.current.contains(W.target) && (x(!1), c(!1), b(""));
450
+ const u = (W) => {
451
+ q.current && !q.current.contains(W.target) && (g(!1), d(!1), m(""));
451
452
  };
452
- return document.addEventListener("mousedown", d), () => {
453
- document.removeEventListener("mousedown", d);
453
+ return document.addEventListener("mousedown", u), () => {
454
+ document.removeEventListener("mousedown", u);
454
455
  };
455
456
  }, []);
456
457
  const ne = () => {
457
- i || (x(!0), c(!0), E && D.current && setTimeout(() => {
458
- var d;
459
- return (d = D.current) == null ? void 0 : d.focus();
458
+ v || (g(!0), d(!0), S && D.current && setTimeout(() => {
459
+ var u;
460
+ return (u = D.current) == null ? void 0 : u.focus();
460
461
  }, 0));
461
- }, ae = (d) => {
462
- c(!0), w && w(d);
463
- }, ee = (d) => {
464
- p && p(d);
465
- }, re = (d) => {
466
- b(d.target.value);
467
- }, n = (d) => {
468
- if (I && t && I.setValue(t, d), B.onChange) {
462
+ }, ae = (u) => {
463
+ d(!0), h && h(u);
464
+ }, ee = (u) => {
465
+ f && f(u);
466
+ }, re = (u) => {
467
+ m(u.target.value);
468
+ }, l = (u) => {
469
+ if (A && t && A.setValue(t, u), B.onChange) {
469
470
  const W = {
470
- target: { value: d }
471
+ target: { value: u }
471
472
  };
472
473
  B.onChange(W);
473
474
  }
474
- x(!1), c(!1), b("");
475
- }, F = (d) => {
476
- if (d.stopPropagation(), I && t && I.setValue(t, ""), B.onChange) {
475
+ g(!1), d(!1), m("");
476
+ }, P = (u) => {
477
+ if (u.stopPropagation(), A && t && A.setValue(t, ""), B.onChange) {
477
478
  const W = {
478
479
  target: { value: "" }
479
480
  };
480
481
  B.onChange(W);
481
482
  }
482
- x(!1), c(!1), b("");
483
- }, a = _.find((d) => d.value === A), P = E && i ? $ : (a == null ? void 0 : a.label) || "";
484
- return /* @__PURE__ */ e.createElement("div", { className: u("relative", f), ref: q }, /* @__PURE__ */ e.createElement(
483
+ g(!1), d(!1), m("");
484
+ }, a = E.find((u) => u.value === O), I = S && v ? z : (a == null ? void 0 : a.label) || "";
485
+ return /* @__PURE__ */ e.createElement("div", { className: i("relative", c), ref: q }, /* @__PURE__ */ e.createElement(
485
486
  "div",
486
487
  {
487
488
  id: B.id || t,
488
- tabIndex: E ? -1 : 0,
489
+ tabIndex: S ? -1 : 0,
489
490
  role: "button",
490
491
  "aria-haspopup": "listbox",
491
- "aria-expanded": i,
492
- className: u(
492
+ "aria-expanded": v,
493
+ className: i(
493
494
  "peer flex items-center h-12 w-full border border-[var(--primary,#2563eb)] rounded-md bg-[var(--input-bg,#fff)] text-[var(--input-text,#222)] px-3 py-3 text-sm transition focus:outline-none focus:border-[var(--primary,#2563eb)] disabled:cursor-not-allowed disabled:opacity-50 appearance-none cursor-pointer relative",
494
- s
495
+ n
495
496
  ),
496
497
  onClick: ne,
497
- onFocus: E ? void 0 : ae,
498
- onBlur: E ? void 0 : ee,
499
- ref: h
498
+ onFocus: S ? void 0 : ae,
499
+ onBlur: S ? void 0 : ee,
500
+ ref: y
500
501
  },
501
- E ? /* @__PURE__ */ e.createElement(
502
+ S ? /* @__PURE__ */ e.createElement(
502
503
  "input",
503
504
  {
504
505
  ref: D,
505
506
  type: "text",
506
- value: P,
507
+ value: I,
507
508
  onChange: re,
508
509
  onFocus: ae,
509
510
  onBlur: ee,
510
511
  placeholder: o ? "" : "Selecione...",
511
- className: u(
512
+ className: i(
512
513
  "w-full bg-transparent border-none outline-none text-sm",
513
- !A && !$ && "text-gray-400"
514
+ !O && !z && "text-gray-400"
514
515
  )
515
516
  }
516
- ) : /* @__PURE__ */ e.createElement("span", { className: u("block truncate", !A && "text-gray-400") }, (a == null ? void 0 : a.label) || !o && "Selecione..."),
517
- g && /* @__PURE__ */ e.createElement("div", { className: "absolute right-8 top-1/2 -translate-y-1/2" }, /* @__PURE__ */ e.createElement("div", { className: "animate-spin rounded-full h-4 w-4 border-b-2 border-[var(--primary,#2563eb)]" })),
518
- y && A && !g && /* @__PURE__ */ e.createElement(
517
+ ) : /* @__PURE__ */ e.createElement("span", { className: i("block truncate", !O && "text-gray-400") }, (a == null ? void 0 : a.label) || !o && "Selecione..."),
518
+ w && /* @__PURE__ */ e.createElement("div", { className: "absolute right-8 top-1/2 -translate-y-1/2" }, /* @__PURE__ */ e.createElement("div", { className: "animate-spin rounded-full h-4 w-4 border-b-2 border-[var(--primary,#2563eb)]" })),
519
+ N && O && !w && /* @__PURE__ */ e.createElement(
519
520
  "button",
520
521
  {
521
522
  type: "button",
522
523
  tabIndex: -1,
523
524
  "aria-label": "Limpar seleção",
524
525
  className: "absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-red-500 bg-transparent p-1 rounded-full focus:outline-none",
525
- onClick: F
526
+ onClick: P
526
527
  },
527
528
  "✕"
528
529
  )
@@ -530,7 +531,7 @@ const Pe = e.forwardRef(
530
531
  "label",
531
532
  {
532
533
  htmlFor: B.id || t,
533
- className: u(
534
+ className: i(
534
535
  "absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",
535
536
  U ? "top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white" : "top-3 scale-100 translate-y-0.5"
536
537
  )
@@ -539,132 +540,132 @@ const Pe = e.forwardRef(
539
540
  ), /* @__PURE__ */ e.createElement(
540
541
  "div",
541
542
  {
542
- className: u(
543
+ className: i(
543
544
  "absolute left-0 w-full mt-1 rounded-md transition-all duration-200 overflow-hidden",
544
545
  "bg-[var(--select-dropdown-bg)] border-[var(--select-dropdown-border)] text-[var(--select-dropdown-text)]",
545
- i ? "border max-h-36 opacity-100 scale-100" : "max-h-0 opacity-0 scale-95 pointer-events-none"
546
+ v ? "border max-h-36 opacity-100 scale-100" : "max-h-0 opacity-0 scale-95 pointer-events-none"
546
547
  ),
547
548
  style: {
548
- maxHeight: i ? "9.5rem" : "0",
549
- overflowY: _.length > 3 ? "auto" : "hidden",
549
+ maxHeight: v ? "9.5rem" : "0",
550
+ overflowY: E.length > 3 ? "auto" : "hidden",
550
551
  position: "fixed",
551
552
  // Use fixed positioning to escape container overflow
552
- top: i ? `${C.top}px` : "auto",
553
- left: i ? `${C.left}px` : "auto",
554
- width: i ? `${C.width}px` : "auto",
553
+ top: v ? `${R.top}px` : "auto",
554
+ left: v ? `${R.left}px` : "auto",
555
+ width: v ? `${R.width}px` : "auto",
555
556
  zIndex: 9999,
556
- boxShadow: i ? "var(--select-dropdown-shadow)" : "none"
557
+ boxShadow: v ? "var(--select-dropdown-shadow)" : "none"
557
558
  }
558
559
  },
559
- g ? /* @__PURE__ */ e.createElement("div", { className: "px-3 py-2 text-sm text-gray-500 text-center" }, z) : _.length === 0 ? /* @__PURE__ */ e.createElement("div", { className: "px-3 py-2 text-sm text-gray-500 text-center" }, T) : _.map((d) => /* @__PURE__ */ e.createElement(
560
+ w ? /* @__PURE__ */ e.createElement("div", { className: "px-3 py-2 text-sm text-gray-500 text-center" }, T) : E.length === 0 ? /* @__PURE__ */ e.createElement("div", { className: "px-3 py-2 text-sm text-gray-500 text-center" }, F) : E.map((u) => /* @__PURE__ */ e.createElement(
560
561
  "div",
561
562
  {
562
- key: d.value,
563
- className: u(
563
+ key: u.value,
564
+ className: i(
564
565
  "px-3 py-2 cursor-pointer text-sm transition-colors duration-150",
565
566
  "hover:bg-[var(--select-dropdown-hover)]",
566
- A === d.value && "bg-[var(--select-dropdown-selected)]"
567
+ O === u.value && "bg-[var(--select-dropdown-selected)]"
567
568
  ),
568
- onMouseDown: () => n(d.value)
569
+ onMouseDown: () => l(u.value)
569
570
  },
570
- d.label
571
+ u.label
571
572
  ))
572
- ), O && /* @__PURE__ */ e.createElement("span", { className: "text-red-500 text-xs mt-1 block" }, O));
573
+ ), $ && /* @__PURE__ */ e.createElement("span", { className: "text-red-500 text-xs mt-1 block" }, $));
573
574
  }
574
575
  );
575
- Pe.displayName = "AsyncSelect";
576
- const ze = e.forwardRef(
576
+ Te.displayName = "AsyncSelect";
577
+ const Ie = e.forwardRef(
577
578
  ({
578
579
  name: t,
579
580
  label: o,
580
581
  options: r,
581
- className: s,
582
- containerClassName: f,
583
- isClearable: y,
584
- searchable: m = !1,
585
- filterPlaceholder: z = "Digite para filtrar...",
586
- caseSensitive: T = !1,
587
- filterFunction: E,
588
- onFocus: v,
589
- onBlur: w,
590
- ...p
582
+ className: n,
583
+ containerClassName: c,
584
+ isClearable: N,
585
+ searchable: p = !1,
586
+ filterPlaceholder: T = "Digite para filtrar...",
587
+ caseSensitive: F = !1,
588
+ filterFunction: S,
589
+ onFocus: x,
590
+ onBlur: h,
591
+ ...f
591
592
  }, B) => {
592
593
  var ae, ee, re;
593
- const [h, S] = e.useState(!1), [c, i] = e.useState(!1), [x, _] = e.useState(""), [k, g] = e.useState({
594
+ const [y, M] = e.useState(!1), [d, v] = e.useState(!1), [g, E] = e.useState(""), [b, w] = e.useState({
594
595
  top: 0,
595
596
  left: 0,
596
597
  width: 0
597
- }), R = e.useRef(null), $ = e.useRef(null), b = ie(), H = b == null ? void 0 : b.control, V = H && t ? ce({ control: H, name: t }) : void 0, C = p.value ?? V ?? [], G = (re = (ee = (ae = b == null ? void 0 : b.formState) == null ? void 0 : ae.errors) == null ? void 0 : ee[t]) == null ? void 0 : re.message, D = E || ((n, F) => {
598
- const a = T ? n.label : n.label.toLowerCase(), P = T ? F : F.toLowerCase();
599
- return a.includes(P);
600
- }), I = x.trim() ? r.filter((n) => D(n, x.trim())) : r, N = h || C && C.length > 0 || m && !!x, J = e.useCallback(() => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || window.innerWidth <= 768, []), A = e.useCallback(() => {
601
- if (R.current && c) {
602
- const n = R.current.getBoundingClientRect(), F = J(), a = window.innerHeight, P = window.innerWidth, j = 152;
603
- let Q = n.bottom + 4, Y = n.left;
604
- if (F) {
605
- const d = a - n.bottom, W = n.top;
606
- d < j && W > j && (Q = n.top - j - 4);
607
- const te = 16, l = P - n.width - te;
608
- Y = Math.min(Math.max(Y, te), l);
598
+ }), C = e.useRef(null), z = e.useRef(null), m = ie(), H = m == null ? void 0 : m.control, V = H && t ? ce({ control: H, name: t }) : void 0, R = f.value ?? V ?? [], G = (re = (ee = (ae = m == null ? void 0 : m.formState) == null ? void 0 : ae.errors) == null ? void 0 : ee[t]) == null ? void 0 : re.message, D = S || ((l, P) => {
599
+ const a = F ? l.label : l.label.toLowerCase(), I = F ? P : P.toLowerCase();
600
+ return a.includes(I);
601
+ }), A = g.trim() ? r.filter((l) => D(l, g.trim())) : r, L = y || R && R.length > 0 || p && !!g, J = e.useCallback(() => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || window.innerWidth <= 768, []), O = e.useCallback(() => {
602
+ if (C.current && d) {
603
+ const l = C.current.getBoundingClientRect(), P = J(), a = window.innerHeight, I = window.innerWidth, j = 152;
604
+ let Q = l.bottom + 4, Y = l.left;
605
+ if (P) {
606
+ const u = a - l.bottom, W = l.top;
607
+ u < j && W > j && (Q = l.top - j - 4);
608
+ const te = 16, s = I - l.width - te;
609
+ Y = Math.min(Math.max(Y, te), s);
609
610
  } else
610
- a - n.bottom < j && (Q = n.top - j - 4);
611
- g({
611
+ a - l.bottom < j && (Q = l.top - j - 4);
612
+ w({
612
613
  top: Q,
613
614
  left: Y,
614
- width: n.width
615
+ width: l.width
615
616
  });
616
617
  }
617
- }, [c, J]);
618
+ }, [d, J]);
618
619
  e.useEffect(() => {
619
- if (A(), c) {
620
- const n = () => A(), F = () => A();
621
- return window.addEventListener("resize", n), window.addEventListener("scroll", F, !0), () => {
622
- window.removeEventListener("resize", n), window.removeEventListener("scroll", F, !0);
620
+ if (O(), d) {
621
+ const l = () => O(), P = () => O();
622
+ return window.addEventListener("resize", l), window.addEventListener("scroll", P, !0), () => {
623
+ window.removeEventListener("resize", l), window.removeEventListener("scroll", P, !0);
623
624
  };
624
625
  }
625
- }, [c, A]), e.useEffect(() => {
626
- const n = (F) => {
627
- R.current && !R.current.contains(F.target) && (i(!1), S(!1));
626
+ }, [d, O]), e.useEffect(() => {
627
+ const l = (P) => {
628
+ C.current && !C.current.contains(P.target) && (v(!1), M(!1));
628
629
  };
629
- return document.addEventListener("mousedown", n), () => {
630
- document.removeEventListener("mousedown", n);
630
+ return document.addEventListener("mousedown", l), () => {
631
+ document.removeEventListener("mousedown", l);
631
632
  };
632
633
  }, []);
633
- const O = () => {
634
- i((n) => !n), S(!0);
635
- }, U = (n) => {
636
- S(!0), v && v(n);
637
- }, oe = (n) => {
638
- w && w(n);
639
- }, X = (n) => {
634
+ const $ = () => {
635
+ v((l) => !l), M(!0);
636
+ }, U = (l) => {
637
+ M(!0), x && x(l);
638
+ }, oe = (l) => {
639
+ h && h(l);
640
+ }, X = (l) => {
640
641
  var a;
641
- let F;
642
- C.includes(n) ? F = C.filter((P) => P !== n) : F = [...C, n], b && t && b.setValue(t, F), p.onChange && ((a = p.onChange) == null || a.call(p, {
643
- target: { value: F }
644
- })), S(!0);
645
- }, Z = (n) => {
646
- var F;
647
- n.stopPropagation(), b && t && b.setValue(t, []), p.onChange && ((F = p.onChange) == null || F.call(p, {
642
+ let P;
643
+ R.includes(l) ? P = R.filter((I) => I !== l) : P = [...R, l], m && t && m.setValue(t, P), f.onChange && ((a = f.onChange) == null || a.call(f, {
644
+ target: { value: P }
645
+ })), M(!0);
646
+ }, Z = (l) => {
647
+ var P;
648
+ l.stopPropagation(), m && t && m.setValue(t, []), f.onChange && ((P = f.onChange) == null || P.call(f, {
648
649
  target: { value: [] }
649
- })), i(!1), S(!1);
650
- }, ne = (n) => {
651
- _(n.target.value);
650
+ })), v(!1), M(!1);
651
+ }, ne = (l) => {
652
+ E(l.target.value);
652
653
  };
653
- return /* @__PURE__ */ e.createElement("div", { className: u("relative", f), ref: R }, /* @__PURE__ */ e.createElement(
654
+ return /* @__PURE__ */ e.createElement("div", { className: i("relative", c), ref: C }, /* @__PURE__ */ e.createElement(
654
655
  "div",
655
656
  {
656
- id: p.id || t,
657
+ id: f.id || t,
657
658
  tabIndex: 0,
658
659
  role: "button",
659
660
  "aria-haspopup": "listbox",
660
- "aria-expanded": c,
661
- className: u(
661
+ "aria-expanded": d,
662
+ className: i(
662
663
  "peer flex items-center h-12 w-full border border-[var(--primary,#2563eb)] rounded-md bg-[var(--input-bg,#fff)] text-[var(--input-text,#222)] px-3 py-3 text-sm transition focus:outline-none focus:border-[var(--primary,#2563eb)] disabled:cursor-not-allowed disabled:opacity-50 appearance-none cursor-pointer relative",
663
- s
664
+ n
664
665
  ),
665
- onClick: m ? void 0 : O,
666
- onFocus: m ? void 0 : U,
667
- onBlur: m ? void 0 : oe,
666
+ onClick: p ? void 0 : $,
667
+ onFocus: p ? void 0 : U,
668
+ onBlur: p ? void 0 : oe,
668
669
  ref: B
669
670
  },
670
671
  /* @__PURE__ */ e.createElement(
@@ -673,25 +674,25 @@ const ze = e.forwardRef(
673
674
  className: "flex flex-nowrap gap-1 items-center min-h-[1.5rem] w-full overflow-x-auto",
674
675
  style: { scrollbarWidth: "none" }
675
676
  },
676
- C && C.length > 0 ? r.filter((n) => C.includes(n.value)).map((n) => /* @__PURE__ */ e.createElement(
677
+ R && R.length > 0 ? r.filter((l) => R.includes(l.value)).map((l) => /* @__PURE__ */ e.createElement(
677
678
  "span",
678
679
  {
679
- key: n.value,
680
+ key: l.value,
680
681
  className: "flex items-center border border-blue-200 bg-blue-50 text-blue-700 rounded-2xl px-3 py-1 text-xs shadow-sm mr-1 gap-2",
681
682
  style: { maxWidth: "140px" }
682
683
  },
683
- /* @__PURE__ */ e.createElement("span", { className: "truncate", title: n.label }, n.label),
684
+ /* @__PURE__ */ e.createElement("span", { className: "truncate", title: l.label }, l.label),
684
685
  /* @__PURE__ */ e.createElement(
685
686
  "button",
686
687
  {
687
688
  type: "button",
688
689
  className: "ml-1 text-[var(--primary,#2563eb)] hover:text-red-500 focus:outline-none w-4 h-4 flex items-center justify-center rounded-full transition-colors duration-150",
689
- "aria-label": `Remover ${n.label}`,
690
+ "aria-label": `Remover ${l.label}`,
690
691
  tabIndex: -1,
691
- onClick: (F) => {
692
- F.stopPropagation();
693
- const a = C.filter((P) => P !== n.value);
694
- b && t && b.setValue(t, a), p.onChange && p.onChange({
692
+ onClick: (P) => {
693
+ P.stopPropagation();
694
+ const a = R.filter((I) => I !== l.value);
695
+ m && t && m.setValue(t, a), f.onChange && f.onChange({
695
696
  target: { value: a }
696
697
  });
697
698
  }
@@ -716,26 +717,26 @@ const ze = e.forwardRef(
716
717
  )
717
718
  )
718
719
  )
719
- )) : !o && !m && /* @__PURE__ */ e.createElement("span", { className: "text-gray-400 text-sm" }, "Selecione..."),
720
- m && /* @__PURE__ */ e.createElement(
720
+ )) : !o && !p && /* @__PURE__ */ e.createElement("span", { className: "text-gray-400 text-sm" }, "Selecione..."),
721
+ p && /* @__PURE__ */ e.createElement(
721
722
  "input",
722
723
  {
723
- ref: $,
724
+ ref: z,
724
725
  type: "text",
725
- value: x,
726
+ value: g,
726
727
  onChange: ne,
727
- onFocus: (n) => {
728
- S(!0), i(!0), v && v(n);
728
+ onFocus: (l) => {
729
+ M(!0), v(!0), x && x(l);
729
730
  },
730
- onBlur: (n) => {
731
- w && w(n);
731
+ onBlur: (l) => {
732
+ h && h(l);
732
733
  },
733
- placeholder: o ? C && C.length > 0 ? "" : z : z || "Selecione...",
734
+ placeholder: o ? R && R.length > 0 ? "" : T : T || "Selecione...",
734
735
  className: "flex-1 bg-transparent border-none outline-none text-sm min-w-[100px]"
735
736
  }
736
737
  )
737
738
  ),
738
- y && C && C.length > 0 && /* @__PURE__ */ e.createElement(
739
+ N && R && R.length > 0 && /* @__PURE__ */ e.createElement(
739
740
  "button",
740
741
  {
741
742
  type: "button",
@@ -749,196 +750,196 @@ const ze = e.forwardRef(
749
750
  ), o && /* @__PURE__ */ e.createElement(
750
751
  "label",
751
752
  {
752
- htmlFor: p.id || t,
753
- className: u(
753
+ htmlFor: f.id || t,
754
+ className: i(
754
755
  "absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",
755
- N ? "top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white" : "top-3 scale-100 translate-y-0.5"
756
+ L ? "top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white" : "top-3 scale-100 translate-y-0.5"
756
757
  )
757
758
  },
758
759
  o
759
760
  ), /* @__PURE__ */ e.createElement(
760
761
  "div",
761
762
  {
762
- className: u(
763
+ className: i(
763
764
  "absolute left-0 w-full mt-1 rounded-md transition-all duration-200 overflow-hidden",
764
765
  "bg-[var(--select-dropdown-bg)] border-[var(--select-dropdown-border)] text-[var(--select-dropdown-text)]",
765
- c ? "border max-h-36 opacity-100 scale-100" : "max-h-0 opacity-0 scale-95 pointer-events-none"
766
+ d ? "border max-h-36 opacity-100 scale-100" : "max-h-0 opacity-0 scale-95 pointer-events-none"
766
767
  ),
767
768
  style: {
768
- maxHeight: c ? "9.5rem" : "0",
769
+ maxHeight: d ? "9.5rem" : "0",
769
770
  overflowY: r.length > 3 ? "auto" : "hidden",
770
771
  position: "fixed",
771
772
  // Use fixed positioning to escape container overflow
772
- top: c ? `${k.top}px` : "auto",
773
- left: c ? `${k.left}px` : "auto",
774
- width: c ? `${k.width}px` : "auto",
773
+ top: d ? `${b.top}px` : "auto",
774
+ left: d ? `${b.left}px` : "auto",
775
+ width: d ? `${b.width}px` : "auto",
775
776
  zIndex: 9999,
776
- boxShadow: c ? "var(--select-dropdown-shadow)" : "none"
777
+ boxShadow: d ? "var(--select-dropdown-shadow)" : "none"
777
778
  }
778
779
  },
779
- I.length === 0 ? /* @__PURE__ */ e.createElement("div", { className: "px-3 py-2 text-sm text-gray-500 text-center" }, "Nenhuma opção encontrada") : I.map((n) => /* @__PURE__ */ e.createElement(
780
+ A.length === 0 ? /* @__PURE__ */ e.createElement("div", { className: "px-3 py-2 text-sm text-gray-500 text-center" }, "Nenhuma opção encontrada") : A.map((l) => /* @__PURE__ */ e.createElement(
780
781
  "div",
781
782
  {
782
- key: n.value,
783
- className: u(
783
+ key: l.value,
784
+ className: i(
784
785
  "px-3 py-2 cursor-pointer text-sm flex items-center gap-2 transition-colors duration-150",
785
786
  "hover:bg-[var(--select-dropdown-hover)]",
786
- C.includes(n.value) && "bg-[var(--select-dropdown-selected)] font-semibold"
787
+ R.includes(l.value) && "bg-[var(--select-dropdown-selected)] font-semibold"
787
788
  ),
788
- onMouseDown: () => X(n.value)
789
+ onMouseDown: () => X(l.value)
789
790
  },
790
791
  /* @__PURE__ */ e.createElement(
791
792
  "input",
792
793
  {
793
794
  type: "checkbox",
794
- checked: C.includes(n.value),
795
+ checked: R.includes(l.value),
795
796
  readOnly: !0,
796
797
  className: "accent-blue-500"
797
798
  }
798
799
  ),
799
- n.label
800
+ l.label
800
801
  ))
801
802
  ), G && /* @__PURE__ */ e.createElement("span", { className: "text-red-500 text-xs mt-1 block" }, G));
802
803
  }
803
804
  );
804
- ze.displayName = "MultiSelect";
805
- const Te = e.forwardRef(
805
+ Ie.displayName = "MultiSelect";
806
+ const ze = e.forwardRef(
806
807
  ({
807
808
  name: t,
808
809
  label: o,
809
810
  loadOptions: r,
810
- className: s,
811
- containerClassName: f,
812
- isClearable: y,
813
- defaultOptions: m = !1,
814
- loadingMessage: z = "Carregando...",
815
- noOptionsMessage: T = "Nenhuma opção encontrada",
816
- searchable: E = !1,
817
- debounceMs: v = 300,
818
- maxSelectedDisplay: w = 3,
819
- onFocus: p,
811
+ className: n,
812
+ containerClassName: c,
813
+ isClearable: N,
814
+ defaultOptions: p = !1,
815
+ loadingMessage: T = "Carregando...",
816
+ noOptionsMessage: F = "Nenhuma opção encontrada",
817
+ searchable: S = !1,
818
+ debounceMs: x = 300,
819
+ maxSelectedDisplay: h = 3,
820
+ onFocus: f,
820
821
  onBlur: B,
821
- ...h
822
- }, S) => {
823
- var d, W, te;
824
- const [c, i] = e.useState(!1), [x, _] = e.useState(!1), [k, g] = e.useState([]), [R, $] = e.useState(!1), [b, H] = e.useState(""), [V, C] = e.useState(""), [G, q] = e.useState({
822
+ ...y
823
+ }, M) => {
824
+ var u, W, te;
825
+ const [d, v] = e.useState(!1), [g, E] = e.useState(!1), [b, w] = e.useState([]), [C, z] = e.useState(!1), [m, H] = e.useState(""), [V, R] = e.useState(""), [G, q] = e.useState({
825
826
  top: 0,
826
827
  left: 0,
827
828
  width: 0
828
- }), D = e.useRef(null), I = e.useRef(null), N = ie(), J = N == null ? void 0 : N.control, A = J && t ? ce({ control: J, name: t }) : void 0, O = h.value ?? A ?? [], U = (te = (W = (d = N == null ? void 0 : N.formState) == null ? void 0 : d.errors) == null ? void 0 : W[t]) == null ? void 0 : te.message, oe = c || O && O.length > 0, X = e.useCallback(() => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || window.innerWidth <= 768, []), Z = e.useCallback(() => {
829
- if (D.current && x) {
830
- const l = D.current.getBoundingClientRect(), L = X(), K = window.innerHeight, le = window.innerWidth, se = 152;
831
- let ue = l.bottom + 4, de = l.left;
832
- if (L) {
833
- const fe = K - l.bottom, Se = l.top;
834
- fe < se && Se > se && (ue = l.top - se - 4);
835
- const me = 16, Re = le - l.width - me;
836
- de = Math.min(Math.max(de, me), Re);
829
+ }), D = e.useRef(null), A = e.useRef(null), L = ie(), J = L == null ? void 0 : L.control, O = J && t ? ce({ control: J, name: t }) : void 0, $ = y.value ?? O ?? [], U = (te = (W = (u = L == null ? void 0 : L.formState) == null ? void 0 : u.errors) == null ? void 0 : W[t]) == null ? void 0 : te.message, oe = d || $ && $.length > 0, X = e.useCallback(() => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || window.innerWidth <= 768, []), Z = e.useCallback(() => {
830
+ if (D.current && g) {
831
+ const s = D.current.getBoundingClientRect(), _ = X(), K = window.innerHeight, se = window.innerWidth, le = 152;
832
+ let ue = s.bottom + 4, de = s.left;
833
+ if (_) {
834
+ const fe = K - s.bottom, Re = s.top;
835
+ fe < le && Re > le && (ue = s.top - le - 4);
836
+ const pe = 16, Le = se - s.width - pe;
837
+ de = Math.min(Math.max(de, pe), Le);
837
838
  } else
838
- K - l.bottom < se && (ue = l.top - se - 4);
839
+ K - s.bottom < le && (ue = s.top - le - 4);
839
840
  q({
840
841
  top: ue,
841
842
  left: de,
842
- width: l.width
843
+ width: s.width
843
844
  });
844
845
  }
845
- }, [x, X]);
846
+ }, [g, X]);
846
847
  e.useEffect(() => {
847
- if (Z(), x) {
848
- const l = () => Z(), L = () => Z();
849
- return window.addEventListener("resize", l), window.addEventListener("scroll", L, !0), () => {
850
- window.removeEventListener("resize", l), window.removeEventListener("scroll", L, !0);
848
+ if (Z(), g) {
849
+ const s = () => Z(), _ = () => Z();
850
+ return window.addEventListener("resize", s), window.addEventListener("scroll", _, !0), () => {
851
+ window.removeEventListener("resize", s), window.removeEventListener("scroll", _, !0);
851
852
  };
852
853
  }
853
- }, [x, Z]), e.useEffect(() => {
854
- const l = setTimeout(() => {
855
- C(b);
856
- }, v);
857
- return () => clearTimeout(l);
858
- }, [b, v]), e.useEffect(() => {
859
- (x || m && k.length === 0) && ne(E ? V : void 0);
860
- }, [V, x]), e.useEffect(() => {
861
- m === !0 ? ne() : Array.isArray(m) && g(m);
854
+ }, [g, Z]), e.useEffect(() => {
855
+ const s = setTimeout(() => {
856
+ R(m);
857
+ }, x);
858
+ return () => clearTimeout(s);
859
+ }, [m, x]), e.useEffect(() => {
860
+ (g || p && b.length === 0) && ne(S ? V : void 0);
861
+ }, [V, g]), e.useEffect(() => {
862
+ p === !0 ? ne() : Array.isArray(p) && w(p);
862
863
  }, []);
863
- const ne = async (l) => {
864
+ const ne = async (s) => {
864
865
  try {
865
- $(!0);
866
- const L = await r(l);
867
- g(L);
868
- } catch (L) {
869
- console.error("Error loading options:", L), g([]);
866
+ z(!0);
867
+ const _ = await r(s);
868
+ w(_);
869
+ } catch (_) {
870
+ console.error("Error loading options:", _), w([]);
870
871
  } finally {
871
- $(!1);
872
+ z(!1);
872
873
  }
873
874
  };
874
875
  e.useEffect(() => {
875
- const l = (L) => {
876
- D.current && !D.current.contains(L.target) && (_(!1), i(!1), H(""));
876
+ const s = (_) => {
877
+ D.current && !D.current.contains(_.target) && (E(!1), v(!1), H(""));
877
878
  };
878
- return document.addEventListener("mousedown", l), () => {
879
- document.removeEventListener("mousedown", l);
879
+ return document.addEventListener("mousedown", s), () => {
880
+ document.removeEventListener("mousedown", s);
880
881
  };
881
882
  }, []);
882
883
  const ae = () => {
883
- x || (_(!0), i(!0), E && I.current && setTimeout(() => {
884
- var l;
885
- return (l = I.current) == null ? void 0 : l.focus();
884
+ g || (E(!0), v(!0), S && A.current && setTimeout(() => {
885
+ var s;
886
+ return (s = A.current) == null ? void 0 : s.focus();
886
887
  }, 0));
887
- }, ee = (l) => {
888
- i(!0), p && p(l);
889
- }, re = (l) => {
890
- B && B(l);
891
- }, n = (l) => {
892
- H(l.target.value);
893
- }, F = (l) => {
894
- let L;
895
- O.includes(l) ? L = O.filter((K) => K !== l) : L = [...O, l], N && t && N.setValue(t, L), h.onChange && h.onChange({
896
- target: { value: L }
897
- }), i(!0);
898
- }, a = (l, L) => {
899
- L.stopPropagation();
900
- const K = O.filter((le) => le !== l);
901
- N && t && N.setValue(t, K), h.onChange && h.onChange({
888
+ }, ee = (s) => {
889
+ v(!0), f && f(s);
890
+ }, re = (s) => {
891
+ B && B(s);
892
+ }, l = (s) => {
893
+ H(s.target.value);
894
+ }, P = (s) => {
895
+ let _;
896
+ $.includes(s) ? _ = $.filter((K) => K !== s) : _ = [...$, s], L && t && L.setValue(t, _), y.onChange && y.onChange({
897
+ target: { value: _ }
898
+ }), v(!0);
899
+ }, a = (s, _) => {
900
+ _.stopPropagation();
901
+ const K = $.filter((se) => se !== s);
902
+ L && t && L.setValue(t, K), y.onChange && y.onChange({
902
903
  target: { value: K }
903
904
  });
904
- }, P = (l) => {
905
- l.stopPropagation(), N && t && N.setValue(t, []), h.onChange && h.onChange({
905
+ }, I = (s) => {
906
+ s.stopPropagation(), L && t && L.setValue(t, []), y.onChange && y.onChange({
906
907
  target: { value: [] }
907
- }), _(!1), i(!1), H("");
908
- }, j = k.filter((l) => O.includes(l.value)), Q = j.slice(0, w), Y = j.length - w;
909
- return /* @__PURE__ */ e.createElement("div", { className: u("relative", f), ref: D }, /* @__PURE__ */ e.createElement(
908
+ }), E(!1), v(!1), H("");
909
+ }, j = b.filter((s) => $.includes(s.value)), Q = j.slice(0, h), Y = j.length - h;
910
+ return /* @__PURE__ */ e.createElement("div", { className: i("relative", c), ref: D }, /* @__PURE__ */ e.createElement(
910
911
  "div",
911
912
  {
912
- id: h.id || t,
913
- tabIndex: E ? -1 : 0,
913
+ id: y.id || t,
914
+ tabIndex: S ? -1 : 0,
914
915
  role: "button",
915
916
  "aria-haspopup": "listbox",
916
- "aria-expanded": x,
917
- className: u(
917
+ "aria-expanded": g,
918
+ className: i(
918
919
  "peer flex items-center min-h-12 w-full border border-[var(--primary,#2563eb)] rounded-md bg-[var(--input-bg,#fff)] text-[var(--input-text,#222)] px-3 py-2 text-sm transition focus:outline-none focus:border-[var(--primary,#2563eb)] disabled:cursor-not-allowed disabled:opacity-50 appearance-none cursor-pointer relative",
919
- s
920
+ n
920
921
  ),
921
922
  onClick: ae,
922
- onFocus: E ? void 0 : ee,
923
- onBlur: E ? void 0 : re,
924
- ref: S
923
+ onFocus: S ? void 0 : ee,
924
+ onBlur: S ? void 0 : re,
925
+ ref: M
925
926
  },
926
- /* @__PURE__ */ e.createElement("div", { className: "flex flex-wrap gap-1 items-center min-h-[1.5rem] w-full" }, Q.map((l) => /* @__PURE__ */ e.createElement(
927
+ /* @__PURE__ */ e.createElement("div", { className: "flex flex-wrap gap-1 items-center min-h-[1.5rem] w-full" }, Q.map((s) => /* @__PURE__ */ e.createElement(
927
928
  "span",
928
929
  {
929
- key: l.value,
930
+ key: s.value,
930
931
  className: "flex items-center border border-blue-200 bg-blue-50 text-blue-700 rounded-2xl px-3 py-1 text-xs shadow-sm gap-2",
931
932
  style: { maxWidth: "140px" }
932
933
  },
933
- /* @__PURE__ */ e.createElement("span", { className: "truncate", title: l.label }, l.label),
934
+ /* @__PURE__ */ e.createElement("span", { className: "truncate", title: s.label }, s.label),
934
935
  /* @__PURE__ */ e.createElement(
935
936
  "button",
936
937
  {
937
938
  type: "button",
938
939
  className: "ml-1 text-[var(--primary,#2563eb)] hover:text-red-500 focus:outline-none w-4 h-4 flex items-center justify-center rounded-full transition-colors duration-150",
939
- "aria-label": `Remover ${l.label}`,
940
+ "aria-label": `Remover ${s.label}`,
940
941
  tabIndex: -1,
941
- onClick: (L) => a(l.value, L)
942
+ onClick: (_) => a(s.value, _)
942
943
  },
943
944
  /* @__PURE__ */ e.createElement(
944
945
  "svg",
@@ -960,36 +961,36 @@ const Te = e.forwardRef(
960
961
  )
961
962
  )
962
963
  )
963
- )), Y > 0 && /* @__PURE__ */ e.createElement("span", { className: "flex items-center border border-gray-200 bg-gray-100 text-gray-600 rounded-2xl px-3 py-1 text-xs" }, "+", Y, " mais"), E ? /* @__PURE__ */ e.createElement(
964
+ )), Y > 0 && /* @__PURE__ */ e.createElement("span", { className: "flex items-center border border-gray-200 bg-gray-100 text-gray-600 rounded-2xl px-3 py-1 text-xs" }, "+", Y, " mais"), S ? /* @__PURE__ */ e.createElement(
964
965
  "input",
965
966
  {
966
- ref: I,
967
+ ref: A,
967
968
  type: "text",
968
- value: b,
969
- onChange: n,
969
+ value: m,
970
+ onChange: l,
970
971
  onFocus: ee,
971
972
  onBlur: re,
972
- placeholder: O.length === 0 && !o ? "Selecione..." : "",
973
+ placeholder: $.length === 0 && !o ? "Selecione..." : "",
973
974
  className: "flex-1 min-w-[120px] bg-transparent border-none outline-none text-sm"
974
975
  }
975
- ) : O.length === 0 && !o && /* @__PURE__ */ e.createElement("span", { className: "text-gray-400 text-sm" }, "Selecione...")),
976
- R && /* @__PURE__ */ e.createElement("div", { className: "absolute right-8 top-1/2 -translate-y-1/2" }, /* @__PURE__ */ e.createElement("div", { className: "animate-spin rounded-full h-4 w-4 border-b-2 border-[var(--primary,#2563eb)]" })),
977
- y && O && O.length > 0 && !R && /* @__PURE__ */ e.createElement(
976
+ ) : $.length === 0 && !o && /* @__PURE__ */ e.createElement("span", { className: "text-gray-400 text-sm" }, "Selecione...")),
977
+ C && /* @__PURE__ */ e.createElement("div", { className: "absolute right-8 top-1/2 -translate-y-1/2" }, /* @__PURE__ */ e.createElement("div", { className: "animate-spin rounded-full h-4 w-4 border-b-2 border-[var(--primary,#2563eb)]" })),
978
+ N && $ && $.length > 0 && !C && /* @__PURE__ */ e.createElement(
978
979
  "button",
979
980
  {
980
981
  type: "button",
981
982
  tabIndex: -1,
982
983
  "aria-label": "Limpar seleção",
983
984
  className: "absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-red-500 bg-transparent p-1 rounded-full focus:outline-none",
984
- onClick: P
985
+ onClick: I
985
986
  },
986
987
  "✕"
987
988
  )
988
989
  ), o && /* @__PURE__ */ e.createElement(
989
990
  "label",
990
991
  {
991
- htmlFor: h.id || t,
992
- className: u(
992
+ htmlFor: y.id || t,
993
+ className: i(
993
994
  "absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",
994
995
  oe ? "top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white" : "top-3 scale-100 translate-y-0.5"
995
996
  )
@@ -998,50 +999,50 @@ const Te = e.forwardRef(
998
999
  ), /* @__PURE__ */ e.createElement(
999
1000
  "div",
1000
1001
  {
1001
- className: u(
1002
+ className: i(
1002
1003
  "absolute left-0 w-full mt-1 rounded-md transition-all duration-200 overflow-hidden",
1003
1004
  "bg-[var(--select-dropdown-bg)] border-[var(--select-dropdown-border)] text-[var(--select-dropdown-text)]",
1004
- x ? "border max-h-36 opacity-100 scale-100" : "max-h-0 opacity-0 scale-95 pointer-events-none"
1005
+ g ? "border max-h-36 opacity-100 scale-100" : "max-h-0 opacity-0 scale-95 pointer-events-none"
1005
1006
  ),
1006
1007
  style: {
1007
- maxHeight: x ? "9.5rem" : "0",
1008
- overflowY: k.length > 3 ? "auto" : "hidden",
1008
+ maxHeight: g ? "9.5rem" : "0",
1009
+ overflowY: b.length > 3 ? "auto" : "hidden",
1009
1010
  position: "fixed",
1010
1011
  // Use fixed positioning to escape container overflow
1011
- top: x ? `${G.top}px` : "auto",
1012
- left: x ? `${G.left}px` : "auto",
1013
- width: x ? `${G.width}px` : "auto",
1012
+ top: g ? `${G.top}px` : "auto",
1013
+ left: g ? `${G.left}px` : "auto",
1014
+ width: g ? `${G.width}px` : "auto",
1014
1015
  zIndex: 9999,
1015
- boxShadow: x ? "var(--select-dropdown-shadow)" : "none"
1016
+ boxShadow: g ? "var(--select-dropdown-shadow)" : "none"
1016
1017
  }
1017
1018
  },
1018
- R ? /* @__PURE__ */ e.createElement("div", { className: "px-3 py-2 text-sm text-gray-500 text-center" }, z) : k.length === 0 ? /* @__PURE__ */ e.createElement("div", { className: "px-3 py-2 text-sm text-gray-500 text-center" }, T) : k.map((l) => /* @__PURE__ */ e.createElement(
1019
+ C ? /* @__PURE__ */ e.createElement("div", { className: "px-3 py-2 text-sm text-gray-500 text-center" }, T) : b.length === 0 ? /* @__PURE__ */ e.createElement("div", { className: "px-3 py-2 text-sm text-gray-500 text-center" }, F) : b.map((s) => /* @__PURE__ */ e.createElement(
1019
1020
  "div",
1020
1021
  {
1021
- key: l.value,
1022
- className: u(
1022
+ key: s.value,
1023
+ className: i(
1023
1024
  "px-3 py-2 cursor-pointer text-sm flex items-center gap-2 transition-colors duration-150",
1024
1025
  "hover:bg-[var(--select-dropdown-hover)]",
1025
- O.includes(l.value) && "bg-[var(--select-dropdown-selected)] font-semibold"
1026
+ $.includes(s.value) && "bg-[var(--select-dropdown-selected)] font-semibold"
1026
1027
  ),
1027
- onMouseDown: () => F(l.value)
1028
+ onMouseDown: () => P(s.value)
1028
1029
  },
1029
1030
  /* @__PURE__ */ e.createElement(
1030
1031
  "input",
1031
1032
  {
1032
1033
  type: "checkbox",
1033
- checked: O.includes(l.value),
1034
+ checked: $.includes(s.value),
1034
1035
  readOnly: !0,
1035
1036
  className: "accent-blue-500"
1036
1037
  }
1037
1038
  ),
1038
- l.label
1039
+ s.label
1039
1040
  ))
1040
1041
  ), U && /* @__PURE__ */ e.createElement("span", { className: "text-red-500 text-xs mt-1 block" }, U));
1041
1042
  }
1042
1043
  );
1043
- Te.displayName = "MultiAsyncSelect";
1044
- const Ie = {
1044
+ ze.displayName = "MultiAsyncSelect";
1045
+ const Ae = {
1045
1046
  sm: "h-10 text-sm px-3",
1046
1047
  md: "h-12 text-base px-4",
1047
1048
  lg: "h-16 text-lg px-6"
@@ -1050,24 +1051,24 @@ const Ie = {
1050
1051
  name: t,
1051
1052
  label: o,
1052
1053
  options: r,
1053
- className: s,
1054
- containerClassName: f,
1055
- optionClassName: y,
1056
- direction: m = "row",
1057
- size: z = "md",
1058
- onFocus: T,
1059
- onBlur: E,
1060
- ...v
1061
- }, w) => {
1062
- var x, _, k;
1063
- const p = ie(), B = p == null ? void 0 : p.control, h = B && t ? ce({ control: B, name: t }) : void 0, S = v.value ?? h ?? "", c = (k = (_ = (x = p == null ? void 0 : p.formState) == null ? void 0 : x.errors) == null ? void 0 : _[t]) == null ? void 0 : k.message, i = (g) => {
1064
- p && t && p.setValue(t, g), v.onChange && v.onChange({ target: { value: g } });
1054
+ className: n,
1055
+ containerClassName: c,
1056
+ optionClassName: N,
1057
+ direction: p = "row",
1058
+ size: T = "md",
1059
+ onFocus: F,
1060
+ onBlur: S,
1061
+ ...x
1062
+ }, h) => {
1063
+ var g, E, b;
1064
+ const f = ie(), B = f == null ? void 0 : f.control, y = B && t ? ce({ control: B, name: t }) : void 0, M = x.value ?? y ?? "", d = (b = (E = (g = f == null ? void 0 : f.formState) == null ? void 0 : g.errors) == null ? void 0 : E[t]) == null ? void 0 : b.message, v = (w) => {
1065
+ f && t && f.setValue(t, w), x.onChange && x.onChange({ target: { value: w } });
1065
1066
  };
1066
- return /* @__PURE__ */ e.createElement("div", { className: u("relative", f), ref: w }, o && /* @__PURE__ */ e.createElement(
1067
+ return /* @__PURE__ */ e.createElement("div", { className: i("relative", c), ref: h }, o && /* @__PURE__ */ e.createElement(
1067
1068
  "label",
1068
1069
  {
1069
1070
  htmlFor: t,
1070
- className: u(
1071
+ className: i(
1071
1072
  "absolute left-3 z-10 origin-[0] cursor-text select-none text-sm transition-all duration-200",
1072
1073
  "top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white"
1073
1074
  )
@@ -1076,67 +1077,67 @@ const Ie = {
1076
1077
  ), /* @__PURE__ */ e.createElement(
1077
1078
  "div",
1078
1079
  {
1079
- className: u(
1080
+ className: i(
1080
1081
  "flex gap-2 w-full pt-6",
1081
1082
  // espaço para label flutuante
1082
- m === "row" ? "flex-row" : "flex-col",
1083
- s
1083
+ p === "row" ? "flex-row" : "flex-col",
1084
+ n
1084
1085
  ),
1085
1086
  "aria-label": o,
1086
1087
  tabIndex: -1,
1087
- onFocus: T,
1088
- onBlur: E
1088
+ onFocus: F,
1089
+ onBlur: S
1089
1090
  },
1090
- r.map((g) => /* @__PURE__ */ e.createElement(
1091
+ r.map((w) => /* @__PURE__ */ e.createElement(
1091
1092
  "button",
1092
1093
  {
1093
- key: g.value,
1094
+ key: w.value,
1094
1095
  type: "button",
1095
- className: u(
1096
+ className: i(
1096
1097
  "relative flex items-center justify-center border rounded-lg transition-all duration-200 shadow-sm px-4 focus:outline-none focus:ring-2 focus:ring-[var(--primary-hover,#dbeafe)]",
1097
- Ie[z],
1098
- S === g.value ? "border-[var(--primary,#2563eb)] bg-[var(--primary-hover,#dbeafe)] text-[var(--primary,#2563eb)] ring-2 ring-[var(--primary-hover,#dbeafe)] shadow-md transform scale-[1.02]" : "border-gray-200 bg-white text-gray-600 hover:border-[var(--primary,#2563eb)] hover:bg-[var(--primary-hover,#dbeafe)] hover:text-[var(--primary,#2563eb)] hover:shadow-md",
1099
- y
1098
+ Ae[T],
1099
+ M === w.value ? "border-[var(--primary,#2563eb)] bg-[var(--primary-hover,#dbeafe)] text-[var(--primary,#2563eb)] ring-2 ring-[var(--primary-hover,#dbeafe)] shadow-md transform scale-[1.02]" : "border-gray-200 bg-white text-gray-600 hover:border-[var(--primary,#2563eb)] hover:bg-[var(--primary-hover,#dbeafe)] hover:text-[var(--primary,#2563eb)] hover:shadow-md",
1100
+ N
1100
1101
  ),
1101
- "aria-pressed": S === g.value,
1102
- "data-selected": S === g.value,
1102
+ "aria-pressed": M === w.value,
1103
+ "data-selected": M === w.value,
1103
1104
  tabIndex: 0,
1104
- onClick: () => i(g.value),
1105
- onKeyDown: (R) => {
1106
- (R.key === "Enter" || R.key === " ") && (R.preventDefault(), i(g.value));
1105
+ onClick: () => v(w.value),
1106
+ onKeyDown: (C) => {
1107
+ (C.key === "Enter" || C.key === " ") && (C.preventDefault(), v(w.value));
1107
1108
  }
1108
1109
  },
1109
- g.icon && /* @__PURE__ */ e.createElement("span", { className: "mr-2 text-lg flex items-center" }, g.icon),
1110
- /* @__PURE__ */ e.createElement("span", { className: "truncate font-medium" }, g.label)
1110
+ w.icon && /* @__PURE__ */ e.createElement("span", { className: "mr-2 text-lg flex items-center" }, w.icon),
1111
+ /* @__PURE__ */ e.createElement("span", { className: "truncate font-medium" }, w.label)
1111
1112
  ))
1112
- ), c && /* @__PURE__ */ e.createElement("span", { className: "text-red-500 text-xs mt-1 block" }, c));
1113
+ ), d && /* @__PURE__ */ e.createElement("span", { className: "text-red-500 text-xs mt-1 block" }, d));
1113
1114
  }
1114
1115
  );
1115
1116
  We.displayName = "RadioGroup";
1116
- const xe = M.forwardRef(
1117
- ({ children: t, className: o, as: r = "div", ...s }, f) => /* @__PURE__ */ M.createElement(
1117
+ const ge = k.forwardRef(
1118
+ ({ children: t, className: o, as: r = "div", ...n }, c) => /* @__PURE__ */ k.createElement(
1118
1119
  r,
1119
1120
  {
1120
- ref: f,
1121
- className: u(
1121
+ ref: c,
1122
+ className: i(
1122
1123
  "px-6 py-4 border-b",
1123
1124
  "bg-[var(--card-header-bg,rgba(249,250,251,0.5))]",
1124
1125
  "border-[var(--card-header-border,#e5e7eb)]",
1125
1126
  "text-[var(--card-text,#111827)]",
1126
1127
  o
1127
1128
  ),
1128
- ...s
1129
+ ...n
1129
1130
  },
1130
1131
  t
1131
1132
  )
1132
1133
  );
1133
- xe.displayName = "CardHeader";
1134
- const ge = M.forwardRef(
1135
- ({ children: t, className: o, as: r = "div", ...s }, f) => /* @__PURE__ */ M.createElement(
1134
+ ge.displayName = "CardHeader";
1135
+ const he = k.forwardRef(
1136
+ ({ children: t, className: o, as: r = "div", ...n }, c) => /* @__PURE__ */ k.createElement(
1136
1137
  r,
1137
1138
  {
1138
- ref: f,
1139
- className: u(
1139
+ ref: c,
1140
+ className: i(
1140
1141
  "px-6 py-4",
1141
1142
  "flex-1",
1142
1143
  // Para ocupar o espaço disponível
@@ -1144,98 +1145,102 @@ const ge = M.forwardRef(
1144
1145
  "text-[var(--card-text,#111827)]",
1145
1146
  o
1146
1147
  ),
1147
- ...s
1148
+ ...n
1148
1149
  },
1149
1150
  t
1150
1151
  )
1151
1152
  );
1152
- ge.displayName = "CardBody";
1153
- const he = M.forwardRef(
1154
- ({ children: t, className: o, as: r = "div", ...s }, f) => /* @__PURE__ */ M.createElement(
1153
+ he.displayName = "CardBody";
1154
+ const we = k.forwardRef(
1155
+ ({ children: t, className: o, as: r = "div", ...n }, c) => /* @__PURE__ */ k.createElement(
1155
1156
  r,
1156
1157
  {
1157
- ref: f,
1158
- className: u(
1158
+ ref: c,
1159
+ className: i(
1159
1160
  "px-6 py-4 border-t",
1160
1161
  "bg-[var(--card-footer-bg,rgba(249,250,251,0.5))]",
1161
1162
  "border-[var(--card-footer-border,#e5e7eb)]",
1162
1163
  "text-[var(--card-text,#111827)]",
1163
1164
  o
1164
1165
  ),
1165
- ...s
1166
+ ...n
1166
1167
  },
1167
1168
  t
1168
1169
  )
1169
1170
  );
1170
- he.displayName = "CardFooter";
1171
- const Ae = M.forwardRef(
1171
+ we.displayName = "CardFooter";
1172
+ const Oe = k.forwardRef(
1172
1173
  ({
1173
1174
  children: t,
1174
1175
  className: o,
1175
1176
  variant: r = "default",
1176
- size: s = "md",
1177
- padding: f = "none",
1177
+ size: n = "md",
1178
+ padding: c = "none",
1178
1179
  // none pois cada seção tem seu próprio padding
1179
- rounded: y = "lg",
1180
- constrainWidth: m = !1,
1180
+ rounded: N = "lg",
1181
+ constrainWidth: p = !1,
1181
1182
  // Por padrão, não aplicar max-width
1182
- ...z
1183
- }, T) => {
1184
- const E = {
1183
+ allowOverflow: T = !1,
1184
+ // Por padrão, aplicar overflow hidden para interface limpa
1185
+ ...F
1186
+ }, S) => {
1187
+ const x = {
1185
1188
  default: "bg-[var(--card-bg,#ffffff)] border border-[var(--card-border,#e5e7eb)] shadow-[var(--card-shadow-sm,0_1px_2px_0_rgb(0_0_0_/_0.05))]",
1186
1189
  outlined: "bg-[var(--card-bg,#ffffff)] border-2 border-[var(--primary,#2563eb)]",
1187
1190
  elevated: "bg-[var(--card-bg,#ffffff)] border border-[var(--card-border,#e5e7eb)] shadow-[var(--card-shadow-lg,0_10px_15px_-3px_rgb(0_0_0_/_0.1),_0_4px_6px_-4px_rgb(0_0_0_/_0.1))]",
1188
1191
  flat: "bg-[var(--card-bg,#ffffff)] border-0"
1189
- }, v = {
1192
+ }, h = {
1190
1193
  sm: "max-w-sm",
1191
1194
  md: "max-w-md",
1192
1195
  lg: "max-w-lg"
1193
- }, w = {
1196
+ }, f = {
1194
1197
  none: "",
1195
1198
  sm: "p-3",
1196
1199
  md: "p-4",
1197
1200
  lg: "p-6"
1198
- }, p = {
1201
+ }, B = {
1199
1202
  none: "rounded-none",
1200
1203
  sm: "rounded-sm",
1201
1204
  md: "rounded-md",
1202
1205
  lg: "rounded-lg",
1203
1206
  xl: "rounded-xl"
1204
1207
  };
1205
- return /* @__PURE__ */ M.createElement(
1208
+ return /* @__PURE__ */ k.createElement(
1206
1209
  "div",
1207
1210
  {
1208
- ref: T,
1209
- className: u(
1211
+ ref: S,
1212
+ className: i(
1210
1213
  "flex flex-col",
1211
1214
  // Flex column para organizar header, body, footer
1212
- E[r],
1213
- m && v[s],
1215
+ !T && "overflow-hidden",
1216
+ // Overflow hidden por padrão para bordas limpas
1217
+ x[r],
1218
+ p && h[n],
1214
1219
  // Aplicar max-width apenas se constrainWidth for true
1215
- w[f],
1216
- p[y],
1220
+ f[c],
1221
+ B[N],
1217
1222
  o
1218
1223
  ),
1219
- ...z
1224
+ ...F
1220
1225
  },
1221
1226
  t
1222
1227
  );
1223
1228
  }
1224
- ), Ve = Object.assign(Ae, {
1225
- Header: xe,
1226
- Body: ge,
1227
- Footer: he
1228
- }), we = M.forwardRef(
1229
+ ), Ye = Object.assign(Oe, {
1230
+ Header: ge,
1231
+ Body: he,
1232
+ Footer: we
1233
+ }), ye = k.forwardRef(
1229
1234
  ({
1230
1235
  children: t,
1231
1236
  className: o,
1232
1237
  variant: r = "default",
1233
- size: s = "md",
1234
- responsive: f = !1,
1235
- stickyHeader: y = !1,
1236
- ...m
1237
- }, z) => {
1238
- const T = u(
1238
+ size: n = "md",
1239
+ responsive: c = !1,
1240
+ stickyHeader: N = !1,
1241
+ ...p
1242
+ }, T) => {
1243
+ const F = i(
1239
1244
  // Base styles
1240
1245
  "w-full border-collapse bg-[var(--table-bg)] text-[var(--table-text)]",
1241
1246
  // Variant styles
@@ -1244,76 +1249,76 @@ const Ae = M.forwardRef(
1244
1249
  },
1245
1250
  // Size styles
1246
1251
  {
1247
- "text-sm": s === "sm",
1248
- "text-base": s === "md",
1249
- "text-lg": s === "lg"
1252
+ "text-sm": n === "sm",
1253
+ "text-base": n === "md",
1254
+ "text-lg": n === "lg"
1250
1255
  },
1251
1256
  o
1252
- ), E = u(
1257
+ ), S = i(
1253
1258
  {
1254
- "overflow-x-auto": f,
1255
- "max-h-96 overflow-y-auto": y
1259
+ "overflow-x-auto": c,
1260
+ "max-h-96 overflow-y-auto": N
1256
1261
  }
1257
- ), v = /* @__PURE__ */ M.createElement(
1262
+ ), x = /* @__PURE__ */ k.createElement(
1258
1263
  "table",
1259
1264
  {
1260
- ref: z,
1261
- className: T,
1262
- ...m
1265
+ ref: T,
1266
+ className: F,
1267
+ ...p
1263
1268
  },
1264
1269
  t
1265
1270
  );
1266
- return f || y ? /* @__PURE__ */ M.createElement("div", { className: E }, v) : v;
1271
+ return c || N ? /* @__PURE__ */ k.createElement("div", { className: S }, x) : x;
1267
1272
  }
1268
- ), ye = M.forwardRef(
1269
- ({ children: t, className: o, as: r = "thead", ...s }, f) => /* @__PURE__ */ M.createElement(
1273
+ ), Ee = k.forwardRef(
1274
+ ({ children: t, className: o, as: r = "thead", ...n }, c) => /* @__PURE__ */ k.createElement(
1270
1275
  r,
1271
1276
  {
1272
- ref: f,
1273
- className: u(
1277
+ ref: c,
1278
+ className: i(
1274
1279
  "border-b border-[var(--table-border)] bg-[var(--table-header-bg)]",
1275
1280
  {
1276
1281
  "sticky top-0 z-10": r === "thead"
1277
1282
  },
1278
1283
  o
1279
1284
  ),
1280
- ...s
1285
+ ...n
1281
1286
  },
1282
1287
  t
1283
1288
  )
1284
- ), Ee = M.forwardRef(
1285
- ({ children: t, className: o, as: r = "tbody", ...s }, f) => /* @__PURE__ */ M.createElement(
1289
+ ), Ne = k.forwardRef(
1290
+ ({ children: t, className: o, as: r = "tbody", ...n }, c) => /* @__PURE__ */ k.createElement(
1286
1291
  r,
1287
1292
  {
1288
- ref: f,
1289
- className: u(
1293
+ ref: c,
1294
+ className: i(
1290
1295
  "[&_tr:nth-child(odd)]:bg-[var(--table-row-odd)]",
1291
1296
  "[&_tr:nth-child(even)]:bg-[var(--table-row-even)]",
1292
1297
  o
1293
1298
  ),
1294
- ...s
1299
+ ...n
1295
1300
  },
1296
1301
  t
1297
1302
  )
1298
- ), Ce = M.forwardRef(
1299
- ({ children: t, className: o, as: r = "tfoot", ...s }, f) => /* @__PURE__ */ M.createElement(
1303
+ ), Ce = k.forwardRef(
1304
+ ({ children: t, className: o, as: r = "tfoot", ...n }, c) => /* @__PURE__ */ k.createElement(
1300
1305
  r,
1301
1306
  {
1302
- ref: f,
1303
- className: u(
1307
+ ref: c,
1308
+ className: i(
1304
1309
  "border-t border-[var(--table-border)] bg-[var(--table-header-bg)] font-medium",
1305
1310
  o
1306
1311
  ),
1307
- ...s
1312
+ ...n
1308
1313
  },
1309
1314
  t
1310
1315
  )
1311
- ), Ne = M.forwardRef(
1312
- ({ children: t, className: o, variant: r = "default", ...s }, f) => /* @__PURE__ */ M.createElement(
1316
+ ), ke = k.forwardRef(
1317
+ ({ children: t, className: o, variant: r = "default", ...n }, c) => /* @__PURE__ */ k.createElement(
1313
1318
  "tr",
1314
1319
  {
1315
- ref: f,
1316
- className: u(
1320
+ ref: c,
1321
+ className: i(
1317
1322
  "border-b border-[var(--table-border)] transition-colors",
1318
1323
  {
1319
1324
  "hover:bg-[var(--table-row-hover)]": r === "hover",
@@ -1321,156 +1326,243 @@ const Ae = M.forwardRef(
1321
1326
  },
1322
1327
  o
1323
1328
  ),
1324
- ...s
1329
+ ...n
1325
1330
  },
1326
1331
  t
1327
1332
  )
1328
- ), ke = M.forwardRef(
1333
+ ), Se = k.forwardRef(
1329
1334
  ({
1330
1335
  children: t,
1331
1336
  className: o,
1332
1337
  as: r = "td",
1333
- align: s = "left",
1334
- scope: f,
1335
- colSpan: y,
1336
- rowSpan: m,
1337
- ...z
1338
- }, T) => /* @__PURE__ */ M.createElement(
1338
+ align: n = "left",
1339
+ scope: c,
1340
+ colSpan: N,
1341
+ rowSpan: p,
1342
+ ...T
1343
+ }, F) => /* @__PURE__ */ k.createElement(
1339
1344
  r,
1340
1345
  {
1341
- ref: T,
1342
- scope: r === "th" ? f : void 0,
1343
- colSpan: y,
1344
- rowSpan: m,
1345
- className: u(
1346
+ ref: F,
1347
+ scope: r === "th" ? c : void 0,
1348
+ colSpan: N,
1349
+ rowSpan: p,
1350
+ className: i(
1346
1351
  "px-4 py-3 text-left",
1347
1352
  {
1348
1353
  "font-semibold": r === "th",
1349
1354
  "text-sm": r === "td",
1350
- "text-center": s === "center",
1351
- "text-right": s === "right"
1355
+ "text-center": n === "center",
1356
+ "text-right": n === "right"
1352
1357
  },
1353
1358
  o
1354
1359
  ),
1355
- ...z
1360
+ ...T
1356
1361
  },
1357
1362
  t
1358
1363
  )
1359
1364
  );
1360
- we.displayName = "Table";
1361
- ye.displayName = "TableHeader";
1362
- Ee.displayName = "TableBody";
1365
+ ye.displayName = "Table";
1366
+ Ee.displayName = "TableHeader";
1367
+ Ne.displayName = "TableBody";
1363
1368
  Ce.displayName = "TableFooter";
1364
- Ne.displayName = "TableRow";
1365
- ke.displayName = "TableCell";
1366
- const De = Object.assign(we, {
1367
- Header: ye,
1368
- Body: Ee,
1369
+ ke.displayName = "TableRow";
1370
+ Se.displayName = "TableCell";
1371
+ const Ge = Object.assign(ye, {
1372
+ Header: Ee,
1373
+ Body: Ne,
1369
1374
  Footer: Ce,
1370
- Row: Ne,
1371
- Cell: ke
1372
- }), je = ({
1375
+ Row: ke,
1376
+ Cell: Se
1377
+ }), Ke = ({
1373
1378
  content: t,
1374
1379
  children: o,
1375
1380
  position: r = "top",
1376
- className: s = "",
1377
- disabled: f = !1
1381
+ className: n = "",
1382
+ disabled: c = !1
1378
1383
  }) => {
1379
- const [y, m] = pe(!1), [z, T] = pe(r), E = be(null), v = be(null);
1380
- Le(() => {
1381
- if (!y || !E.current || !v.current) return;
1382
- const i = E.current, _ = v.current.getBoundingClientRect(), k = i.getBoundingClientRect();
1383
- let g = r;
1384
- const R = window.innerWidth, $ = window.innerHeight;
1385
- r === "top" && _.top < k.height + 10 ? g = "bottom" : r === "bottom" && _.bottom + k.height + 10 > $ ? g = "top" : r === "left" && _.left < k.width + 10 ? g = "right" : r === "right" && _.right + k.width + 10 > R && (g = "left"), T(g);
1386
- }, [y, r]);
1387
- const w = () => {
1388
- f || m(!0);
1389
- }, p = () => {
1390
- m(!1);
1391
- }, B = () => {
1392
- f || m(!0);
1393
- }, h = () => {
1394
- m(!1);
1395
- }, S = () => {
1396
- const i = "absolute z-[9999] pointer-events-none";
1397
- switch (z) {
1384
+ const [N, p] = me(!1), [T, F] = me(r), [S, x] = me({}), h = be(null), f = be(null);
1385
+ Be(() => {
1386
+ if (!N || !f.current) return;
1387
+ const b = f.current.getBoundingClientRect();
1388
+ let w = r, C = 0, z = 0;
1389
+ switch (r) {
1390
+ case "top":
1391
+ C = b.top - 8, z = b.left + b.width / 2;
1392
+ break;
1393
+ case "bottom":
1394
+ C = b.bottom + 8, z = b.left + b.width / 2;
1395
+ break;
1396
+ case "left":
1397
+ C = b.top + b.height / 2, z = b.left - 8;
1398
+ break;
1399
+ case "right":
1400
+ C = b.top + b.height / 2, z = b.right + 8;
1401
+ break;
1402
+ }
1403
+ if (h.current) {
1404
+ const m = h.current.getBoundingClientRect(), H = window.innerWidth, V = window.innerHeight;
1405
+ r === "top" && b.top < m.height + 16 ? (w = "bottom", C = b.bottom + 8) : r === "bottom" && b.bottom + m.height + 16 > V ? (w = "top", C = b.top - 8) : r === "left" && b.left < m.width + 16 ? (w = "right", z = b.right + 8) : r === "right" && b.right + m.width + 16 > H && (w = "left", z = b.left - 8);
1406
+ }
1407
+ F(w), x({
1408
+ position: "fixed",
1409
+ top: `${C}px`,
1410
+ left: `${z}px`,
1411
+ zIndex: 9999
1412
+ });
1413
+ }, [N, r]);
1414
+ const B = () => {
1415
+ c || p(!0);
1416
+ }, y = () => {
1417
+ p(!1);
1418
+ }, M = () => {
1419
+ c || p(!0);
1420
+ }, d = () => {
1421
+ p(!1);
1422
+ }, v = () => {
1423
+ const E = "pointer-events-none";
1424
+ switch (T) {
1398
1425
  case "top":
1399
- return `${i} bottom-full left-1/2 transform -translate-x-1/2 mb-2`;
1426
+ return `${E} transform -translate-x-1/2 -translate-y-full`;
1400
1427
  case "bottom":
1401
- return `${i} top-full left-1/2 transform -translate-x-1/2 mt-2`;
1428
+ return `${E} transform -translate-x-1/2`;
1402
1429
  case "left":
1403
- return `${i} right-full top-1/2 transform -translate-y-1/2 mr-2`;
1430
+ return `${E} transform -translate-x-full -translate-y-1/2`;
1404
1431
  case "right":
1405
- return `${i} left-full top-1/2 transform -translate-y-1/2 ml-2`;
1432
+ return `${E} transform -translate-y-1/2`;
1406
1433
  default:
1407
- return `${i} bottom-full left-1/2 transform -translate-x-1/2 mb-2`;
1434
+ return `${E} transform -translate-x-1/2 -translate-y-full`;
1408
1435
  }
1409
- }, c = () => {
1410
- const i = "absolute w-2 h-2 bg-[var(--tooltip-bg,#374151)] transform rotate-45";
1411
- switch (z) {
1436
+ }, g = () => {
1437
+ const E = "absolute w-2 h-2 bg-[var(--tooltip-bg,#374151)] transform rotate-45";
1438
+ switch (T) {
1412
1439
  case "top":
1413
- return `${i} top-full left-1/2 transform -translate-x-1/2 -translate-y-1/2`;
1440
+ return `${E} top-full left-1/2 -translate-x-1/2 -translate-y-1/2`;
1414
1441
  case "bottom":
1415
- return `${i} bottom-full left-1/2 transform -translate-x-1/2 translate-y-1/2`;
1442
+ return `${E} bottom-full left-1/2 -translate-x-1/2 translate-y-1/2`;
1416
1443
  case "left":
1417
- return `${i} left-full top-1/2 transform -translate-y-1/2 -translate-x-1/2`;
1444
+ return `${E} left-full top-1/2 -translate-y-1/2 -translate-x-1/2`;
1418
1445
  case "right":
1419
- return `${i} right-full top-1/2 transform -translate-y-1/2 translate-x-1/2`;
1446
+ return `${E} right-full top-1/2 -translate-y-1/2 translate-x-1/2`;
1420
1447
  default:
1421
- return `${i} top-full left-1/2 transform -translate-x-1/2 -translate-y-1/2`;
1448
+ return `${E} top-full left-1/2 -translate-x-1/2 -translate-y-1/2`;
1422
1449
  }
1423
1450
  };
1424
- return f || !t ? /* @__PURE__ */ M.createElement(M.Fragment, null, o) : /* @__PURE__ */ M.createElement(
1451
+ return c || !t ? /* @__PURE__ */ k.createElement(k.Fragment, null, o) : /* @__PURE__ */ k.createElement(k.Fragment, null, /* @__PURE__ */ k.createElement(
1425
1452
  "div",
1426
1453
  {
1427
1454
  className: "relative inline-block",
1428
- ref: v,
1429
- onMouseEnter: w,
1430
- onMouseLeave: p,
1431
- onFocus: B,
1432
- onBlur: h
1455
+ ref: f,
1456
+ onMouseEnter: B,
1457
+ onMouseLeave: y,
1458
+ onFocus: M,
1459
+ onBlur: d
1433
1460
  },
1434
- o,
1435
- y && /* @__PURE__ */ M.createElement(
1461
+ o
1462
+ ), N && typeof document < "u" && ve(
1463
+ /* @__PURE__ */ k.createElement(
1436
1464
  "div",
1437
1465
  {
1438
- ref: E,
1439
- className: u(
1440
- S(),
1466
+ ref: h,
1467
+ style: S,
1468
+ className: i(
1469
+ v(),
1441
1470
  "px-2 py-1 text-sm rounded whitespace-nowrap",
1442
1471
  "bg-[var(--tooltip-bg,#374151)] text-[var(--tooltip-text,#fff)]",
1443
1472
  "shadow-[var(--tooltip-shadow,0_10px_15px_-3px_rgb(0_0_0_/_0.1),_0_4px_6px_-4px_rgb(0_0_0_/_0.1))]",
1444
1473
  "transition-opacity duration-200 ease-in-out",
1445
- s
1474
+ n
1446
1475
  ),
1447
- style: { zIndex: 999999 },
1448
1476
  role: "tooltip",
1449
- "aria-hidden": !y
1477
+ "aria-hidden": !N
1450
1478
  },
1451
1479
  t,
1452
- /* @__PURE__ */ M.createElement("div", { className: c() })
1480
+ /* @__PURE__ */ k.createElement("div", { className: g() })
1481
+ ),
1482
+ document.body
1483
+ ));
1484
+ }, $e = ({
1485
+ open: t,
1486
+ onClose: o,
1487
+ side: r = "right",
1488
+ size: n = "md",
1489
+ closeOnOverlayClick: c = !0,
1490
+ children: N,
1491
+ className: p = "",
1492
+ ...T
1493
+ }) => {
1494
+ const F = typeof document < "u" ? document.body : null, S = n === "sm" ? "w-64" : n === "md" ? "w-96" : n === "lg" ? "w-[36rem]" : void 0, x = typeof n == "string" && !["sm", "md", "lg"].includes(n) ? { width: n } : void 0, h = /* @__PURE__ */ k.createElement(
1495
+ "div",
1496
+ {
1497
+ "aria-hidden": !t,
1498
+ className: i(
1499
+ "fixed inset-0 z-50 flex",
1500
+ t ? "pointer-events-auto" : "pointer-events-none"
1501
+ )
1502
+ },
1503
+ /* @__PURE__ */ k.createElement(
1504
+ "div",
1505
+ {
1506
+ className: i(
1507
+ "absolute inset-0 bg-black/40 transition-opacity duration-200",
1508
+ t ? "opacity-100" : "opacity-0"
1509
+ ),
1510
+ onMouseDown: (f) => {
1511
+ c && f.target === f.currentTarget && o();
1512
+ }
1513
+ }
1514
+ ),
1515
+ /* @__PURE__ */ k.createElement(
1516
+ "div",
1517
+ {
1518
+ className: i(
1519
+ "relative h-full",
1520
+ r === "right" ? "ml-auto" : "mr-auto",
1521
+ // ensure the sheet doesn't shrink
1522
+ "flex-shrink-0"
1523
+ ),
1524
+ style: x
1525
+ },
1526
+ /* @__PURE__ */ k.createElement(
1527
+ "aside",
1528
+ {
1529
+ role: "dialog",
1530
+ "aria-modal": !0,
1531
+ className: i(
1532
+ "h-full bg-white shadow-xl border-l border-gray-100 overflow-auto transition-transform duration-300",
1533
+ r === "right" ? t ? "translate-x-0" : "translate-x-full" : t ? "translate-x-0" : "-translate-x-full",
1534
+ S,
1535
+ p
1536
+ ),
1537
+ style: x,
1538
+ ...T
1539
+ },
1540
+ N
1541
+ )
1453
1542
  )
1454
1543
  );
1544
+ return F ? ve(h, F) : null;
1455
1545
  };
1546
+ $e.displayName = "AsideSheet";
1456
1547
  export {
1457
- Pe as AsyncSelect,
1458
- He as Button,
1459
- Ve as Card,
1460
- ge as CardBody,
1461
- he as CardFooter,
1462
- xe as CardHeader,
1548
+ $e as AsideSheet,
1549
+ Te as AsyncSelect,
1550
+ je as Button,
1551
+ Ye as Card,
1552
+ he as CardBody,
1553
+ we as CardFooter,
1554
+ ge as CardHeader,
1463
1555
  _e as Input,
1464
- Te as MultiAsyncSelect,
1465
- ze as MultiSelect,
1556
+ ze as MultiAsyncSelect,
1557
+ Ie as MultiSelect,
1466
1558
  We as RadioGroup,
1467
- Me as Select,
1468
- De as Table,
1469
- Ee as TableBody,
1470
- ke as TableCell,
1559
+ Fe as Select,
1560
+ Ge as Table,
1561
+ Ne as TableBody,
1562
+ Se as TableCell,
1471
1563
  Ce as TableFooter,
1472
- ye as TableHeader,
1473
- Ne as TableRow,
1474
- Fe as Textarea,
1475
- je as Tooltip
1564
+ Ee as TableHeader,
1565
+ ke as TableRow,
1566
+ Pe as Textarea,
1567
+ Ke as Tooltip
1476
1568
  };