@revisium/schema-toolkit-ui 0.6.5 → 0.6.7

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 CHANGED
@@ -6681,11 +6681,25 @@ const FileRendererComponent = (0, mobx_react_lite.observer)(({ node }) => {
6681
6681
  });
6682
6682
  });
6683
6683
 
6684
+ //#endregion
6685
+ //#region src/hooks/useAutoResize.ts
6686
+ const MIN_HEIGHT = 120;
6687
+ function useAutoResize(value) {
6688
+ const ref = (0, react.useRef)(null);
6689
+ (0, react.useEffect)(() => {
6690
+ const el = ref.current;
6691
+ if (!el) return;
6692
+ el.style.height = "auto";
6693
+ el.style.height = `${Math.max(el.scrollHeight, MIN_HEIGHT)}px`;
6694
+ }, [value]);
6695
+ return ref;
6696
+ }
6697
+
6684
6698
  //#endregion
6685
6699
  //#region src/row-editor/ui/editors/MarkdownEditor.tsx
6686
6700
  const MarkdownEditor = ({ value, setValue, readonly, dataTestId }) => {
6687
6701
  const [internalValue, setInternalValue] = (0, react.useState)(value);
6688
- const textareaRef = (0, react.useRef)(null);
6702
+ const textareaRef = useAutoResize(internalValue);
6689
6703
  (0, react.useEffect)(() => {
6690
6704
  setInternalValue(value);
6691
6705
  }, [value]);
@@ -6710,6 +6724,7 @@ const MarkdownEditor = ({ value, setValue, readonly, dataTestId }) => {
6710
6724
  lineHeight: "1.5",
6711
6725
  minHeight: "120px",
6712
6726
  resize: "vertical",
6727
+ overflow: "hidden",
6713
6728
  borderColor: "gray.200",
6714
6729
  _focus: {
6715
6730
  borderColor: "blue.400",
@@ -14276,7 +14291,7 @@ const TableEditor = (0, mobx_react_lite.observer)(({ viewModel, useWindowScroll
14276
14291
  segments: breadcrumbs,
14277
14292
  highlightLast: false,
14278
14293
  onSegmentClick: callbacks.onBreadcrumbClick,
14279
- action: !isReadonly && callbacks.onCreateRow ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PlusButton, {
14294
+ action: callbacks.onCreateRow ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PlusButton, {
14280
14295
  tooltip: "New row",
14281
14296
  onClick: callbacks.onCreateRow,
14282
14297
  dataTestId: "create-row-button"