@dust-tt/sparkle 0.2.634 → 0.2.636-rc-1

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.
@@ -338,6 +338,7 @@ export interface ScrollableDataTableProps<TData extends TBaseData>
338
338
  maxHeight?: string | boolean;
339
339
  onLoadMore?: () => void;
340
340
  isLoading?: boolean;
341
+ containerRef?: React.Ref<HTMLDivElement>;
341
342
  }
342
343
 
343
344
  // cellHeight in pixels
@@ -361,14 +362,29 @@ export function ScrollableDataTable<TData extends TBaseData>({
361
362
  enableRowSelection,
362
363
  enableMultiRowSelection = true,
363
364
  getRowId,
365
+ containerRef,
364
366
  }: ScrollableDataTableProps<TData>) {
365
367
  const windowSize = useWindowSize();
366
- const tableContainerRef = useRef<HTMLDivElement>(null);
367
368
  const loadMoreRef = useRef<HTMLDivElement>(null);
368
369
  const [tableWidth, setTableWidth] = useState(0);
370
+ const tableContainerRef = useRef<HTMLDivElement | null>(null);
369
371
 
370
372
  const isSorting = !!setSorting;
371
373
 
374
+ // Handle container ref
375
+ const setRef = (element: HTMLDivElement | null) => {
376
+ tableContainerRef.current = element;
377
+ if (containerRef) {
378
+ if (typeof containerRef === "function") {
379
+ containerRef(element);
380
+ } else if ("current" in containerRef) {
381
+ (
382
+ containerRef as React.MutableRefObject<HTMLDivElement | null>
383
+ ).current = element;
384
+ }
385
+ }
386
+ };
387
+
372
388
  // Monitor table width changes
373
389
  useEffect(() => {
374
390
  if (!tableContainerRef.current) {
@@ -520,7 +536,7 @@ export function ScrollableDataTable<TData extends TBaseData>({
520
536
  ? maxHeight
521
537
  : "s-max-h-100"
522
538
  )}
523
- ref={tableContainerRef}
539
+ ref={setRef}
524
540
  >
525
541
  <div className="s-relative">
526
542
  <DataTable.Root className="s-w-full s-table-fixed">
@@ -10,7 +10,7 @@ const SvgAtom = (props: SVGProps<SVGSVGElement>) => (
10
10
  {...props}
11
11
  >
12
12
  <path
13
- fill="#000"
13
+ fill="currentColor"
14
14
  fillRule="evenodd"
15
15
  d="M14.974 2.284c.831-.248 1.733-.268 2.526.19.793.458 1.227 1.249 1.428 2.093.2.841.196 1.827.047 2.866-.029.196-.065.396-.104.599.196.068.387.137.571.21.975.39 1.83.88 2.46 1.474C22.531 10.313 23 11.084 23 12c0 .915-.468 1.687-1.099 2.283-.628.594-1.484 1.084-2.459 1.473-.184.074-.375.143-.57.211.038.204.074.404.103.6.15 1.039.153 2.025-.047 2.866-.201.844-.635 1.635-1.428 2.093-.793.458-1.695.438-2.526.19-.83-.247-1.681-.743-2.506-1.392a12.997 12.997 0 0 1-.468-.389c-.157.136-.312.266-.468.389-.825.649-1.677 1.145-2.506 1.392-.831.248-1.733.268-2.526-.19-.793-.458-1.227-1.249-1.428-2.093-.2-.841-.196-1.827-.047-2.866.029-.196.064-.396.103-.6a13.01 13.01 0 0 1-.57-.21c-.975-.39-1.83-.88-2.46-1.474C1.469 13.687 1 12.915 1 12c0-.916.468-1.687 1.099-2.284.628-.594 1.484-1.083 2.459-1.473.184-.074.374-.143.57-.211-.04-.203-.074-.403-.103-.599-.15-1.039-.153-2.025.047-2.866.201-.844.635-1.635 1.428-2.093.793-.458 1.695-.438 2.526-.19.83.247 1.681.743 2.506 1.392.156.123.312.253.468.388.156-.135.312-.265.468-.388.825-.649 1.677-1.145 2.506-1.392ZM7.06 16.502a10.7 10.7 0 0 0-.056.35c-.128.89-.11 1.605.013 2.118.121.51.319.73.482.825.163.094.452.155.955.005.506-.15 1.134-.492 1.84-1.049.092-.07.182-.146.274-.223a21.574 21.574 0 0 1-1.368-1.683 21.558 21.558 0 0 1-2.14-.343Zm9.878 0c-.677.145-1.394.26-2.141.343a21.577 21.577 0 0 1-1.368 1.683c.092.077.183.152.274.224.707.556 1.335.898 1.84 1.048.504.15.793.089.956-.006.163-.094.36-.314.482-.824.123-.513.141-1.229.013-2.119a10.715 10.715 0 0 0-.056-.35ZM12 17l-.114-.002.113.127.114-.127L12 17Zm0-8c-.582 0-1.15.022-1.698.061A23.841 23.841 0 0 0 8.605 12a23.888 23.888 0 0 0 1.697 2.939 23.855 23.855 0 0 0 3.395 0 23.915 23.915 0 0 0 1.697-2.94 23.902 23.902 0 0 0-1.697-2.937A23.853 23.853 0 0 0 12 9Zm4.33 5.5c-.019.033-.04.065-.058.098l.168-.035-.054-.163c-.02.033-.037.067-.056.1Zm-8.77.063.168.034-.058-.097-.057-.1-.053.163Zm10.808-4.59c-.212.66-.47 1.338-.772 2.027.301.688.56 1.366.772 2.025.113-.041.224-.082.331-.125.835-.334 1.445-.708 1.828-1.07.381-.36.473-.642.473-.83 0-.19-.092-.47-.473-.83-.383-.363-.993-.737-1.828-1.07a10.657 10.657 0 0 0-.33-.127Zm-12.737 0c-.113.041-.223.083-.33.126-.835.334-1.445.708-1.828 1.07-.381.36-.473.642-.473.83 0 .19.092.47.473.83.383.363.993.737 1.828 1.071.107.043.217.084.33.125.212-.659.471-1.337.772-2.025a21.546 21.546 0 0 1-.772-2.027Zm1.929-.537.053.162.057-.098.058-.098-.168.034Zm8.77.064.056.098.053-.162-.168-.035.06.099ZM8.455 4.2c-.503-.15-.792-.089-.955.006-.163.094-.36.314-.482.824-.123.513-.141 1.229-.013 2.119.016.114.035.23.056.349a21.543 21.543 0 0 1 2.14-.345c.446-.605.904-1.17 1.368-1.683-.091-.077-.183-.15-.273-.221-.707-.557-1.335-.898-1.84-1.05Zm8.045.006c-.163-.095-.452-.156-.955-.006-.506.15-1.134.492-1.84 1.049-.091.07-.184.144-.275.221a21.56 21.56 0 0 1 1.368 1.683c.747.083 1.464.199 2.14.345.021-.119.04-.235.057-.349.128-.89.11-1.606-.013-2.12-.121-.51-.319-.73-.482-.823ZM11.887 7 12 7h.112A17.69 17.69 0 0 0 12 6.874L11.887 7Z"
16
16
  clipRule="evenodd"
@@ -10,7 +10,7 @@ const SvgAtom = (props: SVGProps<SVGSVGElement>) => (
10
10
  {...props}
11
11
  >
12
12
  <path
13
- fill="#000"
13
+ fill="currentColor"
14
14
  fillRule="evenodd"
15
15
  d="M14.974 2.284c.831-.248 1.733-.268 2.526.19.793.458 1.227 1.249 1.428 2.093.2.841.196 1.827.047 2.866-.029.196-.065.396-.104.599.196.068.387.137.571.21.975.39 1.83.88 2.46 1.474C22.531 10.313 23 11.084 23 12c0 .915-.468 1.687-1.099 2.283-.628.594-1.484 1.084-2.459 1.473-.184.074-.375.143-.57.211.038.204.074.404.103.6.15 1.039.153 2.025-.047 2.866-.201.844-.635 1.635-1.428 2.093-.793.458-1.695.438-2.526.19-.83-.247-1.681-.743-2.506-1.392a12.997 12.997 0 0 1-.468-.389c-.157.136-.312.266-.468.389-.825.649-1.677 1.145-2.506 1.392-.831.248-1.733.268-2.526-.19-.793-.458-1.227-1.249-1.428-2.093-.2-.841-.196-1.827-.047-2.866.029-.196.064-.396.103-.6a13.01 13.01 0 0 1-.57-.21c-.975-.39-1.83-.88-2.46-1.474C1.469 13.687 1 12.915 1 12c0-.916.468-1.687 1.099-2.284.628-.594 1.484-1.083 2.459-1.473.184-.074.374-.143.57-.211-.04-.203-.074-.403-.103-.599-.15-1.039-.153-2.025.047-2.866.201-.844.635-1.635 1.428-2.093.793-.458 1.695-.438 2.526-.19.83.247 1.681.743 2.506 1.392.156.123.312.253.468.388.156-.135.312-.265.468-.388.825-.649 1.677-1.145 2.506-1.392ZM7.06 16.502a10.7 10.7 0 0 0-.056.35c-.128.89-.11 1.605.013 2.118.121.51.319.73.482.825.163.094.452.155.955.005.506-.15 1.134-.492 1.84-1.049.092-.07.182-.146.274-.223a21.574 21.574 0 0 1-1.368-1.683 21.558 21.558 0 0 1-2.14-.343Zm9.878 0c-.677.145-1.394.26-2.141.343a21.577 21.577 0 0 1-1.368 1.683c.092.077.183.152.274.224.707.556 1.335.898 1.84 1.048.504.15.793.089.956-.006.163-.094.36-.314.482-.824.123-.513.141-1.229.013-2.119a10.715 10.715 0 0 0-.056-.35ZM12 17l-.114-.002.113.127.114-.127L12 17Zm0-8c-.582 0-1.15.022-1.698.061A23.841 23.841 0 0 0 8.605 12a23.888 23.888 0 0 0 1.697 2.939 23.855 23.855 0 0 0 3.395 0 23.915 23.915 0 0 0 1.697-2.94 23.902 23.902 0 0 0-1.697-2.937A23.853 23.853 0 0 0 12 9Zm4.33 5.5c-.019.033-.04.065-.058.098l.168-.035-.054-.163c-.02.033-.037.067-.056.1Zm-8.77.063.168.034-.058-.097-.057-.1-.053.163Zm10.808-4.59c-.212.66-.47 1.338-.772 2.027.301.688.56 1.366.772 2.025.113-.041.224-.082.331-.125.835-.334 1.445-.708 1.828-1.07.381-.36.473-.642.473-.83 0-.19-.092-.47-.473-.83-.383-.363-.993-.737-1.828-1.07a10.657 10.657 0 0 0-.33-.127Zm-12.737 0c-.113.041-.223.083-.33.126-.835.334-1.445.708-1.828 1.07-.381.36-.473.642-.473.83 0 .19.092.47.473.83.383.363.993.737 1.828 1.071.107.043.217.084.33.125.212-.659.471-1.337.772-2.025a21.546 21.546 0 0 1-.772-2.027Zm1.929-.537.053.162.057-.098.058-.098-.168.034Zm8.77.064.056.098.053-.162-.168-.035.06.099ZM8.455 4.2c-.503-.15-.792-.089-.955.006-.163.094-.36.314-.482.824-.123.513-.141 1.229-.013 2.119.016.114.035.23.056.349a21.543 21.543 0 0 1 2.14-.345c.446-.605.904-1.17 1.368-1.683-.091-.077-.183-.15-.273-.221-.707-.557-1.335-.898-1.84-1.05Zm8.045.006c-.163-.095-.452-.156-.955-.006-.506.15-1.134.492-1.84 1.049-.091.07-.184.144-.275.221a21.56 21.56 0 0 1 1.368 1.683c.747.083 1.464.199 2.14.345.021-.119.04-.235.057-.349.128-.89.11-1.606-.013-2.12-.121-.51-.319-.73-.482-.823ZM11.887 7 12 7h.112A17.69 17.69 0 0 0 12 6.874L11.887 7Z"
16
16
  clipRule="evenodd"
@@ -2,11 +2,14 @@ import type { Meta } from "@storybook/react";
2
2
  import React from "react";
3
3
 
4
4
  import {
5
+ ArrowPathIcon,
6
+ AtomIcon,
5
7
  Avatar,
6
8
  Button,
7
9
  Citation,
8
10
  CitationIcons,
9
11
  CitationTitle,
12
+ ClipboardIcon,
10
13
  ClockIcon,
11
14
  ConversationContainer,
12
15
  ConversationMessage,
@@ -180,3 +183,106 @@ footnote [^1]
180
183
  | October 31 | 19 | 10 |
181
184
 
182
185
  `;
186
+
187
+ export const ConversationHandoffExample = () => {
188
+ return (
189
+ <>
190
+ <div className="s-flex s-w-full s-justify-center s-gap-6">
191
+ <ConversationContainer>
192
+ <ConversationMessage
193
+ type="user"
194
+ name="Daph"
195
+ pictureUrl="https://avatars.githubusercontent.com/u/3803406?v=4"
196
+ timestamp="17:09"
197
+ >
198
+ Can you provide an overview of the major frontier language models
199
+ and their specificities. I'm curious about technical details,
200
+ benchmarks, business etc.. I need a complete picture
201
+ </ConversationMessage>
202
+
203
+ <ConversationMessage
204
+ type="agent"
205
+ name="@soupinou"
206
+ pictureUrl="https://avatars.githubusercontent.com/u/138893015?&v=4"
207
+ buttons={[
208
+ <Button
209
+ icon={ClipboardIcon}
210
+ onClick={() => {}}
211
+ size="xs"
212
+ variant={"outline"}
213
+ />,
214
+ <Button
215
+ icon={ArrowPathIcon}
216
+ onClick={() => {}}
217
+ size="xs"
218
+ variant={"outline"}
219
+ />,
220
+ ]}
221
+ >
222
+ <Markdown
223
+ content={
224
+ "Let me use Deep Dive to explore this comprehensively. I'll need some time to gather all the information."
225
+ }
226
+ />
227
+ </ConversationMessage>
228
+
229
+ <ConversationMessage
230
+ type="agentHandoff"
231
+ name="Deep Dive"
232
+ renderName={(name) => (
233
+ <span className="s-inline-flex s-items-center s-text-faint dark:s-text-faint-night">
234
+ <Icon
235
+ visual={AtomIcon}
236
+ size="sm"
237
+ className="s-text-element-600 dark:s-text-element-600-dark"
238
+ />
239
+ <span className="s-ml-1">{name}</span>
240
+ </span>
241
+ )}
242
+ citations={[
243
+ <Citation href="https://www.google.com">
244
+ <CitationIcons>
245
+ <Icon visual={SlackLogo} size="sm" />
246
+ </CitationIcons>
247
+ <CitationTitle>
248
+ Source: Thread on #general message from @ed
249
+ </CitationTitle>
250
+ </Citation>,
251
+ <Citation href="https://www.google.com">
252
+ <CitationIcons>
253
+ <Icon visual={GithubIcon} size="sm" />
254
+ </CitationIcons>
255
+ <CitationTitle>PR from @henry</CitationTitle>
256
+ </Citation>,
257
+ ]}
258
+ >
259
+ <Markdown content={handoffAnswer} />
260
+ </ConversationMessage>
261
+ </ConversationContainer>
262
+ </div>
263
+ </>
264
+ );
265
+ };
266
+
267
+ const handoffAnswer = `
268
+ **A Complete Technical Overview of Soupinou: The Frontier Feline Model**
269
+
270
+ Soupinou represents a breakthrough in black cat architecture, featuring a revolutionary single-whisker design that challenges conventional multi-whisker paradigms. This asymmetric sensor configuration demonstrates remarkable efficiency gains in cuddle detection and lap-finding algorithms.
271
+
272
+ **Technical Specifications:**
273
+ - Processing unit: One (1) whisker sensor array
274
+ - Color depth: Maximum black saturation
275
+ - Purr frequency: Variable, optimized for human dopamine release
276
+ - Cuddle latency: Near-zero response time
277
+
278
+ **Benchmark Performance:**
279
+ - Achieves 99.7% accuracy in identifying the exact moment you sit down
280
+ - Outperforms all competitors in the "appearing from nowhere when you're sad" metric
281
+ - Sets new industry standards for selective hearing (responds to treat bags but not "get off the counter")
282
+
283
+ **Business Model:**
284
+ Operates on a simple value exchange - provides unlimited affection in return for food, shelter, and accepting that everything you own now has black fur on it. Market penetration strategy involves strategic placement on keyboards during important work calls.
285
+
286
+ **Limitations:**
287
+ Occasional system crashes when presented with empty food bowl. Single whisker may cause slight navigation errors when squeezing through spaces designed for two-whiskered models.
288
+ `;