@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
|
@@ -42,14 +42,14 @@ $parcel$export(module.exports, "useTimeField", () => $4acc2f407c169e55$export$4c
|
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
const $4acc2f407c169e55$export$653eddfc964b0f8a = new WeakMap();
|
|
45
|
-
const $4acc2f407c169e55$export$300019f83c56d282 =
|
|
46
|
-
const $4acc2f407c169e55$export$7b3062cd49e80452 =
|
|
45
|
+
const $4acc2f407c169e55$export$300019f83c56d282 = '__role_' + Date.now();
|
|
46
|
+
const $4acc2f407c169e55$export$7b3062cd49e80452 = '__focusManager_' + Date.now();
|
|
47
47
|
function $4acc2f407c169e55$export$5591b0b878c1a989(props, state, ref) {
|
|
48
48
|
var _state_value;
|
|
49
49
|
let { isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = state.displayValidation;
|
|
50
50
|
let { labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $lVMtq$reactarialabel.useField)({
|
|
51
51
|
...props,
|
|
52
|
-
labelElementType:
|
|
52
|
+
labelElementType: 'span',
|
|
53
53
|
isInvalid: isInvalid,
|
|
54
54
|
errorMessage: props.errorMessage || validationErrors
|
|
55
55
|
});
|
|
@@ -69,34 +69,34 @@ function $4acc2f407c169e55$export$5591b0b878c1a989(props, state, ref) {
|
|
|
69
69
|
},
|
|
70
70
|
onFocusWithinChange: props.onFocusChange
|
|
71
71
|
});
|
|
72
|
-
let stringFormatter = (0, $lVMtq$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($c1905b78f6d2f5bf$exports))),
|
|
73
|
-
let message = state.maxGranularity ===
|
|
74
|
-
let field = state.maxGranularity ===
|
|
72
|
+
let stringFormatter = (0, $lVMtq$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($c1905b78f6d2f5bf$exports))), '@react-aria/datepicker');
|
|
73
|
+
let message = state.maxGranularity === 'hour' ? 'selectedTimeDescription' : 'selectedDateDescription';
|
|
74
|
+
let field = state.maxGranularity === 'hour' ? 'time' : 'date';
|
|
75
75
|
let description = state.value ? stringFormatter.format(message, {
|
|
76
76
|
[field]: state.formatValue({
|
|
77
|
-
month:
|
|
77
|
+
month: 'long'
|
|
78
78
|
})
|
|
79
|
-
}) :
|
|
79
|
+
}) : '';
|
|
80
80
|
let descProps = (0, $lVMtq$reactariautils.useDescription)(description);
|
|
81
81
|
// If within a date picker or date range picker, the date field will have role="presentation" and an aria-describedby
|
|
82
82
|
// will be passed in that references the value (e.g. entire range). Otherwise, add the field's value description.
|
|
83
|
-
let describedBy = props[$4acc2f407c169e55$export$300019f83c56d282] ===
|
|
84
|
-
descProps[
|
|
85
|
-
fieldProps[
|
|
86
|
-
].filter(Boolean).join(
|
|
83
|
+
let describedBy = props[$4acc2f407c169e55$export$300019f83c56d282] === 'presentation' ? fieldProps['aria-describedby'] : [
|
|
84
|
+
descProps['aria-describedby'],
|
|
85
|
+
fieldProps['aria-describedby']
|
|
86
|
+
].filter(Boolean).join(' ') || undefined;
|
|
87
87
|
let propsFocusManager = props[$4acc2f407c169e55$export$7b3062cd49e80452];
|
|
88
88
|
let focusManager = (0, $lVMtq$react.useMemo)(()=>propsFocusManager || (0, $lVMtq$reactariafocus.createFocusManager)(ref), [
|
|
89
89
|
propsFocusManager,
|
|
90
90
|
ref
|
|
91
91
|
]);
|
|
92
|
-
let groupProps = (0, $715562ad3b4cced4$exports.useDatePickerGroup)(state, ref, props[$4acc2f407c169e55$export$300019f83c56d282] ===
|
|
92
|
+
let groupProps = (0, $715562ad3b4cced4$exports.useDatePickerGroup)(state, ref, props[$4acc2f407c169e55$export$300019f83c56d282] === 'presentation');
|
|
93
93
|
// Pass labels and other information to segments.
|
|
94
94
|
$4acc2f407c169e55$export$653eddfc964b0f8a.set(state, {
|
|
95
|
-
ariaLabel: props[
|
|
95
|
+
ariaLabel: props['aria-label'],
|
|
96
96
|
ariaLabelledBy: [
|
|
97
97
|
labelProps.id,
|
|
98
|
-
props[
|
|
99
|
-
].filter(Boolean).join(
|
|
98
|
+
props['aria-labelledby']
|
|
99
|
+
].filter(Boolean).join(' ') || undefined,
|
|
100
100
|
ariaDescribedBy: describedBy,
|
|
101
101
|
focusManager: focusManager
|
|
102
102
|
});
|
|
@@ -106,13 +106,13 @@ function $4acc2f407c169e55$export$5591b0b878c1a989(props, state, ref) {
|
|
|
106
106
|
// with a label and description, and the segments are already labeled by this as well, this
|
|
107
107
|
// avoids very verbose duplicate announcements.
|
|
108
108
|
let fieldDOMProps;
|
|
109
|
-
if (props[$4acc2f407c169e55$export$300019f83c56d282] ===
|
|
110
|
-
role:
|
|
109
|
+
if (props[$4acc2f407c169e55$export$300019f83c56d282] === 'presentation') fieldDOMProps = {
|
|
110
|
+
role: 'presentation'
|
|
111
111
|
};
|
|
112
112
|
else fieldDOMProps = (0, $lVMtq$reactariautils.mergeProps)(fieldProps, {
|
|
113
|
-
role:
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
role: 'group',
|
|
114
|
+
'aria-disabled': props.isDisabled || undefined,
|
|
115
|
+
'aria-describedby': describedBy
|
|
116
116
|
});
|
|
117
117
|
(0, $lVMtq$react.useEffect)(()=>{
|
|
118
118
|
if (autoFocusRef.current) focusManager.focusFirst();
|
|
@@ -128,14 +128,14 @@ function $4acc2f407c169e55$export$5591b0b878c1a989(props, state, ref) {
|
|
|
128
128
|
}
|
|
129
129
|
}, state, props.inputRef);
|
|
130
130
|
let inputProps = {
|
|
131
|
-
type:
|
|
131
|
+
type: 'hidden',
|
|
132
132
|
name: props.name,
|
|
133
|
-
value: ((_state_value = state.value) === null || _state_value === void 0 ? void 0 : _state_value.toString()) ||
|
|
133
|
+
value: ((_state_value = state.value) === null || _state_value === void 0 ? void 0 : _state_value.toString()) || ''
|
|
134
134
|
};
|
|
135
|
-
if (props.validationBehavior ===
|
|
135
|
+
if (props.validationBehavior === 'native') {
|
|
136
136
|
// Use a hidden <input type="text"> rather than <input type="hidden">
|
|
137
137
|
// so that an empty value blocks HTML form submission when the field is required.
|
|
138
|
-
inputProps.type =
|
|
138
|
+
inputProps.type = 'text';
|
|
139
139
|
inputProps.hidden = true;
|
|
140
140
|
inputProps.required = props.isRequired;
|
|
141
141
|
// Ignore react warning.
|
|
@@ -168,7 +168,7 @@ function $4acc2f407c169e55$export$5591b0b878c1a989(props, state, ref) {
|
|
|
168
168
|
function $4acc2f407c169e55$export$4c842f6a241dc825(props, state, ref) {
|
|
169
169
|
var _state_timeValue;
|
|
170
170
|
let res = $4acc2f407c169e55$export$5591b0b878c1a989(props, state, ref);
|
|
171
|
-
res.inputProps.value = ((_state_timeValue = state.timeValue) === null || _state_timeValue === void 0 ? void 0 : _state_timeValue.toString()) ||
|
|
171
|
+
res.inputProps.value = ((_state_timeValue = state.timeValue) === null || _state_timeValue === void 0 ? void 0 : _state_timeValue.toString()) || '';
|
|
172
172
|
return res;
|
|
173
173
|
}
|
|
174
174
|
|
package/dist/useDateField.mjs
CHANGED
|
@@ -32,14 +32,14 @@ function $parcel$interopDefault(a) {
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
const $16f0b7bb276bc17e$export$653eddfc964b0f8a = new WeakMap();
|
|
35
|
-
const $16f0b7bb276bc17e$export$300019f83c56d282 =
|
|
36
|
-
const $16f0b7bb276bc17e$export$7b3062cd49e80452 =
|
|
35
|
+
const $16f0b7bb276bc17e$export$300019f83c56d282 = '__role_' + Date.now();
|
|
36
|
+
const $16f0b7bb276bc17e$export$7b3062cd49e80452 = '__focusManager_' + Date.now();
|
|
37
37
|
function $16f0b7bb276bc17e$export$5591b0b878c1a989(props, state, ref) {
|
|
38
38
|
var _state_value;
|
|
39
39
|
let { isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = state.displayValidation;
|
|
40
40
|
let { labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $7Gzdi$useField)({
|
|
41
41
|
...props,
|
|
42
|
-
labelElementType:
|
|
42
|
+
labelElementType: 'span',
|
|
43
43
|
isInvalid: isInvalid,
|
|
44
44
|
errorMessage: props.errorMessage || validationErrors
|
|
45
45
|
});
|
|
@@ -59,34 +59,34 @@ function $16f0b7bb276bc17e$export$5591b0b878c1a989(props, state, ref) {
|
|
|
59
59
|
},
|
|
60
60
|
onFocusWithinChange: props.onFocusChange
|
|
61
61
|
});
|
|
62
|
-
let stringFormatter = (0, $7Gzdi$useLocalizedStringFormatter)((0, ($parcel$interopDefault($7Gzdi$intlStringsmodulejs))),
|
|
63
|
-
let message = state.maxGranularity ===
|
|
64
|
-
let field = state.maxGranularity ===
|
|
62
|
+
let stringFormatter = (0, $7Gzdi$useLocalizedStringFormatter)((0, ($parcel$interopDefault($7Gzdi$intlStringsmodulejs))), '@react-aria/datepicker');
|
|
63
|
+
let message = state.maxGranularity === 'hour' ? 'selectedTimeDescription' : 'selectedDateDescription';
|
|
64
|
+
let field = state.maxGranularity === 'hour' ? 'time' : 'date';
|
|
65
65
|
let description = state.value ? stringFormatter.format(message, {
|
|
66
66
|
[field]: state.formatValue({
|
|
67
|
-
month:
|
|
67
|
+
month: 'long'
|
|
68
68
|
})
|
|
69
|
-
}) :
|
|
69
|
+
}) : '';
|
|
70
70
|
let descProps = (0, $7Gzdi$useDescription)(description);
|
|
71
71
|
// If within a date picker or date range picker, the date field will have role="presentation" and an aria-describedby
|
|
72
72
|
// will be passed in that references the value (e.g. entire range). Otherwise, add the field's value description.
|
|
73
|
-
let describedBy = props[$16f0b7bb276bc17e$export$300019f83c56d282] ===
|
|
74
|
-
descProps[
|
|
75
|
-
fieldProps[
|
|
76
|
-
].filter(Boolean).join(
|
|
73
|
+
let describedBy = props[$16f0b7bb276bc17e$export$300019f83c56d282] === 'presentation' ? fieldProps['aria-describedby'] : [
|
|
74
|
+
descProps['aria-describedby'],
|
|
75
|
+
fieldProps['aria-describedby']
|
|
76
|
+
].filter(Boolean).join(' ') || undefined;
|
|
77
77
|
let propsFocusManager = props[$16f0b7bb276bc17e$export$7b3062cd49e80452];
|
|
78
78
|
let focusManager = (0, $7Gzdi$useMemo)(()=>propsFocusManager || (0, $7Gzdi$createFocusManager)(ref), [
|
|
79
79
|
propsFocusManager,
|
|
80
80
|
ref
|
|
81
81
|
]);
|
|
82
|
-
let groupProps = (0, $3dfb0f96be0d6a08$export$4a931266a3838b86)(state, ref, props[$16f0b7bb276bc17e$export$300019f83c56d282] ===
|
|
82
|
+
let groupProps = (0, $3dfb0f96be0d6a08$export$4a931266a3838b86)(state, ref, props[$16f0b7bb276bc17e$export$300019f83c56d282] === 'presentation');
|
|
83
83
|
// Pass labels and other information to segments.
|
|
84
84
|
$16f0b7bb276bc17e$export$653eddfc964b0f8a.set(state, {
|
|
85
|
-
ariaLabel: props[
|
|
85
|
+
ariaLabel: props['aria-label'],
|
|
86
86
|
ariaLabelledBy: [
|
|
87
87
|
labelProps.id,
|
|
88
|
-
props[
|
|
89
|
-
].filter(Boolean).join(
|
|
88
|
+
props['aria-labelledby']
|
|
89
|
+
].filter(Boolean).join(' ') || undefined,
|
|
90
90
|
ariaDescribedBy: describedBy,
|
|
91
91
|
focusManager: focusManager
|
|
92
92
|
});
|
|
@@ -96,13 +96,13 @@ function $16f0b7bb276bc17e$export$5591b0b878c1a989(props, state, ref) {
|
|
|
96
96
|
// with a label and description, and the segments are already labeled by this as well, this
|
|
97
97
|
// avoids very verbose duplicate announcements.
|
|
98
98
|
let fieldDOMProps;
|
|
99
|
-
if (props[$16f0b7bb276bc17e$export$300019f83c56d282] ===
|
|
100
|
-
role:
|
|
99
|
+
if (props[$16f0b7bb276bc17e$export$300019f83c56d282] === 'presentation') fieldDOMProps = {
|
|
100
|
+
role: 'presentation'
|
|
101
101
|
};
|
|
102
102
|
else fieldDOMProps = (0, $7Gzdi$mergeProps)(fieldProps, {
|
|
103
|
-
role:
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
role: 'group',
|
|
104
|
+
'aria-disabled': props.isDisabled || undefined,
|
|
105
|
+
'aria-describedby': describedBy
|
|
106
106
|
});
|
|
107
107
|
(0, $7Gzdi$useEffect)(()=>{
|
|
108
108
|
if (autoFocusRef.current) focusManager.focusFirst();
|
|
@@ -118,14 +118,14 @@ function $16f0b7bb276bc17e$export$5591b0b878c1a989(props, state, ref) {
|
|
|
118
118
|
}
|
|
119
119
|
}, state, props.inputRef);
|
|
120
120
|
let inputProps = {
|
|
121
|
-
type:
|
|
121
|
+
type: 'hidden',
|
|
122
122
|
name: props.name,
|
|
123
|
-
value: ((_state_value = state.value) === null || _state_value === void 0 ? void 0 : _state_value.toString()) ||
|
|
123
|
+
value: ((_state_value = state.value) === null || _state_value === void 0 ? void 0 : _state_value.toString()) || ''
|
|
124
124
|
};
|
|
125
|
-
if (props.validationBehavior ===
|
|
125
|
+
if (props.validationBehavior === 'native') {
|
|
126
126
|
// Use a hidden <input type="text"> rather than <input type="hidden">
|
|
127
127
|
// so that an empty value blocks HTML form submission when the field is required.
|
|
128
|
-
inputProps.type =
|
|
128
|
+
inputProps.type = 'text';
|
|
129
129
|
inputProps.hidden = true;
|
|
130
130
|
inputProps.required = props.isRequired;
|
|
131
131
|
// Ignore react warning.
|
|
@@ -158,7 +158,7 @@ function $16f0b7bb276bc17e$export$5591b0b878c1a989(props, state, ref) {
|
|
|
158
158
|
function $16f0b7bb276bc17e$export$4c842f6a241dc825(props, state, ref) {
|
|
159
159
|
var _state_timeValue;
|
|
160
160
|
let res = $16f0b7bb276bc17e$export$5591b0b878c1a989(props, state, ref);
|
|
161
|
-
res.inputProps.value = ((_state_timeValue = state.timeValue) === null || _state_timeValue === void 0 ? void 0 : _state_timeValue.toString()) ||
|
|
161
|
+
res.inputProps.value = ((_state_timeValue = state.timeValue) === null || _state_timeValue === void 0 ? void 0 : _state_timeValue.toString()) || '';
|
|
162
162
|
return res;
|
|
163
163
|
}
|
|
164
164
|
|
|
@@ -32,14 +32,14 @@ function $parcel$interopDefault(a) {
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
const $16f0b7bb276bc17e$export$653eddfc964b0f8a = new WeakMap();
|
|
35
|
-
const $16f0b7bb276bc17e$export$300019f83c56d282 =
|
|
36
|
-
const $16f0b7bb276bc17e$export$7b3062cd49e80452 =
|
|
35
|
+
const $16f0b7bb276bc17e$export$300019f83c56d282 = '__role_' + Date.now();
|
|
36
|
+
const $16f0b7bb276bc17e$export$7b3062cd49e80452 = '__focusManager_' + Date.now();
|
|
37
37
|
function $16f0b7bb276bc17e$export$5591b0b878c1a989(props, state, ref) {
|
|
38
38
|
var _state_value;
|
|
39
39
|
let { isInvalid: isInvalid, validationErrors: validationErrors, validationDetails: validationDetails } = state.displayValidation;
|
|
40
40
|
let { labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $7Gzdi$useField)({
|
|
41
41
|
...props,
|
|
42
|
-
labelElementType:
|
|
42
|
+
labelElementType: 'span',
|
|
43
43
|
isInvalid: isInvalid,
|
|
44
44
|
errorMessage: props.errorMessage || validationErrors
|
|
45
45
|
});
|
|
@@ -59,34 +59,34 @@ function $16f0b7bb276bc17e$export$5591b0b878c1a989(props, state, ref) {
|
|
|
59
59
|
},
|
|
60
60
|
onFocusWithinChange: props.onFocusChange
|
|
61
61
|
});
|
|
62
|
-
let stringFormatter = (0, $7Gzdi$useLocalizedStringFormatter)((0, ($parcel$interopDefault($7Gzdi$intlStringsmodulejs))),
|
|
63
|
-
let message = state.maxGranularity ===
|
|
64
|
-
let field = state.maxGranularity ===
|
|
62
|
+
let stringFormatter = (0, $7Gzdi$useLocalizedStringFormatter)((0, ($parcel$interopDefault($7Gzdi$intlStringsmodulejs))), '@react-aria/datepicker');
|
|
63
|
+
let message = state.maxGranularity === 'hour' ? 'selectedTimeDescription' : 'selectedDateDescription';
|
|
64
|
+
let field = state.maxGranularity === 'hour' ? 'time' : 'date';
|
|
65
65
|
let description = state.value ? stringFormatter.format(message, {
|
|
66
66
|
[field]: state.formatValue({
|
|
67
|
-
month:
|
|
67
|
+
month: 'long'
|
|
68
68
|
})
|
|
69
|
-
}) :
|
|
69
|
+
}) : '';
|
|
70
70
|
let descProps = (0, $7Gzdi$useDescription)(description);
|
|
71
71
|
// If within a date picker or date range picker, the date field will have role="presentation" and an aria-describedby
|
|
72
72
|
// will be passed in that references the value (e.g. entire range). Otherwise, add the field's value description.
|
|
73
|
-
let describedBy = props[$16f0b7bb276bc17e$export$300019f83c56d282] ===
|
|
74
|
-
descProps[
|
|
75
|
-
fieldProps[
|
|
76
|
-
].filter(Boolean).join(
|
|
73
|
+
let describedBy = props[$16f0b7bb276bc17e$export$300019f83c56d282] === 'presentation' ? fieldProps['aria-describedby'] : [
|
|
74
|
+
descProps['aria-describedby'],
|
|
75
|
+
fieldProps['aria-describedby']
|
|
76
|
+
].filter(Boolean).join(' ') || undefined;
|
|
77
77
|
let propsFocusManager = props[$16f0b7bb276bc17e$export$7b3062cd49e80452];
|
|
78
78
|
let focusManager = (0, $7Gzdi$useMemo)(()=>propsFocusManager || (0, $7Gzdi$createFocusManager)(ref), [
|
|
79
79
|
propsFocusManager,
|
|
80
80
|
ref
|
|
81
81
|
]);
|
|
82
|
-
let groupProps = (0, $3dfb0f96be0d6a08$export$4a931266a3838b86)(state, ref, props[$16f0b7bb276bc17e$export$300019f83c56d282] ===
|
|
82
|
+
let groupProps = (0, $3dfb0f96be0d6a08$export$4a931266a3838b86)(state, ref, props[$16f0b7bb276bc17e$export$300019f83c56d282] === 'presentation');
|
|
83
83
|
// Pass labels and other information to segments.
|
|
84
84
|
$16f0b7bb276bc17e$export$653eddfc964b0f8a.set(state, {
|
|
85
|
-
ariaLabel: props[
|
|
85
|
+
ariaLabel: props['aria-label'],
|
|
86
86
|
ariaLabelledBy: [
|
|
87
87
|
labelProps.id,
|
|
88
|
-
props[
|
|
89
|
-
].filter(Boolean).join(
|
|
88
|
+
props['aria-labelledby']
|
|
89
|
+
].filter(Boolean).join(' ') || undefined,
|
|
90
90
|
ariaDescribedBy: describedBy,
|
|
91
91
|
focusManager: focusManager
|
|
92
92
|
});
|
|
@@ -96,13 +96,13 @@ function $16f0b7bb276bc17e$export$5591b0b878c1a989(props, state, ref) {
|
|
|
96
96
|
// with a label and description, and the segments are already labeled by this as well, this
|
|
97
97
|
// avoids very verbose duplicate announcements.
|
|
98
98
|
let fieldDOMProps;
|
|
99
|
-
if (props[$16f0b7bb276bc17e$export$300019f83c56d282] ===
|
|
100
|
-
role:
|
|
99
|
+
if (props[$16f0b7bb276bc17e$export$300019f83c56d282] === 'presentation') fieldDOMProps = {
|
|
100
|
+
role: 'presentation'
|
|
101
101
|
};
|
|
102
102
|
else fieldDOMProps = (0, $7Gzdi$mergeProps)(fieldProps, {
|
|
103
|
-
role:
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
role: 'group',
|
|
104
|
+
'aria-disabled': props.isDisabled || undefined,
|
|
105
|
+
'aria-describedby': describedBy
|
|
106
106
|
});
|
|
107
107
|
(0, $7Gzdi$useEffect)(()=>{
|
|
108
108
|
if (autoFocusRef.current) focusManager.focusFirst();
|
|
@@ -118,14 +118,14 @@ function $16f0b7bb276bc17e$export$5591b0b878c1a989(props, state, ref) {
|
|
|
118
118
|
}
|
|
119
119
|
}, state, props.inputRef);
|
|
120
120
|
let inputProps = {
|
|
121
|
-
type:
|
|
121
|
+
type: 'hidden',
|
|
122
122
|
name: props.name,
|
|
123
|
-
value: ((_state_value = state.value) === null || _state_value === void 0 ? void 0 : _state_value.toString()) ||
|
|
123
|
+
value: ((_state_value = state.value) === null || _state_value === void 0 ? void 0 : _state_value.toString()) || ''
|
|
124
124
|
};
|
|
125
|
-
if (props.validationBehavior ===
|
|
125
|
+
if (props.validationBehavior === 'native') {
|
|
126
126
|
// Use a hidden <input type="text"> rather than <input type="hidden">
|
|
127
127
|
// so that an empty value blocks HTML form submission when the field is required.
|
|
128
|
-
inputProps.type =
|
|
128
|
+
inputProps.type = 'text';
|
|
129
129
|
inputProps.hidden = true;
|
|
130
130
|
inputProps.required = props.isRequired;
|
|
131
131
|
// Ignore react warning.
|
|
@@ -158,7 +158,7 @@ function $16f0b7bb276bc17e$export$5591b0b878c1a989(props, state, ref) {
|
|
|
158
158
|
function $16f0b7bb276bc17e$export$4c842f6a241dc825(props, state, ref) {
|
|
159
159
|
var _state_timeValue;
|
|
160
160
|
let res = $16f0b7bb276bc17e$export$5591b0b878c1a989(props, state, ref);
|
|
161
|
-
res.inputProps.value = ((_state_timeValue = state.timeValue) === null || _state_timeValue === void 0 ? void 0 : _state_timeValue.toString()) ||
|
|
161
|
+
res.inputProps.value = ((_state_timeValue = state.timeValue) === null || _state_timeValue === void 0 ? void 0 : _state_timeValue.toString()) || '';
|
|
162
162
|
return res;
|
|
163
163
|
}
|
|
164
164
|
|
|
@@ -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,
|
|
@@ -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,
|