@dust-tt/sparkle 0.2.617-rc-1 → 0.2.617
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/index.js +1 -1
- package/dist/esm/components/Avatar.d.ts +1 -1
- package/dist/esm/components/Avatar.js +4 -4
- package/dist/esm/components/Avatar.js.map +1 -1
- package/dist/esm/components/Button.d.ts +3 -0
- package/dist/esm/components/Button.d.ts.map +1 -1
- package/dist/esm/components/Button.js +21 -10
- package/dist/esm/components/Button.js.map +1 -1
- package/dist/esm/components/Card.d.ts +1 -0
- package/dist/esm/components/Card.d.ts.map +1 -1
- package/dist/esm/components/ConversationMessage.d.ts +4 -0
- package/dist/esm/components/ConversationMessage.d.ts.map +1 -1
- package/dist/esm/components/ConversationMessage.js +9 -4
- package/dist/esm/components/ConversationMessage.js.map +1 -1
- package/dist/esm/components/DataTable.d.ts.map +1 -1
- package/dist/esm/components/DataTable.js +12 -50
- package/dist/esm/components/DataTable.js.map +1 -1
- package/dist/esm/components/NavigationList.d.ts +4 -1
- package/dist/esm/components/NavigationList.d.ts.map +1 -1
- package/dist/esm/components/NavigationList.js +2 -2
- package/dist/esm/components/NavigationList.js.map +1 -1
- package/dist/esm/components/ScrollArea.d.ts +1 -0
- package/dist/esm/components/ScrollArea.d.ts.map +1 -1
- package/dist/esm/components/ScrollArea.js +7 -4
- package/dist/esm/components/ScrollArea.js.map +1 -1
- package/dist/esm/components/Spinner.d.ts +1 -1
- package/dist/esm/components/Spinner.js +7 -7
- package/dist/esm/components/Spinner.js.map +1 -1
- package/dist/esm/components/ToolCard.d.ts +6 -0
- package/dist/esm/components/ToolCard.d.ts.map +1 -1
- package/dist/esm/components/ToolCard.js +18 -11
- package/dist/esm/components/ToolCard.js.map +1 -1
- package/dist/esm/components/Tooltip.d.ts.map +1 -1
- package/dist/esm/components/Tooltip.js.map +1 -1
- package/dist/esm/components/WindowUtility.d.ts +3 -2
- package/dist/esm/components/WindowUtility.d.ts.map +1 -1
- package/dist/esm/components/WindowUtility.js +25 -17
- package/dist/esm/components/WindowUtility.js.map +1 -1
- package/dist/esm/components/markdown/CodeBlock.d.ts +2 -1
- package/dist/esm/components/markdown/CodeBlock.d.ts.map +1 -1
- package/dist/esm/components/markdown/CodeBlock.js +9 -2
- package/dist/esm/components/markdown/CodeBlock.js.map +1 -1
- package/dist/esm/icons/app/Mic.d.ts +5 -0
- package/dist/esm/icons/app/Mic.d.ts.map +1 -0
- package/dist/esm/icons/app/Mic.js +6 -0
- package/dist/esm/icons/app/Mic.js.map +1 -0
- package/dist/esm/icons/app/index.d.ts +1 -0
- package/dist/esm/icons/app/index.d.ts.map +1 -1
- package/dist/esm/icons/app/index.js +1 -0
- package/dist/esm/icons/app/index.js.map +1 -1
- package/dist/esm/icons/src/app/mic.svg +3 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/stories/Avatar.stories.js +4 -4
- package/dist/esm/stories/CodeBlock.stories.d.ts +17 -0
- package/dist/esm/stories/CodeBlock.stories.d.ts.map +1 -0
- package/dist/esm/stories/CodeBlock.stories.js +125 -0
- package/dist/esm/stories/CodeBlock.stories.js.map +1 -0
- package/dist/esm/stories/ConversationMessage.stories.d.ts.map +1 -1
- package/dist/esm/stories/ConversationMessage.stories.js +3 -3
- package/dist/esm/stories/ConversationMessage.stories.js.map +1 -1
- package/dist/esm/stories/MultiPageDialog.stories.js +1 -1
- package/dist/esm/stories/MultiPageDialog.stories.js.map +1 -1
- package/dist/esm/stories/Playground.stories.d.ts.map +1 -1
- package/dist/esm/stories/Playground.stories.js +166 -29
- package/dist/esm/stories/Playground.stories.js.map +1 -1
- package/dist/esm/stories/Spinner.stories.js +3 -3
- package/dist/esm/stories/ToolCard.stories.d.ts.map +1 -1
- package/dist/esm/stories/ToolCard.stories.js +14 -6
- package/dist/esm/stories/ToolCard.stories.js.map +1 -1
- package/dist/sparkle.css +100 -0
- package/package.json +1 -1
- package/src/components/Avatar.tsx +4 -4
- package/src/components/Button.tsx +35 -7
- package/src/components/ConversationMessage.tsx +26 -7
- package/src/components/DataTable.tsx +7 -46
- package/src/components/NavigationList.tsx +7 -2
- package/src/components/ScrollArea.tsx +9 -3
- package/src/components/Spinner.tsx +7 -7
- package/src/components/ToolCard.tsx +60 -35
- package/src/components/Tooltip.tsx +49 -38
- package/src/components/WindowUtility.tsx +11 -18
- package/src/components/markdown/CodeBlock.tsx +10 -0
- package/src/icons/app/Mic.tsx +18 -0
- package/src/icons/app/index.ts +1 -0
- package/src/icons/src/app/mic.svg +3 -0
- package/src/index.ts +1 -0
- package/src/stories/Avatar.stories.tsx +4 -4
- package/src/stories/CodeBlock.stories.tsx +361 -0
- package/src/stories/ConversationMessage.stories.tsx +6 -0
- package/src/stories/MultiPageDialog.stories.tsx +1 -1
- package/src/stories/Playground.stories.tsx +311 -56
- package/src/stories/Spinner.stories.tsx +3 -3
- package/src/stories/ToolCard.stories.tsx +49 -35
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Playground.stories.js","sourceRoot":"","sources":["../../../src/stories/Playground.stories.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Playground.stories.js","sourceRoot":"","sources":["../../../src/stories/Playground.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE3D,OAAO,EACL,WAAW,EACX,cAAc,EACd,QAAQ,EACR,MAAM,EACN,EAAE,EACF,OAAO,EACP,QAAQ,EACR,aAAa,EACb,SAAS,EACT,UAAU,GACX,MAAM,uBAAuB,CAAC;AAE/B,eAAe;IACb,KAAK,EAAE,uBAAuB;CAC/B,CAAC;AAEF,MAAM,CAAC,IAAM,IAAI,GAAG;IACZ,IAAA,KAAA,OAA4B,QAAQ,CAAC,KAAK,CAAC,IAAA,EA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AAC,CAAC,SAAS;wCACX,CAAC,CAAC,qBAAqB,EAE3B,SAAS,EACP,WAAW,KAAK,WAAW;wCACzB,CAAC,CAAC,SAAS;wCACX,CAAC,CAAC,mBAAmB,EAEzB,YAAY,EACV,WAAW,KAAK,WAAW;wCACzB,CAAC,CAAC,SAAS;wCACX,CAAC,CAAC,sBAAsB,GAE5B;gCACF,oBAAC,MAAM,IACL,OAAO,EAAC,WAAW,EACnB,IAAI,EAAE,WAAW,EACjB,IAAI,EAAC,IAAI,EACT,OAAO,EAAC,cAAc,EACtB,SAAS,QACT,QAAQ,EAAE,WAAW,KAAK,WAAW,EACrC,SAAS,EAAC,aAAa,GACvB,CACE,CACF,CACF,CACF,CACQ,CACZ,CACF,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -50,11 +50,11 @@ export var SpinnerExample = function () {
|
|
|
50
50
|
React.createElement("div", { className: "s-heading-base s-text-foreground dark:s-text-white" }, "Size = XXL"),
|
|
51
51
|
React.createElement("div", { className: "s-flex s-gap-4" },
|
|
52
52
|
React.createElement("div", { className: "s-p-20" },
|
|
53
|
-
React.createElement(Spinner, { variant: "color", size: "
|
|
53
|
+
React.createElement(Spinner, { variant: "color", size: "2xl" })),
|
|
54
54
|
React.createElement("div", { className: "s-p-20" },
|
|
55
|
-
React.createElement(Spinner, { variant: "mono", size: "
|
|
55
|
+
React.createElement(Spinner, { variant: "mono", size: "2xl" })),
|
|
56
56
|
React.createElement("div", { className: "s-p-20" },
|
|
57
|
-
React.createElement(Spinner, { variant: "rose300", size: "
|
|
57
|
+
React.createElement(Spinner, { variant: "rose300", size: "2xl" })))));
|
|
58
58
|
};
|
|
59
59
|
export var BasicSpinner = {
|
|
60
60
|
args: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolCard.stories.d.ts","sourceRoot":"","sources":["../../../src/stories/ToolCard.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAI/C,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,QAAQ,CAG/B,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"ToolCard.stories.d.ts","sourceRoot":"","sources":["../../../src/stories/ToolCard.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAI/C,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,QAAQ,CAG/B,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,eAAO,MAAM,QAAQ,yBAoDpB,CAAC"}
|
|
@@ -7,10 +7,18 @@ var meta = {
|
|
|
7
7
|
component: ToolCard,
|
|
8
8
|
};
|
|
9
9
|
export default meta;
|
|
10
|
-
export var Examples = function () { return (React.createElement("div", { className: "s-
|
|
11
|
-
React.createElement(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
export var Examples = function () { return (React.createElement("div", { className: "s-flex s-gap-3" },
|
|
11
|
+
React.createElement("div", { className: "s-w-80" },
|
|
12
|
+
React.createElement(ToolCard, { icon: BookOpenIcon, cardContainerClassName: "s-h-36", label: "Image Generation", description: "Agent can generate images (GPT Image 1).", isSelected: true, canAdd: true, onClick: function () { return console.log("Add Image Generation"); }, toolInfo: {
|
|
13
|
+
label: "Click here",
|
|
14
|
+
onClick: function () { return console.log("Click here"); },
|
|
15
|
+
} })),
|
|
16
|
+
React.createElement("div", { className: "s-w-80" },
|
|
17
|
+
React.createElement(ToolCard, { cardContainerClassName: "s-h-36", icon: CommandLineIcon, label: "Reasoning", description: React.createElement(React.Fragment, null,
|
|
18
|
+
"Agent can decide to trigger a reasoning model for complex tasks. Agent can decide to trigger a reasoning model for complex tasks. Agent can decide to trigger a reasoning model for complex tasks. Agent can decide to trigger a reasoning model for complex tasks. Agent can decide to trigger a reasoning model for complex tasks. Agent can decide to trigger a reasoning model for complex tasks.",
|
|
19
|
+
" ",
|
|
20
|
+
React.createElement(Hoverable, { href: "https://example.com/help", target: "_blank", rel: "noopener noreferrer", variant: "primary" }, "the docs")), isSelected: true, canAdd: false, toolInfo: {
|
|
21
|
+
label: "Click here",
|
|
22
|
+
onClick: function () { return console.log("Click here"); },
|
|
23
|
+
} })))); };
|
|
16
24
|
//# sourceMappingURL=ToolCard.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolCard.stories.js","sourceRoot":"","sources":["../../../src/stories/ToolCard.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAEnE,IAAM,IAAI,GAA0B;IAClC,KAAK,EAAE,kBAAkB;IACzB,SAAS,EAAE,QAAQ;CACpB,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,MAAM,CAAC,IAAM,QAAQ,GAAG,cAAM,OAAA,CAC5B,6BAAK,SAAS,EAAC,
|
|
1
|
+
{"version":3,"file":"ToolCard.stories.js","sourceRoot":"","sources":["../../../src/stories/ToolCard.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,oB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1410
|
+
.s-h-\[12\%\] {
|
|
1411
|
+
height: 12%;
|
|
1412
|
+
}
|
|
1413
|
+
|
|
1410
1414
|
.s-h-\[120px\] {
|
|
1411
1415
|
height: 120px;
|
|
1412
1416
|
}
|
|
@@ -1415,6 +1419,10 @@ select {
|
|
|
1415
1419
|
height: 125px;
|
|
1416
1420
|
}
|
|
1417
1421
|
|
|
1422
|
+
.s-h-\[18\%\] {
|
|
1423
|
+
height: 18%;
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1418
1426
|
.s-h-\[1px\] {
|
|
1419
1427
|
height: 1px;
|
|
1420
1428
|
}
|
|
@@ -1423,10 +1431,22 @@ select {
|
|
|
1423
1431
|
height: 200px;
|
|
1424
1432
|
}
|
|
1425
1433
|
|
|
1434
|
+
.s-h-\[22\%\] {
|
|
1435
|
+
height: 22%;
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1426
1438
|
.s-h-\[30\%\] {
|
|
1427
1439
|
height: 30%;
|
|
1428
1440
|
}
|
|
1429
1441
|
|
|
1442
|
+
.s-h-\[33\%\] {
|
|
1443
|
+
height: 33%;
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1446
|
+
.s-h-\[34\%\] {
|
|
1447
|
+
height: 34%;
|
|
1448
|
+
}
|
|
1449
|
+
|
|
1430
1450
|
.s-h-\[340px\] {
|
|
1431
1451
|
height: 340px;
|
|
1432
1452
|
}
|
|
@@ -1443,14 +1463,38 @@ select {
|
|
|
1443
1463
|
height: 45%;
|
|
1444
1464
|
}
|
|
1445
1465
|
|
|
1466
|
+
.s-h-\[46\%\] {
|
|
1467
|
+
height: 46%;
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
.s-h-\[56\%\] {
|
|
1471
|
+
height: 56%;
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
.s-h-\[6\%\] {
|
|
1475
|
+
height: 6%;
|
|
1476
|
+
}
|
|
1477
|
+
|
|
1446
1478
|
.s-h-\[600px\] {
|
|
1447
1479
|
height: 600px;
|
|
1448
1480
|
}
|
|
1449
1481
|
|
|
1482
|
+
.s-h-\[64\%\] {
|
|
1483
|
+
height: 64%;
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1450
1486
|
.s-h-\[700px\] {
|
|
1451
1487
|
height: 700px;
|
|
1452
1488
|
}
|
|
1453
1489
|
|
|
1490
|
+
.s-h-\[76\%\] {
|
|
1491
|
+
height: 76%;
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1494
|
+
.s-h-\[98\%\] {
|
|
1495
|
+
height: 98%;
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1454
1498
|
.s-h-fit {
|
|
1455
1499
|
height: -moz-fit-content;
|
|
1456
1500
|
height: fit-content;
|
|
@@ -1484,6 +1528,10 @@ select {
|
|
|
1484
1528
|
min-height: 0px;
|
|
1485
1529
|
}
|
|
1486
1530
|
|
|
1531
|
+
.s-min-h-1 {
|
|
1532
|
+
min-height: 0.25rem;
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1487
1535
|
.s-min-h-5 {
|
|
1488
1536
|
min-height: 1.25rem;
|
|
1489
1537
|
}
|
|
@@ -1798,6 +1846,10 @@ select {
|
|
|
1798
1846
|
max-width: 80vh;
|
|
1799
1847
|
}
|
|
1800
1848
|
|
|
1849
|
+
.s-max-w-\[900px\] {
|
|
1850
|
+
max-width: 900px;
|
|
1851
|
+
}
|
|
1852
|
+
|
|
1801
1853
|
.s-max-w-full {
|
|
1802
1854
|
max-width: 100%;
|
|
1803
1855
|
}
|
|
@@ -2768,6 +2820,10 @@ select {
|
|
|
2768
2820
|
border-color: rgb(248 166 180 / var(--tw-border-opacity));
|
|
2769
2821
|
}
|
|
2770
2822
|
|
|
2823
|
+
.s-border-warning\/20 {
|
|
2824
|
+
border-color: rgb(225 67 34 / 0.2);
|
|
2825
|
+
}
|
|
2826
|
+
|
|
2771
2827
|
.s-border-white\/30 {
|
|
2772
2828
|
border-color: rgb(255 255 255 / 0.3);
|
|
2773
2829
|
}
|
|
@@ -3293,6 +3349,11 @@ select {
|
|
|
3293
3349
|
background-color: rgb(247 247 247 / var(--tw-bg-opacity));
|
|
3294
3350
|
}
|
|
3295
3351
|
|
|
3352
|
+
.s-bg-muted-foreground {
|
|
3353
|
+
--tw-bg-opacity: 1;
|
|
3354
|
+
background-color: rgb(84 93 108 / var(--tw-bg-opacity));
|
|
3355
|
+
}
|
|
3356
|
+
|
|
3296
3357
|
.s-bg-muted-foreground\/40 {
|
|
3297
3358
|
background-color: rgb(84 93 108 / 0.4);
|
|
3298
3359
|
}
|
|
@@ -8794,12 +8855,51 @@ select {
|
|
|
8794
8855
|
.sm\:s-gap-3 {
|
|
8795
8856
|
gap: 0.75rem;
|
|
8796
8857
|
}
|
|
8858
|
+
|
|
8859
|
+
.sm\:s-p-0 {
|
|
8860
|
+
padding: 0px;
|
|
8861
|
+
}
|
|
8797
8862
|
}
|
|
8798
8863
|
|
|
8799
8864
|
@media (min-width: 768px) {
|
|
8865
|
+
.md\:s-flex {
|
|
8866
|
+
display: flex;
|
|
8867
|
+
}
|
|
8868
|
+
|
|
8869
|
+
.md\:s-hidden {
|
|
8870
|
+
display: none;
|
|
8871
|
+
}
|
|
8872
|
+
|
|
8800
8873
|
.md\:s-min-w-\[450px\] {
|
|
8801
8874
|
min-width: 450px;
|
|
8802
8875
|
}
|
|
8876
|
+
|
|
8877
|
+
.md\:s-gap-1 {
|
|
8878
|
+
gap: 0.25rem;
|
|
8879
|
+
}
|
|
8880
|
+
|
|
8881
|
+
.md\:s-rounded-3xl {
|
|
8882
|
+
border-radius: 1.5rem;
|
|
8883
|
+
}
|
|
8884
|
+
|
|
8885
|
+
.md\:s-p-6 {
|
|
8886
|
+
padding: 1.5rem;
|
|
8887
|
+
}
|
|
8888
|
+
|
|
8889
|
+
.md\:s-ring-2 {
|
|
8890
|
+
--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
|
|
8891
|
+
--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);
|
|
8892
|
+
box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
|
|
8893
|
+
}
|
|
8894
|
+
|
|
8895
|
+
.md\:s-ring-highlight-300 {
|
|
8896
|
+
--tw-ring-opacity: 1;
|
|
8897
|
+
--tw-ring-color: rgb(122 198 255 / var(--tw-ring-opacity));
|
|
8898
|
+
}
|
|
8899
|
+
|
|
8900
|
+
.md\:s-ring-offset-2 {
|
|
8901
|
+
--tw-ring-offset-width: 2px;
|
|
8902
|
+
}
|
|
8803
8903
|
}
|
|
8804
8904
|
|
|
8805
8905
|
@media (min-width: 1024px) {
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@ import { UserIcon } from "@sparkle/icons/app";
|
|
|
6
6
|
import { getEmojiAndBackgroundFromUrl } from "@sparkle/lib/avatar/utils";
|
|
7
7
|
import { cn } from "@sparkle/lib/utils";
|
|
8
8
|
|
|
9
|
-
const AVATAR_SIZES = ["xs", "sm", "md", "lg", "xl", "
|
|
9
|
+
const AVATAR_SIZES = ["xs", "sm", "md", "lg", "xl", "2xl", "auto"] as const;
|
|
10
10
|
type AvatarSizeType = (typeof AVATAR_SIZES)[number];
|
|
11
11
|
|
|
12
12
|
const AVATAR_VARIANTS = ["default", "clickable", "disabled"] as const;
|
|
@@ -22,7 +22,7 @@ const avatarVariants = cva(
|
|
|
22
22
|
md: "s-h-10 s-w-10",
|
|
23
23
|
lg: "s-h-16 s-w-16",
|
|
24
24
|
xl: "s-h-20 s-w-20",
|
|
25
|
-
|
|
25
|
+
"2xl": "s-h-36 s-w-36",
|
|
26
26
|
auto: "s-w-full s-relative",
|
|
27
27
|
},
|
|
28
28
|
variant: {
|
|
@@ -64,7 +64,7 @@ const avatarVariants = cva(
|
|
|
64
64
|
},
|
|
65
65
|
{
|
|
66
66
|
rounded: false,
|
|
67
|
-
size: "
|
|
67
|
+
size: "2xl",
|
|
68
68
|
className: "s-rounded-[38px]",
|
|
69
69
|
},
|
|
70
70
|
{
|
|
@@ -89,7 +89,7 @@ const textVariants = cva("s-select-none s-font-semibold", {
|
|
|
89
89
|
md: "s-text-base",
|
|
90
90
|
lg: "s-text-3xl",
|
|
91
91
|
xl: "s-text-5xl",
|
|
92
|
-
|
|
92
|
+
"2xl": "s-text-7xl",
|
|
93
93
|
auto: "s-text-xl",
|
|
94
94
|
},
|
|
95
95
|
},
|
|
@@ -100,16 +100,25 @@ const buttonVariants = cva(
|
|
|
100
100
|
),
|
|
101
101
|
},
|
|
102
102
|
size: {
|
|
103
|
-
xmini: "s-h-6 s-w-6 s-
|
|
104
|
-
mini: "s-h-7 s-w-7 s-
|
|
105
|
-
xs: "s-h-7 s-px-2.5 s-
|
|
106
|
-
sm: "s-h-9 s-px-3 s-
|
|
107
|
-
md: "s-h-12 s-px-4 s-py-2 s-
|
|
103
|
+
xmini: "s-h-6 s-w-6 s-label-xs s-gap-1 s-shrink-0",
|
|
104
|
+
mini: "s-h-7 s-w-7 s-label-xs s-gap-1.5 s-shrink-0",
|
|
105
|
+
xs: "s-h-7 s-px-2.5 s-label-xs s-gap-1.5 s-shrink-0",
|
|
106
|
+
sm: "s-h-9 s-px-3 s-label-sm s-gap-2 s-shrink-0",
|
|
107
|
+
md: "s-h-12 s-px-4 s-py-2 s-label-base s-gap-2.5 s-shrink-0",
|
|
108
|
+
},
|
|
109
|
+
rounded: {
|
|
110
|
+
xmini: "s-rounded-lg",
|
|
111
|
+
mini: "s-rounded-lg",
|
|
112
|
+
xs: "s-rounded-lg",
|
|
113
|
+
sm: "s-rounded-xl",
|
|
114
|
+
md: "s-rounded-2xl",
|
|
115
|
+
full: "s-rounded-full",
|
|
108
116
|
},
|
|
109
117
|
},
|
|
110
118
|
defaultVariants: {
|
|
111
119
|
variant: "primary",
|
|
112
120
|
size: "sm",
|
|
121
|
+
rounded: "sm",
|
|
113
122
|
},
|
|
114
123
|
}
|
|
115
124
|
);
|
|
@@ -153,14 +162,30 @@ export interface MetaButtonProps
|
|
|
153
162
|
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
154
163
|
VariantProps<typeof buttonVariants> {
|
|
155
164
|
asChild?: boolean;
|
|
165
|
+
isRounded?: boolean;
|
|
156
166
|
}
|
|
157
167
|
|
|
158
168
|
const MetaButton = React.forwardRef<HTMLButtonElement, MetaButtonProps>(
|
|
159
|
-
(
|
|
169
|
+
(
|
|
170
|
+
{
|
|
171
|
+
className,
|
|
172
|
+
asChild = false,
|
|
173
|
+
variant,
|
|
174
|
+
size,
|
|
175
|
+
isRounded,
|
|
176
|
+
children,
|
|
177
|
+
...props
|
|
178
|
+
},
|
|
179
|
+
ref
|
|
180
|
+
) => {
|
|
160
181
|
const Comp = asChild ? Slot : "button";
|
|
182
|
+
|
|
183
|
+
// Determine rounded variant based on isRounded prop
|
|
184
|
+
const rounded = isRounded ? "full" : size;
|
|
185
|
+
|
|
161
186
|
return (
|
|
162
187
|
<Comp
|
|
163
|
-
className={cn(buttonVariants({ variant, size, className }))}
|
|
188
|
+
className={cn(buttonVariants({ variant, size, rounded, className }))}
|
|
164
189
|
ref={ref}
|
|
165
190
|
{...props}
|
|
166
191
|
>
|
|
@@ -199,6 +224,7 @@ type CommonButtonProps = Omit<MetaButtonProps, "children"> &
|
|
|
199
224
|
tooltip?: string;
|
|
200
225
|
isCounter?: boolean;
|
|
201
226
|
counterValue?: string;
|
|
227
|
+
isRounded?: boolean;
|
|
202
228
|
};
|
|
203
229
|
|
|
204
230
|
export type MiniButtonProps = CommonButtonProps & {
|
|
@@ -230,6 +256,7 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
230
256
|
isCounter = false,
|
|
231
257
|
counterValue,
|
|
232
258
|
size = "sm",
|
|
259
|
+
isRounded = false,
|
|
233
260
|
href,
|
|
234
261
|
target,
|
|
235
262
|
rel,
|
|
@@ -338,6 +365,7 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
338
365
|
ref={ref}
|
|
339
366
|
size={size}
|
|
340
367
|
variant={variant}
|
|
368
|
+
isRounded={isRounded}
|
|
341
369
|
disabled={isLoading || props.disabled}
|
|
342
370
|
className={cn(
|
|
343
371
|
(isPulsing || isPulsingBriefly) && "s-animate-pulse",
|
|
@@ -35,8 +35,10 @@ interface ConversationMessageProps
|
|
|
35
35
|
citations?: React.ReactElement[];
|
|
36
36
|
isDisabled?: boolean;
|
|
37
37
|
name?: string;
|
|
38
|
+
timestamp?: string;
|
|
38
39
|
pictureUrl?: string | React.ReactNode | null;
|
|
39
40
|
renderName?: (name: string | null) => React.ReactNode;
|
|
41
|
+
infoChip?: React.ReactNode;
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
const messageVariants = cva("s-flex s-w-full s-flex-col s-rounded-2xl", {
|
|
@@ -81,8 +83,10 @@ export const ConversationMessage = React.forwardRef<
|
|
|
81
83
|
citations,
|
|
82
84
|
isDisabled = false,
|
|
83
85
|
name,
|
|
86
|
+
timestamp,
|
|
84
87
|
pictureUrl,
|
|
85
88
|
renderName = (name) => <span>{name}</span>,
|
|
89
|
+
infoChip,
|
|
86
90
|
type,
|
|
87
91
|
className,
|
|
88
92
|
...props
|
|
@@ -95,9 +99,11 @@ export const ConversationMessage = React.forwardRef<
|
|
|
95
99
|
<ConversationMessageHeader
|
|
96
100
|
avatarUrl={pictureUrl}
|
|
97
101
|
name={name}
|
|
102
|
+
timestamp={timestamp}
|
|
98
103
|
isBusy={avatarBusy}
|
|
99
104
|
isDisabled={isDisabled}
|
|
100
105
|
renderName={renderName}
|
|
106
|
+
infoChip={infoChip}
|
|
101
107
|
/>
|
|
102
108
|
|
|
103
109
|
<ConversationMessageContent citations={citations}>
|
|
@@ -158,6 +164,8 @@ interface ConversationMessageHeaderProps
|
|
|
158
164
|
isBusy?: boolean;
|
|
159
165
|
isDisabled?: boolean;
|
|
160
166
|
name?: string;
|
|
167
|
+
timestamp?: string;
|
|
168
|
+
infoChip?: React.ReactNode;
|
|
161
169
|
renderName: (name: string | null) => React.ReactNode;
|
|
162
170
|
}
|
|
163
171
|
|
|
@@ -171,6 +179,8 @@ export const ConversationMessageHeader = React.forwardRef<
|
|
|
171
179
|
isBusy,
|
|
172
180
|
isDisabled,
|
|
173
181
|
name = "",
|
|
182
|
+
timestamp,
|
|
183
|
+
infoChip,
|
|
174
184
|
renderName,
|
|
175
185
|
className,
|
|
176
186
|
...props
|
|
@@ -202,13 +212,22 @@ export const ConversationMessageHeader = React.forwardRef<
|
|
|
202
212
|
disabled={isDisabled}
|
|
203
213
|
size="sm"
|
|
204
214
|
/>
|
|
205
|
-
<div
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
215
|
+
<div className="s-flex s-w-full s-flex-row s-justify-between s-gap-0.5">
|
|
216
|
+
<div
|
|
217
|
+
className={cn(
|
|
218
|
+
"s-text-sm s-font-semibold @sm:s-text-base",
|
|
219
|
+
"s-text-foreground dark:s-text-foreground-night",
|
|
220
|
+
"s-flex s-flex-row s-items-center s-gap-2"
|
|
221
|
+
)}
|
|
222
|
+
>
|
|
223
|
+
{renderName(name)}
|
|
224
|
+
{infoChip}
|
|
225
|
+
</div>
|
|
226
|
+
<div>
|
|
227
|
+
<span className="s-text-xs s-font-normal s-text-muted-foreground dark:s-text-muted-foreground-night">
|
|
228
|
+
{timestamp}
|
|
229
|
+
</span>
|
|
230
|
+
</div>
|
|
212
231
|
</div>
|
|
213
232
|
</div>
|
|
214
233
|
);
|
|
@@ -15,13 +15,7 @@ import {
|
|
|
15
15
|
useReactTable,
|
|
16
16
|
} from "@tanstack/react-table";
|
|
17
17
|
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
18
|
-
import React, {
|
|
19
|
-
ReactNode,
|
|
20
|
-
useEffect,
|
|
21
|
-
useLayoutEffect,
|
|
22
|
-
useRef,
|
|
23
|
-
useState,
|
|
24
|
-
} from "react";
|
|
18
|
+
import React, { ReactNode, useEffect, useRef, useState } from "react";
|
|
25
19
|
|
|
26
20
|
import {
|
|
27
21
|
Avatar,
|
|
@@ -345,24 +339,6 @@ export interface ScrollableDataTableProps<TData extends TBaseData>
|
|
|
345
339
|
const COLUMN_HEIGHT = 48;
|
|
346
340
|
const MIN_COLUMN_WIDTH = 40;
|
|
347
341
|
|
|
348
|
-
// Helper function to compare column sizing objects
|
|
349
|
-
function shallowEqualSizing(
|
|
350
|
-
a: Record<string, number>,
|
|
351
|
-
b: Record<string, number>
|
|
352
|
-
) {
|
|
353
|
-
const aKeys = Object.keys(a);
|
|
354
|
-
const bKeys = Object.keys(b);
|
|
355
|
-
if (aKeys.length !== bKeys.length) {
|
|
356
|
-
return false;
|
|
357
|
-
}
|
|
358
|
-
for (const k of aKeys) {
|
|
359
|
-
if (a[k] !== b[k]) {
|
|
360
|
-
return false;
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
return true;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
342
|
export function ScrollableDataTable<TData extends TBaseData>({
|
|
367
343
|
data,
|
|
368
344
|
totalRowCount,
|
|
@@ -384,7 +360,7 @@ export function ScrollableDataTable<TData extends TBaseData>({
|
|
|
384
360
|
const loadMoreRef = useRef<HTMLDivElement>(null);
|
|
385
361
|
const [tableWidth, setTableWidth] = useState(0);
|
|
386
362
|
|
|
387
|
-
// Monitor table width changes
|
|
363
|
+
// Monitor table width changes
|
|
388
364
|
useEffect(() => {
|
|
389
365
|
if (!tableContainerRef.current) {
|
|
390
366
|
return;
|
|
@@ -392,8 +368,7 @@ export function ScrollableDataTable<TData extends TBaseData>({
|
|
|
392
368
|
|
|
393
369
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
394
370
|
for (const entry of entries) {
|
|
395
|
-
|
|
396
|
-
setTableWidth((prev) => (prev !== w ? w : prev)); // update only on real change
|
|
371
|
+
setTableWidth(entry.contentRect.width);
|
|
397
372
|
}
|
|
398
373
|
});
|
|
399
374
|
|
|
@@ -430,20 +405,12 @@ export function ScrollableDataTable<TData extends TBaseData>({
|
|
|
430
405
|
getRowId,
|
|
431
406
|
});
|
|
432
407
|
|
|
433
|
-
|
|
408
|
+
useEffect(() => {
|
|
434
409
|
if (!tableContainerRef.current || !table || !tableWidth) {
|
|
435
410
|
return;
|
|
436
411
|
}
|
|
437
412
|
const columns = table.getAllColumns();
|
|
438
413
|
|
|
439
|
-
// Skip sizing if no columns have ratios defined
|
|
440
|
-
const hasRatios = columns.some(
|
|
441
|
-
(c) => (c.columnDef.meta?.sizeRatio ?? 0) > 0
|
|
442
|
-
);
|
|
443
|
-
if (!hasRatios) {
|
|
444
|
-
return;
|
|
445
|
-
}
|
|
446
|
-
|
|
447
414
|
// Calculate ideal widths and handle minimums
|
|
448
415
|
const idealSizing = columns.reduce(
|
|
449
416
|
(acc, column) => {
|
|
@@ -452,8 +419,7 @@ export function ScrollableDataTable<TData extends TBaseData>({
|
|
|
452
419
|
Math.floor((ratio / 100) * tableWidth),
|
|
453
420
|
MIN_COLUMN_WIDTH
|
|
454
421
|
);
|
|
455
|
-
acc[column.id]
|
|
456
|
-
return acc;
|
|
422
|
+
return { ...acc, [column.id]: calculated };
|
|
457
423
|
},
|
|
458
424
|
{} as Record<string, number>
|
|
459
425
|
);
|
|
@@ -473,13 +439,8 @@ export function ScrollableDataTable<TData extends TBaseData>({
|
|
|
473
439
|
|
|
474
440
|
idealSizing[adjustColumnId] += widthDifference;
|
|
475
441
|
}
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
const currentSizing = table.getState().columnSizing;
|
|
479
|
-
if (!shallowEqualSizing(idealSizing, currentSizing)) {
|
|
480
|
-
table.setColumnSizing(idealSizing);
|
|
481
|
-
}
|
|
482
|
-
}, [tableWidth]); // intentionally remove `table` from deps
|
|
442
|
+
table.setColumnSizing(idealSizing);
|
|
443
|
+
}, [table, tableWidth]);
|
|
483
444
|
|
|
484
445
|
// Get the current column sizing from the table for rendering
|
|
485
446
|
const columnSizing = table.getState().columnSizing;
|
|
@@ -41,13 +41,18 @@ const NavigationListItemStyles = cva(
|
|
|
41
41
|
}
|
|
42
42
|
);
|
|
43
43
|
|
|
44
|
+
interface NavigationListProps {
|
|
45
|
+
viewportRef?: React.RefObject<HTMLDivElement>;
|
|
46
|
+
}
|
|
44
47
|
const NavigationList = React.forwardRef<
|
|
45
48
|
React.ElementRef<typeof ScrollAreaPrimitive.Root>,
|
|
46
|
-
React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>
|
|
47
|
-
|
|
49
|
+
React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root> &
|
|
50
|
+
NavigationListProps
|
|
51
|
+
>(({ className, children, viewportRef, ...props }, ref) => {
|
|
48
52
|
return (
|
|
49
53
|
<ScrollArea
|
|
50
54
|
ref={ref}
|
|
55
|
+
viewportRef={viewportRef}
|
|
51
56
|
className={cn(className, "s-transition-all s-duration-300")}
|
|
52
57
|
{...props}
|
|
53
58
|
>
|
|
@@ -14,6 +14,7 @@ interface ScrollAreaProps
|
|
|
14
14
|
active?: string;
|
|
15
15
|
inactive?: string;
|
|
16
16
|
};
|
|
17
|
+
viewportRef?: React.RefObject<HTMLDivElement>;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
const ScrollArea = React.forwardRef<
|
|
@@ -29,11 +30,12 @@ const ScrollArea = React.forwardRef<
|
|
|
29
30
|
scrollBarClassName,
|
|
30
31
|
viewportClassName,
|
|
31
32
|
scrollStyles,
|
|
33
|
+
viewportRef,
|
|
32
34
|
...props
|
|
33
35
|
},
|
|
34
36
|
ref
|
|
35
37
|
) => {
|
|
36
|
-
const
|
|
38
|
+
const localViewportRef = React.useRef<HTMLDivElement>(null);
|
|
37
39
|
const [isScrolled, setIsScrolled] = React.useState(false);
|
|
38
40
|
|
|
39
41
|
const hasCustomScrollBar = useMemo(
|
|
@@ -50,9 +52,13 @@ const ScrollArea = React.forwardRef<
|
|
|
50
52
|
const shouldHideDefaultScrollBar = hideScrollBar || hasCustomScrollBar;
|
|
51
53
|
|
|
52
54
|
const handleScroll = React.useCallback(() => {
|
|
53
|
-
if (viewportRef.current) {
|
|
55
|
+
if (viewportRef && viewportRef.current) {
|
|
54
56
|
setIsScrolled(viewportRef.current.scrollTop > 0);
|
|
55
57
|
}
|
|
58
|
+
|
|
59
|
+
if (localViewportRef.current) {
|
|
60
|
+
setIsScrolled(localViewportRef.current.scrollTop > 0);
|
|
61
|
+
}
|
|
56
62
|
}, []);
|
|
57
63
|
|
|
58
64
|
return (
|
|
@@ -66,7 +72,7 @@ const ScrollArea = React.forwardRef<
|
|
|
66
72
|
{...props}
|
|
67
73
|
>
|
|
68
74
|
<ScrollAreaPrimitive.Viewport
|
|
69
|
-
ref={viewportRef}
|
|
75
|
+
ref={viewportRef || localViewportRef}
|
|
70
76
|
onScroll={handleScroll}
|
|
71
77
|
className={cn(
|
|
72
78
|
"s-h-full s-w-full s-rounded-[inherit]",
|