import IconFont from "../iconfont/index.js";
import { message } from "../pisellMessage/index.js";
import "./squareToast/index.js";
import React from "react";
import { getUniqueId } from "@pisell/utils";
import "./index.less";
//#region src/components/pisellToast/index.tsx
const PisellToast = (props) => {
	const { content, duration, showAction, actionText, onClose } = props;
	const key = getUniqueId();
	if (!message) return alert(content);
	message.open({
		key,
		content: /* @__PURE__ */ React.createElement("div", { className: "pisell-toast-content" }, /* @__PURE__ */ React.createElement("span", null, content), showAction && /* @__PURE__ */ React.createElement("span", { className: "pisell-toast-action" }, actionText), /* @__PURE__ */ React.createElement(IconFont, {
			type: "pisell2-x-close",
			className: "pisell-toast-close",
			onClick: () => message.destroy(key)
		})),
		icon: null,
		duration: duration || 5,
		className: "pisell-toast-wrap",
		onClose
	});
};
//#endregion
export { PisellToast as default };
