@node-core/ui-components 1.0.1-6cb8b0a0c75c24f5ccc84bb07a1ea9b4b810abd2 → 1.0.1-e9ec33a60f54512653a136fe677cd7e04d47c7dc
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.
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
DocumentDuplicateIcon,
|
|
5
|
-
CodeBracketIcon,
|
|
6
|
-
} from '@heroicons/react/24/outline';
|
|
3
|
+
import { DocumentDuplicateIcon } from '@heroicons/react/24/outline';
|
|
7
4
|
import classNames from 'classnames';
|
|
8
|
-
import type { FC, PropsWithChildren, ReactElement
|
|
5
|
+
import type { FC, PropsWithChildren, ReactElement } from 'react';
|
|
9
6
|
import { Fragment, isValidElement, useRef } from 'react';
|
|
10
7
|
|
|
11
8
|
import BaseButton from '#ui/Common/BaseButton';
|
|
@@ -69,10 +66,9 @@ const transformCode = <T extends ReactElement<PropsWithChildren>>(
|
|
|
69
66
|
interface CodeBoxProps {
|
|
70
67
|
language: string;
|
|
71
68
|
className?: string;
|
|
72
|
-
onCopy: (text: string
|
|
69
|
+
onCopy: (text: string) => void;
|
|
73
70
|
as?: LinkLike;
|
|
74
|
-
|
|
75
|
-
copiedText: string;
|
|
71
|
+
buttonText: string;
|
|
76
72
|
showCopyButton?: boolean;
|
|
77
73
|
}
|
|
78
74
|
|
|
@@ -81,8 +77,7 @@ const BaseCodeBox: FC<PropsWithChildren<CodeBoxProps>> = ({
|
|
|
81
77
|
language,
|
|
82
78
|
className,
|
|
83
79
|
onCopy,
|
|
84
|
-
|
|
85
|
-
copyText,
|
|
80
|
+
buttonText,
|
|
86
81
|
as = 'a',
|
|
87
82
|
showCopyButton = true,
|
|
88
83
|
}: PropsWithChildren<CodeBoxProps>) => {
|
|
@@ -91,13 +86,7 @@ const BaseCodeBox: FC<PropsWithChildren<CodeBoxProps>> = ({
|
|
|
91
86
|
const handleCopy = (): void => {
|
|
92
87
|
const text = containerRef.current?.textContent;
|
|
93
88
|
if (text) {
|
|
94
|
-
onCopy(
|
|
95
|
-
text,
|
|
96
|
-
<div className={styles.notification}>
|
|
97
|
-
<CodeBracketIcon className={styles.icon} />
|
|
98
|
-
{copiedText}
|
|
99
|
-
</div>
|
|
100
|
-
);
|
|
89
|
+
onCopy(text);
|
|
101
90
|
}
|
|
102
91
|
};
|
|
103
92
|
|
|
@@ -121,7 +110,7 @@ const BaseCodeBox: FC<PropsWithChildren<CodeBoxProps>> = ({
|
|
|
121
110
|
onClick={handleCopy}
|
|
122
111
|
>
|
|
123
112
|
<DocumentDuplicateIcon className={styles.icon} />
|
|
124
|
-
{
|
|
113
|
+
{buttonText}
|
|
125
114
|
</BaseButton>
|
|
126
115
|
)}
|
|
127
116
|
</div>
|
package/package.json
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@radix-ui/react-label": "~2.1.2",
|
|
27
27
|
"@radix-ui/react-select": "~2.2.2",
|
|
28
28
|
"@radix-ui/react-separator": "~1.1.3",
|
|
29
|
-
"@radix-ui/react-tabs": "~1.1.
|
|
29
|
+
"@radix-ui/react-tabs": "~1.1.9",
|
|
30
30
|
"@radix-ui/react-toast": "~1.2.6",
|
|
31
31
|
"@radix-ui/react-tooltip": "~1.2.4",
|
|
32
32
|
"@tailwindcss/postcss": "~4.1.5",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"engines": {
|
|
77
77
|
"node": ">=20"
|
|
78
78
|
},
|
|
79
|
-
"version": "1.0.1-
|
|
79
|
+
"version": "1.0.1-e9ec33a60f54512653a136fe677cd7e04d47c7dc",
|
|
80
80
|
"scripts": {
|
|
81
81
|
"check-types": "tsc --noEmit",
|
|
82
82
|
"lint": "turbo run lint:js lint:css",
|