@react-aria/datepicker 3.9.3 → 3.10.1

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 (43) hide show
  1. package/dist/import.mjs +5 -1047
  2. package/dist/intlStrings.main.js +108 -0
  3. package/dist/intlStrings.main.js.map +1 -0
  4. package/dist/intlStrings.mjs +110 -0
  5. package/dist/intlStrings.module.js +110 -0
  6. package/dist/intlStrings.module.js.map +1 -0
  7. package/dist/main.js +11 -1053
  8. package/dist/main.js.map +1 -1
  9. package/dist/module.js +5 -1047
  10. package/dist/module.js.map +1 -1
  11. package/dist/types.d.ts.map +1 -1
  12. package/dist/useDateField.main.js +176 -0
  13. package/dist/useDateField.main.js.map +1 -0
  14. package/dist/useDateField.mjs +167 -0
  15. package/dist/useDateField.module.js +167 -0
  16. package/dist/useDateField.module.js.map +1 -0
  17. package/dist/useDatePicker.main.js +158 -0
  18. package/dist/useDatePicker.main.js.map +1 -0
  19. package/dist/useDatePicker.mjs +153 -0
  20. package/dist/useDatePicker.module.js +153 -0
  21. package/dist/useDatePicker.module.js.map +1 -0
  22. package/dist/useDatePickerGroup.main.js +91 -0
  23. package/dist/useDatePickerGroup.main.js.map +1 -0
  24. package/dist/useDatePickerGroup.mjs +86 -0
  25. package/dist/useDatePickerGroup.module.js +86 -0
  26. package/dist/useDatePickerGroup.module.js.map +1 -0
  27. package/dist/useDateRangePicker.main.js +201 -0
  28. package/dist/useDateRangePicker.main.js.map +1 -0
  29. package/dist/useDateRangePicker.mjs +196 -0
  30. package/dist/useDateRangePicker.module.js +196 -0
  31. package/dist/useDateRangePicker.module.js.map +1 -0
  32. package/dist/useDateSegment.main.js +366 -0
  33. package/dist/useDateSegment.main.js.map +1 -0
  34. package/dist/useDateSegment.mjs +357 -0
  35. package/dist/useDateSegment.module.js +357 -0
  36. package/dist/useDateSegment.module.js.map +1 -0
  37. package/dist/useDisplayNames.main.js +59 -0
  38. package/dist/useDisplayNames.main.js.map +1 -0
  39. package/dist/useDisplayNames.mjs +54 -0
  40. package/dist/useDisplayNames.module.js +54 -0
  41. package/dist/useDisplayNames.module.js.map +1 -0
  42. package/package.json +19 -19
  43. package/src/useDateSegment.ts +4 -0
