require("./DatePicker.css");
var $e9e9a0d15c3364d7$exports = require("./Calendar.cjs");
var $bde97c91243ed164$exports = require("../icons/Icon.cjs");
var $7b93ad26130ad3f8$exports = require("./TimeField.cjs");
var $1dfd5738cdf83d1e$exports = require("../icons/Calendar.cjs");
var $d19642654b699f84$exports = require("./DateField.cjs");
var $a0b996a550bb0891$exports = require("./Field.cjs");
var $4526404114e78c80$exports = require("./intlStrings.cjs");
var $493371ef39bf7a55$exports = require("./Popover.cjs");
var $2061c83559b50a66$exports = require("./pressScale.cjs");
var $ac757a4c2bd72aee$exports = require("../icons/useSpectrumContextProps.cjs");
var $2B5ON$reactjsxruntime = require("react/jsx-runtime");
var $2B5ON$reactariacomponents = require("react-aria-components");
var $2B5ON$react = require("react");
var $2B5ON$reactariai18n = require("@react-aria/i18n");


function $parcel$interopDefault(a) {
  return a && a.__esModule ? a.default : a;
}

function $parcel$export(e, n, v, s) {
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}

$parcel$export(module.exports, "DatePickerContext", () => $e6aad0776f57e0e9$export$cf316c7f3b44c11e);
$parcel$export(module.exports, "timeField", () => $e6aad0776f57e0e9$export$5320dd0e349ed44d);
$parcel$export(module.exports, "DatePicker", () => $e6aad0776f57e0e9$export$5109c6dd95d8fb00);
$parcel$export(module.exports, "CalendarButton", () => $e6aad0776f57e0e9$export$adb29da0ac001538);
$parcel$export(module.exports, "CalendarPopover", () => $e6aad0776f57e0e9$export$f3ce207574a3cffe);
/*
 * Copyright 2024 Adobe. All rights reserved.
 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License. You may obtain a copy
 * of the License at http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
 * OF ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */ 











