import * as React from 'react'; import {createContainer} from '@workday/canvas-kit-react/common'; import {Menu} from '@workday/canvas-kit-react/menu'; import {CSProps, handleCsProp} from '@workday/canvas-kit-styling'; import {BreadcrumbsCurrentItem} from './BreadcrumbsCurrentItem'; import {BreadcrumbsItem} from './BreadcrumbsItem'; import {BreadcrumbsLink} from './BreadcrumbsLink'; import {BreadcrumbsList} from './BreadcrumbsList'; import {BreadcrumbsMenu} from './BreadcrumbsMenu'; import {BreadcrumbsOverflowButton} from './BreadcrumbsOverflowButton'; import {useBreadcrumbsModel} from './hooks/useBreadcrumbsModel'; export interface BreadcrumbsProps extends CSProps { /** * The accessibility label for the nav element. * It's required to be provided by a11y guidance. * */ 'aria-label': string; /** * The contents of the Breadcrumbs. Can be `Breadcrumbs` children or any valid elements. */ children: React.ReactNode; } /** * `Breadcrumbs` is a container component that is responsible for creating a * {@link BreadcrumbsModel} and sharing it with its subcomponents using React context. It also * renders `nav` element, and `aria-label` attribute must be provided for this element. * * ```tsx * * * * Docs * * * Components * * * Breadcrumbs * * * * ``` * * You may pass {@link BreadcrumbsModelConfig} directly to the `Breadcrumbs` component. * * ```tsx * * {Child components} * * ``` * * Alternatively, you may pass in a model using the hoisted model pattern. * * ```tsx * const model = useBreadcrumbsModel({ * items: [], * }); * * * {Child components} * ; * ``` * * Note that if you pass in a `model` configured with {@link useBreadcrumbsModel}, configuration * props passed to `Breadcrumbs` will be ignored. `aria-label` attribute must be provided for `nav` * element. */ export const Breadcrumbs = createContainer('nav')({ displayName: 'Breadcrumbs', modelHook: useBreadcrumbsModel, subComponents: { /** * `Breadcrumbs.List` is a `Flex` component rendered as a `