import _extends from "@babel/runtime/helpers/esm/extends";
import React, { useRef } from "react";
import { Input } from "./Input";
import { useInputHours } from "../../hooks/useInputHours";
import { validateTimeInput } from "../../utils";
import useForkRef from "../../utils/useForkRef";
export const InputHours = /*#__PURE__*/React.forwardRef((_ref, ref) => {
  let {
    value: defaultValue,
    onCancel,
    onSave,
    onEnterKeyPress: externalEnterKeyPress,
    allowEmptyValue,
    withLeadingZero = true,
    validation = validateTimeInput,
    incrementOnlySelected = false,
    minuteIncrement = 1,
    className,
    onChange: externalOnChange,
    onClick: externalOnClick,
    align = "center",
    ...rest
  } = _ref;
  const inputRef = useRef(null);
  const handleRef = useForkRef(ref, inputRef);
  const {
    inputProps
  } = useInputHours({
    value: defaultValue,
    withLeadingZero,
    onSave,
    validation,
    allowEmptyValue,
    onCancel,
    minuteIncrement,
    incrementOnlySelected,
    onEnterKeyPress: externalEnterKeyPress,
    onChange: externalOnChange,
    onClick: externalOnClick
  }, inputRef);
  const {
    value,
    onBlur,
    onKeyDown,
    onChange,
    onClick,
    onDoubleClick
  } = inputProps;
  return /*#__PURE__*/React.createElement(Input, _extends({}, rest, {
    align: align,
    className: className,
    placeholder: withLeadingZero ? "00:00" : "0:00",
    value: value,
    onBlur: onBlur,
    onKeyDown: onKeyDown,
    onChange: onChange,
    onClick: onClick,
    onDoubleClick: onDoubleClick,
    ref: handleRef,
    autoComplete: "off"
  }));
});
InputHours.displayName = "InputHours";
//# sourceMappingURL=InputHours.js.map