{"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAgCM,MAAM,0DAAgB,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC,SAAS,cAAmC,KAAoC,EAAE,GAA8B;IAC5J,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,EAAE,OAAO,OAAO;IAE1G,qBACE,0DAAC,CAAA,GAAA,sCAAW;QACT,GAAG,KAAK;QACT,eAAe;QACf,OAAO;QACP,aAAa;QACb,eAAe;QACf,iBAAiB;QACjB,iBAAiB;QACjB,mBAAmB;;AAEzB","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> extends AriaRangeCalendarProps<T>, StyleProps {\n  /**\n   * The number of months to display at once. Up to 3 months are supported.\n   * @default 1\n   */\n  visibleMonths?: number,\n\n  /**\n   * A function to create a new [Calendar](https://react-spectrum.adobe.com/internationalized/date/Calendar.html)\n   * object for a given calendar identifier. If not provided, the `createCalendar` function\n   * from `@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 contiguous range of dates.\n */\nexport const RangeCalendar = React.forwardRef(function RangeCalendar<T extends DateValue>(props: SpectrumRangeCalendarProps<T>, ref: FocusableRef<HTMLElement>) {\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(props, state, domRef);\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}) as <T extends DateValue>(props: SpectrumRangeCalendarProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;\n"],"names":[],"version":3,"file":"RangeCalendar.cjs.map"}