|
|
@ -20,7 +20,6 @@ import OutlinedInputLabel, { |
|
|
|
} from './OutlinedInputLabel'; |
|
|
|
} from './OutlinedInputLabel'; |
|
|
|
|
|
|
|
|
|
|
|
type OutlinedInputWithLabelOptionalPropsWithDefault = { |
|
|
|
type OutlinedInputWithLabelOptionalPropsWithDefault = { |
|
|
|
fillRow?: boolean; |
|
|
|
|
|
|
|
formControlProps?: Partial<MUIFormControlProps>; |
|
|
|
formControlProps?: Partial<MUIFormControlProps>; |
|
|
|
helpMessageBoxProps?: Partial<MessageBoxProps>; |
|
|
|
helpMessageBoxProps?: Partial<MessageBoxProps>; |
|
|
|
id?: string; |
|
|
|
id?: string; |
|
|
@ -53,7 +52,6 @@ type OutlinedInputWithLabelProps = Pick< |
|
|
|
const OUTLINED_INPUT_WITH_LABEL_DEFAULT_PROPS: Required<OutlinedInputWithLabelOptionalPropsWithDefault> & |
|
|
|
const OUTLINED_INPUT_WITH_LABEL_DEFAULT_PROPS: Required<OutlinedInputWithLabelOptionalPropsWithDefault> & |
|
|
|
OutlinedInputWithLabelOptionalPropsWithoutDefault = { |
|
|
|
OutlinedInputWithLabelOptionalPropsWithoutDefault = { |
|
|
|
baseInputProps: undefined, |
|
|
|
baseInputProps: undefined, |
|
|
|
fillRow: false, |
|
|
|
|
|
|
|
formControlProps: {}, |
|
|
|
formControlProps: {}, |
|
|
|
helpMessageBoxProps: {}, |
|
|
|
helpMessageBoxProps: {}, |
|
|
|
id: '', |
|
|
|
id: '', |
|
|
@ -70,7 +68,6 @@ const OUTLINED_INPUT_WITH_LABEL_DEFAULT_PROPS: Required<OutlinedInputWithLabelOp |
|
|
|
const OutlinedInputWithLabel: FC<OutlinedInputWithLabelProps> = ({ |
|
|
|
const OutlinedInputWithLabel: FC<OutlinedInputWithLabelProps> = ({ |
|
|
|
baseInputProps, |
|
|
|
baseInputProps, |
|
|
|
disableAutofill, |
|
|
|
disableAutofill, |
|
|
|
fillRow: isFillRow = OUTLINED_INPUT_WITH_LABEL_DEFAULT_PROPS.fillRow, |
|
|
|
|
|
|
|
formControlProps = OUTLINED_INPUT_WITH_LABEL_DEFAULT_PROPS.formControlProps, |
|
|
|
formControlProps = OUTLINED_INPUT_WITH_LABEL_DEFAULT_PROPS.formControlProps, |
|
|
|
helpMessageBoxProps = OUTLINED_INPUT_WITH_LABEL_DEFAULT_PROPS.helpMessageBoxProps, |
|
|
|
helpMessageBoxProps = OUTLINED_INPUT_WITH_LABEL_DEFAULT_PROPS.helpMessageBoxProps, |
|
|
|
id = OUTLINED_INPUT_WITH_LABEL_DEFAULT_PROPS.id, |
|
|
|
id = OUTLINED_INPUT_WITH_LABEL_DEFAULT_PROPS.id, |
|
|
@ -91,15 +88,10 @@ const OutlinedInputWithLabel: FC<OutlinedInputWithLabelProps> = ({ |
|
|
|
type, |
|
|
|
type, |
|
|
|
value = OUTLINED_INPUT_WITH_LABEL_DEFAULT_PROPS.value, |
|
|
|
value = OUTLINED_INPUT_WITH_LABEL_DEFAULT_PROPS.value, |
|
|
|
}) => { |
|
|
|
}) => { |
|
|
|
const { sx: formControlSx, ...restFormControlProps } = formControlProps; |
|
|
|
|
|
|
|
const { text: helpText = '' } = helpMessageBoxProps; |
|
|
|
const { text: helpText = '' } = helpMessageBoxProps; |
|
|
|
|
|
|
|
|
|
|
|
const [isShowHelp, setIsShowHelp] = useState<boolean>(false); |
|
|
|
const [isShowHelp, setIsShowHelp] = useState<boolean>(false); |
|
|
|
|
|
|
|
|
|
|
|
const formControlWidth = useMemo( |
|
|
|
|
|
|
|
() => (isFillRow ? '100%' : undefined), |
|
|
|
|
|
|
|
[isFillRow], |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
const helpElement = useMemo( |
|
|
|
const helpElement = useMemo( |
|
|
|
() => |
|
|
|
() => |
|
|
|
isShowHelp && ( |
|
|
|
isShowHelp && ( |
|
|
@ -136,11 +128,7 @@ const OutlinedInputWithLabel: FC<OutlinedInputWithLabelProps> = ({ |
|
|
|
const handleHelp = useMemo(createHelpHandler, [createHelpHandler]); |
|
|
|
const handleHelp = useMemo(createHelpHandler, [createHelpHandler]); |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<MUIFormControl |
|
|
|
<MUIFormControl fullWidth {...formControlProps}> |
|
|
|
fullWidth |
|
|
|
|
|
|
|
{...restFormControlProps} |
|
|
|
|
|
|
|
sx={{ width: formControlWidth, ...formControlSx }} |
|
|
|
|
|
|
|
> |
|
|
|
|
|
|
|
<OutlinedInputLabel |
|
|
|
<OutlinedInputLabel |
|
|
|
htmlFor={id} |
|
|
|
htmlFor={id} |
|
|
|
isNotifyRequired={required} |
|
|
|
isNotifyRequired={required} |
|
|
|