import { _ as _extends } from '../extends-C4cduGrv.js';
import { _ as _objectWithoutProperties } from '../objectWithoutProperties-TXwlfNxG.js';
import React__default from 'react';
import PropTypes from 'prop-types';
import { t as tr } from '../react-datepicker-LIxGrEze.js';
import cx from 'classnames';
import Label from '../label/index.js';
import '../typeof-CgC7Bq6K.js';
import 'react-dom';
import '../Popper-CsEj9W8C.js';
import '../usePopper-DMhEmCof.js';
import '../warning-s9zGJbnw.js';
import '@reach/visually-hidden';

var _excluded = ["name", "value", "onChange", "timeIntervals", "label"];

function DatePickerInput(_ref) {
  var name = _ref.name,
      value = _ref.value,
      onChange = _ref.onChange,
      _ref$timeIntervals = _ref.timeIntervals,
      timeIntervals = _ref$timeIntervals === void 0 ? 15 : _ref$timeIntervals,
      label = _ref.label,
      props = _objectWithoutProperties(_ref, _excluded);

  var handleChange = function handleChange(date) {
    onChange({
      target: {
        name: name,
        value: date
      }
    });
  };

  var className = cx(props.className, "border border-gray-200 text-sm px-2 py-1 rounded-sm focus:outline-blue");
  return /*#__PURE__*/React__default.createElement("div", null, label && /*#__PURE__*/React__default.createElement(Label, {
    as: "div",
    className: "mb-1"
  }, label), /*#__PURE__*/React__default.createElement(tr, _extends({
    showTimeSelect: true,
    showPopperArrow: false,
    timeFormat: "h:mm aa",
    timeIntervals: timeIntervals,
    timeCaption: "time",
    dateFormat: "MMMM d, yyyy h:mm aa",
    className: className,
    value: value,
    onChange: handleChange
  }, props)));
}

DatePickerInput.propTypes = {
  name: PropTypes.string,
  value: PropTypes.object,
  className: PropTypes.string,
  onChange: PropTypes.func,
  timeIntervals: PropTypes.number,
  label: PropTypes.string
};

export { DatePickerInput as default };
