@quillsql/react 1.1.8 → 1.2.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.
Files changed (106) hide show
  1. package/lib/BarList.d.ts +1 -0
  2. package/lib/BarList.js +129 -37
  3. package/lib/BarList.js.map +1 -1
  4. package/lib/Chart.d.ts +3 -3
  5. package/lib/Chart.js +66 -30
  6. package/lib/Chart.js.map +1 -1
  7. package/lib/Context.d.ts +1 -1
  8. package/lib/Dashboard.d.ts +1 -1
  9. package/lib/Dashboard.js +0 -4
  10. package/lib/Dashboard.js.map +1 -1
  11. package/lib/DateRangePicker/Calendar.d.ts +1 -1
  12. package/lib/DateRangePicker/Calendar.js +122 -23
  13. package/lib/DateRangePicker/Calendar.js.map +1 -1
  14. package/lib/DateRangePicker/DateRangePicker.js +5 -6
  15. package/lib/DateRangePicker/DateRangePicker.js.map +1 -1
  16. package/lib/DateRangePicker/DateRangePickerButton.d.ts +1 -1
  17. package/lib/DateRangePicker/DateRangePickerButton.js +101 -17
  18. package/lib/DateRangePicker/DateRangePickerButton.js.map +1 -1
  19. package/lib/DateRangePicker/dateRangePickerUtils.d.ts +1 -3
  20. package/lib/DateRangePicker/dateRangePickerUtils.js +113 -79
  21. package/lib/DateRangePicker/dateRangePickerUtils.js.map +1 -1
  22. package/lib/PieChart.d.ts +3 -10
  23. package/lib/PieChart.js +51 -103
  24. package/lib/PieChart.js.map +1 -1
  25. package/lib/QuillProvider.d.ts +1 -2
  26. package/lib/assets/ArrowDownHeadIcon.d.ts +1 -2
  27. package/lib/assets/ArrowDownIcon.d.ts +1 -2
  28. package/lib/assets/ArrowDownRightIcon.d.ts +1 -2
  29. package/lib/assets/ArrowLeftHeadIcon.d.ts +1 -2
  30. package/lib/assets/ArrowRightHeadIcon.d.ts +1 -2
  31. package/lib/assets/ArrowRightIcon.d.ts +1 -2
  32. package/lib/assets/ArrowUpHeadIcon.d.ts +1 -2
  33. package/lib/assets/ArrowUpIcon.d.ts +1 -2
  34. package/lib/assets/ArrowUpRightIcon.d.ts +1 -2
  35. package/lib/assets/CalendarIcon.d.ts +1 -2
  36. package/lib/assets/DoubleArrowLeftHeadIcon.d.ts +1 -2
  37. package/lib/assets/DoubleArrowRightHeadIcon.d.ts +1 -2
  38. package/lib/assets/ExclamationFilledIcon.d.ts +1 -2
  39. package/lib/assets/LoadingSpinner.d.ts +1 -2
  40. package/lib/assets/SearchIcon.d.ts +1 -2
  41. package/lib/assets/XCircleIcon.d.ts +1 -2
  42. package/lib/components/Dropdown/Dropdown.js +45 -14
  43. package/lib/components/Dropdown/Dropdown.js.map +1 -1
  44. package/lib/components/Dropdown/DropdownItem.d.ts +1 -0
  45. package/lib/components/Dropdown/DropdownItem.js +21 -29
  46. package/lib/components/Dropdown/DropdownItem.js.map +1 -1
  47. package/lib/components/Modal/Modal.d.ts +1 -0
  48. package/lib/components/Modal/Modal.js +47 -9
  49. package/lib/components/Modal/Modal.js.map +1 -1
  50. package/lib/components/selectUtils.d.ts +1 -1
  51. package/lib/components/selectUtils.js +18 -12
  52. package/lib/components/selectUtils.js.map +1 -1
  53. package/lib/contexts/BaseColorContext.d.ts +1 -1
  54. package/lib/contexts/BaseColorContext.js +1 -2
  55. package/lib/contexts/BaseColorContext.js.map +1 -1
  56. package/lib/lib/index.d.ts +0 -7
  57. package/lib/lib/index.js +0 -7
  58. package/lib/lib/index.js.map +1 -1
  59. package/lib/lib/utils.d.ts +1 -4
  60. package/lib/lib/utils.js +4 -33
  61. package/lib/lib/utils.js.map +1 -1
  62. package/package.json +1 -8
  63. package/src/BarList.tsx +193 -96
  64. package/src/Chart.tsx +108 -48
  65. package/src/Dashboard.tsx +10 -10
  66. package/src/DateRangePicker/Calendar.tsx +149 -165
  67. package/src/DateRangePicker/DateRangePicker.tsx +11 -11
  68. package/src/DateRangePicker/DateRangePickerButton.tsx +129 -84
  69. package/src/DateRangePicker/dateRangePickerUtils.tsx +137 -117
  70. package/src/PieChart.tsx +87 -111
  71. package/src/components/Dropdown/Dropdown.tsx +50 -69
  72. package/src/components/Dropdown/DropdownItem.tsx +15 -50
  73. package/src/components/Modal/Modal.tsx +50 -31
  74. package/src/components/selectUtils.ts +19 -26
  75. package/src/contexts/BaseColorContext.tsx +1 -4
  76. package/src/lib/index.ts +0 -7
  77. package/src/lib/utils.tsx +8 -43
  78. package/src/styles.css +0 -5
  79. package/example/README.md +0 -46
  80. package/example/package-lock.json +0 -12111
  81. package/example/package.json +0 -43
  82. package/example/public/favicon.ico +0 -0
  83. package/example/public/index.html +0 -43
  84. package/example/public/logo192.png +0 -0
  85. package/example/public/logo512.png +0 -0
  86. package/example/public/manifest.json +0 -25
  87. package/example/public/robots.txt +0 -3
  88. package/example/src/App.css +0 -38
  89. package/example/src/App.test.tsx +0 -9
  90. package/example/src/App.tsx +0 -47
  91. package/example/src/index.css +0 -13
  92. package/example/src/index.tsx +0 -19
  93. package/example/src/logo.svg +0 -1
  94. package/example/src/react-app-env.d.ts +0 -1
  95. package/example/src/reportWebVitals.ts +0 -15
  96. package/example/src/setupTests.ts +0 -5
  97. package/example/tsconfig.json +0 -26
  98. package/postcss.config.js +0 -6
  99. package/src/lib/colorClassNames.ts +0 -3191
  100. package/src/lib/constants.ts +0 -58
  101. package/src/lib/hexColors.ts +0 -28
  102. package/src/lib/shape.ts +0 -75
  103. package/src/lib/sizing.ts +0 -47
  104. package/src/lib/spacing.ts +0 -264
  105. package/src/lib/theme.ts +0 -49
  106. 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,
