@dust-tt/sparkle 0.2.210 → 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.
Files changed (147) hide show
  1. package/dist/cjs/_index.d.ts +4 -4
  2. package/dist/cjs/components/Checkbox.d.ts +3 -3
  3. package/dist/cjs/components/Item.d.ts +1 -1
  4. package/dist/cjs/components/Tree.d.ts +11 -6
  5. package/dist/cjs/icons/solid/ArrowDownS.d.ts +4 -0
  6. package/dist/cjs/icons/solid/ArrowLeftS.d.ts +4 -0
  7. package/dist/cjs/icons/solid/ArrowRightS.d.ts +4 -0
  8. package/dist/cjs/icons/solid/ArrowUpS.d.ts +4 -0
  9. package/dist/cjs/icons/solid/ChevronDoubleLeft.d.ts +4 -0
  10. package/dist/cjs/icons/solid/ChevronDoubleRight.d.ts +4 -0
  11. package/dist/cjs/icons/solid/Company.d.ts +4 -0
  12. package/dist/cjs/icons/solid/Filter.d.ts +4 -0
  13. package/dist/cjs/icons/solid/Heart.d.ts +4 -0
  14. package/dist/cjs/icons/solid/History.d.ts +4 -0
  15. package/dist/cjs/icons/solid/Home.d.ts +4 -0
  16. package/dist/cjs/icons/solid/MarkPen.d.ts +4 -0
  17. package/dist/cjs/icons/solid/Translate.d.ts +4 -0
  18. package/dist/cjs/icons/solid/index.d.ts +13 -0
  19. package/dist/cjs/icons/stroke/ArrowDownS.d.ts +4 -0
  20. package/dist/cjs/icons/stroke/ArrowLeftS.d.ts +4 -0
  21. package/dist/cjs/icons/stroke/ArrowRightS.d.ts +4 -0
  22. package/dist/cjs/icons/stroke/ArrowUpS.d.ts +4 -0
  23. package/dist/cjs/icons/stroke/ChevronDoubleLeft.d.ts +4 -0
  24. package/dist/cjs/icons/stroke/ChevronDoubleRight.d.ts +4 -0
  25. package/dist/cjs/icons/stroke/Company.d.ts +4 -0
  26. package/dist/cjs/icons/stroke/Filter.d.ts +4 -0
  27. package/dist/cjs/icons/stroke/Heart.d.ts +4 -0
  28. package/dist/cjs/icons/stroke/History.d.ts +4 -0
  29. package/dist/cjs/icons/stroke/Home.d.ts +4 -0
  30. package/dist/cjs/icons/stroke/MarkPen.d.ts +4 -0
  31. package/dist/cjs/icons/stroke/Translate.d.ts +4 -0
  32. package/dist/cjs/icons/stroke/index.d.ts +13 -0
  33. package/dist/cjs/index.js +4414 -4256
  34. package/dist/cjs/index.js.map +1 -1
  35. package/dist/cjs/stories/Checkbox.stories.d.ts +2 -0
  36. package/dist/cjs/stories/Tree.stories.d.ts +0 -1
  37. package/dist/esm/_index.d.ts +4 -4
  38. package/dist/esm/components/Checkbox.d.ts +3 -3
  39. package/dist/esm/components/Item.d.ts +1 -1
  40. package/dist/esm/components/Tree.d.ts +11 -6
  41. package/dist/esm/icons/solid/ArrowDownS.d.ts +4 -0
  42. package/dist/esm/icons/solid/ArrowLeftS.d.ts +4 -0
  43. package/dist/esm/icons/solid/ArrowRightS.d.ts +4 -0
  44. package/dist/esm/icons/solid/ArrowUpS.d.ts +4 -0
  45. package/dist/esm/icons/solid/ChevronDoubleLeft.d.ts +4 -0
  46. package/dist/esm/icons/solid/ChevronDoubleRight.d.ts +4 -0
  47. package/dist/esm/icons/solid/Company.d.ts +4 -0
  48. package/dist/esm/icons/solid/Filter.d.ts +4 -0
  49. package/dist/esm/icons/solid/Heart.d.ts +4 -0
  50. package/dist/esm/icons/solid/History.d.ts +4 -0
  51. package/dist/esm/icons/solid/Home.d.ts +4 -0
  52. package/dist/esm/icons/solid/MarkPen.d.ts +4 -0
  53. package/dist/esm/icons/solid/Translate.d.ts +4 -0
  54. package/dist/esm/icons/solid/index.d.ts +13 -0
  55. package/dist/esm/icons/stroke/ArrowDownS.d.ts +4 -0
  56. package/dist/esm/icons/stroke/ArrowLeftS.d.ts +4 -0
  57. package/dist/esm/icons/stroke/ArrowRightS.d.ts +4 -0
  58. package/dist/esm/icons/stroke/ArrowUpS.d.ts +4 -0
  59. package/dist/esm/icons/stroke/ChevronDoubleLeft.d.ts +4 -0
  60. package/dist/esm/icons/stroke/ChevronDoubleRight.d.ts +4 -0
  61. package/dist/esm/icons/stroke/Company.d.ts +4 -0
  62. package/dist/esm/icons/stroke/Filter.d.ts +4 -0
  63. package/dist/esm/icons/stroke/Heart.d.ts +4 -0
  64. package/dist/esm/icons/stroke/History.d.ts +4 -0
  65. package/dist/esm/icons/stroke/Home.d.ts +4 -0
  66. package/dist/esm/icons/stroke/MarkPen.d.ts +4 -0
  67. package/dist/esm/icons/stroke/Translate.d.ts +4 -0
  68. package/dist/esm/icons/stroke/index.d.ts +13 -0
  69. package/dist/esm/index.js +4391 -4259
  70. package/dist/esm/index.js.map +1 -1
  71. package/dist/esm/stories/Checkbox.stories.d.ts +2 -0
  72. package/dist/esm/stories/Tree.stories.d.ts +0 -1
  73. package/dist/tsconfig.tsbuildinfo +1 -1
  74. package/package.json +1 -1
  75. package/src/_index.ts +52 -0
  76. package/src/components/Checkbox.tsx +42 -12
  77. package/src/components/Item.tsx +1 -1
  78. package/src/components/Tree.tsx +89 -67
  79. package/src/components/WindowUtility.tsx +1 -2
  80. package/src/icons/solid/ArrowDownS.tsx +15 -0
  81. package/src/icons/solid/ArrowLeftS.tsx +15 -0
  82. package/src/icons/solid/ArrowRightS.tsx +15 -0
  83. package/src/icons/solid/ArrowUpS.tsx +15 -0
  84. package/src/icons/solid/ChevronDoubleLeft.tsx +22 -0
  85. package/src/icons/solid/ChevronDoubleRight.tsx +22 -0
  86. package/src/icons/solid/Company.tsx +20 -0
  87. package/src/icons/solid/Filter.tsx +18 -0
  88. package/src/icons/solid/Heart.tsx +18 -0
  89. package/src/icons/solid/History.tsx +18 -0
  90. package/src/icons/solid/Home.tsx +20 -0
  91. package/src/icons/solid/MarkPen.tsx +18 -0
  92. package/src/icons/solid/Translate.tsx +18 -0
  93. package/src/icons/solid/index.ts +13 -0
  94. package/src/icons/src/solid/arrow-down-s.svg +3 -0
  95. package/src/icons/src/solid/arrow-left-s.svg +3 -0
  96. package/src/icons/src/solid/arrow-right-s.svg +3 -0
  97. package/src/icons/src/solid/arrow-up-s.svg +3 -0
  98. package/src/icons/src/solid/chevron-double-left.svg +4 -0
  99. package/src/icons/src/solid/chevron-double-right.svg +4 -0
  100. package/src/icons/src/solid/company.svg +3 -0
  101. package/src/icons/src/solid/filter.svg +3 -0
  102. package/src/icons/src/solid/heart.svg +3 -0
  103. package/src/icons/src/solid/history.svg +3 -0
  104. package/src/icons/src/solid/home.svg +3 -0
  105. package/src/icons/src/solid/mark-pen.svg +3 -0
  106. package/src/icons/src/solid/translate.svg +3 -0
  107. package/src/icons/src/stroke/arrow-down-s.svg +3 -0
  108. package/src/icons/src/stroke/arrow-left-s.svg +3 -0
  109. package/src/icons/src/stroke/arrow-right-s.svg +3 -0
  110. package/src/icons/src/stroke/arrow-up-s.svg +3 -0
  111. package/src/icons/src/stroke/chevron-double-left.svg +4 -0
  112. package/src/icons/src/stroke/chevron-double-right.svg +4 -0
  113. package/src/icons/src/stroke/company.svg +9 -0
  114. package/src/icons/src/stroke/filter.svg +3 -0
  115. package/src/icons/src/stroke/heart.svg +3 -0
  116. package/src/icons/src/stroke/history.svg +3 -0
  117. package/src/icons/src/stroke/home.svg +3 -0
  118. package/src/icons/src/stroke/mark-pen.svg +3 -0
  119. package/src/icons/src/stroke/translate.svg +3 -0
  120. package/src/icons/stroke/ArrowDownS.tsx +15 -0
  121. package/src/icons/stroke/ArrowLeftS.tsx +15 -0
  122. package/src/icons/stroke/ArrowRightS.tsx +15 -0
  123. package/src/icons/stroke/ArrowUpS.tsx +15 -0
  124. package/src/icons/stroke/ChevronDoubleLeft.tsx +16 -0
  125. package/src/icons/stroke/ChevronDoubleRight.tsx +16 -0
  126. package/src/icons/stroke/Company.tsx +24 -0
  127. package/src/icons/stroke/Filter.tsx +15 -0
  128. package/src/icons/stroke/Heart.tsx +20 -0
  129. package/src/icons/stroke/History.tsx +18 -0
  130. package/src/icons/stroke/Home.tsx +20 -0
  131. package/src/icons/stroke/MarkPen.tsx +18 -0
  132. package/src/icons/stroke/Translate.tsx +18 -0
  133. package/src/icons/stroke/index.ts +13 -0
  134. package/src/logo/src/platforms/Zendesk.svg +6 -0
  135. package/src/lottie/collapseBar.ts +124 -124
  136. package/src/lottie/spinnerColor.ts +337 -337
  137. package/src/lottie/spinnerColorLG.ts +824 -824
  138. package/src/lottie/spinnerColorXS.ts +187 -187
  139. package/src/lottie/spinnerDark.ts +353 -353
  140. package/src/lottie/spinnerDarkLG.ts +824 -824
  141. package/src/lottie/spinnerDarkXS.ts +218 -218
  142. package/src/lottie/spinnerLight.ts +342 -342
  143. package/src/lottie/spinnerLightLG.ts +797 -797
  144. package/src/lottie/spinnerLightXS.ts +215 -215
  145. package/src/stories/Checkbox.stories.tsx +75 -6
  146. package/src/stories/Tree.stories.tsx +197 -226
  147. package/src/styles/tailwind.css +7 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dust-tt/sparkle",
