import _Tooltip from "@mui/material/Tooltip";
/*!
 * 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 { InformationCircleIcon } from "./icons.generated/index.js";
import { useMuiProps } from "./MuiPropsContext.js";
import { useOdysseyDesignTokens } from "./OdysseyDesignTokensContext.js";
import { jsx as _jsx } from "react/jsx-runtime";
const IconContainer = styled.span(({
  odysseyDesignTokens
}) => ({
  display: "inline-flex",
  transitionProperty: "border-color, box-shadow, outline",
  transitionDuration: odysseyDesignTokens.TransitionDurationMain,
  border: "1px solid transparent",
  "&:focus, &:focus-visible": {
    borderColor: odysseyDesignTokens.FocusOutlineColorPrimary,
    boxShadow: `0 0 0 1px ${odysseyDesignTokens.FocusOutlineColorPrimary}`,
    outline: `${odysseyDesignTokens.FocusOutlineWidthMain} ${odysseyDesignTokens.FocusOutlineStyle} transparent`,
    outlineOffset: odysseyDesignTokens.FocusOutlineOffsetTight
  },
  svg: {
    display: "flex"
  }
}));
const IconWithTooltip = ({
  IconComponent = _jsx(InformationCircleIcon, {}),
  placement = "right",
  testId,
  tooltipText,
  translate
}) => {
  const muiProps = useMuiProps();
  const odysseyDesignTokens = useOdysseyDesignTokens();
  return _jsx(_Tooltip, {
    "data-se": testId,
    describeChild: true,
    placement: placement,
    tabIndex: 0,
    title: tooltipText,
    translate: translate,
    children: _jsx(IconContainer, {
      odysseyDesignTokens: odysseyDesignTokens,
      ...muiProps,
      children: IconComponent
    })
  });
};
const MemoizedIconWithTooltip = memo(IconWithTooltip);
MemoizedIconWithTooltip.displayName = "IconWithTooltip";
export { MemoizedIconWithTooltip as IconWithTooltip };
//# sourceMappingURL=IconWithTooltip.js.map