@react-aria/datepicker 3.6.0 → 3.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/import.mjs +25 -24
- package/dist/main.js +25 -24
- package/dist/main.js.map +1 -1
- package/dist/module.js +25 -24
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +4 -4
- package/dist/types.d.ts.map +1 -1
- package/package.json +16 -16
- package/src/useDateField.ts +4 -4
- package/src/useDatePicker.ts +6 -6
- package/src/useDatePickerGroup.ts +4 -0
- package/src/useDateRangePicker.ts +6 -6
- package/src/useDateSegment.ts +2 -2
package/dist/module.js
CHANGED
|
@@ -808,12 +808,13 @@ $dfb4eba373ed9493$exports = {
|
|
|
808
808
|
|
|
809
809
|
|
|
810
810
|
function $3dfb0f96be0d6a08$export$4a931266a3838b86(state, ref, disableArrowNavigation) {
|
|
811
|
-
let { direction: direction
|
|
811
|
+
let { direction: direction } = (0, $cIPI0$useLocale)();
|
|
812
812
|
let focusManager = (0, $cIPI0$useMemo)(()=>(0, $cIPI0$createFocusManager)(ref), [
|
|
813
813
|
ref
|
|
814
814
|
]);
|
|
815
815
|
// Open the popover on alt + arrow down
|
|
816
816
|
let onKeyDown = (e)=>{
|
|
817
|
+
if (!e.currentTarget.contains(e.target)) return;
|
|
817
818
|
if (e.altKey && (e.key === "ArrowDown" || e.key === "ArrowUp") && "setOpen" in state) {
|
|
818
819
|
e.preventDefault();
|
|
819
820
|
e.stopPropagation();
|
|
@@ -863,7 +864,7 @@ function $3dfb0f96be0d6a08$export$4a931266a3838b86(state, ref, disableArrowNavig
|
|
|
863
864
|
}
|
|
864
865
|
if (target) target.focus();
|
|
865
866
|
};
|
|
866
|
-
let { pressProps: pressProps
|
|
867
|
+
let { pressProps: pressProps } = (0, $cIPI0$usePress)({
|
|
867
868
|
preventFocusOnPress: true,
|
|
868
869
|
allowTextSelectionOnPress: true,
|
|
869
870
|
onPressStart (e) {
|
|
@@ -887,11 +888,11 @@ const $16f0b7bb276bc17e$export$300019f83c56d282 = "__role_" + Date.now();
|
|
|
887
888
|
const $16f0b7bb276bc17e$export$7b3062cd49e80452 = "__focusManager_" + Date.now();
|
|
888
889
|
function $16f0b7bb276bc17e$export$5591b0b878c1a989(props, state, ref) {
|
|
889
890
|
var _state_value;
|
|
890
|
-
let { labelProps: labelProps
|
|
891
|
+
let { labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $cIPI0$useField)({
|
|
891
892
|
...props,
|
|
892
893
|
labelElementType: "span"
|
|
893
894
|
});
|
|
894
|
-
let { focusWithinProps: focusWithinProps
|
|
895
|
+
let { focusWithinProps: focusWithinProps } = (0, $cIPI0$useFocusWithin)({
|
|
895
896
|
...props,
|
|
896
897
|
onBlurWithin: (e)=>{
|
|
897
898
|
state.confirmPlaceholder();
|
|
@@ -994,13 +995,13 @@ function $6057a3d2a53a12fd$export$42df105a73306d51(props, state, ref) {
|
|
|
994
995
|
let dialogId = (0, $cIPI0$useId)();
|
|
995
996
|
let fieldId = (0, $cIPI0$useId)();
|
|
996
997
|
let stringFormatter = (0, $cIPI0$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($dfb4eba373ed9493$exports))));
|
|
997
|
-
let { labelProps: labelProps
|
|
998
|
+
let { labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $cIPI0$useField)({
|
|
998
999
|
...props,
|
|
999
1000
|
labelElementType: "span"
|
|
1000
1001
|
});
|
|
1001
1002
|
let groupProps = (0, $3dfb0f96be0d6a08$export$4a931266a3838b86)(state, ref);
|
|
1002
1003
|
let labelledBy = fieldProps["aria-labelledby"] || fieldProps.id;
|
|
1003
|
-
let { locale: locale
|
|
1004
|
+
let { locale: locale } = (0, $cIPI0$useLocale)();
|
|
1004
1005
|
let date = state.formatValue(locale, {
|
|
1005
1006
|
month: "long"
|
|
1006
1007
|
});
|
|
@@ -1016,7 +1017,7 @@ function $6057a3d2a53a12fd$export$42df105a73306d51(props, state, ref) {
|
|
|
1016
1017
|
let focusManager = (0, $cIPI0$useMemo)(()=>(0, $cIPI0$createFocusManager)(ref), [
|
|
1017
1018
|
ref
|
|
1018
1019
|
]);
|
|
1019
|
-
let { focusWithinProps: focusWithinProps
|
|
1020
|
+
let { focusWithinProps: focusWithinProps } = (0, $cIPI0$useFocusWithin)({
|
|
1020
1021
|
...props,
|
|
1021
1022
|
isDisabled: state.isOpen,
|
|
1022
1023
|
onBlurWithin: props.onBlur,
|
|
@@ -1061,7 +1062,7 @@ function $6057a3d2a53a12fd$export$42df105a73306d51(props, state, ref) {
|
|
|
1061
1062
|
isDisabled: props.isDisabled,
|
|
1062
1063
|
isReadOnly: props.isReadOnly,
|
|
1063
1064
|
isRequired: props.isRequired,
|
|
1064
|
-
|
|
1065
|
+
isInvalid: state.isInvalid,
|
|
1065
1066
|
autoFocus: props.autoFocus,
|
|
1066
1067
|
name: props.name
|
|
1067
1068
|
},
|
|
@@ -1074,7 +1075,7 @@ function $6057a3d2a53a12fd$export$42df105a73306d51(props, state, ref) {
|
|
|
1074
1075
|
"aria-label": stringFormatter.format("calendar"),
|
|
1075
1076
|
"aria-labelledby": `${buttonId} ${labelledBy}`,
|
|
1076
1077
|
"aria-describedby": ariaDescribedBy,
|
|
1077
|
-
"aria-expanded": state.isOpen
|
|
1078
|
+
"aria-expanded": state.isOpen,
|
|
1078
1079
|
onPress: ()=>state.setOpen(true)
|
|
1079
1080
|
},
|
|
1080
1081
|
dialogProps: {
|
|
@@ -1091,7 +1092,7 @@ function $6057a3d2a53a12fd$export$42df105a73306d51(props, state, ref) {
|
|
|
1091
1092
|
isReadOnly: props.isReadOnly,
|
|
1092
1093
|
isDateUnavailable: props.isDateUnavailable,
|
|
1093
1094
|
defaultFocusedValue: state.dateValue ? undefined : props.placeholderValue,
|
|
1094
|
-
|
|
1095
|
+
isInvalid: state.isInvalid,
|
|
1095
1096
|
errorMessage: props.errorMessage
|
|
1096
1097
|
}
|
|
1097
1098
|
};
|
|
@@ -1130,7 +1131,7 @@ function $6057a3d2a53a12fd$export$42df105a73306d51(props, state, ref) {
|
|
|
1130
1131
|
|
|
1131
1132
|
|
|
1132
1133
|
function $3aeceb3a64eb8358$export$d42c60378c8168f8() {
|
|
1133
|
-
let { locale: locale
|
|
1134
|
+
let { locale: locale } = (0, $cIPI0$useLocale)();
|
|
1134
1135
|
return (0, $cIPI0$useMemo)(()=>{
|
|
1135
1136
|
// Try to use Intl.DisplayNames if possible. It may be supported in browsers, but not support the dateTimeField
|
|
1136
1137
|
// type as that was only added in v2. https://github.com/tc39/intl-displaynames-v2
|
|
@@ -1160,9 +1161,9 @@ class $3aeceb3a64eb8358$var$DisplayNamesPolyfill {
|
|
|
1160
1161
|
|
|
1161
1162
|
function $32489daedd52963e$export$1315d136e6f7581(segment, state, ref) {
|
|
1162
1163
|
let enteredKeys = (0, $cIPI0$useRef)("");
|
|
1163
|
-
let { locale: locale
|
|
1164
|
+
let { locale: locale } = (0, $cIPI0$useLocale)();
|
|
1164
1165
|
let displayNames = (0, $3aeceb3a64eb8358$export$d42c60378c8168f8)();
|
|
1165
|
-
let { ariaLabel: ariaLabel
|
|
1166
|
+
let { ariaLabel: ariaLabel, ariaLabelledBy: ariaLabelledBy, ariaDescribedBy: ariaDescribedBy, focusManager: focusManager } = (0, $16f0b7bb276bc17e$export$653eddfc964b0f8a).get(state);
|
|
1166
1167
|
let textValue = segment.isPlaceholder ? "" : segment.text;
|
|
1167
1168
|
let options = (0, $cIPI0$useMemo)(()=>state.dateFormatter.resolvedOptions(), [
|
|
1168
1169
|
state.dateFormatter
|
|
@@ -1180,7 +1181,7 @@ function $32489daedd52963e$export$1315d136e6f7581(segment, state, ref) {
|
|
|
1180
1181
|
let monthTextValue = monthDateFormatter.format(state.dateValue);
|
|
1181
1182
|
textValue = monthTextValue !== textValue ? `${textValue} – ${monthTextValue}` : monthTextValue;
|
|
1182
1183
|
} else if (segment.type === "hour" && !segment.isPlaceholder) textValue = hourDateFormatter.format(state.dateValue);
|
|
1183
|
-
let { spinButtonProps: spinButtonProps
|
|
1184
|
+
let { spinButtonProps: spinButtonProps } = (0, $cIPI0$useSpinButton)({
|
|
1184
1185
|
// The ARIA spec says aria-valuenow is optional if there's no value, but aXe seems to require it.
|
|
1185
1186
|
// This doesn't seem to have any negative effects with real AT since we also use aria-valuetext.
|
|
1186
1187
|
// https://github.com/dequelabs/axe-core/issues/3505
|
|
@@ -1246,7 +1247,7 @@ function $32489daedd52963e$export$1315d136e6f7581(segment, state, ref) {
|
|
|
1246
1247
|
}
|
|
1247
1248
|
};
|
|
1248
1249
|
// Safari dayPeriod option doesn't work...
|
|
1249
|
-
let { startsWith: startsWith
|
|
1250
|
+
let { startsWith: startsWith } = (0, $cIPI0$useFilter)({
|
|
1250
1251
|
sensitivity: "base"
|
|
1251
1252
|
});
|
|
1252
1253
|
let amPmFormatter = (0, $cIPI0$useDateFormatter)({
|
|
@@ -1386,7 +1387,7 @@ function $32489daedd52963e$export$1315d136e6f7581(segment, state, ref) {
|
|
|
1386
1387
|
}
|
|
1387
1388
|
});
|
|
1388
1389
|
(0, $cIPI0$useEvent)(ref, "input", (e)=>{
|
|
1389
|
-
let { inputType: inputType
|
|
1390
|
+
let { inputType: inputType, data: data } = e;
|
|
1390
1391
|
switch(inputType){
|
|
1391
1392
|
case "insertCompositionText":
|
|
1392
1393
|
// Reset the DOM to how it was in the beforeinput event.
|
|
@@ -1423,7 +1424,7 @@ function $32489daedd52963e$export$1315d136e6f7581(segment, state, ref) {
|
|
|
1423
1424
|
let firstSegment = (0, $cIPI0$useMemo)(()=>state.segments.find((s)=>s.isEditable), [
|
|
1424
1425
|
state.segments
|
|
1425
1426
|
]);
|
|
1426
|
-
if (segment !== firstSegment && state.
|
|
1427
|
+
if (segment !== firstSegment && !state.isInvalid) ariaDescribedBy = undefined;
|
|
1427
1428
|
let id = (0, $cIPI0$useId)();
|
|
1428
1429
|
let isEditable = !state.isDisabled && !state.isReadOnly && segment.isEditable;
|
|
1429
1430
|
// Prepend the label passed from the field to each segment name.
|
|
@@ -1444,7 +1445,7 @@ function $32489daedd52963e$export$1315d136e6f7581(segment, state, ref) {
|
|
|
1444
1445
|
segmentProps: (0, $cIPI0$mergeProps)(spinButtonProps, labelProps, {
|
|
1445
1446
|
id: id,
|
|
1446
1447
|
...touchPropOverrides,
|
|
1447
|
-
"aria-invalid": state.
|
|
1448
|
+
"aria-invalid": state.isInvalid ? "true" : undefined,
|
|
1448
1449
|
"aria-describedby": ariaDescribedBy,
|
|
1449
1450
|
"aria-readonly": state.isReadOnly || !segment.isEditable ? "true" : undefined,
|
|
1450
1451
|
"data-placeholder": segment.isPlaceholder || undefined,
|
|
@@ -1507,12 +1508,12 @@ function $32489daedd52963e$var$commonPrefixLength(strings) {
|
|
|
1507
1508
|
function $887cac91b7cc8801$export$12fd5f0e9f4bb192(props, state, ref) {
|
|
1508
1509
|
var _state_value, _state_value1;
|
|
1509
1510
|
let stringFormatter = (0, $cIPI0$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($dfb4eba373ed9493$exports))));
|
|
1510
|
-
let { labelProps: labelProps
|
|
1511
|
+
let { labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $cIPI0$useField)({
|
|
1511
1512
|
...props,
|
|
1512
1513
|
labelElementType: "span"
|
|
1513
1514
|
});
|
|
1514
1515
|
let labelledBy = fieldProps["aria-labelledby"] || fieldProps.id;
|
|
1515
|
-
let { locale: locale
|
|
1516
|
+
let { locale: locale } = (0, $cIPI0$useLocale)();
|
|
1516
1517
|
let range = state.formatValue(locale, {
|
|
1517
1518
|
month: "long"
|
|
1518
1519
|
});
|
|
@@ -1557,10 +1558,10 @@ function $887cac91b7cc8801$export$12fd5f0e9f4bb192(props, state, ref) {
|
|
|
1557
1558
|
isDisabled: props.isDisabled,
|
|
1558
1559
|
isReadOnly: props.isReadOnly,
|
|
1559
1560
|
isRequired: props.isRequired,
|
|
1560
|
-
|
|
1561
|
+
isInvalid: state.isInvalid
|
|
1561
1562
|
};
|
|
1562
1563
|
let domProps = (0, $cIPI0$filterDOMProps)(props);
|
|
1563
|
-
let { focusWithinProps: focusWithinProps
|
|
1564
|
+
let { focusWithinProps: focusWithinProps } = (0, $cIPI0$useFocusWithin)({
|
|
1564
1565
|
...props,
|
|
1565
1566
|
isDisabled: state.isOpen,
|
|
1566
1567
|
onBlurWithin: props.onBlur,
|
|
@@ -1594,7 +1595,7 @@ function $887cac91b7cc8801$export$12fd5f0e9f4bb192(props, state, ref) {
|
|
|
1594
1595
|
"aria-label": stringFormatter.format("calendar"),
|
|
1595
1596
|
"aria-labelledby": `${buttonId} ${labelledBy}`,
|
|
1596
1597
|
"aria-describedby": ariaDescribedBy,
|
|
1597
|
-
"aria-expanded": state.isOpen
|
|
1598
|
+
"aria-expanded": state.isOpen,
|
|
1598
1599
|
onPress: ()=>state.setOpen(true)
|
|
1599
1600
|
},
|
|
1600
1601
|
dialogProps: {
|
|
@@ -1629,7 +1630,7 @@ function $887cac91b7cc8801$export$12fd5f0e9f4bb192(props, state, ref) {
|
|
|
1629
1630
|
isDateUnavailable: props.isDateUnavailable,
|
|
1630
1631
|
allowsNonContiguousRanges: props.allowsNonContiguousRanges,
|
|
1631
1632
|
defaultFocusedValue: state.dateRange ? undefined : props.placeholderValue,
|
|
1632
|
-
|
|
1633
|
+
isInvalid: state.isInvalid,
|
|
1633
1634
|
errorMessage: props.errorMessage
|
|
1634
1635
|
}
|
|
1635
1636
|
};
|