UNPKG

@fluentui/react-northstar

Version:
74 lines (73 loc) 3.53 kB
import { Accessibility, TreeTitleBehaviorProps } from '@fluentui/accessibility'; import { BoxProps } from '../Box/Box'; import { SupportedIntrinsicInputProps } from '../../utils/htmlPropsUtils'; import * as PropTypes from 'prop-types'; import * as React from 'react'; import { UIComponentProps, ChildrenComponentProps, ContentComponentProps } from '../../utils'; import { ComponentEventHandler, FluentComponentStaticProps, ShorthandValue } from '../../types'; export interface TreeTitleSlotClassNames { indicator: string; } export interface TreeTitleProps extends UIComponentProps, ChildrenComponentProps, ContentComponentProps { /** Accessibility behavior if overridden by the user. */ accessibility?: Accessibility<TreeTitleBehaviorProps>; /** Internal usage only - Id needed to identify this item inside the Tree, passed down from TreeItem */ id?: string; /** Whether or not the title has a subtree. */ hasSubtree?: boolean; /** The index of the title among its siblings. Count starts at 1. */ index?: number; /** Level of the tree/subtree that contains this title. */ level?: number; /** * Called on click. * * @param event - React's original SyntheticEvent. * @param data - All props. */ onClick?: ComponentEventHandler<TreeTitleProps>; /** Whether or not the subtree of the title is in the open state. */ expanded?: boolean; /** Size of the tree containing this title without any children. */ treeSize?: number; /** A selection indicator icon can be customized. */ selectionIndicator?: ShorthandValue<BoxProps>; /** A selection indicator can appear disabled and be unable to change states. */ disabled?: SupportedIntrinsicInputProps['disabled']; /** A state of selection indicator. */ selected?: boolean; /** Whether or not tree title is selectable. */ selectable?: boolean; /** For selectable parents define if all nested children are checked */ indeterminate?: boolean; /** The id of the parent tree title, if any. */ parent?: string; unstyled?: boolean; } export declare type TreeTitleStylesProps = Pick<TreeTitleProps, 'selected' | 'selectable' | 'disabled' | 'indeterminate' | 'level'> & { showIndicator: boolean; }; export declare const treeTitleClassName = "ui-tree__title"; export declare const treeTitleSlotClassNames: { indicator: string; }; /** * A TreeTitle renders a title of TreeItem. */ export declare const TreeTitle: (<TExtendedElementType extends React.ElementType<any> = "a">(props: React.RefAttributes<HTMLAnchorElement> & Omit<import("@fluentui/react-bindings").PropsOfElement<TExtendedElementType>, "as" | keyof TreeTitleProps> & { as?: TExtendedElementType; } & TreeTitleProps) => JSX.Element) & { propTypes?: React.WeakValidationMap<TreeTitleProps> & { as: React.Requireable<string | ((props: any, context?: any) => any) | (new (props: any, context?: any) => any)>; }; contextTypes?: PropTypes.ValidationMap<any>; defaultProps?: Partial<TreeTitleProps & { as: "a"; }>; displayName?: string; readonly __PRIVATE_PROPS?: React.RefAttributes<HTMLAnchorElement> & Omit<Pick<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "key" | keyof React.AnchorHTMLAttributes<HTMLAnchorElement>> & { ref?: React.Ref<HTMLAnchorElement>; }, "as" | keyof TreeTitleProps> & { as?: "a"; } & TreeTitleProps; } & FluentComponentStaticProps<TreeTitleProps>;