@0xchain/copy-button 0.0.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/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # @0xchain/copy-button
2
+
3
+ This library was generated with [Nx](https://nx.dev).
4
+
5
+ ## Running unit tests
6
+
7
+ Run `nx test @0xchain/copy-button` to execute the unit tests via [Vitest](https://vitest.dev/).
@@ -0,0 +1,7 @@
1
+ interface CopyButtonProps extends React.HTMLAttributes<HTMLSpanElement> {
2
+ content: string;
3
+ iconClassName?: string;
4
+ }
5
+ declare const CopyButton: ({ content, className, iconClassName }: CopyButtonProps) => import("react/jsx-runtime").JSX.Element;
6
+ export default CopyButton;
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAIA,UAAU,eAAgB,SAAQ,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC;IACnE,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B;AACD,QAAA,MAAM,UAAU,GAAI,uCAAyD,eAAe,4CAqB3F,CAAC;AAEF,eAAe,UAAU,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,20 @@
1
+ 'use client';
2
+ import { jsx as e } from "react/jsx-runtime";
3
+ import { useState as n } from "react";
4
+ import { Check as l, Copy as p } from "lucide-react";
5
+ import { twMerge as m } from "tailwind-merge";
6
+ const d = ({ content: r, className: s, iconClassName: t = "text-subtitle" }) => {
7
+ const [a, o] = n(!1), i = async () => {
8
+ try {
9
+ await navigator.clipboard.writeText(r), o(!0), setTimeout(() => {
10
+ o(!1);
11
+ }, 1e3);
12
+ } catch (c) {
13
+ console.error("复制失败:", c);
14
+ }
15
+ };
16
+ return /* @__PURE__ */ e("span", { className: m("inline-block w-4 cursor-pointer", s), onClick: i, children: a ? /* @__PURE__ */ e(l, { size: 16, className: t }) : /* @__PURE__ */ e(p, { size: 16, className: t }) });
17
+ };
18
+ export {
19
+ d as default
20
+ };
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@0xchain/copy-button",
3
+ "version": "0.0.1",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ "./package.json": "./package.json",
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "default": "./dist/index.js"
14
+ }
15
+ },
16
+ "devDependencies": {
17
+ "rollup-plugin-preserve-use-client": "3.0.1"
18
+ },
19
+ "files": [
20
+ "dist",
21
+ "!**/*.tsbuildinfo"
22
+ ],
23
+ "dependencies": {
24
+ "lucide-react": "0.539.0",
25
+ "tailwind-merge": "3.3.1"
26
+ },
27
+ "publishConfig": {
28
+ "access": "public"
29
+ }
30
+ }