@react-aria/datepicker 3.5.0 → 3.7.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 -11
- package/dist/main.js +24 -10
- package/dist/main.js.map +1 -1
- package/dist/module.js +25 -11
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +11 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +15 -15
- package/src/useDateField.ts +25 -6
- package/src/useDatePicker.ts +4 -3
- package/src/useDatePickerGroup.ts +4 -0
- package/src/useDateRangePicker.ts +6 -4
- package/src/useDateSegment.ts +2 -2
package/dist/module.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {createFocusManager as $cIPI0$createFocusManager, getFocusableTreeWalker as $cIPI0$getFocusableTreeWalker} from "@react-aria/focus";
|
|
2
|
-
import {useId as $cIPI0$useId, useDescription as $cIPI0$useDescription, filterDOMProps as $cIPI0$filterDOMProps, mergeProps as $cIPI0$mergeProps, isMac as $cIPI0$isMac, scrollIntoViewport as $cIPI0$scrollIntoViewport, getScrollParent as $cIPI0$getScrollParent, useEvent as $cIPI0$useEvent, useLayoutEffect as $cIPI0$useLayoutEffect, isIOS as $cIPI0$isIOS, useLabels as $cIPI0$useLabels} from "@react-aria/utils";
|
|
2
|
+
import {useId as $cIPI0$useId, useDescription as $cIPI0$useDescription, filterDOMProps as $cIPI0$filterDOMProps, mergeProps as $cIPI0$mergeProps, useFormReset as $cIPI0$useFormReset, isMac as $cIPI0$isMac, scrollIntoViewport as $cIPI0$scrollIntoViewport, getScrollParent as $cIPI0$getScrollParent, useEvent as $cIPI0$useEvent, useLayoutEffect as $cIPI0$useLayoutEffect, isIOS as $cIPI0$isIOS, useLabels as $cIPI0$useLabels} from "@react-aria/utils";
|
|
3
3
|
import $cIPI0$react, {useMemo as $cIPI0$useMemo, useRef as $cIPI0$useRef, useEffect as $cIPI0$useEffect} from "react";
|
|
4
4
|
import {useField as $cIPI0$useField} from "@react-aria/label";
|
|
5
5
|
import {useFocusWithin as $cIPI0$useFocusWithin, usePress as $cIPI0$usePress} from "@react-aria/interactions";
|
|
@@ -814,6 +814,7 @@ function $3dfb0f96be0d6a08$export$4a931266a3838b86(state, ref, disableArrowNavig
|
|
|
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();
|
|
@@ -886,6 +887,7 @@ const $16f0b7bb276bc17e$export$653eddfc964b0f8a = new WeakMap();
|
|
|
886
887
|
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) {
|
|
890
|
+
var _state_value;
|
|
889
891
|
let { labelProps: labelProps , fieldProps: fieldProps , descriptionProps: descriptionProps , errorMessageProps: errorMessageProps } = (0, $cIPI0$useField)({
|
|
890
892
|
...props,
|
|
891
893
|
labelElementType: "span"
|
|
@@ -950,6 +952,7 @@ function $16f0b7bb276bc17e$export$5591b0b878c1a989(props, state, ref) {
|
|
|
950
952
|
}, [
|
|
951
953
|
focusManager
|
|
952
954
|
]);
|
|
955
|
+
(0, $cIPI0$useFormReset)(props.inputRef, state.value, state.setValue);
|
|
953
956
|
let domProps = (0, $cIPI0$filterDOMProps)(props);
|
|
954
957
|
return {
|
|
955
958
|
labelProps: {
|
|
@@ -966,12 +969,20 @@ function $16f0b7bb276bc17e$export$5591b0b878c1a989(props, state, ref) {
|
|
|
966
969
|
if (props.onKeyUp) props.onKeyUp(e);
|
|
967
970
|
}
|
|
968
971
|
}),
|
|
972
|
+
inputProps: {
|
|
973
|
+
type: "hidden",
|
|
974
|
+
name: props.name,
|
|
975
|
+
value: ((_state_value = state.value) === null || _state_value === void 0 ? void 0 : _state_value.toString()) || ""
|
|
976
|
+
},
|
|
969
977
|
descriptionProps: descriptionProps,
|
|
970
978
|
errorMessageProps: errorMessageProps
|
|
971
979
|
};
|
|
972
980
|
}
|
|
973
981
|
function $16f0b7bb276bc17e$export$4c842f6a241dc825(props, state, ref) {
|
|
974
|
-
|
|
982
|
+
var _state_timeValue;
|
|
983
|
+
let res = $16f0b7bb276bc17e$export$5591b0b878c1a989(props, state, ref);
|
|
984
|
+
res.inputProps.value = ((_state_timeValue = state.timeValue) === null || _state_timeValue === void 0 ? void 0 : _state_timeValue.toString()) || "";
|
|
985
|
+
return res;
|
|
975
986
|
}
|
|
976
987
|
|
|
977
988
|
|
|
@@ -1051,8 +1062,9 @@ function $6057a3d2a53a12fd$export$42df105a73306d51(props, state, ref) {
|
|
|
1051
1062
|
isDisabled: props.isDisabled,
|
|
1052
1063
|
isReadOnly: props.isReadOnly,
|
|
1053
1064
|
isRequired: props.isRequired,
|
|
1054
|
-
|
|
1055
|
-
autoFocus: props.autoFocus
|
|
1065
|
+
isInvalid: state.isInvalid,
|
|
1066
|
+
autoFocus: props.autoFocus,
|
|
1067
|
+
name: props.name
|
|
1056
1068
|
},
|
|
1057
1069
|
descriptionProps: descriptionProps,
|
|
1058
1070
|
errorMessageProps: errorMessageProps,
|
|
@@ -1080,7 +1092,7 @@ function $6057a3d2a53a12fd$export$42df105a73306d51(props, state, ref) {
|
|
|
1080
1092
|
isReadOnly: props.isReadOnly,
|
|
1081
1093
|
isDateUnavailable: props.isDateUnavailable,
|
|
1082
1094
|
defaultFocusedValue: state.dateValue ? undefined : props.placeholderValue,
|
|
1083
|
-
|
|
1095
|
+
isInvalid: state.isInvalid,
|
|
1084
1096
|
errorMessage: props.errorMessage
|
|
1085
1097
|
}
|
|
1086
1098
|
};
|
|
@@ -1412,7 +1424,7 @@ function $32489daedd52963e$export$1315d136e6f7581(segment, state, ref) {
|
|
|
1412
1424
|
let firstSegment = (0, $cIPI0$useMemo)(()=>state.segments.find((s)=>s.isEditable), [
|
|
1413
1425
|
state.segments
|
|
1414
1426
|
]);
|
|
1415
|
-
if (segment !== firstSegment && state.
|
|
1427
|
+
if (segment !== firstSegment && !state.isInvalid) ariaDescribedBy = undefined;
|
|
1416
1428
|
let id = (0, $cIPI0$useId)();
|
|
1417
1429
|
let isEditable = !state.isDisabled && !state.isReadOnly && segment.isEditable;
|
|
1418
1430
|
// Prepend the label passed from the field to each segment name.
|
|
@@ -1433,7 +1445,7 @@ function $32489daedd52963e$export$1315d136e6f7581(segment, state, ref) {
|
|
|
1433
1445
|
segmentProps: (0, $cIPI0$mergeProps)(spinButtonProps, labelProps, {
|
|
1434
1446
|
id: id,
|
|
1435
1447
|
...touchPropOverrides,
|
|
1436
|
-
"aria-invalid": state.
|
|
1448
|
+
"aria-invalid": state.isInvalid ? "true" : undefined,
|
|
1437
1449
|
"aria-describedby": ariaDescribedBy,
|
|
1438
1450
|
"aria-readonly": state.isReadOnly || !segment.isEditable ? "true" : undefined,
|
|
1439
1451
|
"data-placeholder": segment.isPlaceholder || undefined,
|
|
@@ -1546,7 +1558,7 @@ function $887cac91b7cc8801$export$12fd5f0e9f4bb192(props, state, ref) {
|
|
|
1546
1558
|
isDisabled: props.isDisabled,
|
|
1547
1559
|
isReadOnly: props.isReadOnly,
|
|
1548
1560
|
isRequired: props.isRequired,
|
|
1549
|
-
|
|
1561
|
+
isInvalid: state.isInvalid
|
|
1550
1562
|
};
|
|
1551
1563
|
let domProps = (0, $cIPI0$filterDOMProps)(props);
|
|
1552
1564
|
let { focusWithinProps: focusWithinProps } = (0, $cIPI0$useFocusWithin)({
|
|
@@ -1595,13 +1607,15 @@ function $887cac91b7cc8801$export$12fd5f0e9f4bb192(props, state, ref) {
|
|
|
1595
1607
|
...commonFieldProps,
|
|
1596
1608
|
value: (_state_value = state.value) === null || _state_value === void 0 ? void 0 : _state_value.start,
|
|
1597
1609
|
onChange: (start)=>state.setDateTime("start", start),
|
|
1598
|
-
autoFocus: props.autoFocus
|
|
1610
|
+
autoFocus: props.autoFocus,
|
|
1611
|
+
name: props.startName
|
|
1599
1612
|
},
|
|
1600
1613
|
endFieldProps: {
|
|
1601
1614
|
...endFieldProps,
|
|
1602
1615
|
...commonFieldProps,
|
|
1603
1616
|
value: (_state_value1 = state.value) === null || _state_value1 === void 0 ? void 0 : _state_value1.end,
|
|
1604
|
-
onChange: (end)=>state.setDateTime("end", end)
|
|
1617
|
+
onChange: (end)=>state.setDateTime("end", end),
|
|
1618
|
+
name: props.endName
|
|
1605
1619
|
},
|
|
1606
1620
|
descriptionProps: descriptionProps,
|
|
1607
1621
|
errorMessageProps: errorMessageProps,
|
|
@@ -1616,7 +1630,7 @@ function $887cac91b7cc8801$export$12fd5f0e9f4bb192(props, state, ref) {
|
|
|
1616
1630
|
isDateUnavailable: props.isDateUnavailable,
|
|
1617
1631
|
allowsNonContiguousRanges: props.allowsNonContiguousRanges,
|
|
1618
1632
|
defaultFocusedValue: state.dateRange ? undefined : props.placeholderValue,
|
|
1619
|
-
|
|
1633
|
+
isInvalid: state.isInvalid,
|
|
1620
1634
|
errorMessage: props.errorMessage
|
|
1621
1635
|
}
|
|
1622
1636
|
};
|