@fibery/ui-kit 1.32.0 → 1.32.1
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/package.json +10 -10
- package/src/toast/toaster.tsx +18 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fibery/ui-kit",
|
|
3
|
-
"version": "1.32.
|
|
3
|
+
"version": "1.32.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"files": [
|
|
6
6
|
"src/antd/styles.ts",
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"@linaria/core": "5.0.1",
|
|
39
39
|
"@linaria/react": "5.0.1",
|
|
40
40
|
"@popperjs/core": "2.11.6",
|
|
41
|
-
"@radix-ui/react-collapsible": "1.0
|
|
42
|
-
"@radix-ui/react-context-menu": "2.1
|
|
43
|
-
"@radix-ui/react-dropdown-menu": "2.
|
|
44
|
-
"@radix-ui/react-toast": "1.1
|
|
45
|
-
"@radix-ui/react-tooltip": "1.
|
|
41
|
+
"@radix-ui/react-collapsible": "1.1.0",
|
|
42
|
+
"@radix-ui/react-context-menu": "2.2.1",
|
|
43
|
+
"@radix-ui/react-dropdown-menu": "2.1.1",
|
|
44
|
+
"@radix-ui/react-toast": "1.2.1",
|
|
45
|
+
"@radix-ui/react-tooltip": "1.1.2",
|
|
46
46
|
"@types/d3-shape": "^3.1.3",
|
|
47
47
|
"@types/react-select-country-list": "^2.2.1",
|
|
48
48
|
"@types/setimmediate": "^1.0.2",
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
"screenfull": "6.0.1",
|
|
74
74
|
"ua-parser-js": "0.7.24",
|
|
75
75
|
"@fibery/emoji-data": "2.6.0",
|
|
76
|
-
"@fibery/
|
|
77
|
-
"@fibery/
|
|
76
|
+
"@fibery/react": "1.4.0",
|
|
77
|
+
"@fibery/helpers": "1.3.0"
|
|
78
78
|
},
|
|
79
79
|
"peerDependencies": {
|
|
80
80
|
"react": "^18.2.0",
|
|
@@ -108,8 +108,8 @@
|
|
|
108
108
|
"svgo": "2.8.0",
|
|
109
109
|
"typescript": "5.4.3",
|
|
110
110
|
"unist-util-reduce": "0.2.2",
|
|
111
|
-
"@fibery/
|
|
112
|
-
"@fibery/
|
|
111
|
+
"@fibery/eslint-config": "8.6.0",
|
|
112
|
+
"@fibery/babel-preset": "7.4.0"
|
|
113
113
|
},
|
|
114
114
|
"jest": {
|
|
115
115
|
"testEnvironment": "jsdom",
|
package/src/toast/toaster.tsx
CHANGED
|
@@ -18,6 +18,8 @@ const ToastThemeProvider: React.FC<React.PropsWithChildren> = ({children}) => {
|
|
|
18
18
|
);
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
+
const viewportId = "toast-viewport";
|
|
22
|
+
|
|
21
23
|
export const Toaster: React.FC = () => {
|
|
22
24
|
const toastQueue = useToast();
|
|
23
25
|
|
|
@@ -26,10 +28,24 @@ export const Toaster: React.FC = () => {
|
|
|
26
28
|
return (
|
|
27
29
|
<ToastThemeProvider>
|
|
28
30
|
{toasts.map(({id, open, type = "info", ...toastProps}) => (
|
|
29
|
-
<Toast
|
|
31
|
+
<Toast
|
|
32
|
+
key={`${id}-${type}`}
|
|
33
|
+
type={type}
|
|
34
|
+
{...toastProps}
|
|
35
|
+
open={open}
|
|
36
|
+
onHide={() => {
|
|
37
|
+
// workaround for https://github.com/radix-ui/primitives/issues/2233
|
|
38
|
+
// without it timers aren't resumed until hover if the last toast was closed via ToastAction
|
|
39
|
+
if (toasts.length === 1) {
|
|
40
|
+
document.getElementById(viewportId)?.blur();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
toastQueue.remove(id);
|
|
44
|
+
}}
|
|
45
|
+
/>
|
|
30
46
|
))}
|
|
31
47
|
|
|
32
|
-
<ToastViewport />
|
|
48
|
+
<ToastViewport id={viewportId} />
|
|
33
49
|
</ToastThemeProvider>
|
|
34
50
|
);
|
|
35
51
|
};
|