import type { Snippet } from 'svelte'; import type { HTMLAttributes } from 'svelte/elements'; import type { IconComponent } from '../../icons/index.js'; import type { BreadcrumbSlots, BreadcrumbVariants } from './breadcrumb.variants.js'; /** Single breadcrumb item definition */ export interface BreadcrumbItem { /** Display label */ label: string; /** * Leading icon rendered before the label, inside the crumb's own link (or * inside the current-page span for the last item). Pass the icon *component* * — `import { HomeIcon } from '@urbicon-ui/blocks'` — never an icon name: a * name has to be resolved through the registry at runtime, and that dynamic * lookup drags all 315 icons into the consumer bundle (see * docs/ICON-DESIGN.md). Decorative by contract — the icon is wrapped in an * `aria-hidden` span, so the crumb still announces as its `label` alone. * Give an icon-led crumb an `aria-label` if its `label` is too terse to * stand on its own. */ icon?: IconComponent; /** Navigation URL (omit for current page) */ href?: string; /** * Click handler. Use alongside or instead of `href` when navigation * happens through a client-side router or shouldn't follow the link * (e.g. demos with non-existent routes — call `event.preventDefault()`). */ onclick?: (event: MouseEvent) => void; /** * Accessible name override for this crumb, replacing `label` for assistive * technology. * * On a linked crumb this is an `aria-label` on the ``, which every * implementation honours. On the current page it rides on a generic element, * and implementations disagree there: Chrome computes the name, while a * strict ARIA 1.2 reading ignores an author name on `generic` and falls back * to the content. So give an icon-led last crumb a real `label` rather than * relying on the override alone. */ 'aria-label'?: string; } /** * Props interface for Breadcrumb component * * @summary The trail back up: where this page sits in the hierarchy. * @description Navigation aid showing the current page's location in a hierarchy. * Renders an accessible nav with structured items and customizable separators. * * @tag navigation * @related Tab * @related Stepper * * @example * ```svelte * * ``` * * @example * ```svelte * * {#snippet separator()}{/snippet} * * ``` * * @example Collapse a long trail — middle items fold into an expandable "…" * ```svelte * * ``` * * @example Leading icon on a crumb — pass the icon component, never its name * ```svelte * * ``` */ export interface BreadcrumbProps extends BreadcrumbVariants, Omit, 'children'> { /** Ordered breadcrumb items (last item is current page) */ items: BreadcrumbItem[]; /** Size @default 'md' */ size?: 'sm' | 'md' | 'lg'; /** * Let the trail wrap onto multiple lines (`true`, default) or keep it on a * single line where the current page truncates and the ancestor links hold * their width (`false`). Use `false` for tight single-line bars such as a * sticky header or toolbar. @default true * @summary Whether a long trail wraps onto several lines, or stays on one and truncates. */ wrap?: boolean; /** Custom separator snippet (default: "/") */ separator?: Snippet; /** * Collapse the trail when it has more than this many items: the middle items * fold into a single "…" button that expands the full trail on click. The * first `itemsBeforeCollapse` and last `itemsAfterCollapse` items stay * visible (the current page is always kept). Omit to never collapse. * @summary Folds the middle of a long trail into one ellipsis button. */ maxItems?: number; /** Leading items kept visible when collapsed. @default 1 */ itemsBeforeCollapse?: number; /** Trailing items kept visible when collapsed; the current page is always included. @default 1 */ itemsAfterCollapse?: number; /** * Accessible label for the "…" button that expands a collapsed trail. * Defaults to the localized `accessibility.breadcrumbExpand`. * @summary Accessible name for the button that expands a collapsed trail. */ expandLabel?: string; /** Accessible label for the nav element. Defaults to the localized `accessibility.breadcrumb`. */ 'aria-label'?: string; /** Custom CSS class */ class?: string; /** Remove default styles */ unstyled?: boolean; /** Per-slot class overrides */ slotClasses?: Partial>; /** * Apply a named preset registered via ``. * Prefer this over `class` overrides when the requested look falls outside the * semantic intent palette — presets keep hover/active/dark-mode logic coherent * and make the custom look reusable across the project. */ preset?: string; } export { default as Breadcrumb } from './Breadcrumb.svelte'; export { type BreadcrumbVariants, breadcrumbVariants } from './breadcrumb.variants.js'; /** Re-export as BreadcrumbItemType for barrel-level consumption */ export type { BreadcrumbItem as BreadcrumbItemType };