@quillsql/react 1.7.4 → 1.7.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.
Files changed (86) hide show
  1. package/lib/AddToDashboardModal.js +2 -2
  2. package/lib/AddToDashboardModal.js.map +1 -1
  3. package/lib/Chart.js +2 -2
  4. package/lib/Chart.js.map +1 -1
  5. package/lib/Context.d.ts +2 -1
  6. package/lib/Context.js +3 -1
  7. package/lib/Context.js.map +1 -1
  8. package/lib/Dashboard.js +2 -2
  9. package/lib/Dashboard.js.map +1 -1
  10. package/lib/QuillProvider.d.ts +2 -1
  11. package/lib/QuillProvider.js +2 -2
  12. package/lib/QuillProvider.js.map +1 -1
  13. package/lib/ReportBuilder.d.ts +1 -1
  14. package/lib/ReportBuilder.js +3 -2
  15. package/lib/ReportBuilder.js.map +1 -1
  16. package/lib/SQLEditor.js +5 -5
  17. package/lib/SQLEditor.js.map +1 -1
  18. package/lib/Table.js +1 -1
  19. package/lib/Table.js.map +1 -1
  20. package/lib/components/BigModal/BigModal.js +1 -0
  21. package/lib/components/BigModal/BigModal.js.map +1 -1
  22. package/lib/components/Modal/Modal.js +1 -0
  23. package/lib/components/Modal/Modal.js.map +1 -1
  24. package/lib/hooks/useQuill.js +3 -2
  25. package/lib/hooks/useQuill.js.map +1 -1
  26. package/package.json +11 -4
  27. package/.eslintrc.json +0 -19
  28. package/.prettierrc +0 -11
  29. package/.vscode/settings.json +0 -10
  30. package/src/AddToDashboardModal.tsx +0 -1213
  31. package/src/BarList.tsx +0 -580
  32. package/src/Chart.tsx +0 -1336
  33. package/src/Context.tsx +0 -249
  34. package/src/Dashboard.tsx +0 -819
  35. package/src/DateRangePicker/Calendar.tsx +0 -442
  36. package/src/DateRangePicker/DateRangePicker.tsx +0 -261
  37. package/src/DateRangePicker/DateRangePickerButton.tsx +0 -250
  38. package/src/DateRangePicker/dateRangePickerUtils.tsx +0 -480
  39. package/src/DateRangePicker/index.ts +0 -4
  40. package/src/PieChart.tsx +0 -845
  41. package/src/QuillProvider.tsx +0 -78
  42. package/src/ReportBuilder.tsx +0 -2202
  43. package/src/SQLEditor.tsx +0 -1087
  44. package/src/Table.tsx +0 -1074
  45. package/src/TableChart.tsx +0 -428
  46. package/src/assets/ArrowDownHeadIcon.tsx +0 -11
  47. package/src/assets/ArrowDownIcon.tsx +0 -14
  48. package/src/assets/ArrowDownRightIcon.tsx +0 -14
  49. package/src/assets/ArrowLeftHeadIcon.tsx +0 -11
  50. package/src/assets/ArrowRightHeadIcon.tsx +0 -11
  51. package/src/assets/ArrowRightIcon.tsx +0 -14
  52. package/src/assets/ArrowUpHeadIcon.tsx +0 -11
  53. package/src/assets/ArrowUpIcon.tsx +0 -14
  54. package/src/assets/ArrowUpRightIcon.tsx +0 -14
  55. package/src/assets/CalendarIcon.tsx +0 -14
  56. package/src/assets/DoubleArrowLeftHeadIcon.tsx +0 -18
  57. package/src/assets/DoubleArrowRightHeadIcon.tsx +0 -20
  58. package/src/assets/ExclamationFilledIcon.tsx +0 -14
  59. package/src/assets/LoadingSpinner.tsx +0 -11
  60. package/src/assets/SearchIcon.tsx +0 -14
  61. package/src/assets/XCircleIcon.tsx +0 -14
  62. package/src/assets/index.ts +0 -16
  63. package/src/components/BigModal/BigModal.tsx +0 -108
  64. package/src/components/Dropdown/Dropdown.tsx +0 -169
  65. package/src/components/Dropdown/DropdownItem.tsx +0 -68
  66. package/src/components/Dropdown/index.ts +0 -2
  67. package/src/components/Modal/Modal.tsx +0 -132
  68. package/src/components/Modal/index.ts +0 -1
  69. package/src/components/selectUtils.ts +0 -60
  70. package/src/contexts/BaseColorContext.tsx +0 -5
  71. package/src/contexts/HoveredValueContext.tsx +0 -12
  72. package/src/contexts/RootStylesContext.tsx +0 -5
  73. package/src/contexts/SelectedValueContext.tsx +0 -13
  74. package/src/contexts/index.ts +0 -4
  75. package/src/hooks/index.ts +0 -4
  76. package/src/hooks/useInternalState.tsx +0 -18
  77. package/src/hooks/useOnClickOutside.tsx +0 -23
  78. package/src/hooks/useOnWindowResize.tsx +0 -17
  79. package/src/hooks/useQuill.ts +0 -137
  80. package/src/hooks/useSelectOnKeyDown.tsx +0 -80
  81. package/src/index.ts +0 -9
  82. package/src/lib/font.ts +0 -14
  83. package/src/lib/index.ts +0 -3
  84. package/src/lib/inputTypes.ts +0 -81
  85. package/src/lib/utils.tsx +0 -46
  86. package/tsconfig.json +0 -22
