@quillsql/react 1.1.7 → 1.1.9

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.
Files changed (70) hide show
  1. package/example/package-lock.json +754 -1643
  2. package/example/src/App.tsx +3 -2
  3. package/lib/BarList.d.ts +1 -0
  4. package/lib/BarList.js +129 -37
  5. package/lib/BarList.js.map +1 -1
  6. package/lib/Chart.d.ts +3 -3
  7. package/lib/Chart.js +67 -31
  8. package/lib/Chart.js.map +1 -1
  9. package/lib/Context.d.ts +1 -1
  10. package/lib/Dashboard.d.ts +1 -1
  11. package/lib/Dashboard.js +16 -16
  12. package/lib/Dashboard.js.map +1 -1
  13. package/lib/DateRangePicker/Calendar.d.ts +1 -1
  14. package/lib/DateRangePicker/Calendar.js +122 -23
  15. package/lib/DateRangePicker/Calendar.js.map +1 -1
  16. package/lib/DateRangePicker/DateRangePicker.js +5 -6
  17. package/lib/DateRangePicker/DateRangePicker.js.map +1 -1
  18. package/lib/DateRangePicker/DateRangePickerButton.d.ts +1 -1
  19. package/lib/DateRangePicker/DateRangePickerButton.js +101 -17
  20. package/lib/DateRangePicker/DateRangePickerButton.js.map +1 -1
  21. package/lib/DateRangePicker/dateRangePickerUtils.d.ts +1 -2
  22. package/lib/DateRangePicker/dateRangePickerUtils.js +113 -79
  23. package/lib/DateRangePicker/dateRangePickerUtils.js.map +1 -1
  24. package/lib/PieChart.d.ts +3 -3
  25. package/lib/PieChart.js +51 -28
  26. package/lib/PieChart.js.map +1 -1
  27. package/lib/QuillProvider.d.ts +1 -2
  28. package/lib/assets/ArrowDownHeadIcon.d.ts +1 -2
  29. package/lib/assets/ArrowDownIcon.d.ts +1 -2
  30. package/lib/assets/ArrowDownRightIcon.d.ts +1 -2
  31. package/lib/assets/ArrowLeftHeadIcon.d.ts +1 -2
  32. package/lib/assets/ArrowRightHeadIcon.d.ts +1 -2
  33. package/lib/assets/ArrowRightIcon.d.ts +1 -2
  34. package/lib/assets/ArrowUpHeadIcon.d.ts +1 -2
  35. package/lib/assets/ArrowUpIcon.d.ts +1 -2
  36. package/lib/assets/ArrowUpRightIcon.d.ts +1 -2
  37. package/lib/assets/CalendarIcon.d.ts +1 -2
  38. package/lib/assets/DoubleArrowLeftHeadIcon.d.ts +1 -2
  39. package/lib/assets/DoubleArrowRightHeadIcon.d.ts +1 -2
  40. package/lib/assets/ExclamationFilledIcon.d.ts +1 -2
  41. package/lib/assets/LoadingSpinner.d.ts +1 -2
  42. package/lib/assets/SearchIcon.d.ts +1 -2
  43. package/lib/assets/XCircleIcon.d.ts +1 -2
  44. package/lib/components/Dropdown/Dropdown.js +45 -14
  45. package/lib/components/Dropdown/Dropdown.js.map +1 -1
  46. package/lib/components/Dropdown/DropdownItem.d.ts +1 -0
  47. package/lib/components/Dropdown/DropdownItem.js +21 -29
  48. package/lib/components/Dropdown/DropdownItem.js.map +1 -1
  49. package/lib/components/Modal/Modal.d.ts +1 -0
  50. package/lib/components/Modal/Modal.js +47 -9
  51. package/lib/components/Modal/Modal.js.map +1 -1
  52. package/lib/components/selectUtils.d.ts +1 -1
  53. package/lib/components/selectUtils.js +18 -12
  54. package/lib/components/selectUtils.js.map +1 -1
  55. package/package.json +1 -8
  56. package/src/BarList.tsx +193 -96
  57. package/src/Chart.tsx +109 -49
  58. package/src/Dashboard.tsx +27 -16
  59. package/src/DateRangePicker/Calendar.tsx +149 -163
  60. package/src/DateRangePicker/DateRangePicker.tsx +11 -11
  61. package/src/DateRangePicker/DateRangePickerButton.tsx +129 -84
  62. package/src/DateRangePicker/dateRangePickerUtils.tsx +137 -111
  63. package/src/PieChart.tsx +87 -34
  64. package/src/components/Dropdown/Dropdown.tsx +50 -69
  65. package/src/components/Dropdown/DropdownItem.tsx +15 -50
  66. package/src/components/Modal/Modal.tsx +50 -31
  67. package/src/components/selectUtils.ts +19 -18
  68. package/src/styles.css +0 -5
  69. package/postcss.config.js +0 -6
  70. package/tailwind.config.js +0 -23
