| 1 |
import { Component } from 'react'; |
| 2 |
import { OUIAProps } from '../../helpers'; |
| 3 |
export type NavSelectClickHandler = (event: React.FormEvent<HTMLInputElement>, itemId: number | string, groupId: number | string, to: string) => void; |
| 4 |
export interface NavProps extends Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, 'onSelect' | 'onToggle'>, OUIAProps { |
| 5 |
/** Anything that can be rendered inside of the nav */ |
| 6 |
children?: React.ReactNode; |
| 7 |
/** Additional classes added to the container */ |
| 8 |
className?: string; |
| 9 |
/** Callback for updating when item selection changes */ |
| 10 |
onSelect?: (event: React.FormEvent<HTMLInputElement>, selectedItem: { |
| 11 |
groupId: number | string; |
| 12 |
itemId: number | string; |
| 13 |
to: string; |
| 14 |
}) => void; |
| 15 |
/** Callback for when a list is expanded or collapsed */ |
| 16 |
onToggle?: (event: React.MouseEvent<HTMLButtonElement>, toggledItem: { |
| 17 |
groupId: number | string; |
| 18 |
isExpanded: boolean; |
| 19 |
}) => void; |
| 20 |
/** Accessible label for the nav when there are multiple navs on the page */ |
| 21 |
'aria-label'?: string; |
| 22 |
/** The nav variant to use. Docked is in beta. */ |
| 23 |
variant?: 'default' | 'horizontal' | 'horizontal-subnav' | 'docked'; |
| 24 |
/** @beta Flag indicating the docked nav should display text. Only applies when variant is docked. */ |
| 25 |
isTextExpanded?: boolean; |
| 26 |
/** Value to overwrite the randomly generated data-ouia-component-id.*/ |
| 27 |
ouiaId?: number | string; |
| 28 |
/** Set the value of data-ouia-safe. Only set to true when the component is in a static state, i.e. no animations are occurring. At all other times, this value must be false. */ |
| 29 |
ouiaSafe?: boolean; |
| 30 |
} |
| 31 |
export interface NavContextProps { |
| 32 |
onSelect?: (event: React.FormEvent<HTMLInputElement>, groupId: number | string, itemId: number | string, to: string, preventDefault: boolean, onClick: NavSelectClickHandler) => void; |
| 33 |
onToggle?: (event: React.MouseEvent<HTMLButtonElement>, groupId: number | string, expanded: boolean) => void; |
| 34 |
updateIsScrollable?: (isScrollable: boolean) => void; |
| 35 |
isHorizontal?: boolean; |
| 36 |
flyoutRef?: React.Ref<HTMLLIElement>; |
| 37 |
setFlyoutRef?: (ref: React.Ref<HTMLLIElement>) => void; |
| 38 |
navRef?: React.RefObject<HTMLElement | null>; |
| 39 |
} |
| 40 |
export declare const navContextDefaults: {}; |
| 41 |
export declare const NavContext: import("react").Context<NavContextProps>; |
| 42 |
declare class Nav extends Component<NavProps, { |
| 43 |
isScrollable: boolean; |
| 44 |
flyoutRef: React.Ref<HTMLLIElement> | null; |
| 45 |
}> { |
| 46 |
static displayName: string; |
| 47 |
static defaultProps: NavProps; |
| 48 |
state: { |
| 49 |
isScrollable: boolean; |
| 50 |
flyoutRef: import("react").Ref<HTMLLIElement>; |
| 51 |
}; |
| 52 |
navRef: import("react").RefObject<HTMLElement>; |
| 53 |
onSelect(event: React.FormEvent<HTMLInputElement>, groupId: number | string, itemId: number | string, to: string, preventDefault: boolean, onClick: NavSelectClickHandler): void; |
| 54 |
onToggle(event: React.MouseEvent<HTMLButtonElement>, groupId: number | string, toggleValue: boolean): void; |
| 55 |
render(): import("react/jsx-runtime").JSX.Element; |
| 56 |
} |
| 57 |
export { Nav }; |
| 58 |
//# sourceMappingURL=Nav.d.ts.map |