import { InputNumber } from 'antd';

export default function NumberInput({ label, value, onChange, unit, min = 0, step = 1 }) {
    const handleChange = (newValue) => {
        const numValue = Math.max(min, newValue || 0);
        onChange(numValue);
    };

    return (
        <div className="form-row">
            <label className="form-label">{label}</label>
            <InputNumber
                value={value}
                onChange={handleChange}
                min={min}
                step={step}
                placeholder="0"
                addonAfter={unit}
                size="large"
                style={{ width: '100%' }}
                controls={false}
            />
        </div>
    );
}
