@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.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
|
|
@@ -2564,7 +2564,7 @@ var Card = ({
|
|
|
2564
2564
|
"div",
|
|
2565
2565
|
{
|
|
2566
2566
|
className: twMerge(
|
|
2567
|
-
"
|
|
2567
|
+
"shrink-0",
|
|
2568
2568
|
direction === "row" ? "mr-4" : "mb-4",
|
|
2569
2569
|
size === "small" && direction === "row" ? "mr-3" : "",
|
|
2570
2570
|
size === "small" && direction === "col" ? "mb-3" : ""
|
|
@@ -2576,7 +2576,7 @@ var Card = ({
|
|
|
2576
2576
|
alt: imageAlt,
|
|
2577
2577
|
width: imageSize,
|
|
2578
2578
|
height: "auto",
|
|
2579
|
-
className: "rounded object-cover"
|
|
2579
|
+
className: "rounded-sm object-cover"
|
|
2580
2580
|
}
|
|
2581
2581
|
)
|
|
2582
2582
|
}
|
|
@@ -2590,14 +2590,17 @@ var Card = ({
|
|
|
2590
2590
|
direction === "row" && "flex-1"
|
|
2591
2591
|
),
|
|
2592
2592
|
children: [
|
|
2593
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: "text-md text-left font-bold
|
|
2594
|
-
content && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className:
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
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: "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
|
)
|
|
@@ -2631,8 +2634,8 @@ var Button = (0, import_react.forwardRef)(
|
|
|
2631
2634
|
lg: "px-8 py-3 text-lg"
|
|
2632
2635
|
};
|
|
2633
2636
|
const variantClasses = {
|
|
2634
|
-
primary: "bg-orange-500 text-neutral hover:bg-orange-700 focus:ring-orange-500",
|
|
2635
|
-
secondary: "bg-neutral text-orange-500 border border-orange-500 hover:text-
|
|
2637
|
+
primary: "bg-orange-500 text-neutral-100 hover:bg-orange-700 hover:text-white focus:ring-orange-500",
|
|
2638
|
+
secondary: "bg-neutral text-orange-500 border border-orange-500 hover:text-white hover:bg-orange-500 focus:ring-orange-500",
|
|
2636
2639
|
outline: "bg-transparent text-orange-500 border border-orange-500 hover:bg-orange-50 focus:ring-orange-500",
|
|
2637
2640
|
ghost: "bg-transparent text-orange-500 hover:bg-orange-50 focus:ring-orange-500",
|
|
2638
2641
|
link: "bg-transparent text-orange-500 hover:underline p-0 h-auto shadow-none focus:ring-0"
|
|
@@ -2646,8 +2649,8 @@ var Button = (0, import_react.forwardRef)(
|
|
|
2646
2649
|
{
|
|
2647
2650
|
ref,
|
|
2648
2651
|
className: twMerge(
|
|
2649
|
-
"relative font-medium rounded-
|
|
2650
|
-
"focus:outline-
|
|
2652
|
+
"relative font-medium rounded-xs transition-all duration-200 hover:cursor-pointer",
|
|
2653
|
+
"focus:outline-hidden focus:ring-2 focus:ring-offset-2 rounded-md focus:ring-opacity-50",
|
|
2651
2654
|
variantClasses[variant],
|
|
2652
2655
|
sizeClasses[size],
|
|
2653
2656
|
fullWidth ? "w-full" : "max-w-[180px]",
|
|
@@ -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)(
|
|
@@ -2792,7 +2794,7 @@ var Checkbox = ({ className, required, disabled }) => {
|
|
|
2792
2794
|
{
|
|
2793
2795
|
className: twMerge(
|
|
2794
2796
|
className,
|
|
2795
|
-
"relative border-2 w-5 h-5 flex items-center justify-center rounded-
|
|
2797
|
+
"relative border-2 w-5 h-5 flex items-center justify-center rounded-xs hover:border-orange-500 hover:cursor-pointer",
|
|
2796
2798
|
selected ? "bg-orange-500 border-orange-500" : "border-neutral-500 hover:shadow-md hover:shadow-orange-500",
|
|
2797
2799
|
disabled === true && "opacity-50 cursor-not-allowed"
|
|
2798
2800
|
),
|
|
@@ -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,16 +3063,16 @@ 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(
|
|
3054
|
-
"flex items-center justify-center border-2 border-gray-400 rounded-
|
|
3070
|
+
"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",
|
|
3055
3071
|
className,
|
|
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
|
}
|
|
@@ -3153,8 +3177,8 @@ var TextInput = (0, import_react5.forwardRef)(
|
|
|
3153
3177
|
"div",
|
|
3154
3178
|
{
|
|
3155
3179
|
className: twMerge(
|
|
3156
|
-
" py-2 px-4 border-2 rounded-
|
|
3157
|
-
"hover:shadow-md hover:shadow-neutral-500 focus:outline-
|
|
3180
|
+
" py-2 px-4 border-2 rounded-xs box-border flex items-baseline bg-neutral-200",
|
|
3181
|
+
"hover:shadow-md hover:shadow-neutral-500 focus:outline-hidden",
|
|
3158
3182
|
variant === "secondary" && "bg-neutral-800 border-neutral-800 ",
|
|
3159
3183
|
selected === true && "border-2 border-orange-500",
|
|
3160
3184
|
disabled === true && "opacity-50 cursor-not-allowed",
|
|
@@ -3176,8 +3200,8 @@ var TextInput = (0, import_react5.forwardRef)(
|
|
|
3176
3200
|
disabled,
|
|
3177
3201
|
ref,
|
|
3178
3202
|
className: twMerge(
|
|
3179
|
-
"flex items-center justify-center bg-neutral-200 rounded-
|
|
3180
|
-
"focus:outline-
|
|
3203
|
+
"flex items-center justify-center bg-neutral-200 rounded-xs w-full px-1 py-2 text-md",
|
|
3204
|
+
"focus:outline-hidden text-neutral-800",
|
|
3181
3205
|
disabled === true && "cursor-not-allowed",
|
|
3182
3206
|
variant === "secondary" && "bg-neutral-800 text-neutral",
|
|
3183
3207
|
className
|
|
@@ -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,17 +3313,19 @@ 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;
|
|
3299
3325
|
const hasMaxLength = maxLength !== void 0 && maxLength > 0;
|
|
3300
3326
|
const isOverLimit = hasMaxLength && characterCount > maxLength;
|
|
3301
3327
|
const textareaClasses = twMerge(
|
|
3302
|
-
"w-full border-2 rounded-
|
|
3328
|
+
"w-full border-2 rounded-xs focus:outline-hidden transition-all duration-200",
|
|
3303
3329
|
"hover:shadow-md hover:shadow-neutral-500",
|
|
3304
3330
|
sizeStyles[size],
|
|
3305
3331
|
variantStyles[variant],
|
|
@@ -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,52 +3714,50 @@ 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"}
|
|
3703
3734
|
${disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"}
|
|
3704
3735
|
transition-colors duration-300 ease-in-out
|
|
3705
|
-
focus:outline-
|
|
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
|
}
|
|
@@ -3925,8 +3965,24 @@ var Modal = ({
|
|
|
3925
3965
|
type: "button",
|
|
3926
3966
|
"aria-label": "Close modal",
|
|
3927
3967
|
onClick: onClose,
|
|
3928
|
-
className: "p-1 text-gray-400 hover:text-gray-500 focus:outline-
|
|
3929
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3968
|
+
className: "p-1 text-gray-400 hover:text-gray-500 focus:outline-hidden focus:ring-2 focus:ring-blue-500 rounded-full",
|
|
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",
|
|
@@ -4030,7 +4113,7 @@ var Toast = ({
|
|
|
4030
4113
|
),
|
|
4031
4114
|
role: "alert",
|
|
4032
4115
|
children: [
|
|
4033
|
-
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: `
|
|
4116
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: `shrink-0 mr-3 text-${variant}-500`, children: icons[variant] }),
|
|
4034
4117
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex-1", children: [
|
|
4035
4118
|
title && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("h3", { className: "font-medium text-sm", children: title }),
|
|
4036
4119
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "text-sm", children: message })
|
|
@@ -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
|
]
|