@anoki/fse-ui
Version:
FSE UI components library
26 lines (25 loc) • 642 B
JavaScript
import { useState as a, useCallback as l } from "react";
import "./index.es535.js";
function c() {
const [t, o] = a(null), e = l(async (r) => {
if (!(navigator != null && navigator.clipboard))
return console.warn("Clipboard not supported"), !1;
try {
return await navigator.clipboard.writeText(r), o(r), !0;
} catch (n) {
return console.warn("Copy failed", n), o(null), !1;
}
}, []);
return [t, e];
}
function s(t) {
const [o, e] = a(!!t), r = l(() => {
e((n) => !n);
}, []);
return [o, r, e];
}
export {
c as useCopyToClipboard,
s as useToggle
};
//# sourceMappingURL=index.es331.js.map