@0xchain/copy-button 1.0.0 → 1.1.0-beta.2
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/index.d.ts.map +1 -1
- package/dist/index.js +7 -7
- package/package.json +1 -1
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +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,
|
|
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,uCAAiE,eAAe,4CAqBnG,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as e } from "react/jsx-runtime";
|
|
3
3
|
import { useState as n } from "react";
|
|
4
|
-
import { Check as
|
|
4
|
+
import { Check as p, Copy as l } from "lucide-react";
|
|
5
5
|
import { twMerge as m } from "tailwind-merge";
|
|
6
|
-
const
|
|
7
|
-
const [a,
|
|
6
|
+
const C = ({ content: r, className: s, iconClassName: o = "text-muted-foreground" }) => {
|
|
7
|
+
const [a, t] = n(!1), i = async () => {
|
|
8
8
|
try {
|
|
9
|
-
await navigator.clipboard.writeText(r),
|
|
10
|
-
|
|
9
|
+
await navigator.clipboard.writeText(r), t(!0), setTimeout(() => {
|
|
10
|
+
t(!1);
|
|
11
11
|
}, 1e3);
|
|
12
12
|
} catch (c) {
|
|
13
13
|
console.error("复制失败:", c);
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
|
-
return /* @__PURE__ */ e("span", { className: m("inline-block w-4 cursor-pointer", s), onClick: i, children: a ? /* @__PURE__ */ e(
|
|
16
|
+
return /* @__PURE__ */ e("span", { className: m("inline-block w-4 cursor-pointer", s), onClick: i, children: a ? /* @__PURE__ */ e(p, { size: 16, className: o }) : /* @__PURE__ */ e(l, { size: 16, className: o }) });
|
|
17
17
|
};
|
|
18
18
|
export {
|
|
19
|
-
|
|
19
|
+
C as default
|
|
20
20
|
};
|