@koaris/bloom-ui 1.2.5 → 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 +346 -81
- package/dist/index.d.cts +58 -19
- package/dist/index.d.ts +58 -19
- package/dist/index.mjs +348 -82
- package/package.json +1 -1
- package/tailwind.css +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3034,6 +3034,8 @@ var Input = (0, import_react4.forwardRef)(
|
|
|
3034
3034
|
return "password";
|
|
3035
3035
|
case "email":
|
|
3036
3036
|
return "email";
|
|
3037
|
+
case "datePicker":
|
|
3038
|
+
return "date";
|
|
3037
3039
|
case "date":
|
|
3038
3040
|
case "cpf":
|
|
3039
3041
|
case "phone":
|
|
@@ -3194,73 +3196,201 @@ TextInput.displayName = "TextInput";
|
|
|
3194
3196
|
// src/components/TextArea/index.tsx
|
|
3195
3197
|
var import_react6 = require("react");
|
|
3196
3198
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
3197
|
-
var TextArea = (
|
|
3198
|
-
|
|
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
|
-
|
|
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
|
+
}
|
|
3237
3325
|
),
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
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";
|
|
3248
3366
|
|
|
3249
3367
|
// src/components/Text/index.tsx
|
|
3250
3368
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
3251
3369
|
var Text = ({
|
|
3252
3370
|
children,
|
|
3253
|
-
color = "neutral
|
|
3371
|
+
color = "neutral",
|
|
3372
|
+
colorShade = "800",
|
|
3254
3373
|
size = "md",
|
|
3255
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,
|
|
3256
3384
|
className,
|
|
3257
3385
|
...rest
|
|
3258
3386
|
}) => {
|
|
3259
3387
|
const fontSize = {
|
|
3260
|
-
xxs: "text-
|
|
3388
|
+
xxs: "text-xs",
|
|
3389
|
+
// fallback to xs since xxs isn't standard in Tailwind
|
|
3261
3390
|
xs: "text-xs",
|
|
3262
3391
|
sm: "text-sm",
|
|
3263
|
-
md: "text-
|
|
3392
|
+
md: "text-base",
|
|
3393
|
+
// fixed from 'text-md' to 'text-base'
|
|
3264
3394
|
lg: "text-lg",
|
|
3265
3395
|
xl: "text-xl",
|
|
3266
3396
|
"2xl": "text-2xl",
|
|
@@ -3272,22 +3402,88 @@ var Text = ({
|
|
|
3272
3402
|
"8xl": "text-8xl",
|
|
3273
3403
|
"9xl": "text-9xl"
|
|
3274
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";
|
|
3275
3445
|
const Tag = tag;
|
|
3276
|
-
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
|
+
);
|
|
3277
3465
|
};
|
|
3466
|
+
Text.displayName = "Text";
|
|
3278
3467
|
|
|
3279
3468
|
// src/components/Heading/index.tsx
|
|
3280
3469
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
3281
3470
|
var Heading = ({
|
|
3282
3471
|
children,
|
|
3283
|
-
color = "neutral
|
|
3472
|
+
color = "neutral",
|
|
3473
|
+
colorShade = "800",
|
|
3284
3474
|
size = "lg",
|
|
3285
3475
|
tag = "h2",
|
|
3286
|
-
|
|
3476
|
+
weight = "bold",
|
|
3477
|
+
tracking = "normal",
|
|
3478
|
+
alignment = "left",
|
|
3479
|
+
truncate = false,
|
|
3480
|
+
uppercase = false,
|
|
3481
|
+
className,
|
|
3482
|
+
...rest
|
|
3287
3483
|
}) => {
|
|
3288
3484
|
const fontSize = {
|
|
3289
3485
|
sm: "text-sm",
|
|
3290
|
-
md: "text-
|
|
3486
|
+
md: "text-base",
|
|
3291
3487
|
lg: "text-lg",
|
|
3292
3488
|
xl: "text-xl",
|
|
3293
3489
|
"2xl": "text-2xl",
|
|
@@ -3299,32 +3495,101 @@ var Heading = ({
|
|
|
3299
3495
|
"8xl": "text-8xl",
|
|
3300
3496
|
"9xl": "text-9xl"
|
|
3301
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" : "";
|
|
3302
3521
|
const Tag = tag;
|
|
3303
|
-
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
|
+
);
|
|
3304
3539
|
};
|
|
3305
3540
|
|
|
3306
3541
|
// src/components/Box/index.tsx
|
|
3542
|
+
var import_react7 = require("react");
|
|
3307
3543
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
3308
|
-
var Box = ({
|
|
3544
|
+
var Box = (0, import_react7.forwardRef)(({
|
|
3309
3545
|
className,
|
|
3310
3546
|
children,
|
|
3311
3547
|
tag = "div",
|
|
3312
|
-
variant = "secondary"
|
|
3313
|
-
|
|
3548
|
+
variant = "secondary",
|
|
3549
|
+
size = "md",
|
|
3550
|
+
elevated = false,
|
|
3551
|
+
hasBorder = true,
|
|
3552
|
+
isInteractive = false,
|
|
3553
|
+
fullWidth = false,
|
|
3554
|
+
...props
|
|
3555
|
+
}, ref) => {
|
|
3314
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" : "";
|
|
3315
3573
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3316
3574
|
Tag,
|
|
3317
3575
|
{
|
|
3576
|
+
ref,
|
|
3318
3577
|
className: twMerge(
|
|
3319
|
-
"
|
|
3320
|
-
|
|
3321
|
-
|
|
3578
|
+
"rounded-md",
|
|
3579
|
+
borderStyles,
|
|
3580
|
+
sizeStyles[size],
|
|
3581
|
+
variantStyles[variant],
|
|
3582
|
+
elevationStyles,
|
|
3583
|
+
interactiveStyles,
|
|
3584
|
+
widthStyles,
|
|
3322
3585
|
className
|
|
3323
3586
|
),
|
|
3587
|
+
...props,
|
|
3324
3588
|
children
|
|
3325
3589
|
}
|
|
3326
3590
|
);
|
|
3327
|
-
};
|
|
3591
|
+
});
|
|
3592
|
+
Box.displayName = "Box";
|
|
3328
3593
|
|
|
3329
3594
|
// src/components/Form/index.tsx
|
|
3330
3595
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
@@ -3373,7 +3638,7 @@ var Avatar = ({ className, ...rest }) => {
|
|
|
3373
3638
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
3374
3639
|
var MultiStep = ({ className, size, currentStep }) => {
|
|
3375
3640
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "w-full", children: [
|
|
3376
|
-
/* @__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}` }),
|
|
3377
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) => {
|
|
3378
3643
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3379
3644
|
"div",
|
|
@@ -3596,7 +3861,7 @@ var Loading = ({
|
|
|
3596
3861
|
Loading.displayName = "Loading";
|
|
3597
3862
|
|
|
3598
3863
|
// src/components/Modal/index.tsx
|
|
3599
|
-
var
|
|
3864
|
+
var import_react8 = require("react");
|
|
3600
3865
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3601
3866
|
var Modal = ({
|
|
3602
3867
|
className,
|
|
@@ -3611,10 +3876,10 @@ var Modal = ({
|
|
|
3611
3876
|
footer,
|
|
3612
3877
|
...rest
|
|
3613
3878
|
}) => {
|
|
3614
|
-
const modalRef = (0,
|
|
3615
|
-
const portalRoot = (0,
|
|
3616
|
-
const [mounted, setMounted] = (0,
|
|
3617
|
-
(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)(() => {
|
|
3618
3883
|
portalRoot.current = document.createElement("div");
|
|
3619
3884
|
portalRoot.current.id = "bloom-ui-portal-root";
|
|
3620
3885
|
document.body.appendChild(portalRoot.current);
|
|
@@ -3624,14 +3889,14 @@ var Modal = ({
|
|
|
3624
3889
|
document.body.style.overflow = "";
|
|
3625
3890
|
};
|
|
3626
3891
|
}, []);
|
|
3627
|
-
(0,
|
|
3892
|
+
(0, import_react8.useEffect)(() => {
|
|
3628
3893
|
if (isOpen) {
|
|
3629
3894
|
document.body.style.overflow = "hidden";
|
|
3630
3895
|
} else {
|
|
3631
3896
|
document.body.style.overflow = "";
|
|
3632
3897
|
}
|
|
3633
3898
|
}, [isOpen]);
|
|
3634
|
-
(0,
|
|
3899
|
+
(0, import_react8.useEffect)(() => {
|
|
3635
3900
|
const handleKeyDown = (e) => {
|
|
3636
3901
|
if (isOpen && closeOnEsc && e.key === "Escape") onClose();
|
|
3637
3902
|
};
|
|
@@ -3692,7 +3957,7 @@ var Modal = ({
|
|
|
3692
3957
|
};
|
|
3693
3958
|
|
|
3694
3959
|
// src/components/Toast/index.tsx
|
|
3695
|
-
var
|
|
3960
|
+
var import_react9 = require("react");
|
|
3696
3961
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3697
3962
|
var ToastService = class _ToastService {
|
|
3698
3963
|
constructor() {
|
|
@@ -3747,13 +4012,13 @@ var Toast = ({
|
|
|
3747
4012
|
onDismiss,
|
|
3748
4013
|
className
|
|
3749
4014
|
}) => {
|
|
3750
|
-
const [isRemoving, setIsRemoving] = (0,
|
|
3751
|
-
const timerRef = (0,
|
|
4015
|
+
const [isRemoving, setIsRemoving] = (0, import_react9.useState)(false);
|
|
4016
|
+
const timerRef = (0, import_react9.useRef)();
|
|
3752
4017
|
const handleDismiss = () => {
|
|
3753
4018
|
setIsRemoving(true);
|
|
3754
4019
|
setTimeout(() => onDismiss?.(id), 300);
|
|
3755
4020
|
};
|
|
3756
|
-
(0,
|
|
4021
|
+
(0, import_react9.useEffect)(() => {
|
|
3757
4022
|
if (duration > 0) {
|
|
3758
4023
|
timerRef.current = window.setTimeout(handleDismiss, duration);
|
|
3759
4024
|
}
|
|
@@ -3805,10 +4070,10 @@ var ToastContainer = ({
|
|
|
3805
4070
|
position = "top-right",
|
|
3806
4071
|
className
|
|
3807
4072
|
}) => {
|
|
3808
|
-
const containerRef = (0,
|
|
3809
|
-
const [isMounted, setIsMounted] = (0,
|
|
3810
|
-
const [toasts, setToasts] = (0,
|
|
3811
|
-
(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)(() => {
|
|
3812
4077
|
const container = document.createElement("div");
|
|
3813
4078
|
container.id = "toast-root";
|
|
3814
4079
|
container.className = "fixed z-50 p-4";
|
package/dist/index.d.cts
CHANGED
|
@@ -66,7 +66,7 @@ interface CheckboxProps extends DetailedHTMLProps<HTMLAttributes<HTMLDivElement>
|
|
|
66
66
|
}
|
|
67
67
|
declare const Checkbox: ({ className, required, disabled }: CheckboxProps) => react_jsx_runtime.JSX.Element;
|
|
68
68
|
|
|
69
|
-
type InputType = 'text' | 'password' | 'date' | 'cpf' | 'phone' | 'cnpj' | 'cep' | 'email';
|
|
69
|
+
type InputType = 'text' | 'password' | 'date' | 'datePicker' | 'cpf' | 'phone' | 'cnpj' | 'cep' | 'email';
|
|
70
70
|
interface PasswordValidation {
|
|
71
71
|
hasEightCharacters: boolean;
|
|
72
72
|
hasSpecialCharacters: boolean;
|
|
@@ -105,42 +105,81 @@ interface TextInputProps extends DetailedHTMLProps<InputHTMLAttributes<HTMLInput
|
|
|
105
105
|
}
|
|
106
106
|
declare const TextInput: react.ForwardRefExoticComponent<Omit<TextInputProps, "ref"> & react.RefAttributes<HTMLInputElement>>;
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
type TextAreaSize = 'sm' | 'md' | 'lg';
|
|
109
|
+
type TextAreaVariant = 'primary' | 'secondary' | 'outline';
|
|
110
|
+
type TextAreaType = 'text' | 'markdown' | 'code' | 'json';
|
|
111
|
+
interface TextAreaProps extends Omit<DetailedHTMLProps<TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, 'type'> {
|
|
109
112
|
disabled?: boolean;
|
|
110
|
-
reference?: React.RefObject<HTMLTextAreaElement>;
|
|
111
113
|
placeholder?: string;
|
|
112
114
|
value?: string;
|
|
113
115
|
validated?: boolean;
|
|
114
|
-
error
|
|
116
|
+
error?: boolean;
|
|
115
117
|
required?: boolean;
|
|
116
|
-
resize?:
|
|
117
|
-
type
|
|
118
|
+
resize?: 'none' | 'vertical' | 'horizontal' | 'both';
|
|
119
|
+
type?: TextAreaType;
|
|
120
|
+
errorMessage?: string;
|
|
121
|
+
onChange?: (event: ChangeEvent<HTMLTextAreaElement>) => void;
|
|
122
|
+
label?: string;
|
|
123
|
+
helperText?: string;
|
|
124
|
+
maxLength?: number;
|
|
125
|
+
minRows?: number;
|
|
126
|
+
maxRows?: number;
|
|
127
|
+
size?: TextAreaSize;
|
|
128
|
+
variant?: TextAreaVariant;
|
|
129
|
+
showCount?: boolean;
|
|
130
|
+
autoGrow?: boolean;
|
|
118
131
|
}
|
|
119
|
-
declare const TextArea:
|
|
132
|
+
declare const TextArea: react.ForwardRefExoticComponent<Omit<TextAreaProps, "ref"> & react.RefAttributes<HTMLTextAreaElement>>;
|
|
120
133
|
|
|
121
|
-
interface TextProps extends DetailedHTMLProps<HTMLAttributes<
|
|
134
|
+
interface TextProps extends DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement> {
|
|
122
135
|
children: ReactNode;
|
|
123
|
-
color?:
|
|
136
|
+
color?: 'primary' | 'secondary' | 'accent' | 'neutral' | 'success' | 'warning' | 'error' | 'info';
|
|
137
|
+
colorShade?: '50' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
|
|
124
138
|
size?: 'xxs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl' | '7xl' | '8xl' | '9xl';
|
|
125
|
-
tag?: 'p' | 'strong' | '
|
|
139
|
+
tag?: 'p' | 'span' | 'label' | 'strong' | 'em' | 'small' | 'div';
|
|
140
|
+
weight?: 'thin' | 'extralight' | 'light' | 'normal' | 'medium' | 'semibold' | 'bold' | 'extrabold' | 'black';
|
|
141
|
+
tracking?: 'tighter' | 'tight' | 'normal' | 'wide' | 'wider' | 'widest';
|
|
142
|
+
leading?: 'none' | 'tight' | 'snug' | 'normal' | 'relaxed' | 'loose';
|
|
143
|
+
alignment?: 'left' | 'center' | 'right' | 'justify';
|
|
144
|
+
truncate?: boolean;
|
|
145
|
+
italic?: boolean;
|
|
146
|
+
uppercase?: boolean;
|
|
147
|
+
lowercase?: boolean;
|
|
148
|
+
capitalize?: boolean;
|
|
126
149
|
htmlFor?: string;
|
|
127
150
|
}
|
|
128
|
-
declare const Text:
|
|
151
|
+
declare const Text: {
|
|
152
|
+
({ children, color, colorShade, size, tag, weight, tracking, leading, alignment, truncate, italic, uppercase, lowercase, capitalize, className, ...rest }: TextProps): react_jsx_runtime.JSX.Element;
|
|
153
|
+
displayName: string;
|
|
154
|
+
};
|
|
129
155
|
|
|
130
|
-
interface HeadingProps extends DetailedHTMLProps<HTMLAttributes<
|
|
156
|
+
interface HeadingProps extends DetailedHTMLProps<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement> {
|
|
131
157
|
children: React.ReactNode;
|
|
132
|
-
color?:
|
|
158
|
+
color?: 'primary' | 'secondary' | 'accent' | 'neutral' | 'success' | 'warning' | 'error' | 'info';
|
|
159
|
+
colorShade?: '50' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900';
|
|
133
160
|
size?: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl' | '7xl' | '8xl' | '9xl';
|
|
134
|
-
tag?: 'h1' | 'h2' | 'h3' | 'h4';
|
|
161
|
+
tag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
162
|
+
weight?: 'normal' | 'medium' | 'semibold' | 'bold' | 'extrabold';
|
|
163
|
+
tracking?: 'tighter' | 'tight' | 'normal' | 'wide' | 'wider' | 'widest';
|
|
164
|
+
alignment?: 'left' | 'center' | 'right';
|
|
165
|
+
truncate?: boolean;
|
|
166
|
+
uppercase?: boolean;
|
|
135
167
|
}
|
|
136
|
-
declare const Heading: ({ children, color, size, tag, className, }: HeadingProps) => react_jsx_runtime.JSX.Element;
|
|
168
|
+
declare const Heading: ({ children, color, colorShade, size, tag, weight, tracking, alignment, truncate, uppercase, className, ...rest }: HeadingProps) => react_jsx_runtime.JSX.Element;
|
|
137
169
|
|
|
170
|
+
type BoxVariant = 'primary' | 'secondary' | 'ghost' | 'outline';
|
|
171
|
+
type BoxSize = 'sm' | 'md' | 'lg' | 'xl';
|
|
138
172
|
interface BoxProps extends DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
|
|
139
173
|
children: React.ReactNode;
|
|
140
|
-
tag?: 'div' | 'section' | 'article' | 'aside' | 'header' | 'footer';
|
|
141
|
-
variant?:
|
|
174
|
+
tag?: 'div' | 'section' | 'article' | 'aside' | 'header' | 'footer' | 'main' | 'nav';
|
|
175
|
+
variant?: BoxVariant;
|
|
176
|
+
size?: BoxSize;
|
|
177
|
+
elevated?: boolean;
|
|
178
|
+
hasBorder?: boolean;
|
|
179
|
+
isInteractive?: boolean;
|
|
180
|
+
fullWidth?: boolean;
|
|
142
181
|
}
|
|
143
|
-
declare const Box:
|
|
182
|
+
declare const Box: react.ForwardRefExoticComponent<Omit<BoxProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
144
183
|
|
|
145
184
|
interface FormProps extends DetailedHTMLProps<FormHTMLAttributes<HTMLFormElement>, HTMLFormElement> {
|
|
146
185
|
children: React.ReactNode;
|
|
@@ -251,4 +290,4 @@ declare const ToastProvider: react__default.FC<{
|
|
|
251
290
|
children: react__default.ReactNode;
|
|
252
291
|
}>;
|
|
253
292
|
|
|
254
|
-
export { Avatar, type AvatarProps, Box, type BoxProps, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, type CardDirection, type CardProps, type CardSize, Checkbox, type CheckboxProps, Form, type FormProps, Heading, type HeadingProps, Input, type InputProps, type InputType, Link, type LinkProps, Loading, type LoadingColor, type LoadingProps, type LoadingSize, Modal, type ModalProps, MultiStep, type MultiStepProps, type PasswordValidation, type PhoneFormat, RadioGroup, type RadioGroupProps, Skeleton, type SkeletonProps, Text, TextArea, type TextAreaProps, TextInput, type TextInputProps, type TextProps, Toast, ToastContainer, type ToastContainerProps, type ToastPosition, type ToastProps, ToastProvider, type ToastVariant, Toggle, type ToggleProps, toastService, useToast };
|
|
293
|
+
export { Avatar, type AvatarProps, Box, type BoxProps, type BoxSize, type BoxVariant, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, type CardDirection, type CardProps, type CardSize, Checkbox, type CheckboxProps, Form, type FormProps, Heading, type HeadingProps, Input, type InputProps, type InputType, Link, type LinkProps, Loading, type LoadingColor, type LoadingProps, type LoadingSize, Modal, type ModalProps, MultiStep, type MultiStepProps, type PasswordValidation, type PhoneFormat, RadioGroup, type RadioGroupProps, Skeleton, type SkeletonProps, Text, TextArea, type TextAreaProps, type TextAreaSize, type TextAreaType, type TextAreaVariant, TextInput, type TextInputProps, type TextProps, Toast, ToastContainer, type ToastContainerProps, type ToastPosition, type ToastProps, ToastProvider, type ToastVariant, Toggle, type ToggleProps, toastService, useToast };
|