UNPKG

lucid-ui

Version:

A UI component library from AppNexus.

131 lines (130 loc) 5.48 kB
import React from 'react'; import { StandardProps, Overwrite } from '../../util/component-types'; import * as reducers from './VerticalListMenu.reducers'; import { ICollapsibleProps } from '../Collapsible/Collapsible'; export interface IVerticalListMenuPropsRaw extends StandardProps { /** Indicates which of the \`VerticalListMenu.Item\` children are currently selected. You can also put the \`isSelected\` prop directly on the \`VerticalListMenu.Item\`s if you wish. */ selectedIndices: number[]; /** Indicates which of the \`VerticalListMenu.Item\` children are currently expanded. You can also put the \`isExpanded\` prop directly on the \`VerticalListMenu.Item\`s if you wish. */ expandedIndices: number[]; /** Callback fired when the user selects a \`VerticalListMenu.Item\`.*/ onSelect: (index: number, { event, props, }: { event: React.MouseEvent; props: IVerticalListMenuItemProps; }) => void; /** Callback fired when the user expands or collapses an expandable \`VerticalListMenu.Item\`. */ onToggle: (index: number, { event, props, }: { event: React.MouseEvent; props: IVerticalListMenuItemProps; }) => void; } export declare type IVerticalListMenuProps = Overwrite<React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>, IVerticalListMenuPropsRaw>; interface IVerticalListMenuItemPropsRaw extends StandardProps { /** Show or hide the expand button. Should be \`true\` if you want to nest menus. */ hasExpander?: boolean; /** Determines the visibility of nested menus. */ isExpanded?: boolean; /** If \`true\` then a small bar on the left side of the item will be shown indicating this item is selected. */ isSelected?: boolean; /** Determines the visibility of the small bar on the left when the user hovers over the item. This should indicate to the user that an item is clickable. */ isActionable?: boolean; /** Called when the user clicks the main body of the item. */ onSelect?: (index: number, { event, props, }: { event: React.MouseEvent; props: IVerticalListMenuItemProps; }) => void; /** Called when the user clicks the expand button. */ onToggle?: (index: number, { event, props, }: { event: React.MouseEvent; props: IVerticalListMenuItemProps; }) => void; /** Props that are passed through to the underlying Collapsible component if the item has children. */ Collapsible?: Partial<ICollapsibleProps>; } export declare type IVerticalListMenuItemProps = Overwrite<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, IVerticalListMenuItemPropsRaw>; export interface IVerticalListMenuState { selectedIndices?: number[]; expandedIndices?: number[]; } declare class VerticalListMenu extends React.Component<IVerticalListMenuProps, IVerticalListMenuState> { static displayName: string; static Item: { (_props: Overwrite<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, IVerticalListMenuItemPropsRaw>): null; peek: { description: string; }; displayName: string; propTypes: { hasExpander: any; isExpanded: any; isSelected: any; isActionable: any; onSelect: any; onToggle: any; Collapsible: any; }; }; static peek: { description: string; categories: string[]; madeFrom: string[]; }; static reducers: typeof reducers; static definition: { statics: { Item: { (_props: Overwrite<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, IVerticalListMenuItemPropsRaw>): null; peek: { description: string; }; displayName: string; propTypes: { hasExpander: any; isExpanded: any; isSelected: any; isActionable: any; onSelect: any; onToggle: any; Collapsible: any; }; }; reducers: typeof reducers; peek: { description: string; categories: string[]; madeFrom: string[]; }; }; }; static propTypes: { children: any; className: any; style: any; selectedIndices: any; expandedIndices: any; onSelect: any; onToggle: any; }; static defaultProps: { onSelect: (...args: any[]) => void; onToggle: (...args: any[]) => void; expandedIndices: never[]; selectedIndices: never[]; }; render(): JSX.Element; handleToggle: (index: number, itemChildProp: IVerticalListMenuItemProps, event: React.MouseEvent) => void; handleClickItem: (index: number, itemChildProp: IVerticalListMenuItemProps, event: React.MouseEvent) => void; } declare const _default: typeof VerticalListMenu & import("../../util/state-management").IHybridComponent<Overwrite<React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>, IVerticalListMenuPropsRaw>, IVerticalListMenuState>; export default _default; export { VerticalListMenu as VerticalListMenuDumb };