@wordpress/block-editor
Version:
48 lines (47 loc) • 1.27 kB
JavaScript
// packages/block-editor/src/components/list-view/leaf.js
import { animated } from "@react-spring/web";
import clsx from "clsx";
import { __experimentalTreeGridRow as TreeGridRow } from "@wordpress/components";
import { useMergeRefs } from "@wordpress/compose";
import { forwardRef } from "@wordpress/element";
import useMovingAnimation from "../use-moving-animation";
import { jsx } from "react/jsx-runtime";
var AnimatedTreeGridRow = animated(TreeGridRow);
var ListViewLeaf = forwardRef(
({
isDragged,
isSelected,
position,
level,
rowCount,
children,
className,
path,
...props
}, ref) => {
const animationRef = useMovingAnimation({
clientId: props["data-block"],
enableAnimation: true,
triggerAnimationOnChange: path
});
const mergedRef = useMergeRefs([ref, animationRef]);
return /* @__PURE__ */ jsx(
AnimatedTreeGridRow,
{
ref: mergedRef,
className: clsx("block-editor-list-view-leaf", className),
level,
positionInSet: position,
setSize: rowCount,
isExpanded: void 0,
...props,
children
}
);
}
);
var leaf_default = ListViewLeaf;
export {
leaf_default as default
};
//# sourceMappingURL=leaf.js.map