@basic-ui/material 1.0.0-alpha.28 → 1.0.0-alpha.29
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@basic-ui/material",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.29",
|
|
4
4
|
"description": "Accessible React Components used as building blocks for UI patterns",
|
|
5
5
|
"author": "Lucas Terra <lucasterra7@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"react": "^16.14.0 || ^17.0.0 || ^18.0.0",
|
|
53
53
|
"react-dom": "^16.14.0 || ^17.0.0 || ^18.0.0"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "ee3fb47600f6b456b30902d30436894fde9c5387"
|
|
56
56
|
}
|
package/src/Snackbar/Stack.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { MutableRefObject, ReactElement, FC, ReactNode } from 'react';
|
|
2
1
|
import {
|
|
2
|
+
useMemo,
|
|
3
3
|
useLayoutEffect,
|
|
4
4
|
createContext,
|
|
5
5
|
useContext,
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
useRef,
|
|
8
8
|
useState,
|
|
9
9
|
} from 'react';
|
|
10
|
+
import type { MutableRefObject, ReactElement, FC, ReactNode } from 'react';
|
|
10
11
|
|
|
11
12
|
export type StackPlacement =
|
|
12
13
|
| 'top-right'
|
|
@@ -209,12 +210,15 @@ export const StackProvider: FC<{
|
|
|
209
210
|
maxSize?: number;
|
|
210
211
|
}> = ({ children, gap = 8, placement = 'top-right', maxSize = 3 }) => {
|
|
211
212
|
const onAddItemRef = useRef<(element: ReactElement) => void>(null);
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
213
|
+
const value = useMemo(
|
|
214
|
+
() => ({
|
|
215
|
+
addItem: (element: ReactElement) => onAddItemRef.current?.(element),
|
|
216
|
+
}),
|
|
217
|
+
[]
|
|
218
|
+
);
|
|
215
219
|
|
|
216
220
|
return (
|
|
217
|
-
<StackContext.Provider value={
|
|
221
|
+
<StackContext.Provider value={value}>
|
|
218
222
|
{children}
|
|
219
223
|
<StackContent
|
|
220
224
|
gap={gap}
|