|
|
@ -13,7 +13,6 @@ export default class UnitInput extends PureComponent { |
|
|
|
children: PropTypes.node, |
|
|
|
children: PropTypes.node, |
|
|
|
actionComponent: PropTypes.node, |
|
|
|
actionComponent: PropTypes.node, |
|
|
|
error: PropTypes.bool, |
|
|
|
error: PropTypes.bool, |
|
|
|
maxModeOn: PropTypes.bool, |
|
|
|
|
|
|
|
onChange: PropTypes.func, |
|
|
|
onChange: PropTypes.func, |
|
|
|
placeholder: PropTypes.string, |
|
|
|
placeholder: PropTypes.string, |
|
|
|
suffix: PropTypes.string, |
|
|
|
suffix: PropTypes.string, |
|
|
@ -63,33 +62,20 @@ export default class UnitInput extends PureComponent { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
render() { |
|
|
|
render() { |
|
|
|
const { |
|
|
|
const { error, placeholder, suffix, actionComponent, children } = this.props |
|
|
|
error, |
|
|
|
|
|
|
|
placeholder, |
|
|
|
|
|
|
|
suffix, |
|
|
|
|
|
|
|
actionComponent, |
|
|
|
|
|
|
|
children, |
|
|
|
|
|
|
|
maxModeOn, |
|
|
|
|
|
|
|
} = this.props |
|
|
|
|
|
|
|
const { value } = this.state |
|
|
|
const { value } = this.state |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<div |
|
|
|
<div |
|
|
|
className={classnames( |
|
|
|
className={classnames('unit-input', { 'unit-input--error': error })} |
|
|
|
'unit-input', |
|
|
|
onClick={this.handleFocus} |
|
|
|
{ 'unit-input--error': error }, |
|
|
|
|
|
|
|
{ 'unit-input__disabled': maxModeOn }, |
|
|
|
|
|
|
|
)} |
|
|
|
|
|
|
|
onClick={maxModeOn ? null : this.handleFocus} |
|
|
|
|
|
|
|
> |
|
|
|
> |
|
|
|
<div className="unit-input__inputs"> |
|
|
|
<div className="unit-input__inputs"> |
|
|
|
<div className="unit-input__input-container"> |
|
|
|
<div className="unit-input__input-container"> |
|
|
|
<input |
|
|
|
<input |
|
|
|
type="number" |
|
|
|
type="number" |
|
|
|
dir="ltr" |
|
|
|
dir="ltr" |
|
|
|
className={classnames('unit-input__input', { |
|
|
|
className={classnames('unit-input__input')} |
|
|
|
'unit-input__disabled': maxModeOn, |
|
|
|
|
|
|
|
})} |
|
|
|
|
|
|
|
value={value} |
|
|
|
value={value} |
|
|
|
placeholder={placeholder} |
|
|
|
placeholder={placeholder} |
|
|
|
onChange={this.handleChange} |
|
|
|
onChange={this.handleChange} |
|
|
@ -97,7 +83,6 @@ export default class UnitInput extends PureComponent { |
|
|
|
ref={(ref) => { |
|
|
|
ref={(ref) => { |
|
|
|
this.unitInput = ref |
|
|
|
this.unitInput = ref |
|
|
|
}} |
|
|
|
}} |
|
|
|
disabled={maxModeOn} |
|
|
|
|
|
|
|
/> |
|
|
|
/> |
|
|
|
{suffix && <div className="unit-input__suffix">{suffix}</div>} |
|
|
|
{suffix && <div className="unit-input__suffix">{suffix}</div>} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|