'use client'; import * as React from 'react'; import { cva, type VariantProps } from '@/lib/cva'; import { ChevronRightIcon, MoreHorizontalIcon } from '@/icons'; import * as Slot from 'radix-ui/slot'; import { cn } from '@/lib/utils'; import { colorPalettes } from '@/lib/cva-presets'; /* * CBAR builds each crumb out of its Button component, which is why the sizes * below are button heights rather than line heights. The list publishes the * size as `data-size` and the crumbs read it back with `group-data-*`, so a * caller sets it once. */ const breadcrumbListVariants = cva( 'group/breadcrumb-list flex flex-wrap items-center gap-1 break-words text-foreground', { variants: { size: { xs: 'text-xs', md: 'text-sm', }, /** Only the separator takes palette colour; CBAR draws it turquoise. */ colorPalette: colorPalettes, }, defaultVariants: { size: 'md', colorPalette: 'secondary', }, } ); export type BreadcrumbProps = React.ComponentProps<'nav'>; export interface BreadcrumbListProps extends React.ComponentProps<'ol'>, VariantProps {} export interface BreadcrumbLinkProps extends React.ComponentProps<'a'> { /** Render the child element instead of an `` — e.g. a router ``. */ asChild?: boolean; } /** * Trail showing where the current page sits in the hierarchy. * * The last crumb is the current page: render it as `BreadcrumbPage`, not a * link, so it is announced with `aria-current="page"`. */ function Breadcrumb(props: BreadcrumbProps) { return