koval-ui
Version:
React components collection with minimalistic design. Supports theming, layout, and input validation.
30 lines (29 loc) • 760 B
JavaScript
"use client";
import { jsx as a } from "react/jsx-runtime";
import { useEffect as i, Fragment as u } from "react";
import { useRegisterNotification as N } from "./useRegisterNotification.js";
import { useNotificationState as x } from "./useNotificationState.js";
const O = ({
id: t,
title: o,
icon: r,
body: s,
requireInteraction: e,
onToggle: f = () => {
},
onDenied: m = () => {
}
}) => {
const c = N(), { isOpen: n, permission: p } = x(t);
return i(() => {
c(t, { title: o, icon: r, body: s, requireInteraction: e });
}, [t, o, r, s, e, c]), i(() => {
f(n);
}, [n, f]), i(() => {
p === "denied" && m();
}, [m, p]), /* @__PURE__ */ a(u, {});
};
export {
O as Notification
};
//# sourceMappingURL=Notification.js.map