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