@wordpress/block-editor 12.19.3 → 12.20.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/CHANGELOG.md +2 -0
- package/build/components/block-canvas/index.js +2 -0
- package/build/components/block-canvas/index.js.map +1 -1
- package/build/components/block-heading-level-dropdown/index.js +14 -17
- package/build/components/block-heading-level-dropdown/index.js.map +1 -1
- package/build/components/block-inspector/index.js +0 -3
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/index.js +9 -9
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-preview/index.js +4 -0
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-settings-menu/block-parent-selector-menu-item.js +54 -0
- package/build/components/block-settings-menu/block-parent-selector-menu-item.js.map +1 -0
- package/build/components/block-settings-menu/block-settings-dropdown.js +9 -37
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/child-layout-control/index.js +37 -5
- package/build/components/child-layout-control/index.js.map +1 -1
- package/build/components/date-format-picker/index.js +0 -1
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +1 -2
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +30 -19
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/inspector-controls-tabs/styles-tab.js +0 -4
- package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build/components/observe-typing/index.js +5 -10
- package/build/components/observe-typing/index.js.map +1 -1
- package/build/components/rich-text/format-toolbar-container.js +1 -31
- package/build/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build/components/rich-text/index.js +1 -2
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/skip-to-selected-block/index.js +7 -14
- package/build/components/skip-to-selected-block/index.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +0 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/url-input/index.js +5 -8
- package/build/components/url-input/index.js.map +1 -1
- package/build/hooks/layout-child.js +50 -1
- package/build/hooks/layout-child.js.map +1 -1
- package/build/hooks/position.js +0 -1
- package/build/hooks/position.js.map +1 -1
- package/build/layouts/grid.js +105 -12
- package/build/layouts/grid.js.map +1 -1
- package/build/store/actions.js +2 -30
- package/build/store/actions.js.map +1 -1
- package/build-module/components/block-canvas/index.js +2 -0
- package/build-module/components/block-canvas/index.js.map +1 -1
- package/build-module/components/block-heading-level-dropdown/index.js +14 -17
- package/build-module/components/block-heading-level-dropdown/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +1 -4
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/index.js +9 -9
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-preview/index.js +4 -0
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-settings-menu/block-parent-selector-menu-item.js +46 -0
- package/build-module/components/block-settings-menu/block-parent-selector-menu-item.js.map +1 -0
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +12 -40
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +38 -6
- package/build-module/components/child-layout-control/index.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +0 -1
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +1 -2
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +30 -19
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.js +0 -4
- package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build-module/components/observe-typing/index.js +5 -10
- package/build-module/components/observe-typing/index.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar-container.js +1 -31
- package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build-module/components/rich-text/index.js +1 -2
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/skip-to-selected-block/index.js +8 -14
- package/build-module/components/skip-to-selected-block/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +0 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/url-input/index.js +5 -8
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/hooks/layout-child.js +50 -1
- package/build-module/hooks/layout-child.js.map +1 -1
- package/build-module/hooks/position.js +0 -1
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/layouts/grid.js +107 -14
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/store/actions.js +2 -30
- package/build-module/store/actions.js.map +1 -1
- package/build-style/style-rtl.css +12 -17
- package/build-style/style.css +12 -17
- package/package.json +31 -32
- package/src/components/block-canvas/index.js +2 -0
- package/src/components/block-heading-level-dropdown/index.js +17 -25
- package/src/components/block-inspector/index.js +0 -11
- package/src/components/block-list/index.js +55 -55
- package/src/components/block-preview/index.js +6 -1
- package/src/components/block-settings-menu/block-parent-selector-menu-item.js +50 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +9 -50
- package/src/components/block-styles/style.scss +0 -4
- package/src/components/block-toolbar/style.scss +11 -6
- package/src/components/child-layout-control/index.js +85 -44
- package/src/components/date-format-picker/index.js +0 -1
- package/src/components/font-appearance-control/index.js +0 -1
- package/src/components/global-styles/dimensions-panel.js +36 -24
- package/src/components/global-styles/test/use-global-styles-output.js +3 -2
- package/src/components/inspector-controls-tabs/styles-tab.js +0 -7
- package/src/components/observe-typing/index.js +7 -10
- package/src/components/rich-text/format-toolbar-container.js +1 -48
- package/src/components/rich-text/index.js +0 -1
- package/src/components/skip-to-selected-block/index.js +10 -13
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +0 -1
- package/src/components/url-input/index.js +6 -15
- package/src/hooks/anchor.scss +1 -1
- package/src/hooks/layout-child.js +53 -1
- package/src/hooks/position.js +0 -1
- package/src/layouts/grid.js +131 -52
- package/src/layouts/test/grid.js +16 -2
- package/src/store/actions.js +2 -38
- package/src/store/test/actions.js +0 -101
- package/src/style.scss +0 -1
- package/build/components/default-style-picker/index.js +0 -70
- package/build/components/default-style-picker/index.js.map +0 -1
- package/build-module/components/default-style-picker/index.js +0 -63
- package/build-module/components/default-style-picker/index.js.map +0 -1
- package/src/components/block-settings-menu/style.scss +0 -3
- package/src/components/default-style-picker/index.js +0 -70
|
@@ -16,13 +16,12 @@ var _i18n = require("@wordpress/i18n");
|
|
|
16
16
|
var _keyboardShortcuts = require("@wordpress/keyboard-shortcuts");
|
|
17
17
|
var _compose = require("@wordpress/compose");
|
|
18
18
|
var _blockActions = _interopRequireDefault(require("../block-actions"));
|
|
19
|
-
var _blockIcon = _interopRequireDefault(require("../block-icon"));
|
|
20
19
|
var _blockHtmlConvertButton = _interopRequireDefault(require("./block-html-convert-button"));
|
|
21
20
|
var _blockSettingsMenuFirstItem = _interopRequireDefault(require("./block-settings-menu-first-item"));
|
|
22
21
|
var _blockSettingsMenuControls = _interopRequireDefault(require("../block-settings-menu-controls"));
|
|
22
|
+
var _blockParentSelectorMenuItem = _interopRequireDefault(require("./block-parent-selector-menu-item"));
|
|
23
23
|
var _store = require("../../store");
|
|
24
24
|
var _lockUnlock = require("../../lock-unlock");
|
|
25
|
-
var _utils = require("../block-toolbar/utils");
|
|
26
25
|
/**
|
|
27
26
|
* WordPress dependencies
|
|
28
27
|
*/
|
|
@@ -46,35 +45,6 @@ function CopyMenuItem({
|
|
|
46
45
|
ref: ref
|
|
47
46
|
}, copyMenuItemLabel);
|
|
48
47
|
}
|
|
49
|
-
function ParentSelectorMenuItem({
|
|
50
|
-
parentClientId,
|
|
51
|
-
parentBlockType
|
|
52
|
-
}) {
|
|
53
|
-
const isSmallViewport = (0, _compose.useViewportMatch)('medium', '<');
|
|
54
|
-
const {
|
|
55
|
-
selectBlock
|
|
56
|
-
} = (0, _data.useDispatch)(_store.store);
|
|
57
|
-
|
|
58
|
-
// Allows highlighting the parent block outline when focusing or hovering
|
|
59
|
-
// the parent block selector within the child.
|
|
60
|
-
const menuItemRef = (0, _element.useRef)();
|
|
61
|
-
const gesturesProps = (0, _utils.useShowHoveredOrFocusedGestures)({
|
|
62
|
-
ref: menuItemRef,
|
|
63
|
-
highlightParent: true
|
|
64
|
-
});
|
|
65
|
-
if (!isSmallViewport) {
|
|
66
|
-
return null;
|
|
67
|
-
}
|
|
68
|
-
return (0, _react.createElement)(_components.MenuItem, {
|
|
69
|
-
...gesturesProps,
|
|
70
|
-
ref: menuItemRef,
|
|
71
|
-
icon: (0, _react.createElement)(_blockIcon.default, {
|
|
72
|
-
icon: parentBlockType.icon
|
|
73
|
-
}),
|
|
74
|
-
onClick: () => selectBlock(parentClientId)
|
|
75
|
-
}, (0, _i18n.sprintf)( /* translators: %s: Name of the block's parent. */
|
|
76
|
-
(0, _i18n.__)('Select parent block (%s)'), parentBlockType.title));
|
|
77
|
-
}
|
|
78
48
|
function BlockSettingsDropdown({
|
|
79
49
|
block,
|
|
80
50
|
clientIds,
|
|
@@ -93,7 +63,8 @@ function BlockSettingsDropdown({
|
|
|
93
63
|
onlyBlock,
|
|
94
64
|
parentBlockType,
|
|
95
65
|
previousBlockClientId,
|
|
96
|
-
selectedBlockClientIds
|
|
66
|
+
selectedBlockClientIds,
|
|
67
|
+
openedBlockSettingsMenu
|
|
97
68
|
} = (0, _data.useSelect)(select => {
|
|
98
69
|
const {
|
|
99
70
|
getBlockCount,
|
|
@@ -101,8 +72,9 @@ function BlockSettingsDropdown({
|
|
|
101
72
|
getBlockRootClientId,
|
|
102
73
|
getPreviousBlockClientId,
|
|
103
74
|
getSelectedBlockClientIds,
|
|
104
|
-
getBlockAttributes
|
|
105
|
-
|
|
75
|
+
getBlockAttributes,
|
|
76
|
+
getOpenedBlockSettingsMenu
|
|
77
|
+
} = (0, _lockUnlock.unlock)(select(_store.store));
|
|
106
78
|
const {
|
|
107
79
|
getActiveBlockVariation
|
|
108
80
|
} = select(_blocks.store);
|
|
@@ -113,14 +85,14 @@ function BlockSettingsDropdown({
|
|
|
113
85
|
onlyBlock: 1 === getBlockCount(_firstParentClientId),
|
|
114
86
|
parentBlockType: _firstParentClientId && (getActiveBlockVariation(parentBlockName, getBlockAttributes(_firstParentClientId)) || (0, _blocks.getBlockType)(parentBlockName)),
|
|
115
87
|
previousBlockClientId: getPreviousBlockClientId(firstBlockClientId),
|
|
116
|
-
selectedBlockClientIds: getSelectedBlockClientIds()
|
|
88
|
+
selectedBlockClientIds: getSelectedBlockClientIds(),
|
|
89
|
+
openedBlockSettingsMenu: getOpenedBlockSettingsMenu()
|
|
117
90
|
};
|
|
118
91
|
}, [firstBlockClientId]);
|
|
119
92
|
const {
|
|
120
93
|
getBlockOrder,
|
|
121
94
|
getSelectedBlockClientIds
|
|
122
95
|
} = (0, _data.useSelect)(_store.store);
|
|
123
|
-
const openedBlockSettingsMenu = (0, _data.useSelect)(select => (0, _lockUnlock.unlock)(select(_store.store)).getOpenedBlockSettingsMenu(), []);
|
|
124
96
|
const {
|
|
125
97
|
setOpenedBlockSettingsMenu
|
|
126
98
|
} = (0, _lockUnlock.unlock)((0, _data.useDispatch)(_store.store));
|
|
@@ -234,7 +206,7 @@ function BlockSettingsDropdown({
|
|
|
234
206
|
fillProps: {
|
|
235
207
|
onClose
|
|
236
208
|
}
|
|
237
|
-
}), !parentBlockIsSelected && !!firstParentClientId && (0, _react.createElement)(
|
|
209
|
+
}), !parentBlockIsSelected && !!firstParentClientId && (0, _react.createElement)(_blockParentSelectorMenuItem.default, {
|
|
238
210
|
parentClientId: firstParentClientId,
|
|
239
211
|
parentBlockType: parentBlockType
|
|
240
212
|
}), count === 1 && (0, _react.createElement)(_blockHtmlConvertButton.default, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blocks","require","_components","_data","_icons","_element","_i18n","_keyboardShortcuts","_compose","_blockActions","_interopRequireDefault","_blockIcon","_blockHtmlConvertButton","_blockSettingsMenuFirstItem","_blockSettingsMenuControls","_store","_lockUnlock","_utils","POPOVER_PROPS","className","placement","CopyMenuItem","blocks","onCopy","label","ref","useCopyToClipboard","serialize","copyMenuItemLabel","__","_react","createElement","MenuItem","ParentSelectorMenuItem","parentClientId","parentBlockType","isSmallViewport","useViewportMatch","selectBlock","useDispatch","blockEditorStore","menuItemRef","useRef","gesturesProps","useShowHoveredOrFocusedGestures","highlightParent","icon","default","onClick","sprintf","title","BlockSettingsDropdown","block","clientIds","__experimentalSelectBlock","children","__unstableDisplayLocation","props","currentClientId","clientId","blockClientIds","Array","isArray","count","length","firstBlockClientId","firstParentClientId","onlyBlock","previousBlockClientId","selectedBlockClientIds","useSelect","select","getBlockCount","getBlockName","getBlockRootClientId","getPreviousBlockClientId","getSelectedBlockClientIds","getBlockAttributes","getActiveBlockVariation","blocksStore","_firstParentClientId","parentBlockName","getBlockType","getBlockOrder","openedBlockSettingsMenu","unlock","getOpenedBlockSettingsMenu","setOpenedBlockSettingsMenu","shortcuts","getShortcutRepresentation","keyboardShortcutsStore","duplicate","remove","insertAfter","insertBefore","isMatch","__unstableUseShortcutEventMatch","hasSelectedBlocks","updateSelectionAfterDuplicate","useCallback","clientIdsPromise","ids","updateSelectionAfterRemove","blockToFocus","shouldUpdateSelection","parentBlockIsSelected","includes","open","undefined","onToggle","localOpen","__experimentalUpdateSelection","canCopyStyles","canDuplicate","canInsertDefaultBlock","canMove","canRemove","onDuplicate","onInsertAfter","onInsertBefore","onRemove","onPasteStyles","onMoveTo","DropdownMenu","moreVertical","popoverProps","noIcons","menuProps","onKeyDown","event","defaultPrevented","preventDefault","onClose","Fragment","MenuGroup","Slot","fillProps","pipe","shortcut","Children","map","child","cloneElement","_default","exports"],"sources":["@wordpress/block-editor/src/components/block-settings-menu/block-settings-dropdown.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tgetBlockType,\n\tserialize,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { moreVertical } from '@wordpress/icons';\nimport {\n\tChildren,\n\tcloneElement,\n\tuseCallback,\n\tuseRef,\n} from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tstore as keyboardShortcutsStore,\n\t__unstableUseShortcutEventMatch,\n} from '@wordpress/keyboard-shortcuts';\nimport { pipe, useCopyToClipboard, useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BlockActions from '../block-actions';\nimport BlockIcon from '../block-icon';\nimport BlockHTMLConvertButton from './block-html-convert-button';\nimport __unstableBlockSettingsMenuFirstItem from './block-settings-menu-first-item';\nimport BlockSettingsMenuControls from '../block-settings-menu-controls';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { useShowHoveredOrFocusedGestures } from '../block-toolbar/utils';\n\nconst POPOVER_PROPS = {\n\tclassName: 'block-editor-block-settings-menu__popover',\n\tplacement: 'bottom-start',\n};\n\nfunction CopyMenuItem( { blocks, onCopy, label } ) {\n\tconst ref = useCopyToClipboard( () => serialize( blocks ), onCopy );\n\tconst copyMenuItemLabel = label ? label : __( 'Copy' );\n\treturn <MenuItem ref={ ref }>{ copyMenuItemLabel }</MenuItem>;\n}\n\nfunction ParentSelectorMenuItem( { parentClientId, parentBlockType } ) {\n\tconst isSmallViewport = useViewportMatch( 'medium', '<' );\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\n\t// Allows highlighting the parent block outline when focusing or hovering\n\t// the parent block selector within the child.\n\tconst menuItemRef = useRef();\n\tconst gesturesProps = useShowHoveredOrFocusedGestures( {\n\t\tref: menuItemRef,\n\t\thighlightParent: true,\n\t} );\n\n\tif ( ! isSmallViewport ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<MenuItem\n\t\t\t{ ...gesturesProps }\n\t\t\tref={ menuItemRef }\n\t\t\ticon={ <BlockIcon icon={ parentBlockType.icon } /> }\n\t\t\tonClick={ () => selectBlock( parentClientId ) }\n\t\t>\n\t\t\t{ sprintf(\n\t\t\t\t/* translators: %s: Name of the block's parent. */\n\t\t\t\t__( 'Select parent block (%s)' ),\n\t\t\t\tparentBlockType.title\n\t\t\t) }\n\t\t</MenuItem>\n\t);\n}\n\nexport function BlockSettingsDropdown( {\n\tblock,\n\tclientIds,\n\t__experimentalSelectBlock,\n\tchildren,\n\t__unstableDisplayLocation,\n\t...props\n} ) {\n\t// Get the client id of the current block for this menu, if one is set.\n\tconst currentClientId = block?.clientId;\n\tconst blockClientIds = Array.isArray( clientIds )\n\t\t? clientIds\n\t\t: [ clientIds ];\n\tconst count = blockClientIds.length;\n\tconst firstBlockClientId = blockClientIds[ 0 ];\n\tconst {\n\t\tfirstParentClientId,\n\t\tonlyBlock,\n\t\tparentBlockType,\n\t\tpreviousBlockClientId,\n\t\tselectedBlockClientIds,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetPreviousBlockClientId,\n\t\t\t\tgetSelectedBlockClientIds,\n\t\t\t\tgetBlockAttributes,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst { getActiveBlockVariation } = select( blocksStore );\n\n\t\t\tconst _firstParentClientId =\n\t\t\t\tgetBlockRootClientId( firstBlockClientId );\n\t\t\tconst parentBlockName =\n\t\t\t\t_firstParentClientId && getBlockName( _firstParentClientId );\n\n\t\t\treturn {\n\t\t\t\tfirstParentClientId: _firstParentClientId,\n\t\t\t\tonlyBlock: 1 === getBlockCount( _firstParentClientId ),\n\t\t\t\tparentBlockType:\n\t\t\t\t\t_firstParentClientId &&\n\t\t\t\t\t( getActiveBlockVariation(\n\t\t\t\t\t\tparentBlockName,\n\t\t\t\t\t\tgetBlockAttributes( _firstParentClientId )\n\t\t\t\t\t) ||\n\t\t\t\t\t\tgetBlockType( parentBlockName ) ),\n\t\t\t\tpreviousBlockClientId:\n\t\t\t\t\tgetPreviousBlockClientId( firstBlockClientId ),\n\t\t\t\tselectedBlockClientIds: getSelectedBlockClientIds(),\n\t\t\t};\n\t\t},\n\t\t[ firstBlockClientId ]\n\t);\n\tconst { getBlockOrder, getSelectedBlockClientIds } =\n\t\tuseSelect( blockEditorStore );\n\n\tconst openedBlockSettingsMenu = useSelect(\n\t\t( select ) =>\n\t\t\tunlock( select( blockEditorStore ) ).getOpenedBlockSettingsMenu(),\n\t\t[]\n\t);\n\n\tconst { setOpenedBlockSettingsMenu } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\n\tconst shortcuts = useSelect( ( select ) => {\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\t\treturn {\n\t\t\tduplicate: getShortcutRepresentation(\n\t\t\t\t'core/block-editor/duplicate'\n\t\t\t),\n\t\t\tremove: getShortcutRepresentation( 'core/block-editor/remove' ),\n\t\t\tinsertAfter: getShortcutRepresentation(\n\t\t\t\t'core/block-editor/insert-after'\n\t\t\t),\n\t\t\tinsertBefore: getShortcutRepresentation(\n\t\t\t\t'core/block-editor/insert-before'\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst isMatch = __unstableUseShortcutEventMatch();\n\tconst hasSelectedBlocks = selectedBlockClientIds.length > 0;\n\n\tconst updateSelectionAfterDuplicate = useCallback(\n\t\tasync ( clientIdsPromise ) => {\n\t\t\tif ( __experimentalSelectBlock ) {\n\t\t\t\tconst ids = await clientIdsPromise;\n\t\t\t\tif ( ids && ids[ 0 ] ) {\n\t\t\t\t\t__experimentalSelectBlock( ids[ 0 ], false );\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[ __experimentalSelectBlock ]\n\t);\n\n\tconst updateSelectionAfterRemove = useCallback( () => {\n\t\tif ( __experimentalSelectBlock ) {\n\t\t\tlet blockToFocus = previousBlockClientId || firstParentClientId;\n\n\t\t\t// Focus the first block if there's no previous block nor parent block.\n\t\t\tif ( ! blockToFocus ) {\n\t\t\t\tblockToFocus = getBlockOrder()[ 0 ];\n\t\t\t}\n\n\t\t\t// Only update the selection if the original selection is removed.\n\t\t\tconst shouldUpdateSelection =\n\t\t\t\thasSelectedBlocks && getSelectedBlockClientIds().length === 0;\n\n\t\t\t__experimentalSelectBlock( blockToFocus, shouldUpdateSelection );\n\t\t}\n\t}, [\n\t\t__experimentalSelectBlock,\n\t\tpreviousBlockClientId,\n\t\tfirstParentClientId,\n\t\tgetBlockOrder,\n\t\thasSelectedBlocks,\n\t\tgetSelectedBlockClientIds,\n\t] );\n\n\t// This can occur when the selected block (the parent)\n\t// displays child blocks within a List View.\n\tconst parentBlockIsSelected =\n\t\tselectedBlockClientIds?.includes( firstParentClientId );\n\n\t// When a currentClientId is in use, treat the menu as a controlled component.\n\t// This ensures that only one block settings menu is open at a time.\n\t// This is a temporary solution to work around an issue with `onFocusOutside`\n\t// where it does not allow a dropdown to be closed if focus was never within\n\t// the dropdown to begin with. Examples include a user either CMD+Clicking or\n\t// right clicking into an inactive window.\n\t// See: https://github.com/WordPress/gutenberg/pull/54083\n\tconst open = ! currentClientId\n\t\t? undefined\n\t\t: openedBlockSettingsMenu === currentClientId || false;\n\n\tconst onToggle = useCallback(\n\t\t( localOpen ) => {\n\t\t\tif ( localOpen && openedBlockSettingsMenu !== currentClientId ) {\n\t\t\t\tsetOpenedBlockSettingsMenu( currentClientId );\n\t\t\t} else if (\n\t\t\t\t! localOpen &&\n\t\t\t\topenedBlockSettingsMenu &&\n\t\t\t\topenedBlockSettingsMenu === currentClientId\n\t\t\t) {\n\t\t\t\tsetOpenedBlockSettingsMenu( undefined );\n\t\t\t}\n\t\t},\n\t\t[ currentClientId, openedBlockSettingsMenu, setOpenedBlockSettingsMenu ]\n\t);\n\n\treturn (\n\t\t<BlockActions\n\t\t\tclientIds={ clientIds }\n\t\t\t__experimentalUpdateSelection={ ! __experimentalSelectBlock }\n\t\t>\n\t\t\t{ ( {\n\t\t\t\tcanCopyStyles,\n\t\t\t\tcanDuplicate,\n\t\t\t\tcanInsertDefaultBlock,\n\t\t\t\tcanMove,\n\t\t\t\tcanRemove,\n\t\t\t\tonDuplicate,\n\t\t\t\tonInsertAfter,\n\t\t\t\tonInsertBefore,\n\t\t\t\tonRemove,\n\t\t\t\tonCopy,\n\t\t\t\tonPasteStyles,\n\t\t\t\tonMoveTo,\n\t\t\t\tblocks,\n\t\t\t} ) => (\n\t\t\t\t<DropdownMenu\n\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\tlabel={ __( 'Options' ) }\n\t\t\t\t\tclassName=\"block-editor-block-settings-menu\"\n\t\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t\t\topen={ open }\n\t\t\t\t\tonToggle={ onToggle }\n\t\t\t\t\tnoIcons\n\t\t\t\t\tmenuProps={ {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * @param {KeyboardEvent} event\n\t\t\t\t\t\t */\n\t\t\t\t\t\tonKeyDown( event ) {\n\t\t\t\t\t\t\tif ( event.defaultPrevented ) return;\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tisMatch( 'core/block-editor/remove', event ) &&\n\t\t\t\t\t\t\t\tcanRemove\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\tupdateSelectionAfterRemove( onRemove() );\n\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\tisMatch(\n\t\t\t\t\t\t\t\t\t'core/block-editor/duplicate',\n\t\t\t\t\t\t\t\t\tevent\n\t\t\t\t\t\t\t\t) &&\n\t\t\t\t\t\t\t\tcanDuplicate\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\tupdateSelectionAfterDuplicate( onDuplicate() );\n\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\tisMatch(\n\t\t\t\t\t\t\t\t\t'core/block-editor/insert-after',\n\t\t\t\t\t\t\t\t\tevent\n\t\t\t\t\t\t\t\t) &&\n\t\t\t\t\t\t\t\tcanInsertDefaultBlock\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\tsetOpenedBlockSettingsMenu( undefined );\n\t\t\t\t\t\t\t\tonInsertAfter();\n\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\tisMatch(\n\t\t\t\t\t\t\t\t\t'core/block-editor/insert-before',\n\t\t\t\t\t\t\t\t\tevent\n\t\t\t\t\t\t\t\t) &&\n\t\t\t\t\t\t\t\tcanInsertDefaultBlock\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\tsetOpenedBlockSettingsMenu( undefined );\n\t\t\t\t\t\t\t\tonInsertBefore();\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\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t<__unstableBlockSettingsMenuFirstItem.Slot\n\t\t\t\t\t\t\t\t\tfillProps={ { onClose } }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t{ ! parentBlockIsSelected &&\n\t\t\t\t\t\t\t\t\t!! firstParentClientId && (\n\t\t\t\t\t\t\t\t\t\t<ParentSelectorMenuItem\n\t\t\t\t\t\t\t\t\t\t\tparentClientId={\n\t\t\t\t\t\t\t\t\t\t\t\tfirstParentClientId\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tparentBlockType={ parentBlockType }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ count === 1 && (\n\t\t\t\t\t\t\t\t\t<BlockHTMLConvertButton\n\t\t\t\t\t\t\t\t\t\tclientId={ firstBlockClientId }\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\t<CopyMenuItem\n\t\t\t\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\t\t\t\tonCopy={ onCopy }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t{ canDuplicate && (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\tonDuplicate,\n\t\t\t\t\t\t\t\t\t\t\tupdateSelectionAfterDuplicate\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tshortcut={ shortcuts.duplicate }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Duplicate' ) }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ canInsertDefaultBlock && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\t\tonInsertBefore\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tshortcut={ shortcuts.insertBefore }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Add before' ) }\n\t\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\t\tonInsertAfter\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tshortcut={ shortcuts.insertAfter }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Add after' ) }\n\t\t\t\t\t\t\t\t\t\t</MenuItem>\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</MenuGroup>\n\t\t\t\t\t\t\t{ canCopyStyles && (\n\t\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t\t<CopyMenuItem\n\t\t\t\t\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\t\t\t\t\tonCopy={ onCopy }\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Copy styles' ) }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<MenuItem onClick={ onPasteStyles }>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Paste styles' ) }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<BlockSettingsMenuControls.Slot\n\t\t\t\t\t\t\t\tfillProps={ {\n\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\tcanMove,\n\t\t\t\t\t\t\t\t\tonMoveTo,\n\t\t\t\t\t\t\t\t\tonlyBlock,\n\t\t\t\t\t\t\t\t\tcount,\n\t\t\t\t\t\t\t\t\tfirstBlockClientId,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tclientIds={ clientIds }\n\t\t\t\t\t\t\t\t__unstableDisplayLocation={\n\t\t\t\t\t\t\t\t\t__unstableDisplayLocation\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{ typeof children === 'function'\n\t\t\t\t\t\t\t\t? children( { onClose } )\n\t\t\t\t\t\t\t\t: Children.map( ( child ) =>\n\t\t\t\t\t\t\t\t\t\tcloneElement( child, { onClose } )\n\t\t\t\t\t\t\t\t ) }\n\t\t\t\t\t\t\t{ canRemove && (\n\t\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\tonRemove,\n\t\t\t\t\t\t\t\t\t\t\tupdateSelectionAfterRemove\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tshortcut={ shortcuts.remove }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Delete' ) }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t</MenuGroup>\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</DropdownMenu>\n\t\t\t) }\n\t\t</BlockActions>\n\t);\n}\n\nexport default BlockSettingsDropdown;\n"],"mappings":";;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAMA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,kBAAA,GAAAN,OAAA;AAIA,IAAAO,QAAA,GAAAP,OAAA;AAKA,IAAAQ,aAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,UAAA,GAAAD,sBAAA,CAAAT,OAAA;AACA,IAAAW,uBAAA,GAAAF,sBAAA,CAAAT,OAAA;AACA,IAAAY,2BAAA,GAAAH,sBAAA,CAAAT,OAAA;AACA,IAAAa,0BAAA,GAAAJ,sBAAA,CAAAT,OAAA;AACA,IAAAc,MAAA,GAAAd,OAAA;AACA,IAAAe,WAAA,GAAAf,OAAA;AACA,IAAAgB,MAAA,GAAAhB,OAAA;AAlCA;AACA;AAC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,WAAA,CAAA8B,QAAQ;IACRgB,OAAO,EAAG,IAAAyF,aAAI,EACbL,OAAO,EACPZ,QAAQ,EACRlB,0BACD,CAAG;IACHoC,QAAQ,EAAGlD,SAAS,CAACI;EAAQ,GAE3B,IAAA/D,QAAE,EAAE,QAAS,CACN,CACA,CAEX,CAEU,CAEF,CAAC;AAEjB;AAAC,IAAAkH,QAAA,GAAAC,OAAA,CAAAjG,OAAA,GAEcI,qBAAqB"}
|
|
1
|
+
{"version":3,"names":["_blocks","require","_components","_data","_icons","_element","_i18n","_keyboardShortcuts","_compose","_blockActions","_interopRequireDefault","_blockHtmlConvertButton","_blockSettingsMenuFirstItem","_blockSettingsMenuControls","_blockParentSelectorMenuItem","_store","_lockUnlock","POPOVER_PROPS","className","placement","CopyMenuItem","blocks","onCopy","label","ref","useCopyToClipboard","serialize","copyMenuItemLabel","__","_react","createElement","MenuItem","BlockSettingsDropdown","block","clientIds","__experimentalSelectBlock","children","__unstableDisplayLocation","props","currentClientId","clientId","blockClientIds","Array","isArray","count","length","firstBlockClientId","firstParentClientId","onlyBlock","parentBlockType","previousBlockClientId","selectedBlockClientIds","openedBlockSettingsMenu","useSelect","select","getBlockCount","getBlockName","getBlockRootClientId","getPreviousBlockClientId","getSelectedBlockClientIds","getBlockAttributes","getOpenedBlockSettingsMenu","unlock","blockEditorStore","getActiveBlockVariation","blocksStore","_firstParentClientId","parentBlockName","getBlockType","getBlockOrder","setOpenedBlockSettingsMenu","useDispatch","shortcuts","getShortcutRepresentation","keyboardShortcutsStore","duplicate","remove","insertAfter","insertBefore","isMatch","__unstableUseShortcutEventMatch","hasSelectedBlocks","updateSelectionAfterDuplicate","useCallback","clientIdsPromise","ids","updateSelectionAfterRemove","blockToFocus","shouldUpdateSelection","parentBlockIsSelected","includes","open","undefined","onToggle","localOpen","default","__experimentalUpdateSelection","canCopyStyles","canDuplicate","canInsertDefaultBlock","canMove","canRemove","onDuplicate","onInsertAfter","onInsertBefore","onRemove","onPasteStyles","onMoveTo","DropdownMenu","icon","moreVertical","popoverProps","noIcons","menuProps","onKeyDown","event","defaultPrevented","preventDefault","onClose","Fragment","MenuGroup","Slot","fillProps","parentClientId","onClick","pipe","shortcut","Children","map","child","cloneElement","_default","exports"],"sources":["@wordpress/block-editor/src/components/block-settings-menu/block-settings-dropdown.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tgetBlockType,\n\tserialize,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { moreVertical } from '@wordpress/icons';\nimport { Children, cloneElement, useCallback } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tstore as keyboardShortcutsStore,\n\t__unstableUseShortcutEventMatch,\n} from '@wordpress/keyboard-shortcuts';\nimport { pipe, useCopyToClipboard } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BlockActions from '../block-actions';\nimport BlockHTMLConvertButton from './block-html-convert-button';\nimport __unstableBlockSettingsMenuFirstItem from './block-settings-menu-first-item';\nimport BlockSettingsMenuControls from '../block-settings-menu-controls';\nimport BlockParentSelectorMenuItem from './block-parent-selector-menu-item';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst POPOVER_PROPS = {\n\tclassName: 'block-editor-block-settings-menu__popover',\n\tplacement: 'bottom-start',\n};\n\nfunction CopyMenuItem( { blocks, onCopy, label } ) {\n\tconst ref = useCopyToClipboard( () => serialize( blocks ), onCopy );\n\tconst copyMenuItemLabel = label ? label : __( 'Copy' );\n\treturn <MenuItem ref={ ref }>{ copyMenuItemLabel }</MenuItem>;\n}\n\nexport function BlockSettingsDropdown( {\n\tblock,\n\tclientIds,\n\t__experimentalSelectBlock,\n\tchildren,\n\t__unstableDisplayLocation,\n\t...props\n} ) {\n\t// Get the client id of the current block for this menu, if one is set.\n\tconst currentClientId = block?.clientId;\n\tconst blockClientIds = Array.isArray( clientIds )\n\t\t? clientIds\n\t\t: [ clientIds ];\n\tconst count = blockClientIds.length;\n\tconst firstBlockClientId = blockClientIds[ 0 ];\n\tconst {\n\t\tfirstParentClientId,\n\t\tonlyBlock,\n\t\tparentBlockType,\n\t\tpreviousBlockClientId,\n\t\tselectedBlockClientIds,\n\t\topenedBlockSettingsMenu,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetPreviousBlockClientId,\n\t\t\t\tgetSelectedBlockClientIds,\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetOpenedBlockSettingsMenu,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\n\t\t\tconst { getActiveBlockVariation } = select( blocksStore );\n\n\t\t\tconst _firstParentClientId =\n\t\t\t\tgetBlockRootClientId( firstBlockClientId );\n\t\t\tconst parentBlockName =\n\t\t\t\t_firstParentClientId && getBlockName( _firstParentClientId );\n\n\t\t\treturn {\n\t\t\t\tfirstParentClientId: _firstParentClientId,\n\t\t\t\tonlyBlock: 1 === getBlockCount( _firstParentClientId ),\n\t\t\t\tparentBlockType:\n\t\t\t\t\t_firstParentClientId &&\n\t\t\t\t\t( getActiveBlockVariation(\n\t\t\t\t\t\tparentBlockName,\n\t\t\t\t\t\tgetBlockAttributes( _firstParentClientId )\n\t\t\t\t\t) ||\n\t\t\t\t\t\tgetBlockType( parentBlockName ) ),\n\t\t\t\tpreviousBlockClientId:\n\t\t\t\t\tgetPreviousBlockClientId( firstBlockClientId ),\n\t\t\t\tselectedBlockClientIds: getSelectedBlockClientIds(),\n\t\t\t\topenedBlockSettingsMenu: getOpenedBlockSettingsMenu(),\n\t\t\t};\n\t\t},\n\t\t[ firstBlockClientId ]\n\t);\n\tconst { getBlockOrder, getSelectedBlockClientIds } =\n\t\tuseSelect( blockEditorStore );\n\n\tconst { setOpenedBlockSettingsMenu } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\n\tconst shortcuts = useSelect( ( select ) => {\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\t\treturn {\n\t\t\tduplicate: getShortcutRepresentation(\n\t\t\t\t'core/block-editor/duplicate'\n\t\t\t),\n\t\t\tremove: getShortcutRepresentation( 'core/block-editor/remove' ),\n\t\t\tinsertAfter: getShortcutRepresentation(\n\t\t\t\t'core/block-editor/insert-after'\n\t\t\t),\n\t\t\tinsertBefore: getShortcutRepresentation(\n\t\t\t\t'core/block-editor/insert-before'\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst isMatch = __unstableUseShortcutEventMatch();\n\tconst hasSelectedBlocks = selectedBlockClientIds.length > 0;\n\n\tconst updateSelectionAfterDuplicate = useCallback(\n\t\tasync ( clientIdsPromise ) => {\n\t\t\tif ( __experimentalSelectBlock ) {\n\t\t\t\tconst ids = await clientIdsPromise;\n\t\t\t\tif ( ids && ids[ 0 ] ) {\n\t\t\t\t\t__experimentalSelectBlock( ids[ 0 ], false );\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[ __experimentalSelectBlock ]\n\t);\n\n\tconst updateSelectionAfterRemove = useCallback( () => {\n\t\tif ( __experimentalSelectBlock ) {\n\t\t\tlet blockToFocus = previousBlockClientId || firstParentClientId;\n\n\t\t\t// Focus the first block if there's no previous block nor parent block.\n\t\t\tif ( ! blockToFocus ) {\n\t\t\t\tblockToFocus = getBlockOrder()[ 0 ];\n\t\t\t}\n\n\t\t\t// Only update the selection if the original selection is removed.\n\t\t\tconst shouldUpdateSelection =\n\t\t\t\thasSelectedBlocks && getSelectedBlockClientIds().length === 0;\n\n\t\t\t__experimentalSelectBlock( blockToFocus, shouldUpdateSelection );\n\t\t}\n\t}, [\n\t\t__experimentalSelectBlock,\n\t\tpreviousBlockClientId,\n\t\tfirstParentClientId,\n\t\tgetBlockOrder,\n\t\thasSelectedBlocks,\n\t\tgetSelectedBlockClientIds,\n\t] );\n\n\t// This can occur when the selected block (the parent)\n\t// displays child blocks within a List View.\n\tconst parentBlockIsSelected =\n\t\tselectedBlockClientIds?.includes( firstParentClientId );\n\n\t// When a currentClientId is in use, treat the menu as a controlled component.\n\t// This ensures that only one block settings menu is open at a time.\n\t// This is a temporary solution to work around an issue with `onFocusOutside`\n\t// where it does not allow a dropdown to be closed if focus was never within\n\t// the dropdown to begin with. Examples include a user either CMD+Clicking or\n\t// right clicking into an inactive window.\n\t// See: https://github.com/WordPress/gutenberg/pull/54083\n\tconst open = ! currentClientId\n\t\t? undefined\n\t\t: openedBlockSettingsMenu === currentClientId || false;\n\n\tconst onToggle = useCallback(\n\t\t( localOpen ) => {\n\t\t\tif ( localOpen && openedBlockSettingsMenu !== currentClientId ) {\n\t\t\t\tsetOpenedBlockSettingsMenu( currentClientId );\n\t\t\t} else if (\n\t\t\t\t! localOpen &&\n\t\t\t\topenedBlockSettingsMenu &&\n\t\t\t\topenedBlockSettingsMenu === currentClientId\n\t\t\t) {\n\t\t\t\tsetOpenedBlockSettingsMenu( undefined );\n\t\t\t}\n\t\t},\n\t\t[ currentClientId, openedBlockSettingsMenu, setOpenedBlockSettingsMenu ]\n\t);\n\n\treturn (\n\t\t<BlockActions\n\t\t\tclientIds={ clientIds }\n\t\t\t__experimentalUpdateSelection={ ! __experimentalSelectBlock }\n\t\t>\n\t\t\t{ ( {\n\t\t\t\tcanCopyStyles,\n\t\t\t\tcanDuplicate,\n\t\t\t\tcanInsertDefaultBlock,\n\t\t\t\tcanMove,\n\t\t\t\tcanRemove,\n\t\t\t\tonDuplicate,\n\t\t\t\tonInsertAfter,\n\t\t\t\tonInsertBefore,\n\t\t\t\tonRemove,\n\t\t\t\tonCopy,\n\t\t\t\tonPasteStyles,\n\t\t\t\tonMoveTo,\n\t\t\t\tblocks,\n\t\t\t} ) => (\n\t\t\t\t<DropdownMenu\n\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\tlabel={ __( 'Options' ) }\n\t\t\t\t\tclassName=\"block-editor-block-settings-menu\"\n\t\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t\t\topen={ open }\n\t\t\t\t\tonToggle={ onToggle }\n\t\t\t\t\tnoIcons\n\t\t\t\t\tmenuProps={ {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * @param {KeyboardEvent} event\n\t\t\t\t\t\t */\n\t\t\t\t\t\tonKeyDown( event ) {\n\t\t\t\t\t\t\tif ( event.defaultPrevented ) return;\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tisMatch( 'core/block-editor/remove', event ) &&\n\t\t\t\t\t\t\t\tcanRemove\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\tupdateSelectionAfterRemove( onRemove() );\n\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\tisMatch(\n\t\t\t\t\t\t\t\t\t'core/block-editor/duplicate',\n\t\t\t\t\t\t\t\t\tevent\n\t\t\t\t\t\t\t\t) &&\n\t\t\t\t\t\t\t\tcanDuplicate\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\tupdateSelectionAfterDuplicate( onDuplicate() );\n\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\tisMatch(\n\t\t\t\t\t\t\t\t\t'core/block-editor/insert-after',\n\t\t\t\t\t\t\t\t\tevent\n\t\t\t\t\t\t\t\t) &&\n\t\t\t\t\t\t\t\tcanInsertDefaultBlock\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\tsetOpenedBlockSettingsMenu( undefined );\n\t\t\t\t\t\t\t\tonInsertAfter();\n\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\tisMatch(\n\t\t\t\t\t\t\t\t\t'core/block-editor/insert-before',\n\t\t\t\t\t\t\t\t\tevent\n\t\t\t\t\t\t\t\t) &&\n\t\t\t\t\t\t\t\tcanInsertDefaultBlock\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\tsetOpenedBlockSettingsMenu( undefined );\n\t\t\t\t\t\t\t\tonInsertBefore();\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\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t<__unstableBlockSettingsMenuFirstItem.Slot\n\t\t\t\t\t\t\t\t\tfillProps={ { onClose } }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t{ ! parentBlockIsSelected &&\n\t\t\t\t\t\t\t\t\t!! firstParentClientId && (\n\t\t\t\t\t\t\t\t\t\t<BlockParentSelectorMenuItem\n\t\t\t\t\t\t\t\t\t\t\tparentClientId={\n\t\t\t\t\t\t\t\t\t\t\t\tfirstParentClientId\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tparentBlockType={ parentBlockType }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ count === 1 && (\n\t\t\t\t\t\t\t\t\t<BlockHTMLConvertButton\n\t\t\t\t\t\t\t\t\t\tclientId={ firstBlockClientId }\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\t<CopyMenuItem\n\t\t\t\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\t\t\t\tonCopy={ onCopy }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t{ canDuplicate && (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\tonDuplicate,\n\t\t\t\t\t\t\t\t\t\t\tupdateSelectionAfterDuplicate\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tshortcut={ shortcuts.duplicate }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Duplicate' ) }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ canInsertDefaultBlock && (\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\t\tonInsertBefore\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tshortcut={ shortcuts.insertBefore }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Add before' ) }\n\t\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\t\tonInsertAfter\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tshortcut={ shortcuts.insertAfter }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Add after' ) }\n\t\t\t\t\t\t\t\t\t\t</MenuItem>\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</MenuGroup>\n\t\t\t\t\t\t\t{ canCopyStyles && (\n\t\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t\t<CopyMenuItem\n\t\t\t\t\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\t\t\t\t\tonCopy={ onCopy }\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Copy styles' ) }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<MenuItem onClick={ onPasteStyles }>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Paste styles' ) }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<BlockSettingsMenuControls.Slot\n\t\t\t\t\t\t\t\tfillProps={ {\n\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\tcanMove,\n\t\t\t\t\t\t\t\t\tonMoveTo,\n\t\t\t\t\t\t\t\t\tonlyBlock,\n\t\t\t\t\t\t\t\t\tcount,\n\t\t\t\t\t\t\t\t\tfirstBlockClientId,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tclientIds={ clientIds }\n\t\t\t\t\t\t\t\t__unstableDisplayLocation={\n\t\t\t\t\t\t\t\t\t__unstableDisplayLocation\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{ typeof children === 'function'\n\t\t\t\t\t\t\t\t? children( { onClose } )\n\t\t\t\t\t\t\t\t: Children.map( ( child ) =>\n\t\t\t\t\t\t\t\t\t\tcloneElement( child, { onClose } )\n\t\t\t\t\t\t\t\t ) }\n\t\t\t\t\t\t\t{ canRemove && (\n\t\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\tonRemove,\n\t\t\t\t\t\t\t\t\t\t\tupdateSelectionAfterRemove\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tshortcut={ shortcuts.remove }\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t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ACRnB,0BACD,CAAG;IACHwC,QAAQ,EAAGtD,SAAS,CAACI;EAAQ,GAE3B,IAAAhD,QAAE,EAAE,QAAS,CACN,CACA,CAEX,CAEU,CAEF,CAAC;AAEjB;AAAC,IAAAuG,QAAA,GAAAC,OAAA,CAAArC,OAAA,GAEc/D,qBAAqB"}
|
|
@@ -45,8 +45,17 @@ function ChildLayoutControl({
|
|
|
45
45
|
}) {
|
|
46
46
|
const {
|
|
47
47
|
selfStretch,
|
|
48
|
-
flexSize
|
|
48
|
+
flexSize,
|
|
49
|
+
columnSpan,
|
|
50
|
+
rowSpan
|
|
49
51
|
} = childLayout;
|
|
52
|
+
const {
|
|
53
|
+
type: parentType,
|
|
54
|
+
default: {
|
|
55
|
+
type: defaultParentType = 'default'
|
|
56
|
+
} = {}
|
|
57
|
+
} = parentLayout !== null && parentLayout !== void 0 ? parentLayout : {};
|
|
58
|
+
const parentLayoutType = parentType || defaultParentType;
|
|
50
59
|
(0, _element.useEffect)(() => {
|
|
51
60
|
if (selfStretch === 'fixed' && !flexSize) {
|
|
52
61
|
onChange({
|
|
@@ -55,7 +64,7 @@ function ChildLayoutControl({
|
|
|
55
64
|
});
|
|
56
65
|
}
|
|
57
66
|
}, []);
|
|
58
|
-
return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_components.__experimentalToggleGroupControl, {
|
|
67
|
+
return (0, _react.createElement)(_react.Fragment, null, parentLayoutType === 'flex' && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_components.__experimentalToggleGroupControl, {
|
|
59
68
|
__nextHasNoMarginBottom: true,
|
|
60
69
|
size: '__unstable-large',
|
|
61
70
|
label: childLayoutOrientation(parentLayout),
|
|
@@ -64,7 +73,6 @@ function ChildLayoutControl({
|
|
|
64
73
|
onChange: value => {
|
|
65
74
|
const newFlexSize = value !== 'fixed' ? null : flexSize;
|
|
66
75
|
onChange({
|
|
67
|
-
...childLayout,
|
|
68
76
|
selfStretch: value,
|
|
69
77
|
flexSize: newFlexSize
|
|
70
78
|
});
|
|
@@ -86,12 +94,36 @@ function ChildLayoutControl({
|
|
|
86
94
|
size: '__unstable-large',
|
|
87
95
|
onChange: value => {
|
|
88
96
|
onChange({
|
|
89
|
-
|
|
97
|
+
selfStretch,
|
|
90
98
|
flexSize: value
|
|
91
99
|
});
|
|
92
100
|
},
|
|
93
101
|
value: flexSize
|
|
94
|
-
}))
|
|
102
|
+
})), parentLayoutType === 'grid' && (0, _react.createElement)(_components.__experimentalHStack, null, (0, _react.createElement)(_components.__experimentalInputControl, {
|
|
103
|
+
size: '__unstable-large',
|
|
104
|
+
label: (0, _i18n.__)('Column Span'),
|
|
105
|
+
type: "number",
|
|
106
|
+
onChange: value => {
|
|
107
|
+
onChange({
|
|
108
|
+
rowSpan,
|
|
109
|
+
columnSpan: value
|
|
110
|
+
});
|
|
111
|
+
},
|
|
112
|
+
value: columnSpan,
|
|
113
|
+
min: 1
|
|
114
|
+
}), (0, _react.createElement)(_components.__experimentalInputControl, {
|
|
115
|
+
size: '__unstable-large',
|
|
116
|
+
label: (0, _i18n.__)('Row Span'),
|
|
117
|
+
type: "number",
|
|
118
|
+
onChange: value => {
|
|
119
|
+
onChange({
|
|
120
|
+
columnSpan,
|
|
121
|
+
rowSpan: value
|
|
122
|
+
});
|
|
123
|
+
},
|
|
124
|
+
value: rowSpan,
|
|
125
|
+
min: 1
|
|
126
|
+
})));
|
|
95
127
|
}
|
|
96
128
|
function childLayoutOrientation(parentLayout) {
|
|
97
129
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_i18n","_element","helpText","selfStretch","parentLayout","orientation","__","ChildLayoutControl","value","childLayout","onChange","flexSize","useEffect","_react","createElement","Fragment","__experimentalToggleGroupControl","__nextHasNoMarginBottom","size","label","childLayoutOrientation","help","newFlexSize","isBlock","__experimentalToggleGroupControlOption","key","__experimentalUnitControl"],"sources":["@wordpress/block-editor/src/components/child-layout-control/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalUnitControl as UnitControl,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useEffect } from '@wordpress/element';\n\nfunction helpText( selfStretch, parentLayout ) {\n\tconst { orientation = 'horizontal' } = parentLayout;\n\n\tif ( selfStretch === 'fill' ) {\n\t\treturn __( 'Stretch to fill available space.' );\n\t}\n\tif ( selfStretch === 'fixed' && orientation === 'horizontal' ) {\n\t\treturn __( 'Specify a fixed width.' );\n\t} else if ( selfStretch === 'fixed' ) {\n\t\treturn __( 'Specify a fixed height.' );\n\t}\n\treturn __( 'Fit contents.' );\n}\n\n/**\n * Form to edit the child layout value.\n *\n * @param {Object} props Props.\n * @param {Object} props.value The child layout value.\n * @param {Function} props.onChange Function to update the child layout value.\n * @param {Object} props.parentLayout The parent layout value.\n *\n * @return {Element} child layout edit element.\n */\nexport default function ChildLayoutControl( {\n\tvalue: childLayout = {},\n\tonChange,\n\tparentLayout,\n} ) {\n\tconst { selfStretch, flexSize } = childLayout;\n\n\tuseEffect( () => {\n\t\tif ( selfStretch === 'fixed' && ! flexSize ) {\n\t\t\tonChange( {\n\t\t\t\t...childLayout,\n\t\t\t\tselfStretch: 'fit',\n\t\t\t} );\n\t\t}\n\t}, [] );\n\n\treturn (\n\t\t<>\n\t\t\t<ToggleGroupControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\tlabel={ childLayoutOrientation( parentLayout ) }\n\t\t\t\tvalue={ selfStretch || 'fit' }\n\t\t\t\thelp={ helpText( selfStretch, parentLayout ) }\n\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\tconst newFlexSize
|
|
1
|
+
{"version":3,"names":["_components","require","_i18n","_element","helpText","selfStretch","parentLayout","orientation","__","ChildLayoutControl","value","childLayout","onChange","flexSize","columnSpan","rowSpan","type","parentType","default","defaultParentType","parentLayoutType","useEffect","_react","createElement","Fragment","__experimentalToggleGroupControl","__nextHasNoMarginBottom","size","label","childLayoutOrientation","help","newFlexSize","isBlock","__experimentalToggleGroupControlOption","key","__experimentalUnitControl","__experimentalHStack","__experimentalInputControl","min"],"sources":["@wordpress/block-editor/src/components/child-layout-control/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalInputControl as InputControl,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useEffect } from '@wordpress/element';\n\nfunction helpText( selfStretch, parentLayout ) {\n\tconst { orientation = 'horizontal' } = parentLayout;\n\n\tif ( selfStretch === 'fill' ) {\n\t\treturn __( 'Stretch to fill available space.' );\n\t}\n\tif ( selfStretch === 'fixed' && orientation === 'horizontal' ) {\n\t\treturn __( 'Specify a fixed width.' );\n\t} else if ( selfStretch === 'fixed' ) {\n\t\treturn __( 'Specify a fixed height.' );\n\t}\n\treturn __( 'Fit contents.' );\n}\n\n/**\n * Form to edit the child layout value.\n *\n * @param {Object} props Props.\n * @param {Object} props.value The child layout value.\n * @param {Function} props.onChange Function to update the child layout value.\n * @param {Object} props.parentLayout The parent layout value.\n *\n * @return {Element} child layout edit element.\n */\nexport default function ChildLayoutControl( {\n\tvalue: childLayout = {},\n\tonChange,\n\tparentLayout,\n} ) {\n\tconst { selfStretch, flexSize, columnSpan, rowSpan } = childLayout;\n\tconst {\n\t\ttype: parentType,\n\t\tdefault: { type: defaultParentType = 'default' } = {},\n\t} = parentLayout ?? {};\n\tconst parentLayoutType = parentType || defaultParentType;\n\n\tuseEffect( () => {\n\t\tif ( selfStretch === 'fixed' && ! flexSize ) {\n\t\t\tonChange( {\n\t\t\t\t...childLayout,\n\t\t\t\tselfStretch: 'fit',\n\t\t\t} );\n\t\t}\n\t}, [] );\n\n\treturn (\n\t\t<>\n\t\t\t{ parentLayoutType === 'flex' && (\n\t\t\t\t<>\n\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\t\tlabel={ childLayoutOrientation( parentLayout ) }\n\t\t\t\t\t\tvalue={ selfStretch || 'fit' }\n\t\t\t\t\t\thelp={ helpText( selfStretch, parentLayout ) }\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tconst newFlexSize =\n\t\t\t\t\t\t\t\tvalue !== 'fixed' ? null : flexSize;\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\tselfStretch: value,\n\t\t\t\t\t\t\t\tflexSize: newFlexSize,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisBlock={ true }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\tkey={ 'fit' }\n\t\t\t\t\t\t\tvalue={ 'fit' }\n\t\t\t\t\t\t\tlabel={ __( 'Fit' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\tkey={ 'fill' }\n\t\t\t\t\t\t\tvalue={ 'fill' }\n\t\t\t\t\t\t\tlabel={ __( 'Fill' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\tkey={ 'fixed' }\n\t\t\t\t\t\t\tvalue={ 'fixed' }\n\t\t\t\t\t\t\tlabel={ __( 'Fixed' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t\t{ selfStretch === 'fixed' && (\n\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\tselfStretch,\n\t\t\t\t\t\t\t\t\tflexSize: value,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tvalue={ flexSize }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t{ parentLayoutType === 'grid' && (\n\t\t\t\t<HStack>\n\t\t\t\t\t<InputControl\n\t\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\t\tlabel={ __( 'Column Span' ) }\n\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\trowSpan,\n\t\t\t\t\t\t\t\tcolumnSpan: value,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tvalue={ columnSpan }\n\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t/>\n\t\t\t\t\t<InputControl\n\t\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\t\tlabel={ __( 'Row Span' ) }\n\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\tcolumnSpan,\n\t\t\t\t\t\t\t\trowSpan: value,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tvalue={ rowSpan }\n\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t/>\n\t\t\t\t</HStack>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport function childLayoutOrientation( parentLayout ) {\n\tconst { orientation = 'horizontal' } = parentLayout;\n\n\treturn orientation === 'horizontal' ? __( 'Width' ) : __( 'Height' );\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAOA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAXA;AACA;AACA;;AAWA,SAAS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=> !!format && !suggestedFormats.includes(format));
|
|
96
96
|
return (0, _react.createElement)(_components.__experimentalVStack, null, (0, _react.createElement)(_components.CustomSelectControl, {
|
|
97
|
-
__nextUnconstrainedWidth: true,
|
|
98
97
|
label: (0, _i18n.__)('Choose a format'),
|
|
99
98
|
options: [...suggestedOptions, customOption],
|
|
100
99
|
value: isCustom ? customOption : (_suggestedOptions$fin = suggestedOptions.find(option => option.format === format)) !== null && _suggestedOptions$fin !== void 0 ? _suggestedOptions$fin : customOption,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_date","_element","_components","EXAMPLE_DATE","Date","DateFormatPicker","format","defaultFormat","onChange","_react","createElement","className","VisuallyHidden","as","__","ToggleControl","__nextHasNoMarginBottom","label","help","dateI18n","checked","NonDefaultControls","_suggestedOptions$fin","suggestedFormats","Set","_x","suggestedOptions","map","suggestedFormat","index","key","name","customOption","__experimentalHint","isCustom","setIsCustom","useState","includes","__experimentalVStack","CustomSelectControl","__nextUnconstrainedWidth","options","value","find","option","selectedItem","TextControl","hideLabelFromVision","createInterpolateElement","Link","ExternalLink","href"],"sources":["@wordpress/block-editor/src/components/date-format-picker/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _x, __ } from '@wordpress/i18n';\nimport { dateI18n } from '@wordpress/date';\nimport { useState, createInterpolateElement } from '@wordpress/element';\nimport {\n\tTextControl,\n\tExternalLink,\n\tVisuallyHidden,\n\tCustomSelectControl,\n\tToggleControl,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\n\n// So that we can illustrate the different formats in the dropdown properly,\n// show a date that has a day greater than 12 and a month with more than three\n// letters. Here we're using 2022-01-25 which is when WordPress 5.9 was\n// released.\nconst EXAMPLE_DATE = new Date( 2022, 0, 25 );\n\n/**\n * The `DateFormatPicker` component renders controls that let the user choose a\n * _date format_. That is, how they want their dates to be formatted.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/date-format-picker/README.md\n *\n * @param {Object} props\n * @param {string|null} props.format The selected date\n * format. If\n * `null`,\n * _Default_ is\n * selected.\n * @param {string} props.defaultFormat The date format that\n * will be used if the\n * user selects\n * 'Default'.\n * @param {( format: string|null ) => void} props.onChange Called when a\n * selection is\n * made. If `null`,\n * _Default_ is\n * selected.\n */\nexport default function DateFormatPicker( {\n\tformat,\n\tdefaultFormat,\n\tonChange,\n} ) {\n\treturn (\n\t\t<fieldset className=\"block-editor-date-format-picker\">\n\t\t\t<VisuallyHidden as=\"legend\">{ __( 'Date format' ) }</VisuallyHidden>\n\t\t\t<ToggleControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Default format' ) }\n\t\t\t\thelp={ `${ __( 'Example:' ) } ${ dateI18n(\n\t\t\t\t\tdefaultFormat,\n\t\t\t\t\tEXAMPLE_DATE\n\t\t\t\t) }` }\n\t\t\t\tchecked={ ! format }\n\t\t\t\tonChange={ ( checked ) =>\n\t\t\t\t\tonChange( checked ? null : defaultFormat )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ format && (\n\t\t\t\t<NonDefaultControls format={ format } onChange={ onChange } />\n\t\t\t) }\n\t\t</fieldset>\n\t);\n}\n\nfunction NonDefaultControls( { format, onChange } ) {\n\t// Suggest a short format, medium format, long format, and a standardised\n\t// (YYYY-MM-DD) format. The short, medium, and long formats are localised as\n\t// different languages have different ways of writing these. For example, 'F\n\t// j, Y' (April 20, 2022) in American English (en_US) is 'j. F Y' (20. April\n\t// 2022) in German (de). The resultant array is de-duplicated as some\n\t// languages will use the same format string for short, medium, and long\n\t// formats.\n\tconst suggestedFormats = [\n\t\t...new Set( [\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t'Y-m-d',\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'n/j/Y', 'short date format' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'n/j/Y g:i A', 'short date format with time' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'M j, Y', 'medium date format' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'M j, Y g:i A', 'medium date format with time' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'F j, Y', 'long date format' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'M j', 'short date format without the year' ),\n\t\t] ),\n\t];\n\n\tconst suggestedOptions = suggestedFormats.map(\n\t\t( suggestedFormat, index ) => ( {\n\t\t\tkey: `suggested-${ index }`,\n\t\t\tname: dateI18n( suggestedFormat, EXAMPLE_DATE ),\n\t\t\tformat: suggestedFormat,\n\t\t} )\n\t);\n\tconst customOption = {\n\t\tkey: 'custom',\n\t\tname: __( 'Custom' ),\n\t\tclassName:\n\t\t\t'block-editor-date-format-picker__custom-format-select-control__custom-option',\n\t\t__experimentalHint: __( 'Enter your own date format' ),\n\t};\n\n\tconst [ isCustom, setIsCustom ] = useState(\n\t\t() => !! format && ! suggestedFormats.includes( format )\n\t);\n\n\treturn (\n\t\t<VStack>\n\t\t\t<CustomSelectControl\n\t\t\t\t__nextUnconstrainedWidth\n\t\t\t\tlabel={ __( 'Choose a format' ) }\n\t\t\t\toptions={ [ ...suggestedOptions, customOption ] }\n\t\t\t\tvalue={\n\t\t\t\t\tisCustom\n\t\t\t\t\t\t? customOption\n\t\t\t\t\t\t: suggestedOptions.find(\n\t\t\t\t\t\t\t\t( option ) => option.format === format\n\t\t\t\t\t\t ) ?? customOption\n\t\t\t\t}\n\t\t\t\tonChange={ ( { selectedItem } ) => {\n\t\t\t\t\tif ( selectedItem === customOption ) {\n\t\t\t\t\t\tsetIsCustom( true );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsetIsCustom( false );\n\t\t\t\t\t\tonChange( selectedItem.format );\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t{ isCustom && (\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Custom format' ) }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\thelp={ createInterpolateElement(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Enter a date or time <Link>format string</Link>.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tLink: (\n\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/customize-date-and-time-format/'\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),\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\tvalue={ format }\n\t\t\t\t\tonChange={ ( value ) => onChange( value ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AANA;AACA;AACA;;AAaA;AACA;AACA;AACA;AACA,MAAMI,YAAY,GAAG,IAAIC,IAAI,CAAE,IAAI,EAAE,CAAC,EAAE,EAAG,CAAC;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,gBAAgBA,CAAE;EACzCC,MAAM;EACNC,aAAa;EACbC;AACD,CAAC,EAAG;EACH,OACC,IAAAC,MAAA,CAAAC,aAAA;IAAUC,SAAS,EAAC;EAAiC,GACpD,IAAAF,MAAA,CAAAC,aAAA,EAACR,WAAA,CAAAU,cAAc;IAACC,EAAE,EAAC;EAAQ,GAAG,IAAAC,QAAE,EAAE,aAAc,CA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IAAAH,QAAE,EAAE,eAAgB,CAAG;IAC/BiC,mBAAmB;IACnB7B,IAAI,EAAG,IAAA8B,iCAAwB,EAC9B,IAAAlC,QAAE,EACD,kDACD,CAAC,EACD;MACCmC,IAAI,EACH,IAAAxC,MAAA,CAAAC,aAAA,EAACR,WAAA,CAAAgD,YAAY;QACZC,IAAI,EAAG,IAAArC,QAAE,EACR,6EACD;MAAG,CACH;IAEH,CACD,CAAG;IACH4B,KAAK,EAAGpC,MAAQ;IAChBE,QAAQ,EAAKkC,KAAK,IAAMlC,QAAQ,CAAEkC,KAAM;EAAG,CAC3C,CAEK,CAAC;AAEX"}
|
|
1
|
+
{"version":3,"names":["_i18n","require","_date","_element","_components","EXAMPLE_DATE","Date","DateFormatPicker","format","defaultFormat","onChange","_react","createElement","className","VisuallyHidden","as","__","ToggleControl","__nextHasNoMarginBottom","label","help","dateI18n","checked","NonDefaultControls","_suggestedOptions$fin","suggestedFormats","Set","_x","suggestedOptions","map","suggestedFormat","index","key","name","customOption","__experimentalHint","isCustom","setIsCustom","useState","includes","__experimentalVStack","CustomSelectControl","options","value","find","option","selectedItem","TextControl","hideLabelFromVision","createInterpolateElement","Link","ExternalLink","href"],"sources":["@wordpress/block-editor/src/components/date-format-picker/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _x, __ } from '@wordpress/i18n';\nimport { dateI18n } from '@wordpress/date';\nimport { useState, createInterpolateElement } from '@wordpress/element';\nimport {\n\tTextControl,\n\tExternalLink,\n\tVisuallyHidden,\n\tCustomSelectControl,\n\tToggleControl,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\n\n// So that we can illustrate the different formats in the dropdown properly,\n// show a date that has a day greater than 12 and a month with more than three\n// letters. Here we're using 2022-01-25 which is when WordPress 5.9 was\n// released.\nconst EXAMPLE_DATE = new Date( 2022, 0, 25 );\n\n/**\n * The `DateFormatPicker` component renders controls that let the user choose a\n * _date format_. That is, how they want their dates to be formatted.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/date-format-picker/README.md\n *\n * @param {Object} props\n * @param {string|null} props.format The selected date\n * format. If\n * `null`,\n * _Default_ is\n * selected.\n * @param {string} props.defaultFormat The date format that\n * will be used if the\n * user selects\n * 'Default'.\n * @param {( format: string|null ) => void} props.onChange Called when a\n * selection is\n * made. If `null`,\n * _Default_ is\n * selected.\n */\nexport default function DateFormatPicker( {\n\tformat,\n\tdefaultFormat,\n\tonChange,\n} ) {\n\treturn (\n\t\t<fieldset className=\"block-editor-date-format-picker\">\n\t\t\t<VisuallyHidden as=\"legend\">{ __( 'Date format' ) }</VisuallyHidden>\n\t\t\t<ToggleControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Default format' ) }\n\t\t\t\thelp={ `${ __( 'Example:' ) } ${ dateI18n(\n\t\t\t\t\tdefaultFormat,\n\t\t\t\t\tEXAMPLE_DATE\n\t\t\t\t) }` }\n\t\t\t\tchecked={ ! format }\n\t\t\t\tonChange={ ( checked ) =>\n\t\t\t\t\tonChange( checked ? null : defaultFormat )\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ format && (\n\t\t\t\t<NonDefaultControls format={ format } onChange={ onChange } />\n\t\t\t) }\n\t\t</fieldset>\n\t);\n}\n\nfunction NonDefaultControls( { format, onChange } ) {\n\t// Suggest a short format, medium format, long format, and a standardised\n\t// (YYYY-MM-DD) format. The short, medium, and long formats are localised as\n\t// different languages have different ways of writing these. For example, 'F\n\t// j, Y' (April 20, 2022) in American English (en_US) is 'j. F Y' (20. April\n\t// 2022) in German (de). The resultant array is de-duplicated as some\n\t// languages will use the same format string for short, medium, and long\n\t// formats.\n\tconst suggestedFormats = [\n\t\t...new Set( [\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t'Y-m-d',\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'n/j/Y', 'short date format' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'n/j/Y g:i A', 'short date format with time' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'M j, Y', 'medium date format' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'M j, Y g:i A', 'medium date format with time' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'F j, Y', 'long date format' ),\n\t\t\t/* translators: See https://www.php.net/manual/datetime.format.php */\n\t\t\t_x( 'M j', 'short date format without the year' ),\n\t\t] ),\n\t];\n\n\tconst suggestedOptions = suggestedFormats.map(\n\t\t( suggestedFormat, index ) => ( {\n\t\t\tkey: `suggested-${ index }`,\n\t\t\tname: dateI18n( suggestedFormat, EXAMPLE_DATE ),\n\t\t\tformat: suggestedFormat,\n\t\t} )\n\t);\n\tconst customOption = {\n\t\tkey: 'custom',\n\t\tname: __( 'Custom' ),\n\t\tclassName:\n\t\t\t'block-editor-date-format-picker__custom-format-select-control__custom-option',\n\t\t__experimentalHint: __( 'Enter your own date format' ),\n\t};\n\n\tconst [ isCustom, setIsCustom ] = useState(\n\t\t() => !! format && ! suggestedFormats.includes( format )\n\t);\n\n\treturn (\n\t\t<VStack>\n\t\t\t<CustomSelectControl\n\t\t\t\tlabel={ __( 'Choose a format' ) }\n\t\t\t\toptions={ [ ...suggestedOptions, customOption ] }\n\t\t\t\tvalue={\n\t\t\t\t\tisCustom\n\t\t\t\t\t\t? customOption\n\t\t\t\t\t\t: suggestedOptions.find(\n\t\t\t\t\t\t\t\t( option ) => option.format === format\n\t\t\t\t\t\t ) ?? customOption\n\t\t\t\t}\n\t\t\t\tonChange={ ( { selectedItem } ) => {\n\t\t\t\t\tif ( selectedItem === customOption ) {\n\t\t\t\t\t\tsetIsCustom( true );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsetIsCustom( false );\n\t\t\t\t\t\tonChange( selectedItem.format );\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t/>\n\t\t\t{ isCustom && (\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Custom format' ) }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t\thelp={ createInterpolateElement(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Enter a date or time <Link>format string</Link>.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tLink: (\n\t\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/customize-date-and-time-format/'\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),\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\tvalue={ format }\n\t\t\t\t\tonChange={ ( value ) => onChange( value ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AANA;AACA;AACA;;AAaA;AACA;AACA;AACA;AACA,MAAMI,YAAY,GAAG,IAAIC,IAAI,CAAE,IAAI,EAAE,CAAC,EAAE,EAAG,CAAC;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASC,gBAAgBA,CAAE;EACzCC,MAAM;EACNC,aAAa;EACbC;AACD,CAAC,EAAG;EACH,OACC,IAAAC,MAAA,CAAAC,aAAA;IAAUC,SAAS,EAAC;EAAiC,GACpD,IAAAF,MAAA,CAAAC,aAAA,EAACR,WAAA,CAAAU,cAAc;IAACC,EAAE,EAAC;EAAQ,GAAG,IAAAC,QAAE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,IAAAH,QAAE,EAAE,eAAgB,CAAG;IAC/BgC,mBAAmB;IACnB5B,IAAI,EAAG,IAAA6B,iCAAwB,EAC9B,IAAAjC,QAAE,EACD,kDACD,CAAC,EACD;MACCkC,IAAI,EACH,IAAAvC,MAAA,CAAAC,aAAA,EAACR,WAAA,CAAA+C,YAAY;QACZC,IAAI,EAAG,IAAApC,QAAE,EACR,6EACD;MAAG,CACH;IAEH,CACD,CAAG;IACH2B,KAAK,EAAGnC,MAAQ;IAChBE,QAAQ,EAAKiC,KAAK,IAAMjC,QAAQ,CAAEiC,KAAM;EAAG,CAC3C,CAEK,CAAC;AAEX"}
|
|
@@ -199,8 +199,7 @@ function FontAppearanceControl(props) {
|
|
|
199
199
|
value: currentSelection,
|
|
200
200
|
onChange: ({
|
|
201
201
|
selectedItem
|
|
202
|
-
}) => onChange(selectedItem.style)
|
|
203
|
-
__nextUnconstrainedWidth: true
|
|
202
|
+
}) => onChange(selectedItem.style)
|
|
204
203
|
});
|
|
205
204
|
}
|
|
206
205
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_element","_i18n","FONT_STYLES","name","_x","value","FONT_WEIGHTS","getFontAppearanceLabel","hasFontStyles","hasFontWeights","__","FontAppearanceControl","props","onChange","fontStyle","fontWeight","otherProps","hasStylesOrWeights","label","defaultOption","key","style","undefined","combineOptions","combinedOptions","forEach","styleName","styleValue","weightName","weightValue","optionName","sprintf","push","styleOptions","weightOptions","selectOptions","useMemo","options","currentSelection","find","option","getDescribedBy","_react","createElement","CustomSelectControl","className","describedBy","selectedItem","__nextUnconstrainedWidth"],"sources":["@wordpress/block-editor/src/components/font-appearance-control/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { CustomSelectControl } from '@wordpress/components';\nimport { useMemo } from '@wordpress/element';\nimport { __, _x, sprintf } from '@wordpress/i18n';\n\nconst FONT_STYLES = [\n\t{\n\t\tname: _x( 'Regular', 'font style' ),\n\t\tvalue: 'normal',\n\t},\n\t{\n\t\tname: _x( 'Italic', 'font style' ),\n\t\tvalue: 'italic',\n\t},\n];\n\nconst FONT_WEIGHTS = [\n\t{\n\t\tname: _x( 'Thin', 'font weight' ),\n\t\tvalue: '100',\n\t},\n\t{\n\t\tname: _x( 'Extra Light', 'font weight' ),\n\t\tvalue: '200',\n\t},\n\t{\n\t\tname: _x( 'Light', 'font weight' ),\n\t\tvalue: '300',\n\t},\n\t{\n\t\tname: _x( 'Regular', 'font weight' ),\n\t\tvalue: '400',\n\t},\n\t{\n\t\tname: _x( 'Medium', 'font weight' ),\n\t\tvalue: '500',\n\t},\n\t{\n\t\tname: _x( 'Semi Bold', 'font weight' ),\n\t\tvalue: '600',\n\t},\n\t{\n\t\tname: _x( 'Bold', 'font weight' ),\n\t\tvalue: '700',\n\t},\n\t{\n\t\tname: _x( 'Extra Bold', 'font weight' ),\n\t\tvalue: '800',\n\t},\n\t{\n\t\tname: _x( 'Black', 'font weight' ),\n\t\tvalue: '900',\n\t},\n];\n\n/**\n * Adjusts font appearance field label in case either font styles or weights\n * are disabled.\n *\n * @param {boolean} hasFontStyles Whether font styles are enabled and present.\n * @param {boolean} hasFontWeights Whether font weights are enabled and present.\n * @return {string} A label representing what font appearance is being edited.\n */\nconst getFontAppearanceLabel = ( hasFontStyles, hasFontWeights ) => {\n\tif ( ! hasFontStyles ) {\n\t\treturn __( 'Font weight' );\n\t}\n\n\tif ( ! hasFontWeights ) {\n\t\treturn __( 'Font style' );\n\t}\n\n\treturn __( 'Appearance' );\n};\n\n/**\n * Control to display unified font style and weight options.\n *\n * @param {Object} props Component props.\n *\n * @return {Element} Font appearance control.\n */\nexport default function FontAppearanceControl( props ) {\n\tconst {\n\t\tonChange,\n\t\thasFontStyles = true,\n\t\thasFontWeights = true,\n\t\tvalue: { fontStyle, fontWeight },\n\t\t...otherProps\n\t} = props;\n\tconst hasStylesOrWeights = hasFontStyles || hasFontWeights;\n\tconst label = getFontAppearanceLabel( hasFontStyles, hasFontWeights );\n\tconst defaultOption = {\n\t\tkey: 'default',\n\t\tname: __( 'Default' ),\n\t\tstyle: { fontStyle: undefined, fontWeight: undefined },\n\t};\n\n\t// Combines both font style and weight options into a single dropdown.\n\tconst combineOptions = () => {\n\t\tconst combinedOptions = [ defaultOption ];\n\n\t\tFONT_STYLES.forEach( ( { name: styleName, value: styleValue } ) => {\n\t\t\tFONT_WEIGHTS.forEach(\n\t\t\t\t( { name: weightName, value: weightValue } ) => {\n\t\t\t\t\tconst optionName =\n\t\t\t\t\t\tstyleValue === 'normal'\n\t\t\t\t\t\t\t? weightName\n\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: 1: Font weight name. 2: Font style name. */\n\t\t\t\t\t\t\t\t\t__( '%1$s %2$s' ),\n\t\t\t\t\t\t\t\t\tweightName,\n\t\t\t\t\t\t\t\t\tstyleName\n\t\t\t\t\t\t\t );\n\n\t\t\t\t\tcombinedOptions.push( {\n\t\t\t\t\t\tkey: `${ styleValue }-${ weightValue }`,\n\t\t\t\t\t\tname: optionName,\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\tfontStyle: styleValue,\n\t\t\t\t\t\t\tfontWeight: weightValue,\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t);\n\t\t} );\n\n\t\treturn combinedOptions;\n\t};\n\n\t// Generates select options for font styles only.\n\tconst styleOptions = () => {\n\t\tconst combinedOptions = [ defaultOption ];\n\t\tFONT_STYLES.forEach( ( { name, value } ) => {\n\t\t\tcombinedOptions.push( {\n\t\t\t\tkey: value,\n\t\t\t\tname,\n\t\t\t\tstyle: { fontStyle: value, fontWeight: undefined },\n\t\t\t} );\n\t\t} );\n\t\treturn combinedOptions;\n\t};\n\n\t// Generates select options for font weights only.\n\tconst weightOptions = () => {\n\t\tconst combinedOptions = [ defaultOption ];\n\t\tFONT_WEIGHTS.forEach( ( { name, value } ) => {\n\t\t\tcombinedOptions.push( {\n\t\t\t\tkey: value,\n\t\t\t\tname,\n\t\t\t\tstyle: { fontStyle: undefined, fontWeight: value },\n\t\t\t} );\n\t\t} );\n\t\treturn combinedOptions;\n\t};\n\n\t// Map font styles and weights to select options.\n\tconst selectOptions = useMemo( () => {\n\t\tif ( hasFontStyles && hasFontWeights ) {\n\t\t\treturn combineOptions();\n\t\t}\n\n\t\treturn hasFontStyles ? styleOptions() : weightOptions();\n\t}, [ props.options ] );\n\n\t// Find current selection by comparing font style & weight against options,\n\t// and fall back to the Default option if there is no matching option.\n\tconst currentSelection =\n\t\tselectOptions.find(\n\t\t\t( option ) =>\n\t\t\t\toption.style.fontStyle === fontStyle &&\n\t\t\t\toption.style.fontWeight === fontWeight\n\t\t) || selectOptions[ 0 ];\n\n\t// Adjusts screen reader description based on styles or weights.\n\tconst getDescribedBy = () => {\n\t\tif ( ! currentSelection ) {\n\t\t\treturn __( 'No selected font appearance' );\n\t\t}\n\n\t\tif ( ! hasFontStyles ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: %s: Currently selected font weight.\n\t\t\t\t__( 'Currently selected font weight: %s' ),\n\t\t\t\tcurrentSelection.name\n\t\t\t);\n\t\t}\n\n\t\tif ( ! hasFontWeights ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: %s: Currently selected font style.\n\t\t\t\t__( 'Currently selected font style: %s' ),\n\t\t\t\tcurrentSelection.name\n\t\t\t);\n\t\t}\n\n\t\treturn sprintf(\n\t\t\t// translators: %s: Currently selected font appearance.\n\t\t\t__( 'Currently selected font appearance: %s' ),\n\t\t\tcurrentSelection.name\n\t\t);\n\t};\n\n\treturn (\n\t\thasStylesOrWeights && (\n\t\t\t<CustomSelectControl\n\t\t\t\t{ ...otherProps }\n\t\t\t\tclassName=\"components-font-appearance-control\"\n\t\t\t\tlabel={ label }\n\t\t\t\tdescribedBy={ getDescribedBy() }\n\t\t\t\toptions={ selectOptions }\n\t\t\t\tvalue={ currentSelection }\n\t\t\t\tonChange={ ( { selected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O,EAAGF,aAAe;IACzB9B,KAAK,EAAGiC,gBAAkB;IAC1BzB,QAAQ,EAAGA,CAAE;MAAEkC;IAAa,CAAC,KAC5BlC,QAAQ,CAAEkC,YAAY,CAAC1B,KAAM,CAC7B;IACD2B,wBAAwB;EAAA,CACxB,CACD;AAEH"}
|
|
1
|
+
{"version":3,"names":["_components","require","_element","_i18n","FONT_STYLES","name","_x","value","FONT_WEIGHTS","getFontAppearanceLabel","hasFontStyles","hasFontWeights","__","FontAppearanceControl","props","onChange","fontStyle","fontWeight","otherProps","hasStylesOrWeights","label","defaultOption","key","style","undefined","combineOptions","combinedOptions","forEach","styleName","styleValue","weightName","weightValue","optionName","sprintf","push","styleOptions","weightOptions","selectOptions","useMemo","options","currentSelection","find","option","getDescribedBy","_react","createElement","CustomSelectControl","className","describedBy","selectedItem"],"sources":["@wordpress/block-editor/src/components/font-appearance-control/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { CustomSelectControl } from '@wordpress/components';\nimport { useMemo } from '@wordpress/element';\nimport { __, _x, sprintf } from '@wordpress/i18n';\n\nconst FONT_STYLES = [\n\t{\n\t\tname: _x( 'Regular', 'font style' ),\n\t\tvalue: 'normal',\n\t},\n\t{\n\t\tname: _x( 'Italic', 'font style' ),\n\t\tvalue: 'italic',\n\t},\n];\n\nconst FONT_WEIGHTS = [\n\t{\n\t\tname: _x( 'Thin', 'font weight' ),\n\t\tvalue: '100',\n\t},\n\t{\n\t\tname: _x( 'Extra Light', 'font weight' ),\n\t\tvalue: '200',\n\t},\n\t{\n\t\tname: _x( 'Light', 'font weight' ),\n\t\tvalue: '300',\n\t},\n\t{\n\t\tname: _x( 'Regular', 'font weight' ),\n\t\tvalue: '400',\n\t},\n\t{\n\t\tname: _x( 'Medium', 'font weight' ),\n\t\tvalue: '500',\n\t},\n\t{\n\t\tname: _x( 'Semi Bold', 'font weight' ),\n\t\tvalue: '600',\n\t},\n\t{\n\t\tname: _x( 'Bold', 'font weight' ),\n\t\tvalue: '700',\n\t},\n\t{\n\t\tname: _x( 'Extra Bold', 'font weight' ),\n\t\tvalue: '800',\n\t},\n\t{\n\t\tname: _x( 'Black', 'font weight' ),\n\t\tvalue: '900',\n\t},\n];\n\n/**\n * Adjusts font appearance field label in case either font styles or weights\n * are disabled.\n *\n * @param {boolean} hasFontStyles Whether font styles are enabled and present.\n * @param {boolean} hasFontWeights Whether font weights are enabled and present.\n * @return {string} A label representing what font appearance is being edited.\n */\nconst getFontAppearanceLabel = ( hasFontStyles, hasFontWeights ) => {\n\tif ( ! hasFontStyles ) {\n\t\treturn __( 'Font weight' );\n\t}\n\n\tif ( ! hasFontWeights ) {\n\t\treturn __( 'Font style' );\n\t}\n\n\treturn __( 'Appearance' );\n};\n\n/**\n * Control to display unified font style and weight options.\n *\n * @param {Object} props Component props.\n *\n * @return {Element} Font appearance control.\n */\nexport default function FontAppearanceControl( props ) {\n\tconst {\n\t\tonChange,\n\t\thasFontStyles = true,\n\t\thasFontWeights = true,\n\t\tvalue: { fontStyle, fontWeight },\n\t\t...otherProps\n\t} = props;\n\tconst hasStylesOrWeights = hasFontStyles || hasFontWeights;\n\tconst label = getFontAppearanceLabel( hasFontStyles, hasFontWeights );\n\tconst defaultOption = {\n\t\tkey: 'default',\n\t\tname: __( 'Default' ),\n\t\tstyle: { fontStyle: undefined, fontWeight: undefined },\n\t};\n\n\t// Combines both font style and weight options into a single dropdown.\n\tconst combineOptions = () => {\n\t\tconst combinedOptions = [ defaultOption ];\n\n\t\tFONT_STYLES.forEach( ( { name: styleName, value: styleValue } ) => {\n\t\t\tFONT_WEIGHTS.forEach(\n\t\t\t\t( { name: weightName, value: weightValue } ) => {\n\t\t\t\t\tconst optionName =\n\t\t\t\t\t\tstyleValue === 'normal'\n\t\t\t\t\t\t\t? weightName\n\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: 1: Font weight name. 2: Font style name. */\n\t\t\t\t\t\t\t\t\t__( '%1$s %2$s' ),\n\t\t\t\t\t\t\t\t\tweightName,\n\t\t\t\t\t\t\t\t\tstyleName\n\t\t\t\t\t\t\t );\n\n\t\t\t\t\tcombinedOptions.push( {\n\t\t\t\t\t\tkey: `${ styleValue }-${ weightValue }`,\n\t\t\t\t\t\tname: optionName,\n\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\tfontStyle: styleValue,\n\t\t\t\t\t\t\tfontWeight: weightValue,\n\t\t\t\t\t\t},\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t);\n\t\t} );\n\n\t\treturn combinedOptions;\n\t};\n\n\t// Generates select options for font styles only.\n\tconst styleOptions = () => {\n\t\tconst combinedOptions = [ defaultOption ];\n\t\tFONT_STYLES.forEach( ( { name, value } ) => {\n\t\t\tcombinedOptions.push( {\n\t\t\t\tkey: value,\n\t\t\t\tname,\n\t\t\t\tstyle: { fontStyle: value, fontWeight: undefined },\n\t\t\t} );\n\t\t} );\n\t\treturn combinedOptions;\n\t};\n\n\t// Generates select options for font weights only.\n\tconst weightOptions = () => {\n\t\tconst combinedOptions = [ defaultOption ];\n\t\tFONT_WEIGHTS.forEach( ( { name, value } ) => {\n\t\t\tcombinedOptions.push( {\n\t\t\t\tkey: value,\n\t\t\t\tname,\n\t\t\t\tstyle: { fontStyle: undefined, fontWeight: value },\n\t\t\t} );\n\t\t} );\n\t\treturn combinedOptions;\n\t};\n\n\t// Map font styles and weights to select options.\n\tconst selectOptions = useMemo( () => {\n\t\tif ( hasFontStyles && hasFontWeights ) {\n\t\t\treturn combineOptions();\n\t\t}\n\n\t\treturn hasFontStyles ? styleOptions() : weightOptions();\n\t}, [ props.options ] );\n\n\t// Find current selection by comparing font style & weight against options,\n\t// and fall back to the Default option if there is no matching option.\n\tconst currentSelection =\n\t\tselectOptions.find(\n\t\t\t( option ) =>\n\t\t\t\toption.style.fontStyle === fontStyle &&\n\t\t\t\toption.style.fontWeight === fontWeight\n\t\t) || selectOptions[ 0 ];\n\n\t// Adjusts screen reader description based on styles or weights.\n\tconst getDescribedBy = () => {\n\t\tif ( ! currentSelection ) {\n\t\t\treturn __( 'No selected font appearance' );\n\t\t}\n\n\t\tif ( ! hasFontStyles ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: %s: Currently selected font weight.\n\t\t\t\t__( 'Currently selected font weight: %s' ),\n\t\t\t\tcurrentSelection.name\n\t\t\t);\n\t\t}\n\n\t\tif ( ! hasFontWeights ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: %s: Currently selected font style.\n\t\t\t\t__( 'Currently selected font style: %s' ),\n\t\t\t\tcurrentSelection.name\n\t\t\t);\n\t\t}\n\n\t\treturn sprintf(\n\t\t\t// translators: %s: Currently selected font appearance.\n\t\t\t__( 'Currently selected font appearance: %s' ),\n\t\t\tcurrentSelection.name\n\t\t);\n\t};\n\n\treturn (\n\t\thasStylesOrWeights && (\n\t\t\t<CustomSelectControl\n\t\t\t\t{ ...otherProps }\n\t\t\t\tclassName=\"components-font-appearance-control\"\n\t\t\t\tlabel={ label }\n\t\t\t\tdescribedBy={ getDescribedBy() }\n\t\t\t\toptions={ selectOptions }\n\t\t\t\tvalue={ currentSelection }\n\t\t\t\tonChange={ ( { selectedItem } ) =>\n\t\t\t\t\tonChange( selectedItem.style )\n\t\t\t\t}\n\t\t\t/>\n\t\t)\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AALA;AACA;AACA;;AAKA,MAAMG,WAAW,GAAG,CACnB;EACCC,IAAI,EAAE,IAAAC,QAAE,EAAE,SAAS,EAAE,YAAa,CAAC;EACnCC,KAAK,EAAE;AACR,CAAC,EACD;EACCF,IAAI,EAAE,IAAAC,QAAE,EAAE,QAAQ,EAAE,YAAa,CAAC;EAClCC,KAAK,EAAE;AACR,CAAC,CACD;AAED,MAAMC,YAAY,GAAG,CACpB;EACCH,IAAI,EAAE,IAAAC,QAAE,EAAE,MA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5B,IAAK,CAAEH,gBAAgB,EAAG;MACzB,OAAO,IAAA5B,QAAE,EAAE,6BAA8B,CAAC;IAC3C;IAEA,IAAK,CAAEF,aAAa,EAAG;MACtB,OAAO,IAAAuB,aAAO;MACb;MACA,IAAArB,QAAE,EAAE,oCAAqC,CAAC,EAC1C4B,gBAAgB,CAACnC,IAClB,CAAC;IACF;IAEA,IAAK,CAAEM,cAAc,EAAG;MACvB,OAAO,IAAAsB,aAAO;MACb;MACA,IAAArB,QAAE,EAAE,mCAAoC,CAAC,EACzC4B,gBAAgB,CAACnC,IAClB,CAAC;IACF;IAEA,OAAO,IAAA4B,aAAO;IACb;IACA,IAAArB,QAAE,EAAE,wCAAyC,CAAC,EAC9C4B,gBAAgB,CAACnC,IAClB,CAAC;EACF,CAAC;EAED,OACCc,kBAAkB,IACjB,IAAAyB,MAAA,CAAAC,aAAA,EAAC7C,WAAA,CAAA8C,mBAAmB;IAAA,GACd5B,UAAU;IACf6B,SAAS,EAAC,oCAAoC;IAC9C3B,KAAK,EAAGA,KAAO;IACf4B,WAAW,EAAGL,cAAc,CAAC,CAAG;IAChCJ,OAAO,EAAGF,aAAe;IACzB9B,KAAK,EAAGiC,gBAAkB;IAC1BzB,QAAQ,EAAGA,CAAE;MAAEkC;IAAa,CAAC,KAC5BlC,QAAQ,CAAEkC,YAAY,CAAC1B,KAAM;EAC7B,CACD,CACD;AAEH"}
|
|
@@ -73,7 +73,7 @@ function useHasChildLayout(settings) {
|
|
|
73
73
|
} = {},
|
|
74
74
|
allowSizingOnChildren = false
|
|
75
75
|
} = (_settings$parentLayou = settings?.parentLayout) !== null && _settings$parentLayou !== void 0 ? _settings$parentLayou : {};
|
|
76
|
-
const support = (defaultParentLayoutType === 'flex' || parentLayoutType === 'flex') && allowSizingOnChildren;
|
|
76
|
+
const support = (defaultParentLayoutType === 'flex' || parentLayoutType === 'flex' || defaultParentLayoutType === 'grid' || parentLayoutType === 'grid') && allowSizingOnChildren;
|
|
77
77
|
return !!settings?.layout && support;
|
|
78
78
|
}
|
|
79
79
|
function useHasSpacingPresets(settings) {
|
|
@@ -179,7 +179,7 @@ function DimensionsPanel({
|
|
|
179
179
|
// in global styles but not in block inspector.
|
|
180
180
|
includeLayoutControls = false
|
|
181
181
|
}) {
|
|
182
|
-
var _settings$parentLayou2, _defaultControls$cont, _defaultControls$wide, _defaultControls$padd, _defaultControls$marg, _defaultControls$bloc, _defaultControls$
|
|
182
|
+
var _settings$parentLayou2, _settings$parentLayou3, _defaultControls$cont, _defaultControls$wide, _defaultControls$padd, _defaultControls$marg, _defaultControls$bloc, _defaultControls$chil, _defaultControls$minH, _defaultControls$aspe;
|
|
183
183
|
const {
|
|
184
184
|
dimensions,
|
|
185
185
|
spacing
|
|
@@ -309,12 +309,19 @@ function DimensionsPanel({
|
|
|
309
309
|
const {
|
|
310
310
|
orientation = 'horizontal'
|
|
311
311
|
} = (_settings$parentLayou2 = settings?.parentLayout) !== null && _settings$parentLayou2 !== void 0 ? _settings$parentLayou2 : {};
|
|
312
|
-
const
|
|
312
|
+
const {
|
|
313
|
+
type: parentType,
|
|
314
|
+
default: {
|
|
315
|
+
type: defaultParentType = 'default'
|
|
316
|
+
} = {}
|
|
317
|
+
} = (_settings$parentLayou3 = settings?.parentLayout) !== null && _settings$parentLayou3 !== void 0 ? _settings$parentLayou3 : {};
|
|
318
|
+
const parentLayoutType = parentType || defaultParentType;
|
|
319
|
+
const flexResetLabel = orientation === 'horizontal' ? (0, _i18n.__)('Width') : (0, _i18n.__)('Height');
|
|
320
|
+
const childLayoutResetLabel = parentLayoutType === 'flex' ? flexResetLabel : (0, _i18n.__)('Grid spans');
|
|
313
321
|
const setChildLayout = newChildLayout => {
|
|
314
322
|
onChange({
|
|
315
323
|
...value,
|
|
316
324
|
layout: {
|
|
317
|
-
...value?.layout,
|
|
318
325
|
...newChildLayout
|
|
319
326
|
}
|
|
320
327
|
});
|
|
@@ -322,7 +329,9 @@ function DimensionsPanel({
|
|
|
322
329
|
const resetChildLayoutValue = () => {
|
|
323
330
|
setChildLayout({
|
|
324
331
|
selfStretch: undefined,
|
|
325
|
-
flexSize: undefined
|
|
332
|
+
flexSize: undefined,
|
|
333
|
+
columnSpan: undefined,
|
|
334
|
+
rowSpan: undefined
|
|
326
335
|
});
|
|
327
336
|
};
|
|
328
337
|
const hasChildLayoutValue = () => !!value?.layout;
|
|
@@ -334,7 +343,9 @@ function DimensionsPanel({
|
|
|
334
343
|
contentSize: undefined,
|
|
335
344
|
wideSize: undefined,
|
|
336
345
|
selfStretch: undefined,
|
|
337
|
-
flexSize: undefined
|
|
346
|
+
flexSize: undefined,
|
|
347
|
+
columnSpan: undefined,
|
|
348
|
+
rowSpan: undefined
|
|
338
349
|
}),
|
|
339
350
|
spacing: {
|
|
340
351
|
...previousValue?.spacing,
|
|
@@ -489,6 +500,18 @@ function DimensionsPanel({
|
|
|
489
500
|
,
|
|
490
501
|
values: gapValues,
|
|
491
502
|
allowReset: false
|
|
503
|
+
})), showChildLayoutControl && (0, _react.createElement)(_components.__experimentalVStack, {
|
|
504
|
+
as: _components.__experimentalToolsPanelItem,
|
|
505
|
+
spacing: 2,
|
|
506
|
+
hasValue: hasChildLayoutValue,
|
|
507
|
+
label: childLayoutResetLabel,
|
|
508
|
+
onDeselect: resetChildLayoutValue,
|
|
509
|
+
isShownByDefault: (_defaultControls$chil = defaultControls.childLayout) !== null && _defaultControls$chil !== void 0 ? _defaultControls$chil : DEFAULT_CONTROLS.childLayout,
|
|
510
|
+
panelId: panelId
|
|
511
|
+
}, (0, _react.createElement)(_childLayoutControl.default, {
|
|
512
|
+
value: childLayout,
|
|
513
|
+
onChange: setChildLayout,
|
|
514
|
+
parentLayout: settings?.parentLayout
|
|
492
515
|
})), showMinHeightControl && (0, _react.createElement)(_components.__experimentalToolsPanelItem, {
|
|
493
516
|
hasValue: hasMinHeightValue,
|
|
494
517
|
label: (0, _i18n.__)('Minimum height'),
|
|
@@ -505,18 +528,6 @@ function DimensionsPanel({
|
|
|
505
528
|
onChange: setAspectRatioValue,
|
|
506
529
|
panelId: panelId,
|
|
507
530
|
isShownByDefault: (_defaultControls$aspe = defaultControls.aspectRatio) !== null && _defaultControls$aspe !== void 0 ? _defaultControls$aspe : DEFAULT_CONTROLS.aspectRatio
|
|
508
|
-
})
|
|
509
|
-
as: _components.__experimentalToolsPanelItem,
|
|
510
|
-
spacing: 2,
|
|
511
|
-
hasValue: hasChildLayoutValue,
|
|
512
|
-
label: childLayoutOrientationLabel,
|
|
513
|
-
onDeselect: resetChildLayoutValue,
|
|
514
|
-
isShownByDefault: (_defaultControls$chil = defaultControls.childLayout) !== null && _defaultControls$chil !== void 0 ? _defaultControls$chil : DEFAULT_CONTROLS.childLayout,
|
|
515
|
-
panelId: panelId
|
|
516
|
-
}, (0, _react.createElement)(_childLayoutControl.default, {
|
|
517
|
-
value: childLayout,
|
|
518
|
-
onChange: setChildLayout,
|
|
519
|
-
parentLayout: settings?.parentLayout
|
|
520
|
-
})));
|
|
531
|
+
}));
|
|
521
532
|
}
|
|
522
533
|
//# sourceMappingURL=dimensions-panel.js.map
|