"use strict";

exports.__esModule = true;
exports.useTouchedState = void 0;
var _react = require("react");
var useTouchedState = exports.useTouchedState = function useTouchedState(_ref) {
  var onBlur = _ref.onBlur,
    _ref$defaultState = _ref.defaultState,
    defaultState = _ref$defaultState === void 0 ? false : _ref$defaultState;
  var _useState = (0, _react.useState)(defaultState),
    touchedState = _useState[0],
    setTouchedState = _useState[1];
  var handleBlur = (0, _react.useCallback)(function (e) {
    if (!touchedState) {
      setTouchedState(true);
    }
    if (onBlur) {
      onBlur(e);
    }
  }, [onBlur, touchedState]);
  return [touchedState, handleBlur, setTouchedState];
};