@react-aria/calendar 3.5.7 → 3.5.8

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.
Files changed (52) hide show
  1. package/dist/ar-AE.mjs +1 -1
  2. package/dist/bg-BG.mjs +1 -1
  3. package/dist/cs-CZ.mjs +1 -1
  4. package/dist/da-DK.mjs +1 -1
  5. package/dist/de-DE.mjs +1 -1
  6. package/dist/el-GR.mjs +1 -1
  7. package/dist/en-US.mjs +1 -1
  8. package/dist/es-ES.mjs +1 -1
  9. package/dist/et-EE.mjs +1 -1
  10. package/dist/fi-FI.mjs +1 -1
  11. package/dist/fr-FR.mjs +1 -1
  12. package/dist/he-IL.mjs +1 -1
  13. package/dist/hr-HR.mjs +1 -1
  14. package/dist/hu-HU.mjs +1 -1
  15. package/dist/intlStrings.mjs +1 -1
  16. package/dist/it-IT.mjs +1 -1
  17. package/dist/ja-JP.mjs +1 -1
  18. package/dist/ko-KR.mjs +1 -1
  19. package/dist/lt-LT.mjs +1 -1
  20. package/dist/lv-LV.mjs +1 -1
  21. package/dist/nb-NO.mjs +1 -1
  22. package/dist/nl-NL.mjs +1 -1
  23. package/dist/pl-PL.mjs +1 -1
  24. package/dist/pt-BR.mjs +1 -1
  25. package/dist/pt-PT.mjs +1 -1
  26. package/dist/ro-RO.mjs +1 -1
  27. package/dist/ru-RU.mjs +1 -1
  28. package/dist/sk-SK.mjs +1 -1
  29. package/dist/sl-SI.mjs +1 -1
  30. package/dist/sr-SP.mjs +1 -1
  31. package/dist/sv-SE.mjs +1 -1
  32. package/dist/tr-TR.mjs +1 -1
  33. package/dist/uk-UA.mjs +1 -1
  34. package/dist/useCalendar.mjs +1 -1
  35. package/dist/useCalendarBase.main.js +13 -13
  36. package/dist/useCalendarBase.mjs +14 -14
  37. package/dist/useCalendarBase.module.js +13 -13
  38. package/dist/useCalendarCell.main.js +40 -40
  39. package/dist/useCalendarCell.mjs +41 -41
  40. package/dist/useCalendarCell.module.js +40 -40
  41. package/dist/useCalendarGrid.main.js +23 -23
  42. package/dist/useCalendarGrid.mjs +24 -24
  43. package/dist/useCalendarGrid.module.js +23 -23
  44. package/dist/useRangeCalendar.main.js +4 -4
  45. package/dist/useRangeCalendar.mjs +5 -5
  46. package/dist/useRangeCalendar.module.js +4 -4
  47. package/dist/utils.main.js +22 -22
  48. package/dist/utils.mjs +23 -23
  49. package/dist/utils.module.js +22 -22
  50. package/dist/zh-CN.mjs +1 -1
  51. package/dist/zh-TW.mjs +1 -1
  52. package/package.json +11 -11
@@ -36,12 +36,12 @@ $parcel$export(module.exports, "useCalendarCell", () => $4d833327a32c9193$export
36
36
  function $4d833327a32c9193$export$136073280381448e(props, state, ref) {
37
37
  let { date: date, isDisabled: isDisabled } = props;
38
38
  let { errorMessageId: errorMessageId, selectedDateDescription: selectedDateDescription } = (0, $df1d8e967e73ec8e$exports.hookData).get(state);
39
- let stringFormatter = (0, $cuS6T$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($bd6dc95a3c5ee5cd$exports))), "@react-aria/calendar");
39
+ let stringFormatter = (0, $cuS6T$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($bd6dc95a3c5ee5cd$exports))), '@react-aria/calendar');
40
40
  let dateFormatter = (0, $cuS6T$reactariai18n.useDateFormatter)({
41
- weekday: "long",
42
- day: "numeric",
43
- month: "long",
44
- year: "numeric",
41
+ weekday: 'long',
42
+ day: 'numeric',
43
+ month: 'long',
44
+ year: 'numeric',
45
45
  era: (0, $df1d8e967e73ec8e$exports.getEraFormat)(date),
46
46
  timeZone: state.timeZone
47
47
  });
@@ -50,7 +50,7 @@ function $4d833327a32c9193$export$136073280381448e(props, state, ref) {
50
50
  isDisabled = isDisabled || state.isCellDisabled(date);
51
51
  let isUnavailable = state.isCellUnavailable(date);
52
52
  let isSelectable = !isDisabled && !isUnavailable;
53
- 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, $cuS6T$internationalizeddate.isSameDay)(state.value, date));
53
+ 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, $cuS6T$internationalizeddate.isSameDay)(state.value, date));
54
54
  if (isInvalid) isSelected = true;
55
55
  // For performance, reuse the same date object as before if the new date prop is the same.
56
56
  // This allows subsequent useMemo results to be reused.
