rharuow-ds 1.8.2 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +512 -25
- package/dist/rharuow-ds.cjs.js +1 -1
- package/dist/rharuow-ds.es.js +1298 -963
- package/dist/styles.css +1 -1
- package/dist/types/src/components/Modal.d.ts +16 -0
- package/dist/types/src/components/Toaster.d.ts +31 -0
- package/dist/types/src/components/index.d.ts +2 -0
- package/dist/types/src/stories/Modal.stories.d.ts +13 -0
- package/dist/types/src/stories/Toaster.stories.d.ts +13 -0
- package/package.json +7 -2
package/dist/rharuow-ds.es.js
CHANGED
|
@@ -1,737 +1,737 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
1
|
+
import * as t from "react";
|
|
2
|
+
import n, { useState as ne, useRef as pe, useEffect as ve, createContext as $e, useCallback as ge, useContext as We } from "react";
|
|
3
3
|
import { useFormContext as ce, useWatch as de } from "react-hook-form";
|
|
4
|
-
import { createPortal as
|
|
5
|
-
function
|
|
6
|
-
var
|
|
7
|
-
if (typeof
|
|
8
|
-
else if (typeof
|
|
9
|
-
var l =
|
|
10
|
-
for (
|
|
11
|
-
} else for (r in
|
|
12
|
-
return
|
|
4
|
+
import { createPortal as be } from "react-dom";
|
|
5
|
+
function ye(e) {
|
|
6
|
+
var a, r, o = "";
|
|
7
|
+
if (typeof e == "string" || typeof e == "number") o += e;
|
|
8
|
+
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
9
|
+
var l = e.length;
|
|
10
|
+
for (a = 0; a < l; a++) e[a] && (r = ye(e[a])) && (o && (o += " "), o += r);
|
|
11
|
+
} else for (r in e) e[r] && (o && (o += " "), o += r);
|
|
12
|
+
return o;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
for (var
|
|
16
|
-
return
|
|
14
|
+
function Oe() {
|
|
15
|
+
for (var e, a, r = 0, o = "", l = arguments.length; r < l; r++) (e = arguments[r]) && (a = ye(e)) && (o && (o += " "), o += a);
|
|
16
|
+
return o;
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
return
|
|
18
|
+
function i(...e) {
|
|
19
|
+
return Oe(...e);
|
|
20
20
|
}
|
|
21
|
-
const
|
|
22
|
-
children:
|
|
23
|
-
variant:
|
|
21
|
+
const lt = ({
|
|
22
|
+
children: e,
|
|
23
|
+
variant: a = "default",
|
|
24
24
|
className: r = "",
|
|
25
|
-
...
|
|
25
|
+
...o
|
|
26
26
|
}) => {
|
|
27
|
-
const l = "px-4 py-2 rounded font-medium transition",
|
|
27
|
+
const l = "px-4 py-2 rounded font-medium transition", v = {
|
|
28
28
|
default: "bg-[var(--primary,#2563eb)] text-[var(--primary-text,#fff)] hover:bg-[var(--primary-hover,#1d4ed8)]",
|
|
29
29
|
outline: "border border-[var(--primary,#2563eb)] text-[var(--primary,#2563eb)] bg-white hover:bg-[var(--primary-hover,#e0e7ff)]",
|
|
30
30
|
secondary: "bg-[var(--secondary,#fbbf24)] text-[var(--secondary-text,#222)] hover:bg-[var(--secondary-hover,#f59e42)]"
|
|
31
31
|
};
|
|
32
|
-
return /* @__PURE__ */
|
|
33
|
-
},
|
|
34
|
-
const r =
|
|
32
|
+
return /* @__PURE__ */ n.createElement("button", { className: i(l, v[a], r), ...o }, e);
|
|
33
|
+
}, Ee = (e) => e.replace(/\D/g, ""), Ve = (e) => {
|
|
34
|
+
const r = Ee(e).slice(0, 11);
|
|
35
35
|
return r.length <= 3 ? r : r.length <= 6 ? `${r.slice(0, 3)}.${r.slice(3)}` : r.length <= 9 ? `${r.slice(0, 3)}.${r.slice(3, 6)}.${r.slice(6)}` : `${r.slice(0, 3)}.${r.slice(3, 6)}.${r.slice(6, 9)}-${r.slice(9, 11)}`;
|
|
36
|
-
},
|
|
37
|
-
const
|
|
38
|
-
if (
|
|
36
|
+
}, we = (e) => {
|
|
37
|
+
const a = Ee(e);
|
|
38
|
+
if (a.length !== 11 || /^(\d)\1{10}$/.test(a))
|
|
39
39
|
return !1;
|
|
40
40
|
let r = 0;
|
|
41
41
|
for (let l = 0; l < 9; l++)
|
|
42
|
-
r += parseInt(
|
|
43
|
-
let
|
|
44
|
-
if ((
|
|
42
|
+
r += parseInt(a.charAt(l)) * (10 - l);
|
|
43
|
+
let o = r * 10 % 11;
|
|
44
|
+
if ((o === 10 || o === 11) && (o = 0), o !== parseInt(a.charAt(9)))
|
|
45
45
|
return !1;
|
|
46
46
|
r = 0;
|
|
47
47
|
for (let l = 0; l < 10; l++)
|
|
48
|
-
r += parseInt(
|
|
49
|
-
return
|
|
50
|
-
},
|
|
48
|
+
r += parseInt(a.charAt(l)) * (11 - l);
|
|
49
|
+
return o = r * 10 % 11, (o === 10 || o === 11) && (o = 0), o === parseInt(a.charAt(10));
|
|
50
|
+
}, He = t.forwardRef(
|
|
51
51
|
({
|
|
52
|
-
name:
|
|
53
|
-
className:
|
|
52
|
+
name: e,
|
|
53
|
+
className: a,
|
|
54
54
|
type: r = "text",
|
|
55
|
-
label:
|
|
55
|
+
label: o,
|
|
56
56
|
onFocus: l,
|
|
57
|
-
onBlur:
|
|
58
|
-
onChange:
|
|
59
|
-
Icon:
|
|
60
|
-
iconClassName:
|
|
61
|
-
iconAction:
|
|
62
|
-
containerClassName:
|
|
57
|
+
onBlur: v,
|
|
58
|
+
onChange: d,
|
|
59
|
+
Icon: k,
|
|
60
|
+
iconClassName: h,
|
|
61
|
+
iconAction: g,
|
|
62
|
+
containerClassName: u,
|
|
63
63
|
cpf: x = !1,
|
|
64
|
-
...
|
|
65
|
-
},
|
|
66
|
-
var
|
|
67
|
-
const [
|
|
64
|
+
...s
|
|
65
|
+
}, S) => {
|
|
66
|
+
var T, P, q;
|
|
67
|
+
const [L, M] = t.useState(!1), [y, E] = t.useState(!1), [N, C] = t.useState(null), m = ce(), R = m == null ? void 0 : m.control, F = m == null ? void 0 : m.register, I = R && e ? de({ control: R, name: e }) : void 0, b = s.value ?? I ?? "", V = ((q = (P = (T = m == null ? void 0 : m.formState) == null ? void 0 : T.errors) == null ? void 0 : P[e]) == null ? void 0 : q.message) || N, B = ["date", "datetime-local", "time", "month", "week"].includes(r), J = L || !!b || B, Z = r === "password" ? y ? "text" : "password" : r, G = () => /* @__PURE__ */ t.createElement("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ t.createElement(
|
|
68
68
|
"path",
|
|
69
69
|
{
|
|
70
70
|
d: "M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z",
|
|
71
71
|
fill: "currentColor"
|
|
72
72
|
}
|
|
73
|
-
)),
|
|
73
|
+
)), O = () => /* @__PURE__ */ t.createElement("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ t.createElement(
|
|
74
74
|
"path",
|
|
75
75
|
{
|
|
76
76
|
d: "M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z",
|
|
77
77
|
fill: "currentColor"
|
|
78
78
|
}
|
|
79
|
-
)),
|
|
80
|
-
|
|
81
|
-
}, X = (
|
|
79
|
+
)), z = () => {
|
|
80
|
+
E(!y);
|
|
81
|
+
}, X = ($) => {
|
|
82
82
|
if (x) {
|
|
83
|
-
const Y =
|
|
84
|
-
|
|
83
|
+
const Y = $.target.value, j = Ve(Y);
|
|
84
|
+
$.target.value = j, j.length === 14 ? we(j) ? C(null) : C("CPF inválido") : C(null);
|
|
85
85
|
}
|
|
86
|
-
|
|
86
|
+
d && d($);
|
|
87
87
|
};
|
|
88
|
-
return /* @__PURE__ */
|
|
88
|
+
return /* @__PURE__ */ t.createElement("div", { className: i("relative", u) }, /* @__PURE__ */ t.createElement(
|
|
89
89
|
"input",
|
|
90
90
|
{
|
|
91
|
-
id:
|
|
91
|
+
id: s.id || e,
|
|
92
92
|
type: Z,
|
|
93
|
-
className:
|
|
93
|
+
className: i(
|
|
94
94
|
"peer flex h-12 w-full border border-[var(--primary,#2563eb)] rounded-md bg-[var(--input-bg,#fff)] text-[var(--input-text,#222)] px-3 pt-6 pb-2 text-sm placeholder-transparent transition focus:outline-none focus:border-[var(--primary,#2563eb)] disabled:cursor-not-allowed disabled:opacity-50",
|
|
95
|
-
r === "password" ||
|
|
95
|
+
r === "password" || k ? "pr-12" : "",
|
|
96
96
|
// espaço extra para qualquer ícone (password ou customizado)
|
|
97
97
|
V ? "border-red-500" : "",
|
|
98
|
-
|
|
98
|
+
a
|
|
99
99
|
),
|
|
100
|
-
onFocus: (
|
|
101
|
-
|
|
100
|
+
onFocus: ($) => {
|
|
101
|
+
M(!0), l && l($);
|
|
102
102
|
},
|
|
103
|
-
maxLength: x ? 14 :
|
|
104
|
-
inputMode: x ? "numeric" :
|
|
105
|
-
...
|
|
106
|
-
const
|
|
107
|
-
validate: (D) => D ? D.length < 14 ? "CPF incompleto" :
|
|
108
|
-
} : void 0), Y =
|
|
103
|
+
maxLength: x ? 14 : s.maxLength,
|
|
104
|
+
inputMode: x ? "numeric" : s.inputMode,
|
|
105
|
+
...m && e ? (() => {
|
|
106
|
+
const $ = F(e, x ? {
|
|
107
|
+
validate: (D) => D ? D.length < 14 ? "CPF incompleto" : we(D) ? !0 : "CPF inválido" : "CPF é obrigatório"
|
|
108
|
+
} : void 0), Y = $.onBlur, j = $.onChange;
|
|
109
109
|
return {
|
|
110
|
-
|
|
110
|
+
...$,
|
|
111
111
|
ref: (D) => {
|
|
112
|
-
typeof
|
|
112
|
+
typeof S == "function" ? S(D) : S && (S.current = D), $.ref && $.ref(D);
|
|
113
113
|
},
|
|
114
114
|
onBlur: (D) => {
|
|
115
|
-
|
|
115
|
+
M(!1), v && v(D), Y && Y(D);
|
|
116
116
|
},
|
|
117
117
|
onChange: (D) => {
|
|
118
118
|
X(D), j && j(D);
|
|
119
119
|
}
|
|
120
120
|
};
|
|
121
121
|
})() : {
|
|
122
|
-
ref:
|
|
123
|
-
onBlur: (
|
|
124
|
-
|
|
122
|
+
ref: S,
|
|
123
|
+
onBlur: ($) => {
|
|
124
|
+
M(!1), v && v($);
|
|
125
125
|
},
|
|
126
126
|
onChange: X
|
|
127
127
|
},
|
|
128
|
-
...
|
|
128
|
+
...s
|
|
129
129
|
}
|
|
130
|
-
),
|
|
130
|
+
), o && /* @__PURE__ */ t.createElement(
|
|
131
131
|
"label",
|
|
132
132
|
{
|
|
133
|
-
htmlFor:
|
|
134
|
-
className:
|
|
133
|
+
htmlFor: s.id || e,
|
|
134
|
+
className: i(
|
|
135
135
|
"absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",
|
|
136
136
|
J ? "top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white" : "top-3 scale-100 translate-y-0.5"
|
|
137
137
|
)
|
|
138
138
|
},
|
|
139
|
-
|
|
140
|
-
), r === "password" && /* @__PURE__ */
|
|
139
|
+
o
|
|
140
|
+
), r === "password" && /* @__PURE__ */ t.createElement(
|
|
141
141
|
"button",
|
|
142
142
|
{
|
|
143
143
|
type: "button",
|
|
144
144
|
className: "absolute top-1/2 right-3 -translate-y-1/2 text-gray-400 hover:text-[var(--primary,#2563eb)] transition-colors duration-200 focus:outline-none focus:text-[var(--primary,#2563eb)]",
|
|
145
|
-
onClick:
|
|
146
|
-
"aria-label":
|
|
145
|
+
onClick: z,
|
|
146
|
+
"aria-label": y ? "Esconder senha" : "Mostrar senha",
|
|
147
147
|
tabIndex: -1
|
|
148
148
|
},
|
|
149
|
-
|
|
150
|
-
),
|
|
149
|
+
y ? /* @__PURE__ */ t.createElement(O, null) : /* @__PURE__ */ t.createElement(G, null)
|
|
150
|
+
), k && r !== "password" && /* @__PURE__ */ t.createElement(
|
|
151
151
|
"div",
|
|
152
152
|
{
|
|
153
|
-
className:
|
|
153
|
+
className: i(
|
|
154
154
|
"absolute top-1/2 right-3 -translate-y-1/2 text-gray-400 cursor-pointer hover:text-[var(--primary,#2563eb)] transition-colors duration-200",
|
|
155
|
-
|
|
155
|
+
h
|
|
156
156
|
),
|
|
157
|
-
onClick:
|
|
157
|
+
onClick: g
|
|
158
158
|
},
|
|
159
|
-
/* @__PURE__ */
|
|
160
|
-
), V && /* @__PURE__ */
|
|
159
|
+
/* @__PURE__ */ t.createElement(k, null)
|
|
160
|
+
), V && /* @__PURE__ */ t.createElement("span", { className: "text-red-500 text-xs mt-1 block" }, V));
|
|
161
161
|
}
|
|
162
162
|
);
|
|
163
|
-
|
|
164
|
-
const
|
|
163
|
+
He.displayName = "Input";
|
|
164
|
+
const De = t.forwardRef(
|
|
165
165
|
({
|
|
166
|
-
name:
|
|
167
|
-
label:
|
|
166
|
+
name: e,
|
|
167
|
+
label: a,
|
|
168
168
|
options: r,
|
|
169
|
-
className:
|
|
169
|
+
className: o,
|
|
170
170
|
containerClassName: l,
|
|
171
|
-
isClearable:
|
|
172
|
-
searchable:
|
|
173
|
-
filterPlaceholder:
|
|
174
|
-
caseSensitive:
|
|
175
|
-
filterFunction:
|
|
176
|
-
onFocus:
|
|
171
|
+
isClearable: v,
|
|
172
|
+
searchable: d = !1,
|
|
173
|
+
filterPlaceholder: k = "Digite para filtrar...",
|
|
174
|
+
caseSensitive: h = !1,
|
|
175
|
+
filterFunction: g,
|
|
176
|
+
onFocus: u,
|
|
177
177
|
onBlur: x,
|
|
178
|
-
...
|
|
179
|
-
},
|
|
180
|
-
var re,
|
|
181
|
-
const [
|
|
178
|
+
...s
|
|
179
|
+
}, S) => {
|
|
180
|
+
var re, oe, f, A;
|
|
181
|
+
const [L, M] = t.useState(!1), [y, E] = t.useState(!1), [N, C] = t.useState(""), [m, R] = t.useState({
|
|
182
182
|
top: 0,
|
|
183
183
|
left: 0,
|
|
184
184
|
width: 0
|
|
185
|
-
}), F =
|
|
186
|
-
const K =
|
|
185
|
+
}), F = t.useRef(null), I = t.useRef(null), b = ce(), V = b == null ? void 0 : b.control, U = V && e ? de({ control: V, name: e }) : void 0, B = s.value ?? U ?? "", J = (f = (oe = (re = b == null ? void 0 : b.formState) == null ? void 0 : re.errors) == null ? void 0 : oe[e]) == null ? void 0 : f.message, G = g || ((c, W) => {
|
|
186
|
+
const K = h ? c.label : c.label.toLowerCase(), te = h ? W : W.toLowerCase();
|
|
187
187
|
return K.includes(te);
|
|
188
|
-
}),
|
|
189
|
-
if (F.current &&
|
|
190
|
-
const
|
|
191
|
-
let
|
|
192
|
-
if (
|
|
193
|
-
const ae = K -
|
|
194
|
-
ae < Q &&
|
|
195
|
-
const
|
|
196
|
-
H = Math.min(Math.max(H,
|
|
188
|
+
}), O = N.trim() ? r.filter((c) => G(c, N.trim())) : r, z = r.find((c) => c.value === B), X = d && y ? N : (z == null ? void 0 : z.label) || "", T = L || !!B || d && !!N, P = t.useCallback(() => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || window.innerWidth <= 768, []), q = t.useCallback(() => {
|
|
189
|
+
if (F.current && y) {
|
|
190
|
+
const c = F.current.getBoundingClientRect(), W = P(), K = window.innerHeight, te = window.innerWidth, Q = 152;
|
|
191
|
+
let w = c.bottom + 4, H = c.left;
|
|
192
|
+
if (W) {
|
|
193
|
+
const ae = K - c.bottom, p = c.top;
|
|
194
|
+
ae < Q && p > Q && (w = c.top - Q - 4);
|
|
195
|
+
const _ = 16, ee = te - c.width - _;
|
|
196
|
+
H = Math.min(Math.max(H, _), ee);
|
|
197
197
|
} else
|
|
198
|
-
K -
|
|
198
|
+
K - c.bottom < Q && (w = c.top - Q - 4);
|
|
199
199
|
R({
|
|
200
|
-
top:
|
|
200
|
+
top: w,
|
|
201
201
|
left: H,
|
|
202
|
-
width:
|
|
202
|
+
width: c.width
|
|
203
203
|
});
|
|
204
204
|
}
|
|
205
|
-
}, [
|
|
206
|
-
|
|
207
|
-
if (q(),
|
|
208
|
-
const
|
|
209
|
-
return window.addEventListener("resize",
|
|
210
|
-
window.removeEventListener("resize",
|
|
205
|
+
}, [y, P]);
|
|
206
|
+
t.useEffect(() => {
|
|
207
|
+
if (q(), y) {
|
|
208
|
+
const c = () => q(), W = () => q();
|
|
209
|
+
return window.addEventListener("resize", c), window.addEventListener("scroll", W, !0), () => {
|
|
210
|
+
window.removeEventListener("resize", c), window.removeEventListener("scroll", W, !0);
|
|
211
211
|
};
|
|
212
212
|
}
|
|
213
|
-
}, [
|
|
214
|
-
const
|
|
215
|
-
F.current && !F.current.contains(
|
|
213
|
+
}, [y, q]), t.useEffect(() => {
|
|
214
|
+
const c = (W) => {
|
|
215
|
+
F.current && !F.current.contains(W.target) && (E(!1), M(!1));
|
|
216
216
|
};
|
|
217
|
-
return document.addEventListener("mousedown",
|
|
218
|
-
document.removeEventListener("mousedown",
|
|
217
|
+
return document.addEventListener("mousedown", c), () => {
|
|
218
|
+
document.removeEventListener("mousedown", c);
|
|
219
219
|
};
|
|
220
220
|
}, []);
|
|
221
|
-
const
|
|
222
|
-
|
|
223
|
-
}, Y = (
|
|
224
|
-
|
|
225
|
-
}, j = (
|
|
226
|
-
x && x(
|
|
227
|
-
}, D = (
|
|
228
|
-
C(
|
|
229
|
-
},
|
|
230
|
-
if (
|
|
231
|
-
const
|
|
232
|
-
target: { value:
|
|
221
|
+
const $ = () => {
|
|
222
|
+
E((c) => !c), M(!0);
|
|
223
|
+
}, Y = (c) => {
|
|
224
|
+
M(!0), u && u(c);
|
|
225
|
+
}, j = (c) => {
|
|
226
|
+
x && x(c);
|
|
227
|
+
}, D = (c) => {
|
|
228
|
+
C(c.target.value);
|
|
229
|
+
}, le = (c) => {
|
|
230
|
+
if (b && e && b.setValue(e, c), s.onChange) {
|
|
231
|
+
const W = {
|
|
232
|
+
target: { value: c }
|
|
233
233
|
};
|
|
234
|
-
|
|
234
|
+
s.onChange(W);
|
|
235
235
|
}
|
|
236
|
-
|
|
236
|
+
E(!1), M(!1), C("");
|
|
237
237
|
};
|
|
238
|
-
return /* @__PURE__ */
|
|
238
|
+
return /* @__PURE__ */ t.createElement("div", { className: i("relative", l), ref: F }, /* @__PURE__ */ t.createElement(
|
|
239
239
|
"div",
|
|
240
240
|
{
|
|
241
|
-
id:
|
|
241
|
+
id: s.id || e,
|
|
242
242
|
tabIndex: 0,
|
|
243
243
|
role: "button",
|
|
244
244
|
"aria-haspopup": "listbox",
|
|
245
|
-
"aria-expanded":
|
|
246
|
-
className:
|
|
245
|
+
"aria-expanded": y,
|
|
246
|
+
className: i(
|
|
247
247
|
"peer flex items-center h-12 w-full border border-[var(--primary,#2563eb)] rounded-md bg-[var(--input-bg,#fff)] text-[var(--input-text,#222)] px-3 py-3 text-sm transition focus:outline-none focus:border-[var(--primary,#2563eb)] disabled:cursor-not-allowed disabled:opacity-50 appearance-none cursor-pointer relative",
|
|
248
|
-
|
|
248
|
+
o
|
|
249
249
|
),
|
|
250
|
-
onClick:
|
|
251
|
-
onFocus:
|
|
252
|
-
onBlur:
|
|
253
|
-
ref:
|
|
250
|
+
onClick: d ? void 0 : $,
|
|
251
|
+
onFocus: d ? void 0 : Y,
|
|
252
|
+
onBlur: d ? void 0 : j,
|
|
253
|
+
ref: S
|
|
254
254
|
},
|
|
255
|
-
|
|
255
|
+
d ? /* @__PURE__ */ t.createElement(
|
|
256
256
|
"input",
|
|
257
257
|
{
|
|
258
|
-
ref:
|
|
258
|
+
ref: I,
|
|
259
259
|
type: "text",
|
|
260
260
|
value: X,
|
|
261
261
|
onChange: D,
|
|
262
|
-
onFocus:
|
|
263
|
-
|
|
262
|
+
onFocus: d ? (c) => {
|
|
263
|
+
M(!0), E(!0), u && u(c);
|
|
264
264
|
} : void 0,
|
|
265
|
-
onBlur:
|
|
266
|
-
x && x(
|
|
265
|
+
onBlur: d ? (c) => {
|
|
266
|
+
x && x(c);
|
|
267
267
|
} : void 0,
|
|
268
|
-
placeholder:
|
|
269
|
-
className:
|
|
268
|
+
placeholder: a ? "" : k || "Selecione...",
|
|
269
|
+
className: i(
|
|
270
270
|
"w-full bg-transparent border-none outline-none text-sm",
|
|
271
|
-
!
|
|
271
|
+
!B && !N && "text-gray-400"
|
|
272
272
|
)
|
|
273
273
|
}
|
|
274
|
-
) : /* @__PURE__ */
|
|
275
|
-
|
|
274
|
+
) : /* @__PURE__ */ t.createElement("span", { className: i("block truncate", !B && "text-gray-400") }, ((A = r.find((c) => c.value === B)) == null ? void 0 : A.label) || !a && "Selecione..."),
|
|
275
|
+
v && B && /* @__PURE__ */ t.createElement(
|
|
276
276
|
"button",
|
|
277
277
|
{
|
|
278
278
|
type: "button",
|
|
279
279
|
tabIndex: -1,
|
|
280
280
|
"aria-label": "Limpar seleção",
|
|
281
281
|
className: "absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-red-500 bg-transparent p-1 rounded-full focus:outline-none",
|
|
282
|
-
onClick: (
|
|
283
|
-
if (
|
|
284
|
-
const
|
|
282
|
+
onClick: (c) => {
|
|
283
|
+
if (c.stopPropagation(), b && e && b.setValue(e, ""), s.onChange) {
|
|
284
|
+
const W = {
|
|
285
285
|
target: { value: "" }
|
|
286
286
|
};
|
|
287
|
-
|
|
287
|
+
s.onChange(W);
|
|
288
288
|
}
|
|
289
|
-
|
|
289
|
+
E(!1), M(!1);
|
|
290
290
|
}
|
|
291
291
|
},
|
|
292
292
|
"✕"
|
|
293
293
|
)
|
|
294
|
-
),
|
|
294
|
+
), a && /* @__PURE__ */ t.createElement(
|
|
295
295
|
"label",
|
|
296
296
|
{
|
|
297
|
-
htmlFor:
|
|
298
|
-
className:
|
|
297
|
+
htmlFor: s.id || e,
|
|
298
|
+
className: i(
|
|
299
299
|
"absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",
|
|
300
|
-
|
|
300
|
+
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"
|
|
301
301
|
)
|
|
302
302
|
},
|
|
303
|
-
|
|
304
|
-
), /* @__PURE__ */
|
|
303
|
+
a
|
|
304
|
+
), /* @__PURE__ */ t.createElement(
|
|
305
305
|
"div",
|
|
306
306
|
{
|
|
307
|
-
className:
|
|
307
|
+
className: i(
|
|
308
308
|
"absolute left-0 w-full mt-1 rounded-md transition-all duration-200 overflow-hidden",
|
|
309
309
|
"bg-[var(--select-dropdown-bg)] border-[var(--select-dropdown-border)] text-[var(--select-dropdown-text)]",
|
|
310
|
-
|
|
310
|
+
y ? "border max-h-36 opacity-100 scale-100" : "max-h-0 opacity-0 scale-95 pointer-events-none"
|
|
311
311
|
),
|
|
312
312
|
style: {
|
|
313
|
-
maxHeight:
|
|
313
|
+
maxHeight: y ? "9.5rem" : "0",
|
|
314
314
|
// 3 options * 2.5rem + padding
|
|
315
315
|
overflowY: r.length > 3 ? "auto" : "hidden",
|
|
316
316
|
position: "fixed",
|
|
317
317
|
// Use fixed positioning to escape container overflow
|
|
318
|
-
top:
|
|
319
|
-
left:
|
|
320
|
-
width:
|
|
318
|
+
top: y ? `${m.top}px` : "auto",
|
|
319
|
+
left: y ? `${m.left}px` : "auto",
|
|
320
|
+
width: y ? `${m.width}px` : "auto",
|
|
321
321
|
zIndex: 9999,
|
|
322
|
-
boxShadow:
|
|
322
|
+
boxShadow: y ? "var(--select-dropdown-shadow)" : "none"
|
|
323
323
|
}
|
|
324
324
|
},
|
|
325
|
-
|
|
325
|
+
O.length === 0 ? /* @__PURE__ */ t.createElement("div", { className: "px-3 py-2 text-sm text-gray-500 text-center" }, "Nenhuma opção encontrada") : O.map((c) => /* @__PURE__ */ t.createElement(
|
|
326
326
|
"div",
|
|
327
327
|
{
|
|
328
|
-
key:
|
|
329
|
-
className:
|
|
328
|
+
key: c.value,
|
|
329
|
+
className: i(
|
|
330
330
|
"px-3 py-2 cursor-pointer text-sm transition-colors duration-150",
|
|
331
331
|
"hover:bg-[var(--select-dropdown-hover)]",
|
|
332
|
-
|
|
332
|
+
B === c.value && "bg-[var(--select-dropdown-selected)]"
|
|
333
333
|
),
|
|
334
|
-
onMouseDown: () =>
|
|
334
|
+
onMouseDown: () => le(c.value)
|
|
335
335
|
},
|
|
336
|
-
|
|
336
|
+
c.label
|
|
337
337
|
))
|
|
338
|
-
), J && /* @__PURE__ */
|
|
338
|
+
), J && /* @__PURE__ */ t.createElement("span", { className: "text-red-500 text-xs mt-1 block" }, J));
|
|
339
339
|
}
|
|
340
340
|
);
|
|
341
|
-
|
|
342
|
-
const
|
|
341
|
+
De.displayName = "Select";
|
|
342
|
+
const je = t.forwardRef(
|
|
343
343
|
({
|
|
344
|
-
name:
|
|
345
|
-
className:
|
|
344
|
+
name: e,
|
|
345
|
+
className: a,
|
|
346
346
|
label: r,
|
|
347
|
-
onFocus:
|
|
347
|
+
onFocus: o,
|
|
348
348
|
onBlur: l,
|
|
349
|
-
Icon:
|
|
350
|
-
iconClassName:
|
|
351
|
-
iconAction:
|
|
352
|
-
containerClassName:
|
|
353
|
-
rows:
|
|
354
|
-
...
|
|
349
|
+
Icon: v,
|
|
350
|
+
iconClassName: d,
|
|
351
|
+
iconAction: k,
|
|
352
|
+
containerClassName: h,
|
|
353
|
+
rows: g = 4,
|
|
354
|
+
...u
|
|
355
355
|
}, x) => {
|
|
356
|
-
var R, F,
|
|
357
|
-
const [
|
|
358
|
-
return /* @__PURE__ */
|
|
356
|
+
var R, F, I;
|
|
357
|
+
const [s, S] = t.useState(!1), L = ce(), M = L == null ? void 0 : L.control, y = L == null ? void 0 : L.register, E = M && e ? de({ control: M, name: e }) : void 0, N = u.value ?? E ?? "", C = (I = (F = (R = L == null ? void 0 : L.formState) == null ? void 0 : R.errors) == null ? void 0 : F[e]) == null ? void 0 : I.message, m = s || !!N;
|
|
358
|
+
return /* @__PURE__ */ t.createElement("div", { className: i("relative", h) }, /* @__PURE__ */ t.createElement(
|
|
359
359
|
"textarea",
|
|
360
360
|
{
|
|
361
|
-
id:
|
|
362
|
-
rows:
|
|
363
|
-
className:
|
|
361
|
+
id: u.id || e,
|
|
362
|
+
rows: g,
|
|
363
|
+
className: i(
|
|
364
364
|
"peer flex min-h-[80px] w-full border border-[var(--primary,#2563eb)] rounded-md bg-[var(--input-bg,#fff)] text-[var(--input-text,#222)] px-3 pt-6 pb-2 text-sm placeholder-transparent transition focus:outline-none focus:border-[var(--primary,#2563eb)] disabled:cursor-not-allowed disabled:opacity-50 resize-vertical",
|
|
365
|
-
|
|
365
|
+
v ? "pr-12" : "",
|
|
366
366
|
// espaço extra para ícone customizado
|
|
367
|
-
|
|
367
|
+
a
|
|
368
368
|
),
|
|
369
|
-
onFocus: (
|
|
370
|
-
|
|
369
|
+
onFocus: (b) => {
|
|
370
|
+
S(!0), o && o(b);
|
|
371
371
|
},
|
|
372
|
-
...
|
|
373
|
-
const
|
|
372
|
+
...L && e ? (() => {
|
|
373
|
+
const b = y(e), V = b.onBlur;
|
|
374
374
|
return {
|
|
375
|
-
...
|
|
375
|
+
...b,
|
|
376
376
|
ref: (U) => {
|
|
377
|
-
typeof x == "function" ? x(U) : x && (x.current = U),
|
|
377
|
+
typeof x == "function" ? x(U) : x && (x.current = U), b.ref && b.ref(U);
|
|
378
378
|
},
|
|
379
379
|
onBlur: (U) => {
|
|
380
|
-
|
|
380
|
+
S(!1), l && l(U), V && V(U);
|
|
381
381
|
}
|
|
382
382
|
};
|
|
383
383
|
})() : {
|
|
384
384
|
ref: x,
|
|
385
|
-
onBlur: (
|
|
386
|
-
|
|
385
|
+
onBlur: (b) => {
|
|
386
|
+
S(!1), l && l(b);
|
|
387
387
|
}
|
|
388
388
|
},
|
|
389
|
-
...
|
|
389
|
+
...u
|
|
390
390
|
}
|
|
391
|
-
), r && /* @__PURE__ */
|
|
391
|
+
), r && /* @__PURE__ */ t.createElement(
|
|
392
392
|
"label",
|
|
393
393
|
{
|
|
394
|
-
htmlFor:
|
|
395
|
-
className:
|
|
394
|
+
htmlFor: u.id || e,
|
|
395
|
+
className: i(
|
|
396
396
|
"absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",
|
|
397
|
-
|
|
397
|
+
m ? "top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white" : "top-3 scale-100 translate-y-0.5"
|
|
398
398
|
)
|
|
399
399
|
},
|
|
400
400
|
r
|
|
401
|
-
),
|
|
401
|
+
), v && /* @__PURE__ */ t.createElement(
|
|
402
402
|
"div",
|
|
403
403
|
{
|
|
404
|
-
className:
|
|
404
|
+
className: i(
|
|
405
405
|
"absolute top-3 right-3 text-gray-400 cursor-pointer hover:text-[var(--primary,#2563eb)] transition-colors duration-200",
|
|
406
|
-
|
|
406
|
+
d
|
|
407
407
|
),
|
|
408
|
-
onClick:
|
|
408
|
+
onClick: k
|
|
409
409
|
},
|
|
410
|
-
/* @__PURE__ */
|
|
411
|
-
), C && /* @__PURE__ */
|
|
410
|
+
/* @__PURE__ */ t.createElement(v, null)
|
|
411
|
+
), C && /* @__PURE__ */ t.createElement("span", { className: "text-red-500 text-xs mt-1 block" }, C));
|
|
412
412
|
}
|
|
413
413
|
);
|
|
414
|
-
|
|
415
|
-
const
|
|
414
|
+
je.displayName = "Textarea";
|
|
415
|
+
const Ue = t.forwardRef(
|
|
416
416
|
({
|
|
417
|
-
name:
|
|
418
|
-
label:
|
|
417
|
+
name: e,
|
|
418
|
+
label: a,
|
|
419
419
|
loadOptions: r,
|
|
420
|
-
className:
|
|
420
|
+
className: o,
|
|
421
421
|
containerClassName: l,
|
|
422
|
-
isClearable:
|
|
423
|
-
defaultOptions:
|
|
424
|
-
loadingMessage:
|
|
425
|
-
noOptionsMessage:
|
|
426
|
-
searchable:
|
|
427
|
-
debounceMs:
|
|
422
|
+
isClearable: v,
|
|
423
|
+
defaultOptions: d = !1,
|
|
424
|
+
loadingMessage: k = "Carregando...",
|
|
425
|
+
noOptionsMessage: h = "Nenhuma opção encontrada",
|
|
426
|
+
searchable: g = !1,
|
|
427
|
+
debounceMs: u = 300,
|
|
428
428
|
onFocus: x,
|
|
429
|
-
onBlur:
|
|
430
|
-
...
|
|
431
|
-
},
|
|
429
|
+
onBlur: s,
|
|
430
|
+
...S
|
|
431
|
+
}, L) => {
|
|
432
432
|
var K, te, Q;
|
|
433
|
-
const [
|
|
433
|
+
const [M, y] = t.useState(!1), [E, N] = t.useState(!1), [C, m] = t.useState([]), [R, F] = t.useState(!1), [I, b] = t.useState(""), [V, U] = t.useState(""), [B, J] = t.useState({
|
|
434
434
|
top: 0,
|
|
435
435
|
left: 0,
|
|
436
436
|
width: 0
|
|
437
|
-
}), Z =
|
|
438
|
-
if (Z.current &&
|
|
439
|
-
const
|
|
440
|
-
let ee =
|
|
437
|
+
}), Z = t.useRef(null), G = t.useRef(null), O = ce(), z = O == null ? void 0 : O.control, X = z && e ? de({ control: z, name: e }) : void 0, T = S.value ?? X ?? "", P = (Q = (te = (K = O == null ? void 0 : O.formState) == null ? void 0 : K.errors) == null ? void 0 : te[e]) == null ? void 0 : Q.message, q = M || !!T, $ = t.useCallback(() => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || window.innerWidth <= 768, []), Y = t.useCallback(() => {
|
|
438
|
+
if (Z.current && E) {
|
|
439
|
+
const w = Z.current.getBoundingClientRect(), H = $(), ae = window.innerHeight, p = window.innerWidth, _ = 152;
|
|
440
|
+
let ee = w.bottom + 4, ie = w.left;
|
|
441
441
|
if (H) {
|
|
442
|
-
const se = ae -
|
|
443
|
-
se <
|
|
444
|
-
const ue = 16,
|
|
445
|
-
ie = Math.min(Math.max(ie, ue),
|
|
442
|
+
const se = ae - w.bottom, me = w.top;
|
|
443
|
+
se < _ && me > _ && (ee = w.top - _ - 4);
|
|
444
|
+
const ue = 16, fe = p - w.width - ue;
|
|
445
|
+
ie = Math.min(Math.max(ie, ue), fe);
|
|
446
446
|
} else
|
|
447
|
-
ae -
|
|
447
|
+
ae - w.bottom < _ && (ee = w.top - _ - 4);
|
|
448
448
|
J({
|
|
449
449
|
top: ee,
|
|
450
450
|
left: ie,
|
|
451
|
-
width:
|
|
451
|
+
width: w.width
|
|
452
452
|
});
|
|
453
453
|
}
|
|
454
|
-
}, [
|
|
455
|
-
|
|
456
|
-
if (Y(),
|
|
457
|
-
const
|
|
458
|
-
return window.addEventListener("resize",
|
|
459
|
-
window.removeEventListener("resize",
|
|
454
|
+
}, [E, $]);
|
|
455
|
+
t.useEffect(() => {
|
|
456
|
+
if (Y(), E) {
|
|
457
|
+
const w = () => Y(), H = () => Y();
|
|
458
|
+
return window.addEventListener("resize", w), window.addEventListener("scroll", H, !0), () => {
|
|
459
|
+
window.removeEventListener("resize", w), window.removeEventListener("scroll", H, !0);
|
|
460
460
|
};
|
|
461
461
|
}
|
|
462
|
-
}, [
|
|
463
|
-
const
|
|
464
|
-
U(
|
|
465
|
-
},
|
|
466
|
-
return () => clearTimeout(
|
|
467
|
-
}, [
|
|
468
|
-
(
|
|
469
|
-
}, [V,
|
|
470
|
-
|
|
462
|
+
}, [E, Y]), t.useEffect(() => {
|
|
463
|
+
const w = setTimeout(() => {
|
|
464
|
+
U(I);
|
|
465
|
+
}, u);
|
|
466
|
+
return () => clearTimeout(w);
|
|
467
|
+
}, [I, u]), t.useEffect(() => {
|
|
468
|
+
(E || d && C.length === 0) && j(g ? V : void 0);
|
|
469
|
+
}, [V, E]), t.useEffect(() => {
|
|
470
|
+
d === !0 ? j() : Array.isArray(d) && m(d);
|
|
471
471
|
}, []);
|
|
472
|
-
const j = async (
|
|
472
|
+
const j = async (w) => {
|
|
473
473
|
try {
|
|
474
474
|
F(!0);
|
|
475
|
-
const H = await r(
|
|
476
|
-
|
|
475
|
+
const H = await r(w);
|
|
476
|
+
m(H);
|
|
477
477
|
} catch (H) {
|
|
478
|
-
console.error("Error loading options:", H),
|
|
478
|
+
console.error("Error loading options:", H), m([]);
|
|
479
479
|
} finally {
|
|
480
480
|
F(!1);
|
|
481
481
|
}
|
|
482
482
|
};
|
|
483
|
-
|
|
484
|
-
const
|
|
485
|
-
Z.current && !Z.current.contains(H.target) && (
|
|
483
|
+
t.useEffect(() => {
|
|
484
|
+
const w = (H) => {
|
|
485
|
+
Z.current && !Z.current.contains(H.target) && (N(!1), y(!1), b(""));
|
|
486
486
|
};
|
|
487
|
-
return document.addEventListener("mousedown",
|
|
488
|
-
document.removeEventListener("mousedown",
|
|
487
|
+
return document.addEventListener("mousedown", w), () => {
|
|
488
|
+
document.removeEventListener("mousedown", w);
|
|
489
489
|
};
|
|
490
490
|
}, []);
|
|
491
491
|
const D = () => {
|
|
492
|
-
|
|
493
|
-
var
|
|
494
|
-
return (
|
|
492
|
+
E || (N(!0), y(!0), g && G.current && setTimeout(() => {
|
|
493
|
+
var w;
|
|
494
|
+
return (w = G.current) == null ? void 0 : w.focus();
|
|
495
495
|
}, 0));
|
|
496
|
-
},
|
|
497
|
-
|
|
498
|
-
}, re = (
|
|
499
|
-
|
|
500
|
-
},
|
|
501
|
-
|
|
502
|
-
},
|
|
503
|
-
if (
|
|
496
|
+
}, le = (w) => {
|
|
497
|
+
y(!0), x && x(w);
|
|
498
|
+
}, re = (w) => {
|
|
499
|
+
s && s(w);
|
|
500
|
+
}, oe = (w) => {
|
|
501
|
+
b(w.target.value);
|
|
502
|
+
}, f = (w) => {
|
|
503
|
+
if (O && e && O.setValue(e, w), S.onChange) {
|
|
504
504
|
const H = {
|
|
505
|
-
target: { value:
|
|
505
|
+
target: { value: w }
|
|
506
506
|
};
|
|
507
|
-
|
|
507
|
+
S.onChange(H);
|
|
508
508
|
}
|
|
509
|
-
|
|
510
|
-
},
|
|
511
|
-
if (
|
|
509
|
+
N(!1), y(!1), b("");
|
|
510
|
+
}, A = (w) => {
|
|
511
|
+
if (w.stopPropagation(), O && e && O.setValue(e, ""), S.onChange) {
|
|
512
512
|
const H = {
|
|
513
513
|
target: { value: "" }
|
|
514
514
|
};
|
|
515
|
-
|
|
515
|
+
S.onChange(H);
|
|
516
516
|
}
|
|
517
|
-
|
|
518
|
-
},
|
|
519
|
-
return /* @__PURE__ */
|
|
517
|
+
N(!1), y(!1), b("");
|
|
518
|
+
}, c = C.find((w) => w.value === T), W = g && E ? I : (c == null ? void 0 : c.label) || "";
|
|
519
|
+
return /* @__PURE__ */ t.createElement("div", { className: i("relative", l), ref: Z }, /* @__PURE__ */ t.createElement(
|
|
520
520
|
"div",
|
|
521
521
|
{
|
|
522
|
-
id:
|
|
523
|
-
tabIndex:
|
|
522
|
+
id: S.id || e,
|
|
523
|
+
tabIndex: g ? -1 : 0,
|
|
524
524
|
role: "button",
|
|
525
525
|
"aria-haspopup": "listbox",
|
|
526
|
-
"aria-expanded":
|
|
527
|
-
className:
|
|
526
|
+
"aria-expanded": E,
|
|
527
|
+
className: i(
|
|
528
528
|
"peer flex items-center h-12 w-full border border-[var(--primary,#2563eb)] rounded-md bg-[var(--input-bg,#fff)] text-[var(--input-text,#222)] px-3 py-3 text-sm transition focus:outline-none focus:border-[var(--primary,#2563eb)] disabled:cursor-not-allowed disabled:opacity-50 appearance-none cursor-pointer relative",
|
|
529
|
-
|
|
529
|
+
o
|
|
530
530
|
),
|
|
531
531
|
onClick: D,
|
|
532
|
-
onFocus:
|
|
533
|
-
onBlur:
|
|
534
|
-
ref:
|
|
532
|
+
onFocus: g ? void 0 : le,
|
|
533
|
+
onBlur: g ? void 0 : re,
|
|
534
|
+
ref: L
|
|
535
535
|
},
|
|
536
|
-
|
|
536
|
+
g ? /* @__PURE__ */ t.createElement(
|
|
537
537
|
"input",
|
|
538
538
|
{
|
|
539
539
|
ref: G,
|
|
540
540
|
type: "text",
|
|
541
|
-
value:
|
|
542
|
-
onChange:
|
|
543
|
-
onFocus:
|
|
541
|
+
value: W,
|
|
542
|
+
onChange: oe,
|
|
543
|
+
onFocus: le,
|
|
544
544
|
onBlur: re,
|
|
545
|
-
placeholder:
|
|
546
|
-
className:
|
|
545
|
+
placeholder: a ? "" : "Selecione...",
|
|
546
|
+
className: i(
|
|
547
547
|
"w-full bg-transparent border-none outline-none text-sm",
|
|
548
|
-
!
|
|
548
|
+
!T && !I && "text-gray-400"
|
|
549
549
|
)
|
|
550
550
|
}
|
|
551
|
-
) : /* @__PURE__ */
|
|
552
|
-
R && /* @__PURE__ */
|
|
553
|
-
|
|
551
|
+
) : /* @__PURE__ */ t.createElement("span", { className: i("block truncate", !T && "text-gray-400") }, (c == null ? void 0 : c.label) || !a && "Selecione..."),
|
|
552
|
+
R && /* @__PURE__ */ t.createElement("div", { className: "absolute right-8 top-1/2 -translate-y-1/2" }, /* @__PURE__ */ t.createElement("div", { className: "animate-spin rounded-full h-4 w-4 border-b-2 border-[var(--primary,#2563eb)]" })),
|
|
553
|
+
v && T && !R && /* @__PURE__ */ t.createElement(
|
|
554
554
|
"button",
|
|
555
555
|
{
|
|
556
556
|
type: "button",
|
|
557
557
|
tabIndex: -1,
|
|
558
558
|
"aria-label": "Limpar seleção",
|
|
559
559
|
className: "absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-red-500 bg-transparent p-1 rounded-full focus:outline-none",
|
|
560
|
-
onClick:
|
|
560
|
+
onClick: A
|
|
561
561
|
},
|
|
562
562
|
"✕"
|
|
563
563
|
)
|
|
564
|
-
),
|
|
564
|
+
), a && /* @__PURE__ */ t.createElement(
|
|
565
565
|
"label",
|
|
566
566
|
{
|
|
567
|
-
htmlFor:
|
|
568
|
-
className:
|
|
567
|
+
htmlFor: S.id || e,
|
|
568
|
+
className: i(
|
|
569
569
|
"absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",
|
|
570
570
|
q ? "top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white" : "top-3 scale-100 translate-y-0.5"
|
|
571
571
|
)
|
|
572
572
|
},
|
|
573
|
-
|
|
574
|
-
), /* @__PURE__ */
|
|
573
|
+
a
|
|
574
|
+
), /* @__PURE__ */ t.createElement(
|
|
575
575
|
"div",
|
|
576
576
|
{
|
|
577
|
-
className:
|
|
577
|
+
className: i(
|
|
578
578
|
"absolute left-0 w-full mt-1 rounded-md transition-all duration-200 overflow-hidden",
|
|
579
579
|
"bg-[var(--select-dropdown-bg)] border-[var(--select-dropdown-border)] text-[var(--select-dropdown-text)]",
|
|
580
|
-
|
|
580
|
+
E ? "border max-h-36 opacity-100 scale-100" : "max-h-0 opacity-0 scale-95 pointer-events-none"
|
|
581
581
|
),
|
|
582
582
|
style: {
|
|
583
|
-
maxHeight:
|
|
583
|
+
maxHeight: E ? "9.5rem" : "0",
|
|
584
584
|
overflowY: C.length > 3 ? "auto" : "hidden",
|
|
585
585
|
position: "fixed",
|
|
586
586
|
// Use fixed positioning to escape container overflow
|
|
587
|
-
top:
|
|
588
|
-
left:
|
|
589
|
-
width:
|
|
587
|
+
top: E ? `${B.top}px` : "auto",
|
|
588
|
+
left: E ? `${B.left}px` : "auto",
|
|
589
|
+
width: E ? `${B.width}px` : "auto",
|
|
590
590
|
zIndex: 9999,
|
|
591
|
-
boxShadow:
|
|
591
|
+
boxShadow: E ? "var(--select-dropdown-shadow)" : "none"
|
|
592
592
|
}
|
|
593
593
|
},
|
|
594
|
-
R ? /* @__PURE__ */
|
|
594
|
+
R ? /* @__PURE__ */ t.createElement("div", { className: "px-3 py-2 text-sm text-gray-500 text-center" }, k) : C.length === 0 ? /* @__PURE__ */ t.createElement("div", { className: "px-3 py-2 text-sm text-gray-500 text-center" }, h) : C.map((w) => /* @__PURE__ */ t.createElement(
|
|
595
595
|
"div",
|
|
596
596
|
{
|
|
597
|
-
key:
|
|
598
|
-
className:
|
|
597
|
+
key: w.value,
|
|
598
|
+
className: i(
|
|
599
599
|
"px-3 py-2 cursor-pointer text-sm transition-colors duration-150",
|
|
600
600
|
"hover:bg-[var(--select-dropdown-hover)]",
|
|
601
|
-
|
|
601
|
+
T === w.value && "bg-[var(--select-dropdown-selected)]"
|
|
602
602
|
),
|
|
603
|
-
onMouseDown: () =>
|
|
603
|
+
onMouseDown: () => f(w.value)
|
|
604
604
|
},
|
|
605
|
-
|
|
605
|
+
w.label
|
|
606
606
|
))
|
|
607
|
-
), P && /* @__PURE__ */
|
|
607
|
+
), P && /* @__PURE__ */ t.createElement("span", { className: "text-red-500 text-xs mt-1 block" }, P));
|
|
608
608
|
}
|
|
609
609
|
);
|
|
610
|
-
|
|
611
|
-
const
|
|
610
|
+
Ue.displayName = "AsyncSelect";
|
|
611
|
+
const Ye = t.forwardRef(
|
|
612
612
|
({
|
|
613
|
-
name:
|
|
614
|
-
label:
|
|
613
|
+
name: e,
|
|
614
|
+
label: a,
|
|
615
615
|
options: r,
|
|
616
|
-
className:
|
|
616
|
+
className: o,
|
|
617
617
|
containerClassName: l,
|
|
618
|
-
isClearable:
|
|
619
|
-
searchable:
|
|
620
|
-
filterPlaceholder:
|
|
621
|
-
caseSensitive:
|
|
622
|
-
filterFunction:
|
|
623
|
-
onFocus:
|
|
618
|
+
isClearable: v,
|
|
619
|
+
searchable: d = !1,
|
|
620
|
+
filterPlaceholder: k = "Digite para filtrar...",
|
|
621
|
+
caseSensitive: h = !1,
|
|
622
|
+
filterFunction: g,
|
|
623
|
+
onFocus: u,
|
|
624
624
|
onBlur: x,
|
|
625
|
-
...
|
|
626
|
-
},
|
|
627
|
-
var
|
|
628
|
-
const [
|
|
625
|
+
...s
|
|
626
|
+
}, S) => {
|
|
627
|
+
var le, re, oe;
|
|
628
|
+
const [L, M] = t.useState(!1), [y, E] = t.useState(!1), [N, C] = t.useState(""), [m, R] = t.useState({
|
|
629
629
|
top: 0,
|
|
630
630
|
left: 0,
|
|
631
631
|
width: 0
|
|
632
|
-
}), F =
|
|
633
|
-
const
|
|
634
|
-
return
|
|
635
|
-
}),
|
|
636
|
-
if (F.current &&
|
|
637
|
-
const
|
|
638
|
-
let te =
|
|
639
|
-
if (
|
|
640
|
-
const
|
|
641
|
-
|
|
642
|
-
const ae = 16,
|
|
643
|
-
Q = Math.min(Math.max(Q, ae),
|
|
632
|
+
}), F = t.useRef(null), I = t.useRef(null), b = ce(), V = b == null ? void 0 : b.control, U = V && e ? de({ control: V, name: e }) : void 0, B = s.value ?? U ?? [], J = (oe = (re = (le = b == null ? void 0 : b.formState) == null ? void 0 : le.errors) == null ? void 0 : re[e]) == null ? void 0 : oe.message, G = g || ((f, A) => {
|
|
633
|
+
const c = h ? f.label : f.label.toLowerCase(), W = h ? A : A.toLowerCase();
|
|
634
|
+
return c.includes(W);
|
|
635
|
+
}), O = N.trim() ? r.filter((f) => G(f, N.trim())) : r, z = L || B && B.length > 0 || d && !!N, X = t.useCallback(() => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || window.innerWidth <= 768, []), T = t.useCallback(() => {
|
|
636
|
+
if (F.current && y) {
|
|
637
|
+
const f = F.current.getBoundingClientRect(), A = X(), c = window.innerHeight, W = window.innerWidth, K = 152;
|
|
638
|
+
let te = f.bottom + 4, Q = f.left;
|
|
639
|
+
if (A) {
|
|
640
|
+
const w = c - f.bottom, H = f.top;
|
|
641
|
+
w < K && H > K && (te = f.top - K - 4);
|
|
642
|
+
const ae = 16, p = W - f.width - ae;
|
|
643
|
+
Q = Math.min(Math.max(Q, ae), p);
|
|
644
644
|
} else
|
|
645
|
-
|
|
645
|
+
c - f.bottom < K && (te = f.top - K - 4);
|
|
646
646
|
R({
|
|
647
647
|
top: te,
|
|
648
648
|
left: Q,
|
|
649
|
-
width:
|
|
649
|
+
width: f.width
|
|
650
650
|
});
|
|
651
651
|
}
|
|
652
|
-
}, [
|
|
653
|
-
|
|
654
|
-
if (
|
|
655
|
-
const
|
|
656
|
-
return window.addEventListener("resize",
|
|
657
|
-
window.removeEventListener("resize",
|
|
652
|
+
}, [y, X]);
|
|
653
|
+
t.useEffect(() => {
|
|
654
|
+
if (T(), y) {
|
|
655
|
+
const f = () => T(), A = () => T();
|
|
656
|
+
return window.addEventListener("resize", f), window.addEventListener("scroll", A, !0), () => {
|
|
657
|
+
window.removeEventListener("resize", f), window.removeEventListener("scroll", A, !0);
|
|
658
658
|
};
|
|
659
659
|
}
|
|
660
|
-
}, [
|
|
661
|
-
const
|
|
662
|
-
F.current && !F.current.contains(
|
|
660
|
+
}, [y, T]), t.useEffect(() => {
|
|
661
|
+
const f = (A) => {
|
|
662
|
+
F.current && !F.current.contains(A.target) && (E(!1), M(!1));
|
|
663
663
|
};
|
|
664
|
-
return document.addEventListener("mousedown",
|
|
665
|
-
document.removeEventListener("mousedown",
|
|
664
|
+
return document.addEventListener("mousedown", f), () => {
|
|
665
|
+
document.removeEventListener("mousedown", f);
|
|
666
666
|
};
|
|
667
667
|
}, []);
|
|
668
668
|
const P = () => {
|
|
669
|
-
|
|
670
|
-
}, q = (
|
|
671
|
-
|
|
672
|
-
},
|
|
673
|
-
x && x(
|
|
674
|
-
}, Y = (
|
|
675
|
-
var
|
|
676
|
-
let
|
|
677
|
-
|
|
678
|
-
target: { value:
|
|
679
|
-
})),
|
|
680
|
-
}, j = (
|
|
681
|
-
var
|
|
682
|
-
|
|
669
|
+
E((f) => !f), M(!0);
|
|
670
|
+
}, q = (f) => {
|
|
671
|
+
M(!0), u && u(f);
|
|
672
|
+
}, $ = (f) => {
|
|
673
|
+
x && x(f);
|
|
674
|
+
}, Y = (f) => {
|
|
675
|
+
var c;
|
|
676
|
+
let A;
|
|
677
|
+
B.includes(f) ? A = B.filter((W) => W !== f) : A = [...B, f], b && e && b.setValue(e, A), s.onChange && ((c = s.onChange) == null || c.call(s, {
|
|
678
|
+
target: { value: A }
|
|
679
|
+
})), M(!0);
|
|
680
|
+
}, j = (f) => {
|
|
681
|
+
var A;
|
|
682
|
+
f.stopPropagation(), b && e && b.setValue(e, []), s.onChange && ((A = s.onChange) == null || A.call(s, {
|
|
683
683
|
target: { value: [] }
|
|
684
|
-
})),
|
|
685
|
-
}, D = (
|
|
686
|
-
C(
|
|
684
|
+
})), E(!1), M(!1);
|
|
685
|
+
}, D = (f) => {
|
|
686
|
+
C(f.target.value);
|
|
687
687
|
};
|
|
688
|
-
return /* @__PURE__ */
|
|
688
|
+
return /* @__PURE__ */ t.createElement("div", { className: i("relative", l), ref: F }, /* @__PURE__ */ t.createElement(
|
|
689
689
|
"div",
|
|
690
690
|
{
|
|
691
|
-
id:
|
|
691
|
+
id: s.id || e,
|
|
692
692
|
tabIndex: 0,
|
|
693
693
|
role: "button",
|
|
694
694
|
"aria-haspopup": "listbox",
|
|
695
|
-
"aria-expanded":
|
|
696
|
-
className:
|
|
695
|
+
"aria-expanded": y,
|
|
696
|
+
className: i(
|
|
697
697
|
"peer flex items-center h-12 w-full border border-[var(--primary,#2563eb)] rounded-md bg-[var(--input-bg,#fff)] text-[var(--input-text,#222)] px-3 py-3 text-sm transition focus:outline-none focus:border-[var(--primary,#2563eb)] disabled:cursor-not-allowed disabled:opacity-50 appearance-none cursor-pointer relative",
|
|
698
|
-
|
|
698
|
+
o
|
|
699
699
|
),
|
|
700
|
-
onClick:
|
|
701
|
-
onFocus:
|
|
702
|
-
onBlur:
|
|
703
|
-
ref:
|
|
700
|
+
onClick: d ? void 0 : P,
|
|
701
|
+
onFocus: d ? void 0 : q,
|
|
702
|
+
onBlur: d ? void 0 : $,
|
|
703
|
+
ref: S
|
|
704
704
|
},
|
|
705
|
-
/* @__PURE__ */
|
|
705
|
+
/* @__PURE__ */ t.createElement(
|
|
706
706
|
"div",
|
|
707
707
|
{
|
|
708
708
|
className: "flex flex-nowrap gap-1 items-center min-h-[1.5rem] w-full overflow-x-auto",
|
|
709
709
|
style: { scrollbarWidth: "none" }
|
|
710
710
|
},
|
|
711
|
-
|
|
711
|
+
B && B.length > 0 ? r.filter((f) => B.includes(f.value)).map((f) => /* @__PURE__ */ t.createElement(
|
|
712
712
|
"span",
|
|
713
713
|
{
|
|
714
|
-
key:
|
|
714
|
+
key: f.value,
|
|
715
715
|
className: "flex items-center border border-blue-200 bg-blue-50 text-blue-700 rounded-2xl px-3 py-1 text-xs shadow-sm mr-1 gap-2",
|
|
716
716
|
style: { maxWidth: "140px" }
|
|
717
717
|
},
|
|
718
|
-
/* @__PURE__ */
|
|
719
|
-
/* @__PURE__ */
|
|
718
|
+
/* @__PURE__ */ t.createElement("span", { className: "truncate", title: f.label }, f.label),
|
|
719
|
+
/* @__PURE__ */ t.createElement(
|
|
720
720
|
"button",
|
|
721
721
|
{
|
|
722
722
|
type: "button",
|
|
723
723
|
className: "ml-1 text-[var(--primary,#2563eb)] hover:text-red-500 focus:outline-none w-4 h-4 flex items-center justify-center rounded-full transition-colors duration-150",
|
|
724
|
-
"aria-label": `Remover ${
|
|
724
|
+
"aria-label": `Remover ${f.label}`,
|
|
725
725
|
tabIndex: -1,
|
|
726
|
-
onClick: (
|
|
727
|
-
|
|
728
|
-
const
|
|
729
|
-
|
|
730
|
-
target: { value:
|
|
726
|
+
onClick: (A) => {
|
|
727
|
+
A.stopPropagation();
|
|
728
|
+
const c = B.filter((W) => W !== f.value);
|
|
729
|
+
b && e && b.setValue(e, c), s.onChange && s.onChange({
|
|
730
|
+
target: { value: c }
|
|
731
731
|
});
|
|
732
732
|
}
|
|
733
733
|
},
|
|
734
|
-
/* @__PURE__ */
|
|
734
|
+
/* @__PURE__ */ t.createElement(
|
|
735
735
|
"svg",
|
|
736
736
|
{
|
|
737
737
|
width: "12",
|
|
@@ -740,7 +740,7 @@ const Ve = e.forwardRef(
|
|
|
740
740
|
fill: "none",
|
|
741
741
|
xmlns: "http://www.w3.org/2000/svg"
|
|
742
742
|
},
|
|
743
|
-
/* @__PURE__ */
|
|
743
|
+
/* @__PURE__ */ t.createElement(
|
|
744
744
|
"path",
|
|
745
745
|
{
|
|
746
746
|
d: "M3 3L9 9M9 3L3 9",
|
|
@@ -751,26 +751,26 @@ const Ve = e.forwardRef(
|
|
|
751
751
|
)
|
|
752
752
|
)
|
|
753
753
|
)
|
|
754
|
-
)) : !
|
|
755
|
-
|
|
754
|
+
)) : !a && !d && /* @__PURE__ */ t.createElement("span", { className: "text-gray-400 text-sm" }, "Selecione..."),
|
|
755
|
+
d && /* @__PURE__ */ t.createElement(
|
|
756
756
|
"input",
|
|
757
757
|
{
|
|
758
|
-
ref:
|
|
758
|
+
ref: I,
|
|
759
759
|
type: "text",
|
|
760
|
-
value:
|
|
760
|
+
value: N,
|
|
761
761
|
onChange: D,
|
|
762
|
-
onFocus: (
|
|
763
|
-
|
|
762
|
+
onFocus: (f) => {
|
|
763
|
+
M(!0), E(!0), u && u(f);
|
|
764
764
|
},
|
|
765
|
-
onBlur: (
|
|
766
|
-
x && x(
|
|
765
|
+
onBlur: (f) => {
|
|
766
|
+
x && x(f);
|
|
767
767
|
},
|
|
768
|
-
placeholder:
|
|
768
|
+
placeholder: a ? B && B.length > 0 ? "" : k : k || "Selecione...",
|
|
769
769
|
className: "flex-1 bg-transparent border-none outline-none text-sm min-w-[100px]"
|
|
770
770
|
}
|
|
771
771
|
)
|
|
772
772
|
),
|
|
773
|
-
|
|
773
|
+
v && B && B.length > 0 && /* @__PURE__ */ t.createElement(
|
|
774
774
|
"button",
|
|
775
775
|
{
|
|
776
776
|
type: "button",
|
|
@@ -781,201 +781,201 @@ const Ve = e.forwardRef(
|
|
|
781
781
|
},
|
|
782
782
|
"✕"
|
|
783
783
|
)
|
|
784
|
-
),
|
|
784
|
+
), a && /* @__PURE__ */ t.createElement(
|
|
785
785
|
"label",
|
|
786
786
|
{
|
|
787
|
-
htmlFor:
|
|
788
|
-
className:
|
|
787
|
+
htmlFor: s.id || e,
|
|
788
|
+
className: i(
|
|
789
789
|
"absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",
|
|
790
|
-
|
|
790
|
+
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"
|
|
791
791
|
)
|
|
792
792
|
},
|
|
793
|
-
|
|
794
|
-
), /* @__PURE__ */
|
|
793
|
+
a
|
|
794
|
+
), /* @__PURE__ */ t.createElement(
|
|
795
795
|
"div",
|
|
796
796
|
{
|
|
797
|
-
className:
|
|
797
|
+
className: i(
|
|
798
798
|
"absolute left-0 w-full mt-1 rounded-md transition-all duration-200 overflow-hidden",
|
|
799
799
|
"bg-[var(--select-dropdown-bg)] border-[var(--select-dropdown-border)] text-[var(--select-dropdown-text)]",
|
|
800
|
-
|
|
800
|
+
y ? "border max-h-36 opacity-100 scale-100" : "max-h-0 opacity-0 scale-95 pointer-events-none"
|
|
801
801
|
),
|
|
802
802
|
style: {
|
|
803
|
-
maxHeight:
|
|
803
|
+
maxHeight: y ? "9.5rem" : "0",
|
|
804
804
|
overflowY: r.length > 3 ? "auto" : "hidden",
|
|
805
805
|
position: "fixed",
|
|
806
806
|
// Use fixed positioning to escape container overflow
|
|
807
|
-
top:
|
|
808
|
-
left:
|
|
809
|
-
width:
|
|
807
|
+
top: y ? `${m.top}px` : "auto",
|
|
808
|
+
left: y ? `${m.left}px` : "auto",
|
|
809
|
+
width: y ? `${m.width}px` : "auto",
|
|
810
810
|
zIndex: 9999,
|
|
811
|
-
boxShadow:
|
|
811
|
+
boxShadow: y ? "var(--select-dropdown-shadow)" : "none"
|
|
812
812
|
}
|
|
813
813
|
},
|
|
814
|
-
|
|
814
|
+
O.length === 0 ? /* @__PURE__ */ t.createElement("div", { className: "px-3 py-2 text-sm text-gray-500 text-center" }, "Nenhuma opção encontrada") : O.map((f) => /* @__PURE__ */ t.createElement(
|
|
815
815
|
"div",
|
|
816
816
|
{
|
|
817
|
-
key:
|
|
818
|
-
className:
|
|
817
|
+
key: f.value,
|
|
818
|
+
className: i(
|
|
819
819
|
"px-3 py-2 cursor-pointer text-sm flex items-center gap-2 transition-colors duration-150",
|
|
820
820
|
"hover:bg-[var(--select-dropdown-hover)]",
|
|
821
|
-
|
|
821
|
+
B.includes(f.value) && "bg-[var(--select-dropdown-selected)] font-semibold"
|
|
822
822
|
),
|
|
823
|
-
onMouseDown: () => Y(
|
|
823
|
+
onMouseDown: () => Y(f.value)
|
|
824
824
|
},
|
|
825
|
-
/* @__PURE__ */
|
|
825
|
+
/* @__PURE__ */ t.createElement(
|
|
826
826
|
"input",
|
|
827
827
|
{
|
|
828
828
|
type: "checkbox",
|
|
829
|
-
checked:
|
|
829
|
+
checked: B.includes(f.value),
|
|
830
830
|
readOnly: !0,
|
|
831
831
|
className: "accent-blue-500"
|
|
832
832
|
}
|
|
833
833
|
),
|
|
834
|
-
|
|
834
|
+
f.label
|
|
835
835
|
))
|
|
836
|
-
), J && /* @__PURE__ */
|
|
836
|
+
), J && /* @__PURE__ */ t.createElement("span", { className: "text-red-500 text-xs mt-1 block" }, J));
|
|
837
837
|
}
|
|
838
838
|
);
|
|
839
|
-
|
|
840
|
-
const
|
|
839
|
+
Ye.displayName = "MultiSelect";
|
|
840
|
+
const Ge = t.forwardRef(
|
|
841
841
|
({
|
|
842
|
-
name:
|
|
843
|
-
label:
|
|
842
|
+
name: e,
|
|
843
|
+
label: a,
|
|
844
844
|
loadOptions: r,
|
|
845
|
-
className:
|
|
845
|
+
className: o,
|
|
846
846
|
containerClassName: l,
|
|
847
|
-
isClearable:
|
|
848
|
-
defaultOptions:
|
|
849
|
-
loadingMessage:
|
|
850
|
-
noOptionsMessage:
|
|
851
|
-
searchable:
|
|
852
|
-
debounceMs:
|
|
847
|
+
isClearable: v,
|
|
848
|
+
defaultOptions: d = !1,
|
|
849
|
+
loadingMessage: k = "Carregando...",
|
|
850
|
+
noOptionsMessage: h = "Nenhuma opção encontrada",
|
|
851
|
+
searchable: g = !1,
|
|
852
|
+
debounceMs: u = 300,
|
|
853
853
|
maxSelectedDisplay: x = 3,
|
|
854
|
-
onFocus:
|
|
855
|
-
onBlur:
|
|
856
|
-
...
|
|
857
|
-
},
|
|
858
|
-
var
|
|
859
|
-
const [
|
|
854
|
+
onFocus: s,
|
|
855
|
+
onBlur: S,
|
|
856
|
+
...L
|
|
857
|
+
}, M) => {
|
|
858
|
+
var w, H, ae;
|
|
859
|
+
const [y, E] = t.useState(!1), [N, C] = t.useState(!1), [m, R] = t.useState([]), [F, I] = t.useState(!1), [b, V] = t.useState(""), [U, B] = t.useState(""), [J, Z] = t.useState({
|
|
860
860
|
top: 0,
|
|
861
861
|
left: 0,
|
|
862
862
|
width: 0
|
|
863
|
-
}), G =
|
|
864
|
-
if (G.current &&
|
|
865
|
-
const
|
|
866
|
-
let
|
|
867
|
-
if (
|
|
868
|
-
const
|
|
869
|
-
|
|
870
|
-
const
|
|
871
|
-
ue = Math.min(Math.max(ue,
|
|
863
|
+
}), G = t.useRef(null), O = t.useRef(null), z = ce(), X = z == null ? void 0 : z.control, T = X && e ? de({ control: X, name: e }) : void 0, P = L.value ?? T ?? [], q = (ae = (H = (w = z == null ? void 0 : z.formState) == null ? void 0 : w.errors) == null ? void 0 : H[e]) == null ? void 0 : ae.message, $ = y || P && P.length > 0, Y = t.useCallback(() => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || window.innerWidth <= 768, []), j = t.useCallback(() => {
|
|
864
|
+
if (G.current && N) {
|
|
865
|
+
const p = G.current.getBoundingClientRect(), _ = Y(), ee = window.innerHeight, ie = window.innerWidth, se = 152;
|
|
866
|
+
let me = p.bottom + 4, ue = p.left;
|
|
867
|
+
if (_) {
|
|
868
|
+
const fe = ee - p.bottom, Ae = p.top;
|
|
869
|
+
fe < se && Ae > se && (me = p.top - se - 4);
|
|
870
|
+
const xe = 16, ze = ie - p.width - xe;
|
|
871
|
+
ue = Math.min(Math.max(ue, xe), ze);
|
|
872
872
|
} else
|
|
873
|
-
ee -
|
|
873
|
+
ee - p.bottom < se && (me = p.top - se - 4);
|
|
874
874
|
Z({
|
|
875
|
-
top:
|
|
875
|
+
top: me,
|
|
876
876
|
left: ue,
|
|
877
|
-
width:
|
|
877
|
+
width: p.width
|
|
878
878
|
});
|
|
879
879
|
}
|
|
880
|
-
}, [
|
|
881
|
-
|
|
882
|
-
if (j(),
|
|
883
|
-
const
|
|
884
|
-
return window.addEventListener("resize",
|
|
885
|
-
window.removeEventListener("resize",
|
|
880
|
+
}, [N, Y]);
|
|
881
|
+
t.useEffect(() => {
|
|
882
|
+
if (j(), N) {
|
|
883
|
+
const p = () => j(), _ = () => j();
|
|
884
|
+
return window.addEventListener("resize", p), window.addEventListener("scroll", _, !0), () => {
|
|
885
|
+
window.removeEventListener("resize", p), window.removeEventListener("scroll", _, !0);
|
|
886
886
|
};
|
|
887
887
|
}
|
|
888
|
-
}, [
|
|
889
|
-
const
|
|
890
|
-
|
|
891
|
-
},
|
|
892
|
-
return () => clearTimeout(
|
|
893
|
-
}, [
|
|
894
|
-
(
|
|
895
|
-
}, [U,
|
|
896
|
-
|
|
888
|
+
}, [N, j]), t.useEffect(() => {
|
|
889
|
+
const p = setTimeout(() => {
|
|
890
|
+
B(b);
|
|
891
|
+
}, u);
|
|
892
|
+
return () => clearTimeout(p);
|
|
893
|
+
}, [b, u]), t.useEffect(() => {
|
|
894
|
+
(N || d && m.length === 0) && D(g ? U : void 0);
|
|
895
|
+
}, [U, N]), t.useEffect(() => {
|
|
896
|
+
d === !0 ? D() : Array.isArray(d) && R(d);
|
|
897
897
|
}, []);
|
|
898
|
-
const D = async (
|
|
898
|
+
const D = async (p) => {
|
|
899
899
|
try {
|
|
900
|
-
|
|
901
|
-
const
|
|
902
|
-
R(
|
|
903
|
-
} catch (
|
|
904
|
-
console.error("Error loading options:",
|
|
900
|
+
I(!0);
|
|
901
|
+
const _ = await r(p);
|
|
902
|
+
R(_);
|
|
903
|
+
} catch (_) {
|
|
904
|
+
console.error("Error loading options:", _), R([]);
|
|
905
905
|
} finally {
|
|
906
|
-
|
|
906
|
+
I(!1);
|
|
907
907
|
}
|
|
908
908
|
};
|
|
909
|
-
|
|
910
|
-
const
|
|
911
|
-
G.current && !G.current.contains(
|
|
909
|
+
t.useEffect(() => {
|
|
910
|
+
const p = (_) => {
|
|
911
|
+
G.current && !G.current.contains(_.target) && (C(!1), E(!1), V(""));
|
|
912
912
|
};
|
|
913
|
-
return document.addEventListener("mousedown",
|
|
914
|
-
document.removeEventListener("mousedown",
|
|
913
|
+
return document.addEventListener("mousedown", p), () => {
|
|
914
|
+
document.removeEventListener("mousedown", p);
|
|
915
915
|
};
|
|
916
916
|
}, []);
|
|
917
|
-
const
|
|
918
|
-
|
|
919
|
-
var
|
|
920
|
-
return (
|
|
917
|
+
const le = () => {
|
|
918
|
+
N || (C(!0), E(!0), g && O.current && setTimeout(() => {
|
|
919
|
+
var p;
|
|
920
|
+
return (p = O.current) == null ? void 0 : p.focus();
|
|
921
921
|
}, 0));
|
|
922
|
-
}, re = (
|
|
923
|
-
|
|
924
|
-
},
|
|
925
|
-
|
|
926
|
-
},
|
|
927
|
-
V(
|
|
928
|
-
},
|
|
929
|
-
let
|
|
930
|
-
P.includes(
|
|
931
|
-
target: { value:
|
|
932
|
-
}),
|
|
933
|
-
},
|
|
934
|
-
|
|
935
|
-
const ee = P.filter((ie) => ie !==
|
|
936
|
-
|
|
922
|
+
}, re = (p) => {
|
|
923
|
+
E(!0), s && s(p);
|
|
924
|
+
}, oe = (p) => {
|
|
925
|
+
S && S(p);
|
|
926
|
+
}, f = (p) => {
|
|
927
|
+
V(p.target.value);
|
|
928
|
+
}, A = (p) => {
|
|
929
|
+
let _;
|
|
930
|
+
P.includes(p) ? _ = P.filter((ee) => ee !== p) : _ = [...P, p], z && e && z.setValue(e, _), L.onChange && L.onChange({
|
|
931
|
+
target: { value: _ }
|
|
932
|
+
}), E(!0);
|
|
933
|
+
}, c = (p, _) => {
|
|
934
|
+
_.stopPropagation();
|
|
935
|
+
const ee = P.filter((ie) => ie !== p);
|
|
936
|
+
z && e && z.setValue(e, ee), L.onChange && L.onChange({
|
|
937
937
|
target: { value: ee }
|
|
938
938
|
});
|
|
939
|
-
},
|
|
940
|
-
|
|
939
|
+
}, W = (p) => {
|
|
940
|
+
p.stopPropagation(), z && e && z.setValue(e, []), L.onChange && L.onChange({
|
|
941
941
|
target: { value: [] }
|
|
942
|
-
}), C(!1),
|
|
943
|
-
}, K =
|
|
944
|
-
return /* @__PURE__ */
|
|
942
|
+
}), C(!1), E(!1), V("");
|
|
943
|
+
}, K = m.filter((p) => P.includes(p.value)), te = K.slice(0, x), Q = K.length - x;
|
|
944
|
+
return /* @__PURE__ */ t.createElement("div", { className: i("relative", l), ref: G }, /* @__PURE__ */ t.createElement(
|
|
945
945
|
"div",
|
|
946
946
|
{
|
|
947
|
-
id:
|
|
948
|
-
tabIndex:
|
|
947
|
+
id: L.id || e,
|
|
948
|
+
tabIndex: g ? -1 : 0,
|
|
949
949
|
role: "button",
|
|
950
950
|
"aria-haspopup": "listbox",
|
|
951
|
-
"aria-expanded":
|
|
952
|
-
className:
|
|
951
|
+
"aria-expanded": N,
|
|
952
|
+
className: i(
|
|
953
953
|
"peer flex items-center min-h-12 w-full border border-[var(--primary,#2563eb)] rounded-md bg-[var(--input-bg,#fff)] text-[var(--input-text,#222)] px-3 py-2 text-sm transition focus:outline-none focus:border-[var(--primary,#2563eb)] disabled:cursor-not-allowed disabled:opacity-50 appearance-none cursor-pointer relative",
|
|
954
|
-
|
|
954
|
+
o
|
|
955
955
|
),
|
|
956
|
-
onClick:
|
|
957
|
-
onFocus:
|
|
958
|
-
onBlur:
|
|
959
|
-
ref:
|
|
956
|
+
onClick: le,
|
|
957
|
+
onFocus: g ? void 0 : re,
|
|
958
|
+
onBlur: g ? void 0 : oe,
|
|
959
|
+
ref: M
|
|
960
960
|
},
|
|
961
|
-
/* @__PURE__ */
|
|
961
|
+
/* @__PURE__ */ t.createElement("div", { className: "flex flex-wrap gap-1 items-center min-h-[1.5rem] w-full" }, te.map((p) => /* @__PURE__ */ t.createElement(
|
|
962
962
|
"span",
|
|
963
963
|
{
|
|
964
|
-
key:
|
|
964
|
+
key: p.value,
|
|
965
965
|
className: "flex items-center border border-blue-200 bg-blue-50 text-blue-700 rounded-2xl px-3 py-1 text-xs shadow-sm gap-2",
|
|
966
966
|
style: { maxWidth: "140px" }
|
|
967
967
|
},
|
|
968
|
-
/* @__PURE__ */
|
|
969
|
-
/* @__PURE__ */
|
|
968
|
+
/* @__PURE__ */ t.createElement("span", { className: "truncate", title: p.label }, p.label),
|
|
969
|
+
/* @__PURE__ */ t.createElement(
|
|
970
970
|
"button",
|
|
971
971
|
{
|
|
972
972
|
type: "button",
|
|
973
973
|
className: "ml-1 text-[var(--primary,#2563eb)] hover:text-red-500 focus:outline-none w-4 h-4 flex items-center justify-center rounded-full transition-colors duration-150",
|
|
974
|
-
"aria-label": `Remover ${
|
|
974
|
+
"aria-label": `Remover ${p.label}`,
|
|
975
975
|
tabIndex: -1,
|
|
976
|
-
onClick: (
|
|
976
|
+
onClick: (_) => c(p.value, _)
|
|
977
977
|
},
|
|
978
|
-
/* @__PURE__ */
|
|
978
|
+
/* @__PURE__ */ t.createElement(
|
|
979
979
|
"svg",
|
|
980
980
|
{
|
|
981
981
|
width: "12",
|
|
@@ -984,7 +984,7 @@ const He = e.forwardRef(
|
|
|
984
984
|
fill: "none",
|
|
985
985
|
xmlns: "http://www.w3.org/2000/svg"
|
|
986
986
|
},
|
|
987
|
-
/* @__PURE__ */
|
|
987
|
+
/* @__PURE__ */ t.createElement(
|
|
988
988
|
"path",
|
|
989
989
|
{
|
|
990
990
|
d: "M3 3L9 9M9 3L3 9",
|
|
@@ -995,230 +995,230 @@ const He = e.forwardRef(
|
|
|
995
995
|
)
|
|
996
996
|
)
|
|
997
997
|
)
|
|
998
|
-
)), Q > 0 && /* @__PURE__ */
|
|
998
|
+
)), Q > 0 && /* @__PURE__ */ t.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"), g ? /* @__PURE__ */ t.createElement(
|
|
999
999
|
"input",
|
|
1000
1000
|
{
|
|
1001
|
-
ref:
|
|
1001
|
+
ref: O,
|
|
1002
1002
|
type: "text",
|
|
1003
|
-
value:
|
|
1004
|
-
onChange:
|
|
1003
|
+
value: b,
|
|
1004
|
+
onChange: f,
|
|
1005
1005
|
onFocus: re,
|
|
1006
|
-
onBlur:
|
|
1007
|
-
placeholder: P.length === 0 && !
|
|
1006
|
+
onBlur: oe,
|
|
1007
|
+
placeholder: P.length === 0 && !a ? "Selecione..." : "",
|
|
1008
1008
|
className: "flex-1 min-w-[120px] bg-transparent border-none outline-none text-sm"
|
|
1009
1009
|
}
|
|
1010
|
-
) : P.length === 0 && !
|
|
1011
|
-
F && /* @__PURE__ */
|
|
1012
|
-
|
|
1010
|
+
) : P.length === 0 && !a && /* @__PURE__ */ t.createElement("span", { className: "text-gray-400 text-sm" }, "Selecione...")),
|
|
1011
|
+
F && /* @__PURE__ */ t.createElement("div", { className: "absolute right-8 top-1/2 -translate-y-1/2" }, /* @__PURE__ */ t.createElement("div", { className: "animate-spin rounded-full h-4 w-4 border-b-2 border-[var(--primary,#2563eb)]" })),
|
|
1012
|
+
v && P && P.length > 0 && !F && /* @__PURE__ */ t.createElement(
|
|
1013
1013
|
"button",
|
|
1014
1014
|
{
|
|
1015
1015
|
type: "button",
|
|
1016
1016
|
tabIndex: -1,
|
|
1017
1017
|
"aria-label": "Limpar seleção",
|
|
1018
1018
|
className: "absolute right-2 top-1/2 -translate-y-1/2 text-gray-400 hover:text-red-500 bg-transparent p-1 rounded-full focus:outline-none",
|
|
1019
|
-
onClick:
|
|
1019
|
+
onClick: W
|
|
1020
1020
|
},
|
|
1021
1021
|
"✕"
|
|
1022
1022
|
)
|
|
1023
|
-
),
|
|
1023
|
+
), a && /* @__PURE__ */ t.createElement(
|
|
1024
1024
|
"label",
|
|
1025
1025
|
{
|
|
1026
|
-
htmlFor:
|
|
1027
|
-
className:
|
|
1026
|
+
htmlFor: L.id || e,
|
|
1027
|
+
className: i(
|
|
1028
1028
|
"absolute left-3 z-10 origin-[0] cursor-text select-none text-sm text-gray-400 transition-all duration-200",
|
|
1029
|
-
|
|
1029
|
+
$ ? "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"
|
|
1030
1030
|
)
|
|
1031
1031
|
},
|
|
1032
|
-
|
|
1033
|
-
), /* @__PURE__ */
|
|
1032
|
+
a
|
|
1033
|
+
), /* @__PURE__ */ t.createElement(
|
|
1034
1034
|
"div",
|
|
1035
1035
|
{
|
|
1036
|
-
className:
|
|
1036
|
+
className: i(
|
|
1037
1037
|
"absolute left-0 w-full mt-1 rounded-md transition-all duration-200 overflow-hidden",
|
|
1038
1038
|
"bg-[var(--select-dropdown-bg)] border-[var(--select-dropdown-border)] text-[var(--select-dropdown-text)]",
|
|
1039
|
-
|
|
1039
|
+
N ? "border max-h-36 opacity-100 scale-100" : "max-h-0 opacity-0 scale-95 pointer-events-none"
|
|
1040
1040
|
),
|
|
1041
1041
|
style: {
|
|
1042
|
-
maxHeight:
|
|
1043
|
-
overflowY:
|
|
1042
|
+
maxHeight: N ? "9.5rem" : "0",
|
|
1043
|
+
overflowY: m.length > 3 ? "auto" : "hidden",
|
|
1044
1044
|
position: "fixed",
|
|
1045
1045
|
// Use fixed positioning to escape container overflow
|
|
1046
|
-
top:
|
|
1047
|
-
left:
|
|
1048
|
-
width:
|
|
1046
|
+
top: N ? `${J.top}px` : "auto",
|
|
1047
|
+
left: N ? `${J.left}px` : "auto",
|
|
1048
|
+
width: N ? `${J.width}px` : "auto",
|
|
1049
1049
|
zIndex: 9999,
|
|
1050
|
-
boxShadow:
|
|
1050
|
+
boxShadow: N ? "var(--select-dropdown-shadow)" : "none"
|
|
1051
1051
|
}
|
|
1052
1052
|
},
|
|
1053
|
-
F ? /* @__PURE__ */
|
|
1053
|
+
F ? /* @__PURE__ */ t.createElement("div", { className: "px-3 py-2 text-sm text-gray-500 text-center" }, k) : m.length === 0 ? /* @__PURE__ */ t.createElement("div", { className: "px-3 py-2 text-sm text-gray-500 text-center" }, h) : m.map((p) => /* @__PURE__ */ t.createElement(
|
|
1054
1054
|
"div",
|
|
1055
1055
|
{
|
|
1056
|
-
key:
|
|
1057
|
-
className:
|
|
1056
|
+
key: p.value,
|
|
1057
|
+
className: i(
|
|
1058
1058
|
"px-3 py-2 cursor-pointer text-sm flex items-center gap-2 transition-colors duration-150",
|
|
1059
1059
|
"hover:bg-[var(--select-dropdown-hover)]",
|
|
1060
|
-
P.includes(
|
|
1060
|
+
P.includes(p.value) && "bg-[var(--select-dropdown-selected)] font-semibold"
|
|
1061
1061
|
),
|
|
1062
|
-
onMouseDown: () =>
|
|
1062
|
+
onMouseDown: () => A(p.value)
|
|
1063
1063
|
},
|
|
1064
|
-
/* @__PURE__ */
|
|
1064
|
+
/* @__PURE__ */ t.createElement(
|
|
1065
1065
|
"input",
|
|
1066
1066
|
{
|
|
1067
1067
|
type: "checkbox",
|
|
1068
|
-
checked: P.includes(
|
|
1068
|
+
checked: P.includes(p.value),
|
|
1069
1069
|
readOnly: !0,
|
|
1070
1070
|
className: "accent-blue-500"
|
|
1071
1071
|
}
|
|
1072
1072
|
),
|
|
1073
|
-
|
|
1073
|
+
p.label
|
|
1074
1074
|
))
|
|
1075
|
-
), q && /* @__PURE__ */
|
|
1075
|
+
), q && /* @__PURE__ */ t.createElement("span", { className: "text-red-500 text-xs mt-1 block" }, q));
|
|
1076
1076
|
}
|
|
1077
1077
|
);
|
|
1078
|
-
|
|
1079
|
-
const
|
|
1078
|
+
Ge.displayName = "MultiAsyncSelect";
|
|
1079
|
+
const qe = {
|
|
1080
1080
|
sm: "h-10 text-sm px-3",
|
|
1081
1081
|
md: "h-12 text-base px-4",
|
|
1082
1082
|
lg: "h-16 text-lg px-6"
|
|
1083
|
-
},
|
|
1083
|
+
}, Ke = t.forwardRef(
|
|
1084
1084
|
({
|
|
1085
|
-
name:
|
|
1086
|
-
label:
|
|
1085
|
+
name: e,
|
|
1086
|
+
label: a,
|
|
1087
1087
|
options: r,
|
|
1088
|
-
className:
|
|
1088
|
+
className: o,
|
|
1089
1089
|
containerClassName: l,
|
|
1090
|
-
optionClassName:
|
|
1091
|
-
direction:
|
|
1092
|
-
size:
|
|
1093
|
-
onFocus:
|
|
1094
|
-
onBlur:
|
|
1095
|
-
...
|
|
1090
|
+
optionClassName: v,
|
|
1091
|
+
direction: d = "row",
|
|
1092
|
+
size: k = "md",
|
|
1093
|
+
onFocus: h,
|
|
1094
|
+
onBlur: g,
|
|
1095
|
+
...u
|
|
1096
1096
|
}, x) => {
|
|
1097
|
-
var
|
|
1098
|
-
const
|
|
1099
|
-
|
|
1097
|
+
var N, C, m;
|
|
1098
|
+
const s = ce(), S = s == null ? void 0 : s.control, L = S && e ? de({ control: S, name: e }) : void 0, M = u.value ?? L ?? "", y = (m = (C = (N = s == null ? void 0 : s.formState) == null ? void 0 : N.errors) == null ? void 0 : C[e]) == null ? void 0 : m.message, E = (R) => {
|
|
1099
|
+
s && e && s.setValue(e, R), u.onChange && u.onChange({ target: { value: R } });
|
|
1100
1100
|
};
|
|
1101
|
-
return /* @__PURE__ */
|
|
1101
|
+
return /* @__PURE__ */ t.createElement("div", { className: i("relative", l), ref: x }, a && /* @__PURE__ */ t.createElement(
|
|
1102
1102
|
"label",
|
|
1103
1103
|
{
|
|
1104
|
-
htmlFor:
|
|
1105
|
-
className:
|
|
1104
|
+
htmlFor: e,
|
|
1105
|
+
className: i(
|
|
1106
1106
|
"absolute left-3 z-10 origin-[0] cursor-text select-none text-sm transition-all duration-200",
|
|
1107
1107
|
"top-0 scale-90 -translate-y-1 text-xs text-[var(--primary,#2563eb)] p-1 rounded-full bg-white"
|
|
1108
1108
|
)
|
|
1109
1109
|
},
|
|
1110
|
-
|
|
1111
|
-
), /* @__PURE__ */
|
|
1110
|
+
a
|
|
1111
|
+
), /* @__PURE__ */ t.createElement(
|
|
1112
1112
|
"div",
|
|
1113
1113
|
{
|
|
1114
|
-
className:
|
|
1114
|
+
className: i(
|
|
1115
1115
|
"flex gap-2 w-full pt-6",
|
|
1116
1116
|
// espaço para label flutuante
|
|
1117
|
-
|
|
1118
|
-
|
|
1117
|
+
d === "row" ? "flex-row" : "flex-col",
|
|
1118
|
+
o
|
|
1119
1119
|
),
|
|
1120
|
-
"aria-label":
|
|
1120
|
+
"aria-label": a,
|
|
1121
1121
|
tabIndex: -1,
|
|
1122
|
-
onFocus:
|
|
1123
|
-
onBlur:
|
|
1122
|
+
onFocus: h,
|
|
1123
|
+
onBlur: g
|
|
1124
1124
|
},
|
|
1125
|
-
r.map((R) => /* @__PURE__ */
|
|
1125
|
+
r.map((R) => /* @__PURE__ */ t.createElement(
|
|
1126
1126
|
"button",
|
|
1127
1127
|
{
|
|
1128
1128
|
key: R.value,
|
|
1129
1129
|
type: "button",
|
|
1130
|
-
className:
|
|
1130
|
+
className: i(
|
|
1131
1131
|
"relative flex items-center justify-center border rounded-lg transition-all duration-200 shadow-sm px-4 focus:outline-none focus:ring-2 focus:ring-[var(--primary-hover,#dbeafe)]",
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1132
|
+
qe[k],
|
|
1133
|
+
M === R.value ? "border-[var(--primary,#2563eb)] bg-[var(--primary-hover,#dbeafe)] text-[var(--primary,#2563eb)] ring-2 ring-[var(--primary-hover,#dbeafe)] shadow-md transform scale-[1.02]" : "border-gray-200 bg-white text-gray-600 hover:border-[var(--primary,#2563eb)] hover:bg-[var(--primary-hover,#dbeafe)] hover:text-[var(--primary,#2563eb)] hover:shadow-md",
|
|
1134
|
+
v
|
|
1135
1135
|
),
|
|
1136
|
-
"aria-pressed":
|
|
1137
|
-
"data-selected":
|
|
1136
|
+
"aria-pressed": M === R.value,
|
|
1137
|
+
"data-selected": M === R.value,
|
|
1138
1138
|
tabIndex: 0,
|
|
1139
|
-
onClick: () =>
|
|
1139
|
+
onClick: () => E(R.value),
|
|
1140
1140
|
onKeyDown: (F) => {
|
|
1141
|
-
(F.key === "Enter" || F.key === " ") && (F.preventDefault(),
|
|
1141
|
+
(F.key === "Enter" || F.key === " ") && (F.preventDefault(), E(R.value));
|
|
1142
1142
|
}
|
|
1143
1143
|
},
|
|
1144
|
-
R.icon && /* @__PURE__ */
|
|
1145
|
-
/* @__PURE__ */
|
|
1144
|
+
R.icon && /* @__PURE__ */ t.createElement("span", { className: "mr-2 text-lg flex items-center" }, R.icon),
|
|
1145
|
+
/* @__PURE__ */ t.createElement("span", { className: "truncate font-medium" }, R.label)
|
|
1146
1146
|
))
|
|
1147
|
-
),
|
|
1147
|
+
), y && /* @__PURE__ */ t.createElement("span", { className: "text-red-500 text-xs mt-1 block" }, y));
|
|
1148
1148
|
}
|
|
1149
1149
|
);
|
|
1150
|
-
|
|
1151
|
-
const
|
|
1152
|
-
({ children:
|
|
1150
|
+
Ke.displayName = "RadioGroup";
|
|
1151
|
+
const Ne = n.forwardRef(
|
|
1152
|
+
({ children: e, className: a, as: r = "div", ...o }, l) => /* @__PURE__ */ n.createElement(
|
|
1153
1153
|
r,
|
|
1154
1154
|
{
|
|
1155
1155
|
ref: l,
|
|
1156
|
-
className:
|
|
1156
|
+
className: i(
|
|
1157
1157
|
"px-2 py-1 sm:px-4 sm:py-2 lg:px-6 lg:py-4 border-b",
|
|
1158
1158
|
"bg-[var(--card-header-bg,rgba(249,250,251,0.5))]",
|
|
1159
1159
|
"border-[var(--card-header-border,#e5e7eb)]",
|
|
1160
1160
|
"text-[var(--card-text,#111827)]",
|
|
1161
|
-
|
|
1161
|
+
a
|
|
1162
1162
|
),
|
|
1163
|
-
...
|
|
1163
|
+
...o
|
|
1164
1164
|
},
|
|
1165
|
-
|
|
1165
|
+
e
|
|
1166
1166
|
)
|
|
1167
1167
|
);
|
|
1168
|
-
|
|
1169
|
-
const
|
|
1170
|
-
({ children:
|
|
1168
|
+
Ne.displayName = "CardHeader";
|
|
1169
|
+
const Ce = n.forwardRef(
|
|
1170
|
+
({ children: e, className: a, as: r = "div", ...o }, l) => /* @__PURE__ */ n.createElement(
|
|
1171
1171
|
r,
|
|
1172
1172
|
{
|
|
1173
1173
|
ref: l,
|
|
1174
|
-
className:
|
|
1174
|
+
className: i(
|
|
1175
1175
|
"px-2 py-1 sm:px-4 sm:py-2 lg:px-6 lg:py-4",
|
|
1176
1176
|
"flex-1",
|
|
1177
1177
|
// Para ocupar o espaço disponível
|
|
1178
1178
|
"bg-[var(--card-bg,#ffffff)]",
|
|
1179
1179
|
"text-[var(--card-text,#111827)]",
|
|
1180
|
-
|
|
1180
|
+
a
|
|
1181
1181
|
),
|
|
1182
|
-
...
|
|
1182
|
+
...o
|
|
1183
1183
|
},
|
|
1184
|
-
|
|
1184
|
+
e
|
|
1185
1185
|
)
|
|
1186
1186
|
);
|
|
1187
|
-
|
|
1188
|
-
const
|
|
1189
|
-
({ children:
|
|
1187
|
+
Ce.displayName = "CardBody";
|
|
1188
|
+
const ke = n.forwardRef(
|
|
1189
|
+
({ children: e, className: a, as: r = "div", ...o }, l) => /* @__PURE__ */ n.createElement(
|
|
1190
1190
|
r,
|
|
1191
1191
|
{
|
|
1192
1192
|
ref: l,
|
|
1193
|
-
className:
|
|
1193
|
+
className: i(
|
|
1194
1194
|
"px-6 py-4 border-t",
|
|
1195
1195
|
"bg-[var(--card-footer-bg,rgba(249,250,251,0.5))]",
|
|
1196
1196
|
"border-[var(--card-footer-border,#e5e7eb)]",
|
|
1197
1197
|
"text-[var(--card-text,#111827)]",
|
|
1198
|
-
|
|
1198
|
+
a
|
|
1199
1199
|
),
|
|
1200
|
-
...
|
|
1200
|
+
...o
|
|
1201
1201
|
},
|
|
1202
|
-
|
|
1202
|
+
e
|
|
1203
1203
|
)
|
|
1204
1204
|
);
|
|
1205
|
-
|
|
1206
|
-
const
|
|
1205
|
+
ke.displayName = "CardFooter";
|
|
1206
|
+
const Je = n.forwardRef(
|
|
1207
1207
|
({
|
|
1208
|
-
children:
|
|
1209
|
-
className:
|
|
1208
|
+
children: e,
|
|
1209
|
+
className: a,
|
|
1210
1210
|
variant: r = "default",
|
|
1211
|
-
size:
|
|
1211
|
+
size: o = "md",
|
|
1212
1212
|
padding: l = "none",
|
|
1213
1213
|
// none pois cada seção tem seu próprio padding
|
|
1214
|
-
rounded:
|
|
1215
|
-
constrainWidth:
|
|
1214
|
+
rounded: v = "lg",
|
|
1215
|
+
constrainWidth: d = !1,
|
|
1216
1216
|
// Por padrão, não aplicar max-width
|
|
1217
|
-
allowOverflow:
|
|
1217
|
+
allowOverflow: k = !1,
|
|
1218
1218
|
// Por padrão, aplicar overflow hidden para interface limpa
|
|
1219
|
-
...
|
|
1220
|
-
},
|
|
1221
|
-
const
|
|
1219
|
+
...h
|
|
1220
|
+
}, g) => {
|
|
1221
|
+
const u = {
|
|
1222
1222
|
default: "bg-[var(--card-bg,#ffffff)] border border-[var(--card-border,#e5e7eb)] shadow-[var(--card-shadow-sm,0_1px_2px_0_rgb(0_0_0_/_0.05))]",
|
|
1223
1223
|
outlined: "bg-[var(--card-bg,#ffffff)] border-2 border-[var(--primary,#2563eb)]",
|
|
1224
1224
|
elevated: "bg-[var(--card-bg,#ffffff)] border border-[var(--card-border,#e5e7eb)] shadow-[var(--card-shadow-lg,0_10px_15px_-3px_rgb(0_0_0_/_0.1),_0_4px_6px_-4px_rgb(0_0_0_/_0.1))]",
|
|
@@ -1227,54 +1227,54 @@ const Ue = o.forwardRef(
|
|
|
1227
1227
|
sm: "max-w-sm",
|
|
1228
1228
|
md: "max-w-md",
|
|
1229
1229
|
lg: "max-w-lg"
|
|
1230
|
-
},
|
|
1230
|
+
}, s = {
|
|
1231
1231
|
none: "",
|
|
1232
1232
|
sm: "p-3",
|
|
1233
1233
|
md: "p-4",
|
|
1234
1234
|
lg: "p-6"
|
|
1235
|
-
},
|
|
1235
|
+
}, S = {
|
|
1236
1236
|
none: "rounded-none",
|
|
1237
1237
|
sm: "rounded-sm",
|
|
1238
1238
|
md: "rounded-md",
|
|
1239
1239
|
lg: "rounded-lg",
|
|
1240
1240
|
xl: "rounded-xl"
|
|
1241
1241
|
};
|
|
1242
|
-
return /* @__PURE__ */
|
|
1242
|
+
return /* @__PURE__ */ n.createElement(
|
|
1243
1243
|
"div",
|
|
1244
1244
|
{
|
|
1245
|
-
ref:
|
|
1246
|
-
className:
|
|
1245
|
+
ref: g,
|
|
1246
|
+
className: i(
|
|
1247
1247
|
"flex flex-col",
|
|
1248
1248
|
// Flex column para organizar header, body, footer
|
|
1249
|
-
!
|
|
1249
|
+
!k && "overflow-hidden",
|
|
1250
1250
|
// Overflow hidden por padrão para bordas limpas
|
|
1251
|
-
|
|
1252
|
-
|
|
1251
|
+
u[r],
|
|
1252
|
+
d && x[o],
|
|
1253
1253
|
// Aplicar max-width apenas se constrainWidth for true
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1254
|
+
s[l],
|
|
1255
|
+
S[v],
|
|
1256
|
+
a
|
|
1257
1257
|
),
|
|
1258
|
-
...
|
|
1258
|
+
...h
|
|
1259
1259
|
},
|
|
1260
|
-
|
|
1260
|
+
e
|
|
1261
1261
|
);
|
|
1262
1262
|
}
|
|
1263
|
-
),
|
|
1264
|
-
Header:
|
|
1265
|
-
Body:
|
|
1266
|
-
Footer:
|
|
1267
|
-
}),
|
|
1263
|
+
), st = Object.assign(Je, {
|
|
1264
|
+
Header: Ne,
|
|
1265
|
+
Body: Ce,
|
|
1266
|
+
Footer: ke
|
|
1267
|
+
}), Se = n.forwardRef(
|
|
1268
1268
|
({
|
|
1269
|
-
children:
|
|
1270
|
-
className:
|
|
1269
|
+
children: e,
|
|
1270
|
+
className: a,
|
|
1271
1271
|
variant: r = "default",
|
|
1272
|
-
size:
|
|
1272
|
+
size: o = "md",
|
|
1273
1273
|
responsive: l = !1,
|
|
1274
|
-
stickyHeader:
|
|
1275
|
-
...
|
|
1276
|
-
},
|
|
1277
|
-
const
|
|
1274
|
+
stickyHeader: v = !1,
|
|
1275
|
+
...d
|
|
1276
|
+
}, k) => {
|
|
1277
|
+
const h = i(
|
|
1278
1278
|
// Base styles
|
|
1279
1279
|
"w-full border-collapse bg-[var(--table-bg)] text-[var(--table-text)]",
|
|
1280
1280
|
// Variant styles
|
|
@@ -1283,179 +1283,179 @@ const Ue = o.forwardRef(
|
|
|
1283
1283
|
},
|
|
1284
1284
|
// Size styles
|
|
1285
1285
|
{
|
|
1286
|
-
"text-sm":
|
|
1287
|
-
"text-base":
|
|
1288
|
-
"text-lg":
|
|
1286
|
+
"text-sm": o === "sm",
|
|
1287
|
+
"text-base": o === "md",
|
|
1288
|
+
"text-lg": o === "lg"
|
|
1289
1289
|
},
|
|
1290
|
-
|
|
1291
|
-
),
|
|
1290
|
+
a
|
|
1291
|
+
), g = i(
|
|
1292
1292
|
{
|
|
1293
1293
|
"overflow-x-auto": l,
|
|
1294
|
-
"max-h-96 overflow-y-auto":
|
|
1294
|
+
"max-h-96 overflow-y-auto": v
|
|
1295
1295
|
}
|
|
1296
|
-
),
|
|
1296
|
+
), u = /* @__PURE__ */ n.createElement(
|
|
1297
1297
|
"table",
|
|
1298
1298
|
{
|
|
1299
|
-
ref:
|
|
1300
|
-
className:
|
|
1301
|
-
...
|
|
1299
|
+
ref: k,
|
|
1300
|
+
className: h,
|
|
1301
|
+
...d
|
|
1302
1302
|
},
|
|
1303
|
-
|
|
1303
|
+
e
|
|
1304
1304
|
);
|
|
1305
|
-
return l ||
|
|
1305
|
+
return l || v ? /* @__PURE__ */ n.createElement("div", { className: g }, u) : u;
|
|
1306
1306
|
}
|
|
1307
|
-
),
|
|
1308
|
-
({ children:
|
|
1307
|
+
), Le = n.forwardRef(
|
|
1308
|
+
({ children: e, className: a, as: r = "thead", ...o }, l) => /* @__PURE__ */ n.createElement(
|
|
1309
1309
|
r,
|
|
1310
1310
|
{
|
|
1311
1311
|
ref: l,
|
|
1312
|
-
className:
|
|
1312
|
+
className: i(
|
|
1313
1313
|
"border-b border-[var(--table-border)] bg-[var(--table-header-bg)]",
|
|
1314
1314
|
{
|
|
1315
1315
|
"sticky top-0 z-10": r === "thead"
|
|
1316
1316
|
},
|
|
1317
|
-
|
|
1317
|
+
a
|
|
1318
1318
|
),
|
|
1319
|
-
...
|
|
1319
|
+
...o
|
|
1320
1320
|
},
|
|
1321
|
-
|
|
1321
|
+
e
|
|
1322
1322
|
)
|
|
1323
|
-
),
|
|
1324
|
-
({ children:
|
|
1323
|
+
), Me = n.forwardRef(
|
|
1324
|
+
({ children: e, className: a, as: r = "tbody", ...o }, l) => /* @__PURE__ */ n.createElement(
|
|
1325
1325
|
r,
|
|
1326
1326
|
{
|
|
1327
1327
|
ref: l,
|
|
1328
|
-
className:
|
|
1328
|
+
className: i(
|
|
1329
1329
|
"[&_tr:nth-child(odd)]:bg-[var(--table-row-odd)]",
|
|
1330
1330
|
"[&_tr:nth-child(even)]:bg-[var(--table-row-even)]",
|
|
1331
|
-
|
|
1331
|
+
a
|
|
1332
1332
|
),
|
|
1333
|
-
...
|
|
1333
|
+
...o
|
|
1334
1334
|
},
|
|
1335
|
-
|
|
1335
|
+
e
|
|
1336
1336
|
)
|
|
1337
|
-
), Re =
|
|
1338
|
-
({ children:
|
|
1337
|
+
), Re = n.forwardRef(
|
|
1338
|
+
({ children: e, className: a, as: r = "tfoot", ...o }, l) => /* @__PURE__ */ n.createElement(
|
|
1339
1339
|
r,
|
|
1340
1340
|
{
|
|
1341
1341
|
ref: l,
|
|
1342
|
-
className:
|
|
1342
|
+
className: i(
|
|
1343
1343
|
"border-t border-[var(--table-border)] bg-[var(--table-header-bg)] font-medium",
|
|
1344
|
-
|
|
1344
|
+
a
|
|
1345
1345
|
),
|
|
1346
|
-
...
|
|
1346
|
+
...o
|
|
1347
1347
|
},
|
|
1348
|
-
|
|
1348
|
+
e
|
|
1349
1349
|
)
|
|
1350
|
-
), Fe =
|
|
1351
|
-
({ children:
|
|
1350
|
+
), Fe = n.forwardRef(
|
|
1351
|
+
({ children: e, className: a, variant: r = "default", ...o }, l) => /* @__PURE__ */ n.createElement(
|
|
1352
1352
|
"tr",
|
|
1353
1353
|
{
|
|
1354
1354
|
ref: l,
|
|
1355
|
-
className:
|
|
1355
|
+
className: i(
|
|
1356
1356
|
"border-b border-[var(--table-border)] transition-colors",
|
|
1357
1357
|
{
|
|
1358
1358
|
"hover:bg-[var(--table-row-hover)]": r === "hover",
|
|
1359
1359
|
"bg-[var(--table-row-selected)]": r === "selected"
|
|
1360
1360
|
},
|
|
1361
|
-
|
|
1361
|
+
a
|
|
1362
1362
|
),
|
|
1363
|
-
...
|
|
1363
|
+
...o
|
|
1364
1364
|
},
|
|
1365
|
-
|
|
1365
|
+
e
|
|
1366
1366
|
)
|
|
1367
|
-
),
|
|
1367
|
+
), Be = n.forwardRef(
|
|
1368
1368
|
({
|
|
1369
|
-
children:
|
|
1370
|
-
className:
|
|
1369
|
+
children: e,
|
|
1370
|
+
className: a,
|
|
1371
1371
|
as: r = "td",
|
|
1372
|
-
align:
|
|
1372
|
+
align: o = "left",
|
|
1373
1373
|
scope: l,
|
|
1374
|
-
colSpan:
|
|
1375
|
-
rowSpan:
|
|
1376
|
-
...
|
|
1377
|
-
},
|
|
1374
|
+
colSpan: v,
|
|
1375
|
+
rowSpan: d,
|
|
1376
|
+
...k
|
|
1377
|
+
}, h) => /* @__PURE__ */ n.createElement(
|
|
1378
1378
|
r,
|
|
1379
1379
|
{
|
|
1380
|
-
ref:
|
|
1380
|
+
ref: h,
|
|
1381
1381
|
scope: r === "th" ? l : void 0,
|
|
1382
|
-
colSpan:
|
|
1383
|
-
rowSpan:
|
|
1384
|
-
className:
|
|
1382
|
+
colSpan: v,
|
|
1383
|
+
rowSpan: d,
|
|
1384
|
+
className: i(
|
|
1385
1385
|
"px-4 py-3 text-left",
|
|
1386
1386
|
{
|
|
1387
1387
|
"font-semibold": r === "th",
|
|
1388
1388
|
"text-sm": r === "td",
|
|
1389
|
-
"text-center":
|
|
1390
|
-
"text-right":
|
|
1389
|
+
"text-center": o === "center",
|
|
1390
|
+
"text-right": o === "right"
|
|
1391
1391
|
},
|
|
1392
|
-
|
|
1392
|
+
a
|
|
1393
1393
|
),
|
|
1394
|
-
...
|
|
1394
|
+
...k
|
|
1395
1395
|
},
|
|
1396
|
-
|
|
1396
|
+
e
|
|
1397
1397
|
)
|
|
1398
1398
|
);
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1399
|
+
Se.displayName = "Table";
|
|
1400
|
+
Le.displayName = "TableHeader";
|
|
1401
|
+
Me.displayName = "TableBody";
|
|
1402
1402
|
Re.displayName = "TableFooter";
|
|
1403
1403
|
Fe.displayName = "TableRow";
|
|
1404
|
-
|
|
1405
|
-
const
|
|
1406
|
-
Header:
|
|
1407
|
-
Body:
|
|
1404
|
+
Be.displayName = "TableCell";
|
|
1405
|
+
const it = Object.assign(Se, {
|
|
1406
|
+
Header: Le,
|
|
1407
|
+
Body: Me,
|
|
1408
1408
|
Footer: Re,
|
|
1409
1409
|
Row: Fe,
|
|
1410
|
-
Cell:
|
|
1411
|
-
}),
|
|
1412
|
-
content:
|
|
1413
|
-
children:
|
|
1410
|
+
Cell: Be
|
|
1411
|
+
}), ct = ({
|
|
1412
|
+
content: e,
|
|
1413
|
+
children: a,
|
|
1414
1414
|
position: r = "top",
|
|
1415
|
-
className:
|
|
1415
|
+
className: o = "",
|
|
1416
1416
|
disabled: l = !1
|
|
1417
1417
|
}) => {
|
|
1418
|
-
const [
|
|
1419
|
-
|
|
1420
|
-
if (!
|
|
1421
|
-
const
|
|
1422
|
-
let R = r, F = 0,
|
|
1418
|
+
const [v, d] = ne(!1), [k, h] = ne(r), [g, u] = ne({}), x = pe(null), s = pe(null);
|
|
1419
|
+
ve(() => {
|
|
1420
|
+
if (!v || !s.current) return;
|
|
1421
|
+
const m = s.current.getBoundingClientRect();
|
|
1422
|
+
let R = r, F = 0, I = 0;
|
|
1423
1423
|
switch (r) {
|
|
1424
1424
|
case "top":
|
|
1425
|
-
F =
|
|
1425
|
+
F = m.top - 8, I = m.left + m.width / 2;
|
|
1426
1426
|
break;
|
|
1427
1427
|
case "bottom":
|
|
1428
|
-
F =
|
|
1428
|
+
F = m.bottom + 8, I = m.left + m.width / 2;
|
|
1429
1429
|
break;
|
|
1430
1430
|
case "left":
|
|
1431
|
-
F =
|
|
1431
|
+
F = m.top + m.height / 2, I = m.left - 8;
|
|
1432
1432
|
break;
|
|
1433
1433
|
case "right":
|
|
1434
|
-
F =
|
|
1434
|
+
F = m.top + m.height / 2, I = m.right + 8;
|
|
1435
1435
|
break;
|
|
1436
1436
|
}
|
|
1437
1437
|
if (x.current) {
|
|
1438
|
-
const
|
|
1439
|
-
r === "top" &&
|
|
1438
|
+
const b = x.current.getBoundingClientRect(), V = window.innerWidth, U = window.innerHeight;
|
|
1439
|
+
r === "top" && m.top < b.height + 16 ? (R = "bottom", F = m.bottom + 8) : r === "bottom" && m.bottom + b.height + 16 > U ? (R = "top", F = m.top - 8) : r === "left" && m.left < b.width + 16 ? (R = "right", I = m.right + 8) : r === "right" && m.right + b.width + 16 > V && (R = "left", I = m.left - 8);
|
|
1440
1440
|
}
|
|
1441
|
-
|
|
1441
|
+
h(R), u({
|
|
1442
1442
|
position: "fixed",
|
|
1443
1443
|
top: `${F}px`,
|
|
1444
|
-
left: `${
|
|
1444
|
+
left: `${I}px`,
|
|
1445
1445
|
zIndex: 9999
|
|
1446
1446
|
});
|
|
1447
|
-
}, [
|
|
1448
|
-
const
|
|
1449
|
-
l ||
|
|
1450
|
-
},
|
|
1451
|
-
|
|
1452
|
-
},
|
|
1453
|
-
l ||
|
|
1454
|
-
},
|
|
1455
|
-
|
|
1456
|
-
},
|
|
1447
|
+
}, [v, r]);
|
|
1448
|
+
const S = () => {
|
|
1449
|
+
l || d(!0);
|
|
1450
|
+
}, L = () => {
|
|
1451
|
+
d(!1);
|
|
1452
|
+
}, M = () => {
|
|
1453
|
+
l || d(!0);
|
|
1454
|
+
}, y = () => {
|
|
1455
|
+
d(!1);
|
|
1456
|
+
}, E = () => {
|
|
1457
1457
|
const C = "pointer-events-none";
|
|
1458
|
-
switch (
|
|
1458
|
+
switch (k) {
|
|
1459
1459
|
case "top":
|
|
1460
1460
|
return `${C} transform -translate-x-1/2 -translate-y-full`;
|
|
1461
1461
|
case "bottom":
|
|
@@ -1467,9 +1467,9 @@ const et = Object.assign(Ne, {
|
|
|
1467
1467
|
default:
|
|
1468
1468
|
return `${C} transform -translate-x-1/2 -translate-y-full`;
|
|
1469
1469
|
}
|
|
1470
|
-
},
|
|
1470
|
+
}, N = () => {
|
|
1471
1471
|
const C = "absolute w-2 h-2 bg-[var(--tooltip-bg,#374151)] transform rotate-45";
|
|
1472
|
-
switch (
|
|
1472
|
+
switch (k) {
|
|
1473
1473
|
case "top":
|
|
1474
1474
|
return `${C} top-full left-1/2 -translate-x-1/2 -translate-y-1/2`;
|
|
1475
1475
|
case "bottom":
|
|
@@ -1482,208 +1482,208 @@ const et = Object.assign(Ne, {
|
|
|
1482
1482
|
return `${C} top-full left-1/2 -translate-x-1/2 -translate-y-1/2`;
|
|
1483
1483
|
}
|
|
1484
1484
|
};
|
|
1485
|
-
return l || !
|
|
1485
|
+
return l || !e ? /* @__PURE__ */ n.createElement(n.Fragment, null, a) : /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
|
|
1486
1486
|
"div",
|
|
1487
1487
|
{
|
|
1488
1488
|
className: "relative inline-block",
|
|
1489
|
-
ref:
|
|
1490
|
-
onMouseEnter:
|
|
1491
|
-
onMouseLeave:
|
|
1492
|
-
onFocus:
|
|
1493
|
-
onBlur:
|
|
1489
|
+
ref: s,
|
|
1490
|
+
onMouseEnter: S,
|
|
1491
|
+
onMouseLeave: L,
|
|
1492
|
+
onFocus: M,
|
|
1493
|
+
onBlur: y
|
|
1494
1494
|
},
|
|
1495
|
-
|
|
1496
|
-
),
|
|
1497
|
-
/* @__PURE__ */
|
|
1495
|
+
a
|
|
1496
|
+
), v && typeof document < "u" && be(
|
|
1497
|
+
/* @__PURE__ */ n.createElement(
|
|
1498
1498
|
"div",
|
|
1499
1499
|
{
|
|
1500
1500
|
ref: x,
|
|
1501
|
-
style:
|
|
1502
|
-
className:
|
|
1503
|
-
|
|
1501
|
+
style: g,
|
|
1502
|
+
className: i(
|
|
1503
|
+
E(),
|
|
1504
1504
|
"px-2 py-1 text-sm rounded whitespace-nowrap",
|
|
1505
1505
|
"bg-[var(--tooltip-bg,#374151)] text-[var(--tooltip-text,#fff)]",
|
|
1506
1506
|
"shadow-[var(--tooltip-shadow,0_10px_15px_-3px_rgb(0_0_0_/_0.1),_0_4px_6px_-4px_rgb(0_0_0_/_0.1))]",
|
|
1507
1507
|
"transition-opacity duration-200 ease-in-out",
|
|
1508
|
-
|
|
1508
|
+
o
|
|
1509
1509
|
),
|
|
1510
1510
|
role: "tooltip",
|
|
1511
|
-
"aria-hidden": !
|
|
1511
|
+
"aria-hidden": !v
|
|
1512
1512
|
},
|
|
1513
|
-
|
|
1514
|
-
/* @__PURE__ */
|
|
1513
|
+
e,
|
|
1514
|
+
/* @__PURE__ */ n.createElement("div", { className: N() })
|
|
1515
1515
|
),
|
|
1516
1516
|
document.body
|
|
1517
1517
|
));
|
|
1518
|
-
},
|
|
1519
|
-
open:
|
|
1520
|
-
onClose:
|
|
1518
|
+
}, Qe = ({
|
|
1519
|
+
open: e,
|
|
1520
|
+
onClose: a,
|
|
1521
1521
|
side: r = "right",
|
|
1522
|
-
size:
|
|
1522
|
+
size: o = "md",
|
|
1523
1523
|
closeOnOverlayClick: l = !0,
|
|
1524
|
-
children:
|
|
1525
|
-
className:
|
|
1526
|
-
...
|
|
1524
|
+
children: v,
|
|
1525
|
+
className: d = "",
|
|
1526
|
+
...k
|
|
1527
1527
|
}) => {
|
|
1528
|
-
const
|
|
1528
|
+
const h = typeof document < "u" ? document.body : null, g = o === "sm" ? "w-64" : o === "md" ? "w-96" : o === "lg" ? "w-[36rem]" : void 0, u = typeof o == "string" && !["sm", "md", "lg"].includes(o) ? { width: o } : void 0, x = /* @__PURE__ */ n.createElement(
|
|
1529
1529
|
"div",
|
|
1530
1530
|
{
|
|
1531
|
-
"aria-hidden": !
|
|
1532
|
-
className:
|
|
1531
|
+
"aria-hidden": !e,
|
|
1532
|
+
className: i(
|
|
1533
1533
|
"fixed inset-0 z-50 flex",
|
|
1534
|
-
|
|
1534
|
+
e ? "pointer-events-auto" : "pointer-events-none"
|
|
1535
1535
|
)
|
|
1536
1536
|
},
|
|
1537
|
-
/* @__PURE__ */
|
|
1537
|
+
/* @__PURE__ */ n.createElement(
|
|
1538
1538
|
"div",
|
|
1539
1539
|
{
|
|
1540
|
-
className:
|
|
1540
|
+
className: i(
|
|
1541
1541
|
"absolute inset-0 bg-black/40 transition-opacity duration-200",
|
|
1542
|
-
|
|
1542
|
+
e ? "opacity-100" : "opacity-0"
|
|
1543
1543
|
),
|
|
1544
|
-
onMouseDown: (
|
|
1545
|
-
l &&
|
|
1544
|
+
onMouseDown: (s) => {
|
|
1545
|
+
l && s.target === s.currentTarget && a();
|
|
1546
1546
|
}
|
|
1547
1547
|
}
|
|
1548
1548
|
),
|
|
1549
|
-
/* @__PURE__ */
|
|
1549
|
+
/* @__PURE__ */ n.createElement(
|
|
1550
1550
|
"div",
|
|
1551
1551
|
{
|
|
1552
|
-
className:
|
|
1552
|
+
className: i(
|
|
1553
1553
|
"relative h-full",
|
|
1554
1554
|
r === "right" ? "ml-auto" : "mr-auto",
|
|
1555
1555
|
// ensure the sheet doesn't shrink
|
|
1556
1556
|
"flex-shrink-0"
|
|
1557
1557
|
),
|
|
1558
|
-
style:
|
|
1558
|
+
style: u
|
|
1559
1559
|
},
|
|
1560
|
-
/* @__PURE__ */
|
|
1560
|
+
/* @__PURE__ */ n.createElement(
|
|
1561
1561
|
"aside",
|
|
1562
1562
|
{
|
|
1563
1563
|
role: "dialog",
|
|
1564
1564
|
"aria-modal": !0,
|
|
1565
|
-
className:
|
|
1565
|
+
className: i(
|
|
1566
1566
|
"h-full bg-white shadow-xl border-l border-gray-100 overflow-auto transition-transform duration-300",
|
|
1567
|
-
r === "right" ?
|
|
1568
|
-
|
|
1569
|
-
|
|
1567
|
+
r === "right" ? e ? "translate-x-0" : "translate-x-full" : e ? "translate-x-0" : "-translate-x-full",
|
|
1568
|
+
g,
|
|
1569
|
+
d
|
|
1570
1570
|
),
|
|
1571
|
-
style:
|
|
1572
|
-
...
|
|
1571
|
+
style: u,
|
|
1572
|
+
...k
|
|
1573
1573
|
},
|
|
1574
|
-
|
|
1574
|
+
v
|
|
1575
1575
|
)
|
|
1576
1576
|
)
|
|
1577
1577
|
);
|
|
1578
|
-
return
|
|
1578
|
+
return h ? be(x, h) : null;
|
|
1579
1579
|
};
|
|
1580
|
-
|
|
1581
|
-
const
|
|
1582
|
-
avatar:
|
|
1583
|
-
value:
|
|
1580
|
+
Qe.displayName = "AsideSheet";
|
|
1581
|
+
const dt = ({
|
|
1582
|
+
avatar: e = !1,
|
|
1583
|
+
value: a,
|
|
1584
1584
|
onUpload: r,
|
|
1585
|
-
onRemove:
|
|
1585
|
+
onRemove: o,
|
|
1586
1586
|
accept: l = "image/*",
|
|
1587
|
-
maxSize:
|
|
1588
|
-
placeholder:
|
|
1589
|
-
loading:
|
|
1590
|
-
size:
|
|
1591
|
-
label:
|
|
1592
|
-
error:
|
|
1587
|
+
maxSize: v,
|
|
1588
|
+
placeholder: d = "Selecionar imagem",
|
|
1589
|
+
loading: k = !1,
|
|
1590
|
+
size: h = "md",
|
|
1591
|
+
label: g,
|
|
1592
|
+
error: u,
|
|
1593
1593
|
disabled: x,
|
|
1594
|
-
className:
|
|
1595
|
-
...
|
|
1594
|
+
className: s,
|
|
1595
|
+
...S
|
|
1596
1596
|
}) => {
|
|
1597
|
-
const [
|
|
1598
|
-
sm:
|
|
1599
|
-
md:
|
|
1600
|
-
lg:
|
|
1601
|
-
},
|
|
1602
|
-
var
|
|
1603
|
-
const P = (
|
|
1597
|
+
const [L, M] = ne(null), [y, E] = ne(""), [N, C] = ne(!1), m = pe(null), R = !!a, F = !!L, I = R || F, b = k || N, V = {
|
|
1598
|
+
sm: e ? "w-16 h-16" : "w-24 h-16",
|
|
1599
|
+
md: e ? "w-24 h-24" : "w-32 h-24",
|
|
1600
|
+
lg: e ? "w-32 h-32" : "w-40 h-32"
|
|
1601
|
+
}, B = d || (e ? "Adicionar foto" : "Selecionar imagem"), J = (T) => {
|
|
1602
|
+
var $;
|
|
1603
|
+
const P = ($ = T.target.files) == null ? void 0 : $[0];
|
|
1604
1604
|
if (!P) return;
|
|
1605
|
-
if (
|
|
1606
|
-
alert(`Arquivo muito grande. Tamanho máximo: ${(
|
|
1605
|
+
if (v && P.size > v) {
|
|
1606
|
+
alert(`Arquivo muito grande. Tamanho máximo: ${(v / 1024 / 1024).toFixed(1)}MB`);
|
|
1607
1607
|
return;
|
|
1608
1608
|
}
|
|
1609
1609
|
const q = new FileReader();
|
|
1610
1610
|
q.onload = (Y) => {
|
|
1611
1611
|
var j;
|
|
1612
|
-
|
|
1612
|
+
E((j = Y.target) == null ? void 0 : j.result), M(P);
|
|
1613
1613
|
}, q.readAsDataURL(P);
|
|
1614
1614
|
}, Z = async () => {
|
|
1615
|
-
if (!(!
|
|
1615
|
+
if (!(!L || !r))
|
|
1616
1616
|
try {
|
|
1617
1617
|
C(!0);
|
|
1618
|
-
const
|
|
1619
|
-
|
|
1620
|
-
} catch (
|
|
1621
|
-
console.error("Erro ao fazer upload:",
|
|
1618
|
+
const T = await r(L);
|
|
1619
|
+
M(null), E(""), m.current && (m.current.value = "");
|
|
1620
|
+
} catch (T) {
|
|
1621
|
+
console.error("Erro ao fazer upload:", T), alert("Erro ao fazer upload da imagem");
|
|
1622
1622
|
} finally {
|
|
1623
1623
|
C(!1);
|
|
1624
1624
|
}
|
|
1625
1625
|
}, G = () => {
|
|
1626
|
-
|
|
1627
|
-
},
|
|
1626
|
+
M(null), E(""), m.current && (m.current.value = "");
|
|
1627
|
+
}, O = async () => {
|
|
1628
1628
|
try {
|
|
1629
|
-
|
|
1630
|
-
} catch (
|
|
1631
|
-
console.error("Erro ao remover imagem:",
|
|
1629
|
+
o && await o(a), M(null), E(""), m.current && (m.current.value = "");
|
|
1630
|
+
} catch (T) {
|
|
1631
|
+
console.error("Erro ao remover imagem:", T), alert("Erro ao remover imagem");
|
|
1632
1632
|
}
|
|
1633
|
-
},
|
|
1634
|
-
var
|
|
1635
|
-
x ||
|
|
1636
|
-
}, X =
|
|
1637
|
-
return /* @__PURE__ */
|
|
1633
|
+
}, z = () => {
|
|
1634
|
+
var T;
|
|
1635
|
+
x || b || (T = m.current) == null || T.click();
|
|
1636
|
+
}, X = y || a;
|
|
1637
|
+
return /* @__PURE__ */ n.createElement("div", { className: i("flex flex-col space-y-2", s) }, g && /* @__PURE__ */ n.createElement("label", { className: "text-sm font-medium text-gray-700" }, g), /* @__PURE__ */ n.createElement("div", { className: "relative flex flex-col items-center" }, /* @__PURE__ */ n.createElement(
|
|
1638
1638
|
"input",
|
|
1639
1639
|
{
|
|
1640
|
-
ref:
|
|
1640
|
+
ref: m,
|
|
1641
1641
|
type: "file",
|
|
1642
1642
|
accept: l,
|
|
1643
1643
|
onChange: J,
|
|
1644
|
-
disabled: x ||
|
|
1644
|
+
disabled: x || b,
|
|
1645
1645
|
className: "hidden",
|
|
1646
|
-
...
|
|
1646
|
+
...S
|
|
1647
1647
|
}
|
|
1648
|
-
), /* @__PURE__ */
|
|
1648
|
+
), /* @__PURE__ */ n.createElement(
|
|
1649
1649
|
"div",
|
|
1650
1650
|
{
|
|
1651
|
-
onClick:
|
|
1652
|
-
className:
|
|
1651
|
+
onClick: z,
|
|
1652
|
+
className: i(
|
|
1653
1653
|
// Base styles
|
|
1654
1654
|
"relative border-2 border-dashed border-gray-300 transition-colors cursor-pointer",
|
|
1655
1655
|
"hover:border-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",
|
|
1656
1656
|
// Shape
|
|
1657
|
-
|
|
1657
|
+
e ? "rounded-full" : "rounded-lg",
|
|
1658
1658
|
// Size
|
|
1659
|
-
V[
|
|
1659
|
+
V[h],
|
|
1660
1660
|
// States
|
|
1661
1661
|
x && "opacity-50 cursor-not-allowed",
|
|
1662
|
-
|
|
1663
|
-
|
|
1662
|
+
b && "cursor-wait",
|
|
1663
|
+
u && "border-red-300",
|
|
1664
1664
|
// Background
|
|
1665
|
-
!
|
|
1666
|
-
|
|
1665
|
+
!I && "bg-gray-50 hover:bg-gray-100",
|
|
1666
|
+
I && "border-solid border-gray-200"
|
|
1667
1667
|
)
|
|
1668
1668
|
},
|
|
1669
|
-
|
|
1669
|
+
I ? (
|
|
1670
1670
|
// Preview da imagem
|
|
1671
|
-
/* @__PURE__ */
|
|
1671
|
+
/* @__PURE__ */ n.createElement(
|
|
1672
1672
|
"img",
|
|
1673
1673
|
{
|
|
1674
1674
|
src: X,
|
|
1675
1675
|
alt: "Preview",
|
|
1676
|
-
className:
|
|
1676
|
+
className: i(
|
|
1677
1677
|
"w-full h-full object-cover",
|
|
1678
|
-
|
|
1678
|
+
e ? "rounded-full" : "rounded-lg"
|
|
1679
1679
|
)
|
|
1680
1680
|
}
|
|
1681
1681
|
)
|
|
1682
1682
|
) : (
|
|
1683
1683
|
// Estado vazio
|
|
1684
|
-
/* @__PURE__ */
|
|
1684
|
+
/* @__PURE__ */ n.createElement("div", { className: "flex flex-col items-center justify-center h-full text-gray-500 text-sm" }, e ? (
|
|
1685
1685
|
// Ícone de usuário para avatar
|
|
1686
|
-
/* @__PURE__ */
|
|
1686
|
+
/* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
|
|
1687
1687
|
"svg",
|
|
1688
1688
|
{
|
|
1689
1689
|
className: "w-8 h-8 mb-1",
|
|
@@ -1691,7 +1691,7 @@ const rt = ({
|
|
|
1691
1691
|
stroke: "currentColor",
|
|
1692
1692
|
viewBox: "0 0 24 24"
|
|
1693
1693
|
},
|
|
1694
|
-
/* @__PURE__ */
|
|
1694
|
+
/* @__PURE__ */ n.createElement(
|
|
1695
1695
|
"path",
|
|
1696
1696
|
{
|
|
1697
1697
|
strokeLinecap: "round",
|
|
@@ -1700,10 +1700,10 @@ const rt = ({
|
|
|
1700
1700
|
d: "M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"
|
|
1701
1701
|
}
|
|
1702
1702
|
)
|
|
1703
|
-
), /* @__PURE__ */
|
|
1703
|
+
), /* @__PURE__ */ n.createElement("span", { className: "text-center px-2 text-xs" }, B))
|
|
1704
1704
|
) : (
|
|
1705
1705
|
// Ícone de adicionar imagem genérica
|
|
1706
|
-
/* @__PURE__ */
|
|
1706
|
+
/* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
|
|
1707
1707
|
"svg",
|
|
1708
1708
|
{
|
|
1709
1709
|
className: "w-6 h-6 mb-1",
|
|
@@ -1711,7 +1711,7 @@ const rt = ({
|
|
|
1711
1711
|
stroke: "currentColor",
|
|
1712
1712
|
viewBox: "0 0 24 24"
|
|
1713
1713
|
},
|
|
1714
|
-
/* @__PURE__ */
|
|
1714
|
+
/* @__PURE__ */ n.createElement(
|
|
1715
1715
|
"path",
|
|
1716
1716
|
{
|
|
1717
1717
|
strokeLinecap: "round",
|
|
@@ -1720,16 +1720,16 @@ const rt = ({
|
|
|
1720
1720
|
d: "M12 6v6m0 0v6m0-6h6m-6 0H6"
|
|
1721
1721
|
}
|
|
1722
1722
|
)
|
|
1723
|
-
), /* @__PURE__ */
|
|
1723
|
+
), /* @__PURE__ */ n.createElement("span", { className: "text-center px-2" }, B))
|
|
1724
1724
|
))
|
|
1725
1725
|
),
|
|
1726
|
-
|
|
1726
|
+
b && /* @__PURE__ */ n.createElement("div", { className: i(
|
|
1727
1727
|
"absolute inset-0 bg-black bg-opacity-50 flex items-center justify-center",
|
|
1728
|
-
|
|
1729
|
-
) }, /* @__PURE__ */
|
|
1730
|
-
),
|
|
1728
|
+
e ? "rounded-full" : "rounded-lg"
|
|
1729
|
+
) }, /* @__PURE__ */ n.createElement("div", { className: "w-6 h-6 border-2 border-white border-t-transparent rounded-full animate-spin" }))
|
|
1730
|
+
), I && !b && /* @__PURE__ */ n.createElement("div", { className: "flex justify-center space-x-2 mt-3" }, F ? (
|
|
1731
1731
|
// Ações para arquivo selecionado (não salvo ainda)
|
|
1732
|
-
/* @__PURE__ */
|
|
1732
|
+
/* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
|
|
1733
1733
|
"button",
|
|
1734
1734
|
{
|
|
1735
1735
|
onClick: Z,
|
|
@@ -1737,7 +1737,7 @@ const rt = ({
|
|
|
1737
1737
|
className: "px-3 py-1 bg-blue-600 text-white text-sm rounded hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed"
|
|
1738
1738
|
},
|
|
1739
1739
|
"Confirmar"
|
|
1740
|
-
), /* @__PURE__ */
|
|
1740
|
+
), /* @__PURE__ */ n.createElement(
|
|
1741
1741
|
"button",
|
|
1742
1742
|
{
|
|
1743
1743
|
onClick: G,
|
|
@@ -1747,44 +1747,44 @@ const rt = ({
|
|
|
1747
1747
|
))
|
|
1748
1748
|
) : (
|
|
1749
1749
|
// Ações para imagem já salva
|
|
1750
|
-
/* @__PURE__ */
|
|
1750
|
+
/* @__PURE__ */ n.createElement(
|
|
1751
1751
|
"button",
|
|
1752
1752
|
{
|
|
1753
|
-
onClick:
|
|
1754
|
-
disabled: !
|
|
1753
|
+
onClick: O,
|
|
1754
|
+
disabled: !o,
|
|
1755
1755
|
className: "px-3 py-1 bg-red-600 text-white text-sm rounded hover:bg-red-700 disabled:opacity-50 disabled:cursor-not-allowed"
|
|
1756
1756
|
},
|
|
1757
1757
|
"Remover"
|
|
1758
1758
|
)
|
|
1759
|
-
))),
|
|
1760
|
-
},
|
|
1761
|
-
const
|
|
1762
|
-
if (!
|
|
1759
|
+
))), u && /* @__PURE__ */ n.createElement("p", { className: "text-sm text-red-600" }, u), v && !I && /* @__PURE__ */ n.createElement("p", { className: "text-xs text-gray-500" }, "Tamanho máximo: ", (v / 1024 / 1024).toFixed(1), "MB"), e && !I && /* @__PURE__ */ n.createElement("p", { className: "text-xs text-gray-500 text-center" }, "Use uma foto com seu rosto centralizado e bem visível"));
|
|
1760
|
+
}, Ie = n.createContext(null), Xe = () => {
|
|
1761
|
+
const e = n.useContext(Ie);
|
|
1762
|
+
if (!e)
|
|
1763
1763
|
throw new Error("AccordionItem must be used within an Accordion");
|
|
1764
|
-
return
|
|
1764
|
+
return e;
|
|
1765
1765
|
};
|
|
1766
|
-
let
|
|
1767
|
-
const
|
|
1768
|
-
title:
|
|
1769
|
-
children:
|
|
1766
|
+
let Pe = 0;
|
|
1767
|
+
const Te = ({
|
|
1768
|
+
title: e,
|
|
1769
|
+
children: a,
|
|
1770
1770
|
defaultOpen: r = !1,
|
|
1771
|
-
disabled:
|
|
1771
|
+
disabled: o = !1,
|
|
1772
1772
|
className: l,
|
|
1773
|
-
headerClassName:
|
|
1774
|
-
contentClassName:
|
|
1775
|
-
icon:
|
|
1773
|
+
headerClassName: v,
|
|
1774
|
+
contentClassName: d,
|
|
1775
|
+
icon: k
|
|
1776
1776
|
}) => {
|
|
1777
|
-
const { openItems:
|
|
1778
|
-
|
|
1779
|
-
if (
|
|
1780
|
-
const C =
|
|
1781
|
-
C &&
|
|
1777
|
+
const { openItems: h, toggleItem: g, variant: u } = Xe(), [x] = ne(() => Pe++), s = h.has(x), S = pe(null), [L, M] = ne(r ? void 0 : 0);
|
|
1778
|
+
ve(() => {
|
|
1779
|
+
if (s) {
|
|
1780
|
+
const C = S.current;
|
|
1781
|
+
C && M(C.scrollHeight);
|
|
1782
1782
|
} else
|
|
1783
|
-
|
|
1784
|
-
}, [
|
|
1785
|
-
const
|
|
1786
|
-
|
|
1787
|
-
},
|
|
1783
|
+
M(0);
|
|
1784
|
+
}, [s]);
|
|
1785
|
+
const y = () => {
|
|
1786
|
+
o || g(x);
|
|
1787
|
+
}, N = {
|
|
1788
1788
|
default: {
|
|
1789
1789
|
item: "border-b border-[var(--accordion-border,#e5e7eb)] last:border-b-0",
|
|
1790
1790
|
header: "",
|
|
@@ -1800,122 +1800,457 @@ const Be = ({
|
|
|
1800
1800
|
header: "",
|
|
1801
1801
|
content: ""
|
|
1802
1802
|
}
|
|
1803
|
-
}[
|
|
1804
|
-
return /* @__PURE__ */
|
|
1803
|
+
}[u];
|
|
1804
|
+
return /* @__PURE__ */ n.createElement("div", { className: i(N.item, l) }, /* @__PURE__ */ n.createElement(
|
|
1805
1805
|
"button",
|
|
1806
1806
|
{
|
|
1807
1807
|
type: "button",
|
|
1808
|
-
onClick:
|
|
1809
|
-
disabled:
|
|
1810
|
-
"aria-expanded":
|
|
1811
|
-
className:
|
|
1808
|
+
onClick: y,
|
|
1809
|
+
disabled: o,
|
|
1810
|
+
"aria-expanded": s,
|
|
1811
|
+
className: i(
|
|
1812
1812
|
"w-full flex items-center justify-between px-4 py-3 text-left transition-colors",
|
|
1813
1813
|
"bg-[var(--accordion-header-bg,transparent)]",
|
|
1814
1814
|
"hover:bg-[var(--accordion-header-hover,rgba(0,0,0,0.05))]",
|
|
1815
1815
|
"text-[var(--accordion-text,#111827)]",
|
|
1816
1816
|
"font-medium",
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1817
|
+
o && "opacity-50 cursor-not-allowed",
|
|
1818
|
+
s && u !== "default" && N.header,
|
|
1819
|
+
v
|
|
1820
1820
|
)
|
|
1821
1821
|
},
|
|
1822
|
-
/* @__PURE__ */
|
|
1823
|
-
/* @__PURE__ */
|
|
1822
|
+
/* @__PURE__ */ n.createElement("span", { className: "flex items-center gap-2" }, k && /* @__PURE__ */ n.createElement("span", { className: "flex-shrink-0" }, k), e),
|
|
1823
|
+
/* @__PURE__ */ n.createElement(
|
|
1824
1824
|
"svg",
|
|
1825
1825
|
{
|
|
1826
|
-
className:
|
|
1826
|
+
className: i(
|
|
1827
1827
|
"w-5 h-5 transition-transform duration-200 flex-shrink-0",
|
|
1828
1828
|
"text-[var(--accordion-icon,#6b7280)]",
|
|
1829
|
-
|
|
1829
|
+
s && "rotate-180"
|
|
1830
1830
|
),
|
|
1831
1831
|
fill: "none",
|
|
1832
1832
|
strokeWidth: "2",
|
|
1833
1833
|
stroke: "currentColor",
|
|
1834
1834
|
viewBox: "0 0 24 24"
|
|
1835
1835
|
},
|
|
1836
|
-
/* @__PURE__ */
|
|
1836
|
+
/* @__PURE__ */ n.createElement("path", { d: "M19 9l-7 7-7-7" })
|
|
1837
1837
|
)
|
|
1838
|
-
), /* @__PURE__ */
|
|
1838
|
+
), /* @__PURE__ */ n.createElement(
|
|
1839
1839
|
"div",
|
|
1840
1840
|
{
|
|
1841
1841
|
style: {
|
|
1842
|
-
height:
|
|
1842
|
+
height: L,
|
|
1843
1843
|
overflow: "hidden",
|
|
1844
1844
|
transition: "height 0.3s ease-in-out"
|
|
1845
1845
|
}
|
|
1846
1846
|
},
|
|
1847
|
-
/* @__PURE__ */
|
|
1847
|
+
/* @__PURE__ */ n.createElement(
|
|
1848
1848
|
"div",
|
|
1849
1849
|
{
|
|
1850
|
-
ref:
|
|
1851
|
-
className:
|
|
1850
|
+
ref: S,
|
|
1851
|
+
className: i(
|
|
1852
1852
|
"px-4 py-3",
|
|
1853
1853
|
"text-[var(--accordion-content-text,#374151)]",
|
|
1854
1854
|
"bg-[var(--accordion-content-bg,transparent)]",
|
|
1855
|
-
|
|
1855
|
+
d
|
|
1856
1856
|
)
|
|
1857
1857
|
},
|
|
1858
|
-
|
|
1858
|
+
a
|
|
1859
1859
|
)
|
|
1860
1860
|
));
|
|
1861
1861
|
};
|
|
1862
|
-
|
|
1863
|
-
const
|
|
1864
|
-
children:
|
|
1865
|
-
type:
|
|
1862
|
+
Te.displayName = "AccordionItem";
|
|
1863
|
+
const Ze = ({
|
|
1864
|
+
children: e,
|
|
1865
|
+
type: a = "single",
|
|
1866
1866
|
className: r,
|
|
1867
|
-
variant:
|
|
1867
|
+
variant: o = "default",
|
|
1868
1868
|
collapsible: l = !0
|
|
1869
1869
|
}) => {
|
|
1870
|
-
const [
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
const
|
|
1874
|
-
if (
|
|
1875
|
-
|
|
1876
|
-
}),
|
|
1877
|
-
const
|
|
1878
|
-
|
|
1870
|
+
const [v, d] = ne(/* @__PURE__ */ new Set());
|
|
1871
|
+
ve(() => {
|
|
1872
|
+
Pe = 0;
|
|
1873
|
+
const h = n.Children.toArray(e), g = /* @__PURE__ */ new Set();
|
|
1874
|
+
if (h.forEach((u, x) => {
|
|
1875
|
+
n.isValidElement(u) && u.props.defaultOpen && g.add(x);
|
|
1876
|
+
}), a === "single" && g.size > 1) {
|
|
1877
|
+
const u = Array.from(g)[0];
|
|
1878
|
+
d(/* @__PURE__ */ new Set([u]));
|
|
1879
1879
|
} else
|
|
1880
|
-
|
|
1881
|
-
}, [
|
|
1882
|
-
const
|
|
1883
|
-
|
|
1884
|
-
const
|
|
1885
|
-
return
|
|
1880
|
+
d(g);
|
|
1881
|
+
}, [e, a]);
|
|
1882
|
+
const k = (h) => {
|
|
1883
|
+
d((g) => {
|
|
1884
|
+
const u = new Set(g);
|
|
1885
|
+
return a === "single" ? u.has(h) ? l && u.clear() : (u.clear(), u.add(h)) : u.has(h) ? u.delete(h) : u.add(h), u;
|
|
1886
1886
|
});
|
|
1887
1887
|
};
|
|
1888
|
-
return /* @__PURE__ */
|
|
1889
|
-
|
|
1888
|
+
return /* @__PURE__ */ n.createElement(
|
|
1889
|
+
Ie.Provider,
|
|
1890
|
+
{
|
|
1891
|
+
value: { type: a, openItems: v, toggleItem: k, collapsible: l, variant: o }
|
|
1892
|
+
},
|
|
1893
|
+
/* @__PURE__ */ n.createElement("div", { className: i("w-full", r) }, e)
|
|
1894
|
+
);
|
|
1895
|
+
};
|
|
1896
|
+
Ze.Item = Te;
|
|
1897
|
+
const he = ({
|
|
1898
|
+
open: e,
|
|
1899
|
+
onClose: a,
|
|
1900
|
+
size: r = "md",
|
|
1901
|
+
closeOnOverlayClick: o = !0,
|
|
1902
|
+
closeOnEscape: l = !0,
|
|
1903
|
+
showCloseButton: v = !0,
|
|
1904
|
+
children: d,
|
|
1905
|
+
className: k = "",
|
|
1906
|
+
...h
|
|
1907
|
+
}) => {
|
|
1908
|
+
const g = typeof document < "u" ? document.body : null;
|
|
1909
|
+
n.useEffect(() => {
|
|
1910
|
+
if (!e || !l) return;
|
|
1911
|
+
const s = (S) => {
|
|
1912
|
+
S.key === "Escape" && a();
|
|
1913
|
+
};
|
|
1914
|
+
return document.addEventListener("keydown", s), () => document.removeEventListener("keydown", s);
|
|
1915
|
+
}, [e, l, a]), n.useEffect(() => (e ? document.body.style.overflow = "hidden" : document.body.style.overflow = "", () => {
|
|
1916
|
+
document.body.style.overflow = "";
|
|
1917
|
+
}), [e]);
|
|
1918
|
+
const u = {
|
|
1919
|
+
sm: "max-w-sm",
|
|
1920
|
+
md: "max-w-md",
|
|
1921
|
+
lg: "max-w-lg",
|
|
1922
|
+
xl: "max-w-xl",
|
|
1923
|
+
full: "max-w-full mx-4"
|
|
1924
|
+
};
|
|
1925
|
+
if (!g || !e) return null;
|
|
1926
|
+
const x = /* @__PURE__ */ n.createElement(
|
|
1927
|
+
"div",
|
|
1928
|
+
{
|
|
1929
|
+
className: i(
|
|
1930
|
+
"fixed inset-0 z-50 flex items-center justify-center p-4",
|
|
1931
|
+
e ? "pointer-events-auto" : "pointer-events-none"
|
|
1932
|
+
)
|
|
1933
|
+
},
|
|
1934
|
+
/* @__PURE__ */ n.createElement(
|
|
1935
|
+
"div",
|
|
1936
|
+
{
|
|
1937
|
+
className: i(
|
|
1938
|
+
"absolute inset-0 bg-black/50 transition-opacity duration-200",
|
|
1939
|
+
e ? "opacity-100" : "opacity-0"
|
|
1940
|
+
),
|
|
1941
|
+
onClick: (s) => {
|
|
1942
|
+
o && s.target === s.currentTarget && a();
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
1945
|
+
),
|
|
1946
|
+
/* @__PURE__ */ n.createElement(
|
|
1947
|
+
"div",
|
|
1948
|
+
{
|
|
1949
|
+
role: "dialog",
|
|
1950
|
+
"aria-modal": !0,
|
|
1951
|
+
className: i(
|
|
1952
|
+
"relative bg-white rounded-lg shadow-xl w-full transition-all duration-200",
|
|
1953
|
+
u[r],
|
|
1954
|
+
e ? "scale-100 opacity-100" : "scale-95 opacity-0",
|
|
1955
|
+
k
|
|
1956
|
+
),
|
|
1957
|
+
...h
|
|
1958
|
+
},
|
|
1959
|
+
v && /* @__PURE__ */ n.createElement(
|
|
1960
|
+
"button",
|
|
1961
|
+
{
|
|
1962
|
+
onClick: a,
|
|
1963
|
+
className: "absolute top-4 right-4 text-gray-400 hover:text-gray-600 transition-colors",
|
|
1964
|
+
"aria-label": "Fechar modal"
|
|
1965
|
+
},
|
|
1966
|
+
/* @__PURE__ */ n.createElement(
|
|
1967
|
+
"svg",
|
|
1968
|
+
{
|
|
1969
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1970
|
+
className: "h-6 w-6",
|
|
1971
|
+
fill: "none",
|
|
1972
|
+
viewBox: "0 0 24 24",
|
|
1973
|
+
stroke: "currentColor"
|
|
1974
|
+
},
|
|
1975
|
+
/* @__PURE__ */ n.createElement(
|
|
1976
|
+
"path",
|
|
1977
|
+
{
|
|
1978
|
+
strokeLinecap: "round",
|
|
1979
|
+
strokeLinejoin: "round",
|
|
1980
|
+
strokeWidth: 2,
|
|
1981
|
+
d: "M6 18L18 6M6 6l12 12"
|
|
1982
|
+
}
|
|
1983
|
+
)
|
|
1984
|
+
)
|
|
1985
|
+
),
|
|
1986
|
+
/* @__PURE__ */ n.createElement("div", { className: "p-6" }, d)
|
|
1987
|
+
)
|
|
1988
|
+
);
|
|
1989
|
+
return be(x, g);
|
|
1990
|
+
};
|
|
1991
|
+
he.Header = function({
|
|
1992
|
+
children: a,
|
|
1993
|
+
className: r = "",
|
|
1994
|
+
...o
|
|
1995
|
+
}) {
|
|
1996
|
+
return /* @__PURE__ */ n.createElement("div", { className: i("mb-4 pr-8", r), ...o }, a);
|
|
1997
|
+
};
|
|
1998
|
+
he.Body = function({
|
|
1999
|
+
children: a,
|
|
2000
|
+
className: r = "",
|
|
2001
|
+
...o
|
|
2002
|
+
}) {
|
|
2003
|
+
return /* @__PURE__ */ n.createElement("div", { className: i("mb-4", r), ...o }, a);
|
|
2004
|
+
};
|
|
2005
|
+
he.Footer = function({
|
|
2006
|
+
children: a,
|
|
2007
|
+
className: r = "",
|
|
2008
|
+
...o
|
|
2009
|
+
}) {
|
|
2010
|
+
return /* @__PURE__ */ n.createElement(
|
|
2011
|
+
"div",
|
|
2012
|
+
{
|
|
2013
|
+
className: i("flex justify-end gap-2 mt-6 pt-4 border-t border-gray-200", r),
|
|
2014
|
+
...o
|
|
2015
|
+
},
|
|
2016
|
+
a
|
|
2017
|
+
);
|
|
2018
|
+
};
|
|
2019
|
+
const _e = $e(null), ut = ({
|
|
2020
|
+
children: e,
|
|
2021
|
+
position: a = "top-right",
|
|
2022
|
+
maxToasts: r = 5
|
|
2023
|
+
}) => {
|
|
2024
|
+
const [o, l] = ne([]), v = ge(
|
|
2025
|
+
(h) => {
|
|
2026
|
+
const g = `toast-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`, u = { ...h, id: g };
|
|
2027
|
+
if (l((x) => [...x, u].slice(-r)), h.duration !== 0) {
|
|
2028
|
+
const x = h.duration || 5e3;
|
|
2029
|
+
setTimeout(() => {
|
|
2030
|
+
var s;
|
|
2031
|
+
d(g), (s = h.onClose) == null || s.call(h);
|
|
2032
|
+
}, x);
|
|
2033
|
+
}
|
|
2034
|
+
return g;
|
|
2035
|
+
},
|
|
2036
|
+
[r]
|
|
2037
|
+
), d = ge((h) => {
|
|
2038
|
+
l((g) => g.filter((u) => u.id !== h));
|
|
2039
|
+
}, []), k = ge(() => {
|
|
2040
|
+
l([]);
|
|
2041
|
+
}, []);
|
|
2042
|
+
return /* @__PURE__ */ n.createElement(_e.Provider, { value: { toasts: o, addToast: v, removeToast: d, clearAll: k } }, e, /* @__PURE__ */ n.createElement(tt, { toasts: o, position: a, onClose: d }));
|
|
2043
|
+
}, et = () => {
|
|
2044
|
+
const e = We(_e);
|
|
2045
|
+
if (!e)
|
|
2046
|
+
throw new Error("useToaster must be used within ToasterProvider");
|
|
2047
|
+
return e;
|
|
2048
|
+
}, mt = () => {
|
|
2049
|
+
const { addToast: e } = et();
|
|
2050
|
+
return {
|
|
2051
|
+
toast: (a, r) => e({ message: a, ...r }),
|
|
2052
|
+
success: (a, r) => e({ message: a, variant: "success", duration: r }),
|
|
2053
|
+
error: (a, r) => e({ message: a, variant: "error", duration: r }),
|
|
2054
|
+
warning: (a, r) => e({ message: a, variant: "warning", duration: r }),
|
|
2055
|
+
info: (a, r) => e({ message: a, variant: "info", duration: r })
|
|
2056
|
+
};
|
|
2057
|
+
}, tt = ({
|
|
2058
|
+
toasts: e,
|
|
2059
|
+
position: a,
|
|
2060
|
+
onClose: r
|
|
2061
|
+
}) => {
|
|
2062
|
+
const o = typeof document < "u" ? document.body : null;
|
|
2063
|
+
if (!o || e.length === 0) return null;
|
|
2064
|
+
const l = {
|
|
2065
|
+
"top-left": "top-4 left-4 items-start",
|
|
2066
|
+
"top-center": "top-4 left-1/2 -translate-x-1/2 items-center",
|
|
2067
|
+
"top-right": "top-4 right-4 items-end",
|
|
2068
|
+
"bottom-left": "bottom-4 left-4 items-start",
|
|
2069
|
+
"bottom-center": "bottom-4 left-1/2 -translate-x-1/2 items-center",
|
|
2070
|
+
"bottom-right": "bottom-4 right-4 items-end"
|
|
2071
|
+
}, v = /* @__PURE__ */ n.createElement(
|
|
2072
|
+
"div",
|
|
2073
|
+
{
|
|
2074
|
+
className: i(
|
|
2075
|
+
"fixed z-[100] flex flex-col gap-2 pointer-events-none",
|
|
2076
|
+
l[a]
|
|
2077
|
+
),
|
|
2078
|
+
style: { maxWidth: "calc(100vw - 2rem)" }
|
|
2079
|
+
},
|
|
2080
|
+
e.map((d) => /* @__PURE__ */ n.createElement(rt, { key: d.id, toast: d, onClose: r }))
|
|
2081
|
+
);
|
|
2082
|
+
return be(v, o);
|
|
2083
|
+
}, rt = ({ toast: e, onClose: a }) => {
|
|
2084
|
+
const [r, o] = ne(!1), l = () => {
|
|
2085
|
+
o(!0), setTimeout(() => {
|
|
2086
|
+
var h;
|
|
2087
|
+
a(e.id), (h = e.onClose) == null || h.call(e);
|
|
2088
|
+
}, 200);
|
|
2089
|
+
}, v = {
|
|
2090
|
+
success: "bg-green-50 text-green-800 border-green-200",
|
|
2091
|
+
error: "bg-red-50 text-red-800 border-red-200",
|
|
2092
|
+
warning: "bg-yellow-50 text-yellow-800 border-yellow-200",
|
|
2093
|
+
info: "bg-blue-50 text-blue-800 border-blue-200",
|
|
2094
|
+
default: "bg-white text-gray-800 border-gray-200"
|
|
2095
|
+
}, d = {
|
|
2096
|
+
success: /* @__PURE__ */ n.createElement(
|
|
2097
|
+
"svg",
|
|
2098
|
+
{
|
|
2099
|
+
className: "w-5 h-5 text-green-600",
|
|
2100
|
+
fill: "none",
|
|
2101
|
+
viewBox: "0 0 24 24",
|
|
2102
|
+
stroke: "currentColor"
|
|
2103
|
+
},
|
|
2104
|
+
/* @__PURE__ */ n.createElement(
|
|
2105
|
+
"path",
|
|
2106
|
+
{
|
|
2107
|
+
strokeLinecap: "round",
|
|
2108
|
+
strokeLinejoin: "round",
|
|
2109
|
+
strokeWidth: 2,
|
|
2110
|
+
d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
2111
|
+
}
|
|
2112
|
+
)
|
|
2113
|
+
),
|
|
2114
|
+
error: /* @__PURE__ */ n.createElement(
|
|
2115
|
+
"svg",
|
|
2116
|
+
{
|
|
2117
|
+
className: "w-5 h-5 text-red-600",
|
|
2118
|
+
fill: "none",
|
|
2119
|
+
viewBox: "0 0 24 24",
|
|
2120
|
+
stroke: "currentColor"
|
|
2121
|
+
},
|
|
2122
|
+
/* @__PURE__ */ n.createElement(
|
|
2123
|
+
"path",
|
|
2124
|
+
{
|
|
2125
|
+
strokeLinecap: "round",
|
|
2126
|
+
strokeLinejoin: "round",
|
|
2127
|
+
strokeWidth: 2,
|
|
2128
|
+
d: "M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
2129
|
+
}
|
|
2130
|
+
)
|
|
2131
|
+
),
|
|
2132
|
+
warning: /* @__PURE__ */ n.createElement(
|
|
2133
|
+
"svg",
|
|
2134
|
+
{
|
|
2135
|
+
className: "w-5 h-5 text-yellow-600",
|
|
2136
|
+
fill: "none",
|
|
2137
|
+
viewBox: "0 0 24 24",
|
|
2138
|
+
stroke: "currentColor"
|
|
2139
|
+
},
|
|
2140
|
+
/* @__PURE__ */ n.createElement(
|
|
2141
|
+
"path",
|
|
2142
|
+
{
|
|
2143
|
+
strokeLinecap: "round",
|
|
2144
|
+
strokeLinejoin: "round",
|
|
2145
|
+
strokeWidth: 2,
|
|
2146
|
+
d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
|
|
2147
|
+
}
|
|
2148
|
+
)
|
|
2149
|
+
),
|
|
2150
|
+
info: /* @__PURE__ */ n.createElement(
|
|
2151
|
+
"svg",
|
|
2152
|
+
{
|
|
2153
|
+
className: "w-5 h-5 text-blue-600",
|
|
2154
|
+
fill: "none",
|
|
2155
|
+
viewBox: "0 0 24 24",
|
|
2156
|
+
stroke: "currentColor"
|
|
2157
|
+
},
|
|
2158
|
+
/* @__PURE__ */ n.createElement(
|
|
2159
|
+
"path",
|
|
2160
|
+
{
|
|
2161
|
+
strokeLinecap: "round",
|
|
2162
|
+
strokeLinejoin: "round",
|
|
2163
|
+
strokeWidth: 2,
|
|
2164
|
+
d: "M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
2165
|
+
}
|
|
2166
|
+
)
|
|
2167
|
+
),
|
|
2168
|
+
default: /* @__PURE__ */ n.createElement(
|
|
2169
|
+
"svg",
|
|
2170
|
+
{
|
|
2171
|
+
className: "w-5 h-5 text-gray-600",
|
|
2172
|
+
fill: "none",
|
|
2173
|
+
viewBox: "0 0 24 24",
|
|
2174
|
+
stroke: "currentColor"
|
|
2175
|
+
},
|
|
2176
|
+
/* @__PURE__ */ n.createElement(
|
|
2177
|
+
"path",
|
|
2178
|
+
{
|
|
2179
|
+
strokeLinecap: "round",
|
|
2180
|
+
strokeLinejoin: "round",
|
|
2181
|
+
strokeWidth: 2,
|
|
2182
|
+
d: "M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
2183
|
+
}
|
|
2184
|
+
)
|
|
2185
|
+
)
|
|
2186
|
+
}, k = e.variant || "default";
|
|
2187
|
+
return /* @__PURE__ */ n.createElement(
|
|
2188
|
+
"div",
|
|
1890
2189
|
{
|
|
1891
|
-
|
|
2190
|
+
role: "alert",
|
|
2191
|
+
className: i(
|
|
2192
|
+
"pointer-events-auto flex items-start gap-3 px-4 py-3 rounded-lg border shadow-lg min-w-[300px] max-w-[500px]",
|
|
2193
|
+
"transition-all duration-200 ease-in-out",
|
|
2194
|
+
r ? "opacity-0 scale-95 translate-x-4" : "opacity-100 scale-100 translate-x-0",
|
|
2195
|
+
v[k]
|
|
2196
|
+
)
|
|
1892
2197
|
},
|
|
1893
|
-
/* @__PURE__ */
|
|
2198
|
+
/* @__PURE__ */ n.createElement("div", { className: "flex-shrink-0 mt-0.5" }, d[k]),
|
|
2199
|
+
/* @__PURE__ */ n.createElement("p", { className: "flex-1 text-sm font-medium leading-relaxed" }, e.message),
|
|
2200
|
+
/* @__PURE__ */ n.createElement(
|
|
2201
|
+
"button",
|
|
2202
|
+
{
|
|
2203
|
+
onClick: l,
|
|
2204
|
+
className: "flex-shrink-0 text-current opacity-60 hover:opacity-100 transition-opacity",
|
|
2205
|
+
"aria-label": "Fechar notificação"
|
|
2206
|
+
},
|
|
2207
|
+
/* @__PURE__ */ n.createElement(
|
|
2208
|
+
"svg",
|
|
2209
|
+
{
|
|
2210
|
+
className: "w-4 h-4",
|
|
2211
|
+
fill: "none",
|
|
2212
|
+
viewBox: "0 0 24 24",
|
|
2213
|
+
stroke: "currentColor"
|
|
2214
|
+
},
|
|
2215
|
+
/* @__PURE__ */ n.createElement(
|
|
2216
|
+
"path",
|
|
2217
|
+
{
|
|
2218
|
+
strokeLinecap: "round",
|
|
2219
|
+
strokeLinejoin: "round",
|
|
2220
|
+
strokeWidth: 2,
|
|
2221
|
+
d: "M6 18L18 6M6 6l12 12"
|
|
2222
|
+
}
|
|
2223
|
+
)
|
|
2224
|
+
)
|
|
2225
|
+
)
|
|
1894
2226
|
);
|
|
1895
2227
|
};
|
|
1896
|
-
qe.Item = Be;
|
|
1897
2228
|
export {
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
2229
|
+
Ze as Accordion,
|
|
2230
|
+
Te as AccordionItem,
|
|
2231
|
+
Qe as AsideSheet,
|
|
2232
|
+
Ue as AsyncSelect,
|
|
2233
|
+
lt as Button,
|
|
2234
|
+
st as Card,
|
|
2235
|
+
Ce as CardBody,
|
|
2236
|
+
ke as CardFooter,
|
|
2237
|
+
Ne as CardHeader,
|
|
2238
|
+
dt as ImageInput,
|
|
2239
|
+
He as Input,
|
|
2240
|
+
he as Modal,
|
|
2241
|
+
Ge as MultiAsyncSelect,
|
|
2242
|
+
Ye as MultiSelect,
|
|
2243
|
+
Ke as RadioGroup,
|
|
2244
|
+
De as Select,
|
|
2245
|
+
it as Table,
|
|
2246
|
+
Me as TableBody,
|
|
2247
|
+
Be as TableCell,
|
|
1916
2248
|
Re as TableFooter,
|
|
1917
|
-
|
|
2249
|
+
Le as TableHeader,
|
|
1918
2250
|
Fe as TableRow,
|
|
1919
|
-
|
|
1920
|
-
|
|
2251
|
+
je as Textarea,
|
|
2252
|
+
ut as ToasterProvider,
|
|
2253
|
+
ct as Tooltip,
|
|
2254
|
+
mt as useToast,
|
|
2255
|
+
et as useToaster
|
|
1921
2256
|
};
|