3
- "version": "0.2.210",
3
+ "version": "0.2.211",
4
4
  "scripts": {
5
5
  "build": "rm -rf dist && rollup -c",
6
6
  "build:with-tw-base": "rollup -c --environment INCLUDE_TW_BASE:true",
package/src/_index.ts CHANGED
@@ -252,11 +252,15 @@ import {
252
252
  ArrowDown as ArrowDownIcon,
253
253
  ArrowDownCircle as ArrowDownCircleIcon,
254
254
  ArrowDownOnSquare as ArrowDownOnSquareIcon,
255
+ ArrowDownS as ArrowDownSIcon,
255
256
  ArrowLeft as ArrowLeftIcon,
257
+ ArrowLeftS as ArrowLeftSIcon,
256
258
  ArrowPath as ArrowPathIcon,
257
259
  ArrowRight as ArrowRightIcon,
260
+ ArrowRightS as ArrowRightSIcon,
258
261
  ArrowUp as ArrowUpIcon,
259
262
  ArrowUpOnSquare as ArrowUpOnSquareIcon,
263
+ ArrowUpS as ArrowUpSIcon,
260
264
  Attachment as AttachmentIcon,
261
265
  Backspace as BackspaceIcon,
262
266
  Bookmark as BookmarkIcon,
@@ -269,6 +273,8 @@ import {
269
273
  ChatBubbleThought as ChatBubbleThoughtIcon,
270
274
  Check as CheckIcon,
271
275
  CheckCircle as CheckCircleIcon,
276
+ ChevronDoubleLeft as ChevronDoubleLeftIcon,
277
+ ChevronDoubleRight as ChevronDoubleRightIcon,
272
278
  ChevronDown as ChevronDownIcon,
273
279
  ChevronLeft as ChevronLeftIcon,
274
280
  ChevronRight as ChevronRightIcon,
@@ -285,6 +291,7 @@ import {
285
291
  Cog6Tooth as Cog6ToothIcon,
286
292
  Command as CommandIcon,
287
293
  CommandLine as CommandLineIcon,
294
+ Company as CompanyIcon,
288
295
  Cube as CubeIcon,
289
296
  Dash as DashIcon,
290
297
  Document as DocumentIcon,
@@ -299,6 +306,7 @@ import {
299
306
  ExternalLink as ExternalLinkIcon,
300
307
  Eye as EyeIcon,
301
308
  EyeSlash as EyeSlashIcon,
309
+ Filter as FilterIcon,
302
310
  Fire as FireIcon,
303
311
  Flag as FlagIcon,
304
312
  Folder as FolderIcon,
@@ -309,8 +317,11 @@ import {
309
317
  Grab as GrabIcon,
310
318
  HandThumbDown as HandThumbDownIcon,
311
319
  HandThumbUp as HandThumbUpIcon,
320
+ Heart as HeartIcon,
312
321
  HeartAlt as HeartAltIcon,
313
322
  Hexagon as HexagonIcon,
323
+ History as HistoryIcon,
324
+ Home as HomeIcon,
314
325
  Image as ImageIcon,
315
326
  InformationCircle as InformationCircleIcon,
316
327
  Key as KeyIcon,
@@ -325,6 +336,7 @@ import {
325
336
  Logout as LogoutIcon,
326
337
  Magic as MagicIcon,
327
338
  MagnifyingGlass as MagnifyingGlassIcon,
339
+ MarkPen as MarkPenIcon,
328
340
  Menu as MenuIcon,
329
341
  More as MoreIcon,
330
342
  MovingMail as MovingMailIcon,
@@ -357,6 +369,7 @@ import {
357
369
  Template as TemplateIcon,
358
370
  TestTube as TestTubeIcon,
359
371
  Time as TimeIcon,
372
+ Translate as TranslateIcon,
360
373
  Trash as TrashIcon,
361
374
  Triangle as TriangleIcon,
362
375
  User as UserIcon,
@@ -372,11 +385,15 @@ export {
372
385
  ArrowDownCircleIcon,
373
386
  ArrowDownIcon,
374
387
  ArrowDownOnSquareIcon,
388
+ ArrowDownSIcon,
375
389
  ArrowLeftIcon,
390
+ ArrowLeftSIcon,
376
391
  ArrowPathIcon,
377
392
  ArrowRightIcon,
393
+ ArrowRightSIcon,
378
394
  ArrowUpIcon,
379
395
  ArrowUpOnSquareIcon,
396
+ ArrowUpSIcon,
380
397
  AttachmentIcon,
381
398
  BackspaceIcon,
382
399
  BookmarkIcon,
@@ -389,6 +406,8 @@ export {
389
406
  ChatBubbleThoughtIcon,
390
407
  CheckCircleIcon,
391
408
  CheckIcon,
409
+ ChevronDoubleLeftIcon,
410
+ ChevronDoubleRightIcon,
392
411
  ChevronDownIcon,
393
412
  ChevronLeftIcon,
394
413
  ChevronRightIcon,
@@ -405,6 +424,7 @@ export {
405
424
  Cog6ToothIcon,
406
425
  CommandIcon,
407
426
  CommandLineIcon,
427
+ CompanyIcon,
408
428
  CubeIcon,
409
429
  DashIcon,
410
430
  DocumentDuplicateIcon,
@@ -419,6 +439,7 @@ export {
419
439
  ExternalLinkIcon,
420
440
  EyeIcon,
421
441
  EyeSlashIcon,
442
+ FilterIcon,
422
443
  FireIcon,
423
444
  FlagIcon,
424
445
  FolderIcon,
@@ -430,7 +451,10 @@ export {
430
451
  HandThumbDownIcon,
431
452
  HandThumbUpIcon,
432
453
  HeartAltIcon,
454
+ HeartIcon,
433
455
  HexagonIcon,
456
+ HistoryIcon,
457
+ HomeIcon,
434
458
  ImageIcon,
435
459
  InformationCircleIcon,
436
460
  KeyIcon,
@@ -445,6 +469,7 @@ export {
445
469
  LogoutIcon,
446
470
  MagicIcon,
447
471
  MagnifyingGlassIcon,
472
+ MarkPenIcon,
448
473
  MenuIcon,
449
474
  MoreIcon,
450
475
  MovingMailIcon,
@@ -477,6 +502,7 @@ export {
477
502
  TemplateIcon,
478
503
  TestTubeIcon,
479
504
  TimeIcon,
505
+ TranslateIcon,
480
506
  TrashIcon,
481
507
  TriangleIcon,
482
508
  UserArrowIcon,
@@ -492,11 +518,15 @@ import {
492
518
  ArrowDown as ArrowDownStrokeIcon,
493
519
  ArrowDownCircle as ArrowDownCircleStrokeIcon,
494
520
  ArrowDownOnSquare as ArrowDownOnSquareStrokeIcon,
521
+ ArrowDownS as ArrowDownSStrokeIcon,
495
522
  ArrowLeft as ArrowLeftStrokeIcon,
523
+ ArrowLeftS as ArrowLeftSStrokeIcon,
496
524
  ArrowPath as ArrowPathStrokeIcon,
497
525
  ArrowRight as ArrowRightStrokeIcon,
526
+ ArrowRightS as ArrowRightSStrokeIcon,
498
527
  ArrowUp as ArrowUpStrokeIcon,
499
528
  ArrowUpOnSquare as ArrowUpOnSquareStrokeIcon,
529
+ ArrowUpS as ArrowUpSStrokeIcon,
500
530
  Attachment as AttachmentStrokeIcon,
501
531
  Backspace as BackspaceStrokeIcon,
502
532
  Bookmark as BookmarkStrokeIcon,
@@ -509,6 +539,8 @@ import {
509
539
  ChatBubbleThought as ChatBubbleThoughtStrokeIcon,
510
540
  Check as CheckStrokeIcon,
511
541
  CheckCircle as CheckCircleStrokeIcon,
542
+ ChevronDoubleLeft as ChevronDoubleLeftStrokeIcon,
543
+ ChevronDoubleRight as ChevronDoubleRightStrokeIcon,
512
544
  ChevronDown as ChevronDownStrokeIcon,
513
545
  ChevronLeft as ChevronLeftStrokeIcon,
514
546
  ChevronRight as ChevronRightStrokeIcon,
@@ -525,6 +557,7 @@ import {
525
557
  Cog6Tooth as Cog6ToothStrokeIcon,
526
558
  Command as CommandStrokeIcon,
527
559
  CommandLine as CommandLineStrokeIcon,
560
+ Company as CompanyStrokeIcon,
528
561
  Cube as CubeStrokeIcon,
529
562
  Dash as DashStrokeIcon,
530
563
  Document as DocumentStrokeIcon,
@@ -539,6 +572,7 @@ import {
539
572
  ExternalLink as ExternalLinkStrokeIcon,
540
573
  Eye as EyeStrokeIcon,
541
574
  EyeSlash as EyeSlashStrokeIcon,
575
+ Filter as FilterStrokeIcon,
542
576
  Fire as FireStrokeIcon,
543
577
  Flag as FlagStrokeIcon,
544
578
  Folder as FolderStrokeIcon,
@@ -549,8 +583,11 @@ import {
549
583
  Grab as GrabStrokeIcon,
550
584
  HandThumbDown as HandThumbDownStrokeIcon,
551
585
  HandThumbUp as HandThumbUpStrokeIcon,
586
+ Heart as HeartStrokeIcon,
552
587
  HeartAlt as HeartAltStrokeIcon,
553
588
  Hexagon as HexagonStrokeIcon,
589
+ History as HistoryStrokeIcon,
590
+ Home as HomeStrokeIcon,
554
591
  Image as ImageStrokeIcon,
555
592
  InformationCircle as InformationCircleStrokeIcon,
556
593
  Key as KeyStrokeIcon,
@@ -565,6 +602,7 @@ import {
565
602
  Logout as LogoutStrokeIcon,
566
603
  Magic as MagicStrokeIcon,
567
604
  MagnifyingGlass as MagnifyingGlassStrokeIcon,
605
+ MarkPen as MarkPenStrokeIcon,
568
606
  Menu as MenuStrokeIcon,
569
607
  More as MoreStrokeIcon,
570
608
  MovingMail as MovingMailStrokeIcon,
@@ -597,6 +635,7 @@ import {
597
635
  Template as TemplateStrokeIcon,
598
636
  TestTube as TestTubeStrokeIcon,
599
637
  Time as TimeStrokeIcon,
638
+ Translate as TranslateStrokeIcon,
600
639
  Trash as TrashStrokeIcon,
601
640
  Triangle as TriangleStrokeIcon,
602
641
  User as UserStrokeIcon,
@@ -611,11 +650,15 @@ import {
611
650
  export {
612
651
  ArrowDownCircleStrokeIcon,
613
652
  ArrowDownOnSquareStrokeIcon,
653
+ ArrowDownSStrokeIcon,
614
654
  ArrowDownStrokeIcon,
655
+ ArrowLeftSStrokeIcon,
615
656
  ArrowLeftStrokeIcon,
616
657
  ArrowPathStrokeIcon,
658
+ ArrowRightSStrokeIcon,
617
659
  ArrowRightStrokeIcon,
618
660
  ArrowUpOnSquareStrokeIcon,
661
+ ArrowUpSStrokeIcon,
619
662
  ArrowUpStrokeIcon,
620
663
  AttachmentStrokeIcon,
621
664
  BackspaceStrokeIcon,
@@ -629,6 +672,8 @@ export {
629
672
  ChatBubbleThoughtStrokeIcon,
630
673
  CheckCircleStrokeIcon,
631
674
  CheckStrokeIcon,
675
+ ChevronDoubleLeftStrokeIcon,
676
+ ChevronDoubleRightStrokeIcon,
632
677
  ChevronDownStrokeIcon,
633
678
  ChevronLeftStrokeIcon,
634
679
  ChevronRightStrokeIcon,
@@ -645,6 +690,7 @@ export {
645
690
  Cog6ToothStrokeIcon,
646
691
  CommandLineStrokeIcon,
647
692
  CommandStrokeIcon,
693
+ CompanyStrokeIcon,
648
694
  CubeStrokeIcon,
649
695
  DashStrokeIcon,
650
696
  DocumentDuplicateStrokeIcon,
@@ -659,6 +705,7 @@ export {
659
705
  ExternalLinkStrokeIcon,
660
706
  EyeSlashStrokeIcon,
661
707
  EyeStrokeIcon,
708
+ FilterStrokeIcon,
662
709
  FireStrokeIcon,
663
710
  FlagStrokeIcon,
664
711
  FolderOpenStrokeIcon,
@@ -670,7 +717,10 @@ export {
670
717
  HandThumbDownStrokeIcon,
671
718
  HandThumbUpStrokeIcon,
672
719
  HeartAltStrokeIcon,
720
+ HeartStrokeIcon,
673
721
  HexagonStrokeIcon,
722
+ HistoryStrokeIcon,
723
+ HomeStrokeIcon,
674
724
  ImageStrokeIcon,
675
725
  InformationCircleStrokeIcon,
676
726
  KeyStrokeIcon,
@@ -685,6 +735,7 @@ export {
685
735
  LogoutStrokeIcon,
686
736
  MagicStrokeIcon,
687
737
  MagnifyingGlassStrokeIcon,
738
+ MarkPenStrokeIcon,
688
739
  MenuStrokeIcon,
689
740
  MoreStrokeIcon,
690
741
  MovingMailStrokeIcon,
@@ -717,6 +768,7 @@ export {
717
768
  TemplateStrokeIcon,
718
769
  TestTubeStrokeIcon,
719
770
  TimeStrokeIcon,
771
+ TranslateStrokeIcon,
720
772
  TrashStrokeIcon,
721
773
  TriangleStrokeIcon,
722
774
  UserArrowStrokeIcon,
@@ -7,23 +7,42 @@ import { Icon } from "./Icon";
7
7
 
8
8
  export interface CheckboxProps {
9
9
  variant?: "selectable" | "checkable";
10
- checked: boolean;
10
+ size?: "xs" | "sm";
11
+ checked?: "checked" | "unchecked" | "partial";
11
12
  disabled?: boolean;
12
- partialChecked?: boolean;
13
13
  onChange: (checked: boolean) => void;
14
14
  className?: string;
15
15
  }
16
16
 
17
17
  export function Checkbox({
18
18
  variant = "selectable",
19
- checked,
19
+ checked = "unchecked",
20
+ size = "sm",
20
21
  onChange,
21
22
  className = "",
22
23
  disabled,
23
- partialChecked,
24
24
  }: CheckboxProps) {
25
+ let isChecked: boolean;
26
+ let isPartialChecked: boolean;
27
+ switch (checked) {
28
+ case "checked":
29
+ isChecked = true;
30
+ isPartialChecked = false;
31
+ break;
32
+ case "unchecked":
33
+ isChecked = false;
34
+ isPartialChecked = false;
35
+ break;
36
+ case "partial":
37
+ isChecked = true;
38
+ isPartialChecked = true;
39
+ break;
40
+ default:
41
+ throw new Error("Invalid checked prop");
42
+ }
43
+
25
44
  const baseStyleClasses = {
26
- base: "s-border s-justify-center s-w-5 s-h-5 s-rounded-md s-flex s-items-center s-transition-colors s-duration-300 s-ease-out",
45
+ base: "s-border s-justify-center s-flex s-items-center s-transition-colors s-duration-300 s-ease-out",
27
46
  idle: "s-bg-structure-50 s-border-element-600 s-cursor-pointer",
28
47
  hover:
29
48
  "hover:s-border-action-500 hover:s-bg-action-200 hover:s-text-white/100",
@@ -37,6 +56,11 @@ export function Checkbox({
37
56
  },
38
57
  };
39
58
 
59
+ const baseSizeClasses = {
60
+ xs: "s-w-4 s-h-4 s-rounded",
61
+ sm: "s-w-5 s-h-5 s-rounded-md",
62
+ };
63
+
40
64
  const checkedIndicatorClasses = {
41
65
  base: "s-transition s-duration-300 s-ease-in-out",
42
66
  selected: "s-opacity-100 s-bg-action-500 dark:s-bg-action-500-dark",
@@ -45,9 +69,15 @@ export function Checkbox({
45
69
  disabled: "s-opacity-100 s-bg-element-500 dark:s-bg-element-500-dark",
46
70
  };
47
71
 
72
+ const sizeStyles = {
73
+ xs: { width: "12px", height: "12px", borderRadius: "2px" },
74
+ sm: { width: "14px", height: "14px", borderRadius: "3px" },
75
+ };
76
+
48
77
  const combinedBaseClasses = classNames(
49
78
  baseStyleClasses.base,
50
- checked || partialChecked ? "s-text-white" : "s-text-white/0",
79
+ baseSizeClasses[size],
80
+ isChecked || isPartialChecked ? "s-text-white" : "s-text-white/0",
51
81
  disabled ? baseStyleClasses.disabled : baseStyleClasses.idle,
52
82
  !disabled ? baseStyleClasses.hover : "",
53
83
  disabled ? baseStyleClasses.dark.disabled : baseStyleClasses.dark.base,
@@ -58,18 +88,18 @@ export function Checkbox({
58
88
  const combinedCheckedIndicatorClasses = classNames(
59
89
  checkedIndicatorClasses.base,
60
90
  disabled ? checkedIndicatorClasses.disabled : "",
61
- checked && !partialChecked && !disabled
91
+ isChecked && !isPartialChecked && !disabled
62
92
  ? checkedIndicatorClasses.selected
63
93
  : "",
64
- partialChecked && !disabled ? checkedIndicatorClasses.partialChecked : "",
65
- !checked && !disabled ? checkedIndicatorClasses.unselected : ""
94
+ isPartialChecked && !disabled ? checkedIndicatorClasses.partialChecked : "",
95
+ !isChecked && !disabled ? checkedIndicatorClasses.unselected : ""
66
96
  );
67
97
 
68
98
  return (
69
99
  <label>
70
100
  <input
71
101
  type="checkbox"
72
- checked={checked}
102
+ checked={isChecked}
73
103
  onChange={(e) => onChange && onChange(e.target.checked)}
74
104
  className="s-hidden"
75
105
  disabled={disabled}
@@ -77,11 +107,11 @@ export function Checkbox({
77
107
  <div className={classNames(combinedBaseClasses, "s-relative")}>
78
108
  <div
79
109
  className={combinedCheckedIndicatorClasses}
80
- style={{ width: "14px", height: "14px", borderRadius: "3px" }}
110
+ style={sizeStyles[size]}
81
111
  />
82
112
  {variant === "checkable" && (
83
113
  <div className="s-absolute">
84
- <Icon visual={partialChecked ? Dash : Check} size="xs" />
114
+ <Icon visual={isPartialChecked ? Dash : Check} size="xs" />
85
115
  </div>
86
116
  )}
87
117
  </div>
@@ -74,7 +74,7 @@ export function Item({
74
74
  disabled = false,
75
75
  className = "",
76
76
  href,
77
- target
77
+ target,
78
78
  }: ItemProps) {
79
79
  const { components } = React.useContext(SparkleContext);
80
80
 
@@ -1,12 +1,6 @@
1
- import React, { useState } from "react";
2
-
3
- import {
4
- ChatBubbleBottomCenterText,
5
- DocumentText,
6
- Folder,
7
- Square3Stack3D,
8
- } from "@sparkle/icons/stroke";
9
- import { ChevronDownIcon, ChevronRightIcon, Spinner } from "@sparkle/index";
1
+ import React, { ComponentType, ReactNode, useState } from "react";
2
+
3
+ import { ArrowDownSIcon, ArrowRightSIcon, Spinner } from "@sparkle/index";
10
4
  import { classNames } from "@sparkle/lib/utils";
11
5
 
12
6
  import { Checkbox, CheckboxProps } from "./Checkbox";
@@ -14,12 +8,40 @@ import { Icon } from "./Icon";
14
8
  import { IconButton } from "./IconButton";
15
9
 
16
10
  export interface TreeProps {
17
- children?: React.ReactNode;
11
+ children?: ReactNode;
18
12
  isBoxed?: boolean;
19
13
  isLoading?: boolean;
14
+ tailwindIconTextColor?: string;
15
+ variant?: "navigator" | "finder";
20
16
  }
21
17
 
22
- export function Tree({ children, isLoading, isBoxed = false }: TreeProps) {
18
+ export function Tree({
19
+ children,
20
+ isLoading,
21
+ isBoxed = false,
22
+ tailwindIconTextColor,
23
+ variant = "finder",
24
+ }: TreeProps) {
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.
28
+ if (React.isValidElement<TreeItemProps>(child)) {
29
+ // Clone the child element and pass the necessary props
30
+ const childProps: Partial<TreeItemProps> = {};
31
+
32
+ if (variant === "navigator") {
33
+ childProps.isNavigatable = true;
34
+ }
35
+
36
+ if (tailwindIconTextColor) {
37
+ childProps.tailwindIconTextColor = tailwindIconTextColor;
38
+ }
39
+
40
+ return React.cloneElement(child, childProps);
41
+ }
42
+ return child;
43
+ });
44
+
23
45
  return isLoading ? (
24
46
  <div className="s-py-2 s-pl-4">
25
47
  <Spinner size="xs" variant="dark" />
@@ -29,28 +51,21 @@ export function Tree({ children, isLoading, isBoxed = false }: TreeProps) {
29
51
  className={classNames(
30
52
  "s-flex s-flex-col s-gap-1 s-overflow-hidden",
31
53
  isBoxed
32
- ? "s- s-rounded-xl s-border s-border-structure-200 s-bg-structure-50 s-p-4"
54
+ ? "s-rounded-xl s-border s-border-structure-200 s-bg-structure-50 s-p-4"
33
55
  : ""
34
56
  )}
35
57
  >
36
- {children}
58
+ {modifiedChildren}
37
59
  </div>
38
60
  );
39
61
  }
40
62
 
41
- const visualTable = {
42
- file: DocumentText,
43
- folder: Folder,
44
- database: Square3Stack3D,
45
- channel: ChatBubbleBottomCenterText,
46
- };
47
-
48
63
  interface TreeItemProps {
49
64
  label?: string;
50
65
  type?: "node" | "item" | "leaf";
51
- variant?: "file" | "folder" | "database" | "channel";
52
66
  size?: "sm" | "md";
53
- visual?: React.ReactNode;
67
+ tailwindIconTextColor?: string;
68
+ visual?: ComponentType<{ className?: string }>;
54
69
  checkbox?: CheckboxProps;
55
70
  onChevronClick?: () => void;
56
71
  collapsed?: boolean;
@@ -58,6 +73,7 @@ interface TreeItemProps {
58
73
  className?: string;
59
74
  actions?: React.ReactNode;
60
75
  areActionsFading?: boolean;
76
+ isNavigatable?: boolean;
61
77
  isSelected?: boolean;
62
78
  onItemClick?: () => void;
63
79
  }
@@ -76,8 +92,8 @@ Tree.Item = function ({
76
92
  label,
77
93
  type = "node",
78
94
  className = "",
79
- variant = "file",
80
95
  size = "sm",
96
+ tailwindIconTextColor = "s-text-element-600",
81
97
  visual,
82
98
  checkbox,
83
99
  onChevronClick,
@@ -87,6 +103,7 @@ Tree.Item = function ({
87
103
  areActionsFading = true,
88
104
  renderTreeItems,
89
105
  children,
106
+ isNavigatable = false,
90
107
  isSelected = false,
91
108
  onItemClick,
92
109
  }: TreeItemPropsWithChildren | TreeItemPropsWithRender) {
@@ -111,16 +128,34 @@ Tree.Item = function ({
111
128
 
112
129
  const childrenToRender = getChildren();
113
130
 
131
+ const treeItemStyleClasses = {
132
+ base: "s-group s-flex s-cursor-default s-flex-row s-items-center",
133
+ isNavigatableBase:
134
+ "s-border s-transition-colors s-duration-300 s-ease-out s-cursor-pointer",
135
+ isNavigatableUnselected:
136
+ "s-border-structure-200/0 s-bg-white/0 hover:s-border-structure-200 hover:s-bg-white",
137
+ isNavigatableSelected: "s-border-structure-200 s-bg-white",
138
+ };
139
+
114
140
  return (
115
141
  <>
116
142
  <div
117
143
  className={classNames(
118
144
  className ? className : "",
119
- "s-group s-flex s-cursor-default s-flex-row s-items-center s-gap-4",
120
- size === "sm" ? "s-py-1" : "s-py-2",
145
+ treeItemStyleClasses.base,
121
146
  onItemClick ? "s-cursor-pointer" : "",
122
- isSelected
123
- ? "s-rounded-md s-border s-border-neutral-200 s-bg-white"
147
+ isNavigatable ? treeItemStyleClasses.isNavigatableBase : "",
148
+ isNavigatable
149
+ ? size === "sm"
150
+ ? "s-gap-1 s-rounded-lg s-py-1 s-pl-1.5 s-pr-3"
151
+ : "s-gap-2 s-rounded-lg s-py-2 s-pl-2.5 s-pr-4"
152
+ : size === "sm"
153
+ ? "s-gap-1 s-py-1"
154
+ : "s-gap-2 s-py-2",
155
+ isNavigatable
156
+ ? isSelected
157
+ ? treeItemStyleClasses.isNavigatableSelected
158
+ : treeItemStyleClasses.isNavigatableUnselected
124
159
  : ""
125
160
  )}
126
161
  onClick={onItemClick ? onItemClick : undefined}
@@ -129,10 +164,10 @@ Tree.Item = function ({
129
164
  <IconButton
130
165
  icon={
131
166
  childrenToRender && !effectiveCollapsed
132
- ? ChevronDownIcon
133
- : ChevronRightIcon
167
+ ? ArrowDownSIcon
168
+ : ArrowRightSIcon
134
169
  }
135
- size="sm"
170
+ size="xs"
136
171
  variant="secondary"
137
172
  onClick={(e) => {
138
173
  e.stopPropagation();
@@ -143,50 +178,37 @@ Tree.Item = function ({
143
178
  />
144
179
  )}
145
180
  {type === "leaf" && <div className="s-w-5"></div>}
146
- {checkbox && <Checkbox {...checkbox} />}
147
-
148
- <div className="s-flex s-w-full s-items-center">
181
+ {checkbox && <Checkbox {...checkbox} size="xs" />}
182
+ <Icon
183
+ visual={visual}
184
+ size={size === "sm" ? "sm" : "md"}
185
+ className={classNames("s-flex-shrink-0", tailwindIconTextColor)}
186
+ />
187
+
188
+ <div
189
+ className={classNames(
190
+ "s-truncate s-font-medium s-text-element-900",
191
+ size === "sm" ? "s-ml-1 s-text-sm" : "s-ml-1 s-text-base"
192
+ )}
193
+ >
194
+ {label}
195
+ </div>
196
+ <div className="s-grow" />
197
+ {actions && (
149
198
  <div
150
199
  className={classNames(
151
- "s-grid s-w-full s-grid-cols-[auto,1fr,auto] s-items-center",
152
- size === "sm" ? "s-gap-1.5" : "s-gap-2"
200
+ "s-flex s-gap-2 s-pl-4",
201
+ areActionsFading
202
+ ? "s-transform s-opacity-0 s-duration-300 group-hover:s-opacity-100"
203
+ : ""
153
204
  )}
154
205
  >
155
- {visual ? (
156
- visual
157
- ) : (
158
- <Icon
159
- visual={visualTable[variant]}
160
- size="sm"
161
- className="s-flex-shrink-0 s-text-element-700"
162
- />
163
- )}
164
-
165
- <div
166
- className={classNames(
167
- "s-truncate s-font-medium s-text-element-900",
168
- size === "sm" ? "s-text-sm" : "s-text-base"
169
- )}
170
- >
171
- {label}
172
- </div>
173
- {actions && (
174
- <div
175
- className={classNames(
176
- "s-inline-block s-pl-5",
177
- areActionsFading
178
- ? "s-transform s-opacity-0 s-duration-300 group-hover:s-opacity-100"
179
- : ""
180
- )}
181
- >
182
- {actions}
183
- </div>
184
- )}
206
+ {actions}
185
207
  </div>
186
- </div>
208
+ )}
187
209
  </div>
188
210
  {React.Children.count(childrenToRender) > 0 && (
189
- <div className="s-pl-5">{childrenToRender}</div>
211
+ <div className="s-pl-2.5">{childrenToRender}</div>
190
212
  )}
191
213
  </>
192
214
  );
@@ -30,7 +30,6 @@ function getActiveBreakpoint(width: number): keyof typeof breakpoints {
30
30
  return "xs";
31
31
  }
32
32
 
33
-
34
33
  interface WindowSizeState {
35
34
  width: number | undefined;
36
35
  height: number | undefined;
@@ -42,7 +41,7 @@ export function useWindowSize() {
42
41
  const [windowSize, setWindowSize] = useState<WindowSizeState>({
43
42
  width: undefined,
44
43
  height: undefined,
45
- activeBreakpoint: "xs"
44
+ activeBreakpoint: "xs",
46
45
  });
47
46
 
48
47
  useEffect(() => {
@@ -0,0 +1,15 @@
1
+ import type { SVGProps } from "react";
2
+ import * as React from "react";
3
+ const SvgArrowDownS = (props: SVGProps<SVGSVGElement>) => (
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ width="1em"
7
+ height="1em"
8
+ fill="none"
9
+ viewBox="0 0 24 24"
10
+ {...props}
11
+ >
12
+ <path fill="currentColor" d="m12 16-6-6h12l-6 6Z" />
13
+ </svg>
14
+ );
15
+ export default SvgArrowDownS;
@@ -0,0 +1,15 @@
1
+ import type { SVGProps } from "react";
2
+ import * as React from "react";
3
+ const SvgArrowLeftS = (props: SVGProps<SVGSVGElement>) => (
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ width="1em"
7
+ height="1em"
8
+ fill="none"
9
+ viewBox="0 0 24 24"
10
+ {...props}
11
+ >
12
+ <path fill="currentColor" d="m8 12 6-6v12l-6-6Z" />
13
+ </svg>
14
+ );
15
+ export default SvgArrowLeftS;