@koaris/bloom-ui 1.2.1 → 1.2.3
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 +1 -1
- package/dist/index.cjs +927 -362
- package/dist/index.d.cts +122 -27
- package/dist/index.d.ts +122 -27
- package/dist/index.mjs +904 -361
- package/package.json +3 -3
- package/tailwind.css +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,35 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
var __objRest = (source, exclude) => {
|
|
21
|
-
var target = {};
|
|
22
|
-
for (var prop in source)
|
|
23
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
-
target[prop] = source[prop];
|
|
25
|
-
if (source != null && __getOwnPropSymbols)
|
|
26
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
}
|
|
30
|
-
return target;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
1
|
// ../../node_modules/tailwind-merge/dist/bundle-mjs.mjs
|
|
34
2
|
var CLASS_PART_SEPARATOR = "-";
|
|
35
3
|
var createClassGroupUtils = (config) => {
|
|
@@ -58,7 +26,6 @@ var createClassGroupUtils = (config) => {
|
|
|
58
26
|
};
|
|
59
27
|
};
|
|
60
28
|
var getGroupRecursive = (classParts, classPartObject) => {
|
|
61
|
-
var _a;
|
|
62
29
|
if (classParts.length === 0) {
|
|
63
30
|
return classPartObject.classGroupId;
|
|
64
31
|
}
|
|
@@ -72,15 +39,15 @@ var getGroupRecursive = (classParts, classPartObject) => {
|
|
|
72
39
|
return void 0;
|
|
73
40
|
}
|
|
74
41
|
const classRest = classParts.join(CLASS_PART_SEPARATOR);
|
|
75
|
-
return
|
|
42
|
+
return classPartObject.validators.find(({
|
|
76
43
|
validator
|
|
77
|
-
}) => validator(classRest))
|
|
44
|
+
}) => validator(classRest))?.classGroupId;
|
|
78
45
|
};
|
|
79
46
|
var arbitraryPropertyRegex = /^\[(.+)\]$/;
|
|
80
47
|
var getGroupIdForArbitraryProperty = (className) => {
|
|
81
48
|
if (arbitraryPropertyRegex.test(className)) {
|
|
82
49
|
const arbitraryPropertyClassName = arbitraryPropertyRegex.exec(className)[1];
|
|
83
|
-
const property = arbitraryPropertyClassName
|
|
50
|
+
const property = arbitraryPropertyClassName?.substring(0, arbitraryPropertyClassName.indexOf(":"));
|
|
84
51
|
if (property) {
|
|
85
52
|
return "arbitrary.." + property;
|
|
86
53
|
}
|
|
@@ -265,10 +232,11 @@ var sortModifiers = (modifiers) => {
|
|
|
265
232
|
sortedModifiers.push(...unsortedModifiers.sort());
|
|
266
233
|
return sortedModifiers;
|
|
267
234
|
};
|
|
268
|
-
var createConfigUtils = (config) =>
|
|
235
|
+
var createConfigUtils = (config) => ({
|
|
269
236
|
cache: createLruCache(config.cacheSize),
|
|
270
|
-
parseClassName: createParseClassName(config)
|
|
271
|
-
|
|
237
|
+
parseClassName: createParseClassName(config),
|
|
238
|
+
...createClassGroupUtils(config)
|
|
239
|
+
});
|
|
272
240
|
var SPLIT_CLASSES_REGEX = /\s+/;
|
|
273
241
|
var mergeClassList = (classList, configUtils) => {
|
|
274
242
|
const {
|
|
@@ -2492,50 +2460,97 @@ var twMerge = /* @__PURE__ */ createTailwindMerge(getDefaultConfig);
|
|
|
2492
2460
|
|
|
2493
2461
|
// src/components/Card/index.tsx
|
|
2494
2462
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2495
|
-
var Card = (
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2463
|
+
var Card = ({
|
|
2464
|
+
className,
|
|
2465
|
+
selected = false,
|
|
2466
|
+
direction = "row",
|
|
2467
|
+
size = "medium",
|
|
2468
|
+
disabled = false,
|
|
2469
|
+
image,
|
|
2470
|
+
imageSize = "100px",
|
|
2471
|
+
imageAlt = "",
|
|
2472
|
+
title,
|
|
2473
|
+
content,
|
|
2474
|
+
onClick,
|
|
2475
|
+
footer,
|
|
2476
|
+
hoverable = true,
|
|
2477
|
+
...rest
|
|
2478
|
+
}) => {
|
|
2479
|
+
const handleClick = () => {
|
|
2480
|
+
if (!disabled && onClick) {
|
|
2481
|
+
onClick();
|
|
2482
|
+
}
|
|
2483
|
+
};
|
|
2484
|
+
const cardSizeClasses = {
|
|
2485
|
+
small: "max-w-xs p-3",
|
|
2486
|
+
medium: "max-w-md p-4",
|
|
2487
|
+
large: "max-w-lg p-5",
|
|
2488
|
+
full: "w-full p-5"
|
|
2489
|
+
};
|
|
2513
2490
|
return /* @__PURE__ */ jsxs(
|
|
2514
2491
|
"div",
|
|
2515
2492
|
{
|
|
2516
2493
|
className: twMerge(
|
|
2517
|
-
"flex items-center
|
|
2518
|
-
"
|
|
2519
|
-
size
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2494
|
+
"flex items-center rounded-lg bg-neutral border border-neutral-500 text-neutral-1000 transition-all duration-200",
|
|
2495
|
+
direction === "col" ? "flex-col" : "flex-row",
|
|
2496
|
+
cardSizeClasses[size],
|
|
2497
|
+
hoverable && !disabled && "hover:shadow-md hover:shadow-neutral-500",
|
|
2498
|
+
selected && "border-2 border-orange-500",
|
|
2499
|
+
disabled && "opacity-50 cursor-not-allowed",
|
|
2500
|
+
onClick && !disabled && "cursor-pointer",
|
|
2524
2501
|
className
|
|
2525
2502
|
),
|
|
2526
|
-
onClick,
|
|
2503
|
+
onClick: handleClick,
|
|
2504
|
+
role: onClick && !disabled ? "button" : void 0,
|
|
2505
|
+
tabIndex: onClick && !disabled ? 0 : void 0,
|
|
2506
|
+
onKeyDown: (e) => {
|
|
2507
|
+
if ((e.key === "Enter" || e.key === " ") && onClick && !disabled) {
|
|
2508
|
+
e.preventDefault();
|
|
2509
|
+
onClick();
|
|
2510
|
+
}
|
|
2511
|
+
},
|
|
2512
|
+
"aria-disabled": disabled,
|
|
2513
|
+
...rest,
|
|
2527
2514
|
children: [
|
|
2528
|
-
/* @__PURE__ */ jsx(
|
|
2515
|
+
image && /* @__PURE__ */ jsx(
|
|
2516
|
+
"div",
|
|
2517
|
+
{
|
|
2518
|
+
className: twMerge(
|
|
2519
|
+
"flex-shrink-0",
|
|
2520
|
+
direction === "row" ? "mr-4" : "mb-4",
|
|
2521
|
+
size === "small" && direction === "row" ? "mr-3" : "",
|
|
2522
|
+
size === "small" && direction === "col" ? "mb-3" : ""
|
|
2523
|
+
),
|
|
2524
|
+
children: /* @__PURE__ */ jsx(
|
|
2525
|
+
"img",
|
|
2526
|
+
{
|
|
2527
|
+
src: image,
|
|
2528
|
+
alt: imageAlt,
|
|
2529
|
+
width: imageSize,
|
|
2530
|
+
height: "auto",
|
|
2531
|
+
className: "rounded object-cover"
|
|
2532
|
+
}
|
|
2533
|
+
)
|
|
2534
|
+
}
|
|
2535
|
+
),
|
|
2529
2536
|
/* @__PURE__ */ jsxs(
|
|
2530
|
-
"
|
|
2537
|
+
"div",
|
|
2531
2538
|
{
|
|
2532
2539
|
className: twMerge(
|
|
2533
|
-
|
|
2534
|
-
"
|
|
2540
|
+
"flex flex-col",
|
|
2541
|
+
direction === "col" && "text-center w-full",
|
|
2542
|
+
direction === "row" && "flex-1"
|
|
2535
2543
|
),
|
|
2536
2544
|
children: [
|
|
2537
|
-
/* @__PURE__ */ jsx("
|
|
2538
|
-
/* @__PURE__ */ jsx("
|
|
2545
|
+
title && /* @__PURE__ */ jsx("h3", { className: "text-xl font-bold font-default leading-tight mb-2", children: title }),
|
|
2546
|
+
content && /* @__PURE__ */ jsx("div", { className: twMerge(
|
|
2547
|
+
"text-base",
|
|
2548
|
+
direction === "col" ? "text-center" : "text-left"
|
|
2549
|
+
), children: content }),
|
|
2550
|
+
footer && /* @__PURE__ */ jsx("div", { className: twMerge(
|
|
2551
|
+
"mt-4 pt-3 border-t border-neutral-300",
|
|
2552
|
+
direction === "col" ? "text-center" : "text-left"
|
|
2553
|
+
), children: footer })
|
|
2539
2554
|
]
|
|
2540
2555
|
}
|
|
2541
2556
|
)
|
|
@@ -2543,74 +2558,132 @@ var Card = (_a) => {
|
|
|
2543
2558
|
}
|
|
2544
2559
|
);
|
|
2545
2560
|
};
|
|
2561
|
+
Card.displayName = "Card";
|
|
2546
2562
|
|
|
2547
2563
|
// src/components/Button/index.tsx
|
|
2548
|
-
import {
|
|
2549
|
-
|
|
2550
|
-
|
|
2564
|
+
import { forwardRef } from "react";
|
|
2565
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
2566
|
+
var Button = forwardRef(
|
|
2567
|
+
({
|
|
2551
2568
|
className,
|
|
2552
2569
|
variant = "primary",
|
|
2553
2570
|
size = "md",
|
|
2554
|
-
disabled,
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2571
|
+
disabled = false,
|
|
2572
|
+
loading = false,
|
|
2573
|
+
startIcon,
|
|
2574
|
+
endIcon,
|
|
2575
|
+
fullWidth = false,
|
|
2576
|
+
onClick,
|
|
2577
|
+
children,
|
|
2578
|
+
...rest
|
|
2579
|
+
}, ref) => {
|
|
2580
|
+
const sizeClasses = {
|
|
2581
|
+
xs: "px-3 py-1 text-xs",
|
|
2582
|
+
sm: "px-5 py-1.5 text-sm",
|
|
2583
|
+
md: "px-6 py-2 text-md",
|
|
2584
|
+
lg: "px-8 py-3 text-lg"
|
|
2585
|
+
};
|
|
2586
|
+
const variantClasses = {
|
|
2587
|
+
primary: "bg-orange-500 text-neutral hover:bg-orange-700 focus:ring-orange-500",
|
|
2588
|
+
secondary: "bg-neutral text-orange-500 border border-orange-500 hover:text-neutral hover:bg-orange-500 focus:ring-orange-500",
|
|
2589
|
+
outline: "bg-transparent text-orange-500 border border-orange-500 hover:bg-orange-50 focus:ring-orange-500",
|
|
2590
|
+
ghost: "bg-transparent text-orange-500 hover:bg-orange-50 focus:ring-orange-500",
|
|
2591
|
+
link: "bg-transparent text-orange-500 hover:underline p-0 h-auto shadow-none focus:ring-0"
|
|
2592
|
+
};
|
|
2593
|
+
const handleClick = (e) => {
|
|
2594
|
+
if (loading || disabled) return;
|
|
2595
|
+
onClick?.(e);
|
|
2596
|
+
};
|
|
2597
|
+
return /* @__PURE__ */ jsxs2(
|
|
2598
|
+
"button",
|
|
2599
|
+
{
|
|
2600
|
+
ref,
|
|
2601
|
+
className: twMerge(
|
|
2602
|
+
"relative font-medium rounded-sm transition-all duration-200",
|
|
2603
|
+
"focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-opacity-50",
|
|
2604
|
+
variantClasses[variant],
|
|
2605
|
+
sizeClasses[size],
|
|
2606
|
+
fullWidth ? "w-full" : "max-w-[180px]",
|
|
2607
|
+
"inline-flex items-center justify-center gap-2",
|
|
2608
|
+
(disabled || loading) && "opacity-50 cursor-not-allowed hover:shadow-none hover:bg-opacity-100",
|
|
2609
|
+
className
|
|
2610
|
+
),
|
|
2611
|
+
onClick: handleClick,
|
|
2612
|
+
disabled: disabled || loading,
|
|
2613
|
+
...rest,
|
|
2614
|
+
children: [
|
|
2615
|
+
loading && /* @__PURE__ */ jsx2("span", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsxs2(
|
|
2616
|
+
"svg",
|
|
2617
|
+
{
|
|
2618
|
+
className: "animate-spin h-5 w-5",
|
|
2619
|
+
viewBox: "0 0 24 24",
|
|
2620
|
+
fill: "none",
|
|
2621
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2622
|
+
children: [
|
|
2623
|
+
/* @__PURE__ */ jsx2(
|
|
2624
|
+
"circle",
|
|
2625
|
+
{
|
|
2626
|
+
className: "opacity-25",
|
|
2627
|
+
cx: "12",
|
|
2628
|
+
cy: "12",
|
|
2629
|
+
r: "10",
|
|
2630
|
+
stroke: "currentColor",
|
|
2631
|
+
strokeWidth: "4"
|
|
2632
|
+
}
|
|
2633
|
+
),
|
|
2634
|
+
/* @__PURE__ */ jsx2(
|
|
2635
|
+
"path",
|
|
2636
|
+
{
|
|
2637
|
+
className: "opacity-75",
|
|
2638
|
+
fill: "currentColor",
|
|
2639
|
+
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
2640
|
+
}
|
|
2641
|
+
)
|
|
2642
|
+
]
|
|
2643
|
+
}
|
|
2644
|
+
) }),
|
|
2645
|
+
/* @__PURE__ */ jsxs2("span", { className: loading ? "invisible" : "flex items-center gap-2", children: [
|
|
2646
|
+
startIcon && /* @__PURE__ */ jsx2("span", { className: "mr-1", children: startIcon }),
|
|
2647
|
+
children,
|
|
2648
|
+
endIcon && /* @__PURE__ */ jsx2("span", { className: "ml-1", children: endIcon })
|
|
2649
|
+
] })
|
|
2650
|
+
]
|
|
2651
|
+
}
|
|
2652
|
+
);
|
|
2653
|
+
}
|
|
2654
|
+
);
|
|
2655
|
+
Button.displayName = "Button";
|
|
2579
2656
|
|
|
2580
2657
|
// src/components/Link/index.tsx
|
|
2581
2658
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
2582
|
-
var Link = (
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
"className",
|
|
2591
|
-
"disabled",
|
|
2592
|
-
"url",
|
|
2593
|
-
"newPage",
|
|
2594
|
-
"onClick"
|
|
2595
|
-
]);
|
|
2659
|
+
var Link = ({
|
|
2660
|
+
className,
|
|
2661
|
+
disabled,
|
|
2662
|
+
url,
|
|
2663
|
+
newPage = true,
|
|
2664
|
+
onClick,
|
|
2665
|
+
...rest
|
|
2666
|
+
}) => {
|
|
2596
2667
|
return /* @__PURE__ */ jsx3(
|
|
2597
2668
|
"a",
|
|
2598
|
-
|
|
2669
|
+
{
|
|
2599
2670
|
className: twMerge(
|
|
2600
2671
|
"text-blue-800 font-bold",
|
|
2601
2672
|
typeof rest.children !== "string" && "px-4",
|
|
2602
2673
|
disabled === true && "opacity-50 cursor-not-allowed",
|
|
2603
2674
|
className
|
|
2604
2675
|
),
|
|
2605
|
-
href: url
|
|
2606
|
-
|
|
2676
|
+
href: url,
|
|
2677
|
+
...newPage && { target: "_blank", rel: "noopener noreferrer" },
|
|
2678
|
+
...rest
|
|
2679
|
+
}
|
|
2607
2680
|
);
|
|
2608
2681
|
};
|
|
2609
2682
|
|
|
2610
2683
|
// src/components/RadioGroup/index.tsx
|
|
2611
2684
|
import { useState } from "react";
|
|
2612
2685
|
import { FiCheck } from "react-icons/fi";
|
|
2613
|
-
import { jsx as jsx4, jsxs as
|
|
2686
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
2614
2687
|
var RadioGroup = ({
|
|
2615
2688
|
disabled,
|
|
2616
2689
|
options = [
|
|
@@ -2624,8 +2697,8 @@ var RadioGroup = ({
|
|
|
2624
2697
|
const handleOptionChange = (value) => {
|
|
2625
2698
|
setSelectedOption(value);
|
|
2626
2699
|
};
|
|
2627
|
-
return /* @__PURE__ */ jsx4("div", { className: "flex flex-col ", children: options.map((option) => /* @__PURE__ */
|
|
2628
|
-
/* @__PURE__ */
|
|
2700
|
+
return /* @__PURE__ */ jsx4("div", { className: "flex flex-col ", children: options.map((option) => /* @__PURE__ */ jsxs3("div", { className: "flex py-2 items-center", children: [
|
|
2701
|
+
/* @__PURE__ */ jsxs3(
|
|
2629
2702
|
"label",
|
|
2630
2703
|
{
|
|
2631
2704
|
htmlFor: `radio${option.id}`,
|
|
@@ -2661,13 +2734,13 @@ var RadioGroup = ({
|
|
|
2661
2734
|
// src/components/Checkbox/index.tsx
|
|
2662
2735
|
import { useState as useState2 } from "react";
|
|
2663
2736
|
import { FiCheck as FiCheck2 } from "react-icons/fi";
|
|
2664
|
-
import { jsx as jsx5, jsxs as
|
|
2737
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2665
2738
|
var Checkbox = ({ className, required, disabled }) => {
|
|
2666
2739
|
const [selected, setSelected] = useState2(false);
|
|
2667
2740
|
const handleCheckboxChange = (value) => {
|
|
2668
2741
|
setSelected(!value);
|
|
2669
2742
|
};
|
|
2670
|
-
return /* @__PURE__ */ jsx5("div", { className: "flex items-center justify-center", children: /* @__PURE__ */
|
|
2743
|
+
return /* @__PURE__ */ jsx5("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ jsxs4(
|
|
2671
2744
|
"label",
|
|
2672
2745
|
{
|
|
2673
2746
|
className: twMerge(
|
|
@@ -2701,179 +2774,240 @@ var Checkbox = ({ className, required, disabled }) => {
|
|
|
2701
2774
|
import {
|
|
2702
2775
|
useEffect,
|
|
2703
2776
|
useState as useState3,
|
|
2704
|
-
forwardRef
|
|
2777
|
+
forwardRef as forwardRef2
|
|
2705
2778
|
} from "react";
|
|
2706
2779
|
import { FiCheck as FiCheck3, FiX } from "react-icons/fi";
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
password: [/^(?=.*[!@#$%^&*])/, /(?=.*[0-9])/, /.{8,}$/],
|
|
2711
|
-
date: [/\d/, /\d/, "/", /\d/, /\d/, "/", /\d/, /\d/, /\d/, /\d/],
|
|
2712
|
-
cpf: [
|
|
2713
|
-
/\d/,
|
|
2714
|
-
/\d/,
|
|
2715
|
-
/\d/,
|
|
2716
|
-
".",
|
|
2717
|
-
/\d/,
|
|
2718
|
-
/\d/,
|
|
2719
|
-
/\d/,
|
|
2720
|
-
".",
|
|
2721
|
-
/\d/,
|
|
2722
|
-
/\d/,
|
|
2723
|
-
/\d/,
|
|
2724
|
-
"-",
|
|
2725
|
-
/\d/,
|
|
2726
|
-
/\d/
|
|
2727
|
-
],
|
|
2728
|
-
cnpj: [
|
|
2729
|
-
/\d/,
|
|
2730
|
-
/\d/,
|
|
2731
|
-
".",
|
|
2732
|
-
/\d/,
|
|
2733
|
-
/\d/,
|
|
2734
|
-
/\d/,
|
|
2735
|
-
".",
|
|
2736
|
-
/\d/,
|
|
2737
|
-
/\d/,
|
|
2738
|
-
/\d/,
|
|
2739
|
-
"/",
|
|
2740
|
-
/\d/,
|
|
2741
|
-
/\d/,
|
|
2742
|
-
/\d/,
|
|
2743
|
-
/\d/,
|
|
2744
|
-
"-",
|
|
2745
|
-
/\d/,
|
|
2746
|
-
/\d/
|
|
2747
|
-
],
|
|
2748
|
-
cep: [/\d/, /\d/, /\d/, /\d/, /\d/, "-", /\d/, /\d/, /\d/],
|
|
2749
|
-
phone: [
|
|
2750
|
-
"(",
|
|
2751
|
-
/[1-9]/,
|
|
2752
|
-
/[1-9]/,
|
|
2753
|
-
")",
|
|
2754
|
-
" ",
|
|
2755
|
-
/\d/,
|
|
2756
|
-
/\d/,
|
|
2757
|
-
/\d/,
|
|
2758
|
-
/\d/,
|
|
2759
|
-
/\d/,
|
|
2760
|
-
"-",
|
|
2761
|
-
/\d/,
|
|
2762
|
-
/\d/,
|
|
2763
|
-
/\d/,
|
|
2764
|
-
/\d/
|
|
2765
|
-
]
|
|
2780
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
2781
|
+
var passwordMask = {
|
|
2782
|
+
password: [/^(?=.*[!@#$%^&*])/, /(?=.*[0-9])/, /.{8,}$/]
|
|
2766
2783
|
};
|
|
2767
|
-
var
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
"disabled",
|
|
2786
|
-
"placeholder",
|
|
2787
|
-
"value",
|
|
2788
|
-
"validated",
|
|
2789
|
-
"error",
|
|
2790
|
-
"required",
|
|
2791
|
-
"type",
|
|
2792
|
-
"onClick"
|
|
2793
|
-
]);
|
|
2784
|
+
var Input = forwardRef2(
|
|
2785
|
+
({
|
|
2786
|
+
className,
|
|
2787
|
+
disabled,
|
|
2788
|
+
placeholder,
|
|
2789
|
+
value,
|
|
2790
|
+
validated,
|
|
2791
|
+
error,
|
|
2792
|
+
required,
|
|
2793
|
+
type,
|
|
2794
|
+
onClick,
|
|
2795
|
+
errorMessage,
|
|
2796
|
+
onChange: externalOnChange,
|
|
2797
|
+
label,
|
|
2798
|
+
helperText,
|
|
2799
|
+
id,
|
|
2800
|
+
...rest
|
|
2801
|
+
}, ref) => {
|
|
2794
2802
|
const [selected, setSelected] = useState3(false);
|
|
2795
|
-
const [inputValue, setInputValue] = useState3(value);
|
|
2796
|
-
const [
|
|
2797
|
-
|
|
2798
|
-
|
|
2803
|
+
const [inputValue, setInputValue] = useState3(value || "");
|
|
2804
|
+
const [passwordValidation, setPasswordValidation] = useState3({
|
|
2805
|
+
hasEightCharacters: false,
|
|
2806
|
+
hasSpecialCharacters: false,
|
|
2807
|
+
hasNumber: false
|
|
2808
|
+
});
|
|
2809
|
+
const [isValid, setIsValid] = useState3(false);
|
|
2799
2810
|
const handleFocus = () => {
|
|
2800
|
-
setSelected(
|
|
2811
|
+
setSelected(true);
|
|
2801
2812
|
};
|
|
2802
2813
|
const handleBlur = () => {
|
|
2803
2814
|
setSelected(false);
|
|
2815
|
+
validateInput(inputValue || "");
|
|
2816
|
+
};
|
|
2817
|
+
const applyMask = (value2, type2) => {
|
|
2818
|
+
let result = value2;
|
|
2819
|
+
switch (type2) {
|
|
2820
|
+
case "date":
|
|
2821
|
+
result = value2.replace(/\D/g, "");
|
|
2822
|
+
if (result.length > 8) result = result.substring(0, 8);
|
|
2823
|
+
if (result.length > 4) result = result.replace(/(\d{2})(\d{2})(\d+)/, "$1/$2/$3");
|
|
2824
|
+
else if (result.length > 2) result = result.replace(/(\d{2})(\d+)/, "$1/$2");
|
|
2825
|
+
break;
|
|
2826
|
+
case "cpf":
|
|
2827
|
+
result = value2.replace(/\D/g, "");
|
|
2828
|
+
if (result.length > 11) result = result.substring(0, 11);
|
|
2829
|
+
if (result.length > 9) result = result.replace(/(\d{3})(\d{3})(\d{3})(\d+)/, "$1.$2.$3-$4");
|
|
2830
|
+
else if (result.length > 6) result = result.replace(/(\d{3})(\d{3})(\d+)/, "$1.$2.$3");
|
|
2831
|
+
else if (result.length > 3) result = result.replace(/(\d{3})(\d+)/, "$1.$2");
|
|
2832
|
+
break;
|
|
2833
|
+
case "cnpj":
|
|
2834
|
+
result = value2.replace(/\D/g, "");
|
|
2835
|
+
if (result.length > 14) result = result.substring(0, 14);
|
|
2836
|
+
if (result.length > 12)
|
|
2837
|
+
result = result.replace(/(\d{2})(\d{3})(\d{3})(\d{4})(\d+)/, "$1.$2.$3/$4-$5");
|
|
2838
|
+
else if (result.length > 8)
|
|
2839
|
+
result = result.replace(/(\d{2})(\d{3})(\d{3})(\d+)/, "$1.$2.$3/$4");
|
|
2840
|
+
else if (result.length > 5)
|
|
2841
|
+
result = result.replace(/(\d{2})(\d{3})(\d+)/, "$1.$2.$3");
|
|
2842
|
+
else if (result.length > 2)
|
|
2843
|
+
result = result.replace(/(\d{2})(\d+)/, "$1.$2");
|
|
2844
|
+
break;
|
|
2845
|
+
case "cep":
|
|
2846
|
+
result = value2.replace(/\D/g, "");
|
|
2847
|
+
if (result.length > 8) result = result.substring(0, 8);
|
|
2848
|
+
if (result.length > 5) result = result.replace(/(\d{5})(\d+)/, "$1-$2");
|
|
2849
|
+
break;
|
|
2850
|
+
case "phone":
|
|
2851
|
+
result = value2.replace(/\D/g, "");
|
|
2852
|
+
if (result.length > 11) result = result.substring(0, 11);
|
|
2853
|
+
if (result.length > 10)
|
|
2854
|
+
result = result.replace(/(\d{2})(\d{5})(\d+)/, "($1) $2-$3");
|
|
2855
|
+
else if (result.length > 6)
|
|
2856
|
+
result = result.replace(/(\d{2})(\d{4})(\d+)/, "($1) $2-$3");
|
|
2857
|
+
else if (result.length > 2)
|
|
2858
|
+
result = result.replace(/(\d{2})(\d+)/, "($1) $2");
|
|
2859
|
+
break;
|
|
2860
|
+
default:
|
|
2861
|
+
break;
|
|
2862
|
+
}
|
|
2863
|
+
return result;
|
|
2864
|
+
};
|
|
2865
|
+
const validateInput = (value2) => {
|
|
2866
|
+
if (!value2) return false;
|
|
2867
|
+
let valid = false;
|
|
2868
|
+
switch (type) {
|
|
2869
|
+
case "password":
|
|
2870
|
+
valid = passwordValidation.hasEightCharacters && passwordValidation.hasSpecialCharacters && passwordValidation.hasNumber;
|
|
2871
|
+
break;
|
|
2872
|
+
case "date":
|
|
2873
|
+
valid = /^\d{2}\/\d{2}\/\d{4}$/.test(value2);
|
|
2874
|
+
break;
|
|
2875
|
+
case "cpf":
|
|
2876
|
+
valid = /^\d{3}\.\d{3}\.\d{3}-\d{2}$/.test(value2);
|
|
2877
|
+
break;
|
|
2878
|
+
case "cnpj":
|
|
2879
|
+
valid = /^\d{2}\.\d{3}\.\d{3}\/\d{4}-\d{2}$/.test(value2);
|
|
2880
|
+
break;
|
|
2881
|
+
case "cep":
|
|
2882
|
+
valid = /^\d{5}-\d{3}$/.test(value2);
|
|
2883
|
+
break;
|
|
2884
|
+
case "phone":
|
|
2885
|
+
valid = /^\(\d{2}\) \d{5}-\d{4}$/.test(value2);
|
|
2886
|
+
break;
|
|
2887
|
+
default:
|
|
2888
|
+
valid = value2.length > 0;
|
|
2889
|
+
break;
|
|
2890
|
+
}
|
|
2891
|
+
setIsValid(valid);
|
|
2892
|
+
return valid;
|
|
2804
2893
|
};
|
|
2805
2894
|
const handleInput = (event) => {
|
|
2806
|
-
|
|
2807
|
-
|
|
2895
|
+
let newValue = event.currentTarget.value;
|
|
2896
|
+
if (["date", "cpf", "phone", "cnpj", "cep"].includes(type)) {
|
|
2897
|
+
newValue = applyMask(newValue, type);
|
|
2898
|
+
}
|
|
2899
|
+
const newEvent = {
|
|
2900
|
+
...event,
|
|
2901
|
+
currentTarget: {
|
|
2902
|
+
...event.currentTarget,
|
|
2903
|
+
value: newValue
|
|
2904
|
+
},
|
|
2905
|
+
target: {
|
|
2906
|
+
...event.target,
|
|
2907
|
+
value: newValue
|
|
2908
|
+
}
|
|
2909
|
+
};
|
|
2910
|
+
setInputValue(newValue);
|
|
2911
|
+
if (type === "password") {
|
|
2912
|
+
checkPassword(newValue);
|
|
2913
|
+
} else {
|
|
2914
|
+
validateInput(newValue);
|
|
2915
|
+
}
|
|
2916
|
+
externalOnChange?.(newEvent);
|
|
2808
2917
|
};
|
|
2809
2918
|
useEffect(() => {
|
|
2810
|
-
setInputValue(value);
|
|
2811
|
-
|
|
2919
|
+
setInputValue(value || "");
|
|
2920
|
+
if (value && type === "password") {
|
|
2921
|
+
checkPassword(value);
|
|
2922
|
+
} else if (value) {
|
|
2923
|
+
validateInput(value);
|
|
2924
|
+
}
|
|
2925
|
+
}, [value, type]);
|
|
2812
2926
|
const checkPassword = (value2) => {
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2927
|
+
const validationResult = {
|
|
2928
|
+
hasEightCharacters: value2?.match(passwordMask.password[2]) !== null,
|
|
2929
|
+
hasSpecialCharacters: value2?.match(passwordMask.password[0]) !== null,
|
|
2930
|
+
hasNumber: value2?.match(passwordMask.password[1]) !== null
|
|
2931
|
+
};
|
|
2932
|
+
setPasswordValidation(validationResult);
|
|
2933
|
+
setIsValid(
|
|
2934
|
+
validationResult.hasEightCharacters && validationResult.hasSpecialCharacters && validationResult.hasNumber
|
|
2935
|
+
);
|
|
2816
2936
|
};
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
"
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
] })
|
|
2937
|
+
const getInputType = () => {
|
|
2938
|
+
switch (type) {
|
|
2939
|
+
case "password":
|
|
2940
|
+
return "password";
|
|
2941
|
+
case "date":
|
|
2942
|
+
case "cpf":
|
|
2943
|
+
case "phone":
|
|
2944
|
+
case "cnpj":
|
|
2945
|
+
case "cep":
|
|
2946
|
+
return "text";
|
|
2947
|
+
default:
|
|
2948
|
+
return "text";
|
|
2949
|
+
}
|
|
2950
|
+
};
|
|
2951
|
+
const inputClasses = twMerge(
|
|
2952
|
+
"flex items-center justify-center border-2 border-neutral rounded-sm w-full px-3 py-2 text-md hover:shadow-md hover:shadow-neutral-500 focus:outline-none transition-all duration-200",
|
|
2953
|
+
className,
|
|
2954
|
+
disabled && "opacity-50 cursor-not-allowed",
|
|
2955
|
+
selected && "border-2 border-orange-500",
|
|
2956
|
+
validated && isValid && "border-2 border-green-900",
|
|
2957
|
+
error && "border-2 border-red-900"
|
|
2958
|
+
);
|
|
2959
|
+
const renderPasswordValidation = () => {
|
|
2960
|
+
if (type !== "password") return null;
|
|
2961
|
+
return /* @__PURE__ */ jsxs5("ul", { className: "py-1 text-sm", role: "list", children: [
|
|
2962
|
+
/* @__PURE__ */ jsxs5("li", { className: "flex items-center px-2", role: "listitem", children: [
|
|
2963
|
+
passwordValidation.hasEightCharacters ? /* @__PURE__ */ jsx6(FiCheck3, { className: "text-green-500" }) : /* @__PURE__ */ jsx6(FiX, { className: "text-red-500" }),
|
|
2964
|
+
/* @__PURE__ */ jsx6("span", { className: "px-1", children: "Pelo menos 8 caracteres" })
|
|
2965
|
+
] }),
|
|
2966
|
+
/* @__PURE__ */ jsxs5("li", { className: "flex items-center px-2", role: "listitem", children: [
|
|
2967
|
+
passwordValidation.hasSpecialCharacters ? /* @__PURE__ */ jsx6(FiCheck3, { className: "text-green-500" }) : /* @__PURE__ */ jsx6(FiX, { className: "text-red-500" }),
|
|
2968
|
+
/* @__PURE__ */ jsx6("span", { className: "px-1", children: "Pelo menos 1 s\xEDmbolo (@, !, $, etc)" })
|
|
2969
|
+
] }),
|
|
2970
|
+
/* @__PURE__ */ jsxs5("li", { className: "flex items-center px-2", role: "listitem", children: [
|
|
2971
|
+
passwordValidation.hasNumber ? /* @__PURE__ */ jsx6(FiCheck3, { className: "text-green-500" }) : /* @__PURE__ */ jsx6(FiX, { className: "text-red-500" }),
|
|
2972
|
+
/* @__PURE__ */ jsx6("span", { className: "px-1", children: "Deve conter 1 n\xFAmero" })
|
|
2854
2973
|
] })
|
|
2855
|
-
] })
|
|
2974
|
+
] });
|
|
2975
|
+
};
|
|
2976
|
+
return /* @__PURE__ */ jsxs5("div", { className: "w-full", children: [
|
|
2977
|
+
label && /* @__PURE__ */ jsxs5(
|
|
2978
|
+
"label",
|
|
2979
|
+
{
|
|
2980
|
+
htmlFor: id,
|
|
2981
|
+
className: "block text-sm font-medium text-gray-700 mb-1",
|
|
2982
|
+
children: [
|
|
2983
|
+
label,
|
|
2984
|
+
required && /* @__PURE__ */ jsx6("span", { className: "text-red-500 ml-1", children: "*" })
|
|
2985
|
+
]
|
|
2986
|
+
}
|
|
2987
|
+
),
|
|
2988
|
+
/* @__PURE__ */ jsx6(
|
|
2856
2989
|
"input",
|
|
2857
|
-
|
|
2858
|
-
type,
|
|
2990
|
+
{
|
|
2991
|
+
type: getInputType(),
|
|
2859
2992
|
required,
|
|
2993
|
+
disabled,
|
|
2860
2994
|
ref,
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
className,
|
|
2864
|
-
disabled === true && "opacity-50 cursor-not-allowed",
|
|
2865
|
-
selected === true && "border-2 border-orange-500",
|
|
2866
|
-
error === true && "border-2 border-red-900"
|
|
2867
|
-
),
|
|
2995
|
+
id,
|
|
2996
|
+
className: inputClasses,
|
|
2868
2997
|
onClick,
|
|
2869
2998
|
onFocus: handleFocus,
|
|
2870
2999
|
onChange: handleInput,
|
|
2871
3000
|
onBlur: handleBlur,
|
|
2872
3001
|
placeholder,
|
|
2873
|
-
value: inputValue
|
|
2874
|
-
|
|
3002
|
+
value: inputValue,
|
|
3003
|
+
"aria-invalid": error,
|
|
3004
|
+
"aria-describedby": error ? `${id}-error` : helperText ? `${id}-helper` : void 0,
|
|
3005
|
+
...rest
|
|
3006
|
+
}
|
|
2875
3007
|
),
|
|
2876
|
-
|
|
3008
|
+
renderPasswordValidation(),
|
|
3009
|
+
error && /* @__PURE__ */ jsx6("p", { id: `${id}-error`, className: "mt-1 text-sm text-red-900", role: "alert", children: errorMessage || "Invalid field." }),
|
|
3010
|
+
helperText && !error && /* @__PURE__ */ jsx6("p", { id: `${id}-helper`, className: "mt-1 text-sm text-gray-500", children: helperText })
|
|
2877
3011
|
] });
|
|
2878
3012
|
}
|
|
2879
3013
|
);
|
|
@@ -2883,32 +3017,22 @@ Input.displayName = "Input";
|
|
|
2883
3017
|
import {
|
|
2884
3018
|
useEffect as useEffect2,
|
|
2885
3019
|
useState as useState4,
|
|
2886
|
-
forwardRef as
|
|
3020
|
+
forwardRef as forwardRef3
|
|
2887
3021
|
} from "react";
|
|
2888
|
-
import { jsx as jsx7, jsxs as
|
|
2889
|
-
var TextInput =
|
|
2890
|
-
(
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
"className",
|
|
2903
|
-
"disabled",
|
|
2904
|
-
"value",
|
|
2905
|
-
"prefix",
|
|
2906
|
-
"placeholder",
|
|
2907
|
-
"error",
|
|
2908
|
-
"type",
|
|
2909
|
-
"variant",
|
|
2910
|
-
"onClick"
|
|
2911
|
-
]);
|
|
3022
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
3023
|
+
var TextInput = forwardRef3(
|
|
3024
|
+
({
|
|
3025
|
+
className,
|
|
3026
|
+
disabled,
|
|
3027
|
+
value,
|
|
3028
|
+
prefix,
|
|
3029
|
+
placeholder,
|
|
3030
|
+
error,
|
|
3031
|
+
type = "text",
|
|
3032
|
+
variant = "primary",
|
|
3033
|
+
onClick,
|
|
3034
|
+
...rest
|
|
3035
|
+
}, ref) => {
|
|
2912
3036
|
const [selected, setSelected] = useState4(false);
|
|
2913
3037
|
const [inputValue, setInputValue] = useState4(value);
|
|
2914
3038
|
const handleFocus = () => {
|
|
@@ -2923,7 +3047,7 @@ var TextInput = forwardRef2(
|
|
|
2923
3047
|
useEffect2(() => {
|
|
2924
3048
|
setInputValue(value);
|
|
2925
3049
|
}, [value]);
|
|
2926
|
-
return /* @__PURE__ */
|
|
3050
|
+
return /* @__PURE__ */ jsxs6(
|
|
2927
3051
|
"div",
|
|
2928
3052
|
{
|
|
2929
3053
|
className: twMerge(
|
|
@@ -2938,7 +3062,7 @@ var TextInput = forwardRef2(
|
|
|
2938
3062
|
!!prefix && /* @__PURE__ */ jsx7("span", { className: "text-neutral-500 sm:text-sm", children: prefix }),
|
|
2939
3063
|
/* @__PURE__ */ jsx7(
|
|
2940
3064
|
"input",
|
|
2941
|
-
|
|
3065
|
+
{
|
|
2942
3066
|
type,
|
|
2943
3067
|
required: rest.required,
|
|
2944
3068
|
onClick,
|
|
@@ -2955,8 +3079,9 @@ var TextInput = forwardRef2(
|
|
|
2955
3079
|
disabled === true && "cursor-not-allowed",
|
|
2956
3080
|
variant === "secondary" && "bg-neutral-800 text-neutral",
|
|
2957
3081
|
className
|
|
2958
|
-
)
|
|
2959
|
-
|
|
3082
|
+
),
|
|
3083
|
+
...rest
|
|
3084
|
+
}
|
|
2960
3085
|
)
|
|
2961
3086
|
]
|
|
2962
3087
|
}
|
|
@@ -2971,28 +3096,18 @@ import {
|
|
|
2971
3096
|
useState as useState5
|
|
2972
3097
|
} from "react";
|
|
2973
3098
|
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
2974
|
-
var TextArea = (
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
"className",
|
|
2987
|
-
"disabled",
|
|
2988
|
-
"reference",
|
|
2989
|
-
"value",
|
|
2990
|
-
"error",
|
|
2991
|
-
"required",
|
|
2992
|
-
"placeholder",
|
|
2993
|
-
"resize",
|
|
2994
|
-
"onClick"
|
|
2995
|
-
]);
|
|
3099
|
+
var TextArea = ({
|
|
3100
|
+
className,
|
|
3101
|
+
disabled,
|
|
3102
|
+
reference,
|
|
3103
|
+
value,
|
|
3104
|
+
error,
|
|
3105
|
+
required,
|
|
3106
|
+
placeholder,
|
|
3107
|
+
resize,
|
|
3108
|
+
onClick,
|
|
3109
|
+
...rest
|
|
3110
|
+
}) => {
|
|
2996
3111
|
const [selected, setSelected] = useState5(false);
|
|
2997
3112
|
const [inputValue, setInputValue] = useState5(value);
|
|
2998
3113
|
const handleFocus = () => {
|
|
@@ -3009,7 +3124,7 @@ var TextArea = (_a) => {
|
|
|
3009
3124
|
}, [value]);
|
|
3010
3125
|
return /* @__PURE__ */ jsx8(
|
|
3011
3126
|
"textarea",
|
|
3012
|
-
|
|
3127
|
+
{
|
|
3013
3128
|
required,
|
|
3014
3129
|
ref: reference,
|
|
3015
3130
|
disabled,
|
|
@@ -3027,27 +3142,22 @@ var TextArea = (_a) => {
|
|
|
3027
3142
|
onChange: handleInput,
|
|
3028
3143
|
onBlur: handleBlur,
|
|
3029
3144
|
placeholder,
|
|
3030
|
-
value: inputValue
|
|
3031
|
-
|
|
3145
|
+
value: inputValue,
|
|
3146
|
+
...rest
|
|
3147
|
+
}
|
|
3032
3148
|
);
|
|
3033
3149
|
};
|
|
3034
3150
|
|
|
3035
3151
|
// src/components/Text/index.tsx
|
|
3036
3152
|
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
3037
|
-
var Text = (
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
"children",
|
|
3046
|
-
"color",
|
|
3047
|
-
"size",
|
|
3048
|
-
"tag",
|
|
3049
|
-
"className"
|
|
3050
|
-
]);
|
|
3153
|
+
var Text = ({
|
|
3154
|
+
children,
|
|
3155
|
+
color = "neutral-800",
|
|
3156
|
+
size = "md",
|
|
3157
|
+
tag = "p",
|
|
3158
|
+
className,
|
|
3159
|
+
...rest
|
|
3160
|
+
}) => {
|
|
3051
3161
|
const fontSize = {
|
|
3052
3162
|
xxs: "text-xxs",
|
|
3053
3163
|
xs: "text-xs",
|
|
@@ -3065,7 +3175,7 @@ var Text = (_a) => {
|
|
|
3065
3175
|
"9xl": "text-9xl"
|
|
3066
3176
|
}[size];
|
|
3067
3177
|
const Tag = tag;
|
|
3068
|
-
return /* @__PURE__ */ jsx9(Tag,
|
|
3178
|
+
return /* @__PURE__ */ jsx9(Tag, { ...rest, className: twMerge(`text-${color} ${fontSize}`, className), children });
|
|
3069
3179
|
};
|
|
3070
3180
|
|
|
3071
3181
|
// src/components/Heading/index.tsx
|
|
@@ -3120,39 +3230,33 @@ var Box = ({
|
|
|
3120
3230
|
|
|
3121
3231
|
// src/components/Form/index.tsx
|
|
3122
3232
|
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
3123
|
-
var Form = (
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
"className",
|
|
3131
|
-
"children",
|
|
3132
|
-
"variant",
|
|
3133
|
-
"orientation"
|
|
3134
|
-
]);
|
|
3233
|
+
var Form = ({
|
|
3234
|
+
className,
|
|
3235
|
+
children,
|
|
3236
|
+
variant = "secondary",
|
|
3237
|
+
orientation = "row",
|
|
3238
|
+
...rest
|
|
3239
|
+
}) => {
|
|
3135
3240
|
return /* @__PURE__ */ jsx12(
|
|
3136
3241
|
"form",
|
|
3137
|
-
|
|
3242
|
+
{
|
|
3138
3243
|
className: twMerge(
|
|
3139
3244
|
"flex flex-row gap-2 p-6 rounded-md border-2",
|
|
3140
3245
|
variant === "primary" && "text-neutral-800 bg-neutral-200 border-neutral-300",
|
|
3141
3246
|
variant === "secondary" && "text-neutral-200 bg-neutral-600 border-neutral-800",
|
|
3142
3247
|
orientation === "col" && "flex-col",
|
|
3143
3248
|
className
|
|
3144
|
-
)
|
|
3145
|
-
|
|
3249
|
+
),
|
|
3250
|
+
...rest,
|
|
3146
3251
|
children
|
|
3147
|
-
}
|
|
3252
|
+
}
|
|
3148
3253
|
);
|
|
3149
3254
|
};
|
|
3150
3255
|
|
|
3151
3256
|
// src/components/Avatar/index.tsx
|
|
3152
3257
|
import { FaUser } from "react-icons/fa";
|
|
3153
3258
|
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
3154
|
-
var Avatar = (
|
|
3155
|
-
var _b = _a, { className } = _b, rest = __objRest(_b, ["className"]);
|
|
3259
|
+
var Avatar = ({ className, ...rest }) => {
|
|
3156
3260
|
return /* @__PURE__ */ jsx13(
|
|
3157
3261
|
"div",
|
|
3158
3262
|
{
|
|
@@ -3162,15 +3266,15 @@ var Avatar = (_a) => {
|
|
|
3162
3266
|
bg-neutral-600 justify-center`,
|
|
3163
3267
|
className
|
|
3164
3268
|
),
|
|
3165
|
-
children: rest.src ? /* @__PURE__ */ jsx13("img",
|
|
3269
|
+
children: rest.src ? /* @__PURE__ */ jsx13("img", { className: "w-full h-full object-cover rounded-full", ...rest }) : /* @__PURE__ */ jsx13(FaUser, { color: "#FFFFFF", size: 24 })
|
|
3166
3270
|
}
|
|
3167
3271
|
);
|
|
3168
3272
|
};
|
|
3169
3273
|
|
|
3170
3274
|
// src/components/MultiStep/index.tsx
|
|
3171
|
-
import { jsx as jsx14, jsxs as
|
|
3275
|
+
import { jsx as jsx14, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3172
3276
|
var MultiStep = ({ className, size, currentStep }) => {
|
|
3173
|
-
return /* @__PURE__ */
|
|
3277
|
+
return /* @__PURE__ */ jsxs7("div", { className: "w-full", children: [
|
|
3174
3278
|
/* @__PURE__ */ jsx14(Text, { tag: "label", color: "neutral-100", size: "xs", children: `Passo ${currentStep} de ${size}` }),
|
|
3175
3279
|
/* @__PURE__ */ jsx14("div", { className: `grid gap-2 grid-cols-${size} grid-flow-col mt-1`, children: Array.from(Array(size).keys()).map((_, index) => {
|
|
3176
3280
|
return /* @__PURE__ */ jsx14(
|
|
@@ -3187,6 +3291,436 @@ var MultiStep = ({ className, size, currentStep }) => {
|
|
|
3187
3291
|
}) })
|
|
3188
3292
|
] });
|
|
3189
3293
|
};
|
|
3294
|
+
|
|
3295
|
+
// src/components/Toggle/index.tsx
|
|
3296
|
+
import { jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3297
|
+
var Toggle = ({
|
|
3298
|
+
className,
|
|
3299
|
+
disabled,
|
|
3300
|
+
active,
|
|
3301
|
+
label,
|
|
3302
|
+
setActive,
|
|
3303
|
+
size = "md",
|
|
3304
|
+
hideLabel = false,
|
|
3305
|
+
id,
|
|
3306
|
+
...rest
|
|
3307
|
+
}) => {
|
|
3308
|
+
const toggleId = id || `toggle-${Math.random().toString(36).substring(2, 9)}`;
|
|
3309
|
+
const sizeClasses = {
|
|
3310
|
+
sm: {
|
|
3311
|
+
toggle: "h-5 w-9",
|
|
3312
|
+
knob: "h-3 w-3",
|
|
3313
|
+
translate: active ? "translate-x-5" : "translate-x-1"
|
|
3314
|
+
},
|
|
3315
|
+
md: {
|
|
3316
|
+
toggle: "h-6 w-11",
|
|
3317
|
+
knob: "h-4 w-4",
|
|
3318
|
+
translate: active ? "translate-x-6" : "translate-x-1"
|
|
3319
|
+
},
|
|
3320
|
+
lg: {
|
|
3321
|
+
toggle: "h-7 w-14",
|
|
3322
|
+
knob: "h-5 w-5",
|
|
3323
|
+
translate: active ? "translate-x-8" : "translate-x-1"
|
|
3324
|
+
}
|
|
3325
|
+
};
|
|
3326
|
+
const selectedSize = sizeClasses[size];
|
|
3327
|
+
const handleKeyDown = (e) => {
|
|
3328
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
3329
|
+
e.preventDefault();
|
|
3330
|
+
if (!disabled) {
|
|
3331
|
+
setActive(!active);
|
|
3332
|
+
}
|
|
3333
|
+
}
|
|
3334
|
+
};
|
|
3335
|
+
return /* @__PURE__ */ jsxs8(
|
|
3336
|
+
"div",
|
|
3337
|
+
{
|
|
3338
|
+
className: twMerge("flex items-center gap-3", className),
|
|
3339
|
+
...rest,
|
|
3340
|
+
children: [
|
|
3341
|
+
/* @__PURE__ */ jsx15(
|
|
3342
|
+
"button",
|
|
3343
|
+
{
|
|
3344
|
+
type: "button",
|
|
3345
|
+
role: "switch",
|
|
3346
|
+
"aria-checked": active,
|
|
3347
|
+
"aria-labelledby": hideLabel ? void 0 : `${toggleId}-label`,
|
|
3348
|
+
"aria-label": hideLabel ? label : void 0,
|
|
3349
|
+
id: toggleId,
|
|
3350
|
+
disabled,
|
|
3351
|
+
onClick: () => setActive(!active),
|
|
3352
|
+
onKeyDown: handleKeyDown,
|
|
3353
|
+
className: twMerge(`
|
|
3354
|
+
relative inline-flex items-center rounded-full
|
|
3355
|
+
${selectedSize.toggle}
|
|
3356
|
+
${active ? "bg-blue-600" : "bg-gray-300 dark:bg-gray-600"}
|
|
3357
|
+
${disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}
|
|
3358
|
+
transition-colors duration-300 ease-in-out
|
|
3359
|
+
focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2
|
|
3360
|
+
`),
|
|
3361
|
+
children: /* @__PURE__ */ jsx15("span", { className: `
|
|
3362
|
+
inline-block transform rounded-full bg-white shadow-md
|
|
3363
|
+
${selectedSize.knob}
|
|
3364
|
+
${selectedSize.translate}
|
|
3365
|
+
transition-transform duration-300 ease-in-out
|
|
3366
|
+
` })
|
|
3367
|
+
}
|
|
3368
|
+
),
|
|
3369
|
+
!hideLabel && /* @__PURE__ */ jsx15(
|
|
3370
|
+
"label",
|
|
3371
|
+
{
|
|
3372
|
+
id: `${toggleId}-label`,
|
|
3373
|
+
htmlFor: toggleId,
|
|
3374
|
+
className: `text-sm font-medium text-gray-700 dark:text-gray-300 ${disabled ? "opacity-50" : ""}`,
|
|
3375
|
+
children: label
|
|
3376
|
+
}
|
|
3377
|
+
)
|
|
3378
|
+
]
|
|
3379
|
+
}
|
|
3380
|
+
);
|
|
3381
|
+
};
|
|
3382
|
+
|
|
3383
|
+
// src/components/Skeleton/index.tsx
|
|
3384
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
3385
|
+
var Skeleton = ({
|
|
3386
|
+
width = "full",
|
|
3387
|
+
height = "16",
|
|
3388
|
+
rounded = false,
|
|
3389
|
+
circle = false,
|
|
3390
|
+
animate = true,
|
|
3391
|
+
className
|
|
3392
|
+
}) => {
|
|
3393
|
+
const widthClass = typeof width === "string" ? width.includes("px") || width.includes("%") || width.includes("rem") || width.includes("em") ? `w-[${width}]` : `w-${width}` : `w-[${width}px]`;
|
|
3394
|
+
const heightClass = typeof height === "string" ? height.includes("px") || height.includes("%") || height.includes("rem") || height.includes("em") ? `h-[${height}]` : `h-${height}` : `h-[${height}px]`;
|
|
3395
|
+
const safeWidthClass = widthClass.includes("[") ? "w-full" : widthClass;
|
|
3396
|
+
const safeHeightClass = heightClass.includes("[") ? "h-16" : heightClass;
|
|
3397
|
+
return /* @__PURE__ */ jsx16(
|
|
3398
|
+
"div",
|
|
3399
|
+
{
|
|
3400
|
+
className: twMerge(
|
|
3401
|
+
"bg-gray-200",
|
|
3402
|
+
safeWidthClass,
|
|
3403
|
+
safeHeightClass,
|
|
3404
|
+
rounded && !circle && "rounded-md",
|
|
3405
|
+
circle && "rounded-full",
|
|
3406
|
+
animate && "animate-pulse",
|
|
3407
|
+
className
|
|
3408
|
+
),
|
|
3409
|
+
"aria-hidden": "true"
|
|
3410
|
+
}
|
|
3411
|
+
);
|
|
3412
|
+
};
|
|
3413
|
+
Skeleton.displayName = "Skeleton";
|
|
3414
|
+
|
|
3415
|
+
// src/components/Loading/index.tsx
|
|
3416
|
+
import { jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3417
|
+
var Loading = ({
|
|
3418
|
+
size = "md",
|
|
3419
|
+
color = "primary",
|
|
3420
|
+
withText = false,
|
|
3421
|
+
text = "Loading...",
|
|
3422
|
+
centered = false,
|
|
3423
|
+
className
|
|
3424
|
+
}) => {
|
|
3425
|
+
const sizeClasses = {
|
|
3426
|
+
xs: "h-4 w-4",
|
|
3427
|
+
sm: "h-6 w-6",
|
|
3428
|
+
md: "h-8 w-8",
|
|
3429
|
+
lg: "h-12 w-12"
|
|
3430
|
+
};
|
|
3431
|
+
const colorClasses = {
|
|
3432
|
+
primary: "text-orange-500",
|
|
3433
|
+
secondary: "text-neutral",
|
|
3434
|
+
white: "text-white",
|
|
3435
|
+
black: "text-black",
|
|
3436
|
+
gray: "text-gray-400"
|
|
3437
|
+
};
|
|
3438
|
+
const textSizeClasses = {
|
|
3439
|
+
xs: "text-xs",
|
|
3440
|
+
sm: "text-sm",
|
|
3441
|
+
md: "text-base",
|
|
3442
|
+
lg: "text-lg"
|
|
3443
|
+
};
|
|
3444
|
+
return /* @__PURE__ */ jsxs9(
|
|
3445
|
+
"div",
|
|
3446
|
+
{
|
|
3447
|
+
className: twMerge(
|
|
3448
|
+
"inline-flex items-center",
|
|
3449
|
+
centered && "justify-center",
|
|
3450
|
+
className
|
|
3451
|
+
),
|
|
3452
|
+
role: "status",
|
|
3453
|
+
children: [
|
|
3454
|
+
/* @__PURE__ */ jsxs9(
|
|
3455
|
+
"svg",
|
|
3456
|
+
{
|
|
3457
|
+
className: twMerge(
|
|
3458
|
+
"animate-spin",
|
|
3459
|
+
sizeClasses[size],
|
|
3460
|
+
colorClasses[color]
|
|
3461
|
+
),
|
|
3462
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3463
|
+
fill: "none",
|
|
3464
|
+
viewBox: "0 0 24 24",
|
|
3465
|
+
children: [
|
|
3466
|
+
/* @__PURE__ */ jsx17(
|
|
3467
|
+
"circle",
|
|
3468
|
+
{
|
|
3469
|
+
className: "opacity-25",
|
|
3470
|
+
cx: "12",
|
|
3471
|
+
cy: "12",
|
|
3472
|
+
r: "10",
|
|
3473
|
+
stroke: "currentColor",
|
|
3474
|
+
strokeWidth: "4"
|
|
3475
|
+
}
|
|
3476
|
+
),
|
|
3477
|
+
/* @__PURE__ */ jsx17(
|
|
3478
|
+
"path",
|
|
3479
|
+
{
|
|
3480
|
+
className: "opacity-75",
|
|
3481
|
+
fill: "currentColor",
|
|
3482
|
+
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
3483
|
+
}
|
|
3484
|
+
)
|
|
3485
|
+
]
|
|
3486
|
+
}
|
|
3487
|
+
),
|
|
3488
|
+
withText && /* @__PURE__ */ jsx17("span", { className: twMerge(
|
|
3489
|
+
"ml-3",
|
|
3490
|
+
textSizeClasses[size],
|
|
3491
|
+
colorClasses[color]
|
|
3492
|
+
), children: text }),
|
|
3493
|
+
/* @__PURE__ */ jsx17("span", { className: "sr-only", children: "Loading" })
|
|
3494
|
+
]
|
|
3495
|
+
}
|
|
3496
|
+
);
|
|
3497
|
+
};
|
|
3498
|
+
Loading.displayName = "Loading";
|
|
3499
|
+
|
|
3500
|
+
// src/components/Modal/index.tsx
|
|
3501
|
+
import { useEffect as useEffect4, useState as useState6, useRef } from "react";
|
|
3502
|
+
import { jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3503
|
+
var Modal = ({
|
|
3504
|
+
className,
|
|
3505
|
+
isOpen,
|
|
3506
|
+
onClose,
|
|
3507
|
+
title,
|
|
3508
|
+
size = "md",
|
|
3509
|
+
children,
|
|
3510
|
+
showCloseButton = true,
|
|
3511
|
+
closeOnOutsideClick = true,
|
|
3512
|
+
closeOnEsc = true,
|
|
3513
|
+
footer,
|
|
3514
|
+
...rest
|
|
3515
|
+
}) => {
|
|
3516
|
+
const modalRef = useRef(null);
|
|
3517
|
+
const portalRoot = useRef(null);
|
|
3518
|
+
const [mounted, setMounted] = useState6(false);
|
|
3519
|
+
useEffect4(() => {
|
|
3520
|
+
portalRoot.current = document.createElement("div");
|
|
3521
|
+
portalRoot.current.id = "bloom-ui-portal-root";
|
|
3522
|
+
document.body.appendChild(portalRoot.current);
|
|
3523
|
+
setMounted(true);
|
|
3524
|
+
return () => {
|
|
3525
|
+
portalRoot.current?.remove();
|
|
3526
|
+
document.body.style.overflow = "";
|
|
3527
|
+
};
|
|
3528
|
+
}, []);
|
|
3529
|
+
useEffect4(() => {
|
|
3530
|
+
if (isOpen) {
|
|
3531
|
+
document.body.style.overflow = "hidden";
|
|
3532
|
+
} else {
|
|
3533
|
+
document.body.style.overflow = "";
|
|
3534
|
+
}
|
|
3535
|
+
}, [isOpen]);
|
|
3536
|
+
useEffect4(() => {
|
|
3537
|
+
const handleKeyDown = (e) => {
|
|
3538
|
+
if (isOpen && closeOnEsc && e.key === "Escape") onClose();
|
|
3539
|
+
};
|
|
3540
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
3541
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
3542
|
+
}, [isOpen, onClose, closeOnEsc]);
|
|
3543
|
+
const handleBackdropClick = (e) => {
|
|
3544
|
+
if (closeOnOutsideClick && modalRef.current && !modalRef.current.contains(e.target)) {
|
|
3545
|
+
onClose();
|
|
3546
|
+
}
|
|
3547
|
+
};
|
|
3548
|
+
const sizeClasses = {
|
|
3549
|
+
sm: "max-w-sm",
|
|
3550
|
+
md: "max-w-md",
|
|
3551
|
+
lg: "max-w-lg",
|
|
3552
|
+
xl: "max-w-xl"
|
|
3553
|
+
};
|
|
3554
|
+
if (!isOpen || !mounted || !portalRoot.current) return null;
|
|
3555
|
+
return /* @__PURE__ */ jsx18(
|
|
3556
|
+
"div",
|
|
3557
|
+
{
|
|
3558
|
+
className: "fixed inset-0 z-50 flex items-center justify-center p-4 bg-black bg-opacity-50 transition-opacity duration-300",
|
|
3559
|
+
onClick: handleBackdropClick,
|
|
3560
|
+
"aria-modal": "true",
|
|
3561
|
+
role: "dialog",
|
|
3562
|
+
...rest,
|
|
3563
|
+
children: /* @__PURE__ */ jsxs10(
|
|
3564
|
+
"div",
|
|
3565
|
+
{
|
|
3566
|
+
ref: modalRef,
|
|
3567
|
+
className: twMerge(
|
|
3568
|
+
`relative bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full
|
|
3569
|
+
${sizeClasses[size]} opacity-100 scale-100
|
|
3570
|
+
transition-all duration-300 ease-in-out`,
|
|
3571
|
+
className
|
|
3572
|
+
),
|
|
3573
|
+
children: [
|
|
3574
|
+
(title || showCloseButton) && /* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-700", children: [
|
|
3575
|
+
title && /* @__PURE__ */ jsx18("h3", { className: "text-lg font-medium text-gray-900 dark:text-gray-100", children: title }),
|
|
3576
|
+
showCloseButton && /* @__PURE__ */ jsx18(
|
|
3577
|
+
"button",
|
|
3578
|
+
{
|
|
3579
|
+
type: "button",
|
|
3580
|
+
"aria-label": "Close modal",
|
|
3581
|
+
onClick: onClose,
|
|
3582
|
+
className: "p-1 text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-blue-500 rounded-full",
|
|
3583
|
+
children: /* @__PURE__ */ jsx18("svg", { className: "h-5 w-5", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx18("path", { fillRule: "evenodd", d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z", clipRule: "evenodd" }) })
|
|
3584
|
+
}
|
|
3585
|
+
)
|
|
3586
|
+
] }),
|
|
3587
|
+
/* @__PURE__ */ jsx18("div", { className: "px-6 py-4 max-h-[70vh] overflow-y-auto", children }),
|
|
3588
|
+
footer && /* @__PURE__ */ jsx18("div", { className: "px-6 py-4 border-t border-gray-200 dark:border-gray-700", children: footer })
|
|
3589
|
+
]
|
|
3590
|
+
}
|
|
3591
|
+
)
|
|
3592
|
+
}
|
|
3593
|
+
);
|
|
3594
|
+
};
|
|
3595
|
+
|
|
3596
|
+
// src/components/Toast/index.tsx
|
|
3597
|
+
import React, { useEffect as useEffect5, useState as useState7, useRef as useRef2 } from "react";
|
|
3598
|
+
import { jsx as jsx19, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3599
|
+
var Toast = ({
|
|
3600
|
+
id,
|
|
3601
|
+
message,
|
|
3602
|
+
title,
|
|
3603
|
+
variant = "info",
|
|
3604
|
+
duration = 5e3,
|
|
3605
|
+
showCloseButton = true,
|
|
3606
|
+
onDismiss,
|
|
3607
|
+
className
|
|
3608
|
+
}) => {
|
|
3609
|
+
const [isRemoving, setIsRemoving] = useState7(false);
|
|
3610
|
+
const timerRef = useRef2();
|
|
3611
|
+
const handleDismiss = () => {
|
|
3612
|
+
setIsRemoving(true);
|
|
3613
|
+
setTimeout(() => onDismiss?.(id), 300);
|
|
3614
|
+
};
|
|
3615
|
+
useEffect5(() => {
|
|
3616
|
+
if (duration > 0) {
|
|
3617
|
+
timerRef.current = window.setTimeout(handleDismiss, duration);
|
|
3618
|
+
}
|
|
3619
|
+
return () => window.clearTimeout(timerRef.current);
|
|
3620
|
+
}, [duration]);
|
|
3621
|
+
const variantStyles = {
|
|
3622
|
+
success: "bg-green-100 border-green-500 text-green-800",
|
|
3623
|
+
error: "bg-red-100 border-red-500 text-red-800",
|
|
3624
|
+
warning: "bg-yellow-100 border-yellow-500 text-yellow-800",
|
|
3625
|
+
info: "bg-blue-100 border-blue-500 text-blue-800"
|
|
3626
|
+
};
|
|
3627
|
+
const icons = {
|
|
3628
|
+
success: /* @__PURE__ */ jsx19("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx19("path", { fillRule: "evenodd", d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z", clipRule: "evenodd" }) }),
|
|
3629
|
+
error: /* @__PURE__ */ jsx19("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx19("path", { fillRule: "evenodd", d: "M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z", clipRule: "evenodd" }) }),
|
|
3630
|
+
warning: /* @__PURE__ */ jsx19("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx19("path", { fillRule: "evenodd", d: "M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z", clipRule: "evenodd" }) }),
|
|
3631
|
+
info: /* @__PURE__ */ jsx19("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx19("path", { fillRule: "evenodd", d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z", clipRule: "evenodd" }) })
|
|
3632
|
+
};
|
|
3633
|
+
return /* @__PURE__ */ jsxs11(
|
|
3634
|
+
"div",
|
|
3635
|
+
{
|
|
3636
|
+
className: twMerge(
|
|
3637
|
+
"flex items-start p-4 mb-3 w-full max-w-xs rounded-md shadow-md border-l-4 transform transition-all duration-300",
|
|
3638
|
+
variantStyles[variant],
|
|
3639
|
+
isRemoving ? "translate-x-full opacity-0" : "translate-x-0 opacity-100",
|
|
3640
|
+
className
|
|
3641
|
+
),
|
|
3642
|
+
role: "alert",
|
|
3643
|
+
children: [
|
|
3644
|
+
/* @__PURE__ */ jsx19("div", { className: `flex-shrink-0 mr-3 text-${variant}-500`, children: icons[variant] }),
|
|
3645
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex-1", children: [
|
|
3646
|
+
title && /* @__PURE__ */ jsx19("h3", { className: "font-medium text-sm", children: title }),
|
|
3647
|
+
/* @__PURE__ */ jsx19("div", { className: "text-sm", children: message })
|
|
3648
|
+
] }),
|
|
3649
|
+
showCloseButton && /* @__PURE__ */ jsx19(
|
|
3650
|
+
"button",
|
|
3651
|
+
{
|
|
3652
|
+
type: "button",
|
|
3653
|
+
className: "ml-3 text-gray-400 hover:text-gray-900",
|
|
3654
|
+
onClick: handleDismiss,
|
|
3655
|
+
"aria-label": "Close",
|
|
3656
|
+
children: /* @__PURE__ */ jsx19("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx19("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M6 18L18 6M6 6l12 12" }) })
|
|
3657
|
+
}
|
|
3658
|
+
)
|
|
3659
|
+
]
|
|
3660
|
+
}
|
|
3661
|
+
);
|
|
3662
|
+
};
|
|
3663
|
+
var ToastContainer = ({
|
|
3664
|
+
position = "top-right",
|
|
3665
|
+
className,
|
|
3666
|
+
children
|
|
3667
|
+
}) => {
|
|
3668
|
+
const containerRef = useRef2({ current: null });
|
|
3669
|
+
const [isMounted, setIsMounted] = useState7(false);
|
|
3670
|
+
useEffect5(() => {
|
|
3671
|
+
const container = document.createElement("div");
|
|
3672
|
+
container.id = "toast-root";
|
|
3673
|
+
container.className = "fixed z-50 p-4";
|
|
3674
|
+
document.body.appendChild(container);
|
|
3675
|
+
containerRef.current = { current: container };
|
|
3676
|
+
setIsMounted(true);
|
|
3677
|
+
return () => {
|
|
3678
|
+
container.remove();
|
|
3679
|
+
};
|
|
3680
|
+
}, []);
|
|
3681
|
+
const positionClasses = {
|
|
3682
|
+
"top-right": "top-0 right-0",
|
|
3683
|
+
"top-left": "top-0 left-0",
|
|
3684
|
+
"bottom-right": "bottom-0 right-0",
|
|
3685
|
+
"bottom-left": "bottom-0 left-0",
|
|
3686
|
+
"top-center": "top-0 left-1/2 -translate-x-1/2",
|
|
3687
|
+
"bottom-center": "bottom-0 left-1/2 -translate-x-1/2"
|
|
3688
|
+
};
|
|
3689
|
+
if (!isMounted || !containerRef.current) return null;
|
|
3690
|
+
return /* @__PURE__ */ jsx19(
|
|
3691
|
+
"div",
|
|
3692
|
+
{
|
|
3693
|
+
className: twMerge(
|
|
3694
|
+
"fixed z-50 p-4 flex flex-col items-end",
|
|
3695
|
+
positionClasses[position],
|
|
3696
|
+
className
|
|
3697
|
+
),
|
|
3698
|
+
children
|
|
3699
|
+
}
|
|
3700
|
+
);
|
|
3701
|
+
};
|
|
3702
|
+
var ToastContext = React.createContext(void 0);
|
|
3703
|
+
var ToastProvider = ({ position = "top-right", children }) => {
|
|
3704
|
+
const [toasts, setToasts] = useState7([]);
|
|
3705
|
+
const showToast = (toast) => {
|
|
3706
|
+
const id = `toast-${Date.now()}`;
|
|
3707
|
+
setToasts((prev) => [...prev, { ...toast, id }]);
|
|
3708
|
+
return id;
|
|
3709
|
+
};
|
|
3710
|
+
const hideToast = (id) => setToasts((prev) => prev.filter((toast) => toast.id !== id));
|
|
3711
|
+
const clearToasts = () => setToasts([]);
|
|
3712
|
+
return /* @__PURE__ */ jsxs11(ToastContext.Provider, { value: { showToast, hideToast, clearToasts }, children: [
|
|
3713
|
+
children,
|
|
3714
|
+
/* @__PURE__ */ jsx19(ToastContainer, { position, children: toasts.map((toast) => /* @__PURE__ */ jsx19(Toast, { ...toast, onDismiss: hideToast }, toast.id)) })
|
|
3715
|
+
] });
|
|
3716
|
+
};
|
|
3717
|
+
var useToast = () => {
|
|
3718
|
+
const context = React.useContext(ToastContext);
|
|
3719
|
+
if (!context) throw new Error("useToast must be used within ToastProvider");
|
|
3720
|
+
return context;
|
|
3721
|
+
};
|
|
3722
|
+
Toast.displayName = "Toast";
|
|
3723
|
+
ToastContainer.displayName = "ToastContainer";
|
|
3190
3724
|
export {
|
|
3191
3725
|
Avatar,
|
|
3192
3726
|
Box,
|
|
@@ -3197,9 +3731,18 @@ export {
|
|
|
3197
3731
|
Heading,
|
|
3198
3732
|
Input,
|
|
3199
3733
|
Link,
|
|
3734
|
+
Loading,
|
|
3735
|
+
Modal,
|
|
3200
3736
|
MultiStep,
|
|
3201
3737
|
RadioGroup,
|
|
3738
|
+
Skeleton,
|
|
3202
3739
|
Text,
|
|
3203
3740
|
TextArea,
|
|
3204
|
-
TextInput
|
|
3741
|
+
TextInput,
|
|
3742
|
+
Toast,
|
|
3743
|
+
ToastContainer,
|
|
3744
|
+
ToastContext,
|
|
3745
|
+
ToastProvider,
|
|
3746
|
+
Toggle,
|
|
3747
|
+
useToast
|
|
3205
3748
|
};
|