UNPKG

@wordpress/block-library

Version:
52 lines (51 loc) • 1.59 kB
import clsx from "clsx"; import { useState } from "@wordpress/element"; import { privateApis } from "@wordpress/block-editor"; import { unlock } from "../../lock-unlock.mjs"; import { jsx } from "react/jsx-runtime"; // packages/block-library/src/cover/edit/resizable-cover-popover.jsx const RESIZABLE_BOX_ENABLE_OPTION = { top: false, right: false, bottom: true, left: false, topRight: false, bottomRight: false, bottomLeft: false, topLeft: false }; const { ResizableBoxPopover } = unlock(privateApis); function ResizableCoverPopover({ className, height, minHeight, onResize, onResizeStart, onResizeStop, showHandle, size, width, ...props }) { const [isResizing, setIsResizing] = useState(false); const resizableBoxProps = { className: clsx(className, { "is-resizing": isResizing }), enable: RESIZABLE_BOX_ENABLE_OPTION, onResizeStart: (_event, _direction, elt) => { onResizeStart(elt.clientHeight); onResize(elt.clientHeight); }, onResize: (_event, _direction, elt) => { onResize(elt.clientHeight); if (!isResizing) setIsResizing(true); }, onResizeStop: (_event, _direction, elt) => { onResizeStop(elt.clientHeight); setIsResizing(false); }, showHandle, size, __experimentalShowTooltip: true, __experimentalTooltipProps: { axis: "y", position: "bottom", isVisible: isResizing } }; return /* @__PURE__ */ jsx(ResizableBoxPopover, { className: "block-library-cover__resizable-box-popover", resizableBoxProps, ...props }); } export { ResizableCoverPopover as default }; //# sourceMappingURL=resizable-cover-popover.mjs.map