@react-aria/calendar 3.0.0-nightly.2238 → 3.0.0-nightly.2258
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 +16 -17
- package/dist/main.js +14 -15
- package/dist/main.js.map +1 -1
- package/dist/module.js +16 -17
- 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 +7 -10
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
|
|
@@ -1236,8 +1232,11 @@ function $36a0ac60f04457c5$export$136073280381448e(props, state, ref) {
|
|
|
1236
1232
|
// Scroll into view if navigating with a keyboard, otherwise
|
|
1237
1233
|
// try not to shift the view under the user's mouse/finger.
|
|
1238
1234
|
// If in a overlay, scrollIntoViewport will only cause scrolling
|
|
1239
|
-
// up to the overlay scroll body to prevent overlay shifting
|
|
1240
|
-
if
|
|
1235
|
+
// up to the overlay scroll body to prevent overlay shifting.
|
|
1236
|
+
// Also only scroll into view if the cell actually got focused.
|
|
1237
|
+
// There are some cases where the cell might be disabled or inside,
|
|
1238
|
+
// an inert container and we don't want to scroll then.
|
|
1239
|
+
if ((0, $amWdn$getInteractionModality)() !== "pointer" && document.activeElement === ref.current) (0, $amWdn$scrollIntoViewport)(ref.current, {
|
|
1241
1240
|
containingElement: (0, $amWdn$getScrollParent)(ref.current)
|
|
1242
1241
|
});
|
|
1243
1242
|
}
|
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
|
|
@@ -1244,8 +1240,11 @@ function $4d833327a32c9193$export$136073280381448e(props, state, ref) {
|
|
|
1244
1240
|
// Scroll into view if navigating with a keyboard, otherwise
|
|
1245
1241
|
// try not to shift the view under the user's mouse/finger.
|
|
1246
1242
|
// If in a overlay, scrollIntoViewport will only cause scrolling
|
|
1247
|
-
// up to the overlay scroll body to prevent overlay shifting
|
|
1248
|
-
if
|
|
1243
|
+
// up to the overlay scroll body to prevent overlay shifting.
|
|
1244
|
+
// Also only scroll into view if the cell actually got focused.
|
|
1245
|
+
// There are some cases where the cell might be disabled or inside,
|
|
1246
|
+
// an inert container and we don't want to scroll then.
|
|
1247
|
+
if ((0, $jzHdg$reactariainteractions.getInteractionModality)() !== "pointer" && document.activeElement === ref.current) (0, $jzHdg$reactariautils.scrollIntoViewport)(ref.current, {
|
|
1249
1248
|
containingElement: (0, $jzHdg$reactariautils.getScrollParent)(ref.current)
|
|
1250
1249
|
});
|
|
1251
1250
|
}
|