@wordpress/block-editor 15.8.1-next.16d95556a.0 → 15.8.1-next.dc3f6d3c1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/block-inspector/edit-contents.js +19 -23
- package/build/components/block-inspector/edit-contents.js.map +3 -3
- package/build/components/block-inspector/index.js +7 -1
- package/build/components/block-inspector/index.js.map +2 -2
- package/build/components/block-list/block.js +4 -0
- package/build/components/block-list/block.js.map +2 -2
- package/build/components/block-list/use-block-props/index.js +3 -1
- package/build/components/block-list/use-block-props/index.js.map +2 -2
- package/build/components/block-list/use-block-props/use-is-hovered.js +16 -10
- package/build/components/block-list/use-block-props/use-is-hovered.js.map +2 -2
- package/build/components/block-settings-menu-controls/edit-section-menu-item.js +64 -0
- package/build/components/block-settings-menu-controls/edit-section-menu-item.js.map +7 -0
- package/build/components/block-settings-menu-controls/index.js +8 -0
- package/build/components/block-settings-menu-controls/index.js.map +2 -2
- package/build/components/block-toolbar/block-toolbar-icon.js +9 -9
- package/build/components/block-toolbar/block-toolbar-icon.js.map +2 -2
- package/build/components/block-variation-transforms/index.js +32 -5
- package/build/components/block-variation-transforms/index.js.map +2 -2
- package/build/components/border-radius-control/single-input-control.js +1 -0
- package/build/components/border-radius-control/single-input-control.js.map +2 -2
- package/build/components/content-only-controls/index.js +263 -0
- package/build/components/content-only-controls/index.js.map +7 -0
- package/build/components/content-only-controls/link/index.js +204 -0
- package/build/components/content-only-controls/link/index.js.map +7 -0
- package/build/components/content-only-controls/media/index.js +264 -0
- package/build/components/content-only-controls/media/index.js.map +7 -0
- package/build/components/content-only-controls/plain-text/index.js +68 -0
- package/build/components/content-only-controls/plain-text/index.js.map +7 -0
- package/build/components/content-only-controls/rich-text/index.js +197 -0
- package/build/components/content-only-controls/rich-text/index.js.map +7 -0
- package/build/components/content-only-controls/use-inspector-popover-placement.js +41 -0
- package/build/components/content-only-controls/use-inspector-popover-placement.js.map +7 -0
- package/build/components/inserter/media-tab/media-tab.js +1 -33
- package/build/components/inserter/media-tab/media-tab.js.map +3 -3
- package/build/components/inspector-controls-tabs/content-tab.js +6 -2
- package/build/components/inspector-controls-tabs/content-tab.js.map +3 -3
- package/build/components/inspector-controls-tabs/index.js +7 -1
- package/build/components/inspector-controls-tabs/index.js.map +2 -2
- package/build/components/list-view/block-select-button.js +11 -4
- package/build/components/list-view/block-select-button.js.map +2 -2
- package/build/components/media-placeholder/index.js +1 -31
- package/build/components/media-placeholder/index.js.map +3 -3
- package/build/components/media-replace-flow/index.js +4 -30
- package/build/components/media-replace-flow/index.js.map +3 -3
- package/build/components/use-block-display-information/index.js +21 -1
- package/build/components/use-block-display-information/index.js.map +3 -3
- package/build/hooks/block-bindings.js +52 -61
- package/build/hooks/block-bindings.js.map +3 -3
- package/build/hooks/use-content-only-section-edit.js +67 -0
- package/build/hooks/use-content-only-section-edit.js.map +7 -0
- package/build/layouts/constrained.js +2 -2
- package/build/layouts/constrained.js.map +2 -2
- package/build/private-apis.js +2 -3
- package/build/private-apis.js.map +3 -3
- package/build/store/private-keys.js +3 -0
- package/build/store/private-keys.js.map +2 -2
- package/build/store/private-selectors.js +1 -2
- package/build/store/private-selectors.js.map +2 -2
- package/build/store/reducer.js +1 -2
- package/build/store/reducer.js.map +2 -2
- package/build/utils/fit-text-utils.js +9 -1
- package/build/utils/fit-text-utils.js.map +2 -2
- package/build-module/components/block-inspector/edit-contents.js +9 -23
- package/build-module/components/block-inspector/edit-contents.js.map +2 -2
- package/build-module/components/block-inspector/index.js +7 -1
- package/build-module/components/block-inspector/index.js.map +2 -2
- package/build-module/components/block-list/block.js +4 -0
- package/build-module/components/block-list/block.js.map +2 -2
- package/build-module/components/block-list/use-block-props/index.js +3 -1
- package/build-module/components/block-list/use-block-props/index.js.map +2 -2
- package/build-module/components/block-list/use-block-props/use-is-hovered.js +16 -10
- package/build-module/components/block-list/use-block-props/use-is-hovered.js.map +2 -2
- package/build-module/components/block-settings-menu-controls/edit-section-menu-item.js +29 -0
- package/build-module/components/block-settings-menu-controls/edit-section-menu-item.js.map +7 -0
- package/build-module/components/block-settings-menu-controls/index.js +8 -0
- package/build-module/components/block-settings-menu-controls/index.js.map +2 -2
- package/build-module/components/block-toolbar/block-toolbar-icon.js +10 -10
- package/build-module/components/block-toolbar/block-toolbar-icon.js.map +2 -2
- package/build-module/components/block-variation-transforms/index.js +32 -5
- package/build-module/components/block-variation-transforms/index.js.map +2 -2
- package/build-module/components/border-radius-control/single-input-control.js +1 -0
- package/build-module/components/border-radius-control/single-input-control.js.map +2 -2
- package/build-module/components/content-only-controls/index.js +237 -0
- package/build-module/components/content-only-controls/index.js.map +7 -0
- package/build-module/components/content-only-controls/link/index.js +172 -0
- package/build-module/components/content-only-controls/link/index.js.map +7 -0
- package/build-module/components/content-only-controls/media/index.js +243 -0
- package/build-module/components/content-only-controls/media/index.js.map +7 -0
- package/build-module/components/content-only-controls/plain-text/index.js +50 -0
- package/build-module/components/content-only-controls/plain-text/index.js.map +7 -0
- package/build-module/components/content-only-controls/rich-text/index.js +174 -0
- package/build-module/components/content-only-controls/rich-text/index.js.map +7 -0
- package/build-module/components/content-only-controls/use-inspector-popover-placement.js +16 -0
- package/build-module/components/content-only-controls/use-inspector-popover-placement.js.map +7 -0
- package/build-module/components/inserter/media-tab/media-tab.js +2 -34
- package/build-module/components/inserter/media-tab/media-tab.js.map +2 -2
- package/build-module/components/inspector-controls-tabs/content-tab.js +7 -3
- package/build-module/components/inspector-controls-tabs/content-tab.js.map +2 -2
- package/build-module/components/inspector-controls-tabs/index.js +7 -1
- package/build-module/components/inspector-controls-tabs/index.js.map +2 -2
- package/build-module/components/list-view/block-select-button.js +18 -5
- package/build-module/components/list-view/block-select-button.js.map +2 -2
- package/build-module/components/media-placeholder/index.js +1 -31
- package/build-module/components/media-placeholder/index.js.map +2 -2
- package/build-module/components/media-replace-flow/index.js +4 -30
- package/build-module/components/media-replace-flow/index.js.map +2 -2
- package/build-module/components/use-block-display-information/index.js +21 -1
- package/build-module/components/use-block-display-information/index.js.map +3 -3
- package/build-module/hooks/block-bindings.js +57 -62
- package/build-module/hooks/block-bindings.js.map +2 -2
- package/build-module/hooks/use-content-only-section-edit.js +46 -0
- package/build-module/hooks/use-content-only-section-edit.js.map +7 -0
- package/build-module/layouts/constrained.js +2 -2
- package/build-module/layouts/constrained.js.map +2 -2
- package/build-module/private-apis.js +3 -3
- package/build-module/private-apis.js.map +2 -2
- package/build-module/store/private-keys.js +2 -0
- package/build-module/store/private-keys.js.map +2 -2
- package/build-module/store/private-selectors.js +1 -2
- package/build-module/store/private-selectors.js.map +2 -2
- package/build-module/store/reducer.js +1 -2
- package/build-module/store/reducer.js.map +2 -2
- package/build-module/utils/fit-text-utils.js +9 -1
- package/build-module/utils/fit-text-utils.js.map +2 -2
- package/build-style/style-rtl.css +132 -0
- package/build-style/style.css +132 -0
- package/package.json +37 -37
- package/src/components/block-inspector/edit-contents.js +10 -29
- package/src/components/block-inspector/index.js +4 -2
- package/src/components/block-list/block.js +6 -0
- package/src/components/block-list/use-block-props/index.js +3 -1
- package/src/components/block-list/use-block-props/use-is-hovered.js +24 -12
- package/src/components/block-settings-menu-controls/edit-section-menu-item.js +39 -0
- package/src/components/block-settings-menu-controls/index.js +7 -0
- package/src/components/block-toolbar/block-toolbar-icon.js +14 -10
- package/src/components/block-variation-transforms/index.js +96 -35
- package/src/components/border-radius-control/single-input-control.js +1 -0
- package/src/components/content-only-controls/index.js +296 -0
- package/src/components/content-only-controls/link/index.js +195 -0
- package/src/components/content-only-controls/link/styles.scss +23 -0
- package/src/components/content-only-controls/media/index.js +285 -0
- package/src/components/content-only-controls/media/styles.scss +47 -0
- package/src/components/content-only-controls/plain-text/index.js +49 -0
- package/src/components/content-only-controls/rich-text/index.js +193 -0
- package/src/components/content-only-controls/rich-text/styles.scss +24 -0
- package/src/components/content-only-controls/styles.scss +35 -0
- package/src/components/content-only-controls/use-inspector-popover-placement.js +19 -0
- package/src/components/inserter/media-tab/media-tab.js +2 -44
- package/src/components/inspector-controls-tabs/content-tab.js +12 -4
- package/src/components/inspector-controls-tabs/index.js +4 -1
- package/src/components/list-view/block-select-button.js +37 -24
- package/src/components/media-placeholder/index.js +1 -41
- package/src/components/media-replace-flow/index.js +3 -39
- package/src/components/use-block-display-information/index.js +30 -2
- package/src/hooks/block-bindings.js +71 -82
- package/src/hooks/use-content-only-section-edit.js +63 -0
- package/src/layouts/constrained.js +8 -2
- package/src/private-apis.js +2 -2
- package/src/store/private-keys.js +1 -0
- package/src/store/private-selectors.js +1 -2
- package/src/store/reducer.js +0 -3
- package/src/store/test/reducer.js +7 -17
- package/src/style.scss +1 -0
- package/src/utils/fit-text-utils.js +19 -1
- package/build/components/media-upload-modal/index.js +0 -29
- package/build/components/media-upload-modal/index.js.map +0 -7
- package/build-module/components/media-upload-modal/index.js +0 -8
- package/build-module/components/media-upload-modal/index.js.map +0 -7
- package/src/components/media-upload-modal/index.js +0 -18
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// packages/block-editor/src/components/block-settings-menu-controls/edit-section-menu-item.js
|
|
31
|
+
var edit_section_menu_item_exports = {};
|
|
32
|
+
__export(edit_section_menu_item_exports, {
|
|
33
|
+
EditSectionMenuItem: () => EditSectionMenuItem
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(edit_section_menu_item_exports);
|
|
36
|
+
var import_components = require("@wordpress/components");
|
|
37
|
+
var import_i18n = require("@wordpress/i18n");
|
|
38
|
+
var import_use_content_only_section_edit = __toESM(require("../../hooks/use-content-only-section-edit"));
|
|
39
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
40
|
+
function EditSectionMenuItem({ clientId, onClose }) {
|
|
41
|
+
const {
|
|
42
|
+
isSectionBlock,
|
|
43
|
+
isEditingContentOnlySection,
|
|
44
|
+
editContentOnlySection
|
|
45
|
+
} = (0, import_use_content_only_section_edit.default)(clientId);
|
|
46
|
+
if (!window?.__experimentalContentOnlyPatternInsertion || !isSectionBlock || isEditingContentOnlySection) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
50
|
+
import_components.MenuItem,
|
|
51
|
+
{
|
|
52
|
+
onClick: () => {
|
|
53
|
+
editContentOnlySection(clientId);
|
|
54
|
+
onClose();
|
|
55
|
+
},
|
|
56
|
+
children: (0, import_i18n._x)("Edit section", "Editing a section in the Editor")
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
61
|
+
0 && (module.exports = {
|
|
62
|
+
EditSectionMenuItem
|
|
63
|
+
});
|
|
64
|
+
//# sourceMappingURL=edit-section-menu-item.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/block-settings-menu-controls/edit-section-menu-item.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { _x } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useContentOnlySectionEdit from '../../hooks/use-content-only-section-edit';\n\nexport function EditSectionMenuItem( { clientId, onClose } ) {\n\tconst {\n\t\tisSectionBlock,\n\t\tisEditingContentOnlySection,\n\t\teditContentOnlySection,\n\t} = useContentOnlySectionEdit( clientId );\n\n\t// Only show when the experiment is enabled, the block is a section block,\n\t// and we're not already editing it\n\tif (\n\t\t! window?.__experimentalContentOnlyPatternInsertion ||\n\t\t! isSectionBlock ||\n\t\tisEditingContentOnlySection\n\t) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\teditContentOnlySection( clientId );\n\t\t\t\tonClose();\n\t\t\t} }\n\t\t>\n\t\t\t{ _x( 'Edit section', 'Editing a section in the Editor' ) }\n\t\t</MenuItem>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAAyB;AACzB,kBAAmB;AAKnB,2CAAsC;AAoBpC;AAlBK,SAAS,oBAAqB,EAAE,UAAU,QAAQ,GAAI;AAC5D,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACD,QAAI,qCAAAA,SAA2B,QAAS;AAIxC,MACC,CAAE,QAAQ,6CACV,CAAE,kBACF,6BACC;AACD,WAAO;AAAA,EACR;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,SAAU,MAAM;AACf,+BAAwB,QAAS;AACjC,gBAAQ;AAAA,MACT;AAAA,MAEE,8BAAI,gBAAgB,iCAAkC;AAAA;AAAA,EACzD;AAEF;",
|
|
6
|
+
"names": ["useContentOnlySectionEdit"]
|
|
7
|
+
}
|
|
@@ -43,6 +43,7 @@ var import_block_mode_toggle = __toESM(require("../block-settings-menu/block-mod
|
|
|
43
43
|
var import_content_lock = require("../content-lock");
|
|
44
44
|
var import_block_rename = require("../block-rename");
|
|
45
45
|
var import_block_visibility = require("../block-visibility");
|
|
46
|
+
var import_edit_section_menu_item = require("./edit-section-menu-item");
|
|
46
47
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
47
48
|
var { Fill, Slot } = (0, import_components.createSlotFill)("BlockSettingsMenuControls");
|
|
48
49
|
var BlockSettingsMenuControlsSlot = ({ fillProps, clientIds = null }) => {
|
|
@@ -101,6 +102,13 @@ var BlockSettingsMenuControlsSlot = ({ fillProps, clientIds = null }) => {
|
|
|
101
102
|
onClose: fillProps?.onClose
|
|
102
103
|
}
|
|
103
104
|
),
|
|
105
|
+
selectedClientIds.length === 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
106
|
+
import_edit_section_menu_item.EditSectionMenuItem,
|
|
107
|
+
{
|
|
108
|
+
clientId: selectedClientIds[0],
|
|
109
|
+
onClose: fillProps?.onClose
|
|
110
|
+
}
|
|
111
|
+
),
|
|
104
112
|
showLockButton && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
105
113
|
import_block_lock.BlockLockMenuItem,
|
|
106
114
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-settings-menu-controls/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tcreateSlotFill,\n\tMenuGroup,\n\t__experimentalStyleProvider as StyleProvider,\n} from '@wordpress/components';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseConvertToGroupButtonProps,\n\tConvertToGroupButton,\n} from '../convert-to-group-buttons';\nimport { BlockLockMenuItem, useBlockLock } from '../block-lock';\nimport { store as blockEditorStore } from '../../store';\nimport BlockModeToggle from '../block-settings-menu/block-mode-toggle';\nimport { ModifyContentOnlySectionMenuItem } from '../content-lock';\nimport { BlockRenameControl, useBlockRename } from '../block-rename';\nimport { BlockVisibilityMenuItem } from '../block-visibility';\n\nconst { Fill, Slot } = createSlotFill( 'BlockSettingsMenuControls' );\n\nconst BlockSettingsMenuControlsSlot = ( { fillProps, clientIds = null } ) => {\n\tconst {\n\t\tselectedBlocks,\n\t\tselectedClientIds,\n\t\tisContentOnly,\n\t\tcanToggleSelectedBlocksVisibility,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlocksByClientId,\n\t\t\t\tgetBlockNamesByClientId,\n\t\t\t\tgetSelectedBlockClientIds,\n\t\t\t\tgetBlockEditingMode,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst ids =\n\t\t\t\tclientIds !== null ? clientIds : getSelectedBlockClientIds();\n\t\t\treturn {\n\t\t\t\tselectedBlocks: getBlockNamesByClientId( ids ),\n\t\t\t\tselectedClientIds: ids,\n\t\t\t\tisContentOnly:\n\t\t\t\t\tgetBlockEditingMode( ids[ 0 ] ) === 'contentOnly',\n\t\t\t\tcanToggleSelectedBlocksVisibility: getBlocksByClientId(\n\t\t\t\t\tids\n\t\t\t\t).every( ( block ) =>\n\t\t\t\t\thasBlockSupport( block.name, 'blockVisibility', true )\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ clientIds ]\n\t);\n\n\tconst { canLock } = useBlockLock( selectedClientIds[ 0 ] );\n\tconst { canRename } = useBlockRename( selectedBlocks[ 0 ] );\n\tconst showLockButton =\n\t\tselectedClientIds.length === 1 && canLock && ! isContentOnly;\n\tconst showRenameButton =\n\t\tselectedClientIds.length === 1 && canRename && ! isContentOnly;\n\tconst showVisibilityButton =\n\t\tcanToggleSelectedBlocksVisibility && ! isContentOnly;\n\n\t// Check if current selection of blocks is Groupable or Ungroupable\n\t// and pass this props down to ConvertToGroupButton.\n\tconst convertToGroupButtonProps =\n\t\tuseConvertToGroupButtonProps( selectedClientIds );\n\tconst { isGroupable, isUngroupable } = convertToGroupButtonProps;\n\tconst showConvertToGroupButton =\n\t\t( isGroupable || isUngroupable ) && ! isContentOnly;\n\n\treturn (\n\t\t<Slot\n\t\t\tfillProps={ {\n\t\t\t\t...fillProps,\n\t\t\t\tselectedBlocks,\n\t\t\t\tselectedClientIds,\n\t\t\t} }\n\t\t>\n\t\t\t{ ( fills ) => {\n\t\t\t\tif (\n\t\t\t\t\t! fills?.length > 0 &&\n\t\t\t\t\t! showConvertToGroupButton &&\n\t\t\t\t\t! showLockButton\n\t\t\t\t) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t{ showConvertToGroupButton && (\n\t\t\t\t\t\t\t<ConvertToGroupButton\n\t\t\t\t\t\t\t\t{ ...convertToGroupButtonProps }\n\t\t\t\t\t\t\t\tonClose={ fillProps?.onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ showLockButton && (\n\t\t\t\t\t\t\t<BlockLockMenuItem\n\t\t\t\t\t\t\t\tclientId={ selectedClientIds[ 0 ] }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ showRenameButton && (\n\t\t\t\t\t\t\t<BlockRenameControl\n\t\t\t\t\t\t\t\tclientId={ selectedClientIds[ 0 ] }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ showVisibilityButton && (\n\t\t\t\t\t\t\t<BlockVisibilityMenuItem\n\t\t\t\t\t\t\t\tclientIds={ selectedClientIds }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ fills }\n\t\t\t\t\t\t{ selectedClientIds.length === 1 && (\n\t\t\t\t\t\t\t<ModifyContentOnlySectionMenuItem\n\t\t\t\t\t\t\t\tclientId={ selectedClientIds[ 0 ] }\n\t\t\t\t\t\t\t\tonClose={ fillProps?.onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ fillProps?.count === 1 && ! isContentOnly && (\n\t\t\t\t\t\t\t<BlockModeToggle\n\t\t\t\t\t\t\t\tclientId={ fillProps?.firstBlockClientId }\n\t\t\t\t\t\t\t\tonToggle={ fillProps?.onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t);\n\t\t\t} }\n\t\t</Slot>\n\t);\n};\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-settings-menu-controls/README.md\n *\n * @param {Object} props Fill props.\n * @return {Element} Element.\n */\nfunction BlockSettingsMenuControls( { ...props } ) {\n\treturn (\n\t\t<StyleProvider document={ document }>\n\t\t\t<Fill { ...props } />\n\t\t</StyleProvider>\n\t);\n}\n\nBlockSettingsMenuControls.Slot = BlockSettingsMenuControlsSlot;\n\nexport default BlockSettingsMenuControls;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAIO;AACP,oBAAgC;AAChC,kBAA0B;AAK1B,sCAGO;AACP,wBAAgD;AAChD,mBAA0C;AAC1C,+BAA4B;AAC5B,0BAAiD;AACjD,0BAAmD;AACnD,8BAAwC;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tcreateSlotFill,\n\tMenuGroup,\n\t__experimentalStyleProvider as StyleProvider,\n} from '@wordpress/components';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseConvertToGroupButtonProps,\n\tConvertToGroupButton,\n} from '../convert-to-group-buttons';\nimport { BlockLockMenuItem, useBlockLock } from '../block-lock';\nimport { store as blockEditorStore } from '../../store';\nimport BlockModeToggle from '../block-settings-menu/block-mode-toggle';\nimport { ModifyContentOnlySectionMenuItem } from '../content-lock';\nimport { BlockRenameControl, useBlockRename } from '../block-rename';\nimport { BlockVisibilityMenuItem } from '../block-visibility';\nimport { EditSectionMenuItem } from './edit-section-menu-item';\n\nconst { Fill, Slot } = createSlotFill( 'BlockSettingsMenuControls' );\n\nconst BlockSettingsMenuControlsSlot = ( { fillProps, clientIds = null } ) => {\n\tconst {\n\t\tselectedBlocks,\n\t\tselectedClientIds,\n\t\tisContentOnly,\n\t\tcanToggleSelectedBlocksVisibility,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlocksByClientId,\n\t\t\t\tgetBlockNamesByClientId,\n\t\t\t\tgetSelectedBlockClientIds,\n\t\t\t\tgetBlockEditingMode,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst ids =\n\t\t\t\tclientIds !== null ? clientIds : getSelectedBlockClientIds();\n\t\t\treturn {\n\t\t\t\tselectedBlocks: getBlockNamesByClientId( ids ),\n\t\t\t\tselectedClientIds: ids,\n\t\t\t\tisContentOnly:\n\t\t\t\t\tgetBlockEditingMode( ids[ 0 ] ) === 'contentOnly',\n\t\t\t\tcanToggleSelectedBlocksVisibility: getBlocksByClientId(\n\t\t\t\t\tids\n\t\t\t\t).every( ( block ) =>\n\t\t\t\t\thasBlockSupport( block.name, 'blockVisibility', true )\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ clientIds ]\n\t);\n\n\tconst { canLock } = useBlockLock( selectedClientIds[ 0 ] );\n\tconst { canRename } = useBlockRename( selectedBlocks[ 0 ] );\n\tconst showLockButton =\n\t\tselectedClientIds.length === 1 && canLock && ! isContentOnly;\n\tconst showRenameButton =\n\t\tselectedClientIds.length === 1 && canRename && ! isContentOnly;\n\tconst showVisibilityButton =\n\t\tcanToggleSelectedBlocksVisibility && ! isContentOnly;\n\n\t// Check if current selection of blocks is Groupable or Ungroupable\n\t// and pass this props down to ConvertToGroupButton.\n\tconst convertToGroupButtonProps =\n\t\tuseConvertToGroupButtonProps( selectedClientIds );\n\tconst { isGroupable, isUngroupable } = convertToGroupButtonProps;\n\tconst showConvertToGroupButton =\n\t\t( isGroupable || isUngroupable ) && ! isContentOnly;\n\n\treturn (\n\t\t<Slot\n\t\t\tfillProps={ {\n\t\t\t\t...fillProps,\n\t\t\t\tselectedBlocks,\n\t\t\t\tselectedClientIds,\n\t\t\t} }\n\t\t>\n\t\t\t{ ( fills ) => {\n\t\t\t\tif (\n\t\t\t\t\t! fills?.length > 0 &&\n\t\t\t\t\t! showConvertToGroupButton &&\n\t\t\t\t\t! showLockButton\n\t\t\t\t) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t{ showConvertToGroupButton && (\n\t\t\t\t\t\t\t<ConvertToGroupButton\n\t\t\t\t\t\t\t\t{ ...convertToGroupButtonProps }\n\t\t\t\t\t\t\t\tonClose={ fillProps?.onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ selectedClientIds.length === 1 && (\n\t\t\t\t\t\t\t<EditSectionMenuItem\n\t\t\t\t\t\t\t\tclientId={ selectedClientIds[ 0 ] }\n\t\t\t\t\t\t\t\tonClose={ fillProps?.onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ showLockButton && (\n\t\t\t\t\t\t\t<BlockLockMenuItem\n\t\t\t\t\t\t\t\tclientId={ selectedClientIds[ 0 ] }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ showRenameButton && (\n\t\t\t\t\t\t\t<BlockRenameControl\n\t\t\t\t\t\t\t\tclientId={ selectedClientIds[ 0 ] }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ showVisibilityButton && (\n\t\t\t\t\t\t\t<BlockVisibilityMenuItem\n\t\t\t\t\t\t\t\tclientIds={ selectedClientIds }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ fills }\n\t\t\t\t\t\t{ selectedClientIds.length === 1 && (\n\t\t\t\t\t\t\t<ModifyContentOnlySectionMenuItem\n\t\t\t\t\t\t\t\tclientId={ selectedClientIds[ 0 ] }\n\t\t\t\t\t\t\t\tonClose={ fillProps?.onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ fillProps?.count === 1 && ! isContentOnly && (\n\t\t\t\t\t\t\t<BlockModeToggle\n\t\t\t\t\t\t\t\tclientId={ fillProps?.firstBlockClientId }\n\t\t\t\t\t\t\t\tonToggle={ fillProps?.onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t);\n\t\t\t} }\n\t\t</Slot>\n\t);\n};\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-settings-menu-controls/README.md\n *\n * @param {Object} props Fill props.\n * @return {Element} Element.\n */\nfunction BlockSettingsMenuControls( { ...props } ) {\n\treturn (\n\t\t<StyleProvider document={ document }>\n\t\t\t<Fill { ...props } />\n\t\t</StyleProvider>\n\t);\n}\n\nBlockSettingsMenuControls.Slot = BlockSettingsMenuControlsSlot;\n\nexport default BlockSettingsMenuControls;\n"],
|
|
5
|
+
"m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
|
7
7
|
}
|
|
@@ -52,7 +52,6 @@ function getBlockIconVariant({ select, clientIds }) {
|
|
|
52
52
|
getBlockName,
|
|
53
53
|
getBlockAttributes,
|
|
54
54
|
getBlockParentsByBlockName,
|
|
55
|
-
isSectionBlock,
|
|
56
55
|
canRemoveBlocks,
|
|
57
56
|
getTemplateLock,
|
|
58
57
|
getBlockEditingMode
|
|
@@ -64,8 +63,8 @@ function getBlockIconVariant({ select, clientIds }) {
|
|
|
64
63
|
const isSingleBlock = clientIds.length === 1;
|
|
65
64
|
const blockName = isSingleBlock && getBlockName(clientIds[0]);
|
|
66
65
|
const hasBlockStyles = isSingleBlock && !!getBlockStyles(blockName)?.length;
|
|
67
|
-
const
|
|
68
|
-
(id) =>
|
|
66
|
+
const hasPatternNameInSelection = clientIds.some(
|
|
67
|
+
(id) => !!getBlockAttributes(id)?.metadata?.patternName
|
|
69
68
|
);
|
|
70
69
|
const hasPatternOverrides = clientIds.every(
|
|
71
70
|
(clientId) => (0, import_block_bindings.hasPatternOverridesDefaultBinding)(
|
|
@@ -77,7 +76,7 @@ function getBlockIconVariant({ select, clientIds }) {
|
|
|
77
76
|
);
|
|
78
77
|
const canRemove = canRemoveBlocks(clientIds);
|
|
79
78
|
const isDefaultEditingMode = getBlockEditingMode(clientIds[0]) === "default";
|
|
80
|
-
const _hideTransformsForSections = window?.__experimentalContentOnlyPatternInsertion &&
|
|
79
|
+
const _hideTransformsForSections = window?.__experimentalContentOnlyPatternInsertion && hasPatternNameInSelection;
|
|
81
80
|
const _showBlockSwitcher = !_hideTransformsForSections && isDefaultEditingMode && (hasBlockStyles || canRemove) && !hasTemplateLock;
|
|
82
81
|
const _showPatternOverrides = hasPatternOverrides && hasParentPattern;
|
|
83
82
|
if (_showBlockSwitcher) {
|
|
@@ -91,16 +90,17 @@ function getBlockIcon({ select, clientIds }) {
|
|
|
91
90
|
const { getBlockName, getBlockAttributes } = (0, import_lock_unlock.unlock)(
|
|
92
91
|
select(import_store.store)
|
|
93
92
|
);
|
|
94
|
-
const { getActiveBlockVariation } = select(import_blocks.store);
|
|
95
93
|
const _isSingleBlock = clientIds.length === 1;
|
|
96
94
|
const firstClientId = clientIds[0];
|
|
95
|
+
const blockAttributes = getBlockAttributes(firstClientId);
|
|
96
|
+
if (_isSingleBlock && blockAttributes?.metadata?.patternName && window?.__experimentalContentOnlyPatternInsertion) {
|
|
97
|
+
return import_icons.symbol;
|
|
98
|
+
}
|
|
97
99
|
const blockName = getBlockName(firstClientId);
|
|
98
100
|
const blockType = (0, import_blocks.getBlockType)(blockName);
|
|
99
101
|
if (_isSingleBlock) {
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
getBlockAttributes(firstClientId)
|
|
103
|
-
);
|
|
102
|
+
const { getActiveBlockVariation } = select(import_blocks.store);
|
|
103
|
+
const match = getActiveBlockVariation(blockName, blockAttributes);
|
|
104
104
|
return match?.icon || blockType?.icon;
|
|
105
105
|
}
|
|
106
106
|
const blockNames = clientIds.map((id) => getBlockName(id));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-toolbar/block-toolbar-icon.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { ToolbarButton } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { copy } from '@wordpress/icons';\nimport { getBlockType, store as blocksStore } from '@wordpress/blocks';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport BlockSwitcher from '../block-switcher';\nimport BlockIcon from '../block-icon';\nimport PatternOverridesDropdown from './pattern-overrides-dropdown';\nimport useBlockDisplayTitle from '../block-title/use-block-display-title';\nimport { store as blockEditorStore } from '../../store';\nimport { hasPatternOverridesDefaultBinding } from '../../utils/block-bindings';\nimport { unlock } from '../../lock-unlock';\n\nfunction getBlockIconVariant( { select, clientIds } ) {\n\tconst {\n\t\tgetBlockName,\n\t\tgetBlockAttributes,\n\t\tgetBlockParentsByBlockName,\n\t\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAA8B;AAC9B,kBAAmB;AACnB,kBAA0B;AAC1B,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { ToolbarButton } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { copy, symbol } from '@wordpress/icons';\nimport { getBlockType, store as blocksStore } from '@wordpress/blocks';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport BlockSwitcher from '../block-switcher';\nimport BlockIcon from '../block-icon';\nimport PatternOverridesDropdown from './pattern-overrides-dropdown';\nimport useBlockDisplayTitle from '../block-title/use-block-display-title';\nimport { store as blockEditorStore } from '../../store';\nimport { hasPatternOverridesDefaultBinding } from '../../utils/block-bindings';\nimport { unlock } from '../../lock-unlock';\n\nfunction getBlockIconVariant( { select, clientIds } ) {\n\tconst {\n\t\tgetBlockName,\n\t\tgetBlockAttributes,\n\t\tgetBlockParentsByBlockName,\n\t\tcanRemoveBlocks,\n\t\tgetTemplateLock,\n\t\tgetBlockEditingMode,\n\t} = unlock( select( blockEditorStore ) );\n\tconst { getBlockStyles } = select( blocksStore );\n\n\tconst hasTemplateLock = clientIds.some(\n\t\t( id ) => getTemplateLock( id ) === 'contentOnly'\n\t);\n\n\t// Calculate props only used in this function\n\tconst isSingleBlock = clientIds.length === 1;\n\tconst blockName = isSingleBlock && getBlockName( clientIds[ 0 ] );\n\tconst hasBlockStyles =\n\t\tisSingleBlock && !! getBlockStyles( blockName )?.length;\n\tconst hasPatternNameInSelection = clientIds.some(\n\t\t( id ) => !! getBlockAttributes( id )?.metadata?.patternName\n\t);\n\tconst hasPatternOverrides = clientIds.every( ( clientId ) =>\n\t\thasPatternOverridesDefaultBinding(\n\t\t\tgetBlockAttributes( clientId )?.metadata?.bindings\n\t\t)\n\t);\n\tconst hasParentPattern = clientIds.every(\n\t\t( clientId ) =>\n\t\t\tgetBlockParentsByBlockName( clientId, 'core/block', true ).length >\n\t\t\t0\n\t);\n\tconst canRemove = canRemoveBlocks( clientIds );\n\n\tconst isDefaultEditingMode =\n\t\tgetBlockEditingMode( clientIds[ 0 ] ) === 'default';\n\tconst _hideTransformsForSections =\n\t\twindow?.__experimentalContentOnlyPatternInsertion &&\n\t\thasPatternNameInSelection;\n\tconst _showBlockSwitcher =\n\t\t! _hideTransformsForSections &&\n\t\tisDefaultEditingMode &&\n\t\t( hasBlockStyles || canRemove ) &&\n\t\t! hasTemplateLock;\n\n\tconst _showPatternOverrides = hasPatternOverrides && hasParentPattern;\n\n\tif ( _showBlockSwitcher ) {\n\t\treturn 'switcher';\n\t} else if ( _showPatternOverrides ) {\n\t\treturn 'pattern-overrides';\n\t}\n\n\treturn 'default';\n}\n\nfunction getBlockIcon( { select, clientIds } ) {\n\tconst { getBlockName, getBlockAttributes } = unlock(\n\t\tselect( blockEditorStore )\n\t);\n\n\tconst _isSingleBlock = clientIds.length === 1;\n\tconst firstClientId = clientIds[ 0 ];\n\tconst blockAttributes = getBlockAttributes( firstClientId );\n\tif (\n\t\t_isSingleBlock &&\n\t\tblockAttributes?.metadata?.patternName &&\n\t\twindow?.__experimentalContentOnlyPatternInsertion\n\t) {\n\t\treturn symbol;\n\t}\n\n\tconst blockName = getBlockName( firstClientId );\n\tconst blockType = getBlockType( blockName );\n\n\tif ( _isSingleBlock ) {\n\t\tconst { getActiveBlockVariation } = select( blocksStore );\n\t\tconst match = getActiveBlockVariation( blockName, blockAttributes );\n\t\treturn match?.icon || blockType?.icon;\n\t}\n\n\tconst blockNames = clientIds.map( ( id ) => getBlockName( id ) );\n\tconst isSelectionOfSameType = new Set( blockNames ).size === 1;\n\treturn isSelectionOfSameType ? blockType?.icon : copy;\n}\n\nexport default function BlockToolbarIcon( { clientIds, isSynced } ) {\n\tconst { icon, showIconLabels, variant } = useSelect(\n\t\t( select ) => {\n\t\t\treturn {\n\t\t\t\ticon: getBlockIcon( { select, clientIds } ),\n\t\t\t\tshowIconLabels: select( preferencesStore ).get(\n\t\t\t\t\t'core',\n\t\t\t\t\t'showIconLabels'\n\t\t\t\t),\n\t\t\t\tvariant: getBlockIconVariant( {\n\t\t\t\t\tselect,\n\t\t\t\t\tclientIds,\n\t\t\t\t} ),\n\t\t\t};\n\t\t},\n\t\t[ clientIds ]\n\t);\n\n\tconst blockTitle = useBlockDisplayTitle( {\n\t\tclientId: clientIds?.[ 0 ],\n\t\tmaximumLength: 35,\n\t} );\n\n\tconst isSingleBlock = clientIds.length === 1;\n\tconst showBlockTitle = isSingleBlock && isSynced && ! showIconLabels;\n\tconst label = isSingleBlock ? blockTitle : __( 'Multiple blocks selected' );\n\t// Used to hide the block icon when the showIconLabels preference is enabled, or to display the template title when it's a template.\n\tconst text = showBlockTitle && blockTitle ? blockTitle : undefined;\n\n\tconst BlockIconElement = (\n\t\t<BlockIcon\n\t\t\tclassName=\"block-editor-block-toolbar__block-icon\"\n\t\t\ticon={ icon }\n\t\t/>\n\t);\n\n\tif ( variant === 'switcher' ) {\n\t\treturn (\n\t\t\t<BlockSwitcher\n\t\t\t\tclientIds={ clientIds }\n\t\t\t\tlabel={ label }\n\t\t\t\ttext={ text }\n\t\t\t>\n\t\t\t\t{ BlockIconElement }\n\t\t\t</BlockSwitcher>\n\t\t);\n\t}\n\n\tif ( variant === 'pattern-overrides' ) {\n\t\treturn (\n\t\t\t<PatternOverridesDropdown\n\t\t\t\ticon={ BlockIconElement }\n\t\t\t\tclientIds={ clientIds }\n\t\t\t\tblockTitle={ blockTitle }\n\t\t\t\tlabel={ label }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<ToolbarButton\n\t\t\tdisabled\n\t\t\tclassName=\"block-editor-block-toolbar__block-icon-button\"\n\t\t\ttitle={ label }\n\t\t\ticon={ BlockIconElement }\n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AAM,iBAAa,+BAAAC,SAAsB;AAAA,IACxC,UAAU,YAAa,CAAE;AAAA,IACzB,eAAe;AAAA,EAChB,CAAE;AAEF,QAAM,gBAAgB,UAAU,WAAW;AAC3C,QAAM,iBAAiB,iBAAiB,YAAY,CAAE;AACtD,QAAM,QAAQ,gBAAgB,iBAAa,gBAAI,0BAA2B;AAE1E,QAAM,OAAO,kBAAkB,aAAa,aAAa;AAEzD,QAAM,mBACL;AAAA,IAAC,kBAAAC;AAAA,IAAA;AAAA,MACA,WAAU;AAAA,MACV;AAAA;AAAA,EACD;AAGD,MAAK,YAAY,YAAa;AAC7B,WACC;AAAA,MAAC,sBAAAC;AAAA,MAAA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QAEE;AAAA;AAAA,IACH;AAAA,EAEF;AAEA,MAAK,YAAY,qBAAsB;AACtC,WACC;AAAA,MAAC,kCAAAC;AAAA,MAAA;AAAA,QACA,MAAO;AAAA,QACP;AAAA,QACA;AAAA,QACA;AAAA;AAAA,IACD;AAAA,EAEF;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,UAAQ;AAAA,MACR,WAAU;AAAA,MACV,OAAQ;AAAA,MACR,MAAO;AAAA,MACP;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": ["blockEditorStore", "blocksStore", "preferencesStore", "useBlockDisplayTitle", "BlockIcon", "BlockSwitcher", "PatternOverridesDropdown"]
|
|
7
7
|
}
|
|
@@ -140,7 +140,13 @@ function VariationsToggleGroupControl({
|
|
|
140
140
|
}
|
|
141
141
|
function __experimentalBlockVariationTransforms({ blockClientId }) {
|
|
142
142
|
const { updateBlockAttributes } = (0, import_data.useDispatch)(import_store.store);
|
|
143
|
-
const {
|
|
143
|
+
const {
|
|
144
|
+
activeBlockVariation,
|
|
145
|
+
unfilteredVariations,
|
|
146
|
+
blockName,
|
|
147
|
+
isContentOnly,
|
|
148
|
+
isSection
|
|
149
|
+
} = (0, import_data.useSelect)(
|
|
144
150
|
(select) => {
|
|
145
151
|
const { getActiveBlockVariation, getBlockVariations } = select(import_blocks.store);
|
|
146
152
|
const {
|
|
@@ -150,9 +156,7 @@ function __experimentalBlockVariationTransforms({ blockClientId }) {
|
|
|
150
156
|
isSectionBlock
|
|
151
157
|
} = (0, import_lock_unlock.unlock)(select(import_store.store));
|
|
152
158
|
const name = blockClientId && getBlockName(blockClientId);
|
|
153
|
-
const { hasContentRoleAttribute } = (0, import_lock_unlock.unlock)(
|
|
154
|
-
select(import_blocks.store)
|
|
155
|
-
);
|
|
159
|
+
const { hasContentRoleAttribute } = (0, import_lock_unlock.unlock)(select(import_blocks.store));
|
|
156
160
|
const isContentBlock = hasContentRoleAttribute(name);
|
|
157
161
|
return {
|
|
158
162
|
activeBlockVariation: getActiveBlockVariation(
|
|
@@ -160,13 +164,36 @@ function __experimentalBlockVariationTransforms({ blockClientId }) {
|
|
|
160
164
|
getBlockAttributes(blockClientId),
|
|
161
165
|
"transform"
|
|
162
166
|
),
|
|
163
|
-
|
|
167
|
+
unfilteredVariations: name && getBlockVariations(name, "transform"),
|
|
168
|
+
blockName: name,
|
|
164
169
|
isContentOnly: getBlockEditingMode(blockClientId) === "contentOnly" && !isContentBlock,
|
|
165
170
|
isSection: isSectionBlock(blockClientId)
|
|
166
171
|
};
|
|
167
172
|
},
|
|
168
173
|
[blockClientId]
|
|
169
174
|
);
|
|
175
|
+
const variations = (0, import_element.useMemo)(() => {
|
|
176
|
+
if (blockName === "core/paragraph") {
|
|
177
|
+
if (activeBlockVariation?.name === "stretchy-paragraph" || unfilteredVariations.every(
|
|
178
|
+
(v) => ["paragraph", "stretchy-paragraph"].includes(v.name)
|
|
179
|
+
)) {
|
|
180
|
+
return [];
|
|
181
|
+
}
|
|
182
|
+
return unfilteredVariations.filter(
|
|
183
|
+
(v) => v.name !== "stretchy-paragraph"
|
|
184
|
+
);
|
|
185
|
+
} else if (blockName === "core/heading") {
|
|
186
|
+
if (activeBlockVariation?.name === "stretchy-heading" || unfilteredVariations.every(
|
|
187
|
+
(v) => ["heading", "stretchy-heading"].includes(v.name)
|
|
188
|
+
)) {
|
|
189
|
+
return [];
|
|
190
|
+
}
|
|
191
|
+
return unfilteredVariations.filter(
|
|
192
|
+
(v) => v.name !== "stretchy-heading"
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
return unfilteredVariations;
|
|
196
|
+
}, [activeBlockVariation?.name, blockName, unfilteredVariations]);
|
|
170
197
|
const selectedValue = activeBlockVariation?.name;
|
|
171
198
|
const hasUniqueIcons = (0, import_element.useMemo)(() => {
|
|
172
199
|
const variationIcons = /* @__PURE__ */ new Set();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-variation-transforms/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tButton,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,\n\tVisuallyHidden,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { Menu } = unlock( componentsPrivateApis );\n\nfunction VariationsButtons( {\n\tclassName,\n\tonSelectVariation,\n\tselectedValue,\n\tvariations,\n} ) {\n\treturn (\n\t\t<fieldset className={ className }>\n\t\t\t<VisuallyHidden as=\"legend\">\n\t\t\t\t{ __( 'Transform to variation' ) }\n\t\t\t</VisuallyHidden>\n\t\t\t{ variations.map( ( variation ) => (\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\tkey={ variation.name }\n\t\t\t\t\ticon={ <BlockIcon icon={ variation.icon } showColors /> }\n\t\t\t\t\tisPressed={ selectedValue === variation.name }\n\t\t\t\t\tlabel={\n\t\t\t\t\t\tselectedValue === variation.name\n\t\t\t\t\t\t\t? variation.title\n\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: Block or block variation name. */\n\t\t\t\t\t\t\t\t\t__( 'Transform to %s' ),\n\t\t\t\t\t\t\t\t\tvariation.title\n\t\t\t\t\t\t\t )\n\t\t\t\t\t}\n\t\t\t\t\tonClick={ () => onSelectVariation( variation.name ) }\n\t\t\t\t\taria-label={ variation.title }\n\t\t\t\t\tshowTooltip\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</fieldset>\n\t);\n}\n\nfunction VariationsDropdown( {\n\tclassName,\n\tonSelectVariation,\n\tselectedValue,\n\tvariations,\n} ) {\n\treturn (\n\t\t<div className={ className }>\n\t\t\t<Menu>\n\t\t\t\t<Menu.TriggerButton\n\t\t\t\t\trender={\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"block-editor-block-variation-transforms__button\"\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Transform to variation' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t<Menu.Popover position=\"bottom\">\n\t\t\t\t\t<Menu.Group>\n\t\t\t\t\t\t{ variations.map( ( variation ) => (\n\t\t\t\t\t\t\t<Menu.RadioItem\n\t\t\t\t\t\t\t\tkey={ variation.name }\n\t\t\t\t\t\t\t\tvalue={ variation.name }\n\t\t\t\t\t\t\t\tchecked={ selectedValue === variation.name }\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tonSelectVariation( variation.name )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t{ variation.title }\n\t\t\t\t\t\t\t\t</Menu.ItemLabel>\n\t\t\t\t\t\t\t\t{ variation.description && (\n\t\t\t\t\t\t\t\t\t<Menu.ItemHelpText>\n\t\t\t\t\t\t\t\t\t\t{ variation.description }\n\t\t\t\t\t\t\t\t\t</Menu.ItemHelpText>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</Menu.RadioItem>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t</Menu.Group>\n\t\t\t\t</Menu.Popover>\n\t\t\t</Menu>\n\t\t</div>\n\t);\n}\n\nfunction VariationsToggleGroupControl( {\n\tclassName,\n\tonSelectVariation,\n\tselectedValue,\n\tvariations,\n} ) {\n\treturn (\n\t\t<div className={ className }>\n\t\t\t<ToggleGroupControl\n\t\t\t\tlabel={ __( 'Transform to variation' ) }\n\t\t\t\tvalue={ selectedValue }\n\t\t\t\thideLabelFromVision\n\t\t\t\tonChange={ onSelectVariation }\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t>\n\t\t\t\t{ variations.map( ( variation ) => (\n\t\t\t\t\t<ToggleGroupControlOptionIcon\n\t\t\t\t\t\tkey={ variation.name }\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<BlockIcon icon={ variation.icon } showColors />\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvalue={ variation.name }\n\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\tselectedValue === variation.name\n\t\t\t\t\t\t\t\t? variation.title\n\t\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t\t/* translators: %s: Block or block variation name. */\n\t\t\t\t\t\t\t\t\t\t__( 'Transform to %s' ),\n\t\t\t\t\t\t\t\t\t\tvariation.title\n\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</ToggleGroupControl>\n\t\t</div>\n\t);\n}\n\nfunction __experimentalBlockVariationTransforms( { blockClientId } ) {\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\tconst {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAAqC;AACrC,kBAA4B;AAC5B,wBAMO;AACP,kBAAuC;AACvC,qBAAwB;AAKxB,wBAAsB;AACtB,mBAA0C;AAC1C,yBAAuB;AAWrB;AATF,IAAM,EAAE,KAAK,QAAI,2BAAQ,kBAAAA,WAAsB;AAE/C,SAAS,kBAAmB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,SACC,6CAAC,cAAS,WACT;AAAA,gDAAC,oCAAe,IAAG,UAChB,8BAAI,wBAAyB,GAChC;AAAA,IACE,WAAW,IAAK,CAAE,cACnB;AAAA,MAAC;AAAA;AAAA,QACA,uBAAqB;AAAA,QACrB,MAAK;AAAA,QAEL,MAAO,4CAAC,kBAAAC,SAAA,EAAU,MAAO,UAAU,MAAO,YAAU,MAAC;AAAA,QACrD,WAAY,kBAAkB,UAAU;AAAA,QACxC,OACC,kBAAkB,UAAU,OACzB,UAAU,YACV;AAAA;AAAA,cAEA,gBAAI,iBAAkB;AAAA,UACtB,UAAU;AAAA,QACV;AAAA,QAEJ,SAAU,MAAM,kBAAmB,UAAU,IAAK;AAAA,QAClD,cAAa,UAAU;AAAA,QACvB,aAAW;AAAA;AAAA,MAdL,UAAU;AAAA,IAejB,CACC;AAAA,KACH;AAEF;AAEA,SAAS,mBAAoB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,SACC,4CAAC,SAAI,WACJ,uDAAC,QACA;AAAA;AAAA,MAAC,KAAK;AAAA,MAAL;AAAA,QACA,QACC;AAAA,UAAC;AAAA;AAAA,YACA,WAAU;AAAA,YACV,uBAAqB;AAAA,YACrB,SAAQ;AAAA,YAE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Press dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tButton,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,\n\tVisuallyHidden,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { Menu } = unlock( componentsPrivateApis );\n\nfunction VariationsButtons( {\n\tclassName,\n\tonSelectVariation,\n\tselectedValue,\n\tvariations,\n} ) {\n\treturn (\n\t\t<fieldset className={ className }>\n\t\t\t<VisuallyHidden as=\"legend\">\n\t\t\t\t{ __( 'Transform to variation' ) }\n\t\t\t</VisuallyHidden>\n\t\t\t{ variations.map( ( variation ) => (\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\tkey={ variation.name }\n\t\t\t\t\ticon={ <BlockIcon icon={ variation.icon } showColors /> }\n\t\t\t\t\tisPressed={ selectedValue === variation.name }\n\t\t\t\t\tlabel={\n\t\t\t\t\t\tselectedValue === variation.name\n\t\t\t\t\t\t\t? variation.title\n\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: Block or block variation name. */\n\t\t\t\t\t\t\t\t\t__( 'Transform to %s' ),\n\t\t\t\t\t\t\t\t\tvariation.title\n\t\t\t\t\t\t\t )\n\t\t\t\t\t}\n\t\t\t\t\tonClick={ () => onSelectVariation( variation.name ) }\n\t\t\t\t\taria-label={ variation.title }\n\t\t\t\t\tshowTooltip\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</fieldset>\n\t);\n}\n\nfunction VariationsDropdown( {\n\tclassName,\n\tonSelectVariation,\n\tselectedValue,\n\tvariations,\n} ) {\n\treturn (\n\t\t<div className={ className }>\n\t\t\t<Menu>\n\t\t\t\t<Menu.TriggerButton\n\t\t\t\t\trender={\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"block-editor-block-variation-transforms__button\"\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Transform to variation' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t<Menu.Popover position=\"bottom\">\n\t\t\t\t\t<Menu.Group>\n\t\t\t\t\t\t{ variations.map( ( variation ) => (\n\t\t\t\t\t\t\t<Menu.RadioItem\n\t\t\t\t\t\t\t\tkey={ variation.name }\n\t\t\t\t\t\t\t\tvalue={ variation.name }\n\t\t\t\t\t\t\t\tchecked={ selectedValue === variation.name }\n\t\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\t\tonSelectVariation( variation.name )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Menu.ItemLabel>\n\t\t\t\t\t\t\t\t\t{ variation.title }\n\t\t\t\t\t\t\t\t</Menu.ItemLabel>\n\t\t\t\t\t\t\t\t{ variation.description && (\n\t\t\t\t\t\t\t\t\t<Menu.ItemHelpText>\n\t\t\t\t\t\t\t\t\t\t{ variation.description }\n\t\t\t\t\t\t\t\t\t</Menu.ItemHelpText>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</Menu.RadioItem>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t</Menu.Group>\n\t\t\t\t</Menu.Popover>\n\t\t\t</Menu>\n\t\t</div>\n\t);\n}\n\nfunction VariationsToggleGroupControl( {\n\tclassName,\n\tonSelectVariation,\n\tselectedValue,\n\tvariations,\n} ) {\n\treturn (\n\t\t<div className={ className }>\n\t\t\t<ToggleGroupControl\n\t\t\t\tlabel={ __( 'Transform to variation' ) }\n\t\t\t\tvalue={ selectedValue }\n\t\t\t\thideLabelFromVision\n\t\t\t\tonChange={ onSelectVariation }\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t>\n\t\t\t\t{ variations.map( ( variation ) => (\n\t\t\t\t\t<ToggleGroupControlOptionIcon\n\t\t\t\t\t\tkey={ variation.name }\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<BlockIcon icon={ variation.icon } showColors />\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvalue={ variation.name }\n\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\tselectedValue === variation.name\n\t\t\t\t\t\t\t\t? variation.title\n\t\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t\t/* translators: %s: Block or block variation name. */\n\t\t\t\t\t\t\t\t\t\t__( 'Transform to %s' ),\n\t\t\t\t\t\t\t\t\t\tvariation.title\n\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</ToggleGroupControl>\n\t\t</div>\n\t);\n}\n\nfunction __experimentalBlockVariationTransforms( { blockClientId } ) {\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\tconst {\n\t\tactiveBlockVariation,\n\t\tunfilteredVariations,\n\t\tblockName,\n\t\tisContentOnly,\n\t\tisSection,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getActiveBlockVariation, getBlockVariations } =\n\t\t\t\tselect( blocksStore );\n\n\t\t\tconst {\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetBlockEditingMode,\n\t\t\t\tisSectionBlock,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\n\t\t\tconst name = blockClientId && getBlockName( blockClientId );\n\n\t\t\tconst { hasContentRoleAttribute } = unlock( select( blocksStore ) );\n\t\t\tconst isContentBlock = hasContentRoleAttribute( name );\n\n\t\t\treturn {\n\t\t\t\tactiveBlockVariation: getActiveBlockVariation(\n\t\t\t\t\tname,\n\t\t\t\t\tgetBlockAttributes( blockClientId ),\n\t\t\t\t\t'transform'\n\t\t\t\t),\n\t\t\t\tunfilteredVariations:\n\t\t\t\t\tname && getBlockVariations( name, 'transform' ),\n\t\t\t\tblockName: name,\n\t\t\t\tisContentOnly:\n\t\t\t\t\tgetBlockEditingMode( blockClientId ) === 'contentOnly' &&\n\t\t\t\t\t! isContentBlock,\n\t\t\t\tisSection: isSectionBlock( blockClientId ),\n\t\t\t};\n\t\t},\n\t\t[ blockClientId ]\n\t);\n\n\t/*\n\t * Hack for WordPress 6.9\n\t *\n\t * The Stretchy blocks shipped in 6.9 were ultimately\n\t * implemented as block variations of the base types Paragraph\n\t * and Heading. See #73056 for discussion and trade-offs.\n\t *\n\t * The main drawback of this choice is that the Variations API\n\t * doesn't offer enough control over how prominent and how tied\n\t * to the base type a variation should be.\n\t *\n\t * In order to ship these new \"blocks\" with an acceptable UX,\n\t * we need two hacks until the Variations API is improved:\n\t *\n\t * - Don't show the variations switcher in the block inspector\n\t * for Paragraph, Heading, Stretchy Paragraph and Stretchy\n\t * Heading (implemented below). Transformations are still\n\t * available in the block switcher.\n\t *\n\t * - Move the stretchy variations to the end of the core blocks\n\t * list in the block inserter (implemented in\n\t * getInserterItems in #73056).\n\t */\n\tconst variations = useMemo( () => {\n\t\tif ( blockName === 'core/paragraph' ) {\n\t\t\t// Always hide options when active variation is stretchy, but\n\t\t\t// ensure that there are no third-party variations before doing the\n\t\t\t// same elsewhere.\n\t\t\tif (\n\t\t\t\tactiveBlockVariation?.name === 'stretchy-paragraph' ||\n\t\t\t\tunfilteredVariations.every( ( v ) =>\n\t\t\t\t\t[ 'paragraph', 'stretchy-paragraph' ].includes( v.name )\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\t// If there are other variations, only hide the stretchy one.\n\t\t\treturn unfilteredVariations.filter(\n\t\t\t\t( v ) => v.name !== 'stretchy-paragraph'\n\t\t\t);\n\t\t} else if ( blockName === 'core/heading' ) {\n\t\t\tif (\n\t\t\t\tactiveBlockVariation?.name === 'stretchy-heading' ||\n\t\t\t\tunfilteredVariations.every( ( v ) =>\n\t\t\t\t\t[ 'heading', 'stretchy-heading' ].includes( v.name )\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\treturn unfilteredVariations.filter(\n\t\t\t\t( v ) => v.name !== 'stretchy-heading'\n\t\t\t);\n\t\t}\n\t\treturn unfilteredVariations;\n\t}, [ activeBlockVariation?.name, blockName, unfilteredVariations ] );\n\n\tconst selectedValue = activeBlockVariation?.name;\n\n\t// Check if each variation has a unique icon.\n\tconst hasUniqueIcons = useMemo( () => {\n\t\tconst variationIcons = new Set();\n\t\tif ( ! variations ) {\n\t\t\treturn false;\n\t\t}\n\t\tvariations.forEach( ( variation ) => {\n\t\t\tif ( variation.icon ) {\n\t\t\t\tvariationIcons.add( variation.icon?.src || variation.icon );\n\t\t\t}\n\t\t} );\n\t\treturn variationIcons.size === variations.length;\n\t}, [ variations ] );\n\n\tconst onSelectVariation = ( variationName ) => {\n\t\tupdateBlockAttributes( blockClientId, {\n\t\t\t...variations.find( ( { name } ) => name === variationName )\n\t\t\t\t.attributes,\n\t\t} );\n\t};\n\n\tconst hideVariationsForSections =\n\t\twindow?.__experimentalContentOnlyPatternInsertion && isSection;\n\n\tif ( ! variations?.length || isContentOnly || hideVariationsForSections ) {\n\t\treturn null;\n\t}\n\n\tconst baseClass = 'block-editor-block-variation-transforms';\n\n\t// Show buttons if there are more than 5 variations because the ToggleGroupControl does not wrap\n\tconst showButtons = variations.length > 5;\n\n\tconst ButtonComponent = showButtons\n\t\t? VariationsButtons\n\t\t: VariationsToggleGroupControl;\n\n\tconst Component = hasUniqueIcons ? ButtonComponent : VariationsDropdown;\n\n\treturn (\n\t\t<Component\n\t\t\tclassName={ baseClass }\n\t\t\tonSelectVariation={ onSelectVariation }\n\t\t\tselectedValue={ selectedValue }\n\t\t\tvariations={ variations }\n\t\t/>\n\t);\n}\n\nexport default __experimentalBlockVariationTransforms;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAAqC;AACrC,kBAA4B;AAC5B,wBAMO;AACP,kBAAuC;AACvC,qBAAwB;AAKxB,wBAAsB;AACtB,mBAA0C;AAC1C,yBAAuB;AAWrB;AATF,IAAM,EAAE,KAAK,QAAI,2BAAQ,kBAAAA,WAAsB;AAE/C,SAAS,kBAAmB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,SACC,6CAAC,cAAS,WACT;AAAA,gDAAC,oCAAe,IAAG,UAChB,8BAAI,wBAAyB,GAChC;AAAA,IACE,WAAW,IAAK,CAAE,cACnB;AAAA,MAAC;AAAA;AAAA,QACA,uBAAqB;AAAA,QACrB,MAAK;AAAA,QAEL,MAAO,4CAAC,kBAAAC,SAAA,EAAU,MAAO,UAAU,MAAO,YAAU,MAAC;AAAA,QACrD,WAAY,kBAAkB,UAAU;AAAA,QACxC,OACC,kBAAkB,UAAU,OACzB,UAAU,YACV;AAAA;AAAA,cAEA,gBAAI,iBAAkB;AAAA,UACtB,UAAU;AAAA,QACV;AAAA,QAEJ,SAAU,MAAM,kBAAmB,UAAU,IAAK;AAAA,QAClD,cAAa,UAAU;AAAA,QACvB,aAAW;AAAA;AAAA,MAdL,UAAU;AAAA,IAejB,CACC;AAAA,KACH;AAEF;AAEA,SAAS,mBAAoB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,SACC,4CAAC,SAAI,WACJ,uDAAC,QACA;AAAA;AAAA,MAAC,KAAK;AAAA,MAAL;AAAA,QACA,QACC;AAAA,UAAC;AAAA;AAAA,YACA,WAAU;AAAA,YACV,uBAAqB;AAAA,YACrB,SAAQ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AACA,WAAO;AAAA,EACR,GAAG,CAAE,sBAAsB,MAAM,WAAW,oBAAqB,CAAE;AAEnE,QAAM,gBAAgB,sBAAsB;AAG5C,QAAM,qBAAiB,wBAAS,MAAM;AACrC,UAAM,iBAAiB,oBAAI,IAAI;AAC/B,QAAK,CAAE,YAAa;AACnB,aAAO;AAAA,IACR;AACA,eAAW,QAAS,CAAE,cAAe;AACpC,UAAK,UAAU,MAAO;AACrB,uBAAe,IAAK,UAAU,MAAM,OAAO,UAAU,IAAK;AAAA,MAC3D;AAAA,IACD,CAAE;AACF,WAAO,eAAe,SAAS,WAAW;AAAA,EAC3C,GAAG,CAAE,UAAW,CAAE;AAElB,QAAM,oBAAoB,CAAE,kBAAmB;AAC9C,0BAAuB,eAAe;AAAA,MACrC,GAAG,WAAW,KAAM,CAAE,EAAE,KAAK,MAAO,SAAS,aAAc,EACzD;AAAA,IACH,CAAE;AAAA,EACH;AAEA,QAAM,4BACL,QAAQ,6CAA6C;AAEtD,MAAK,CAAE,YAAY,UAAU,iBAAiB,2BAA4B;AACzE,WAAO;AAAA,EACR;AAEA,QAAM,YAAY;AAGlB,QAAM,cAAc,WAAW,SAAS;AAExC,QAAM,kBAAkB,cACrB,oBACA;AAEH,QAAM,YAAY,iBAAiB,kBAAkB;AAErD,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAY;AAAA,MACZ;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACD;AAEF;AAEA,IAAO,qCAAQ;",
|
|
6
6
|
"names": ["componentsPrivateApis", "BlockIcon", "ToggleGroupControl", "ToggleGroupControlOptionIcon", "blockEditorStore", "blocksStore"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/border-radius-control/single-input-control.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalHStack as HStack,\n\tIcon,\n\tTooltip,\n\tRangeControl,\n\tButton,\n\tCustomSelectControl,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { settings } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetAllValue,\n\tgetCustomValueFromPreset,\n\tgetPresetValueFromControlValue,\n\tgetPresetValueFromCustomValue,\n\tgetSliderValueFromPreset,\n\tisValuePreset,\n\tconvertPresetsToCustomValues,\n} from './utils';\nimport {\n\tCORNERS,\n\tICONS,\n\tMIN_BORDER_RADIUS_VALUE,\n\tMAX_BORDER_RADIUS_VALUES,\n\tRANGE_CONTROL_MAX_SIZE,\n} from './constants';\n\nexport default function SingleInputControl( {\n\tcorner,\n\tonChange,\n\tselectedUnits,\n\tsetSelectedUnits,\n\tvalues: valuesProp,\n\tunits,\n\tpresets,\n} ) {\n\tconst changeCornerValue = ( validatedValue ) => {\n\t\tif ( corner === 'all' ) {\n\t\t\tonChange( {\n\t\t\t\ttopLeft: validatedValue,\n\t\t\t\ttopRight: validatedValue,\n\t\t\t\tbottomLeft: validatedValue,\n\t\t\t\tbottomRight: validatedValue,\n\t\t\t} );\n\t\t} else {\n\t\t\tonChange( {\n\t\t\t\t...values,\n\t\t\t\t[ corner ]: validatedValue,\n\t\t\t} );\n\t\t}\n\t};\n\n\tconst onChangeValue = ( next ) => {\n\t\tif ( ! onChange ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Filter out CSS-unit-only values to prevent invalid styles.\n\t\tconst isNumeric = ! isNaN( parseFloat( next ) );\n\t\tconst nextValue = isNumeric ? next : undefined;\n\t\tchangeCornerValue( nextValue );\n\t};\n\n\tconst onChangeUnit = ( next ) => {\n\t\tconst newUnits = { ...selectedUnits };\n\t\tif ( corner === 'all' ) {\n\t\t\tnewUnits.topLeft = next;\n\t\t\tnewUnits.topRight = next;\n\t\t\tnewUnits.bottomLeft = next;\n\t\t\tnewUnits.bottomRight = next;\n\t\t} else {\n\t\t\tnewUnits[ corner ] = next;\n\t\t}\n\t\tsetSelectedUnits( newUnits );\n\t};\n\n\t// For shorthand style & backwards compatibility, handle flat string value.\n\tconst values =\n\t\ttypeof valuesProp !== 'string'\n\t\t\t? valuesProp\n\t\t\t: {\n\t\t\t\t\ttopLeft: valuesProp,\n\t\t\t\t\ttopRight: valuesProp,\n\t\t\t\t\tbottomLeft: valuesProp,\n\t\t\t\t\tbottomRight: valuesProp,\n\t\t\t };\n\n\t// For 'all' corner, convert presets to custom values before calling getAllValue\n\t// For individual corners, check if the value should be converted to a preset\n\tlet value;\n\tif ( corner === 'all' ) {\n\t\tconst convertedValues = convertPresetsToCustomValues( values, presets );\n\t\tconst customValue = getAllValue( convertedValues );\n\t\tvalue = getPresetValueFromCustomValue( customValue, presets );\n\t} else {\n\t\tvalue = getPresetValueFromCustomValue( values[ corner ], presets );\n\t}\n\tconst resolvedPresetValue = isValuePreset( value )\n\t\t? getCustomValueFromPreset( value, presets )\n\t\t: value;\n\tconst [ parsedQuantity, parsedUnit ] =\n\t\tparseQuantityAndUnitFromRawValue( resolvedPresetValue );\n\tconst computedUnit = value\n\t\t? parsedUnit\n\t\t: selectedUnits[ corner ] || selectedUnits.flat || 'px';\n\tconst unitConfig =\n\t\tunits && units.find( ( item ) => item.value === computedUnit );\n\tconst step = unitConfig?.step || 1;\n\tconst [ showCustomValueControl, setShowCustomValueControl ] = useState(\n\t\tvalue !== undefined && ! isValuePreset( value )\n\t);\n\tconst showRangeControl = presets.length <= RANGE_CONTROL_MAX_SIZE;\n\tconst presetIndex = getSliderValueFromPreset( value, presets );\n\tconst rangeTooltip = ( newValue ) =>\n\t\tvalue === undefined ? undefined : presets[ newValue ]?.name;\n\tconst marks = presets\n\t\t.slice( 1, presets.length - 1 )\n\t\t.map( ( _newValue, index ) => ( {\n\t\t\tvalue: index + 1,\n\t\t\tlabel: undefined,\n\t\t} ) );\n\tconst hasPresets = marks.length > 0;\n\tlet options = [];\n\tif ( ! showRangeControl ) {\n\t\toptions = [\n\t\t\t...presets,\n\t\t\t{\n\t\t\t\tname: __( 'Custom' ),\n\t\t\t\tslug: 'custom',\n\t\t\t\tsize: resolvedPresetValue,\n\t\t\t},\n\t\t].map( ( size, index ) => ( {\n\t\t\tkey: index,\n\t\t\tname: size.name,\n\t\t} ) );\n\t}\n\tconst icon = ICONS[ corner ];\n\n\tconst handleSliderChange = ( next ) => {\n\t\tconst val =\n\t\t\tnext !== undefined ? `${ next }${ computedUnit }` : undefined;\n\t\tchangeCornerValue( val );\n\t};\n\n\t// Controls are wrapped in tooltips as visible labels aren't desired here.\n\t// Tooltip rendering also requires the UnitControl to be wrapped. See:\n\t// https://github.com/WordPress/gutenberg/pull/24966#issuecomment-685875026\n\treturn (\n\t\t<HStack>\n\t\t\t{ icon && (\n\t\t\t\t<Icon\n\t\t\t\t\tclassName=\"components-border-radius-control__icon\"\n\t\t\t\t\ticon={ icon }\n\t\t\t\t\tsize={ 24 }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ( ! hasPresets || showCustomValueControl ) && (\n\t\t\t\t<div className=\"components-border-radius-control__input-controls-wrapper\">\n\t\t\t\t\t<Tooltip text={ CORNERS[ corner ] } placement=\"top\">\n\t\t\t\t\t\t<div className=\"components-border-radius-control__tooltip-wrapper\">\n\t\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\t\tclassName=\"components-border-radius-control__unit-control\"\n\t\t\t\t\t\t\t\taria-label={ CORNERS[ corner ] }\n\t\t\t\t\t\t\t\tvalue={ [ parsedQuantity, computedUnit ].join(\n\t\t\t\t\t\t\t\t\t''\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tonChange={ onChangeValue }\n\t\t\t\t\t\t\t\tonUnitChange={ onChangeUnit }\n\t\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\t\tmin={ MIN_BORDER_RADIUS_VALUE }\n\t\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</Tooltip>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Border radius' ) }\n\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\tclassName=\"components-border-radius-control__range-control\"\n\t\t\t\t\t\tvalue={ parsedQuantity ?? '' }\n\t\t\t\t\t\tmin={ MIN_BORDER_RADIUS_VALUE }\n\t\t\t\t\t\tmax={ MAX_BORDER_RADIUS_VALUES[ computedUnit ] }\n\t\t\t\t\t\tinitialPosition={ 0 }\n\t\t\t\t\t\twithInputField={ false }\n\t\t\t\t\t\tonChange={ handleSliderChange }\n\t\t\t\t\t\tstep={ step }\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ hasPresets && showRangeControl && ! showCustomValueControl && (\n\t\t\t\t<RangeControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tclassName=\"components-border-radius-control__range-control\"\n\t\t\t\t\tvalue={ presetIndex }\n\t\t\t\t\tonChange={ ( newSize ) => {\n\t\t\t\t\t\tchangeCornerValue(\n\t\t\t\t\t\t\tgetPresetValueFromControlValue(\n\t\t\t\t\t\t\t\tnewSize,\n\t\t\t\t\t\t\t\t'range',\n\t\t\t\t\t\t\t\tpresets\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t\twithInputField={ false }\n\t\t\t\t\taria-valuenow={ presetIndex }\n\t\t\t\t\taria-valuetext={ presets[ presetIndex ]?.name }\n\t\t\t\t\trenderTooltipContent={ rangeTooltip }\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tmax={ presets.length - 1 }\n\t\t\t\t\tmarks={ marks }\n\t\t\t\t\tlabel={ CORNERS[ corner ] }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ ! showRangeControl && ! showCustomValueControl && (\n\t\t\t\t<CustomSelectControl\n\t\t\t\t\tclassName=\"components-border-radius-control__custom-select-control\"\n\t\t\t\t\tvalue={\n\t\t\t\t\t\toptions.find(\n\t\t\t\t\t\t\t( option ) => option.key === presetIndex\n\t\t\t\t\t\t) || options[ options.length - 1 ]\n\t\t\t\t\t}\n\t\t\t\t\tonChange={ ( selection ) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tselection.selectedItem.key ===\n\t\t\t\t\t\t\toptions.length - 1\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tsetShowCustomValueControl( true );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tchangeCornerValue(\n\t\t\t\t\t\t\t\tgetPresetValueFromControlValue(\n\t\t\t\t\t\t\t\t\tselection.selectedItem.key,\n\t\t\t\t\t\t\t\t\t'selectList',\n\t\t\t\t\t\t\t\t\tpresets\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\toptions={ options }\n\t\t\t\t\tlabel={ CORNERS[ corner ] }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasPresets && (\n\t\t\t\t<Button\n\t\t\t\t\tlabel={\n\t\t\t\t\t\tshowCustomValueControl\n\t\t\t\t\t\t\t? __( 'Use border radius preset' )\n\t\t\t\t\t\t\t: __( 'Set custom border radius' )\n\t\t\t\t\t}\n\t\t\t\t\ticon={ settings }\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tsetShowCustomValueControl( ! showCustomValueControl );\n\t\t\t\t\t} }\n\t\t\t\t\tisPressed={ showCustomValueControl }\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t\tclassName=\"components-border-radius-control__custom-toggle\"\n\t\t\t\t\ticonSize={ 24 }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</HStack>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBASO;AACP,kBAAmB;AACnB,qBAAyB;AACzB,mBAAyB;AAKzB,mBAQO;AACP,uBAMO;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalHStack as HStack,\n\tIcon,\n\tTooltip,\n\tRangeControl,\n\tButton,\n\tCustomSelectControl,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { settings } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetAllValue,\n\tgetCustomValueFromPreset,\n\tgetPresetValueFromControlValue,\n\tgetPresetValueFromCustomValue,\n\tgetSliderValueFromPreset,\n\tisValuePreset,\n\tconvertPresetsToCustomValues,\n} from './utils';\nimport {\n\tCORNERS,\n\tICONS,\n\tMIN_BORDER_RADIUS_VALUE,\n\tMAX_BORDER_RADIUS_VALUES,\n\tRANGE_CONTROL_MAX_SIZE,\n} from './constants';\n\nexport default function SingleInputControl( {\n\tcorner,\n\tonChange,\n\tselectedUnits,\n\tsetSelectedUnits,\n\tvalues: valuesProp,\n\tunits,\n\tpresets,\n} ) {\n\tconst changeCornerValue = ( validatedValue ) => {\n\t\tif ( corner === 'all' ) {\n\t\t\tonChange( {\n\t\t\t\ttopLeft: validatedValue,\n\t\t\t\ttopRight: validatedValue,\n\t\t\t\tbottomLeft: validatedValue,\n\t\t\t\tbottomRight: validatedValue,\n\t\t\t} );\n\t\t} else {\n\t\t\tonChange( {\n\t\t\t\t...values,\n\t\t\t\t[ corner ]: validatedValue,\n\t\t\t} );\n\t\t}\n\t};\n\n\tconst onChangeValue = ( next ) => {\n\t\tif ( ! onChange ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Filter out CSS-unit-only values to prevent invalid styles.\n\t\tconst isNumeric = ! isNaN( parseFloat( next ) );\n\t\tconst nextValue = isNumeric ? next : undefined;\n\t\tchangeCornerValue( nextValue );\n\t};\n\n\tconst onChangeUnit = ( next ) => {\n\t\tconst newUnits = { ...selectedUnits };\n\t\tif ( corner === 'all' ) {\n\t\t\tnewUnits.flat = next;\n\t\t\tnewUnits.topLeft = next;\n\t\t\tnewUnits.topRight = next;\n\t\t\tnewUnits.bottomLeft = next;\n\t\t\tnewUnits.bottomRight = next;\n\t\t} else {\n\t\t\tnewUnits[ corner ] = next;\n\t\t}\n\t\tsetSelectedUnits( newUnits );\n\t};\n\n\t// For shorthand style & backwards compatibility, handle flat string value.\n\tconst values =\n\t\ttypeof valuesProp !== 'string'\n\t\t\t? valuesProp\n\t\t\t: {\n\t\t\t\t\ttopLeft: valuesProp,\n\t\t\t\t\ttopRight: valuesProp,\n\t\t\t\t\tbottomLeft: valuesProp,\n\t\t\t\t\tbottomRight: valuesProp,\n\t\t\t };\n\n\t// For 'all' corner, convert presets to custom values before calling getAllValue\n\t// For individual corners, check if the value should be converted to a preset\n\tlet value;\n\tif ( corner === 'all' ) {\n\t\tconst convertedValues = convertPresetsToCustomValues( values, presets );\n\t\tconst customValue = getAllValue( convertedValues );\n\t\tvalue = getPresetValueFromCustomValue( customValue, presets );\n\t} else {\n\t\tvalue = getPresetValueFromCustomValue( values[ corner ], presets );\n\t}\n\tconst resolvedPresetValue = isValuePreset( value )\n\t\t? getCustomValueFromPreset( value, presets )\n\t\t: value;\n\tconst [ parsedQuantity, parsedUnit ] =\n\t\tparseQuantityAndUnitFromRawValue( resolvedPresetValue );\n\tconst computedUnit = value\n\t\t? parsedUnit\n\t\t: selectedUnits[ corner ] || selectedUnits.flat || 'px';\n\tconst unitConfig =\n\t\tunits && units.find( ( item ) => item.value === computedUnit );\n\tconst step = unitConfig?.step || 1;\n\tconst [ showCustomValueControl, setShowCustomValueControl ] = useState(\n\t\tvalue !== undefined && ! isValuePreset( value )\n\t);\n\tconst showRangeControl = presets.length <= RANGE_CONTROL_MAX_SIZE;\n\tconst presetIndex = getSliderValueFromPreset( value, presets );\n\tconst rangeTooltip = ( newValue ) =>\n\t\tvalue === undefined ? undefined : presets[ newValue ]?.name;\n\tconst marks = presets\n\t\t.slice( 1, presets.length - 1 )\n\t\t.map( ( _newValue, index ) => ( {\n\t\t\tvalue: index + 1,\n\t\t\tlabel: undefined,\n\t\t} ) );\n\tconst hasPresets = marks.length > 0;\n\tlet options = [];\n\tif ( ! showRangeControl ) {\n\t\toptions = [\n\t\t\t...presets,\n\t\t\t{\n\t\t\t\tname: __( 'Custom' ),\n\t\t\t\tslug: 'custom',\n\t\t\t\tsize: resolvedPresetValue,\n\t\t\t},\n\t\t].map( ( size, index ) => ( {\n\t\t\tkey: index,\n\t\t\tname: size.name,\n\t\t} ) );\n\t}\n\tconst icon = ICONS[ corner ];\n\n\tconst handleSliderChange = ( next ) => {\n\t\tconst val =\n\t\t\tnext !== undefined ? `${ next }${ computedUnit }` : undefined;\n\t\tchangeCornerValue( val );\n\t};\n\n\t// Controls are wrapped in tooltips as visible labels aren't desired here.\n\t// Tooltip rendering also requires the UnitControl to be wrapped. See:\n\t// https://github.com/WordPress/gutenberg/pull/24966#issuecomment-685875026\n\treturn (\n\t\t<HStack>\n\t\t\t{ icon && (\n\t\t\t\t<Icon\n\t\t\t\t\tclassName=\"components-border-radius-control__icon\"\n\t\t\t\t\ticon={ icon }\n\t\t\t\t\tsize={ 24 }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ ( ! hasPresets || showCustomValueControl ) && (\n\t\t\t\t<div className=\"components-border-radius-control__input-controls-wrapper\">\n\t\t\t\t\t<Tooltip text={ CORNERS[ corner ] } placement=\"top\">\n\t\t\t\t\t\t<div className=\"components-border-radius-control__tooltip-wrapper\">\n\t\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\t\tclassName=\"components-border-radius-control__unit-control\"\n\t\t\t\t\t\t\t\taria-label={ CORNERS[ corner ] }\n\t\t\t\t\t\t\t\tvalue={ [ parsedQuantity, computedUnit ].join(\n\t\t\t\t\t\t\t\t\t''\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tonChange={ onChangeValue }\n\t\t\t\t\t\t\t\tonUnitChange={ onChangeUnit }\n\t\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\t\tmin={ MIN_BORDER_RADIUS_VALUE }\n\t\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</Tooltip>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Border radius' ) }\n\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\tclassName=\"components-border-radius-control__range-control\"\n\t\t\t\t\t\tvalue={ parsedQuantity ?? '' }\n\t\t\t\t\t\tmin={ MIN_BORDER_RADIUS_VALUE }\n\t\t\t\t\t\tmax={ MAX_BORDER_RADIUS_VALUES[ computedUnit ] }\n\t\t\t\t\t\tinitialPosition={ 0 }\n\t\t\t\t\t\twithInputField={ false }\n\t\t\t\t\t\tonChange={ handleSliderChange }\n\t\t\t\t\t\tstep={ step }\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ hasPresets && showRangeControl && ! showCustomValueControl && (\n\t\t\t\t<RangeControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tclassName=\"components-border-radius-control__range-control\"\n\t\t\t\t\tvalue={ presetIndex }\n\t\t\t\t\tonChange={ ( newSize ) => {\n\t\t\t\t\t\tchangeCornerValue(\n\t\t\t\t\t\t\tgetPresetValueFromControlValue(\n\t\t\t\t\t\t\t\tnewSize,\n\t\t\t\t\t\t\t\t'range',\n\t\t\t\t\t\t\t\tpresets\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t\t} }\n\t\t\t\t\twithInputField={ false }\n\t\t\t\t\taria-valuenow={ presetIndex }\n\t\t\t\t\taria-valuetext={ presets[ presetIndex ]?.name }\n\t\t\t\t\trenderTooltipContent={ rangeTooltip }\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tmax={ presets.length - 1 }\n\t\t\t\t\tmarks={ marks }\n\t\t\t\t\tlabel={ CORNERS[ corner ] }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ ! showRangeControl && ! showCustomValueControl && (\n\t\t\t\t<CustomSelectControl\n\t\t\t\t\tclassName=\"components-border-radius-control__custom-select-control\"\n\t\t\t\t\tvalue={\n\t\t\t\t\t\toptions.find(\n\t\t\t\t\t\t\t( option ) => option.key === presetIndex\n\t\t\t\t\t\t) || options[ options.length - 1 ]\n\t\t\t\t\t}\n\t\t\t\t\tonChange={ ( selection ) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tselection.selectedItem.key ===\n\t\t\t\t\t\t\toptions.length - 1\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tsetShowCustomValueControl( true );\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tchangeCornerValue(\n\t\t\t\t\t\t\t\tgetPresetValueFromControlValue(\n\t\t\t\t\t\t\t\t\tselection.selectedItem.key,\n\t\t\t\t\t\t\t\t\t'selectList',\n\t\t\t\t\t\t\t\t\tpresets\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\toptions={ options }\n\t\t\t\t\tlabel={ CORNERS[ corner ] }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ hasPresets && (\n\t\t\t\t<Button\n\t\t\t\t\tlabel={\n\t\t\t\t\t\tshowCustomValueControl\n\t\t\t\t\t\t\t? __( 'Use border radius preset' )\n\t\t\t\t\t\t\t: __( 'Set custom border radius' )\n\t\t\t\t\t}\n\t\t\t\t\ticon={ settings }\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tsetShowCustomValueControl( ! showCustomValueControl );\n\t\t\t\t\t} }\n\t\t\t\t\tisPressed={ showCustomValueControl }\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t\tclassName=\"components-border-radius-control__custom-toggle\"\n\t\t\t\t\ticonSize={ 24 }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</HStack>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBASO;AACP,kBAAmB;AACnB,qBAAyB;AACzB,mBAAyB;AAKzB,mBAQO;AACP,uBAMO;AA8HH;AA5HW,SAAR,mBAAqC;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AACD,GAAI;AACH,QAAM,oBAAoB,CAAE,mBAAoB;AAC/C,QAAK,WAAW,OAAQ;AACvB,eAAU;AAAA,QACT,SAAS;AAAA,QACT,UAAU;AAAA,QACV,YAAY;AAAA,QACZ,aAAa;AAAA,MACd,CAAE;AAAA,IACH,OAAO;AACN,eAAU;AAAA,QACT,GAAG;AAAA,QACH,CAAE,MAAO,GAAG;AAAA,MACb,CAAE;AAAA,IACH;AAAA,EACD;AAEA,QAAM,gBAAgB,CAAE,SAAU;AACjC,QAAK,CAAE,UAAW;AACjB;AAAA,IACD;AAGA,UAAM,YAAY,CAAE,MAAO,WAAY,IAAK,CAAE;AAC9C,UAAM,YAAY,YAAY,OAAO;AACrC,sBAAmB,SAAU;AAAA,EAC9B;AAEA,QAAM,eAAe,CAAE,SAAU;AAChC,UAAM,WAAW,EAAE,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