import { FC } from 'react'; import { Checkbox as MUICheckbox, FormControl as MUIFormControl, } from '@mui/material'; import InputMessageBox from './InputMessageBox'; import MenuItem from './MenuItem'; import { MessageBoxProps } from './MessageBox'; import OutlinedInput from './OutlinedInput'; import OutlinedInputLabel, { OutlinedInputLabelProps, } from './OutlinedInputLabel'; import Select, { SelectProps } from './Select'; type SelectItem = { displayValue?: SelectItemValueType; value: SelectItemValueType; }; type SelectWithLabelOptionalProps = { checkItem?: ((value: string) => boolean) | null; disableItem?: ((value: string) => boolean) | null; hideItem?: ((value: string) => boolean) | null; isCheckableItems?: boolean; inputLabelProps?: Partial; label?: string | null; messageBoxProps?: Partial; selectProps?: Partial; }; type SelectWithLabelProps = SelectWithLabelOptionalProps & { id: string; selectItems: SelectItem[]; }; const SELECT_WITH_LABEL_DEFAULT_PROPS: Required = { checkItem: null, disableItem: null, hideItem: null, isCheckableItems: false, inputLabelProps: {}, label: null, messageBoxProps: {}, selectProps: {}, }; const SelectWithLabel: FC = ({ id, label, selectItems, checkItem, disableItem, hideItem, inputLabelProps, messageBoxProps, selectProps, isCheckableItems = selectProps?.multiple, }) => ( {label && ( // eslint-disable-next-line react/jsx-props-no-spreading {label} )} {/* eslint-disable-next-line react/jsx-props-no-spreading */} ); SelectWithLabel.defaultProps = SELECT_WITH_LABEL_DEFAULT_PROPS; export type { SelectItem, SelectWithLabelProps }; export default SelectWithLabel;