@dust-tt/sparkle 0.2.467 → 0.2.469

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.
@@ -12,7 +12,6 @@ import {
12
12
  DropdownMenuPortal,
13
13
  DropdownMenuRadioGroup,
14
14
  DropdownMenuRadioItem,
15
- DropdownMenuSearchbar,
16
15
  DropdownMenuSeparator,
17
16
  DropdownMenuStaticItem,
18
17
  DropdownMenuSub,
@@ -31,12 +30,20 @@ import {
31
30
  } from "@sparkle/logo/platforms";
32
31
 
33
32
  import {
33
+ ActionArmchairIcon,
34
+ ActionCloudArrowDownIcon,
35
+ ActionCommand1Icon,
36
+ ActionDocumentIcon,
37
+ ActionFolderIcon,
38
+ ActionMagicIcon,
39
+ ActionUserGroupIcon,
34
40
  ArrowDownCircleIcon,
41
+ ArrowUpOnSquareIcon,
42
+ AttachmentIcon,
35
43
  Avatar,
36
44
  Button,
37
45
  ChatBubbleBottomCenterPlusIcon,
38
46
  CloudArrowDownIcon,
39
- CloudArrowUpIcon,
40
47
  Cog6ToothIcon,
41
48
  DocumentIcon,
42
49
  FolderIcon,
@@ -45,7 +52,12 @@ import {
45
52
  Icon,
46
53
  LogoutIcon,
47
54
  MagicIcon,
55
+ MagnifyingGlassIcon,
56
+ PlusIcon,
57
+ RobotIcon,
48
58
  ScrollArea,
59
+ SearchInput,
60
+ SuitcaseIcon,
49
61
  UserGroupIcon,
50
62
  UserIcon,
51
63
  } from "../index_with_tw_base";
@@ -65,11 +77,16 @@ export const DropdownExamples = () => (
65
77
  <div>{DropdownMenuRadioGroupDemo()}</div>
66
78
  <div>{ModelsDropdownDemo()}</div>
67
79
  <div>{ModelsDropdownRadioGroupDemo()}</div>
68
- <div>{DropdownMenuSearchbarDemo()}</div>
69
80
  <div>{StaticItemDropdownDemo()}</div>
70
81
  </div>
71
82
  );
72
83
 
84
+ export const PickerExamples = () => (
85
+ <div className="s-flex s-h-80 s-w-full s-flex-col s-items-center s-justify-center s-gap-4 s-text-foreground dark:s-text-foreground-night">
86
+ <div>{AttachFileDemo()}</div>
87
+ </div>
88
+ );
89
+
73
90
  function SimpleDropdownDemo() {
74
91
  return (
75
92
  <DropdownMenu>
@@ -309,9 +326,39 @@ function ModelsDropdownRadioGroupDemo() {
309
326
  );
310
327
  }
311
328
 
312
- function DropdownMenuSearchbarDemo() {
329
+ function AttachFileDemo() {
313
330
  const [searchText, setSearchText] = React.useState("");
314
331
  const [selectedItem, setSelectedItem] = React.useState<string | null>(null);
332
+ const [open, setOpen] = React.useState(false);
333
+ const [openAgents, setOpenAgents] = React.useState(false);
334
+ const [openToolsets, setOpenToolsets] = React.useState(false);
335
+ const searchInputRef = React.useRef<HTMLInputElement>(null);
336
+ const agentsSearchInputRef = React.useRef<HTMLInputElement>(null);
337
+ const toolsetsSearchInputRef = React.useRef<HTMLInputElement>(null);
338
+
339
+ React.useEffect(() => {
340
+ if (open) {
341
+ setTimeout(() => {
342
+ searchInputRef.current?.focus();
343
+ }, 0);
344
+ }
345
+ }, [open]);
346
+
347
+ React.useEffect(() => {
348
+ if (openAgents) {
349
+ setTimeout(() => {
350
+ agentsSearchInputRef.current?.focus();
351
+ }, 0);
352
+ }
353
+ }, [openAgents]);
354
+
355
+ React.useEffect(() => {
356
+ if (openToolsets) {
357
+ setTimeout(() => {
358
+ toolsetsSearchInputRef.current?.focus();
359
+ }, 0);
360
+ }
361
+ }, [openToolsets]);
315
362
 
316
363
  const items = [
317
364
  "Automated Data Processing Automated Data Processing Automated Data Processing Automated Data Processing",
@@ -343,49 +390,251 @@ function DropdownMenuSearchbarDemo() {
343
390
  const mainIcons = [FolderIcon, DocumentIcon];
344
391
  const extraIcons = [DriveLogo, NotionLogo, SlackLogo];
345
392
 
393
+ const filteredAgents = [
394
+ {
395
+ name: "Research Assistant",
396
+ description: "Academic research and paper analysis",
397
+ emoji: "🔬",
398
+ backgroundColor: "s-bg-blue-200",
399
+ },
400
+ {
401
+ name: "Code Companion",
402
+ description: "Pair programming and code review",
403
+ emoji: "💻",
404
+ backgroundColor: "s-bg-purple-200",
405
+ },
406
+ {
407
+ name: "Data Analyst",
408
+ description: "Data visualization and insights",
409
+ emoji: "��",
410
+ backgroundColor: "s-bg-green-200",
411
+ },
412
+ {
413
+ name: "Content Writer",
414
+ description: "Blog posts and marketing copy",
415
+ emoji: "✍️",
416
+ backgroundColor: "s-bg-yellow-200",
417
+ },
418
+ {
419
+ name: "Customer Support",
420
+ description: "24/7 customer service automation",
421
+ emoji: "🤝",
422
+ backgroundColor: "s-bg-pink-200",
423
+ },
424
+ {
425
+ name: "Legal Assistant",
426
+ description: "Contract review and legal research",
427
+ emoji: "⚖️",
428
+ backgroundColor: "s-bg-red-200",
429
+ },
430
+ {
431
+ name: "Design Assistant",
432
+ description: "UI/UX design and prototyping",
433
+ emoji: "🎨",
434
+ backgroundColor: "s-bg-indigo-200",
435
+ },
436
+ {
437
+ name: "Financial Advisor",
438
+ description: "Investment analysis and planning",
439
+ emoji: "💰",
440
+ backgroundColor: "s-bg-emerald-200",
441
+ },
442
+ ] as const;
443
+
444
+ const filteredToolsetList = [
445
+ {
446
+ name: "Product Design Suite",
447
+ description: "Figma, Adobe XD, and design assets",
448
+ icon: ActionMagicIcon,
449
+ },
450
+ {
451
+ name: "Business Intelligence",
452
+ description: "Tableau, PowerBI, and analytics tools",
453
+ icon: ActionDocumentIcon,
454
+ },
455
+ {
456
+ name: "Project Management",
457
+ description: "Notion, Jira, and task tracking",
458
+ icon: ActionFolderIcon,
459
+ },
460
+ {
461
+ name: "Communication Hub",
462
+ description: "Slack, Email, and messaging platforms",
463
+ icon: ActionArmchairIcon,
464
+ },
465
+ {
466
+ name: "Development Stack",
467
+ description: "GitHub, VSCode, and dev tools",
468
+ icon: ActionCommand1Icon,
469
+ },
470
+ {
471
+ name: "Customer Success",
472
+ description: "Zendesk, Intercom, and support tools",
473
+ icon: ActionUserGroupIcon,
474
+ },
475
+ {
476
+ name: "Marketing Suite",
477
+ description: "HubSpot, Mailchimp, and campaign tools",
478
+ icon: ActionCloudArrowDownIcon,
479
+ },
480
+ {
481
+ name: "Data Warehouse",
482
+ description: "Snowflake, BigQuery, and data storage",
483
+ icon: ActionArmchairIcon,
484
+ },
485
+ {
486
+ name: "HR Platform",
487
+ description: "BambooHR, Workday, and people tools",
488
+ icon: ActionMagicIcon,
489
+ },
490
+ {
491
+ name: "Finance Stack",
492
+ description: "QuickBooks, Stripe, and payment tools",
493
+ icon: ActionFolderIcon,
494
+ },
495
+ ] as const;
496
+
346
497
  return (
347
- <DropdownMenu>
348
- <DropdownMenuTrigger asChild>
349
- <Button
350
- label={selectedItem || "Select System"}
351
- variant="outline"
352
- size="sm"
353
- />
354
- </DropdownMenuTrigger>
355
- <DropdownMenuContent className="s-w-[300px]">
356
- <DropdownMenuItem icon={CloudArrowUpIcon} label="Upload File" />
357
- <DropdownMenuSeparator />
358
- <DropdownMenuSearchbar
359
- placeholder="Search systems..."
360
- name="search"
361
- value={searchText}
362
- onChange={setSearchText}
363
- />
364
- <DropdownMenuSeparator />
365
- <ScrollArea className="s-h-[200px]">
366
- {filteredItems.map((item) => {
367
- const randomMainIcon =
368
- mainIcons[Math.floor(Math.random() * mainIcons.length)];
369
- const randomExtraIcon =
370
- extraIcons[Math.floor(Math.random() * extraIcons.length)];
371
- return (
372
- <DropdownMenuItem
373
- key={item}
374
- label={item}
375
- description="Company Space/Notion"
376
- icon={randomMainIcon}
377
- extraIcon={randomExtraIcon}
378
- onClick={() => {
379
- setSelectedItem(item);
380
- setSearchText("");
381
- }}
382
- truncateText
383
- />
384
- );
385
- })}
386
- </ScrollArea>
387
- </DropdownMenuContent>
388
- </DropdownMenu>
498
+ <div className="s-flex s-gap-2">
499
+ <DropdownMenu open={open} onOpenChange={setOpen}>
500
+ <DropdownMenuTrigger asChild>
501
+ <Button
502
+ label={selectedItem || "Attach"}
503
+ icon={AttachmentIcon}
504
+ variant="outline"
505
+ size="sm"
506
+ />
507
+ </DropdownMenuTrigger>
508
+ <DropdownMenuContent className="s-w-[380px]">
509
+ <div className="s-flex s-gap-1.5 s-p-1.5">
510
+ <SearchInput
511
+ ref={searchInputRef}
512
+ name="search"
513
+ onChange={setSearchText}
514
+ onKeyDown={() => {}}
515
+ placeholder="Search in Dust"
516
+ value={searchText}
517
+ />
518
+ <Button icon={ArrowUpOnSquareIcon} label="Upload File" />
519
+ </div>
520
+ <DropdownMenuSeparator />
521
+ <ScrollArea className="s-h-[380px]">
522
+ {searchText ? (
523
+ filteredItems.map((item) => {
524
+ const randomMainIcon =
525
+ mainIcons[Math.floor(Math.random() * mainIcons.length)];
526
+ const randomExtraIcon =
527
+ extraIcons[Math.floor(Math.random() * extraIcons.length)];
528
+ return (
529
+ <DropdownMenuItem
530
+ key={item}
531
+ label={item}
532
+ description="Company Space/Notion"
533
+ icon={randomMainIcon}
534
+ extraIcon={randomExtraIcon}
535
+ onClick={() => {
536
+ setSelectedItem(item);
537
+ setSearchText("");
538
+ }}
539
+ truncateText
540
+ />
541
+ );
542
+ })
543
+ ) : (
544
+ <div className="s-flex s-h-full s-w-full s-items-center s-justify-center s-py-8">
545
+ <div className="s-flex s-flex-col s-items-center s-justify-center s-gap-0 s-text-center s-text-base s-font-semibold s-text-primary-400">
546
+ <Icon visual={MagnifyingGlassIcon} size="sm" />
547
+ Search in Dust
548
+ </div>
549
+ </div>
550
+ )}
551
+ </ScrollArea>
552
+ </DropdownMenuContent>
553
+ </DropdownMenu>
554
+ <DropdownMenu open={openAgents} onOpenChange={setOpenAgents}>
555
+ <DropdownMenuTrigger asChild>
556
+ <Button icon={RobotIcon} variant="outline" size="sm" isSelect />
557
+ </DropdownMenuTrigger>
558
+ <DropdownMenuContent className="s-w-[380px]">
559
+ <div className="s-flex s-gap-1.5 s-p-1.5">
560
+ <SearchInput
561
+ ref={agentsSearchInputRef}
562
+ name="search"
563
+ onChange={() => {}}
564
+ onKeyDown={() => {}}
565
+ placeholder="Search Agents"
566
+ value=""
567
+ />
568
+ <Button icon={PlusIcon} label="Create" />
569
+ </div>
570
+ <DropdownMenuSeparator />
571
+ <ScrollArea className="s-h-[380px]">
572
+ {filteredAgents.map((agent) => {
573
+ return (
574
+ <DropdownMenuItem
575
+ key={agent.name}
576
+ label={agent.name}
577
+ description={agent.description}
578
+ icon={() => (
579
+ <Avatar
580
+ size="sm"
581
+ emoji={agent.emoji}
582
+ backgroundColor={agent.backgroundColor}
583
+ />
584
+ )}
585
+ onClick={() => {
586
+ setSelectedItem(agent.name);
587
+ setSearchText("");
588
+ }}
589
+ truncateText
590
+ />
591
+ );
592
+ })}
593
+ </ScrollArea>
594
+ </DropdownMenuContent>
595
+ </DropdownMenu>
596
+ <DropdownMenu open={openToolsets} onOpenChange={setOpenToolsets}>
597
+ <DropdownMenuTrigger asChild>
598
+ <Button
599
+ label={selectedItem || "Add Toolset"}
600
+ icon={SuitcaseIcon}
601
+ variant="outline"
602
+ size="sm"
603
+ />
604
+ </DropdownMenuTrigger>
605
+ <DropdownMenuContent className="s-w-[380px]">
606
+ <div className="s-flex s-gap-1.5 s-p-1.5">
607
+ <SearchInput
608
+ ref={toolsetsSearchInputRef}
609
+ name="search"
610
+ onChange={() => {}}
611
+ onKeyDown={() => {}}
612
+ placeholder="Search Toolsets"
613
+ value=""
614
+ />
615
+ <Button icon={PlusIcon} label="Add MCP Server" />
616
+ </div>
617
+ <DropdownMenuSeparator />
618
+ <ScrollArea className="s-h-[380px]">
619
+ {filteredToolsetList.map((toolset) => {
620
+ return (
621
+ <DropdownMenuItem
622
+ key={toolset.name}
623
+ label={toolset.name}
624
+ description={toolset.description}
625
+ icon={() => <Avatar size="sm" icon={toolset.icon} />}
626
+ onClick={() => {
627
+ setSelectedItem(toolset.name);
628
+ setSearchText("");
629
+ }}
630
+ truncateText
631
+ />
632
+ );
633
+ })}
634
+ </ScrollArea>
635
+ </DropdownMenuContent>
636
+ </DropdownMenu>
637
+ </div>
389
638
  );
390
639
  }
391
640
 
@@ -29,7 +29,7 @@ export const SpinnerExample = () => {
29
29
  <Spinner variant="dark" size="xs" />
30
30
  </div>
31
31
  <div className="s-p-20">
32
- <Spinner variant="rose900" size="xs" />
32
+ <Spinner variant="rose300" size="xs" />
33
33
  </div>
34
34
  </div>
35
35
  Size = SM
@@ -47,7 +47,7 @@ export const SpinnerExample = () => {
47
47
  <Spinner variant="dark" size="sm" />
48
48
  </div>
49
49
  <div className="s-p-20">
50
- <Spinner variant="rose900" size="sm" />
50
+ <Spinner variant="rose300" size="sm" />
51
51
  </div>
52
52
  </div>
53
53
  Size = MD
@@ -2,6 +2,7 @@ import { Meta } from "@storybook/react";
2
2
  import React from "react";
3
3
 
4
4
  import {
5
+ Button,
5
6
  Cog6ToothIcon,
6
7
  CommandIcon,
7
8
  LightbulbIcon,
@@ -50,6 +51,8 @@ export function Demo2() {
50
51
  <TabsTrigger value="tab4" label="Tab 4" icon={CommandIcon} />
51
52
  <TabsTrigger value="tab5" label="Tab 5" icon={LightbulbIcon} />
52
53
  <TabsTrigger value="tab6" label="Tab 6" icon={Cog6ToothIcon} />
54
+ <div className="s-grow" />
55
+ <Button label="Hello" />
53
56
  </TabsList>
54
57
  <TabsContent value="tab1">Content for Tab 1</TabsContent>
55
58
  <TabsContent value="tab2">Content for Tab 2</TabsContent>