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AG;qBAC3C,0DAAC,CAAA,GAAA,mCAAQ;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;;AAUhC","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 {useFocusManagerRef, useFormatHelpText, useFormattedDateWidth, useVisibleMonths} 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> extends SpectrumDateFieldBase<T>, SpectrumLabelableProps, StyleProps {\n  /**\n   * The maximum number of months to display at once in the calendar popover, if screen space permits.\n   * @default 1\n   */\n  maxVisibleMonths?: number,\n  /**\n   * Whether the calendar popover should automatically flip direction when space is limited.\n   * @default true\n   */\n  shouldFlip?: boolean,\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. 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> extends Omit<AriaDatePickerProps<T>, 'isInvalid' | 'validationState' | 'autoComplete'>, SpectrumDatePickerBase<T> {}\n\n/**\n * DatePickers combine a DateField and a Calendar popover to allow users to enter or select a date and time value.\n */\nexport const DatePicker = React.forwardRef(function DatePicker<T extends DateValue>(props: SpectrumDatePickerProps<T>, ref: FocusableRef<HTMLElement>) {\n  props = useProviderProps(props);\n  props = useFormProps(props);\n  let {\n    autoFocus,\n    isQuiet,\n    isDisabled,\n    placeholderValue,\n    maxVisibleMonths = 1\n  } = 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 {groupProps, labelProps, fieldProps, descriptionProps, errorMessageProps, buttonProps, dialogProps, calendarProps, isInvalid, validationErrors, validationDetails} = 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(\n    styles,\n    'spectrum-InputGroup',\n    {\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\n  let fieldClassName = classNames(\n    styles,\n    'spectrum-InputGroup-input',\n    {\n      'is-disabled': isDisabled,\n      'is-invalid': isInvalid && !isDisabled\n    }\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 = state.granularity === 'hour' || state.granularity === 'minute' || state.granularity === 'second' ? state.granularity : 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\n            {...fieldProps}\n            data-testid=\"date-field\"\n            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 UNSAFE_className={classNames(datepickerStyles, 'react-spectrum-Datepicker-dialog')} {...dialogProps}>\n            <Content>\n              <div className={classNames(datepickerStyles, 'react-spectrum-Datepicker-dialogContent')}>\n                <Calendar\n                  {...calendarProps}\n                  visibleMonths={visibleMonths}\n                  createCalendar={props.createCalendar}\n                  UNSAFE_className={classNames(datepickerStyles, 'react-spectrum-Datepicker-calendar', {'is-invalid': isInvalid})} />\n                {showTimeField &&\n                  <div className={classNames(datepickerStyles, 'react-spectrum-Datepicker-timeFields')}>\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                  </div>\n                }\n              </div>\n            </Content>\n          </Dialog>\n        </DialogTrigger>\n      </div>\n    </Field>\n  );\n}) as <T extends DateValue>(props: SpectrumDatePickerProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;\n"],"names":[],"version":3,"file":"DatePicker.cjs.map"}