@react-aria/calendar 3.5.7 → 3.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ar-AE.mjs +1 -1
- package/dist/bg-BG.mjs +1 -1
- package/dist/cs-CZ.mjs +1 -1
- package/dist/da-DK.mjs +1 -1
- package/dist/de-DE.mjs +1 -1
- package/dist/el-GR.mjs +1 -1
- package/dist/en-US.mjs +1 -1
- package/dist/es-ES.mjs +1 -1
- package/dist/et-EE.mjs +1 -1
- package/dist/fi-FI.mjs +1 -1
- package/dist/fr-FR.mjs +1 -1
- package/dist/he-IL.mjs +1 -1
- package/dist/hr-HR.mjs +1 -1
- package/dist/hu-HU.mjs +1 -1
- package/dist/intlStrings.mjs +1 -1
- package/dist/it-IT.mjs +1 -1
- package/dist/ja-JP.mjs +1 -1
- package/dist/ko-KR.mjs +1 -1
- package/dist/lt-LT.mjs +1 -1
- package/dist/lv-LV.mjs +1 -1
- package/dist/nb-NO.mjs +1 -1
- package/dist/nl-NL.mjs +1 -1
- package/dist/pl-PL.mjs +1 -1
- package/dist/pt-BR.mjs +1 -1
- package/dist/pt-PT.mjs +1 -1
- package/dist/ro-RO.mjs +1 -1
- package/dist/ru-RU.mjs +1 -1
- package/dist/sk-SK.mjs +1 -1
- package/dist/sl-SI.mjs +1 -1
- package/dist/sr-SP.mjs +1 -1
- package/dist/sv-SE.mjs +1 -1
- package/dist/tr-TR.mjs +1 -1
- package/dist/uk-UA.mjs +1 -1
- package/dist/useCalendar.mjs +1 -1
- package/dist/useCalendarBase.main.js +13 -13
- package/dist/useCalendarBase.mjs +14 -14
- package/dist/useCalendarBase.module.js +13 -13
- package/dist/useCalendarCell.main.js +40 -40
- package/dist/useCalendarCell.mjs +41 -41
- package/dist/useCalendarCell.module.js +40 -40
- package/dist/useCalendarGrid.main.js +23 -23
- package/dist/useCalendarGrid.mjs +24 -24
- package/dist/useCalendarGrid.module.js +23 -23
- package/dist/useRangeCalendar.main.js +4 -4
- package/dist/useRangeCalendar.mjs +5 -5
- package/dist/useRangeCalendar.module.js +4 -4
- package/dist/utils.main.js +22 -22
- package/dist/utils.mjs +23 -23
- package/dist/utils.module.js +22 -22
- package/dist/zh-CN.mjs +1 -1
- package/dist/zh-TW.mjs +1 -1
- package/package.json +11 -11
|
@@ -30,56 +30,56 @@ function $a07388a797d86b95$export$cb95147730a423f5(props, state) {
|
|
|
30
30
|
let { direction: direction } = (0, $iASLq$reactariai18n.useLocale)();
|
|
31
31
|
let onKeyDown = (e)=>{
|
|
32
32
|
switch(e.key){
|
|
33
|
-
case
|
|
34
|
-
case
|
|
33
|
+
case 'Enter':
|
|
34
|
+
case ' ':
|
|
35
35
|
e.preventDefault();
|
|
36
36
|
state.selectFocusedDate();
|
|
37
37
|
break;
|
|
38
|
-
case
|
|
38
|
+
case 'PageUp':
|
|
39
39
|
e.preventDefault();
|
|
40
40
|
e.stopPropagation();
|
|
41
41
|
state.focusPreviousSection(e.shiftKey);
|
|
42
42
|
break;
|
|
43
|
-
case
|
|
43
|
+
case 'PageDown':
|
|
44
44
|
e.preventDefault();
|
|
45
45
|
e.stopPropagation();
|
|
46
46
|
state.focusNextSection(e.shiftKey);
|
|
47
47
|
break;
|
|
48
|
-
case
|
|
48
|
+
case 'End':
|
|
49
49
|
e.preventDefault();
|
|
50
50
|
e.stopPropagation();
|
|
51
51
|
state.focusSectionEnd();
|
|
52
52
|
break;
|
|
53
|
-
case
|
|
53
|
+
case 'Home':
|
|
54
54
|
e.preventDefault();
|
|
55
55
|
e.stopPropagation();
|
|
56
56
|
state.focusSectionStart();
|
|
57
57
|
break;
|
|
58
|
-
case
|
|
58
|
+
case 'ArrowLeft':
|
|
59
59
|
e.preventDefault();
|
|
60
60
|
e.stopPropagation();
|
|
61
|
-
if (direction ===
|
|
61
|
+
if (direction === 'rtl') state.focusNextDay();
|
|
62
62
|
else state.focusPreviousDay();
|
|
63
63
|
break;
|
|
64
|
-
case
|
|
64
|
+
case 'ArrowUp':
|
|
65
65
|
e.preventDefault();
|
|
66
66
|
e.stopPropagation();
|
|
67
67
|
state.focusPreviousRow();
|
|
68
68
|
break;
|
|
69
|
-
case
|
|
69
|
+
case 'ArrowRight':
|
|
70
70
|
e.preventDefault();
|
|
71
71
|
e.stopPropagation();
|
|
72
|
-
if (direction ===
|
|
72
|
+
if (direction === 'rtl') state.focusPreviousDay();
|
|
73
73
|
else state.focusNextDay();
|
|
74
74
|
break;
|
|
75
|
-
case
|
|
75
|
+
case 'ArrowDown':
|
|
76
76
|
e.preventDefault();
|
|
77
77
|
e.stopPropagation();
|
|
78
78
|
state.focusNextRow();
|
|
79
79
|
break;
|
|
80
|
-
case
|
|
80
|
+
case 'Escape':
|
|
81
81
|
// Cancel the selection.
|
|
82
|
-
if (
|
|
82
|
+
if ('setAnchorDate' in state) {
|
|
83
83
|
e.preventDefault();
|
|
84
84
|
state.setAnchorDate(null);
|
|
85
85
|
}
|
|
@@ -89,14 +89,14 @@ function $a07388a797d86b95$export$cb95147730a423f5(props, state) {
|
|
|
89
89
|
let visibleRangeDescription = (0, $df1d8e967e73ec8e$exports.useVisibleRangeDescription)(startDate, endDate, state.timeZone, true);
|
|
90
90
|
let { ariaLabel: ariaLabel, ariaLabelledBy: ariaLabelledBy } = (0, $df1d8e967e73ec8e$exports.hookData).get(state);
|
|
91
91
|
let labelProps = (0, $iASLq$reactariautils.useLabels)({
|
|
92
|
-
|
|
92
|
+
'aria-label': [
|
|
93
93
|
ariaLabel,
|
|
94
94
|
visibleRangeDescription
|
|
95
|
-
].filter(Boolean).join(
|
|
96
|
-
|
|
95
|
+
].filter(Boolean).join(', '),
|
|
96
|
+
'aria-labelledby': ariaLabelledBy
|
|
97
97
|
});
|
|
98
98
|
let dayFormatter = (0, $iASLq$reactariai18n.useDateFormatter)({
|
|
99
|
-
weekday: props.weekdayStyle ||
|
|
99
|
+
weekday: props.weekdayStyle || 'narrow',
|
|
100
100
|
timeZone: state.timeZone
|
|
101
101
|
});
|
|
102
102
|
let { locale: locale } = (0, $iASLq$reactariai18n.useLocale)();
|
|
@@ -118,10 +118,10 @@ function $a07388a797d86b95$export$cb95147730a423f5(props, state) {
|
|
|
118
118
|
]);
|
|
119
119
|
return {
|
|
120
120
|
gridProps: (0, $iASLq$reactariautils.mergeProps)(labelProps, {
|
|
121
|
-
role:
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
121
|
+
role: 'grid',
|
|
122
|
+
'aria-readonly': state.isReadOnly || null,
|
|
123
|
+
'aria-disabled': state.isDisabled || null,
|
|
124
|
+
'aria-multiselectable': 'highlightedRange' in state || undefined,
|
|
125
125
|
onKeyDown: onKeyDown,
|
|
126
126
|
onFocus: ()=>state.setFocused(true),
|
|
127
127
|
onBlur: ()=>state.setFocused(false)
|
|
@@ -129,7 +129,7 @@ function $a07388a797d86b95$export$cb95147730a423f5(props, state) {
|
|
|
129
129
|
headerProps: {
|
|
130
130
|
// Column headers are hidden to screen readers to make navigating with a touch screen reader easier.
|
|
131
131
|
// The day names are already included in the label of each cell, so there's no need to announce them twice.
|
|
132
|
-
|
|
132
|
+
'aria-hidden': true
|
|
133
133
|
},
|
|
134
134
|
weekDays: weekDays
|
|
135
135
|
};
|
package/dist/useCalendarGrid.mjs
CHANGED
|
@@ -24,56 +24,56 @@ function $e3031d1f8c9d64eb$export$cb95147730a423f5(props, state) {
|
|
|
24
24
|
let { direction: direction } = (0, $NQfxu$useLocale)();
|
|
25
25
|
let onKeyDown = (e)=>{
|
|
26
26
|
switch(e.key){
|
|
27
|
-
case
|
|
28
|
-
case
|
|
27
|
+
case 'Enter':
|
|
28
|
+
case ' ':
|
|
29
29
|
e.preventDefault();
|
|
30
30
|
state.selectFocusedDate();
|
|
31
31
|
break;
|
|
32
|
-
case
|
|
32
|
+
case 'PageUp':
|
|
33
33
|
e.preventDefault();
|
|
34
34
|
e.stopPropagation();
|
|
35
35
|
state.focusPreviousSection(e.shiftKey);
|
|
36
36
|
break;
|
|
37
|
-
case
|
|
37
|
+
case 'PageDown':
|
|
38
38
|
e.preventDefault();
|
|
39
39
|
e.stopPropagation();
|
|
40
40
|
state.focusNextSection(e.shiftKey);
|
|
41
41
|
break;
|
|
42
|
-
case
|
|
42
|
+
case 'End':
|
|
43
43
|
e.preventDefault();
|
|
44
44
|
e.stopPropagation();
|
|
45
45
|
state.focusSectionEnd();
|
|
46
46
|
break;
|
|
47
|
-
case
|
|
47
|
+
case 'Home':
|
|
48
48
|
e.preventDefault();
|
|
49
49
|
e.stopPropagation();
|
|
50
50
|
state.focusSectionStart();
|
|
51
51
|
break;
|
|
52
|
-
case
|
|
52
|
+
case 'ArrowLeft':
|
|
53
53
|
e.preventDefault();
|
|
54
54
|
e.stopPropagation();
|
|
55
|
-
if (direction ===
|
|
55
|
+
if (direction === 'rtl') state.focusNextDay();
|
|
56
56
|
else state.focusPreviousDay();
|
|
57
57
|
break;
|
|
58
|
-
case
|
|
58
|
+
case 'ArrowUp':
|
|
59
59
|
e.preventDefault();
|
|
60
60
|
e.stopPropagation();
|
|
61
61
|
state.focusPreviousRow();
|
|
62
62
|
break;
|
|
63
|
-
case
|
|
63
|
+
case 'ArrowRight':
|
|
64
64
|
e.preventDefault();
|
|
65
65
|
e.stopPropagation();
|
|
66
|
-
if (direction ===
|
|
66
|
+
if (direction === 'rtl') state.focusPreviousDay();
|
|
67
67
|
else state.focusNextDay();
|
|
68
68
|
break;
|
|
69
|
-
case
|
|
69
|
+
case 'ArrowDown':
|
|
70
70
|
e.preventDefault();
|
|
71
71
|
e.stopPropagation();
|
|
72
72
|
state.focusNextRow();
|
|
73
73
|
break;
|
|
74
|
-
case
|
|
74
|
+
case 'Escape':
|
|
75
75
|
// Cancel the selection.
|
|
76
|
-
if (
|
|
76
|
+
if ('setAnchorDate' in state) {
|
|
77
77
|
e.preventDefault();
|
|
78
78
|
state.setAnchorDate(null);
|
|
79
79
|
}
|
|
@@ -83,14 +83,14 @@ function $e3031d1f8c9d64eb$export$cb95147730a423f5(props, state) {
|
|
|
83
83
|
let visibleRangeDescription = (0, $a074e1e2d0f0a665$export$31afe65d91ef6e8)(startDate, endDate, state.timeZone, true);
|
|
84
84
|
let { ariaLabel: ariaLabel, ariaLabelledBy: ariaLabelledBy } = (0, $a074e1e2d0f0a665$export$653eddfc964b0f8a).get(state);
|
|
85
85
|
let labelProps = (0, $NQfxu$useLabels)({
|
|
86
|
-
|
|
86
|
+
'aria-label': [
|
|
87
87
|
ariaLabel,
|
|
88
88
|
visibleRangeDescription
|
|
89
|
-
].filter(Boolean).join(
|
|
90
|
-
|
|
89
|
+
].filter(Boolean).join(', '),
|
|
90
|
+
'aria-labelledby': ariaLabelledBy
|
|
91
91
|
});
|
|
92
92
|
let dayFormatter = (0, $NQfxu$useDateFormatter)({
|
|
93
|
-
weekday: props.weekdayStyle ||
|
|
93
|
+
weekday: props.weekdayStyle || 'narrow',
|
|
94
94
|
timeZone: state.timeZone
|
|
95
95
|
});
|
|
96
96
|
let { locale: locale } = (0, $NQfxu$useLocale)();
|
|
@@ -112,10 +112,10 @@ function $e3031d1f8c9d64eb$export$cb95147730a423f5(props, state) {
|
|
|
112
112
|
]);
|
|
113
113
|
return {
|
|
114
114
|
gridProps: (0, $NQfxu$mergeProps)(labelProps, {
|
|
115
|
-
role:
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
role: 'grid',
|
|
116
|
+
'aria-readonly': state.isReadOnly || null,
|
|
117
|
+
'aria-disabled': state.isDisabled || null,
|
|
118
|
+
'aria-multiselectable': 'highlightedRange' in state || undefined,
|
|
119
119
|
onKeyDown: onKeyDown,
|
|
120
120
|
onFocus: ()=>state.setFocused(true),
|
|
121
121
|
onBlur: ()=>state.setFocused(false)
|
|
@@ -123,7 +123,7 @@ function $e3031d1f8c9d64eb$export$cb95147730a423f5(props, state) {
|
|
|
123
123
|
headerProps: {
|
|
124
124
|
// Column headers are hidden to screen readers to make navigating with a touch screen reader easier.
|
|
125
125
|
// The day names are already included in the label of each cell, so there's no need to announce them twice.
|
|
126
|
-
|
|
126
|
+
'aria-hidden': true
|
|
127
127
|
},
|
|
128
128
|
weekDays: weekDays
|
|
129
129
|
};
|
|
@@ -131,4 +131,4 @@ function $e3031d1f8c9d64eb$export$cb95147730a423f5(props, state) {
|
|
|
131
131
|
|
|
132
132
|
|
|
133
133
|
export {$e3031d1f8c9d64eb$export$cb95147730a423f5 as useCalendarGrid};
|
|
134
|
-
//# sourceMappingURL=useCalendarGrid.
|
|
134
|
+
//# sourceMappingURL=useCalendarGrid.module.js.map
|
|
@@ -24,56 +24,56 @@ function $e3031d1f8c9d64eb$export$cb95147730a423f5(props, state) {
|
|
|
24
24
|
let { direction: direction } = (0, $NQfxu$useLocale)();
|
|
25
25
|
let onKeyDown = (e)=>{
|
|
26
26
|
switch(e.key){
|
|
27
|
-
case
|
|
28
|
-
case
|
|
27
|
+
case 'Enter':
|
|
28
|
+
case ' ':
|
|
29
29
|
e.preventDefault();
|
|
30
30
|
state.selectFocusedDate();
|
|
31
31
|
break;
|
|
32
|
-
case
|
|
32
|
+
case 'PageUp':
|
|
33
33
|
e.preventDefault();
|
|
34
34
|
e.stopPropagation();
|
|
35
35
|
state.focusPreviousSection(e.shiftKey);
|
|
36
36
|
break;
|
|
37
|
-
case
|
|
37
|
+
case 'PageDown':
|
|
38
38
|
e.preventDefault();
|
|
39
39
|
e.stopPropagation();
|
|
40
40
|
state.focusNextSection(e.shiftKey);
|
|
41
41
|
break;
|
|
42
|
-
case
|
|
42
|
+
case 'End':
|
|
43
43
|
e.preventDefault();
|
|
44
44
|
e.stopPropagation();
|
|
45
45
|
state.focusSectionEnd();
|
|
46
46
|
break;
|
|
47
|
-
case
|
|
47
|
+
case 'Home':
|
|
48
48
|
e.preventDefault();
|
|
49
49
|
e.stopPropagation();
|
|
50
50
|
state.focusSectionStart();
|
|
51
51
|
break;
|
|
52
|
-
case
|
|
52
|
+
case 'ArrowLeft':
|
|
53
53
|
e.preventDefault();
|
|
54
54
|
e.stopPropagation();
|
|
55
|
-
if (direction ===
|
|
55
|
+
if (direction === 'rtl') state.focusNextDay();
|
|
56
56
|
else state.focusPreviousDay();
|
|
57
57
|
break;
|
|
58
|
-
case
|
|
58
|
+
case 'ArrowUp':
|
|
59
59
|
e.preventDefault();
|
|
60
60
|
e.stopPropagation();
|
|
61
61
|
state.focusPreviousRow();
|
|
62
62
|
break;
|
|
63
|
-
case
|
|
63
|
+
case 'ArrowRight':
|
|
64
64
|
e.preventDefault();
|
|
65
65
|
e.stopPropagation();
|
|
66
|
-
if (direction ===
|
|
66
|
+
if (direction === 'rtl') state.focusPreviousDay();
|
|
67
67
|
else state.focusNextDay();
|
|
68
68
|
break;
|
|
69
|
-
case
|
|
69
|
+
case 'ArrowDown':
|
|
70
70
|
e.preventDefault();
|
|
71
71
|
e.stopPropagation();
|
|
72
72
|
state.focusNextRow();
|
|
73
73
|
break;
|
|
74
|
-
case
|
|
74
|
+
case 'Escape':
|
|
75
75
|
// Cancel the selection.
|
|
76
|
-
if (
|
|
76
|
+
if ('setAnchorDate' in state) {
|
|
77
77
|
e.preventDefault();
|
|
78
78
|
state.setAnchorDate(null);
|
|
79
79
|
}
|
|
@@ -83,14 +83,14 @@ function $e3031d1f8c9d64eb$export$cb95147730a423f5(props, state) {
|
|
|
83
83
|
let visibleRangeDescription = (0, $a074e1e2d0f0a665$export$31afe65d91ef6e8)(startDate, endDate, state.timeZone, true);
|
|
84
84
|
let { ariaLabel: ariaLabel, ariaLabelledBy: ariaLabelledBy } = (0, $a074e1e2d0f0a665$export$653eddfc964b0f8a).get(state);
|
|
85
85
|
let labelProps = (0, $NQfxu$useLabels)({
|
|
86
|
-
|
|
86
|
+
'aria-label': [
|
|
87
87
|
ariaLabel,
|
|
88
88
|
visibleRangeDescription
|
|
89
|
-
].filter(Boolean).join(
|
|
90
|
-
|
|
89
|
+
].filter(Boolean).join(', '),
|
|
90
|
+
'aria-labelledby': ariaLabelledBy
|
|
91
91
|
});
|
|
92
92
|
let dayFormatter = (0, $NQfxu$useDateFormatter)({
|
|
93
|
-
weekday: props.weekdayStyle ||
|
|
93
|
+
weekday: props.weekdayStyle || 'narrow',
|
|
94
94
|
timeZone: state.timeZone
|
|
95
95
|
});
|
|
96
96
|
let { locale: locale } = (0, $NQfxu$useLocale)();
|
|
@@ -112,10 +112,10 @@ function $e3031d1f8c9d64eb$export$cb95147730a423f5(props, state) {
|
|
|
112
112
|
]);
|
|
113
113
|
return {
|
|
114
114
|
gridProps: (0, $NQfxu$mergeProps)(labelProps, {
|
|
115
|
-
role:
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
role: 'grid',
|
|
116
|
+
'aria-readonly': state.isReadOnly || null,
|
|
117
|
+
'aria-disabled': state.isDisabled || null,
|
|
118
|
+
'aria-multiselectable': 'highlightedRange' in state || undefined,
|
|
119
119
|
onKeyDown: onKeyDown,
|
|
120
120
|
onFocus: ()=>state.setFocused(true),
|
|
121
121
|
onBlur: ()=>state.setFocused(false)
|
|
@@ -123,7 +123,7 @@ function $e3031d1f8c9d64eb$export$cb95147730a423f5(props, state) {
|
|
|
123
123
|
headerProps: {
|
|
124
124
|
// Column headers are hidden to screen readers to make navigating with a touch screen reader easier.
|
|
125
125
|
// The day names are already included in the label of each cell, so there's no need to announce them twice.
|
|
126
|
-
|
|
126
|
+
'aria-hidden': true
|
|
127
127
|
},
|
|
128
128
|
weekDays: weekDays
|
|
129
129
|
};
|
|
@@ -30,8 +30,8 @@ function $c49ada48cbc48220$export$87e0539f600c24e5(props, state, ref) {
|
|
|
30
30
|
// We need to match that here otherwise this will fire before the press event in
|
|
31
31
|
// useCalendarCell, causing range selection to not work properly.
|
|
32
32
|
let isVirtualClick = (0, $3kfPe$react.useRef)(false);
|
|
33
|
-
let windowRef = (0, $3kfPe$react.useRef)(typeof window !==
|
|
34
|
-
(0, $3kfPe$reactariautils.useEvent)(windowRef,
|
|
33
|
+
let windowRef = (0, $3kfPe$react.useRef)(typeof window !== 'undefined' ? window : null);
|
|
34
|
+
(0, $3kfPe$reactariautils.useEvent)(windowRef, 'pointerdown', (e)=>{
|
|
35
35
|
isVirtualClick.current = e.width === 0 && e.height === 0;
|
|
36
36
|
});
|
|
37
37
|
// Stop range selection when pressing or releasing a pointer outside the calendar body,
|
|
@@ -46,14 +46,14 @@ function $c49ada48cbc48220$export$87e0539f600c24e5(props, state, ref) {
|
|
|
46
46
|
let target = e.target;
|
|
47
47
|
if (ref.current && ref.current.contains(document.activeElement) && (!ref.current.contains(target) || !target.closest('button, [role="button"]'))) state.selectFocusedDate();
|
|
48
48
|
};
|
|
49
|
-
(0, $3kfPe$reactariautils.useEvent)(windowRef,
|
|
49
|
+
(0, $3kfPe$reactariautils.useEvent)(windowRef, 'pointerup', endDragging);
|
|
50
50
|
// Also stop range selection on blur, e.g. tabbing away from the calendar.
|
|
51
51
|
res.calendarProps.onBlur = (e)=>{
|
|
52
52
|
if (!ref.current) return;
|
|
53
53
|
if ((!e.relatedTarget || !ref.current.contains(e.relatedTarget)) && state.anchorDate) state.selectFocusedDate();
|
|
54
54
|
};
|
|
55
55
|
// Prevent touch scrolling while dragging
|
|
56
|
-
(0, $3kfPe$reactariautils.useEvent)(ref,
|
|
56
|
+
(0, $3kfPe$reactariautils.useEvent)(ref, 'touchmove', (e)=>{
|
|
57
57
|
if (state.isDragging) e.preventDefault();
|
|
58
58
|
}, {
|
|
59
59
|
passive: false,
|
|
@@ -24,8 +24,8 @@ function $46a4342aab3d8076$export$87e0539f600c24e5(props, state, ref) {
|
|
|
24
24
|
// We need to match that here otherwise this will fire before the press event in
|
|
25
25
|
// useCalendarCell, causing range selection to not work properly.
|
|
26
26
|
let isVirtualClick = (0, $juhpn$useRef)(false);
|
|
27
|
-
let windowRef = (0, $juhpn$useRef)(typeof window !==
|
|
28
|
-
(0, $juhpn$useEvent)(windowRef,
|
|
27
|
+
let windowRef = (0, $juhpn$useRef)(typeof window !== 'undefined' ? window : null);
|
|
28
|
+
(0, $juhpn$useEvent)(windowRef, 'pointerdown', (e)=>{
|
|
29
29
|
isVirtualClick.current = e.width === 0 && e.height === 0;
|
|
30
30
|
});
|
|
31
31
|
// Stop range selection when pressing or releasing a pointer outside the calendar body,
|
|
@@ -40,14 +40,14 @@ function $46a4342aab3d8076$export$87e0539f600c24e5(props, state, ref) {
|
|
|
40
40
|
let target = e.target;
|
|
41
41
|
if (ref.current && ref.current.contains(document.activeElement) && (!ref.current.contains(target) || !target.closest('button, [role="button"]'))) state.selectFocusedDate();
|
|
42
42
|
};
|
|
43
|
-
(0, $juhpn$useEvent)(windowRef,
|
|
43
|
+
(0, $juhpn$useEvent)(windowRef, 'pointerup', endDragging);
|
|
44
44
|
// Also stop range selection on blur, e.g. tabbing away from the calendar.
|
|
45
45
|
res.calendarProps.onBlur = (e)=>{
|
|
46
46
|
if (!ref.current) return;
|
|
47
47
|
if ((!e.relatedTarget || !ref.current.contains(e.relatedTarget)) && state.anchorDate) state.selectFocusedDate();
|
|
48
48
|
};
|
|
49
49
|
// Prevent touch scrolling while dragging
|
|
50
|
-
(0, $juhpn$useEvent)(ref,
|
|
50
|
+
(0, $juhpn$useEvent)(ref, 'touchmove', (e)=>{
|
|
51
51
|
if (state.isDragging) e.preventDefault();
|
|
52
52
|
}, {
|
|
53
53
|
passive: false,
|
|
@@ -58,4 +58,4 @@ function $46a4342aab3d8076$export$87e0539f600c24e5(props, state, ref) {
|
|
|
58
58
|
|
|
59
59
|
|
|
60
60
|
export {$46a4342aab3d8076$export$87e0539f600c24e5 as useRangeCalendar};
|
|
61
|
-
//# sourceMappingURL=useRangeCalendar.
|
|
61
|
+
//# sourceMappingURL=useRangeCalendar.module.js.map
|
|
@@ -24,8 +24,8 @@ function $46a4342aab3d8076$export$87e0539f600c24e5(props, state, ref) {
|
|
|
24
24
|
// We need to match that here otherwise this will fire before the press event in
|
|
25
25
|
// useCalendarCell, causing range selection to not work properly.
|
|
26
26
|
let isVirtualClick = (0, $juhpn$useRef)(false);
|
|
27
|
-
let windowRef = (0, $juhpn$useRef)(typeof window !==
|
|
28
|
-
(0, $juhpn$useEvent)(windowRef,
|
|
27
|
+
let windowRef = (0, $juhpn$useRef)(typeof window !== 'undefined' ? window : null);
|
|
28
|
+
(0, $juhpn$useEvent)(windowRef, 'pointerdown', (e)=>{
|
|
29
29
|
isVirtualClick.current = e.width === 0 && e.height === 0;
|
|
30
30
|
});
|
|
31
31
|
// Stop range selection when pressing or releasing a pointer outside the calendar body,
|
|
@@ -40,14 +40,14 @@ function $46a4342aab3d8076$export$87e0539f600c24e5(props, state, ref) {
|
|
|
40
40
|
let target = e.target;
|
|
41
41
|
if (ref.current && ref.current.contains(document.activeElement) && (!ref.current.contains(target) || !target.closest('button, [role="button"]'))) state.selectFocusedDate();
|
|
42
42
|
};
|
|
43
|
-
(0, $juhpn$useEvent)(windowRef,
|
|
43
|
+
(0, $juhpn$useEvent)(windowRef, 'pointerup', endDragging);
|
|
44
44
|
// Also stop range selection on blur, e.g. tabbing away from the calendar.
|
|
45
45
|
res.calendarProps.onBlur = (e)=>{
|
|
46
46
|
if (!ref.current) return;
|
|
47
47
|
if ((!e.relatedTarget || !ref.current.contains(e.relatedTarget)) && state.anchorDate) state.selectFocusedDate();
|
|
48
48
|
};
|
|
49
49
|
// Prevent touch scrolling while dragging
|
|
50
|
-
(0, $juhpn$useEvent)(ref,
|
|
50
|
+
(0, $juhpn$useEvent)(ref, 'touchmove', (e)=>{
|
|
51
51
|
if (state.isDragging) e.preventDefault();
|
|
52
52
|
}, {
|
|
53
53
|
passive: false,
|
package/dist/utils.main.js
CHANGED
|
@@ -32,22 +32,22 @@ $parcel$export(module.exports, "useVisibleRangeDescription", () => $df1d8e967e73
|
|
|
32
32
|
|
|
33
33
|
const $df1d8e967e73ec8e$export$653eddfc964b0f8a = new WeakMap();
|
|
34
34
|
function $df1d8e967e73ec8e$export$134cbb7fb09a9522(date) {
|
|
35
|
-
return (date === null || date === void 0 ? void 0 : date.calendar.identifier) ===
|
|
35
|
+
return (date === null || date === void 0 ? void 0 : date.calendar.identifier) === 'gregory' && date.era === 'BC' ? 'short' : undefined;
|
|
36
36
|
}
|
|
37
37
|
function $df1d8e967e73ec8e$export$b6df97c887c38e1a(state) {
|
|
38
|
-
let stringFormatter = (0, $idq92$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($bd6dc95a3c5ee5cd$exports))),
|
|
38
|
+
let stringFormatter = (0, $idq92$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($bd6dc95a3c5ee5cd$exports))), '@react-aria/calendar');
|
|
39
39
|
let start, end;
|
|
40
|
-
if (
|
|
40
|
+
if ('highlightedRange' in state) ({ start: start, end: end } = state.highlightedRange || {});
|
|
41
41
|
else start = end = state.value;
|
|
42
42
|
let dateFormatter = (0, $idq92$reactariai18n.useDateFormatter)({
|
|
43
|
-
weekday:
|
|
44
|
-
month:
|
|
45
|
-
year:
|
|
46
|
-
day:
|
|
43
|
+
weekday: 'long',
|
|
44
|
+
month: 'long',
|
|
45
|
+
year: 'numeric',
|
|
46
|
+
day: 'numeric',
|
|
47
47
|
era: $df1d8e967e73ec8e$export$134cbb7fb09a9522(start) || $df1d8e967e73ec8e$export$134cbb7fb09a9522(end),
|
|
48
48
|
timeZone: state.timeZone
|
|
49
49
|
});
|
|
50
|
-
let anchorDate =
|
|
50
|
+
let anchorDate = 'anchorDate' in state ? state.anchorDate : null;
|
|
51
51
|
return (0, $idq92$react.useMemo)(()=>{
|
|
52
52
|
// No message if currently selecting a range, or there is nothing highlighted.
|
|
53
53
|
if (!anchorDate && start && end) {
|
|
@@ -55,17 +55,17 @@ function $df1d8e967e73ec8e$export$b6df97c887c38e1a(state) {
|
|
|
55
55
|
// otherwise include both dates.
|
|
56
56
|
if ((0, $idq92$internationalizeddate.isSameDay)(start, end)) {
|
|
57
57
|
let date = dateFormatter.format(start.toDate(state.timeZone));
|
|
58
|
-
return stringFormatter.format(
|
|
58
|
+
return stringFormatter.format('selectedDateDescription', {
|
|
59
59
|
date: date
|
|
60
60
|
});
|
|
61
61
|
} else {
|
|
62
62
|
let dateRange = $df1d8e967e73ec8e$var$formatRange(dateFormatter, stringFormatter, start, end, state.timeZone);
|
|
63
|
-
return stringFormatter.format(
|
|
63
|
+
return stringFormatter.format('selectedRangeDescription', {
|
|
64
64
|
dateRange: dateRange
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
return
|
|
68
|
+
return '';
|
|
69
69
|
}, [
|
|
70
70
|
start,
|
|
71
71
|
end,
|
|
@@ -76,19 +76,19 @@ function $df1d8e967e73ec8e$export$b6df97c887c38e1a(state) {
|
|
|
76
76
|
]);
|
|
77
77
|
}
|
|
78
78
|
function $df1d8e967e73ec8e$export$31afe65d91ef6e8(startDate, endDate, timeZone, isAria) {
|
|
79
|
-
let stringFormatter = (0, $idq92$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($bd6dc95a3c5ee5cd$exports))),
|
|
79
|
+
let stringFormatter = (0, $idq92$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($bd6dc95a3c5ee5cd$exports))), '@react-aria/calendar');
|
|
80
80
|
let era = $df1d8e967e73ec8e$export$134cbb7fb09a9522(startDate) || $df1d8e967e73ec8e$export$134cbb7fb09a9522(endDate);
|
|
81
81
|
let monthFormatter = (0, $idq92$reactariai18n.useDateFormatter)({
|
|
82
|
-
month:
|
|
83
|
-
year:
|
|
82
|
+
month: 'long',
|
|
83
|
+
year: 'numeric',
|
|
84
84
|
era: era,
|
|
85
85
|
calendar: startDate.calendar.identifier,
|
|
86
86
|
timeZone: timeZone
|
|
87
87
|
});
|
|
88
88
|
let dateFormatter = (0, $idq92$reactariai18n.useDateFormatter)({
|
|
89
|
-
month:
|
|
90
|
-
year:
|
|
91
|
-
day:
|
|
89
|
+
month: 'long',
|
|
90
|
+
year: 'numeric',
|
|
91
|
+
day: 'numeric',
|
|
92
92
|
era: era,
|
|
93
93
|
calendar: startDate.calendar.identifier,
|
|
94
94
|
timeZone: timeZone
|
|
@@ -118,17 +118,17 @@ function $df1d8e967e73ec8e$var$formatRange(dateFormatter, stringFormatter, start
|
|
|
118
118
|
let separatorIndex = -1;
|
|
119
119
|
for(let i = 0; i < parts.length; i++){
|
|
120
120
|
let part = parts[i];
|
|
121
|
-
if (part.source ===
|
|
122
|
-
else if (part.source ===
|
|
121
|
+
if (part.source === 'shared' && part.type === 'literal') separatorIndex = i;
|
|
122
|
+
else if (part.source === 'endRange') break;
|
|
123
123
|
}
|
|
124
124
|
// Now we can combine the parts into start and end strings.
|
|
125
|
-
let startValue =
|
|
126
|
-
let endValue =
|
|
125
|
+
let startValue = '';
|
|
126
|
+
let endValue = '';
|
|
127
127
|
for(let i = 0; i < parts.length; i++){
|
|
128
128
|
if (i < separatorIndex) startValue += parts[i].value;
|
|
129
129
|
else if (i > separatorIndex) endValue += parts[i].value;
|
|
130
130
|
}
|
|
131
|
-
return stringFormatter.format(
|
|
131
|
+
return stringFormatter.format('dateRange', {
|
|
132
132
|
startDate: startValue,
|
|
133
133
|
endDate: endValue
|
|
134
134
|
});
|
package/dist/utils.mjs
CHANGED
|
@@ -23,22 +23,22 @@ function $parcel$interopDefault(a) {
|
|
|
23
23
|
|
|
24
24
|
const $a074e1e2d0f0a665$export$653eddfc964b0f8a = new WeakMap();
|
|
25
25
|
function $a074e1e2d0f0a665$export$134cbb7fb09a9522(date) {
|
|
26
|
-
return (date === null || date === void 0 ? void 0 : date.calendar.identifier) ===
|
|
26
|
+
return (date === null || date === void 0 ? void 0 : date.calendar.identifier) === 'gregory' && date.era === 'BC' ? 'short' : undefined;
|
|
27
27
|
}
|
|
28
28
|
function $a074e1e2d0f0a665$export$b6df97c887c38e1a(state) {
|
|
29
|
-
let stringFormatter = (0, $3HATx$useLocalizedStringFormatter)((0, ($parcel$interopDefault($3HATx$intlStringsmodulejs))),
|
|
29
|
+
let stringFormatter = (0, $3HATx$useLocalizedStringFormatter)((0, ($parcel$interopDefault($3HATx$intlStringsmodulejs))), '@react-aria/calendar');
|
|
30
30
|
let start, end;
|
|
31
|
-
if (
|
|
31
|
+
if ('highlightedRange' in state) ({ start: start, end: end } = state.highlightedRange || {});
|
|
32
32
|
else start = end = state.value;
|
|
33
33
|
let dateFormatter = (0, $3HATx$useDateFormatter)({
|
|
34
|
-
weekday:
|
|
35
|
-
month:
|
|
36
|
-
year:
|
|
37
|
-
day:
|
|
34
|
+
weekday: 'long',
|
|
35
|
+
month: 'long',
|
|
36
|
+
year: 'numeric',
|
|
37
|
+
day: 'numeric',
|
|
38
38
|
era: $a074e1e2d0f0a665$export$134cbb7fb09a9522(start) || $a074e1e2d0f0a665$export$134cbb7fb09a9522(end),
|
|
39
39
|
timeZone: state.timeZone
|
|
40
40
|
});
|
|
41
|
-
let anchorDate =
|
|
41
|
+
let anchorDate = 'anchorDate' in state ? state.anchorDate : null;
|
|
42
42
|
return (0, $3HATx$useMemo)(()=>{
|
|
43
43
|
// No message if currently selecting a range, or there is nothing highlighted.
|
|
44
44
|
if (!anchorDate && start && end) {
|
|
@@ -46,17 +46,17 @@ function $a074e1e2d0f0a665$export$b6df97c887c38e1a(state) {
|
|
|
46
46
|
// otherwise include both dates.
|
|
47
47
|
if ((0, $3HATx$isSameDay)(start, end)) {
|
|
48
48
|
let date = dateFormatter.format(start.toDate(state.timeZone));
|
|
49
|
-
return stringFormatter.format(
|
|
49
|
+
return stringFormatter.format('selectedDateDescription', {
|
|
50
50
|
date: date
|
|
51
51
|
});
|
|
52
52
|
} else {
|
|
53
53
|
let dateRange = $a074e1e2d0f0a665$var$formatRange(dateFormatter, stringFormatter, start, end, state.timeZone);
|
|
54
|
-
return stringFormatter.format(
|
|
54
|
+
return stringFormatter.format('selectedRangeDescription', {
|
|
55
55
|
dateRange: dateRange
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
return
|
|
59
|
+
return '';
|
|
60
60
|
}, [
|
|
61
61
|
start,
|
|
62
62
|
end,
|
|
@@ -67,19 +67,19 @@ function $a074e1e2d0f0a665$export$b6df97c887c38e1a(state) {
|
|
|
67
67
|
]);
|
|
68
68
|
}
|
|
69
69
|
function $a074e1e2d0f0a665$export$31afe65d91ef6e8(startDate, endDate, timeZone, isAria) {
|
|
70
|
-
let stringFormatter = (0, $3HATx$useLocalizedStringFormatter)((0, ($parcel$interopDefault($3HATx$intlStringsmodulejs))),
|
|
70
|
+
let stringFormatter = (0, $3HATx$useLocalizedStringFormatter)((0, ($parcel$interopDefault($3HATx$intlStringsmodulejs))), '@react-aria/calendar');
|
|
71
71
|
let era = $a074e1e2d0f0a665$export$134cbb7fb09a9522(startDate) || $a074e1e2d0f0a665$export$134cbb7fb09a9522(endDate);
|
|
72
72
|
let monthFormatter = (0, $3HATx$useDateFormatter)({
|
|
73
|
-
month:
|
|
74
|
-
year:
|
|
73
|
+
month: 'long',
|
|
74
|
+
year: 'numeric',
|
|
75
75
|
era: era,
|
|
76
76
|
calendar: startDate.calendar.identifier,
|
|
77
77
|
timeZone: timeZone
|
|
78
78
|
});
|
|
79
79
|
let dateFormatter = (0, $3HATx$useDateFormatter)({
|
|
80
|
-
month:
|
|
81
|
-
year:
|
|
82
|
-
day:
|
|
80
|
+
month: 'long',
|
|
81
|
+
year: 'numeric',
|
|
82
|
+
day: 'numeric',
|
|
83
83
|
era: era,
|
|
84
84
|
calendar: startDate.calendar.identifier,
|
|
85
85
|
timeZone: timeZone
|
|
@@ -109,17 +109,17 @@ function $a074e1e2d0f0a665$var$formatRange(dateFormatter, stringFormatter, start
|
|
|
109
109
|
let separatorIndex = -1;
|
|
110
110
|
for(let i = 0; i < parts.length; i++){
|
|
111
111
|
let part = parts[i];
|
|
112
|
-
if (part.source ===
|
|
113
|
-
else if (part.source ===
|
|
112
|
+
if (part.source === 'shared' && part.type === 'literal') separatorIndex = i;
|
|
113
|
+
else if (part.source === 'endRange') break;
|
|
114
114
|
}
|
|
115
115
|
// Now we can combine the parts into start and end strings.
|
|
116
|
-
let startValue =
|
|
117
|
-
let endValue =
|
|
116
|
+
let startValue = '';
|
|
117
|
+
let endValue = '';
|
|
118
118
|
for(let i = 0; i < parts.length; i++){
|
|
119
119
|
if (i < separatorIndex) startValue += parts[i].value;
|
|
120
120
|
else if (i > separatorIndex) endValue += parts[i].value;
|
|
121
121
|
}
|
|
122
|
-
return stringFormatter.format(
|
|
122
|
+
return stringFormatter.format('dateRange', {
|
|
123
123
|
startDate: startValue,
|
|
124
124
|
endDate: endValue
|
|
125
125
|
});
|
|
@@ -127,4 +127,4 @@ function $a074e1e2d0f0a665$var$formatRange(dateFormatter, stringFormatter, start
|
|
|
127
127
|
|
|
128
128
|
|
|
129
129
|
export {$a074e1e2d0f0a665$export$653eddfc964b0f8a as hookData, $a074e1e2d0f0a665$export$134cbb7fb09a9522 as getEraFormat, $a074e1e2d0f0a665$export$b6df97c887c38e1a as useSelectedDateDescription, $a074e1e2d0f0a665$export$31afe65d91ef6e8 as useVisibleRangeDescription};
|
|
130
|
-
//# sourceMappingURL=utils.
|
|
130
|
+
//# sourceMappingURL=utils.module.js.map
|