var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import React from 'react';
import { withRenderEnvironment } from '../../lib/renderEnvironment/index.js';
import { getDateForNative, getDateForComponent } from './utils.js';
import { getJsStyles } from './NativeDateInput.styles.js';
var DEFAULT_MIN_DATE = '1900-01-01';
var DEFAULT_MAX_DATE = '2099-12-31';
var NativeDateInput = /** @class */ (function (_super) {
    __extends(NativeDateInput, _super);
    function NativeDateInput() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        /**
         * @public
         */
        _this.focus = function () {
            if (_this.input) {
                _this.input.focus();
            }
        };
        /**
         * @public
         */
        _this.click = function () {
            if (_this.input) {
                _this.input.click();
            }
        };
        _this.refInput = function (element) {
            _this.input = element;
        };
        return _this;
    }
    NativeDateInput.prototype.render = function () {
        var _this = this;
        this.jsStyles = getJsStyles(this.emotion);
        return (React.createElement("input", { type: 'date', max: this.props.maxDate ? getDateForNative(this.props.maxDate) : DEFAULT_MAX_DATE, min: this.props.minDate ? getDateForNative(this.props.minDate) : DEFAULT_MIN_DATE, value: getDateForNative(this.props.value), onChange: function (e) {
                if (_this.props.onValueChange) {
                    _this.props.onValueChange(getDateForComponent(e.target.value));
                }
            }, className: this.jsStyles.inputTypeDate(), ref: this.refInput, disabled: this.props.disabled, tabIndex: -1 }));
    };
    NativeDateInput.__KONTUR_REACT_UI__ = 'NativeDatePicker';
    NativeDateInput.displayName = 'NativeDatePicker';
    NativeDateInput = __decorate([
        withRenderEnvironment
    ], NativeDateInput);
    return NativeDateInput;
}(React.Component));
export { NativeDateInput };
//# sourceMappingURL=NativeDateInput.js.map