@@ -1,480 +0,0 @@
1
- import {
2
- addDays,
3
- format,
4
- isEqual,
5
- isToday,
6
- max,
7
- min,
8
- startOfDay,
9
- startOfMonth,
10
- startOfToday,
11
- startOfWeek,
12
- startOfYear,
13
- sub,
14
- } from 'date-fns';
15
- import { DateRangePickerOption } from './DateRangePicker';
16
- import { hexToRgbaWith10PercentAlpha } from '../BarList';
17
-
18
- export const getWeekdays = (locale: Locale) => {
19
- const firstDayOfWeek = startOfWeek(new Date());
20
- return Array.from(Array(7)).map((e, i) =>
21
- format(addDays(firstDayOfWeek, i), 'EEEEEE', { locale })
22
- );
23
- };
24
-
25
- export const capitalize = (s: string, locale: Locale) => {
26
- return s.charAt(0).toLocaleUpperCase(locale.code) + s.substring(1);
27
- };
28
-
29
- export const getStartDateByDropdownValue = (
30
- dropdownValue: string | null | undefined,
31
- dropdownOptions: DateRangePickerOption[]
32
- ) => {
33
- const startDate =
34
- dropdownOptions.find(
35
- (option: DateRangePickerOption) => option.value === dropdownValue
36
- )?.startDate ?? null;
37
- return startDate ? startOfDay(startDate) : null;
38
- };
39
-
40
- export const getEndDateByDropdownValue = (
41
- dropdownValue: string | null | undefined,
42
- dropdownOptions: DateRangePickerOption[]
43
- ) =>
44
- startOfDay(
45
- dropdownOptions.find(
46
- (option: DateRangePickerOption) => option.value === dropdownValue
47
- )?.endDate ?? startOfToday()
48
- );
49
-
50
- export const parseStartDate = (
51
- startDate: Date | null | undefined,
52
- minDate: Date | null | undefined,
53
- selectedDropdownValue: string | null | undefined,
54
- dropdownOptions: DateRangePickerOption[]
55
- ) => {
56
- if (selectedDropdownValue) {
57
- startDate = getStartDateByDropdownValue(
58
- selectedDropdownValue,
59
- dropdownOptions
60
- );
61
- }
62
- if (!startDate) return null;
63
- if (startDate && !minDate) return startOfDay(startDate);
64
- return startOfDay(max([startDate as Date, minDate as Date]));
65
- };
66
-
67
- export const parseEndDate = (
68
- endDate: Date | null | undefined,
69
- maxDate: Date | null | undefined,
70
- selectedDropdownValue: string | null | undefined,
71
- dropdownOptions: DateRangePickerOption[]
72
- ) => {
73
- if (selectedDropdownValue) {
74
- endDate = getEndDateByDropdownValue(selectedDropdownValue, dropdownOptions);
75
- }
76
- if (!endDate) return null;
77
- if (endDate && !maxDate) return startOfDay(endDate);
78
-
79
- return startOfDay(min([endDate as Date, maxDate as Date]));
80
- };
81
-
82
- export const defaultOptions: DateRangePickerOption[] = [
83
- // {
84
- // value: 'tdy',
85
- // text: 'Today',
86
- // startDate: startOfToday(),
87
- // },
88
- {
89
- value: 'w',
90
- text: 'Last 7 days',
91
- startDate: sub(startOfToday(), { days: 7 }),
92
- },
93
- {
94
- value: 't',
95
- text: 'Last 30 days',
96
- startDate: sub(startOfToday(), { days: 30 }),
97
- },
98
- {
99
- value: '90d',
100
- text: 'Last 90 days',
101
- startDate: sub(startOfToday(), { days: 90 }),
102
- },
103
- {
104
- value: '6m',
105
- text: 'Last 6 months',
106
- startDate: sub(startOfToday(), { months: 6 }),
107
- },
108
- {
109
- value: 'm',
110
- text: 'This month',
111
- startDate: startOfMonth(startOfToday()),
112
- },
113
- {
114
- value: 'y',
115
- text: 'This year',
116
- startDate: startOfYear(startOfToday()),
117
- },
118
- // {
119
- // value: 'tw',
120
- // text: 'This week',
121
- // startDate: startOfWeek(startOfToday()),
122
- // },
123
- // {
124
- // value: '2w',
125
- // text: 'Last 2 weeks',
126
- // startDate: sub(startOfToday(), { weeks: 2 }),
127
- // },
128
- {
129
- value: 'at',
130
- text: 'All time',
131
- startDate: sub(startOfToday(), { years: 100 }),
132
- },
133
- ];
134
-
135
- export const getDateStyles = (
136
- theme: any,
137
- date: Date,
138
- finalStartDate: Date | null,
139
- finalEndDate: Date | null,
140
- hoveredDate: Date | undefined,
141
- isDateDisabled: boolean
142
- ) => {
143
- return {
144
- ...getDayTextClassNames(
145
- theme,
146
- date,
147
- finalStartDate,
148
- finalEndDate,
149
- hoveredDate as Date | null,
150
- isDateDisabled
151
- ),
152
- // ...getDayHoverBgColorClassName(
153
- // date,
154
- // finalStartDate,
155
- // finalEndDate,
156
- // isDateDisabled
157
- // ),
158
- ...getDayRoundedClassName(
159
- date,
160
- finalStartDate,
161
- finalEndDate,
162
- hoveredDate as Date | null
163
- ),
164
- ...getDayBgColorClassName(
165
- theme,
166
- date,
167
- finalStartDate,
168
- finalEndDate,
169
- hoveredDate as Date | null,
170
- isDateDisabled
171
- ),
172
- };
173
- };
174
-
175
- const getDayRoundedClassName = (
176
- day: Date,
177
- selectedStartDay: Date | null,
178
- selectedEndDay: Date | null,
179
- hoveredDay: Date | null
180
- ): any => {
181
- if (!selectedStartDay && !selectedEndDay) {
182
- return { borderRadius: '0.375rem' };
183
- }
184
- if (
185
- selectedStartDay &&
186
- selectedEndDay &&
187
- isEqual(day, selectedStartDay) &&
188
- isEqual(day, selectedEndDay)
189
- ) {
190
- return { borderRadius: '0.375rem' };
191
- }
192
- if (selectedStartDay && selectedEndDay && isEqual(day, selectedStartDay)) {
193
- return {
194
- borderBottomLeftRadius: '0.375rem',
195
- borderTopLeftRadius: '0.375rem',
196
- };
197
- }
198
- if (
199
- selectedStartDay &&
200
- !selectedEndDay &&
201
- !hoveredDay &&
202
- isEqual(day, selectedStartDay)
203
- ) {
204
- return { borderRadius: '0.375rem' };
205
- }
206
- if (
207
- selectedStartDay &&
208
- !selectedEndDay &&
209
- hoveredDay &&
210
- day < selectedStartDay
211
- ) {
212
- return { borderRadius: '0.375rem' };
213
- }
214
- if (
215
- selectedStartDay &&
216
- !selectedEndDay &&
217
- hoveredDay &&
218
- isEqual(day, selectedStartDay) &&
219
- hoveredDay > selectedStartDay
220
- ) {
221
- return {
222
- borderBottomLeftRadius: '0.375rem',
223
- borderTopLeftRadius: '0.375rem',
224
- };
225
- }
226
- if (
227
- selectedStartDay &&
228
- !selectedEndDay &&
229
- hoveredDay &&
230
- day > selectedStartDay &&
231
- day < hoveredDay
232
- ) {
233
- return { borderRadius: 0 };
234
- }
235
- if (
236
- selectedStartDay &&
237
- selectedEndDay &&
238
- day > selectedStartDay &&
239
- day < selectedEndDay
240
- ) {
241
- return { borderRadius: 0 };
242
- }
243
- if (
244
- selectedStartDay &&
245
- !selectedEndDay &&
246
- hoveredDay &&
247
- isEqual(day, hoveredDay) &&
248
- !isEqual(day, selectedStartDay)
249
- ) {
250
- return {
251
- borderBottomRightRadius: '0.375rem',
252
- borderTopRightRadius: '0.375rem',
253
- };
254
- }
255
- if (selectedStartDay && selectedEndDay && isEqual(day, selectedEndDay)) {
256
- return {
257
- borderBottomRightRadius: '0.375rem',
258
- borderTopRightRadius: '0.375rem',
259
- };
260
- }
261
- if (
262
- selectedStartDay &&
263
- selectedEndDay &&
264
- (day < selectedStartDay || day > selectedEndDay)
265
- ) {
266
- return { borderRadius: '0.375rem' };
267
- }
268
- return { borderRadius: '0.375rem' };
269
- };
270
-
271
- export const displaySelected = (
272
- selectedStartDay: Date | null,
273
- selectedEndDay: Date | null
274
- ) => {
275
- if (!selectedStartDay && !selectedEndDay) {
276
- return '';
277
- } else if (selectedStartDay && !selectedEndDay) {
278
- const options: Intl.DateTimeFormatOptions = {
279
- year: 'numeric',
280
- month: 'short',
281
- day: 'numeric',
282
- };
283
- return selectedStartDay.toLocaleDateString('en-US', options);
284
- } else if (selectedStartDay && selectedEndDay) {
285
- if (isEqual(selectedStartDay, selectedEndDay)) {
286
- const options: Intl.DateTimeFormatOptions = {
287
- year: 'numeric',
288
- month: 'short',
289
- day: 'numeric',
290
- };
291
- return selectedStartDay.toLocaleDateString('en-US', options);
292
- } else if (
293
- selectedStartDay.getMonth() === selectedEndDay.getMonth() &&
294
- selectedStartDay.getFullYear() === selectedEndDay.getFullYear()
295
- ) {
296
- const optionsStartDate: Intl.DateTimeFormatOptions = {
297
- month: 'short',
298
- day: 'numeric',
299
- };
300
- return `${selectedStartDay.toLocaleDateString(
301
- 'en-US',
302
- optionsStartDate
303
- )} -
304
- ${selectedEndDay.getDate()}, ${selectedEndDay.getFullYear()}`;
305
- } else {
306
- const options: Intl.DateTimeFormatOptions = {
307
- year: 'numeric',
308
- month: 'short',
309
- day: 'numeric',
310
- };
311
- return `${selectedStartDay.toLocaleDateString('en-US', options)} -
312
- ${selectedEndDay.toLocaleDateString('en-US', options)}`;
313
- }
314
- }
315
- };
316
-
317
- const getDayBgColorClassName = (
318
- theme: any,
319
- day: Date,
320
- selectedStartDay: Date | null,
321
- selectedEndDay: Date | null,
322
- hoveredDay: Date | null,
323
- isDayDisabled = false
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
- }
357
- }
358
-
359
- return styles;
360
- };
361
-
362
- const getDayTextClassNames = (
363
- theme: any,
364
- day: Date,
365
- selectedStartDay: Date | null,
366
- selectedEndDay: Date | null,
367
- hoveredDay: Date | null,
368
- isDayDisabled = false
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
- }
408
- }
409
- }
410
-
411
- return styles;
412
- };
413
-
414
- const getDayHoverBgColorClassName = (
415
- day: Date,
416
- selectedStartDay: Date | null,
417
- selectedEndDay: Date | null,
418
- isDayDisabled = false
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
- }
431
- }
432
-
433
- return styles;
434
- };
435
-
436
- export const formatSelectedDates = (
437
- startDate: Date | null,
438
- endDate: Date | null,
439
- locale?: Locale
440
- ) => {
441
- const localeCode = locale?.code || 'en-US';
442
- if (!startDate && !endDate) {
443
- return '';
444
- } else if (startDate && !endDate) {
445
- const options: Intl.DateTimeFormatOptions = {
446
- year: 'numeric',
447
- month: 'short',
448
- day: 'numeric',
449
- };
450
- return startDate.toLocaleDateString(localeCode, options);
451
- } else if (startDate && endDate) {
452
- if (isEqual(startDate, endDate)) {
453
- const options: Intl.DateTimeFormatOptions = {
454
- year: 'numeric',
455
- month: 'short',
456
- day: 'numeric',
457
- };
458
- return startDate.toLocaleDateString(localeCode, options);
459
- } else if (
460
- startDate.getMonth() === endDate.getMonth() &&
461
- startDate.getFullYear() === endDate.getFullYear()
462
- ) {
463
- const optionsStartDate: Intl.DateTimeFormatOptions = {
464
- month: 'short',
465
- day: 'numeric',
466
- };
467
- return `${startDate.toLocaleDateString(localeCode, optionsStartDate)} -
468
- ${endDate.getDate()}, ${endDate.getFullYear()}`;
469
- } else {
470
- const options: Intl.DateTimeFormatOptions = {
471
- year: 'numeric',
472
- month: 'short',
473
- day: 'numeric',
474
- };
475
- return `${startDate.toLocaleDateString(localeCode, options)} -
476
- ${endDate.toLocaleDateString(localeCode, options)}`;
477
- }
478
- }
479
- return '';
480
- };
@@ -1,4 +0,0 @@
1
- // @ts-nocheck
2
- export { default as DateRangePicker } from './DateRangePicker';
3
-
4
- export { DateRangePickerValue } from './DateRangePicker';