"use strict";

exports.__esModule = true;
exports.TimeInput = exports.TimeButton = exports.TimeIcon = void 0;

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

var _styledComponents = _interopRequireDefault(require("styled-components"));

var _utils = require("../../../utils");

var _Icon = _interopRequireDefault(require("../../Icon"));

var _Text = require("./Text");

var _FieldButtons = require("./FieldButtons");

var _excluded = ["update", "required", "value"];

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

(function () {
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
  enterModule && enterModule(module);
})();

(function () {
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
  enterModule && enterModule(module);
})();

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
  return a;
};

var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
  return a;
};

// TODO: Time dialog on focus, prevent default behavior in Edge, Firefox
var TimeIcon = (0, _styledComponents.default)(_Icon.default).attrs(function (props) {
  return {
    id: (0, _utils.getThemeProp)(["icons", "time"], "clock")(props)
  };
}).withConfig({
  displayName: "Time__TimeIcon",
  componentId: "sc-15jtfxc-0"
})(["font-size:20px;"]);
exports.TimeIcon = TimeIcon;
var TimeButton = (0, _styledComponents.default)(_FieldButtons.InputButton).withConfig({
  displayName: "Time__TimeButton",
  componentId: "sc-15jtfxc-1"
})(["margin-top:-1px;margin-right:-1px;min-width:36px;padding:4px 7px;border-left-color:transparent;background-color:#fff;"]);
exports.TimeButton = TimeButton;

var TimeInput = function TimeInput(_ref) {
  var update = _ref.update,
      required = _ref.required,
      value = _ref.value,
      props = _objectWithoutProperties(_ref, _excluded);

  return /*#__PURE__*/_react.default.createElement(_FieldButtons.ButtonWrapper, {
    invalid: required && !value
  }, /*#__PURE__*/_react.default.createElement(_Text.FormInput, _extends({
    type: "time",
    onChange: (0, _Text.getEventUpdater)(update),
    value: value
  }, props)), /*#__PURE__*/_react.default.createElement(TimeButton, null, /*#__PURE__*/_react.default.createElement(TimeIcon, null)));
};

exports.TimeInput = TimeInput;
;

(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;

  if (!reactHotLoader) {
    return;
  }

  reactHotLoader.register(TimeIcon, "TimeIcon", "/home/vsts/work/1/s/src/components/Form/Inputs/Time.js");
  reactHotLoader.register(TimeButton, "TimeButton", "/home/vsts/work/1/s/src/components/Form/Inputs/Time.js");
  reactHotLoader.register(TimeInput, "TimeInput", "/home/vsts/work/1/s/src/components/Form/Inputs/Time.js");
})();

;

(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();

;

(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;

  if (!reactHotLoader) {
    return;
  }

  reactHotLoader.register(TimeIcon, "TimeIcon", "/home/vsts/work/1/s/src/components/Form/Inputs/Time.js");
  reactHotLoader.register(TimeButton, "TimeButton", "/home/vsts/work/1/s/src/components/Form/Inputs/Time.js");
  reactHotLoader.register(TimeInput, "TimeInput", "/home/vsts/work/1/s/src/components/Form/Inputs/Time.js");
})();

;

(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();