/*!
 * Copyright (c) 2024-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, useMemo } from "react";
import { Badge } from "../../Badge.js";
import { Box } from "../../Box.js";
import { useOdysseyDesignTokens } from "../../OdysseyDesignTokensContext.js";
import { Status } from "../../Status.js";
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
const SideNavItemLabelContainer = styled("div", {
  shouldForwardProp: prop => prop !== "odysseyDesignTokens" && prop !== "isIconVisible"
})(({
  odysseyDesignTokens,
  isIconVisible
}) => ({
  width: "100%",
  marginInlineStart: isIconVisible ? odysseyDesignTokens.Spacing3 : 0,
  alignItems: "center",
  display: "flex",
  fontSize: odysseyDesignTokens.TypographySizeBody,
  overflowWrap: "anywhere"
}));
const SideNavItemLinkContent = ({
  count,
  label,
  startIcon,
  endIcon,
  severity,
  statusLabel,
  translate
}) => {
  const odysseyDesignTokens = useOdysseyDesignTokens();
  const sideNavItemContentStyles = useMemo(() => ({
    alignItems: "center",
    display: "flex",
    gap: odysseyDesignTokens.Spacing1,
    marginInlineStart: odysseyDesignTokens.Spacing2
  }), [odysseyDesignTokens]);
  return _jsxs(_Fragment, {
    children: [startIcon && startIcon, _jsxs(SideNavItemLabelContainer, {
      isIconVisible: Boolean(startIcon),
      odysseyDesignTokens: odysseyDesignTokens,
      translate: translate,
      children: [label, !count && severity && _jsx(Box, {
        sx: sideNavItemContentStyles,
        children: severity && _jsx(Status, {
          label: statusLabel || "",
          severity: severity
        })
      }), !severity && count && _jsx(Box, {
        sx: sideNavItemContentStyles,
        children: count && _jsx(Badge, {
          badgeContent: count
        })
      })]
    }), endIcon && endIcon]
  });
};
const MemoizedSideNavItemLinkContent = memo(SideNavItemLinkContent);
MemoizedSideNavItemLinkContent.displayName = "SideNavItemLinkContent";
export { MemoizedSideNavItemLinkContent as SideNavItemLinkContent };
//# sourceMappingURL=SideNavItemLinkContent.js.map