@react-aria/datepicker 3.9.2 → 3.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/dist/ar-AE.main.js +21 -0
  2. package/dist/ar-AE.main.js.map +1 -0
  3. package/dist/ar-AE.mjs +23 -0
  4. package/dist/ar-AE.module.js +23 -0
  5. package/dist/ar-AE.module.js.map +1 -0
  6. package/dist/bg-BG.main.js +21 -0
  7. package/dist/bg-BG.main.js.map +1 -0
  8. package/dist/bg-BG.mjs +23 -0
  9. package/dist/bg-BG.module.js +23 -0
  10. package/dist/bg-BG.module.js.map +1 -0
  11. package/dist/cs-CZ.main.js +21 -0
  12. package/dist/cs-CZ.main.js.map +1 -0
  13. package/dist/cs-CZ.mjs +23 -0
  14. package/dist/cs-CZ.module.js +23 -0
  15. package/dist/cs-CZ.module.js.map +1 -0
  16. package/dist/da-DK.main.js +21 -0
  17. package/dist/da-DK.main.js.map +1 -0
  18. package/dist/da-DK.mjs +23 -0
  19. package/dist/da-DK.module.js +23 -0
  20. package/dist/da-DK.module.js.map +1 -0
  21. package/dist/de-DE.main.js +21 -0
  22. package/dist/de-DE.main.js.map +1 -0
  23. package/dist/de-DE.mjs +23 -0
  24. package/dist/de-DE.module.js +23 -0
  25. package/dist/de-DE.module.js.map +1 -0
  26. package/dist/el-GR.main.js +21 -0
  27. package/dist/el-GR.main.js.map +1 -0
  28. package/dist/el-GR.mjs +23 -0
  29. package/dist/el-GR.module.js +23 -0
  30. package/dist/el-GR.module.js.map +1 -0
  31. package/dist/en-US.main.js +21 -0
  32. package/dist/en-US.main.js.map +1 -0
  33. package/dist/en-US.mjs +23 -0
  34. package/dist/en-US.module.js +23 -0
  35. package/dist/en-US.module.js.map +1 -0
  36. package/dist/es-ES.main.js +21 -0
  37. package/dist/es-ES.main.js.map +1 -0
  38. package/dist/es-ES.mjs +23 -0
  39. package/dist/es-ES.module.js +23 -0
  40. package/dist/es-ES.module.js.map +1 -0
  41. package/dist/et-EE.main.js +21 -0
  42. package/dist/et-EE.main.js.map +1 -0
  43. package/dist/et-EE.mjs +23 -0
  44. package/dist/et-EE.module.js +23 -0
  45. package/dist/et-EE.module.js.map +1 -0
  46. package/dist/fi-FI.main.js +21 -0
  47. package/dist/fi-FI.main.js.map +1 -0
  48. package/dist/fi-FI.mjs +23 -0
  49. package/dist/fi-FI.module.js +23 -0
  50. package/dist/fi-FI.module.js.map +1 -0
  51. package/dist/fr-FR.main.js +21 -0
  52. package/dist/fr-FR.main.js.map +1 -0
  53. package/dist/fr-FR.mjs +23 -0
  54. package/dist/fr-FR.module.js +23 -0
  55. package/dist/fr-FR.module.js.map +1 -0
  56. package/dist/he-IL.main.js +21 -0
  57. package/dist/he-IL.main.js.map +1 -0
  58. package/dist/he-IL.mjs +23 -0
  59. package/dist/he-IL.module.js +23 -0
  60. package/dist/he-IL.module.js.map +1 -0
  61. package/dist/hr-HR.main.js +21 -0
  62. package/dist/hr-HR.main.js.map +1 -0
  63. package/dist/hr-HR.mjs +23 -0
  64. package/dist/hr-HR.module.js +23 -0
  65. package/dist/hr-HR.module.js.map +1 -0
  66. package/dist/hu-HU.main.js +21 -0
  67. package/dist/hu-HU.main.js.map +1 -0
  68. package/dist/hu-HU.mjs +23 -0
  69. package/dist/hu-HU.module.js +23 -0
  70. package/dist/hu-HU.module.js.map +1 -0
  71. package/dist/import.mjs +5 -1693
  72. package/dist/intlStrings.main.js +108 -0
  73. package/dist/intlStrings.main.js.map +1 -0
  74. package/dist/intlStrings.mjs +110 -0
  75. package/dist/intlStrings.module.js +110 -0
  76. package/dist/intlStrings.module.js.map +1 -0
  77. package/dist/it-IT.main.js +21 -0
  78. package/dist/it-IT.main.js.map +1 -0
  79. package/dist/it-IT.mjs +23 -0
  80. package/dist/it-IT.module.js +23 -0
  81. package/dist/it-IT.module.js.map +1 -0
  82. package/dist/ja-JP.main.js +21 -0
  83. package/dist/ja-JP.main.js.map +1 -0
  84. package/dist/ja-JP.mjs +23 -0
  85. package/dist/ja-JP.module.js +23 -0
  86. package/dist/ja-JP.module.js.map +1 -0
  87. package/dist/ko-KR.main.js +21 -0
  88. package/dist/ko-KR.main.js.map +1 -0
  89. package/dist/ko-KR.mjs +23 -0
  90. package/dist/ko-KR.module.js +23 -0
  91. package/dist/ko-KR.module.js.map +1 -0
  92. package/dist/lt-LT.main.js +21 -0
  93. package/dist/lt-LT.main.js.map +1 -0
  94. package/dist/lt-LT.mjs +23 -0
  95. package/dist/lt-LT.module.js +23 -0
  96. package/dist/lt-LT.module.js.map +1 -0
  97. package/dist/lv-LV.main.js +21 -0
  98. package/dist/lv-LV.main.js.map +1 -0
  99. package/dist/lv-LV.mjs +23 -0
  100. package/dist/lv-LV.module.js +23 -0
  101. package/dist/lv-LV.module.js.map +1 -0
  102. package/dist/main.js +11 -1699
  103. package/dist/main.js.map +1 -1
  104. package/dist/module.js +5 -1693
  105. package/dist/module.js.map +1 -1
  106. package/dist/nb-NO.main.js +21 -0
  107. package/dist/nb-NO.main.js.map +1 -0
  108. package/dist/nb-NO.mjs +23 -0
  109. package/dist/nb-NO.module.js +23 -0
  110. package/dist/nb-NO.module.js.map +1 -0
  111. package/dist/nl-NL.main.js +21 -0
  112. package/dist/nl-NL.main.js.map +1 -0
  113. package/dist/nl-NL.mjs +23 -0
  114. package/dist/nl-NL.module.js +23 -0
  115. package/dist/nl-NL.module.js.map +1 -0
  116. package/dist/pl-PL.main.js +21 -0
  117. package/dist/pl-PL.main.js.map +1 -0
  118. package/dist/pl-PL.mjs +23 -0
  119. package/dist/pl-PL.module.js +23 -0
  120. package/dist/pl-PL.module.js.map +1 -0
  121. package/dist/pt-BR.main.js +21 -0
  122. package/dist/pt-BR.main.js.map +1 -0
  123. package/dist/pt-BR.mjs +23 -0
  124. package/dist/pt-BR.module.js +23 -0
  125. package/dist/pt-BR.module.js.map +1 -0
  126. package/dist/pt-PT.main.js +21 -0
  127. package/dist/pt-PT.main.js.map +1 -0
  128. package/dist/pt-PT.mjs +23 -0
  129. package/dist/pt-PT.module.js +23 -0
  130. package/dist/pt-PT.module.js.map +1 -0
  131. package/dist/ro-RO.main.js +21 -0
  132. package/dist/ro-RO.main.js.map +1 -0
  133. package/dist/ro-RO.mjs +23 -0
  134. package/dist/ro-RO.module.js +23 -0
  135. package/dist/ro-RO.module.js.map +1 -0
  136. package/dist/ru-RU.main.js +21 -0
  137. package/dist/ru-RU.main.js.map +1 -0
  138. package/dist/ru-RU.mjs +23 -0
  139. package/dist/ru-RU.module.js +23 -0
  140. package/dist/ru-RU.module.js.map +1 -0
  141. package/dist/sk-SK.main.js +21 -0
  142. package/dist/sk-SK.main.js.map +1 -0
  143. package/dist/sk-SK.mjs +23 -0
  144. package/dist/sk-SK.module.js +23 -0
  145. package/dist/sk-SK.module.js.map +1 -0
  146. package/dist/sl-SI.main.js +21 -0
  147. package/dist/sl-SI.main.js.map +1 -0
  148. package/dist/sl-SI.mjs +23 -0
  149. package/dist/sl-SI.module.js +23 -0
  150. package/dist/sl-SI.module.js.map +1 -0
  151. package/dist/sr-SP.main.js +21 -0
  152. package/dist/sr-SP.main.js.map +1 -0
  153. package/dist/sr-SP.mjs +23 -0
  154. package/dist/sr-SP.module.js +23 -0
  155. package/dist/sr-SP.module.js.map +1 -0
  156. package/dist/sv-SE.main.js +21 -0
  157. package/dist/sv-SE.main.js.map +1 -0
  158. package/dist/sv-SE.mjs +23 -0
  159. package/dist/sv-SE.module.js +23 -0
  160. package/dist/sv-SE.module.js.map +1 -0
  161. package/dist/tr-TR.main.js +21 -0
  162. package/dist/tr-TR.main.js.map +1 -0
  163. package/dist/tr-TR.mjs +23 -0
  164. package/dist/tr-TR.module.js +23 -0
  165. package/dist/tr-TR.module.js.map +1 -0
  166. package/dist/types.d.ts.map +1 -1
  167. package/dist/uk-UA.main.js +21 -0
  168. package/dist/uk-UA.main.js.map +1 -0
  169. package/dist/uk-UA.mjs +23 -0
  170. package/dist/uk-UA.module.js +23 -0
  171. package/dist/uk-UA.module.js.map +1 -0
  172. package/dist/useDateField.main.js +176 -0
  173. package/dist/useDateField.main.js.map +1 -0
  174. package/dist/useDateField.mjs +167 -0
  175. package/dist/useDateField.module.js +167 -0
  176. package/dist/useDateField.module.js.map +1 -0
  177. package/dist/useDatePicker.main.js +158 -0
  178. package/dist/useDatePicker.main.js.map +1 -0
  179. package/dist/useDatePicker.mjs +153 -0
  180. package/dist/useDatePicker.module.js +153 -0
  181. package/dist/useDatePicker.module.js.map +1 -0
  182. package/dist/useDatePickerGroup.main.js +91 -0
  183. package/dist/useDatePickerGroup.main.js.map +1 -0
  184. package/dist/useDatePickerGroup.mjs +86 -0
  185. package/dist/useDatePickerGroup.module.js +86 -0
  186. package/dist/useDatePickerGroup.module.js.map +1 -0
  187. package/dist/useDateRangePicker.main.js +201 -0
  188. package/dist/useDateRangePicker.main.js.map +1 -0
  189. package/dist/useDateRangePicker.mjs +196 -0
  190. package/dist/useDateRangePicker.module.js +196 -0
  191. package/dist/useDateRangePicker.module.js.map +1 -0
  192. package/dist/useDateSegment.main.js +366 -0
  193. package/dist/useDateSegment.main.js.map +1 -0
  194. package/dist/useDateSegment.mjs +357 -0
  195. package/dist/useDateSegment.module.js +357 -0
  196. package/dist/useDateSegment.module.js.map +1 -0
  197. package/dist/useDisplayNames.main.js +59 -0
  198. package/dist/useDisplayNames.main.js.map +1 -0
  199. package/dist/useDisplayNames.mjs +54 -0
  200. package/dist/useDisplayNames.module.js +54 -0
  201. package/dist/useDisplayNames.module.js.map +1 -0
  202. package/dist/zh-CN.main.js +21 -0
  203. package/dist/zh-CN.main.js.map +1 -0
  204. package/dist/zh-CN.mjs +23 -0
  205. package/dist/zh-CN.module.js +23 -0
  206. package/dist/zh-CN.module.js.map +1 -0
  207. package/dist/zh-TW.main.js +21 -0
  208. package/dist/zh-TW.main.js.map +1 -0
  209. package/dist/zh-TW.mjs +23 -0
  210. package/dist/zh-TW.module.js +23 -0
  211. package/dist/zh-TW.module.js.map +1 -0
  212. package/package.json +19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B,oBAAoB,MAAM,kBAAkB;gBAC5C,mBAAmB,MAAM,iBAAiB;gBAC1C,kBAAiB,CAAC;oBAChB,mBAAmB,OAAO,GAAG;oBAC7B,MAAM,gBAAgB,CAAC,CAAA,GAAA,uCAAc,EAAE,qBAAqB,OAAO,EAAE;gBACvE;gBACA,iBAAiB,MAAM,eAAe;gBACtC,kBAAkB,MAAM,gBAAgB;YAC1C;QACF;0BACA;2BACA;QACA,eAAe;YACb,WAAW;YACX,OAAO,MAAM,SAAS;YACtB,UAAU,MAAM,YAAY;YAC5B,UAAU,MAAM,QAAQ;YACxB,UAAU,MAAM,QAAQ;YACxB,YAAY,MAAM,UAAU;YAC5B,YAAY,MAAM,UAAU;YAC5B,mBAAmB,MAAM,iBAAiB;YAC1C,2BAA2B,MAAM,yBAAyB;YAC1D,qBAAqB,MAAM,SAAS,GAAG,YAAY,MAAM,gBAAgB;YACzE,WAAW,MAAM,SAAS;YAC1B,cAAc,OAAO,MAAM,YAAY,KAAK,aAAa,MAAM,YAAY,CAAC,MAAM,iBAAiB,IAAK,MAAM,YAAY,IAAI,MAAM,iBAAiB,CAAC,gBAAgB,CAAC,IAAI,CAAC;QAC9K;mBACA;0BACA;2BACA;IACF;AACF","sources":["packages/@react-aria/datepicker/src/useDateRangePicker.ts"],"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 {AriaButtonProps} from '@react-types/button';\nimport {AriaDatePickerProps, AriaDateRangePickerProps, DateValue} from '@react-types/datepicker';\nimport {AriaDialogProps} from '@react-types/dialog';\nimport {createFocusManager} from '@react-aria/focus';\nimport {DateRangePickerState} from '@react-stately/datepicker';\nimport {DEFAULT_VALIDATION_RESULT, mergeValidation, privateValidationStateProp} from '@react-stately/form';\nimport {DOMAttributes, GroupDOMAttributes, KeyboardEvent, ValidationResult} from '@react-types/shared';\nimport {filterDOMProps, mergeProps, useDescription, useId} from '@react-aria/utils';\nimport {focusManagerSymbol, roleSymbol} from './useDateField';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {RangeCalendarProps} from '@react-types/calendar';\nimport {RefObject, useMemo, useRef} from 'react';\nimport {useDatePickerGroup} from './useDatePickerGroup';\nimport {useField} from '@react-aria/label';\nimport {useFocusWithin} from '@react-aria/interactions';\nimport {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface DateRangePickerAria extends ValidationResult {\n /** Props for the date range picker's visible label element, if any. */\n labelProps: DOMAttributes,\n /** Props for the grouping element containing the date fields and button. */\n groupProps: GroupDOMAttributes,\n /** Props for the start date field. */\n startFieldProps: AriaDatePickerProps<DateValue>,\n /** Props for the end date field. */\n endFieldProps: AriaDatePickerProps<DateValue>,\n /** Props for the popover trigger button. */\n buttonProps: AriaButtonProps,\n /** Props for the description element, if any. */\n descriptionProps: DOMAttributes,\n /** Props for the error message element, if any. */\n errorMessageProps: DOMAttributes,\n /** Props for the popover dialog. */\n dialogProps: AriaDialogProps,\n /** Props for the range calendar within the popover dialog. */\n calendarProps: RangeCalendarProps<DateValue>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a date picker component.\n * A date range picker combines two DateFields and a RangeCalendar popover to allow\n * users to enter or select a date and time range.\n */\nexport function useDateRangePicker<T extends DateValue>(props: AriaDateRangePickerProps<T>, state: DateRangePickerState, ref: RefObject<Element>): DateRangePickerAria {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/datepicker');\n let {isInvalid, validationErrors, validationDetails} = state.displayValidation;\n let {labelProps, fieldProps, descriptionProps, errorMessageProps} = useField({\n ...props,\n labelElementType: 'span',\n isInvalid,\n errorMessage: props.errorMessage || validationErrors\n });\n\n let labelledBy = fieldProps['aria-labelledby'] || fieldProps.id;\n\n let {locale} = useLocale();\n let range = state.formatValue(locale, {month: 'long'});\n let description = range ? stringFormatter.format('selectedRangeDescription', {startDate: range.start, endDate: range.end}) : '';\n let descProps = useDescription(description);\n\n let startFieldProps = {\n 'aria-label': stringFormatter.format('startDate'),\n 'aria-labelledby': labelledBy\n };\n\n let endFieldProps = {\n 'aria-label': stringFormatter.format('endDate'),\n 'aria-labelledby': labelledBy\n };\n\n let buttonId = useId();\n let dialogId = useId();\n\n let groupProps = useDatePickerGroup(state, ref);\n\n let ariaDescribedBy = [descProps['aria-describedby'], fieldProps['aria-describedby']].filter(Boolean).join(' ') || undefined;\n let focusManager = useMemo(() => createFocusManager(ref, {\n // Exclude the button from the focus manager.\n accept: element => element.id !== buttonId\n }), [ref, buttonId]);\n\n let commonFieldProps = {\n [focusManagerSymbol]: focusManager,\n [roleSymbol]: 'presentation',\n 'aria-describedby': ariaDescribedBy,\n placeholderValue: props.placeholderValue,\n hideTimeZone: props.hideTimeZone,\n hourCycle: props.hourCycle,\n granularity: props.granularity,\n shouldForceLeadingZeros: props.shouldForceLeadingZeros,\n isDisabled: props.isDisabled,\n isReadOnly: props.isReadOnly,\n isRequired: props.isRequired,\n validationBehavior: props.validationBehavior\n };\n\n let domProps = filterDOMProps(props);\n\n let {focusWithinProps} = useFocusWithin({\n ...props,\n isDisabled: state.isOpen,\n onBlurWithin: props.onBlur,\n onFocusWithin: props.onFocus,\n onFocusWithinChange: props.onFocusChange\n });\n\n let startFieldValidation = useRef(DEFAULT_VALIDATION_RESULT);\n let endFieldValidation = useRef(DEFAULT_VALIDATION_RESULT);\n\n return {\n groupProps: mergeProps(domProps, groupProps, fieldProps, descProps, focusWithinProps, {\n role: 'group' as const,\n 'aria-disabled': props.isDisabled || null,\n 'aria-describedby': ariaDescribedBy,\n onKeyDown(e: KeyboardEvent) {\n if (state.isOpen) {\n return;\n }\n\n if (props.onKeyDown) {\n props.onKeyDown(e);\n }\n },\n onKeyUp(e: KeyboardEvent) {\n if (state.isOpen) {\n return;\n }\n\n if (props.onKeyUp) {\n props.onKeyUp(e);\n }\n }\n }),\n labelProps: {\n ...labelProps,\n onClick: () => {\n focusManager.focusFirst();\n }\n },\n buttonProps: {\n ...descProps,\n id: buttonId,\n 'aria-haspopup': 'dialog',\n 'aria-label': stringFormatter.format('calendar'),\n 'aria-labelledby': `${buttonId} ${labelledBy}`,\n 'aria-describedby': ariaDescribedBy,\n 'aria-expanded': state.isOpen,\n isDisabled: props.isDisabled || props.isReadOnly,\n onPress: () => state.setOpen(true)\n },\n dialogProps: {\n id: dialogId,\n 'aria-labelledby': `${buttonId} ${labelledBy}`\n },\n startFieldProps: {\n ...startFieldProps,\n ...commonFieldProps,\n value: state.value?.start,\n onChange: start => state.setDateTime('start', start),\n autoFocus: props.autoFocus,\n name: props.startName,\n [privateValidationStateProp]: {\n realtimeValidation: state.realtimeValidation,\n displayValidation: state.displayValidation,\n updateValidation(e) {\n startFieldValidation.current = e;\n state.updateValidation(mergeValidation(e, endFieldValidation.current));\n },\n resetValidation: state.resetValidation,\n commitValidation: state.commitValidation\n }\n },\n endFieldProps: {\n ...endFieldProps,\n ...commonFieldProps,\n value: state.value?.end,\n onChange: end => state.setDateTime('end', end),\n name: props.endName,\n [privateValidationStateProp]: {\n realtimeValidation: state.realtimeValidation,\n displayValidation: state.displayValidation,\n updateValidation(e) {\n endFieldValidation.current = e;\n state.updateValidation(mergeValidation(startFieldValidation.current, e));\n },\n resetValidation: state.resetValidation,\n commitValidation: state.commitValidation\n }\n },\n descriptionProps,\n errorMessageProps,\n calendarProps: {\n autoFocus: true,\n value: state.dateRange,\n onChange: state.setDateRange,\n minValue: props.minValue,\n maxValue: props.maxValue,\n isDisabled: props.isDisabled,\n isReadOnly: props.isReadOnly,\n isDateUnavailable: props.isDateUnavailable,\n allowsNonContiguousRanges: props.allowsNonContiguousRanges,\n defaultFocusedValue: state.dateRange ? undefined : props.placeholderValue,\n isInvalid: state.isInvalid,\n errorMessage: typeof props.errorMessage === 'function' ? props.errorMessage(state.displayValidation) : (props.errorMessage || state.displayValidation.validationErrors.join(' '))\n },\n isInvalid,\n validationErrors,\n validationDetails\n };\n}\n"],"names":[],"version":3,"file":"useDateRangePicker.main.js.map"}
@@ -0,0 +1,196 @@
1
+ import {focusManagerSymbol as $16f0b7bb276bc17e$export$7b3062cd49e80452, roleSymbol as $16f0b7bb276bc17e$export$300019f83c56d282} from "./useDateField.mjs";
2
+ import $eIQ1H$intlStringsmodulejs from "./intlStrings.mjs";
3
+ import {useDatePickerGroup as $3dfb0f96be0d6a08$export$4a931266a3838b86} from "./useDatePickerGroup.mjs";
4
+ import {createFocusManager as $eIQ1H$createFocusManager} from "@react-aria/focus";
5
+ import {DEFAULT_VALIDATION_RESULT as $eIQ1H$DEFAULT_VALIDATION_RESULT, privateValidationStateProp as $eIQ1H$privateValidationStateProp, mergeValidation as $eIQ1H$mergeValidation} from "@react-stately/form";
6
+ import {useDescription as $eIQ1H$useDescription, useId as $eIQ1H$useId, filterDOMProps as $eIQ1H$filterDOMProps, mergeProps as $eIQ1H$mergeProps} from "@react-aria/utils";
7
+ import {useMemo as $eIQ1H$useMemo, useRef as $eIQ1H$useRef} from "react";
8
+ import {useField as $eIQ1H$useField} from "@react-aria/label";
9
+ import {useFocusWithin as $eIQ1H$useFocusWithin} from "@react-aria/interactions";
10
+ import {useLocalizedStringFormatter as $eIQ1H$useLocalizedStringFormatter, useLocale as $eIQ1H$useLocale} from "@react-aria/i18n";
11
+
12
+
13
+ function $parcel$interopDefault(a) {
14
+ return a && a.__esModule ? a.default : a;
15
+ }
16
+ /*
17
+ * Copyright 2020 Adobe. All rights reserved.
18
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
19
+ * you may not use this file except in compliance with the License. You may obtain a copy
20
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
21
+ *
22
+ * Unless required by applicable law or agreed to in writing, software distributed under
23
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
24
+ * OF ANY KIND, either express or implied. See the License for the specific language
25
+ * governing permissions and limitations under the License.
26
+ */
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+ function $887cac91b7cc8801$export$12fd5f0e9f4bb192(props, state, ref) {
37
+ var _state_value, _state_value1;
38
+ let stringFormatter = (0, $eIQ1H$useLocalizedStringFormatter)((0, ($parcel$interopDefault($eIQ1H$intlStringsmodulejs))), "@react-aria/datepicker");
39
+ let { isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = state.displayValidation;
40
+ let { labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $eIQ1H$useField)({
41
+ ...props,
42
+ labelElementType: "span",
43
+ isInvalid: isInvalid,
44
+ errorMessage: props.errorMessage || validationErrors
45
+ });
46
+ let labelledBy = fieldProps["aria-labelledby"] || fieldProps.id;
47
+ let { locale: locale } = (0, $eIQ1H$useLocale)();
48
+ let range = state.formatValue(locale, {
49
+ month: "long"
50
+ });
51
+ let description = range ? stringFormatter.format("selectedRangeDescription", {
52
+ startDate: range.start,
53
+ endDate: range.end
54
+ }) : "";
55
+ let descProps = (0, $eIQ1H$useDescription)(description);
56
+ let startFieldProps = {
57
+ "aria-label": stringFormatter.format("startDate"),
58
+ "aria-labelledby": labelledBy
59
+ };
60
+ let endFieldProps = {
61
+ "aria-label": stringFormatter.format("endDate"),
62
+ "aria-labelledby": labelledBy
63
+ };
64
+ let buttonId = (0, $eIQ1H$useId)();
65
+ let dialogId = (0, $eIQ1H$useId)();
66
+ let groupProps = (0, $3dfb0f96be0d6a08$export$4a931266a3838b86)(state, ref);
67
+ let ariaDescribedBy = [
68
+ descProps["aria-describedby"],
69
+ fieldProps["aria-describedby"]
70
+ ].filter(Boolean).join(" ") || undefined;
71
+ let focusManager = (0, $eIQ1H$useMemo)(()=>(0, $eIQ1H$createFocusManager)(ref, {
72
+ // Exclude the button from the focus manager.
73
+ accept: (element)=>element.id !== buttonId
74
+ }), [
75
+ ref,
76
+ buttonId
77
+ ]);
78
+ let commonFieldProps = {
79
+ [(0, $16f0b7bb276bc17e$export$7b3062cd49e80452)]: focusManager,
80
+ [(0, $16f0b7bb276bc17e$export$300019f83c56d282)]: "presentation",
81
+ "aria-describedby": ariaDescribedBy,
82
+ placeholderValue: props.placeholderValue,
83
+ hideTimeZone: props.hideTimeZone,
84
+ hourCycle: props.hourCycle,
85
+ granularity: props.granularity,
86
+ shouldForceLeadingZeros: props.shouldForceLeadingZeros,
87
+ isDisabled: props.isDisabled,
88
+ isReadOnly: props.isReadOnly,
89
+ isRequired: props.isRequired,
90
+ validationBehavior: props.validationBehavior
91
+ };
92
+ let domProps = (0, $eIQ1H$filterDOMProps)(props);
93
+ let { focusWithinProps: focusWithinProps } = (0, $eIQ1H$useFocusWithin)({
94
+ ...props,
95
+ isDisabled: state.isOpen,
96
+ onBlurWithin: props.onBlur,
97
+ onFocusWithin: props.onFocus,
98
+ onFocusWithinChange: props.onFocusChange
99
+ });
100
+ let startFieldValidation = (0, $eIQ1H$useRef)((0, $eIQ1H$DEFAULT_VALIDATION_RESULT));
101
+ let endFieldValidation = (0, $eIQ1H$useRef)((0, $eIQ1H$DEFAULT_VALIDATION_RESULT));
102
+ return {
103
+ groupProps: (0, $eIQ1H$mergeProps)(domProps, groupProps, fieldProps, descProps, focusWithinProps, {
104
+ role: "group",
105
+ "aria-disabled": props.isDisabled || null,
106
+ "aria-describedby": ariaDescribedBy,
107
+ onKeyDown (e) {
108
+ if (state.isOpen) return;
109
+ if (props.onKeyDown) props.onKeyDown(e);
110
+ },
111
+ onKeyUp (e) {
112
+ if (state.isOpen) return;
113
+ if (props.onKeyUp) props.onKeyUp(e);
114
+ }
115
+ }),
116
+ labelProps: {
117
+ ...labelProps,
118
+ onClick: ()=>{
119
+ focusManager.focusFirst();
120
+ }
121
+ },
122
+ buttonProps: {
123
+ ...descProps,
124
+ id: buttonId,
125
+ "aria-haspopup": "dialog",
126
+ "aria-label": stringFormatter.format("calendar"),
127
+ "aria-labelledby": `${buttonId} ${labelledBy}`,
128
+ "aria-describedby": ariaDescribedBy,
129
+ "aria-expanded": state.isOpen,
130
+ isDisabled: props.isDisabled || props.isReadOnly,
131
+ onPress: ()=>state.setOpen(true)
132
+ },
133
+ dialogProps: {
134
+ id: dialogId,
135
+ "aria-labelledby": `${buttonId} ${labelledBy}`
136
+ },
137
+ startFieldProps: {
138
+ ...startFieldProps,
139
+ ...commonFieldProps,
140
+ value: (_state_value = state.value) === null || _state_value === void 0 ? void 0 : _state_value.start,
141
+ onChange: (start)=>state.setDateTime("start", start),
142
+ autoFocus: props.autoFocus,
143
+ name: props.startName,
144
+ [(0, $eIQ1H$privateValidationStateProp)]: {
145
+ realtimeValidation: state.realtimeValidation,
146
+ displayValidation: state.displayValidation,
147
+ updateValidation (e) {
148
+ startFieldValidation.current = e;
149
+ state.updateValidation((0, $eIQ1H$mergeValidation)(e, endFieldValidation.current));
150
+ },
151
+ resetValidation: state.resetValidation,
152
+ commitValidation: state.commitValidation
153
+ }
154
+ },
155
+ endFieldProps: {
156
+ ...endFieldProps,
157
+ ...commonFieldProps,
158
+ value: (_state_value1 = state.value) === null || _state_value1 === void 0 ? void 0 : _state_value1.end,
159
+ onChange: (end)=>state.setDateTime("end", end),
160
+ name: props.endName,
161
+ [(0, $eIQ1H$privateValidationStateProp)]: {
162
+ realtimeValidation: state.realtimeValidation,
163
+ displayValidation: state.displayValidation,
164
+ updateValidation (e) {
165
+ endFieldValidation.current = e;
166
+ state.updateValidation((0, $eIQ1H$mergeValidation)(startFieldValidation.current, e));
167
+ },
168
+ resetValidation: state.resetValidation,
169
+ commitValidation: state.commitValidation
170
+ }
171
+ },
172
+ descriptionProps: descriptionProps,
173
+ errorMessageProps: errorMessageProps,
174
+ calendarProps: {
175
+ autoFocus: true,
176
+ value: state.dateRange,
177
+ onChange: state.setDateRange,
178
+ minValue: props.minValue,
179
+ maxValue: props.maxValue,
180
+ isDisabled: props.isDisabled,
181
+ isReadOnly: props.isReadOnly,
182
+ isDateUnavailable: props.isDateUnavailable,
183
+ allowsNonContiguousRanges: props.allowsNonContiguousRanges,
184
+ defaultFocusedValue: state.dateRange ? undefined : props.placeholderValue,
185
+ isInvalid: state.isInvalid,
186
+ errorMessage: typeof props.errorMessage === "function" ? props.errorMessage(state.displayValidation) : props.errorMessage || state.displayValidation.validationErrors.join(" ")
187
+ },
188
+ isInvalid: isInvalid,
189
+ validationErrors: validationErrors,
190
+ validationDetails: validationDetails
191
+ };
192
+ }
193
+
194
+
195
+ export {$887cac91b7cc8801$export$12fd5f0e9f4bb192 as useDateRangePicker};
196
+ //# sourceMappingURL=useDateRangePicker.mjs.map
@@ -0,0 +1,196 @@
1
+ import {focusManagerSymbol as $16f0b7bb276bc17e$export$7b3062cd49e80452, roleSymbol as $16f0b7bb276bc17e$export$300019f83c56d282} from "./useDateField.module.js";
2
+ import $eIQ1H$intlStringsmodulejs from "./intlStrings.module.js";
3
+ import {useDatePickerGroup as $3dfb0f96be0d6a08$export$4a931266a3838b86} from "./useDatePickerGroup.module.js";
4
+ import {createFocusManager as $eIQ1H$createFocusManager} from "@react-aria/focus";
5
+ import {DEFAULT_VALIDATION_RESULT as $eIQ1H$DEFAULT_VALIDATION_RESULT, privateValidationStateProp as $eIQ1H$privateValidationStateProp, mergeValidation as $eIQ1H$mergeValidation} from "@react-stately/form";
6
+ import {useDescription as $eIQ1H$useDescription, useId as $eIQ1H$useId, filterDOMProps as $eIQ1H$filterDOMProps, mergeProps as $eIQ1H$mergeProps} from "@react-aria/utils";
7
+ import {useMemo as $eIQ1H$useMemo, useRef as $eIQ1H$useRef} from "react";
8
+ import {useField as $eIQ1H$useField} from "@react-aria/label";
9
+ import {useFocusWithin as $eIQ1H$useFocusWithin} from "@react-aria/interactions";
10
+ import {useLocalizedStringFormatter as $eIQ1H$useLocalizedStringFormatter, useLocale as $eIQ1H$useLocale} from "@react-aria/i18n";
11
+
12
+
13
+ function $parcel$interopDefault(a) {
14
+ return a && a.__esModule ? a.default : a;
15
+ }
16
+ /*
17
+ * Copyright 2020 Adobe. All rights reserved.
18
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
19
+ * you may not use this file except in compliance with the License. You may obtain a copy
20
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
21
+ *
22
+ * Unless required by applicable law or agreed to in writing, software distributed under
23
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
24
+ * OF ANY KIND, either express or implied. See the License for the specific language
25
+ * governing permissions and limitations under the License.
26
+ */
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+ function $887cac91b7cc8801$export$12fd5f0e9f4bb192(props, state, ref) {
37
+ var _state_value, _state_value1;
38
+ let stringFormatter = (0, $eIQ1H$useLocalizedStringFormatter)((0, ($parcel$interopDefault($eIQ1H$intlStringsmodulejs))), "@react-aria/datepicker");
39
+ let { isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = state.displayValidation;
40
+ let { labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $eIQ1H$useField)({
41
+ ...props,
42
+ labelElementType: "span",
43
+ isInvalid: isInvalid,
44
+ errorMessage: props.errorMessage || validationErrors
45
+ });
46
+ let labelledBy = fieldProps["aria-labelledby"] || fieldProps.id;
47
+ let { locale: locale } = (0, $eIQ1H$useLocale)();
48
+ let range = state.formatValue(locale, {
49
+ month: "long"
50
+ });
51
+ let description = range ? stringFormatter.format("selectedRangeDescription", {
52
+ startDate: range.start,
53
+ endDate: range.end
54
+ }) : "";
55
+ let descProps = (0, $eIQ1H$useDescription)(description);
56
+ let startFieldProps = {
57
+ "aria-label": stringFormatter.format("startDate"),
58
+ "aria-labelledby": labelledBy
59
+ };
60
+ let endFieldProps = {
61
+ "aria-label": stringFormatter.format("endDate"),
62
+ "aria-labelledby": labelledBy
63
+ };
64
+ let buttonId = (0, $eIQ1H$useId)();
65
+ let dialogId = (0, $eIQ1H$useId)();
66
+ let groupProps = (0, $3dfb0f96be0d6a08$export$4a931266a3838b86)(state, ref);
67
+ let ariaDescribedBy = [
68
+ descProps["aria-describedby"],
69
+ fieldProps["aria-describedby"]
70
+ ].filter(Boolean).join(" ") || undefined;
71
+ let focusManager = (0, $eIQ1H$useMemo)(()=>(0, $eIQ1H$createFocusManager)(ref, {
72
+ // Exclude the button from the focus manager.
73
+ accept: (element)=>element.id !== buttonId
74
+ }), [
75
+ ref,
76
+ buttonId
77
+ ]);
78
+ let commonFieldProps = {
79
+ [(0, $16f0b7bb276bc17e$export$7b3062cd49e80452)]: focusManager,
80
+ [(0, $16f0b7bb276bc17e$export$300019f83c56d282)]: "presentation",
81
+ "aria-describedby": ariaDescribedBy,
82
+ placeholderValue: props.placeholderValue,
83
+ hideTimeZone: props.hideTimeZone,
84
+ hourCycle: props.hourCycle,
85
+ granularity: props.granularity,
86
+ shouldForceLeadingZeros: props.shouldForceLeadingZeros,
87
+ isDisabled: props.isDisabled,
88
+ isReadOnly: props.isReadOnly,
89
+ isRequired: props.isRequired,
90
+ validationBehavior: props.validationBehavior
91
+ };
92
+ let domProps = (0, $eIQ1H$filterDOMProps)(props);
93
+ let { focusWithinProps: focusWithinProps } = (0, $eIQ1H$useFocusWithin)({
94
+ ...props,
95
+ isDisabled: state.isOpen,
96
+ onBlurWithin: props.onBlur,
97
+ onFocusWithin: props.onFocus,
98
+ onFocusWithinChange: props.onFocusChange
99
+ });
100
+ let startFieldValidation = (0, $eIQ1H$useRef)((0, $eIQ1H$DEFAULT_VALIDATION_RESULT));
101
+ let endFieldValidation = (0, $eIQ1H$useRef)((0, $eIQ1H$DEFAULT_VALIDATION_RESULT));
102
+ return {
103
+ groupProps: (0, $eIQ1H$mergeProps)(domProps, groupProps, fieldProps, descProps, focusWithinProps, {
104
+ role: "group",
105
+ "aria-disabled": props.isDisabled || null,
106
+ "aria-describedby": ariaDescribedBy,
107
+ onKeyDown (e) {
108
+ if (state.isOpen) return;
109
+ if (props.onKeyDown) props.onKeyDown(e);
110
+ },
111
+ onKeyUp (e) {
112
+ if (state.isOpen) return;
113
+ if (props.onKeyUp) props.onKeyUp(e);
114
+ }
115
+ }),
116
+ labelProps: {
117
+ ...labelProps,
118
+ onClick: ()=>{
119
+ focusManager.focusFirst();
120
+ }
121
+ },
122
+ buttonProps: {
123
+ ...descProps,
124
+ id: buttonId,
125
+ "aria-haspopup": "dialog",
126
+ "aria-label": stringFormatter.format("calendar"),
127
+ "aria-labelledby": `${buttonId} ${labelledBy}`,
128
+ "aria-describedby": ariaDescribedBy,
129
+ "aria-expanded": state.isOpen,
130
+ isDisabled: props.isDisabled || props.isReadOnly,
131
+ onPress: ()=>state.setOpen(true)
132
+ },
133
+ dialogProps: {
134
+ id: dialogId,
135
+ "aria-labelledby": `${buttonId} ${labelledBy}`
136
+ },
137
+ startFieldProps: {
138
+ ...startFieldProps,
139
+ ...commonFieldProps,
140
+ value: (_state_value = state.value) === null || _state_value === void 0 ? void 0 : _state_value.start,
141
+ onChange: (start)=>state.setDateTime("start", start),
142
+ autoFocus: props.autoFocus,
143
+ name: props.startName,
144
+ [(0, $eIQ1H$privateValidationStateProp)]: {
145
+ realtimeValidation: state.realtimeValidation,
146
+ displayValidation: state.displayValidation,
147
+ updateValidation (e) {
148
+ startFieldValidation.current = e;
149
+ state.updateValidation((0, $eIQ1H$mergeValidation)(e, endFieldValidation.current));
150
+ },
151
+ resetValidation: state.resetValidation,
152
+ commitValidation: state.commitValidation
153
+ }
154
+ },
155
+ endFieldProps: {
156
+ ...endFieldProps,
157
+ ...commonFieldProps,
158
+ value: (_state_value1 = state.value) === null || _state_value1 === void 0 ? void 0 : _state_value1.end,
159
+ onChange: (end)=>state.setDateTime("end", end),
160
+ name: props.endName,
161
+ [(0, $eIQ1H$privateValidationStateProp)]: {
162
+ realtimeValidation: state.realtimeValidation,
163
+ displayValidation: state.displayValidation,
164
+ updateValidation (e) {
165
+ endFieldValidation.current = e;
166
+ state.updateValidation((0, $eIQ1H$mergeValidation)(startFieldValidation.current, e));
167
+ },
168
+ resetValidation: state.resetValidation,
169
+ commitValidation: state.commitValidation
170
+ }
171
+ },
172
+ descriptionProps: descriptionProps,
173
+ errorMessageProps: errorMessageProps,
174
+ calendarProps: {
175
+ autoFocus: true,
176
+ value: state.dateRange,
177
+ onChange: state.setDateRange,
178
+ minValue: props.minValue,
179
+ maxValue: props.maxValue,
180
+ isDisabled: props.isDisabled,
181
+ isReadOnly: props.isReadOnly,
182
+ isDateUnavailable: props.isDateUnavailable,
183
+ allowsNonContiguousRanges: props.allowsNonContiguousRanges,
184
+ defaultFocusedValue: state.dateRange ? undefined : props.placeholderValue,
185
+ isInvalid: state.isInvalid,
186
+ errorMessage: typeof props.errorMessage === "function" ? props.errorMessage(state.displayValidation) : props.errorMessage || state.displayValidation.validationErrors.join(" ")
187
+ },
188
+ isInvalid: isInvalid,
189
+ validationErrors: validationErrors,
190
+ validationDetails: validationDetails
191
+ };
192
+ }
193
+
194
+
195
+ export {$887cac91b7cc8801$export$12fd5f0e9f4bb192 as useDateRangePicker};
196
+ //# sourceMappingURL=useDateRangePicker.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AA8CM,SAAS,0CAAwC,KAAkC,EAAE,KAA2B,EAAE,GAAuB;QAkHnI,cAkBA;IAnIX,IAAI,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,oDAAW,GAAG;IAChE,IAAI,aAAC,SAAS,oBAAE,gBAAgB,qBAAE,iBAAiB,EAAC,GAAG,MAAM,iBAAiB;IAC9E,IAAI,cAAC,UAAU,cAAE,UAAU,oBAAE,gBAAgB,qBAAE,iBAAiB,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;QAC3E,GAAG,KAAK;QACR,kBAAkB;mBAClB;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B;YAC1D,qBAAqB,MAAM,SAAS,GAAG,YAAY,MAAM,gBAAgB;YACzE,WAAW,MAAM,SAAS;YAC1B,cAAc,OAAO,MAAM,YAAY,KAAK,aAAa,MAAM,YAAY,CAAC,MAAM,iBAAiB,IAAK,MAAM,YAAY,IAAI,MAAM,iBAAiB,CAAC,gBAAgB,CAAC,IAAI,CAAC;QAC9K;mBACA;0BACA;2BACA;IACF;AACF","sources":["packages/@react-aria/datepicker/src/useDateRangePicker.ts"],"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 {AriaButtonProps} from '@react-types/button';\nimport {AriaDatePickerProps, AriaDateRangePickerProps, DateValue} from '@react-types/datepicker';\nimport {AriaDialogProps} from '@react-types/dialog';\nimport {createFocusManager} from '@react-aria/focus';\nimport {DateRangePickerState} from '@react-stately/datepicker';\nimport {DEFAULT_VALIDATION_RESULT, mergeValidation, privateValidationStateProp} from '@react-stately/form';\nimport {DOMAttributes, GroupDOMAttributes, KeyboardEvent, ValidationResult} from '@react-types/shared';\nimport {filterDOMProps, mergeProps, useDescription, useId} from '@react-aria/utils';\nimport {focusManagerSymbol, roleSymbol} from './useDateField';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {RangeCalendarProps} from '@react-types/calendar';\nimport {RefObject, useMemo, useRef} from 'react';\nimport {useDatePickerGroup} from './useDatePickerGroup';\nimport {useField} from '@react-aria/label';\nimport {useFocusWithin} from '@react-aria/interactions';\nimport {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\n\nexport interface DateRangePickerAria extends ValidationResult {\n /** Props for the date range picker's visible label element, if any. */\n labelProps: DOMAttributes,\n /** Props for the grouping element containing the date fields and button. */\n groupProps: GroupDOMAttributes,\n /** Props for the start date field. */\n startFieldProps: AriaDatePickerProps<DateValue>,\n /** Props for the end date field. */\n endFieldProps: AriaDatePickerProps<DateValue>,\n /** Props for the popover trigger button. */\n buttonProps: AriaButtonProps,\n /** Props for the description element, if any. */\n descriptionProps: DOMAttributes,\n /** Props for the error message element, if any. */\n errorMessageProps: DOMAttributes,\n /** Props for the popover dialog. */\n dialogProps: AriaDialogProps,\n /** Props for the range calendar within the popover dialog. */\n calendarProps: RangeCalendarProps<DateValue>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a date picker component.\n * A date range picker combines two DateFields and a RangeCalendar popover to allow\n * users to enter or select a date and time range.\n */\nexport function useDateRangePicker<T extends DateValue>(props: AriaDateRangePickerProps<T>, state: DateRangePickerState, ref: RefObject<Element>): DateRangePickerAria {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/datepicker');\n let {isInvalid, validationErrors, validationDetails} = state.displayValidation;\n let {labelProps, fieldProps, descriptionProps, errorMessageProps} = useField({\n ...props,\n labelElementType: 'span',\n isInvalid,\n errorMessage: props.errorMessage || validationErrors\n });\n\n let labelledBy = fieldProps['aria-labelledby'] || fieldProps.id;\n\n let {locale} = useLocale();\n let range = state.formatValue(locale, {month: 'long'});\n let description = range ? stringFormatter.format('selectedRangeDescription', {startDate: range.start, endDate: range.end}) : '';\n let descProps = useDescription(description);\n\n let startFieldProps = {\n 'aria-label': stringFormatter.format('startDate'),\n 'aria-labelledby': labelledBy\n };\n\n let endFieldProps = {\n 'aria-label': stringFormatter.format('endDate'),\n 'aria-labelledby': labelledBy\n };\n\n let buttonId = useId();\n let dialogId = useId();\n\n let groupProps = useDatePickerGroup(state, ref);\n\n let ariaDescribedBy = [descProps['aria-describedby'], fieldProps['aria-describedby']].filter(Boolean).join(' ') || undefined;\n let focusManager = useMemo(() => createFocusManager(ref, {\n // Exclude the button from the focus manager.\n accept: element => element.id !== buttonId\n }), [ref, buttonId]);\n\n let commonFieldProps = {\n [focusManagerSymbol]: focusManager,\n [roleSymbol]: 'presentation',\n 'aria-describedby': ariaDescribedBy,\n placeholderValue: props.placeholderValue,\n hideTimeZone: props.hideTimeZone,\n hourCycle: props.hourCycle,\n granularity: props.granularity,\n shouldForceLeadingZeros: props.shouldForceLeadingZeros,\n isDisabled: props.isDisabled,\n isReadOnly: props.isReadOnly,\n isRequired: props.isRequired,\n validationBehavior: props.validationBehavior\n };\n\n let domProps = filterDOMProps(props);\n\n let {focusWithinProps} = useFocusWithin({\n ...props,\n isDisabled: state.isOpen,\n onBlurWithin: props.onBlur,\n onFocusWithin: props.onFocus,\n onFocusWithinChange: props.onFocusChange\n });\n\n let startFieldValidation = useRef(DEFAULT_VALIDATION_RESULT);\n let endFieldValidation = useRef(DEFAULT_VALIDATION_RESULT);\n\n return {\n groupProps: mergeProps(domProps, groupProps, fieldProps, descProps, focusWithinProps, {\n role: 'group' as const,\n 'aria-disabled': props.isDisabled || null,\n 'aria-describedby': ariaDescribedBy,\n onKeyDown(e: KeyboardEvent) {\n if (state.isOpen) {\n return;\n }\n\n if (props.onKeyDown) {\n props.onKeyDown(e);\n }\n },\n onKeyUp(e: KeyboardEvent) {\n if (state.isOpen) {\n return;\n }\n\n if (props.onKeyUp) {\n props.onKeyUp(e);\n }\n }\n }),\n labelProps: {\n ...labelProps,\n onClick: () => {\n focusManager.focusFirst();\n }\n },\n buttonProps: {\n ...descProps,\n id: buttonId,\n 'aria-haspopup': 'dialog',\n 'aria-label': stringFormatter.format('calendar'),\n 'aria-labelledby': `${buttonId} ${labelledBy}`,\n 'aria-describedby': ariaDescribedBy,\n 'aria-expanded': state.isOpen,\n isDisabled: props.isDisabled || props.isReadOnly,\n onPress: () => state.setOpen(true)\n },\n dialogProps: {\n id: dialogId,\n 'aria-labelledby': `${buttonId} ${labelledBy}`\n },\n startFieldProps: {\n ...startFieldProps,\n ...commonFieldProps,\n value: state.value?.start,\n onChange: start => state.setDateTime('start', start),\n autoFocus: props.autoFocus,\n name: props.startName,\n [privateValidationStateProp]: {\n realtimeValidation: state.realtimeValidation,\n displayValidation: state.displayValidation,\n updateValidation(e) {\n startFieldValidation.current = e;\n state.updateValidation(mergeValidation(e, endFieldValidation.current));\n },\n resetValidation: state.resetValidation,\n commitValidation: state.commitValidation\n }\n },\n endFieldProps: {\n ...endFieldProps,\n ...commonFieldProps,\n value: state.value?.end,\n onChange: end => state.setDateTime('end', end),\n name: props.endName,\n [privateValidationStateProp]: {\n realtimeValidation: state.realtimeValidation,\n displayValidation: state.displayValidation,\n updateValidation(e) {\n endFieldValidation.current = e;\n state.updateValidation(mergeValidation(startFieldValidation.current, e));\n },\n resetValidation: state.resetValidation,\n commitValidation: state.commitValidation\n }\n },\n descriptionProps,\n errorMessageProps,\n calendarProps: {\n autoFocus: true,\n value: state.dateRange,\n onChange: state.setDateRange,\n minValue: props.minValue,\n maxValue: props.maxValue,\n isDisabled: props.isDisabled,\n isReadOnly: props.isReadOnly,\n isDateUnavailable: props.isDateUnavailable,\n allowsNonContiguousRanges: props.allowsNonContiguousRanges,\n defaultFocusedValue: state.dateRange ? undefined : props.placeholderValue,\n isInvalid: state.isInvalid,\n errorMessage: typeof props.errorMessage === 'function' ? props.errorMessage(state.displayValidation) : (props.errorMessage || state.displayValidation.validationErrors.join(' '))\n },\n isInvalid,\n validationErrors,\n validationDetails\n };\n}\n"],"names":[],"version":3,"file":"useDateRangePicker.module.js.map"}