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