UNPKG

@primer/react

Version:

An implementation of GitHub's Primer Design System using React

73 lines 2.45 kB
import { type Icon } from '@primer/octicons-react'; import React from 'react'; import type { FCWithSlotMarker } from '../utils/types'; export type TreeViewProps = { 'aria-label'?: React.AriaAttributes['aria-label']; 'aria-labelledby'?: React.AriaAttributes['aria-labelledby']; children: React.ReactNode; flat?: boolean; truncate?: boolean; className?: string; style?: React.CSSProperties; }; export type TreeViewSecondaryActions = { label: string; onClick: () => void; icon: Icon; count?: number | string; className?: string; }; export type TreeViewItemProps = { 'aria-label'?: React.AriaAttributes['aria-label']; 'aria-labelledby'?: React.AriaAttributes['aria-labelledby']; id: string; children: React.ReactNode; containIntrinsicSize?: string; current?: boolean; defaultExpanded?: boolean; expanded?: boolean | null; onExpandedChange?: (expanded: boolean) => void; onSelect?: (event: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>) => void; className?: string; secondaryActions?: TreeViewSecondaryActions[]; }; export type SubTreeState = 'initial' | 'loading' | 'done' | 'error'; export type TreeViewSubTreeProps = { children?: React.ReactNode; state?: SubTreeState; /** * Display a skeleton loading state with the specified count of items */ count?: number; 'aria-label'?: string; }; export type TreeViewVisualProps = { children: React.ReactNode | ((props: { isExpanded: boolean; }) => React.ReactNode); label?: string; }; export type TreeViewTrailingAction = { items: TreeViewSecondaryActions[]; shortcutText: string; }; export type TreeViewActionDialogProps = { items: TreeViewSecondaryActions[]; onClose?: () => void; }; export type TreeViewErrorDialogProps = { children: React.ReactNode; title?: string; onRetry?: () => void; onDismiss?: () => void; }; export declare const TreeView: React.FC<TreeViewProps> & { Item: React.ForwardRefExoticComponent<TreeViewItemProps & React.RefAttributes<HTMLElement>>; SubTree: FCWithSlotMarker<TreeViewSubTreeProps>; LeadingAction: React.FC<TreeViewVisualProps>; LeadingVisual: React.FC<TreeViewVisualProps>; TrailingVisual: React.FC<TreeViewVisualProps>; DirectoryIcon: () => React.JSX.Element; ErrorDialog: React.FC<TreeViewErrorDialogProps>; }; //# sourceMappingURL=TreeView.d.ts.map