@koaris/bloom-ui 1.2.4 → 1.2.6
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 +349 -85
- package/dist/index.d.cts +58 -19
- package/dist/index.d.ts +58 -19
- package/dist/index.mjs +351 -86
- package/package.json +1 -1
- package/tailwind.css +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2831,7 +2831,6 @@ var phoneFormats = {
|
|
|
2831
2831
|
"UK": { countryCode: "+44", format: "$1 $2 $3" },
|
|
2832
2832
|
"DE": { countryCode: "+49", format: "$1 $2 $3" },
|
|
2833
2833
|
"FR": { countryCode: "+33", format: "$1 $2 $3 $4" }
|
|
2834
|
-
// Add more countries as needed
|
|
2835
2834
|
};
|
|
2836
2835
|
var Input = (0, import_react4.forwardRef)(
|
|
2837
2836
|
({
|
|
@@ -3035,6 +3034,8 @@ var Input = (0, import_react4.forwardRef)(
|
|
|
3035
3034
|
return "password";
|
|
3036
3035
|
case "email":
|
|
3037
3036
|
return "email";
|
|
3037
|
+
case "datePicker":
|
|
3038
|
+
return "date";
|
|
3038
3039
|
case "date":
|
|
3039
3040
|
case "cpf":
|
|
3040
3041
|
case "phone":
|
|
@@ -3048,15 +3049,15 @@ var Input = (0, import_react4.forwardRef)(
|
|
|
3048
3049
|
const renderPhonePrefix = () => {
|
|
3049
3050
|
if (type !== "phone") return null;
|
|
3050
3051
|
const format = phoneFormats[countryCode] || phoneFormats["BR"];
|
|
3051
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "absolute left-
|
|
3052
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "absolute left-3 top-1.5 text-gray-500", children: format.countryCode });
|
|
3052
3053
|
};
|
|
3053
3054
|
const inputClasses = twMerge(
|
|
3054
|
-
"flex items-center justify-center border-2 border-
|
|
3055
|
+
"flex items-center justify-center border-2 border-gray-400 rounded-sm w-full px-3 py-1 text-md hover:shadow-md hover:shadow-neutral-500 focus:outline-none transition-all duration-200",
|
|
3055
3056
|
className,
|
|
3056
3057
|
disabled && "opacity-50 cursor-not-allowed",
|
|
3057
3058
|
selected && "border-2 border-orange-500",
|
|
3058
3059
|
validated && isValid && "border-2 border-green-900",
|
|
3059
|
-
error && "border-2 border-red-900",
|
|
3060
|
+
(error || !isValid && inputValue != "") && "border-2 border-red-900",
|
|
3060
3061
|
type === "phone" && "pl-10"
|
|
3061
3062
|
);
|
|
3062
3063
|
const renderPasswordValidation = () => {
|
|
@@ -3195,73 +3196,201 @@ TextInput.displayName = "TextInput";
|
|
|
3195
3196
|
// src/components/TextArea/index.tsx
|
|
3196
3197
|
var import_react6 = require("react");
|
|
3197
3198
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
3198
|
-
var TextArea = (
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
},
|
|
3224
|
-
|
|
3225
|
-
"
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3199
|
+
var TextArea = (0, import_react6.forwardRef)(
|
|
3200
|
+
({
|
|
3201
|
+
className,
|
|
3202
|
+
disabled,
|
|
3203
|
+
placeholder,
|
|
3204
|
+
value,
|
|
3205
|
+
validated,
|
|
3206
|
+
error,
|
|
3207
|
+
required,
|
|
3208
|
+
resize = "vertical",
|
|
3209
|
+
type = "text",
|
|
3210
|
+
onClick,
|
|
3211
|
+
errorMessage,
|
|
3212
|
+
onChange: externalOnChange,
|
|
3213
|
+
label,
|
|
3214
|
+
helperText,
|
|
3215
|
+
id,
|
|
3216
|
+
maxLength,
|
|
3217
|
+
minRows = 3,
|
|
3218
|
+
maxRows = 8,
|
|
3219
|
+
size = "md",
|
|
3220
|
+
variant = "primary",
|
|
3221
|
+
showCount = false,
|
|
3222
|
+
autoGrow = false,
|
|
3223
|
+
...rest
|
|
3224
|
+
}, ref) => {
|
|
3225
|
+
const [selected, setSelected] = (0, import_react6.useState)(false);
|
|
3226
|
+
const [inputValue, setInputValue] = (0, import_react6.useState)(value || "");
|
|
3227
|
+
const [isValid, setIsValid] = (0, import_react6.useState)(true);
|
|
3228
|
+
const [rows, setRows] = (0, import_react6.useState)(minRows);
|
|
3229
|
+
const sizeStyles = {
|
|
3230
|
+
sm: "px-2 py-1 text-sm",
|
|
3231
|
+
md: "px-3 py-2 text-base",
|
|
3232
|
+
lg: "px-4 py-3 text-lg"
|
|
3233
|
+
};
|
|
3234
|
+
const variantStyles = {
|
|
3235
|
+
primary: "border-gray-400 focus:border-orange-500",
|
|
3236
|
+
secondary: "border-neutral-500 bg-neutral-100 focus:border-orange-500",
|
|
3237
|
+
outline: "border-gray-300 bg-transparent focus:border-orange-500"
|
|
3238
|
+
};
|
|
3239
|
+
const resizeStyles = {
|
|
3240
|
+
none: "resize-none",
|
|
3241
|
+
vertical: "resize-y",
|
|
3242
|
+
horizontal: "resize-x",
|
|
3243
|
+
both: "resize"
|
|
3244
|
+
};
|
|
3245
|
+
const handleFocus = () => {
|
|
3246
|
+
setSelected(true);
|
|
3247
|
+
};
|
|
3248
|
+
const handleBlur = () => {
|
|
3249
|
+
setSelected(false);
|
|
3250
|
+
validateInput(inputValue);
|
|
3251
|
+
};
|
|
3252
|
+
const validateInput = (value2) => {
|
|
3253
|
+
if (required && (!value2 || value2.trim().length === 0)) {
|
|
3254
|
+
setIsValid(false);
|
|
3255
|
+
return false;
|
|
3256
|
+
}
|
|
3257
|
+
if (maxLength && value2.length > maxLength) {
|
|
3258
|
+
setIsValid(false);
|
|
3259
|
+
return false;
|
|
3260
|
+
}
|
|
3261
|
+
if (type === "json" && value2.trim().length > 0) {
|
|
3262
|
+
try {
|
|
3263
|
+
JSON.parse(value2);
|
|
3264
|
+
setIsValid(true);
|
|
3265
|
+
return true;
|
|
3266
|
+
} catch (e) {
|
|
3267
|
+
setIsValid(false);
|
|
3268
|
+
return false;
|
|
3269
|
+
}
|
|
3270
|
+
}
|
|
3271
|
+
setIsValid(true);
|
|
3272
|
+
return true;
|
|
3273
|
+
};
|
|
3274
|
+
const handleInput = (event) => {
|
|
3275
|
+
const newValue = event.currentTarget.value;
|
|
3276
|
+
setInputValue(newValue);
|
|
3277
|
+
validateInput(newValue);
|
|
3278
|
+
if (autoGrow) {
|
|
3279
|
+
const textareaLineHeight = 24;
|
|
3280
|
+
const newRows = Math.max(
|
|
3281
|
+
minRows,
|
|
3282
|
+
Math.min(
|
|
3283
|
+
maxRows,
|
|
3284
|
+
Math.floor(event.currentTarget.scrollHeight / textareaLineHeight)
|
|
3285
|
+
)
|
|
3286
|
+
);
|
|
3287
|
+
setRows(newRows);
|
|
3288
|
+
}
|
|
3289
|
+
if (externalOnChange) {
|
|
3290
|
+
externalOnChange(event);
|
|
3291
|
+
}
|
|
3292
|
+
};
|
|
3293
|
+
(0, import_react6.useEffect)(() => {
|
|
3294
|
+
setInputValue(value || "");
|
|
3295
|
+
if (value) {
|
|
3296
|
+
validateInput(value);
|
|
3297
|
+
}
|
|
3298
|
+
}, [value, required, maxLength]);
|
|
3299
|
+
const characterCount = inputValue?.length || 0;
|
|
3300
|
+
const hasMaxLength = maxLength !== void 0 && maxLength > 0;
|
|
3301
|
+
const isOverLimit = hasMaxLength && characterCount > maxLength;
|
|
3302
|
+
const textareaClasses = twMerge(
|
|
3303
|
+
"w-full border-2 rounded-sm focus:outline-none transition-all duration-200",
|
|
3304
|
+
"hover:shadow-md hover:shadow-neutral-500",
|
|
3305
|
+
sizeStyles[size],
|
|
3306
|
+
variantStyles[variant],
|
|
3307
|
+
resizeStyles[resize],
|
|
3308
|
+
disabled && "opacity-50 cursor-not-allowed",
|
|
3309
|
+
selected && "border-orange-500",
|
|
3310
|
+
validated && isValid && "border-green-500",
|
|
3311
|
+
(error || !isValid && inputValue !== "") && "border-red-900",
|
|
3312
|
+
className
|
|
3313
|
+
);
|
|
3314
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "w-full", children: [
|
|
3315
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
3316
|
+
"label",
|
|
3317
|
+
{
|
|
3318
|
+
htmlFor: id,
|
|
3319
|
+
className: "block text-sm font-medium text-gray-700 mb-1",
|
|
3320
|
+
children: [
|
|
3321
|
+
label,
|
|
3322
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-red-500 ml-1", children: "*" })
|
|
3323
|
+
]
|
|
3324
|
+
}
|
|
3238
3325
|
),
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3326
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
3327
|
+
"textarea",
|
|
3328
|
+
{
|
|
3329
|
+
ref,
|
|
3330
|
+
id,
|
|
3331
|
+
rows,
|
|
3332
|
+
disabled,
|
|
3333
|
+
required,
|
|
3334
|
+
className: textareaClasses,
|
|
3335
|
+
onClick,
|
|
3336
|
+
onFocus: handleFocus,
|
|
3337
|
+
onChange: handleInput,
|
|
3338
|
+
onBlur: handleBlur,
|
|
3339
|
+
placeholder,
|
|
3340
|
+
value: inputValue,
|
|
3341
|
+
maxLength: hasMaxLength && !showCount ? maxLength : void 0,
|
|
3342
|
+
"aria-invalid": error || !isValid,
|
|
3343
|
+
"aria-describedby": error || !isValid ? `${id}-error` : helperText ? `${id}-helper` : void 0,
|
|
3344
|
+
...rest
|
|
3345
|
+
}
|
|
3346
|
+
),
|
|
3347
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex justify-between mt-1", children: [
|
|
3348
|
+
(error || !isValid && inputValue !== "") && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { id: `${id}-error`, className: "text-sm text-red-900", role: "alert", children: errorMessage || "This field is invalid." }),
|
|
3349
|
+
helperText && isValid && !error && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { id: `${id}-helper`, className: "text-sm text-gray-500", children: helperText }),
|
|
3350
|
+
showCount && hasMaxLength && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
3351
|
+
"p",
|
|
3352
|
+
{
|
|
3353
|
+
className: `text-sm ml-auto ${isOverLimit ? "text-red-600" : "text-gray-500"}`,
|
|
3354
|
+
children: [
|
|
3355
|
+
characterCount,
|
|
3356
|
+
"/",
|
|
3357
|
+
maxLength
|
|
3358
|
+
]
|
|
3359
|
+
}
|
|
3360
|
+
)
|
|
3361
|
+
] })
|
|
3362
|
+
] });
|
|
3363
|
+
}
|
|
3364
|
+
);
|
|
3365
|
+
TextArea.displayName = "TextArea";
|
|
3249
3366
|
|
|
3250
3367
|
// src/components/Text/index.tsx
|
|
3251
3368
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
3252
3369
|
var Text = ({
|
|
3253
3370
|
children,
|
|
3254
|
-
color = "neutral
|
|
3371
|
+
color = "neutral",
|
|
3372
|
+
colorShade = "800",
|
|
3255
3373
|
size = "md",
|
|
3256
3374
|
tag = "p",
|
|
3375
|
+
weight = "normal",
|
|
3376
|
+
tracking = "normal",
|
|
3377
|
+
leading = "normal",
|
|
3378
|
+
alignment = "left",
|
|
3379
|
+
truncate = false,
|
|
3380
|
+
italic = false,
|
|
3381
|
+
uppercase = false,
|
|
3382
|
+
lowercase = false,
|
|
3383
|
+
capitalize = false,
|
|
3257
3384
|
className,
|
|
3258
3385
|
...rest
|
|
3259
3386
|
}) => {
|
|
3260
3387
|
const fontSize = {
|
|
3261
|
-
xxs: "text-
|
|
3388
|
+
xxs: "text-xs",
|
|
3389
|
+
// fallback to xs since xxs isn't standard in Tailwind
|
|
3262
3390
|
xs: "text-xs",
|
|
3263
3391
|
sm: "text-sm",
|
|
3264
|
-
md: "text-
|
|
3392
|
+
md: "text-base",
|
|
3393
|
+
// fixed from 'text-md' to 'text-base'
|
|
3265
3394
|
lg: "text-lg",
|
|
3266
3395
|
xl: "text-xl",
|
|
3267
3396
|
"2xl": "text-2xl",
|
|
@@ -3273,22 +3402,88 @@ var Text = ({
|
|
|
3273
3402
|
"8xl": "text-8xl",
|
|
3274
3403
|
"9xl": "text-9xl"
|
|
3275
3404
|
}[size];
|
|
3405
|
+
const fontWeight = {
|
|
3406
|
+
thin: "font-thin",
|
|
3407
|
+
extralight: "font-extralight",
|
|
3408
|
+
light: "font-light",
|
|
3409
|
+
normal: "font-normal",
|
|
3410
|
+
medium: "font-medium",
|
|
3411
|
+
semibold: "font-semibold",
|
|
3412
|
+
bold: "font-bold",
|
|
3413
|
+
extrabold: "font-extrabold",
|
|
3414
|
+
black: "font-black"
|
|
3415
|
+
}[weight];
|
|
3416
|
+
const letterTracking = {
|
|
3417
|
+
tighter: "tracking-tighter",
|
|
3418
|
+
tight: "tracking-tight",
|
|
3419
|
+
normal: "tracking-normal",
|
|
3420
|
+
wide: "tracking-wide",
|
|
3421
|
+
wider: "tracking-wider",
|
|
3422
|
+
widest: "tracking-widest"
|
|
3423
|
+
}[tracking];
|
|
3424
|
+
const lineHeight = {
|
|
3425
|
+
none: "leading-none",
|
|
3426
|
+
tight: "leading-tight",
|
|
3427
|
+
snug: "leading-snug",
|
|
3428
|
+
normal: "leading-normal",
|
|
3429
|
+
relaxed: "leading-relaxed",
|
|
3430
|
+
loose: "leading-loose"
|
|
3431
|
+
}[leading];
|
|
3432
|
+
const textAlignment = {
|
|
3433
|
+
left: "text-left",
|
|
3434
|
+
center: "text-center",
|
|
3435
|
+
right: "text-right",
|
|
3436
|
+
justify: "text-justify"
|
|
3437
|
+
}[alignment];
|
|
3438
|
+
const colorClass = `text-${color}-${colorShade}`;
|
|
3439
|
+
const truncateClass = truncate ? "truncate" : "";
|
|
3440
|
+
const italicClass = italic ? "italic" : "";
|
|
3441
|
+
let transformClass = "";
|
|
3442
|
+
if (uppercase) transformClass = "uppercase";
|
|
3443
|
+
else if (lowercase) transformClass = "lowercase";
|
|
3444
|
+
else if (capitalize) transformClass = "capitalize";
|
|
3276
3445
|
const Tag = tag;
|
|
3277
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3446
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3447
|
+
Tag,
|
|
3448
|
+
{
|
|
3449
|
+
className: twMerge(
|
|
3450
|
+
colorClass,
|
|
3451
|
+
fontSize,
|
|
3452
|
+
fontWeight,
|
|
3453
|
+
letterTracking,
|
|
3454
|
+
lineHeight,
|
|
3455
|
+
textAlignment,
|
|
3456
|
+
truncateClass,
|
|
3457
|
+
italicClass,
|
|
3458
|
+
transformClass,
|
|
3459
|
+
className
|
|
3460
|
+
),
|
|
3461
|
+
...rest,
|
|
3462
|
+
children
|
|
3463
|
+
}
|
|
3464
|
+
);
|
|
3278
3465
|
};
|
|
3466
|
+
Text.displayName = "Text";
|
|
3279
3467
|
|
|
3280
3468
|
// src/components/Heading/index.tsx
|
|
3281
3469
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
3282
3470
|
var Heading = ({
|
|
3283
3471
|
children,
|
|
3284
|
-
color = "neutral
|
|
3472
|
+
color = "neutral",
|
|
3473
|
+
colorShade = "800",
|
|
3285
3474
|
size = "lg",
|
|
3286
3475
|
tag = "h2",
|
|
3287
|
-
|
|
3476
|
+
weight = "bold",
|
|
3477
|
+
tracking = "normal",
|
|
3478
|
+
alignment = "left",
|
|
3479
|
+
truncate = false,
|
|
3480
|
+
uppercase = false,
|
|
3481
|
+
className,
|
|
3482
|
+
...rest
|
|
3288
3483
|
}) => {
|
|
3289
3484
|
const fontSize = {
|
|
3290
3485
|
sm: "text-sm",
|
|
3291
|
-
md: "text-
|
|
3486
|
+
md: "text-base",
|
|
3292
3487
|
lg: "text-lg",
|
|
3293
3488
|
xl: "text-xl",
|
|
3294
3489
|
"2xl": "text-2xl",
|
|
@@ -3300,32 +3495,101 @@ var Heading = ({
|
|
|
3300
3495
|
"8xl": "text-8xl",
|
|
3301
3496
|
"9xl": "text-9xl"
|
|
3302
3497
|
}[size];
|
|
3498
|
+
const fontWeight = {
|
|
3499
|
+
normal: "font-normal",
|
|
3500
|
+
medium: "font-medium",
|
|
3501
|
+
semibold: "font-semibold",
|
|
3502
|
+
bold: "font-bold",
|
|
3503
|
+
extrabold: "font-extrabold"
|
|
3504
|
+
}[weight];
|
|
3505
|
+
const letterTracking = {
|
|
3506
|
+
tighter: "tracking-tighter",
|
|
3507
|
+
tight: "tracking-tight",
|
|
3508
|
+
normal: "tracking-normal",
|
|
3509
|
+
wide: "tracking-wide",
|
|
3510
|
+
wider: "tracking-wider",
|
|
3511
|
+
widest: "tracking-widest"
|
|
3512
|
+
}[tracking];
|
|
3513
|
+
const textAlignment = {
|
|
3514
|
+
left: "text-left",
|
|
3515
|
+
center: "text-center",
|
|
3516
|
+
right: "text-right"
|
|
3517
|
+
}[alignment];
|
|
3518
|
+
const colorClass = `text-${color}-${colorShade}`;
|
|
3519
|
+
const truncateClass = truncate ? "truncate" : "";
|
|
3520
|
+
const uppercaseClass = uppercase ? "uppercase" : "";
|
|
3303
3521
|
const Tag = tag;
|
|
3304
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3522
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3523
|
+
Tag,
|
|
3524
|
+
{
|
|
3525
|
+
className: twMerge(
|
|
3526
|
+
colorClass,
|
|
3527
|
+
fontSize,
|
|
3528
|
+
fontWeight,
|
|
3529
|
+
letterTracking,
|
|
3530
|
+
textAlignment,
|
|
3531
|
+
truncateClass,
|
|
3532
|
+
uppercaseClass,
|
|
3533
|
+
className
|
|
3534
|
+
),
|
|
3535
|
+
...rest,
|
|
3536
|
+
children
|
|
3537
|
+
}
|
|
3538
|
+
);
|
|
3305
3539
|
};
|
|
3306
3540
|
|
|
3307
3541
|
// src/components/Box/index.tsx
|
|
3542
|
+
var import_react7 = require("react");
|
|
3308
3543
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
3309
|
-
var Box = ({
|
|
3544
|
+
var Box = (0, import_react7.forwardRef)(({
|
|
3310
3545
|
className,
|
|
3311
3546
|
children,
|
|
3312
3547
|
tag = "div",
|
|
3313
|
-
variant = "secondary"
|
|
3314
|
-
|
|
3548
|
+
variant = "secondary",
|
|
3549
|
+
size = "md",
|
|
3550
|
+
elevated = false,
|
|
3551
|
+
hasBorder = true,
|
|
3552
|
+
isInteractive = false,
|
|
3553
|
+
fullWidth = false,
|
|
3554
|
+
...props
|
|
3555
|
+
}, ref) => {
|
|
3315
3556
|
const Tag = tag;
|
|
3557
|
+
const variantStyles = {
|
|
3558
|
+
primary: "text-neutral-800 bg-neutral-200 border-neutral-300",
|
|
3559
|
+
secondary: "text-neutral-200 bg-neutral-600 border-neutral-800",
|
|
3560
|
+
ghost: "text-neutral-800 bg-transparent border-transparent",
|
|
3561
|
+
outline: "text-neutral-800 bg-transparent border-neutral-300"
|
|
3562
|
+
};
|
|
3563
|
+
const sizeStyles = {
|
|
3564
|
+
sm: "p-3 text-sm",
|
|
3565
|
+
md: "p-6 text-base",
|
|
3566
|
+
lg: "p-8 text-lg",
|
|
3567
|
+
xl: "p-10 text-xl"
|
|
3568
|
+
};
|
|
3569
|
+
const elevationStyles = elevated ? "shadow-md hover:shadow-lg transition-shadow duration-200" : "";
|
|
3570
|
+
const borderStyles = hasBorder ? "border" : "border-0";
|
|
3571
|
+
const interactiveStyles = isInteractive ? "cursor-pointer hover:brightness-105 active:brightness-95 transition-all duration-200" : "";
|
|
3572
|
+
const widthStyles = fullWidth ? "w-full" : "";
|
|
3316
3573
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3317
3574
|
Tag,
|
|
3318
3575
|
{
|
|
3576
|
+
ref,
|
|
3319
3577
|
className: twMerge(
|
|
3320
|
-
"
|
|
3321
|
-
|
|
3322
|
-
|
|
3578
|
+
"rounded-md",
|
|
3579
|
+
borderStyles,
|
|
3580
|
+
sizeStyles[size],
|
|
3581
|
+
variantStyles[variant],
|
|
3582
|
+
elevationStyles,
|
|
3583
|
+
interactiveStyles,
|
|
3584
|
+
widthStyles,
|
|
3323
3585
|
className
|
|
3324
3586
|
),
|
|
3587
|
+
...props,
|
|
3325
3588
|
children
|
|
3326
3589
|
}
|
|
3327
3590
|
);
|
|
3328
|
-
};
|
|
3591
|
+
});
|
|
3592
|
+
Box.displayName = "Box";
|
|
3329
3593
|
|
|
3330
3594
|
// src/components/Form/index.tsx
|
|
3331
3595
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
@@ -3374,7 +3638,7 @@ var Avatar = ({ className, ...rest }) => {
|
|
|
3374
3638
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
3375
3639
|
var MultiStep = ({ className, size, currentStep }) => {
|
|
3376
3640
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "w-full", children: [
|
|
3377
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text, { tag: "label", color: "
|
|
3641
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text, { tag: "label", color: "primary", size: "xs", children: `Passo ${currentStep} de ${size}` }),
|
|
3378
3642
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: `grid gap-2 grid-cols-${size} grid-flow-col mt-1`, children: Array.from(Array(size).keys()).map((_, index) => {
|
|
3379
3643
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3380
3644
|
"div",
|
|
@@ -3597,7 +3861,7 @@ var Loading = ({
|
|
|
3597
3861
|
Loading.displayName = "Loading";
|
|
3598
3862
|
|
|
3599
3863
|
// src/components/Modal/index.tsx
|
|
3600
|
-
var
|
|
3864
|
+
var import_react8 = require("react");
|
|
3601
3865
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3602
3866
|
var Modal = ({
|
|
3603
3867
|
className,
|
|
@@ -3612,10 +3876,10 @@ var Modal = ({
|
|
|
3612
3876
|
footer,
|
|
3613
3877
|
...rest
|
|
3614
3878
|
}) => {
|
|
3615
|
-
const modalRef = (0,
|
|
3616
|
-
const portalRoot = (0,
|
|
3617
|
-
const [mounted, setMounted] = (0,
|
|
3618
|
-
(0,
|
|
3879
|
+
const modalRef = (0, import_react8.useRef)(null);
|
|
3880
|
+
const portalRoot = (0, import_react8.useRef)(null);
|
|
3881
|
+
const [mounted, setMounted] = (0, import_react8.useState)(false);
|
|
3882
|
+
(0, import_react8.useEffect)(() => {
|
|
3619
3883
|
portalRoot.current = document.createElement("div");
|
|
3620
3884
|
portalRoot.current.id = "bloom-ui-portal-root";
|
|
3621
3885
|
document.body.appendChild(portalRoot.current);
|
|
@@ -3625,14 +3889,14 @@ var Modal = ({
|
|
|
3625
3889
|
document.body.style.overflow = "";
|
|
3626
3890
|
};
|
|
3627
3891
|
}, []);
|
|
3628
|
-
(0,
|
|
3892
|
+
(0, import_react8.useEffect)(() => {
|
|
3629
3893
|
if (isOpen) {
|
|
3630
3894
|
document.body.style.overflow = "hidden";
|
|
3631
3895
|
} else {
|
|
3632
3896
|
document.body.style.overflow = "";
|
|
3633
3897
|
}
|
|
3634
3898
|
}, [isOpen]);
|
|
3635
|
-
(0,
|
|
3899
|
+
(0, import_react8.useEffect)(() => {
|
|
3636
3900
|
const handleKeyDown = (e) => {
|
|
3637
3901
|
if (isOpen && closeOnEsc && e.key === "Escape") onClose();
|
|
3638
3902
|
};
|
|
@@ -3693,7 +3957,7 @@ var Modal = ({
|
|
|
3693
3957
|
};
|
|
3694
3958
|
|
|
3695
3959
|
// src/components/Toast/index.tsx
|
|
3696
|
-
var
|
|
3960
|
+
var import_react9 = require("react");
|
|
3697
3961
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3698
3962
|
var ToastService = class _ToastService {
|
|
3699
3963
|
constructor() {
|
|
@@ -3748,13 +4012,13 @@ var Toast = ({
|
|
|
3748
4012
|
onDismiss,
|
|
3749
4013
|
className
|
|
3750
4014
|
}) => {
|
|
3751
|
-
const [isRemoving, setIsRemoving] = (0,
|
|
3752
|
-
const timerRef = (0,
|
|
4015
|
+
const [isRemoving, setIsRemoving] = (0, import_react9.useState)(false);
|
|
4016
|
+
const timerRef = (0, import_react9.useRef)();
|
|
3753
4017
|
const handleDismiss = () => {
|
|
3754
4018
|
setIsRemoving(true);
|
|
3755
4019
|
setTimeout(() => onDismiss?.(id), 300);
|
|
3756
4020
|
};
|
|
3757
|
-
(0,
|
|
4021
|
+
(0, import_react9.useEffect)(() => {
|
|
3758
4022
|
if (duration > 0) {
|
|
3759
4023
|
timerRef.current = window.setTimeout(handleDismiss, duration);
|
|
3760
4024
|
}
|
|
@@ -3806,10 +4070,10 @@ var ToastContainer = ({
|
|
|
3806
4070
|
position = "top-right",
|
|
3807
4071
|
className
|
|
3808
4072
|
}) => {
|
|
3809
|
-
const containerRef = (0,
|
|
3810
|
-
const [isMounted, setIsMounted] = (0,
|
|
3811
|
-
const [toasts, setToasts] = (0,
|
|
3812
|
-
(0,
|
|
4073
|
+
const containerRef = (0, import_react9.useRef)(null);
|
|
4074
|
+
const [isMounted, setIsMounted] = (0, import_react9.useState)(false);
|
|
4075
|
+
const [toasts, setToasts] = (0, import_react9.useState)([]);
|
|
4076
|
+
(0, import_react9.useEffect)(() => {
|
|
3813
4077
|
const container = document.createElement("div");
|
|
3814
4078
|
container.id = "toast-root";
|
|
3815
4079
|
container.className = "fixed z-50 p-4";
|