"use strict";var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;exports.__esModule = true;exports.DatePickerPlayground = void 0;var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));var _inheritsLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/inheritsLoose"));var _react = _interopRequireDefault(require("react"));


var _Tooltip = require("../../components/Tooltip");

var _DatePicker = require("../../components/DatePicker");var







DatePickerPlayground = exports.DatePickerPlayground = /*#__PURE__*/function (_React$Component) {function DatePickerPlayground() {var _this;for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {args[_key] = arguments[_key];}_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;_this.
    state = {
      value: '17.06.2019',
      error: false,
      tooltip: false
    };_this.























    handleChange = function (value) {
      _this.setState({
        value: value
      });
    };_this.

    invalidate = function () {
      _this.setState({ error: false, tooltip: false });
    };_this.

    validate = function () {
      var currentValue = _this.state.value;
      _this.setState(function () {
        var error = !!currentValue && !_DatePicker.DatePicker.validate(currentValue);
        return {
          error: error,
          tooltip: error
        };
      });
    };_this.

    removeTooltip = function () {
      _this.setState({
        tooltip: false
      });
    };return _this;}(0, _inheritsLoose2.default)(DatePickerPlayground, _React$Component);var _proto = DatePickerPlayground.prototype;_proto.render = function render() {return /*#__PURE__*/_react.default.createElement(_Tooltip.Tooltip, { trigger: this.state.tooltip ? 'opened' : 'closed', render: function render() {return 'Такой даты не существует';}, onCloseClick: this.removeTooltip }, /*#__PURE__*/_react.default.createElement(_DatePicker.DatePicker, (0, _extends2.default)({}, this.props, { disabled: this.props.disabled, size: this.props.size, error: this.state.error, value: this.state.value, onValueChange: this.handleChange, onFocus: this.invalidate, onBlur: this.validate, enableTodayLink: true })));};return DatePickerPlayground;}(_react.default.Component);