const require_runtime = require("../../_virtual/_rolldown/runtime.js");
const require_objectSpread2 = require("../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js");
const require_objectWithoutProperties = require("../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js");
const require_index = require("../iconfont/index.js");
let react = require("react");
react = require_runtime.__toESM(react);
let antd = require("antd");
let classnames = require("classnames");
classnames = require_runtime.__toESM(classnames);
require("./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 = require_objectWithoutProperties._objectWithoutProperties(props, _excluded);
	const [visible, setVisible] = (0, react.useState)(true);
	return visible && /* @__PURE__ */ react.default.createElement(antd.Alert, require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, others), {}, {
		icon: /* @__PURE__ */ react.default.createElement("div", { className: "pisell-alert-type-icon" }, icon || /* @__PURE__ */ react.default.createElement(require_index.default, { type: iconMap[type] })),
		message,
		description: /* @__PURE__ */ react.default.createElement("div", null, /* @__PURE__ */ react.default.createElement("div", null, description), (showDismiss || showView) && /* @__PURE__ */ react.default.createElement("div", { className: "pisell-alert-action-wrap" }, showDismiss && /* @__PURE__ */ react.default.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.default.createElement("span", {
			className: "pisell-action-item pisell-action-view",
			onClick: onViewClick
		}, view))),
		type,
		showIcon,
		closable,
		className: (0, classnames.default)(className, "pisell-alert-wrap")
	}));
};
//#endregion
exports.default = PisellAlert;
