{"version":3,"file":"UserProfile.cjs","names":["_styled","_interopRequireDefault","require","_react","_Box","_OdysseyDesignTokensContext","_Typography","_jsxRuntime","e","__esModule","default","UserProfileContainer","styled","shouldForwardProp","prop","display","alignItems","UserProfileIconContainer","odysseyDesignTokens","paddingInlineEnd","Spacing2","UserProfile","profileIcon","userName","orgName","translate","userNameEndIcon","useOdysseyDesignTokens","jsxs","children","jsx","Box","sx","flexDirection","gap","Subordinate","color","MemoizedUserProfile","exports","memo","displayName"],"sources":["../../../src/labs/UserProfile.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 { memo, type ReactElement } from \"react\";\n\nimport { Box } from \"../Box.js\";\nimport { HtmlProps } from \"../HtmlProps.js\";\nimport {\n  DesignTokens,\n  useOdysseyDesignTokens,\n} from \"../OdysseyDesignTokensContext.js\";\nimport { Subordinate } from \"../Typography.js\";\n\nconst UserProfileContainer = styled(\"div\", {\n  shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})<{ odysseyDesignTokens: DesignTokens }>({\n  display: \"flex\",\n  alignItems: \"center\",\n});\n\nconst UserProfileIconContainer = styled(\"div\", {\n  shouldForwardProp: (prop) => prop !== \"odysseyDesignTokens\",\n})<{ odysseyDesignTokens: DesignTokens }>(({ odysseyDesignTokens }) => ({\n  display: \"flex\",\n  paddingInlineEnd: odysseyDesignTokens.Spacing2,\n}));\n\nexport type UserProfileProps = {\n  /**\n   * Org name of the logged in user\n   */\n  orgName: string;\n  /**\n   * Logged in user profile icon to be displayed in the top nav\n   */\n  profileIcon?: ReactElement;\n  /**\n   * Logged in user info to be displayed in the top nav\n   */\n  userName: string;\n  /**\n   * The icon element to display after the username\n   */\n  userNameEndIcon?: ReactElement;\n} & Pick<HtmlProps, \"translate\">;\n\nconst UserProfile = ({\n  profileIcon,\n  userName,\n  orgName,\n  translate,\n  userNameEndIcon,\n}: UserProfileProps) => {\n  const odysseyDesignTokens = useOdysseyDesignTokens();\n\n  return (\n    <UserProfileContainer odysseyDesignTokens={odysseyDesignTokens}>\n      {profileIcon && (\n        <UserProfileIconContainer odysseyDesignTokens={odysseyDesignTokens}>\n          {profileIcon}\n        </UserProfileIconContainer>\n      )}\n\n      <div>\n        {userNameEndIcon ? (\n          <Box\n            sx={{\n              display: \"flex\",\n              flexDirection: \"row\",\n              gap: odysseyDesignTokens.Spacing2,\n            }}\n          >\n            <Subordinate color=\"textPrimary\" translate={translate}>\n              {userName}\n            </Subordinate>\n            {userNameEndIcon}\n          </Box>\n        ) : (\n          <Subordinate color=\"textPrimary\" translate={translate}>\n            {userName}\n          </Subordinate>\n        )}\n        <Subordinate color=\"textSecondary\" translate={translate}>\n          {orgName}\n        </Subordinate>\n      </div>\n    </UserProfileContainer>\n  );\n};\n\nconst MemoizedUserProfile = memo(UserProfile);\nMemoizedUserProfile.displayName = \"UserProfile\";\n\nexport { MemoizedUserProfile as UserProfile };\n"],"mappings":";;;;;;AAYA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,IAAA,GAAAF,OAAA;AAEA,IAAAG,2BAAA,GAAAH,OAAA;AAIA,IAAAI,WAAA,GAAAJ,OAAA;AAA+C,IAAAK,WAAA,GAAAL,OAAA;AAAA,SAAAD,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AArB/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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