UNPKG

@wordpress/block-editor

Version:
72 lines (69 loc) 1.98 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _data = require("@wordpress/data"); var _compose = require("@wordpress/compose"); var _components = require("@wordpress/components"); var _store = require("../../store"); var _cover = _interopRequireDefault(require("./cover")); var _jsxRuntime = require("react/jsx-runtime"); /** * 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 /*#__PURE__*/(0, _jsxRuntime.jsx)(_cover.default, { clientId: clientId, __unstablePopoverSlot: __unstablePopoverSlot, __unstableContentRef: __unstableContentRef, className: "block-editor-block-popover__drop-zone", children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_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 = exports.default = BlockDropZonePopover; //# sourceMappingURL=drop-zone.js.map