diff --git a/src/Input/index.tsx b/src/Input/index.tsx index 71d88eb..c5a6a3b 100644 --- a/src/Input/index.tsx +++ b/src/Input/index.tsx @@ -48,6 +48,11 @@ interface Props extends React.DetailedHTMLProps { break case 'number': baseProps.onWheel = (ev: React.WheelEvent) => ev.currentTarget.blur() - iconLeft = this.props.iconLeft ?? {icon: MinusSquare, transformer: (v) => { - let value = parseFloat(v) - if (isNaN(value)) { - value = 0 - } - return (value - this.ensureNumber(this.props.step, 1)).toString() - }} - iconRight = this.props.iconRight ?? {icon: PlusSquare, transformer: (v) => { - let value = parseFloat(v) - if (isNaN(value)) { - value = 0 - } - return (value + this.ensureNumber(this.props.step, 1)).toString() - }} + if (!this.props.disabled && !this.props.disableAutoIcons) { + iconLeft = this.props.iconLeft ?? {icon: MinusSquare, transformer: (v) => { + let value = parseFloat(v) + if (isNaN(value)) { + value = 0 + } + return (value - this.ensureNumber(this.props.step, 1)).toString() + }} + iconRight = this.props.iconRight ?? {icon: PlusSquare, transformer: (v) => { + let value = parseFloat(v) + if (isNaN(value)) { + value = 0 + } + return (value + this.ensureNumber(this.props.step, 1)).toString() + }} + } default: input = { {/* Right Icon */} {iconRight ? this.getIcon(iconRight, 'right') : - (this.props.choices && !this.props.disabled) && ( + (this.props.choices && !this.props.disabled && !this.props.disableAutoIcons) && ( ) } @@ -316,6 +323,7 @@ export default class Input extends React.PureComponent { if ('icon' in Icon) { return { + if (this.props.disabled) {return} const value = Icon.transformer(this.state.value ?? this.state.displayedValue ?? '') this.setState({ value: value, displayedValue: value, valueUpdate: true }) }} />