import { FormControl, FormLabel, Select, SelectProps, Tooltip, TooltipProps, } from '@chakra-ui/react'; import { memo, MouseEvent } from 'react'; import IAIOption from './IAIOption'; type IAISelectProps = SelectProps & { label?: string; tooltip?: string; tooltipProps?: Omit; validValues: | Array | Array<{ key: string; value: string | number }>; horizontal?: boolean; spaceEvenly?: boolean; }; /** * Customized Chakra FormControl + Select multi-part component. */ const IAISelect = (props: IAISelectProps) => { const { label, isDisabled, validValues, tooltip, tooltipProps, horizontal, spaceEvenly, ...rest } = props; return ( ) => { e.stopPropagation(); e.nativeEvent.stopImmediatePropagation(); e.nativeEvent.stopPropagation(); e.nativeEvent.cancelBubble = true; }} sx={ horizontal ? { display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', gap: 4, } : {} } > {label && ( {label} )} ); }; export default memo(IAISelect);