{"version":3,"file":"UiShellLogo.cjs","names":["_styled","_interopRequireDefault","require","_react","_OktaLogo","_jsxRuntime","e","__esModule","default","StyledLogoContainer","styled","shouldForwardProp","prop","isLogoInteractive","alignItems","display","height","cursor","StyledLogoLink","UiShellLogo","imageAltText","imageUrl","logoComponent","optionalProps","logo","useMemo","jsx","alt","src","OktaLogo","ariaLabel","href","onClick","children","Boolean","role","MemoizedUiShellLogo","exports","memo","displayName"],"sources":["../../../src/ui-shell/UiShellLogo.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2024-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 styled from \"@emotion/styled\";\nimport {\n  memo,\n  type MouseEventHandler,\n  type ReactElement,\n  useMemo,\n} from \"react\";\n\nimport { OktaLogo } from \"./SideNav/OktaLogo.js\";\n\nconst StyledLogoContainer = styled(\"div\", {\n  shouldForwardProp: (prop) => prop !== \"isLogoInteractive\",\n})<{\n  isLogoInteractive?: boolean;\n}>(({ isLogoInteractive }) => ({\n  alignItems: \"center\",\n  display: \"flex\",\n  height: \"100%\",\n\n  ...(isLogoInteractive && {\n    cursor: \"pointer\",\n  }),\n}));\n\nconst StyledLogoLink = styled(\"a\")(() => ({\n  alignItems: \"center\",\n  display: \"flex\",\n  height: \"100%\",\n}));\n\nexport type UiShellLogoProps = {\n  isSameBackgroundAsMain?: boolean;\n  /**\n   * Event fired when the logo is clicked\n   */\n  onClick?: MouseEventHandler<HTMLDivElement | HTMLAnchorElement>;\n} & (\n  | {\n      ariaLabel: string;\n      href: string;\n    }\n  | {\n      ariaLabel?: never;\n      href?: never;\n    }\n) &\n  (\n    | {\n        imageAltText?: never;\n        imageUrl?: never;\n        /**\n         * a component to render as the logo\n         */\n        logoComponent: ReactElement;\n      }\n    | {\n        /**\n         * alt text for the img logo\n         */\n        imageAltText: string;\n        /**\n         * The src url to render in an `img` tag\n         */\n        imageUrl: string;\n        logoComponent?: never;\n      }\n    | {\n        /**\n         * alt text for the img logo\n         */\n        imageAltText?: never;\n        /**\n         * The src url to render in an `img` tag\n         */\n        imageUrl?: never;\n        logoComponent?: never;\n      }\n  );\n\nconst UiShellLogo = ({\n  imageAltText,\n  imageUrl,\n  logoComponent,\n  ...optionalProps\n}: UiShellLogoProps) => {\n  const logo = useMemo(() => {\n    if (logoComponent) {\n      return logoComponent;\n    }\n\n    if (imageAltText && imageUrl) {\n      return <img alt={imageAltText} src={imageUrl} />;\n    }\n\n    return <OktaLogo />;\n  }, [imageAltText, logoComponent, imageUrl]);\n\n  return \"href\" in optionalProps && \"ariaLabel\" in optionalProps ? (\n    <StyledLogoLink\n      aria-label={optionalProps.ariaLabel}\n      data-se=\"sidenav-header-logo\"\n      href={optionalProps.href}\n      onClick={optionalProps.onClick}\n    >\n      {logo}\n    </StyledLogoLink>\n  ) : (\n    <StyledLogoContainer\n      aria-label={optionalProps.ariaLabel}\n      data-se=\"sidenav-header-logo\"\n      isLogoInteractive={Boolean(optionalProps.onClick) || optionalProps.href}\n      onClick={optionalProps.onClick}\n      role=\"presentation\"\n    >\n      {logo}\n    </StyledLogoContainer>\n  );\n};\n\nconst MemoizedUiShellLogo = memo(UiShellLogo);\nMemoizedUiShellLogo.displayName = \"UiShellLogo\";\n\nexport { MemoizedUiShellLogo as UiShellLogo };\n"],"mappings":";;;;;;AAYA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAOA,IAAAE,SAAA,GAAAF,OAAA;AAAiD,IAAAG,WAAA,GAAAH,OAAA;AAAA,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IA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