@koaris/bloom-ui 1.3.2 → 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 +259 -159
- package/dist/index.d.cts +17 -20
- package/dist/index.d.ts +17 -20
- package/dist/index.mjs +274 -166
- package/package.json +21 -9
- package/tailwind.css +2 -1
package/dist/index.mjs
CHANGED
|
@@ -352,7 +352,7 @@ var fractionRegex = /^\d+\/\d+$/;
|
|
|
352
352
|
var stringLengths = /* @__PURE__ */ new Set(["px", "full", "screen"]);
|
|
353
353
|
var tshirtUnitRegex = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/;
|
|
354
354
|
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$/;
|
|
355
|
-
var colorFunctionRegex = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/;
|
|
355
|
+
var colorFunctionRegex = /^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/;
|
|
356
356
|
var shadowRegex = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;
|
|
357
357
|
var imageRegex = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;
|
|
358
358
|
var isLength = (value) => isNumber(value) || stringLengths.has(value) || fractionRegex.test(value);
|
|
@@ -2495,7 +2495,7 @@ var Card = ({
|
|
|
2495
2495
|
direction === "col" ? "flex-col" : "flex-row",
|
|
2496
2496
|
cardSizeClasses[size],
|
|
2497
2497
|
hoverable && !disabled && "hover:shadow-md hover:shadow-neutral-500",
|
|
2498
|
-
|
|
2498
|
+
selected && "border-2 border-orange-500",
|
|
2499
2499
|
disabled && "opacity-50 cursor-not-allowed",
|
|
2500
2500
|
onClick && !disabled && "cursor-pointer",
|
|
2501
2501
|
className
|
|
@@ -2516,7 +2516,7 @@ var Card = ({
|
|
|
2516
2516
|
"div",
|
|
2517
2517
|
{
|
|
2518
2518
|
className: twMerge(
|
|
2519
|
-
"
|
|
2519
|
+
"shrink-0",
|
|
2520
2520
|
direction === "row" ? "mr-4" : "mb-4",
|
|
2521
2521
|
size === "small" && direction === "row" ? "mr-3" : "",
|
|
2522
2522
|
size === "small" && direction === "col" ? "mb-3" : ""
|
|
@@ -2528,7 +2528,7 @@ var Card = ({
|
|
|
2528
2528
|
alt: imageAlt,
|
|
2529
2529
|
width: imageSize,
|
|
2530
2530
|
height: "auto",
|
|
2531
|
-
className: "rounded object-cover"
|
|
2531
|
+
className: "rounded-sm object-cover"
|
|
2532
2532
|
}
|
|
2533
2533
|
)
|
|
2534
2534
|
}
|
|
@@ -2542,14 +2542,17 @@ var Card = ({
|
|
|
2542
2542
|
direction === "row" && "flex-1"
|
|
2543
2543
|
),
|
|
2544
2544
|
children: [
|
|
2545
|
-
title && /* @__PURE__ */ jsx("h3", { className: "text-md text-left font-bold
|
|
2546
|
-
content && /* @__PURE__ */ jsx("div", { className:
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2545
|
+
title && /* @__PURE__ */ jsx("h3", { className: "text-md text-left font-bold leading-tight mb-1", children: title }),
|
|
2546
|
+
content && /* @__PURE__ */ jsx("div", { className: "text-sm text-left", children: content }),
|
|
2547
|
+
footer && /* @__PURE__ */ jsx(
|
|
2548
|
+
"div",
|
|
2549
|
+
{
|
|
2550
|
+
className: twMerge(
|
|
2551
|
+
"pt-2 text-sm border-t border-neutral-300 text-left"
|
|
2552
|
+
),
|
|
2553
|
+
children: footer
|
|
2554
|
+
}
|
|
2555
|
+
)
|
|
2553
2556
|
]
|
|
2554
2557
|
}
|
|
2555
2558
|
)
|
|
@@ -2560,7 +2563,9 @@ var Card = ({
|
|
|
2560
2563
|
Card.displayName = "Card";
|
|
2561
2564
|
|
|
2562
2565
|
// src/components/Button/index.tsx
|
|
2563
|
-
import {
|
|
2566
|
+
import {
|
|
2567
|
+
forwardRef
|
|
2568
|
+
} from "react";
|
|
2564
2569
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
2565
2570
|
var Button = forwardRef(
|
|
2566
2571
|
({
|
|
@@ -2583,8 +2588,8 @@ var Button = forwardRef(
|
|
|
2583
2588
|
lg: "px-8 py-3 text-lg"
|
|
2584
2589
|
};
|
|
2585
2590
|
const variantClasses = {
|
|
2586
|
-
primary: "bg-orange-500 text-neutral hover:bg-orange-700 focus:ring-orange-500",
|
|
2587
|
-
secondary: "bg-neutral text-orange-500 border border-orange-500 hover:text-
|
|
2591
|
+
primary: "bg-orange-500 text-neutral-100 hover:bg-orange-700 hover:text-white focus:ring-orange-500",
|
|
2592
|
+
secondary: "bg-neutral text-orange-500 border border-orange-500 hover:text-white hover:bg-orange-500 focus:ring-orange-500",
|
|
2588
2593
|
outline: "bg-transparent text-orange-500 border border-orange-500 hover:bg-orange-50 focus:ring-orange-500",
|
|
2589
2594
|
ghost: "bg-transparent text-orange-500 hover:bg-orange-50 focus:ring-orange-500",
|
|
2590
2595
|
link: "bg-transparent text-orange-500 hover:underline p-0 h-auto shadow-none focus:ring-0"
|
|
@@ -2598,8 +2603,8 @@ var Button = forwardRef(
|
|
|
2598
2603
|
{
|
|
2599
2604
|
ref,
|
|
2600
2605
|
className: twMerge(
|
|
2601
|
-
"relative font-medium rounded-
|
|
2602
|
-
"focus:outline-
|
|
2606
|
+
"relative font-medium rounded-xs transition-all duration-200 hover:cursor-pointer",
|
|
2607
|
+
"focus:outline-hidden focus:ring-2 focus:ring-offset-2 rounded-md focus:ring-opacity-50",
|
|
2603
2608
|
variantClasses[variant],
|
|
2604
2609
|
sizeClasses[size],
|
|
2605
2610
|
fullWidth ? "w-full" : "max-w-[180px]",
|
|
@@ -2660,7 +2665,6 @@ var Link = ({
|
|
|
2660
2665
|
disabled,
|
|
2661
2666
|
url,
|
|
2662
2667
|
newPage = true,
|
|
2663
|
-
onClick,
|
|
2664
2668
|
...rest
|
|
2665
2669
|
}) => {
|
|
2666
2670
|
return /* @__PURE__ */ jsx3(
|
|
@@ -2744,7 +2748,7 @@ var Checkbox = ({ className, required, disabled }) => {
|
|
|
2744
2748
|
{
|
|
2745
2749
|
className: twMerge(
|
|
2746
2750
|
className,
|
|
2747
|
-
"relative border-2 w-5 h-5 flex items-center justify-center rounded-
|
|
2751
|
+
"relative border-2 w-5 h-5 flex items-center justify-center rounded-xs hover:border-orange-500 hover:cursor-pointer",
|
|
2748
2752
|
selected ? "bg-orange-500 border-orange-500" : "border-neutral-500 hover:shadow-md hover:shadow-orange-500",
|
|
2749
2753
|
disabled === true && "opacity-50 cursor-not-allowed"
|
|
2750
2754
|
),
|
|
@@ -2772,6 +2776,7 @@ var Checkbox = ({ className, required, disabled }) => {
|
|
|
2772
2776
|
// src/components/Input/index.tsx
|
|
2773
2777
|
import {
|
|
2774
2778
|
useEffect,
|
|
2779
|
+
useRef,
|
|
2775
2780
|
useState as useState3,
|
|
2776
2781
|
forwardRef as forwardRef2
|
|
2777
2782
|
} from "react";
|
|
@@ -2781,11 +2786,11 @@ var passwordMask = {
|
|
|
2781
2786
|
password: [/^(?=.*[!@#$%^&*])/, /(?=.*[0-9])/, /.{8,}$/]
|
|
2782
2787
|
};
|
|
2783
2788
|
var phoneFormats = {
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
+
BR: { countryCode: "+55", format: "($1) $2-$3" },
|
|
2790
|
+
US: { countryCode: "+1", format: "($1) $2-$3" },
|
|
2791
|
+
UK: { countryCode: "+44", format: "$1 $2 $3" },
|
|
2792
|
+
DE: { countryCode: "+49", format: "$1 $2 $3" },
|
|
2793
|
+
FR: { countryCode: "+33", format: "$1 $2 $3 $4" }
|
|
2789
2794
|
};
|
|
2790
2795
|
var Input = forwardRef2(
|
|
2791
2796
|
({
|
|
@@ -2828,21 +2833,29 @@ var Input = forwardRef2(
|
|
|
2828
2833
|
case "date":
|
|
2829
2834
|
result = value2.replace(/\D/g, "");
|
|
2830
2835
|
if (result.length > 8) result = result.substring(0, 8);
|
|
2831
|
-
if (result.length > 4)
|
|
2832
|
-
|
|
2836
|
+
if (result.length > 4)
|
|
2837
|
+
result = result.replace(/(\d{2})(\d{2})(\d+)/, "$1/$2/$3");
|
|
2838
|
+
else if (result.length > 2)
|
|
2839
|
+
result = result.replace(/(\d{2})(\d+)/, "$1/$2");
|
|
2833
2840
|
break;
|
|
2834
2841
|
case "cpf":
|
|
2835
2842
|
result = value2.replace(/\D/g, "");
|
|
2836
2843
|
if (result.length > 11) result = result.substring(0, 11);
|
|
2837
|
-
if (result.length > 9)
|
|
2838
|
-
|
|
2839
|
-
else if (result.length >
|
|
2844
|
+
if (result.length > 9)
|
|
2845
|
+
result = result.replace(/(\d{3})(\d{3})(\d{3})(\d+)/, "$1.$2.$3-$4");
|
|
2846
|
+
else if (result.length > 6)
|
|
2847
|
+
result = result.replace(/(\d{3})(\d{3})(\d+)/, "$1.$2.$3");
|
|
2848
|
+
else if (result.length > 3)
|
|
2849
|
+
result = result.replace(/(\d{3})(\d+)/, "$1.$2");
|
|
2840
2850
|
break;
|
|
2841
2851
|
case "cnpj":
|
|
2842
2852
|
result = value2.replace(/\D/g, "");
|
|
2843
2853
|
if (result.length > 14) result = result.substring(0, 14);
|
|
2844
2854
|
if (result.length > 12)
|
|
2845
|
-
result = result.replace(
|
|
2855
|
+
result = result.replace(
|
|
2856
|
+
/(\d{2})(\d{3})(\d{3})(\d{4})(\d+)/,
|
|
2857
|
+
"$1.$2.$3/$4-$5"
|
|
2858
|
+
);
|
|
2846
2859
|
else if (result.length > 8)
|
|
2847
2860
|
result = result.replace(/(\d{2})(\d{3})(\d{3})(\d+)/, "$1.$2.$3/$4");
|
|
2848
2861
|
else if (result.length > 5)
|
|
@@ -2853,7 +2866,8 @@ var Input = forwardRef2(
|
|
|
2853
2866
|
case "cep":
|
|
2854
2867
|
result = value2.replace(/\D/g, "");
|
|
2855
2868
|
if (result.length > 8) result = result.substring(0, 8);
|
|
2856
|
-
if (result.length > 5)
|
|
2869
|
+
if (result.length > 5)
|
|
2870
|
+
result = result.replace(/(\d{5})(\d+)/, "$1-$2");
|
|
2857
2871
|
break;
|
|
2858
2872
|
case "phone":
|
|
2859
2873
|
result = applyPhoneMask(value2, countryCode);
|
|
@@ -2868,7 +2882,6 @@ var Input = forwardRef2(
|
|
|
2868
2882
|
};
|
|
2869
2883
|
const applyPhoneMask = (value2, countryCode2) => {
|
|
2870
2884
|
let digits = value2.replace(/\D/g, "");
|
|
2871
|
-
const format = phoneFormats[countryCode2] || phoneFormats["BR"];
|
|
2872
2885
|
switch (countryCode2) {
|
|
2873
2886
|
case "BR":
|
|
2874
2887
|
if (digits.length > 11) digits = digits.substring(0, 11);
|
|
@@ -2931,7 +2944,9 @@ var Input = forwardRef2(
|
|
|
2931
2944
|
}
|
|
2932
2945
|
break;
|
|
2933
2946
|
case "email":
|
|
2934
|
-
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(
|
|
2947
|
+
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(
|
|
2948
|
+
value2
|
|
2949
|
+
);
|
|
2935
2950
|
break;
|
|
2936
2951
|
default:
|
|
2937
2952
|
valid = value2.length > 0;
|
|
@@ -2964,14 +2979,6 @@ var Input = forwardRef2(
|
|
|
2964
2979
|
}
|
|
2965
2980
|
externalOnChange?.(newEvent);
|
|
2966
2981
|
};
|
|
2967
|
-
useEffect(() => {
|
|
2968
|
-
setInputValue(value || "");
|
|
2969
|
-
if (value && type === "password") {
|
|
2970
|
-
checkPassword(value);
|
|
2971
|
-
} else if (value) {
|
|
2972
|
-
validateInput(value);
|
|
2973
|
-
}
|
|
2974
|
-
}, [value, type]);
|
|
2975
2982
|
const checkPassword = (value2) => {
|
|
2976
2983
|
const validationResult = {
|
|
2977
2984
|
hasEightCharacters: value2?.match(passwordMask.password[2]) !== null,
|
|
@@ -2983,6 +2990,18 @@ var Input = forwardRef2(
|
|
|
2983
2990
|
validationResult.hasEightCharacters && validationResult.hasSpecialCharacters && validationResult.hasNumber
|
|
2984
2991
|
);
|
|
2985
2992
|
};
|
|
2993
|
+
const validateInputRef = useRef(validateInput);
|
|
2994
|
+
const checkPasswordRef = useRef(checkPassword);
|
|
2995
|
+
validateInputRef.current = validateInput;
|
|
2996
|
+
checkPasswordRef.current = checkPassword;
|
|
2997
|
+
useEffect(() => {
|
|
2998
|
+
setInputValue(value || "");
|
|
2999
|
+
if (value && type === "password") {
|
|
3000
|
+
checkPasswordRef.current(value);
|
|
3001
|
+
} else if (value) {
|
|
3002
|
+
validateInputRef.current(value);
|
|
3003
|
+
}
|
|
3004
|
+
}, [value, type]);
|
|
2986
3005
|
const getInputType = () => {
|
|
2987
3006
|
switch (type) {
|
|
2988
3007
|
case "password":
|
|
@@ -3003,16 +3022,16 @@ var Input = forwardRef2(
|
|
|
3003
3022
|
};
|
|
3004
3023
|
const renderPhonePrefix = () => {
|
|
3005
3024
|
if (type !== "phone") return null;
|
|
3006
|
-
const format = phoneFormats[countryCode] || phoneFormats
|
|
3025
|
+
const format = phoneFormats[countryCode] || phoneFormats.BR;
|
|
3007
3026
|
return /* @__PURE__ */ jsx6("span", { className: "absolute left-3 top-1.5 text-gray-500", children: format.countryCode });
|
|
3008
3027
|
};
|
|
3009
3028
|
const inputClasses = twMerge(
|
|
3010
|
-
"flex items-center justify-center border-2 border-gray-400 rounded-
|
|
3029
|
+
"flex items-center justify-center border-2 border-gray-400 rounded-xs w-full px-3 py-1 text-md hover:shadow-md hover:shadow-neutral-500 focus:outline-hidden transition-all duration-200",
|
|
3011
3030
|
className,
|
|
3012
3031
|
disabled && "opacity-50 cursor-not-allowed",
|
|
3013
3032
|
selected && "border-2 border-orange-500",
|
|
3014
3033
|
validated && isValid && "border-2 border-green-900",
|
|
3015
|
-
(error || !isValid && inputValue
|
|
3034
|
+
(error || !isValid && inputValue !== "") && "border-2 border-red-900",
|
|
3016
3035
|
type === "phone" && "pl-10"
|
|
3017
3036
|
);
|
|
3018
3037
|
const renderPasswordValidation = () => {
|
|
@@ -3068,7 +3087,15 @@ var Input = forwardRef2(
|
|
|
3068
3087
|
)
|
|
3069
3088
|
] }),
|
|
3070
3089
|
renderPasswordValidation(),
|
|
3071
|
-
error && /* @__PURE__ */ jsx6(
|
|
3090
|
+
error && /* @__PURE__ */ jsx6(
|
|
3091
|
+
"p",
|
|
3092
|
+
{
|
|
3093
|
+
id: `${id}-error`,
|
|
3094
|
+
className: "mt-1 text-sm text-red-900",
|
|
3095
|
+
role: "alert",
|
|
3096
|
+
children: errorMessage || "Invalid field."
|
|
3097
|
+
}
|
|
3098
|
+
),
|
|
3072
3099
|
helperText && !error && /* @__PURE__ */ jsx6("p", { id: `${id}-helper`, className: "mt-1 text-sm text-gray-500", children: helperText })
|
|
3073
3100
|
] });
|
|
3074
3101
|
}
|
|
@@ -3113,8 +3140,8 @@ var TextInput = forwardRef3(
|
|
|
3113
3140
|
"div",
|
|
3114
3141
|
{
|
|
3115
3142
|
className: twMerge(
|
|
3116
|
-
" py-2 px-4 border-2 rounded-
|
|
3117
|
-
"hover:shadow-md hover:shadow-neutral-500 focus:outline-
|
|
3143
|
+
" py-2 px-4 border-2 rounded-xs box-border flex items-baseline bg-neutral-200",
|
|
3144
|
+
"hover:shadow-md hover:shadow-neutral-500 focus:outline-hidden",
|
|
3118
3145
|
variant === "secondary" && "bg-neutral-800 border-neutral-800 ",
|
|
3119
3146
|
selected === true && "border-2 border-orange-500",
|
|
3120
3147
|
disabled === true && "opacity-50 cursor-not-allowed",
|
|
@@ -3136,8 +3163,8 @@ var TextInput = forwardRef3(
|
|
|
3136
3163
|
disabled,
|
|
3137
3164
|
ref,
|
|
3138
3165
|
className: twMerge(
|
|
3139
|
-
"flex items-center justify-center bg-neutral-200 rounded-
|
|
3140
|
-
"focus:outline-
|
|
3166
|
+
"flex items-center justify-center bg-neutral-200 rounded-xs w-full px-1 py-2 text-md",
|
|
3167
|
+
"focus:outline-hidden text-neutral-800",
|
|
3141
3168
|
disabled === true && "cursor-not-allowed",
|
|
3142
3169
|
variant === "secondary" && "bg-neutral-800 text-neutral",
|
|
3143
3170
|
className
|
|
@@ -3155,6 +3182,7 @@ TextInput.displayName = "TextInput";
|
|
|
3155
3182
|
// src/components/TextArea/index.tsx
|
|
3156
3183
|
import {
|
|
3157
3184
|
useEffect as useEffect3,
|
|
3185
|
+
useRef as useRef2,
|
|
3158
3186
|
useState as useState5,
|
|
3159
3187
|
forwardRef as forwardRef4
|
|
3160
3188
|
} from "react";
|
|
@@ -3226,7 +3254,7 @@ var TextArea = forwardRef4(
|
|
|
3226
3254
|
JSON.parse(value2);
|
|
3227
3255
|
setIsValid(true);
|
|
3228
3256
|
return true;
|
|
3229
|
-
} catch
|
|
3257
|
+
} catch {
|
|
3230
3258
|
setIsValid(false);
|
|
3231
3259
|
return false;
|
|
3232
3260
|
}
|
|
@@ -3253,17 +3281,19 @@ var TextArea = forwardRef4(
|
|
|
3253
3281
|
externalOnChange(event);
|
|
3254
3282
|
}
|
|
3255
3283
|
};
|
|
3284
|
+
const validateInputRef = useRef2(validateInput);
|
|
3285
|
+
validateInputRef.current = validateInput;
|
|
3256
3286
|
useEffect3(() => {
|
|
3257
3287
|
setInputValue(value || "");
|
|
3258
3288
|
if (value) {
|
|
3259
|
-
|
|
3289
|
+
validateInputRef.current(value);
|
|
3260
3290
|
}
|
|
3261
3291
|
}, [value, required, maxLength]);
|
|
3262
3292
|
const characterCount = inputValue?.length || 0;
|
|
3263
3293
|
const hasMaxLength = maxLength !== void 0 && maxLength > 0;
|
|
3264
3294
|
const isOverLimit = hasMaxLength && characterCount > maxLength;
|
|
3265
3295
|
const textareaClasses = twMerge(
|
|
3266
|
-
"w-full border-2 rounded-
|
|
3296
|
+
"w-full border-2 rounded-xs focus:outline-hidden transition-all duration-200",
|
|
3267
3297
|
"hover:shadow-md hover:shadow-neutral-500",
|
|
3268
3298
|
sizeStyles[size],
|
|
3269
3299
|
variantStyles[variant],
|
|
@@ -3488,54 +3518,56 @@ var Heading = ({
|
|
|
3488
3518
|
// src/components/Box/index.tsx
|
|
3489
3519
|
import { forwardRef as forwardRef5 } from "react";
|
|
3490
3520
|
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
3491
|
-
var Box = forwardRef5(
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3521
|
+
var Box = forwardRef5(
|
|
3522
|
+
({
|
|
3523
|
+
className,
|
|
3524
|
+
children,
|
|
3525
|
+
tag = "div",
|
|
3526
|
+
variant = "secondary",
|
|
3527
|
+
size = "md",
|
|
3528
|
+
elevated = false,
|
|
3529
|
+
hasBorder = true,
|
|
3530
|
+
isInteractive = false,
|
|
3531
|
+
fullWidth = false,
|
|
3532
|
+
...props
|
|
3533
|
+
}, ref) => {
|
|
3534
|
+
const Tag = tag;
|
|
3535
|
+
const variantStyles = {
|
|
3536
|
+
primary: "text-neutral-800 bg-neutral-200 border-neutral-300",
|
|
3537
|
+
secondary: "text-neutral-200 bg-neutral-600 border-neutral-800",
|
|
3538
|
+
ghost: "text-neutral-800 bg-transparent border-transparent",
|
|
3539
|
+
outline: "text-neutral-800 bg-transparent border-neutral-300"
|
|
3540
|
+
};
|
|
3541
|
+
const sizeStyles = {
|
|
3542
|
+
sm: "p-3 text-sm",
|
|
3543
|
+
md: "p-6 text-base",
|
|
3544
|
+
lg: "p-8 text-lg",
|
|
3545
|
+
xl: "p-10 text-xl"
|
|
3546
|
+
};
|
|
3547
|
+
const elevationStyles = elevated ? "shadow-md hover:shadow-lg transition-shadow duration-200" : "";
|
|
3548
|
+
const borderStyles = hasBorder ? "border" : "border-0";
|
|
3549
|
+
const interactiveStyles = isInteractive ? "cursor-pointer hover:brightness-105 active:brightness-95 transition-all duration-200" : "";
|
|
3550
|
+
const widthStyles = fullWidth ? "w-full" : "";
|
|
3551
|
+
return /* @__PURE__ */ jsx11(
|
|
3552
|
+
Tag,
|
|
3553
|
+
{
|
|
3554
|
+
ref,
|
|
3555
|
+
className: twMerge(
|
|
3556
|
+
"rounded-md",
|
|
3557
|
+
borderStyles,
|
|
3558
|
+
sizeStyles[size],
|
|
3559
|
+
variantStyles[variant],
|
|
3560
|
+
elevationStyles,
|
|
3561
|
+
interactiveStyles,
|
|
3562
|
+
widthStyles,
|
|
3563
|
+
className
|
|
3564
|
+
),
|
|
3565
|
+
...props,
|
|
3566
|
+
children
|
|
3567
|
+
}
|
|
3568
|
+
);
|
|
3569
|
+
}
|
|
3570
|
+
);
|
|
3539
3571
|
Box.displayName = "Box";
|
|
3540
3572
|
|
|
3541
3573
|
// src/components/Form/index.tsx
|
|
@@ -3566,7 +3598,7 @@ var Form = ({
|
|
|
3566
3598
|
// src/components/Avatar/index.tsx
|
|
3567
3599
|
import { FaUser } from "react-icons/fa";
|
|
3568
3600
|
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
3569
|
-
var Avatar = ({ className, ...rest }) => {
|
|
3601
|
+
var Avatar = ({ className, src, alt = "", ...rest }) => {
|
|
3570
3602
|
return /* @__PURE__ */ jsx13(
|
|
3571
3603
|
"div",
|
|
3572
3604
|
{
|
|
@@ -3576,7 +3608,15 @@ var Avatar = ({ className, ...rest }) => {
|
|
|
3576
3608
|
bg-neutral-600 justify-center`,
|
|
3577
3609
|
className
|
|
3578
3610
|
),
|
|
3579
|
-
children:
|
|
3611
|
+
children: src ? /* @__PURE__ */ jsx13(
|
|
3612
|
+
"img",
|
|
3613
|
+
{
|
|
3614
|
+
className: "w-full h-full object-cover rounded-full",
|
|
3615
|
+
src,
|
|
3616
|
+
alt,
|
|
3617
|
+
...rest
|
|
3618
|
+
}
|
|
3619
|
+
) : /* @__PURE__ */ jsx13(FaUser, { color: "#FFFFFF", size: 24 })
|
|
3580
3620
|
}
|
|
3581
3621
|
);
|
|
3582
3622
|
};
|
|
@@ -3642,52 +3682,50 @@ var Toggle = ({
|
|
|
3642
3682
|
}
|
|
3643
3683
|
}
|
|
3644
3684
|
};
|
|
3645
|
-
return /* @__PURE__ */ jsxs9(
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
id: toggleId,
|
|
3660
|
-
disabled,
|
|
3661
|
-
onClick: () => setActive(!active),
|
|
3662
|
-
onKeyDown: handleKeyDown,
|
|
3663
|
-
className: twMerge(`
|
|
3685
|
+
return /* @__PURE__ */ jsxs9("div", { className: twMerge("flex items-center gap-3", className), ...rest, children: [
|
|
3686
|
+
/* @__PURE__ */ jsx15(
|
|
3687
|
+
"button",
|
|
3688
|
+
{
|
|
3689
|
+
type: "button",
|
|
3690
|
+
role: "switch",
|
|
3691
|
+
"aria-checked": active,
|
|
3692
|
+
"aria-labelledby": hideLabel ? void 0 : `${toggleId}-label`,
|
|
3693
|
+
"aria-label": hideLabel ? label : void 0,
|
|
3694
|
+
id: toggleId,
|
|
3695
|
+
disabled,
|
|
3696
|
+
onClick: () => setActive(!active),
|
|
3697
|
+
onKeyDown: handleKeyDown,
|
|
3698
|
+
className: twMerge(`
|
|
3664
3699
|
relative inline-flex items-center rounded-full
|
|
3665
3700
|
${selectedSize.toggle}
|
|
3666
3701
|
${active ? "bg-blue-600" : "bg-gray-300 dark:bg-gray-600"}
|
|
3667
3702
|
${disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}
|
|
3668
3703
|
transition-colors duration-300 ease-in-out
|
|
3669
|
-
focus:outline-
|
|
3704
|
+
focus:outline-hidden focus:ring-2 focus:ring-blue-500 focus:ring-offset-2
|
|
3670
3705
|
`),
|
|
3671
|
-
|
|
3706
|
+
children: /* @__PURE__ */ jsx15(
|
|
3707
|
+
"span",
|
|
3708
|
+
{
|
|
3709
|
+
className: `
|
|
3672
3710
|
inline-block transform rounded-full bg-white shadow-md
|
|
3673
3711
|
${selectedSize.knob}
|
|
3674
3712
|
${selectedSize.translate}
|
|
3675
3713
|
transition-transform duration-300 ease-in-out
|
|
3676
|
-
`
|
|
3677
|
-
}
|
|
3678
|
-
),
|
|
3679
|
-
!hideLabel && /* @__PURE__ */ jsx15(
|
|
3680
|
-
"label",
|
|
3681
|
-
{
|
|
3682
|
-
id: `${toggleId}-label`,
|
|
3683
|
-
htmlFor: toggleId,
|
|
3684
|
-
className: `text-sm font-medium text-gray-700 dark:text-gray-300 ${disabled ? "opacity-50" : ""}`,
|
|
3685
|
-
children: label
|
|
3714
|
+
`
|
|
3686
3715
|
}
|
|
3687
3716
|
)
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3717
|
+
}
|
|
3718
|
+
),
|
|
3719
|
+
!hideLabel && /* @__PURE__ */ jsx15(
|
|
3720
|
+
"label",
|
|
3721
|
+
{
|
|
3722
|
+
id: `${toggleId}-label`,
|
|
3723
|
+
htmlFor: toggleId,
|
|
3724
|
+
className: `text-sm font-medium text-gray-700 dark:text-gray-300 ${disabled ? "opacity-50" : ""}`,
|
|
3725
|
+
children: label
|
|
3726
|
+
}
|
|
3727
|
+
)
|
|
3728
|
+
] });
|
|
3691
3729
|
};
|
|
3692
3730
|
|
|
3693
3731
|
// src/components/Skeleton/index.tsx
|
|
@@ -3795,11 +3833,17 @@ var Loading = ({
|
|
|
3795
3833
|
]
|
|
3796
3834
|
}
|
|
3797
3835
|
),
|
|
3798
|
-
withText && /* @__PURE__ */ jsx17(
|
|
3799
|
-
"
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3836
|
+
withText && /* @__PURE__ */ jsx17(
|
|
3837
|
+
"span",
|
|
3838
|
+
{
|
|
3839
|
+
className: twMerge(
|
|
3840
|
+
"ml-3",
|
|
3841
|
+
textSizeClasses[size],
|
|
3842
|
+
colorClasses[color]
|
|
3843
|
+
),
|
|
3844
|
+
children: text
|
|
3845
|
+
}
|
|
3846
|
+
),
|
|
3803
3847
|
/* @__PURE__ */ jsx17("span", { className: "sr-only", children: "Loading" })
|
|
3804
3848
|
]
|
|
3805
3849
|
}
|
|
@@ -3808,7 +3852,11 @@ var Loading = ({
|
|
|
3808
3852
|
Loading.displayName = "Loading";
|
|
3809
3853
|
|
|
3810
3854
|
// src/components/Modal/index.tsx
|
|
3811
|
-
import {
|
|
3855
|
+
import {
|
|
3856
|
+
useEffect as useEffect4,
|
|
3857
|
+
useState as useState6,
|
|
3858
|
+
useRef as useRef3
|
|
3859
|
+
} from "react";
|
|
3812
3860
|
import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3813
3861
|
var Modal = ({
|
|
3814
3862
|
className,
|
|
@@ -3823,8 +3871,8 @@ var Modal = ({
|
|
|
3823
3871
|
footer,
|
|
3824
3872
|
...rest
|
|
3825
3873
|
}) => {
|
|
3826
|
-
const modalRef =
|
|
3827
|
-
const portalRoot =
|
|
3874
|
+
const modalRef = useRef3(null);
|
|
3875
|
+
const portalRoot = useRef3(null);
|
|
3828
3876
|
const [mounted, setMounted] = useState6(false);
|
|
3829
3877
|
useEffect4(() => {
|
|
3830
3878
|
portalRoot.current = document.createElement("div");
|
|
@@ -3889,8 +3937,24 @@ var Modal = ({
|
|
|
3889
3937
|
type: "button",
|
|
3890
3938
|
"aria-label": "Close modal",
|
|
3891
3939
|
onClick: onClose,
|
|
3892
|
-
className: "p-1 text-gray-400 hover:text-gray-500 focus:outline-
|
|
3893
|
-
children: /* @__PURE__ */ jsx18(
|
|
3940
|
+
className: "p-1 text-gray-400 hover:text-gray-500 focus:outline-hidden focus:ring-2 focus:ring-blue-500 rounded-full",
|
|
3941
|
+
children: /* @__PURE__ */ jsx18(
|
|
3942
|
+
"svg",
|
|
3943
|
+
{
|
|
3944
|
+
className: "h-5 w-5",
|
|
3945
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3946
|
+
viewBox: "0 0 20 20",
|
|
3947
|
+
fill: "currentColor",
|
|
3948
|
+
children: /* @__PURE__ */ jsx18(
|
|
3949
|
+
"path",
|
|
3950
|
+
{
|
|
3951
|
+
fillRule: "evenodd",
|
|
3952
|
+
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",
|
|
3953
|
+
clipRule: "evenodd"
|
|
3954
|
+
}
|
|
3955
|
+
)
|
|
3956
|
+
}
|
|
3957
|
+
)
|
|
3894
3958
|
}
|
|
3895
3959
|
)
|
|
3896
3960
|
] }),
|
|
@@ -3904,19 +3968,13 @@ var Modal = ({
|
|
|
3904
3968
|
};
|
|
3905
3969
|
|
|
3906
3970
|
// src/components/Toast/index.tsx
|
|
3907
|
-
import { useEffect as useEffect5, useState as useState7, useRef as
|
|
3971
|
+
import { useEffect as useEffect5, useState as useState7, useRef as useRef4 } from "react";
|
|
3908
3972
|
import { Fragment, jsx as jsx19, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3909
|
-
var ToastService = class
|
|
3973
|
+
var ToastService = class {
|
|
3910
3974
|
constructor() {
|
|
3911
3975
|
this.listeners = /* @__PURE__ */ new Set();
|
|
3912
3976
|
this.toasts = [];
|
|
3913
3977
|
}
|
|
3914
|
-
static getInstance() {
|
|
3915
|
-
if (!_ToastService.instance) {
|
|
3916
|
-
_ToastService.instance = new _ToastService();
|
|
3917
|
-
}
|
|
3918
|
-
return _ToastService.instance;
|
|
3919
|
-
}
|
|
3920
3978
|
subscribe(listener) {
|
|
3921
3979
|
this.listeners.add(listener);
|
|
3922
3980
|
return () => {
|
|
@@ -3948,7 +4006,7 @@ var ToastService = class _ToastService {
|
|
|
3948
4006
|
return [...this.toasts];
|
|
3949
4007
|
}
|
|
3950
4008
|
};
|
|
3951
|
-
var toastService = ToastService
|
|
4009
|
+
var toastService = new ToastService();
|
|
3952
4010
|
var Toast = ({
|
|
3953
4011
|
id,
|
|
3954
4012
|
message,
|
|
@@ -3960,17 +4018,22 @@ var Toast = ({
|
|
|
3960
4018
|
className
|
|
3961
4019
|
}) => {
|
|
3962
4020
|
const [isRemoving, setIsRemoving] = useState7(false);
|
|
3963
|
-
const timerRef =
|
|
4021
|
+
const timerRef = useRef4();
|
|
4022
|
+
const onDismissRef = useRef4(onDismiss);
|
|
4023
|
+
onDismissRef.current = onDismiss;
|
|
3964
4024
|
const handleDismiss = () => {
|
|
3965
4025
|
setIsRemoving(true);
|
|
3966
|
-
setTimeout(() =>
|
|
4026
|
+
setTimeout(() => onDismissRef.current?.(id), 300);
|
|
3967
4027
|
};
|
|
3968
4028
|
useEffect5(() => {
|
|
3969
4029
|
if (duration > 0) {
|
|
3970
|
-
timerRef.current = window.setTimeout(
|
|
4030
|
+
timerRef.current = window.setTimeout(() => {
|
|
4031
|
+
setIsRemoving(true);
|
|
4032
|
+
setTimeout(() => onDismissRef.current?.(id), 300);
|
|
4033
|
+
}, duration);
|
|
3971
4034
|
}
|
|
3972
4035
|
return () => window.clearTimeout(timerRef.current);
|
|
3973
|
-
}, [duration]);
|
|
4036
|
+
}, [duration, id]);
|
|
3974
4037
|
const variantStyles = {
|
|
3975
4038
|
success: "bg-green-100 border-green-500 text-green-800",
|
|
3976
4039
|
error: "bg-red-100 border-red-500 text-red-800",
|
|
@@ -3978,10 +4041,38 @@ var Toast = ({
|
|
|
3978
4041
|
info: "bg-blue-100 border-blue-500 text-blue-800"
|
|
3979
4042
|
};
|
|
3980
4043
|
const icons = {
|
|
3981
|
-
success: /* @__PURE__ */ jsx19("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx19(
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
4044
|
+
success: /* @__PURE__ */ jsx19("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx19(
|
|
4045
|
+
"path",
|
|
4046
|
+
{
|
|
4047
|
+
fillRule: "evenodd",
|
|
4048
|
+
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",
|
|
4049
|
+
clipRule: "evenodd"
|
|
4050
|
+
}
|
|
4051
|
+
) }),
|
|
4052
|
+
error: /* @__PURE__ */ jsx19("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx19(
|
|
4053
|
+
"path",
|
|
4054
|
+
{
|
|
4055
|
+
fillRule: "evenodd",
|
|
4056
|
+
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",
|
|
4057
|
+
clipRule: "evenodd"
|
|
4058
|
+
}
|
|
4059
|
+
) }),
|
|
4060
|
+
warning: /* @__PURE__ */ jsx19("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx19(
|
|
4061
|
+
"path",
|
|
4062
|
+
{
|
|
4063
|
+
fillRule: "evenodd",
|
|
4064
|
+
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",
|
|
4065
|
+
clipRule: "evenodd"
|
|
4066
|
+
}
|
|
4067
|
+
) }),
|
|
4068
|
+
info: /* @__PURE__ */ jsx19("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx19(
|
|
4069
|
+
"path",
|
|
4070
|
+
{
|
|
4071
|
+
fillRule: "evenodd",
|
|
4072
|
+
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",
|
|
4073
|
+
clipRule: "evenodd"
|
|
4074
|
+
}
|
|
4075
|
+
) })
|
|
3985
4076
|
};
|
|
3986
4077
|
return /* @__PURE__ */ jsxs12(
|
|
3987
4078
|
"div",
|
|
@@ -3994,7 +4085,7 @@ var Toast = ({
|
|
|
3994
4085
|
),
|
|
3995
4086
|
role: "alert",
|
|
3996
4087
|
children: [
|
|
3997
|
-
/* @__PURE__ */ jsx19("div", { className: `
|
|
4088
|
+
/* @__PURE__ */ jsx19("div", { className: `shrink-0 mr-3 text-${variant}-500`, children: icons[variant] }),
|
|
3998
4089
|
/* @__PURE__ */ jsxs12("div", { className: "flex-1", children: [
|
|
3999
4090
|
title && /* @__PURE__ */ jsx19("h3", { className: "font-medium text-sm", children: title }),
|
|
4000
4091
|
/* @__PURE__ */ jsx19("div", { className: "text-sm", children: message })
|
|
@@ -4006,7 +4097,24 @@ var Toast = ({
|
|
|
4006
4097
|
className: "ml-3 text-gray-400 hover:text-gray-900",
|
|
4007
4098
|
onClick: handleDismiss,
|
|
4008
4099
|
"aria-label": "Close",
|
|
4009
|
-
children: /* @__PURE__ */ jsx19(
|
|
4100
|
+
children: /* @__PURE__ */ jsx19(
|
|
4101
|
+
"svg",
|
|
4102
|
+
{
|
|
4103
|
+
className: "w-4 h-4",
|
|
4104
|
+
fill: "none",
|
|
4105
|
+
stroke: "currentColor",
|
|
4106
|
+
viewBox: "0 0 24 24",
|
|
4107
|
+
children: /* @__PURE__ */ jsx19(
|
|
4108
|
+
"path",
|
|
4109
|
+
{
|
|
4110
|
+
strokeLinecap: "round",
|
|
4111
|
+
strokeLinejoin: "round",
|
|
4112
|
+
strokeWidth: "2",
|
|
4113
|
+
d: "M6 18L18 6M6 6l12 12"
|
|
4114
|
+
}
|
|
4115
|
+
)
|
|
4116
|
+
}
|
|
4117
|
+
)
|
|
4010
4118
|
}
|
|
4011
4119
|
)
|
|
4012
4120
|
]
|
|
@@ -4017,7 +4125,7 @@ var ToastContainer = ({
|
|
|
4017
4125
|
position = "top-right",
|
|
4018
4126
|
className
|
|
4019
4127
|
}) => {
|
|
4020
|
-
const containerRef =
|
|
4128
|
+
const containerRef = useRef4(null);
|
|
4021
4129
|
const [isMounted, setIsMounted] = useState7(false);
|
|
4022
4130
|
const [toasts, setToasts] = useState7([]);
|
|
4023
4131
|
useEffect5(() => {
|