"use strict";
var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Datepicker = exports.DatepickerWithUnform = exports.DatepickerWithoutUnform = void 0;
var react_1 = __importStar(require("react"));
var react_hooks_1 = require("@devesharp/react-hooks");
var react_utils_1 = require("@devesharp/react-utils");
var free_regular_svg_icons_1 = require("@fortawesome/free-regular-svg-icons");
var free_solid_svg_icons_1 = require("@fortawesome/free-solid-svg-icons");
var react_fontawesome_1 = require("@fortawesome/react-fontawesome");
var core_1 = require("@unform/core");
var dateFns = __importStar(require("date-fns"));
var styled_components_1 = require("styled-components");
var Checkbox_1 = require("../Checkbox");
var styles_1 = require("../styles");
var Datepicker_style_1 = __importDefault(require("./Datepicker.style"));
function InputDatePicker(_a) {
    var date = _a.date, error = _a.error, setOpen = _a.setOpen, withTimePicker = _a.withTimePicker, removeDate = _a.removeDate, allDay = _a.allDay, formatShowDate = _a.formatShowDate, formatTimeDate = _a.formatTimeDate;
    var viewDateStringView = date ? dateFns.format(date, formatShowDate) : '';
    var viewTimeStringView = date ? dateFns.format(date, formatTimeDate) : '';
    return (react_1.default.createElement(react_1.default.Fragment, null,
        !date && (react_1.default.createElement("div", { className: "input-border " + (error && 'has-error'), "data-testid": "datepicker-input" },
            react_1.default.createElement("div", { className: "prefix calendar-icon" },
                react_1.default.createElement(react_fontawesome_1.FontAwesomeIcon, { icon: free_regular_svg_icons_1.faCalendarAlt })),
            react_1.default.createElement("div", { className: "input pl-3" }, "Selecione um data"),
            react_1.default.createElement("div", { className: "container-cursor", "data-testid": "open-popup", onClick: function () { return setOpen(true); } }))),
        !!date && (react_1.default.createElement("div", { className: "input-border", "data-cy": "view-date" },
            react_1.default.createElement("div", { className: "table calendar-input" },
                react_1.default.createElement("div", { className: "text-primary calendar-icon" },
                    react_1.default.createElement(react_fontawesome_1.FontAwesomeIcon, { icon: free_regular_svg_icons_1.faCalendarAlt })),
                react_1.default.createElement("div", { className: "pl-3 text-primary font-weight-bold flex-fill date-input-container", "data-testid": "datepicker-input" },
                    react_1.default.createElement("div", { className: "date", "data-testid": "date-string" }, viewDateStringView),
                    withTimePicker && !allDay && react_1.default.createElement("div", { className: "time" }, viewTimeStringView),
                    withTimePicker && allDay && react_1.default.createElement("div", { className: "time" }, "O dia todo")),
                react_1.default.createElement("div", { className: "font-weight-bold align-self-center remove-date", "data-testid": "datepicker-remove-date", onClick: removeDate },
                    react_1.default.createElement(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faTimes }))),
            react_1.default.createElement("div", { className: "container-cursor", "data-testid": "open-popup", onClick: function () { return setOpen(true); } })))));
}
function DatePickerCalendar(_a) {
    var calendarDate = _a.calendarDate, setCalendarDate = _a.setCalendarDate, selectedDate = _a.selectedDate, setSelectedDate = _a.setSelectedDate, disablePastDates = _a.disablePastDates;
    var monthName = react_hooks_1.useMemoImmer(function () { return react_utils_1.Calendar.monthsName[dateFns.getMonth(calendarDate)]; }, [calendarDate]);
    var calendarYear = dateFns.getYear(calendarDate);
    var weekNames = react_1.useMemo(function () { return react_utils_1.Calendar.weeksName; }, []);
    var month = react_1.useMemo(function () { return react_utils_1.Calendar.getMonth(dateFns.getMonth(calendarDate), dateFns.getYear(calendarDate)); }, [
        calendarDate,
    ]);
    var NextMonth = react_1.useCallback(function NextMonth() {
        setCalendarDate(function (d) { return dateFns.addMonths(d, 1); });
    }, []);
    var PreviousMonth = react_1.useCallback(function PreviousMonth() {
        setCalendarDate(function (d) { return dateFns.subMonths(d, 1); });
    }, []);
    return (react_1.default.createElement(react_1.default.Fragment, null,
        react_1.default.createElement("div", { className: "month" },
            react_1.default.createElement("span", { className: "right", onClick: NextMonth },
                react_1.default.createElement(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faAngleRight, "data-testid": "datepicker-next-month" })),
            react_1.default.createElement("span", { className: "left", onClick: PreviousMonth },
                react_1.default.createElement(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faAngleLeft, "data-testid": "datepicker-previous-month" })),
            react_1.default.createElement("div", { className: "month-name", "data-testid": "datepicker-month-name" },
                monthName,
                ", ",
                calendarYear)),
        weekNames.map(function (nameWeek, i) { return (react_1.default.createElement("div", { key: nameWeek + "-" + i, className: "weekName" }, nameWeek)); }),
        month.map(function (week, weekI) { return (react_1.default.createElement("div", { key: weekI, className: "week" }, week.map(function (day) { return (react_1.default.createElement("div", { key: day.dateYYYYMMDD, "data-testid": day.dateYYYYMMDD, className: "day " + (day.today && 'today') + " " + (disablePastDates && day.past && 'disable-past') + " " + (dateFns.isSameDay(day.dateInstance, selectedDate) && 'select') + " " + (!day.currentMonth && 'other-month'), onClick: function () { return setSelectedDate(day.dateInstance); } }, day.day)); }))); })));
}
function TimePicker(_a) {
    var date = _a.date, setDate = _a.setDate, allDayValue = _a.allDayValue, onAllDayChange = _a.onAllDayChange, enableAllDay = _a.enableAllDay;
    var theme = styled_components_1.useTheme();
    var _b = (theme !== null && theme !== void 0 ? theme : {}).datePicker, datePicker = _b === void 0 ? {} : _b;
    var defaultColor = datePicker.defaultColor;
    var hourInputRef = react_1.useRef();
    var minuteInputRef = react_1.useRef();
    react_1.useEffect(function () {
        hourInputRef.current.value = dateFns.format(date !== null && date !== void 0 ? date : new Date(), 'HH');
        minuteInputRef.current.value = dateFns.format(date !== null && date !== void 0 ? date : new Date(), 'mm');
    }, [date]);
    var SubHour = react_1.useCallback(function SubHour() {
        setDate(dateFns.subHours(date !== null && date !== void 0 ? date : new Date(), 1));
    }, [date]);
    var AddHour = react_1.useCallback(function AddHour() {
        setDate(dateFns.addHours(date !== null && date !== void 0 ? date : new Date(), 1));
    }, [date]);
    var SubMinute = react_1.useCallback(function SubMinute() {
        setDate(dateFns.setHours(dateFns.subMinutes(date !== null && date !== void 0 ? date : new Date(), 1), dateFns.getHours(date !== null && date !== void 0 ? date : new Date())));
    }, [date]);
    var AddMinute = react_1.useCallback(function AddMinute() {
        setDate(dateFns.setHours(dateFns.addMinutes(date !== null && date !== void 0 ? date : new Date(), 1), dateFns.getHours(date !== null && date !== void 0 ? date : new Date())));
    }, [date]);
    var OnChangeHour = react_1.useCallback(function OnChangeHour() {
        if (hourInputRef.current.value.length >= 2) {
            minuteInputRef.current.focus();
            minuteInputRef.current.select();
        }
    }, [date]);
    var OnBlurHours = react_1.useCallback(function OnBlurHours() {
        var newDate = dateFns.setHours(date !== null && date !== void 0 ? date : new Date(), Number(react_utils_1.OnlyNumbers(hourInputRef.current.value)));
        newDate = dateFns.setDate(newDate, dateFns.getDate(date !== null && date !== void 0 ? date : new Date()));
        newDate = dateFns.setMonth(newDate, dateFns.getMonth(date !== null && date !== void 0 ? date : new Date()));
        setDate(newDate);
    }, [date]);
    var OnChangeMinutes = react_1.useCallback(function OnChangeMinutes() { }, [date]);
    var OnBlurMinutes = react_1.useCallback(function OnBlurMinutes() {
        var newDate = dateFns.setMinutes(date !== null && date !== void 0 ? date : new Date(), Number(react_utils_1.OnlyNumbers(minuteInputRef.current.value)));
        newDate = dateFns.setHours(newDate, dateFns.getHours(date !== null && date !== void 0 ? date : new Date()));
        newDate = dateFns.setDate(newDate, dateFns.getDate(date !== null && date !== void 0 ? date : new Date()));
        newDate = dateFns.setMonth(newDate, dateFns.getMonth(date !== null && date !== void 0 ? date : new Date()));
        setDate(newDate);
    }, [date]);
    return (react_1.default.createElement("div", null,
        react_1.default.createElement("hr", null),
        enableAllDay && (react_1.default.createElement(Checkbox_1.Checkbox, { title: "Dia todo", checked: allDayValue, onChange: onAllDayChange, "data-testid": "datepicker-all-day", color: defaultColor })),
        react_1.default.createElement("div", { className: "timepicker" },
            react_1.default.createElement("div", { className: "d-flex w-100" },
                react_1.default.createElement("div", { className: "d-flex flex-fill" },
                    react_1.default.createElement("div", { className: "plus flex-fill align-self-center", onClick: SubHour },
                        react_1.default.createElement(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faMinusCircle })),
                    react_1.default.createElement("div", { className: "input-time" },
                        react_1.default.createElement("input", { type: "text", defaultValue: "00", ref: hourInputRef, onFocus: function () { return hourInputRef.current.select(); }, onChange: OnChangeHour, onBlur: OnBlurHours, maxLength: 3, "data-testid": "datepicker-input-hour" })),
                    react_1.default.createElement("div", { className: "plus flex-fill align-self-center", onClick: AddHour },
                        react_1.default.createElement(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faPlusCircle }))),
                react_1.default.createElement("span", { className: "division" }, ":"),
                react_1.default.createElement("div", { className: "d-flex flex-fill" },
                    react_1.default.createElement("div", { className: "plus flex-fill align-self-center", onClick: SubMinute },
                        react_1.default.createElement(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faMinusCircle })),
                    react_1.default.createElement("div", { className: "input-time" },
                        react_1.default.createElement("input", { type: "text", defaultValue: "00", ref: minuteInputRef, onFocus: function () { return minuteInputRef.current.select(); }, onChange: OnChangeMinutes, onBlur: OnBlurMinutes, maxLength: 2, "data-testid": "datepicker-input-minute" })),
                    react_1.default.createElement("div", { className: "plus flex-fill align-self-center", onClick: AddMinute },
                        react_1.default.createElement(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faPlusCircle })))))));
}
function DatePickerPopup(_a) {
    var enableAllDay = _a.enableAllDay, date = _a.date, setDate = _a.setDate, allDayValue = _a.allDayValue, onAllDayChange = _a.onAllDayChange, calendarDate = _a.calendarDate, setCalendarDate = _a.setCalendarDate, withTimePicker = _a.withTimePicker, applyOnSelect = _a.applyOnSelect, cleanDatePicker = _a.cleanDatePicker, disablePastDates = _a.disablePastDates, onApply = _a.onApply;
    var datePickerPopupRef = react_1.useRef(null);
    react_hooks_1.useClickOutside(function () {
        cleanDatePicker();
    }, datePickerPopupRef);
    return (react_1.default.createElement("div", { className: "datepicker-popup", ref: datePickerPopupRef, "data-testid": "datepicker-popup" },
        react_1.default.createElement(DatePickerCalendar, { calendarDate: calendarDate, selectedDate: date, setSelectedDate: setDate, setCalendarDate: setCalendarDate, disablePastDates: disablePastDates }),
        withTimePicker && (react_1.default.createElement(TimePicker, { date: date, setDate: setDate, allDayValue: allDayValue, onAllDayChange: onAllDayChange, enableAllDay: enableAllDay })),
        applyOnSelect && (react_1.default.createElement("div", { className: "actions" },
            react_1.default.createElement("div", { className: "btn-cancel", "data-testid": "datepicker-cancel", onClick: cleanDatePicker }, "Cancelar"),
            react_1.default.createElement("div", { className: "btn-apply", "data-testid": "datepicker-apply", onClick: onApply }, "Aplicar")))));
}
var DatepickerWithoutUnform = function (_a) {
    var name = _a.name, title = _a.title, _b = _a.withTimePicker, withTimePicker = _b === void 0 ? false : _b, _c = _a.value, value = _c === void 0 ? null : _c, onValueChange = _a.onValueChange, _d = _a.allDay, allDayValue = _d === void 0 ? false : _d, _e = _a.onAllDayChange, onAllDayChange = _e === void 0 ? function () { } : _e, error = _a.error, _f = _a.applyOnSelect, applyOnSelect = _f === void 0 ? false : _f, formattedString = _a.formattedString, _g = _a.formatShowDate, formatShowDate = _g === void 0 ? 'd MMM yyyy' : _g, _h = _a.formatTimeDate, formatTimeDate = _h === void 0 ? "'Ás' HH:mm" : _h, _j = _a.enableAllDay, enableAllDay = _j === void 0 ? false : _j, disablePastDates = _a.disablePastDates, asPopup = _a.asPopup, children = _a.children, rest = __rest(_a, ["name", "title", "withTimePicker", "value", "onValueChange", "allDay", "onAllDayChange", "error", "applyOnSelect", "formattedString", "formatShowDate", "formatTimeDate", "enableAllDay", "disablePastDates", "asPopup", "children"]);
    var datepickerRef = react_1.useRef();
    var _k = react_1.useState(value !== null && value !== void 0 ? value : new Date()), calendarDate = _k[0], setCalendarDate = _k[1];
    var _l = react_1.useState(value), dateTmp = _l[0], setDateTmp = _l[1];
    var _m = react_1.useState(allDayValue), allDay = _m[0], setAllDay = _m[1];
    var _o = react_1.useState(false), openDatePicker = _o[0], setOpenDatePicker = _o[1];
    react_hooks_1.useDidUpdateEffect(function () {
        setAllDay(allDayValue);
    }, [allDayValue]);
    react_hooks_1.useDidUpdateEffect(function () {
        setDateTmp(value);
    }, [value]);
    var OpenDatePicker = react_1.useCallback(function OpenDatePicker() {
        setOpenDatePicker(true);
    }, []);
    var CloseDatePicker = react_1.useCallback(function CloseDatePicker() {
        setOpenDatePicker(false);
    }, []);
    var CleanDatePicker = react_1.useCallback(function CleanDatePicker() {
        setDateTmp(value);
        setCalendarDate(value !== null && value !== void 0 ? value : new Date());
        setOpenDatePicker(false);
        setAllDay(allDayValue);
    }, [value, allDayValue]);
    var RemoveDateInput = react_1.useCallback(function RemoveDateInput() {
        if (onValueChange)
            onValueChange(null, null);
        setCalendarDate(new Date());
        if (onAllDayChange)
            onAllDayChange(false);
        setOpenDatePicker(false);
    }, [onValueChange]);
    var SetSelectedDate = react_1.useCallback(function SetSelectedDate(d) {
        if (disablePastDates && dateFns.differenceInDays(d, new Date()) < 0) {
            return;
        }
        if (disablePastDates && dateFns.differenceInMinutes(d, new Date()) < 0) {
            d = dateFns.setMinutes(d, dateFns.getMinutes(new Date()));
            d = dateFns.setHours(d, dateFns.getHours(new Date()));
        }
        if (!withTimePicker) {
            d = dateFns.setMinutes(d, 0);
            d = dateFns.setHours(d, 0);
        }
        d = dateFns.setSeconds(d, 0);
        d = dateFns.setMilliseconds(d, 0);
        if (!applyOnSelect) {
            if (onValueChange)
                onValueChange(d, formattedString ? dateFns.format(d, formattedString) : null);
            CloseDatePicker();
        }
        else {
            setDateTmp(d);
        }
    }, [onValueChange]);
    var OnApply = react_1.useCallback(function OnApply() {
        if (onValueChange)
            onValueChange(dateTmp, dateTmp && formattedString ? dateFns.format(dateTmp, formattedString) : null);
        if (onAllDayChange)
            onAllDayChange(allDay);
        CloseDatePicker();
    }, [dateTmp, onValueChange, allDay]);
    react_1.useEffect(function () {
        if (openDatePicker) {
            var el = document.getElementsByClassName('datepicker-popup')[0];
            var scrollParent = react_utils_1.GetScrollParent(datepickerRef.current.parentNode);
            var _a = datepickerRef.current.getBoundingClientRect(), topMain = _a.top, heightMain = _a.height;
            var heightScroll = scrollParent.getBoundingClientRect().height;
            if (topMain + heightMain + el.getBoundingClientRect().height > heightScroll) {
                if (el.scrollIntoView)
                    el.scrollIntoView({ block: 'end', behavior: 'smooth' });
            }
        }
    }, [openDatePicker]);
    if (withTimePicker)
        applyOnSelect = true;
    return (react_1.default.createElement(styles_1.FormStyle, null,
        react_1.default.createElement(Datepicker_style_1.default, { "data-testid": "datepicker-" + name, ref: datepickerRef },
            title && react_1.default.createElement("div", { className: "input-title" }, title),
            !asPopup && (react_1.default.createElement(InputDatePicker, { date: value, error: !!error, allDay: allDayValue, setOpen: OpenDatePicker, withTimePicker: withTimePicker, removeDate: RemoveDateInput, formatShowDate: formatShowDate, formatTimeDate: formatTimeDate })),
            asPopup && (react_1.default.createElement("div", { className: "container-cursor", "data-testid": "open-popup", onClick: OpenDatePicker }, children)),
            openDatePicker && (react_1.default.createElement(DatePickerPopup, { enableAllDay: enableAllDay, date: dateTmp, setDate: SetSelectedDate, calendarDate: calendarDate, setCalendarDate: setCalendarDate, withTimePicker: withTimePicker, applyOnSelect: applyOnSelect, onApply: OnApply, cleanDatePicker: CleanDatePicker, allDayValue: allDay, onAllDayChange: setAllDay, disablePastDates: disablePastDates })),
            error && (react_1.default.createElement("div", { className: "error-input", "data-testid": "input-error" }, error)))));
};
exports.DatepickerWithoutUnform = DatepickerWithoutUnform;
function AllDayUnform(_a) {
    var name = _a.name, allDay = _a.allDay, onChange = _a.onChange;
    var _b = core_1.useField(name), fieldName = _b.fieldName, registerField = _b.registerField, _c = _b.defaultValue, defaultValue = _c === void 0 ? false : _c;
    var inputRef = react_1.useRef(defaultValue);
    react_1.useLayoutEffect(function () {
        onChange(defaultValue);
    }, []);
    react_1.useEffect(function () {
        inputRef.current = allDay;
    }, [allDay]);
    react_1.useEffect(function () {
        registerField({
            name: fieldName,
            ref: inputRef,
            path: 'current',
            clearValue: function (ref) {
                ref.current = false;
                onChange(false);
            },
            setValue: function (ref, v) {
                ref.current = v;
                onChange(v);
            },
            getValue: function (ref) {
                return ref.current;
            },
        });
    }, [fieldName, registerField, onChange]);
    return null;
}
var DatepickerWithUnform = function (props) {
    var _a = core_1.useField(props.name), fieldName = _a.fieldName, registerField = _a.registerField, _b = _a.defaultValue, defaultValue = _b === void 0 ? null : _b, error = _a.error, clearError = _a.clearError;
    if (props.formattedString && typeof (defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.getMonth) === 'function') {
        throw new Error("Se formattedString for definido 'value' tem ser string");
    }
    if (!props.formattedString && typeof (defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.getMonth) !== 'function' && defaultValue != null) {
        throw new Error("'value' deve ser um Date ou null");
    }
    var inputDateRef = react_1.useRef(defaultValue && props.formattedString
        ? dateFns.parse(defaultValue, props.formattedString, new Date())
        : defaultValue);
    var inputFormattedRef = react_1.useRef(typeof defaultValue === 'string' ? defaultValue : null);
    var _c = react_1.useState(inputDateRef.current), value = _c[0], setValue = _c[1];
    var _d = react_1.useState(), allDay = _d[0], setAllDay = _d[1];
    react_1.useEffect(function () {
        registerField({
            name: fieldName,
            ref: inputDateRef,
            path: 'current',
            clearValue: function (ref) {
                if (props.formattedString) {
                    inputFormattedRef.current = null;
                }
                ref.current = null;
                setValue(null);
            },
            setValue: function (ref, v) {
                if (props.formattedString && typeof (v === null || v === void 0 ? void 0 : v.getMonth) === 'function') {
                    throw new Error("Se formattedString for definido 'value' tem ser string");
                }
                if (!props.formattedString && typeof (v === null || v === void 0 ? void 0 : v.getMonth) !== 'function' && v != null) {
                    throw new Error("'value' deve ser um Date ou null");
                }
                if (typeof v === 'string') {
                    ref.current = v && props.formattedString ? dateFns.parse(v, props.formattedString, new Date()) : v;
                    inputFormattedRef.current = v;
                }
                else {
                    inputFormattedRef.current = null;
                    ref.current = v;
                    setValue(v);
                }
            },
            getValue: function (ref) {
                if (props.formattedString)
                    return inputFormattedRef.current;
                return ref.current;
            },
        });
    }, [fieldName, registerField, props.formattedString]);
    var onValueChange = react_1.useCallback(function onSelectItem(d, f) {
        if (error)
            clearError();
        setValue(d);
        inputDateRef.current = d;
        inputFormattedRef.current = f;
        if (props.onValueChange)
            props.onValueChange(d, f);
    }, [error]);
    return (react_1.default.createElement(react_1.default.Fragment, null,
        props.nameAllDay && react_1.default.createElement(AllDayUnform, { name: props.nameAllDay, allDay: allDay, onChange: setAllDay }),
        react_1.default.createElement(exports.DatepickerWithoutUnform, __assign({}, props, { value: value, onValueChange: onValueChange, allDay: allDay, onAllDayChange: setAllDay, error: error }))));
};
exports.DatepickerWithUnform = DatepickerWithUnform;
var Datepicker = function (props) {
    if (props.name) {
        return react_1.default.createElement(exports.DatepickerWithUnform, __assign({}, props));
    }
    return react_1.default.createElement(exports.DatepickerWithoutUnform, __assign({}, props));
};
exports.Datepicker = Datepicker;
//# sourceMappingURL=Datepicker.js.map