@dust-tt/sparkle 0.2.646-rc-3 → 0.2.646

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.
Files changed (94) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/esm/components/DataTable.d.ts +13 -3
  3. package/dist/esm/components/DataTable.d.ts.map +1 -1
  4. package/dist/esm/components/DataTable.js +9 -8
  5. package/dist/esm/components/DataTable.js.map +1 -1
  6. package/dist/esm/components/markdown/BlockquoteBlock.d.ts +1 -3
  7. package/dist/esm/components/markdown/BlockquoteBlock.d.ts.map +1 -1
  8. package/dist/esm/components/markdown/BlockquoteBlock.js +3 -7
  9. package/dist/esm/components/markdown/BlockquoteBlock.js.map +1 -1
  10. package/dist/esm/components/markdown/CodeBlockWithExtendedSupport.d.ts +2 -4
  11. package/dist/esm/components/markdown/CodeBlockWithExtendedSupport.d.ts.map +1 -1
  12. package/dist/esm/components/markdown/CodeBlockWithExtendedSupport.js +6 -11
  13. package/dist/esm/components/markdown/CodeBlockWithExtendedSupport.js.map +1 -1
  14. package/dist/esm/components/markdown/List.d.ts +3 -17
  15. package/dist/esm/components/markdown/List.d.ts.map +1 -1
  16. package/dist/esm/components/markdown/List.js +7 -21
  17. package/dist/esm/components/markdown/List.js.map +1 -1
  18. package/dist/esm/components/markdown/Markdown.d.ts +9 -2
  19. package/dist/esm/components/markdown/Markdown.d.ts.map +1 -1
  20. package/dist/esm/components/markdown/Markdown.js +66 -45
  21. package/dist/esm/components/markdown/Markdown.js.map +1 -1
  22. package/dist/esm/components/markdown/ParagraphBlock.d.ts +1 -3
  23. package/dist/esm/components/markdown/ParagraphBlock.d.ts.map +1 -1
  24. package/dist/esm/components/markdown/ParagraphBlock.js +3 -7
  25. package/dist/esm/components/markdown/ParagraphBlock.js.map +1 -1
  26. package/dist/esm/components/markdown/PreBlock.d.ts +1 -3
  27. package/dist/esm/components/markdown/PreBlock.d.ts.map +1 -1
  28. package/dist/esm/components/markdown/PreBlock.js +3 -7
  29. package/dist/esm/components/markdown/PreBlock.js.map +1 -1
  30. package/dist/esm/components/markdown/TableBlock.d.ts +11 -17
  31. package/dist/esm/components/markdown/TableBlock.d.ts.map +1 -1
  32. package/dist/esm/components/markdown/TableBlock.js +14 -18
  33. package/dist/esm/components/markdown/TableBlock.js.map +1 -1
  34. package/dist/esm/components/markdown/index.d.ts +0 -4
  35. package/dist/esm/components/markdown/index.d.ts.map +1 -1
  36. package/dist/esm/components/markdown/index.js +0 -4
  37. package/dist/esm/components/markdown/index.js.map +1 -1
  38. package/dist/esm/components/markdown/utils.d.ts +0 -11
  39. package/dist/esm/components/markdown/utils.d.ts.map +1 -1
  40. package/dist/esm/components/markdown/utils.js +0 -21
  41. package/dist/esm/components/markdown/utils.js.map +1 -1
  42. package/dist/esm/stories/DataTable.stories.d.ts +1 -0
  43. package/dist/esm/stories/DataTable.stories.d.ts.map +1 -1
  44. package/dist/esm/stories/DataTable.stories.js +188 -0
  45. package/dist/esm/stories/DataTable.stories.js.map +1 -1
  46. package/dist/esm/styles/global.css +12 -0
  47. package/dist/esm/styles/global_with_tw_base.css +12 -0
  48. package/dist/esm/styles/tailwind.css +11 -0
  49. package/dist/sparkle.css +34 -0
  50. package/package.json +1 -2
  51. package/src/components/DataTable.tsx +31 -2
  52. package/src/components/markdown/BlockquoteBlock.tsx +29 -36
  53. package/src/components/markdown/CodeBlockWithExtendedSupport.tsx +131 -142
  54. package/src/components/markdown/List.tsx +30 -53
  55. package/src/components/markdown/Markdown.tsx +171 -108
  56. package/src/components/markdown/ParagraphBlock.tsx +12 -18
  57. package/src/components/markdown/PreBlock.tsx +18 -28
  58. package/src/components/markdown/TableBlock.tsx +95 -125
  59. package/src/components/markdown/index.ts +0 -4
  60. package/src/components/markdown/utils.ts +0 -37
  61. package/src/stories/DataTable.stories.tsx +235 -0
  62. package/src/styles/global.css +12 -0
  63. package/src/styles/global_with_tw_base.css +12 -0
  64. package/src/styles/tailwind.css +11 -0
  65. package/dist/esm/components/markdown/HeaderBlocks.d.ts +0 -24
  66. package/dist/esm/components/markdown/HeaderBlocks.d.ts.map +0 -1
  67. package/dist/esm/components/markdown/HeaderBlocks.js +0 -54
  68. package/dist/esm/components/markdown/HeaderBlocks.js.map +0 -1
  69. package/dist/esm/components/markdown/InputBlock.d.ts +0 -10
  70. package/dist/esm/components/markdown/InputBlock.d.ts.map +0 -1
  71. package/dist/esm/components/markdown/InputBlock.js +0 -26
  72. package/dist/esm/components/markdown/InputBlock.js.map +0 -1
  73. package/dist/esm/components/markdown/LinkBlock.d.ts +0 -10
  74. package/dist/esm/components/markdown/LinkBlock.d.ts.map +0 -1
  75. package/dist/esm/components/markdown/LinkBlock.js +0 -11
  76. package/dist/esm/components/markdown/LinkBlock.js.map +0 -1
  77. package/dist/esm/components/markdown/TextFormattingBlocks.d.ts +0 -10
  78. package/dist/esm/components/markdown/TextFormattingBlocks.d.ts.map +0 -1
  79. package/dist/esm/components/markdown/TextFormattingBlocks.js +0 -12
  80. package/dist/esm/components/markdown/TextFormattingBlocks.js.map +0 -1
  81. package/dist/esm/components/markdown/types.d.ts +0 -13
  82. package/dist/esm/components/markdown/types.d.ts.map +0 -1
  83. package/dist/esm/components/markdown/types.js +0 -2
  84. package/dist/esm/components/markdown/types.js.map +0 -1
  85. package/dist/esm/components/markdown/useAnimatedText.d.ts +0 -2
  86. package/dist/esm/components/markdown/useAnimatedText.d.ts.map +0 -1
  87. package/dist/esm/components/markdown/useAnimatedText.js +0 -31
  88. package/dist/esm/components/markdown/useAnimatedText.js.map +0 -1
  89. package/src/components/markdown/HeaderBlocks.tsx +0 -160
  90. package/src/components/markdown/InputBlock.tsx +0 -60
  91. package/src/components/markdown/LinkBlock.tsx +0 -36
  92. package/src/components/markdown/TextFormattingBlocks.tsx +0 -31
  93. package/src/components/markdown/types.ts +0 -5
  94. package/src/components/markdown/useAnimatedText.ts +0 -36
