import { jsxs, jsx } from 'react/jsx-runtime';
import { forwardRef } from 'react';
import { S as SvgClose } from './close-DZj38AEh.js';
import { S as SvgInfo } from './info-CYpG6tcI.js';
import { S as SvgWarning } from './warning-c4Wj1rI4.js';
import { S as SvgError } from './error-DR_wWdYY.js';
import { S as SvgCheckCircle } from './check_circle-CM0ukqXv.js';
import { B as Button } from './Button-Bnt8XUI7.js';
import { I as Icon } from './Icon-BMMbp40n.js';
import { c as cx } from './index-De1g9FRV.js';
import { u as useLayoutPropsUtil } from './useLayoutPropsUtil-CB_zHDbW.js';
import { useTrackingId } from './useTrackingId.js';

import './Announcement.css';const announcement = "_announcement_kpf9b_1";
const title = "_title_kpf9b_83";
const success = "_success_kpf9b_101";
const warning = "_warning_kpf9b_110";
const danger = "_danger_kpf9b_119";
const styles = {
	announcement: announcement,
	"close-button": "_close-button_kpf9b_34",
	"close-container": "_close-container_kpf9b_56",
	"title-container": "_title-container_kpf9b_83",
	title: title,
	"status-icon": "_status-icon_kpf9b_97",
	success: success,
	warning: warning,
	danger: danger
};

const statusIconMap = {
  info: SvgInfo,
  success: SvgCheckCircle,
  warning: SvgWarning,
  danger: SvgError
};
const Announcement = forwardRef(
  (props, ref) => {
    const { layoutStyles, componentProps } = useLayoutPropsUtil(props);
    const {
      className,
      title,
      status = "info",
      children,
      style,
      onClose,
      ...rest
    } = componentProps;
    const data = {
      title,
      status
    };
    const trackingId = useTrackingId({
      name: "Announcement",
      data,
      hasOverride: !!props["data-tracking-id"]
    });
    const AnnouncementCx = cx(styles["announcement"], className, {
      [styles["success"]]: status === "success",
      [styles["warning"]]: status === "warning",
      [styles["danger"]]: status === "danger"
    });
    const styleCombined = {
      ...style,
      ...layoutStyles
    };
    return /* @__PURE__ */ jsxs(
      "div",
      {
        "data-tracking-id": trackingId,
        role: "status",
        className: AnnouncementCx,
        "data-anv": "announcement",
        style: styleCombined,
        ...rest,
        ref,
        children: [
          /* @__PURE__ */ jsxs("span", { className: styles["title-container"], children: [
            /* @__PURE__ */ jsx(
              Icon,
              {
                size: "large",
                className: styles["status-icon"],
                svg: statusIconMap[status]
              }
            ),
            /* @__PURE__ */ jsx("span", { className: styles["title"], children: title })
          ] }),
          children,
          onClose ? /* @__PURE__ */ jsx("span", { className: styles["close-container"], children: /* @__PURE__ */ jsx(
            Button,
            {
              icon: SvgClose,
              size: "small",
              appearance: "ghost",
              className: styles["close-button"],
              onClick: (e) => onClose(e),
              "aria-label": `Dismiss ${status} announcement`
            }
          ) }) : null
        ]
      }
    );
  }
);
Announcement.displayName = "Announcement";

export { Announcement as A };
//# sourceMappingURL=Announcement-_C5g2Lzm.js.map
