"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DatePicker = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = require("react");
const constants_1 = require("./constants");
const DatePickerInput_1 = require("./DatePickerInput");
const DatePickerPopover_1 = require("./DatePickerPopover");
const MinMaxDateContext_1 = require("./MinMaxDateContext");
const styles_1 = require("./styles");
const useLogic_1 = require("./useLogic");
const YearMonthDayPicker_1 = require("./YearMonthDayPicker");
exports.DatePicker = (0, react_1.forwardRef)((props, forwardedRef) => {
    const { ref, pickerProps, handleOpen, onAccept, confirmButtonProps, isMobile, DatePickerInputProps, datePickerProps, } = (0, useLogic_1.useLogic)({ ...props, forwardedRef });
    const { className, startAdornment, label, required, helperText, inputProps, mask = constants_1.DEFAULT_DATE_MASK, size, disabled, inputRef, minDate = MinMaxDateContext_1.DEFAULT_MIN_DATE, maxDate = MinMaxDateContext_1.DEFAULT_MAX_DATE, isMondayFirst, isDoubleNavigationButtonsEnabled, hideHelperText = false, } = props;
    return ((0, jsx_runtime_1.jsxs)("div", { ref: ref, className: className, children: [(0, jsx_runtime_1.jsx)(DatePickerInput_1.DatePickerInput, { startAdornment: startAdornment, label: label, required: required, helperText: helperText, ...inputProps, ...DatePickerInputProps, onAccept: onAccept, mask: mask, size: size, disabled: disabled, ref: inputRef, onClick: handleOpen, hideHelperText: hideHelperText }), (0, jsx_runtime_1.jsx)(DatePickerPopover_1.DatePickerPopover, { placement: "bottom-start", ...datePickerProps, children: (0, jsx_runtime_1.jsx)(MinMaxDateContext_1.MinMaxDateContextProvider, { minDate: minDate, maxDate: maxDate, children: (0, jsx_runtime_1.jsxs)(styles_1.StyledPaper, { children: [(0, jsx_runtime_1.jsx)(YearMonthDayPicker_1.YearMonthDayPicker, { isMondayFirst: isMondayFirst, isDoubleNavigationButtonsEnabled: isDoubleNavigationButtonsEnabled, ...pickerProps }), isMobile && ((0, jsx_runtime_1.jsx)(styles_1.ButtonWrapper, { children: (0, jsx_runtime_1.jsx)(styles_1.ConfirmButton, { ...confirmButtonProps, size: "large" }) }))] }) }) })] }));
});
