@quillsql/react 1.1.1 → 1.1.3
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/src/App.tsx +2 -3
- package/lib/BarList.js +19 -16
- package/lib/BarList.js.map +1 -1
- package/lib/Chart.d.ts +4 -2
- package/lib/Chart.js +65 -27
- package/lib/Chart.js.map +1 -1
- package/lib/Dashboard.js +13 -10
- package/lib/Dashboard.js.map +1 -1
- package/lib/DateRangePicker/Calendar.d.ts +2 -1
- package/lib/DateRangePicker/Calendar.js +31 -11
- package/lib/DateRangePicker/Calendar.js.map +1 -1
- package/lib/DateRangePicker/DateRangePicker.d.ts +1 -0
- package/lib/DateRangePicker/DateRangePicker.js +4 -4
- package/lib/DateRangePicker/DateRangePicker.js.map +1 -1
- package/lib/DateRangePicker/DateRangePickerButton.d.ts +2 -1
- package/lib/DateRangePicker/DateRangePickerButton.js +22 -4
- package/lib/DateRangePicker/DateRangePickerButton.js.map +1 -1
- package/lib/PieChart.js +14 -9
- package/lib/PieChart.js.map +1 -1
- package/lib/components/Dropdown/Dropdown.d.ts +1 -0
- package/lib/components/Dropdown/Dropdown.js +10 -5
- package/lib/components/Dropdown/Dropdown.js.map +1 -1
- package/lib/components/Dropdown/DropdownItem.d.ts +1 -0
- package/lib/components/Dropdown/DropdownItem.js +19 -3
- package/lib/components/Dropdown/DropdownItem.js.map +1 -1
- package/lib/components/Modal/Modal.js +1 -1
- package/lib/components/Modal/Modal.js.map +1 -1
- package/lib/lib/colorClassNames.js +3094 -3094
- package/lib/lib/colorClassNames.js.map +1 -1
- package/lib/lib/constants.d.ts +1 -1
- package/lib/lib/constants.js +36 -36
- package/lib/lib/constants.js.map +1 -1
- package/lib/lib/font.js +9 -9
- package/lib/lib/font.js.map +1 -1
- package/lib/lib/hexColors.js +25 -25
- package/lib/lib/index.d.ts +10 -10
- package/lib/lib/index.js +10 -10
- package/lib/lib/inputTypes.d.ts +4 -4
- package/lib/lib/inputTypes.js +50 -31
- package/lib/lib/inputTypes.js.map +1 -1
- package/lib/lib/shape.js +49 -49
- package/lib/lib/shape.js.map +1 -1
- package/lib/lib/sizing.js +20 -20
- package/lib/lib/sizing.js.map +1 -1
- package/lib/lib/spacing.js +238 -238
- package/lib/lib/spacing.js.map +1 -1
- package/lib/styles.css +12915 -9139
- package/package.json +4 -2
- package/prefix-classnames.js +50 -0
- package/src/BarList.tsx +71 -45
- package/src/Chart.tsx +97 -34
- package/src/Dashboard.tsx +14 -10
- package/src/DateRangePicker/Calendar.tsx +49 -16
- package/src/DateRangePicker/DateRangePicker.tsx +12 -3
- package/src/DateRangePicker/DateRangePickerButton.tsx +31 -7
- package/src/PieChart.tsx +22 -14
- package/src/components/Dropdown/Dropdown.tsx +15 -6
- package/src/components/Dropdown/DropdownItem.tsx +22 -5
- package/src/components/Modal/Modal.tsx +2 -2
- package/src/lib/colorClassNames.ts +3094 -3094
- package/src/lib/constants.ts +43 -37
- package/src/lib/font.ts +9 -9
- package/src/lib/hexColors.ts +25 -25
- package/src/lib/index.ts +10 -10
- package/src/lib/inputTypes.ts +54 -35
- package/src/lib/shape.ts +49 -49
- package/src/lib/sizing.ts +20 -20
- package/src/lib/spacing.ts +238 -238
- package/tailwind.config.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quillsql/react",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"access": "public",
|
|
5
5
|
"description": "Quill React components for building dashboards and reporting.",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"lint:fix": "eslint --fix 'src/**/*.{ts,tsx}'",
|
|
12
12
|
"prettier": "prettier --check 'src/**/*.{ts,tsx}'",
|
|
13
13
|
"prettier:fix": "prettier --write 'src/**/*.{ts,tsx}'",
|
|
14
|
-
"build:css": "postcss src/styles.css -o lib/styles.css"
|
|
14
|
+
"build:css": "postcss src/styles.css -o lib/styles.css",
|
|
15
|
+
"prefix-classnames": "node ./prefix-classnames.js"
|
|
15
16
|
},
|
|
16
17
|
"keywords": [],
|
|
17
18
|
"author": "",
|
|
@@ -41,6 +42,7 @@
|
|
|
41
42
|
"eslint-config-prettier": "^8.8.0",
|
|
42
43
|
"eslint-plugin-prettier": "^4.2.1",
|
|
43
44
|
"eslint-plugin-react": "^7.32.2",
|
|
45
|
+
"glob": "^10.2.2",
|
|
44
46
|
"postcss": "^8.4.21",
|
|
45
47
|
"postcss-cli": "^10.1.0",
|
|
46
48
|
"prettier": "^2.8.7"
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const { glob } = require('glob');
|
|
4
|
+
|
|
5
|
+
const rootDir = path.resolve(__dirname);
|
|
6
|
+
const classNameRegex = /className=["']([\w\s-]+)["']/g;
|
|
7
|
+
|
|
8
|
+
console.log('Root directory:', rootDir);
|
|
9
|
+
|
|
10
|
+
try {
|
|
11
|
+
const files = glob.sync('**/*.{js,jsx,tsx}', {
|
|
12
|
+
cwd: rootDir,
|
|
13
|
+
ignore: '**/node_modules/**',
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
console.log('Files found:', files);
|
|
17
|
+
|
|
18
|
+
files.forEach(file => {
|
|
19
|
+
console.log('Processing file:', file);
|
|
20
|
+
const filePath = path.join(rootDir, file);
|
|
21
|
+
fs.readFile(filePath, 'utf-8', (err, data) => {
|
|
22
|
+
if (err) {
|
|
23
|
+
console.error('Error reading file:', err);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const result = data.replace(classNameRegex, (match, p1) => {
|
|
28
|
+
const classNames = p1.split(' ');
|
|
29
|
+
const prefixedClassNames = classNames.map(className => {
|
|
30
|
+
if (className.startsWith('qq-')) {
|
|
31
|
+
return className;
|
|
32
|
+
} else {
|
|
33
|
+
return `qq-${className}`;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
return `className="${prefixedClassNames.join(' ')}"`;
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
fs.writeFile(filePath, result, 'utf-8', err => {
|
|
40
|
+
if (err) {
|
|
41
|
+
console.error('Error writing file:', err);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
console.log('File updated successfully:', filePath);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
} catch (error) {
|
|
49
|
+
console.error('Error in glob.sync():', error);
|
|
50
|
+
}
|
package/src/BarList.tsx
CHANGED
|
@@ -138,6 +138,7 @@ const BarList = React.forwardRef<HTMLDivElement, BarListProps>((props, ref) => {
|
|
|
138
138
|
ref={ref}
|
|
139
139
|
style={{
|
|
140
140
|
width: '100%',
|
|
141
|
+
height: '100%',
|
|
141
142
|
marginLeft: 25,
|
|
142
143
|
// background: 'red',
|
|
143
144
|
marginTop: 20,
|
|
@@ -146,16 +147,16 @@ const BarList = React.forwardRef<HTMLDivElement, BarListProps>((props, ref) => {
|
|
|
146
147
|
}}
|
|
147
148
|
className={twMerge(
|
|
148
149
|
// makeBarListClassName('root'),
|
|
149
|
-
'flex justify-between',
|
|
150
|
-
'space-x-6',
|
|
150
|
+
'qq-flex qq-justify-between',
|
|
151
|
+
'qq-space-x-6',
|
|
151
152
|
className
|
|
152
153
|
)}
|
|
153
154
|
{...other}
|
|
154
155
|
>
|
|
155
156
|
<div
|
|
156
157
|
// className={twMerge(makeBarListClassName('bars'), 'relative w-full')}
|
|
157
|
-
className="relative-w-full
|
|
158
|
-
style={{ width: '100%' }}
|
|
158
|
+
className="qq-relative-w-full"
|
|
159
|
+
style={{ width: '100%', height: '100%' }}
|
|
159
160
|
>
|
|
160
161
|
{data.slice(0, Math.floor(NUM_TO_SHOW / 2)).map((item, idx) => {
|
|
161
162
|
// const Icon = item.icon;
|
|
@@ -163,7 +164,7 @@ const BarList = React.forwardRef<HTMLDivElement, BarListProps>((props, ref) => {
|
|
|
163
164
|
|
|
164
165
|
return (
|
|
165
166
|
<div
|
|
166
|
-
className="flex flex-row items-center"
|
|
167
|
+
className="qq-flex qq-flex-row qq-items-center"
|
|
167
168
|
key={item[xAxisField] + idx}
|
|
168
169
|
>
|
|
169
170
|
<div
|
|
@@ -173,17 +174,20 @@ const BarList = React.forwardRef<HTMLDivElement, BarListProps>((props, ref) => {
|
|
|
173
174
|
<p
|
|
174
175
|
className={twMerge(
|
|
175
176
|
// makeBarListClassName('barText'),
|
|
176
|
-
'whitespace-nowrap truncate',
|
|
177
|
-
'text-gray-500',
|
|
178
|
-
'text-sm'
|
|
177
|
+
'qq-whitespace-nowrap truncate',
|
|
178
|
+
'qq-text-gray-500',
|
|
179
|
+
'qq-text-sm'
|
|
179
180
|
)}
|
|
180
181
|
>
|
|
181
182
|
{item[xAxisField]}
|
|
182
183
|
</p>
|
|
183
184
|
</div>
|
|
184
|
-
<div
|
|
185
|
+
<div
|
|
186
|
+
style={{ width: '100%', height: '100%' }}
|
|
187
|
+
className="qq-flex qq-flex-col"
|
|
188
|
+
>
|
|
185
189
|
<div
|
|
186
|
-
className={`flex items-center h-9 rounded mb-2`}
|
|
190
|
+
className={`qq-flex qq-items-center qq-h-9 qq-rounded qq-mb-2`}
|
|
187
191
|
style={{
|
|
188
192
|
width: `${widths[idx]}%`,
|
|
189
193
|
transition: showAnimation ? 'all 2s' : '',
|
|
@@ -191,14 +195,17 @@ const BarList = React.forwardRef<HTMLDivElement, BarListProps>((props, ref) => {
|
|
|
191
195
|
}}
|
|
192
196
|
>
|
|
193
197
|
<div
|
|
194
|
-
className={twMerge(
|
|
198
|
+
className={twMerge(
|
|
199
|
+
'qq-absolute qq-max-w-full qq-flex',
|
|
200
|
+
'qq-ml-2'
|
|
201
|
+
)}
|
|
195
202
|
>
|
|
196
203
|
<p
|
|
197
204
|
className={twMerge(
|
|
198
205
|
// makeBarListClassName('barText'),
|
|
199
|
-
'whitespace-nowrap truncate',
|
|
200
|
-
'text-gray-500',
|
|
201
|
-
'text-sm'
|
|
206
|
+
'qq-whitespace-nowrap truncate',
|
|
207
|
+
'qq-text-gray-500',
|
|
208
|
+
'qq-text-sm'
|
|
202
209
|
)}
|
|
203
210
|
>
|
|
204
211
|
{yAxisFields[0].label}
|
|
@@ -206,7 +213,7 @@ const BarList = React.forwardRef<HTMLDivElement, BarListProps>((props, ref) => {
|
|
|
206
213
|
</div>
|
|
207
214
|
</div>
|
|
208
215
|
<div
|
|
209
|
-
className={`flex items-center h-9 rounded mb-2`}
|
|
216
|
+
className={`qq-flex qq-items-center qq-h-9 qq-rounded qq-mb-2`}
|
|
210
217
|
style={{
|
|
211
218
|
width: `${widths2[idx]}%`,
|
|
212
219
|
transition: showAnimation ? 'all 2s' : '',
|
|
@@ -214,14 +221,17 @@ const BarList = React.forwardRef<HTMLDivElement, BarListProps>((props, ref) => {
|
|
|
214
221
|
}}
|
|
215
222
|
>
|
|
216
223
|
<div
|
|
217
|
-
className={twMerge(
|
|
224
|
+
className={twMerge(
|
|
225
|
+
'qq-absolute qq-max-w-full qq-flex',
|
|
226
|
+
'qq-ml-2'
|
|
227
|
+
)}
|
|
218
228
|
>
|
|
219
229
|
<p
|
|
220
230
|
className={twMerge(
|
|
221
231
|
// makeBarListClassName('barText'),
|
|
222
|
-
'whitespace-nowrap truncate',
|
|
223
|
-
'text-gray-500',
|
|
224
|
-
'text-sm'
|
|
232
|
+
'qq-whitespace-nowrap truncate',
|
|
233
|
+
'qq-text-gray-500',
|
|
234
|
+
'qq-text-sm'
|
|
225
235
|
)}
|
|
226
236
|
>
|
|
227
237
|
{yAxisFields[1].label}
|
|
@@ -234,31 +244,36 @@ const BarList = React.forwardRef<HTMLDivElement, BarListProps>((props, ref) => {
|
|
|
234
244
|
);
|
|
235
245
|
})}
|
|
236
246
|
{data.length > NUM_TO_SHOW && (
|
|
237
|
-
<div
|
|
247
|
+
<div
|
|
248
|
+
style={{ color: theme.chartLabelColor }}
|
|
249
|
+
className="qq-text-sm"
|
|
250
|
+
>
|
|
238
251
|
...{data.length - NUM_TO_SHOW} more
|
|
239
252
|
</div>
|
|
240
253
|
)}
|
|
241
254
|
</div>
|
|
242
255
|
{/* eslint-disable prettier/prettier */}
|
|
243
256
|
<div
|
|
244
|
-
className={
|
|
257
|
+
className={
|
|
258
|
+
(makeBarListClassName('labels'), 'qq-text-right qq-min-w-min')
|
|
259
|
+
}
|
|
245
260
|
>
|
|
246
261
|
{data.slice(0, NUM_TO_SHOW).map((item, idx) => (
|
|
247
262
|
<div
|
|
248
263
|
key={item[xAxisField] + 'label' + idx}
|
|
249
264
|
className={twMerge(
|
|
250
265
|
makeBarListClassName('labelWrapper'),
|
|
251
|
-
'flex justify-end items-center',
|
|
252
|
-
'h-9',
|
|
253
|
-
idx === data.length - 1 ? 'mb-0' : 'mb-2'
|
|
266
|
+
'qq-flex qq-justify-end qq-items-center',
|
|
267
|
+
'qq-h-9',
|
|
268
|
+
idx === data.length - 1 ? 'qq-mb-0' : 'qq-mb-2'
|
|
254
269
|
)}
|
|
255
270
|
>
|
|
256
271
|
<p
|
|
257
272
|
className={twMerge(
|
|
258
273
|
makeBarListClassName('labelText'),
|
|
259
|
-
'whitespace-nowrap truncate',
|
|
260
|
-
'text-gray-500',
|
|
261
|
-
'text-sm'
|
|
274
|
+
'qq-whitespace-nowrap truncate',
|
|
275
|
+
'qq-text-gray-500',
|
|
276
|
+
'qq-text-sm'
|
|
262
277
|
)}
|
|
263
278
|
>
|
|
264
279
|
{valueFormatter(item[yAxisFields[0].field])}
|
|
@@ -275,7 +290,9 @@ const BarList = React.forwardRef<HTMLDivElement, BarListProps>((props, ref) => {
|
|
|
275
290
|
ref={ref}
|
|
276
291
|
style={{
|
|
277
292
|
width: '100%',
|
|
278
|
-
|
|
293
|
+
height: '100%',
|
|
294
|
+
// height: hei
|
|
295
|
+
// marginLeft: 25,
|
|
279
296
|
// background: 'red',
|
|
280
297
|
marginTop: 20,
|
|
281
298
|
paddingRight: 25,
|
|
@@ -283,16 +300,16 @@ const BarList = React.forwardRef<HTMLDivElement, BarListProps>((props, ref) => {
|
|
|
283
300
|
}}
|
|
284
301
|
className={twMerge(
|
|
285
302
|
// makeBarListClassName('root'),
|
|
286
|
-
'flex justify-between',
|
|
287
|
-
'space-x-6',
|
|
303
|
+
'qq-flex qq-justify-between qq-h-full qq-w-full',
|
|
304
|
+
'qq-space-x-6',
|
|
288
305
|
className
|
|
289
306
|
)}
|
|
290
307
|
{...other}
|
|
291
308
|
>
|
|
292
309
|
<div
|
|
293
310
|
// className={twMerge(makeBarListClassName('bars'), 'relative w-full')}
|
|
294
|
-
className="relative-w-full
|
|
295
|
-
style={{ width: '100%' }}
|
|
311
|
+
className="qq-relative-w-full"
|
|
312
|
+
style={{ width: 'calc(100%)', height: '100%', paddingLeft: 25 }}
|
|
296
313
|
>
|
|
297
314
|
{data.slice(0, NUM_TO_SHOW).map((item, idx) => {
|
|
298
315
|
// const Icon = item.icon;
|
|
@@ -301,20 +318,25 @@ const BarList = React.forwardRef<HTMLDivElement, BarListProps>((props, ref) => {
|
|
|
301
318
|
return (
|
|
302
319
|
<div
|
|
303
320
|
key={item[xAxisField] + 'label' + idx}
|
|
304
|
-
className={`flex items-center h-9 rounded mb-2`}
|
|
321
|
+
className={`qq-flex qq-items-center qq-h-9 qq-rounded qq-mb-2`}
|
|
305
322
|
style={{
|
|
306
323
|
width: `${widths[idx]}%`,
|
|
307
324
|
transition: showAnimation ? 'all 2s' : '',
|
|
308
325
|
backgroundColor: hexToRgbaWith10PercentAlpha(colors[0]),
|
|
309
326
|
}}
|
|
310
327
|
>
|
|
311
|
-
<div
|
|
328
|
+
<div
|
|
329
|
+
className={twMerge(
|
|
330
|
+
'qq-absolute qq-max-w-full qq-flex',
|
|
331
|
+
'qq-ml-2'
|
|
332
|
+
)}
|
|
333
|
+
>
|
|
312
334
|
<p
|
|
313
335
|
className={twMerge(
|
|
314
336
|
// makeBarListClassName('barText'),
|
|
315
|
-
'whitespace-nowrap truncate',
|
|
316
|
-
'text-gray-500',
|
|
317
|
-
'text-sm'
|
|
337
|
+
'qq-whitespace-nowrap truncate',
|
|
338
|
+
'qq-text-gray-500',
|
|
339
|
+
'qq-text-sm'
|
|
318
340
|
)}
|
|
319
341
|
>
|
|
320
342
|
{item[xAxisField]}
|
|
@@ -324,29 +346,33 @@ const BarList = React.forwardRef<HTMLDivElement, BarListProps>((props, ref) => {
|
|
|
324
346
|
);
|
|
325
347
|
})}
|
|
326
348
|
{data.length > NUM_TO_SHOW && (
|
|
327
|
-
<div style={{ color: theme.chartLabelColor }} className="text-sm">
|
|
349
|
+
<div style={{ color: theme.chartLabelColor }} className="qq-text-sm">
|
|
328
350
|
...{data.length - NUM_TO_SHOW} more
|
|
329
351
|
</div>
|
|
330
352
|
)}
|
|
331
353
|
</div>
|
|
332
354
|
{/* eslint-disable prettier/prettier */}
|
|
333
|
-
<div
|
|
355
|
+
<div
|
|
356
|
+
className={
|
|
357
|
+
(makeBarListClassName('labels'), 'qq-text-right qq-min-w-min')
|
|
358
|
+
}
|
|
359
|
+
>
|
|
334
360
|
{data.slice(0, NUM_TO_SHOW).map((item, idx) => (
|
|
335
361
|
<div
|
|
336
362
|
key={item[xAxisField] + 'value' + idx}
|
|
337
363
|
className={twMerge(
|
|
338
364
|
makeBarListClassName('labelWrapper'),
|
|
339
|
-
'flex justify-end items-center',
|
|
340
|
-
'h-9',
|
|
341
|
-
idx === data.length - 1 ? 'mb-0' : 'mb-2'
|
|
365
|
+
'qq-flex qq-justify-end qq-items-center',
|
|
366
|
+
'qq-h-9',
|
|
367
|
+
idx === data.length - 1 ? 'qq-mb-0' : 'qq-mb-2'
|
|
342
368
|
)}
|
|
343
369
|
>
|
|
344
370
|
<p
|
|
345
371
|
className={twMerge(
|
|
346
372
|
makeBarListClassName('labelText'),
|
|
347
|
-
'whitespace-nowrap truncate',
|
|
348
|
-
'text-gray-500',
|
|
349
|
-
'text-sm'
|
|
373
|
+
'qq-whitespace-nowrap qq-truncate',
|
|
374
|
+
'qq-text-gray-500',
|
|
375
|
+
'qq-text-sm'
|
|
350
376
|
)}
|
|
351
377
|
>
|
|
352
378
|
{valueFormatter(item[yAxisFields[0].field])}
|
package/src/Chart.tsx
CHANGED
|
@@ -199,11 +199,17 @@ const labelFormatter = (name: string) => {
|
|
|
199
199
|
|
|
200
200
|
export const ChartTooltipFrame = ({
|
|
201
201
|
children,
|
|
202
|
+
theme,
|
|
202
203
|
}: {
|
|
203
204
|
children: React.ReactNode;
|
|
204
205
|
}) => (
|
|
205
206
|
<div
|
|
206
|
-
|
|
207
|
+
style={{
|
|
208
|
+
borderStyle: 'solid',
|
|
209
|
+
borderColor: theme.borderColor || '#E5E7EB',
|
|
210
|
+
borderWidth: 1,
|
|
211
|
+
}}
|
|
212
|
+
className="qq-bg-white qq-text-sm qq-rounded-md qq-shadow-lg"
|
|
207
213
|
// className={twMerge(
|
|
208
214
|
// 'bg-white',
|
|
209
215
|
// 'font-normal',
|
|
@@ -221,17 +227,24 @@ export interface ChartTooltipRowProps {
|
|
|
221
227
|
value: string;
|
|
222
228
|
name: string;
|
|
223
229
|
color: Color;
|
|
230
|
+
thee: any;
|
|
224
231
|
}
|
|
225
232
|
|
|
226
233
|
export const ChartTooltipRow = ({
|
|
227
234
|
value,
|
|
228
235
|
name,
|
|
229
236
|
color,
|
|
237
|
+
theme,
|
|
230
238
|
}: ChartTooltipRowProps) => (
|
|
231
|
-
<div className="flex items-center justify-between space-x-8">
|
|
232
|
-
<div className="flex items-center space-x-2">
|
|
239
|
+
<div className="qq-flex qq-items-center qq-justify-between qq-space-x-8">
|
|
240
|
+
<div className="qq-flex qq-items-center qq-space-x-2">
|
|
233
241
|
<span
|
|
234
|
-
style={{
|
|
242
|
+
style={{
|
|
243
|
+
background: color,
|
|
244
|
+
borderWidth: 2,
|
|
245
|
+
borderStyle: 'solid',
|
|
246
|
+
borderColor: 'white',
|
|
247
|
+
}}
|
|
235
248
|
className={twMerge(
|
|
236
249
|
// 'shrink-0',
|
|
237
250
|
// 'bg-black',
|
|
@@ -239,10 +252,10 @@ export const ChartTooltipRow = ({
|
|
|
239
252
|
// 'border-black',
|
|
240
253
|
// sizing.sm.height,
|
|
241
254
|
// sizing.sm.width,
|
|
242
|
-
'h-3',
|
|
243
|
-
'w-3',
|
|
244
|
-
'shadow',
|
|
245
|
-
'rounded-full'
|
|
255
|
+
'qq-h-3',
|
|
256
|
+
'qq-w-3',
|
|
257
|
+
'qq-shadow',
|
|
258
|
+
'qq-rounded-full'
|
|
246
259
|
// border.md.all,
|
|
247
260
|
// boxShadow.md
|
|
248
261
|
)}
|
|
@@ -252,16 +265,28 @@ export const ChartTooltipRow = ({
|
|
|
252
265
|
// 'font-medium tabular-nums text-right whitespace-nowrap',
|
|
253
266
|
// 'text-[#212121] !important'
|
|
254
267
|
// )}
|
|
255
|
-
|
|
268
|
+
style={{
|
|
269
|
+
marginTop: 0,
|
|
270
|
+
marginBottom: 0,
|
|
271
|
+
fontFamily: theme.fontFamily,
|
|
272
|
+
color: theme.primaryTextColor,
|
|
273
|
+
}}
|
|
274
|
+
className="qq-font-medium qq-tabular-nums qq-text-right qq-whitespace-nowrap qq-text-black"
|
|
256
275
|
>
|
|
257
276
|
{value}
|
|
258
277
|
</p>
|
|
259
278
|
</div>
|
|
260
279
|
<p
|
|
280
|
+
style={{
|
|
281
|
+
marginTop: 0,
|
|
282
|
+
marginBottom: 0,
|
|
283
|
+
fontFamily: theme.fontFamily,
|
|
284
|
+
color: theme.secondaryTextColor,
|
|
285
|
+
}}
|
|
261
286
|
className={twMerge(
|
|
262
|
-
'text-right whitespace-nowrap',
|
|
287
|
+
'qq-text-right qq-whitespace-nowrap',
|
|
263
288
|
// getColorClassNames(DEFAULT_COLOR, colorPalette.text).textColor,
|
|
264
|
-
'text-gray-500'
|
|
289
|
+
'qq-text-gray-500'
|
|
265
290
|
// fontWeight.sm
|
|
266
291
|
)}
|
|
267
292
|
>
|
|
@@ -276,6 +301,7 @@ export interface ChartTooltipProps {
|
|
|
276
301
|
label: string;
|
|
277
302
|
colors: string[];
|
|
278
303
|
valueFormatter: any;
|
|
304
|
+
theme: any;
|
|
279
305
|
}
|
|
280
306
|
|
|
281
307
|
const ChartTooltip = ({
|
|
@@ -284,12 +310,21 @@ const ChartTooltip = ({
|
|
|
284
310
|
label,
|
|
285
311
|
colors,
|
|
286
312
|
valueFormatter,
|
|
313
|
+
theme,
|
|
287
314
|
}: ChartTooltipProps) => {
|
|
288
315
|
if (active && payload) {
|
|
289
316
|
return (
|
|
290
|
-
<ChartTooltipFrame>
|
|
317
|
+
<ChartTooltipFrame theme={theme}>
|
|
291
318
|
<div
|
|
292
|
-
|
|
319
|
+
style={{
|
|
320
|
+
borderStyle: 'solid',
|
|
321
|
+
borderBottomColor: theme.borderColor || '#E5E7EB',
|
|
322
|
+
borderTop: 'none',
|
|
323
|
+
borderLeft: 'none',
|
|
324
|
+
borderRight: 'none',
|
|
325
|
+
borderBottomWidth: 1,
|
|
326
|
+
}}
|
|
327
|
+
className="qq-flex qq-flex-col qq-py-2 qq-px-4 qq-gray-200"
|
|
293
328
|
// className={
|
|
294
329
|
// twMerge()
|
|
295
330
|
// getColorClassNames(DEFAULT_COLOR, colorPalette.lightBorder)
|
|
@@ -300,12 +335,18 @@ const ChartTooltip = ({
|
|
|
300
335
|
// }
|
|
301
336
|
>
|
|
302
337
|
<p
|
|
303
|
-
style={{
|
|
338
|
+
style={{
|
|
339
|
+
textAlign: 'left',
|
|
340
|
+
marginTop: 0,
|
|
341
|
+
marginBottom: 0,
|
|
342
|
+
fontFamily: theme.fontFamily,
|
|
343
|
+
color: theme.primaryTextColor,
|
|
344
|
+
}}
|
|
304
345
|
className={twMerge(
|
|
305
|
-
'text-elem',
|
|
306
|
-
'text-black',
|
|
307
|
-
'font-medium',
|
|
308
|
-
'gray-700'
|
|
346
|
+
'qq-text-elem',
|
|
347
|
+
'qq-text-black',
|
|
348
|
+
'qq-font-medium',
|
|
349
|
+
'qq-gray-700'
|
|
309
350
|
// getColorClassNames(DEFAULT_COLOR, colorPalette.darkText)
|
|
310
351
|
// .textColor,
|
|
311
352
|
// fontWeight.md
|
|
@@ -319,7 +360,7 @@ const ChartTooltip = ({
|
|
|
319
360
|
</div>
|
|
320
361
|
|
|
321
362
|
<div
|
|
322
|
-
className="px-4 space-y-1 py-2 px-4"
|
|
363
|
+
className="qq-px-4 qq-space-y-1 qq-py-2 qq-px-4"
|
|
323
364
|
// className={
|
|
324
365
|
// twMerge()
|
|
325
366
|
// spacing.twoXl.paddingX,
|
|
@@ -335,6 +376,7 @@ const ChartTooltip = ({
|
|
|
335
376
|
name={labelFormatter(name)}
|
|
336
377
|
// color={categoryColors.get(name) ?? BaseColors.Blue}
|
|
337
378
|
color={colors[idx]}
|
|
379
|
+
theme={theme}
|
|
338
380
|
/>
|
|
339
381
|
)
|
|
340
382
|
)}
|
|
@@ -519,16 +561,25 @@ const ChartUpdater: React.FC<ChartProps> = ({
|
|
|
519
561
|
className="flex flex-col flex-1 h-[100%]"
|
|
520
562
|
style={{ ...containerStyle, marginLeft: 25 }}
|
|
521
563
|
>
|
|
522
|
-
<
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
564
|
+
<div style={{ height: containerStyle?.height || 300, width: '100%' }}>
|
|
565
|
+
<Skeleton
|
|
566
|
+
count={1}
|
|
567
|
+
// height={containerStyle?.height}
|
|
568
|
+
height={
|
|
569
|
+
containerStyle?.height && containerStyle?.marginTop
|
|
570
|
+
? containerStyle?.height + containerStyle?.marginTop
|
|
571
|
+
: containerStyle?.height
|
|
572
|
+
? containerStyle?.height
|
|
573
|
+
: 300
|
|
574
|
+
}
|
|
575
|
+
borderRadius={8}
|
|
576
|
+
// highlightColor="#F7F7F8"
|
|
577
|
+
highlightColor="#FDFDFD"
|
|
578
|
+
// baseColor="#F3F4F6"
|
|
579
|
+
baseColor="#F9F9FA"
|
|
580
|
+
width="100%"
|
|
581
|
+
/>
|
|
582
|
+
</div>
|
|
532
583
|
</div>
|
|
533
584
|
);
|
|
534
585
|
}
|
|
@@ -550,6 +601,7 @@ const ChartUpdater: React.FC<ChartProps> = ({
|
|
|
550
601
|
category={yAxisFields[0].field}
|
|
551
602
|
index={xAxisField}
|
|
552
603
|
colors={colors}
|
|
604
|
+
theme={theme}
|
|
553
605
|
/>
|
|
554
606
|
);
|
|
555
607
|
}
|
|
@@ -597,7 +649,7 @@ const ChartUpdater: React.FC<ChartProps> = ({
|
|
|
597
649
|
return (
|
|
598
650
|
<div
|
|
599
651
|
style={{
|
|
600
|
-
|
|
652
|
+
fontFamily: theme.fontFamily,
|
|
601
653
|
fontSize: 32,
|
|
602
654
|
color: theme.primaryTextColor,
|
|
603
655
|
fontWeight: '600',
|
|
@@ -609,10 +661,10 @@ const ChartUpdater: React.FC<ChartProps> = ({
|
|
|
609
661
|
maxWidth: '100%',
|
|
610
662
|
textAlign: 'left',
|
|
611
663
|
overflow: 'hidden',
|
|
612
|
-
height: '100%',
|
|
664
|
+
height: containerStyle?.height || '100%',
|
|
613
665
|
// background: 'red',
|
|
614
666
|
}}
|
|
615
|
-
className="flex flex-col text-xl"
|
|
667
|
+
className="qq-flex qq-flex-col qq-text-xl"
|
|
616
668
|
>
|
|
617
669
|
{formatNumber(
|
|
618
670
|
chartConfig.rows[0][chartConfig.xAxisField],
|
|
@@ -631,6 +683,7 @@ const ChartUpdater: React.FC<ChartProps> = ({
|
|
|
631
683
|
xAxisField={chartConfig.xAxisField}
|
|
632
684
|
xAxisLabel={chartConfig.xAxisLabel}
|
|
633
685
|
containerStyle={containerStyle}
|
|
686
|
+
theme={theme}
|
|
634
687
|
/>
|
|
635
688
|
);
|
|
636
689
|
};
|
|
@@ -719,7 +772,10 @@ function BarChart({
|
|
|
719
772
|
}) {
|
|
720
773
|
const newColors = findComplementaryAndAnalogousColors(colors[0], colors[1]);
|
|
721
774
|
return (
|
|
722
|
-
<div
|
|
775
|
+
<div
|
|
776
|
+
style={containerStyle}
|
|
777
|
+
className="qq-flex qq-flex-col qq-flex-1 qq-h-full qq-w-full"
|
|
778
|
+
>
|
|
723
779
|
<ResponsiveContainer width="100%" height={'100%'}>
|
|
724
780
|
<ReChartsBarChart
|
|
725
781
|
data={data}
|
|
@@ -800,6 +856,7 @@ function BarChart({
|
|
|
800
856
|
content={({ active, payload, label }) => {
|
|
801
857
|
return (
|
|
802
858
|
<ChartTooltip
|
|
859
|
+
theme={theme}
|
|
803
860
|
active={active}
|
|
804
861
|
payload={payload}
|
|
805
862
|
label={label}
|
|
@@ -842,6 +899,7 @@ function LineChart({
|
|
|
842
899
|
containerStyle,
|
|
843
900
|
xAxisField,
|
|
844
901
|
xAxisLabel,
|
|
902
|
+
theme,
|
|
845
903
|
}: {
|
|
846
904
|
colors: string[];
|
|
847
905
|
yAxisFields: any[];
|
|
@@ -849,13 +907,17 @@ function LineChart({
|
|
|
849
907
|
containerStyle?: React.CSSProperties;
|
|
850
908
|
xAxisField: string;
|
|
851
909
|
xAxisLabel: string;
|
|
910
|
+
theme: any;
|
|
852
911
|
}) {
|
|
853
912
|
// console.log('CONTAINER: ', containerStyle);
|
|
854
913
|
if (!yAxisFields || !yAxisFields.length) {
|
|
855
914
|
return null;
|
|
856
915
|
}
|
|
857
916
|
return (
|
|
858
|
-
<div
|
|
917
|
+
<div
|
|
918
|
+
style={containerStyle}
|
|
919
|
+
className="qq-flex qq-flex-col qq-flex-1 qq-h-full qq-w-full"
|
|
920
|
+
>
|
|
859
921
|
<ResponsiveContainer width="100%" height={'100%'}>
|
|
860
922
|
<ReChartsAreaChart data={data}>
|
|
861
923
|
<CartesianGrid
|
|
@@ -916,6 +978,7 @@ function LineChart({
|
|
|
916
978
|
label={label}
|
|
917
979
|
valueFormatter={valueFormatter}
|
|
918
980
|
colors={colors}
|
|
981
|
+
theme={theme}
|
|
919
982
|
/>
|
|
920
983
|
);
|
|
921
984
|
}}
|