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AA,GAAA,yCAAQ;QACP,OAAO,gBAAgB,MAAM,CAAC;QAC9B,OAAO,MAAM,SAAS;QACtB,UAAU,MAAM,YAAY;QAC5B,kBAAkB;QAClB,aAAa;QACb,UAAU;QACV,UAAU;QACV,WAAW,MAAM,SAAS;QAC1B,cAAc,MAAM,YAAY;QAChC,WAAU;;AAWhC","sources":["packages/@adobe/react-spectrum/src/datepicker/DatePicker.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 {AriaDatePickerProps, DateValue, useDatePicker} from 'react-aria/useDatePicker';\n\nimport {Calendar} from '../calendar/Calendar';\nimport CalendarIcon from '@spectrum-icons/workflow/Calendar';\nimport {CalendarIdentifier, Calendar as ICalendar} from '@internationalized/date';\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 {FocusableRef, SpectrumLabelableProps, StyleProps} from '@react-types/shared';\nimport {Input} from './Input';\nimport intlMessages from '../../intl/datepicker/*.json';\n// @ts-ignore\nimport {mergeProps} from 'react-aria/mergeProps';\nimport React, {ReactElement, useRef} from 'react';\nimport {SpectrumDateFieldBase} from './DateField';\nimport styles from '@adobe/spectrum-css-temp/components/inputgroup/vars.css'; // HACK: must be included BEFORE inputgroup\nimport {TimeField} from './TimeField';\nimport {useDatePickerState} from 'react-stately/useDatePickerState';\nimport '@adobe/spectrum-css-temp/components/textfield/vars.css';\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 SpectrumDatePickerBase<T extends DateValue>\n  extends SpectrumDateFieldBase<T>, SpectrumLabelableProps, StyleProps {\n  /**\n   * The maximum number of months to display at once in the calendar popover, if screen space\n   * permits.\n   *\n   * @default 1\n   */\n  maxVisibleMonths?: number;\n  /**\n   * Whether the calendar popover should automatically flip direction when space is limited.\n   *\n   * @default true\n   */\n  shouldFlip?: boolean;\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. This will be used for the popover calendar. If not provided, the\n   * `createCalendar` function from `@internationalized/date` will be used.\n   */\n  createCalendar?: (identifier: CalendarIdentifier) => ICalendar;\n}\n\nexport interface SpectrumDatePickerProps<T extends DateValue>\n  extends\n    Omit<AriaDatePickerProps<T>, 'isInvalid' | 'validationState' | 'autoComplete'>,\n    SpectrumDatePickerBase<T> {}\n\n/**\n * DatePickers combine a DateField and a Calendar popover to allow users to enter or select a date\n * and time value.\n */\nexport const DatePicker = React.forwardRef(function DatePicker<T extends DateValue>(\n  props: SpectrumDatePickerProps<T>,\n  ref: FocusableRef<HTMLElement>\n) {\n  props = useProviderProps(props);\n  props = useFormProps(props);\n  let {autoFocus, isQuiet, isDisabled, placeholderValue, maxVisibleMonths = 1} = props;\n  let {hoverProps, isHovered} = useHover({isDisabled});\n  let targetRef = useRef<HTMLDivElement | null>(null);\n  let state = useDatePickerState({\n    ...props,\n    shouldCloseOnSelect: () => !state.hasTime\n  });\n  let {\n    groupProps,\n    labelProps,\n    fieldProps,\n    descriptionProps,\n    errorMessageProps,\n    buttonProps,\n    dialogProps,\n    calendarProps,\n    isInvalid,\n    validationErrors,\n    validationDetails\n  } = useDatePicker(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  let approximateWidth = useFormattedDateWidth(state) + 'ch';\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        <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 {...fieldProps} data-testid=\"date-field\" isQuiet={isQuiet} />\n        </Input>\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                <Calendar\n                  {...calendarProps}\n                  visibleMonths={visibleMonths}\n                  createCalendar={props.createCalendar}\n                  UNSAFE_className={classNames(\n                    datepickerStyles,\n                    'react-spectrum-Datepicker-calendar',\n                    {'is-invalid': isInvalid}\n                  )}\n                />\n                {showTimeField && (\n                  <div\n                    className={classNames(\n                      datepickerStyles,\n                      'react-spectrum-Datepicker-timeFields'\n                    )}>\n                    <TimeField\n                      label={stringFormatter.format('time')}\n                      value={state.timeValue}\n                      onChange={state.setTimeValue}\n                      placeholderValue={timePlaceholder}\n                      granularity={timeGranularity}\n                      minValue={timeMinValue}\n                      maxValue={timeMaxValue}\n                      hourCycle={props.hourCycle}\n                      hideTimeZone={props.hideTimeZone}\n                      marginTop=\"size-100\"\n                    />\n                  </div>\n                )}\n              </div>\n            </Content>\n          </Dialog>\n        </DialogTrigger>\n      </div>\n    </Field>\n  );\n}) as <T extends DateValue>(\n  props: SpectrumDatePickerProps<T> & {ref?: FocusableRef<HTMLElement>}\n) => ReactElement;\n"],"names":[],"version":3,"file":"DatePicker.mjs.map"}