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 += ' _Lf1';
    else rules += ' _Le1';
    rules += ' Oh1';
    rules += ' Olc1';
    rules += ' _Mc1';
    rules += ' _Kd1';
    if (props.size === "XL") rules += ' -SFnbic-_JaP8ec1';
    else if (props.size === "L") rules += ' -SFnbic-_J0K2hn1';
    else if (props.size === "S") rules += ' -SFnbic-_JJOW22b1';
    else if (props.size === "XS") rules += ' -SFnbic-_JICefdd1';
    else rules += ' -SFnbic-_Jb1';
    rules += ' -Bu7z1c-oa1';
    rules += ' oj1';
    rules += ' nj1';
    rules += ' kj1';
    rules += ' jj1';
    rules += ' _Pc1';
    if (props.size === "XL") {
        rules += ' uk1';
        rules += ' ucJ9TBTb1';
        rules += ' ud3Euai1';
        rules += ' uea1';
        rules += ' ugb1';
        rules += ' uhd1';
        rules += ' uje1';
        rules += ' u2NhKxcl1';
        rules += ' uic1';
    } else if (props.size === "L") {
        rules += ' uk1';
        rules += ' ucJ9TBTb1';
        rules += ' ud3Euai1';
        rules += ' uea1';
        rules += ' ugb1';
        rules += ' uhd1';
        rules += ' uje1';
        rules += ' u2NhKxcl1';
        rules += ' uic1';
    } else if (props.size === "M") {
        rules += ' uk1';
        rules += ' ucJ9TBTb1';
        rules += ' ud3Euai1';
        rules += ' uea1';
        rules += ' ugb1';
        rules += ' uhd1';
        rules += ' uje1';
        rules += ' u2NhKxcl1';
        rules += ' uic1';
    } else if (props.size === "S") {
        rules += ' uk1';
        rules += ' ucJ9TBTb1';
        rules += ' ud3Euai1';
        rules += ' uea1';
        rules += ' ugb1';
        rules += ' uhd1';
        rules += ' uje1';
        rules += ' u2NhKxcl1';
        rules += ' uic1';
    }
    if (props.size === "XL") {
        rules += ' -_6BNtrc-e1';
        rules += ' vx1';
    } else if (props.size === "L") {
        rules += ' -_6BNtrc-d1';
        rules += ' vx1';
    } else if (props.size === "M") {
        rules += ' -_6BNtrc-c1';
        rules += ' vx1';
    } else if (props.size === "S") {
        rules += ' -_6BNtrc-b1';
        rules += ' vx1';
    }
    if (props.size === "XL") {
        rules += ' xb1';
        rules += ' _xa1';
    } else if (props.size === "L") {
        rules += ' xb1';
        rules += ' _xa1';
    } else if (props.size === "M") {
        rules += ' xb1';
        rules += ' _xa1';
    } else if (props.size === "S") {
        rules += ' xb1';
        rules += ' _xa1';
    }
    if (props.size === "XL") {
        rules += ' _Fd1';
        rules += ' _FnuYUweb1';
    } else if (props.size === "L") {
        rules += ' _Fd1';
        rules += ' _FnuYUweb1';
    } else if (props.size === "M") {
        rules += ' _Fd1';
        rules += ' _FnuYUweb1';
    } else if (props.size === "S") {
        rules += ' _Fd1';
        rules += ' _FnuYUweb1';
    }
    if (props.isDisabled) rules += ' pp1';
    else {
        if (props.isPressed) rules += ' po1';
        else if (props.isFocusVisible) rules += ' po1';
        else if (props.isHovered) rules += ' po1';
        else rules += ' pt1';
    }
    rules += ' pla1';
    rules += ' ri1';
    rules += ' sd1';
    rules += ' _Wa1';
    rules += ' _je1';
    rules += ' eb1';
    rules += ' _Ca1';
    if (props.size === "XL") rules += ' ZC1';
    else if (props.size === "L") rules += ' Zo1';
    else if (props.size === "M") rules += ' Zm1';
    else if (props.size === "S") rules += ' Zu1';
    rules += ' Fd1';
    rules += ' Iw1';
    rules += ' fa1';
    rules += ' _va1';
    rules += ' Yd1';
    rules += ' Yle1';
    rules += ' Xb1';
    rules += ' Xlb1';
    rules += ' _2b1';
    rules += ' _2lb1';
    if (props.isDisabled) rules += ' gH1';
    else if (props.isOpen) rules += ' gF1';
    else {
        if (props.isPressed) rules += ' gF1';
        else if (props.isFocusVisible) rules += ' gF1';
        else if (props.isHovered) rules += ' gF1';
        else rules += ' gH1';
    }
    if (props.isDisabled) rules += ' gld1';
    else if (props.isOpen) rules += ' gle1';
    else if (props.isHovered) rules += ' gle1';
    else rules += ' glc1';
    return rules;
};
const $e6aad0776f57e0e9$export$5320dd0e349ed44d = " _vb1 _ua1 Na1 Ze4mUs1";
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 += ' se1';
            if (props.isInForm) {
                if (!gridColumnStart) rules += ' z2mU1';
            }
            if (props.isInForm) {
                if (props.labelPosition === "side") {
                    if (!gridColumnEnd) rules += ' yvoofG1';
                }
            }
            if (props.isInForm) rules += ' DLwlgod1';
            else {
                if (props.labelPosition === "side") rules += ' DPlN5qb1';
                else if (props.labelPosition === "top") rules += ' DM8Mfn1';
            }
            if (props.labelPosition === "side") rules += ' EPlN5qb1';
            else if (props.labelPosition === "top") rules += ' E4w1sLc1';
            if (props.labelPosition === "side") rules += ' CbRM95c1';
            else if (props.labelPosition === "top") rules += ' Cxaocre1';
            if (props.size === "XL") {
                rules += ' -_6BNtrc-e1';
                rules += ' vx1';
            } else if (props.size === "L") {
                rules += ' -_6BNtrc-d1';
                rules += ' vx1';
            } else if (props.size === "S") {
                rules += ' -_6BNtrc-b1';
                rules += ' vx1';
            } else if (props.size === "XS") {
                rules += ' -_6BNtrc-a1';
                rules += ' vx1';
            } else {
                rules += ' -_6BNtrc-c1';
                rules += ' vx1';
            }
            rules += ' ea1';
            rules += ' _Fd1';
            rules += ' _FnuYUweb1';
            if (props.size === "XL") rules += ' -BhX7R-Fz1';
            else if (props.size === "L") rules += ' -BhX7R-Fv1';
            else if (props.size === "S") rules += ' -BhX7R-Fp1';
            else if (props.size === "XS") rules += ' -BhX7R-Fn1';
            else rules += ' -BhX7R-Fx1';
            rules += ' -AJjOLd-UVkF0Db1';
            rules += ' qg1';
            rules += ' __ca1';
            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 += ' zXcEWr1';
                            rules += ' yXcEWr1';
                            rules += ' BXcEWr1';
                            rules += ' AXcEWr1';
                            if (props.size === "XL") rules += ' Nl1';
                            else if (props.size === "L") rules += ' Nj1';
                            else if (props.size === "S") rules += ' Nf1';
                            else if (props.size === "XS") rules += ' Ne1';
                            else rules += ' Nk1';
                            if (props.isQuiet) rules += ' _qd1';
                            else rules += ' _qtb1';
                            if (props.size === "XL") rules += ' -Anxdcc-Zt1';
                            else if (props.size === "L") rules += ' -Anxdcc-ZStdtne1';
                            else if (props.size === "S") rules += ' -Anxdcc-Zr1';
                            else rules += ' -Anxdcc-Z3fn9H1';
                            rules += ' __v6TNLWb1';
                            rules += ' __Wb1';
                            rules += ' SMBFGYc1';
                            rules += ' RfBFGYc1';
                            rules += ' -S_-Sv1';
                            if (props.size === "XL") rules += ' -R_-RWJpoB1';
                            else if (props.size === "L") rules += ' -R_-RWJpoB1';
                            else if (props.size === "M") rules += ' -R_-Rp1';
                            else if (props.size === "S") rules += ' -R_-Rj1';
                            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, {
                        shouldFlip: props1.shouldFlip,
                        children: [
                            /*#__PURE__*/ (0, $2B5ON$reactjsxruntime.jsx)((0, $e9e9a0d15c3364d7$exports.Calendar), {
                                visibleMonths: maxVisibleMonths,
                                createCalendar: createCalendar
                            }),
                            showTimeField && /*#__PURE__*/ (0, $2B5ON$reactjsxruntime.jsx)("div", {
                                className: " sd1 Ul1 ql1 _qb1",
                                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), {
        ...props,
        hideArrow: true,
        padding: "none",
        children: /*#__PURE__*/ (0, $2B5ON$reactjsxruntime.jsx)("div", {
            className: " Sf1 Rf1 Tk1 Qk1 _Na1 Pa1 sd1 _ta1 Ul1 ql1 _oa1 Za1 Fb1",
            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-t5ZbAob1 Za8Mfn1 Fa8Mfn1"
                    }
                ]
            ],
            children: /*#__PURE__*/ (0, $2B5ON$reactjsxruntime.jsx)((0, $1dfd5738cdf83d1e$exports.default), {})
        })
    });
}


//# sourceMappingURL=DatePicker.cjs.map
