UNPKG

json-joy

Version:

Collection of libraries for building collaborative editing apps.

19 lines 977 B
import * as React from 'react'; // import {ExpandableToolbar, type ExpandableToolbarProps} from 'nice-ui/lib/4-card/Toolbar/ToolbarMenu/ExpandableToolbar'; import { ExpandableToolbar } from './ExpandableToolbar'; export const AutoExpandableToolbar = ({ menu, disabled, onPopupClose, ...rest }) => { const expandPoint = React.useRef({ x: 32, y: 32, dx: 1, dy: 1 }); return (React.createElement("div", { ref: (el) => { if (!el) return; const rect = el.getBoundingClientRect(); if (!rect) return; expandPoint.current.dx = 1; expandPoint.current.dy = 1; expandPoint.current.x = rect.x - 100; expandPoint.current.y = rect.y - 48; } }, React.createElement(ExpandableToolbar, { ...rest, menu: menu, expandPoint: () => expandPoint.current, disabled: disabled, onPopupClose: onPopupClose }))); }; //# sourceMappingURL=AutoExpandableToolbar.js.map