import React, { PureComponent, ReactNode } from 'react'; interface ShallowDropDownContentsTheme { readonly 'dropDown__contents': string; readonly 'dropDown__contents--isOpen': string; readonly 'dropDown__contents--scrollable': string; } export interface ShallowDropDownContentsProps { /** * An optional `id` to attach to the wrapper. */ readonly id?: string; /** * An optional `className` to attach to the wrapper. */ readonly className?: string; /** * The contents to be rendered within the contents wrapper. */ readonly children?: ReactNode; /** * Limit height and add scrollbar. */ readonly scrollable?: boolean; /** * These props control the visual state of the contents, and are passed * from the outside via the `ContextDropDownContents` component. */ readonly isOpen: boolean; readonly closeDropDown: () => void; /** * An optional css theme to be injected. */ readonly theme?: ShallowDropDownContentsTheme; /** * A React.RefObject pointing to the dropdown wrapper element */ readonly wrapperRef: React.RefObject; /** * A custom function to calculate the minimum height, in case the * component is marked as scrollable. * * Defaults to: window => .25 * window.innerHeight */ readonly getMinHeight: (window: Window, props: ShallowDropDownContentsProps) => number; /** * A custom function to calculate the maximum height, in case the * component is marked as scrollable. * * Defaults to: window => .8 * window.innerHeight */ readonly getMaxHeight: (window: Window, props: ShallowDropDownContentsProps) => number; } export interface ShallowDropDownContentsState { /** * Calculated style properties */ style: React.CSSProperties; } export default class ShallowDropDownContents extends PureComponent { static defaultProps: { getMinHeight: (window: Window) => number; getMaxHeight: (window: Window) => number; }; /** * Calculate position and dimensions of ShallowDropDownContents based on * its wrapper element. * * @param ShallowDropDownContentsProps props * @returns React.CSSProperties */ static getCalculatedStyleFromProps(props: ShallowDropDownContentsProps): React.CSSProperties; static getDerivedStateFromProps(props: ShallowDropDownContentsProps): ShallowDropDownContentsState; readonly state: ShallowDropDownContentsState; readonly recalculateStyle: () => number; componentDidMount(): void; componentWillUnmount(): void; render(): JSX.Element | null; } export {};