@veracity/vui
Version:
Veracity UI is a React component library crafted for use within Veracity applications and pages. Based on Styled Components and @xstyled.
47 lines (45 loc) • 1.21 kB
JavaScript
import zIndices_default from "../theme/foundations/zIndices.js";
import { v } from "../core/styled.js";
import { useVuiContext } from "../core/vuiProvider/context.js";
import { Box } from "../box/box.js";
import { ToastItem } from "./ToastItem.js";
import { memo } from "react";
import { jsx } from "react/jsx-runtime";
//#region src/toast/Toaster.tsx
const toasterWidth = 480;
const Toaster = () => {
const { toasts } = useVuiContext();
const right = {
md: "1rem",
sm: "0.5rem",
xs: "0.5rem"
};
const width = {
md: 560,
sm: 560,
xs: "100%"
};
const bottom = toasts?.list?.length ? "1rem" : "-2rem";
return /* @__PURE__ */ jsx(Box, {
bottom,
className: "vui-toaster",
alignItems: "flex-end",
display: "flex",
flexDirection: "column",
gap: "8px",
maxW: width,
minW: width,
position: "fixed",
right,
zIndex: zIndices_default.toast,
children: toasts?.list?.map?.((toast) => /* @__PURE__ */ jsx(v.div, {
id: `toast_${toast.id}`,
children: toast.component
}, toast.id))
});
};
var Toaster_default = memo(Toaster);
//#endregion
export { ToastItem, Toaster_default as default, toasterWidth };
globalThis.__vuiVersion__ = "5.3.1"
//# sourceMappingURL=Toaster.js.map