@react-spectrum/calendar 3.7.11 → 3.8.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/import.mjs +3 -3
- package/dist/main.js +4 -4
- package/dist/main.js.map +1 -1
- package/dist/module.js +3 -3
- package/dist/module.js.map +1 -1
- package/dist/types/src/index.d.ts +4 -0
- package/package.json +12 -40
- package/src/index.ts +5 -3
- package/dist/Calendar.main.js +0 -75
- package/dist/Calendar.main.js.map +0 -1
- package/dist/Calendar.mjs +0 -66
- package/dist/Calendar.module.js +0 -66
- package/dist/Calendar.module.js.map +0 -1
- package/dist/CalendarBase.main.js +0 -121
- package/dist/CalendarBase.main.js.map +0 -1
- package/dist/CalendarBase.mjs +0 -116
- package/dist/CalendarBase.module.js +0 -116
- package/dist/CalendarBase.module.js.map +0 -1
- package/dist/CalendarCell.main.js +0 -95
- package/dist/CalendarCell.main.js.map +0 -1
- package/dist/CalendarCell.mjs +0 -90
- package/dist/CalendarCell.module.js +0 -90
- package/dist/CalendarCell.module.js.map +0 -1
- package/dist/CalendarMonth.main.js +0 -65
- package/dist/CalendarMonth.main.js.map +0 -1
- package/dist/CalendarMonth.mjs +0 -60
- package/dist/CalendarMonth.module.js +0 -60
- package/dist/CalendarMonth.module.js.map +0 -1
- package/dist/RangeCalendar.main.js +0 -75
- package/dist/RangeCalendar.main.js.map +0 -1
- package/dist/RangeCalendar.mjs +0 -66
- package/dist/RangeCalendar.module.js +0 -66
- package/dist/RangeCalendar.module.js.map +0 -1
- package/dist/ar-AE.main.js +0 -9
- package/dist/ar-AE.main.js.map +0 -1
- package/dist/ar-AE.mjs +0 -11
- package/dist/ar-AE.module.js +0 -11
- package/dist/ar-AE.module.js.map +0 -1
- package/dist/bg-BG.main.js +0 -9
- package/dist/bg-BG.main.js.map +0 -1
- package/dist/bg-BG.mjs +0 -11
- package/dist/bg-BG.module.js +0 -11
- package/dist/bg-BG.module.js.map +0 -1
- package/dist/calendar.e1e61a27.css +0 -924
- package/dist/calendar.e1e61a27.css.map +0 -1
- package/dist/calendar_vars_css.main.js +0 -116
- package/dist/calendar_vars_css.main.js.map +0 -1
- package/dist/calendar_vars_css.mjs +0 -118
- package/dist/calendar_vars_css.module.js +0 -118
- package/dist/calendar_vars_css.module.js.map +0 -1
- package/dist/cs-CZ.main.js +0 -9
- package/dist/cs-CZ.main.js.map +0 -1
- package/dist/cs-CZ.mjs +0 -11
- package/dist/cs-CZ.module.js +0 -11
- package/dist/cs-CZ.module.js.map +0 -1
- package/dist/da-DK.main.js +0 -9
- package/dist/da-DK.main.js.map +0 -1
- package/dist/da-DK.mjs +0 -11
- package/dist/da-DK.module.js +0 -11
- package/dist/da-DK.module.js.map +0 -1
- package/dist/de-DE.main.js +0 -9
- package/dist/de-DE.main.js.map +0 -1
- package/dist/de-DE.mjs +0 -11
- package/dist/de-DE.module.js +0 -11
- package/dist/de-DE.module.js.map +0 -1
- package/dist/el-GR.main.js +0 -9
- package/dist/el-GR.main.js.map +0 -1
- package/dist/el-GR.mjs +0 -11
- package/dist/el-GR.module.js +0 -11
- package/dist/el-GR.module.js.map +0 -1
- package/dist/en-US.main.js +0 -9
- package/dist/en-US.main.js.map +0 -1
- package/dist/en-US.mjs +0 -11
- package/dist/en-US.module.js +0 -11
- package/dist/en-US.module.js.map +0 -1
- package/dist/es-ES.main.js +0 -9
- package/dist/es-ES.main.js.map +0 -1
- package/dist/es-ES.mjs +0 -11
- package/dist/es-ES.module.js +0 -11
- package/dist/es-ES.module.js.map +0 -1
- package/dist/et-EE.main.js +0 -9
- package/dist/et-EE.main.js.map +0 -1
- package/dist/et-EE.mjs +0 -11
- package/dist/et-EE.module.js +0 -11
- package/dist/et-EE.module.js.map +0 -1
- package/dist/fi-FI.main.js +0 -9
- package/dist/fi-FI.main.js.map +0 -1
- package/dist/fi-FI.mjs +0 -11
- package/dist/fi-FI.module.js +0 -11
- package/dist/fi-FI.module.js.map +0 -1
- package/dist/fr-FR.main.js +0 -9
- package/dist/fr-FR.main.js.map +0 -1
- package/dist/fr-FR.mjs +0 -11
- package/dist/fr-FR.module.js +0 -11
- package/dist/fr-FR.module.js.map +0 -1
- package/dist/he-IL.main.js +0 -9
- package/dist/he-IL.main.js.map +0 -1
- package/dist/he-IL.mjs +0 -11
- package/dist/he-IL.module.js +0 -11
- package/dist/he-IL.module.js.map +0 -1
- package/dist/hr-HR.main.js +0 -9
- package/dist/hr-HR.main.js.map +0 -1
- package/dist/hr-HR.mjs +0 -11
- package/dist/hr-HR.module.js +0 -11
- package/dist/hr-HR.module.js.map +0 -1
- package/dist/hu-HU.main.js +0 -9
- package/dist/hu-HU.main.js.map +0 -1
- package/dist/hu-HU.mjs +0 -11
- package/dist/hu-HU.module.js +0 -11
- package/dist/hu-HU.module.js.map +0 -1
- package/dist/intlStrings.main.js +0 -108
- package/dist/intlStrings.main.js.map +0 -1
- package/dist/intlStrings.mjs +0 -110
- package/dist/intlStrings.module.js +0 -110
- package/dist/intlStrings.module.js.map +0 -1
- package/dist/it-IT.main.js +0 -9
- package/dist/it-IT.main.js.map +0 -1
- package/dist/it-IT.mjs +0 -11
- package/dist/it-IT.module.js +0 -11
- package/dist/it-IT.module.js.map +0 -1
- package/dist/ja-JP.main.js +0 -9
- package/dist/ja-JP.main.js.map +0 -1
- package/dist/ja-JP.mjs +0 -11
- package/dist/ja-JP.module.js +0 -11
- package/dist/ja-JP.module.js.map +0 -1
- package/dist/ko-KR.main.js +0 -9
- package/dist/ko-KR.main.js.map +0 -1
- package/dist/ko-KR.mjs +0 -11
- package/dist/ko-KR.module.js +0 -11
- package/dist/ko-KR.module.js.map +0 -1
- package/dist/lt-LT.main.js +0 -9
- package/dist/lt-LT.main.js.map +0 -1
- package/dist/lt-LT.mjs +0 -11
- package/dist/lt-LT.module.js +0 -11
- package/dist/lt-LT.module.js.map +0 -1
- package/dist/lv-LV.main.js +0 -9
- package/dist/lv-LV.main.js.map +0 -1
- package/dist/lv-LV.mjs +0 -11
- package/dist/lv-LV.module.js +0 -11
- package/dist/lv-LV.module.js.map +0 -1
- package/dist/nb-NO.main.js +0 -9
- package/dist/nb-NO.main.js.map +0 -1
- package/dist/nb-NO.mjs +0 -11
- package/dist/nb-NO.module.js +0 -11
- package/dist/nb-NO.module.js.map +0 -1
- package/dist/nl-NL.main.js +0 -9
- package/dist/nl-NL.main.js.map +0 -1
- package/dist/nl-NL.mjs +0 -11
- package/dist/nl-NL.module.js +0 -11
- package/dist/nl-NL.module.js.map +0 -1
- package/dist/pl-PL.main.js +0 -9
- package/dist/pl-PL.main.js.map +0 -1
- package/dist/pl-PL.mjs +0 -11
- package/dist/pl-PL.module.js +0 -11
- package/dist/pl-PL.module.js.map +0 -1
- package/dist/pt-BR.main.js +0 -9
- package/dist/pt-BR.main.js.map +0 -1
- package/dist/pt-BR.mjs +0 -11
- package/dist/pt-BR.module.js +0 -11
- package/dist/pt-BR.module.js.map +0 -1
- package/dist/pt-PT.main.js +0 -9
- package/dist/pt-PT.main.js.map +0 -1
- package/dist/pt-PT.mjs +0 -11
- package/dist/pt-PT.module.js +0 -11
- package/dist/pt-PT.module.js.map +0 -1
- package/dist/ro-RO.main.js +0 -9
- package/dist/ro-RO.main.js.map +0 -1
- package/dist/ro-RO.mjs +0 -11
- package/dist/ro-RO.module.js +0 -11
- package/dist/ro-RO.module.js.map +0 -1
- package/dist/ru-RU.main.js +0 -9
- package/dist/ru-RU.main.js.map +0 -1
- package/dist/ru-RU.mjs +0 -11
- package/dist/ru-RU.module.js +0 -11
- package/dist/ru-RU.module.js.map +0 -1
- package/dist/sk-SK.main.js +0 -9
- package/dist/sk-SK.main.js.map +0 -1
- package/dist/sk-SK.mjs +0 -11
- package/dist/sk-SK.module.js +0 -11
- package/dist/sk-SK.module.js.map +0 -1
- package/dist/sl-SI.main.js +0 -9
- package/dist/sl-SI.main.js.map +0 -1
- package/dist/sl-SI.mjs +0 -11
- package/dist/sl-SI.module.js +0 -11
- package/dist/sl-SI.module.js.map +0 -1
- package/dist/sr-SP.main.js +0 -9
- package/dist/sr-SP.main.js.map +0 -1
- package/dist/sr-SP.mjs +0 -11
- package/dist/sr-SP.module.js +0 -11
- package/dist/sr-SP.module.js.map +0 -1
- package/dist/sv-SE.main.js +0 -9
- package/dist/sv-SE.main.js.map +0 -1
- package/dist/sv-SE.mjs +0 -11
- package/dist/sv-SE.module.js +0 -11
- package/dist/sv-SE.module.js.map +0 -1
- package/dist/tr-TR.main.js +0 -9
- package/dist/tr-TR.main.js.map +0 -1
- package/dist/tr-TR.mjs +0 -11
- package/dist/tr-TR.module.js +0 -11
- package/dist/tr-TR.module.js.map +0 -1
- package/dist/types.d.ts +0 -18
- package/dist/types.d.ts.map +0 -1
- package/dist/uk-UA.main.js +0 -9
- package/dist/uk-UA.main.js.map +0 -1
- package/dist/uk-UA.mjs +0 -11
- package/dist/uk-UA.module.js +0 -11
- package/dist/uk-UA.module.js.map +0 -1
- package/dist/zh-CN.main.js +0 -9
- package/dist/zh-CN.main.js.map +0 -1
- package/dist/zh-CN.mjs +0 -11
- package/dist/zh-CN.module.js +0 -11
- package/dist/zh-CN.module.js.map +0 -1
- package/dist/zh-TW.main.js +0 -9
- package/dist/zh-TW.main.js.map +0 -1
- package/dist/zh-TW.mjs +0 -11
- package/dist/zh-TW.module.js +0 -11
- package/dist/zh-TW.module.js.map +0 -1
- package/src/Calendar.tsx +0 -61
- package/src/CalendarBase.tsx +0 -160
- package/src/CalendarCell.tsx +0 -89
- package/src/CalendarMonth.tsx +0 -80
- package/src/RangeCalendar.tsx +0 -61
package/dist/CalendarBase.mjs
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import {CalendarMonth as $faa2f3867773cfe5$export$26e2752316b9a375} from "./CalendarMonth.mjs";
|
|
2
|
-
import $bF3AV$intlStringsmodulejs from "./intlStrings.mjs";
|
|
3
|
-
import "./calendar.e1e61a27.css";
|
|
4
|
-
import $bF3AV$calendar_vars_cssmodulejs from "./calendar_vars_css.mjs";
|
|
5
|
-
import {ActionButton as $bF3AV$ActionButton} from "@react-spectrum/button";
|
|
6
|
-
import $bF3AV$spectrumiconsuiChevronLeftLarge from "@spectrum-icons/ui/ChevronLeftLarge";
|
|
7
|
-
import $bF3AV$spectrumiconsuiChevronRightLarge from "@spectrum-icons/ui/ChevronRightLarge";
|
|
8
|
-
import {useStyleProps as $bF3AV$useStyleProps, classNames as $bF3AV$classNames} from "@react-spectrum/utils";
|
|
9
|
-
import {HelpText as $bF3AV$HelpText} from "@react-spectrum/label";
|
|
10
|
-
import $bF3AV$react from "react";
|
|
11
|
-
import {useLocalizedStringFormatter as $bF3AV$useLocalizedStringFormatter, useLocale as $bF3AV$useLocale, useDateFormatter as $bF3AV$useDateFormatter} from "@react-aria/i18n";
|
|
12
|
-
import {VisuallyHidden as $bF3AV$VisuallyHidden} from "@react-aria/visually-hidden";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
function $parcel$interopDefault(a) {
|
|
16
|
-
return a && a.__esModule ? a.default : a;
|
|
17
|
-
}
|
|
18
|
-
/*
|
|
19
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
20
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
21
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
22
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
23
|
-
*
|
|
24
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
25
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
26
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
27
|
-
* governing permissions and limitations under the License.
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
function $62cd1e80f0dffb66$export$bfd52a43017368fe(props) {
|
|
40
|
-
let { state: state, calendarProps: calendarProps, nextButtonProps: nextButtonProps, prevButtonProps: prevButtonProps, errorMessageProps: errorMessageProps, calendarRef: ref, visibleMonths: visibleMonths = 1, firstDayOfWeek: firstDayOfWeek } = props;
|
|
41
|
-
let { styleProps: styleProps } = (0, $bF3AV$useStyleProps)(props);
|
|
42
|
-
let stringFormatter = (0, $bF3AV$useLocalizedStringFormatter)((0, ($parcel$interopDefault($bF3AV$intlStringsmodulejs))), '@react-spectrum/calendar');
|
|
43
|
-
let { direction: direction } = (0, $bF3AV$useLocale)();
|
|
44
|
-
let currentMonth = state.visibleRange.start;
|
|
45
|
-
let monthDateFormatter = (0, $bF3AV$useDateFormatter)({
|
|
46
|
-
month: 'long',
|
|
47
|
-
year: 'numeric',
|
|
48
|
-
era: currentMonth.calendar.identifier === 'gregory' && currentMonth.era === 'BC' ? 'short' : undefined,
|
|
49
|
-
calendar: currentMonth.calendar.identifier,
|
|
50
|
-
timeZone: state.timeZone
|
|
51
|
-
});
|
|
52
|
-
let titles = [];
|
|
53
|
-
let calendars = [];
|
|
54
|
-
for(let i = 0; i < visibleMonths; i++){
|
|
55
|
-
let d = currentMonth.add({
|
|
56
|
-
months: i
|
|
57
|
-
});
|
|
58
|
-
titles.push(/*#__PURE__*/ (0, $bF3AV$react).createElement("div", {
|
|
59
|
-
key: i,
|
|
60
|
-
className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))), 'spectrum-Calendar-monthHeader')
|
|
61
|
-
}, i === 0 && /*#__PURE__*/ (0, $bF3AV$react).createElement((0, $bF3AV$ActionButton), {
|
|
62
|
-
...prevButtonProps,
|
|
63
|
-
UNSAFE_className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))), 'spectrum-Calendar-prevMonth'),
|
|
64
|
-
isQuiet: true
|
|
65
|
-
}, direction === 'rtl' ? /*#__PURE__*/ (0, $bF3AV$react).createElement((0, $bF3AV$spectrumiconsuiChevronRightLarge), null) : /*#__PURE__*/ (0, $bF3AV$react).createElement((0, $bF3AV$spectrumiconsuiChevronLeftLarge), null)), /*#__PURE__*/ (0, $bF3AV$react).createElement("h2", {
|
|
66
|
-
// We have a visually hidden heading describing the entire visible range,
|
|
67
|
-
// and the calendar itself describes the individual month
|
|
68
|
-
// so we don't need to repeat that here for screen reader users.
|
|
69
|
-
"aria-hidden": true,
|
|
70
|
-
className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))), 'spectrum-Calendar-title')
|
|
71
|
-
}, $62cd1e80f0dffb66$var$getCurrentMonthName(d, state.timeZone, monthDateFormatter)), i === visibleMonths - 1 && /*#__PURE__*/ (0, $bF3AV$react).createElement((0, $bF3AV$ActionButton), {
|
|
72
|
-
...nextButtonProps,
|
|
73
|
-
UNSAFE_className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))), 'spectrum-Calendar-nextMonth'),
|
|
74
|
-
isQuiet: true
|
|
75
|
-
}, direction === 'rtl' ? /*#__PURE__*/ (0, $bF3AV$react).createElement((0, $bF3AV$spectrumiconsuiChevronLeftLarge), null) : /*#__PURE__*/ (0, $bF3AV$react).createElement((0, $bF3AV$spectrumiconsuiChevronRightLarge), null))));
|
|
76
|
-
calendars.push(/*#__PURE__*/ (0, $bF3AV$react).createElement((0, $faa2f3867773cfe5$export$26e2752316b9a375), {
|
|
77
|
-
...props,
|
|
78
|
-
key: i,
|
|
79
|
-
state: state,
|
|
80
|
-
startDate: d,
|
|
81
|
-
firstDayOfWeek: firstDayOfWeek
|
|
82
|
-
}));
|
|
83
|
-
}
|
|
84
|
-
return /*#__PURE__*/ (0, $bF3AV$react).createElement("div", {
|
|
85
|
-
...styleProps,
|
|
86
|
-
...calendarProps,
|
|
87
|
-
ref: ref,
|
|
88
|
-
className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))), 'spectrum-Calendar', styleProps.className)
|
|
89
|
-
}, /*#__PURE__*/ (0, $bF3AV$react).createElement((0, $bF3AV$VisuallyHidden), null, /*#__PURE__*/ (0, $bF3AV$react).createElement("h2", null, calendarProps['aria-label'])), /*#__PURE__*/ (0, $bF3AV$react).createElement("div", {
|
|
90
|
-
className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))), 'spectrum-Calendar-header')
|
|
91
|
-
}, titles), /*#__PURE__*/ (0, $bF3AV$react).createElement("div", {
|
|
92
|
-
className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))), 'spectrum-Calendar-months')
|
|
93
|
-
}, calendars), /*#__PURE__*/ (0, $bF3AV$react).createElement((0, $bF3AV$VisuallyHidden), null, /*#__PURE__*/ (0, $bF3AV$react).createElement("button", {
|
|
94
|
-
"aria-label": nextButtonProps['aria-label'],
|
|
95
|
-
disabled: nextButtonProps.isDisabled,
|
|
96
|
-
onClick: ()=>state.focusNextPage(),
|
|
97
|
-
tabIndex: -1
|
|
98
|
-
})), state.isValueInvalid && /*#__PURE__*/ (0, $bF3AV$react).createElement((0, $bF3AV$HelpText), {
|
|
99
|
-
showErrorIcon: true,
|
|
100
|
-
errorMessage: props.errorMessage || stringFormatter.format('invalidSelection', {
|
|
101
|
-
selectedCount: 'highlightedRange' in state ? 2 : 1
|
|
102
|
-
}),
|
|
103
|
-
errorMessageProps: errorMessageProps,
|
|
104
|
-
isInvalid: true,
|
|
105
|
-
// Intentionally a global class name so it can be targeted in DatePicker CSS...
|
|
106
|
-
UNSAFE_className: "spectrum-Calendar-helpText"
|
|
107
|
-
}));
|
|
108
|
-
}
|
|
109
|
-
function $62cd1e80f0dffb66$var$getCurrentMonthName(date, timezone, monthDateFormatter) {
|
|
110
|
-
if (date.calendar.getFormattableMonth) date = date.calendar.getFormattableMonth(date);
|
|
111
|
-
return monthDateFormatter.format(date.toDate(timezone));
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
export {$62cd1e80f0dffb66$export$bfd52a43017368fe as CalendarBase};
|
|
116
|
-
//# sourceMappingURL=CalendarBase.module.js.map
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import {CalendarMonth as $faa2f3867773cfe5$export$26e2752316b9a375} from "./CalendarMonth.module.js";
|
|
2
|
-
import $bF3AV$intlStringsmodulejs from "./intlStrings.module.js";
|
|
3
|
-
import "./calendar.e1e61a27.css";
|
|
4
|
-
import $bF3AV$calendar_vars_cssmodulejs from "./calendar_vars_css.module.js";
|
|
5
|
-
import {ActionButton as $bF3AV$ActionButton} from "@react-spectrum/button";
|
|
6
|
-
import $bF3AV$spectrumiconsuiChevronLeftLarge from "@spectrum-icons/ui/ChevronLeftLarge";
|
|
7
|
-
import $bF3AV$spectrumiconsuiChevronRightLarge from "@spectrum-icons/ui/ChevronRightLarge";
|
|
8
|
-
import {useStyleProps as $bF3AV$useStyleProps, classNames as $bF3AV$classNames} from "@react-spectrum/utils";
|
|
9
|
-
import {HelpText as $bF3AV$HelpText} from "@react-spectrum/label";
|
|
10
|
-
import $bF3AV$react from "react";
|
|
11
|
-
import {useLocalizedStringFormatter as $bF3AV$useLocalizedStringFormatter, useLocale as $bF3AV$useLocale, useDateFormatter as $bF3AV$useDateFormatter} from "@react-aria/i18n";
|
|
12
|
-
import {VisuallyHidden as $bF3AV$VisuallyHidden} from "@react-aria/visually-hidden";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
function $parcel$interopDefault(a) {
|
|
16
|
-
return a && a.__esModule ? a.default : a;
|
|
17
|
-
}
|
|
18
|
-
/*
|
|
19
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
20
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
21
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
22
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
23
|
-
*
|
|
24
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
25
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
26
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
27
|
-
* governing permissions and limitations under the License.
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
function $62cd1e80f0dffb66$export$bfd52a43017368fe(props) {
|
|
40
|
-
let { state: state, calendarProps: calendarProps, nextButtonProps: nextButtonProps, prevButtonProps: prevButtonProps, errorMessageProps: errorMessageProps, calendarRef: ref, visibleMonths: visibleMonths = 1, firstDayOfWeek: firstDayOfWeek } = props;
|
|
41
|
-
let { styleProps: styleProps } = (0, $bF3AV$useStyleProps)(props);
|
|
42
|
-
let stringFormatter = (0, $bF3AV$useLocalizedStringFormatter)((0, ($parcel$interopDefault($bF3AV$intlStringsmodulejs))), '@react-spectrum/calendar');
|
|
43
|
-
let { direction: direction } = (0, $bF3AV$useLocale)();
|
|
44
|
-
let currentMonth = state.visibleRange.start;
|
|
45
|
-
let monthDateFormatter = (0, $bF3AV$useDateFormatter)({
|
|
46
|
-
month: 'long',
|
|
47
|
-
year: 'numeric',
|
|
48
|
-
era: currentMonth.calendar.identifier === 'gregory' && currentMonth.era === 'BC' ? 'short' : undefined,
|
|
49
|
-
calendar: currentMonth.calendar.identifier,
|
|
50
|
-
timeZone: state.timeZone
|
|
51
|
-
});
|
|
52
|
-
let titles = [];
|
|
53
|
-
let calendars = [];
|
|
54
|
-
for(let i = 0; i < visibleMonths; i++){
|
|
55
|
-
let d = currentMonth.add({
|
|
56
|
-
months: i
|
|
57
|
-
});
|
|
58
|
-
titles.push(/*#__PURE__*/ (0, $bF3AV$react).createElement("div", {
|
|
59
|
-
key: i,
|
|
60
|
-
className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))), 'spectrum-Calendar-monthHeader')
|
|
61
|
-
}, i === 0 && /*#__PURE__*/ (0, $bF3AV$react).createElement((0, $bF3AV$ActionButton), {
|
|
62
|
-
...prevButtonProps,
|
|
63
|
-
UNSAFE_className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))), 'spectrum-Calendar-prevMonth'),
|
|
64
|
-
isQuiet: true
|
|
65
|
-
}, direction === 'rtl' ? /*#__PURE__*/ (0, $bF3AV$react).createElement((0, $bF3AV$spectrumiconsuiChevronRightLarge), null) : /*#__PURE__*/ (0, $bF3AV$react).createElement((0, $bF3AV$spectrumiconsuiChevronLeftLarge), null)), /*#__PURE__*/ (0, $bF3AV$react).createElement("h2", {
|
|
66
|
-
// We have a visually hidden heading describing the entire visible range,
|
|
67
|
-
// and the calendar itself describes the individual month
|
|
68
|
-
// so we don't need to repeat that here for screen reader users.
|
|
69
|
-
"aria-hidden": true,
|
|
70
|
-
className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))), 'spectrum-Calendar-title')
|
|
71
|
-
}, $62cd1e80f0dffb66$var$getCurrentMonthName(d, state.timeZone, monthDateFormatter)), i === visibleMonths - 1 && /*#__PURE__*/ (0, $bF3AV$react).createElement((0, $bF3AV$ActionButton), {
|
|
72
|
-
...nextButtonProps,
|
|
73
|
-
UNSAFE_className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))), 'spectrum-Calendar-nextMonth'),
|
|
74
|
-
isQuiet: true
|
|
75
|
-
}, direction === 'rtl' ? /*#__PURE__*/ (0, $bF3AV$react).createElement((0, $bF3AV$spectrumiconsuiChevronLeftLarge), null) : /*#__PURE__*/ (0, $bF3AV$react).createElement((0, $bF3AV$spectrumiconsuiChevronRightLarge), null))));
|
|
76
|
-
calendars.push(/*#__PURE__*/ (0, $bF3AV$react).createElement((0, $faa2f3867773cfe5$export$26e2752316b9a375), {
|
|
77
|
-
...props,
|
|
78
|
-
key: i,
|
|
79
|
-
state: state,
|
|
80
|
-
startDate: d,
|
|
81
|
-
firstDayOfWeek: firstDayOfWeek
|
|
82
|
-
}));
|
|
83
|
-
}
|
|
84
|
-
return /*#__PURE__*/ (0, $bF3AV$react).createElement("div", {
|
|
85
|
-
...styleProps,
|
|
86
|
-
...calendarProps,
|
|
87
|
-
ref: ref,
|
|
88
|
-
className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))), 'spectrum-Calendar', styleProps.className)
|
|
89
|
-
}, /*#__PURE__*/ (0, $bF3AV$react).createElement((0, $bF3AV$VisuallyHidden), null, /*#__PURE__*/ (0, $bF3AV$react).createElement("h2", null, calendarProps['aria-label'])), /*#__PURE__*/ (0, $bF3AV$react).createElement("div", {
|
|
90
|
-
className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))), 'spectrum-Calendar-header')
|
|
91
|
-
}, titles), /*#__PURE__*/ (0, $bF3AV$react).createElement("div", {
|
|
92
|
-
className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))), 'spectrum-Calendar-months')
|
|
93
|
-
}, calendars), /*#__PURE__*/ (0, $bF3AV$react).createElement((0, $bF3AV$VisuallyHidden), null, /*#__PURE__*/ (0, $bF3AV$react).createElement("button", {
|
|
94
|
-
"aria-label": nextButtonProps['aria-label'],
|
|
95
|
-
disabled: nextButtonProps.isDisabled,
|
|
96
|
-
onClick: ()=>state.focusNextPage(),
|
|
97
|
-
tabIndex: -1
|
|
98
|
-
})), state.isValueInvalid && /*#__PURE__*/ (0, $bF3AV$react).createElement((0, $bF3AV$HelpText), {
|
|
99
|
-
showErrorIcon: true,
|
|
100
|
-
errorMessage: props.errorMessage || stringFormatter.format('invalidSelection', {
|
|
101
|
-
selectedCount: 'highlightedRange' in state ? 2 : 1
|
|
102
|
-
}),
|
|
103
|
-
errorMessageProps: errorMessageProps,
|
|
104
|
-
isInvalid: true,
|
|
105
|
-
// Intentionally a global class name so it can be targeted in DatePicker CSS...
|
|
106
|
-
UNSAFE_className: "spectrum-Calendar-helpText"
|
|
107
|
-
}));
|
|
108
|
-
}
|
|
109
|
-
function $62cd1e80f0dffb66$var$getCurrentMonthName(date, timezone, monthDateFormatter) {
|
|
110
|
-
if (date.calendar.getFormattableMonth) date = date.calendar.getFormattableMonth(date);
|
|
111
|
-
return monthDateFormatter.format(date.toDate(timezone));
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
export {$62cd1e80f0dffb66$export$bfd52a43017368fe as CalendarBase};
|
|
116
|
-
//# sourceMappingURL=CalendarBase.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;AA8BM,SAAS,0CAA2D,KAA2B;IACpG,IAAI,SACF,KAAK,iBACL,aAAa,mBACb,eAAe,mBACf,eAAe,qBACf,iBAAiB,EACjB,aAAa,GAAG,iBAChB,gBAAgB,mBAChB,cAAc,EACf,GAAG;IACJ,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,oBAAY,EAAE;IACjC,IAAI,kBAAkB,CAAA,GAAA,kCAA0B,EAAE,CAAA,GAAA,oDAAW,GAAG;IAChE,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ;IAC1B,IAAI,eAAe,MAAM,YAAY,CAAC,KAAK;IAC3C,IAAI,qBAAqB,CAAA,GAAA,uBAAe,EAAE;QACxC,OAAO;QACP,MAAM;QACN,KAAK,aAAa,QAAQ,CAAC,UAAU,KAAK,aAAa,aAAa,GAAG,KAAK,OAAO,UAAU;QAC7F,UAAU,aAAa,QAAQ,CAAC,UAAU;QAC1C,UAAU,MAAM,QAAQ;IAC1B;IAEA,IAAI,SAAwB,EAAE;IAC9B,IAAI,YAA2B,EAAE;IACjC,IAAK,IAAI,IAAI,GAAG,IAAI,eAAe,IAAK;QACtC,IAAI,IAAI,aAAa,GAAG,CAAC;YAAC,QAAQ;QAAC;QACnC,OAAO,IAAI,eACT,gCAAC;YAAI,KAAK;YAAG,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,0DAAK,GAAG;WACxC,MAAM,mBACL,gCAAC,CAAA,GAAA,mBAAW;YACT,GAAG,eAAe;YACnB,kBAAkB,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,0DAAK,GAAG;YACrC,SAAA;WACC,cAAc,sBAAQ,gCAAC,CAAA,GAAA,uCAAW,yBAAO,gCAAC,CAAA,GAAA,sCAAU,yBAGzD,gCAAC;YACC,yEAAyE;YACzE,yDAAyD;YACzD,gEAAgE;YAChE,eAAA;YACA,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,0DAAK,GAAG;WAC7B,0CAAoB,GAAG,MAAM,QAAQ,EAAE,sBAEzC,MAAM,gBAAgB,mBACrB,gCAAC,CAAA,GAAA,mBAAW;YACT,GAAG,eAAe;YACnB,kBAAkB,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,0DAAK,GAAG;YACrC,SAAA;WACC,cAAc,sBAAQ,gCAAC,CAAA,GAAA,sCAAU,yBAAO,gCAAC,CAAA,GAAA,uCAAW;QAM7D,UAAU,IAAI,eACZ,gCAAC,CAAA,GAAA,yCAAY;YACV,GAAG,KAAK;YACT,KAAK;YACL,OAAO;YACP,WAAW;YACX,gBAAgB;;IAEtB;IAEA,qBACE,gCAAC;QACE,GAAG,UAAU;QACb,GAAG,aAAa;QACjB,KAAK;QACL,WACE,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,0DAAK,GACd,qBACA,WAAW,SAAS;qBAQxB,gCAAC,CAAA,GAAA,qBAAa,uBACZ,gCAAC,YAAI,aAAa,CAAC,aAAa,kBAElC,gCAAC;QAAI,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,0DAAK,GAAG;OAChC,uBAEH,gCAAC;QAAI,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,0DAAK,GAAG;OAChC,0BAKH,gCAAC,CAAA,GAAA,qBAAa,uBACZ,gCAAC;QACC,cAAY,eAAe,CAAC,aAAa;QACzC,UAAU,gBAAgB,UAAU;QACpC,SAAS,IAAM,MAAM,aAAa;QAClC,UAAU;SAEb,MAAM,cAAc,kBACnB,gCAAC,CAAA,GAAA,eAAO;QACN,eAAA;QACA,cAAc,MAAM,YAAY,IAAI,gBAAgB,MAAM,CAAC,oBAAoB;YAAC,eAAe,sBAAsB,QAAQ,IAAI;QAAC;QAClI,mBAAmB;QACnB,WAAA;QACA,+EAA+E;QAC/E,kBAAiB;;AAI3B;AAEA,SAAS,0CAAoB,IAAkB,EAAE,QAAgB,EAAE,kBAAuD;IACxH,IAAI,KAAK,QAAQ,CAAC,mBAAmB,EACnC,OAAO,KAAK,QAAQ,CAAC,mBAAmB,CAAC;IAE3C,OAAO,mBAAmB,MAAM,CAAC,KAAK,MAAM,CAAC;AAC/C","sources":["packages/@react-spectrum/calendar/src/CalendarBase.tsx"],"sourcesContent":["/*\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 {AriaButtonProps} from '@react-types/button';\nimport {CalendarDate} from '@internationalized/date';\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, useStyleProps} from '@react-spectrum/utils';\nimport {DOMProps, RefObject, StyleProps} from '@react-types/shared';\nimport {HelpText} from '@react-spectrum/label';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport React, {HTMLAttributes, JSX} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/calendar/vars.css';\nimport {useDateFormatter, useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {VisuallyHidden} from '@react-aria/visually-hidden';\n\ninterface CalendarBaseProps<T extends CalendarState | RangeCalendarState> extends CalendarPropsBase, DOMProps, StyleProps {\n state: T,\n visibleMonths?: number,\n calendarProps: HTMLAttributes<HTMLElement>,\n nextButtonProps: AriaButtonProps,\n prevButtonProps: AriaButtonProps,\n errorMessageProps: HTMLAttributes<HTMLElement>,\n calendarRef: RefObject<HTMLDivElement | null>\n}\n\nexport function CalendarBase<T extends CalendarState | RangeCalendarState>(props: CalendarBaseProps<T>): JSX.Element {\n let {\n state,\n calendarProps,\n nextButtonProps,\n prevButtonProps,\n errorMessageProps,\n calendarRef: ref,\n visibleMonths = 1,\n firstDayOfWeek\n } = props;\n let {styleProps} = useStyleProps(props);\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/calendar');\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' && currentMonth.era === 'BC' ? 'short' : undefined,\n calendar: currentMonth.calendar.identifier,\n timeZone: state.timeZone\n });\n\n let titles: JSX.Element[] = [];\n let calendars: JSX.Element[] = [];\n for (let i = 0; i < visibleMonths; i++) {\n let d = currentMonth.add({months: 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 // We have a visually hidden heading describing the entire visible range,\n // and the calendar itself describes the individual month\n // so we don't need to repeat that here for screen reader users.\n aria-hidden\n className={classNames(styles, 'spectrum-Calendar-title')}>\n {getCurrentMonthName(d, state.timeZone, monthDateFormatter)}\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 calendars.push(\n <CalendarMonth\n {...props}\n key={i}\n state={state}\n startDate={d}\n firstDayOfWeek={firstDayOfWeek} />\n );\n }\n\n return (\n <div\n {...styleProps}\n {...calendarProps}\n ref={ref}\n className={\n classNames(styles,\n 'spectrum-Calendar',\n styleProps.className\n )\n }>\n {/* Add a screen reader only description of the entire visible range rather than\n * a separate heading above each month grid. This is placed first in the DOM order\n * so that it is the first thing a touch screen reader user encounters.\n * In addition, VoiceOver on iOS does not announce the aria-label of the grid\n * elements, so the aria-label of the Calendar is included here as well. */}\n <VisuallyHidden>\n <h2>{calendarProps['aria-label']}</h2>\n </VisuallyHidden>\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 {/* For touch screen readers, add a visually hidden next button after the month grid\n * so it's easy to navigate after reaching the end without going all the way\n * back to the start of the month. */}\n <VisuallyHidden>\n <button\n aria-label={nextButtonProps['aria-label']}\n disabled={nextButtonProps.isDisabled}\n onClick={() => state.focusNextPage()}\n tabIndex={-1} />\n </VisuallyHidden>\n {state.isValueInvalid &&\n <HelpText\n showErrorIcon\n errorMessage={props.errorMessage || stringFormatter.format('invalidSelection', {selectedCount: 'highlightedRange' in state ? 2 : 1})}\n errorMessageProps={errorMessageProps}\n isInvalid\n // Intentionally a global class name so it can be targeted in DatePicker CSS...\n UNSAFE_className=\"spectrum-Calendar-helpText\" />\n }\n </div>\n );\n}\n\nfunction getCurrentMonthName(date: CalendarDate, timezone: string, monthDateFormatter: ReturnType<typeof useDateFormatter>): string {\n if (date.calendar.getFormattableMonth) {\n date = date.calendar.getFormattableMonth(date);\n }\n return monthDateFormatter.format(date.toDate(timezone));\n}\n"],"names":[],"version":3,"file":"CalendarBase.module.js.map"}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
require("./calendar.e1e61a27.css");
|
|
2
|
-
var $915891ae6206caad$exports = require("./calendar_vars_css.main.js");
|
|
3
|
-
var $1NqcN$reactariacalendar = require("@react-aria/calendar");
|
|
4
|
-
var $1NqcN$internationalizeddate = require("@internationalized/date");
|
|
5
|
-
var $1NqcN$reactspectrumutils = require("@react-spectrum/utils");
|
|
6
|
-
var $1NqcN$reactariautils = require("@react-aria/utils");
|
|
7
|
-
var $1NqcN$react = require("react");
|
|
8
|
-
var $1NqcN$reactariafocus = require("@react-aria/focus");
|
|
9
|
-
var $1NqcN$reactariainteractions = require("@react-aria/interactions");
|
|
10
|
-
var $1NqcN$reactariai18n = require("@react-aria/i18n");
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
function $parcel$interopDefault(a) {
|
|
14
|
-
return a && a.__esModule ? a.default : a;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function $parcel$export(e, n, v, s) {
|
|
18
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
$parcel$export(module.exports, "CalendarCell", () => $52c7c3c887827b64$export$5d847498420df57b);
|
|
22
|
-
/*
|
|
23
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
24
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
25
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
26
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
27
|
-
*
|
|
28
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
29
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
30
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
31
|
-
* governing permissions and limitations under the License.
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
function $52c7c3c887827b64$export$5d847498420df57b({ state: state, currentMonth: currentMonth, firstDayOfWeek: firstDayOfWeek, ...props }) {
|
|
42
|
-
let ref = (0, $1NqcN$react.useRef)(null);
|
|
43
|
-
let { cellProps: cellProps, buttonProps: buttonProps, isPressed: isPressed, isSelected: isSelected, isDisabled: isDisabled, isFocused: isFocused, isInvalid: isInvalid, formattedDate: formattedDate } = (0, $1NqcN$reactariacalendar.useCalendarCell)({
|
|
44
|
-
...props,
|
|
45
|
-
isDisabled: !(0, $1NqcN$internationalizeddate.isSameMonth)(props.date, currentMonth)
|
|
46
|
-
}, state, ref);
|
|
47
|
-
let isUnavailable = state.isCellUnavailable(props.date) && !isDisabled;
|
|
48
|
-
let isLastSelectedBeforeDisabled = !isDisabled && !isInvalid && state.isCellUnavailable(props.date.add({
|
|
49
|
-
days: 1
|
|
50
|
-
}));
|
|
51
|
-
let isFirstSelectedAfterDisabled = !isDisabled && !isInvalid && state.isCellUnavailable(props.date.subtract({
|
|
52
|
-
days: 1
|
|
53
|
-
}));
|
|
54
|
-
let highlightedRange = 'highlightedRange' in state && state.highlightedRange;
|
|
55
|
-
let isSelectionStart = isSelected && highlightedRange && (0, $1NqcN$internationalizeddate.isSameDay)(props.date, highlightedRange.start);
|
|
56
|
-
let isSelectionEnd = isSelected && highlightedRange && (0, $1NqcN$internationalizeddate.isSameDay)(props.date, highlightedRange.end);
|
|
57
|
-
let { locale: locale } = (0, $1NqcN$reactariai18n.useLocale)();
|
|
58
|
-
let dayOfWeek = (0, $1NqcN$internationalizeddate.getDayOfWeek)(props.date, locale, firstDayOfWeek);
|
|
59
|
-
let isRangeStart = isSelected && (isFirstSelectedAfterDisabled || dayOfWeek === 0 || props.date.day === 1);
|
|
60
|
-
let isRangeEnd = isSelected && (isLastSelectedBeforeDisabled || dayOfWeek === 6 || props.date.day === currentMonth.calendar.getDaysInMonth(currentMonth));
|
|
61
|
-
let { focusProps: focusProps, isFocusVisible: isFocusVisible } = (0, $1NqcN$reactariafocus.useFocusRing)();
|
|
62
|
-
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $1NqcN$reactariainteractions.useHover)({
|
|
63
|
-
isDisabled: isDisabled || isUnavailable || state.isReadOnly
|
|
64
|
-
});
|
|
65
|
-
return /*#__PURE__*/ (0, ($parcel$interopDefault($1NqcN$react))).createElement("td", {
|
|
66
|
-
...cellProps,
|
|
67
|
-
className: (0, $1NqcN$reactspectrumutils.classNames)((0, ($parcel$interopDefault($915891ae6206caad$exports))), 'spectrum-Calendar-tableCell')
|
|
68
|
-
}, /*#__PURE__*/ (0, ($parcel$interopDefault($1NqcN$react))).createElement("span", {
|
|
69
|
-
...(0, $1NqcN$reactariautils.mergeProps)(buttonProps, hoverProps, focusProps),
|
|
70
|
-
ref: ref,
|
|
71
|
-
className: (0, $1NqcN$reactspectrumutils.classNames)((0, ($parcel$interopDefault($915891ae6206caad$exports))), 'spectrum-Calendar-date', {
|
|
72
|
-
'is-today': (0, $1NqcN$internationalizeddate.isToday)(props.date, state.timeZone),
|
|
73
|
-
'is-selected': isSelected,
|
|
74
|
-
'is-focused': isFocused && isFocusVisible,
|
|
75
|
-
// Style disabled (i.e. out of min/max range), but selected dates as unavailable
|
|
76
|
-
// since it is more clear than trying to dim the selection.
|
|
77
|
-
'is-disabled': isDisabled && !isInvalid,
|
|
78
|
-
'is-unavailable': isUnavailable || isInvalid && isDisabled,
|
|
79
|
-
'is-outsideMonth': !(0, $1NqcN$internationalizeddate.isSameMonth)(props.date, currentMonth),
|
|
80
|
-
'is-range-start': isRangeStart,
|
|
81
|
-
'is-range-end': isRangeEnd,
|
|
82
|
-
'is-range-selection': isSelected && 'highlightedRange' in state,
|
|
83
|
-
'is-selection-start': isSelectionStart,
|
|
84
|
-
'is-selection-end': isSelectionEnd,
|
|
85
|
-
'is-hovered': isHovered,
|
|
86
|
-
'is-pressed': isPressed && !state.isReadOnly,
|
|
87
|
-
'is-invalid': isInvalid
|
|
88
|
-
})
|
|
89
|
-
}, /*#__PURE__*/ (0, ($parcel$interopDefault($1NqcN$react))).createElement("span", {
|
|
90
|
-
className: (0, $1NqcN$reactspectrumutils.classNames)((0, ($parcel$interopDefault($915891ae6206caad$exports))), 'spectrum-Calendar-dateText')
|
|
91
|
-
}, /*#__PURE__*/ (0, ($parcel$interopDefault($1NqcN$react))).createElement("span", null, formattedDate))));
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
//# sourceMappingURL=CalendarCell.main.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AAmBM,SAAS,0CAAa,SAAC,KAAK,gBAAE,YAAY,kBAAE,cAAc,EAAE,GAAG,OAAyB;IAC7F,IAAI,MAAM,CAAA,GAAA,mBAAK,EAAe;IAC9B,IAAI,aACF,SAAS,eACT,WAAW,aACX,SAAS,cACT,UAAU,cACV,UAAU,aACV,SAAS,aACT,SAAS,iBACT,aAAa,EACd,GAAG,CAAA,GAAA,wCAAc,EAAE;QAClB,GAAG,KAAK;QACR,YAAY,CAAC,CAAA,GAAA,wCAAU,EAAE,MAAM,IAAI,EAAE;IACvC,GAAG,OAAO;IACV,IAAI,gBAAgB,MAAM,iBAAiB,CAAC,MAAM,IAAI,KAAK,CAAC;IAC5D,IAAI,+BAA+B,CAAC,cAAc,CAAC,aAAa,MAAM,iBAAiB,CAAC,MAAM,IAAI,CAAC,GAAG,CAAC;QAAC,MAAM;IAAC;IAC/G,IAAI,+BAA+B,CAAC,cAAc,CAAC,aAAa,MAAM,iBAAiB,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC;QAAC,MAAM;IAAC;IACpH,IAAI,mBAAmB,sBAAsB,SAAS,MAAM,gBAAgB;IAC5E,IAAI,mBAAmB,cAAc,oBAAoB,CAAA,GAAA,sCAAQ,EAAE,MAAM,IAAI,EAAE,iBAAiB,KAAK;IACrG,IAAI,iBAAiB,cAAc,oBAAoB,CAAA,GAAA,sCAAQ,EAAE,MAAM,IAAI,EAAE,iBAAiB,GAAG;IACjG,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,8BAAQ;IACvB,IAAI,YAAY,CAAA,GAAA,yCAAW,EAAE,MAAM,IAAI,EAAE,QAAQ;IACjD,IAAI,eAAe,cAAe,CAAA,gCAAgC,cAAc,KAAK,MAAM,IAAI,CAAC,GAAG,KAAK,CAAA;IACxG,IAAI,aAAa,cAAe,CAAA,gCAAgC,cAAc,KAAK,MAAM,IAAI,CAAC,GAAG,KAAK,aAAa,QAAQ,CAAC,cAAc,CAAC,aAAY;IACvJ,IAAI,cAAC,UAAU,kBAAE,cAAc,EAAC,GAAG,CAAA,GAAA,kCAAW;IAC9C,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,qCAAO,EAAE;QAAC,YAAY,cAAc,iBAAiB,MAAM,UAAU;IAAA;IAEnG,qBACE,0DAAC;QACE,GAAG,SAAS;QACb,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;qBAC9B,0DAAC;QACE,GAAG,CAAA,GAAA,gCAAS,EAAE,aAAa,YAAY,WAAW;QACnD,KAAK;QACL,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG,0BAA0B;YACtD,YAAY,CAAA,GAAA,oCAAM,EAAE,MAAM,IAAI,EAAE,MAAM,QAAQ;YAC9C,eAAe;YACf,cAAc,aAAa;YAC3B,gFAAgF;YAChF,2DAA2D;YAC3D,eAAe,cAAc,CAAC;YAC9B,kBAAkB,iBAAkB,aAAa;YACjD,mBAAmB,CAAC,CAAA,GAAA,wCAAU,EAAE,MAAM,IAAI,EAAE;YAC5C,kBAAkB;YAClB,gBAAgB;YAChB,sBAAsB,cAAc,sBAAsB;YAC1D,sBAAsB;YACtB,oBAAoB;YACpB,cAAc;YACd,cAAc,aAAa,CAAC,MAAM,UAAU;YAC5C,cAAc;QAChB;qBACA,0DAAC;QAAK,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;qBAClC,0DAAC,cAAM;AAKjB","sources":["packages/@react-spectrum/calendar/src/CalendarCell.tsx"],"sourcesContent":["/*\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, 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, {JSX, useRef} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/calendar/vars.css';\nimport {useFocusRing} from '@react-aria/focus';\nimport {useHover} from '@react-aria/interactions';\nimport {useLocale} from '@react-aria/i18n';\n\ninterface CalendarCellProps extends AriaCalendarCellProps {\n state: CalendarState | RangeCalendarState,\n currentMonth: CalendarDate,\n firstDayOfWeek?: 'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat'\n}\n\nexport function CalendarCell({state, currentMonth, firstDayOfWeek, ...props}: CalendarCellProps): JSX.Element {\n let ref = useRef<HTMLElement>(null);\n let {\n cellProps,\n buttonProps,\n isPressed,\n isSelected,\n isDisabled,\n isFocused,\n isInvalid,\n formattedDate\n } = useCalendarCell({\n ...props,\n isDisabled: !isSameMonth(props.date, currentMonth)\n }, state, ref);\n let isUnavailable = state.isCellUnavailable(props.date) && !isDisabled;\n let isLastSelectedBeforeDisabled = !isDisabled && !isInvalid && state.isCellUnavailable(props.date.add({days: 1}));\n let isFirstSelectedAfterDisabled = !isDisabled && !isInvalid && state.isCellUnavailable(props.date.subtract({days: 1}));\n let highlightedRange = 'highlightedRange' in state && state.highlightedRange;\n let isSelectionStart = isSelected && highlightedRange && isSameDay(props.date, highlightedRange.start);\n let isSelectionEnd = isSelected && highlightedRange && isSameDay(props.date, highlightedRange.end);\n let {locale} = useLocale();\n let dayOfWeek = getDayOfWeek(props.date, locale, firstDayOfWeek);\n let isRangeStart = isSelected && (isFirstSelectedAfterDisabled || dayOfWeek === 0 || props.date.day === 1);\n let isRangeEnd = isSelected && (isLastSelectedBeforeDisabled || dayOfWeek === 6 || props.date.day === currentMonth.calendar.getDaysInMonth(currentMonth));\n let {focusProps, isFocusVisible} = useFocusRing();\n let {hoverProps, isHovered} = useHover({isDisabled: isDisabled || isUnavailable || state.isReadOnly});\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': isFocused && isFocusVisible,\n // Style disabled (i.e. out of min/max range), but selected dates as unavailable\n // since it is more clear than trying to dim the selection.\n 'is-disabled': isDisabled && !isInvalid,\n 'is-unavailable': isUnavailable || (isInvalid && isDisabled),\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 && !state.isReadOnly,\n 'is-invalid': isInvalid\n })}>\n <span className={classNames(styles, 'spectrum-Calendar-dateText')}>\n <span>{formattedDate}</span>\n </span>\n </span>\n </td>\n );\n}\n"],"names":[],"version":3,"file":"CalendarCell.main.js.map"}
|
package/dist/CalendarCell.mjs
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import "./calendar.e1e61a27.css";
|
|
2
|
-
import $1nHC4$calendar_vars_cssmodulejs from "./calendar_vars_css.mjs";
|
|
3
|
-
import {useCalendarCell as $1nHC4$useCalendarCell} from "@react-aria/calendar";
|
|
4
|
-
import {isSameMonth as $1nHC4$isSameMonth, isSameDay as $1nHC4$isSameDay, getDayOfWeek as $1nHC4$getDayOfWeek, isToday as $1nHC4$isToday} from "@internationalized/date";
|
|
5
|
-
import {classNames as $1nHC4$classNames} from "@react-spectrum/utils";
|
|
6
|
-
import {mergeProps as $1nHC4$mergeProps} from "@react-aria/utils";
|
|
7
|
-
import $1nHC4$react, {useRef as $1nHC4$useRef} from "react";
|
|
8
|
-
import {useFocusRing as $1nHC4$useFocusRing} from "@react-aria/focus";
|
|
9
|
-
import {useHover as $1nHC4$useHover} from "@react-aria/interactions";
|
|
10
|
-
import {useLocale as $1nHC4$useLocale} from "@react-aria/i18n";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
function $parcel$interopDefault(a) {
|
|
14
|
-
return a && a.__esModule ? a.default : a;
|
|
15
|
-
}
|
|
16
|
-
/*
|
|
17
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
18
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
19
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
20
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
21
|
-
*
|
|
22
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
23
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
24
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
25
|
-
* governing permissions and limitations under the License.
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
function $453c556b9066da11$export$5d847498420df57b({ state: state, currentMonth: currentMonth, firstDayOfWeek: firstDayOfWeek, ...props }) {
|
|
36
|
-
let ref = (0, $1nHC4$useRef)(null);
|
|
37
|
-
let { cellProps: cellProps, buttonProps: buttonProps, isPressed: isPressed, isSelected: isSelected, isDisabled: isDisabled, isFocused: isFocused, isInvalid: isInvalid, formattedDate: formattedDate } = (0, $1nHC4$useCalendarCell)({
|
|
38
|
-
...props,
|
|
39
|
-
isDisabled: !(0, $1nHC4$isSameMonth)(props.date, currentMonth)
|
|
40
|
-
}, state, ref);
|
|
41
|
-
let isUnavailable = state.isCellUnavailable(props.date) && !isDisabled;
|
|
42
|
-
let isLastSelectedBeforeDisabled = !isDisabled && !isInvalid && state.isCellUnavailable(props.date.add({
|
|
43
|
-
days: 1
|
|
44
|
-
}));
|
|
45
|
-
let isFirstSelectedAfterDisabled = !isDisabled && !isInvalid && state.isCellUnavailable(props.date.subtract({
|
|
46
|
-
days: 1
|
|
47
|
-
}));
|
|
48
|
-
let highlightedRange = 'highlightedRange' in state && state.highlightedRange;
|
|
49
|
-
let isSelectionStart = isSelected && highlightedRange && (0, $1nHC4$isSameDay)(props.date, highlightedRange.start);
|
|
50
|
-
let isSelectionEnd = isSelected && highlightedRange && (0, $1nHC4$isSameDay)(props.date, highlightedRange.end);
|
|
51
|
-
let { locale: locale } = (0, $1nHC4$useLocale)();
|
|
52
|
-
let dayOfWeek = (0, $1nHC4$getDayOfWeek)(props.date, locale, firstDayOfWeek);
|
|
53
|
-
let isRangeStart = isSelected && (isFirstSelectedAfterDisabled || dayOfWeek === 0 || props.date.day === 1);
|
|
54
|
-
let isRangeEnd = isSelected && (isLastSelectedBeforeDisabled || dayOfWeek === 6 || props.date.day === currentMonth.calendar.getDaysInMonth(currentMonth));
|
|
55
|
-
let { focusProps: focusProps, isFocusVisible: isFocusVisible } = (0, $1nHC4$useFocusRing)();
|
|
56
|
-
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $1nHC4$useHover)({
|
|
57
|
-
isDisabled: isDisabled || isUnavailable || state.isReadOnly
|
|
58
|
-
});
|
|
59
|
-
return /*#__PURE__*/ (0, $1nHC4$react).createElement("td", {
|
|
60
|
-
...cellProps,
|
|
61
|
-
className: (0, $1nHC4$classNames)((0, ($parcel$interopDefault($1nHC4$calendar_vars_cssmodulejs))), 'spectrum-Calendar-tableCell')
|
|
62
|
-
}, /*#__PURE__*/ (0, $1nHC4$react).createElement("span", {
|
|
63
|
-
...(0, $1nHC4$mergeProps)(buttonProps, hoverProps, focusProps),
|
|
64
|
-
ref: ref,
|
|
65
|
-
className: (0, $1nHC4$classNames)((0, ($parcel$interopDefault($1nHC4$calendar_vars_cssmodulejs))), 'spectrum-Calendar-date', {
|
|
66
|
-
'is-today': (0, $1nHC4$isToday)(props.date, state.timeZone),
|
|
67
|
-
'is-selected': isSelected,
|
|
68
|
-
'is-focused': isFocused && isFocusVisible,
|
|
69
|
-
// Style disabled (i.e. out of min/max range), but selected dates as unavailable
|
|
70
|
-
// since it is more clear than trying to dim the selection.
|
|
71
|
-
'is-disabled': isDisabled && !isInvalid,
|
|
72
|
-
'is-unavailable': isUnavailable || isInvalid && isDisabled,
|
|
73
|
-
'is-outsideMonth': !(0, $1nHC4$isSameMonth)(props.date, currentMonth),
|
|
74
|
-
'is-range-start': isRangeStart,
|
|
75
|
-
'is-range-end': isRangeEnd,
|
|
76
|
-
'is-range-selection': isSelected && 'highlightedRange' in state,
|
|
77
|
-
'is-selection-start': isSelectionStart,
|
|
78
|
-
'is-selection-end': isSelectionEnd,
|
|
79
|
-
'is-hovered': isHovered,
|
|
80
|
-
'is-pressed': isPressed && !state.isReadOnly,
|
|
81
|
-
'is-invalid': isInvalid
|
|
82
|
-
})
|
|
83
|
-
}, /*#__PURE__*/ (0, $1nHC4$react).createElement("span", {
|
|
84
|
-
className: (0, $1nHC4$classNames)((0, ($parcel$interopDefault($1nHC4$calendar_vars_cssmodulejs))), 'spectrum-Calendar-dateText')
|
|
85
|
-
}, /*#__PURE__*/ (0, $1nHC4$react).createElement("span", null, formattedDate))));
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
export {$453c556b9066da11$export$5d847498420df57b as CalendarCell};
|
|
90
|
-
//# sourceMappingURL=CalendarCell.module.js.map
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import "./calendar.e1e61a27.css";
|
|
2
|
-
import $1nHC4$calendar_vars_cssmodulejs from "./calendar_vars_css.module.js";
|
|
3
|
-
import {useCalendarCell as $1nHC4$useCalendarCell} from "@react-aria/calendar";
|
|
4
|
-
import {isSameMonth as $1nHC4$isSameMonth, isSameDay as $1nHC4$isSameDay, getDayOfWeek as $1nHC4$getDayOfWeek, isToday as $1nHC4$isToday} from "@internationalized/date";
|
|
5
|
-
import {classNames as $1nHC4$classNames} from "@react-spectrum/utils";
|
|
6
|
-
import {mergeProps as $1nHC4$mergeProps} from "@react-aria/utils";
|
|
7
|
-
import $1nHC4$react, {useRef as $1nHC4$useRef} from "react";
|
|
8
|
-
import {useFocusRing as $1nHC4$useFocusRing} from "@react-aria/focus";
|
|
9
|
-
import {useHover as $1nHC4$useHover} from "@react-aria/interactions";
|
|
10
|
-
import {useLocale as $1nHC4$useLocale} from "@react-aria/i18n";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
function $parcel$interopDefault(a) {
|
|
14
|
-
return a && a.__esModule ? a.default : a;
|
|
15
|
-
}
|
|
16
|
-
/*
|
|
17
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
18
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
19
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
20
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
21
|
-
*
|
|
22
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
23
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
24
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
25
|
-
* governing permissions and limitations under the License.
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
function $453c556b9066da11$export$5d847498420df57b({ state: state, currentMonth: currentMonth, firstDayOfWeek: firstDayOfWeek, ...props }) {
|
|
36
|
-
let ref = (0, $1nHC4$useRef)(null);
|
|
37
|
-
let { cellProps: cellProps, buttonProps: buttonProps, isPressed: isPressed, isSelected: isSelected, isDisabled: isDisabled, isFocused: isFocused, isInvalid: isInvalid, formattedDate: formattedDate } = (0, $1nHC4$useCalendarCell)({
|
|
38
|
-
...props,
|
|
39
|
-
isDisabled: !(0, $1nHC4$isSameMonth)(props.date, currentMonth)
|
|
40
|
-
}, state, ref);
|
|
41
|
-
let isUnavailable = state.isCellUnavailable(props.date) && !isDisabled;
|
|
42
|
-
let isLastSelectedBeforeDisabled = !isDisabled && !isInvalid && state.isCellUnavailable(props.date.add({
|
|
43
|
-
days: 1
|
|
44
|
-
}));
|
|
45
|
-
let isFirstSelectedAfterDisabled = !isDisabled && !isInvalid && state.isCellUnavailable(props.date.subtract({
|
|
46
|
-
days: 1
|
|
47
|
-
}));
|
|
48
|
-
let highlightedRange = 'highlightedRange' in state && state.highlightedRange;
|
|
49
|
-
let isSelectionStart = isSelected && highlightedRange && (0, $1nHC4$isSameDay)(props.date, highlightedRange.start);
|
|
50
|
-
let isSelectionEnd = isSelected && highlightedRange && (0, $1nHC4$isSameDay)(props.date, highlightedRange.end);
|
|
51
|
-
let { locale: locale } = (0, $1nHC4$useLocale)();
|
|
52
|
-
let dayOfWeek = (0, $1nHC4$getDayOfWeek)(props.date, locale, firstDayOfWeek);
|
|
53
|
-
let isRangeStart = isSelected && (isFirstSelectedAfterDisabled || dayOfWeek === 0 || props.date.day === 1);
|
|
54
|
-
let isRangeEnd = isSelected && (isLastSelectedBeforeDisabled || dayOfWeek === 6 || props.date.day === currentMonth.calendar.getDaysInMonth(currentMonth));
|
|
55
|
-
let { focusProps: focusProps, isFocusVisible: isFocusVisible } = (0, $1nHC4$useFocusRing)();
|
|
56
|
-
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $1nHC4$useHover)({
|
|
57
|
-
isDisabled: isDisabled || isUnavailable || state.isReadOnly
|
|
58
|
-
});
|
|
59
|
-
return /*#__PURE__*/ (0, $1nHC4$react).createElement("td", {
|
|
60
|
-
...cellProps,
|
|
61
|
-
className: (0, $1nHC4$classNames)((0, ($parcel$interopDefault($1nHC4$calendar_vars_cssmodulejs))), 'spectrum-Calendar-tableCell')
|
|
62
|
-
}, /*#__PURE__*/ (0, $1nHC4$react).createElement("span", {
|
|
63
|
-
...(0, $1nHC4$mergeProps)(buttonProps, hoverProps, focusProps),
|
|
64
|
-
ref: ref,
|
|
65
|
-
className: (0, $1nHC4$classNames)((0, ($parcel$interopDefault($1nHC4$calendar_vars_cssmodulejs))), 'spectrum-Calendar-date', {
|
|
66
|
-
'is-today': (0, $1nHC4$isToday)(props.date, state.timeZone),
|
|
67
|
-
'is-selected': isSelected,
|
|
68
|
-
'is-focused': isFocused && isFocusVisible,
|
|
69
|
-
// Style disabled (i.e. out of min/max range), but selected dates as unavailable
|
|
70
|
-
// since it is more clear than trying to dim the selection.
|
|
71
|
-
'is-disabled': isDisabled && !isInvalid,
|
|
72
|
-
'is-unavailable': isUnavailable || isInvalid && isDisabled,
|
|
73
|
-
'is-outsideMonth': !(0, $1nHC4$isSameMonth)(props.date, currentMonth),
|
|
74
|
-
'is-range-start': isRangeStart,
|
|
75
|
-
'is-range-end': isRangeEnd,
|
|
76
|
-
'is-range-selection': isSelected && 'highlightedRange' in state,
|
|
77
|
-
'is-selection-start': isSelectionStart,
|
|
78
|
-
'is-selection-end': isSelectionEnd,
|
|
79
|
-
'is-hovered': isHovered,
|
|
80
|
-
'is-pressed': isPressed && !state.isReadOnly,
|
|
81
|
-
'is-invalid': isInvalid
|
|
82
|
-
})
|
|
83
|
-
}, /*#__PURE__*/ (0, $1nHC4$react).createElement("span", {
|
|
84
|
-
className: (0, $1nHC4$classNames)((0, ($parcel$interopDefault($1nHC4$calendar_vars_cssmodulejs))), 'spectrum-Calendar-dateText')
|
|
85
|
-
}, /*#__PURE__*/ (0, $1nHC4$react).createElement("span", null, formattedDate))));
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
export {$453c556b9066da11$export$5d847498420df57b as CalendarCell};
|
|
90
|
-
//# sourceMappingURL=CalendarCell.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AAmBM,SAAS,0CAAa,SAAC,KAAK,gBAAE,YAAY,kBAAE,cAAc,EAAE,GAAG,OAAyB;IAC7F,IAAI,MAAM,CAAA,GAAA,aAAK,EAAe;IAC9B,IAAI,aACF,SAAS,eACT,WAAW,aACX,SAAS,cACT,UAAU,cACV,UAAU,aACV,SAAS,aACT,SAAS,iBACT,aAAa,EACd,GAAG,CAAA,GAAA,sBAAc,EAAE;QAClB,GAAG,KAAK;QACR,YAAY,CAAC,CAAA,GAAA,kBAAU,EAAE,MAAM,IAAI,EAAE;IACvC,GAAG,OAAO;IACV,IAAI,gBAAgB,MAAM,iBAAiB,CAAC,MAAM,IAAI,KAAK,CAAC;IAC5D,IAAI,+BAA+B,CAAC,cAAc,CAAC,aAAa,MAAM,iBAAiB,CAAC,MAAM,IAAI,CAAC,GAAG,CAAC;QAAC,MAAM;IAAC;IAC/G,IAAI,+BAA+B,CAAC,cAAc,CAAC,aAAa,MAAM,iBAAiB,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC;QAAC,MAAM;IAAC;IACpH,IAAI,mBAAmB,sBAAsB,SAAS,MAAM,gBAAgB;IAC5E,IAAI,mBAAmB,cAAc,oBAAoB,CAAA,GAAA,gBAAQ,EAAE,MAAM,IAAI,EAAE,iBAAiB,KAAK;IACrG,IAAI,iBAAiB,cAAc,oBAAoB,CAAA,GAAA,gBAAQ,EAAE,MAAM,IAAI,EAAE,iBAAiB,GAAG;IACjG,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,gBAAQ;IACvB,IAAI,YAAY,CAAA,GAAA,mBAAW,EAAE,MAAM,IAAI,EAAE,QAAQ;IACjD,IAAI,eAAe,cAAe,CAAA,gCAAgC,cAAc,KAAK,MAAM,IAAI,CAAC,GAAG,KAAK,CAAA;IACxG,IAAI,aAAa,cAAe,CAAA,gCAAgC,cAAc,KAAK,MAAM,IAAI,CAAC,GAAG,KAAK,aAAa,QAAQ,CAAC,cAAc,CAAC,aAAY;IACvJ,IAAI,cAAC,UAAU,kBAAE,cAAc,EAAC,GAAG,CAAA,GAAA,mBAAW;IAC9C,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;QAAC,YAAY,cAAc,iBAAiB,MAAM,UAAU;IAAA;IAEnG,qBACE,gCAAC;QACE,GAAG,SAAS;QACb,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,0DAAK,GAAG;qBAC9B,gCAAC;QACE,GAAG,CAAA,GAAA,iBAAS,EAAE,aAAa,YAAY,WAAW;QACnD,KAAK;QACL,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,0DAAK,GAAG,0BAA0B;YACtD,YAAY,CAAA,GAAA,cAAM,EAAE,MAAM,IAAI,EAAE,MAAM,QAAQ;YAC9C,eAAe;YACf,cAAc,aAAa;YAC3B,gFAAgF;YAChF,2DAA2D;YAC3D,eAAe,cAAc,CAAC;YAC9B,kBAAkB,iBAAkB,aAAa;YACjD,mBAAmB,CAAC,CAAA,GAAA,kBAAU,EAAE,MAAM,IAAI,EAAE;YAC5C,kBAAkB;YAClB,gBAAgB;YAChB,sBAAsB,cAAc,sBAAsB;YAC1D,sBAAsB;YACtB,oBAAoB;YACpB,cAAc;YACd,cAAc,aAAa,CAAC,MAAM,UAAU;YAC5C,cAAc;QAChB;qBACA,gCAAC;QAAK,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,0DAAK,GAAG;qBAClC,gCAAC,cAAM;AAKjB","sources":["packages/@react-spectrum/calendar/src/CalendarCell.tsx"],"sourcesContent":["/*\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, 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, {JSX, useRef} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/calendar/vars.css';\nimport {useFocusRing} from '@react-aria/focus';\nimport {useHover} from '@react-aria/interactions';\nimport {useLocale} from '@react-aria/i18n';\n\ninterface CalendarCellProps extends AriaCalendarCellProps {\n state: CalendarState | RangeCalendarState,\n currentMonth: CalendarDate,\n firstDayOfWeek?: 'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat'\n}\n\nexport function CalendarCell({state, currentMonth, firstDayOfWeek, ...props}: CalendarCellProps): JSX.Element {\n let ref = useRef<HTMLElement>(null);\n let {\n cellProps,\n buttonProps,\n isPressed,\n isSelected,\n isDisabled,\n isFocused,\n isInvalid,\n formattedDate\n } = useCalendarCell({\n ...props,\n isDisabled: !isSameMonth(props.date, currentMonth)\n }, state, ref);\n let isUnavailable = state.isCellUnavailable(props.date) && !isDisabled;\n let isLastSelectedBeforeDisabled = !isDisabled && !isInvalid && state.isCellUnavailable(props.date.add({days: 1}));\n let isFirstSelectedAfterDisabled = !isDisabled && !isInvalid && state.isCellUnavailable(props.date.subtract({days: 1}));\n let highlightedRange = 'highlightedRange' in state && state.highlightedRange;\n let isSelectionStart = isSelected && highlightedRange && isSameDay(props.date, highlightedRange.start);\n let isSelectionEnd = isSelected && highlightedRange && isSameDay(props.date, highlightedRange.end);\n let {locale} = useLocale();\n let dayOfWeek = getDayOfWeek(props.date, locale, firstDayOfWeek);\n let isRangeStart = isSelected && (isFirstSelectedAfterDisabled || dayOfWeek === 0 || props.date.day === 1);\n let isRangeEnd = isSelected && (isLastSelectedBeforeDisabled || dayOfWeek === 6 || props.date.day === currentMonth.calendar.getDaysInMonth(currentMonth));\n let {focusProps, isFocusVisible} = useFocusRing();\n let {hoverProps, isHovered} = useHover({isDisabled: isDisabled || isUnavailable || state.isReadOnly});\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': isFocused && isFocusVisible,\n // Style disabled (i.e. out of min/max range), but selected dates as unavailable\n // since it is more clear than trying to dim the selection.\n 'is-disabled': isDisabled && !isInvalid,\n 'is-unavailable': isUnavailable || (isInvalid && isDisabled),\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 && !state.isReadOnly,\n 'is-invalid': isInvalid\n })}>\n <span className={classNames(styles, 'spectrum-Calendar-dateText')}>\n <span>{formattedDate}</span>\n </span>\n </span>\n </td>\n );\n}\n"],"names":[],"version":3,"file":"CalendarCell.module.js.map"}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
var $52c7c3c887827b64$exports = require("./CalendarCell.main.js");
|
|
2
|
-
require("./calendar.e1e61a27.css");
|
|
3
|
-
var $915891ae6206caad$exports = require("./calendar_vars_css.main.js");
|
|
4
|
-
var $4d66a$internationalizeddate = require("@internationalized/date");
|
|
5
|
-
var $4d66a$reactspectrumutils = require("@react-spectrum/utils");
|
|
6
|
-
var $4d66a$react = require("react");
|
|
7
|
-
var $4d66a$reactariacalendar = require("@react-aria/calendar");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
function $parcel$interopDefault(a) {
|
|
11
|
-
return a && a.__esModule ? a.default : a;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function $parcel$export(e, n, v, s) {
|
|
15
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
$parcel$export(module.exports, "CalendarMonth", () => $02c19eea15a72a7b$export$26e2752316b9a375);
|
|
19
|
-
/*
|
|
20
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
21
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
22
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
23
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
24
|
-
*
|
|
25
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
26
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
27
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
28
|
-
* governing permissions and limitations under the License.
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
function $02c19eea15a72a7b$export$26e2752316b9a375(props) {
|
|
36
|
-
let { state: state, startDate: startDate, firstDayOfWeek: firstDayOfWeek } = props;
|
|
37
|
-
let { gridProps: gridProps, headerProps: headerProps, weekDays: weekDays, weeksInMonth: weeksInMonth } = (0, $4d66a$reactariacalendar.useCalendarGrid)({
|
|
38
|
-
...props,
|
|
39
|
-
endDate: (0, $4d66a$internationalizeddate.endOfMonth)(startDate)
|
|
40
|
-
}, state);
|
|
41
|
-
return /*#__PURE__*/ (0, ($parcel$interopDefault($4d66a$react))).createElement("table", {
|
|
42
|
-
...gridProps,
|
|
43
|
-
className: (0, $4d66a$reactspectrumutils.classNames)((0, ($parcel$interopDefault($915891ae6206caad$exports))), 'spectrum-Calendar-body', 'spectrum-Calendar-table')
|
|
44
|
-
}, /*#__PURE__*/ (0, ($parcel$interopDefault($4d66a$react))).createElement("thead", headerProps, /*#__PURE__*/ (0, ($parcel$interopDefault($4d66a$react))).createElement("tr", null, weekDays.map((day, index)=>/*#__PURE__*/ (0, ($parcel$interopDefault($4d66a$react))).createElement("th", {
|
|
45
|
-
key: index,
|
|
46
|
-
className: (0, $4d66a$reactspectrumutils.classNames)((0, ($parcel$interopDefault($915891ae6206caad$exports))), 'spectrum-Calendar-tableCell')
|
|
47
|
-
}, /*#__PURE__*/ (0, ($parcel$interopDefault($4d66a$react))).createElement("span", {
|
|
48
|
-
className: (0, $4d66a$reactspectrumutils.classNames)((0, ($parcel$interopDefault($915891ae6206caad$exports))), 'spectrum-Calendar-dayOfWeek')
|
|
49
|
-
}, day))))), /*#__PURE__*/ (0, ($parcel$interopDefault($4d66a$react))).createElement("tbody", null, [
|
|
50
|
-
...new Array(weeksInMonth).keys()
|
|
51
|
-
].map((weekIndex)=>/*#__PURE__*/ (0, ($parcel$interopDefault($4d66a$react))).createElement("tr", {
|
|
52
|
-
key: weekIndex
|
|
53
|
-
}, state.getDatesInWeek(weekIndex, startDate).map((date, i)=>date ? /*#__PURE__*/ (0, ($parcel$interopDefault($4d66a$react))).createElement((0, $52c7c3c887827b64$exports.CalendarCell), {
|
|
54
|
-
key: i,
|
|
55
|
-
state: state,
|
|
56
|
-
date: date,
|
|
57
|
-
currentMonth: startDate,
|
|
58
|
-
firstDayOfWeek: firstDayOfWeek
|
|
59
|
-
}) : /*#__PURE__*/ (0, ($parcel$interopDefault($4d66a$react))).createElement("td", {
|
|
60
|
-
key: i
|
|
61
|
-
}))))));
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
//# sourceMappingURL=CalendarMonth.main.js.map
|