@react-aria/calendar 3.5.5 → 3.5.7
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/ar-AE.main.js +17 -0
- package/dist/ar-AE.main.js.map +1 -0
- package/dist/ar-AE.mjs +19 -0
- package/dist/ar-AE.module.js +19 -0
- package/dist/ar-AE.module.js.map +1 -0
- package/dist/bg-BG.main.js +17 -0
- package/dist/bg-BG.main.js.map +1 -0
- package/dist/bg-BG.mjs +19 -0
- package/dist/bg-BG.module.js +19 -0
- package/dist/bg-BG.module.js.map +1 -0
- package/dist/cs-CZ.main.js +17 -0
- package/dist/cs-CZ.main.js.map +1 -0
- package/dist/cs-CZ.mjs +19 -0
- package/dist/cs-CZ.module.js +19 -0
- package/dist/cs-CZ.module.js.map +1 -0
- package/dist/da-DK.main.js +17 -0
- package/dist/da-DK.main.js.map +1 -0
- package/dist/da-DK.mjs +19 -0
- package/dist/da-DK.module.js +19 -0
- package/dist/da-DK.module.js.map +1 -0
- package/dist/de-DE.main.js +17 -0
- package/dist/de-DE.main.js.map +1 -0
- package/dist/de-DE.mjs +19 -0
- package/dist/de-DE.module.js +19 -0
- package/dist/de-DE.module.js.map +1 -0
- package/dist/el-GR.main.js +17 -0
- package/dist/el-GR.main.js.map +1 -0
- package/dist/el-GR.mjs +19 -0
- package/dist/el-GR.module.js +19 -0
- package/dist/el-GR.module.js.map +1 -0
- package/dist/en-US.main.js +17 -0
- package/dist/en-US.main.js.map +1 -0
- package/dist/en-US.mjs +19 -0
- package/dist/en-US.module.js +19 -0
- package/dist/en-US.module.js.map +1 -0
- package/dist/es-ES.main.js +17 -0
- package/dist/es-ES.main.js.map +1 -0
- package/dist/es-ES.mjs +19 -0
- package/dist/es-ES.module.js +19 -0
- package/dist/es-ES.module.js.map +1 -0
- package/dist/et-EE.main.js +17 -0
- package/dist/et-EE.main.js.map +1 -0
- package/dist/et-EE.mjs +19 -0
- package/dist/et-EE.module.js +19 -0
- package/dist/et-EE.module.js.map +1 -0
- package/dist/fi-FI.main.js +17 -0
- package/dist/fi-FI.main.js.map +1 -0
- package/dist/fi-FI.mjs +19 -0
- package/dist/fi-FI.module.js +19 -0
- package/dist/fi-FI.module.js.map +1 -0
- package/dist/fr-FR.main.js +17 -0
- package/dist/fr-FR.main.js.map +1 -0
- package/dist/fr-FR.mjs +19 -0
- package/dist/fr-FR.module.js +19 -0
- package/dist/fr-FR.module.js.map +1 -0
- package/dist/he-IL.main.js +17 -0
- package/dist/he-IL.main.js.map +1 -0
- package/dist/he-IL.mjs +19 -0
- package/dist/he-IL.module.js +19 -0
- package/dist/he-IL.module.js.map +1 -0
- package/dist/hr-HR.main.js +17 -0
- package/dist/hr-HR.main.js.map +1 -0
- package/dist/hr-HR.mjs +19 -0
- package/dist/hr-HR.module.js +19 -0
- package/dist/hr-HR.module.js.map +1 -0
- package/dist/hu-HU.main.js +17 -0
- package/dist/hu-HU.main.js.map +1 -0
- package/dist/hu-HU.mjs +19 -0
- package/dist/hu-HU.module.js +19 -0
- package/dist/hu-HU.module.js.map +1 -0
- package/dist/import.mjs +4 -1288
- package/dist/intlStrings.main.js +108 -0
- package/dist/intlStrings.main.js.map +1 -0
- package/dist/intlStrings.mjs +110 -0
- package/dist/intlStrings.module.js +110 -0
- package/dist/intlStrings.module.js.map +1 -0
- package/dist/it-IT.main.js +17 -0
- package/dist/it-IT.main.js.map +1 -0
- package/dist/it-IT.mjs +19 -0
- package/dist/it-IT.module.js +19 -0
- package/dist/it-IT.module.js.map +1 -0
- package/dist/ja-JP.main.js +17 -0
- package/dist/ja-JP.main.js.map +1 -0
- package/dist/ja-JP.mjs +19 -0
- package/dist/ja-JP.module.js +19 -0
- package/dist/ja-JP.module.js.map +1 -0
- package/dist/ko-KR.main.js +17 -0
- package/dist/ko-KR.main.js.map +1 -0
- package/dist/ko-KR.mjs +19 -0
- package/dist/ko-KR.module.js +19 -0
- package/dist/ko-KR.module.js.map +1 -0
- package/dist/lt-LT.main.js +17 -0
- package/dist/lt-LT.main.js.map +1 -0
- package/dist/lt-LT.mjs +19 -0
- package/dist/lt-LT.module.js +19 -0
- package/dist/lt-LT.module.js.map +1 -0
- package/dist/lv-LV.main.js +17 -0
- package/dist/lv-LV.main.js.map +1 -0
- package/dist/lv-LV.mjs +19 -0
- package/dist/lv-LV.module.js +19 -0
- package/dist/lv-LV.module.js.map +1 -0
- package/dist/main.js +8 -1292
- package/dist/main.js.map +1 -1
- package/dist/module.js +4 -1288
- package/dist/module.js.map +1 -1
- package/dist/nb-NO.main.js +17 -0
- package/dist/nb-NO.main.js.map +1 -0
- package/dist/nb-NO.mjs +19 -0
- package/dist/nb-NO.module.js +19 -0
- package/dist/nb-NO.module.js.map +1 -0
- package/dist/nl-NL.main.js +17 -0
- package/dist/nl-NL.main.js.map +1 -0
- package/dist/nl-NL.mjs +19 -0
- package/dist/nl-NL.module.js +19 -0
- package/dist/nl-NL.module.js.map +1 -0
- package/dist/pl-PL.main.js +17 -0
- package/dist/pl-PL.main.js.map +1 -0
- package/dist/pl-PL.mjs +19 -0
- package/dist/pl-PL.module.js +19 -0
- package/dist/pl-PL.module.js.map +1 -0
- package/dist/pt-BR.main.js +17 -0
- package/dist/pt-BR.main.js.map +1 -0
- package/dist/pt-BR.mjs +19 -0
- package/dist/pt-BR.module.js +19 -0
- package/dist/pt-BR.module.js.map +1 -0
- package/dist/pt-PT.main.js +17 -0
- package/dist/pt-PT.main.js.map +1 -0
- package/dist/pt-PT.mjs +19 -0
- package/dist/pt-PT.module.js +19 -0
- package/dist/pt-PT.module.js.map +1 -0
- package/dist/ro-RO.main.js +17 -0
- package/dist/ro-RO.main.js.map +1 -0
- package/dist/ro-RO.mjs +19 -0
- package/dist/ro-RO.module.js +19 -0
- package/dist/ro-RO.module.js.map +1 -0
- package/dist/ru-RU.main.js +17 -0
- package/dist/ru-RU.main.js.map +1 -0
- package/dist/ru-RU.mjs +19 -0
- package/dist/ru-RU.module.js +19 -0
- package/dist/ru-RU.module.js.map +1 -0
- package/dist/sk-SK.main.js +17 -0
- package/dist/sk-SK.main.js.map +1 -0
- package/dist/sk-SK.mjs +19 -0
- package/dist/sk-SK.module.js +19 -0
- package/dist/sk-SK.module.js.map +1 -0
- package/dist/sl-SI.main.js +17 -0
- package/dist/sl-SI.main.js.map +1 -0
- package/dist/sl-SI.mjs +19 -0
- package/dist/sl-SI.module.js +19 -0
- package/dist/sl-SI.module.js.map +1 -0
- package/dist/sr-SP.main.js +17 -0
- package/dist/sr-SP.main.js.map +1 -0
- package/dist/sr-SP.mjs +19 -0
- package/dist/sr-SP.module.js +19 -0
- package/dist/sr-SP.module.js.map +1 -0
- package/dist/sv-SE.main.js +17 -0
- package/dist/sv-SE.main.js.map +1 -0
- package/dist/sv-SE.mjs +19 -0
- package/dist/sv-SE.module.js +19 -0
- package/dist/sv-SE.module.js.map +1 -0
- package/dist/tr-TR.main.js +17 -0
- package/dist/tr-TR.main.js.map +1 -0
- package/dist/tr-TR.mjs +19 -0
- package/dist/tr-TR.module.js +19 -0
- package/dist/tr-TR.module.js.map +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/uk-UA.main.js +17 -0
- package/dist/uk-UA.main.js.map +1 -0
- package/dist/uk-UA.mjs +19 -0
- package/dist/uk-UA.module.js +19 -0
- package/dist/uk-UA.module.js.map +1 -0
- package/dist/useCalendar.main.js +25 -0
- package/dist/useCalendar.main.js.map +1 -0
- package/dist/useCalendar.mjs +20 -0
- package/dist/useCalendar.module.js +20 -0
- package/dist/useCalendar.module.js.map +1 -0
- package/dist/useCalendarBase.main.js +112 -0
- package/dist/useCalendarBase.main.js.map +1 -0
- package/dist/useCalendarBase.mjs +107 -0
- package/dist/useCalendarBase.module.js +107 -0
- package/dist/useCalendarBase.module.js.map +1 -0
- package/dist/useCalendarCell.main.js +276 -0
- package/dist/useCalendarCell.main.js.map +1 -0
- package/dist/useCalendarCell.mjs +271 -0
- package/dist/useCalendarCell.module.js +271 -0
- package/dist/useCalendarCell.module.js.map +1 -0
- package/dist/useCalendarGrid.main.js +139 -0
- package/dist/useCalendarGrid.main.js.map +1 -0
- package/dist/useCalendarGrid.mjs +134 -0
- package/dist/useCalendarGrid.module.js +134 -0
- package/dist/useCalendarGrid.module.js.map +1 -0
- package/dist/useRangeCalendar.main.js +66 -0
- package/dist/useRangeCalendar.main.js.map +1 -0
- package/dist/useRangeCalendar.mjs +61 -0
- package/dist/useRangeCalendar.module.js +61 -0
- package/dist/useRangeCalendar.module.js.map +1 -0
- package/dist/utils.main.js +138 -0
- package/dist/utils.main.js.map +1 -0
- package/dist/utils.mjs +130 -0
- package/dist/utils.module.js +130 -0
- package/dist/utils.module.js.map +1 -0
- package/dist/zh-CN.main.js +17 -0
- package/dist/zh-CN.main.js.map +1 -0
- package/dist/zh-CN.mjs +19 -0
- package/dist/zh-CN.module.js +19 -0
- package/dist/zh-CN.module.js.map +1 -0
- package/dist/zh-TW.main.js +17 -0
- package/dist/zh-TW.main.js.map +1 -0
- package/dist/zh-TW.mjs +19 -0
- package/dist/zh-TW.module.js +19 -0
- package/dist/zh-TW.module.js.map +1 -0
- package/package.json +11 -11
- package/src/useRangeCalendar.ts +6 -5
package/dist/utils.mjs
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import $3HATx$intlStringsmodulejs from "./intlStrings.mjs";
|
|
2
|
+
import {isSameDay as $3HATx$isSameDay, startOfMonth as $3HATx$startOfMonth, endOfMonth as $3HATx$endOfMonth} from "@internationalized/date";
|
|
3
|
+
import {useLocalizedStringFormatter as $3HATx$useLocalizedStringFormatter, useDateFormatter as $3HATx$useDateFormatter} from "@react-aria/i18n";
|
|
4
|
+
import {useMemo as $3HATx$useMemo} from "react";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
function $parcel$interopDefault(a) {
|
|
8
|
+
return a && a.__esModule ? a.default : a;
|
|
9
|
+
}
|
|
10
|
+
/*
|
|
11
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
12
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
14
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
+
*
|
|
16
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
17
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
18
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
19
|
+
* governing permissions and limitations under the License.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
const $a074e1e2d0f0a665$export$653eddfc964b0f8a = new WeakMap();
|
|
25
|
+
function $a074e1e2d0f0a665$export$134cbb7fb09a9522(date) {
|
|
26
|
+
return (date === null || date === void 0 ? void 0 : date.calendar.identifier) === "gregory" && date.era === "BC" ? "short" : undefined;
|
|
27
|
+
}
|
|
28
|
+
function $a074e1e2d0f0a665$export$b6df97c887c38e1a(state) {
|
|
29
|
+
let stringFormatter = (0, $3HATx$useLocalizedStringFormatter)((0, ($parcel$interopDefault($3HATx$intlStringsmodulejs))), "@react-aria/calendar");
|
|
30
|
+
let start, end;
|
|
31
|
+
if ("highlightedRange" in state) ({ start: start, end: end } = state.highlightedRange || {});
|
|
32
|
+
else start = end = state.value;
|
|
33
|
+
let dateFormatter = (0, $3HATx$useDateFormatter)({
|
|
34
|
+
weekday: "long",
|
|
35
|
+
month: "long",
|
|
36
|
+
year: "numeric",
|
|
37
|
+
day: "numeric",
|
|
38
|
+
era: $a074e1e2d0f0a665$export$134cbb7fb09a9522(start) || $a074e1e2d0f0a665$export$134cbb7fb09a9522(end),
|
|
39
|
+
timeZone: state.timeZone
|
|
40
|
+
});
|
|
41
|
+
let anchorDate = "anchorDate" in state ? state.anchorDate : null;
|
|
42
|
+
return (0, $3HATx$useMemo)(()=>{
|
|
43
|
+
// No message if currently selecting a range, or there is nothing highlighted.
|
|
44
|
+
if (!anchorDate && start && end) {
|
|
45
|
+
// Use a single date message if the start and end dates are the same day,
|
|
46
|
+
// otherwise include both dates.
|
|
47
|
+
if ((0, $3HATx$isSameDay)(start, end)) {
|
|
48
|
+
let date = dateFormatter.format(start.toDate(state.timeZone));
|
|
49
|
+
return stringFormatter.format("selectedDateDescription", {
|
|
50
|
+
date: date
|
|
51
|
+
});
|
|
52
|
+
} else {
|
|
53
|
+
let dateRange = $a074e1e2d0f0a665$var$formatRange(dateFormatter, stringFormatter, start, end, state.timeZone);
|
|
54
|
+
return stringFormatter.format("selectedRangeDescription", {
|
|
55
|
+
dateRange: dateRange
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return "";
|
|
60
|
+
}, [
|
|
61
|
+
start,
|
|
62
|
+
end,
|
|
63
|
+
anchorDate,
|
|
64
|
+
state.timeZone,
|
|
65
|
+
stringFormatter,
|
|
66
|
+
dateFormatter
|
|
67
|
+
]);
|
|
68
|
+
}
|
|
69
|
+
function $a074e1e2d0f0a665$export$31afe65d91ef6e8(startDate, endDate, timeZone, isAria) {
|
|
70
|
+
let stringFormatter = (0, $3HATx$useLocalizedStringFormatter)((0, ($parcel$interopDefault($3HATx$intlStringsmodulejs))), "@react-aria/calendar");
|
|
71
|
+
let era = $a074e1e2d0f0a665$export$134cbb7fb09a9522(startDate) || $a074e1e2d0f0a665$export$134cbb7fb09a9522(endDate);
|
|
72
|
+
let monthFormatter = (0, $3HATx$useDateFormatter)({
|
|
73
|
+
month: "long",
|
|
74
|
+
year: "numeric",
|
|
75
|
+
era: era,
|
|
76
|
+
calendar: startDate.calendar.identifier,
|
|
77
|
+
timeZone: timeZone
|
|
78
|
+
});
|
|
79
|
+
let dateFormatter = (0, $3HATx$useDateFormatter)({
|
|
80
|
+
month: "long",
|
|
81
|
+
year: "numeric",
|
|
82
|
+
day: "numeric",
|
|
83
|
+
era: era,
|
|
84
|
+
calendar: startDate.calendar.identifier,
|
|
85
|
+
timeZone: timeZone
|
|
86
|
+
});
|
|
87
|
+
return (0, $3HATx$useMemo)(()=>{
|
|
88
|
+
// Special case for month granularity. Format as a single month if only a
|
|
89
|
+
// single month is visible, otherwise format as a range of months.
|
|
90
|
+
if ((0, $3HATx$isSameDay)(startDate, (0, $3HATx$startOfMonth)(startDate))) {
|
|
91
|
+
if ((0, $3HATx$isSameDay)(endDate, (0, $3HATx$endOfMonth)(startDate))) return monthFormatter.format(startDate.toDate(timeZone));
|
|
92
|
+
else if ((0, $3HATx$isSameDay)(endDate, (0, $3HATx$endOfMonth)(endDate))) return isAria ? $a074e1e2d0f0a665$var$formatRange(monthFormatter, stringFormatter, startDate, endDate, timeZone) : monthFormatter.formatRange(startDate.toDate(timeZone), endDate.toDate(timeZone));
|
|
93
|
+
}
|
|
94
|
+
return isAria ? $a074e1e2d0f0a665$var$formatRange(dateFormatter, stringFormatter, startDate, endDate, timeZone) : dateFormatter.formatRange(startDate.toDate(timeZone), endDate.toDate(timeZone));
|
|
95
|
+
}, [
|
|
96
|
+
startDate,
|
|
97
|
+
endDate,
|
|
98
|
+
monthFormatter,
|
|
99
|
+
dateFormatter,
|
|
100
|
+
stringFormatter,
|
|
101
|
+
timeZone,
|
|
102
|
+
isAria
|
|
103
|
+
]);
|
|
104
|
+
}
|
|
105
|
+
function $a074e1e2d0f0a665$var$formatRange(dateFormatter, stringFormatter, start, end, timeZone) {
|
|
106
|
+
let parts = dateFormatter.formatRangeToParts(start.toDate(timeZone), end.toDate(timeZone));
|
|
107
|
+
// Find the separator between the start and end date. This is determined
|
|
108
|
+
// by finding the last shared literal before the end range.
|
|
109
|
+
let separatorIndex = -1;
|
|
110
|
+
for(let i = 0; i < parts.length; i++){
|
|
111
|
+
let part = parts[i];
|
|
112
|
+
if (part.source === "shared" && part.type === "literal") separatorIndex = i;
|
|
113
|
+
else if (part.source === "endRange") break;
|
|
114
|
+
}
|
|
115
|
+
// Now we can combine the parts into start and end strings.
|
|
116
|
+
let startValue = "";
|
|
117
|
+
let endValue = "";
|
|
118
|
+
for(let i = 0; i < parts.length; i++){
|
|
119
|
+
if (i < separatorIndex) startValue += parts[i].value;
|
|
120
|
+
else if (i > separatorIndex) endValue += parts[i].value;
|
|
121
|
+
}
|
|
122
|
+
return stringFormatter.format("dateRange", {
|
|
123
|
+
startDate: startValue,
|
|
124
|
+
endDate: endValue
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
export {$a074e1e2d0f0a665$export$653eddfc964b0f8a as hookData, $a074e1e2d0f0a665$export$134cbb7fb09a9522 as getEraFormat, $a074e1e2d0f0a665$export$b6df97c887c38e1a as useSelectedDateDescription, $a074e1e2d0f0a665$export$31afe65d91ef6e8 as useVisibleRangeDescription};
|
|
130
|
+
//# sourceMappingURL=utils.mjs.map
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import $3HATx$intlStringsmodulejs from "./intlStrings.module.js";
|
|
2
|
+
import {isSameDay as $3HATx$isSameDay, startOfMonth as $3HATx$startOfMonth, endOfMonth as $3HATx$endOfMonth} from "@internationalized/date";
|
|
3
|
+
import {useLocalizedStringFormatter as $3HATx$useLocalizedStringFormatter, useDateFormatter as $3HATx$useDateFormatter} from "@react-aria/i18n";
|
|
4
|
+
import {useMemo as $3HATx$useMemo} from "react";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
function $parcel$interopDefault(a) {
|
|
8
|
+
return a && a.__esModule ? a.default : a;
|
|
9
|
+
}
|
|
10
|
+
/*
|
|
11
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
12
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
14
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
+
*
|
|
16
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
17
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
18
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
19
|
+
* governing permissions and limitations under the License.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
const $a074e1e2d0f0a665$export$653eddfc964b0f8a = new WeakMap();
|
|
25
|
+
function $a074e1e2d0f0a665$export$134cbb7fb09a9522(date) {
|
|
26
|
+
return (date === null || date === void 0 ? void 0 : date.calendar.identifier) === "gregory" && date.era === "BC" ? "short" : undefined;
|
|
27
|
+
}
|
|
28
|
+
function $a074e1e2d0f0a665$export$b6df97c887c38e1a(state) {
|
|
29
|
+
let stringFormatter = (0, $3HATx$useLocalizedStringFormatter)((0, ($parcel$interopDefault($3HATx$intlStringsmodulejs))), "@react-aria/calendar");
|
|
30
|
+
let start, end;
|
|
31
|
+
if ("highlightedRange" in state) ({ start: start, end: end } = state.highlightedRange || {});
|
|
32
|
+
else start = end = state.value;
|
|
33
|
+
let dateFormatter = (0, $3HATx$useDateFormatter)({
|
|
34
|
+
weekday: "long",
|
|
35
|
+
month: "long",
|
|
36
|
+
year: "numeric",
|
|
37
|
+
day: "numeric",
|
|
38
|
+
era: $a074e1e2d0f0a665$export$134cbb7fb09a9522(start) || $a074e1e2d0f0a665$export$134cbb7fb09a9522(end),
|
|
39
|
+
timeZone: state.timeZone
|
|
40
|
+
});
|
|
41
|
+
let anchorDate = "anchorDate" in state ? state.anchorDate : null;
|
|
42
|
+
return (0, $3HATx$useMemo)(()=>{
|
|
43
|
+
// No message if currently selecting a range, or there is nothing highlighted.
|
|
44
|
+
if (!anchorDate && start && end) {
|
|
45
|
+
// Use a single date message if the start and end dates are the same day,
|
|
46
|
+
// otherwise include both dates.
|
|
47
|
+
if ((0, $3HATx$isSameDay)(start, end)) {
|
|
48
|
+
let date = dateFormatter.format(start.toDate(state.timeZone));
|
|
49
|
+
return stringFormatter.format("selectedDateDescription", {
|
|
50
|
+
date: date
|
|
51
|
+
});
|
|
52
|
+
} else {
|
|
53
|
+
let dateRange = $a074e1e2d0f0a665$var$formatRange(dateFormatter, stringFormatter, start, end, state.timeZone);
|
|
54
|
+
return stringFormatter.format("selectedRangeDescription", {
|
|
55
|
+
dateRange: dateRange
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return "";
|
|
60
|
+
}, [
|
|
61
|
+
start,
|
|
62
|
+
end,
|
|
63
|
+
anchorDate,
|
|
64
|
+
state.timeZone,
|
|
65
|
+
stringFormatter,
|
|
66
|
+
dateFormatter
|
|
67
|
+
]);
|
|
68
|
+
}
|
|
69
|
+
function $a074e1e2d0f0a665$export$31afe65d91ef6e8(startDate, endDate, timeZone, isAria) {
|
|
70
|
+
let stringFormatter = (0, $3HATx$useLocalizedStringFormatter)((0, ($parcel$interopDefault($3HATx$intlStringsmodulejs))), "@react-aria/calendar");
|
|
71
|
+
let era = $a074e1e2d0f0a665$export$134cbb7fb09a9522(startDate) || $a074e1e2d0f0a665$export$134cbb7fb09a9522(endDate);
|
|
72
|
+
let monthFormatter = (0, $3HATx$useDateFormatter)({
|
|
73
|
+
month: "long",
|
|
74
|
+
year: "numeric",
|
|
75
|
+
era: era,
|
|
76
|
+
calendar: startDate.calendar.identifier,
|
|
77
|
+
timeZone: timeZone
|
|
78
|
+
});
|
|
79
|
+
let dateFormatter = (0, $3HATx$useDateFormatter)({
|
|
80
|
+
month: "long",
|
|
81
|
+
year: "numeric",
|
|
82
|
+
day: "numeric",
|
|
83
|
+
era: era,
|
|
84
|
+
calendar: startDate.calendar.identifier,
|
|
85
|
+
timeZone: timeZone
|
|
86
|
+
});
|
|
87
|
+
return (0, $3HATx$useMemo)(()=>{
|
|
88
|
+
// Special case for month granularity. Format as a single month if only a
|
|
89
|
+
// single month is visible, otherwise format as a range of months.
|
|
90
|
+
if ((0, $3HATx$isSameDay)(startDate, (0, $3HATx$startOfMonth)(startDate))) {
|
|
91
|
+
if ((0, $3HATx$isSameDay)(endDate, (0, $3HATx$endOfMonth)(startDate))) return monthFormatter.format(startDate.toDate(timeZone));
|
|
92
|
+
else if ((0, $3HATx$isSameDay)(endDate, (0, $3HATx$endOfMonth)(endDate))) return isAria ? $a074e1e2d0f0a665$var$formatRange(monthFormatter, stringFormatter, startDate, endDate, timeZone) : monthFormatter.formatRange(startDate.toDate(timeZone), endDate.toDate(timeZone));
|
|
93
|
+
}
|
|
94
|
+
return isAria ? $a074e1e2d0f0a665$var$formatRange(dateFormatter, stringFormatter, startDate, endDate, timeZone) : dateFormatter.formatRange(startDate.toDate(timeZone), endDate.toDate(timeZone));
|
|
95
|
+
}, [
|
|
96
|
+
startDate,
|
|
97
|
+
endDate,
|
|
98
|
+
monthFormatter,
|
|
99
|
+
dateFormatter,
|
|
100
|
+
stringFormatter,
|
|
101
|
+
timeZone,
|
|
102
|
+
isAria
|
|
103
|
+
]);
|
|
104
|
+
}
|
|
105
|
+
function $a074e1e2d0f0a665$var$formatRange(dateFormatter, stringFormatter, start, end, timeZone) {
|
|
106
|
+
let parts = dateFormatter.formatRangeToParts(start.toDate(timeZone), end.toDate(timeZone));
|
|
107
|
+
// Find the separator between the start and end date. This is determined
|
|
108
|
+
// by finding the last shared literal before the end range.
|
|
109
|
+
let separatorIndex = -1;
|
|
110
|
+
for(let i = 0; i < parts.length; i++){
|
|
111
|
+
let part = parts[i];
|
|
112
|
+
if (part.source === "shared" && part.type === "literal") separatorIndex = i;
|
|
113
|
+
else if (part.source === "endRange") break;
|
|
114
|
+
}
|
|
115
|
+
// Now we can combine the parts into start and end strings.
|
|
116
|
+
let startValue = "";
|
|
117
|
+
let endValue = "";
|
|
118
|
+
for(let i = 0; i < parts.length; i++){
|
|
119
|
+
if (i < separatorIndex) startValue += parts[i].value;
|
|
120
|
+
else if (i > separatorIndex) endValue += parts[i].value;
|
|
121
|
+
}
|
|
122
|
+
return stringFormatter.format("dateRange", {
|
|
123
|
+
startDate: startValue,
|
|
124
|
+
endDate: endValue
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
export {$a074e1e2d0f0a665$export$653eddfc964b0f8a as hookData, $a074e1e2d0f0a665$export$134cbb7fb09a9522 as getEraFormat, $a074e1e2d0f0a665$export$b6df97c887c38e1a as useSelectedDateDescription, $a074e1e2d0f0a665$export$31afe65d91ef6e8 as useVisibleRangeDescription};
|
|
130
|
+
//# sourceMappingURL=utils.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"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","sources":["packages/@react-aria/calendar/src/utils.ts"],"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 {CalendarDate, DateFormatter, endOfMonth, isSameDay, startOfMonth} from '@internationalized/date';\nimport {CalendarState, RangeCalendarState} from '@react-stately/calendar';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport type {LocalizedStringFormatter} from '@internationalized/string';\nimport {useDateFormatter, useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useMemo} from 'react';\n\ninterface HookData {\n ariaLabel: string,\n ariaLabelledBy: string,\n errorMessageId: string,\n selectedDateDescription: string\n}\n\nexport const hookData = new WeakMap<CalendarState | RangeCalendarState, HookData>();\n\nexport function getEraFormat(date: CalendarDate): 'short' | undefined {\n return date?.calendar.identifier === 'gregory' && date.era === 'BC' ? 'short' : undefined;\n}\n\nexport function useSelectedDateDescription(state: CalendarState | RangeCalendarState) {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/calendar');\n\n let start: CalendarDate, end: CalendarDate;\n if ('highlightedRange' in state) {\n ({start, end} = state.highlightedRange || {});\n } else {\n start = end = state.value;\n }\n\n let dateFormatter = useDateFormatter({\n weekday: 'long',\n month: 'long',\n year: 'numeric',\n day: 'numeric',\n era: getEraFormat(start) || getEraFormat(end),\n timeZone: state.timeZone\n });\n\n let anchorDate = 'anchorDate' in state ? state.anchorDate : null;\n return useMemo(() => {\n // No message if currently selecting a range, or there is nothing highlighted.\n if (!anchorDate && start && end) {\n // Use a single date message if the start and end dates are the same day,\n // otherwise include both dates.\n if (isSameDay(start, end)) {\n let date = dateFormatter.format(start.toDate(state.timeZone));\n return stringFormatter.format('selectedDateDescription', {date});\n } else {\n let dateRange = formatRange(dateFormatter, stringFormatter, start, end, state.timeZone);\n\n return stringFormatter.format('selectedRangeDescription', {dateRange});\n }\n }\n return '';\n }, [start, end, anchorDate, state.timeZone, stringFormatter, dateFormatter]);\n}\n\nexport function useVisibleRangeDescription(startDate: CalendarDate, endDate: CalendarDate, timeZone: string, isAria: boolean) {\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/calendar');\n let era: any = getEraFormat(startDate) || getEraFormat(endDate);\n let monthFormatter = useDateFormatter({\n month: 'long',\n year: 'numeric',\n era,\n calendar: startDate.calendar.identifier,\n timeZone\n });\n\n let dateFormatter = useDateFormatter({\n month: 'long',\n year: 'numeric',\n day: 'numeric',\n era,\n calendar: startDate.calendar.identifier,\n timeZone\n });\n\n return useMemo(() => {\n // Special case for month granularity. Format as a single month if only a\n // single month is visible, otherwise format as a range of months.\n if (isSameDay(startDate, startOfMonth(startDate))) {\n if (isSameDay(endDate, endOfMonth(startDate))) {\n return monthFormatter.format(startDate.toDate(timeZone));\n } else if (isSameDay(endDate, endOfMonth(endDate))) {\n return isAria\n ? formatRange(monthFormatter, stringFormatter, startDate, endDate, timeZone)\n : monthFormatter.formatRange(startDate.toDate(timeZone), endDate.toDate(timeZone));\n }\n }\n\n return isAria\n ? formatRange(dateFormatter, stringFormatter, startDate, endDate, timeZone)\n : dateFormatter.formatRange(startDate.toDate(timeZone), endDate.toDate(timeZone));\n }, [startDate, endDate, monthFormatter, dateFormatter, stringFormatter, timeZone, isAria]);\n}\n\nfunction formatRange(dateFormatter: DateFormatter, stringFormatter: LocalizedStringFormatter, start: CalendarDate, end: CalendarDate, timeZone: string) {\n let parts = dateFormatter.formatRangeToParts(start.toDate(timeZone), end.toDate(timeZone));\n\n // Find the separator between the start and end date. This is determined\n // by finding the last shared literal before the end range.\n let separatorIndex = -1;\n for (let i = 0; i < parts.length; i++) {\n let part = parts[i];\n if (part.source === 'shared' && part.type === 'literal') {\n separatorIndex = i;\n } else if (part.source === 'endRange') {\n break;\n }\n }\n\n // Now we can combine the parts into start and end strings.\n let startValue = '';\n let endValue = '';\n for (let i = 0; i < parts.length; i++) {\n if (i < separatorIndex) {\n startValue += parts[i].value;\n } else if (i > separatorIndex) {\n endValue += parts[i].value;\n }\n }\n\n return stringFormatter.format('dateRange', {startDate: startValue, endDate: endValue});\n}\n"],"names":[],"version":3,"file":"utils.module.js.map"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
"dateRange": (args)=>`${args.startDate} \u{81F3} ${args.endDate}`,
|
|
3
|
+
"dateSelected": (args)=>`\u{5DF2}\u{9009}\u{62E9} ${args.date}`,
|
|
4
|
+
"finishRangeSelectionPrompt": `\u{5355}\u{51FB}\u{4EE5}\u{5B8C}\u{6210}\u{9009}\u{62E9}\u{65E5}\u{671F}\u{8303}\u{56F4}`,
|
|
5
|
+
"maximumDate": `\u{6700}\u{540E}\u{4E00}\u{4E2A}\u{53EF}\u{7528}\u{65E5}\u{671F}`,
|
|
6
|
+
"minimumDate": `\u{7B2C}\u{4E00}\u{4E2A}\u{53EF}\u{7528}\u{65E5}\u{671F}`,
|
|
7
|
+
"next": `\u{4E0B}\u{4E00}\u{9875}`,
|
|
8
|
+
"previous": `\u{4E0A}\u{4E00}\u{9875}`,
|
|
9
|
+
"selectedDateDescription": (args)=>`\u{9009}\u{5B9A}\u{7684}\u{65E5}\u{671F}\u{FF1A}${args.date}`,
|
|
10
|
+
"selectedRangeDescription": (args)=>`\u{9009}\u{5B9A}\u{7684}\u{8303}\u{56F4}\u{FF1A}${args.dateRange}`,
|
|
11
|
+
"startRangeSelectionPrompt": `\u{5355}\u{51FB}\u{4EE5}\u{5F00}\u{59CB}\u{9009}\u{62E9}\u{65E5}\u{671F}\u{8303}\u{56F4}`,
|
|
12
|
+
"todayDate": (args)=>`\u{4ECA}\u{5929}\u{FF0C}\u{5373} ${args.date}`,
|
|
13
|
+
"todayDateSelected": (args)=>`\u{5DF2}\u{9009}\u{62E9}\u{4ECA}\u{5929}\u{FF0C}\u{5373} ${args.date}`
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=zh-CN.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAAA,iBAAiB;IAAG,aAAa,CAAC,OAAS,CAAC,EAAE,KAAK,SAAS,CAAC,UAAG,EAAE,KAAK,OAAO,CAAC,CAAC;IAC9E,gBAAgB,CAAC,OAAS,CAAC,yBAAI,EAAE,KAAK,IAAI,CAAC,CAAC;IAC5C,8BAA8B,CAAC,wFAAW,CAAC;IAC3C,eAAe,CAAC,gEAAQ,CAAC;IACzB,eAAe,CAAC,wDAAO,CAAC;IACxB,QAAQ,CAAC,wBAAG,CAAC;IACb,YAAY,CAAC,wBAAG,CAAC;IACjB,2BAA2B,CAAC,OAAS,CAAC,gDAAM,EAAE,KAAK,IAAI,CAAC,CAAC;IACzD,4BAA4B,CAAC,OAAS,CAAC,gDAAM,EAAE,KAAK,SAAS,CAAC,CAAC;IAC/D,6BAA6B,CAAC,wFAAW,CAAC;IAC1C,aAAa,CAAC,OAAS,CAAC,iCAAK,EAAE,KAAK,IAAI,CAAC,CAAC;IAC1C,qBAAqB,CAAC,OAAS,CAAC,yDAAQ,EAAE,KAAK,IAAI,CAAC,CAAC;AACvD","sources":["packages/@react-aria/calendar/intl/zh-CN.json"],"sourcesContent":["{\n \"dateRange\": \"{startDate} 至 {endDate}\",\n \"dateSelected\": \"已选择 {date}\",\n \"finishRangeSelectionPrompt\": \"单击以完成选择日期范围\",\n \"maximumDate\": \"最后一个可用日期\",\n \"minimumDate\": \"第一个可用日期\",\n \"next\": \"下一页\",\n \"previous\": \"上一页\",\n \"selectedDateDescription\": \"选定的日期:{date}\",\n \"selectedRangeDescription\": \"选定的范围:{dateRange}\",\n \"startRangeSelectionPrompt\": \"单击以开始选择日期范围\",\n \"todayDate\": \"今天,即 {date}\",\n \"todayDateSelected\": \"已选择今天,即 {date}\"\n}\n"],"names":[],"version":3,"file":"zh-CN.main.js.map"}
|
package/dist/zh-CN.mjs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
var $628e140a43dfb330$exports = {};
|
|
2
|
+
$628e140a43dfb330$exports = {
|
|
3
|
+
"dateRange": (args)=>`${args.startDate} \u{81F3} ${args.endDate}`,
|
|
4
|
+
"dateSelected": (args)=>`\u{5DF2}\u{9009}\u{62E9} ${args.date}`,
|
|
5
|
+
"finishRangeSelectionPrompt": `\u{5355}\u{51FB}\u{4EE5}\u{5B8C}\u{6210}\u{9009}\u{62E9}\u{65E5}\u{671F}\u{8303}\u{56F4}`,
|
|
6
|
+
"maximumDate": `\u{6700}\u{540E}\u{4E00}\u{4E2A}\u{53EF}\u{7528}\u{65E5}\u{671F}`,
|
|
7
|
+
"minimumDate": `\u{7B2C}\u{4E00}\u{4E2A}\u{53EF}\u{7528}\u{65E5}\u{671F}`,
|
|
8
|
+
"next": `\u{4E0B}\u{4E00}\u{9875}`,
|
|
9
|
+
"previous": `\u{4E0A}\u{4E00}\u{9875}`,
|
|
10
|
+
"selectedDateDescription": (args)=>`\u{9009}\u{5B9A}\u{7684}\u{65E5}\u{671F}\u{FF1A}${args.date}`,
|
|
11
|
+
"selectedRangeDescription": (args)=>`\u{9009}\u{5B9A}\u{7684}\u{8303}\u{56F4}\u{FF1A}${args.dateRange}`,
|
|
12
|
+
"startRangeSelectionPrompt": `\u{5355}\u{51FB}\u{4EE5}\u{5F00}\u{59CB}\u{9009}\u{62E9}\u{65E5}\u{671F}\u{8303}\u{56F4}`,
|
|
13
|
+
"todayDate": (args)=>`\u{4ECA}\u{5929}\u{FF0C}\u{5373} ${args.date}`,
|
|
14
|
+
"todayDateSelected": (args)=>`\u{5DF2}\u{9009}\u{62E9}\u{4ECA}\u{5929}\u{FF0C}\u{5373} ${args.date}`
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
export {$628e140a43dfb330$exports as default};
|
|
19
|
+
//# sourceMappingURL=zh-CN.mjs.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
var $628e140a43dfb330$exports = {};
|
|
2
|
+
$628e140a43dfb330$exports = {
|
|
3
|
+
"dateRange": (args)=>`${args.startDate} \u{81F3} ${args.endDate}`,
|
|
4
|
+
"dateSelected": (args)=>`\u{5DF2}\u{9009}\u{62E9} ${args.date}`,
|
|
5
|
+
"finishRangeSelectionPrompt": `\u{5355}\u{51FB}\u{4EE5}\u{5B8C}\u{6210}\u{9009}\u{62E9}\u{65E5}\u{671F}\u{8303}\u{56F4}`,
|
|
6
|
+
"maximumDate": `\u{6700}\u{540E}\u{4E00}\u{4E2A}\u{53EF}\u{7528}\u{65E5}\u{671F}`,
|
|
7
|
+
"minimumDate": `\u{7B2C}\u{4E00}\u{4E2A}\u{53EF}\u{7528}\u{65E5}\u{671F}`,
|
|
8
|
+
"next": `\u{4E0B}\u{4E00}\u{9875}`,
|
|
9
|
+
"previous": `\u{4E0A}\u{4E00}\u{9875}`,
|
|
10
|
+
"selectedDateDescription": (args)=>`\u{9009}\u{5B9A}\u{7684}\u{65E5}\u{671F}\u{FF1A}${args.date}`,
|
|
11
|
+
"selectedRangeDescription": (args)=>`\u{9009}\u{5B9A}\u{7684}\u{8303}\u{56F4}\u{FF1A}${args.dateRange}`,
|
|
12
|
+
"startRangeSelectionPrompt": `\u{5355}\u{51FB}\u{4EE5}\u{5F00}\u{59CB}\u{9009}\u{62E9}\u{65E5}\u{671F}\u{8303}\u{56F4}`,
|
|
13
|
+
"todayDate": (args)=>`\u{4ECA}\u{5929}\u{FF0C}\u{5373} ${args.date}`,
|
|
14
|
+
"todayDateSelected": (args)=>`\u{5DF2}\u{9009}\u{62E9}\u{4ECA}\u{5929}\u{FF0C}\u{5373} ${args.date}`
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
export {$628e140a43dfb330$exports as default};
|
|
19
|
+
//# sourceMappingURL=zh-CN.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";AAAA,4BAAiB;IAAG,aAAa,CAAC,OAAS,CAAC,EAAE,KAAK,SAAS,CAAC,UAAG,EAAE,KAAK,OAAO,CAAC,CAAC;IAC9E,gBAAgB,CAAC,OAAS,CAAC,yBAAI,EAAE,KAAK,IAAI,CAAC,CAAC;IAC5C,8BAA8B,CAAC,wFAAW,CAAC;IAC3C,eAAe,CAAC,gEAAQ,CAAC;IACzB,eAAe,CAAC,wDAAO,CAAC;IACxB,QAAQ,CAAC,wBAAG,CAAC;IACb,YAAY,CAAC,wBAAG,CAAC;IACjB,2BAA2B,CAAC,OAAS,CAAC,gDAAM,EAAE,KAAK,IAAI,CAAC,CAAC;IACzD,4BAA4B,CAAC,OAAS,CAAC,gDAAM,EAAE,KAAK,SAAS,CAAC,CAAC;IAC/D,6BAA6B,CAAC,wFAAW,CAAC;IAC1C,aAAa,CAAC,OAAS,CAAC,iCAAK,EAAE,KAAK,IAAI,CAAC,CAAC;IAC1C,qBAAqB,CAAC,OAAS,CAAC,yDAAQ,EAAE,KAAK,IAAI,CAAC,CAAC;AACvD","sources":["packages/@react-aria/calendar/intl/zh-CN.json"],"sourcesContent":["{\n \"dateRange\": \"{startDate} 至 {endDate}\",\n \"dateSelected\": \"已选择 {date}\",\n \"finishRangeSelectionPrompt\": \"单击以完成选择日期范围\",\n \"maximumDate\": \"最后一个可用日期\",\n \"minimumDate\": \"第一个可用日期\",\n \"next\": \"下一页\",\n \"previous\": \"上一页\",\n \"selectedDateDescription\": \"选定的日期:{date}\",\n \"selectedRangeDescription\": \"选定的范围:{dateRange}\",\n \"startRangeSelectionPrompt\": \"单击以开始选择日期范围\",\n \"todayDate\": \"今天,即 {date}\",\n \"todayDateSelected\": \"已选择今天,即 {date}\"\n}\n"],"names":[],"version":3,"file":"zh-CN.module.js.map"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
"dateRange": (args)=>`${args.startDate} \u{81F3} ${args.endDate}`,
|
|
3
|
+
"dateSelected": (args)=>`\u{5DF2}\u{9078}\u{53D6} ${args.date}`,
|
|
4
|
+
"finishRangeSelectionPrompt": `\u{6309}\u{4E00}\u{4E0B}\u{4EE5}\u{5B8C}\u{6210}\u{9078}\u{53D6}\u{65E5}\u{671F}\u{7BC4}\u{570D}`,
|
|
5
|
+
"maximumDate": `\u{6700}\u{5F8C}\u{4E00}\u{500B}\u{53EF}\u{7528}\u{65E5}\u{671F}`,
|
|
6
|
+
"minimumDate": `\u{7B2C}\u{4E00}\u{500B}\u{53EF}\u{7528}\u{65E5}\u{671F}`,
|
|
7
|
+
"next": `\u{4E0B}\u{4E00}\u{9801}`,
|
|
8
|
+
"previous": `\u{4E0A}\u{4E00}\u{9801}`,
|
|
9
|
+
"selectedDateDescription": (args)=>`\u{9078}\u{5B9A}\u{7684}\u{65E5}\u{671F}\u{FF1A}${args.date}`,
|
|
10
|
+
"selectedRangeDescription": (args)=>`\u{9078}\u{5B9A}\u{7684}\u{7BC4}\u{570D}\u{FF1A}${args.dateRange}`,
|
|
11
|
+
"startRangeSelectionPrompt": `\u{6309}\u{4E00}\u{4E0B}\u{4EE5}\u{958B}\u{59CB}\u{9078}\u{53D6}\u{65E5}\u{671F}\u{7BC4}\u{570D}`,
|
|
12
|
+
"todayDate": (args)=>`\u{4ECA}\u{5929}\u{FF0C}${args.date}`,
|
|
13
|
+
"todayDateSelected": (args)=>`\u{5DF2}\u{9078}\u{53D6}\u{4ECA}\u{5929}\u{FF0C}${args.date}`
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=zh-TW.main.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAAA,iBAAiB;IAAG,aAAa,CAAC,OAAS,CAAC,EAAE,KAAK,SAAS,CAAC,UAAG,EAAE,KAAK,OAAO,CAAC,CAAC;IAC9E,gBAAgB,CAAC,OAAS,CAAC,yBAAI,EAAE,KAAK,IAAI,CAAC,CAAC;IAC5C,8BAA8B,CAAC,gGAAY,CAAC;IAC5C,eAAe,CAAC,gEAAQ,CAAC;IACzB,eAAe,CAAC,wDAAO,CAAC;IACxB,QAAQ,CAAC,wBAAG,CAAC;IACb,YAAY,CAAC,wBAAG,CAAC;IACjB,2BAA2B,CAAC,OAAS,CAAC,gDAAM,EAAE,KAAK,IAAI,CAAC,CAAC;IACzD,4BAA4B,CAAC,OAAS,CAAC,gDAAM,EAAE,KAAK,SAAS,CAAC,CAAC;IAC/D,6BAA6B,CAAC,gGAAY,CAAC;IAC3C,aAAa,CAAC,OAAS,CAAC,wBAAG,EAAE,KAAK,IAAI,CAAC,CAAC;IACxC,qBAAqB,CAAC,OAAS,CAAC,gDAAM,EAAE,KAAK,IAAI,CAAC,CAAC;AACrD","sources":["packages/@react-aria/calendar/intl/zh-TW.json"],"sourcesContent":["{\n \"dateRange\": \"{startDate} 至 {endDate}\",\n \"dateSelected\": \"已選取 {date}\",\n \"finishRangeSelectionPrompt\": \"按一下以完成選取日期範圍\",\n \"maximumDate\": \"最後一個可用日期\",\n \"minimumDate\": \"第一個可用日期\",\n \"next\": \"下一頁\",\n \"previous\": \"上一頁\",\n \"selectedDateDescription\": \"選定的日期:{date}\",\n \"selectedRangeDescription\": \"選定的範圍:{dateRange}\",\n \"startRangeSelectionPrompt\": \"按一下以開始選取日期範圍\",\n \"todayDate\": \"今天,{date}\",\n \"todayDateSelected\": \"已選取今天,{date}\"\n}\n"],"names":[],"version":3,"file":"zh-TW.main.js.map"}
|
package/dist/zh-TW.mjs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
var $745937250cd4679c$exports = {};
|
|
2
|
+
$745937250cd4679c$exports = {
|
|
3
|
+
"dateRange": (args)=>`${args.startDate} \u{81F3} ${args.endDate}`,
|
|
4
|
+
"dateSelected": (args)=>`\u{5DF2}\u{9078}\u{53D6} ${args.date}`,
|
|
5
|
+
"finishRangeSelectionPrompt": `\u{6309}\u{4E00}\u{4E0B}\u{4EE5}\u{5B8C}\u{6210}\u{9078}\u{53D6}\u{65E5}\u{671F}\u{7BC4}\u{570D}`,
|
|
6
|
+
"maximumDate": `\u{6700}\u{5F8C}\u{4E00}\u{500B}\u{53EF}\u{7528}\u{65E5}\u{671F}`,
|
|
7
|
+
"minimumDate": `\u{7B2C}\u{4E00}\u{500B}\u{53EF}\u{7528}\u{65E5}\u{671F}`,
|
|
8
|
+
"next": `\u{4E0B}\u{4E00}\u{9801}`,
|
|
9
|
+
"previous": `\u{4E0A}\u{4E00}\u{9801}`,
|
|
10
|
+
"selectedDateDescription": (args)=>`\u{9078}\u{5B9A}\u{7684}\u{65E5}\u{671F}\u{FF1A}${args.date}`,
|
|
11
|
+
"selectedRangeDescription": (args)=>`\u{9078}\u{5B9A}\u{7684}\u{7BC4}\u{570D}\u{FF1A}${args.dateRange}`,
|
|
12
|
+
"startRangeSelectionPrompt": `\u{6309}\u{4E00}\u{4E0B}\u{4EE5}\u{958B}\u{59CB}\u{9078}\u{53D6}\u{65E5}\u{671F}\u{7BC4}\u{570D}`,
|
|
13
|
+
"todayDate": (args)=>`\u{4ECA}\u{5929}\u{FF0C}${args.date}`,
|
|
14
|
+
"todayDateSelected": (args)=>`\u{5DF2}\u{9078}\u{53D6}\u{4ECA}\u{5929}\u{FF0C}${args.date}`
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
export {$745937250cd4679c$exports as default};
|
|
19
|
+
//# sourceMappingURL=zh-TW.mjs.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
var $745937250cd4679c$exports = {};
|
|
2
|
+
$745937250cd4679c$exports = {
|
|
3
|
+
"dateRange": (args)=>`${args.startDate} \u{81F3} ${args.endDate}`,
|
|
4
|
+
"dateSelected": (args)=>`\u{5DF2}\u{9078}\u{53D6} ${args.date}`,
|
|
5
|
+
"finishRangeSelectionPrompt": `\u{6309}\u{4E00}\u{4E0B}\u{4EE5}\u{5B8C}\u{6210}\u{9078}\u{53D6}\u{65E5}\u{671F}\u{7BC4}\u{570D}`,
|
|
6
|
+
"maximumDate": `\u{6700}\u{5F8C}\u{4E00}\u{500B}\u{53EF}\u{7528}\u{65E5}\u{671F}`,
|
|
7
|
+
"minimumDate": `\u{7B2C}\u{4E00}\u{500B}\u{53EF}\u{7528}\u{65E5}\u{671F}`,
|
|
8
|
+
"next": `\u{4E0B}\u{4E00}\u{9801}`,
|
|
9
|
+
"previous": `\u{4E0A}\u{4E00}\u{9801}`,
|
|
10
|
+
"selectedDateDescription": (args)=>`\u{9078}\u{5B9A}\u{7684}\u{65E5}\u{671F}\u{FF1A}${args.date}`,
|
|
11
|
+
"selectedRangeDescription": (args)=>`\u{9078}\u{5B9A}\u{7684}\u{7BC4}\u{570D}\u{FF1A}${args.dateRange}`,
|
|
12
|
+
"startRangeSelectionPrompt": `\u{6309}\u{4E00}\u{4E0B}\u{4EE5}\u{958B}\u{59CB}\u{9078}\u{53D6}\u{65E5}\u{671F}\u{7BC4}\u{570D}`,
|
|
13
|
+
"todayDate": (args)=>`\u{4ECA}\u{5929}\u{FF0C}${args.date}`,
|
|
14
|
+
"todayDateSelected": (args)=>`\u{5DF2}\u{9078}\u{53D6}\u{4ECA}\u{5929}\u{FF0C}${args.date}`
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
export {$745937250cd4679c$exports as default};
|
|
19
|
+
//# sourceMappingURL=zh-TW.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";AAAA,4BAAiB;IAAG,aAAa,CAAC,OAAS,CAAC,EAAE,KAAK,SAAS,CAAC,UAAG,EAAE,KAAK,OAAO,CAAC,CAAC;IAC9E,gBAAgB,CAAC,OAAS,CAAC,yBAAI,EAAE,KAAK,IAAI,CAAC,CAAC;IAC5C,8BAA8B,CAAC,gGAAY,CAAC;IAC5C,eAAe,CAAC,gEAAQ,CAAC;IACzB,eAAe,CAAC,wDAAO,CAAC;IACxB,QAAQ,CAAC,wBAAG,CAAC;IACb,YAAY,CAAC,wBAAG,CAAC;IACjB,2BAA2B,CAAC,OAAS,CAAC,gDAAM,EAAE,KAAK,IAAI,CAAC,CAAC;IACzD,4BAA4B,CAAC,OAAS,CAAC,gDAAM,EAAE,KAAK,SAAS,CAAC,CAAC;IAC/D,6BAA6B,CAAC,gGAAY,CAAC;IAC3C,aAAa,CAAC,OAAS,CAAC,wBAAG,EAAE,KAAK,IAAI,CAAC,CAAC;IACxC,qBAAqB,CAAC,OAAS,CAAC,gDAAM,EAAE,KAAK,IAAI,CAAC,CAAC;AACrD","sources":["packages/@react-aria/calendar/intl/zh-TW.json"],"sourcesContent":["{\n \"dateRange\": \"{startDate} 至 {endDate}\",\n \"dateSelected\": \"已選取 {date}\",\n \"finishRangeSelectionPrompt\": \"按一下以完成選取日期範圍\",\n \"maximumDate\": \"最後一個可用日期\",\n \"minimumDate\": \"第一個可用日期\",\n \"next\": \"下一頁\",\n \"previous\": \"上一頁\",\n \"selectedDateDescription\": \"選定的日期:{date}\",\n \"selectedRangeDescription\": \"選定的範圍:{dateRange}\",\n \"startRangeSelectionPrompt\": \"按一下以開始選取日期範圍\",\n \"todayDate\": \"今天,{date}\",\n \"todayDateSelected\": \"已選取今天,{date}\"\n}\n"],"names":[],"version":3,"file":"zh-TW.module.js.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/calendar",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.7",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -22,15 +22,15 @@
|
|
|
22
22
|
"url": "https://github.com/adobe/react-spectrum"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@internationalized/date": "^3.5.
|
|
26
|
-
"@react-aria/i18n": "^3.
|
|
27
|
-
"@react-aria/interactions": "^3.21.
|
|
28
|
-
"@react-aria/live-announcer": "^3.3.
|
|
29
|
-
"@react-aria/utils": "^3.
|
|
30
|
-
"@react-stately/calendar": "^3.
|
|
31
|
-
"@react-types/button": "^3.9.
|
|
32
|
-
"@react-types/calendar": "^3.4.
|
|
33
|
-
"@react-types/shared": "^3.
|
|
25
|
+
"@internationalized/date": "^3.5.3",
|
|
26
|
+
"@react-aria/i18n": "^3.11.0",
|
|
27
|
+
"@react-aria/interactions": "^3.21.2",
|
|
28
|
+
"@react-aria/live-announcer": "^3.3.3",
|
|
29
|
+
"@react-aria/utils": "^3.24.0",
|
|
30
|
+
"@react-stately/calendar": "^3.5.0",
|
|
31
|
+
"@react-types/button": "^3.9.3",
|
|
32
|
+
"@react-types/calendar": "^3.4.5",
|
|
33
|
+
"@react-types/shared": "^3.23.0",
|
|
34
34
|
"@swc/helpers": "^0.5.0"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "f645f29edc1322153fd60af4640cbcab1d992dbd"
|
|
44
44
|
}
|
package/src/useRangeCalendar.ts
CHANGED
|
@@ -50,21 +50,22 @@ export function useRangeCalendar<T extends DateValue>(props: AriaRangeCalendarPr
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
let target = e.target as Element;
|
|
53
|
-
let body = document.getElementById(res.calendarProps.id);
|
|
54
53
|
if (
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
(!
|
|
54
|
+
ref.current &&
|
|
55
|
+
ref.current.contains(document.activeElement) &&
|
|
56
|
+
(!ref.current.contains(target) || !target.closest('button, [role="button"]'))
|
|
58
57
|
) {
|
|
59
58
|
state.selectFocusedDate();
|
|
60
59
|
}
|
|
61
60
|
};
|
|
62
61
|
|
|
63
62
|
useEvent(windowRef, 'pointerup', endDragging);
|
|
64
|
-
useEvent(windowRef, 'pointercancel', endDragging);
|
|
65
63
|
|
|
66
64
|
// Also stop range selection on blur, e.g. tabbing away from the calendar.
|
|
67
65
|
res.calendarProps.onBlur = e => {
|
|
66
|
+
if (!ref.current) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
68
69
|
if ((!e.relatedTarget || !ref.current.contains(e.relatedTarget)) && state.anchorDate) {
|
|
69
70
|
state.selectFocusedDate();
|
|
70
71
|
}
|