@obolnetwork/obol-ui 1.0.22 → 1.0.23

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.es.js CHANGED
@@ -1358,9 +1358,10 @@ var Content$2 = styled(TooltipContent, {
1358
1358
  fill: "$bg05",
1359
1359
  },
1360
1360
  });
1361
- var TextFieldWithCopy = forwardRef(function (props, ref) {
1361
+ var TextFieldWithCopy = forwardRef(function (props) {
1362
1362
  var _a = useState(), inputValue = _a[0], setInputValue = _a[1];
1363
1363
  var _b = useState(false), isCopied = _b[0], setIsCopied = _b[1];
1364
+ var ref = useRef(null);
1364
1365
  var copyToClipBoard = function (content) {
1365
1366
  if (content) {
1366
1367
  navigator.clipboard.writeText(content);
@@ -1370,7 +1371,9 @@ var TextFieldWithCopy = forwardRef(function (props, ref) {
1370
1371
  useTimeout(function () {
1371
1372
  setIsCopied(false);
1372
1373
  }, isCopied ? 3000 : null);
1373
- return (jsxs(Box, __assign({ css: { display: "flex", width: "$full" } }, { children: [jsx(TextField, __assign({ withCopy: true, ref: ref, value: inputValue, onChange: function (e) { return setInputValue(e.target.value); } }, props, { css: { width: "$full" } })), jsxs(Tooltip, __assign({ open: isCopied }, { children: [jsx(TooltipTrigger, __assign({ asChild: true }, { children: jsx(IconButton, __assign({ onClick: function () { return copyToClipBoard(inputValue); } }, { children: !isCopied ? jsx(CopyIcon, {}) : jsx(CheckIcon, {}) })) })), jsxs(Content$2, __assign({ side: "bottom", sideOffset: 5 }, { children: ["Copied!", jsx(TooltipArrow, {})] }))] }))] })));
1374
+ return (jsxs(Box, __assign({ css: { display: "flex", width: "$full" } }, { children: [jsx(TextField, __assign({ withCopy: true, ref: ref, value: inputValue, onChange: function (e) { return setInputValue(e.target.value); } }, props, { css: { width: "$full" } })), jsxs(Tooltip, __assign({ open: isCopied }, { children: [jsx(TooltipTrigger, __assign({ asChild: true }, { children: jsx(IconButton, __assign({ onClick: function () {
1375
+ return copyToClipBoard(ref && ref.current && ref.current.value);
1376
+ } }, { children: !isCopied ? jsx(CopyIcon, {}) : jsx(CheckIcon, {}) })) })), jsxs(Content$2, __assign({ side: "bottom", sideOffset: 5 }, { children: ["Copied!", jsx(TooltipArrow, {})] }))] }))] })));
1374
1377
  });
1375
1378
  TextFieldWithCopy.displayName = "TextFieldWithCopy";
1376
1379
 
package/dist/index.js CHANGED
@@ -1389,9 +1389,10 @@ var Content$2 = styled(TooltipContent, {
1389
1389
  fill: "$bg05",
1390
1390
  },
1391
1391
  });
1392
- var TextFieldWithCopy = React.forwardRef(function (props, ref) {
1392
+ var TextFieldWithCopy = React.forwardRef(function (props) {
1393
1393
  var _a = React.useState(), inputValue = _a[0], setInputValue = _a[1];
1394
1394
  var _b = React.useState(false), isCopied = _b[0], setIsCopied = _b[1];
1395
+ var ref = React.useRef(null);
1395
1396
  var copyToClipBoard = function (content) {
1396
1397
  if (content) {
1397
1398
  navigator.clipboard.writeText(content);
@@ -1401,7 +1402,9 @@ var TextFieldWithCopy = React.forwardRef(function (props, ref) {
1401
1402
  useTimeout(function () {
1402
1403
  setIsCopied(false);
1403
1404
  }, isCopied ? 3000 : null);
1404
- return (jsxRuntime.jsxs(Box, __assign({ css: { display: "flex", width: "$full" } }, { children: [jsxRuntime.jsx(TextField, __assign({ withCopy: true, ref: ref, value: inputValue, onChange: function (e) { return setInputValue(e.target.value); } }, props, { css: { width: "$full" } })), jsxRuntime.jsxs(Tooltip, __assign({ open: isCopied }, { children: [jsxRuntime.jsx(TooltipTrigger, __assign({ asChild: true }, { children: jsxRuntime.jsx(IconButton, __assign({ onClick: function () { return copyToClipBoard(inputValue); } }, { children: !isCopied ? jsxRuntime.jsx(CopyIcon, {}) : jsxRuntime.jsx(CheckIcon, {}) })) })), jsxRuntime.jsxs(Content$2, __assign({ side: "bottom", sideOffset: 5 }, { children: ["Copied!", jsxRuntime.jsx(TooltipArrow, {})] }))] }))] })));
1405
+ return (jsxRuntime.jsxs(Box, __assign({ css: { display: "flex", width: "$full" } }, { children: [jsxRuntime.jsx(TextField, __assign({ withCopy: true, ref: ref, value: inputValue, onChange: function (e) { return setInputValue(e.target.value); } }, props, { css: { width: "$full" } })), jsxRuntime.jsxs(Tooltip, __assign({ open: isCopied }, { children: [jsxRuntime.jsx(TooltipTrigger, __assign({ asChild: true }, { children: jsxRuntime.jsx(IconButton, __assign({ onClick: function () {
1406
+ return copyToClipBoard(ref && ref.current && ref.current.value);
1407
+ } }, { children: !isCopied ? jsxRuntime.jsx(CopyIcon, {}) : jsxRuntime.jsx(CheckIcon, {}) })) })), jsxRuntime.jsxs(Content$2, __assign({ side: "bottom", sideOffset: 5 }, { children: ["Copied!", jsxRuntime.jsx(TooltipArrow, {})] }))] }))] })));
1405
1408
  });
1406
1409
  TextFieldWithCopy.displayName = "TextFieldWithCopy";
1407
1410
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obolnetwork/obol-ui",
3
- "version": "1.0.22",
3
+ "version": "1.0.23",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.es.js",
6
6
  "license": "MIT",