import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import { _objectWithoutProperties } from "../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js";
import IconFont from "../iconfont/index.js";
import React, { useState } from "react";
import { Alert } from "antd";
import classNames from "classnames";
import "./index.less";
//#region src/components/pisellAlert/index.tsx
const _excluded = [
	"message",
	"description",
	"type",
	"showIcon",
	"icon",
	"closable",
	"className",
	"showDismiss",
	"dismiss",
	"showView",
	"view",
	"onViewClick"
];
const iconMap = {
	success: "pisell2-check-circle",
	warning: "pisell2-alert-circle",
	error: "pisell2-alert-circle",
	info: "pisell2-alert-circle"
};
/**
* PisellAlert警告提示组件
* @param props
* @constructor
*/
const PisellAlert = (props) => {
	const { message, description, type = "success", showIcon, icon, closable, className, showDismiss, dismiss, showView, view, onViewClick } = props, others = _objectWithoutProperties(props, _excluded);
	const [visible, setVisible] = useState(true);
	return visible && /* @__PURE__ */ React.createElement(Alert, _objectSpread2(_objectSpread2({}, others), {}, {
		icon: /* @__PURE__ */ React.createElement("div", { className: "pisell-alert-type-icon" }, icon || /* @__PURE__ */ React.createElement(IconFont, { type: iconMap[type] })),
		message,
		description: /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", null, description), (showDismiss || showView) && /* @__PURE__ */ React.createElement("div", { className: "pisell-alert-action-wrap" }, showDismiss && /* @__PURE__ */ React.createElement("span", {
			className: "pisell-action-item pisell-action-dismiss",
			onClick: (e) => {
				var _props$onClose;
				setVisible(false);
				props === null || props === void 0 || (_props$onClose = props.onClose) === null || _props$onClose === void 0 || _props$onClose.call(props, e);
			}
		}, dismiss), showView && /* @__PURE__ */ React.createElement("span", {
			className: "pisell-action-item pisell-action-view",
			onClick: onViewClick
		}, view))),
		type,
		showIcon,
		closable,
		className: classNames(className, "pisell-alert-wrap")
	}));
};
//#endregion
export { PisellAlert as default };
