@react-aria/datepicker 3.10.0 → 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.
- package/dist/ar-AE.mjs +1 -1
- package/dist/bg-BG.mjs +1 -1
- package/dist/cs-CZ.mjs +1 -1
- package/dist/da-DK.mjs +1 -1
- package/dist/de-DE.mjs +1 -1
- package/dist/el-GR.mjs +1 -1
- package/dist/en-US.mjs +1 -1
- package/dist/es-ES.mjs +1 -1
- package/dist/et-EE.mjs +1 -1
- package/dist/fi-FI.mjs +1 -1
- package/dist/fr-FR.mjs +1 -1
- package/dist/he-IL.mjs +1 -1
- package/dist/hr-HR.mjs +1 -1
- package/dist/hu-HU.mjs +1 -1
- package/dist/intlStrings.mjs +1 -1
- package/dist/it-IT.mjs +1 -1
- package/dist/ja-JP.mjs +1 -1
- package/dist/ko-KR.mjs +1 -1
- package/dist/lt-LT.mjs +1 -1
- package/dist/lv-LV.mjs +1 -1
- package/dist/nb-NO.mjs +1 -1
- package/dist/nl-NL.mjs +1 -1
- package/dist/pl-PL.mjs +1 -1
- package/dist/pt-BR.mjs +1 -1
- package/dist/pt-PT.mjs +1 -1
- package/dist/ro-RO.mjs +1 -1
- package/dist/ru-RU.mjs +1 -1
- package/dist/sk-SK.mjs +1 -1
- package/dist/sl-SI.mjs +1 -1
- package/dist/sr-SP.mjs +1 -1
- package/dist/sv-SE.mjs +1 -1
- package/dist/tr-TR.mjs +1 -1
- package/dist/uk-UA.mjs +1 -1
- package/dist/useDateField.main.js +26 -26
- package/dist/useDateField.mjs +27 -27
- package/dist/useDateField.module.js +26 -26
- package/dist/useDatePicker.main.js +22 -22
- package/dist/useDatePicker.mjs +23 -23
- package/dist/useDatePicker.module.js +22 -22
- package/dist/useDatePickerGroup.main.js +9 -9
- package/dist/useDatePickerGroup.mjs +10 -10
- package/dist/useDatePickerGroup.module.js +9 -9
- package/dist/useDateRangePicker.main.js +27 -27
- package/dist/useDateRangePicker.mjs +28 -28
- package/dist/useDateRangePicker.module.js +27 -27
- package/dist/useDateSegment.main.js +72 -72
- package/dist/useDateSegment.mjs +73 -73
- package/dist/useDateSegment.module.js +72 -72
- package/dist/useDisplayNames.main.js +2 -2
- package/dist/useDisplayNames.mjs +3 -3
- package/dist/useDisplayNames.module.js +2 -2
- package/dist/zh-CN.mjs +1 -1
- package/dist/zh-TW.mjs +1 -1
- package/package.json +19 -19
|
@@ -43,28 +43,28 @@ function $e90ae7c26a69c6b1$export$42df105a73306d51(props, state, ref) {
|
|
|
43
43
|
let buttonId = (0, $bxHoL$reactariautils.useId)();
|
|
44
44
|
let dialogId = (0, $bxHoL$reactariautils.useId)();
|
|
45
45
|
let fieldId = (0, $bxHoL$reactariautils.useId)();
|
|
46
|
-
let stringFormatter = (0, $bxHoL$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($c1905b78f6d2f5bf$exports))),
|
|
46
|
+
let stringFormatter = (0, $bxHoL$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($c1905b78f6d2f5bf$exports))), '@react-aria/datepicker');
|
|
47
47
|
let { isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = state.displayValidation;
|
|
48
48
|
let { labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $bxHoL$reactarialabel.useField)({
|
|
49
49
|
...props,
|
|
50
|
-
labelElementType:
|
|
50
|
+
labelElementType: 'span',
|
|
51
51
|
isInvalid: isInvalid,
|
|
52
52
|
errorMessage: props.errorMessage || validationErrors
|
|
53
53
|
});
|
|
54
54
|
let groupProps = (0, $715562ad3b4cced4$exports.useDatePickerGroup)(state, ref);
|
|
55
|
-
let labelledBy = fieldProps[
|
|
55
|
+
let labelledBy = fieldProps['aria-labelledby'] || fieldProps.id;
|
|
56
56
|
let { locale: locale } = (0, $bxHoL$reactariai18n.useLocale)();
|
|
57
57
|
let date = state.formatValue(locale, {
|
|
58
|
-
month:
|
|
58
|
+
month: 'long'
|
|
59
59
|
});
|
|
60
|
-
let description = date ? stringFormatter.format(
|
|
60
|
+
let description = date ? stringFormatter.format('selectedDateDescription', {
|
|
61
61
|
date: date
|
|
62
|
-
}) :
|
|
62
|
+
}) : '';
|
|
63
63
|
let descProps = (0, $bxHoL$reactariautils.useDescription)(description);
|
|
64
64
|
let ariaDescribedBy = [
|
|
65
|
-
descProps[
|
|
66
|
-
fieldProps[
|
|
67
|
-
].filter(Boolean).join(
|
|
65
|
+
descProps['aria-describedby'],
|
|
66
|
+
fieldProps['aria-describedby']
|
|
67
|
+
].filter(Boolean).join(' ') || undefined;
|
|
68
68
|
let domProps = (0, $bxHoL$reactariautils.filterDOMProps)(props);
|
|
69
69
|
let focusManager = (0, $bxHoL$react.useMemo)(()=>(0, $bxHoL$reactariafocus.createFocusManager)(ref), [
|
|
70
70
|
ref
|
|
@@ -78,10 +78,10 @@ function $e90ae7c26a69c6b1$export$42df105a73306d51(props, state, ref) {
|
|
|
78
78
|
});
|
|
79
79
|
return {
|
|
80
80
|
groupProps: (0, $bxHoL$reactariautils.mergeProps)(domProps, groupProps, fieldProps, descProps, focusWithinProps, {
|
|
81
|
-
role:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
role: 'group',
|
|
82
|
+
'aria-disabled': props.isDisabled || null,
|
|
83
|
+
'aria-labelledby': labelledBy,
|
|
84
|
+
'aria-describedby': ariaDescribedBy,
|
|
85
85
|
onKeyDown (e) {
|
|
86
86
|
if (state.isOpen) return;
|
|
87
87
|
if (props.onKeyDown) props.onKeyDown(e);
|
|
@@ -100,8 +100,8 @@ function $e90ae7c26a69c6b1$export$42df105a73306d51(props, state, ref) {
|
|
|
100
100
|
fieldProps: {
|
|
101
101
|
...fieldProps,
|
|
102
102
|
id: fieldId,
|
|
103
|
-
[(0, $4acc2f407c169e55$exports.roleSymbol)]:
|
|
104
|
-
|
|
103
|
+
[(0, $4acc2f407c169e55$exports.roleSymbol)]: 'presentation',
|
|
104
|
+
'aria-describedby': ariaDescribedBy,
|
|
105
105
|
value: state.value,
|
|
106
106
|
onChange: state.setValue,
|
|
107
107
|
placeholderValue: props.placeholderValue,
|
|
@@ -123,17 +123,17 @@ function $e90ae7c26a69c6b1$export$42df105a73306d51(props, state, ref) {
|
|
|
123
123
|
buttonProps: {
|
|
124
124
|
...descProps,
|
|
125
125
|
id: buttonId,
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
126
|
+
'aria-haspopup': 'dialog',
|
|
127
|
+
'aria-label': stringFormatter.format('calendar'),
|
|
128
|
+
'aria-labelledby': `${buttonId} ${labelledBy}`,
|
|
129
|
+
'aria-describedby': ariaDescribedBy,
|
|
130
|
+
'aria-expanded': state.isOpen,
|
|
131
131
|
isDisabled: props.isDisabled || props.isReadOnly,
|
|
132
132
|
onPress: ()=>state.setOpen(true)
|
|
133
133
|
},
|
|
134
134
|
dialogProps: {
|
|
135
135
|
id: dialogId,
|
|
136
|
-
|
|
136
|
+
'aria-labelledby': `${buttonId} ${labelledBy}`
|
|
137
137
|
},
|
|
138
138
|
calendarProps: {
|
|
139
139
|
autoFocus: true,
|
|
@@ -146,7 +146,7 @@ function $e90ae7c26a69c6b1$export$42df105a73306d51(props, state, ref) {
|
|
|
146
146
|
isDateUnavailable: props.isDateUnavailable,
|
|
147
147
|
defaultFocusedValue: state.dateValue ? undefined : props.placeholderValue,
|
|
148
148
|
isInvalid: state.isInvalid,
|
|
149
|
-
errorMessage: typeof props.errorMessage ===
|
|
149
|
+
errorMessage: typeof props.errorMessage === 'function' ? props.errorMessage(state.displayValidation) : props.errorMessage || state.displayValidation.validationErrors.join(' ')
|
|
150
150
|
},
|
|
151
151
|
isInvalid: isInvalid,
|
|
152
152
|
validationErrors: validationErrors,
|
package/dist/useDatePicker.mjs
CHANGED
|
@@ -37,28 +37,28 @@ function $6057a3d2a53a12fd$export$42df105a73306d51(props, state, ref) {
|
|
|
37
37
|
let buttonId = (0, $4lVjK$useId)();
|
|
38
38
|
let dialogId = (0, $4lVjK$useId)();
|
|
39
39
|
let fieldId = (0, $4lVjK$useId)();
|
|
40
|
-
let stringFormatter = (0, $4lVjK$useLocalizedStringFormatter)((0, ($parcel$interopDefault($4lVjK$intlStringsmodulejs))),
|
|
40
|
+
let stringFormatter = (0, $4lVjK$useLocalizedStringFormatter)((0, ($parcel$interopDefault($4lVjK$intlStringsmodulejs))), '@react-aria/datepicker');
|
|
41
41
|
let { isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = state.displayValidation;
|
|
42
42
|
let { labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $4lVjK$useField)({
|
|
43
43
|
...props,
|
|
44
|
-
labelElementType:
|
|
44
|
+
labelElementType: 'span',
|
|
45
45
|
isInvalid: isInvalid,
|
|
46
46
|
errorMessage: props.errorMessage || validationErrors
|
|
47
47
|
});
|
|
48
48
|
let groupProps = (0, $3dfb0f96be0d6a08$export$4a931266a3838b86)(state, ref);
|
|
49
|
-
let labelledBy = fieldProps[
|
|
49
|
+
let labelledBy = fieldProps['aria-labelledby'] || fieldProps.id;
|
|
50
50
|
let { locale: locale } = (0, $4lVjK$useLocale)();
|
|
51
51
|
let date = state.formatValue(locale, {
|
|
52
|
-
month:
|
|
52
|
+
month: 'long'
|
|
53
53
|
});
|
|
54
|
-
let description = date ? stringFormatter.format(
|
|
54
|
+
let description = date ? stringFormatter.format('selectedDateDescription', {
|
|
55
55
|
date: date
|
|
56
|
-
}) :
|
|
56
|
+
}) : '';
|
|
57
57
|
let descProps = (0, $4lVjK$useDescription)(description);
|
|
58
58
|
let ariaDescribedBy = [
|
|
59
|
-
descProps[
|
|
60
|
-
fieldProps[
|
|
61
|
-
].filter(Boolean).join(
|
|
59
|
+
descProps['aria-describedby'],
|
|
60
|
+
fieldProps['aria-describedby']
|
|
61
|
+
].filter(Boolean).join(' ') || undefined;
|
|
62
62
|
let domProps = (0, $4lVjK$filterDOMProps)(props);
|
|
63
63
|
let focusManager = (0, $4lVjK$useMemo)(()=>(0, $4lVjK$createFocusManager)(ref), [
|
|
64
64
|
ref
|
|
@@ -72,10 +72,10 @@ function $6057a3d2a53a12fd$export$42df105a73306d51(props, state, ref) {
|
|
|
72
72
|
});
|
|
73
73
|
return {
|
|
74
74
|
groupProps: (0, $4lVjK$mergeProps)(domProps, groupProps, fieldProps, descProps, focusWithinProps, {
|
|
75
|
-
role:
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
role: 'group',
|
|
76
|
+
'aria-disabled': props.isDisabled || null,
|
|
77
|
+
'aria-labelledby': labelledBy,
|
|
78
|
+
'aria-describedby': ariaDescribedBy,
|
|
79
79
|
onKeyDown (e) {
|
|
80
80
|
if (state.isOpen) return;
|
|
81
81
|
if (props.onKeyDown) props.onKeyDown(e);
|
|
@@ -94,8 +94,8 @@ function $6057a3d2a53a12fd$export$42df105a73306d51(props, state, ref) {
|
|
|
94
94
|
fieldProps: {
|
|
95
95
|
...fieldProps,
|
|
96
96
|
id: fieldId,
|
|
97
|
-
[(0, $16f0b7bb276bc17e$export$300019f83c56d282)]:
|
|
98
|
-
|
|
97
|
+
[(0, $16f0b7bb276bc17e$export$300019f83c56d282)]: 'presentation',
|
|
98
|
+
'aria-describedby': ariaDescribedBy,
|
|
99
99
|
value: state.value,
|
|
100
100
|
onChange: state.setValue,
|
|
101
101
|
placeholderValue: props.placeholderValue,
|
|
@@ -117,17 +117,17 @@ function $6057a3d2a53a12fd$export$42df105a73306d51(props, state, ref) {
|
|
|
117
117
|
buttonProps: {
|
|
118
118
|
...descProps,
|
|
119
119
|
id: buttonId,
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
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
125
|
isDisabled: props.isDisabled || props.isReadOnly,
|
|
126
126
|
onPress: ()=>state.setOpen(true)
|
|
127
127
|
},
|
|
128
128
|
dialogProps: {
|
|
129
129
|
id: dialogId,
|
|
130
|
-
|
|
130
|
+
'aria-labelledby': `${buttonId} ${labelledBy}`
|
|
131
131
|
},
|
|
132
132
|
calendarProps: {
|
|
133
133
|
autoFocus: true,
|
|
@@ -140,7 +140,7 @@ function $6057a3d2a53a12fd$export$42df105a73306d51(props, state, ref) {
|
|
|
140
140
|
isDateUnavailable: props.isDateUnavailable,
|
|
141
141
|
defaultFocusedValue: state.dateValue ? undefined : props.placeholderValue,
|
|
142
142
|
isInvalid: state.isInvalid,
|
|
143
|
-
errorMessage: typeof props.errorMessage ===
|
|
143
|
+
errorMessage: typeof props.errorMessage === 'function' ? props.errorMessage(state.displayValidation) : props.errorMessage || state.displayValidation.validationErrors.join(' ')
|
|
144
144
|
},
|
|
145
145
|
isInvalid: isInvalid,
|
|
146
146
|
validationErrors: validationErrors,
|
|
@@ -150,4 +150,4 @@ function $6057a3d2a53a12fd$export$42df105a73306d51(props, state, ref) {
|
|
|
150
150
|
|
|
151
151
|
|
|
152
152
|
export {$6057a3d2a53a12fd$export$42df105a73306d51 as useDatePicker};
|
|
153
|
-
//# sourceMappingURL=useDatePicker.
|
|
153
|
+
//# sourceMappingURL=useDatePicker.module.js.map
|
|
@@ -37,28 +37,28 @@ function $6057a3d2a53a12fd$export$42df105a73306d51(props, state, ref) {
|
|
|
37
37
|
let buttonId = (0, $4lVjK$useId)();
|
|
38
38
|
let dialogId = (0, $4lVjK$useId)();
|
|
39
39
|
let fieldId = (0, $4lVjK$useId)();
|
|
40
|
-
let stringFormatter = (0, $4lVjK$useLocalizedStringFormatter)((0, ($parcel$interopDefault($4lVjK$intlStringsmodulejs))),
|
|
40
|
+
let stringFormatter = (0, $4lVjK$useLocalizedStringFormatter)((0, ($parcel$interopDefault($4lVjK$intlStringsmodulejs))), '@react-aria/datepicker');
|
|
41
41
|
let { isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = state.displayValidation;
|
|
42
42
|
let { labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $4lVjK$useField)({
|
|
43
43
|
...props,
|
|
44
|
-
labelElementType:
|
|
44
|
+
labelElementType: 'span',
|
|
45
45
|
isInvalid: isInvalid,
|
|
46
46
|
errorMessage: props.errorMessage || validationErrors
|
|
47
47
|
});
|
|
48
48
|
let groupProps = (0, $3dfb0f96be0d6a08$export$4a931266a3838b86)(state, ref);
|
|
49
|
-
let labelledBy = fieldProps[
|
|
49
|
+
let labelledBy = fieldProps['aria-labelledby'] || fieldProps.id;
|
|
50
50
|
let { locale: locale } = (0, $4lVjK$useLocale)();
|
|
51
51
|
let date = state.formatValue(locale, {
|
|
52
|
-
month:
|
|
52
|
+
month: 'long'
|
|
53
53
|
});
|
|
54
|
-
let description = date ? stringFormatter.format(
|
|
54
|
+
let description = date ? stringFormatter.format('selectedDateDescription', {
|
|
55
55
|
date: date
|
|
56
|
-
}) :
|
|
56
|
+
}) : '';
|
|
57
57
|
let descProps = (0, $4lVjK$useDescription)(description);
|
|
58
58
|
let ariaDescribedBy = [
|
|
59
|
-
descProps[
|
|
60
|
-
fieldProps[
|
|
61
|
-
].filter(Boolean).join(
|
|
59
|
+
descProps['aria-describedby'],
|
|
60
|
+
fieldProps['aria-describedby']
|
|
61
|
+
].filter(Boolean).join(' ') || undefined;
|
|
62
62
|
let domProps = (0, $4lVjK$filterDOMProps)(props);
|
|
63
63
|
let focusManager = (0, $4lVjK$useMemo)(()=>(0, $4lVjK$createFocusManager)(ref), [
|
|
64
64
|
ref
|
|
@@ -72,10 +72,10 @@ function $6057a3d2a53a12fd$export$42df105a73306d51(props, state, ref) {
|
|
|
72
72
|
});
|
|
73
73
|
return {
|
|
74
74
|
groupProps: (0, $4lVjK$mergeProps)(domProps, groupProps, fieldProps, descProps, focusWithinProps, {
|
|
75
|
-
role:
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
role: 'group',
|
|
76
|
+
'aria-disabled': props.isDisabled || null,
|
|
77
|
+
'aria-labelledby': labelledBy,
|
|
78
|
+
'aria-describedby': ariaDescribedBy,
|
|
79
79
|
onKeyDown (e) {
|
|
80
80
|
if (state.isOpen) return;
|
|
81
81
|
if (props.onKeyDown) props.onKeyDown(e);
|
|
@@ -94,8 +94,8 @@ function $6057a3d2a53a12fd$export$42df105a73306d51(props, state, ref) {
|
|
|
94
94
|
fieldProps: {
|
|
95
95
|
...fieldProps,
|
|
96
96
|
id: fieldId,
|
|
97
|
-
[(0, $16f0b7bb276bc17e$export$300019f83c56d282)]:
|
|
98
|
-
|
|
97
|
+
[(0, $16f0b7bb276bc17e$export$300019f83c56d282)]: 'presentation',
|
|
98
|
+
'aria-describedby': ariaDescribedBy,
|
|
99
99
|
value: state.value,
|
|
100
100
|
onChange: state.setValue,
|
|
101
101
|
placeholderValue: props.placeholderValue,
|
|
@@ -117,17 +117,17 @@ function $6057a3d2a53a12fd$export$42df105a73306d51(props, state, ref) {
|
|
|
117
117
|
buttonProps: {
|
|
118
118
|
...descProps,
|
|
119
119
|
id: buttonId,
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
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
125
|
isDisabled: props.isDisabled || props.isReadOnly,
|
|
126
126
|
onPress: ()=>state.setOpen(true)
|
|
127
127
|
},
|
|
128
128
|
dialogProps: {
|
|
129
129
|
id: dialogId,
|
|
130
|
-
|
|
130
|
+
'aria-labelledby': `${buttonId} ${labelledBy}`
|
|
131
131
|
},
|
|
132
132
|
calendarProps: {
|
|
133
133
|
autoFocus: true,
|
|
@@ -140,7 +140,7 @@ function $6057a3d2a53a12fd$export$42df105a73306d51(props, state, ref) {
|
|
|
140
140
|
isDateUnavailable: props.isDateUnavailable,
|
|
141
141
|
defaultFocusedValue: state.dateValue ? undefined : props.placeholderValue,
|
|
142
142
|
isInvalid: state.isInvalid,
|
|
143
|
-
errorMessage: typeof props.errorMessage ===
|
|
143
|
+
errorMessage: typeof props.errorMessage === 'function' ? props.errorMessage(state.displayValidation) : props.errorMessage || state.displayValidation.validationErrors.join(' ')
|
|
144
144
|
},
|
|
145
145
|
isInvalid: isInvalid,
|
|
146
146
|
validationErrors: validationErrors,
|
|
@@ -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, {
|
|
@@ -83,4 +83,4 @@ function $3dfb0f96be0d6a08$export$4a931266a3838b86(state, ref, disableArrowNavig
|
|
|
83
83
|
|
|
84
84
|
|
|
85
85
|
export {$3dfb0f96be0d6a08$export$4a931266a3838b86 as useDatePickerGroup};
|
|
86
|
-
//# sourceMappingURL=useDatePickerGroup.
|
|
86
|
+
//# sourceMappingURL=useDatePickerGroup.module.js.map
|
|
@@ -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,
|