@react-spectrum/calendar 3.0.0-alpha.1 → 3.0.0-alpha.2

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/module.js CHANGED
@@ -1,300 +1,392 @@
1
- import { useCalendarState, useRangeCalendarState } from "@react-stately/calendar";
2
- import _spectrumIconsUiChevronRightLarge from "@spectrum-icons/ui/ChevronRightLarge";
3
- import _spectrumIconsUiChevronLeftLarge from "@spectrum-icons/ui/ChevronLeftLarge";
4
- import { VisuallyHidden } from "@react-aria/visually-hidden";
5
- import { useProviderProps } from "@react-spectrum/provider";
6
- import { useHover } from "@react-aria/interactions";
7
- import { useFocusRing } from "@react-aria/focus";
8
- import { useDateFormatter, useLocale } from "@react-aria/i18n";
9
- import _react, { useMemo, useRef, useEffect, useState } from "react";
10
- import { mergeProps } from "@react-aria/utils";
11
- import { classNames } from "@react-spectrum/utils";
12
- import { getDayOfWeek, isEqualDay, isSameDay, isSameMonth, isToday, endOfMonth, getWeeksInMonth, startOfWeek, createCalendar } from "@internationalized/date";
13
- import { useCalendarCell, useCalendarGrid, useCalendar as _useCalendar, useRangeCalendar } from "@react-aria/calendar";
14
- import _babelRuntimeHelpersEsmObjectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
15
- import { ActionButton } from "@react-spectrum/button";
16
- import _babelRuntimeHelpersEsmExtends from "@babel/runtime/helpers/esm/extends";
17
1
  import "./main.css";
2
+ import {createCalendar as $73RbK$createCalendar, endOfMonth as $73RbK$endOfMonth, startOfWeek as $73RbK$startOfWeek, getWeeksInMonth as $73RbK$getWeeksInMonth, isSameMonth as $73RbK$isSameMonth, isSameDay as $73RbK$isSameDay, getDayOfWeek as $73RbK$getDayOfWeek, isEqualDay as $73RbK$isEqualDay, isToday as $73RbK$isToday} from "@internationalized/date";
3
+ import $73RbK$react, {useMemo as $73RbK$useMemo, useRef as $73RbK$useRef, useState as $73RbK$useState, useEffect as $73RbK$useEffect} from "react";
4
+ import {useCalendar as $73RbK$useCalendar, useCalendarGrid as $73RbK$useCalendarGrid, useCalendarCell as $73RbK$useCalendarCell, useRangeCalendar as $73RbK$useRangeCalendar} from "@react-aria/calendar";
5
+ import {useCalendarState as $73RbK$useCalendarState, useRangeCalendarState as $73RbK$useRangeCalendarState} from "@react-stately/calendar";
6
+ import {useLocale as $73RbK$useLocale, useDateFormatter as $73RbK$useDateFormatter} from "@react-aria/i18n";
7
+ import {ActionButton as $73RbK$ActionButton} from "@react-spectrum/button";
8
+ import $73RbK$spectrumiconsuiChevronLeftLarge from "@spectrum-icons/ui/ChevronLeftLarge";
9
+ import $73RbK$spectrumiconsuiChevronRightLarge from "@spectrum-icons/ui/ChevronRightLarge";
10
+ import {classNames as $73RbK$classNames} from "@react-spectrum/utils";
11
+ import {useProviderProps as $73RbK$useProviderProps} from "@react-spectrum/provider";
12
+ import {VisuallyHidden as $73RbK$VisuallyHidden} from "@react-aria/visually-hidden";
13
+ import {mergeProps as $73RbK$mergeProps} from "@react-aria/utils";
14
+ import {useFocusRing as $73RbK$useFocusRing} from "@react-aria/focus";
15
+ import {useHover as $73RbK$useHover} from "@react-aria/interactions";
18
16
 
17
+ function $parcel$export(e, n, v, s) {
18
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
19
+ }
19
20
  function $parcel$interopDefault(a) {
20
21
  return a && a.__esModule ? a.default : a;
21
22
  }
23
+ var $c804ccf407f51ca3$exports = {};
24
+
25
+ $parcel$export($c804ccf407f51ca3$exports, "Calendar", () => $c804ccf407f51ca3$export$e1aef45b828286de);
26
+
27
+
28
+
29
+
30
+
22
31
 
