{"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAoCM,MAAM,0DAAgB,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC,SAAS,cACrD,KAAoC,EACpC,GAA8B;IAE9B,QAAQ,CAAA,GAAA,0CAAe,EAAE;IACzB,IAAI,iBAAC,gBAAgB,GAAE,GAAG;IAC1B,gBAAgB,KAAK,GAAG,CAAC,eAAe;IACxC,IAAI,kBAAkB,CAAA,GAAA,oBAAM,EAAE,IAAO,CAAA;YAAC,QAAQ;QAAa,CAAA,GAAI;QAAC;KAAc;IAC9E,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,sCAAQ;IACvB,IAAI,QAAQ,CAAA,GAAA,8DAAoB,EAAE;QAChC,GAAG,KAAK;gBACR;yBACA;QACA,gBAAgB,MAAM,cAAc,IAAI,CAAA,GAAA,2CAAa;IACvD;IAEA,IAAI,SAAS,CAAA,GAAA,mBAAK,EAAE;IACpB,CAAA,GAAA,gCAAkB,EAAE,KAAK,IAAO,CAAA;YAC9B,GAAG,CAAA,GAAA,sCAAW,EAAE,OAAO;YACvB;gBACE,MAAM,UAAU,CAAC;YACnB;QACF,CAAA;IAEA,IAAI,iBAAC,aAAa,mBAAE,eAAe,mBAAE,eAAe,qBAAE,iBAAiB,EAAC,GAAG,CAAA,GAAA,iDAAe,EACxF,OACA,OACA;IAGF,qBACE,0DAAC,CAAA,GAAA,sCAAW;QACT,GAAG,KAAK;QACT,eAAe;QACf,OAAO;QACP,aAAa;QACb,eAAe;QACf,iBAAiB;QACjB,iBAAiB;QACjB,mBAAmB;;AAGzB","sources":["packages/@adobe/react-spectrum/src/calendar/RangeCalendar.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 */\n\nimport {AriaRangeCalendarProps, useRangeCalendar} from 'react-aria/useRangeCalendar';\n\nimport {CalendarBase} from './CalendarBase';\nimport {CalendarIdentifier, createCalendar, Calendar as ICalendar} from '@internationalized/date';\nimport {createDOMRef} from '../utils/useDOMRef';\nimport {DateValue} from 'react-stately/useCalendarState';\nimport {FocusableRef, StyleProps} from '@react-types/shared';\nimport React, {ReactElement, useImperativeHandle, useMemo, useRef} from 'react';\nimport {useLocale} from 'react-aria/I18nProvider';\nimport {useProviderProps} from '../provider/Provider';\nimport {useRangeCalendarState} from 'react-stately/useRangeCalendarState';\n\nexport interface SpectrumRangeCalendarProps<T extends DateValue>\n  extends Omit<AriaRangeCalendarProps<T>, 'weeksInMonth'>, StyleProps {\n  /**\n   * The number of months to display at once. Up to 3 months are supported.\n   *\n   * @default 1\n   */\n  visibleMonths?: number;\n\n  /**\n   * A function to create a new\n   * [Calendar](https://react-spectrum.adobe.com/internationalized/date/Calendar.html) object for a\n   * given calendar identifier. If not provided, the `createCalendar` function from\n   * `@internationalized/date` will be used.\n   */\n  createCalendar?: (identifier: CalendarIdentifier) => ICalendar;\n}\n\n/**\n * RangeCalendars display a grid of days in one or more months and allow users to select a\n * contiguous range of dates.\n */\nexport const RangeCalendar = React.forwardRef(function RangeCalendar<T extends DateValue>(\n  props: SpectrumRangeCalendarProps<T>,\n  ref: FocusableRef<HTMLElement>\n) {\n  props = useProviderProps(props);\n  let {visibleMonths = 1} = props;\n  visibleMonths = Math.max(visibleMonths, 1);\n  let visibleDuration = useMemo(() => ({months: visibleMonths}), [visibleMonths]);\n  let {locale} = useLocale();\n  let state = useRangeCalendarState({\n    ...props,\n    locale,\n    visibleDuration,\n    createCalendar: props.createCalendar || createCalendar\n  });\n\n  let domRef = useRef(null);\n  useImperativeHandle(ref, () => ({\n    ...createDOMRef(domRef),\n    focus() {\n      state.setFocused(true);\n    }\n  }));\n\n  let {calendarProps, prevButtonProps, nextButtonProps, errorMessageProps} = useRangeCalendar(\n    props,\n    state,\n    domRef\n  );\n\n  return (\n    <CalendarBase\n      {...props}\n      visibleMonths={visibleMonths}\n      state={state}\n      calendarRef={domRef}\n      calendarProps={calendarProps}\n      prevButtonProps={prevButtonProps}\n      nextButtonProps={nextButtonProps}\n      errorMessageProps={errorMessageProps}\n    />\n  );\n}) as <T extends DateValue>(\n  props: SpectrumRangeCalendarProps<T> & {ref?: FocusableRef<HTMLElement>}\n) => ReactElement;\n"],"names":[],"version":3,"file":"RangeCalendar.cjs.map"}