@quillsql/react 2.8.4 → 2.8.6
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/AddToDashboardModal.js +146 -180
- package/dist/BarList.js +36 -43
- package/dist/Chart.js +99 -131
- package/dist/ChartBuilder.js +80 -88
- package/dist/ChartEditor.js +14 -20
- package/dist/Context.js +52 -56
- package/dist/Dashboard.d.ts.map +1 -1
- package/dist/Dashboard.js +246 -305
- package/dist/DateRangePicker/Calendar.js +41 -45
- package/dist/DateRangePicker/DateRangePicker.js +32 -60
- package/dist/DateRangePicker/DateRangePickerButton.js +14 -16
- package/dist/DateRangePicker/dateRangePickerUtils.d.ts +6 -0
- package/dist/DateRangePicker/dateRangePickerUtils.d.ts.map +1 -1
- package/dist/DateRangePicker/dateRangePickerUtils.js +89 -89
- package/dist/DateRangePicker/index.js +1 -8
- package/dist/PieChart.js +35 -69
- package/dist/QuillProvider.js +4 -6
- package/dist/ReportBuilder.js +120 -128
- package/dist/SQLEditor.js +56 -64
- package/dist/Table.d.ts +2 -1
- package/dist/Table.d.ts.map +1 -1
- package/dist/Table.js +64 -68
- package/dist/TableChart.js +17 -44
- package/dist/assets/ArrowDownHeadIcon.js +3 -5
- package/dist/assets/ArrowDownIcon.js +3 -5
- package/dist/assets/ArrowDownRightIcon.js +3 -5
- package/dist/assets/ArrowLeftHeadIcon.js +3 -5
- package/dist/assets/ArrowRightHeadIcon.js +3 -5
- package/dist/assets/ArrowRightIcon.js +3 -5
- package/dist/assets/ArrowUpHeadIcon.js +3 -5
- package/dist/assets/ArrowUpIcon.js +3 -5
- package/dist/assets/ArrowUpRightIcon.js +3 -5
- package/dist/assets/CalendarIcon.js +3 -5
- package/dist/assets/CalendarNormalIcon.js +3 -5
- package/dist/assets/DoubleArrowLeftHeadIcon.js +3 -5
- package/dist/assets/DoubleArrowRightHeadIcon.js +3 -5
- package/dist/assets/ExclamationFilledIcon.js +3 -5
- package/dist/assets/FilterIcon.js +3 -5
- package/dist/assets/LoadingSpinner.js +3 -5
- package/dist/assets/RefreshIcon.js +3 -5
- package/dist/assets/SearchIcon.js +3 -5
- package/dist/assets/UpLeftArrowsIcon.js +3 -5
- package/dist/assets/XCircleIcon.js +3 -5
- package/dist/assets/XIcon.js +3 -5
- package/dist/assets/index.js +21 -48
- package/dist/components/BigModal/BigModal.js +13 -38
- package/dist/components/Dropdown/Dropdown.js +24 -52
- package/dist/components/Dropdown/DropdownItem.js +9 -34
- package/dist/components/Dropdown/index.js +2 -10
- package/dist/components/Modal/Modal.js +13 -38
- package/dist/components/Modal/index.js +1 -8
- package/dist/components/QuillCard.js +8 -12
- package/dist/components/SqlTextEditor.d.ts +7 -0
- package/dist/components/SqlTextEditor.d.ts.map +1 -0
- package/dist/components/SqlTextEditor.js +14 -0
- package/dist/components/UiComponents.js +37 -50
- package/dist/components/selectUtils.js +6 -16
- package/dist/contexts/BaseColorContext.js +3 -5
- package/dist/contexts/HoveredValueContext.js +3 -5
- package/dist/contexts/RootStylesContext.js +3 -5
- package/dist/contexts/SelectedValueContext.js +3 -5
- package/dist/contexts/index.js +4 -14
- package/dist/hooks/index.js +4 -14
- package/dist/hooks/useDashboard.d.ts +7 -0
- package/dist/hooks/useDashboard.d.ts.map +1 -0
- package/dist/hooks/useDashboard.js +48 -0
- package/dist/hooks/useInternalState.js +3 -5
- package/dist/hooks/useOnClickOutside.js +3 -5
- package/dist/hooks/useOnWindowResize.js +4 -6
- package/dist/hooks/useQuill.js +11 -15
- package/dist/hooks/useSelectOnKeyDown.js +4 -6
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -28
- package/dist/internals/ReportBuilder/PivotList.js +14 -19
- package/dist/internals/ReportBuilder/PivotModal.js +84 -91
- package/dist/internals/ReportBuilder/PivotModal.spec.js +70 -72
- package/dist/lib/font.js +2 -5
- package/dist/lib/index.js +3 -19
- package/dist/lib/inputTypes.js +1 -2
- package/dist/lib/utils.js +8 -18
- package/dist/utils/aggregate.js +28 -34
- package/dist/utils/colorToHex.js +1 -4
- package/dist/utils/dataFetcher.js +2 -7
- package/dist/utils/downloadCSV.js +1 -5
- package/package.json +2 -4
|
@@ -1,172 +1,175 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
const getWeekdays = (locale) => {
|
|
7
|
-
const firstDayOfWeek = (0, date_fns_1.startOfWeek)(new Date());
|
|
8
|
-
return Array.from(Array(7)).map((e, i) => (0, date_fns_1.format)((0, date_fns_1.addDays)(firstDayOfWeek, i), 'EEEEEE', { locale }));
|
|
1
|
+
import { addDays, differenceInDays, format, isEqual, isToday, max, min, startOfDay, startOfMonth, startOfToday, startOfWeek, startOfYear, sub, } from 'date-fns';
|
|
2
|
+
import { hexToRgbaWith10PercentAlpha } from '../BarList';
|
|
3
|
+
export const getWeekdays = (locale) => {
|
|
4
|
+
const firstDayOfWeek = startOfWeek(new Date());
|
|
5
|
+
return Array.from(Array(7)).map((e, i) => format(addDays(firstDayOfWeek, i), 'EEEEEE', { locale }));
|
|
9
6
|
};
|
|
10
|
-
|
|
11
|
-
const capitalize = (s, locale) => {
|
|
7
|
+
export const capitalize = (s, locale) => {
|
|
12
8
|
return s.charAt(0).toLocaleUpperCase(locale.code) + s.substring(1);
|
|
13
9
|
};
|
|
14
|
-
|
|
15
|
-
const getStartDateByDropdownValue = (dropdownValue, dropdownOptions) => {
|
|
10
|
+
export const getStartDateByDropdownValue = (dropdownValue, dropdownOptions) => {
|
|
16
11
|
if (!dropdownOptions) {
|
|
17
12
|
return null;
|
|
18
13
|
}
|
|
19
14
|
const startDate = dropdownOptions.find((option) => option.value === dropdownValue)?.startDate ?? null;
|
|
20
|
-
return startDate ?
|
|
15
|
+
return startDate ? startOfDay(startDate) : null;
|
|
21
16
|
};
|
|
22
|
-
|
|
23
|
-
const getEndDateByDropdownValue = (dropdownValue, dropdownOptions) => {
|
|
17
|
+
export const getEndDateByDropdownValue = (dropdownValue, dropdownOptions) => {
|
|
24
18
|
if (!dropdownOptions) {
|
|
25
|
-
return
|
|
19
|
+
return startOfToday();
|
|
26
20
|
}
|
|
27
|
-
return
|
|
21
|
+
return startOfDay(dropdownOptions.find((option) => option.value === dropdownValue)?.endDate ?? startOfToday());
|
|
28
22
|
};
|
|
29
|
-
|
|
30
|
-
const parseStartDate = (startDate, minDate, selectedDropdownValue, dropdownOptions) => {
|
|
23
|
+
export const parseStartDate = (startDate, minDate, selectedDropdownValue, dropdownOptions) => {
|
|
31
24
|
if (selectedDropdownValue) {
|
|
32
|
-
startDate =
|
|
25
|
+
startDate = getStartDateByDropdownValue(selectedDropdownValue, dropdownOptions);
|
|
33
26
|
}
|
|
34
27
|
if (!startDate)
|
|
35
28
|
return null;
|
|
36
29
|
if (startDate && !minDate)
|
|
37
|
-
return
|
|
38
|
-
return
|
|
30
|
+
return startOfDay(startDate);
|
|
31
|
+
return startOfDay(max([startDate, minDate]));
|
|
39
32
|
};
|
|
40
|
-
|
|
41
|
-
const parseEndDate = (endDate, maxDate, selectedDropdownValue, dropdownOptions) => {
|
|
33
|
+
export const parseEndDate = (endDate, maxDate, selectedDropdownValue, dropdownOptions) => {
|
|
42
34
|
if (selectedDropdownValue) {
|
|
43
|
-
endDate =
|
|
35
|
+
endDate = getEndDateByDropdownValue(selectedDropdownValue, dropdownOptions);
|
|
44
36
|
}
|
|
45
37
|
if (!endDate)
|
|
46
38
|
return null;
|
|
47
39
|
if (endDate && !maxDate)
|
|
48
|
-
return
|
|
49
|
-
return
|
|
40
|
+
return startOfDay(endDate);
|
|
41
|
+
return startOfDay(min([endDate, maxDate]));
|
|
50
42
|
};
|
|
51
|
-
exports.parseEndDate = parseEndDate;
|
|
52
43
|
/**
|
|
53
44
|
* A simple map between the primary range key and the QuillDateRange for that
|
|
54
45
|
* key ending on today.
|
|
55
46
|
*/
|
|
56
|
-
|
|
57
|
-
THIS_WEEK: { start:
|
|
58
|
-
THIS_MONTH: { start:
|
|
59
|
-
THIS_YEAR: { start:
|
|
60
|
-
LAST_7_DAYS: { start:
|
|
61
|
-
LAST_30_DAYS: { start:
|
|
62
|
-
LAST_90_DAYS: { start:
|
|
63
|
-
LAST_6_MONTHS: { start:
|
|
47
|
+
export const PRIMARY_RANGE = {
|
|
48
|
+
THIS_WEEK: { start: startOfWeek(startOfToday()), end: new Date() },
|
|
49
|
+
THIS_MONTH: { start: startOfMonth(startOfToday()), end: new Date() },
|
|
50
|
+
THIS_YEAR: { start: startOfYear(startOfToday()), end: new Date() },
|
|
51
|
+
LAST_7_DAYS: { start: sub(startOfToday(), { days: 7 }), end: new Date() },
|
|
52
|
+
LAST_30_DAYS: { start: sub(startOfToday(), { days: 30 }), end: new Date() },
|
|
53
|
+
LAST_90_DAYS: { start: sub(startOfToday(), { days: 90 }), end: new Date() },
|
|
54
|
+
LAST_6_MONTHS: { start: sub(startOfToday(), { months: 6 }), end: new Date() },
|
|
64
55
|
ALL_TIME: { start: new Date(0), end: new Date() },
|
|
65
56
|
};
|
|
57
|
+
/**
|
|
58
|
+
* Maps between the keys of primary range and the short code.
|
|
59
|
+
*/
|
|
60
|
+
export const PRIMARY_CODES = {
|
|
61
|
+
THIS_WEEK: "wk",
|
|
62
|
+
THIS_MONTH: "m",
|
|
63
|
+
THIS_YEAR: "y",
|
|
64
|
+
LAST_7_DAYS: "w",
|
|
65
|
+
LAST_30_DAYS: "t",
|
|
66
|
+
LAST_90_DAYS: "90d",
|
|
67
|
+
LAST_6_MONTHS: "6m",
|
|
68
|
+
ALL_TIME: "at",
|
|
69
|
+
};
|
|
66
70
|
/**
|
|
67
71
|
* A helpful map between comparison range keys and a function that takes the
|
|
68
72
|
* start date of the primary range (which is also the end date for our
|
|
69
73
|
* comparison range) and returns a QuillDateRange based on that key and date.
|
|
70
74
|
*/
|
|
71
|
-
|
|
75
|
+
export const COMPARISON_RANGE = {
|
|
72
76
|
PREV_PERIOD: ({ start, end }) => ({
|
|
73
|
-
start:
|
|
77
|
+
start: sub(start, { days: differenceInDays(end, start) }),
|
|
74
78
|
end: start,
|
|
75
79
|
}),
|
|
76
80
|
PREV_7_DAYS: ({ start }) => ({
|
|
77
|
-
start:
|
|
81
|
+
start: sub(start, { days: 7 }),
|
|
78
82
|
end: start,
|
|
79
83
|
}),
|
|
80
84
|
PREV_30_DAYS: ({ start }) => ({
|
|
81
|
-
start:
|
|
85
|
+
start: sub(start, { days: 30 }),
|
|
82
86
|
end: start,
|
|
83
87
|
}),
|
|
84
88
|
PREV_90_DAYS: ({ start }) => ({
|
|
85
|
-
start:
|
|
89
|
+
start: sub(start, { days: 90 }),
|
|
86
90
|
end: start,
|
|
87
91
|
}),
|
|
88
|
-
NO_COMPARISON: _ => null,
|
|
92
|
+
NO_COMPARISON: (_) => null,
|
|
89
93
|
};
|
|
90
|
-
|
|
94
|
+
export const defaultOptions = [
|
|
91
95
|
{
|
|
92
96
|
value: 'wk',
|
|
93
97
|
text: 'This week',
|
|
94
|
-
startDate:
|
|
98
|
+
startDate: PRIMARY_RANGE['THIS_WEEK']?.start,
|
|
95
99
|
},
|
|
96
100
|
{
|
|
97
101
|
value: 'm',
|
|
98
102
|
text: 'This month',
|
|
99
|
-
startDate:
|
|
103
|
+
startDate: PRIMARY_RANGE['THIS_MONTH']?.start,
|
|
100
104
|
},
|
|
101
105
|
{
|
|
102
106
|
value: 'y',
|
|
103
107
|
text: 'This year',
|
|
104
|
-
startDate:
|
|
108
|
+
startDate: PRIMARY_RANGE['THIS_YEAR']?.start,
|
|
105
109
|
},
|
|
106
110
|
{
|
|
107
111
|
value: 'w',
|
|
108
112
|
text: 'Last 7 days',
|
|
109
|
-
startDate:
|
|
113
|
+
startDate: PRIMARY_RANGE['LAST_7_DAYS']?.start,
|
|
110
114
|
},
|
|
111
115
|
{
|
|
112
116
|
value: 't',
|
|
113
117
|
text: 'Last 30 days',
|
|
114
|
-
startDate:
|
|
118
|
+
startDate: PRIMARY_RANGE['LAST_30_DAYS']?.start,
|
|
115
119
|
},
|
|
116
120
|
{
|
|
117
121
|
value: '90d',
|
|
118
122
|
text: 'Last 90 days',
|
|
119
|
-
startDate:
|
|
123
|
+
startDate: PRIMARY_RANGE['LAST_90_DAYS']?.start,
|
|
120
124
|
},
|
|
121
125
|
{
|
|
122
126
|
value: '6m',
|
|
123
127
|
text: 'Last 6 months',
|
|
124
|
-
startDate:
|
|
128
|
+
startDate: PRIMARY_RANGE['LAST_6_MONTHS']?.start,
|
|
125
129
|
},
|
|
126
130
|
{
|
|
127
131
|
value: 'at',
|
|
128
132
|
text: 'All time',
|
|
129
|
-
startDate:
|
|
133
|
+
startDate: PRIMARY_RANGE['ALL_TIME']?.start,
|
|
130
134
|
},
|
|
131
135
|
];
|
|
132
|
-
|
|
136
|
+
export const reportBuilderOptions = [
|
|
133
137
|
{
|
|
134
138
|
value: 'w',
|
|
135
139
|
text: 'Last 7 days',
|
|
136
|
-
startDate:
|
|
140
|
+
startDate: PRIMARY_RANGE['LAST_7_DAYS']?.start,
|
|
137
141
|
dayInterval: 7,
|
|
138
142
|
},
|
|
139
143
|
{
|
|
140
144
|
value: 't',
|
|
141
145
|
text: 'Last 30 days',
|
|
142
|
-
startDate:
|
|
146
|
+
startDate: PRIMARY_RANGE['LAST_30_DAYS']?.start,
|
|
143
147
|
dayInterval: 30,
|
|
144
148
|
},
|
|
145
149
|
{
|
|
146
150
|
value: '90d',
|
|
147
151
|
text: 'Last 90 days',
|
|
148
|
-
startDate:
|
|
152
|
+
startDate: PRIMARY_RANGE['LAST_90_DAYS']?.start,
|
|
149
153
|
dayInterval: 90,
|
|
150
154
|
},
|
|
151
155
|
{
|
|
152
156
|
value: '6m',
|
|
153
157
|
text: 'Last 6 months',
|
|
154
|
-
startDate:
|
|
158
|
+
startDate: PRIMARY_RANGE['LAST_6_MONTHS']?.start,
|
|
155
159
|
dayInterval: 180,
|
|
156
160
|
},
|
|
157
161
|
{
|
|
158
162
|
value: 'at',
|
|
159
163
|
text: 'All time',
|
|
160
|
-
startDate:
|
|
164
|
+
startDate: PRIMARY_RANGE['ALL_TIME']?.start,
|
|
161
165
|
dayInterval: 36500,
|
|
162
166
|
},
|
|
163
167
|
];
|
|
164
|
-
const getRangeFromPreset = (preset) => {
|
|
165
|
-
const foundPreset =
|
|
168
|
+
export const getRangeFromPreset = (preset) => {
|
|
169
|
+
const foundPreset = defaultOptions.find((elem) => elem.value === preset);
|
|
166
170
|
return [foundPreset?.startDate || null, new Date(), foundPreset?.value || ''];
|
|
167
171
|
};
|
|
168
|
-
|
|
169
|
-
const getDateStyles = (theme, date, finalStartDate, finalEndDate, hoveredDate, isDateDisabled) => {
|
|
172
|
+
export const getDateStyles = (theme, date, finalStartDate, finalEndDate, hoveredDate, isDateDisabled) => {
|
|
170
173
|
return {
|
|
171
174
|
...getDayTextClassNames(theme, date, finalStartDate, finalEndDate, hoveredDate, isDateDisabled),
|
|
172
175
|
// ...getDayHoverBgColorClassName(
|
|
@@ -179,18 +182,17 @@ const getDateStyles = (theme, date, finalStartDate, finalEndDate, hoveredDate, i
|
|
|
179
182
|
...getDayBgColorClassName(theme, date, finalStartDate, finalEndDate, hoveredDate, isDateDisabled),
|
|
180
183
|
};
|
|
181
184
|
};
|
|
182
|
-
exports.getDateStyles = getDateStyles;
|
|
183
185
|
const getDayRoundedClassName = (day, selectedStartDay, selectedEndDay, hoveredDay) => {
|
|
184
186
|
if (!selectedStartDay && !selectedEndDay) {
|
|
185
187
|
return { borderRadius: '0.375rem' };
|
|
186
188
|
}
|
|
187
189
|
if (selectedStartDay &&
|
|
188
190
|
selectedEndDay &&
|
|
189
|
-
|
|
190
|
-
|
|
191
|
+
isEqual(day, selectedStartDay) &&
|
|
192
|
+
isEqual(day, selectedEndDay)) {
|
|
191
193
|
return { borderRadius: '0.375rem' };
|
|
192
194
|
}
|
|
193
|
-
if (selectedStartDay && selectedEndDay &&
|
|
195
|
+
if (selectedStartDay && selectedEndDay && isEqual(day, selectedStartDay)) {
|
|
194
196
|
return {
|
|
195
197
|
borderBottomLeftRadius: '0.375rem',
|
|
196
198
|
borderTopLeftRadius: '0.375rem',
|
|
@@ -199,7 +201,7 @@ const getDayRoundedClassName = (day, selectedStartDay, selectedEndDay, hoveredDa
|
|
|
199
201
|
if (selectedStartDay &&
|
|
200
202
|
!selectedEndDay &&
|
|
201
203
|
!hoveredDay &&
|
|
202
|
-
|
|
204
|
+
isEqual(day, selectedStartDay)) {
|
|
203
205
|
return { borderRadius: '0.375rem' };
|
|
204
206
|
}
|
|
205
207
|
if (selectedStartDay &&
|
|
@@ -211,7 +213,7 @@ const getDayRoundedClassName = (day, selectedStartDay, selectedEndDay, hoveredDa
|
|
|
211
213
|
if (selectedStartDay &&
|
|
212
214
|
!selectedEndDay &&
|
|
213
215
|
hoveredDay &&
|
|
214
|
-
|
|
216
|
+
isEqual(day, selectedStartDay) &&
|
|
215
217
|
hoveredDay > selectedStartDay) {
|
|
216
218
|
return {
|
|
217
219
|
borderBottomLeftRadius: '0.375rem',
|
|
@@ -234,14 +236,14 @@ const getDayRoundedClassName = (day, selectedStartDay, selectedEndDay, hoveredDa
|
|
|
234
236
|
if (selectedStartDay &&
|
|
235
237
|
!selectedEndDay &&
|
|
236
238
|
hoveredDay &&
|
|
237
|
-
|
|
238
|
-
!
|
|
239
|
+
isEqual(day, hoveredDay) &&
|
|
240
|
+
!isEqual(day, selectedStartDay)) {
|
|
239
241
|
return {
|
|
240
242
|
borderBottomRightRadius: '0.375rem',
|
|
241
243
|
borderTopRightRadius: '0.375rem',
|
|
242
244
|
};
|
|
243
245
|
}
|
|
244
|
-
if (selectedStartDay && selectedEndDay &&
|
|
246
|
+
if (selectedStartDay && selectedEndDay && isEqual(day, selectedEndDay)) {
|
|
245
247
|
return {
|
|
246
248
|
borderBottomRightRadius: '0.375rem',
|
|
247
249
|
borderTopRightRadius: '0.375rem',
|
|
@@ -254,7 +256,7 @@ const getDayRoundedClassName = (day, selectedStartDay, selectedEndDay, hoveredDa
|
|
|
254
256
|
}
|
|
255
257
|
return { borderRadius: '0.375rem' };
|
|
256
258
|
};
|
|
257
|
-
const displaySelected = (selectedStartDay, selectedEndDay) => {
|
|
259
|
+
export const displaySelected = (selectedStartDay, selectedEndDay) => {
|
|
258
260
|
if (!selectedStartDay && !selectedEndDay) {
|
|
259
261
|
return '';
|
|
260
262
|
}
|
|
@@ -267,7 +269,7 @@ const displaySelected = (selectedStartDay, selectedEndDay) => {
|
|
|
267
269
|
return selectedStartDay.toLocaleDateString('en-US', options);
|
|
268
270
|
}
|
|
269
271
|
else if (selectedStartDay && selectedEndDay) {
|
|
270
|
-
if (
|
|
272
|
+
if (isEqual(selectedStartDay, selectedEndDay)) {
|
|
271
273
|
const options = {
|
|
272
274
|
year: 'numeric',
|
|
273
275
|
month: 'short',
|
|
@@ -295,13 +297,12 @@ const displaySelected = (selectedStartDay, selectedEndDay) => {
|
|
|
295
297
|
}
|
|
296
298
|
}
|
|
297
299
|
};
|
|
298
|
-
exports.displaySelected = displaySelected;
|
|
299
300
|
const getDayBgColorClassName = (theme, day, selectedStartDay, selectedEndDay, hoveredDay, isDayDisabled = false) => {
|
|
300
301
|
const styles = {
|
|
301
302
|
background: 'transparent',
|
|
302
303
|
};
|
|
303
304
|
if (!isDayDisabled) {
|
|
304
|
-
if (selectedStartDay &&
|
|
305
|
+
if (selectedStartDay && isEqual(day, selectedStartDay)) {
|
|
305
306
|
styles.background = theme?.primaryTextColor || '#6269E9';
|
|
306
307
|
}
|
|
307
308
|
if (selectedStartDay &&
|
|
@@ -310,10 +311,10 @@ const getDayBgColorClassName = (theme, day, selectedStartDay, selectedEndDay, ho
|
|
|
310
311
|
day > selectedStartDay &&
|
|
311
312
|
day < hoveredDay) {
|
|
312
313
|
styles.background =
|
|
313
|
-
|
|
314
|
-
|
|
314
|
+
hexToRgbaWith10PercentAlpha(theme?.primaryTextColor) ||
|
|
315
|
+
hexToRgbaWith10PercentAlpha('#6269E9');
|
|
315
316
|
}
|
|
316
|
-
if (selectedEndDay &&
|
|
317
|
+
if (selectedEndDay && isEqual(day, selectedEndDay)) {
|
|
317
318
|
styles.background = theme?.primaryTextColor || '#6269E9';
|
|
318
319
|
}
|
|
319
320
|
if (selectedStartDay &&
|
|
@@ -321,8 +322,8 @@ const getDayBgColorClassName = (theme, day, selectedStartDay, selectedEndDay, ho
|
|
|
321
322
|
day > selectedStartDay &&
|
|
322
323
|
day < selectedEndDay) {
|
|
323
324
|
styles.background =
|
|
324
|
-
|
|
325
|
-
|
|
325
|
+
hexToRgbaWith10PercentAlpha(theme?.primaryTextColor) ||
|
|
326
|
+
hexToRgbaWith10PercentAlpha('#6269E9');
|
|
326
327
|
}
|
|
327
328
|
}
|
|
328
329
|
return styles;
|
|
@@ -332,9 +333,9 @@ const getDayTextClassNames = (theme, day, selectedStartDay, selectedEndDay, hove
|
|
|
332
333
|
color: theme?.primaryTextColor || '#364153',
|
|
333
334
|
};
|
|
334
335
|
if (!isDayDisabled) {
|
|
335
|
-
if (
|
|
336
|
-
if ((selectedStartDay &&
|
|
337
|
-
(selectedEndDay &&
|
|
336
|
+
if (isToday(day)) {
|
|
337
|
+
if ((selectedStartDay && isEqual(day, selectedStartDay)) ||
|
|
338
|
+
(selectedEndDay && isEqual(day, selectedEndDay))) {
|
|
338
339
|
styles.color = 'white';
|
|
339
340
|
}
|
|
340
341
|
else {
|
|
@@ -342,7 +343,7 @@ const getDayTextClassNames = (theme, day, selectedStartDay, selectedEndDay, hove
|
|
|
342
343
|
}
|
|
343
344
|
}
|
|
344
345
|
else {
|
|
345
|
-
if (selectedStartDay &&
|
|
346
|
+
if (selectedStartDay && isEqual(day, selectedStartDay)) {
|
|
346
347
|
styles.color = 'white';
|
|
347
348
|
}
|
|
348
349
|
if (selectedStartDay &&
|
|
@@ -352,7 +353,7 @@ const getDayTextClassNames = (theme, day, selectedStartDay, selectedEndDay, hove
|
|
|
352
353
|
day < hoveredDay) {
|
|
353
354
|
styles.color = theme?.primaryTextColor || '#364153';
|
|
354
355
|
}
|
|
355
|
-
if (selectedEndDay &&
|
|
356
|
+
if (selectedEndDay && isEqual(day, selectedEndDay)) {
|
|
356
357
|
styles.color = 'white';
|
|
357
358
|
}
|
|
358
359
|
if (selectedStartDay &&
|
|
@@ -370,16 +371,16 @@ const getDayHoverBgColorClassName = (day, selectedStartDay, selectedEndDay, isDa
|
|
|
370
371
|
background: 'transparent',
|
|
371
372
|
};
|
|
372
373
|
if (!isDayDisabled) {
|
|
373
|
-
if (selectedStartDay &&
|
|
374
|
+
if (selectedStartDay && isEqual(day, selectedStartDay)) {
|
|
374
375
|
styles.background = '';
|
|
375
376
|
}
|
|
376
|
-
if (selectedEndDay &&
|
|
377
|
+
if (selectedEndDay && isEqual(day, selectedEndDay)) {
|
|
377
378
|
styles.background = '';
|
|
378
379
|
}
|
|
379
380
|
}
|
|
380
381
|
return styles;
|
|
381
382
|
};
|
|
382
|
-
const formatSelectedDates = (startDate, endDate, locale) => {
|
|
383
|
+
export const formatSelectedDates = (startDate, endDate, locale) => {
|
|
383
384
|
const localeCode = locale?.code || 'en-US';
|
|
384
385
|
if (!startDate && !endDate) {
|
|
385
386
|
return '';
|
|
@@ -393,7 +394,7 @@ const formatSelectedDates = (startDate, endDate, locale) => {
|
|
|
393
394
|
return startDate.toLocaleDateString(localeCode, options);
|
|
394
395
|
}
|
|
395
396
|
else if (startDate && endDate) {
|
|
396
|
-
if (
|
|
397
|
+
if (isEqual(startDate, endDate)) {
|
|
397
398
|
const options = {
|
|
398
399
|
year: 'numeric',
|
|
399
400
|
month: 'short',
|
|
@@ -422,7 +423,6 @@ const formatSelectedDates = (startDate, endDate, locale) => {
|
|
|
422
423
|
}
|
|
423
424
|
return '';
|
|
424
425
|
};
|
|
425
|
-
exports.formatSelectedDates = formatSelectedDates;
|
|
426
426
|
/** This is the current dateFilter Object, I think we can pare it down */
|
|
427
427
|
// const dateFilter = {
|
|
428
428
|
// date_range: {
|
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.DateRangePicker = void 0;
|
|
7
1
|
// @ts-nocheck
|
|
8
|
-
|
|
9
|
-
Object.defineProperty(exports, "DateRangePicker", { enumerable: true, get: function () { return __importDefault(DateRangePicker_1).default; } });
|
|
2
|
+
export { default as DateRangePicker } from './DateRangePicker';
|