@sigep/react 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +294 -2
- package/dist/index.d.ts +294 -2
- package/dist/index.js +483 -125
- package/dist/index.mjs +482 -125
- package/package.json +4 -3
package/dist/index.js
CHANGED
|
@@ -20,7 +20,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
Avatar: () => Avatar,
|
|
23
24
|
Button: () => Button,
|
|
25
|
+
Card: () => Card,
|
|
24
26
|
InputCNPJ: () => InputCNPJ,
|
|
25
27
|
InputCPF: () => InputCPF,
|
|
26
28
|
InputCep: () => InputCep,
|
|
@@ -33,23 +35,72 @@ __export(index_exports, {
|
|
|
33
35
|
InputRadio: () => InputRadio,
|
|
34
36
|
InputString: () => InputString,
|
|
35
37
|
InputWrapper: () => InputWrapper,
|
|
38
|
+
Modal: () => Modal,
|
|
36
39
|
Textarea: () => Textarea,
|
|
40
|
+
Tooltip: () => Tooltip,
|
|
41
|
+
avatar: () => avatar,
|
|
37
42
|
button: () => button,
|
|
43
|
+
card: () => card,
|
|
38
44
|
maskCEP: () => maskCEP,
|
|
39
45
|
maskCNPJ: () => maskCNPJ,
|
|
40
46
|
maskCPF: () => maskCPF,
|
|
41
47
|
maskCurrency: () => maskCurrency,
|
|
42
48
|
maskPhone: () => maskPhone,
|
|
49
|
+
modal: () => modal,
|
|
50
|
+
tooltip: () => tooltip,
|
|
43
51
|
unmask: () => unmask,
|
|
44
52
|
unmaskCurrency: () => unmaskCurrency
|
|
45
53
|
});
|
|
46
54
|
module.exports = __toCommonJS(index_exports);
|
|
47
55
|
|
|
48
|
-
// src/components/
|
|
56
|
+
// src/components/Avatar/index.tsx
|
|
49
57
|
var import_react = require("react");
|
|
50
58
|
var import_tailwind_variants = require("tailwind-variants");
|
|
51
59
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
52
|
-
var
|
|
60
|
+
var avatar = (0, import_tailwind_variants.tv)({
|
|
61
|
+
base: "inline-flex items-center justify-center rounded-full font-medium select-none overflow-hidden",
|
|
62
|
+
variants: {
|
|
63
|
+
size: {
|
|
64
|
+
sm: "h-8 w-8 text-xs",
|
|
65
|
+
md: "h-10 w-10 text-sm",
|
|
66
|
+
lg: "h-12 w-12 text-base",
|
|
67
|
+
xl: "h-16 w-16 text-lg"
|
|
68
|
+
},
|
|
69
|
+
variant: {
|
|
70
|
+
primary: "bg-blue-600 text-white",
|
|
71
|
+
secondary: "bg-gray-200 text-gray-700",
|
|
72
|
+
outline: "bg-white text-blue-600 ring-2 ring-blue-600 ring-offset-2"
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
defaultVariants: {
|
|
76
|
+
size: "md",
|
|
77
|
+
variant: "primary"
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
function getInitials(name) {
|
|
81
|
+
const parts = name.trim().split(/\s+/);
|
|
82
|
+
if (parts.length === 1) return parts[0].charAt(0).toUpperCase();
|
|
83
|
+
return (parts[0].charAt(0) + parts[parts.length - 1].charAt(0)).toUpperCase();
|
|
84
|
+
}
|
|
85
|
+
var Avatar = (0, import_react.forwardRef)(
|
|
86
|
+
({ name, src, alt, size, variant, className, ...props }, ref) => {
|
|
87
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref, className: avatar({ size, variant, className }), ...props, children: src ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
88
|
+
"img",
|
|
89
|
+
{
|
|
90
|
+
src,
|
|
91
|
+
alt: alt || name || "avatar",
|
|
92
|
+
className: "h-full w-full object-cover"
|
|
93
|
+
}
|
|
94
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: name ? getInitials(name) : "?" }) });
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
Avatar.displayName = "Avatar";
|
|
98
|
+
|
|
99
|
+
// src/components/Button/index.tsx
|
|
100
|
+
var import_react2 = require("react");
|
|
101
|
+
var import_tailwind_variants2 = require("tailwind-variants");
|
|
102
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
103
|
+
var button = (0, import_tailwind_variants2.tv)({
|
|
53
104
|
base: "inline-flex items-center justify-center gap-2 rounded-md font-medium transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
54
105
|
variants: {
|
|
55
106
|
variant: {
|
|
@@ -69,9 +120,9 @@ var button = (0, import_tailwind_variants.tv)({
|
|
|
69
120
|
size: "md"
|
|
70
121
|
}
|
|
71
122
|
});
|
|
72
|
-
var Button = (0,
|
|
123
|
+
var Button = (0, import_react2.forwardRef)(
|
|
73
124
|
({ variant, size, className, ...props }, ref) => {
|
|
74
|
-
return /* @__PURE__ */ (0,
|
|
125
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
75
126
|
"button",
|
|
76
127
|
{
|
|
77
128
|
ref,
|
|
@@ -83,20 +134,319 @@ var Button = (0, import_react.forwardRef)(
|
|
|
83
134
|
);
|
|
84
135
|
Button.displayName = "Button";
|
|
85
136
|
|
|
86
|
-
// src/components/
|
|
137
|
+
// src/components/Card/index.tsx
|
|
87
138
|
var import_react3 = require("react");
|
|
139
|
+
var import_tailwind_variants3 = require("tailwind-variants");
|
|
140
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
141
|
+
var card = (0, import_tailwind_variants3.tv)({
|
|
142
|
+
base: "rounded-lg bg-white text-gray-900 overflow-hidden",
|
|
143
|
+
variants: {
|
|
144
|
+
variant: {
|
|
145
|
+
elevated: "shadow-md",
|
|
146
|
+
outlined: "border border-gray-200",
|
|
147
|
+
filled: "bg-gray-50"
|
|
148
|
+
},
|
|
149
|
+
padding: {
|
|
150
|
+
none: "",
|
|
151
|
+
sm: "p-3",
|
|
152
|
+
md: "p-5",
|
|
153
|
+
lg: "p-8"
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
defaultVariants: {
|
|
157
|
+
variant: "elevated",
|
|
158
|
+
padding: "md"
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
var Card = (0, import_react3.forwardRef)(
|
|
162
|
+
({ variant, padding, header, footer, className, children, ...props }, ref) => {
|
|
163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { ref, className: card({ variant, padding: header || footer ? "none" : padding, className }), ...props, children: [
|
|
164
|
+
header && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "border-b border-gray-200 px-5 py-3 font-semibold text-sm", children: header }),
|
|
165
|
+
header || footer ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: card({ padding, className: "rounded-none shadow-none border-none bg-transparent" }), children }) : children,
|
|
166
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "border-t border-gray-200 px-5 py-3 text-sm", children: footer })
|
|
167
|
+
] });
|
|
168
|
+
}
|
|
169
|
+
);
|
|
170
|
+
Card.displayName = "Card";
|
|
171
|
+
|
|
172
|
+
// src/components/Modal/index.tsx
|
|
173
|
+
var import_react4 = require("react");
|
|
174
|
+
var import_tailwind_variants4 = require("tailwind-variants");
|
|
175
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
176
|
+
var overlay = (0, import_tailwind_variants4.tv)({
|
|
177
|
+
base: "fixed inset-0 z-50 flex items-center justify-center bg-black/50 transition-opacity"
|
|
178
|
+
});
|
|
179
|
+
var modal = (0, import_tailwind_variants4.tv)({
|
|
180
|
+
base: "relative flex flex-col rounded-lg bg-white text-gray-900 shadow-xl overflow-hidden",
|
|
181
|
+
variants: {
|
|
182
|
+
size: {
|
|
183
|
+
sm: "w-[30vw] max-h-[40vh]",
|
|
184
|
+
md: "w-[50vw] max-h-[60vh]",
|
|
185
|
+
lg: "w-[70vw] max-h-[80vh]",
|
|
186
|
+
full: "w-[95vw] max-h-[90vh]"
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
defaultVariants: {
|
|
190
|
+
size: "md"
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
var Modal = (0, import_react4.forwardRef)(
|
|
194
|
+
({ isOpen, onClose, title, footer, size, className, children, ...props }, ref) => {
|
|
195
|
+
const handleKeyDown = (0, import_react4.useCallback)(
|
|
196
|
+
(e) => {
|
|
197
|
+
if (e.key === "Escape") onClose();
|
|
198
|
+
},
|
|
199
|
+
[onClose]
|
|
200
|
+
);
|
|
201
|
+
(0, import_react4.useEffect)(() => {
|
|
202
|
+
if (!isOpen) return;
|
|
203
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
204
|
+
document.body.style.overflow = "hidden";
|
|
205
|
+
return () => {
|
|
206
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
207
|
+
document.body.style.overflow = "";
|
|
208
|
+
};
|
|
209
|
+
}, [isOpen, handleKeyDown]);
|
|
210
|
+
if (!isOpen) return null;
|
|
211
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: overlay(), onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
212
|
+
"div",
|
|
213
|
+
{
|
|
214
|
+
ref,
|
|
215
|
+
className: modal({ size, className }),
|
|
216
|
+
onClick: (e) => e.stopPropagation(),
|
|
217
|
+
role: "dialog",
|
|
218
|
+
"aria-modal": "true",
|
|
219
|
+
...props,
|
|
220
|
+
children: [
|
|
221
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex items-center justify-between border-b border-gray-200 bg-gray-50 px-5 py-3", children: [
|
|
222
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-sm font-semibold text-gray-900", children: title }),
|
|
223
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
224
|
+
"button",
|
|
225
|
+
{
|
|
226
|
+
type: "button",
|
|
227
|
+
className: "inline-flex h-7 w-7 items-center justify-center rounded-md text-gray-500 hover:bg-gray-200 hover:text-gray-700 transition-colors",
|
|
228
|
+
onClick: onClose,
|
|
229
|
+
"aria-label": "Fechar",
|
|
230
|
+
children: "\u2715"
|
|
231
|
+
}
|
|
232
|
+
)
|
|
233
|
+
] }),
|
|
234
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "flex-1 overflow-y-auto p-5", children }),
|
|
235
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "flex items-center justify-end gap-2 border-t border-gray-200 px-5 py-3", children: footer })
|
|
236
|
+
]
|
|
237
|
+
}
|
|
238
|
+
) });
|
|
239
|
+
}
|
|
240
|
+
);
|
|
241
|
+
Modal.displayName = "Modal";
|
|
242
|
+
|
|
243
|
+
// src/components/Tooltip/index.tsx
|
|
244
|
+
var import_react5 = require("react");
|
|
245
|
+
var import_react_dom = require("react-dom");
|
|
246
|
+
var import_tailwind_variants5 = require("tailwind-variants");
|
|
247
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
248
|
+
var tooltip = (0, import_tailwind_variants5.tv)({
|
|
249
|
+
base: "fixed z-[999999] pointer-events-none",
|
|
250
|
+
variants: {
|
|
251
|
+
variant: {
|
|
252
|
+
dark: "",
|
|
253
|
+
light: ""
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
defaultVariants: {
|
|
257
|
+
variant: "dark"
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
var tooltipContent = (0, import_tailwind_variants5.tv)({
|
|
261
|
+
base: "inline-flex items-center justify-center rounded px-2.5 py-1 text-xs font-medium whitespace-nowrap",
|
|
262
|
+
variants: {
|
|
263
|
+
variant: {
|
|
264
|
+
dark: "bg-gray-900 text-white",
|
|
265
|
+
light: "bg-white text-gray-900 shadow-md border border-gray-200"
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
defaultVariants: {
|
|
269
|
+
variant: "dark"
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
var tooltipArrow = (0, import_tailwind_variants5.tv)({
|
|
273
|
+
base: "absolute h-1.5 w-1.5 rotate-45",
|
|
274
|
+
variants: {
|
|
275
|
+
variant: {
|
|
276
|
+
dark: "bg-gray-900",
|
|
277
|
+
light: "bg-white border border-gray-200"
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
defaultVariants: {
|
|
281
|
+
variant: "dark"
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
var arrowPlacementStyles = {
|
|
285
|
+
top: "bottom-[-3px] left-1/2 -translate-x-1/2",
|
|
286
|
+
bottom: "top-[-3px] left-1/2 -translate-x-1/2",
|
|
287
|
+
left: "right-[-3px] top-1/2 -translate-y-1/2",
|
|
288
|
+
right: "left-[-3px] top-1/2 -translate-y-1/2"
|
|
289
|
+
};
|
|
290
|
+
var Tooltip = (0, import_react5.forwardRef)(
|
|
291
|
+
({
|
|
292
|
+
content,
|
|
293
|
+
placement = "top",
|
|
294
|
+
offset: offsetPx = 8,
|
|
295
|
+
variant,
|
|
296
|
+
disabled,
|
|
297
|
+
delayShow = 100,
|
|
298
|
+
delayHide = 100,
|
|
299
|
+
children,
|
|
300
|
+
className,
|
|
301
|
+
...props
|
|
302
|
+
}, ref) => {
|
|
303
|
+
const wrapperRef = (0, import_react5.useRef)(null);
|
|
304
|
+
const tipRef = (0, import_react5.useRef)(null);
|
|
305
|
+
const [visible, setVisible] = (0, import_react5.useState)(false);
|
|
306
|
+
const [coords, setCoords] = (0, import_react5.useState)(null);
|
|
307
|
+
const [activePlacement, setActivePlacement] = (0, import_react5.useState)(placement);
|
|
308
|
+
const showTimer = (0, import_react5.useRef)(null);
|
|
309
|
+
const hideTimer = (0, import_react5.useRef)(null);
|
|
310
|
+
function clearTimers() {
|
|
311
|
+
if (showTimer.current !== null) window.clearTimeout(showTimer.current);
|
|
312
|
+
if (hideTimer.current !== null) window.clearTimeout(hideTimer.current);
|
|
313
|
+
showTimer.current = null;
|
|
314
|
+
hideTimer.current = null;
|
|
315
|
+
}
|
|
316
|
+
function scheduleShow() {
|
|
317
|
+
if (disabled) return;
|
|
318
|
+
clearTimers();
|
|
319
|
+
showTimer.current = window.setTimeout(() => setVisible(true), delayShow);
|
|
320
|
+
}
|
|
321
|
+
function scheduleHide() {
|
|
322
|
+
clearTimers();
|
|
323
|
+
hideTimer.current = window.setTimeout(() => setVisible(false), delayHide);
|
|
324
|
+
}
|
|
325
|
+
const computePosition = (0, import_react5.useCallback)(() => {
|
|
326
|
+
const anchor = wrapperRef.current;
|
|
327
|
+
const tip = tipRef.current;
|
|
328
|
+
if (!anchor || !tip) return;
|
|
329
|
+
const rect = anchor.getBoundingClientRect();
|
|
330
|
+
const tipW = tip.offsetWidth;
|
|
331
|
+
const tipH = tip.offsetHeight;
|
|
332
|
+
const vw = window.innerWidth;
|
|
333
|
+
const vh = window.innerHeight;
|
|
334
|
+
const calc = (p2) => {
|
|
335
|
+
switch (p2) {
|
|
336
|
+
case "top":
|
|
337
|
+
return { top: rect.top - tipH - offsetPx, left: rect.left + rect.width / 2 - tipW / 2 };
|
|
338
|
+
case "bottom":
|
|
339
|
+
return { top: rect.bottom + offsetPx, left: rect.left + rect.width / 2 - tipW / 2 };
|
|
340
|
+
case "left":
|
|
341
|
+
return { top: rect.top + rect.height / 2 - tipH / 2, left: rect.left - tipW - offsetPx };
|
|
342
|
+
case "right":
|
|
343
|
+
return { top: rect.top + rect.height / 2 - tipH / 2, left: rect.right + offsetPx };
|
|
344
|
+
}
|
|
345
|
+
};
|
|
346
|
+
let pos = calc(placement);
|
|
347
|
+
let p = placement;
|
|
348
|
+
const fits = (c) => c.top >= 0 && c.left >= 0 && c.top + tipH <= vh && c.left + tipW <= vw;
|
|
349
|
+
if (!fits(pos)) {
|
|
350
|
+
const fallbacks = {
|
|
351
|
+
top: ["bottom", "right", "left"],
|
|
352
|
+
bottom: ["top", "right", "left"],
|
|
353
|
+
left: ["right", "top", "bottom"],
|
|
354
|
+
right: ["left", "top", "bottom"]
|
|
355
|
+
};
|
|
356
|
+
for (const candidate of fallbacks[placement]) {
|
|
357
|
+
const c = calc(candidate);
|
|
358
|
+
if (fits(c)) {
|
|
359
|
+
pos = c;
|
|
360
|
+
p = candidate;
|
|
361
|
+
break;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
pos.top = Math.max(4, Math.min(vh - tipH - 4, pos.top));
|
|
366
|
+
pos.left = Math.max(4, Math.min(vw - tipW - 4, pos.left));
|
|
367
|
+
setActivePlacement(p);
|
|
368
|
+
setCoords(pos);
|
|
369
|
+
}, [placement, offsetPx]);
|
|
370
|
+
(0, import_react5.useLayoutEffect)(() => {
|
|
371
|
+
if (!visible) return;
|
|
372
|
+
let raf1 = 0;
|
|
373
|
+
let raf2 = 0;
|
|
374
|
+
raf1 = requestAnimationFrame(() => {
|
|
375
|
+
raf2 = requestAnimationFrame(computePosition);
|
|
376
|
+
});
|
|
377
|
+
return () => {
|
|
378
|
+
cancelAnimationFrame(raf1);
|
|
379
|
+
cancelAnimationFrame(raf2);
|
|
380
|
+
};
|
|
381
|
+
}, [visible, computePosition]);
|
|
382
|
+
(0, import_react5.useEffect)(() => {
|
|
383
|
+
if (!visible) return;
|
|
384
|
+
const handler = () => computePosition();
|
|
385
|
+
window.addEventListener("scroll", handler, true);
|
|
386
|
+
window.addEventListener("resize", handler);
|
|
387
|
+
return () => {
|
|
388
|
+
window.removeEventListener("scroll", handler, true);
|
|
389
|
+
window.removeEventListener("resize", handler);
|
|
390
|
+
};
|
|
391
|
+
}, [visible, computePosition]);
|
|
392
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
393
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
394
|
+
"span",
|
|
395
|
+
{
|
|
396
|
+
ref: (el) => {
|
|
397
|
+
wrapperRef.current = el;
|
|
398
|
+
if (typeof ref === "function") ref(el);
|
|
399
|
+
else if (ref) ref.current = el;
|
|
400
|
+
},
|
|
401
|
+
onMouseEnter: scheduleShow,
|
|
402
|
+
onMouseLeave: scheduleHide,
|
|
403
|
+
onFocus: scheduleShow,
|
|
404
|
+
onBlur: scheduleHide,
|
|
405
|
+
style: { display: "contents" },
|
|
406
|
+
className,
|
|
407
|
+
...props,
|
|
408
|
+
children
|
|
409
|
+
}
|
|
410
|
+
),
|
|
411
|
+
visible && (0, import_react_dom.createPortal)(
|
|
412
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
413
|
+
"div",
|
|
414
|
+
{
|
|
415
|
+
ref: tipRef,
|
|
416
|
+
role: "tooltip",
|
|
417
|
+
className: tooltip({ variant }),
|
|
418
|
+
style: {
|
|
419
|
+
top: coords?.top ?? -99999,
|
|
420
|
+
left: coords?.left ?? -99999,
|
|
421
|
+
visibility: coords ? "visible" : "hidden"
|
|
422
|
+
},
|
|
423
|
+
children: [
|
|
424
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: tooltipContent({ variant }), children: content }),
|
|
425
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: `${tooltipArrow({ variant })} ${arrowPlacementStyles[activePlacement]}` })
|
|
426
|
+
]
|
|
427
|
+
}
|
|
428
|
+
),
|
|
429
|
+
document.body
|
|
430
|
+
)
|
|
431
|
+
] });
|
|
432
|
+
}
|
|
433
|
+
);
|
|
434
|
+
Tooltip.displayName = "Tooltip";
|
|
435
|
+
|
|
436
|
+
// src/components/Input/InputString.tsx
|
|
437
|
+
var import_react7 = require("react");
|
|
88
438
|
|
|
89
439
|
// src/components/Input/InputWrapper.tsx
|
|
90
|
-
var
|
|
91
|
-
var
|
|
92
|
-
var
|
|
93
|
-
var wrapper = (0,
|
|
440
|
+
var import_react6 = require("react");
|
|
441
|
+
var import_tailwind_variants6 = require("tailwind-variants");
|
|
442
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
443
|
+
var wrapper = (0, import_tailwind_variants6.tv)({
|
|
94
444
|
base: "flex w-full flex-col gap-1"
|
|
95
445
|
});
|
|
96
|
-
var labelStyle = (0,
|
|
446
|
+
var labelStyle = (0, import_tailwind_variants6.tv)({
|
|
97
447
|
base: "text-xs text-gray-700 flex items-start gap-0.5"
|
|
98
448
|
});
|
|
99
|
-
var containerStyle = (0,
|
|
449
|
+
var containerStyle = (0, import_tailwind_variants6.tv)({
|
|
100
450
|
base: "flex items-center w-full rounded-md border bg-white transition-colors",
|
|
101
451
|
variants: {
|
|
102
452
|
size: {
|
|
@@ -117,26 +467,26 @@ var containerStyle = (0, import_tailwind_variants2.tv)({
|
|
|
117
467
|
error: false
|
|
118
468
|
}
|
|
119
469
|
});
|
|
120
|
-
var errorStyle = (0,
|
|
470
|
+
var errorStyle = (0, import_tailwind_variants6.tv)({
|
|
121
471
|
base: "text-xs text-red-500 mt-0.5"
|
|
122
472
|
});
|
|
123
|
-
var InputWrapper = (0,
|
|
473
|
+
var InputWrapper = (0, import_react6.forwardRef)(
|
|
124
474
|
({ label, error, errorMessage, required, disabled, size, children, className, classContainer, htmlFor }, ref) => {
|
|
125
|
-
return /* @__PURE__ */ (0,
|
|
126
|
-
label && /* @__PURE__ */ (0,
|
|
127
|
-
/* @__PURE__ */ (0,
|
|
128
|
-
required && /* @__PURE__ */ (0,
|
|
475
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { ref, className: wrapper({ className }), children: [
|
|
476
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { htmlFor, className: labelStyle(), children: [
|
|
477
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: label }),
|
|
478
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-red-500 text-[10px] leading-none mt-0.5", children: "*" })
|
|
129
479
|
] }),
|
|
130
|
-
/* @__PURE__ */ (0,
|
|
131
|
-
error && errorMessage && /* @__PURE__ */ (0,
|
|
480
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: containerStyle({ size, error: !!error, disabled: !!disabled, className: classContainer }), children }),
|
|
481
|
+
error && errorMessage && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: errorStyle(), children: errorMessage })
|
|
132
482
|
] });
|
|
133
483
|
}
|
|
134
484
|
);
|
|
135
485
|
InputWrapper.displayName = "InputWrapper";
|
|
136
486
|
|
|
137
487
|
// src/components/Input/InputString.tsx
|
|
138
|
-
var
|
|
139
|
-
var InputString = (0,
|
|
488
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
489
|
+
var InputString = (0, import_react7.forwardRef)(
|
|
140
490
|
({
|
|
141
491
|
label,
|
|
142
492
|
error,
|
|
@@ -154,14 +504,14 @@ var InputString = (0, import_react3.forwardRef)(
|
|
|
154
504
|
name,
|
|
155
505
|
...props
|
|
156
506
|
}, ref) => {
|
|
157
|
-
const [hovered, setHovered] = (0,
|
|
158
|
-
return /* @__PURE__ */ (0,
|
|
507
|
+
const [hovered, setHovered] = (0, import_react7.useState)(false);
|
|
508
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
159
509
|
"div",
|
|
160
510
|
{
|
|
161
511
|
onMouseEnter: () => setHovered(true),
|
|
162
512
|
onMouseLeave: () => setHovered(false),
|
|
163
513
|
className: "w-full",
|
|
164
|
-
children: /* @__PURE__ */ (0,
|
|
514
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
165
515
|
InputWrapper,
|
|
166
516
|
{
|
|
167
517
|
label,
|
|
@@ -173,8 +523,8 @@ var InputString = (0, import_react3.forwardRef)(
|
|
|
173
523
|
classContainer,
|
|
174
524
|
htmlFor: name,
|
|
175
525
|
children: [
|
|
176
|
-
leftIcon && /* @__PURE__ */ (0,
|
|
177
|
-
/* @__PURE__ */ (0,
|
|
526
|
+
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "pl-2.5 text-gray-400", children: leftIcon }),
|
|
527
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
178
528
|
"input",
|
|
179
529
|
{
|
|
180
530
|
ref,
|
|
@@ -189,7 +539,7 @@ var InputString = (0, import_react3.forwardRef)(
|
|
|
189
539
|
...props
|
|
190
540
|
}
|
|
191
541
|
),
|
|
192
|
-
showClearButton && hovered && value && !disabled && !required && /* @__PURE__ */ (0,
|
|
542
|
+
showClearButton && hovered && value && !disabled && !required && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
193
543
|
"button",
|
|
194
544
|
{
|
|
195
545
|
type: "button",
|
|
@@ -198,7 +548,7 @@ var InputString = (0, import_react3.forwardRef)(
|
|
|
198
548
|
className: "px-2 text-gray-400 hover:text-gray-600",
|
|
199
549
|
onMouseDown: (e) => e.preventDefault(),
|
|
200
550
|
onClick: () => onChange?.(""),
|
|
201
|
-
children: /* @__PURE__ */ (0,
|
|
551
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
202
552
|
"svg",
|
|
203
553
|
{
|
|
204
554
|
width: "14",
|
|
@@ -210,14 +560,14 @@ var InputString = (0, import_react3.forwardRef)(
|
|
|
210
560
|
strokeLinecap: "round",
|
|
211
561
|
strokeLinejoin: "round",
|
|
212
562
|
children: [
|
|
213
|
-
/* @__PURE__ */ (0,
|
|
214
|
-
/* @__PURE__ */ (0,
|
|
563
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
564
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
215
565
|
]
|
|
216
566
|
}
|
|
217
567
|
)
|
|
218
568
|
}
|
|
219
569
|
),
|
|
220
|
-
rightIcon && /* @__PURE__ */ (0,
|
|
570
|
+
rightIcon && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "pr-2.5 text-gray-400", children: rightIcon })
|
|
221
571
|
]
|
|
222
572
|
}
|
|
223
573
|
)
|
|
@@ -228,11 +578,11 @@ var InputString = (0, import_react3.forwardRef)(
|
|
|
228
578
|
InputString.displayName = "InputString";
|
|
229
579
|
|
|
230
580
|
// src/components/Input/InputEmail.tsx
|
|
231
|
-
var
|
|
232
|
-
var
|
|
233
|
-
var InputEmail = (0,
|
|
581
|
+
var import_react8 = require("react");
|
|
582
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
583
|
+
var InputEmail = (0, import_react8.forwardRef)(
|
|
234
584
|
({ label, error, errorMessage, required, size, leftIcon, rightIcon, classContainer, classInput, value, onChange, disabled, name, ...props }, ref) => {
|
|
235
|
-
return /* @__PURE__ */ (0,
|
|
585
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
236
586
|
InputWrapper,
|
|
237
587
|
{
|
|
238
588
|
label,
|
|
@@ -244,8 +594,8 @@ var InputEmail = (0, import_react4.forwardRef)(
|
|
|
244
594
|
classContainer,
|
|
245
595
|
htmlFor: name,
|
|
246
596
|
children: [
|
|
247
|
-
leftIcon && /* @__PURE__ */ (0,
|
|
248
|
-
/* @__PURE__ */ (0,
|
|
597
|
+
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "pl-2.5 text-gray-400", children: leftIcon }),
|
|
598
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
249
599
|
"input",
|
|
250
600
|
{
|
|
251
601
|
ref,
|
|
@@ -261,7 +611,7 @@ var InputEmail = (0, import_react4.forwardRef)(
|
|
|
261
611
|
...props
|
|
262
612
|
}
|
|
263
613
|
),
|
|
264
|
-
rightIcon && /* @__PURE__ */ (0,
|
|
614
|
+
rightIcon && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "pr-2.5 text-gray-400", children: rightIcon })
|
|
265
615
|
]
|
|
266
616
|
}
|
|
267
617
|
);
|
|
@@ -270,20 +620,20 @@ var InputEmail = (0, import_react4.forwardRef)(
|
|
|
270
620
|
InputEmail.displayName = "InputEmail";
|
|
271
621
|
|
|
272
622
|
// src/components/Input/InputPassword.tsx
|
|
273
|
-
var
|
|
274
|
-
var
|
|
275
|
-
var EyeIcon = () => /* @__PURE__ */ (0,
|
|
276
|
-
/* @__PURE__ */ (0,
|
|
277
|
-
/* @__PURE__ */ (0,
|
|
623
|
+
var import_react9 = require("react");
|
|
624
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
625
|
+
var EyeIcon = () => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
626
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }),
|
|
627
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("circle", { cx: "12", cy: "12", r: "3" })
|
|
278
628
|
] });
|
|
279
|
-
var EyeOffIcon = () => /* @__PURE__ */ (0,
|
|
280
|
-
/* @__PURE__ */ (0,
|
|
281
|
-
/* @__PURE__ */ (0,
|
|
629
|
+
var EyeOffIcon = () => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
630
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("path", { d: "M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24" }),
|
|
631
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
|
|
282
632
|
] });
|
|
283
|
-
var InputPassword = (0,
|
|
633
|
+
var InputPassword = (0, import_react9.forwardRef)(
|
|
284
634
|
({ label, error, errorMessage, required, size, classContainer, classInput, value, onChange, disabled, name, ...props }, ref) => {
|
|
285
|
-
const [visible, setVisible] = (0,
|
|
286
|
-
return /* @__PURE__ */ (0,
|
|
635
|
+
const [visible, setVisible] = (0, import_react9.useState)(false);
|
|
636
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
287
637
|
InputWrapper,
|
|
288
638
|
{
|
|
289
639
|
label,
|
|
@@ -295,7 +645,7 @@ var InputPassword = (0, import_react5.forwardRef)(
|
|
|
295
645
|
classContainer,
|
|
296
646
|
htmlFor: name,
|
|
297
647
|
children: [
|
|
298
|
-
/* @__PURE__ */ (0,
|
|
648
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
299
649
|
"input",
|
|
300
650
|
{
|
|
301
651
|
ref,
|
|
@@ -311,7 +661,7 @@ var InputPassword = (0, import_react5.forwardRef)(
|
|
|
311
661
|
...props
|
|
312
662
|
}
|
|
313
663
|
),
|
|
314
|
-
/* @__PURE__ */ (0,
|
|
664
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
315
665
|
"button",
|
|
316
666
|
{
|
|
317
667
|
type: "button",
|
|
@@ -319,7 +669,7 @@ var InputPassword = (0, import_react5.forwardRef)(
|
|
|
319
669
|
"aria-label": visible ? "Ocultar senha" : "Mostrar senha",
|
|
320
670
|
className: "px-2.5 text-gray-400 hover:text-gray-600",
|
|
321
671
|
onClick: () => setVisible(!visible),
|
|
322
|
-
children: visible ? /* @__PURE__ */ (0,
|
|
672
|
+
children: visible ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(EyeOffIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(EyeIcon, {})
|
|
323
673
|
}
|
|
324
674
|
)
|
|
325
675
|
]
|
|
@@ -330,10 +680,10 @@ var InputPassword = (0, import_react5.forwardRef)(
|
|
|
330
680
|
InputPassword.displayName = "InputPassword";
|
|
331
681
|
|
|
332
682
|
// src/components/Input/InputNumber.tsx
|
|
333
|
-
var
|
|
334
|
-
var
|
|
683
|
+
var import_react10 = require("react");
|
|
684
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
335
685
|
var allowedKeys = ["Backspace", "Delete", "Tab", "ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "Home", "End"];
|
|
336
|
-
var InputNumber = (0,
|
|
686
|
+
var InputNumber = (0, import_react10.forwardRef)(
|
|
337
687
|
({ label, error, errorMessage, required, size, leftIcon, rightIcon, classContainer, classInput, value, onChange, disabled, name, min = 0, max, ...props }, ref) => {
|
|
338
688
|
function handleKeyDown(e) {
|
|
339
689
|
if (e.ctrlKey || e.metaKey) return;
|
|
@@ -353,7 +703,7 @@ var InputNumber = (0, import_react6.forwardRef)(
|
|
|
353
703
|
if (max !== void 0 && num > max) return;
|
|
354
704
|
onChange?.(num);
|
|
355
705
|
}
|
|
356
|
-
return /* @__PURE__ */ (0,
|
|
706
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
|
357
707
|
InputWrapper,
|
|
358
708
|
{
|
|
359
709
|
label,
|
|
@@ -365,8 +715,8 @@ var InputNumber = (0, import_react6.forwardRef)(
|
|
|
365
715
|
classContainer,
|
|
366
716
|
htmlFor: name,
|
|
367
717
|
children: [
|
|
368
|
-
leftIcon && /* @__PURE__ */ (0,
|
|
369
|
-
/* @__PURE__ */ (0,
|
|
718
|
+
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "pl-2.5 text-gray-400", children: leftIcon }),
|
|
719
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
370
720
|
"input",
|
|
371
721
|
{
|
|
372
722
|
ref,
|
|
@@ -383,7 +733,7 @@ var InputNumber = (0, import_react6.forwardRef)(
|
|
|
383
733
|
...props
|
|
384
734
|
}
|
|
385
735
|
),
|
|
386
|
-
rightIcon && /* @__PURE__ */ (0,
|
|
736
|
+
rightIcon && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "pr-2.5 text-gray-400", children: rightIcon })
|
|
387
737
|
]
|
|
388
738
|
}
|
|
389
739
|
);
|
|
@@ -392,7 +742,7 @@ var InputNumber = (0, import_react6.forwardRef)(
|
|
|
392
742
|
InputNumber.displayName = "InputNumber";
|
|
393
743
|
|
|
394
744
|
// src/components/Input/InputCPF.tsx
|
|
395
|
-
var
|
|
745
|
+
var import_react11 = require("react");
|
|
396
746
|
|
|
397
747
|
// src/components/Input/masks.ts
|
|
398
748
|
function maskCPF(value) {
|
|
@@ -426,14 +776,14 @@ function unmaskCurrency(value) {
|
|
|
426
776
|
}
|
|
427
777
|
|
|
428
778
|
// src/components/Input/InputCPF.tsx
|
|
429
|
-
var
|
|
430
|
-
var InputCPF = (0,
|
|
779
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
780
|
+
var InputCPF = (0, import_react11.forwardRef)(
|
|
431
781
|
({ label, error, errorMessage, required, size, classContainer, classInput, value, onChange, disabled, name, ...props }, ref) => {
|
|
432
782
|
function handleChange(raw) {
|
|
433
783
|
const digits = unmask(raw);
|
|
434
784
|
onChange?.(digits);
|
|
435
785
|
}
|
|
436
|
-
return /* @__PURE__ */ (0,
|
|
786
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
437
787
|
InputWrapper,
|
|
438
788
|
{
|
|
439
789
|
label,
|
|
@@ -444,7 +794,7 @@ var InputCPF = (0, import_react7.forwardRef)(
|
|
|
444
794
|
size,
|
|
445
795
|
classContainer,
|
|
446
796
|
htmlFor: name,
|
|
447
|
-
children: /* @__PURE__ */ (0,
|
|
797
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
448
798
|
"input",
|
|
449
799
|
{
|
|
450
800
|
ref,
|
|
@@ -469,15 +819,15 @@ var InputCPF = (0, import_react7.forwardRef)(
|
|
|
469
819
|
InputCPF.displayName = "InputCPF";
|
|
470
820
|
|
|
471
821
|
// src/components/Input/InputCNPJ.tsx
|
|
472
|
-
var
|
|
473
|
-
var
|
|
474
|
-
var InputCNPJ = (0,
|
|
822
|
+
var import_react12 = require("react");
|
|
823
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
824
|
+
var InputCNPJ = (0, import_react12.forwardRef)(
|
|
475
825
|
({ label, error, errorMessage, required, size, classContainer, classInput, value, onChange, disabled, name, ...props }, ref) => {
|
|
476
826
|
function handleChange(raw) {
|
|
477
827
|
const digits = unmask(raw);
|
|
478
828
|
onChange?.(digits);
|
|
479
829
|
}
|
|
480
|
-
return /* @__PURE__ */ (0,
|
|
830
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
481
831
|
InputWrapper,
|
|
482
832
|
{
|
|
483
833
|
label,
|
|
@@ -488,7 +838,7 @@ var InputCNPJ = (0, import_react8.forwardRef)(
|
|
|
488
838
|
size,
|
|
489
839
|
classContainer,
|
|
490
840
|
htmlFor: name,
|
|
491
|
-
children: /* @__PURE__ */ (0,
|
|
841
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
492
842
|
"input",
|
|
493
843
|
{
|
|
494
844
|
ref,
|
|
@@ -513,15 +863,15 @@ var InputCNPJ = (0, import_react8.forwardRef)(
|
|
|
513
863
|
InputCNPJ.displayName = "InputCNPJ";
|
|
514
864
|
|
|
515
865
|
// src/components/Input/InputPhone.tsx
|
|
516
|
-
var
|
|
517
|
-
var
|
|
518
|
-
var InputPhone = (0,
|
|
866
|
+
var import_react13 = require("react");
|
|
867
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
868
|
+
var InputPhone = (0, import_react13.forwardRef)(
|
|
519
869
|
({ label, error, errorMessage, required, size, classContainer, classInput, value, onChange, disabled, name, ...props }, ref) => {
|
|
520
870
|
function handleChange(raw) {
|
|
521
871
|
const digits = unmask(raw);
|
|
522
872
|
onChange?.(digits);
|
|
523
873
|
}
|
|
524
|
-
return /* @__PURE__ */ (0,
|
|
874
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
525
875
|
InputWrapper,
|
|
526
876
|
{
|
|
527
877
|
label,
|
|
@@ -532,7 +882,7 @@ var InputPhone = (0, import_react9.forwardRef)(
|
|
|
532
882
|
size,
|
|
533
883
|
classContainer,
|
|
534
884
|
htmlFor: name,
|
|
535
|
-
children: /* @__PURE__ */ (0,
|
|
885
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
536
886
|
"input",
|
|
537
887
|
{
|
|
538
888
|
ref,
|
|
@@ -557,8 +907,8 @@ var InputPhone = (0, import_react9.forwardRef)(
|
|
|
557
907
|
InputPhone.displayName = "InputPhone";
|
|
558
908
|
|
|
559
909
|
// src/components/Input/InputCurrency.tsx
|
|
560
|
-
var
|
|
561
|
-
var
|
|
910
|
+
var import_react14 = require("react");
|
|
911
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
562
912
|
function formatCurrency(value, prefix, decimalScale) {
|
|
563
913
|
const fixed = Math.abs(value).toFixed(decimalScale);
|
|
564
914
|
const [intPart, decPart] = fixed.split(".");
|
|
@@ -566,7 +916,7 @@ function formatCurrency(value, prefix, decimalScale) {
|
|
|
566
916
|
const sign = value < 0 ? "-" : "";
|
|
567
917
|
return `${sign}${prefix}${formatted},${decPart}`;
|
|
568
918
|
}
|
|
569
|
-
var InputCurrency = (0,
|
|
919
|
+
var InputCurrency = (0, import_react14.forwardRef)(
|
|
570
920
|
({ label, error, errorMessage, required, size, classContainer, classInput, value, onChange, disabled, name, prefix = "R$ ", decimalScale = 2, allowNegative = false, ...props }, ref) => {
|
|
571
921
|
function handleChange(e) {
|
|
572
922
|
const raw = e.target.value;
|
|
@@ -575,7 +925,7 @@ var InputCurrency = (0, import_react10.forwardRef)(
|
|
|
575
925
|
onChange?.(isNaN(num) ? void 0 : num);
|
|
576
926
|
}
|
|
577
927
|
const displayValue = value !== void 0 && value !== null ? formatCurrency(value, prefix, decimalScale) : "";
|
|
578
|
-
return /* @__PURE__ */ (0,
|
|
928
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
579
929
|
InputWrapper,
|
|
580
930
|
{
|
|
581
931
|
label,
|
|
@@ -586,7 +936,7 @@ var InputCurrency = (0, import_react10.forwardRef)(
|
|
|
586
936
|
size,
|
|
587
937
|
classContainer,
|
|
588
938
|
htmlFor: name,
|
|
589
|
-
children: /* @__PURE__ */ (0,
|
|
939
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
590
940
|
"input",
|
|
591
941
|
{
|
|
592
942
|
ref,
|
|
@@ -610,15 +960,15 @@ var InputCurrency = (0, import_react10.forwardRef)(
|
|
|
610
960
|
InputCurrency.displayName = "InputCurrency";
|
|
611
961
|
|
|
612
962
|
// src/components/Input/InputCep.tsx
|
|
613
|
-
var
|
|
614
|
-
var
|
|
615
|
-
var InputCep = (0,
|
|
963
|
+
var import_react15 = require("react");
|
|
964
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
965
|
+
var InputCep = (0, import_react15.forwardRef)(
|
|
616
966
|
({ label, error, errorMessage, required, size, classContainer, classInput, value, onChange, disabled, name, ...props }, ref) => {
|
|
617
967
|
function handleChange(raw) {
|
|
618
968
|
const digits = unmask(raw);
|
|
619
969
|
onChange?.(digits);
|
|
620
970
|
}
|
|
621
|
-
return /* @__PURE__ */ (0,
|
|
971
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
622
972
|
InputWrapper,
|
|
623
973
|
{
|
|
624
974
|
label,
|
|
@@ -629,7 +979,7 @@ var InputCep = (0, import_react11.forwardRef)(
|
|
|
629
979
|
size,
|
|
630
980
|
classContainer,
|
|
631
981
|
htmlFor: name,
|
|
632
|
-
children: /* @__PURE__ */ (0,
|
|
982
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
633
983
|
"input",
|
|
634
984
|
{
|
|
635
985
|
ref,
|
|
@@ -655,10 +1005,10 @@ var InputCep = (0, import_react11.forwardRef)(
|
|
|
655
1005
|
InputCep.displayName = "InputCep";
|
|
656
1006
|
|
|
657
1007
|
// src/components/Input/InputCheckbox.tsx
|
|
658
|
-
var
|
|
659
|
-
var
|
|
660
|
-
var
|
|
661
|
-
var checkboxContainer = (0,
|
|
1008
|
+
var import_react16 = require("react");
|
|
1009
|
+
var import_tailwind_variants7 = require("tailwind-variants");
|
|
1010
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1011
|
+
var checkboxContainer = (0, import_tailwind_variants7.tv)({
|
|
662
1012
|
base: "inline-flex items-center justify-center w-[18px] h-[18px] rounded border cursor-pointer transition-colors",
|
|
663
1013
|
variants: {
|
|
664
1014
|
checked: {
|
|
@@ -676,15 +1026,15 @@ var checkboxContainer = (0, import_tailwind_variants3.tv)({
|
|
|
676
1026
|
checked: false
|
|
677
1027
|
}
|
|
678
1028
|
});
|
|
679
|
-
var CheckIcon = () => /* @__PURE__ */ (0,
|
|
680
|
-
var IndeterminateIcon = () => /* @__PURE__ */ (0,
|
|
681
|
-
var InputCheckbox = (0,
|
|
1029
|
+
var CheckIcon = () => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("svg", { width: "10", height: "10", viewBox: "0 0 24 24", fill: "none", stroke: "white", strokeWidth: "4", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("polyline", { points: "20 6 9 17 4 12" }) });
|
|
1030
|
+
var IndeterminateIcon = () => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "w-2 h-2 rounded-sm bg-gray-300" });
|
|
1031
|
+
var InputCheckbox = (0, import_react16.forwardRef)(
|
|
682
1032
|
({ label, checked = false, indeterminate = false, onChange, disabled, error, labelPosition = "right", className, name, required }, ref) => {
|
|
683
1033
|
function handleClick() {
|
|
684
1034
|
if (disabled) return;
|
|
685
1035
|
onChange?.(!checked);
|
|
686
1036
|
}
|
|
687
|
-
const box = /* @__PURE__ */ (0,
|
|
1037
|
+
const box = /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
688
1038
|
"button",
|
|
689
1039
|
{
|
|
690
1040
|
ref,
|
|
@@ -697,27 +1047,27 @@ var InputCheckbox = (0, import_react12.forwardRef)(
|
|
|
697
1047
|
onClick: handleClick,
|
|
698
1048
|
disabled,
|
|
699
1049
|
children: [
|
|
700
|
-
checked && !indeterminate && /* @__PURE__ */ (0,
|
|
701
|
-
indeterminate && /* @__PURE__ */ (0,
|
|
1050
|
+
checked && !indeterminate && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CheckIcon, {}),
|
|
1051
|
+
indeterminate && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(IndeterminateIcon, {})
|
|
702
1052
|
]
|
|
703
1053
|
}
|
|
704
1054
|
);
|
|
705
|
-
if (!label) return /* @__PURE__ */ (0,
|
|
706
|
-
return /* @__PURE__ */ (0,
|
|
707
|
-
labelPosition === "left" && /* @__PURE__ */ (0,
|
|
1055
|
+
if (!label) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className, children: box });
|
|
1056
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: `flex items-center gap-2 ${className ?? ""}`, children: [
|
|
1057
|
+
labelPosition === "left" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("label", { htmlFor: name, className: "text-sm text-gray-700 cursor-pointer select-none", children: label }),
|
|
708
1058
|
box,
|
|
709
|
-
labelPosition === "right" && /* @__PURE__ */ (0,
|
|
710
|
-
required && /* @__PURE__ */ (0,
|
|
1059
|
+
labelPosition === "right" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("label", { htmlFor: name, className: "text-sm text-gray-700 cursor-pointer select-none", children: label }),
|
|
1060
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-red-500 text-[10px]", children: "*" })
|
|
711
1061
|
] });
|
|
712
1062
|
}
|
|
713
1063
|
);
|
|
714
1064
|
InputCheckbox.displayName = "InputCheckbox";
|
|
715
1065
|
|
|
716
1066
|
// src/components/Input/InputRadio.tsx
|
|
717
|
-
var
|
|
718
|
-
var
|
|
719
|
-
var
|
|
720
|
-
var radioButton = (0,
|
|
1067
|
+
var import_react17 = require("react");
|
|
1068
|
+
var import_tailwind_variants8 = require("tailwind-variants");
|
|
1069
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1070
|
+
var radioButton = (0, import_tailwind_variants8.tv)({
|
|
721
1071
|
base: "inline-flex items-center justify-center w-[18px] h-[18px] rounded-full border cursor-pointer transition-colors",
|
|
722
1072
|
variants: {
|
|
723
1073
|
selected: {
|
|
@@ -735,14 +1085,14 @@ var radioButton = (0, import_tailwind_variants4.tv)({
|
|
|
735
1085
|
selected: false
|
|
736
1086
|
}
|
|
737
1087
|
});
|
|
738
|
-
var InputRadio = (0,
|
|
1088
|
+
var InputRadio = (0, import_react17.forwardRef)(
|
|
739
1089
|
({ label, options, value, onChange, disabled, error, required, name, className, direction = "horizontal" }, ref) => {
|
|
740
|
-
return /* @__PURE__ */ (0,
|
|
741
|
-
label && /* @__PURE__ */ (0,
|
|
742
|
-
/* @__PURE__ */ (0,
|
|
743
|
-
required && /* @__PURE__ */ (0,
|
|
1090
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { ref, className: `flex w-full flex-col gap-1 ${className ?? ""}`, children: [
|
|
1091
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "text-xs text-gray-700 flex items-start gap-0.5", children: [
|
|
1092
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: label }),
|
|
1093
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-red-500 text-[10px] leading-none mt-0.5", children: "*" })
|
|
744
1094
|
] }),
|
|
745
|
-
/* @__PURE__ */ (0,
|
|
1095
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
746
1096
|
"div",
|
|
747
1097
|
{
|
|
748
1098
|
role: "radiogroup",
|
|
@@ -751,12 +1101,12 @@ var InputRadio = (0, import_react13.forwardRef)(
|
|
|
751
1101
|
children: options.map((option) => {
|
|
752
1102
|
const isSelected = value === option.value;
|
|
753
1103
|
const isDisabled = disabled || option.disabled;
|
|
754
|
-
return /* @__PURE__ */ (0,
|
|
1104
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
755
1105
|
"label",
|
|
756
1106
|
{
|
|
757
1107
|
className: `flex items-center gap-2 cursor-pointer select-none ${isDisabled ? "opacity-50 cursor-not-allowed" : ""}`,
|
|
758
1108
|
children: [
|
|
759
|
-
/* @__PURE__ */ (0,
|
|
1109
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
760
1110
|
"button",
|
|
761
1111
|
{
|
|
762
1112
|
type: "button",
|
|
@@ -765,10 +1115,10 @@ var InputRadio = (0, import_react13.forwardRef)(
|
|
|
765
1115
|
className: radioButton({ selected: isSelected, disabled: !!isDisabled, error: !!error }),
|
|
766
1116
|
onClick: () => !isDisabled && onChange?.(option.value),
|
|
767
1117
|
disabled: isDisabled,
|
|
768
|
-
children: isSelected && /* @__PURE__ */ (0,
|
|
1118
|
+
children: isSelected && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "w-[10px] h-[10px] rounded-full bg-blue-600" })
|
|
769
1119
|
}
|
|
770
1120
|
),
|
|
771
|
-
/* @__PURE__ */ (0,
|
|
1121
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-sm text-gray-700", children: option.label })
|
|
772
1122
|
]
|
|
773
1123
|
},
|
|
774
1124
|
String(option.value)
|
|
@@ -776,17 +1126,17 @@ var InputRadio = (0, import_react13.forwardRef)(
|
|
|
776
1126
|
})
|
|
777
1127
|
}
|
|
778
1128
|
),
|
|
779
|
-
error && /* @__PURE__ */ (0,
|
|
1129
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "text-xs text-red-500 mt-0.5", children: "Selecione uma op\xE7\xE3o" })
|
|
780
1130
|
] });
|
|
781
1131
|
}
|
|
782
1132
|
);
|
|
783
1133
|
InputRadio.displayName = "InputRadio";
|
|
784
1134
|
|
|
785
1135
|
// src/components/Input/Textarea.tsx
|
|
786
|
-
var
|
|
787
|
-
var
|
|
788
|
-
var
|
|
789
|
-
var textareaStyle = (0,
|
|
1136
|
+
var import_react18 = require("react");
|
|
1137
|
+
var import_tailwind_variants9 = require("tailwind-variants");
|
|
1138
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1139
|
+
var textareaStyle = (0, import_tailwind_variants9.tv)({
|
|
790
1140
|
base: "w-full rounded-md border bg-white px-2.5 py-2 text-sm text-gray-900 outline-none placeholder:text-gray-400 resize-vertical transition-colors",
|
|
791
1141
|
variants: {
|
|
792
1142
|
error: {
|
|
@@ -801,14 +1151,14 @@ var textareaStyle = (0, import_tailwind_variants5.tv)({
|
|
|
801
1151
|
error: false
|
|
802
1152
|
}
|
|
803
1153
|
});
|
|
804
|
-
var Textarea = (0,
|
|
1154
|
+
var Textarea = (0, import_react18.forwardRef)(
|
|
805
1155
|
({ label, error, errorMessage, required, size, classInput, value, onChange, disabled, name, rows = 4, ...props }, ref) => {
|
|
806
|
-
return /* @__PURE__ */ (0,
|
|
807
|
-
label && /* @__PURE__ */ (0,
|
|
808
|
-
/* @__PURE__ */ (0,
|
|
809
|
-
required && /* @__PURE__ */ (0,
|
|
1156
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex w-full flex-col gap-1", children: [
|
|
1157
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { htmlFor: name, className: "text-xs text-gray-700 flex items-start gap-0.5", children: [
|
|
1158
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: label }),
|
|
1159
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-red-500 text-[10px] leading-none mt-0.5", children: "*" })
|
|
810
1160
|
] }),
|
|
811
|
-
/* @__PURE__ */ (0,
|
|
1161
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
812
1162
|
"textarea",
|
|
813
1163
|
{
|
|
814
1164
|
ref,
|
|
@@ -823,14 +1173,16 @@ var Textarea = (0, import_react14.forwardRef)(
|
|
|
823
1173
|
...props
|
|
824
1174
|
}
|
|
825
1175
|
),
|
|
826
|
-
error && errorMessage && /* @__PURE__ */ (0,
|
|
1176
|
+
error && errorMessage && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-xs text-red-500 mt-0.5", children: errorMessage })
|
|
827
1177
|
] });
|
|
828
1178
|
}
|
|
829
1179
|
);
|
|
830
1180
|
Textarea.displayName = "Textarea";
|
|
831
1181
|
// Annotate the CommonJS export names for ESM import in node:
|
|
832
1182
|
0 && (module.exports = {
|
|
1183
|
+
Avatar,
|
|
833
1184
|
Button,
|
|
1185
|
+
Card,
|
|
834
1186
|
InputCNPJ,
|
|
835
1187
|
InputCPF,
|
|
836
1188
|
InputCep,
|
|
@@ -843,13 +1195,19 @@ Textarea.displayName = "Textarea";
|
|
|
843
1195
|
InputRadio,
|
|
844
1196
|
InputString,
|
|
845
1197
|
InputWrapper,
|
|
1198
|
+
Modal,
|
|
846
1199
|
Textarea,
|
|
1200
|
+
Tooltip,
|
|
1201
|
+
avatar,
|
|
847
1202
|
button,
|
|
1203
|
+
card,
|
|
848
1204
|
maskCEP,
|
|
849
1205
|
maskCNPJ,
|
|
850
1206
|
maskCPF,
|
|
851
1207
|
maskCurrency,
|
|
852
1208
|
maskPhone,
|
|
1209
|
+
modal,
|
|
1210
|
+
tooltip,
|
|
853
1211
|
unmask,
|
|
854
1212
|
unmaskCurrency
|
|
855
1213
|
});
|