UNPKG

@wordpress/block-editor

Version:
55 lines (52 loc) 2.02 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = BlockDraggableChip; var _i18n = require("@wordpress/i18n"); var _components = require("@wordpress/components"); var _icons = require("@wordpress/icons"); var _blockIcon = _interopRequireDefault(require("../block-icon")); var _jsxRuntime = require("react/jsx-runtime"); /** * WordPress dependencies */ /** * Internal dependencies */ function BlockDraggableChip({ count, icon, isPattern, fadeWhenDisabled }) { const patternLabel = isPattern && (0, _i18n.__)('Pattern'); return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", { className: "block-editor-block-draggable-chip-wrapper", children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", { className: "block-editor-block-draggable-chip", "data-testid": "block-draggable-chip", children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Flex, { justify: "center", className: "block-editor-block-draggable-chip__content", children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.FlexItem, { children: icon ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockIcon.default, { icon: icon }) : patternLabel || (0, _i18n.sprintf)(/* translators: %d: Number of blocks. */ (0, _i18n._n)('%d block', '%d blocks', count), count) }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.FlexItem, { children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockIcon.default, { icon: _icons.dragHandle }) }), fadeWhenDisabled && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.FlexItem, { className: "block-editor-block-draggable-chip__disabled", children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", { className: "block-editor-block-draggable-chip__disabled-icon" }) })] }) }) }); } //# sourceMappingURL=draggable-chip.js.map