@dust-tt/sparkle 0.2.616 → 0.2.617-rc-1

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 (72) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/esm/components/Avatar.d.ts +1 -1
  3. package/dist/esm/components/Avatar.js +4 -4
  4. package/dist/esm/components/Avatar.js.map +1 -1
  5. package/dist/esm/components/ConversationMessage.d.ts +0 -4
  6. package/dist/esm/components/ConversationMessage.d.ts.map +1 -1
  7. package/dist/esm/components/ConversationMessage.js +4 -9
  8. package/dist/esm/components/ConversationMessage.js.map +1 -1
  9. package/dist/esm/components/DataTable.d.ts.map +1 -1
  10. package/dist/esm/components/DataTable.js +50 -12
  11. package/dist/esm/components/DataTable.js.map +1 -1
  12. package/dist/esm/components/NavigationList.d.ts +1 -4
  13. package/dist/esm/components/NavigationList.d.ts.map +1 -1
  14. package/dist/esm/components/NavigationList.js +2 -2
  15. package/dist/esm/components/NavigationList.js.map +1 -1
  16. package/dist/esm/components/ScrollArea.d.ts +0 -1
  17. package/dist/esm/components/ScrollArea.d.ts.map +1 -1
  18. package/dist/esm/components/ScrollArea.js +4 -7
  19. package/dist/esm/components/ScrollArea.js.map +1 -1
  20. package/dist/esm/components/Spinner.d.ts +1 -1
  21. package/dist/esm/components/Spinner.js +7 -7
  22. package/dist/esm/components/Spinner.js.map +1 -1
  23. package/dist/esm/components/ToolCard.d.ts +0 -6
  24. package/dist/esm/components/ToolCard.d.ts.map +1 -1
  25. package/dist/esm/components/ToolCard.js +11 -18
  26. package/dist/esm/components/ToolCard.js.map +1 -1
  27. package/dist/esm/components/Tooltip.d.ts.map +1 -1
  28. package/dist/esm/components/Tooltip.js.map +1 -1
  29. package/dist/esm/components/WindowUtility.d.ts +2 -3
  30. package/dist/esm/components/WindowUtility.d.ts.map +1 -1
  31. package/dist/esm/components/WindowUtility.js +17 -25
  32. package/dist/esm/components/WindowUtility.js.map +1 -1
  33. package/dist/esm/components/markdown/CodeBlock.d.ts +1 -2
  34. package/dist/esm/components/markdown/CodeBlock.d.ts.map +1 -1
  35. package/dist/esm/components/markdown/CodeBlock.js +2 -9
  36. package/dist/esm/components/markdown/CodeBlock.js.map +1 -1
  37. package/dist/esm/index.d.ts +0 -1
  38. package/dist/esm/index.d.ts.map +1 -1
  39. package/dist/esm/index.js +0 -1
  40. package/dist/esm/index.js.map +1 -1
  41. package/dist/esm/stories/Avatar.stories.js +4 -4
  42. package/dist/esm/stories/ConversationMessage.stories.d.ts.map +1 -1
  43. package/dist/esm/stories/ConversationMessage.stories.js +3 -3
  44. package/dist/esm/stories/ConversationMessage.stories.js.map +1 -1
  45. package/dist/esm/stories/MultiPageDialog.stories.js +1 -1
  46. package/dist/esm/stories/MultiPageDialog.stories.js.map +1 -1
  47. package/dist/esm/stories/Spinner.stories.js +3 -3
  48. package/dist/esm/stories/ToolCard.stories.d.ts.map +1 -1
  49. package/dist/esm/stories/ToolCard.stories.js +6 -14
  50. package/dist/esm/stories/ToolCard.stories.js.map +1 -1
  51. package/package.json +1 -1
  52. package/src/components/Avatar.tsx +4 -4
  53. package/src/components/ConversationMessage.tsx +7 -26
  54. package/src/components/DataTable.tsx +46 -7
  55. package/src/components/NavigationList.tsx +2 -7
  56. package/src/components/ScrollArea.tsx +3 -9
  57. package/src/components/Spinner.tsx +7 -7
  58. package/src/components/ToolCard.tsx +35 -60
  59. package/src/components/Tooltip.tsx +38 -49
  60. package/src/components/WindowUtility.tsx +18 -11
  61. package/src/components/markdown/CodeBlock.tsx +0 -10
  62. package/src/index.ts +0 -1
  63. package/src/stories/Avatar.stories.tsx +4 -4
  64. package/src/stories/ConversationMessage.stories.tsx +0 -6
  65. package/src/stories/MultiPageDialog.stories.tsx +1 -1
  66. package/src/stories/Spinner.stories.tsx +3 -3
  67. package/src/stories/ToolCard.stories.tsx +35 -49
  68. package/dist/esm/stories/CodeBlock.stories.d.ts +0 -17
  69. package/dist/esm/stories/CodeBlock.stories.d.ts.map +0 -1
  70. package/dist/esm/stories/CodeBlock.stories.js +0 -125
  71. package/dist/esm/stories/CodeBlock.stories.js.map +0 -1
  72. package/src/stories/CodeBlock.stories.tsx +0 -361
