import _extends from "@babel/runtime/helpers/esm/extends";
import React, { forwardRef, useRef } from "react";
import { Input } from "./Input";
import { useInputNumber } from "../../hooks";
import { useForkRef } from "../../utils";
export const InputNumber = /*#__PURE__*/forwardRef((_ref, ref) => {
  let {
    decimalLength = 2,
    decimalSeparator = ".",
    disableAbbreviation = false,
    disabled,
    disableMacros = false,
    invalid,
    step = 1,
    thousandSeparator = ",",
    value: defaultValue,
    onCancel,
    onSave,
    onEnterKeyPress: externalEnterKeyPress,
    allowEmptyValue,
    onChange: externalOnChange,
    onClick: externalOnClick,
    limit,
    placeholder,
    trimDecimals = true,
    min,
    max,
    onBlur: externalOnBlur,
    ...rest
  } = _ref;
  const inputRef = useRef(null);
  const handleRef = useForkRef(ref, inputRef);
  const {
    value,
    onBlur,
    onKeyDown,
    onChange,
    onClick,
    onFocus,
    onDoubleClick
  } = useInputNumber({
    decimalLength,
    decimalSeparator,
    disableAbbreviation,
    disableMacros,
    step,
    thousandSeparator,
    onEnterKeyPress: externalEnterKeyPress,
    onChange: externalOnChange,
    onClick: externalOnClick,
    value: defaultValue,
    onCancel,
    onSave,
    allowEmptyValue,
    limit,
    trimDecimals,
    min,
    max,
    onBlur: externalOnBlur
  }, inputRef);
  return /*#__PURE__*/React.createElement(Input, _extends({}, rest, {
    ref: handleRef,
    placeholder: placeholder,
    value: value,
    type: "text",
    disabled: disabled,
    invalid: invalid,
    onChange: onChange,
    onBlur: onBlur,
    onKeyDown: onKeyDown,
    onClick: onClick,
    onDoubleClick: onDoubleClick,
    onFocus: onFocus,
    "aria-placeholder": placeholder,
    "aria-disabled": disabled,
    "aria-invalid": invalid
  }));
});
InputNumber.displayName = "InputNumber";
//# sourceMappingURL=InputNumber.js.map