import { Star as MUIRequiredIcon } from '@mui/icons-material'; import { Box, InputLabel as MUIInputLabel, inputLabelClasses as muiInputLabelClasses, InputLabelProps as MUIInputLabelProps, svgIconClasses as muiSvgIconClasses, } from '@mui/material'; import { BLACK, BORDER_RADIUS, GREY } from '../../lib/consts/DEFAULT_THEME'; type OutlinedInputLabelOptionalProps = { isNotifyRequired?: boolean; }; type OutlinedInputLabelProps = MUIInputLabelProps & OutlinedInputLabelOptionalProps; const OutlinedInputLabel = ( inputLabelProps: OutlinedInputLabelProps, ): JSX.Element => { const { children, isNotifyRequired, sx, variant = 'outlined', ...inputLabelRestProps } = inputLabelProps; const combinedSx = { color: `${GREY}9F`, [`& .${muiSvgIconClasses.root}`]: { color: GREY, }, [`&.${muiInputLabelClasses.focused}`]: { backgroundColor: GREY, borderRadius: BORDER_RADIUS, color: BLACK, padding: '.1em .6em', }, [`&.${muiInputLabelClasses.shrink} .${muiSvgIconClasses.root}`]: { display: 'none', }, ...sx, }; return ( {isNotifyRequired && ( )} {children} ); }; export type { OutlinedInputLabelProps }; export default OutlinedInputLabel;