import _Alert from "@mui/material/Alert";
import _Box from "@mui/material/Box";
import _AlertTitle from "@mui/material/AlertTitle";
/*!
 * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.
 * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
 *
 * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *
 * See the License for the specific language governing permissions and limitations under the License.
 */

import styled from "@emotion/styled";
import { memo } from "react";
import { useTranslation } from "./i18n.generated/i18n.js";
import { Link } from "./Link.js";
import { useOdysseyDesignTokens } from "./OdysseyDesignTokensContext.js";
import { Paragraph } from "./Typography.js";
import { useUniqueId } from "./useUniqueId.js";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
export const calloutRoleValues = ["status", "alert"];
export const calloutSeverityValues = ["success", "info", "warning", "error"];
const ContentContainer = styled("div", {
  shouldForwardProp: prop => prop !== "odysseyDesignTokens"
})(({
  odysseyDesignTokens
}) => ({
  "& > * + *": {
    marginBlockStart: odysseyDesignTokens.Spacing4
  }
}));
const Callout = ({
  children,
  linkRel,
  linkTarget,
  linkText,
  linkUrl,
  role,
  severity,
  testId,
  text,
  title,
  translate
}) => {
  const {
    t
  } = useTranslation();
  const odysseyDesignTokens = useOdysseyDesignTokens();
  const titleId = useUniqueId();
  return _jsxs(_Alert, {
    "aria-label": t(`severity.${severity}`),
    "aria-labelledby": titleId,
    "data-se": testId,
    role: role,
    severity: severity,
    variant: "callout",
    children: [title && _jsx(_AlertTitle, {
      "aria-hidden": true,
      id: titleId,
      translate: translate,
      children: title
    }), _jsxs(ContentContainer, {
      odysseyDesignTokens: odysseyDesignTokens,
      children: [children && _jsx(_Box, {
        component: "div",
        children: children
      }), text && _jsx(Paragraph, {
        children: text
      }), linkUrl && _jsx(_Box, {
        children: _jsx(Link, {
          href: linkUrl,
          rel: linkRel,
          target: linkTarget,
          variant: "monochrome",
          children: linkText
        })
      })]
    })]
  });
};
const MemoizedCallout = memo(Callout);
MemoizedCallout.displayName = "Callout";
export { MemoizedCallout as Callout };
//# sourceMappingURL=Callout.js.map