@@ -2,25 +2,30 @@ import { useEffect, useState } from "react";
2
2
 
3
3
  // Define breakpoints
4
4
  export const breakpoints = {
5
- xxs: 0,
6
- xs: 512,
5
+ xs: 0,
7
6
  sm: 640,
8
7
  md: 768,
9
8
  lg: 1024,
10
9
  xl: 1280,
11
- "2xl": 1536,
10
+ xxl: 1536,
12
11
  };
13
12
 
14
13
  // Helper function to determine active breakpoint
15
14
  function getActiveBreakpoint(width: number): keyof typeof breakpoints {
16
- const breakpointEntries = Object.entries(breakpoints) as [keyof typeof breakpoints, number][];
17
- // Sort breakpoints from largest to smallest
18
- const sortedBreakpoints = breakpointEntries.sort(([, a], [, b]) => b - a);
19
-
20
- for (const [breakpoint, minWidth] of sortedBreakpoints) {
21
- if (width >= minWidth) {
22
- return breakpoint;
23
- }
15
+ if (width >= breakpoints.xxl) {
16
+ return "xxl";
17
+ }
18
+ if (width >= breakpoints.xl) {
19
+ return "xl";
20
+ }
21
+ if (width >= breakpoints.lg) {
22
+ return "lg";
23
+ }
24
+ if (width >= breakpoints.md) {
25
+ return "md";
26
+ }
27
+ if (width >= breakpoints.sm) {
28
+ return "sm";
24
29
  }
25
30
  return "xs";
26
31
  }
@@ -57,3 +62,5 @@ export function useWindowSize() {
57
62
 
58
63
  return windowSize;
59
64
  }
65
+
66
+ export default useWindowSize;
@@ -34,7 +34,6 @@ type CodeBlockProps = {
34
34
  inline?: boolean;
35
35
  variant?: "surface";
36
36
  wrapLongLines?: boolean;
37
- showLineNumber?: boolean;
38
37
  };
39
38
 
40
39
  export function CodeBlock({
@@ -43,7 +42,6 @@ export function CodeBlock({
43
42
  inline,
44
43
  variant = "surface",
45
44
  wrapLongLines = false,
46
- showLineNumber = false,
47
45
  }: CodeBlockProps): JSX.Element {
48
46
  const match = /language-(\w+)/.exec(className || "");
49
47
  const language = match ? match[1] : "text";
@@ -65,13 +63,6 @@ export function CodeBlock({
65
63
  backgroundColor: "transparent",
66
64
  fontSize: "0.875rem",
67
65
  },
68
- "hljs-ln": {
69
- color: "var(--s-muted-foreground)",
70
- fontSize: "0.75rem",
71
- paddingRight: "1em",
72
- textAlign: "right",
73
- userSelect: "none",
74
- },
75
66
  "hljs-keyword": {
76
67
  // function, const, let, if, return
77
68
  color: violet[500],
@@ -157,7 +148,6 @@ export function CodeBlock({
157
148
  <div className="s-text-foreground dark:s-text-foreground-night">
158
149
  <SyntaxHighlighter
159
150
  wrapLongLines={wrapLongLines}
160
- showLineNumbers={showLineNumber}
161
151
  style={codeStyle}
162
152
  language={languageToUse}
163
153
  PreTag="div"
package/src/index.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  export * from "./components";
2
- export * from "./components/WindowUtility";
3
2
  export { SparkleContext } from "./context";
4
3
  export * from "./hooks";
5
4
  export * from "./icons";
@@ -44,7 +44,7 @@ export const AvatarExample = () => (
44
44
  <Avatar size="md" />
45
45
  <Avatar size="lg" />
46
46
  <Avatar size="xl" />
47
- <Avatar size="2xl" />
47
+ <Avatar size="xxl" />
48
48
  </div>
49
49
  <div>With name</div>
50
50
  <div className="s-flex s-gap-4">
@@ -53,7 +53,7 @@ export const AvatarExample = () => (
53
53
  <Avatar size="md" name="Aria Doe" />
54
54
  <Avatar size="lg" name="Omar Doe" />
55
55
  <Avatar size="xl" name="Omar Doe" />
56
- <Avatar size="2xl" name="Omar Doe" />
56
+ <Avatar size="xxl" name="Omar Doe" />
57
57
  </div>
58
58
  <div>With emoji url</div>
59
59
  <div className="s-flex s-gap-4">
@@ -69,7 +69,7 @@ export const AvatarExample = () => (
69
69
  <Avatar size="md" emoji="😂" backgroundColor="s-bg-info-200" />
70
70
  <Avatar size="lg" emoji="🧑‍🚀" backgroundColor="s-bg-gray-200" />
71
71
  <Avatar size="xl" emoji="👕" backgroundColor="s-bg-blue-200" />
72
- <Avatar size="2xl" emoji="👕" backgroundColor="s-bg-blue-200" />
72
+ <Avatar size="xxl" emoji="👕" backgroundColor="s-bg-blue-200" />
73
73
  </div>
74
74
  <div className="s-flex s-gap-4">
75
75
  <Avatar size="sm" name="Eleanor Wright" />
@@ -126,7 +126,7 @@ export const AvatarExample = () => (
126
126
  <Avatar size="lg" icon={ActionFlagIcon} />
127
127
  <Avatar size="lg" icon={SlackLogo} hexBgColor="#421D51" />
128
128
  <Avatar size="xl" icon={ActionShirtIcon} />
129
- <Avatar size="2xl" icon={StarStrokeIcon} />
129
+ <Avatar size="xxl" icon={StarStrokeIcon} />
130
130
  </div>
131
131
  <div className="heading-2xl">Tools example</div>
132
132
  <div>Remote MCP Servers</div>
@@ -2,12 +2,10 @@ import type { Meta } from "@storybook/react";
2
2
  import React from "react";
3
3
 
4
4
  import {
5
- Avatar,
6
5
  Button,
7
6
  Citation,
8
7
  CitationIcons,
9
8
  CitationTitle,
10
- ClockIcon,
11
9
  ConversationContainer,
12
10
  ConversationMessage,
13
11
  GithubIcon,
@@ -34,7 +32,6 @@ export const ConversationExample = () => {
34
32
  type="user"
35
33
  name="Edouard"
36
34
  pictureUrl="https://dust.tt/static/droidavatar/Droid_Lime_1.jpg"
37
- timestamp="14:30"
38
35
  citations={[
39
36
  <Citation href="https://www.google.com">
40
37
  <CitationIcons>
@@ -43,9 +40,6 @@ export const ConversationExample = () => {
43
40
  <CitationTitle>Title</CitationTitle>
44
41
  </Citation>,
45
42
  ]}
46
- infoChip={
47
- <Avatar size="xs" visual={<ClockIcon className="h-4 w-4" />} />
48
- }
49
43
  >
50
44
  I only want to show citations if a citations reactnode has been
51
45
  passed
@@ -912,7 +912,7 @@ export const ActionValidation: Story = {
912
912
  content: (
913
913
  <div className="s-space-y-6 s-pt-4">
914
914
  <div>
915
- <p className="s-mb-6 s-text-sm s-text-muted-foreground dark:s-text-muted-foreground-night">
915
+ <p className="s-mb-6 s-text-sm s-text-muted-foreground">
916
916
  Allow{" "}
917
917
  <span className="s-font-semibold">@Marketing Assistant</span> to
918
918
  use the tool <span className="s-font-semibold">Send Email</span>{" "}
@@ -89,13 +89,13 @@ export const SpinnerExample = () => {
89
89
  </div>
90
90
  <div className="s-flex s-gap-4">
91
91
  <div className="s-p-20">
92
- <Spinner variant="color" size="2xl" />
92
+ <Spinner variant="color" size="xxl" />
93
93
  </div>
94
94
  <div className="s-p-20">
95
- <Spinner variant="mono" size="2xl" />
95
+ <Spinner variant="mono" size="xxl" />
96
96
  </div>
97
97
  <div className="s-p-20">
98
- <Spinner variant="rose300" size="2xl" />
98
+ <Spinner variant="rose300" size="xxl" />
99
99
  </div>
100
100
  </div>
101
101
  </div>
@@ -13,55 +13,41 @@ const meta: Meta<typeof ToolCard> = {
13
13
  export default meta;
14
14
 
15
15
  export const Examples = () => (
16
- <div className="s-flex s-gap-3">
17
- {/* Not added - default md size */}
18
- <div className="s-w-80">
19
- <ToolCard
20
- icon={BookOpenIcon}
21
- cardContainerClassName="s-h-36"
22
- label="Image Generation"
23
- description="Agent can generate images (GPT Image 1)."
24
- isSelected
25
- canAdd
26
- onClick={() => console.log("Add Image Generation")}
27
- toolInfo={{
28
- label: "Click here",
29
- onClick: () => console.log("Click here"),
30
- }}
31
- />
32
- </div>
16
+ <div className="s-grid s-grid-cols-2 s-gap-3">
17
+ {/* Not added */}
18
+ <ToolCard
19
+ icon={BookOpenIcon}
20
+ label="Image Generation"
21
+ description="Agent can generate images (GPT Image 1)."
22
+ isSelected={false}
23
+ canAdd={true}
24
+ onClick={() => console.log("Add Image Generation")}
25
+ />
33
26
 
34
- {/* Added - xl size */}
35
- <div className="s-w-80">
36
- <ToolCard
37
- cardContainerClassName="s-h-36"
38
- icon={CommandLineIcon}
39
- label="Reasoning"
40
- description={
41
- <>
42
- Agent can decide to trigger a reasoning model for complex tasks.
43
- Agent can decide to trigger a reasoning model for complex tasks.
44
- Agent can decide to trigger a reasoning model for complex tasks.
45
- Agent can decide to trigger a reasoning model for complex tasks.
46
- Agent can decide to trigger a reasoning model for complex tasks.
47
- Agent can decide to trigger a reasoning model for complex tasks.{" "}
48
- <Hoverable
49
- href="https://example.com/help"
50
- target="_blank"
51
- rel="noopener noreferrer"
52
- variant="primary"
53
- >
54
- the docs
55
- </Hoverable>
56
- </>
57
- }
58
- isSelected
59
- canAdd={false}
60
- toolInfo={{
61
- label: "Click here",
62
- onClick: () => console.log("Click here"),
63
- }}
64
- />
65
- </div>
27
+ {/* Added */}
28
+ <ToolCard
29
+ icon={CommandLineIcon}
30
+ label="Reasoning"
31
+ description={
32
+ <>
33
+ Agent can decide to trigger a reasoning model for complex tasks. Agent
34
+ can decide to trigger a reasoning model for complex tasks. Agent can
35
+ decide to trigger a reasoning model for complex tasks. Agent can
36
+ decide to trigger a reasoning model for complex tasks. Agent can
37
+ decide to trigger a reasoning model for complex tasks. Agent can
38
+ decide to trigger a reasoning model for complex tasks.{" "}
39
+ <Hoverable
40
+ href="https://example.com/help"
41
+ target="_blank"
42
+ rel="noopener noreferrer"
43
+ variant="primary"
44
+ >
45
+ the docs
46
+ </Hoverable>
47
+ </>
48
+ }
49
+ isSelected={true}
50
+ canAdd={false}
51
+ />
66
52
  </div>
67
53
  );
@@ -1,17 +0,0 @@
1
- import type { Meta, StoryObj } from "@storybook/react";
2
- import { CodeBlock } from "../index_with_tw_base";
3
- declare const meta: Meta<typeof CodeBlock>;
4
- export default meta;
5
- type Story = StoryObj<typeof meta>;
6
- export declare const InlineCode: Story;
7
- export declare const InlineCodeWithVariant: Story;
8
- export declare const TypescriptBlock: Story;
9
- export declare const ReactTSXBlock: Story;
10
- export declare const CSSBlock: Story;
11
- export declare const JSONBlock: Story;
12
- export declare const BashBlock: Story;
13
- export declare const SQLBlock: Story;
14
- export declare const LongCodeWithWrapping: Story;
15
- export declare const LongCodeWithoutWrapping: Story;
16
- export declare const TypescriptWithLineNumbers: Story;
17
- //# sourceMappingURL=CodeBlock.stories.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CodeBlock.stories.d.ts","sourceRoot":"","sources":["../../../src/stories/CodeBlock.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGvD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,SAAS,CA2ChC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAGnC,eAAO,MAAM,UAAU,EAAE,KAKxB,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,KAMnC,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAsB7B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KA+C3B,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAmCtB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KA+BvB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KA2BvB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KA+BtB,CAAC;AAGF,eAAO,MAAM,oBAAoB,EAAE,KAuBlC,CAAC;AAGF,eAAO,MAAM,uBAAuB,EAAE,KAcrC,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,KA2CvC,CAAC"}
@@ -1,125 +0,0 @@
1
- import React from "react";
2
- import { CodeBlock } from "../index_with_tw_base";
3
- var meta = {
4
- title: "Components/CodeBlock",
5
- component: CodeBlock,
6
- argTypes: {
7
- children: {
8
- description: "The code content to display",
9
- control: { type: "text" },
10
- },
11
- className: {
12
- description: "CSS class name, can include language specification (e.g., 'language-javascript')",
13
- control: { type: "text" },
14
- },
15
- inline: {
16
- description: "Whether to render as inline code (single line) or block code",
17
- control: { type: "boolean" },
18
- defaultValue: false,
19
- },
20
- variant: {
21
- description: "Visual variant of the code block",
22
- options: ["surface"],
23
- control: { type: "select" },
24
- defaultValue: "surface",
25
- },
26
- wrapLongLines: {
27
- description: "Whether to wrap long lines in block code",
28
- control: { type: "boolean" },
29
- defaultValue: false,
30
- },
31
- showLineNumber: {
32
- description: "Whether to show line numbers on the left side of the code",
33
- control: { type: "boolean" },
34
- defaultValue: false,
35
- },
36
- },
37
- decorators: [
38
- function (Story) { return (React.createElement("div", { className: "s-bg-background s-p-4 dark:s-bg-background-night" },
39
- React.createElement(Story, null))); },
40
- ],
41
- };
42
- export default meta;
43
- // Inline code examples
44
- export var InlineCode = {
45
- args: {
46
- children: "const greeting = 'Hello, World!';",
47
- inline: true,
48
- },
49
- };
50
- export var InlineCodeWithVariant = {
51
- args: {
52
- children: "npm install @dust-tt/sparkle",
53
- inline: true,
54
- variant: "surface",
55
- },
56
- };
57
- export var TypescriptBlock = {
58
- args: {
59
- children: "interface User {\n id: number;\n name: string;\n email: string;\n isActive: boolean;\n}\n\nconst createUser = (userData: Partial<User>): User => {\n return {\n id: Math.random(),\n name: userData.name || \"Anonymous\",\n email: userData.email || \"\",\n isActive: userData.isActive ?? true,\n };\n};\n\nconst newUser = createUser({ name: \"John Doe\", email: \"john@example.com\" });",
60
- className: "language-typescript",
61
- inline: false,
62
- },
63
- };
64
- export var ReactTSXBlock = {
65
- args: {
66
- children: "import React, { useState, useEffect } from 'react';\nimport { Button } from '@dust-tt/sparkle';\n\ninterface CounterProps {\n initialValue?: number;\n step?: number;\n onCountChange?: (count: number) => void;\n}\n\nconst Counter: React.FC<CounterProps> = ({ \n initialValue = 0, \n step = 1,\n onCountChange\n}) => {\n const [count, setCount] = useState<number>(initialValue);\n\n useEffect(() => {\n document.title = `Count: ${count}`;\n onCountChange?.(count);\n }, [count, onCountChange]);\n\n const increment = (): void => setCount(prev => prev + step);\n const decrement = (): void => setCount(prev => prev - step);\n const reset = (): void => setCount(initialValue);\n\n return (\n <div className=\"flex items-center gap-4\">\n <Button onClick={decrement} variant=\"outline\">\n -\n </Button>\n <span className=\"text-2xl font-bold\">{count}</span>\n <Button onClick={increment} variant=\"primary\">\n +\n </Button>\n <Button onClick={reset} variant=\"ghost\">\n Reset\n </Button>\n </div>\n );\n};\n\nexport default Counter;",
67
- className: "language-tsx",
68
- inline: false,
69
- },
70
- };
71
- export var CSSBlock = {
72
- args: {
73
- children: ".code-block {\n background-color: var(--s-muted);\n border: 1px solid var(--s-border);\n border-radius: 0.5rem;\n padding: 1rem;\n font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;\n font-size: 0.875rem;\n line-height: 1.5;\n overflow-x: auto;\n}\n\n.code-block .keyword {\n color: #8b5cf6; /* violet-500 */\n}\n\n.code-block .string {\n color: #10b981; /* emerald-500 */\n}\n\n.code-block .comment {\n color: #6b7280; /* gray-500 */\n font-style: italic;\n}\n\n@media (prefers-color-scheme: dark) {\n .code-block {\n background-color: var(--s-muted-night);\n border-color: var(--s-border-night);\n }\n}",
74
- className: "language-css",
75
- inline: false,
76
- },
77
- };
78
- export var JSONBlock = {
79
- args: {
80
- children: "{\n \"name\": \"@dust-tt/sparkle\",\n \"version\": \"1.0.0\",\n \"description\": \"A beautiful component library for React applications\",\n \"main\": \"dist/index.js\",\n \"types\": \"dist/index.d.ts\",\n \"scripts\": {\n \"build\": \"rollup -c\",\n \"dev\": \"rollup -c -w\",\n \"test\": \"jest\",\n \"lint\": \"eslint src/**/*.{ts,tsx}\"\n },\n \"dependencies\": {\n \"react\": \"^18.0.0\",\n \"react-dom\": \"^18.0.0\",\n \"class-variance-authority\": \"^0.7.0\"\n },\n \"devDependencies\": {\n \"@types/react\": \"^18.0.0\",\n \"@types/react-dom\": \"^18.0.0\",\n \"typescript\": \"^5.0.0\"\n },\n \"keywords\": [\"react\", \"components\", \"ui\", \"typescript\"],\n \"author\": \"Dust Team\",\n \"license\": \"MIT\"\n}",
81
- className: "language-json",
82
- inline: false,
83
- },
84
- };
85
- export var BashBlock = {
86
- args: {
87
- children: "#!/bin/bash\n\n# Install dependencies\nnpm install\n\n# Build the project\nnpm run build\n\n# Run tests\nnpm test\n\n# Deploy to production\nif [ \"$ENVIRONMENT\" = \"production\" ]; then\n echo \"Deploying to production...\"\n npm run deploy:prod\nelse\n echo \"Deploying to staging...\"\n npm run deploy:staging\nfi\n\n# Clean up\nnpm run clean",
88
- className: "language-bash",
89
- inline: false,
90
- },
91
- };
92
- export var SQLBlock = {
93
- args: {
94
- children: "-- Create users table\nCREATE TABLE users (\n id SERIAL PRIMARY KEY,\n username VARCHAR(50) UNIQUE NOT NULL,\n email VARCHAR(100) UNIQUE NOT NULL,\n created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP\n);\n\n-- Insert sample data\nINSERT INTO users (username, email) VALUES\n ('alice', 'alice@example.com'),\n ('bob', 'bob@example.com'),\n ('charlie', 'charlie@example.com');\n\n-- Query with joins\nSELECT \n u.username,\n u.email,\n p.title as post_title,\n p.created_at as post_date\nFROM users u\nLEFT JOIN posts p ON u.id = p.user_id\nWHERE u.created_at > '2024-01-01'\nORDER BY p.created_at DESC\nLIMIT 10;",
95
- className: "language-sql",
96
- inline: false,
97
- },
98
- };
99
- // Long code example with line wrapping
100
- export var LongCodeWithWrapping = {
101
- args: {
102
- children: "// This is a very long line of code that demonstrates how the wrapLongLines prop works when set to true. It contains a lot of text and would normally overflow the container, but with wrapLongLines enabled, it will wrap to the next line instead of creating a horizontal scrollbar. This is particularly useful for mobile devices or narrow containers where horizontal scrolling is not desirable.\n\nfunction processVeryLongFunctionNameWithManyParameters(\n parameterOne: string,\n parameterTwo: number,\n parameterThree: boolean,\n parameterFour: object,\n parameterFive: array,\n parameterSix: function,\n parameterSeven: string,\n parameterEight: number\n): Promise<ComplexReturnType> {\n // Implementation here\n return new Promise((resolve, reject) => {\n // More implementation\n });\n}",
103
- className: "language-typescript",
104
- inline: false,
105
- wrapLongLines: true,
106
- },
107
- };
108
- // Long code example without line wrapping (default)
109
- export var LongCodeWithoutWrapping = {
110
- args: {
111
- children: "// This is a very long line of code that demonstrates how the wrapLongLines prop works when set to false (default). It contains a lot of text and will create a horizontal scrollbar when it overflows the container. This is the default behavior and is useful when you want to preserve the exact formatting of the code.\n\nfunction processVeryLongFunctionNameWithManyParameters(parameterOne: string, parameterTwo: number, parameterThree: boolean, parameterFour: object, parameterFive: array, parameterSix: function, parameterSeven: string, parameterEight: number): Promise<ComplexReturnType> {\n // Implementation here\n return new Promise((resolve, reject) => {\n // More implementation\n });\n}",
112
- className: "language-typescript",
113
- inline: false,
114
- wrapLongLines: false,
115
- },
116
- };
117
- export var TypescriptWithLineNumbers = {
118
- args: {
119
- children: "interface User {\n id: number;\n name: string;\n email: string;\n isActive: boolean;\n}\n\nclass UserService {\n private users: User[] = [];\n\n addUser(user: Omit<User, 'id'>): User {\n const newUser: User = {\n id: this.users.length + 1,\n ...user\n };\n \n this.users.push(newUser);\n return newUser;\n }\n\n getUserById(id: number): User | undefined {\n return this.users.find(user => user.id === id);\n }\n\n getAllUsers(): User[] {\n return [...this.users];\n }\n}\n\nconst userService = new UserService();\nconst newUser = userService.addUser({\n name: \"John Doe\",\n email: \"john@example.com\",\n isActive: true\n});\n\nconsole.log(\"Created user:\", newUser);",
120
- className: "language-typescript",
121
- inline: false,
122
- showLineNumber: true,
123
- },
124
- };
125
- //# sourceMappingURL=CodeBlock.stories.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CodeBlock.stories.js","sourceRoot":"","sources":["../../../src/stories/CodeBlock.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,IAAM,IAAI,GAA2B;IACnC,KAAK,EAAE,sBAAsB;IAC7B,SAAS,EAAE,SAAS;IACpB,QAAQ,EAAE;QACR,QAAQ,EAAE;YACR,WAAW,EAAE,6BAA6B;YAC1C,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SAC1B;QACD,SAAS,EAAE;YACT,WAAW,EACT,kFAAkF;YACpF,O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