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 += ' _Lf11';
    else rules += ' _Le11';
    rules += ' Oh11';
    rules += ' Olc11';
    rules += ' _Mc11';
    rules += ' _Kd11';
    if (props.size === "XL") rules += ' -SFnbic-_JaP8ec11';
    else if (props.size === "L") rules += ' -SFnbic-_J0K2hn11';
    else if (props.size === "S") rules += ' -SFnbic-_JJOW22b11';
    else if (props.size === "XS") rules += ' -SFnbic-_JICefdd11';
    else rules += ' -SFnbic-_Jb11';
    rules += ' -Bu7z1c-oa11';
    rules += ' oj11';
    rules += ' nj11';
    rules += ' kj11';
    rules += ' jj11';
    rules += ' _Pc11';
    if (props.size === "XL") {
        rules += ' uk11';
        rules += ' ucJ9TBTb11';
        rules += ' ud3Euai11';
        rules += ' uea11';
        rules += ' ugb11';
        rules += ' uhd11';
        rules += ' uje11';
        rules += ' u2NhKxcl11';
        rules += ' uic11';
    } else if (props.size === "L") {
        rules += ' uk11';
        rules += ' ucJ9TBTb11';
        rules += ' ud3Euai11';
        rules += ' uea11';
        rules += ' ugb11';
        rules += ' uhd11';
        rules += ' uje11';
        rules += ' u2NhKxcl11';
        rules += ' uic11';
    } else if (props.size === "M") {
        rules += ' uk11';
        rules += ' ucJ9TBTb11';
        rules += ' ud3Euai11';
        rules += ' uea11';
        rules += ' ugb11';
        rules += ' uhd11';
        rules += ' uje11';
        rules += ' u2NhKxcl11';
        rules += ' uic11';
    } else if (props.size === "S") {
        rules += ' uk11';
        rules += ' ucJ9TBTb11';
        rules += ' ud3Euai11';
        rules += ' uea11';
        rules += ' ugb11';
        rules += ' uhd11';
        rules += ' uje11';
        rules += ' u2NhKxcl11';
        rules += ' uic11';
    }
    if (props.size === "XL") {
        rules += ' -_6BNtrc-e11';
        rules += ' vx11';
    } else if (props.size === "L") {
        rules += ' -_6BNtrc-d11';
        rules += ' vx11';
    } else if (props.size === "M") {
        rules += ' -_6BNtrc-c11';
        rules += ' vx11';
    } else if (props.size === "S") {
        rules += ' -_6BNtrc-b11';
        rules += ' vx11';
    }
    if (props.size === "XL") {
        rules += ' xb11';
        rules += ' _xa11';
    } else if (props.size === "L") {
        rules += ' xb11';
        rules += ' _xa11';
    } else if (props.size === "M") {
        rules += ' xb11';
        rules += ' _xa11';
    } else if (props.size === "S") {
        rules += ' xb11';
        rules += ' _xa11';
    }
    if (props.size === "XL") {
        rules += ' _Fd11';
        rules += ' _FnuYUweb11';
    } else if (props.size === "L") {
        rules += ' _Fd11';
        rules += ' _FnuYUweb11';
    } else if (props.size === "M") {
        rules += ' _Fd11';
        rules += ' _FnuYUweb11';
    } else if (props.size === "S") {
        rules += ' _Fd11';
        rules += ' _FnuYUweb11';
    }
    if (props.isDisabled) rules += ' pp11';
    else {
        if (props.isPressed) rules += ' po11';
        else if (props.isFocusVisible) rules += ' po11';
        else if (props.isHovered) rules += ' po11';
        else rules += ' pt11';
    }
    rules += ' pla11';
    rules += ' ri11';
    rules += ' sd11';
    rules += ' _Wa11';
    rules += ' _je11';
    rules += ' eb11';
    rules += ' _Ca11';
    if (props.size === "XL") rules += ' ZC11';
    else if (props.size === "L") rules += ' Zo11';
    else if (props.size === "M") rules += ' Zm11';
    else if (props.size === "S") rules += ' Zu11';
    rules += ' Fd11';
    rules += ' Iw11';
    rules += ' fa11';
    rules += ' _va11';
    rules += ' Yd11';
    rules += ' Yle11';
    rules += ' Xb11';
    rules += ' Xlb11';
    rules += ' _2b11';
    rules += ' _2lb11';
    if (props.isDisabled) rules += ' gH11';
    else if (props.isOpen) rules += ' gF11';
    else {
        if (props.isPressed) rules += ' gF11';
        else if (props.isFocusVisible) rules += ' gF11';
        else if (props.isHovered) rules += ' gF11';
        else rules += ' gH11';
    }
    if (props.isDisabled) rules += ' gld11';
    else if (props.isOpen) rules += ' gle11';
    else if (props.isHovered) rules += ' gle11';
    else rules += ' glc11';
    return rules;
};
const $e6aad0776f57e0e9$export$5320dd0e349ed44d = " _vb11 _ua11 Na11 Ze4mUs11";
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 = String(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 += ' se11';
            if (props.isInForm) {
                if (!gridColumnStart) rules += ' z2mU11';
            }
            if (props.isInForm) {
                if (props.labelPosition === "side") {
                    if (!gridColumnEnd) rules += ' yvoofG11';
                }
            }
            if (props.isInForm) rules += ' DLwlgod11';
            else {
                if (props.labelPosition === "side") rules += ' DPlN5qb11';
                else if (props.labelPosition === "top") rules += ' DM8Mfn11';
            }
            if (props.labelPosition === "side") rules += ' EPlN5qb11';
            else if (props.labelPosition === "top") rules += ' E4w1sLc11';
            if (props.labelPosition === "side") rules += ' CbRM95c11';
            else if (props.labelPosition === "top") rules += ' Cxaocre11';
            if (props.size === "XL") {
                rules += ' -_6BNtrc-e11';
                rules += ' vx11';
            } else if (props.size === "L") {
                rules += ' -_6BNtrc-d11';
                rules += ' vx11';
            } else if (props.size === "S") {
                rules += ' -_6BNtrc-b11';
                rules += ' vx11';
            } else if (props.size === "XS") {
                rules += ' -_6BNtrc-a11';
                rules += ' vx11';
            } else {
                rules += ' -_6BNtrc-c11';
                rules += ' vx11';
            }
            rules += ' ea11';
            rules += ' _Fd11';
            rules += ' _FnuYUweb11';
            if (props.size === "XL") rules += ' -BhX7R-Fz11';
            else if (props.size === "L") rules += ' -BhX7R-Fv11';
            else if (props.size === "S") rules += ' -BhX7R-Fp11';
            else if (props.size === "XS") rules += ' -BhX7R-Fn11';
            else rules += ' -BhX7R-Fx11';
            rules += ' -AJjOLd-UVkF0Db11';
            rules += ' qg11';
            rules += ' __ca11';
            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 += ' zXcEWr11';
                            rules += ' yXcEWr11';
                            rules += ' BXcEWr11';
                            rules += ' AXcEWr11';
                            if (props.size === "XL") rules += ' Nl11';
                            else if (props.size === "L") rules += ' Nj11';
                            else if (props.size === "S") rules += ' Nf11';
                            else if (props.size === "XS") rules += ' Ne11';
                            else rules += ' Nk11';
                            if (props.isQuiet) rules += ' _qd11';
                            else rules += ' _qtb11';
                            if (props.size === "XL") rules += ' -Anxdcc-Zt11';
                            else if (props.size === "L") rules += ' -Anxdcc-ZStdtne11';
                            else if (props.size === "S") rules += ' -Anxdcc-Zr11';
                            else rules += ' -Anxdcc-Z3fn9H11';
                            rules += ' __v6TNLWb11';
                            rules += ' __Wb11';
                            rules += ' SMBFGYc11';
                            rules += ' RfBFGYc11';
                            rules += ' -S_-Sv11';
                            if (props.size === "XL") rules += ' -R_-RWJpoB11';
                            else if (props.size === "L") rules += ' -R_-RWJpoB11';
                            else if (props.size === "M") rules += ' -R_-Rp11';
                            else if (props.size === "S") rules += ' -R_-Rj11';
                            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: " sd11 Ul11 ql11 _qb11",
                                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: " Sf11 Rf11 Tk11 Qk11 _Na11 Pa11 sd11 _ta11 Ul11 ql11 _oa11 Za11 Fb11",
            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-t5ZbAob11 Za8Mfn11 Fa8Mfn11"
                    }
                ]
            ],
            children: /*#__PURE__*/ (0, $2B5ON$reactjsxruntime.jsx)((0, $1dfd5738cdf83d1e$exports.default), {})
        })
    });
}


//# sourceMappingURL=DatePicker.cjs.map
