UNPKG

@wordpress/block-editor

Version:
84 lines (70 loc) 1.99 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _element = require("@wordpress/element"); var _data = require("@wordpress/data"); var _compose = require("@wordpress/compose"); var _components = require("@wordpress/components"); var _store = require("../../store"); var _index = _interopRequireDefault(require("./index")); /** * WordPress dependencies */ /** * Internal dependencies */ const animateVariants = { hide: { opacity: 0, scaleY: 0.75 }, show: { opacity: 1, scaleY: 1 }, exit: { opacity: 0, scaleY: 0.9 } }; function BlockDropZonePopover({ __unstablePopoverSlot, __unstableContentRef }) { const { clientId } = (0, _data.useSelect)(select => { const { getBlockOrder, getBlockInsertionPoint } = select(_store.store); const insertionPoint = getBlockInsertionPoint(); const order = getBlockOrder(insertionPoint.rootClientId); if (!order.length) { return {}; } return { clientId: order[insertionPoint.index] }; }, []); const reducedMotion = (0, _compose.useReducedMotion)(); return (0, _element.createElement)(_index.default, { clientId: clientId, __unstableCoverTarget: true, __unstablePopoverSlot: __unstablePopoverSlot, __unstableContentRef: __unstableContentRef, className: "block-editor-block-popover__drop-zone" }, (0, _element.createElement)(_components.__unstableMotion.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 _default = BlockDropZonePopover; exports.default = _default; //# sourceMappingURL=drop-zone.js.map