@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.
- package/example/package-lock.json +754 -1643
- package/example/src/App.tsx +3 -2
- package/lib/BarList.d.ts +1 -0
- package/lib/BarList.js +129 -37
- package/lib/BarList.js.map +1 -1
- package/lib/Chart.d.ts +3 -3
- package/lib/Chart.js +67 -31
- package/lib/Chart.js.map +1 -1
- package/lib/Context.d.ts +1 -1
- package/lib/Dashboard.d.ts +1 -1
- package/lib/Dashboard.js +16 -16
- package/lib/Dashboard.js.map +1 -1
- package/lib/DateRangePicker/Calendar.d.ts +1 -1
- package/lib/DateRangePicker/Calendar.js +122 -23
- package/lib/DateRangePicker/Calendar.js.map +1 -1
- package/lib/DateRangePicker/DateRangePicker.js +5 -6
- package/lib/DateRangePicker/DateRangePicker.js.map +1 -1
- package/lib/DateRangePicker/DateRangePickerButton.d.ts +1 -1
- package/lib/DateRangePicker/DateRangePickerButton.js +101 -17
- package/lib/DateRangePicker/DateRangePickerButton.js.map +1 -1
- package/lib/DateRangePicker/dateRangePickerUtils.d.ts +1 -2
- package/lib/DateRangePicker/dateRangePickerUtils.js +113 -79
- package/lib/DateRangePicker/dateRangePickerUtils.js.map +1 -1
- package/lib/PieChart.d.ts +3 -3
- package/lib/PieChart.js +51 -28
- package/lib/PieChart.js.map +1 -1
- package/lib/QuillProvider.d.ts +1 -2
- package/lib/assets/ArrowDownHeadIcon.d.ts +1 -2
- package/lib/assets/ArrowDownIcon.d.ts +1 -2
- package/lib/assets/ArrowDownRightIcon.d.ts +1 -2
- package/lib/assets/ArrowLeftHeadIcon.d.ts +1 -2
- package/lib/assets/ArrowRightHeadIcon.d.ts +1 -2
- package/lib/assets/ArrowRightIcon.d.ts +1 -2
- package/lib/assets/ArrowUpHeadIcon.d.ts +1 -2
- package/lib/assets/ArrowUpIcon.d.ts +1 -2
- package/lib/assets/ArrowUpRightIcon.d.ts +1 -2
- package/lib/assets/CalendarIcon.d.ts +1 -2
- package/lib/assets/DoubleArrowLeftHeadIcon.d.ts +1 -2
- package/lib/assets/DoubleArrowRightHeadIcon.d.ts +1 -2
- package/lib/assets/ExclamationFilledIcon.d.ts +1 -2
- package/lib/assets/LoadingSpinner.d.ts +1 -2
- package/lib/assets/SearchIcon.d.ts +1 -2
- package/lib/assets/XCircleIcon.d.ts +1 -2
- package/lib/components/Dropdown/Dropdown.js +45 -14
- package/lib/components/Dropdown/Dropdown.js.map +1 -1
- package/lib/components/Dropdown/DropdownItem.d.ts +1 -0
- package/lib/components/Dropdown/DropdownItem.js +21 -29
- package/lib/components/Dropdown/DropdownItem.js.map +1 -1
- package/lib/components/Modal/Modal.d.ts +1 -0
- package/lib/components/Modal/Modal.js +47 -9
- package/lib/components/Modal/Modal.js.map +1 -1
- package/lib/components/selectUtils.d.ts +1 -1
- package/lib/components/selectUtils.js +18 -12
- package/lib/components/selectUtils.js.map +1 -1
- package/package.json +1 -8
- package/src/BarList.tsx +193 -96
- package/src/Chart.tsx +109 -49
- package/src/Dashboard.tsx +27 -16
- package/src/DateRangePicker/Calendar.tsx +149 -163
- package/src/DateRangePicker/DateRangePicker.tsx +11 -11
- package/src/DateRangePicker/DateRangePickerButton.tsx +129 -84
- package/src/DateRangePicker/dateRangePickerUtils.tsx +137 -111
- package/src/PieChart.tsx +87 -34
- package/src/components/Dropdown/Dropdown.tsx +50 -69
- package/src/components/Dropdown/DropdownItem.tsx +15 -50
- package/src/components/Modal/Modal.tsx +50 -31
- package/src/components/selectUtils.ts +19 -18
- package/src/styles.css +0 -5
- package/postcss.config.js +0 -6
- package/tailwind.config.js +0 -23
package/src/PieChart.tsx
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
/* eslint-disable react/display-name */
|
|
3
3
|
// @ts-nocheck
|
|
4
4
|
import React, { useRef, useState, useEffect, CSSProperties } from 'react';
|
|
5
|
-
import { twMerge } from 'tailwind-merge';
|
|
6
5
|
import { Pie, PieChart, ResponsiveContainer, Tooltip, Legend } from 'recharts';
|
|
7
6
|
|
|
8
7
|
// const data = [
|
|
@@ -391,9 +390,14 @@ export const ChartTooltipFrame = ({
|
|
|
391
390
|
borderStyle: 'solid',
|
|
392
391
|
borderColor: theme?.borderColor || '#E5E7EB',
|
|
393
392
|
borderWidth: 1,
|
|
393
|
+
background: theme?.backgroundColor || '#ffffff',
|
|
394
|
+
fontSize: '0.875rem',
|
|
395
|
+
borderRadius: '0.375rem',
|
|
396
|
+
boxShadow:
|
|
397
|
+
'0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)',
|
|
394
398
|
}}
|
|
395
399
|
// style={{ transform: 'translateX(-120px)' }}
|
|
396
|
-
className="qq-bg-white qq-text-sm qq-rounded-md qq-shadow-lg"
|
|
400
|
+
// className="qq-bg-white qq-text-sm qq-rounded-md qq-shadow-lg"
|
|
397
401
|
// className={twMerge(
|
|
398
402
|
// 'bg-white',
|
|
399
403
|
// 'font-normal',
|
|
@@ -420,29 +424,52 @@ export const ChartTooltipRow = ({
|
|
|
420
424
|
color,
|
|
421
425
|
theme,
|
|
422
426
|
}: ChartTooltipRowProps) => (
|
|
423
|
-
<div
|
|
424
|
-
|
|
427
|
+
<div
|
|
428
|
+
style={{
|
|
429
|
+
display: 'flex',
|
|
430
|
+
alignItems: 'center',
|
|
431
|
+
justifyContent: 'space-between',
|
|
432
|
+
minWidth: 120,
|
|
433
|
+
// minHeight: 27,
|
|
434
|
+
// margin: '0 2rem',
|
|
435
|
+
}}
|
|
436
|
+
>
|
|
437
|
+
<div
|
|
438
|
+
style={{
|
|
439
|
+
display: 'flex',
|
|
440
|
+
alignItems: 'center',
|
|
441
|
+
justifyContent: 'space-between',
|
|
442
|
+
// margin: '0 0.5rem',
|
|
443
|
+
// minWidth: 120,
|
|
444
|
+
}}
|
|
445
|
+
>
|
|
425
446
|
<span
|
|
426
447
|
style={{
|
|
427
448
|
background: color,
|
|
428
449
|
borderWidth: 2,
|
|
429
450
|
borderStyle: 'solid',
|
|
430
451
|
borderColor: 'white',
|
|
452
|
+
height: '0.5rem',
|
|
453
|
+
width: '0.5rem',
|
|
454
|
+
boxShadow:
|
|
455
|
+
'0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)',
|
|
456
|
+
borderRadius: '9999px',
|
|
457
|
+
marginRight: 5,
|
|
431
458
|
}}
|
|
432
|
-
className={twMerge(
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
)}
|
|
459
|
+
// className={twMerge(
|
|
460
|
+
// 'shrink-0',
|
|
461
|
+
// 'bg-black',
|
|
462
|
+
// 'bg-white',
|
|
463
|
+
// 'border-black',
|
|
464
|
+
// sizing.sm.height,
|
|
465
|
+
// sizing.sm.width,
|
|
466
|
+
// 'qq-h-3',
|
|
467
|
+
// 'qq-w-3',
|
|
468
|
+
// 'qq-shadow',
|
|
469
|
+
// 'qq-rounded-full'
|
|
470
|
+
// border.md.all,
|
|
471
|
+
// boxShadow.md
|
|
472
|
+
// )}
|
|
446
473
|
/>
|
|
447
474
|
<p
|
|
448
475
|
// className={twMerge(
|
|
@@ -454,8 +481,12 @@ export const ChartTooltipRow = ({
|
|
|
454
481
|
marginBottom: 0,
|
|
455
482
|
fontFamily: theme?.fontFamily,
|
|
456
483
|
color: theme?.primaryTextColor,
|
|
484
|
+
paddingTop: 2,
|
|
485
|
+
paddingBottom: 2,
|
|
486
|
+
fontSize: theme?.fontSizeSmall || '0.875rem',
|
|
487
|
+
fontWeight: theme?.fontWeightMedium || '500',
|
|
457
488
|
}}
|
|
458
|
-
className="qq-font-medium qq-tabular-nums qq-text-right qq-whitespace-nowrap"
|
|
489
|
+
// className="qq-font-medium qq-tabular-nums qq-text-right qq-whitespace-nowrap"
|
|
459
490
|
>
|
|
460
491
|
{value}
|
|
461
492
|
</p>
|
|
@@ -466,13 +497,19 @@ export const ChartTooltipRow = ({
|
|
|
466
497
|
marginBottom: 0,
|
|
467
498
|
fontFamily: theme?.fontFamily,
|
|
468
499
|
color: theme?.secondaryTextColor,
|
|
500
|
+
whiteSpace: 'nowrap',
|
|
501
|
+
overflow: 'hidden',
|
|
502
|
+
textOverflow: 'ellipsis',
|
|
503
|
+
textAlign: 'right',
|
|
504
|
+
fontSize: theme?.fontSizeSmall || '0.875rem',
|
|
505
|
+
fontWeight: theme?.fontWeightNormal || '400',
|
|
469
506
|
}}
|
|
470
|
-
className={twMerge(
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
)}
|
|
507
|
+
// className={twMerge(
|
|
508
|
+
// 'qq-text-right qq-whitespace-nowrap'
|
|
509
|
+
// getColorClassNames(DEFAULT_COLOR, colorPalette.text).textColor,
|
|
510
|
+
// 'qq-text-gray-500'
|
|
511
|
+
// fontWeight.sm
|
|
512
|
+
// )}
|
|
476
513
|
>
|
|
477
514
|
{name}
|
|
478
515
|
</p>
|
|
@@ -498,7 +535,13 @@ export const DonutChartTooltip = ({
|
|
|
498
535
|
<ChartTooltipFrame theme={theme}>
|
|
499
536
|
<div
|
|
500
537
|
// style={{ transform: 'translateX(-120px)' }}
|
|
501
|
-
className={twMerge('qq-px-4', 'qq-py-2')}
|
|
538
|
+
// className={twMerge('qq-px-4', 'qq-py-2')}
|
|
539
|
+
style={{
|
|
540
|
+
paddingLeft: '1rem',
|
|
541
|
+
paddingRight: '1rem',
|
|
542
|
+
paddingTop: '0.5rem',
|
|
543
|
+
paddingBottom: '0.5rem',
|
|
544
|
+
}}
|
|
502
545
|
>
|
|
503
546
|
<ChartTooltipRow
|
|
504
547
|
value={valueFormatter(payloadRow.value)}
|
|
@@ -756,11 +799,19 @@ const PieChartWrapper = React.forwardRef<HTMLDivElement, DonutChartProps>(
|
|
|
756
799
|
return (
|
|
757
800
|
<div
|
|
758
801
|
ref={ref}
|
|
759
|
-
style={
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
802
|
+
style={{
|
|
803
|
+
...containerStyle,
|
|
804
|
+
width: '100%',
|
|
805
|
+
// height: '100%',
|
|
806
|
+
display: 'flex',
|
|
807
|
+
flexDirection: 'row',
|
|
808
|
+
alignItems: 'center',
|
|
809
|
+
boxSizing: 'content-box',
|
|
810
|
+
}}
|
|
811
|
+
// className={twMerge(
|
|
812
|
+
// 'w-full h-full flex flex-row items-center',
|
|
813
|
+
// className
|
|
814
|
+
// )}
|
|
764
815
|
{...other}
|
|
765
816
|
>
|
|
766
817
|
<ResponsiveContainer width="100%" height="100%">
|
|
@@ -826,7 +877,9 @@ const PieChartWrapper = React.forwardRef<HTMLDivElement, DonutChartProps>(
|
|
|
826
877
|
|
|
827
878
|
function Legend2({ payload, colors }: { payload: any; colors: string[] }) {
|
|
828
879
|
return (
|
|
829
|
-
<div
|
|
880
|
+
<div
|
|
881
|
+
// className="flex flex-col min-w-[130px] max-w-[130px] w-full"
|
|
882
|
+
>
|
|
830
883
|
{/* @ts-ignore */}
|
|
831
884
|
{payload.map((item, idx) => {
|
|
832
885
|
if (idx > 9) {
|
|
@@ -835,7 +888,7 @@ function Legend2({ payload, colors }: { payload: any; colors: string[] }) {
|
|
|
835
888
|
return (
|
|
836
889
|
<div
|
|
837
890
|
key={item.value}
|
|
838
|
-
className="flex flex-row items-center min-w-[130px] max-w-[130px]"
|
|
891
|
+
// className="flex flex-row items-center min-w-[130px] max-w-[130px]"
|
|
839
892
|
>
|
|
840
893
|
<div
|
|
841
894
|
style={{
|
|
@@ -855,7 +908,7 @@ function Legend2({ payload, colors }: { payload: any; colors: string[] }) {
|
|
|
855
908
|
display: 'block',
|
|
856
909
|
maxWidth: 120,
|
|
857
910
|
}}
|
|
858
|
-
className="qq-text-sm qq-text-gray-600 qq-whitespace-nowrap qq-overflow-hidden qq-overflow-ellipsis qq-text-sm qq-font-normal"
|
|
911
|
+
// className="qq-text-sm qq-text-gray-600 qq-whitespace-nowrap qq-overflow-hidden qq-overflow-ellipsis qq-text-sm qq-font-normal"
|
|
859
912
|
>
|
|
860
913
|
{item.value}
|
|
861
914
|
</div>
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/* eslint-disable react/display-name */
|
|
2
2
|
import React, { useRef, useState } from 'react';
|
|
3
|
-
import { twMerge } from 'tailwind-merge';
|
|
4
3
|
|
|
5
4
|
import { HoveredValueContext, SelectedValueContext } from '../../contexts';
|
|
6
5
|
|
|
@@ -8,29 +7,10 @@ import { useInternalState, useSelectOnKeyDown } from '../../hooks';
|
|
|
8
7
|
|
|
9
8
|
import { ArrowDownHeadIcon } from '../../assets';
|
|
10
9
|
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
border,
|
|
14
|
-
borderRadius,
|
|
15
|
-
boxShadow,
|
|
16
|
-
fontSize,
|
|
17
|
-
fontWeight,
|
|
18
|
-
getColorClassNames,
|
|
19
|
-
makeClassName,
|
|
20
|
-
mergeRefs,
|
|
21
|
-
sizing,
|
|
22
|
-
spacing,
|
|
23
|
-
} from '../../lib';
|
|
24
|
-
import {
|
|
25
|
-
constructValueToNameMapping,
|
|
26
|
-
getSelectButtonColors,
|
|
27
|
-
hasValue,
|
|
28
|
-
} from '../selectUtils';
|
|
10
|
+
import { mergeRefs } from '../../lib';
|
|
11
|
+
import { constructValueToNameMapping, hasValue } from '../selectUtils';
|
|
29
12
|
import { DropdownItemProps } from './DropdownItem';
|
|
30
13
|
import Modal from '../Modal';
|
|
31
|
-
import { DEFAULT_COLOR, colorPalette } from '../../lib/theme';
|
|
32
|
-
|
|
33
|
-
const makeDropdownClassName = makeClassName('Dropdown');
|
|
34
14
|
|
|
35
15
|
export interface DropdownProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
36
16
|
value?: string;
|
|
@@ -92,60 +72,62 @@ const Dropdown = React.forwardRef<HTMLDivElement, DropdownProps>(
|
|
|
92
72
|
<div
|
|
93
73
|
ref={mergeRefs([dropdownRef, ref])}
|
|
94
74
|
onKeyDown={handleKeyDown}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
75
|
+
style={{
|
|
76
|
+
position: 'relative',
|
|
77
|
+
width: '100%',
|
|
78
|
+
minWidth: '10rem',
|
|
79
|
+
}}
|
|
100
80
|
{...other}
|
|
101
81
|
>
|
|
102
82
|
<button
|
|
103
83
|
style={{
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
84
|
+
display: 'flex',
|
|
85
|
+
justifyContent: 'space-between',
|
|
86
|
+
alignItems: 'center',
|
|
87
|
+
width: '100%',
|
|
88
|
+
outline: 'none',
|
|
89
|
+
padding: '1.5rem 2rem',
|
|
90
|
+
borderRadius: '0.375rem',
|
|
91
|
+
border: '2px solid',
|
|
92
|
+
boxShadow: '0 1px 2px 0 rgba(0, 0, 0, 0.05)',
|
|
93
|
+
cursor: 'pointer',
|
|
107
94
|
background: 'white',
|
|
108
95
|
}}
|
|
109
96
|
type="button"
|
|
110
|
-
className={twMerge(
|
|
111
|
-
makeDropdownClassName('button'),
|
|
112
|
-
'qq-flex qq-justify-between qq-items-center qq-w-full focus:qq-outline-none focus:qq-ring-2',
|
|
113
|
-
getSelectButtonColors(hasSelection, disabled),
|
|
114
|
-
getColorClassNames(BaseColors.Blue, colorPalette.lightRing)
|
|
115
|
-
.focusRingColor,
|
|
116
|
-
Icon ? spacing.xl.paddingLeft : spacing.twoXl.paddingLeft,
|
|
117
|
-
spacing.twoXl.paddingRight,
|
|
118
|
-
spacing.sm.paddingY,
|
|
119
|
-
borderRadius.md.all,
|
|
120
|
-
border.sm.all,
|
|
121
|
-
boxShadow.sm
|
|
122
|
-
)}
|
|
123
97
|
onClick={() => setIsFocused(!isFocused)}
|
|
124
98
|
disabled={disabled}
|
|
125
99
|
>
|
|
126
|
-
<div
|
|
100
|
+
<div
|
|
101
|
+
style={{
|
|
102
|
+
display: 'flex',
|
|
103
|
+
justifyContent: 'start',
|
|
104
|
+
alignItems: 'center',
|
|
105
|
+
whiteSpace: 'nowrap',
|
|
106
|
+
overflow: 'hidden',
|
|
107
|
+
textOverflow: 'ellipsis',
|
|
108
|
+
}}
|
|
109
|
+
>
|
|
127
110
|
{Icon ? (
|
|
128
111
|
<Icon
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
'
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
spacing.lg.marginRight
|
|
137
|
-
)}
|
|
112
|
+
style={{
|
|
113
|
+
flexShrink: 0,
|
|
114
|
+
height: '1.5rem',
|
|
115
|
+
width: '1.5rem',
|
|
116
|
+
color: theme?.secondaryTextColor || '#6C727F',
|
|
117
|
+
marginRight: '1.5rem',
|
|
118
|
+
}}
|
|
138
119
|
aria-hidden="true"
|
|
139
120
|
/>
|
|
140
121
|
) : null}
|
|
141
122
|
<p
|
|
142
|
-
style={{
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
123
|
+
style={{
|
|
124
|
+
margin: 0,
|
|
125
|
+
fontSize: '0.875rem',
|
|
126
|
+
fontWeight: '500',
|
|
127
|
+
whiteSpace: 'nowrap',
|
|
128
|
+
overflow: 'hidden',
|
|
129
|
+
textOverflow: 'ellipsis',
|
|
130
|
+
}}
|
|
149
131
|
>
|
|
150
132
|
{selectedValue
|
|
151
133
|
? valueToNameMapping.get(selectedValue)
|
|
@@ -153,19 +135,18 @@ const Dropdown = React.forwardRef<HTMLDivElement, DropdownProps>(
|
|
|
153
135
|
</p>
|
|
154
136
|
</div>
|
|
155
137
|
<ArrowDownHeadIcon
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
'
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
.textColor
|
|
164
|
-
)}
|
|
138
|
+
style={{
|
|
139
|
+
flexShrink: 0,
|
|
140
|
+
height: '1.5rem',
|
|
141
|
+
width: '1.5rem',
|
|
142
|
+
marginRight: '-0.25rem',
|
|
143
|
+
color: theme?.secondaryTextColor || '#6C727F',
|
|
144
|
+
}}
|
|
165
145
|
aria-hidden="true"
|
|
166
146
|
/>
|
|
167
147
|
</button>
|
|
168
148
|
<Modal
|
|
149
|
+
theme={theme}
|
|
169
150
|
showModal={isFocused}
|
|
170
151
|
setShowModal={setIsFocused}
|
|
171
152
|
parentRef={dropdownRef}
|
|
@@ -1,97 +1,62 @@
|
|
|
1
1
|
/* eslint-disable react/display-name */
|
|
2
2
|
import React, { useContext } from 'react';
|
|
3
|
-
import { twMerge } from 'tailwind-merge';
|
|
4
3
|
|
|
5
4
|
import { HoveredValueContext, SelectedValueContext } from '../../contexts';
|
|
6
5
|
|
|
7
|
-
import { fontSize } from '../../lib/font';
|
|
8
|
-
import { sizing } from '../../lib/sizing';
|
|
9
|
-
import { spacing } from '../../lib/spacing';
|
|
10
|
-
|
|
11
|
-
import { getColorClassNames, makeClassName } from '../../lib';
|
|
12
|
-
import { DEFAULT_COLOR, colorPalette } from '../../lib/theme';
|
|
13
|
-
|
|
14
|
-
const makeDropdownItemClassName = makeClassName('DropdownItem');
|
|
15
|
-
|
|
16
6
|
export interface DropdownItemProps
|
|
17
7
|
extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
18
8
|
value: string;
|
|
19
9
|
text?: string;
|
|
20
10
|
icon?: React.ElementType;
|
|
21
11
|
theme: any;
|
|
12
|
+
lastItem?: boolean;
|
|
22
13
|
}
|
|
23
14
|
|
|
24
15
|
const DropdownItem = React.forwardRef<HTMLButtonElement, DropdownItemProps>(
|
|
25
16
|
(props, ref) => {
|
|
26
|
-
const { value, text, icon, className, theme, ...other } = props;
|
|
17
|
+
const { value, text, icon, className, theme, lastItem, ...other } = props;
|
|
27
18
|
const { selectedValue, handleValueChange } =
|
|
28
19
|
useContext(SelectedValueContext);
|
|
29
20
|
const { hoveredValue } = useContext(HoveredValueContext);
|
|
30
21
|
const isActive = selectedValue === value;
|
|
31
22
|
const isHovered = hoveredValue === value;
|
|
32
|
-
const bgColor = isActive
|
|
33
|
-
? getColorClassNames(DEFAULT_COLOR, colorPalette.lightBackground).bgColor
|
|
34
|
-
: isHovered
|
|
35
|
-
? getColorClassNames(DEFAULT_COLOR, colorPalette.canvasBackground).bgColor
|
|
36
|
-
: getColorClassNames(DEFAULT_COLOR, colorPalette.canvasBackground)
|
|
37
|
-
.hoverBgColor;
|
|
38
|
-
const textColor = isActive
|
|
39
|
-
? getColorClassNames(DEFAULT_COLOR, colorPalette.darkestText).textColor
|
|
40
|
-
: getColorClassNames(DEFAULT_COLOR, colorPalette.darkText).textColor;
|
|
41
23
|
|
|
42
24
|
const Icon = icon ? icon : null;
|
|
43
25
|
return (
|
|
44
26
|
<button
|
|
45
27
|
ref={ref}
|
|
46
28
|
style={{
|
|
47
|
-
|
|
29
|
+
display: 'flex',
|
|
30
|
+
alignItems: 'center',
|
|
31
|
+
justifyContent: 'start',
|
|
32
|
+
width: '100%',
|
|
33
|
+
overflow: 'hidden',
|
|
34
|
+
textOverflow: 'ellipsis',
|
|
35
|
+
padding: '0.75rem 2rem',
|
|
36
|
+
fontSize: '0.875rem',
|
|
48
37
|
borderStyle: 'solid',
|
|
49
|
-
borderBottomWidth:
|
|
38
|
+
borderBottomWidth: lastItem ? '0px' : '1px',
|
|
50
39
|
borderBottomColor: theme?.borderColor || '#E5E7EB',
|
|
51
40
|
background: theme?.backgroundColor || 'white',
|
|
52
41
|
borderTop: 'none',
|
|
53
42
|
borderRight: 'none',
|
|
54
43
|
borderLeft: 'none',
|
|
55
44
|
cursor: 'pointer',
|
|
45
|
+
color: theme?.primaryTextColor || '#364153',
|
|
56
46
|
}}
|
|
57
47
|
type="button"
|
|
58
48
|
onClick={() => handleValueChange?.(value)}
|
|
59
|
-
className={twMerge(
|
|
60
|
-
makeDropdownItemClassName('root'),
|
|
61
|
-
'qq-flex qq-items-center qq-justify-start qq-w-full qq-truncate',
|
|
62
|
-
spacing.twoXl.paddingX,
|
|
63
|
-
spacing.md.paddingY,
|
|
64
|
-
fontSize.sm,
|
|
65
|
-
// bgColor,
|
|
66
|
-
textColor,
|
|
67
|
-
className
|
|
68
|
-
)}
|
|
69
49
|
{...other}
|
|
70
50
|
>
|
|
71
|
-
{Icon ? (
|
|
72
|
-
<Icon
|
|
73
|
-
className={twMerge(
|
|
74
|
-
makeDropdownItemClassName('icon'),
|
|
75
|
-
'qq-flex-none',
|
|
76
|
-
sizing.lg.height,
|
|
77
|
-
sizing.lg.width,
|
|
78
|
-
spacing.lg.marginRight,
|
|
79
|
-
getColorClassNames(DEFAULT_COLOR, colorPalette.lightText)
|
|
80
|
-
.textColor
|
|
81
|
-
)}
|
|
82
|
-
aria-hidden="true"
|
|
83
|
-
/>
|
|
84
|
-
) : null}
|
|
85
51
|
<p
|
|
86
52
|
style={{
|
|
87
53
|
margin: 0,
|
|
88
54
|
fontFamily: theme?.fontFamily,
|
|
89
55
|
color: theme?.primaryTextColor,
|
|
56
|
+
whiteSpace: 'nowrap',
|
|
57
|
+
overflow: 'hidden',
|
|
58
|
+
textOverflow: 'ellipsis',
|
|
90
59
|
}}
|
|
91
|
-
className={twMerge(
|
|
92
|
-
makeDropdownItemClassName('text'),
|
|
93
|
-
'qq-text-sm qq-whitespace-nowrap qq-truncate'
|
|
94
|
-
)}
|
|
95
60
|
>
|
|
96
61
|
{text ?? value}
|
|
97
62
|
</p>
|
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
/* eslint-disable react/display-name */
|
|
2
2
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
3
|
-
import { twMerge } from 'tailwind-merge';
|
|
4
3
|
|
|
5
4
|
import { useOnClickOutside, useOnWindowResize } from '../../hooks';
|
|
6
5
|
|
|
7
6
|
import { HorizontalPosition } from '../../lib/inputTypes';
|
|
8
|
-
import {
|
|
9
|
-
border,
|
|
10
|
-
borderRadius,
|
|
11
|
-
boxShadow,
|
|
12
|
-
getColorClassNames,
|
|
13
|
-
mergeRefs,
|
|
14
|
-
spacing,
|
|
15
|
-
} from '../../lib';
|
|
16
|
-
import { DEFAULT_COLOR, colorPalette } from '../../lib/theme';
|
|
7
|
+
import { mergeRefs } from '../../lib';
|
|
17
8
|
|
|
18
9
|
export interface ModalProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
19
10
|
showModal: boolean;
|
|
@@ -25,6 +16,7 @@ export interface ModalProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
25
16
|
maxHeight?: string;
|
|
26
17
|
anchorPosition?: HorizontalPosition;
|
|
27
18
|
children: React.ReactNode;
|
|
19
|
+
theme: any;
|
|
28
20
|
}
|
|
29
21
|
|
|
30
22
|
const Modal = React.forwardRef<HTMLDivElement, ModalProps>((props, ref) => {
|
|
@@ -33,9 +25,10 @@ const Modal = React.forwardRef<HTMLDivElement, ModalProps>((props, ref) => {
|
|
|
33
25
|
setShowModal,
|
|
34
26
|
parentRef,
|
|
35
27
|
width,
|
|
36
|
-
maxHeight = '
|
|
28
|
+
maxHeight = '18rem',
|
|
37
29
|
children,
|
|
38
30
|
className,
|
|
31
|
+
theme,
|
|
39
32
|
...other
|
|
40
33
|
} = props;
|
|
41
34
|
const [modalExceedsWindow, setModalExceedsWindow] = useState(false);
|
|
@@ -55,10 +48,7 @@ const Modal = React.forwardRef<HTMLDivElement, ModalProps>((props, ref) => {
|
|
|
55
48
|
);
|
|
56
49
|
|
|
57
50
|
const getAbsoluteSpacing = () => {
|
|
58
|
-
|
|
59
|
-
return spacing.none.left;
|
|
60
|
-
}
|
|
61
|
-
return spacing.none.right;
|
|
51
|
+
return modalExceedsWindow ? '0' : '0';
|
|
62
52
|
};
|
|
63
53
|
|
|
64
54
|
useOnClickOutside(modalRef, e => {
|
|
@@ -87,22 +77,51 @@ const Modal = React.forwardRef<HTMLDivElement, ModalProps>((props, ref) => {
|
|
|
87
77
|
return showModal ? (
|
|
88
78
|
<div
|
|
89
79
|
ref={mergeRefs([modalRef, ref])}
|
|
90
|
-
|
|
91
|
-
'
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
80
|
+
style={{
|
|
81
|
+
position: 'absolute',
|
|
82
|
+
zIndex: 10,
|
|
83
|
+
overflowY: 'auto',
|
|
84
|
+
width: width ? width : '100%',
|
|
85
|
+
left: getAbsoluteSpacing(),
|
|
86
|
+
right: getAbsoluteSpacing(),
|
|
87
|
+
maxHeight: maxHeight,
|
|
88
|
+
backgroundColor: theme?.backgroundColor || 'white',
|
|
89
|
+
borderColor: theme?.borderColor || '#E5E7EB',
|
|
90
|
+
// borderTopColor: getColorClassNames(
|
|
91
|
+
// DEFAULT_COLOR,
|
|
92
|
+
// colorPalette.lightBorder
|
|
93
|
+
// ).borderColor,
|
|
94
|
+
// borderBottomColor: getColorClassNames(
|
|
95
|
+
// DEFAULT_COLOR,
|
|
96
|
+
// colorPalette.lightBorder
|
|
97
|
+
// ).borderColor,
|
|
98
|
+
// borderLeftColor: getColorClassNames(
|
|
99
|
+
// DEFAULT_COLOR,
|
|
100
|
+
// colorPalette.lightBorder
|
|
101
|
+
// ).borderColor,
|
|
102
|
+
// borderRightColor: getColorClassNames(
|
|
103
|
+
// DEFAULT_COLOR,
|
|
104
|
+
// colorPalette.lightBorder
|
|
105
|
+
// ).borderColor,
|
|
106
|
+
borderTopStyle: 'solid',
|
|
107
|
+
borderBottomStyle: 'solid',
|
|
108
|
+
borderLeftStyle: 'solid',
|
|
109
|
+
borderRightStyle: 'solid',
|
|
110
|
+
borderTopWidth: 1,
|
|
111
|
+
borderBottomWidth: 1,
|
|
112
|
+
borderLeftWidth: 1,
|
|
113
|
+
borderRightWidth: 1,
|
|
114
|
+
marginTop: '0.5rem',
|
|
115
|
+
marginBottom: '0.5rem',
|
|
116
|
+
borderRadius: '0.375rem',
|
|
117
|
+
boxShadow:
|
|
118
|
+
'0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)',
|
|
119
|
+
// boxShadow: '0 1px 3px 0 #0000001A, 0 1px 2px 0 #0000000F',
|
|
120
|
+
// borderTopWidth: '2px',
|
|
121
|
+
// borderBottomWidth: '2px',
|
|
122
|
+
// borderLeftWidth: '2px',
|
|
123
|
+
// borderRightWidth: '2px',
|
|
124
|
+
}}
|
|
106
125
|
{...other}
|
|
107
126
|
>
|
|
108
127
|
{children}
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
getColorClassNames,
|
|
8
8
|
} from '../lib';
|
|
9
9
|
import React from 'react';
|
|
10
|
-
import { twMerge } from 'tailwind-merge';
|
|
10
|
+
// import { twMerge } from 'tailwind-merge';
|
|
11
11
|
|
|
12
12
|
export interface SelectItemProps {
|
|
13
13
|
value: string;
|
|
@@ -44,23 +44,24 @@ export const getSelectButtonColors = (
|
|
|
44
44
|
isDisabled: boolean,
|
|
45
45
|
hasError = false
|
|
46
46
|
) => {
|
|
47
|
-
return
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
)
|
|
47
|
+
return null;
|
|
48
|
+
// return twMerge(
|
|
49
|
+
// isDisabled
|
|
50
|
+
// ? getColorClassNames(DEFAULT_COLOR, colorPalette.canvasBackground).bgColor
|
|
51
|
+
// : getColorClassNames(WHITE, colorPalette.background).bgColor,
|
|
52
|
+
// !isDisabled &&
|
|
53
|
+
// getColorClassNames(DEFAULT_COLOR, colorPalette.canvasBackground)
|
|
54
|
+
// .hoverBgColor,
|
|
55
|
+
// hasSelection
|
|
56
|
+
// ? getColorClassNames(DEFAULT_COLOR, colorPalette.darkText).textColor
|
|
57
|
+
// : getColorClassNames(DEFAULT_COLOR, colorPalette.text).textColor,
|
|
58
|
+
// isDisabled &&
|
|
59
|
+
// getColorClassNames(DEFAULT_COLOR, colorPalette.lightText).textColor,
|
|
60
|
+
// hasError && colorClassNames[BaseColors.Rose][colorPalette.text].textColor,
|
|
61
|
+
// hasError
|
|
62
|
+
// ? colorClassNames[BaseColors.Rose][colorPalette.ring].borderColor
|
|
63
|
+
// : getColorClassNames(DEFAULT_COLOR, colorPalette.ring).borderColor
|
|
64
|
+
// );
|
|
64
65
|
};
|
|
65
66
|
|
|
66
67
|
export const hasValue = (value: string | null | undefined) =>
|
package/src/styles.css
CHANGED