@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/dist/index.mjs
CHANGED
|
@@ -2491,11 +2491,11 @@ var Card = ({
|
|
|
2491
2491
|
"div",
|
|
2492
2492
|
{
|
|
2493
2493
|
className: twMerge(
|
|
2494
|
-
"flex items-center
|
|
2494
|
+
"flex items-center rounded-lg bg-orange-500 text-neutral-100 transition-all duration-200",
|
|
2495
2495
|
direction === "col" ? "flex-col" : "flex-row",
|
|
2496
2496
|
cardSizeClasses[size],
|
|
2497
2497
|
hoverable && !disabled && "hover:shadow-md hover:shadow-neutral-500",
|
|
2498
|
-
selected &&
|
|
2498
|
+
// selected && 'border-2 border-orange-500',
|
|
2499
2499
|
disabled && "opacity-50 cursor-not-allowed",
|
|
2500
2500
|
onClick && !disabled && "cursor-pointer",
|
|
2501
2501
|
className
|
|
@@ -2542,14 +2542,13 @@ var Card = ({
|
|
|
2542
2542
|
direction === "row" && "flex-1"
|
|
2543
2543
|
),
|
|
2544
2544
|
children: [
|
|
2545
|
-
title && /* @__PURE__ */ jsx("h3", { className: "text-
|
|
2545
|
+
title && /* @__PURE__ */ jsx("h3", { className: "text-md text-left font-bold font-default leading-tight mb-1", children: title }),
|
|
2546
2546
|
content && /* @__PURE__ */ jsx("div", { className: twMerge(
|
|
2547
|
-
"text-
|
|
2548
|
-
direction ===
|
|
2547
|
+
"text-sm text-left"
|
|
2548
|
+
// direction === 'col' ? 'text-left' : 'text-left'
|
|
2549
2549
|
), children: content }),
|
|
2550
2550
|
footer && /* @__PURE__ */ jsx("div", { className: twMerge(
|
|
2551
|
-
"
|
|
2552
|
-
direction === "col" ? "text-center" : "text-left"
|
|
2551
|
+
"pt-2 text-sm border-t border-neutral-300 text-left"
|
|
2553
2552
|
), children: footer })
|
|
2554
2553
|
]
|
|
2555
2554
|
}
|
|
@@ -2600,7 +2599,7 @@ var Button = forwardRef(
|
|
|
2600
2599
|
ref,
|
|
2601
2600
|
className: twMerge(
|
|
2602
2601
|
"relative font-medium rounded-sm transition-all duration-200",
|
|
2603
|
-
"focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-opacity-50",
|
|
2602
|
+
"focus:outline-none focus:ring-2 focus:ring-offset-2 rounded-md focus:ring-opacity-50",
|
|
2604
2603
|
variantClasses[variant],
|
|
2605
2604
|
sizeClasses[size],
|
|
2606
2605
|
fullWidth ? "w-full" : "max-w-[180px]",
|
|
@@ -2990,6 +2989,8 @@ var Input = forwardRef2(
|
|
|
2990
2989
|
return "password";
|
|
2991
2990
|
case "email":
|
|
2992
2991
|
return "email";
|
|
2992
|
+
case "datePicker":
|
|
2993
|
+
return "date";
|
|
2993
2994
|
case "date":
|
|
2994
2995
|
case "cpf":
|
|
2995
2996
|
case "phone":
|
|
@@ -3154,76 +3155,205 @@ TextInput.displayName = "TextInput";
|
|
|
3154
3155
|
// src/components/TextArea/index.tsx
|
|
3155
3156
|
import {
|
|
3156
3157
|
useEffect as useEffect3,
|
|
3157
|
-
useState as useState5
|
|
3158
|
+
useState as useState5,
|
|
3159
|
+
forwardRef as forwardRef4
|
|
3158
3160
|
} from "react";
|
|
3159
|
-
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
3160
|
-
var TextArea = (
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
},
|
|
3186
|
-
|
|
3187
|
-
"
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3161
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3162
|
+
var TextArea = forwardRef4(
|
|
3163
|
+
({
|
|
3164
|
+
className,
|
|
3165
|
+
disabled,
|
|
3166
|
+
placeholder,
|
|
3167
|
+
value,
|
|
3168
|
+
validated,
|
|
3169
|
+
error,
|
|
3170
|
+
required,
|
|
3171
|
+
resize = "vertical",
|
|
3172
|
+
type = "text",
|
|
3173
|
+
onClick,
|
|
3174
|
+
errorMessage,
|
|
3175
|
+
onChange: externalOnChange,
|
|
3176
|
+
label,
|
|
3177
|
+
helperText,
|
|
3178
|
+
id,
|
|
3179
|
+
maxLength,
|
|
3180
|
+
minRows = 3,
|
|
3181
|
+
maxRows = 8,
|
|
3182
|
+
size = "md",
|
|
3183
|
+
variant = "primary",
|
|
3184
|
+
showCount = false,
|
|
3185
|
+
autoGrow = false,
|
|
3186
|
+
...rest
|
|
3187
|
+
}, ref) => {
|
|
3188
|
+
const [selected, setSelected] = useState5(false);
|
|
3189
|
+
const [inputValue, setInputValue] = useState5(value || "");
|
|
3190
|
+
const [isValid, setIsValid] = useState5(true);
|
|
3191
|
+
const [rows, setRows] = useState5(minRows);
|
|
3192
|
+
const sizeStyles = {
|
|
3193
|
+
sm: "px-2 py-1 text-sm",
|
|
3194
|
+
md: "px-3 py-2 text-base",
|
|
3195
|
+
lg: "px-4 py-3 text-lg"
|
|
3196
|
+
};
|
|
3197
|
+
const variantStyles = {
|
|
3198
|
+
primary: "border-gray-400 focus:border-orange-500",
|
|
3199
|
+
secondary: "border-neutral-500 bg-neutral-100 focus:border-orange-500",
|
|
3200
|
+
outline: "border-gray-300 bg-transparent focus:border-orange-500"
|
|
3201
|
+
};
|
|
3202
|
+
const resizeStyles = {
|
|
3203
|
+
none: "resize-none",
|
|
3204
|
+
vertical: "resize-y",
|
|
3205
|
+
horizontal: "resize-x",
|
|
3206
|
+
both: "resize"
|
|
3207
|
+
};
|
|
3208
|
+
const handleFocus = () => {
|
|
3209
|
+
setSelected(true);
|
|
3210
|
+
};
|
|
3211
|
+
const handleBlur = () => {
|
|
3212
|
+
setSelected(false);
|
|
3213
|
+
validateInput(inputValue);
|
|
3214
|
+
};
|
|
3215
|
+
const validateInput = (value2) => {
|
|
3216
|
+
if (required && (!value2 || value2.trim().length === 0)) {
|
|
3217
|
+
setIsValid(false);
|
|
3218
|
+
return false;
|
|
3219
|
+
}
|
|
3220
|
+
if (maxLength && value2.length > maxLength) {
|
|
3221
|
+
setIsValid(false);
|
|
3222
|
+
return false;
|
|
3223
|
+
}
|
|
3224
|
+
if (type === "json" && value2.trim().length > 0) {
|
|
3225
|
+
try {
|
|
3226
|
+
JSON.parse(value2);
|
|
3227
|
+
setIsValid(true);
|
|
3228
|
+
return true;
|
|
3229
|
+
} catch (e) {
|
|
3230
|
+
setIsValid(false);
|
|
3231
|
+
return false;
|
|
3232
|
+
}
|
|
3233
|
+
}
|
|
3234
|
+
setIsValid(true);
|
|
3235
|
+
return true;
|
|
3236
|
+
};
|
|
3237
|
+
const handleInput = (event) => {
|
|
3238
|
+
const newValue = event.currentTarget.value;
|
|
3239
|
+
setInputValue(newValue);
|
|
3240
|
+
validateInput(newValue);
|
|
3241
|
+
if (autoGrow) {
|
|
3242
|
+
const textareaLineHeight = 24;
|
|
3243
|
+
const newRows = Math.max(
|
|
3244
|
+
minRows,
|
|
3245
|
+
Math.min(
|
|
3246
|
+
maxRows,
|
|
3247
|
+
Math.floor(event.currentTarget.scrollHeight / textareaLineHeight)
|
|
3248
|
+
)
|
|
3249
|
+
);
|
|
3250
|
+
setRows(newRows);
|
|
3251
|
+
}
|
|
3252
|
+
if (externalOnChange) {
|
|
3253
|
+
externalOnChange(event);
|
|
3254
|
+
}
|
|
3255
|
+
};
|
|
3256
|
+
useEffect3(() => {
|
|
3257
|
+
setInputValue(value || "");
|
|
3258
|
+
if (value) {
|
|
3259
|
+
validateInput(value);
|
|
3260
|
+
}
|
|
3261
|
+
}, [value, required, maxLength]);
|
|
3262
|
+
const characterCount = inputValue?.length || 0;
|
|
3263
|
+
const hasMaxLength = maxLength !== void 0 && maxLength > 0;
|
|
3264
|
+
const isOverLimit = hasMaxLength && characterCount > maxLength;
|
|
3265
|
+
const textareaClasses = twMerge(
|
|
3266
|
+
"w-full border-2 rounded-sm focus:outline-none transition-all duration-200",
|
|
3267
|
+
"hover:shadow-md hover:shadow-neutral-500",
|
|
3268
|
+
sizeStyles[size],
|
|
3269
|
+
variantStyles[variant],
|
|
3270
|
+
resizeStyles[resize],
|
|
3271
|
+
disabled && "opacity-50 cursor-not-allowed",
|
|
3272
|
+
selected && "border-orange-500",
|
|
3273
|
+
validated && isValid && "border-green-500",
|
|
3274
|
+
(error || !isValid && inputValue !== "") && "border-red-900",
|
|
3275
|
+
className
|
|
3276
|
+
);
|
|
3277
|
+
return /* @__PURE__ */ jsxs7("div", { className: "w-full", children: [
|
|
3278
|
+
label && /* @__PURE__ */ jsxs7(
|
|
3279
|
+
"label",
|
|
3280
|
+
{
|
|
3281
|
+
htmlFor: id,
|
|
3282
|
+
className: "block text-sm font-medium text-gray-700 mb-1",
|
|
3283
|
+
children: [
|
|
3284
|
+
label,
|
|
3285
|
+
required && /* @__PURE__ */ jsx8("span", { className: "text-red-500 ml-1", children: "*" })
|
|
3286
|
+
]
|
|
3287
|
+
}
|
|
3200
3288
|
),
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3289
|
+
/* @__PURE__ */ jsx8(
|
|
3290
|
+
"textarea",
|
|
3291
|
+
{
|
|
3292
|
+
ref,
|
|
3293
|
+
id,
|
|
3294
|
+
rows,
|
|
3295
|
+
disabled,
|
|
3296
|
+
required,
|
|
3297
|
+
className: textareaClasses,
|
|
3298
|
+
onClick,
|
|
3299
|
+
onFocus: handleFocus,
|
|
3300
|
+
onChange: handleInput,
|
|
3301
|
+
onBlur: handleBlur,
|
|
3302
|
+
placeholder,
|
|
3303
|
+
value: inputValue,
|
|
3304
|
+
maxLength: hasMaxLength && !showCount ? maxLength : void 0,
|
|
3305
|
+
"aria-invalid": error || !isValid,
|
|
3306
|
+
"aria-describedby": error || !isValid ? `${id}-error` : helperText ? `${id}-helper` : void 0,
|
|
3307
|
+
...rest
|
|
3308
|
+
}
|
|
3309
|
+
),
|
|
3310
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex justify-between mt-1", children: [
|
|
3311
|
+
(error || !isValid && inputValue !== "") && /* @__PURE__ */ jsx8("p", { id: `${id}-error`, className: "text-sm text-red-900", role: "alert", children: errorMessage || "This field is invalid." }),
|
|
3312
|
+
helperText && isValid && !error && /* @__PURE__ */ jsx8("p", { id: `${id}-helper`, className: "text-sm text-gray-500", children: helperText }),
|
|
3313
|
+
showCount && hasMaxLength && /* @__PURE__ */ jsxs7(
|
|
3314
|
+
"p",
|
|
3315
|
+
{
|
|
3316
|
+
className: `text-sm ml-auto ${isOverLimit ? "text-red-600" : "text-gray-500"}`,
|
|
3317
|
+
children: [
|
|
3318
|
+
characterCount,
|
|
3319
|
+
"/",
|
|
3320
|
+
maxLength
|
|
3321
|
+
]
|
|
3322
|
+
}
|
|
3323
|
+
)
|
|
3324
|
+
] })
|
|
3325
|
+
] });
|
|
3326
|
+
}
|
|
3327
|
+
);
|
|
3328
|
+
TextArea.displayName = "TextArea";
|
|
3211
3329
|
|
|
3212
3330
|
// src/components/Text/index.tsx
|
|
3213
3331
|
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
3214
3332
|
var Text = ({
|
|
3215
3333
|
children,
|
|
3216
|
-
color = "neutral
|
|
3334
|
+
color = "neutral",
|
|
3335
|
+
colorShade = "800",
|
|
3217
3336
|
size = "md",
|
|
3218
3337
|
tag = "p",
|
|
3338
|
+
weight = "normal",
|
|
3339
|
+
tracking = "normal",
|
|
3340
|
+
leading = "normal",
|
|
3341
|
+
alignment = "left",
|
|
3342
|
+
truncate = false,
|
|
3343
|
+
italic = false,
|
|
3344
|
+
uppercase = false,
|
|
3345
|
+
lowercase = false,
|
|
3346
|
+
capitalize = false,
|
|
3219
3347
|
className,
|
|
3220
3348
|
...rest
|
|
3221
3349
|
}) => {
|
|
3222
3350
|
const fontSize = {
|
|
3223
|
-
xxs: "text-
|
|
3351
|
+
xxs: "text-xs",
|
|
3352
|
+
// fallback to xs since xxs isn't standard in Tailwind
|
|
3224
3353
|
xs: "text-xs",
|
|
3225
3354
|
sm: "text-sm",
|
|
3226
|
-
md: "text-
|
|
3355
|
+
md: "text-base",
|
|
3356
|
+
// fixed from 'text-md' to 'text-base'
|
|
3227
3357
|
lg: "text-lg",
|
|
3228
3358
|
xl: "text-xl",
|
|
3229
3359
|
"2xl": "text-2xl",
|
|
@@ -3235,22 +3365,88 @@ var Text = ({
|
|
|
3235
3365
|
"8xl": "text-8xl",
|
|
3236
3366
|
"9xl": "text-9xl"
|
|
3237
3367
|
}[size];
|
|
3368
|
+
const fontWeight = {
|
|
3369
|
+
thin: "font-thin",
|
|
3370
|
+
extralight: "font-extralight",
|
|
3371
|
+
light: "font-light",
|
|
3372
|
+
normal: "font-normal",
|
|
3373
|
+
medium: "font-medium",
|
|
3374
|
+
semibold: "font-semibold",
|
|
3375
|
+
bold: "font-bold",
|
|
3376
|
+
extrabold: "font-extrabold",
|
|
3377
|
+
black: "font-black"
|
|
3378
|
+
}[weight];
|
|
3379
|
+
const letterTracking = {
|
|
3380
|
+
tighter: "tracking-tighter",
|
|
3381
|
+
tight: "tracking-tight",
|
|
3382
|
+
normal: "tracking-normal",
|
|
3383
|
+
wide: "tracking-wide",
|
|
3384
|
+
wider: "tracking-wider",
|
|
3385
|
+
widest: "tracking-widest"
|
|
3386
|
+
}[tracking];
|
|
3387
|
+
const lineHeight = {
|
|
3388
|
+
none: "leading-none",
|
|
3389
|
+
tight: "leading-tight",
|
|
3390
|
+
snug: "leading-snug",
|
|
3391
|
+
normal: "leading-normal",
|
|
3392
|
+
relaxed: "leading-relaxed",
|
|
3393
|
+
loose: "leading-loose"
|
|
3394
|
+
}[leading];
|
|
3395
|
+
const textAlignment = {
|
|
3396
|
+
left: "text-left",
|
|
3397
|
+
center: "text-center",
|
|
3398
|
+
right: "text-right",
|
|
3399
|
+
justify: "text-justify"
|
|
3400
|
+
}[alignment];
|
|
3401
|
+
const colorClass = `text-${color}-${colorShade}`;
|
|
3402
|
+
const truncateClass = truncate ? "truncate" : "";
|
|
3403
|
+
const italicClass = italic ? "italic" : "";
|
|
3404
|
+
let transformClass = "";
|
|
3405
|
+
if (uppercase) transformClass = "uppercase";
|
|
3406
|
+
else if (lowercase) transformClass = "lowercase";
|
|
3407
|
+
else if (capitalize) transformClass = "capitalize";
|
|
3238
3408
|
const Tag = tag;
|
|
3239
|
-
return /* @__PURE__ */ jsx9(
|
|
3409
|
+
return /* @__PURE__ */ jsx9(
|
|
3410
|
+
Tag,
|
|
3411
|
+
{
|
|
3412
|
+
className: twMerge(
|
|
3413
|
+
colorClass,
|
|
3414
|
+
fontSize,
|
|
3415
|
+
fontWeight,
|
|
3416
|
+
letterTracking,
|
|
3417
|
+
lineHeight,
|
|
3418
|
+
textAlignment,
|
|
3419
|
+
truncateClass,
|
|
3420
|
+
italicClass,
|
|
3421
|
+
transformClass,
|
|
3422
|
+
className
|
|
3423
|
+
),
|
|
3424
|
+
...rest,
|
|
3425
|
+
children
|
|
3426
|
+
}
|
|
3427
|
+
);
|
|
3240
3428
|
};
|
|
3429
|
+
Text.displayName = "Text";
|
|
3241
3430
|
|
|
3242
3431
|
// src/components/Heading/index.tsx
|
|
3243
3432
|
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
3244
3433
|
var Heading = ({
|
|
3245
3434
|
children,
|
|
3246
|
-
color = "neutral
|
|
3435
|
+
color = "neutral",
|
|
3436
|
+
colorShade = "800",
|
|
3247
3437
|
size = "lg",
|
|
3248
3438
|
tag = "h2",
|
|
3249
|
-
|
|
3439
|
+
weight = "bold",
|
|
3440
|
+
tracking = "normal",
|
|
3441
|
+
alignment = "left",
|
|
3442
|
+
truncate = false,
|
|
3443
|
+
uppercase = false,
|
|
3444
|
+
className,
|
|
3445
|
+
...rest
|
|
3250
3446
|
}) => {
|
|
3251
3447
|
const fontSize = {
|
|
3252
3448
|
sm: "text-sm",
|
|
3253
|
-
md: "text-
|
|
3449
|
+
md: "text-base",
|
|
3254
3450
|
lg: "text-lg",
|
|
3255
3451
|
xl: "text-xl",
|
|
3256
3452
|
"2xl": "text-2xl",
|
|
@@ -3262,32 +3458,101 @@ var Heading = ({
|
|
|
3262
3458
|
"8xl": "text-8xl",
|
|
3263
3459
|
"9xl": "text-9xl"
|
|
3264
3460
|
}[size];
|
|
3461
|
+
const fontWeight = {
|
|
3462
|
+
normal: "font-normal",
|
|
3463
|
+
medium: "font-medium",
|
|
3464
|
+
semibold: "font-semibold",
|
|
3465
|
+
bold: "font-bold",
|
|
3466
|
+
extrabold: "font-extrabold"
|
|
3467
|
+
}[weight];
|
|
3468
|
+
const letterTracking = {
|
|
3469
|
+
tighter: "tracking-tighter",
|
|
3470
|
+
tight: "tracking-tight",
|
|
3471
|
+
normal: "tracking-normal",
|
|
3472
|
+
wide: "tracking-wide",
|
|
3473
|
+
wider: "tracking-wider",
|
|
3474
|
+
widest: "tracking-widest"
|
|
3475
|
+
}[tracking];
|
|
3476
|
+
const textAlignment = {
|
|
3477
|
+
left: "text-left",
|
|
3478
|
+
center: "text-center",
|
|
3479
|
+
right: "text-right"
|
|
3480
|
+
}[alignment];
|
|
3481
|
+
const colorClass = `text-${color}-${colorShade}`;
|
|
3482
|
+
const truncateClass = truncate ? "truncate" : "";
|
|
3483
|
+
const uppercaseClass = uppercase ? "uppercase" : "";
|
|
3265
3484
|
const Tag = tag;
|
|
3266
|
-
return /* @__PURE__ */ jsx10(
|
|
3485
|
+
return /* @__PURE__ */ jsx10(
|
|
3486
|
+
Tag,
|
|
3487
|
+
{
|
|
3488
|
+
className: twMerge(
|
|
3489
|
+
colorClass,
|
|
3490
|
+
fontSize,
|
|
3491
|
+
fontWeight,
|
|
3492
|
+
letterTracking,
|
|
3493
|
+
textAlignment,
|
|
3494
|
+
truncateClass,
|
|
3495
|
+
uppercaseClass,
|
|
3496
|
+
className
|
|
3497
|
+
),
|
|
3498
|
+
...rest,
|
|
3499
|
+
children
|
|
3500
|
+
}
|
|
3501
|
+
);
|
|
3267
3502
|
};
|
|
3268
3503
|
|
|
3269
3504
|
// src/components/Box/index.tsx
|
|
3505
|
+
import { forwardRef as forwardRef5 } from "react";
|
|
3270
3506
|
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
3271
|
-
var Box = ({
|
|
3507
|
+
var Box = forwardRef5(({
|
|
3272
3508
|
className,
|
|
3273
3509
|
children,
|
|
3274
3510
|
tag = "div",
|
|
3275
|
-
variant = "secondary"
|
|
3276
|
-
|
|
3511
|
+
variant = "secondary",
|
|
3512
|
+
size = "md",
|
|
3513
|
+
elevated = false,
|
|
3514
|
+
hasBorder = true,
|
|
3515
|
+
isInteractive = false,
|
|
3516
|
+
fullWidth = false,
|
|
3517
|
+
...props
|
|
3518
|
+
}, ref) => {
|
|
3277
3519
|
const Tag = tag;
|
|
3520
|
+
const variantStyles = {
|
|
3521
|
+
primary: "text-neutral-800 bg-neutral-200 border-neutral-300",
|
|
3522
|
+
secondary: "text-neutral-200 bg-neutral-600 border-neutral-800",
|
|
3523
|
+
ghost: "text-neutral-800 bg-transparent border-transparent",
|
|
3524
|
+
outline: "text-neutral-800 bg-transparent border-neutral-300"
|
|
3525
|
+
};
|
|
3526
|
+
const sizeStyles = {
|
|
3527
|
+
sm: "p-3 text-sm",
|
|
3528
|
+
md: "p-6 text-base",
|
|
3529
|
+
lg: "p-8 text-lg",
|
|
3530
|
+
xl: "p-10 text-xl"
|
|
3531
|
+
};
|
|
3532
|
+
const elevationStyles = elevated ? "shadow-md hover:shadow-lg transition-shadow duration-200" : "";
|
|
3533
|
+
const borderStyles = hasBorder ? "border" : "border-0";
|
|
3534
|
+
const interactiveStyles = isInteractive ? "cursor-pointer hover:brightness-105 active:brightness-95 transition-all duration-200" : "";
|
|
3535
|
+
const widthStyles = fullWidth ? "w-full" : "";
|
|
3278
3536
|
return /* @__PURE__ */ jsx11(
|
|
3279
3537
|
Tag,
|
|
3280
3538
|
{
|
|
3539
|
+
ref,
|
|
3281
3540
|
className: twMerge(
|
|
3282
|
-
"
|
|
3283
|
-
|
|
3284
|
-
|
|
3541
|
+
"rounded-md",
|
|
3542
|
+
borderStyles,
|
|
3543
|
+
sizeStyles[size],
|
|
3544
|
+
variantStyles[variant],
|
|
3545
|
+
elevationStyles,
|
|
3546
|
+
interactiveStyles,
|
|
3547
|
+
widthStyles,
|
|
3285
3548
|
className
|
|
3286
3549
|
),
|
|
3550
|
+
...props,
|
|
3287
3551
|
children
|
|
3288
3552
|
}
|
|
3289
3553
|
);
|
|
3290
|
-
};
|
|
3554
|
+
});
|
|
3555
|
+
Box.displayName = "Box";
|
|
3291
3556
|
|
|
3292
3557
|
// src/components/Form/index.tsx
|
|
3293
3558
|
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
@@ -3333,10 +3598,10 @@ var Avatar = ({ className, ...rest }) => {
|
|
|
3333
3598
|
};
|
|
3334
3599
|
|
|
3335
3600
|
// src/components/MultiStep/index.tsx
|
|
3336
|
-
import { jsx as jsx14, jsxs as
|
|
3601
|
+
import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3337
3602
|
var MultiStep = ({ className, size, currentStep }) => {
|
|
3338
|
-
return /* @__PURE__ */
|
|
3339
|
-
/* @__PURE__ */ jsx14(Text, { tag: "label", color: "
|
|
3603
|
+
return /* @__PURE__ */ jsxs8("div", { className: "w-full", children: [
|
|
3604
|
+
/* @__PURE__ */ jsx14(Text, { tag: "label", color: "primary", size: "xs", children: `Passo ${currentStep} de ${size}` }),
|
|
3340
3605
|
/* @__PURE__ */ jsx14("div", { className: `grid gap-2 grid-cols-${size} grid-flow-col mt-1`, children: Array.from(Array(size).keys()).map((_, index) => {
|
|
3341
3606
|
return /* @__PURE__ */ jsx14(
|
|
3342
3607
|
"div",
|
|
@@ -3354,7 +3619,7 @@ var MultiStep = ({ className, size, currentStep }) => {
|
|
|
3354
3619
|
};
|
|
3355
3620
|
|
|
3356
3621
|
// src/components/Toggle/index.tsx
|
|
3357
|
-
import { jsx as jsx15, jsxs as
|
|
3622
|
+
import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3358
3623
|
var Toggle = ({
|
|
3359
3624
|
className,
|
|
3360
3625
|
disabled,
|
|
@@ -3393,7 +3658,7 @@ var Toggle = ({
|
|
|
3393
3658
|
}
|
|
3394
3659
|
}
|
|
3395
3660
|
};
|
|
3396
|
-
return /* @__PURE__ */
|
|
3661
|
+
return /* @__PURE__ */ jsxs9(
|
|
3397
3662
|
"div",
|
|
3398
3663
|
{
|
|
3399
3664
|
className: twMerge("flex items-center gap-3", className),
|
|
@@ -3474,7 +3739,7 @@ var Skeleton = ({
|
|
|
3474
3739
|
Skeleton.displayName = "Skeleton";
|
|
3475
3740
|
|
|
3476
3741
|
// src/components/Loading/index.tsx
|
|
3477
|
-
import { jsx as jsx17, jsxs as
|
|
3742
|
+
import { jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3478
3743
|
var Loading = ({
|
|
3479
3744
|
size = "md",
|
|
3480
3745
|
color = "primary",
|
|
@@ -3502,7 +3767,7 @@ var Loading = ({
|
|
|
3502
3767
|
md: "text-base",
|
|
3503
3768
|
lg: "text-lg"
|
|
3504
3769
|
};
|
|
3505
|
-
return /* @__PURE__ */
|
|
3770
|
+
return /* @__PURE__ */ jsxs10(
|
|
3506
3771
|
"div",
|
|
3507
3772
|
{
|
|
3508
3773
|
className: twMerge(
|
|
@@ -3512,7 +3777,7 @@ var Loading = ({
|
|
|
3512
3777
|
),
|
|
3513
3778
|
role: "status",
|
|
3514
3779
|
children: [
|
|
3515
|
-
/* @__PURE__ */
|
|
3780
|
+
/* @__PURE__ */ jsxs10(
|
|
3516
3781
|
"svg",
|
|
3517
3782
|
{
|
|
3518
3783
|
className: twMerge(
|
|
@@ -3560,7 +3825,7 @@ Loading.displayName = "Loading";
|
|
|
3560
3825
|
|
|
3561
3826
|
// src/components/Modal/index.tsx
|
|
3562
3827
|
import { useEffect as useEffect4, useState as useState6, useRef } from "react";
|
|
3563
|
-
import { jsx as jsx18, jsxs as
|
|
3828
|
+
import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3564
3829
|
var Modal = ({
|
|
3565
3830
|
className,
|
|
3566
3831
|
isOpen,
|
|
@@ -3621,7 +3886,7 @@ var Modal = ({
|
|
|
3621
3886
|
"aria-modal": "true",
|
|
3622
3887
|
role: "dialog",
|
|
3623
3888
|
...rest,
|
|
3624
|
-
children: /* @__PURE__ */
|
|
3889
|
+
children: /* @__PURE__ */ jsxs11(
|
|
3625
3890
|
"div",
|
|
3626
3891
|
{
|
|
3627
3892
|
ref: modalRef,
|
|
@@ -3632,7 +3897,7 @@ var Modal = ({
|
|
|
3632
3897
|
className
|
|
3633
3898
|
),
|
|
3634
3899
|
children: [
|
|
3635
|
-
(title || showCloseButton) && /* @__PURE__ */
|
|
3900
|
+
(title || showCloseButton) && /* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-700", children: [
|
|
3636
3901
|
title && /* @__PURE__ */ jsx18("h3", { className: "text-lg font-medium text-gray-900 dark:text-gray-100", children: title }),
|
|
3637
3902
|
showCloseButton && /* @__PURE__ */ jsx18(
|
|
3638
3903
|
"button",
|
|
@@ -3656,7 +3921,7 @@ var Modal = ({
|
|
|
3656
3921
|
|
|
3657
3922
|
// src/components/Toast/index.tsx
|
|
3658
3923
|
import { useEffect as useEffect5, useState as useState7, useRef as useRef2 } from "react";
|
|
3659
|
-
import { Fragment, jsx as jsx19, jsxs as
|
|
3924
|
+
import { Fragment, jsx as jsx19, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3660
3925
|
var ToastService = class _ToastService {
|
|
3661
3926
|
constructor() {
|
|
3662
3927
|
this.listeners = /* @__PURE__ */ new Set();
|
|
@@ -3734,7 +3999,7 @@ var Toast = ({
|
|
|
3734
3999
|
warning: /* @__PURE__ */ jsx19("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx19("path", { fillRule: "evenodd", 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", clipRule: "evenodd" }) }),
|
|
3735
4000
|
info: /* @__PURE__ */ jsx19("svg", { className: "w-5 h-5", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ jsx19("path", { fillRule: "evenodd", 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", clipRule: "evenodd" }) })
|
|
3736
4001
|
};
|
|
3737
|
-
return /* @__PURE__ */
|
|
4002
|
+
return /* @__PURE__ */ jsxs12(
|
|
3738
4003
|
"div",
|
|
3739
4004
|
{
|
|
3740
4005
|
className: twMerge(
|
|
@@ -3746,7 +4011,7 @@ var Toast = ({
|
|
|
3746
4011
|
role: "alert",
|
|
3747
4012
|
children: [
|
|
3748
4013
|
/* @__PURE__ */ jsx19("div", { className: `flex-shrink-0 mr-3 text-${variant}-500`, children: icons[variant] }),
|
|
3749
|
-
/* @__PURE__ */
|
|
4014
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex-1", children: [
|
|
3750
4015
|
title && /* @__PURE__ */ jsx19("h3", { className: "font-medium text-sm", children: title }),
|
|
3751
4016
|
/* @__PURE__ */ jsx19("div", { className: "text-sm", children: message })
|
|
3752
4017
|
] }),
|
|
@@ -3813,7 +4078,7 @@ var useToast = () => {
|
|
|
3813
4078
|
};
|
|
3814
4079
|
};
|
|
3815
4080
|
var ToastProvider = ({ position = "top-right", children }) => {
|
|
3816
|
-
return /* @__PURE__ */
|
|
4081
|
+
return /* @__PURE__ */ jsxs12(Fragment, { children: [
|
|
3817
4082
|
children,
|
|
3818
4083
|
/* @__PURE__ */ jsx19(ToastContainer, { position })
|
|
3819
4084
|
] });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koaris/bloom-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Bloom-ui is a public design system from the Koaris Project developed with React, Typescript, and Tailwind.",
|
|
5
5
|
"source": "./src/index.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"type": "git",
|
|
36
36
|
"url": "git+https://github.com/koaris/bloom-ui.git"
|
|
37
37
|
},
|
|
38
|
-
"license": "
|
|
38
|
+
"license": "MIT",
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@koaris/eslint-config": "*",
|
|
41
41
|
"@koaris/tokens": "*",
|