@ebay/ui-core-react 7.4.0-alpha.9 → 7.4.0
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/README.md +2 -2
- package/array.polyfill.flat-5BAolFdk.js +1 -0
- package/badge-CoHKfiPt.js +1 -0
- package/button-DGuEBUDJ.js +1 -0
- package/calendar-lAu6VfAb.js +1 -0
- package/common/component-utils/forwardRef/index.js +1 -10
- package/common/component-utils/index.js +1 -9
- package/common/component-utils/utils/index.js +1 -25
- package/common/event-utils/index.js +1 -113
- package/common/floating-label-utils/hooks/index.js +1 -106
- package/common/notice-utils/notice-cta/index.js +1 -5
- package/common/random-id/index.js +1 -13
- package/common/tooltip-utils/constants/index.js +1 -97
- package/common/tooltip-utils/index.js +1 -11
- package/debounce-BQsYxxOL.js +1 -0
- package/dialog-previous-button-CpuFLkQp.js +1 -0
- package/drawer-rqXAEeqd.js +1 -0
- package/ebay-alert-dialog/index.js +1 -26
- package/ebay-badge/index.js +1 -4
- package/ebay-breadcrumbs/index.js +1 -47
- package/ebay-button/index.js +1 -5
- package/ebay-calendar/index.js +1 -4
- package/ebay-carousel/index.js +1 -345
- package/ebay-checkbox/index.js +1 -52
- package/ebay-confirm-dialog/index.js +1 -28
- package/ebay-cta-button/index.js +1 -22
- package/ebay-date-textbox/index.js +1 -140
- package/ebay-dialog-base/components/animation/index.js +1 -92
- package/ebay-dialog-base/components/dialog-footer/index.js +1 -4
- package/ebay-dialog-base/components/dialog-header/index.js +1 -4
- package/ebay-dialog-base/index.js +1 -13
- package/ebay-drawer-dialog/index.js +1 -4
- package/ebay-eek/index.js +1 -54
- package/ebay-fake-menu/index.js +1 -10
- package/ebay-fake-menu/menu-item/index.js +1 -49
- package/ebay-fake-menu-button/index.js +1 -7
- package/ebay-fake-menu-button/menu-button/index.js +1 -12
- package/ebay-fake-tabs/index.js +1 -30
- package/ebay-field/index.js +1 -21
- package/ebay-fullscreen-dialog/index.js +1 -10
- package/ebay-icon/index.js +1 -4
- package/ebay-icon/types.d.ts +1 -1
- package/ebay-icon/types.d.ts.map +1 -1
- package/ebay-icon-button/index.js +1 -4
- package/ebay-infotip/index.js +1 -76
- package/ebay-inline-notice/index.js +1 -36
- package/ebay-lightbox-dialog/index.js +1 -12
- package/ebay-listbox-button/index.d.ts +2 -1
- package/ebay-listbox-button/index.d.ts.map +1 -1
- package/ebay-listbox-button/index.js +2 -151
- package/ebay-listbox-button/listbox-button-option.d.ts +10 -0
- package/ebay-listbox-button/listbox-button-option.d.ts.map +1 -0
- package/ebay-listbox-button/listbox-button.d.ts +5 -15
- package/ebay-listbox-button/listbox-button.d.ts.map +1 -1
- package/ebay-menu/index.js +1 -9
- package/ebay-menu-button/index.js +1 -113
- package/ebay-notice-base/index.js +1 -7
- package/ebay-page-notice/index.js +1 -50
- package/ebay-pagination/index.js +1 -244
- package/ebay-panel-dialog/index.js +1 -12
- package/ebay-progress-bar/index.js +1 -6
- package/ebay-progress-spinner/index.js +1 -4
- package/ebay-progress-stepper/index.js +1 -72
- package/ebay-radio/index.js +1 -4
- package/ebay-radio/radio/index.js +1 -48
- package/ebay-section-notice/index.js +1 -69
- package/ebay-section-title/index.js +1 -38
- package/ebay-segmented-buttons/index.js +1 -46
- package/ebay-select/index.js +1 -98
- package/ebay-signal/index.js +1 -9
- package/ebay-snackbar-dialog/index.js +1 -81
- package/ebay-split-button/index.js +1 -22
- package/ebay-star-rating/index.js +1 -9
- package/ebay-star-rating-select/index.js +1 -55
- package/ebay-svg/index.js +1 -5189
- package/ebay-svg/symbols.d.ts.map +1 -1
- package/ebay-switch/index.js +1 -27
- package/ebay-tabs/index.js +1 -88
- package/ebay-textbox/index.js +1 -10
- package/ebay-toast-dialog/index.js +1 -9
- package/ebay-toggle-button/README.md +39 -0
- package/ebay-toggle-button/index.d.ts +3 -0
- package/ebay-toggle-button/index.d.ts.map +1 -0
- package/ebay-toggle-button/index.js +1 -0
- package/ebay-toggle-button/toggle-button.d.ts +5 -0
- package/ebay-toggle-button/toggle-button.d.ts.map +1 -0
- package/ebay-toggle-button/types.d.ts +23 -0
- package/ebay-toggle-button/types.d.ts.map +1 -0
- package/ebay-toggle-button-group/README.md +56 -0
- package/ebay-toggle-button-group/index.d.ts +3 -0
- package/ebay-toggle-button-group/index.d.ts.map +1 -0
- package/ebay-toggle-button-group/index.js +1 -0
- package/ebay-toggle-button-group/toggle-button-group.d.ts +5 -0
- package/ebay-toggle-button-group/toggle-button-group.d.ts.map +1 -0
- package/ebay-toggle-button-group/types.d.ts +20 -0
- package/ebay-toggle-button-group/types.d.ts.map +1 -0
- package/ebay-tooltip/index.js +1 -64
- package/ebay-tourtip/index.js +1 -54
- package/ebay-video/index.js +1 -229
- package/events/index.js +1 -18
- package/icon-TuxfQndO.js +1 -0
- package/icon-button-Cwaj-eT9.js +1 -0
- package/label-CnrpYJ-g.js +1 -0
- package/menu-CV-INYLM.js +1 -0
- package/menu-_LzP6yje.js +1 -0
- package/menu-button-BZ66jxvI.js +1 -0
- package/notice-content-9iF4T8uB.js +1 -0
- package/notice-content-C0ZStfuX.js +1 -0
- package/notice-footer-Cw1DMzoB.js +1 -0
- package/package.json +2 -5
- package/progress-spinner-U2qOANON.js +1 -0
- package/range-DOsPN0h5.js +1 -0
- package/textbox-dUhinDwj.js +1 -0
- package/toggle-button-D8l0YB43.js +1 -0
- package/use-roving-index-DoAVBgsp.js +1 -0
- package/use-tooltip-CL3_zAeg.js +1 -0
- package/utils/index.js +1 -13
- package/array.polyfill.flat-DyxysTxZ.js +0 -21
- package/badge-CR5t7-2L.js +0 -8
- package/button-B4bZIgwB.js +0 -83
- package/calendar-D-DWjrMU.js +0 -333
- package/debounce-v8bWAUnY.js +0 -9
- package/dialog-previous-button-EC_Y6KaT.js +0 -370
- package/drawer-DBDktEBZ.js +0 -69
- package/ebay-listbox/README.md +0 -100
- package/ebay-listbox/index.d.ts +0 -4
- package/ebay-listbox/index.d.ts.map +0 -1
- package/ebay-listbox/index.js +0 -6
- package/ebay-listbox/listbox-option-description.d.ts +0 -4
- package/ebay-listbox/listbox-option-description.d.ts.map +0 -1
- package/ebay-listbox/listbox-option.d.ts +0 -10
- package/ebay-listbox/listbox-option.d.ts.map +0 -1
- package/ebay-listbox/listbox.d.ts +0 -22
- package/ebay-listbox/listbox.d.ts.map +0 -1
- package/icon-B17Di3YL.js +0 -56
- package/icon-button-BQWoMgX1.js +0 -31
- package/index-BXizW4ue.js +0 -89
- package/index-DcH7Tjjd.js +0 -272
- package/label-C0AS4fnO.js +0 -19
- package/listbox-DfOw_fJc.js +0 -662
- package/menu-Bsy48CE1.js +0 -163
- package/menu-button-CKGsgg6G.js +0 -89
- package/menu-fCOy6wBS.js +0 -29
- package/notice-content-BTXVxttv.js +0 -8
- package/notice-content-BhUeK1pd.js +0 -3
- package/notice-footer-CIQ8SM6N.js +0 -10
- package/progress-spinner-DOFKRtuu.js +0 -20
- package/range-C5qzyhg4.js +0 -3
- package/textbox-J291yCpJ.js +0 -136
- package/use-roving-index-CEM_UsCH.js +0 -58
- package/use-tooltip-7JxcZHJn.js +0 -92
- package/utils/scroll.d.ts +0 -2
- package/utils/scroll.d.ts.map +0 -1
package/calendar-D-DWjrMU.js
DELETED
|
@@ -1,333 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
const React = require("react");
|
|
3
|
-
const iconButton = require("./icon-button-BQWoMgX1.js");
|
|
4
|
-
const classNames = require("classnames");
|
|
5
|
-
function findFirstDayOfWeek(localeName) {
|
|
6
|
-
const locale = new Intl.Locale(localeName);
|
|
7
|
-
if (locale.weekInfo) {
|
|
8
|
-
return locale.weekInfo.firstDay;
|
|
9
|
-
}
|
|
10
|
-
return 0;
|
|
11
|
-
}
|
|
12
|
-
function getWeekdayInfo(localeName) {
|
|
13
|
-
const firstDayOfWeek = findFirstDayOfWeek(localeName);
|
|
14
|
-
const weekdayLabelFormatter = new Intl.DateTimeFormat(localeName, {
|
|
15
|
-
weekday: "short"
|
|
16
|
-
});
|
|
17
|
-
const weekday = new Date(2022, 9, 2 + firstDayOfWeek);
|
|
18
|
-
const weekdayLabels = [...Array(7)].map(() => {
|
|
19
|
-
const dayLabel = weekdayLabelFormatter.format(weekday);
|
|
20
|
-
weekday.setDate(weekday.getDate() + 1);
|
|
21
|
-
return dayLabel;
|
|
22
|
-
});
|
|
23
|
-
return {
|
|
24
|
-
firstDayOfWeek,
|
|
25
|
-
weekdayLabels
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
function dateArgToISO(arg) {
|
|
29
|
-
if (!arg)
|
|
30
|
-
return void 0;
|
|
31
|
-
if (/^\d\d\d\d-\d\d-\d\d$/g.test(arg))
|
|
32
|
-
return arg;
|
|
33
|
-
return toISO(new Date(arg));
|
|
34
|
-
}
|
|
35
|
-
function toISO(date) {
|
|
36
|
-
if (isNaN(date.getTime()))
|
|
37
|
-
return;
|
|
38
|
-
return date.toISOString().slice(0, 10);
|
|
39
|
-
}
|
|
40
|
-
function fromISO(iso) {
|
|
41
|
-
return new Date(iso);
|
|
42
|
-
}
|
|
43
|
-
function offsetISO(iso, days) {
|
|
44
|
-
const date = fromISO(iso);
|
|
45
|
-
date.setUTCDate(date.getUTCDate() + days);
|
|
46
|
-
return toISO(date);
|
|
47
|
-
}
|
|
48
|
-
function localeOverride(locale) {
|
|
49
|
-
return locale || navigator.language;
|
|
50
|
-
}
|
|
51
|
-
const DAY_UPDATE_KEYMAP = {
|
|
52
|
-
ArrowRight: 1,
|
|
53
|
-
ArrowLeft: -1,
|
|
54
|
-
ArrowDown: 7,
|
|
55
|
-
ArrowUp: -7
|
|
56
|
-
};
|
|
57
|
-
const EbayCalendar = ({ selected, numMonths = 1, navigable, interactive, range, locale, disableBefore, disableAfter, disableWeekdays, disableList, a11ySelectedText = "selected", a11yRangeStartText = "start of range", a11yInRangeText = "in range", a11yRangeEndText = "end of range", a11ySeparator = "-", a11yTodayText = "today", a11yDisabledText = "inactive", getA11yShowMonthText = (monthTitle) => `Show ${monthTitle}`, linkBuilder, onMonthChange = () => {
|
|
58
|
-
}, onFocus = () => {
|
|
59
|
-
}, onSelect = () => {
|
|
60
|
-
} }) => {
|
|
61
|
-
const todayISO = toISO(/* @__PURE__ */ new Date());
|
|
62
|
-
const { firstDayOfWeek, weekdayLabels } = getWeekdayInfo(localeOverride(locale));
|
|
63
|
-
const containerRef = React.useRef(null);
|
|
64
|
-
const [offset, setOffset] = React.useState(0);
|
|
65
|
-
const [focusISO, setFocusISO] = React.useState(null);
|
|
66
|
-
const [tabIndexISO, setTabIndexISO] = React.useState(todayISO);
|
|
67
|
-
const baseISO = React.useRef(todayISO);
|
|
68
|
-
const getMonthDate = (monthOffset) => {
|
|
69
|
-
const baseDate = fromISO(baseISO.current);
|
|
70
|
-
const date = new Date(Date.UTC(baseDate.getUTCFullYear(), baseDate.getUTCMonth() + monthOffset));
|
|
71
|
-
return date;
|
|
72
|
-
};
|
|
73
|
-
const getFirstVisibleISO = () => toISO(getMonthDate(offset));
|
|
74
|
-
const getLastVisibleISO = () => {
|
|
75
|
-
const baseDate = fromISO(baseISO.current);
|
|
76
|
-
return toISO(new Date(Date.UTC(baseDate.getUTCFullYear(), baseDate.getUTCMonth() + offset + (numMonths || 1), 0)));
|
|
77
|
-
};
|
|
78
|
-
React.useEffect(() => {
|
|
79
|
-
if (selected) {
|
|
80
|
-
const selectedISOs = Array.isArray(selected) ? selected : [selected];
|
|
81
|
-
const currFirstISO = getFirstVisibleISO();
|
|
82
|
-
const currLastISO = getLastVisibleISO();
|
|
83
|
-
const selectedTimeInView = selectedISOs.find((iso) => iso >= currFirstISO && iso <= currLastISO);
|
|
84
|
-
if (selectedTimeInView === void 0) {
|
|
85
|
-
baseISO.current = selectedISOs[0];
|
|
86
|
-
setOffset(0);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}, [selected]);
|
|
90
|
-
const calculateRangeDisplay = () => {
|
|
91
|
-
if (selected && range) {
|
|
92
|
-
let iso1;
|
|
93
|
-
let iso2;
|
|
94
|
-
if (Array.isArray(selected)) {
|
|
95
|
-
[iso1, iso2] = selected;
|
|
96
|
-
} else if (focusISO) {
|
|
97
|
-
iso1 = selected;
|
|
98
|
-
iso2 = focusISO;
|
|
99
|
-
}
|
|
100
|
-
if (iso1 && iso2) {
|
|
101
|
-
const [start, end] = [iso1, iso2].sort();
|
|
102
|
-
return {
|
|
103
|
-
rangeStart: start,
|
|
104
|
-
rangeEnd: end
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
return {
|
|
109
|
-
rangeStart: null,
|
|
110
|
-
rangeEnd: null
|
|
111
|
-
};
|
|
112
|
-
};
|
|
113
|
-
const monthTitle = (date) => {
|
|
114
|
-
const formatter = new Intl.DateTimeFormat(localeOverride(locale), {
|
|
115
|
-
month: "long",
|
|
116
|
-
year: "numeric"
|
|
117
|
-
});
|
|
118
|
-
return formatter.format(new Date(date.getUTCFullYear(), date.getUTCMonth()));
|
|
119
|
-
};
|
|
120
|
-
const isDayDisabled = (iso) => disableBefore && iso < disableBefore || disableAfter && iso > disableAfter || disableWeekdays && disableWeekdays.includes(fromISO(iso).getUTCDay()) || disableList && disableList.includes(iso);
|
|
121
|
-
const getFirstActiveISO = () => {
|
|
122
|
-
let iso = getFirstVisibleISO();
|
|
123
|
-
const lastVisible = getLastVisibleISO();
|
|
124
|
-
while (iso <= lastVisible && isDayDisabled(iso)) {
|
|
125
|
-
iso = offsetISO(iso, 1);
|
|
126
|
-
}
|
|
127
|
-
return iso > lastVisible ? null : iso;
|
|
128
|
-
};
|
|
129
|
-
const getLastActiveISO = () => {
|
|
130
|
-
let iso = getLastVisibleISO();
|
|
131
|
-
const firstVisible = getFirstVisibleISO();
|
|
132
|
-
while (iso >= firstVisible && isDayDisabled(iso)) {
|
|
133
|
-
iso = offsetISO(iso, -1);
|
|
134
|
-
}
|
|
135
|
-
return iso < firstVisible ? null : iso;
|
|
136
|
-
};
|
|
137
|
-
const setTabindexAndFocus = (iso) => {
|
|
138
|
-
setTabIndexISO(iso);
|
|
139
|
-
setTimeout(() => {
|
|
140
|
-
var _a;
|
|
141
|
-
const elementToFocus = (_a = containerRef.current) == null ? void 0 : _a.querySelector(`[data-iso="${iso}"]`);
|
|
142
|
-
elementToFocus == null ? void 0 : elementToFocus.focus();
|
|
143
|
-
});
|
|
144
|
-
};
|
|
145
|
-
const prevMonth = (focus) => {
|
|
146
|
-
if (disableBefore && getFirstVisibleISO() <= disableBefore) {
|
|
147
|
-
return false;
|
|
148
|
-
}
|
|
149
|
-
setOffset((currentOffset) => currentOffset - 1);
|
|
150
|
-
let newTabIndexISO = tabIndexISO;
|
|
151
|
-
const lastActiveISO = getLastActiveISO();
|
|
152
|
-
if (lastActiveISO && lastActiveISO < tabIndexISO) {
|
|
153
|
-
newTabIndexISO = lastActiveISO;
|
|
154
|
-
setTabIndexISO(lastActiveISO);
|
|
155
|
-
}
|
|
156
|
-
if (focus) {
|
|
157
|
-
setTabindexAndFocus(newTabIndexISO);
|
|
158
|
-
}
|
|
159
|
-
onMonthChange({
|
|
160
|
-
iso: toISO(getMonthDate(offset))
|
|
161
|
-
});
|
|
162
|
-
return true;
|
|
163
|
-
};
|
|
164
|
-
const nextMonth = (focus) => {
|
|
165
|
-
if (disableAfter && getLastVisibleISO() >= disableAfter) {
|
|
166
|
-
return false;
|
|
167
|
-
}
|
|
168
|
-
setOffset((currentOffset) => currentOffset + 1);
|
|
169
|
-
let newTabIndexISO = tabIndexISO;
|
|
170
|
-
const firstActiveISO = getFirstActiveISO();
|
|
171
|
-
if (firstActiveISO && firstActiveISO > tabIndexISO) {
|
|
172
|
-
newTabIndexISO = firstActiveISO;
|
|
173
|
-
setTabIndexISO(firstActiveISO);
|
|
174
|
-
}
|
|
175
|
-
if (focus) {
|
|
176
|
-
setTabindexAndFocus(newTabIndexISO);
|
|
177
|
-
}
|
|
178
|
-
onMonthChange({
|
|
179
|
-
iso: toISO(getMonthDate(offset + (numMonths || 1)))
|
|
180
|
-
});
|
|
181
|
-
};
|
|
182
|
-
const onKeyDown = (event) => {
|
|
183
|
-
const dayChange = DAY_UPDATE_KEYMAP[event.key];
|
|
184
|
-
if (dayChange) {
|
|
185
|
-
event.preventDefault();
|
|
186
|
-
let tries = 7;
|
|
187
|
-
let iso = tabIndexISO;
|
|
188
|
-
do {
|
|
189
|
-
iso = offsetISO(iso, dayChange);
|
|
190
|
-
} while (tries-- > 0 && isDayDisabled(iso));
|
|
191
|
-
if (tries > 0) {
|
|
192
|
-
const firstVisible = getFirstVisibleISO();
|
|
193
|
-
const lastVisible = getLastVisibleISO();
|
|
194
|
-
if (iso < firstVisible) {
|
|
195
|
-
if (navigable) {
|
|
196
|
-
prevMonth();
|
|
197
|
-
} else {
|
|
198
|
-
iso = firstVisible;
|
|
199
|
-
}
|
|
200
|
-
} else if (iso > lastVisible) {
|
|
201
|
-
if (navigable) {
|
|
202
|
-
nextMonth();
|
|
203
|
-
} else {
|
|
204
|
-
iso = lastVisible;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
setTabindexAndFocus(iso);
|
|
208
|
-
}
|
|
209
|
-
} else {
|
|
210
|
-
switch (event.key) {
|
|
211
|
-
case "PageUp":
|
|
212
|
-
prevMonth(true);
|
|
213
|
-
break;
|
|
214
|
-
case "PageDown":
|
|
215
|
-
nextMonth(true);
|
|
216
|
-
break;
|
|
217
|
-
case "Home":
|
|
218
|
-
setTabindexAndFocus(getFirstActiveISO());
|
|
219
|
-
break;
|
|
220
|
-
case "End":
|
|
221
|
-
setTabindexAndFocus(getLastActiveISO());
|
|
222
|
-
break;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
};
|
|
226
|
-
const onDaySelect = (event, iso) => {
|
|
227
|
-
onSelect(event, { iso });
|
|
228
|
-
};
|
|
229
|
-
const onDayFocus = (event, day) => {
|
|
230
|
-
setFocusISO(day);
|
|
231
|
-
setTabIndexISO(day);
|
|
232
|
-
onFocus(event, { iso: day });
|
|
233
|
-
};
|
|
234
|
-
const onDayBlur = () => {
|
|
235
|
-
setFocusISO(null);
|
|
236
|
-
};
|
|
237
|
-
const { rangeStart, rangeEnd } = calculateRangeDisplay();
|
|
238
|
-
const isDayInRange = (iso) => {
|
|
239
|
-
if (!rangeStart || !rangeEnd) {
|
|
240
|
-
return false;
|
|
241
|
-
}
|
|
242
|
-
if (iso < rangeStart || iso > rangeEnd) {
|
|
243
|
-
return false;
|
|
244
|
-
}
|
|
245
|
-
return true;
|
|
246
|
-
};
|
|
247
|
-
const monthDates = [...Array(numMonths)].map((_, i) => getMonthDate(offset + i));
|
|
248
|
-
return React.createElement(
|
|
249
|
-
"div",
|
|
250
|
-
{ className: "calendar", ref: containerRef },
|
|
251
|
-
navigable && React.createElement(
|
|
252
|
-
"div",
|
|
253
|
-
{ className: "calendar__header" },
|
|
254
|
-
React.createElement(
|
|
255
|
-
"div",
|
|
256
|
-
{ className: "calendar__header--inner" },
|
|
257
|
-
React.createElement(iconButton.EbayIconButton, { transparent: true, size: "small", icon: "chevronLeft24", disabled: disableBefore && getFirstVisibleISO() <= disableBefore, "aria-label": getA11yShowMonthText(monthTitle(getMonthDate(offset - 1))), onClick: () => prevMonth() }),
|
|
258
|
-
monthDates.map((monthDate, i) => React.createElement("h3", { key: i }, monthTitle(monthDate))),
|
|
259
|
-
React.createElement(iconButton.EbayIconButton, { transparent: true, size: "small", icon: "chevronRight24", disabled: disableAfter && getLastVisibleISO() >= disableAfter, "aria-label": getA11yShowMonthText(monthTitle(getMonthDate(offset + numMonths))), onClick: () => nextMonth() })
|
|
260
|
-
)
|
|
261
|
-
),
|
|
262
|
-
React.createElement("div", { className: "calendar__body" }, monthDates.map((monthDate, i) => {
|
|
263
|
-
const numBlankDays = (monthDate.getUTCDay() - firstDayOfWeek + 7) % 7;
|
|
264
|
-
const year = monthDate.getUTCFullYear();
|
|
265
|
-
const month = monthDate.getUTCMonth();
|
|
266
|
-
const daysInMont = new Date(year, month + 1, 0).getDate();
|
|
267
|
-
const calendarRows = [...Array(Math.ceil((numBlankDays + daysInMont) / 7))];
|
|
268
|
-
return React.createElement(
|
|
269
|
-
"div",
|
|
270
|
-
{ key: i, className: "calendar__month" },
|
|
271
|
-
React.createElement(
|
|
272
|
-
"table",
|
|
273
|
-
{ onKeyDown },
|
|
274
|
-
React.createElement("caption", null, monthTitle(monthDate)),
|
|
275
|
-
React.createElement(
|
|
276
|
-
"thead",
|
|
277
|
-
null,
|
|
278
|
-
React.createElement("tr", null, weekdayLabels.map((dayName) => React.createElement("th", { key: dayName, scope: "col" }, dayName)))
|
|
279
|
-
),
|
|
280
|
-
React.createElement("tbody", null, calendarRows.map((_, row) => {
|
|
281
|
-
let startDate = row * 7 - numBlankDays + 1;
|
|
282
|
-
let endDate = startDate + 6;
|
|
283
|
-
const columns = [];
|
|
284
|
-
if (row === 0 && numBlankDays !== 0) {
|
|
285
|
-
startDate = 1;
|
|
286
|
-
columns.push(React.createElement("td", { key: "pre-column", colSpan: numBlankDays }));
|
|
287
|
-
} else if (endDate > daysInMont) {
|
|
288
|
-
endDate = daysInMont;
|
|
289
|
-
}
|
|
290
|
-
for (let day = startDate; day <= endDate; day++) {
|
|
291
|
-
const dayISO = toISO(new Date(Date.UTC(year, month, day)));
|
|
292
|
-
const isToday = dayISO === todayISO;
|
|
293
|
-
const isSelected = Array.isArray(selected) ? selected.some((iso) => iso === dayISO) : selected === dayISO;
|
|
294
|
-
const isRangeStart = dayISO === rangeStart;
|
|
295
|
-
const isInRange = isDayInRange(dayISO);
|
|
296
|
-
const isRangeEnd = dayISO === rangeEnd;
|
|
297
|
-
const isDisabled = isDayDisabled(dayISO);
|
|
298
|
-
const a11yTexts = [
|
|
299
|
-
"",
|
|
300
|
-
isSelected && a11ySelectedText,
|
|
301
|
-
isRangeStart && a11yRangeStartText,
|
|
302
|
-
!isRangeStart && !isRangeEnd && isInRange && a11yInRangeText,
|
|
303
|
-
isRangeEnd && a11yRangeEndText,
|
|
304
|
-
!interactive && isToday && a11yTodayText,
|
|
305
|
-
!interactive && isDisabled && a11yDisabledText
|
|
306
|
-
].filter((value) => typeof value !== "boolean" || value !== false);
|
|
307
|
-
const link = !interactive && !isDisabled && linkBuilder && linkBuilder(dayISO);
|
|
308
|
-
const NonInteractiveTag = link ? "a" : "span";
|
|
309
|
-
columns.push(React.createElement("td", { key: day, className: classNames({
|
|
310
|
-
"calendar__cell--selected": isSelected,
|
|
311
|
-
"calendar__range--start": isRangeStart,
|
|
312
|
-
"calendar__range": isInRange,
|
|
313
|
-
"calendar__range--end": isRangeEnd
|
|
314
|
-
}) }, interactive ? React.createElement("button", { disabled: isDisabled, "aria-label": a11yTexts.length > 1 ? `${day}${a11yTexts.join(a11ySeparator)}` : void 0, tabIndex: tabIndexISO !== dayISO ? -1 : void 0, "aria-current": isToday ? "date" : void 0, "aria-pressed": isSelected ? "true" : void 0, onClick: (event) => onDaySelect(event, dayISO), onFocus: (event) => onDayFocus(event, dayISO), onMouseOver: (event) => onDayFocus(event, dayISO), onMouseOut: (event) => onDayBlur(), onBlur: () => onDayBlur(), "data-iso": dayISO }, day) : React.createElement(
|
|
315
|
-
NonInteractiveTag,
|
|
316
|
-
{ className: classNames({
|
|
317
|
-
"calendar__cell--disabled": isDisabled,
|
|
318
|
-
"calendar__cell--current": isToday
|
|
319
|
-
}), href: link },
|
|
320
|
-
day,
|
|
321
|
-
a11yTexts.length > 1 && React.createElement("span", { className: "clipped" }, a11yTexts.join(a11ySeparator))
|
|
322
|
-
)));
|
|
323
|
-
}
|
|
324
|
-
return React.createElement("tr", { key: row }, columns);
|
|
325
|
-
}))
|
|
326
|
-
)
|
|
327
|
-
);
|
|
328
|
-
}))
|
|
329
|
-
);
|
|
330
|
-
};
|
|
331
|
-
exports.EbayCalendar = EbayCalendar;
|
|
332
|
-
exports.dateArgToISO = dateArgToISO;
|
|
333
|
-
exports.toISO = toISO;
|