// ~/src/siteplane/components/breadcrumb/breadcrumb.tsx
"use client";
import { mergeProps } from "@base-ui/react/merge-props";
import { useRender } from "@base-ui/react/use-render";
import { ChevronRightIcon, MoreHorizontalIcon } from "lucide-react";
import * as React from "react";
import { cn } from "../../system/utils/cn";
import { slotClass } from "../../system/utils/slot-class";
export function Breadcrumb(props: React.ComponentProps<"nav">) {
return (
);
}
export function BreadcrumbList({
className,
...props
}: React.ComponentProps<"ol">) {
// The trail wraps by default; design-rework.css owns the wrap, so a header
// bar can keep it on one line (Dashboard Shell).
return (
);
}
export function BreadcrumbItem({
className,
...props
}: React.ComponentProps<"li">) {
// A crumb can shrink below its text, so a long one never runs past the
// trail: the current page ends with an ellipsis, a link wraps.
return (
);
}
export function BreadcrumbLink({
className,
render,
...props
}: useRender.ComponentProps<"a">) {
const defaultProps = {
className: cn(
slotClass("breadcrumb-link", props, render),
"hover:text-foreground",
className,
),
"data-slot": "breadcrumb-link",
};
return useRender({
defaultTagName: "a",
props: mergeProps<"a">(defaultProps, props),
render,
});
}
export function BreadcrumbPage({
className,
children,
title,
...props
}: React.ComponentProps<"span">) {
// The current page stays on one line and ends with an ellipsis when the
// trail has no room for it; plain text keeps its full value in title (K5).
return (
{children}
);
}
/** The text of children made of strings and numbers only, such as `Invoice {id}`. */
function plainText(children: React.ReactNode): string | undefined {
const parts = React.Children.toArray(children);
const text = parts.every(
(part) => typeof part === "string" || typeof part === "number",
)
? parts.join("")
: "";
return text === "" ? undefined : text;
}
export function BreadcrumbSeparator({
children,
className,
...props
}: React.ComponentProps<"li">) {
// The default chevron points to the next level, at the inline end: it
// mirrors in a right-to-left page.
return (