import { jsxs, jsx } from "react/jsx-runtime";
import { forwardRef } from "react";
import default_1$1 from "../../node_modules/@mui/icons-material/Cancel.js";
import default_1$4 from "../../node_modules/@mui/icons-material/CheckCircle.js";
import default_1 from "../../node_modules/@mui/icons-material/Close.js";
import default_1$3 from "../../node_modules/@mui/icons-material/Info.js";
import default_1$2 from "../../node_modules/@mui/icons-material/Warning.js";
import { Button } from "../Button/index.js";
/* empty css                  */
import Alert$1 from "../../node_modules/@mui/material/Alert/Alert.js";
import AlertTitle from "../../node_modules/@mui/material/AlertTitle/AlertTitle.js";
const Alert = forwardRef(
  ({
    severity,
    title,
    description = "",
    actionName = "",
    onAction,
    onClose,
    actionButtonProps,
    children,
    subtleBackground,
    className = "",
    ...args
  }, ref) => {
    const classStr = `ia-styles ia-alert ${subtleBackground ? "ia-subtleBackground" : ""} ${className}`.trim();
    const displayTitle = title ?? severity.charAt(0).toUpperCase() + severity.slice(1);
    return /* @__PURE__ */ jsxs(
      Alert$1,
      {
        ref,
        "aria-live": severity === "error" ? "assertive" : "polite",
        className: classStr,
        iconMapping: {
          success: /* @__PURE__ */ jsx(default_1$4, { fontSize: "small" }),
          info: /* @__PURE__ */ jsx(default_1$3, { fontSize: "small" }),
          warning: /* @__PURE__ */ jsx(default_1$2, { fontSize: "small" }),
          error: /* @__PURE__ */ jsx(default_1$1, { fontSize: "small" })
        },
        role: "alert",
        severity,
        ...args,
        children: [
          /* @__PURE__ */ jsxs("div", { className: "ia-alert-body", children: [
            /* @__PURE__ */ jsx(AlertTitle, { children: displayTitle }),
            actionName && onAction ? /* @__PURE__ */ jsx(
              Button,
              {
                "aria-label": actionName,
                size: "small",
                variant: "url",
                onClick: onAction,
                ...actionButtonProps,
                children: actionName
              }
            ) : null,
            onClose ? /* @__PURE__ */ jsx(
              Button,
              {
                "aria-label": "Close alert",
                className: "close_btn_alert",
                size: "small",
                variant: "text",
                onClick: onClose,
                children: /* @__PURE__ */ jsx(default_1, { fontSize: "small" })
              }
            ) : null
          ] }),
          description ? /* @__PURE__ */ jsx("span", { className: "description", children: description }) : null,
          children
        ]
      }
    );
  }
);
Alert.displayName = "Alert";
export {
  Alert
};
