{"version":3,"file":"IconWithTooltip.cjs","names":["_styled","_interopRequireDefault","require","_react","_index","_MuiPropsContext","_OdysseyDesignTokensContext","_jsxRuntime","e","__esModule","default","IconContainer","styled","span","odysseyDesignTokens","display","transitionProperty","transitionDuration","TransitionDurationMain","border","borderColor","FocusOutlineColorPrimary","boxShadow","outline","FocusOutlineWidthMain","FocusOutlineStyle","outlineOffset","FocusOutlineOffsetTight","svg","IconWithTooltip","IconComponent","jsx","InformationCircleIcon","placement","testId","tooltipText","translate","muiProps","useMuiProps","useOdysseyDesignTokens","_Tooltip2","describeChild","tabIndex","title","children","role","MemoizedIconWithTooltip","exports","memo","displayName"],"sources":["../../src/IconWithTooltip.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport type { TooltipProps as MuiTooltipProps } from \"@mui/material\";\n\nimport styled from \"@emotion/styled\";\nimport { Tooltip as MuiTooltip } from \"@mui/material\";\nimport { memo, ReactNode } from \"react\";\n\nimport { HtmlProps } from \"./HtmlProps.js\";\nimport { InformationCircleIcon } from \"./icons.generated/index.js\";\nimport { useMuiProps } from \"./MuiPropsContext.js\";\nimport {\n  DesignTokens,\n  useOdysseyDesignTokens,\n} from \"./OdysseyDesignTokensContext.js\";\n\nconst IconContainer = styled.span<{\n  odysseyDesignTokens: DesignTokens;\n}>(({ odysseyDesignTokens }) => ({\n  display: \"inline-flex\",\n  transitionProperty: \"border-color, box-shadow, outline\",\n  transitionDuration: odysseyDesignTokens.TransitionDurationMain,\n  border: \"1px solid transparent\",\n\n  \"&:focus, &:focus-visible\": {\n    borderColor: odysseyDesignTokens.FocusOutlineColorPrimary,\n    boxShadow: `0 0 0 1px ${odysseyDesignTokens.FocusOutlineColorPrimary}`,\n    outline: `${odysseyDesignTokens.FocusOutlineWidthMain} ${odysseyDesignTokens.FocusOutlineStyle} transparent`,\n    outlineOffset: odysseyDesignTokens.FocusOutlineOffsetTight,\n  },\n\n  svg: {\n    display: \"flex\",\n  },\n}));\n\nexport type IconWithTooltipProps = {\n  /**\n   * The icon to render. Defaults to `InformationCircleIcon`.\n   * @default `<InformationCircleIcon />`\n   */\n  IconComponent?: ReactNode;\n  /**\n   * The placement of the Tooltip.\n   * @default \"right\"\n   */\n  placement?: MuiTooltipProps[\"placement\"];\n  /**\n   * The text to display in the Tooltip\n   */\n  tooltipText: string;\n} & Pick<HtmlProps, \"testId\" | \"translate\">;\n\n/**\n * Displays an icon (defaulting to an information circle) that reveals a tooltip on focus or hover. Use it to surface supplementary help text inline next to a label or form field.\n */\nconst IconWithTooltip = ({\n  IconComponent = <InformationCircleIcon />,\n  placement = \"right\",\n  testId,\n  tooltipText,\n  translate,\n}: IconWithTooltipProps) => {\n  const muiProps = useMuiProps();\n  const odysseyDesignTokens = useOdysseyDesignTokens();\n\n  return (\n    <MuiTooltip\n      data-se={testId}\n      describeChild\n      placement={placement}\n      tabIndex={0}\n      title={tooltipText}\n      translate={translate}\n    >\n      <IconContainer\n        aria-label={tooltipText}\n        odysseyDesignTokens={odysseyDesignTokens}\n        role=\"img\"\n        {...muiProps}\n      >\n        {IconComponent}\n      </IconContainer>\n    </MuiTooltip>\n  );\n};\n\nconst MemoizedIconWithTooltip = memo(IconWithTooltip);\nMemoizedIconWithTooltip.displayName = \"IconWithTooltip\";\n\nexport { MemoizedIconWithTooltip as IconWithTooltip };\n"],"mappings":";;;;;;;AAcA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAGA,IAAAE,MAAA,GAAAF,OAAA;AACA,IA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