@koaris/bloom-ui 1.3.3 → 1.3.4
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.cjs +242 -142
- package/dist/index.d.cts +17 -20
- package/dist/index.d.ts +17 -20
- package/dist/index.mjs +257 -149
- package/package.json +14 -4
- package/tailwind.css +2 -2
package/dist/index.cjs
CHANGED
|
@@ -400,7 +400,7 @@ var fractionRegex = /^\d+\/\d+$/;
|
|
|
400
400
|
var stringLengths = /* @__PURE__ */ new Set(["px", "full", "screen"]);
|
|
401
401
|
var tshirtUnitRegex = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/;
|
|
402
402
|
var lengthUnitRegex = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/;
|
|
403
|
-
var colorFunctionRegex = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/;
|
|
403
|
+
var colorFunctionRegex = /^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/;
|
|
404
404
|
var shadowRegex = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;
|
|
405
405
|
var imageRegex = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;
|
|
406
406
|
var isLength = (value) => isNumber(value) || stringLengths.has(value) || fractionRegex.test(value);
|
|
@@ -2543,7 +2543,7 @@ var Card = ({
|
|
|
2543
2543
|
direction === "col" ? "flex-col" : "flex-row",
|
|
2544
2544
|
cardSizeClasses[size],
|
|
2545
2545
|
hoverable && !disabled && "hover:shadow-md hover:shadow-neutral-500",
|
|
2546
|
-
|
|
2546
|
+
selected && "border-2 border-orange-500",
|
|
2547
2547
|
disabled && "opacity-50 cursor-not-allowed",
|
|
2548
2548
|
onClick && !disabled && "cursor-pointer",
|
|
2549
2549
|
className
|
|
@@ -2591,13 +2591,16 @@ var Card = ({
|
|
|
2591
2591
|
),
|
|
2592
2592
|
children: [
|
|
2593
2593
|
title && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: "text-md text-left font-bold leading-tight mb-1", children: title }),
|
|
2594
|
-
content && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className:
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2594
|
+
content && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-sm text-left", children: content }),
|
|
2595
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
2596
|
+
"div",
|
|
2597
|
+
{
|
|
2598
|
+
className: twMerge(
|
|
2599
|
+
"pt-2 text-sm border-t border-neutral-300 text-left"
|
|
2600
|
+
),
|
|
2601
|
+
children: footer
|
|
2602
|
+
}
|
|
2603
|
+
)
|
|
2601
2604
|
]
|
|
2602
2605
|
}
|
|
2603
2606
|
)
|
|
@@ -2708,7 +2711,6 @@ var Link = ({
|
|
|
2708
2711
|
disabled,
|
|
2709
2712
|
url,
|
|
2710
2713
|
newPage = true,
|
|
2711
|
-
onClick,
|
|
2712
2714
|
...rest
|
|
2713
2715
|
}) => {
|
|
2714
2716
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
@@ -2825,11 +2827,11 @@ var passwordMask = {
|
|
|
2825
2827
|
password: [/^(?=.*[!@#$%^&*])/, /(?=.*[0-9])/, /.{8,}$/]
|
|
2826
2828
|
};
|
|
2827
2829
|
var phoneFormats = {
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2830
|
+
BR: { countryCode: "+55", format: "($1) $2-$3" },
|
|
2831
|
+
US: { countryCode: "+1", format: "($1) $2-$3" },
|
|
2832
|
+
UK: { countryCode: "+44", format: "$1 $2 $3" },
|
|
2833
|
+
DE: { countryCode: "+49", format: "$1 $2 $3" },
|
|
2834
|
+
FR: { countryCode: "+33", format: "$1 $2 $3 $4" }
|
|
2833
2835
|
};
|
|
2834
2836
|
var Input = (0, import_react4.forwardRef)(
|
|
2835
2837
|
({
|
|
@@ -2872,21 +2874,29 @@ var Input = (0, import_react4.forwardRef)(
|
|
|
2872
2874
|
case "date":
|
|
2873
2875
|
result = value2.replace(/\D/g, "");
|
|
2874
2876
|
if (result.length > 8) result = result.substring(0, 8);
|
|
2875
|
-
if (result.length > 4)
|
|
2876
|
-
|
|
2877
|
+
if (result.length > 4)
|
|
2878
|
+
result = result.replace(/(\d{2})(\d{2})(\d+)/, "$1/$2/$3");
|
|
2879
|
+
else if (result.length > 2)
|
|
2880
|
+
result = result.replace(/(\d{2})(\d+)/, "$1/$2");
|
|
2877
2881
|
break;
|
|
2878
2882
|
case "cpf":
|
|
2879
2883
|
result = value2.replace(/\D/g, "");
|
|
2880
2884
|
if (result.length > 11) result = result.substring(0, 11);
|
|
2881
|
-
if (result.length > 9)
|
|
2882
|
-
|
|
2883
|
-
else if (result.length >
|
|
2885
|
+
if (result.length > 9)
|
|
2886
|
+
result = result.replace(/(\d{3})(\d{3})(\d{3})(\d+)/, "$1.$2.$3-$4");
|
|
2887
|
+
else if (result.length > 6)
|
|
2888
|
+
result = result.replace(/(\d{3})(\d{3})(\d+)/, "$1.$2.$3");
|
|
2889
|
+
else if (result.length > 3)
|
|
2890
|
+
result = result.replace(/(\d{3})(\d+)/, "$1.$2");
|
|
2884
2891
|
break;
|
|
2885
2892
|
case "cnpj":
|
|
2886
2893
|
result = value2.replace(/\D/g, "");
|
|
2887
2894
|
if (result.length > 14) result = result.substring(0, 14);
|
|
2888
2895
|
if (result.length > 12)
|
|
2889
|
-
result = result.replace(
|
|
2896
|
+
result = result.replace(
|
|
2897
|
+
/(\d{2})(\d{3})(\d{3})(\d{4})(\d+)/,
|
|
2898
|
+
"$1.$2.$3/$4-$5"
|
|
2899
|
+
);
|
|
2890
2900
|
else if (result.length > 8)
|
|
2891
2901
|
result = result.replace(/(\d{2})(\d{3})(\d{3})(\d+)/, "$1.$2.$3/$4");
|
|
2892
2902
|
else if (result.length > 5)
|
|
@@ -2897,7 +2907,8 @@ var Input = (0, import_react4.forwardRef)(
|
|
|
2897
2907
|
case "cep":
|
|
2898
2908
|
result = value2.replace(/\D/g, "");
|
|
2899
2909
|
if (result.length > 8) result = result.substring(0, 8);
|
|
2900
|
-
if (result.length > 5)
|
|
2910
|
+
if (result.length > 5)
|
|
2911
|
+
result = result.replace(/(\d{5})(\d+)/, "$1-$2");
|
|
2901
2912
|
break;
|
|
2902
2913
|
case "phone":
|
|
2903
2914
|
result = applyPhoneMask(value2, countryCode);
|
|
@@ -2912,7 +2923,6 @@ var Input = (0, import_react4.forwardRef)(
|
|
|
2912
2923
|
};
|
|
2913
2924
|
const applyPhoneMask = (value2, countryCode2) => {
|
|
2914
2925
|
let digits = value2.replace(/\D/g, "");
|
|
2915
|
-
const format = phoneFormats[countryCode2] || phoneFormats["BR"];
|
|
2916
2926
|
switch (countryCode2) {
|
|
2917
2927
|
case "BR":
|
|
2918
2928
|
if (digits.length > 11) digits = digits.substring(0, 11);
|
|
@@ -2975,7 +2985,9 @@ var Input = (0, import_react4.forwardRef)(
|
|
|
2975
2985
|
}
|
|
2976
2986
|
break;
|
|
2977
2987
|
case "email":
|
|
2978
|
-
valid = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(
|
|
2988
|
+
valid = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(
|
|
2989
|
+
value2
|
|
2990
|
+
);
|
|
2979
2991
|
break;
|
|
2980
2992
|
default:
|
|
2981
2993
|
valid = value2.length > 0;
|
|
@@ -3008,14 +3020,6 @@ var Input = (0, import_react4.forwardRef)(
|
|
|
3008
3020
|
}
|
|
3009
3021
|
externalOnChange?.(newEvent);
|
|
3010
3022
|
};
|
|
3011
|
-
(0, import_react4.useEffect)(() => {
|
|
3012
|
-
setInputValue(value || "");
|
|
3013
|
-
if (value && type === "password") {
|
|
3014
|
-
checkPassword(value);
|
|
3015
|
-
} else if (value) {
|
|
3016
|
-
validateInput(value);
|
|
3017
|
-
}
|
|
3018
|
-
}, [value, type]);
|
|
3019
3023
|
const checkPassword = (value2) => {
|
|
3020
3024
|
const validationResult = {
|
|
3021
3025
|
hasEightCharacters: value2?.match(passwordMask.password[2]) !== null,
|
|
@@ -3027,6 +3031,18 @@ var Input = (0, import_react4.forwardRef)(
|
|
|
3027
3031
|
validationResult.hasEightCharacters && validationResult.hasSpecialCharacters && validationResult.hasNumber
|
|
3028
3032
|
);
|
|
3029
3033
|
};
|
|
3034
|
+
const validateInputRef = (0, import_react4.useRef)(validateInput);
|
|
3035
|
+
const checkPasswordRef = (0, import_react4.useRef)(checkPassword);
|
|
3036
|
+
validateInputRef.current = validateInput;
|
|
3037
|
+
checkPasswordRef.current = checkPassword;
|
|
3038
|
+
(0, import_react4.useEffect)(() => {
|
|
3039
|
+
setInputValue(value || "");
|
|
3040
|
+
if (value && type === "password") {
|
|
3041
|
+
checkPasswordRef.current(value);
|
|
3042
|
+
} else if (value) {
|
|
3043
|
+
validateInputRef.current(value);
|
|
3044
|
+
}
|
|
3045
|
+
}, [value, type]);
|
|
3030
3046
|
const getInputType = () => {
|
|
3031
3047
|
switch (type) {
|
|
3032
3048
|
case "password":
|
|
@@ -3047,7 +3063,7 @@ var Input = (0, import_react4.forwardRef)(
|
|
|
3047
3063
|
};
|
|
3048
3064
|
const renderPhonePrefix = () => {
|
|
3049
3065
|
if (type !== "phone") return null;
|
|
3050
|
-
const format = phoneFormats[countryCode] || phoneFormats
|
|
3066
|
+
const format = phoneFormats[countryCode] || phoneFormats.BR;
|
|
3051
3067
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "absolute left-3 top-1.5 text-gray-500", children: format.countryCode });
|
|
3052
3068
|
};
|
|
3053
3069
|
const inputClasses = twMerge(
|
|
@@ -3056,7 +3072,7 @@ var Input = (0, import_react4.forwardRef)(
|
|
|
3056
3072
|
disabled && "opacity-50 cursor-not-allowed",
|
|
3057
3073
|
selected && "border-2 border-orange-500",
|
|
3058
3074
|
validated && isValid && "border-2 border-green-900",
|
|
3059
|
-
(error || !isValid && inputValue
|
|
3075
|
+
(error || !isValid && inputValue !== "") && "border-2 border-red-900",
|
|
3060
3076
|
type === "phone" && "pl-10"
|
|
3061
3077
|
);
|
|
3062
3078
|
const renderPasswordValidation = () => {
|
|
@@ -3112,7 +3128,15 @@ var Input = (0, import_react4.forwardRef)(
|
|
|
3112
3128
|
)
|
|
3113
3129
|
] }),
|
|
3114
3130
|
renderPasswordValidation(),
|
|
3115
|
-
error && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
3131
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
3132
|
+
"p",
|
|
3133
|
+
{
|
|
3134
|
+
id: `${id}-error`,
|
|
3135
|
+
className: "mt-1 text-sm text-red-900",
|
|
3136
|
+
role: "alert",
|
|
3137
|
+
children: errorMessage || "Invalid field."
|
|
3138
|
+
}
|
|
3139
|
+
),
|
|
3116
3140
|
helperText && !error && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { id: `${id}-helper`, className: "mt-1 text-sm text-gray-500", children: helperText })
|
|
3117
3141
|
] });
|
|
3118
3142
|
}
|
|
@@ -3262,7 +3286,7 @@ var TextArea = (0, import_react6.forwardRef)(
|
|
|
3262
3286
|
JSON.parse(value2);
|
|
3263
3287
|
setIsValid(true);
|
|
3264
3288
|
return true;
|
|
3265
|
-
} catch
|
|
3289
|
+
} catch {
|
|
3266
3290
|
setIsValid(false);
|
|
3267
3291
|
return false;
|
|
3268
3292
|
}
|
|
@@ -3289,10 +3313,12 @@ var TextArea = (0, import_react6.forwardRef)(
|
|
|
3289
3313
|
externalOnChange(event);
|
|
3290
3314
|
}
|
|
3291
3315
|
};
|
|
3316
|
+
const validateInputRef = (0, import_react6.useRef)(validateInput);
|
|
3317
|
+
validateInputRef.current = validateInput;
|
|
3292
3318
|
(0, import_react6.useEffect)(() => {
|
|
3293
3319
|
setInputValue(value || "");
|
|
3294
3320
|
if (value) {
|
|
3295
|
-
|
|
3321
|
+
validateInputRef.current(value);
|
|
3296
3322
|
}
|
|
3297
3323
|
}, [value, required, maxLength]);
|
|
3298
3324
|
const characterCount = inputValue?.length || 0;
|
|
@@ -3524,54 +3550,56 @@ var Heading = ({
|
|
|
3524
3550
|
// src/components/Box/index.tsx
|
|
3525
3551
|
var import_react7 = require("react");
|
|
3526
3552
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
3527
|
-
var Box = (0, import_react7.forwardRef)(
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3553
|
+
var Box = (0, import_react7.forwardRef)(
|
|
3554
|
+
({
|
|
3555
|
+
className,
|
|
3556
|
+
children,
|
|
3557
|
+
tag = "div",
|
|
3558
|
+
variant = "secondary",
|
|
3559
|
+
size = "md",
|
|
3560
|
+
elevated = false,
|
|
3561
|
+
hasBorder = true,
|
|
3562
|
+
isInteractive = false,
|
|
3563
|
+
fullWidth = false,
|
|
3564
|
+
...props
|
|
3565
|
+
}, ref) => {
|
|
3566
|
+
const Tag = tag;
|
|
3567
|
+
const variantStyles = {
|
|
3568
|
+
primary: "text-neutral-800 bg-neutral-200 border-neutral-300",
|
|
3569
|
+
secondary: "text-neutral-200 bg-neutral-600 border-neutral-800",
|
|
3570
|
+
ghost: "text-neutral-800 bg-transparent border-transparent",
|
|
3571
|
+
outline: "text-neutral-800 bg-transparent border-neutral-300"
|
|
3572
|
+
};
|
|
3573
|
+
const sizeStyles = {
|
|
3574
|
+
sm: "p-3 text-sm",
|
|
3575
|
+
md: "p-6 text-base",
|
|
3576
|
+
lg: "p-8 text-lg",
|
|
3577
|
+
xl: "p-10 text-xl"
|
|
3578
|
+
};
|
|
3579
|
+
const elevationStyles = elevated ? "shadow-md hover:shadow-lg transition-shadow duration-200" : "";
|
|
3580
|
+
const borderStyles = hasBorder ? "border" : "border-0";
|
|
3581
|
+
const interactiveStyles = isInteractive ? "cursor-pointer hover:brightness-105 active:brightness-95 transition-all duration-200" : "";
|
|
3582
|
+
const widthStyles = fullWidth ? "w-full" : "";
|
|
3583
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3584
|
+
Tag,
|
|
3585
|
+
{
|
|
3586
|
+
ref,
|
|
3587
|
+
className: twMerge(
|
|
3588
|
+
"rounded-md",
|
|
3589
|
+
borderStyles,
|
|
3590
|
+
sizeStyles[size],
|
|
3591
|
+
variantStyles[variant],
|
|
3592
|
+
elevationStyles,
|
|
3593
|
+
interactiveStyles,
|
|
3594
|
+
widthStyles,
|
|
3595
|
+
className
|
|
3596
|
+
),
|
|
3597
|
+
...props,
|
|
3598
|
+
children
|
|
3599
|
+
}
|
|
3600
|
+
);
|
|
3601
|
+
}
|
|
3602
|
+
);
|
|
3575
3603
|
Box.displayName = "Box";
|
|
3576
3604
|
|
|
3577
3605
|
// src/components/Form/index.tsx
|
|
@@ -3602,7 +3630,7 @@ var Form = ({
|
|
|
3602
3630
|
// src/components/Avatar/index.tsx
|
|
3603
3631
|
var import_fa = require("react-icons/fa");
|
|
3604
3632
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
3605
|
-
var Avatar = ({ className, ...rest }) => {
|
|
3633
|
+
var Avatar = ({ className, src, alt = "", ...rest }) => {
|
|
3606
3634
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
3607
3635
|
"div",
|
|
3608
3636
|
{
|
|
@@ -3612,7 +3640,15 @@ var Avatar = ({ className, ...rest }) => {
|
|
|
3612
3640
|
bg-neutral-600 justify-center`,
|
|
3613
3641
|
className
|
|
3614
3642
|
),
|
|
3615
|
-
children:
|
|
3643
|
+
children: src ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
3644
|
+
"img",
|
|
3645
|
+
{
|
|
3646
|
+
className: "w-full h-full object-cover rounded-full",
|
|
3647
|
+
src,
|
|
3648
|
+
alt,
|
|
3649
|
+
...rest
|
|
3650
|
+
}
|
|
3651
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_fa.FaUser, { color: "#FFFFFF", size: 24 })
|
|
3616
3652
|
}
|
|
3617
3653
|
);
|
|
3618
3654
|
};
|
|
@@ -3678,25 +3714,20 @@ var Toggle = ({
|
|
|
3678
3714
|
}
|
|
3679
3715
|
}
|
|
3680
3716
|
};
|
|
3681
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
id: toggleId,
|
|
3696
|
-
disabled,
|
|
3697
|
-
onClick: () => setActive(!active),
|
|
3698
|
-
onKeyDown: handleKeyDown,
|
|
3699
|
-
className: twMerge(`
|
|
3717
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: twMerge("flex items-center gap-3", className), ...rest, children: [
|
|
3718
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3719
|
+
"button",
|
|
3720
|
+
{
|
|
3721
|
+
type: "button",
|
|
3722
|
+
role: "switch",
|
|
3723
|
+
"aria-checked": active,
|
|
3724
|
+
"aria-labelledby": hideLabel ? void 0 : `${toggleId}-label`,
|
|
3725
|
+
"aria-label": hideLabel ? label : void 0,
|
|
3726
|
+
id: toggleId,
|
|
3727
|
+
disabled,
|
|
3728
|
+
onClick: () => setActive(!active),
|
|
3729
|
+
onKeyDown: handleKeyDown,
|
|
3730
|
+
className: twMerge(`
|
|
3700
3731
|
relative inline-flex items-center rounded-full
|
|
3701
3732
|
${selectedSize.toggle}
|
|
3702
3733
|
${active ? "bg-blue-600" : "bg-gray-300 dark:bg-gray-600"}
|
|
@@ -3704,26 +3735,29 @@ var Toggle = ({
|
|
|
3704
3735
|
transition-colors duration-300 ease-in-out
|
|
3705
3736
|
focus:outline-hidden focus:ring-2 focus:ring-blue-500 focus:ring-offset-2
|
|
3706
3737
|
`),
|
|
3707
|
-
|
|
3738
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3739
|
+
"span",
|
|
3740
|
+
{
|
|
3741
|
+
className: `
|
|
3708
3742
|
inline-block transform rounded-full bg-white shadow-md
|
|
3709
3743
|
${selectedSize.knob}
|
|
3710
3744
|
${selectedSize.translate}
|
|
3711
3745
|
transition-transform duration-300 ease-in-out
|
|
3712
|
-
`
|
|
3713
|
-
}
|
|
3714
|
-
),
|
|
3715
|
-
!hideLabel && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3716
|
-
"label",
|
|
3717
|
-
{
|
|
3718
|
-
id: `${toggleId}-label`,
|
|
3719
|
-
htmlFor: toggleId,
|
|
3720
|
-
className: `text-sm font-medium text-gray-700 dark:text-gray-300 ${disabled ? "opacity-50" : ""}`,
|
|
3721
|
-
children: label
|
|
3746
|
+
`
|
|
3722
3747
|
}
|
|
3723
3748
|
)
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3749
|
+
}
|
|
3750
|
+
),
|
|
3751
|
+
!hideLabel && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
3752
|
+
"label",
|
|
3753
|
+
{
|
|
3754
|
+
id: `${toggleId}-label`,
|
|
3755
|
+
htmlFor: toggleId,
|
|
3756
|
+
className: `text-sm font-medium text-gray-700 dark:text-gray-300 ${disabled ? "opacity-50" : ""}`,
|
|
3757
|
+
children: label
|
|
3758
|
+
}
|
|
3759
|
+
)
|
|
3760
|
+
] });
|
|
3727
3761
|
};
|
|
3728
3762
|
|
|
3729
3763
|
// src/components/Skeleton/index.tsx
|
|
@@ -3831,11 +3865,17 @@ var Loading = ({
|
|
|
3831
3865
|
]
|
|
3832
3866
|
}
|
|
3833
3867
|
),
|
|
3834
|
-
withText && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3835
|
-
"
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3868
|
+
withText && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
3869
|
+
"span",
|
|
3870
|
+
{
|
|
3871
|
+
className: twMerge(
|
|
3872
|
+
"ml-3",
|
|
3873
|
+
textSizeClasses[size],
|
|
3874
|
+
colorClasses[color]
|
|
3875
|
+
),
|
|
3876
|
+
children: text
|
|
3877
|
+
}
|
|
3878
|
+
),
|
|
3839
3879
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "sr-only", children: "Loading" })
|
|
3840
3880
|
]
|
|
3841
3881
|
}
|
|
@@ -3926,7 +3966,23 @@ var Modal = ({
|
|
|
3926
3966
|
"aria-label": "Close modal",
|
|
3927
3967
|
onClick: onClose,
|
|
3928
3968
|
className: "p-1 text-gray-400 hover:text-gray-500 focus:outline-hidden focus:ring-2 focus:ring-blue-500 rounded-full",
|
|
3929
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3969
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3970
|
+
"svg",
|
|
3971
|
+
{
|
|
3972
|
+
className: "h-5 w-5",
|
|
3973
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3974
|
+
viewBox: "0 0 20 20",
|
|
3975
|
+
fill: "currentColor",
|
|
3976
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3977
|
+
"path",
|
|
3978
|
+
{
|
|
3979
|
+
fillRule: "evenodd",
|
|
3980
|
+
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",
|
|
3981
|
+
clipRule: "evenodd"
|
|
3982
|
+
}
|
|
3983
|
+
)
|
|
3984
|
+
}
|
|
3985
|
+
)
|
|
3930
3986
|
}
|
|
3931
3987
|
)
|
|
3932
3988
|
] }),
|
|
@@ -3942,17 +3998,11 @@ var Modal = ({
|
|
|
3942
3998
|
// src/components/Toast/index.tsx
|
|
3943
3999
|
var import_react9 = require("react");
|
|
3944
4000
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3945
|
-
var ToastService = class
|
|
4001
|
+
var ToastService = class {
|
|
3946
4002
|
constructor() {
|
|
3947
4003
|
this.listeners = /* @__PURE__ */ new Set();
|
|
3948
4004
|
this.toasts = [];
|
|
3949
4005
|
}
|
|
3950
|
-
static getInstance() {
|
|
3951
|
-
if (!_ToastService.instance) {
|
|
3952
|
-
_ToastService.instance = new _ToastService();
|
|
3953
|
-
}
|
|
3954
|
-
return _ToastService.instance;
|
|
3955
|
-
}
|
|
3956
4006
|
subscribe(listener) {
|
|
3957
4007
|
this.listeners.add(listener);
|
|
3958
4008
|
return () => {
|
|
@@ -3984,7 +4034,7 @@ var ToastService = class _ToastService {
|
|
|
3984
4034
|
return [...this.toasts];
|
|
3985
4035
|
}
|
|
3986
4036
|
};
|
|
3987
|
-
var toastService = ToastService
|
|
4037
|
+
var toastService = new ToastService();
|
|
3988
4038
|
var Toast = ({
|
|
3989
4039
|
id,
|
|
3990
4040
|
message,
|
|
@@ -3997,16 +4047,21 @@ var Toast = ({
|
|
|
3997
4047
|
}) => {
|
|
3998
4048
|
const [isRemoving, setIsRemoving] = (0, import_react9.useState)(false);
|
|
3999
4049
|
const timerRef = (0, import_react9.useRef)();
|
|
4050
|
+
const onDismissRef = (0, import_react9.useRef)(onDismiss);
|
|
4051
|
+
onDismissRef.current = onDismiss;
|
|
4000
4052
|
const handleDismiss = () => {
|
|
4001
4053
|
setIsRemoving(true);
|
|
4002
|
-
setTimeout(() =>
|
|
4054
|
+
setTimeout(() => onDismissRef.current?.(id), 300);
|
|
4003
4055
|
};
|
|
4004
4056
|
(0, import_react9.useEffect)(() => {
|
|
4005
4057
|
if (duration > 0) {
|
|
4006
|
-
timerRef.current = window.setTimeout(
|
|
4058
|
+
timerRef.current = window.setTimeout(() => {
|
|
4059
|
+
setIsRemoving(true);
|
|
4060
|
+
setTimeout(() => onDismissRef.current?.(id), 300);
|
|
4061
|
+
}, duration);
|
|
4007
4062
|
}
|
|
4008
4063
|
return () => window.clearTimeout(timerRef.current);
|
|
4009
|
-
}, [duration]);
|
|
4064
|
+
}, [duration, id]);
|
|
4010
4065
|
const variantStyles = {
|
|
4011
4066
|
success: "bg-green-100 border-green-500 text-green-800",
|
|
4012
4067
|
error: "bg-red-100 border-red-500 text-red-800",
|
|
@@ -4014,10 +4069,38 @@ var Toast = ({
|
|
|
4014
4069
|
info: "bg-blue-100 border-blue-500 text-blue-800"
|
|
4015
4070
|
};
|
|
4016
4071
|
const icons = {
|
|
4017
|
-
success: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4072
|
+
success: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4073
|
+
"path",
|
|
4074
|
+
{
|
|
4075
|
+
fillRule: "evenodd",
|
|
4076
|
+
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",
|
|
4077
|
+
clipRule: "evenodd"
|
|
4078
|
+
}
|
|
4079
|
+
) }),
|
|
4080
|
+
error: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4081
|
+
"path",
|
|
4082
|
+
{
|
|
4083
|
+
fillRule: "evenodd",
|
|
4084
|
+
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",
|
|
4085
|
+
clipRule: "evenodd"
|
|
4086
|
+
}
|
|
4087
|
+
) }),
|
|
4088
|
+
warning: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4089
|
+
"path",
|
|
4090
|
+
{
|
|
4091
|
+
fillRule: "evenodd",
|
|
4092
|
+
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",
|
|
4093
|
+
clipRule: "evenodd"
|
|
4094
|
+
}
|
|
4095
|
+
) }),
|
|
4096
|
+
info: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4097
|
+
"path",
|
|
4098
|
+
{
|
|
4099
|
+
fillRule: "evenodd",
|
|
4100
|
+
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",
|
|
4101
|
+
clipRule: "evenodd"
|
|
4102
|
+
}
|
|
4103
|
+
) })
|
|
4021
4104
|
};
|
|
4022
4105
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
4023
4106
|
"div",
|
|
@@ -4042,7 +4125,24 @@ var Toast = ({
|
|
|
4042
4125
|
className: "ml-3 text-gray-400 hover:text-gray-900",
|
|
4043
4126
|
onClick: handleDismiss,
|
|
4044
4127
|
"aria-label": "Close",
|
|
4045
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4128
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4129
|
+
"svg",
|
|
4130
|
+
{
|
|
4131
|
+
className: "w-4 h-4",
|
|
4132
|
+
fill: "none",
|
|
4133
|
+
stroke: "currentColor",
|
|
4134
|
+
viewBox: "0 0 24 24",
|
|
4135
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
4136
|
+
"path",
|
|
4137
|
+
{
|
|
4138
|
+
strokeLinecap: "round",
|
|
4139
|
+
strokeLinejoin: "round",
|
|
4140
|
+
strokeWidth: "2",
|
|
4141
|
+
d: "M6 18L18 6M6 6l12 12"
|
|
4142
|
+
}
|
|
4143
|
+
)
|
|
4144
|
+
}
|
|
4145
|
+
)
|
|
4046
4146
|
}
|
|
4047
4147
|
)
|
|
4048
4148
|
]
|