@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/dist/cjs/components/DataTable.d.ts +6 -2
- package/dist/cjs/index.js +9 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/components/DataTable.d.ts +6 -2
- package/dist/esm/index.js +9 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/DataTable.tsx +46 -35
- package/src/stories/Citation.stories.tsx +1 -0
- package/src/stories/DataTable.stories.tsx +14 -6
package/package.json
CHANGED
|
@@ -254,7 +254,26 @@ DataTable.Row = function Row({
|
|
|
254
254
|
</tr>
|
|
255
255
|
);
|
|
256
256
|
};
|
|
257
|
-
|
|
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.
|
|
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
|
-
}:
|
|
294
|
+
}: CellContentProps) {
|
|
276
295
|
return (
|
|
277
|
-
<
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
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
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
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
|
-
</
|
|
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.
|
|
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.
|
|
92
|
+
</DataTable.CellContent>
|
|
93
93
|
),
|
|
94
94
|
},
|
|
95
95
|
{
|
|
96
96
|
accessorKey: "usedBy",
|
|
97
97
|
header: "Used by",
|
|
98
98
|
cell: (info) => (
|
|
99
|
-
<DataTable.
|
|
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.
|
|
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.
|
|
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) =>
|
|
126
|
+
cell: (info) => (
|
|
127
|
+
<DataTable.CellContent>{info.row.original.size}</DataTable.CellContent>
|
|
128
|
+
),
|
|
121
129
|
},
|
|
122
130
|
];
|
|
123
131
|
|