@react-stately/calendar 3.0.0-nightly.1501 → 3.0.0-nightly.1508
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 +71 -36
- package/dist/main.js.map +1 -1
- package/dist/module.js +70 -22
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +26 -16
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -9
- package/src/index.ts +6 -3
- package/src/types.ts +23 -13
- package/src/useCalendarState.ts +80 -11
- package/src/useRangeCalendarState.ts +24 -2
- package/src/utils.ts +15 -1
package/dist/main.js
CHANGED
|
@@ -2,31 +2,12 @@ var $hEzMm$internationalizeddate = require("@internationalized/date");
|
|
|
2
2
|
var $hEzMm$reactstatelyutils = require("@react-stately/utils");
|
|
3
3
|
var $hEzMm$react = require("react");
|
|
4
4
|
|
|
5
|
-
function $parcel$exportWildcard(dest, source) {
|
|
6
|
-
Object.keys(source).forEach(function(key) {
|
|
7
|
-
if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
Object.defineProperty(dest, key, {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
get: function get() {
|
|
14
|
-
return source[key];
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
return dest;
|
|
20
|
-
}
|
|
21
5
|
function $parcel$export(e, n, v, s) {
|
|
22
6
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
23
7
|
}
|
|
24
|
-
var $7a549489c00e7fe0$exports = {};
|
|
25
|
-
|
|
26
8
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
$parcel$export($6adad0c8536fc209$exports, "useCalendarState", () => $6adad0c8536fc209$export$6d095e787d2b5e1f);
|
|
9
|
+
$parcel$export(module.exports, "useCalendarState", () => $6adad0c8536fc209$export$6d095e787d2b5e1f);
|
|
10
|
+
$parcel$export(module.exports, "useRangeCalendarState", () => $e49f7b861e5e8049$export$9a987164d97ecc90);
|
|
30
11
|
|
|
31
12
|
function $4301262d71f567b9$export$eac50920cf2fd59a(date, minValue, maxValue) {
|
|
32
13
|
return minValue != null && date.compare(minValue) < 0 || maxValue != null && date.compare(maxValue) > 0;
|
|
@@ -71,6 +52,13 @@ function $4301262d71f567b9$export$4f5203c0d889109e(date, minValue, maxValue) {
|
|
|
71
52
|
if (maxValue) date = $hEzMm$internationalizeddate.minDate(date, $hEzMm$internationalizeddate.toCalendarDate(maxValue));
|
|
72
53
|
return date;
|
|
73
54
|
}
|
|
55
|
+
function $4301262d71f567b9$export$a1d3911297b952d7(date, minValue, isDateUnavailable) {
|
|
56
|
+
if (!isDateUnavailable) return date;
|
|
57
|
+
while(date.compare(minValue) >= 0 && isDateUnavailable(date))date = date.subtract({
|
|
58
|
+
days: 1
|
|
59
|
+
});
|
|
60
|
+
if (date.compare(minValue) >= 0) return date;
|
|
61
|
+
}
|
|
74
62
|
|
|
75
63
|
|
|
76
64
|
|
|
@@ -87,7 +75,7 @@ function $6adad0c8536fc209$export$6d095e787d2b5e1f(props) {
|
|
|
87
75
|
]);
|
|
88
76
|
let { locale: locale , createCalendar: createCalendar , visibleDuration: visibleDuration = {
|
|
89
77
|
months: 1
|
|
90
|
-
} , minValue: minValue , maxValue: maxValue , selectionAlignment: selectionAlignment } = props;
|
|
78
|
+
} , minValue: minValue , maxValue: maxValue , selectionAlignment: selectionAlignment , isDateUnavailable: isDateUnavailable } = props;
|
|
91
79
|
let calendar = $hEzMm$react.useMemo(()=>createCalendar(resolvedOptions.calendar)
|
|
92
80
|
, [
|
|
93
81
|
createCalendar,
|
|
@@ -159,6 +147,9 @@ function $6adad0c8536fc209$export$6d095e787d2b5e1f(props) {
|
|
|
159
147
|
}
|
|
160
148
|
function setValue(newValue) {
|
|
161
149
|
if (!props.isDisabled && !props.isReadOnly) {
|
|
150
|
+
newValue = $4301262d71f567b9$export$4f5203c0d889109e(newValue, minValue, maxValue);
|
|
151
|
+
newValue = $4301262d71f567b9$export$a1d3911297b952d7(newValue, startDate, isDateUnavailable);
|
|
152
|
+
if (!newValue) return;
|
|
162
153
|
// The display calendar should not have any effect on the emitted value.
|
|
163
154
|
// Emit dates in the same calendar as the original value, if any, otherwise gregorian.
|
|
164
155
|
newValue = $hEzMm$internationalizeddate.toCalendar(newValue, (value === null || value === void 0 ? void 0 : value.calendar) || new $hEzMm$internationalizeddate.GregorianCalendar());
|
|
@@ -167,6 +158,17 @@ function $6adad0c8536fc209$export$6d095e787d2b5e1f(props) {
|
|
|
167
158
|
else setControlledValue(newValue);
|
|
168
159
|
}
|
|
169
160
|
}
|
|
161
|
+
let isUnavailable = $hEzMm$react.useMemo(()=>{
|
|
162
|
+
if (!calendarDateValue) return false;
|
|
163
|
+
if (isDateUnavailable && isDateUnavailable(calendarDateValue)) return true;
|
|
164
|
+
return $4301262d71f567b9$export$eac50920cf2fd59a(calendarDateValue, minValue, maxValue);
|
|
165
|
+
}, [
|
|
166
|
+
calendarDateValue,
|
|
167
|
+
isDateUnavailable,
|
|
168
|
+
minValue,
|
|
169
|
+
maxValue
|
|
170
|
+
]);
|
|
171
|
+
let validationState = props.validationState || (isUnavailable ? 'invalid' : null);
|
|
170
172
|
return {
|
|
171
173
|
isDisabled: props.isDisabled,
|
|
172
174
|
isReadOnly: props.isReadOnly,
|
|
@@ -176,8 +178,11 @@ function $6adad0c8536fc209$export$6d095e787d2b5e1f(props) {
|
|
|
176
178
|
start: startDate,
|
|
177
179
|
end: endDate
|
|
178
180
|
},
|
|
181
|
+
minValue: minValue,
|
|
182
|
+
maxValue: maxValue,
|
|
179
183
|
focusedDate: focusedDate,
|
|
180
184
|
timeZone: timeZone,
|
|
185
|
+
validationState: validationState,
|
|
181
186
|
setFocusedDate (date) {
|
|
182
187
|
focusCell(date);
|
|
183
188
|
setFocused(true);
|
|
@@ -207,20 +212,28 @@ function $6adad0c8536fc209$export$6d095e787d2b5e1f(props) {
|
|
|
207
212
|
focusNextPage () {
|
|
208
213
|
let start = startDate.add(visibleDuration);
|
|
209
214
|
setFocusedDate($4301262d71f567b9$export$4f5203c0d889109e(focusedDate.add(visibleDuration), minValue, maxValue));
|
|
210
|
-
setStartDate($4301262d71f567b9$export$5bb865b12696a77d(focusedDate, start, visibleDuration, locale, minValue, maxValue));
|
|
215
|
+
setStartDate($4301262d71f567b9$export$144a00ba6044eb9($4301262d71f567b9$export$5bb865b12696a77d(focusedDate, start, visibleDuration, locale, minValue, maxValue), visibleDuration, locale));
|
|
211
216
|
},
|
|
212
217
|
focusPreviousPage () {
|
|
213
218
|
let start = startDate.subtract(visibleDuration);
|
|
214
219
|
setFocusedDate($4301262d71f567b9$export$4f5203c0d889109e(focusedDate.subtract(visibleDuration), minValue, maxValue));
|
|
215
|
-
setStartDate($4301262d71f567b9$export$5bb865b12696a77d(focusedDate, start, visibleDuration, locale, minValue, maxValue));
|
|
220
|
+
setStartDate($4301262d71f567b9$export$144a00ba6044eb9($4301262d71f567b9$export$5bb865b12696a77d(focusedDate, start, visibleDuration, locale, minValue, maxValue), visibleDuration, locale));
|
|
216
221
|
},
|
|
217
|
-
|
|
218
|
-
focusCell(startDate);
|
|
222
|
+
focusSectionStart () {
|
|
223
|
+
if (visibleDuration.days) focusCell(startDate);
|
|
224
|
+
else if (visibleDuration.weeks) focusCell($hEzMm$internationalizeddate.startOfWeek(focusedDate, locale));
|
|
225
|
+
else if (visibleDuration.months || visibleDuration.years) focusCell($hEzMm$internationalizeddate.startOfMonth(focusedDate));
|
|
219
226
|
},
|
|
220
|
-
|
|
221
|
-
focusCell(endDate);
|
|
227
|
+
focusSectionEnd () {
|
|
228
|
+
if (visibleDuration.days) focusCell(endDate);
|
|
229
|
+
else if (visibleDuration.weeks) focusCell($hEzMm$internationalizeddate.endOfWeek(focusedDate, locale));
|
|
230
|
+
else if (visibleDuration.months || visibleDuration.years) focusCell($hEzMm$internationalizeddate.endOfMonth(focusedDate));
|
|
222
231
|
},
|
|
223
|
-
focusNextSection () {
|
|
232
|
+
focusNextSection (larger) {
|
|
233
|
+
if (!larger && !visibleDuration.days) {
|
|
234
|
+
focusCell(focusedDate.add($6adad0c8536fc209$var$unitDuration(visibleDuration)));
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
224
237
|
if (visibleDuration.days) this.focusNextPage();
|
|
225
238
|
else if (visibleDuration.weeks) focusCell(focusedDate.add({
|
|
226
239
|
months: 1
|
|
@@ -229,7 +242,11 @@ function $6adad0c8536fc209$export$6d095e787d2b5e1f(props) {
|
|
|
229
242
|
years: 1
|
|
230
243
|
}));
|
|
231
244
|
},
|
|
232
|
-
focusPreviousSection () {
|
|
245
|
+
focusPreviousSection (larger) {
|
|
246
|
+
if (!larger && !visibleDuration.days) {
|
|
247
|
+
focusCell(focusedDate.subtract($6adad0c8536fc209$var$unitDuration(visibleDuration)));
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
233
250
|
if (visibleDuration.days) this.focusPreviousPage();
|
|
234
251
|
else if (visibleDuration.weeks) focusCell(focusedDate.subtract({
|
|
235
252
|
months: 1
|
|
@@ -273,11 +290,15 @@ function $6adad0c8536fc209$export$6d095e787d2b5e1f(props) {
|
|
|
273
290
|
}
|
|
274
291
|
};
|
|
275
292
|
}
|
|
293
|
+
function $6adad0c8536fc209$var$unitDuration(duration) {
|
|
294
|
+
let unit = {
|
|
295
|
+
...duration
|
|
296
|
+
};
|
|
297
|
+
for(let key in duration)unit[key] = 1;
|
|
298
|
+
return unit;
|
|
299
|
+
}
|
|
276
300
|
|
|
277
301
|
|
|
278
|
-
var $e49f7b861e5e8049$exports = {};
|
|
279
|
-
|
|
280
|
-
$parcel$export($e49f7b861e5e8049$exports, "useRangeCalendarState", () => $e49f7b861e5e8049$export$9a987164d97ecc90);
|
|
281
302
|
|
|
282
303
|
|
|
283
304
|
|
|
@@ -352,6 +373,9 @@ function $e49f7b861e5e8049$export$9a987164d97ecc90(props) {
|
|
|
352
373
|
let highlightedRange = anchorDate ? $e49f7b861e5e8049$var$makeRange(anchorDate, calendar.focusedDate) : value && $e49f7b861e5e8049$var$makeRange(value.start, value.end);
|
|
353
374
|
let selectDate = (date)=>{
|
|
354
375
|
if (props.isReadOnly) return;
|
|
376
|
+
date = $4301262d71f567b9$export$4f5203c0d889109e(date, min, max);
|
|
377
|
+
date = $4301262d71f567b9$export$a1d3911297b952d7(date, calendar.visibleRange.start, props.isDateUnavailable);
|
|
378
|
+
if (!date) return;
|
|
355
379
|
if (!anchorDate) setAnchorDate(date);
|
|
356
380
|
else {
|
|
357
381
|
let range = $e49f7b861e5e8049$var$makeRange(anchorDate, date);
|
|
@@ -363,6 +387,19 @@ function $e49f7b861e5e8049$export$9a987164d97ecc90(props) {
|
|
|
363
387
|
}
|
|
364
388
|
};
|
|
365
389
|
let [isDragging, setDragging] = $hEzMm$react.useState(false);
|
|
390
|
+
let { isDateUnavailable: isDateUnavailable } = props;
|
|
391
|
+
let isInvalidSelection = $hEzMm$react.useMemo(()=>{
|
|
392
|
+
if (!value || anchorDate) return false;
|
|
393
|
+
if (isDateUnavailable && (isDateUnavailable(value.start) || isDateUnavailable(value.end))) return true;
|
|
394
|
+
return $4301262d71f567b9$export$eac50920cf2fd59a(value.start, minValue, maxValue) || $4301262d71f567b9$export$eac50920cf2fd59a(value.end, minValue, maxValue);
|
|
395
|
+
}, [
|
|
396
|
+
isDateUnavailable,
|
|
397
|
+
value,
|
|
398
|
+
anchorDate,
|
|
399
|
+
minValue,
|
|
400
|
+
maxValue
|
|
401
|
+
]);
|
|
402
|
+
let validationState = props.validationState || (isInvalidSelection ? 'invalid' : null);
|
|
366
403
|
return {
|
|
367
404
|
...calendar,
|
|
368
405
|
value: value,
|
|
@@ -370,6 +407,7 @@ function $e49f7b861e5e8049$export$9a987164d97ecc90(props) {
|
|
|
370
407
|
anchorDate: anchorDate,
|
|
371
408
|
setAnchorDate: setAnchorDate,
|
|
372
409
|
highlightedRange: highlightedRange,
|
|
410
|
+
validationState: validationState,
|
|
373
411
|
selectFocusedDate () {
|
|
374
412
|
selectDate(calendar.focusedDate);
|
|
375
413
|
},
|
|
@@ -421,9 +459,6 @@ function $e49f7b861e5e8049$var$nextUnavailableDate(anchorDate, state, dir) {
|
|
|
421
459
|
}
|
|
422
460
|
|
|
423
461
|
|
|
424
|
-
$parcel$exportWildcard(module.exports, $7a549489c00e7fe0$exports);
|
|
425
|
-
$parcel$exportWildcard(module.exports, $6adad0c8536fc209$exports);
|
|
426
|
-
$parcel$exportWildcard(module.exports, $e49f7b861e5e8049$exports);
|
|
427
462
|
|
|
428
463
|
|
|
429
464
|
//# 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,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,QAAsB,EAAE,MAAc,EAAE,QAAoB,EAAE,QAAoB,EAAE,CAAC;IACnI,GAAG,CAAC,YAAY,GAAiB,CAAC;IAAA,CAAC;IACnC,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,MA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AAI,EAAE,GAAG;IAAA,CAAC;IAGrC,EAAE,EAAE,KAAK,CAAC,iBAAiB,CAAC,QAAQ,GAClC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAAA,IAAI,GAAG,GAAG;IAAA,CAAC;IAGlC,MAAM,CAAC,IAAI;AACb,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 /** Whether the calendar is disabled. */\n readonly isDisabled: boolean,\n /** Whether the calendar is in a read only state. */\n readonly isReadOnly: boolean,\n /** The date range that is currently visible in the calendar. */\n readonly visibleRange: RangeValue<CalendarDate>,\n /** The time zone of the dates currently being displayed. */\n readonly timeZone: string,\n /** The currently focused date. */\n readonly focusedDate: CalendarDate,\n /** Sets the focused date. */\n setFocusedDate(value: CalendarDate): void,\n /** Moves focus to the next calendar date. */\n focusNextDay(): void,\n /** Moves focus to the previous calendar date. */\n focusPreviousDay(): void,\n /** Moves focus to the next row of dates, e.g. the next week. */\n focusNextRow(): void,\n /** Moves focus to the previous row of dates, e.g. the previous work. */\n focusPreviousRow(): void,\n /** Moves focus to the next page of dates, e.g. the next month if one month is visible. */\n focusNextPage(): void,\n /** Moves focus to the previous page of dates, e.g. the previous month if one month is visible. */\n focusPreviousPage(): void,\n /** Moves focus to the start of the current page of dates, e.g. the start of the first visible month. */\n focusPageStart(): void,\n /** Moves focus to the end of the current page of dates, e.g. the end of the last visible month. */\n focusPageEnd(): void,\n /**\n * Moves focus to the next larger section of dates based on what is currently displayed.\n * If days are displayed, then moves to the next visible range. If weeks are displayed, then\n * moves to the next month. If months or years are displayed, moves to the next year.\n */\n focusNextSection(): void,\n /**\n * Moves focus to the previous larger section of dates based on what is currently displayed.\n * If days are displayed, then moves to the previous visible range. If weeks are displayed, then\n * moves to the previous month. If months or years are displayed, moves to the previous year.\n */\n focusPreviousSection(): void,\n /** Selects the currently focused date. */\n selectFocusedDate(): void,\n /** Selects the given date. */\n selectDate(date: CalendarDate): void,\n /** Whether focus is currently within the calendar. */\n readonly isFocused: boolean,\n /** Sets whether focus is currently within the calendar. */\n setFocused(value: boolean): void,\n /** Returns whether the given date is invalid according to the `minValue` and `maxValue` props. */\n isInvalid(date: CalendarDate): boolean,\n /** Returns whether the given date is currently selected. */\n isSelected(date: CalendarDate): boolean,\n /** Returns whether the given date is currently focused. */\n isCellFocused(date: CalendarDate): boolean,\n /** Returns whether the given date is disabled according to the `minValue, `maxValue`, and `isDisabled` props. */\n isCellDisabled(date: CalendarDate): boolean,\n /** Returns whether the given date is unavailable according to the `isDateUnavailable` prop. */\n isCellUnavailable(date: CalendarDate): boolean,\n /** Returns whether the previous visible date range is allowed to be selected according to the `minValue` prop. */\n isPreviousVisibleRangeInvalid(): boolean,\n /** Returns whether the next visible date range is allowed to be selected according to the `maxValue` prop. */\n isNextVisibleRangeInvalid(): boolean\n}\n\nexport interface CalendarState extends CalendarStateBase {\n /** The currently selected date. */\n readonly value: CalendarDate,\n /** Sets the currently selected date. */\n setValue(value: CalendarDate): void\n}\n\nexport interface RangeCalendarState extends CalendarStateBase {\n /** The currently selected date range. */\n readonly value: RangeValue<DateValue>,\n /** Sets the currently selected date range. */\n setValue(value: RangeValue<DateValue>): void,\n /** Highlights the given date during selection, e.g. by hovering or dragging. */\n highlightDate(date: CalendarDate): void,\n /** The current anchor date that the user clicked on to begin range selection. */\n readonly anchorDate: CalendarDate | null,\n /** Sets the anchor date that the user clicked on to begin range selection. */\n setAnchorDate(date: CalendarDate | null): void,\n /** The currently highlighted date range. */\n readonly highlightedRange: RangeValue<CalendarDate>,\n /** Whether the user is currently dragging over the calendar. */\n readonly isDragging: boolean,\n /** Sets whether the user is dragging over the calendar. */\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 DateDuration,\n DateFormatter,\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 {useMemo, useRef, useState} from 'react';\n\ninterface CalendarStateOptions extends CalendarProps<DateValue> {\n /** The locale to display and edit the value according to. */\n locale: string,\n /**\n * A function that creates a [Calendar](../internationalized/date/Calendar.html)\n * object for a given calendar identifier. Such a function may be imported from the\n * `@internationalized/date` package, or manually implemented to include support for\n * only certain calendars.\n */\n createCalendar: (name: string) => Calendar,\n /**\n * The amount of days that will be displayed at once. This affects how pagination works.\n * @default {months: 1}\n */\n visibleDuration?: DateDuration,\n /** Determines how to align the initial selection relative to the visible date range. */\n selectionAlignment?: 'start' | 'center' | 'end'\n}\n\n/**\n * Provides state management for a calendar component.\n * A calendar displays one or more date grids and allows users to select a single date.\n */\nexport function useCalendarState(props: CalendarStateOptions): CalendarState {\n let defaultFormatter = useMemo(() => new DateFormatter(props.locale), [props.locale]);\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 focusedCalendarDate = useMemo(() => (\n props.focusedValue\n ? constrainValue(toCalendar(toCalendarDate(props.focusedValue), calendar), minValue, maxValue)\n : undefined\n ), [props.focusedValue, calendar, minValue, maxValue]);\n let defaultFocusedCalendarDate = useMemo(() => (\n constrainValue(\n props.defaultFocusedValue\n ? toCalendar(toCalendarDate(props.defaultFocusedValue), calendar)\n : calendarDateValue || toCalendar(today(timeZone), calendar),\n minValue,\n maxValue\n )\n ), [props.defaultFocusedValue, calendarDateValue, timeZone, calendar, minValue, maxValue]);\n let [focusedDate, setFocusedDate] = useControlledState(focusedCalendarDate, defaultFocusedCalendarDate, props.onFocusChange);\n let [startDate, setStartDate] = useState(() => {\n switch (selectionAlignment) {\n case 'start':\n return alignStart(focusedDate, visibleDuration, locale, minValue, maxValue);\n case 'end':\n return alignEnd(focusedDate, visibleDuration, locale, minValue, maxValue);\n case 'center':\n default:\n return alignCenter(focusedDate, visibleDuration, locale, minValue, maxValue);\n }\n });\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 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\n if (isInvalid(focusedDate, minValue, maxValue)) {\n // If the focused date was moved to an invalid value, it can't be focused, so constrain it.\n setFocusedDate(constrainValue(focusedDate, minValue, maxValue));\n } else if (focusedDate.compare(startDate) < 0) {\n setStartDate(alignEnd(focusedDate, visibleDuration, locale, minValue, maxValue));\n } else if (focusedDate.compare(startDate.add(visibleDuration)) >= 0) {\n setStartDate(alignStart(focusedDate, visibleDuration, locale, minValue, maxValue));\n }\n\n // Sets focus to a specific cell date\n function focusCell(date: CalendarDate) {\n date = constrainValue(date, minValue, maxValue);\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 focusCell(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 setFocusedDate(constrainValue(focusedDate.add(visibleDuration), minValue, maxValue));\n setStartDate(constrainStart(focusedDate, start, visibleDuration, locale, minValue, maxValue));\n },\n focusPreviousPage() {\n let start = startDate.subtract(visibleDuration);\n setFocusedDate(constrainValue(focusedDate.subtract(visibleDuration), minValue, maxValue));\n setStartDate(constrainStart(focusedDate, start, visibleDuration, locale, 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) && !this.isCellDisabled(date) && !this.isCellUnavailable(date);\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 || this.isInvalid(date, minValue, maxValue);\n },\n isCellUnavailable(date) {\n return props.isDateUnavailable && props.isDateUnavailable(date);\n },\n isPreviousVisibleRangeInvalid() {\n return this.isInvalid(startDate.subtract({days: 1}), minValue, maxValue);\n },\n isNextVisibleRangeInvalid() {\n return this.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 DateDuration,\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: DateDuration, locale: string, minValue?: DateValue, maxValue?: DateValue) {\n let halfDuration: DateDuration = {};\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: DateDuration, 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: DateDuration, 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: DateDuration,\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, isInvalid} from './utils';\nimport {Calendar, CalendarDate, DateDuration, GregorianCalendar, isEqualDay, maxDate, minDate, toCalendar, toCalendarDate} from '@internationalized/date';\nimport {CalendarState, RangeCalendarState} from './types';\nimport {DateRange, DateValue} from '@react-types/calendar';\nimport {RangeCalendarProps} from '@react-types/calendar';\nimport {RangeValue} from '@react-types/shared';\nimport {useCalendarState} from './useCalendarState';\nimport {useControlledState} from '@react-stately/utils';\nimport {useMemo, useRef, useState} from 'react';\n\ninterface RangeCalendarStateOptions extends RangeCalendarProps<DateValue> {\n /** The locale to display and edit the value according to. */\n locale: string,\n /**\n * A function that creates a [Calendar](../internationalized/date/Calendar.html)\n * object for a given calendar identifier. Such a function may be imported from the\n * `@internationalized/date` package, or manually implemented to include support for\n * only certain calendars.\n */\n createCalendar: (name: string) => Calendar,\n /**\n * The amount of days that will be displayed at once. This affects how pagination works.\n * @default {months: 1}\n */\n visibleDuration?: DateDuration\n}\n\n/**\n * Provides state management for a range calendar component.\n * A range calendar displays one or more date grids and allows users to select a contiguous range of dates.\n */\nexport function useRangeCalendarState(props: RangeCalendarStateOptions): 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 || null,\n onChange\n );\n\n let [anchorDate, setAnchorDateState] = 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 // Available range must be stored in a ref so we have access to the updated version immediately in `isInvalid`.\n let availableRangeRef = useRef<RangeValue<DateValue>>(null);\n let [availableRange, setAvailableRange] = useState<RangeValue<DateValue>>(null);\n let min = useMemo(() => maxDate(minValue, availableRange?.start), [minValue, availableRange]);\n let max = useMemo(() => minDate(maxValue, availableRange?.end), [maxValue, availableRange]);\n\n let calendar = useCalendarState({\n ...calendarProps,\n value: value && value.start,\n createCalendar,\n locale,\n visibleDuration,\n minValue: min,\n maxValue: max,\n selectionAlignment: alignment\n });\n\n let updateAvailableRange = (date) => {\n if (date && props.isDateUnavailable && !props.allowsNonContiguousRanges) {\n availableRangeRef.current = {\n start: nextUnavailableDate(date, calendar, -1),\n end: nextUnavailableDate(date, calendar, 1)\n };\n setAvailableRange(availableRangeRef.current);\n } else {\n availableRangeRef.current = null;\n setAvailableRange(null);\n }\n };\n\n // If the visible range changes, we need to update the available range.\n let lastVisibleRange = useRef(calendar.visibleRange);\n if (!isEqualDay(calendar.visibleRange.start, lastVisibleRange.current.start) || !isEqualDay(calendar.visibleRange.end, lastVisibleRange.current.end)) {\n updateAvailableRange(anchorDate);\n lastVisibleRange.current = calendar.visibleRange;\n }\n\n let setAnchorDate = (date: CalendarDate) => {\n if (date) {\n setAnchorDateState(date);\n updateAvailableRange(date);\n } else {\n setAnchorDateState(null);\n updateAvailableRange(null);\n }\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 && !calendar.isCellDisabled(date) && !calendar.isCellUnavailable(date);\n },\n isInvalid(date) {\n return calendar.isInvalid(date) || isInvalid(date, availableRangeRef.current?.start, availableRangeRef.current?.end);\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\nfunction nextUnavailableDate(anchorDate: CalendarDate, state: CalendarState, dir: number) {\n let nextDate = anchorDate.add({days: dir});\n while (\n (dir < 0 ? nextDate.compare(state.visibleRange.start) >= 0 : nextDate.compare(state.visibleRange.end) <= 0) &&\n !state.isCellUnavailable(nextDate)\n ) {\n nextDate = nextDate.add({days: dir});\n }\n\n if (state.isCellUnavailable(nextDate)) {\n return nextDate.add({days: -dir});\n }\n\n return null;\n}\n"],"names":[],"version":3,"file":"main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;SEuBgB,yCAAS,CAAC,IAAe,EAAE,QAAmB,EAAE,QAAmB,EAAE,CAAC;IACpF,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,QAAsB,EAAE,MAAc,EAAE,QAAoB,EAAE,QAAoB,EAAE,CAAC;IACnI,GAAG,CAAC,YAAY,GAAiB,CAAC;IAAA,CAAC;IACnC,GAAG,CAAE,GAAG,CAAC,GAAG,IAAI,QAAQ,CAAE,CAAC;QACzB,YAAY,CAAC,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,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I,CAAJ,CAAkB,GAAlB,IAAI,CAAJ,CAAkB,GAAlB,QAAQ,CAAE,QAAQ,KAAI,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;SAEQ,yCAAmB,CAAC,UAAwB,EAAE,KAAoB,EAAE,GAAW,EAAE,CAAC;IACzF,GAAG,CAAC,QAAQ,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;QAAA,IAAI,EAAE,GAAG;IAAA,CAAC;WAEtC,GAAG,GAAG,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,KAAK,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,KAAK,CAAC,MACzG,KAAK,CAAC,iBAAiB,CAAC,QAAQ,EAEjC,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;QAAA,IAAI,EAAE,GAAG;IAAA,CAAC;IAGrC,EAAE,EAAE,KAAK,CAAC,iBAAiB,CAAC,QAAQ,GAClC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAAA,IAAI,GAAG,GAAG;IAAA,CAAC;IAGlC,MAAM,CAAC,IAAI;AACb,CAAC;;","sources":["packages/@react-stately/calendar/src/index.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 {useCalendarState} from './useCalendarState';\nexport {useRangeCalendarState} from './useRangeCalendarState';\n\nexport type {CalendarStateOptions} from './useCalendarState';\nexport type {RangeCalendarStateOptions} from './useRangeCalendarState';\nexport type {CalendarState, RangeCalendarState} from './types';\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, previousAvailableDate} from './utils';\nimport {\n Calendar,\n CalendarDate,\n DateDuration,\n DateFormatter,\n endOfMonth,\n endOfWeek,\n GregorianCalendar,\n isSameDay,\n startOfMonth,\n startOfWeek,\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 {useMemo, useRef, useState} from 'react';\n\nexport interface CalendarStateOptions extends CalendarProps<DateValue> {\n /** The locale to display and edit the value according to. */\n locale: string,\n /**\n * A function that creates a [Calendar](../internationalized/date/Calendar.html)\n * object for a given calendar identifier. Such a function may be imported from the\n * `@internationalized/date` package, or manually implemented to include support for\n * only certain calendars.\n */\n createCalendar: (name: string) => Calendar,\n /**\n * The amount of days that will be displayed at once. This affects how pagination works.\n * @default {months: 1}\n */\n visibleDuration?: DateDuration,\n /** Determines how to align the initial selection relative to the visible date range. */\n selectionAlignment?: 'start' | 'center' | 'end'\n}\n\n/**\n * Provides state management for a calendar component.\n * A calendar displays one or more date grids and allows users to select a single date.\n */\nexport function useCalendarState(props: CalendarStateOptions): CalendarState {\n let defaultFormatter = useMemo(() => new DateFormatter(props.locale), [props.locale]);\n let resolvedOptions = useMemo(() => defaultFormatter.resolvedOptions(), [defaultFormatter]);\n let {\n locale,\n createCalendar,\n visibleDuration = {months: 1},\n minValue,\n maxValue,\n selectionAlignment,\n isDateUnavailable\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 focusedCalendarDate = useMemo(() => (\n props.focusedValue\n ? constrainValue(toCalendar(toCalendarDate(props.focusedValue), calendar), minValue, maxValue)\n : undefined\n ), [props.focusedValue, calendar, minValue, maxValue]);\n let defaultFocusedCalendarDate = useMemo(() => (\n constrainValue(\n props.defaultFocusedValue\n ? toCalendar(toCalendarDate(props.defaultFocusedValue), calendar)\n : calendarDateValue || toCalendar(today(timeZone), calendar),\n minValue,\n maxValue\n )\n ), [props.defaultFocusedValue, calendarDateValue, timeZone, calendar, minValue, maxValue]);\n let [focusedDate, setFocusedDate] = useControlledState(focusedCalendarDate, defaultFocusedCalendarDate, props.onFocusChange);\n let [startDate, setStartDate] = useState(() => {\n switch (selectionAlignment) {\n case 'start':\n return alignStart(focusedDate, visibleDuration, locale, minValue, maxValue);\n case 'end':\n return alignEnd(focusedDate, visibleDuration, locale, minValue, maxValue);\n case 'center':\n default:\n return alignCenter(focusedDate, visibleDuration, locale, minValue, maxValue);\n }\n });\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 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\n if (isInvalid(focusedDate, minValue, maxValue)) {\n // If the focused date was moved to an invalid value, it can't be focused, so constrain it.\n setFocusedDate(constrainValue(focusedDate, minValue, maxValue));\n } else if (focusedDate.compare(startDate) < 0) {\n setStartDate(alignEnd(focusedDate, visibleDuration, locale, minValue, maxValue));\n } else if (focusedDate.compare(startDate.add(visibleDuration)) >= 0) {\n setStartDate(alignStart(focusedDate, visibleDuration, locale, minValue, maxValue));\n }\n\n // Sets focus to a specific cell date\n function focusCell(date: CalendarDate) {\n date = constrainValue(date, minValue, maxValue);\n setFocusedDate(date);\n }\n\n function setValue(newValue: CalendarDate) {\n if (!props.isDisabled && !props.isReadOnly) {\n newValue = constrainValue(newValue, minValue, maxValue);\n newValue = previousAvailableDate(newValue, startDate, isDateUnavailable);\n if (!newValue) {\n return;\n }\n\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 let isUnavailable = useMemo(() => {\n if (!calendarDateValue) {\n return false;\n }\n\n if (isDateUnavailable && isDateUnavailable(calendarDateValue)) {\n return true;\n }\n\n return isInvalid(calendarDateValue, minValue, maxValue);\n }, [calendarDateValue, isDateUnavailable, minValue, maxValue]);\n let validationState = props.validationState || (isUnavailable ? 'invalid' : null);\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 minValue,\n maxValue,\n focusedDate,\n timeZone,\n validationState,\n setFocusedDate(date) {\n focusCell(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 setFocusedDate(constrainValue(focusedDate.add(visibleDuration), minValue, maxValue));\n setStartDate(\n alignStart(\n constrainStart(focusedDate, start, visibleDuration, locale, minValue, maxValue),\n visibleDuration,\n locale\n )\n );\n },\n focusPreviousPage() {\n let start = startDate.subtract(visibleDuration);\n setFocusedDate(constrainValue(focusedDate.subtract(visibleDuration), minValue, maxValue));\n setStartDate(\n alignStart(\n constrainStart(focusedDate, start, visibleDuration, locale, minValue, maxValue),\n visibleDuration,\n locale\n )\n );\n },\n focusSectionStart() {\n if (visibleDuration.days) {\n focusCell(startDate);\n } else if (visibleDuration.weeks) {\n focusCell(startOfWeek(focusedDate, locale));\n } else if (visibleDuration.months || visibleDuration.years) {\n focusCell(startOfMonth(focusedDate));\n }\n },\n focusSectionEnd() {\n if (visibleDuration.days) {\n focusCell(endDate);\n } else if (visibleDuration.weeks) {\n focusCell(endOfWeek(focusedDate, locale));\n } else if (visibleDuration.months || visibleDuration.years) {\n focusCell(endOfMonth(focusedDate));\n }\n },\n focusNextSection(larger) {\n if (!larger && !visibleDuration.days) {\n focusCell(focusedDate.add(unitDuration(visibleDuration)));\n return;\n }\n\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(larger) {\n if (!larger && !visibleDuration.days) {\n focusCell(focusedDate.subtract(unitDuration(visibleDuration)));\n return;\n }\n\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) && !this.isCellDisabled(date) && !this.isCellUnavailable(date);\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 || this.isInvalid(date, minValue, maxValue);\n },\n isCellUnavailable(date) {\n return props.isDateUnavailable && props.isDateUnavailable(date);\n },\n isPreviousVisibleRangeInvalid() {\n return this.isInvalid(startDate.subtract({days: 1}), minValue, maxValue);\n },\n isNextVisibleRangeInvalid() {\n return this.isInvalid(endDate.add({days: 1}), minValue, maxValue);\n }\n };\n}\n\nfunction unitDuration(duration: DateDuration) {\n let unit = {...duration};\n for (let key in duration) {\n unit[key] = 1;\n }\n return unit;\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 DateDuration,\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: DateValue, 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: DateDuration, locale: string, minValue?: DateValue, maxValue?: DateValue) {\n let halfDuration: DateDuration = {};\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: DateDuration, 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: DateDuration, 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: DateDuration,\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\nexport function previousAvailableDate(date: CalendarDate, minValue: DateValue, isDateUnavailable: (date: CalendarDate) => boolean) {\n if (!isDateUnavailable) {\n return date;\n }\n\n while (date.compare(minValue) >= 0 && isDateUnavailable(date)) {\n date = date.subtract({days: 1});\n }\n\n if (date.compare(minValue) >= 0) {\n return date;\n }\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {alignCenter, constrainValue, isInvalid, previousAvailableDate} from './utils';\nimport {Calendar, CalendarDate, DateDuration, GregorianCalendar, isEqualDay, maxDate, minDate, toCalendar, toCalendarDate} from '@internationalized/date';\nimport {CalendarState, RangeCalendarState} from './types';\nimport {DateRange, DateValue} from '@react-types/calendar';\nimport {RangeCalendarProps} from '@react-types/calendar';\nimport {RangeValue} from '@react-types/shared';\nimport {useCalendarState} from './useCalendarState';\nimport {useControlledState} from '@react-stately/utils';\nimport {useMemo, useRef, useState} from 'react';\n\nexport interface RangeCalendarStateOptions extends RangeCalendarProps<DateValue> {\n /** The locale to display and edit the value according to. */\n locale: string,\n /**\n * A function that creates a [Calendar](../internationalized/date/Calendar.html)\n * object for a given calendar identifier. Such a function may be imported from the\n * `@internationalized/date` package, or manually implemented to include support for\n * only certain calendars.\n */\n createCalendar: (name: string) => Calendar,\n /**\n * The amount of days that will be displayed at once. This affects how pagination works.\n * @default {months: 1}\n */\n visibleDuration?: DateDuration\n}\n\n/**\n * Provides state management for a range calendar component.\n * A range calendar displays one or more date grids and allows users to select a contiguous range of dates.\n */\nexport function useRangeCalendarState(props: RangeCalendarStateOptions): 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 || null,\n onChange\n );\n\n let [anchorDate, setAnchorDateState] = 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 // Available range must be stored in a ref so we have access to the updated version immediately in `isInvalid`.\n let availableRangeRef = useRef<RangeValue<DateValue>>(null);\n let [availableRange, setAvailableRange] = useState<RangeValue<DateValue>>(null);\n let min = useMemo(() => maxDate(minValue, availableRange?.start), [minValue, availableRange]);\n let max = useMemo(() => minDate(maxValue, availableRange?.end), [maxValue, availableRange]);\n\n let calendar = useCalendarState({\n ...calendarProps,\n value: value && value.start,\n createCalendar,\n locale,\n visibleDuration,\n minValue: min,\n maxValue: max,\n selectionAlignment: alignment\n });\n\n let updateAvailableRange = (date) => {\n if (date && props.isDateUnavailable && !props.allowsNonContiguousRanges) {\n availableRangeRef.current = {\n start: nextUnavailableDate(date, calendar, -1),\n end: nextUnavailableDate(date, calendar, 1)\n };\n setAvailableRange(availableRangeRef.current);\n } else {\n availableRangeRef.current = null;\n setAvailableRange(null);\n }\n };\n\n // If the visible range changes, we need to update the available range.\n let lastVisibleRange = useRef(calendar.visibleRange);\n if (!isEqualDay(calendar.visibleRange.start, lastVisibleRange.current.start) || !isEqualDay(calendar.visibleRange.end, lastVisibleRange.current.end)) {\n updateAvailableRange(anchorDate);\n lastVisibleRange.current = calendar.visibleRange;\n }\n\n let setAnchorDate = (date: CalendarDate) => {\n if (date) {\n setAnchorDateState(date);\n updateAvailableRange(date);\n } else {\n setAnchorDateState(null);\n updateAvailableRange(null);\n }\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 date = constrainValue(date, min, max);\n date = previousAvailableDate(date, calendar.visibleRange.start, props.isDateUnavailable);\n if (!date) {\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 let {isDateUnavailable} = props;\n let isInvalidSelection = useMemo(() => {\n if (!value || anchorDate) {\n return false;\n }\n\n if (isDateUnavailable && (isDateUnavailable(value.start) || isDateUnavailable(value.end))) {\n return true;\n }\n\n return isInvalid(value.start, minValue, maxValue) || isInvalid(value.end, minValue, maxValue);\n }, [isDateUnavailable, value, anchorDate, minValue, maxValue]);\n\n let validationState = props.validationState || (isInvalidSelection ? 'invalid' : null);\n\n return {\n ...calendar,\n value,\n setValue,\n anchorDate,\n setAnchorDate,\n highlightedRange,\n validationState,\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 && !calendar.isCellDisabled(date) && !calendar.isCellUnavailable(date);\n },\n isInvalid(date) {\n return calendar.isInvalid(date) || isInvalid(date, availableRangeRef.current?.start, availableRangeRef.current?.end);\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\nfunction nextUnavailableDate(anchorDate: CalendarDate, state: CalendarState, dir: number) {\n let nextDate = anchorDate.add({days: dir});\n while (\n (dir < 0 ? nextDate.compare(state.visibleRange.start) >= 0 : nextDate.compare(state.visibleRange.end) <= 0) &&\n !state.isCellUnavailable(nextDate)\n ) {\n nextDate = nextDate.add({days: dir});\n }\n\n if (state.isCellUnavailable(nextDate)) {\n return nextDate.add({days: -dir});\n }\n\n return null;\n}\n"],"names":[],"version":3,"file":"main.js.map"}
|
package/dist/module.js
CHANGED
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
import {DateFormatter as $keQhS$DateFormatter, toCalendar as $keQhS$toCalendar, toCalendarDate as $keQhS$toCalendarDate, today as $keQhS$today, GregorianCalendar as $keQhS$GregorianCalendar,
|
|
1
|
+
import {DateFormatter as $keQhS$DateFormatter, toCalendar as $keQhS$toCalendar, toCalendarDate as $keQhS$toCalendarDate, today as $keQhS$today, GregorianCalendar as $keQhS$GregorianCalendar, startOfWeek as $keQhS$startOfWeek, startOfMonth as $keQhS$startOfMonth, endOfWeek as $keQhS$endOfWeek, endOfMonth as $keQhS$endOfMonth, isSameDay as $keQhS$isSameDay, startOfYear as $keQhS$startOfYear, maxDate as $keQhS$maxDate, minDate as $keQhS$minDate, isEqualDay as $keQhS$isEqualDay} from "@internationalized/date";
|
|
2
2
|
import {useControlledState as $keQhS$useControlledState} from "@react-stately/utils";
|
|
3
3
|
import {useMemo as $keQhS$useMemo, useState as $keQhS$useState, useRef as $keQhS$useRef} from "react";
|
|
4
4
|
|
|
5
|
-
function $parcel$export(e, n, v, s) {
|
|
6
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
7
|
-
}
|
|
8
|
-
var $77b8da46fac7b53e$exports = {};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var $131cf43a05231e1e$exports = {};
|
|
12
|
-
|
|
13
|
-
$parcel$export($131cf43a05231e1e$exports, "useCalendarState", () => $131cf43a05231e1e$export$6d095e787d2b5e1f);
|
|
14
5
|
|
|
15
6
|
function $f62d864046160412$export$eac50920cf2fd59a(date, minValue, maxValue) {
|
|
16
7
|
return minValue != null && date.compare(minValue) < 0 || maxValue != null && date.compare(maxValue) > 0;
|
|
@@ -55,6 +46,13 @@ function $f62d864046160412$export$4f5203c0d889109e(date, minValue, maxValue) {
|
|
|
55
46
|
if (maxValue) date = $keQhS$minDate(date, $keQhS$toCalendarDate(maxValue));
|
|
56
47
|
return date;
|
|
57
48
|
}
|
|
49
|
+
function $f62d864046160412$export$a1d3911297b952d7(date, minValue, isDateUnavailable) {
|
|
50
|
+
if (!isDateUnavailable) return date;
|
|
51
|
+
while(date.compare(minValue) >= 0 && isDateUnavailable(date))date = date.subtract({
|
|
52
|
+
days: 1
|
|
53
|
+
});
|
|
54
|
+
if (date.compare(minValue) >= 0) return date;
|
|
55
|
+
}
|
|
58
56
|
|
|
59
57
|
|
|
60
58
|
|
|
@@ -71,7 +69,7 @@ function $131cf43a05231e1e$export$6d095e787d2b5e1f(props) {
|
|
|
71
69
|
]);
|
|
72
70
|
let { locale: locale , createCalendar: createCalendar , visibleDuration: visibleDuration = {
|
|
73
71
|
months: 1
|
|
74
|
-
} , minValue: minValue , maxValue: maxValue , selectionAlignment: selectionAlignment } = props;
|
|
72
|
+
} , minValue: minValue , maxValue: maxValue , selectionAlignment: selectionAlignment , isDateUnavailable: isDateUnavailable } = props;
|
|
75
73
|
let calendar = $keQhS$useMemo(()=>createCalendar(resolvedOptions.calendar)
|
|
76
74
|
, [
|
|
77
75
|
createCalendar,
|
|
@@ -143,6 +141,9 @@ function $131cf43a05231e1e$export$6d095e787d2b5e1f(props) {
|
|
|
143
141
|
}
|
|
144
142
|
function setValue(newValue) {
|
|
145
143
|
if (!props.isDisabled && !props.isReadOnly) {
|
|
144
|
+
newValue = $f62d864046160412$export$4f5203c0d889109e(newValue, minValue, maxValue);
|
|
145
|
+
newValue = $f62d864046160412$export$a1d3911297b952d7(newValue, startDate, isDateUnavailable);
|
|
146
|
+
if (!newValue) return;
|
|
146
147
|
// The display calendar should not have any effect on the emitted value.
|
|
147
148
|
// Emit dates in the same calendar as the original value, if any, otherwise gregorian.
|
|
148
149
|
newValue = $keQhS$toCalendar(newValue, (value === null || value === void 0 ? void 0 : value.calendar) || new $keQhS$GregorianCalendar());
|
|
@@ -151,6 +152,17 @@ function $131cf43a05231e1e$export$6d095e787d2b5e1f(props) {
|
|
|
151
152
|
else setControlledValue(newValue);
|
|
152
153
|
}
|
|
153
154
|
}
|
|
155
|
+
let isUnavailable = $keQhS$useMemo(()=>{
|
|
156
|
+
if (!calendarDateValue) return false;
|
|
157
|
+
if (isDateUnavailable && isDateUnavailable(calendarDateValue)) return true;
|
|
158
|
+
return $f62d864046160412$export$eac50920cf2fd59a(calendarDateValue, minValue, maxValue);
|
|
159
|
+
}, [
|
|
160
|
+
calendarDateValue,
|
|
161
|
+
isDateUnavailable,
|
|
162
|
+
minValue,
|
|
163
|
+
maxValue
|
|
164
|
+
]);
|
|
165
|
+
let validationState = props.validationState || (isUnavailable ? 'invalid' : null);
|
|
154
166
|
return {
|
|
155
167
|
isDisabled: props.isDisabled,
|
|
156
168
|
isReadOnly: props.isReadOnly,
|
|
@@ -160,8 +172,11 @@ function $131cf43a05231e1e$export$6d095e787d2b5e1f(props) {
|
|
|
160
172
|
start: startDate,
|
|
161
173
|
end: endDate
|
|
162
174
|
},
|
|
175
|
+
minValue: minValue,
|
|
176
|
+
maxValue: maxValue,
|
|
163
177
|
focusedDate: focusedDate,
|
|
164
178
|
timeZone: timeZone,
|
|
179
|
+
validationState: validationState,
|
|
165
180
|
setFocusedDate (date) {
|
|
166
181
|
focusCell(date);
|
|
167
182
|
setFocused(true);
|
|
@@ -191,20 +206,28 @@ function $131cf43a05231e1e$export$6d095e787d2b5e1f(props) {
|
|
|
191
206
|
focusNextPage () {
|
|
192
207
|
let start = startDate.add(visibleDuration);
|
|
193
208
|
setFocusedDate($f62d864046160412$export$4f5203c0d889109e(focusedDate.add(visibleDuration), minValue, maxValue));
|
|
194
|
-
setStartDate($f62d864046160412$export$5bb865b12696a77d(focusedDate, start, visibleDuration, locale, minValue, maxValue));
|
|
209
|
+
setStartDate($f62d864046160412$export$144a00ba6044eb9($f62d864046160412$export$5bb865b12696a77d(focusedDate, start, visibleDuration, locale, minValue, maxValue), visibleDuration, locale));
|
|
195
210
|
},
|
|
196
211
|
focusPreviousPage () {
|
|
197
212
|
let start = startDate.subtract(visibleDuration);
|
|
198
213
|
setFocusedDate($f62d864046160412$export$4f5203c0d889109e(focusedDate.subtract(visibleDuration), minValue, maxValue));
|
|
199
|
-
setStartDate($f62d864046160412$export$5bb865b12696a77d(focusedDate, start, visibleDuration, locale, minValue, maxValue));
|
|
214
|
+
setStartDate($f62d864046160412$export$144a00ba6044eb9($f62d864046160412$export$5bb865b12696a77d(focusedDate, start, visibleDuration, locale, minValue, maxValue), visibleDuration, locale));
|
|
200
215
|
},
|
|
201
|
-
|
|
202
|
-
focusCell(startDate);
|
|
216
|
+
focusSectionStart () {
|
|
217
|
+
if (visibleDuration.days) focusCell(startDate);
|
|
218
|
+
else if (visibleDuration.weeks) focusCell($keQhS$startOfWeek(focusedDate, locale));
|
|
219
|
+
else if (visibleDuration.months || visibleDuration.years) focusCell($keQhS$startOfMonth(focusedDate));
|
|
203
220
|
},
|
|
204
|
-
|
|
205
|
-
focusCell(endDate);
|
|
221
|
+
focusSectionEnd () {
|
|
222
|
+
if (visibleDuration.days) focusCell(endDate);
|
|
223
|
+
else if (visibleDuration.weeks) focusCell($keQhS$endOfWeek(focusedDate, locale));
|
|
224
|
+
else if (visibleDuration.months || visibleDuration.years) focusCell($keQhS$endOfMonth(focusedDate));
|
|
206
225
|
},
|
|
207
|
-
focusNextSection () {
|
|
226
|
+
focusNextSection (larger) {
|
|
227
|
+
if (!larger && !visibleDuration.days) {
|
|
228
|
+
focusCell(focusedDate.add($131cf43a05231e1e$var$unitDuration(visibleDuration)));
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
208
231
|
if (visibleDuration.days) this.focusNextPage();
|
|
209
232
|
else if (visibleDuration.weeks) focusCell(focusedDate.add({
|
|
210
233
|
months: 1
|
|
@@ -213,7 +236,11 @@ function $131cf43a05231e1e$export$6d095e787d2b5e1f(props) {
|
|
|
213
236
|
years: 1
|
|
214
237
|
}));
|
|
215
238
|
},
|
|
216
|
-
focusPreviousSection () {
|
|
239
|
+
focusPreviousSection (larger) {
|
|
240
|
+
if (!larger && !visibleDuration.days) {
|
|
241
|
+
focusCell(focusedDate.subtract($131cf43a05231e1e$var$unitDuration(visibleDuration)));
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
217
244
|
if (visibleDuration.days) this.focusPreviousPage();
|
|
218
245
|
else if (visibleDuration.weeks) focusCell(focusedDate.subtract({
|
|
219
246
|
months: 1
|
|
@@ -257,11 +284,15 @@ function $131cf43a05231e1e$export$6d095e787d2b5e1f(props) {
|
|
|
257
284
|
}
|
|
258
285
|
};
|
|
259
286
|
}
|
|
287
|
+
function $131cf43a05231e1e$var$unitDuration(duration) {
|
|
288
|
+
let unit = {
|
|
289
|
+
...duration
|
|
290
|
+
};
|
|
291
|
+
for(let key in duration)unit[key] = 1;
|
|
292
|
+
return unit;
|
|
293
|
+
}
|
|
260
294
|
|
|
261
295
|
|
|
262
|
-
var $9a36b6ba2fb1a7c5$exports = {};
|
|
263
|
-
|
|
264
|
-
$parcel$export($9a36b6ba2fb1a7c5$exports, "useRangeCalendarState", () => $9a36b6ba2fb1a7c5$export$9a987164d97ecc90);
|
|
265
296
|
|
|
266
297
|
|
|
267
298
|
|
|
@@ -336,6 +367,9 @@ function $9a36b6ba2fb1a7c5$export$9a987164d97ecc90(props) {
|
|
|
336
367
|
let highlightedRange = anchorDate ? $9a36b6ba2fb1a7c5$var$makeRange(anchorDate, calendar.focusedDate) : value && $9a36b6ba2fb1a7c5$var$makeRange(value.start, value.end);
|
|
337
368
|
let selectDate = (date)=>{
|
|
338
369
|
if (props.isReadOnly) return;
|
|
370
|
+
date = $f62d864046160412$export$4f5203c0d889109e(date, min, max);
|
|
371
|
+
date = $f62d864046160412$export$a1d3911297b952d7(date, calendar.visibleRange.start, props.isDateUnavailable);
|
|
372
|
+
if (!date) return;
|
|
339
373
|
if (!anchorDate) setAnchorDate(date);
|
|
340
374
|
else {
|
|
341
375
|
let range = $9a36b6ba2fb1a7c5$var$makeRange(anchorDate, date);
|
|
@@ -347,6 +381,19 @@ function $9a36b6ba2fb1a7c5$export$9a987164d97ecc90(props) {
|
|
|
347
381
|
}
|
|
348
382
|
};
|
|
349
383
|
let [isDragging, setDragging] = $keQhS$useState(false);
|
|
384
|
+
let { isDateUnavailable: isDateUnavailable } = props;
|
|
385
|
+
let isInvalidSelection = $keQhS$useMemo(()=>{
|
|
386
|
+
if (!value || anchorDate) return false;
|
|
387
|
+
if (isDateUnavailable && (isDateUnavailable(value.start) || isDateUnavailable(value.end))) return true;
|
|
388
|
+
return $f62d864046160412$export$eac50920cf2fd59a(value.start, minValue, maxValue) || $f62d864046160412$export$eac50920cf2fd59a(value.end, minValue, maxValue);
|
|
389
|
+
}, [
|
|
390
|
+
isDateUnavailable,
|
|
391
|
+
value,
|
|
392
|
+
anchorDate,
|
|
393
|
+
minValue,
|
|
394
|
+
maxValue
|
|
395
|
+
]);
|
|
396
|
+
let validationState = props.validationState || (isInvalidSelection ? 'invalid' : null);
|
|
350
397
|
return {
|
|
351
398
|
...calendar,
|
|
352
399
|
value: value,
|
|
@@ -354,6 +401,7 @@ function $9a36b6ba2fb1a7c5$export$9a987164d97ecc90(props) {
|
|
|
354
401
|
anchorDate: anchorDate,
|
|
355
402
|
setAnchorDate: setAnchorDate,
|
|
356
403
|
highlightedRange: highlightedRange,
|
|
404
|
+
validationState: validationState,
|
|
357
405
|
selectFocusedDate () {
|
|
358
406
|
selectDate(calendar.focusedDate);
|
|
359
407
|
},
|
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,QAAsB,EAAE,MAAc,EAAE,QAAoB,EAAE,QAAoB,EAAE,CAAC;IACnI,GAAG,CAAC,YAAY,GAAiB,CAAC;IAAA,CAAC;IACnC,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,CAAC;SAEe,wCAAU,CAAC,IAAkB,EAAE,QAAsB,EAAE,MAAc,EAAE,QAAoB,EAAE,QAAo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/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 /** Whether the calendar is disabled. */\n readonly isDisabled: boolean,\n /** Whether the calendar is in a read only state. */\n readonly isReadOnly: boolean,\n /** The date range that is currently visible in the calendar. */\n readonly visibleRange: RangeValue<CalendarDate>,\n /** The time zone of the dates currently being displayed. */\n readonly timeZone: string,\n /** The currently focused date. */\n readonly focusedDate: CalendarDate,\n /** Sets the focused date. */\n setFocusedDate(value: CalendarDate): void,\n /** Moves focus to the next calendar date. */\n focusNextDay(): void,\n /** Moves focus to the previous calendar date. */\n focusPreviousDay(): void,\n /** Moves focus to the next row of dates, e.g. the next week. */\n focusNextRow(): void,\n /** Moves focus to the previous row of dates, e.g. the previous work. */\n focusPreviousRow(): void,\n /** Moves focus to the next page of dates, e.g. the next month if one month is visible. */\n focusNextPage(): void,\n /** Moves focus to the previous page of dates, e.g. the previous month if one month is visible. */\n focusPreviousPage(): void,\n /** Moves focus to the start of the current page of dates, e.g. the start of the first visible month. */\n focusPageStart(): void,\n /** Moves focus to the end of the current page of dates, e.g. the end of the last visible month. */\n focusPageEnd(): void,\n /**\n * Moves focus to the next larger section of dates based on what is currently displayed.\n * If days are displayed, then moves to the next visible range. If weeks are displayed, then\n * moves to the next month. If months or years are displayed, moves to the next year.\n */\n focusNextSection(): void,\n /**\n * Moves focus to the previous larger section of dates based on what is currently displayed.\n * If days are displayed, then moves to the previous visible range. If weeks are displayed, then\n * moves to the previous month. If months or years are displayed, moves to the previous year.\n */\n focusPreviousSection(): void,\n /** Selects the currently focused date. */\n selectFocusedDate(): void,\n /** Selects the given date. */\n selectDate(date: CalendarDate): void,\n /** Whether focus is currently within the calendar. */\n readonly isFocused: boolean,\n /** Sets whether focus is currently within the calendar. */\n setFocused(value: boolean): void,\n /** Returns whether the given date is invalid according to the `minValue` and `maxValue` props. */\n isInvalid(date: CalendarDate): boolean,\n /** Returns whether the given date is currently selected. */\n isSelected(date: CalendarDate): boolean,\n /** Returns whether the given date is currently focused. */\n isCellFocused(date: CalendarDate): boolean,\n /** Returns whether the given date is disabled according to the `minValue, `maxValue`, and `isDisabled` props. */\n isCellDisabled(date: CalendarDate): boolean,\n /** Returns whether the given date is unavailable according to the `isDateUnavailable` prop. */\n isCellUnavailable(date: CalendarDate): boolean,\n /** Returns whether the previous visible date range is allowed to be selected according to the `minValue` prop. */\n isPreviousVisibleRangeInvalid(): boolean,\n /** Returns whether the next visible date range is allowed to be selected according to the `maxValue` prop. */\n isNextVisibleRangeInvalid(): boolean\n}\n\nexport interface CalendarState extends CalendarStateBase {\n /** The currently selected date. */\n readonly value: CalendarDate,\n /** Sets the currently selected date. */\n setValue(value: CalendarDate): void\n}\n\nexport interface RangeCalendarState extends CalendarStateBase {\n /** The currently selected date range. */\n readonly value: RangeValue<DateValue>,\n /** Sets the currently selected date range. */\n setValue(value: RangeValue<DateValue>): void,\n /** Highlights the given date during selection, e.g. by hovering or dragging. */\n highlightDate(date: CalendarDate): void,\n /** The current anchor date that the user clicked on to begin range selection. */\n readonly anchorDate: CalendarDate | null,\n /** Sets the anchor date that the user clicked on to begin range selection. */\n setAnchorDate(date: CalendarDate | null): void,\n /** The currently highlighted date range. */\n readonly highlightedRange: RangeValue<CalendarDate>,\n /** Whether the user is currently dragging over the calendar. */\n readonly isDragging: boolean,\n /** Sets whether the user is dragging over the calendar. */\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 DateDuration,\n DateFormatter,\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 {useMemo, useRef, useState} from 'react';\n\ninterface CalendarStateOptions extends CalendarProps<DateValue> {\n /** The locale to display and edit the value according to. */\n locale: string,\n /**\n * A function that creates a [Calendar](../internationalized/date/Calendar.html)\n * object for a given calendar identifier. Such a function may be imported from the\n * `@internationalized/date` package, or manually implemented to include support for\n * only certain calendars.\n */\n createCalendar: (name: string) => Calendar,\n /**\n * The amount of days that will be displayed at once. This affects how pagination works.\n * @default {months: 1}\n */\n visibleDuration?: DateDuration,\n /** Determines how to align the initial selection relative to the visible date range. */\n selectionAlignment?: 'start' | 'center' | 'end'\n}\n\n/**\n * Provides state management for a calendar component.\n * A calendar displays one or more date grids and allows users to select a single date.\n */\nexport function useCalendarState(props: CalendarStateOptions): CalendarState {\n let defaultFormatter = useMemo(() => new DateFormatter(props.locale), [props.locale]);\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 focusedCalendarDate = useMemo(() => (\n props.focusedValue\n ? constrainValue(toCalendar(toCalendarDate(props.focusedValue), calendar), minValue, maxValue)\n : undefined\n ), [props.focusedValue, calendar, minValue, maxValue]);\n let defaultFocusedCalendarDate = useMemo(() => (\n constrainValue(\n props.defaultFocusedValue\n ? toCalendar(toCalendarDate(props.defaultFocusedValue), calendar)\n : calendarDateValue || toCalendar(today(timeZone), calendar),\n minValue,\n maxValue\n )\n ), [props.defaultFocusedValue, calendarDateValue, timeZone, calendar, minValue, maxValue]);\n let [focusedDate, setFocusedDate] = useControlledState(focusedCalendarDate, defaultFocusedCalendarDate, props.onFocusChange);\n let [startDate, setStartDate] = useState(() => {\n switch (selectionAlignment) {\n case 'start':\n return alignStart(focusedDate, visibleDuration, locale, minValue, maxValue);\n case 'end':\n return alignEnd(focusedDate, visibleDuration, locale, minValue, maxValue);\n case 'center':\n default:\n return alignCenter(focusedDate, visibleDuration, locale, minValue, maxValue);\n }\n });\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 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\n if (isInvalid(focusedDate, minValue, maxValue)) {\n // If the focused date was moved to an invalid value, it can't be focused, so constrain it.\n setFocusedDate(constrainValue(focusedDate, minValue, maxValue));\n } else if (focusedDate.compare(startDate) < 0) {\n setStartDate(alignEnd(focusedDate, visibleDuration, locale, minValue, maxValue));\n } else if (focusedDate.compare(startDate.add(visibleDuration)) >= 0) {\n setStartDate(alignStart(focusedDate, visibleDuration, locale, minValue, maxValue));\n }\n\n // Sets focus to a specific cell date\n function focusCell(date: CalendarDate) {\n date = constrainValue(date, minValue, maxValue);\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 focusCell(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 setFocusedDate(constrainValue(focusedDate.add(visibleDuration), minValue, maxValue));\n setStartDate(constrainStart(focusedDate, start, visibleDuration, locale, minValue, maxValue));\n },\n focusPreviousPage() {\n let start = startDate.subtract(visibleDuration);\n setFocusedDate(constrainValue(focusedDate.subtract(visibleDuration), minValue, maxValue));\n setStartDate(constrainStart(focusedDate, start, visibleDuration, locale, 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) && !this.isCellDisabled(date) && !this.isCellUnavailable(date);\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 || this.isInvalid(date, minValue, maxValue);\n },\n isCellUnavailable(date) {\n return props.isDateUnavailable && props.isDateUnavailable(date);\n },\n isPreviousVisibleRangeInvalid() {\n return this.isInvalid(startDate.subtract({days: 1}), minValue, maxValue);\n },\n isNextVisibleRangeInvalid() {\n return this.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 DateDuration,\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: DateDuration, locale: string, minValue?: DateValue, maxValue?: DateValue) {\n let halfDuration: DateDuration = {};\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: DateDuration, 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: DateDuration, 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: DateDuration,\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, isInvalid} from './utils';\nimport {Calendar, CalendarDate, DateDuration, GregorianCalendar, isEqualDay, maxDate, minDate, toCalendar, toCalendarDate} from '@internationalized/date';\nimport {CalendarState, RangeCalendarState} from './types';\nimport {DateRange, DateValue} from '@react-types/calendar';\nimport {RangeCalendarProps} from '@react-types/calendar';\nimport {RangeValue} from '@react-types/shared';\nimport {useCalendarState} from './useCalendarState';\nimport {useControlledState} from '@react-stately/utils';\nimport {useMemo, useRef, useState} from 'react';\n\ninterface RangeCalendarStateOptions extends RangeCalendarProps<DateValue> {\n /** The locale to display and edit the value according to. */\n locale: string,\n /**\n * A function that creates a [Calendar](../internationalized/date/Calendar.html)\n * object for a given calendar identifier. Such a function may be imported from the\n * `@internationalized/date` package, or manually implemented to include support for\n * only certain calendars.\n */\n createCalendar: (name: string) => Calendar,\n /**\n * The amount of days that will be displayed at once. This affects how pagination works.\n * @default {months: 1}\n */\n visibleDuration?: DateDuration\n}\n\n/**\n * Provides state management for a range calendar component.\n * A range calendar displays one or more date grids and allows users to select a contiguous range of dates.\n */\nexport function useRangeCalendarState(props: RangeCalendarStateOptions): 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 || null,\n onChange\n );\n\n let [anchorDate, setAnchorDateState] = 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 // Available range must be stored in a ref so we have access to the updated version immediately in `isInvalid`.\n let availableRangeRef = useRef<RangeValue<DateValue>>(null);\n let [availableRange, setAvailableRange] = useState<RangeValue<DateValue>>(null);\n let min = useMemo(() => maxDate(minValue, availableRange?.start), [minValue, availableRange]);\n let max = useMemo(() => minDate(maxValue, availableRange?.end), [maxValue, availableRange]);\n\n let calendar = useCalendarState({\n ...calendarProps,\n value: value && value.start,\n createCalendar,\n locale,\n visibleDuration,\n minValue: min,\n maxValue: max,\n selectionAlignment: alignment\n });\n\n let updateAvailableRange = (date) => {\n if (date && props.isDateUnavailable && !props.allowsNonContiguousRanges) {\n availableRangeRef.current = {\n start: nextUnavailableDate(date, calendar, -1),\n end: nextUnavailableDate(date, calendar, 1)\n };\n setAvailableRange(availableRangeRef.current);\n } else {\n availableRangeRef.current = null;\n setAvailableRange(null);\n }\n };\n\n // If the visible range changes, we need to update the available range.\n let lastVisibleRange = useRef(calendar.visibleRange);\n if (!isEqualDay(calendar.visibleRange.start, lastVisibleRange.current.start) || !isEqualDay(calendar.visibleRange.end, lastVisibleRange.current.end)) {\n updateAvailableRange(anchorDate);\n lastVisibleRange.current = calendar.visibleRange;\n }\n\n let setAnchorDate = (date: CalendarDate) => {\n if (date) {\n setAnchorDateState(date);\n updateAvailableRange(date);\n } else {\n setAnchorDateState(null);\n updateAvailableRange(null);\n }\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 && !calendar.isCellDisabled(date) && !calendar.isCellUnavailable(date);\n },\n isInvalid(date) {\n return calendar.isInvalid(date) || isInvalid(date, availableRangeRef.current?.start, availableRangeRef.current?.end);\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\nfunction nextUnavailableDate(anchorDate: CalendarDate, state: CalendarState, dir: number) {\n let nextDate = anchorDate.add({days: dir});\n while (\n (dir < 0 ? nextDate.compare(state.visibleRange.start) >= 0 : nextDate.compare(state.visibleRange.end) <= 0) &&\n !state.isCellUnavailable(nextDate)\n ) {\n nextDate = nextDate.add({days: dir});\n }\n\n if (state.isCellUnavailable(nextDate)) {\n return nextDate.add({days: -dir});\n }\n\n return null;\n}\n"],"names":[],"version":3,"file":"module.js.map"}
|
|
1
|
+
{"mappings":";;;;;SEuBgB,yCAAS,CAAC,IAAe,EAAE,QAAmB,EAAE,QAAmB,EAAE,CAAC;IACpF,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,QAAsB,EAAE,MAAc,EAAE,QAAoB,EAAE,QAAoB,EAAE,CAAC;IACnI,GAAG,CAAC,YAAY,GAAiB,CAAC;IAAA,CAAC;IACnC,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,CAA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C,UAAwB,EAAE,KAAoB,EAAE,GAAW,EAAE,CAAC;IACzF,GAAG,CAAC,QAAQ,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;QAAA,IAAI,EAAE,GAAG;IAAA,CAAC;WAEtC,GAAG,GAAG,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,KAAK,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,KAAK,CAAC,MACzG,KAAK,CAAC,iBAAiB,CAAC,QAAQ,EAEjC,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;QAAA,IAAI,EAAE,GAAG;IAAA,CAAC;IAGrC,EAAE,EAAE,KAAK,CAAC,iBAAiB,CAAC,QAAQ,GAClC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QAAA,IAAI,GAAG,GAAG;IAAA,CAAC;IAGlC,MAAM,CAAC,IAAI;AACb,CAAC;;","sources":["packages/@react-stately/calendar/src/index.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 {useCalendarState} from './useCalendarState';\nexport {useRangeCalendarState} from './useRangeCalendarState';\n\nexport type {CalendarStateOptions} from './useCalendarState';\nexport type {RangeCalendarStateOptions} from './useRangeCalendarState';\nexport type {CalendarState, RangeCalendarState} from './types';\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, previousAvailableDate} from './utils';\nimport {\n Calendar,\n CalendarDate,\n DateDuration,\n DateFormatter,\n endOfMonth,\n endOfWeek,\n GregorianCalendar,\n isSameDay,\n startOfMonth,\n startOfWeek,\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 {useMemo, useRef, useState} from 'react';\n\nexport interface CalendarStateOptions extends CalendarProps<DateValue> {\n /** The locale to display and edit the value according to. */\n locale: string,\n /**\n * A function that creates a [Calendar](../internationalized/date/Calendar.html)\n * object for a given calendar identifier. Such a function may be imported from the\n * `@internationalized/date` package, or manually implemented to include support for\n * only certain calendars.\n */\n createCalendar: (name: string) => Calendar,\n /**\n * The amount of days that will be displayed at once. This affects how pagination works.\n * @default {months: 1}\n */\n visibleDuration?: DateDuration,\n /** Determines how to align the initial selection relative to the visible date range. */\n selectionAlignment?: 'start' | 'center' | 'end'\n}\n\n/**\n * Provides state management for a calendar component.\n * A calendar displays one or more date grids and allows users to select a single date.\n */\nexport function useCalendarState(props: CalendarStateOptions): CalendarState {\n let defaultFormatter = useMemo(() => new DateFormatter(props.locale), [props.locale]);\n let resolvedOptions = useMemo(() => defaultFormatter.resolvedOptions(), [defaultFormatter]);\n let {\n locale,\n createCalendar,\n visibleDuration = {months: 1},\n minValue,\n maxValue,\n selectionAlignment,\n isDateUnavailable\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 focusedCalendarDate = useMemo(() => (\n props.focusedValue\n ? constrainValue(toCalendar(toCalendarDate(props.focusedValue), calendar), minValue, maxValue)\n : undefined\n ), [props.focusedValue, calendar, minValue, maxValue]);\n let defaultFocusedCalendarDate = useMemo(() => (\n constrainValue(\n props.defaultFocusedValue\n ? toCalendar(toCalendarDate(props.defaultFocusedValue), calendar)\n : calendarDateValue || toCalendar(today(timeZone), calendar),\n minValue,\n maxValue\n )\n ), [props.defaultFocusedValue, calendarDateValue, timeZone, calendar, minValue, maxValue]);\n let [focusedDate, setFocusedDate] = useControlledState(focusedCalendarDate, defaultFocusedCalendarDate, props.onFocusChange);\n let [startDate, setStartDate] = useState(() => {\n switch (selectionAlignment) {\n case 'start':\n return alignStart(focusedDate, visibleDuration, locale, minValue, maxValue);\n case 'end':\n return alignEnd(focusedDate, visibleDuration, locale, minValue, maxValue);\n case 'center':\n default:\n return alignCenter(focusedDate, visibleDuration, locale, minValue, maxValue);\n }\n });\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 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\n if (isInvalid(focusedDate, minValue, maxValue)) {\n // If the focused date was moved to an invalid value, it can't be focused, so constrain it.\n setFocusedDate(constrainValue(focusedDate, minValue, maxValue));\n } else if (focusedDate.compare(startDate) < 0) {\n setStartDate(alignEnd(focusedDate, visibleDuration, locale, minValue, maxValue));\n } else if (focusedDate.compare(startDate.add(visibleDuration)) >= 0) {\n setStartDate(alignStart(focusedDate, visibleDuration, locale, minValue, maxValue));\n }\n\n // Sets focus to a specific cell date\n function focusCell(date: CalendarDate) {\n date = constrainValue(date, minValue, maxValue);\n setFocusedDate(date);\n }\n\n function setValue(newValue: CalendarDate) {\n if (!props.isDisabled && !props.isReadOnly) {\n newValue = constrainValue(newValue, minValue, maxValue);\n newValue = previousAvailableDate(newValue, startDate, isDateUnavailable);\n if (!newValue) {\n return;\n }\n\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 let isUnavailable = useMemo(() => {\n if (!calendarDateValue) {\n return false;\n }\n\n if (isDateUnavailable && isDateUnavailable(calendarDateValue)) {\n return true;\n }\n\n return isInvalid(calendarDateValue, minValue, maxValue);\n }, [calendarDateValue, isDateUnavailable, minValue, maxValue]);\n let validationState = props.validationState || (isUnavailable ? 'invalid' : null);\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 minValue,\n maxValue,\n focusedDate,\n timeZone,\n validationState,\n setFocusedDate(date) {\n focusCell(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 setFocusedDate(constrainValue(focusedDate.add(visibleDuration), minValue, maxValue));\n setStartDate(\n alignStart(\n constrainStart(focusedDate, start, visibleDuration, locale, minValue, maxValue),\n visibleDuration,\n locale\n )\n );\n },\n focusPreviousPage() {\n let start = startDate.subtract(visibleDuration);\n setFocusedDate(constrainValue(focusedDate.subtract(visibleDuration), minValue, maxValue));\n setStartDate(\n alignStart(\n constrainStart(focusedDate, start, visibleDuration, locale, minValue, maxValue),\n visibleDuration,\n locale\n )\n );\n },\n focusSectionStart() {\n if (visibleDuration.days) {\n focusCell(startDate);\n } else if (visibleDuration.weeks) {\n focusCell(startOfWeek(focusedDate, locale));\n } else if (visibleDuration.months || visibleDuration.years) {\n focusCell(startOfMonth(focusedDate));\n }\n },\n focusSectionEnd() {\n if (visibleDuration.days) {\n focusCell(endDate);\n } else if (visibleDuration.weeks) {\n focusCell(endOfWeek(focusedDate, locale));\n } else if (visibleDuration.months || visibleDuration.years) {\n focusCell(endOfMonth(focusedDate));\n }\n },\n focusNextSection(larger) {\n if (!larger && !visibleDuration.days) {\n focusCell(focusedDate.add(unitDuration(visibleDuration)));\n return;\n }\n\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(larger) {\n if (!larger && !visibleDuration.days) {\n focusCell(focusedDate.subtract(unitDuration(visibleDuration)));\n return;\n }\n\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) && !this.isCellDisabled(date) && !this.isCellUnavailable(date);\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 || this.isInvalid(date, minValue, maxValue);\n },\n isCellUnavailable(date) {\n return props.isDateUnavailable && props.isDateUnavailable(date);\n },\n isPreviousVisibleRangeInvalid() {\n return this.isInvalid(startDate.subtract({days: 1}), minValue, maxValue);\n },\n isNextVisibleRangeInvalid() {\n return this.isInvalid(endDate.add({days: 1}), minValue, maxValue);\n }\n };\n}\n\nfunction unitDuration(duration: DateDuration) {\n let unit = {...duration};\n for (let key in duration) {\n unit[key] = 1;\n }\n return unit;\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 DateDuration,\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: DateValue, 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: DateDuration, locale: string, minValue?: DateValue, maxValue?: DateValue) {\n let halfDuration: DateDuration = {};\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: DateDuration, 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: DateDuration, 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: DateDuration,\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\nexport function previousAvailableDate(date: CalendarDate, minValue: DateValue, isDateUnavailable: (date: CalendarDate) => boolean) {\n if (!isDateUnavailable) {\n return date;\n }\n\n while (date.compare(minValue) >= 0 && isDateUnavailable(date)) {\n date = date.subtract({days: 1});\n }\n\n if (date.compare(minValue) >= 0) {\n return date;\n }\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {alignCenter, constrainValue, isInvalid, previousAvailableDate} from './utils';\nimport {Calendar, CalendarDate, DateDuration, GregorianCalendar, isEqualDay, maxDate, minDate, toCalendar, toCalendarDate} from '@internationalized/date';\nimport {CalendarState, RangeCalendarState} from './types';\nimport {DateRange, DateValue} from '@react-types/calendar';\nimport {RangeCalendarProps} from '@react-types/calendar';\nimport {RangeValue} from '@react-types/shared';\nimport {useCalendarState} from './useCalendarState';\nimport {useControlledState} from '@react-stately/utils';\nimport {useMemo, useRef, useState} from 'react';\n\nexport interface RangeCalendarStateOptions extends RangeCalendarProps<DateValue> {\n /** The locale to display and edit the value according to. */\n locale: string,\n /**\n * A function that creates a [Calendar](../internationalized/date/Calendar.html)\n * object for a given calendar identifier. Such a function may be imported from the\n * `@internationalized/date` package, or manually implemented to include support for\n * only certain calendars.\n */\n createCalendar: (name: string) => Calendar,\n /**\n * The amount of days that will be displayed at once. This affects how pagination works.\n * @default {months: 1}\n */\n visibleDuration?: DateDuration\n}\n\n/**\n * Provides state management for a range calendar component.\n * A range calendar displays one or more date grids and allows users to select a contiguous range of dates.\n */\nexport function useRangeCalendarState(props: RangeCalendarStateOptions): 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 || null,\n onChange\n );\n\n let [anchorDate, setAnchorDateState] = 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 // Available range must be stored in a ref so we have access to the updated version immediately in `isInvalid`.\n let availableRangeRef = useRef<RangeValue<DateValue>>(null);\n let [availableRange, setAvailableRange] = useState<RangeValue<DateValue>>(null);\n let min = useMemo(() => maxDate(minValue, availableRange?.start), [minValue, availableRange]);\n let max = useMemo(() => minDate(maxValue, availableRange?.end), [maxValue, availableRange]);\n\n let calendar = useCalendarState({\n ...calendarProps,\n value: value && value.start,\n createCalendar,\n locale,\n visibleDuration,\n minValue: min,\n maxValue: max,\n selectionAlignment: alignment\n });\n\n let updateAvailableRange = (date) => {\n if (date && props.isDateUnavailable && !props.allowsNonContiguousRanges) {\n availableRangeRef.current = {\n start: nextUnavailableDate(date, calendar, -1),\n end: nextUnavailableDate(date, calendar, 1)\n };\n setAvailableRange(availableRangeRef.current);\n } else {\n availableRangeRef.current = null;\n setAvailableRange(null);\n }\n };\n\n // If the visible range changes, we need to update the available range.\n let lastVisibleRange = useRef(calendar.visibleRange);\n if (!isEqualDay(calendar.visibleRange.start, lastVisibleRange.current.start) || !isEqualDay(calendar.visibleRange.end, lastVisibleRange.current.end)) {\n updateAvailableRange(anchorDate);\n lastVisibleRange.current = calendar.visibleRange;\n }\n\n let setAnchorDate = (date: CalendarDate) => {\n if (date) {\n setAnchorDateState(date);\n updateAvailableRange(date);\n } else {\n setAnchorDateState(null);\n updateAvailableRange(null);\n }\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 date = constrainValue(date, min, max);\n date = previousAvailableDate(date, calendar.visibleRange.start, props.isDateUnavailable);\n if (!date) {\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 let {isDateUnavailable} = props;\n let isInvalidSelection = useMemo(() => {\n if (!value || anchorDate) {\n return false;\n }\n\n if (isDateUnavailable && (isDateUnavailable(value.start) || isDateUnavailable(value.end))) {\n return true;\n }\n\n return isInvalid(value.start, minValue, maxValue) || isInvalid(value.end, minValue, maxValue);\n }, [isDateUnavailable, value, anchorDate, minValue, maxValue]);\n\n let validationState = props.validationState || (isInvalidSelection ? 'invalid' : null);\n\n return {\n ...calendar,\n value,\n setValue,\n anchorDate,\n setAnchorDate,\n highlightedRange,\n validationState,\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 && !calendar.isCellDisabled(date) && !calendar.isCellUnavailable(date);\n },\n isInvalid(date) {\n return calendar.isInvalid(date) || isInvalid(date, availableRangeRef.current?.start, availableRangeRef.current?.end);\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\nfunction nextUnavailableDate(anchorDate: CalendarDate, state: CalendarState, dir: number) {\n let nextDate = anchorDate.add({days: dir});\n while (\n (dir < 0 ? nextDate.compare(state.visibleRange.start) >= 0 : nextDate.compare(state.visibleRange.end) <= 0) &&\n !state.isCellUnavailable(nextDate)\n ) {\n nextDate = nextDate.add({days: dir});\n }\n\n if (state.isCellUnavailable(nextDate)) {\n return nextDate.add({days: -dir});\n }\n\n return null;\n}\n"],"names":[],"version":3,"file":"module.js.map"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import { CalendarDate, Calendar, DateDuration } from "@internationalized/date";
|
|
2
2
|
import { DateValue, CalendarProps, RangeCalendarProps } from "@react-types/calendar";
|
|
3
|
-
import { RangeValue } from "@react-types/shared";
|
|
4
|
-
|
|
3
|
+
import { RangeValue, ValidationState } from "@react-types/shared";
|
|
4
|
+
interface CalendarStateBase {
|
|
5
5
|
/** Whether the calendar is disabled. */
|
|
6
6
|
readonly isDisabled: boolean;
|
|
7
7
|
/** Whether the calendar is in a read only state. */
|
|
8
8
|
readonly isReadOnly: boolean;
|
|
9
9
|
/** The date range that is currently visible in the calendar. */
|
|
10
10
|
readonly visibleRange: RangeValue<CalendarDate>;
|
|
11
|
+
/** The minimum allowed date that a user may select. */
|
|
12
|
+
readonly minValue?: DateValue;
|
|
13
|
+
/** The maximum allowed date that a user may select. */
|
|
14
|
+
readonly maxValue?: DateValue;
|
|
11
15
|
/** The time zone of the dates currently being displayed. */
|
|
12
16
|
readonly timeZone: string;
|
|
17
|
+
/** The current validation state of the selected value. */
|
|
18
|
+
readonly validationState: ValidationState;
|
|
13
19
|
/** The currently focused date. */
|
|
14
20
|
readonly focusedDate: CalendarDate;
|
|
15
21
|
/** Sets the focused date. */
|
|
@@ -26,22 +32,26 @@ export interface CalendarStateBase {
|
|
|
26
32
|
focusNextPage(): void;
|
|
27
33
|
/** Moves focus to the previous page of dates, e.g. the previous month if one month is visible. */
|
|
28
34
|
focusPreviousPage(): void;
|
|
29
|
-
/** Moves focus to the start of the current
|
|
30
|
-
|
|
31
|
-
/** Moves focus to the end of the current
|
|
32
|
-
|
|
35
|
+
/** Moves focus to the start of the current section of dates, e.g. the start of the current month. */
|
|
36
|
+
focusSectionStart(): void;
|
|
37
|
+
/** Moves focus to the end of the current section of dates, e.g. the end of the current month month. */
|
|
38
|
+
focusSectionEnd(): void;
|
|
33
39
|
/**
|
|
34
|
-
* Moves focus to the next
|
|
35
|
-
*
|
|
36
|
-
*
|
|
40
|
+
* Moves focus to the next section of dates based on what is currently displayed.
|
|
41
|
+
* By default, focus is moved by one of the currently displayed unit. For example, if
|
|
42
|
+
* one or more months are displayed, then focus is moved forward by one month.
|
|
43
|
+
* If the `larger` option is `true`, the focus is moved by the next larger unit than
|
|
44
|
+
* the one displayed. For example, if months are displayed, then focus moves to the next year.
|
|
37
45
|
*/
|
|
38
|
-
focusNextSection(): void;
|
|
46
|
+
focusNextSection(larger?: boolean): void;
|
|
39
47
|
/**
|
|
40
|
-
* Moves focus to the previous
|
|
41
|
-
*
|
|
42
|
-
*
|
|
48
|
+
* Moves focus to the previous section of dates based on what is currently displayed.
|
|
49
|
+
* By default, focus is moved by one of the currently displayed unit. For example, if
|
|
50
|
+
* one or more months are displayed, then focus is moved backward by one month.
|
|
51
|
+
* If the `larger` option is `true`, the focus is moved by the next larger unit than
|
|
52
|
+
* the one displayed. For example, if months are displayed, then focus moves to the previous year.
|
|
43
53
|
*/
|
|
44
|
-
focusPreviousSection(): void;
|
|
54
|
+
focusPreviousSection(larger?: boolean): void;
|
|
45
55
|
/** Selects the currently focused date. */
|
|
46
56
|
selectFocusedDate(): void;
|
|
47
57
|
/** Selects the given date. */
|
|
@@ -89,7 +99,7 @@ export interface RangeCalendarState extends CalendarStateBase {
|
|
|
89
99
|
/** Sets whether the user is dragging over the calendar. */
|
|
90
100
|
setDragging(isDragging: boolean): void;
|
|
91
101
|
}
|
|
92
|
-
interface CalendarStateOptions extends CalendarProps<DateValue> {
|
|
102
|
+
export interface CalendarStateOptions extends CalendarProps<DateValue> {
|
|
93
103
|
/** The locale to display and edit the value according to. */
|
|
94
104
|
locale: string;
|
|
95
105
|
/**
|
|
@@ -112,7 +122,7 @@ interface CalendarStateOptions extends CalendarProps<DateValue> {
|
|
|
112
122
|
* A calendar displays one or more date grids and allows users to select a single date.
|
|
113
123
|
*/
|
|
114
124
|
export function useCalendarState(props: CalendarStateOptions): CalendarState;
|
|
115
|
-
interface RangeCalendarStateOptions extends RangeCalendarProps<DateValue> {
|
|
125
|
+
export interface RangeCalendarStateOptions extends RangeCalendarProps<DateValue> {
|
|
116
126
|
/** The locale to display and edit the value according to. */
|
|
117
127
|
locale: string;
|
|
118
128
|
/**
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;
|
|
1
|
+
{"mappings":";;;ACgBA;IACE,wCAAwC;IACxC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,oDAAoD;IACpD,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,gEAAgE;IAChE,QAAQ,CAAC,YAAY,EAAE,WAAW,YAAY,CAAC,CAAC;IAChD,uDAAuD;IACvD,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;IAC9B,uDAAuD;IACvD,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;IAC9B,4DAA4D;IAC5D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,0DAA0D;IAC1D,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;IAC1C,kCAAkC;IAClC,QAAQ,CAAC,WAAW,EAAE,YAAY,CAAC;IACnC,6BAA6B;IAC7B,cAAc,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IAC1C,6CAA6C;IAC7C,YAAY,IAAI,IAAI,CAAC;IACrB,iDAAiD;IACjD,gBAAgB,IAAI,IAAI,CAAC;IACzB,gEAAgE;IAChE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E,YAAY,CAAA;CAC/B;AAED;;;GAGG;AACH,sCAAsC,KAAK,EAAE,yBAAyB,GAAG,kBAAkB,CAqI1F","sources":["packages/@react-stately/calendar/src/packages/@react-stately/calendar/src/utils.ts","packages/@react-stately/calendar/src/packages/@react-stately/calendar/src/types.ts","packages/@react-stately/calendar/src/packages/@react-stately/calendar/src/useCalendarState.ts","packages/@react-stately/calendar/src/packages/@react-stately/calendar/src/useRangeCalendarState.ts","packages/@react-stately/calendar/src/packages/@react-stately/calendar/src/index.ts","packages/@react-stately/calendar/src/index.ts"],"sourcesContent":[null,null,null,null,null,"/*\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 {useCalendarState} from './useCalendarState';\nexport {useRangeCalendarState} from './useRangeCalendarState';\n\nexport type {CalendarStateOptions} from './useCalendarState';\nexport type {RangeCalendarStateOptions} from './useRangeCalendarState';\nexport type {CalendarState, RangeCalendarState} from './types';\n"],"names":[],"version":3,"file":"types.d.ts.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.1508+cc158b410",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -18,13 +18,11 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@babel/runtime": "^7.6.2",
|
|
21
|
-
"@internationalized/date": "3.0.0-nightly.
|
|
22
|
-
"@react-
|
|
23
|
-
"@react-
|
|
24
|
-
"@react-types/
|
|
25
|
-
"@react-types/
|
|
26
|
-
"@react-types/shared": "3.0.0-nightly.1501+ad9fc6c06",
|
|
27
|
-
"date-fns": "^1.30.1"
|
|
21
|
+
"@internationalized/date": "3.0.0-nightly.3207+cc158b410",
|
|
22
|
+
"@react-stately/utils": "3.0.0-nightly.1508+cc158b410",
|
|
23
|
+
"@react-types/calendar": "3.0.0-nightly.1508+cc158b410",
|
|
24
|
+
"@react-types/datepicker": "3.0.0-nightly.1508+cc158b410",
|
|
25
|
+
"@react-types/shared": "3.0.0-nightly.1508+cc158b410"
|
|
28
26
|
},
|
|
29
27
|
"peerDependencies": {
|
|
30
28
|
"react": "^16.8.0 || ^17.0.0-rc.1"
|
|
@@ -32,5 +30,5 @@
|
|
|
32
30
|
"publishConfig": {
|
|
33
31
|
"access": "public"
|
|
34
32
|
},
|
|
35
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "cc158b410d11894fb2f14cc2732165dd91786036"
|
|
36
34
|
}
|
package/src/index.ts
CHANGED
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
|
|
13
|
+
export {useCalendarState} from './useCalendarState';
|
|
14
|
+
export {useRangeCalendarState} from './useRangeCalendarState';
|
|
15
|
+
|
|
16
|
+
export type {CalendarStateOptions} from './useCalendarState';
|
|
17
|
+
export type {RangeCalendarStateOptions} from './useRangeCalendarState';
|
|
18
|
+
export type {CalendarState, RangeCalendarState} from './types';
|
package/src/types.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
import {CalendarDate} from '@internationalized/date';
|
|
14
14
|
import {DateValue} from '@react-types/calendar';
|
|
15
|
-
import {RangeValue} from '@react-types/shared';
|
|
15
|
+
import {RangeValue, ValidationState} from '@react-types/shared';
|
|
16
16
|
|
|
17
17
|
export interface CalendarStateBase {
|
|
18
18
|
/** Whether the calendar is disabled. */
|
|
@@ -21,8 +21,14 @@ export interface CalendarStateBase {
|
|
|
21
21
|
readonly isReadOnly: boolean,
|
|
22
22
|
/** The date range that is currently visible in the calendar. */
|
|
23
23
|
readonly visibleRange: RangeValue<CalendarDate>,
|
|
24
|
+
/** The minimum allowed date that a user may select. */
|
|
25
|
+
readonly minValue?: DateValue,
|
|
26
|
+
/** The maximum allowed date that a user may select. */
|
|
27
|
+
readonly maxValue?: DateValue,
|
|
24
28
|
/** The time zone of the dates currently being displayed. */
|
|
25
29
|
readonly timeZone: string,
|
|
30
|
+
/** The current validation state of the selected value. */
|
|
31
|
+
readonly validationState: ValidationState,
|
|
26
32
|
/** The currently focused date. */
|
|
27
33
|
readonly focusedDate: CalendarDate,
|
|
28
34
|
/** Sets the focused date. */
|
|
@@ -39,22 +45,26 @@ export interface CalendarStateBase {
|
|
|
39
45
|
focusNextPage(): void,
|
|
40
46
|
/** Moves focus to the previous page of dates, e.g. the previous month if one month is visible. */
|
|
41
47
|
focusPreviousPage(): void,
|
|
42
|
-
/** Moves focus to the start of the current
|
|
43
|
-
|
|
44
|
-
/** Moves focus to the end of the current
|
|
45
|
-
|
|
48
|
+
/** Moves focus to the start of the current section of dates, e.g. the start of the current month. */
|
|
49
|
+
focusSectionStart(): void,
|
|
50
|
+
/** Moves focus to the end of the current section of dates, e.g. the end of the current month month. */
|
|
51
|
+
focusSectionEnd(): void,
|
|
46
52
|
/**
|
|
47
|
-
* Moves focus to the next
|
|
48
|
-
*
|
|
49
|
-
*
|
|
53
|
+
* Moves focus to the next section of dates based on what is currently displayed.
|
|
54
|
+
* By default, focus is moved by one of the currently displayed unit. For example, if
|
|
55
|
+
* one or more months are displayed, then focus is moved forward by one month.
|
|
56
|
+
* If the `larger` option is `true`, the focus is moved by the next larger unit than
|
|
57
|
+
* the one displayed. For example, if months are displayed, then focus moves to the next year.
|
|
50
58
|
*/
|
|
51
|
-
focusNextSection(): void,
|
|
59
|
+
focusNextSection(larger?: boolean): void,
|
|
52
60
|
/**
|
|
53
|
-
* Moves focus to the previous
|
|
54
|
-
*
|
|
55
|
-
*
|
|
61
|
+
* Moves focus to the previous section of dates based on what is currently displayed.
|
|
62
|
+
* By default, focus is moved by one of the currently displayed unit. For example, if
|
|
63
|
+
* one or more months are displayed, then focus is moved backward by one month.
|
|
64
|
+
* If the `larger` option is `true`, the focus is moved by the next larger unit than
|
|
65
|
+
* the one displayed. For example, if months are displayed, then focus moves to the previous year.
|
|
56
66
|
*/
|
|
57
|
-
focusPreviousSection(): void,
|
|
67
|
+
focusPreviousSection(larger?: boolean): void,
|
|
58
68
|
/** Selects the currently focused date. */
|
|
59
69
|
selectFocusedDate(): void,
|
|
60
70
|
/** Selects the given date. */
|
package/src/useCalendarState.ts
CHANGED
|
@@ -10,14 +10,18 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import {alignCenter, alignEnd, alignStart, constrainStart, constrainValue, isInvalid} from './utils';
|
|
13
|
+
import {alignCenter, alignEnd, alignStart, constrainStart, constrainValue, isInvalid, previousAvailableDate} from './utils';
|
|
14
14
|
import {
|
|
15
15
|
Calendar,
|
|
16
16
|
CalendarDate,
|
|
17
17
|
DateDuration,
|
|
18
18
|
DateFormatter,
|
|
19
|
+
endOfMonth,
|
|
20
|
+
endOfWeek,
|
|
19
21
|
GregorianCalendar,
|
|
20
22
|
isSameDay,
|
|
23
|
+
startOfMonth,
|
|
24
|
+
startOfWeek,
|
|
21
25
|
toCalendar,
|
|
22
26
|
toCalendarDate,
|
|
23
27
|
today
|
|
@@ -27,7 +31,7 @@ import {CalendarState} from './types';
|
|
|
27
31
|
import {useControlledState} from '@react-stately/utils';
|
|
28
32
|
import {useMemo, useRef, useState} from 'react';
|
|
29
33
|
|
|
30
|
-
interface CalendarStateOptions extends CalendarProps<DateValue> {
|
|
34
|
+
export interface CalendarStateOptions extends CalendarProps<DateValue> {
|
|
31
35
|
/** The locale to display and edit the value according to. */
|
|
32
36
|
locale: string,
|
|
33
37
|
/**
|
|
@@ -59,7 +63,8 @@ export function useCalendarState(props: CalendarStateOptions): CalendarState {
|
|
|
59
63
|
visibleDuration = {months: 1},
|
|
60
64
|
minValue,
|
|
61
65
|
maxValue,
|
|
62
|
-
selectionAlignment
|
|
66
|
+
selectionAlignment,
|
|
67
|
+
isDateUnavailable
|
|
63
68
|
} = props;
|
|
64
69
|
|
|
65
70
|
let calendar = useMemo(() => createCalendar(resolvedOptions.calendar), [createCalendar, resolvedOptions.calendar]);
|
|
@@ -123,6 +128,12 @@ export function useCalendarState(props: CalendarStateOptions): CalendarState {
|
|
|
123
128
|
|
|
124
129
|
function setValue(newValue: CalendarDate) {
|
|
125
130
|
if (!props.isDisabled && !props.isReadOnly) {
|
|
131
|
+
newValue = constrainValue(newValue, minValue, maxValue);
|
|
132
|
+
newValue = previousAvailableDate(newValue, startDate, isDateUnavailable);
|
|
133
|
+
if (!newValue) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
|
|
126
137
|
// The display calendar should not have any effect on the emitted value.
|
|
127
138
|
// Emit dates in the same calendar as the original value, if any, otherwise gregorian.
|
|
128
139
|
newValue = toCalendar(newValue, value?.calendar || new GregorianCalendar());
|
|
@@ -136,6 +147,19 @@ export function useCalendarState(props: CalendarStateOptions): CalendarState {
|
|
|
136
147
|
}
|
|
137
148
|
}
|
|
138
149
|
|
|
150
|
+
let isUnavailable = useMemo(() => {
|
|
151
|
+
if (!calendarDateValue) {
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (isDateUnavailable && isDateUnavailable(calendarDateValue)) {
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return isInvalid(calendarDateValue, minValue, maxValue);
|
|
160
|
+
}, [calendarDateValue, isDateUnavailable, minValue, maxValue]);
|
|
161
|
+
let validationState = props.validationState || (isUnavailable ? 'invalid' : null);
|
|
162
|
+
|
|
139
163
|
return {
|
|
140
164
|
isDisabled: props.isDisabled,
|
|
141
165
|
isReadOnly: props.isReadOnly,
|
|
@@ -145,8 +169,11 @@ export function useCalendarState(props: CalendarStateOptions): CalendarState {
|
|
|
145
169
|
start: startDate,
|
|
146
170
|
end: endDate
|
|
147
171
|
},
|
|
172
|
+
minValue,
|
|
173
|
+
maxValue,
|
|
148
174
|
focusedDate,
|
|
149
175
|
timeZone,
|
|
176
|
+
validationState,
|
|
150
177
|
setFocusedDate(date) {
|
|
151
178
|
focusCell(date);
|
|
152
179
|
setFocused(true);
|
|
@@ -174,20 +201,49 @@ export function useCalendarState(props: CalendarStateOptions): CalendarState {
|
|
|
174
201
|
focusNextPage() {
|
|
175
202
|
let start = startDate.add(visibleDuration);
|
|
176
203
|
setFocusedDate(constrainValue(focusedDate.add(visibleDuration), minValue, maxValue));
|
|
177
|
-
setStartDate(
|
|
204
|
+
setStartDate(
|
|
205
|
+
alignStart(
|
|
206
|
+
constrainStart(focusedDate, start, visibleDuration, locale, minValue, maxValue),
|
|
207
|
+
visibleDuration,
|
|
208
|
+
locale
|
|
209
|
+
)
|
|
210
|
+
);
|
|
178
211
|
},
|
|
179
212
|
focusPreviousPage() {
|
|
180
213
|
let start = startDate.subtract(visibleDuration);
|
|
181
214
|
setFocusedDate(constrainValue(focusedDate.subtract(visibleDuration), minValue, maxValue));
|
|
182
|
-
setStartDate(
|
|
215
|
+
setStartDate(
|
|
216
|
+
alignStart(
|
|
217
|
+
constrainStart(focusedDate, start, visibleDuration, locale, minValue, maxValue),
|
|
218
|
+
visibleDuration,
|
|
219
|
+
locale
|
|
220
|
+
)
|
|
221
|
+
);
|
|
183
222
|
},
|
|
184
|
-
|
|
185
|
-
|
|
223
|
+
focusSectionStart() {
|
|
224
|
+
if (visibleDuration.days) {
|
|
225
|
+
focusCell(startDate);
|
|
226
|
+
} else if (visibleDuration.weeks) {
|
|
227
|
+
focusCell(startOfWeek(focusedDate, locale));
|
|
228
|
+
} else if (visibleDuration.months || visibleDuration.years) {
|
|
229
|
+
focusCell(startOfMonth(focusedDate));
|
|
230
|
+
}
|
|
186
231
|
},
|
|
187
|
-
|
|
188
|
-
|
|
232
|
+
focusSectionEnd() {
|
|
233
|
+
if (visibleDuration.days) {
|
|
234
|
+
focusCell(endDate);
|
|
235
|
+
} else if (visibleDuration.weeks) {
|
|
236
|
+
focusCell(endOfWeek(focusedDate, locale));
|
|
237
|
+
} else if (visibleDuration.months || visibleDuration.years) {
|
|
238
|
+
focusCell(endOfMonth(focusedDate));
|
|
239
|
+
}
|
|
189
240
|
},
|
|
190
|
-
focusNextSection() {
|
|
241
|
+
focusNextSection(larger) {
|
|
242
|
+
if (!larger && !visibleDuration.days) {
|
|
243
|
+
focusCell(focusedDate.add(unitDuration(visibleDuration)));
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
|
|
191
247
|
if (visibleDuration.days) {
|
|
192
248
|
this.focusNextPage();
|
|
193
249
|
} else if (visibleDuration.weeks) {
|
|
@@ -196,7 +252,12 @@ export function useCalendarState(props: CalendarStateOptions): CalendarState {
|
|
|
196
252
|
focusCell(focusedDate.add({years: 1}));
|
|
197
253
|
}
|
|
198
254
|
},
|
|
199
|
-
focusPreviousSection() {
|
|
255
|
+
focusPreviousSection(larger) {
|
|
256
|
+
if (!larger && !visibleDuration.days) {
|
|
257
|
+
focusCell(focusedDate.subtract(unitDuration(visibleDuration)));
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
|
|
200
261
|
if (visibleDuration.days) {
|
|
201
262
|
this.focusPreviousPage();
|
|
202
263
|
} else if (visibleDuration.weeks) {
|
|
@@ -236,3 +297,11 @@ export function useCalendarState(props: CalendarStateOptions): CalendarState {
|
|
|
236
297
|
}
|
|
237
298
|
};
|
|
238
299
|
}
|
|
300
|
+
|
|
301
|
+
function unitDuration(duration: DateDuration) {
|
|
302
|
+
let unit = {...duration};
|
|
303
|
+
for (let key in duration) {
|
|
304
|
+
unit[key] = 1;
|
|
305
|
+
}
|
|
306
|
+
return unit;
|
|
307
|
+
}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import {alignCenter, isInvalid} from './utils';
|
|
13
|
+
import {alignCenter, constrainValue, isInvalid, previousAvailableDate} from './utils';
|
|
14
14
|
import {Calendar, CalendarDate, DateDuration, GregorianCalendar, isEqualDay, maxDate, minDate, toCalendar, toCalendarDate} from '@internationalized/date';
|
|
15
15
|
import {CalendarState, RangeCalendarState} from './types';
|
|
16
16
|
import {DateRange, DateValue} from '@react-types/calendar';
|
|
@@ -20,7 +20,7 @@ import {useCalendarState} from './useCalendarState';
|
|
|
20
20
|
import {useControlledState} from '@react-stately/utils';
|
|
21
21
|
import {useMemo, useRef, useState} from 'react';
|
|
22
22
|
|
|
23
|
-
interface RangeCalendarStateOptions extends RangeCalendarProps<DateValue> {
|
|
23
|
+
export interface RangeCalendarStateOptions extends RangeCalendarProps<DateValue> {
|
|
24
24
|
/** The locale to display and edit the value according to. */
|
|
25
25
|
locale: string,
|
|
26
26
|
/**
|
|
@@ -113,6 +113,12 @@ export function useRangeCalendarState(props: RangeCalendarStateOptions): RangeCa
|
|
|
113
113
|
return;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
date = constrainValue(date, min, max);
|
|
117
|
+
date = previousAvailableDate(date, calendar.visibleRange.start, props.isDateUnavailable);
|
|
118
|
+
if (!date) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
|
|
116
122
|
if (!anchorDate) {
|
|
117
123
|
setAnchorDate(date);
|
|
118
124
|
} else {
|
|
@@ -127,6 +133,21 @@ export function useRangeCalendarState(props: RangeCalendarStateOptions): RangeCa
|
|
|
127
133
|
|
|
128
134
|
let [isDragging, setDragging] = useState(false);
|
|
129
135
|
|
|
136
|
+
let {isDateUnavailable} = props;
|
|
137
|
+
let isInvalidSelection = useMemo(() => {
|
|
138
|
+
if (!value || anchorDate) {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (isDateUnavailable && (isDateUnavailable(value.start) || isDateUnavailable(value.end))) {
|
|
143
|
+
return true;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return isInvalid(value.start, minValue, maxValue) || isInvalid(value.end, minValue, maxValue);
|
|
147
|
+
}, [isDateUnavailable, value, anchorDate, minValue, maxValue]);
|
|
148
|
+
|
|
149
|
+
let validationState = props.validationState || (isInvalidSelection ? 'invalid' : null);
|
|
150
|
+
|
|
130
151
|
return {
|
|
131
152
|
...calendar,
|
|
132
153
|
value,
|
|
@@ -134,6 +155,7 @@ export function useRangeCalendarState(props: RangeCalendarStateOptions): RangeCa
|
|
|
134
155
|
anchorDate,
|
|
135
156
|
setAnchorDate,
|
|
136
157
|
highlightedRange,
|
|
158
|
+
validationState,
|
|
137
159
|
selectFocusedDate() {
|
|
138
160
|
selectDate(calendar.focusedDate);
|
|
139
161
|
},
|
package/src/utils.ts
CHANGED
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
} from '@internationalized/date';
|
|
22
22
|
import {DateValue} from '@react-types/calendar';
|
|
23
23
|
|
|
24
|
-
export function isInvalid(date:
|
|
24
|
+
export function isInvalid(date: DateValue, minValue: DateValue, maxValue: DateValue) {
|
|
25
25
|
return (minValue != null && date.compare(minValue) < 0) ||
|
|
26
26
|
(maxValue != null && date.compare(maxValue) > 0);
|
|
27
27
|
}
|
|
@@ -105,3 +105,17 @@ export function constrainValue(date: CalendarDate, minValue: DateValue, maxValue
|
|
|
105
105
|
|
|
106
106
|
return date;
|
|
107
107
|
}
|
|
108
|
+
|
|
109
|
+
export function previousAvailableDate(date: CalendarDate, minValue: DateValue, isDateUnavailable: (date: CalendarDate) => boolean) {
|
|
110
|
+
if (!isDateUnavailable) {
|
|
111
|
+
return date;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
while (date.compare(minValue) >= 0 && isDateUnavailable(date)) {
|
|
115
|
+
date = date.subtract({days: 1});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (date.compare(minValue) >= 0) {
|
|
119
|
+
return date;
|
|
120
|
+
}
|
|
121
|
+
}
|