@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 +12 -7
- package/dist/index.js +12 -7
- package/package.json +1 -1
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 (
|
|
1390
|
-
var
|
|
1391
|
-
var _b = useState(
|
|
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
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
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 (
|
|
1422
|
-
var
|
|
1423
|
-
var _b = React.useState(
|
|
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
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
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
|
|