@spaced-out/ui-design-system 0.5.0 → 0.5.1
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/.cspell/custom-words.txt +9 -7
- package/.storybook/{SenseTheme.js → SenseTheme.ts} +4 -2
- package/.storybook/{main.js → main.ts} +24 -24
- package/.storybook/manager-head.html +4 -0
- package/.storybook/{manager.js → manager.ts} +0 -3
- package/.storybook/paths-macro.d.ts +6 -0
- package/.storybook/preview.ts +67 -0
- package/.storybook/tsconfig.json +14 -0
- package/CHANGELOG.md +21 -0
- package/lib/components/Charts/ChartTooltip/index.d.ts +2 -2
- package/lib/components/Charts/ChartTooltip/index.d.ts.map +1 -1
- package/lib/components/Charts/ColumnChart/ColumnChart.d.ts +2 -1
- package/lib/components/Charts/ColumnChart/ColumnChart.d.ts.map +1 -1
- package/lib/components/Charts/DonutChart/DonutChart.d.ts +3 -2
- package/lib/components/Charts/DonutChart/DonutChart.d.ts.map +1 -1
- package/lib/components/Charts/FunnelChart/FunnelChart.d.ts +2 -1
- package/lib/components/Charts/FunnelChart/FunnelChart.d.ts.map +1 -1
- package/lib/components/Charts/LineChart/LineChart.d.ts +2 -1
- package/lib/components/Charts/LineChart/LineChart.d.ts.map +1 -1
- package/lib/components/Charts/SpiderChart/SpiderChart.d.ts +2 -1
- package/lib/components/Charts/SpiderChart/SpiderChart.d.ts.map +1 -1
- package/lib/components/Charts/index.d.ts.map +1 -1
- package/lib/components/ChatBubble/ChatBubble.d.ts +2 -1
- package/lib/components/ChatBubble/ChatBubble.d.ts.map +1 -1
- package/lib/components/FileUpload/FileBlock/FileBlock.d.ts +1 -0
- package/lib/components/FileUpload/FileBlock/FileBlock.d.ts.map +1 -1
- package/lib/components/FileUpload/FileBlock/FileBlock.js +3 -2
- package/lib/components/FileUpload/FileBlock/FileBlock.stories.d.ts +14 -0
- package/lib/components/FileUpload/FileBlock/FileBlock.stories.d.ts.map +1 -1
- package/lib/components/OptionButton/SimpleOptionButton.d.ts +0 -1
- package/lib/components/OptionButton/SimpleOptionButton.d.ts.map +1 -1
- package/lib/components/ScoreBar/ScoreBar.d.ts +2 -1
- package/lib/components/ScoreBar/ScoreBar.d.ts.map +1 -1
- package/lib/components/Table/StaticTable.d.ts.map +1 -1
- package/lib/components/Table/Table.d.ts +2 -2
- package/lib/components/Table/Table.d.ts.map +1 -1
- package/lib/components/index.d.ts.map +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/types/charts.d.ts +19 -10
- package/lib/types/charts.d.ts.map +1 -1
- package/lib/utils/charts/charts.d.ts.map +1 -1
- package/lib/utils/charts/charts.js +0 -4
- package/lib/utils/charts/columnChart.d.ts.map +1 -1
- package/lib/utils/charts/columnChart.js +0 -1
- package/lib/utils/charts/donutChart.d.ts.map +1 -1
- package/lib/utils/charts/donutChart.js +1 -7
- package/lib/utils/charts/funnelChart.d.ts.map +1 -1
- package/lib/utils/charts/funnelChart.js +0 -3
- package/lib/utils/charts/lineChart.d.ts.map +1 -1
- package/lib/utils/charts/lineChart.js +0 -1
- package/lib/utils/classify/index.d.ts.map +1 -1
- package/lib/utils/classify/index.js +4 -2
- package/lib/utils/click-away/click-away.d.ts +9 -13
- package/lib/utils/click-away/click-away.d.ts.map +1 -1
- package/lib/utils/click-away/click-away.js +6 -18
- package/lib/utils/date-range-picker/date-range-picker.d.ts +12 -11
- package/lib/utils/date-range-picker/date-range-picker.d.ts.map +1 -1
- package/lib/utils/date-range-picker/date-range-picker.js +12 -34
- package/lib/utils/date-range-picker/timezones.d.ts +1 -254
- package/lib/utils/date-range-picker/timezones.d.ts.map +1 -1
- package/lib/utils/dom/dom.d.ts +5 -13
- package/lib/utils/dom/dom.d.ts.map +1 -1
- package/lib/utils/dom/dom.js +21 -20
- package/lib/utils/makeClassNameComponent/makeClassNameComponent.d.ts +17 -5
- package/lib/utils/makeClassNameComponent/makeClassNameComponent.d.ts.map +1 -1
- package/lib/utils/makeClassNameComponent/makeClassNameComponent.js +28 -47
- package/lib/utils/merge-refs/merge-refs.d.ts +1 -1
- package/lib/utils/merge-refs/merge-refs.d.ts.map +1 -1
- package/lib/utils/merge-refs/merge-refs.js +0 -1
- package/package.json +32 -26
- package/tsconfig.json +3 -5
- package/.storybook/preview.js +0 -124
|
@@ -108,8 +108,7 @@ const wrangleMoment = date => {
|
|
|
108
108
|
} else if (!date) {
|
|
109
109
|
return new Date();
|
|
110
110
|
}
|
|
111
|
-
|
|
112
|
-
return date instanceof _moment.default ? date.toDate() : (0, _parseISO.default)(date);
|
|
111
|
+
return _moment.default.isMoment(date) ? date.toDate() : (0, _parseISO.default)(date);
|
|
113
112
|
};
|
|
114
113
|
exports.wrangleMoment = wrangleMoment;
|
|
115
114
|
const formatIsoDate = function (date) {
|
|
@@ -140,7 +139,6 @@ const inDateRange = (_ref3, date) => {
|
|
|
140
139
|
const momentDay = _moment.default.utc(date);
|
|
141
140
|
const momentStartDate = _moment.default.utc(startDate);
|
|
142
141
|
const momentEndDate = _moment.default.utc(endDate);
|
|
143
|
-
// @ts-ignore - TS2345 - Argument of type 'Moment' is not assignable to parameter of type 'string'.
|
|
144
142
|
return isBetween(momentDay, momentStartDate, momentEndDate);
|
|
145
143
|
}
|
|
146
144
|
return false;
|
|
@@ -164,10 +162,8 @@ const getMonthAndYear = date => {
|
|
|
164
162
|
const getDaysInMonth = date => {
|
|
165
163
|
const startWeek = _moment.default.utc(date).startOf('month').startOf('week');
|
|
166
164
|
const endWeek = _moment.default.utc(date).endOf('month').endOf('week');
|
|
167
|
-
const days = []
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
// @ts-ignore - TS2345 - Argument of type 'Moment' is not assignable to parameter of type 'string'.
|
|
165
|
+
const days = [];
|
|
166
|
+
const current = startWeek.clone();
|
|
171
167
|
while (isBefore(current, endWeek)) {
|
|
172
168
|
days.push(current.clone().format('YYYY-MM-DD'));
|
|
173
169
|
current.add(1, 'd');
|
|
@@ -176,10 +172,8 @@ const getDaysInMonth = date => {
|
|
|
176
172
|
|
|
177
173
|
// if total rows in calendar are 5 add one more week to the calendar
|
|
178
174
|
if (daysInChunks.length === 5) {
|
|
179
|
-
// @ts-ignore - TS2345 - Argument of type 'Moment' is not assignable to parameter of type 'string'.
|
|
180
175
|
const nextWeek = getAddedDate(endWeek, WEEKDAYS.length, 'd');
|
|
181
176
|
const extraDays = [];
|
|
182
|
-
// @ts-ignore - TS2345 - Argument of type 'Moment' is not assignable to parameter of type 'string'.
|
|
183
177
|
while (isSameOrBefore(current, nextWeek)) {
|
|
184
178
|
extraDays.push(current.clone().format('YYYY-MM-DD'));
|
|
185
179
|
current.add(1, 'd');
|
|
@@ -188,30 +182,18 @@ const getDaysInMonth = date => {
|
|
|
188
182
|
}
|
|
189
183
|
return daysInChunks;
|
|
190
184
|
};
|
|
191
|
-
|
|
192
|
-
// @ts-ignore - TS2345 - Argument of type 'Moment' is not assignable to parameter of type 'string | Date | undefined'.
|
|
193
185
|
exports.getDaysInMonth = getDaysInMonth;
|
|
194
|
-
const getAddedDate = (date, addCount, timeUnit
|
|
195
|
-
//@ts-expect-error
|
|
196
|
-
) => formatIsoDate(_moment.default.utc(date).add(addCount, timeUnit));
|
|
197
|
-
|
|
198
|
-
// @ts-ignore - TS2345 - Argument of type 'Moment' is not assignable to parameter of type 'string | Date | undefined'.
|
|
186
|
+
const getAddedDate = (date, addCount, timeUnit) => formatIsoDate(_moment.default.utc(date).add(addCount, timeUnit));
|
|
199
187
|
exports.getAddedDate = getAddedDate;
|
|
200
|
-
const getSubtractedDate = (date, subtractCount, timeUnit
|
|
201
|
-
//@ts-expect-error
|
|
202
|
-
) => formatIsoDate(_moment.default.utc(date).subtract(subtractCount, timeUnit));
|
|
203
|
-
|
|
204
|
-
// @ts-ignore - TS2345 - Argument of type 'Moment' is not assignable to parameter of type 'string | Date | undefined'.
|
|
188
|
+
const getSubtractedDate = (date, subtractCount, timeUnit) => formatIsoDate(_moment.default.utc(date).subtract(subtractCount, timeUnit));
|
|
205
189
|
exports.getSubtractedDate = getSubtractedDate;
|
|
206
|
-
const getMonthEndDate = date =>
|
|
207
|
-
//@ts-expect-error
|
|
208
|
-
formatIsoDate(_moment.default.utc(date).endOf('M'));
|
|
190
|
+
const getMonthEndDate = date => formatIsoDate(_moment.default.utc(date).endOf('M'));
|
|
209
191
|
exports.getMonthEndDate = getMonthEndDate;
|
|
210
192
|
const getTimezones = t => Object.keys(_timezones.TIMEZONES).reduce((menuOptions, key) => {
|
|
193
|
+
const label = _timezones.TIMEZONES[key];
|
|
211
194
|
menuOptions.push({
|
|
212
195
|
key,
|
|
213
|
-
|
|
214
|
-
label: getTranslation(t, _timezones.TIMEZONES[key])
|
|
196
|
+
label: getTranslation(t, label)
|
|
215
197
|
});
|
|
216
198
|
return menuOptions;
|
|
217
199
|
}, []);
|
|
@@ -252,21 +234,17 @@ const getAvailableMonths = _ref6 => {
|
|
|
252
234
|
const isFirstAndMinDateYearSame = rangeStartYear === minDateYear;
|
|
253
235
|
const isSecondAndMaxDateYearSame = rangeEndYear === maxDateYear;
|
|
254
236
|
if (marker === MARKERS.DATE_RANGE_START) {
|
|
255
|
-
|
|
256
|
-
if (isSameYear && month.key >= rangeEndMonthKey) {
|
|
237
|
+
if (isSameYear && Number(month.key) >= rangeEndMonthKey) {
|
|
257
238
|
return false;
|
|
258
|
-
|
|
259
|
-
} else if (isFirstAndMinDateYearSame && month.key < minDateMonth) {
|
|
239
|
+
} else if (isFirstAndMinDateYearSame && Number(month.key) < minDateMonth) {
|
|
260
240
|
return false;
|
|
261
241
|
} else {
|
|
262
242
|
return true;
|
|
263
243
|
}
|
|
264
244
|
} else {
|
|
265
|
-
|
|
266
|
-
if (isSameYear && month.key <= rangeStartMonthKey) {
|
|
245
|
+
if (isSameYear && Number(month.key) <= rangeStartMonthKey) {
|
|
267
246
|
return false;
|
|
268
|
-
|
|
269
|
-
} else if (isSecondAndMaxDateYearSame && month.key > maxDateMonth) {
|
|
247
|
+
} else if (isSecondAndMaxDateYearSame && Number(month.key) > maxDateMonth) {
|
|
270
248
|
return false;
|
|
271
249
|
} else {
|
|
272
250
|
return true;
|
|
@@ -1,257 +1,4 @@
|
|
|
1
|
-
export declare const TIMEZONES:
|
|
2
|
-
readonly 'Pacific/Niue': "(GMT-11:00) Niue";
|
|
3
|
-
readonly 'Pacific/Pago_Pago': "(GMT-11:00) Pago Pago";
|
|
4
|
-
readonly 'Pacific/Honolulu': "(GMT-10:00) Hawaii Time";
|
|
5
|
-
readonly 'Pacific/Rarotonga': "(GMT-10:00) Rarotonga";
|
|
6
|
-
readonly 'Pacific/Tahiti': "(GMT-10:00) Tahiti";
|
|
7
|
-
readonly 'Pacific/Marquesas': "(GMT-09:30) Marquesas";
|
|
8
|
-
readonly 'America/Anchorage': "(GMT-09:00) Alaska Time";
|
|
9
|
-
readonly 'Pacific/Gambier': "(GMT-09:00) Gambier";
|
|
10
|
-
readonly 'America/Los_Angeles': "(GMT-08:00) Pacific Time";
|
|
11
|
-
readonly 'America/Tijuana': "(GMT-08:00) Pacific Time - Tijuana";
|
|
12
|
-
readonly 'America/Vancouver': "(GMT-08:00) Pacific Time - Vancouver";
|
|
13
|
-
readonly 'America/Whitehorse': "(GMT-08:00) Pacific Time - Whitehorse";
|
|
14
|
-
readonly 'Pacific/Pitcairn': "(GMT-08:00) Pitcairn";
|
|
15
|
-
readonly 'America/Dawson_Creek': "(GMT-07:00) Mountain Time - Dawson Creek";
|
|
16
|
-
readonly 'America/Denver': "(GMT-07:00) Mountain Time";
|
|
17
|
-
readonly 'America/Edmonton': "(GMT-07:00) Mountain Time - Edmonton";
|
|
18
|
-
readonly 'America/Hermosillo': "(GMT-07:00) Mountain Time - Hermosillo";
|
|
19
|
-
readonly 'America/Mazatlan': "(GMT-07:00) Mountain Time - Chihuahua, Mazatlan";
|
|
20
|
-
readonly 'America/Phoenix': "(GMT-07:00) Mountain Time - Arizona";
|
|
21
|
-
readonly 'America/Yellowknife': "(GMT-07:00) Mountain Time - Yellowknife";
|
|
22
|
-
readonly 'America/Belize': "(GMT-06:00) Belize";
|
|
23
|
-
readonly 'America/Chicago': "(GMT-06:00) Central Time";
|
|
24
|
-
readonly 'America/Costa_Rica': "(GMT-06:00) Costa Rica";
|
|
25
|
-
readonly 'America/El_Salvador': "(GMT-06:00) El Salvador";
|
|
26
|
-
readonly 'America/Guatemala': "(GMT-06:00) Guatemala";
|
|
27
|
-
readonly 'America/Managua': "(GMT-06:00) Managua";
|
|
28
|
-
readonly 'America/Mexico_City': "(GMT-06:00) Central Time - Mexico City";
|
|
29
|
-
readonly 'America/Regina': "(GMT-06:00) Central Time - Regina";
|
|
30
|
-
readonly 'America/Tegucigalpa': "(GMT-06:00) Central Time - Tegucigalpa";
|
|
31
|
-
readonly 'America/Winnipeg': "(GMT-06:00) Central Time - Winnipeg";
|
|
32
|
-
readonly 'Pacific/Galapagos': "(GMT-06:00) Galapagos";
|
|
33
|
-
readonly 'America/Bogota': "(GMT-05:00) Bogota";
|
|
34
|
-
readonly 'America/Cancun': "(GMT-05:00) America Cancun";
|
|
35
|
-
readonly 'America/Cayman': "(GMT-05:00) Cayman";
|
|
36
|
-
readonly 'America/Guayaquil': "(GMT-05:00) Guayaquil";
|
|
37
|
-
readonly 'America/Havana': "(GMT-05:00) Havana";
|
|
38
|
-
readonly 'America/Iqaluit': "(GMT-05:00) Eastern Time - Iqaluit";
|
|
39
|
-
readonly 'America/Jamaica': "(GMT-05:00) Jamaica";
|
|
40
|
-
readonly 'America/Lima': "(GMT-05:00) Lima";
|
|
41
|
-
readonly 'America/Nassau': "(GMT-05:00) Nassau";
|
|
42
|
-
readonly 'America/New_York': "(GMT-05:00) Eastern Time";
|
|
43
|
-
readonly 'America/Panama': "(GMT-05:00) Panama";
|
|
44
|
-
readonly 'America/Port-au-Prince': "(GMT-05:00) Port-au-Prince";
|
|
45
|
-
readonly 'America/Rio_Branco': "(GMT-05:00) Rio Branco";
|
|
46
|
-
readonly 'America/Toronto': "(GMT-05:00) Eastern Time - Toronto";
|
|
47
|
-
readonly 'Pacific/Easter': "(GMT-05:00) Easter Island";
|
|
48
|
-
readonly 'America/Caracas': "(GMT-04:00) Caracas";
|
|
49
|
-
readonly 'America/Asuncion': "(GMT-03:00) Asuncion";
|
|
50
|
-
readonly 'America/Barbados': "(GMT-04:00) Barbados";
|
|
51
|
-
readonly 'America/Boa_Vista': "(GMT-04:00) Boa Vista";
|
|
52
|
-
readonly 'America/Campo_Grande': "(GMT-03:00) Campo Grande";
|
|
53
|
-
readonly 'America/Cuiaba': "(GMT-03:00) Cuiaba";
|
|
54
|
-
readonly 'America/Curacao': "(GMT-04:00) Curacao";
|
|
55
|
-
readonly 'America/Grand_Turk': "(GMT-04:00) Grand Turk";
|
|
56
|
-
readonly 'America/Guyana': "(GMT-04:00) Guyana";
|
|
57
|
-
readonly 'America/Halifax': "(GMT-04:00) Atlantic Time - Halifax";
|
|
58
|
-
readonly 'America/La_Paz': "(GMT-04:00) La Paz";
|
|
59
|
-
readonly 'America/Manaus': "(GMT-04:00) Manaus";
|
|
60
|
-
readonly 'America/Martinique': "(GMT-04:00) Martinique";
|
|
61
|
-
readonly 'America/Port_of_Spain': "(GMT-04:00) Port of Spain";
|
|
62
|
-
readonly 'America/Porto_Velho': "(GMT-04:00) Porto Velho";
|
|
63
|
-
readonly 'America/Puerto_Rico': "(GMT-04:00) Puerto Rico";
|
|
64
|
-
readonly 'America/Santo_Domingo': "(GMT-04:00) Santo Domingo";
|
|
65
|
-
readonly 'America/Thule': "(GMT-04:00) Thule";
|
|
66
|
-
readonly 'Atlantic/Bermuda': "(GMT-04:00) Bermuda";
|
|
67
|
-
readonly 'America/St_Johns': "(GMT-03:30) Newfoundland Time - St. Johns";
|
|
68
|
-
readonly 'America/Araguaina': "(GMT-03:00) Araguaina";
|
|
69
|
-
readonly 'America/Argentina/Buenos_Aires': "(GMT-03:00) Buenos Aires";
|
|
70
|
-
readonly 'America/Bahia': "(GMT-03:00) Salvador";
|
|
71
|
-
readonly 'America/Belem': "(GMT-03:00) Belem";
|
|
72
|
-
readonly 'America/Cayenne': "(GMT-03:00) Cayenne";
|
|
73
|
-
readonly 'America/Fortaleza': "(GMT-03:00) Fortaleza";
|
|
74
|
-
readonly 'America/Godthab': "(GMT-03:00) Godthab";
|
|
75
|
-
readonly 'America/Maceio': "(GMT-03:00) Maceio";
|
|
76
|
-
readonly 'America/Miquelon': "(GMT-03:00) Miquelon";
|
|
77
|
-
readonly 'America/Montevideo': "(GMT-03:00) Montevideo";
|
|
78
|
-
readonly 'America/Paramaribo': "(GMT-03:00) Paramaribo";
|
|
79
|
-
readonly 'America/Recife': "(GMT-03:00) Recife";
|
|
80
|
-
readonly 'America/Santiago': "(GMT-03:00) Santiago";
|
|
81
|
-
readonly 'America/Sao_Paulo': "(GMT-03:00) Sao Paulo";
|
|
82
|
-
readonly 'Antarctica/Palmer': "(GMT-03:00) Palmer";
|
|
83
|
-
readonly 'Antarctica/Rothera': "(GMT-03:00) Rothera";
|
|
84
|
-
readonly 'Atlantic/Stanley': "(GMT-03:00) Stanley";
|
|
85
|
-
readonly 'America/Noronha': "(GMT-02:00) Noronha";
|
|
86
|
-
readonly 'Atlantic/South_Georgia': "(GMT-02:00) South Georgia";
|
|
87
|
-
readonly 'America/Scoresbysund': "(GMT-01:00) Scoresbysund";
|
|
88
|
-
readonly 'Atlantic/Azores': "(GMT-01:00) Azores";
|
|
89
|
-
readonly 'Atlantic/Cape_Verde': "(GMT-01:00) Cape Verde";
|
|
90
|
-
readonly 'Africa/Abidjan': "(GMT+00:00) Abidjan";
|
|
91
|
-
readonly 'Africa/Accra': "(GMT+00:00) Accra";
|
|
92
|
-
readonly 'Africa/Bissau': "(GMT+00:00) Bissau";
|
|
93
|
-
readonly 'Africa/Casablanca': "(GMT+00:00) Casablanca";
|
|
94
|
-
readonly 'Africa/El_Aaiun': "(GMT+00:00) El Aaiun";
|
|
95
|
-
readonly 'Africa/Monrovia': "(GMT+00:00) Monrovia";
|
|
96
|
-
readonly 'America/Danmarkshavn': "(GMT+00:00) Danmarkshavn";
|
|
97
|
-
readonly 'Atlantic/Canary': "(GMT+00:00) Canary Islands";
|
|
98
|
-
readonly 'Atlantic/Faroe': "(GMT+00:00) Faeroe";
|
|
99
|
-
readonly 'Atlantic/Reykjavik': "(GMT+00:00) Reykjavik";
|
|
100
|
-
readonly 'Etc/GMT': "(GMT+00:00) GMT (no daylight saving)";
|
|
101
|
-
readonly 'Europe/Dublin': "(GMT+00:00) Dublin";
|
|
102
|
-
readonly 'Europe/Lisbon': "(GMT+00:00) Lisbon";
|
|
103
|
-
readonly 'Europe/London': "(GMT+00:00) London";
|
|
104
|
-
readonly 'Africa/Algiers': "(GMT+01:00) Algiers";
|
|
105
|
-
readonly 'Africa/Ceuta': "(GMT+01:00) Ceuta";
|
|
106
|
-
readonly 'Africa/Lagos': "(GMT+01:00) Lagos";
|
|
107
|
-
readonly 'Africa/Ndjamena': "(GMT+01:00) Ndjamena";
|
|
108
|
-
readonly 'Africa/Tunis': "(GMT+01:00) Tunis";
|
|
109
|
-
readonly 'Africa/Windhoek': "(GMT+02:00) Windhoek";
|
|
110
|
-
readonly 'Europe/Amsterdam': "(GMT+01:00) Amsterdam";
|
|
111
|
-
readonly 'Europe/Andorra': "(GMT+01:00) Andorra";
|
|
112
|
-
readonly 'Europe/Belgrade': "(GMT+01:00) Central European Time - Belgrade";
|
|
113
|
-
readonly 'Europe/Berlin': "(GMT+01:00) Berlin";
|
|
114
|
-
readonly 'Europe/Brussels': "(GMT+01:00) Brussels";
|
|
115
|
-
readonly 'Europe/Budapest': "(GMT+01:00) Budapest";
|
|
116
|
-
readonly 'Europe/Copenhagen': "(GMT+01:00) Copenhagen";
|
|
117
|
-
readonly 'Europe/Gibraltar': "(GMT+01:00) Gibraltar";
|
|
118
|
-
readonly 'Europe/Luxembourg': "(GMT+01:00) Luxembourg";
|
|
119
|
-
readonly 'Europe/Madrid': "(GMT+01:00) Madrid";
|
|
120
|
-
readonly 'Europe/Malta': "(GMT+01:00) Malta";
|
|
121
|
-
readonly 'Europe/Monaco': "(GMT+01:00) Monaco";
|
|
122
|
-
readonly 'Europe/Oslo': "(GMT+01:00) Oslo";
|
|
123
|
-
readonly 'Europe/Paris': "(GMT+01:00) Paris";
|
|
124
|
-
readonly 'Europe/Prague': "(GMT+01:00) Central European Time - Prague";
|
|
125
|
-
readonly 'Europe/Rome': "(GMT+01:00) Rome";
|
|
126
|
-
readonly 'Europe/Stockholm': "(GMT+01:00) Stockholm";
|
|
127
|
-
readonly 'Europe/Tirane': "(GMT+01:00) Tirane";
|
|
128
|
-
readonly 'Europe/Vienna': "(GMT+01:00) Vienna";
|
|
129
|
-
readonly 'Europe/Warsaw': "(GMT+01:00) Warsaw";
|
|
130
|
-
readonly 'Europe/Zurich': "(GMT+01:00) Zurich";
|
|
131
|
-
readonly 'Africa/Cairo': "(GMT+02:00) Cairo";
|
|
132
|
-
readonly 'Africa/Johannesburg': "(GMT+02:00) Johannesburg";
|
|
133
|
-
readonly 'Africa/Maputo': "(GMT+02:00) Maputo";
|
|
134
|
-
readonly 'Africa/Tripoli': "(GMT+02:00) Tripoli";
|
|
135
|
-
readonly 'Asia/Amman': "(GMT+02:00) Amman";
|
|
136
|
-
readonly 'Asia/Beirut': "(GMT+02:00) Beirut";
|
|
137
|
-
readonly 'Asia/Damascus': "(GMT+02:00) Damascus";
|
|
138
|
-
readonly 'Asia/Gaza': "(GMT+02:00) Gaza";
|
|
139
|
-
readonly 'Asia/Jerusalem': "(GMT+02:00) Jerusalem";
|
|
140
|
-
readonly 'Asia/Nicosia': "(GMT+02:00) Nicosia";
|
|
141
|
-
readonly 'Europe/Athens': "(GMT+02:00) Athens";
|
|
142
|
-
readonly 'Europe/Bucharest': "(GMT+02:00) Bucharest";
|
|
143
|
-
readonly 'Europe/Chisinau': "(GMT+02:00) Chisinau";
|
|
144
|
-
readonly 'Europe/Helsinki': "(GMT+02:00) Helsinki";
|
|
145
|
-
readonly 'Europe/Istanbul': "(GMT+03:00) Istanbul";
|
|
146
|
-
readonly 'Europe/Kaliningrad': "(GMT+02:00) Moscow-01 - Kaliningrad";
|
|
147
|
-
readonly 'Europe/Kyiv': "(GMT+02:00) Kyiv";
|
|
148
|
-
readonly 'Europe/Riga': "(GMT+02:00) Riga";
|
|
149
|
-
readonly 'Europe/Sofia': "(GMT+02:00) Sofia";
|
|
150
|
-
readonly 'Europe/Tallinn': "(GMT+02:00) Tallinn";
|
|
151
|
-
readonly 'Europe/Vilnius': "(GMT+02:00) Vilnius";
|
|
152
|
-
readonly 'Africa/Khartoum': "(GMT+03:00) Khartoum";
|
|
153
|
-
readonly 'Africa/Nairobi': "(GMT+03:00) Nairobi";
|
|
154
|
-
readonly 'Antarctica/Syowa': "(GMT+03:00) Syowa";
|
|
155
|
-
readonly 'Asia/Baghdad': "(GMT+03:00) Baghdad";
|
|
156
|
-
readonly 'Asia/Qatar': "(GMT+03:00) Qatar";
|
|
157
|
-
readonly 'Asia/Riyadh': "(GMT+03:00) Riyadh";
|
|
158
|
-
readonly 'Europe/Minsk': "(GMT+03:00) Minsk";
|
|
159
|
-
readonly 'Europe/Moscow': "(GMT+03:00) Moscow+00 - Moscow";
|
|
160
|
-
readonly 'Asia/Tehran': "(GMT+03:30) Tehran";
|
|
161
|
-
readonly 'Asia/Baku': "(GMT+04:00) Baku";
|
|
162
|
-
readonly 'Asia/Dubai': "(GMT+04:00) Dubai";
|
|
163
|
-
readonly 'Asia/Tbilisi': "(GMT+04:00) Tbilisi";
|
|
164
|
-
readonly 'Asia/Yerevan': "(GMT+04:00) Yerevan";
|
|
165
|
-
readonly 'Europe/Samara': "(GMT+04:00) Moscow+01 - Samara";
|
|
166
|
-
readonly 'Indian/Mahe': "(GMT+04:00) Mahe";
|
|
167
|
-
readonly 'Indian/Mauritius': "(GMT+04:00) Mauritius";
|
|
168
|
-
readonly 'Indian/Reunion': "(GMT+04:00) Reunion";
|
|
169
|
-
readonly 'Asia/Kabul': "(GMT+04:30) Kabul";
|
|
170
|
-
readonly 'Antarctica/Mawson': "(GMT+05:00) Mawson";
|
|
171
|
-
readonly 'Asia/Aqtau': "(GMT+05:00) Aqtau";
|
|
172
|
-
readonly 'Asia/Aqtobe': "(GMT+05:00) Aqtobe";
|
|
173
|
-
readonly 'Asia/Ashgabat': "(GMT+05:00) Ashgabat";
|
|
174
|
-
readonly 'Asia/Dushanbe': "(GMT+05:00) Dushanbe";
|
|
175
|
-
readonly 'Asia/Karachi': "(GMT+05:00) Karachi";
|
|
176
|
-
readonly 'Asia/Tashkent': "(GMT+05:00) Tashkent";
|
|
177
|
-
readonly 'Asia/Yekaterinburg': "(GMT+05:00) Moscow+02 - Yekaterinburg";
|
|
178
|
-
readonly 'Indian/Kerguelen': "(GMT+05:00) Kerguelen";
|
|
179
|
-
readonly 'Indian/Maldives': "(GMT+05:00) Maldives";
|
|
180
|
-
readonly 'Asia/Calcutta': "(GMT+05:30) India Standard Time";
|
|
181
|
-
readonly 'Asia/Colombo': "(GMT+05:30) Colombo";
|
|
182
|
-
readonly 'Asia/Katmandu': "(GMT+05:45) Katmandu";
|
|
183
|
-
readonly 'Antarctica/Vostok': "(GMT+06:00) Vostok";
|
|
184
|
-
readonly 'Asia/Almaty': "(GMT+06:00) Almaty";
|
|
185
|
-
readonly 'Asia/Bishkek': "(GMT+06:00) Bishkek";
|
|
186
|
-
readonly 'Asia/Dhaka': "(GMT+06:00) Dhaka";
|
|
187
|
-
readonly 'Asia/Omsk': "(GMT+06:00) Moscow+03 - Omsk, Novosibirsk";
|
|
188
|
-
readonly 'Asia/Thimphu': "(GMT+06:00) Thimphu";
|
|
189
|
-
readonly 'Indian/Chagos': "(GMT+06:00) Chagos";
|
|
190
|
-
readonly 'Asia/Rangoon': "(GMT+06:30) Rangoon";
|
|
191
|
-
readonly 'Indian/Cocos': "(GMT+06:30) Cocos";
|
|
192
|
-
readonly 'Antarctica/Davis': "(GMT+07:00) Davis";
|
|
193
|
-
readonly 'Asia/Bangkok': "(GMT+07:00) Bangkok";
|
|
194
|
-
readonly 'Asia/Hovd': "(GMT+07:00) Hovd";
|
|
195
|
-
readonly 'Asia/Jakarta': "(GMT+07:00) Jakarta";
|
|
196
|
-
readonly 'Asia/Krasnoyarsk': "(GMT+07:00) Moscow+04 - Krasnoyarsk";
|
|
197
|
-
readonly 'Asia/Saigon': "(GMT+07:00) Hanoi";
|
|
198
|
-
readonly 'Asia/Ho_Chi_Minh': "(GMT+07:00) Ho Chi Minh";
|
|
199
|
-
readonly 'Indian/Christmas': "(GMT+07:00) Christmas";
|
|
200
|
-
readonly 'Antarctica/Casey': "(GMT+08:00) Casey";
|
|
201
|
-
readonly 'Asia/Brunei': "(GMT+08:00) Brunei";
|
|
202
|
-
readonly 'Asia/Choibalsan': "(GMT+08:00) Choibalsan";
|
|
203
|
-
readonly 'Asia/Hong_Kong': "(GMT+08:00) Hong Kong";
|
|
204
|
-
readonly 'Asia/Irkutsk': "(GMT+08:00) Moscow+05 - Irkutsk";
|
|
205
|
-
readonly 'Asia/Kuala_Lumpur': "(GMT+08:00) Kuala Lumpur";
|
|
206
|
-
readonly 'Asia/Macau': "(GMT+08:00) Macau";
|
|
207
|
-
readonly 'Asia/Makassar': "(GMT+08:00) Makassar";
|
|
208
|
-
readonly 'Asia/Manila': "(GMT+08:00) Manila";
|
|
209
|
-
readonly 'Asia/Shanghai': "(GMT+08:00) China Time - Beijing";
|
|
210
|
-
readonly 'Asia/Singapore': "(GMT+08:00) Singapore";
|
|
211
|
-
readonly 'Asia/Taipei': "(GMT+08:00) Taipei";
|
|
212
|
-
readonly 'Asia/Ulaanbaatar': "(GMT+08:00) Ulaanbaatar";
|
|
213
|
-
readonly 'Australia/Perth': "(GMT+08:00) Western Time - Perth";
|
|
214
|
-
readonly 'Asia/Pyongyang': "(GMT+08:30) Pyongyang";
|
|
215
|
-
readonly 'Asia/Dili': "(GMT+09:00) Dili";
|
|
216
|
-
readonly 'Asia/Jayapura': "(GMT+09:00) Jayapura";
|
|
217
|
-
readonly 'Asia/Seoul': "(GMT+09:00) Seoul";
|
|
218
|
-
readonly 'Asia/Tokyo': "(GMT+09:00) Tokyo";
|
|
219
|
-
readonly 'Asia/Yakutsk': "(GMT+09:00) Moscow+06 - Yakutsk";
|
|
220
|
-
readonly 'Pacific/Palau': "(GMT+09:00) Palau";
|
|
221
|
-
readonly 'Australia/Adelaide': "(GMT+10:30) Central Time - Adelaide";
|
|
222
|
-
readonly 'Australia/Darwin': "(GMT+09:30) Central Time - Darwin";
|
|
223
|
-
readonly 'Antarctica/DumontDUrville': "(GMT+10:00) Dumont D'Urville";
|
|
224
|
-
readonly 'Asia/Magadan': "(GMT+10:00) Moscow+07 - Magadan";
|
|
225
|
-
readonly 'Asia/Vladivostok': "(GMT+10:00) Moscow+07 - Vladivostok";
|
|
226
|
-
readonly 'Australia/Brisbane': "(GMT+10:00) Eastern Time - Brisbane";
|
|
227
|
-
readonly 'Asia/Sakhalin': "(GMT+11:00) Moscow+08 - Yuzhno-Sakhalin";
|
|
228
|
-
readonly 'Australia/Hobart': "(GMT+11:00) Eastern Time - Hobart";
|
|
229
|
-
readonly 'Australia/Sydney': "(GMT+11:00) Eastern Time - Melbourne, Sydney";
|
|
230
|
-
readonly 'Pacific/Chuuk': "(GMT+10:00) Truk";
|
|
231
|
-
readonly 'Pacific/Guam': "(GMT+10:00) Guam";
|
|
232
|
-
readonly 'Pacific/Port_Moresby': "(GMT+10:00) Port Moresby";
|
|
233
|
-
readonly 'Pacific/Efate': "(GMT+11:00) Efate";
|
|
234
|
-
readonly 'Pacific/Guadalcanal': "(GMT+11:00) Guadalcanal";
|
|
235
|
-
readonly 'Pacific/Kosrae': "(GMT+11:00) Kosrae";
|
|
236
|
-
readonly 'Pacific/Norfolk': "(GMT+11:00) Norfolk";
|
|
237
|
-
readonly 'Pacific/Noumea': "(GMT+11:00) Noumea";
|
|
238
|
-
readonly 'Pacific/Pohnpei': "(GMT+11:00) Ponape";
|
|
239
|
-
readonly 'Asia/Kamchatka': "(GMT+12:00) Moscow+09 - Petropavlovsk-Kamchatskiy";
|
|
240
|
-
readonly 'Pacific/Auckland': "(GMT+13:00) Auckland";
|
|
241
|
-
readonly 'Pacific/Fiji': "(GMT+13:00) Fiji";
|
|
242
|
-
readonly 'Pacific/Funafuti': "(GMT+12:00) Funafuti";
|
|
243
|
-
readonly 'Pacific/Kwajalein': "(GMT+12:00) Kwajalein";
|
|
244
|
-
readonly 'Pacific/Majuro': "(GMT+12:00) Majuro";
|
|
245
|
-
readonly 'Pacific/Nauru': "(GMT+12:00) Nauru";
|
|
246
|
-
readonly 'Pacific/Tarawa': "(GMT+12:00) Tarawa";
|
|
247
|
-
readonly 'Pacific/Wake': "(GMT+12:00) Wake";
|
|
248
|
-
readonly 'Pacific/Wallis': "(GMT+12:00) Wallis";
|
|
249
|
-
readonly 'Pacific/Apia': "(GMT+14:00) Apia";
|
|
250
|
-
readonly 'Pacific/Enderbury': "(GMT+13:00) Enderbury";
|
|
251
|
-
readonly 'Pacific/Fakaofo': "(GMT+13:00) Fakaofo";
|
|
252
|
-
readonly 'Pacific/Tongatapu': "(GMT+13:00) Tongatapu";
|
|
253
|
-
readonly 'Pacific/Kiritimati': "(GMT+14:00) Kiritimati";
|
|
254
|
-
};
|
|
1
|
+
export declare const TIMEZONES: Record<string, string>;
|
|
255
2
|
export declare const addTimezoneStartOfDay: (date: string, timezone: string) => string;
|
|
256
3
|
export declare const addTimezoneEndOfDay: (date: string, timezone: string) => string;
|
|
257
4
|
export declare const getTodayInTimezone: (timezone: string) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timezones.d.ts","sourceRoot":"","sources":["../../../src/utils/date-range-picker/timezones.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"timezones.d.ts","sourceRoot":"","sources":["../../../src/utils/date-range-picker/timezones.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA6PnC,CAAC;AAEX,eAAO,MAAM,qBAAqB,GAAI,MAAM,MAAM,EAAE,UAAU,MAAM,KAAG,MACjB,CAAC;AAEvD,eAAO,MAAM,mBAAmB,GAAI,MAAM,MAAM,EAAE,UAAU,MAAM,KAAG,MACjB,CAAC;AAErD,eAAO,MAAM,kBAAkB,GAAI,UAAU,MAAM,KAAG,MACZ,CAAC"}
|
package/lib/utils/dom/dom.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
1
2
|
export type Placement = 'top' | 'left' | 'right' | 'bottom';
|
|
2
3
|
export type ArrowPosition = 'start' | 'center' | 'end';
|
|
3
4
|
export type Justify = ArrowPosition;
|
|
@@ -6,24 +7,15 @@ export type PositionedPlacement = {
|
|
|
6
7
|
x: number;
|
|
7
8
|
y: number;
|
|
8
9
|
};
|
|
9
|
-
export declare function createElement(document: Document, type: string, props:
|
|
10
|
-
[key: string]: unknown;
|
|
11
|
-
}): HTMLElement;
|
|
10
|
+
export declare function createElement(document: Document, type: string, props: Record<string, unknown>): HTMLElement;
|
|
12
11
|
export declare function pageHeight(): number;
|
|
13
12
|
export declare function getFixedAnchorPosition(element: HTMLElement, placement?: Placement, pad?: number, justify?: Justify): PositionedPlacement;
|
|
14
13
|
export declare function getAnchorPosition(element: HTMLElement, placement?: Placement, pad?: number, justify?: Justify): PositionedPlacement;
|
|
15
14
|
export declare function pxToNumber(px: string): number;
|
|
16
|
-
type
|
|
17
|
-
|
|
18
|
-
mousedown: (arg1: MouseEvent) => unknown;
|
|
19
|
-
mouseup: (arg1: MouseEvent) => unknown;
|
|
20
|
-
pointerdown: (arg1: PointerEvent) => unknown;
|
|
21
|
-
pointerup: (arg1: PointerEvent) => unknown;
|
|
22
|
-
pointercancel: (arg1: PointerEvent) => unknown;
|
|
23
|
-
[key: string]: (arg1: Event) => unknown;
|
|
24
|
-
}>;
|
|
15
|
+
type EventListenerOptionsOrUseCapture = boolean | AddEventListenerOptions;
|
|
16
|
+
type Handlers = Partial<Record<string, EventListener>>;
|
|
25
17
|
export declare function listen(target: EventTarget, handlers: Handlers, options?: EventListenerOptionsOrUseCapture, hook?: 'addEventListener' | 'removeEventListener'): void;
|
|
26
|
-
export declare function forget(target: EventTarget, events: Handlers, options
|
|
18
|
+
export declare function forget(target: EventTarget, events: Handlers, options?: EventListenerOptionsOrUseCapture): void;
|
|
27
19
|
type MixedEvent = React.SyntheticEvent<EventTarget> | Event;
|
|
28
20
|
export declare function stopEvent(event: MixedEvent): void;
|
|
29
21
|
export declare function stopEventImmediately(event: React.SyntheticEvent<EventTarget>): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../../src/utils/dom/dom.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAC5D,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;AACvD,MAAM,MAAM,OAAO,GAAG,aAAa,CAAC;AAEpC,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,EAAE,SAAS,CAAC;IACrB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAEF,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE
|
|
1
|
+
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../../src/utils/dom/dom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAGpC,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAC5D,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;AACvD,MAAM,MAAM,OAAO,GAAG,aAAa,CAAC;AAEpC,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,EAAE,SAAS,CAAC;IACrB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAEF,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,WAAW,CAGb;AAED,wBAAgB,UAAU,IAAI,MAAM,CAQnC;AAED,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,WAAW,EACpB,SAAS,GAAE,SAAiB,EAC5B,GAAG,GAAE,MAAU,EACf,OAAO,GAAE,OAAkB,GAC1B,mBAAmB,CA8DrB;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,WAAW,EACpB,SAAS,GAAE,SAAiB,EAC5B,GAAG,GAAE,MAAU,EACf,OAAO,GAAE,OAAkB,GAC1B,mBAAmB,CAQrB;AAED,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED,KAAK,gCAAgC,GAAG,OAAO,GAAG,uBAAuB,CAAC;AAG1E,KAAK,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC;AAEvD,wBAAgB,MAAM,CACpB,MAAM,EAAE,WAAW,EACnB,QAAQ,EAAE,QAAQ,EAClB,OAAO,CAAC,EAAE,gCAAgC,EAC1C,IAAI,GAAE,kBAAkB,GAAG,qBAA0C,QActE;AAED,wBAAgB,MAAM,CACpB,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,QAAQ,EAChB,OAAO,CAAC,EAAE,gCAAgC,GACzC,IAAI,CAEN;AAED,KAAK,UAAU,GAAG,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,GAAG,KAAK,CAAC;AAE5D,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,QAE1C;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,QAK5E;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,QAG5C;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CA4BlE;AAED,wBAAgB,qBAAqB,IAAI,OAAO,CAQ/C;AAGD,eAAO,MAAM,mBAAmB,GAAI,0CAGjC;IACD,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC;CAC3C,KAAG,CAAC,CAAC,IAAI,EAAE,cAAc,KAAK,OAAO,CAwBrC,CAAC"}
|
package/lib/utils/dom/dom.js
CHANGED
|
@@ -34,7 +34,8 @@ function getFixedAnchorPosition(element) {
|
|
|
34
34
|
const rect = element.getBoundingClientRect();
|
|
35
35
|
const docX = rect.left;
|
|
36
36
|
const docY = rect.top;
|
|
37
|
-
let x
|
|
37
|
+
let x;
|
|
38
|
+
let y;
|
|
38
39
|
switch (placement) {
|
|
39
40
|
case 'bottom':
|
|
40
41
|
y = docY + rect.height + pad;
|
|
@@ -108,27 +109,33 @@ function pxToNumber(px) {
|
|
|
108
109
|
return parseFloat(px.replace('px', '') || '0');
|
|
109
110
|
}
|
|
110
111
|
|
|
111
|
-
//
|
|
112
|
+
// Map event name -> listener
|
|
112
113
|
|
|
113
|
-
function listen(target, handlers,
|
|
114
|
-
// @ts-ignore
|
|
115
|
-
options) {
|
|
114
|
+
function listen(target, handlers, options) {
|
|
116
115
|
let hook = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'addEventListener';
|
|
117
116
|
for (const eventName in handlers) {
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
const handler = handlers[eventName];
|
|
118
|
+
if (!handler) {
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
if (hook === 'addEventListener') {
|
|
122
|
+
target.addEventListener(eventName, handler, options);
|
|
123
|
+
} else {
|
|
124
|
+
target.removeEventListener(eventName, handler, options);
|
|
125
|
+
}
|
|
120
126
|
}
|
|
121
127
|
}
|
|
122
|
-
function forget(target, events,
|
|
123
|
-
// @ts-ignore
|
|
124
|
-
options) {
|
|
128
|
+
function forget(target, events, options) {
|
|
125
129
|
return listen(target, events, options, 'removeEventListener');
|
|
126
130
|
}
|
|
127
131
|
function stopEvent(event) {
|
|
128
132
|
event.stopPropagation();
|
|
129
133
|
}
|
|
130
134
|
function stopEventImmediately(event) {
|
|
131
|
-
event.nativeEvent
|
|
135
|
+
const nativeEvt = event.nativeEvent;
|
|
136
|
+
if (typeof nativeEvt.stopImmediatePropagation === 'function') {
|
|
137
|
+
nativeEvt.stopImmediatePropagation();
|
|
138
|
+
}
|
|
132
139
|
}
|
|
133
140
|
function cancelEvent(event) {
|
|
134
141
|
event.stopPropagation();
|
|
@@ -138,7 +145,6 @@ function requestPointerLock(element) {
|
|
|
138
145
|
return new Promise((resolve, reject) => {
|
|
139
146
|
const handleChange = () => {
|
|
140
147
|
if (document.pointerLockElement === element) {
|
|
141
|
-
// @ts-ignore - TS2794 - Expected 1 arguments, but got 0. Did you forget to include 'void' in your type argument to 'Promise'?
|
|
142
148
|
resolve();
|
|
143
149
|
removeHandlers();
|
|
144
150
|
}
|
|
@@ -148,7 +154,6 @@ function requestPointerLock(element) {
|
|
|
148
154
|
removeHandlers();
|
|
149
155
|
};
|
|
150
156
|
const removeHandlers = () => {
|
|
151
|
-
// @ts-ignore - TS2554 - Expected 3 arguments, but got 2.
|
|
152
157
|
forget(document, {
|
|
153
158
|
pointerlockchange: handleChange,
|
|
154
159
|
pointerlockerror: handleError
|
|
@@ -168,8 +173,8 @@ function checkDateInputSupport() {
|
|
|
168
173
|
input.setAttribute('value', notADateValue);
|
|
169
174
|
return input.value !== notADateValue;
|
|
170
175
|
}
|
|
171
|
-
//reference: https://stackoverflow.com/a/10199306
|
|
172
176
|
|
|
177
|
+
// reference: https://stackoverflow.com/a/10199306
|
|
173
178
|
const getListPasteHandler = _ref => {
|
|
174
179
|
let {
|
|
175
180
|
listItemSeparatorRegex = /[\,\n]/,
|
|
@@ -180,18 +185,14 @@ const getListPasteHandler = _ref => {
|
|
|
180
185
|
if (!value || !value.length) {
|
|
181
186
|
return;
|
|
182
187
|
}
|
|
183
|
-
//do nothing if the copied string fails the regex test
|
|
188
|
+
// do nothing if the copied string fails the regex test
|
|
184
189
|
if (!listItemSeparatorRegex.test(value)) {
|
|
185
190
|
return;
|
|
186
191
|
}
|
|
187
192
|
event.preventDefault();
|
|
188
193
|
const parsedValues = value.split(listItemSeparatorRegex).reduce((acc, val) => {
|
|
189
194
|
const newVal = val.trim();
|
|
190
|
-
if (
|
|
191
|
-
// value exists
|
|
192
|
-
!!newVal.length &&
|
|
193
|
-
// value not already in queue
|
|
194
|
-
!acc.includes(newVal)) {
|
|
195
|
+
if (newVal.length && !acc.includes(newVal)) {
|
|
195
196
|
acc.push(newVal);
|
|
196
197
|
}
|
|
197
198
|
return acc;
|
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { Flow } from 'flow-to-typescript-codemod';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
/** Extract the actual ref instance type from a JSX element/component type */
|
|
4
|
+
type RefOf<E extends React.ElementType> = React.ComponentPropsWithRef<E> extends {
|
|
5
|
+
ref?: React.Ref<infer R>;
|
|
6
|
+
} ? R : never;
|
|
7
|
+
/** Public props for generated components: original props (no ref) + optional className */
|
|
8
|
+
export type ComponentProps<E extends React.ElementType> = React.ComponentPropsWithoutRef<E> & {
|
|
7
9
|
className?: string;
|
|
8
|
-
}
|
|
10
|
+
};
|
|
11
|
+
/** HOC display name helper: sets Wrapper.displayName = `${hocName}(WrappedName)` */
|
|
12
|
+
export declare function nameHoc<C, T extends React.ComponentType<C>, C2>(WrapperComponent: T, WrappedComponent: React.ComponentType<C2>, hocName: string): T;
|
|
13
|
+
/** Public alias for “className-merging” components */
|
|
14
|
+
export type ClassNameComponent<T extends React.ElementType = 'div'> = Flow.AbstractComponent<ComponentProps<T>, RefOf<T>>;
|
|
15
|
+
/**
|
|
16
|
+
* Factory: builds a component for a given intrinsic tag or component type
|
|
17
|
+
* that merges `className` with a base class and forwards its ref.
|
|
18
|
+
*/
|
|
19
|
+
export declare function makeClassNameComponent<C extends React.ElementType = 'div'>(baseClassName: string, ComponentType?: C, name?: string): Flow.AbstractComponent<ComponentProps<C>, RefOf<C>>;
|
|
20
|
+
export {};
|
|
9
21
|
//# sourceMappingURL=makeClassNameComponent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makeClassNameComponent.d.ts","sourceRoot":"","sources":["../../../src/utils/makeClassNameComponent/makeClassNameComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"makeClassNameComponent.d.ts","sourceRoot":"","sources":["../../../src/utils/makeClassNameComponent/makeClassNameComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,4BAA4B,CAAC;AAIrD,6EAA6E;AAC7E,KAAK,KAAK,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,IACpC,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,SAAS;IAAC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAEhF,0FAA0F;AAC1F,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,IACpD,KAAK,CAAC,wBAAwB,CAAC,CAAC,CAAC,GAAG;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAC,CAAC;AAW3D,oFAAoF;AACpF,wBAAgB,OAAO,CAAC,CAAC,EAAE,CAAC,SAAS,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,EAAE,EAC7D,gBAAgB,EAAE,CAAC,EACnB,gBAAgB,EAAE,KAAK,CAAC,aAAa,CAAC,EAAE,CAAC,EACzC,OAAO,EAAE,MAAM,GACd,CAAC,CAKH;AAED,sDAAsD;AACtD,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,KAAK,IAChE,IAAI,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAEtD;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,KAAK,EACxE,aAAa,EAAE,MAAM,EACrB,aAAa,CAAC,EAAE,CAAC,EACjB,IAAI,CAAC,EAAE,MAAM,GACZ,IAAI,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAarD"}
|