@ichaingo/copy-button 1.2.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 +7 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/package.json +23 -0
package/README.md
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAIA,QAAA,MAAM,UAAU,GAAI,aAAa;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,4CAqBnD,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useState as a } from "react";
|
|
3
|
+
import { Check as c, Copy as i } from "lucide-react";
|
|
4
|
+
const y = ({ content: o }) => {
|
|
5
|
+
const [r, t] = a(!1);
|
|
6
|
+
return /* @__PURE__ */ e("span", { className: "inline-block w-4 cursor-pointer", onClick: async () => {
|
|
7
|
+
try {
|
|
8
|
+
await navigator.clipboard.writeText(o), t(!0), setTimeout(() => {
|
|
9
|
+
t(!1);
|
|
10
|
+
}, 1e3);
|
|
11
|
+
} catch (s) {
|
|
12
|
+
console.error("复制失败:", s);
|
|
13
|
+
}
|
|
14
|
+
}, children: r ? /* @__PURE__ */ e(c, { size: 16, className: "text-gray-400" }) : /* @__PURE__ */ e(i, { size: 16, className: "text-gray-400" }) });
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
y as default
|
|
18
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ichaingo/copy-button",
|
|
3
|
+
"version": "1.2.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
|
+
"peerDependencies": {
|
|
17
|
+
"lucide-react": "^0.490.0"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist",
|
|
21
|
+
"!**/*.tsbuildinfo"
|
|
22
|
+
]
|
|
23
|
+
}
|