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 `
` element. It is a container for
* `Breadcrumbs.Item` subcomponents. It also renders overflow button if `overflowButton` prop
* has been passed;
*
* ```tsx
* // without overflow
* {Breadcrumbs.Items}
* ```
*
* ```tsx
* // with overflow
* }>
* {Breadcrumbs.Items}
*
* ```
*
* `Breadcrumbs.List` accepts a `overflowButton` prop allowing to pass specific overflow button.
* Breadcrumbs.List with overflow behavior should contain `overflowButton` component with
* `aria-label` to render overflow button.
*/
List: BreadcrumbsList,
/**
* `Breadcrumbs.Item` is a {@link Flex} component rendered as an `