UNPKG

@wordpress/block-editor

Version:
54 lines (53 loc) 1.74 kB
// packages/block-editor/src/components/block-popover/drop-zone.js import { useSelect } from "@wordpress/data"; import { useReducedMotion } from "@wordpress/compose"; import { __unstableMotion as motion } from "@wordpress/components"; import { store as blockEditorStore } from "../../store"; import BlockPopoverCover from "./cover"; import { jsx } from "react/jsx-runtime"; var animateVariants = { hide: { opacity: 0, scaleY: 0.75 }, show: { opacity: 1, scaleY: 1 }, exit: { opacity: 0, scaleY: 0.9 } }; function BlockDropZonePopover({ __unstablePopoverSlot, __unstableContentRef }) { const { clientId } = useSelect((select) => { const { getBlockOrder, getBlockInsertionPoint } = select(blockEditorStore); const insertionPoint = getBlockInsertionPoint(); const order = getBlockOrder(insertionPoint.rootClientId); if (!order.length) { return {}; } return { clientId: order[insertionPoint.index] }; }, []); const reducedMotion = useReducedMotion(); return /* @__PURE__ */ jsx( BlockPopoverCover, { clientId, __unstablePopoverSlot, __unstableContentRef, className: "block-editor-block-popover__drop-zone", children: /* @__PURE__ */ jsx( motion.div, { "data-testid": "block-popover-drop-zone", initial: reducedMotion ? animateVariants.show : animateVariants.hide, animate: animateVariants.show, exit: reducedMotion ? animateVariants.show : animateVariants.exit, className: "block-editor-block-popover__drop-zone-foreground" } ) } ); } var drop_zone_default = BlockDropZonePopover; export { drop_zone_default as default }; //# sourceMappingURL=drop-zone.js.map