@atlaskit/atlassian-navigation
Version:
A horizontal navigation component for Atlassian products.
45 lines (44 loc) • 1.9 kB
TypeScript
/// <reference types="lodash" />
import React, { ReactNode } from 'react';
import noop from '@atlaskit/ds-lib/noop';
import { OverflowProviderProps } from './types';
interface OverflowContext {
/**
* Returns `true` when the navigation item is visible,
* and `false` when the navigation item has been pushed into the overflow menu.
*/
isVisible: boolean;
/**
* Method that can be used to programmatically open the overflow menu
*/
openOverflowMenu: () => void;
/**
* Method that can be used to programmatically close the overflow menu
*/
closeOverflowMenu: () => void;
}
declare const OverflowContext: React.Context<{
isVisible: boolean;
openOverflowMenu: typeof noop;
closeOverflowMenu: typeof noop;
}>;
export declare const OverflowProvider: ({ children, isVisible, openOverflowMenu, closeOverflowMenu, }: OverflowProviderProps) => JSX.Element;
/**
* __useOverFlowStatus__
*
* Returns the current context value for the nearest OverflowProvider.
*
* - [Example](https://atlassian.design/components/atlassian-navigation/examples#responsive)
*/
export declare const useOverflowStatus: () => {
isVisible: boolean;
openOverflowMenu: typeof noop;
closeOverflowMenu: typeof noop;
};
export declare const useOverflowController: (nodes: ReactNode | ReactNode[]) => {
visibleItems: (string | number | boolean | {} | React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactNodeArray | React.ReactPortal | null | undefined)[];
overflowItems: (string | number | boolean | {} | React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactNodeArray | React.ReactPortal | null | undefined)[];
updateWidth: import("lodash").DebouncedFunc<React.Dispatch<React.SetStateAction<number>>>;
};
declare const _default: (props: OverflowContext) => void;
export default _default;