react-markdown-table-ts 0.5.3 → 0.5.5

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.cjs.js CHANGED
@@ -18569,6 +18569,7 @@ var MarkdownTable = function (_a) {
18569
18569
  var _b = _a.inputData, inputData = _b === void 0 ? null : _b, _c = _a.hasHeader, hasHeader = _c === void 0 ? true : _c, _d = _a.columnAlignments, columnAlignments = _d === void 0 ? [] : _d, _e = _a.isCompact, isCompact = _e === void 0 ? false : _e, _f = _a.hasTabs, hasTabs = _f === void 0 ? false : _f, _g = _a.hasPadding, hasPadding = _g === void 0 ? true : _g, _h = _a.canReplaceNewlines, canReplaceNewlines = _h === void 0 ? false : _h, className = _a.className, onTableCreate = _a.onTableCreate, _j = _a.theme, theme = _j === void 0 ? 'light' : _j, preStyle = _a.preStyle;
18570
18570
  var adjustColumnWidths = !isCompact;
18571
18571
  var preElementRef = React.useRef(null);
18572
+ var _k = React.useState(false), isCopied = _k[0], setIsCopied = _k[1];
18572
18573
  var markdownTableSyntax = React.useMemo(function () {
18573
18574
  if (inputData === null) {
18574
18575
  return 'Error: No data provided for the table.';
@@ -18621,11 +18622,13 @@ var MarkdownTable = function (_a) {
18621
18622
  }, [markdownTableSyntax]);
18622
18623
  var handleCopy = function () {
18623
18624
  navigator.clipboard.writeText(markdownTableSyntax);
18625
+ setIsCopied(true);
18626
+ setTimeout(function () { return setIsCopied(false); }, 2000);
18624
18627
  };
18625
18628
  return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("style", { children: theme === 'light' ? LIGHT_THEME_CSS : DARK_THEME_CSS }), jsxRuntimeExports.jsxs("div", { style: {
18626
18629
  position: 'relative',
18627
18630
  isolation: 'isolate'
18628
- }, children: [jsxRuntimeExports.jsx(Tooltip$1, { title: "Copy markdown table syntax", placement: "left-end", arrow: true, children: jsxRuntimeExports.jsx(IconButton$1, { onClick: handleCopy, sx: {
18631
+ }, children: [jsxRuntimeExports.jsx(Tooltip$1, { title: isCopied ? 'Copied!' : 'Copy markdown table syntax', placement: "left-end", arrow: true, children: jsxRuntimeExports.jsx(IconButton$1, { onClick: handleCopy, sx: {
18629
18632
  position: 'absolute',
18630
18633
  top: '12px',
18631
18634
  right: '8px',