@@ -13,17 +12,8 @@ import {
13
12
  startOfYear,
14
13
  sub,
15
14
  } from 'date-fns';
16
- import { Color } from '../lib/inputTypes';
17
15
  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');
16
+ import { hexToRgbaWith10PercentAlpha } from '../BarList';
27
17
 
28
18
  export const getWeekdays = (locale: Locale) => {
29
19
  const firstDayOfWeek = startOfWeek(new Date());
@@ -143,52 +133,53 @@ export const defaultOptions: DateRangePickerOption[] = [
143
133
  ];
144
134
 
145
135
  export const getDateStyles = (
136
+ theme: any,
146
137
  date: Date,
147
138
  finalStartDate: Date | null,
148
139
  finalEndDate: Date | null,
149
140
  hoveredDate: Date | undefined,
150
- isDateDisabled: boolean,
151
- color: Color
152
- ) =>
153
- twMerge(
154
- getDayBgColorClassName(
141
+ isDateDisabled: boolean
142
+ ) => {
143
+ return {
144
+ ...getDayTextClassNames(
145
+ theme,
155
146
  date,
156
147
  finalStartDate,
157
148
  finalEndDate,
158
149
  hoveredDate as Date | null,
159
- color,
160
150
  isDateDisabled
161
151
  ),
162
- getDayTextClassNames(
152
+ // ...getDayHoverBgColorClassName(
153
+ // date,
154
+ // finalStartDate,
155
+ // finalEndDate,
156
+ // isDateDisabled
157
+ // ),
158
+ ...getDayRoundedClassName(
163
159
  date,
164
160
  finalStartDate,
165
161
  finalEndDate,
166
- hoveredDate as Date | null,
167
- color,
168
- isDateDisabled
162
+ hoveredDate as Date | null
169
163
  ),
170
- getDayHoverBgColorClassName(
164
+ ...getDayBgColorClassName(
165
+ theme,
171
166
  date,
172
167
  finalStartDate,
173
168
  finalEndDate,
169
+ hoveredDate as Date | null,
174
170
  isDateDisabled
175
171
  ),
176
- getDayRoundedClassName(
177
- date,
178
- finalStartDate,
179
- finalEndDate,
180
- hoveredDate as Date | null
181
- )
182
- );
172
+ };
173
+ };
183
174
 
184
175
  const getDayRoundedClassName = (
185
176
  day: Date,
186
177
  selectedStartDay: Date | null,
187
178
  selectedEndDay: Date | null,
188
179
  hoveredDay: Date | null
189
- ): string => {
180
+ ): any => {
190
181
  if (!selectedStartDay && !selectedEndDay) {
191
- return borderRadius.md.all;
182
+ return { borderRadius: '0.375rem' };
192
183
  }
193
184
  if (
194
185
  selectedStartDay &&
@@ -196,10 +187,13 @@ const getDayRoundedClassName = (
196
187
  isEqual(day, selectedStartDay) &&
197
188
  isEqual(day, selectedEndDay)
198
189
  ) {
199
- return borderRadius.md.all;
190
+ return { borderRadius: '0.375rem' };
200
191
  }
201
192
  if (selectedStartDay && selectedEndDay && isEqual(day, selectedStartDay)) {
202
- return borderRadius.md.left;
193
+ return {
194
+ borderBottomLeftRadius: '0.375rem',
195
+ borderTopLeftRadius: '0.375rem',
196
+ };
203
197
  }
204
198
  if (
205
199
  selectedStartDay &&
@@ -207,7 +201,7 @@ const getDayRoundedClassName = (
207
201
  !hoveredDay &&
208
202
  isEqual(day, selectedStartDay)
209
203
  ) {
210
- return borderRadius.md.all;
204
+ return { borderRadius: '0.375rem' };
211
205
  }
212
206
  if (
213
207
  selectedStartDay &&
@@ -215,7 +209,7 @@ const getDayRoundedClassName = (
215
209
  hoveredDay &&
216
210
  day < selectedStartDay
217
211
  ) {
218
- return borderRadius.md.all;
212
+ return { borderRadius: '0.375rem' };
219
213
  }
220
214
  if (
221
215
  selectedStartDay &&
@@ -224,7 +218,10 @@ const getDayRoundedClassName = (
224
218
  isEqual(day, selectedStartDay) &&
225
219
  hoveredDay > selectedStartDay
226
220
  ) {
227
- return borderRadius.md.left;
221
+ return {
222
+ borderBottomLeftRadius: '0.375rem',
223
+ borderTopLeftRadius: '0.375rem',
224
+ };
228
225
  }
229
226
  if (
230
227
  selectedStartDay &&
@@ -233,7 +230,7 @@ const getDayRoundedClassName = (
233
230
  day > selectedStartDay &&
234
231
  day < hoveredDay
235
232
  ) {
236
- return borderRadius.none.all;
233
+ return { borderRadius: 0 };
237
234
  }
238
235
  if (
239
236
  selectedStartDay &&
@@ -241,7 +238,7 @@ const getDayRoundedClassName = (
241
238
  day > selectedStartDay &&
242
239
  day < selectedEndDay
243
240
  ) {
244
- return borderRadius.none.all;
241
+ return { borderRadius: 0 };
245
242
  }
246
243
  if (
247
244
  selectedStartDay &&
@@ -250,19 +247,25 @@ const getDayRoundedClassName = (
250
247
  isEqual(day, hoveredDay) &&
251
248
  !isEqual(day, selectedStartDay)
252
249
  ) {
253
- return borderRadius.md.right;
250
+ return {
251
+ borderBottomRightRadius: '0.375rem',
252
+ borderTopRightRadius: '0.375rem',
253
+ };
254
254
  }
255
255
  if (selectedStartDay && selectedEndDay && isEqual(day, selectedEndDay)) {
256
- return borderRadius.md.right;
256
+ return {
257
+ borderBottomRightRadius: '0.375rem',
258
+ borderTopRightRadius: '0.375rem',
259
+ };
257
260
  }
258
261
  if (
259
262
  selectedStartDay &&
260
263
  selectedEndDay &&
261
264
  (day < selectedStartDay || day > selectedEndDay)
262
265
  ) {
263
- return borderRadius.md.all;
266
+ return { borderRadius: '0.375rem' };
264
267
  }
265
- return borderRadius.md.all;
268
+ return { borderRadius: '0.375rem' };
266
269
  };
267
270
 
268
271
  export const displaySelected = (
@@ -312,89 +315,100 @@ export const displaySelected = (
312
315
  };
313
316
 
314
317
  const getDayBgColorClassName = (
318
+ theme: any,
315
319
  day: Date,
316
320
  selectedStartDay: Date | null,
317
321
  selectedEndDay: Date | null,
318
322
  hoveredDay: Date | null,
319
- color: Color,
320
323
  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;
324
+ ) => {
325
+ const styles = {
326
+ background: 'transparent',
327
+ };
328
+
329
+ if (!isDayDisabled) {
330
+ if (selectedStartDay && isEqual(day, selectedStartDay)) {
331
+ styles.background = theme?.chartColors[0] || '#6269E9';
332
+ }
333
+ if (
334
+ selectedStartDay &&
335
+ !selectedEndDay &&
336
+ hoveredDay &&
337
+ day > selectedStartDay &&
338
+ day < hoveredDay
339
+ ) {
340
+ styles.background =
341
+ hexToRgbaWith10PercentAlpha(theme?.chartColors[0]) ||
342
+ hexToRgbaWith10PercentAlpha('#6269E9');
343
+ }
344
+ if (selectedEndDay && isEqual(day, selectedEndDay)) {
345
+ styles.background = theme?.chartColors[0] || '#6269E9';
346
+ }
347
+ if (
348
+ selectedStartDay &&
349
+ selectedEndDay &&
350
+ day > selectedStartDay &&
351
+ day < selectedEndDay
352
+ ) {
353
+ styles.background =
354
+ hexToRgbaWith10PercentAlpha(theme?.chartColors[0]) ||
355
+ hexToRgbaWith10PercentAlpha('#6269E9');
356
+ }
347
357
  }
348
- return getColorClassNames('transparent').bgColor;
358
+
359
+ return styles;
349
360
  };
350
361
 
351
362
  const getDayTextClassNames = (
363
+ theme: any,
352
364
  day: Date,
353
365
  selectedStartDay: Date | null,
354
366
  selectedEndDay: Date | null,
355
367
  hoveredDay: Date | null,
356
- color: Color,
357
368
  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;
369
+ ) => {
370
+ const styles = {
371
+ color: theme?.primaryTextColor || '#364153',
372
+ };
373
+
374
+ if (!isDayDisabled) {
375
+ if (isToday(day)) {
376
+ if (
377
+ (selectedStartDay && isEqual(day, selectedStartDay)) ||
378
+ (selectedEndDay && isEqual(day, selectedEndDay))
379
+ ) {
380
+ styles.color = 'white';
381
+ } else {
382
+ styles.color = theme?.primaryTextColor || '#364153';
383
+ }
384
+ } else {
385
+ if (selectedStartDay && isEqual(day, selectedStartDay)) {
386
+ styles.color = 'white';
387
+ }
388
+ if (
389
+ selectedStartDay &&
390
+ !selectedEndDay &&
391
+ hoveredDay &&
392
+ day > selectedStartDay &&
393
+ day < hoveredDay
394
+ ) {
395
+ styles.color = theme?.primaryTextColor || '#364153';
396
+ }
397
+ if (selectedEndDay && isEqual(day, selectedEndDay)) {
398
+ styles.color = 'white';
399
+ }
400
+ if (
401
+ selectedStartDay &&
402
+ selectedEndDay &&
403
+ day > selectedStartDay &&
404
+ day < selectedEndDay
405
+ ) {
406
+ styles.color = theme?.primaryTextColor || '#364153';
407
+ }
367
408
  }
368
- return twMerge(
369
- getColorClassNames(color, colorPalette.text).textColor,
370
- fontWeight.lg
371
- );
372
- }
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
409
  }
397
- return getColorClassNames(DEFAULT_COLOR, colorPalette.darkestText).textColor;
410
+
411
+ return styles;
398
412
  };
399
413
 
400
414
  const getDayHoverBgColorClassName = (
@@ -402,15 +416,21 @@ const getDayHoverBgColorClassName = (
402
416
  selectedStartDay: Date | null,
403
417
  selectedEndDay: Date | null,
404
418
  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 '';
419
+ ) => {
420
+ const styles = {
421
+ background: 'transparent',
422
+ };
423
+
424
+ if (!isDayDisabled) {
425
+ if (selectedStartDay && isEqual(day, selectedStartDay)) {
426
+ styles.background = '';
427
+ }
428
+ if (selectedEndDay && isEqual(day, selectedEndDay)) {
429
+ styles.background = '';
430
+ }
412
431
  }
413
- return 'hover:bg-gray-200';
432
+
433
+ return styles;
414
434
  };
415
435
 
416
436
  export const formatSelectedDates = (