const $e6aad0776f57e0e9$export$cf316c7f3b44c11e = /*#__PURE__*/ (0, $2B5ON$react.createContext)(null);
const $e6aad0776f57e0e9$var$inputButton = function anonymous(props) {
    let rules = " ";
    if (props.isFocusVisible) rules += ' _Lf12';
    else rules += ' _Le12';
    rules += ' Oh12';
    rules += ' _Mc12';
    rules += ' _Kd12';
    if (props.size === "XL") rules += ' -SFnbic-_JaP8ec12';
    else if (props.size === "L") rules += ' -SFnbic-_J0K2hn12';
    else if (props.size === "S") rules += ' -SFnbic-_JJOW22b12';
    else if (props.size === "XS") rules += ' -SFnbic-_JICefdd12';
    else rules += ' -SFnbic-_Jb12';
    rules += ' -Bu7z1c-oa12';
    rules += ' oj12';
    rules += ' nj12';
    rules += ' kj12';
    rules += ' jj12';
    rules += ' _Pc12';
    if (props.size === "XL") {
        rules += ' uk12';
        rules += ' uch12';
        rules += ' udi12';
        rules += ' uea12';
        rules += ' ugb12';
        rules += ' uhd12';
        rules += ' uje12';
        rules += ' u2NhKxcl12';
        rules += ' uic12';
    } else if (props.size === "L") {
        rules += ' uk12';
        rules += ' uch12';
        rules += ' udi12';
        rules += ' uea12';
        rules += ' ugb12';
        rules += ' uhd12';
        rules += ' uje12';
        rules += ' u2NhKxcl12';
        rules += ' uic12';
    } else if (props.size === "M") {
        rules += ' uk12';
        rules += ' uch12';
        rules += ' udi12';
        rules += ' uea12';
        rules += ' ugb12';
        rules += ' uhd12';
        rules += ' uje12';
        rules += ' u2NhKxcl12';
        rules += ' uic12';
    } else if (props.size === "S") {
        rules += ' uk12';
        rules += ' uch12';
        rules += ' udi12';
        rules += ' uea12';
        rules += ' ugb12';
        rules += ' uhd12';
        rules += ' uje12';
        rules += ' u2NhKxcl12';
        rules += ' uic12';
    }
    if (props.size === "XL") {
        rules += ' -_6BNtrc-e12';
        rules += ' vx12';
    } else if (props.size === "L") {
        rules += ' -_6BNtrc-d12';
        rules += ' vx12';
    } else if (props.size === "M") {
        rules += ' -_6BNtrc-c12';
        rules += ' vx12';
    } else if (props.size === "S") {
        rules += ' -_6BNtrc-b12';
        rules += ' vx12';
    }
    if (props.size === "XL") {
        rules += ' xb12';
        rules += ' _xa12';
    } else if (props.size === "L") {
        rules += ' xb12';
        rules += ' _xa12';
    } else if (props.size === "M") {
        rules += ' xb12';
        rules += ' _xa12';
    } else if (props.size === "S") {
        rules += ' xb12';
        rules += ' _xa12';
    }
    if (props.size === "XL") {
        rules += ' _Fd12';
        rules += ' _FezxGHba12';
        rules += ' _FnuYUweb12';
    } else if (props.size === "L") {
        rules += ' _Fd12';
        rules += ' _FezxGHba12';
        rules += ' _FnuYUweb12';
    } else if (props.size === "M") {
        rules += ' _Fd12';
        rules += ' _FezxGHba12';
        rules += ' _FnuYUweb12';
    } else if (props.size === "S") {
        rules += ' _Fd12';
        rules += ' _FezxGHba12';
        rules += ' _FnuYUweb12';
    }
    if (props.isDisabled) rules += ' pp12';
    else {
        if (props.isPressed) rules += ' po12';
        else if (props.isFocusVisible) rules += ' po12';
        else if (props.isHovered) rules += ' po12';
        else rules += ' pt12';
    }
    rules += ' pla12';
    rules += ' ri12';
    rules += ' sd12';
    rules += ' _Wa12';
    rules += ' _je12';
    rules += ' eb12';
    rules += ' _Ca12';
    if (props.size === "XL") rules += ' ZC12';
    else if (props.size === "L") rules += ' Zo12';
    else if (props.size === "M") rules += ' Zm12';
    else if (props.size === "S") rules += ' Zu12';
    rules += ' Fd12';
    rules += ' Iw12';
    rules += ' fa12';
    rules += ' _va12';
    rules += ' Yd12';
    rules += ' Yle12';
    rules += ' Xb12';
    rules += ' Xlb12';
    rules += ' _2b12';
    rules += ' _2lb12';
    if (props.isDisabled) rules += ' gH12';
    else if (props.isOpen) rules += ' gF12';
    else {
        if (props.isPressed) rules += ' gF12';
        else if (props.isFocusVisible) rules += ' gF12';
        else if (props.isHovered) rules += ' gF12';
        else rules += ' gH12';
    }
    if (props.isDisabled) rules += ' gld12';
    else if (props.isOpen) rules += ' gle12';
    else if (props.isHovered) rules += ' gle12';
    else rules += ' glc12';
    return rules;
};
const $e6aad0776f57e0e9$export$5320dd0e349ed44d = " _vb12 _ua12 Na12 Ze4mUs12";
const $e6aad0776f57e0e9$export$5109c6dd95d8fb00 = /*#__PURE__*/ (0, $2B5ON$react.forwardRef)(function DatePicker(props1, ref) {
    [props1, ref] = (0, $ac757a4c2bd72aee$exports.useSpectrumContextProps)(props1, ref, $e6aad0776f57e0e9$export$cf316c7f3b44c11e);
    let stringFormatter = (0, $2B5ON$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($4526404114e78c80$exports))), '@react-spectrum/s2');
    let { label: label, contextualHelp: contextualHelp, description: descriptionMessage, errorMessage: errorMessage, isRequired: isRequired, size: size = 'M', labelPosition: labelPosition = 'top', necessityIndicator: necessityIndicator, labelAlign: labelAlign = 'start', UNSAFE_style: UNSAFE_style, UNSAFE_className: UNSAFE_className, styles: styles, placeholderValue: placeholderValue, maxVisibleMonths: maxVisibleMonths = 1, createCalendar: createCalendar, ...dateFieldProps } = props1;
    let formContext = (0, $2B5ON$react.useContext)((0, $2B5ON$reactariacomponents.FormContext));
    let [buttonHasFocus, setButtonHasFocus] = (0, $2B5ON$react.useState)(false);
    return /*#__PURE__*/ (0, $2B5ON$reactjsxruntime.jsx)((0, $2B5ON$reactariacomponents.DatePicker), {
        ref: ref,
        isRequired: isRequired,
        ...dateFieldProps,
        style: UNSAFE_style,
        className: (UNSAFE_className || '') + function anonymous(props, overrides) {
            let rules = " ";
            let gridColumnStart = false;
            let gridColumnEnd = false;
            let matches = (overrides || '').matchAll(/(?:^|\s)(J|G|I|H|_u|_v|_s|__A|_d|_J|z|y|B|A|_P|_9|W|_l|_A|_z|_6|Z|N|L)[^\s]+/g);
            for (let p of matches){
                if (p[1] === "z") gridColumnStart = true;
                if (p[1] === "y") gridColumnEnd = true;
                rules += p[0];
            }
            rules += ' se12';
            if (props.isInForm) {
                if (!gridColumnStart) rules += ' z2mU12';
            }
            if (props.isInForm) {
                if (props.labelPosition === "side") {
                    if (!gridColumnEnd) rules += ' yvoofG12';
                }
            }
            if (props.isInForm) rules += ' DLwlgod12';
            else {
                if (props.labelPosition === "side") rules += ' DPlN5qb12';
                else if (props.labelPosition === "top") rules += ' DM8Mfn12';
            }
            if (props.labelPosition === "side") rules += ' EPlN5qb12';
            else if (props.labelPosition === "top") rules += ' E4w1sLc12';
            if (props.labelPosition === "side") rules += ' CbRM95c12';
            else if (props.labelPosition === "top") rules += ' Cxaocre12';
            if (props.size === "XL") {
                rules += ' -_6BNtrc-e12';
                rules += ' vx12';
            } else if (props.size === "L") {
                rules += ' -_6BNtrc-d12';
                rules += ' vx12';
            } else if (props.size === "S") {
                rules += ' -_6BNtrc-b12';
                rules += ' vx12';
            } else if (props.size === "XS") {
                rules += ' -_6BNtrc-a12';
                rules += ' vx12';
            } else {
                rules += ' -_6BNtrc-c12';
                rules += ' vx12';
            }
            rules += ' ea12';
            rules += ' _Fd12';
            rules += ' _FezxGHba12';
            rules += ' _FnuYUweb12';
            if (props.size === "XL") rules += ' -BhX7R-Fz12';
            else if (props.size === "L") rules += ' -BhX7R-Fv12';
            else if (props.size === "S") rules += ' -BhX7R-Fp12';
            else if (props.size === "XS") rules += ' -BhX7R-Fn12';
            else rules += ' -BhX7R-Fx12';
            rules += ' -AJjOLd-UVkF0Db12';
            rules += ' qg12';
            rules += ' __ca12';
            return rules;
        }({
            isInForm: !!formContext,
            labelPosition: labelPosition,
            size: size
        }, styles),
        children: ({ isDisabled: isDisabled, isInvalid: isInvalid, isOpen: isOpen, state: state })=>{
            let placeholder = placeholderValue ?? undefined;
            let timePlaceholder = placeholder && 'hour' in placeholder ? placeholder : undefined;
            let timeMinValue = props1.minValue && 'hour' in props1.minValue ? props1.minValue : undefined;
            let timeMaxValue = props1.maxValue && 'hour' in props1.maxValue ? props1.maxValue : undefined;
            let timeGranularity = state.granularity === 'hour' || state.granularity === 'minute' || state.granularity === 'second' ? state.granularity : undefined;
            let showTimeField = !!timeGranularity;
            return /*#__PURE__*/ (0, $2B5ON$reactjsxruntime.jsxs)((0, $2B5ON$reactjsxruntime.Fragment), {
                children: [
                    /*#__PURE__*/ (0, $2B5ON$reactjsxruntime.jsx)((0, $a0b996a550bb0891$exports.FieldLabel), {
                        isDisabled: isDisabled,
                        isRequired: isRequired,
                        size: size,
                        labelPosition: labelPosition,
                        labelAlign: labelAlign,
                        necessityIndicator: necessityIndicator,
                        contextualHelp: contextualHelp,
                        children: label
                    }),
                    /*#__PURE__*/ (0, $2B5ON$reactjsxruntime.jsxs)((0, $a0b996a550bb0891$exports.FieldGroup), {
                        role: "presentation",
                        shouldTurnOffFocusRing: buttonHasFocus,
                        isDisabled: isDisabled,
                        isInvalid: isInvalid,
                        size: size,
                        styles: function anonymous(props) {
                            let rules = " ";
                            rules += ' zXcEWr12';
                            rules += ' yXcEWr12';
                            rules += ' BXcEWr12';
                            rules += ' AXcEWr12';
                            if (props.size === "XL") rules += ' Nl12';
                            else if (props.size === "L") rules += ' Nj12';
                            else if (props.size === "S") rules += ' Nf12';
                            else if (props.size === "XS") rules += ' Ne12';
                            else rules += ' Nk12';
                            if (props.isQuiet) rules += ' _qd12';
                            else rules += ' _qtb12';
                            if (props.size === "XL") rules += ' -Anxdcc-Zt12';
                            else if (props.size === "L") rules += ' -Anxdcc-ZStdtne12';
                            else if (props.size === "S") rules += ' -Anxdcc-Zr12';
                            else rules += ' -Anxdcc-Z3fn9H12';
                            rules += ' __v6TNLWb12';
                            rules += ' __Wb12';
                            rules += ' SMBFGYc12';
                            rules += ' RfBFGYc12';
                            rules += ' -S_-Sv12';
                            if (props.size === "XL") rules += ' -R_-RWJpoB12';
                            else if (props.size === "L") rules += ' -R_-RWJpoB12';
                            else if (props.size === "M") rules += ' -R_-Rp12';
                            else if (props.size === "S") rules += ' -R_-Rj12';
                            return rules;
                        }({
                            size: size
                        }),
                        children: [
                            /*#__PURE__*/ (0, $2B5ON$reactjsxruntime.jsx)((0, $d19642654b699f84$exports.DateInputContainer), {
                                children: /*#__PURE__*/ (0, $2B5ON$reactjsxruntime.jsx)((0, $d19642654b699f84$exports.DateInput), {})
                            }),
                            /*#__PURE__*/ (0, $2B5ON$reactjsxruntime.jsx)((0, $d19642654b699f84$exports.InvalidIndicator), {
                                isInvalid: isInvalid,
                                isDisabled: isDisabled
                            }),
                            /*#__PURE__*/ (0, $2B5ON$reactjsxruntime.jsx)($e6aad0776f57e0e9$export$adb29da0ac001538, {
                                isOpen: isOpen,
                                size: size,
                                setButtonHasFocus: setButtonHasFocus
                            })
                        ]
                    }),
                    /*#__PURE__*/ (0, $2B5ON$reactjsxruntime.jsxs)($e6aad0776f57e0e9$export$f3ce207574a3cffe, {
                        children: [
                            /*#__PURE__*/ (0, $2B5ON$reactjsxruntime.jsx)((0, $e9e9a0d15c3364d7$exports.Calendar), {
                                visibleMonths: maxVisibleMonths,
                                createCalendar: createCalendar
                            }),
                            showTimeField && /*#__PURE__*/ (0, $2B5ON$reactjsxruntime.jsx)("div", {
                                className: " sd12 Ul12 ql12 _qb12",
                                children: /*#__PURE__*/ (0, $2B5ON$reactjsxruntime.jsx)((0, $7b93ad26130ad3f8$exports.TimeField), {
                                    styles: $e6aad0776f57e0e9$export$5320dd0e349ed44d,
                                    label: stringFormatter.format('datepicker.time'),
                                    value: state.timeValue,
                                    // TODO: why do i need the cast?
                                    onChange: (v)=>state.setTimeValue(v),
                                    placeholderValue: timePlaceholder,
                                    granularity: timeGranularity,
                                    minValue: timeMinValue,
                                    maxValue: timeMaxValue,
                                    hourCycle: props1.hourCycle,
                                    hideTimeZone: props1.hideTimeZone
                                })
                            })
                        ]
                    }),
                    /*#__PURE__*/ (0, $2B5ON$reactjsxruntime.jsx)((0, $a0b996a550bb0891$exports.HelpText), {
                        size: size,
                        isDisabled: isDisabled,
                        isInvalid: isInvalid,
                        description: descriptionMessage,
                        children: errorMessage
                    })
                ]
            });
        }
    });
});
function $e6aad0776f57e0e9$export$f3ce207574a3cffe(props) {
    return /*#__PURE__*/ (0, $2B5ON$reactjsxruntime.jsx)((0, $493371ef39bf7a55$exports.Popover), {
        hideArrow: true,
        padding: "none",
        children: /*#__PURE__*/ (0, $2B5ON$reactjsxruntime.jsx)("div", {
            className: " Sf12 Rf12 Tk12 Qk12 _Na12 Pa12 sd12 _ta12 Ul12 ql12 _oa12 Za12 Fb12",
            children: /*#__PURE__*/ (0, $2B5ON$reactjsxruntime.jsx)((0, $2B5ON$reactariacomponents.Dialog), {
                children: /*#__PURE__*/ (0, $2B5ON$reactjsxruntime.jsx)((0, $2B5ON$reactariacomponents.Provider), {
                    values: [
                        [
                            (0, $2B5ON$reactariacomponents.OverlayTriggerStateContext),
                            null
                        ]
                    ],
                    children: props.children
                })
            })
        })
    });
}
function $e6aad0776f57e0e9$export$adb29da0ac001538(props) {
    let buttonRef = (0, $2B5ON$react.useRef)(null);
    let { isOpen: isOpen, size: size, setButtonHasFocus: setButtonHasFocus } = props;
    return /*#__PURE__*/ (0, $2B5ON$reactjsxruntime.jsx)((0, $2B5ON$reactariacomponents.Button), {
        ref: buttonRef,
        // Prevent press scale from sticking while DatePicker is open.
        // @ts-ignore
        isPressed: false,
        onFocusChange: setButtonHasFocus,
        style: (0, $2061c83559b50a66$exports.pressScale)(buttonRef),
        className: (renderProps)=>$e6aad0776f57e0e9$var$inputButton({
                ...renderProps,
                size: size,
                isOpen: isOpen
            }),
        children: /*#__PURE__*/ (0, $2B5ON$reactjsxruntime.jsx)((0, $2B5ON$reactariacomponents.Provider), {
            values: [
                [
                    (0, $bde97c91243ed164$exports.IconContext),
                    {
                        styles: " -_8sjo0b-t5ZbAob12 Za8Mfn12 Fa8Mfn12"
                    }
                ]
            ],
            children: /*#__PURE__*/ (0, $2B5ON$reactjsxruntime.jsx)((0, $1dfd5738cdf83d1e$exports.default), {})
        })
    });
}


//# sourceMappingURL=DatePicker.cjs.map
