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;aACD;YACD;gBACE,CAAA,GAAA,qCAAU;gBACV;oBACE,OAAO;wBACL,aAAa;wBACb,cAAc;oBAChB;gBACF;aACD;YACD;gBAAC,CAAA,GAAA,2CAAgB;gBAAG;aAAW;SAChC;qBACD,0DAAC,CAAA,GAAA,6BAAE,EAAE,GAAG;QACL,GAAG,CAAA,GAAA,qCAAS,EAAE,UAAU,aAAa,WAAW;QACjD,KAAK;QACL,MAAM,MAAM,IAAI,IAAI;QACpB,qBAAmB,aAAa;QAChC,gBAAc,MAAM,SAAS,IAAI;QACjC,sBAAoB,kBAAkB;QACtC,iBAAe,MAAM,UAAU,IAAI;QACnC,iBAAe,MAAM,UAAU,IAAI;QACnC,iBAAe,MAAM,UAAU,IAAI;QACnC,aAAW,MAAM,MAAM,IAAI;;AAInC","sources":["packages/react-aria-components/src/DatePicker.tsx"],"sourcesContent":["/*\n * Copyright 2022 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport {AriaDatePickerProps, useDatePicker} from 'react-aria/useDatePicker';\nimport {AriaDateRangePickerProps, useDateRangePicker} from 'react-aria/useDateRangePicker';\nimport {ButtonContext} from './Button';\nimport {CalendarContext, RangeCalendarContext} from './Calendar';\nimport {\n  ClassNameOrFunction,\n  ContextValue,\n  dom,\n  Provider,\n  RACValidation,\n  removeDataAttributes,\n  RenderProps,\n  SlotProps,\n  useContextProps,\n  useRenderProps,\n  useSlot,\n  useSlottedContext\n} from './utils';\nimport {DateFieldContext} from './DateField';\nimport {\n  DatePickerState,\n  DatePickerStateOptions,\n  DateValue,\n  useDatePickerState\n} from 'react-stately/useDatePickerState';\nimport {\n  DateRangePickerState,\n  DateRangePickerStateOptions,\n  useDateRangePickerState\n} from 'react-stately/useDateRangePickerState';\nimport {DialogContext, OverlayTriggerStateContext} from './Dialog';\nimport {FieldErrorContext} from './FieldError';\nimport {filterDOMProps} from 'react-aria/filterDOMProps';\nimport {FormContext} from './Form';\nimport {forwardRefType, GlobalDOMAttributes} from '@react-types/shared';\nimport {GroupContext} from './Group';\nimport {HiddenDateInput} from './HiddenDateInput';\nimport {LabelContext} from './Label';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {PopoverContext} from './Popover';\nimport React, {createContext, ForwardedRef, forwardRef, useRef} from 'react';\nimport {TextContext} from './Text';\nimport {useFocusRing} from 'react-aria/useFocusRing';\n\nexport interface DatePickerRenderProps {\n  /**\n   * Whether an element within the date picker is focused, either via a mouse or keyboard.\n   *\n   * @selector [data-focus-within]\n   */\n  isFocusWithin: boolean;\n  /**\n   * Whether an element within the date picker is keyboard focused.\n   *\n   * @selector [data-focus-visible]\n   */\n  isFocusVisible: boolean;\n  /**\n   * Whether the date picker is disabled.\n   *\n   * @selector [data-disabled]\n   */\n  isDisabled: boolean;\n  /**\n   * Whether the date picker is read only.\n   *\n   * @selector [data-readonly]\n   */\n  isReadOnly: boolean;\n  /**\n   * Whether the date picker is invalid.\n   *\n   * @selector [data-invalid]\n   */\n  isInvalid: boolean;\n  /**\n   * Whether the date picker is required.\n   *\n   * @selector [data-required]\n   */\n  isRequired: boolean;\n  /**\n   * Whether the date picker's popover is currently open.\n   *\n   * @selector [data-open]\n   */\n  isOpen: boolean;\n  /**\n   * State of the date picker.\n   */\n  state: DatePickerState;\n}\nexport interface DateRangePickerRenderProps extends Omit<DatePickerRenderProps, 'state'> {\n  /**\n   * State of the date range picker.\n   */\n  state: DateRangePickerState;\n}\n\nexport interface DatePickerProps<T extends DateValue>\n  extends\n    Omit<\n      AriaDatePickerProps<T>,\n      'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'\n    >,\n    Pick<DatePickerStateOptions<T>, 'shouldCloseOnSelect'>,\n    RACValidation,\n    RenderProps<DatePickerRenderProps>,\n    SlotProps,\n    GlobalDOMAttributes<HTMLDivElement> {\n  /**\n   * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n   * element. A function may be provided to compute the class based on component state.\n   *\n   * @default 'react-aria-DatePicker'\n   */\n  className?: ClassNameOrFunction<DatePickerRenderProps>;\n}\nexport interface DateRangePickerProps<T extends DateValue>\n  extends\n    Omit<\n      AriaDateRangePickerProps<T>,\n      'label' | 'description' | 'errorMessage' | 'validationState' | 'validationBehavior'\n    >,\n    Pick<DateRangePickerStateOptions<T>, 'shouldCloseOnSelect'>,\n    RACValidation,\n    RenderProps<DateRangePickerRenderProps>,\n    SlotProps,\n    GlobalDOMAttributes<HTMLDivElement> {\n  /**\n   * The CSS [className](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) for the\n   * element. A function may be provided to compute the class based on component state.\n   *\n   * @default 'react-aria-DateRangePicker'\n   */\n  className?: ClassNameOrFunction<DateRangePickerRenderProps>;\n}\n\nexport const DatePickerContext =\n  createContext<ContextValue<DatePickerProps<any>, HTMLDivElement>>(null);\nexport const DateRangePickerContext =\n  createContext<ContextValue<DateRangePickerProps<any>, HTMLDivElement>>(null);\nexport const DatePickerStateContext = createContext<DatePickerState | null>(null);\nexport const DateRangePickerStateContext = createContext<DateRangePickerState | null>(null);\n\n// Contexts to clear inside the popover.\nconst CLEAR_CONTEXTS = [GroupContext, ButtonContext, LabelContext, TextContext];\n\n/**\n * A date picker combines a DateField and a Calendar popover to allow users to enter or select a\n * date and time value.\n */\nexport const DatePicker = /*#__PURE__*/ (forwardRef as forwardRefType)(function DatePicker<\n  T extends DateValue\n>(props: DatePickerProps<T>, ref: ForwardedRef<HTMLDivElement>) {\n  [props, ref] = useContextProps(props, ref, DatePickerContext);\n  let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n  let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n  let state = useDatePickerState({\n    ...props,\n    validationBehavior\n  });\n\n  let groupRef = useRef<HTMLDivElement>(null);\n  let [labelRef, label] = useSlot(!props['aria-label'] && !props['aria-labelledby']);\n  let {\n    groupProps,\n    labelProps,\n    fieldProps,\n    buttonProps,\n    dialogProps,\n    calendarProps,\n    descriptionProps,\n    errorMessageProps,\n    ...validation\n  } = useDatePicker(\n    {\n      ...removeDataAttributes(props),\n      label,\n      validationBehavior\n    },\n    state,\n    groupRef\n  );\n\n  let {focusProps, isFocused, isFocusVisible} = useFocusRing({within: true});\n  let renderProps = useRenderProps({\n    ...props,\n    values: {\n      state,\n      isFocusWithin: isFocused,\n      isFocusVisible,\n      isDisabled: props.isDisabled || false,\n      isInvalid: state.isInvalid,\n      isOpen: state.isOpen,\n      isReadOnly: props.isReadOnly || false,\n      isRequired: props.isRequired || false\n    },\n    defaultClassName: 'react-aria-DatePicker'\n  });\n\n  let DOMProps = filterDOMProps(props, {global: true});\n  delete DOMProps.id;\n\n  return (\n    <Provider\n      values={[\n        [DatePickerStateContext, state],\n        [GroupContext, {...groupProps, ref: groupRef, isInvalid: state.isInvalid}],\n        [DateFieldContext, fieldProps],\n        [ButtonContext, {...buttonProps, isPressed: state.isOpen}],\n        [LabelContext, {...labelProps, ref: labelRef, elementType: 'span'}],\n        [CalendarContext, calendarProps as any],\n        [OverlayTriggerStateContext, state],\n        [\n          PopoverContext,\n          {\n            trigger: 'DatePicker',\n            triggerRef: groupRef,\n            placement: 'bottom start',\n            clearContexts: CLEAR_CONTEXTS\n          }\n        ],\n        [DialogContext, dialogProps],\n        [\n          TextContext,\n          {\n            slots: {\n              description: descriptionProps,\n              errorMessage: errorMessageProps\n            }\n          }\n        ],\n        [FieldErrorContext, validation]\n      ]}>\n      <dom.div\n        {...mergeProps(DOMProps, renderProps, focusProps)}\n        ref={ref}\n        slot={props.slot || undefined}\n        data-focus-within={isFocused || undefined}\n        data-invalid={state.isInvalid || undefined}\n        data-focus-visible={isFocusVisible || undefined}\n        data-disabled={props.isDisabled || undefined}\n        data-readonly={props.isReadOnly || undefined}\n        data-required={props.isRequired || undefined}\n        data-open={state.isOpen || undefined}\n      />\n      <HiddenDateInput\n        autoComplete={props.autoComplete}\n        name={props.name}\n        isDisabled={props.isDisabled}\n        state={state}\n      />\n    </Provider>\n  );\n});\n\n/**\n * A date range picker combines two DateFields and a RangeCalendar popover to allow\n * users to enter or select a date and time range.\n */\nexport const DateRangePicker = /*#__PURE__*/ (forwardRef as forwardRefType)(\n  function DateRangePicker<T extends DateValue>(\n    props: DateRangePickerProps<T>,\n    ref: ForwardedRef<HTMLDivElement>\n  ) {\n    [props, ref] = useContextProps(props, ref, DateRangePickerContext);\n    let {validationBehavior: formValidationBehavior} = useSlottedContext(FormContext) || {};\n    let validationBehavior = props.validationBehavior ?? formValidationBehavior ?? 'native';\n    let state = useDateRangePickerState({\n      ...props,\n      validationBehavior\n    });\n\n    let groupRef = useRef<HTMLDivElement>(null);\n    let [labelRef, label] = useSlot(!props['aria-label'] && !props['aria-labelledby']);\n    let {\n      groupProps,\n      labelProps,\n      startFieldProps,\n      endFieldProps,\n      buttonProps,\n      dialogProps,\n      calendarProps,\n      descriptionProps,\n      errorMessageProps,\n      ...validation\n    } = useDateRangePicker(\n      {\n        ...removeDataAttributes(props),\n        label,\n        validationBehavior\n      },\n      state,\n      groupRef\n    );\n\n    let {focusProps, isFocused, isFocusVisible} = useFocusRing({within: true});\n    let renderProps = useRenderProps({\n      ...props,\n      values: {\n        state,\n        isFocusWithin: isFocused,\n        isFocusVisible,\n        isDisabled: props.isDisabled || false,\n        isInvalid: state.isInvalid,\n        isOpen: state.isOpen,\n        isReadOnly: props.isReadOnly || false,\n        isRequired: props.isRequired || false\n      },\n      defaultClassName: 'react-aria-DateRangePicker'\n    });\n\n    let DOMProps = filterDOMProps(props, {global: true});\n    delete DOMProps.id;\n\n    return (\n      <Provider\n        values={[\n          [DateRangePickerStateContext, state],\n          [GroupContext, {...groupProps, ref: groupRef, isInvalid: state.isInvalid}],\n          [ButtonContext, {...buttonProps, isPressed: state.isOpen}],\n          [LabelContext, {...labelProps, ref: labelRef, elementType: 'span'}],\n          [RangeCalendarContext, calendarProps],\n          [OverlayTriggerStateContext, state],\n          [\n            PopoverContext,\n            {\n              trigger: 'DateRangePicker',\n              triggerRef: groupRef,\n              placement: 'bottom start',\n              clearContexts: CLEAR_CONTEXTS\n            }\n          ],\n          [DialogContext, dialogProps],\n          [\n            DateFieldContext,\n            {\n              slots: {\n                start: startFieldProps,\n                end: endFieldProps\n              }\n            }\n          ],\n          [\n            TextContext,\n            {\n              slots: {\n                description: descriptionProps,\n                errorMessage: errorMessageProps\n              }\n            }\n          ],\n          [FieldErrorContext, validation]\n        ]}>\n        <dom.div\n          {...mergeProps(DOMProps, renderProps, focusProps)}\n          ref={ref}\n          slot={props.slot || undefined}\n          data-focus-within={isFocused || undefined}\n          data-invalid={state.isInvalid || undefined}\n          data-focus-visible={isFocusVisible || undefined}\n          data-disabled={props.isDisabled || undefined}\n          data-readonly={props.isReadOnly || undefined}\n          data-required={props.isRequired || undefined}\n          data-open={state.isOpen || undefined}\n        />\n      </Provider>\n    );\n  }\n);\n"],"names":[],"version":3,"file":"DatePicker.cjs.map"}