@wordpress/block-editor 12.16.0 → 12.17.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 (646) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/LICENSE.md +1 -1
  3. package/README.md +3 -6
  4. package/build/components/block-canvas/index.js +0 -2
  5. package/build/components/block-canvas/index.js.map +1 -1
  6. package/build/components/block-card/index.js +1 -1
  7. package/build/components/block-card/index.js.map +1 -1
  8. package/build/components/block-draggable/draggable-chip.js +6 -1
  9. package/build/components/block-draggable/draggable-chip.js.map +1 -1
  10. package/build/components/block-draggable/index.js +76 -6
  11. package/build/components/block-draggable/index.js.map +1 -1
  12. package/build/components/block-draggable/index.native.js +0 -6
  13. package/build/components/block-draggable/index.native.js.map +1 -1
  14. package/build/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
  15. package/build/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -1
  16. package/build/components/block-editing-mode/index.js +2 -3
  17. package/build/components/block-editing-mode/index.js.map +1 -1
  18. package/build/components/block-inspector/index.js +1 -1
  19. package/build/components/block-inspector/index.js.map +1 -1
  20. package/build/components/block-list/block-list-item-cell.native.js +1 -0
  21. package/build/components/block-list/block-list-item-cell.native.js.map +1 -1
  22. package/build/components/block-list/block.js +245 -102
  23. package/build/components/block-list/block.js.map +1 -1
  24. package/build/components/block-list/block.native.js +46 -20
  25. package/build/components/block-list/block.native.js.map +1 -1
  26. package/build/components/block-list/index.native.js +3 -5
  27. package/build/components/block-list/index.native.js.map +1 -1
  28. package/build/components/block-list/private-block-context.js +14 -0
  29. package/build/components/block-list/private-block-context.js.map +1 -0
  30. package/build/components/block-list/use-block-props/index.js +33 -96
  31. package/build/components/block-list/use-block-props/index.js.map +1 -1
  32. package/build/components/block-list/use-in-between-inserter.js +3 -2
  33. package/build/components/block-list/use-in-between-inserter.js.map +1 -1
  34. package/build/components/block-list/use-scroll-upon-insertion.native.js +41 -0
  35. package/build/components/block-list/use-scroll-upon-insertion.native.js.map +1 -0
  36. package/build/components/block-lock/toolbar.js +15 -27
  37. package/build/components/block-lock/toolbar.js.map +1 -1
  38. package/build/components/block-mover/index.js +2 -1
  39. package/build/components/block-mover/index.js.map +1 -1
  40. package/build/components/block-patterns-list/index.js +4 -4
  41. package/build/components/block-patterns-list/index.js.map +1 -1
  42. package/build/components/block-switcher/index.js +4 -4
  43. package/build/components/block-switcher/index.js.map +1 -1
  44. package/build/components/block-toolbar/index.js +1 -2
  45. package/build/components/block-toolbar/index.js.map +1 -1
  46. package/build/components/block-tools/block-toolbar-popover.js +0 -2
  47. package/build/components/block-tools/block-toolbar-popover.js.map +1 -1
  48. package/build/components/block-variation-transforms/index.js +29 -2
  49. package/build/components/block-variation-transforms/index.js.map +1 -1
  50. package/build/components/border-radius-control/linked-button.js +1 -1
  51. package/build/components/border-radius-control/linked-button.js.map +1 -1
  52. package/build/components/colors/utils.js +10 -2
  53. package/build/components/colors/utils.js.map +1 -1
  54. package/build/components/colors/with-colors.js +6 -2
  55. package/build/components/colors/with-colors.js.map +1 -1
  56. package/build/components/font-sizes/utils.js +10 -2
  57. package/build/components/font-sizes/utils.js.map +1 -1
  58. package/build/components/global-styles/border-panel.js +2 -1
  59. package/build/components/global-styles/border-panel.js.map +1 -1
  60. package/build/components/global-styles/color-panel.js +2 -1
  61. package/build/components/global-styles/color-panel.js.map +1 -1
  62. package/build/components/global-styles/dimensions-panel.js +4 -3
  63. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  64. package/build/components/global-styles/effects-panel.js +2 -1
  65. package/build/components/global-styles/effects-panel.js.map +1 -1
  66. package/build/components/global-styles/filters-panel.js +1 -4
  67. package/build/components/global-styles/filters-panel.js.map +1 -1
  68. package/build/components/global-styles/get-global-styles-changes.js +192 -0
  69. package/build/components/global-styles/get-global-styles-changes.js.map +1 -0
  70. package/build/components/global-styles/hooks.js +1 -1
  71. package/build/components/global-styles/hooks.js.map +1 -1
  72. package/build/components/global-styles/image-settings-panel.js +7 -1
  73. package/build/components/global-styles/image-settings-panel.js.map +1 -1
  74. package/build/components/global-styles/index.js +7 -0
  75. package/build/components/global-styles/index.js.map +1 -1
  76. package/build/components/global-styles/typography-panel.js +2 -1
  77. package/build/components/global-styles/typography-panel.js.map +1 -1
  78. package/build/components/global-styles/use-global-styles-output.js +22 -8
  79. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  80. package/build/components/global-styles/utils.js +8 -1
  81. package/build/components/global-styles/utils.js.map +1 -1
  82. package/build/components/height-control/index.js +6 -2
  83. package/build/components/height-control/index.js.map +1 -1
  84. package/build/components/image-size-control/index.js +2 -2
  85. package/build/components/image-size-control/index.js.map +1 -1
  86. package/build/components/index.native.js +6 -5
  87. package/build/components/index.native.js.map +1 -1
  88. package/build/components/inner-blocks/index.js +61 -22
  89. package/build/components/inner-blocks/index.js.map +1 -1
  90. package/build/components/inner-blocks/index.native.js +18 -4
  91. package/build/components/inner-blocks/index.native.js.map +1 -1
  92. package/build/components/inner-blocks/use-inner-block-template-sync.js +5 -6
  93. package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  94. package/build/components/inner-blocks/use-nested-settings-update.js +5 -9
  95. package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  96. package/build/components/inserter/block-patterns-explorer/pattern-list.js +1 -1
  97. package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  98. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +10 -9
  99. package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  100. package/build/components/inserter/block-patterns-tab/patterns-filter.js +10 -10
  101. package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  102. package/build/components/inserter/block-patterns-tab/use-pattern-categories.js +9 -9
  103. package/build/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
  104. package/build/components/inserter/block-patterns-tab/utils.js +10 -14
  105. package/build/components/inserter/block-patterns-tab/utils.js.map +1 -1
  106. package/build/components/inserter/hooks/use-block-types-state.js +4 -14
  107. package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
  108. package/build/components/inserter/hooks/use-patterns-state.js +1 -1
  109. package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
  110. package/build/components/inserter/index.js +1 -2
  111. package/build/components/inserter/index.js.map +1 -1
  112. package/build/components/inserter/library.js +3 -7
  113. package/build/components/inserter/library.js.map +1 -1
  114. package/build/components/inserter/menu.js +14 -28
  115. package/build/components/inserter/menu.js.map +1 -1
  116. package/build/components/inserter/tabs.js +21 -21
  117. package/build/components/inserter/tabs.js.map +1 -1
  118. package/build/components/inserter-draggable-blocks/index.js +1 -1
  119. package/build/components/inserter-draggable-blocks/index.js.map +1 -1
  120. package/build/components/inserter-list-item/index.js +2 -4
  121. package/build/components/inserter-list-item/index.js.map +1 -1
  122. package/build/components/inspector-controls/block-support-tools-panel.js +3 -1
  123. package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  124. package/build/components/inspector-controls-tabs/index.js +34 -23
  125. package/build/components/inspector-controls-tabs/index.js.map +1 -1
  126. package/build/components/list-view/block-select-button.js +4 -0
  127. package/build/components/list-view/block-select-button.js.map +1 -1
  128. package/build/components/list-view/block.js +57 -3
  129. package/build/components/list-view/block.js.map +1 -1
  130. package/build/components/media-upload-progress/constants.js +19 -0
  131. package/build/components/media-upload-progress/constants.js.map +1 -0
  132. package/build/components/media-upload-progress/index.native.js +42 -17
  133. package/build/components/media-upload-progress/index.native.js.map +1 -1
  134. package/build/components/navigable-toolbar/index.js +9 -14
  135. package/build/components/navigable-toolbar/index.js.map +1 -1
  136. package/build/components/plain-text/index.native.js +8 -3
  137. package/build/components/plain-text/index.native.js.map +1 -1
  138. package/build/components/provider/index.js +3 -1
  139. package/build/components/provider/index.js.map +1 -1
  140. package/build/components/provider/use-block-sync.js +7 -1
  141. package/build/components/provider/use-block-sync.js.map +1 -1
  142. package/build/components/rich-text/index.js +17 -7
  143. package/build/components/rich-text/index.js.map +1 -1
  144. package/build/components/rich-text/native/index.native.js +16 -24
  145. package/build/components/rich-text/native/index.native.js.map +1 -1
  146. package/build/components/rich-text/use-input-rules.js +2 -2
  147. package/build/components/rich-text/use-input-rules.js.map +1 -1
  148. package/build/components/rich-text/use-mark-persistent.js +1 -1
  149. package/build/components/rich-text/use-mark-persistent.js.map +1 -1
  150. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
  151. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  152. package/build/components/url-input/index.js +9 -6
  153. package/build/components/url-input/index.js.map +1 -1
  154. package/build/components/use-block-commands/index.js +14 -18
  155. package/build/components/use-block-commands/index.js.map +1 -1
  156. package/build/components/use-block-drop-zone/index.js +51 -22
  157. package/build/components/use-block-drop-zone/index.js.map +1 -1
  158. package/build/components/use-moving-animation/index.js +100 -92
  159. package/build/components/use-moving-animation/index.js.map +1 -1
  160. package/build/components/use-on-block-drop/index.js +8 -11
  161. package/build/components/use-on-block-drop/index.js.map +1 -1
  162. package/build/components/writing-flow/index.js +0 -1
  163. package/build/components/writing-flow/index.js.map +1 -1
  164. package/build/components/writing-flow/use-drag-selection.js +15 -4
  165. package/build/components/writing-flow/use-drag-selection.js.map +1 -1
  166. package/build/components/writing-flow/use-selection-observer.js +73 -27
  167. package/build/components/writing-flow/use-selection-observer.js.map +1 -1
  168. package/build/components/writing-flow/use-tab-nav.js +7 -4
  169. package/build/components/writing-flow/use-tab-nav.js.map +1 -1
  170. package/build/hooks/align.js +1 -1
  171. package/build/hooks/align.js.map +1 -1
  172. package/build/hooks/anchor.js +1 -1
  173. package/build/hooks/anchor.js.map +1 -1
  174. package/build/hooks/aria-label.js +9 -1
  175. package/build/hooks/aria-label.js.map +1 -1
  176. package/build/hooks/background.js +185 -20
  177. package/build/hooks/background.js.map +1 -1
  178. package/build/hooks/border.js +5 -10
  179. package/build/hooks/border.js.map +1 -1
  180. package/build/hooks/color.js +13 -11
  181. package/build/hooks/color.js.map +1 -1
  182. package/build/hooks/custom-class-name.js +1 -1
  183. package/build/hooks/custom-class-name.js.map +1 -1
  184. package/build/hooks/custom-class-name.native.js +9 -1
  185. package/build/hooks/custom-class-name.native.js.map +1 -1
  186. package/build/hooks/dimensions.js +4 -9
  187. package/build/hooks/dimensions.js.map +1 -1
  188. package/build/hooks/font-family.js +7 -3
  189. package/build/hooks/font-family.js.map +1 -1
  190. package/build/hooks/font-size.js +1 -1
  191. package/build/hooks/font-size.js.map +1 -1
  192. package/build/hooks/index.js +4 -3
  193. package/build/hooks/index.js.map +1 -1
  194. package/build/hooks/index.native.js +5 -3
  195. package/build/hooks/index.native.js.map +1 -1
  196. package/build/hooks/layout.js +10 -4
  197. package/build/hooks/layout.js.map +1 -1
  198. package/build/hooks/style.js +1 -1
  199. package/build/hooks/style.js.map +1 -1
  200. package/build/hooks/typography.js +4 -9
  201. package/build/hooks/typography.js.map +1 -1
  202. package/build/hooks/typography.native.js +43 -18
  203. package/build/hooks/typography.native.js.map +1 -1
  204. package/build/hooks/use-typography-props.js +10 -2
  205. package/build/hooks/use-typography-props.js.map +1 -1
  206. package/build/hooks/utils.js +44 -4
  207. package/build/hooks/utils.js.map +1 -1
  208. package/build/private-apis.js +2 -4
  209. package/build/private-apis.js.map +1 -1
  210. package/build/private-apis.native.js +0 -2
  211. package/build/private-apis.native.js.map +1 -1
  212. package/build/store/actions.js +0 -16
  213. package/build/store/actions.js.map +1 -1
  214. package/build/store/private-actions.js +51 -5
  215. package/build/store/private-actions.js.map +1 -1
  216. package/build/store/private-selectors.js +12 -0
  217. package/build/store/private-selectors.js.map +1 -1
  218. package/build/store/reducer.js +14 -6
  219. package/build/store/reducer.js.map +1 -1
  220. package/build/store/selectors.js +1 -13
  221. package/build/store/selectors.js.map +1 -1
  222. package/build/store/undo-ignore.js +12 -0
  223. package/build/store/undo-ignore.js.map +1 -0
  224. package/build/store/utils.js +1 -1
  225. package/build/store/utils.js.map +1 -1
  226. package/build/utils/get-px-from-css-unit.js +16 -0
  227. package/build/utils/get-px-from-css-unit.js.map +1 -0
  228. package/build/utils/index.js +2 -2
  229. package/build/utils/index.js.map +1 -1
  230. package/build/utils/object.js +0 -38
  231. package/build/utils/object.js.map +1 -1
  232. package/build/utils/use-can-block-toolbar-be-focused.js +46 -0
  233. package/build/utils/use-can-block-toolbar-be-focused.js.map +1 -0
  234. package/build-module/components/block-canvas/index.js +0 -2
  235. package/build-module/components/block-canvas/index.js.map +1 -1
  236. package/build-module/components/block-card/index.js +1 -1
  237. package/build-module/components/block-card/index.js.map +1 -1
  238. package/build-module/components/block-draggable/draggable-chip.js +6 -1
  239. package/build-module/components/block-draggable/draggable-chip.js.map +1 -1
  240. package/build-module/components/block-draggable/index.js +76 -6
  241. package/build-module/components/block-draggable/index.js.map +1 -1
  242. package/build-module/components/block-draggable/index.native.js +1 -7
  243. package/build-module/components/block-draggable/index.native.js.map +1 -1
  244. package/build-module/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
  245. package/build-module/components/block-draggable/use-scroll-when-dragging.native.js.map +1 -1
  246. package/build-module/components/block-editing-mode/index.js +3 -4
  247. package/build-module/components/block-editing-mode/index.js.map +1 -1
  248. package/build-module/components/block-inspector/index.js +1 -1
  249. package/build-module/components/block-inspector/index.js.map +1 -1
  250. package/build-module/components/block-list/block-list-item-cell.native.js +1 -0
  251. package/build-module/components/block-list/block-list-item-cell.native.js.map +1 -1
  252. package/build-module/components/block-list/block.js +249 -106
  253. package/build-module/components/block-list/block.js.map +1 -1
  254. package/build-module/components/block-list/block.native.js +48 -22
  255. package/build-module/components/block-list/block.native.js.map +1 -1
  256. package/build-module/components/block-list/index.native.js +3 -5
  257. package/build-module/components/block-list/index.native.js.map +1 -1
  258. package/build-module/components/block-list/private-block-context.js +6 -0
  259. package/build-module/components/block-list/private-block-context.js.map +1 -0
  260. package/build-module/components/block-list/use-block-props/index.js +34 -97
  261. package/build-module/components/block-list/use-block-props/index.js.map +1 -1
  262. package/build-module/components/block-list/use-in-between-inserter.js +3 -2
  263. package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
  264. package/build-module/components/block-list/use-scroll-upon-insertion.native.js +33 -0
  265. package/build-module/components/block-list/use-scroll-upon-insertion.native.js.map +1 -0
  266. package/build-module/components/block-lock/toolbar.js +16 -28
  267. package/build-module/components/block-lock/toolbar.js.map +1 -1
  268. package/build-module/components/block-mover/index.js +2 -1
  269. package/build-module/components/block-mover/index.js.map +1 -1
  270. package/build-module/components/block-patterns-list/index.js +5 -5
  271. package/build-module/components/block-patterns-list/index.js.map +1 -1
  272. package/build-module/components/block-switcher/index.js +4 -4
  273. package/build-module/components/block-switcher/index.js.map +1 -1
  274. package/build-module/components/block-toolbar/index.js +1 -2
  275. package/build-module/components/block-toolbar/index.js.map +1 -1
  276. package/build-module/components/block-tools/block-toolbar-popover.js +0 -2
  277. package/build-module/components/block-tools/block-toolbar-popover.js.map +1 -1
  278. package/build-module/components/block-variation-transforms/index.js +30 -3
  279. package/build-module/components/block-variation-transforms/index.js.map +1 -1
  280. package/build-module/components/border-radius-control/linked-button.js +1 -1
  281. package/build-module/components/border-radius-control/linked-button.js.map +1 -1
  282. package/build-module/components/colors/utils.js +9 -1
  283. package/build-module/components/colors/utils.js.map +1 -1
  284. package/build-module/components/colors/with-colors.js +5 -1
  285. package/build-module/components/colors/with-colors.js.map +1 -1
  286. package/build-module/components/font-sizes/utils.js +9 -1
  287. package/build-module/components/font-sizes/utils.js.map +1 -1
  288. package/build-module/components/global-styles/border-panel.js +3 -2
  289. package/build-module/components/global-styles/border-panel.js.map +1 -1
  290. package/build-module/components/global-styles/color-panel.js +3 -2
  291. package/build-module/components/global-styles/color-panel.js.map +1 -1
  292. package/build-module/components/global-styles/dimensions-panel.js +5 -4
  293. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  294. package/build-module/components/global-styles/effects-panel.js +3 -2
  295. package/build-module/components/global-styles/effects-panel.js.map +1 -1
  296. package/build-module/components/global-styles/filters-panel.js +2 -5
  297. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  298. package/build-module/components/global-styles/get-global-styles-changes.js +184 -0
  299. package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -0
  300. package/build-module/components/global-styles/hooks.js +1 -1
  301. package/build-module/components/global-styles/hooks.js.map +1 -1
  302. package/build-module/components/global-styles/image-settings-panel.js +7 -1
  303. package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
  304. package/build-module/components/global-styles/index.js +1 -0
  305. package/build-module/components/global-styles/index.js.map +1 -1
  306. package/build-module/components/global-styles/typography-panel.js +3 -2
  307. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  308. package/build-module/components/global-styles/use-global-styles-output.js +15 -1
  309. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  310. package/build-module/components/global-styles/utils.js +7 -0
  311. package/build-module/components/global-styles/utils.js.map +1 -1
  312. package/build-module/components/height-control/index.js +6 -2
  313. package/build-module/components/height-control/index.js.map +1 -1
  314. package/build-module/components/image-size-control/index.js +2 -2
  315. package/build-module/components/image-size-control/index.js.map +1 -1
  316. package/build-module/components/index.native.js +2 -1
  317. package/build-module/components/index.native.js.map +1 -1
  318. package/build-module/components/inner-blocks/index.js +62 -23
  319. package/build-module/components/inner-blocks/index.js.map +1 -1
  320. package/build-module/components/inner-blocks/index.native.js +18 -4
  321. package/build-module/components/inner-blocks/index.native.js.map +1 -1
  322. package/build-module/components/inner-blocks/use-inner-block-template-sync.js +5 -6
  323. package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
  324. package/build-module/components/inner-blocks/use-nested-settings-update.js +6 -10
  325. package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
  326. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
  327. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  328. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +11 -10
  329. package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
  330. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +11 -11
  331. package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
  332. package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js +11 -11
  333. package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
  334. package/build-module/components/inserter/block-patterns-tab/utils.js +7 -11
  335. package/build-module/components/inserter/block-patterns-tab/utils.js.map +1 -1
  336. package/build-module/components/inserter/hooks/use-block-types-state.js +4 -14
  337. package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
  338. package/build-module/components/inserter/hooks/use-patterns-state.js +2 -2
  339. package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
  340. package/build-module/components/inserter/index.js +1 -2
  341. package/build-module/components/inserter/index.js.map +1 -1
  342. package/build-module/components/inserter/library.js +3 -7
  343. package/build-module/components/inserter/library.js.map +1 -1
  344. package/build-module/components/inserter/menu.js +14 -28
  345. package/build-module/components/inserter/menu.js.map +1 -1
  346. package/build-module/components/inserter/tabs.js +22 -22
  347. package/build-module/components/inserter/tabs.js.map +1 -1
  348. package/build-module/components/inserter-draggable-blocks/index.js +2 -2
  349. package/build-module/components/inserter-draggable-blocks/index.js.map +1 -1
  350. package/build-module/components/inserter-list-item/index.js +2 -4
  351. package/build-module/components/inserter-list-item/index.js.map +1 -1
  352. package/build-module/components/inspector-controls/block-support-tools-panel.js +3 -1
  353. package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
  354. package/build-module/components/inspector-controls-tabs/index.js +35 -24
  355. package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
  356. package/build-module/components/list-view/block-select-button.js +4 -0
  357. package/build-module/components/list-view/block-select-button.js.map +1 -1
  358. package/build-module/components/list-view/block.js +58 -4
  359. package/build-module/components/list-view/block.js.map +1 -1
  360. package/build-module/components/media-upload-progress/constants.js +7 -0
  361. package/build-module/components/media-upload-progress/constants.js.map +1 -0
  362. package/build-module/components/media-upload-progress/index.native.js +37 -8
  363. package/build-module/components/media-upload-progress/index.native.js.map +1 -1
  364. package/build-module/components/navigable-toolbar/index.js +9 -14
  365. package/build-module/components/navigable-toolbar/index.js.map +1 -1
  366. package/build-module/components/plain-text/index.native.js +6 -1
  367. package/build-module/components/plain-text/index.native.js.map +1 -1
  368. package/build-module/components/provider/index.js +3 -1
  369. package/build-module/components/provider/index.js.map +1 -1
  370. package/build-module/components/provider/use-block-sync.js +7 -1
  371. package/build-module/components/provider/use-block-sync.js.map +1 -1
  372. package/build-module/components/rich-text/index.js +17 -7
  373. package/build-module/components/rich-text/index.js.map +1 -1
  374. package/build-module/components/rich-text/native/index.native.js +16 -23
  375. package/build-module/components/rich-text/native/index.native.js.map +1 -1
  376. package/build-module/components/rich-text/use-input-rules.js +2 -2
  377. package/build-module/components/rich-text/use-input-rules.js.map +1 -1
  378. package/build-module/components/rich-text/use-mark-persistent.js +1 -1
  379. package/build-module/components/rich-text/use-mark-persistent.js.map +1 -1
  380. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
  381. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  382. package/build-module/components/url-input/index.js +9 -6
  383. package/build-module/components/url-input/index.js.map +1 -1
  384. package/build-module/components/use-block-commands/index.js +14 -18
  385. package/build-module/components/use-block-commands/index.js.map +1 -1
  386. package/build-module/components/use-block-drop-zone/index.js +51 -23
  387. package/build-module/components/use-block-drop-zone/index.js.map +1 -1
  388. package/build-module/components/use-moving-animation/index.js +102 -94
  389. package/build-module/components/use-moving-animation/index.js.map +1 -1
  390. package/build-module/components/use-on-block-drop/index.js +8 -11
  391. package/build-module/components/use-on-block-drop/index.js.map +1 -1
  392. package/build-module/components/writing-flow/index.js +0 -1
  393. package/build-module/components/writing-flow/index.js.map +1 -1
  394. package/build-module/components/writing-flow/use-drag-selection.js +15 -4
  395. package/build-module/components/writing-flow/use-drag-selection.js.map +1 -1
  396. package/build-module/components/writing-flow/use-selection-observer.js +73 -27
  397. package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
  398. package/build-module/components/writing-flow/use-tab-nav.js +7 -4
  399. package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
  400. package/build-module/hooks/align.js +1 -1
  401. package/build-module/hooks/align.js.map +1 -1
  402. package/build-module/hooks/anchor.js +1 -1
  403. package/build-module/hooks/anchor.js.map +1 -1
  404. package/build-module/hooks/aria-label.js +7 -1
  405. package/build-module/hooks/aria-label.js.map +1 -1
  406. package/build-module/hooks/background.js +181 -19
  407. package/build-module/hooks/background.js.map +1 -1
  408. package/build-module/hooks/border.js +2 -8
  409. package/build-module/hooks/border.js.map +1 -1
  410. package/build-module/hooks/color.js +11 -9
  411. package/build-module/hooks/color.js.map +1 -1
  412. package/build-module/hooks/custom-class-name.js +1 -1
  413. package/build-module/hooks/custom-class-name.js.map +1 -1
  414. package/build-module/hooks/custom-class-name.native.js +7 -1
  415. package/build-module/hooks/custom-class-name.native.js.map +1 -1
  416. package/build-module/hooks/dimensions.js +1 -7
  417. package/build-module/hooks/dimensions.js.map +1 -1
  418. package/build-module/hooks/font-family.js +6 -2
  419. package/build-module/hooks/font-family.js.map +1 -1
  420. package/build-module/hooks/font-size.js +1 -1
  421. package/build-module/hooks/font-size.js.map +1 -1
  422. package/build-module/hooks/index.js +5 -4
  423. package/build-module/hooks/index.js.map +1 -1
  424. package/build-module/hooks/index.native.js +6 -4
  425. package/build-module/hooks/index.native.js.map +1 -1
  426. package/build-module/hooks/layout.js +9 -3
  427. package/build-module/hooks/layout.js.map +1 -1
  428. package/build-module/hooks/style.js +1 -1
  429. package/build-module/hooks/style.js.map +1 -1
  430. package/build-module/hooks/typography.js +1 -7
  431. package/build-module/hooks/typography.js.map +1 -1
  432. package/build-module/hooks/typography.native.js +43 -17
  433. package/build-module/hooks/typography.native.js.map +1 -1
  434. package/build-module/hooks/use-typography-props.js +9 -1
  435. package/build-module/hooks/use-typography-props.js.map +1 -1
  436. package/build-module/hooks/utils.js +43 -4
  437. package/build-module/hooks/utils.js.map +1 -1
  438. package/build-module/private-apis.js +2 -4
  439. package/build-module/private-apis.js.map +1 -1
  440. package/build-module/private-apis.native.js +0 -2
  441. package/build-module/private-apis.native.js.map +1 -1
  442. package/build-module/store/actions.js +0 -15
  443. package/build-module/store/actions.js.map +1 -1
  444. package/build-module/store/private-actions.js +49 -4
  445. package/build-module/store/private-actions.js.map +1 -1
  446. package/build-module/store/private-selectors.js +11 -0
  447. package/build-module/store/private-selectors.js.map +1 -1
  448. package/build-module/store/reducer.js +14 -6
  449. package/build-module/store/reducer.js.map +1 -1
  450. package/build-module/store/selectors.js +1 -12
  451. package/build-module/store/selectors.js.map +1 -1
  452. package/build-module/store/undo-ignore.js +5 -0
  453. package/build-module/store/undo-ignore.js.map +1 -0
  454. package/build-module/store/utils.js +2 -2
  455. package/build-module/store/utils.js.map +1 -1
  456. package/build-module/utils/get-px-from-css-unit.js +9 -0
  457. package/build-module/utils/get-px-from-css-unit.js.map +1 -0
  458. package/build-module/utils/index.js +1 -1
  459. package/build-module/utils/index.js.map +1 -1
  460. package/build-module/utils/object.js +0 -37
  461. package/build-module/utils/object.js.map +1 -1
  462. package/build-module/utils/use-can-block-toolbar-be-focused.js +40 -0
  463. package/build-module/utils/use-can-block-toolbar-be-focused.js.map +1 -0
  464. package/build-style/content-rtl.css +7 -6
  465. package/build-style/content.css +7 -6
  466. package/build-style/style-rtl.css +51 -8
  467. package/build-style/style.css +51 -8
  468. package/package.json +31 -31
  469. package/src/components/alignment-control/README.md +0 -5
  470. package/src/components/block-alignment-control/README.md +0 -5
  471. package/src/components/block-alignment-matrix-control/README.md +0 -10
  472. package/src/components/block-breadcrumb/README.md +0 -5
  473. package/src/components/block-canvas/index.js +0 -2
  474. package/src/components/block-canvas/style.scss +6 -0
  475. package/src/components/block-caption/README.md +0 -5
  476. package/src/components/block-card/README.md +0 -5
  477. package/src/components/block-card/index.js +1 -1
  478. package/src/components/block-draggable/draggable-chip.js +11 -1
  479. package/src/components/block-draggable/index.js +116 -4
  480. package/src/components/block-draggable/index.native.js +0 -5
  481. package/src/components/block-draggable/style.scss +35 -0
  482. package/src/components/block-draggable/test/helpers.native.js +8 -7
  483. package/src/components/block-draggable/use-scroll-when-dragging.native.js +1 -1
  484. package/src/components/block-editing-mode/index.js +3 -3
  485. package/src/components/block-icon/README.md +0 -5
  486. package/src/components/block-inspector/README.md +0 -5
  487. package/src/components/block-inspector/index.js +3 -1
  488. package/src/components/block-list/block-list-item-cell.native.js +5 -1
  489. package/src/components/block-list/block.js +290 -119
  490. package/src/components/block-list/block.native.js +55 -21
  491. package/src/components/block-list/content.scss +14 -10
  492. package/src/components/block-list/index.native.js +3 -5
  493. package/src/components/block-list/{block-list-block-context.js → private-block-context.js} +1 -1
  494. package/src/components/block-list/use-block-props/index.js +32 -128
  495. package/src/components/block-list/use-in-between-inserter.js +4 -1
  496. package/src/components/block-list/use-scroll-upon-insertion.native.js +52 -0
  497. package/src/components/block-lock/toolbar.js +15 -34
  498. package/src/components/block-mover/README.md +0 -5
  499. package/src/components/block-mover/index.js +1 -1
  500. package/src/components/block-parent-selector/README.md +0 -5
  501. package/src/components/block-patterns-list/README.md +0 -5
  502. package/src/components/block-patterns-list/index.js +8 -5
  503. package/src/components/block-switcher/index.js +49 -59
  504. package/src/components/block-toolbar/README.md +0 -5
  505. package/src/components/block-toolbar/index.js +1 -2
  506. package/src/components/block-tools/block-toolbar-popover.js +4 -10
  507. package/src/components/block-types-list/README.md +0 -5
  508. package/src/components/block-variation-picker/README.md +0 -5
  509. package/src/components/block-variation-transforms/README.md +0 -5
  510. package/src/components/block-variation-transforms/index.js +49 -3
  511. package/src/components/border-radius-control/linked-button.js +1 -1
  512. package/src/components/caption/README.md +0 -5
  513. package/src/components/color-palette/test/__snapshots__/control.js.snap +0 -1
  514. package/src/components/colors/utils.js +8 -1
  515. package/src/components/colors/with-colors.js +3 -1
  516. package/src/components/contrast-checker/README.md +0 -4
  517. package/src/components/copy-handler/README.md +0 -10
  518. package/src/components/font-sizes/utils.js +7 -1
  519. package/src/components/global-styles/border-panel.js +2 -1
  520. package/src/components/global-styles/color-panel.js +2 -1
  521. package/src/components/global-styles/dimensions-panel.js +4 -3
  522. package/src/components/global-styles/effects-panel.js +2 -1
  523. package/src/components/global-styles/filters-panel.js +2 -5
  524. package/src/components/global-styles/get-global-styles-changes.js +210 -0
  525. package/src/components/global-styles/hooks.js +3 -0
  526. package/src/components/global-styles/image-settings-panel.js +6 -0
  527. package/src/components/global-styles/index.js +1 -0
  528. package/src/components/global-styles/test/get-global-styles-changes.js +234 -0
  529. package/src/components/global-styles/typography-panel.js +2 -1
  530. package/src/components/global-styles/use-global-styles-output.js +9 -5
  531. package/src/components/global-styles/utils.js +7 -0
  532. package/src/components/height-control/README.md +2 -7
  533. package/src/components/height-control/index.js +4 -0
  534. package/src/components/image-size-control/index.js +5 -2
  535. package/src/components/index.native.js +2 -2
  536. package/src/components/inner-blocks/index.js +68 -29
  537. package/src/components/inner-blocks/index.native.js +19 -7
  538. package/src/components/inner-blocks/use-inner-block-template-sync.js +5 -7
  539. package/src/components/inner-blocks/use-nested-settings-update.js +6 -13
  540. package/src/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
  541. package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +15 -15
  542. package/src/components/inserter/block-patterns-tab/patterns-filter.js +15 -13
  543. package/src/components/inserter/block-patterns-tab/use-pattern-categories.js +15 -18
  544. package/src/components/inserter/block-patterns-tab/utils.js +11 -12
  545. package/src/components/inserter/hooks/use-block-types-state.js +9 -11
  546. package/src/components/inserter/hooks/use-patterns-state.js +2 -2
  547. package/src/components/inserter/index.js +0 -1
  548. package/src/components/inserter/library.js +2 -8
  549. package/src/components/inserter/menu.js +13 -31
  550. package/src/components/inserter/style.scss +6 -4
  551. package/src/components/inserter/tabs.js +34 -25
  552. package/src/components/inserter-draggable-blocks/index.js +2 -2
  553. package/src/components/inserter-list-item/index.js +6 -6
  554. package/src/components/inspector-controls/block-support-tools-panel.js +2 -0
  555. package/src/components/inspector-controls-tabs/index.js +39 -28
  556. package/src/components/inspector-controls-tabs/style.scss +3 -2
  557. package/src/components/letter-spacing-control/README.md +0 -5
  558. package/src/components/line-height-control/README.md +0 -5
  559. package/src/components/list-view/README.md +0 -5
  560. package/src/components/list-view/block-select-button.js +4 -0
  561. package/src/components/list-view/block.js +73 -2
  562. package/src/components/list-view/style.scss +6 -0
  563. package/src/components/media-upload-progress/constants.js +6 -0
  564. package/src/components/media-upload-progress/index.native.js +66 -14
  565. package/src/components/media-upload-progress/test/index.native.js +2 -2
  566. package/src/components/multi-selection-inspector/README.md +0 -5
  567. package/src/components/navigable-toolbar/index.js +13 -11
  568. package/src/components/plain-text/index.native.js +6 -1
  569. package/src/components/provider/index.js +1 -1
  570. package/src/components/provider/test/use-block-sync.js +20 -17
  571. package/src/components/provider/use-block-sync.js +6 -0
  572. package/src/components/rich-text/index.js +18 -6
  573. package/src/components/rich-text/native/index.native.js +16 -24
  574. package/src/components/rich-text/native/test/__snapshots__/index.native.js.snap +3 -3
  575. package/src/components/rich-text/native/test/index.native.js +72 -5
  576. package/src/components/rich-text/use-input-rules.js +2 -2
  577. package/src/components/rich-text/use-mark-persistent.js +1 -2
  578. package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
  579. package/src/components/text-decoration-control/README.md +40 -0
  580. package/src/components/text-transform-control/README.md +0 -4
  581. package/src/components/ungroup-button/README.md +0 -5
  582. package/src/components/unit-control/README.md +0 -4
  583. package/src/components/url-input/index.js +11 -11
  584. package/src/components/use-block-commands/index.js +18 -21
  585. package/src/components/use-block-drop-zone/index.js +85 -34
  586. package/src/components/use-moving-animation/index.js +107 -103
  587. package/src/components/use-on-block-drop/index.js +7 -23
  588. package/src/components/use-on-block-drop/test/index.js +12 -26
  589. package/src/components/use-resize-canvas/README.md +0 -4
  590. package/src/components/use-settings/README.md +0 -4
  591. package/src/components/writing-flow/index.js +0 -1
  592. package/src/components/writing-flow/use-drag-selection.js +18 -4
  593. package/src/components/writing-flow/use-selection-observer.js +99 -37
  594. package/src/components/writing-flow/use-tab-nav.js +7 -7
  595. package/src/hooks/align.js +1 -5
  596. package/src/hooks/anchor.js +1 -5
  597. package/src/hooks/aria-label.js +8 -5
  598. package/src/hooks/background.js +253 -21
  599. package/src/hooks/border.js +2 -13
  600. package/src/hooks/color.js +19 -14
  601. package/src/hooks/custom-class-name.js +1 -5
  602. package/src/hooks/custom-class-name.native.js +8 -5
  603. package/src/hooks/dimensions.js +1 -7
  604. package/src/hooks/font-family.js +4 -7
  605. package/src/hooks/font-size.js +1 -6
  606. package/src/hooks/index.js +19 -3
  607. package/src/hooks/index.native.js +17 -4
  608. package/src/hooks/layout.js +5 -2
  609. package/src/hooks/style.js +1 -6
  610. package/src/hooks/test/anchor.js +4 -9
  611. package/src/hooks/test/custom-class-name.js +3 -8
  612. package/src/hooks/test/style.js +4 -14
  613. package/src/hooks/typography.js +1 -7
  614. package/src/hooks/typography.native.js +31 -33
  615. package/src/hooks/use-typography-props.js +7 -1
  616. package/src/hooks/utils.js +60 -2
  617. package/src/private-apis.js +2 -4
  618. package/src/private-apis.native.js +0 -2
  619. package/src/store/actions.js +0 -15
  620. package/src/store/private-actions.js +44 -4
  621. package/src/store/private-selectors.js +11 -0
  622. package/src/store/reducer.js +16 -5
  623. package/src/store/selectors.js +5 -13
  624. package/src/store/undo-ignore.js +4 -0
  625. package/src/store/utils.js +2 -2
  626. package/src/style.scss +1 -0
  627. package/src/utils/get-px-from-css-unit.js +8 -0
  628. package/src/utils/index.js +1 -1
  629. package/src/utils/object.js +0 -35
  630. package/src/utils/test/object.js +1 -96
  631. package/src/utils/use-can-block-toolbar-be-focused.js +48 -0
  632. package/build/components/block-list/block-list-block-context.js +0 -14
  633. package/build/components/block-list/block-list-block-context.js.map +0 -1
  634. package/build/utils/parse-css-unit-to-px.js +0 -302
  635. package/build/utils/parse-css-unit-to-px.js.map +0 -1
  636. package/build/utils/use-should-contextual-toolbar-show.js +0 -63
  637. package/build/utils/use-should-contextual-toolbar-show.js.map +0 -1
  638. package/build-module/components/block-list/block-list-block-context.js +0 -6
  639. package/build-module/components/block-list/block-list-block-context.js.map +0 -1
  640. package/build-module/utils/parse-css-unit-to-px.js +0 -294
  641. package/build-module/utils/parse-css-unit-to-px.js.map +0 -1
  642. package/build-module/utils/use-should-contextual-toolbar-show.js +0 -57
  643. package/build-module/utils/use-should-contextual-toolbar-show.js.map +0 -1
  644. package/src/utils/parse-css-unit-to-px.js +0 -329
  645. package/src/utils/test/parse-css-unit-to-px.js +0 -172
  646. package/src/utils/use-should-contextual-toolbar-show.js +0 -85
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","useEffect","useState","forwardRef","VisuallyHidden","Tooltip","privateApis","componentsPrivateApis","__experimentalHStack","HStack","useInstanceId","__","Icon","symbol","unlock","BlockPreview","InserterDraggableBlocks","BlockPatternsPaging","PATTERN_TYPES","CompositeV2","Composite","CompositeItemV2","CompositeItem","useCompositeStoreV2","useCompositeStore","WithToolTip","showTooltip","title","children","createElement","text","Fragment","BlockPattern","id","isDraggable","pattern","onClick","onHover","isDragging","setIsDragging","blocks","viewportWidth","instanceId","descriptionId","isEnabled","draggable","onDragStart","onDragEnd","className","event","type","user","render","role","description","undefined","syncStatus","onMouseEnter","onMouseLeave","icon","BlockPatternPlaceholder","BlockPatternsList","blockPatterns","shownPatterns","onClickPattern","orientation","label","showTitlesAsTooltip","pagingProps","ref","compositeStore","setActiveId","store","map","isShown","includes","key","name"],"sources":["@wordpress/block-editor/src/components/block-patterns-list/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, useState, forwardRef } from '@wordpress/element';\nimport {\n\tVisuallyHidden,\n\tTooltip,\n\tprivateApis as componentsPrivateApis,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { Icon, symbol } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport BlockPreview from '../block-preview';\nimport InserterDraggableBlocks from '../inserter-draggable-blocks';\nimport BlockPatternsPaging from '../block-patterns-paging';\nimport { PATTERN_TYPES } from '../inserter/block-patterns-tab/utils';\n\nconst {\n\tCompositeV2: Composite,\n\tCompositeItemV2: CompositeItem,\n\tuseCompositeStoreV2: useCompositeStore,\n} = unlock( componentsPrivateApis );\n\nconst WithToolTip = ( { showTooltip, title, children } ) => {\n\tif ( showTooltip ) {\n\t\treturn <Tooltip text={ title }>{ children }</Tooltip>;\n\t}\n\treturn <>{ children }</>;\n};\n\nfunction BlockPattern( {\n\tid,\n\tisDraggable,\n\tpattern,\n\tonClick,\n\tonHover,\n\tshowTooltip,\n} ) {\n\tconst [ isDragging, setIsDragging ] = useState( false );\n\tconst { blocks, viewportWidth } = pattern;\n\tconst instanceId = useInstanceId( BlockPattern );\n\tconst descriptionId = `block-editor-block-patterns-list__item-description-${ instanceId }`;\n\n\treturn (\n\t\t<InserterDraggableBlocks\n\t\t\tisEnabled={ isDraggable }\n\t\t\tblocks={ blocks }\n\t\t\tpattern={ pattern }\n\t\t>\n\t\t\t{ ( { draggable, onDragStart, onDragEnd } ) => (\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"block-editor-block-patterns-list__list-item\"\n\t\t\t\t\tdraggable={ draggable }\n\t\t\t\t\tonDragStart={ ( event ) => {\n\t\t\t\t\t\tsetIsDragging( true );\n\t\t\t\t\t\tif ( onDragStart ) {\n\t\t\t\t\t\t\tonHover?.( null );\n\t\t\t\t\t\t\tonDragStart( event );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\tonDragEnd={ ( event ) => {\n\t\t\t\t\t\tsetIsDragging( false );\n\t\t\t\t\t\tif ( onDragEnd ) {\n\t\t\t\t\t\t\tonDragEnd( event );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<WithToolTip\n\t\t\t\t\t\tshowTooltip={\n\t\t\t\t\t\t\tshowTooltip && ! pattern.type !== PATTERN_TYPES.user\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttitle={ pattern.title }\n\t\t\t\t\t>\n\t\t\t\t\t\t<CompositeItem\n\t\t\t\t\t\t\trender={\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\trole=\"option\"\n\t\t\t\t\t\t\t\t\taria-label={ pattern.title }\n\t\t\t\t\t\t\t\t\taria-describedby={\n\t\t\t\t\t\t\t\t\t\tpattern.description\n\t\t\t\t\t\t\t\t\t\t\t? descriptionId\n\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t\t'block-editor-block-patterns-list__item',\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t'block-editor-block-patterns-list__list-item-synced':\n\t\t\t\t\t\t\t\t\t\t\t\tpattern.type ===\n\t\t\t\t\t\t\t\t\t\t\t\t\tPATTERN_TYPES.user &&\n\t\t\t\t\t\t\t\t\t\t\t\t! pattern.syncStatus,\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}\n\t\t\t\t\t\t\tid={ id }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tonClick( pattern, blocks );\n\t\t\t\t\t\t\t\tonHover?.( null );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonMouseEnter={ () => {\n\t\t\t\t\t\t\t\tif ( isDragging ) {\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonHover?.( pattern );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonMouseLeave={ () => onHover?.( null ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockPreview\n\t\t\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\t\t\tviewportWidth={ viewportWidth }\n\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t<HStack className=\"block-editor-patterns__pattern-details\">\n\t\t\t\t\t\t\t\t{ pattern.type === PATTERN_TYPES.user &&\n\t\t\t\t\t\t\t\t\t! pattern.syncStatus && (\n\t\t\t\t\t\t\t\t\t\t<div className=\"block-editor-patterns__pattern-icon-wrapper\">\n\t\t\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-patterns__pattern-icon\"\n\t\t\t\t\t\t\t\t\t\t\t\ticon={ symbol }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ ( ! showTooltip ||\n\t\t\t\t\t\t\t\t\tpattern.type === PATTERN_TYPES.user ) && (\n\t\t\t\t\t\t\t\t\t<div className=\"block-editor-block-patterns-list__item-title\">\n\t\t\t\t\t\t\t\t\t\t{ pattern.title }\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</HStack>\n\n\t\t\t\t\t\t\t{ !! pattern.description && (\n\t\t\t\t\t\t\t\t<VisuallyHidden id={ descriptionId }>\n\t\t\t\t\t\t\t\t\t{ pattern.description }\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</CompositeItem>\n\t\t\t\t\t</WithToolTip>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</InserterDraggableBlocks>\n\t);\n}\n\nfunction BlockPatternPlaceholder() {\n\treturn (\n\t\t<div className=\"block-editor-block-patterns-list__item is-placeholder\" />\n\t);\n}\n\nfunction BlockPatternsList(\n\t{\n\t\tisDraggable,\n\t\tblockPatterns,\n\t\tshownPatterns,\n\t\tonHover,\n\t\tonClickPattern,\n\t\torientation,\n\t\tlabel = __( 'Block patterns' ),\n\t\tshowTitlesAsTooltip,\n\t\tpagingProps,\n\t},\n\tref\n) {\n\tconst compositeStore = useCompositeStore( { orientation } );\n\tconst { setActiveId } = compositeStore;\n\n\tuseEffect( () => {\n\t\t// We reset the active composite item whenever the\n\t\t// available patterns change, to make sure that\n\t\t// focus is put back to the start.\n\t\tsetActiveId( undefined );\n\t}, [ setActiveId, shownPatterns, blockPatterns ] );\n\n\treturn (\n\t\t<Composite\n\t\t\tstore={ compositeStore }\n\t\t\trole=\"listbox\"\n\t\t\tclassName=\"block-editor-block-patterns-list\"\n\t\t\taria-label={ label }\n\t\t\tref={ ref }\n\t\t>\n\t\t\t{ blockPatterns.map( ( pattern ) => {\n\t\t\t\tconst isShown = shownPatterns.includes( pattern );\n\t\t\t\treturn isShown ? (\n\t\t\t\t\t<BlockPattern\n\t\t\t\t\t\tkey={ pattern.name }\n\t\t\t\t\t\tid={ pattern.name }\n\t\t\t\t\t\tpattern={ pattern }\n\t\t\t\t\t\tonClick={ onClickPattern }\n\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\tisDraggable={ isDraggable }\n\t\t\t\t\t\tshowTooltip={ showTitlesAsTooltip }\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<BlockPatternPlaceholder key={ pattern.name } />\n\t\t\t\t);\n\t\t\t} ) }\n\t\t\t{ pagingProps && <BlockPatternsPaging { ...pagingProps } /> }\n\t\t</Composite>\n\t);\n}\n\nexport default forwardRef( BlockPatternsList );\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,SAAS,EAAEC,QAAQ,EAAEC,UAAU,QAAQ,oBAAoB;AACpE,SACCC,cAAc,EACdC,OAAO,EACPC,WAAW,IAAIC,qBAAqB,EACpCC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,aAAa,QAAQ,oBAAoB;AA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AC,SAAS;IACdL,SAAS,EAAC,kCAAkC;IAC5C,cAAakB,KAAO;IACpBG,GAAG,EAAGA;EAAK,GAETP,aAAa,CAACW,GAAG,CAAItC,OAAO,IAAM;IACnC,MAAMuC,OAAO,GAAGX,aAAa,CAACY,QAAQ,CAAExC,OAAQ,CAAC;IACjD,OAAOuC,OAAO,GACb7C,aAAA,CAACG,YAAY;MACZ4C,GAAG,EAAGzC,OAAO,CAAC0C,IAAM;MACpB5C,EAAE,EAAGE,OAAO,CAAC0C,IAAM;MACnB1C,OAAO,EAAGA,OAAS;MACnBC,OAAO,EAAG4B,cAAgB;MAC1B3B,OAAO,EAAGA,OAAS;MACnBH,WAAW,EAAGA,WAAa;MAC3BR,WAAW,EAAGyC;IAAqB,CACnC,CAAC,GAEFtC,aAAA,CAAC+B,uBAAuB;MAACgB,GAAG,EAAGzC,OAAO,CAAC0C;IAAM,CAAE,CAC/C;EACF,CAAE,CAAC,EACDT,WAAW,IAAIvC,aAAA,CAACZ,mBAAmB;IAAA,GAAMmD;EAAW,CAAI,CAChD,CAAC;AAEd;AAEA,eAAejE,UAAU,CAAE0D,iBAAkB,CAAC"}
1
+ {"version":3,"names":["classnames","useEffect","useState","forwardRef","VisuallyHidden","Tooltip","privateApis","componentsPrivateApis","__experimentalHStack","HStack","useInstanceId","__","Icon","symbol","unlock","BlockPreview","InserterDraggableBlocks","BlockPatternsPaging","INSERTER_PATTERN_TYPES","CompositeV2","Composite","CompositeItemV2","CompositeItem","useCompositeStoreV2","useCompositeStore","WithToolTip","showTooltip","title","children","createElement","text","Fragment","BlockPattern","id","isDraggable","pattern","onClick","onHover","isDragging","setIsDragging","blocks","viewportWidth","instanceId","descriptionId","isEnabled","draggable","onDragStart","onDragEnd","className","event","type","user","render","role","description","undefined","syncStatus","onMouseEnter","onMouseLeave","icon","BlockPatternPlaceholder","BlockPatternsList","blockPatterns","shownPatterns","onClickPattern","orientation","label","showTitlesAsTooltip","pagingProps","ref","compositeStore","setActiveId","store","map","isShown","includes","key","name"],"sources":["@wordpress/block-editor/src/components/block-patterns-list/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, useState, forwardRef } from '@wordpress/element';\nimport {\n\tVisuallyHidden,\n\tTooltip,\n\tprivateApis as componentsPrivateApis,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { Icon, symbol } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport BlockPreview from '../block-preview';\nimport InserterDraggableBlocks from '../inserter-draggable-blocks';\nimport BlockPatternsPaging from '../block-patterns-paging';\nimport { INSERTER_PATTERN_TYPES } from '../inserter/block-patterns-tab/utils';\n\nconst {\n\tCompositeV2: Composite,\n\tCompositeItemV2: CompositeItem,\n\tuseCompositeStoreV2: useCompositeStore,\n} = unlock( componentsPrivateApis );\n\nconst WithToolTip = ( { showTooltip, title, children } ) => {\n\tif ( showTooltip ) {\n\t\treturn <Tooltip text={ title }>{ children }</Tooltip>;\n\t}\n\treturn <>{ children }</>;\n};\n\nfunction BlockPattern( {\n\tid,\n\tisDraggable,\n\tpattern,\n\tonClick,\n\tonHover,\n\tshowTooltip,\n} ) {\n\tconst [ isDragging, setIsDragging ] = useState( false );\n\tconst { blocks, viewportWidth } = pattern;\n\tconst instanceId = useInstanceId( BlockPattern );\n\tconst descriptionId = `block-editor-block-patterns-list__item-description-${ instanceId }`;\n\n\treturn (\n\t\t<InserterDraggableBlocks\n\t\t\tisEnabled={ isDraggable }\n\t\t\tblocks={ blocks }\n\t\t\tpattern={ pattern }\n\t\t>\n\t\t\t{ ( { draggable, onDragStart, onDragEnd } ) => (\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"block-editor-block-patterns-list__list-item\"\n\t\t\t\t\tdraggable={ draggable }\n\t\t\t\t\tonDragStart={ ( event ) => {\n\t\t\t\t\t\tsetIsDragging( true );\n\t\t\t\t\t\tif ( onDragStart ) {\n\t\t\t\t\t\t\tonHover?.( null );\n\t\t\t\t\t\t\tonDragStart( event );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\tonDragEnd={ ( event ) => {\n\t\t\t\t\t\tsetIsDragging( false );\n\t\t\t\t\t\tif ( onDragEnd ) {\n\t\t\t\t\t\t\tonDragEnd( event );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<WithToolTip\n\t\t\t\t\t\tshowTooltip={\n\t\t\t\t\t\t\tshowTooltip &&\n\t\t\t\t\t\t\t! pattern.type !== INSERTER_PATTERN_TYPES.user\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttitle={ pattern.title }\n\t\t\t\t\t>\n\t\t\t\t\t\t<CompositeItem\n\t\t\t\t\t\t\trender={\n\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\trole=\"option\"\n\t\t\t\t\t\t\t\t\taria-label={ pattern.title }\n\t\t\t\t\t\t\t\t\taria-describedby={\n\t\t\t\t\t\t\t\t\t\tpattern.description\n\t\t\t\t\t\t\t\t\t\t\t? descriptionId\n\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t\t'block-editor-block-patterns-list__item',\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t'block-editor-block-patterns-list__list-item-synced':\n\t\t\t\t\t\t\t\t\t\t\t\tpattern.type ===\n\t\t\t\t\t\t\t\t\t\t\t\t\tINSERTER_PATTERN_TYPES.user &&\n\t\t\t\t\t\t\t\t\t\t\t\t! pattern.syncStatus,\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}\n\t\t\t\t\t\t\tid={ id }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tonClick( pattern, blocks );\n\t\t\t\t\t\t\t\tonHover?.( null );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonMouseEnter={ () => {\n\t\t\t\t\t\t\t\tif ( isDragging ) {\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonHover?.( pattern );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonMouseLeave={ () => onHover?.( null ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<BlockPreview\n\t\t\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\t\t\tviewportWidth={ viewportWidth }\n\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t<HStack className=\"block-editor-patterns__pattern-details\">\n\t\t\t\t\t\t\t\t{ pattern.type ===\n\t\t\t\t\t\t\t\t\tINSERTER_PATTERN_TYPES.user &&\n\t\t\t\t\t\t\t\t\t! pattern.syncStatus && (\n\t\t\t\t\t\t\t\t\t\t<div className=\"block-editor-patterns__pattern-icon-wrapper\">\n\t\t\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-patterns__pattern-icon\"\n\t\t\t\t\t\t\t\t\t\t\t\ticon={ symbol }\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ ( ! showTooltip ||\n\t\t\t\t\t\t\t\t\tpattern.type ===\n\t\t\t\t\t\t\t\t\t\tINSERTER_PATTERN_TYPES.user ) && (\n\t\t\t\t\t\t\t\t\t<div className=\"block-editor-block-patterns-list__item-title\">\n\t\t\t\t\t\t\t\t\t\t{ pattern.title }\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</HStack>\n\n\t\t\t\t\t\t\t{ !! pattern.description && (\n\t\t\t\t\t\t\t\t<VisuallyHidden id={ descriptionId }>\n\t\t\t\t\t\t\t\t\t{ pattern.description }\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</CompositeItem>\n\t\t\t\t\t</WithToolTip>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</InserterDraggableBlocks>\n\t);\n}\n\nfunction BlockPatternPlaceholder() {\n\treturn (\n\t\t<div className=\"block-editor-block-patterns-list__item is-placeholder\" />\n\t);\n}\n\nfunction BlockPatternsList(\n\t{\n\t\tisDraggable,\n\t\tblockPatterns,\n\t\tshownPatterns,\n\t\tonHover,\n\t\tonClickPattern,\n\t\torientation,\n\t\tlabel = __( 'Block patterns' ),\n\t\tshowTitlesAsTooltip,\n\t\tpagingProps,\n\t},\n\tref\n) {\n\tconst compositeStore = useCompositeStore( { orientation } );\n\tconst { setActiveId } = compositeStore;\n\n\tuseEffect( () => {\n\t\t// We reset the active composite item whenever the\n\t\t// available patterns change, to make sure that\n\t\t// focus is put back to the start.\n\t\tsetActiveId( undefined );\n\t}, [ setActiveId, shownPatterns, blockPatterns ] );\n\n\treturn (\n\t\t<Composite\n\t\t\tstore={ compositeStore }\n\t\t\trole=\"listbox\"\n\t\t\tclassName=\"block-editor-block-patterns-list\"\n\t\t\taria-label={ label }\n\t\t\tref={ ref }\n\t\t>\n\t\t\t{ blockPatterns.map( ( pattern ) => {\n\t\t\t\tconst isShown = shownPatterns.includes( pattern );\n\t\t\t\treturn isShown ? (\n\t\t\t\t\t<BlockPattern\n\t\t\t\t\t\tkey={ pattern.name }\n\t\t\t\t\t\tid={ pattern.name }\n\t\t\t\t\t\tpattern={ pattern }\n\t\t\t\t\t\tonClick={ onClickPattern }\n\t\t\t\t\t\tonHover={ onHover }\n\t\t\t\t\t\tisDraggable={ isDraggable }\n\t\t\t\t\t\tshowTooltip={ showTitlesAsTooltip }\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<BlockPatternPlaceholder key={ pattern.name } />\n\t\t\t\t);\n\t\t\t} ) }\n\t\t\t{ pagingProps && <BlockPatternsPaging { ...pagingProps } /> }\n\t\t</Composite>\n\t);\n}\n\nexport default forwardRef( BlockPatternsList );\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,SAAS,EAAEC,QAAQ,EAAEC,UAAU,QAAQ,oBAAoB;AACpE,SACCC,cAAc,EACdC,OAAO,EACPC,WAAW,IAAIC,qBAAqB,EACpCC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,IAAI,EAAEC,MAAM,QAAQ,kBAAkB;;AAE/C;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,uBAAuB,MAAM,8BAA8B;AAClE,OAAOC,mBAAmB,MAAM,0BAA0B;AAC1D,SAASC,sBAAsB,QAAQ,sCAAsC;AAE7E,MAAM;EACLC,WAAW,EAAEC,SAAS;EACtBC,eAAe,EAAEC,aAAa;EAC9BC,mBAAmB,EAAEC;AACtB,CAAC,GAAGV,MAAM,CAAEP,qBAAsB,CAAC;AAEnC,MAAMkB,WAAW,GAAGA,CAAE;EAAEC,WAAW;EAAEC,KAAK;EAAEC;AAAS,CAAC,KAAM;EAC3D,IAAKF,WAAW,EAAG;IAClB,OAAOG,aAAA,CAACxB,OAAO;MAACyB,IAAI,EAAGH;IAAO,GAAGC,QAAmB,CAAC;EACtD;EACA,OAAOC,aAAA,CAAAE,QAAA,QAAIH,QAAY,CAAC;AACzB,CAAC;AAED,SAASI,YAAYA,CAAE;EACtBC,EAAE;EACFC,WAAW;EACXC,OAAO;EACPC,OAAO;EACPC,OAAO;EACPX;AACD,CAAC,EAAG;EACH,MA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lockTransformations = !!possibleBlockTransformations.length && canRemove && !isTemplate;
117
117
  const hasPossibleBlockVariationTransformations = !!blockVariationTransformations?.length;
118
118
  const hasPatternTransformation = !!patterns?.length && canRemove;
119
- if (!hasBlockStyles && !hasPossibleBlockTransformations && !hasPossibleBlockVariationTransformations) {
119
+ const hasBlockOrBlockVariationTransforms = hasPossibleBlockTransformations || hasPossibleBlockVariationTransformations;
120
+ const showDropdown = hasBlockStyles || hasBlockOrBlockVariationTransforms || hasPatternTransformation;
121
+ if (!showDropdown) {
120
122
  return createElement(ToolbarGroup, null, createElement(ToolbarButton, {
121
123
  disabled: true,
122
124
  className: "block-editor-block-switcher__no-switcher-icon",
@@ -132,8 +134,6 @@ export const BlockSwitcherDropdownMenu = ({
132
134
  const blockSwitcherLabel = isSingleBlock ? blockTitle : __('Multiple blocks selected');
133
135
  const blockSwitcherDescription = isSingleBlock ? __('Change block type or style') : sprintf( /* translators: %d: number of blocks. */
134
136
  _n('Change type of %d block', 'Change type of %d blocks', blocks.length), blocks.length);
135
- const hasBlockOrBlockVariationTransforms = hasPossibleBlockTransformations || hasPossibleBlockVariationTransformations;
136
- const showDropDown = hasBlockStyles || hasBlockOrBlockVariationTransforms || hasPatternTransformation;
137
137
  return createElement(ToolbarGroup, null, createElement(ToolbarItem, null, toggleProps => createElement(DropdownMenu, {
138
138
  className: "block-editor-block-switcher",
139
139
  label: blockSwitcherLabel,
@@ -157,7 +157,7 @@ export const BlockSwitcherDropdownMenu = ({
157
157
  }
158
158
  }, ({
159
159
  onClose
160
- }) => showDropDown && createElement("div", {
160
+ }) => createElement("div", {
161
161
  className: "block-editor-block-switcher__container"
162
162
  }, hasPatternTransformation && createElement(PatternTransformationsMenu, {
163
163
  blocks: blocks,
@@ -1 +1 @@
1
- {"version":3,"names":["__","_n","sprintf","DropdownMenu","ToolbarButton","ToolbarGroup","ToolbarItem","switchToBlockType","store","blocksStore","isReusableBlock","isTemplatePart","useSelect","useDispatch","copy","blockEditorStore","useBlockDisplayInformation","BlockIcon","BlockTransformationsMenu","useBlockVariationTransforms","BlockStylesMenu","PatternTransformationsMenu","useBlockDisplayTitle","BlockSwitcherDropdownMenu","clientIds","blocks","replaceBlocks","multiSelect","updateBlockAttributes","blockInformation","clientId","possibleBlockTransformations","canRemove","hasBlockStyles","icon","patterns","select","getBlockRootClientId","getBlockTransformItems","__experimentalGetPatternTransformItems","canRemoveBlocks","getBlockStyles","getBlockType","rootClientId","Array","isArray","name","firstBlockName","_isSingleBlockSelected","length","styles","_icon","isSelectionOfSameType","Set","map","size","blockVariationTransformations","blockTitle","maximumLength","isSingleBlock","isReusable","isTemplate","selectForMultipleBlocks","insertedBlocks","onBlockTransform","newBlocks","onBlockVariationTransform","find","variationName","attributes","onPatternTransform","transformedBlocks","hasPossibleBlockTransformations","hasPossibleBlockVariationTransformations","hasPatternTransformation","createElement","disabled","className","title","Fragment","showColors","blockSwitcherLabel","blockSwitcherDescription","hasBlockOrBlockVariationTransforms","showDropDown","toggleProps","label","popoverProps","placement","describedBy","menuProps","orientation","onClose","onSelect","possibleBlockVariationTransformations","onSelectVariation","hoveredBlock","onSwitch","BlockSwitcher","getBlocksByClientId","some","block"],"sources":["@wordpress/block-editor/src/components/block-switcher/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport {\n\tDropdownMenu,\n\tToolbarButton,\n\tToolbarGroup,\n\tToolbarItem,\n} from '@wordpress/components';\nimport {\n\tswitchToBlockType,\n\tstore as blocksStore,\n\tisReusableBlock,\n\tisTemplatePart,\n} from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { copy } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport BlockIcon from '../block-icon';\nimport BlockTransformationsMenu from './block-transformations-menu';\nimport { useBlockVariationTransforms } from './block-variation-transformations';\nimport BlockStylesMenu from './block-styles-menu';\nimport PatternTransformationsMenu from './pattern-transformations-menu';\nimport useBlockDisplayTitle from '../block-title/use-block-display-title';\n\nexport const BlockSwitcherDropdownMenu = ( { clientIds, blocks } ) => {\n\tconst { replaceBlocks, multiSelect, updateBlockAttributes } =\n\t\tuseDispatch( blockEditorStore );\n\tconst blockInformation = useBlockDisplayInformation( blocks[ 0 ].clientId );\n\tconst {\n\t\tpossibleBlockTransformations,\n\t\tcanRemove,\n\t\thasBlockStyles,\n\t\ticon,\n\t\tpatterns,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetBlockTransformItems,\n\t\t\t\t__experimentalGetPatternTransformItems,\n\t\t\t\tcanRemoveBlocks,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst { getBlockStyles, getBlockType } = select( blocksStore );\n\t\t\tconst rootClientId = getBlockRootClientId(\n\t\t\t\tArray.isArray( clientIds ) ? clientIds[ 0 ] : clientIds\n\t\t\t);\n\t\t\tconst [ { name: firstBlockName } ] = blocks;\n\t\t\tconst _isSingleBlockSelected = blocks.length === 1;\n\t\t\tconst styles =\n\t\t\t\t_isSingleBlockSelected && getBlockStyles( firstBlockName );\n\t\t\tlet _icon;\n\t\t\tif ( _isSingleBlockSelected ) {\n\t\t\t\t_icon = blockInformation?.icon; // Take into account active block variations.\n\t\t\t} else {\n\t\t\t\tconst isSelectionOfSameType =\n\t\t\t\t\tnew Set( blocks.map( ( { name } ) => name ) ).size === 1;\n\t\t\t\t// When selection consists of blocks of multiple types, display an\n\t\t\t\t// appropriate icon to communicate the non-uniformity.\n\t\t\t\t_icon = isSelectionOfSameType\n\t\t\t\t\t? getBlockType( firstBlockName )?.icon\n\t\t\t\t\t: copy;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tpossibleBlockTransformations: getBlockTransformItems(\n\t\t\t\t\tblocks,\n\t\t\t\t\trootClientId\n\t\t\t\t),\n\t\t\t\tcanRemove: canRemoveBlocks( clientIds, rootClientId ),\n\t\t\t\thasBlockStyles: !! styles?.length,\n\t\t\t\ticon: _icon,\n\t\t\t\tpatterns: __experimentalGetPatternTransformItems(\n\t\t\t\t\tblocks,\n\t\t\t\t\trootClientId\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ clientIds, blocks, blockInformation?.icon ]\n\t);\n\n\tconst blockVariationTransformations = useBlockVariationTransforms( {\n\t\tclientIds,\n\t\tblocks,\n\t} );\n\n\tconst blockTitle = useBlockDisplayTitle( {\n\t\tclientId: Array.isArray( clientIds ) ? clientIds[ 0 ] : clientIds,\n\t\tmaximumLength: 35,\n\t} );\n\n\tconst isSingleBlock = blocks.length === 1;\n\tconst isReusable = isSingleBlock && isReusableBlock( blocks[ 0 ] );\n\tconst isTemplate = isSingleBlock && isTemplatePart( blocks[ 0 ] );\n\n\tfunction selectForMultipleBlocks( insertedBlocks ) {\n\t\tif ( insertedBlocks.length > 1 ) {\n\t\t\tmultiSelect(\n\t\t\t\tinsertedBlocks[ 0 ].clientId,\n\t\t\t\tinsertedBlocks[ insertedBlocks.length - 1 ].clientId\n\t\t\t);\n\t\t}\n\t}\n\n\t// Simple block tranformation based on the `Block Transforms` API.\n\tfunction onBlockTransform( name ) {\n\t\tconst newBlocks = switchToBlockType( blocks, name );\n\t\treplaceBlocks( clientIds, newBlocks );\n\t\tselectForMultipleBlocks( newBlocks );\n\t}\n\n\tfunction onBlockVariationTransform( name ) {\n\t\tupdateBlockAttributes( blocks[ 0 ].clientId, {\n\t\t\t...blockVariationTransformations.find(\n\t\t\t\t( { name: variationName } ) => variationName === name\n\t\t\t).attributes,\n\t\t} );\n\t}\n\n\t// Pattern transformation through the `Patterns` API.\n\tfunction onPatternTransform( transformedBlocks ) {\n\t\treplaceBlocks( clientIds, transformedBlocks );\n\t\tselectForMultipleBlocks( transformedBlocks );\n\t}\n\n\t/**\n\t * The `isTemplate` check is a stopgap solution here.\n\t * Ideally, the Transforms API should handle this\n\t * by allowing to exclude blocks from wildcard transformations.\n\t */\n\tconst hasPossibleBlockTransformations =\n\t\t!! possibleBlockTransformations.length && canRemove && ! isTemplate;\n\tconst hasPossibleBlockVariationTransformations =\n\t\t!! blockVariationTransformations?.length;\n\tconst hasPatternTransformation = !! patterns?.length && canRemove;\n\tif (\n\t\t! hasBlockStyles &&\n\t\t! hasPossibleBlockTransformations &&\n\t\t! hasPossibleBlockVariationTransformations\n\t) {\n\t\treturn (\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tdisabled\n\t\t\t\t\tclassName=\"block-editor-block-switcher__no-switcher-icon\"\n\t\t\t\t\ttitle={ blockTitle }\n\t\t\t\t\ticon={\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<BlockIcon icon={ icon } showColors />\n\t\t\t\t\t\t\t{ ( isReusable || isTemplate ) && (\n\t\t\t\t\t\t\t\t<span className=\"block-editor-block-switcher__toggle-text\">\n\t\t\t\t\t\t\t\t\t{ blockTitle }\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</ToolbarGroup>\n\t\t);\n\t}\n\n\tconst blockSwitcherLabel = isSingleBlock\n\t\t? blockTitle\n\t\t: __( 'Multiple blocks selected' );\n\n\tconst blockSwitcherDescription = isSingleBlock\n\t\t? __( 'Change block type or style' )\n\t\t: sprintf(\n\t\t\t\t/* translators: %d: number of blocks. */\n\t\t\t\t_n(\n\t\t\t\t\t'Change type of %d block',\n\t\t\t\t\t'Change type of %d blocks',\n\t\t\t\t\tblocks.length\n\t\t\t\t),\n\t\t\t\tblocks.length\n\t\t );\n\n\tconst hasBlockOrBlockVariationTransforms =\n\t\thasPossibleBlockTransformations ||\n\t\thasPossibleBlockVariationTransformations;\n\tconst showDropDown =\n\t\thasBlockStyles ||\n\t\thasBlockOrBlockVariationTransforms ||\n\t\thasPatternTransformation;\n\treturn (\n\t\t<ToolbarGroup>\n\t\t\t<ToolbarItem>\n\t\t\t\t{ ( toggleProps ) => (\n\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\tclassName=\"block-editor-block-switcher\"\n\t\t\t\t\t\tlabel={ blockSwitcherLabel }\n\t\t\t\t\t\tpopoverProps={ {\n\t\t\t\t\t\t\tplacement: 'bottom-start',\n\t\t\t\t\t\t\tclassName: 'block-editor-block-switcher__popover',\n\t\t\t\t\t\t} }\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<BlockIcon\n\t\t\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\t\t\tclassName=\"block-editor-block-switcher__toggle\"\n\t\t\t\t\t\t\t\t\tshowColors\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t{ ( isReusable || isTemplate ) && (\n\t\t\t\t\t\t\t\t\t<span className=\"block-editor-block-switcher__toggle-text\">\n\t\t\t\t\t\t\t\t\t\t{ blockTitle }\n\t\t\t\t\t\t\t\t\t</span>\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\ttoggleProps={ {\n\t\t\t\t\t\t\tdescribedBy: blockSwitcherDescription,\n\t\t\t\t\t\t\t...toggleProps,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tmenuProps={ { orientation: 'both' } }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ( { onClose } ) =>\n\t\t\t\t\t\t\tshowDropDown && (\n\t\t\t\t\t\t\t\t<div className=\"block-editor-block-switcher__container\">\n\t\t\t\t\t\t\t\t\t{ hasPatternTransformation && (\n\t\t\t\t\t\t\t\t\t\t<PatternTransformationsMenu\n\t\t\t\t\t\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\t\t\t\t\t\tpatterns={ patterns }\n\t\t\t\t\t\t\t\t\t\t\tonSelect={ (\n\t\t\t\t\t\t\t\t\t\t\t\ttransformedBlocks\n\t\t\t\t\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\t\t\t\t\tonPatternTransform(\n\t\t\t\t\t\t\t\t\t\t\t\t\ttransformedBlocks\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t\t} }\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\t{ hasBlockOrBlockVariationTransforms && (\n\t\t\t\t\t\t\t\t\t\t<BlockTransformationsMenu\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-block-switcher__transforms__menugroup\"\n\t\t\t\t\t\t\t\t\t\t\tpossibleBlockTransformations={\n\t\t\t\t\t\t\t\t\t\t\t\tpossibleBlockTransformations\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tpossibleBlockVariationTransformations={\n\t\t\t\t\t\t\t\t\t\t\t\tblockVariationTransformations\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\t\t\t\t\t\tonSelect={ ( name ) => {\n\t\t\t\t\t\t\t\t\t\t\t\tonBlockTransform( name );\n\t\t\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\tonSelectVariation={ ( name ) => {\n\t\t\t\t\t\t\t\t\t\t\t\tonBlockVariationTransform(\n\t\t\t\t\t\t\t\t\t\t\t\t\tname\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t\t} }\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\t{ hasBlockStyles && (\n\t\t\t\t\t\t\t\t\t\t<BlockStylesMenu\n\t\t\t\t\t\t\t\t\t\t\thoveredBlock={ blocks[ 0 ] }\n\t\t\t\t\t\t\t\t\t\t\tonSwitch={ onClose }\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</div>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t</DropdownMenu>\n\t\t\t\t) }\n\t\t\t</ToolbarItem>\n\t\t</ToolbarGroup>\n\t);\n};\n\nexport const BlockSwitcher = ( { clientIds } ) => {\n\tconst blocks = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getBlocksByClientId( clientIds ),\n\t\t[ clientIds ]\n\t);\n\n\tif ( ! blocks.length || blocks.some( ( block ) => ! block ) ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockSwitcherDropdownMenu clientIds={ clientIds } blocks={ blocks } />\n\t);\n};\n\nexport default BlockSwitcher;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACjD,SACCC,YAAY,EACZC,aAAa,EACbC,YAAY,EACZC,WAAW,QACL,uBAAuB;AAC9B,SACCC,iBAAiB,EACjBC,KAAK,IAAIC,WAAW,EACpBC,eAAe,EACfC,cAAc,QACR,mBAAmB;AAC1B,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,IAAI,QAAQ,kBAAkB;;AAEvC;AACA;AACA;AACA,SAASN,KAAK,IAAIO,gBAAgB,QAAQ,aAAa;AACvD,OAAOC,0BAA0B,MAAM,kCAAkC;AACzE,OAAOC,SAAS,MAAM,eAAe;AACrC,OAAOC,wBAAwB,MAAM,8BAA8B;AACnE,SAASC,2BAA2B,QAAQ,mCAAmC;AAC/E,OAAOC,eAAe,MAAM,qBAAqB;AACjD,OAAOC,0BAA0B,MAAM,gCAAgC;AACvE,OAAOC,oBAAoB,MAAM,wCAAwC;AAEzE,OAAO,MAAMC,yBAAyB,GAAGA,CAAE;EAAEC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B,OAAO,CAAC,CAAC;IACV;EAAG,CACH,CACD,EACCT,kCAAkC,IACnCR,aAAA,CAACzD,wBAAwB;IACxB2D,SAAS,EAAC,oDAAoD;IAC9D9C,4BAA4B,EAC3BA,4BACA;IACD+D,qCAAqC,EACpCtC,6BACA;IACD/B,MAAM,EAAGA,MAAQ;IACjBoE,QAAQ,EAAK/C,IAAI,IAAM;MACtBkB,gBAAgB,CAAElB,IAAK,CAAC;MACxB8C,OAAO,CAAC,CAAC;IACV,CAAG;IACHG,iBAAiB,EAAKjD,IAAI,IAAM;MAC/BoB,yBAAyB,CACxBpB,IACD,CAAC;MACD8C,OAAO,CAAC,CAAC;IACV;EAAG,CACH,CACD,EACC3D,cAAc,IACf0C,aAAA,CAACvD,eAAe;IACf4E,YAAY,EAAGvE,MAAM,CAAE,CAAC,CAAI;IAC5BwE,QAAQ,EAAGL;EAAS,CACpB,CAEE,CAGM,CAEH,CACA,CAAC;AAEjB,CAAC;AAED,OAAO,MAAMM,aAAa,GAAGA,CAAE;EAAE1E;AAAU,CAAC,KAAM;EACjD,MAAMC,MAAM,GAAGb,SAAS,CACrBwB,MAAM,IACPA,MAAM,CAAErB,gBAAiB,CAAC,CAACoF,mBAAmB,CAAE3E,SAAU,CAAC,EAC5D,CAAEA,SAAS,CACZ,CAAC;EAED,IAAK,CAAEC,MAAM,CAACwB,MAAM,IAAIxB,MAAM,CAAC2E,IAAI,CAAIC,KAAK,IAAM,CAAEA,KAAM,CAAC,EAAG;IAC7D,OAAO,IAAI;EACZ;EAEA,OACC1B,aAAA,CAACpD,yBAAyB;IAACC,SAAS,EAAGA,SAAW;IAACC,MAAM,EAAGA;EAAQ,CAAE,CAAC;AAEzE,CAAC;AAED,eAAeyE,aAAa"}
1
+ {"version":3,"names":["__","_n","sprintf","DropdownMenu","ToolbarButton","ToolbarGroup","ToolbarItem","switchToBlockType","store","blocksStore","isReusableBlock","isTemplatePart","useSelect","useDispatch","copy","blockEditorStore","useBlockDisplayInformation","BlockIcon","BlockTransformationsMenu","useBlockVariationTransforms","BlockStylesMenu","PatternTransformationsMenu","useBlockDisplayTitle","BlockSwitcherDropdownMenu","clientIds","blocks","replaceBlocks","multiSelect","updateBlockAttributes","blockInformation","clientId","possibleBlockTransformations","canRemove","hasBlockStyles","icon","patterns","select","getBlockRootClientId","getBlockTransformItems","__experimentalGetPatternTransformItems","canRemoveBlocks","getBlockStyles","getBlockType","rootClientId","Array","isArray","name","firstBlockName","_isSingleBlockSelected","length","styles","_icon","isSelectionOfSameType","Set","map","size","blockVariationTransformations","blockTitle","maximumLength","isSingleBlock","isReusable","isTemplate","selectForMultipleBlocks","insertedBlocks","onBlockTransform","newBlocks","onBlockVariationTransform","find","variationName","attributes","onPatternTransform","transformedBlocks","hasPossibleBlockTransformations","hasPossibleBlockVariationTransformations","hasPatternTransformation","hasBlockOrBlockVariationTransforms","showDropdown","createElement","disabled","className","title","Fragment","showColors","blockSwitcherLabel","blockSwitcherDescription","toggleProps","label","popoverProps","placement","describedBy","menuProps","orientation","onClose","onSelect","possibleBlockVariationTransformations","onSelectVariation","hoveredBlock","onSwitch","BlockSwitcher","getBlocksByClientId","some","block"],"sources":["@wordpress/block-editor/src/components/block-switcher/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport {\n\tDropdownMenu,\n\tToolbarButton,\n\tToolbarGroup,\n\tToolbarItem,\n} from '@wordpress/components';\nimport {\n\tswitchToBlockType,\n\tstore as blocksStore,\n\tisReusableBlock,\n\tisTemplatePart,\n} from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { copy } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport useBlockDisplayInformation from '../use-block-display-information';\nimport BlockIcon from '../block-icon';\nimport BlockTransformationsMenu from './block-transformations-menu';\nimport { useBlockVariationTransforms } from './block-variation-transformations';\nimport BlockStylesMenu from './block-styles-menu';\nimport PatternTransformationsMenu from './pattern-transformations-menu';\nimport useBlockDisplayTitle from '../block-title/use-block-display-title';\n\nexport const BlockSwitcherDropdownMenu = ( { clientIds, blocks } ) => {\n\tconst { replaceBlocks, multiSelect, updateBlockAttributes } =\n\t\tuseDispatch( blockEditorStore );\n\tconst blockInformation = useBlockDisplayInformation( blocks[ 0 ].clientId );\n\tconst {\n\t\tpossibleBlockTransformations,\n\t\tcanRemove,\n\t\thasBlockStyles,\n\t\ticon,\n\t\tpatterns,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetBlockTransformItems,\n\t\t\t\t__experimentalGetPatternTransformItems,\n\t\t\t\tcanRemoveBlocks,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst { getBlockStyles, getBlockType } = select( blocksStore );\n\t\t\tconst rootClientId = getBlockRootClientId(\n\t\t\t\tArray.isArray( clientIds ) ? clientIds[ 0 ] : clientIds\n\t\t\t);\n\t\t\tconst [ { name: firstBlockName } ] = blocks;\n\t\t\tconst _isSingleBlockSelected = blocks.length === 1;\n\t\t\tconst styles =\n\t\t\t\t_isSingleBlockSelected && getBlockStyles( firstBlockName );\n\t\t\tlet _icon;\n\t\t\tif ( _isSingleBlockSelected ) {\n\t\t\t\t_icon = blockInformation?.icon; // Take into account active block variations.\n\t\t\t} else {\n\t\t\t\tconst isSelectionOfSameType =\n\t\t\t\t\tnew Set( blocks.map( ( { name } ) => name ) ).size === 1;\n\t\t\t\t// When selection consists of blocks of multiple types, display an\n\t\t\t\t// appropriate icon to communicate the non-uniformity.\n\t\t\t\t_icon = isSelectionOfSameType\n\t\t\t\t\t? getBlockType( firstBlockName )?.icon\n\t\t\t\t\t: copy;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tpossibleBlockTransformations: getBlockTransformItems(\n\t\t\t\t\tblocks,\n\t\t\t\t\trootClientId\n\t\t\t\t),\n\t\t\t\tcanRemove: canRemoveBlocks( clientIds, rootClientId ),\n\t\t\t\thasBlockStyles: !! styles?.length,\n\t\t\t\ticon: _icon,\n\t\t\t\tpatterns: __experimentalGetPatternTransformItems(\n\t\t\t\t\tblocks,\n\t\t\t\t\trootClientId\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ clientIds, blocks, blockInformation?.icon ]\n\t);\n\n\tconst blockVariationTransformations = useBlockVariationTransforms( {\n\t\tclientIds,\n\t\tblocks,\n\t} );\n\n\tconst blockTitle = useBlockDisplayTitle( {\n\t\tclientId: Array.isArray( clientIds ) ? clientIds[ 0 ] : clientIds,\n\t\tmaximumLength: 35,\n\t} );\n\n\tconst isSingleBlock = blocks.length === 1;\n\tconst isReusable = isSingleBlock && isReusableBlock( blocks[ 0 ] );\n\tconst isTemplate = isSingleBlock && isTemplatePart( blocks[ 0 ] );\n\n\tfunction selectForMultipleBlocks( insertedBlocks ) {\n\t\tif ( insertedBlocks.length > 1 ) {\n\t\t\tmultiSelect(\n\t\t\t\tinsertedBlocks[ 0 ].clientId,\n\t\t\t\tinsertedBlocks[ insertedBlocks.length - 1 ].clientId\n\t\t\t);\n\t\t}\n\t}\n\n\t// Simple block tranformation based on the `Block Transforms` API.\n\tfunction onBlockTransform( name ) {\n\t\tconst newBlocks = switchToBlockType( blocks, name );\n\t\treplaceBlocks( clientIds, newBlocks );\n\t\tselectForMultipleBlocks( newBlocks );\n\t}\n\n\tfunction onBlockVariationTransform( name ) {\n\t\tupdateBlockAttributes( blocks[ 0 ].clientId, {\n\t\t\t...blockVariationTransformations.find(\n\t\t\t\t( { name: variationName } ) => variationName === name\n\t\t\t).attributes,\n\t\t} );\n\t}\n\n\t// Pattern transformation through the `Patterns` API.\n\tfunction onPatternTransform( transformedBlocks ) {\n\t\treplaceBlocks( clientIds, transformedBlocks );\n\t\tselectForMultipleBlocks( transformedBlocks );\n\t}\n\n\t/**\n\t * The `isTemplate` check is a stopgap solution here.\n\t * Ideally, the Transforms API should handle this\n\t * by allowing to exclude blocks from wildcard transformations.\n\t */\n\tconst hasPossibleBlockTransformations =\n\t\t!! possibleBlockTransformations.length && canRemove && ! isTemplate;\n\tconst hasPossibleBlockVariationTransformations =\n\t\t!! blockVariationTransformations?.length;\n\tconst hasPatternTransformation = !! patterns?.length && canRemove;\n\tconst hasBlockOrBlockVariationTransforms =\n\t\thasPossibleBlockTransformations ||\n\t\thasPossibleBlockVariationTransformations;\n\tconst showDropdown =\n\t\thasBlockStyles ||\n\t\thasBlockOrBlockVariationTransforms ||\n\t\thasPatternTransformation;\n\tif ( ! showDropdown ) {\n\t\treturn (\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tdisabled\n\t\t\t\t\tclassName=\"block-editor-block-switcher__no-switcher-icon\"\n\t\t\t\t\ttitle={ blockTitle }\n\t\t\t\t\ticon={\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<BlockIcon icon={ icon } showColors />\n\t\t\t\t\t\t\t{ ( isReusable || isTemplate ) && (\n\t\t\t\t\t\t\t\t<span className=\"block-editor-block-switcher__toggle-text\">\n\t\t\t\t\t\t\t\t\t{ blockTitle }\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</ToolbarGroup>\n\t\t);\n\t}\n\n\tconst blockSwitcherLabel = isSingleBlock\n\t\t? blockTitle\n\t\t: __( 'Multiple blocks selected' );\n\n\tconst blockSwitcherDescription = isSingleBlock\n\t\t? __( 'Change block type or style' )\n\t\t: sprintf(\n\t\t\t\t/* translators: %d: number of blocks. */\n\t\t\t\t_n(\n\t\t\t\t\t'Change type of %d block',\n\t\t\t\t\t'Change type of %d blocks',\n\t\t\t\t\tblocks.length\n\t\t\t\t),\n\t\t\t\tblocks.length\n\t\t );\n\n\treturn (\n\t\t<ToolbarGroup>\n\t\t\t<ToolbarItem>\n\t\t\t\t{ ( toggleProps ) => (\n\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\tclassName=\"block-editor-block-switcher\"\n\t\t\t\t\t\tlabel={ blockSwitcherLabel }\n\t\t\t\t\t\tpopoverProps={ {\n\t\t\t\t\t\t\tplacement: 'bottom-start',\n\t\t\t\t\t\t\tclassName: 'block-editor-block-switcher__popover',\n\t\t\t\t\t\t} }\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<BlockIcon\n\t\t\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\t\t\tclassName=\"block-editor-block-switcher__toggle\"\n\t\t\t\t\t\t\t\t\tshowColors\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t{ ( isReusable || isTemplate ) && (\n\t\t\t\t\t\t\t\t\t<span className=\"block-editor-block-switcher__toggle-text\">\n\t\t\t\t\t\t\t\t\t\t{ blockTitle }\n\t\t\t\t\t\t\t\t\t</span>\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\ttoggleProps={ {\n\t\t\t\t\t\t\tdescribedBy: blockSwitcherDescription,\n\t\t\t\t\t\t\t...toggleProps,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tmenuProps={ { orientation: 'both' } }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t\t<div className=\"block-editor-block-switcher__container\">\n\t\t\t\t\t\t\t\t{ hasPatternTransformation && (\n\t\t\t\t\t\t\t\t\t<PatternTransformationsMenu\n\t\t\t\t\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\t\t\t\t\tpatterns={ patterns }\n\t\t\t\t\t\t\t\t\t\tonSelect={ ( transformedBlocks ) => {\n\t\t\t\t\t\t\t\t\t\t\tonPatternTransform(\n\t\t\t\t\t\t\t\t\t\t\t\ttransformedBlocks\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\tonClose();\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\t{ hasBlockOrBlockVariationTransforms && (\n\t\t\t\t\t\t\t\t\t<BlockTransformationsMenu\n\t\t\t\t\t\t\t\t\t\tclassName=\"block-editor-block-switcher__transforms__menugroup\"\n\t\t\t\t\t\t\t\t\t\tpossibleBlockTransformations={\n\t\t\t\t\t\t\t\t\t\t\tpossibleBlockTransformations\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tpossibleBlockVariationTransformations={\n\t\t\t\t\t\t\t\t\t\t\tblockVariationTransformations\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\t\t\t\t\tonSelect={ ( name ) => {\n\t\t\t\t\t\t\t\t\t\t\tonBlockTransform( name );\n\t\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tonSelectVariation={ ( name ) => {\n\t\t\t\t\t\t\t\t\t\t\tonBlockVariationTransform( name );\n\t\t\t\t\t\t\t\t\t\t\tonClose();\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\t{ hasBlockStyles && (\n\t\t\t\t\t\t\t\t\t<BlockStylesMenu\n\t\t\t\t\t\t\t\t\t\thoveredBlock={ blocks[ 0 ] }\n\t\t\t\t\t\t\t\t\t\tonSwitch={ onClose }\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</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</DropdownMenu>\n\t\t\t\t) }\n\t\t\t</ToolbarItem>\n\t\t</ToolbarGroup>\n\t);\n};\n\nexport const BlockSwitcher = ( { clientIds } ) => {\n\tconst blocks = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getBlocksByClientId( clientIds ),\n\t\t[ clientIds ]\n\t);\n\n\tif ( ! blocks.length || blocks.some( ( block ) => ! block ) ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockSwitcherDropdownMenu clientIds={ clientIds } blocks={ blocks } />\n\t);\n};\n\nexport default BlockSwitcher;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACjD,SACCC,YAAY,EACZC,aAAa,EACbC,YAAY,EACZC,WAAW,QACL,uBAAuB;AAC9B,SACCC,iBAAiB,EACjBC,KAAK,IAAIC,WAAW,EACpBC,eAAe,EACfC,cAAc,QACR,mBAAmB;AAC1B,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,IAAI,QAAQ,kBAAkB;;AAEvC;AACA;AACA;AACA,SAASN,KAAK,IAAIO,gBAAgB,QAAQ,aAAa;AACvD,OAAOC,0BAA0B,MAAM,kCAAkC;AACzE,OAAOC,SAAS,MAAM,eAAe;AACrC,OAAOC,wBAAwB,MAAM,8BAA8B;AACnE,SAASC,2BAA2B,QAAQ,mCAAmC;AAC/E,OAAOC,eAAe,MAAM,qBAAqB;AACjD,OAAOC,0BAA0B,MAAM,gCAAgC;AACvE,OAAOC,oBAAoB,MAAM,wCAAwC;AAEzE,OAAO,MAAMC,yBAAyB,GAAGA,CAAE;EAAEC,SAAS;EAAEC;AAAO,CAAC,KAAM;EACrE,MAAM;IAAEC,aAAa;IAAEC,WAAW;IAAEC;EAAsB,CAAC,GAC1Df,WAAW,CAAEE,gBAAiB,CAAC;EAChC,MAAMc,gBAAgB,GAAGb,0BAA0B,CAAES,MAAM,CAAE,CAAC,CAAE,CAACK,QAAS,CAAC;EAC3E,MAAM;IACLC,4BAA4B;IAC5BC,SAAS;IACTC,cAAc;IACdC,IAAI;IACJC;EACD,CAAC,GAAGvB,SAAS,CACVwB,MAAM,IAAM;IACb,MAAM;MACLC,oBA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AO,CAAC,CAAC;IACV;EAAG,CACH,CACD,EACC3D,cAAc,IACf4C,aAAA,CAACzD,eAAe;IACf4E,YAAY,EAAGvE,MAAM,CAAE,CAAC,CAAI;IAC5BwE,QAAQ,EAAGL;EAAS,CACpB,CAEE,CAEO,CAEH,CACA,CAAC;AAEjB,CAAC;AAED,OAAO,MAAMM,aAAa,GAAGA,CAAE;EAAE1E;AAAU,CAAC,KAAM;EACjD,MAAMC,MAAM,GAAGb,SAAS,CACrBwB,MAAM,IACPA,MAAM,CAAErB,gBAAiB,CAAC,CAACoF,mBAAmB,CAAE3E,SAAU,CAAC,EAC5D,CAAEA,SAAS,CACZ,CAAC;EAED,IAAK,CAAEC,MAAM,CAACwB,MAAM,IAAIxB,MAAM,CAAC2E,IAAI,CAAIC,KAAK,IAAM,CAAEA,KAAM,CAAC,EAAG;IAC7D,OAAO,IAAI;EACZ;EAEA,OACCxB,aAAA,CAACtD,yBAAyB;IAACC,SAAS,EAAGA,SAAW;IAACC,MAAM,EAAGA;EAAQ,CAAE,CAAC;AAEzE,CAAC;AAED,eAAeyE,aAAa"}
@@ -138,8 +138,7 @@ export function PrivateBlockToolbar({
138
138
  }, createElement(BlockSwitcher, {
139
139
  clientIds: blockClientIds
140
140
  }), !isMultiToolbar && createElement(BlockLockToolbar, {
141
- clientId: blockClientIds[0],
142
- wrapperRef: toolbarWrapperRef
141
+ clientId: blockClientId
143
142
  }), createElement(BlockMover, {
144
143
  clientIds: blockClientIds,
145
144
  hideDragHandle: hideDragHandle
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","__","useSelect","useRef","useViewportMatch","getBlockType","hasBlockSupport","isReusableBlock","isTemplatePart","ToolbarGroup","BlockMover","BlockParentSelector","BlockSwitcher","BlockControls","__unstableBlockToolbarLastItem","BlockSettingsMenu","BlockLockToolbar","BlockGroupToolbar","BlockEditVisuallyButton","useShowHoveredOrFocusedGestures","store","blockEditorStore","__unstableBlockNameContext","NavigableToolbar","useHasAnyBlockControls","PrivateBlockToolbar","hideDragHandle","focusOnMount","__experimentalInitialIndex","__experimentalOnIndexChange","variant","blockClientId","blockClientIds","isDefaultEditingMode","blockType","shouldShowVisualToolbar","showParentSelector","select","getBlockName","getBlockMode","getBlockParents","getSelectedBlockClientIds","isBlockValid","getBlockRootClientId","getBlockEditingMode","selectedBlockClientIds","selectedBlockClientId","blockRootClientId","parents","firstParentClientId","length","parentBlockName","parentBlockType","_isDefaultEditingMode","isValid","every","id","isVisual","rootClientId","toolbarWrapperRef","nodeRef","showHoveredOrFocusedGestures","ref","isLargeViewport","isToolbarEnabled","hasAnyBlockControls","isMultiToolbar","isSynced","classes","innerClasses","createElement","focusEditorOnEscape","className","undefined","key","clientIds","clientId","wrapperRef","Fragment","Slot","group","Provider","value","name","BlockToolbar"],"sources":["@wordpress/block-editor/src/components/block-toolbar/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tgetBlockType,\n\thasBlockSupport,\n\tisReusableBlock,\n\tisTemplatePart,\n} from '@wordpress/blocks';\nimport { ToolbarGroup } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport BlockMover from '../block-mover';\nimport BlockParentSelector from '../block-parent-selector';\nimport BlockSwitcher from '../block-switcher';\nimport BlockControls from '../block-controls';\nimport __unstableBlockToolbarLastItem from './block-toolbar-last-item';\nimport BlockSettingsMenu from '../block-settings-menu';\nimport { BlockLockToolbar } from '../block-lock';\nimport { BlockGroupToolbar } from '../convert-to-group-buttons';\nimport BlockEditVisuallyButton from '../block-edit-visually-button';\nimport { useShowHoveredOrFocusedGestures } from './utils';\nimport { store as blockEditorStore } from '../../store';\nimport __unstableBlockNameContext from './block-name-context';\nimport NavigableToolbar from '../navigable-toolbar';\nimport { useHasAnyBlockControls } from '../block-controls/use-has-block-controls';\n\n/**\n * Renders the block toolbar.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-toolbar/README.md\n *\n * @param {Object} props Components props.\n * @param {boolean} props.hideDragHandle Show or hide the Drag Handle for drag and drop functionality.\n * @param {boolean} props.focusOnMount Focus the toolbar when mounted.\n * @param {number} props.__experimentalInitialIndex The initial index of the toolbar item to focus.\n * @param {Function} props.__experimentalOnIndexChange Callback function to be called when the index of the focused toolbar item changes.\n * @param {string} props.variant Style variant of the toolbar, also passed to the Dropdowns rendered from Block Toolbar Buttons.\n */\nexport function PrivateBlockToolbar( {\n\thideDragHandle,\n\tfocusOnMount,\n\t__experimentalInitialIndex,\n\t__experimentalOnIndexChange,\n\tvariant = 'unstyled',\n} ) {\n\tconst {\n\t\tblockClientId,\n\t\tblockClientIds,\n\t\tisDefaultEditingMode,\n\t\tblockType,\n\t\tshouldShowVisualToolbar,\n\t\tshowParentSelector,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockName,\n\t\t\tgetBlockMode,\n\t\t\tgetBlockParents,\n\t\t\tgetSelectedBlockClientIds,\n\t\t\tisBlockValid,\n\t\t\tgetBlockRootClientId,\n\t\t\tgetBlockEditingMode,\n\t\t} = select( blockEditorStore );\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\t\tconst selectedBlockClientId = selectedBlockClientIds[ 0 ];\n\t\tconst blockRootClientId = getBlockRootClientId( selectedBlockClientId );\n\t\tconst parents = getBlockParents( selectedBlockClientId );\n\t\tconst firstParentClientId = parents[ parents.length - 1 ];\n\t\tconst parentBlockName = getBlockName( firstParentClientId );\n\t\tconst parentBlockType = getBlockType( parentBlockName );\n\t\tconst _isDefaultEditingMode =\n\t\t\tgetBlockEditingMode( selectedBlockClientId ) === 'default';\n\t\tconst isValid = selectedBlockClientIds.every( ( id ) =>\n\t\t\tisBlockValid( id )\n\t\t);\n\t\tconst isVisual = selectedBlockClientIds.every(\n\t\t\t( id ) => getBlockMode( id ) === 'visual'\n\t\t);\n\t\treturn {\n\t\t\tblockClientId: selectedBlockClientId,\n\t\t\tblockClientIds: selectedBlockClientIds,\n\t\t\tisDefaultEditingMode: _isDefaultEditingMode,\n\t\t\tblockType:\n\t\t\t\tselectedBlockClientId &&\n\t\t\t\tgetBlockType( getBlockName( selectedBlockClientId ) ),\n\n\t\t\tshouldShowVisualToolbar: isValid && isVisual,\n\t\t\trootClientId: blockRootClientId,\n\t\t\tshowParentSelector:\n\t\t\t\tparentBlockType &&\n\t\t\t\tgetBlockEditingMode( firstParentClientId ) === 'default' &&\n\t\t\t\thasBlockSupport(\n\t\t\t\t\tparentBlockType,\n\t\t\t\t\t'__experimentalParentSelector',\n\t\t\t\t\ttrue\n\t\t\t\t) &&\n\t\t\t\tselectedBlockClientIds.length === 1 &&\n\t\t\t\t_isDefaultEditingMode,\n\t\t};\n\t}, [] );\n\n\tconst toolbarWrapperRef = useRef( null );\n\n\t// Handles highlighting the current block outline on hover or focus of the\n\t// block type toolbar area.\n\tconst nodeRef = useRef();\n\tconst showHoveredOrFocusedGestures = useShowHoveredOrFocusedGestures( {\n\t\tref: nodeRef,\n\t} );\n\n\tconst isLargeViewport = ! useViewportMatch( 'medium', '<' );\n\n\tconst isToolbarEnabled =\n\t\tblockType &&\n\t\thasBlockSupport( blockType, '__experimentalToolbar', true );\n\tconst hasAnyBlockControls = useHasAnyBlockControls();\n\n\tif (\n\t\t! isToolbarEnabled ||\n\t\t( ! isDefaultEditingMode && ! hasAnyBlockControls )\n\t) {\n\t\treturn null;\n\t}\n\n\tconst isMultiToolbar = blockClientIds.length > 1;\n\tconst isSynced =\n\t\tisReusableBlock( blockType ) || isTemplatePart( blockType );\n\n\t// Shifts the toolbar to make room for the parent block selector.\n\tconst classes = classnames( 'block-editor-block-contextual-toolbar', {\n\t\t'has-parent': showParentSelector,\n\t} );\n\n\tconst innerClasses = classnames( 'block-editor-block-toolbar', {\n\t\t'is-synced': isSynced,\n\t} );\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tfocusEditorOnEscape\n\t\t\tclassName={ classes }\n\t\t\t/* translators: accessibility text for the block toolbar */\n\t\t\taria-label={ __( 'Block tools' ) }\n\t\t\t// The variant is applied as \"toolbar\" when undefined, which is the black border style of the dropdown from the toolbar popover.\n\t\t\tvariant={ variant === 'toolbar' ? undefined : variant }\n\t\t\tfocusOnMount={ focusOnMount }\n\t\t\t__experimentalInitialIndex={ __experimentalInitialIndex }\n\t\t\t__experimentalOnIndexChange={ __experimentalOnIndexChange }\n\t\t\t// Resets the index whenever the active block changes so\n\t\t\t// this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169\n\t\t\tkey={ blockClientId }\n\t\t>\n\t\t\t<div ref={ toolbarWrapperRef } className={ innerClasses }>\n\t\t\t\t{ ! isMultiToolbar &&\n\t\t\t\t\tisLargeViewport &&\n\t\t\t\t\tisDefaultEditingMode && <BlockParentSelector /> }\n\t\t\t\t{ ( shouldShowVisualToolbar || isMultiToolbar ) &&\n\t\t\t\t\tisDefaultEditingMode && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tref={ nodeRef }\n\t\t\t\t\t\t\t{ ...showHoveredOrFocusedGestures }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToolbarGroup className=\"block-editor-block-toolbar__block-controls\">\n\t\t\t\t\t\t\t\t<BlockSwitcher clientIds={ blockClientIds } />\n\t\t\t\t\t\t\t\t{ ! isMultiToolbar && (\n\t\t\t\t\t\t\t\t\t<BlockLockToolbar\n\t\t\t\t\t\t\t\t\t\tclientId={ blockClientIds[ 0 ] }\n\t\t\t\t\t\t\t\t\t\twrapperRef={ toolbarWrapperRef }\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<BlockMover\n\t\t\t\t\t\t\t\t\tclientIds={ blockClientIds }\n\t\t\t\t\t\t\t\t\thideDragHandle={ hideDragHandle }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t{ shouldShowVisualToolbar && isMultiToolbar && (\n\t\t\t\t\t<BlockGroupToolbar />\n\t\t\t\t) }\n\t\t\t\t{ shouldShowVisualToolbar && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"parent\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"block\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BlockControls.Slot className=\"block-editor-block-toolbar__slot\" />\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"inline\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"other\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<__unstableBlockNameContext.Provider\n\t\t\t\t\t\t\tvalue={ blockType?.name }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<__unstableBlockToolbarLastItem.Slot />\n\t\t\t\t\t\t</__unstableBlockNameContext.Provider>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t<BlockEditVisuallyButton clientIds={ blockClientIds } />\n\t\t\t\t{ isDefaultEditingMode && (\n\t\t\t\t\t<BlockSettingsMenu clientIds={ blockClientIds } />\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</NavigableToolbar>\n\t);\n}\n\n/**\n * Renders the block toolbar.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-toolbar/README.md\n *\n * @param {Object} props Components props.\n * @param {boolean} props.hideDragHandle Show or hide the Drag Handle for drag and drop functionality.\n * @param {string} props.variant Style variant of the toolbar, also passed to the Dropdowns rendered from Block Toolbar Buttons.\n */\nexport default function BlockToolbar( { hideDragHandle, variant } ) {\n\treturn (\n\t\t<PrivateBlockToolbar\n\t\t\thideDragHandle={ hideDragHandle }\n\t\t\tvariant={ variant }\n\t\t\tfocusOnMount={ undefined }\n\t\t\t__experimentalInitialIndex={ undefined }\n\t\t\t__experimentalOnIndexChange={ undefined }\n\t\t/>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,MAAM,QAAQ,oBAAoB;AAC3C,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SACCC,YAAY,EACZC,eAAe,EACfC,eAAe,EACfC,cAAc,QACR,mBAAmB;AAC1B,SAASC,YAAY,QAAQ,uBAAuB;;AAEpD;AACA;AACA;AACA,OAAOC,UAAU,MAAM,gBAAgB;AACvC,OAAOC,mBAAmB,MAAM,0BAA0B;AAC1D,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,OAAOC,8BAA8B,MAAM,2BAA2B;AACtE,OAAOC,iBAAiB,MAAM,wBAAwB;AACtD,SAASC,gBAAgB,QAAQ,eAAe;AAChD,SAASC,iBAAiB,QAAQ,6BAA6B;AAC/D,OAAOC,uBAAuB,MAAM,+BAA+B;AACnE,SAASC,+BAA+B,QAAQ,SAAS;AACzD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,OAAOC,0BAA0B,MAAM,sBAAsB;AAC7D,OAAOC,gBAAgB,MAAM,sBAAsB;AACnD,SAASC,sBAAsB,QAAQ,0CAA0C;;AAEjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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BC,KAAK,EAAC,OAAO;IACbR,SAAS,EAAC;EAAkC,CAC5C,CAAC,EACFF,aAAA,CAACzD,aAAa,CAACkE,IAAI;IAACP,SAAS,EAAC;EAAkC,CAAE,CAAC,EACnEF,aAAA,CAACzD,aAAa,CAACkE,IAAI;IAClBC,KAAK,EAAC,QAAQ;IACdR,SAAS,EAAC;EAAkC,CAC5C,CAAC,EACFF,aAAA,CAACzD,aAAa,CAACkE,IAAI;IAClBC,KAAK,EAAC,OAAO;IACbR,SAAS,EAAC;EAAkC,CAC5C,CAAC,EACFF,aAAA,CAAChD,0BAA0B,CAAC2D,QAAQ;IACnCC,KAAK,EAAGhD,SAAS,EAAEiD;EAAM,GAEzBb,aAAA,CAACxD,8BAA8B,CAACiE,IAAI,MAAE,CACF,CACpC,CACF,EACDT,aAAA,CAACpD,uBAAuB;IAACyD,SAAS,EAAG3C;EAAgB,CAAE,CAAC,EACtDC,oBAAoB,IACrBqC,aAAA,CAACvD,iBAAiB;IAAC4D,SAAS,EAAG3C;EAAgB,CAAE,CAE9C,CACY,CAAC;AAErB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASoD,YAAYA,CAAE;EAAE1D,cAAc;EAAEI;AAAQ,CAAC,EAAG;EACnE,OACCwC,aAAA,CAAC7C,mBAAmB;IACnBC,cAAc,EAAGA,cAAgB;IACjCI,OAAO,EAAGA,OAAS;IACnBH,YAAY,EAAG8C,SAAW;IAC1B7C,0BAA0B,EAAG6C,SAAW;IACxC5C,2BAA2B,EAAG4C;EAAW,CACzC,CAAC;AAEJ"}
1
+ {"version":3,"names":["classnames","__","useSelect","useRef","useViewportMatch","getBlockType","hasBlockSupport","isReusableBlock","isTemplatePart","ToolbarGroup","BlockMover","BlockParentSelector","BlockSwitcher","BlockControls","__unstableBlockToolbarLastItem","BlockSettingsMenu","BlockLockToolbar","BlockGroupToolbar","BlockEditVisuallyButton","useShowHoveredOrFocusedGestures","store","blockEditorStore","__unstableBlockNameContext","NavigableToolbar","useHasAnyBlockControls","PrivateBlockToolbar","hideDragHandle","focusOnMount","__experimentalInitialIndex","__experimentalOnIndexChange","variant","blockClientId","blockClientIds","isDefaultEditingMode","blockType","shouldShowVisualToolbar","showParentSelector","select","getBlockName","getBlockMode","getBlockParents","getSelectedBlockClientIds","isBlockValid","getBlockRootClientId","getBlockEditingMode","selectedBlockClientIds","selectedBlockClientId","blockRootClientId","parents","firstParentClientId","length","parentBlockName","parentBlockType","_isDefaultEditingMode","isValid","every","id","isVisual","rootClientId","toolbarWrapperRef","nodeRef","showHoveredOrFocusedGestures","ref","isLargeViewport","isToolbarEnabled","hasAnyBlockControls","isMultiToolbar","isSynced","classes","innerClasses","createElement","focusEditorOnEscape","className","undefined","key","clientIds","clientId","Fragment","Slot","group","Provider","value","name","BlockToolbar"],"sources":["@wordpress/block-editor/src/components/block-toolbar/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { useRef } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\tgetBlockType,\n\thasBlockSupport,\n\tisReusableBlock,\n\tisTemplatePart,\n} from '@wordpress/blocks';\nimport { ToolbarGroup } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport BlockMover from '../block-mover';\nimport BlockParentSelector from '../block-parent-selector';\nimport BlockSwitcher from '../block-switcher';\nimport BlockControls from '../block-controls';\nimport __unstableBlockToolbarLastItem from './block-toolbar-last-item';\nimport BlockSettingsMenu from '../block-settings-menu';\nimport { BlockLockToolbar } from '../block-lock';\nimport { BlockGroupToolbar } from '../convert-to-group-buttons';\nimport BlockEditVisuallyButton from '../block-edit-visually-button';\nimport { useShowHoveredOrFocusedGestures } from './utils';\nimport { store as blockEditorStore } from '../../store';\nimport __unstableBlockNameContext from './block-name-context';\nimport NavigableToolbar from '../navigable-toolbar';\nimport { useHasAnyBlockControls } from '../block-controls/use-has-block-controls';\n\n/**\n * Renders the block toolbar.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-toolbar/README.md\n *\n * @param {Object} props Components props.\n * @param {boolean} props.hideDragHandle Show or hide the Drag Handle for drag and drop functionality.\n * @param {boolean} props.focusOnMount Focus the toolbar when mounted.\n * @param {number} props.__experimentalInitialIndex The initial index of the toolbar item to focus.\n * @param {Function} props.__experimentalOnIndexChange Callback function to be called when the index of the focused toolbar item changes.\n * @param {string} props.variant Style variant of the toolbar, also passed to the Dropdowns rendered from Block Toolbar Buttons.\n */\nexport function PrivateBlockToolbar( {\n\thideDragHandle,\n\tfocusOnMount,\n\t__experimentalInitialIndex,\n\t__experimentalOnIndexChange,\n\tvariant = 'unstyled',\n} ) {\n\tconst {\n\t\tblockClientId,\n\t\tblockClientIds,\n\t\tisDefaultEditingMode,\n\t\tblockType,\n\t\tshouldShowVisualToolbar,\n\t\tshowParentSelector,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetBlockName,\n\t\t\tgetBlockMode,\n\t\t\tgetBlockParents,\n\t\t\tgetSelectedBlockClientIds,\n\t\t\tisBlockValid,\n\t\t\tgetBlockRootClientId,\n\t\t\tgetBlockEditingMode,\n\t\t} = select( blockEditorStore );\n\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\t\tconst selectedBlockClientId = selectedBlockClientIds[ 0 ];\n\t\tconst blockRootClientId = getBlockRootClientId( selectedBlockClientId );\n\t\tconst parents = getBlockParents( selectedBlockClientId );\n\t\tconst firstParentClientId = parents[ parents.length - 1 ];\n\t\tconst parentBlockName = getBlockName( firstParentClientId );\n\t\tconst parentBlockType = getBlockType( parentBlockName );\n\t\tconst _isDefaultEditingMode =\n\t\t\tgetBlockEditingMode( selectedBlockClientId ) === 'default';\n\t\tconst isValid = selectedBlockClientIds.every( ( id ) =>\n\t\t\tisBlockValid( id )\n\t\t);\n\t\tconst isVisual = selectedBlockClientIds.every(\n\t\t\t( id ) => getBlockMode( id ) === 'visual'\n\t\t);\n\t\treturn {\n\t\t\tblockClientId: selectedBlockClientId,\n\t\t\tblockClientIds: selectedBlockClientIds,\n\t\t\tisDefaultEditingMode: _isDefaultEditingMode,\n\t\t\tblockType:\n\t\t\t\tselectedBlockClientId &&\n\t\t\t\tgetBlockType( getBlockName( selectedBlockClientId ) ),\n\n\t\t\tshouldShowVisualToolbar: isValid && isVisual,\n\t\t\trootClientId: blockRootClientId,\n\t\t\tshowParentSelector:\n\t\t\t\tparentBlockType &&\n\t\t\t\tgetBlockEditingMode( firstParentClientId ) === 'default' &&\n\t\t\t\thasBlockSupport(\n\t\t\t\t\tparentBlockType,\n\t\t\t\t\t'__experimentalParentSelector',\n\t\t\t\t\ttrue\n\t\t\t\t) &&\n\t\t\t\tselectedBlockClientIds.length === 1 &&\n\t\t\t\t_isDefaultEditingMode,\n\t\t};\n\t}, [] );\n\n\tconst toolbarWrapperRef = useRef( null );\n\n\t// Handles highlighting the current block outline on hover or focus of the\n\t// block type toolbar area.\n\tconst nodeRef = useRef();\n\tconst showHoveredOrFocusedGestures = useShowHoveredOrFocusedGestures( {\n\t\tref: nodeRef,\n\t} );\n\n\tconst isLargeViewport = ! useViewportMatch( 'medium', '<' );\n\n\tconst isToolbarEnabled =\n\t\tblockType &&\n\t\thasBlockSupport( blockType, '__experimentalToolbar', true );\n\tconst hasAnyBlockControls = useHasAnyBlockControls();\n\n\tif (\n\t\t! isToolbarEnabled ||\n\t\t( ! isDefaultEditingMode && ! hasAnyBlockControls )\n\t) {\n\t\treturn null;\n\t}\n\n\tconst isMultiToolbar = blockClientIds.length > 1;\n\tconst isSynced =\n\t\tisReusableBlock( blockType ) || isTemplatePart( blockType );\n\n\t// Shifts the toolbar to make room for the parent block selector.\n\tconst classes = classnames( 'block-editor-block-contextual-toolbar', {\n\t\t'has-parent': showParentSelector,\n\t} );\n\n\tconst innerClasses = classnames( 'block-editor-block-toolbar', {\n\t\t'is-synced': isSynced,\n\t} );\n\n\treturn (\n\t\t<NavigableToolbar\n\t\t\tfocusEditorOnEscape\n\t\t\tclassName={ classes }\n\t\t\t/* translators: accessibility text for the block toolbar */\n\t\t\taria-label={ __( 'Block tools' ) }\n\t\t\t// The variant is applied as \"toolbar\" when undefined, which is the black border style of the dropdown from the toolbar popover.\n\t\t\tvariant={ variant === 'toolbar' ? undefined : variant }\n\t\t\tfocusOnMount={ focusOnMount }\n\t\t\t__experimentalInitialIndex={ __experimentalInitialIndex }\n\t\t\t__experimentalOnIndexChange={ __experimentalOnIndexChange }\n\t\t\t// Resets the index whenever the active block changes so\n\t\t\t// this is not persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169\n\t\t\tkey={ blockClientId }\n\t\t>\n\t\t\t<div ref={ toolbarWrapperRef } className={ innerClasses }>\n\t\t\t\t{ ! isMultiToolbar &&\n\t\t\t\t\tisLargeViewport &&\n\t\t\t\t\tisDefaultEditingMode && <BlockParentSelector /> }\n\t\t\t\t{ ( shouldShowVisualToolbar || isMultiToolbar ) &&\n\t\t\t\t\tisDefaultEditingMode && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tref={ nodeRef }\n\t\t\t\t\t\t\t{ ...showHoveredOrFocusedGestures }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ToolbarGroup className=\"block-editor-block-toolbar__block-controls\">\n\t\t\t\t\t\t\t\t<BlockSwitcher clientIds={ blockClientIds } />\n\t\t\t\t\t\t\t\t{ ! isMultiToolbar && (\n\t\t\t\t\t\t\t\t\t<BlockLockToolbar\n\t\t\t\t\t\t\t\t\t\tclientId={ blockClientId }\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<BlockMover\n\t\t\t\t\t\t\t\t\tclientIds={ blockClientIds }\n\t\t\t\t\t\t\t\t\thideDragHandle={ hideDragHandle }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t{ shouldShowVisualToolbar && isMultiToolbar && (\n\t\t\t\t\t<BlockGroupToolbar />\n\t\t\t\t) }\n\t\t\t\t{ shouldShowVisualToolbar && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"parent\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"block\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BlockControls.Slot className=\"block-editor-block-toolbar__slot\" />\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"inline\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BlockControls.Slot\n\t\t\t\t\t\t\tgroup=\"other\"\n\t\t\t\t\t\t\tclassName=\"block-editor-block-toolbar__slot\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<__unstableBlockNameContext.Provider\n\t\t\t\t\t\t\tvalue={ blockType?.name }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<__unstableBlockToolbarLastItem.Slot />\n\t\t\t\t\t\t</__unstableBlockNameContext.Provider>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t<BlockEditVisuallyButton clientIds={ blockClientIds } />\n\t\t\t\t{ isDefaultEditingMode && (\n\t\t\t\t\t<BlockSettingsMenu clientIds={ blockClientIds } />\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</NavigableToolbar>\n\t);\n}\n\n/**\n * Renders the block toolbar.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-toolbar/README.md\n *\n * @param {Object} props Components props.\n * @param {boolean} props.hideDragHandle Show or hide the Drag Handle for drag and drop functionality.\n * @param {string} props.variant Style variant of the toolbar, also passed to the Dropdowns rendered from Block Toolbar Buttons.\n */\nexport default function BlockToolbar( { hideDragHandle, variant } ) {\n\treturn (\n\t\t<PrivateBlockToolbar\n\t\t\thideDragHandle={ hideDragHandle }\n\t\t\tvariant={ variant }\n\t\t\tfocusOnMount={ undefined }\n\t\t\t__experimentalInitialIndex={ undefined }\n\t\t\t__experimentalOnIndexChange={ undefined }\n\t\t/>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,MAAM,QAAQ,oBAAoB;AAC3C,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SACCC,YAAY,EACZC,eAAe,EACfC,eAAe,EACfC,cAAc,QACR,mBAAmB;AAC1B,SAASC,YAAY,QAAQ,uBAAuB;;AAEpD;AACA;AACA;AACA,OAAOC,UAAU,MAAM,gBAAgB;AACvC,OAAOC,mBAAmB,MAAM,0BAA0B;AAC1D,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,OAAOC,8BAA8B,MAAM,2BAA2B;AACtE,OAAOC,iBAAiB,MAAM,wBAAwB;AACtD,SAASC,gBAAgB,QAAQ,eAAe;AAChD,SAASC,iBAAiB,QAAQ,6BAA6B;AAC/D,OAAOC,uBAAuB,MAAM,+BAA+B;AACnE,SAASC,+BAA+B,QAAQ,SAAS;AACzD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,OAAOC,0BAA0B,MAAM,sBAAsB;AAC7D,OAAOC,gBAAgB,MAAM,sBAAsB;AACnD,SAASC,sBAAsB,QAAQ,0CAA0C;;AAEjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,S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zD,aAAa,CAACiE,IAAI;IAACN,SAAS,EAAC;EAAkC,CAAE,CAAC,EACnEF,aAAA,CAACzD,aAAa,CAACiE,IAAI;IAClBC,KAAK,EAAC,QAAQ;IACdP,SAAS,EAAC;EAAkC,CAC5C,CAAC,EACFF,aAAA,CAACzD,aAAa,CAACiE,IAAI;IAClBC,KAAK,EAAC,OAAO;IACbP,SAAS,EAAC;EAAkC,CAC5C,CAAC,EACFF,aAAA,CAAChD,0BAA0B,CAAC0D,QAAQ;IACnCC,KAAK,EAAG/C,SAAS,EAAEgD;EAAM,GAEzBZ,aAAA,CAACxD,8BAA8B,CAACgE,IAAI,MAAE,CACF,CACpC,CACF,EACDR,aAAA,CAACpD,uBAAuB;IAACyD,SAAS,EAAG3C;EAAgB,CAAE,CAAC,EACtDC,oBAAoB,IACrBqC,aAAA,CAACvD,iBAAiB;IAAC4D,SAAS,EAAG3C;EAAgB,CAAE,CAE9C,CACY,CAAC;AAErB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASmD,YAAYA,CAAE;EAAEzD,cAAc;EAAEI;AAAQ,CAAC,EAAG;EACnE,OACCwC,aAAA,CAAC7C,mBAAmB;IACnBC,cAAc,EAAGA,cAAgB;IACjCI,OAAO,EAAGA,OAAS;IACnBH,YAAY,EAAG8C,SAAW;IAC1B7C,0BAA0B,EAAG6C,SAAW;IACxC5C,2BAA2B,EAAG4C;EAAW,CACzC,CAAC;AAEJ"}
@@ -43,8 +43,6 @@ export default function BlockToolbarPopover({
43
43
  useShortcut('core/block-editor/focus-toolbar', () => {
44
44
  isToolbarForced.current = true;
45
45
  stopTyping(true);
46
- }, {
47
- isDisabled: false
48
46
  });
49
47
  useEffect(() => {
50
48
  isToolbarForced.current = false;
@@ -1 +1 @@
1
- {"version":3,"names":["classnames","useDispatch","useEffect","useRef","useShortcut","BlockPopover","useBlockToolbarPopoverProps","useSelectedBlockToolProps","store","blockEditorStore","PrivateBlockToolbar","BlockToolbarPopover","clientId","isTyping","__unstableContentRef","capturingClientId","isInsertionPointVisible","lastClientId","initialToolbarItemIndexRef","current","undefined","stopTyping","isToolbarForced","isDisabled","popoverProps","contentElement","createElement","bottomClientId","className","resize","focusOnMount","__experimentalInitialIndex","__experimentalOnIndexChange","index","variant"],"sources":["@wordpress/block-editor/src/components/block-tools/block-toolbar-popover.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { useEffect, useRef } from '@wordpress/element';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\n/**\n * Internal dependencies\n */\nimport BlockPopover from '../block-popover';\nimport useBlockToolbarPopoverProps from './use-block-toolbar-popover-props';\nimport useSelectedBlockToolProps from './use-selected-block-tool-props';\nimport { store as blockEditorStore } from '../../store';\nimport { PrivateBlockToolbar } from '../block-toolbar';\n\nexport default function BlockToolbarPopover( {\n\tclientId,\n\tisTyping,\n\t__unstableContentRef,\n} ) {\n\tconst { capturingClientId, isInsertionPointVisible, lastClientId } =\n\t\tuseSelectedBlockToolProps( clientId );\n\n\t// Stores the active toolbar item index so the block toolbar can return focus\n\t// to it when re-mounting.\n\tconst initialToolbarItemIndexRef = useRef();\n\n\tuseEffect( () => {\n\t\t// Resets the index whenever the active block changes so this is not\n\t\t// persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169\n\t\tinitialToolbarItemIndexRef.current = undefined;\n\t}, [ clientId ] );\n\n\tconst { stopTyping } = useDispatch( blockEditorStore );\n\tconst isToolbarForced = useRef( false );\n\n\tuseShortcut(\n\t\t'core/block-editor/focus-toolbar',\n\t\t() => {\n\t\t\tisToolbarForced.current = true;\n\t\t\tstopTyping( true );\n\t\t},\n\t\t{\n\t\t\tisDisabled: false,\n\t\t}\n\t);\n\n\tuseEffect( () => {\n\t\tisToolbarForced.current = false;\n\t} );\n\n\tconst popoverProps = useBlockToolbarPopoverProps( {\n\t\tcontentElement: __unstableContentRef?.current,\n\t\tclientId,\n\t} );\n\n\treturn (\n\t\t! isTyping && (\n\t\t\t<BlockPopover\n\t\t\t\tclientId={ capturingClientId || clientId }\n\t\t\t\tbottomClientId={ lastClientId }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'block-editor-block-list__block-popover',\n\t\t\t\t\t{\n\t\t\t\t\t\t'is-insertion-point-visible': isInsertionPointVisible,\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t\tresize={ false }\n\t\t\t\t{ ...popoverProps }\n\t\t\t>\n\t\t\t\t<PrivateBlockToolbar\n\t\t\t\t\t// If the toolbar is being shown because of being forced\n\t\t\t\t\t// it should focus the toolbar right after the mount.\n\t\t\t\t\tfocusOnMount={ isToolbarForced.current }\n\t\t\t\t\t__experimentalInitialIndex={\n\t\t\t\t\t\tinitialToolbarItemIndexRef.current\n\t\t\t\t\t}\n\t\t\t\t\t__experimentalOnIndexChange={ ( index ) => {\n\t\t\t\t\t\tinitialToolbarItemIndexRef.current = index;\n\t\t\t\t\t} }\n\t\t\t\t\tvariant=\"toolbar\"\n\t\t\t\t/>\n\t\t\t</BlockPopover>\n\t\t)\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;AACnC;AACA;AACA;AACA,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,SAAS,EAAEC,MAAM,QAAQ,oBAAoB;AACtD,SAASC,WAAW,QAAQ,+BAA+B;AAC3D;AACA;AACA;AACA,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,2BAA2B,MAAM,mCAAmC;AAC3E,OAAOC,yBAAyB,MAAM,iCAAiC;AACvE,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,mBAAmB,QAAQ,kBAAkB;AAEtD,eAAe,SAASC,mBAAmBA,CAAE;EAC5CC,QAAQ;EACRC,QAAQ;EACRC;AACD,CAAC,EAAG;EACH,MAAM;IAAEC,iBAAiB;I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"}
1
+ {"version":3,"names":["classnames","useDispatch","useEffect","useRef","useShortcut","BlockPopover","useBlockToolbarPopoverProps","useSelectedBlockToolProps","store","blockEditorStore","PrivateBlockToolbar","BlockToolbarPopover","clientId","isTyping","__unstableContentRef","capturingClientId","isInsertionPointVisible","lastClientId","initialToolbarItemIndexRef","current","undefined","stopTyping","isToolbarForced","popoverProps","contentElement","createElement","bottomClientId","className","resize","focusOnMount","__experimentalInitialIndex","__experimentalOnIndexChange","index","variant"],"sources":["@wordpress/block-editor/src/components/block-tools/block-toolbar-popover.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { useEffect, useRef } from '@wordpress/element';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\n/**\n * Internal dependencies\n */\nimport BlockPopover from '../block-popover';\nimport useBlockToolbarPopoverProps from './use-block-toolbar-popover-props';\nimport useSelectedBlockToolProps from './use-selected-block-tool-props';\nimport { store as blockEditorStore } from '../../store';\nimport { PrivateBlockToolbar } from '../block-toolbar';\n\nexport default function BlockToolbarPopover( {\n\tclientId,\n\tisTyping,\n\t__unstableContentRef,\n} ) {\n\tconst { capturingClientId, isInsertionPointVisible, lastClientId } =\n\t\tuseSelectedBlockToolProps( clientId );\n\n\t// Stores the active toolbar item index so the block toolbar can return focus\n\t// to it when re-mounting.\n\tconst initialToolbarItemIndexRef = useRef();\n\n\tuseEffect( () => {\n\t\t// Resets the index whenever the active block changes so this is not\n\t\t// persisted. See https://github.com/WordPress/gutenberg/pull/25760#issuecomment-717906169\n\t\tinitialToolbarItemIndexRef.current = undefined;\n\t}, [ clientId ] );\n\n\tconst { stopTyping } = useDispatch( blockEditorStore );\n\tconst isToolbarForced = useRef( false );\n\n\tuseShortcut( 'core/block-editor/focus-toolbar', () => {\n\t\tisToolbarForced.current = true;\n\t\tstopTyping( true );\n\t} );\n\n\tuseEffect( () => {\n\t\tisToolbarForced.current = false;\n\t} );\n\n\tconst popoverProps = useBlockToolbarPopoverProps( {\n\t\tcontentElement: __unstableContentRef?.current,\n\t\tclientId,\n\t} );\n\n\treturn (\n\t\t! isTyping && (\n\t\t\t<BlockPopover\n\t\t\t\tclientId={ capturingClientId || clientId }\n\t\t\t\tbottomClientId={ lastClientId }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'block-editor-block-list__block-popover',\n\t\t\t\t\t{\n\t\t\t\t\t\t'is-insertion-point-visible': isInsertionPointVisible,\n\t\t\t\t\t}\n\t\t\t\t) }\n\t\t\t\tresize={ false }\n\t\t\t\t{ ...popoverProps }\n\t\t\t>\n\t\t\t\t<PrivateBlockToolbar\n\t\t\t\t\t// If the toolbar is being shown because of being forced\n\t\t\t\t\t// it should focus the toolbar right after the mount.\n\t\t\t\t\tfocusOnMount={ isToolbarForced.current }\n\t\t\t\t\t__experimentalInitialIndex={\n\t\t\t\t\t\tinitialToolbarItemIndexRef.current\n\t\t\t\t\t}\n\t\t\t\t\t__experimentalOnIndexChange={ ( index ) => {\n\t\t\t\t\t\tinitialToolbarItemIndexRef.current = index;\n\t\t\t\t\t} }\n\t\t\t\t\tvariant=\"toolbar\"\n\t\t\t\t/>\n\t\t\t</BlockPopover>\n\t\t)\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;AACnC;AACA;AACA;AACA,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,SAAS,EAAEC,MAAM,QAAQ,oBAAoB;AACtD,SAASC,WAAW,QAAQ,+BAA+B;AAC3D;AACA;AACA;AACA,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,2BAA2B,MAAM,mCAAmC;AAC3E,OAAOC,yBAAyB,MAAM,iCAAiC;AACvE,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,mBAAmB,QAAQ,kBAAkB;AAEtD,eAAe,SAASC,mBAAmBA,CAAE;EAC5CC,QAAQ;EACRC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C;EAAS,CACjB,CACY,CACd;AAEH"}
@@ -4,7 +4,7 @@ import { createElement } from "react";
4
4
  */
5
5
  import { store as blocksStore } from '@wordpress/blocks';
6
6
  import { __, sprintf } from '@wordpress/i18n';
7
- import { Button, DropdownMenu, MenuGroup, MenuItemsChoice, VisuallyHidden } from '@wordpress/components';
7
+ import { Button, DropdownMenu, MenuGroup, MenuItemsChoice, __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon, VisuallyHidden } from '@wordpress/components';
8
8
  import { useSelect, useDispatch } from '@wordpress/data';
9
9
  import { useMemo } from '@wordpress/element';
10
10
  import { chevronDown } from '@wordpress/icons';
@@ -73,6 +73,29 @@ function VariationsDropdown({
73
73
  onSelect: onSelectVariation
74
74
  }))));
75
75
  }
76
+ function VariationsToggleGroupControl({
77
+ className,
78
+ onSelectVariation,
79
+ selectedValue,
80
+ variations
81
+ }) {
82
+ return createElement("div", {
83
+ className: className
84
+ }, createElement(ToggleGroupControl, {
85
+ label: __('Transform to variation'),
86
+ value: selectedValue,
87
+ hideLabelFromVision: true,
88
+ onChange: onSelectVariation,
89
+ __next40pxDefaultSize: true,
90
+ __nextHasNoMarginBottom: true
91
+ }, variations.map(variation => createElement(ToggleGroupControlOptionIcon, {
92
+ key: variation.name,
93
+ icon: variation.icon,
94
+ value: variation.name,
95
+ label: selectedValue === variation.name ? variation.title : sprintf( /* translators: %s: Name of the block variation */
96
+ __('Transform to %s'), variation.title)
97
+ }))));
98
+ }
76
99
  function __experimentalBlockVariationTransforms({
77
100
  blockClientId
78
101
  }) {
@@ -119,11 +142,15 @@ function __experimentalBlockVariationTransforms({
119
142
  }) => name === variationName).attributes
120
143
  });
121
144
  };
122
- const baseClass = 'block-editor-block-variation-transforms';
123
145
 
124
146
  // Skip rendering if there are no variations
125
147
  if (!variations?.length) return null;
126
- const Component = hasUniqueIcons ? VariationsButtons : VariationsDropdown;
148
+ const baseClass = 'block-editor-block-variation-transforms';
149
+
150
+ // Show buttons if there are more than 5 variations because the ToggleGroupControl does not wrap
151
+ const showButtons = variations.length > 5;
152
+ const ButtonComponent = showButtons ? VariationsButtons : VariationsToggleGroupControl;
153
+ const Component = hasUniqueIcons ? ButtonComponent : VariationsDropdown;
127
154
  return createElement(Component, {
128
155
  className: baseClass,
129
156
  onSelectVariation: onSelectVariation,
@@ -1 +1 @@
1
- {"version":3,"names":["store","blocksStore","__","sprintf","Button","DropdownMenu","MenuGroup","MenuItemsChoice","VisuallyHidden","useSelect","useDispatch","useMemo","chevronDown","BlockIcon","blockEditorStore","VariationsButtons","className","onSelectVariation","selectedValue","variations","createElement","as","map","variation","key","name","icon","showColors","isPressed","label","title","onClick","showTooltip","VariationsDropdown","selectOptions","description","value","info","text","popoverProps","position","toggleProps","iconPosition","choices","onSelect","__experimentalBlockVariationTransforms","blockClientId","updateBlockAttributes","activeBlockVariation","select","getActiveBlockVariation","getBlockVariations","getBlockName","getBlockAttributes","hasUniqueIcons","variationIcons","Set","forEach","add","src","size","length","variationName","find","attributes","baseClass","Component"],"sources":["@wordpress/block-editor/src/components/block-variation-transforms/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tButton,\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItemsChoice,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { chevronDown } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\nimport { store as blockEditorStore } from '../../store';\n\nfunction VariationsButtons( {\n\tclassName,\n\tonSelectVariation,\n\tselectedValue,\n\tvariations,\n} ) {\n\treturn (\n\t\t<fieldset className={ className }>\n\t\t\t<VisuallyHidden as=\"legend\">\n\t\t\t\t{ __( 'Transform to variation' ) }\n\t\t\t</VisuallyHidden>\n\t\t\t{ variations.map( ( variation ) => (\n\t\t\t\t<Button\n\t\t\t\t\tkey={ variation.name }\n\t\t\t\t\ticon={ <BlockIcon icon={ variation.icon } showColors /> }\n\t\t\t\t\tisPressed={ selectedValue === variation.name }\n\t\t\t\t\tlabel={\n\t\t\t\t\t\tselectedValue === variation.name\n\t\t\t\t\t\t\t? variation.title\n\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: Name of the block variation */\n\t\t\t\t\t\t\t\t\t__( 'Transform to %s' ),\n\t\t\t\t\t\t\t\t\tvariation.title\n\t\t\t\t\t\t\t )\n\t\t\t\t\t}\n\t\t\t\t\tonClick={ () => onSelectVariation( variation.name ) }\n\t\t\t\t\taria-label={ variation.title }\n\t\t\t\t\tshowTooltip\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</fieldset>\n\t);\n}\n\nfunction VariationsDropdown( {\n\tclassName,\n\tonSelectVariation,\n\tselectedValue,\n\tvariations,\n} ) {\n\tconst selectOptions = variations.map(\n\t\t( { name, title, description } ) => ( {\n\t\t\tvalue: name,\n\t\t\tlabel: title,\n\t\t\tinfo: description,\n\t\t} )\n\t);\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\tclassName={ className }\n\t\t\tlabel={ __( 'Transform to variation' ) }\n\t\t\ttext={ __( 'Transform to variation' ) }\n\t\t\tpopoverProps={ {\n\t\t\t\tposition: 'bottom center',\n\t\t\t\tclassName: `${ className }__popover`,\n\t\t\t} }\n\t\t\ticon={ chevronDown }\n\t\t\ttoggleProps={ { iconPosition: 'right' } }\n\t\t>\n\t\t\t{ () => (\n\t\t\t\t<div className={ `${ className }__container` }>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItemsChoice\n\t\t\t\t\t\t\tchoices={ selectOptions }\n\t\t\t\t\t\t\tvalue={ selectedValue }\n\t\t\t\t\t\t\tonSelect={ onSelectVariation }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n\nfunction __experimentalBlockVariationTransforms( { blockClientId } ) {\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\tconst { activeBlockVariation, variations } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getActiveBlockVariation, getBlockVariations } =\n\t\t\t\tselect( blocksStore );\n\t\t\tconst { getBlockName, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst name = blockClientId && getBlockName( blockClientId );\n\t\t\treturn {\n\t\t\t\tactiveBlockVariation: getActiveBlockVariation(\n\t\t\t\t\tname,\n\t\t\t\t\tgetBlockAttributes( blockClientId )\n\t\t\t\t),\n\t\t\t\tvariations: name && getBlockVariations( name, 'transform' ),\n\t\t\t};\n\t\t},\n\t\t[ blockClientId ]\n\t);\n\n\tconst selectedValue = activeBlockVariation?.name;\n\n\t// Check if each variation has a unique icon.\n\tconst hasUniqueIcons = useMemo( () => {\n\t\tconst variationIcons = new Set();\n\t\tif ( ! variations ) {\n\t\t\treturn false;\n\t\t}\n\t\tvariations.forEach( ( variation ) => {\n\t\t\tif ( variation.icon ) {\n\t\t\t\tvariationIcons.add( variation.icon?.src || variation.icon );\n\t\t\t}\n\t\t} );\n\t\treturn variationIcons.size === variations.length;\n\t}, [ variations ] );\n\n\tconst onSelectVariation = ( variationName ) => {\n\t\tupdateBlockAttributes( blockClientId, {\n\t\t\t...variations.find( ( { name } ) => name === variationName )\n\t\t\t\t.attributes,\n\t\t} );\n\t};\n\n\tconst baseClass = 'block-editor-block-variation-transforms';\n\n\t// Skip rendering if there are no variations\n\tif ( ! variations?.length ) return null;\n\n\tconst Component = hasUniqueIcons ? VariationsButtons : VariationsDropdown;\n\n\treturn (\n\t\t<Component\n\t\t\tclassName={ baseClass }\n\t\t\tonSelectVariation={ onSelectVariation }\n\t\t\tselectedValue={ selectedValue }\n\t\t\tvariations={ variations }\n\t\t/>\n\t);\n}\n\nexport default __experimentalBlockVariationTransforms;\n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IACvBhD,iBAAiB,EAAGA,iBAAmB;IACvCC,aAAa,EAAGA,aAAe;IAC/BC,UAAU,EAAGA;EAAY,CACzB,CAAC;AAEJ;AAEA,eAAe0B,sCAAsC"}
1
+ {"version":3,"names":["store","blocksStore","__","sprintf","Button","DropdownMenu","MenuGroup","MenuItemsChoice","__experimentalToggleGroupControl","ToggleGroupControl","__experimentalToggleGroupControlOptionIcon","ToggleGroupControlOptionIcon","VisuallyHidden","useSelect","useDispatch","useMemo","chevronDown","BlockIcon","blockEditorStore","VariationsButtons","className","onSelectVariation","selectedValue","variations","createElement","as","map","variation","key","name","icon","showColors","isPressed","label","title","onClick","showTooltip","VariationsDropdown","selectOptions","description","value","info","text","popoverProps","position","toggleProps","iconPosition","choices","onSelect","VariationsToggleGroupControl","hideLabelFromVision","onChange","__next40pxDefaultSize","__nextHasNoMarginBottom","__experimentalBlockVariationTransforms","blockClientId","updateBlockAttributes","activeBlockVariation","select","getActiveBlockVariation","getBlockVariations","getBlockName","getBlockAttributes","hasUniqueIcons","variationIcons","Set","forEach","add","src","size","length","variationName","find","attributes","baseClass","showButtons","ButtonComponent","Component"],"sources":["@wordpress/block-editor/src/components/block-variation-transforms/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tButton,\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItemsChoice,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { chevronDown } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\nimport { store as blockEditorStore } from '../../store';\n\nfunction VariationsButtons( {\n\tclassName,\n\tonSelectVariation,\n\tselectedValue,\n\tvariations,\n} ) {\n\treturn (\n\t\t<fieldset className={ className }>\n\t\t\t<VisuallyHidden as=\"legend\">\n\t\t\t\t{ __( 'Transform to variation' ) }\n\t\t\t</VisuallyHidden>\n\t\t\t{ variations.map( ( variation ) => (\n\t\t\t\t<Button\n\t\t\t\t\tkey={ variation.name }\n\t\t\t\t\ticon={ <BlockIcon icon={ variation.icon } showColors /> }\n\t\t\t\t\tisPressed={ selectedValue === variation.name }\n\t\t\t\t\tlabel={\n\t\t\t\t\t\tselectedValue === variation.name\n\t\t\t\t\t\t\t? variation.title\n\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: Name of the block variation */\n\t\t\t\t\t\t\t\t\t__( 'Transform to %s' ),\n\t\t\t\t\t\t\t\t\tvariation.title\n\t\t\t\t\t\t\t )\n\t\t\t\t\t}\n\t\t\t\t\tonClick={ () => onSelectVariation( variation.name ) }\n\t\t\t\t\taria-label={ variation.title }\n\t\t\t\t\tshowTooltip\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</fieldset>\n\t);\n}\n\nfunction VariationsDropdown( {\n\tclassName,\n\tonSelectVariation,\n\tselectedValue,\n\tvariations,\n} ) {\n\tconst selectOptions = variations.map(\n\t\t( { name, title, description } ) => ( {\n\t\t\tvalue: name,\n\t\t\tlabel: title,\n\t\t\tinfo: description,\n\t\t} )\n\t);\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\tclassName={ className }\n\t\t\tlabel={ __( 'Transform to variation' ) }\n\t\t\ttext={ __( 'Transform to variation' ) }\n\t\t\tpopoverProps={ {\n\t\t\t\tposition: 'bottom center',\n\t\t\t\tclassName: `${ className }__popover`,\n\t\t\t} }\n\t\t\ticon={ chevronDown }\n\t\t\ttoggleProps={ { iconPosition: 'right' } }\n\t\t>\n\t\t\t{ () => (\n\t\t\t\t<div className={ `${ className }__container` }>\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItemsChoice\n\t\t\t\t\t\t\tchoices={ selectOptions }\n\t\t\t\t\t\t\tvalue={ selectedValue }\n\t\t\t\t\t\t\tonSelect={ onSelectVariation }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n\nfunction VariationsToggleGroupControl( {\n\tclassName,\n\tonSelectVariation,\n\tselectedValue,\n\tvariations,\n} ) {\n\treturn (\n\t\t<div className={ className }>\n\t\t\t<ToggleGroupControl\n\t\t\t\tlabel={ __( 'Transform to variation' ) }\n\t\t\t\tvalue={ selectedValue }\n\t\t\t\thideLabelFromVision\n\t\t\t\tonChange={ onSelectVariation }\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t>\n\t\t\t\t{ variations.map( ( variation ) => (\n\t\t\t\t\t<ToggleGroupControlOptionIcon\n\t\t\t\t\t\tkey={ variation.name }\n\t\t\t\t\t\ticon={ variation.icon }\n\t\t\t\t\t\tvalue={ variation.name }\n\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\tselectedValue === variation.name\n\t\t\t\t\t\t\t\t? variation.title\n\t\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t\t/* translators: %s: Name of the block variation */\n\t\t\t\t\t\t\t\t\t\t__( 'Transform to %s' ),\n\t\t\t\t\t\t\t\t\t\tvariation.title\n\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) ) }\n\t\t\t</ToggleGroupControl>\n\t\t</div>\n\t);\n}\n\nfunction __experimentalBlockVariationTransforms( { blockClientId } ) {\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\tconst { activeBlockVariation, variations } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getActiveBlockVariation, getBlockVariations } =\n\t\t\t\tselect( blocksStore );\n\t\t\tconst { getBlockName, getBlockAttributes } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst name = blockClientId && getBlockName( blockClientId );\n\t\t\treturn {\n\t\t\t\tactiveBlockVariation: getActiveBlockVariation(\n\t\t\t\t\tname,\n\t\t\t\t\tgetBlockAttributes( blockClientId )\n\t\t\t\t),\n\t\t\t\tvariations: name && getBlockVariations( name, 'transform' ),\n\t\t\t};\n\t\t},\n\t\t[ blockClientId ]\n\t);\n\n\tconst selectedValue = activeBlockVariation?.name;\n\n\t// Check if each variation has a unique icon.\n\tconst hasUniqueIcons = useMemo( () => {\n\t\tconst variationIcons = new Set();\n\t\tif ( ! variations ) {\n\t\t\treturn false;\n\t\t}\n\t\tvariations.forEach( ( variation ) => {\n\t\t\tif ( variation.icon ) {\n\t\t\t\tvariationIcons.add( variation.icon?.src || variation.icon );\n\t\t\t}\n\t\t} );\n\t\treturn variationIcons.size === variations.length;\n\t}, [ variations ] );\n\n\tconst onSelectVariation = ( variationName ) => {\n\t\tupdateBlockAttributes( blockClientId, {\n\t\t\t...variations.find( ( { name } ) => name === variationName )\n\t\t\t\t.attributes,\n\t\t} );\n\t};\n\n\t// Skip rendering if there are no variations\n\tif ( ! variations?.length ) return null;\n\n\tconst baseClass = 'block-editor-block-variation-transforms';\n\n\t// Show buttons if there are more than 5 variations because the ToggleGroupControl does not wrap\n\tconst showButtons = variations.length > 5;\n\n\tconst ButtonComponent = showButtons\n\t\t? VariationsButtons\n\t\t: VariationsToggleGroupControl;\n\n\tconst Component = hasUniqueIcons ? ButtonComponent : VariationsDropdown;\n\n\treturn (\n\t\t<Component\n\t\t\tclassName={ baseClass }\n\t\t\tonSelectVariation={ onSelectVariation }\n\t\t\tselectedValue={ selectedValue }\n\t\t\tvariations={ variations }\n\t\t/>\n\t);\n}\n\nexport default __experimentalBlockVariationTransforms;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;AACxD,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SACCC,MAAM,EACNC,YAAY,EACZC,SAAS,EACTC,eAAe,EACfC,g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S,CAACG,IAAK,CAAC;MAC5D;IACD,CAAE,CAAC;IACH,OAAOkC,cAAc,CAACK,IAAI,KAAK9C,UAAU,CAAC+C,MAAM;EACjD,CAAC,EAAE,CAAE/C,UAAU,CAAG,CAAC;EAEnB,MAAMF,iBAAiB,GAAKkD,aAAa,IAAM;IAC9Cf,qBAAqB,CAAED,aAAa,EAAE;MACrC,GAAGhC,UAAU,CAACiD,IAAI,CAAE,CAAE;QAAE3C;MAAK,CAAC,KAAMA,IAAI,KAAK0C,aAAc,CAAC,CAC1DE;IACH,CAAE,CAAC;EACJ,CAAC;;EAED;EACA,IAAK,CAAElD,UAAU,EAAE+C,MAAM,EAAG,OAAO,IAAI;EAEvC,MAAMI,SAAS,GAAG,yCAAyC;;EAE3D;EACA,MAAMC,WAAW,GAAGpD,UAAU,CAAC+C,MAAM,GAAG,CAAC;EAEzC,MAAMM,eAAe,GAAGD,WAAW,GAChCxD,iBAAiB,GACjB8B,4BAA4B;EAE/B,MAAM4B,SAAS,GAAGd,cAAc,GAAGa,eAAe,GAAGvC,kBAAkB;EAEvE,OACCb,aAAA,CAACqD,SAAS;IACTzD,SAAS,EAAGsD,SAAW;IACvBrD,iBAAiB,EAAGA,iBAAmB;IACvCC,aAAa,EAAGA,aAAe;IAC/BC,UAAU,EAAGA;EAAY,CACzB,CAAC;AAEJ;AAEA,eAAe+B,sCAAsC"}
@@ -15,7 +15,7 @@ export default function LinkedButton({
15
15
  }, createElement(Button, {
16
16
  ...props,
17
17
  className: "component-border-radius-control__linked-button",
18
- isSmall: true,
18
+ size: "small",
19
19
  icon: isLinked ? link : linkOff,
20
20
  iconSize: 24,
21
21
  "aria-label": label
@@ -1 +1 @@
1
- {"version":3,"names":["Button","Tooltip","link","linkOff","__","LinkedButton","isLinked","props","label","createElement","text","className","isSmall","icon","iconSize"],"sources":["@wordpress/block-editor/src/components/border-radius-control/linked-button.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button, Tooltip } from '@wordpress/components';\nimport { link, linkOff } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\nexport default function LinkedButton( { isLinked, ...props } ) {\n\tconst label = isLinked ? __( 'Unlink radii' ) : __( 'Link radii' );\n\n\treturn (\n\t\t<Tooltip text={ label }>\n\t\t\t<Button\n\t\t\t\t{ ...props }\n\t\t\t\tclassName=\"component-border-radius-control__linked-button\"\n\t\t\t\tisSmall\n\t\t\t\ticon={ isLinked ? link : linkOff }\n\t\t\t\ticonSize={ 24 }\n\t\t\t\taria-label={ label }\n\t\t\t/>\n\t\t</Tooltip>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,MAAM,EAAEC,OAAO,QAAQ,uBAAuB;AACvD,SAASC,IAAI,EAAEC,OAAO,QAAQ,kBAAkB;AAChD,SAASC,EAAE,QAAQ,iBAAiB;AAEpC,eAAe,SAASC,YAAYA,CAAE;EAAEC,QAAQ;EAAE,GAAGC;AAAM,CAAC,EAAG;EAC9D,MAAMC,KAAK,GAAGF,QAAQ,GAAGF,EAAE,CAAE,cAAe,CAAC,GAAGA,EAAE,CAAE,YAAa,CAAC;EAElE,OACCK,aAAA,CAACR,OAAO;IAACS,IAAI,EAAGF;EAAO,GACtBC,aAAA,CAACT,MAAM;IAAA,GACDO,KAAK;IACVI,SAAS,EAAC,gDAAgD;IAC1DC,OAAO;IACPC,IAAI,EAAGP,QAAQ,GAAGJ,IAAI,GAAGC,OAAS;IAClCW,QAAQ,EAAG,EAAI;IACf,cAAaN;EAAO,CACpB,CACO,CAAC;AAEZ"}
1
+ {"version":3,"names":["Button","Tooltip","link","linkOff","__","LinkedButton","isLinked","props","label","createElement","text","className","size","icon","iconSize"],"sources":["@wordpress/block-editor/src/components/border-radius-control/linked-button.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Button, Tooltip } from '@wordpress/components';\nimport { link, linkOff } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\nexport default function LinkedButton( { isLinked, ...props } ) {\n\tconst label = isLinked ? __( 'Unlink radii' ) : __( 'Link radii' );\n\n\treturn (\n\t\t<Tooltip text={ label }>\n\t\t\t<Button\n\t\t\t\t{ ...props }\n\t\t\t\tclassName=\"component-border-radius-control__linked-button\"\n\t\t\t\tsize=\"small\"\n\t\t\t\ticon={ isLinked ? link : linkOff }\n\t\t\t\ticonSize={ 24 }\n\t\t\t\taria-label={ label }\n\t\t\t/>\n\t\t</Tooltip>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,MAAM,EAAEC,OAAO,QAAQ,uBAAuB;AACvD,SAASC,IAAI,EAAEC,OAAO,QAAQ,kBAAkB;AAChD,SAASC,EAAE,QAAQ,iBAAiB;AAEpC,eAAe,SAASC,YAAYA,CAAE;EAAEC,QAAQ;EAAE,GAAGC;AAAM,CAAC,EAAG;EAC9D,MAAMC,KAAK,GAAGF,QAAQ,GAAGF,EAAE,CAAE,cAAe,CAAC,GAAGA,EAAE,CAAE,YAAa,CAAC;EAElE,OACCK,aAAA,CAACR,OAAO;IAACS,IAAI,EAAGF;EAAO,GACtBC,aAAA,CAACT,MAAM;IAAA,GACDO,KAAK;IACVI,SAAS,EAAC,gDAAgD;IAC1DC,IAAI,EAAC,OAAO;IACZC,IAAI,EAAGP,QAAQ,GAAGJ,IAAI,GAAGC,OAAS;IAClCW,QAAQ,EAAG,EAAI;IACf,cAAaN;EAAO,CACpB,CACO,CAAC;AAEZ"}
@@ -5,10 +5,15 @@ import { colord, extend } from 'colord';
5
5
  import namesPlugin from 'colord/plugins/names';
6
6
  import a11yPlugin from 'colord/plugins/a11y';
7
7
 
8
+ /**
9
+ * WordPress dependencies
10
+ */
11
+ import { privateApis as componentsPrivateApis } from '@wordpress/components';
12
+
8
13
  /**
9
14
  * Internal dependencies
10
15
  */
11
- import { kebabCase } from '../../utils/object';
16
+ import { unlock } from '../../lock-unlock';
12
17
  extend([namesPlugin, a11yPlugin]);
13
18
 
14
19
  /**
@@ -61,6 +66,9 @@ export function getColorClassName(colorContextName, colorSlug) {
61
66
  if (!colorContextName || !colorSlug) {
62
67
  return undefined;
63
68
  }
69
+ const {
70
+ kebabCase
71
+ } = unlock(componentsPrivateApis);
64
72
  return `has-${kebabCase(colorSlug)}-${colorContextName}`;
65
73
  }
66
74
 
@@ -1 +1 @@
1
- {"version":3,"names":["colord","extend","namesPlugin","a11yPlugin","kebabCase","getColorObjectByAttributeValues","colors","definedColor","customColor","colorObj","find","color","slug","getColorObjectByColorValue","colorValue","getColorClassName","colorContextName","colorSlug","undefined","getMostReadableColor","colordColor","getColorContrast","contrast","maxContrast","Math","max","map"],"sources":["@wordpress/block-editor/src/components/colors/utils.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { colord, extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\nimport a11yPlugin from 'colord/plugins/a11y';\n\n/**\n * Internal dependencies\n */\nimport { kebabCase } from '../../utils/object';\n\nextend( [ namesPlugin, a11yPlugin ] );\n\n/**\n * Provided an array of color objects as set by the theme or by the editor defaults,\n * and the values of the defined color or custom color returns a color object describing the color.\n *\n * @param {Array} colors Array of color objects as set by the theme or by the editor defaults.\n * @param {?string} definedColor A string containing the color slug.\n * @param {?string} customColor A string containing the customColor value.\n *\n * @return {?Object} If definedColor is passed and the name is found in colors,\n * the color object exactly as set by the theme or editor defaults is returned.\n * Otherwise, an object that just sets the color is defined.\n */\nexport const getColorObjectByAttributeValues = (\n\tcolors,\n\tdefinedColor,\n\tcustomColor\n) => {\n\tif ( definedColor ) {\n\t\tconst colorObj = colors?.find(\n\t\t\t( color ) => color.slug === definedColor\n\t\t);\n\n\t\tif ( colorObj ) {\n\t\t\treturn colorObj;\n\t\t}\n\t}\n\treturn {\n\t\tcolor: customColor,\n\t};\n};\n\n/**\n * Provided an array of color objects as set by the theme or by the editor defaults, and a color value returns the color object matching that value or undefined.\n *\n * @param {Array} colors Array of color objects as set by the theme or by the editor defaults.\n * @param {?string} colorValue A string containing the color value.\n *\n * @return {?Object} Color object included in the colors array whose color property equals colorValue.\n * Returns undefined if no color object matches this requirement.\n */\nexport const getColorObjectByColorValue = ( colors, colorValue ) => {\n\treturn colors?.find( ( color ) => color.color === colorValue );\n};\n\n/**\n * Returns a class based on the context a color is being used and its slug.\n *\n * @param {string} colorContextName Context/place where color is being used e.g: background, text etc...\n * @param {string} colorSlug Slug of the color.\n *\n * @return {?string} String with the class corresponding to the color in the provided context.\n * Returns undefined if either colorContextName or colorSlug are not provided.\n */\nexport function getColorClassName( colorContextName, colorSlug ) {\n\tif ( ! colorContextName || ! colorSlug ) {\n\t\treturn undefined;\n\t}\n\n\treturn `has-${ kebabCase( colorSlug ) }-${ colorContextName }`;\n}\n\n/**\n * Given an array of color objects and a color value returns the color value of the most readable color in the array.\n *\n * @param {Array} colors Array of color objects as set by the theme or by the editor defaults.\n * @param {?string} colorValue A string containing the color value.\n *\n * @return {string} String with the color value of the most readable color.\n */\nexport function getMostReadableColor( colors, colorValue ) {\n\tconst colordColor = colord( colorValue );\n\tconst getColorContrast = ( { color } ) => colordColor.contrast( color );\n\n\tconst maxContrast = Math.max( ...colors.map( getColorContrast ) );\n\treturn colors.find( ( color ) => getColorContrast( color ) === maxContrast )\n\t\t.color;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAM,EAAEC,MAAM,QAAQ,QAAQ;AACvC,OAAOC,WAAW,MAAM,sBAAsB;AAC9C,OAAOC,UAAU,MAAM,qBAAqB;;AAE5C;AACA;AACA;AACA,SAASC,SAAS,QAAQ,oBAAoB;AAE9CH,MAAM,CAAE,CAAEC,WAAW,EAAEC,UAAU,CAAG,CAAC;;AAErC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAME,+BAA+B,GAAGA,CAC9CC,MAAM,EACNC,YAAY,EACZC,WAAW,KACP;EACJ,IAAKD,YAAY,EAAG;IACnB,MAAME,QAAQ,GAAGH,MAAM,EAAEI,IAAI,CAC1BC,KAAK,IAAMA,KAAK,CAACC,IAAI,KAAKL,YAC7B,CAAC;IAED,IAAKE,QAAQ,EAAG;MACf,OAAOA,QAAQ;IAChB;EACD;EACA,OAAO;IACNE,KAAK,EAAEH;EACR,CAAC;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMK,0BAA0B,GAAGA,CAAEP,MAAM,EAAEQ,UAAU,KAAM;EACnE,OAAOR,MAAM,EAAEI,IAAI,CAAIC,KAAK,IAAMA,KAAK,CAACA,KAAK,KAAKG,UAAW,CAAC;AAC/D,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAAEC,gBAAgB,EAAEC,SAAS,EAAG;EAChE,IAAK,CAAED,gBAAgB,IAAI,CAAEC,SAAS,EAAG;IACxC,OAAOC,SAAS;EACjB;EAEA,OAAQ,OAAOd,SAAS,CAAEa,SAAU,CAAG,IAAID,gBAAkB,EAAC;AAC/D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,oBAAoBA,CAAEb,MAAM,EAAEQ,UAAU,EAAG;EAC1D,MAAMM,WAAW,GAAGpB,MAAM,CAAEc,UAAW,CAAC;EACxC,MAAMO,gBAAgB,GAAGA,CAAE;IAAEV;EAAM,CAAC,KAAMS,WAAW,CAACE,QAAQ,CAAEX,KAAM,CAAC;EAEvE,MAAMY,WAAW,GAAGC,IAAI,CAACC,GAAG,CAAE,GAAGnB,MAAM,CAACoB,GAAG,CAAEL,gBAAiB,CAAE,CAAC;EACjE,OAAOf,MAAM,CAACI,IAAI,CAAIC,KAAK,IAAMU,gBAAgB,CAAEV,KAAM,CAAC,KAAKY,WAAY,CAAC,CAC1EZ,KAAK;AACR"}
1
+ {"version":3,"names":["colord","extend","namesPlugin","a11yPlugin","privateApis","componentsPrivateApis","unlock","getColorObjectByAttributeValues","colors","definedColor","customColor","colorObj","find","color","slug","getColorObjectByColorValue","colorValue","getColorClassName","colorContextName","colorSlug","undefined","kebabCase","getMostReadableColor","colordColor","getColorContrast","contrast","maxContrast","Math","max","map"],"sources":["@wordpress/block-editor/src/components/colors/utils.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { colord, extend } from 'colord';\nimport namesPlugin from 'colord/plugins/names';\nimport a11yPlugin from 'colord/plugins/a11y';\n\n/**\n * WordPress dependencies\n */\nimport { privateApis as componentsPrivateApis } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nextend( [ namesPlugin, a11yPlugin ] );\n\n/**\n * Provided an array of color objects as set by the theme or by the editor defaults,\n * and the values of the defined color or custom color returns a color object describing the color.\n *\n * @param {Array} colors Array of color objects as set by the theme or by the editor defaults.\n * @param {?string} definedColor A string containing the color slug.\n * @param {?string} customColor A string containing the customColor value.\n *\n * @return {?Object} If definedColor is passed and the name is found in colors,\n * the color object exactly as set by the theme or editor defaults is returned.\n * Otherwise, an object that just sets the color is defined.\n */\nexport const getColorObjectByAttributeValues = (\n\tcolors,\n\tdefinedColor,\n\tcustomColor\n) => {\n\tif ( definedColor ) {\n\t\tconst colorObj = colors?.find(\n\t\t\t( color ) => color.slug === definedColor\n\t\t);\n\n\t\tif ( colorObj ) {\n\t\t\treturn colorObj;\n\t\t}\n\t}\n\treturn {\n\t\tcolor: customColor,\n\t};\n};\n\n/**\n * Provided an array of color objects as set by the theme or by the editor defaults, and a color value returns the color object matching that value or undefined.\n *\n * @param {Array} colors Array of color objects as set by the theme or by the editor defaults.\n * @param {?string} colorValue A string containing the color value.\n *\n * @return {?Object} Color object included in the colors array whose color property equals colorValue.\n * Returns undefined if no color object matches this requirement.\n */\nexport const getColorObjectByColorValue = ( colors, colorValue ) => {\n\treturn colors?.find( ( color ) => color.color === colorValue );\n};\n\n/**\n * Returns a class based on the context a color is being used and its slug.\n *\n * @param {string} colorContextName Context/place where color is being used e.g: background, text etc...\n * @param {string} colorSlug Slug of the color.\n *\n * @return {?string} String with the class corresponding to the color in the provided context.\n * Returns undefined if either colorContextName or colorSlug are not provided.\n */\nexport function getColorClassName( colorContextName, colorSlug ) {\n\tif ( ! colorContextName || ! colorSlug ) {\n\t\treturn undefined;\n\t}\n\n\tconst { kebabCase } = unlock( componentsPrivateApis );\n\n\treturn `has-${ kebabCase( colorSlug ) }-${ colorContextName }`;\n}\n\n/**\n * Given an array of color objects and a color value returns the color value of the most readable color in the array.\n *\n * @param {Array} colors Array of color objects as set by the theme or by the editor defaults.\n * @param {?string} colorValue A string containing the color value.\n *\n * @return {string} String with the color value of the most readable color.\n */\nexport function getMostReadableColor( colors, colorValue ) {\n\tconst colordColor = colord( colorValue );\n\tconst getColorContrast = ( { color } ) => colordColor.contrast( color );\n\n\tconst maxContrast = Math.max( ...colors.map( getColorContrast ) );\n\treturn colors.find( ( color ) => getColorContrast( color ) === maxContrast )\n\t\t.color;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAM,EAAEC,MAAM,QAAQ,QAAQ;AACvC,OAAOC,WAAW,MAAM,sBAAsB;AAC9C,OAAOC,UAAU,MAAM,qBAAqB;;AAE5C;AACA;AACA;AACA,SAASC,WAAW,IAAIC,qBAAqB,QAAQ,uBAAuB;;AAE5E;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAE1CL,MAAM,CAAE,CAAEC,WAAW,EAAEC,UAAU,CAAG,CAAC;;AAErC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMI,+BAA+B,GAAGA,CAC9CC,MAAM,EACNC,YAAY,EACZC,WAAW,KACP;EACJ,IAAKD,YAAY,EAAG;IACnB,MAAME,QAAQ,GAAGH,MAAM,EAAEI,IAAI,CAC1BC,KAAK,IAAMA,KAAK,CAACC,IAAI,KAAKL,YAC7B,CAAC;IAED,IAAKE,QAAQ,EAAG;MACf,OAAOA,QAAQ;IAChB;EACD;EACA,OAAO;IACNE,KAAK,EAAEH;EACR,CAAC;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMK,0BAA0B,GAAGA,CAAEP,MAAM,EAAEQ,UAAU,KAAM;EACnE,OAAOR,MAAM,EAAEI,IAAI,CAAIC,KAAK,IAAMA,KAAK,CAACA,KAAK,KAAKG,UAAW,CAAC;AAC/D,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAAEC,gBAAgB,EAAEC,SAAS,EAAG;EAChE,IAAK,CAAED,gBAAgB,IAAI,CAAEC,SAAS,EAAG;IACxC,OAAOC,SAAS;EACjB;EAEA,MAAM;IAAEC;EAAU,CAAC,GAAGf,MAAM,CAAED,qBAAsB,CAAC;EAErD,OAAQ,OAAOgB,SAAS,CAAEF,SAAU,CAAG,IAAID,gBAAkB,EAAC;AAC/D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,oBAAoBA,CAAEd,MAAM,EAAEQ,UAAU,EAAG;EAC1D,MAAMO,WAAW,GAAGvB,MAAM,CAAEgB,UAAW,CAAC;EACxC,MAAMQ,gBAAgB,GAAGA,CAAE;IAAEX;EAAM,CAAC,KAAMU,WAAW,CAACE,QAAQ,CAAEZ,KAAM,CAAC;EAEvE,MAAMa,WAAW,GAAGC,IAAI,CAACC,GAAG,CAAE,GAAGpB,MAAM,CAACqB,GAAG,CAAEL,gBAAiB,CAAE,CAAC;EACjE,OAAOhB,MAAM,CAACI,IAAI,CAAIC,KAAK,IAAMW,gBAAgB,CAAEX,KAAM,CAAC,KAAKa,WAAY,CAAC,CAC1Eb,KAAK;AACR"}
@@ -4,13 +4,14 @@ import { createElement } from "react";
4
4
  */
5
5
  import { useMemo, Component } from '@wordpress/element';
6
6
  import { compose, createHigherOrderComponent } from '@wordpress/compose';
7
+ import { privateApis as componentsPrivateApis } from '@wordpress/components';
7
8
 
8
9
  /**
9
10
  * Internal dependencies
10
11
  */
11
12
  import { getColorClassName, getColorObjectByColorValue, getColorObjectByAttributeValues, getMostReadableColor } from './utils';
12
13
  import { useSettings } from '../use-settings';
13
- import { kebabCase } from '../../utils/object';
14
+ import { unlock } from '../../lock-unlock';
14
15
 
15
16
  /**
16
17
  * Capitalizes the first letter in a string.
@@ -59,6 +60,9 @@ const withEditorColorPalette = () => createHigherOrderComponent(WrappedComponent
59
60
  * @return {Component} The component that can be used as a HOC.
60
61
  */
61
62
  function createColorHOC(colorTypes, withColorPalette) {
63
+ const {
64
+ kebabCase
65
+ } = unlock(componentsPrivateApis);
62
66
  const colorMap = colorTypes.reduce((colorObject, colorType) => {
63
67
  return {
64
68
  ...colorObject,