import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
import * as React from 'react';
import { forwardRef, Children, cloneElement } from 'react';
import { c as cx } from './index-De1g9FRV.js';
import { u as useLayoutPropsUtil } from './useLayoutPropsUtil-DjqeAJZ9.js';
import { L as Link } from './Link-C7dtI5K6.js';
import { T as Text } from './Text-mDcQHC2U.js';
import { I as Icon } from './Icon-B4uCvMU9.js';

import './Breadcrumbs.css';const SvgChevronRight = (props) => /* @__PURE__ */ React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24", ...props }, /* @__PURE__ */ React.createElement("path", { d: "M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z" }));

const breadcrumbs = "_breadcrumbs_rz0m1_1";
const styles = {
	breadcrumbs: breadcrumbs,
	"breadcrumbs-link": "_breadcrumbs-link_rz0m1_17"
};

const BreadcrumbsLink = forwardRef((props, ref) => {
  const { layoutStyles, componentProps } = useLayoutPropsUtil(props);
  const { children, className, style, ...rest } = componentProps;
  const classes = cx([styles["breadcrumbs-link"]], className, {});
  const styleCombined = {
    ...style,
    ...layoutStyles
  };
  return /* @__PURE__ */ jsx(
    Link,
    {
      tabIndex: 0,
      "data-anv": "breadcrumbs-link",
      style: styleCombined,
      appearance: "secondary",
      className: classes,
      ...rest,
      ref,
      children: /* @__PURE__ */ jsx(Text, { size: "small", inline: true, children })
    }
  );
});
BreadcrumbsLink.displayName = "BreadcrumbsLink";

const Breadcrumbs = Object.assign(
  forwardRef(
    function BreadcrumbsInner(props, ref) {
      const { layoutStyles, componentProps } = useLayoutPropsUtil(props);
      const { children, className, style, ...rest } = componentProps;
      const classes = cx([styles["breadcrumbs"]], className, {});
      const styleCombined = {
        ...style,
        ...layoutStyles
      };
      const linkCount = Children.count(children);
      return /* @__PURE__ */ jsx(
        "nav",
        {
          "data-anv": "breadcrumbs",
          style: styleCombined,
          className: classes,
          "aria-label": "Breadcrumb",
          ...rest,
          ref,
          children: Children.map(children, (link, i) => {
            if (i + 1 === linkCount) {
              return /* @__PURE__ */ jsx(
                Text,
                {
                  inline: true,
                  size: "small",
                  style: {
                    fontWeight: "bold"
                  },
                  children: link.props.children
                }
              );
            } else {
              return /* @__PURE__ */ jsxs(Fragment, { children: [
                cloneElement(link),
                /* @__PURE__ */ jsx(Icon, { svg: SvgChevronRight, "aria-hidden": "true" })
              ] });
            }
          })
        }
      );
    }
  ),
  {
    /**
     * BreadcrumbsLink component for individual breadcrumb navigation items.
     *
     * Features:
     * - Renders as a clickable link with secondary appearance
     * - Supports all standard anchor element props
     * - Includes layout utilities for positioning and spacing
     * - Uses small text size for consistent styling
     * - Fully accessible with proper focus management
     * - Automatically applies secondary link styling
     *
     * @example
     * <Breadcrumbs.Link href="/dashboard">Dashboard</Breadcrumbs.Link>
     */
    Link: BreadcrumbsLink
  }
);
Breadcrumbs.displayName = "Breadcrumbs";

export { Breadcrumbs as B };
//# sourceMappingURL=Breadcrumbs-VzOM2nBU.js.map
