@dust-tt/sparkle 0.2.644 → 0.2.645

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.
@@ -52,6 +52,7 @@ type Data = {
52
52
  >;
53
53
  id?: number;
54
54
  roundedAvatar?: boolean;
55
+ avatarStack?: { name: string; visual: string }[];
55
56
  };
56
57
 
57
58
  type TransformedData = {
@@ -181,6 +182,130 @@ const data: TransformedData[] = [
181
182
  },
182
183
  ];
183
184
 
185
+ const avatarStackData: TransformedData[] = [
186
+ {
187
+ name: "Team Alpha",
188
+ description: "Development team",
189
+ usedBy: 12,
190
+ addedBy: "Project Manager",
191
+ lastUpdated: "2024-01-15",
192
+ size: "256kb",
193
+ avatarStack: [
194
+ {
195
+ name: "Alice Johnson",
196
+ visual: "https://avatars.githubusercontent.com/u/1?s=200&v=4",
197
+ },
198
+ {
199
+ name: "Bob Smith",
200
+ visual: "https://avatars.githubusercontent.com/u/2?s=200&v=4",
201
+ },
202
+ {
203
+ name: "Carol Davis",
204
+ visual: "https://avatars.githubusercontent.com/u/3?s=200&v=4",
205
+ },
206
+ {
207
+ name: "David Wilson",
208
+ visual: "https://avatars.githubusercontent.com/u/4?s=200&v=4",
209
+ },
210
+ {
211
+ name: "Eve Brown",
212
+ visual: "https://avatars.githubusercontent.com/u/5?s=200&v=4",
213
+ },
214
+ ],
215
+ onClick: () => alert("Team Alpha clicked"),
216
+ },
217
+ {
218
+ name: "Marketing Team",
219
+ description: "Marketing and communications",
220
+ usedBy: 8,
221
+ addedBy: "Marketing Director",
222
+ lastUpdated: "2024-01-14",
223
+ size: "128kb",
224
+ avatarStack: [
225
+ {
226
+ name: "Frank Miller",
227
+ visual: "https://avatars.githubusercontent.com/u/6?s=200&v=4",
228
+ },
229
+ {
230
+ name: "Grace Lee",
231
+ visual: "https://avatars.githubusercontent.com/u/7?s=200&v=4",
232
+ },
233
+ {
234
+ name: "Henry Taylor",
235
+ visual: "https://avatars.githubusercontent.com/u/8?s=200&v=4",
236
+ },
237
+ ],
238
+ onClick: () => alert("Marketing Team clicked"),
239
+ },
240
+ {
241
+ name: "Design Squad",
242
+ description: "UI/UX design team",
243
+ usedBy: 6,
244
+ addedBy: "Design Lead",
245
+ lastUpdated: "2024-01-13",
246
+ size: "512kb",
247
+ avatarStack: [
248
+ {
249
+ name: "Ivy Chen",
250
+ visual: "https://avatars.githubusercontent.com/u/9?s=200&v=4",
251
+ },
252
+ {
253
+ name: "Jack Rodriguez",
254
+ visual: "https://avatars.githubusercontent.com/u/10?s=200&v=4",
255
+ },
256
+ {
257
+ name: "Kate Anderson",
258
+ visual: "https://avatars.githubusercontent.com/u/11?s=200&v=4",
259
+ },
260
+ {
261
+ name: "Liam Thompson",
262
+ visual: "https://avatars.githubusercontent.com/u/12?s=200&v=4",
263
+ },
264
+ ],
265
+ roundedAvatar: true,
266
+ onClick: () => alert("Design Squad clicked"),
267
+ },
268
+ {
269
+ name: "Large Team",
270
+ description: "Cross-functional team with many members",
271
+ usedBy: 25,
272
+ addedBy: "Team Lead",
273
+ lastUpdated: "2024-01-12",
274
+ size: "1.2mb",
275
+ avatarStack: [
276
+ {
277
+ name: "Maya Patel",
278
+ visual: "https://avatars.githubusercontent.com/u/13?s=200&v=4",
279
+ },
280
+ {
281
+ name: "Noah Garcia",
282
+ visual: "https://avatars.githubusercontent.com/u/14?s=200&v=4",
283
+ },
284
+ {
285
+ name: "Olivia Martinez",
286
+ visual: "https://avatars.githubusercontent.com/u/15?s=200&v=4",
287
+ },
288
+ {
289
+ name: "Paul Kim",
290
+ visual: "https://avatars.githubusercontent.com/u/16?s=200&v=4",
291
+ },
292
+ {
293
+ name: "Quinn White",
294
+ visual: "https://avatars.githubusercontent.com/u/17?s=200&v=4",
295
+ },
296
+ {
297
+ name: "Rachel Green",
298
+ visual: "https://avatars.githubusercontent.com/u/18?s=200&v=4",
299
+ },
300
+ {
301
+ name: "Sam Johnson",
302
+ visual: "https://avatars.githubusercontent.com/u/19?s=200&v=4",
303
+ },
304
+ ],
305
+ onClick: () => alert("Large Team clicked"),
306
+ },
307
+ ];
308
+
184
309
  const columns: ColumnDef<Data>[] = [
185
310
  {
186
311
  accessorKey: "name",
@@ -770,3 +895,113 @@ export const DataTableWithRadioSelectionExample = () => {
770
895
  </div>
771
896
  );
772
897
  };
898
+
899
+ // Column definition for avatar stack story
900
+ const avatarStackColumns: ColumnDef<Data>[] = [
901
+ {
902
+ accessorKey: "name",
903
+ header: "Team Name",
904
+ sortingFn: "text",
905
+ id: "name",
906
+ meta: {
907
+ className: "s-w-full",
908
+ tooltip: "Team name with member avatars",
909
+ },
910
+ cell: (info) => (
911
+ <DataTable.CellContent
912
+ avatarStack={
913
+ info.row.original.avatarStack
914
+ ? {
915
+ items: info.row.original.avatarStack,
916
+ nbVisibleItems: 3,
917
+ }
918
+ : undefined
919
+ }
920
+ description={info.row.original.description}
921
+ roundedAvatar={info.row.original.roundedAvatar}
922
+ >
923
+ {info.row.original.name}
924
+ </DataTable.CellContent>
925
+ ),
926
+ },
927
+ {
928
+ accessorKey: "usedBy",
929
+ id: "usedBy",
930
+ meta: {
931
+ className: "s-w-[82px] s-hidden @xs/table:s-table-cell",
932
+ },
933
+ header: "Members",
934
+ cell: (info) => (
935
+ <DataTable.BasicCellContent label={info.row.original.usedBy} />
936
+ ),
937
+ },
938
+ {
939
+ accessorKey: "addedBy",
940
+ header: "Created by",
941
+ id: "addedBy",
942
+ meta: {
943
+ className: "s-w-[128px]",
944
+ },
945
+ cell: (info) => (
946
+ <DataTable.BasicCellContent
947
+ label={info.row.original.addedBy}
948
+ textToCopy={info.row.original.addedBy}
949
+ tooltip={info.row.original.addedBy}
950
+ />
951
+ ),
952
+ },
953
+ {
954
+ accessorKey: "lastUpdated",
955
+ id: "lastUpdated",
956
+ header: "Last updated",
957
+ meta: {
958
+ className: "s-w-[128px] s-hidden @sm/table:s-table-cell",
959
+ },
960
+ cell: (info) => (
961
+ <DataTable.BasicCellContent label={info.row.original.lastUpdated} />
962
+ ),
963
+ enableSorting: false,
964
+ },
965
+ {
966
+ accessorKey: "size",
967
+ id: "size",
968
+ header: "Size",
969
+ meta: {
970
+ className: "s-w-[48px] s-hidden @sm/table:s-table-cell",
971
+ },
972
+ cell: (info) => (
973
+ <DataTable.BasicCellContent label={info.row.original.size} />
974
+ ),
975
+ },
976
+ ];
977
+
978
+ export const DataTableWithAvatarStackExample = () => {
979
+ const [filter, setFilter] = React.useState<string>("");
980
+
981
+ return (
982
+ <div className="s-flex s-w-full s-max-w-4xl s-flex-col s-gap-6">
983
+ <h3 className="s-text-lg s-font-medium">DataTable with Avatar Stack</h3>
984
+ <p className="s-text-sm s-text-muted-foreground">
985
+ This example demonstrates the DataTable with avatar stacks showing team
986
+ members. The avatar stack displays up to 4 visible avatars with a count
987
+ indicator for additional members.
988
+ </p>
989
+
990
+ <div className="s-flex s-flex-col s-gap-4">
991
+ <Input
992
+ name="filter"
993
+ placeholder="Filter teams..."
994
+ value={filter}
995
+ onChange={(e) => setFilter(e.target.value)}
996
+ />
997
+
998
+ <DataTable
999
+ data={avatarStackData}
1000
+ filter={filter}
1001
+ filterColumn="name"
1002
+ columns={avatarStackColumns}
1003
+ />
1004
+ </div>
1005
+ </div>
1006
+ );
1007
+ };