@@ -0,0 +1,153 @@
1
+ import $4lVjK$intlStringsmodulejs from "./intlStrings.module.js";
2
+ import {roleSymbol as $16f0b7bb276bc17e$export$300019f83c56d282} from "./useDateField.module.js";
3
+ import {useDatePickerGroup as $3dfb0f96be0d6a08$export$4a931266a3838b86} from "./useDatePickerGroup.module.js";
4
+ import {createFocusManager as $4lVjK$createFocusManager} from "@react-aria/focus";
5
+ import {useId as $4lVjK$useId, useDescription as $4lVjK$useDescription, filterDOMProps as $4lVjK$filterDOMProps, mergeProps as $4lVjK$mergeProps} from "@react-aria/utils";
6
+ import {privateValidationStateProp as $4lVjK$privateValidationStateProp} from "@react-stately/form";
7
+ import {useMemo as $4lVjK$useMemo} from "react";
8
+ import {useField as $4lVjK$useField} from "@react-aria/label";
9
+ import {useFocusWithin as $4lVjK$useFocusWithin} from "@react-aria/interactions";
10
+ import {useLocalizedStringFormatter as $4lVjK$useLocalizedStringFormatter, useLocale as $4lVjK$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 $6057a3d2a53a12fd$export$42df105a73306d51(props, state, ref) {
37
+ let buttonId = (0, $4lVjK$useId)();
38
+ let dialogId = (0, $4lVjK$useId)();
39
+ let fieldId = (0, $4lVjK$useId)();
40
+ let stringFormatter = (0, $4lVjK$useLocalizedStringFormatter)((0, ($parcel$interopDefault($4lVjK$intlStringsmodulejs))), '@react-aria/datepicker');
41
+ let { isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = state.displayValidation;
42
+ let { labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $4lVjK$useField)({
43
+ ...props,
44
+ labelElementType: 'span',
45
+ isInvalid: isInvalid,
46
+ errorMessage: props.errorMessage || validationErrors
47
+ });
48
+ let groupProps = (0, $3dfb0f96be0d6a08$export$4a931266a3838b86)(state, ref);
49
+ let labelledBy = fieldProps['aria-labelledby'] || fieldProps.id;
50
+ let { locale: locale } = (0, $4lVjK$useLocale)();
51
+ let date = state.formatValue(locale, {
52
+ month: 'long'
53
+ });
54
+ let description = date ? stringFormatter.format('selectedDateDescription', {
55
+ date: date
56
+ }) : '';
57
+ let descProps = (0, $4lVjK$useDescription)(description);
58
+ let ariaDescribedBy = [
59
+ descProps['aria-describedby'],
60
+ fieldProps['aria-describedby']
61
+ ].filter(Boolean).join(' ') || undefined;
62
+ let domProps = (0, $4lVjK$filterDOMProps)(props);
63
+ let focusManager = (0, $4lVjK$useMemo)(()=>(0, $4lVjK$createFocusManager)(ref), [
64
+ ref
65
+ ]);
66
+ let { focusWithinProps: focusWithinProps } = (0, $4lVjK$useFocusWithin)({
67
+ ...props,
68
+ isDisabled: state.isOpen,
69
+ onBlurWithin: props.onBlur,
70
+ onFocusWithin: props.onFocus,
71
+ onFocusWithinChange: props.onFocusChange
72
+ });
73
+ return {
74
+ groupProps: (0, $4lVjK$mergeProps)(domProps, groupProps, fieldProps, descProps, focusWithinProps, {
75
+ role: 'group',
76
+ 'aria-disabled': props.isDisabled || null,
77
+ 'aria-labelledby': labelledBy,
78
+ 'aria-describedby': ariaDescribedBy,
79
+ onKeyDown (e) {
80
+ if (state.isOpen) return;
81
+ if (props.onKeyDown) props.onKeyDown(e);
82
+ },
83
+ onKeyUp (e) {
84
+ if (state.isOpen) return;
85
+ if (props.onKeyUp) props.onKeyUp(e);
86
+ }
87
+ }),
88
+ labelProps: {
89
+ ...labelProps,
90
+ onClick: ()=>{
91
+ focusManager.focusFirst();
92
+ }
93
+ },
94
+ fieldProps: {
95
+ ...fieldProps,
96
+ id: fieldId,
97
+ [(0, $16f0b7bb276bc17e$export$300019f83c56d282)]: 'presentation',
98
+ 'aria-describedby': ariaDescribedBy,
99
+ value: state.value,
100
+ onChange: state.setValue,
101
+ placeholderValue: props.placeholderValue,
102
+ hideTimeZone: props.hideTimeZone,
103
+ hourCycle: props.hourCycle,
104
+ shouldForceLeadingZeros: props.shouldForceLeadingZeros,
105
+ granularity: props.granularity,
106
+ isDisabled: props.isDisabled,
107
+ isReadOnly: props.isReadOnly,
108
+ isRequired: props.isRequired,
109
+ validationBehavior: props.validationBehavior,
110
+ // DatePicker owns the validation state for the date field.
111
+ [(0, $4lVjK$privateValidationStateProp)]: state,
112
+ autoFocus: props.autoFocus,
113
+ name: props.name
114
+ },
115
+ descriptionProps: descriptionProps,
116
+ errorMessageProps: errorMessageProps,
117
+ buttonProps: {
118
+ ...descProps,
119
+ id: buttonId,
120
+ 'aria-haspopup': 'dialog',
121
+ 'aria-label': stringFormatter.format('calendar'),
122
+ 'aria-labelledby': `${buttonId} ${labelledBy}`,
123
+ 'aria-describedby': ariaDescribedBy,
124
+ 'aria-expanded': state.isOpen,
125
+ isDisabled: props.isDisabled || props.isReadOnly,
126
+ onPress: ()=>state.setOpen(true)
127
+ },
128
+ dialogProps: {
129
+ id: dialogId,
130
+ 'aria-labelledby': `${buttonId} ${labelledBy}`
131
+ },
132
+ calendarProps: {
133
+ autoFocus: true,
134
+ value: state.dateValue,
135
+ onChange: state.setDateValue,
136
+ minValue: props.minValue,
137
+ maxValue: props.maxValue,
138
+ isDisabled: props.isDisabled,
139
+ isReadOnly: props.isReadOnly,
140
+ isDateUnavailable: props.isDateUnavailable,
141
+ defaultFocusedValue: state.dateValue ? undefined : props.placeholderValue,
142
+ isInvalid: state.isInvalid,
143
+ errorMessage: typeof props.errorMessage === 'function' ? props.errorMessage(state.displayValidation) : props.errorMessage || state.displayValidation.validationErrors.join(' ')
144
+ },
145
+ isInvalid: isInvalid,
146
+ validationErrors: validationErrors,
147
+ validationDetails: validationDetails
148
+ };
149
+ }
150
+
151
+
152
+ export {$6057a3d2a53a12fd$export$42df105a73306d51 as useDatePicker};
153
+ //# sourceMappingURL=useDatePicker.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":"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","sources":["packages/@react-aria/datepicker/src/useDatePicker.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, DateValue} from '@react-types/datepicker';\nimport {AriaDialogProps} from '@react-types/dialog';\nimport {CalendarProps} from '@react-types/calendar';\nimport {createFocusManager} from '@react-aria/focus';\nimport {DatePickerState} from '@react-stately/datepicker';\nimport {DOMAttributes, GroupDOMAttributes, KeyboardEvent, ValidationResult} from '@react-types/shared';\nimport {filterDOMProps, mergeProps, useDescription, useId} from '@react-aria/utils';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {privateValidationStateProp} from '@react-stately/form';\nimport {RefObject, useMemo} from 'react';\nimport {roleSymbol} from './useDateField';\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 DatePickerAria extends ValidationResult {\n /** Props for the date picker's visible label element, if any. */\n labelProps: DOMAttributes,\n /** Props for the grouping element containing the date field and button. */\n groupProps: GroupDOMAttributes,\n /** Props for the date field. */\n fieldProps: 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 calendar within the popover dialog. */\n calendarProps: CalendarProps<DateValue>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a date picker component.\n * A date picker combines a DateField and a Calendar popover to allow users to enter or select a date and time value.\n */\nexport function useDatePicker<T extends DateValue>(props: AriaDatePickerProps<T>, state: DatePickerState, ref: RefObject<Element>): DatePickerAria {\n let buttonId = useId();\n let dialogId = useId();\n let fieldId = useId();\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/datepicker');\n\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 groupProps = useDatePickerGroup(state, ref);\n\n let labelledBy = fieldProps['aria-labelledby'] || fieldProps.id;\n\n let {locale} = useLocale();\n let date = state.formatValue(locale, {month: 'long'});\n let description = date ? stringFormatter.format('selectedDateDescription', {date}) : '';\n let descProps = useDescription(description);\n let ariaDescribedBy = [descProps['aria-describedby'], fieldProps['aria-describedby']].filter(Boolean).join(' ') || undefined;\n let domProps = filterDOMProps(props);\n let focusManager = useMemo(() => createFocusManager(ref), [ref]);\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 return {\n groupProps: mergeProps(domProps, groupProps, fieldProps, descProps, focusWithinProps, {\n role: 'group' as const,\n 'aria-disabled': props.isDisabled || null,\n 'aria-labelledby': labelledBy,\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 fieldProps: {\n ...fieldProps,\n id: fieldId,\n [roleSymbol]: 'presentation',\n 'aria-describedby': ariaDescribedBy,\n value: state.value,\n onChange: state.setValue,\n placeholderValue: props.placeholderValue,\n hideTimeZone: props.hideTimeZone,\n hourCycle: props.hourCycle,\n shouldForceLeadingZeros: props.shouldForceLeadingZeros,\n granularity: props.granularity,\n isDisabled: props.isDisabled,\n isReadOnly: props.isReadOnly,\n isRequired: props.isRequired,\n validationBehavior: props.validationBehavior,\n // DatePicker owns the validation state for the date field.\n [privateValidationStateProp]: state,\n autoFocus: props.autoFocus,\n name: props.name\n },\n descriptionProps,\n errorMessageProps,\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 calendarProps: {\n autoFocus: true,\n value: state.dateValue,\n onChange: state.setDateValue,\n minValue: props.minValue,\n maxValue: props.maxValue,\n isDisabled: props.isDisabled,\n isReadOnly: props.isReadOnly,\n isDateUnavailable: props.isDateUnavailable,\n defaultFocusedValue: state.dateValue ? 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":"useDatePicker.module.js.map"}
@@ -0,0 +1,91 @@
1
+ var $19S5E$reactariafocus = require("@react-aria/focus");
2
+ var $19S5E$reactariautils = require("@react-aria/utils");
3
+ var $19S5E$react = require("react");
4
+ var $19S5E$reactariai18n = require("@react-aria/i18n");
5
+ var $19S5E$reactariainteractions = require("@react-aria/interactions");
6
+
7
+
8
+ function $parcel$export(e, n, v, s) {
9
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
10
+ }
11
+
12
+ $parcel$export(module.exports, "useDatePickerGroup", () => $715562ad3b4cced4$export$4a931266a3838b86);
13
+
14
+
15
+
16
+
17
+
18
+ function $715562ad3b4cced4$export$4a931266a3838b86(state, ref, disableArrowNavigation) {
19
+ let { direction: direction } = (0, $19S5E$reactariai18n.useLocale)();
20
+ let focusManager = (0, $19S5E$react.useMemo)(()=>(0, $19S5E$reactariafocus.createFocusManager)(ref), [
21
+ ref
22
+ ]);
23
+ // Open the popover on alt + arrow down
24
+ let onKeyDown = (e)=>{
25
+ if (!e.currentTarget.contains(e.target)) return;
26
+ if (e.altKey && (e.key === 'ArrowDown' || e.key === 'ArrowUp') && 'setOpen' in state) {
27
+ e.preventDefault();
28
+ e.stopPropagation();
29
+ state.setOpen(true);
30
+ }
31
+ if (disableArrowNavigation) return;
32
+ switch(e.key){
33
+ case 'ArrowLeft':
34
+ e.preventDefault();
35
+ e.stopPropagation();
36
+ if (direction === 'rtl') focusManager.focusNext();
37
+ else focusManager.focusPrevious();
38
+ break;
39
+ case 'ArrowRight':
40
+ e.preventDefault();
41
+ e.stopPropagation();
42
+ if (direction === 'rtl') focusManager.focusPrevious();
43
+ else focusManager.focusNext();
44
+ break;
45
+ }
46
+ };
47
+ // Focus the first placeholder segment from the end on mouse down/touch up in the field.
48
+ let focusLast = ()=>{
49
+ var _window_event;
50
+ // Try to find the segment prior to the element that was clicked on.
51
+ let target = (_window_event = window.event) === null || _window_event === void 0 ? void 0 : _window_event.target;
52
+ let walker = (0, $19S5E$reactariafocus.getFocusableTreeWalker)(ref.current, {
53
+ tabbable: true
54
+ });
55
+ if (target) {
56
+ walker.currentNode = target;
57
+ target = walker.previousNode();
58
+ }
59
+ // If no target found, find the last element from the end.
60
+ if (!target) {
61
+ let last;
62
+ do {
63
+ last = walker.lastChild();
64
+ if (last) target = last;
65
+ }while (last);
66
+ }
67
+ // Now go backwards until we find an element that is not a placeholder.
68
+ while(target === null || target === void 0 ? void 0 : target.hasAttribute('data-placeholder')){
69
+ let prev = walker.previousNode();
70
+ if (prev && prev.hasAttribute('data-placeholder')) target = prev;
71
+ else break;
72
+ }
73
+ if (target) target.focus();
74
+ };
75
+ let { pressProps: pressProps } = (0, $19S5E$reactariainteractions.usePress)({
76
+ preventFocusOnPress: true,
77
+ allowTextSelectionOnPress: true,
78
+ onPressStart (e) {
79
+ if (e.pointerType === 'mouse') focusLast();
80
+ },
81
+ onPress (e) {
82
+ if (e.pointerType !== 'mouse') focusLast();
83
+ }
84
+ });
85
+ return (0, $19S5E$reactariautils.mergeProps)(pressProps, {
86
+ onKeyDown: onKeyDown
87
+ });
88
+ }
89
+
90
+
91
+ //# sourceMappingURL=useDatePickerGroup.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;;;AAQO,SAAS,0CAAmB,KAA8D,EAAE,GAAuB,EAAE,sBAAgC;IAC1J,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,8BAAQ;IAC1B,IAAI,eAAe,CAAA,GAAA,oBAAM,EAAE,IAAM,CAAA,GAAA,wCAAiB,EAAE,MAAM;QAAC;KAAI;IAE/D,uCAAuC;IACvC,IAAI,YAAY,CAAC;QACf,IAAI,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,EAAE,MAAM,GACpC;QAGF,IAAI,EAAE,MAAM,IAAK,CAAA,EAAE,GAAG,KAAK,eAAe,EAAE,GAAG,KAAK,SAAQ,KAAM,aAAa,OAAO;YACpF,EAAE,cAAc;YAChB,EAAE,eAAe;YACjB,MAAM,OAAO,CAAC;QAChB;QAEA,IAAI,wBACF;QAGF,OAAQ,EAAE,GAAG;YACX,KAAK;gBACH,EAAE,cAAc;gBAChB,EAAE,eAAe;gBACjB,IAAI,cAAc,OAChB,aAAa,SAAS;qBAEtB,aAAa,aAAa;gBAE5B;YACF,KAAK;gBACH,EAAE,cAAc;gBAChB,EAAE,eAAe;gBACjB,IAAI,cAAc,OAChB,aAAa,aAAa;qBAE1B,aAAa,SAAS;gBAExB;QACJ;IACF;IAEA,wFAAwF;IACxF,IAAI,YAAY;YAED;QADb,oEAAoE;QACpE,IAAI,UAAS,gBAAA,OAAO,KAAK,cAAZ,oCAAA,cAAc,MAAM;QACjC,IAAI,SAAS,CAAA,GAAA,4CAAqB,EAAE,IAAI,OAAO,EAAE;YAAC,UAAU;QAAI;QAChE,IAAI,QAAQ;YACV,OAAO,WAAW,GAAG;YACrB,SAAS,OAAO,YAAY;QAC9B;QAEA,0DAA0D;QAC1D,IAAI,CAAC,QAAQ;YACX,IAAI;YACJ,GAAG;gBACD,OAAO,OAAO,SAAS;gBACvB,IAAI,MACF,SAAS;YAEb,QAAS,MAAM;QACjB;QAEA,uEAAuE;QACvE,MAAO,mBAAA,6BAAA,OAAQ,YAAY,CAAC,oBAAqB;YAC/C,IAAI,OAAO,OAAO,YAAY;YAC9B,IAAI,QAAQ,KAAK,YAAY,CAAC,qBAC5B,SAAS;iBAET;QAEJ;QAEA,IAAI,QACF,OAAO,KAAK;IAEhB;IAEA,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,qCAAO,EAAE;QAC1B,qBAAqB;QACrB,2BAA2B;QAC3B,cAAa,CAAC;YACZ,IAAI,EAAE,WAAW,KAAK,SACpB;QAEJ;QACA,SAAQ,CAAC;YACP,IAAI,EAAE,WAAW,KAAK,SACpB;QAEJ;IACF;IAEA,OAAO,CAAA,GAAA,gCAAS,EAAE,YAAY;mBAAC;IAAS;AAC1C","sources":["packages/@react-aria/datepicker/src/useDatePickerGroup.ts"],"sourcesContent":["import {createFocusManager, getFocusableTreeWalker} from '@react-aria/focus';\nimport {DateFieldState, DatePickerState, DateRangePickerState} from '@react-stately/datepicker';\nimport {FocusableElement, KeyboardEvent} from '@react-types/shared';\nimport {mergeProps} from '@react-aria/utils';\nimport {RefObject, useMemo} from 'react';\nimport {useLocale} from '@react-aria/i18n';\nimport {usePress} from '@react-aria/interactions';\n\nexport function useDatePickerGroup(state: DatePickerState | DateRangePickerState | DateFieldState, ref: RefObject<Element>, disableArrowNavigation?: boolean) {\n let {direction} = useLocale();\n let focusManager = useMemo(() => createFocusManager(ref), [ref]);\n\n // Open the popover on alt + arrow down\n let onKeyDown = (e: KeyboardEvent) => {\n if (!e.currentTarget.contains(e.target)) {\n return;\n }\n \n if (e.altKey && (e.key === 'ArrowDown' || e.key === 'ArrowUp') && 'setOpen' in state) {\n e.preventDefault();\n e.stopPropagation();\n state.setOpen(true);\n }\n\n if (disableArrowNavigation) {\n return;\n }\n\n switch (e.key) {\n case 'ArrowLeft':\n e.preventDefault();\n e.stopPropagation();\n if (direction === 'rtl') {\n focusManager.focusNext();\n } else {\n focusManager.focusPrevious();\n }\n break;\n case 'ArrowRight':\n e.preventDefault();\n e.stopPropagation();\n if (direction === 'rtl') {\n focusManager.focusPrevious();\n } else {\n focusManager.focusNext();\n }\n break;\n }\n };\n\n // Focus the first placeholder segment from the end on mouse down/touch up in the field.\n let focusLast = () => {\n // Try to find the segment prior to the element that was clicked on.\n let target = window.event?.target as FocusableElement;\n let walker = getFocusableTreeWalker(ref.current, {tabbable: true});\n if (target) {\n walker.currentNode = target;\n target = walker.previousNode() as FocusableElement;\n }\n\n // If no target found, find the last element from the end.\n if (!target) {\n let last: FocusableElement;\n do {\n last = walker.lastChild() as FocusableElement;\n if (last) {\n target = last;\n }\n } while (last);\n }\n\n // Now go backwards until we find an element that is not a placeholder.\n while (target?.hasAttribute('data-placeholder')) {\n let prev = walker.previousNode() as FocusableElement;\n if (prev && prev.hasAttribute('data-placeholder')) {\n target = prev;\n } else {\n break;\n }\n }\n\n if (target) {\n target.focus();\n }\n };\n\n let {pressProps} = usePress({\n preventFocusOnPress: true,\n allowTextSelectionOnPress: true,\n onPressStart(e) {\n if (e.pointerType === 'mouse') {\n focusLast();\n }\n },\n onPress(e) {\n if (e.pointerType !== 'mouse') {\n focusLast();\n }\n }\n });\n\n return mergeProps(pressProps, {onKeyDown});\n}\n"],"names":[],"version":3,"file":"useDatePickerGroup.main.js.map"}
@@ -0,0 +1,86 @@
1
+ import {createFocusManager as $7CEvq$createFocusManager, getFocusableTreeWalker as $7CEvq$getFocusableTreeWalker} from "@react-aria/focus";
2
+ import {mergeProps as $7CEvq$mergeProps} from "@react-aria/utils";
3
+ import {useMemo as $7CEvq$useMemo} from "react";
4
+ import {useLocale as $7CEvq$useLocale} from "@react-aria/i18n";
5
+ import {usePress as $7CEvq$usePress} from "@react-aria/interactions";
6
+
7
+
8
+
9
+
10
+
11
+
12
+ function $3dfb0f96be0d6a08$export$4a931266a3838b86(state, ref, disableArrowNavigation) {
13
+ let { direction: direction } = (0, $7CEvq$useLocale)();
14
+ let focusManager = (0, $7CEvq$useMemo)(()=>(0, $7CEvq$createFocusManager)(ref), [
15
+ ref
16
+ ]);
17
+ // Open the popover on alt + arrow down
18
+ let onKeyDown = (e)=>{
19
+ if (!e.currentTarget.contains(e.target)) return;
20
+ if (e.altKey && (e.key === 'ArrowDown' || e.key === 'ArrowUp') && 'setOpen' in state) {
21
+ e.preventDefault();
22
+ e.stopPropagation();
23
+ state.setOpen(true);
24
+ }
25
+ if (disableArrowNavigation) return;
26
+ switch(e.key){
27
+ case 'ArrowLeft':
28
+ e.preventDefault();
29
+ e.stopPropagation();
30
+ if (direction === 'rtl') focusManager.focusNext();
31
+ else focusManager.focusPrevious();
32
+ break;
33
+ case 'ArrowRight':
34
+ e.preventDefault();
35
+ e.stopPropagation();
36
+ if (direction === 'rtl') focusManager.focusPrevious();
37
+ else focusManager.focusNext();
38
+ break;
39
+ }
40
+ };
41
+ // Focus the first placeholder segment from the end on mouse down/touch up in the field.
42
+ let focusLast = ()=>{
43
+ var _window_event;
44
+ // Try to find the segment prior to the element that was clicked on.
45
+ let target = (_window_event = window.event) === null || _window_event === void 0 ? void 0 : _window_event.target;
46
+ let walker = (0, $7CEvq$getFocusableTreeWalker)(ref.current, {
47
+ tabbable: true
48
+ });
49
+ if (target) {
50
+ walker.currentNode = target;
51
+ target = walker.previousNode();
52
+ }
53
+ // If no target found, find the last element from the end.
54
+ if (!target) {
55
+ let last;
56
+ do {
57
+ last = walker.lastChild();
58
+ if (last) target = last;
59
+ }while (last);
60
+ }
61
+ // Now go backwards until we find an element that is not a placeholder.
62
+ while(target === null || target === void 0 ? void 0 : target.hasAttribute('data-placeholder')){
63
+ let prev = walker.previousNode();
64
+ if (prev && prev.hasAttribute('data-placeholder')) target = prev;
65
+ else break;
66
+ }
67
+ if (target) target.focus();
68
+ };
69
+ let { pressProps: pressProps } = (0, $7CEvq$usePress)({
70
+ preventFocusOnPress: true,
71
+ allowTextSelectionOnPress: true,
72
+ onPressStart (e) {
73
+ if (e.pointerType === 'mouse') focusLast();
74
+ },
75
+ onPress (e) {
76
+ if (e.pointerType !== 'mouse') focusLast();
77
+ }
78
+ });
79
+ return (0, $7CEvq$mergeProps)(pressProps, {
80
+ onKeyDown: onKeyDown
81
+ });
82
+ }
83
+
84
+
85
+ export {$3dfb0f96be0d6a08$export$4a931266a3838b86 as useDatePickerGroup};
86
+ //# sourceMappingURL=useDatePickerGroup.module.js.map
@@ -0,0 +1,86 @@
1
+ import {createFocusManager as $7CEvq$createFocusManager, getFocusableTreeWalker as $7CEvq$getFocusableTreeWalker} from "@react-aria/focus";
2
+ import {mergeProps as $7CEvq$mergeProps} from "@react-aria/utils";
3
+ import {useMemo as $7CEvq$useMemo} from "react";
4
+ import {useLocale as $7CEvq$useLocale} from "@react-aria/i18n";
5
+ import {usePress as $7CEvq$usePress} from "@react-aria/interactions";
6
+
7
+
8
+
9
+
10
+
11
+
12
+ function $3dfb0f96be0d6a08$export$4a931266a3838b86(state, ref, disableArrowNavigation) {
13
+ let { direction: direction } = (0, $7CEvq$useLocale)();
14
+ let focusManager = (0, $7CEvq$useMemo)(()=>(0, $7CEvq$createFocusManager)(ref), [
15
+ ref
16
+ ]);
17
+ // Open the popover on alt + arrow down
18
+ let onKeyDown = (e)=>{
19
+ if (!e.currentTarget.contains(e.target)) return;
20
+ if (e.altKey && (e.key === 'ArrowDown' || e.key === 'ArrowUp') && 'setOpen' in state) {
21
+ e.preventDefault();
22
+ e.stopPropagation();
23
+ state.setOpen(true);
24
+ }
25
+ if (disableArrowNavigation) return;
26
+ switch(e.key){
27
+ case 'ArrowLeft':
28
+ e.preventDefault();
29
+ e.stopPropagation();
30
+ if (direction === 'rtl') focusManager.focusNext();
31
+ else focusManager.focusPrevious();
32
+ break;
33
+ case 'ArrowRight':
34
+ e.preventDefault();
35
+ e.stopPropagation();
36
+ if (direction === 'rtl') focusManager.focusPrevious();
37
+ else focusManager.focusNext();
38
+ break;
39
+ }
40
+ };
41
+ // Focus the first placeholder segment from the end on mouse down/touch up in the field.
42
+ let focusLast = ()=>{
43
+ var _window_event;
44
+ // Try to find the segment prior to the element that was clicked on.
45
+ let target = (_window_event = window.event) === null || _window_event === void 0 ? void 0 : _window_event.target;
46
+ let walker = (0, $7CEvq$getFocusableTreeWalker)(ref.current, {
47
+ tabbable: true
48
+ });
49
+ if (target) {
50
+ walker.currentNode = target;
51
+ target = walker.previousNode();
52
+ }
53
+ // If no target found, find the last element from the end.
54
+ if (!target) {
55
+ let last;
56
+ do {
57
+ last = walker.lastChild();
58
+ if (last) target = last;
59
+ }while (last);
60
+ }
61
+ // Now go backwards until we find an element that is not a placeholder.
62
+ while(target === null || target === void 0 ? void 0 : target.hasAttribute('data-placeholder')){
63
+ let prev = walker.previousNode();
64
+ if (prev && prev.hasAttribute('data-placeholder')) target = prev;
65
+ else break;
66
+ }
67
+ if (target) target.focus();
68
+ };
69
+ let { pressProps: pressProps } = (0, $7CEvq$usePress)({
70
+ preventFocusOnPress: true,
71
+ allowTextSelectionOnPress: true,
72
+ onPressStart (e) {
73
+ if (e.pointerType === 'mouse') focusLast();
74
+ },
75
+ onPress (e) {
76
+ if (e.pointerType !== 'mouse') focusLast();
77
+ }
78
+ });
79
+ return (0, $7CEvq$mergeProps)(pressProps, {
80
+ onKeyDown: onKeyDown
81
+ });
82
+ }
83
+
84
+
85
+ export {$3dfb0f96be0d6a08$export$4a931266a3838b86 as useDatePickerGroup};
86
+ //# sourceMappingURL=useDatePickerGroup.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;AAQO,SAAS,0CAAmB,KAA8D,EAAE,GAAuB,EAAE,sBAAgC;IAC1J,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ;IAC1B,IAAI,eAAe,CAAA,GAAA,cAAM,EAAE,IAAM,CAAA,GAAA,yBAAiB,EAAE,MAAM;QAAC;KAAI;IAE/D,uCAAuC;IACvC,IAAI,YAAY,CAAC;QACf,IAAI,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,EAAE,MAAM,GACpC;QAGF,IAAI,EAAE,MAAM,IAAK,CAAA,EAAE,GAAG,KAAK,eAAe,EAAE,GAAG,KAAK,SAAQ,KAAM,aAAa,OAAO;YACpF,EAAE,cAAc;YAChB,EAAE,eAAe;YACjB,MAAM,OAAO,CAAC;QAChB;QAEA,IAAI,wBACF;QAGF,OAAQ,EAAE,GAAG;YACX,KAAK;gBACH,EAAE,cAAc;gBAChB,EAAE,eAAe;gBACjB,IAAI,cAAc,OAChB,aAAa,SAAS;qBAEtB,aAAa,aAAa;gBAE5B;YACF,KAAK;gBACH,EAAE,cAAc;gBAChB,EAAE,eAAe;gBACjB,IAAI,cAAc,OAChB,aAAa,aAAa;qBAE1B,aAAa,SAAS;gBAExB;QACJ;IACF;IAEA,wFAAwF;IACxF,IAAI,YAAY;YAED;QADb,oEAAoE;QACpE,IAAI,UAAS,gBAAA,OAAO,KAAK,cAAZ,oCAAA,cAAc,MAAM;QACjC,IAAI,SAAS,CAAA,GAAA,6BAAqB,EAAE,IAAI,OAAO,EAAE;YAAC,UAAU;QAAI;QAChE,IAAI,QAAQ;YACV,OAAO,WAAW,GAAG;YACrB,SAAS,OAAO,YAAY;QAC9B;QAEA,0DAA0D;QAC1D,IAAI,CAAC,QAAQ;YACX,IAAI;YACJ,GAAG;gBACD,OAAO,OAAO,SAAS;gBACvB,IAAI,MACF,SAAS;YAEb,QAAS,MAAM;QACjB;QAEA,uEAAuE;QACvE,MAAO,mBAAA,6BAAA,OAAQ,YAAY,CAAC,oBAAqB;YAC/C,IAAI,OAAO,OAAO,YAAY;YAC9B,IAAI,QAAQ,KAAK,YAAY,CAAC,qBAC5B,SAAS;iBAET;QAEJ;QAEA,IAAI,QACF,OAAO,KAAK;IAEhB;IAEA,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;QAC1B,qBAAqB;QACrB,2BAA2B;QAC3B,cAAa,CAAC;YACZ,IAAI,EAAE,WAAW,KAAK,SACpB;QAEJ;QACA,SAAQ,CAAC;YACP,IAAI,EAAE,WAAW,KAAK,SACpB;QAEJ;IACF;IAEA,OAAO,CAAA,GAAA,iBAAS,EAAE,YAAY;mBAAC;IAAS;AAC1C","sources":["packages/@react-aria/datepicker/src/useDatePickerGroup.ts"],"sourcesContent":["import {createFocusManager, getFocusableTreeWalker} from '@react-aria/focus';\nimport {DateFieldState, DatePickerState, DateRangePickerState} from '@react-stately/datepicker';\nimport {FocusableElement, KeyboardEvent} from '@react-types/shared';\nimport {mergeProps} from '@react-aria/utils';\nimport {RefObject, useMemo} from 'react';\nimport {useLocale} from '@react-aria/i18n';\nimport {usePress} from '@react-aria/interactions';\n\nexport function useDatePickerGroup(state: DatePickerState | DateRangePickerState | DateFieldState, ref: RefObject<Element>, disableArrowNavigation?: boolean) {\n let {direction} = useLocale();\n let focusManager = useMemo(() => createFocusManager(ref), [ref]);\n\n // Open the popover on alt + arrow down\n let onKeyDown = (e: KeyboardEvent) => {\n if (!e.currentTarget.contains(e.target)) {\n return;\n }\n \n if (e.altKey && (e.key === 'ArrowDown' || e.key === 'ArrowUp') && 'setOpen' in state) {\n e.preventDefault();\n e.stopPropagation();\n state.setOpen(true);\n }\n\n if (disableArrowNavigation) {\n return;\n }\n\n switch (e.key) {\n case 'ArrowLeft':\n e.preventDefault();\n e.stopPropagation();\n if (direction === 'rtl') {\n focusManager.focusNext();\n } else {\n focusManager.focusPrevious();\n }\n break;\n case 'ArrowRight':\n e.preventDefault();\n e.stopPropagation();\n if (direction === 'rtl') {\n focusManager.focusPrevious();\n } else {\n focusManager.focusNext();\n }\n break;\n }\n };\n\n // Focus the first placeholder segment from the end on mouse down/touch up in the field.\n let focusLast = () => {\n // Try to find the segment prior to the element that was clicked on.\n let target = window.event?.target as FocusableElement;\n let walker = getFocusableTreeWalker(ref.current, {tabbable: true});\n if (target) {\n walker.currentNode = target;\n target = walker.previousNode() as FocusableElement;\n }\n\n // If no target found, find the last element from the end.\n if (!target) {\n let last: FocusableElement;\n do {\n last = walker.lastChild() as FocusableElement;\n if (last) {\n target = last;\n }\n } while (last);\n }\n\n // Now go backwards until we find an element that is not a placeholder.\n while (target?.hasAttribute('data-placeholder')) {\n let prev = walker.previousNode() as FocusableElement;\n if (prev && prev.hasAttribute('data-placeholder')) {\n target = prev;\n } else {\n break;\n }\n }\n\n if (target) {\n target.focus();\n }\n };\n\n let {pressProps} = usePress({\n preventFocusOnPress: true,\n allowTextSelectionOnPress: true,\n onPressStart(e) {\n if (e.pointerType === 'mouse') {\n focusLast();\n }\n },\n onPress(e) {\n if (e.pointerType !== 'mouse') {\n focusLast();\n }\n }\n });\n\n return mergeProps(pressProps, {onKeyDown});\n}\n"],"names":[],"version":3,"file":"useDatePickerGroup.module.js.map"}
@@ -0,0 +1,201 @@
1
+ var $4acc2f407c169e55$exports = require("./useDateField.main.js");
2
+ var $c1905b78f6d2f5bf$exports = require("./intlStrings.main.js");
3
+ var $715562ad3b4cced4$exports = require("./useDatePickerGroup.main.js");
4
+ var $Xt1Bd$reactariafocus = require("@react-aria/focus");
5
+ var $Xt1Bd$reactstatelyform = require("@react-stately/form");
6
+ var $Xt1Bd$reactariautils = require("@react-aria/utils");
7
+ var $Xt1Bd$react = require("react");
8
+ var $Xt1Bd$reactarialabel = require("@react-aria/label");
9
+ var $Xt1Bd$reactariainteractions = require("@react-aria/interactions");
10
+ var $Xt1Bd$reactariai18n = require("@react-aria/i18n");
11
+
12
+
13
+ function $parcel$interopDefault(a) {
14
+ return a && a.__esModule ? a.default : a;
15
+ }
16
+
17
+ function $parcel$export(e, n, v, s) {
18
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
19
+ }
20
+
21
+ $parcel$export(module.exports, "useDateRangePicker", () => $20f695b1b69e6b9e$export$12fd5f0e9f4bb192);
22
+ /*
23
+ * Copyright 2020 Adobe. All rights reserved.
24
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
25
+ * you may not use this file except in compliance with the License. You may obtain a copy
26
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
27
+ *
28
+ * Unless required by applicable law or agreed to in writing, software distributed under
29
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
30
+ * OF ANY KIND, either express or implied. See the License for the specific language
31
+ * governing permissions and limitations under the License.
32
+ */
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+ function $20f695b1b69e6b9e$export$12fd5f0e9f4bb192(props, state, ref) {
43
+ var _state_value, _state_value1;
44
+ let stringFormatter = (0, $Xt1Bd$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($c1905b78f6d2f5bf$exports))), '@react-aria/datepicker');
45
+ let { isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = state.displayValidation;
46
+ let { labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $Xt1Bd$reactarialabel.useField)({
47
+ ...props,
48
+ labelElementType: 'span',
49
+ isInvalid: isInvalid,
50
+ errorMessage: props.errorMessage || validationErrors
51
+ });
52
+ let labelledBy = fieldProps['aria-labelledby'] || fieldProps.id;
53
+ let { locale: locale } = (0, $Xt1Bd$reactariai18n.useLocale)();
54
+ let range = state.formatValue(locale, {
55
+ month: 'long'
56
+ });
57
+ let description = range ? stringFormatter.format('selectedRangeDescription', {
58
+ startDate: range.start,
59
+ endDate: range.end
60
+ }) : '';
61
+ let descProps = (0, $Xt1Bd$reactariautils.useDescription)(description);
62
+ let startFieldProps = {
63
+ 'aria-label': stringFormatter.format('startDate'),
64
+ 'aria-labelledby': labelledBy
65
+ };
66
+ let endFieldProps = {
67
+ 'aria-label': stringFormatter.format('endDate'),
68
+ 'aria-labelledby': labelledBy
69
+ };
70
+ let buttonId = (0, $Xt1Bd$reactariautils.useId)();
71
+ let dialogId = (0, $Xt1Bd$reactariautils.useId)();
72
+ let groupProps = (0, $715562ad3b4cced4$exports.useDatePickerGroup)(state, ref);
73
+ let ariaDescribedBy = [
74
+ descProps['aria-describedby'],
75
+ fieldProps['aria-describedby']
76
+ ].filter(Boolean).join(' ') || undefined;
77
+ let focusManager = (0, $Xt1Bd$react.useMemo)(()=>(0, $Xt1Bd$reactariafocus.createFocusManager)(ref, {
78
+ // Exclude the button from the focus manager.
79
+ accept: (element)=>element.id !== buttonId
80
+ }), [
81
+ ref,
82
+ buttonId
83
+ ]);
84
+ let commonFieldProps = {
85
+ [(0, $4acc2f407c169e55$exports.focusManagerSymbol)]: focusManager,
86
+ [(0, $4acc2f407c169e55$exports.roleSymbol)]: 'presentation',
87
+ 'aria-describedby': ariaDescribedBy,
88
+ placeholderValue: props.placeholderValue,
89
+ hideTimeZone: props.hideTimeZone,
90
+ hourCycle: props.hourCycle,
91
+ granularity: props.granularity,
92
+ shouldForceLeadingZeros: props.shouldForceLeadingZeros,
93
+ isDisabled: props.isDisabled,
94
+ isReadOnly: props.isReadOnly,
95
+ isRequired: props.isRequired,
96
+ validationBehavior: props.validationBehavior
97
+ };
98
+ let domProps = (0, $Xt1Bd$reactariautils.filterDOMProps)(props);
99
+ let { focusWithinProps: focusWithinProps } = (0, $Xt1Bd$reactariainteractions.useFocusWithin)({
100
+ ...props,
101
+ isDisabled: state.isOpen,
102
+ onBlurWithin: props.onBlur,
103
+ onFocusWithin: props.onFocus,
104
+ onFocusWithinChange: props.onFocusChange
105
+ });
106
+ let startFieldValidation = (0, $Xt1Bd$react.useRef)((0, $Xt1Bd$reactstatelyform.DEFAULT_VALIDATION_RESULT));
107
+ let endFieldValidation = (0, $Xt1Bd$react.useRef)((0, $Xt1Bd$reactstatelyform.DEFAULT_VALIDATION_RESULT));
108
+ return {
109
+ groupProps: (0, $Xt1Bd$reactariautils.mergeProps)(domProps, groupProps, fieldProps, descProps, focusWithinProps, {
110
+ role: 'group',
111
+ 'aria-disabled': props.isDisabled || null,
112
+ 'aria-describedby': ariaDescribedBy,
113
+ onKeyDown (e) {
114
+ if (state.isOpen) return;
115
+ if (props.onKeyDown) props.onKeyDown(e);
116
+ },
117
+ onKeyUp (e) {
118
+ if (state.isOpen) return;
119
+ if (props.onKeyUp) props.onKeyUp(e);
120
+ }
121
+ }),
122
+ labelProps: {
123
+ ...labelProps,
124
+ onClick: ()=>{
125
+ focusManager.focusFirst();
126
+ }
127
+ },
128
+ buttonProps: {
129
+ ...descProps,
130
+ id: buttonId,
131
+ 'aria-haspopup': 'dialog',
132
+ 'aria-label': stringFormatter.format('calendar'),
133
+ 'aria-labelledby': `${buttonId} ${labelledBy}`,
134
+ 'aria-describedby': ariaDescribedBy,
135
+ 'aria-expanded': state.isOpen,
136
+ isDisabled: props.isDisabled || props.isReadOnly,
137
+ onPress: ()=>state.setOpen(true)
138
+ },
139
+ dialogProps: {
140
+ id: dialogId,
141
+ 'aria-labelledby': `${buttonId} ${labelledBy}`
142
+ },
143
+ startFieldProps: {
144
+ ...startFieldProps,
145
+ ...commonFieldProps,
146
+ value: (_state_value = state.value) === null || _state_value === void 0 ? void 0 : _state_value.start,
147
+ onChange: (start)=>state.setDateTime('start', start),
148
+ autoFocus: props.autoFocus,
149
+ name: props.startName,
150
+ [(0, $Xt1Bd$reactstatelyform.privateValidationStateProp)]: {
151
+ realtimeValidation: state.realtimeValidation,
152
+ displayValidation: state.displayValidation,
153
+ updateValidation (e) {
154
+ startFieldValidation.current = e;
155
+ state.updateValidation((0, $Xt1Bd$reactstatelyform.mergeValidation)(e, endFieldValidation.current));
156
+ },
157
+ resetValidation: state.resetValidation,
158
+ commitValidation: state.commitValidation
159
+ }
160
+ },
161
+ endFieldProps: {
162
+ ...endFieldProps,
163
+ ...commonFieldProps,
164
+ value: (_state_value1 = state.value) === null || _state_value1 === void 0 ? void 0 : _state_value1.end,
165
+ onChange: (end)=>state.setDateTime('end', end),
166
+ name: props.endName,
167
+ [(0, $Xt1Bd$reactstatelyform.privateValidationStateProp)]: {
168
+ realtimeValidation: state.realtimeValidation,
169
+ displayValidation: state.displayValidation,
170
+ updateValidation (e) {
171
+ endFieldValidation.current = e;
172
+ state.updateValidation((0, $Xt1Bd$reactstatelyform.mergeValidation)(startFieldValidation.current, e));
173
+ },
174
+ resetValidation: state.resetValidation,
175
+ commitValidation: state.commitValidation
176
+ }
177
+ },
178
+ descriptionProps: descriptionProps,
179
+ errorMessageProps: errorMessageProps,
180
+ calendarProps: {
181
+ autoFocus: true,
182
+ value: state.dateRange,
183
+ onChange: state.setDateRange,
184
+ minValue: props.minValue,
185
+ maxValue: props.maxValue,
186
+ isDisabled: props.isDisabled,
187
+ isReadOnly: props.isReadOnly,
188
+ isDateUnavailable: props.isDateUnavailable,
189
+ allowsNonContiguousRanges: props.allowsNonContiguousRanges,
190
+ defaultFocusedValue: state.dateRange ? undefined : props.placeholderValue,
191
+ isInvalid: state.isInvalid,
192
+ errorMessage: typeof props.errorMessage === 'function' ? props.errorMessage(state.displayValidation) : props.errorMessage || state.displayValidation.validationErrors.join(' ')
193
+ },
194
+ isInvalid: isInvalid,
195
+ validationErrors: validationErrors,
196
+ validationDetails: validationDetails
197
+ };
198
+ }
199
+
200
+
201
+ //# sourceMappingURL=useDateRangePicker.main.js.map