@wordpress/block-library 9.29.1-next.f34ab90e9.0 → 9.30.1-next.6870dfe5b.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.
Files changed (168) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/accordion/edit.js +18 -1
  3. package/build/accordion/edit.js.map +1 -1
  4. package/build/accordion/index.js +0 -3
  5. package/build/accordion/index.js.map +1 -1
  6. package/build/accordion-content/edit.js +8 -8
  7. package/build/accordion-content/edit.js.map +1 -1
  8. package/build/accordion-content/index.js +2 -5
  9. package/build/accordion-content/index.js.map +1 -1
  10. package/build/accordion-header/index.js +0 -4
  11. package/build/accordion-header/index.js.map +1 -1
  12. package/build/accordion-panel/edit.js +5 -30
  13. package/build/accordion-panel/edit.js.map +1 -1
  14. package/build/accordion-panel/index.js +2 -5
  15. package/build/accordion-panel/index.js.map +1 -1
  16. package/build/accordion-panel/save.js +3 -29
  17. package/build/accordion-panel/save.js.map +1 -1
  18. package/build/audio/edit.js +3 -1
  19. package/build/audio/edit.js.map +1 -1
  20. package/build/gallery/index.js +2 -1
  21. package/build/gallery/index.js.map +1 -1
  22. package/build/group/variations.js +0 -12
  23. package/build/group/variations.js.map +1 -1
  24. package/build/image/image.js +1 -1
  25. package/build/image/image.js.map +1 -1
  26. package/build/navigation/constants.js +5 -1
  27. package/build/navigation/constants.js.map +1 -1
  28. package/build/navigation/edit/index.js +45 -1
  29. package/build/navigation/edit/index.js.map +1 -1
  30. package/build/navigation/edit/leaf-more-menu.js +0 -1
  31. package/build/navigation/edit/leaf-more-menu.js.map +1 -1
  32. package/build/navigation/edit/menu-inspector-controls.js +40 -5
  33. package/build/navigation/edit/menu-inspector-controls.js.map +1 -1
  34. package/build/navigation-link/block-inserter.js +69 -0
  35. package/build/navigation-link/block-inserter.js.map +1 -0
  36. package/build/navigation-link/dialog-wrapper.js +80 -0
  37. package/build/navigation-link/dialog-wrapper.js.map +1 -0
  38. package/build/navigation-link/link-ui.js +80 -116
  39. package/build/navigation-link/link-ui.js.map +1 -1
  40. package/build/navigation-link/page-creator.js +137 -0
  41. package/build/navigation-link/page-creator.js.map +1 -0
  42. package/build/query/edit/index.js.map +1 -1
  43. package/build/query/edit/query-content.js +7 -6
  44. package/build/query/edit/query-content.js.map +1 -1
  45. package/build/query/edit/query-placeholder.js +30 -9
  46. package/build/query/edit/query-placeholder.js.map +1 -1
  47. package/build/query/edit/query-toolbar.js +4 -2
  48. package/build/query/edit/query-toolbar.js.map +1 -1
  49. package/build/search/edit.js +22 -14
  50. package/build/search/edit.js.map +1 -1
  51. package/build/template-part/edit/placeholder.js +2 -1
  52. package/build/template-part/edit/placeholder.js.map +1 -1
  53. package/build/video/edit.js +3 -1
  54. package/build/video/edit.js.map +1 -1
  55. package/build-module/accordion/edit.js +20 -3
  56. package/build-module/accordion/edit.js.map +1 -1
  57. package/build-module/accordion/index.js +0 -3
  58. package/build-module/accordion/index.js.map +1 -1
  59. package/build-module/accordion-content/edit.js +8 -8
  60. package/build-module/accordion-content/edit.js.map +1 -1
  61. package/build-module/accordion-content/index.js +2 -5
  62. package/build-module/accordion-content/index.js.map +1 -1
  63. package/build-module/accordion-header/index.js +0 -4
  64. package/build-module/accordion-header/index.js.map +1 -1
  65. package/build-module/accordion-panel/edit.js +6 -29
  66. package/build-module/accordion-panel/edit.js.map +1 -1
  67. package/build-module/accordion-panel/index.js +2 -5
  68. package/build-module/accordion-panel/index.js.map +1 -1
  69. package/build-module/accordion-panel/save.js +4 -28
  70. package/build-module/accordion-panel/save.js.map +1 -1
  71. package/build-module/audio/edit.js +4 -2
  72. package/build-module/audio/edit.js.map +1 -1
  73. package/build-module/gallery/index.js +2 -1
  74. package/build-module/gallery/index.js.map +1 -1
  75. package/build-module/group/variations.js +0 -12
  76. package/build-module/group/variations.js.map +1 -1
  77. package/build-module/image/image.js +1 -1
  78. package/build-module/image/image.js.map +1 -1
  79. package/build-module/navigation/constants.js +5 -1
  80. package/build-module/navigation/constants.js.map +1 -1
  81. package/build-module/navigation/edit/index.js +50 -4
  82. package/build-module/navigation/edit/index.js.map +1 -1
  83. package/build-module/navigation/edit/leaf-more-menu.js +0 -1
  84. package/build-module/navigation/edit/leaf-more-menu.js.map +1 -1
  85. package/build-module/navigation/edit/menu-inspector-controls.js +40 -5
  86. package/build-module/navigation/edit/menu-inspector-controls.js.map +1 -1
  87. package/build-module/navigation-link/block-inserter.js +61 -0
  88. package/build-module/navigation-link/block-inserter.js.map +1 -0
  89. package/build-module/navigation-link/dialog-wrapper.js +75 -0
  90. package/build-module/navigation-link/dialog-wrapper.js.map +1 -0
  91. package/build-module/navigation-link/link-ui.js +85 -121
  92. package/build-module/navigation-link/link-ui.js.map +1 -1
  93. package/build-module/navigation-link/page-creator.js +130 -0
  94. package/build-module/navigation-link/page-creator.js.map +1 -0
  95. package/build-module/query/edit/index.js.map +1 -1
  96. package/build-module/query/edit/query-content.js +8 -7
  97. package/build-module/query/edit/query-content.js.map +1 -1
  98. package/build-module/query/edit/query-placeholder.js +30 -10
  99. package/build-module/query/edit/query-placeholder.js.map +1 -1
  100. package/build-module/query/edit/query-toolbar.js +4 -2
  101. package/build-module/query/edit/query-toolbar.js.map +1 -1
  102. package/build-module/search/edit.js +22 -14
  103. package/build-module/search/edit.js.map +1 -1
  104. package/build-module/template-part/edit/placeholder.js +2 -1
  105. package/build-module/template-part/edit/placeholder.js.map +1 -1
  106. package/build-module/video/edit.js +4 -2
  107. package/build-module/video/edit.js.map +1 -1
  108. package/build-style/accordion/style-rtl.css +8 -18
  109. package/build-style/accordion/style.css +8 -18
  110. package/build-style/editor-rtl.css +18 -0
  111. package/build-style/editor.css +18 -0
  112. package/build-style/form-input/style-rtl.css +4 -3
  113. package/build-style/form-input/style.css +4 -3
  114. package/build-style/navigation-link/editor-rtl.css +14 -0
  115. package/build-style/navigation-link/editor.css +14 -0
  116. package/build-style/navigation-link/style-rtl.css +1 -1
  117. package/build-style/navigation-link/style.css +1 -1
  118. package/build-style/post-comments-form/style-rtl.css +8 -5
  119. package/build-style/post-comments-form/style.css +8 -5
  120. package/build-style/query/editor-rtl.css +4 -0
  121. package/build-style/query/editor.css +4 -0
  122. package/build-style/search/style-rtl.css +11 -12
  123. package/build-style/search/style.css +11 -12
  124. package/build-style/style-rtl.css +32 -40
  125. package/build-style/style.css +32 -40
  126. package/package.json +35 -35
  127. package/src/accordion/block.json +0 -3
  128. package/src/accordion/edit.js +20 -0
  129. package/src/accordion/style.scss +12 -21
  130. package/src/accordion-content/block.json +2 -4
  131. package/src/accordion-content/edit.js +21 -27
  132. package/src/accordion-content/index.js +0 -1
  133. package/src/accordion-header/block.json +0 -3
  134. package/src/accordion-header/index.js +0 -1
  135. package/src/accordion-panel/block.json +2 -4
  136. package/src/accordion-panel/edit.js +11 -51
  137. package/src/accordion-panel/index.js +0 -1
  138. package/src/accordion-panel/save.js +4 -45
  139. package/src/audio/edit.js +6 -1
  140. package/src/cover/test/edit.js +1 -5
  141. package/src/form-input/style.scss +3 -2
  142. package/src/gallery/block.json +2 -1
  143. package/src/gallery/index.php +1 -1
  144. package/src/gallery/test/helpers.native.js +3 -3
  145. package/src/group/variations.js +0 -12
  146. package/src/image/image.js +2 -1
  147. package/src/navigation/constants.js +4 -0
  148. package/src/navigation/edit/index.js +50 -1
  149. package/src/navigation/edit/leaf-more-menu.js +0 -1
  150. package/src/navigation/edit/menu-inspector-controls.js +40 -5
  151. package/src/navigation-link/block-inserter.js +65 -0
  152. package/src/navigation-link/dialog-wrapper.js +74 -0
  153. package/src/navigation-link/editor.scss +17 -0
  154. package/src/navigation-link/link-ui.js +108 -158
  155. package/src/navigation-link/page-creator.js +157 -0
  156. package/src/navigation-link/style.scss +1 -1
  157. package/src/post-comments-form/style.scss +11 -11
  158. package/src/post-date/index.php +2 -1
  159. package/src/query/edit/index.js +1 -0
  160. package/src/query/edit/query-content.js +8 -4
  161. package/src/query/edit/query-placeholder.js +47 -17
  162. package/src/query/edit/query-toolbar.js +10 -2
  163. package/src/query/editor.scss +6 -1
  164. package/src/search/edit.js +44 -13
  165. package/src/search/index.php +16 -2
  166. package/src/search/style.scss +15 -16
  167. package/src/template-part/edit/placeholder.js +2 -1
  168. package/src/video/edit.js +6 -1
@@ -125,7 +125,13 @@ function QueryContent({
125
125
  }
126
126
  }, [queryId, instanceId, __unstableMarkNextChangeAsNotPersistent, setAttributes]);
