@react-spectrum/calendar 3.4.8 → 3.4.10
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/Calendar.main.js +1 -1
- package/dist/Calendar.main.js.map +1 -1
- package/dist/Calendar.mjs +2 -2
- package/dist/Calendar.module.js +1 -1
- package/dist/Calendar.module.js.map +1 -1
- package/dist/CalendarBase.main.js +17 -17
- package/dist/CalendarBase.main.js.map +1 -1
- package/dist/CalendarBase.mjs +18 -18
- package/dist/CalendarBase.module.js +17 -17
- package/dist/CalendarBase.module.js.map +1 -1
- package/dist/CalendarCell.main.js +19 -19
- package/dist/CalendarCell.main.js.map +1 -1
- package/dist/CalendarCell.mjs +20 -20
- package/dist/CalendarCell.module.js +19 -19
- package/dist/CalendarCell.module.js.map +1 -1
- package/dist/CalendarMonth.main.js +3 -3
- package/dist/CalendarMonth.mjs +4 -4
- package/dist/CalendarMonth.module.js +3 -3
- package/dist/RangeCalendar.main.js +1 -1
- package/dist/RangeCalendar.main.js.map +1 -1
- package/dist/RangeCalendar.mjs +2 -2
- package/dist/RangeCalendar.module.js +1 -1
- package/dist/RangeCalendar.module.js.map +1 -1
- package/dist/ar-AE.mjs +1 -1
- package/dist/bg-BG.mjs +1 -1
- package/dist/calendar_vars_css.mjs +1 -1
- package/dist/cs-CZ.mjs +1 -1
- package/dist/da-DK.mjs +1 -1
- package/dist/de-DE.mjs +1 -1
- package/dist/el-GR.mjs +1 -1
- package/dist/en-US.mjs +1 -1
- package/dist/es-ES.mjs +1 -1
- package/dist/et-EE.mjs +1 -1
- package/dist/fi-FI.mjs +1 -1
- package/dist/fr-FR.mjs +1 -1
- package/dist/he-IL.mjs +1 -1
- package/dist/hr-HR.mjs +1 -1
- package/dist/hu-HU.mjs +1 -1
- package/dist/intlStrings.mjs +1 -1
- package/dist/it-IT.mjs +1 -1
- package/dist/ja-JP.mjs +1 -1
- package/dist/ko-KR.mjs +1 -1
- package/dist/lt-LT.mjs +1 -1
- package/dist/lv-LV.mjs +1 -1
- package/dist/nb-NO.mjs +1 -1
- package/dist/nl-NL.mjs +1 -1
- package/dist/pl-PL.mjs +1 -1
- package/dist/pt-BR.mjs +1 -1
- package/dist/pt-PT.mjs +1 -1
- package/dist/ro-RO.mjs +1 -1
- package/dist/ru-RU.mjs +1 -1
- package/dist/sk-SK.mjs +1 -1
- package/dist/sl-SI.mjs +1 -1
- package/dist/sr-SP.mjs +1 -1
- package/dist/sv-SE.mjs +1 -1
- package/dist/tr-TR.mjs +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/uk-UA.mjs +1 -1
- package/dist/zh-CN.mjs +1 -1
- package/dist/zh-TW.mjs +1 -1
- package/package.json +19 -19
- package/src/Calendar.tsx +1 -1
- package/src/CalendarBase.tsx +5 -5
- package/src/CalendarCell.tsx +1 -1
- package/src/RangeCalendar.tsx +1 -1
package/dist/Calendar.main.js
CHANGED
|
@@ -51,7 +51,7 @@ function $d9490b77e8681e44$var$Calendar(props, ref) {
|
|
|
51
51
|
visibleDuration: visibleDuration,
|
|
52
52
|
createCalendar: $jdfnP$internationalizeddate.createCalendar
|
|
53
53
|
});
|
|
54
|
-
let domRef = (0, $jdfnP$react.useRef)();
|
|
54
|
+
let domRef = (0, $jdfnP$react.useRef)(null);
|
|
55
55
|
(0, $jdfnP$react.useImperativeHandle)(ref, ()=>({
|
|
56
56
|
...(0, $jdfnP$reactspectrumutils.createDOMRef)(domRef),
|
|
57
57
|
focus () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAaD,SAAS,+BAA8B,KAA+B,EAAE,GAA8B;IACpG,QAAQ,CAAA,GAAA,6CAAe,EAAE;IACzB,IAAI,iBAAC,gBAAgB,GAAE,GAAG;IAC1B,gBAAgB,KAAK,GAAG,CAAC,eAAe;IACxC,IAAI,kBAAkB,CAAA,GAAA,oBAAM,EAAE,IAAO,CAAA;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ectrum/calendar/src/Calendar.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 {CalendarBase} from './CalendarBase';\nimport {createCalendar} from '@internationalized/date';\nimport {createDOMRef} from '@react-spectrum/utils';\nimport {DateValue, SpectrumCalendarProps} from '@react-types/calendar';\nimport {FocusableRef} from '@react-types/shared';\nimport React, {ReactElement, useImperativeHandle, useMemo, useRef} from 'react';\nimport {useCalendar} from '@react-aria/calendar';\nimport {useCalendarState} from '@react-stately/calendar';\nimport {useLocale} from '@react-aria/i18n';\nimport {useProviderProps} from '@react-spectrum/provider';\n\nfunction Calendar<T extends DateValue>(props: SpectrumCalendarProps<T>, ref: FocusableRef<HTMLElement>) {\n props = useProviderProps(props);\n let {visibleMonths = 1} = props;\n visibleMonths = Math.max(visibleMonths, 1);\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 let domRef = useRef(null);\n useImperativeHandle(ref, () => ({\n ...createDOMRef(domRef),\n focus() {\n state.setFocused(true);\n }\n }));\n\n let {calendarProps, prevButtonProps, nextButtonProps, errorMessageProps} = useCalendar(props, state);\n\n return (\n <CalendarBase\n {...props}\n visibleMonths={visibleMonths}\n state={state}\n calendarRef={domRef}\n calendarProps={calendarProps}\n prevButtonProps={prevButtonProps}\n nextButtonProps={nextButtonProps}\n errorMessageProps={errorMessageProps} />\n );\n}\n\n/**\n * Calendars display a grid of days in one or more months and allow users to select a single date.\n */\nconst _Calendar = React.forwardRef(Calendar) as <T extends DateValue>(props: SpectrumCalendarProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;\nexport {_Calendar as Calendar};\n"],"names":[],"version":3,"file":"Calendar.main.js.map"}
|
package/dist/Calendar.mjs
CHANGED
|
@@ -41,7 +41,7 @@ function $d2b8d4577dd88671$var$Calendar(props, ref) {
|
|
|
41
41
|
visibleDuration: visibleDuration,
|
|
42
42
|
createCalendar: $fF0AO$createCalendar
|
|
43
43
|
});
|
|
44
|
-
let domRef = (0, $fF0AO$useRef)();
|
|
44
|
+
let domRef = (0, $fF0AO$useRef)(null);
|
|
45
45
|
(0, $fF0AO$useImperativeHandle)(ref, ()=>({
|
|
46
46
|
...(0, $fF0AO$createDOMRef)(domRef),
|
|
47
47
|
focus () {
|
|
@@ -66,4 +66,4 @@ function $d2b8d4577dd88671$var$Calendar(props, ref) {
|
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
export {$d2b8d4577dd88671$export$e1aef45b828286de as Calendar};
|
|
69
|
-
//# sourceMappingURL=Calendar.
|
|
69
|
+
//# sourceMappingURL=Calendar.module.js.map
|
package/dist/Calendar.module.js
CHANGED
|
@@ -41,7 +41,7 @@ function $d2b8d4577dd88671$var$Calendar(props, ref) {
|
|
|
41
41
|
visibleDuration: visibleDuration,
|
|
42
42
|
createCalendar: $fF0AO$createCalendar
|
|
43
43
|
});
|
|
44
|
-
let domRef = (0, $fF0AO$useRef)();
|
|
44
|
+
let domRef = (0, $fF0AO$useRef)(null);
|
|
45
45
|
(0, $fF0AO$useImperativeHandle)(ref, ()=>({
|
|
46
46
|
...(0, $fF0AO$createDOMRef)(domRef),
|
|
47
47
|
focus () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAaD,SAAS,+BAA8B,KAA+B,EAAE,GAA8B;IACpG,QAAQ,CAAA,GAAA,uBAAe,EAAE;IACzB,IAAI,iBAAC,gBAAgB,GAAE,GAA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;AAEA;;CAEC,GACD,MAAM,0DAAY,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/calendar/src/Calendar.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 {CalendarBase} from './CalendarBase';\nimport {createCalendar} from '@internationalized/date';\nimport {createDOMRef} from '@react-spectrum/utils';\nimport {DateValue, SpectrumCalendarProps} from '@react-types/calendar';\nimport {FocusableRef} from '@react-types/shared';\nimport React, {ReactElement, useImperativeHandle, useMemo, useRef} from 'react';\nimport {useCalendar} from '@react-aria/calendar';\nimport {useCalendarState} from '@react-stately/calendar';\nimport {useLocale} from '@react-aria/i18n';\nimport {useProviderProps} from '@react-spectrum/provider';\n\nfunction Calendar<T extends DateValue>(props: SpectrumCalendarProps<T>, ref: FocusableRef<HTMLElement>) {\n props = useProviderProps(props);\n let {visibleMonths = 1} = props;\n visibleMonths = Math.max(visibleMonths, 1);\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 let domRef = useRef(null);\n useImperativeHandle(ref, () => ({\n ...createDOMRef(domRef),\n focus() {\n state.setFocused(true);\n }\n }));\n\n let {calendarProps, prevButtonProps, nextButtonProps, errorMessageProps} = useCalendar(props, state);\n\n return (\n <CalendarBase\n {...props}\n visibleMonths={visibleMonths}\n state={state}\n calendarRef={domRef}\n calendarProps={calendarProps}\n prevButtonProps={prevButtonProps}\n nextButtonProps={nextButtonProps}\n errorMessageProps={errorMessageProps} />\n );\n}\n\n/**\n * Calendars display a grid of days in one or more months and allow users to select a single date.\n */\nconst _Calendar = React.forwardRef(Calendar) as <T extends DateValue>(props: SpectrumCalendarProps<T> & {ref?: FocusableRef<HTMLElement>}) => ReactElement;\nexport {_Calendar as Calendar};\n"],"names":[],"version":3,"file":"Calendar.module.js.map"}
|
|
@@ -45,13 +45,13 @@ $parcel$export(module.exports, "CalendarBase", () => $6d416018158e3a26$export$bf
|
|
|
45
45
|
function $6d416018158e3a26$export$bfd52a43017368fe(props) {
|
|
46
46
|
let { state: state, calendarProps: calendarProps, nextButtonProps: nextButtonProps, prevButtonProps: prevButtonProps, errorMessageProps: errorMessageProps, calendarRef: ref, visibleMonths: visibleMonths = 1 } = props;
|
|
47
47
|
let { styleProps: styleProps } = (0, $6ckm4$reactspectrumutils.useStyleProps)(props);
|
|
48
|
-
let stringFormatter = (0, $6ckm4$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($7e7c3b1f5233ce23$exports))),
|
|
48
|
+
let stringFormatter = (0, $6ckm4$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($7e7c3b1f5233ce23$exports))), '@react-spectrum/calendar');
|
|
49
49
|
let { direction: direction } = (0, $6ckm4$reactariai18n.useLocale)();
|
|
50
50
|
let currentMonth = state.visibleRange.start;
|
|
51
51
|
let monthDateFormatter = (0, $6ckm4$reactariai18n.useDateFormatter)({
|
|
52
|
-
month:
|
|
53
|
-
year:
|
|
54
|
-
era: currentMonth.calendar.identifier ===
|
|
52
|
+
month: 'long',
|
|
53
|
+
year: 'numeric',
|
|
54
|
+
era: currentMonth.calendar.identifier === 'gregory' && currentMonth.era === 'BC' ? 'short' : undefined,
|
|
55
55
|
calendar: currentMonth.calendar.identifier,
|
|
56
56
|
timeZone: state.timeZone
|
|
57
57
|
});
|
|
@@ -63,22 +63,22 @@ function $6d416018158e3a26$export$bfd52a43017368fe(props) {
|
|
|
63
63
|
});
|
|
64
64
|
titles.push(/*#__PURE__*/ (0, ($parcel$interopDefault($6ckm4$react))).createElement("div", {
|
|
65
65
|
key: i,
|
|
66
|
-
className: (0, $6ckm4$reactspectrumutils.classNames)((0, ($parcel$interopDefault($915891ae6206caad$exports))),
|
|
66
|
+
className: (0, $6ckm4$reactspectrumutils.classNames)((0, ($parcel$interopDefault($915891ae6206caad$exports))), 'spectrum-Calendar-monthHeader')
|
|
67
67
|
}, i === 0 && /*#__PURE__*/ (0, ($parcel$interopDefault($6ckm4$react))).createElement((0, $6ckm4$reactspectrumbutton.ActionButton), {
|
|
68
68
|
...prevButtonProps,
|
|
69
|
-
UNSAFE_className: (0, $6ckm4$reactspectrumutils.classNames)((0, ($parcel$interopDefault($915891ae6206caad$exports))),
|
|
69
|
+
UNSAFE_className: (0, $6ckm4$reactspectrumutils.classNames)((0, ($parcel$interopDefault($915891ae6206caad$exports))), 'spectrum-Calendar-prevMonth'),
|
|
70
70
|
isQuiet: true
|
|
71
|
-
}, direction ===
|
|
71
|
+
}, direction === 'rtl' ? /*#__PURE__*/ (0, ($parcel$interopDefault($6ckm4$react))).createElement((0, ($parcel$interopDefault($6ckm4$spectrumiconsuiChevronRightLarge))), null) : /*#__PURE__*/ (0, ($parcel$interopDefault($6ckm4$react))).createElement((0, ($parcel$interopDefault($6ckm4$spectrumiconsuiChevronLeftLarge))), null)), /*#__PURE__*/ (0, ($parcel$interopDefault($6ckm4$react))).createElement("h2", {
|
|
72
72
|
// We have a visually hidden heading describing the entire visible range,
|
|
73
73
|
// and the calendar itself describes the individual month
|
|
74
74
|
// so we don't need to repeat that here for screen reader users.
|
|
75
75
|
"aria-hidden": true,
|
|
76
|
-
className: (0, $6ckm4$reactspectrumutils.classNames)((0, ($parcel$interopDefault($915891ae6206caad$exports))),
|
|
76
|
+
className: (0, $6ckm4$reactspectrumutils.classNames)((0, ($parcel$interopDefault($915891ae6206caad$exports))), 'spectrum-Calendar-title')
|
|
77
77
|
}, monthDateFormatter.format(d.toDate(state.timeZone))), i === visibleMonths - 1 && /*#__PURE__*/ (0, ($parcel$interopDefault($6ckm4$react))).createElement((0, $6ckm4$reactspectrumbutton.ActionButton), {
|
|
78
78
|
...nextButtonProps,
|
|
79
|
-
UNSAFE_className: (0, $6ckm4$reactspectrumutils.classNames)((0, ($parcel$interopDefault($915891ae6206caad$exports))),
|
|
79
|
+
UNSAFE_className: (0, $6ckm4$reactspectrumutils.classNames)((0, ($parcel$interopDefault($915891ae6206caad$exports))), 'spectrum-Calendar-nextMonth'),
|
|
80
80
|
isQuiet: true
|
|
81
|
-
}, direction ===
|
|
81
|
+
}, direction === 'rtl' ? /*#__PURE__*/ (0, ($parcel$interopDefault($6ckm4$react))).createElement((0, ($parcel$interopDefault($6ckm4$spectrumiconsuiChevronLeftLarge))), null) : /*#__PURE__*/ (0, ($parcel$interopDefault($6ckm4$react))).createElement((0, ($parcel$interopDefault($6ckm4$spectrumiconsuiChevronRightLarge))), null))));
|
|
82
82
|
calendars.push(/*#__PURE__*/ (0, ($parcel$interopDefault($6ckm4$react))).createElement((0, $02c19eea15a72a7b$exports.CalendarMonth), {
|
|
83
83
|
...props,
|
|
84
84
|
key: i,
|
|
@@ -90,20 +90,20 @@ function $6d416018158e3a26$export$bfd52a43017368fe(props) {
|
|
|
90
90
|
...styleProps,
|
|
91
91
|
...calendarProps,
|
|
92
92
|
ref: ref,
|
|
93
|
-
className: (0, $6ckm4$reactspectrumutils.classNames)((0, ($parcel$interopDefault($915891ae6206caad$exports))),
|
|
94
|
-
}, /*#__PURE__*/ (0, ($parcel$interopDefault($6ckm4$react))).createElement((0, $6ckm4$reactariavisuallyhidden.VisuallyHidden), null, /*#__PURE__*/ (0, ($parcel$interopDefault($6ckm4$react))).createElement("h2", null, calendarProps[
|
|
95
|
-
className: (0, $6ckm4$reactspectrumutils.classNames)((0, ($parcel$interopDefault($915891ae6206caad$exports))),
|
|
93
|
+
className: (0, $6ckm4$reactspectrumutils.classNames)((0, ($parcel$interopDefault($915891ae6206caad$exports))), 'spectrum-Calendar', styleProps.className)
|
|
94
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($6ckm4$react))).createElement((0, $6ckm4$reactariavisuallyhidden.VisuallyHidden), null, /*#__PURE__*/ (0, ($parcel$interopDefault($6ckm4$react))).createElement("h2", null, calendarProps['aria-label'])), /*#__PURE__*/ (0, ($parcel$interopDefault($6ckm4$react))).createElement("div", {
|
|
95
|
+
className: (0, $6ckm4$reactspectrumutils.classNames)((0, ($parcel$interopDefault($915891ae6206caad$exports))), 'spectrum-Calendar-header')
|
|
96
96
|
}, titles), /*#__PURE__*/ (0, ($parcel$interopDefault($6ckm4$react))).createElement("div", {
|
|
97
|
-
className: (0, $6ckm4$reactspectrumutils.classNames)((0, ($parcel$interopDefault($915891ae6206caad$exports))),
|
|
97
|
+
className: (0, $6ckm4$reactspectrumutils.classNames)((0, ($parcel$interopDefault($915891ae6206caad$exports))), 'spectrum-Calendar-months')
|
|
98
98
|
}, calendars), /*#__PURE__*/ (0, ($parcel$interopDefault($6ckm4$react))).createElement((0, $6ckm4$reactariavisuallyhidden.VisuallyHidden), null, /*#__PURE__*/ (0, ($parcel$interopDefault($6ckm4$react))).createElement("button", {
|
|
99
|
-
"aria-label": nextButtonProps[
|
|
99
|
+
"aria-label": nextButtonProps['aria-label'],
|
|
100
100
|
disabled: nextButtonProps.isDisabled,
|
|
101
101
|
onClick: ()=>state.focusNextPage(),
|
|
102
102
|
tabIndex: -1
|
|
103
103
|
})), state.isValueInvalid && /*#__PURE__*/ (0, ($parcel$interopDefault($6ckm4$react))).createElement((0, $6ckm4$reactspectrumlabel.HelpText), {
|
|
104
104
|
showErrorIcon: true,
|
|
105
|
-
errorMessage: props.errorMessage || stringFormatter.format(
|
|
106
|
-
selectedCount:
|
|
105
|
+
errorMessage: props.errorMessage || stringFormatter.format('invalidSelection', {
|
|
106
|
+
selectedCount: 'highlightedRange' in state ? 2 : 1
|
|
107
107
|
}),
|
|
108
108
|
errorMessageProps: errorMessageProps,
|
|
109
109
|
isIn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AAa;QACjB,KAAK;QACL,WACE,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GACd,qBACA,WAAW,SAAS;qBAQxB,0DAAC,CAAA,GAAA,6CAAa,uBACZ,0DAAC,YAAI,aAAa,CAAC,aAAa,kBAElC,0DAAC;QAAI,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;OAChC,uBAEH,0DAAC;QAAI,WAAW,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;OAChC,0BAKH,0DAAC,CAAA,GAAA,6CAAa,uBACZ,0DAAC;QACC,cAAY,eAAe,CAAC,aAAa;QACzC,UAAU,gBAAgB,UAAU;QACpC,SAAS,IAAM,MAAM,aAAa;QAClC,UAAU;SAEb,MAAM,cAAc,kBACnB,0DAAC,CAAA,GAAA,kCAAO;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","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 {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>) {\n let {\n state,\n calendarProps,\n nextButtonProps,\n prevButtonProps,\n errorMessageProps,\n calendarRef: ref,\n visibleMonths = 1\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 {monthDateFormatter.format(d.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 calendars.push(\n <CalendarMonth\n {...props}\n key={i}\n state={state}\n startDate={d} />\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"],"names":[],"version":3,"file":"CalendarBase.main.js.map"}
|
package/dist/CalendarBase.mjs
CHANGED
|
@@ -39,13 +39,13 @@ function $parcel$interopDefault(a) {
|
|
|
39
39
|
function $62cd1e80f0dffb66$export$bfd52a43017368fe(props) {
|
|
40
40
|
let { state: state, calendarProps: calendarProps, nextButtonProps: nextButtonProps, prevButtonProps: prevButtonProps, errorMessageProps: errorMessageProps, calendarRef: ref, visibleMonths: visibleMonths = 1 } = props;
|
|
41
41
|
let { styleProps: styleProps } = (0, $bF3AV$useStyleProps)(props);
|
|
42
|
-
let stringFormatter = (0, $bF3AV$useLocalizedStringFormatter)((0, ($parcel$interopDefault($bF3AV$intlStringsmodulejs))),
|
|
42
|
+
let stringFormatter = (0, $bF3AV$useLocalizedStringFormatter)((0, ($parcel$interopDefault($bF3AV$intlStringsmodulejs))), '@react-spectrum/calendar');
|
|
43
43
|
let { direction: direction } = (0, $bF3AV$useLocale)();
|
|
44
44
|
let currentMonth = state.visibleRange.start;
|
|
45
45
|
let monthDateFormatter = (0, $bF3AV$useDateFormatter)({
|
|
46
|
-
month:
|
|
47
|
-
year:
|
|
48
|
-
era: currentMonth.calendar.identifier ===
|
|
46
|
+
month: 'long',
|
|
47
|
+
year: 'numeric',
|
|
48
|
+
era: currentMonth.calendar.identifier === 'gregory' && currentMonth.era === 'BC' ? 'short' : undefined,
|
|
49
49
|
calendar: currentMonth.calendar.identifier,
|
|
50
50
|
timeZone: state.timeZone
|
|
51
51
|
});
|
|
@@ -57,22 +57,22 @@ function $62cd1e80f0dffb66$export$bfd52a43017368fe(props) {
|
|
|
57
57
|
});
|
|
58
58
|
titles.push(/*#__PURE__*/ (0, $bF3AV$react).createElement("div", {
|
|
59
59
|
key: i,
|
|
60
|
-
className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))),
|
|
60
|
+
className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))), 'spectrum-Calendar-monthHeader')
|
|
61
61
|
}, i === 0 && /*#__PURE__*/ (0, $bF3AV$react).createElement((0, $bF3AV$ActionButton), {
|
|
62
62
|
...prevButtonProps,
|
|
63
|
-
UNSAFE_className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))),
|
|
63
|
+
UNSAFE_className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))), 'spectrum-Calendar-prevMonth'),
|
|
64
64
|
isQuiet: true
|
|
65
|
-
}, direction ===
|
|
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
66
|
// We have a visually hidden heading describing the entire visible range,
|
|
67
67
|
// and the calendar itself describes the individual month
|
|
68
68
|
// so we don't need to repeat that here for screen reader users.
|
|
69
69
|
"aria-hidden": true,
|
|
70
|
-
className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))),
|
|
70
|
+
className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))), 'spectrum-Calendar-title')
|
|
71
71
|
}, monthDateFormatter.format(d.toDate(state.timeZone))), i === visibleMonths - 1 && /*#__PURE__*/ (0, $bF3AV$react).createElement((0, $bF3AV$ActionButton), {
|
|
72
72
|
...nextButtonProps,
|
|
73
|
-
UNSAFE_className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))),
|
|
73
|
+
UNSAFE_className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))), 'spectrum-Calendar-nextMonth'),
|
|
74
74
|
isQuiet: true
|
|
75
|
-
}, direction ===
|
|
75
|
+
}, direction === 'rtl' ? /*#__PURE__*/ (0, $bF3AV$react).createElement((0, $bF3AV$spectrumiconsuiChevronLeftLarge), null) : /*#__PURE__*/ (0, $bF3AV$react).createElement((0, $bF3AV$spectrumiconsuiChevronRightLarge), null))));
|
|
76
76
|
calendars.push(/*#__PURE__*/ (0, $bF3AV$react).createElement((0, $faa2f3867773cfe5$export$26e2752316b9a375), {
|
|
77
77
|
...props,
|
|
78
78
|
key: i,
|
|
@@ -84,20 +84,20 @@ function $62cd1e80f0dffb66$export$bfd52a43017368fe(props) {
|
|
|
84
84
|
...styleProps,
|
|
85
85
|
...calendarProps,
|
|
86
86
|
ref: ref,
|
|
87
|
-
className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))),
|
|
88
|
-
}, /*#__PURE__*/ (0, $bF3AV$react).createElement((0, $bF3AV$VisuallyHidden), null, /*#__PURE__*/ (0, $bF3AV$react).createElement("h2", null, calendarProps[
|
|
89
|
-
className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))),
|
|
87
|
+
className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))), 'spectrum-Calendar', styleProps.className)
|
|
88
|
+
}, /*#__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", {
|
|
89
|
+
className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))), 'spectrum-Calendar-header')
|
|
90
90
|
}, titles), /*#__PURE__*/ (0, $bF3AV$react).createElement("div", {
|
|
91
|
-
className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))),
|
|
91
|
+
className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))), 'spectrum-Calendar-months')
|
|
92
92
|
}, calendars), /*#__PURE__*/ (0, $bF3AV$react).createElement((0, $bF3AV$VisuallyHidden), null, /*#__PURE__*/ (0, $bF3AV$react).createElement("button", {
|
|
93
|
-
"aria-label": nextButtonProps[
|
|
93
|
+
"aria-label": nextButtonProps['aria-label'],
|
|
94
94
|
disabled: nextButtonProps.isDisabled,
|
|
95
95
|
onClick: ()=>state.focusNextPage(),
|
|
96
96
|
tabIndex: -1
|
|
97
97
|
})), state.isValueInvalid && /*#__PURE__*/ (0, $bF3AV$react).createElement((0, $bF3AV$HelpText), {
|
|
98
98
|
showErrorIcon: true,
|
|
99
|
-
errorMessage: props.errorMessage || stringFormatter.format(
|
|
100
|
-
selectedCount:
|
|
99
|
+
errorMessage: props.errorMessage || stringFormatter.format('invalidSelection', {
|
|
100
|
+
selectedCount: 'highlightedRange' in state ? 2 : 1
|
|
101
101
|
}),
|
|
102
102
|
errorMessageProps: errorMessageProps,
|
|
103
103
|
isInvalid: true,
|
|
@@ -108,4 +108,4 @@ function $62cd1e80f0dffb66$export$bfd52a43017368fe(props) {
|
|
|
108
108
|
|
|
109
109
|
|
|
110
110
|
export {$62cd1e80f0dffb66$export$bfd52a43017368fe as CalendarBase};
|
|
111
|
-
//# sourceMappingURL=CalendarBase.
|
|
111
|
+
//# sourceMappingURL=CalendarBase.module.js.map
|
|
@@ -39,13 +39,13 @@ function $parcel$interopDefault(a) {
|
|
|
39
39
|
function $62cd1e80f0dffb66$export$bfd52a43017368fe(props) {
|
|
40
40
|
let { state: state, calendarProps: calendarProps, nextButtonProps: nextButtonProps, prevButtonProps: prevButtonProps, errorMessageProps: errorMessageProps, calendarRef: ref, visibleMonths: visibleMonths = 1 } = props;
|
|
41
41
|
let { styleProps: styleProps } = (0, $bF3AV$useStyleProps)(props);
|
|
42
|
-
let stringFormatter = (0, $bF3AV$useLocalizedStringFormatter)((0, ($parcel$interopDefault($bF3AV$intlStringsmodulejs))),
|
|
42
|
+
let stringFormatter = (0, $bF3AV$useLocalizedStringFormatter)((0, ($parcel$interopDefault($bF3AV$intlStringsmodulejs))), '@react-spectrum/calendar');
|
|
43
43
|
let { direction: direction } = (0, $bF3AV$useLocale)();
|
|
44
44
|
let currentMonth = state.visibleRange.start;
|
|
45
45
|
let monthDateFormatter = (0, $bF3AV$useDateFormatter)({
|
|
46
|
-
month:
|
|
47
|
-
year:
|
|
48
|
-
era: currentMonth.calendar.identifier ===
|
|
46
|
+
month: 'long',
|
|
47
|
+
year: 'numeric',
|
|
48
|
+
era: currentMonth.calendar.identifier === 'gregory' && currentMonth.era === 'BC' ? 'short' : undefined,
|
|
49
49
|
calendar: currentMonth.calendar.identifier,
|
|
50
50
|
timeZone: state.timeZone
|
|
51
51
|
});
|
|
@@ -57,22 +57,22 @@ function $62cd1e80f0dffb66$export$bfd52a43017368fe(props) {
|
|
|
57
57
|
});
|
|
58
58
|
titles.push(/*#__PURE__*/ (0, $bF3AV$react).createElement("div", {
|
|
59
59
|
key: i,
|
|
60
|
-
className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))),
|
|
60
|
+
className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))), 'spectrum-Calendar-monthHeader')
|
|
61
61
|
}, i === 0 && /*#__PURE__*/ (0, $bF3AV$react).createElement((0, $bF3AV$ActionButton), {
|
|
62
62
|
...prevButtonProps,
|
|
63
|
-
UNSAFE_className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))),
|
|
63
|
+
UNSAFE_className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))), 'spectrum-Calendar-prevMonth'),
|
|
64
64
|
isQuiet: true
|
|
65
|
-
}, direction ===
|
|
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
66
|
// We have a visually hidden heading describing the entire visible range,
|
|
67
67
|
// and the calendar itself describes the individual month
|
|
68
68
|
// so we don't need to repeat that here for screen reader users.
|
|
69
69
|
"aria-hidden": true,
|
|
70
|
-
className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))),
|
|
70
|
+
className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))), 'spectrum-Calendar-title')
|
|
71
71
|
}, monthDateFormatter.format(d.toDate(state.timeZone))), i === visibleMonths - 1 && /*#__PURE__*/ (0, $bF3AV$react).createElement((0, $bF3AV$ActionButton), {
|
|
72
72
|
...nextButtonProps,
|
|
73
|
-
UNSAFE_className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))),
|
|
73
|
+
UNSAFE_className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))), 'spectrum-Calendar-nextMonth'),
|
|
74
74
|
isQuiet: true
|
|
75
|
-
}, direction ===
|
|
75
|
+
}, direction === 'rtl' ? /*#__PURE__*/ (0, $bF3AV$react).createElement((0, $bF3AV$spectrumiconsuiChevronLeftLarge), null) : /*#__PURE__*/ (0, $bF3AV$react).createElement((0, $bF3AV$spectrumiconsuiChevronRightLarge), null))));
|
|
76
76
|
calendars.push(/*#__PURE__*/ (0, $bF3AV$react).createElement((0, $faa2f3867773cfe5$export$26e2752316b9a375), {
|
|
77
77
|
...props,
|
|
78
78
|
key: i,
|
|
@@ -84,20 +84,20 @@ function $62cd1e80f0dffb66$export$bfd52a43017368fe(props) {
|
|
|
84
84
|
...styleProps,
|
|
85
85
|
...calendarProps,
|
|
86
86
|
ref: ref,
|
|
87
|
-
className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))),
|
|
88
|
-
}, /*#__PURE__*/ (0, $bF3AV$react).createElement((0, $bF3AV$VisuallyHidden), null, /*#__PURE__*/ (0, $bF3AV$react).createElement("h2", null, calendarProps[
|
|
89
|
-
className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))),
|
|
87
|
+
className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))), 'spectrum-Calendar', styleProps.className)
|
|
88
|
+
}, /*#__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", {
|
|
89
|
+
className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))), 'spectrum-Calendar-header')
|
|
90
90
|
}, titles), /*#__PURE__*/ (0, $bF3AV$react).createElement("div", {
|
|
91
|
-
className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))),
|
|
91
|
+
className: (0, $bF3AV$classNames)((0, ($parcel$interopDefault($bF3AV$calendar_vars_cssmodulejs))), 'spectrum-Calendar-months')
|
|
92
92
|
}, calendars), /*#__PURE__*/ (0, $bF3AV$react).createElement((0, $bF3AV$VisuallyHidden), null, /*#__PURE__*/ (0, $bF3AV$react).createElement("button", {
|
|
93
|
-
"aria-label": nextButtonProps[
|
|
93
|
+
"aria-label": nextButtonProps['aria-label'],
|
|
94
94
|
disabled: nextButtonProps.isDisabled,
|
|
95
95
|
onClick: ()=>state.focusNextPage(),
|
|
96
96
|
tabIndex: -1
|
|
97
97
|
})), state.isValueInvalid && /*#__PURE__*/ (0, $bF3AV$react).createElement((0, $bF3AV$HelpText), {
|
|
98
98
|
showErrorIcon: true,
|
|
99
|
-
errorMessage: props.errorMessage || stringFormatter.format(
|
|
100
|
-
selectedCount:
|
|
99
|
+
errorMessage: props.errorMessage || stringFormatter.format('invalidSelection', {
|
|
100
|
+
selectedCount: 'highlightedRange' in state ? 2 : 1
|
|
101
101
|
}),
|
|
102
102
|
errorMessageProps: errorMessageProps,
|
|
103
103
|
isInvalid: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;AA6BM,SAAS,0CAA2D,KAA2B;IACpG,IAAI,SACF,KAAK,iBACL,aAAa,mBACb,eAAe,mBACf,eAAe,qBACf,iBAAiB,EACjB,aAAa,GAAG,iBAChB,gBAAgB,GACjB,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,
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;AA6BM,SAAS,0CAA2D,KAA2B;IACpG,IAAI,SACF,KAAK,iBACL,aAAa,mBACb,eAAe,mBACf,eAAe,qBACf,iBAAiB,EACjB,aAAa,GAAG,iBAChB,gBAAgB,GACjB,GAAG;IACJ,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,oBAAY,EAAE;IACjC,IAAI,kBAAkB,CAAA,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AO,gCAAC,CAAA,GAAA,uCAAW;QAM7D,UAAU,IAAI,eACZ,gCAAC,CAAA,GAAA,yCAAY;YACV,GAAG,KAAK;YACT,KAAK;YACL,OAAO;YACP,WAAW;;IAEjB;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","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 {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>) {\n let {\n state,\n calendarProps,\n nextButtonProps,\n prevButtonProps,\n errorMessageProps,\n calendarRef: ref,\n visibleMonths = 1\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 {monthDateFormatter.format(d.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 calendars.push(\n <CalendarMonth\n {...props}\n key={i}\n state={state}\n startDate={d} />\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"],"names":[],"version":3,"file":"CalendarBase.module.js.map"}
|
|
@@ -39,7 +39,7 @@ $parcel$export(module.exports, "CalendarCell", () => $52c7c3c887827b64$export$5d
|
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
function $52c7c3c887827b64$export$5d847498420df57b({ state: state, currentMonth: currentMonth, ...props }) {
|
|
42
|
-
let ref = (0, $1NqcN$react.useRef)();
|
|
42
|
+
let ref = (0, $1NqcN$react.useRef)(null);
|
|
43
43
|
let { cellProps: cellProps, buttonProps: buttonProps, isPressed: isPressed, isSelected: isSelected, isDisabled: isDisabled, isFocused: isFocused, isInvalid: isInvalid, formattedDate: formattedDate } = (0, $1NqcN$reactariacalendar.useCalendarCell)({
|
|
44
44
|
...props,
|
|
45
45
|
isDisabled: !(0, $1NqcN$internationalizeddate.isSameMonth)(props.date, currentMonth)
|
|
@@ -51,7 +51,7 @@ function $52c7c3c887827b64$export$5d847498420df57b({ state: state, currentMonth:
|
|
|
51
51
|
let isFirstSelectedAfterDisabled = !isDisabled && !isInvalid && state.isCellUnavailable(props.date.subtract({
|
|
52
52
|
days: 1
|
|
53
53
|
}));
|
|
54
|
-
let highlightedRange =
|
|
54
|
+
let highlightedRange = 'highlightedRange' in state && state.highlightedRange;
|
|
55
55
|
let isSelectionStart = isSelected && highlightedRange && (0, $1NqcN$internationalizeddate.isSameDay)(props.date, highlightedRange.start);
|
|
56
56
|
let isSelectionEnd = isSelected && highlightedRange && (0, $1NqcN$internationalizeddate.isSameDay)(props.date, highlightedRange.end);
|
|
57
57
|
let { locale: locale } = (0, $1NqcN$reactariai18n.useLocale)();
|
|
@@ -64,30 +64,30 @@ function $52c7c3c887827b64$export$5d847498420df57b({ state: state, currentMonth:
|
|
|
64
64
|
});
|
|
65
65
|
return /*#__PURE__*/ (0, ($parcel$interopDefault($1NqcN$react))).createElement("td", {
|
|
66
66
|
...cellProps,
|
|
67
|
-
className: (0, $1NqcN$reactspectrumutils.classNames)((0, ($parcel$interopDefault($915891ae6206caad$exports))),
|
|
67
|
+
className: (0, $1NqcN$reactspectrumutils.classNames)((0, ($parcel$interopDefault($915891ae6206caad$exports))), 'spectrum-Calendar-tableCell')
|
|
68
68
|
}, /*#__PURE__*/ (0, ($parcel$interopDefault($1NqcN$react))).createElement("span", {
|
|
69
69
|
...(0, $1NqcN$reactariautils.mergeProps)(buttonProps, hoverProps, focusProps),
|
|
70
70
|
ref: ref,
|
|
71
|
-
className: (0, $1NqcN$reactspectrumutils.classNames)((0, ($parcel$interopDefault($915891ae6206caad$exports))),
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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
75
|
// Style disabled (i.e. out of min/max range), but selected dates as unavailable
|
|
76
76
|
// since it is more clear than trying to dim the selection.
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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
88
|
})
|
|
89
89
|
}, /*#__PURE__*/ (0, ($parcel$interopDefault($1NqcN$react))).createElement("span", {
|
|
90
|
-
className: (0, $1NqcN$reactspectrumutils.classNames)((0, ($parcel$interopDefault($915891ae6206caad$exports))),
|
|
90
|
+
className: (0, $1NqcN$reactspectrumutils.classNames)((0, ($parcel$interopDefault($915891ae6206caad$exports))), 'spectrum-Calendar-dateText')
|
|
91
91
|
}, /*#__PURE__*/ (0, ($parcel$interopDefault($1NqcN$react))).createElement("span", null, formattedDate))));
|
|
92
92
|
}
|
|
93
93
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AAkBM,SAAS,0CAAa,SAAC,KAAK,gBAAE,YAAY,EAAE,GAAG,OAAyB;IAC7E,IAAI,MAAM,CAAA,GAAA,mBAAK;
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AAkBM,SAAS,0CAAa,SAAC,KAAK,gBAAE,YAAY,EAAE,GAAG,OAAyB;IAC7E,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;IAC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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, {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}\n\nexport function CalendarCell({state, currentMonth, ...props}: CalendarCellProps) {\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);\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
CHANGED
|
@@ -33,7 +33,7 @@ function $parcel$interopDefault(a) {
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
function $453c556b9066da11$export$5d847498420df57b({ state: state, currentMonth: currentMonth, ...props }) {
|
|
36
|
-
let ref = (0, $1nHC4$useRef)();
|
|
36
|
+
let ref = (0, $1nHC4$useRef)(null);
|
|
37
37
|
let { cellProps: cellProps, buttonProps: buttonProps, isPressed: isPressed, isSelected: isSelected, isDisabled: isDisabled, isFocused: isFocused, isInvalid: isInvalid, formattedDate: formattedDate } = (0, $1nHC4$useCalendarCell)({
|
|
38
38
|
...props,
|
|
39
39
|
isDisabled: !(0, $1nHC4$isSameMonth)(props.date, currentMonth)
|
|
@@ -45,7 +45,7 @@ function $453c556b9066da11$export$5d847498420df57b({ state: state, currentMonth:
|
|
|
45
45
|
let isFirstSelectedAfterDisabled = !isDisabled && !isInvalid && state.isCellUnavailable(props.date.subtract({
|
|
46
46
|
days: 1
|
|
47
47
|
}));
|
|
48
|
-
let highlightedRange =
|
|
48
|
+
let highlightedRange = 'highlightedRange' in state && state.highlightedRange;
|
|
49
49
|
let isSelectionStart = isSelected && highlightedRange && (0, $1nHC4$isSameDay)(props.date, highlightedRange.start);
|
|
50
50
|
let isSelectionEnd = isSelected && highlightedRange && (0, $1nHC4$isSameDay)(props.date, highlightedRange.end);
|
|
51
51
|
let { locale: locale } = (0, $1nHC4$useLocale)();
|
|
@@ -58,33 +58,33 @@ function $453c556b9066da11$export$5d847498420df57b({ state: state, currentMonth:
|
|
|
58
58
|
});
|
|
59
59
|
return /*#__PURE__*/ (0, $1nHC4$react).createElement("td", {
|
|
60
60
|
...cellProps,
|
|
61
|
-
className: (0, $1nHC4$classNames)((0, ($parcel$interopDefault($1nHC4$calendar_vars_cssmodulejs))),
|
|
61
|
+
className: (0, $1nHC4$classNames)((0, ($parcel$interopDefault($1nHC4$calendar_vars_cssmodulejs))), 'spectrum-Calendar-tableCell')
|
|
62
62
|
}, /*#__PURE__*/ (0, $1nHC4$react).createElement("span", {
|
|
63
63
|
...(0, $1nHC4$mergeProps)(buttonProps, hoverProps, focusProps),
|
|
64
64
|
ref: ref,
|
|
65
|
-
className: (0, $1nHC4$classNames)((0, ($parcel$interopDefault($1nHC4$calendar_vars_cssmodulejs))),
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
69
|
// Style disabled (i.e. out of min/max range), but selected dates as unavailable
|
|
70
70
|
// since it is more clear than trying to dim the selection.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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
82
|
})
|
|
83
83
|
}, /*#__PURE__*/ (0, $1nHC4$react).createElement("span", {
|
|
84
|
-
className: (0, $1nHC4$classNames)((0, ($parcel$interopDefault($1nHC4$calendar_vars_cssmodulejs))),
|
|
84
|
+
className: (0, $1nHC4$classNames)((0, ($parcel$interopDefault($1nHC4$calendar_vars_cssmodulejs))), 'spectrum-Calendar-dateText')
|
|
85
85
|
}, /*#__PURE__*/ (0, $1nHC4$react).createElement("span", null, formattedDate))));
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
|
|
89
89
|
export {$453c556b9066da11$export$5d847498420df57b as CalendarCell};
|
|
90
|
-
//# sourceMappingURL=CalendarCell.
|
|
90
|
+
//# sourceMappingURL=CalendarCell.module.js.map
|