import classnames from 'classnames/dedupe'; import selectStyles from 'gutenberg-react-select-styles'; import Select, { components } from 'react-select'; import { AutoSizer, List } from 'react-virtualized'; const rowHeight = 26; function MenuList(props) { const { children, maxHeight } = props; if (!children.length) { return null; } return ( {({ width }) => { return ( { return (
{children[index]}
); }} width={width} /> ); }}
); } const { Option: DefaultOption } = components; function Option(props) { return ( {props?.data?.icon || ''} {props.data.label} ); } /** * Component Class * * @param props */ export default function SelectComponent(props) { const { className, ...restProps } = props; const selectProps = { ...(props.grouped ? { groupHeaderHeight: 50, } : {}), ...restProps, }; // Add virtualized if there are > 30 items. const withVirtualized = props?.options?.length > 30; return (