"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.calloutSeverityValues = exports.calloutRoleValues = exports.Callout = void 0;
var _Alert2 = _interopRequireDefault(require("@mui/material/Alert"));
var _Box2 = _interopRequireDefault(require("@mui/material/Box"));
var _AlertTitle2 = _interopRequireDefault(require("@mui/material/AlertTitle"));
var _styled = _interopRequireDefault(require("@emotion/styled"));
var _react = require("react");
var _i18n = require("./i18n.generated/i18n.cjs");
var _Link = require("./Link.cjs");
var _OdysseyDesignTokensContext = require("./OdysseyDesignTokensContext.cjs");
var _Typography = require("./Typography.cjs");
var _useUniqueId = require("./useUniqueId.cjs");
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
/*!
 * 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.
 */

const calloutRoleValues = exports.calloutRoleValues = ["status", "alert"];
const calloutSeverityValues = exports.calloutSeverityValues = ["success", "info", "warning", "error"];
const ContentContainer = (0, _styled.default)("div", {
  shouldForwardProp: prop => prop !== "odysseyDesignTokens"
})(({
  odysseyDesignTokens
}) => ({
  "& > * + *": {
    marginBlockStart: odysseyDesignTokens.Spacing4
  }
}));
const Callout = ({
  children,
  linkRel,
  linkTarget,
  linkText,
  linkUrl,
  onLinkClick,
  role,
  severity,
  testId,
  text,
  title,
  translate
}) => {
  const {
    t
  } = (0, _i18n.useTranslation)();
  const odysseyDesignTokens = (0, _OdysseyDesignTokensContext.useOdysseyDesignTokens)();
  const titleId = (0, _useUniqueId.useUniqueId)();
  return (0, _jsxRuntime.jsxs)(_Alert2.default, {
    "aria-label": t(`severity.${severity}`),
    "aria-labelledby": titleId,
    "data-se": testId,
    role: role,
    severity: severity,
    variant: "callout",
    children: [title && (0, _jsxRuntime.jsx)(_AlertTitle2.default, {
      "aria-hidden": true,
      id: titleId,
      translate: translate,
      children: title
    }), (0, _jsxRuntime.jsxs)(ContentContainer, {
      odysseyDesignTokens: odysseyDesignTokens,
      children: [children && (0, _jsxRuntime.jsx)(_Box2.default, {
        component: "div",
        children: children
      }), text && (0, _jsxRuntime.jsx)(_Typography.Paragraph, {
        children: text
      }), linkText && (0, _jsxRuntime.jsx)(_Box2.default, {
        children: (0, _jsxRuntime.jsx)(_Link.Link, {
          href: linkUrl ?? "#",
          onClick: onLinkClick,
          rel: linkRel,
          target: linkTarget,
          variant: "monochrome",
          children: linkText
        })
      })]
    })]
  });
};
const MemoizedCallout = exports.Callout = (0, _react.memo)(Callout);
MemoizedCallout.displayName = "Callout";
//# sourceMappingURL=Callout.cjs.map