@dust-tt/sparkle 0.2.207 → 0.2.209

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dust-tt/sparkle",
3
- "version": "0.2.207",
3
+ "version": "0.2.209",
4
4
  "scripts": {
5
5
  "build": "rm -rf dist && rollup -c",
6
6
  "build:with-tw-base": "rollup -c --environment INCLUDE_TW_BASE:true",
@@ -254,7 +254,26 @@ DataTable.Row = function Row({
254
254
  </tr>
255
255
  );
256
256
  };
257
- interface CellProps extends React.TdHTMLAttributes<HTMLTableCellElement> {
257
+
258
+ interface CellProps extends React.HTMLAttributes<HTMLTableCellElement> {
259
+ children: ReactNode;
260
+ }
261
+
262
+ DataTable.Cell = function Cell({ children, className, ...props }: CellProps) {
263
+ return (
264
+ <td
265
+ className={classNames(
266
+ "s-whitespace-nowrap s-py-2 s-pl-0.5 s-text-element-800",
267
+ className || ""
268
+ )}
269
+ {...props}
270
+ >
271
+ {children}
272
+ </td>
273
+ );
274
+ };
275
+
276
+ interface CellContentProps extends React.TdHTMLAttributes<HTMLDivElement> {
258
277
  avatarUrl?: string;
259
278
  icon?: React.ComponentType<{ className?: string }>;
260
279
  iconClassName?: string;
@@ -263,7 +282,7 @@ interface CellProps extends React.TdHTMLAttributes<HTMLTableCellElement> {
263
282
  description?: string;
264
283
  }
265
284
 
266
- DataTable.Cell = function Cell({
285
+ DataTable.CellContent = function CellContent({
267
286
  children,
268
287
  className,
269
288
  avatarUrl,
@@ -272,44 +291,36 @@ DataTable.Cell = function Cell({
272
291
  iconClassName,
273
292
  description,
274
293
  ...props
275
- }: CellProps) {
294
+ }: CellContentProps) {
276
295
  return (
277
- <td
278
- className={classNames(
279
- "s-whitespace-nowrap s-py-2 s-pl-0.5 s-text-element-800",
280
- className || ""
296
+ <div className={classNames("s-flex s-py-2", className || "")} {...props}>
297
+ {avatarUrl && (
298
+ <Avatar
299
+ visual={avatarUrl}
300
+ size="xs"
301
+ className="s-mr-2"
302
+ isRounded={roundedAvatar ?? false}
303
+ />
304
+ )}
305
+ {icon && (
306
+ <Icon
307
+ visual={icon}
308
+ size="sm"
309
+ className={classNames(
310
+ "s-mr-2 s-text-element-600",
311
+ iconClassName || ""
312
+ )}
313
+ />
281
314
  )}
282
- {...props}
283
- >
284
315
  <div className="s-flex">
285
- {avatarUrl && (
286
- <Avatar
287
- visual={avatarUrl}
288
- size="xs"
289
- className="s-mr-2"
290
- isRounded={roundedAvatar ?? false}
291
- />
316
+ <span className="s-text-sm s-text-element-800">{children}</span>
317
+ {description && (
318
+ <span className="s-pl-2 s-text-sm s-text-element-600">
319
+ {description}
320
+ </span>
292
321
  )}
293
- {icon && (
294
- <Icon
295
- visual={icon}
296
- size="sm"
297
- className={classNames(
298
- "s-mr-2 s-text-element-600",
299
- iconClassName || ""
300
- )}
301
- />
302
- )}
303
- <div className="s-flex">
304
- <span className="s-text-sm s-text-element-800">{children}</span>
305
- {description && (
306
- <span className="s-pl-2 s-text-sm s-text-element-600">
307
- {description}
308
- </span>
309
- )}
310
- </div>
311
322
  </div>
312
- </td>
323
+ </div>
313
324
  );
314
325
  };
315
326
 
@@ -201,6 +201,7 @@ export const CitationsExample = () => (
201
201
  <h2>With zoom effect</h2>
202
202
  <div className="s-flex s-gap-2">
203
203
  <ZoomableImageCitationWrapper
204
+ size="sm"
204
205
  title="With imgSrc"
205
206
  // size="xs"
206
207
  imgSrc="https://dust.tt/static/droidavatar/Droid_Black_4.jpg"
@@ -82,42 +82,50 @@ export const DataTableExample = () => {
82
82
  accessorKey: "name",
83
83
  header: "Name",
84
84
  cell: (info) => (
85
- <DataTable.Cell
85
+ <DataTable.CellContent
86
86
  avatarUrl={info.row.original.avatarUrl}
87
87
  icon={info.row.original.icon}
88
88
  description={info.row.original.description}
89
89
  roundedAvatar={info.row.original.roundedAvatar}
90
90
  >
91
91
  {info.row.original.name}
92
- </DataTable.Cell>
92
+ </DataTable.CellContent>
93
93
  ),
94
94
  },
95
95
  {
96
96
  accessorKey: "usedBy",
97
97
  header: "Used by",
98
98
  cell: (info) => (
99
- <DataTable.Cell>{info.row.original.usedBy}</DataTable.Cell>
99
+ <DataTable.CellContent>
100
+ {info.row.original.usedBy}
101
+ </DataTable.CellContent>
100
102
  ),
101
103
  },
102
104
  {
103
105
  accessorKey: "addedBy",
104
106
  header: "Added by",
105
107
  cell: (info) => (
106
- <DataTable.Cell>{info.row.original.addedBy}</DataTable.Cell>
108
+ <DataTable.CellContent>
109
+ {info.row.original.addedBy}
110
+ </DataTable.CellContent>
107
111
  ),
108
112
  },
109
113
  {
110
114
  accessorKey: "lastUpdated",
111
115
  header: "Last updated",
112
116
  cell: (info) => (
113
- <DataTable.Cell>{info.row.original.lastUpdated}</DataTable.Cell>
117
+ <DataTable.CellContent>
118
+ {info.row.original.lastUpdated}
119
+ </DataTable.CellContent>
114
120
  ),
115
121
  enableSorting: false,
116
122
  },
117
123
  {
118
124
  accessorKey: "size",
119
125
  header: "Size",
120
- cell: (info) => <DataTable.Cell>{info.row.original.size}</DataTable.Cell>,
126
+ cell: (info) => (
127
+ <DataTable.CellContent>{info.row.original.size}</DataTable.CellContent>
128
+ ),
121
129
  },
122
130
  ];
123
131