@particle-network/ui-react 0.3.0-beta.10 → 0.3.0-beta.12
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.
|
@@ -4,7 +4,7 @@ import { cn } from "@heroui/theme";
|
|
|
4
4
|
import { colorToClassName } from "@particle-network/ui-shared";
|
|
5
5
|
import { Square } from "../layout/index.js";
|
|
6
6
|
import { SpinnerIcon } from "./SpinnerIcon.js";
|
|
7
|
-
const UXSpinner = ({ size = 18, color = 'primary', duration =
|
|
7
|
+
const UXSpinner = ({ size = 18, color = 'primary', duration = 500, className, style, ...restProps })=>{
|
|
8
8
|
const [currentIndex, setCurrentIndex] = useState(0);
|
|
9
9
|
const animationRef = useRef(null);
|
|
10
10
|
const iconClassName = 'currentColor' === color ? void 0 : colorToClassName[color];
|
|
@@ -4,7 +4,7 @@ export type UXToastProps = Partial<ToastProps> & {
|
|
|
4
4
|
type: UXToastType;
|
|
5
5
|
};
|
|
6
6
|
export declare const UXToastProvider: () => import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const toast: {
|
|
8
8
|
success: (message: string, props?: Partial<ToastProps>) => string | null;
|
|
9
9
|
error: (message: string, props?: Partial<ToastProps>) => string | null;
|
|
10
10
|
loading: (message: string, props?: Partial<ToastProps>) => string | null;
|
|
@@ -12,5 +12,5 @@ export declare const UXToast: {
|
|
|
12
12
|
type: UXToastType;
|
|
13
13
|
}) => string | null;
|
|
14
14
|
closeAll: () => void;
|
|
15
|
-
|
|
15
|
+
close: (key: string) => void;
|
|
16
16
|
};
|
|
@@ -5,11 +5,12 @@ import CircleCloseIcon from "@particle-network/icons/web/CircleCloseIcon";
|
|
|
5
5
|
import CloseIcon from "@particle-network/icons/web/CloseIcon";
|
|
6
6
|
import { UXSpinner } from "../UXSpinner/index.js";
|
|
7
7
|
const UXToastProvider = ()=>/*#__PURE__*/ jsx(ToastProvider, {
|
|
8
|
+
disableAnimation: true,
|
|
8
9
|
placement: "top-center",
|
|
9
|
-
maxVisibleToasts:
|
|
10
|
+
maxVisibleToasts: 4,
|
|
10
11
|
toastOffset: 40,
|
|
11
12
|
toastProps: {
|
|
12
|
-
timeout:
|
|
13
|
+
timeout: 3000
|
|
13
14
|
}
|
|
14
15
|
});
|
|
15
16
|
const getIcon = (type)=>{
|
|
@@ -29,7 +30,7 @@ const show = (props)=>{
|
|
|
29
30
|
return addToast({
|
|
30
31
|
classNames: {
|
|
31
32
|
base: [
|
|
32
|
-
'bg-tertiary rounded-xl px-3.5 py-3 shadow-none !w-fit max-w-[350px]',
|
|
33
|
+
'bg-tertiary rounded-xl px-3.5 py-3 shadow-none border-none !w-fit max-w-[350px]',
|
|
33
34
|
!hideCloseButton && 'pr-12',
|
|
34
35
|
'flat' === variant && 'success' === type && 'bg-[#0E3728]',
|
|
35
36
|
'flat' === variant && 'error' === type && 'bg-[#501D1D]'
|
|
@@ -63,11 +64,11 @@ const show = (props)=>{
|
|
|
63
64
|
loadingComponent: /*#__PURE__*/ jsx(UXSpinner, {
|
|
64
65
|
size: 18
|
|
65
66
|
}),
|
|
66
|
-
timeout: 'loading' === type ? 1 / 0 :
|
|
67
|
+
timeout: 'loading' === type ? 1 / 0 : 3000,
|
|
67
68
|
...toastProps
|
|
68
69
|
});
|
|
69
70
|
};
|
|
70
|
-
const
|
|
71
|
+
const toast = {
|
|
71
72
|
success: (message, props)=>show({
|
|
72
73
|
type: 'success',
|
|
73
74
|
description: message,
|
|
@@ -86,6 +87,6 @@ const UXToast = {
|
|
|
86
87
|
}),
|
|
87
88
|
show,
|
|
88
89
|
closeAll: closeAll,
|
|
89
|
-
|
|
90
|
+
close: closeToast
|
|
90
91
|
};
|
|
91
|
-
export {
|
|
92
|
+
export { UXToastProvider, toast };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@particle-network/ui-react",
|
|
3
|
-
"version": "0.3.0-beta.
|
|
3
|
+
"version": "0.3.0-beta.12",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"ahooks": "^3.9.4",
|
|
51
|
-
"@particle-network/
|
|
52
|
-
"@particle-network/
|
|
51
|
+
"@particle-network/ui-shared": "0.2.0-beta.3",
|
|
52
|
+
"@particle-network/icons": "0.3.0-beta.6"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"build": "rslib build",
|