diff --git a/frontend/src/component/feature/FeatureStrategy/FeatureStrategyConstraints/AddSingleValueWidget.tsx b/frontend/src/component/feature/FeatureStrategy/FeatureStrategyConstraints/AddSingleValueWidget.tsx index 545da27372..1ce574eabe 100644 --- a/frontend/src/component/feature/FeatureStrategy/FeatureStrategyConstraints/AddSingleValueWidget.tsx +++ b/frontend/src/component/feature/FeatureStrategy/FeatureStrategyConstraints/AddSingleValueWidget.tsx @@ -17,15 +17,16 @@ const StyledChip = styled(ValueChip, { }, })); -interface AddValuesProps { +type Props = { onAddValue: (newValue: string) => void; removeValue: () => void; currentValue?: string; helpText?: string; -} + inputType: 'text' | 'number'; +}; -export const AddSingleValueWidget = forwardRef( - ({ currentValue, onAddValue, removeValue, helpText }, ref) => { +export const AddSingleValueWidget = forwardRef( + ({ currentValue, onAddValue, removeValue, helpText, inputType }, ref) => { const [open, setOpen] = useState(false); const positioningRef = useRef(null); useImperativeHandle( @@ -55,6 +56,9 @@ export const AddSingleValueWidget = forwardRef( onDelete={currentValue ? removeValue : undefined} /> void; helpText?: string; + inputProps?: InputBaseComponentProps; }; const HelpText = styled('p')(({ theme }) => ({ @@ -52,6 +59,7 @@ export const AddValuesPopover: FC = ({ open, onClose, helpText, + inputProps, }) => { const [inputValue, setInputValue] = useState(initialValue || ''); const [error, setError] = useState(''); @@ -119,6 +127,9 @@ export const AddValuesPopover: FC = ({ error={!!error} helperText={error} aria-describedby={helpTextId} + inputProps={{ + ...inputProps, + }} /> = ({ ? 'Add a single number' : 'A semver value should be of the format X.Y.Z' } + inputType={ + inputType.type === 'number' ? 'number' : 'text' + } /> ); case 'multiple values':