@react-aria/calendar 3.4.1 → 3.5.1

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 CHANGED
@@ -677,7 +677,7 @@ function $a074e1e2d0f0a665$export$134cbb7fb09a9522(date) {
677
677
  function $a074e1e2d0f0a665$export$b6df97c887c38e1a(state) {
678
678
  let stringFormatter = (0, $amWdn$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($3904726b442bd9b2$exports))));
679
679
  let start, end;
680
- if ("highlightedRange" in state) ({ start: start , end: end } = state.highlightedRange || {});
680
+ if ("highlightedRange" in state) ({ start: start, end: end } = state.highlightedRange || {});
681
681
  else start = end = state.value;
682
682
  let dateFormatter = (0, $amWdn$useDateFormatter)({
683
683
  weekday: "long",
@@ -800,6 +800,7 @@ function $c4acc1de3ab169cf$export$d652b3ea2d672d5b(props, state) {
800
800
  ]);
801
801
  let errorMessageId = (0, $amWdn$useSlotId)([
802
802
  Boolean(props.errorMessage),
803
+ props.isInvalid,
803
804
  props.validationState
804
805
  ]);
805
806
  // Pass the label to the child grid elements.
@@ -932,8 +933,8 @@ function $46a4342aab3d8076$export$87e0539f600c24e5(props, state, ref) {
932
933
 
933
934
 
934
935
  function $e3031d1f8c9d64eb$export$cb95147730a423f5(props, state) {
935
- let { startDate: startDate = state.visibleRange.start , endDate: endDate = state.visibleRange.end } = props;
936
- let { direction: direction } = (0, $amWdn$useLocale)();
936
+ let { startDate: startDate = state.visibleRange.start, endDate: endDate = state.visibleRange.end } = props;
937
+ let { direction: direction } = (0, $amWdn$useLocale)();
937
938
  let onKeyDown = (e)=>{
938
939
  switch(e.key){
939
940
  case "Enter":
@@ -993,7 +994,7 @@ function $e3031d1f8c9d64eb$export$cb95147730a423f5(props, state) {
993
994
  }
994
995
  };
995
996
  let visibleRangeDescription = (0, $a074e1e2d0f0a665$export$31afe65d91ef6e8)(startDate, endDate, state.timeZone, true);
996
- let { ariaLabel: ariaLabel , ariaLabelledBy: ariaLabelledBy } = (0, $a074e1e2d0f0a665$export$653eddfc964b0f8a).get(state);
997
+ let { ariaLabel: ariaLabel, ariaLabelledBy: ariaLabelledBy } = (0, $a074e1e2d0f0a665$export$653eddfc964b0f8a).get(state);
997
998
  let labelProps = (0, $amWdn$useLabels)({
998
999
  "aria-label": [
999
1000
  ariaLabel,
@@ -1005,7 +1006,7 @@ function $e3031d1f8c9d64eb$export$cb95147730a423f5(props, state) {
1005
1006
  weekday: props.weekdayStyle || "narrow",
1006
1007
  timeZone: state.timeZone
1007
1008
  });
1008
- let { locale: locale } = (0, $amWdn$useLocale)();
1009
+ let { locale: locale } = (0, $amWdn$useLocale)();
1009
1010
  let weekDays = (0, $amWdn$useMemo)(()=>{
1010
1011
  let weekStart = (0, $amWdn$startOfWeek)((0, $amWdn$today)(state.timeZone), locale);
1011
1012
  return [
@@ -1060,8 +1061,8 @@ function $e3031d1f8c9d64eb$export$cb95147730a423f5(props, state) {
1060
1061
 
1061
1062
 
1062
1063
  function $36a0ac60f04457c5$export$136073280381448e(props, state, ref) {
1063
- let { date: date , isDisabled: isDisabled } = props;
1064
- let { errorMessageId: errorMessageId , selectedDateDescription: selectedDateDescription } = (0, $a074e1e2d0f0a665$export$653eddfc964b0f8a).get(state);
1064
+ let { date: date, isDisabled: isDisabled } = props;
1065
+ let { errorMessageId: errorMessageId, selectedDateDescription: selectedDateDescription } = (0, $a074e1e2d0f0a665$export$653eddfc964b0f8a).get(state);
1065
1066
  let stringFormatter = (0, $amWdn$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($3904726b442bd9b2$exports))));
1066
1067
  let dateFormatter = (0, $amWdn$useDateFormatter)({
1067
1068
  weekday: "long",
@@ -1076,7 +1077,7 @@ function $36a0ac60f04457c5$export$136073280381448e(props, state, ref) {
1076
1077
  isDisabled = isDisabled || state.isCellDisabled(date);
1077
1078
  let isUnavailable = state.isCellUnavailable(date);
1078
1079
  let isSelectable = !isDisabled && !isUnavailable;
1079
- let isInvalid = state.validationState === "invalid" && ("highlightedRange" in state ? !state.anchorDate && state.highlightedRange && date.compare(state.highlightedRange.start) >= 0 && date.compare(state.highlightedRange.end) <= 0 : state.value && (0, $amWdn$isSameDay)(state.value, date));
1080
+ let isInvalid = state.isValueInvalid && ("highlightedRange" in state ? !state.anchorDate && state.highlightedRange && date.compare(state.highlightedRange.start) >= 0 && date.compare(state.highlightedRange.end) <= 0 : state.value && (0, $amWdn$isSameDay)(state.value, date));
1080
1081
  if (isInvalid) isSelected = true;
1081
1082
  // For performance, reuse the same date object as before if the new date prop is the same.
1082
1083
  // This allows subsequent useMemo results to be reused.
@@ -1126,7 +1127,7 @@ function $36a0ac60f04457c5$export$136073280381448e(props, state, ref) {
1126
1127
  let isAnchorPressed = (0, $amWdn$useRef)(false);
1127
1128
  let isRangeBoundaryPressed = (0, $amWdn$useRef)(false);
1128
1129
  let touchDragTimerRef = (0, $amWdn$useRef)(null);
1129
- let { pressProps: pressProps , isPressed: isPressed } = (0, $amWdn$usePress)({
1130
+ let { pressProps: pressProps, isPressed: isPressed } = (0, $amWdn$usePress)({
1130
1131
  // When dragging to select a range, we don't want dragging over the original anchor
1131
1132
  // again to trigger onPressStart. Cancel presses immediately when the pointer exits.
1132
1133
  shouldCancelOnPointerExit: "anchorDate" in state && !!state.anchorDate,
package/dist/main.js CHANGED
@@ -685,7 +685,7 @@ function $df1d8e967e73ec8e$export$134cbb7fb09a9522(date) {
685
685
  function $df1d8e967e73ec8e$export$b6df97c887c38e1a(state) {
686
686
  let stringFormatter = (0, $jzHdg$reactariai18n.useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($bd6dc95a3c5ee5cd$exports))));
687
687
  let start, end;
688
- if ("highlightedRange" in state) ({ start: start , end: end } = state.highlightedRange || {});
688
+ if ("highlightedRange" in state) ({ start: start, end: end } = state.highlightedRange || {});
689
689
  else start = end = state.value;
690
690
  let dateFormatter = (0, $jzHdg$reactariai18n.useDateFormatter)({
691
691
  weekday: "long",
@@ -808,6 +808,7 @@ function $02ef492a56b91cb2$export$d652b3ea2d672d5b(props, state) {
808
808
  ]);
809
809
  let errorMessageId = (0, $jzHdg$reactariautils.useSlotId)([
810
810
  Boolean(props.errorMessage),
811
+ props.isInvalid,
811
812
  props.validationState
812
813
  ]);
813
814
  // Pass the label to the child grid elements.
@@ -940,8 +941,8 @@ function $c49ada48cbc48220$export$87e0539f600c24e5(props, state, ref) {
940
941
 
941
942
 
942
943
  function $a07388a797d86b95$export$cb95147730a423f5(props, state) {
943
- let { startDate: startDate = state.visibleRange.start , endDate: endDate = state.visibleRange.end } = props;
944
- let { direction: direction } = (0, $jzHdg$reactariai18n.useLocale)();
944
+ let { startDate: startDate = state.visibleRange.start, endDate: endDate = state.visibleRange.end } = props;
945
+ let { direction: direction } = (0, $jzHdg$reactariai18n.useLocale)();
945
946
  let onKeyDown = (e)=>{
946
947
  switch(e.key){
947
948
  case "Enter":
@@ -1001,7 +1002,7 @@ function $a07388a797d86b95$export$cb95147730a423f5(props, state) {
1001
1002
  }
1002
1003
  };
1003
1004
  let visibleRangeDescription = (0, $df1d8e967e73ec8e$export$31afe65d91ef6e8)(startDate, endDate, state.timeZone, true);
1004
- let { ariaLabel: ariaLabel , ariaLabelledBy: ariaLabelledBy } = (0, $df1d8e967e73ec8e$export$653eddfc964b0f8a).get(state);
1005
+ let { ariaLabel: ariaLabel, ariaLabelledBy: ariaLabelledBy } = (0, $df1d8e967e73ec8e$export$653eddfc964b0f8a).get(state);
1005
1006
  let labelProps = (0, $jzHdg$reactariautils.useLabels)({
1006
1007
  "aria-label": [
1007
1008
  ariaLabel,
@@ -1013,7 +1014,7 @@ function $a07388a797d86b95$export$cb95147730a423f5(props, state) {
1013
1014
  weekday: props.weekdayStyle || "narrow",
1014
1015
  timeZone: state.timeZone
1015
1016
  });
1016
- let { locale: locale } = (0, $jzHdg$reactariai18n.useLocale)();
1017
+ let { locale: locale } = (0, $jzHdg$reactariai18n.useLocale)();
1017
1018
  let weekDays = (0, $jzHdg$react.useMemo)(()=>{
1018
1019
  let weekStart = (0, $jzHdg$internationalizeddate.startOfWeek)((0, $jzHdg$internationalizeddate.today)(state.timeZone), locale);
1019
1020
  return [
@@ -1068,8 +1069,8 @@ function $a07388a797d86b95$export$cb95147730a423f5(props, state) {
1068
1069
 
1069
1070
 
1070
1071
  function $4d833327a32c9193$export$136073280381448e(props, state, ref) {
1071
- let { date: date , isDisabled: isDisabled } = props;
1072
- let { errorMessageId: errorMessageId , selectedDateDescription: selectedDateDescription } = (0, $df1d8e967e73ec8e$export$653eddfc964b0f8a).get(state);
1072
+ let { date: date, isDisabled: isDisabled } = props;
1073
+ let { errorMessageId: errorMessageId, selectedDateDescription: selectedDateDescription } = (0, $df1d8e967e73ec8e$export$653eddfc964b0f8a).get(state);
1073
1074
  let stringFormatter = (0, $jzHdg$reactariai18n.useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($bd6dc95a3c5ee5cd$exports))));
1074
1075
  let dateFormatter = (0, $jzHdg$reactariai18n.useDateFormatter)({
1075
1076
  weekday: "long",
@@ -1084,7 +1085,7 @@ function $4d833327a32c9193$export$136073280381448e(props, state, ref) {
1084
1085
  isDisabled = isDisabled || state.isCellDisabled(date);
1085
1086
  let isUnavailable = state.isCellUnavailable(date);
1086
1087
  let isSelectable = !isDisabled && !isUnavailable;
1087
- let isInvalid = state.validationState === "invalid" && ("highlightedRange" in state ? !state.anchorDate && state.highlightedRange && date.compare(state.highlightedRange.start) >= 0 && date.compare(state.highlightedRange.end) <= 0 : state.value && (0, $jzHdg$internationalizeddate.isSameDay)(state.value, date));
1088
+ let isInvalid = state.isValueInvalid && ("highlightedRange" in state ? !state.anchorDate && state.highlightedRange && date.compare(state.highlightedRange.start) >= 0 && date.compare(state.highlightedRange.end) <= 0 : state.value && (0, $jzHdg$internationalizeddate.isSameDay)(state.value, date));
1088
1089
  if (isInvalid) isSelected = true;
1089
1090
  // For performance, reuse the same date object as before if the new date prop is the same.
1090
1091
  // This allows subsequent useMemo results to be reused.
@@ -1134,7 +1135,7 @@ function $4d833327a32c9193$export$136073280381448e(props, state, ref) {
1134
1135
  let isAnchorPressed = (0, $jzHdg$react.useRef)(false);
1135
1136
  let isRangeBoundaryPressed = (0, $jzHdg$react.useRef)(false);
1136
1137
  let touchDragTimerRef = (0, $jzHdg$react.useRef)(null);
1137
- let { pressProps: pressProps , isPressed: isPressed } = (0, $jzHdg$reactariainteractions.usePress)({
1138
+ let { pressProps: pressProps, isPressed: isPressed } = (0, $jzHdg$reactariainteractions.usePress)({
1138
1139
  // When dragging to select a range, we don't want dragging over the original anchor
1139
1140
  // again to trigger onPressStart. Cancel presses immediately when the pointer exits.
1140
1141
  shouldCancelOnPointerExit: "anchorDate" in state && !!state.anchorDate,