@react-stately/calendar 3.0.0-nightly.1409 → 3.0.0-nightly.1424
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +78 -78
- package/dist/main.js.map +1 -1
- package/dist/module.js +76 -76
- package/dist/module.js.map +1 -1
- package/package.json +8 -8
package/dist/main.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var $
|
|
2
|
-
var $
|
|
3
|
-
var $
|
|
4
|
-
var $
|
|
1
|
+
var $hEzMm$internationalizeddate = require("@internationalized/date");
|
|
2
|
+
var $hEzMm$reactstatelyutils = require("@react-stately/utils");
|
|
3
|
+
var $hEzMm$reactariai18n = require("@react-aria/i18n");
|
|
4
|
+
var $hEzMm$react = require("react");
|
|
5
5
|
|
|
6
6
|
function $parcel$exportWildcard(dest, source) {
|
|
7
7
|
Object.keys(source).forEach(function(key) {
|
|
@@ -22,35 +22,35 @@ function $parcel$exportWildcard(dest, source) {
|
|
|
22
22
|
function $parcel$export(e, n, v, s) {
|
|
23
23
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
24
24
|
}
|
|
25
|
-
var $
|
|
25
|
+
var $7a549489c00e7fe0$exports = {};
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
var $
|
|
28
|
+
var $6adad0c8536fc209$exports = {};
|
|
29
29
|
|
|
30
|
-
$parcel$export($
|
|
30
|
+
$parcel$export($6adad0c8536fc209$exports, "useCalendarState", () => $6adad0c8536fc209$export$6d095e787d2b5e1f);
|
|
31
31
|
|
|
32
|
-
function $
|
|
32
|
+
function $4301262d71f567b9$export$eac50920cf2fd59a(date, minValue, maxValue) {
|
|
33
33
|
return minValue != null && date.compare(minValue) < 0 || maxValue != null && date.compare(maxValue) > 0;
|
|
34
34
|
}
|
|
35
|
-
function $
|
|
35
|
+
function $4301262d71f567b9$export$f4a51ff076cc9a09(date, duration, locale, minValue, maxValue) {
|
|
36
36
|
let halfDuration = {
|
|
37
37
|
};
|
|
38
38
|
for(let key in duration){
|
|
39
39
|
halfDuration[key] = Math.floor(duration[key] / 2);
|
|
40
40
|
if (halfDuration[key] > 0 && duration[key] % 2 === 0) halfDuration[key]--;
|
|
41
41
|
}
|
|
42
|
-
let aligned = $
|
|
43
|
-
return $
|
|
42
|
+
let aligned = $4301262d71f567b9$export$144a00ba6044eb9(date, duration, locale).subtract(halfDuration);
|
|
43
|
+
return $4301262d71f567b9$export$5bb865b12696a77d(date, aligned, duration, locale, minValue, maxValue);
|
|
44
44
|
}
|
|
45
|
-
function $
|
|
45
|
+
function $4301262d71f567b9$export$144a00ba6044eb9(date, duration, locale, minValue, maxValue) {
|
|
46
46
|
// align to the start of the largest unit
|
|
47
47
|
let aligned = date;
|
|
48
|
-
if (duration.years) aligned = $
|
|
49
|
-
else if (duration.months) aligned = $
|
|
50
|
-
else if (duration.weeks) aligned = $
|
|
51
|
-
return $
|
|
48
|
+
if (duration.years) aligned = $hEzMm$internationalizeddate.startOfYear(date);
|
|
49
|
+
else if (duration.months) aligned = $hEzMm$internationalizeddate.startOfMonth(date);
|
|
50
|
+
else if (duration.weeks) aligned = $hEzMm$internationalizeddate.startOfWeek(date, locale);
|
|
51
|
+
return $4301262d71f567b9$export$5bb865b12696a77d(date, aligned, duration, locale, minValue, maxValue);
|
|
52
52
|
}
|
|
53
|
-
function $
|
|
53
|
+
function $4301262d71f567b9$export$530edbfc915b2b04(date, duration, locale, minValue, maxValue) {
|
|
54
54
|
let d = {
|
|
55
55
|
...duration
|
|
56
56
|
};
|
|
@@ -59,17 +59,17 @@ function $7e122b6ea38c4913$export$530edbfc915b2b04(date, duration, locale, minVa
|
|
|
59
59
|
else if (duration.weeks) d.weeks--;
|
|
60
60
|
else if (duration.months) d.months--;
|
|
61
61
|
else if (duration.years) d.years--;
|
|
62
|
-
let aligned = $
|
|
63
|
-
return $
|
|
62
|
+
let aligned = $4301262d71f567b9$export$144a00ba6044eb9(date, duration, locale).subtract(d);
|
|
63
|
+
return $4301262d71f567b9$export$5bb865b12696a77d(date, aligned, duration, locale, minValue, maxValue);
|
|
64
64
|
}
|
|
65
|
-
function $
|
|
66
|
-
if (minValue && date.compare(minValue) >= 0) aligned = $
|
|
67
|
-
if (maxValue && date.compare(maxValue) <= 0) aligned = $
|
|
65
|
+
function $4301262d71f567b9$export$5bb865b12696a77d(date, aligned, duration, locale, minValue, maxValue) {
|
|
66
|
+
if (minValue && date.compare(minValue) >= 0) aligned = $hEzMm$internationalizeddate.maxDate(aligned, $4301262d71f567b9$export$144a00ba6044eb9($hEzMm$internationalizeddate.toCalendarDate(minValue), duration, locale));
|
|
67
|
+
if (maxValue && date.compare(maxValue) <= 0) aligned = $hEzMm$internationalizeddate.minDate(aligned, $4301262d71f567b9$export$530edbfc915b2b04($hEzMm$internationalizeddate.toCalendarDate(maxValue), duration, locale));
|
|
68
68
|
return aligned;
|
|
69
69
|
}
|
|
70
|
-
function $
|
|
71
|
-
if (minValue) date = $
|
|
72
|
-
if (maxValue) date = $
|
|
70
|
+
function $4301262d71f567b9$export$4f5203c0d889109e(date, minValue, maxValue) {
|
|
71
|
+
if (minValue) date = $hEzMm$internationalizeddate.maxDate(date, $hEzMm$internationalizeddate.toCalendarDate(minValue));
|
|
72
|
+
if (maxValue) date = $hEzMm$internationalizeddate.minDate(date, $hEzMm$internationalizeddate.toCalendarDate(maxValue));
|
|
73
73
|
return date;
|
|
74
74
|
}
|
|
75
75
|
|
|
@@ -78,32 +78,32 @@ function $7e122b6ea38c4913$export$4f5203c0d889109e(date, minValue, maxValue) {
|
|
|
78
78
|
|
|
79
79
|
|
|
80
80
|
|
|
81
|
-
function $
|
|
82
|
-
let defaultFormatter = $
|
|
83
|
-
let resolvedOptions = $
|
|
81
|
+
function $6adad0c8536fc209$export$6d095e787d2b5e1f(props) {
|
|
82
|
+
let defaultFormatter = $hEzMm$reactariai18n.useDateFormatter();
|
|
83
|
+
let resolvedOptions = $hEzMm$react.useMemo(()=>defaultFormatter.resolvedOptions()
|
|
84
84
|
, [
|
|
85
85
|
defaultFormatter
|
|
86
86
|
]);
|
|
87
87
|
let { locale: locale , createCalendar: createCalendar , visibleDuration: visibleDuration = {
|
|
88
88
|
months: 1
|
|
89
89
|
} , minValue: minValue , maxValue: maxValue , selectionAlignment: selectionAlignment } = props;
|
|
90
|
-
let calendar = $
|
|
90
|
+
let calendar = $hEzMm$react.useMemo(()=>createCalendar(resolvedOptions.calendar)
|
|
91
91
|
, [
|
|
92
92
|
createCalendar,
|
|
93
93
|
resolvedOptions.calendar
|
|
94
94
|
]);
|
|
95
|
-
let [value, setControlledValue] = $
|
|
96
|
-
let calendarDateValue = $
|
|
95
|
+
let [value, setControlledValue] = $hEzMm$reactstatelyutils.useControlledState(props.value, props.defaultValue, props.onChange);
|
|
96
|
+
let calendarDateValue = $hEzMm$react.useMemo(()=>value ? $hEzMm$internationalizeddate.toCalendar($hEzMm$internationalizeddate.toCalendarDate(value), calendar) : null
|
|
97
97
|
, [
|
|
98
98
|
value,
|
|
99
99
|
calendar
|
|
100
100
|
]);
|
|
101
|
-
let timeZone = $
|
|
101
|
+
let timeZone = $hEzMm$react.useMemo(()=>value && 'timeZone' in value ? value.timeZone : resolvedOptions.timeZone
|
|
102
102
|
, [
|
|
103
103
|
value,
|
|
104
104
|
resolvedOptions.timeZone
|
|
105
105
|
]);
|
|
106
|
-
let defaultDate = $
|
|
106
|
+
let defaultDate = $hEzMm$react.useMemo(()=>calendarDateValue || $4301262d71f567b9$export$4f5203c0d889109e($hEzMm$internationalizeddate.toCalendar($hEzMm$internationalizeddate.today(timeZone), calendar), minValue, maxValue)
|
|
107
107
|
, [
|
|
108
108
|
calendarDateValue,
|
|
109
109
|
timeZone,
|
|
@@ -111,20 +111,20 @@ function $f61c34523ac023ce$export$6d095e787d2b5e1f(props) {
|
|
|
111
111
|
minValue,
|
|
112
112
|
maxValue
|
|
113
113
|
]);
|
|
114
|
-
let [startDate, setStartDate] = $
|
|
114
|
+
let [startDate, setStartDate] = $hEzMm$react.useState(()=>{
|
|
115
115
|
switch(selectionAlignment){
|
|
116
116
|
case 'start':
|
|
117
|
-
return $
|
|
117
|
+
return $4301262d71f567b9$export$144a00ba6044eb9(defaultDate, visibleDuration, locale, minValue, maxValue);
|
|
118
118
|
case 'end':
|
|
119
|
-
return $
|
|
119
|
+
return $4301262d71f567b9$export$530edbfc915b2b04(defaultDate, visibleDuration, locale, minValue, maxValue);
|
|
120
120
|
case 'center':
|
|
121
121
|
default:
|
|
122
|
-
return $
|
|
122
|
+
return $4301262d71f567b9$export$f4a51ff076cc9a09(defaultDate, visibleDuration, locale, minValue, maxValue);
|
|
123
123
|
}
|
|
124
124
|
});
|
|
125
|
-
let [focusedDate, setFocusedDate] = $
|
|
126
|
-
let [isFocused, setFocused] = $
|
|
127
|
-
let endDate = $
|
|
125
|
+
let [focusedDate, setFocusedDate] = $hEzMm$react.useState(defaultDate);
|
|
126
|
+
let [isFocused, setFocused] = $hEzMm$react.useState(props.autoFocus || false);
|
|
127
|
+
let endDate = $hEzMm$react.useMemo(()=>startDate.add(visibleDuration).subtract({
|
|
128
128
|
days: 1
|
|
129
129
|
})
|
|
130
130
|
, [
|
|
@@ -132,11 +132,11 @@ function $f61c34523ac023ce$export$6d095e787d2b5e1f(props) {
|
|
|
132
132
|
visibleDuration
|
|
133
133
|
]);
|
|
134
134
|
// Reset focused date and visible range when calendar changes.
|
|
135
|
-
let lastCalendarIdentifier = $
|
|
136
|
-
$
|
|
135
|
+
let lastCalendarIdentifier = $hEzMm$react.useRef(calendar.identifier);
|
|
136
|
+
$hEzMm$react.useEffect(()=>{
|
|
137
137
|
if (calendar.identifier !== lastCalendarIdentifier.current) {
|
|
138
|
-
let newFocusedDate = $
|
|
139
|
-
setStartDate($
|
|
138
|
+
let newFocusedDate = $hEzMm$internationalizeddate.toCalendar(focusedDate, calendar);
|
|
139
|
+
setStartDate($4301262d71f567b9$export$f4a51ff076cc9a09(newFocusedDate, visibleDuration, locale, minValue, maxValue));
|
|
140
140
|
setFocusedDate(newFocusedDate);
|
|
141
141
|
lastCalendarIdentifier.current = calendar.identifier;
|
|
142
142
|
}
|
|
@@ -151,17 +151,17 @@ function $f61c34523ac023ce$export$6d095e787d2b5e1f(props) {
|
|
|
151
151
|
// Sets focus to a specific cell date
|
|
152
152
|
function focusCell(date) {
|
|
153
153
|
// date = constrain(focusedDate, date, visibleDuration, locale, minValue, maxValue);
|
|
154
|
-
date = $
|
|
154
|
+
date = $4301262d71f567b9$export$4f5203c0d889109e(date, minValue, maxValue);
|
|
155
155
|
let next = startDate.add(visibleDuration);
|
|
156
|
-
if (date.compare(startDate) < 0) setStartDate($
|
|
157
|
-
else if (date.compare(next) >= 0) setStartDate($
|
|
156
|
+
if (date.compare(startDate) < 0) setStartDate($4301262d71f567b9$export$530edbfc915b2b04(date, visibleDuration, locale, minValue, maxValue));
|
|
157
|
+
else if (date.compare(next) >= 0) setStartDate($4301262d71f567b9$export$144a00ba6044eb9(date, visibleDuration, locale, minValue, maxValue));
|
|
158
158
|
setFocusedDate(date);
|
|
159
159
|
}
|
|
160
160
|
function setValue(newValue) {
|
|
161
161
|
if (!props.isDisabled && !props.isReadOnly) {
|
|
162
162
|
// The display calendar should not have any effect on the emitted value.
|
|
163
163
|
// Emit dates in the same calendar as the original value, if any, otherwise gregorian.
|
|
164
|
-
newValue = $
|
|
164
|
+
newValue = $hEzMm$internationalizeddate.toCalendar(newValue, (value === null || value === void 0 ? void 0 : value.calendar) || new $hEzMm$internationalizeddate.GregorianCalendar());
|
|
165
165
|
// Preserve time if the input value had one.
|
|
166
166
|
if (value && 'hour' in value) setControlledValue(value.set(newValue));
|
|
167
167
|
else setControlledValue(newValue);
|
|
@@ -206,13 +206,13 @@ function $f61c34523ac023ce$export$6d095e787d2b5e1f(props) {
|
|
|
206
206
|
},
|
|
207
207
|
focusNextPage () {
|
|
208
208
|
let start = startDate.add(visibleDuration);
|
|
209
|
-
setStartDate($
|
|
210
|
-
setFocusedDate($
|
|
209
|
+
setStartDate($4301262d71f567b9$export$5bb865b12696a77d(focusedDate, start, visibleDuration, locale, minValue, maxValue));
|
|
210
|
+
setFocusedDate($4301262d71f567b9$export$4f5203c0d889109e(focusedDate.add(visibleDuration), minValue, maxValue));
|
|
211
211
|
},
|
|
212
212
|
focusPreviousPage () {
|
|
213
213
|
let start = startDate.subtract(visibleDuration);
|
|
214
|
-
setStartDate($
|
|
215
|
-
setFocusedDate($
|
|
214
|
+
setStartDate($4301262d71f567b9$export$5bb865b12696a77d(focusedDate, start, visibleDuration, locale, minValue, maxValue));
|
|
215
|
+
setFocusedDate($4301262d71f567b9$export$4f5203c0d889109e(focusedDate.subtract(visibleDuration), minValue, maxValue));
|
|
216
216
|
},
|
|
217
217
|
focusPageStart () {
|
|
218
218
|
focusCell(startDate);
|
|
@@ -247,24 +247,24 @@ function $f61c34523ac023ce$export$6d095e787d2b5e1f(props) {
|
|
|
247
247
|
isFocused: isFocused,
|
|
248
248
|
setFocused: setFocused,
|
|
249
249
|
isInvalid (date) {
|
|
250
|
-
return $
|
|
250
|
+
return $4301262d71f567b9$export$eac50920cf2fd59a(date, minValue, maxValue);
|
|
251
251
|
},
|
|
252
252
|
isSelected (date) {
|
|
253
|
-
return calendarDateValue != null && $
|
|
253
|
+
return calendarDateValue != null && $hEzMm$internationalizeddate.isSameDay(date, calendarDateValue);
|
|
254
254
|
},
|
|
255
255
|
isCellFocused (date) {
|
|
256
|
-
return isFocused && focusedDate && $
|
|
256
|
+
return isFocused && focusedDate && $hEzMm$internationalizeddate.isSameDay(date, focusedDate);
|
|
257
257
|
},
|
|
258
258
|
isCellDisabled (date) {
|
|
259
|
-
return props.isDisabled || date.compare(startDate) < 0 || date.compare(endDate) > 0 || $
|
|
259
|
+
return props.isDisabled || date.compare(startDate) < 0 || date.compare(endDate) > 0 || $4301262d71f567b9$export$eac50920cf2fd59a(date, minValue, maxValue);
|
|
260
260
|
},
|
|
261
261
|
isPreviousVisibleRangeInvalid () {
|
|
262
|
-
return $
|
|
262
|
+
return $4301262d71f567b9$export$eac50920cf2fd59a(startDate.subtract({
|
|
263
263
|
days: 1
|
|
264
264
|
}), minValue, maxValue);
|
|
265
265
|
},
|
|
266
266
|
isNextVisibleRangeInvalid () {
|
|
267
|
-
return $
|
|
267
|
+
return $4301262d71f567b9$export$eac50920cf2fd59a(endDate.add({
|
|
268
268
|
days: 1
|
|
269
269
|
}), minValue, maxValue);
|
|
270
270
|
}
|
|
@@ -272,29 +272,29 @@ function $f61c34523ac023ce$export$6d095e787d2b5e1f(props) {
|
|
|
272
272
|
}
|
|
273
273
|
|
|
274
274
|
|
|
275
|
-
var $
|
|
275
|
+
var $e49f7b861e5e8049$exports = {};
|
|
276
276
|
|
|
277
|
-
$parcel$export($
|
|
277
|
+
$parcel$export($e49f7b861e5e8049$exports, "useRangeCalendarState", () => $e49f7b861e5e8049$export$9a987164d97ecc90);
|
|
278
278
|
|
|
279
279
|
|
|
280
280
|
|
|
281
281
|
|
|
282
282
|
|
|
283
|
-
function $
|
|
283
|
+
function $e49f7b861e5e8049$export$9a987164d97ecc90(props) {
|
|
284
284
|
let { value: valueProp , defaultValue: defaultValue , onChange: onChange , createCalendar: createCalendar , locale: locale , visibleDuration: visibleDuration = {
|
|
285
285
|
months: 1
|
|
286
286
|
} , minValue: minValue , maxValue: maxValue , ...calendarProps } = props;
|
|
287
|
-
let [value, setValue] = $
|
|
288
|
-
let [anchorDate, setAnchorDate] = $
|
|
287
|
+
let [value, setValue] = $hEzMm$reactstatelyutils.useControlledState(valueProp, defaultValue, onChange);
|
|
288
|
+
let [anchorDate, setAnchorDate] = $hEzMm$react.useState(null);
|
|
289
289
|
let alignment = 'center';
|
|
290
290
|
if (value && value.start && value.end) {
|
|
291
|
-
let start = $
|
|
291
|
+
let start = $4301262d71f567b9$export$f4a51ff076cc9a09($hEzMm$internationalizeddate.toCalendarDate(value.start), visibleDuration, locale, minValue, maxValue);
|
|
292
292
|
let end = start.add(visibleDuration).subtract({
|
|
293
293
|
days: 1
|
|
294
294
|
});
|
|
295
295
|
if (value.end.compare(end) > 0) alignment = 'start';
|
|
296
296
|
}
|
|
297
|
-
let calendar = $
|
|
297
|
+
let calendar = $6adad0c8536fc209$export$6d095e787d2b5e1f({
|
|
298
298
|
...calendarProps,
|
|
299
299
|
value: value && value.start,
|
|
300
300
|
createCalendar: createCalendar,
|
|
@@ -304,20 +304,20 @@ function $794e8b1784854410$export$9a987164d97ecc90(props) {
|
|
|
304
304
|
maxValue: maxValue,
|
|
305
305
|
selectionAlignment: alignment
|
|
306
306
|
});
|
|
307
|
-
let highlightedRange = anchorDate ? $
|
|
307
|
+
let highlightedRange = anchorDate ? $e49f7b861e5e8049$var$makeRange(anchorDate, calendar.focusedDate) : value && $e49f7b861e5e8049$var$makeRange(value.start, value.end);
|
|
308
308
|
let selectDate = (date)=>{
|
|
309
309
|
if (props.isReadOnly) return;
|
|
310
310
|
if (!anchorDate) setAnchorDate(date);
|
|
311
311
|
else {
|
|
312
|
-
let range = $
|
|
312
|
+
let range = $e49f7b861e5e8049$var$makeRange(anchorDate, date);
|
|
313
313
|
setValue({
|
|
314
|
-
start: $
|
|
315
|
-
end: $
|
|
314
|
+
start: $e49f7b861e5e8049$var$convertValue(range.start, value === null || value === void 0 ? void 0 : value.start),
|
|
315
|
+
end: $e49f7b861e5e8049$var$convertValue(range.end, value === null || value === void 0 ? void 0 : value.end)
|
|
316
316
|
});
|
|
317
317
|
setAnchorDate(null);
|
|
318
318
|
}
|
|
319
319
|
};
|
|
320
|
-
let [isDragging, setDragging] = $
|
|
320
|
+
let [isDragging, setDragging] = $hEzMm$react.useState(false);
|
|
321
321
|
return {
|
|
322
322
|
...calendar,
|
|
323
323
|
value: value,
|
|
@@ -339,30 +339,30 @@ function $794e8b1784854410$export$9a987164d97ecc90(props) {
|
|
|
339
339
|
setDragging: setDragging
|
|
340
340
|
};
|
|
341
341
|
}
|
|
342
|
-
function $
|
|
342
|
+
function $e49f7b861e5e8049$var$makeRange(start, end) {
|
|
343
343
|
if (!start || !end) return null;
|
|
344
344
|
if (end.compare(start) < 0) [start, end] = [
|
|
345
345
|
end,
|
|
346
346
|
start
|
|
347
347
|
];
|
|
348
348
|
return {
|
|
349
|
-
start: $
|
|
350
|
-
end: $
|
|
349
|
+
start: $hEzMm$internationalizeddate.toCalendarDate(start),
|
|
350
|
+
end: $hEzMm$internationalizeddate.toCalendarDate(end)
|
|
351
351
|
};
|
|
352
352
|
}
|
|
353
|
-
function $
|
|
353
|
+
function $e49f7b861e5e8049$var$convertValue(newValue, oldValue) {
|
|
354
354
|
// The display calendar should not have any effect on the emitted value.
|
|
355
355
|
// Emit dates in the same calendar as the original value, if any, otherwise gregorian.
|
|
356
|
-
newValue = $
|
|
356
|
+
newValue = $hEzMm$internationalizeddate.toCalendar(newValue, (oldValue === null || oldValue === void 0 ? void 0 : oldValue.calendar) || new $hEzMm$internationalizeddate.GregorianCalendar());
|
|
357
357
|
// Preserve time if the input value had one.
|
|
358
358
|
if (oldValue && 'hour' in oldValue) return oldValue.set(newValue);
|
|
359
359
|
return newValue;
|
|
360
360
|
}
|
|
361
361
|
|
|
362
362
|
|
|
363
|
-
$parcel$exportWildcard(module.exports, $
|
|
364
|
-
$parcel$exportWildcard(module.exports, $
|
|
365
|
-
$parcel$exportWildcard(module.exports, $
|
|
363
|
+
$parcel$exportWildcard(module.exports, $7a549489c00e7fe0$exports);
|
|
364
|
+
$parcel$exportWildcard(module.exports, $6adad0c8536fc209$exports);
|
|
365
|
+
$parcel$exportWildcard(module.exports, $e49f7b861e5e8049$exports);
|
|
366
366
|
|
|
367
367
|
|
|
368
368
|
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SGuBgB,yCAAS,CAAC,IAAkB,EAAE,QAAmB,EAAE,QAAmB,EAAE,CAAC;IACvF,MAAM,CAAE,QAAQ,IAAI,IAAI,IAAI,IAAI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AC,IAAI;IAGb,EAAE,EAAE,GAAG,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,GACvB,KAAK,EAAE,GAAG,IAAI,CAAC;QAAA,GAAG;QAAE,KAAK;IAAA,CAAC;IAG7B,MAAM,CAAC,CAAC;QAAA,KAAK,EAAE,2CAAc,CAAC,KAAK;QAAG,GAAG,EAAE,2CAAc,CAAC,GAAG;IAAC,CAAC;AACjE,CAAC;SAEQ,kCAAY,CAAC,QAAsB,EAAE,QAAmB,EAAE,CAAC;IAClE,EAAwE,AAAxE,sEAAwE;IACxE,EAAsF,AAAtF,oFAAsF;IACtF,QAAQ,GAAG,uCAAU,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,IAAI,GAAG,CAAC,8CAAiB;IAE3E,EAA4C,AAA5C,0CAA4C;IAC5C,EAAE,EAAE,QAAQ,IAAI,CAAM,SAAI,QAAQ,EAChC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ;IAG9B,MAAM,CAAC,QAAQ;AACjB,CAAC;;","sources":["packages/@react-stately/calendar/src/index.ts","packages/@react-stately/calendar/src/types.ts","packages/@react-stately/calendar/src/useCalendarState.ts","packages/@react-stately/calendar/src/utils.ts","packages/@react-stately/calendar/src/useRangeCalendarState.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\nexport * from './types';\nexport * from './useCalendarState';\nexport * from './useRangeCalendarState';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CalendarDate} from '@internationalized/date';\nimport {DateValue} from '@react-types/calendar';\nimport {RangeValue} from '@react-types/shared';\n\nexport interface CalendarStateBase {\n isDisabled: boolean,\n isReadOnly: boolean,\n visibleRange: RangeValue<CalendarDate>,\n timeZone: string,\n focusedDate: CalendarDate,\n setFocusedDate(value: CalendarDate): void,\n focusNextDay(): void,\n focusPreviousDay(): void,\n focusNextRow(): void,\n focusPreviousRow(): void,\n focusNextPage(): void,\n focusPreviousPage(): void,\n focusPageStart(): void,\n focusPageEnd(): void,\n focusNextSection(): void,\n focusPreviousSection(): void,\n focusNextPage(): void,\n focusPreviousPage(): void,\n selectFocusedDate(): void,\n selectDate(date: CalendarDate): void,\n isFocused: boolean,\n setFocused(value: boolean): void,\n isInvalid(date: CalendarDate): boolean,\n isSelected(date: CalendarDate): boolean,\n isCellFocused(date: CalendarDate): boolean,\n isCellDisabled(date: CalendarDate): boolean,\n isPreviousVisibleRangeInvalid(): boolean,\n isNextVisibleRangeInvalid(): boolean\n}\n\nexport interface CalendarState extends CalendarStateBase {\n value: CalendarDate,\n setValue(value: CalendarDate): void\n}\n\nexport interface RangeCalendarState extends CalendarStateBase {\n value: RangeValue<DateValue>,\n setValue(value: RangeValue<DateValue>): void,\n highlightDate(date: CalendarDate): void,\n anchorDate: CalendarDate | null,\n setAnchorDate(date: CalendarDate | null): void,\n highlightedRange: RangeValue<CalendarDate>,\n isDragging: boolean,\n setDragging(isDragging: boolean): void\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {alignCenter, alignEnd, alignStart, constrainStart, constrainValue, isInvalid} from './utils';\nimport {\n Calendar,\n CalendarDate,\n Duration,\n GregorianCalendar,\n isSameDay,\n toCalendar,\n toCalendarDate,\n today\n} from '@internationalized/date';\nimport {CalendarProps, DateValue} from '@react-types/calendar';\nimport {CalendarState} from './types';\nimport {useControlledState} from '@react-stately/utils';\nimport {useDateFormatter} from '@react-aria/i18n';\nimport {useEffect, useMemo, useRef, useState} from 'react';\n\ninterface CalendarStateOptions<T extends DateValue> extends CalendarProps<T> {\n locale: string,\n createCalendar: (name: string) => Calendar,\n visibleDuration?: Duration,\n selectionAlignment?: 'start' | 'center' | 'end'\n}\n\nexport function useCalendarState<T extends DateValue>(props: CalendarStateOptions<T>): CalendarState {\n let defaultFormatter = useDateFormatter();\n let resolvedOptions = useMemo(() => defaultFormatter.resolvedOptions(), [defaultFormatter]);\n let {\n locale,\n createCalendar,\n visibleDuration = {months: 1},\n minValue,\n maxValue,\n selectionAlignment\n } = props;\n\n let calendar = useMemo(() => createCalendar(resolvedOptions.calendar), [createCalendar, resolvedOptions.calendar]);\n\n let [value, setControlledValue] = useControlledState<DateValue>(props.value, props.defaultValue, props.onChange);\n let calendarDateValue = useMemo(() => value ? toCalendar(toCalendarDate(value), calendar) : null, [value, calendar]);\n let timeZone = useMemo(() => value && 'timeZone' in value ? value.timeZone : resolvedOptions.timeZone, [value, resolvedOptions.timeZone]);\n let defaultDate = useMemo(() => calendarDateValue || constrainValue(toCalendar(today(timeZone), calendar), minValue, maxValue), [calendarDateValue, timeZone, calendar, minValue, maxValue]);\n let [startDate, setStartDate] = useState(() => {\n switch (selectionAlignment) {\n case 'start':\n return alignStart(defaultDate, visibleDuration, locale, minValue, maxValue);\n case 'end':\n return alignEnd(defaultDate, visibleDuration, locale, minValue, maxValue);\n case 'center':\n default:\n return alignCenter(defaultDate, visibleDuration, locale, minValue, maxValue);\n }\n });\n let [focusedDate, setFocusedDate] = useState(defaultDate);\n let [isFocused, setFocused] = useState(props.autoFocus || false);\n\n let endDate = useMemo(() => startDate.add(visibleDuration).subtract({days: 1}), [startDate, visibleDuration]);\n\n // Reset focused date and visible range when calendar changes.\n let lastCalendarIdentifier = useRef(calendar.identifier);\n useEffect(() => {\n if (calendar.identifier !== lastCalendarIdentifier.current) {\n let newFocusedDate = toCalendar(focusedDate, calendar);\n setStartDate(alignCenter(newFocusedDate, visibleDuration, locale, minValue, maxValue));\n setFocusedDate(newFocusedDate);\n lastCalendarIdentifier.current = calendar.identifier;\n }\n }, [calendar, focusedDate, visibleDuration, locale, minValue, maxValue]);\n\n // Sets focus to a specific cell date\n function focusCell(date: CalendarDate) {\n // date = constrain(focusedDate, date, visibleDuration, locale, minValue, maxValue);\n date = constrainValue(date, minValue, maxValue);\n\n let next = startDate.add(visibleDuration);\n if (date.compare(startDate) < 0) {\n setStartDate(alignEnd(date, visibleDuration, locale, minValue, maxValue));\n } else if (date.compare(next) >= 0) {\n setStartDate(alignStart(date, visibleDuration, locale, minValue, maxValue));\n }\n\n setFocusedDate(date);\n }\n\n function setValue(newValue: CalendarDate) {\n if (!props.isDisabled && !props.isReadOnly) {\n // The display calendar should not have any effect on the emitted value.\n // Emit dates in the same calendar as the original value, if any, otherwise gregorian.\n newValue = toCalendar(newValue, value?.calendar || new GregorianCalendar());\n\n // Preserve time if the input value had one.\n if (value && 'hour' in value) {\n setControlledValue(value.set(newValue));\n } else {\n setControlledValue(newValue);\n }\n }\n }\n\n return {\n isDisabled: props.isDisabled,\n isReadOnly: props.isReadOnly,\n value: calendarDateValue,\n setValue,\n visibleRange: {\n start: startDate,\n end: endDate\n },\n focusedDate,\n timeZone,\n setFocusedDate(date) {\n setFocusedDate(date);\n setFocused(true);\n },\n focusNextDay() {\n focusCell(focusedDate.add({days: 1}));\n },\n focusPreviousDay() {\n focusCell(focusedDate.subtract({days: 1}));\n },\n focusNextRow() {\n if (visibleDuration.days) {\n this.focusNextPage();\n } else if (visibleDuration.weeks || visibleDuration.months || visibleDuration.years) {\n focusCell(focusedDate.add({weeks: 1}));\n }\n },\n focusPreviousRow() {\n if (visibleDuration.days) {\n this.focusPreviousPage();\n } else if (visibleDuration.weeks || visibleDuration.months || visibleDuration.years) {\n focusCell(focusedDate.subtract({weeks: 1}));\n }\n },\n focusNextPage() {\n let start = startDate.add(visibleDuration);\n setStartDate(constrainStart(focusedDate, start, visibleDuration, locale, minValue, maxValue));\n setFocusedDate(constrainValue(focusedDate.add(visibleDuration), minValue, maxValue));\n },\n focusPreviousPage() {\n let start = startDate.subtract(visibleDuration);\n setStartDate(constrainStart(focusedDate, start, visibleDuration, locale, minValue, maxValue));\n setFocusedDate(constrainValue(focusedDate.subtract(visibleDuration), minValue, maxValue));\n },\n focusPageStart() {\n focusCell(startDate);\n },\n focusPageEnd() {\n focusCell(endDate);\n },\n focusNextSection() {\n if (visibleDuration.days) {\n this.focusNextPage();\n } else if (visibleDuration.weeks) {\n focusCell(focusedDate.add({months: 1}));\n } else if (visibleDuration.months || visibleDuration.years) {\n focusCell(focusedDate.add({years: 1}));\n }\n },\n focusPreviousSection() {\n if (visibleDuration.days) {\n this.focusPreviousPage();\n } else if (visibleDuration.weeks) {\n focusCell(focusedDate.subtract({months: 1}));\n } else if (visibleDuration.months || visibleDuration.years) {\n focusCell(focusedDate.subtract({years: 1}));\n }\n },\n selectFocusedDate() {\n setValue(focusedDate);\n },\n selectDate(date) {\n setValue(date);\n },\n isFocused,\n setFocused,\n isInvalid(date) {\n return isInvalid(date, minValue, maxValue);\n },\n isSelected(date) {\n return calendarDateValue != null && isSameDay(date, calendarDateValue);\n },\n isCellFocused(date) {\n return isFocused && focusedDate && isSameDay(date, focusedDate);\n },\n isCellDisabled(date) {\n return props.isDisabled || date.compare(startDate) < 0 || date.compare(endDate) > 0 || isInvalid(date, minValue, maxValue);\n },\n isPreviousVisibleRangeInvalid() {\n return isInvalid(startDate.subtract({days: 1}), minValue, maxValue);\n },\n isNextVisibleRangeInvalid() {\n return isInvalid(endDate.add({days: 1}), minValue, maxValue);\n }\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport {\n CalendarDate,\n Duration,\n maxDate,\n minDate,\n startOfMonth,\n startOfWeek,\n startOfYear,\n toCalendarDate\n} from '@internationalized/date';\nimport {DateValue} from '@react-types/calendar';\n\nexport function isInvalid(date: CalendarDate, minValue: DateValue, maxValue: DateValue) {\n return (minValue != null && date.compare(minValue) < 0) ||\n (maxValue != null && date.compare(maxValue) > 0);\n}\n\nexport function alignCenter(date: CalendarDate, duration: Duration, locale: string, minValue?: DateValue, maxValue?: DateValue) {\n let halfDuration: Duration = {};\n for (let key in duration) {\n halfDuration[key] = Math.floor(duration[key] / 2);\n if (halfDuration[key] > 0 && duration[key] % 2 === 0) {\n halfDuration[key]--;\n }\n }\n\n let aligned = alignStart(date, duration, locale).subtract(halfDuration);\n return constrainStart(date, aligned, duration, locale, minValue, maxValue);\n}\n\nexport function alignStart(date: CalendarDate, duration: Duration, locale: string, minValue?: DateValue, maxValue?: DateValue) {\n // align to the start of the largest unit\n let aligned = date;\n if (duration.years) {\n aligned = startOfYear(date);\n } else if (duration.months) {\n aligned = startOfMonth(date);\n } else if (duration.weeks) {\n aligned = startOfWeek(date, locale);\n }\n\n return constrainStart(date, aligned, duration, locale, minValue, maxValue);\n}\n\nexport function alignEnd(date: CalendarDate, duration: Duration, locale: string, minValue?: DateValue, maxValue?: DateValue) {\n let d = {...duration};\n // subtract 1 from the smallest unit\n if (duration.days) {\n d.days--;\n } else if (duration.weeks) {\n d.weeks--;\n } else if (duration.months) {\n d.months--;\n } else if (duration.years) {\n d.years--;\n }\n\n let aligned = alignStart(date, duration, locale).subtract(d);\n return constrainStart(date, aligned, duration, locale, minValue, maxValue);\n}\n\nexport function constrainStart(\n date: CalendarDate,\n aligned: CalendarDate,\n duration: Duration,\n locale: string,\n minValue: DateValue,\n maxValue: DateValue) {\n if (minValue && date.compare(minValue) >= 0) {\n aligned = maxDate(\n aligned,\n alignStart(toCalendarDate(minValue), duration, locale)\n );\n }\n\n if (maxValue && date.compare(maxValue) <= 0) {\n aligned = minDate(\n aligned,\n alignEnd(toCalendarDate(maxValue), duration, locale)\n );\n }\n\n return aligned;\n}\n\nexport function constrainValue(date: CalendarDate, minValue: DateValue, maxValue: DateValue) {\n if (minValue) {\n date = maxDate(date, toCalendarDate(minValue));\n }\n\n if (maxValue) {\n date = minDate(date, toCalendarDate(maxValue));\n }\n\n return date;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {alignCenter} from './utils';\nimport {Calendar, CalendarDate, Duration, GregorianCalendar, toCalendar, toCalendarDate} from '@internationalized/date';\nimport {DateRange, DateValue} from '@react-types/calendar';\nimport {RangeCalendarProps} from '@react-types/calendar';\nimport {RangeCalendarState} from './types';\nimport {RangeValue} from '@react-types/shared';\nimport {useCalendarState} from './useCalendarState';\nimport {useControlledState} from '@react-stately/utils';\nimport {useState} from 'react';\n\ninterface RangeCalendarStateOptions<T extends DateValue> extends RangeCalendarProps<T> {\n locale: string,\n createCalendar: (name: string) => Calendar,\n visibleDuration?: Duration\n}\n\nexport function useRangeCalendarState<T extends DateValue>(props: RangeCalendarStateOptions<T>): RangeCalendarState {\n let {value: valueProp, defaultValue, onChange, createCalendar, locale, visibleDuration = {months: 1}, minValue, maxValue, ...calendarProps} = props;\n let [value, setValue] = useControlledState<DateRange>(\n valueProp,\n defaultValue,\n onChange\n );\n\n let [anchorDate, setAnchorDate] = useState(null);\n let alignment: 'center' | 'start' = 'center';\n if (value && value.start && value.end) {\n let start = alignCenter(toCalendarDate(value.start), visibleDuration, locale, minValue, maxValue);\n let end = start.add(visibleDuration).subtract({days: 1});\n\n if (value.end.compare(end) > 0) {\n alignment = 'start';\n }\n }\n\n let calendar = useCalendarState({\n ...calendarProps,\n value: value && value.start,\n createCalendar,\n locale,\n visibleDuration,\n minValue,\n maxValue,\n selectionAlignment: alignment\n });\n\n let highlightedRange = anchorDate ? makeRange(anchorDate, calendar.focusedDate) : value && makeRange(value.start, value.end);\n let selectDate = (date: CalendarDate) => {\n if (props.isReadOnly) {\n return;\n }\n\n if (!anchorDate) {\n setAnchorDate(date);\n } else {\n let range = makeRange(anchorDate, date);\n setValue({\n start: convertValue(range.start, value?.start),\n end: convertValue(range.end, value?.end)\n });\n setAnchorDate(null);\n }\n };\n\n let [isDragging, setDragging] = useState(false);\n\n return {\n ...calendar,\n value,\n setValue,\n anchorDate,\n setAnchorDate,\n highlightedRange,\n selectFocusedDate() {\n selectDate(calendar.focusedDate);\n },\n selectDate,\n highlightDate(date) {\n if (anchorDate) {\n calendar.setFocusedDate(date);\n }\n },\n isSelected(date) {\n return highlightedRange && date.compare(highlightedRange.start) >= 0 && date.compare(highlightedRange.end) <= 0;\n },\n isDragging,\n setDragging\n };\n}\n\nfunction makeRange(start: DateValue, end: DateValue): RangeValue<CalendarDate> {\n if (!start || !end) {\n return null;\n }\n\n if (end.compare(start) < 0) {\n [start, end] = [end, start];\n }\n\n return {start: toCalendarDate(start), end: toCalendarDate(end)};\n}\n\nfunction convertValue(newValue: CalendarDate, oldValue: DateValue) {\n // The display calendar should not have any effect on the emitted value.\n // Emit dates in the same calendar as the original value, if any, otherwise gregorian.\n newValue = toCalendar(newValue, oldValue?.calendar || new GregorianCalendar());\n\n // Preserve time if the input value had one.\n if (oldValue && 'hour' in oldValue) {\n return oldValue.set(newValue);\n }\n\n return newValue;\n}\n"],"names":[],"version":3,"file":"main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SGuBgB,yCAAS,CAAC,IAAkB,EAAE,QAAmB,EAAE,QAAmB,EAAE,CAAC;IACvF,MAAM,CAAE,QAAQ,IAAI,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,CAAC,IACnD,QAAQ,IAAI,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,CAAC;AACnD,CAAC;SAEe,yCAAW,CAAC,IAAkB,EAAE,QAAkB,EAAE,MAAc,EAAE,QAAoB,EAAE,QAAoB,EAAE,CAAC;IAC/H,GAAG,CAAC,YAAY,GAAa,CAAC;IAAA,CAAC;IAC/B,GAAG,CAAE,GAAG,CAAC,GAAG,IAAI,QAAQ,CAAE,CAAC;QACzB,YAAY,CAAC,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;QAChD,EAAE,EAAE,YAAY,CAAC,GAAG,IAAI,CAAC,IAAI,QAAQ,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,EAClD,YAAY,CAAC,GAAG;IAEpB,CAAC;IAED,GAAG,CAAC,OAAO,GAAG,wCAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,YAAY;IACtE,MAAM,CAAC,yCAAc,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ;AAC3E,CA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GAAG,CAAC,8CAAiB;IAE3E,EAA4C,AAA5C,0CAA4C;IAC5C,EAAE,EAAE,QAAQ,IAAI,CAAM,SAAI,QAAQ,EAChC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ;IAG9B,MAAM,CAAC,QAAQ;AACjB,CAAC;;","sources":["packages/@react-stately/calendar/src/index.ts","packages/@react-stately/calendar/src/types.ts","packages/@react-stately/calendar/src/useCalendarState.ts","packages/@react-stately/calendar/src/utils.ts","packages/@react-stately/calendar/src/useRangeCalendarState.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\nexport * from './types';\nexport * from './useCalendarState';\nexport * from './useRangeCalendarState';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CalendarDate} from '@internationalized/date';\nimport {DateValue} from '@react-types/calendar';\nimport {RangeValue} from '@react-types/shared';\n\nexport interface CalendarStateBase {\n isDisabled: boolean,\n isReadOnly: boolean,\n visibleRange: RangeValue<CalendarDate>,\n timeZone: string,\n focusedDate: CalendarDate,\n setFocusedDate(value: CalendarDate): void,\n focusNextDay(): void,\n focusPreviousDay(): void,\n focusNextRow(): void,\n focusPreviousRow(): void,\n focusNextPage(): void,\n focusPreviousPage(): void,\n focusPageStart(): void,\n focusPageEnd(): void,\n focusNextSection(): void,\n focusPreviousSection(): void,\n focusNextPage(): void,\n focusPreviousPage(): void,\n selectFocusedDate(): void,\n selectDate(date: CalendarDate): void,\n isFocused: boolean,\n setFocused(value: boolean): void,\n isInvalid(date: CalendarDate): boolean,\n isSelected(date: CalendarDate): boolean,\n isCellFocused(date: CalendarDate): boolean,\n isCellDisabled(date: CalendarDate): boolean,\n isPreviousVisibleRangeInvalid(): boolean,\n isNextVisibleRangeInvalid(): boolean\n}\n\nexport interface CalendarState extends CalendarStateBase {\n value: CalendarDate,\n setValue(value: CalendarDate): void\n}\n\nexport interface RangeCalendarState extends CalendarStateBase {\n value: RangeValue<DateValue>,\n setValue(value: RangeValue<DateValue>): void,\n highlightDate(date: CalendarDate): void,\n anchorDate: CalendarDate | null,\n setAnchorDate(date: CalendarDate | null): void,\n highlightedRange: RangeValue<CalendarDate>,\n isDragging: boolean,\n setDragging(isDragging: boolean): void\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {alignCenter, alignEnd, alignStart, constrainStart, constrainValue, isInvalid} from './utils';\nimport {\n Calendar,\n CalendarDate,\n Duration,\n GregorianCalendar,\n isSameDay,\n toCalendar,\n toCalendarDate,\n today\n} from '@internationalized/date';\nimport {CalendarProps, DateValue} from '@react-types/calendar';\nimport {CalendarState} from './types';\nimport {useControlledState} from '@react-stately/utils';\nimport {useDateFormatter} from '@react-aria/i18n';\nimport {useEffect, useMemo, useRef, useState} from 'react';\n\ninterface CalendarStateOptions<T extends DateValue> extends CalendarProps<T> {\n locale: string,\n createCalendar: (name: string) => Calendar,\n visibleDuration?: Duration,\n selectionAlignment?: 'start' | 'center' | 'end'\n}\n\nexport function useCalendarState<T extends DateValue>(props: CalendarStateOptions<T>): CalendarState {\n let defaultFormatter = useDateFormatter();\n let resolvedOptions = useMemo(() => defaultFormatter.resolvedOptions(), [defaultFormatter]);\n let {\n locale,\n createCalendar,\n visibleDuration = {months: 1},\n minValue,\n maxValue,\n selectionAlignment\n } = props;\n\n let calendar = useMemo(() => createCalendar(resolvedOptions.calendar), [createCalendar, resolvedOptions.calendar]);\n\n let [value, setControlledValue] = useControlledState<DateValue>(props.value, props.defaultValue, props.onChange);\n let calendarDateValue = useMemo(() => value ? toCalendar(toCalendarDate(value), calendar) : null, [value, calendar]);\n let timeZone = useMemo(() => value && 'timeZone' in value ? value.timeZone : resolvedOptions.timeZone, [value, resolvedOptions.timeZone]);\n let defaultDate = useMemo(() => calendarDateValue || constrainValue(toCalendar(today(timeZone), calendar), minValue, maxValue), [calendarDateValue, timeZone, calendar, minValue, maxValue]);\n let [startDate, setStartDate] = useState(() => {\n switch (selectionAlignment) {\n case 'start':\n return alignStart(defaultDate, visibleDuration, locale, minValue, maxValue);\n case 'end':\n return alignEnd(defaultDate, visibleDuration, locale, minValue, maxValue);\n case 'center':\n default:\n return alignCenter(defaultDate, visibleDuration, locale, minValue, maxValue);\n }\n });\n let [focusedDate, setFocusedDate] = useState(defaultDate);\n let [isFocused, setFocused] = useState(props.autoFocus || false);\n\n let endDate = useMemo(() => startDate.add(visibleDuration).subtract({days: 1}), [startDate, visibleDuration]);\n\n // Reset focused date and visible range when calendar changes.\n let lastCalendarIdentifier = useRef(calendar.identifier);\n useEffect(() => {\n if (calendar.identifier !== lastCalendarIdentifier.current) {\n let newFocusedDate = toCalendar(focusedDate, calendar);\n setStartDate(alignCenter(newFocusedDate, visibleDuration, locale, minValue, maxValue));\n setFocusedDate(newFocusedDate);\n lastCalendarIdentifier.current = calendar.identifier;\n }\n }, [calendar, focusedDate, visibleDuration, locale, minValue, maxValue]);\n\n // Sets focus to a specific cell date\n function focusCell(date: CalendarDate) {\n // date = constrain(focusedDate, date, visibleDuration, locale, minValue, maxValue);\n date = constrainValue(date, minValue, maxValue);\n\n let next = startDate.add(visibleDuration);\n if (date.compare(startDate) < 0) {\n setStartDate(alignEnd(date, visibleDuration, locale, minValue, maxValue));\n } else if (date.compare(next) >= 0) {\n setStartDate(alignStart(date, visibleDuration, locale, minValue, maxValue));\n }\n\n setFocusedDate(date);\n }\n\n function setValue(newValue: CalendarDate) {\n if (!props.isDisabled && !props.isReadOnly) {\n // The display calendar should not have any effect on the emitted value.\n // Emit dates in the same calendar as the original value, if any, otherwise gregorian.\n newValue = toCalendar(newValue, value?.calendar || new GregorianCalendar());\n\n // Preserve time if the input value had one.\n if (value && 'hour' in value) {\n setControlledValue(value.set(newValue));\n } else {\n setControlledValue(newValue);\n }\n }\n }\n\n return {\n isDisabled: props.isDisabled,\n isReadOnly: props.isReadOnly,\n value: calendarDateValue,\n setValue,\n visibleRange: {\n start: startDate,\n end: endDate\n },\n focusedDate,\n timeZone,\n setFocusedDate(date) {\n setFocusedDate(date);\n setFocused(true);\n },\n focusNextDay() {\n focusCell(focusedDate.add({days: 1}));\n },\n focusPreviousDay() {\n focusCell(focusedDate.subtract({days: 1}));\n },\n focusNextRow() {\n if (visibleDuration.days) {\n this.focusNextPage();\n } else if (visibleDuration.weeks || visibleDuration.months || visibleDuration.years) {\n focusCell(focusedDate.add({weeks: 1}));\n }\n },\n focusPreviousRow() {\n if (visibleDuration.days) {\n this.focusPreviousPage();\n } else if (visibleDuration.weeks || visibleDuration.months || visibleDuration.years) {\n focusCell(focusedDate.subtract({weeks: 1}));\n }\n },\n focusNextPage() {\n let start = startDate.add(visibleDuration);\n setStartDate(constrainStart(focusedDate, start, visibleDuration, locale, minValue, maxValue));\n setFocusedDate(constrainValue(focusedDate.add(visibleDuration), minValue, maxValue));\n },\n focusPreviousPage() {\n let start = startDate.subtract(visibleDuration);\n setStartDate(constrainStart(focusedDate, start, visibleDuration, locale, minValue, maxValue));\n setFocusedDate(constrainValue(focusedDate.subtract(visibleDuration), minValue, maxValue));\n },\n focusPageStart() {\n focusCell(startDate);\n },\n focusPageEnd() {\n focusCell(endDate);\n },\n focusNextSection() {\n if (visibleDuration.days) {\n this.focusNextPage();\n } else if (visibleDuration.weeks) {\n focusCell(focusedDate.add({months: 1}));\n } else if (visibleDuration.months || visibleDuration.years) {\n focusCell(focusedDate.add({years: 1}));\n }\n },\n focusPreviousSection() {\n if (visibleDuration.days) {\n this.focusPreviousPage();\n } else if (visibleDuration.weeks) {\n focusCell(focusedDate.subtract({months: 1}));\n } else if (visibleDuration.months || visibleDuration.years) {\n focusCell(focusedDate.subtract({years: 1}));\n }\n },\n selectFocusedDate() {\n setValue(focusedDate);\n },\n selectDate(date) {\n setValue(date);\n },\n isFocused,\n setFocused,\n isInvalid(date) {\n return isInvalid(date, minValue, maxValue);\n },\n isSelected(date) {\n return calendarDateValue != null && isSameDay(date, calendarDateValue);\n },\n isCellFocused(date) {\n return isFocused && focusedDate && isSameDay(date, focusedDate);\n },\n isCellDisabled(date) {\n return props.isDisabled || date.compare(startDate) < 0 || date.compare(endDate) > 0 || isInvalid(date, minValue, maxValue);\n },\n isPreviousVisibleRangeInvalid() {\n return isInvalid(startDate.subtract({days: 1}), minValue, maxValue);\n },\n isNextVisibleRangeInvalid() {\n return isInvalid(endDate.add({days: 1}), minValue, maxValue);\n }\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport {\n CalendarDate,\n Duration,\n maxDate,\n minDate,\n startOfMonth,\n startOfWeek,\n startOfYear,\n toCalendarDate\n} from '@internationalized/date';\nimport {DateValue} from '@react-types/calendar';\n\nexport function isInvalid(date: CalendarDate, minValue: DateValue, maxValue: DateValue) {\n return (minValue != null && date.compare(minValue) < 0) ||\n (maxValue != null && date.compare(maxValue) > 0);\n}\n\nexport function alignCenter(date: CalendarDate, duration: Duration, locale: string, minValue?: DateValue, maxValue?: DateValue) {\n let halfDuration: Duration = {};\n for (let key in duration) {\n halfDuration[key] = Math.floor(duration[key] / 2);\n if (halfDuration[key] > 0 && duration[key] % 2 === 0) {\n halfDuration[key]--;\n }\n }\n\n let aligned = alignStart(date, duration, locale).subtract(halfDuration);\n return constrainStart(date, aligned, duration, locale, minValue, maxValue);\n}\n\nexport function alignStart(date: CalendarDate, duration: Duration, locale: string, minValue?: DateValue, maxValue?: DateValue) {\n // align to the start of the largest unit\n let aligned = date;\n if (duration.years) {\n aligned = startOfYear(date);\n } else if (duration.months) {\n aligned = startOfMonth(date);\n } else if (duration.weeks) {\n aligned = startOfWeek(date, locale);\n }\n\n return constrainStart(date, aligned, duration, locale, minValue, maxValue);\n}\n\nexport function alignEnd(date: CalendarDate, duration: Duration, locale: string, minValue?: DateValue, maxValue?: DateValue) {\n let d = {...duration};\n // subtract 1 from the smallest unit\n if (duration.days) {\n d.days--;\n } else if (duration.weeks) {\n d.weeks--;\n } else if (duration.months) {\n d.months--;\n } else if (duration.years) {\n d.years--;\n }\n\n let aligned = alignStart(date, duration, locale).subtract(d);\n return constrainStart(date, aligned, duration, locale, minValue, maxValue);\n}\n\nexport function constrainStart(\n date: CalendarDate,\n aligned: CalendarDate,\n duration: Duration,\n locale: string,\n minValue: DateValue,\n maxValue: DateValue) {\n if (minValue && date.compare(minValue) >= 0) {\n aligned = maxDate(\n aligned,\n alignStart(toCalendarDate(minValue), duration, locale)\n );\n }\n\n if (maxValue && date.compare(maxValue) <= 0) {\n aligned = minDate(\n aligned,\n alignEnd(toCalendarDate(maxValue), duration, locale)\n );\n }\n\n return aligned;\n}\n\nexport function constrainValue(date: CalendarDate, minValue: DateValue, maxValue: DateValue) {\n if (minValue) {\n date = maxDate(date, toCalendarDate(minValue));\n }\n\n if (maxValue) {\n date = minDate(date, toCalendarDate(maxValue));\n }\n\n return date;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {alignCenter} from './utils';\nimport {Calendar, CalendarDate, Duration, GregorianCalendar, toCalendar, toCalendarDate} from '@internationalized/date';\nimport {DateRange, DateValue} from '@react-types/calendar';\nimport {RangeCalendarProps} from '@react-types/calendar';\nimport {RangeCalendarState} from './types';\nimport {RangeValue} from '@react-types/shared';\nimport {useCalendarState} from './useCalendarState';\nimport {useControlledState} from '@react-stately/utils';\nimport {useState} from 'react';\n\ninterface RangeCalendarStateOptions<T extends DateValue> extends RangeCalendarProps<T> {\n locale: string,\n createCalendar: (name: string) => Calendar,\n visibleDuration?: Duration\n}\n\nexport function useRangeCalendarState<T extends DateValue>(props: RangeCalendarStateOptions<T>): RangeCalendarState {\n let {value: valueProp, defaultValue, onChange, createCalendar, locale, visibleDuration = {months: 1}, minValue, maxValue, ...calendarProps} = props;\n let [value, setValue] = useControlledState<DateRange>(\n valueProp,\n defaultValue,\n onChange\n );\n\n let [anchorDate, setAnchorDate] = useState(null);\n let alignment: 'center' | 'start' = 'center';\n if (value && value.start && value.end) {\n let start = alignCenter(toCalendarDate(value.start), visibleDuration, locale, minValue, maxValue);\n let end = start.add(visibleDuration).subtract({days: 1});\n\n if (value.end.compare(end) > 0) {\n alignment = 'start';\n }\n }\n\n let calendar = useCalendarState({\n ...calendarProps,\n value: value && value.start,\n createCalendar,\n locale,\n visibleDuration,\n minValue,\n maxValue,\n selectionAlignment: alignment\n });\n\n let highlightedRange = anchorDate ? makeRange(anchorDate, calendar.focusedDate) : value && makeRange(value.start, value.end);\n let selectDate = (date: CalendarDate) => {\n if (props.isReadOnly) {\n return;\n }\n\n if (!anchorDate) {\n setAnchorDate(date);\n } else {\n let range = makeRange(anchorDate, date);\n setValue({\n start: convertValue(range.start, value?.start),\n end: convertValue(range.end, value?.end)\n });\n setAnchorDate(null);\n }\n };\n\n let [isDragging, setDragging] = useState(false);\n\n return {\n ...calendar,\n value,\n setValue,\n anchorDate,\n setAnchorDate,\n highlightedRange,\n selectFocusedDate() {\n selectDate(calendar.focusedDate);\n },\n selectDate,\n highlightDate(date) {\n if (anchorDate) {\n calendar.setFocusedDate(date);\n }\n },\n isSelected(date) {\n return highlightedRange && date.compare(highlightedRange.start) >= 0 && date.compare(highlightedRange.end) <= 0;\n },\n isDragging,\n setDragging\n };\n}\n\nfunction makeRange(start: DateValue, end: DateValue): RangeValue<CalendarDate> {\n if (!start || !end) {\n return null;\n }\n\n if (end.compare(start) < 0) {\n [start, end] = [end, start];\n }\n\n return {start: toCalendarDate(start), end: toCalendarDate(end)};\n}\n\nfunction convertValue(newValue: CalendarDate, oldValue: DateValue) {\n // The display calendar should not have any effect on the emitted value.\n // Emit dates in the same calendar as the original value, if any, otherwise gregorian.\n newValue = toCalendar(newValue, oldValue?.calendar || new GregorianCalendar());\n\n // Preserve time if the input value had one.\n if (oldValue && 'hour' in oldValue) {\n return oldValue.set(newValue);\n }\n\n return newValue;\n}\n"],"names":[],"version":3,"file":"main.js.map"}
|
package/dist/module.js
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import {toCalendar as $
|
|
2
|
-
import {useControlledState as $
|
|
3
|
-
import {useDateFormatter as $
|
|
4
|
-
import {useMemo as $
|
|
1
|
+
import {toCalendar as $keQhS$toCalendar, toCalendarDate as $keQhS$toCalendarDate, today as $keQhS$today, GregorianCalendar as $keQhS$GregorianCalendar, isSameDay as $keQhS$isSameDay, startOfYear as $keQhS$startOfYear, startOfMonth as $keQhS$startOfMonth, startOfWeek as $keQhS$startOfWeek, maxDate as $keQhS$maxDate, minDate as $keQhS$minDate} from "@internationalized/date";
|
|
2
|
+
import {useControlledState as $keQhS$useControlledState} from "@react-stately/utils";
|
|
3
|
+
import {useDateFormatter as $keQhS$useDateFormatter} from "@react-aria/i18n";
|
|
4
|
+
import {useMemo as $keQhS$useMemo, useState as $keQhS$useState, useRef as $keQhS$useRef, useEffect as $keQhS$useEffect} from "react";
|
|
5
5
|
|
|
6
6
|
function $parcel$export(e, n, v, s) {
|
|
7
7
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
8
8
|
}
|
|
9
|
-
var $
|
|
9
|
+
var $77b8da46fac7b53e$exports = {};
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var $
|
|
12
|
+
var $131cf43a05231e1e$exports = {};
|
|
13
13
|
|
|
14
|
-
$parcel$export($
|
|
14
|
+
$parcel$export($131cf43a05231e1e$exports, "useCalendarState", () => $131cf43a05231e1e$export$6d095e787d2b5e1f);
|
|
15
15
|
|
|
16
|
-
function $
|
|
16
|
+
function $f62d864046160412$export$eac50920cf2fd59a(date, minValue, maxValue) {
|
|
17
17
|
return minValue != null && date.compare(minValue) < 0 || maxValue != null && date.compare(maxValue) > 0;
|
|
18
18
|
}
|
|
19
|
-
function $
|
|
19
|
+
function $f62d864046160412$export$f4a51ff076cc9a09(date, duration, locale, minValue, maxValue) {
|
|
20
20
|
let halfDuration = {
|
|
21
21
|
};
|
|
22
22
|
for(let key in duration){
|
|
23
23
|
halfDuration[key] = Math.floor(duration[key] / 2);
|
|
24
24
|
if (halfDuration[key] > 0 && duration[key] % 2 === 0) halfDuration[key]--;
|
|
25
25
|
}
|
|
26
|
-
let aligned = $
|
|
27
|
-
return $
|
|
26
|
+
let aligned = $f62d864046160412$export$144a00ba6044eb9(date, duration, locale).subtract(halfDuration);
|
|
27
|
+
return $f62d864046160412$export$5bb865b12696a77d(date, aligned, duration, locale, minValue, maxValue);
|
|
28
28
|
}
|
|
29
|
-
function $
|
|
29
|
+
function $f62d864046160412$export$144a00ba6044eb9(date, duration, locale, minValue, maxValue) {
|
|
30
30
|
// align to the start of the largest unit
|
|
31
31
|
let aligned = date;
|
|
32
|
-
if (duration.years) aligned = $
|
|
33
|
-
else if (duration.months) aligned = $
|
|
34
|
-
else if (duration.weeks) aligned = $
|
|
35
|
-
return $
|
|
32
|
+
if (duration.years) aligned = $keQhS$startOfYear(date);
|
|
33
|
+
else if (duration.months) aligned = $keQhS$startOfMonth(date);
|
|
34
|
+
else if (duration.weeks) aligned = $keQhS$startOfWeek(date, locale);
|
|
35
|
+
return $f62d864046160412$export$5bb865b12696a77d(date, aligned, duration, locale, minValue, maxValue);
|
|
36
36
|
}
|
|
37
|
-
function $
|
|
37
|
+
function $f62d864046160412$export$530edbfc915b2b04(date, duration, locale, minValue, maxValue) {
|
|
38
38
|
let d = {
|
|
39
39
|
...duration
|
|
40
40
|
};
|
|
@@ -43,17 +43,17 @@ function $e8a61e762628fc7e$export$530edbfc915b2b04(date, duration, locale, minVa
|
|
|
43
43
|
else if (duration.weeks) d.weeks--;
|
|
44
44
|
else if (duration.months) d.months--;
|
|
45
45
|
else if (duration.years) d.years--;
|
|
46
|
-
let aligned = $
|
|
47
|
-
return $
|
|
46
|
+
let aligned = $f62d864046160412$export$144a00ba6044eb9(date, duration, locale).subtract(d);
|
|
47
|
+
return $f62d864046160412$export$5bb865b12696a77d(date, aligned, duration, locale, minValue, maxValue);
|
|
48
48
|
}
|
|
49
|
-
function $
|
|
50
|
-
if (minValue && date.compare(minValue) >= 0) aligned = $
|
|
51
|
-
if (maxValue && date.compare(maxValue) <= 0) aligned = $
|
|
49
|
+
function $f62d864046160412$export$5bb865b12696a77d(date, aligned, duration, locale, minValue, maxValue) {
|
|
50
|
+
if (minValue && date.compare(minValue) >= 0) aligned = $keQhS$maxDate(aligned, $f62d864046160412$export$144a00ba6044eb9($keQhS$toCalendarDate(minValue), duration, locale));
|
|
51
|
+
if (maxValue && date.compare(maxValue) <= 0) aligned = $keQhS$minDate(aligned, $f62d864046160412$export$530edbfc915b2b04($keQhS$toCalendarDate(maxValue), duration, locale));
|
|
52
52
|
return aligned;
|
|
53
53
|
}
|
|
54
|
-
function $
|
|
55
|
-
if (minValue) date = $
|
|
56
|
-
if (maxValue) date = $
|
|
54
|
+
function $f62d864046160412$export$4f5203c0d889109e(date, minValue, maxValue) {
|
|
55
|
+
if (minValue) date = $keQhS$maxDate(date, $keQhS$toCalendarDate(minValue));
|
|
56
|
+
if (maxValue) date = $keQhS$minDate(date, $keQhS$toCalendarDate(maxValue));
|
|
57
57
|
return date;
|
|
58
58
|
}
|
|
59
59
|
|
|
@@ -62,32 +62,32 @@ function $e8a61e762628fc7e$export$4f5203c0d889109e(date, minValue, maxValue) {
|
|
|
62
62
|
|
|
63
63
|
|
|
64
64
|
|
|
65
|
-
function $
|
|
66
|
-
let defaultFormatter = $
|
|
67
|
-
let resolvedOptions = $
|
|
65
|
+
function $131cf43a05231e1e$export$6d095e787d2b5e1f(props) {
|
|
66
|
+
let defaultFormatter = $keQhS$useDateFormatter();
|
|
67
|
+
let resolvedOptions = $keQhS$useMemo(()=>defaultFormatter.resolvedOptions()
|
|
68
68
|
, [
|
|
69
69
|
defaultFormatter
|
|
70
70
|
]);
|
|
71
71
|
let { locale: locale , createCalendar: createCalendar , visibleDuration: visibleDuration = {
|
|
72
72
|
months: 1
|
|
73
73
|
} , minValue: minValue , maxValue: maxValue , selectionAlignment: selectionAlignment } = props;
|
|
74
|
-
let calendar = $
|
|
74
|
+
let calendar = $keQhS$useMemo(()=>createCalendar(resolvedOptions.calendar)
|
|
75
75
|
, [
|
|
76
76
|
createCalendar,
|
|
77
77
|
resolvedOptions.calendar
|
|
78
78
|
]);
|
|
79
|
-
let [value, setControlledValue] = $
|
|
80
|
-
let calendarDateValue = $
|
|
79
|
+
let [value, setControlledValue] = $keQhS$useControlledState(props.value, props.defaultValue, props.onChange);
|
|
80
|
+
let calendarDateValue = $keQhS$useMemo(()=>value ? $keQhS$toCalendar($keQhS$toCalendarDate(value), calendar) : null
|
|
81
81
|
, [
|
|
82
82
|
value,
|
|
83
83
|
calendar
|
|
84
84
|
]);
|
|
85
|
-
let timeZone = $
|
|
85
|
+
let timeZone = $keQhS$useMemo(()=>value && 'timeZone' in value ? value.timeZone : resolvedOptions.timeZone
|
|
86
86
|
, [
|
|
87
87
|
value,
|
|
88
88
|
resolvedOptions.timeZone
|
|
89
89
|
]);
|
|
90
|
-
let defaultDate = $
|
|
90
|
+
let defaultDate = $keQhS$useMemo(()=>calendarDateValue || $f62d864046160412$export$4f5203c0d889109e($keQhS$toCalendar($keQhS$today(timeZone), calendar), minValue, maxValue)
|
|
91
91
|
, [
|
|
92
92
|
calendarDateValue,
|
|
93
93
|
timeZone,
|
|
@@ -95,20 +95,20 @@ function $773eaea6455709cc$export$6d095e787d2b5e1f(props) {
|
|
|
95
95
|
minValue,
|
|
96
96
|
maxValue
|
|
97
97
|
]);
|
|
98
|
-
let [startDate, setStartDate] = $
|
|
98
|
+
let [startDate, setStartDate] = $keQhS$useState(()=>{
|
|
99
99
|
switch(selectionAlignment){
|
|
100
100
|
case 'start':
|
|
101
|
-
return $
|
|
101
|
+
return $f62d864046160412$export$144a00ba6044eb9(defaultDate, visibleDuration, locale, minValue, maxValue);
|
|
102
102
|
case 'end':
|
|
103
|
-
return $
|
|
103
|
+
return $f62d864046160412$export$530edbfc915b2b04(defaultDate, visibleDuration, locale, minValue, maxValue);
|
|
104
104
|
case 'center':
|
|
105
105
|
default:
|
|
106
|
-
return $
|
|
106
|
+
return $f62d864046160412$export$f4a51ff076cc9a09(defaultDate, visibleDuration, locale, minValue, maxValue);
|
|
107
107
|
}
|
|
108
108
|
});
|
|
109
|
-
let [focusedDate, setFocusedDate] = $
|
|
110
|
-
let [isFocused, setFocused] = $
|
|
111
|
-
let endDate = $
|
|
109
|
+
let [focusedDate, setFocusedDate] = $keQhS$useState(defaultDate);
|
|
110
|
+
let [isFocused, setFocused] = $keQhS$useState(props.autoFocus || false);
|
|
111
|
+
let endDate = $keQhS$useMemo(()=>startDate.add(visibleDuration).subtract({
|
|
112
112
|
days: 1
|
|
113
113
|
})
|
|
114
114
|
, [
|
|
@@ -116,11 +116,11 @@ function $773eaea6455709cc$export$6d095e787d2b5e1f(props) {
|
|
|
116
116
|
visibleDuration
|
|
117
117
|
]);
|
|
118
118
|
// Reset focused date and visible range when calendar changes.
|
|
119
|
-
let lastCalendarIdentifier = $
|
|
120
|
-
$
|
|
119
|
+
let lastCalendarIdentifier = $keQhS$useRef(calendar.identifier);
|
|
120
|
+
$keQhS$useEffect(()=>{
|
|
121
121
|
if (calendar.identifier !== lastCalendarIdentifier.current) {
|
|
122
|
-
let newFocusedDate = $
|
|
123
|
-
setStartDate($
|
|
122
|
+
let newFocusedDate = $keQhS$toCalendar(focusedDate, calendar);
|
|
123
|
+
setStartDate($f62d864046160412$export$f4a51ff076cc9a09(newFocusedDate, visibleDuration, locale, minValue, maxValue));
|
|
124
124
|
setFocusedDate(newFocusedDate);
|
|
125
125
|
lastCalendarIdentifier.current = calendar.identifier;
|
|
126
126
|
}
|
|
@@ -135,17 +135,17 @@ function $773eaea6455709cc$export$6d095e787d2b5e1f(props) {
|
|
|
135
135
|
// Sets focus to a specific cell date
|
|
136
136
|
function focusCell(date) {
|
|
137
137
|
// date = constrain(focusedDate, date, visibleDuration, locale, minValue, maxValue);
|
|
138
|
-
date = $
|
|
138
|
+
date = $f62d864046160412$export$4f5203c0d889109e(date, minValue, maxValue);
|
|
139
139
|
let next = startDate.add(visibleDuration);
|
|
140
|
-
if (date.compare(startDate) < 0) setStartDate($
|
|
141
|
-
else if (date.compare(next) >= 0) setStartDate($
|
|
140
|
+
if (date.compare(startDate) < 0) setStartDate($f62d864046160412$export$530edbfc915b2b04(date, visibleDuration, locale, minValue, maxValue));
|
|
141
|
+
else if (date.compare(next) >= 0) setStartDate($f62d864046160412$export$144a00ba6044eb9(date, visibleDuration, locale, minValue, maxValue));
|
|
142
142
|
setFocusedDate(date);
|
|
143
143
|
}
|
|
144
144
|
function setValue(newValue) {
|
|
145
145
|
if (!props.isDisabled && !props.isReadOnly) {
|
|
146
146
|
// The display calendar should not have any effect on the emitted value.
|
|
147
147
|
// Emit dates in the same calendar as the original value, if any, otherwise gregorian.
|
|
148
|
-
newValue = $
|
|
148
|
+
newValue = $keQhS$toCalendar(newValue, (value === null || value === void 0 ? void 0 : value.calendar) || new $keQhS$GregorianCalendar());
|
|
149
149
|
// Preserve time if the input value had one.
|
|
150
150
|
if (value && 'hour' in value) setControlledValue(value.set(newValue));
|
|
151
151
|
else setControlledValue(newValue);
|
|
@@ -190,13 +190,13 @@ function $773eaea6455709cc$export$6d095e787d2b5e1f(props) {
|
|
|
190
190
|
},
|
|
191
191
|
focusNextPage () {
|
|
192
192
|
let start = startDate.add(visibleDuration);
|
|
193
|
-
setStartDate($
|
|
194
|
-
setFocusedDate($
|
|
193
|
+
setStartDate($f62d864046160412$export$5bb865b12696a77d(focusedDate, start, visibleDuration, locale, minValue, maxValue));
|
|
194
|
+
setFocusedDate($f62d864046160412$export$4f5203c0d889109e(focusedDate.add(visibleDuration), minValue, maxValue));
|
|
195
195
|
},
|
|
196
196
|
focusPreviousPage () {
|
|
197
197
|
let start = startDate.subtract(visibleDuration);
|
|
198
|
-
setStartDate($
|
|
199
|
-
setFocusedDate($
|
|
198
|
+
setStartDate($f62d864046160412$export$5bb865b12696a77d(focusedDate, start, visibleDuration, locale, minValue, maxValue));
|
|
199
|
+
setFocusedDate($f62d864046160412$export$4f5203c0d889109e(focusedDate.subtract(visibleDuration), minValue, maxValue));
|
|
200
200
|
},
|
|
201
201
|
focusPageStart () {
|
|
202
202
|
focusCell(startDate);
|
|
@@ -231,24 +231,24 @@ function $773eaea6455709cc$export$6d095e787d2b5e1f(props) {
|
|
|
231
231
|
isFocused: isFocused,
|
|
232
232
|
setFocused: setFocused,
|
|
233
233
|
isInvalid (date) {
|
|
234
|
-
return $
|
|
234
|
+
return $f62d864046160412$export$eac50920cf2fd59a(date, minValue, maxValue);
|
|
235
235
|
},
|
|
236
236
|
isSelected (date) {
|
|
237
|
-
return calendarDateValue != null && $
|
|
237
|
+
return calendarDateValue != null && $keQhS$isSameDay(date, calendarDateValue);
|
|
238
238
|
},
|
|
239
239
|
isCellFocused (date) {
|
|
240
|
-
return isFocused && focusedDate && $
|
|
240
|
+
return isFocused && focusedDate && $keQhS$isSameDay(date, focusedDate);
|
|
241
241
|
},
|
|
242
242
|
isCellDisabled (date) {
|
|
243
|
-
return props.isDisabled || date.compare(startDate) < 0 || date.compare(endDate) > 0 || $
|
|
243
|
+
return props.isDisabled || date.compare(startDate) < 0 || date.compare(endDate) > 0 || $f62d864046160412$export$eac50920cf2fd59a(date, minValue, maxValue);
|
|
244
244
|
},
|
|
245
245
|
isPreviousVisibleRangeInvalid () {
|
|
246
|
-
return $
|
|
246
|
+
return $f62d864046160412$export$eac50920cf2fd59a(startDate.subtract({
|
|
247
247
|
days: 1
|
|
248
248
|
}), minValue, maxValue);
|
|
249
249
|
},
|
|
250
250
|
isNextVisibleRangeInvalid () {
|
|
251
|
-
return $
|
|
251
|
+
return $f62d864046160412$export$eac50920cf2fd59a(endDate.add({
|
|
252
252
|
days: 1
|
|
253
253
|
}), minValue, maxValue);
|
|
254
254
|
}
|
|
@@ -256,29 +256,29 @@ function $773eaea6455709cc$export$6d095e787d2b5e1f(props) {
|
|
|
256
256
|
}
|
|
257
257
|
|
|
258
258
|
|
|
259
|
-
var $
|
|
259
|
+
var $9a36b6ba2fb1a7c5$exports = {};
|
|
260
260
|
|
|
261
|
-
$parcel$export($
|
|
261
|
+
$parcel$export($9a36b6ba2fb1a7c5$exports, "useRangeCalendarState", () => $9a36b6ba2fb1a7c5$export$9a987164d97ecc90);
|
|
262
262
|
|
|
263
263
|
|
|
264
264
|
|
|
265
265
|
|
|
266
266
|
|
|
267
|
-
function $
|
|
267
|
+
function $9a36b6ba2fb1a7c5$export$9a987164d97ecc90(props) {
|
|
268
268
|
let { value: valueProp , defaultValue: defaultValue , onChange: onChange , createCalendar: createCalendar , locale: locale , visibleDuration: visibleDuration = {
|
|
269
269
|
months: 1
|
|
270
270
|
} , minValue: minValue , maxValue: maxValue , ...calendarProps } = props;
|
|
271
|
-
let [value, setValue] = $
|
|
272
|
-
let [anchorDate, setAnchorDate] = $
|
|
271
|
+
let [value, setValue] = $keQhS$useControlledState(valueProp, defaultValue, onChange);
|
|
272
|
+
let [anchorDate, setAnchorDate] = $keQhS$useState(null);
|
|
273
273
|
let alignment = 'center';
|
|
274
274
|
if (value && value.start && value.end) {
|
|
275
|
-
let start = $
|
|
275
|
+
let start = $f62d864046160412$export$f4a51ff076cc9a09($keQhS$toCalendarDate(value.start), visibleDuration, locale, minValue, maxValue);
|
|
276
276
|
let end = start.add(visibleDuration).subtract({
|
|
277
277
|
days: 1
|
|
278
278
|
});
|
|
279
279
|
if (value.end.compare(end) > 0) alignment = 'start';
|
|
280
280
|
}
|
|
281
|
-
let calendar = $
|
|
281
|
+
let calendar = $131cf43a05231e1e$export$6d095e787d2b5e1f({
|
|
282
282
|
...calendarProps,
|
|
283
283
|
value: value && value.start,
|
|
284
284
|
createCalendar: createCalendar,
|
|
@@ -288,20 +288,20 @@ function $47d19290c26a12d7$export$9a987164d97ecc90(props) {
|
|
|
288
288
|
maxValue: maxValue,
|
|
289
289
|
selectionAlignment: alignment
|
|
290
290
|
});
|
|
291
|
-
let highlightedRange = anchorDate ? $
|
|
291
|
+
let highlightedRange = anchorDate ? $9a36b6ba2fb1a7c5$var$makeRange(anchorDate, calendar.focusedDate) : value && $9a36b6ba2fb1a7c5$var$makeRange(value.start, value.end);
|
|
292
292
|
let selectDate = (date)=>{
|
|
293
293
|
if (props.isReadOnly) return;
|
|
294
294
|
if (!anchorDate) setAnchorDate(date);
|
|
295
295
|
else {
|
|
296
|
-
let range = $
|
|
296
|
+
let range = $9a36b6ba2fb1a7c5$var$makeRange(anchorDate, date);
|
|
297
297
|
setValue({
|
|
298
|
-
start: $
|
|
299
|
-
end: $
|
|
298
|
+
start: $9a36b6ba2fb1a7c5$var$convertValue(range.start, value === null || value === void 0 ? void 0 : value.start),
|
|
299
|
+
end: $9a36b6ba2fb1a7c5$var$convertValue(range.end, value === null || value === void 0 ? void 0 : value.end)
|
|
300
300
|
});
|
|
301
301
|
setAnchorDate(null);
|
|
302
302
|
}
|
|
303
303
|
};
|
|
304
|
-
let [isDragging, setDragging] = $
|
|
304
|
+
let [isDragging, setDragging] = $keQhS$useState(false);
|
|
305
305
|
return {
|
|
306
306
|
...calendar,
|
|
307
307
|
value: value,
|
|
@@ -323,21 +323,21 @@ function $47d19290c26a12d7$export$9a987164d97ecc90(props) {
|
|
|
323
323
|
setDragging: setDragging
|
|
324
324
|
};
|
|
325
325
|
}
|
|
326
|
-
function $
|
|
326
|
+
function $9a36b6ba2fb1a7c5$var$makeRange(start, end) {
|
|
327
327
|
if (!start || !end) return null;
|
|
328
328
|
if (end.compare(start) < 0) [start, end] = [
|
|
329
329
|
end,
|
|
330
330
|
start
|
|
331
331
|
];
|
|
332
332
|
return {
|
|
333
|
-
start: $
|
|
334
|
-
end: $
|
|
333
|
+
start: $keQhS$toCalendarDate(start),
|
|
334
|
+
end: $keQhS$toCalendarDate(end)
|
|
335
335
|
};
|
|
336
336
|
}
|
|
337
|
-
function $
|
|
337
|
+
function $9a36b6ba2fb1a7c5$var$convertValue(newValue, oldValue) {
|
|
338
338
|
// The display calendar should not have any effect on the emitted value.
|
|
339
339
|
// Emit dates in the same calendar as the original value, if any, otherwise gregorian.
|
|
340
|
-
newValue = $
|
|
340
|
+
newValue = $keQhS$toCalendar(newValue, (oldValue === null || oldValue === void 0 ? void 0 : oldValue.calendar) || new $keQhS$GregorianCalendar());
|
|
341
341
|
// Preserve time if the input value had one.
|
|
342
342
|
if (oldValue && 'hour' in oldValue) return oldValue.set(newValue);
|
|
343
343
|
return newValue;
|
|
@@ -346,5 +346,5 @@ function $47d19290c26a12d7$var$convertValue(newValue, oldValue) {
|
|
|
346
346
|
|
|
347
347
|
|
|
348
348
|
|
|
349
|
-
export {$
|
|
349
|
+
export {$131cf43a05231e1e$export$6d095e787d2b5e1f as useCalendarState, $9a36b6ba2fb1a7c5$export$9a987164d97ecc90 as useRangeCalendarState};
|
|
350
350
|
//# sourceMappingURL=module.js.map
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;SGuBgB,yCAAS,CAAC,IAAkB,EAAE,QAAmB,EAAE,QAAmB,EAAE,CAAC;IACvF,MAAM,CAAE,QAAQ,IAAI,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,CAAC,IACnD,QAAQ,IAAI,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,CAAC;AACnD,CAAC;SAEe,yCAAW,CAAC,IAAkB,EAAE,QAAkB,EAAE,MAAc,EAAE,QAAoB,EAAE,QAAoB,EAAE,CAAC;IAC/H,GAAG,CAAC,YAAY,GAAa,CAAC;IAAA,CAAC;IAC/B,GAAG,CAAE,GAAG,CAAC,GAAG,IAAI,QAAQ,CAAE,CAAC;QACzB,YAAY,CAAC,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;QAChD,EAAE,EAAE,YAAY,CAAC,GAAG,IAAI,CAAC,IAAI,QAAQ,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,EAClD,YAAY,CAAC,GAAG;IAEpB,CAAC;IAED,GAAG,CAAC,OAAO,GAAG,wCAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,YAAY;IACtE,MAAM,CAAC,yCAA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types.ts","packages/@react-stately/calendar/src/useCalendarState.ts","packages/@react-stately/calendar/src/utils.ts","packages/@react-stately/calendar/src/useRangeCalendarState.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\nexport * from './types';\nexport * from './useCalendarState';\nexport * from './useRangeCalendarState';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CalendarDate} from '@internationalized/date';\nimport {DateValue} from '@react-types/calendar';\nimport {RangeValue} from '@react-types/shared';\n\nexport interface CalendarStateBase {\n isDisabled: boolean,\n isReadOnly: boolean,\n visibleRange: RangeValue<CalendarDate>,\n timeZone: string,\n focusedDate: CalendarDate,\n setFocusedDate(value: CalendarDate): void,\n focusNextDay(): void,\n focusPreviousDay(): void,\n focusNextRow(): void,\n focusPreviousRow(): void,\n focusNextPage(): void,\n focusPreviousPage(): void,\n focusPageStart(): void,\n focusPageEnd(): void,\n focusNextSection(): void,\n focusPreviousSection(): void,\n focusNextPage(): void,\n focusPreviousPage(): void,\n selectFocusedDate(): void,\n selectDate(date: CalendarDate): void,\n isFocused: boolean,\n setFocused(value: boolean): void,\n isInvalid(date: CalendarDate): boolean,\n isSelected(date: CalendarDate): boolean,\n isCellFocused(date: CalendarDate): boolean,\n isCellDisabled(date: CalendarDate): boolean,\n isPreviousVisibleRangeInvalid(): boolean,\n isNextVisibleRangeInvalid(): boolean\n}\n\nexport interface CalendarState extends CalendarStateBase {\n value: CalendarDate,\n setValue(value: CalendarDate): void\n}\n\nexport interface RangeCalendarState extends CalendarStateBase {\n value: RangeValue<DateValue>,\n setValue(value: RangeValue<DateValue>): void,\n highlightDate(date: CalendarDate): void,\n anchorDate: CalendarDate | null,\n setAnchorDate(date: CalendarDate | null): void,\n highlightedRange: RangeValue<CalendarDate>,\n isDragging: boolean,\n setDragging(isDragging: boolean): void\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {alignCenter, alignEnd, alignStart, constrainStart, constrainValue, isInvalid} from './utils';\nimport {\n Calendar,\n CalendarDate,\n Duration,\n GregorianCalendar,\n isSameDay,\n toCalendar,\n toCalendarDate,\n today\n} from '@internationalized/date';\nimport {CalendarProps, DateValue} from '@react-types/calendar';\nimport {CalendarState} from './types';\nimport {useControlledState} from '@react-stately/utils';\nimport {useDateFormatter} from '@react-aria/i18n';\nimport {useEffect, useMemo, useRef, useState} from 'react';\n\ninterface CalendarStateOptions<T extends DateValue> extends CalendarProps<T> {\n locale: string,\n createCalendar: (name: string) => Calendar,\n visibleDuration?: Duration,\n selectionAlignment?: 'start' | 'center' | 'end'\n}\n\nexport function useCalendarState<T extends DateValue>(props: CalendarStateOptions<T>): CalendarState {\n let defaultFormatter = useDateFormatter();\n let resolvedOptions = useMemo(() => defaultFormatter.resolvedOptions(), [defaultFormatter]);\n let {\n locale,\n createCalendar,\n visibleDuration = {months: 1},\n minValue,\n maxValue,\n selectionAlignment\n } = props;\n\n let calendar = useMemo(() => createCalendar(resolvedOptions.calendar), [createCalendar, resolvedOptions.calendar]);\n\n let [value, setControlledValue] = useControlledState<DateValue>(props.value, props.defaultValue, props.onChange);\n let calendarDateValue = useMemo(() => value ? toCalendar(toCalendarDate(value), calendar) : null, [value, calendar]);\n let timeZone = useMemo(() => value && 'timeZone' in value ? value.timeZone : resolvedOptions.timeZone, [value, resolvedOptions.timeZone]);\n let defaultDate = useMemo(() => calendarDateValue || constrainValue(toCalendar(today(timeZone), calendar), minValue, maxValue), [calendarDateValue, timeZone, calendar, minValue, maxValue]);\n let [startDate, setStartDate] = useState(() => {\n switch (selectionAlignment) {\n case 'start':\n return alignStart(defaultDate, visibleDuration, locale, minValue, maxValue);\n case 'end':\n return alignEnd(defaultDate, visibleDuration, locale, minValue, maxValue);\n case 'center':\n default:\n return alignCenter(defaultDate, visibleDuration, locale, minValue, maxValue);\n }\n });\n let [focusedDate, setFocusedDate] = useState(defaultDate);\n let [isFocused, setFocused] = useState(props.autoFocus || false);\n\n let endDate = useMemo(() => startDate.add(visibleDuration).subtract({days: 1}), [startDate, visibleDuration]);\n\n // Reset focused date and visible range when calendar changes.\n let lastCalendarIdentifier = useRef(calendar.identifier);\n useEffect(() => {\n if (calendar.identifier !== lastCalendarIdentifier.current) {\n let newFocusedDate = toCalendar(focusedDate, calendar);\n setStartDate(alignCenter(newFocusedDate, visibleDuration, locale, minValue, maxValue));\n setFocusedDate(newFocusedDate);\n lastCalendarIdentifier.current = calendar.identifier;\n }\n }, [calendar, focusedDate, visibleDuration, locale, minValue, maxValue]);\n\n // Sets focus to a specific cell date\n function focusCell(date: CalendarDate) {\n // date = constrain(focusedDate, date, visibleDuration, locale, minValue, maxValue);\n date = constrainValue(date, minValue, maxValue);\n\n let next = startDate.add(visibleDuration);\n if (date.compare(startDate) < 0) {\n setStartDate(alignEnd(date, visibleDuration, locale, minValue, maxValue));\n } else if (date.compare(next) >= 0) {\n setStartDate(alignStart(date, visibleDuration, locale, minValue, maxValue));\n }\n\n setFocusedDate(date);\n }\n\n function setValue(newValue: CalendarDate) {\n if (!props.isDisabled && !props.isReadOnly) {\n // The display calendar should not have any effect on the emitted value.\n // Emit dates in the same calendar as the original value, if any, otherwise gregorian.\n newValue = toCalendar(newValue, value?.calendar || new GregorianCalendar());\n\n // Preserve time if the input value had one.\n if (value && 'hour' in value) {\n setControlledValue(value.set(newValue));\n } else {\n setControlledValue(newValue);\n }\n }\n }\n\n return {\n isDisabled: props.isDisabled,\n isReadOnly: props.isReadOnly,\n value: calendarDateValue,\n setValue,\n visibleRange: {\n start: startDate,\n end: endDate\n },\n focusedDate,\n timeZone,\n setFocusedDate(date) {\n setFocusedDate(date);\n setFocused(true);\n },\n focusNextDay() {\n focusCell(focusedDate.add({days: 1}));\n },\n focusPreviousDay() {\n focusCell(focusedDate.subtract({days: 1}));\n },\n focusNextRow() {\n if (visibleDuration.days) {\n this.focusNextPage();\n } else if (visibleDuration.weeks || visibleDuration.months || visibleDuration.years) {\n focusCell(focusedDate.add({weeks: 1}));\n }\n },\n focusPreviousRow() {\n if (visibleDuration.days) {\n this.focusPreviousPage();\n } else if (visibleDuration.weeks || visibleDuration.months || visibleDuration.years) {\n focusCell(focusedDate.subtract({weeks: 1}));\n }\n },\n focusNextPage() {\n let start = startDate.add(visibleDuration);\n setStartDate(constrainStart(focusedDate, start, visibleDuration, locale, minValue, maxValue));\n setFocusedDate(constrainValue(focusedDate.add(visibleDuration), minValue, maxValue));\n },\n focusPreviousPage() {\n let start = startDate.subtract(visibleDuration);\n setStartDate(constrainStart(focusedDate, start, visibleDuration, locale, minValue, maxValue));\n setFocusedDate(constrainValue(focusedDate.subtract(visibleDuration), minValue, maxValue));\n },\n focusPageStart() {\n focusCell(startDate);\n },\n focusPageEnd() {\n focusCell(endDate);\n },\n focusNextSection() {\n if (visibleDuration.days) {\n this.focusNextPage();\n } else if (visibleDuration.weeks) {\n focusCell(focusedDate.add({months: 1}));\n } else if (visibleDuration.months || visibleDuration.years) {\n focusCell(focusedDate.add({years: 1}));\n }\n },\n focusPreviousSection() {\n if (visibleDuration.days) {\n this.focusPreviousPage();\n } else if (visibleDuration.weeks) {\n focusCell(focusedDate.subtract({months: 1}));\n } else if (visibleDuration.months || visibleDuration.years) {\n focusCell(focusedDate.subtract({years: 1}));\n }\n },\n selectFocusedDate() {\n setValue(focusedDate);\n },\n selectDate(date) {\n setValue(date);\n },\n isFocused,\n setFocused,\n isInvalid(date) {\n return isInvalid(date, minValue, maxValue);\n },\n isSelected(date) {\n return calendarDateValue != null && isSameDay(date, calendarDateValue);\n },\n isCellFocused(date) {\n return isFocused && focusedDate && isSameDay(date, focusedDate);\n },\n isCellDisabled(date) {\n return props.isDisabled || date.compare(startDate) < 0 || date.compare(endDate) > 0 || isInvalid(date, minValue, maxValue);\n },\n isPreviousVisibleRangeInvalid() {\n return isInvalid(startDate.subtract({days: 1}), minValue, maxValue);\n },\n isNextVisibleRangeInvalid() {\n return isInvalid(endDate.add({days: 1}), minValue, maxValue);\n }\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport {\n CalendarDate,\n Duration,\n maxDate,\n minDate,\n startOfMonth,\n startOfWeek,\n startOfYear,\n toCalendarDate\n} from '@internationalized/date';\nimport {DateValue} from '@react-types/calendar';\n\nexport function isInvalid(date: CalendarDate, minValue: DateValue, maxValue: DateValue) {\n return (minValue != null && date.compare(minValue) < 0) ||\n (maxValue != null && date.compare(maxValue) > 0);\n}\n\nexport function alignCenter(date: CalendarDate, duration: Duration, locale: string, minValue?: DateValue, maxValue?: DateValue) {\n let halfDuration: Duration = {};\n for (let key in duration) {\n halfDuration[key] = Math.floor(duration[key] / 2);\n if (halfDuration[key] > 0 && duration[key] % 2 === 0) {\n halfDuration[key]--;\n }\n }\n\n let aligned = alignStart(date, duration, locale).subtract(halfDuration);\n return constrainStart(date, aligned, duration, locale, minValue, maxValue);\n}\n\nexport function alignStart(date: CalendarDate, duration: Duration, locale: string, minValue?: DateValue, maxValue?: DateValue) {\n // align to the start of the largest unit\n let aligned = date;\n if (duration.years) {\n aligned = startOfYear(date);\n } else if (duration.months) {\n aligned = startOfMonth(date);\n } else if (duration.weeks) {\n aligned = startOfWeek(date, locale);\n }\n\n return constrainStart(date, aligned, duration, locale, minValue, maxValue);\n}\n\nexport function alignEnd(date: CalendarDate, duration: Duration, locale: string, minValue?: DateValue, maxValue?: DateValue) {\n let d = {...duration};\n // subtract 1 from the smallest unit\n if (duration.days) {\n d.days--;\n } else if (duration.weeks) {\n d.weeks--;\n } else if (duration.months) {\n d.months--;\n } else if (duration.years) {\n d.years--;\n }\n\n let aligned = alignStart(date, duration, locale).subtract(d);\n return constrainStart(date, aligned, duration, locale, minValue, maxValue);\n}\n\nexport function constrainStart(\n date: CalendarDate,\n aligned: CalendarDate,\n duration: Duration,\n locale: string,\n minValue: DateValue,\n maxValue: DateValue) {\n if (minValue && date.compare(minValue) >= 0) {\n aligned = maxDate(\n aligned,\n alignStart(toCalendarDate(minValue), duration, locale)\n );\n }\n\n if (maxValue && date.compare(maxValue) <= 0) {\n aligned = minDate(\n aligned,\n alignEnd(toCalendarDate(maxValue), duration, locale)\n );\n }\n\n return aligned;\n}\n\nexport function constrainValue(date: CalendarDate, minValue: DateValue, maxValue: DateValue) {\n if (minValue) {\n date = maxDate(date, toCalendarDate(minValue));\n }\n\n if (maxValue) {\n date = minDate(date, toCalendarDate(maxValue));\n }\n\n return date;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {alignCenter} from './utils';\nimport {Calendar, CalendarDate, Duration, GregorianCalendar, toCalendar, toCalendarDate} from '@internationalized/date';\nimport {DateRange, DateValue} from '@react-types/calendar';\nimport {RangeCalendarProps} from '@react-types/calendar';\nimport {RangeCalendarState} from './types';\nimport {RangeValue} from '@react-types/shared';\nimport {useCalendarState} from './useCalendarState';\nimport {useControlledState} from '@react-stately/utils';\nimport {useState} from 'react';\n\ninterface RangeCalendarStateOptions<T extends DateValue> extends RangeCalendarProps<T> {\n locale: string,\n createCalendar: (name: string) => Calendar,\n visibleDuration?: Duration\n}\n\nexport function useRangeCalendarState<T extends DateValue>(props: RangeCalendarStateOptions<T>): RangeCalendarState {\n let {value: valueProp, defaultValue, onChange, createCalendar, locale, visibleDuration = {months: 1}, minValue, maxValue, ...calendarProps} = props;\n let [value, setValue] = useControlledState<DateRange>(\n valueProp,\n defaultValue,\n onChange\n );\n\n let [anchorDate, setAnchorDate] = useState(null);\n let alignment: 'center' | 'start' = 'center';\n if (value && value.start && value.end) {\n let start = alignCenter(toCalendarDate(value.start), visibleDuration, locale, minValue, maxValue);\n let end = start.add(visibleDuration).subtract({days: 1});\n\n if (value.end.compare(end) > 0) {\n alignment = 'start';\n }\n }\n\n let calendar = useCalendarState({\n ...calendarProps,\n value: value && value.start,\n createCalendar,\n locale,\n visibleDuration,\n minValue,\n maxValue,\n selectionAlignment: alignment\n });\n\n let highlightedRange = anchorDate ? makeRange(anchorDate, calendar.focusedDate) : value && makeRange(value.start, value.end);\n let selectDate = (date: CalendarDate) => {\n if (props.isReadOnly) {\n return;\n }\n\n if (!anchorDate) {\n setAnchorDate(date);\n } else {\n let range = makeRange(anchorDate, date);\n setValue({\n start: convertValue(range.start, value?.start),\n end: convertValue(range.end, value?.end)\n });\n setAnchorDate(null);\n }\n };\n\n let [isDragging, setDragging] = useState(false);\n\n return {\n ...calendar,\n value,\n setValue,\n anchorDate,\n setAnchorDate,\n highlightedRange,\n selectFocusedDate() {\n selectDate(calendar.focusedDate);\n },\n selectDate,\n highlightDate(date) {\n if (anchorDate) {\n calendar.setFocusedDate(date);\n }\n },\n isSelected(date) {\n return highlightedRange && date.compare(highlightedRange.start) >= 0 && date.compare(highlightedRange.end) <= 0;\n },\n isDragging,\n setDragging\n };\n}\n\nfunction makeRange(start: DateValue, end: DateValue): RangeValue<CalendarDate> {\n if (!start || !end) {\n return null;\n }\n\n if (end.compare(start) < 0) {\n [start, end] = [end, start];\n }\n\n return {start: toCalendarDate(start), end: toCalendarDate(end)};\n}\n\nfunction convertValue(newValue: CalendarDate, oldValue: DateValue) {\n // The display calendar should not have any effect on the emitted value.\n // Emit dates in the same calendar as the original value, if any, otherwise gregorian.\n newValue = toCalendar(newValue, oldValue?.calendar || new GregorianCalendar());\n\n // Preserve time if the input value had one.\n if (oldValue && 'hour' in oldValue) {\n return oldValue.set(newValue);\n }\n\n return newValue;\n}\n"],"names":[],"version":3,"file":"module.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;SGuBgB,yCAAS,CAAC,IAAkB,EAAE,QAAmB,EAAE,QAAmB,EAAE,CAAC;IACvF,MAAM,CAAE,QAAQ,IAAI,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,CAAC,IACnD,QAAQ,IAAI,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,CAAC;AACnD,CAAC;SAEe,yCAAW,CAAC,IAAkB,EAAE,QAAkB,EAAE,MAAc,EAAE,QAAoB,EAAE,QAAoB,EAAE,CAAC;IAC/H,GAAG,CAAC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GAAG,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC,GACvB,KAAK,EAAE,GAAG,IAAI,CAAC;QAAA,GAAG;QAAE,KAAK;IAAA,CAAC;IAG7B,MAAM,CAAC,CAAC;QAAA,KAAK,EAAE,qBAAc,CAAC,KAAK;QAAG,GAAG,EAAE,qBAAc,CAAC,GAAG;IAAC,CAAC;AACjE,CAAC;SAEQ,kCAAY,CAAC,QAAsB,EAAE,QAAmB,EAAE,CAAC;IAClE,EAAwE,AAAxE,sEAAwE;IACxE,EAAsF,AAAtF,oFAAsF;IACtF,QAAQ,GAAG,iBAAU,CAAC,QAAQ,GAAE,QAAQ,aAAR,QAAQ,KAAR,IAAI,CAAJ,CAAkB,GAAlB,IAAI,CAAJ,CAAkB,GAAlB,QAAQ,CAAE,QAAQ,KAAI,GAAG,CAAC,wBAAiB;IAE3E,EAA4C,AAA5C,0CAA4C;IAC5C,EAAE,EAAE,QAAQ,IAAI,CAAM,SAAI,QAAQ,EAChC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ;IAG9B,MAAM,CAAC,QAAQ;AACjB,CAAC;;","sources":["packages/@react-stately/calendar/src/index.ts","packages/@react-stately/calendar/src/types.ts","packages/@react-stately/calendar/src/useCalendarState.ts","packages/@react-stately/calendar/src/utils.ts","packages/@react-stately/calendar/src/useRangeCalendarState.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\nexport * from './types';\nexport * from './useCalendarState';\nexport * from './useRangeCalendarState';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {CalendarDate} from '@internationalized/date';\nimport {DateValue} from '@react-types/calendar';\nimport {RangeValue} from '@react-types/shared';\n\nexport interface CalendarStateBase {\n isDisabled: boolean,\n isReadOnly: boolean,\n visibleRange: RangeValue<CalendarDate>,\n timeZone: string,\n focusedDate: CalendarDate,\n setFocusedDate(value: CalendarDate): void,\n focusNextDay(): void,\n focusPreviousDay(): void,\n focusNextRow(): void,\n focusPreviousRow(): void,\n focusNextPage(): void,\n focusPreviousPage(): void,\n focusPageStart(): void,\n focusPageEnd(): void,\n focusNextSection(): void,\n focusPreviousSection(): void,\n focusNextPage(): void,\n focusPreviousPage(): void,\n selectFocusedDate(): void,\n selectDate(date: CalendarDate): void,\n isFocused: boolean,\n setFocused(value: boolean): void,\n isInvalid(date: CalendarDate): boolean,\n isSelected(date: CalendarDate): boolean,\n isCellFocused(date: CalendarDate): boolean,\n isCellDisabled(date: CalendarDate): boolean,\n isPreviousVisibleRangeInvalid(): boolean,\n isNextVisibleRangeInvalid(): boolean\n}\n\nexport interface CalendarState extends CalendarStateBase {\n value: CalendarDate,\n setValue(value: CalendarDate): void\n}\n\nexport interface RangeCalendarState extends CalendarStateBase {\n value: RangeValue<DateValue>,\n setValue(value: RangeValue<DateValue>): void,\n highlightDate(date: CalendarDate): void,\n anchorDate: CalendarDate | null,\n setAnchorDate(date: CalendarDate | null): void,\n highlightedRange: RangeValue<CalendarDate>,\n isDragging: boolean,\n setDragging(isDragging: boolean): void\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {alignCenter, alignEnd, alignStart, constrainStart, constrainValue, isInvalid} from './utils';\nimport {\n Calendar,\n CalendarDate,\n Duration,\n GregorianCalendar,\n isSameDay,\n toCalendar,\n toCalendarDate,\n today\n} from '@internationalized/date';\nimport {CalendarProps, DateValue} from '@react-types/calendar';\nimport {CalendarState} from './types';\nimport {useControlledState} from '@react-stately/utils';\nimport {useDateFormatter} from '@react-aria/i18n';\nimport {useEffect, useMemo, useRef, useState} from 'react';\n\ninterface CalendarStateOptions<T extends DateValue> extends CalendarProps<T> {\n locale: string,\n createCalendar: (name: string) => Calendar,\n visibleDuration?: Duration,\n selectionAlignment?: 'start' | 'center' | 'end'\n}\n\nexport function useCalendarState<T extends DateValue>(props: CalendarStateOptions<T>): CalendarState {\n let defaultFormatter = useDateFormatter();\n let resolvedOptions = useMemo(() => defaultFormatter.resolvedOptions(), [defaultFormatter]);\n let {\n locale,\n createCalendar,\n visibleDuration = {months: 1},\n minValue,\n maxValue,\n selectionAlignment\n } = props;\n\n let calendar = useMemo(() => createCalendar(resolvedOptions.calendar), [createCalendar, resolvedOptions.calendar]);\n\n let [value, setControlledValue] = useControlledState<DateValue>(props.value, props.defaultValue, props.onChange);\n let calendarDateValue = useMemo(() => value ? toCalendar(toCalendarDate(value), calendar) : null, [value, calendar]);\n let timeZone = useMemo(() => value && 'timeZone' in value ? value.timeZone : resolvedOptions.timeZone, [value, resolvedOptions.timeZone]);\n let defaultDate = useMemo(() => calendarDateValue || constrainValue(toCalendar(today(timeZone), calendar), minValue, maxValue), [calendarDateValue, timeZone, calendar, minValue, maxValue]);\n let [startDate, setStartDate] = useState(() => {\n switch (selectionAlignment) {\n case 'start':\n return alignStart(defaultDate, visibleDuration, locale, minValue, maxValue);\n case 'end':\n return alignEnd(defaultDate, visibleDuration, locale, minValue, maxValue);\n case 'center':\n default:\n return alignCenter(defaultDate, visibleDuration, locale, minValue, maxValue);\n }\n });\n let [focusedDate, setFocusedDate] = useState(defaultDate);\n let [isFocused, setFocused] = useState(props.autoFocus || false);\n\n let endDate = useMemo(() => startDate.add(visibleDuration).subtract({days: 1}), [startDate, visibleDuration]);\n\n // Reset focused date and visible range when calendar changes.\n let lastCalendarIdentifier = useRef(calendar.identifier);\n useEffect(() => {\n if (calendar.identifier !== lastCalendarIdentifier.current) {\n let newFocusedDate = toCalendar(focusedDate, calendar);\n setStartDate(alignCenter(newFocusedDate, visibleDuration, locale, minValue, maxValue));\n setFocusedDate(newFocusedDate);\n lastCalendarIdentifier.current = calendar.identifier;\n }\n }, [calendar, focusedDate, visibleDuration, locale, minValue, maxValue]);\n\n // Sets focus to a specific cell date\n function focusCell(date: CalendarDate) {\n // date = constrain(focusedDate, date, visibleDuration, locale, minValue, maxValue);\n date = constrainValue(date, minValue, maxValue);\n\n let next = startDate.add(visibleDuration);\n if (date.compare(startDate) < 0) {\n setStartDate(alignEnd(date, visibleDuration, locale, minValue, maxValue));\n } else if (date.compare(next) >= 0) {\n setStartDate(alignStart(date, visibleDuration, locale, minValue, maxValue));\n }\n\n setFocusedDate(date);\n }\n\n function setValue(newValue: CalendarDate) {\n if (!props.isDisabled && !props.isReadOnly) {\n // The display calendar should not have any effect on the emitted value.\n // Emit dates in the same calendar as the original value, if any, otherwise gregorian.\n newValue = toCalendar(newValue, value?.calendar || new GregorianCalendar());\n\n // Preserve time if the input value had one.\n if (value && 'hour' in value) {\n setControlledValue(value.set(newValue));\n } else {\n setControlledValue(newValue);\n }\n }\n }\n\n return {\n isDisabled: props.isDisabled,\n isReadOnly: props.isReadOnly,\n value: calendarDateValue,\n setValue,\n visibleRange: {\n start: startDate,\n end: endDate\n },\n focusedDate,\n timeZone,\n setFocusedDate(date) {\n setFocusedDate(date);\n setFocused(true);\n },\n focusNextDay() {\n focusCell(focusedDate.add({days: 1}));\n },\n focusPreviousDay() {\n focusCell(focusedDate.subtract({days: 1}));\n },\n focusNextRow() {\n if (visibleDuration.days) {\n this.focusNextPage();\n } else if (visibleDuration.weeks || visibleDuration.months || visibleDuration.years) {\n focusCell(focusedDate.add({weeks: 1}));\n }\n },\n focusPreviousRow() {\n if (visibleDuration.days) {\n this.focusPreviousPage();\n } else if (visibleDuration.weeks || visibleDuration.months || visibleDuration.years) {\n focusCell(focusedDate.subtract({weeks: 1}));\n }\n },\n focusNextPage() {\n let start = startDate.add(visibleDuration);\n setStartDate(constrainStart(focusedDate, start, visibleDuration, locale, minValue, maxValue));\n setFocusedDate(constrainValue(focusedDate.add(visibleDuration), minValue, maxValue));\n },\n focusPreviousPage() {\n let start = startDate.subtract(visibleDuration);\n setStartDate(constrainStart(focusedDate, start, visibleDuration, locale, minValue, maxValue));\n setFocusedDate(constrainValue(focusedDate.subtract(visibleDuration), minValue, maxValue));\n },\n focusPageStart() {\n focusCell(startDate);\n },\n focusPageEnd() {\n focusCell(endDate);\n },\n focusNextSection() {\n if (visibleDuration.days) {\n this.focusNextPage();\n } else if (visibleDuration.weeks) {\n focusCell(focusedDate.add({months: 1}));\n } else if (visibleDuration.months || visibleDuration.years) {\n focusCell(focusedDate.add({years: 1}));\n }\n },\n focusPreviousSection() {\n if (visibleDuration.days) {\n this.focusPreviousPage();\n } else if (visibleDuration.weeks) {\n focusCell(focusedDate.subtract({months: 1}));\n } else if (visibleDuration.months || visibleDuration.years) {\n focusCell(focusedDate.subtract({years: 1}));\n }\n },\n selectFocusedDate() {\n setValue(focusedDate);\n },\n selectDate(date) {\n setValue(date);\n },\n isFocused,\n setFocused,\n isInvalid(date) {\n return isInvalid(date, minValue, maxValue);\n },\n isSelected(date) {\n return calendarDateValue != null && isSameDay(date, calendarDateValue);\n },\n isCellFocused(date) {\n return isFocused && focusedDate && isSameDay(date, focusedDate);\n },\n isCellDisabled(date) {\n return props.isDisabled || date.compare(startDate) < 0 || date.compare(endDate) > 0 || isInvalid(date, minValue, maxValue);\n },\n isPreviousVisibleRangeInvalid() {\n return isInvalid(startDate.subtract({days: 1}), minValue, maxValue);\n },\n isNextVisibleRangeInvalid() {\n return isInvalid(endDate.add({days: 1}), minValue, maxValue);\n }\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport {\n CalendarDate,\n Duration,\n maxDate,\n minDate,\n startOfMonth,\n startOfWeek,\n startOfYear,\n toCalendarDate\n} from '@internationalized/date';\nimport {DateValue} from '@react-types/calendar';\n\nexport function isInvalid(date: CalendarDate, minValue: DateValue, maxValue: DateValue) {\n return (minValue != null && date.compare(minValue) < 0) ||\n (maxValue != null && date.compare(maxValue) > 0);\n}\n\nexport function alignCenter(date: CalendarDate, duration: Duration, locale: string, minValue?: DateValue, maxValue?: DateValue) {\n let halfDuration: Duration = {};\n for (let key in duration) {\n halfDuration[key] = Math.floor(duration[key] / 2);\n if (halfDuration[key] > 0 && duration[key] % 2 === 0) {\n halfDuration[key]--;\n }\n }\n\n let aligned = alignStart(date, duration, locale).subtract(halfDuration);\n return constrainStart(date, aligned, duration, locale, minValue, maxValue);\n}\n\nexport function alignStart(date: CalendarDate, duration: Duration, locale: string, minValue?: DateValue, maxValue?: DateValue) {\n // align to the start of the largest unit\n let aligned = date;\n if (duration.years) {\n aligned = startOfYear(date);\n } else if (duration.months) {\n aligned = startOfMonth(date);\n } else if (duration.weeks) {\n aligned = startOfWeek(date, locale);\n }\n\n return constrainStart(date, aligned, duration, locale, minValue, maxValue);\n}\n\nexport function alignEnd(date: CalendarDate, duration: Duration, locale: string, minValue?: DateValue, maxValue?: DateValue) {\n let d = {...duration};\n // subtract 1 from the smallest unit\n if (duration.days) {\n d.days--;\n } else if (duration.weeks) {\n d.weeks--;\n } else if (duration.months) {\n d.months--;\n } else if (duration.years) {\n d.years--;\n }\n\n let aligned = alignStart(date, duration, locale).subtract(d);\n return constrainStart(date, aligned, duration, locale, minValue, maxValue);\n}\n\nexport function constrainStart(\n date: CalendarDate,\n aligned: CalendarDate,\n duration: Duration,\n locale: string,\n minValue: DateValue,\n maxValue: DateValue) {\n if (minValue && date.compare(minValue) >= 0) {\n aligned = maxDate(\n aligned,\n alignStart(toCalendarDate(minValue), duration, locale)\n );\n }\n\n if (maxValue && date.compare(maxValue) <= 0) {\n aligned = minDate(\n aligned,\n alignEnd(toCalendarDate(maxValue), duration, locale)\n );\n }\n\n return aligned;\n}\n\nexport function constrainValue(date: CalendarDate, minValue: DateValue, maxValue: DateValue) {\n if (minValue) {\n date = maxDate(date, toCalendarDate(minValue));\n }\n\n if (maxValue) {\n date = minDate(date, toCalendarDate(maxValue));\n }\n\n return date;\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {alignCenter} from './utils';\nimport {Calendar, CalendarDate, Duration, GregorianCalendar, toCalendar, toCalendarDate} from '@internationalized/date';\nimport {DateRange, DateValue} from '@react-types/calendar';\nimport {RangeCalendarProps} from '@react-types/calendar';\nimport {RangeCalendarState} from './types';\nimport {RangeValue} from '@react-types/shared';\nimport {useCalendarState} from './useCalendarState';\nimport {useControlledState} from '@react-stately/utils';\nimport {useState} from 'react';\n\ninterface RangeCalendarStateOptions<T extends DateValue> extends RangeCalendarProps<T> {\n locale: string,\n createCalendar: (name: string) => Calendar,\n visibleDuration?: Duration\n}\n\nexport function useRangeCalendarState<T extends DateValue>(props: RangeCalendarStateOptions<T>): RangeCalendarState {\n let {value: valueProp, defaultValue, onChange, createCalendar, locale, visibleDuration = {months: 1}, minValue, maxValue, ...calendarProps} = props;\n let [value, setValue] = useControlledState<DateRange>(\n valueProp,\n defaultValue,\n onChange\n );\n\n let [anchorDate, setAnchorDate] = useState(null);\n let alignment: 'center' | 'start' = 'center';\n if (value && value.start && value.end) {\n let start = alignCenter(toCalendarDate(value.start), visibleDuration, locale, minValue, maxValue);\n let end = start.add(visibleDuration).subtract({days: 1});\n\n if (value.end.compare(end) > 0) {\n alignment = 'start';\n }\n }\n\n let calendar = useCalendarState({\n ...calendarProps,\n value: value && value.start,\n createCalendar,\n locale,\n visibleDuration,\n minValue,\n maxValue,\n selectionAlignment: alignment\n });\n\n let highlightedRange = anchorDate ? makeRange(anchorDate, calendar.focusedDate) : value && makeRange(value.start, value.end);\n let selectDate = (date: CalendarDate) => {\n if (props.isReadOnly) {\n return;\n }\n\n if (!anchorDate) {\n setAnchorDate(date);\n } else {\n let range = makeRange(anchorDate, date);\n setValue({\n start: convertValue(range.start, value?.start),\n end: convertValue(range.end, value?.end)\n });\n setAnchorDate(null);\n }\n };\n\n let [isDragging, setDragging] = useState(false);\n\n return {\n ...calendar,\n value,\n setValue,\n anchorDate,\n setAnchorDate,\n highlightedRange,\n selectFocusedDate() {\n selectDate(calendar.focusedDate);\n },\n selectDate,\n highlightDate(date) {\n if (anchorDate) {\n calendar.setFocusedDate(date);\n }\n },\n isSelected(date) {\n return highlightedRange && date.compare(highlightedRange.start) >= 0 && date.compare(highlightedRange.end) <= 0;\n },\n isDragging,\n setDragging\n };\n}\n\nfunction makeRange(start: DateValue, end: DateValue): RangeValue<CalendarDate> {\n if (!start || !end) {\n return null;\n }\n\n if (end.compare(start) < 0) {\n [start, end] = [end, start];\n }\n\n return {start: toCalendarDate(start), end: toCalendarDate(end)};\n}\n\nfunction convertValue(newValue: CalendarDate, oldValue: DateValue) {\n // The display calendar should not have any effect on the emitted value.\n // Emit dates in the same calendar as the original value, if any, otherwise gregorian.\n newValue = toCalendar(newValue, oldValue?.calendar || new GregorianCalendar());\n\n // Preserve time if the input value had one.\n if (oldValue && 'hour' in oldValue) {\n return oldValue.set(newValue);\n }\n\n return newValue;\n}\n"],"names":[],"version":3,"file":"module.js.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-stately/calendar",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.1424+1aa66e6e7",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@babel/runtime": "^7.6.2",
|
|
21
|
-
"@internationalized/date": "3.0.0-nightly.
|
|
22
|
-
"@react-aria/i18n": "3.0.0-nightly.
|
|
23
|
-
"@react-stately/utils": "3.0.0-nightly.
|
|
24
|
-
"@react-types/calendar": "3.0.0-nightly.
|
|
25
|
-
"@react-types/datepicker": "3.0.0-nightly.
|
|
26
|
-
"@react-types/shared": "3.0.0-nightly.
|
|
21
|
+
"@internationalized/date": "3.0.0-nightly.3120+1aa66e6e7",
|
|
22
|
+
"@react-aria/i18n": "3.0.0-nightly.1424+1aa66e6e7",
|
|
23
|
+
"@react-stately/utils": "3.0.0-nightly.1424+1aa66e6e7",
|
|
24
|
+
"@react-types/calendar": "3.0.0-nightly.3120+1aa66e6e7",
|
|
25
|
+
"@react-types/datepicker": "3.0.0-nightly.3120+1aa66e6e7",
|
|
26
|
+
"@react-types/shared": "3.0.0-nightly.1424+1aa66e6e7",
|
|
27
27
|
"date-fns": "^1.30.1"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "1aa66e6e75e2da014f44177686c3332cd625fb9f"
|
|
36
36
|
}
|