@underverse-ui/underverse 2.0.43 → 2.0.44
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/api-reference.json +1 -1
- package/dist/index.cjs +6 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -611,6 +611,7 @@ interface Toast {
|
|
|
611
611
|
};
|
|
612
612
|
dismissible?: boolean;
|
|
613
613
|
overflowHidden?: boolean;
|
|
614
|
+
showProgress?: boolean;
|
|
614
615
|
}
|
|
615
616
|
interface ToastContextType {
|
|
616
617
|
addToast: (toast: Omit<Toast, "id">) => void;
|
|
@@ -624,6 +625,7 @@ interface ToastProviderProps {
|
|
|
624
625
|
position?: ToastPosition;
|
|
625
626
|
maxToasts?: number;
|
|
626
627
|
viewportClassName?: string;
|
|
628
|
+
showProgress?: boolean;
|
|
627
629
|
}
|
|
628
630
|
declare const ToastProvider: React__default.FC<ToastProviderProps>;
|
|
629
631
|
|
package/dist/index.d.ts
CHANGED
|
@@ -611,6 +611,7 @@ interface Toast {
|
|
|
611
611
|
};
|
|
612
612
|
dismissible?: boolean;
|
|
613
613
|
overflowHidden?: boolean;
|
|
614
|
+
showProgress?: boolean;
|
|
614
615
|
}
|
|
615
616
|
interface ToastContextType {
|
|
616
617
|
addToast: (toast: Omit<Toast, "id">) => void;
|
|
@@ -624,6 +625,7 @@ interface ToastProviderProps {
|
|
|
624
625
|
position?: ToastPosition;
|
|
625
626
|
maxToasts?: number;
|
|
626
627
|
viewportClassName?: string;
|
|
628
|
+
showProgress?: boolean;
|
|
627
629
|
}
|
|
628
630
|
declare const ToastProvider: React__default.FC<ToastProviderProps>;
|
|
629
631
|
|
package/dist/index.js
CHANGED
|
@@ -3505,7 +3505,8 @@ var ToastProvider = ({
|
|
|
3505
3505
|
children,
|
|
3506
3506
|
position = "top-right",
|
|
3507
3507
|
maxToasts = 5,
|
|
3508
|
-
viewportClassName
|
|
3508
|
+
viewportClassName,
|
|
3509
|
+
showProgress = true
|
|
3509
3510
|
}) => {
|
|
3510
3511
|
const [toasts, setToasts] = useState7([]);
|
|
3511
3512
|
const idRef = useRef4(0);
|
|
@@ -3539,12 +3540,12 @@ var ToastProvider = ({
|
|
|
3539
3540
|
className: cn("fixed z-99999 flex flex-col gap-2 pointer-events-none", positionClasses[position], viewportClassName),
|
|
3540
3541
|
"aria-live": "polite",
|
|
3541
3542
|
"aria-atomic": true,
|
|
3542
|
-
children: toasts.map((toast) => /* @__PURE__ */ jsx16(ToastComponent, { toast, onRemove: removeToast }, toast.id))
|
|
3543
|
+
children: toasts.map((toast) => /* @__PURE__ */ jsx16(ToastComponent, { toast, onRemove: removeToast, defaultShowProgress: showProgress }, toast.id))
|
|
3543
3544
|
}
|
|
3544
3545
|
)
|
|
3545
3546
|
] });
|
|
3546
3547
|
};
|
|
3547
|
-
var ToastComponent = ({ toast, onRemove }) => {
|
|
3548
|
+
var ToastComponent = ({ toast, onRemove, defaultShowProgress = true }) => {
|
|
3548
3549
|
const gi18n = useGlobalI18n();
|
|
3549
3550
|
const [isVisible, setIsVisible] = useState7(true);
|
|
3550
3551
|
const [progress, setProgress] = useState7(100);
|
|
@@ -3601,6 +3602,7 @@ var ToastComponent = ({ toast, onRemove }) => {
|
|
|
3601
3602
|
};
|
|
3602
3603
|
const config = typeConfig[toast.type];
|
|
3603
3604
|
const Icon = config.icon;
|
|
3605
|
+
const shouldShowProgress = toast.showProgress ?? defaultShowProgress;
|
|
3604
3606
|
return /* @__PURE__ */ jsxs12(
|
|
3605
3607
|
"div",
|
|
3606
3608
|
{
|
|
@@ -3658,7 +3660,7 @@ var ToastComponent = ({ toast, onRemove }) => {
|
|
|
3658
3660
|
}
|
|
3659
3661
|
)
|
|
3660
3662
|
] }),
|
|
3661
|
-
toast.duration !== 0 && /* @__PURE__ */ jsx16("div", { className: "absolute left-0 right-0 bottom-0 h-1 bg-transparent", children: /* @__PURE__ */ jsx16(
|
|
3663
|
+
shouldShowProgress && toast.duration !== 0 && /* @__PURE__ */ jsx16("div", { className: "absolute left-0 right-0 bottom-0 h-1 bg-transparent", "data-testid": "toast-progress-bar", children: /* @__PURE__ */ jsx16(
|
|
3662
3664
|
"div",
|
|
3663
3665
|
{
|
|
3664
3666
|
className: cn(
|