aloha-ui-library 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/FormError/FormError.d.ts +6 -0
- package/dist/components/FormError/index.d.ts +1 -0
- package/dist/components/Input/Input.d.ts +1 -0
- package/dist/components/Toast/Toast.d.ts +11 -0
- package/dist/components/Toast/index.d.ts +1 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.css +1 -1
- package/dist/index.esm.js +171 -40
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +170 -37
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import React, {
|
|
3
|
-
import { Search, Bell, X,
|
|
2
|
+
import React, { useState, useEffect, useRef } from 'react';
|
|
3
|
+
import { AlertCircle, EyeOff, Eye, Search, Bell, X, RefreshCw, Info, CheckCircle, Loader2 } from 'lucide-react';
|
|
4
4
|
import { Link as Link$1 } from 'react-router-dom';
|
|
5
5
|
|
|
6
6
|
function _arrayLikeToArray(r, a) {
|
|
@@ -2762,7 +2762,7 @@ var themeVars = {
|
|
|
2762
2762
|
primary: 'var(--theme-primary)'
|
|
2763
2763
|
};
|
|
2764
2764
|
|
|
2765
|
-
var _excluded$
|
|
2765
|
+
var _excluded$q = ["className", "variant", "size", "loading", "disabled", "color", "textColor", "borderColor", "icon", "children", "style", "borderWidth"];
|
|
2766
2766
|
var buttonVariants = cva('inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50', {
|
|
2767
2767
|
variants: {
|
|
2768
2768
|
variant: {
|
|
@@ -2799,7 +2799,7 @@ var Button = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
2799
2799
|
style = _ref.style,
|
|
2800
2800
|
_ref$borderWidth = _ref.borderWidth,
|
|
2801
2801
|
borderWidth = _ref$borderWidth === void 0 ? 1 : _ref$borderWidth,
|
|
2802
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
2802
|
+
props = _objectWithoutProperties(_ref, _excluded$q);
|
|
2803
2803
|
var customStyle = {};
|
|
2804
2804
|
// Aplicar color de fondo si se especifica
|
|
2805
2805
|
if (color) {
|
|
@@ -2858,7 +2858,7 @@ var Button = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
2858
2858
|
});
|
|
2859
2859
|
Button.displayName = 'Button';
|
|
2860
2860
|
|
|
2861
|
-
var _excluded$
|
|
2861
|
+
var _excluded$p = ["className", "children", "font", "weight", "color", "style"],
|
|
2862
2862
|
_excluded2$3 = ["className", "children", "font", "weight", "color", "style"],
|
|
2863
2863
|
_excluded3$2 = ["className", "children", "font", "weight", "color", "style"],
|
|
2864
2864
|
_excluded4$1 = ["className", "children", "font", "weight", "color", "style"],
|
|
@@ -2897,7 +2897,7 @@ var H1 = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
2897
2897
|
weight = _ref.weight,
|
|
2898
2898
|
color = _ref.color,
|
|
2899
2899
|
style = _ref.style,
|
|
2900
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
2900
|
+
props = _objectWithoutProperties(_ref, _excluded$p);
|
|
2901
2901
|
return jsx("h1", _objectSpread2(_objectSpread2({
|
|
2902
2902
|
ref: ref,
|
|
2903
2903
|
className: cn('scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl', fontFamilyClasses[font], weight && fontWeightClasses[weight], className),
|
|
@@ -3052,7 +3052,7 @@ var Muted = /*#__PURE__*/React.forwardRef(function (_ref9, ref) {
|
|
|
3052
3052
|
});
|
|
3053
3053
|
Muted.displayName = 'Muted';
|
|
3054
3054
|
|
|
3055
|
-
var _excluded$
|
|
3055
|
+
var _excluded$o = ["className", "size", "borderRadius", "showBorder", "backgroundColor", "borderColor", "shadow", "padding", "margin", "style"],
|
|
3056
3056
|
_excluded2$2 = ["className", "padding", "margin", "style"],
|
|
3057
3057
|
_excluded3$1 = ["className", "font", "weight", "descriptionColor", "small", "children"],
|
|
3058
3058
|
_excluded4 = ["color"],
|
|
@@ -3151,7 +3151,7 @@ var Card = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
3151
3151
|
padding = _ref.padding,
|
|
3152
3152
|
margin = _ref.margin,
|
|
3153
3153
|
style = _ref.style,
|
|
3154
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
3154
|
+
props = _objectWithoutProperties(_ref, _excluded$o);
|
|
3155
3155
|
return jsx("div", _objectSpread2({
|
|
3156
3156
|
ref: ref,
|
|
3157
3157
|
className: cn('text-card-foreground', sizeClasses$2[size], borderRadiusClasses[borderRadius], showBorder ? 'border' : '', showBorder ? getBorderColor(borderColor) : '', getBackgroundColor(backgroundColor), shadow ? 'shadow-sm' : '', className),
|
|
@@ -3264,7 +3264,7 @@ var CardFooter = /*#__PURE__*/React.forwardRef(function (_ref6, ref) {
|
|
|
3264
3264
|
});
|
|
3265
3265
|
CardFooter.displayName = 'CardFooter';
|
|
3266
3266
|
|
|
3267
|
-
var _excluded$
|
|
3267
|
+
var _excluded$n = ["className", "src", "alt", "fallback", "size"];
|
|
3268
3268
|
var Avatar = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
3269
3269
|
var _alt$charAt;
|
|
3270
3270
|
var className = _ref.className,
|
|
@@ -3273,7 +3273,7 @@ var Avatar = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
3273
3273
|
fallback = _ref.fallback,
|
|
3274
3274
|
_ref$size = _ref.size,
|
|
3275
3275
|
size = _ref$size === void 0 ? 'md' : _ref$size,
|
|
3276
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
3276
|
+
props = _objectWithoutProperties(_ref, _excluded$n);
|
|
3277
3277
|
var _React$useState = React.useState(false),
|
|
3278
3278
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
3279
3279
|
imageFailed = _React$useState2[0],
|
|
@@ -3306,7 +3306,7 @@ var Avatar = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
3306
3306
|
});
|
|
3307
3307
|
Avatar.displayName = 'Avatar';
|
|
3308
3308
|
|
|
3309
|
-
var _excluded$
|
|
3309
|
+
var _excluded$m = ["className", "variant"];
|
|
3310
3310
|
var badgeVariants = cva('inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2', {
|
|
3311
3311
|
variants: {
|
|
3312
3312
|
variant: {
|
|
@@ -3323,7 +3323,7 @@ var badgeVariants = cva('inline-flex items-center rounded-full border px-2.5 py-
|
|
|
3323
3323
|
function Badge(_ref) {
|
|
3324
3324
|
var className = _ref.className,
|
|
3325
3325
|
variant = _ref.variant,
|
|
3326
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
3326
|
+
props = _objectWithoutProperties(_ref, _excluded$m);
|
|
3327
3327
|
return jsx("div", _objectSpread2({
|
|
3328
3328
|
className: cn(badgeVariants({
|
|
3329
3329
|
variant: variant
|
|
@@ -3331,7 +3331,33 @@ function Badge(_ref) {
|
|
|
3331
3331
|
}, props));
|
|
3332
3332
|
}
|
|
3333
3333
|
|
|
3334
|
-
var _excluded$
|
|
3334
|
+
var _excluded$l = ["className", "error"];
|
|
3335
|
+
var FormError = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
3336
|
+
var className = _ref.className,
|
|
3337
|
+
error = _ref.error,
|
|
3338
|
+
props = _objectWithoutProperties(_ref, _excluded$l);
|
|
3339
|
+
if (!error) return null;
|
|
3340
|
+
return jsxs("div", _objectSpread2(_objectSpread2({
|
|
3341
|
+
ref: ref,
|
|
3342
|
+
className: cn('flex items-center gap-1.5 mt-1.5', className)
|
|
3343
|
+
}, props), {}, {
|
|
3344
|
+
children: [jsx(AlertCircle, {
|
|
3345
|
+
className: "w-4 h-4",
|
|
3346
|
+
style: {
|
|
3347
|
+
color: colors.coral
|
|
3348
|
+
}
|
|
3349
|
+
}), jsx(P, {
|
|
3350
|
+
className: "text-sm m-0 font-medium",
|
|
3351
|
+
style: {
|
|
3352
|
+
color: colors.coral
|
|
3353
|
+
},
|
|
3354
|
+
children: error
|
|
3355
|
+
})]
|
|
3356
|
+
}));
|
|
3357
|
+
});
|
|
3358
|
+
FormError.displayName = 'FormError';
|
|
3359
|
+
|
|
3360
|
+
var _excluded$k = ["className", "type", "label", "helperText", "required", "id", "error"];
|
|
3335
3361
|
var Input = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
3336
3362
|
var className = _ref.className,
|
|
3337
3363
|
type = _ref.type,
|
|
@@ -3339,7 +3365,18 @@ var Input = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
3339
3365
|
helperText = _ref.helperText,
|
|
3340
3366
|
required = _ref.required,
|
|
3341
3367
|
id = _ref.id,
|
|
3342
|
-
|
|
3368
|
+
error = _ref.error,
|
|
3369
|
+
props = _objectWithoutProperties(_ref, _excluded$k);
|
|
3370
|
+
var _useState = useState(false),
|
|
3371
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
3372
|
+
showPassword = _useState2[0],
|
|
3373
|
+
setShowPassword = _useState2[1];
|
|
3374
|
+
var isPassword = type === 'password';
|
|
3375
|
+
var inputType = isPassword ? showPassword ? 'text' : 'password' : type;
|
|
3376
|
+
// Determine if type was explicitly set to text by parent but it's meant to be a password
|
|
3377
|
+
// Wait, the parent might already be doing `type={showPassword ? 'text' : 'password'}`
|
|
3378
|
+
// If we handle it internally, we check if `type === 'password'`. If the parent does that, our internal toggle wouldn't work when parent overrides.
|
|
3379
|
+
// However, since we now handle it internally, parents won't need to control the toggle.
|
|
3343
3380
|
var inputId = id || "input-".concat(Math.random().toString(36).substr(2, 9));
|
|
3344
3381
|
return jsxs("div", {
|
|
3345
3382
|
className: "w-full",
|
|
@@ -3357,27 +3394,47 @@ var Input = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
3357
3394
|
className: "text-xs text-gray-500 m-0 mt-1 [&:not(:first-child)]:mt-1",
|
|
3358
3395
|
children: helperText
|
|
3359
3396
|
})]
|
|
3360
|
-
}),
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3397
|
+
}), jsxs("div", {
|
|
3398
|
+
className: "relative",
|
|
3399
|
+
children: [jsx("input", _objectSpread2({
|
|
3400
|
+
type: inputType,
|
|
3401
|
+
id: inputId,
|
|
3402
|
+
className: cn('flex h-10 w-full rounded-lg border-2 px-3 py-2 text-sm transition-all', 'placeholder:text-gray-500', 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2', 'disabled:cursor-not-allowed disabled:opacity-50', isPassword ? 'pr-10' : '',
|
|
3403
|
+
// make room for the eye icon
|
|
3404
|
+
error ? 'border-coral/50' : '',
|
|
3405
|
+
// simple error indication on border
|
|
3406
|
+
className),
|
|
3407
|
+
style: {
|
|
3408
|
+
borderColor: error ? colors.coral : colors.piedra,
|
|
3409
|
+
backgroundColor: colors.koala
|
|
3410
|
+
},
|
|
3411
|
+
ref: ref,
|
|
3412
|
+
required: required
|
|
3413
|
+
}, props)), isPassword && jsx("button", {
|
|
3414
|
+
type: "button",
|
|
3415
|
+
className: "absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-gray-700 focus:outline-none",
|
|
3416
|
+
onClick: function onClick() {
|
|
3417
|
+
return setShowPassword(!showPassword);
|
|
3418
|
+
},
|
|
3419
|
+
children: showPassword ? jsx(EyeOff, {
|
|
3420
|
+
size: 18
|
|
3421
|
+
}) : jsx(Eye, {
|
|
3422
|
+
size: 18
|
|
3423
|
+
})
|
|
3424
|
+
})]
|
|
3425
|
+
}), error && typeof error === 'string' && jsx(FormError, {
|
|
3426
|
+
error: error
|
|
3427
|
+
})]
|
|
3371
3428
|
});
|
|
3372
3429
|
});
|
|
3373
3430
|
Input.displayName = 'Input';
|
|
3374
3431
|
|
|
3375
|
-
var _excluded$
|
|
3432
|
+
var _excluded$j = ["className", "label", "id"];
|
|
3376
3433
|
var Checkbox = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
3377
3434
|
var className = _ref.className,
|
|
3378
3435
|
label = _ref.label,
|
|
3379
3436
|
id = _ref.id,
|
|
3380
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
3437
|
+
props = _objectWithoutProperties(_ref, _excluded$j);
|
|
3381
3438
|
var checkboxId = id || "checkbox-".concat(Math.random().toString(36).substr(2, 9));
|
|
3382
3439
|
var _React$useState = React.useState(false),
|
|
3383
3440
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -3437,7 +3494,7 @@ var Checkbox = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
3437
3494
|
});
|
|
3438
3495
|
Checkbox.displayName = 'Checkbox';
|
|
3439
3496
|
|
|
3440
|
-
var _excluded$
|
|
3497
|
+
var _excluded$i = ["className", "label", "font", "weight", "labelColor", "id"];
|
|
3441
3498
|
var Switch = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
3442
3499
|
var className = _ref.className,
|
|
3443
3500
|
label = _ref.label,
|
|
@@ -3445,7 +3502,7 @@ var Switch = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
3445
3502
|
weight = _ref.weight,
|
|
3446
3503
|
labelColor = _ref.labelColor,
|
|
3447
3504
|
id = _ref.id,
|
|
3448
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
3505
|
+
props = _objectWithoutProperties(_ref, _excluded$i);
|
|
3449
3506
|
var switchId = id || "switch-".concat(Math.random().toString(36).substr(2, 9));
|
|
3450
3507
|
return jsxs("div", {
|
|
3451
3508
|
className: "flex items-center space-x-3",
|
|
@@ -3471,11 +3528,11 @@ var Switch = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
3471
3528
|
});
|
|
3472
3529
|
Switch.displayName = 'Switch';
|
|
3473
3530
|
|
|
3474
|
-
var _excluded$
|
|
3531
|
+
var _excluded$h = ["className", "onSearch"];
|
|
3475
3532
|
var SearchInput = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
3476
3533
|
var className = _ref.className,
|
|
3477
3534
|
onSearch = _ref.onSearch,
|
|
3478
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
3535
|
+
props = _objectWithoutProperties(_ref, _excluded$h);
|
|
3479
3536
|
var handleKeyDown = function handleKeyDown(e) {
|
|
3480
3537
|
if (e.key === 'Enter' && onSearch) {
|
|
3481
3538
|
onSearch(e.currentTarget.value);
|
|
@@ -3495,7 +3552,7 @@ var SearchInput = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
3495
3552
|
});
|
|
3496
3553
|
SearchInput.displayName = 'SearchInput';
|
|
3497
3554
|
|
|
3498
|
-
var _excluded$
|
|
3555
|
+
var _excluded$g = ["type", "title", "message", "timestamp", "avatar", "read", "onClose", "onClick", "className"];
|
|
3499
3556
|
var Notification = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
3500
3557
|
var type = _ref.type,
|
|
3501
3558
|
title = _ref.title,
|
|
@@ -3507,7 +3564,7 @@ var Notification = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
3507
3564
|
onClose = _ref.onClose,
|
|
3508
3565
|
onClick = _ref.onClick,
|
|
3509
3566
|
className = _ref.className,
|
|
3510
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
3567
|
+
props = _objectWithoutProperties(_ref, _excluded$g);
|
|
3511
3568
|
var typeColors = {
|
|
3512
3569
|
like: 'text-red-500',
|
|
3513
3570
|
comment: 'text-blue-500',
|
|
@@ -3558,7 +3615,7 @@ var Notification = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
3558
3615
|
});
|
|
3559
3616
|
Notification.displayName = 'Notification';
|
|
3560
3617
|
|
|
3561
|
-
var _excluded$
|
|
3618
|
+
var _excluded$f = ["className", "text", "component", "font", "weight", "textColor", "lineColor", "lineThickness", "avatars", "avatarRingColor", "rightSlot"];
|
|
3562
3619
|
// ── Color de la línea (herencia del original) ─────────────────────
|
|
3563
3620
|
var getLineColorClass = function getLineColorClass(color) {
|
|
3564
3621
|
if (!color || color === 'default') return 'bg-gray-300';
|
|
@@ -3597,7 +3654,7 @@ var TextDivider = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
3597
3654
|
avatars = _ref.avatars,
|
|
3598
3655
|
avatarRingColor = _ref.avatarRingColor,
|
|
3599
3656
|
rightSlot = _ref.rightSlot,
|
|
3600
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
3657
|
+
props = _objectWithoutProperties(_ref, _excluded$f);
|
|
3601
3658
|
var renderText = function renderText() {
|
|
3602
3659
|
var commonProps = {
|
|
3603
3660
|
font: font,
|
|
@@ -3671,7 +3728,7 @@ var TextDivider = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
3671
3728
|
});
|
|
3672
3729
|
TextDivider.displayName = 'TextDivider';
|
|
3673
3730
|
|
|
3674
|
-
var _excluded$
|
|
3731
|
+
var _excluded$e = ["className", "children", "color", "hoverColor", "underline", "external"],
|
|
3675
3732
|
_excluded2$1 = ["to"],
|
|
3676
3733
|
_excluded3 = ["href", "target", "rel"];
|
|
3677
3734
|
var getColorClass = function getColorClass(color) {
|
|
@@ -3735,7 +3792,7 @@ var Link = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
3735
3792
|
underline = _ref$underline === void 0 ? 'hover' : _ref$underline,
|
|
3736
3793
|
_ref$external = _ref.external,
|
|
3737
3794
|
external = _ref$external === void 0 ? false : _ref$external,
|
|
3738
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
3795
|
+
props = _objectWithoutProperties(_ref, _excluded$e);
|
|
3739
3796
|
var linkClasses = cn('inline-flex items-center font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2', getColorClass(color), hoverColor ? '' : getHoverColorClass(color), getUnderlineClass(underline), className);
|
|
3740
3797
|
// Si tiene la prop "to", usar React Router Link
|
|
3741
3798
|
if ('to' in props && props.to) {
|
|
@@ -3776,7 +3833,7 @@ var Link = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
3776
3833
|
});
|
|
3777
3834
|
Link.displayName = 'Link';
|
|
3778
3835
|
|
|
3779
|
-
var _excluded$
|
|
3836
|
+
var _excluded$d = ["src", "alt", "width", "height", "objectFit", "loading", "fallbackSrc", "onError", "className"];
|
|
3780
3837
|
var Image = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
3781
3838
|
var src = _ref.src,
|
|
3782
3839
|
alt = _ref.alt,
|
|
@@ -3789,7 +3846,7 @@ var Image = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
3789
3846
|
fallbackSrc = _ref.fallbackSrc,
|
|
3790
3847
|
onError = _ref.onError,
|
|
3791
3848
|
className = _ref.className,
|
|
3792
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
3849
|
+
props = _objectWithoutProperties(_ref, _excluded$d);
|
|
3793
3850
|
var _React$useState = React.useState(src),
|
|
3794
3851
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
3795
3852
|
imgSrc = _React$useState2[0],
|
|
@@ -4028,6 +4085,80 @@ var Error = function Error(_ref) {
|
|
|
4028
4085
|
});
|
|
4029
4086
|
};
|
|
4030
4087
|
|
|
4088
|
+
var _excluded$c = ["message", "type", "onClose", "duration", "className", "position"];
|
|
4089
|
+
var Toast = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
4090
|
+
var message = _ref.message,
|
|
4091
|
+
_ref$type = _ref.type,
|
|
4092
|
+
type = _ref$type === void 0 ? 'error' : _ref$type,
|
|
4093
|
+
onClose = _ref.onClose,
|
|
4094
|
+
_ref$duration = _ref.duration,
|
|
4095
|
+
duration = _ref$duration === void 0 ? 3000 : _ref$duration,
|
|
4096
|
+
className = _ref.className,
|
|
4097
|
+
_ref$position = _ref.position,
|
|
4098
|
+
position = _ref$position === void 0 ? 'bottom-center' : _ref$position,
|
|
4099
|
+
props = _objectWithoutProperties(_ref, _excluded$c);
|
|
4100
|
+
useEffect(function () {
|
|
4101
|
+
if (duration > 0) {
|
|
4102
|
+
var timer = setTimeout(onClose, duration);
|
|
4103
|
+
return function () {
|
|
4104
|
+
return clearTimeout(timer);
|
|
4105
|
+
};
|
|
4106
|
+
}
|
|
4107
|
+
}, [duration, onClose]);
|
|
4108
|
+
var typeConfig = {
|
|
4109
|
+
error: {
|
|
4110
|
+
icon: jsx(AlertCircle, {
|
|
4111
|
+
className: "w-5 h-5 text-white"
|
|
4112
|
+
}),
|
|
4113
|
+
bgColor: colors.coral
|
|
4114
|
+
},
|
|
4115
|
+
success: {
|
|
4116
|
+
icon: jsx(CheckCircle, {
|
|
4117
|
+
className: "w-5 h-5 text-white"
|
|
4118
|
+
}),
|
|
4119
|
+
bgColor: colors.lima
|
|
4120
|
+
},
|
|
4121
|
+
info: {
|
|
4122
|
+
icon: jsx(Info, {
|
|
4123
|
+
className: "w-5 h-5 text-white"
|
|
4124
|
+
}),
|
|
4125
|
+
bgColor: colors.electrico
|
|
4126
|
+
}
|
|
4127
|
+
};
|
|
4128
|
+
var config = typeConfig[type];
|
|
4129
|
+
var positionClasses = {
|
|
4130
|
+
'top-left': 'top-4 left-4',
|
|
4131
|
+
'top-center': 'top-4 left-1/2 -translate-x-1/2',
|
|
4132
|
+
'top-right': 'top-4 right-4',
|
|
4133
|
+
'bottom-left': 'bottom-4 left-4',
|
|
4134
|
+
'bottom-center': 'bottom-4 left-1/2 -translate-x-1/2',
|
|
4135
|
+
'bottom-right': 'bottom-4 right-4'
|
|
4136
|
+
};
|
|
4137
|
+
return jsxs("div", _objectSpread2(_objectSpread2({
|
|
4138
|
+
ref: ref,
|
|
4139
|
+
className: cn('fixed z-50 flex items-center gap-3 px-4 py-3 rounded-lg shadow-lg min-w-[300px] animate-in fade-in slide-in-from-bottom-5', positionClasses[position], className),
|
|
4140
|
+
style: {
|
|
4141
|
+
backgroundColor: config.bgColor
|
|
4142
|
+
},
|
|
4143
|
+
role: "alert"
|
|
4144
|
+
}, props), {}, {
|
|
4145
|
+
children: [jsx("div", {
|
|
4146
|
+
className: "flex-shrink-0",
|
|
4147
|
+
children: config.icon
|
|
4148
|
+
}), jsx(P, {
|
|
4149
|
+
className: "text-white m-0 font-medium flex-1 text-sm",
|
|
4150
|
+
children: message
|
|
4151
|
+
}), jsx("button", {
|
|
4152
|
+
onClick: onClose,
|
|
4153
|
+
className: "flex-shrink-0 text-white opacity-70 hover:opacity-100 transition-opacity focus:outline-none",
|
|
4154
|
+
children: jsx(X, {
|
|
4155
|
+
className: "w-4 h-4"
|
|
4156
|
+
})
|
|
4157
|
+
})]
|
|
4158
|
+
}));
|
|
4159
|
+
});
|
|
4160
|
+
Toast.displayName = 'Toast';
|
|
4161
|
+
|
|
4031
4162
|
var Loading = function Loading(_ref) {
|
|
4032
4163
|
var message = _ref.message,
|
|
4033
4164
|
className = _ref.className,
|
|
@@ -5393,5 +5524,5 @@ var ColorPalette = function ColorPalette(_ref2) {
|
|
|
5393
5524
|
});
|
|
5394
5525
|
};
|
|
5395
5526
|
|
|
5396
|
-
export { Avatar, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, ChatMessage, Checkbox, ColorPalette, ColorSwatch, Emoji, Error, ErrorFullScreen, FriendListItem, FullPage, Grid, GridItem, H1, H2, H3, H4, Icon, Image, Input, Lead, Link, Loading, LoadingFullScreen, Logo, Muted, Navbar, Notification, P, Pattern, PatternFill, PatternGroup, Popup, QuestionCard, SearchInput, Small, Streak, Subtitle, Switch, TextDivider, badgeVariants, buttonVariants, cn, colorEntries, colors, cssVars, getColor, getCssVar, themeVars };
|
|
5527
|
+
export { Avatar, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, ChatMessage, Checkbox, ColorPalette, ColorSwatch, Emoji, Error, ErrorFullScreen, FormError, FriendListItem, FullPage, Grid, GridItem, H1, H2, H3, H4, Icon, Image, Input, Lead, Link, Loading, LoadingFullScreen, Logo, Muted, Navbar, Notification, P, Pattern, PatternFill, PatternGroup, Popup, QuestionCard, SearchInput, Small, Streak, Subtitle, Switch, TextDivider, Toast, badgeVariants, buttonVariants, cn, colorEntries, colors, cssVars, getColor, getCssVar, themeVars };
|
|
5397
5528
|
//# sourceMappingURL=index.esm.js.map
|