UNPKG

@douyinfe/semi-ui

Version:

A modern, comprehensive, flexible design system and UI library. Connect DesignOps & DevOps. Quickly build beautiful React apps. Maintained by Douyin-fe team.

66 lines (65 loc) 2.64 kB
import React from 'react'; import propTypes from 'prop-types'; import { BreadcrumbItemAdapter, BreadcrumbItemInfo, Route } from '@douyinfe/semi-foundation/lib/cjs/breadcrumb/itemFoundation'; import BaseComponent, { BaseProps } from '../_base/baseComponent'; import { noop } from '@douyinfe/semi-foundation/lib/cjs/utils/function'; import { BreadContextType } from './bread-context'; export type { BreadcrumbItemInfo }; export interface RouteProps extends Route { icon?: React.ReactNode; } export interface BreadcrumbItemProps extends BaseProps { onClick?: (item: RouteProps, e: React.MouseEvent) => void; icon?: React.ReactNode; href?: string; separator?: React.ReactNode; noLink?: boolean; active?: boolean; shouldRenderSeparator?: boolean; route?: RouteProps; } type BreadcrumbItemState = Record<string, never>; export default class BreadcrumbItem extends BaseComponent<BreadcrumbItemProps, BreadcrumbItemState> { static isBreadcrumbItem: boolean; static contextType: React.Context<BreadContextType>; static propTypes: { onClick: propTypes.Requireable<(...args: any[]) => any>; route: propTypes.Requireable<NonNullable<string | object>>; name: propTypes.Requireable<string>; children: propTypes.Requireable<propTypes.ReactNodeLike>; active: propTypes.Requireable<boolean>; shouldRenderSeparator: propTypes.Requireable<boolean>; icon: propTypes.Requireable<propTypes.ReactNodeLike>; separator: propTypes.Requireable<propTypes.ReactNodeLike>; noLink: propTypes.Requireable<boolean>; }; static defaultProps: { onClick: typeof noop; shouldRenderSeparator: boolean; }; context: BreadContextType; get adapter(): BreadcrumbItemAdapter<BreadcrumbItemProps, BreadcrumbItemState>; constructor(props: BreadcrumbItemProps); componentDidMount(): void; componentWillUnmount(): void; renderIcon: () => string | number | boolean | Iterable<React.ReactNode> | React.DetailedReactHTMLElement<unknown, HTMLElement>; getTooltipOpt: () => { width: number; ellipsisPos: string; opts: { autoAdjustOverflow: boolean; position: string; }; } | { width: number; ellipsisPos: string; }; getItemInfo: () => BreadcrumbItemInfo; renderBreadItem: () => React.JSX.Element; renderItem: () => React.DetailedReactHTMLElement<{ className: string; onClick: (e: React.MouseEvent<HTMLElement, MouseEvent>) => any; href: string; }, HTMLElement>; render(): React.JSX.Element; }