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