@react-aria/datepicker 3.0.0-nightly.2912 → 3.0.0-nightly.2917
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.
- package/dist/useDateField.main.js +26 -26
- package/dist/useDateField.mjs +26 -26
- package/dist/useDateField.module.js +26 -26
- package/dist/useDatePicker.main.js +22 -22
- package/dist/useDatePicker.mjs +22 -22
- package/dist/useDatePicker.module.js +22 -22
- package/dist/useDatePickerGroup.main.js +9 -9
- package/dist/useDatePickerGroup.mjs +9 -9
- package/dist/useDatePickerGroup.module.js +9 -9
- package/dist/useDateRangePicker.main.js +27 -27
- package/dist/useDateRangePicker.mjs +27 -27
- package/dist/useDateRangePicker.module.js +27 -27
- package/dist/useDateSegment.main.js +72 -72
- package/dist/useDateSegment.mjs +72 -72
- package/dist/useDateSegment.module.js +72 -72
- package/dist/useDisplayNames.main.js +2 -2
- package/dist/useDisplayNames.mjs +2 -2
- package/dist/useDisplayNames.module.js +2 -2
- package/package.json +19 -19
|
@@ -23,23 +23,23 @@ function $715562ad3b4cced4$export$4a931266a3838b86(state, ref, disableArrowNavig
|
|
|
23
23
|
// Open the popover on alt + arrow down
|
|
24
24
|
let onKeyDown = (e)=>{
|
|
25
25
|
if (!e.currentTarget.contains(e.target)) return;
|
|
26
|
-
if (e.altKey && (e.key ===
|
|
26
|
+
if (e.altKey && (e.key === 'ArrowDown' || e.key === 'ArrowUp') && 'setOpen' in state) {
|
|
27
27
|
e.preventDefault();
|
|
28
28
|
e.stopPropagation();
|
|
29
29
|
state.setOpen(true);
|
|
30
30
|
}
|
|
31
31
|
if (disableArrowNavigation) return;
|
|
32
32
|
switch(e.key){
|
|
33
|
-
case
|
|
33
|
+
case 'ArrowLeft':
|
|
34
34
|
e.preventDefault();
|
|
35
35
|
e.stopPropagation();
|
|
36
|
-
if (direction ===
|
|
36
|
+
if (direction === 'rtl') focusManager.focusNext();
|
|
37
37
|
else focusManager.focusPrevious();
|
|
38
38
|
break;
|
|
39
|
-
case
|
|
39
|
+
case 'ArrowRight':
|
|
40
40
|
e.preventDefault();
|
|
41
41
|
e.stopPropagation();
|
|
42
|
-
if (direction ===
|
|
42
|
+
if (direction === 'rtl') focusManager.focusPrevious();
|
|
43
43
|
else focusManager.focusNext();
|
|
44
44
|
break;
|
|
45
45
|
}
|
|
@@ -65,9 +65,9 @@ function $715562ad3b4cced4$export$4a931266a3838b86(state, ref, disableArrowNavig
|
|
|
65
65
|
}while (last);
|
|
66
66
|
}
|
|
67
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(
|
|
68
|
+
while(target === null || target === void 0 ? void 0 : target.hasAttribute('data-placeholder')){
|
|
69
69
|
let prev = walker.previousNode();
|
|
70
|
-
if (prev && prev.hasAttribute(
|
|
70
|
+
if (prev && prev.hasAttribute('data-placeholder')) target = prev;
|
|
71
71
|
else break;
|
|
72
72
|
}
|
|
73
73
|
if (target) target.focus();
|
|
@@ -76,10 +76,10 @@ function $715562ad3b4cced4$export$4a931266a3838b86(state, ref, disableArrowNavig
|
|
|
76
76
|
preventFocusOnPress: true,
|
|
77
77
|
allowTextSelectionOnPress: true,
|
|
78
78
|
onPressStart (e) {
|
|
79
|
-
if (e.pointerType ===
|
|
79
|
+
if (e.pointerType === 'mouse') focusLast();
|
|
80
80
|
},
|
|
81
81
|
onPress (e) {
|
|
82
|
-
if (e.pointerType !==
|
|
82
|
+
if (e.pointerType !== 'mouse') focusLast();
|
|
83
83
|
}
|
|
84
84
|
});
|
|
85
85
|
return (0, $19S5E$reactariautils.mergeProps)(pressProps, {
|
|
@@ -17,23 +17,23 @@ function $3dfb0f96be0d6a08$export$4a931266a3838b86(state, ref, disableArrowNavig
|
|
|
17
17
|
// Open the popover on alt + arrow down
|
|
18
18
|
let onKeyDown = (e)=>{
|
|
19
19
|
if (!e.currentTarget.contains(e.target)) return;
|
|
20
|
-
if (e.altKey && (e.key ===
|
|
20
|
+
if (e.altKey && (e.key === 'ArrowDown' || e.key === 'ArrowUp') && 'setOpen' in state) {
|
|
21
21
|
e.preventDefault();
|
|
22
22
|
e.stopPropagation();
|
|
23
23
|
state.setOpen(true);
|
|
24
24
|
}
|
|
25
25
|
if (disableArrowNavigation) return;
|
|
26
26
|
switch(e.key){
|
|
27
|
-
case
|
|
27
|
+
case 'ArrowLeft':
|
|
28
28
|
e.preventDefault();
|
|
29
29
|
e.stopPropagation();
|
|
30
|
-
if (direction ===
|
|
30
|
+
if (direction === 'rtl') focusManager.focusNext();
|
|
31
31
|
else focusManager.focusPrevious();
|
|
32
32
|
break;
|
|
33
|
-
case
|
|
33
|
+
case 'ArrowRight':
|
|
34
34
|
e.preventDefault();
|
|
35
35
|
e.stopPropagation();
|
|
36
|
-
if (direction ===
|
|
36
|
+
if (direction === 'rtl') focusManager.focusPrevious();
|
|
37
37
|
else focusManager.focusNext();
|
|
38
38
|
break;
|
|
39
39
|
}
|
|
@@ -59,9 +59,9 @@ function $3dfb0f96be0d6a08$export$4a931266a3838b86(state, ref, disableArrowNavig
|
|
|
59
59
|
}while (last);
|
|
60
60
|
}
|
|
61
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(
|
|
62
|
+
while(target === null || target === void 0 ? void 0 : target.hasAttribute('data-placeholder')){
|
|
63
63
|
let prev = walker.previousNode();
|
|
64
|
-
if (prev && prev.hasAttribute(
|
|
64
|
+
if (prev && prev.hasAttribute('data-placeholder')) target = prev;
|
|
65
65
|
else break;
|
|
66
66
|
}
|
|
67
67
|
if (target) target.focus();
|
|
@@ -70,10 +70,10 @@ function $3dfb0f96be0d6a08$export$4a931266a3838b86(state, ref, disableArrowNavig
|
|
|
70
70
|
preventFocusOnPress: true,
|
|
71
71
|
allowTextSelectionOnPress: true,
|
|
72
72
|
onPressStart (e) {
|
|
73
|
-
if (e.pointerType ===
|
|
73
|
+
if (e.pointerType === 'mouse') focusLast();
|
|
74
74
|
},
|
|
75
75
|
onPress (e) {
|
|
76
|
-
if (e.pointerType !==
|
|
76
|
+
if (e.pointerType !== 'mouse') focusLast();
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
79
|
return (0, $7CEvq$mergeProps)(pressProps, {
|
|
@@ -17,23 +17,23 @@ function $3dfb0f96be0d6a08$export$4a931266a3838b86(state, ref, disableArrowNavig
|
|
|
17
17
|
// Open the popover on alt + arrow down
|
|
18
18
|
let onKeyDown = (e)=>{
|
|
19
19
|
if (!e.currentTarget.contains(e.target)) return;
|
|
20
|
-
if (e.altKey && (e.key ===
|
|
20
|
+
if (e.altKey && (e.key === 'ArrowDown' || e.key === 'ArrowUp') && 'setOpen' in state) {
|
|
21
21
|
e.preventDefault();
|
|
22
22
|
e.stopPropagation();
|
|
23
23
|
state.setOpen(true);
|
|
24
24
|
}
|
|
25
25
|
if (disableArrowNavigation) return;
|
|
26
26
|
switch(e.key){
|
|
27
|
-
case
|
|
27
|
+
case 'ArrowLeft':
|
|
28
28
|
e.preventDefault();
|
|
29
29
|
e.stopPropagation();
|
|
30
|
-
if (direction ===
|
|
30
|
+
if (direction === 'rtl') focusManager.focusNext();
|
|
31
31
|
else focusManager.focusPrevious();
|
|
32
32
|
break;
|
|
33
|
-
case
|
|
33
|
+
case 'ArrowRight':
|
|
34
34
|
e.preventDefault();
|
|
35
35
|
e.stopPropagation();
|
|
36
|
-
if (direction ===
|
|
36
|
+
if (direction === 'rtl') focusManager.focusPrevious();
|
|
37
37
|
else focusManager.focusNext();
|
|
38
38
|
break;
|
|
39
39
|
}
|
|
@@ -59,9 +59,9 @@ function $3dfb0f96be0d6a08$export$4a931266a3838b86(state, ref, disableArrowNavig
|
|
|
59
59
|
}while (last);
|
|
60
60
|
}
|
|
61
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(
|
|
62
|
+
while(target === null || target === void 0 ? void 0 : target.hasAttribute('data-placeholder')){
|
|
63
63
|
let prev = walker.previousNode();
|
|
64
|
-
if (prev && prev.hasAttribute(
|
|
64
|
+
if (prev && prev.hasAttribute('data-placeholder')) target = prev;
|
|
65
65
|
else break;
|
|
66
66
|
}
|
|
67
67
|
if (target) target.focus();
|
|
@@ -70,10 +70,10 @@ function $3dfb0f96be0d6a08$export$4a931266a3838b86(state, ref, disableArrowNavig
|
|
|
70
70
|
preventFocusOnPress: true,
|
|
71
71
|
allowTextSelectionOnPress: true,
|
|
72
72
|
onPressStart (e) {
|
|
73
|
-
if (e.pointerType ===
|
|
73
|
+
if (e.pointerType === 'mouse') focusLast();
|
|
74
74
|
},
|
|
75
75
|
onPress (e) {
|
|
76
|
-
if (e.pointerType !==
|
|
76
|
+
if (e.pointerType !== 'mouse') focusLast();
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
79
|
return (0, $7CEvq$mergeProps)(pressProps, {
|
|
@@ -41,39 +41,39 @@ $parcel$export(module.exports, "useDateRangePicker", () => $20f695b1b69e6b9e$exp
|
|
|
41
41
|
|
|
42
42
|
function $20f695b1b69e6b9e$export$12fd5f0e9f4bb192(props, state, ref) {
|
|
43
43
|
var _state_value, _state_value1;
|
|
44
|
-
let stringFormatter = (0, $Xt1Bd$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($c1905b78f6d2f5bf$exports))),
|
|
44
|
+
let stringFormatter = (0, $Xt1Bd$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($c1905b78f6d2f5bf$exports))), '@react-aria/datepicker');
|
|
45
45
|
let { isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = state.displayValidation;
|
|
46
46
|
let { labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $Xt1Bd$reactarialabel.useField)({
|
|
47
47
|
...props,
|
|
48
|
-
labelElementType:
|
|
48
|
+
labelElementType: 'span',
|
|
49
49
|
isInvalid: isInvalid,
|
|
50
50
|
errorMessage: props.errorMessage || validationErrors
|
|
51
51
|
});
|
|
52
|
-
let labelledBy = fieldProps[
|
|
52
|
+
let labelledBy = fieldProps['aria-labelledby'] || fieldProps.id;
|
|
53
53
|
let { locale: locale } = (0, $Xt1Bd$reactariai18n.useLocale)();
|
|
54
54
|
let range = state.formatValue(locale, {
|
|
55
|
-
month:
|
|
55
|
+
month: 'long'
|
|
56
56
|
});
|
|
57
|
-
let description = range ? stringFormatter.format(
|
|
57
|
+
let description = range ? stringFormatter.format('selectedRangeDescription', {
|
|
58
58
|
startDate: range.start,
|
|
59
59
|
endDate: range.end
|
|
60
|
-
}) :
|
|
60
|
+
}) : '';
|
|
61
61
|
let descProps = (0, $Xt1Bd$reactariautils.useDescription)(description);
|
|
62
62
|
let startFieldProps = {
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
'aria-label': stringFormatter.format('startDate'),
|
|
64
|
+
'aria-labelledby': labelledBy
|
|
65
65
|
};
|
|
66
66
|
let endFieldProps = {
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
'aria-label': stringFormatter.format('endDate'),
|
|
68
|
+
'aria-labelledby': labelledBy
|
|
69
69
|
};
|
|
70
70
|
let buttonId = (0, $Xt1Bd$reactariautils.useId)();
|
|
71
71
|
let dialogId = (0, $Xt1Bd$reactariautils.useId)();
|
|
72
72
|
let groupProps = (0, $715562ad3b4cced4$exports.useDatePickerGroup)(state, ref);
|
|
73
73
|
let ariaDescribedBy = [
|
|
74
|
-
descProps[
|
|
75
|
-
fieldProps[
|
|
76
|
-
].filter(Boolean).join(
|
|
74
|
+
descProps['aria-describedby'],
|
|
75
|
+
fieldProps['aria-describedby']
|
|
76
|
+
].filter(Boolean).join(' ') || undefined;
|
|
77
77
|
let focusManager = (0, $Xt1Bd$react.useMemo)(()=>(0, $Xt1Bd$reactariafocus.createFocusManager)(ref, {
|
|
78
78
|
// Exclude the button from the focus manager.
|
|
79
79
|
accept: (element)=>element.id !== buttonId
|
|
@@ -83,8 +83,8 @@ function $20f695b1b69e6b9e$export$12fd5f0e9f4bb192(props, state, ref) {
|
|
|
83
83
|
]);
|
|
84
84
|
let commonFieldProps = {
|
|
85
85
|
[(0, $4acc2f407c169e55$exports.focusManagerSymbol)]: focusManager,
|
|
86
|
-
[(0, $4acc2f407c169e55$exports.roleSymbol)]:
|
|
87
|
-
|
|
86
|
+
[(0, $4acc2f407c169e55$exports.roleSymbol)]: 'presentation',
|
|
87
|
+
'aria-describedby': ariaDescribedBy,
|
|
88
88
|
placeholderValue: props.placeholderValue,
|
|
89
89
|
hideTimeZone: props.hideTimeZone,
|
|
90
90
|
hourCycle: props.hourCycle,
|
|
@@ -107,9 +107,9 @@ function $20f695b1b69e6b9e$export$12fd5f0e9f4bb192(props, state, ref) {
|
|
|
107
107
|
let endFieldValidation = (0, $Xt1Bd$react.useRef)((0, $Xt1Bd$reactstatelyform.DEFAULT_VALIDATION_RESULT));
|
|
108
108
|
return {
|
|
109
109
|
groupProps: (0, $Xt1Bd$reactariautils.mergeProps)(domProps, groupProps, fieldProps, descProps, focusWithinProps, {
|
|
110
|
-
role:
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
role: 'group',
|
|
111
|
+
'aria-disabled': props.isDisabled || null,
|
|
112
|
+
'aria-describedby': ariaDescribedBy,
|
|
113
113
|
onKeyDown (e) {
|
|
114
114
|
if (state.isOpen) return;
|
|
115
115
|
if (props.onKeyDown) props.onKeyDown(e);
|
|
@@ -128,23 +128,23 @@ function $20f695b1b69e6b9e$export$12fd5f0e9f4bb192(props, state, ref) {
|
|
|
128
128
|
buttonProps: {
|
|
129
129
|
...descProps,
|
|
130
130
|
id: buttonId,
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
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
136
|
isDisabled: props.isDisabled || props.isReadOnly,
|
|
137
137
|
onPress: ()=>state.setOpen(true)
|
|
138
138
|
},
|
|
139
139
|
dialogProps: {
|
|
140
140
|
id: dialogId,
|
|
141
|
-
|
|
141
|
+
'aria-labelledby': `${buttonId} ${labelledBy}`
|
|
142
142
|
},
|
|
143
143
|
startFieldProps: {
|
|
144
144
|
...startFieldProps,
|
|
145
145
|
...commonFieldProps,
|
|
146
146
|
value: (_state_value = state.value) === null || _state_value === void 0 ? void 0 : _state_value.start,
|
|
147
|
-
onChange: (start)=>state.setDateTime(
|
|
147
|
+
onChange: (start)=>state.setDateTime('start', start),
|
|
148
148
|
autoFocus: props.autoFocus,
|
|
149
149
|
name: props.startName,
|
|
150
150
|
[(0, $Xt1Bd$reactstatelyform.privateValidationStateProp)]: {
|
|
@@ -162,7 +162,7 @@ function $20f695b1b69e6b9e$export$12fd5f0e9f4bb192(props, state, ref) {
|
|
|
162
162
|
...endFieldProps,
|
|
163
163
|
...commonFieldProps,
|
|
164
164
|
value: (_state_value1 = state.value) === null || _state_value1 === void 0 ? void 0 : _state_value1.end,
|
|
165
|
-
onChange: (end)=>state.setDateTime(
|
|
165
|
+
onChange: (end)=>state.setDateTime('end', end),
|
|
166
166
|
name: props.endName,
|
|
167
167
|
[(0, $Xt1Bd$reactstatelyform.privateValidationStateProp)]: {
|
|
168
168
|
realtimeValidation: state.realtimeValidation,
|
|
@@ -189,7 +189,7 @@ function $20f695b1b69e6b9e$export$12fd5f0e9f4bb192(props, state, ref) {
|
|
|
189
189
|
allowsNonContiguousRanges: props.allowsNonContiguousRanges,
|
|
190
190
|
defaultFocusedValue: state.dateRange ? undefined : props.placeholderValue,
|
|
191
191
|
isInvalid: state.isInvalid,
|
|
192
|
-
errorMessage: typeof props.errorMessage ===
|
|
192
|
+
errorMessage: typeof props.errorMessage === 'function' ? props.errorMessage(state.displayValidation) : props.errorMessage || state.displayValidation.validationErrors.join(' ')
|
|
193
193
|
},
|
|
194
194
|
isInvalid: isInvalid,
|
|
195
195
|
validationErrors: validationErrors,
|
|
@@ -35,39 +35,39 @@ function $parcel$interopDefault(a) {
|
|
|
35
35
|
|
|
36
36
|
function $887cac91b7cc8801$export$12fd5f0e9f4bb192(props, state, ref) {
|
|
37
37
|
var _state_value, _state_value1;
|
|
38
|
-
let stringFormatter = (0, $eIQ1H$useLocalizedStringFormatter)((0, ($parcel$interopDefault($eIQ1H$intlStringsmodulejs))),
|
|
38
|
+
let stringFormatter = (0, $eIQ1H$useLocalizedStringFormatter)((0, ($parcel$interopDefault($eIQ1H$intlStringsmodulejs))), '@react-aria/datepicker');
|
|
39
39
|
let { isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = state.displayValidation;
|
|
40
40
|
let { labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $eIQ1H$useField)({
|
|
41
41
|
...props,
|
|
42
|
-
labelElementType:
|
|
42
|
+
labelElementType: 'span',
|
|
43
43
|
isInvalid: isInvalid,
|
|
44
44
|
errorMessage: props.errorMessage || validationErrors
|
|
45
45
|
});
|
|
46
|
-
let labelledBy = fieldProps[
|
|
46
|
+
let labelledBy = fieldProps['aria-labelledby'] || fieldProps.id;
|
|
47
47
|
let { locale: locale } = (0, $eIQ1H$useLocale)();
|
|
48
48
|
let range = state.formatValue(locale, {
|
|
49
|
-
month:
|
|
49
|
+
month: 'long'
|
|
50
50
|
});
|
|
51
|
-
let description = range ? stringFormatter.format(
|
|
51
|
+
let description = range ? stringFormatter.format('selectedRangeDescription', {
|
|
52
52
|
startDate: range.start,
|
|
53
53
|
endDate: range.end
|
|
54
|
-
}) :
|
|
54
|
+
}) : '';
|
|
55
55
|
let descProps = (0, $eIQ1H$useDescription)(description);
|
|
56
56
|
let startFieldProps = {
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
'aria-label': stringFormatter.format('startDate'),
|
|
58
|
+
'aria-labelledby': labelledBy
|
|
59
59
|
};
|
|
60
60
|
let endFieldProps = {
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
'aria-label': stringFormatter.format('endDate'),
|
|
62
|
+
'aria-labelledby': labelledBy
|
|
63
63
|
};
|
|
64
64
|
let buttonId = (0, $eIQ1H$useId)();
|
|
65
65
|
let dialogId = (0, $eIQ1H$useId)();
|
|
66
66
|
let groupProps = (0, $3dfb0f96be0d6a08$export$4a931266a3838b86)(state, ref);
|
|
67
67
|
let ariaDescribedBy = [
|
|
68
|
-
descProps[
|
|
69
|
-
fieldProps[
|
|
70
|
-
].filter(Boolean).join(
|
|
68
|
+
descProps['aria-describedby'],
|
|
69
|
+
fieldProps['aria-describedby']
|
|
70
|
+
].filter(Boolean).join(' ') || undefined;
|
|
71
71
|
let focusManager = (0, $eIQ1H$useMemo)(()=>(0, $eIQ1H$createFocusManager)(ref, {
|
|
72
72
|
// Exclude the button from the focus manager.
|
|
73
73
|
accept: (element)=>element.id !== buttonId
|
|
@@ -77,8 +77,8 @@ function $887cac91b7cc8801$export$12fd5f0e9f4bb192(props, state, ref) {
|
|
|
77
77
|
]);
|
|
78
78
|
let commonFieldProps = {
|
|
79
79
|
[(0, $16f0b7bb276bc17e$export$7b3062cd49e80452)]: focusManager,
|
|
80
|
-
[(0, $16f0b7bb276bc17e$export$300019f83c56d282)]:
|
|
81
|
-
|
|
80
|
+
[(0, $16f0b7bb276bc17e$export$300019f83c56d282)]: 'presentation',
|
|
81
|
+
'aria-describedby': ariaDescribedBy,
|
|
82
82
|
placeholderValue: props.placeholderValue,
|
|
83
83
|
hideTimeZone: props.hideTimeZone,
|
|
84
84
|
hourCycle: props.hourCycle,
|
|
@@ -101,9 +101,9 @@ function $887cac91b7cc8801$export$12fd5f0e9f4bb192(props, state, ref) {
|
|
|
101
101
|
let endFieldValidation = (0, $eIQ1H$useRef)((0, $eIQ1H$DEFAULT_VALIDATION_RESULT));
|
|
102
102
|
return {
|
|
103
103
|
groupProps: (0, $eIQ1H$mergeProps)(domProps, groupProps, fieldProps, descProps, focusWithinProps, {
|
|
104
|
-
role:
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
role: 'group',
|
|
105
|
+
'aria-disabled': props.isDisabled || null,
|
|
106
|
+
'aria-describedby': ariaDescribedBy,
|
|
107
107
|
onKeyDown (e) {
|
|
108
108
|
if (state.isOpen) return;
|
|
109
109
|
if (props.onKeyDown) props.onKeyDown(e);
|
|
@@ -122,23 +122,23 @@ function $887cac91b7cc8801$export$12fd5f0e9f4bb192(props, state, ref) {
|
|
|
122
122
|
buttonProps: {
|
|
123
123
|
...descProps,
|
|
124
124
|
id: buttonId,
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
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
130
|
isDisabled: props.isDisabled || props.isReadOnly,
|
|
131
131
|
onPress: ()=>state.setOpen(true)
|
|
132
132
|
},
|
|
133
133
|
dialogProps: {
|
|
134
134
|
id: dialogId,
|
|
135
|
-
|
|
135
|
+
'aria-labelledby': `${buttonId} ${labelledBy}`
|
|
136
136
|
},
|
|
137
137
|
startFieldProps: {
|
|
138
138
|
...startFieldProps,
|
|
139
139
|
...commonFieldProps,
|
|
140
140
|
value: (_state_value = state.value) === null || _state_value === void 0 ? void 0 : _state_value.start,
|
|
141
|
-
onChange: (start)=>state.setDateTime(
|
|
141
|
+
onChange: (start)=>state.setDateTime('start', start),
|
|
142
142
|
autoFocus: props.autoFocus,
|
|
143
143
|
name: props.startName,
|
|
144
144
|
[(0, $eIQ1H$privateValidationStateProp)]: {
|
|
@@ -156,7 +156,7 @@ function $887cac91b7cc8801$export$12fd5f0e9f4bb192(props, state, ref) {
|
|
|
156
156
|
...endFieldProps,
|
|
157
157
|
...commonFieldProps,
|
|
158
158
|
value: (_state_value1 = state.value) === null || _state_value1 === void 0 ? void 0 : _state_value1.end,
|
|
159
|
-
onChange: (end)=>state.setDateTime(
|
|
159
|
+
onChange: (end)=>state.setDateTime('end', end),
|
|
160
160
|
name: props.endName,
|
|
161
161
|
[(0, $eIQ1H$privateValidationStateProp)]: {
|
|
162
162
|
realtimeValidation: state.realtimeValidation,
|
|
@@ -183,7 +183,7 @@ function $887cac91b7cc8801$export$12fd5f0e9f4bb192(props, state, ref) {
|
|
|
183
183
|
allowsNonContiguousRanges: props.allowsNonContiguousRanges,
|
|
184
184
|
defaultFocusedValue: state.dateRange ? undefined : props.placeholderValue,
|
|
185
185
|
isInvalid: state.isInvalid,
|
|
186
|
-
errorMessage: typeof props.errorMessage ===
|
|
186
|
+
errorMessage: typeof props.errorMessage === 'function' ? props.errorMessage(state.displayValidation) : props.errorMessage || state.displayValidation.validationErrors.join(' ')
|
|
187
187
|
},
|
|
188
188
|
isInvalid: isInvalid,
|
|
189
189
|
validationErrors: validationErrors,
|
|
@@ -35,39 +35,39 @@ function $parcel$interopDefault(a) {
|
|
|
35
35
|
|
|
36
36
|
function $887cac91b7cc8801$export$12fd5f0e9f4bb192(props, state, ref) {
|
|
37
37
|
var _state_value, _state_value1;
|
|
38
|
-
let stringFormatter = (0, $eIQ1H$useLocalizedStringFormatter)((0, ($parcel$interopDefault($eIQ1H$intlStringsmodulejs))),
|
|
38
|
+
let stringFormatter = (0, $eIQ1H$useLocalizedStringFormatter)((0, ($parcel$interopDefault($eIQ1H$intlStringsmodulejs))), '@react-aria/datepicker');
|
|
39
39
|
let { isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = state.displayValidation;
|
|
40
40
|
let { labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $eIQ1H$useField)({
|
|
41
41
|
...props,
|
|
42
|
-
labelElementType:
|
|
42
|
+
labelElementType: 'span',
|
|
43
43
|
isInvalid: isInvalid,
|
|
44
44
|
errorMessage: props.errorMessage || validationErrors
|
|
45
45
|
});
|
|
46
|
-
let labelledBy = fieldProps[
|
|
46
|
+
let labelledBy = fieldProps['aria-labelledby'] || fieldProps.id;
|
|
47
47
|
let { locale: locale } = (0, $eIQ1H$useLocale)();
|
|
48
48
|
let range = state.formatValue(locale, {
|
|
49
|
-
month:
|
|
49
|
+
month: 'long'
|
|
50
50
|
});
|
|
51
|
-
let description = range ? stringFormatter.format(
|
|
51
|
+
let description = range ? stringFormatter.format('selectedRangeDescription', {
|
|
52
52
|
startDate: range.start,
|
|
53
53
|
endDate: range.end
|
|
54
|
-
}) :
|
|
54
|
+
}) : '';
|
|
55
55
|
let descProps = (0, $eIQ1H$useDescription)(description);
|
|
56
56
|
let startFieldProps = {
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
'aria-label': stringFormatter.format('startDate'),
|
|
58
|
+
'aria-labelledby': labelledBy
|
|
59
59
|
};
|
|
60
60
|
let endFieldProps = {
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
'aria-label': stringFormatter.format('endDate'),
|
|
62
|
+
'aria-labelledby': labelledBy
|
|
63
63
|
};
|
|
64
64
|
let buttonId = (0, $eIQ1H$useId)();
|
|
65
65
|
let dialogId = (0, $eIQ1H$useId)();
|
|
66
66
|
let groupProps = (0, $3dfb0f96be0d6a08$export$4a931266a3838b86)(state, ref);
|
|
67
67
|
let ariaDescribedBy = [
|
|
68
|
-
descProps[
|
|
69
|
-
fieldProps[
|
|
70
|
-
].filter(Boolean).join(
|
|
68
|
+
descProps['aria-describedby'],
|
|
69
|
+
fieldProps['aria-describedby']
|
|
70
|
+
].filter(Boolean).join(' ') || undefined;
|
|
71
71
|
let focusManager = (0, $eIQ1H$useMemo)(()=>(0, $eIQ1H$createFocusManager)(ref, {
|
|
72
72
|
// Exclude the button from the focus manager.
|
|
73
73
|
accept: (element)=>element.id !== buttonId
|
|
@@ -77,8 +77,8 @@ function $887cac91b7cc8801$export$12fd5f0e9f4bb192(props, state, ref) {
|
|
|
77
77
|
]);
|
|
78
78
|
let commonFieldProps = {
|
|
79
79
|
[(0, $16f0b7bb276bc17e$export$7b3062cd49e80452)]: focusManager,
|
|
80
|
-
[(0, $16f0b7bb276bc17e$export$300019f83c56d282)]:
|
|
81
|
-
|
|
80
|
+
[(0, $16f0b7bb276bc17e$export$300019f83c56d282)]: 'presentation',
|
|
81
|
+
'aria-describedby': ariaDescribedBy,
|
|
82
82
|
placeholderValue: props.placeholderValue,
|
|
83
83
|
hideTimeZone: props.hideTimeZone,
|
|
84
84
|
hourCycle: props.hourCycle,
|
|
@@ -101,9 +101,9 @@ function $887cac91b7cc8801$export$12fd5f0e9f4bb192(props, state, ref) {
|
|
|
101
101
|
let endFieldValidation = (0, $eIQ1H$useRef)((0, $eIQ1H$DEFAULT_VALIDATION_RESULT));
|
|
102
102
|
return {
|
|
103
103
|
groupProps: (0, $eIQ1H$mergeProps)(domProps, groupProps, fieldProps, descProps, focusWithinProps, {
|
|
104
|
-
role:
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
role: 'group',
|
|
105
|
+
'aria-disabled': props.isDisabled || null,
|
|
106
|
+
'aria-describedby': ariaDescribedBy,
|
|
107
107
|
onKeyDown (e) {
|
|
108
108
|
if (state.isOpen) return;
|
|
109
109
|
if (props.onKeyDown) props.onKeyDown(e);
|
|
@@ -122,23 +122,23 @@ function $887cac91b7cc8801$export$12fd5f0e9f4bb192(props, state, ref) {
|
|
|
122
122
|
buttonProps: {
|
|
123
123
|
...descProps,
|
|
124
124
|
id: buttonId,
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
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
130
|
isDisabled: props.isDisabled || props.isReadOnly,
|
|
131
131
|
onPress: ()=>state.setOpen(true)
|
|
132
132
|
},
|
|
133
133
|
dialogProps: {
|
|
134
134
|
id: dialogId,
|
|
135
|
-
|
|
135
|
+
'aria-labelledby': `${buttonId} ${labelledBy}`
|
|
136
136
|
},
|
|
137
137
|
startFieldProps: {
|
|
138
138
|
...startFieldProps,
|
|
139
139
|
...commonFieldProps,
|
|
140
140
|
value: (_state_value = state.value) === null || _state_value === void 0 ? void 0 : _state_value.start,
|
|
141
|
-
onChange: (start)=>state.setDateTime(
|
|
141
|
+
onChange: (start)=>state.setDateTime('start', start),
|
|
142
142
|
autoFocus: props.autoFocus,
|
|
143
143
|
name: props.startName,
|
|
144
144
|
[(0, $eIQ1H$privateValidationStateProp)]: {
|
|
@@ -156,7 +156,7 @@ function $887cac91b7cc8801$export$12fd5f0e9f4bb192(props, state, ref) {
|
|
|
156
156
|
...endFieldProps,
|
|
157
157
|
...commonFieldProps,
|
|
158
158
|
value: (_state_value1 = state.value) === null || _state_value1 === void 0 ? void 0 : _state_value1.end,
|
|
159
|
-
onChange: (end)=>state.setDateTime(
|
|
159
|
+
onChange: (end)=>state.setDateTime('end', end),
|
|
160
160
|
name: props.endName,
|
|
161
161
|
[(0, $eIQ1H$privateValidationStateProp)]: {
|
|
162
162
|
realtimeValidation: state.realtimeValidation,
|
|
@@ -183,7 +183,7 @@ function $887cac91b7cc8801$export$12fd5f0e9f4bb192(props, state, ref) {
|
|
|
183
183
|
allowsNonContiguousRanges: props.allowsNonContiguousRanges,
|
|
184
184
|
defaultFocusedValue: state.dateRange ? undefined : props.placeholderValue,
|
|
185
185
|
isInvalid: state.isInvalid,
|
|
186
|
-
errorMessage: typeof props.errorMessage ===
|
|
186
|
+
errorMessage: typeof props.errorMessage === 'function' ? props.errorMessage(state.displayValidation) : props.errorMessage || state.displayValidation.validationErrors.join(' ')
|
|
187
187
|
},
|
|
188
188
|
isInvalid: isInvalid,
|
|
189
189
|
validationErrors: validationErrors,
|