UNPKG

synapse-react-client

Version:

[![npm version](https://badge.fury.io/js/synapse-react-client.svg)](https://badge.fury.io/js/synapse-react-client) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettie

64 lines (63 loc) 1.65 kB
import { jsxs as d, Fragment as c, jsx as o } from "react/jsx-runtime"; import { Box as m, TextField as a, InputAdornment as f, IconButton as u } from "@mui/material"; import h from "@mui/icons-material/ContentCopy"; import { useState as x, createRef as y } from "react"; import { ToastMessage as C } from "../ToastMessage/ToastMessage.js"; import { copyStringToClipboard as T } from "../../utils/functions/StringUtils.js"; function k({ value: t, inputWidth: i }) { const [s, r] = x(!1), e = y(), n = (I, p) => (l) => { l.preventDefault(), T(p).then(() => { r(!0), setTimeout(() => { r(!1); }, 4e3); }); }; return /* @__PURE__ */ d(c, { children: [ /* @__PURE__ */ o( C, { text: "Successfully copied to clipboard", show: s, autohide: !0 } ), /* @__PURE__ */ o( m, { ref: e, sx: { display: "flex", justifyContent: "center", my: 2, mx: 0 }, children: /* @__PURE__ */ o( a, { sx: { width: i }, value: t, slotProps: { input: { endAdornment: /* @__PURE__ */ o(f, { position: "end", children: /* @__PURE__ */ o(u, { onClick: n(e, t), children: /* @__PURE__ */ o(h, {}) }) }) }, htmlInput: { readOnly: !0, onClick: n(e, t) } } } ) } ) ] }); } export { k as CopyToClipboardInput, k as default }; //# sourceMappingURL=CopyToClipboardInput.js.map