From 7c09bbc77f680bc889afd86c3e37aa019349f138 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wilder=20Gonz=C3=A1lez=20D=C3=ADaz?= <3240995+wildergd@users.noreply.github.com> Date: Thu, 13 Jul 2023 13:51:04 -0600 Subject: [PATCH] fix: add `step` to props to `Input` component (#2623) * fix: add step to props * fix: minor issues --- src/components/Input/index.d.ts | 1 + src/components/Input/index.js | 3 +++ src/components/Input/inputBase/index.js | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/src/components/Input/index.d.ts b/src/components/Input/index.d.ts index eef27b362..f62b2c2a0 100644 --- a/src/components/Input/index.d.ts +++ b/src/components/Input/index.d.ts @@ -38,6 +38,7 @@ export interface InputProps extends BaseProps { iconPosition?: IconPosition; max?: number | string; min?: number | string; + step?: number | string; maxLength?: number; minLength?: number; bottomHelpText?: ReactNode; diff --git a/src/components/Input/index.js b/src/components/Input/index.js index b91de9777..e9f1ceea6 100644 --- a/src/components/Input/index.js +++ b/src/components/Input/index.js @@ -91,6 +91,8 @@ Input.propTypes = { /** Describes the position of the icon with respect to body. Options include left and right. * This value defaults to left. */ iconPosition: PropTypes.oneOf(['left', 'right']), + /** Specifies the increment step allowed in the field. */ + step: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), /** Specifies the minimum value allowed in the field. */ max: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), /** Specifies the maximum value allowed in the field. */ @@ -162,6 +164,7 @@ Input.defaultProps = { iconPosition: 'left', max: undefined, min: undefined, + step: undefined, maxLength: undefined, minLength: undefined, bottomHelpText: null, diff --git a/src/components/Input/inputBase/index.js b/src/components/Input/inputBase/index.js index b7ec98740..e48710a9f 100644 --- a/src/components/Input/inputBase/index.js +++ b/src/components/Input/inputBase/index.js @@ -108,6 +108,7 @@ export default class InputBase extends Component { type, max, min, + step, maxLength, minLength, pattern, @@ -171,6 +172,7 @@ export default class InputBase extends Component { required={required} max={max} min={min} + step={step} maxLength={maxLength} minLength={minLength} pattern={pattern} @@ -233,6 +235,7 @@ InputBase.propTypes = { iconPosition: PropTypes.oneOf(['left', 'right']), max: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), min: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), + step: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), maxLength: PropTypes.number, minLength: PropTypes.number, bottomHelpText: PropTypes.oneOfType([PropTypes.string, PropTypes.node]), @@ -272,6 +275,7 @@ InputBase.defaultProps = { iconPosition: 'left', max: undefined, min: undefined, + step: undefined, maxLength: undefined, minLength: undefined, bottomHelpText: null,