@sonic-equipment/ui 0.0.93 → 0.0.94
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/index.js +2 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9898,18 +9898,11 @@ const Toast = forwardRef(({ className, id, onClose, toastMessage: { body, isUser
|
|
|
9898
9898
|
Toast.displayName = 'Toast';
|
|
9899
9899
|
|
|
9900
9900
|
function useToast() {
|
|
9901
|
-
const
|
|
9902
|
-
const targetRef = useRef(null);
|
|
9903
|
-
useEffect(() => {
|
|
9904
|
-
if (targetRef.current) {
|
|
9905
|
-
targetRef.current.style.zIndex = toastCount.toString();
|
|
9906
|
-
}
|
|
9907
|
-
}, [toastCount]);
|
|
9901
|
+
const count = useRef(0);
|
|
9908
9902
|
return {
|
|
9909
9903
|
addToast(toastMessage, toastOptions) {
|
|
9910
|
-
setToastCount(toastCount => toastCount + 1);
|
|
9911
9904
|
const id = createUUID();
|
|
9912
|
-
toast(jsx(Toast, { ref:
|
|
9905
|
+
toast(jsx(Toast, { ref: el => el && (el.style.zIndex = (count.current++).toString()), id: id, onClose: id => toast.dismiss(id), toastMessage: toastMessage }), {
|
|
9913
9906
|
toastId: id,
|
|
9914
9907
|
...toastOptions,
|
|
9915
9908
|
});
|