@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/main.js ADDED
@@ -0,0 +1,365 @@
1
+ var {
2
+ useCalendarState,
3
+ useRangeCalendarState
4
+ } = require("@react-stately/calendar");
5
+
6
+ var _spectrumIconsUiChevronRightLarge = $parcel$interopDefault(require("@spectrum-icons/ui/ChevronRightLarge"));
7
+
8
+ var _spectrumIconsUiChevronLeftLarge = $parcel$interopDefault(require("@spectrum-icons/ui/ChevronLeftLarge"));
9
+
10
+ var {
11
+ VisuallyHidden
12
+ } = require("@react-aria/visually-hidden");
13
+
14
+ var {
15
+ useProviderProps
16
+ } = require("@react-spectrum/provider");
17
+
18
+ var {
19
+ useHover
20
+ } = require("@react-aria/interactions");
21
+
22
+ var {
23
+ useFocusRing
24
+ } = require("@react-aria/focus");
25
+
26
+ var {
27
+ useDateFormatter,
28
+ useLocale
29
+ } = require("@react-aria/i18n");
30
+
31
+ var _react2 = require("react");
32
+
33
+ var _react = $parcel$interopDefault(_react2);
34
+
35
+ var {
36
+ useMemo,
37
+ useRef,
38
+ useEffect,
39
+ useState
40
+ } = _react2;
41
+
42
+ var {
43
+ mergeProps
44
+ } = require("@react-aria/utils");
45
+
46
+ var {
47
+ classNames
48
+ } = require("@react-spectrum/utils");
49
+
50
+ var {
51
+ getDayOfWeek,
52
+ isEqualDay,
53
+ isSameDay,
54
+ isSameMonth,
55
+ isToday,
56
+ endOfMonth,
57
+ getWeeksInMonth,
58
+ startOfWeek,
59
+ createCalendar
60
+ } = require("@internationalized/date");
61
+
62
+ var {
63
+ useCalendarCell,
64
+ useCalendarGrid,
65
+ useCalendar: _useCalendar,
66
+ useRangeCalendar
67
+ } = require("@react-aria/calendar");
68
+
69
+ var _babelRuntimeHelpersObjectWithoutPropertiesLoose = $parcel$interopDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
70
+
71
+ var {
72
+ ActionButton
73
+ } = require("@react-spectrum/button");
74
+
75
+ var _babelRuntimeHelpersExtends = $parcel$interopDefault(require("@babel/runtime/helpers/extends"));
76
+
77
+ require("./main.css");
78
+
79
+ function $parcel$interopDefault(a) {
80
+ return a && a.__esModule ? a.default : a;
81
+ }
82
+
83
+ // ASSET: /Users/govett/dev/react-spectrum-v3/node_modules/@adobe/spectrum-css-temp/components/calendar/vars.css
84
+ var $fc2fc91c11e03e6573b316082f3cde$exports = {};
85
+ $fc2fc91c11e03e6573b316082f3cde$exports = {
86
+ "spectrum-Calendar": "_spectrum-Calendar_b7235",
87
+ "spectrum-Calendar--padded": "_spectrum-Calendar--padded_b7235",
88
+ "spectrum-Calendar-header": "_spectrum-Calendar-header_b7235",
89
+ "spectrum-Calendar-monthHeader": "_spectrum-Calendar-monthHeader_b7235",
90
+ "spectrum-Calendar-title": "_spectrum-Calendar-title_b7235",
91
+ "spectrum-Calendar-prevMonth": "_spectrum-Calendar-prevMonth_b7235",
92
+ "spectrum-Calendar-nextMonth": "_spectrum-Calendar-nextMonth_b7235",
93
+ "spectrum-Calendar-months": "_spectrum-Calendar-months_b7235",
94
+ "spectrum-Calendar-dayOfWeek": "_spectrum-Calendar-dayOfWeek_b7235",
95
+ "spectrum-Calendar-body": "_spectrum-Calendar-body_b7235",
96
+ "spectrum-Calendar-table": "_spectrum-Calendar-table_b7235",
97
+ "spectrum-Calendar-tableCell": "_spectrum-Calendar-tableCell_b7235",
98
+ "spectrum-Calendar-date": "_spectrum-Calendar-date_b7235",
99
+ "spectrum-Calendar-dateText": "_spectrum-Calendar-dateText_b7235",
100
+ "is-disabled": "_is-disabled_b7235",
101
+ "is-outsideMonth": "_is-outsideMonth_b7235",
102
+ "is-focused": "_is-focused_b7235",
103
+ "is-range-selection": "_is-range-selection_b7235",
104
+ "is-range-start": "_is-range-start_b7235",
105
+ "is-selection-start": "_is-selection-start_b7235",
106
+ "is-range-end": "_is-range-end_b7235",
107
+ "is-selection-end": "_is-selection-end_b7235",
108
+ "is-range-selecting": "_is-range-selecting_b7235",
109
+ "is-today": "_is-today_b7235",
110
+ "is-selected": "_is-selected_b7235",
111
+ "is-hovered": "_is-hovered_b7235",
112
+ "is-pressed": "_is-pressed_b7235"
113
+ };
114
+ var $fc2fc91c11e03e6573b316082f3cde$$interop$default = $parcel$interopDefault($fc2fc91c11e03e6573b316082f3cde$exports);
115
+
116
+ function $a724b9f005a0f81fd8e885eddefe2b9$export$CalendarCell(_ref) {
117
+ let {
118
+ state,
119
+ currentMonth
120
+ } = _ref,
121
+ props = _babelRuntimeHelpersObjectWithoutPropertiesLoose(_ref, ["state", "currentMonth"]);
122
+
123
+ let ref = useRef();
124
+ let {
125
+ cellProps,
126
+ buttonProps,
127
+ isPressed
128
+ } = useCalendarCell(_babelRuntimeHelpersExtends({}, props, {
129
+ isDisabled: !isSameMonth(props.date, currentMonth)
130
+ }), state, ref);
131
+ let {
132
+ hoverProps,
133
+ isHovered
134
+ } = useHover({});
135
+ let dateFormatter = useDateFormatter({
136
+ day: 'numeric',
137
+ timeZone: state.timeZone,
138
+ calendar: currentMonth.calendar.identifier
139
+ });
140
+ let isSelected = state.isSelected(props.date);
141
+ let highlightedRange = 'highlightedRange' in state && state.highlightedRange;
142
+ let isSelectionStart = highlightedRange && isSameDay(props.date, highlightedRange.start);
143
+ let isSelectionEnd = highlightedRange && isSameDay(props.date, highlightedRange.end);
144
+ let {
145
+ locale
146
+ } = useLocale();
147
+ let dayOfWeek = getDayOfWeek(props.date, locale);
148
+ let isRangeStart = isSelected && (dayOfWeek === 0 || props.date.day === 1);
149
+ let isRangeEnd = isSelected && (dayOfWeek === 6 || props.date.day === currentMonth.calendar.getDaysInMonth(currentMonth));
150
+ let {
151
+ focusProps,
152
+ isFocusVisible
153
+ } = useFocusRing(); // For performance, reuse the same date object as before if the new date prop is the same.
154
+ // This allows subsequent useMemo results to be reused.
155
+
156
+ let date = props.date;
157
+ let lastDate = useRef(null);
158
+
159
+ if (lastDate.current && isEqualDay(date, lastDate.current)) {
160
+ date = lastDate.current;
161
+ }
162
+
163
+ lastDate.current = date;
164
+ let nativeDate = useMemo(() => date.toDate(state.timeZone), [date, state.timeZone]);
165
+ let formatted = useMemo(() => dateFormatter.format(nativeDate), [dateFormatter, nativeDate]);
166
+ return /*#__PURE__*/_react.createElement("td", _babelRuntimeHelpersExtends({}, cellProps, {
167
+ className: classNames($fc2fc91c11e03e6573b316082f3cde$$interop$default, 'spectrum-Calendar-tableCell')
168
+ }), /*#__PURE__*/_react.createElement("span", _babelRuntimeHelpersExtends({}, mergeProps(buttonProps, hoverProps, focusProps), {
169
+ ref: ref,
170
+ className: classNames($fc2fc91c11e03e6573b316082f3cde$$interop$default, 'spectrum-Calendar-date', {
171
+ 'is-today': isToday(props.date, state.timeZone),
172
+ 'is-selected': isSelected,
173
+ 'is-focused': state.isCellFocused(props.date) && isFocusVisible,
174
+ 'is-disabled': state.isCellDisabled(props.date),
175
+ 'is-outsideMonth': !isSameMonth(props.date, currentMonth),
176
+ 'is-range-start': isRangeStart,
177
+ 'is-range-end': isRangeEnd,
178
+ 'is-range-selection': isSelected && 'highlightedRange' in state,
179
+ 'is-selection-start': isSelectionStart,
180
+ 'is-selection-end': isSelectionEnd,
181
+ 'is-hovered': isHovered,
182
+ 'is-pressed': isPressed
183
+ })
184
+ }), /*#__PURE__*/_react.createElement("span", {
185
+ className: classNames($fc2fc91c11e03e6573b316082f3cde$$interop$default, 'spectrum-Calendar-dateText')
186
+ }, formatted)));
187
+ }
188
+
189
+ function $d7c2e7213583e3c468b07d5c707af2$export$CalendarMonth(props) {
190
+ props = useProviderProps(props);
191
+ let {
192
+ state,
193
+ startDate
194
+ } = props;
195
+ let {
196
+ gridProps
197
+ } = useCalendarGrid(_babelRuntimeHelpersExtends({}, props, {
198
+ endDate: endOfMonth(startDate)
199
+ }), state);
200
+ let dayFormatter = useDateFormatter({
201
+ weekday: 'narrow'
202
+ });
203
+ let dayFormatterLong = useDateFormatter({
204
+ weekday: 'long'
205
+ });
206
+ let {
207
+ locale
208
+ } = useLocale();
209
+ let monthStart = startOfWeek(startDate, locale);
210
+ let weeksInMonth = getWeeksInMonth(startDate, locale);
211
+ let [isRangeSelecting, setRangeSelecting] = useState(false);
212
+ let hasAnchorDate = 'anchorDate' in state && state.anchorDate != null; // Update isRangeSelecting immediately when it becomes true.
213
+ // This feels weird but is actually fine...
214
+ // https://reactjs.org/docs/hooks-faq.html#how-do-i-implement-getderivedstatefromprops
215
+
216
+ if (hasAnchorDate && !isRangeSelecting) {
217
+ setRangeSelecting(true);
218
+ } // Delay removing the is-range-selecting class for a frame after selection ends.
219
+ // This avoids an undesired animation on touch devices.
220
+
221
+
222
+ useEffect(() => {
223
+ if (!hasAnchorDate && isRangeSelecting) {
224
+ let raf = requestAnimationFrame(() => setRangeSelecting(false));
225
+ return () => cancelAnimationFrame(raf);
226
+ }
227
+ }, [hasAnchorDate, isRangeSelecting]);
228
+ return /*#__PURE__*/_react.createElement("table", _babelRuntimeHelpersExtends({}, gridProps, {
229
+ className: classNames($fc2fc91c11e03e6573b316082f3cde$$interop$default, 'spectrum-Calendar-body', 'spectrum-Calendar-table', {
230
+ 'is-range-selecting': isRangeSelecting
231
+ })
232
+ }), /*#__PURE__*/_react.createElement("thead", null, /*#__PURE__*/_react.createElement("tr", null, [...new Array(7).keys()].map(index => {
233
+ let date = monthStart.add({
234
+ days: index
235
+ });
236
+ let dateDay = date.toDate(state.timeZone);
237
+ let day = dayFormatter.format(dateDay);
238
+ let dayLong = dayFormatterLong.format(dateDay);
239
+ return /*#__PURE__*/_react.createElement("th", {
240
+ key: index,
241
+ className: classNames($fc2fc91c11e03e6573b316082f3cde$$interop$default, 'spectrum-Calendar-tableCell')
242
+ }, /*#__PURE__*/_react.createElement(VisuallyHidden, null, dayLong), /*#__PURE__*/_react.createElement("span", {
243
+ "aria-hidden": "true",
244
+ className: classNames($fc2fc91c11e03e6573b316082f3cde$$interop$default, 'spectrum-Calendar-dayOfWeek')
245
+ }, day));
246
+ }))), /*#__PURE__*/_react.createElement("tbody", null, [...new Array(weeksInMonth).keys()].map(weekIndex => /*#__PURE__*/_react.createElement("tr", {
247
+ key: weekIndex
248
+ }, [...new Array(7).keys()].map(dayIndex => /*#__PURE__*/_react.createElement($a724b9f005a0f81fd8e885eddefe2b9$export$CalendarCell, {
249
+ key: dayIndex,
250
+ state: state,
251
+ date: monthStart.add({
252
+ weeks: weekIndex,
253
+ days: dayIndex
254
+ }),
255
+ currentMonth: startDate
256
+ }))))));
257
+ }
258
+
259
+ function $c5c738c2592de01e15d070fbb9b608f$export$CalendarBase(props) {
260
+ props = useProviderProps(props);
261
+ let {
262
+ state,
263
+ useCalendar,
264
+ visibleMonths = 1
265
+ } = props;
266
+ let {
267
+ direction
268
+ } = useLocale();
269
+ let currentMonth = state.visibleRange.start;
270
+ let monthDateFormatter = useDateFormatter({
271
+ month: 'long',
272
+ year: 'numeric',
273
+ era: currentMonth.calendar.identifier !== 'gregory' ? 'long' : undefined,
274
+ calendar: currentMonth.calendar.identifier
275
+ });
276
+ let ref = useRef(null);
277
+ let {
278
+ calendarProps,
279
+ prevButtonProps,
280
+ nextButtonProps
281
+ } = useCalendar(props, state, ref);
282
+ let titles = [];
283
+ let calendars = [];
284
+
285
+ for (let i = 0; i < visibleMonths; i++) {
286
+ titles.push( /*#__PURE__*/_react.createElement("div", {
287
+ key: i,
288
+ className: classNames($fc2fc91c11e03e6573b316082f3cde$$interop$default, 'spectrum-Calendar-monthHeader')
289
+ }, i === 0 && /*#__PURE__*/_react.createElement(ActionButton, _babelRuntimeHelpersExtends({}, prevButtonProps, {
290
+ UNSAFE_className: classNames($fc2fc91c11e03e6573b316082f3cde$$interop$default, 'spectrum-Calendar-prevMonth'),
291
+ isQuiet: true
292
+ }), direction === 'rtl' ? /*#__PURE__*/_react.createElement(_spectrumIconsUiChevronRightLarge, null) : /*#__PURE__*/_react.createElement(_spectrumIconsUiChevronLeftLarge, null)), /*#__PURE__*/_react.createElement("h2", {
293
+ className: classNames($fc2fc91c11e03e6573b316082f3cde$$interop$default, 'spectrum-Calendar-title')
294
+ }, monthDateFormatter.format(currentMonth.add({
295
+ months: i
296
+ }).toDate(state.timeZone))), i === visibleMonths - 1 && /*#__PURE__*/_react.createElement(ActionButton, _babelRuntimeHelpersExtends({}, nextButtonProps, {
297
+ UNSAFE_className: classNames($fc2fc91c11e03e6573b316082f3cde$$interop$default, 'spectrum-Calendar-nextMonth'),
298
+ isQuiet: true
299
+ }), direction === 'rtl' ? /*#__PURE__*/_react.createElement(_spectrumIconsUiChevronLeftLarge, null) : /*#__PURE__*/_react.createElement(_spectrumIconsUiChevronRightLarge, null))));
300
+ let d = currentMonth.add({
301
+ months: i
302
+ });
303
+ calendars.push( /*#__PURE__*/_react.createElement($d7c2e7213583e3c468b07d5c707af2$export$CalendarMonth, _babelRuntimeHelpersExtends({}, props, {
304
+ key: d.year + "-" + d.month + "-" + d.day,
305
+ state: state,
306
+ startDate: d
307
+ })));
308
+ }
309
+
310
+ return /*#__PURE__*/_react.createElement("div", _babelRuntimeHelpersExtends({}, calendarProps, {
311
+ ref: ref,
312
+ className: classNames($fc2fc91c11e03e6573b316082f3cde$$interop$default, 'spectrum-Calendar')
313
+ }), /*#__PURE__*/_react.createElement("div", {
314
+ className: classNames($fc2fc91c11e03e6573b316082f3cde$$interop$default, 'spectrum-Calendar-header')
315
+ }, titles), /*#__PURE__*/_react.createElement("div", {
316
+ className: classNames($fc2fc91c11e03e6573b316082f3cde$$interop$default, 'spectrum-Calendar-months')
317
+ }, calendars));
318
+ }
319
+
320
+ function Calendar(props) {
321
+ let {
322
+ visibleMonths = 1
323
+ } = props;
324
+ let visibleDuration = useMemo(() => ({
325
+ months: visibleMonths
326
+ }), [visibleMonths]);
327
+ let {
328
+ locale
329
+ } = useLocale();
330
+ let state = useCalendarState(_babelRuntimeHelpersExtends({}, props, {
331
+ locale,
332
+ visibleDuration,
333
+ createCalendar
334
+ }));
335
+ return /*#__PURE__*/_react.createElement($c5c738c2592de01e15d070fbb9b608f$export$CalendarBase, _babelRuntimeHelpersExtends({}, props, {
336
+ state: state,
337
+ useCalendar: _useCalendar
338
+ }));
339
+ }
340
+
341
+ exports.Calendar = Calendar;
342
+
343
+ function RangeCalendar(props) {
344
+ let {
345
+ visibleMonths = 1
346
+ } = props;
347
+ let visibleDuration = useMemo(() => ({
348
+ months: visibleMonths
349
+ }), [visibleMonths]);
350
+ let {
351
+ locale
352
+ } = useLocale();
353
+ let state = useRangeCalendarState(_babelRuntimeHelpersExtends({}, props, {
354
+ locale,
355
+ visibleDuration,
356
+ createCalendar
357
+ }));
358
+ return /*#__PURE__*/_react.createElement($c5c738c2592de01e15d070fbb9b608f$export$CalendarBase, _babelRuntimeHelpersExtends({}, props, {
359
+ state: state,
360
+ useCalendar: useRangeCalendar
361
+ }));
362
+ }
363
+
364
+ exports.RangeCalendar = RangeCalendar;
365
+ //# sourceMappingURL=main.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,0CAAiB;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,2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B;AAG1B6E,IAAAA,eAH0B;AAI1BE,IAAAA;AAJ0B,KAA5B;AAOA,sBACE,2GACMzG,KADN;AAEE,IAAA,KAAK,EAAEF,KAFT;AAGE,IAAA,WAAW,EAAEsF;AAHf,KADF;AAMD;;;;ACjBM,SAASsB,aAAT,CAA4C1G,KAA5C,EAAkF;AACvF,MAAI;AAACqF,IAAAA,aAAa,GAAG;AAAjB,MAAsBrF,KAA1B;AACA,MAAIuG,eAAe,GAAG/D,OAAO,CAAC,OAAO;AAAC4D,IAAAA,MAAM,EAAEf;AAAT,GAAP,CAAD,EAAkC,CAACA,aAAD,CAAlC,CAA7B;AACA,MAAI;AAAC3D,IAAAA;AAAD,MAAWC,SAAS,EAAxB;AACA,MAAI7B,KAAK,GAAG6G,qBAAqB,iCAC5B3G,KAD4B;AAE/B0B,IAAAA,MAF+B;AAG/B6E,IAAAA,eAH+B;AAI/BE,IAAAA;AAJ+B,KAAjC;AAOA,sBACE,2GACMzG,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":"main.js.map"}