import React, { memo } from 'react';
import InputLabel from '@mui/material/InputLabel';
import FormHelperText from '@mui/material/FormHelperText';
import FormControl from '@mui/material/FormControl';
import SelectMuiImport from '@mui/material/Select';
import type { SelectProps } from '@mui/material/Select/Select';
import variants from '@techytools/ui/components/SelectMui/styles';
import withCombinedProps from '@techytools/ui/hooks/withCombinedProps';
import withStyles from '@techytools/ui/hooks/withStyles';
export type Props = {
helperText?: string;
} & SelectProps;
/**
* SelectMui
*/
export const Component = (props: Props) => {
const {
label = undefined,
value,
onChange,
children,
helperText,
...rest
} = props;
return (
// @ts-ignore - experimental component
{label && (
{label}
)}
{children}
{helperText && {helperText}}
);
};
/*
* (1) default export is normal component ready to use (2) withSelectMui is HOC used to predefine common props
*/
// @ts-ignore - experimental component
const Styled: React.FC = withStyles(Component, 'SelectMui', variants);
export default memo(Styled);
export const withSelectMui = (props: Props) =>
memo(withCombinedProps(Styled, props));