summaryrefslogtreecommitdiffstats
path: root/wp-includes/js/dist/widgets.js
diff options
context:
space:
mode:
Diffstat (limited to 'wp-includes/js/dist/widgets.js')
-rw-r--r--wp-includes/js/dist/widgets.js616
1 files changed, 298 insertions, 318 deletions
diff --git a/wp-includes/js/dist/widgets.js b/wp-includes/js/dist/widgets.js
index 3224595..301ab51 100644
--- a/wp-includes/js/dist/widgets.js
+++ b/wp-includes/js/dist/widgets.js
@@ -1,97 +1,7 @@
/******/ (() => { // webpackBootstrap
-/******/ var __webpack_modules__ = ({
-
-/***/ 5755:
-/***/ ((module, exports) => {
-
-var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
- Copyright (c) 2018 Jed Watson.
- Licensed under the MIT License (MIT), see
- http://jedwatson.github.io/classnames
-*/
-/* global define */
-
-(function () {
- 'use strict';
-
- var hasOwn = {}.hasOwnProperty;
- var nativeCodeString = '[native code]';
-
- function classNames() {
- var classes = [];
-
- for (var i = 0; i < arguments.length; i++) {
- var arg = arguments[i];
- if (!arg) continue;
-
- var argType = typeof arg;
-
- if (argType === 'string' || argType === 'number') {
- classes.push(arg);
- } else if (Array.isArray(arg)) {
- if (arg.length) {
- var inner = classNames.apply(null, arg);
- if (inner) {
- classes.push(inner);
- }
- }
- } else if (argType === 'object') {
- if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
- classes.push(arg.toString());
- continue;
- }
-
- for (var key in arg) {
- if (hasOwn.call(arg, key) && arg[key]) {
- classes.push(key);
- }
- }
- }
- }
-
- return classes.join(' ');
- }
-
- if ( true && module.exports) {
- classNames.default = classNames;
- module.exports = classNames;
- } else if (true) {
- // register as 'classnames', consistent with npm package name
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
- return classNames;
- }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
- } else {}
-}());
-
-
-/***/ })
-
-/******/ });
-/************************************************************************/
-/******/ // The module cache
-/******/ var __webpack_module_cache__ = {};
-/******/
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-/******/ // Check if module is in cache
-/******/ var cachedModule = __webpack_module_cache__[moduleId];
-/******/ if (cachedModule !== undefined) {
-/******/ return cachedModule.exports;
-/******/ }
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = __webpack_module_cache__[moduleId] = {
-/******/ // no module.id needed
-/******/ // no module.loaded needed
-/******/ exports: {}
-/******/ };
-/******/
-/******/ // Execute the module function
-/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
-/******/
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
+/******/ "use strict";
+/******/ // The require scope
+/******/ var __webpack_require__ = {};
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
@@ -136,9 +46,6 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
/******/
/************************************************************************/
var __webpack_exports__ = {};
-// This entry need to be wrapped in an IIFE because it need to be in strict mode.
-(() => {
-"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
@@ -172,43 +79,44 @@ __webpack_require__.d(widget_group_namespaceObject, {
;// CONCATENATED MODULE: external ["wp","blocks"]
const external_wp_blocks_namespaceObject = window["wp"]["blocks"];
-;// CONCATENATED MODULE: external "React"
-const external_React_namespaceObject = window["React"];
;// CONCATENATED MODULE: external ["wp","primitives"]
const external_wp_primitives_namespaceObject = window["wp"]["primitives"];
+;// CONCATENATED MODULE: external "ReactJSXRuntime"
+const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/widget.js
-
/**
* WordPress dependencies
*/
-const widget = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
+
+const widget = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M6 3H8V5H16V3H18V5C19.1046 5 20 5.89543 20 7V19C20 20.1046 19.1046 21 18 21H6C4.89543 21 4 20.1046 4 19V7C4 5.89543 4.89543 5 6 5V3ZM18 6.5H6C5.72386 6.5 5.5 6.72386 5.5 7V8H18.5V7C18.5 6.72386 18.2761 6.5 18 6.5ZM18.5 9.5H5.5V19C5.5 19.2761 5.72386 19.5 6 19.5H18C18.2761 19.5 18.5 19.2761 18.5 19V9.5ZM11 11H13V13H11V11ZM7 11V13H9V11H7ZM15 13V11H17V13H15Z"
-}));
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M6 3H8V5H16V3H18V5C19.1046 5 20 5.89543 20 7V19C20 20.1046 19.1046 21 18 21H6C4.89543 21 4 20.1046 4 19V7C4 5.89543 4.89543 5 6 5V3ZM18 6.5H6C5.72386 6.5 5.5 6.72386 5.5 7V8H18.5V7C18.5 6.72386 18.2761 6.5 18 6.5ZM18.5 9.5H5.5V19C5.5 19.2761 5.72386 19.5 6 19.5H18C18.2761 19.5 18.5 19.2761 18.5 19V9.5ZM11 11H13V13H11V11ZM7 11V13H9V11H7ZM15 13V11H17V13H15Z"
+ })
+});
/* harmony default export */ const library_widget = (widget);
-// EXTERNAL MODULE: ./node_modules/classnames/index.js
-var classnames = __webpack_require__(5755);
-var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
+;// CONCATENATED MODULE: ./node_modules/clsx/dist/clsx.mjs
+function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f)}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}/* harmony default export */ const dist_clsx = (clsx);
;// CONCATENATED MODULE: external ["wp","blockEditor"]
const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"];
;// CONCATENATED MODULE: external ["wp","components"]
const external_wp_components_namespaceObject = window["wp"]["components"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/brush.js
-
/**
* WordPress dependencies
*/
-const brush = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
+
+const brush = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M4 20h8v-1.5H4V20zM18.9 3.5c-.6-.6-1.5-.6-2.1 0l-7.2 7.2c-.4-.1-.7 0-1.1.1-.5.2-1.5.7-1.9 2.2-.4 1.7-.8 2.2-1.1 2.7-.1.1-.2.3-.3.4l-.6 1.1H6c2 0 3.4-.4 4.7-1.4.8-.6 1.2-1.4 1.3-2.3 0-.3 0-.5-.1-.7L19 5.7c.5-.6.5-1.6-.1-2.2zM9.7 14.7c-.7.5-1.5.8-2.4 1 .2-.5.5-1.2.8-2.3.2-.6.4-1 .8-1.1.5-.1 1 .1 1.3.3.2.2.3.5.2.8 0 .3-.1.9-.7 1.3z"
-}));
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M4 20h8v-1.5H4V20zM18.9 3.5c-.6-.6-1.5-.6-2.1 0l-7.2 7.2c-.4-.1-.7 0-1.1.1-.5.2-1.5.7-1.9 2.2-.4 1.7-.8 2.2-1.1 2.7-.1.1-.2.3-.3.4l-.6 1.1H6c2 0 3.4-.4 4.7-1.4.8-.6 1.2-1.4 1.3-2.3 0-.3 0-.5-.1-.7L19 5.7c.5-.6.5-1.6-.1-2.2zM9.7 14.7c-.7.5-1.5.8-2.4 1 .2-.5.5-1.2.8-2.3.2-.6.4-1 .8-1.1.5-.1 1 .1 1.3.3.2.2.3.5.2.8 0 .3-.1.9-.7 1.3z"
+ })
+});
/* harmony default export */ const library_brush = (brush);
;// CONCATENATED MODULE: external ["wp","i18n"]
@@ -220,7 +128,6 @@ const external_wp_data_namespaceObject = window["wp"]["data"];
;// CONCATENATED MODULE: external ["wp","coreData"]
const external_wp_coreData_namespaceObject = window["wp"]["coreData"];
;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/widget-type-selector.js
-
/**
* WordPress dependencies
*/
@@ -229,6 +136,7 @@ const external_wp_coreData_namespaceObject = window["wp"]["coreData"];
+
function WidgetTypeSelector({
selectedId,
onSelect
@@ -241,12 +149,12 @@ function WidgetTypeSelector({
})?.filter(widgetType => !hiddenIds.includes(widgetType.id));
}, []);
if (!widgetTypes) {
- return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null);
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {});
}
if (widgetTypes.length === 0) {
return (0,external_wp_i18n_namespaceObject.__)('There are no widgets available.');
}
- return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, {
__nextHasNoMarginBottom: true,
label: (0,external_wp_i18n_namespaceObject.__)('Select a legacy widget to display:'),
value: selectedId !== null && selectedId !== void 0 ? selectedId : '',
@@ -275,15 +183,20 @@ function WidgetTypeSelector({
;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/inspector-card.js
+
function InspectorCard({
name,
description
}) {
- return (0,external_React_namespaceObject.createElement)("div", {
- className: "wp-block-legacy-widget-inspector-card"
- }, (0,external_React_namespaceObject.createElement)("h3", {
- className: "wp-block-legacy-widget-inspector-card__name"
- }, name), (0,external_React_namespaceObject.createElement)("span", null, description));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "wp-block-legacy-widget-inspector-card",
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h3", {
+ className: "wp-block-legacy-widget-inspector-card__name",
+ children: name
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", {
+ children: description
+ })]
+ });
}
;// CONCATENATED MODULE: external ["wp","notices"]
@@ -704,7 +617,6 @@ function serializeForm(form) {
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/form.js
-
/**
* External dependencies
*/
@@ -722,6 +634,8 @@ function serializeForm(form) {
* Internal dependencies
*/
+
+
function Form({
title,
isVisible,
@@ -775,36 +689,40 @@ function Form({
};
}, [id, idBase, instance, onChangeInstance, onChangeHasPreview, isMediumLargeViewport]);
if (isWide && isMediumLargeViewport) {
- return (0,external_React_namespaceObject.createElement)("div", {
- className: classnames_default()({
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: dist_clsx({
'wp-block-legacy-widget__container': isVisible
- })
- }, isVisible && (0,external_React_namespaceObject.createElement)("h3", {
- className: "wp-block-legacy-widget__edit-form-title"
- }, title), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover, {
- focusOnMount: false,
- placement: "right",
- offset: 32,
- resize: false,
- flip: false,
- shift: true
- }, (0,external_React_namespaceObject.createElement)("div", {
- ref: ref,
- className: "wp-block-legacy-widget__edit-form",
- hidden: !isVisible
- })));
+ }),
+ children: [isVisible && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h3", {
+ className: "wp-block-legacy-widget__edit-form-title",
+ children: title
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover, {
+ focusOnMount: false,
+ placement: "right",
+ offset: 32,
+ resize: false,
+ flip: false,
+ shift: true,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ ref: ref,
+ className: "wp-block-legacy-widget__edit-form",
+ hidden: !isVisible
+ })
+ })]
+ });
}
- return (0,external_React_namespaceObject.createElement)("div", {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
ref: ref,
className: "wp-block-legacy-widget__edit-form",
- hidden: !isVisible
- }, (0,external_React_namespaceObject.createElement)("h3", {
- className: "wp-block-legacy-widget__edit-form-title"
- }, title));
+ hidden: !isVisible,
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h3", {
+ className: "wp-block-legacy-widget__edit-form-title",
+ children: title
+ })
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/preview.js
-
/**
* External dependencies
*/
@@ -818,6 +736,9 @@ function Form({
+
+
+
function Preview({
idBase,
instance,
@@ -891,44 +812,56 @@ function Preview({
iframe.removeEventListener('load', setHeight);
};
}, [isLoaded]);
- return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, isVisible && !isLoaded && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null)), (0,external_React_namespaceObject.createElement)("div", {
- className: classnames_default()('wp-block-legacy-widget__edit-preview', {
- 'is-offscreen': !isVisible || !isLoaded
- })
- }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Disabled, null, (0,external_React_namespaceObject.createElement)("iframe", {
- ref: ref,
- className: "wp-block-legacy-widget__edit-preview-iframe",
- tabIndex: "-1",
- title: (0,external_wp_i18n_namespaceObject.__)('Legacy Widget Preview'),
- srcDoc: srcDoc,
- onLoad: event => {
- // To hide the scrollbars of the preview frame for some edge cases,
- // such as negative margins in the Gallery Legacy Widget.
- // It can't be scrolled anyway.
- // TODO: Ideally, this should be fixed in core.
- event.target.contentDocument.body.style.overflow = 'hidden';
- setIsLoaded(true);
- },
- height: 100
- }))));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [isVisible && !isLoaded && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Placeholder, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {})
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: dist_clsx('wp-block-legacy-widget__edit-preview', {
+ 'is-offscreen': !isVisible || !isLoaded
+ }),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Disabled, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("iframe", {
+ ref: ref,
+ className: "wp-block-legacy-widget__edit-preview-iframe",
+ tabIndex: "-1",
+ title: (0,external_wp_i18n_namespaceObject.__)('Legacy Widget Preview'),
+ srcDoc: srcDoc,
+ onLoad: event => {
+ // To hide the scrollbars of the preview frame for some edge cases,
+ // such as negative margins in the Gallery Legacy Widget.
+ // It can't be scrolled anyway.
+ // TODO: Ideally, this should be fixed in core.
+ event.target.contentDocument.body.style.overflow = 'hidden';
+ setIsLoaded(true);
+ },
+ height: 100
+ })
+ })
+ })]
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/no-preview.js
-
/**
* WordPress dependencies
*/
+
+
function NoPreview({
name
}) {
- return (0,external_React_namespaceObject.createElement)("div", {
- className: "wp-block-legacy-widget__edit-no-preview"
- }, name && (0,external_React_namespaceObject.createElement)("h3", null, name), (0,external_React_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('No preview available.')));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", {
+ className: "wp-block-legacy-widget__edit-no-preview",
+ children: [name && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h3", {
+ children: name
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", {
+ children: (0,external_wp_i18n_namespaceObject.__)('No preview available.')
+ })]
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/convert-to-blocks-button.js
-
/**
* WordPress dependencies
*/
@@ -937,6 +870,7 @@ function NoPreview({
+
function ConvertToBlocksButton({
clientId,
rawInstance
@@ -944,7 +878,7 @@ function ConvertToBlocksButton({
const {
replaceBlocks
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
- return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarButton, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, {
onClick: () => {
if (rawInstance.title) {
replaceBlocks(clientId, [(0,external_wp_blocks_namespaceObject.createBlock)('core/heading', {
@@ -957,12 +891,12 @@ function ConvertToBlocksButton({
HTML: rawInstance.text
}));
}
- }
- }, (0,external_wp_i18n_namespaceObject.__)('Convert to blocks'));
+ },
+ children: (0,external_wp_i18n_namespaceObject.__)('Convert to blocks')
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/index.js
-
/**
* External dependencies
*/
@@ -988,6 +922,9 @@ function ConvertToBlocksButton({
+
+
+
function Edit(props) {
const {
id,
@@ -997,17 +934,18 @@ function Edit(props) {
isWide = false
} = props;
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({
- className: classnames_default()({
+ className: dist_clsx({
'is-wide-widget': isWide
})
});
- return (0,external_React_namespaceObject.createElement)("div", {
- ...blockProps
- }, !id && !idBase ? (0,external_React_namespaceObject.createElement)(Empty, {
- ...props
- }) : (0,external_React_namespaceObject.createElement)(NotEmpty, {
- ...props
- }));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ ...blockProps,
+ children: !id && !idBase ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Empty, {
+ ...props
+ }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NotEmpty, {
+ ...props
+ })
+ });
}
function Empty({
attributes: {
@@ -1016,38 +954,43 @@ function Empty({
},
setAttributes
}) {
- return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, {
- icon: (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Placeholder, {
+ icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, {
icon: library_brush
}),
- label: (0,external_wp_i18n_namespaceObject.__)('Legacy Widget')
- }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexBlock, null, (0,external_React_namespaceObject.createElement)(WidgetTypeSelector, {
- selectedId: id !== null && id !== void 0 ? id : idBase,
- onSelect: ({
- selectedId,
- isMulti
- }) => {
- if (!selectedId) {
- setAttributes({
- id: null,
- idBase: null,
- instance: null
- });
- } else if (isMulti) {
- setAttributes({
- id: null,
- idBase: selectedId,
- instance: {}
- });
- } else {
- setAttributes({
- id: selectedId,
- idBase: null,
- instance: null
- });
- }
- }
- }))));
+ label: (0,external_wp_i18n_namespaceObject.__)('Legacy Widget'),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WidgetTypeSelector, {
+ selectedId: id !== null && id !== void 0 ? id : idBase,
+ onSelect: ({
+ selectedId,
+ isMulti
+ }) => {
+ if (!selectedId) {
+ setAttributes({
+ id: null,
+ idBase: null,
+ instance: null
+ });
+ } else if (isMulti) {
+ setAttributes({
+ id: null,
+ idBase: selectedId,
+ instance: {}
+ });
+ } else {
+ setAttributes({
+ id: selectedId,
+ idBase: null,
+ instance: null
+ });
+ }
+ }
+ })
+ })
+ })
+ });
}
function NotEmpty({
attributes: {
@@ -1073,41 +1016,53 @@ function NotEmpty({
});
}, []);
if (!widgetType && hasResolvedWidgetType) {
- return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, {
- icon: (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Placeholder, {
+ icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, {
icon: library_brush
}),
- label: (0,external_wp_i18n_namespaceObject.__)('Legacy Widget')
- }, (0,external_wp_i18n_namespaceObject.__)('Widget is missing.'));
+ label: (0,external_wp_i18n_namespaceObject.__)('Legacy Widget'),
+ children: (0,external_wp_i18n_namespaceObject.__)('Widget is missing.')
+ });
}
if (!hasResolvedWidgetType) {
- return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Placeholder, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {})
+ });
}
const mode = idBase && (isNavigationMode || !isSelected) ? 'preview' : 'edit';
- return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, idBase === 'text' && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockControls, {
- group: "other"
- }, (0,external_React_namespaceObject.createElement)(ConvertToBlocksButton, {
- clientId: clientId,
- rawInstance: instance.raw
- })), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InspectorControls, null, (0,external_React_namespaceObject.createElement)(InspectorCard, {
- name: widgetType.name,
- description: widgetType.description
- })), (0,external_React_namespaceObject.createElement)(Form, {
- title: widgetType.name,
- isVisible: mode === 'edit',
- id: id,
- idBase: idBase,
- instance: instance,
- isWide: isWide,
- onChangeInstance: setInstance,
- onChangeHasPreview: setHasPreview
- }), idBase && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, hasPreview === null && mode === 'preview' && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null)), hasPreview === true && (0,external_React_namespaceObject.createElement)(Preview, {
- idBase: idBase,
- instance: instance,
- isVisible: mode === 'preview'
- }), hasPreview === false && mode === 'preview' && (0,external_React_namespaceObject.createElement)(NoPreview, {
- name: widgetType.name
- })));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [idBase === 'text' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockControls, {
+ group: "other",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ConvertToBlocksButton, {
+ clientId: clientId,
+ rawInstance: instance.raw
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InspectorControls, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InspectorCard, {
+ name: widgetType.name,
+ description: widgetType.description
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Form, {
+ title: widgetType.name,
+ isVisible: mode === 'edit',
+ id: id,
+ idBase: idBase,
+ instance: instance,
+ isWide: isWide,
+ onChangeInstance: setInstance,
+ onChangeHasPreview: setHasPreview
+ }), idBase && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [hasPreview === null && mode === 'preview' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Placeholder, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {})
+ }), hasPreview === true && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Preview, {
+ idBase: idBase,
+ instance: instance,
+ isVisible: mode === 'preview'
+ }), hasPreview === false && mode === 'preview' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NoPreview, {
+ name: widgetType.name
+ })]
+ })]
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/transforms.js
@@ -1373,21 +1328,21 @@ const settings = {
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/group.js
-
/**
* WordPress dependencies
*/
-const group = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
+
+const group = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
viewBox: "0 0 24 24",
- xmlns: "http://www.w3.org/2000/svg"
-}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M18 4h-7c-1.1 0-2 .9-2 2v3H6c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2v-3h3c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4.5 14c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5v-7c0-.3.2-.5.5-.5h3V13c0 1.1.9 2 2 2h2.5v3zm0-4.5H11c-.3 0-.5-.2-.5-.5v-2.5H13c.3 0 .5.2.5.5v2.5zm5-.5c0 .3-.2.5-.5.5h-3V11c0-1.1-.9-2-2-2h-2.5V6c0-.3.2-.5.5-.5h7c.3 0 .5.2.5.5v7z"
-}));
+ xmlns: "http://www.w3.org/2000/svg",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M18 4h-7c-1.1 0-2 .9-2 2v3H6c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2v-3h3c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4.5 14c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5v-7c0-.3.2-.5.5-.5h3V13c0 1.1.9 2 2 2h2.5v3zm0-4.5H11c-.3 0-.5-.2-.5-.5v-2.5H13c.3 0 .5.2.5.5v2.5zm5-.5c0 .3-.2.5-.5.5h-3V11c0-1.1-.9-2-2-2h-2.5V6c0-.3.2-.5.5-.5h7c.3 0 .5.2.5.5v7z"
+ })
+});
/* harmony default export */ const library_group = (group);
;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/widget-group/edit.js
-
/**
* WordPress dependencies
*/
@@ -1396,6 +1351,9 @@ const group = (0,external_React_namespaceObject.createElement)(external_wp_primi
+
+
+
function edit_Edit(props) {
const {
clientId
@@ -1403,72 +1361,86 @@ function edit_Edit(props) {
const {
innerBlocks
} = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getBlock(clientId), [clientId]);
- return (0,external_React_namespaceObject.createElement)("div", {
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
...(0,external_wp_blockEditor_namespaceObject.useBlockProps)({
className: 'widget'
+ }),
+ children: innerBlocks.length === 0 ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PlaceholderContent, {
+ ...props
+ }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewContent, {
+ ...props
})
- }, innerBlocks.length === 0 ? (0,external_React_namespaceObject.createElement)(PlaceholderContent, {
- ...props
- }) : (0,external_React_namespaceObject.createElement)(PreviewContent, {
- ...props
- }));
+ });
}
function PlaceholderContent({
clientId
}) {
- return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Placeholder, {
- className: "wp-block-widget-group__placeholder",
- icon: (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, {
- icon: library_group
- }),
- label: (0,external_wp_i18n_namespaceObject.__)('Widget Group')
- }, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.ButtonBlockAppender, {
- rootClientId: clientId
- })), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks, {
- renderAppender: false
- }));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Placeholder, {
+ className: "wp-block-widget-group__placeholder",
+ icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, {
+ icon: library_group
+ }),
+ label: (0,external_wp_i18n_namespaceObject.__)('Widget Group'),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.ButtonBlockAppender, {
+ rootClientId: clientId
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InnerBlocks, {
+ renderAppender: false
+ })]
+ });
}
function PreviewContent({
attributes,
setAttributes
}) {
var _attributes$title;
- return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText, {
- tagName: "h2",
- className: "widget-title",
- allowedFormats: [],
- placeholder: (0,external_wp_i18n_namespaceObject.__)('Title'),
- value: (_attributes$title = attributes.title) !== null && _attributes$title !== void 0 ? _attributes$title : '',
- onChange: title => setAttributes({
- title
- })
- }), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks, null));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText, {
+ tagName: "h2",
+ identifier: "title",
+ className: "widget-title",
+ allowedFormats: [],
+ placeholder: (0,external_wp_i18n_namespaceObject.__)('Title'),
+ value: (_attributes$title = attributes.title) !== null && _attributes$title !== void 0 ? _attributes$title : '',
+ onChange: title => setAttributes({
+ title
+ })
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InnerBlocks, {})]
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/widget-group/save.js
-
/**
* WordPress dependencies
*/
+
+
+
function save({
attributes
}) {
- return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
- tagName: "h2",
- className: "widget-title",
- value: attributes.title
- }), (0,external_React_namespaceObject.createElement)("div", {
- className: "wp-widget-group__inner-blocks"
- }, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null)));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, {
+ tagName: "h2",
+ className: "widget-title",
+ value: attributes.title
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
+ className: "wp-widget-group__inner-blocks",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, {})
+ })]
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/widget-group/deprecated.js
-
/**
* WordPress dependencies
*/
+
+
+
const v1 = {
attributes: {
title: {
@@ -1484,11 +1456,13 @@ const v1 = {
save({
attributes
}) {
- return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.RichText.Content, {
- tagName: "h2",
- className: "widget-title",
- value: attributes.title
- }), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, null));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
+ children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, {
+ tagName: "h2",
+ className: "widget-title",
+ value: attributes.title
+ }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, {})]
+ });
}
};
/* harmony default export */ const deprecated = ([v1]);
@@ -1508,6 +1482,7 @@ const widget_group_metadata = {
$schema: "https://schemas.wp.org/trunk/block.json",
apiVersion: 3,
name: "core/widget-group",
+ title: "Widget Group",
category: "widgets",
attributes: {
title: {
@@ -1573,52 +1548,59 @@ const widget_group_settings = {
};
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/move-to.js
-
/**
* WordPress dependencies
*/
-const moveTo = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
+
+const moveTo = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, {
xmlns: "http://www.w3.org/2000/svg",
- viewBox: "0 0 24 24"
-}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
- d: "M19.75 9c0-1.257-.565-2.197-1.39-2.858-.797-.64-1.827-1.017-2.815-1.247-1.802-.42-3.703-.403-4.383-.396L11 4.5V6l.177-.001c.696-.006 2.416-.02 4.028.356.887.207 1.67.518 2.216.957.52.416.829.945.829 1.688 0 .592-.167.966-.407 1.23-.255.281-.656.508-1.236.674-1.19.34-2.82.346-4.607.346h-.077c-1.692 0-3.527 0-4.942.404-.732.209-1.424.545-1.935 1.108-.526.579-.796 1.33-.796 2.238 0 1.257.565 2.197 1.39 2.858.797.64 1.827 1.017 2.815 1.247 1.802.42 3.703.403 4.383.396L13 19.5h.714V22L18 18.5 13.714 15v3H13l-.177.001c-.696.006-2.416.02-4.028-.356-.887-.207-1.67-.518-2.216-.957-.52-.416-.829-.945-.829-1.688 0-.592.167-.966.407-1.23.255-.281.656-.508 1.237-.674 1.189-.34 2.819-.346 4.606-.346h.077c1.692 0 3.527 0 4.941-.404.732-.209 1.425-.545 1.936-1.108.526-.579.796-1.33.796-2.238z"
-}));
+ viewBox: "0 0 24 24",
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, {
+ d: "M19.75 9c0-1.257-.565-2.197-1.39-2.858-.797-.64-1.827-1.017-2.815-1.247-1.802-.42-3.703-.403-4.383-.396L11 4.5V6l.177-.001c.696-.006 2.416-.02 4.028.356.887.207 1.67.518 2.216.957.52.416.829.945.829 1.688 0 .592-.167.966-.407 1.23-.255.281-.656.508-1.236.674-1.19.34-2.82.346-4.607.346h-.077c-1.692 0-3.527 0-4.942.404-.732.209-1.424.545-1.935 1.108-.526.579-.796 1.33-.796 2.238 0 1.257.565 2.197 1.39 2.858.797.64 1.827 1.017 2.815 1.247 1.802.42 3.703.403 4.383.396L13 19.5h.714V22L18 18.5 13.714 15v3H13l-.177.001c-.696.006-2.416.02-4.028-.356-.887-.207-1.67-.518-2.216-.957-.52-.416-.829-.945-.829-1.688 0-.592.167-.966.407-1.23.255-.281.656-.508 1.237-.674 1.189-.34 2.819-.346 4.606-.346h.077c1.692 0 3.527 0 4.941-.404.732-.209 1.425-.545 1.936-1.108.526-.579.796-1.33.796-2.238z"
+ })
+});
/* harmony default export */ const move_to = (moveTo);
;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/components/move-to-widget-area/index.js
-
/**
* WordPress dependencies
*/
+
function MoveToWidgetArea({
currentWidgetAreaId,
widgetAreas,
onSelect
}) {
- return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarGroup, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, null, toggleProps => (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.DropdownMenu, {
- icon: move_to,
- label: (0,external_wp_i18n_namespaceObject.__)('Move to widget area'),
- toggleProps: toggleProps
- }, ({
- onClose
- }) => (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
- label: (0,external_wp_i18n_namespaceObject.__)('Move to')
- }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItemsChoice, {
- choices: widgetAreas.map(widgetArea => ({
- value: widgetArea.id,
- label: widgetArea.name,
- info: widgetArea.description
- })),
- value: currentWidgetAreaId,
- onSelect: value => {
- onSelect(value);
- onClose();
- }
- })))));
+ return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, {
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, {
+ children: toggleProps => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, {
+ icon: move_to,
+ label: (0,external_wp_i18n_namespaceObject.__)('Move to widget area'),
+ toggleProps: toggleProps,
+ children: ({
+ onClose
+ }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, {
+ label: (0,external_wp_i18n_namespaceObject.__)('Move to'),
+ children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItemsChoice, {
+ choices: widgetAreas.map(widgetArea => ({
+ value: widgetArea.id,
+ label: widgetArea.name,
+ info: widgetArea.description
+ })),
+ value: currentWidgetAreaId,
+ onSelect: value => {
+ onSelect(value);
+ onClose();
+ }
+ })
+ })
+ })
+ })
+ });
}
;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/components/index.js
@@ -1755,8 +1737,6 @@ function registerWidgetGroupBlock(supports = {}) {
}
-})();
-
(window.wp = window.wp || {}).widgets = __webpack_exports__;
/******/ })()
; \ No newline at end of file