@epicbagel/saas-kit 1.35.0 → 1.36.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.
- package/dist/{chunk-DILYV4FI.js → chunk-AL3FBR36.js} +12 -6
- package/dist/{chunk-FARCLWLU.cjs → chunk-AYH5TTLD.cjs} +12 -6
- package/dist/chunk-OABDSR7G.js +70 -0
- package/dist/chunk-VWMNAIDX.cjs +70 -0
- package/dist/primitives/code-block.cjs +3 -3
- package/dist/primitives/code-block.js +2 -2
- package/dist/primitives/copy-button.cjs +2 -2
- package/dist/primitives/copy-button.d.cts +9 -0
- package/dist/primitives/copy-button.d.ts +9 -0
- package/dist/primitives/copy-button.js +1 -1
- package/dist/primitives/file-preview.cjs +3 -3
- package/dist/primitives/file-preview.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-BGCNGYPL.cjs +0 -55
- package/dist/chunk-HTPPNW74.js +0 -55
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
import {
|
|
3
3
|
Button
|
|
4
4
|
} from "./chunk-W326GKML.js";
|
|
5
|
-
import {
|
|
6
|
-
cn
|
|
7
|
-
} from "./chunk-G6SRSWXB.js";
|
|
8
5
|
import {
|
|
9
6
|
useCopyToClipboard
|
|
10
7
|
} from "./chunk-ZWZAAGQF.js";
|
|
@@ -13,6 +10,15 @@ import {
|
|
|
13
10
|
import { forwardRef } from "react";
|
|
14
11
|
import { Check, Copy } from "lucide-react";
|
|
15
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
var ICON_SIZES = /* @__PURE__ */ new Set([
|
|
14
|
+
"icon",
|
|
15
|
+
"icon-lg",
|
|
16
|
+
"icon-sm",
|
|
17
|
+
"icon-md",
|
|
18
|
+
"icon-xs",
|
|
19
|
+
"icon-compact",
|
|
20
|
+
"icon-micro"
|
|
21
|
+
]);
|
|
16
22
|
var CopyButton = forwardRef(
|
|
17
23
|
function CopyButton2({
|
|
18
24
|
text,
|
|
@@ -27,7 +33,7 @@ var CopyButton = forwardRef(
|
|
|
27
33
|
}, ref) {
|
|
28
34
|
const { copied, copy } = useCopyToClipboard({ resetAfter });
|
|
29
35
|
const iconOnly = label == null;
|
|
30
|
-
const resolvedSize = size
|
|
36
|
+
const resolvedSize = iconOnly ? size != null && ICON_SIZES.has(size) ? size : "icon-compact" : size ?? "sm";
|
|
31
37
|
return /* @__PURE__ */ jsxs(
|
|
32
38
|
Button,
|
|
33
39
|
{
|
|
@@ -35,7 +41,7 @@ var CopyButton = forwardRef(
|
|
|
35
41
|
type: "button",
|
|
36
42
|
variant,
|
|
37
43
|
size: resolvedSize,
|
|
38
|
-
className
|
|
44
|
+
className,
|
|
39
45
|
onClick: async (e) => {
|
|
40
46
|
e.stopPropagation();
|
|
41
47
|
const ok = await copy(text);
|
|
@@ -44,7 +50,7 @@ var CopyButton = forwardRef(
|
|
|
44
50
|
"aria-label": iconOnly ? "Copy" : void 0,
|
|
45
51
|
...rest,
|
|
46
52
|
children: [
|
|
47
|
-
copied ? /* @__PURE__ */ jsx(Check, {
|
|
53
|
+
copied ? /* @__PURE__ */ jsx(Check, {}) : /* @__PURE__ */ jsx(Copy, {}),
|
|
48
54
|
!iconOnly && (copied ? copiedLabel ?? label : label)
|
|
49
55
|
]
|
|
50
56
|
}
|
|
@@ -4,15 +4,21 @@
|
|
|
4
4
|
var _chunkJDEXZGIYcjs = require('./chunk-JDEXZGIY.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var _chunkKWLSBTB2cjs = require('./chunk-KWLSBTB2.cjs');
|
|
8
|
-
|
|
9
|
-
|
|
10
7
|
var _chunk4LXN6GLZcjs = require('./chunk-4LXN6GLZ.cjs');
|
|
11
8
|
|
|
12
9
|
// src/primitives/copy-button.tsx
|
|
13
10
|
var _react = require('react');
|
|
14
11
|
var _lucidereact = require('lucide-react');
|
|
15
12
|
var _jsxruntime = require('react/jsx-runtime');
|
|
13
|
+
var ICON_SIZES = /* @__PURE__ */ new Set([
|
|
14
|
+
"icon",
|
|
15
|
+
"icon-lg",
|
|
16
|
+
"icon-sm",
|
|
17
|
+
"icon-md",
|
|
18
|
+
"icon-xs",
|
|
19
|
+
"icon-compact",
|
|
20
|
+
"icon-micro"
|
|
21
|
+
]);
|
|
16
22
|
var CopyButton = _react.forwardRef.call(void 0,
|
|
17
23
|
function CopyButton2({
|
|
18
24
|
text,
|
|
@@ -27,7 +33,7 @@ var CopyButton = _react.forwardRef.call(void 0,
|
|
|
27
33
|
}, ref) {
|
|
28
34
|
const { copied, copy } = _chunk4LXN6GLZcjs.useCopyToClipboard.call(void 0, { resetAfter });
|
|
29
35
|
const iconOnly = label == null;
|
|
30
|
-
const resolvedSize =
|
|
36
|
+
const resolvedSize = iconOnly ? size != null && ICON_SIZES.has(size) ? size : "icon-compact" : _nullishCoalesce(size, () => ( "sm"));
|
|
31
37
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
32
38
|
_chunkJDEXZGIYcjs.Button,
|
|
33
39
|
{
|
|
@@ -35,7 +41,7 @@ var CopyButton = _react.forwardRef.call(void 0,
|
|
|
35
41
|
type: "button",
|
|
36
42
|
variant,
|
|
37
43
|
size: resolvedSize,
|
|
38
|
-
className
|
|
44
|
+
className,
|
|
39
45
|
onClick: async (e) => {
|
|
40
46
|
e.stopPropagation();
|
|
41
47
|
const ok = await copy(text);
|
|
@@ -44,7 +50,7 @@ var CopyButton = _react.forwardRef.call(void 0,
|
|
|
44
50
|
"aria-label": iconOnly ? "Copy" : void 0,
|
|
45
51
|
...rest,
|
|
46
52
|
children: [
|
|
47
|
-
copied ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Check, {
|
|
53
|
+
copied ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Check, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Copy, {}),
|
|
48
54
|
!iconOnly && (copied ? _nullishCoalesce(copiedLabel, () => ( label)) : label)
|
|
49
55
|
]
|
|
50
56
|
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
CopyButton
|
|
4
|
+
} from "./chunk-AL3FBR36.js";
|
|
5
|
+
import {
|
|
6
|
+
cn
|
|
7
|
+
} from "./chunk-G6SRSWXB.js";
|
|
8
|
+
|
|
9
|
+
// src/primitives/code-block.tsx
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
var CODE_TYPE = "font-mono text-xs leading-relaxed";
|
|
12
|
+
var HEIGHTS = {
|
|
13
|
+
none: "",
|
|
14
|
+
sm: "max-h-40 overflow-y-auto",
|
|
15
|
+
md: "max-h-64 overflow-y-auto",
|
|
16
|
+
lg: "max-h-96 overflow-y-auto",
|
|
17
|
+
viewport: "min-h-[55vh] max-h-[65vh] overflow-y-auto"
|
|
18
|
+
};
|
|
19
|
+
function CodeBlock({
|
|
20
|
+
children,
|
|
21
|
+
copy,
|
|
22
|
+
copyLabel,
|
|
23
|
+
wrap = false,
|
|
24
|
+
maxHeight = "none",
|
|
25
|
+
className
|
|
26
|
+
}) {
|
|
27
|
+
const copyText = typeof copy === "string" ? copy : children;
|
|
28
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("relative", className), children: [
|
|
29
|
+
/* @__PURE__ */ jsx(
|
|
30
|
+
"pre",
|
|
31
|
+
{
|
|
32
|
+
className: cn(
|
|
33
|
+
"rounded-md border border-border bg-muted/40 p-3",
|
|
34
|
+
CODE_TYPE,
|
|
35
|
+
wrap ? "whitespace-pre-wrap break-words" : "overflow-x-auto",
|
|
36
|
+
HEIGHTS[maxHeight],
|
|
37
|
+
copy ? "pr-12" : void 0
|
|
38
|
+
),
|
|
39
|
+
children
|
|
40
|
+
}
|
|
41
|
+
),
|
|
42
|
+
copy ? (
|
|
43
|
+
// The copy button sits on the first line of code: this box is that
|
|
44
|
+
// line (the block's border and padding down from the top, one line
|
|
45
|
+
// of the block's own type high), and the button is centred in it.
|
|
46
|
+
// So its glyph shares the first line's centre whatever the button's
|
|
47
|
+
// size, the type's or the viewport's, with no offset to keep in step.
|
|
48
|
+
/* @__PURE__ */ jsx(
|
|
49
|
+
"div",
|
|
50
|
+
{
|
|
51
|
+
"data-slot": "code-block-copy",
|
|
52
|
+
className: cn(CODE_TYPE, "pointer-events-none absolute right-1.5 top-3 mt-px flex h-[1lh] items-center"),
|
|
53
|
+
children: /* @__PURE__ */ jsx(
|
|
54
|
+
CopyButton,
|
|
55
|
+
{
|
|
56
|
+
text: copyText,
|
|
57
|
+
label: copyLabel,
|
|
58
|
+
variant: "ghost",
|
|
59
|
+
className: "pointer-events-auto"
|
|
60
|
+
}
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
) : null
|
|
65
|
+
] });
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export {
|
|
69
|
+
CodeBlock
|
|
70
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkAYH5TTLDcjs = require('./chunk-AYH5TTLD.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkKWLSBTB2cjs = require('./chunk-KWLSBTB2.cjs');
|
|
8
|
+
|
|
9
|
+
// src/primitives/code-block.tsx
|
|
10
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
11
|
+
var CODE_TYPE = "font-mono text-xs leading-relaxed";
|
|
12
|
+
var HEIGHTS = {
|
|
13
|
+
none: "",
|
|
14
|
+
sm: "max-h-40 overflow-y-auto",
|
|
15
|
+
md: "max-h-64 overflow-y-auto",
|
|
16
|
+
lg: "max-h-96 overflow-y-auto",
|
|
17
|
+
viewport: "min-h-[55vh] max-h-[65vh] overflow-y-auto"
|
|
18
|
+
};
|
|
19
|
+
function CodeBlock({
|
|
20
|
+
children,
|
|
21
|
+
copy,
|
|
22
|
+
copyLabel,
|
|
23
|
+
wrap = false,
|
|
24
|
+
maxHeight = "none",
|
|
25
|
+
className
|
|
26
|
+
}) {
|
|
27
|
+
const copyText = typeof copy === "string" ? copy : children;
|
|
28
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkKWLSBTB2cjs.cn.call(void 0, "relative", className), children: [
|
|
29
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
30
|
+
"pre",
|
|
31
|
+
{
|
|
32
|
+
className: _chunkKWLSBTB2cjs.cn.call(void 0,
|
|
33
|
+
"rounded-md border border-border bg-muted/40 p-3",
|
|
34
|
+
CODE_TYPE,
|
|
35
|
+
wrap ? "whitespace-pre-wrap break-words" : "overflow-x-auto",
|
|
36
|
+
HEIGHTS[maxHeight],
|
|
37
|
+
copy ? "pr-12" : void 0
|
|
38
|
+
),
|
|
39
|
+
children
|
|
40
|
+
}
|
|
41
|
+
),
|
|
42
|
+
copy ? (
|
|
43
|
+
// The copy button sits on the first line of code: this box is that
|
|
44
|
+
// line (the block's border and padding down from the top, one line
|
|
45
|
+
// of the block's own type high), and the button is centred in it.
|
|
46
|
+
// So its glyph shares the first line's centre whatever the button's
|
|
47
|
+
// size, the type's or the viewport's, with no offset to keep in step.
|
|
48
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
49
|
+
"div",
|
|
50
|
+
{
|
|
51
|
+
"data-slot": "code-block-copy",
|
|
52
|
+
className: _chunkKWLSBTB2cjs.cn.call(void 0, CODE_TYPE, "pointer-events-none absolute right-1.5 top-3 mt-px flex h-[1lh] items-center"),
|
|
53
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
54
|
+
_chunkAYH5TTLDcjs.CopyButton,
|
|
55
|
+
{
|
|
56
|
+
text: copyText,
|
|
57
|
+
label: copyLabel,
|
|
58
|
+
variant: "ghost",
|
|
59
|
+
className: "pointer-events-auto"
|
|
60
|
+
}
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
) : null
|
|
65
|
+
] });
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
exports.CodeBlock = CodeBlock;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('../chunk-
|
|
4
|
+
var _chunkVWMNAIDXcjs = require('../chunk-VWMNAIDX.cjs');
|
|
5
|
+
require('../chunk-AYH5TTLD.cjs');
|
|
6
6
|
require('../chunk-JDEXZGIY.cjs');
|
|
7
7
|
require('../chunk-KWLSBTB2.cjs');
|
|
8
8
|
require('../chunk-4LXN6GLZ.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
exports.CodeBlock =
|
|
11
|
+
exports.CodeBlock = _chunkVWMNAIDXcjs.CodeBlock;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
CodeBlock
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-OABDSR7G.js";
|
|
5
|
+
import "../chunk-AL3FBR36.js";
|
|
6
6
|
import "../chunk-W326GKML.js";
|
|
7
7
|
import "../chunk-G6SRSWXB.js";
|
|
8
8
|
import "../chunk-ZWZAAGQF.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkAYH5TTLDcjs = require('../chunk-AYH5TTLD.cjs');
|
|
5
5
|
require('../chunk-JDEXZGIY.cjs');
|
|
6
6
|
require('../chunk-KWLSBTB2.cjs');
|
|
7
7
|
require('../chunk-4LXN6GLZ.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
exports.CopyButton =
|
|
10
|
+
exports.CopyButton = _chunkAYH5TTLDcjs.CopyButton;
|
|
@@ -9,6 +9,15 @@ interface CopyButtonProps extends Omit<ButtonProps, "onClick" | "children"> {
|
|
|
9
9
|
text: string;
|
|
10
10
|
/** Optional label shown next to the icon. Omit for an icon-only button. */
|
|
11
11
|
label?: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* The Button size. With a `label` it is a text button, `sm` by default.
|
|
14
|
+
* With no label it is an icon button: `icon-compact` (28px) by default,
|
|
15
|
+
* and any of the Button's icon sizes as given, so beside other icon
|
|
16
|
+
* buttons it takes theirs (`size="icon"`) and shares their centre line. A
|
|
17
|
+
* text size on a button with no text means nothing, and is read as the
|
|
18
|
+
* default.
|
|
19
|
+
*/
|
|
20
|
+
size?: ButtonProps["size"];
|
|
12
21
|
/** Label shown after a successful copy. Defaults to `label`. */
|
|
13
22
|
copiedLabel?: ReactNode;
|
|
14
23
|
/** ms before the success state reverts. Defaults to 2000. */
|
|
@@ -9,6 +9,15 @@ interface CopyButtonProps extends Omit<ButtonProps, "onClick" | "children"> {
|
|
|
9
9
|
text: string;
|
|
10
10
|
/** Optional label shown next to the icon. Omit for an icon-only button. */
|
|
11
11
|
label?: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* The Button size. With a `label` it is a text button, `sm` by default.
|
|
14
|
+
* With no label it is an icon button: `icon-compact` (28px) by default,
|
|
15
|
+
* and any of the Button's icon sizes as given, so beside other icon
|
|
16
|
+
* buttons it takes theirs (`size="icon"`) and shares their centre line. A
|
|
17
|
+
* text size on a button with no text means nothing, and is read as the
|
|
18
|
+
* default.
|
|
19
|
+
*/
|
|
20
|
+
size?: ButtonProps["size"];
|
|
12
21
|
/** Label shown after a successful copy. Defaults to `label`. */
|
|
13
22
|
copiedLabel?: ReactNode;
|
|
14
23
|
/** ms before the success state reverts. Defaults to 2000. */
|
|
@@ -17,8 +17,8 @@ require('../chunk-ELPV44S6.cjs');
|
|
|
17
17
|
require('../chunk-2BHI5ZWJ.cjs');
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
var
|
|
21
|
-
require('../chunk-
|
|
20
|
+
var _chunkVWMNAIDXcjs = require('../chunk-VWMNAIDX.cjs');
|
|
21
|
+
require('../chunk-AYH5TTLD.cjs');
|
|
22
22
|
require('../chunk-WDXEJDMO.cjs');
|
|
23
23
|
|
|
24
24
|
|
|
@@ -281,7 +281,7 @@ function FilePreviewBody({
|
|
|
281
281
|
kind === "markdown" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkKENBU3NVcjs.LazyMarkdown, { components: { a: NewTabLink, ...markdownComponents }, children: text.text }) : (
|
|
282
282
|
// The theme's relaxed leading is a fixed 1.8rem, which spaces a
|
|
283
283
|
// file's small monospace lines apart; read it at 20px lines.
|
|
284
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
284
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVWMNAIDXcjs.CodeBlock, { wrap: true, className: "[&>pre]:leading-5", children: text.text })
|
|
285
285
|
)
|
|
286
286
|
] });
|
|
287
287
|
}
|
|
@@ -17,8 +17,8 @@ import "../chunk-INNGGLMZ.js";
|
|
|
17
17
|
import "../chunk-4HWCNRK4.js";
|
|
18
18
|
import {
|
|
19
19
|
CodeBlock
|
|
20
|
-
} from "../chunk-
|
|
21
|
-
import "../chunk-
|
|
20
|
+
} from "../chunk-OABDSR7G.js";
|
|
21
|
+
import "../chunk-AL3FBR36.js";
|
|
22
22
|
import "../chunk-3QT5VYZ3.js";
|
|
23
23
|
import {
|
|
24
24
|
Text
|
package/package.json
CHANGED
package/dist/chunk-BGCNGYPL.cjs
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var _chunkFARCLWLUcjs = require('./chunk-FARCLWLU.cjs');
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var _chunkKWLSBTB2cjs = require('./chunk-KWLSBTB2.cjs');
|
|
8
|
-
|
|
9
|
-
// src/primitives/code-block.tsx
|
|
10
|
-
var _jsxruntime = require('react/jsx-runtime');
|
|
11
|
-
var HEIGHTS = {
|
|
12
|
-
none: "",
|
|
13
|
-
sm: "max-h-40 overflow-y-auto",
|
|
14
|
-
md: "max-h-64 overflow-y-auto",
|
|
15
|
-
lg: "max-h-96 overflow-y-auto",
|
|
16
|
-
viewport: "min-h-[55vh] max-h-[65vh] overflow-y-auto"
|
|
17
|
-
};
|
|
18
|
-
function CodeBlock({
|
|
19
|
-
children,
|
|
20
|
-
copy,
|
|
21
|
-
copyLabel,
|
|
22
|
-
wrap = false,
|
|
23
|
-
maxHeight = "none",
|
|
24
|
-
className
|
|
25
|
-
}) {
|
|
26
|
-
const copyText = typeof copy === "string" ? copy : children;
|
|
27
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: _chunkKWLSBTB2cjs.cn.call(void 0, "relative", className), children: [
|
|
28
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
29
|
-
"pre",
|
|
30
|
-
{
|
|
31
|
-
className: _chunkKWLSBTB2cjs.cn.call(void 0,
|
|
32
|
-
"rounded-md border border-border bg-muted/40 p-3 font-mono text-xs leading-relaxed",
|
|
33
|
-
wrap ? "whitespace-pre-wrap break-words" : "overflow-x-auto",
|
|
34
|
-
HEIGHTS[maxHeight],
|
|
35
|
-
copy ? "pr-12" : void 0
|
|
36
|
-
),
|
|
37
|
-
children
|
|
38
|
-
}
|
|
39
|
-
),
|
|
40
|
-
copy ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
41
|
-
_chunkFARCLWLUcjs.CopyButton,
|
|
42
|
-
{
|
|
43
|
-
text: copyText,
|
|
44
|
-
label: copyLabel,
|
|
45
|
-
size: "sm",
|
|
46
|
-
variant: "ghost",
|
|
47
|
-
className: "absolute right-1.5 top-1.5"
|
|
48
|
-
}
|
|
49
|
-
) : null
|
|
50
|
-
] });
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
exports.CodeBlock = CodeBlock;
|
package/dist/chunk-HTPPNW74.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
CopyButton
|
|
4
|
-
} from "./chunk-DILYV4FI.js";
|
|
5
|
-
import {
|
|
6
|
-
cn
|
|
7
|
-
} from "./chunk-G6SRSWXB.js";
|
|
8
|
-
|
|
9
|
-
// src/primitives/code-block.tsx
|
|
10
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
-
var HEIGHTS = {
|
|
12
|
-
none: "",
|
|
13
|
-
sm: "max-h-40 overflow-y-auto",
|
|
14
|
-
md: "max-h-64 overflow-y-auto",
|
|
15
|
-
lg: "max-h-96 overflow-y-auto",
|
|
16
|
-
viewport: "min-h-[55vh] max-h-[65vh] overflow-y-auto"
|
|
17
|
-
};
|
|
18
|
-
function CodeBlock({
|
|
19
|
-
children,
|
|
20
|
-
copy,
|
|
21
|
-
copyLabel,
|
|
22
|
-
wrap = false,
|
|
23
|
-
maxHeight = "none",
|
|
24
|
-
className
|
|
25
|
-
}) {
|
|
26
|
-
const copyText = typeof copy === "string" ? copy : children;
|
|
27
|
-
return /* @__PURE__ */ jsxs("div", { className: cn("relative", className), children: [
|
|
28
|
-
/* @__PURE__ */ jsx(
|
|
29
|
-
"pre",
|
|
30
|
-
{
|
|
31
|
-
className: cn(
|
|
32
|
-
"rounded-md border border-border bg-muted/40 p-3 font-mono text-xs leading-relaxed",
|
|
33
|
-
wrap ? "whitespace-pre-wrap break-words" : "overflow-x-auto",
|
|
34
|
-
HEIGHTS[maxHeight],
|
|
35
|
-
copy ? "pr-12" : void 0
|
|
36
|
-
),
|
|
37
|
-
children
|
|
38
|
-
}
|
|
39
|
-
),
|
|
40
|
-
copy ? /* @__PURE__ */ jsx(
|
|
41
|
-
CopyButton,
|
|
42
|
-
{
|
|
43
|
-
text: copyText,
|
|
44
|
-
label: copyLabel,
|
|
45
|
-
size: "sm",
|
|
46
|
-
variant: "ghost",
|
|
47
|
-
className: "absolute right-1.5 top-1.5"
|
|
48
|
-
}
|
|
49
|
-
) : null
|
|
50
|
-
] });
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export {
|
|
54
|
-
CodeBlock
|
|
55
|
-
};
|