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 +4 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +5 -2
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
-
import React__default, { forwardRef, useContext, Children, isValidElement, cloneElement, useRef, useMemo, useEffect } from 'react';
|
2
|
+
import React__default, { forwardRef, useContext, Children, isValidElement, cloneElement, useRef, useState, useMemo, useEffect } from 'react';
|
3
3
|
import * as ReactDOM from 'react-dom';
|
4
4
|
import ReactDOM__default from 'react-dom';
|
5
5
|
|
@@ -18542,6 +18542,7 @@ var MarkdownTable = function (_a) {
|
|
18542
18542
|
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;
|
18543
18543
|
var adjustColumnWidths = !isCompact;
|
18544
18544
|
var preElementRef = useRef(null);
|
18545
|
+
var _k = useState(false), isCopied = _k[0], setIsCopied = _k[1];
|
18545
18546
|
var markdownTableSyntax = useMemo(function () {
|
18546
18547
|
if (inputData === null) {
|
18547
18548
|
return 'Error: No data provided for the table.';
|
@@ -18594,11 +18595,13 @@ var MarkdownTable = function (_a) {
|
|
18594
18595
|
}, [markdownTableSyntax]);
|
18595
18596
|
var handleCopy = function () {
|
18596
18597
|
navigator.clipboard.writeText(markdownTableSyntax);
|
18598
|
+
setIsCopied(true);
|
18599
|
+
setTimeout(function () { return setIsCopied(false); }, 2000);
|
18597
18600
|
};
|
18598
18601
|
return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("style", { children: theme === 'light' ? LIGHT_THEME_CSS : DARK_THEME_CSS }), jsxRuntimeExports.jsxs("div", { style: {
|
18599
18602
|
position: 'relative',
|
18600
18603
|
isolation: 'isolate'
|
18601
|
-
}, children: [jsxRuntimeExports.jsx(Tooltip$1, { title:
|
18604
|
+
}, 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: {
|
18602
18605
|
position: 'absolute',
|
18603
18606
|
top: '12px',
|
18604
18607
|
right: '8px',
|