127
127
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
128
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_enhancedPaginationModal.default, {
128
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.BlockControls, {
129
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_queryToolbar.default, {
130
+ clientId: clientId,
131
+ attributes: attributes,
132
+ hasInnerBlocks: true
133
+ })
134
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_enhancedPaginationModal.default, {
129
135
  attributes: attributes,
130
136
  setAttributes: setAttributes,
131
137
  clientId: clientId
@@ -138,11 +144,6 @@ function QueryContent({
138
144
  clientId: clientId,
139
145
  isSingular: isSingular
140
146
  })
141
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.BlockControls, {
142
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_queryToolbar.default, {
143
- attributes: attributes,
144
- clientId: clientId
145
- })
146
147
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_blockEditor.InspectorControls, {
147
148
  group: "advanced",
148
149
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(HTMLElementControl, {
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_compose","_element","_blockEditor","_i18n","_coreData","_enhancedPaginationControl","_interopRequireDefault","_lockUnlock","_inspectorControls","_enhancedPaginationModal","_utils","_queryToolbar","_jsxRuntime","HTMLElementControl","unlock","blockEditorPrivateApis","DEFAULTS_POSTS_PER_PAGE","TEMPLATE","QueryContent","attributes","setAttributes","clientId","context","name","queryId","query","enhancedPagination","tagName","TagName","inherit","templateSlug","isSingular","getQueryContextFromTemplate","__unstableMarkNextChangeAsNotPersistent","useDispatch","blockEditorStore","instanceId","useInstanceId","blockProps","useBlockProps","innerBlocksProps","useInnerBlocksProps","template","postsPerPage","useSelect","select","getSettings","getEntityRecord","getEntityRecordEdits","canUser","coreStore","settingPerPage","kind","posts_per_page","editedSettingPerPage","updateQuery","useCallback","newQuery","prevAttributes","useEffect","perPage","Object","keys","length","Number","isFinite","jsxs","Fragment","children","jsx","default","InspectorControls","setQuery","BlockControls","group","onChange","value","options","label","__"],"sources":["@wordpress/block-library/src/query/edit/query-content.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useEffect, useCallback } from '@wordpress/element';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tuseInnerBlocksProps,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport EnhancedPaginationControl from './inspector-controls/enhanced-pagination-control';\nimport { unlock } from '../../lock-unlock';\nimport QueryInspectorControls from './inspector-controls';\nimport EnhancedPaginationModal from './enhanced-pagination-modal';\nimport { getQueryContextFromTemplate } from '../utils';\nimport QueryToolbar from './query-toolbar';\n\nconst { HTMLElementControl } = unlock( blockEditorPrivateApis );\n\nconst DEFAULTS_POSTS_PER_PAGE = 3;\n\nconst TEMPLATE = [ [ 'core/post-template' ] ];\nexport default function QueryContent( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n\tcontext,\n\tname,\n} ) {\n\tconst {\n\t\tqueryId,\n\t\tquery,\n\t\tenhancedPagination,\n\t\ttagName: TagName = 'div',\n\t\tquery: { inherit } = {},\n\t} = attributes;\n\tconst { templateSlug } = context;\n\tconst { isSingular } = getQueryContextFromTemplate( templateSlug );\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst instanceId = useInstanceId( QueryContent );\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t} );\n\tconst { postsPerPage } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { getEntityRecord, getEntityRecordEdits, canUser } =\n\t\t\tselect( coreStore );\n\t\tconst settingPerPage = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? +getEntityRecord( 'root', 'site' )?.posts_per_page\n\t\t\t: +getSettings().postsPerPage;\n\n\t\t// Gets changes made via the template area posts per page setting. These won't be saved\n\t\t// until the page is saved, but we should reflect this setting within the query loops\n\t\t// that inherit it.\n\t\tconst editedSettingPerPage = +getEntityRecordEdits( 'root', 'site' )\n\t\t\t?.posts_per_page;\n\n\t\treturn {\n\t\t\tpostsPerPage:\n\t\t\t\teditedSettingPerPage ||\n\t\t\t\tsettingPerPage ||\n\t\t\t\tDEFAULTS_POSTS_PER_PAGE,\n\t\t};\n\t}, [] );\n\t// There are some effects running where some initialization logic is\n\t// happening and setting some values to some attributes (ex. queryId).\n\t// These updates can cause an `undo trap` where undoing will result in\n\t// resetting again, so we need to mark these changes as not persistent\n\t// with `__unstableMarkNextChangeAsNotPersistent`.\n\n\t// Changes in query property (which is an object) need to be in the same callback,\n\t// because updates are batched after the render and changes in different query properties\n\t// would cause to override previous wanted changes.\n\tconst updateQuery = useCallback(\n\t\t( newQuery ) =>\n\t\t\tsetAttributes( ( prevAttributes ) => ( {\n\t\t\t\tquery: { ...prevAttributes.query, ...newQuery },\n\t\t\t} ) ),\n\t\t[ setAttributes ]\n\t);\n\tuseEffect( () => {\n\t\tconst newQuery = {};\n\t\t// When we inherit from global query always need to set the `perPage`\n\t\t// based on the reading settings.\n\t\tif ( inherit && query.perPage !== postsPerPage ) {\n\t\t\tnewQuery.perPage = postsPerPage;\n\t\t} else if ( ! query.perPage && postsPerPage ) {\n\t\t\tnewQuery.perPage = postsPerPage;\n\t\t}\n\n\t\tif ( !! Object.keys( newQuery ).length ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tupdateQuery( newQuery );\n\t\t}\n\t}, [\n\t\tquery.perPage,\n\t\tinherit,\n\t\tpostsPerPage,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tupdateQuery,\n\t] );\n\t// We need this for multi-query block pagination.\n\t// Query parameters for each block are scoped to their ID.\n\tuseEffect( () => {\n\t\tif ( ! Number.isFinite( queryId ) ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { queryId: instanceId } );\n\t\t}\n\t}, [\n\t\tqueryId,\n\t\tinstanceId,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tsetAttributes,\n\t] );\n\n\treturn (\n\t\t<>\n\t\t\t<EnhancedPaginationModal\n\t\t\t\tattributes={ attributes }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\tclientId={ clientId }\n\t\t\t/>\n\t\t\t<InspectorControls>\n\t\t\t\t<QueryInspectorControls\n\t\t\t\t\tname={ name }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetQuery={ updateQuery }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tisSingular={ isSingular }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<BlockControls>\n\t\t\t\t<QueryToolbar attributes={ attributes } clientId={ clientId } />\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<HTMLElementControl\n\t\t\t\t\ttagName={ TagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t] }\n\t\t\t\t/>\n\t\t\t\t<EnhancedPaginationControl\n\t\t\t\t\tenhancedPagination={ enhancedPagination }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<TagName { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAQA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAKA,IAAAM,0BAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,WAAA,GAAAR,OAAA;AACA,IAAAS,kBAAA,GAAAF,sBAAA,CAAAP,OAAA;AACA,IAAAU,wBAAA,GAAAH,sBAAA,CAAAP,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,aAAA,GAAAL,sBAAA,CAAAP,OAAA;AAA2C,IAAAa,WAAA,GAAAb,OAAA;AAzB3C;AACA;AACA;;AAeA;AACA;AACA;;AAQA,MAAM;EAAEc;AAAmB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAE/D,MAAMC,uBAAuB,GAAG,CAAC;AAEjC,MAAMC,QAAQ,GAAG,CAAE,CAAE,oBAAoB,CAAE,CAAE;AAC9B,SAASC,YAAYA,CAAE;EACrCC,UAAU;EACVC,aAAa;EACbC,QAAQ;EACRC,OAAO;EACPC;AACD,CAAC,EAAG;EACH,MAAM;IACLC,OAAO;IACPC,KAAK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AC,eACF,IAAAhE,WAAA,CAAAyD,GAAA,EAAChE,0BAAA,CAAAiE,OAAyB;QACzB5C,kBAAkB,EAAGA,kBAAoB;QACzCN,aAAa,EAAGA,aAAe;QAC/BC,QAAQ,EAAGA;MAAU,CACrB,CAAC;IAAA,CACgB,CAAC,eACpB,IAAAT,WAAA,CAAAyD,GAAA,EAACzC,OAAO;MAAA,GAAMY;IAAgB,CAAI,CAAC;EAAA,CAClC,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_compose","_element","_blockEditor","_i18n","_coreData","_enhancedPaginationControl","_interopRequireDefault","_lockUnlock","_inspectorControls","_enhancedPaginationModal","_utils","_queryToolbar","_jsxRuntime","HTMLElementControl","unlock","blockEditorPrivateApis","DEFAULTS_POSTS_PER_PAGE","TEMPLATE","QueryContent","attributes","setAttributes","clientId","context","name","queryId","query","enhancedPagination","tagName","TagName","inherit","templateSlug","isSingular","getQueryContextFromTemplate","__unstableMarkNextChangeAsNotPersistent","useDispatch","blockEditorStore","instanceId","useInstanceId","blockProps","useBlockProps","innerBlocksProps","useInnerBlocksProps","template","postsPerPage","useSelect","select","getSettings","getEntityRecord","getEntityRecordEdits","canUser","coreStore","settingPerPage","kind","posts_per_page","editedSettingPerPage","updateQuery","useCallback","newQuery","prevAttributes","useEffect","perPage","Object","keys","length","Number","isFinite","jsxs","Fragment","children","jsx","BlockControls","default","hasInnerBlocks","InspectorControls","setQuery","group","onChange","value","options","label","__"],"sources":["@wordpress/block-library/src/query/edit/query-content.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useEffect, useCallback } from '@wordpress/element';\nimport {\n\tInspectorControls,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tuseInnerBlocksProps,\n\tprivateApis as blockEditorPrivateApis,\n\tBlockControls,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport EnhancedPaginationControl from './inspector-controls/enhanced-pagination-control';\nimport { unlock } from '../../lock-unlock';\nimport QueryInspectorControls from './inspector-controls';\nimport EnhancedPaginationModal from './enhanced-pagination-modal';\nimport { getQueryContextFromTemplate } from '../utils';\nimport QueryToolbar from './query-toolbar';\n\nconst { HTMLElementControl } = unlock( blockEditorPrivateApis );\n\nconst DEFAULTS_POSTS_PER_PAGE = 3;\n\nconst TEMPLATE = [ [ 'core/post-template' ] ];\nexport default function QueryContent( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n\tcontext,\n\tname,\n} ) {\n\tconst {\n\t\tqueryId,\n\t\tquery,\n\t\tenhancedPagination,\n\t\ttagName: TagName = 'div',\n\t\tquery: { inherit } = {},\n\t} = attributes;\n\tconst { templateSlug } = context;\n\tconst { isSingular } = getQueryContextFromTemplate( templateSlug );\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst instanceId = useInstanceId( QueryContent );\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t} );\n\tconst { postsPerPage } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { getEntityRecord, getEntityRecordEdits, canUser } =\n\t\t\tselect( coreStore );\n\t\tconst settingPerPage = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? +getEntityRecord( 'root', 'site' )?.posts_per_page\n\t\t\t: +getSettings().postsPerPage;\n\n\t\t// Gets changes made via the template area posts per page setting. These won't be saved\n\t\t// until the page is saved, but we should reflect this setting within the query loops\n\t\t// that inherit it.\n\t\tconst editedSettingPerPage = +getEntityRecordEdits( 'root', 'site' )\n\t\t\t?.posts_per_page;\n\n\t\treturn {\n\t\t\tpostsPerPage:\n\t\t\t\teditedSettingPerPage ||\n\t\t\t\tsettingPerPage ||\n\t\t\t\tDEFAULTS_POSTS_PER_PAGE,\n\t\t};\n\t}, [] );\n\t// There are some effects running where some initialization logic is\n\t// happening and setting some values to some attributes (ex. queryId).\n\t// These updates can cause an `undo trap` where undoing will result in\n\t// resetting again, so we need to mark these changes as not persistent\n\t// with `__unstableMarkNextChangeAsNotPersistent`.\n\n\t// Changes in query property (which is an object) need to be in the same callback,\n\t// because updates are batched after the render and changes in different query properties\n\t// would cause to override previous wanted changes.\n\tconst updateQuery = useCallback(\n\t\t( newQuery ) =>\n\t\t\tsetAttributes( ( prevAttributes ) => ( {\n\t\t\t\tquery: { ...prevAttributes.query, ...newQuery },\n\t\t\t} ) ),\n\t\t[ setAttributes ]\n\t);\n\tuseEffect( () => {\n\t\tconst newQuery = {};\n\t\t// When we inherit from global query always need to set the `perPage`\n\t\t// based on the reading settings.\n\t\tif ( inherit && query.perPage !== postsPerPage ) {\n\t\t\tnewQuery.perPage = postsPerPage;\n\t\t} else if ( ! query.perPage && postsPerPage ) {\n\t\t\tnewQuery.perPage = postsPerPage;\n\t\t}\n\n\t\tif ( !! Object.keys( newQuery ).length ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tupdateQuery( newQuery );\n\t\t}\n\t}, [\n\t\tquery.perPage,\n\t\tinherit,\n\t\tpostsPerPage,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tupdateQuery,\n\t] );\n\t// We need this for multi-query block pagination.\n\t// Query parameters for each block are scoped to their ID.\n\tuseEffect( () => {\n\t\tif ( ! Number.isFinite( queryId ) ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { queryId: instanceId } );\n\t\t}\n\t}, [\n\t\tqueryId,\n\t\tinstanceId,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tsetAttributes,\n\t] );\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<QueryToolbar\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\thasInnerBlocks\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<EnhancedPaginationModal\n\t\t\t\tattributes={ attributes }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\tclientId={ clientId }\n\t\t\t/>\n\t\t\t<InspectorControls>\n\t\t\t\t<QueryInspectorControls\n\t\t\t\t\tname={ name }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetQuery={ updateQuery }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tisSingular={ isSingular }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<HTMLElementControl\n\t\t\t\t\ttagName={ TagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t] }\n\t\t\t\t/>\n\t\t\t\t<EnhancedPaginationControl\n\t\t\t\t\tenhancedPagination={ enhancedPagination }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<TagName { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAQA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAKA,IAA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,CACzB;IAAC,CACgB,CAAC,eACpB,IAAAnB,WAAA,CAAAsD,IAAA,EAAChE,YAAA,CAAAuE,iBAAiB;MAACE,KAAK,EAAC,UAAU;MAAAP,QAAA,gBAClC,IAAAxD,WAAA,CAAAyD,GAAA,EAACxD,kBAAkB;QAClBc,OAAO,EAAGC,OAAS;QACnBgD,QAAQ,EAAKC,KAAK,IACjBzD,aAAa,CAAE;UAAEO,OAAO,EAAEkD;QAAM,CAAE,CAClC;QACDxD,QAAQ,EAAGA,QAAU;QACrByD,OAAO,EAAG,CACT;UAAEC,KAAK,EAAE,IAAAC,QAAE,EAAE,iBAAkB,CAAC;UAAEH,KAAK,EAAE;QAAM,CAAC,EAChD;UAAEE,KAAK,EAAE,QAAQ;UAAEF,KAAK,EAAE;QAAO,CAAC,EAClC;UAAEE,KAAK,EAAE,WAAW;UAAEF,KAAK,EAAE;QAAU,CAAC,EACxC;UAAEE,KAAK,EAAE,SAAS;UAAEF,KAAK,EAAE;QAAQ,CAAC;MAClC,CACH,CAAC,eACF,IAAAjE,WAAA,CAAAyD,GAAA,EAAChE,0BAAA,CAAAkE,OAAyB;QACzB7C,kBAAkB,EAAGA,kBAAoB;QACzCN,aAAa,EAAGA,aAAe;QAC/BC,QAAQ,EAAGA;MAAU,CACrB,CAAC;IAAA,CACgB,CAAC,eACpB,IAAAT,WAAA,CAAAyD,GAAA,EAACzC,OAAO;MAAA,GAAMY;IAAgB,CAAI,CAAC;EAAA,CAClC,CAAC;AAEL","ignoreList":[]}
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
@@ -10,8 +11,10 @@ var _element = require("@wordpress/element");
10
11
  var _blockEditor = require("@wordpress/block-editor");
11
12
  var _components = require("@wordpress/components");
12
13
  var _i18n = require("@wordpress/i18n");
14
+ var _compose = require("@wordpress/compose");
13
15
  var _utils = require("../utils");
14
16
  var _patternSelection = require("./pattern-selection");
17
+ var _queryToolbar = _interopRequireDefault(require("./query-toolbar"));
15
18
  var _jsxRuntime = require("react/jsx-runtime");
16
19
  /**
17
20
  * WordPress dependencies
@@ -28,7 +31,14 @@ function QueryPlaceholder({
28
31
  openPatternSelectionModal
29
32
  }) {
30
33
  const [isStartingBlank, setIsStartingBlank] = (0, _element.useState)(false);
31
- const blockProps = (0, _blockEditor.useBlockProps)();
34
+ const [containerWidth, setContainerWidth] = (0, _element.useState)(0);
35
+
36
+ // Use ResizeObserver to monitor container width.
37
+ const resizeObserverRef = (0, _compose.useResizeObserver)(([entry]) => {
38
+ setContainerWidth(entry.contentRect.width);
39
+ });
40
+ const SMALL_CONTAINER_BREAKPOINT = 160;
41
+ const isSmallContainer = containerWidth > 0 && containerWidth < SMALL_CONTAINER_BREAKPOINT;
32
42
  const {
33
43
  blockType,
34
44
  activeBlockVariation
@@ -45,6 +55,9 @@ function QueryPlaceholder({
45
55
  const hasPatterns = !!(0, _patternSelection.useBlockPatterns)(clientId, attributes).length;
46
56
  const icon = activeBlockVariation?.icon?.src || activeBlockVariation?.icon || blockType?.icon?.src;
47
57
  const label = activeBlockVariation?.title || blockType?.title;
58
+ const blockProps = (0, _blockEditor.useBlockProps)({
59
+ ref: resizeObserverRef
60
+ });
48
61
  if (isStartingBlank) {
49
62
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(QueryVariationPicker, {
50
63
  clientId: clientId,
@@ -53,18 +66,26 @@ function QueryPlaceholder({
53
66
  label: label
54
67
  });
55
68
  }
56
- return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
69
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
57
70
  ...blockProps,
58
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Placeholder, {
59
- icon: icon,
60
- label: label,
61
- instructions: (0, _i18n.__)('Choose a pattern for the query loop or start blank.'),
62
- children: [!!hasPatterns && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
71
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.BlockControls, {
72
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_queryToolbar.default, {
73
+ clientId: clientId,
74
+ attributes: attributes,
75
+ hasInnerBlocks: false
76
+ })
77
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Placeholder, {
78
+ className: "block-editor-media-placeholder",
79
+ icon: !isSmallContainer && icon,
80
+ label: !isSmallContainer && label,
81
+ instructions: !isSmallContainer && (0, _i18n.__)('Choose a pattern for the query loop or start blank.'),
82
+ withIllustration: isSmallContainer,
83
+ children: [!!hasPatterns && !isSmallContainer && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
63
84
  __next40pxDefaultSize: true,
64
85
  variant: "primary",
65
86
  onClick: openPatternSelectionModal,
66
87
  children: (0, _i18n.__)('Choose')
67
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
88
+ }), !isSmallContainer && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
68
89
  __next40pxDefaultSize: true,
69
90
  variant: "secondary",
70
91
  onClick: () => {
@@ -72,7 +93,7 @@ function QueryPlaceholder({
72
93
  },
73
94
  children: (0, _i18n.__)('Start blank')
74
95
  })]
75
- })
96
+ })]
76
97
  });
77
98
  }
78
99
  function QueryVariationPicker({
@@ -1 +1 @@
1
- {"version":3,"names":["_data","require","_blocks","_element","_blockEditor","_components","_i18n","_utils","_patternSelection","_jsxRuntime","QueryPlaceholder","attributes","clientId","name","openPatternSelectionModal","isStartingBlank","setIsStartingBlank","useState","blockProps","useBlockProps","blockType","activeBlockVariation","useSelect","select","getActiveBlockVariation","getBlockType","blocksStore","hasPatterns","useBlockPatterns","length","icon","src","label","title","jsx","QueryVariationPicker","children","jsxs","Placeholder","instructions","__","Button","__next40pxDefaultSize","variant","onClick","scopeVariations","useScopedBlockVariations","replaceInnerBlocks","useDispatch","blockEditorStore","__experimentalBlockVariationPicker","variations","onSelect","variation","innerBlocks","createBlocksFromInnerBlocksTemplate"],"sources":["@wordpress/block-library/src/query/edit/query-placeholder.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tcreateBlocksFromInnerBlocksTemplate,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useState } from '@wordpress/element';\nimport {\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\t__experimentalBlockVariationPicker,\n} from '@wordpress/block-editor';\nimport { Button, Placeholder } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useScopedBlockVariations } from '../utils';\nimport { useBlockPatterns } from './pattern-selection';\n\nexport default function QueryPlaceholder( {\n\tattributes,\n\tclientId,\n\tname,\n\topenPatternSelectionModal,\n} ) {\n\tconst [ isStartingBlank, setIsStartingBlank ] = useState( false );\n\tconst blockProps = useBlockProps();\n\tconst { blockType, activeBlockVariation } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getActiveBlockVariation, getBlockType } =\n\t\t\t\tselect( blocksStore );\n\t\t\treturn {\n\t\t\t\tblockType: getBlockType( name ),\n\t\t\t\tactiveBlockVariation: getActiveBlockVariation(\n\t\t\t\t\tname,\n\t\t\t\t\tattributes\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ name, attributes ]\n\t);\n\tconst hasPatterns = !! useBlockPatterns( clientId, attributes ).length;\n\tconst icon =\n\t\tactiveBlockVariation?.icon?.src ||\n\t\tactiveBlockVariation?.icon ||\n\t\tblockType?.icon?.src;\n\tconst label = activeBlockVariation?.title || blockType?.title;\n\tif ( isStartingBlank ) {\n\t\treturn (\n\t\t\t<QueryVariationPicker\n\t\t\t\tclientId={ clientId }\n\t\t\t\tattributes={ attributes }\n\t\t\t\ticon={ icon }\n\t\t\t\tlabel={ label }\n\t\t\t/>\n\t\t);\n\t}\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<Placeholder\n\t\t\t\ticon={ icon }\n\t\t\t\tlabel={ label }\n\t\t\t\tinstructions={ __(\n\t\t\t\t\t'Choose a pattern for the query loop or start blank.'\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t{ !! hasPatterns && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ openPatternSelectionModal }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Choose' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tsetIsStartingBlank( true );\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Start blank' ) }\n\t\t\t\t</Button>\n\t\t\t</Placeholder>\n\t\t</div>\n\t);\n}\n\nfunction QueryVariationPicker( { clientId, attributes, icon, label } ) {\n\tconst scopeVariations = useScopedBlockVariations( attributes );\n\tconst { replaceInnerBlocks } = useDispatch( blockEditorStore );\n\tconst blockProps = useBlockProps();\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<__experimentalBlockVariationPicker\n\t\t\t\ticon={ icon }\n\t\t\t\tlabel={ label }\n\t\t\t\tvariations={ scopeVariations }\n\t\t\t\tonSelect={ ( variation ) => {\n\t\t\t\t\tif ( variation.innerBlocks ) {\n\t\t\t\t\t\treplaceInnerBlocks(\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tcreateBlocksFromInnerBlocksTemplate(\n\t\t\t\t\t\t\t\tvariation.innerBlocks\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tfalse\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</div>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA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AU;IAAAkB,QAAA,eACnB,IAAA3B,WAAA,CAAAyB,GAAA,EAAC9B,YAAA,CAAA8C,kCAAkC;MAClCpB,IAAI,EAAGA,IAAM;MACbE,KAAK,EAAGA,KAAO;MACfmB,UAAU,EAAGN,eAAiB;MAC9BO,QAAQ,EAAKC,SAAS,IAAM;QAC3B,IAAKA,SAAS,CAACC,WAAW,EAAG;UAC5BP,kBAAkB,CACjBnC,QAAQ,EACR,IAAA2C,2CAAmC,EAClCF,SAAS,CAACC,WACX,CAAC,EACD,KACD,CAAC;QACF;MACD;IAAG,CACH;EAAC,CACE,CAAC;AAER","ignoreList":[]}
1
+ {"version":3,"names":["_data","require","_blocks","_element","_blockEditor","_components","_i18n","_compose","_utils","_patternSelection","_queryToolbar","_interopRequireDefault","_jsxRuntime","QueryPlaceholder","attributes","clientId","name","openPatternSelectionModal","isStartingBlank","setIsStartingBlank","useState","containerWidth","setContainerWidth","resizeObserverRef","useResizeObserver","entry","contentRect","width","SMALL_CONTAINER_BREAKPOINT","isSmallContainer","blockType","activeBlockVariation","useSelect","select","getActiveBlockVariation","getBlockType","blocksStore","hasPatterns","useBlockPatterns","length","icon","src","label","title","blockProps","useBlockProps","ref","jsx","QueryVariationPicker","jsxs","children","BlockControls","default","hasInnerBlocks","Placeholder","className","instructions","__","withIllustration","Button","__next40pxDefaultSize","variant","onClick","scopeVariations","useScopedBlockVariations","replaceInnerBlocks","useDispatch","blockEditorStore","__experimentalBlockVariationPicker","variations","onSelect","variation","innerBlocks","createBlocksFromInnerBlocksTemplate"],"sources":["@wordpress/block-library/src/query/edit/query-placeholder.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tcreateBlocksFromInnerBlocksTemplate,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { useState } from '@wordpress/element';\nimport {\n\tstore as blockEditorStore,\n\t__experimentalBlockVariationPicker,\n\tBlockControls,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { Button, Placeholder } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useResizeObserver } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { useScopedBlockVariations } from '../utils';\nimport { useBlockPatterns } from './pattern-selection';\nimport QueryToolbar from './query-toolbar';\n\nexport default function QueryPlaceholder( {\n\tattributes,\n\tclientId,\n\tname,\n\topenPatternSelectionModal,\n} ) {\n\tconst [ isStartingBlank, setIsStartingBlank ] = useState( false );\n\tconst [ containerWidth, setContainerWidth ] = useState( 0 );\n\n\t// Use ResizeObserver to monitor container width.\n\tconst resizeObserverRef = useResizeObserver( ( [ entry ] ) => {\n\t\tsetContainerWidth( entry.contentRect.width );\n\t} );\n\n\tconst SMALL_CONTAINER_BREAKPOINT = 160;\n\n\tconst isSmallContainer =\n\t\tcontainerWidth > 0 && containerWidth < SMALL_CONTAINER_BREAKPOINT;\n\n\tconst { blockType, activeBlockVariation } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getActiveBlockVariation, getBlockType } =\n\t\t\t\tselect( blocksStore );\n\t\t\treturn {\n\t\t\t\tblockType: getBlockType( name ),\n\t\t\t\tactiveBlockVariation: getActiveBlockVariation(\n\t\t\t\t\tname,\n\t\t\t\t\tattributes\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ name, attributes ]\n\t);\n\tconst hasPatterns = !! useBlockPatterns( clientId, attributes ).length;\n\tconst icon =\n\t\tactiveBlockVariation?.icon?.src ||\n\t\tactiveBlockVariation?.icon ||\n\t\tblockType?.icon?.src;\n\tconst label = activeBlockVariation?.title || blockType?.title;\n\tconst blockProps = useBlockProps( {\n\t\tref: resizeObserverRef,\n\t} );\n\n\tif ( isStartingBlank ) {\n\t\treturn (\n\t\t\t<QueryVariationPicker\n\t\t\t\tclientId={ clientId }\n\t\t\t\tattributes={ attributes }\n\t\t\t\ticon={ icon }\n\t\t\t\tlabel={ label }\n\t\t\t/>\n\t\t);\n\t}\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<BlockControls>\n\t\t\t\t<QueryToolbar\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\thasInnerBlocks={ false }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<Placeholder\n\t\t\t\tclassName=\"block-editor-media-placeholder\"\n\t\t\t\ticon={ ! isSmallContainer && icon }\n\t\t\t\tlabel={ ! isSmallContainer && label }\n\t\t\t\tinstructions={\n\t\t\t\t\t! isSmallContainer &&\n\t\t\t\t\t__( 'Choose a pattern for the query loop or start blank.' )\n\t\t\t\t}\n\t\t\t\twithIllustration={ isSmallContainer }\n\t\t\t>\n\t\t\t\t{ !! hasPatterns && ! isSmallContainer && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ openPatternSelectionModal }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Choose' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\n\t\t\t\t{ ! isSmallContainer && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetIsStartingBlank( true );\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Start blank' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t</Placeholder>\n\t\t</div>\n\t);\n}\n\nfunction QueryVariationPicker( { clientId, attributes, icon, label } ) {\n\tconst scopeVariations = useScopedBlockVariations( attributes );\n\tconst { replaceInnerBlocks } = useDispatch( blockEditorStore );\n\tconst blockProps = useBlockProps();\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<__experimentalBlockVariationPicker\n\t\t\t\ticon={ icon }\n\t\t\t\tlabel={ label }\n\t\t\t\tvariations={ scopeVariations }\n\t\t\t\tonSelect={ ( variation ) => {\n\t\t\t\t\tif ( variation.innerBlocks ) {\n\t\t\t\t\t\treplaceInnerBlocks(\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tcreateBlocksFromInnerBlocksTemplate(\n\t\t\t\t\t\t\t\tvariation.innerBlocks\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tfalse\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</div>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAIA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAMA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AAKA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,iBAAA,GAAAR,OAAA;AACA,IAAAS,aAAA,GAAAC,sBAAA,CAAAV,OAAA;AAA2C,IAAAW,WAAA,GAAAX,OAAA;AAxB3C;AACA;AACA;;AAiBA;AACA;AACA;;AAKe,SAASY,gBAAgBA,CAAE;EACzCC,UAAU;EACVC,QAAQ;EACRC,IAAI;EACJC;AACD,CAAC,EAAG;EACH,MAAM,CAAEC,eAAe,EAAEC,kBAAkB,CAAE,GAAG,IAAAC,iBAAQ,EAAE,KAAM,CAAC;EACjE,MAAM,CAAEC,cAAc,EAAEC,iBAAiB,CAAE,GAAG,IAAAF,iBAAQ,EAAE,CAAE,CAAC;;EAE3D;EACA,MAAMG,iBAAiB,GAAG,IAAAC,0BAAiB,EAAE,CAAE,CAAEC,KAAK,CAAE,KAAM;IAC7DH,iBAAiB,CAAEG,KAAK,CAACC,WAAW,CAACC,KAAM,CAAC;EAC7C,CAAE,CAAC;EAEH,MAAMC,0BAA0B,GAAG,GAAG;EAEtC,MAAMC,gBAAgB,GACrBR,cAA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jC,WAAA,CAAAmC,GAAA;IAAA,GAAUH,UAAU;IAAAM,QAAA,eACnB,IAAAtC,WAAA,CAAAmC,GAAA,EAAC3C,YAAA,CAAAgE,kCAAkC;MAClC5B,IAAI,EAAGA,IAAM;MACbE,KAAK,EAAGA,KAAO;MACf2B,UAAU,EAAGN,eAAiB;MAC9BO,QAAQ,EAAKC,SAAS,IAAM;QAC3B,IAAKA,SAAS,CAACC,WAAW,EAAG;UAC5BP,kBAAkB,CACjBlD,QAAQ,EACR,IAAA0D,2CAAmC,EAClCF,SAAS,CAACC,WACX,CAAC,EACD,KACD,CAAC;QACF;MACD;IAAG,CACH;EAAC,CACE,CAAC;AAER","ignoreList":[]}
@@ -20,12 +20,14 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
20
20
 
21
21
  function QueryToolbar({
22
22
  clientId,
23
- attributes
23
+ attributes,
24
+ hasInnerBlocks
24
25
  }) {
25
26
  const hasPatterns = (0, _patternSelection.useBlockPatterns)(clientId, attributes).length;
26
27
  if (!hasPatterns) {
27
28
  return null;
28
29
  }
30
+ const buttonLabel = hasInnerBlocks ? (0, _i18n.__)('Change design') : (0, _i18n.__)('Choose pattern');
29
31
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ToolbarGroup, {
30
32
  className: "wp-block-template-part__block-control-group",
31
33
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalDropdownContentWrapper, {
@@ -40,7 +42,7 @@ function QueryToolbar({
40
42
  "aria-haspopup": "true",
41
43
  "aria-expanded": isOpen,
42
44
  onClick: onToggle,
43
- children: (0, _i18n.__)('Change design')
45
+ children: buttonLabel
44
46
  }),
45
47
  renderContent: () => /*#__PURE__*/(0, _jsxRuntime.jsx)(_patternSelection.default, {
46
48
  clientId: clientId,
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_i18n","_patternSelection","_interopRequireWildcard","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","QueryToolbar","clientId","attributes","hasPatterns","useBlockPatterns","length","jsx","ToolbarGroup","className","children","__experimentalDropdownContentWrapper","Dropdown","contentClassName","focusOnMount","expandOnMobile","renderToggle","isOpen","onToggle","ToolbarButton","onClick","__","renderContent","showSearch","showTitlesAsTooltip"],"sources":["@wordpress/block-library/src/query/edit/query-toolbar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tToolbarGroup,\n\tToolbarButton,\n\tDropdown,\n\t__experimentalDropdownContentWrapper as DropdownContentWrapper,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport PatternSelection, { useBlockPatterns } from './pattern-selection';\n\nexport default function QueryToolbar( { clientId, attributes } ) {\n\tconst hasPatterns = useBlockPatterns( clientId, attributes ).length;\n\tif ( ! hasPatterns ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ToolbarGroup className=\"wp-block-template-part__block-control-group\">\n\t\t\t<DropdownContentWrapper>\n\t\t\t\t<Dropdown\n\t\t\t\t\tcontentClassName=\"block-editor-block-settings-menu__popover\"\n\t\t\t\t\tfocusOnMount=\"firstElement\"\n\t\t\t\t\texpandOnMobile\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Change design' ) }\n\t\t\t\t\t\t</ToolbarButton>\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ () => (\n\t\t\t\t\t\t<PatternSelection\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\t\t\tshowSearch={ false }\n\t\t\t\t\t\t\tshowTitlesAsToolt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_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","QueryToolbar","clientId","attributes","hasInnerBlocks","hasPatterns","useBlockPatterns","length","buttonLabel","__","jsx","ToolbarGroup","className","children","__experimentalDropdownContentWrapper","Dropdown","contentClassName","focusOnMount","expandOnMobile","renderToggle","isOpen","onToggle","ToolbarButton","onClick","renderContent","showSearch","showTitlesAsTooltip"],"sources":["@wordpress/block-library/src/query/edit/query-toolbar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tToolbarGroup,\n\tToolbarButton,\n\tDropdown,\n\t__experimentalDropdownContentWrapper as DropdownContentWrapper,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport PatternSelection, { useBlockPatterns } from './pattern-selection';\n\nexport default function QueryToolbar( {\n\tclientId,\n\tattributes,\n\thasInnerBlocks,\n} ) {\n\tconst hasPatterns = useBlockPatterns( clientId, attributes ).length;\n\tif ( ! hasPatterns ) {\n\t\treturn null;\n\t}\n\n\tconst buttonLabel = hasInnerBlocks\n\t\t? __( 'Change design' )\n\t\t: __( 'Choose pattern' );\n\n\treturn (\n\t\t<ToolbarGroup className=\"wp-block-template-part__block-control-group\">\n\t\t\t<DropdownContentWrapper>\n\t\t\t\t<Dropdown\n\t\t\t\t\tcontentClassName=\"block-editor-block-settings-menu__popover\"\n\t\t\t\t\tfocusOnMount=\"firstElement\"\n\t\t\t\t\texpandOnMobile\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ buttonLabel }\n\t\t\t\t\t\t</ToolbarButton>\n\t\t\t\t\t) }\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5C,WAAA,CAAA8B,GAAA,EAAChC,iBAAA,CAAAS,OAAgB;UAChBe,QAAQ,EAAGA,QAAU;UACrBC,UAAU,EAAGA,UAAY;UACzBsB,UAAU,EAAG,KAAO;UACpBC,mBAAmB;QAAA,CACnB;MACC,CACH;IAAC,CACqB;EAAC,CACZ,CAAC;AAEjB","ignoreList":[]}
@@ -162,7 +162,11 @@ function SearchEdit({
162
162
  const textFieldClasses = (0, _clsx.default)('wp-block-search__input', isButtonPositionInside ? undefined : borderProps.className, typographyProps.className);
163
163
  const textFieldStyles = {
164
164
  ...(isButtonPositionInside ? {
165
- borderRadius
165
+ borderRadius: borderProps.style?.borderRadius,
166
+ borderTopLeftRadius: borderProps.style?.borderTopLeftRadius,
167
+ borderTopRightRadius: borderProps.style?.borderTopRightRadius,
168
+ borderBottomLeftRadius: borderProps.style?.borderBottomLeftRadius,
169
+ borderBottomRightRadius: borderProps.style?.borderBottomRightRadius
166
170
  } : borderProps.style),
167
171
  ...typographyProps.style,
168
172
  textDecoration: undefined
@@ -191,7 +195,11 @@ function SearchEdit({
191
195
  ...colorProps.style,
192
196
  ...typographyProps.style,
193
197
  ...(isButtonPositionInside ? {
194
- borderRadius
198
+ borderRadius: borderProps.style?.borderRadius,
199
+ borderTopLeftRadius: borderProps.style?.borderTopLeftRadius,
200
+ borderTopRightRadius: borderProps.style?.borderTopRightRadius,
201
+ borderBottomLeftRadius: borderProps.style?.borderBottomLeftRadius,
202
+ borderBottomRightRadius: borderProps.style?.borderBottomRightRadius
195
203
  } : borderProps.style)
196
204
  };
197
205
  const handleButtonClick = () => {
@@ -360,7 +368,8 @@ function SearchEdit({
360
368
  })
361
369
  })
362
370
  });
363
- const padBorderRadius = radius => radius ? `calc(${radius} + ${DEFAULT_INNER_PADDING})` : undefined;
371
+ const isNonZeroBorderRadius = radius => radius !== undefined && parseInt(radius, 10) !== 0;
372
+ const padBorderRadius = radius => isNonZeroBorderRadius(radius) ? `calc(${radius} + ${DEFAULT_INNER_PADDING})` : undefined;
364
373
  const getWrapperStyles = () => {
365
374
  const styles = isButtonPositionInside ? borderProps.style : {
366
375
  borderRadius: borderProps.style?.borderRadius,
@@ -369,8 +378,7 @@ function SearchEdit({
369
378
  borderBottomLeftRadius: borderProps.style?.borderBottomLeftRadius,
370
379
  borderBottomRightRadius: borderProps.style?.borderBottomRightRadius
371
380
  };
372
- const isNonZeroBorderRadius = borderRadius !== undefined && parseInt(borderRadius, 10) !== 0;
373
- if (isButtonPositionInside && isNonZeroBorderRadius) {
381
+ if (isButtonPositionInside) {
374
382
  // We have button inside wrapper and a border radius value to apply.
375
383
  // Add default padding so we don't get "fat" corners.
376
384
  //
@@ -380,17 +388,17 @@ function SearchEdit({
380
388
  if (typeof borderRadius === 'object') {
381
389
  // Individual corner border radii present.
382
390
  const {
383
- topLeft,
384
- topRight,
385
- bottomLeft,
386
- bottomRight
387
- } = borderRadius;
391
+ borderTopLeftRadius,
392
+ borderTopRightRadius,
393
+ borderBottomLeftRadius,
394
+ borderBottomRightRadius
395
+ } = borderProps.style;
388
396
  return {
389
397
  ...styles,
390
- borderTopLeftRadius: padBorderRadius(topLeft),
391
- borderTopRightRadius: padBorderRadius(topRight),
392
- borderBottomLeftRadius: padBorderRadius(bottomLeft),
393
- borderBottomRightRadius: padBorderRadius(bottomRight)
398
+ borderTopLeftRadius: padBorderRadius(borderTopLeftRadius),
399
+ borderTopRightRadius: padBorderRadius(borderTopRightRadius),
400
+ borderBottomLeftRadius: padBorderRadius(borderBottomLeftRadius),
401
+ borderBottomRightRadius: padBorderRadius(borderBottomRightRadius)
394
402
  };
395
403
  }
396
404
 
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_blockEditor","_data","_element","_components","_compose","_icons","_i18n","_dom","_utils","_hooks","_jsxRuntime","DEFAULT_INNER_PADDING","PERCENTAGE_WIDTHS","SearchEdit","className","attributes","setAttributes","toggleSelection","isSelected","clientId","label","showLabel","placeholder","width","widthUnit","align","buttonText","buttonPosition","buttonUseIcon","isSearchFieldHidden","style","wasJustInsertedIntoNavigationBlock","useSelect","select","getBlockParentsByBlockName","wasBlockJustInserted","blockEditorStore","length","__unstableMarkNextChangeAsNotPersistent","useDispatch","useEffect","borderRadius","border","radius","borderProps","useBorderProps","colorProps","useColorProps","fluidTypographySettings","layout","useSettings","typographyProps","useTypographyProps","typography","fluid","wideSize","unitControlInstanceId","useInstanceId","UnitControl","unitControlInputId","isButtonPositionInside","isButtonPositionOutside","hasNoButton","hasOnlyButton","searchFieldRef","useRef","buttonRef","units","useCustomUnits","availableUnits","defaultValues","PC_WIDTH_DEFAULT","px","PX_WIDTH_DEFAULT","getBlockClassNames","clsx","undefined","buttonPositionControls","__","value","getResizableSides","right","left","renderTextField","textFieldClasses","textFieldStyles","textDecoration","jsx","type","onChange","event","target","ref","renderButton","buttonClasses","__experimentalGetElementClassName","buttonStyles","handleButtonClick","jsxs","Fragment","children","stripHTML","onClick","Icon","icon","search","RichText","identifier","withoutInteractiveFormatting","html","dropdownMenuProps","useToolsPanelDropdownMenuProps","controls","InspectorControls","__experimentalToolsPanel","resetAll","__experimentalToolsPanelItem","hasValue","onDeselect","isShownByDefault","ToggleControl","__nextHasNoMarginBottom","checked","SelectControl","__next40pxDefaultSize","options","__experimentalVStack","__experimentalUnitControl","id","min","isPercentageUnit","MIN_WIDTH","max","step","newWidth","parsedNewWidth","parseInt","onUnitChange","newUnit","__unstableInputWidth","__experimentalToggleGroupControl","includes","hideLabelFromVision","isBlock","map","widthValue","__experimentalToggleGroupControlOption","sprintf","padBorderRadius","getWrapperStyles","styles","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","isNonZeroBorderRadius","topLeft","topRight","bottomLeft","bottomRight","Number","isInteger","blockProps","useBlockProps","labelClassnames","ResizableBox","size","height","minWidth","enable","onResizeStart","direction","elt","offsetWidth","onResizeStop","delta","showHandle"],"sources":["@wordpress/block-library/src/search/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseBlockProps,\n\tInspectorControls,\n\tRichText,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalUseColorProps as useColorProps,\n\tgetTypographyClassesAndStyles as useTypographyProps,\n\tstore as blockEditorStore,\n\t__experimentalGetElementClassName,\n\tuseSettings,\n} from '@wordpress/block-editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect, useRef } from '@wordpress/element';\nimport {\n\tSelectControl,\n\tToggleControl,\n\tResizableBox,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { Icon, search } from '@wordpress/icons';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport {\n\tPC_WIDTH_DEFAULT,\n\tPX_WIDTH_DEFAULT,\n\tMIN_WIDTH,\n\tisPercentageUnit,\n} from './utils.js';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\n// Used to calculate border radius adjustment to avoid \"fat\" corners when\n// button is placed inside wrapper.\nconst DEFAULT_INNER_PADDING = '4px';\nconst PERCENTAGE_WIDTHS = [ 25, 50, 75, 100 ];\n\nexport default function SearchEdit( {\n\tclassName,\n\tattributes,\n\tsetAttributes,\n\ttoggleSelection,\n\tisSelected,\n\tclientId,\n} ) {\n\tconst {\n\t\tlabel,\n\t\tshowLabel,\n\t\tplaceholder,\n\t\twidth,\n\t\twidthUnit,\n\t\talign,\n\t\tbuttonText,\n\t\tbuttonPosition,\n\t\tbuttonUseIcon,\n\t\tisSearchFieldHidden,\n\t\tstyle,\n\t} = attributes;\n\n\tconst wasJustInsertedIntoNavigationBlock = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockParentsByBlockName, wasBlockJustInserted } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn (\n\t\t\t\t!! getBlockParentsByBlockName( clientId, 'core/navigation' )\n\t\t\t\t\t?.length && wasBlockJustInserted( clientId )\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tuseEffect( () => {\n\t\tif ( wasJustInsertedIntoNavigationBlock ) {\n\t\t\t// This side-effect should not create an undo level.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( {\n\t\t\t\tshowLabel: false,\n\t\t\t\tbuttonUseIcon: true,\n\t\t\t\tbuttonPosition: 'button-inside',\n\t\t\t} );\n\t\t}\n\t}, [\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\twasJustInsertedIntoNavigationBlock,\n\t\tsetAttributes,\n\t] );\n\n\tconst borderRadius = style?.border?.radius;\n\tlet borderProps = useBorderProps( attributes );\n\n\t// Check for old deprecated numerical border radius. Done as a separate\n\t// check so that a borderRadius style won't overwrite the longhand\n\t// per-corner styles.\n\tif ( typeof borderRadius === 'number' ) {\n\t\tborderProps = {\n\t\t\t...borderProps,\n\t\t\tstyle: {\n\t\t\t\t...borderProps.style,\n\t\t\t\tborderRadius: `${ borderRadius }px`,\n\t\t\t},\n\t\t};\n\t}\n\n\tconst colorProps = useColorProps( attributes );\n\tconst [ fluidTypographySettings, layout ] = useSettings(\n\t\t'typography.fluid',\n\t\t'layout'\n\t);\n\tconst typographyProps = useTypographyProps( attributes, {\n\t\ttypography: {\n\t\t\tfluid: fluidTypographySettings,\n\t\t},\n\t\tlayout: {\n\t\t\twideSize: layout?.wideSize,\n\t\t},\n\t} );\n\tconst unitControlInstanceId = useInstanceId( UnitControl );\n\tconst unitControlInputId = `wp-block-search__width-${ unitControlInstanceId }`;\n\tconst isButtonPositionInside = 'button-inside' === buttonPosition;\n\tconst isButtonPositionOutside = 'button-outside' === buttonPosition;\n\tconst hasNoButton = 'no-button' === buttonPosition;\n\tconst hasOnlyButton = 'button-only' === buttonPosition;\n\tconst searchFieldRef = useRef();\n\tconst buttonRef = useRef();\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: [ '%', 'px' ],\n\t\tdefaultValues: { '%': PC_WIDTH_DEFAULT, px: PX_WIDTH_DEFAULT },\n\t} );\n\n\tuseEffect( () => {\n\t\tif ( hasOnlyButton && ! isSelected ) {\n\t\t\tsetAttributes( {\n\t\t\t\tisSearchFieldHidden: true,\n\t\t\t} );\n\t\t}\n\t}, [ hasOnlyButton, isSelected, setAttributes ] );\n\n\t// Show the search field when width changes.\n\tuseEffect( () => {\n\t\tif ( ! hasOnlyButton || ! isSelected ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetAttributes( {\n\t\t\tisSearchFieldHidden: false,\n\t\t} );\n\t}, [ hasOnlyButton, isSelected, setAttributes, width ] );\n\n\tconst getBlockClassNames = () => {\n\t\treturn clsx(\n\t\t\tclassName,\n\t\t\tisButtonPositionInside\n\t\t\t\t? 'wp-block-search__button-inside'\n\t\t\t\t: undefined,\n\t\t\tisButtonPositionOutside\n\t\t\t\t? 'wp-block-search__button-outside'\n\t\t\t\t: undefined,\n\t\t\thasNoButton ? 'wp-block-search__no-button' : undefined,\n\t\t\thasOnlyButton ? 'wp-block-search__button-only' : undefined,\n\t\t\t! buttonUseIcon && ! hasNoButton\n\t\t\t\t? 'wp-block-search__text-button'\n\t\t\t\t: undefined,\n\t\t\tbuttonUseIcon && ! hasNoButton\n\t\t\t\t? 'wp-block-search__icon-button'\n\t\t\t\t: undefined,\n\t\t\thasOnlyButton && isSearchFieldHidden\n\t\t\t\t? 'wp-block-search__searchfield-hidden'\n\t\t\t\t: undefined\n\t\t);\n\t};\n\n\tconst buttonPositionControls = [\n\t\t{\n\t\t\tlabel: __( 'Button outside' ),\n\t\t\tvalue: 'button-outside',\n\t\t},\n\t\t{\n\t\t\tlabel: __( 'Button inside' ),\n\t\t\tvalue: 'button-inside',\n\t\t},\n\t\t{\n\t\t\tlabel: __( 'No button' ),\n\t\t\tvalue: 'no-button',\n\t\t},\n\t\t{\n\t\t\tlabel: __( 'Button only' ),\n\t\t\tvalue: 'button-only',\n\t\t},\n\t];\n\n\tconst getResizableSides = () => {\n\t\tif ( hasOnlyButton ) {\n\t\t\treturn {};\n\t\t}\n\n\t\treturn {\n\t\t\tright: align !== 'right',\n\t\t\tleft: align === 'right',\n\t\t};\n\t};\n\n\tconst renderTextField = () => {\n\t\t// If the input is inside the wrapper, the wrapper gets the border color styles/classes, not the input control.\n\t\tconst textFieldClasses = clsx(\n\t\t\t'wp-block-search__input',\n\t\t\tisButtonPositionInside ? undefined : borderProps.className,\n\t\t\ttypographyProps.className\n\t\t);\n\t\tconst textFieldStyles = {\n\t\t\t...( isButtonPositionInside\n\t\t\t\t? { borderRadius }\n\t\t\t\t: borderProps.style ),\n\t\t\t...typographyProps.style,\n\t\t\ttextDecoration: undefined,\n\t\t};\n\n\t\treturn (\n\t\t\t<input\n\t\t\t\ttype=\"search\"\n\t\t\t\tclassName={ textFieldClasses }\n\t\t\t\tstyle={ textFieldStyles }\n\t\t\t\taria-label={ __( 'Optional placeholder text' ) }\n\t\t\t\t// We hide the placeholder field's placeholder when there is a value. This\n\t\t\t\t// stops screen readers from reading the placeholder field's placeholder\n\t\t\t\t// which is confusing.\n\t\t\t\tplaceholder={\n\t\t\t\t\tplaceholder ? undefined : __( 'Optional placeholder…' )\n\t\t\t\t}\n\t\t\t\tvalue={ placeholder }\n\t\t\t\tonChange={ ( event ) =>\n\t\t\t\t\tsetAttributes( { placeholder: event.target.value } )\n\t\t\t\t}\n\t\t\t\tref={ searchFieldRef }\n\t\t\t/>\n\t\t);\n\t};\n\n\tconst renderButton = () => {\n\t\t// If the button is inside the wrapper, the wrapper gets the border color styles/classes, not the button.\n\t\tconst buttonClasses = clsx(\n\t\t\t'wp-block-search__button',\n\t\t\tcolorProps.className,\n\t\t\ttypographyProps.className,\n\t\t\tisButtonPositionInside ? undefined : borderProps.className,\n\t\t\tbuttonUseIcon ? 'has-icon' : undefined,\n\t\t\t__experimentalGetElementClassName( 'button' )\n\t\t);\n\t\tconst buttonStyles = {\n\t\t\t...colorProps.style,\n\t\t\t...typographyProps.style,\n\t\t\t...( isButtonPositionInside\n\t\t\t\t? { borderRadius }\n\t\t\t\t: borderProps.style ),\n\t\t};\n\t\tconst handleButtonClick = () => {\n\t\t\tif ( hasOnlyButton ) {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tisSearchFieldHidden: ! isSearchFieldHidden,\n\t\t\t\t} );\n\t\t\t}\n\t\t};\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ buttonUseIcon && (\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tclassName={ buttonClasses }\n\t\t\t\t\t\tstyle={ buttonStyles }\n\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\tbuttonText\n\t\t\t\t\t\t\t\t? stripHTML( buttonText )\n\t\t\t\t\t\t\t\t: __( 'Search' )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonClick={ handleButtonClick }\n\t\t\t\t\t\tref={ buttonRef }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Icon icon={ search } />\n\t\t\t\t\t</button>\n\t\t\t\t) }\n\n\t\t\t\t{ ! buttonUseIcon && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"buttonText\"\n\t\t\t\t\t\tclassName={ buttonClasses }\n\t\t\t\t\t\tstyle={ buttonStyles }\n\t\t\t\t\t\taria-label={ __( 'Button text' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Add button text…' ) }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\tvalue={ buttonText }\n\t\t\t\t\t\tonChange={ ( html ) =>\n\t\t\t\t\t\t\tsetAttributes( { buttonText: html } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonClick={ handleButtonClick }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t};\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst controls = (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\twidth: undefined,\n\t\t\t\t\t\t\twidthUnit: undefined,\n\t\t\t\t\t\t\tshowLabel: true,\n\t\t\t\t\t\t\tbuttonUseIcon: false,\n\t\t\t\t\t\t\tbuttonPosition: 'button-outside',\n\t\t\t\t\t\t\tisSearchFieldHidden: false,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => ! showLabel }\n\t\t\t\t\t\tlabel={ __( 'Show label' ) }\n\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowLabel: true,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tchecked={ showLabel }\n\t\t\t\t\t\t\tlabel={ __( 'Show label' ) }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tshowLabel: 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/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => buttonPosition !== 'button-outside' }\n\t\t\t\t\t\tlabel={ __( 'Button position' ) }\n\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tbuttonPosition: 'button-outside',\n\t\t\t\t\t\t\t\tisSearchFieldHidden: false,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\tvalue={ buttonPosition }\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Button position' ) }\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tbuttonPosition: value,\n\t\t\t\t\t\t\t\t\tisSearchFieldHidden:\n\t\t\t\t\t\t\t\t\t\tvalue === 'button-only',\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\toptions={ buttonPositionControls }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t{ buttonPosition !== 'no-button' && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! buttonUseIcon }\n\t\t\t\t\t\t\tlabel={ __( 'Use button with icon' ) }\n\t\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tbuttonUseIcon: false,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tchecked={ buttonUseIcon }\n\t\t\t\t\t\t\t\tlabel={ __( 'Use button with icon' ) }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tbuttonUseIcon: value,\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</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => !! width }\n\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\twidth: undefined,\n\t\t\t\t\t\t\t\twidthUnit: undefined,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<VStack>\n\t\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\t\t\tid={ unitControlInputId } // Unused, kept for backwards compatibility\n\t\t\t\t\t\t\t\tmin={\n\t\t\t\t\t\t\t\t\tisPercentageUnit( widthUnit )\n\t\t\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t\t\t: MIN_WIDTH\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmax={\n\t\t\t\t\t\t\t\t\tisPercentageUnit( widthUnit )\n\t\t\t\t\t\t\t\t\t\t? 100\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tstep={ 1 }\n\t\t\t\t\t\t\t\tonChange={ ( newWidth ) => {\n\t\t\t\t\t\t\t\t\tconst parsedNewWidth =\n\t\t\t\t\t\t\t\t\t\tnewWidth === ''\n\t\t\t\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t\t\t\t: parseInt( newWidth, 10 );\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\twidth: parsedNewWidth,\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\tonUnitChange={ ( newUnit ) => {\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\twidth:\n\t\t\t\t\t\t\t\t\t\t\t'%' === newUnit\n\t\t\t\t\t\t\t\t\t\t\t\t? PC_WIDTH_DEFAULT\n\t\t\t\t\t\t\t\t\t\t\t\t: PX_WIDTH_DEFAULT,\n\t\t\t\t\t\t\t\t\t\twidthUnit: newUnit,\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__unstableInputWidth=\"80px\"\n\t\t\t\t\t\t\t\tvalue={ `${ width }${ widthUnit }` }\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\t<ToggleGroupControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Percentage Width' ) }\n\t\t\t\t\t\t\t\tvalue={\n\t\t\t\t\t\t\t\t\tPERCENTAGE_WIDTHS.includes( width ) &&\n\t\t\t\t\t\t\t\t\twidthUnit === '%'\n\t\t\t\t\t\t\t\t\t\t? width\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\t\tonChange={ ( newWidth ) => {\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\twidth: newWidth,\n\t\t\t\t\t\t\t\t\t\twidthUnit: '%',\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\tisBlock\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ PERCENTAGE_WIDTHS.map( ( widthValue ) => {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\t\t\t\tkey={ widthValue }\n\t\t\t\t\t\t\t\t\t\t\tvalue={ widthValue }\n\t\t\t\t\t\t\t\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t\t\t\t\t\t\t\t/* translators: %d: Percentage value. */\n\t\t\t\t\t\t\t\t\t\t\t\t__( '%d%%' ),\n\t\t\t\t\t\t\t\t\t\t\t\twidthValue\n\t\t\t\t\t\t\t\t\t\t\t) }\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} ) }\n\t\t\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n\n\tconst padBorderRadius = ( radius ) =>\n\t\tradius ? `calc(${ radius } + ${ DEFAULT_INNER_PADDING })` : undefined;\n\n\tconst getWrapperStyles = () => {\n\t\tconst styles = isButtonPositionInside\n\t\t\t? borderProps.style\n\t\t\t: {\n\t\t\t\t\tborderRadius: borderProps.style?.borderRadius,\n\t\t\t\t\tborderTopLeftRadius: borderProps.style?.borderTopLeftRadius,\n\t\t\t\t\tborderTopRightRadius:\n\t\t\t\t\t\tborderProps.style?.borderTopRightRadius,\n\t\t\t\t\tborderBottomLeftRadius:\n\t\t\t\t\t\tborderProps.style?.borderBottomLeftRadius,\n\t\t\t\t\tborderBottomRightRadius:\n\t\t\t\t\t\tborderProps.style?.borderBottomRightRadius,\n\t\t\t };\n\n\t\tconst isNonZeroBorderRadius =\n\t\t\tborderRadius !== undefined && parseInt( borderRadius, 10 ) !== 0;\n\n\t\tif ( isButtonPositionInside && isNonZeroBorderRadius ) {\n\t\t\t// We have button inside wrapper and a border radius value to apply.\n\t\t\t// Add default padding so we don't get \"fat\" corners.\n\t\t\t//\n\t\t\t// CSS calc() is used here to support non-pixel units. The inline\n\t\t\t// style using calc() will only apply if both values have units.\n\n\t\t\tif ( typeof borderRadius === 'object' ) {\n\t\t\t\t// Individual corner border radii present.\n\t\t\t\tconst { topLeft, topRight, bottomLeft, bottomRight } =\n\t\t\t\t\tborderRadius;\n\n\t\t\t\treturn {\n\t\t\t\t\t...styles,\n\t\t\t\t\tborderTopLeftRadius: padBorderRadius( topLeft ),\n\t\t\t\t\tborderTopRightRadius: padBorderRadius( topRight ),\n\t\t\t\t\tborderBottomLeftRadius: padBorderRadius( bottomLeft ),\n\t\t\t\t\tborderBottomRightRadius: padBorderRadius( bottomRight ),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// The inline style using calc() will only apply if both values\n\t\t\t// supplied to calc() have units. Deprecated block's may have\n\t\t\t// unitless integer.\n\t\t\tconst radius = Number.isInteger( borderRadius )\n\t\t\t\t? `${ borderRadius }px`\n\t\t\t\t: borderRadius;\n\n\t\t\tstyles.borderRadius = `calc(${ radius } + ${ DEFAULT_INNER_PADDING })`;\n\t\t}\n\n\t\treturn styles;\n\t};\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: getBlockClassNames(),\n\t\tstyle: {\n\t\t\t...typographyProps.style,\n\t\t\t// Input opts out of text decoration.\n\t\t\ttextDecoration: undefined,\n\t\t},\n\t} );\n\n\tconst labelClassnames = clsx(\n\t\t'wp-block-search__label',\n\t\ttypographyProps.className\n\t);\n\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t{ controls }\n\n\t\t\t{ showLabel && (\n\t\t\t\t<RichText\n\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\tclassName={ labelClassnames }\n\t\t\t\t\taria-label={ __( 'Label text' ) }\n\t\t\t\t\tplaceholder={ __( 'Add label…' ) }\n\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\tvalue={ label }\n\t\t\t\t\tonChange={ ( html ) => setAttributes( { label: html } ) }\n\t\t\t\t\tstyle={ typographyProps.style }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t<ResizableBox\n\t\t\t\tsize={ {\n\t\t\t\t\twidth:\n\t\t\t\t\t\twidth === undefined\n\t\t\t\t\t\t\t? 'auto'\n\t\t\t\t\t\t\t: `${ width }${ widthUnit }`,\n\t\t\t\t\theight: 'auto',\n\t\t\t\t} }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'wp-block-search__inside-wrapper',\n\t\t\t\t\tisButtonPositionInside ? borderProps.className : undefined\n\t\t\t\t) }\n\t\t\t\tstyle={ getWrapperStyles() }\n\t\t\t\tminWidth={ MIN_WIDTH }\n\t\t\t\tenable={ getResizableSides() }\n\t\t\t\tonResizeStart={ ( event, direction, elt ) => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\twidth: parseInt( elt.offsetWidth, 10 ),\n\t\t\t\t\t\twidthUnit: 'px',\n\t\t\t\t\t} );\n\t\t\t\t\ttoggleSelection( false );\n\t\t\t\t} }\n\t\t\t\tonResizeStop={ ( event, direction, elt, delta ) => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\twidth: parseInt( width + delta.width, 10 ),\n\t\t\t\t\t} );\n\t\t\t\t\ttoggleSelection( true );\n\t\t\t\t} }\n\t\t\t\tshowHandle={ isSelected }\n\t\t\t>\n\t\t\t\t{ ( isButtonPositionInside ||\n\t\t\t\t\tisButtonPositionOutside ||\n\t\t\t\t\thasOnlyButton ) && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ renderTextField() }\n\t\t\t\t\t\t{ renderButton() }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\n\t\t\t\t{ hasNoButton && renderTextField() }\n\t\t\t</ResizableBox>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,YAAA,G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C9B+I,MAAM,EAAE;MACT,CAAG;MACHzJ,SAAS,EAAG,IAAA6D,aAAI,EACf,iCAAiC,EACjCf,sBAAsB,GAAGhB,WAAW,CAAC9B,SAAS,GAAG8D,SAClD,CAAG;MACH9C,KAAK,EAAGuH,gBAAgB,CAAC,CAAG;MAC5BmB,QAAQ,EAAGrC,gBAAW;MACtBsC,MAAM,EAAGzF,iBAAiB,CAAC,CAAG;MAC9B0F,aAAa,EAAGA,CAAEhF,KAAK,EAAEiF,SAAS,EAAEC,GAAG,KAAM;QAC5C5J,aAAa,CAAE;UACdO,KAAK,EAAEiH,QAAQ,CAAEoC,GAAG,CAACC,WAAW,EAAE,EAAG,CAAC;UACtCrJ,SAAS,EAAE;QACZ,CAAE,CAAC;QACHP,eAAe,CAAE,KAAM,CAAC;MACzB,CAAG;MACH6J,YAAY,EAAGA,CAAEpF,KAAK,EAAEiF,SAAS,EAAEC,GAAG,EAAEG,KAAK,KAAM;QAClD/J,aAAa,CAAE;UACdO,KAAK,EAAEiH,QAAQ,CAAEjH,KAAK,GAAGwJ,KAAK,CAACxJ,KAAK,EAAE,EAAG;QAC1C,CAAE,CAAC;QACHN,eAAe,CAAE,IAAK,CAAC;MACxB,CAAG;MACH+J,UAAU,EAAG9J,UAAY;MAAAkF,QAAA,GAEvB,CAAExC,sBAAsB,IACzBC,uBAAuB,IACvBE,aAAa,kBACb,IAAArD,WAAA,CAAAwF,IAAA,EAAAxF,WAAA,CAAAyF,QAAA;QAAAC,QAAA,GACGjB,eAAe,CAAC,CAAC,EACjBU,YAAY,CAAC,CAAC;MAAA,CACf,CACF,EAEC/B,WAAW,IAAIqB,eAAe,CAAC,CAAC;IAAA,CACrB,CAAC;EAAA,CACX,CAAC;AAER","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_blockEditor","_data","_element","_components","_compose","_icons","_i18n","_dom","_utils","_hooks","_jsxRuntime","DEFAULT_INNER_PADDING","PERCENTAGE_WIDTHS","SearchEdit","className","attributes","setAttributes","toggleSelection","isSelected","clientId","label","showLabel","placeholder","width","widthUnit","align","buttonText","buttonPosition","buttonUseIcon","isSearchFieldHidden","style","wasJustInsertedIntoNavigationBlock","useSelect","select","getBlockParentsByBlockName","wasBlockJustInserted","blockEditorStore","length","__unstableMarkNextChangeAsNotPersistent","useDispatch","useEffect","borderRadius","border","radius","borderProps","useBorderProps","colorProps","useColorProps","fluidTypographySettings","layout","useSettings","typographyProps","useTypographyProps","typography","fluid","wideSize","unitControlInstanceId","useInstanceId","UnitControl","unitControlInputId","isButtonPositionInside","isButtonPositionOutside","hasNoButton","hasOnlyButton","searchFieldRef","useRef","buttonRef","units","useCustomUnits","availableUnits","defaultValues","PC_WIDTH_DEFAULT","px","PX_WIDTH_DEFAULT","getBlockClassNames","clsx","undefined","buttonPositionControls","__","value","getResizableSides","right","left","renderTextField","textFieldClasses","textFieldStyles","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","textDecoration","jsx","type","onChange","event","target","ref","renderButton","buttonClasses","__experimentalGetElementClassName","buttonStyles","handleButtonClick","jsxs","Fragment","children","stripHTML","onClick","Icon","icon","search","RichText","identifier","withoutInteractiveFormatting","html","dropdownMenuProps","useToolsPanelDropdownMenuProps","controls","InspectorControls","__experimentalToolsPanel","resetAll","__experimentalToolsPanelItem","hasValue","onDeselect","isShownByDefault","ToggleControl","__nextHasNoMarginBottom","checked","SelectControl","__next40pxDefaultSize","options","__experimentalVStack","__experimentalUnitControl","id","min","isPercentageUnit","MIN_WIDTH","max","step","newWidth","parsedNewWidth","parseInt","onUnitChange","newUnit","__unstableInputWidth","__experimentalToggleGroupControl","includes","hideLabelFromVision","isBlock","map","widthValue","__experimentalToggleGroupControlOption","sprintf","isNonZeroBorderRadius","padBorderRadius","getWrapperStyles","styles","Number","isInteger","blockProps","useBlockProps","labelClassnames","ResizableBox","size","height","minWidth","enable","onResizeStart","direction","elt","offsetWidth","onResizeStop","delta","showHandle"],"sources":["@wordpress/block-library/src/search/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseBlockProps,\n\tInspectorControls,\n\tRichText,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalUseColorProps as useColorProps,\n\tgetTypographyClassesAndStyles as useTypographyProps,\n\tstore as blockEditorStore,\n\t__experimentalGetElementClassName,\n\tuseSettings,\n} from '@wordpress/block-editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect, useRef } from '@wordpress/element';\nimport {\n\tSelectControl,\n\tToggleControl,\n\tResizableBox,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { Icon, search } from '@wordpress/icons';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport {\n\tPC_WIDTH_DEFAULT,\n\tPX_WIDTH_DEFAULT,\n\tMIN_WIDTH,\n\tisPercentageUnit,\n} from './utils.js';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\n// Used to calculate border radius adjustment to avoid \"fat\" corners when\n// button is placed inside wrapper.\nconst DEFAULT_INNER_PADDING = '4px';\nconst PERCENTAGE_WIDTHS = [ 25, 50, 75, 100 ];\n\nexport default function SearchEdit( {\n\tclassName,\n\tattributes,\n\tsetAttributes,\n\ttoggleSelection,\n\tisSelected,\n\tclientId,\n} ) {\n\tconst {\n\t\tlabel,\n\t\tshowLabel,\n\t\tplaceholder,\n\t\twidth,\n\t\twidthUnit,\n\t\talign,\n\t\tbuttonText,\n\t\tbuttonPosition,\n\t\tbuttonUseIcon,\n\t\tisSearchFieldHidden,\n\t\tstyle,\n\t} = attributes;\n\n\tconst wasJustInsertedIntoNavigationBlock = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockParentsByBlockName, wasBlockJustInserted } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn (\n\t\t\t\t!! getBlockParentsByBlockName( clientId, 'core/navigation' )\n\t\t\t\t\t?.length && wasBlockJustInserted( clientId )\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tuseEffect( () => {\n\t\tif ( wasJustInsertedIntoNavigationBlock ) {\n\t\t\t// This side-effect should not create an undo level.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( {\n\t\t\t\tshowLabel: false,\n\t\t\t\tbuttonUseIcon: true,\n\t\t\t\tbuttonPosition: 'button-inside',\n\t\t\t} );\n\t\t}\n\t}, [\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\twasJustInsertedIntoNavigationBlock,\n\t\tsetAttributes,\n\t] );\n\n\tconst borderRadius = style?.border?.radius;\n\tlet borderProps = useBorderProps( attributes );\n\n\t// Check for old deprecated numerical border radius. Done as a separate\n\t// check so that a borderRadius style won't overwrite the longhand\n\t// per-corner styles.\n\tif ( typeof borderRadius === 'number' ) {\n\t\tborderProps = {\n\t\t\t...borderProps,\n\t\t\tstyle: {\n\t\t\t\t...borderProps.style,\n\t\t\t\tborderRadius: `${ borderRadius }px`,\n\t\t\t},\n\t\t};\n\t}\n\n\tconst colorProps = useColorProps( attributes );\n\tconst [ fluidTypographySettings, layout ] = useSettings(\n\t\t'typography.fluid',\n\t\t'layout'\n\t);\n\tconst typographyProps = useTypographyProps( attributes, {\n\t\ttypography: {\n\t\t\tfluid: fluidTypographySettings,\n\t\t},\n\t\tlayout: {\n\t\t\twideSize: layout?.wideSize,\n\t\t},\n\t} );\n\tconst unitControlInstanceId = useInstanceId( UnitControl );\n\tconst unitControlInputId = `wp-block-search__width-${ unitControlInstanceId }`;\n\tconst isButtonPositionInside = 'button-inside' === buttonPosition;\n\tconst isButtonPositionOutside = 'button-outside' === buttonPosition;\n\tconst hasNoButton = 'no-button' === buttonPosition;\n\tconst hasOnlyButton = 'button-only' === buttonPosition;\n\tconst searchFieldRef = useRef();\n\tconst buttonRef = useRef();\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: [ '%', 'px' ],\n\t\tdefaultValues: { '%': PC_WIDTH_DEFAULT, px: PX_WIDTH_DEFAULT },\n\t} );\n\n\tuseEffect( () => {\n\t\tif ( hasOnlyButton && ! isSelected ) {\n\t\t\tsetAttributes( {\n\t\t\t\tisSearchFieldHidden: true,\n\t\t\t} );\n\t\t}\n\t}, [ hasOnlyButton, isSelected, setAttributes ] );\n\n\t// Show the search field when width changes.\n\tuseEffect( () => {\n\t\tif ( ! hasOnlyButton || ! isSelected ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetAttributes( {\n\t\t\tisSearchFieldHidden: false,\n\t\t} );\n\t}, [ hasOnlyButton, isSelected, setAttributes, width ] );\n\n\tconst getBlockClassNames = () => {\n\t\treturn clsx(\n\t\t\tclassName,\n\t\t\tisButtonPositionInside\n\t\t\t\t? 'wp-block-search__button-inside'\n\t\t\t\t: undefined,\n\t\t\tisButtonPositionOutside\n\t\t\t\t? 'wp-block-search__button-outside'\n\t\t\t\t: undefined,\n\t\t\thasNoButton ? 'wp-block-search__no-button' : undefined,\n\t\t\thasOnlyButton ? 'wp-block-search__button-only' : undefined,\n\t\t\t! buttonUseIcon && ! hasNoButton\n\t\t\t\t? 'wp-block-search__text-button'\n\t\t\t\t: undefined,\n\t\t\tbuttonUseIcon && ! hasNoButton\n\t\t\t\t? 'wp-block-search__icon-button'\n\t\t\t\t: undefined,\n\t\t\thasOnlyButton && isSearchFieldHidden\n\t\t\t\t? 'wp-block-search__searchfield-hidden'\n\t\t\t\t: undefined\n\t\t);\n\t};\n\n\tconst buttonPositionControls = [\n\t\t{\n\t\t\tlabel: __( 'Button outside' ),\n\t\t\tvalue: 'button-outside',\n\t\t},\n\t\t{\n\t\t\tlabel: __( 'Button inside' ),\n\t\t\tvalue: 'button-inside',\n\t\t},\n\t\t{\n\t\t\tlabel: __( 'No button' ),\n\t\t\tvalue: 'no-button',\n\t\t},\n\t\t{\n\t\t\tlabel: __( 'Button only' ),\n\t\t\tvalue: 'button-only',\n\t\t},\n\t];\n\n\tconst getResizableSides = () => {\n\t\tif ( hasOnlyButton ) {\n\t\t\treturn {};\n\t\t}\n\n\t\treturn {\n\t\t\tright: align !== 'right',\n\t\t\tleft: align === 'right',\n\t\t};\n\t};\n\n\tconst renderTextField = () => {\n\t\t// If the input is inside the wrapper, the wrapper gets the border color styles/classes, not the input control.\n\t\tconst textFieldClasses = clsx(\n\t\t\t'wp-block-search__input',\n\t\t\tisButtonPositionInside ? undefined : borderProps.className,\n\t\t\ttypographyProps.className\n\t\t);\n\t\tconst textFieldStyles = {\n\t\t\t...( isButtonPositionInside\n\t\t\t\t? {\n\t\t\t\t\t\tborderRadius: borderProps.style?.borderRadius,\n\t\t\t\t\t\tborderTopLeftRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderTopLeftRadius,\n\t\t\t\t\t\tborderTopRightRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderTopRightRadius,\n\t\t\t\t\t\tborderBottomLeftRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderBottomLeftRadius,\n\t\t\t\t\t\tborderBottomRightRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderBottomRightRadius,\n\t\t\t\t }\n\t\t\t\t: borderProps.style ),\n\t\t\t...typographyProps.style,\n\t\t\ttextDecoration: undefined,\n\t\t};\n\n\t\treturn (\n\t\t\t<input\n\t\t\t\ttype=\"search\"\n\t\t\t\tclassName={ textFieldClasses }\n\t\t\t\tstyle={ textFieldStyles }\n\t\t\t\taria-label={ __( 'Optional placeholder text' ) }\n\t\t\t\t// We hide the placeholder field's placeholder when there is a value. This\n\t\t\t\t// stops screen readers from reading the placeholder field's placeholder\n\t\t\t\t// which is confusing.\n\t\t\t\tplaceholder={\n\t\t\t\t\tplaceholder ? undefined : __( 'Optional placeholder…' )\n\t\t\t\t}\n\t\t\t\tvalue={ placeholder }\n\t\t\t\tonChange={ ( event ) =>\n\t\t\t\t\tsetAttributes( { placeholder: event.target.value } )\n\t\t\t\t}\n\t\t\t\tref={ searchFieldRef }\n\t\t\t/>\n\t\t);\n\t};\n\n\tconst renderButton = () => {\n\t\t// If the button is inside the wrapper, the wrapper gets the border color styles/classes, not the button.\n\t\tconst buttonClasses = clsx(\n\t\t\t'wp-block-search__button',\n\t\t\tcolorProps.className,\n\t\t\ttypographyProps.className,\n\t\t\tisButtonPositionInside ? undefined : borderProps.className,\n\t\t\tbuttonUseIcon ? 'has-icon' : undefined,\n\t\t\t__experimentalGetElementClassName( 'button' )\n\t\t);\n\t\tconst buttonStyles = {\n\t\t\t...colorProps.style,\n\t\t\t...typographyProps.style,\n\t\t\t...( isButtonPositionInside\n\t\t\t\t? {\n\t\t\t\t\t\tborderRadius: borderProps.style?.borderRadius,\n\t\t\t\t\t\tborderTopLeftRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderTopLeftRadius,\n\t\t\t\t\t\tborderTopRightRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderTopRightRadius,\n\t\t\t\t\t\tborderBottomLeftRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderBottomLeftRadius,\n\t\t\t\t\t\tborderBottomRightRadius:\n\t\t\t\t\t\t\tborderProps.style?.borderBottomRightRadius,\n\t\t\t\t }\n\t\t\t\t: borderProps.style ),\n\t\t};\n\t\tconst handleButtonClick = () => {\n\t\t\tif ( hasOnlyButton ) {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tisSearchFieldHidden: ! isSearchFieldHidden,\n\t\t\t\t} );\n\t\t\t}\n\t\t};\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ buttonUseIcon && (\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tclassName={ buttonClasses }\n\t\t\t\t\t\tstyle={ buttonStyles }\n\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\tbuttonText\n\t\t\t\t\t\t\t\t? stripHTML( buttonText )\n\t\t\t\t\t\t\t\t: __( 'Search' )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonClick={ handleButtonClick }\n\t\t\t\t\t\tref={ buttonRef }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Icon icon={ search } />\n\t\t\t\t\t</button>\n\t\t\t\t) }\n\n\t\t\t\t{ ! buttonUseIcon && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"buttonText\"\n\t\t\t\t\t\tclassName={ buttonClasses }\n\t\t\t\t\t\tstyle={ buttonStyles }\n\t\t\t\t\t\taria-label={ __( 'Button text' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Add button text…' ) }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\tvalue={ buttonText }\n\t\t\t\t\t\tonChange={ ( html ) =>\n\t\t\t\t\t\t\tsetAttributes( { buttonText: html } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonClick={ handleButtonClick }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t};\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst controls = (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\twidth: undefined,\n\t\t\t\t\t\t\twidthUnit: undefined,\n\t\t\t\t\t\t\tshowLabel: true,\n\t\t\t\t\t\t\tbuttonUseIcon: false,\n\t\t\t\t\t\t\tbuttonPosition: 'button-outside',\n\t\t\t\t\t\t\tisSearchFieldHidden: false,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => ! showLabel }\n\t\t\t\t\t\tlabel={ __( 'Show label' ) }\n\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowLabel: true,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tchecked={ showLabel }\n\t\t\t\t\t\t\tlabel={ __( 'Show label' ) }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tshowLabel: 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/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => buttonPosition !== 'button-outside' }\n\t\t\t\t\t\tlabel={ __( 'Button position' ) }\n\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tbuttonPosition: 'button-outside',\n\t\t\t\t\t\t\t\tisSearchFieldHidden: false,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t\tvalue={ buttonPosition }\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Button position' ) }\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tbuttonPosition: value,\n\t\t\t\t\t\t\t\t\tisSearchFieldHidden:\n\t\t\t\t\t\t\t\t\t\tvalue === 'button-only',\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\toptions={ buttonPositionControls }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t{ buttonPosition !== 'no-button' && (\n\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\thasValue={ () => !! buttonUseIcon }\n\t\t\t\t\t\t\tlabel={ __( 'Use button with icon' ) }\n\t\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tbuttonUseIcon: false,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tchecked={ buttonUseIcon }\n\t\t\t\t\t\t\t\tlabel={ __( 'Use button with icon' ) }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tbuttonUseIcon: value,\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</ToolsPanelItem>\n\t\t\t\t\t) }\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => !! width }\n\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\twidth: undefined,\n\t\t\t\t\t\t\t\twidthUnit: undefined,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<VStack>\n\t\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\t\t\tid={ unitControlInputId } // Unused, kept for backwards compatibility\n\t\t\t\t\t\t\t\tmin={\n\t\t\t\t\t\t\t\t\tisPercentageUnit( widthUnit )\n\t\t\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t\t\t: MIN_WIDTH\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmax={\n\t\t\t\t\t\t\t\t\tisPercentageUnit( widthUnit )\n\t\t\t\t\t\t\t\t\t\t? 100\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tstep={ 1 }\n\t\t\t\t\t\t\t\tonChange={ ( newWidth ) => {\n\t\t\t\t\t\t\t\t\tconst parsedNewWidth =\n\t\t\t\t\t\t\t\t\t\tnewWidth === ''\n\t\t\t\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t\t\t\t: parseInt( newWidth, 10 );\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\twidth: parsedNewWidth,\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\tonUnitChange={ ( newUnit ) => {\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\twidth:\n\t\t\t\t\t\t\t\t\t\t\t'%' === newUnit\n\t\t\t\t\t\t\t\t\t\t\t\t? PC_WIDTH_DEFAULT\n\t\t\t\t\t\t\t\t\t\t\t\t: PX_WIDTH_DEFAULT,\n\t\t\t\t\t\t\t\t\t\twidthUnit: newUnit,\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__unstableInputWidth=\"80px\"\n\t\t\t\t\t\t\t\tvalue={ `${ width }${ widthUnit }` }\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\t<ToggleGroupControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Percentage Width' ) }\n\t\t\t\t\t\t\t\tvalue={\n\t\t\t\t\t\t\t\t\tPERCENTAGE_WIDTHS.includes( width ) &&\n\t\t\t\t\t\t\t\t\twidthUnit === '%'\n\t\t\t\t\t\t\t\t\t\t? width\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\t\tonChange={ ( newWidth ) => {\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\twidth: newWidth,\n\t\t\t\t\t\t\t\t\t\twidthUnit: '%',\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\tisBlock\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ PERCENTAGE_WIDTHS.map( ( widthValue ) => {\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\t\t\t\tkey={ widthValue }\n\t\t\t\t\t\t\t\t\t\t\tvalue={ widthValue }\n\t\t\t\t\t\t\t\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t\t\t\t\t\t\t\t/* translators: %d: Percentage value. */\n\t\t\t\t\t\t\t\t\t\t\t\t__( '%d%%' ),\n\t\t\t\t\t\t\t\t\t\t\t\twidthValue\n\t\t\t\t\t\t\t\t\t\t\t) }\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} ) }\n\t\t\t\t\t\t\t</ToggleGroupControl>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n\n\tconst isNonZeroBorderRadius = ( radius ) =>\n\t\tradius !== undefined && parseInt( radius, 10 ) !== 0;\n\n\tconst padBorderRadius = ( radius ) =>\n\t\tisNonZeroBorderRadius( radius )\n\t\t\t? `calc(${ radius } + ${ DEFAULT_INNER_PADDING })`\n\t\t\t: undefined;\n\n\tconst getWrapperStyles = () => {\n\t\tconst styles = isButtonPositionInside\n\t\t\t? borderProps.style\n\t\t\t: {\n\t\t\t\t\tborderRadius: borderProps.style?.borderRadius,\n\t\t\t\t\tborderTopLeftRadius: borderProps.style?.borderTopLeftRadius,\n\t\t\t\t\tborderTopRightRadius:\n\t\t\t\t\t\tborderProps.style?.borderTopRightRadius,\n\t\t\t\t\tborderBottomLeftRadius:\n\t\t\t\t\t\tborderProps.style?.borderBottomLeftRadius,\n\t\t\t\t\tborderBottomRightRadius:\n\t\t\t\t\t\tborderProps.style?.borderBottomRightRadius,\n\t\t\t };\n\n\t\tif ( isButtonPositionInside ) {\n\t\t\t// We have button inside wrapper and a border radius value to apply.\n\t\t\t// Add default padding so we don't get \"fat\" corners.\n\t\t\t//\n\t\t\t// CSS calc() is used here to support non-pixel units. The inline\n\t\t\t// style using calc() will only apply if both values have units.\n\n\t\t\tif ( typeof borderRadius === 'object' ) {\n\t\t\t\t// Individual corner border radii present.\n\t\t\t\tconst {\n\t\t\t\t\tborderTopLeftRadius,\n\t\t\t\t\tborderTopRightRadius,\n\t\t\t\t\tborderBottomLeftRadius,\n\t\t\t\t\tborderBottomRightRadius,\n\t\t\t\t} = borderProps.style;\n\n\t\t\t\treturn {\n\t\t\t\t\t...styles,\n\t\t\t\t\tborderTopLeftRadius: padBorderRadius( borderTopLeftRadius ),\n\t\t\t\t\tborderTopRightRadius:\n\t\t\t\t\t\tpadBorderRadius( borderTopRightRadius ),\n\t\t\t\t\tborderBottomLeftRadius: padBorderRadius(\n\t\t\t\t\t\tborderBottomLeftRadius\n\t\t\t\t\t),\n\t\t\t\t\tborderBottomRightRadius: padBorderRadius(\n\t\t\t\t\t\tborderBottomRightRadius\n\t\t\t\t\t),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// The inline style using calc() will only apply if both values\n\t\t\t// supplied to calc() have units. Deprecated block's may have\n\t\t\t// unitless integer.\n\t\t\tconst radius = Number.isInteger( borderRadius )\n\t\t\t\t? `${ borderRadius }px`\n\t\t\t\t: borderRadius;\n\n\t\t\tstyles.borderRadius = `calc(${ radius } + ${ DEFAULT_INNER_PADDING })`;\n\t\t}\n\n\t\treturn styles;\n\t};\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: getBlockClassNames(),\n\t\tstyle: {\n\t\t\t...typographyProps.style,\n\t\t\t// Input opts out of text decoration.\n\t\t\ttextDecoration: undefined,\n\t\t},\n\t} );\n\n\tconst labelClassnames = clsx(\n\t\t'wp-block-search__label',\n\t\ttypographyProps.className\n\t);\n\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t{ controls }\n\n\t\t\t{ showLabel && (\n\t\t\t\t<RichText\n\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\tclassName={ labelClassnames }\n\t\t\t\t\taria-label={ __( 'Label text' ) }\n\t\t\t\t\tplaceholder={ __( 'Add label…' ) }\n\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\tvalue={ label }\n\t\t\t\t\tonChange={ ( html ) => setAttributes( { label: html } ) }\n\t\t\t\t\tstyle={ typographyProps.style }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t<ResizableBox\n\t\t\t\tsize={ {\n\t\t\t\t\twidth:\n\t\t\t\t\t\twidth === undefined\n\t\t\t\t\t\t\t? 'auto'\n\t\t\t\t\t\t\t: `${ width }${ widthUnit }`,\n\t\t\t\t\theight: 'auto',\n\t\t\t\t} }\n\t\t\t\tclassName={ clsx(\n\t\t\t\t\t'wp-block-search__inside-wrapper',\n\t\t\t\t\tisButtonPositionInside ? borderProps.className : undefined\n\t\t\t\t) }\n\t\t\t\tstyle={ getWrapperStyles() }\n\t\t\t\tminWidth={ MIN_WIDTH }\n\t\t\t\tenable={ getResizableSides() }\n\t\t\t\tonResizeStart={ ( event, direction, elt ) => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\twidth: parseInt( elt.offsetWidth, 10 ),\n\t\t\t\t\t\twidthUnit: 'px',\n\t\t\t\t\t} );\n\t\t\t\t\ttoggleSelection( false );\n\t\t\t\t} }\n\t\t\t\tonResizeStop={ ( event, direction, elt, delta ) => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\twidth: parseInt( width + delta.width, 10 ),\n\t\t\t\t\t} );\n\t\t\t\t\ttoggleSelection( true );\n\t\t\t\t} }\n\t\t\t\tshowHandle={ isSelected }\n\t\t\t>\n\t\t\t\t{ ( isButtonPositionInside ||\n\t\t\t\t\tisButtonPositionOutside ||\n\t\t\t\t\thasOnlyButton ) && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ renderTextField() }\n\t\t\t\t\t\t{ renderButton() }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\n\t\t\t\t{ hasNoButton && renderTextField() }\n\t\t\t</ResizableBox>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AAWA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAYA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,IAAA,GAAAR,OAAA;AAKA,IAAAS,MAAA,GAAAT,OAAA;AAMA,IAAAU,MAAA,GAAAV,OAAA;AAAgE,IA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ACjBc,YAAY,CAAC,CAAC;MAAA,CACf,CACF,EAECnC,WAAW,IAAIqB,eAAe,CAAC,CAAC;IAAA,CACrB,CAAC;EAAA,CACX,CAAC;AAER","ignoreList":[]}
@@ -12,6 +12,7 @@ var _data = require("@wordpress/data");
12
12
  var _coreData = require("@wordpress/core-data");
13
13
  var _hooks = require("./utils/hooks");
14
14
  var _titleModal = _interopRequireDefault(require("./title-modal"));
15
+ var _getTemplatePartIcon = require("./utils/get-template-part-icon");
15
16
  var _jsxRuntime = require("react/jsx-runtime");
16
17
  /**
17
18
  * WordPress dependencies
@@ -53,7 +54,7 @@ function TemplatePartPlaceholder({
53
54
  const areaObject = (0, _hooks.useTemplatePartArea)(area);
54
55
  const createFromBlocks = (0, _hooks.useCreateTemplatePartFromBlocks)(area, setAttributes);
55
56
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Placeholder, {
56
- icon: areaObject.icon,
57
+ icon: (0, _getTemplatePartIcon.getTemplatePartIcon)(areaObject.icon),
57
58
  label: areaObject.label,
58
59
  instructions: isBlockBasedTheme ? (0, _i18n.sprintf)(
59
60
  // Translators: %s as template part area title ("Header", "Footer", etc.).
@@ -1 +1 @@
1
- {"version":3,"names":["_i18n","require","_components","_element","_data","_coreData","_hooks","_titleModal","_interopRequireDefault","_jsxRuntime","TemplatePartPlaceholder","area","clientId","templatePartId","onOpenSelectionModal","setAttributes","templateParts","isResolving","useAlternativeTemplateParts","blockPatterns","useAlternativeBlockPatterns","isBlockBasedTheme","canCreateTemplatePart","useSelect","select","getCurrentTheme","canUser","coreStore","is_block_theme","kind","name","showTitleModal","setShowTitleModal","useState","areaObject","useTemplatePartArea","createFromBlocks","useCreateTemplatePartFromBlocks","jsxs","Placeholder","icon","label","instructions","sprintf","__","toLowerCase","children","jsx","Spinner","length","Button","__next40pxDefaultSize","variant","onClick","default","areaLabel","onClose","onSubmit","title"],"sources":["@wordpress/block-library/src/template-part/edit/placeholder.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Placeholder, Button, Spinner } from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseAlternativeBlockPatterns,\n\tuseAlternativeTemplateParts,\n\tuseCreateTemplatePartFromBlocks,\n\tuseTemplatePartArea,\n} from './utils/hooks';\nimport TitleModal from './title-modal';\n\nexport default function TemplatePartPlaceholder( {\n\tarea,\n\tclientId,\n\ttemplatePartId,\n\tonOpenSelectionModal,\n\tsetAttributes,\n} ) {\n\tconst { templateParts, isResolving } = useAlternativeTemplateParts(\n\t\tarea,\n\t\ttemplatePartId\n\t);\n\tconst blockPatterns = useAlternativeBlockPatterns( area, clientId );\n\n\tconst { isBlockBasedTheme, canCreateTemplatePart } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCurrentTheme, canUser } = select( coreStore );\n\t\t\treturn {\n\t\t\t\tisBlockBasedTheme: getCurrentTheme()?.is_block_theme,\n\t\t\t\tcanCreateTemplatePart: canUser( 'create', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: 'wp_template_part',\n\t\t\t\t} ),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst [ showTitleModal, setShowTitleModal ] = useState( false );\n\tconst areaObject = useTemplatePartArea( area );\n\tconst createFromBlocks = useCreateTemplatePartFromBlocks(\n\t\tarea,\n\t\tsetAttributes\n\t);\n\n\treturn (\n\t\t<Placeholder\n\t\t\ticon={ areaObject.icon }\n\t\t\tlabel={ areaObject.label }\n\t\t\tinstructions={\n\t\t\t\tisBlockBasedTheme\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t// Translators: %s as template part area title (\"Header\", \"Footer\", etc.).\n\t\t\t\t\t\t\t__( 'Choose an existing %s or create a new one.' ),\n\t\t\t\t\t\t\tareaObject.label.toLowerCase()\n\t\t\t\t\t )\n\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t// Translators: %s as template part area title (\"Header\", \"Footer\", etc.).\n\t\t\t\t\t\t\t__( 'Choose an existing %s.' ),\n\t\t\t\t\t\t\tareaObject.label.toLowerCase()\n\t\t\t\t\t )\n\t\t\t}\n\t\t>\n\t\t\t{ isResolving && <Spinner /> }\n\n\t\t\t{ ! isResolving &&\n\t\t\t\t!! ( templateParts.length || blockPatterns.length ) && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ onOpenSelectionModal }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Choose' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\n\t\t\t{ ! isResolving && isBlockBasedTheme && canCreateTemplatePart && (\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tsetShowTitleModal( true );\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Start blank' ) }\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t\t{ showTitleModal && (\n\t\t\t\t<TitleModal\n\t\t\t\t\tareaLabel={ areaObject.label }\n\t\t\t\t\tonClose={ () => setShowTitleModal( false ) }\n\t\t\t\t\tonSubmit={ ( title ) => {\n\t\t\t\t\t\tcreateFromBlocks( [], title );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</Placeholder>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AAMA,IAAAM,WAAA,GAAAC,sBAAA,CAAAP,OAAA;A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AAF,aAAO;IACP;IACA,IAAAC,QAAE,EAAE,wBAAyB,CAAC,EAC9BV,UAAU,CAACO,KAAK,CAACI,WAAW,CAAC,CAC7B,CACH;IAAAC,QAAA,GAEC7B,WAAW,iBAAI,IAAAR,WAAA,CAAAsC,GAAA,EAAC7C,WAAA,CAAA8C,OAAO,IAAE,CAAC,EAE1B,CAAE/B,WAAW,IACd,CAAC,EAAID,aAAa,CAACiC,MAAM,IAAI9B,aAAa,CAAC8B,MAAM,CAAE,iBAClD,IAAAxC,WAAA,CAAAsC,GAAA,EAAC7C,WAAA,CAAAgD,MAAM;MACNC,qBAAqB;MACrBC,OAAO,EAAC,SAAS;MACjBC,OAAO,EAAGvC,oBAAsB;MAAAgC,QAAA,EAE9B,IAAAF,QAAE,EAAE,QAAS;IAAC,CACT,CACR,EAEA,CAAE3B,WAAW,IAAII,iBAAiB,IAAIC,qBAAqB,iBAC5D,IAAAb,WAAA,CAAAsC,GAAA,EAAC7C,WAAA,CAAAgD,MAAM;MACNC,qBAAqB;MACrBC,OAAO,EAAC,WAAW;MACnBC,OAAO,EAAGA,CAAA,KAAM;QACfrB,iBAAiB,CAAE,IAAK,CAAC;MAC1B,CAAG;MAAAc,QAAA,EAED,IAAAF,QAAE,EAAE,aAAc;IAAC,CACd,CACR,EACCb,cAAc,iBACf,IAAAtB,WAAA,CAAAsC,GAAA,EAACxC,WAAA,CAAA+C,OAAU;MACVC,SAAS,EAAGrB,UAAU,CAACO,KAAO;MAC9Be,OAAO,EAAGA,CAAA,KAAMxB,iBAAiB,CAAE,KAAM,CAAG;MAC5CyB,QAAQ,EAAKC,KAAK,IAAM;QACvBtB,gBAAgB,CAAE,EAAE,EAAEsB,KAAM,CAAC;MAC9B;IAAG,CACH,CACD;EAAA,CACW,CAAC;AAEhB","ignoreList":[]}
1
+ {"version":3,"names":["_i18n","require","_components","_element","_data","_coreData","_hooks","_titleModal","_interopRequireDefault","_getTemplatePartIcon","_jsxRuntime","TemplatePartPlaceholder","area","clientId","templatePartId","onOpenSelectionModal","setAttributes","templateParts","isResolving","useAlternativeTemplateParts","blockPatterns","useAlternativeBlockPatterns","isBlockBasedTheme","canCreateTemplatePart","useSelect","select","getCurrentTheme","canUser","coreStore","is_block_theme","kind","name","showTitleModal","setShowTitleModal","useState","areaObject","useTemplatePartArea","createFromBlocks","useCreateTemplatePartFromBlocks","jsxs","Placeholder","icon","getTemplatePartIcon","label","instructions","sprintf","__","toLowerCase","children","jsx","Spinner","length","Button","__next40pxDefaultSize","variant","onClick","default","areaLabel","onClose","onSubmit","title"],"sources":["@wordpress/block-library/src/template-part/edit/placeholder.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Placeholder, Button, Spinner } from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseAlternativeBlockPatterns,\n\tuseAlternativeTemplateParts,\n\tuseCreateTemplatePartFromBlocks,\n\tuseTemplatePartArea,\n} from './utils/hooks';\nimport TitleModal from './title-modal';\nimport { getTemplatePartIcon } from './utils/get-template-part-icon';\n\nexport default function TemplatePartPlaceholder( {\n\tarea,\n\tclientId,\n\ttemplatePartId,\n\tonOpenSelectionModal,\n\tsetAttributes,\n} ) {\n\tconst { templateParts, isResolving } = useAlternativeTemplateParts(\n\t\tarea,\n\t\ttemplatePartId\n\t);\n\tconst blockPatterns = useAlternativeBlockPatterns( area, clientId );\n\n\tconst { isBlockBasedTheme, canCreateTemplatePart } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCurrentTheme, canUser } = select( coreStore );\n\t\t\treturn {\n\t\t\t\tisBlockBasedTheme: getCurrentTheme()?.is_block_theme,\n\t\t\t\tcanCreateTemplatePart: canUser( 'create', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: 'wp_template_part',\n\t\t\t\t} ),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst [ showTitleModal, setShowTitleModal ] = useState( false );\n\tconst areaObject = useTemplatePartArea( area );\n\tconst createFromBlocks = useCreateTemplatePartFromBlocks(\n\t\tarea,\n\t\tsetAttributes\n\t);\n\n\treturn (\n\t\t<Placeholder\n\t\t\ticon={ getTemplatePartIcon( areaObject.icon ) }\n\t\t\tlabel={ areaObject.label }\n\t\t\tinstructions={\n\t\t\t\tisBlockBasedTheme\n\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t// Translators: %s as template part area title (\"Header\", \"Footer\", etc.).\n\t\t\t\t\t\t\t__( 'Choose an existing %s or create a new one.' ),\n\t\t\t\t\t\t\tareaObject.label.toLowerCase()\n\t\t\t\t\t )\n\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t// Translators: %s as template part area title (\"Header\", \"Footer\", etc.).\n\t\t\t\t\t\t\t__( 'Choose an existing %s.' ),\n\t\t\t\t\t\t\tareaObject.label.toLowerCase()\n\t\t\t\t\t )\n\t\t\t}\n\t\t>\n\t\t\t{ isResolving && <Spinner /> }\n\n\t\t\t{ ! isResolving &&\n\t\t\t\t!! ( templateParts.length || blockPatterns.length ) && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ onOpenSelectionModal }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Choose' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\n\t\t\t{ ! isResolving && isBlockBasedTheme && canCreateTemplatePart && (\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\tsetShowTitleModal( true );\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Start blank' ) }\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t\t{ showTitleModal && (\n\t\t\t\t<TitleModal\n\t\t\t\t\tareaLabel={ areaObject.label }\n\t\t\t\t\tonClose={ () => setShowTitleModal( false ) }\n\t\t\t\t\tonSubmit={ ( title ) => {\n\t\t\t\t\t\tcreateFromBlocks( [], title );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</Placeholder>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AAMA,IAAAM,WAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,oBAAA,GAAAR,OAAA;AAAqE,IAAAS,WAAA,GAAAT,OAAA;AAnBrE;AACA;AACA;;AAOA;AACA;AACA;;AAUe,SAASU,uBAAuBA,CAAE;EAChDC,IAAI;EACJC,QAAQ;EACRC,cAAc;EACdC,oBAAoB;EACpBC;AACD,CAAC,EAAG;EACH,MAAM;IAAEC,aAAa;IAAEC;EAAY,CAAC,GAAG,IAAAC,kCAA2B,EACjEP,IAAI,EACJE,cACD,CAAC;EACD,MAAMM,aAAa,GAAG,IAAAC,kCAA2B,EAAET,IAAI,EAAEC,QAAS,CAAC;EAEnE,MAAM;IAAES,iBAAiB;IAAEC;EAAsB,CAAC,GAAG,IAAAC,eAAS,EAC3DC,MAAM,IAAM;IACb,MAAM;MAAEC,eAAe;MAAEC;IAAQ,CAAC,GAAGF,MAAM,CAAEG,eAAU,CAAC;IACxD,OAAO;MACNN,iBAAiB,EAAEI,eAAe,CAAC,CAAC,EAAEG,cAAc;MACpDN,qBAAqB,EAAEI,OAAO,CAAE,QAAQ,EAAE;QACzCG,IAAI,EAAE,UAAU;QAChBC,IAAI,EAAE;MACP,CAAE;IACH,CAAC;EACF,CAAC,EACD,EACD,CAAC;EAED,MAAM,CAAEC,cAAc,EAA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,CAAE,IAAK,CAAC;MAC1B,CAAG;MAAAe,QAAA,EAED,IAAAF,QAAE,EAAE,aAAc;IAAC,CACd,CACR,EACCd,cAAc,iBACf,IAAAtB,WAAA,CAAAuC,GAAA,EAAC1C,WAAA,CAAAiD,OAAU;MACVC,SAAS,EAAGtB,UAAU,CAACQ,KAAO;MAC9Be,OAAO,EAAGA,CAAA,KAAMzB,iBAAiB,CAAE,KAAM,CAAG;MAC5C0B,QAAQ,EAAKC,KAAK,IAAM;QACvBvB,gBAAgB,CAAE,EAAE,EAAEuB,KAAM,CAAC;MAC9B;IAAG,CACH,CACD;EAAA,CACW,CAAC;AAEhB","ignoreList":[]}
@@ -53,6 +53,8 @@ function VideoEdit({
53
53
  } = attributes;
54
54
  const [temporaryURL, setTemporaryURL] = (0, _element.useState)(attributes.blob);
55
55
  const dropdownMenuProps = (0, _hooks.useToolsPanelDropdownMenuProps)();
56
+ const blockEditingMode = (0, _blockEditor.useBlockEditingMode)();
57
+ const hasNonContentControls = blockEditingMode === 'default';
56
58
  (0, _hooks.useUploadMediaFromBlobURL)({
57
59
  url: temporaryURL,
58
60
  allowedTypes: ALLOWED_MEDIA_TYPES,
@@ -230,7 +232,7 @@ function VideoEdit({
230
232
  isSelected: isSingleSelected,
231
233
  insertBlocksAfter: insertBlocksAfter,
232
234
  label: (0, _i18n.__)('Video caption text'),
233
- showToolbarButton: isSingleSelected
235
+ showToolbarButton: isSingleSelected && hasNonContentControls
234
236
  })]
235
237
  })]
236
238
  });