@obolnetwork/obol-ui 1.0.25 → 1.0.26

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
@@ -1386,23 +1386,28 @@ var Content$2 = styled(TooltipContent, {
1386
1386
  fill: "$bg05",
1387
1387
  },
1388
1388
  });
1389
- var TextFieldWithCopy = forwardRef(function (props, ref) {
1390
- var _a = useState(""), inputValue = _a[0], setInputValue = _a[1];
1391
- var _b = useState(false), isCopied = _b[0], setIsCopied = _b[1];
1389
+ var TextFieldWithCopy = forwardRef(function (_a, ref) {
1390
+ var value = _a.value, onChange = _a.onChange, props = __rest(_a, ["value", "onChange"]);
1391
+ var _b = useState(value || ""), inputValue = _b[0], setInputValue = _b[1];
1392
+ var _c = useState(false), isCopied = _c[0], setIsCopied = _c[1];
1392
1393
  var innerRef = useRef(null);
1393
1394
  useImperativeHandle(ref, function () { return innerRef.current; });
1394
1395
  var copyToClipBoard = function (content) {
1395
1396
  if (content) {
1396
- navigator.clipboard.writeText(content);
1397
+ navigator.clipboard.writeText(content.toString());
1397
1398
  setIsCopied(true);
1398
1399
  }
1399
1400
  };
1400
1401
  useTimeout(function () {
1401
1402
  setIsCopied(false);
1402
1403
  }, isCopied ? 3000 : null);
1403
- return (jsxs(Box, __assign({ css: { display: "flex", width: "$full" } }, { children: [jsx(TextField, __assign({ withCopy: true, ref: innerRef, 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 () {
1404
- return copyToClipBoard(inputValue);
1405
- } }, { children: !isCopied ? jsx(CopyIcon, {}) : jsx(CheckIcon, {}) })) })), jsxs(Content$2, __assign({ side: "bottom", sideOffset: 5 }, { children: ["Copied!", jsx(TooltipArrow, {})] }))] }))] })));
1404
+ var handleOnChange = function (e) {
1405
+ setInputValue(e.target.value);
1406
+ if (onChange) {
1407
+ onChange(e);
1408
+ }
1409
+ };
1410
+ return (jsxs(Box, __assign({ css: { display: "flex", width: "$full" } }, { children: [jsx(TextField, __assign({}, props, { withCopy: true, ref: innerRef, value: inputValue, onChange: handleOnChange, 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, {})] }))] }))] })));
1406
1411
  });
1407
1412
  TextFieldWithCopy.displayName = "TextFieldWithCopy";
1408
1413
 
package/dist/index.js CHANGED
@@ -1418,23 +1418,28 @@ var Content$2 = styled(TooltipContent, {
1418
1418
  fill: "$bg05",
1419
1419
  },
1420
1420
  });
1421
- var TextFieldWithCopy = React.forwardRef(function (props, ref) {
1422
- var _a = React.useState(""), inputValue = _a[0], setInputValue = _a[1];
1423
- var _b = React.useState(false), isCopied = _b[0], setIsCopied = _b[1];
1421
+ var TextFieldWithCopy = React.forwardRef(function (_a, ref) {
1422
+ var value = _a.value, onChange = _a.onChange, props = __rest(_a, ["value", "onChange"]);
1423
+ var _b = React.useState(value || ""), inputValue = _b[0], setInputValue = _b[1];
1424
+ var _c = React.useState(false), isCopied = _c[0], setIsCopied = _c[1];
1424
1425
  var innerRef = React.useRef(null);
1425
1426
  React.useImperativeHandle(ref, function () { return innerRef.current; });
1426
1427
  var copyToClipBoard = function (content) {
1427
1428
  if (content) {
1428
- navigator.clipboard.writeText(content);
1429
+ navigator.clipboard.writeText(content.toString());
1429
1430
  setIsCopied(true);
1430
1431
  }
1431
1432
  };
1432
1433
  useTimeout(function () {
1433
1434
  setIsCopied(false);
1434
1435
  }, isCopied ? 3000 : null);
1435
- return (jsxRuntime.jsxs(Box, __assign({ css: { display: "flex", width: "$full" } }, { children: [jsxRuntime.jsx(TextField, __assign({ withCopy: true, ref: innerRef, 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 () {
1436
- return copyToClipBoard(inputValue);
1437
- } }, { children: !isCopied ? jsxRuntime.jsx(CopyIcon, {}) : jsxRuntime.jsx(CheckIcon, {}) })) })), jsxRuntime.jsxs(Content$2, __assign({ side: "bottom", sideOffset: 5 }, { children: ["Copied!", jsxRuntime.jsx(TooltipArrow, {})] }))] }))] })));
1436
+ var handleOnChange = function (e) {
1437
+ setInputValue(e.target.value);
1438
+ if (onChange) {
1439
+ onChange(e);
1440
+ }
1441
+ };
1442
+ return (jsxRuntime.jsxs(Box, __assign({ css: { display: "flex", width: "$full" } }, { children: [jsxRuntime.jsx(TextField, __assign({}, props, { withCopy: true, ref: innerRef, value: inputValue, onChange: handleOnChange, 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, {})] }))] }))] })));
1438
1443
  });
1439
1444
  TextFieldWithCopy.displayName = "TextFieldWithCopy";
1440
1445
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obolnetwork/obol-ui",
3
- "version": "1.0.25",
3
+ "version": "1.0.26",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.es.js",
6
6
  "license": "MIT",