@koaris/bloom-ui 1.2.5 → 1.3.0
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/LICENSE +21 -0
- package/README.md +4 -1
- package/dist/index.cjs +353 -89
- package/dist/index.d.cts +58 -19
- package/dist/index.d.ts +58 -19
- package/dist/index.mjs +355 -90
- package/package.json +2 -2
- package/tailwind.css +1 -1
- package/LICENSE.md +0 -674
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Koaris
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -28,4 +28,7 @@ import { Text } from '@koaris/bloom-ui'
|
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
## Contributions and bug reports
|
|
31
|
-
You can follow and make contributions in [github](https://github.com/koaris/bloom-ui).
|
|
31
|
+
You can follow and make contributions in [github](https://github.com/koaris/bloom-ui).
|
|
32
|
+
|
|
33
|
+
## License
|
|
34
|
+
Bloom-ui is open source under the [MIT License](LICENSE.md).
|
package/dist/index.cjs
CHANGED
|
@@ -2539,11 +2539,11 @@ var Card = ({
|
|
|
2539
2539
|
"div",
|
|
2540
2540
|
{
|
|
2541
2541
|
className: twMerge(
|
|
2542
|
-
"flex items-center
|
|
2542
|
+
"flex items-center rounded-lg bg-orange-500 text-neutral-100 transition-all duration-200",
|
|
2543
2543
|
direction === "col" ? "flex-col" : "flex-row",
|
|
2544
2544
|
cardSizeClasses[size],
|
|
2545
2545
|
hoverable && !disabled && "hover:shadow-md hover:shadow-neutral-500",
|
|
2546
|
-
selected &&
|
|
2546
|
+
// selected && 'border-2 border-orange-500',
|
|
2547
2547
|
disabled && "opacity-50 cursor-not-allowed",
|
|
2548
2548
|
onClick && !disabled && "cursor-pointer",
|
|
2549
2549
|
className
|
|
@@ -2590,14 +2590,13 @@ var Card = ({
|
|
|
2590
2590
|
direction === "row" && "flex-1"
|
|
2591
2591
|
),
|
|
2592
2592
|
children: [
|
|
2593
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: "text-
|
|
2593
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: "text-md text-left font-bold font-default leading-tight mb-1", children: title }),
|
|
2594
2594
|
content && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: twMerge(
|
|
2595
|
-
"text-
|
|
2596
|
-
direction ===
|
|
2595
|
+
"text-sm text-left"
|
|
2596
|
+
// direction === 'col' ? 'text-left' : 'text-left'
|
|
2597
2597
|
), children: content }),
|
|
2598
2598
|
footer && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: twMerge(
|
|
2599
|
-
"
|
|
2600
|
-
direction === "col" ? "text-center" : "text-left"
|
|
2599
|
+
"pt-2 text-sm border-t border-neutral-300 text-left"
|
|
2601
2600
|
), children: footer })
|
|
2602
2601
|
]
|
|
2603
2602
|
}
|
|
@@ -2648,7 +2647,7 @@ var Button = (0, import_react.forwardRef)(
|
|
|
2648
2647
|
ref,
|
|
2649
2648
|
className: twMerge(
|
|
2650
2649
|
"relative font-medium rounded-sm transition-all duration-200",
|
|
2651
|
-
"focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-opacity-50",
|
|
2650
|
+
"focus:outline-none focus:ring-2 focus:ring-offset-2 rounded-md focus:ring-opacity-50",
|
|
2652
2651
|
variantClasses[variant],
|
|
2653
2652
|
sizeClasses[size],
|
|
2654
2653
|
fullWidth ? "w-full" : "max-w-[180px]",
|
|
@@ -3034,6 +3033,8 @@ var Input = (0, import_react4.forwardRef)(
|
|
|
3034
3033
|
return "password";
|
|
3035
3034
|
case "email":
|
|
3036
3035
|
return "email";
|
|
3036
|
+
case "datePicker":
|
|
3037
|
+
return "date";
|
|
3037
3038
|
case "date":
|
|
3038
3039
|
case "cpf":
|
|
3039
3040
|
case "phone":
|
|
@@ -3194,73 +3195,201 @@ TextInput.displayName = "TextInput";
|
|
|
3194
3195
|
// src/components/TextArea/index.tsx
|
|
3195
3196
|
var import_react6 = require("react");
|
|
3196
3197
|
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
|
-
|
|
3198
|
+
var TextArea = (0, import_react6.forwardRef)(
|
|
3199
|
+
({
|
|
3200
|
+
className,
|
|
3201
|
+
disabled,
|
|
3202
|
+
placeholder,
|
|
3203
|
+
value,
|
|
3204
|
+
validated,
|
|
3205
|
+
error,
|
|
3206
|
+
required,
|
|
3207
|
+
resize = "vertical",
|
|
3208
|
+
type = "text",
|
|
3209
|
+
onClick,
|
|
3210
|
+
errorMessage,
|
|
3211
|
+
onChange: externalOnChange,
|
|
3212
|
+
label,
|
|
3213
|
+
helperText,
|
|
3214
|
+
id,
|
|
3215
|
+
maxLength,
|
|
3216
|
+
minRows = 3,
|
|
3217
|
+
maxRows = 8,
|
|
3218
|
+
size = "md",
|
|
3219
|
+
variant = "primary",
|
|
3220
|
+
showCount = false,
|
|
3221
|
+
autoGrow = false,
|
|
3222
|
+
...rest
|
|
3223
|
+
}, ref) => {
|
|
3224
|
+
const [selected, setSelected] = (0, import_react6.useState)(false);
|
|
3225
|
+
const [inputValue, setInputValue] = (0, import_react6.useState)(value || "");
|
|
3226
|
+
const [isValid, setIsValid] = (0, import_react6.useState)(true);
|
|
3227
|
+
const [rows, setRows] = (0, import_react6.useState)(minRows);
|
|
3228
|
+
const sizeStyles = {
|
|
3229
|
+
sm: "px-2 py-1 text-sm",
|
|
3230
|
+
md: "px-3 py-2 text-base",
|
|
3231
|
+
lg: "px-4 py-3 text-lg"
|
|
3232
|
+
};
|
|
3233
|
+
const variantStyles = {
|
|
3234
|
+
primary: "border-gray-400 focus:border-orange-500",
|
|
3235
|
+
secondary: "border-neutral-500 bg-neutral-100 focus:border-orange-500",
|
|
3236
|
+
outline: "border-gray-300 bg-transparent focus:border-orange-500"
|
|
3237
|
+
};
|
|
3238
|
+
const resizeStyles = {
|
|
3239
|
+
none: "resize-none",
|
|
3240
|
+
vertical: "resize-y",
|
|
3241
|
+
horizontal: "resize-x",
|
|
3242
|
+
both: "resize"
|
|
3243
|
+
};
|
|
3244
|
+
const handleFocus = () => {
|
|
3245
|
+
setSelected(true);
|
|
3246
|
+
};
|
|
3247
|
+
const handleBlur = () => {
|
|
3248
|
+
setSelected(false);
|
|
3249
|
+
validateInput(inputValue);
|
|
3250
|
+
};
|
|
3251
|
+
const validateInput = (value2) => {
|
|
3252
|
+
if (required && (!value2 || value2.trim().length === 0)) {
|
|
3253
|
+
setIsValid(false);
|
|
3254
|
+
return false;
|
|
3255
|
+
}
|
|
3256
|
+
if (maxLength && value2.length > maxLength) {
|
|
3257
|
+
setIsValid(false);
|
|
3258
|
+
return false;
|
|
3259
|
+
}
|
|
3260
|
+
if (type === "json" && value2.trim().length > 0) {
|
|
3261
|
+
try {
|
|
3262
|
+
JSON.parse(value2);
|
|
3263
|
+
setIsValid(true);
|
|
3264
|
+
return true;
|
|
3265
|
+
} catch (e) {
|
|
3266
|
+
setIsValid(false);
|
|
3267
|
+
return false;
|
|
3268
|
+
}
|
|
3269
|
+
}
|
|
3270
|
+
setIsValid(true);
|
|
3271
|
+
return true;
|
|
3272
|
+
};
|
|
3273
|
+
const handleInput = (event) => {
|
|
3274
|
+
const newValue = event.currentTarget.value;
|
|
3275
|
+
setInputValue(newValue);
|
|
3276
|
+
validateInput(newValue);
|
|
3277
|
+
if (autoGrow) {
|
|
3278
|
+
const textareaLineHeight = 24;
|
|
3279
|
+
const newRows = Math.max(
|
|
3280
|
+
minRows,
|
|
3281
|
+
Math.min(
|
|
3282
|
+
maxRows,
|
|
3283
|
+
Math.floor(event.currentTarget.scrollHeight / textareaLineHeight)
|
|
3284
|
+
)
|
|
3285
|
+
);
|
|
3286
|
+
setRows(newRows);
|
|
3287
|
+
}
|
|
3288
|
+
if (externalOnChange) {
|
|
3289
|
+
externalOnChange(event);
|
|
3290
|
+
}
|
|
3291
|
+
};
|
|
3292
|
+
(0, import_react6.useEffect)(() => {
|
|
3293
|
+
setInputValue(value || "");
|
|
3294
|
+
if (value) {
|
|
3295
|
+
validateInput(value);
|
|
3296
|
+
}
|
|
3297
|
+
}, [value, required, maxLength]);
|
|
3298
|
+
const characterCount = inputValue?.length || 0;
|
|
3299
|
+
const hasMaxLength = maxLength !== void 0 && maxLength > 0;
|
|
3300
|
+
const isOverLimit = hasMaxLength && characterCount > maxLength;
|
|
3301
|
+
const textareaClasses = twMerge(
|
|
3302
|
+
"w-full border-2 rounded-sm focus:outline-none transition-all duration-200",
|
|
3303
|
+
"hover:shadow-md hover:shadow-neutral-500",
|
|
3304
|
+
sizeStyles[size],
|
|
3305
|
+
variantStyles[variant],
|
|
3306
|
+
resizeStyles[resize],
|
|
3307
|
+
disabled && "opacity-50 cursor-not-allowed",
|
|
3308
|
+
selected && "border-orange-500",
|
|
3309
|
+
validated && isValid && "border-green-500",
|
|
3310
|
+
(error || !isValid && inputValue !== "") && "border-red-900",
|
|
3311
|
+
className
|
|
3312
|
+
);
|
|
3313
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "w-full", children: [
|
|
3314
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
3315
|
+
"label",
|
|
3316
|
+
{
|
|
3317
|
+
htmlFor: id,
|
|
3318
|
+
className: "block text-sm font-medium text-gray-700 mb-1",
|
|
3319
|
+
children: [
|
|
3320
|
+
label,
|
|
3321
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-red-500 ml-1", children: "*" })
|
|
3322
|
+
]
|
|
3323
|
+
}
|
|
3237
3324
|
),
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3325
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
3326
|
+
"textarea",
|
|
3327
|
+
{
|
|
3328
|
+
ref,
|
|
3329
|
+
id,
|
|
3330
|
+
rows,
|
|
3331
|
+
disabled,
|
|
3332
|
+
required,
|
|
3333
|
+
className: textareaClasses,
|
|
3334
|
+
onClick,
|
|
3335
|
+
onFocus: handleFocus,
|
|
3336
|
+
onChange: handleInput,
|
|
3337
|
+
onBlur: handleBlur,
|
|
3338
|
+
placeholder,
|
|
3339
|
+
value: inputValue,
|
|
3340
|
+
maxLength: hasMaxLength && !showCount ? maxLength : void 0,
|
|
3341
|
+
"aria-invalid": error || !isValid,
|
|
3342
|
+
"aria-describedby": error || !isValid ? `${id}-error` : helperText ? `${id}-helper` : void 0,
|
|
3343
|
+
...rest
|
|
3344
|
+
}
|
|
3345
|
+
),
|
|
3346
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex justify-between mt-1", children: [
|
|
3347
|
+
(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." }),
|
|
3348
|
+
helperText && isValid && !error && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { id: `${id}-helper`, className: "text-sm text-gray-500", children: helperText }),
|
|
3349
|
+
showCount && hasMaxLength && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
3350
|
+
"p",
|
|
3351
|
+
{
|
|
3352
|
+
className: `text-sm ml-auto ${isOverLimit ? "text-red-600" : "text-gray-500"}`,
|
|
3353
|
+
children: [
|
|
3354
|
+
characterCount,
|
|
3355
|
+
"/",
|
|
3356
|
+
maxLength
|
|
3357
|
+
]
|
|
3358
|
+
}
|
|
3359
|
+
)
|
|
3360
|
+
] })
|
|
3361
|
+
] });
|
|
3362
|
+
}
|
|
3363
|
+
);
|
|
3364
|
+
TextArea.displayName = "TextArea";
|
|
3248
3365
|
|
|
3249
3366
|
// src/components/Text/index.tsx
|
|
3250
3367
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
3251
3368
|
var Text = ({
|
|
3252
3369
|
children,
|
|
3253
|
-
color = "neutral
|
|
3370
|
+
color = "neutral",
|
|
3371
|
+
colorShade = "800",
|
|
3254
3372
|
size = "md",
|
|
3255
3373
|
tag = "p",
|
|
3374
|
+
weight = "normal",
|
|
3375
|
+
tracking = "normal",
|
|
3376
|
+
leading = "normal",
|
|
3377
|
+
alignment = "left",
|
|
3378
|
+
truncate = false,
|
|
3379
|
+
italic = false,
|
|
3380
|
+
uppercase = false,
|
|
3381
|
+
lowercase = false,
|
|
3382
|
+
capitalize = false,
|
|
3256
3383
|
className,
|
|
3257
3384
|
...rest
|
|
3258
3385
|
}) => {
|
|
3259
3386
|
const fontSize = {
|
|
3260
|
-
xxs: "text-
|
|
3387
|
+
xxs: "text-xs",
|
|
3388
|
+
// fallback to xs since xxs isn't standard in Tailwind
|
|
3261
3389
|
xs: "text-xs",
|
|
3262
3390
|
sm: "text-sm",
|
|
3263
|
-
md: "text-
|
|
3391
|
+
md: "text-base",
|
|
3392
|
+
// fixed from 'text-md' to 'text-base'
|
|
3264
3393
|
lg: "text-lg",
|
|
3265
3394
|
xl: "text-xl",
|
|
3266
3395
|
"2xl": "text-2xl",
|
|
@@ -3272,22 +3401,88 @@ var Text = ({
|
|
|
3272
3401
|
"8xl": "text-8xl",
|
|
3273
3402
|
"9xl": "text-9xl"
|
|
3274
3403
|
}[size];
|
|
3404
|
+
const fontWeight = {
|
|
3405
|
+
thin: "font-thin",
|
|
3406
|
+
extralight: "font-extralight",
|
|
3407
|
+
light: "font-light",
|
|
3408
|
+
normal: "font-normal",
|
|
3409
|
+
medium: "font-medium",
|
|
3410
|
+
semibold: "font-semibold",
|
|
3411
|
+
bold: "font-bold",
|
|
3412
|
+
extrabold: "font-extrabold",
|
|
3413
|
+
black: "font-black"
|
|
3414
|
+
}[weight];
|
|
3415
|
+
const letterTracking = {
|
|
3416
|
+
tighter: "tracking-tighter",
|
|
3417
|
+
tight: "tracking-tight",
|
|
3418
|
+
normal: "tracking-normal",
|
|
3419
|
+
wide: "tracking-wide",
|
|
3420
|
+
wider: "tracking-wider",
|
|
3421
|
+
widest: "tracking-widest"
|
|
3422
|
+
}[tracking];
|
|
3423
|
+
const lineHeight = {
|
|
3424
|
+
none: "leading-none",
|
|
3425
|
+
tight: "leading-tight",
|
|
3426
|
+
snug: "leading-snug",
|
|
3427
|
+
normal: "leading-normal",
|
|
3428
|
+
relaxed: "leading-relaxed",
|
|
3429
|
+
loose: "leading-loose"
|
|
3430
|
+
}[leading];
|
|
3431
|
+
const textAlignment = {
|
|
3432
|
+
left: "text-left",
|
|
3433
|
+
center: "text-center",
|
|
3434
|
+
right: "text-right",
|
|
3435
|
+
justify: "text-justify"
|
|
3436
|
+
}[alignment];
|
|
3437
|
+
const colorClass = `text-${color}-${colorShade}`;
|
|
3438
|
+
const truncateClass = truncate ? "truncate" : "";
|
|
3439
|
+
const italicClass = italic ? "italic" : "";
|
|
3440
|
+
let transformClass = "";
|
|
3441
|
+
if (uppercase) transformClass = "uppercase";
|
|
3442
|
+
else if (lowercase) transformClass = "lowercase";
|
|
3443
|
+
else if (capitalize) transformClass = "capitalize";
|
|
3275
3444
|
const Tag = tag;
|
|
3276
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3445
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
3446
|
+
Tag,
|
|
3447
|
+
{
|
|
3448
|
+
className: twMerge(
|
|
3449
|
+
colorClass,
|
|
3450
|
+
fontSize,
|
|
3451
|
+
fontWeight,
|
|
3452
|
+
letterTracking,
|
|
3453
|
+
lineHeight,
|
|
3454
|
+
textAlignment,
|
|
3455
|
+
truncateClass,
|
|
3456
|
+
italicClass,
|
|
3457
|
+
transformClass,
|
|
3458
|
+
className
|
|
3459
|
+
),
|
|
3460
|
+
...rest,
|
|
3461
|
+
children
|
|
3462
|
+
}
|
|
3463
|
+
);
|
|
3277
3464
|
};
|
|
3465
|
+
Text.displayName = "Text";
|
|
3278
3466
|
|
|
3279
3467
|
// src/components/Heading/index.tsx
|
|
3280
3468
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
3281
3469
|
var Heading = ({
|
|
3282
3470
|
children,
|
|
3283
|
-
color = "neutral
|
|
3471
|
+
color = "neutral",
|
|
3472
|
+
colorShade = "800",
|
|
3284
3473
|
size = "lg",
|
|
3285
3474
|
tag = "h2",
|
|
3286
|
-
|
|
3475
|
+
weight = "bold",
|
|
3476
|
+
tracking = "normal",
|
|
3477
|
+
alignment = "left",
|
|
3478
|
+
truncate = false,
|
|
3479
|
+
uppercase = false,
|
|
3480
|
+
className,
|
|
3481
|
+
...rest
|
|
3287
3482
|
}) => {
|
|
3288
3483
|
const fontSize = {
|
|
3289
3484
|
sm: "text-sm",
|
|
3290
|
-
md: "text-
|
|
3485
|
+
md: "text-base",
|
|
3291
3486
|
lg: "text-lg",
|
|
3292
3487
|
xl: "text-xl",
|
|
3293
3488
|
"2xl": "text-2xl",
|
|
@@ -3299,32 +3494,101 @@ var Heading = ({
|
|
|
3299
3494
|
"8xl": "text-8xl",
|
|
3300
3495
|
"9xl": "text-9xl"
|
|
3301
3496
|
}[size];
|
|
3497
|
+
const fontWeight = {
|
|
3498
|
+
normal: "font-normal",
|
|
3499
|
+
medium: "font-medium",
|
|
3500
|
+
semibold: "font-semibold",
|
|
3501
|
+
bold: "font-bold",
|
|
3502
|
+
extrabold: "font-extrabold"
|
|
3503
|
+
}[weight];
|
|
3504
|
+
const letterTracking = {
|
|
3505
|
+
tighter: "tracking-tighter",
|
|
3506
|
+
tight: "tracking-tight",
|
|
3507
|
+
normal: "tracking-normal",
|
|
3508
|
+
wide: "tracking-wide",
|
|
3509
|
+
wider: "tracking-wider",
|
|
3510
|
+
widest: "tracking-widest"
|
|
3511
|
+
}[tracking];
|
|
3512
|
+
const textAlignment = {
|
|
3513
|
+
left: "text-left",
|
|
3514
|
+
center: "text-center",
|
|
3515
|
+
right: "text-right"
|
|
3516
|
+
}[alignment];
|
|
3517
|
+
const colorClass = `text-${color}-${colorShade}`;
|
|
3518
|
+
const truncateClass = truncate ? "truncate" : "";
|
|
3519
|
+
const uppercaseClass = uppercase ? "uppercase" : "";
|
|
3302
3520
|
const Tag = tag;
|
|
3303
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3521
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
3522
|
+
Tag,
|
|
3523
|
+
{
|
|
3524
|
+
className: twMerge(
|
|
3525
|
+
colorClass,
|
|
3526
|
+
fontSize,
|
|
3527
|
+
fontWeight,
|
|
3528
|
+
letterTracking,
|
|
3529
|
+
textAlignment,
|
|
3530
|
+
truncateClass,
|
|
3531
|
+
uppercaseClass,
|
|
3532
|
+
className
|
|
3533
|
+
),
|
|
3534
|
+
...rest,
|
|
3535
|
+
children
|
|
3536
|
+
}
|
|
3537
|
+
);
|
|
3304
3538
|
};
|
|
3305
3539
|
|
|
3306
3540
|
// src/components/Box/index.tsx
|
|
3541
|
+
var import_react7 = require("react");
|
|
3307
3542
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
3308
|
-
var Box = ({
|
|
3543
|
+
var Box = (0, import_react7.forwardRef)(({
|
|
3309
3544
|
className,
|
|
3310
3545
|
children,
|
|
3311
3546
|
tag = "div",
|
|
3312
|
-
variant = "secondary"
|
|
3313
|
-
|
|
3547
|
+
variant = "secondary",
|
|
3548
|
+
size = "md",
|
|
3549
|
+
elevated = false,
|
|
3550
|
+
hasBorder = true,
|
|
3551
|
+
isInteractive = false,
|
|
3552
|
+
fullWidth = false,
|
|
3553
|
+
...props
|
|
3554
|
+
}, ref) => {
|
|
3314
3555
|
const Tag = tag;
|
|
3556
|
+
const variantStyles = {
|
|
3557
|
+
primary: "text-neutral-800 bg-neutral-200 border-neutral-300",
|
|
3558
|
+
secondary: "text-neutral-200 bg-neutral-600 border-neutral-800",
|
|
3559
|
+
ghost: "text-neutral-800 bg-transparent border-transparent",
|
|
3560
|
+
outline: "text-neutral-800 bg-transparent border-neutral-300"
|
|
3561
|
+
};
|
|
3562
|
+
const sizeStyles = {
|
|
3563
|
+
sm: "p-3 text-sm",
|
|
3564
|
+
md: "p-6 text-base",
|
|
3565
|
+
lg: "p-8 text-lg",
|
|
3566
|
+
xl: "p-10 text-xl"
|
|
3567
|
+
};
|
|
3568
|
+
const elevationStyles = elevated ? "shadow-md hover:shadow-lg transition-shadow duration-200" : "";
|
|
3569
|
+
const borderStyles = hasBorder ? "border" : "border-0";
|
|
3570
|
+
const interactiveStyles = isInteractive ? "cursor-pointer hover:brightness-105 active:brightness-95 transition-all duration-200" : "";
|
|
3571
|
+
const widthStyles = fullWidth ? "w-full" : "";
|
|
3315
3572
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3316
3573
|
Tag,
|
|
3317
3574
|
{
|
|
3575
|
+
ref,
|
|
3318
3576
|
className: twMerge(
|
|
3319
|
-
"
|
|
3320
|
-
|
|
3321
|
-
|
|
3577
|
+
"rounded-md",
|
|
3578
|
+
borderStyles,
|
|
3579
|
+
sizeStyles[size],
|
|
3580
|
+
variantStyles[variant],
|
|
3581
|
+
elevationStyles,
|
|
3582
|
+
interactiveStyles,
|
|
3583
|
+
widthStyles,
|
|
3322
3584
|
className
|
|
3323
3585
|
),
|
|
3586
|
+
...props,
|
|
3324
3587
|
children
|
|
3325
3588
|
}
|
|
3326
3589
|
);
|
|
3327
|
-
};
|
|
3590
|
+
});
|
|
3591
|
+
Box.displayName = "Box";
|
|
3328
3592
|
|
|
3329
3593
|
// src/components/Form/index.tsx
|
|
3330
3594
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
@@ -3373,7 +3637,7 @@ var Avatar = ({ className, ...rest }) => {
|
|
|
3373
3637
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
3374
3638
|
var MultiStep = ({ className, size, currentStep }) => {
|
|
3375
3639
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "w-full", children: [
|
|
3376
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text, { tag: "label", color: "
|
|
3640
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text, { tag: "label", color: "primary", size: "xs", children: `Passo ${currentStep} de ${size}` }),
|
|
3377
3641
|
/* @__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
3642
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
3379
3643
|
"div",
|
|
@@ -3596,7 +3860,7 @@ var Loading = ({
|
|
|
3596
3860
|
Loading.displayName = "Loading";
|
|
3597
3861
|
|
|
3598
3862
|
// src/components/Modal/index.tsx
|
|
3599
|
-
var
|
|
3863
|
+
var import_react8 = require("react");
|
|
3600
3864
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3601
3865
|
var Modal = ({
|
|
3602
3866
|
className,
|
|
@@ -3611,10 +3875,10 @@ var Modal = ({
|
|
|
3611
3875
|
footer,
|
|
3612
3876
|
...rest
|
|
3613
3877
|
}) => {
|
|
3614
|
-
const modalRef = (0,
|
|
3615
|
-
const portalRoot = (0,
|
|
3616
|
-
const [mounted, setMounted] = (0,
|
|
3617
|
-
(0,
|
|
3878
|
+
const modalRef = (0, import_react8.useRef)(null);
|
|
3879
|
+
const portalRoot = (0, import_react8.useRef)(null);
|
|
3880
|
+
const [mounted, setMounted] = (0, import_react8.useState)(false);
|
|
3881
|
+
(0, import_react8.useEffect)(() => {
|
|
3618
3882
|
portalRoot.current = document.createElement("div");
|
|
3619
3883
|
portalRoot.current.id = "bloom-ui-portal-root";
|
|
3620
3884
|
document.body.appendChild(portalRoot.current);
|
|
@@ -3624,14 +3888,14 @@ var Modal = ({
|
|
|
3624
3888
|
document.body.style.overflow = "";
|
|
3625
3889
|
};
|
|
3626
3890
|
}, []);
|
|
3627
|
-
(0,
|
|
3891
|
+
(0, import_react8.useEffect)(() => {
|
|
3628
3892
|
if (isOpen) {
|
|
3629
3893
|
document.body.style.overflow = "hidden";
|
|
3630
3894
|
} else {
|
|
3631
3895
|
document.body.style.overflow = "";
|
|
3632
3896
|
}
|
|
3633
3897
|
}, [isOpen]);
|
|
3634
|
-
(0,
|
|
3898
|
+
(0, import_react8.useEffect)(() => {
|
|
3635
3899
|
const handleKeyDown = (e) => {
|
|
3636
3900
|
if (isOpen && closeOnEsc && e.key === "Escape") onClose();
|
|
3637
3901
|
};
|
|
@@ -3692,7 +3956,7 @@ var Modal = ({
|
|
|
3692
3956
|
};
|
|
3693
3957
|
|
|
3694
3958
|
// src/components/Toast/index.tsx
|
|
3695
|
-
var
|
|
3959
|
+
var import_react9 = require("react");
|
|
3696
3960
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
3697
3961
|
var ToastService = class _ToastService {
|
|
3698
3962
|
constructor() {
|
|
@@ -3747,13 +4011,13 @@ var Toast = ({
|
|
|
3747
4011
|
onDismiss,
|
|
3748
4012
|
className
|
|
3749
4013
|
}) => {
|
|
3750
|
-
const [isRemoving, setIsRemoving] = (0,
|
|
3751
|
-
const timerRef = (0,
|
|
4014
|
+
const [isRemoving, setIsRemoving] = (0, import_react9.useState)(false);
|
|
4015
|
+
const timerRef = (0, import_react9.useRef)();
|
|
3752
4016
|
const handleDismiss = () => {
|
|
3753
4017
|
setIsRemoving(true);
|
|
3754
4018
|
setTimeout(() => onDismiss?.(id), 300);
|
|
3755
4019
|
};
|
|
3756
|
-
(0,
|
|
4020
|
+
(0, import_react9.useEffect)(() => {
|
|
3757
4021
|
if (duration > 0) {
|
|
3758
4022
|
timerRef.current = window.setTimeout(handleDismiss, duration);
|
|
3759
4023
|
}
|
|
@@ -3805,10 +4069,10 @@ var ToastContainer = ({
|
|
|
3805
4069
|
position = "top-right",
|
|
3806
4070
|
className
|
|
3807
4071
|
}) => {
|
|
3808
|
-
const containerRef = (0,
|
|
3809
|
-
const [isMounted, setIsMounted] = (0,
|
|
3810
|
-
const [toasts, setToasts] = (0,
|
|
3811
|
-
(0,
|
|
4072
|
+
const containerRef = (0, import_react9.useRef)(null);
|
|
4073
|
+
const [isMounted, setIsMounted] = (0, import_react9.useState)(false);
|
|
4074
|
+
const [toasts, setToasts] = (0, import_react9.useState)([]);
|
|
4075
|
+
(0, import_react9.useEffect)(() => {
|
|
3812
4076
|
const container = document.createElement("div");
|
|
3813
4077
|
container.id = "toast-root";
|
|
3814
4078
|
container.className = "fixed z-50 p-4";
|