import type { ElementType, MouseEvent, KeyboardEvent } from 'react'; import type { PolymorphicProps } from '../../types'; export type PressEvent = MouseEvent | KeyboardEvent; /** * Event handler types for breadcrumb navigation */ export type NavigationHandler = (href: string, event: PressEvent) => void; /** * Position of breadcrumb item in the trail */ export type BreadcrumbPosition = 'first' | 'middle' | 'last'; /** * Render props provided to BreadcrumbItem children function */ export interface BreadcrumbItemRenderProps { /** * Position of this item in the breadcrumb trail */ position: BreadcrumbPosition; /** * Whether this item represents the current page */ isCurrent: boolean; /** * Whether breadcrumb navigation is disabled (from root context) */ isDisabled: boolean; } /** * Own props for Breadcrumb */ export interface BreadcrumbOwnProps { /** * Navigation event handler for routing integration * @param href - The link destination * @param event - The triggering mouse or keyboard event */ onNavigate?: NavigationHandler; /** * Disable all breadcrumb navigation * @defaultValue false */ disabled?: boolean; } /** * Props for Breadcrumb * @remarks Navigation landmark container for breadcrumb trail */ export type BreadcrumbProps = PolymorphicProps<'nav', T, BreadcrumbOwnProps>; /** * Props for BreadcrumbList * @remarks Ordered list container for breadcrumb items */ export type BreadcrumbListProps = PolymorphicProps<'ol', T>; /** * Own props for BreadcrumbItem */ export interface BreadcrumbItemOwnProps { /** * Item content (Link or Page), or a render function receiving item state */ children?: React.ReactNode | ((props: BreadcrumbItemRenderProps) => React.ReactNode); } /** * Props for BreadcrumbItem * @remarks List item wrapper for breadcrumb content */ export type BreadcrumbItemProps = PolymorphicProps<'li', T, BreadcrumbItemOwnProps>; /** * Own props for BreadcrumbLink */ export interface BreadcrumbLinkOwnProps { /** * Link destination */ href?: string; /** * Disable this specific link * @defaultValue false */ disabled?: boolean; /** * Indicates external link (adds security attributes) * @defaultValue false */ isExternal?: boolean; /** * Press event handler for click, Enter and Space. Replaces the `onNavigate` * flow (the root handler is not called when `onPress` is set). It runs after * the consumer `onClick` / `onKeyDown`, and is skipped when that handler * called `preventDefault()`. On click the anchor's native navigation is left * alone; call `event.preventDefault()` inside `onPress` to cancel it. * @param event - The triggering mouse or keyboard event */ onPress?: (event: PressEvent) => void; } /** * Props for BreadcrumbLink * @remarks Interactive link for navigation */ export type BreadcrumbLinkProps = PolymorphicProps<'a', T, BreadcrumbLinkOwnProps>; /** * Props for BreadcrumbPage * @remarks Current page indicator (non-interactive) */ export type BreadcrumbPageProps = PolymorphicProps<'span', T>; /** * Props for BreadcrumbSeparator * @remarks Visual separator between breadcrumb items */ export type BreadcrumbSeparatorProps = PolymorphicProps<'li', T>;