diff --git a/src/input/Input.tsx b/src/input/Input.tsx index cf2902cd0..77003e5af 100644 --- a/src/input/Input.tsx +++ b/src/input/Input.tsx @@ -73,6 +73,7 @@ interface InputFieldProps { defaultValue?: string; placeholder?: string; defaultChecked?: boolean; + min?: number; onChange?: (event: ChangeEvent) => void; } @@ -91,6 +92,7 @@ export const InputField = forwardRef< suffix, description, disabled, + min, ...rest }, ref, @@ -127,6 +129,7 @@ export const InputField = forwardRef< checked={checked} disabled={disabled} aria-describedby={descriptionId} + min={min} {...rest} /> )} diff --git a/src/settings/SettingsModal.tsx b/src/settings/SettingsModal.tsx index 45b32ae3d..4ffcecf5d 100644 --- a/src/settings/SettingsModal.tsx +++ b/src/settings/SettingsModal.tsx @@ -227,9 +227,13 @@ export const SettingsModal: FC = ({ type="number" label={t("developer_mode.duplicate_tiles_label")} value={duplicateTiles.toString()} + min={0} onChange={useCallback( (event: ChangeEvent): void => { const value = event.target.valueAsNumber; + if (value < 0) { + return; + } setDuplicateTiles(Number.isNaN(value) ? 0 : value); }, [setDuplicateTiles],