diff --git a/packages/strapi-helper-plugin/lib/src/components/InputNumber/index.js b/packages/strapi-helper-plugin/lib/src/components/InputNumber/index.js index c5fa4dce0e..5aafe09b9b 100644 --- a/packages/strapi-helper-plugin/lib/src/components/InputNumber/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/InputNumber/index.js @@ -29,6 +29,7 @@ function InputNumber(props) { onFocus={props.onFocus} placeholder={message} ref={props.inputRef} + step={!Number.isNaN(Number(props.step)) ? Number(props.step) : 1} style={props.style} tabIndex={props.tabIndex} type="number" @@ -49,6 +50,7 @@ InputNumber.defaultProps = { onBlur: () => {}, onFocus: () => {}, placeholder: 'app.utils.placeholder.defaultMessage', + step: 1, style: {}, tabIndex: '0', }; @@ -65,6 +67,7 @@ InputNumber.propTypes = { onChange: PropTypes.func.isRequired, onFocus: PropTypes.func, placeholder: PropTypes.string, + step: PropTypes.number, style: PropTypes.object, tabIndex: PropTypes.string, value: PropTypes.oneOfType([ diff --git a/packages/strapi-helper-plugin/lib/src/components/InputNumberWithErrors/index.js b/packages/strapi-helper-plugin/lib/src/components/InputNumberWithErrors/index.js index 56668821b4..d1f435c6fe 100644 --- a/packages/strapi-helper-plugin/lib/src/components/InputNumberWithErrors/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/InputNumberWithErrors/index.js @@ -83,6 +83,7 @@ class InputNumberWithErrors extends React.Component { // eslint-disable-line rea placeholder, style, tabIndex, + step, value, } = this.props; const handleBlur = isFunction(onBlur) ? onBlur : this.handleBlur; @@ -121,6 +122,7 @@ class InputNumberWithErrors extends React.Component { // eslint-disable-line rea placeholder={placeholder} style={inputStyle} tabIndex={tabIndex} + step={step} value={value} />