/**
* WordPress dependencies
*/
import { BaseControl } from '@safe-wordpress/components';
import { useInstanceId } from '@safe-wordpress/compose';
import * as icons from '@safe-wordpress/icons';
const {
Icon: _,
// Deprecated aliases
warning: __,
...availableIcons
} = icons;
/**
* External dependencies
*/
import clsx from 'clsx';
import { OptionProps, SingleValueProps } from 'react-select';
import { find } from 'lodash';
/**
* Internal dependencies
*/
import { StylizedSelectControl } from '../stylized-select-control';
import './style.scss';
type IconSelectorProps = {
readonly className?: string;
readonly label?: string;
readonly help?: string;
readonly icon?: string;
readonly onChange: ( icon?: string ) => void;
};
export const IconSelector = ( {
className,
label,
help,
icon,
onChange,
}: IconSelectorProps ): JSX.Element | null => {
const instanceId = useInstanceId( IconSelector );
const iconValue = !! icon
? find( ICON_OPTIONS, { value: icon } )
: undefined;
return (