@dust-tt/sparkle 0.2.646-rc-4 → 0.2.647

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 (118) 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/icons/actions/Atom.js +1 -1
  43. package/dist/esm/icons/actions/Atom.js.map +1 -1
  44. package/dist/esm/icons/app/ArrowDownDash.d.ts +5 -0
  45. package/dist/esm/icons/app/ArrowDownDash.d.ts.map +1 -0
  46. package/dist/esm/icons/app/ArrowDownDash.js +6 -0
  47. package/dist/esm/icons/app/ArrowDownDash.js.map +1 -0
  48. package/dist/esm/icons/app/Atom.js +1 -1
  49. package/dist/esm/icons/app/Atom.js.map +1 -1
  50. package/dist/esm/icons/app/index.d.ts +1 -0
  51. package/dist/esm/icons/app/index.d.ts.map +1 -1
  52. package/dist/esm/icons/app/index.js +1 -0
  53. package/dist/esm/icons/app/index.js.map +1 -1
  54. package/dist/esm/icons/src/app/arrow-down-dash.svg +3 -0
  55. package/dist/esm/logo/platforms/Discord.d.ts.map +1 -1
  56. package/dist/esm/logo/platforms/Discord.js +2 -2
  57. package/dist/esm/logo/platforms/Discord.js.map +1 -1
  58. package/dist/esm/logo/src/platforms/Discord.svg +3 -0
  59. package/dist/esm/stories/DataTable.stories.d.ts +1 -0
  60. package/dist/esm/stories/DataTable.stories.d.ts.map +1 -1
  61. package/dist/esm/stories/DataTable.stories.js +188 -0
  62. package/dist/esm/stories/DataTable.stories.js.map +1 -1
  63. package/dist/esm/styles/global.css +12 -0
  64. package/dist/esm/styles/global_with_tw_base.css +12 -0
  65. package/dist/esm/styles/tailwind.css +11 -0
  66. package/dist/sparkle.css +390 -348
  67. package/package.json +1 -2
  68. package/src/components/DataTable.tsx +31 -2
  69. package/src/components/markdown/BlockquoteBlock.tsx +29 -36
  70. package/src/components/markdown/CodeBlockWithExtendedSupport.tsx +131 -142
  71. package/src/components/markdown/List.tsx +30 -53
  72. package/src/components/markdown/Markdown.tsx +171 -108
  73. package/src/components/markdown/ParagraphBlock.tsx +12 -18
  74. package/src/components/markdown/PreBlock.tsx +18 -28
  75. package/src/components/markdown/TableBlock.tsx +95 -125
  76. package/src/components/markdown/index.ts +0 -4
  77. package/src/components/markdown/utils.ts +0 -37
  78. package/src/icons/actions/Atom.tsx +1 -1
  79. package/src/icons/app/ArrowDownDash.tsx +18 -0
  80. package/src/icons/app/Atom.tsx +1 -1
  81. package/src/icons/app/index.ts +1 -0
  82. package/src/icons/src/app/arrow-down-dash.svg +3 -0
  83. package/src/logo/platforms/Discord.tsx +6 -8
  84. package/src/logo/src/platforms/Discord.svg +3 -0
  85. package/src/stories/DataTable.stories.tsx +235 -0
  86. package/src/styles/global.css +12 -0
  87. package/src/styles/global_with_tw_base.css +12 -0
  88. package/src/styles/tailwind.css +11 -0
  89. package/dist/esm/components/markdown/HeaderBlocks.d.ts +0 -24
  90. package/dist/esm/components/markdown/HeaderBlocks.d.ts.map +0 -1
  91. package/dist/esm/components/markdown/HeaderBlocks.js +0 -54
  92. package/dist/esm/components/markdown/HeaderBlocks.js.map +0 -1
  93. package/dist/esm/components/markdown/InputBlock.d.ts +0 -10
  94. package/dist/esm/components/markdown/InputBlock.d.ts.map +0 -1
  95. package/dist/esm/components/markdown/InputBlock.js +0 -26
  96. package/dist/esm/components/markdown/InputBlock.js.map +0 -1
  97. package/dist/esm/components/markdown/LinkBlock.d.ts +0 -10
  98. package/dist/esm/components/markdown/LinkBlock.d.ts.map +0 -1
  99. package/dist/esm/components/markdown/LinkBlock.js +0 -11
  100. package/dist/esm/components/markdown/LinkBlock.js.map +0 -1
  101. package/dist/esm/components/markdown/TextFormattingBlocks.d.ts +0 -10
  102. package/dist/esm/components/markdown/TextFormattingBlocks.d.ts.map +0 -1
  103. package/dist/esm/components/markdown/TextFormattingBlocks.js +0 -12
  104. package/dist/esm/components/markdown/TextFormattingBlocks.js.map +0 -1
  105. package/dist/esm/components/markdown/types.d.ts +0 -13
  106. package/dist/esm/components/markdown/types.d.ts.map +0 -1
  107. package/dist/esm/components/markdown/types.js +0 -2
  108. package/dist/esm/components/markdown/types.js.map +0 -1
  109. package/dist/esm/components/markdown/useAnimatedText.d.ts +0 -2
  110. package/dist/esm/components/markdown/useAnimatedText.d.ts.map +0 -1
  111. package/dist/esm/components/markdown/useAnimatedText.js +0 -31
  112. package/dist/esm/components/markdown/useAnimatedText.js.map +0 -1
  113. package/src/components/markdown/HeaderBlocks.tsx +0 -160
  114. package/src/components/markdown/InputBlock.tsx +0 -60
  115. package/src/components/markdown/LinkBlock.tsx +0 -36
  116. package/src/components/markdown/TextFormattingBlocks.tsx +0 -31
  117. package/src/components/markdown/types.ts +0 -5
  118. 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
