{"version":3,"file":"AppSwitcherApp.cjs","names":["_styled","_interopRequireDefault","require","_react","_MuiPropsContext","_OdysseyDesignTokensContext","_Tooltip","_jsxRuntime","e","__esModule","default","AppSwitcherAppWrapperComponent","styled","shouldForwardProp","prop","odysseyDesignTokens","margin","marginBlockEnd","Spacing3","textAlign","AppSwitcherAppLinkComponent","includes","isSelected","display","padding","Spacing1","backgroundColor","PalettePrimaryLighter","borderRadius","BorderRadiusTight","transition","TransitionDurationMain","HueNeutral50","AppSwitcherAppSkeletonWrapperComponent","AppSwitcherAppImgComponent","width","Spacing6","height","AppSwitcherApp","appIconDefaultUrl","appIconSelectedUrl","appName","label","linkUrl","selectedAppName","useOdysseyDesignTokens","renderAppIconLink","useCallback","muiProps","jsx","undefined","href","children","role","src","Tooltip","ariaType","placement","text","translate","MuiPropsContext","Consumer","exports","AppSwitcherAppSkeleton","_Skeleton2","variant"],"sources":["../../../../src/ui-shell/AppSwitcher/AppSwitcherApp.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 { Skeleton } from \"@mui/material\";\nimport { useCallback } from \"react\";\n\nimport { MuiPropsContext, MuiPropsContextType } from \"../../MuiPropsContext.js\";\nimport {\n  DesignTokens,\n  useOdysseyDesignTokens,\n} from \"../../OdysseyDesignTokensContext.js\";\nimport { Tooltip } from \"../../Tooltip.js\";\n\nconst AppSwitcherAppWrapperComponent = styled(\"li\", {\n  shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})<{ odysseyDesignTokens: DesignTokens }>(({ odysseyDesignTokens }) => ({\n  margin: \"auto\",\n  marginBlockEnd: odysseyDesignTokens.Spacing3,\n  textAlign: \"center\",\n}));\n\nconst AppSwitcherAppLinkComponent = styled(\"a\", {\n  shouldForwardProp: (prop) =>\n    ![\"isSelected\", \"odysseyDesignTokens\"].includes(prop),\n})(\n  ({\n    odysseyDesignTokens,\n    isSelected,\n  }: {\n    isSelected: boolean;\n    odysseyDesignTokens: DesignTokens;\n  }) => ({\n    display: \"inline-block\",\n    margin: \"auto\",\n    padding: odysseyDesignTokens.Spacing1,\n    backgroundColor: isSelected\n      ? odysseyDesignTokens.PalettePrimaryLighter\n      : \"transparent\",\n    borderRadius: odysseyDesignTokens.BorderRadiusTight,\n    transition: `background-color ${odysseyDesignTokens.TransitionDurationMain}`,\n\n    \"&:hover, &:focus\": {\n      backgroundColor: odysseyDesignTokens.HueNeutral50,\n    },\n  }),\n);\n\n// Similar to AppSwitcherAppLinkComponent\nconst AppSwitcherAppSkeletonWrapperComponent = styled(\"div\", {\n  shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})<{ odysseyDesignTokens: DesignTokens }>(({ odysseyDesignTokens }) => ({\n  display: \"inline-block\",\n  margin: \"auto\",\n  padding: odysseyDesignTokens.Spacing1,\n}));\n\nconst AppSwitcherAppImgComponent = styled(\"img\", {\n  shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})<{ odysseyDesignTokens: DesignTokens }>(({ odysseyDesignTokens }) => ({\n  display: \"block\",\n  width: odysseyDesignTokens.Spacing6,\n  height: odysseyDesignTokens.Spacing6,\n}));\n\nexport interface AppSwitcherAppIconData {\n  appIconDefaultUrl: string;\n  appIconSelectedUrl: string;\n  appName: string;\n  label: string;\n  linkUrl: string;\n}\n\nexport type AppSwitcherAppProps = AppSwitcherAppIconData & {\n  selectedAppName?: string;\n};\n\nexport const AppSwitcherApp = ({\n  appIconDefaultUrl,\n  appIconSelectedUrl,\n  appName,\n  label,\n  linkUrl,\n  selectedAppName,\n}: AppSwitcherAppProps) => {\n  const odysseyDesignTokens = useOdysseyDesignTokens();\n  const isSelected = appName === selectedAppName;\n\n  const renderAppIconLink = useCallback(\n    (muiProps: MuiPropsContextType) => (\n      <AppSwitcherAppLinkComponent\n        {...muiProps}\n        aria-current={isSelected ? \"page\" : undefined}\n        href={linkUrl}\n        isSelected={isSelected}\n        odysseyDesignTokens={odysseyDesignTokens}\n      >\n        <AppSwitcherAppImgComponent\n          odysseyDesignTokens={odysseyDesignTokens}\n          role=\"presentation\"\n          src={isSelected ? appIconSelectedUrl : appIconDefaultUrl}\n        />\n      </AppSwitcherAppLinkComponent>\n    ),\n    [\n      odysseyDesignTokens,\n      isSelected,\n      linkUrl,\n      appIconDefaultUrl,\n      appIconSelectedUrl,\n    ],\n  );\n\n  return (\n    <AppSwitcherAppWrapperComponent odysseyDesignTokens={odysseyDesignTokens}>\n      <Tooltip ariaType=\"label\" placement=\"right\" text={label} translate=\"no\">\n        <MuiPropsContext.Consumer>{renderAppIconLink}</MuiPropsContext.Consumer>\n      </Tooltip>\n    </AppSwitcherAppWrapperComponent>\n  );\n};\n\nexport const AppSwitcherAppSkeleton = () => {\n  const odysseyDesignTokens = useOdysseyDesignTokens();\n  return (\n    <AppSwitcherAppWrapperComponent odysseyDesignTokens={odysseyDesignTokens}>\n      <AppSwitcherAppSkeletonWrapperComponent\n        odysseyDesignTokens={odysseyDesignTokens}\n      >\n        <Skeleton\n          height={odysseyDesignTokens.Spacing6}\n          variant=\"rounded\"\n          width={odysseyDesignTokens.Spacing6}\n        />\n      </AppSwitcherAppSkeletonWrapperComponent>\n    </AppSwitcherAppWrapperComponent>\n  );\n};\n"],"mappings":";;;;;;;AAYA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,2BAAA,GAAAH,OAAA;AAIA,IAAAI,QAAA,GAAAJ,OAAA;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