From a85b68e35c3f4f0ed336cdc6c4192468a770bde9 Mon Sep 17 00:00:00 2001 From: Tsu-ba-me Date: Tue, 21 Feb 2023 22:21:14 -0500 Subject: [PATCH] fix(striker-ui): expose name prop in OutlinedInputWithLabel and SelectWithLabel --- .../components/OutlinedInputWithLabel.tsx | 18 +++++++++--------- striker-ui/components/SelectWithLabel.tsx | 2 ++ striker-ui/types/SelectWithLabel.d.ts | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/striker-ui/components/OutlinedInputWithLabel.tsx b/striker-ui/components/OutlinedInputWithLabel.tsx index b0d8c82c..ca16c777 100644 --- a/striker-ui/components/OutlinedInputWithLabel.tsx +++ b/striker-ui/components/OutlinedInputWithLabel.tsx @@ -31,9 +31,6 @@ type OutlinedInputWithLabelOptionalPropsWithDefault = { }; type OutlinedInputWithLabelOptionalPropsWithoutDefault = { - onBlur?: OutlinedInputProps['onBlur']; - onChange?: OutlinedInputProps['onChange']; - onFocus?: OutlinedInputProps['onFocus']; onHelp?: MUIIconButtonProps['onClick']; onHelpAppend?: MUIIconButtonProps['onClick']; type?: string; @@ -43,9 +40,13 @@ type OutlinedInputWithLabelOptionalProps = OutlinedInputWithLabelOptionalPropsWithDefault & OutlinedInputWithLabelOptionalPropsWithoutDefault; -type OutlinedInputWithLabelProps = OutlinedInputWithLabelOptionalProps & { - label: string; -}; +type OutlinedInputWithLabelProps = Pick< + OutlinedInputProps, + 'name' | 'onBlur' | 'onChange' | 'onFocus' +> & + OutlinedInputWithLabelOptionalProps & { + label: string; + }; const OUTLINED_INPUT_WITH_LABEL_DEFAULT_PROPS: Required & OutlinedInputWithLabelOptionalPropsWithoutDefault = { @@ -56,9 +57,6 @@ const OUTLINED_INPUT_WITH_LABEL_DEFAULT_PROPS: Required = ({ inputLabelProps = OUTLINED_INPUT_WITH_LABEL_DEFAULT_PROPS.inputLabelProps, label, messageBoxProps = OUTLINED_INPUT_WITH_LABEL_DEFAULT_PROPS.messageBoxProps, + name, onBlur, onChange, onFocus, @@ -172,6 +171,7 @@ const OutlinedInputWithLabel: FC = ({ fullWidth={formControlProps.fullWidth} id={id} label={label} + name={name} onBlur={onBlur} onChange={onChange} onFocus={onFocus} diff --git a/striker-ui/components/SelectWithLabel.tsx b/striker-ui/components/SelectWithLabel.tsx index e2a343d6..fd66d812 100644 --- a/striker-ui/components/SelectWithLabel.tsx +++ b/striker-ui/components/SelectWithLabel.tsx @@ -21,6 +21,7 @@ const SelectWithLabel: FC = ({ inputLabelProps = {}, isReadOnly = false, messageBoxProps = {}, + name, onChange, selectProps: { multiple: selectMultiple, @@ -97,6 +98,7 @@ const SelectWithLabel: FC = ({ id={id} input={inputElement} multiple={selectMultiple} + name={name} onChange={onChange} readOnly={isReadOnly} value={selectValue} diff --git a/striker-ui/types/SelectWithLabel.d.ts b/striker-ui/types/SelectWithLabel.d.ts index 6c98dabd..0816a005 100644 --- a/striker-ui/types/SelectWithLabel.d.ts +++ b/striker-ui/types/SelectWithLabel.d.ts @@ -23,7 +23,7 @@ type SelectWithLabelOptionalProps = { }; type SelectWithLabelProps = SelectWithLabelOptionalProps & - Pick & { + Pick & { id: string; selectItems: Array; };