@dust-tt/sparkle 0.2.210-rc75 → 0.2.211
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/dist/cjs/components/Checkbox.d.ts +1 -1
- package/dist/cjs/components/DataTable.d.ts +3 -3
- package/dist/cjs/components/Item.d.ts +1 -1
- package/dist/cjs/components/WindowUtility.d.ts +15 -0
- package/dist/cjs/index.js +4328 -4259
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/components/Checkbox.d.ts +1 -1
- package/dist/esm/components/DataTable.d.ts +3 -3
- package/dist/esm/components/Item.d.ts +1 -1
- package/dist/esm/components/WindowUtility.d.ts +15 -0
- package/dist/esm/index.js +4328 -4259
- package/dist/esm/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/_index.ts +48 -48
- package/src/components/Checkbox.tsx +4 -4
- package/src/components/DataTable.tsx +86 -63
- package/src/components/Item.tsx +1 -1
- package/src/components/Tree.tsx +2 -0
- package/src/components/WindowUtility.tsx +66 -0
- package/src/icons/solid/index.ts +0 -1
- package/src/lottie/collapseBar.ts +124 -124
- package/src/lottie/spinnerColor.ts +337 -337
- package/src/lottie/spinnerColorLG.ts +824 -824
- package/src/lottie/spinnerColorXS.ts +187 -187
- package/src/lottie/spinnerDark.ts +353 -353
- package/src/lottie/spinnerDarkLG.ts +824 -824
- package/src/lottie/spinnerDarkXS.ts +218 -218
- package/src/lottie/spinnerLight.ts +342 -342
- package/src/lottie/spinnerLightLG.ts +797 -797
- package/src/lottie/spinnerLightXS.ts +215 -215
- package/src/stories/Checkbox.stories.tsx +16 -8
- package/src/stories/Tree.stories.tsx +37 -37
- package/src/styles/tailwind.css +7 -9
package/package.json
CHANGED
package/src/_index.ts
CHANGED
|
@@ -254,13 +254,13 @@ import {
|
|
|
254
254
|
ArrowDownOnSquare as ArrowDownOnSquareIcon,
|
|
255
255
|
ArrowDownS as ArrowDownSIcon,
|
|
256
256
|
ArrowLeft as ArrowLeftIcon,
|
|
257
|
-
ArrowLeftS as ArrowLeftSIcon,
|
|
257
|
+
ArrowLeftS as ArrowLeftSIcon,
|
|
258
258
|
ArrowPath as ArrowPathIcon,
|
|
259
259
|
ArrowRight as ArrowRightIcon,
|
|
260
|
-
ArrowRightS as ArrowRightSIcon,
|
|
260
|
+
ArrowRightS as ArrowRightSIcon,
|
|
261
261
|
ArrowUp as ArrowUpIcon,
|
|
262
262
|
ArrowUpOnSquare as ArrowUpOnSquareIcon,
|
|
263
|
-
ArrowUpS as ArrowUpSIcon,
|
|
263
|
+
ArrowUpS as ArrowUpSIcon,
|
|
264
264
|
Attachment as AttachmentIcon,
|
|
265
265
|
Backspace as BackspaceIcon,
|
|
266
266
|
Bookmark as BookmarkIcon,
|
|
@@ -273,8 +273,8 @@ ArrowUpS as ArrowUpSIcon,
|
|
|
273
273
|
ChatBubbleThought as ChatBubbleThoughtIcon,
|
|
274
274
|
Check as CheckIcon,
|
|
275
275
|
CheckCircle as CheckCircleIcon,
|
|
276
|
-
ChevronDoubleLeft as ChevronDoubleLeftIcon,
|
|
277
|
-
ChevronDoubleRight as ChevronDoubleRightIcon,
|
|
276
|
+
ChevronDoubleLeft as ChevronDoubleLeftIcon,
|
|
277
|
+
ChevronDoubleRight as ChevronDoubleRightIcon,
|
|
278
278
|
ChevronDown as ChevronDownIcon,
|
|
279
279
|
ChevronLeft as ChevronLeftIcon,
|
|
280
280
|
ChevronRight as ChevronRightIcon,
|
|
@@ -291,7 +291,7 @@ ChevronDoubleRight as ChevronDoubleRightIcon,
|
|
|
291
291
|
Cog6Tooth as Cog6ToothIcon,
|
|
292
292
|
Command as CommandIcon,
|
|
293
293
|
CommandLine as CommandLineIcon,
|
|
294
|
-
Company as CompanyIcon,
|
|
294
|
+
Company as CompanyIcon,
|
|
295
295
|
Cube as CubeIcon,
|
|
296
296
|
Dash as DashIcon,
|
|
297
297
|
Document as DocumentIcon,
|
|
@@ -306,7 +306,7 @@ Company as CompanyIcon,
|
|
|
306
306
|
ExternalLink as ExternalLinkIcon,
|
|
307
307
|
Eye as EyeIcon,
|
|
308
308
|
EyeSlash as EyeSlashIcon,
|
|
309
|
-
Filter as FilterIcon,
|
|
309
|
+
Filter as FilterIcon,
|
|
310
310
|
Fire as FireIcon,
|
|
311
311
|
Flag as FlagIcon,
|
|
312
312
|
Folder as FolderIcon,
|
|
@@ -317,11 +317,11 @@ Filter as FilterIcon,
|
|
|
317
317
|
Grab as GrabIcon,
|
|
318
318
|
HandThumbDown as HandThumbDownIcon,
|
|
319
319
|
HandThumbUp as HandThumbUpIcon,
|
|
320
|
-
Heart as HeartIcon,
|
|
320
|
+
Heart as HeartIcon,
|
|
321
321
|
HeartAlt as HeartAltIcon,
|
|
322
322
|
Hexagon as HexagonIcon,
|
|
323
|
-
History as HistoryIcon,
|
|
324
|
-
Home as HomeIcon,
|
|
323
|
+
History as HistoryIcon,
|
|
324
|
+
Home as HomeIcon,
|
|
325
325
|
Image as ImageIcon,
|
|
326
326
|
InformationCircle as InformationCircleIcon,
|
|
327
327
|
Key as KeyIcon,
|
|
@@ -336,7 +336,7 @@ Home as HomeIcon,
|
|
|
336
336
|
Logout as LogoutIcon,
|
|
337
337
|
Magic as MagicIcon,
|
|
338
338
|
MagnifyingGlass as MagnifyingGlassIcon,
|
|
339
|
-
MarkPen as MarkPenIcon,
|
|
339
|
+
MarkPen as MarkPenIcon,
|
|
340
340
|
Menu as MenuIcon,
|
|
341
341
|
More as MoreIcon,
|
|
342
342
|
MovingMail as MovingMailIcon,
|
|
@@ -369,7 +369,7 @@ MarkPen as MarkPenIcon,
|
|
|
369
369
|
Template as TemplateIcon,
|
|
370
370
|
TestTube as TestTubeIcon,
|
|
371
371
|
Time as TimeIcon,
|
|
372
|
-
Translate as TranslateIcon,
|
|
372
|
+
Translate as TranslateIcon,
|
|
373
373
|
Trash as TrashIcon,
|
|
374
374
|
Triangle as TriangleIcon,
|
|
375
375
|
User as UserIcon,
|
|
@@ -387,13 +387,13 @@ export {
|
|
|
387
387
|
ArrowDownOnSquareIcon,
|
|
388
388
|
ArrowDownSIcon,
|
|
389
389
|
ArrowLeftIcon,
|
|
390
|
-
ArrowLeftSIcon,
|
|
390
|
+
ArrowLeftSIcon,
|
|
391
391
|
ArrowPathIcon,
|
|
392
392
|
ArrowRightIcon,
|
|
393
|
-
ArrowRightSIcon,
|
|
393
|
+
ArrowRightSIcon,
|
|
394
394
|
ArrowUpIcon,
|
|
395
395
|
ArrowUpOnSquareIcon,
|
|
396
|
-
ArrowUpSIcon,
|
|
396
|
+
ArrowUpSIcon,
|
|
397
397
|
AttachmentIcon,
|
|
398
398
|
BackspaceIcon,
|
|
399
399
|
BookmarkIcon,
|
|
@@ -406,8 +406,8 @@ ArrowUpSIcon,
|
|
|
406
406
|
ChatBubbleThoughtIcon,
|
|
407
407
|
CheckCircleIcon,
|
|
408
408
|
CheckIcon,
|
|
409
|
-
ChevronDoubleLeftIcon,
|
|
410
|
-
ChevronDoubleRightIcon,
|
|
409
|
+
ChevronDoubleLeftIcon,
|
|
410
|
+
ChevronDoubleRightIcon,
|
|
411
411
|
ChevronDownIcon,
|
|
412
412
|
ChevronLeftIcon,
|
|
413
413
|
ChevronRightIcon,
|
|
@@ -424,7 +424,7 @@ ChevronDoubleRightIcon,
|
|
|
424
424
|
Cog6ToothIcon,
|
|
425
425
|
CommandIcon,
|
|
426
426
|
CommandLineIcon,
|
|
427
|
-
CompanyIcon,
|
|
427
|
+
CompanyIcon,
|
|
428
428
|
CubeIcon,
|
|
429
429
|
DashIcon,
|
|
430
430
|
DocumentDuplicateIcon,
|
|
@@ -439,7 +439,7 @@ CompanyIcon,
|
|
|
439
439
|
ExternalLinkIcon,
|
|
440
440
|
EyeIcon,
|
|
441
441
|
EyeSlashIcon,
|
|
442
|
-
FilterIcon,
|
|
442
|
+
FilterIcon,
|
|
443
443
|
FireIcon,
|
|
444
444
|
FlagIcon,
|
|
445
445
|
FolderIcon,
|
|
@@ -451,10 +451,10 @@ FilterIcon,
|
|
|
451
451
|
HandThumbDownIcon,
|
|
452
452
|
HandThumbUpIcon,
|
|
453
453
|
HeartAltIcon,
|
|
454
|
-
HeartIcon,
|
|
454
|
+
HeartIcon,
|
|
455
455
|
HexagonIcon,
|
|
456
|
-
HistoryIcon,
|
|
457
|
-
HomeIcon,
|
|
456
|
+
HistoryIcon,
|
|
457
|
+
HomeIcon,
|
|
458
458
|
ImageIcon,
|
|
459
459
|
InformationCircleIcon,
|
|
460
460
|
KeyIcon,
|
|
@@ -469,7 +469,7 @@ HomeIcon,
|
|
|
469
469
|
LogoutIcon,
|
|
470
470
|
MagicIcon,
|
|
471
471
|
MagnifyingGlassIcon,
|
|
472
|
-
MarkPenIcon,
|
|
472
|
+
MarkPenIcon,
|
|
473
473
|
MenuIcon,
|
|
474
474
|
MoreIcon,
|
|
475
475
|
MovingMailIcon,
|
|
@@ -502,7 +502,7 @@ MarkPenIcon,
|
|
|
502
502
|
TemplateIcon,
|
|
503
503
|
TestTubeIcon,
|
|
504
504
|
TimeIcon,
|
|
505
|
-
TranslateIcon,
|
|
505
|
+
TranslateIcon,
|
|
506
506
|
TrashIcon,
|
|
507
507
|
TriangleIcon,
|
|
508
508
|
UserArrowIcon,
|
|
@@ -520,13 +520,13 @@ import {
|
|
|
520
520
|
ArrowDownOnSquare as ArrowDownOnSquareStrokeIcon,
|
|
521
521
|
ArrowDownS as ArrowDownSStrokeIcon,
|
|
522
522
|
ArrowLeft as ArrowLeftStrokeIcon,
|
|
523
|
-
ArrowLeftS as ArrowLeftSStrokeIcon,
|
|
523
|
+
ArrowLeftS as ArrowLeftSStrokeIcon,
|
|
524
524
|
ArrowPath as ArrowPathStrokeIcon,
|
|
525
525
|
ArrowRight as ArrowRightStrokeIcon,
|
|
526
|
-
ArrowRightS as ArrowRightSStrokeIcon,
|
|
526
|
+
ArrowRightS as ArrowRightSStrokeIcon,
|
|
527
527
|
ArrowUp as ArrowUpStrokeIcon,
|
|
528
528
|
ArrowUpOnSquare as ArrowUpOnSquareStrokeIcon,
|
|
529
|
-
ArrowUpS as ArrowUpSStrokeIcon,
|
|
529
|
+
ArrowUpS as ArrowUpSStrokeIcon,
|
|
530
530
|
Attachment as AttachmentStrokeIcon,
|
|
531
531
|
Backspace as BackspaceStrokeIcon,
|
|
532
532
|
Bookmark as BookmarkStrokeIcon,
|
|
@@ -539,8 +539,8 @@ ArrowUpS as ArrowUpSStrokeIcon,
|
|
|
539
539
|
ChatBubbleThought as ChatBubbleThoughtStrokeIcon,
|
|
540
540
|
Check as CheckStrokeIcon,
|
|
541
541
|
CheckCircle as CheckCircleStrokeIcon,
|
|
542
|
-
ChevronDoubleLeft as ChevronDoubleLeftStrokeIcon,
|
|
543
|
-
ChevronDoubleRight as ChevronDoubleRightStrokeIcon,
|
|
542
|
+
ChevronDoubleLeft as ChevronDoubleLeftStrokeIcon,
|
|
543
|
+
ChevronDoubleRight as ChevronDoubleRightStrokeIcon,
|
|
544
544
|
ChevronDown as ChevronDownStrokeIcon,
|
|
545
545
|
ChevronLeft as ChevronLeftStrokeIcon,
|
|
546
546
|
ChevronRight as ChevronRightStrokeIcon,
|
|
@@ -557,7 +557,7 @@ ChevronDoubleRight as ChevronDoubleRightStrokeIcon,
|
|
|
557
557
|
Cog6Tooth as Cog6ToothStrokeIcon,
|
|
558
558
|
Command as CommandStrokeIcon,
|
|
559
559
|
CommandLine as CommandLineStrokeIcon,
|
|
560
|
-
Company as CompanyStrokeIcon,
|
|
560
|
+
Company as CompanyStrokeIcon,
|
|
561
561
|
Cube as CubeStrokeIcon,
|
|
562
562
|
Dash as DashStrokeIcon,
|
|
563
563
|
Document as DocumentStrokeIcon,
|
|
@@ -572,7 +572,7 @@ Company as CompanyStrokeIcon,
|
|
|
572
572
|
ExternalLink as ExternalLinkStrokeIcon,
|
|
573
573
|
Eye as EyeStrokeIcon,
|
|
574
574
|
EyeSlash as EyeSlashStrokeIcon,
|
|
575
|
-
Filter as FilterStrokeIcon,
|
|
575
|
+
Filter as FilterStrokeIcon,
|
|
576
576
|
Fire as FireStrokeIcon,
|
|
577
577
|
Flag as FlagStrokeIcon,
|
|
578
578
|
Folder as FolderStrokeIcon,
|
|
@@ -583,11 +583,11 @@ Filter as FilterStrokeIcon,
|
|
|
583
583
|
Grab as GrabStrokeIcon,
|
|
584
584
|
HandThumbDown as HandThumbDownStrokeIcon,
|
|
585
585
|
HandThumbUp as HandThumbUpStrokeIcon,
|
|
586
|
-
Heart as HeartStrokeIcon,
|
|
586
|
+
Heart as HeartStrokeIcon,
|
|
587
587
|
HeartAlt as HeartAltStrokeIcon,
|
|
588
588
|
Hexagon as HexagonStrokeIcon,
|
|
589
|
-
History as HistoryStrokeIcon,
|
|
590
|
-
Home as HomeStrokeIcon,
|
|
589
|
+
History as HistoryStrokeIcon,
|
|
590
|
+
Home as HomeStrokeIcon,
|
|
591
591
|
Image as ImageStrokeIcon,
|
|
592
592
|
InformationCircle as InformationCircleStrokeIcon,
|
|
593
593
|
Key as KeyStrokeIcon,
|
|
@@ -602,7 +602,7 @@ Home as HomeStrokeIcon,
|
|
|
602
602
|
Logout as LogoutStrokeIcon,
|
|
603
603
|
Magic as MagicStrokeIcon,
|
|
604
604
|
MagnifyingGlass as MagnifyingGlassStrokeIcon,
|
|
605
|
-
MarkPen as MarkPenStrokeIcon,
|
|
605
|
+
MarkPen as MarkPenStrokeIcon,
|
|
606
606
|
Menu as MenuStrokeIcon,
|
|
607
607
|
More as MoreStrokeIcon,
|
|
608
608
|
MovingMail as MovingMailStrokeIcon,
|
|
@@ -635,7 +635,7 @@ MarkPen as MarkPenStrokeIcon,
|
|
|
635
635
|
Template as TemplateStrokeIcon,
|
|
636
636
|
TestTube as TestTubeStrokeIcon,
|
|
637
637
|
Time as TimeStrokeIcon,
|
|
638
|
-
Translate as TranslateStrokeIcon,
|
|
638
|
+
Translate as TranslateStrokeIcon,
|
|
639
639
|
Trash as TrashStrokeIcon,
|
|
640
640
|
Triangle as TriangleStrokeIcon,
|
|
641
641
|
User as UserStrokeIcon,
|
|
@@ -652,13 +652,13 @@ export {
|
|
|
652
652
|
ArrowDownOnSquareStrokeIcon,
|
|
653
653
|
ArrowDownSStrokeIcon,
|
|
654
654
|
ArrowDownStrokeIcon,
|
|
655
|
-
ArrowLeftSStrokeIcon,
|
|
655
|
+
ArrowLeftSStrokeIcon,
|
|
656
656
|
ArrowLeftStrokeIcon,
|
|
657
657
|
ArrowPathStrokeIcon,
|
|
658
|
-
ArrowRightSStrokeIcon,
|
|
658
|
+
ArrowRightSStrokeIcon,
|
|
659
659
|
ArrowRightStrokeIcon,
|
|
660
660
|
ArrowUpOnSquareStrokeIcon,
|
|
661
|
-
ArrowUpSStrokeIcon,
|
|
661
|
+
ArrowUpSStrokeIcon,
|
|
662
662
|
ArrowUpStrokeIcon,
|
|
663
663
|
AttachmentStrokeIcon,
|
|
664
664
|
BackspaceStrokeIcon,
|
|
@@ -672,8 +672,8 @@ ArrowUpSStrokeIcon,
|
|
|
672
672
|
ChatBubbleThoughtStrokeIcon,
|
|
673
673
|
CheckCircleStrokeIcon,
|
|
674
674
|
CheckStrokeIcon,
|
|
675
|
-
ChevronDoubleLeftStrokeIcon,
|
|
676
|
-
ChevronDoubleRightStrokeIcon,
|
|
675
|
+
ChevronDoubleLeftStrokeIcon,
|
|
676
|
+
ChevronDoubleRightStrokeIcon,
|
|
677
677
|
ChevronDownStrokeIcon,
|
|
678
678
|
ChevronLeftStrokeIcon,
|
|
679
679
|
ChevronRightStrokeIcon,
|
|
@@ -690,7 +690,7 @@ ChevronDoubleRightStrokeIcon,
|
|
|
690
690
|
Cog6ToothStrokeIcon,
|
|
691
691
|
CommandLineStrokeIcon,
|
|
692
692
|
CommandStrokeIcon,
|
|
693
|
-
CompanyStrokeIcon,
|
|
693
|
+
CompanyStrokeIcon,
|
|
694
694
|
CubeStrokeIcon,
|
|
695
695
|
DashStrokeIcon,
|
|
696
696
|
DocumentDuplicateStrokeIcon,
|
|
@@ -705,7 +705,7 @@ CompanyStrokeIcon,
|
|
|
705
705
|
ExternalLinkStrokeIcon,
|
|
706
706
|
EyeSlashStrokeIcon,
|
|
707
707
|
EyeStrokeIcon,
|
|
708
|
-
FilterStrokeIcon,
|
|
708
|
+
FilterStrokeIcon,
|
|
709
709
|
FireStrokeIcon,
|
|
710
710
|
FlagStrokeIcon,
|
|
711
711
|
FolderOpenStrokeIcon,
|
|
@@ -717,10 +717,10 @@ FilterStrokeIcon,
|
|
|
717
717
|
HandThumbDownStrokeIcon,
|
|
718
718
|
HandThumbUpStrokeIcon,
|
|
719
719
|
HeartAltStrokeIcon,
|
|
720
|
-
HeartStrokeIcon,
|
|
720
|
+
HeartStrokeIcon,
|
|
721
721
|
HexagonStrokeIcon,
|
|
722
|
-
HistoryStrokeIcon,
|
|
723
|
-
HomeStrokeIcon,
|
|
722
|
+
HistoryStrokeIcon,
|
|
723
|
+
HomeStrokeIcon,
|
|
724
724
|
ImageStrokeIcon,
|
|
725
725
|
InformationCircleStrokeIcon,
|
|
726
726
|
KeyStrokeIcon,
|
|
@@ -735,7 +735,7 @@ HomeStrokeIcon,
|
|
|
735
735
|
LogoutStrokeIcon,
|
|
736
736
|
MagicStrokeIcon,
|
|
737
737
|
MagnifyingGlassStrokeIcon,
|
|
738
|
-
MarkPenStrokeIcon,
|
|
738
|
+
MarkPenStrokeIcon,
|
|
739
739
|
MenuStrokeIcon,
|
|
740
740
|
MoreStrokeIcon,
|
|
741
741
|
MovingMailStrokeIcon,
|
|
@@ -768,7 +768,7 @@ MarkPenStrokeIcon,
|
|
|
768
768
|
TemplateStrokeIcon,
|
|
769
769
|
TestTubeStrokeIcon,
|
|
770
770
|
TimeStrokeIcon,
|
|
771
|
-
TranslateStrokeIcon,
|
|
771
|
+
TranslateStrokeIcon,
|
|
772
772
|
TrashStrokeIcon,
|
|
773
773
|
TriangleStrokeIcon,
|
|
774
774
|
UserArrowStrokeIcon,
|
|
@@ -8,7 +8,7 @@ import { Icon } from "./Icon";
|
|
|
8
8
|
export interface CheckboxProps {
|
|
9
9
|
variant?: "selectable" | "checkable";
|
|
10
10
|
size?: "xs" | "sm";
|
|
11
|
-
checked?:
|
|
11
|
+
checked?: "checked" | "unchecked" | "partial";
|
|
12
12
|
disabled?: boolean;
|
|
13
13
|
onChange: (checked: boolean) => void;
|
|
14
14
|
className?: string;
|
|
@@ -16,7 +16,7 @@ export interface CheckboxProps {
|
|
|
16
16
|
|
|
17
17
|
export function Checkbox({
|
|
18
18
|
variant = "selectable",
|
|
19
|
-
checked =
|
|
19
|
+
checked = "unchecked",
|
|
20
20
|
size = "sm",
|
|
21
21
|
onChange,
|
|
22
22
|
className = "",
|
|
@@ -25,11 +25,11 @@ export function Checkbox({
|
|
|
25
25
|
let isChecked: boolean;
|
|
26
26
|
let isPartialChecked: boolean;
|
|
27
27
|
switch (checked) {
|
|
28
|
-
case
|
|
28
|
+
case "checked":
|
|
29
29
|
isChecked = true;
|
|
30
30
|
isPartialChecked = false;
|
|
31
31
|
break;
|
|
32
|
-
case
|
|
32
|
+
case "unchecked":
|
|
33
33
|
isChecked = false;
|
|
34
34
|
isPartialChecked = false;
|
|
35
35
|
break;
|
|
@@ -11,11 +11,12 @@ import {
|
|
|
11
11
|
import React, { ReactNode, useEffect, useState } from "react";
|
|
12
12
|
|
|
13
13
|
import { DropdownItemProps } from "@sparkle/components/DropdownMenu";
|
|
14
|
-
import { Avatar, DropdownMenu, MoreIcon } from "@sparkle/index";
|
|
14
|
+
import { Avatar, DropdownMenu, IconButton, MoreIcon } from "@sparkle/index";
|
|
15
15
|
import { ArrowDownIcon, ArrowUpIcon } from "@sparkle/index";
|
|
16
16
|
import { classNames } from "@sparkle/lib/utils";
|
|
17
17
|
|
|
18
18
|
import { Icon } from "./Icon";
|
|
19
|
+
import { breakpoints, useWindowSize } from "./WindowUtility";
|
|
19
20
|
|
|
20
21
|
interface TBaseData {
|
|
21
22
|
onClick?: () => void;
|
|
@@ -26,9 +27,9 @@ interface ColumnBreakpoint {
|
|
|
26
27
|
[columnId: string]: "xs" | "sm" | "md" | "lg" | "xl";
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
interface DataTableProps<TData extends TBaseData
|
|
30
|
+
interface DataTableProps<TData extends TBaseData> {
|
|
30
31
|
data: TData[];
|
|
31
|
-
columns: ColumnDef<TData,
|
|
32
|
+
columns: ColumnDef<TData, any>[]; // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
32
33
|
className?: string;
|
|
33
34
|
filter?: string;
|
|
34
35
|
filterColumn?: string;
|
|
@@ -36,7 +37,17 @@ interface DataTableProps<TData extends TBaseData, TValue> {
|
|
|
36
37
|
columnsBreakpoints?: ColumnBreakpoint;
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
function shouldRenderColumn(
|
|
41
|
+
windowWidth: number,
|
|
42
|
+
breakpoint?: keyof typeof breakpoints
|
|
43
|
+
): boolean {
|
|
44
|
+
if (!breakpoint) {
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
return windowWidth >= breakpoints[breakpoint];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function DataTable<TData extends TBaseData>({
|
|
40
51
|
data,
|
|
41
52
|
columns,
|
|
42
53
|
className,
|
|
@@ -44,7 +55,8 @@ export function DataTable<TData extends TBaseData, TValue>({
|
|
|
44
55
|
filterColumn,
|
|
45
56
|
initialColumnOrder,
|
|
46
57
|
columnsBreakpoints = {},
|
|
47
|
-
}: DataTableProps<TData
|
|
58
|
+
}: DataTableProps<TData>) {
|
|
59
|
+
const windowSize = useWindowSize();
|
|
48
60
|
const [sorting, setSorting] = useState<SortingState>(
|
|
49
61
|
initialColumnOrder ?? []
|
|
50
62
|
);
|
|
@@ -75,43 +87,49 @@ export function DataTable<TData extends TBaseData, TValue>({
|
|
|
75
87
|
<DataTable.Header>
|
|
76
88
|
{table.getHeaderGroups().map((headerGroup) => (
|
|
77
89
|
<DataTable.Row key={headerGroup.id}>
|
|
78
|
-
{headerGroup.headers.map((header) =>
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
{
|
|
91
|
-
header.column.
|
|
92
|
-
header.getContext()
|
|
90
|
+
{headerGroup.headers.map((header) => {
|
|
91
|
+
const breakpoint = columnsBreakpoints[header.id];
|
|
92
|
+
if (
|
|
93
|
+
!windowSize.width ||
|
|
94
|
+
!shouldRenderColumn(windowSize.width, breakpoint)
|
|
95
|
+
) {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
return (
|
|
99
|
+
<DataTable.Head
|
|
100
|
+
key={header.id}
|
|
101
|
+
onClick={header.column.getToggleSortingHandler()}
|
|
102
|
+
className={classNames(
|
|
103
|
+
header.column.getCanSort() ? "s-cursor-pointer" : ""
|
|
93
104
|
)}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
105
|
+
>
|
|
106
|
+
<div className="s-flex s-items-center s-space-x-1 s-whitespace-nowrap">
|
|
107
|
+
{flexRender(
|
|
108
|
+
header.column.columnDef.header,
|
|
109
|
+
header.getContext()
|
|
110
|
+
)}
|
|
111
|
+
{header.column.getCanSort() && (
|
|
112
|
+
<Icon
|
|
113
|
+
visual={
|
|
114
|
+
header.column.getIsSorted() === "asc"
|
|
115
|
+
? ArrowUpIcon
|
|
116
|
+
: header.column.getIsSorted() === "desc"
|
|
117
|
+
? ArrowDownIcon
|
|
118
|
+
: ArrowDownIcon
|
|
119
|
+
}
|
|
120
|
+
size="xs"
|
|
121
|
+
className={classNames(
|
|
122
|
+
"s-ml-1",
|
|
123
|
+
header.column.getIsSorted()
|
|
124
|
+
? "s-opacity-100"
|
|
125
|
+
: "s-opacity-0"
|
|
126
|
+
)}
|
|
127
|
+
/>
|
|
128
|
+
)}
|
|
129
|
+
</div>
|
|
130
|
+
</DataTable.Head>
|
|
131
|
+
);
|
|
132
|
+
})}
|
|
115
133
|
</DataTable.Row>
|
|
116
134
|
))}
|
|
117
135
|
</DataTable.Header>
|
|
@@ -122,18 +140,20 @@ export function DataTable<TData extends TBaseData, TValue>({
|
|
|
122
140
|
onClick={row.original.onClick}
|
|
123
141
|
moreMenuItems={row.original.moreMenuItems}
|
|
124
142
|
>
|
|
125
|
-
{row.getVisibleCells().map((cell) =>
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
143
|
+
{row.getVisibleCells().map((cell) => {
|
|
144
|
+
const breakpoint = columnsBreakpoints[cell.column.id];
|
|
145
|
+
if (
|
|
146
|
+
!windowSize.width ||
|
|
147
|
+
!shouldRenderColumn(windowSize.width, breakpoint)
|
|
148
|
+
) {
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
return (
|
|
152
|
+
<DataTable.Cell key={cell.id}>
|
|
153
|
+
{flexRender(cell.column.columnDef.cell, cell.getContext())}
|
|
154
|
+
</DataTable.Cell>
|
|
155
|
+
);
|
|
156
|
+
})}
|
|
137
157
|
</DataTable.Row>
|
|
138
158
|
))}
|
|
139
159
|
</DataTable.Body>
|
|
@@ -225,23 +245,23 @@ DataTable.Row = function Row({
|
|
|
225
245
|
return (
|
|
226
246
|
<tr
|
|
227
247
|
className={classNames(
|
|
228
|
-
"s-border-b s-border-structure-200 s-text-sm",
|
|
229
|
-
onClick ? "s-cursor-pointer hover:s-bg-
|
|
248
|
+
"s-group s-border-b s-border-structure-200 s-text-sm s-transition-colors s-duration-300 s-ease-out",
|
|
249
|
+
onClick ? "s-cursor-pointer hover:s-bg-structure-50" : "",
|
|
230
250
|
className || ""
|
|
231
251
|
)}
|
|
232
252
|
onClick={onClick ? onClick : undefined}
|
|
233
253
|
{...props}
|
|
234
254
|
>
|
|
235
255
|
{children}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
<DropdownMenu className="s-flex">
|
|
256
|
+
<td className="s-w-1 s-cursor-pointer s-pl-1 s-text-element-600">
|
|
257
|
+
{moreMenuItems && (
|
|
258
|
+
<DropdownMenu className="s-mr-1.5 s-flex">
|
|
239
259
|
<DropdownMenu.Button
|
|
240
260
|
onClick={(e) => {
|
|
241
261
|
e.stopPropagation();
|
|
242
262
|
}}
|
|
243
263
|
>
|
|
244
|
-
<
|
|
264
|
+
<IconButton icon={MoreIcon} size="sm" variant="tertiary" />
|
|
245
265
|
</DropdownMenu.Button>
|
|
246
266
|
<DropdownMenu.Items origin="topRight" width={220}>
|
|
247
267
|
{moreMenuItems?.map((item, index) => (
|
|
@@ -249,8 +269,8 @@ DataTable.Row = function Row({
|
|
|
249
269
|
))}
|
|
250
270
|
</DropdownMenu.Items>
|
|
251
271
|
</DropdownMenu>
|
|
252
|
-
|
|
253
|
-
|
|
272
|
+
)}
|
|
273
|
+
</td>
|
|
254
274
|
</tr>
|
|
255
275
|
);
|
|
256
276
|
};
|
|
@@ -263,7 +283,7 @@ DataTable.Cell = function Cell({ children, className, ...props }: CellProps) {
|
|
|
263
283
|
return (
|
|
264
284
|
<td
|
|
265
285
|
className={classNames(
|
|
266
|
-
"s-
|
|
286
|
+
"s-h-12 s-whitespace-nowrap s-pl-1.5 s-text-element-800",
|
|
267
287
|
className || ""
|
|
268
288
|
)}
|
|
269
289
|
{...props}
|
|
@@ -293,7 +313,10 @@ DataTable.CellContent = function CellContent({
|
|
|
293
313
|
...props
|
|
294
314
|
}: CellContentProps) {
|
|
295
315
|
return (
|
|
296
|
-
<div
|
|
316
|
+
<div
|
|
317
|
+
className={classNames("s-flex s-items-center s-py-2", className || "")}
|
|
318
|
+
{...props}
|
|
319
|
+
>
|
|
297
320
|
{avatarUrl && (
|
|
298
321
|
<Avatar
|
|
299
322
|
visual={avatarUrl}
|
package/src/components/Item.tsx
CHANGED
package/src/components/Tree.tsx
CHANGED
|
@@ -23,6 +23,8 @@ export function Tree({
|
|
|
23
23
|
variant = "finder",
|
|
24
24
|
}: TreeProps) {
|
|
25
25
|
const modifiedChildren = React.Children.map(children, (child) => {
|
|
26
|
+
// /!\ Limitation: This stops on the first invalid element.
|
|
27
|
+
// Meaning that if Tree.Item is not the first child, it will not work.
|
|
26
28
|
if (React.isValidElement<TreeItemProps>(child)) {
|
|
27
29
|
// Clone the child element and pass the necessary props
|
|
28
30
|
const childProps: Partial<TreeItemProps> = {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
|
|
3
|
+
// Define breakpoints
|
|
4
|
+
export const breakpoints = {
|
|
5
|
+
xs: 0,
|
|
6
|
+
sm: 640,
|
|
7
|
+
md: 768,
|
|
8
|
+
lg: 1024,
|
|
9
|
+
xl: 1280,
|
|
10
|
+
xxl: 1536,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
// Helper function to determine active breakpoint
|
|
14
|
+
function getActiveBreakpoint(width: number): keyof typeof breakpoints {
|
|
15
|
+
if (width >= breakpoints.xxl) {
|
|
16
|
+
return "xxl";
|
|
17
|
+
}
|
|
18
|
+
if (width >= breakpoints.xl) {
|
|
19
|
+
return "xl";
|
|
20
|
+
}
|
|
21
|
+
if (width >= breakpoints.lg) {
|
|
22
|
+
return "lg";
|
|
23
|
+
}
|
|
24
|
+
if (width >= breakpoints.md) {
|
|
25
|
+
return "md";
|
|
26
|
+
}
|
|
27
|
+
if (width >= breakpoints.sm) {
|
|
28
|
+
return "sm";
|
|
29
|
+
}
|
|
30
|
+
return "xs";
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface WindowSizeState {
|
|
34
|
+
width: number | undefined;
|
|
35
|
+
height: number | undefined;
|
|
36
|
+
activeBreakpoint: keyof typeof breakpoints;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Custom hook to get window size and active breakpoint
|
|
40
|
+
export function useWindowSize() {
|
|
41
|
+
const [windowSize, setWindowSize] = useState<WindowSizeState>({
|
|
42
|
+
width: undefined,
|
|
43
|
+
height: undefined,
|
|
44
|
+
activeBreakpoint: "xs",
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
function handleResize() {
|
|
49
|
+
const width = window.innerWidth;
|
|
50
|
+
setWindowSize({
|
|
51
|
+
width,
|
|
52
|
+
height: window.innerHeight,
|
|
53
|
+
activeBreakpoint: getActiveBreakpoint(width),
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
window.addEventListener("resize", handleResize);
|
|
58
|
+
handleResize();
|
|
59
|
+
|
|
60
|
+
return () => window.removeEventListener("resize", handleResize);
|
|
61
|
+
}, []);
|
|
62
|
+
|
|
63
|
+
return windowSize;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export default useWindowSize;
|
package/src/icons/solid/index.ts
CHANGED