import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
import React, { useEffect } from "react";
import { NumberPicker } from "@alicloudfe/components";
import cls from "classnames";
import BDesignTheme from '../theme';

var BDesignNumberPicker = function BDesignNumberPicker(props) {
  useEffect(function () {
    var inp = document.querySelectorAll('input');

    if (inp && inp.length) {
      inp.forEach(function (item) {
        item.onfocus = function () {
          item.parentNode.parentElement.classList.add("next-input-group-blue"); //添加类名
        };

        item.onblur = function () {
          item.parentNode.parentElement.classList.remove("next-input-group-blue"); //移除类名
        };
      });
    }
  });

  var className = props.className,
      theme = props.theme,
      shape = props.shape,
      rest = _objectWithoutProperties(props, ["className", "theme", "shape"]);

  return /*#__PURE__*/React.createElement(BDesignTheme, {
    theme: theme
  }, function (theme) {
    return /*#__PURE__*/React.createElement(NumberPicker, _extends({
      className: cls(className, {
        'b-design_icon__container': true,
        'next-number-picker-primary': shape === "primary",
        'next-number-picker-dark': theme === "dark"
      })
    }, rest));
  });
};

export default BDesignNumberPicker;