23
- // ASSET: /Users/govett/dev/react-spectrum-v3/node_modules/@adobe/spectrum-css-temp/components/calendar/vars.css
24
- var $be4f0cec50a586942f46dfb826aeabe0$exports = {};
25
- $be4f0cec50a586942f46dfb826aeabe0$exports = {
26
- "spectrum-Calendar": "_spectrum-Calendar_b7235",
27
- "spectrum-Calendar--padded": "_spectrum-Calendar--padded_b7235",
28
- "spectrum-Calendar-header": "_spectrum-Calendar-header_b7235",
29
- "spectrum-Calendar-monthHeader": "_spectrum-Calendar-monthHeader_b7235",
30
- "spectrum-Calendar-title": "_spectrum-Calendar-title_b7235",
31
- "spectrum-Calendar-prevMonth": "_spectrum-Calendar-prevMonth_b7235",
32
- "spectrum-Calendar-nextMonth": "_spectrum-Calendar-nextMonth_b7235",
33
- "spectrum-Calendar-months": "_spectrum-Calendar-months_b7235",
34
- "spectrum-Calendar-dayOfWeek": "_spectrum-Calendar-dayOfWeek_b7235",
35
- "spectrum-Calendar-body": "_spectrum-Calendar-body_b7235",
36
- "spectrum-Calendar-table": "_spectrum-Calendar-table_b7235",
37
- "spectrum-Calendar-tableCell": "_spectrum-Calendar-tableCell_b7235",
38
- "spectrum-Calendar-date": "_spectrum-Calendar-date_b7235",
39
- "spectrum-Calendar-dateText": "_spectrum-Calendar-dateText_b7235",
40
- "is-disabled": "_is-disabled_b7235",
41
- "is-outsideMonth": "_is-outsideMonth_b7235",
42
- "is-focused": "_is-focused_b7235",
43
- "is-range-selection": "_is-range-selection_b7235",
44
- "is-range-start": "_is-range-start_b7235",
45
- "is-selection-start": "_is-selection-start_b7235",
46
- "is-range-end": "_is-range-end_b7235",
47
- "is-selection-end": "_is-selection-end_b7235",
48
- "is-range-selecting": "_is-range-selecting_b7235",
49
- "is-today": "_is-today_b7235",
50
- "is-selected": "_is-selected_b7235",
51
- "is-hovered": "_is-hovered_b7235",
52
- "is-pressed": "_is-pressed_b7235"
53
- };
54
- var $be4f0cec50a586942f46dfb826aeabe0$$interop$default = $parcel$interopDefault($be4f0cec50a586942f46dfb826aeabe0$exports);
55
-
56
- function $e063fdddb71e9ef291bdbb1ac2f23b10$export$CalendarCell(_ref) {
57
- let {
58
- state,
59
- currentMonth
60
- } = _ref,
61
- props = _babelRuntimeHelpersEsmObjectWithoutPropertiesLoose(_ref, ["state", "currentMonth"]);
62
-
63
- let ref = useRef();
64
- let {
65
- cellProps,
66
- buttonProps,
67
- isPressed
68
- } = useCalendarCell(_babelRuntimeHelpersEsmExtends({}, props, {
69
- isDisabled: !isSameMonth(props.date, currentMonth)
70
- }), state, ref);
71
- let {
72
- hoverProps,
73
- isHovered
74
- } = useHover({});
75
- let dateFormatter = useDateFormatter({
76
- day: 'numeric',
77
- timeZone: state.timeZone,
78
- calendar: currentMonth.calendar.identifier
79
- });
80
- let isSelected = state.isSelected(props.date);
81
- let highlightedRange = 'highlightedRange' in state && state.highlightedRange;
82
- let isSelectionStart = highlightedRange && isSameDay(props.date, highlightedRange.start);
83
- let isSelectionEnd = highlightedRange && isSameDay(props.date, highlightedRange.end);
84
- let {
85
- locale
86
- } = useLocale();
87
- let dayOfWeek = getDayOfWeek(props.date, locale);
88
- let isRangeStart = isSelected && (dayOfWeek === 0 || props.date.day === 1);
89
- let isRangeEnd = isSelected && (dayOfWeek === 6 || props.date.day === currentMonth.calendar.getDaysInMonth(currentMonth));
90
- let {
91
- focusProps,
92
- isFocusVisible
93
- } = useFocusRing(); // For performance, reuse the same date object as before if the new date prop is the same.
94
- // This allows subsequent useMemo results to be reused.
95
-
96
- let date = props.date;
97
- let lastDate = useRef(null);
98
-
99
- if (lastDate.current && isEqualDay(date, lastDate.current)) {
100
- date = lastDate.current;
101
- }
102
-
103
- lastDate.current = date;
104
- let nativeDate = useMemo(() => date.toDate(state.timeZone), [date, state.timeZone]);
105
- let formatted = useMemo(() => dateFormatter.format(nativeDate), [dateFormatter, nativeDate]);
106
- return /*#__PURE__*/_react.createElement("td", _babelRuntimeHelpersEsmExtends({}, cellProps, {
107
- className: classNames($be4f0cec50a586942f46dfb826aeabe0$$interop$default, 'spectrum-Calendar-tableCell')
108
- }), /*#__PURE__*/_react.createElement("span", _babelRuntimeHelpersEsmExtends({}, mergeProps(buttonProps, hoverProps, focusProps), {
109
- ref: ref,
110
- className: classNames($be4f0cec50a586942f46dfb826aeabe0$$interop$default, 'spectrum-Calendar-date', {
111
- 'is-today': isToday(props.date, state.timeZone),
112
- 'is-selected': isSelected,
113
- 'is-focused': state.isCellFocused(props.date) && isFocusVisible,
114
- 'is-disabled': state.isCellDisabled(props.date),
115
- 'is-outsideMonth': !isSameMonth(props.date, currentMonth),
116
- 'is-range-start': isRangeStart,
117
- 'is-range-end': isRangeEnd,
118
- 'is-range-selection': isSelected && 'highlightedRange' in state,
119
- 'is-selection-start': isSelectionStart,
120
- 'is-selection-end': isSelectionEnd,
121
- 'is-hovered': isHovered,
122
- 'is-pressed': isPressed
123
- })
124
- }), /*#__PURE__*/_react.createElement("span", {
125
- className: classNames($be4f0cec50a586942f46dfb826aeabe0$$interop$default, 'spectrum-Calendar-dateText')
126
- }, formatted)));
32
+ var $bfaece4cca45ba9e$exports = {};
33
+
34
+ $parcel$export($bfaece4cca45ba9e$exports, "spectrum-Calendar", () => $bfaece4cca45ba9e$export$2d9837ea36f7a875, (v) => $bfaece4cca45ba9e$export$2d9837ea36f7a875 = v);
35
+ $parcel$export($bfaece4cca45ba9e$exports, "spectrum-Calendar--padded", () => $bfaece4cca45ba9e$export$8d90e3a3d21fe428, (v) => $bfaece4cca45ba9e$export$8d90e3a3d21fe428 = v);
36
+ $parcel$export($bfaece4cca45ba9e$exports, "spectrum-Calendar-header", () => $bfaece4cca45ba9e$export$7efb9b56af6e2d09, (v) => $bfaece4cca45ba9e$export$7efb9b56af6e2d09 = v);
37
+ $parcel$export($bfaece4cca45ba9e$exports, "spectrum-Calendar-monthHeader", () => $bfaece4cca45ba9e$export$185018e73e57145f, (v) => $bfaece4cca45ba9e$export$185018e73e57145f = v);
38
+ $parcel$export($bfaece4cca45ba9e$exports, "spectrum-Calendar-title", () => $bfaece4cca45ba9e$export$98ee27555a2b7c01, (v) => $bfaece4cca45ba9e$export$98ee27555a2b7c01 = v);
39
+ $parcel$export($bfaece4cca45ba9e$exports, "spectrum-Calendar-prevMonth", () => $bfaece4cca45ba9e$export$d4c1c2a202a50db2, (v) => $bfaece4cca45ba9e$export$d4c1c2a202a50db2 = v);
40
+ $parcel$export($bfaece4cca45ba9e$exports, "spectrum-Calendar-nextMonth", () => $bfaece4cca45ba9e$export$7876229ab722b448, (v) => $bfaece4cca45ba9e$export$7876229ab722b448 = v);
41
+ $parcel$export($bfaece4cca45ba9e$exports, "spectrum-Calendar-months", () => $bfaece4cca45ba9e$export$5dacd232bfef6687, (v) => $bfaece4cca45ba9e$export$5dacd232bfef6687 = v);
42
+ $parcel$export($bfaece4cca45ba9e$exports, "spectrum-Calendar-dayOfWeek", () => $bfaece4cca45ba9e$export$7ff21fe81b21fa51, (v) => $bfaece4cca45ba9e$export$7ff21fe81b21fa51 = v);
43
+ $parcel$export($bfaece4cca45ba9e$exports, "spectrum-Calendar-body", () => $bfaece4cca45ba9e$export$33407a73687c0e62, (v) => $bfaece4cca45ba9e$export$33407a73687c0e62 = v);
44
+ $parcel$export($bfaece4cca45ba9e$exports, "spectrum-Calendar-table", () => $bfaece4cca45ba9e$export$27f4c38933cceedf, (v) => $bfaece4cca45ba9e$export$27f4c38933cceedf = v);
45
+ $parcel$export($bfaece4cca45ba9e$exports, "spectrum-Calendar-tableCell", () => $bfaece4cca45ba9e$export$292b81cfd590634d, (v) => $bfaece4cca45ba9e$export$292b81cfd590634d = v);
46
+ $parcel$export($bfaece4cca45ba9e$exports, "spectrum-Calendar-date", () => $bfaece4cca45ba9e$export$c20fe43d14f8fa36, (v) => $bfaece4cca45ba9e$export$c20fe43d14f8fa36 = v);
47
+ $parcel$export($bfaece4cca45ba9e$exports, "spectrum-Calendar-dateText", () => $bfaece4cca45ba9e$export$cc48a6e73fdb7719, (v) => $bfaece4cca45ba9e$export$cc48a6e73fdb7719 = v);
48
+ $parcel$export($bfaece4cca45ba9e$exports, "is-disabled", () => $bfaece4cca45ba9e$export$d35bc1e505d1ebbf, (v) => $bfaece4cca45ba9e$export$d35bc1e505d1ebbf = v);
49
+ $parcel$export($bfaece4cca45ba9e$exports, "is-outsideMonth", () => $bfaece4cca45ba9e$export$93ff5b06817b3d41, (v) => $bfaece4cca45ba9e$export$93ff5b06817b3d41 = v);
50
+ $parcel$export($bfaece4cca45ba9e$exports, "is-focused", () => $bfaece4cca45ba9e$export$e7dc768d35940237, (v) => $bfaece4cca45ba9e$export$e7dc768d35940237 = v);
51
+ $parcel$export($bfaece4cca45ba9e$exports, "is-range-selection", () => $bfaece4cca45ba9e$export$cd2839d8bb0c6407, (v) => $bfaece4cca45ba9e$export$cd2839d8bb0c6407 = v);
52
+ $parcel$export($bfaece4cca45ba9e$exports, "is-range-start", () => $bfaece4cca45ba9e$export$4ce7d3d24e42e411, (v) => $bfaece4cca45ba9e$export$4ce7d3d24e42e411 = v);
53
+ $parcel$export($bfaece4cca45ba9e$exports, "is-selection-start", () => $bfaece4cca45ba9e$export$f0091c9d6b8c19d3, (v) => $bfaece4cca45ba9e$export$f0091c9d6b8c19d3 = v);
54
+ $parcel$export($bfaece4cca45ba9e$exports, "is-range-end", () => $bfaece4cca45ba9e$export$52890a3cb1ab46b, (v) => $bfaece4cca45ba9e$export$52890a3cb1ab46b = v);
55
+ $parcel$export($bfaece4cca45ba9e$exports, "is-selection-end", () => $bfaece4cca45ba9e$export$50722ae5663230f9, (v) => $bfaece4cca45ba9e$export$50722ae5663230f9 = v);
56
+ $parcel$export($bfaece4cca45ba9e$exports, "is-range-selecting", () => $bfaece4cca45ba9e$export$7a763a0407a04336, (v) => $bfaece4cca45ba9e$export$7a763a0407a04336 = v);
57
+ $parcel$export($bfaece4cca45ba9e$exports, "is-today", () => $bfaece4cca45ba9e$export$189f6cc7eaf68d8b, (v) => $bfaece4cca45ba9e$export$189f6cc7eaf68d8b = v);
58
+ $parcel$export($bfaece4cca45ba9e$exports, "is-selected", () => $bfaece4cca45ba9e$export$1e0fb04f31d3c22a, (v) => $bfaece4cca45ba9e$export$1e0fb04f31d3c22a = v);
59
+ $parcel$export($bfaece4cca45ba9e$exports, "is-hovered", () => $bfaece4cca45ba9e$export$b8813cd5d7824ce7, (v) => $bfaece4cca45ba9e$export$b8813cd5d7824ce7 = v);
60
+ $parcel$export($bfaece4cca45ba9e$exports, "is-pressed", () => $bfaece4cca45ba9e$export$15b73a232798b8d3, (v) => $bfaece4cca45ba9e$export$15b73a232798b8d3 = v);
61
+ var $bfaece4cca45ba9e$export$2d9837ea36f7a875;
62
+ var $bfaece4cca45ba9e$export$8d90e3a3d21fe428;
63
+ var $bfaece4cca45ba9e$export$7efb9b56af6e2d09;
64
+ var $bfaece4cca45ba9e$export$185018e73e57145f;
65
+ var $bfaece4cca45ba9e$export$98ee27555a2b7c01;
66
+ var $bfaece4cca45ba9e$export$d4c1c2a202a50db2;
67
+ var $bfaece4cca45ba9e$export$7876229ab722b448;
68
+ var $bfaece4cca45ba9e$export$5dacd232bfef6687;
69
+ var $bfaece4cca45ba9e$export$7ff21fe81b21fa51;
70
+ var $bfaece4cca45ba9e$export$33407a73687c0e62;
71
+ var $bfaece4cca45ba9e$export$27f4c38933cceedf;
72
+ var $bfaece4cca45ba9e$export$292b81cfd590634d;
73
+ var $bfaece4cca45ba9e$export$c20fe43d14f8fa36;
74
+ var $bfaece4cca45ba9e$export$cc48a6e73fdb7719;
75
+ var $bfaece4cca45ba9e$export$d35bc1e505d1ebbf;
76
+ var $bfaece4cca45ba9e$export$93ff5b06817b3d41;
77
+ var $bfaece4cca45ba9e$export$e7dc768d35940237;
78
+ var $bfaece4cca45ba9e$export$cd2839d8bb0c6407;
79
+ var $bfaece4cca45ba9e$export$4ce7d3d24e42e411;
80
+ var $bfaece4cca45ba9e$export$f0091c9d6b8c19d3;
81
+ var $bfaece4cca45ba9e$export$52890a3cb1ab46b;
82
+ var $bfaece4cca45ba9e$export$50722ae5663230f9;
83
+ var $bfaece4cca45ba9e$export$7a763a0407a04336;
84
+ var $bfaece4cca45ba9e$export$189f6cc7eaf68d8b;
85
+ var $bfaece4cca45ba9e$export$1e0fb04f31d3c22a;
86
+ var $bfaece4cca45ba9e$export$b8813cd5d7824ce7;
87
+ var $bfaece4cca45ba9e$export$15b73a232798b8d3;
88
+ $bfaece4cca45ba9e$export$2d9837ea36f7a875 = "spectrum-Calendar_6099b6";
89
+ $bfaece4cca45ba9e$export$8d90e3a3d21fe428 = "spectrum-Calendar--padded_6099b6";
90
+ $bfaece4cca45ba9e$export$7efb9b56af6e2d09 = "spectrum-Calendar-header_6099b6";
91
+ $bfaece4cca45ba9e$export$185018e73e57145f = "spectrum-Calendar-monthHeader_6099b6";
92
+ $bfaece4cca45ba9e$export$98ee27555a2b7c01 = "spectrum-Calendar-title_6099b6";
93
+ $bfaece4cca45ba9e$export$d4c1c2a202a50db2 = "spectrum-Calendar-prevMonth_6099b6";
94
+ $bfaece4cca45ba9e$export$7876229ab722b448 = "spectrum-Calendar-nextMonth_6099b6";
95
+ $bfaece4cca45ba9e$export$5dacd232bfef6687 = "spectrum-Calendar-months_6099b6";
96
+ $bfaece4cca45ba9e$export$7ff21fe81b21fa51 = "spectrum-Calendar-dayOfWeek_6099b6";
97
+ $bfaece4cca45ba9e$export$33407a73687c0e62 = "spectrum-Calendar-body_6099b6";
98
+ $bfaece4cca45ba9e$export$27f4c38933cceedf = "spectrum-Calendar-table_6099b6";
99
+ $bfaece4cca45ba9e$export$292b81cfd590634d = "spectrum-Calendar-tableCell_6099b6";
100
+ $bfaece4cca45ba9e$export$c20fe43d14f8fa36 = "spectrum-Calendar-date_6099b6";
101
+ $bfaece4cca45ba9e$export$cc48a6e73fdb7719 = "spectrum-Calendar-dateText_6099b6";
102
+ $bfaece4cca45ba9e$export$d35bc1e505d1ebbf = "is-disabled_6099b6";
103
+ $bfaece4cca45ba9e$export$93ff5b06817b3d41 = "is-outsideMonth_6099b6";
104
+ $bfaece4cca45ba9e$export$e7dc768d35940237 = "is-focused_6099b6";
105
+ $bfaece4cca45ba9e$export$cd2839d8bb0c6407 = "is-range-selection_6099b6";
106
+ $bfaece4cca45ba9e$export$4ce7d3d24e42e411 = "is-range-start_6099b6";
107
+ $bfaece4cca45ba9e$export$f0091c9d6b8c19d3 = "is-selection-start_6099b6";
108
+ $bfaece4cca45ba9e$export$52890a3cb1ab46b = "is-range-end_6099b6";
109
+ $bfaece4cca45ba9e$export$50722ae5663230f9 = "is-selection-end_6099b6";
110
+ $bfaece4cca45ba9e$export$7a763a0407a04336 = "is-range-selecting_6099b6";
111
+ $bfaece4cca45ba9e$export$189f6cc7eaf68d8b = "is-today_6099b6";
112
+ $bfaece4cca45ba9e$export$1e0fb04f31d3c22a = "is-selected_6099b6";
113
+ $bfaece4cca45ba9e$export$b8813cd5d7824ce7 = "is-hovered_6099b6";
114
+ $bfaece4cca45ba9e$export$15b73a232798b8d3 = "is-pressed_6099b6";
115
+
116
+
117
+
118
+
119
+
120
+ function $bbd76894f78834a8$export$5d847498420df57b({ state: state , currentMonth: currentMonth , ...props }) {
121
+ let ref = $73RbK$useRef();
122
+ let { cellProps: cellProps , buttonProps: buttonProps , isPressed: isPressed } = $73RbK$useCalendarCell({
123
+ ...props,
124
+ isDisabled: !$73RbK$isSameMonth(props.date, currentMonth)
125
+ }, state, ref);
126
+ let { hoverProps: hoverProps , isHovered: isHovered } = $73RbK$useHover({
127
+ });
128
+ let dateFormatter = $73RbK$useDateFormatter({
129
+ day: 'numeric',
130
+ timeZone: state.timeZone,
131
+ calendar: currentMonth.calendar.identifier
132
+ });
133
+ let isSelected = state.isSelected(props.date);
134
+ let highlightedRange = 'highlightedRange' in state && state.highlightedRange;
135
+ let isSelectionStart = highlightedRange && $73RbK$isSameDay(props.date, highlightedRange.start);
136
+ let isSelectionEnd = highlightedRange && $73RbK$isSameDay(props.date, highlightedRange.end);
137
+ let { locale: locale } = $73RbK$useLocale();
138
+ let dayOfWeek = $73RbK$getDayOfWeek(props.date, locale);
139
+ let isRangeStart = isSelected && (dayOfWeek === 0 || props.date.day === 1);
140
+ let isRangeEnd = isSelected && (dayOfWeek === 6 || props.date.day === currentMonth.calendar.getDaysInMonth(currentMonth));
141
+ let { focusProps: focusProps , isFocusVisible: isFocusVisible } = $73RbK$useFocusRing();
142
+ // For performance, reuse the same date object as before if the new date prop is the same.
143
+ // This allows subsequent useMemo results to be reused.
144
+ let date = props.date;
145
+ let lastDate = $73RbK$useRef(null);
146
+ if (lastDate.current && $73RbK$isEqualDay(date, lastDate.current)) date = lastDate.current;
147
+ lastDate.current = date;
148
+ let nativeDate = $73RbK$useMemo(()=>date.toDate(state.timeZone)
149
+ , [
150
+ date,
151
+ state.timeZone
152
+ ]);
153
+ let formatted = $73RbK$useMemo(()=>dateFormatter.format(nativeDate)
154
+ , [
155
+ dateFormatter,
156
+ nativeDate
157
+ ]);
158
+ return(/*#__PURE__*/ $73RbK$react.createElement("td", {
159
+ ...cellProps,
160
+ className: $73RbK$classNames((/*@__PURE__*/$parcel$interopDefault($bfaece4cca45ba9e$exports)), 'spectrum-Calendar-tableCell')
161
+ }, /*#__PURE__*/ $73RbK$react.createElement("span", {
162
+ ...$73RbK$mergeProps(buttonProps, hoverProps, focusProps),
163
+ ref: ref,
164
+ className: $73RbK$classNames((/*@__PURE__*/$parcel$interopDefault($bfaece4cca45ba9e$exports)), 'spectrum-Calendar-date', {
165
+ 'is-today': $73RbK$isToday(props.date, state.timeZone),
166
+ 'is-selected': isSelected,
167
+ 'is-focused': state.isCellFocused(props.date) && isFocusVisible,
168
+ 'is-disabled': state.isCellDisabled(props.date),
169
+ 'is-outsideMonth': !$73RbK$isSameMonth(props.date, currentMonth),
170
+ 'is-range-start': isRangeStart,
171
+ 'is-range-end': isRangeEnd,
172
+ 'is-range-selection': isSelected && 'highlightedRange' in state,
173
+ 'is-selection-start': isSelectionStart,
174
+ 'is-selection-end': isSelectionEnd,
175
+ 'is-hovered': isHovered,
176
+ 'is-pressed': isPressed
177
+ })
178
+ }, /*#__PURE__*/ $73RbK$react.createElement("span", {
179
+ className: $73RbK$classNames((/*@__PURE__*/$parcel$interopDefault($bfaece4cca45ba9e$exports)), 'spectrum-Calendar-dateText')
180
+ }, formatted))));
127
181
  }
128
182
 
129
- function $a61ab4829fcdd02202f30ae2d742ae1$export$CalendarMonth(props) {
130
- props = useProviderProps(props);
131
- let {
132
- state,
133
- startDate
134
- } = props;
135
- let {
136
- gridProps
137
- } = useCalendarGrid(_babelRuntimeHelpersEsmExtends({}, props, {
138
- endDate: endOfMonth(startDate)
139
- }), state);
140
- let dayFormatter = useDateFormatter({
141
- weekday: 'narrow'
142
- });
143
- let dayFormatterLong = useDateFormatter({
144
- weekday: 'long'
145
- });
146
- let {
147
- locale
148
- } = useLocale();
149
- let monthStart = startOfWeek(startDate, locale);
150
- let weeksInMonth = getWeeksInMonth(startDate, locale);
151
- let [isRangeSelecting, setRangeSelecting] = useState(false);
152
- let hasAnchorDate = 'anchorDate' in state && state.anchorDate != null; // Update isRangeSelecting immediately when it becomes true.
153
- // This feels weird but is actually fine...
154
- // https://reactjs.org/docs/hooks-faq.html#how-do-i-implement-getderivedstatefromprops
155
-
156
- if (hasAnchorDate && !isRangeSelecting) {
157
- setRangeSelecting(true);
158
- } // Delay removing the is-range-selecting class for a frame after selection ends.
159
- // This avoids an undesired animation on touch devices.
160
-
161
-
162
- useEffect(() => {
163
- if (!hasAnchorDate && isRangeSelecting) {
164
- let raf = requestAnimationFrame(() => setRangeSelecting(false));
165
- return () => cancelAnimationFrame(raf);
166
- }
167
- }, [hasAnchorDate, isRangeSelecting]);
168
- return /*#__PURE__*/_react.createElement("table", _babelRuntimeHelpersEsmExtends({}, gridProps, {
169
- className: classNames($be4f0cec50a586942f46dfb826aeabe0$$interop$default, 'spectrum-Calendar-body', 'spectrum-Calendar-table', {
170
- 'is-range-selecting': isRangeSelecting
171
- })
172
- }), /*#__PURE__*/_react.createElement("thead", null, /*#__PURE__*/_react.createElement("tr", null, [...new Array(7).keys()].map(index => {
173
- let date = monthStart.add({
174
- days: index
183
+
184
+
185
+
186
+
187
+
188
+
189
+
190
+
191
+
192
+ function $807ae6c0f131ca7c$export$26e2752316b9a375(props) {
193
+ props = $73RbK$useProviderProps(props);
194
+ let { state: state , startDate: startDate } = props;
195
+ let { gridProps: gridProps } = $73RbK$useCalendarGrid({
196
+ ...props,
197
+ endDate: $73RbK$endOfMonth(startDate)
198
+ }, state);
199
+ let dayFormatter = $73RbK$useDateFormatter({
200
+ weekday: 'narrow'
175
201
  });
176
- let dateDay = date.toDate(state.timeZone);
177
- let day = dayFormatter.format(dateDay);
178
- let dayLong = dayFormatterLong.format(dateDay);
179
- return /*#__PURE__*/_react.createElement("th", {
180
- key: index,
181
- className: classNames($be4f0cec50a586942f46dfb826aeabe0$$interop$default, 'spectrum-Calendar-tableCell')
182
- }, /*#__PURE__*/_react.createElement(VisuallyHidden, null, dayLong), /*#__PURE__*/_react.createElement("span", {
183
- "aria-hidden": "true",
184
- className: classNames($be4f0cec50a586942f46dfb826aeabe0$$interop$default, 'spectrum-Calendar-dayOfWeek')
185
- }, day));
186
- }))), /*#__PURE__*/_react.createElement("tbody", null, [...new Array(weeksInMonth).keys()].map(weekIndex => /*#__PURE__*/_react.createElement("tr", {
187
- key: weekIndex
188
- }, [...new Array(7).keys()].map(dayIndex => /*#__PURE__*/_react.createElement($e063fdddb71e9ef291bdbb1ac2f23b10$export$CalendarCell, {
189
- key: dayIndex,
190
- state: state,
191
- date: monthStart.add({
192
- weeks: weekIndex,
193
- days: dayIndex
194
- }),
195
- currentMonth: startDate
196
- }))))));
202
+ let dayFormatterLong = $73RbK$useDateFormatter({
203
+ weekday: 'long'
204
+ });
205
+ let { locale: locale } = $73RbK$useLocale();
206
+ let monthStart = $73RbK$startOfWeek(startDate, locale);
207
+ let weeksInMonth = $73RbK$getWeeksInMonth(startDate, locale);
208
+ let [isRangeSelecting, setRangeSelecting] = $73RbK$useState(false);
209
+ let hasAnchorDate = 'anchorDate' in state && state.anchorDate != null;
210
+ // Update isRangeSelecting immediately when it becomes true.
211
+ // This feels weird but is actually fine...
212
+ // https://reactjs.org/docs/hooks-faq.html#how-do-i-implement-getderivedstatefromprops
213
+ if (hasAnchorDate && !isRangeSelecting) setRangeSelecting(true);
214
+ // Delay removing the is-range-selecting class for a frame after selection ends.
215
+ // This avoids an undesired animation on touch devices.
216
+ $73RbK$useEffect(()=>{
217
+ if (!hasAnchorDate && isRangeSelecting) {
218
+ let raf = requestAnimationFrame(()=>setRangeSelecting(false)
219
+ );
220
+ return ()=>cancelAnimationFrame(raf)
221
+ ;
222
+ }
223
+ }, [
224
+ hasAnchorDate,
225
+ isRangeSelecting
226
+ ]);
227
+ return(/*#__PURE__*/ $73RbK$react.createElement("table", {
228
+ ...gridProps,
229
+ className: $73RbK$classNames((/*@__PURE__*/$parcel$interopDefault($bfaece4cca45ba9e$exports)), 'spectrum-Calendar-body', 'spectrum-Calendar-table', {
230
+ 'is-range-selecting': isRangeSelecting
231
+ })
232
+ }, /*#__PURE__*/ $73RbK$react.createElement("thead", null, /*#__PURE__*/ $73RbK$react.createElement("tr", null, [
233
+ ...new Array(7).keys()
234
+ ].map((index)=>{
235
+ let date = monthStart.add({
236
+ days: index
237
+ });
238
+ let dateDay = date.toDate(state.timeZone);
239
+ let day = dayFormatter.format(dateDay);
240
+ let dayLong = dayFormatterLong.format(dateDay);
241
+ return(/*#__PURE__*/ $73RbK$react.createElement("th", {
242
+ key: index,
243
+ className: $73RbK$classNames((/*@__PURE__*/$parcel$interopDefault($bfaece4cca45ba9e$exports)), 'spectrum-Calendar-tableCell')
244
+ }, /*#__PURE__*/ $73RbK$react.createElement($73RbK$VisuallyHidden, null, dayLong), /*#__PURE__*/ $73RbK$react.createElement("span", {
245
+ "aria-hidden": "true",
246
+ className: $73RbK$classNames((/*@__PURE__*/$parcel$interopDefault($bfaece4cca45ba9e$exports)), 'spectrum-Calendar-dayOfWeek')
247
+ }, day)));
248
+ }))), /*#__PURE__*/ $73RbK$react.createElement("tbody", null, [
249
+ ...new Array(weeksInMonth).keys()
250
+ ].map((weekIndex)=>/*#__PURE__*/ $73RbK$react.createElement("tr", {
251
+ key: weekIndex
252
+ }, [
253
+ ...new Array(7).keys()
254
+ ].map((dayIndex)=>/*#__PURE__*/ $73RbK$react.createElement($bbd76894f78834a8$export$5d847498420df57b, {
255
+ key: dayIndex,
256
+ state: state,
257
+ date: monthStart.add({
258
+ weeks: weekIndex,
259
+ days: dayIndex
260
+ }),
261
+ currentMonth: startDate
262
+ })
263
+ ))
264
+ ))));
197
265
  }
198
266
 
199
- function $ff7cb4cae699b79d58b93fa58010e9$export$CalendarBase(props) {
200
- props = useProviderProps(props);
201
- let {
202
- state,
203
- useCalendar,
204
- visibleMonths = 1
205
- } = props;
206
- let {
207
- direction
208
- } = useLocale();
209
- let currentMonth = state.visibleRange.start;
210
- let monthDateFormatter = useDateFormatter({
211
- month: 'long',
212
- year: 'numeric',
213
- era: currentMonth.calendar.identifier !== 'gregory' ? 'long' : undefined,
214
- calendar: currentMonth.calendar.identifier
215
- });
216
- let ref = useRef(null);
217
- let {
218
- calendarProps,
219
- prevButtonProps,
220
- nextButtonProps
221
- } = useCalendar(props, state, ref);
222
- let titles = [];
223
- let calendars = [];
224
-
225
- for (let i = 0; i < visibleMonths; i++) {
226
- titles.push( /*#__PURE__*/_react.createElement("div", {
227
- key: i,
228
- className: classNames($be4f0cec50a586942f46dfb826aeabe0$$interop$default, 'spectrum-Calendar-monthHeader')
229
- }, i === 0 && /*#__PURE__*/_react.createElement(ActionButton, _babelRuntimeHelpersEsmExtends({}, prevButtonProps, {
230
- UNSAFE_className: classNames($be4f0cec50a586942f46dfb826aeabe0$$interop$default, 'spectrum-Calendar-prevMonth'),
231
- isQuiet: true
232
- }), direction === 'rtl' ? /*#__PURE__*/_react.createElement(_spectrumIconsUiChevronRightLarge, null) : /*#__PURE__*/_react.createElement(_spectrumIconsUiChevronLeftLarge, null)), /*#__PURE__*/_react.createElement("h2", {
233
- className: classNames($be4f0cec50a586942f46dfb826aeabe0$$interop$default, 'spectrum-Calendar-title')
234
- }, monthDateFormatter.format(currentMonth.add({
235
- months: i
236
- }).toDate(state.timeZone))), i === visibleMonths - 1 && /*#__PURE__*/_react.createElement(ActionButton, _babelRuntimeHelpersEsmExtends({}, nextButtonProps, {
237
- UNSAFE_className: classNames($be4f0cec50a586942f46dfb826aeabe0$$interop$default, 'spectrum-Calendar-nextMonth'),
238
- isQuiet: true
239
- }), direction === 'rtl' ? /*#__PURE__*/_react.createElement(_spectrumIconsUiChevronLeftLarge, null) : /*#__PURE__*/_react.createElement(_spectrumIconsUiChevronRightLarge, null))));
240
- let d = currentMonth.add({
241
- months: i
267
+
268
+
269
+
270
+
271
+
272
+
273
+
274
+
275
+ function $aa7be0d541cfb539$export$bfd52a43017368fe(props) {
276
+ props = $73RbK$useProviderProps(props);
277
+ let { state: state , useCalendar: useCalendar , visibleMonths: visibleMonths = 1 } = props;
278
+ let { direction: direction } = $73RbK$useLocale();
279
+ let currentMonth = state.visibleRange.start;
280
+ let monthDateFormatter = $73RbK$useDateFormatter({
281
+ month: 'long',
282
+ year: 'numeric',
283
+ era: currentMonth.calendar.identifier !== 'gregory' ? 'long' : undefined,
284
+ calendar: currentMonth.calendar.identifier
242
285
  });
243
- calendars.push( /*#__PURE__*/_react.createElement($a61ab4829fcdd02202f30ae2d742ae1$export$CalendarMonth, _babelRuntimeHelpersEsmExtends({}, props, {
244
- key: d.year + "-" + d.month + "-" + d.day,
245
- state: state,
246
- startDate: d
247
- })));
248
- }
249
-
250
- return /*#__PURE__*/_react.createElement("div", _babelRuntimeHelpersEsmExtends({}, calendarProps, {
251
- ref: ref,
252
- className: classNames($be4f0cec50a586942f46dfb826aeabe0$$interop$default, 'spectrum-Calendar')
253
- }), /*#__PURE__*/_react.createElement("div", {
254
- className: classNames($be4f0cec50a586942f46dfb826aeabe0$$interop$default, 'spectrum-Calendar-header')
255
- }, titles), /*#__PURE__*/_react.createElement("div", {
256
- className: classNames($be4f0cec50a586942f46dfb826aeabe0$$interop$default, 'spectrum-Calendar-months')
257
- }, calendars));
286
+ let ref = $73RbK$useRef(null);
287
+ let { calendarProps: calendarProps , prevButtonProps: prevButtonProps , nextButtonProps: nextButtonProps } = useCalendar(props, state, ref);
288
+ let titles = [];
289
+ let calendars = [];
290
+ for(let i = 0; i < visibleMonths; i++){
291
+ titles.push(/*#__PURE__*/ $73RbK$react.createElement("div", {
292
+ key: i,
293
+ className: $73RbK$classNames((/*@__PURE__*/$parcel$interopDefault($bfaece4cca45ba9e$exports)), 'spectrum-Calendar-monthHeader')
294
+ }, i === 0 && /*#__PURE__*/ $73RbK$react.createElement($73RbK$ActionButton, {
295
+ ...prevButtonProps,
296
+ UNSAFE_className: $73RbK$classNames((/*@__PURE__*/$parcel$interopDefault($bfaece4cca45ba9e$exports)), 'spectrum-Calendar-prevMonth'),
297
+ isQuiet: true
298
+ }, direction === 'rtl' ? /*#__PURE__*/ $73RbK$react.createElement($73RbK$spectrumiconsuiChevronRightLarge, null) : /*#__PURE__*/ $73RbK$react.createElement($73RbK$spectrumiconsuiChevronLeftLarge, null)), /*#__PURE__*/ $73RbK$react.createElement("h2", {
299
+ className: $73RbK$classNames((/*@__PURE__*/$parcel$interopDefault($bfaece4cca45ba9e$exports)), 'spectrum-Calendar-title')
300
+ }, monthDateFormatter.format(currentMonth.add({
301
+ months: i
302
+ }).toDate(state.timeZone))), i === visibleMonths - 1 && /*#__PURE__*/ $73RbK$react.createElement($73RbK$ActionButton, {
303
+ ...nextButtonProps,
304
+ UNSAFE_className: $73RbK$classNames((/*@__PURE__*/$parcel$interopDefault($bfaece4cca45ba9e$exports)), 'spectrum-Calendar-nextMonth'),
305
+ isQuiet: true
306
+ }, direction === 'rtl' ? /*#__PURE__*/ $73RbK$react.createElement($73RbK$spectrumiconsuiChevronLeftLarge, null) : /*#__PURE__*/ $73RbK$react.createElement($73RbK$spectrumiconsuiChevronRightLarge, null))));
307
+ let d = currentMonth.add({
308
+ months: i
309
+ });
310
+ calendars.push(/*#__PURE__*/ $73RbK$react.createElement($807ae6c0f131ca7c$export$26e2752316b9a375, {
311
+ ...props,
312
+ key: `${d.year}-${d.month}-${d.day}`,
313
+ state: state,
314
+ startDate: d
315
+ }));
316
+ }
317
+ return(/*#__PURE__*/ $73RbK$react.createElement("div", {
318
+ ...calendarProps,
319
+ ref: ref,
320
+ className: $73RbK$classNames((/*@__PURE__*/$parcel$interopDefault($bfaece4cca45ba9e$exports)), 'spectrum-Calendar')
321
+ }, /*#__PURE__*/ $73RbK$react.createElement("div", {
322
+ className: $73RbK$classNames((/*@__PURE__*/$parcel$interopDefault($bfaece4cca45ba9e$exports)), 'spectrum-Calendar-header')
323
+ }, titles), /*#__PURE__*/ $73RbK$react.createElement("div", {
324
+ className: $73RbK$classNames((/*@__PURE__*/$parcel$interopDefault($bfaece4cca45ba9e$exports)), 'spectrum-Calendar-months')
325
+ }, calendars)));
258
326
  }
259
327
 
260
- export function Calendar(props) {
261
- let {
262
- visibleMonths = 1
263
- } = props;
264
- let visibleDuration = useMemo(() => ({
265
- months: visibleMonths
266
- }), [visibleMonths]);
267
- let {
268
- locale
269
- } = useLocale();
270
- let state = useCalendarState(_babelRuntimeHelpersEsmExtends({}, props, {
271
- locale,
272
- visibleDuration,
273
- createCalendar
274
- }));
275
- return /*#__PURE__*/_react.createElement($ff7cb4cae699b79d58b93fa58010e9$export$CalendarBase, _babelRuntimeHelpersEsmExtends({}, props, {
276
- state: state,
277
- useCalendar: _useCalendar
278
- }));
328
+
329
+
330
+
331
+
332
+
333
+
334
+ function $c804ccf407f51ca3$export$e1aef45b828286de(props) {
335
+ let { visibleMonths: visibleMonths = 1 } = props;
336
+ let visibleDuration = $73RbK$useMemo(()=>({
337
+ months: visibleMonths
338
+ })
339
+ , [
340
+ visibleMonths
341
+ ]);
342
+ let { locale: locale } = $73RbK$useLocale();
343
+ let state = $73RbK$useCalendarState({
344
+ ...props,
345
+ locale: locale,
346
+ visibleDuration: visibleDuration,
347
+ createCalendar: $73RbK$createCalendar
348
+ });
349
+ return(/*#__PURE__*/ $73RbK$react.createElement($aa7be0d541cfb539$export$bfd52a43017368fe, {
350
+ ...props,
351
+ state: state,
352
+ useCalendar: $73RbK$useCalendar
353
+ }));
279
354
  }
280
- export function RangeCalendar(props) {
281
- let {
282
- visibleMonths = 1
283
- } = props;
284
- let visibleDuration = useMemo(() => ({
285
- months: visibleMonths
286
- }), [visibleMonths]);
287
- let {
288
- locale
289
- } = useLocale();
290
- let state = useRangeCalendarState(_babelRuntimeHelpersEsmExtends({}, props, {
291
- locale,
292
- visibleDuration,
293
- createCalendar
294
- }));
295
- return /*#__PURE__*/_react.createElement($ff7cb4cae699b79d58b93fa58010e9$export$CalendarBase, _babelRuntimeHelpersEsmExtends({}, props, {
296
- state: state,
297
- useCalendar: useRangeCalendar
298
- }));
355
+
356
+
357
+ var $205c8958670f81a4$exports = {};
358
+
359
+ $parcel$export($205c8958670f81a4$exports, "RangeCalendar", () => $205c8958670f81a4$export$a4f5c8b89d277a8d);
360
+
361
+
362
+
363
+
364
+
365
+
366
+ function $205c8958670f81a4$export$a4f5c8b89d277a8d(props) {
367
+ let { visibleMonths: visibleMonths = 1 } = props;
368
+ let visibleDuration = $73RbK$useMemo(()=>({
369
+ months: visibleMonths
370
+ })
371
+ , [
372
+ visibleMonths
373
+ ]);
374
+ let { locale: locale } = $73RbK$useLocale();
375
+ let state = $73RbK$useRangeCalendarState({
376
+ ...props,
377
+ locale: locale,
378
+ visibleDuration: visibleDuration,
379
+ createCalendar: $73RbK$createCalendar
380
+ });
381
+ return(/*#__PURE__*/ $73RbK$react.createElement($aa7be0d541cfb539$export$bfd52a43017368fe, {
382
+ ...props,
383
+ state: state,
384
+ useCalendar: $73RbK$useRangeCalendar
385
+ }));
299
386
  }
387
+
388
+
389
+
390
+
391
+ export {$c804ccf407f51ca3$export$e1aef45b828286de as Calendar, $205c8958670f81a4$export$a4f5c8b89d277a8d as RangeCalendar};
300
392
  //# sourceMappingURL=module.js.map