@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/import.mjs
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
|
};
|
package/dist/main.js
CHANGED
|
@@ -818,12 +818,13 @@ $c1905b78f6d2f5bf$exports = {
|
|
|
818
818
|
|
|
819
819
|
|
|
820
820
|
function $715562ad3b4cced4$export$4a931266a3838b86(state, ref, disableArrowNavigation) {
|
|
821
|
-
let { direction: direction
|
|
821
|
+
let { direction: direction } = (0, $IwcIq$reactariai18n.useLocale)();
|
|
822
822
|
let focusManager = (0, $IwcIq$react.useMemo)(()=>(0, $IwcIq$reactariafocus.createFocusManager)(ref), [
|
|
823
823
|
ref
|
|
824
824
|
]);
|
|
825
825
|
// Open the popover on alt + arrow down
|
|
826
826
|
let onKeyDown = (e)=>{
|
|
827
|
+
if (!e.currentTarget.contains(e.target)) return;
|
|
827
828
|
if (e.altKey && (e.key === "ArrowDown" || e.key === "ArrowUp") && "setOpen" in state) {
|
|
828
829
|
e.preventDefault();
|
|
829
830
|
e.stopPropagation();
|
|
@@ -873,7 +874,7 @@ function $715562ad3b4cced4$export$4a931266a3838b86(state, ref, disableArrowNavig
|
|
|
873
874
|
}
|
|
874
875
|
if (target) target.focus();
|
|
875
876
|
};
|
|
876
|
-
let { pressProps: pressProps
|
|
877
|
+
let { pressProps: pressProps } = (0, $IwcIq$reactariainteractions.usePress)({
|
|
877
878
|
preventFocusOnPress: true,
|
|
878
879
|
allowTextSelectionOnPress: true,
|
|
879
880
|
onPressStart (e) {
|
|
@@ -897,11 +898,11 @@ const $4acc2f407c169e55$export$300019f83c56d282 = "__role_" + Date.now();
|
|
|
897
898
|
const $4acc2f407c169e55$export$7b3062cd49e80452 = "__focusManager_" + Date.now();
|
|
898
899
|
function $4acc2f407c169e55$export$5591b0b878c1a989(props, state, ref) {
|
|
899
900
|
var _state_value;
|
|
900
|
-
let { labelProps: labelProps
|
|
901
|
+
let { labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $IwcIq$reactarialabel.useField)({
|
|
901
902
|
...props,
|
|
902
903
|
labelElementType: "span"
|
|
903
904
|
});
|
|
904
|
-
let { focusWithinProps: focusWithinProps
|
|
905
|
+
let { focusWithinProps: focusWithinProps } = (0, $IwcIq$reactariainteractions.useFocusWithin)({
|
|
905
906
|
...props,
|
|
906
907
|
onBlurWithin: (e)=>{
|
|
907
908
|
state.confirmPlaceholder();
|
|
@@ -1004,13 +1005,13 @@ function $e90ae7c26a69c6b1$export$42df105a73306d51(props, state, ref) {
|
|
|
1004
1005
|
let dialogId = (0, $IwcIq$reactariautils.useId)();
|
|
1005
1006
|
let fieldId = (0, $IwcIq$reactariautils.useId)();
|
|
1006
1007
|
let stringFormatter = (0, $IwcIq$reactariai18n.useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($c1905b78f6d2f5bf$exports))));
|
|
1007
|
-
let { labelProps: labelProps
|
|
1008
|
+
let { labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $IwcIq$reactarialabel.useField)({
|
|
1008
1009
|
...props,
|
|
1009
1010
|
labelElementType: "span"
|
|
1010
1011
|
});
|
|
1011
1012
|
let groupProps = (0, $715562ad3b4cced4$export$4a931266a3838b86)(state, ref);
|
|
1012
1013
|
let labelledBy = fieldProps["aria-labelledby"] || fieldProps.id;
|
|
1013
|
-
let { locale: locale
|
|
1014
|
+
let { locale: locale } = (0, $IwcIq$reactariai18n.useLocale)();
|
|
1014
1015
|
let date = state.formatValue(locale, {
|
|
1015
1016
|
month: "long"
|
|
1016
1017
|
});
|
|
@@ -1026,7 +1027,7 @@ function $e90ae7c26a69c6b1$export$42df105a73306d51(props, state, ref) {
|
|
|
1026
1027
|
let focusManager = (0, $IwcIq$react.useMemo)(()=>(0, $IwcIq$reactariafocus.createFocusManager)(ref), [
|
|
1027
1028
|
ref
|
|
1028
1029
|
]);
|
|
1029
|
-
let { focusWithinProps: focusWithinProps
|
|
1030
|
+
let { focusWithinProps: focusWithinProps } = (0, $IwcIq$reactariainteractions.useFocusWithin)({
|
|
1030
1031
|
...props,
|
|
1031
1032
|
isDisabled: state.isOpen,
|
|
1032
1033
|
onBlurWithin: props.onBlur,
|
|
@@ -1071,7 +1072,7 @@ function $e90ae7c26a69c6b1$export$42df105a73306d51(props, state, ref) {
|
|
|
1071
1072
|
isDisabled: props.isDisabled,
|
|
1072
1073
|
isReadOnly: props.isReadOnly,
|
|
1073
1074
|
isRequired: props.isRequired,
|
|
1074
|
-
|
|
1075
|
+
isInvalid: state.isInvalid,
|
|
1075
1076
|
autoFocus: props.autoFocus,
|
|
1076
1077
|
name: props.name
|
|
1077
1078
|
},
|
|
@@ -1084,7 +1085,7 @@ function $e90ae7c26a69c6b1$export$42df105a73306d51(props, state, ref) {
|
|
|
1084
1085
|
"aria-label": stringFormatter.format("calendar"),
|
|
1085
1086
|
"aria-labelledby": `${buttonId} ${labelledBy}`,
|
|
1086
1087
|
"aria-describedby": ariaDescribedBy,
|
|
1087
|
-
"aria-expanded": state.isOpen
|
|
1088
|
+
"aria-expanded": state.isOpen,
|
|
1088
1089
|
onPress: ()=>state.setOpen(true)
|
|
1089
1090
|
},
|
|
1090
1091
|
dialogProps: {
|
|
@@ -1101,7 +1102,7 @@ function $e90ae7c26a69c6b1$export$42df105a73306d51(props, state, ref) {
|
|
|
1101
1102
|
isReadOnly: props.isReadOnly,
|
|
1102
1103
|
isDateUnavailable: props.isDateUnavailable,
|
|
1103
1104
|
defaultFocusedValue: state.dateValue ? undefined : props.placeholderValue,
|
|
1104
|
-
|
|
1105
|
+
isInvalid: state.isInvalid,
|
|
1105
1106
|
errorMessage: props.errorMessage
|
|
1106
1107
|
}
|
|
1107
1108
|
};
|
|
@@ -1140,7 +1141,7 @@ function $e90ae7c26a69c6b1$export$42df105a73306d51(props, state, ref) {
|
|
|
1140
1141
|
|
|
1141
1142
|
|
|
1142
1143
|
function $934ac650a0aceb4b$export$d42c60378c8168f8() {
|
|
1143
|
-
let { locale: locale
|
|
1144
|
+
let { locale: locale } = (0, $IwcIq$reactariai18n.useLocale)();
|
|
1144
1145
|
return (0, $IwcIq$react.useMemo)(()=>{
|
|
1145
1146
|
// Try to use Intl.DisplayNames if possible. It may be supported in browsers, but not support the dateTimeField
|
|
1146
1147
|
// type as that was only added in v2. https://github.com/tc39/intl-displaynames-v2
|
|
@@ -1170,9 +1171,9 @@ class $934ac650a0aceb4b$var$DisplayNamesPolyfill {
|
|
|
1170
1171
|
|
|
1171
1172
|
function $5c015c6316d1904d$export$1315d136e6f7581(segment, state, ref) {
|
|
1172
1173
|
let enteredKeys = (0, $IwcIq$react.useRef)("");
|
|
1173
|
-
let { locale: locale
|
|
1174
|
+
let { locale: locale } = (0, $IwcIq$reactariai18n.useLocale)();
|
|
1174
1175
|
let displayNames = (0, $934ac650a0aceb4b$export$d42c60378c8168f8)();
|
|
1175
|
-
let { ariaLabel: ariaLabel
|
|
1176
|
+
let { ariaLabel: ariaLabel, ariaLabelledBy: ariaLabelledBy, ariaDescribedBy: ariaDescribedBy, focusManager: focusManager } = (0, $4acc2f407c169e55$export$653eddfc964b0f8a).get(state);
|
|
1176
1177
|
let textValue = segment.isPlaceholder ? "" : segment.text;
|
|
1177
1178
|
let options = (0, $IwcIq$react.useMemo)(()=>state.dateFormatter.resolvedOptions(), [
|
|
1178
1179
|
state.dateFormatter
|
|
@@ -1190,7 +1191,7 @@ function $5c015c6316d1904d$export$1315d136e6f7581(segment, state, ref) {
|
|
|
1190
1191
|
let monthTextValue = monthDateFormatter.format(state.dateValue);
|
|
1191
1192
|
textValue = monthTextValue !== textValue ? `${textValue} – ${monthTextValue}` : monthTextValue;
|
|
1192
1193
|
} else if (segment.type === "hour" && !segment.isPlaceholder) textValue = hourDateFormatter.format(state.dateValue);
|
|
1193
|
-
let { spinButtonProps: spinButtonProps
|
|
1194
|
+
let { spinButtonProps: spinButtonProps } = (0, $IwcIq$reactariaspinbutton.useSpinButton)({
|
|
1194
1195
|
// The ARIA spec says aria-valuenow is optional if there's no value, but aXe seems to require it.
|
|
1195
1196
|
// This doesn't seem to have any negative effects with real AT since we also use aria-valuetext.
|
|
1196
1197
|
// https://github.com/dequelabs/axe-core/issues/3505
|
|
@@ -1256,7 +1257,7 @@ function $5c015c6316d1904d$export$1315d136e6f7581(segment, state, ref) {
|
|
|
1256
1257
|
}
|
|
1257
1258
|
};
|
|
1258
1259
|
// Safari dayPeriod option doesn't work...
|
|
1259
|
-
let { startsWith: startsWith
|
|
1260
|
+
let { startsWith: startsWith } = (0, $IwcIq$reactariai18n.useFilter)({
|
|
1260
1261
|
sensitivity: "base"
|
|
1261
1262
|
});
|
|
1262
1263
|
let amPmFormatter = (0, $IwcIq$reactariai18n.useDateFormatter)({
|
|
@@ -1396,7 +1397,7 @@ function $5c015c6316d1904d$export$1315d136e6f7581(segment, state, ref) {
|
|
|
1396
1397
|
}
|
|
1397
1398
|
});
|
|
1398
1399
|
(0, $IwcIq$reactariautils.useEvent)(ref, "input", (e)=>{
|
|
1399
|
-
let { inputType: inputType
|
|
1400
|
+
let { inputType: inputType, data: data } = e;
|
|
1400
1401
|
switch(inputType){
|
|
1401
1402
|
case "insertCompositionText":
|
|
1402
1403
|
// Reset the DOM to how it was in the beforeinput event.
|
|
@@ -1433,7 +1434,7 @@ function $5c015c6316d1904d$export$1315d136e6f7581(segment, state, ref) {
|
|
|
1433
1434
|
let firstSegment = (0, $IwcIq$react.useMemo)(()=>state.segments.find((s)=>s.isEditable), [
|
|
1434
1435
|
state.segments
|
|
1435
1436
|
]);
|
|
1436
|
-
if (segment !== firstSegment && state.
|
|
1437
|
+
if (segment !== firstSegment && !state.isInvalid) ariaDescribedBy = undefined;
|
|
1437
1438
|
let id = (0, $IwcIq$reactariautils.useId)();
|
|
1438
1439
|
let isEditable = !state.isDisabled && !state.isReadOnly && segment.isEditable;
|
|
1439
1440
|
// Prepend the label passed from the field to each segment name.
|
|
@@ -1454,7 +1455,7 @@ function $5c015c6316d1904d$export$1315d136e6f7581(segment, state, ref) {
|
|
|
1454
1455
|
segmentProps: (0, $IwcIq$reactariautils.mergeProps)(spinButtonProps, labelProps, {
|
|
1455
1456
|
id: id,
|
|
1456
1457
|
...touchPropOverrides,
|
|
1457
|
-
"aria-invalid": state.
|
|
1458
|
+
"aria-invalid": state.isInvalid ? "true" : undefined,
|
|
1458
1459
|
"aria-describedby": ariaDescribedBy,
|
|
1459
1460
|
"aria-readonly": state.isReadOnly || !segment.isEditable ? "true" : undefined,
|
|
1460
1461
|
"data-placeholder": segment.isPlaceholder || undefined,
|
|
@@ -1517,12 +1518,12 @@ function $5c015c6316d1904d$var$commonPrefixLength(strings) {
|
|
|
1517
1518
|
function $20f695b1b69e6b9e$export$12fd5f0e9f4bb192(props, state, ref) {
|
|
1518
1519
|
var _state_value, _state_value1;
|
|
1519
1520
|
let stringFormatter = (0, $IwcIq$reactariai18n.useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($c1905b78f6d2f5bf$exports))));
|
|
1520
|
-
let { labelProps: labelProps
|
|
1521
|
+
let { labelProps: labelProps, fieldProps: fieldProps, descriptionProps: descriptionProps, errorMessageProps: errorMessageProps } = (0, $IwcIq$reactarialabel.useField)({
|
|
1521
1522
|
...props,
|
|
1522
1523
|
labelElementType: "span"
|
|
1523
1524
|
});
|
|
1524
1525
|
let labelledBy = fieldProps["aria-labelledby"] || fieldProps.id;
|
|
1525
|
-
let { locale: locale
|
|
1526
|
+
let { locale: locale } = (0, $IwcIq$reactariai18n.useLocale)();
|
|
1526
1527
|
let range = state.formatValue(locale, {
|
|
1527
1528
|
month: "long"
|
|
1528
1529
|
});
|
|
@@ -1567,10 +1568,10 @@ function $20f695b1b69e6b9e$export$12fd5f0e9f4bb192(props, state, ref) {
|
|
|
1567
1568
|
isDisabled: props.isDisabled,
|
|
1568
1569
|
isReadOnly: props.isReadOnly,
|
|
1569
1570
|
isRequired: props.isRequired,
|
|
1570
|
-
|
|
1571
|
+
isInvalid: state.isInvalid
|
|
1571
1572
|
};
|
|
1572
1573
|
let domProps = (0, $IwcIq$reactariautils.filterDOMProps)(props);
|
|
1573
|
-
let { focusWithinProps: focusWithinProps
|
|
1574
|
+
let { focusWithinProps: focusWithinProps } = (0, $IwcIq$reactariainteractions.useFocusWithin)({
|
|
1574
1575
|
...props,
|
|
1575
1576
|
isDisabled: state.isOpen,
|
|
1576
1577
|
onBlurWithin: props.onBlur,
|
|
@@ -1604,7 +1605,7 @@ function $20f695b1b69e6b9e$export$12fd5f0e9f4bb192(props, state, ref) {
|
|
|
1604
1605
|
"aria-label": stringFormatter.format("calendar"),
|
|
1605
1606
|
"aria-labelledby": `${buttonId} ${labelledBy}`,
|
|
1606
1607
|
"aria-describedby": ariaDescribedBy,
|
|
1607
|
-
"aria-expanded": state.isOpen
|
|
1608
|
+
"aria-expanded": state.isOpen,
|
|
1608
1609
|
onPress: ()=>state.setOpen(true)
|
|
1609
1610
|
},
|
|
1610
1611
|
dialogProps: {
|
|
@@ -1639,7 +1640,7 @@ function $20f695b1b69e6b9e$export$12fd5f0e9f4bb192(props, state, ref) {
|
|
|
1639
1640
|
isDateUnavailable: props.isDateUnavailable,
|
|
1640
1641
|
allowsNonContiguousRanges: props.allowsNonContiguousRanges,
|
|
1641
1642
|
defaultFocusedValue: state.dateRange ? undefined : props.placeholderValue,
|
|
1642
|
-
|
|
1643
|
+
isInvalid: state.isInvalid,
|
|
1643
1644
|
errorMessage: props.errorMessage
|
|
1644
1645
|
}
|
|
1645
1646
|
};
|