@@ -62,21 +62,21 @@ function $4d833327a32c9193$export$136073280381448e(props, state, ref) {
62
62
  // aria-label should be localize Day of week, Month, Day and Year without Time.
63
63
  let isDateToday = (0, $cuS6T$internationalizeddate.isToday)(date, state.timeZone);
64
64
  let label = (0, $cuS6T$react.useMemo)(()=>{
65
- let label = "";
65
+ let label = '';
66
66
  // If this is a range calendar, add a description of the full selected range
67
67
  // to the first and last selected date.
68
- if ("highlightedRange" in state && state.value && !state.anchorDate && ((0, $cuS6T$internationalizeddate.isSameDay)(date, state.value.start) || (0, $cuS6T$internationalizeddate.isSameDay)(date, state.value.end))) label = selectedDateDescription + ", ";
68
+ if ('highlightedRange' in state && state.value && !state.anchorDate && ((0, $cuS6T$internationalizeddate.isSameDay)(date, state.value.start) || (0, $cuS6T$internationalizeddate.isSameDay)(date, state.value.end))) label = selectedDateDescription + ', ';
69
69
  label += dateFormatter.format(nativeDate);
70
70
  if (isDateToday) // If date is today, set appropriate string depending on selected state:
71
- label = stringFormatter.format(isSelected ? "todayDateSelected" : "todayDate", {
71
+ label = stringFormatter.format(isSelected ? 'todayDateSelected' : 'todayDate', {
72
72
  date: label
73
73
  });
74
74
  else if (isSelected) // If date is selected but not today:
75
- label = stringFormatter.format("dateSelected", {
75
+ label = stringFormatter.format('dateSelected', {
76
76
  date: label
77
77
  });
78
- if (state.minValue && (0, $cuS6T$internationalizeddate.isSameDay)(date, state.minValue)) label += ", " + stringFormatter.format("minimumDate");
79
- else if (state.maxValue && (0, $cuS6T$internationalizeddate.isSameDay)(date, state.maxValue)) label += ", " + stringFormatter.format("maximumDate");
78
+ if (state.minValue && (0, $cuS6T$internationalizeddate.isSameDay)(date, state.minValue)) label += ', ' + stringFormatter.format('minimumDate');
79
+ else if (state.maxValue && (0, $cuS6T$internationalizeddate.isSameDay)(date, state.maxValue)) label += ', ' + stringFormatter.format('maximumDate');
80
80
  return label;
81
81
  }, [
82
82
  dateFormatter,
@@ -90,11 +90,11 @@ function $4d833327a32c9193$export$136073280381448e(props, state, ref) {
90
90
  ]);
91
91
  // When a cell is focused and this is a range calendar, add a prompt to help
92
92
  // screenreader users know that they are in a range selection mode.
93
- let rangeSelectionPrompt = "";
94
- if ("anchorDate" in state && isFocused && !state.isReadOnly && isSelectable) {
93
+ let rangeSelectionPrompt = '';
94
+ if ('anchorDate' in state && isFocused && !state.isReadOnly && isSelectable) {
95
95
  // If selection has started add "click to finish selecting range"
96
- if (state.anchorDate) rangeSelectionPrompt = stringFormatter.format("finishRangeSelectionPrompt");
97
- else rangeSelectionPrompt = stringFormatter.format("startRangeSelectionPrompt");
96
+ if (state.anchorDate) rangeSelectionPrompt = stringFormatter.format('finishRangeSelectionPrompt');
97
+ else rangeSelectionPrompt = stringFormatter.format('startRangeSelectionPrompt');
98
98
  }
99
99
  let descriptionProps = (0, $cuS6T$reactariautils.useDescription)(rangeSelectionPrompt);
100
100
  let isAnchorPressed = (0, $cuS6T$react.useRef)(false);
@@ -103,7 +103,7 @@ function $4d833327a32c9193$export$136073280381448e(props, state, ref) {
103
103
  let { pressProps: pressProps, isPressed: isPressed } = (0, $cuS6T$reactariainteractions.usePress)({
104
104
  // When dragging to select a range, we don't want dragging over the original anchor
105
105
  // again to trigger onPressStart. Cancel presses immediately when the pointer exits.
106
- shouldCancelOnPointerExit: "anchorDate" in state && !!state.anchorDate,
106
+ shouldCancelOnPointerExit: 'anchorDate' in state && !!state.anchorDate,
107
107
  preventFocusOnPress: true,
108
108
  isDisabled: !isSelectable || state.isReadOnly,
109
109
  onPressStart (e) {
@@ -111,7 +111,7 @@ function $4d833327a32c9193$export$136073280381448e(props, state, ref) {
111
111
  state.setFocusedDate(date);
112
112
  return;
113
113
  }
114
- if ("highlightedRange" in state && !state.anchorDate && (e.pointerType === "mouse" || e.pointerType === "touch")) {
114
+ if ('highlightedRange' in state && !state.anchorDate && (e.pointerType === 'mouse' || e.pointerType === 'touch')) {
115
115
  // Allow dragging the start or end date of a range to modify it
116
116
  // rather than starting a new selection.
117
117
  // Don't allow dragging when invalid, or weird jumping behavior may occur as date ranges
@@ -140,7 +140,7 @@ function $4d833327a32c9193$export$136073280381448e(props, state, ref) {
140
140
  };
141
141
  // Start selection on mouse/touch down so users can drag to select a range.
142
142
  // On touch, delay dragging to determine if the user really meant to scroll.
143
- if (e.pointerType === "touch") touchDragTimerRef.current = setTimeout(startDragging, 200);
143
+ if (e.pointerType === 'touch') touchDragTimerRef.current = setTimeout(startDragging, 200);
144
144
  else startDragging();
145
145
  }
146
146
  },
@@ -152,7 +152,7 @@ function $4d833327a32c9193$export$136073280381448e(props, state, ref) {
152
152
  },
153
153
  onPress () {
154
154
  // For non-range selection, always select on press up.
155
- if (!("anchorDate" in state) && !state.isReadOnly) {
155
+ if (!('anchorDate' in state) && !state.isReadOnly) {
156
156
  state.selectDate(date);
157
157
  state.setFocusedDate(date);
158
158
  }
@@ -162,11 +162,11 @@ function $4d833327a32c9193$export$136073280381448e(props, state, ref) {
162
162
  // If the user tapped quickly, the date won't be selected yet and the
163
163
  // timer will still be in progress. In this case, select the date on touch up.
164
164
  // Timer is cleared in onPressEnd.
165
- if ("anchorDate" in state && touchDragTimerRef.current) {
165
+ if ('anchorDate' in state && touchDragTimerRef.current) {
166
166
  state.selectDate(date);
167
167
  state.setFocusedDate(date);
168
168
  }
169
- if ("anchorDate" in state) {
169
+ if ('anchorDate' in state) {
170
170
  if (isRangeBoundaryPressed.current) // When clicking on the start or end date of an already selected range,
171
171
  // start a new selection on press up to also allow dragging the date to
172
172
  // change the existing range.
@@ -175,7 +175,7 @@ function $4d833327a32c9193$export$136073280381448e(props, state, ref) {
175
175
  // When releasing a drag or pressing the end date of a range, select it.
176
176
  state.selectDate(date);
177
177
  state.setFocusedDate(date);
178
- } else if (e.pointerType === "keyboard" && !state.anchorDate) {
178
+ } else if (e.pointerType === 'keyboard' && !state.anchorDate) {
179
179
  // For range selection, auto-advance the focused date by one if using keyboard.
180
180
  // This gives an indication that you're selecting a range rather than a single date.
181
181
  // For mouse, this is unnecessary because users will see the indication on hover. For screen readers,
@@ -188,7 +188,7 @@ function $4d833327a32c9193$export$136073280381448e(props, state, ref) {
188
188
  days: 1
189
189
  });
190
190
  if (!state.isInvalid(nextDay)) state.setFocusedDate(nextDay);
191
- } else if (e.pointerType === "virtual") {
191
+ } else if (e.pointerType === 'virtual') {
192
192
  // For screen readers, just select the date on click.
193
193
  state.selectDate(date);
194
194
  state.setFocusedDate(date);
@@ -209,7 +209,7 @@ function $4d833327a32c9193$export$136073280381448e(props, state, ref) {
209
209
  // Also only scroll into view if the cell actually got focused.
210
210
  // There are some cases where the cell might be disabled or inside,
211
211
  // an inert container and we don't want to scroll then.
212
- if ((0, $cuS6T$reactariainteractions.getInteractionModality)() !== "pointer" && document.activeElement === ref.current) (0, $cuS6T$reactariautils.scrollIntoViewport)(ref.current, {
212
+ if ((0, $cuS6T$reactariainteractions.getInteractionModality)() !== 'pointer' && document.activeElement === ref.current) (0, $cuS6T$reactariautils.scrollIntoViewport)(ref.current, {
213
213
  containingElement: (0, $cuS6T$reactariautils.getScrollParent)(ref.current)
214
214
  });
215
215
  }
@@ -218,43 +218,43 @@ function $4d833327a32c9193$export$136073280381448e(props, state, ref) {
218
218
  ref
219
219
  ]);
220
220
  let cellDateFormatter = (0, $cuS6T$reactariai18n.useDateFormatter)({
221
- day: "numeric",
221
+ day: 'numeric',
222
222
  timeZone: state.timeZone,
223
223
  calendar: date.calendar.identifier
224
224
  });
225
- let formattedDate = (0, $cuS6T$react.useMemo)(()=>cellDateFormatter.formatToParts(nativeDate).find((part)=>part.type === "day").value, [
225
+ let formattedDate = (0, $cuS6T$react.useMemo)(()=>cellDateFormatter.formatToParts(nativeDate).find((part)=>part.type === 'day').value, [
226
226
  cellDateFormatter,
227
227
  nativeDate
228
228
  ]);
229
229
  return {
230
230
  cellProps: {
231
- role: "gridcell",
232
- "aria-disabled": !isSelectable || null,
233
- "aria-selected": isSelected || null,
234
- "aria-invalid": isInvalid || null
231
+ role: 'gridcell',
232
+ 'aria-disabled': !isSelectable || null,
233
+ 'aria-selected': isSelected || null,
234
+ 'aria-invalid': isInvalid || null
235
235
  },
236
236
  buttonProps: (0, $cuS6T$reactariautils.mergeProps)(pressProps, {
237
237
  onFocus () {
238
238
  if (!isDisabled) state.setFocusedDate(date);
239
239
  },
240
240
  tabIndex: tabIndex,
241
- role: "button",
242
- "aria-disabled": !isSelectable || null,
243
- "aria-label": label,
244
- "aria-invalid": isInvalid || null,
245
- "aria-describedby": [
241
+ role: 'button',
242
+ 'aria-disabled': !isSelectable || null,
243
+ 'aria-label': label,
244
+ 'aria-invalid': isInvalid || null,
245
+ 'aria-describedby': [
246
246
  isInvalid ? errorMessageId : null,
247
- descriptionProps["aria-describedby"]
248
- ].filter(Boolean).join(" ") || undefined,
247
+ descriptionProps['aria-describedby']
248
+ ].filter(Boolean).join(' ') || undefined,
249
249
  onPointerEnter (e) {
250
250
  // Highlight the date on hover or drag over a date when selecting a range.
251
- if ("highlightDate" in state && (e.pointerType !== "touch" || state.isDragging) && isSelectable) state.highlightDate(date);
251
+ if ('highlightDate' in state && (e.pointerType !== 'touch' || state.isDragging) && isSelectable) state.highlightDate(date);
252
252
  },
253
253
  onPointerDown (e) {
254
254
  // This is necessary on touch devices to allow dragging
255
255
  // outside the original pressed element.
256
256
  // (JSDOM does not support this)
257
- if ("releasePointerCapture" in e.target) e.target.releasePointerCapture(e.pointerId);
257
+ if ('releasePointerCapture' in e.target) e.target.releasePointerCapture(e.pointerId);
258
258
  },
259
259
  onContextMenu (e) {
260
260
  // Prevent context menu on long press.
@@ -30,12 +30,12 @@ function $parcel$interopDefault(a) {
30
30
  function $36a0ac60f04457c5$export$136073280381448e(props, state, ref) {
31
31
  let { date: date, isDisabled: isDisabled } = props;
32
32
  let { errorMessageId: errorMessageId, selectedDateDescription: selectedDateDescription } = (0, $a074e1e2d0f0a665$export$653eddfc964b0f8a).get(state);
33
- let stringFormatter = (0, $dm6hl$useLocalizedStringFormatter)((0, ($parcel$interopDefault($dm6hl$intlStringsmodulejs))), "@react-aria/calendar");
33
+ let stringFormatter = (0, $dm6hl$useLocalizedStringFormatter)((0, ($parcel$interopDefault($dm6hl$intlStringsmodulejs))), '@react-aria/calendar');
34
34
  let dateFormatter = (0, $dm6hl$useDateFormatter)({
35
- weekday: "long",
36
- day: "numeric",
37
- month: "long",
38
- year: "numeric",
35
+ weekday: 'long',
36
+ day: 'numeric',
37
+ month: 'long',
38
+ year: 'numeric',
39
39
  era: (0, $a074e1e2d0f0a665$export$134cbb7fb09a9522)(date),
40
40
  timeZone: state.timeZone
41
41
  });
@@ -44,7 +44,7 @@ function $36a0ac60f04457c5$export$136073280381448e(props, state, ref) {
44
44
  isDisabled = isDisabled || state.isCellDisabled(date);
45
45
  let isUnavailable = state.isCellUnavailable(date);
46
46
  let isSelectable = !isDisabled && !isUnavailable;
47
- 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, $dm6hl$isSameDay)(state.value, date));
47
+ 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, $dm6hl$isSameDay)(state.value, date));
48
48
  if (isInvalid) isSelected = true;
49
49
  // For performance, reuse the same date object as before if the new date prop is the same.
50
50
  // This allows subsequent useMemo results to be reused.
@@ -56,21 +56,21 @@ function $36a0ac60f04457c5$export$136073280381448e(props, state, ref) {
56
56
  // aria-label should be localize Day of week, Month, Day and Year without Time.
57
57
  let isDateToday = (0, $dm6hl$isToday)(date, state.timeZone);
58
58
  let label = (0, $dm6hl$useMemo)(()=>{
59
- let label = "";
59
+ let label = '';
60
60
  // If this is a range calendar, add a description of the full selected range
61
61
  // to the first and last selected date.
62
- if ("highlightedRange" in state && state.value && !state.anchorDate && ((0, $dm6hl$isSameDay)(date, state.value.start) || (0, $dm6hl$isSameDay)(date, state.value.end))) label = selectedDateDescription + ", ";
62
+ if ('highlightedRange' in state && state.value && !state.anchorDate && ((0, $dm6hl$isSameDay)(date, state.value.start) || (0, $dm6hl$isSameDay)(date, state.value.end))) label = selectedDateDescription + ', ';
63
63
  label += dateFormatter.format(nativeDate);
64
64
  if (isDateToday) // If date is today, set appropriate string depending on selected state:
65
- label = stringFormatter.format(isSelected ? "todayDateSelected" : "todayDate", {
65
+ label = stringFormatter.format(isSelected ? 'todayDateSelected' : 'todayDate', {
66
66
  date: label
67
67
  });
68
68
  else if (isSelected) // If date is selected but not today:
69
- label = stringFormatter.format("dateSelected", {
69
+ label = stringFormatter.format('dateSelected', {
70
70
  date: label
71
71
  });
72
- if (state.minValue && (0, $dm6hl$isSameDay)(date, state.minValue)) label += ", " + stringFormatter.format("minimumDate");
73
- else if (state.maxValue && (0, $dm6hl$isSameDay)(date, state.maxValue)) label += ", " + stringFormatter.format("maximumDate");
72
+ if (state.minValue && (0, $dm6hl$isSameDay)(date, state.minValue)) label += ', ' + stringFormatter.format('minimumDate');
73
+ else if (state.maxValue && (0, $dm6hl$isSameDay)(date, state.maxValue)) label += ', ' + stringFormatter.format('maximumDate');
74
74
  return label;
75
75
  }, [
76
76
  dateFormatter,
@@ -84,11 +84,11 @@ function $36a0ac60f04457c5$export$136073280381448e(props, state, ref) {
84
84
  ]);
85
85
  // When a cell is focused and this is a range calendar, add a prompt to help
86
86
  // screenreader users know that they are in a range selection mode.
87
- let rangeSelectionPrompt = "";
88
- if ("anchorDate" in state && isFocused && !state.isReadOnly && isSelectable) {
87
+ let rangeSelectionPrompt = '';
88
+ if ('anchorDate' in state && isFocused && !state.isReadOnly && isSelectable) {
89
89
  // If selection has started add "click to finish selecting range"
90
- if (state.anchorDate) rangeSelectionPrompt = stringFormatter.format("finishRangeSelectionPrompt");
91
- else rangeSelectionPrompt = stringFormatter.format("startRangeSelectionPrompt");
90
+ if (state.anchorDate) rangeSelectionPrompt = stringFormatter.format('finishRangeSelectionPrompt');
91
+ else rangeSelectionPrompt = stringFormatter.format('startRangeSelectionPrompt');
92
92
  }
93
93
  let descriptionProps = (0, $dm6hl$useDescription)(rangeSelectionPrompt);
94
94
  let isAnchorPressed = (0, $dm6hl$useRef)(false);
@@ -97,7 +97,7 @@ function $36a0ac60f04457c5$export$136073280381448e(props, state, ref) {
97
97
  let { pressProps: pressProps, isPressed: isPressed } = (0, $dm6hl$usePress)({
98
98
  // When dragging to select a range, we don't want dragging over the original anchor
99
99
  // again to trigger onPressStart. Cancel presses immediately when the pointer exits.
100
- shouldCancelOnPointerExit: "anchorDate" in state && !!state.anchorDate,
100
+ shouldCancelOnPointerExit: 'anchorDate' in state && !!state.anchorDate,
101
101
  preventFocusOnPress: true,
102
102
  isDisabled: !isSelectable || state.isReadOnly,
103
103
  onPressStart (e) {
@@ -105,7 +105,7 @@ function $36a0ac60f04457c5$export$136073280381448e(props, state, ref) {
105
105
  state.setFocusedDate(date);
106
106
  return;
107
107
  }
108
- if ("highlightedRange" in state && !state.anchorDate && (e.pointerType === "mouse" || e.pointerType === "touch")) {
108
+ if ('highlightedRange' in state && !state.anchorDate && (e.pointerType === 'mouse' || e.pointerType === 'touch')) {
109
109
  // Allow dragging the start or end date of a range to modify it
110
110
  // rather than starting a new selection.
111
111
  // Don't allow dragging when invalid, or weird jumping behavior may occur as date ranges
@@ -134,7 +134,7 @@ function $36a0ac60f04457c5$export$136073280381448e(props, state, ref) {
134
134
  };
135
135
  // Start selection on mouse/touch down so users can drag to select a range.
136
136
  // On touch, delay dragging to determine if the user really meant to scroll.
137
- if (e.pointerType === "touch") touchDragTimerRef.current = setTimeout(startDragging, 200);
137
+ if (e.pointerType === 'touch') touchDragTimerRef.current = setTimeout(startDragging, 200);
138
138
  else startDragging();
139
139
  }
140
140
  },
@@ -146,7 +146,7 @@ function $36a0ac60f04457c5$export$136073280381448e(props, state, ref) {
146
146
  },
147
147
  onPress () {
148
148
  // For non-range selection, always select on press up.
149
- if (!("anchorDate" in state) && !state.isReadOnly) {
149
+ if (!('anchorDate' in state) && !state.isReadOnly) {
150
150
  state.selectDate(date);
151
151
  state.setFocusedDate(date);
152
152
  }
@@ -156,11 +156,11 @@ function $36a0ac60f04457c5$export$136073280381448e(props, state, ref) {
156
156
  // If the user tapped quickly, the date won't be selected yet and the
157
157
  // timer will still be in progress. In this case, select the date on touch up.
158
158
  // Timer is cleared in onPressEnd.
159
- if ("anchorDate" in state && touchDragTimerRef.current) {
159
+ if ('anchorDate' in state && touchDragTimerRef.current) {
160
160
  state.selectDate(date);
161
161
  state.setFocusedDate(date);
162
162
  }
163
- if ("anchorDate" in state) {
163
+ if ('anchorDate' in state) {
164
164
  if (isRangeBoundaryPressed.current) // When clicking on the start or end date of an already selected range,
165
165
  // start a new selection on press up to also allow dragging the date to
166
166
  // change the existing range.
@@ -169,7 +169,7 @@ function $36a0ac60f04457c5$export$136073280381448e(props, state, ref) {
169
169
  // When releasing a drag or pressing the end date of a range, select it.
170
170
  state.selectDate(date);
171
171
  state.setFocusedDate(date);
172
- } else if (e.pointerType === "keyboard" && !state.anchorDate) {
172
+ } else if (e.pointerType === 'keyboard' && !state.anchorDate) {
173
173
  // For range selection, auto-advance the focused date by one if using keyboard.
174
174
  // This gives an indication that you're selecting a range rather than a single date.
175
175
  // For mouse, this is unnecessary because users will see the indication on hover. For screen readers,
@@ -182,7 +182,7 @@ function $36a0ac60f04457c5$export$136073280381448e(props, state, ref) {
182
182
  days: 1
183
183
  });
184
184
  if (!state.isInvalid(nextDay)) state.setFocusedDate(nextDay);
185
- } else if (e.pointerType === "virtual") {
185
+ } else if (e.pointerType === 'virtual') {
186
186
  // For screen readers, just select the date on click.
187
187
  state.selectDate(date);
188
188
  state.setFocusedDate(date);
@@ -203,7 +203,7 @@ function $36a0ac60f04457c5$export$136073280381448e(props, state, ref) {
203
203
  // Also only scroll into view if the cell actually got focused.
204
204
  // There are some cases where the cell might be disabled or inside,
205
205
  // an inert container and we don't want to scroll then.
206
- if ((0, $dm6hl$getInteractionModality)() !== "pointer" && document.activeElement === ref.current) (0, $dm6hl$scrollIntoViewport)(ref.current, {
206
+ if ((0, $dm6hl$getInteractionModality)() !== 'pointer' && document.activeElement === ref.current) (0, $dm6hl$scrollIntoViewport)(ref.current, {
207
207
  containingElement: (0, $dm6hl$getScrollParent)(ref.current)
208
208
  });
209
209
  }
@@ -212,43 +212,43 @@ function $36a0ac60f04457c5$export$136073280381448e(props, state, ref) {
212
212
  ref
213
213
  ]);
214
214
  let cellDateFormatter = (0, $dm6hl$useDateFormatter)({
215
- day: "numeric",
215
+ day: 'numeric',
216
216
  timeZone: state.timeZone,
217
217
  calendar: date.calendar.identifier
218
218
  });
219
- let formattedDate = (0, $dm6hl$useMemo)(()=>cellDateFormatter.formatToParts(nativeDate).find((part)=>part.type === "day").value, [
219
+ let formattedDate = (0, $dm6hl$useMemo)(()=>cellDateFormatter.formatToParts(nativeDate).find((part)=>part.type === 'day').value, [
220
220
  cellDateFormatter,
221
221
  nativeDate
222
222
  ]);
223
223
  return {
224
224
  cellProps: {
225
- role: "gridcell",
226
- "aria-disabled": !isSelectable || null,
227
- "aria-selected": isSelected || null,
228
- "aria-invalid": isInvalid || null
225
+ role: 'gridcell',
226
+ 'aria-disabled': !isSelectable || null,
227
+ 'aria-selected': isSelected || null,
228
+ 'aria-invalid': isInvalid || null
229
229
  },
230
230
  buttonProps: (0, $dm6hl$mergeProps)(pressProps, {
231
231
  onFocus () {
232
232
  if (!isDisabled) state.setFocusedDate(date);
233
233
  },
234
234
  tabIndex: tabIndex,
235
- role: "button",
236
- "aria-disabled": !isSelectable || null,
237
- "aria-label": label,
238
- "aria-invalid": isInvalid || null,
239
- "aria-describedby": [
235
+ role: 'button',
236
+ 'aria-disabled': !isSelectable || null,
237
+ 'aria-label': label,
238
+ 'aria-invalid': isInvalid || null,
239
+ 'aria-describedby': [
240
240
  isInvalid ? errorMessageId : null,
241
- descriptionProps["aria-describedby"]
242
- ].filter(Boolean).join(" ") || undefined,
241
+ descriptionProps['aria-describedby']
242
+ ].filter(Boolean).join(' ') || undefined,
243
243
  onPointerEnter (e) {
244
244
  // Highlight the date on hover or drag over a date when selecting a range.
245
- if ("highlightDate" in state && (e.pointerType !== "touch" || state.isDragging) && isSelectable) state.highlightDate(date);
245
+ if ('highlightDate' in state && (e.pointerType !== 'touch' || state.isDragging) && isSelectable) state.highlightDate(date);
246
246
  },
247
247
  onPointerDown (e) {
248
248
  // This is necessary on touch devices to allow dragging
249
249
  // outside the original pressed element.
250
250
  // (JSDOM does not support this)
251
- if ("releasePointerCapture" in e.target) e.target.releasePointerCapture(e.pointerId);
251
+ if ('releasePointerCapture' in e.target) e.target.releasePointerCapture(e.pointerId);
252
252
  },
253
253
  onContextMenu (e) {
254
254
  // Prevent context menu on long press.
@@ -268,4 +268,4 @@ function $36a0ac60f04457c5$export$136073280381448e(props, state, ref) {
268
268
 
269
269
 
270
270
  export {$36a0ac60f04457c5$export$136073280381448e as useCalendarCell};
271
- //# sourceMappingURL=useCalendarCell.mjs.map
271
+ //# sourceMappingURL=useCalendarCell.module.js.map
@@ -30,12 +30,12 @@ function $parcel$interopDefault(a) {
30
30
  function $36a0ac60f04457c5$export$136073280381448e(props, state, ref) {
31
31
  let { date: date, isDisabled: isDisabled } = props;
32
32
  let { errorMessageId: errorMessageId, selectedDateDescription: selectedDateDescription } = (0, $a074e1e2d0f0a665$export$653eddfc964b0f8a).get(state);
33
- let stringFormatter = (0, $dm6hl$useLocalizedStringFormatter)((0, ($parcel$interopDefault($dm6hl$intlStringsmodulejs))), "@react-aria/calendar");
33
+ let stringFormatter = (0, $dm6hl$useLocalizedStringFormatter)((0, ($parcel$interopDefault($dm6hl$intlStringsmodulejs))), '@react-aria/calendar');
34
34
  let dateFormatter = (0, $dm6hl$useDateFormatter)({
35
- weekday: "long",
36
- day: "numeric",
37
- month: "long",
38
- year: "numeric",
35
+ weekday: 'long',
36
+ day: 'numeric',
37
+ month: 'long',
38
+ year: 'numeric',
39
39
  era: (0, $a074e1e2d0f0a665$export$134cbb7fb09a9522)(date),
40
40
  timeZone: state.timeZone
41
41
  });
@@ -44,7 +44,7 @@ function $36a0ac60f04457c5$export$136073280381448e(props, state, ref) {
44
44
  isDisabled = isDisabled || state.isCellDisabled(date);
45
45
  let isUnavailable = state.isCellUnavailable(date);
46
46
  let isSelectable = !isDisabled && !isUnavailable;
47
- 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, $dm6hl$isSameDay)(state.value, date));
47
+ 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, $dm6hl$isSameDay)(state.value, date));
48
48
  if (isInvalid) isSelected = true;
49
49
  // For performance, reuse the same date object as before if the new date prop is the same.
50
50
  // This allows subsequent useMemo results to be reused.
@@ -56,21 +56,21 @@ function $36a0ac60f04457c5$export$136073280381448e(props, state, ref) {
56
56
  // aria-label should be localize Day of week, Month, Day and Year without Time.
57
57
  let isDateToday = (0, $dm6hl$isToday)(date, state.timeZone);
58
58
  let label = (0, $dm6hl$useMemo)(()=>{
59
- let label = "";
59
+ let label = '';
60
60
  // If this is a range calendar, add a description of the full selected range
61
61
  // to the first and last selected date.
62
- if ("highlightedRange" in state && state.value && !state.anchorDate && ((0, $dm6hl$isSameDay)(date, state.value.start) || (0, $dm6hl$isSameDay)(date, state.value.end))) label = selectedDateDescription + ", ";
62
+ if ('highlightedRange' in state && state.value && !state.anchorDate && ((0, $dm6hl$isSameDay)(date, state.value.start) || (0, $dm6hl$isSameDay)(date, state.value.end))) label = selectedDateDescription + ', ';
63
63
  label += dateFormatter.format(nativeDate);
64
64
  if (isDateToday) // If date is today, set appropriate string depending on selected state:
65
- label = stringFormatter.format(isSelected ? "todayDateSelected" : "todayDate", {
65
+ label = stringFormatter.format(isSelected ? 'todayDateSelected' : 'todayDate', {
66
66
  date: label
67
67
  });
68
68
  else if (isSelected) // If date is selected but not today:
69
- label = stringFormatter.format("dateSelected", {
69
+ label = stringFormatter.format('dateSelected', {
70
70
  date: label
71
71
  });
72
- if (state.minValue && (0, $dm6hl$isSameDay)(date, state.minValue)) label += ", " + stringFormatter.format("minimumDate");
73
- else if (state.maxValue && (0, $dm6hl$isSameDay)(date, state.maxValue)) label += ", " + stringFormatter.format("maximumDate");
72
+ if (state.minValue && (0, $dm6hl$isSameDay)(date, state.minValue)) label += ', ' + stringFormatter.format('minimumDate');
73
+ else if (state.maxValue && (0, $dm6hl$isSameDay)(date, state.maxValue)) label += ', ' + stringFormatter.format('maximumDate');
74
74
  return label;
75
75
  }, [
76
76
  dateFormatter,
@@ -84,11 +84,11 @@ function $36a0ac60f04457c5$export$136073280381448e(props, state, ref) {
84
84
  ]);
85
85
  // When a cell is focused and this is a range calendar, add a prompt to help
86
86
  // screenreader users know that they are in a range selection mode.
87
- let rangeSelectionPrompt = "";
88
- if ("anchorDate" in state && isFocused && !state.isReadOnly && isSelectable) {
87
+ let rangeSelectionPrompt = '';
88
+ if ('anchorDate' in state && isFocused && !state.isReadOnly && isSelectable) {
89
89
  // If selection has started add "click to finish selecting range"
90
- if (state.anchorDate) rangeSelectionPrompt = stringFormatter.format("finishRangeSelectionPrompt");
91
- else rangeSelectionPrompt = stringFormatter.format("startRangeSelectionPrompt");
90
+ if (state.anchorDate) rangeSelectionPrompt = stringFormatter.format('finishRangeSelectionPrompt');
91
+ else rangeSelectionPrompt = stringFormatter.format('startRangeSelectionPrompt');
92
92
  }
93
93
  let descriptionProps = (0, $dm6hl$useDescription)(rangeSelectionPrompt);
94
94
  let isAnchorPressed = (0, $dm6hl$useRef)(false);
@@ -97,7 +97,7 @@ function $36a0ac60f04457c5$export$136073280381448e(props, state, ref) {
97
97
  let { pressProps: pressProps, isPressed: isPressed } = (0, $dm6hl$usePress)({
98
98
  // When dragging to select a range, we don't want dragging over the original anchor
99
99
  // again to trigger onPressStart. Cancel presses immediately when the pointer exits.
100
- shouldCancelOnPointerExit: "anchorDate" in state && !!state.anchorDate,
100
+ shouldCancelOnPointerExit: 'anchorDate' in state && !!state.anchorDate,
101
101
  preventFocusOnPress: true,
102
102
  isDisabled: !isSelectable || state.isReadOnly,
103
103
  onPressStart (e) {
@@ -105,7 +105,7 @@ function $36a0ac60f04457c5$export$136073280381448e(props, state, ref) {
105
105
  state.setFocusedDate(date);
106
106
  return;
107
107
  }
108
- if ("highlightedRange" in state && !state.anchorDate && (e.pointerType === "mouse" || e.pointerType === "touch")) {
108
+ if ('highlightedRange' in state && !state.anchorDate && (e.pointerType === 'mouse' || e.pointerType === 'touch')) {
109
109
  // Allow dragging the start or end date of a range to modify it
110
110
  // rather than starting a new selection.
111
111
  // Don't allow dragging when invalid, or weird jumping behavior may occur as date ranges
@@ -134,7 +134,7 @@ function $36a0ac60f04457c5$export$136073280381448e(props, state, ref) {
134
134
  };
135
135
  // Start selection on mouse/touch down so users can drag to select a range.
136
136
  // On touch, delay dragging to determine if the user really meant to scroll.
137
- if (e.pointerType === "touch") touchDragTimerRef.current = setTimeout(startDragging, 200);
137
+ if (e.pointerType === 'touch') touchDragTimerRef.current = setTimeout(startDragging, 200);
138
138
  else startDragging();
139
139
  }
140
140
  },
@@ -146,7 +146,7 @@ function $36a0ac60f04457c5$export$136073280381448e(props, state, ref) {
146
146
  },
147
147
  onPress () {
148
148
  // For non-range selection, always select on press up.
149
- if (!("anchorDate" in state) && !state.isReadOnly) {
149
+ if (!('anchorDate' in state) && !state.isReadOnly) {
150
150
  state.selectDate(date);
151
151
  state.setFocusedDate(date);
152
152
  }
@@ -156,11 +156,11 @@ function $36a0ac60f04457c5$export$136073280381448e(props, state, ref) {
156
156
  // If the user tapped quickly, the date won't be selected yet and the
157
157
  // timer will still be in progress. In this case, select the date on touch up.
158
158
  // Timer is cleared in onPressEnd.
159
- if ("anchorDate" in state && touchDragTimerRef.current) {
159
+ if ('anchorDate' in state && touchDragTimerRef.current) {
160
160
  state.selectDate(date);
161
161
  state.setFocusedDate(date);
162
162
  }
163
- if ("anchorDate" in state) {
163
+ if ('anchorDate' in state) {
164
164
  if (isRangeBoundaryPressed.current) // When clicking on the start or end date of an already selected range,
165
165
  // start a new selection on press up to also allow dragging the date to
166
166
  // change the existing range.
@@ -169,7 +169,7 @@ function $36a0ac60f04457c5$export$136073280381448e(props, state, ref) {
169
169
  // When releasing a drag or pressing the end date of a range, select it.
170
170
  state.selectDate(date);
171
171
  state.setFocusedDate(date);
172
- } else if (e.pointerType === "keyboard" && !state.anchorDate) {
172
+ } else if (e.pointerType === 'keyboard' && !state.anchorDate) {
173
173
  // For range selection, auto-advance the focused date by one if using keyboard.
174
174
  // This gives an indication that you're selecting a range rather than a single date.
175
175
  // For mouse, this is unnecessary because users will see the indication on hover. For screen readers,
@@ -182,7 +182,7 @@ function $36a0ac60f04457c5$export$136073280381448e(props, state, ref) {
182
182
  days: 1
183
183
  });
184
184
  if (!state.isInvalid(nextDay)) state.setFocusedDate(nextDay);
185
- } else if (e.pointerType === "virtual") {
185
+ } else if (e.pointerType === 'virtual') {
186
186
  // For screen readers, just select the date on click.
187
187
  state.selectDate(date);
188
188
  state.setFocusedDate(date);
@@ -203,7 +203,7 @@ function $36a0ac60f04457c5$export$136073280381448e(props, state, ref) {
203
203
  // Also only scroll into view if the cell actually got focused.
204
204
  // There are some cases where the cell might be disabled or inside,
205
205
  // an inert container and we don't want to scroll then.
206
- if ((0, $dm6hl$getInteractionModality)() !== "pointer" && document.activeElement === ref.current) (0, $dm6hl$scrollIntoViewport)(ref.current, {
206
+ if ((0, $dm6hl$getInteractionModality)() !== 'pointer' && document.activeElement === ref.current) (0, $dm6hl$scrollIntoViewport)(ref.current, {
207
207
  containingElement: (0, $dm6hl$getScrollParent)(ref.current)
208
208
  });
209
209
  }
@@ -212,43 +212,43 @@ function $36a0ac60f04457c5$export$136073280381448e(props, state, ref) {
212
212
  ref
213
213
  ]);
214
214
  let cellDateFormatter = (0, $dm6hl$useDateFormatter)({
215
- day: "numeric",
215
+ day: 'numeric',
216
216
  timeZone: state.timeZone,
217
217
  calendar: date.calendar.identifier
218
218
  });
219
- let formattedDate = (0, $dm6hl$useMemo)(()=>cellDateFormatter.formatToParts(nativeDate).find((part)=>part.type === "day").value, [
219
+ let formattedDate = (0, $dm6hl$useMemo)(()=>cellDateFormatter.formatToParts(nativeDate).find((part)=>part.type === 'day').value, [
220
220
  cellDateFormatter,
221
221
  nativeDate
222
222
  ]);
223
223
  return {
224
224
  cellProps: {
225
- role: "gridcell",
226
- "aria-disabled": !isSelectable || null,
227
- "aria-selected": isSelected || null,
228
- "aria-invalid": isInvalid || null
225
+ role: 'gridcell',
226
+ 'aria-disabled': !isSelectable || null,
227
+ 'aria-selected': isSelected || null,
228
+ 'aria-invalid': isInvalid || null
229
229
  },
230
230
  buttonProps: (0, $dm6hl$mergeProps)(pressProps, {
231
231
  onFocus () {
232
232
  if (!isDisabled) state.setFocusedDate(date);
233
233
  },
234
234
  tabIndex: tabIndex,
235
- role: "button",
236
- "aria-disabled": !isSelectable || null,
237
- "aria-label": label,
238
- "aria-invalid": isInvalid || null,
239
- "aria-describedby": [
235
+ role: 'button',
236
+ 'aria-disabled': !isSelectable || null,
237
+ 'aria-label': label,
238
+ 'aria-invalid': isInvalid || null,
239
+ 'aria-describedby': [
240
240
  isInvalid ? errorMessageId : null,
241
- descriptionProps["aria-describedby"]
242
- ].filter(Boolean).join(" ") || undefined,
241
+ descriptionProps['aria-describedby']
242
+ ].filter(Boolean).join(' ') || undefined,
243
243
  onPointerEnter (e) {
244
244
  // Highlight the date on hover or drag over a date when selecting a range.
245
- if ("highlightDate" in state && (e.pointerType !== "touch" || state.isDragging) && isSelectable) state.highlightDate(date);
245
+ if ('highlightDate' in state && (e.pointerType !== 'touch' || state.isDragging) && isSelectable) state.highlightDate(date);
246
246
  },
247
247
  onPointerDown (e) {
248
248
  // This is necessary on touch devices to allow dragging
249
249
  // outside the original pressed element.
250
250
  // (JSDOM does not support this)
251
- if ("releasePointerCapture" in e.target) e.target.releasePointerCapture(e.pointerId);
251
+ if ('releasePointerCapture' in e.target) e.target.releasePointerCapture(e.pointerId);
252
252
  },
253
253
  onContextMenu (e) {
254
254
  // Prevent context menu on long press.