@react-spectrum/calendar 3.0.0-alpha.0

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 ADDED
@@ -0,0 +1,300 @@
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
+ import "./main.css";
18
+
19
+ function $parcel$interopDefault(a) {
20
+ return a && a.__esModule ? a.default : a;
21
+ }
22
+
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)));
127
+ }
128
+
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
175
+ });
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
+ }))))));
197
+ }
198
+
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
242
+ });
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));
258
+ }
259
+
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
+ }));
279
+ }
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
+ }));
299
+ }
300
+ //# sourceMappingURL=module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;;;;AAAA,SAASA,sBAAT,CAAgCC,CAAhC,EAAmC;AACjC,SAAOA,CAAC,IAAIA,CAAC,CAACC,UAAP,GAAoBD,CAAC,CAACE,OAAtB,GAAgCF,CAAvC;AACD;;;;ACFD,4CAAiB;AACf,uBAAqB,0BADN;AAEf,+BAA6B,kCAFd;AAGf,8BAA4B,iCAHb;AAIf,mCAAiC,sCAJlB;AAKf,6BAA2B,gCALZ;AAMf,iCAA+B,oCANhB;AAOf,iCAA+B,oCAPhB;AAQf,8BAA4B,iCARb;AASf,iCAA+B,oCAThB;AAUf,4BAA0B,+BAVX;AAWf,6BAA2B,gCAXZ;AAYf,iCAA+B,oCAZhB;AAaf,4BAA0B,+BAbX;AAcf,gCAA8B,mCAdf;AAef,iBAAe,oBAfA;AAgBf,qBAAmB,wBAhBJ;AAiBf,gBAAc,mBAjBC;AAkBf,wBAAsB,2BAlBP;AAmBf,oBAAkB,uBAnBH;AAoBf,wBAAsB,2BApBP;AAqBf,kBAAgB,qBArBD;AAsBf,sBAAoB,yBAtBL;AAuBf,wBAAsB,2BAvBP;AAwBf,cAAY,iBAxBG;AAyBf,iBAAe,oBAzBA;AA0Bf,gBAAc,mBA1BC;AA2Bf,gBAAc;AA3BC,CAAjB;;;AC4BO,SAASG,qDAAT,OAA0E;AAAA,MAApD;AAACC,IAAAA,KAAD;AAAQC,IAAAA;AAAR,GAAoD;AAAA,MAA3BC,KAA2B;;AAC/E,MAAIC,GAAG,GAAGC,MAAM,EAAhB;AACA,MAAI;AAACC,IAAAA,SAAD;AAAYC,IAAAA,WAAZ;AAAyBC,IAAAA;AAAzB,MAAsCC,eAAe,oCACpDN,KADoD;AAE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C5B3G,KAD4B;AAE/B0B,IAAAA,MAF+B;AAG/B6E,IAAAA,eAH+B;AAI/BE,IAAAA;AAJ+B,KAAjC;AAOA,sBACE,6GACMzG,KADN;AAEE,IAAA,KAAK,EAAEF,KAFT;AAGE,IAAA,WAAW,EAAE8G;AAHf,KADF;AAMD","sources":["./node_modules/@parcel/scope-hoisting/lib/helpers.js","./node_modules/@adobe/spectrum-css-temp/components/calendar/vars.css","./packages/@react-spectrum/calendar/src/CalendarCell.tsx","./packages/@react-spectrum/calendar/src/CalendarMonth.tsx","./packages/@react-spectrum/calendar/src/CalendarBase.tsx","./packages/@react-spectrum/calendar/src/Calendar.tsx","./packages/@react-spectrum/calendar/src/RangeCalendar.tsx"],"sourcesContent":["function $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\nfunction $parcel$defineInteropFlag(a) {\n Object.defineProperty(a, '__esModule', {value: true});\n}\n\nfunction $parcel$exportWildcard(dest, source) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule') {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function get() {\n return source[key];\n },\n });\n });\n\n return dest;\n}\n\nfunction $parcel$missingModule(name) {\n var err = new Error(\"Cannot find module '\" + name + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n}\n\nvar $parcel$global =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n@import './index.css';\n@import './skin.css';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaCalendarCellProps, useCalendarCell} from '@react-aria/calendar';\nimport {CalendarDate, getDayOfWeek, isEqualDay, isSameDay, isSameMonth, isToday} from '@internationalized/date';\nimport {CalendarState, RangeCalendarState} from '@react-stately/calendar';\nimport {classNames} from '@react-spectrum/utils';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {useMemo, useRef} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/calendar/vars.css';\nimport {useDateFormatter, useLocale} from '@react-aria/i18n';\nimport {useFocusRing} from '@react-aria/focus';\nimport {useHover} from '@react-aria/interactions';\n\ninterface CalendarCellProps extends AriaCalendarCellProps {\n state: CalendarState | RangeCalendarState,\n currentMonth: CalendarDate\n}\n\nexport function CalendarCell({state, currentMonth, ...props}: CalendarCellProps) {\n let ref = useRef<HTMLElement>();\n let {cellProps, buttonProps, isPressed} = useCalendarCell({\n ...props,\n isDisabled: !isSameMonth(props.date, currentMonth)\n }, state, ref);\n let {hoverProps, isHovered} = useHover({});\n let dateFormatter = useDateFormatter({\n day: 'numeric',\n timeZone: state.timeZone,\n calendar: currentMonth.calendar.identifier\n });\n let isSelected = state.isSelected(props.date);\n let highlightedRange = 'highlightedRange' in state && state.highlightedRange;\n let isSelectionStart = highlightedRange && isSameDay(props.date, highlightedRange.start);\n let isSelectionEnd = highlightedRange && isSameDay(props.date, highlightedRange.end);\n let {locale} = useLocale();\n let dayOfWeek = getDayOfWeek(props.date, locale);\n let isRangeStart = isSelected && (dayOfWeek === 0 || props.date.day === 1);\n let isRangeEnd = isSelected && (dayOfWeek === 6 || props.date.day === currentMonth.calendar.getDaysInMonth(currentMonth));\n let {focusProps, isFocusVisible} = useFocusRing();\n\n // For performance, reuse the same date object as before if the new date prop is the same.\n // This allows subsequent useMemo results to be reused.\n let date = props.date;\n let lastDate = useRef(null);\n if (lastDate.current && isEqualDay(date, lastDate.current)) {\n date = lastDate.current;\n }\n\n lastDate.current = date;\n\n let nativeDate = useMemo(() => date.toDate(state.timeZone), [date, state.timeZone]);\n let formatted = useMemo(() => dateFormatter.format(nativeDate), [dateFormatter, nativeDate]);\n\n return (\n <td\n {...cellProps}\n className={classNames(styles, 'spectrum-Calendar-tableCell')}>\n <span\n {...mergeProps(buttonProps, hoverProps, focusProps)}\n ref={ref}\n className={classNames(styles, 'spectrum-Calendar-date', {\n 'is-today': isToday(props.date, state.timeZone),\n 'is-selected': isSelected,\n 'is-focused': state.isCellFocused(props.date) && isFocusVisible,\n 'is-disabled': state.isCellDisabled(props.date),\n 'is-outsideMonth': !isSameMonth(props.date, currentMonth),\n 'is-range-start': isRangeStart,\n 'is-range-end': isRangeEnd,\n 'is-range-selection': isSelected && 'highlightedRange' in state,\n 'is-selection-start': isSelectionStart,\n 'is-selection-end': isSelectionEnd,\n 'is-hovered': isHovered,\n 'is-pressed': isPressed\n })}>\n <span className={classNames(styles, 'spectrum-Calendar-dateText')}>{formatted}</span>\n </span>\n </td>\n );\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CalendarCell} from './CalendarCell';\nimport {CalendarDate, endOfMonth, getWeeksInMonth, startOfWeek} from '@internationalized/date';\nimport {CalendarPropsBase} from '@react-types/calendar';\nimport {CalendarState, RangeCalendarState} from '@react-stately/calendar';\nimport {classNames} from '@react-spectrum/utils';\nimport {DOMProps, StyleProps} from '@react-types/shared';\nimport React, {useEffect, useState} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/calendar/vars.css';\nimport {useCalendarGrid} from '@react-aria/calendar';\nimport {useDateFormatter, useLocale} from '@react-aria/i18n';\nimport {useProviderProps} from '@react-spectrum/provider';\nimport {VisuallyHidden} from '@react-aria/visually-hidden';\n\ninterface CalendarMonthProps extends CalendarPropsBase, DOMProps, StyleProps {\n state: CalendarState | RangeCalendarState,\n startDate: CalendarDate\n}\n\nexport function CalendarMonth(props: CalendarMonthProps) {\n props = useProviderProps(props);\n let {\n state,\n startDate\n } = props;\n let {\n gridProps\n } = useCalendarGrid({\n ...props,\n endDate: endOfMonth(startDate)\n }, state);\n\n let dayFormatter = useDateFormatter({weekday: 'narrow'});\n let dayFormatterLong = useDateFormatter({weekday: 'long'});\n\n let {locale} = useLocale();\n let monthStart = startOfWeek(startDate, locale);\n let weeksInMonth = getWeeksInMonth(startDate, locale);\n\n let [isRangeSelecting, setRangeSelecting] = useState(false);\n let hasAnchorDate = 'anchorDate' in state && state.anchorDate != null;\n\n // Update isRangeSelecting immediately when it becomes true.\n // This feels weird but is actually fine...\n // https://reactjs.org/docs/hooks-faq.html#how-do-i-implement-getderivedstatefromprops\n if (hasAnchorDate && !isRangeSelecting) {\n setRangeSelecting(true);\n }\n\n // Delay removing the is-range-selecting class for a frame after selection ends.\n // This avoids an undesired animation on touch devices.\n useEffect(() => {\n if (!hasAnchorDate && isRangeSelecting) {\n let raf = requestAnimationFrame(() => setRangeSelecting(false));\n return () => cancelAnimationFrame(raf);\n }\n }, [hasAnchorDate, isRangeSelecting]);\n\n return (\n <table\n {...gridProps}\n className={classNames(styles, 'spectrum-Calendar-body', 'spectrum-Calendar-table', {'is-range-selecting': isRangeSelecting})}>\n <thead>\n <tr>\n {[...new Array(7).keys()].map((index) => {\n let date = monthStart.add({days: index});\n let dateDay = date.toDate(state.timeZone);\n let day = dayFormatter.format(dateDay);\n let dayLong = dayFormatterLong.format(dateDay);\n return (\n <th\n key={index}\n className={classNames(styles, 'spectrum-Calendar-tableCell')}>\n {/* Make sure screen readers read the full day name, but we show an abbreviation visually. */}\n <VisuallyHidden>{dayLong}</VisuallyHidden>\n <span aria-hidden=\"true\" className={classNames(styles, 'spectrum-Calendar-dayOfWeek')}>\n {day}\n </span>\n </th>\n );\n })}\n </tr>\n </thead>\n <tbody>\n {[...new Array(weeksInMonth).keys()].map(weekIndex => (\n <tr key={weekIndex}>\n {[...new Array(7).keys()].map(dayIndex => (\n <CalendarCell\n key={dayIndex}\n state={state}\n date={monthStart.add({weeks: weekIndex, days: dayIndex})}\n currentMonth={startDate} />\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n );\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {ActionButton} from '@react-spectrum/button';\nimport {CalendarAria} from '@react-aria/calendar';\nimport {CalendarMonth} from './CalendarMonth';\nimport {CalendarPropsBase} from '@react-types/calendar';\nimport {CalendarState, RangeCalendarState} from '@react-stately/calendar';\nimport ChevronLeft from '@spectrum-icons/ui/ChevronLeftLarge';\nimport ChevronRight from '@spectrum-icons/ui/ChevronRightLarge';\nimport {classNames} from '@react-spectrum/utils';\nimport {DOMProps, StyleProps} from '@react-types/shared';\nimport React, {RefObject, useRef} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/calendar/vars.css';\nimport {useDateFormatter, useLocale} from '@react-aria/i18n';\nimport {useProviderProps} from '@react-spectrum/provider';\n\ninterface CalendarBaseProps<T extends CalendarState | RangeCalendarState> extends CalendarPropsBase, DOMProps, StyleProps {\n state: T,\n useCalendar: (props: CalendarPropsBase, state: T, ref?: RefObject<HTMLElement>) => CalendarAria,\n visibleMonths?: number\n}\n\nexport function CalendarBase<T extends CalendarState | RangeCalendarState>(props: CalendarBaseProps<T>) {\n props = useProviderProps(props);\n let {\n state,\n useCalendar,\n visibleMonths = 1\n } = props;\n let {direction} = useLocale();\n let currentMonth = state.visibleRange.start;\n let monthDateFormatter = useDateFormatter({\n month: 'long',\n year: 'numeric',\n era: currentMonth.calendar.identifier !== 'gregory' ? 'long' : undefined,\n calendar: currentMonth.calendar.identifier\n });\n let ref = useRef(null);\n let {calendarProps, prevButtonProps, nextButtonProps} = useCalendar(props, state, ref);\n\n let titles = [];\n let calendars = [];\n for (let i = 0; i < visibleMonths; i++) {\n titles.push(\n <div key={i} className={classNames(styles, 'spectrum-Calendar-monthHeader')}>\n {i === 0 &&\n <ActionButton\n {...prevButtonProps}\n UNSAFE_className={classNames(styles, 'spectrum-Calendar-prevMonth')}\n isQuiet>\n {direction === 'rtl' ? <ChevronRight /> : <ChevronLeft />}\n </ActionButton>\n }\n <h2\n className={classNames(styles, 'spectrum-Calendar-title')}>\n {monthDateFormatter.format(currentMonth.add({months: i}).toDate(state.timeZone))}\n </h2>\n {i === visibleMonths - 1 &&\n <ActionButton\n {...nextButtonProps}\n UNSAFE_className={classNames(styles, 'spectrum-Calendar-nextMonth')}\n isQuiet>\n {direction === 'rtl' ? <ChevronLeft /> : <ChevronRight />}\n </ActionButton>\n }\n </div>\n );\n\n let d = currentMonth.add({months: i});\n calendars.push(\n <CalendarMonth\n {...props}\n key={`${d.year}-${d.month}-${d.day}`}\n state={state}\n startDate={d} />\n );\n }\n\n return (\n <div\n {...calendarProps}\n ref={ref}\n className={\n classNames(styles,\n 'spectrum-Calendar'\n )\n }>\n <div className={classNames(styles, 'spectrum-Calendar-header')}>\n {titles}\n </div>\n <div className={classNames(styles, 'spectrum-Calendar-months')}>\n {calendars}\n </div>\n </div>\n );\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CalendarBase} from './CalendarBase';\nimport {createCalendar} from '@internationalized/date';\nimport {DateValue, SpectrumCalendarProps} from '@react-types/calendar';\nimport React, {useMemo} from 'react';\nimport {useCalendar} from '@react-aria/calendar';\nimport {useCalendarState} from '@react-stately/calendar';\nimport {useLocale} from '@react-aria/i18n';\n\nexport function Calendar<T extends DateValue>(props: SpectrumCalendarProps<T>) {\n let {visibleMonths = 1} = props;\n let visibleDuration = useMemo(() => ({months: visibleMonths}), [visibleMonths]);\n let {locale} = useLocale();\n let state = useCalendarState({\n ...props,\n locale,\n visibleDuration,\n createCalendar\n });\n\n return (\n <CalendarBase\n {...props}\n state={state}\n useCalendar={useCalendar} />\n );\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CalendarBase} from './CalendarBase';\nimport {createCalendar} from '@internationalized/date';\nimport {DateValue, SpectrumRangeCalendarProps} from '@react-types/calendar';\nimport React, {useMemo} from 'react';\nimport {useLocale} from '@react-aria/i18n';\nimport {useRangeCalendar} from '@react-aria/calendar';\nimport {useRangeCalendarState} from '@react-stately/calendar';\n\nexport function RangeCalendar<T extends DateValue>(props: SpectrumRangeCalendarProps<T>) {\n let {visibleMonths = 1} = props;\n let visibleDuration = useMemo(() => ({months: visibleMonths}), [visibleMonths]);\n let {locale} = useLocale();\n let state = useRangeCalendarState({\n ...props,\n locale,\n visibleDuration,\n createCalendar\n });\n\n return (\n <CalendarBase\n {...props}\n state={state}\n useCalendar={useRangeCalendar} />\n );\n}\n"],"names":["$parcel$interopDefault","a","__esModule","default","CalendarCell","state","currentMonth","props","ref","useRef","cellProps","buttonProps","isPressed","useCalendarCell","isDisabled","isSameMonth","date","hoverProps","isHovered","useHover","dateFormatter","useDateFormatter","day","timeZone","calendar","identifier","isSelected","highlightedRange","isSelectionStart","isSameDay","start","isSelectionEnd","end","locale","useLocale","dayOfWeek","getDayOfWeek","isRangeStart","isRangeEnd","getDaysInMonth","focusProps","isFocusVisible","useFocusRing","lastDate","current","isEqualDay","nativeDate","useMemo","toDate","formatted","format","classNames","mergeProps","isToday","isCellFocused","isCellDisabled","CalendarMonth","useProviderProps","startDate","gridProps","useCalendarGrid","endDate","endOfMonth","dayFormatter","weekday","dayFormatterLong","monthStart","startOfWeek","weeksInMonth","getWeeksInMonth","isRangeSelecting","setRangeSelecting","useState","hasAnchorDate","anchorDate","useEffect","raf","requestAnimationFrame","cancelAnimationFrame","Array","keys","map","index","add","days","dateDay","dayLong","weekIndex","dayIndex","weeks","CalendarBase","useCalendar","visibleMonths","direction","visibleRange","monthDateFormatter","month","year","era","undefined","calendarProps","prevButtonProps","nextButtonProps","titles","calendars","i","push","months","d","Calendar","visibleDuration","useCalendarState","createCalendar","RangeCalendar","useRangeCalendarState","useRangeCalendar"],"version":3,"file":"module.js.map"}
@@ -0,0 +1,5 @@
1
+ import { DateValue, SpectrumCalendarProps, SpectrumRangeCalendarProps } from "@react-types/calendar";
2
+ export function Calendar<T extends DateValue>(props: SpectrumCalendarProps<T>): JSX.Element;
3
+ export function RangeCalendar<T extends DateValue>(props: SpectrumRangeCalendarProps<T>): JSX.Element;
4
+
5
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"mappings":"A;AGoBA,yBAAyB,CAAC,SAAS,SAAS,EAAE,KAAK,EAAE,sBAAsB,CAAC,CAAC,eAiB5E;ACjBD,8BAA8B,CAAC,SAAS,SAAS,EAAE,KAAK,EAAE,2BAA2B,CAAC,CAAC,eAiBtF","sources":["./packages/@react-spectrum/calendar/src/packages/@react-spectrum/calendar/src/CalendarCell.tsx","./packages/@react-spectrum/calendar/src/packages/@react-spectrum/calendar/src/CalendarMonth.tsx","./packages/@react-spectrum/calendar/src/packages/@react-spectrum/calendar/src/CalendarBase.tsx","./packages/@react-spectrum/calendar/src/packages/@react-spectrum/calendar/src/Calendar.tsx","./packages/@react-spectrum/calendar/src/packages/@react-spectrum/calendar/src/RangeCalendar.tsx","./packages/@react-spectrum/calendar/src/packages/@react-spectrum/calendar/src/index.ts"],"sourcesContent":[null,null,null,null,null,null],"names":[],"version":3,"file":"types.d.ts.map"}
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@react-spectrum/calendar",
3
+ "version": "3.0.0-alpha.0",
4
+ "description": "Spectrum UI components in React",
5
+ "license": "Apache-2.0",
6
+ "main": "dist/main.js",
7
+ "module": "dist/module.js",
8
+ "types": "dist/types.d.ts",
9
+ "source": "src/index.ts",
10
+ "files": [
11
+ "dist",
12
+ "src"
13
+ ],
14
+ "sideEffects": [
15
+ "*.css"
16
+ ],
17
+ "targets": {
18
+ "main": {
19
+ "includeNodeModules": [
20
+ "@adobe/spectrum-css-temp"
21
+ ]
22
+ },
23
+ "module": {
24
+ "includeNodeModules": [
25
+ "@adobe/spectrum-css-temp"
26
+ ]
27
+ }
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "https://github.com/adobe/react-spectrum"
32
+ },
33
+ "dependencies": {
34
+ "@babel/runtime": "^7.6.2",
35
+ "@internationalized/date": "3.0.0-alpha.0",
36
+ "@react-aria/calendar": "3.0.0-alpha.0",
37
+ "@react-aria/focus": "^3.1.0",
38
+ "@react-aria/i18n": "^3.3.3",
39
+ "@react-aria/interactions": "^3.7.0",
40
+ "@react-aria/utils": "^3.10.0",
41
+ "@react-aria/visually-hidden": "^3.1.0",
42
+ "@react-spectrum/button": "^3.1.0",
43
+ "@react-spectrum/utils": "^3.6.3",
44
+ "@react-stately/calendar": "3.0.0-alpha.0",
45
+ "@react-types/calendar": "3.0.0-alpha.0",
46
+ "@react-types/shared": "^3.10.0",
47
+ "@spectrum-icons/ui": "^3.1.0",
48
+ "date-fns": "^1.30.1"
49
+ },
50
+ "devDependencies": {
51
+ "@adobe/spectrum-css-temp": "3.0.0-alpha.1",
52
+ "@react-spectrum/test-utils": "3.0.0-alpha.1"
53
+ },
54
+ "peerDependencies": {
55
+ "@react-spectrum/provider": "^3.0.0",
56
+ "react": "^16.8.0 || ^17.0.0-rc.1",
57
+ "react-dom": "^16.8.0 || ^17.0.0-rc.1"
58
+ },
59
+ "publishConfig": {
60
+ "access": "public"
61
+ },
62
+ "gitHead": "896eabe5521a0349a675c4773ed7629addd4b8c4"
63
+ }
@@ -0,0 +1,38 @@
1
+ /*
2
+ * Copyright 2020 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+
13
+ import {CalendarBase} from './CalendarBase';
14
+ import {createCalendar} from '@internationalized/date';
15
+ import {DateValue, SpectrumCalendarProps} from '@react-types/calendar';
16
+ import React, {useMemo} from 'react';
17
+ import {useCalendar} from '@react-aria/calendar';
18
+ import {useCalendarState} from '@react-stately/calendar';
19
+ import {useLocale} from '@react-aria/i18n';
20
+
21
+ export function Calendar<T extends DateValue>(props: SpectrumCalendarProps<T>) {
22
+ let {visibleMonths = 1} = props;
23
+ let visibleDuration = useMemo(() => ({months: visibleMonths}), [visibleMonths]);
24
+ let {locale} = useLocale();
25
+ let state = useCalendarState({
26
+ ...props,
27
+ locale,
28
+ visibleDuration,
29
+ createCalendar
30
+ });
31
+
32
+ return (
33
+ <CalendarBase
34
+ {...props}
35
+ state={state}
36
+ useCalendar={useCalendar} />
37
+ );
38
+ }
@@ -0,0 +1,106 @@
1
+ /*
2
+ * Copyright 2020 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+
13
+ import {ActionButton} from '@react-spectrum/button';
14
+ import {CalendarAria} from '@react-aria/calendar';
15
+ import {CalendarMonth} from './CalendarMonth';
16
+ import {CalendarPropsBase} from '@react-types/calendar';
17
+ import {CalendarState, RangeCalendarState} from '@react-stately/calendar';
18
+ import ChevronLeft from '@spectrum-icons/ui/ChevronLeftLarge';
19
+ import ChevronRight from '@spectrum-icons/ui/ChevronRightLarge';
20
+ import {classNames} from '@react-spectrum/utils';
21
+ import {DOMProps, StyleProps} from '@react-types/shared';
22
+ import React, {RefObject, useRef} from 'react';
23
+ import styles from '@adobe/spectrum-css-temp/components/calendar/vars.css';
24
+ import {useDateFormatter, useLocale} from '@react-aria/i18n';
25
+ import {useProviderProps} from '@react-spectrum/provider';
26
+
27
+ interface CalendarBaseProps<T extends CalendarState | RangeCalendarState> extends CalendarPropsBase, DOMProps, StyleProps {
28
+ state: T,
29
+ useCalendar: (props: CalendarPropsBase, state: T, ref?: RefObject<HTMLElement>) => CalendarAria,
30
+ visibleMonths?: number
31
+ }
32
+
33
+ export function CalendarBase<T extends CalendarState | RangeCalendarState>(props: CalendarBaseProps<T>) {
34
+ props = useProviderProps(props);
35
+ let {
36
+ state,
37
+ useCalendar,
38
+ visibleMonths = 1
39
+ } = props;
40
+ let {direction} = useLocale();
41
+ let currentMonth = state.visibleRange.start;
42
+ let monthDateFormatter = useDateFormatter({
43
+ month: 'long',
44
+ year: 'numeric',
45
+ era: currentMonth.calendar.identifier !== 'gregory' ? 'long' : undefined,
46
+ calendar: currentMonth.calendar.identifier
47
+ });
48
+ let ref = useRef(null);
49
+ let {calendarProps, prevButtonProps, nextButtonProps} = useCalendar(props, state, ref);
50
+
51
+ let titles = [];
52
+ let calendars = [];
53
+ for (let i = 0; i < visibleMonths; i++) {
54
+ titles.push(
55
+ <div key={i} className={classNames(styles, 'spectrum-Calendar-monthHeader')}>
56
+ {i === 0 &&
57
+ <ActionButton
58
+ {...prevButtonProps}
59
+ UNSAFE_className={classNames(styles, 'spectrum-Calendar-prevMonth')}
60
+ isQuiet>
61
+ {direction === 'rtl' ? <ChevronRight /> : <ChevronLeft />}
62
+ </ActionButton>
63
+ }
64
+ <h2
65
+ className={classNames(styles, 'spectrum-Calendar-title')}>
66
+ {monthDateFormatter.format(currentMonth.add({months: i}).toDate(state.timeZone))}
67
+ </h2>
68
+ {i === visibleMonths - 1 &&
69
+ <ActionButton
70
+ {...nextButtonProps}
71
+ UNSAFE_className={classNames(styles, 'spectrum-Calendar-nextMonth')}
72
+ isQuiet>
73
+ {direction === 'rtl' ? <ChevronLeft /> : <ChevronRight />}
74
+ </ActionButton>
75
+ }
76
+ </div>
77
+ );
78
+
79
+ let d = currentMonth.add({months: i});
80
+ calendars.push(
81
+ <CalendarMonth
82
+ {...props}
83
+ key={`${d.year}-${d.month}-${d.day}`}
84
+ state={state}
85
+ startDate={d} />
86
+ );
87
+ }
88
+
89
+ return (
90
+ <div
91
+ {...calendarProps}
92
+ ref={ref}
93
+ className={
94
+ classNames(styles,
95
+ 'spectrum-Calendar'
96
+ )
97
+ }>
98
+ <div className={classNames(styles, 'spectrum-Calendar-header')}>
99
+ {titles}
100
+ </div>
101
+ <div className={classNames(styles, 'spectrum-Calendar-months')}>
102
+ {calendars}
103
+ </div>
104
+ </div>
105
+ );
106
+ }