import React from 'react'; import PropTypes from 'prop-types'; import _ from 'lodash'; import { lucidClassNames, uniqueName } from '../../util/style-helpers'; import { StandardProps, getFirst, rejectTypes, findTypes, Overwrite, } from '../../util/component-types'; import { scrollParentTo } from '../../util/dom-helpers'; import { buildModernHybridComponent } from '../../util/state-management'; import * as KEYCODE from '../../constants/key-code'; import * as reducers from './DropMenu.reducers'; import ContextMenu from '../ContextMenu/ContextMenu'; function joinArray( array: React.ReactNode[], getSeparator: ( element: React.ReactNode, index: number, array: React.ReactNode[] ) => React.ReactNode ) { return _.reduce( array, (newArray: React.ReactNode[], element, index) => { newArray.push(element); if (index < _.size(array) - 1) { newArray.push(getSeparator(element, index, array)); } return newArray; }, [] ); } function isOptionVisible(option: IOptionsData) { return !option.optionProps.isHidden; } const cx = lucidClassNames.bind('&-DropMenu'); const { any, arrayOf, bool, func, node, number, object, oneOf, string } = PropTypes; /** Header */ export interface IDropMenuHeaderProps extends StandardProps { description?: string; } const Header = (_props: IDropMenuHeaderProps): null => null; Header.displayName = 'DropMenu.Header'; Header.peek = { description: ` An optional header to be displayed within the expanded Flyout, above all \`Option\`s. `, }; Header.propName = 'Header'; Header.propTypes = {}; /** Control */ export interface IDropMenuControlProps extends StandardProps { description?: string; } const Control = (_props: IDropMenuControlProps): null => null; Control.displayName = 'DropMenu.Control'; Control.peek = { description: `Renders a \`