@react-aria/calendar 3.0.0-nightly.2235 → 3.0.0-nightly.2241
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 +11 -15
- package/dist/main.js +9 -13
- package/dist/main.js.map +1 -1
- package/dist/module.js +11 -15
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +11 -11
- package/src/useCalendarBase.ts +9 -11
- package/src/useCalendarCell.ts +2 -8
package/dist/import.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {announce as $amWdn$announce} from "@react-aria/live-announcer";
|
|
2
|
-
import {filterDOMProps as $amWdn$filterDOMProps, useUpdateEffect as $amWdn$useUpdateEffect, useSlotId as $amWdn$useSlotId, useLabels as $amWdn$useLabels, mergeProps as $amWdn$mergeProps, useEvent as $amWdn$useEvent, useDescription as $amWdn$useDescription, focusWithoutScrolling as $amWdn$focusWithoutScrolling, scrollIntoViewport as $amWdn$scrollIntoViewport, getScrollParent as $amWdn$getScrollParent} from "@react-aria/utils";
|
|
2
|
+
import {filterDOMProps as $amWdn$filterDOMProps, useUpdateEffect as $amWdn$useUpdateEffect, useSlotId as $amWdn$useSlotId, useLabels as $amWdn$useLabels, mergeProps as $amWdn$mergeProps, useEvent as $amWdn$useEvent, useDeepMemo as $amWdn$useDeepMemo, useDescription as $amWdn$useDescription, focusWithoutScrolling as $amWdn$focusWithoutScrolling, scrollIntoViewport as $amWdn$scrollIntoViewport, getScrollParent as $amWdn$getScrollParent} from "@react-aria/utils";
|
|
3
3
|
import {useLocalizedStringFormatter as $amWdn$useLocalizedStringFormatter, useDateFormatter as $amWdn$useDateFormatter, useLocale as $amWdn$useLocale} from "@react-aria/i18n";
|
|
4
|
-
import {
|
|
4
|
+
import {useState as $amWdn$useState, useMemo as $amWdn$useMemo, useRef as $amWdn$useRef, useEffect as $amWdn$useEffect} from "react";
|
|
5
5
|
import {isSameDay as $amWdn$isSameDay, startOfMonth as $amWdn$startOfMonth, endOfMonth as $amWdn$endOfMonth, startOfWeek as $amWdn$startOfWeek, today as $amWdn$today, isEqualDay as $amWdn$isEqualDay, isToday as $amWdn$isToday} from "@internationalized/date";
|
|
6
6
|
import {usePress as $amWdn$usePress, getInteractionModality as $amWdn$getInteractionModality} from "@react-aria/interactions";
|
|
7
7
|
|
|
@@ -810,16 +810,16 @@ function $c4acc1de3ab169cf$export$d652b3ea2d672d5b(props, state) {
|
|
|
810
810
|
selectedDateDescription: selectedDateDescription
|
|
811
811
|
});
|
|
812
812
|
// If the next or previous buttons become disabled while they are focused, move focus to the calendar body.
|
|
813
|
-
let nextFocused = (0, $amWdn$
|
|
813
|
+
let [nextFocused, setNextFocused] = (0, $amWdn$useState)(false);
|
|
814
814
|
let nextDisabled = props.isDisabled || state.isNextVisibleRangeInvalid();
|
|
815
|
-
if (nextDisabled && nextFocused
|
|
816
|
-
|
|
815
|
+
if (nextDisabled && nextFocused) {
|
|
816
|
+
setNextFocused(false);
|
|
817
817
|
state.setFocused(true);
|
|
818
818
|
}
|
|
819
|
-
let previousFocused = (0, $amWdn$
|
|
819
|
+
let [previousFocused, setPreviousFocused] = (0, $amWdn$useState)(false);
|
|
820
820
|
let previousDisabled = props.isDisabled || state.isPreviousVisibleRangeInvalid();
|
|
821
|
-
if (previousDisabled && previousFocused
|
|
822
|
-
|
|
821
|
+
if (previousDisabled && previousFocused) {
|
|
822
|
+
setPreviousFocused(false);
|
|
823
823
|
state.setFocused(true);
|
|
824
824
|
}
|
|
825
825
|
let labelProps = (0, $amWdn$useLabels)({
|
|
@@ -839,15 +839,13 @@ function $c4acc1de3ab169cf$export$d652b3ea2d672d5b(props, state) {
|
|
|
839
839
|
onPress: ()=>state.focusNextPage(),
|
|
840
840
|
"aria-label": stringFormatter.format("next"),
|
|
841
841
|
isDisabled: nextDisabled,
|
|
842
|
-
|
|
843
|
-
onBlur: ()=>nextFocused.current = false
|
|
842
|
+
onFocusChange: setNextFocused
|
|
844
843
|
},
|
|
845
844
|
prevButtonProps: {
|
|
846
845
|
onPress: ()=>state.focusPreviousPage(),
|
|
847
846
|
"aria-label": stringFormatter.format("previous"),
|
|
848
847
|
isDisabled: previousDisabled,
|
|
849
|
-
|
|
850
|
-
onBlur: ()=>previousFocused.current = false
|
|
848
|
+
onFocusChange: setPreviousFocused
|
|
851
849
|
},
|
|
852
850
|
errorMessageProps: {
|
|
853
851
|
id: errorMessageId
|
|
@@ -1083,9 +1081,7 @@ function $36a0ac60f04457c5$export$136073280381448e(props, state, ref) {
|
|
|
1083
1081
|
if (isInvalid) isSelected = true;
|
|
1084
1082
|
// For performance, reuse the same date object as before if the new date prop is the same.
|
|
1085
1083
|
// This allows subsequent useMemo results to be reused.
|
|
1086
|
-
|
|
1087
|
-
if (lastDate.current && (0, $amWdn$isEqualDay)(date, lastDate.current)) date = lastDate.current;
|
|
1088
|
-
lastDate.current = date;
|
|
1084
|
+
date = (0, $amWdn$useDeepMemo)(date, (0, $amWdn$isEqualDay));
|
|
1089
1085
|
let nativeDate = (0, $amWdn$useMemo)(()=>date.toDate(state.timeZone), [
|
|
1090
1086
|
date,
|
|
1091
1087
|
state.timeZone
|
package/dist/main.js
CHANGED
|
@@ -818,16 +818,16 @@ function $02ef492a56b91cb2$export$d652b3ea2d672d5b(props, state) {
|
|
|
818
818
|
selectedDateDescription: selectedDateDescription
|
|
819
819
|
});
|
|
820
820
|
// If the next or previous buttons become disabled while they are focused, move focus to the calendar body.
|
|
821
|
-
let nextFocused = (0, $jzHdg$react.
|
|
821
|
+
let [nextFocused, setNextFocused] = (0, $jzHdg$react.useState)(false);
|
|
822
822
|
let nextDisabled = props.isDisabled || state.isNextVisibleRangeInvalid();
|
|
823
|
-
if (nextDisabled && nextFocused
|
|
824
|
-
|
|
823
|
+
if (nextDisabled && nextFocused) {
|
|
824
|
+
setNextFocused(false);
|
|
825
825
|
state.setFocused(true);
|
|
826
826
|
}
|
|
827
|
-
let previousFocused = (0, $jzHdg$react.
|
|
827
|
+
let [previousFocused, setPreviousFocused] = (0, $jzHdg$react.useState)(false);
|
|
828
828
|
let previousDisabled = props.isDisabled || state.isPreviousVisibleRangeInvalid();
|
|
829
|
-
if (previousDisabled && previousFocused
|
|
830
|
-
|
|
829
|
+
if (previousDisabled && previousFocused) {
|
|
830
|
+
setPreviousFocused(false);
|
|
831
831
|
state.setFocused(true);
|
|
832
832
|
}
|
|
833
833
|
let labelProps = (0, $jzHdg$reactariautils.useLabels)({
|
|
@@ -847,15 +847,13 @@ function $02ef492a56b91cb2$export$d652b3ea2d672d5b(props, state) {
|
|
|
847
847
|
onPress: ()=>state.focusNextPage(),
|
|
848
848
|
"aria-label": stringFormatter.format("next"),
|
|
849
849
|
isDisabled: nextDisabled,
|
|
850
|
-
|
|
851
|
-
onBlur: ()=>nextFocused.current = false
|
|
850
|
+
onFocusChange: setNextFocused
|
|
852
851
|
},
|
|
853
852
|
prevButtonProps: {
|
|
854
853
|
onPress: ()=>state.focusPreviousPage(),
|
|
855
854
|
"aria-label": stringFormatter.format("previous"),
|
|
856
855
|
isDisabled: previousDisabled,
|
|
857
|
-
|
|
858
|
-
onBlur: ()=>previousFocused.current = false
|
|
856
|
+
onFocusChange: setPreviousFocused
|
|
859
857
|
},
|
|
860
858
|
errorMessageProps: {
|
|
861
859
|
id: errorMessageId
|
|
@@ -1091,9 +1089,7 @@ function $4d833327a32c9193$export$136073280381448e(props, state, ref) {
|
|
|
1091
1089
|
if (isInvalid) isSelected = true;
|
|
1092
1090
|
// For performance, reuse the same date object as before if the new date prop is the same.
|
|
1093
1091
|
// This allows subsequent useMemo results to be reused.
|
|
1094
|
-
|
|
1095
|
-
if (lastDate.current && (0, $jzHdg$internationalizeddate.isEqualDay)(date, lastDate.current)) date = lastDate.current;
|
|
1096
|
-
lastDate.current = date;
|
|
1092
|
+
date = (0, $jzHdg$reactariautils.useDeepMemo)(date, (0, $jzHdg$internationalizeddate.isEqualDay));
|
|
1097
1093
|
let nativeDate = (0, $jzHdg$react.useMemo)(()=>date.toDate(state.timeZone), [
|
|
1098
1094
|
date,
|
|
1099
1095
|
state.timeZone
|