react-markdown-table-ts 1.1.7 → 1.1.8

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/README.md CHANGED
@@ -23,10 +23,11 @@ interface MarkdownTableProps {
23
23
  hasTabs?: boolean;
24
24
  hasHeader?: boolean;
25
25
  convertLineBreaks?: boolean;
26
+ topPadding?: number;
26
27
  theme?: 'light' | 'dark';
27
28
  className?: string;
28
29
  preStyle?: React.CSSProperties;
29
- topPadding?: number;
30
+ minWidth?: number;
30
31
  onGenerate?: (markdownTableString: string) => void;
31
32
  }
32
33
  ```
@@ -39,10 +40,11 @@ interface MarkdownTableProps {
39
40
  | `hasTabs` | `boolean` | `false` | Adds a tab character after each \| and before the content. |
40
41
  | `hasHeader` | `boolean` | `true` | Indicates whether the first row of `data` is a header. |
41
42
  | `convertLineBreaks` | `boolean` | `false` | Replace newlines with <br> tags in table cells. |
43
+ | `topPadding` | `number` | `16` | Controls the padding-top (in pixels) of the \<pre\> element display. |
42
44
  | `theme` | `'light' \| 'dark'` | `light` | Controls the color scheme of the \<pre\> element display. |
43
45
  | `className` | `string` | `undefined` | Class will be applied to the \<pre\> element display. |
44
46
  | `preStyle` | `React.CSSProperties` | `undefined` | Allows direct styling of the display with CSS properties. |
45
- | `topPadding` | `number` | `16` | Controls the padding-top (in pixels) of the \<pre\> element display. |
47
+ | `minWidth` | `number` | `undefined` | Optional minimum width in pixels for the table container. |
46
48
  | `onGenerate` | `(markdownTableString: string) => void` | `undefined` | Callback to receive the generated Markdown table string. |
47
49
  ## Usage Patterns
48
50
 
@@ -69,6 +71,13 @@ interface MarkdownTableProps {
69
71
  hasHeader={false} // Will generate A, B, C... headers
70
72
  />
71
73
  ```
74
+ 4. **Setting Minimum Width**:
75
+ ```typescript
76
+ <MarkdownTable
77
+ inputData={data}
78
+ minWidth={500} // Sets the minimum width of the table container to 500 pixels
79
+ />
80
+ ```
72
81
 
73
82
  ## Behaviors
74
83
 
package/dist/index.cjs.js CHANGED
@@ -4267,7 +4267,7 @@ var applySyntaxHighlighting = function (preElementRef, markdownTableSyntax) {
4267
4267
  }, [markdownTableSyntax]);
4268
4268
  };
4269
4269
  var MarkdownTable = function (_a) {
4270
- 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.convertLineBreaks, convertLineBreaks = _h === void 0 ? false : _h, className = _a.className, onGenerate = _a.onGenerate, _j = _a.theme, theme = _j === void 0 ? 'light' : _j, preStyle = _a.preStyle, _k = _a.topPadding, topPadding = _k === void 0 ? 16 : _k;
4270
+ 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.convertLineBreaks, convertLineBreaks = _h === void 0 ? false : _h, className = _a.className, onGenerate = _a.onGenerate, _j = _a.theme, theme = _j === void 0 ? 'light' : _j, preStyle = _a.preStyle; _a.topPadding; var minWidth = _a.minWidth;
4271
4271
  var adjustColumnWidths = !isCompact;
4272
4272
  var preElementRef = require$$0.useRef(null);
4273
4273
  var markdownTableSyntax = require$$0.useMemo(function () { return generateTableSyntax(inputData, hasHeader, columnAlignments, adjustColumnWidths, hasTabs, convertLineBreaks, hasPadding); }, [
@@ -4285,11 +4285,11 @@ var MarkdownTable = function (_a) {
4285
4285
  }
4286
4286
  }, [markdownTableSyntax, onGenerate]);
4287
4287
  applySyntaxHighlighting(preElementRef, markdownTableSyntax);
4288
- return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsxs("style", { children: [theme === 'light' ? LIGHT_THEME_CSS : DARK_THEME_CSS, "\n pre {\n position: relative;\n padding-top: ".concat(topPadding, "px !important;\n }\n pre::before {\n position: absolute;\n top: 8px;\n left: 12px;\n color: ").concat(theme === 'light' ? '#666' : '#999', ";\n letter-spacing: 2px;\n font-size: 12px;\n }\n ")] }), jsxRuntimeExports.jsx("div", { id: "MarkdownTable", style: {
4288
+ return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsxs("style", { children: [theme === 'light' ? LIGHT_THEME_CSS : DARK_THEME_CSS, "\n pre {\n position: relative;\n }\n pre::before {\n position: absolute;\n top: 8px;\n left: 12px;\n color: ".concat(theme === 'light' ? '#666' : '#999', ";\n letter-spacing: 2px;\n font-size: 12px;\n }\n ")] }), jsxRuntimeExports.jsx("div", { id: "MarkdownTable", style: {
4289
4289
  position: 'relative',
4290
4290
  isolation: 'isolate',
4291
4291
  display: 'inline-block'
4292
- }, children: jsxRuntimeExports.jsx("pre", { ref: preElementRef, className: "".concat(className, " language-markdown line-numbers ").concat(theme === 'dark' ? 'dark-theme' : ''), style: __assign({ width: 'fit-content', minWidth: 'min-content', margin: 0 }, preStyle), children: jsxRuntimeExports.jsx("code", { className: "language-markdown", role: "code", children: markdownTableSyntax }) }) })] }));
4292
+ }, children: jsxRuntimeExports.jsx("pre", { ref: preElementRef, className: "".concat(className, " language-markdown line-numbers ").concat(theme === 'dark' ? 'dark-theme' : ''), style: __assign({ width: 'fit-content', minWidth: minWidth ? "".concat(minWidth, "px") : 'min-content', margin: 0 }, preStyle), children: jsxRuntimeExports.jsx("code", { className: "language-markdown", role: "code", children: markdownTableSyntax }) }) })] }));
4293
4293
  };
4294
4294
 
4295
4295
  exports.MarkdownTable = MarkdownTable;