@@ -1,27 +1,10 @@
1
1
  import React, { Dispatch, Ref, SetStateAction } from 'react';
2
- import { twMerge } from 'tailwind-merge';
3
2
 
4
3
  import { ArrowDownHeadIcon, CalendarIcon } from '../assets';
5
4
 
6
- import {
7
- BaseColors,
8
- border,
9
- borderRadius,
10
- boxShadow,
11
- fontSize,
12
- fontWeight,
13
- getColorClassNames,
14
- sizing,
15
- spacing,
16
- } from '../lib';
17
-
18
5
  import { DateRangePickerOption, DateRangePickerValue } from './DateRangePicker';
19
- import { DEFAULT_COLOR, colorPalette } from '../lib/theme';
20
- import {
21
- formatSelectedDates,
22
- makeDateRangePickerClassName,
23
- } from './dateRangePickerUtils';
24
- import { getSelectButtonColors, hasValue } from '../components/selectUtils';
6
+ import { formatSelectedDates } from './dateRangePickerUtils';
7
+ import { hasValue } from '../components/selectUtils';
25
8
 
26
9
  interface DateRangePickerButtonProps {
27
10
  value: DateRangePickerValue;
@@ -75,52 +58,83 @@ const DateRangePickerButton = ({
75
58
 
76
59
  return (
77
60
  <div
78
- className={twMerge(
79
- makeDateRangePickerClassName('button'),
80
- 'qq-flex qq-items-center qq-justify-between',
81
- getColorClassNames('white').bgColor,
82
- borderRadius.md.all,
83
- boxShadow.sm
84
- )}
61
+ style={{
62
+ display: 'flex',
63
+ alignItems: 'center',
64
+ justifyContent: 'space-between',
65
+ borderRadius: '0.375rem',
66
+ background: theme?.backgroundColor,
67
+ fontFamily: theme?.fontFamily,
68
+ boxShadow: '0 1px 2px 0 rgba(0, 0, 0, 0.05)',
69
+ }}
70
+ // className={twMerge(
71
+ // 'qq-flex qq-items-center qq-justify-between',
72
+ // getColorClassNames('white').bgColor,
73
+ // borderRadius.md.all,
74
+ // boxShadow.sm
75
+ // )}
85
76
  >
86
77
  <button
87
78
  type="button"
88
79
  style={{
80
+ fontFamily: theme?.fontFamily,
89
81
  borderColor: theme?.borderColor || '#E5E7EB',
90
82
  borderStyle: 'solid',
91
- fontFamily: theme?.fontFamily,
83
+ borderWidth: 1,
84
+ borderRadius: '0.375rem',
85
+ minHeight: 38,
86
+ borderRight: 'none',
87
+ borderTopRightRadius: 0,
88
+ borderBottomRightRadius: 0,
92
89
  color: theme?.primaryTextColor,
93
90
  cursor: 'pointer',
91
+ display: 'flex',
92
+ alignItems: 'center',
93
+ width: '100%',
94
+ overflow: 'hidden',
95
+ textOverflow: 'ellipsis',
96
+ whiteSpace: 'nowrap',
97
+ background: theme?.backgroundColor,
98
+ fontWeight: theme?.fontWeightMedium || '500',
99
+ // borderRight: enableDropdown
100
+ // ? border.none.right
101
+ // : twMerge(borderRadius.md.right, border.sm.right),
94
102
  }}
95
103
  ref={calendarRef}
96
104
  onClick={() => setShowCalendar(!showCalendar)}
97
105
  onKeyDown={onCalendarKeyDown}
98
- className={twMerge(
99
- makeDateRangePickerClassName('calendarButton'),
100
- 'qq-flex qq-items-center qq-w-full qq-truncate focus:qq-outline-none focus:qq-ring-2',
101
- getSelectButtonColors(hasDateSelection, disabled),
102
- enableDropdown
103
- ? border.none.right
104
- : twMerge(borderRadius.md.right, border.sm.right),
105
- getColorClassNames(BaseColors.Blue, colorPalette.lightRing)
106
- .focusRingColor,
107
- spacing.twoXl.paddingX,
108
- spacing.sm.paddingY,
109
- borderRadius.md.left,
110
- border.sm.all
111
- )}
106
+ // className={twMerge(
107
+ // 'qq-flex qq-items-center qq-w-full qq-truncate focus:qq-outline-none focus:qq-ring-2',
108
+ // getSelectButtonColors(hasDateSelection, disabled),
109
+ // enableDropdown
110
+ // ? border.none.right
111
+ // : twMerge(borderRadius.md.right, border.sm.right),
112
+ // getColorClassNames(BaseColors.Blue, colorPalette.lightRing)
113
+ // .focusRingColor,
114
+ // spacing.twoXl.paddingX,
115
+ // spacing.sm.paddingY,
116
+ // borderRadius.md.left,
117
+ // border.sm.all
118
+ // )}
112
119
  disabled={disabled}
113
120
  >
114
121
  <CalendarIcon
115
- className={twMerge(
116
- makeDateRangePickerClassName('calendarButtonIcon'),
117
- 'qq-flex-none',
118
- getColorClassNames(DEFAULT_COLOR, colorPalette.lightText).textColor,
119
- sizing.lg.height,
120
- sizing.lg.width,
121
- spacing.threeXs.negativeMarginLeft,
122
- spacing.lg.marginRight
123
- )}
122
+ style={{
123
+ flex: 'none',
124
+ color: theme?.secondaryTextColor,
125
+ height: '1.25rem',
126
+ width: '1.25rem',
127
+ marginLeft: '0.125rem',
128
+ marginRight: '0.75rem',
129
+ }}
130
+ // className={twMerge(
131
+ // 'qq-flex-none',
132
+ // getColorClassNames(DEFAULT_COLOR, colorPalette.lightText).textColor,
133
+ // sizing.lg.height,
134
+ // sizing.lg.width,
135
+ // spacing.threeXs.negativeMarginLeft,
136
+ // spacing.lg.marginRight
137
+ // )}
124
138
  aria-hidden="true"
125
139
  />
126
140
  <p
@@ -128,13 +142,16 @@ const DateRangePickerButton = ({
128
142
  margin: 0,
129
143
  fontFamily: theme?.fontFamily,
130
144
  color: theme?.primaryTextColor,
145
+ overflow: 'hidden',
146
+ textOverflow: 'ellipsis',
147
+ whiteSpace: 'nowrap',
148
+ fontWeight: theme?.fontWeightMedium || '500',
131
149
  }}
132
- className={twMerge(
133
- makeDateRangePickerClassName('calendarButtonText'),
134
- 'qq-whitespace-nowrap qq-truncate',
135
- fontSize.sm,
136
- fontWeight.md
137
- )}
150
+ // className={twMerge(
151
+ // 'qq-whitespace-nowrap qq-truncate',
152
+ // fontSize.sm,
153
+ // fontWeight.md
154
+ // )}
138
155
  >
139
156
  {calendarText}
140
157
  </p>
@@ -143,24 +160,41 @@ const DateRangePickerButton = ({
143
160
  <button
144
161
  type="button"
145
162
  style={{
163
+ // fontFamily: theme?.fontFamily,
146
164
  borderColor: theme?.borderColor || '#E5E7EB',
147
165
  borderStyle: 'solid',
166
+ borderWidth: 1,
148
167
  cursor: 'pointer',
168
+ marginLeft: -1,
169
+ borderRadius: '0.375rem',
170
+ width: '12rem',
171
+ overflow: 'hidden',
172
+ textOverflow: 'ellipsis',
173
+ whiteSpace: 'nowrap',
174
+ paddingLeft: '1rem',
175
+ paddingRight: '1rem',
176
+ display: 'inline-flex',
177
+ minHeight: 38,
178
+ borderTopLeftRadius: 0,
179
+ borderBottomLeftRadius: 0,
180
+ justifyContent: 'space-between',
181
+ alignItems: 'center',
182
+ background: theme?.backgroundColor,
183
+ // fontWeight: theme?.fontWeightMedium || '800',
149
184
  }}
150
185
  ref={dropdownRef}
151
186
  onClick={() => setShowDropdown(!showDropdown)}
152
- className={twMerge(
153
- makeDateRangePickerClassName('dropdownButton'),
154
- 'qq-inline-flex qq-justify-between qq-w-48 qq-truncate focus:qq-outline-none focus:qq-ring-2',
155
- getSelectButtonColors(hasDropdownSelection, disabled),
156
- getColorClassNames(BaseColors.Blue, colorPalette.lightRing)
157
- .focusRingColor,
158
- spacing.twoXl.paddingX,
159
- spacing.sm.paddingY,
160
- spacing.px.negativeMarginLeft,
161
- borderRadius.md.right,
162
- border.sm.all
163
- )}
187
+ // className={twMerge(
188
+ // 'qq-inline-flex qq-justify-between qq-w-48 qq-truncate focus:qq-outline-none focus:qq-ring-2',
189
+ // getSelectButtonColors(hasDropdownSelection, disabled),
190
+ // getColorClassNames(BaseColors.Blue, colorPalette.lightRing)
191
+ // .focusRingColor,
192
+ // spacing.twoXl.paddingX,
193
+ // spacing.sm.paddingY
194
+ // spacing.px.negativeMarginLeft,
195
+ // borderRadius.md.right,
196
+ // border.sm.all
197
+ // )}
164
198
  onKeyDown={onDropdownKeyDown}
165
199
  disabled={disabled}
166
200
  >
@@ -168,27 +202,38 @@ const DateRangePickerButton = ({
168
202
  style={{
169
203
  margin: 0,
170
204
  fontFamily: theme?.fontFamily,
171
- color: theme?.primaryTextColor,
205
+ // fontFamily: 'Avenir',
206
+ color: theme?.primaryTextColor || '#364153',
207
+ overflow: 'hidden',
208
+ textOverflow: 'ellipsis',
209
+ whiteSpace: 'nowrap',
210
+ fontWeight: theme?.fontWeightMedium || '500',
211
+ // background: 'red',
172
212
  }}
173
- className={twMerge(
174
- makeDateRangePickerClassName('dropdownButtonText'),
175
- 'qq-whitespace-nowrap qq-truncate',
176
- fontSize.sm,
177
- fontWeight.md
178
- )}
213
+ // className={twMerge(
214
+ // 'qq-whitespace-nowrap qq-truncate',
215
+ // fontSize.sm,
216
+ // fontWeight.md
217
+ // )}
179
218
  >
180
219
  {dropdownText}
181
220
  </p>
182
221
  <ArrowDownHeadIcon
183
- className={twMerge(
184
- makeDateRangePickerClassName('dropdownButtonIcon'),
185
- 'qq-flex-none',
186
- sizing.lg.height,
187
- sizing.lg.width,
188
- spacing.twoXs.negativeMarginRight,
189
- getColorClassNames(DEFAULT_COLOR, colorPalette.lightText)
190
- .textColor
191
- )}
222
+ style={{
223
+ height: '1.25rem',
224
+ width: '1.25rem',
225
+ flex: 'none',
226
+ color: theme?.secondaryTextColor,
227
+ marginRight: '-0.25rem',
228
+ }}
229
+ // className={twMerge(
230
+ // 'qq-flex-none',
231
+ // sizing.lg.height,
232
+ // sizing.lg.width,
233
+ // spacing.twoXs.negativeMarginRight,
234
+ // getColorClassNames(DEFAULT_COLOR, colorPalette.lightText)
235
+ // .textColor
236
+ // )}
192
237
  aria-hidden="true"
193
238
  />
194
239
  </button>
@@ -1,4 +1,3 @@
1
- import { twMerge } from 'tailwind-merge';
2
1
  import {
3
2
  addDays,
4
3
  format,
@@ -15,15 +14,7 @@ import {
15
14
  } from 'date-fns';
16
15
  import { Color } from '../lib/inputTypes';
17
16
  import { DateRangePickerOption } from './DateRangePicker';
18
- import {
19
- borderRadius,
20
- fontWeight,
21
- getColorClassNames,
22
- makeClassName,
23
- } from '../lib';
24
- import { DEFAULT_COLOR, colorPalette } from '../lib/theme';
25
-
26
- export const makeDateRangePickerClassName = makeClassName('DateRangePicker');
17
+ import { hexToRgbaWith10PercentAlpha } from '../BarList';
27
18
 
28
19
  export const getWeekdays = (locale: Locale) => {
29
20
  const firstDayOfWeek = startOfWeek(new Date());
@@ -143,15 +134,17 @@ export const defaultOptions: DateRangePickerOption[] = [
143
134
  ];
144
135
 
145
136
  export const getDateStyles = (
137
+ theme: any,
146
138
  date: Date,
147
139
  finalStartDate: Date | null,
148
140
  finalEndDate: Date | null,
149
141
  hoveredDate: Date | undefined,
150
142
  isDateDisabled: boolean,
151
143
  color: Color
152
- ) =>
153
- twMerge(
154
- getDayBgColorClassName(
144
+ ) => {
145
+ return {
146
+ ...getDayTextClassNames(
147
+ theme,
155
148
  date,
156
149
  finalStartDate,
157
150
  finalEndDate,
@@ -159,36 +152,38 @@ export const getDateStyles = (
159
152
  color,
160
153
  isDateDisabled
161
154
  ),
162
- getDayTextClassNames(
155
+ // ...getDayHoverBgColorClassName(
156
+ // date,
157
+ // finalStartDate,
158
+ // finalEndDate,
159
+ // isDateDisabled
160
+ // ),
161
+ ...getDayRoundedClassName(
163
162
  date,
164
163
  finalStartDate,
165
164
  finalEndDate,
166
- hoveredDate as Date | null,
167
- color,
168
- isDateDisabled
165
+ hoveredDate as Date | null
169
166
  ),
170
- getDayHoverBgColorClassName(
167
+ ...getDayBgColorClassName(
168
+ theme,
171
169
  date,
172
170
  finalStartDate,
173
171
  finalEndDate,
172
+ hoveredDate as Date | null,
173
+ color,
174
174
  isDateDisabled
175
175
  ),
176
- getDayRoundedClassName(
177
- date,
178
- finalStartDate,
179
- finalEndDate,
180
- hoveredDate as Date | null
181
- )
182
- );
176
+ };
177
+ };
183
178
 
184
179
  const getDayRoundedClassName = (
185
180
  day: Date,
186
181
  selectedStartDay: Date | null,
187
182
  selectedEndDay: Date | null,
188
183
  hoveredDay: Date | null
189
- ): string => {
184
+ ): any => {
190
185
  if (!selectedStartDay && !selectedEndDay) {
191
- return borderRadius.md.all;
186
+ return { borderRadius: '0.375rem' };
192
187
  }
193
188
  if (
194
189
  selectedStartDay &&
@@ -196,10 +191,13 @@ const getDayRoundedClassName = (
196
191
  isEqual(day, selectedStartDay) &&
197
192
  isEqual(day, selectedEndDay)
198
193
  ) {
199
- return borderRadius.md.all;
194
+ return { borderRadius: '0.375rem' };
200
195
  }
201
196
  if (selectedStartDay && selectedEndDay && isEqual(day, selectedStartDay)) {
202
- return borderRadius.md.left;
197
+ return {
198
+ borderBottomLeftRadius: '0.375rem',
199
+ borderTopLeftRadius: '0.375rem',
200
+ };
203
201
  }
204
202
  if (
205
203
  selectedStartDay &&
@@ -207,7 +205,7 @@ const getDayRoundedClassName = (
207
205
  !hoveredDay &&
208
206
  isEqual(day, selectedStartDay)
209
207
  ) {
210
- return borderRadius.md.all;
208
+ return { borderRadius: '0.375rem' };
211
209
  }
212
210
  if (
213
211
  selectedStartDay &&
@@ -215,7 +213,7 @@ const getDayRoundedClassName = (
215
213
  hoveredDay &&
216
214
  day < selectedStartDay
217
215
  ) {
218
- return borderRadius.md.all;
216
+ return { borderRadius: '0.375rem' };
219
217
  }
220
218
  if (
221
219
  selectedStartDay &&
@@ -224,7 +222,10 @@ const getDayRoundedClassName = (
224
222
  isEqual(day, selectedStartDay) &&
225
223
  hoveredDay > selectedStartDay
226
224
  ) {
227
- return borderRadius.md.left;
225
+ return {
226
+ borderBottomLeftRadius: '0.375rem',
227
+ borderTopLeftRadius: '0.375rem',
228
+ };
228
229
  }
229
230
  if (
230
231
  selectedStartDay &&
@@ -233,7 +234,7 @@ const getDayRoundedClassName = (
233
234
  day > selectedStartDay &&
234
235
  day < hoveredDay
235
236
  ) {
236
- return borderRadius.none.all;
237
+ return { borderRadius: 0 };
237
238
  }
238
239
  if (
239
240
  selectedStartDay &&
@@ -241,7 +242,7 @@ const getDayRoundedClassName = (
241
242
  day > selectedStartDay &&
242
243
  day < selectedEndDay
243
244
  ) {
244
- return borderRadius.none.all;
245
+ return { borderRadius: 0 };
245
246
  }
246
247
  if (
247
248
  selectedStartDay &&
@@ -250,19 +251,25 @@ const getDayRoundedClassName = (
250
251
  isEqual(day, hoveredDay) &&
251
252
  !isEqual(day, selectedStartDay)
252
253
  ) {
253
- return borderRadius.md.right;
254
+ return {
255
+ borderBottomRightRadius: '0.375rem',
256
+ borderTopRightRadius: '0.375rem',
257
+ };
254
258
  }
255
259
  if (selectedStartDay && selectedEndDay && isEqual(day, selectedEndDay)) {
256
- return borderRadius.md.right;
260
+ return {
261
+ borderBottomRightRadius: '0.375rem',
262
+ borderTopRightRadius: '0.375rem',
263
+ };
257
264
  }
258
265
  if (
259
266
  selectedStartDay &&
260
267
  selectedEndDay &&
261
268
  (day < selectedStartDay || day > selectedEndDay)
262
269
  ) {
263
- return borderRadius.md.all;
270
+ return { borderRadius: '0.375rem' };
264
271
  }
265
- return borderRadius.md.all;
272
+ return { borderRadius: '0.375rem' };
266
273
  };
267
274
 
268
275
  export const displaySelected = (
@@ -312,89 +319,102 @@ export const displaySelected = (
312
319
  };
313
320
 
314
321
  const getDayBgColorClassName = (
322
+ theme: any,
315
323
  day: Date,
316
324
  selectedStartDay: Date | null,
317
325
  selectedEndDay: Date | null,
318
326
  hoveredDay: Date | null,
319
327
  color: Color,
320
328
  isDayDisabled = false
321
- ): string => {
322
- if (isDayDisabled) return getColorClassNames('transparent').bgColor;
323
- if (selectedStartDay && isEqual(day, selectedStartDay)) {
324
- return getColorClassNames(color, colorPalette.background).bgColor;
325
- }
326
- if (
327
- selectedStartDay &&
328
- !selectedEndDay &&
329
- hoveredDay &&
330
- day > selectedStartDay &&
331
- day < hoveredDay
332
- ) {
333
- return getColorClassNames(DEFAULT_COLOR, colorPalette.lightBackground)
334
- .bgColor;
335
- }
336
- if (selectedEndDay && isEqual(day, selectedEndDay)) {
337
- return getColorClassNames(color, colorPalette.background).bgColor;
338
- }
339
- if (
340
- selectedStartDay &&
341
- selectedEndDay &&
342
- day > selectedStartDay &&
343
- day < selectedEndDay
344
- ) {
345
- return getColorClassNames(DEFAULT_COLOR, colorPalette.lightBackground)
346
- .bgColor;
329
+ ) => {
330
+ const styles = {
331
+ background: 'transparent',
332
+ };
333
+
334
+ if (!isDayDisabled) {
335
+ if (selectedStartDay && isEqual(day, selectedStartDay)) {
336
+ styles.background = theme?.chartColors[0] || '#6269E9';
337
+ }
338
+ if (
339
+ selectedStartDay &&
340
+ !selectedEndDay &&
341
+ hoveredDay &&
342
+ day > selectedStartDay &&
343
+ day < hoveredDay
344
+ ) {
345
+ styles.background =
346
+ hexToRgbaWith10PercentAlpha(theme?.chartColors[0]) ||
347
+ hexToRgbaWith10PercentAlpha('#6269E9');
348
+ }
349
+ if (selectedEndDay && isEqual(day, selectedEndDay)) {
350
+ styles.background = theme?.chartColors[0] || '#6269E9';
351
+ }
352
+ if (
353
+ selectedStartDay &&
354
+ selectedEndDay &&
355
+ day > selectedStartDay &&
356
+ day < selectedEndDay
357
+ ) {
358
+ styles.background =
359
+ hexToRgbaWith10PercentAlpha(theme?.chartColors[0]) ||
360
+ hexToRgbaWith10PercentAlpha('#6269E9');
361
+ }
347
362
  }
348
- return getColorClassNames('transparent').bgColor;
363
+
364
+ return styles;
349
365
  };
350
366
 
351
367
  const getDayTextClassNames = (
368
+ theme: any,
352
369
  day: Date,
353
370
  selectedStartDay: Date | null,
354
371
  selectedEndDay: Date | null,
355
372
  hoveredDay: Date | null,
356
373
  color: Color,
357
374
  isDayDisabled = false
358
- ): string => {
359
- if (isDayDisabled)
360
- return getColorClassNames(DEFAULT_COLOR, colorPalette.lightText).textColor;
361
- if (isToday(day)) {
362
- if (
363
- (selectedStartDay && isEqual(day, selectedStartDay)) ||
364
- (selectedEndDay && isEqual(day, selectedEndDay))
365
- ) {
366
- return getColorClassNames('white').textColor;
375
+ ) => {
376
+ const styles = {
377
+ color: theme?.primaryTextColor || '#364153',
378
+ };
379
+
380
+ if (!isDayDisabled) {
381
+ if (isToday(day)) {
382
+ if (
383
+ (selectedStartDay && isEqual(day, selectedStartDay)) ||
384
+ (selectedEndDay && isEqual(day, selectedEndDay))
385
+ ) {
386
+ styles.color = 'white';
387
+ } else {
388
+ styles.color = theme?.primaryTextColor || '#364153';
389
+ }
390
+ } else {
391
+ if (selectedStartDay && isEqual(day, selectedStartDay)) {
392
+ styles.color = 'white';
393
+ }
394
+ if (
395
+ selectedStartDay &&
396
+ !selectedEndDay &&
397
+ hoveredDay &&
398
+ day > selectedStartDay &&
399
+ day < hoveredDay
400
+ ) {
401
+ styles.color = theme?.primaryTextColor || '#364153';
402
+ }
403
+ if (selectedEndDay && isEqual(day, selectedEndDay)) {
404
+ styles.color = 'white';
405
+ }
406
+ if (
407
+ selectedStartDay &&
408
+ selectedEndDay &&
409
+ day > selectedStartDay &&
410
+ day < selectedEndDay
411
+ ) {
412
+ styles.color = theme?.primaryTextColor || '#364153';
413
+ }
367
414
  }
368
- return twMerge(
369
- getColorClassNames(color, colorPalette.text).textColor,
370
- fontWeight.lg
371
- );
372
415
  }
373
- if (selectedStartDay && isEqual(day, selectedStartDay)) {
374
- return getColorClassNames('white').textColor;
375
- }
376
- if (
377
- selectedStartDay &&
378
- !selectedEndDay &&
379
- hoveredDay &&
380
- day > selectedStartDay &&
381
- day < hoveredDay
382
- ) {
383
- return getColorClassNames(DEFAULT_COLOR, colorPalette.darkestText)
384
- .textColor;
385
- }
386
- if (selectedEndDay && isEqual(day, selectedEndDay)) {
387
- return getColorClassNames('white').textColor;
388
- }
389
- if (
390
- selectedStartDay &&
391
- selectedEndDay &&
392
- day > selectedStartDay &&
393
- day < selectedEndDay
394
- ) {
395
- return getColorClassNames(color, colorPalette.text).textColor;
396
- }
397
- return getColorClassNames(DEFAULT_COLOR, colorPalette.darkestText).textColor;
416
+
417
+ return styles;
398
418
  };
399
419
 
400
420
  const getDayHoverBgColorClassName = (
@@ -402,15 +422,21 @@ const getDayHoverBgColorClassName = (
402
422
  selectedStartDay: Date | null,
403
423
  selectedEndDay: Date | null,
404
424
  isDayDisabled = false
405
- ): string => {
406
- if (isDayDisabled) return '';
407
- if (selectedStartDay && isEqual(day, selectedStartDay)) {
408
- return '';
409
- }
410
- if (selectedEndDay && isEqual(day, selectedEndDay)) {
411
- return '';
425
+ ) => {
426
+ const styles = {
427
+ background: 'transparent',
428
+ };
429
+
430
+ if (!isDayDisabled) {
431
+ if (selectedStartDay && isEqual(day, selectedStartDay)) {
432
+ styles.background = '';
433
+ }
434
+ if (selectedEndDay && isEqual(day, selectedEndDay)) {
435
+ styles.background = '';
436
+ }
412
437
  }
413
- return 'hover:bg-gray-200';
438
+
439
+ return styles;
414
440
  };
415
441
 
416
442
  export const formatSelectedDates = (