rharuow-ds 1.7.2 → 1.8.2
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/README.md +83 -2
- package/dist/rharuow-ds.cjs.js +1 -1
- package/dist/rharuow-ds.es.js +857 -719
- package/dist/styles.css +1 -1
- package/dist/types/src/components/Accordion.d.ts +22 -0
- package/dist/types/src/components/index.d.ts +1 -0
- package/dist/types/src/stories/Accordion.stories.d.ts +18 -0
- package/package.json +5 -2
package/dist/rharuow-ds.es.js
CHANGED
|
@@ -1,136 +1,136 @@
|
|
|
1
1
|
import * as e from "react";
|
|
2
|
-
import
|
|
3
|
-
import { useFormContext as
|
|
4
|
-
import { createPortal as
|
|
5
|
-
function
|
|
2
|
+
import o, { useState as le, useRef as pe, useEffect as be } from "react";
|
|
3
|
+
import { useFormContext as ce, useWatch as de } from "react-hook-form";
|
|
4
|
+
import { createPortal as he } from "react-dom";
|
|
5
|
+
function xe(t) {
|
|
6
6
|
var n, r, a = "";
|
|
7
7
|
if (typeof t == "string" || typeof t == "number") a += t;
|
|
8
8
|
else if (typeof t == "object") if (Array.isArray(t)) {
|
|
9
|
-
var
|
|
10
|
-
for (n = 0; n <
|
|
9
|
+
var l = t.length;
|
|
10
|
+
for (n = 0; n < l; n++) t[n] && (r = xe(t[n])) && (a && (a += " "), a += r);
|
|
11
11
|
} else for (r in t) t[r] && (a && (a += " "), a += r);
|
|
12
12
|
return a;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
for (var t, n, r = 0, a = "",
|
|
14
|
+
function Ae() {
|
|
15
|
+
for (var t, n, r = 0, a = "", l = arguments.length; r < l; r++) (t = arguments[r]) && (n = xe(t)) && (a && (a += " "), a += n);
|
|
16
16
|
return a;
|
|
17
17
|
}
|
|
18
18
|
function d(...t) {
|
|
19
|
-
return
|
|
19
|
+
return Ae(...t);
|
|
20
20
|
}
|
|
21
|
-
const
|
|
21
|
+
const Xe = ({
|
|
22
22
|
children: t,
|
|
23
23
|
variant: n = "default",
|
|
24
24
|
className: r = "",
|
|
25
25
|
...a
|
|
26
26
|
}) => {
|
|
27
|
-
const
|
|
27
|
+
const l = "px-4 py-2 rounded font-medium transition", w = {
|
|
28
28
|
default: "bg-[var(--primary,#2563eb)] text-[var(--primary-text,#fff)] hover:bg-[var(--primary-hover,#1d4ed8)]",
|
|
29
29
|
outline: "border border-[var(--primary,#2563eb)] text-[var(--primary,#2563eb)] bg-white hover:bg-[var(--primary-hover,#e0e7ff)]",
|
|
30
30
|
secondary: "bg-[var(--secondary,#fbbf24)] text-[var(--secondary-text,#222)] hover:bg-[var(--secondary-hover,#f59e42)]"
|
|
31
31
|
};
|
|
32
|
-
return /* @__PURE__ */
|
|
33
|
-
},
|
|
34
|
-
const r =
|
|
32
|
+
return /* @__PURE__ */ o.createElement("button", { className: d(l, w[n], r), ...a }, t);
|
|
33
|
+
}, we = (t) => t.replace(/\D/g, ""), Te = (t) => {
|
|
34
|
+
const r = we(t).slice(0, 11);
|
|
35
35
|
return r.length <= 3 ? r : r.length <= 6 ? `${r.slice(0, 3)}.${r.slice(3)}` : r.length <= 9 ? `${r.slice(0, 3)}.${r.slice(3, 6)}.${r.slice(6)}` : `${r.slice(0, 3)}.${r.slice(3, 6)}.${r.slice(6, 9)}-${r.slice(9, 11)}`;
|
|
36
|
-
},
|
|
37
|
-
const n =
|
|
36
|
+
}, ve = (t) => {
|
|
37
|
+
const n = we(t);
|
|
38
38
|
if (n.length !== 11 || /^(\d)\1{10}$/.test(n))
|
|
39
39
|
return !1;
|
|
40
40
|
let r = 0;
|
|
41
|
-
for (let
|
|
42
|
-
r += parseInt(n.charAt(
|
|
41
|
+
for (let l = 0; l < 9; l++)
|
|
42
|
+
r += parseInt(n.charAt(l)) * (10 - l);
|
|
43
43
|
let a = r * 10 % 11;
|
|
44
44
|
if ((a === 10 || a === 11) && (a = 0), a !== parseInt(n.charAt(9)))
|
|
45
45
|
return !1;
|
|
46
46
|
r = 0;
|
|
47
|
-
for (let
|
|
48
|
-
r += parseInt(n.charAt(
|
|
47
|
+
for (let l = 0; l < 10; l++)
|
|
48
|
+
r += parseInt(n.charAt(l)) * (11 - l);
|
|
49
49
|
return a = r * 10 % 11, (a === 10 || a === 11) && (a = 0), a === parseInt(n.charAt(10));
|
|
50
|
-
},
|
|
50
|
+
}, $e = e.forwardRef(
|
|
51
51
|
({
|
|
52
52
|
name: t,
|
|
53
53
|
className: n,
|
|
54
54
|
type: r = "text",
|
|
55
55
|
label: a,
|
|
56
|
-
onFocus:
|
|
57
|
-
onBlur:
|
|
56
|
+
onFocus: l,
|
|
57
|
+
onBlur: w,
|
|
58
58
|
onChange: b,
|
|
59
|
-
Icon:
|
|
60
|
-
iconClassName:
|
|
61
|
-
iconAction:
|
|
62
|
-
containerClassName:
|
|
63
|
-
cpf:
|
|
64
|
-
...
|
|
65
|
-
},
|
|
66
|
-
var
|
|
67
|
-
const [k,
|
|
59
|
+
Icon: M,
|
|
60
|
+
iconClassName: N,
|
|
61
|
+
iconAction: y,
|
|
62
|
+
containerClassName: f,
|
|
63
|
+
cpf: x = !1,
|
|
64
|
+
...c
|
|
65
|
+
}, I) => {
|
|
66
|
+
var _, P, q;
|
|
67
|
+
const [k, S] = e.useState(!1), [v, h] = e.useState(!1), [E, C] = e.useState(null), i = ce(), R = i == null ? void 0 : i.control, F = i == null ? void 0 : i.register, B = R && t ? de({ control: R, name: t }) : void 0, p = c.value ?? B ?? "", V = ((q = (P = (_ = i == null ? void 0 : i.formState) == null ? void 0 : _.errors) == null ? void 0 : P[t]) == null ? void 0 : q.message) || E, L = ["date", "datetime-local", "time", "month", "week"].includes(r), J = k || !!p || L, Z = r === "password" ? v ? "text" : "password" : r, G = () => /* @__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(
|
|
68
68
|
"path",
|
|
69
69
|
{
|
|
70
70
|
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",
|
|
71
71
|
fill: "currentColor"
|
|
72
72
|
}
|
|
73
|
-
)),
|
|
73
|
+
)), W = () => /* @__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(
|
|
74
74
|
"path",
|
|
75
75
|
{
|
|
76
76
|
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",
|
|
77
77
|
fill: "currentColor"
|
|
78
78
|
}
|
|
79
|
-
)),
|
|
80
|
-
|
|
79
|
+
)), $ = () => {
|
|
80
|
+
h(!v);
|
|
81
81
|
}, X = (z) => {
|
|
82
|
-
if (
|
|
83
|
-
const Y = z.target.value, j =
|
|
84
|
-
z.target.value = j, j.length === 14 ?
|
|
82
|
+
if (x) {
|
|
83
|
+
const Y = z.target.value, j = Te(Y);
|
|
84
|
+
z.target.value = j, j.length === 14 ? ve(j) ? C(null) : C("CPF inválido") : C(null);
|
|
85
85
|
}
|
|
86
86
|
b && b(z);
|
|
87
87
|
};
|
|
88
|
-
return /* @__PURE__ */ e.createElement("div", { className: d("relative",
|
|
88
|
+
return /* @__PURE__ */ e.createElement("div", { className: d("relative", f) }, /* @__PURE__ */ e.createElement(
|
|
89
89
|
"input",
|
|
90
90
|
{
|
|
91
|
-
id:
|
|
91
|
+
id: c.id || t,
|
|
92
92
|
type: Z,
|
|
93
93
|
className: d(
|
|
94
94
|
"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",
|
|
95
|
-
r === "password" ||
|
|
95
|
+
r === "password" || M ? "pr-12" : "",
|
|
96
96
|
// espaço extra para qualquer ícone (password ou customizado)
|
|
97
97
|
V ? "border-red-500" : "",
|
|
98
98
|
n
|
|
99
99
|
),
|
|
100
100
|
onFocus: (z) => {
|
|
101
|
-
|
|
101
|
+
S(!0), l && l(z);
|
|
102
102
|
},
|
|
103
|
-
maxLength:
|
|
104
|
-
inputMode:
|
|
105
|
-
...
|
|
106
|
-
const z =
|
|
107
|
-
validate: (D) => D ? D.length < 14 ? "CPF incompleto" :
|
|
103
|
+
maxLength: x ? 14 : c.maxLength,
|
|
104
|
+
inputMode: x ? "numeric" : c.inputMode,
|
|
105
|
+
...i && t ? (() => {
|
|
106
|
+
const z = F(t, x ? {
|
|
107
|
+
validate: (D) => D ? D.length < 14 ? "CPF incompleto" : ve(D) ? !0 : "CPF inválido" : "CPF é obrigatório"
|
|
108
108
|
} : void 0), Y = z.onBlur, j = z.onChange;
|
|
109
109
|
return {
|
|
110
110
|
...z,
|
|
111
111
|
ref: (D) => {
|
|
112
|
-
typeof
|
|
112
|
+
typeof I == "function" ? I(D) : I && (I.current = D), z.ref && z.ref(D);
|
|
113
113
|
},
|
|
114
114
|
onBlur: (D) => {
|
|
115
|
-
|
|
115
|
+
S(!1), w && w(D), Y && Y(D);
|
|
116
116
|
},
|
|
117
117
|
onChange: (D) => {
|
|
118
118
|
X(D), j && j(D);
|
|
119
119
|
}
|
|
120
120
|
};
|
|
121
121
|
})() : {
|
|
122
|
-
ref:
|
|
122
|
+
ref: I,
|
|
123
123
|
onBlur: (z) => {
|
|
124
|
-
|
|
124
|
+
S(!1), w && w(z);
|
|
125
125
|
},
|
|
126
126
|
onChange: X
|
|
127
127
|
},
|
|
128
|
-
...
|
|
128
|
+
...c
|
|
129
129
|
}
|
|
130
130
|
), a && /* @__PURE__ */ e.createElement(
|
|
131
131
|
"label",
|
|
132
132
|
{
|
|
133
|
-
htmlFor:
|
|
133
|
+
htmlFor: c.id || t,
|
|
134
134
|
className: d(
|
|
135
135
|
"absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",
|
|
136
136
|
J ? "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"
|
|
@@ -142,107 +142,107 @@ const Ge = ({
|
|
|
142
142
|
{
|
|
143
143
|
type: "button",
|
|
144
144
|
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)]",
|
|
145
|
-
onClick:
|
|
146
|
-
"aria-label":
|
|
145
|
+
onClick: $,
|
|
146
|
+
"aria-label": v ? "Esconder senha" : "Mostrar senha",
|
|
147
147
|
tabIndex: -1
|
|
148
148
|
},
|
|
149
|
-
|
|
150
|
-
),
|
|
149
|
+
v ? /* @__PURE__ */ e.createElement(W, null) : /* @__PURE__ */ e.createElement(G, null)
|
|
150
|
+
), M && r !== "password" && /* @__PURE__ */ e.createElement(
|
|
151
151
|
"div",
|
|
152
152
|
{
|
|
153
153
|
className: d(
|
|
154
154
|
"absolute top-1/2 right-3 -translate-y-1/2 text-gray-400 cursor-pointer hover:text-[var(--primary,#2563eb)] transition-colors duration-200",
|
|
155
|
-
|
|
155
|
+
N
|
|
156
156
|
),
|
|
157
|
-
onClick:
|
|
157
|
+
onClick: y
|
|
158
158
|
},
|
|
159
|
-
/* @__PURE__ */ e.createElement(
|
|
159
|
+
/* @__PURE__ */ e.createElement(M, null)
|
|
160
160
|
), V && /* @__PURE__ */ e.createElement("span", { className: "text-red-500 text-xs mt-1 block" }, V));
|
|
161
161
|
}
|
|
162
162
|
);
|
|
163
|
-
|
|
164
|
-
const
|
|
163
|
+
$e.displayName = "Input";
|
|
164
|
+
const ze = e.forwardRef(
|
|
165
165
|
({
|
|
166
166
|
name: t,
|
|
167
167
|
label: n,
|
|
168
168
|
options: r,
|
|
169
169
|
className: a,
|
|
170
|
-
containerClassName:
|
|
171
|
-
isClearable:
|
|
170
|
+
containerClassName: l,
|
|
171
|
+
isClearable: w,
|
|
172
172
|
searchable: b = !1,
|
|
173
|
-
filterPlaceholder:
|
|
174
|
-
caseSensitive:
|
|
175
|
-
filterFunction:
|
|
176
|
-
onFocus:
|
|
177
|
-
onBlur:
|
|
178
|
-
...
|
|
179
|
-
},
|
|
180
|
-
var re, ne,
|
|
181
|
-
const [k,
|
|
173
|
+
filterPlaceholder: M = "Digite para filtrar...",
|
|
174
|
+
caseSensitive: N = !1,
|
|
175
|
+
filterFunction: y,
|
|
176
|
+
onFocus: f,
|
|
177
|
+
onBlur: x,
|
|
178
|
+
...c
|
|
179
|
+
}, I) => {
|
|
180
|
+
var re, ne, u, T;
|
|
181
|
+
const [k, S] = e.useState(!1), [v, h] = e.useState(!1), [E, C] = e.useState(""), [i, R] = e.useState({
|
|
182
182
|
top: 0,
|
|
183
183
|
left: 0,
|
|
184
184
|
width: 0
|
|
185
|
-
}),
|
|
186
|
-
const K =
|
|
185
|
+
}), F = e.useRef(null), B = e.useRef(null), p = ce(), V = p == null ? void 0 : p.control, U = V && t ? de({ control: V, name: t }) : void 0, L = c.value ?? U ?? "", J = (u = (ne = (re = p == null ? void 0 : p.formState) == null ? void 0 : re.errors) == null ? void 0 : ne[t]) == null ? void 0 : u.message, G = y || ((s, O) => {
|
|
186
|
+
const K = N ? s.label : s.label.toLowerCase(), te = N ? O : O.toLowerCase();
|
|
187
187
|
return K.includes(te);
|
|
188
|
-
}),
|
|
189
|
-
if (
|
|
190
|
-
const
|
|
191
|
-
let
|
|
192
|
-
if (
|
|
193
|
-
const ae = K -
|
|
194
|
-
ae < Q &&
|
|
195
|
-
const
|
|
196
|
-
H = Math.min(Math.max(H,
|
|
188
|
+
}), W = E.trim() ? r.filter((s) => G(s, E.trim())) : r, $ = r.find((s) => s.value === L), X = b && v ? E : ($ == null ? void 0 : $.label) || "", _ = k || !!L || b && !!E, P = e.useCallback(() => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || window.innerWidth <= 768, []), q = e.useCallback(() => {
|
|
189
|
+
if (F.current && v) {
|
|
190
|
+
const s = F.current.getBoundingClientRect(), O = P(), K = window.innerHeight, te = window.innerWidth, Q = 152;
|
|
191
|
+
let g = s.bottom + 4, H = s.left;
|
|
192
|
+
if (O) {
|
|
193
|
+
const ae = K - s.bottom, m = s.top;
|
|
194
|
+
ae < Q && m > Q && (g = s.top - Q - 4);
|
|
195
|
+
const A = 16, ee = te - s.width - A;
|
|
196
|
+
H = Math.min(Math.max(H, A), ee);
|
|
197
197
|
} else
|
|
198
|
-
K -
|
|
199
|
-
|
|
200
|
-
top:
|
|
198
|
+
K - s.bottom < Q && (g = s.top - Q - 4);
|
|
199
|
+
R({
|
|
200
|
+
top: g,
|
|
201
201
|
left: H,
|
|
202
|
-
width:
|
|
202
|
+
width: s.width
|
|
203
203
|
});
|
|
204
204
|
}
|
|
205
|
-
}, [
|
|
205
|
+
}, [v, P]);
|
|
206
206
|
e.useEffect(() => {
|
|
207
|
-
if (q(),
|
|
208
|
-
const
|
|
209
|
-
return window.addEventListener("resize",
|
|
210
|
-
window.removeEventListener("resize",
|
|
207
|
+
if (q(), v) {
|
|
208
|
+
const s = () => q(), O = () => q();
|
|
209
|
+
return window.addEventListener("resize", s), window.addEventListener("scroll", O, !0), () => {
|
|
210
|
+
window.removeEventListener("resize", s), window.removeEventListener("scroll", O, !0);
|
|
211
211
|
};
|
|
212
212
|
}
|
|
213
|
-
}, [
|
|
214
|
-
const
|
|
215
|
-
|
|
213
|
+
}, [v, q]), e.useEffect(() => {
|
|
214
|
+
const s = (O) => {
|
|
215
|
+
F.current && !F.current.contains(O.target) && (h(!1), S(!1));
|
|
216
216
|
};
|
|
217
|
-
return document.addEventListener("mousedown",
|
|
218
|
-
document.removeEventListener("mousedown",
|
|
217
|
+
return document.addEventListener("mousedown", s), () => {
|
|
218
|
+
document.removeEventListener("mousedown", s);
|
|
219
219
|
};
|
|
220
220
|
}, []);
|
|
221
221
|
const z = () => {
|
|
222
|
-
|
|
223
|
-
}, Y = (
|
|
224
|
-
|
|
225
|
-
}, j = (
|
|
226
|
-
|
|
227
|
-
}, D = (
|
|
228
|
-
|
|
229
|
-
}, oe = (
|
|
230
|
-
if (
|
|
231
|
-
const
|
|
232
|
-
target: { value:
|
|
222
|
+
h((s) => !s), S(!0);
|
|
223
|
+
}, Y = (s) => {
|
|
224
|
+
S(!0), f && f(s);
|
|
225
|
+
}, j = (s) => {
|
|
226
|
+
x && x(s);
|
|
227
|
+
}, D = (s) => {
|
|
228
|
+
C(s.target.value);
|
|
229
|
+
}, oe = (s) => {
|
|
230
|
+
if (p && t && p.setValue(t, s), c.onChange) {
|
|
231
|
+
const O = {
|
|
232
|
+
target: { value: s }
|
|
233
233
|
};
|
|
234
|
-
|
|
234
|
+
c.onChange(O);
|
|
235
235
|
}
|
|
236
|
-
|
|
236
|
+
h(!1), S(!1), C("");
|
|
237
237
|
};
|
|
238
|
-
return /* @__PURE__ */ e.createElement("div", { className: d("relative",
|
|
238
|
+
return /* @__PURE__ */ e.createElement("div", { className: d("relative", l), ref: F }, /* @__PURE__ */ e.createElement(
|
|
239
239
|
"div",
|
|
240
240
|
{
|
|
241
|
-
id:
|
|
241
|
+
id: c.id || t,
|
|
242
242
|
tabIndex: 0,
|
|
243
243
|
role: "button",
|
|
244
244
|
"aria-haspopup": "listbox",
|
|
245
|
-
"aria-expanded":
|
|
245
|
+
"aria-expanded": v,
|
|
246
246
|
className: d(
|
|
247
247
|
"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",
|
|
248
248
|
a
|
|
@@ -250,43 +250,43 @@ const Te = e.forwardRef(
|
|
|
250
250
|
onClick: b ? void 0 : z,
|
|
251
251
|
onFocus: b ? void 0 : Y,
|
|
252
252
|
onBlur: b ? void 0 : j,
|
|
253
|
-
ref:
|
|
253
|
+
ref: I
|
|
254
254
|
},
|
|
255
255
|
b ? /* @__PURE__ */ e.createElement(
|
|
256
256
|
"input",
|
|
257
257
|
{
|
|
258
|
-
ref:
|
|
258
|
+
ref: B,
|
|
259
259
|
type: "text",
|
|
260
260
|
value: X,
|
|
261
261
|
onChange: D,
|
|
262
|
-
onFocus: b ? (
|
|
263
|
-
|
|
262
|
+
onFocus: b ? (s) => {
|
|
263
|
+
S(!0), h(!0), f && f(s);
|
|
264
264
|
} : void 0,
|
|
265
|
-
onBlur: b ? (
|
|
266
|
-
|
|
265
|
+
onBlur: b ? (s) => {
|
|
266
|
+
x && x(s);
|
|
267
267
|
} : void 0,
|
|
268
|
-
placeholder: n ? "" :
|
|
268
|
+
placeholder: n ? "" : M || "Selecione...",
|
|
269
269
|
className: d(
|
|
270
270
|
"w-full bg-transparent border-none outline-none text-sm",
|
|
271
|
-
!
|
|
271
|
+
!L && !E && "text-gray-400"
|
|
272
272
|
)
|
|
273
273
|
}
|
|
274
|
-
) : /* @__PURE__ */ e.createElement("span", { className: d("block truncate", !
|
|
275
|
-
|
|
274
|
+
) : /* @__PURE__ */ e.createElement("span", { className: d("block truncate", !L && "text-gray-400") }, ((T = r.find((s) => s.value === L)) == null ? void 0 : T.label) || !n && "Selecione..."),
|
|
275
|
+
w && L && /* @__PURE__ */ e.createElement(
|
|
276
276
|
"button",
|
|
277
277
|
{
|
|
278
278
|
type: "button",
|
|
279
279
|
tabIndex: -1,
|
|
280
280
|
"aria-label": "Limpar seleção",
|
|
281
281
|
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",
|
|
282
|
-
onClick: (
|
|
283
|
-
if (
|
|
284
|
-
const
|
|
282
|
+
onClick: (s) => {
|
|
283
|
+
if (s.stopPropagation(), p && t && p.setValue(t, ""), c.onChange) {
|
|
284
|
+
const O = {
|
|
285
285
|
target: { value: "" }
|
|
286
286
|
};
|
|
287
|
-
|
|
287
|
+
c.onChange(O);
|
|
288
288
|
}
|
|
289
|
-
|
|
289
|
+
h(!1), S(!1);
|
|
290
290
|
}
|
|
291
291
|
},
|
|
292
292
|
"✕"
|
|
@@ -294,10 +294,10 @@ const Te = e.forwardRef(
|
|
|
294
294
|
), n && /* @__PURE__ */ e.createElement(
|
|
295
295
|
"label",
|
|
296
296
|
{
|
|
297
|
-
htmlFor:
|
|
297
|
+
htmlFor: c.id || t,
|
|
298
298
|
className: d(
|
|
299
299
|
"absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",
|
|
300
|
-
|
|
300
|
+
_ ? "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"
|
|
301
301
|
)
|
|
302
302
|
},
|
|
303
303
|
n
|
|
@@ -307,264 +307,264 @@ const Te = e.forwardRef(
|
|
|
307
307
|
className: d(
|
|
308
308
|
"absolute left-0 w-full mt-1 rounded-md transition-all duration-200 overflow-hidden",
|
|
309
309
|
"bg-[var(--select-dropdown-bg)] border-[var(--select-dropdown-border)] text-[var(--select-dropdown-text)]",
|
|
310
|
-
|
|
310
|
+
v ? "border max-h-36 opacity-100 scale-100" : "max-h-0 opacity-0 scale-95 pointer-events-none"
|
|
311
311
|
),
|
|
312
312
|
style: {
|
|
313
|
-
maxHeight:
|
|
313
|
+
maxHeight: v ? "9.5rem" : "0",
|
|
314
314
|
// 3 options * 2.5rem + padding
|
|
315
315
|
overflowY: r.length > 3 ? "auto" : "hidden",
|
|
316
316
|
position: "fixed",
|
|
317
317
|
// Use fixed positioning to escape container overflow
|
|
318
|
-
top:
|
|
319
|
-
left:
|
|
320
|
-
width:
|
|
318
|
+
top: v ? `${i.top}px` : "auto",
|
|
319
|
+
left: v ? `${i.left}px` : "auto",
|
|
320
|
+
width: v ? `${i.width}px` : "auto",
|
|
321
321
|
zIndex: 9999,
|
|
322
|
-
boxShadow:
|
|
322
|
+
boxShadow: v ? "var(--select-dropdown-shadow)" : "none"
|
|
323
323
|
}
|
|
324
324
|
},
|
|
325
|
-
|
|
325
|
+
W.length === 0 ? /* @__PURE__ */ e.createElement("div", { className: "px-3 py-2 text-sm text-gray-500 text-center" }, "Nenhuma opção encontrada") : W.map((s) => /* @__PURE__ */ e.createElement(
|
|
326
326
|
"div",
|
|
327
327
|
{
|
|
328
|
-
key:
|
|
328
|
+
key: s.value,
|
|
329
329
|
className: d(
|
|
330
330
|
"px-3 py-2 cursor-pointer text-sm transition-colors duration-150",
|
|
331
331
|
"hover:bg-[var(--select-dropdown-hover)]",
|
|
332
|
-
|
|
332
|
+
L === s.value && "bg-[var(--select-dropdown-selected)]"
|
|
333
333
|
),
|
|
334
|
-
onMouseDown: () => oe(
|
|
334
|
+
onMouseDown: () => oe(s.value)
|
|
335
335
|
},
|
|
336
|
-
|
|
336
|
+
s.label
|
|
337
337
|
))
|
|
338
338
|
), J && /* @__PURE__ */ e.createElement("span", { className: "text-red-500 text-xs mt-1 block" }, J));
|
|
339
339
|
}
|
|
340
340
|
);
|
|
341
|
-
|
|
342
|
-
const
|
|
341
|
+
ze.displayName = "Select";
|
|
342
|
+
const Oe = e.forwardRef(
|
|
343
343
|
({
|
|
344
344
|
name: t,
|
|
345
345
|
className: n,
|
|
346
346
|
label: r,
|
|
347
347
|
onFocus: a,
|
|
348
|
-
onBlur:
|
|
349
|
-
Icon:
|
|
348
|
+
onBlur: l,
|
|
349
|
+
Icon: w,
|
|
350
350
|
iconClassName: b,
|
|
351
|
-
iconAction:
|
|
352
|
-
containerClassName:
|
|
353
|
-
rows:
|
|
354
|
-
...
|
|
355
|
-
},
|
|
356
|
-
var
|
|
357
|
-
const [
|
|
358
|
-
return /* @__PURE__ */ e.createElement("div", { className: d("relative",
|
|
351
|
+
iconAction: M,
|
|
352
|
+
containerClassName: N,
|
|
353
|
+
rows: y = 4,
|
|
354
|
+
...f
|
|
355
|
+
}, x) => {
|
|
356
|
+
var R, F, B;
|
|
357
|
+
const [c, I] = e.useState(!1), k = ce(), S = k == null ? void 0 : k.control, v = k == null ? void 0 : k.register, h = S && t ? de({ control: S, name: t }) : void 0, E = f.value ?? h ?? "", C = (B = (F = (R = k == null ? void 0 : k.formState) == null ? void 0 : R.errors) == null ? void 0 : F[t]) == null ? void 0 : B.message, i = c || !!E;
|
|
358
|
+
return /* @__PURE__ */ e.createElement("div", { className: d("relative", N) }, /* @__PURE__ */ e.createElement(
|
|
359
359
|
"textarea",
|
|
360
360
|
{
|
|
361
|
-
id:
|
|
362
|
-
rows:
|
|
361
|
+
id: f.id || t,
|
|
362
|
+
rows: y,
|
|
363
363
|
className: d(
|
|
364
364
|
"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",
|
|
365
|
-
|
|
365
|
+
w ? "pr-12" : "",
|
|
366
366
|
// espaço extra para ícone customizado
|
|
367
367
|
n
|
|
368
368
|
),
|
|
369
|
-
onFocus: (
|
|
370
|
-
|
|
369
|
+
onFocus: (p) => {
|
|
370
|
+
I(!0), a && a(p);
|
|
371
371
|
},
|
|
372
372
|
...k && t ? (() => {
|
|
373
|
-
const
|
|
373
|
+
const p = v(t), V = p.onBlur;
|
|
374
374
|
return {
|
|
375
|
-
...
|
|
375
|
+
...p,
|
|
376
376
|
ref: (U) => {
|
|
377
|
-
typeof
|
|
377
|
+
typeof x == "function" ? x(U) : x && (x.current = U), p.ref && p.ref(U);
|
|
378
378
|
},
|
|
379
379
|
onBlur: (U) => {
|
|
380
|
-
|
|
380
|
+
I(!1), l && l(U), V && V(U);
|
|
381
381
|
}
|
|
382
382
|
};
|
|
383
383
|
})() : {
|
|
384
|
-
ref:
|
|
385
|
-
onBlur: (
|
|
386
|
-
|
|
384
|
+
ref: x,
|
|
385
|
+
onBlur: (p) => {
|
|
386
|
+
I(!1), l && l(p);
|
|
387
387
|
}
|
|
388
388
|
},
|
|
389
|
-
...
|
|
389
|
+
...f
|
|
390
390
|
}
|
|
391
391
|
), r && /* @__PURE__ */ e.createElement(
|
|
392
392
|
"label",
|
|
393
393
|
{
|
|
394
|
-
htmlFor:
|
|
394
|
+
htmlFor: f.id || t,
|
|
395
395
|
className: d(
|
|
396
396
|
"absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",
|
|
397
|
-
|
|
397
|
+
i ? "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"
|
|
398
398
|
)
|
|
399
399
|
},
|
|
400
400
|
r
|
|
401
|
-
),
|
|
401
|
+
), w && /* @__PURE__ */ e.createElement(
|
|
402
402
|
"div",
|
|
403
403
|
{
|
|
404
404
|
className: d(
|
|
405
405
|
"absolute top-3 right-3 text-gray-400 cursor-pointer hover:text-[var(--primary,#2563eb)] transition-colors duration-200",
|
|
406
406
|
b
|
|
407
407
|
),
|
|
408
|
-
onClick:
|
|
408
|
+
onClick: M
|
|
409
409
|
},
|
|
410
|
-
/* @__PURE__ */ e.createElement(
|
|
411
|
-
),
|
|
410
|
+
/* @__PURE__ */ e.createElement(w, null)
|
|
411
|
+
), C && /* @__PURE__ */ e.createElement("span", { className: "text-red-500 text-xs mt-1 block" }, C));
|
|
412
412
|
}
|
|
413
413
|
);
|
|
414
|
-
|
|
415
|
-
const
|
|
414
|
+
Oe.displayName = "Textarea";
|
|
415
|
+
const We = e.forwardRef(
|
|
416
416
|
({
|
|
417
417
|
name: t,
|
|
418
418
|
label: n,
|
|
419
419
|
loadOptions: r,
|
|
420
420
|
className: a,
|
|
421
|
-
containerClassName:
|
|
422
|
-
isClearable:
|
|
421
|
+
containerClassName: l,
|
|
422
|
+
isClearable: w,
|
|
423
423
|
defaultOptions: b = !1,
|
|
424
|
-
loadingMessage:
|
|
425
|
-
noOptionsMessage:
|
|
426
|
-
searchable:
|
|
427
|
-
debounceMs:
|
|
428
|
-
onFocus:
|
|
429
|
-
onBlur:
|
|
430
|
-
...
|
|
424
|
+
loadingMessage: M = "Carregando...",
|
|
425
|
+
noOptionsMessage: N = "Nenhuma opção encontrada",
|
|
426
|
+
searchable: y = !1,
|
|
427
|
+
debounceMs: f = 300,
|
|
428
|
+
onFocus: x,
|
|
429
|
+
onBlur: c,
|
|
430
|
+
...I
|
|
431
431
|
}, k) => {
|
|
432
432
|
var K, te, Q;
|
|
433
|
-
const [
|
|
433
|
+
const [S, v] = e.useState(!1), [h, E] = e.useState(!1), [C, i] = e.useState([]), [R, F] = e.useState(!1), [B, p] = e.useState(""), [V, U] = e.useState(""), [L, J] = e.useState({
|
|
434
434
|
top: 0,
|
|
435
435
|
left: 0,
|
|
436
436
|
width: 0
|
|
437
|
-
}), Z = e.useRef(null), G = e.useRef(null),
|
|
438
|
-
if (Z.current &&
|
|
439
|
-
const
|
|
440
|
-
let ee =
|
|
437
|
+
}), Z = e.useRef(null), G = e.useRef(null), W = ce(), $ = W == null ? void 0 : W.control, X = $ && t ? de({ control: $, name: t }) : void 0, _ = I.value ?? X ?? "", P = (Q = (te = (K = W == null ? void 0 : W.formState) == null ? void 0 : K.errors) == null ? void 0 : te[t]) == null ? void 0 : Q.message, q = S || !!_, z = e.useCallback(() => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || window.innerWidth <= 768, []), Y = e.useCallback(() => {
|
|
438
|
+
if (Z.current && h) {
|
|
439
|
+
const g = Z.current.getBoundingClientRect(), H = z(), ae = window.innerHeight, m = window.innerWidth, A = 152;
|
|
440
|
+
let ee = g.bottom + 4, ie = g.left;
|
|
441
441
|
if (H) {
|
|
442
|
-
const
|
|
443
|
-
|
|
444
|
-
const
|
|
445
|
-
|
|
442
|
+
const se = ae - g.bottom, fe = g.top;
|
|
443
|
+
se < A && fe > A && (ee = g.top - A - 4);
|
|
444
|
+
const ue = 16, me = m - g.width - ue;
|
|
445
|
+
ie = Math.min(Math.max(ie, ue), me);
|
|
446
446
|
} else
|
|
447
|
-
ae -
|
|
447
|
+
ae - g.bottom < A && (ee = g.top - A - 4);
|
|
448
448
|
J({
|
|
449
449
|
top: ee,
|
|
450
|
-
left:
|
|
451
|
-
width:
|
|
450
|
+
left: ie,
|
|
451
|
+
width: g.width
|
|
452
452
|
});
|
|
453
453
|
}
|
|
454
|
-
}, [
|
|
454
|
+
}, [h, z]);
|
|
455
455
|
e.useEffect(() => {
|
|
456
|
-
if (Y(),
|
|
457
|
-
const
|
|
458
|
-
return window.addEventListener("resize",
|
|
459
|
-
window.removeEventListener("resize",
|
|
456
|
+
if (Y(), h) {
|
|
457
|
+
const g = () => Y(), H = () => Y();
|
|
458
|
+
return window.addEventListener("resize", g), window.addEventListener("scroll", H, !0), () => {
|
|
459
|
+
window.removeEventListener("resize", g), window.removeEventListener("scroll", H, !0);
|
|
460
460
|
};
|
|
461
461
|
}
|
|
462
|
-
}, [
|
|
463
|
-
const
|
|
464
|
-
U(
|
|
465
|
-
},
|
|
466
|
-
return () => clearTimeout(
|
|
467
|
-
}, [
|
|
468
|
-
(
|
|
469
|
-
}, [V,
|
|
470
|
-
b === !0 ? j() : Array.isArray(b) &&
|
|
462
|
+
}, [h, Y]), e.useEffect(() => {
|
|
463
|
+
const g = setTimeout(() => {
|
|
464
|
+
U(B);
|
|
465
|
+
}, f);
|
|
466
|
+
return () => clearTimeout(g);
|
|
467
|
+
}, [B, f]), e.useEffect(() => {
|
|
468
|
+
(h || b && C.length === 0) && j(y ? V : void 0);
|
|
469
|
+
}, [V, h]), e.useEffect(() => {
|
|
470
|
+
b === !0 ? j() : Array.isArray(b) && i(b);
|
|
471
471
|
}, []);
|
|
472
|
-
const j = async (
|
|
472
|
+
const j = async (g) => {
|
|
473
473
|
try {
|
|
474
|
-
|
|
475
|
-
const H = await r(
|
|
476
|
-
|
|
474
|
+
F(!0);
|
|
475
|
+
const H = await r(g);
|
|
476
|
+
i(H);
|
|
477
477
|
} catch (H) {
|
|
478
|
-
console.error("Error loading options:", H),
|
|
478
|
+
console.error("Error loading options:", H), i([]);
|
|
479
479
|
} finally {
|
|
480
|
-
|
|
480
|
+
F(!1);
|
|
481
481
|
}
|
|
482
482
|
};
|
|
483
483
|
e.useEffect(() => {
|
|
484
|
-
const
|
|
485
|
-
Z.current && !Z.current.contains(H.target) && (
|
|
484
|
+
const g = (H) => {
|
|
485
|
+
Z.current && !Z.current.contains(H.target) && (E(!1), v(!1), p(""));
|
|
486
486
|
};
|
|
487
|
-
return document.addEventListener("mousedown",
|
|
488
|
-
document.removeEventListener("mousedown",
|
|
487
|
+
return document.addEventListener("mousedown", g), () => {
|
|
488
|
+
document.removeEventListener("mousedown", g);
|
|
489
489
|
};
|
|
490
490
|
}, []);
|
|
491
491
|
const D = () => {
|
|
492
|
-
|
|
493
|
-
var
|
|
494
|
-
return (
|
|
492
|
+
h || (E(!0), v(!0), y && G.current && setTimeout(() => {
|
|
493
|
+
var g;
|
|
494
|
+
return (g = G.current) == null ? void 0 : g.focus();
|
|
495
495
|
}, 0));
|
|
496
|
-
}, oe = (
|
|
497
|
-
|
|
498
|
-
}, re = (
|
|
499
|
-
|
|
500
|
-
}, ne = (
|
|
501
|
-
|
|
502
|
-
},
|
|
503
|
-
if (
|
|
496
|
+
}, oe = (g) => {
|
|
497
|
+
v(!0), x && x(g);
|
|
498
|
+
}, re = (g) => {
|
|
499
|
+
c && c(g);
|
|
500
|
+
}, ne = (g) => {
|
|
501
|
+
p(g.target.value);
|
|
502
|
+
}, u = (g) => {
|
|
503
|
+
if (W && t && W.setValue(t, g), I.onChange) {
|
|
504
504
|
const H = {
|
|
505
|
-
target: { value:
|
|
505
|
+
target: { value: g }
|
|
506
506
|
};
|
|
507
|
-
|
|
507
|
+
I.onChange(H);
|
|
508
508
|
}
|
|
509
|
-
|
|
510
|
-
},
|
|
511
|
-
if (
|
|
509
|
+
E(!1), v(!1), p("");
|
|
510
|
+
}, T = (g) => {
|
|
511
|
+
if (g.stopPropagation(), W && t && W.setValue(t, ""), I.onChange) {
|
|
512
512
|
const H = {
|
|
513
513
|
target: { value: "" }
|
|
514
514
|
};
|
|
515
|
-
|
|
515
|
+
I.onChange(H);
|
|
516
516
|
}
|
|
517
|
-
|
|
518
|
-
},
|
|
519
|
-
return /* @__PURE__ */ e.createElement("div", { className: d("relative",
|
|
517
|
+
E(!1), v(!1), p("");
|
|
518
|
+
}, s = C.find((g) => g.value === _), O = y && h ? B : (s == null ? void 0 : s.label) || "";
|
|
519
|
+
return /* @__PURE__ */ e.createElement("div", { className: d("relative", l), ref: Z }, /* @__PURE__ */ e.createElement(
|
|
520
520
|
"div",
|
|
521
521
|
{
|
|
522
|
-
id:
|
|
523
|
-
tabIndex:
|
|
522
|
+
id: I.id || t,
|
|
523
|
+
tabIndex: y ? -1 : 0,
|
|
524
524
|
role: "button",
|
|
525
525
|
"aria-haspopup": "listbox",
|
|
526
|
-
"aria-expanded":
|
|
526
|
+
"aria-expanded": h,
|
|
527
527
|
className: d(
|
|
528
528
|
"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",
|
|
529
529
|
a
|
|
530
530
|
),
|
|
531
531
|
onClick: D,
|
|
532
|
-
onFocus:
|
|
533
|
-
onBlur:
|
|
532
|
+
onFocus: y ? void 0 : oe,
|
|
533
|
+
onBlur: y ? void 0 : re,
|
|
534
534
|
ref: k
|
|
535
535
|
},
|
|
536
|
-
|
|
536
|
+
y ? /* @__PURE__ */ e.createElement(
|
|
537
537
|
"input",
|
|
538
538
|
{
|
|
539
539
|
ref: G,
|
|
540
540
|
type: "text",
|
|
541
|
-
value:
|
|
541
|
+
value: O,
|
|
542
542
|
onChange: ne,
|
|
543
543
|
onFocus: oe,
|
|
544
544
|
onBlur: re,
|
|
545
545
|
placeholder: n ? "" : "Selecione...",
|
|
546
546
|
className: d(
|
|
547
547
|
"w-full bg-transparent border-none outline-none text-sm",
|
|
548
|
-
!
|
|
548
|
+
!_ && !B && "text-gray-400"
|
|
549
549
|
)
|
|
550
550
|
}
|
|
551
|
-
) : /* @__PURE__ */ e.createElement("span", { className: d("block truncate", !
|
|
552
|
-
|
|
553
|
-
|
|
551
|
+
) : /* @__PURE__ */ e.createElement("span", { className: d("block truncate", !_ && "text-gray-400") }, (s == null ? void 0 : s.label) || !n && "Selecione..."),
|
|
552
|
+
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)]" })),
|
|
553
|
+
w && _ && !R && /* @__PURE__ */ e.createElement(
|
|
554
554
|
"button",
|
|
555
555
|
{
|
|
556
556
|
type: "button",
|
|
557
557
|
tabIndex: -1,
|
|
558
558
|
"aria-label": "Limpar seleção",
|
|
559
559
|
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",
|
|
560
|
-
onClick:
|
|
560
|
+
onClick: T
|
|
561
561
|
},
|
|
562
562
|
"✕"
|
|
563
563
|
)
|
|
564
564
|
), n && /* @__PURE__ */ e.createElement(
|
|
565
565
|
"label",
|
|
566
566
|
{
|
|
567
|
-
htmlFor:
|
|
567
|
+
htmlFor: I.id || t,
|
|
568
568
|
className: d(
|
|
569
569
|
"absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",
|
|
570
570
|
q ? "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"
|
|
@@ -577,122 +577,122 @@ const Ae = e.forwardRef(
|
|
|
577
577
|
className: d(
|
|
578
578
|
"absolute left-0 w-full mt-1 rounded-md transition-all duration-200 overflow-hidden",
|
|
579
579
|
"bg-[var(--select-dropdown-bg)] border-[var(--select-dropdown-border)] text-[var(--select-dropdown-text)]",
|
|
580
|
-
|
|
580
|
+
h ? "border max-h-36 opacity-100 scale-100" : "max-h-0 opacity-0 scale-95 pointer-events-none"
|
|
581
581
|
),
|
|
582
582
|
style: {
|
|
583
|
-
maxHeight:
|
|
584
|
-
overflowY:
|
|
583
|
+
maxHeight: h ? "9.5rem" : "0",
|
|
584
|
+
overflowY: C.length > 3 ? "auto" : "hidden",
|
|
585
585
|
position: "fixed",
|
|
586
586
|
// Use fixed positioning to escape container overflow
|
|
587
|
-
top:
|
|
588
|
-
left:
|
|
589
|
-
width:
|
|
587
|
+
top: h ? `${L.top}px` : "auto",
|
|
588
|
+
left: h ? `${L.left}px` : "auto",
|
|
589
|
+
width: h ? `${L.width}px` : "auto",
|
|
590
590
|
zIndex: 9999,
|
|
591
|
-
boxShadow:
|
|
591
|
+
boxShadow: h ? "var(--select-dropdown-shadow)" : "none"
|
|
592
592
|
}
|
|
593
593
|
},
|
|
594
|
-
|
|
594
|
+
R ? /* @__PURE__ */ e.createElement("div", { className: "px-3 py-2 text-sm text-gray-500 text-center" }, M) : C.length === 0 ? /* @__PURE__ */ e.createElement("div", { className: "px-3 py-2 text-sm text-gray-500 text-center" }, N) : C.map((g) => /* @__PURE__ */ e.createElement(
|
|
595
595
|
"div",
|
|
596
596
|
{
|
|
597
|
-
key:
|
|
597
|
+
key: g.value,
|
|
598
598
|
className: d(
|
|
599
599
|
"px-3 py-2 cursor-pointer text-sm transition-colors duration-150",
|
|
600
600
|
"hover:bg-[var(--select-dropdown-hover)]",
|
|
601
|
-
|
|
601
|
+
_ === g.value && "bg-[var(--select-dropdown-selected)]"
|
|
602
602
|
),
|
|
603
|
-
onMouseDown: () =>
|
|
603
|
+
onMouseDown: () => u(g.value)
|
|
604
604
|
},
|
|
605
|
-
|
|
605
|
+
g.label
|
|
606
606
|
))
|
|
607
607
|
), P && /* @__PURE__ */ e.createElement("span", { className: "text-red-500 text-xs mt-1 block" }, P));
|
|
608
608
|
}
|
|
609
609
|
);
|
|
610
|
-
|
|
611
|
-
const
|
|
610
|
+
We.displayName = "AsyncSelect";
|
|
611
|
+
const Ve = e.forwardRef(
|
|
612
612
|
({
|
|
613
613
|
name: t,
|
|
614
614
|
label: n,
|
|
615
615
|
options: r,
|
|
616
616
|
className: a,
|
|
617
|
-
containerClassName:
|
|
618
|
-
isClearable:
|
|
617
|
+
containerClassName: l,
|
|
618
|
+
isClearable: w,
|
|
619
619
|
searchable: b = !1,
|
|
620
|
-
filterPlaceholder:
|
|
621
|
-
caseSensitive:
|
|
622
|
-
filterFunction:
|
|
623
|
-
onFocus:
|
|
624
|
-
onBlur:
|
|
625
|
-
...
|
|
626
|
-
},
|
|
620
|
+
filterPlaceholder: M = "Digite para filtrar...",
|
|
621
|
+
caseSensitive: N = !1,
|
|
622
|
+
filterFunction: y,
|
|
623
|
+
onFocus: f,
|
|
624
|
+
onBlur: x,
|
|
625
|
+
...c
|
|
626
|
+
}, I) => {
|
|
627
627
|
var oe, re, ne;
|
|
628
|
-
const [k,
|
|
628
|
+
const [k, S] = e.useState(!1), [v, h] = e.useState(!1), [E, C] = e.useState(""), [i, R] = e.useState({
|
|
629
629
|
top: 0,
|
|
630
630
|
left: 0,
|
|
631
631
|
width: 0
|
|
632
|
-
}),
|
|
633
|
-
const
|
|
634
|
-
return
|
|
635
|
-
}),
|
|
636
|
-
if (
|
|
637
|
-
const
|
|
638
|
-
let te =
|
|
639
|
-
if (
|
|
640
|
-
const
|
|
641
|
-
|
|
642
|
-
const ae = 16,
|
|
643
|
-
Q = Math.min(Math.max(Q, ae),
|
|
632
|
+
}), F = e.useRef(null), B = e.useRef(null), p = ce(), V = p == null ? void 0 : p.control, U = V && t ? de({ control: V, name: t }) : void 0, L = c.value ?? U ?? [], J = (ne = (re = (oe = p == null ? void 0 : p.formState) == null ? void 0 : oe.errors) == null ? void 0 : re[t]) == null ? void 0 : ne.message, G = y || ((u, T) => {
|
|
633
|
+
const s = N ? u.label : u.label.toLowerCase(), O = N ? T : T.toLowerCase();
|
|
634
|
+
return s.includes(O);
|
|
635
|
+
}), W = E.trim() ? r.filter((u) => G(u, E.trim())) : r, $ = k || L && L.length > 0 || b && !!E, X = e.useCallback(() => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || window.innerWidth <= 768, []), _ = e.useCallback(() => {
|
|
636
|
+
if (F.current && v) {
|
|
637
|
+
const u = F.current.getBoundingClientRect(), T = X(), s = window.innerHeight, O = window.innerWidth, K = 152;
|
|
638
|
+
let te = u.bottom + 4, Q = u.left;
|
|
639
|
+
if (T) {
|
|
640
|
+
const g = s - u.bottom, H = u.top;
|
|
641
|
+
g < K && H > K && (te = u.top - K - 4);
|
|
642
|
+
const ae = 16, m = O - u.width - ae;
|
|
643
|
+
Q = Math.min(Math.max(Q, ae), m);
|
|
644
644
|
} else
|
|
645
|
-
|
|
646
|
-
|
|
645
|
+
s - u.bottom < K && (te = u.top - K - 4);
|
|
646
|
+
R({
|
|
647
647
|
top: te,
|
|
648
648
|
left: Q,
|
|
649
|
-
width:
|
|
649
|
+
width: u.width
|
|
650
650
|
});
|
|
651
651
|
}
|
|
652
|
-
}, [
|
|
652
|
+
}, [v, X]);
|
|
653
653
|
e.useEffect(() => {
|
|
654
|
-
if (
|
|
655
|
-
const
|
|
656
|
-
return window.addEventListener("resize",
|
|
657
|
-
window.removeEventListener("resize",
|
|
654
|
+
if (_(), v) {
|
|
655
|
+
const u = () => _(), T = () => _();
|
|
656
|
+
return window.addEventListener("resize", u), window.addEventListener("scroll", T, !0), () => {
|
|
657
|
+
window.removeEventListener("resize", u), window.removeEventListener("scroll", T, !0);
|
|
658
658
|
};
|
|
659
659
|
}
|
|
660
|
-
}, [
|
|
661
|
-
const
|
|
662
|
-
|
|
660
|
+
}, [v, _]), e.useEffect(() => {
|
|
661
|
+
const u = (T) => {
|
|
662
|
+
F.current && !F.current.contains(T.target) && (h(!1), S(!1));
|
|
663
663
|
};
|
|
664
|
-
return document.addEventListener("mousedown",
|
|
665
|
-
document.removeEventListener("mousedown",
|
|
664
|
+
return document.addEventListener("mousedown", u), () => {
|
|
665
|
+
document.removeEventListener("mousedown", u);
|
|
666
666
|
};
|
|
667
667
|
}, []);
|
|
668
668
|
const P = () => {
|
|
669
|
-
|
|
670
|
-
}, q = (
|
|
671
|
-
|
|
672
|
-
}, z = (
|
|
673
|
-
|
|
674
|
-
}, Y = (
|
|
675
|
-
var
|
|
676
|
-
let
|
|
677
|
-
|
|
678
|
-
target: { value:
|
|
679
|
-
})),
|
|
680
|
-
}, j = (
|
|
681
|
-
var
|
|
682
|
-
|
|
669
|
+
h((u) => !u), S(!0);
|
|
670
|
+
}, q = (u) => {
|
|
671
|
+
S(!0), f && f(u);
|
|
672
|
+
}, z = (u) => {
|
|
673
|
+
x && x(u);
|
|
674
|
+
}, Y = (u) => {
|
|
675
|
+
var s;
|
|
676
|
+
let T;
|
|
677
|
+
L.includes(u) ? T = L.filter((O) => O !== u) : T = [...L, u], p && t && p.setValue(t, T), c.onChange && ((s = c.onChange) == null || s.call(c, {
|
|
678
|
+
target: { value: T }
|
|
679
|
+
})), S(!0);
|
|
680
|
+
}, j = (u) => {
|
|
681
|
+
var T;
|
|
682
|
+
u.stopPropagation(), p && t && p.setValue(t, []), c.onChange && ((T = c.onChange) == null || T.call(c, {
|
|
683
683
|
target: { value: [] }
|
|
684
|
-
})),
|
|
685
|
-
}, D = (
|
|
686
|
-
|
|
684
|
+
})), h(!1), S(!1);
|
|
685
|
+
}, D = (u) => {
|
|
686
|
+
C(u.target.value);
|
|
687
687
|
};
|
|
688
|
-
return /* @__PURE__ */ e.createElement("div", { className: d("relative",
|
|
688
|
+
return /* @__PURE__ */ e.createElement("div", { className: d("relative", l), ref: F }, /* @__PURE__ */ e.createElement(
|
|
689
689
|
"div",
|
|
690
690
|
{
|
|
691
|
-
id:
|
|
691
|
+
id: c.id || t,
|
|
692
692
|
tabIndex: 0,
|
|
693
693
|
role: "button",
|
|
694
694
|
"aria-haspopup": "listbox",
|
|
695
|
-
"aria-expanded":
|
|
695
|
+
"aria-expanded": v,
|
|
696
696
|
className: d(
|
|
697
697
|
"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",
|
|
698
698
|
a
|
|
@@ -700,7 +700,7 @@ const ze = e.forwardRef(
|
|
|
700
700
|
onClick: b ? void 0 : P,
|
|
701
701
|
onFocus: b ? void 0 : q,
|
|
702
702
|
onBlur: b ? void 0 : z,
|
|
703
|
-
ref:
|
|
703
|
+
ref: I
|
|
704
704
|
},
|
|
705
705
|
/* @__PURE__ */ e.createElement(
|
|
706
706
|
"div",
|
|
@@ -708,26 +708,26 @@ const ze = e.forwardRef(
|
|
|
708
708
|
className: "flex flex-nowrap gap-1 items-center min-h-[1.5rem] w-full overflow-x-auto",
|
|
709
709
|
style: { scrollbarWidth: "none" }
|
|
710
710
|
},
|
|
711
|
-
|
|
711
|
+
L && L.length > 0 ? r.filter((u) => L.includes(u.value)).map((u) => /* @__PURE__ */ e.createElement(
|
|
712
712
|
"span",
|
|
713
713
|
{
|
|
714
|
-
key:
|
|
714
|
+
key: u.value,
|
|
715
715
|
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",
|
|
716
716
|
style: { maxWidth: "140px" }
|
|
717
717
|
},
|
|
718
|
-
/* @__PURE__ */ e.createElement("span", { className: "truncate", title:
|
|
718
|
+
/* @__PURE__ */ e.createElement("span", { className: "truncate", title: u.label }, u.label),
|
|
719
719
|
/* @__PURE__ */ e.createElement(
|
|
720
720
|
"button",
|
|
721
721
|
{
|
|
722
722
|
type: "button",
|
|
723
723
|
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",
|
|
724
|
-
"aria-label": `Remover ${
|
|
724
|
+
"aria-label": `Remover ${u.label}`,
|
|
725
725
|
tabIndex: -1,
|
|
726
|
-
onClick: (
|
|
727
|
-
|
|
728
|
-
const
|
|
729
|
-
|
|
730
|
-
target: { value:
|
|
726
|
+
onClick: (T) => {
|
|
727
|
+
T.stopPropagation();
|
|
728
|
+
const s = L.filter((O) => O !== u.value);
|
|
729
|
+
p && t && p.setValue(t, s), c.onChange && c.onChange({
|
|
730
|
+
target: { value: s }
|
|
731
731
|
});
|
|
732
732
|
}
|
|
733
733
|
},
|
|
@@ -755,22 +755,22 @@ const ze = e.forwardRef(
|
|
|
755
755
|
b && /* @__PURE__ */ e.createElement(
|
|
756
756
|
"input",
|
|
757
757
|
{
|
|
758
|
-
ref:
|
|
758
|
+
ref: B,
|
|
759
759
|
type: "text",
|
|
760
|
-
value:
|
|
760
|
+
value: E,
|
|
761
761
|
onChange: D,
|
|
762
|
-
onFocus: (
|
|
763
|
-
|
|
762
|
+
onFocus: (u) => {
|
|
763
|
+
S(!0), h(!0), f && f(u);
|
|
764
764
|
},
|
|
765
|
-
onBlur: (
|
|
766
|
-
|
|
765
|
+
onBlur: (u) => {
|
|
766
|
+
x && x(u);
|
|
767
767
|
},
|
|
768
|
-
placeholder: n ?
|
|
768
|
+
placeholder: n ? L && L.length > 0 ? "" : M : M || "Selecione...",
|
|
769
769
|
className: "flex-1 bg-transparent border-none outline-none text-sm min-w-[100px]"
|
|
770
770
|
}
|
|
771
771
|
)
|
|
772
772
|
),
|
|
773
|
-
|
|
773
|
+
w && L && L.length > 0 && /* @__PURE__ */ e.createElement(
|
|
774
774
|
"button",
|
|
775
775
|
{
|
|
776
776
|
type: "button",
|
|
@@ -784,10 +784,10 @@ const ze = e.forwardRef(
|
|
|
784
784
|
), n && /* @__PURE__ */ e.createElement(
|
|
785
785
|
"label",
|
|
786
786
|
{
|
|
787
|
-
htmlFor:
|
|
787
|
+
htmlFor: c.id || t,
|
|
788
788
|
className: d(
|
|
789
789
|
"absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",
|
|
790
|
-
|
|
790
|
+
$ ? "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"
|
|
791
791
|
)
|
|
792
792
|
},
|
|
793
793
|
n
|
|
@@ -797,183 +797,183 @@ const ze = e.forwardRef(
|
|
|
797
797
|
className: d(
|
|
798
798
|
"absolute left-0 w-full mt-1 rounded-md transition-all duration-200 overflow-hidden",
|
|
799
799
|
"bg-[var(--select-dropdown-bg)] border-[var(--select-dropdown-border)] text-[var(--select-dropdown-text)]",
|
|
800
|
-
|
|
800
|
+
v ? "border max-h-36 opacity-100 scale-100" : "max-h-0 opacity-0 scale-95 pointer-events-none"
|
|
801
801
|
),
|
|
802
802
|
style: {
|
|
803
|
-
maxHeight:
|
|
803
|
+
maxHeight: v ? "9.5rem" : "0",
|
|
804
804
|
overflowY: r.length > 3 ? "auto" : "hidden",
|
|
805
805
|
position: "fixed",
|
|
806
806
|
// Use fixed positioning to escape container overflow
|
|
807
|
-
top:
|
|
808
|
-
left:
|
|
809
|
-
width:
|
|
807
|
+
top: v ? `${i.top}px` : "auto",
|
|
808
|
+
left: v ? `${i.left}px` : "auto",
|
|
809
|
+
width: v ? `${i.width}px` : "auto",
|
|
810
810
|
zIndex: 9999,
|
|
811
|
-
boxShadow:
|
|
811
|
+
boxShadow: v ? "var(--select-dropdown-shadow)" : "none"
|
|
812
812
|
}
|
|
813
813
|
},
|
|
814
|
-
|
|
814
|
+
W.length === 0 ? /* @__PURE__ */ e.createElement("div", { className: "px-3 py-2 text-sm text-gray-500 text-center" }, "Nenhuma opção encontrada") : W.map((u) => /* @__PURE__ */ e.createElement(
|
|
815
815
|
"div",
|
|
816
816
|
{
|
|
817
|
-
key:
|
|
817
|
+
key: u.value,
|
|
818
818
|
className: d(
|
|
819
819
|
"px-3 py-2 cursor-pointer text-sm flex items-center gap-2 transition-colors duration-150",
|
|
820
820
|
"hover:bg-[var(--select-dropdown-hover)]",
|
|
821
|
-
|
|
821
|
+
L.includes(u.value) && "bg-[var(--select-dropdown-selected)] font-semibold"
|
|
822
822
|
),
|
|
823
|
-
onMouseDown: () => Y(
|
|
823
|
+
onMouseDown: () => Y(u.value)
|
|
824
824
|
},
|
|
825
825
|
/* @__PURE__ */ e.createElement(
|
|
826
826
|
"input",
|
|
827
827
|
{
|
|
828
828
|
type: "checkbox",
|
|
829
|
-
checked:
|
|
829
|
+
checked: L.includes(u.value),
|
|
830
830
|
readOnly: !0,
|
|
831
831
|
className: "accent-blue-500"
|
|
832
832
|
}
|
|
833
833
|
),
|
|
834
|
-
|
|
834
|
+
u.label
|
|
835
835
|
))
|
|
836
836
|
), J && /* @__PURE__ */ e.createElement("span", { className: "text-red-500 text-xs mt-1 block" }, J));
|
|
837
837
|
}
|
|
838
838
|
);
|
|
839
|
-
|
|
840
|
-
const
|
|
839
|
+
Ve.displayName = "MultiSelect";
|
|
840
|
+
const He = e.forwardRef(
|
|
841
841
|
({
|
|
842
842
|
name: t,
|
|
843
843
|
label: n,
|
|
844
844
|
loadOptions: r,
|
|
845
845
|
className: a,
|
|
846
|
-
containerClassName:
|
|
847
|
-
isClearable:
|
|
846
|
+
containerClassName: l,
|
|
847
|
+
isClearable: w,
|
|
848
848
|
defaultOptions: b = !1,
|
|
849
|
-
loadingMessage:
|
|
850
|
-
noOptionsMessage:
|
|
851
|
-
searchable:
|
|
852
|
-
debounceMs:
|
|
853
|
-
maxSelectedDisplay:
|
|
854
|
-
onFocus:
|
|
855
|
-
onBlur:
|
|
849
|
+
loadingMessage: M = "Carregando...",
|
|
850
|
+
noOptionsMessage: N = "Nenhuma opção encontrada",
|
|
851
|
+
searchable: y = !1,
|
|
852
|
+
debounceMs: f = 300,
|
|
853
|
+
maxSelectedDisplay: x = 3,
|
|
854
|
+
onFocus: c,
|
|
855
|
+
onBlur: I,
|
|
856
856
|
...k
|
|
857
|
-
},
|
|
858
|
-
var
|
|
859
|
-
const [
|
|
857
|
+
}, S) => {
|
|
858
|
+
var g, H, ae;
|
|
859
|
+
const [v, h] = e.useState(!1), [E, C] = e.useState(!1), [i, R] = e.useState([]), [F, B] = e.useState(!1), [p, V] = e.useState(""), [U, L] = e.useState(""), [J, Z] = e.useState({
|
|
860
860
|
top: 0,
|
|
861
861
|
left: 0,
|
|
862
862
|
width: 0
|
|
863
|
-
}), G = e.useRef(null),
|
|
864
|
-
if (G.current &&
|
|
865
|
-
const
|
|
866
|
-
let fe =
|
|
867
|
-
if (
|
|
868
|
-
const me = ee -
|
|
869
|
-
me <
|
|
870
|
-
const
|
|
871
|
-
|
|
863
|
+
}), G = e.useRef(null), W = e.useRef(null), $ = ce(), X = $ == null ? void 0 : $.control, _ = X && t ? de({ control: X, name: t }) : void 0, P = k.value ?? _ ?? [], q = (ae = (H = (g = $ == null ? void 0 : $.formState) == null ? void 0 : g.errors) == null ? void 0 : H[t]) == null ? void 0 : ae.message, z = v || P && P.length > 0, Y = e.useCallback(() => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || window.innerWidth <= 768, []), j = e.useCallback(() => {
|
|
864
|
+
if (G.current && E) {
|
|
865
|
+
const m = G.current.getBoundingClientRect(), A = Y(), ee = window.innerHeight, ie = window.innerWidth, se = 152;
|
|
866
|
+
let fe = m.bottom + 4, ue = m.left;
|
|
867
|
+
if (A) {
|
|
868
|
+
const me = ee - m.bottom, Pe = m.top;
|
|
869
|
+
me < se && Pe > se && (fe = m.top - se - 4);
|
|
870
|
+
const ge = 16, _e = ie - m.width - ge;
|
|
871
|
+
ue = Math.min(Math.max(ue, ge), _e);
|
|
872
872
|
} else
|
|
873
|
-
ee -
|
|
873
|
+
ee - m.bottom < se && (fe = m.top - se - 4);
|
|
874
874
|
Z({
|
|
875
875
|
top: fe,
|
|
876
|
-
left:
|
|
877
|
-
width:
|
|
876
|
+
left: ue,
|
|
877
|
+
width: m.width
|
|
878
878
|
});
|
|
879
879
|
}
|
|
880
|
-
}, [
|
|
880
|
+
}, [E, Y]);
|
|
881
881
|
e.useEffect(() => {
|
|
882
|
-
if (j(),
|
|
883
|
-
const
|
|
884
|
-
return window.addEventListener("resize",
|
|
885
|
-
window.removeEventListener("resize",
|
|
882
|
+
if (j(), E) {
|
|
883
|
+
const m = () => j(), A = () => j();
|
|
884
|
+
return window.addEventListener("resize", m), window.addEventListener("scroll", A, !0), () => {
|
|
885
|
+
window.removeEventListener("resize", m), window.removeEventListener("scroll", A, !0);
|
|
886
886
|
};
|
|
887
887
|
}
|
|
888
|
-
}, [
|
|
889
|
-
const
|
|
890
|
-
|
|
891
|
-
},
|
|
892
|
-
return () => clearTimeout(
|
|
893
|
-
}, [
|
|
894
|
-
(
|
|
895
|
-
}, [U,
|
|
896
|
-
b === !0 ? D() : Array.isArray(b) &&
|
|
888
|
+
}, [E, j]), e.useEffect(() => {
|
|
889
|
+
const m = setTimeout(() => {
|
|
890
|
+
L(p);
|
|
891
|
+
}, f);
|
|
892
|
+
return () => clearTimeout(m);
|
|
893
|
+
}, [p, f]), e.useEffect(() => {
|
|
894
|
+
(E || b && i.length === 0) && D(y ? U : void 0);
|
|
895
|
+
}, [U, E]), e.useEffect(() => {
|
|
896
|
+
b === !0 ? D() : Array.isArray(b) && R(b);
|
|
897
897
|
}, []);
|
|
898
|
-
const D = async (
|
|
898
|
+
const D = async (m) => {
|
|
899
899
|
try {
|
|
900
|
-
|
|
901
|
-
const
|
|
902
|
-
|
|
903
|
-
} catch (
|
|
904
|
-
console.error("Error loading options:",
|
|
900
|
+
B(!0);
|
|
901
|
+
const A = await r(m);
|
|
902
|
+
R(A);
|
|
903
|
+
} catch (A) {
|
|
904
|
+
console.error("Error loading options:", A), R([]);
|
|
905
905
|
} finally {
|
|
906
|
-
|
|
906
|
+
B(!1);
|
|
907
907
|
}
|
|
908
908
|
};
|
|
909
909
|
e.useEffect(() => {
|
|
910
|
-
const
|
|
911
|
-
G.current && !G.current.contains(
|
|
910
|
+
const m = (A) => {
|
|
911
|
+
G.current && !G.current.contains(A.target) && (C(!1), h(!1), V(""));
|
|
912
912
|
};
|
|
913
|
-
return document.addEventListener("mousedown",
|
|
914
|
-
document.removeEventListener("mousedown",
|
|
913
|
+
return document.addEventListener("mousedown", m), () => {
|
|
914
|
+
document.removeEventListener("mousedown", m);
|
|
915
915
|
};
|
|
916
916
|
}, []);
|
|
917
917
|
const oe = () => {
|
|
918
|
-
|
|
919
|
-
var
|
|
920
|
-
return (
|
|
918
|
+
E || (C(!0), h(!0), y && W.current && setTimeout(() => {
|
|
919
|
+
var m;
|
|
920
|
+
return (m = W.current) == null ? void 0 : m.focus();
|
|
921
921
|
}, 0));
|
|
922
|
-
}, re = (
|
|
923
|
-
|
|
924
|
-
}, ne = (
|
|
925
|
-
|
|
926
|
-
},
|
|
927
|
-
V(
|
|
928
|
-
},
|
|
929
|
-
let
|
|
930
|
-
P.includes(
|
|
931
|
-
target: { value:
|
|
932
|
-
}),
|
|
933
|
-
},
|
|
934
|
-
|
|
935
|
-
const ee = P.filter((
|
|
936
|
-
|
|
922
|
+
}, re = (m) => {
|
|
923
|
+
h(!0), c && c(m);
|
|
924
|
+
}, ne = (m) => {
|
|
925
|
+
I && I(m);
|
|
926
|
+
}, u = (m) => {
|
|
927
|
+
V(m.target.value);
|
|
928
|
+
}, T = (m) => {
|
|
929
|
+
let A;
|
|
930
|
+
P.includes(m) ? A = P.filter((ee) => ee !== m) : A = [...P, m], $ && t && $.setValue(t, A), k.onChange && k.onChange({
|
|
931
|
+
target: { value: A }
|
|
932
|
+
}), h(!0);
|
|
933
|
+
}, s = (m, A) => {
|
|
934
|
+
A.stopPropagation();
|
|
935
|
+
const ee = P.filter((ie) => ie !== m);
|
|
936
|
+
$ && t && $.setValue(t, ee), k.onChange && k.onChange({
|
|
937
937
|
target: { value: ee }
|
|
938
938
|
});
|
|
939
|
-
},
|
|
940
|
-
|
|
939
|
+
}, O = (m) => {
|
|
940
|
+
m.stopPropagation(), $ && t && $.setValue(t, []), k.onChange && k.onChange({
|
|
941
941
|
target: { value: [] }
|
|
942
|
-
}),
|
|
943
|
-
}, K =
|
|
944
|
-
return /* @__PURE__ */ e.createElement("div", { className: d("relative",
|
|
942
|
+
}), C(!1), h(!1), V("");
|
|
943
|
+
}, K = i.filter((m) => P.includes(m.value)), te = K.slice(0, x), Q = K.length - x;
|
|
944
|
+
return /* @__PURE__ */ e.createElement("div", { className: d("relative", l), ref: G }, /* @__PURE__ */ e.createElement(
|
|
945
945
|
"div",
|
|
946
946
|
{
|
|
947
947
|
id: k.id || t,
|
|
948
|
-
tabIndex:
|
|
948
|
+
tabIndex: y ? -1 : 0,
|
|
949
949
|
role: "button",
|
|
950
950
|
"aria-haspopup": "listbox",
|
|
951
|
-
"aria-expanded":
|
|
951
|
+
"aria-expanded": E,
|
|
952
952
|
className: d(
|
|
953
953
|
"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",
|
|
954
954
|
a
|
|
955
955
|
),
|
|
956
956
|
onClick: oe,
|
|
957
|
-
onFocus:
|
|
958
|
-
onBlur:
|
|
959
|
-
ref:
|
|
957
|
+
onFocus: y ? void 0 : re,
|
|
958
|
+
onBlur: y ? void 0 : ne,
|
|
959
|
+
ref: S
|
|
960
960
|
},
|
|
961
|
-
/* @__PURE__ */ e.createElement("div", { className: "flex flex-wrap gap-1 items-center min-h-[1.5rem] w-full" }, te.map((
|
|
961
|
+
/* @__PURE__ */ e.createElement("div", { className: "flex flex-wrap gap-1 items-center min-h-[1.5rem] w-full" }, te.map((m) => /* @__PURE__ */ e.createElement(
|
|
962
962
|
"span",
|
|
963
963
|
{
|
|
964
|
-
key:
|
|
964
|
+
key: m.value,
|
|
965
965
|
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",
|
|
966
966
|
style: { maxWidth: "140px" }
|
|
967
967
|
},
|
|
968
|
-
/* @__PURE__ */ e.createElement("span", { className: "truncate", title:
|
|
968
|
+
/* @__PURE__ */ e.createElement("span", { className: "truncate", title: m.label }, m.label),
|
|
969
969
|
/* @__PURE__ */ e.createElement(
|
|
970
970
|
"button",
|
|
971
971
|
{
|
|
972
972
|
type: "button",
|
|
973
973
|
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",
|
|
974
|
-
"aria-label": `Remover ${
|
|
974
|
+
"aria-label": `Remover ${m.label}`,
|
|
975
975
|
tabIndex: -1,
|
|
976
|
-
onClick: (
|
|
976
|
+
onClick: (A) => s(m.value, A)
|
|
977
977
|
},
|
|
978
978
|
/* @__PURE__ */ e.createElement(
|
|
979
979
|
"svg",
|
|
@@ -995,28 +995,28 @@ const We = e.forwardRef(
|
|
|
995
995
|
)
|
|
996
996
|
)
|
|
997
997
|
)
|
|
998
|
-
)), Q > 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" }, "+", Q, " mais"),
|
|
998
|
+
)), Q > 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" }, "+", Q, " mais"), y ? /* @__PURE__ */ e.createElement(
|
|
999
999
|
"input",
|
|
1000
1000
|
{
|
|
1001
|
-
ref:
|
|
1001
|
+
ref: W,
|
|
1002
1002
|
type: "text",
|
|
1003
|
-
value:
|
|
1004
|
-
onChange:
|
|
1003
|
+
value: p,
|
|
1004
|
+
onChange: u,
|
|
1005
1005
|
onFocus: re,
|
|
1006
1006
|
onBlur: ne,
|
|
1007
1007
|
placeholder: P.length === 0 && !n ? "Selecione..." : "",
|
|
1008
1008
|
className: "flex-1 min-w-[120px] bg-transparent border-none outline-none text-sm"
|
|
1009
1009
|
}
|
|
1010
1010
|
) : P.length === 0 && !n && /* @__PURE__ */ e.createElement("span", { className: "text-gray-400 text-sm" }, "Selecione...")),
|
|
1011
|
-
|
|
1012
|
-
|
|
1011
|
+
F && /* @__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)]" })),
|
|
1012
|
+
w && P && P.length > 0 && !F && /* @__PURE__ */ e.createElement(
|
|
1013
1013
|
"button",
|
|
1014
1014
|
{
|
|
1015
1015
|
type: "button",
|
|
1016
1016
|
tabIndex: -1,
|
|
1017
1017
|
"aria-label": "Limpar seleção",
|
|
1018
1018
|
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",
|
|
1019
|
-
onClick:
|
|
1019
|
+
onClick: O
|
|
1020
1020
|
},
|
|
1021
1021
|
"✕"
|
|
1022
1022
|
)
|
|
@@ -1036,69 +1036,69 @@ const We = e.forwardRef(
|
|
|
1036
1036
|
className: d(
|
|
1037
1037
|
"absolute left-0 w-full mt-1 rounded-md transition-all duration-200 overflow-hidden",
|
|
1038
1038
|
"bg-[var(--select-dropdown-bg)] border-[var(--select-dropdown-border)] text-[var(--select-dropdown-text)]",
|
|
1039
|
-
|
|
1039
|
+
E ? "border max-h-36 opacity-100 scale-100" : "max-h-0 opacity-0 scale-95 pointer-events-none"
|
|
1040
1040
|
),
|
|
1041
1041
|
style: {
|
|
1042
|
-
maxHeight:
|
|
1043
|
-
overflowY:
|
|
1042
|
+
maxHeight: E ? "9.5rem" : "0",
|
|
1043
|
+
overflowY: i.length > 3 ? "auto" : "hidden",
|
|
1044
1044
|
position: "fixed",
|
|
1045
1045
|
// Use fixed positioning to escape container overflow
|
|
1046
|
-
top:
|
|
1047
|
-
left:
|
|
1048
|
-
width:
|
|
1046
|
+
top: E ? `${J.top}px` : "auto",
|
|
1047
|
+
left: E ? `${J.left}px` : "auto",
|
|
1048
|
+
width: E ? `${J.width}px` : "auto",
|
|
1049
1049
|
zIndex: 9999,
|
|
1050
|
-
boxShadow:
|
|
1050
|
+
boxShadow: E ? "var(--select-dropdown-shadow)" : "none"
|
|
1051
1051
|
}
|
|
1052
1052
|
},
|
|
1053
|
-
|
|
1053
|
+
F ? /* @__PURE__ */ e.createElement("div", { className: "px-3 py-2 text-sm text-gray-500 text-center" }, M) : i.length === 0 ? /* @__PURE__ */ e.createElement("div", { className: "px-3 py-2 text-sm text-gray-500 text-center" }, N) : i.map((m) => /* @__PURE__ */ e.createElement(
|
|
1054
1054
|
"div",
|
|
1055
1055
|
{
|
|
1056
|
-
key:
|
|
1056
|
+
key: m.value,
|
|
1057
1057
|
className: d(
|
|
1058
1058
|
"px-3 py-2 cursor-pointer text-sm flex items-center gap-2 transition-colors duration-150",
|
|
1059
1059
|
"hover:bg-[var(--select-dropdown-hover)]",
|
|
1060
|
-
P.includes(
|
|
1060
|
+
P.includes(m.value) && "bg-[var(--select-dropdown-selected)] font-semibold"
|
|
1061
1061
|
),
|
|
1062
|
-
onMouseDown: () =>
|
|
1062
|
+
onMouseDown: () => T(m.value)
|
|
1063
1063
|
},
|
|
1064
1064
|
/* @__PURE__ */ e.createElement(
|
|
1065
1065
|
"input",
|
|
1066
1066
|
{
|
|
1067
1067
|
type: "checkbox",
|
|
1068
|
-
checked: P.includes(
|
|
1068
|
+
checked: P.includes(m.value),
|
|
1069
1069
|
readOnly: !0,
|
|
1070
1070
|
className: "accent-blue-500"
|
|
1071
1071
|
}
|
|
1072
1072
|
),
|
|
1073
|
-
|
|
1073
|
+
m.label
|
|
1074
1074
|
))
|
|
1075
1075
|
), q && /* @__PURE__ */ e.createElement("span", { className: "text-red-500 text-xs mt-1 block" }, q));
|
|
1076
1076
|
}
|
|
1077
1077
|
);
|
|
1078
|
-
|
|
1079
|
-
const
|
|
1078
|
+
He.displayName = "MultiAsyncSelect";
|
|
1079
|
+
const De = {
|
|
1080
1080
|
sm: "h-10 text-sm px-3",
|
|
1081
1081
|
md: "h-12 text-base px-4",
|
|
1082
1082
|
lg: "h-16 text-lg px-6"
|
|
1083
|
-
},
|
|
1083
|
+
}, je = e.forwardRef(
|
|
1084
1084
|
({
|
|
1085
1085
|
name: t,
|
|
1086
1086
|
label: n,
|
|
1087
1087
|
options: r,
|
|
1088
1088
|
className: a,
|
|
1089
|
-
containerClassName:
|
|
1090
|
-
optionClassName:
|
|
1089
|
+
containerClassName: l,
|
|
1090
|
+
optionClassName: w,
|
|
1091
1091
|
direction: b = "row",
|
|
1092
|
-
size:
|
|
1093
|
-
onFocus:
|
|
1094
|
-
onBlur:
|
|
1095
|
-
...
|
|
1096
|
-
},
|
|
1097
|
-
var
|
|
1098
|
-
const
|
|
1099
|
-
|
|
1092
|
+
size: M = "md",
|
|
1093
|
+
onFocus: N,
|
|
1094
|
+
onBlur: y,
|
|
1095
|
+
...f
|
|
1096
|
+
}, x) => {
|
|
1097
|
+
var E, C, i;
|
|
1098
|
+
const c = ce(), I = c == null ? void 0 : c.control, k = I && t ? de({ control: I, name: t }) : void 0, S = f.value ?? k ?? "", v = (i = (C = (E = c == null ? void 0 : c.formState) == null ? void 0 : E.errors) == null ? void 0 : C[t]) == null ? void 0 : i.message, h = (R) => {
|
|
1099
|
+
c && t && c.setValue(t, R), f.onChange && f.onChange({ target: { value: R } });
|
|
1100
1100
|
};
|
|
1101
|
-
return /* @__PURE__ */ e.createElement("div", { className: d("relative",
|
|
1101
|
+
return /* @__PURE__ */ e.createElement("div", { className: d("relative", l), ref: x }, n && /* @__PURE__ */ e.createElement(
|
|
1102
1102
|
"label",
|
|
1103
1103
|
{
|
|
1104
1104
|
htmlFor: t,
|
|
@@ -1119,42 +1119,42 @@ const Oe = {
|
|
|
1119
1119
|
),
|
|
1120
1120
|
"aria-label": n,
|
|
1121
1121
|
tabIndex: -1,
|
|
1122
|
-
onFocus:
|
|
1123
|
-
onBlur:
|
|
1122
|
+
onFocus: N,
|
|
1123
|
+
onBlur: y
|
|
1124
1124
|
},
|
|
1125
|
-
r.map((
|
|
1125
|
+
r.map((R) => /* @__PURE__ */ e.createElement(
|
|
1126
1126
|
"button",
|
|
1127
1127
|
{
|
|
1128
|
-
key:
|
|
1128
|
+
key: R.value,
|
|
1129
1129
|
type: "button",
|
|
1130
1130
|
className: d(
|
|
1131
1131
|
"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)]",
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1132
|
+
De[M],
|
|
1133
|
+
S === R.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",
|
|
1134
|
+
w
|
|
1135
1135
|
),
|
|
1136
|
-
"aria-pressed":
|
|
1137
|
-
"data-selected":
|
|
1136
|
+
"aria-pressed": S === R.value,
|
|
1137
|
+
"data-selected": S === R.value,
|
|
1138
1138
|
tabIndex: 0,
|
|
1139
|
-
onClick: () =>
|
|
1140
|
-
onKeyDown: (
|
|
1141
|
-
(
|
|
1139
|
+
onClick: () => h(R.value),
|
|
1140
|
+
onKeyDown: (F) => {
|
|
1141
|
+
(F.key === "Enter" || F.key === " ") && (F.preventDefault(), h(R.value));
|
|
1142
1142
|
}
|
|
1143
1143
|
},
|
|
1144
|
-
|
|
1145
|
-
/* @__PURE__ */ e.createElement("span", { className: "truncate font-medium" },
|
|
1144
|
+
R.icon && /* @__PURE__ */ e.createElement("span", { className: "mr-2 text-lg flex items-center" }, R.icon),
|
|
1145
|
+
/* @__PURE__ */ e.createElement("span", { className: "truncate font-medium" }, R.label)
|
|
1146
1146
|
))
|
|
1147
|
-
),
|
|
1147
|
+
), v && /* @__PURE__ */ e.createElement("span", { className: "text-red-500 text-xs mt-1 block" }, v));
|
|
1148
1148
|
}
|
|
1149
1149
|
);
|
|
1150
|
-
|
|
1151
|
-
const
|
|
1152
|
-
({ children: t, className: n, as: r = "div", ...a },
|
|
1150
|
+
je.displayName = "RadioGroup";
|
|
1151
|
+
const ye = o.forwardRef(
|
|
1152
|
+
({ children: t, className: n, as: r = "div", ...a }, l) => /* @__PURE__ */ o.createElement(
|
|
1153
1153
|
r,
|
|
1154
1154
|
{
|
|
1155
|
-
ref:
|
|
1155
|
+
ref: l,
|
|
1156
1156
|
className: d(
|
|
1157
|
-
"px-6 py-4 border-b",
|
|
1157
|
+
"px-2 py-1 sm:px-4 sm:py-2 lg:px-6 lg:py-4 border-b",
|
|
1158
1158
|
"bg-[var(--card-header-bg,rgba(249,250,251,0.5))]",
|
|
1159
1159
|
"border-[var(--card-header-border,#e5e7eb)]",
|
|
1160
1160
|
"text-[var(--card-text,#111827)]",
|
|
@@ -1165,14 +1165,14 @@ const we = i.forwardRef(
|
|
|
1165
1165
|
t
|
|
1166
1166
|
)
|
|
1167
1167
|
);
|
|
1168
|
-
|
|
1169
|
-
const
|
|
1170
|
-
({ children: t, className: n, as: r = "div", ...a },
|
|
1168
|
+
ye.displayName = "CardHeader";
|
|
1169
|
+
const Ee = o.forwardRef(
|
|
1170
|
+
({ children: t, className: n, as: r = "div", ...a }, l) => /* @__PURE__ */ o.createElement(
|
|
1171
1171
|
r,
|
|
1172
1172
|
{
|
|
1173
|
-
ref:
|
|
1173
|
+
ref: l,
|
|
1174
1174
|
className: d(
|
|
1175
|
-
"px-6 py-4",
|
|
1175
|
+
"px-2 py-1 sm:px-4 sm:py-2 lg:px-6 lg:py-4",
|
|
1176
1176
|
"flex-1",
|
|
1177
1177
|
// Para ocupar o espaço disponível
|
|
1178
1178
|
"bg-[var(--card-bg,#ffffff)]",
|
|
@@ -1184,12 +1184,12 @@ const ye = i.forwardRef(
|
|
|
1184
1184
|
t
|
|
1185
1185
|
)
|
|
1186
1186
|
);
|
|
1187
|
-
|
|
1188
|
-
const
|
|
1189
|
-
({ children: t, className: n, as: r = "div", ...a },
|
|
1187
|
+
Ee.displayName = "CardBody";
|
|
1188
|
+
const Ce = o.forwardRef(
|
|
1189
|
+
({ children: t, className: n, as: r = "div", ...a }, l) => /* @__PURE__ */ o.createElement(
|
|
1190
1190
|
r,
|
|
1191
1191
|
{
|
|
1192
|
-
ref:
|
|
1192
|
+
ref: l,
|
|
1193
1193
|
className: d(
|
|
1194
1194
|
"px-6 py-4 border-t",
|
|
1195
1195
|
"bg-[var(--card-footer-bg,rgba(249,250,251,0.5))]",
|
|
@@ -1202,79 +1202,79 @@ const Ee = i.forwardRef(
|
|
|
1202
1202
|
t
|
|
1203
1203
|
)
|
|
1204
1204
|
);
|
|
1205
|
-
|
|
1206
|
-
const
|
|
1205
|
+
Ce.displayName = "CardFooter";
|
|
1206
|
+
const Ue = o.forwardRef(
|
|
1207
1207
|
({
|
|
1208
1208
|
children: t,
|
|
1209
1209
|
className: n,
|
|
1210
1210
|
variant: r = "default",
|
|
1211
1211
|
size: a = "md",
|
|
1212
|
-
padding:
|
|
1212
|
+
padding: l = "none",
|
|
1213
1213
|
// none pois cada seção tem seu próprio padding
|
|
1214
|
-
rounded:
|
|
1214
|
+
rounded: w = "lg",
|
|
1215
1215
|
constrainWidth: b = !1,
|
|
1216
1216
|
// Por padrão, não aplicar max-width
|
|
1217
|
-
allowOverflow:
|
|
1217
|
+
allowOverflow: M = !1,
|
|
1218
1218
|
// Por padrão, aplicar overflow hidden para interface limpa
|
|
1219
|
-
...
|
|
1220
|
-
},
|
|
1221
|
-
const
|
|
1219
|
+
...N
|
|
1220
|
+
}, y) => {
|
|
1221
|
+
const f = {
|
|
1222
1222
|
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))]",
|
|
1223
1223
|
outlined: "bg-[var(--card-bg,#ffffff)] border-2 border-[var(--primary,#2563eb)]",
|
|
1224
1224
|
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))]",
|
|
1225
1225
|
flat: "bg-[var(--card-bg,#ffffff)] border-0"
|
|
1226
|
-
},
|
|
1226
|
+
}, x = {
|
|
1227
1227
|
sm: "max-w-sm",
|
|
1228
1228
|
md: "max-w-md",
|
|
1229
1229
|
lg: "max-w-lg"
|
|
1230
|
-
},
|
|
1230
|
+
}, c = {
|
|
1231
1231
|
none: "",
|
|
1232
1232
|
sm: "p-3",
|
|
1233
1233
|
md: "p-4",
|
|
1234
1234
|
lg: "p-6"
|
|
1235
|
-
},
|
|
1235
|
+
}, I = {
|
|
1236
1236
|
none: "rounded-none",
|
|
1237
1237
|
sm: "rounded-sm",
|
|
1238
1238
|
md: "rounded-md",
|
|
1239
1239
|
lg: "rounded-lg",
|
|
1240
1240
|
xl: "rounded-xl"
|
|
1241
1241
|
};
|
|
1242
|
-
return /* @__PURE__ */
|
|
1242
|
+
return /* @__PURE__ */ o.createElement(
|
|
1243
1243
|
"div",
|
|
1244
1244
|
{
|
|
1245
|
-
ref:
|
|
1245
|
+
ref: y,
|
|
1246
1246
|
className: d(
|
|
1247
1247
|
"flex flex-col",
|
|
1248
1248
|
// Flex column para organizar header, body, footer
|
|
1249
|
-
!
|
|
1249
|
+
!M && "overflow-hidden",
|
|
1250
1250
|
// Overflow hidden por padrão para bordas limpas
|
|
1251
|
-
|
|
1252
|
-
b &&
|
|
1251
|
+
f[r],
|
|
1252
|
+
b && x[a],
|
|
1253
1253
|
// Aplicar max-width apenas se constrainWidth for true
|
|
1254
|
-
|
|
1255
|
-
|
|
1254
|
+
c[l],
|
|
1255
|
+
I[w],
|
|
1256
1256
|
n
|
|
1257
1257
|
),
|
|
1258
|
-
...
|
|
1258
|
+
...N
|
|
1259
1259
|
},
|
|
1260
1260
|
t
|
|
1261
1261
|
);
|
|
1262
1262
|
}
|
|
1263
|
-
),
|
|
1264
|
-
Header:
|
|
1265
|
-
Body:
|
|
1266
|
-
Footer:
|
|
1267
|
-
}),
|
|
1263
|
+
), Ze = Object.assign(Ue, {
|
|
1264
|
+
Header: ye,
|
|
1265
|
+
Body: Ee,
|
|
1266
|
+
Footer: Ce
|
|
1267
|
+
}), Ne = o.forwardRef(
|
|
1268
1268
|
({
|
|
1269
1269
|
children: t,
|
|
1270
1270
|
className: n,
|
|
1271
1271
|
variant: r = "default",
|
|
1272
1272
|
size: a = "md",
|
|
1273
|
-
responsive:
|
|
1274
|
-
stickyHeader:
|
|
1273
|
+
responsive: l = !1,
|
|
1274
|
+
stickyHeader: w = !1,
|
|
1275
1275
|
...b
|
|
1276
|
-
},
|
|
1277
|
-
const
|
|
1276
|
+
}, M) => {
|
|
1277
|
+
const N = d(
|
|
1278
1278
|
// Base styles
|
|
1279
1279
|
"w-full border-collapse bg-[var(--table-bg)] text-[var(--table-text)]",
|
|
1280
1280
|
// Variant styles
|
|
@@ -1288,27 +1288,27 @@ const He = i.forwardRef(
|
|
|
1288
1288
|
"text-lg": a === "lg"
|
|
1289
1289
|
},
|
|
1290
1290
|
n
|
|
1291
|
-
),
|
|
1291
|
+
), y = d(
|
|
1292
1292
|
{
|
|
1293
|
-
"overflow-x-auto":
|
|
1294
|
-
"max-h-96 overflow-y-auto":
|
|
1293
|
+
"overflow-x-auto": l,
|
|
1294
|
+
"max-h-96 overflow-y-auto": w
|
|
1295
1295
|
}
|
|
1296
|
-
),
|
|
1296
|
+
), f = /* @__PURE__ */ o.createElement(
|
|
1297
1297
|
"table",
|
|
1298
1298
|
{
|
|
1299
|
-
ref:
|
|
1300
|
-
className:
|
|
1299
|
+
ref: M,
|
|
1300
|
+
className: N,
|
|
1301
1301
|
...b
|
|
1302
1302
|
},
|
|
1303
1303
|
t
|
|
1304
1304
|
);
|
|
1305
|
-
return
|
|
1305
|
+
return l || w ? /* @__PURE__ */ o.createElement("div", { className: y }, f) : f;
|
|
1306
1306
|
}
|
|
1307
|
-
),
|
|
1308
|
-
({ children: t, className: n, as: r = "thead", ...a },
|
|
1307
|
+
), ke = o.forwardRef(
|
|
1308
|
+
({ children: t, className: n, as: r = "thead", ...a }, l) => /* @__PURE__ */ o.createElement(
|
|
1309
1309
|
r,
|
|
1310
1310
|
{
|
|
1311
|
-
ref:
|
|
1311
|
+
ref: l,
|
|
1312
1312
|
className: d(
|
|
1313
1313
|
"border-b border-[var(--table-border)] bg-[var(--table-header-bg)]",
|
|
1314
1314
|
{
|
|
@@ -1320,11 +1320,11 @@ const He = i.forwardRef(
|
|
|
1320
1320
|
},
|
|
1321
1321
|
t
|
|
1322
1322
|
)
|
|
1323
|
-
),
|
|
1324
|
-
({ children: t, className: n, as: r = "tbody", ...a },
|
|
1323
|
+
), Se = o.forwardRef(
|
|
1324
|
+
({ children: t, className: n, as: r = "tbody", ...a }, l) => /* @__PURE__ */ o.createElement(
|
|
1325
1325
|
r,
|
|
1326
1326
|
{
|
|
1327
|
-
ref:
|
|
1327
|
+
ref: l,
|
|
1328
1328
|
className: d(
|
|
1329
1329
|
"[&_tr:nth-child(odd)]:bg-[var(--table-row-odd)]",
|
|
1330
1330
|
"[&_tr:nth-child(even)]:bg-[var(--table-row-even)]",
|
|
@@ -1334,11 +1334,11 @@ const He = i.forwardRef(
|
|
|
1334
1334
|
},
|
|
1335
1335
|
t
|
|
1336
1336
|
)
|
|
1337
|
-
),
|
|
1338
|
-
({ children: t, className: n, as: r = "tfoot", ...a },
|
|
1337
|
+
), Re = o.forwardRef(
|
|
1338
|
+
({ children: t, className: n, as: r = "tfoot", ...a }, l) => /* @__PURE__ */ o.createElement(
|
|
1339
1339
|
r,
|
|
1340
1340
|
{
|
|
1341
|
-
ref:
|
|
1341
|
+
ref: l,
|
|
1342
1342
|
className: d(
|
|
1343
1343
|
"border-t border-[var(--table-border)] bg-[var(--table-header-bg)] font-medium",
|
|
1344
1344
|
n
|
|
@@ -1347,11 +1347,11 @@ const He = i.forwardRef(
|
|
|
1347
1347
|
},
|
|
1348
1348
|
t
|
|
1349
1349
|
)
|
|
1350
|
-
),
|
|
1351
|
-
({ children: t, className: n, variant: r = "default", ...a },
|
|
1350
|
+
), Fe = o.forwardRef(
|
|
1351
|
+
({ children: t, className: n, variant: r = "default", ...a }, l) => /* @__PURE__ */ o.createElement(
|
|
1352
1352
|
"tr",
|
|
1353
1353
|
{
|
|
1354
|
-
ref:
|
|
1354
|
+
ref: l,
|
|
1355
1355
|
className: d(
|
|
1356
1356
|
"border-b border-[var(--table-border)] transition-colors",
|
|
1357
1357
|
{
|
|
@@ -1364,22 +1364,22 @@ const He = i.forwardRef(
|
|
|
1364
1364
|
},
|
|
1365
1365
|
t
|
|
1366
1366
|
)
|
|
1367
|
-
),
|
|
1367
|
+
), Ie = o.forwardRef(
|
|
1368
1368
|
({
|
|
1369
1369
|
children: t,
|
|
1370
1370
|
className: n,
|
|
1371
1371
|
as: r = "td",
|
|
1372
1372
|
align: a = "left",
|
|
1373
|
-
scope:
|
|
1374
|
-
colSpan:
|
|
1373
|
+
scope: l,
|
|
1374
|
+
colSpan: w,
|
|
1375
1375
|
rowSpan: b,
|
|
1376
|
-
...
|
|
1377
|
-
},
|
|
1376
|
+
...M
|
|
1377
|
+
}, N) => /* @__PURE__ */ o.createElement(
|
|
1378
1378
|
r,
|
|
1379
1379
|
{
|
|
1380
|
-
ref:
|
|
1381
|
-
scope: r === "th" ?
|
|
1382
|
-
colSpan:
|
|
1380
|
+
ref: N,
|
|
1381
|
+
scope: r === "th" ? l : void 0,
|
|
1382
|
+
colSpan: w,
|
|
1383
1383
|
rowSpan: b,
|
|
1384
1384
|
className: d(
|
|
1385
1385
|
"px-4 py-3 text-left",
|
|
@@ -1391,116 +1391,116 @@ const He = i.forwardRef(
|
|
|
1391
1391
|
},
|
|
1392
1392
|
n
|
|
1393
1393
|
),
|
|
1394
|
-
...
|
|
1394
|
+
...M
|
|
1395
1395
|
},
|
|
1396
1396
|
t
|
|
1397
1397
|
)
|
|
1398
1398
|
);
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
const
|
|
1406
|
-
Header:
|
|
1407
|
-
Body:
|
|
1408
|
-
Footer:
|
|
1409
|
-
Row:
|
|
1410
|
-
Cell:
|
|
1411
|
-
}),
|
|
1399
|
+
Ne.displayName = "Table";
|
|
1400
|
+
ke.displayName = "TableHeader";
|
|
1401
|
+
Se.displayName = "TableBody";
|
|
1402
|
+
Re.displayName = "TableFooter";
|
|
1403
|
+
Fe.displayName = "TableRow";
|
|
1404
|
+
Ie.displayName = "TableCell";
|
|
1405
|
+
const et = Object.assign(Ne, {
|
|
1406
|
+
Header: ke,
|
|
1407
|
+
Body: Se,
|
|
1408
|
+
Footer: Re,
|
|
1409
|
+
Row: Fe,
|
|
1410
|
+
Cell: Ie
|
|
1411
|
+
}), tt = ({
|
|
1412
1412
|
content: t,
|
|
1413
1413
|
children: n,
|
|
1414
1414
|
position: r = "top",
|
|
1415
1415
|
className: a = "",
|
|
1416
|
-
disabled:
|
|
1416
|
+
disabled: l = !1
|
|
1417
1417
|
}) => {
|
|
1418
|
-
const [
|
|
1419
|
-
|
|
1420
|
-
if (!
|
|
1421
|
-
const
|
|
1422
|
-
let
|
|
1418
|
+
const [w, b] = le(!1), [M, N] = le(r), [y, f] = le({}), x = pe(null), c = pe(null);
|
|
1419
|
+
be(() => {
|
|
1420
|
+
if (!w || !c.current) return;
|
|
1421
|
+
const i = c.current.getBoundingClientRect();
|
|
1422
|
+
let R = r, F = 0, B = 0;
|
|
1423
1423
|
switch (r) {
|
|
1424
1424
|
case "top":
|
|
1425
|
-
|
|
1425
|
+
F = i.top - 8, B = i.left + i.width / 2;
|
|
1426
1426
|
break;
|
|
1427
1427
|
case "bottom":
|
|
1428
|
-
|
|
1428
|
+
F = i.bottom + 8, B = i.left + i.width / 2;
|
|
1429
1429
|
break;
|
|
1430
1430
|
case "left":
|
|
1431
|
-
|
|
1431
|
+
F = i.top + i.height / 2, B = i.left - 8;
|
|
1432
1432
|
break;
|
|
1433
1433
|
case "right":
|
|
1434
|
-
|
|
1434
|
+
F = i.top + i.height / 2, B = i.right + 8;
|
|
1435
1435
|
break;
|
|
1436
1436
|
}
|
|
1437
|
-
if (
|
|
1438
|
-
const
|
|
1439
|
-
r === "top" &&
|
|
1437
|
+
if (x.current) {
|
|
1438
|
+
const p = x.current.getBoundingClientRect(), V = window.innerWidth, U = window.innerHeight;
|
|
1439
|
+
r === "top" && i.top < p.height + 16 ? (R = "bottom", F = i.bottom + 8) : r === "bottom" && i.bottom + p.height + 16 > U ? (R = "top", F = i.top - 8) : r === "left" && i.left < p.width + 16 ? (R = "right", B = i.right + 8) : r === "right" && i.right + p.width + 16 > V && (R = "left", B = i.left - 8);
|
|
1440
1440
|
}
|
|
1441
|
-
|
|
1441
|
+
N(R), f({
|
|
1442
1442
|
position: "fixed",
|
|
1443
|
-
top: `${
|
|
1444
|
-
left: `${
|
|
1443
|
+
top: `${F}px`,
|
|
1444
|
+
left: `${B}px`,
|
|
1445
1445
|
zIndex: 9999
|
|
1446
1446
|
});
|
|
1447
|
-
}, [
|
|
1448
|
-
const
|
|
1449
|
-
|
|
1447
|
+
}, [w, r]);
|
|
1448
|
+
const I = () => {
|
|
1449
|
+
l || b(!0);
|
|
1450
1450
|
}, k = () => {
|
|
1451
1451
|
b(!1);
|
|
1452
|
-
},
|
|
1453
|
-
|
|
1454
|
-
}, g = () => {
|
|
1455
|
-
b(!1);
|
|
1452
|
+
}, S = () => {
|
|
1453
|
+
l || b(!0);
|
|
1456
1454
|
}, v = () => {
|
|
1457
|
-
|
|
1458
|
-
|
|
1455
|
+
b(!1);
|
|
1456
|
+
}, h = () => {
|
|
1457
|
+
const C = "pointer-events-none";
|
|
1458
|
+
switch (M) {
|
|
1459
1459
|
case "top":
|
|
1460
|
-
return `${
|
|
1460
|
+
return `${C} transform -translate-x-1/2 -translate-y-full`;
|
|
1461
1461
|
case "bottom":
|
|
1462
|
-
return `${
|
|
1462
|
+
return `${C} transform -translate-x-1/2`;
|
|
1463
1463
|
case "left":
|
|
1464
|
-
return `${
|
|
1464
|
+
return `${C} transform -translate-x-full -translate-y-1/2`;
|
|
1465
1465
|
case "right":
|
|
1466
|
-
return `${
|
|
1466
|
+
return `${C} transform -translate-y-1/2`;
|
|
1467
1467
|
default:
|
|
1468
|
-
return `${
|
|
1468
|
+
return `${C} transform -translate-x-1/2 -translate-y-full`;
|
|
1469
1469
|
}
|
|
1470
|
-
},
|
|
1471
|
-
const
|
|
1472
|
-
switch (
|
|
1470
|
+
}, E = () => {
|
|
1471
|
+
const C = "absolute w-2 h-2 bg-[var(--tooltip-bg,#374151)] transform rotate-45";
|
|
1472
|
+
switch (M) {
|
|
1473
1473
|
case "top":
|
|
1474
|
-
return `${
|
|
1474
|
+
return `${C} top-full left-1/2 -translate-x-1/2 -translate-y-1/2`;
|
|
1475
1475
|
case "bottom":
|
|
1476
|
-
return `${
|
|
1476
|
+
return `${C} bottom-full left-1/2 -translate-x-1/2 translate-y-1/2`;
|
|
1477
1477
|
case "left":
|
|
1478
|
-
return `${
|
|
1478
|
+
return `${C} left-full top-1/2 -translate-y-1/2 -translate-x-1/2`;
|
|
1479
1479
|
case "right":
|
|
1480
|
-
return `${
|
|
1480
|
+
return `${C} right-full top-1/2 -translate-y-1/2 translate-x-1/2`;
|
|
1481
1481
|
default:
|
|
1482
|
-
return `${
|
|
1482
|
+
return `${C} top-full left-1/2 -translate-x-1/2 -translate-y-1/2`;
|
|
1483
1483
|
}
|
|
1484
1484
|
};
|
|
1485
|
-
return
|
|
1485
|
+
return l || !t ? /* @__PURE__ */ o.createElement(o.Fragment, null, n) : /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement(
|
|
1486
1486
|
"div",
|
|
1487
1487
|
{
|
|
1488
1488
|
className: "relative inline-block",
|
|
1489
|
-
ref:
|
|
1490
|
-
onMouseEnter:
|
|
1489
|
+
ref: c,
|
|
1490
|
+
onMouseEnter: I,
|
|
1491
1491
|
onMouseLeave: k,
|
|
1492
|
-
onFocus:
|
|
1493
|
-
onBlur:
|
|
1492
|
+
onFocus: S,
|
|
1493
|
+
onBlur: v
|
|
1494
1494
|
},
|
|
1495
1495
|
n
|
|
1496
|
-
),
|
|
1497
|
-
/* @__PURE__ */
|
|
1496
|
+
), w && typeof document < "u" && he(
|
|
1497
|
+
/* @__PURE__ */ o.createElement(
|
|
1498
1498
|
"div",
|
|
1499
1499
|
{
|
|
1500
|
-
ref:
|
|
1501
|
-
style:
|
|
1500
|
+
ref: x,
|
|
1501
|
+
style: y,
|
|
1502
1502
|
className: d(
|
|
1503
|
-
|
|
1503
|
+
h(),
|
|
1504
1504
|
"px-2 py-1 text-sm rounded whitespace-nowrap",
|
|
1505
1505
|
"bg-[var(--tooltip-bg,#374151)] text-[var(--tooltip-text,#fff)]",
|
|
1506
1506
|
"shadow-[var(--tooltip-shadow,0_10px_15px_-3px_rgb(0_0_0_/_0.1),_0_4px_6px_-4px_rgb(0_0_0_/_0.1))]",
|
|
@@ -1508,24 +1508,24 @@ const Ke = Object.assign(Ce, {
|
|
|
1508
1508
|
a
|
|
1509
1509
|
),
|
|
1510
1510
|
role: "tooltip",
|
|
1511
|
-
"aria-hidden": !
|
|
1511
|
+
"aria-hidden": !w
|
|
1512
1512
|
},
|
|
1513
1513
|
t,
|
|
1514
|
-
/* @__PURE__ */
|
|
1514
|
+
/* @__PURE__ */ o.createElement("div", { className: E() })
|
|
1515
1515
|
),
|
|
1516
1516
|
document.body
|
|
1517
1517
|
));
|
|
1518
|
-
},
|
|
1518
|
+
}, Ye = ({
|
|
1519
1519
|
open: t,
|
|
1520
1520
|
onClose: n,
|
|
1521
1521
|
side: r = "right",
|
|
1522
1522
|
size: a = "md",
|
|
1523
|
-
closeOnOverlayClick:
|
|
1524
|
-
children:
|
|
1523
|
+
closeOnOverlayClick: l = !0,
|
|
1524
|
+
children: w,
|
|
1525
1525
|
className: b = "",
|
|
1526
|
-
...
|
|
1526
|
+
...M
|
|
1527
1527
|
}) => {
|
|
1528
|
-
const
|
|
1528
|
+
const N = typeof document < "u" ? document.body : null, y = a === "sm" ? "w-64" : a === "md" ? "w-96" : a === "lg" ? "w-[36rem]" : void 0, f = typeof a == "string" && !["sm", "md", "lg"].includes(a) ? { width: a } : void 0, x = /* @__PURE__ */ o.createElement(
|
|
1529
1529
|
"div",
|
|
1530
1530
|
{
|
|
1531
1531
|
"aria-hidden": !t,
|
|
@@ -1534,19 +1534,19 @@ const Ke = Object.assign(Ce, {
|
|
|
1534
1534
|
t ? "pointer-events-auto" : "pointer-events-none"
|
|
1535
1535
|
)
|
|
1536
1536
|
},
|
|
1537
|
-
/* @__PURE__ */
|
|
1537
|
+
/* @__PURE__ */ o.createElement(
|
|
1538
1538
|
"div",
|
|
1539
1539
|
{
|
|
1540
1540
|
className: d(
|
|
1541
1541
|
"absolute inset-0 bg-black/40 transition-opacity duration-200",
|
|
1542
1542
|
t ? "opacity-100" : "opacity-0"
|
|
1543
1543
|
),
|
|
1544
|
-
onMouseDown: (
|
|
1545
|
-
|
|
1544
|
+
onMouseDown: (c) => {
|
|
1545
|
+
l && c.target === c.currentTarget && n();
|
|
1546
1546
|
}
|
|
1547
1547
|
}
|
|
1548
1548
|
),
|
|
1549
|
-
/* @__PURE__ */
|
|
1549
|
+
/* @__PURE__ */ o.createElement(
|
|
1550
1550
|
"div",
|
|
1551
1551
|
{
|
|
1552
1552
|
className: d(
|
|
@@ -1555,9 +1555,9 @@ const Ke = Object.assign(Ce, {
|
|
|
1555
1555
|
// ensure the sheet doesn't shrink
|
|
1556
1556
|
"flex-shrink-0"
|
|
1557
1557
|
),
|
|
1558
|
-
style:
|
|
1558
|
+
style: f
|
|
1559
1559
|
},
|
|
1560
|
-
/* @__PURE__ */
|
|
1560
|
+
/* @__PURE__ */ o.createElement(
|
|
1561
1561
|
"aside",
|
|
1562
1562
|
{
|
|
1563
1563
|
role: "dialog",
|
|
@@ -1565,90 +1565,90 @@ const Ke = Object.assign(Ce, {
|
|
|
1565
1565
|
className: d(
|
|
1566
1566
|
"h-full bg-white shadow-xl border-l border-gray-100 overflow-auto transition-transform duration-300",
|
|
1567
1567
|
r === "right" ? t ? "translate-x-0" : "translate-x-full" : t ? "translate-x-0" : "-translate-x-full",
|
|
1568
|
-
|
|
1568
|
+
y,
|
|
1569
1569
|
b
|
|
1570
1570
|
),
|
|
1571
|
-
style:
|
|
1572
|
-
...
|
|
1571
|
+
style: f,
|
|
1572
|
+
...M
|
|
1573
1573
|
},
|
|
1574
|
-
|
|
1574
|
+
w
|
|
1575
1575
|
)
|
|
1576
1576
|
)
|
|
1577
1577
|
);
|
|
1578
|
-
return
|
|
1578
|
+
return N ? he(x, N) : null;
|
|
1579
1579
|
};
|
|
1580
|
-
|
|
1581
|
-
const
|
|
1580
|
+
Ye.displayName = "AsideSheet";
|
|
1581
|
+
const rt = ({
|
|
1582
1582
|
avatar: t = !1,
|
|
1583
1583
|
value: n,
|
|
1584
1584
|
onUpload: r,
|
|
1585
1585
|
onRemove: a,
|
|
1586
|
-
accept:
|
|
1587
|
-
maxSize:
|
|
1586
|
+
accept: l = "image/*",
|
|
1587
|
+
maxSize: w,
|
|
1588
1588
|
placeholder: b = "Selecionar imagem",
|
|
1589
|
-
loading:
|
|
1590
|
-
size:
|
|
1591
|
-
label:
|
|
1592
|
-
error:
|
|
1593
|
-
disabled:
|
|
1594
|
-
className:
|
|
1595
|
-
...
|
|
1589
|
+
loading: M = !1,
|
|
1590
|
+
size: N = "md",
|
|
1591
|
+
label: y,
|
|
1592
|
+
error: f,
|
|
1593
|
+
disabled: x,
|
|
1594
|
+
className: c,
|
|
1595
|
+
...I
|
|
1596
1596
|
}) => {
|
|
1597
|
-
const [k,
|
|
1597
|
+
const [k, S] = le(null), [v, h] = le(""), [E, C] = le(!1), i = pe(null), R = !!n, F = !!k, B = R || F, p = M || E, V = {
|
|
1598
1598
|
sm: t ? "w-16 h-16" : "w-24 h-16",
|
|
1599
1599
|
md: t ? "w-24 h-24" : "w-32 h-24",
|
|
1600
1600
|
lg: t ? "w-32 h-32" : "w-40 h-32"
|
|
1601
|
-
},
|
|
1601
|
+
}, L = b || (t ? "Adicionar foto" : "Selecionar imagem"), J = (_) => {
|
|
1602
1602
|
var z;
|
|
1603
|
-
const P = (z =
|
|
1603
|
+
const P = (z = _.target.files) == null ? void 0 : z[0];
|
|
1604
1604
|
if (!P) return;
|
|
1605
|
-
if (
|
|
1606
|
-
alert(`Arquivo muito grande. Tamanho máximo: ${(
|
|
1605
|
+
if (w && P.size > w) {
|
|
1606
|
+
alert(`Arquivo muito grande. Tamanho máximo: ${(w / 1024 / 1024).toFixed(1)}MB`);
|
|
1607
1607
|
return;
|
|
1608
1608
|
}
|
|
1609
1609
|
const q = new FileReader();
|
|
1610
1610
|
q.onload = (Y) => {
|
|
1611
1611
|
var j;
|
|
1612
|
-
|
|
1612
|
+
h((j = Y.target) == null ? void 0 : j.result), S(P);
|
|
1613
1613
|
}, q.readAsDataURL(P);
|
|
1614
1614
|
}, Z = async () => {
|
|
1615
1615
|
if (!(!k || !r))
|
|
1616
1616
|
try {
|
|
1617
|
-
|
|
1618
|
-
const
|
|
1619
|
-
|
|
1620
|
-
} catch (
|
|
1621
|
-
console.error("Erro ao fazer upload:",
|
|
1617
|
+
C(!0);
|
|
1618
|
+
const _ = await r(k);
|
|
1619
|
+
S(null), h(""), i.current && (i.current.value = "");
|
|
1620
|
+
} catch (_) {
|
|
1621
|
+
console.error("Erro ao fazer upload:", _), alert("Erro ao fazer upload da imagem");
|
|
1622
1622
|
} finally {
|
|
1623
|
-
|
|
1623
|
+
C(!1);
|
|
1624
1624
|
}
|
|
1625
1625
|
}, G = () => {
|
|
1626
|
-
|
|
1627
|
-
},
|
|
1626
|
+
S(null), h(""), i.current && (i.current.value = "");
|
|
1627
|
+
}, W = async () => {
|
|
1628
1628
|
try {
|
|
1629
|
-
a && await a(n),
|
|
1630
|
-
} catch (
|
|
1631
|
-
console.error("Erro ao remover imagem:",
|
|
1629
|
+
a && await a(n), S(null), h(""), i.current && (i.current.value = "");
|
|
1630
|
+
} catch (_) {
|
|
1631
|
+
console.error("Erro ao remover imagem:", _), alert("Erro ao remover imagem");
|
|
1632
1632
|
}
|
|
1633
|
-
},
|
|
1634
|
-
var
|
|
1635
|
-
|
|
1636
|
-
}, X =
|
|
1637
|
-
return /* @__PURE__ */
|
|
1633
|
+
}, $ = () => {
|
|
1634
|
+
var _;
|
|
1635
|
+
x || p || (_ = i.current) == null || _.click();
|
|
1636
|
+
}, X = v || n;
|
|
1637
|
+
return /* @__PURE__ */ o.createElement("div", { className: d("flex flex-col space-y-2", c) }, y && /* @__PURE__ */ o.createElement("label", { className: "text-sm font-medium text-gray-700" }, y), /* @__PURE__ */ o.createElement("div", { className: "relative flex flex-col items-center" }, /* @__PURE__ */ o.createElement(
|
|
1638
1638
|
"input",
|
|
1639
1639
|
{
|
|
1640
|
-
ref:
|
|
1640
|
+
ref: i,
|
|
1641
1641
|
type: "file",
|
|
1642
|
-
accept:
|
|
1642
|
+
accept: l,
|
|
1643
1643
|
onChange: J,
|
|
1644
|
-
disabled:
|
|
1644
|
+
disabled: x || p,
|
|
1645
1645
|
className: "hidden",
|
|
1646
|
-
...
|
|
1646
|
+
...I
|
|
1647
1647
|
}
|
|
1648
|
-
), /* @__PURE__ */
|
|
1648
|
+
), /* @__PURE__ */ o.createElement(
|
|
1649
1649
|
"div",
|
|
1650
1650
|
{
|
|
1651
|
-
onClick:
|
|
1651
|
+
onClick: $,
|
|
1652
1652
|
className: d(
|
|
1653
1653
|
// Base styles
|
|
1654
1654
|
"relative border-2 border-dashed border-gray-300 transition-colors cursor-pointer",
|
|
@@ -1656,19 +1656,19 @@ const Qe = ({
|
|
|
1656
1656
|
// Shape
|
|
1657
1657
|
t ? "rounded-full" : "rounded-lg",
|
|
1658
1658
|
// Size
|
|
1659
|
-
V[
|
|
1659
|
+
V[N],
|
|
1660
1660
|
// States
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1661
|
+
x && "opacity-50 cursor-not-allowed",
|
|
1662
|
+
p && "cursor-wait",
|
|
1663
|
+
f && "border-red-300",
|
|
1664
1664
|
// Background
|
|
1665
|
-
!
|
|
1666
|
-
|
|
1665
|
+
!B && "bg-gray-50 hover:bg-gray-100",
|
|
1666
|
+
B && "border-solid border-gray-200"
|
|
1667
1667
|
)
|
|
1668
1668
|
},
|
|
1669
|
-
|
|
1669
|
+
B ? (
|
|
1670
1670
|
// Preview da imagem
|
|
1671
|
-
/* @__PURE__ */
|
|
1671
|
+
/* @__PURE__ */ o.createElement(
|
|
1672
1672
|
"img",
|
|
1673
1673
|
{
|
|
1674
1674
|
src: X,
|
|
@@ -1681,9 +1681,9 @@ const Qe = ({
|
|
|
1681
1681
|
)
|
|
1682
1682
|
) : (
|
|
1683
1683
|
// Estado vazio
|
|
1684
|
-
/* @__PURE__ */
|
|
1684
|
+
/* @__PURE__ */ o.createElement("div", { className: "flex flex-col items-center justify-center h-full text-gray-500 text-sm" }, t ? (
|
|
1685
1685
|
// Ícone de usuário para avatar
|
|
1686
|
-
/* @__PURE__ */
|
|
1686
|
+
/* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement(
|
|
1687
1687
|
"svg",
|
|
1688
1688
|
{
|
|
1689
1689
|
className: "w-8 h-8 mb-1",
|
|
@@ -1691,7 +1691,7 @@ const Qe = ({
|
|
|
1691
1691
|
stroke: "currentColor",
|
|
1692
1692
|
viewBox: "0 0 24 24"
|
|
1693
1693
|
},
|
|
1694
|
-
/* @__PURE__ */
|
|
1694
|
+
/* @__PURE__ */ o.createElement(
|
|
1695
1695
|
"path",
|
|
1696
1696
|
{
|
|
1697
1697
|
strokeLinecap: "round",
|
|
@@ -1700,10 +1700,10 @@ const Qe = ({
|
|
|
1700
1700
|
d: "M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"
|
|
1701
1701
|
}
|
|
1702
1702
|
)
|
|
1703
|
-
), /* @__PURE__ */
|
|
1703
|
+
), /* @__PURE__ */ o.createElement("span", { className: "text-center px-2 text-xs" }, L))
|
|
1704
1704
|
) : (
|
|
1705
1705
|
// Ícone de adicionar imagem genérica
|
|
1706
|
-
/* @__PURE__ */
|
|
1706
|
+
/* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement(
|
|
1707
1707
|
"svg",
|
|
1708
1708
|
{
|
|
1709
1709
|
className: "w-6 h-6 mb-1",
|
|
@@ -1711,7 +1711,7 @@ const Qe = ({
|
|
|
1711
1711
|
stroke: "currentColor",
|
|
1712
1712
|
viewBox: "0 0 24 24"
|
|
1713
1713
|
},
|
|
1714
|
-
/* @__PURE__ */
|
|
1714
|
+
/* @__PURE__ */ o.createElement(
|
|
1715
1715
|
"path",
|
|
1716
1716
|
{
|
|
1717
1717
|
strokeLinecap: "round",
|
|
@@ -1720,16 +1720,16 @@ const Qe = ({
|
|
|
1720
1720
|
d: "M12 6v6m0 0v6m0-6h6m-6 0H6"
|
|
1721
1721
|
}
|
|
1722
1722
|
)
|
|
1723
|
-
), /* @__PURE__ */
|
|
1723
|
+
), /* @__PURE__ */ o.createElement("span", { className: "text-center px-2" }, L))
|
|
1724
1724
|
))
|
|
1725
1725
|
),
|
|
1726
|
-
|
|
1726
|
+
p && /* @__PURE__ */ o.createElement("div", { className: d(
|
|
1727
1727
|
"absolute inset-0 bg-black bg-opacity-50 flex items-center justify-center",
|
|
1728
1728
|
t ? "rounded-full" : "rounded-lg"
|
|
1729
|
-
) }, /* @__PURE__ */
|
|
1730
|
-
),
|
|
1729
|
+
) }, /* @__PURE__ */ o.createElement("div", { className: "w-6 h-6 border-2 border-white border-t-transparent rounded-full animate-spin" }))
|
|
1730
|
+
), B && !p && /* @__PURE__ */ o.createElement("div", { className: "flex justify-center space-x-2 mt-3" }, F ? (
|
|
1731
1731
|
// Ações para arquivo selecionado (não salvo ainda)
|
|
1732
|
-
/* @__PURE__ */
|
|
1732
|
+
/* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement(
|
|
1733
1733
|
"button",
|
|
1734
1734
|
{
|
|
1735
1735
|
onClick: Z,
|
|
@@ -1737,7 +1737,7 @@ const Qe = ({
|
|
|
1737
1737
|
className: "px-3 py-1 bg-blue-600 text-white text-sm rounded hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed"
|
|
1738
1738
|
},
|
|
1739
1739
|
"Confirmar"
|
|
1740
|
-
), /* @__PURE__ */
|
|
1740
|
+
), /* @__PURE__ */ o.createElement(
|
|
1741
1741
|
"button",
|
|
1742
1742
|
{
|
|
1743
1743
|
onClick: G,
|
|
@@ -1747,37 +1747,175 @@ const Qe = ({
|
|
|
1747
1747
|
))
|
|
1748
1748
|
) : (
|
|
1749
1749
|
// Ações para imagem já salva
|
|
1750
|
-
/* @__PURE__ */
|
|
1750
|
+
/* @__PURE__ */ o.createElement(
|
|
1751
1751
|
"button",
|
|
1752
1752
|
{
|
|
1753
|
-
onClick:
|
|
1753
|
+
onClick: W,
|
|
1754
1754
|
disabled: !a,
|
|
1755
1755
|
className: "px-3 py-1 bg-red-600 text-white text-sm rounded hover:bg-red-700 disabled:opacity-50 disabled:cursor-not-allowed"
|
|
1756
1756
|
},
|
|
1757
1757
|
"Remover"
|
|
1758
1758
|
)
|
|
1759
|
-
))),
|
|
1759
|
+
))), f && /* @__PURE__ */ o.createElement("p", { className: "text-sm text-red-600" }, f), w && !B && /* @__PURE__ */ o.createElement("p", { className: "text-xs text-gray-500" }, "Tamanho máximo: ", (w / 1024 / 1024).toFixed(1), "MB"), t && !B && /* @__PURE__ */ o.createElement("p", { className: "text-xs text-gray-500 text-center" }, "Use uma foto com seu rosto centralizado e bem visível"));
|
|
1760
|
+
}, Me = o.createContext(null), Ge = () => {
|
|
1761
|
+
const t = o.useContext(Me);
|
|
1762
|
+
if (!t)
|
|
1763
|
+
throw new Error("AccordionItem must be used within an Accordion");
|
|
1764
|
+
return t;
|
|
1765
|
+
};
|
|
1766
|
+
let Le = 0;
|
|
1767
|
+
const Be = ({
|
|
1768
|
+
title: t,
|
|
1769
|
+
children: n,
|
|
1770
|
+
defaultOpen: r = !1,
|
|
1771
|
+
disabled: a = !1,
|
|
1772
|
+
className: l,
|
|
1773
|
+
headerClassName: w,
|
|
1774
|
+
contentClassName: b,
|
|
1775
|
+
icon: M
|
|
1776
|
+
}) => {
|
|
1777
|
+
const { openItems: N, toggleItem: y, variant: f } = Ge(), [x] = le(() => Le++), c = N.has(x), I = pe(null), [k, S] = le(r ? void 0 : 0);
|
|
1778
|
+
be(() => {
|
|
1779
|
+
if (c) {
|
|
1780
|
+
const C = I.current;
|
|
1781
|
+
C && S(C.scrollHeight);
|
|
1782
|
+
} else
|
|
1783
|
+
S(0);
|
|
1784
|
+
}, [c]);
|
|
1785
|
+
const v = () => {
|
|
1786
|
+
a || y(x);
|
|
1787
|
+
}, E = {
|
|
1788
|
+
default: {
|
|
1789
|
+
item: "border-b border-[var(--accordion-border,#e5e7eb)] last:border-b-0",
|
|
1790
|
+
header: "",
|
|
1791
|
+
content: ""
|
|
1792
|
+
},
|
|
1793
|
+
bordered: {
|
|
1794
|
+
item: "border border-[var(--accordion-border,#e5e7eb)] rounded-md mb-2",
|
|
1795
|
+
header: "border-b border-[var(--accordion-border,#e5e7eb)]",
|
|
1796
|
+
content: ""
|
|
1797
|
+
},
|
|
1798
|
+
separated: {
|
|
1799
|
+
item: "border border-[var(--accordion-border,#e5e7eb)] rounded-md mb-3 shadow-sm",
|
|
1800
|
+
header: "",
|
|
1801
|
+
content: ""
|
|
1802
|
+
}
|
|
1803
|
+
}[f];
|
|
1804
|
+
return /* @__PURE__ */ o.createElement("div", { className: d(E.item, l) }, /* @__PURE__ */ o.createElement(
|
|
1805
|
+
"button",
|
|
1806
|
+
{
|
|
1807
|
+
type: "button",
|
|
1808
|
+
onClick: v,
|
|
1809
|
+
disabled: a,
|
|
1810
|
+
"aria-expanded": c,
|
|
1811
|
+
className: d(
|
|
1812
|
+
"w-full flex items-center justify-between px-4 py-3 text-left transition-colors",
|
|
1813
|
+
"bg-[var(--accordion-header-bg,transparent)]",
|
|
1814
|
+
"hover:bg-[var(--accordion-header-hover,rgba(0,0,0,0.05))]",
|
|
1815
|
+
"text-[var(--accordion-text,#111827)]",
|
|
1816
|
+
"font-medium",
|
|
1817
|
+
a && "opacity-50 cursor-not-allowed",
|
|
1818
|
+
c && f !== "default" && E.header,
|
|
1819
|
+
w
|
|
1820
|
+
)
|
|
1821
|
+
},
|
|
1822
|
+
/* @__PURE__ */ o.createElement("span", { className: "flex items-center gap-2" }, M && /* @__PURE__ */ o.createElement("span", { className: "flex-shrink-0" }, M), t),
|
|
1823
|
+
/* @__PURE__ */ o.createElement(
|
|
1824
|
+
"svg",
|
|
1825
|
+
{
|
|
1826
|
+
className: d(
|
|
1827
|
+
"w-5 h-5 transition-transform duration-200 flex-shrink-0",
|
|
1828
|
+
"text-[var(--accordion-icon,#6b7280)]",
|
|
1829
|
+
c && "rotate-180"
|
|
1830
|
+
),
|
|
1831
|
+
fill: "none",
|
|
1832
|
+
strokeWidth: "2",
|
|
1833
|
+
stroke: "currentColor",
|
|
1834
|
+
viewBox: "0 0 24 24"
|
|
1835
|
+
},
|
|
1836
|
+
/* @__PURE__ */ o.createElement("path", { d: "M19 9l-7 7-7-7" })
|
|
1837
|
+
)
|
|
1838
|
+
), /* @__PURE__ */ o.createElement(
|
|
1839
|
+
"div",
|
|
1840
|
+
{
|
|
1841
|
+
style: {
|
|
1842
|
+
height: k,
|
|
1843
|
+
overflow: "hidden",
|
|
1844
|
+
transition: "height 0.3s ease-in-out"
|
|
1845
|
+
}
|
|
1846
|
+
},
|
|
1847
|
+
/* @__PURE__ */ o.createElement(
|
|
1848
|
+
"div",
|
|
1849
|
+
{
|
|
1850
|
+
ref: I,
|
|
1851
|
+
className: d(
|
|
1852
|
+
"px-4 py-3",
|
|
1853
|
+
"text-[var(--accordion-content-text,#374151)]",
|
|
1854
|
+
"bg-[var(--accordion-content-bg,transparent)]",
|
|
1855
|
+
b
|
|
1856
|
+
)
|
|
1857
|
+
},
|
|
1858
|
+
n
|
|
1859
|
+
)
|
|
1860
|
+
));
|
|
1861
|
+
};
|
|
1862
|
+
Be.displayName = "AccordionItem";
|
|
1863
|
+
const qe = ({
|
|
1864
|
+
children: t,
|
|
1865
|
+
type: n = "single",
|
|
1866
|
+
className: r,
|
|
1867
|
+
variant: a = "default",
|
|
1868
|
+
collapsible: l = !0
|
|
1869
|
+
}) => {
|
|
1870
|
+
const [w, b] = le(/* @__PURE__ */ new Set());
|
|
1871
|
+
be(() => {
|
|
1872
|
+
Le = 0;
|
|
1873
|
+
const N = o.Children.toArray(t), y = /* @__PURE__ */ new Set();
|
|
1874
|
+
if (N.forEach((f, x) => {
|
|
1875
|
+
o.isValidElement(f) && f.props.defaultOpen && y.add(x);
|
|
1876
|
+
}), n === "single" && y.size > 1) {
|
|
1877
|
+
const f = Array.from(y)[0];
|
|
1878
|
+
b(/* @__PURE__ */ new Set([f]));
|
|
1879
|
+
} else
|
|
1880
|
+
b(y);
|
|
1881
|
+
}, [t, n]);
|
|
1882
|
+
const M = (N) => {
|
|
1883
|
+
b((y) => {
|
|
1884
|
+
const f = new Set(y);
|
|
1885
|
+
return n === "single" ? f.has(N) ? l && f.clear() : (f.clear(), f.add(N)) : f.has(N) ? f.delete(N) : f.add(N), f;
|
|
1886
|
+
});
|
|
1887
|
+
};
|
|
1888
|
+
return /* @__PURE__ */ o.createElement(
|
|
1889
|
+
Me.Provider,
|
|
1890
|
+
{
|
|
1891
|
+
value: { type: n, openItems: w, toggleItem: M, collapsible: l, variant: a }
|
|
1892
|
+
},
|
|
1893
|
+
/* @__PURE__ */ o.createElement("div", { className: d("w-full", r) }, t)
|
|
1894
|
+
);
|
|
1760
1895
|
};
|
|
1896
|
+
qe.Item = Be;
|
|
1761
1897
|
export {
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
Se as
|
|
1779
|
-
|
|
1780
|
-
Re as
|
|
1781
|
-
|
|
1782
|
-
|
|
1898
|
+
qe as Accordion,
|
|
1899
|
+
Be as AccordionItem,
|
|
1900
|
+
Ye as AsideSheet,
|
|
1901
|
+
We as AsyncSelect,
|
|
1902
|
+
Xe as Button,
|
|
1903
|
+
Ze as Card,
|
|
1904
|
+
Ee as CardBody,
|
|
1905
|
+
Ce as CardFooter,
|
|
1906
|
+
ye as CardHeader,
|
|
1907
|
+
rt as ImageInput,
|
|
1908
|
+
$e as Input,
|
|
1909
|
+
He as MultiAsyncSelect,
|
|
1910
|
+
Ve as MultiSelect,
|
|
1911
|
+
je as RadioGroup,
|
|
1912
|
+
ze as Select,
|
|
1913
|
+
et as Table,
|
|
1914
|
+
Se as TableBody,
|
|
1915
|
+
Ie as TableCell,
|
|
1916
|
+
Re as TableFooter,
|
|
1917
|
+
ke as TableHeader,
|
|
1918
|
+
Fe as TableRow,
|
|
1919
|
+
Oe as Textarea,
|
|
1920
|
+
tt as Tooltip
|
|
1783
1921
|
};
|