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EAAE,CAAA,GAAA,8CAAe,GAAG;QAC9C,GAAG,WAAW;qBACf,gCAAC,CAAA,GAAA,yCAAM,uBACL,gCAAC;QACC,WAAW,CAAA,GAAA,yCAAS,EAAE,CAAA,GAAA,8CAAe,GAAG;qBACxC,gCAAC,CAAA,GAAA,yCAAY;QACV,GAAG,aAAa;QACjB,eAAe;QACf,gBAAgB,MAAM,cAAc;QACpC,kBAAkB,CAAA,GAAA,yCAAS,EACzB,CAAA,GAAA,8CAAe,GACf,sCACA;YAAC,cAAc,oBAAoB;QAAS;QAG/C,+BACC,gCAAC,CAAA,GAAA,yCAAG;QACF,KAAI;QACJ,WAAU;QACV,kBAAkB,CAAA,GAAA,yCAAS,EACzB,CAAA,GAAA,8CAAe,GACf;qBAEF,gCAAC,CAAA,GAAA,yCAAQ;QACP,OAAO,gBAAgB,MAAM,CAAC;QAC9B,OAAO,MAAM,SAAS,EAAE,SAAS;QACjC,UAAU,CAAA,IAAK,MAAM,OAAO,CAAC,SAAS;QACtC,kBAAkB;QAClB,aAAa;QACb,UAAU;QACV,UAAU;QACV,WAAW,MAAM,SAAS;QAC1B,cAAc,MAAM,YAAY;QAChC,MAAA;sBAEF,gCAAC,CAAA,GAAA,yCAAQ;QACP,OAAO,gBAAgB,MAAM,CAAC;QAC9B,OAAO,MAAM,SAAS,EAAE,OAAO;QAC/B,UAAU,CAAA,IAAK,MAAM,OAAO,CAAC,OAAO;QACpC,kBAAkB;QAClB,aAAa;QACb,UAAU;QACV,UAAU;QACV,WAAW,MAAM,SAAS;QAC1B,cAAc,MAAM,YAAY;QAChC,MAAA;;AAWtB;AAIA,SAAS;IACP,qBACE,gCAAC;QACC,eAAY;QACZ,eAAY;QACZ,WAAW,CAAA,GAAA,yCAAS,EAAE,CAAA,GAAA,8CAAe,GAAG;;AAG9C","sources":["packages/@adobe/react-spectrum/src/datepicker/DateRangePicker.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 {\n  AriaDateRangePickerProps,\n  DateValue,\n  useDateRangePicker\n} from 'react-aria/useDateRangePicker';\nimport CalendarIcon from '@spectrum-icons/workflow/Calendar';\nimport {classNames} from '../utils/classNames';\nimport {Content} from '../view/Content';\nimport {DatePickerField} from './DatePickerField';\nimport datepickerStyles from './styles.css';\nimport {Dialog} from '../dialog/Dialog';\nimport {DialogTrigger} from '../dialog/DialogTrigger';\nimport {Field} from '../label/Field';\nimport {FieldButton} from '../button/FieldButton';\nimport {Flex} from '../layout/Flex';\nimport {FocusableRef} from '@react-types/shared';\nimport {Input} from './Input';\nimport intlMessages from '../../intl/datepicker/*.json';\n// @ts-ignore\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {RangeCalendar} from '../calendar/RangeCalendar';\nimport React, {ReactElement, useRef} from 'react';\nimport {SpectrumDatePickerBase} from './DatePicker';\nimport styles from '@adobe/spectrum-css-temp/components/inputgroup/vars.css';\nimport {TimeField} from './TimeField';\nimport {useDateRangePickerState} from 'react-stately/useDateRangePickerState';\nimport {\n  useFocusManagerRef,\n  useFormatHelpText,\n  useFormattedDateWidth,\n  useVisibleMonths\n} from './utils';\nimport {useFocusRing} from 'react-aria/useFocusRing';\nimport {useFormProps} from '../form/Form';\nimport {useHover} from 'react-aria/useHover';\nimport {useLocale} from 'react-aria/I18nProvider';\nimport {useLocalizedStringFormatter} from 'react-aria/useLocalizedStringFormatter';\nimport {useProviderProps} from '../provider/Provider';\n\nexport interface SpectrumDateRangePickerProps<T extends DateValue>\n  extends\n    Omit<AriaDateRangePickerProps<T>, 'isInvalid' | 'validationState'>,\n    Omit<SpectrumDatePickerBase<T>, 'validate'> {}\n\n/**\n * DateRangePickers combine two DateFields and a RangeCalendar popover to allow users\n * to enter or select a date and time range.\n */\nexport const DateRangePicker = React.forwardRef(function DateRangePicker<T extends DateValue>(\n  props: SpectrumDateRangePickerProps<T>,\n  ref: FocusableRef<HTMLElement>\n) {\n  props = useProviderProps(props);\n  props = useFormProps(props);\n  let {isQuiet, isDisabled, autoFocus, placeholderValue, maxVisibleMonths = 1} = props;\n  let {hoverProps, isHovered} = useHover({isDisabled});\n  let targetRef = useRef<HTMLDivElement | null>(null);\n  let state = useDateRangePickerState({\n    ...props,\n    shouldCloseOnSelect: () => !state.hasTime\n  });\n  let {\n    labelProps,\n    groupProps,\n    buttonProps,\n    dialogProps,\n    startFieldProps,\n    endFieldProps,\n    descriptionProps,\n    errorMessageProps,\n    calendarProps,\n    isInvalid,\n    validationErrors,\n    validationDetails\n  } = useDateRangePicker(props, state, targetRef);\n  let {isOpen, setOpen} = state;\n  let {direction} = useLocale();\n  let domRef = useFocusManagerRef(ref);\n  let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/datepicker');\n\n  let {isFocused, isFocusVisible, focusProps} = useFocusRing({\n    within: true,\n    isTextInput: true,\n    autoFocus\n  });\n\n  let {isFocused: isFocusedButton, focusProps: focusPropsButton} = useFocusRing({\n    within: false,\n    isTextInput: false,\n    autoFocus\n  });\n\n  let className = classNames(styles, 'spectrum-InputGroup', {\n    'spectrum-InputGroup--quiet': isQuiet,\n    'spectrum-InputGroup--invalid': isInvalid && !isDisabled,\n    'is-disabled': isDisabled,\n    'is-hovered': isHovered,\n    'is-focused': isFocused,\n    'focus-ring': isFocusVisible && !isFocusedButton\n  });\n\n  let fieldClassName = classNames(styles, 'spectrum-InputGroup-input', {\n    'is-disabled': isDisabled,\n    'is-invalid': isInvalid && !isDisabled\n  });\n\n  // Note: this description is intentionally not passed to useDatePicker.\n  // The format help text is unnecessary for screen reader users because each segment already has a label.\n  let description = useFormatHelpText(props);\n  if (description && !props.description) {\n    descriptionProps.id = undefined;\n  }\n\n  let placeholder: DateValue | null | undefined = placeholderValue;\n  let timePlaceholder = placeholder && 'hour' in placeholder ? placeholder : null;\n  let timeMinValue = props.minValue && 'hour' in props.minValue ? props.minValue : null;\n  let timeMaxValue = props.maxValue && 'hour' in props.maxValue ? props.maxValue : null;\n  let timeGranularity =\n    state.granularity === 'hour' || state.granularity === 'minute' || state.granularity === 'second'\n      ? state.granularity\n      : null;\n  let showTimeField = !!timeGranularity;\n\n  let visibleMonths = useVisibleMonths(maxVisibleMonths);\n  let validationState = state.validationState || (isInvalid ? 'invalid' : null);\n\n  // Multiplying by two for the two dates, adding one character for the dash, and then the padding around the dash\n  let approximateWidth = `calc(${useFormattedDateWidth(state) * 2 + 1}ch + 2 * var(--spectrum-global-dimension-size-100))`;\n\n  return (\n    <Field\n      {...props}\n      ref={domRef}\n      elementType=\"span\"\n      description={description}\n      labelProps={labelProps}\n      descriptionProps={descriptionProps}\n      errorMessageProps={errorMessageProps}\n      validationState={validationState}\n      isInvalid={isInvalid}\n      validationErrors={validationErrors}\n      validationDetails={validationDetails}\n      wrapperClassName={classNames(datepickerStyles, 'react-spectrum-Datepicker-fieldWrapper')}>\n      <div\n        {...mergeProps(groupProps, hoverProps, focusProps)}\n        className={className}\n        ref={targetRef}>\n        <div style={{overflow: 'hidden', width: '100%'}}>\n          <Input\n            isDisabled={isDisabled}\n            isQuiet={isQuiet}\n            validationState={validationState}\n            className={classNames(styles, 'spectrum-InputGroup-field')}\n            inputClassName={fieldClassName}\n            disableFocusRing\n            minWidth={approximateWidth}>\n            <DatePickerField\n              {...startFieldProps}\n              data-testid=\"start-date\"\n              isQuiet={props.isQuiet}\n              inputClassName={classNames(datepickerStyles, 'react-spectrum-Datepicker-startField')}\n            />\n            <DateRangeDash />\n            <DatePickerField\n              {...endFieldProps}\n              data-testid=\"end-date\"\n              isQuiet={props.isQuiet}\n              inputClassName={classNames(\n                styles,\n                'spectrum-Datepicker-endField',\n                classNames(datepickerStyles, 'react-spectrum-Datepicker-endField')\n              )}\n            />\n          </Input>\n        </div>\n        <DialogTrigger\n          type=\"popover\"\n          mobileType=\"tray\"\n          placement={direction === 'rtl' ? 'bottom right' : 'bottom left'}\n          targetRef={targetRef}\n          hideArrow\n          isOpen={isOpen}\n          onOpenChange={setOpen}\n          shouldFlip={props.shouldFlip}>\n          <FieldButton\n            {...mergeProps(buttonProps, focusPropsButton)}\n            UNSAFE_className={classNames(styles, 'spectrum-FieldButton')}\n            isQuiet={isQuiet}\n            validationState={validationState}>\n            <CalendarIcon />\n          </FieldButton>\n          <Dialog\n            UNSAFE_className={classNames(datepickerStyles, 'react-spectrum-Datepicker-dialog')}\n            {...dialogProps}>\n            <Content>\n              <div\n                className={classNames(datepickerStyles, 'react-spectrum-Datepicker-dialogContent')}>\n                <RangeCalendar\n                  {...calendarProps}\n                  visibleMonths={visibleMonths}\n                  createCalendar={props.createCalendar}\n                  UNSAFE_className={classNames(\n                    datepickerStyles,\n                    'react-spectrum-Datepicker-calendar',\n                    {'is-invalid': validationState === 'invalid'}\n                  )}\n                />\n                {showTimeField && (\n                  <Flex\n                    gap=\"size-100\"\n                    marginTop=\"size-100\"\n                    UNSAFE_className={classNames(\n                      datepickerStyles,\n                      'react-spectrum-Datepicker-timeFields'\n                    )}>\n                    <TimeField\n                      label={stringFormatter.format('startTime')}\n                      value={state.timeRange?.start || null}\n                      onChange={v => state.setTime('start', v)}\n                      placeholderValue={timePlaceholder}\n                      granularity={timeGranularity}\n                      minValue={timeMinValue}\n                      maxValue={timeMaxValue}\n                      hourCycle={props.hourCycle}\n                      hideTimeZone={props.hideTimeZone}\n                      flex\n                    />\n                    <TimeField\n                      label={stringFormatter.format('endTime')}\n                      value={state.timeRange?.end || null}\n                      onChange={v => state.setTime('end', v)}\n                      placeholderValue={timePlaceholder}\n                      granularity={timeGranularity}\n                      minValue={timeMinValue}\n                      maxValue={timeMaxValue}\n                      hourCycle={props.hourCycle}\n                      hideTimeZone={props.hideTimeZone}\n                      flex\n                    />\n                  </Flex>\n                )}\n              </div>\n            </Content>\n          </Dialog>\n        </DialogTrigger>\n      </div>\n    </Field>\n  );\n}) as <T extends DateValue>(\n  props: SpectrumDateRangePickerProps<T> & {ref?: FocusableRef<HTMLElement>}\n) => ReactElement;\n\nfunction DateRangeDash() {\n  return (\n    <span\n      aria-hidden=\"true\"\n      data-testid=\"date-range-dash\"\n      className={classNames(datepickerStyles, 'react-spectrum-Datepicker-rangeDash')}\n    />\n  );\n}\n"],"names":[],"version":3,"file":"DateRangePicker.mjs.map"}