@sampleapp.ai/sdk 1.0.28 → 1.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/chat-bar.js +1 -2
- package/dist/components/guardian/app-layout-no-sidebar.js +8 -0
- package/dist/components/guardian/ask-ai-view.js +249 -0
- package/dist/components/guardian/code-focus-section.d.ts +41 -0
- package/dist/components/guardian/code-focus-section.js +174 -0
- package/dist/components/guardian/context/guardian-context.js +94 -0
- package/dist/components/guardian/context/vm-context.js +28 -0
- package/dist/components/guardian/default-guide-view.js +34 -0
- package/dist/components/guardian/demo/guardian-demo.js +35 -0
- package/dist/components/guardian/demo/left-view/toggle.js +28 -0
- package/dist/components/guardian/demo/left-view.js +49 -0
- package/dist/components/guardian/guardian-component.js +79 -0
- package/dist/components/guardian/guardian-demo.js +35 -0
- package/dist/components/guardian/guardian-home.d.ts +4 -0
- package/dist/components/guardian/guardian-home.js +61 -0
- package/dist/components/guardian/guardian-playground.js +45 -0
- package/dist/components/guardian/guardian-style-wrapper.js +29 -0
- package/dist/components/guardian/guardian-upload-spec.d.ts +14 -0
- package/dist/components/guardian/guardian-upload-spec.js +160 -0
- package/dist/components/guardian/header/glassmorphic-combobox.d.ts +15 -0
- package/dist/components/guardian/header/glassmorphic-combobox.js +30 -0
- package/dist/components/guardian/header.js +61 -0
- package/dist/components/guardian/hooks/use-frame-messages.js +65 -0
- package/dist/components/guardian/hooks/use-frame-params.js +44 -0
- package/dist/components/guardian/hooks/use-sandbox-url-loader.js +101 -0
- package/dist/components/guardian/ide/browser.js +538 -0
- package/dist/components/guardian/index.js +8 -0
- package/dist/components/guardian/layout/app-layout-no-sidebar.js +8 -0
- package/dist/components/guardian/layout/header/glassmorphic-combobox.js +48 -0
- package/dist/components/guardian/layout/header.js +63 -0
- package/dist/components/guardian/right-view/code-view.js +56 -0
- package/dist/components/guardian/right-view/pill-file-selector.js +233 -0
- package/dist/components/guardian/right-view/preview-control-bar.js +25 -0
- package/dist/components/guardian/right-view/right-panel-view.js +38 -0
- package/dist/components/guardian/right-view/right-top-down-view.js +289 -0
- package/dist/components/guardian/right-view/right-view.js +28 -0
- package/dist/components/guardian/right-view/simplified-editor.js +234 -0
- package/dist/components/guardian/types/ide-types.js +162 -0
- package/dist/components/guardian/types.js +3 -0
- package/dist/components/guardian/ui/ai-loader.js +48 -0
- package/dist/components/guardian/ui/badge.js +24 -0
- package/dist/components/guardian/ui/button.js +45 -0
- package/dist/components/guardian/ui/command.js +63 -0
- package/dist/components/guardian/ui/console-with-app.js +17 -0
- package/dist/components/guardian/ui/dialog.js +57 -0
- package/dist/components/guardian/ui/dropdown-menu.js +82 -0
- package/dist/components/guardian/ui/markdown.js +57 -0
- package/dist/components/guardian/ui/popover.js +25 -0
- package/dist/components/guardian/ui/tooltip.js +25 -0
- package/dist/components/guardian/utils.js +88 -0
- package/dist/components/guardian/zip-to-codebase.js +246 -0
- package/dist/components/guardian/zip-to-filetree.js +284 -0
- package/dist/components/icons.js +22 -0
- package/dist/components/sandbox/Sandbox.js +87 -0
- package/dist/components/sandbox/SandboxHome.js +141 -0
- package/dist/components/sandbox/api.js +108 -0
- package/dist/components/sandbox/guardian/app-layout-no-sidebar.js +8 -0
- package/dist/components/sandbox/guardian/ask-ai-view.js +249 -0
- package/dist/components/sandbox/guardian/code-focus-section.js +174 -0
- package/dist/components/sandbox/guardian/context/guardian-context.js +94 -0
- package/dist/components/sandbox/guardian/context/vm-context.js +28 -0
- package/dist/components/sandbox/guardian/default-guide-view.js +34 -0
- package/dist/components/sandbox/guardian/demo/guardian-demo.js +35 -0
- package/dist/components/sandbox/guardian/demo/left-view/toggle.js +28 -0
- package/dist/components/sandbox/guardian/demo/left-view.js +58 -0
- package/dist/components/sandbox/guardian/guardian-component.js +97 -0
- package/dist/components/sandbox/guardian/guardian-demo.js +35 -0
- package/dist/components/sandbox/guardian/guardian-home.d.ts +4 -0
- package/dist/components/sandbox/guardian/guardian-home.js +61 -0
- package/dist/components/sandbox/guardian/guardian-playground.js +45 -0
- package/dist/components/sandbox/guardian/guardian-style-wrapper.js +33 -0
- package/dist/components/sandbox/guardian/guardian-upload-spec.d.ts +14 -0
- package/dist/components/sandbox/guardian/guardian-upload-spec.js +160 -0
- package/dist/components/sandbox/guardian/header/glassmorphic-combobox.js +30 -0
- package/dist/components/sandbox/guardian/header.js +61 -0
- package/dist/components/sandbox/guardian/hooks/use-frame-messages.js +65 -0
- package/dist/components/sandbox/guardian/hooks/use-frame-params.js +44 -0
- package/dist/components/sandbox/guardian/hooks/use-sandbox-url-loader.js +145 -0
- package/dist/components/sandbox/guardian/ide/browser.js +538 -0
- package/dist/components/sandbox/guardian/index.js +8 -0
- package/dist/components/sandbox/guardian/right-view/code-view.js +60 -0
- package/dist/components/sandbox/guardian/right-view/pill-file-selector.js +233 -0
- package/dist/components/sandbox/guardian/right-view/preview-control-bar.js +25 -0
- package/dist/components/sandbox/guardian/right-view/right-panel-view.js +38 -0
- package/dist/components/sandbox/guardian/right-view/right-top-down-view.js +289 -0
- package/dist/components/sandbox/guardian/right-view/right-view.js +28 -0
- package/dist/components/sandbox/guardian/right-view/simplified-editor.js +234 -0
- package/dist/components/sandbox/guardian/types/ide-types.js +162 -0
- package/dist/components/sandbox/guardian/types.js +3 -0
- package/dist/components/sandbox/guardian/ui/ai-loader.js +48 -0
- package/dist/components/sandbox/guardian/ui/badge.js +24 -0
- package/dist/components/sandbox/guardian/ui/button.js +45 -0
- package/dist/components/sandbox/guardian/ui/command.js +63 -0
- package/dist/components/sandbox/guardian/ui/console-with-app.js +17 -0
- package/dist/components/sandbox/guardian/ui/dialog.js +57 -0
- package/dist/components/sandbox/guardian/ui/dropdown-menu.js +82 -0
- package/dist/components/sandbox/guardian/ui/markdown/accordion-group/accordion.js +62 -0
- package/dist/components/sandbox/guardian/ui/markdown/accordion-group.js +23 -0
- package/dist/components/sandbox/guardian/ui/markdown/callout/callout-check.js +4 -0
- package/dist/components/sandbox/guardian/ui/markdown/callout/callout-error.js +4 -0
- package/dist/components/sandbox/guardian/ui/markdown/callout/callout-info.js +4 -0
- package/dist/components/sandbox/guardian/ui/markdown/callout/callout-note.js +4 -0
- package/dist/components/sandbox/guardian/ui/markdown/callout/callout-tip.js +4 -0
- package/dist/components/sandbox/guardian/ui/markdown/callout/callout-warning.js +4 -0
- package/dist/components/sandbox/guardian/ui/markdown/callout/shared/callout.js +9 -0
- package/dist/components/sandbox/guardian/ui/markdown/callout/shared/types.js +1 -0
- package/dist/components/sandbox/guardian/ui/markdown/card-group/card.js +18 -0
- package/dist/components/sandbox/guardian/ui/markdown/card-group.js +25 -0
- package/dist/components/sandbox/guardian/ui/markdown/code-group/code-block.js +87 -0
- package/dist/components/sandbox/guardian/ui/markdown/code-group.js +101 -0
- package/dist/components/sandbox/guardian/ui/markdown/icon.js +31 -0
- package/dist/components/sandbox/guardian/ui/markdown.js +786 -0
- package/dist/components/sandbox/guardian/ui/popover.js +25 -0
- package/dist/components/sandbox/guardian/ui/tooltip.js +25 -0
- package/dist/components/sandbox/guardian/utils.js +88 -0
- package/dist/components/sandbox/guardian/zip-to-codebase.js +259 -0
- package/dist/components/sandbox/guardian/zip-to-filetree.js +284 -0
- package/dist/components/sandbox/index.js +4 -0
- package/dist/components/sandbox/sandbox-control-bar.js +91 -0
- package/dist/components/sandbox/sandbox-header.js +52 -0
- package/dist/components/sandbox/sandbox-home/SandboxCard.js +59 -0
- package/dist/components/sandbox/sandbox-home/SandboxHome.js +174 -0
- package/dist/components/sandbox/sandbox-home/SearchBar.js +12 -0
- package/dist/components/sandbox/sandbox-home/index.js +3 -0
- package/dist/components/sandbox/sandbox-left-panel.js +248 -0
- package/dist/components/sandbox/sandbox-loading.js +48 -0
- package/dist/components/sandbox/sandbox-right-panel.js +247 -0
- package/dist/components/sandbox/types.js +1 -0
- package/dist/components/sandbox.js +32 -0
- package/dist/components/tailwind-example.js +46 -0
- package/dist/index.d.ts +336 -1
- package/dist/index.es.js +90151 -667
- package/dist/index.js +13 -2
- package/dist/index.standalone.js +61 -53
- package/dist/index.standalone.umd.js +17 -89
- package/dist/index.umd.js +86 -151
- package/dist/lib/api-client.example.js +60 -0
- package/dist/lib/api-client.js +98 -0
- package/dist/lib/generated-css.js +4 -0
- package/dist/lib/inject-styles.js +42 -0
- package/dist/lib/shadow-dom-wrapper.js +42 -0
- package/dist/lib/utils.js +5 -0
- package/dist/sdk.css +1 -1
- package/dist/tailwind.css +1 -0
- package/package.json +32 -5
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { cn } from "../../../../../../../lib/utils";
|
|
3
|
+
import { Markdown } from "../../../markdown";
|
|
4
|
+
export const Callout = ({ children, className, icon }) => {
|
|
5
|
+
return (React.createElement("div", { className: cn("my-4 flex items-start gap-4 rounded-md border bg-opacity-10 p-4", className) },
|
|
6
|
+
icon && React.createElement("div", { className: "mt-0.5 flex-shrink-0" }, icon),
|
|
7
|
+
React.createElement("div", null,
|
|
8
|
+
React.createElement(Markdown, null, children))));
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { cn } from "../../../../../../lib/utils";
|
|
3
|
+
import * as LucideIcons from "lucide-react";
|
|
4
|
+
export const Card = ({ title, children, icon, href, img, horizontal = false, className, }) => {
|
|
5
|
+
const IconComponent = icon
|
|
6
|
+
? LucideIcons[icon]
|
|
7
|
+
: null;
|
|
8
|
+
const CardContent = () => (React.createElement(React.Fragment, null,
|
|
9
|
+
img && (React.createElement("div", { className: "overflow-hidden rounded-t-lg" },
|
|
10
|
+
React.createElement("img", { src: img, alt: title, className: "aspect-[2/1] w-full object-cover" }))),
|
|
11
|
+
React.createElement("div", { className: cn("flex flex-col space-y-2", horizontal ? "flex-row items-start space-x-4 space-y-0" : "", img ? "p-4" : "p-6") },
|
|
12
|
+
React.createElement("div", { className: "flex-1" },
|
|
13
|
+
IconComponent && (React.createElement(IconComponent, { className: "mb-2 h-5 w-5 text-[#0066FF] dark:text-[#66A3FF]" })),
|
|
14
|
+
React.createElement("h3", { className: "font-bold text-zinc-900 dark:text-zinc-100" }, title),
|
|
15
|
+
React.createElement("p", { className: "mt-2 text-zinc-600 dark:text-zinc-400" }, children)))));
|
|
16
|
+
return (React.createElement("div", { className: cn("group relative rounded-lg border border-zinc-200 bg-white transition-shadow hover:shadow-md dark:border-zinc-800 dark:bg-zinc-950", className) }, href ? (React.createElement("a", { href: href, className: "flex h-full flex-col", target: "_blank", rel: "noopener noreferrer" },
|
|
17
|
+
React.createElement(CardContent, null))) : (React.createElement(CardContent, null))));
|
|
18
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { cn } from "../../../../../lib/utils";
|
|
3
|
+
//TODO: Fix the bug on not being able to display different number of columns
|
|
4
|
+
export const CardGroup = ({ children, cols = 2, className, }) => {
|
|
5
|
+
// Helper function to get the correct column classes
|
|
6
|
+
const getColumnClass = () => {
|
|
7
|
+
switch (cols) {
|
|
8
|
+
case 1:
|
|
9
|
+
return "grid-cols-1";
|
|
10
|
+
case 2:
|
|
11
|
+
return "grid-cols-1 sm:grid-cols-2";
|
|
12
|
+
case 3:
|
|
13
|
+
return "grid-cols-1 sm:grid-cols-2 lg:grid-cols-3";
|
|
14
|
+
case 4:
|
|
15
|
+
return "grid-cols-1 sm:grid-cols-2 lg:grid-cols-4";
|
|
16
|
+
case 5:
|
|
17
|
+
return "grid-cols-1 sm:grid-cols-2 lg:grid-cols-5";
|
|
18
|
+
case 6:
|
|
19
|
+
return "grid-cols-1 sm:grid-cols-2 lg:grid-cols-6";
|
|
20
|
+
default:
|
|
21
|
+
return "grid-cols-1 sm:grid-cols-2";
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
return (React.createElement("div", { className: cn("grid gap-4", getColumnClass(), className) }, children));
|
|
25
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
|
|
3
|
+
import { cn } from "../../../../../../lib/utils";
|
|
4
|
+
import { Copy } from "lucide-react";
|
|
5
|
+
export const CodeBlock = ({ language, value, title, className, children, isInsideCodeGroup = false, }) => {
|
|
6
|
+
// const {theme} = useTheme();
|
|
7
|
+
// const isDark = theme === "dark";
|
|
8
|
+
const isDark = true;
|
|
9
|
+
const [copied, setCopied] = React.useState(false);
|
|
10
|
+
const lightTheme = {
|
|
11
|
+
'code[class*="language-"]': {
|
|
12
|
+
color: "#1F2937",
|
|
13
|
+
background: "transparent",
|
|
14
|
+
},
|
|
15
|
+
'pre[class*="language-"]': {
|
|
16
|
+
background: "transparent",
|
|
17
|
+
},
|
|
18
|
+
keyword: {
|
|
19
|
+
color: "#D92D20",
|
|
20
|
+
},
|
|
21
|
+
string: {
|
|
22
|
+
color: "#027A48",
|
|
23
|
+
},
|
|
24
|
+
constant: {
|
|
25
|
+
color: "#1F2937",
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
const darkTheme = {
|
|
29
|
+
'code[class*="language-"]': {
|
|
30
|
+
color: "#E5E7EB",
|
|
31
|
+
background: "transparent",
|
|
32
|
+
},
|
|
33
|
+
'pre[class*="language-"]': {
|
|
34
|
+
background: "transparent",
|
|
35
|
+
},
|
|
36
|
+
keyword: {
|
|
37
|
+
color: "#FF6B6B",
|
|
38
|
+
},
|
|
39
|
+
string: {
|
|
40
|
+
color: "#34D399",
|
|
41
|
+
},
|
|
42
|
+
constant: {
|
|
43
|
+
color: "#E5E7EB",
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
let code = value;
|
|
47
|
+
if (typeof children === "string") {
|
|
48
|
+
code = children;
|
|
49
|
+
}
|
|
50
|
+
const handleCopy = async () => {
|
|
51
|
+
try {
|
|
52
|
+
await navigator.clipboard.writeText(code || "");
|
|
53
|
+
setCopied(true);
|
|
54
|
+
setTimeout(() => setCopied(false), 2000);
|
|
55
|
+
}
|
|
56
|
+
catch (err) {
|
|
57
|
+
console.error("Failed to copy code:", err);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
// If inside CodeGroup, render just the code content
|
|
61
|
+
if (isInsideCodeGroup) {
|
|
62
|
+
return (React.createElement("div", { className: "group relative overflow-x-auto" },
|
|
63
|
+
React.createElement(SyntaxHighlighter, { language: language || "javascript", style: isDark ? darkTheme : lightTheme, customStyle: {
|
|
64
|
+
margin: 0,
|
|
65
|
+
padding: "1rem 1.25rem",
|
|
66
|
+
background: "transparent",
|
|
67
|
+
fontSize: "0.875rem",
|
|
68
|
+
lineHeight: "1.5rem",
|
|
69
|
+
}, showLineNumbers: false, wrapLines: true }, code || "")));
|
|
70
|
+
}
|
|
71
|
+
// Standalone code block with title
|
|
72
|
+
return (React.createElement("div", { className: cn("relative rounded-lg border border-zinc-200 bg-white shadow-sm dark:border-zinc-800 dark:bg-zinc-950", className) },
|
|
73
|
+
title && (React.createElement("div", { className: "flex items-center justify-between px-4 py-2 border-b border-zinc-200 dark:border-zinc-800 bg-zinc-50/80 dark:bg-zinc-900/80" },
|
|
74
|
+
React.createElement("span", { className: "text-sm text-[var(--colors-primary)] font-medium" }, language || title),
|
|
75
|
+
React.createElement("button", { onClick: handleCopy, className: cn("p-1 transition-colors", copied
|
|
76
|
+
? "text-green-500 dark:text-green-400"
|
|
77
|
+
: "text-zinc-500 hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-zinc-200"), "aria-label": "Copy code" },
|
|
78
|
+
React.createElement(Copy, { className: "h-4 w-4" })))),
|
|
79
|
+
React.createElement("div", { className: "px-4 py-3 overflow-x-auto" },
|
|
80
|
+
React.createElement(SyntaxHighlighter, { language: language || "javascript", style: isDark ? darkTheme : lightTheme, customStyle: {
|
|
81
|
+
margin: 0,
|
|
82
|
+
padding: 0,
|
|
83
|
+
background: "transparent",
|
|
84
|
+
fontSize: "0.875rem",
|
|
85
|
+
lineHeight: "1.5rem",
|
|
86
|
+
}, showLineNumbers: false, wrapLines: true }, code || ""))));
|
|
87
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { Copy } from "lucide-react";
|
|
3
|
+
import { cn } from "../../../../../lib/utils";
|
|
4
|
+
import { CodeBlock } from "./code-group/code-block";
|
|
5
|
+
export const CodeGroup = ({ children }) => {
|
|
6
|
+
const [activeTab, setActiveTab] = useState(0);
|
|
7
|
+
const [copied, setCopied] = useState(false);
|
|
8
|
+
const parseCodeBlock = (element) => {
|
|
9
|
+
if (!element || !element.props) {
|
|
10
|
+
console.warn("Invalid code block element");
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
try {
|
|
14
|
+
// Handle both direct string content and nested code elements
|
|
15
|
+
let codeElement = null;
|
|
16
|
+
let content = "";
|
|
17
|
+
if (typeof element.props.children === "string") {
|
|
18
|
+
content = element.props.children.trim();
|
|
19
|
+
// Use the pre element's className if available
|
|
20
|
+
const classNameRaw = element.props.className || "";
|
|
21
|
+
const parts = classNameRaw.replace(/^language-/, "").split(" ");
|
|
22
|
+
const language = parts[0] || "plain";
|
|
23
|
+
const title = parts.slice(1).join(" ") || language;
|
|
24
|
+
return { language, title, content };
|
|
25
|
+
}
|
|
26
|
+
// Handle nested code element
|
|
27
|
+
if (Array.isArray(element.props.children)) {
|
|
28
|
+
const codeChild = element.props.children.find((child) => React.isValidElement(child) &&
|
|
29
|
+
(child.type === "code" || typeof child.type === "string"));
|
|
30
|
+
if (codeChild) {
|
|
31
|
+
codeElement = codeChild;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
else if (React.isValidElement(element.props.children)) {
|
|
35
|
+
codeElement = element.props.children;
|
|
36
|
+
}
|
|
37
|
+
if (!codeElement || !codeElement.props) {
|
|
38
|
+
console.warn("No valid code element found");
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
const classNameRaw = codeElement.props.className || "";
|
|
42
|
+
const parts = classNameRaw.replace(/^language-/, "").split(" ");
|
|
43
|
+
const language = parts[0] || "plain";
|
|
44
|
+
const title = parts.slice(1).join(" ") || language;
|
|
45
|
+
// Handle different content structures
|
|
46
|
+
if (typeof codeElement.props.children === "string") {
|
|
47
|
+
content = codeElement.props.children.trim();
|
|
48
|
+
}
|
|
49
|
+
else if (Array.isArray(codeElement.props.children)) {
|
|
50
|
+
content = codeElement.props.children
|
|
51
|
+
.map((child) => {
|
|
52
|
+
var _a;
|
|
53
|
+
return typeof child === "string"
|
|
54
|
+
? child
|
|
55
|
+
: React.isValidElement(child)
|
|
56
|
+
? ((_a = child.props.children) === null || _a === void 0 ? void 0 : _a.toString()) || ""
|
|
57
|
+
: "";
|
|
58
|
+
})
|
|
59
|
+
.join("")
|
|
60
|
+
.trim();
|
|
61
|
+
}
|
|
62
|
+
return { language, title, content };
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
console.error("Failed to parse code block:", error);
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const validChildren = Array.isArray(children) ? children : [children];
|
|
70
|
+
const blocks = validChildren
|
|
71
|
+
.filter((child) => React.isValidElement(child) &&
|
|
72
|
+
(child.type === "pre" || typeof child.type === "string"))
|
|
73
|
+
.map(parseCodeBlock)
|
|
74
|
+
.filter((block) => block !== null);
|
|
75
|
+
if (blocks.length === 0) {
|
|
76
|
+
console.warn("No valid code blocks found");
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
const handleCopy = async () => {
|
|
80
|
+
try {
|
|
81
|
+
await navigator.clipboard.writeText(blocks[activeTab].content);
|
|
82
|
+
setCopied(true);
|
|
83
|
+
setTimeout(() => setCopied(false), 2000);
|
|
84
|
+
}
|
|
85
|
+
catch (err) {
|
|
86
|
+
console.error("Failed to copy code:", err);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
return (React.createElement("div", { className: "relative my-4 rounded-lg border border-zinc-200 bg-white shadow-sm dark:border-zinc-800 dark:bg-zinc-950" },
|
|
90
|
+
React.createElement("div", { className: "flex items-center justify-between border-b border-zinc-200 bg-zinc-50/80 dark:border-zinc-800 dark:bg-zinc-900/80" },
|
|
91
|
+
React.createElement("div", { className: "flex overflow-x-auto" }, blocks.map((block, index) => (React.createElement("button", { key: index, onClick: () => setActiveTab(index), className: cn("min-w-[120px] border-b-2 px-4 py-2 text-sm font-medium", "transition-all duration-200", activeTab === index
|
|
92
|
+
? "border-[#0066FF] text-[#0066FF] dark:border-[#66A3FF] dark:text-[#66A3FF]"
|
|
93
|
+
: "border-transparent text-zinc-600 hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-zinc-200") }, block.title)))),
|
|
94
|
+
React.createElement("div", { className: "border-l border-zinc-200 dark:border-zinc-800" },
|
|
95
|
+
React.createElement("button", { onClick: handleCopy, className: cn("p-2 transition-colors", copied
|
|
96
|
+
? "text-green-500 dark:text-green-400"
|
|
97
|
+
: "text-zinc-500 hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-zinc-200"), "aria-label": "Copy code" },
|
|
98
|
+
React.createElement(Copy, { className: "h-4 w-4" })))),
|
|
99
|
+
React.createElement("div", { className: "group relative" }, blocks.map((block, index) => (React.createElement("div", { key: index, className: cn("relative", activeTab === index ? "block" : "hidden") },
|
|
100
|
+
React.createElement(CodeBlock, { language: block.language, value: block.content, isInsideCodeGroup: true })))))));
|
|
101
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { cn } from "../../../../../lib/utils";
|
|
3
|
+
import * as LucideIcons from "lucide-react";
|
|
4
|
+
const Icon = ({ icon, size = 24, color = "#0066FF", strokeWidth = 2, absoluteStrokeWidth = false, className, children, }) => {
|
|
5
|
+
// Ensure `size` is always passed as a string
|
|
6
|
+
const normalizedSize = typeof size === "number" ? `${size}` : size;
|
|
7
|
+
// Fetch the appropriate icon component from LucideIcons
|
|
8
|
+
const IconComponent = icon
|
|
9
|
+
? LucideIcons[icon]
|
|
10
|
+
: null;
|
|
11
|
+
if (!IconComponent) {
|
|
12
|
+
console.warn(`Icon "${icon}" not found or not provided`);
|
|
13
|
+
return (React.createElement("span", { className: cn("inline-block align-middle text-zinc-500 italic", className) }, `Icon "${icon}" not found`));
|
|
14
|
+
}
|
|
15
|
+
// Decide rendering behavior based on `children`
|
|
16
|
+
if (!children) {
|
|
17
|
+
// No inline text: render as standalone block-level element
|
|
18
|
+
return (React.createElement("div", { className: cn("block", className), style: {
|
|
19
|
+
lineHeight: 0, // Prevent extra spacing around the icon
|
|
20
|
+
} },
|
|
21
|
+
React.createElement(IconComponent, { size: normalizedSize, color: color, strokeWidth: strokeWidth, absoluteStrokeWidth: absoluteStrokeWidth })));
|
|
22
|
+
}
|
|
23
|
+
// Inline text exists: render as inline-flex with the text
|
|
24
|
+
return (React.createElement("span", { className: cn("inline-flex items-center align-middle gap-1", className), style: {
|
|
25
|
+
display: "inline-flex",
|
|
26
|
+
verticalAlign: "middle",
|
|
27
|
+
} },
|
|
28
|
+
React.createElement(IconComponent, { size: normalizedSize, color: color, strokeWidth: strokeWidth, absoluteStrokeWidth: absoluteStrokeWidth }),
|
|
29
|
+
React.createElement("span", null, children)));
|
|
30
|
+
};
|
|
31
|
+
export default Icon;
|