"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));

var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));

var _react = _interopRequireWildcard(require("react"));

var _classnames = _interopRequireDefault(require("classnames"));

var _enum = require("../../../lib/_util/enum");

var _localeContext = require("../locale-context");

var _NumberField = _interopRequireDefault(require("../number-field/NumberField"));

var QuickJumper = function QuickJumper(props) {
  var prefixCls = props.prefixCls,
      value = props.value,
      onChange = props.onChange,
      disabled = props.disabled,
      gotoButton = props.gotoButton;

  var _useState = (0, _react.useState)(false),
      _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
      focused = _useState2[0],
      setFocused = _useState2[1];

  var handleFocus = (0, _react.useCallback)(function () {
    return setFocused(true);
  }, []);
  var handleBlur = (0, _react.useCallback)(function () {
    return setFocused(false);
  }, []);
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("span", {
    className: "".concat(prefixCls, "-quick-jumper")
  }, (0, _localeContext.$l)('Pagination', 'jump_to')), /*#__PURE__*/_react["default"].createElement("span", {
    className: (0, _classnames["default"])("".concat(prefixCls, "-quick-jumper-input"), (0, _defineProperty2["default"])({}, "".concat(prefixCls, "-quick-jumper-input-focused"), focused))
  }, /*#__PURE__*/_react["default"].createElement(_NumberField["default"], {
    value: value,
    disabled: disabled,
    min: 1,
    onChange: onChange,
    onFocus: handleFocus,
    onBlur: handleBlur,
    size: _enum.Size.small,
    isFlat: true,
    border: false
  }), (0, _localeContext.$l)('Pagination', 'page')), gotoButton);
};

QuickJumper.displayName = 'QuickJumper';
var _default = QuickJumper;
exports["default"] = _default;
//# sourceMappingURL=QuickJumper.js.map
