UNPKG

@trail-ui/react

Version:
24 lines (21 loc) 668 B
import { Flag } from "./chunk-7FMTYK2I.mjs"; // src/toast/toast.tsx import { toast } from "react-toastify"; import { jsx } from "react/jsx-runtime"; function capitalizeText(text) { return (text == null ? void 0 : text.split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ")) || ""; } function customToast(message, type, title, options = {}) { toast( /* @__PURE__ */ jsx("div", { className: "w-full overflow-hidden rounded", children: /* @__PURE__ */ jsx(Flag, { variant: type, title: title != null ? title : capitalizeText(type), desc: message }) }), { delay: 1e3, ...options } ); } export { customToast };