"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _vue = require("vue");
var _inputNumber = _interopRequireDefault(require("../../input-number"));
var _propsUtil = require("../../_util/props-util");
var _classNames = _interopRequireDefault(require("../../_util/classNames"));
const colorSteppersProps = () => ({
  prefixCls: String,
  value: Number,
  min: Number,
  max: Number,
  onChange: Function,
  className: String,
  prefix: Function,
  formatter: Function
});
const ColorSteppers = (0, _vue.defineComponent)({
  name: 'ColorSteppers',
  inheritAttrs: false,
  props: (0, _propsUtil.initDefaultProps)(colorSteppersProps(), {
    min: 0,
    max: 100
  }),
  setup(props) {
    const colorSteppersPrefixCls = (0, _vue.computed)(() => `${props.prefixCls}-steppers`);
    const internalValue = (0, _vue.ref)(0);
    const stepValue = (0, _vue.computed)(() => !Number.isNaN(props.value) ? props.value : internalValue.value);
    return () => {
      const {
        className,
        min,
        max,
        formatter,
        onChange
      } = props;
      return (0, _vue.createVNode)(_inputNumber.default, {
        "class": (0, _classNames.default)(colorSteppersPrefixCls.value, className),
        "min": min,
        "max": max,
        "value": stepValue.value,
        "formatter": formatter,
        "size": "small",
        "onChange": step => {
          internalValue.value = Number(step) || 0;
          onChange === null || onChange === void 0 ? void 0 : onChange(Number(step));
        }
      }, null);
    };
  }
});
var _default = exports.default = ColorSteppers;