- }
@@ -10,7 +10,7 @@ const SvgAtom = (props: SVGProps<SVGSVGElement>) => (
10
10
  {...props}
11
11
  >
12
12
  <path
13
- fill="currentColor"
13
+ fill="#000"
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"
@@ -0,0 +1,18 @@
1
+ import type { SVGProps } from "react";
2
+ import * as React from "react";
3
+ const SvgArrowDownDash = (props: SVGProps<SVGSVGElement>) => (
4
+ <svg
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ width="1em"
7
+ height="1em"
8
+ fill="none"
9
+ viewBox="0 0 24 24"
10
+ {...props}
11
+ >
12
+ <path
13
+ fill="currentColor"
14
+ d="m13.5 17.5 5-5 2 2L12 23l-8.5-8.5 2-2 5 5V7h3v10.5ZM16 5H8V2h8v3Z"
15
+ />
16
+ </svg>
17
+ );
18
+ export default SvgArrowDownDash;
@@ -10,7 +10,7 @@ const SvgAtom = (props: SVGProps<SVGSVGElement>) => (
10
10
  {...props}
11
11
  >
12
12
  <path
13
- fill="currentColor"
13
+ fill="#000"
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"
@@ -1,6 +1,7 @@
1
1
  export { default as ArrowCircleIcon } from "./ArrowCircle";
2
2
  export { default as ArrowDownIcon } from "./ArrowDown";
3
3
  export { default as ArrowDownCircleIcon } from "./ArrowDownCircle";
4
+ export { default as ArrowDownDashIcon } from "./ArrowDownDash";
4
5
  export { default as ArrowDownOnSquareIcon } from "./ArrowDownOnSquare";
5
6
  export { default as ArrowDownSIcon } from "./ArrowDownS";
6
7
  export { default as ArrowGoBackIcon } from "./ArrowGoBack";
@@ -0,0 +1,3 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M13.5 17.5L18.5 12.5L20.5 14.5L12 23L3.5 14.5L5.5 12.5L10.5 17.5V7H13.5V17.5ZM16 5H8V2H16V5Z" fill="#111418"/>
3
+ </svg>
@@ -1,20 +1,18 @@
1
1
  import type { SVGProps } from "react";
2
2
  import * as React from "react";
3
-
4
3
  const SvgDiscord = (props: SVGProps<SVGSVGElement>) => (
5
4
  <svg
6
- width="24"
7
- height="24"
8
- viewBox="0 0 24 24"
9
- fill="none"
10
5
  xmlns="http://www.w3.org/2000/svg"
6
+ width="1em"
7
+ height="1em"
8
+ fill="none"
9
+ viewBox="0 0 24 24"
11
10
  {...props}
12
11
  >
13
12
  <path
14
- d="M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028 14.09 14.09 0 0 0 1.226-1.994.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z"
15
- fill="currentColor"
13
+ fill="#5865F2"
14
+ d="M18.942 5.256A16.668 16.668 0 0 0 14.816 4c-.178.311-.386.73-.529 1.063a15.632 15.632 0 0 0-4.573 0A11.218 11.218 0 0 0 9.18 4c-1.448.243-2.834.67-4.129 1.26-2.611 3.823-3.319 7.55-2.965 11.226a16.704 16.704 0 0 0 5.06 2.512c.408-.543.771-1.12 1.084-1.729-.596-.22-1.167-.49-1.706-.805a8.44 8.44 0 0 0 .418-.32c3.29 1.49 6.866 1.49 10.118 0 .137.11.277.218.418.32-.54.316-1.113.587-1.71.807.314.607.675 1.186 1.084 1.729a16.668 16.668 0 0 0 5.064-2.514c.415-4.26-.71-7.955-2.973-11.23Zm-10.264 8.97c-.988 0-1.798-.894-1.798-1.982s.792-1.983 1.798-1.983c1.005 0 1.815.893 1.798 1.983.001 1.088-.793 1.982-1.798 1.982Zm6.644 0c-.988 0-1.798-.894-1.798-1.982s.793-1.983 1.798-1.983c1.006 0 1.816.893 1.798 1.983 0 1.088-.793 1.982-1.798 1.982Z"
16
15
  />
17
16
  </svg>
18
17
  );
19
-
20
18
  export default SvgDiscord;
@@ -0,0 +1,3 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M18.9419 5.25625C17.6473 4.66937 16.263 4.24286 14.8157 4C14.638 4.31134 14.4304 4.7301 14.2872 5.06322C12.7487 4.83906 11.2245 4.83906 9.7143 5.06322C9.57116 4.7301 9.3588 4.31134 9.17947 4C7.73067 4.24286 6.3448 4.67094 5.05016 5.25935C2.43887 9.08252 1.73099 12.8107 2.08493 16.486C3.81688 17.7391 5.49534 18.5003 7.14548 18.9985C7.55291 18.4552 7.91628 17.8777 8.22931 17.269C7.63313 17.0495 7.06211 16.7787 6.52256 16.4642C6.6657 16.3615 6.80571 16.254 6.94098 16.1435C10.2318 17.6348 13.8074 17.6348 17.0589 16.1435C17.1958 16.254 17.3358 16.3615 17.4774 16.4642C16.9362 16.7802 16.3637 17.0511 15.7675 17.2706C16.0805 17.8777 16.4423 18.4567 16.8513 19C18.503 18.5019 20.183 17.7407 21.915 16.486C22.3303 12.2254 21.2056 8.53146 18.9419 5.25625ZM8.67765 14.2257C7.68977 14.2257 6.87963 13.3322 6.87963 12.2441C6.87963 11.156 7.67247 10.2609 8.67765 10.2609C9.68285 10.2609 10.493 11.1544 10.4757 12.2441C10.4772 13.3322 9.68285 14.2257 8.67765 14.2257ZM15.3223 14.2257C14.3344 14.2257 13.5243 13.3322 13.5243 12.2441C13.5243 11.156 14.3171 10.2609 15.3223 10.2609C16.3275 10.2609 17.1376 11.1544 17.1203 12.2441C17.1203 13.3322 16.3275 14.2257 15.3223 14.2257Z" fill="#5865F2"/>
3
+ </svg>
@@ -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;