@@ -1,12 +1,9 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import React, { memo, ReactNode, useMemo } from "react";
2
+ import React, { ReactNode, useMemo } from "react";
3
3
 
4
4
  import { ScrollArea, ScrollBar } from "@sparkle/components";
5
5
  import { ContentBlockWrapper } from "@sparkle/components/markdown/ContentBlockWrapper";
6
6
 
7
- import { MarkdownNode } from "./types";
8
- import { sameNodePosition } from "./utils";
9
-
10
7
  const getNodeText = (node: ReactNode): string => {
11
8
  if (["string", "number"].includes(typeof node)) {
12
9
  return node as string;
@@ -21,127 +18,100 @@ const getNodeText = (node: ReactNode): string => {
21
18
  return "";
22
19
  };
23
20
 
24
- export const MemoTableBlock = memo(
25
- ({ children }: { children: React.ReactNode; node?: MarkdownNode }) => {
26
- const tableData = useMemo(() => {
27
- const [headNode, bodyNode] = Array.from(children as [any, any]);
28
- if (
29
- !headNode ||
30
- !bodyNode ||
31
- !("props" in headNode) ||
32
- !("props" in bodyNode)
33
- ) {
34
- return;
35
- }
36
-
37
- const headCells = headNode.props.children[0].props.children.map(
38
- (c: any) => getNodeText(c.props.children)
39
- );
40
-
41
- const headHtml = `<thead><tr>${headCells
42
- .map((c: any) => `<th><b>${c}</b></th>`)
43
- .join("")}</tr></thead>`;
44
- const headPlain = headCells.join("\t");
45
-
46
- const bodyRows = bodyNode.props.children.map((row: any) =>
47
- row.props.children.map((cell: any) => {
48
- const children = cell.props.children;
49
- return (Array.isArray(children) ? children : [children])
50
- .map((child: any) =>
51
- child?.type?.name === "CiteBlock" ? "" : getNodeText(child)
52
- )
53
- .join("");
54
- })
55
- );
56
- const bodyHtml = `<tbody>${bodyRows
57
- .map((row: any) => {
58
- return `<tr>${row
59
- .map((cell: any) => `<td>${cell}</td>`)
60
- .join("")}</tr>`;
61
- })
62
- .join("")}</tbody>`;
63
- const bodyPlain = bodyRows.map((row: any) => row.join("\t")).join("\n");
64
-
65
- return {
66
- "text/html": `<table>${headHtml}${bodyHtml}</table>`,
67
- "text/plain": headPlain + "\n" + bodyPlain,
68
- };
69
- }, [children]);
70
-
71
- return (
72
- <ContentBlockWrapper
73
- innerClassName="s-relative s-my-2 s-w-full s-border s-border-border dark:s-border-border-night s-rounded-2xl"
74
- content={tableData}
75
- >
76
- <ScrollArea className="s-w-full s-rounded-2xl">
77
- <table className="s-w-full">{children}</table>
78
- <ScrollBar orientation="horizontal" />
79
- </ScrollArea>
80
- </ContentBlockWrapper>
81
- );
82
- },
83
- (prev, next) => sameNodePosition(prev.node, next.node)
84
- );
85
-
86
- MemoTableBlock.displayName = "TableBlock";
87
-
88
- export const MemoTableHeadBlock = memo(
89
- ({ children }: { children: React.ReactNode; node?: MarkdownNode }) => {
90
- return (
91
- <thead className="s-bg-muted-background s-px-2 s-py-2 dark:s-bg-muted-background-night">
92
- {children}
93
- </thead>
94
- );
95
- },
96
- (prev, next) => sameNodePosition(prev.node, next.node)
97
- );
98
-
99
- MemoTableHeadBlock.displayName = "TableHeadBlock";
100
-
101
- export const MemoTableBodyBlock = memo(
102
- ({ children }: { children: React.ReactNode; node?: MarkdownNode }) => {
103
- return (
104
- <tbody className="s-bg-white dark:s-bg-background-night">
105
- {children}
106
- </tbody>
107
- );
108
- },
109
- (prev, next) => sameNodePosition(prev.node, next.node)
110
- );
111
-
112
- MemoTableBodyBlock.displayName = "TableBodyBlock";
113
-
114
- export const MemoTableHeaderBlock = memo(
115
- ({ children }: { children: React.ReactNode; node?: MarkdownNode }) => {
116
- return (
117
- <th className="s-truncate s-whitespace-nowrap s-break-words s-py-3.5 s-pl-4 s-text-left s-text-xs s-font-semibold s-text-muted-foreground dark:s-text-muted-foreground-night">
118
- {children}
119
- </th>
21
+ export function TableBlock({ children }: { children: React.ReactNode }) {
22
+ const tableData = useMemo(() => {
23
+ const [headNode, bodyNode] = Array.from(children as [any, any]);
24
+ if (
25
+ !headNode ||
26
+ !bodyNode ||
27
+ !("props" in headNode) ||
28
+ !("props" in bodyNode)
29
+ ) {
30
+ return;
31
+ }
32
+
33
+ const headCells = headNode.props.children[0].props.children.map((c: any) =>
34
+ getNodeText(c.props.children)
120
35
  );
121
- },
122
- (prev, next) => sameNodePosition(prev.node, next.node)
123
- );
124
-
125
- MemoTableHeaderBlock.displayName = "TableHeaderBlock";
126
36
 
127
- export const MemoTableDataBlock = memo(
128
- ({ children }: { children: React.ReactNode; node?: MarkdownNode }) => {
129
- return (
130
- <td className="s-px-4 s-py-3 s-text-sm s-text-foreground dark:s-text-foreground-night">
131
- {Array.isArray(children) ? (
132
- children.map((child: any, i) => {
133
- if (child === "<br>") {
134
- return <br key={i} />;
135
- }
136
- return <React.Fragment key={i}>{child}</React.Fragment>;
137
- })
138
- ) : (
139
- <>{children}</>
140
- )}
141
- </td>
37
+ const headHtml = `<thead><tr>${headCells
38
+ .map((c: any) => `<th><b>${c}</b></th>`)
39
+ .join("")}</tr></thead>`;
40
+ const headPlain = headCells.join("\t");
41
+
42
+ const bodyRows = bodyNode.props.children.map((row: any) =>
43
+ row.props.children.map((cell: any) => {
44
+ const children = cell.props.children;
45
+ return (Array.isArray(children) ? children : [children])
46
+ .map((child: any) =>
47
+ child?.type?.name === "CiteBlock" ? "" : getNodeText(child)
48
+ )
49
+ .join("");
50
+ })
142
51
  );
143
- },
144
- (prev, next) => sameNodePosition(prev.node, next.node)
145
- );
146
-
147
- MemoTableDataBlock.displayName = "TableDataBlock";
52
+ const bodyHtml = `<tbody>${bodyRows
53
+ .map((row: any) => {
54
+ return `<tr>${row
55
+ .map((cell: any) => `<td>${cell}</td>`)
56
+ .join("")}</tr>`;
57
+ })
58
+ .join("")}</tbody>`;
59
+ const bodyPlain = bodyRows.map((row: any) => row.join("\t")).join("\n");
60
+
61
+ return {
62
+ "text/html": `<table>${headHtml}${bodyHtml}</table>`,
63
+ "text/plain": headPlain + "\n" + bodyPlain,
64
+ };
65
+ }, [children]);
66
+
67
+ return (
68
+ <ContentBlockWrapper
69
+ innerClassName="s-relative s-my-2 s-w-full s-border s-border-border dark:s-border-border-night s-rounded-2xl"
70
+ content={tableData}
71
+ >
72
+ <ScrollArea className="s-w-full s-rounded-2xl">
73
+ <table className="s-w-full">{children}</table>
74
+ <ScrollBar orientation="horizontal" />
75
+ </ScrollArea>
76
+ </ContentBlockWrapper>
77
+ );
78
+ }
79
+
80
+ export function TableHeadBlock({ children }: { children: React.ReactNode }) {
81
+ return (
82
+ <thead className="s-bg-muted-background s-px-2 s-py-2 dark:s-bg-muted-background-night">
83
+ {children}
84
+ </thead>
85
+ );
86
+ }
87
+
88
+ export function TableBodyBlock({ children }: { children: React.ReactNode }) {
89
+ return (
90
+ <tbody className="s-bg-white dark:s-bg-background-night">{children}</tbody>
91
+ );
92
+ }
93
+
94
+ export function TableHeaderBlock({ children }: { children: React.ReactNode }) {
95
+ return (
96
+ <th className="s-truncate s-whitespace-nowrap s-break-words s-py-3.5 s-pl-4 s-text-left s-text-xs s-font-semibold s-text-muted-foreground dark:s-text-muted-foreground-night">
97
+ {children}
98
+ </th>
99
+ );
100
+ }
101
+
102
+ export function TableDataBlock({ children }: { children: React.ReactNode }) {
103
+ return (
104
+ <td className="s-px-4 s-py-3 s-text-sm s-text-foreground dark:s-text-foreground-night">
105
+ {Array.isArray(children) ? (
106
+ children.map((child: any, i) => {
107
+ if (child === "<br>") {
108
+ return <br key={i} />;
109
+ }
110
+ return <React.Fragment key={i}>{child}</React.Fragment>;
111
+ })
112
+ ) : (
113
+ <>{children}</>
114
+ )}
115
+ </td>
116
+ );
117
+ }
@@ -1,12 +1,8 @@
1
1
  export * from "./CodeBlock";
2
2
  export * from "./CodeBlockWithExtendedSupport";
3
3
  export * from "./ContentBlockWrapper";
4
- export * from "./HeaderBlocks";
5
- export * from "./InputBlock";
6
- export * from "./LinkBlock";
7
4
  export * from "./Markdown";
8
5
  export * from "./MarkdownContentContext";
9
6
  export * from "./PrettyJsonViewer";
10
7
  export * from "./TableBlock";
11
- export * from "./TextFormattingBlocks";
12
8
  export * from "./utils";
@@ -1,5 +1,3 @@
1
- import { MarkdownNode } from "./types";
2
-
3
1
  export function sanitizeContent(str: string): string {
4
2
  // (1) Add closing backticks if they are missing such that we render a code block or inline
5
3
  // element during streaming.
@@ -41,38 +39,3 @@ export function detectLanguage(children: React.ReactNode) {
41
39
 
42
40
  return "text";
43
41
  }
44
-
45
- export function sameNodePosition(
46
- prev?: MarkdownNode,
47
- next?: MarkdownNode
48
- ): boolean {
49
- if (!(prev?.position || next?.position)) {
50
- return true;
51
- }
52
- if (!(prev?.position && next?.position)) {
53
- return false;
54
- }
55
-
56
- const prevStart = prev.position.start;
57
- const nextStart = next.position.start;
58
- const prevEnd = prev.position.end;
59
- const nextEnd = next.position.end;
60
-
61
- return (
62
- prevStart?.line === nextStart?.line &&
63
- prevStart?.column === nextStart?.column &&
64
- prevEnd?.line === nextEnd?.line &&
65
- prevEnd?.column === nextEnd?.column
66
- );
67
- }
68
-
69
- export function sameTextStyling(
70
- prev: { textColor?: string; textSize?: string; forcedTextSize?: string },
71
- next: { textColor?: string; textSize?: string; forcedTextSize?: string }
72
- ): boolean {
73
- return (
74
- prev.textColor === next.textColor &&
75
- prev.textSize === next.textSize &&
76
- prev.forcedTextSize === next.forcedTextSize
77
- );
78
- }
@@ -52,6 +52,7 @@ type Data = {
52
52
  >;
53
53
  id?: number;
54
54
  roundedAvatar?: boolean;
55
+ avatarStack?: { name: string; visual?: string | React.ReactNode }[];
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
+ };
@@ -51,3 +51,15 @@
51
51
  --tw-checker-color: theme("colors.slate.950"); /* Dark mode pattern color */
52
52
  }
53
53
  }
54
+
55
+ .s-blinking-cursor > :not(pre):last-child::after {
56
+ content: "";
57
+ width: 8px;
58
+ height: 16px;
59
+ @apply s-bg-success-400;
60
+ display: inline-block;
61
+ @apply s-animate-cursor-blink;
62
+ margin-left: 5px;
63
+ position: relative;
64
+ top: 4px;
65
+ }
@@ -2,6 +2,18 @@
2
2
  @tailwind components;
3
3
  @tailwind utilities;
4
4
 
5
+ .s-blinking-cursor > :not(pre):last-child::after {
6
+ content: "";
7
+ width: 8px;
8
+ height: 16px;
9
+ @apply s-bg-success-400;
10
+ display: inline-block;
11
+ @apply s-animate-cursor-blink;
12
+ margin-left: 5px;
13
+ position: relative;
14
+ top: 4px;
15
+ }
16
+
5
17
  @keyframes collapse-down {
6
18
  from {
7
19
  height: 0;
@@ -2,6 +2,17 @@
2
2
  @tailwind components;
3
3
  @tailwind utilities;
4
4
 
5
+ .s-blinking-cursor > :not(pre):last-child::after {
6
+ content: "";
7
+ width: 8px;
8
+ height: 16px;
9
+ @apply s-bg-success-400;
10
+ display: inline-block;
11
+ @apply s-animate-cursor-blink;
12
+ margin-left: 5px;
13
+ position: relative;
14
+ top: 4px;
15
+ }
5
16
 
6
17
  @keyframes bgblink {
7
18
  0%,
@@ -1,24 +0,0 @@
1
- import React from "react";
2
- import { MarkdownNode } from "./types";
3
- export declare const markdownHeaderClasses: {
4
- h1: string;
5
- h2: string;
6
- h3: string;
7
- h4: string;
8
- h5: string;
9
- h6: string;
10
- };
11
- interface HeaderBlockProps {
12
- children: React.ReactNode;
13
- textColor?: string;
14
- forcedTextSize?: string;
15
- node?: MarkdownNode;
16
- }
17
- export declare const MemoH1Block: React.MemoExoticComponent<({ children, textColor, forcedTextSize }: HeaderBlockProps) => React.JSX.Element>;
18
- export declare const MemoH2Block: React.MemoExoticComponent<({ children, textColor, forcedTextSize }: HeaderBlockProps) => React.JSX.Element>;
19
- export declare const MemoH3Block: React.MemoExoticComponent<({ children, textColor, forcedTextSize }: HeaderBlockProps) => React.JSX.Element>;
20
- export declare const MemoH4Block: React.MemoExoticComponent<({ children, textColor, forcedTextSize }: HeaderBlockProps) => React.JSX.Element>;
21
- export declare const MemoH5Block: React.MemoExoticComponent<({ children, textColor, forcedTextSize }: HeaderBlockProps) => React.JSX.Element>;
22
- export declare const MemoH6Block: React.MemoExoticComponent<({ children, textColor, forcedTextSize }: HeaderBlockProps) => React.JSX.Element>;
23
- export {};
24
- //# sourceMappingURL=HeaderBlocks.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"HeaderBlocks.d.ts","sourceRoot":"","sources":["../../../../src/components/markdown/HeaderBlocks.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAe,MAAM,OAAO,CAAC;AAIpC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGvC,eAAO,MAAM,qBAAqB;;;;;;;CAOjC,CAAC;AAEF,UAAU,gBAAgB;IACxB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,IAAI,CAAC,EAAE,YAAY,CAAC;CACrB;AAED,eAAO,MAAM,WAAW,sEACoB,gBAAgB,uBAkB3D,CAAC;AAIF,eAAO,MAAM,WAAW,sEACoB,gBAAgB,uBAkB3D,CAAC;AAIF,eAAO,MAAM,WAAW,sEACoB,gBAAgB,uBAkB3D,CAAC;AAIF,eAAO,MAAM,WAAW,sEACoB,gBAAgB,uBAkB3D,CAAC;AAIF,eAAO,MAAM,WAAW,sEACoB,gBAAgB,uBAkB3D,CAAC;AAIF,eAAO,MAAM,WAAW,sEACoB,gBAAgB,uBAkB3D,CAAC"}
@@ -1,54 +0,0 @@
1
- import React, { memo } from "react";
2
- import { cn } from "../../lib/utils";
3
- import { sameNodePosition, sameTextStyling } from "./utils";
4
- export var markdownHeaderClasses = {
5
- h1: "s-heading-2xl",
6
- h2: "s-heading-xl",
7
- h3: "s-heading-lg",
8
- h4: "s-text-base s-font-semibold",
9
- h5: "s-text-sm s-font-semibold",
10
- h6: "s-text-sm s-font-regular s-italic",
11
- };
12
- export var MemoH1Block = memo(function (_a) {
13
- var children = _a.children, textColor = _a.textColor, forcedTextSize = _a.forcedTextSize;
14
- return (React.createElement("h1", { className: cn("s-pb-2 s-pt-4", forcedTextSize ? forcedTextSize : markdownHeaderClasses.h1, textColor) }, children));
15
- }, function (prev, next) {
16
- return (sameNodePosition(prev.node, next.node) && sameTextStyling(prev, next));
17
- });
18
- MemoH1Block.displayName = "H1Block";
19
- export var MemoH2Block = memo(function (_a) {
20
- var children = _a.children, textColor = _a.textColor, forcedTextSize = _a.forcedTextSize;
21
- return (React.createElement("h2", { className: cn("s-pb-2 s-pt-4", forcedTextSize ? forcedTextSize : markdownHeaderClasses.h2, textColor) }, children));
22
- }, function (prev, next) {
23
- return (sameNodePosition(prev.node, next.node) && sameTextStyling(prev, next));
24
- });
25
- MemoH2Block.displayName = "H2Block";
26
- export var MemoH3Block = memo(function (_a) {
27
- var children = _a.children, textColor = _a.textColor, forcedTextSize = _a.forcedTextSize;
28
- return (React.createElement("h3", { className: cn("s-pb-2 s-pt-4", forcedTextSize ? forcedTextSize : markdownHeaderClasses.h3, textColor) }, children));
29
- }, function (prev, next) {
30
- return (sameNodePosition(prev.node, next.node) && sameTextStyling(prev, next));
31
- });
32
- MemoH3Block.displayName = "H3Block";
33
- export var MemoH4Block = memo(function (_a) {
34
- var children = _a.children, textColor = _a.textColor, forcedTextSize = _a.forcedTextSize;
35
- return (React.createElement("h4", { className: cn("s-pb-2 s-pt-3", forcedTextSize ? forcedTextSize : markdownHeaderClasses.h4, textColor) }, children));
36
- }, function (prev, next) {
37
- return (sameNodePosition(prev.node, next.node) && sameTextStyling(prev, next));
38
- });
39
- MemoH4Block.displayName = "H4Block";
40
- export var MemoH5Block = memo(function (_a) {
41
- var children = _a.children, textColor = _a.textColor, forcedTextSize = _a.forcedTextSize;
42
- return (React.createElement("h5", { className: cn("s-pb-1.5 s-pt-2.5", forcedTextSize ? forcedTextSize : markdownHeaderClasses.h5, textColor) }, children));
43
- }, function (prev, next) {
44
- return (sameNodePosition(prev.node, next.node) && sameTextStyling(prev, next));
45
- });
46
- MemoH5Block.displayName = "H5Block";
47
- export var MemoH6Block = memo(function (_a) {
48
- var children = _a.children, textColor = _a.textColor, forcedTextSize = _a.forcedTextSize;
49
- return (React.createElement("h6", { className: cn("s-pb-1.5 s-pt-2.5", forcedTextSize ? forcedTextSize : markdownHeaderClasses.h6, textColor) }, children));
50
- }, function (prev, next) {
51
- return (sameNodePosition(prev.node, next.node) && sameTextStyling(prev, next));
52
- });
53
- MemoH6Block.displayName = "H6Block";
54
- //# sourceMappingURL=HeaderBlocks.js.map