@wordpress/block-library 8.0.0 → 8.1.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 (450) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/categories/edit.js +1 -1
  3. package/build/categories/edit.js.map +1 -1
  4. package/build/cover/edit/inspector-controls.js +1 -1
  5. package/build/cover/edit/inspector-controls.js.map +1 -1
  6. package/build/freeform/edit.js +21 -6
  7. package/build/freeform/edit.js.map +1 -1
  8. package/build/freeform/modal.js +97 -0
  9. package/build/freeform/modal.js.map +1 -0
  10. package/build/gallery/edit.js +13 -2
  11. package/build/gallery/edit.js.map +1 -1
  12. package/build/gallery/gallery.js +2 -16
  13. package/build/gallery/gallery.js.map +1 -1
  14. package/build/image/image.js +1 -0
  15. package/build/image/image.js.map +1 -1
  16. package/build/media-text/edit.js +1 -0
  17. package/build/media-text/edit.js.map +1 -1
  18. package/build/missing/edit.native.js +2 -2
  19. package/build/missing/edit.native.js.map +1 -1
  20. package/build/navigation/edit/index.js +3 -4
  21. package/build/navigation/edit/index.js.map +1 -1
  22. package/build/navigation/edit/menu-inspector-controls.js +29 -7
  23. package/build/navigation/edit/menu-inspector-controls.js.map +1 -1
  24. package/build/navigation/edit/navigation-menu-selector.js +11 -8
  25. package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
  26. package/build/navigation/edit/utils.js +81 -0
  27. package/build/navigation/edit/utils.js.map +1 -1
  28. package/build/navigation-link/edit.js +4 -58
  29. package/build/navigation-link/edit.js.map +1 -1
  30. package/build/navigation-submenu/edit.js +7 -72
  31. package/build/navigation-submenu/edit.js.map +1 -1
  32. package/build/page-list/edit.js +16 -15
  33. package/build/page-list/edit.js.map +1 -1
  34. package/build/page-list/index.js +29 -2
  35. package/build/page-list/index.js.map +1 -1
  36. package/build/page-list-item/edit.js +9 -5
  37. package/build/page-list-item/edit.js.map +1 -1
  38. package/build/post-featured-image/overlay.js +0 -1
  39. package/build/post-featured-image/overlay.js.map +1 -1
  40. package/build/query/edit/index.js +2 -1
  41. package/build/query/edit/index.js.map +1 -1
  42. package/build/query/edit/inspector-controls/index.js +10 -5
  43. package/build/query/edit/inspector-controls/index.js.map +1 -1
  44. package/build/query/edit/inspector-controls/taxonomy-controls.js +101 -37
  45. package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  46. package/build/query/edit/query-content.js +2 -3
  47. package/build/query/edit/query-content.js.map +1 -1
  48. package/build/query/edit/query-placeholder.js +17 -12
  49. package/build/query/edit/query-placeholder.js.map +1 -1
  50. package/build/query/utils.js +73 -1
  51. package/build/query/utils.js.map +1 -1
  52. package/build/search/edit.js +2 -2
  53. package/build/search/edit.js.map +1 -1
  54. package/build/social-link/edit.js.map +1 -1
  55. package/build/social-links/edit.js +0 -1
  56. package/build/social-links/edit.js.map +1 -1
  57. package/build/table-of-contents/edit.js +1 -1
  58. package/build/table-of-contents/edit.js.map +1 -1
  59. package/build/template-part/edit/advanced-controls.js +11 -1
  60. package/build/template-part/edit/advanced-controls.js.map +1 -1
  61. package/build/template-part/edit/import-controls.js +160 -0
  62. package/build/template-part/edit/import-controls.js.map +1 -0
  63. package/build/template-part/edit/index.js +2 -1
  64. package/build/template-part/edit/index.js.map +1 -1
  65. package/build/template-part/edit/utils/transformers.js +48 -0
  66. package/build/template-part/edit/utils/transformers.js.map +1 -0
  67. package/build-module/categories/edit.js +1 -1
  68. package/build-module/categories/edit.js.map +1 -1
  69. package/build-module/cover/edit/inspector-controls.js +3 -3
  70. package/build-module/cover/edit/inspector-controls.js.map +1 -1
  71. package/build-module/freeform/edit.js +22 -8
  72. package/build-module/freeform/edit.js.map +1 -1
  73. package/build-module/freeform/modal.js +90 -0
  74. package/build-module/freeform/modal.js.map +1 -0
  75. package/build-module/gallery/edit.js +14 -3
  76. package/build-module/gallery/edit.js.map +1 -1
  77. package/build-module/gallery/gallery.js +3 -16
  78. package/build-module/gallery/gallery.js.map +1 -1
  79. package/build-module/image/image.js +1 -0
  80. package/build-module/image/image.js.map +1 -1
  81. package/build-module/media-text/edit.js +1 -0
  82. package/build-module/media-text/edit.js.map +1 -1
  83. package/build-module/missing/edit.native.js +2 -2
  84. package/build-module/missing/edit.native.js.map +1 -1
  85. package/build-module/navigation/edit/index.js +3 -4
  86. package/build-module/navigation/edit/index.js.map +1 -1
  87. package/build-module/navigation/edit/menu-inspector-controls.js +30 -9
  88. package/build-module/navigation/edit/menu-inspector-controls.js.map +1 -1
  89. package/build-module/navigation/edit/navigation-menu-selector.js +12 -9
  90. package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
  91. package/build-module/navigation/edit/utils.js +75 -0
  92. package/build-module/navigation/edit/utils.js.map +1 -1
  93. package/build-module/navigation-link/edit.js +4 -59
  94. package/build-module/navigation-link/edit.js.map +1 -1
  95. package/build-module/navigation-submenu/edit.js +6 -72
  96. package/build-module/navigation-submenu/edit.js.map +1 -1
  97. package/build-module/page-list/edit.js +17 -15
  98. package/build-module/page-list/edit.js.map +1 -1
  99. package/build-module/page-list/index.js +30 -3
  100. package/build-module/page-list/index.js.map +1 -1
  101. package/build-module/page-list-item/edit.js +9 -6
  102. package/build-module/page-list-item/edit.js.map +1 -1
  103. package/build-module/post-featured-image/overlay.js +0 -1
  104. package/build-module/post-featured-image/overlay.js.map +1 -1
  105. package/build-module/query/edit/index.js +2 -1
  106. package/build-module/query/edit/index.js.map +1 -1
  107. package/build-module/query/edit/inspector-controls/index.js +10 -5
  108. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  109. package/build-module/query/edit/inspector-controls/taxonomy-controls.js +99 -35
  110. package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  111. package/build-module/query/edit/query-content.js +1 -1
  112. package/build-module/query/edit/query-content.js.map +1 -1
  113. package/build-module/query/edit/query-placeholder.js +16 -12
  114. package/build-module/query/edit/query-placeholder.js.map +1 -1
  115. package/build-module/query/utils.js +69 -0
  116. package/build-module/query/utils.js.map +1 -1
  117. package/build-module/search/edit.js +2 -2
  118. package/build-module/search/edit.js.map +1 -1
  119. package/build-module/social-link/edit.js +2 -2
  120. package/build-module/social-link/edit.js.map +1 -1
  121. package/build-module/social-links/edit.js +0 -1
  122. package/build-module/social-links/edit.js.map +1 -1
  123. package/build-module/table-of-contents/edit.js +1 -1
  124. package/build-module/table-of-contents/edit.js.map +1 -1
  125. package/build-module/template-part/edit/advanced-controls.js +10 -1
  126. package/build-module/template-part/edit/advanced-controls.js.map +1 -1
  127. package/build-module/template-part/edit/import-controls.js +146 -0
  128. package/build-module/template-part/edit/import-controls.js.map +1 -0
  129. package/build-module/template-part/edit/index.js +2 -1
  130. package/build-module/template-part/edit/index.js.map +1 -1
  131. package/build-module/template-part/edit/utils/transformers.js +40 -0
  132. package/build-module/template-part/edit/utils/transformers.js.map +1 -0
  133. package/build-style/archives/editor-rtl.css +3 -3
  134. package/build-style/archives/editor.css +3 -3
  135. package/build-style/archives/style-rtl.css +3 -3
  136. package/build-style/archives/style.css +3 -3
  137. package/build-style/audio/editor-rtl.css +3 -3
  138. package/build-style/audio/editor.css +3 -3
  139. package/build-style/audio/style-rtl.css +3 -3
  140. package/build-style/audio/style.css +3 -3
  141. package/build-style/audio/theme-rtl.css +3 -3
  142. package/build-style/audio/theme.css +3 -3
  143. package/build-style/avatar/editor-rtl.css +3 -3
  144. package/build-style/avatar/editor.css +3 -3
  145. package/build-style/avatar/style-rtl.css +3 -3
  146. package/build-style/avatar/style.css +3 -3
  147. package/build-style/block/editor-rtl.css +3 -3
  148. package/build-style/block/editor.css +3 -3
  149. package/build-style/button/editor-rtl.css +3 -3
  150. package/build-style/button/editor.css +3 -3
  151. package/build-style/button/style-rtl.css +3 -3
  152. package/build-style/button/style.css +3 -3
  153. package/build-style/buttons/editor-rtl.css +3 -3
  154. package/build-style/buttons/editor.css +3 -3
  155. package/build-style/buttons/style-rtl.css +3 -3
  156. package/build-style/buttons/style.css +3 -3
  157. package/build-style/calendar/style-rtl.css +3 -3
  158. package/build-style/calendar/style.css +3 -3
  159. package/build-style/categories/editor-rtl.css +3 -3
  160. package/build-style/categories/editor.css +3 -3
  161. package/build-style/categories/style-rtl.css +3 -3
  162. package/build-style/categories/style.css +3 -3
  163. package/build-style/classic-rtl.css +3 -3
  164. package/build-style/classic.css +3 -3
  165. package/build-style/code/editor-rtl.css +3 -3
  166. package/build-style/code/editor.css +3 -3
  167. package/build-style/code/style-rtl.css +3 -3
  168. package/build-style/code/style.css +3 -3
  169. package/build-style/code/theme-rtl.css +3 -3
  170. package/build-style/code/theme.css +3 -3
  171. package/build-style/columns/editor-rtl.css +3 -3
  172. package/build-style/columns/editor.css +3 -3
  173. package/build-style/columns/style-rtl.css +3 -3
  174. package/build-style/columns/style.css +3 -3
  175. package/build-style/comment-author-avatar/editor-rtl.css +3 -3
  176. package/build-style/comment-author-avatar/editor.css +3 -3
  177. package/build-style/comment-content/style-rtl.css +3 -3
  178. package/build-style/comment-content/style.css +3 -3
  179. package/build-style/comment-template/style-rtl.css +3 -3
  180. package/build-style/comment-template/style.css +3 -3
  181. package/build-style/comments/editor-rtl.css +3 -3
  182. package/build-style/comments/editor.css +3 -3
  183. package/build-style/comments/style-rtl.css +3 -3
  184. package/build-style/comments/style.css +3 -3
  185. package/build-style/comments-pagination/editor-rtl.css +3 -3
  186. package/build-style/comments-pagination/editor.css +3 -3
  187. package/build-style/comments-pagination/style-rtl.css +3 -3
  188. package/build-style/comments-pagination/style.css +3 -3
  189. package/build-style/comments-pagination-numbers/editor-rtl.css +3 -3
  190. package/build-style/comments-pagination-numbers/editor.css +3 -3
  191. package/build-style/comments-title/editor-rtl.css +3 -3
  192. package/build-style/comments-title/editor.css +3 -3
  193. package/build-style/common-rtl.css +3 -3
  194. package/build-style/common.css +3 -3
  195. package/build-style/cover/editor-rtl.css +3 -3
  196. package/build-style/cover/editor.css +3 -3
  197. package/build-style/cover/style-rtl.css +3 -3
  198. package/build-style/cover/style.css +3 -3
  199. package/build-style/editor-elements-rtl.css +3 -3
  200. package/build-style/editor-elements.css +3 -3
  201. package/build-style/editor-rtl.css +7 -9
  202. package/build-style/editor.css +7 -9
  203. package/build-style/elements-rtl.css +3 -3
  204. package/build-style/elements.css +3 -3
  205. package/build-style/embed/editor-rtl.css +3 -3
  206. package/build-style/embed/editor.css +3 -3
  207. package/build-style/embed/style-rtl.css +3 -3
  208. package/build-style/embed/style.css +3 -3
  209. package/build-style/embed/theme-rtl.css +3 -3
  210. package/build-style/embed/theme.css +3 -3
  211. package/build-style/file/editor-rtl.css +3 -3
  212. package/build-style/file/editor.css +3 -3
  213. package/build-style/file/style-rtl.css +3 -3
  214. package/build-style/file/style.css +3 -3
  215. package/build-style/freeform/editor-rtl.css +3 -3
  216. package/build-style/freeform/editor.css +3 -3
  217. package/build-style/gallery/editor-rtl.css +3 -3
  218. package/build-style/gallery/editor.css +3 -3
  219. package/build-style/gallery/style-rtl.css +3 -3
  220. package/build-style/gallery/style.css +3 -3
  221. package/build-style/gallery/theme-rtl.css +3 -3
  222. package/build-style/gallery/theme.css +3 -3
  223. package/build-style/group/editor-rtl.css +3 -3
  224. package/build-style/group/editor.css +3 -3
  225. package/build-style/group/style-rtl.css +3 -3
  226. package/build-style/group/style.css +3 -3
  227. package/build-style/group/theme-rtl.css +3 -3
  228. package/build-style/group/theme.css +3 -3
  229. package/build-style/heading/style-rtl.css +3 -3
  230. package/build-style/heading/style.css +3 -3
  231. package/build-style/html/editor-rtl.css +3 -3
  232. package/build-style/html/editor.css +3 -3
  233. package/build-style/image/editor-rtl.css +3 -3
  234. package/build-style/image/editor.css +3 -3
  235. package/build-style/image/style-rtl.css +3 -3
  236. package/build-style/image/style.css +3 -3
  237. package/build-style/image/theme-rtl.css +3 -3
  238. package/build-style/image/theme.css +3 -3
  239. package/build-style/latest-comments/style-rtl.css +3 -3
  240. package/build-style/latest-comments/style.css +3 -3
  241. package/build-style/latest-posts/editor-rtl.css +3 -3
  242. package/build-style/latest-posts/editor.css +3 -3
  243. package/build-style/latest-posts/style-rtl.css +3 -3
  244. package/build-style/latest-posts/style.css +3 -3
  245. package/build-style/list/style-rtl.css +3 -3
  246. package/build-style/list/style.css +3 -3
  247. package/build-style/media-text/editor-rtl.css +3 -3
  248. package/build-style/media-text/editor.css +3 -3
  249. package/build-style/media-text/style-rtl.css +3 -3
  250. package/build-style/media-text/style.css +3 -3
  251. package/build-style/more/editor-rtl.css +3 -3
  252. package/build-style/more/editor.css +3 -3
  253. package/build-style/navigation/editor-rtl.css +3 -9
  254. package/build-style/navigation/editor.css +3 -9
  255. package/build-style/navigation/style-rtl.css +3 -4
  256. package/build-style/navigation/style.css +3 -4
  257. package/build-style/navigation-link/editor-rtl.css +3 -3
  258. package/build-style/navigation-link/editor.css +3 -3
  259. package/build-style/navigation-link/style-rtl.css +3 -3
  260. package/build-style/navigation-link/style.css +3 -3
  261. package/build-style/navigation-submenu/editor-rtl.css +3 -3
  262. package/build-style/navigation-submenu/editor.css +3 -3
  263. package/build-style/nextpage/editor-rtl.css +3 -3
  264. package/build-style/nextpage/editor.css +3 -3
  265. package/build-style/page-list/editor-rtl.css +7 -3
  266. package/build-style/page-list/editor.css +7 -3
  267. package/build-style/page-list/style-rtl.css +3 -3
  268. package/build-style/page-list/style.css +3 -3
  269. package/build-style/paragraph/editor-rtl.css +3 -3
  270. package/build-style/paragraph/editor.css +3 -3
  271. package/build-style/paragraph/style-rtl.css +3 -3
  272. package/build-style/paragraph/style.css +3 -3
  273. package/build-style/post-author/style-rtl.css +3 -3
  274. package/build-style/post-author/style.css +3 -3
  275. package/build-style/post-comments-form/editor-rtl.css +3 -3
  276. package/build-style/post-comments-form/editor.css +3 -3
  277. package/build-style/post-comments-form/style-rtl.css +3 -3
  278. package/build-style/post-comments-form/style.css +3 -3
  279. package/build-style/post-date/style-rtl.css +3 -3
  280. package/build-style/post-date/style.css +3 -3
  281. package/build-style/post-excerpt/editor-rtl.css +3 -3
  282. package/build-style/post-excerpt/editor.css +3 -3
  283. package/build-style/post-excerpt/style-rtl.css +3 -3
  284. package/build-style/post-excerpt/style.css +3 -3
  285. package/build-style/post-featured-image/editor-rtl.css +3 -3
  286. package/build-style/post-featured-image/editor.css +3 -3
  287. package/build-style/post-featured-image/style-rtl.css +3 -3
  288. package/build-style/post-featured-image/style.css +3 -3
  289. package/build-style/post-navigation-link/style-rtl.css +3 -3
  290. package/build-style/post-navigation-link/style.css +3 -3
  291. package/build-style/post-template/editor-rtl.css +3 -3
  292. package/build-style/post-template/editor.css +3 -3
  293. package/build-style/post-template/style-rtl.css +3 -3
  294. package/build-style/post-template/style.css +3 -3
  295. package/build-style/post-terms/style-rtl.css +3 -3
  296. package/build-style/post-terms/style.css +3 -3
  297. package/build-style/post-title/style-rtl.css +3 -3
  298. package/build-style/post-title/style.css +3 -3
  299. package/build-style/preformatted/style-rtl.css +3 -3
  300. package/build-style/preformatted/style.css +3 -3
  301. package/build-style/pullquote/editor-rtl.css +3 -3
  302. package/build-style/pullquote/editor.css +3 -3
  303. package/build-style/pullquote/style-rtl.css +3 -3
  304. package/build-style/pullquote/style.css +3 -3
  305. package/build-style/pullquote/theme-rtl.css +3 -3
  306. package/build-style/pullquote/theme.css +3 -3
  307. package/build-style/query/editor-rtl.css +3 -3
  308. package/build-style/query/editor.css +3 -3
  309. package/build-style/query-pagination/editor-rtl.css +3 -3
  310. package/build-style/query-pagination/editor.css +3 -3
  311. package/build-style/query-pagination/style-rtl.css +3 -3
  312. package/build-style/query-pagination/style.css +3 -3
  313. package/build-style/query-pagination-numbers/editor-rtl.css +3 -3
  314. package/build-style/query-pagination-numbers/editor.css +3 -3
  315. package/build-style/query-title/style-rtl.css +3 -3
  316. package/build-style/query-title/style.css +3 -3
  317. package/build-style/quote/style-rtl.css +3 -3
  318. package/build-style/quote/style.css +3 -3
  319. package/build-style/quote/theme-rtl.css +3 -3
  320. package/build-style/quote/theme.css +3 -3
  321. package/build-style/read-more/style-rtl.css +3 -3
  322. package/build-style/read-more/style.css +3 -3
  323. package/build-style/reset-rtl.css +3 -3
  324. package/build-style/reset.css +3 -3
  325. package/build-style/rss/editor-rtl.css +3 -3
  326. package/build-style/rss/editor.css +3 -3
  327. package/build-style/rss/style-rtl.css +3 -3
  328. package/build-style/rss/style.css +3 -3
  329. package/build-style/search/editor-rtl.css +3 -3
  330. package/build-style/search/editor.css +3 -3
  331. package/build-style/search/style-rtl.css +3 -3
  332. package/build-style/search/style.css +3 -3
  333. package/build-style/search/theme-rtl.css +3 -3
  334. package/build-style/search/theme.css +3 -3
  335. package/build-style/separator/editor-rtl.css +3 -3
  336. package/build-style/separator/editor.css +3 -3
  337. package/build-style/separator/style-rtl.css +3 -3
  338. package/build-style/separator/style.css +3 -3
  339. package/build-style/separator/theme-rtl.css +3 -3
  340. package/build-style/separator/theme.css +3 -3
  341. package/build-style/shortcode/editor-rtl.css +3 -3
  342. package/build-style/shortcode/editor.css +3 -3
  343. package/build-style/site-logo/editor-rtl.css +3 -3
  344. package/build-style/site-logo/editor.css +3 -3
  345. package/build-style/site-logo/style-rtl.css +3 -3
  346. package/build-style/site-logo/style.css +3 -3
  347. package/build-style/site-tagline/editor-rtl.css +3 -3
  348. package/build-style/site-tagline/editor.css +3 -3
  349. package/build-style/site-title/editor-rtl.css +3 -3
  350. package/build-style/site-title/editor.css +3 -3
  351. package/build-style/site-title/style-rtl.css +3 -3
  352. package/build-style/site-title/style.css +3 -3
  353. package/build-style/social-link/editor-rtl.css +3 -3
  354. package/build-style/social-link/editor.css +3 -3
  355. package/build-style/social-links/editor-rtl.css +3 -3
  356. package/build-style/social-links/editor.css +3 -3
  357. package/build-style/social-links/style-rtl.css +3 -3
  358. package/build-style/social-links/style.css +3 -3
  359. package/build-style/spacer/editor-rtl.css +3 -3
  360. package/build-style/spacer/editor.css +3 -3
  361. package/build-style/spacer/style-rtl.css +3 -3
  362. package/build-style/spacer/style.css +3 -3
  363. package/build-style/style-rtl.css +13 -5
  364. package/build-style/style.css +13 -5
  365. package/build-style/table/editor-rtl.css +3 -3
  366. package/build-style/table/editor.css +3 -3
  367. package/build-style/table/style-rtl.css +9 -3
  368. package/build-style/table/style.css +9 -3
  369. package/build-style/table/theme-rtl.css +3 -9
  370. package/build-style/table/theme.css +3 -9
  371. package/build-style/tag-cloud/style-rtl.css +3 -3
  372. package/build-style/tag-cloud/style.css +3 -3
  373. package/build-style/template-part/editor-rtl.css +3 -3
  374. package/build-style/template-part/editor.css +3 -3
  375. package/build-style/template-part/theme-rtl.css +3 -3
  376. package/build-style/template-part/theme.css +3 -3
  377. package/build-style/text-columns/editor-rtl.css +3 -3
  378. package/build-style/text-columns/editor.css +3 -3
  379. package/build-style/text-columns/style-rtl.css +3 -3
  380. package/build-style/text-columns/style.css +3 -3
  381. package/build-style/theme-rtl.css +3 -9
  382. package/build-style/theme.css +3 -9
  383. package/build-style/verse/style-rtl.css +7 -4
  384. package/build-style/verse/style.css +7 -4
  385. package/build-style/video/editor-rtl.css +3 -3
  386. package/build-style/video/editor.css +3 -3
  387. package/build-style/video/style-rtl.css +3 -3
  388. package/build-style/video/style.css +3 -3
  389. package/build-style/video/theme-rtl.css +3 -3
  390. package/build-style/video/theme.css +3 -3
  391. package/package.json +29 -29
  392. package/src/categories/edit.js +1 -1
  393. package/src/comments/index.php +0 -1
  394. package/src/cover/edit/inspector-controls.js +4 -4
  395. package/src/freeform/edit.js +48 -29
  396. package/src/freeform/modal.js +111 -0
  397. package/src/gallery/edit.js +17 -2
  398. package/src/gallery/gallery.js +3 -13
  399. package/src/image/image.js +1 -0
  400. package/src/latest-posts/test/__snapshots__/edit.native.js.snap +3 -0
  401. package/src/latest-posts/test/edit.native.js +49 -0
  402. package/src/media-text/edit.js +1 -0
  403. package/src/missing/edit.native.js +13 -6
  404. package/src/more/test/__snapshots__/edit.native.js.snap +7 -0
  405. package/src/more/test/edit.native.js +41 -0
  406. package/src/navigation/edit/index.js +3 -4
  407. package/src/navigation/edit/menu-inspector-controls.js +70 -29
  408. package/src/navigation/edit/navigation-menu-selector.js +19 -9
  409. package/src/navigation/edit/utils.js +82 -0
  410. package/src/navigation/editor.scss +0 -7
  411. package/src/navigation/index.php +32 -0
  412. package/src/navigation/style.scss +0 -1
  413. package/src/navigation-link/edit.js +5 -58
  414. package/src/navigation-link/index.php +32 -0
  415. package/src/navigation-submenu/edit.js +29 -100
  416. package/src/navigation-submenu/index.php +32 -0
  417. package/src/page-list/block.json +18 -1
  418. package/src/page-list/edit.js +30 -22
  419. package/src/page-list/editor.scss +4 -0
  420. package/src/page-list/index.js +8 -2
  421. package/src/page-list/index.php +9 -10
  422. package/src/page-list-item/edit.js +17 -9
  423. package/src/post-featured-image/overlay.js +0 -1
  424. package/src/query/edit/index.js +1 -0
  425. package/src/query/edit/inspector-controls/index.js +49 -38
  426. package/src/query/edit/inspector-controls/taxonomy-controls.js +102 -38
  427. package/src/query/edit/query-content.js +2 -1
  428. package/src/query/edit/query-placeholder.js +15 -14
  429. package/src/query/utils.js +59 -1
  430. package/src/search/edit.js +2 -2
  431. package/src/separator/test/__snapshots__/edit.native.js.snap +7 -0
  432. package/src/separator/test/edit.native.js +41 -0
  433. package/src/social-link/edit.js +3 -3
  434. package/src/social-links/edit.js +0 -1
  435. package/src/table/style.scss +8 -0
  436. package/src/table/theme.scss +0 -8
  437. package/src/table-of-contents/edit.js +1 -1
  438. package/src/template-part/edit/advanced-controls.js +12 -0
  439. package/src/template-part/edit/import-controls.js +180 -0
  440. package/src/template-part/edit/index.js +1 -0
  441. package/src/template-part/edit/utils/transformers.js +37 -0
  442. package/src/verse/style.scss +4 -1
  443. package/src/verse/test/__snapshots__/edit.native.js.snap +13 -0
  444. package/src/verse/test/edit.native.js +40 -33
  445. package/tsconfig.tsbuildinfo +1 -1
  446. package/build/query/constants.js +0 -16
  447. package/build/query/constants.js.map +0 -1
  448. package/build-module/query/constants.js +0 -7
  449. package/build-module/query/constants.js.map +0 -1
  450. package/src/query/constants.js +0 -7
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/navigation/edit/navigation-menu-selector.js"],"names":["NavigationMenuSelector","currentMenuId","onSelectNavigationMenu","onSelectClassicMenu","onCreateNew","actionLabel","createNavigationMenuIsSuccess","createNavigationMenuIsError","toggleProps","createActionLabel","selectorLabel","setSelectorLabel","isPressed","setIsPressed","enableOptions","setEnableOptions","isCreatingMenu","setIsCreatingMenu","menus","classicMenus","navigationMenus","hasResolvedNavigationMenus","isNavigationMenuResolved","canUserCreateNavigationMenu","canSwitchNavigationMenu","currentTitle","shouldEnableMenuSelector","menuChoices","map","id","title","label","rendered","value","ariaLabel","hasNavigationMenus","length","hasClassicMenus","showNavigationMenus","showClassicMenus","noMenuSelected","noBlockMenus","menuUnavailable","className","children","chevronUp","chevronDown","isBusy","disabled","__experimentalIsFocusable","onClick","onClose","menuId","menu","name"],"mappings":";;;;;;;;;AAeA;;AAZA;;AAQA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AArBA;AACA;AACA;;AAeA;AACA;AACA;AAIA,SAASA,sBAAT,OASI;AAAA,MAT6B;AAChCC,IAAAA,aADgC;AAEhCC,IAAAA,sBAFgC;AAGhCC,IAAAA,mBAHgC;AAIhCC,IAAAA,WAJgC;AAKhCC,IAAAA,WALgC;AAMhCC,IAAAA,6BANgC;AAOhCC,IAAAA,2BAPgC;AAQhCC,IAAAA,WAAW,GAAG;AARkB,GAS7B;;AACH;AACA,QAAMC,iBAAiB,GAAG,cAAI,kBAAJ,CAA1B;AAEA,QAAM,CAAEC,aAAF,EAAiBC,gBAAjB,IAAsC,uBAAU,EAAV,CAA5C;AACA,QAAM,CAAEC,SAAF,EAAaC,YAAb,IAA8B,uBAAU,KAAV,CAApC;AACA,QAAM,CAAEC,aAAF,EAAiBC,gBAAjB,IAAsC,uBAAU,KAAV,CAA5C;AACA,QAAM,CAAEC,cAAF,EAAkBC,iBAAlB,IAAwC,uBAAU,KAAV,CAA9C;AAEAZ,EAAAA,WAAW,GAAGA,WAAW,IAAII,iBAA7B;AAEA,QAAM;AAAES,IAAAA,KAAK,EAAEC;AAAT,MAA0B,qCAAhC;AAEA,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AD;AACC,QAAA,OAAO,EAAG,MAAM;AACf3C,UAAAA,gBAAgB,CACf,cAAI,WAAJ,CADe,CAAhB;AAGAI,UAAAA,gBAAgB,CAAE,KAAF,CAAhB;AACAZ,UAAAA,mBAAmB,CAAEkD,IAAF,CAAnB;AACAF,UAAAA,OAAO;AACP,SARF;AASC,QAAA,GAAG,EAAGE,IAAI,CAACxB,EATZ;AAUC,sBAAa,mBACZpB,iBADY,EAEZsB,KAFY;AAVd,SAeGA,KAfH,CADD;AAmBA,KArBC,CADH,CAbF,EAuCGR,2BAA2B,IAC5B,4BAAC,qBAAD;AAAW,MAAA,KAAK,EAAG,cAAI,OAAJ;AAAnB,OACC,4BAAC,oBAAD;AACC,MAAA,OAAO,EAAG,MAAM;AACf4B,QAAAA,OAAO;AACP/C,QAAAA,WAAW;AACXa,QAAAA,iBAAiB,CAAE,IAAF,CAAjB;AACAN,QAAAA,gBAAgB,CAAE,cAAI,WAAJ,CAAF,CAAhB;AACAI,QAAAA,gBAAgB,CAAE,KAAF,CAAhB;AACA;AAPF,OASG,cAAI,iBAAJ,CATH,CADD,CAxCF,CADC;AAAA,GAXH,CADD;AAuEA;;eAEcf,sB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tMenuGroup,\n\tMenuItem,\n\tMenuItemsChoice,\n\tDropdownMenu,\n\tButton,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { Icon, chevronUp, chevronDown } from '@wordpress/icons';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useEffect, useMemo, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useNavigationMenu from '../use-navigation-menu';\nimport useNavigationEntities from '../use-navigation-entities';\n\nfunction NavigationMenuSelector( {\n\tcurrentMenuId,\n\tonSelectNavigationMenu,\n\tonSelectClassicMenu,\n\tonCreateNew,\n\tactionLabel,\n\tcreateNavigationMenuIsSuccess,\n\tcreateNavigationMenuIsError,\n\ttoggleProps = {},\n} ) {\n\t/* translators: %s: The name of a menu. */\n\tconst createActionLabel = __( \"Create from '%s'\" );\n\n\tconst [ selectorLabel, setSelectorLabel ] = useState( '' );\n\tconst [ isPressed, setIsPressed ] = useState( false );\n\tconst [ enableOptions, setEnableOptions ] = useState( false );\n\tconst [ isCreatingMenu, setIsCreatingMenu ] = useState( false );\n\n\tactionLabel = actionLabel || createActionLabel;\n\n\tconst { menus: classicMenus } = useNavigationEntities();\n\n\tconst {\n\t\tnavigationMenus,\n\t\thasResolvedNavigationMenus,\n\t\tisNavigationMenuResolved,\n\t\tcanUserCreateNavigationMenu,\n\t\tcanSwitchNavigationMenu,\n\t} = useNavigationMenu();\n\n\tconst [ currentTitle ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_navigation',\n\t\t'title'\n\t);\n\n\tconst shouldEnableMenuSelector =\n\t\t( canSwitchNavigationMenu || canUserCreateNavigationMenu ) &&\n\t\thasResolvedNavigationMenus &&\n\t\t! isCreatingMenu;\n\n\tconst menuChoices = useMemo( () => {\n\t\treturn (\n\t\t\tnavigationMenus?.map( ( { id, title } ) => {\n\t\t\t\tconst label = decodeEntities( title.rendered );\n\t\t\t\tif ( id === currentMenuId && ! isCreatingMenu ) {\n\t\t\t\t\tsetSelectorLabel( currentTitle );\n\t\t\t\t\tsetEnableOptions( shouldEnableMenuSelector );\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tvalue: id,\n\t\t\t\t\tlabel,\n\t\t\t\t\tariaLabel: sprintf( actionLabel, label ),\n\t\t\t\t};\n\t\t\t} ) || []\n\t\t);\n\t}, [\n\t\tcurrentTitle,\n\t\tcurrentMenuId,\n\t\tnavigationMenus,\n\t\tcreateNavigationMenuIsSuccess,\n\t\tisNavigationMenuResolved,\n\t\thasResolvedNavigationMenus,\n\t] );\n\n\tconst hasNavigationMenus = !! navigationMenus?.length;\n\tconst hasClassicMenus = !! classicMenus?.length;\n\tconst showNavigationMenus = !! canSwitchNavigationMenu;\n\tconst showClassicMenus = !! canUserCreateNavigationMenu;\n\n\tconst noMenuSelected = hasNavigationMenus && ! currentMenuId;\n\tconst noBlockMenus = ! hasNavigationMenus && hasResolvedNavigationMenus;\n\tconst menuUnavailable =\n\t\thasResolvedNavigationMenus && currentMenuId === null;\n\n\tuseEffect( () => {\n\t\tif ( ! hasResolvedNavigationMenus ) {\n\t\t\tsetSelectorLabel( __( 'Loading …' ) );\n\t\t} else if ( noMenuSelected || noBlockMenus || menuUnavailable ) {\n\t\t\tsetSelectorLabel( __( 'Select menu' ) );\n\t\t\tsetEnableOptions( shouldEnableMenuSelector );\n\t\t}\n\n\t\tif (\n\t\t\tisCreatingMenu &&\n\t\t\t( createNavigationMenuIsSuccess || createNavigationMenuIsError )\n\t\t) {\n\t\t\tsetIsCreatingMenu( false );\n\t\t}\n\t}, [\n\t\tcurrentMenuId,\n\t\thasNavigationMenus,\n\t\thasResolvedNavigationMenus,\n\t\tcreateNavigationMenuIsSuccess,\n\t\tisNavigationMenuResolved,\n\t] );\n\n\ttoggleProps = {\n\t\t...toggleProps,\n\t\tclassName: 'wp-block-navigation__navigation-selector-button',\n\t\tchildren: (\n\t\t\t<>\n\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t{ __( 'Select Menu' ) }\n\t\t\t\t</VisuallyHidden>\n\t\t\t\t<Icon\n\t\t\t\t\ticon={ isPressed ? chevronUp : chevronDown }\n\t\t\t\t\tclassName=\"wp-block-navigation__navigation-selector-button__icon\"\n\t\t\t\t/>\n\t\t\t</>\n\t\t),\n\t\tisBusy: ! enableOptions,\n\t\tdisabled: ! enableOptions,\n\t\t__experimentalIsFocusable: true,\n\t\tonClick: () => {\n\t\t\tsetIsPressed( ! isPressed );\n\t\t},\n\t};\n\n\tif ( ! hasNavigationMenus && ! hasClassicMenus ) {\n\t\treturn (\n\t\t\t<Button\n\t\t\t\tclassName=\"wp-block-navigation__navigation-selector-button--createnew\"\n\t\t\t\tisBusy={ ! enableOptions }\n\t\t\t\tdisabled={ ! enableOptions }\n\t\t\t\t__experimentalIsFocusable\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tonCreateNew();\n\t\t\t\t\tsetIsCreatingMenu( true );\n\t\t\t\t\tsetSelectorLabel( __( 'Loading …' ) );\n\t\t\t\t\tsetEnableOptions( false );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ __( 'Create new menu' ) }\n\t\t\t</Button>\n\t\t);\n\t}\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\tclassName=\"wp-block-navigation__navigation-selector\"\n\t\t\tlabel={ selectorLabel }\n\t\t\ttext={\n\t\t\t\t<span className=\"wp-block-navigation__navigation-selector-button__label\">\n\t\t\t\t\t{ selectorLabel }\n\t\t\t\t</span>\n\t\t\t}\n\t\t\ticon={ null }\n\t\t\ttoggleProps={ toggleProps }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<>\n\t\t\t\t\t{ showNavigationMenus && hasNavigationMenus && (\n\t\t\t\t\t\t<MenuGroup label={ __( 'Menus' ) }>\n\t\t\t\t\t\t\t<MenuItemsChoice\n\t\t\t\t\t\t\t\tvalue={ currentMenuId }\n\t\t\t\t\t\t\t\tonSelect={ ( menuId ) => {\n\t\t\t\t\t\t\t\t\tonSelectNavigationMenu( menuId );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tchoices={ menuChoices }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showClassicMenus && hasClassicMenus && (\n\t\t\t\t\t\t<MenuGroup label={ __( 'Import Classic Menus' ) }>\n\t\t\t\t\t\t\t{ classicMenus?.map( ( menu ) => {\n\t\t\t\t\t\t\t\tconst label = decodeEntities( menu.name );\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetSelectorLabel(\n\t\t\t\t\t\t\t\t\t\t\t\t__( 'Loading …' )\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\tsetEnableOptions( false );\n\t\t\t\t\t\t\t\t\t\t\tonSelectClassicMenu( menu );\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\tkey={ menu.id }\n\t\t\t\t\t\t\t\t\t\taria-label={ sprintf(\n\t\t\t\t\t\t\t\t\t\t\tcreateActionLabel,\n\t\t\t\t\t\t\t\t\t\t\tlabel\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\t{ label }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ canUserCreateNavigationMenu && (\n\t\t\t\t\t\t<MenuGroup label={ __( 'Tools' ) }>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\tonCreateNew();\n\t\t\t\t\t\t\t\t\tsetIsCreatingMenu( true );\n\t\t\t\t\t\t\t\t\tsetSelectorLabel( __( 'Loading …' ) );\n\t\t\t\t\t\t\t\t\tsetEnableOptions( false );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Create new menu' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n\nexport default NavigationMenuSelector;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/navigation/edit/navigation-menu-selector.js"],"names":["NavigationMenuSelector","currentMenuId","onSelectNavigationMenu","onSelectClassicMenu","onCreateNew","actionLabel","createNavigationMenuIsSuccess","createNavigationMenuIsError","toggleProps","isOffCanvasNavigationEditorEnabled","window","__experimentalEnableOffCanvasNavigationEditor","createActionLabel","selectorLabel","setSelectorLabel","isPressed","setIsPressed","enableOptions","setEnableOptions","isCreatingMenu","setIsCreatingMenu","menus","classicMenus","navigationMenus","hasResolvedNavigationMenus","isNavigationMenuResolved","canUserCreateNavigationMenu","canSwitchNavigationMenu","currentTitle","shouldEnableMenuSelector","menuChoices","map","id","title","label","rendered","value","ariaLabel","hasNavigationMenus","length","hasClassicMenus","showNavigationMenus","showClassicMenus","noMenuSelected","noBlockMenus","menuUnavailable","className","children","chevronUp","chevronDown","isBusy","disabled","__experimentalIsFocusable","onClick","moreVertical","isSmall","onClose","menuId","menu","name"],"mappings":";;;;;;;;;AAeA;;AAZA;;AAQA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AArBA;AACA;AACA;;AAeA;AACA;AACA;AAIA,SAASA,sBAAT,OASI;AAAA;;AAAA,MAT6B;AAChCC,IAAAA,aADgC;AAEhCC,IAAAA,sBAFgC;AAGhCC,IAAAA,mBAHgC;AAIhCC,IAAAA,WAJgC;AAKhCC,IAAAA,WALgC;AAMhCC,IAAAA,6BANgC;AAOhCC,IAAAA,2BAPgC;AAQhCC,IAAAA,WAAW,GAAG;AARkB,GAS7B;AACH,QAAMC,kCAAkC,GACvC,YAAAC,MAAM,UAAN,0CAAQC,6CAAR,MAA0D,IAD3D;AAEA;;AACA,QAAMC,iBAAiB,GAAG,cAAI,kBAAJ,CAA1B;AAEA,QAAM,CAAEC,aAAF,EAAiBC,gBAAjB,IAAsC,uBAAU,EAAV,CAA5C;AACA,QAAM,CAAEC,SAAF,EAAaC,YAAb,IAA8B,uBAAU,KAAV,CAApC;AACA,QAAM,CAAEC,aAAF,EAAiBC,gBAAjB,IAAsC,uBAAU,KAAV,CAA5C;AACA,QAAM,CAAEC,cAAF,EAA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;AACA,OAJF;AAKC,MAAA,OAAO,EAAG3B;AALX,MADD,CAFF,EAYGY,gBAAgB,IAAIF,eAApB,IACD,4BAAC,qBAAD;AAAW,MAAA,KAAK,EAAG,cAAI,sBAAJ;AAAnB,OACGlB,YADH,aACGA,YADH,uBACGA,YAAY,CAAES,GAAd,CAAqB2B,IAAF,IAAY;AAChC,YAAMxB,KAAK,GAAG,kCAAgBwB,IAAI,CAACC,IAArB,CAAd;AACA,aACC,4BAAC,oBAAD;AACC,QAAA,OAAO,EAAG,MAAM;AACf7C,UAAAA,gBAAgB,CACf,cAAI,WAAJ,CADe,CAAhB;AAGAI,UAAAA,gBAAgB,CAAE,KAAF,CAAhB;AACAf,UAAAA,mBAAmB,CAAEuD,IAAF,CAAnB;AACAF,UAAAA,OAAO;AACP,SARF;AASC,QAAA,GAAG,EAAGE,IAAI,CAAC1B,EATZ;AAUC,sBAAa,mBACZpB,iBADY,EAEZsB,KAFY;AAVd,SAeGA,KAfH,CADD;AAmBA,KArBC,CADH,CAbF,EAuCGR,2BAA2B,IAC5B,4BAAC,qBAAD;AAAW,MAAA,KAAK,EAAG,cAAI,OAAJ;AAAnB,OACC,4BAAC,oBAAD;AACC,MAAA,OAAO,EAAG,MAAM;AACf8B,QAAAA,OAAO;AACPpD,QAAAA,WAAW;AACXgB,QAAAA,iBAAiB,CAAE,IAAF,CAAjB;AACAN,QAAAA,gBAAgB,CAAE,cAAI,WAAJ,CAAF,CAAhB;AACAI,QAAAA,gBAAgB,CAAE,KAAF,CAAhB;AACA;AAPF,OASG,cAAI,iBAAJ,CATH,CADD,CAxCF,CADC;AAAA,GAfH,CADD;AA2EA;;eAEclB,sB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tMenuGroup,\n\tMenuItem,\n\tMenuItemsChoice,\n\tDropdownMenu,\n\tButton,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { useEntityProp } from '@wordpress/core-data';\nimport { Icon, chevronUp, chevronDown, moreVertical } from '@wordpress/icons';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useEffect, useMemo, useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useNavigationMenu from '../use-navigation-menu';\nimport useNavigationEntities from '../use-navigation-entities';\n\nfunction NavigationMenuSelector( {\n\tcurrentMenuId,\n\tonSelectNavigationMenu,\n\tonSelectClassicMenu,\n\tonCreateNew,\n\tactionLabel,\n\tcreateNavigationMenuIsSuccess,\n\tcreateNavigationMenuIsError,\n\ttoggleProps = {},\n} ) {\n\tconst isOffCanvasNavigationEditorEnabled =\n\t\twindow?.__experimentalEnableOffCanvasNavigationEditor === true;\n\t/* translators: %s: The name of a menu. */\n\tconst createActionLabel = __( \"Create from '%s'\" );\n\n\tconst [ selectorLabel, setSelectorLabel ] = useState( '' );\n\tconst [ isPressed, setIsPressed ] = useState( false );\n\tconst [ enableOptions, setEnableOptions ] = useState( false );\n\tconst [ isCreatingMenu, setIsCreatingMenu ] = useState( false );\n\n\tactionLabel = actionLabel || createActionLabel;\n\n\tconst { menus: classicMenus } = useNavigationEntities();\n\n\tconst {\n\t\tnavigationMenus,\n\t\thasResolvedNavigationMenus,\n\t\tisNavigationMenuResolved,\n\t\tcanUserCreateNavigationMenu,\n\t\tcanSwitchNavigationMenu,\n\t} = useNavigationMenu();\n\n\tconst [ currentTitle ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_navigation',\n\t\t'title'\n\t);\n\n\tconst shouldEnableMenuSelector =\n\t\t( canSwitchNavigationMenu || canUserCreateNavigationMenu ) &&\n\t\thasResolvedNavigationMenus &&\n\t\t! isCreatingMenu;\n\n\tconst menuChoices = useMemo( () => {\n\t\treturn (\n\t\t\tnavigationMenus?.map( ( { id, title } ) => {\n\t\t\t\tconst label = decodeEntities( title.rendered );\n\t\t\t\tif ( id === currentMenuId && ! isCreatingMenu ) {\n\t\t\t\t\tsetSelectorLabel( currentTitle );\n\t\t\t\t\tsetEnableOptions( shouldEnableMenuSelector );\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tvalue: id,\n\t\t\t\t\tlabel,\n\t\t\t\t\tariaLabel: sprintf( actionLabel, label ),\n\t\t\t\t};\n\t\t\t} ) || []\n\t\t);\n\t}, [\n\t\tcurrentTitle,\n\t\tcurrentMenuId,\n\t\tnavigationMenus,\n\t\tcreateNavigationMenuIsSuccess,\n\t\tisNavigationMenuResolved,\n\t\thasResolvedNavigationMenus,\n\t] );\n\n\tconst hasNavigationMenus = !! navigationMenus?.length;\n\tconst hasClassicMenus = !! classicMenus?.length;\n\tconst showNavigationMenus = !! canSwitchNavigationMenu;\n\tconst showClassicMenus = !! canUserCreateNavigationMenu;\n\n\tconst noMenuSelected = hasNavigationMenus && ! currentMenuId;\n\tconst noBlockMenus = ! hasNavigationMenus && hasResolvedNavigationMenus;\n\tconst menuUnavailable =\n\t\thasResolvedNavigationMenus && currentMenuId === null;\n\n\tuseEffect( () => {\n\t\tif ( ! hasResolvedNavigationMenus ) {\n\t\t\tsetSelectorLabel( __( 'Loading …' ) );\n\t\t} else if ( noMenuSelected || noBlockMenus || menuUnavailable ) {\n\t\t\tsetSelectorLabel( __( 'Select menu' ) );\n\t\t\tsetEnableOptions( shouldEnableMenuSelector );\n\t\t}\n\n\t\tif (\n\t\t\tisCreatingMenu &&\n\t\t\t( createNavigationMenuIsSuccess || createNavigationMenuIsError )\n\t\t) {\n\t\t\tsetIsCreatingMenu( false );\n\t\t}\n\t}, [\n\t\tcurrentMenuId,\n\t\thasNavigationMenus,\n\t\thasResolvedNavigationMenus,\n\t\tcreateNavigationMenuIsSuccess,\n\t\tisNavigationMenuResolved,\n\t] );\n\n\ttoggleProps = {\n\t\t...toggleProps,\n\t\tclassName: 'wp-block-navigation__navigation-selector-button',\n\t\tchildren: (\n\t\t\t<>\n\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t{ __( 'Select Menu' ) }\n\t\t\t\t</VisuallyHidden>\n\t\t\t\t<Icon\n\t\t\t\t\ticon={ isPressed ? chevronUp : chevronDown }\n\t\t\t\t\tclassName=\"wp-block-navigation__navigation-selector-button__icon\"\n\t\t\t\t/>\n\t\t\t</>\n\t\t),\n\t\tisBusy: ! enableOptions,\n\t\tdisabled: ! enableOptions,\n\t\t__experimentalIsFocusable: true,\n\t\tonClick: () => {\n\t\t\tsetIsPressed( ! isPressed );\n\t\t},\n\t};\n\n\tif (\n\t\t! hasNavigationMenus &&\n\t\t! hasClassicMenus &&\n\t\t! isOffCanvasNavigationEditorEnabled\n\t) {\n\t\treturn (\n\t\t\t<Button\n\t\t\t\tclassName=\"wp-block-navigation__navigation-selector-button--createnew\"\n\t\t\t\tisBusy={ ! enableOptions }\n\t\t\t\tdisabled={ ! enableOptions }\n\t\t\t\t__experimentalIsFocusable\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tonCreateNew();\n\t\t\t\t\tsetIsCreatingMenu( true );\n\t\t\t\t\tsetSelectorLabel( __( 'Loading …' ) );\n\t\t\t\t\tsetEnableOptions( false );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ __( 'Create new menu' ) }\n\t\t\t</Button>\n\t\t);\n\t}\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\tclassName={\n\t\t\t\tisOffCanvasNavigationEditorEnabled\n\t\t\t\t\t? ''\n\t\t\t\t\t: 'wp-block-navigation__navigation-selector'\n\t\t\t}\n\t\t\tlabel={ selectorLabel }\n\t\t\ttext={ isOffCanvasNavigationEditorEnabled ? '' : selectorLabel }\n\t\t\ticon={ isOffCanvasNavigationEditorEnabled ? moreVertical : null }\n\t\t\ttoggleProps={\n\t\t\t\tisOffCanvasNavigationEditorEnabled\n\t\t\t\t\t? { isSmall: true }\n\t\t\t\t\t: toggleProps\n\t\t\t}\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<>\n\t\t\t\t\t{ showNavigationMenus && hasNavigationMenus && (\n\t\t\t\t\t\t<MenuGroup label={ __( 'Menus' ) }>\n\t\t\t\t\t\t\t<MenuItemsChoice\n\t\t\t\t\t\t\t\tvalue={ currentMenuId }\n\t\t\t\t\t\t\t\tonSelect={ ( menuId ) => {\n\t\t\t\t\t\t\t\t\tonSelectNavigationMenu( menuId );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\tchoices={ menuChoices }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showClassicMenus && hasClassicMenus && (\n\t\t\t\t\t\t<MenuGroup label={ __( 'Import Classic Menus' ) }>\n\t\t\t\t\t\t\t{ classicMenus?.map( ( menu ) => {\n\t\t\t\t\t\t\t\tconst label = decodeEntities( menu.name );\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetSelectorLabel(\n\t\t\t\t\t\t\t\t\t\t\t\t__( 'Loading …' )\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\tsetEnableOptions( false );\n\t\t\t\t\t\t\t\t\t\t\tonSelectClassicMenu( menu );\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\tkey={ menu.id }\n\t\t\t\t\t\t\t\t\t\taria-label={ sprintf(\n\t\t\t\t\t\t\t\t\t\t\tcreateActionLabel,\n\t\t\t\t\t\t\t\t\t\t\tlabel\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\t{ label }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ canUserCreateNavigationMenu && (\n\t\t\t\t\t\t<MenuGroup label={ __( 'Tools' ) }>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\tonCreateNew();\n\t\t\t\t\t\t\t\t\tsetIsCreatingMenu( true );\n\t\t\t\t\t\t\t\t\tsetSelectorLabel( __( 'Loading …' ) );\n\t\t\t\t\t\t\t\t\tsetEnableOptions( false );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Create new menu' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n\nexport default NavigationMenuSelector;\n"]}
@@ -1,10 +1,19 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
8
  exports.detectColors = detectColors;
9
+ exports.getColors = getColors;
10
+ exports.getNavigationChildBlockProps = getNavigationChildBlockProps;
11
+
12
+ var _classnames = _interopRequireDefault(require("classnames"));
7
13
 
14
+ /**
15
+ * External dependencies
16
+ */
8
17
  function getComputedStyle(node) {
9
18
  return node.ownerDocument.defaultView.getComputedStyle(node);
10
19
  }
@@ -25,4 +34,76 @@ function detectColors(colorsDetectionElement, setColor, setBackground) {
25
34
 
26
35
  setBackground(backgroundColor);
27
36
  }
37
+ /**
38
+ * Determine the colors for a menu.
39
+ *
40
+ * Order of priority is:
41
+ * 1: Overlay custom colors (if submenu)
42
+ * 2: Overlay theme colors (if submenu)
43
+ * 3: Custom colors
44
+ * 4: Theme colors
45
+ * 5: Global styles
46
+ *
47
+ * @param {Object} context
48
+ * @param {boolean} isSubMenu
49
+ */
50
+
51
+
52
+ function getColors(context, isSubMenu) {
53
+ var _style$color, _style$color2;
54
+
55
+ const {
56
+ textColor,
57
+ customTextColor,
58
+ backgroundColor,
59
+ customBackgroundColor,
60
+ overlayTextColor,
61
+ customOverlayTextColor,
62
+ overlayBackgroundColor,
63
+ customOverlayBackgroundColor,
64
+ style
65
+ } = context;
66
+ const colors = {};
67
+
68
+ if (isSubMenu && !!customOverlayTextColor) {
69
+ colors.customTextColor = customOverlayTextColor;
70
+ } else if (isSubMenu && !!overlayTextColor) {
71
+ colors.textColor = overlayTextColor;
72
+ } else if (!!customTextColor) {
73
+ colors.customTextColor = customTextColor;
74
+ } else if (!!textColor) {
75
+ colors.textColor = textColor;
76
+ } else if (!!(style !== null && style !== void 0 && (_style$color = style.color) !== null && _style$color !== void 0 && _style$color.text)) {
77
+ colors.customTextColor = style.color.text;
78
+ }
79
+
80
+ if (isSubMenu && !!customOverlayBackgroundColor) {
81
+ colors.customBackgroundColor = customOverlayBackgroundColor;
82
+ } else if (isSubMenu && !!overlayBackgroundColor) {
83
+ colors.backgroundColor = overlayBackgroundColor;
84
+ } else if (!!customBackgroundColor) {
85
+ colors.customBackgroundColor = customBackgroundColor;
86
+ } else if (!!backgroundColor) {
87
+ colors.backgroundColor = backgroundColor;
88
+ } else if (!!(style !== null && style !== void 0 && (_style$color2 = style.color) !== null && _style$color2 !== void 0 && _style$color2.background)) {
89
+ colors.customTextColor = style.color.background;
90
+ }
91
+
92
+ return colors;
93
+ }
94
+
95
+ function getNavigationChildBlockProps(innerBlocksColors) {
96
+ return {
97
+ className: (0, _classnames.default)('wp-block-navigation__submenu-container', {
98
+ 'has-text-color': !!(innerBlocksColors.textColor || innerBlocksColors.customTextColor),
99
+ [`has-${innerBlocksColors.textColor}-color`]: !!innerBlocksColors.textColor,
100
+ 'has-background': !!(innerBlocksColors.backgroundColor || innerBlocksColors.customBackgroundColor),
101
+ [`has-${innerBlocksColors.backgroundColor}-background-color`]: !!innerBlocksColors.backgroundColor
102
+ }),
103
+ style: {
104
+ color: innerBlocksColors.customTextColor,
105
+ backgroundColor: innerBlocksColors.customBackgroundColor
106
+ }
107
+ };
108
+ }
28
109
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/navigation/edit/utils.js"],"names":["getComputedStyle","node","ownerDocument","defaultView","detectColors","colorsDetectionElement","setColor","setBackground","color","backgroundColorNode","backgroundColor","parentNode","nodeType","ELEMENT_NODE"],"mappings":";;;;;;;AAAA,SAASA,gBAAT,CAA2BC,IAA3B,EAAkC;AACjC,SAAOA,IAAI,CAACC,aAAL,CAAmBC,WAAnB,CAA+BH,gBAA/B,CAAiDC,IAAjD,CAAP;AACA;;AAEM,SAASG,YAAT,CACNC,sBADM,EAENC,QAFM,EAGNC,aAHM,EAIL;AACD,MAAK,CAAEF,sBAAP,EAAgC;AAC/B;AACA;;AACDC,EAAAA,QAAQ,CAAEN,gBAAgB,CAAEK,sBAAF,CAAhB,CAA2CG,KAA7C,CAAR;AAEA,MAAIC,mBAAmB,GAAGJ,sBAA1B;AACA,MAAIK,eAAe,GAClBV,gBAAgB,CAAES,mBAAF,CAAhB,CAAwCC,eADzC;;AAEA,SACCA,eAAe,KAAK,kBAApB,IACAD,mBAAmB,CAACE,UADpB,IAEAF,mBAAmB,CAACE,UAApB,CAA+BC,QAA/B,KACCH,mBAAmB,CAACE,UAApB,CAA+BE,YAJjC,EAKE;AACDJ,IAAAA,mBAAmB,GAAGA,mBAAmB,CAACE,UAA1C;AACAD,IAAAA,eAAe,GACdV,gBAAgB,CAAES,mBAAF,CAAhB,CAAwCC,eADzC;AAEA;;AAEDH,EAAAA,aAAa,CAAEG,eAAF,CAAb;AACA","sourcesContent":["function getComputedStyle( node ) {\n\treturn node.ownerDocument.defaultView.getComputedStyle( node );\n}\n\nexport function detectColors(\n\tcolorsDetectionElement,\n\tsetColor,\n\tsetBackground\n) {\n\tif ( ! colorsDetectionElement ) {\n\t\treturn;\n\t}\n\tsetColor( getComputedStyle( colorsDetectionElement ).color );\n\n\tlet backgroundColorNode = colorsDetectionElement;\n\tlet backgroundColor =\n\t\tgetComputedStyle( backgroundColorNode ).backgroundColor;\n\twhile (\n\t\tbackgroundColor === 'rgba(0, 0, 0, 0)' &&\n\t\tbackgroundColorNode.parentNode &&\n\t\tbackgroundColorNode.parentNode.nodeType ===\n\t\t\tbackgroundColorNode.parentNode.ELEMENT_NODE\n\t) {\n\t\tbackgroundColorNode = backgroundColorNode.parentNode;\n\t\tbackgroundColor =\n\t\t\tgetComputedStyle( backgroundColorNode ).backgroundColor;\n\t}\n\n\tsetBackground( backgroundColor );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/navigation/edit/utils.js"],"names":["getComputedStyle","node","ownerDocument","defaultView","detectColors","colorsDetectionElement","setColor","setBackground","color","backgroundColorNode","backgroundColor","parentNode","nodeType","ELEMENT_NODE","getColors","context","isSubMenu","textColor","customTextColor","customBackgroundColor","overlayTextColor","customOverlayTextColor","overlayBackgroundColor","customOverlayBackgroundColor","style","colors","text","background","getNavigationChildBlockProps","innerBlocksColors","className"],"mappings":";;;;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGA,SAASA,gBAAT,CAA2BC,IAA3B,EAAkC;AACjC,SAAOA,IAAI,CAACC,aAAL,CAAmBC,WAAnB,CAA+BH,gBAA/B,CAAiDC,IAAjD,CAAP;AACA;;AAEM,SAASG,YAAT,CACNC,sBADM,EAENC,QAFM,EAGNC,aAHM,EAIL;AACD,MAAK,CAAEF,sBAAP,EAAgC;AAC/B;AACA;;AACDC,EAAAA,QAAQ,CAAEN,gBAAgB,CAAEK,sBAAF,CAAhB,CAA2CG,KAA7C,CAAR;AAEA,MAAIC,mBAAmB,GAAGJ,sBAA1B;AACA,MAAIK,eAAe,GAClBV,gBAAgB,CAAES,mBAAF,CAAhB,CAAwCC,eADzC;;AAEA,SACCA,eAAe,KAAK,kBAApB,IACAD,mBAAmB,CAACE,UADpB,IAEAF,mBAAmB,CAACE,UAApB,CAA+BC,QAA/B,KACCH,mBAAmB,CAACE,UAApB,CAA+BE,YAJjC,EAKE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BAAP,GAA+BI,4BAA/B;AACA,GAFD,MAEO,IAAKP,SAAS,IAAI,CAAC,CAAEM,sBAArB,EAA8C;AACpDG,IAAAA,MAAM,CAACf,eAAP,GAAyBY,sBAAzB;AACA,GAFM,MAEA,IAAK,CAAC,CAAEH,qBAAR,EAAgC;AACtCM,IAAAA,MAAM,CAACN,qBAAP,GAA+BA,qBAA/B;AACA,GAFM,MAEA,IAAK,CAAC,CAAET,eAAR,EAA0B;AAChCe,IAAAA,MAAM,CAACf,eAAP,GAAyBA,eAAzB;AACA,GAFM,MAEA,IAAK,CAAC,EAAEc,KAAF,aAAEA,KAAF,gCAAEA,KAAK,CAAEhB,KAAT,0CAAE,cAAcmB,UAAhB,CAAN,EAAmC;AACzCF,IAAAA,MAAM,CAACP,eAAP,GAAyBM,KAAK,CAAChB,KAAN,CAAYmB,UAArC;AACA;;AAED,SAAOF,MAAP;AACA;;AAEM,SAASG,4BAAT,CAAuCC,iBAAvC,EAA2D;AACjE,SAAO;AACNC,IAAAA,SAAS,EAAE,yBAAY,wCAAZ,EAAsD;AAChE,wBAAkB,CAAC,EAClBD,iBAAiB,CAACZ,SAAlB,IAA+BY,iBAAiB,CAACX,eAD/B,CAD6C;AAIhE,OAAG,OAAOW,iBAAiB,CAACZ,SAAW,QAAvC,GACC,CAAC,CAAEY,iBAAiB,CAACZ,SAL0C;AAMhE,wBAAkB,CAAC,EAClBY,iBAAiB,CAACnB,eAAlB,IACAmB,iBAAiB,CAACV,qBAFA,CAN6C;AAUhE,OAAG,OAAOU,iBAAiB,CAACnB,eAAiB,mBAA7C,GACC,CAAC,CAAEmB,iBAAiB,CAACnB;AAX0C,KAAtD,CADL;AAcNc,IAAAA,KAAK,EAAE;AACNhB,MAAAA,KAAK,EAAEqB,iBAAiB,CAACX,eADnB;AAENR,MAAAA,eAAe,EAAEmB,iBAAiB,CAACV;AAF7B;AAdD,GAAP;AAmBA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\nfunction getComputedStyle( node ) {\n\treturn node.ownerDocument.defaultView.getComputedStyle( node );\n}\n\nexport function detectColors(\n\tcolorsDetectionElement,\n\tsetColor,\n\tsetBackground\n) {\n\tif ( ! colorsDetectionElement ) {\n\t\treturn;\n\t}\n\tsetColor( getComputedStyle( colorsDetectionElement ).color );\n\n\tlet backgroundColorNode = colorsDetectionElement;\n\tlet backgroundColor =\n\t\tgetComputedStyle( backgroundColorNode ).backgroundColor;\n\twhile (\n\t\tbackgroundColor === 'rgba(0, 0, 0, 0)' &&\n\t\tbackgroundColorNode.parentNode &&\n\t\tbackgroundColorNode.parentNode.nodeType ===\n\t\t\tbackgroundColorNode.parentNode.ELEMENT_NODE\n\t) {\n\t\tbackgroundColorNode = backgroundColorNode.parentNode;\n\t\tbackgroundColor =\n\t\t\tgetComputedStyle( backgroundColorNode ).backgroundColor;\n\t}\n\n\tsetBackground( backgroundColor );\n}\n\n/**\n * Determine the colors for a menu.\n *\n * Order of priority is:\n * 1: Overlay custom colors (if submenu)\n * 2: Overlay theme colors (if submenu)\n * 3: Custom colors\n * 4: Theme colors\n * 5: Global styles\n *\n * @param {Object} context\n * @param {boolean} isSubMenu\n */\nexport function getColors( context, isSubMenu ) {\n\tconst {\n\t\ttextColor,\n\t\tcustomTextColor,\n\t\tbackgroundColor,\n\t\tcustomBackgroundColor,\n\t\toverlayTextColor,\n\t\tcustomOverlayTextColor,\n\t\toverlayBackgroundColor,\n\t\tcustomOverlayBackgroundColor,\n\t\tstyle,\n\t} = context;\n\n\tconst colors = {};\n\n\tif ( isSubMenu && !! customOverlayTextColor ) {\n\t\tcolors.customTextColor = customOverlayTextColor;\n\t} else if ( isSubMenu && !! overlayTextColor ) {\n\t\tcolors.textColor = overlayTextColor;\n\t} else if ( !! customTextColor ) {\n\t\tcolors.customTextColor = customTextColor;\n\t} else if ( !! textColor ) {\n\t\tcolors.textColor = textColor;\n\t} else if ( !! style?.color?.text ) {\n\t\tcolors.customTextColor = style.color.text;\n\t}\n\n\tif ( isSubMenu && !! customOverlayBackgroundColor ) {\n\t\tcolors.customBackgroundColor = customOverlayBackgroundColor;\n\t} else if ( isSubMenu && !! overlayBackgroundColor ) {\n\t\tcolors.backgroundColor = overlayBackgroundColor;\n\t} else if ( !! customBackgroundColor ) {\n\t\tcolors.customBackgroundColor = customBackgroundColor;\n\t} else if ( !! backgroundColor ) {\n\t\tcolors.backgroundColor = backgroundColor;\n\t} else if ( !! style?.color?.background ) {\n\t\tcolors.customTextColor = style.color.background;\n\t}\n\n\treturn colors;\n}\n\nexport function getNavigationChildBlockProps( innerBlocksColors ) {\n\treturn {\n\t\tclassName: classnames( 'wp-block-navigation__submenu-container', {\n\t\t\t'has-text-color': !! (\n\t\t\t\tinnerBlocksColors.textColor || innerBlocksColors.customTextColor\n\t\t\t),\n\t\t\t[ `has-${ innerBlocksColors.textColor }-color` ]:\n\t\t\t\t!! innerBlocksColors.textColor,\n\t\t\t'has-background': !! (\n\t\t\t\tinnerBlocksColors.backgroundColor ||\n\t\t\t\tinnerBlocksColors.customBackgroundColor\n\t\t\t),\n\t\t\t[ `has-${ innerBlocksColors.backgroundColor }-background-color` ]:\n\t\t\t\t!! innerBlocksColors.backgroundColor,\n\t\t} ),\n\t\tstyle: {\n\t\t\tcolor: innerBlocksColors.customTextColor,\n\t\t\tbackgroundColor: innerBlocksColors.customBackgroundColor,\n\t\t},\n\t};\n}\n"]}
@@ -39,6 +39,8 @@ var _linkUi = require("./link-ui");
39
39
 
40
40
  var _updateAttributes = require("./update-attributes");
41
41
 
42
+ var _utils = require("../navigation/edit/utils");
43
+
42
44
  /**
43
45
  * External dependencies
44
46
  */
@@ -166,63 +168,6 @@ const useIsDraggingWithin = elementRef => {
166
168
  }, []);
167
169
  return isDraggingWithin;
168
170
  };
169
- /**
170
- * Determine the colors for a menu.
171
- *
172
- * Order of priority is:
173
- * 1: Overlay custom colors (if submenu)
174
- * 2: Overlay theme colors (if submenu)
175
- * 3: Custom colors
176
- * 4: Theme colors
177
- * 5: Global styles
178
- *
179
- * @param {Object} context
180
- * @param {boolean} isSubMenu
181
- */
182
-
183
-
184
- function getColors(context, isSubMenu) {
185
- var _style$color, _style$color2;
186
-
187
- const {
188
- textColor,
189
- customTextColor,
190
- backgroundColor,
191
- customBackgroundColor,
192
- overlayTextColor,
193
- customOverlayTextColor,
194
- overlayBackgroundColor,
195
- customOverlayBackgroundColor,
196
- style
197
- } = context;
198
- const colors = {};
199
-
200
- if (isSubMenu && !!customOverlayTextColor) {
201
- colors.customTextColor = customOverlayTextColor;
202
- } else if (isSubMenu && !!overlayTextColor) {
203
- colors.textColor = overlayTextColor;
204
- } else if (!!customTextColor) {
205
- colors.customTextColor = customTextColor;
206
- } else if (!!textColor) {
207
- colors.textColor = textColor;
208
- } else if (!!(style !== null && style !== void 0 && (_style$color = style.color) !== null && _style$color !== void 0 && _style$color.text)) {
209
- colors.customTextColor = style.color.text;
210
- }
211
-
212
- if (isSubMenu && !!customOverlayBackgroundColor) {
213
- colors.customBackgroundColor = customOverlayBackgroundColor;
214
- } else if (isSubMenu && !!overlayBackgroundColor) {
215
- colors.backgroundColor = overlayBackgroundColor;
216
- } else if (!!customBackgroundColor) {
217
- colors.customBackgroundColor = customBackgroundColor;
218
- } else if (!!backgroundColor) {
219
- colors.backgroundColor = backgroundColor;
220
- } else if (!!(style !== null && style !== void 0 && (_style$color2 = style.color) !== null && _style$color2 !== void 0 && _style$color2.background)) {
221
- colors.customTextColor = style.color.background;
222
- }
223
-
224
- return colors;
225
- }
226
171
 
227
172
  const useIsInvalidLink = (kind, type, id) => {
228
173
  const isPostType = kind === 'post-type' || type === 'post' || type === 'page';
@@ -454,7 +399,7 @@ function NavigationLinkEdit(_ref) {
454
399
  customTextColor,
455
400
  backgroundColor,
456
401
  customBackgroundColor
457
- } = getColors(context, !isTopLevelLink);
402
+ } = (0, _utils.getColors)(context, !isTopLevelLink);
458
403
 
459
404
  function onKeyDown(event) {
460
405
  if (_keycodes.isKeyboardEvent.primary(event, 'k') || !url && event.keyCode === _keycodes.ENTER) {
@@ -535,6 +480,7 @@ function NavigationLinkEdit(_ref) {
535
480
  label: (0, _i18n.__)('URL'),
536
481
  autoComplete: "off"
537
482
  }), (0, _element.createElement)(_components.TextareaControl, {
483
+ __nextHasNoMarginBottom: true,
538
484
  value: description || '',
539
485
  onChange: descriptionValue => {
540
486
  setAttributes({
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/navigation-link/edit.js"],"names":["useIsDraggingWithin","elementRef","isDraggingWithin","setIsDraggingWithin","ownerDocument","current","handleDragStart","event","handleDragEnter","handleDragEnd","contains","target","addEventListener","removeEventListener","getColors","context","isSubMenu","textColor","customTextColor","backgroundColor","customBackgroundColor","overlayTextColor","customOverlayTextColor","overlayBackgroundColor","customOverlayBackgroundColor","style","colors","color","text","background","useIsInvalidLink","kind","type","id","isPostType","hasId","Number","isInteger","postStatus","select","getEntityRecord","coreStore","status","isInvalid","isDraft","getMissingText","missingText","NavigationLinkEdit","attributes","isSelected","setAttributes","insertBlocksAfter","mergeBlocks","onReplace","clientId","label","url","description","rel","title","maxNestingLevel","replaceBlock","__unstableMarkNextChangeAsNotPersistent","blockEditorStore","isLinkOpen","setIsLinkOpen","popoverAnchor","setPopoverAnchor","listItemRef","itemLabelPlaceholder","ref","pagesPermissions","postsPermissions","innerBlocks","isAtMaxNesting","isTopLevelLink","isParentOfSelectedBlock","hasChildren","getBlocks","getBlockCount","getBlockName","getBlockRootClientId","hasSelectedInnerBlock","getBlockParentsByBlockName","name","length","transformToSubmenu","newSubmenu","test","selectLabelText","focus","defaultView","selection","getSelection","range","createRange","selectNodeContents","removeAllRanges","addRange","removeLink","userCanCreate","canCreate","onKeyDown","isKeyboardEvent","primary","keyCode","ENTER","blockProps","className","ALLOWED_BLOCKS","DEFAULT_BLOCK","innerBlocksProps","allowedBlocks","__experimentalDefaultBlock","__experimentalDirectInsert","renderAppender","onClick","classes","placeholderText","tooltipText","linkIcon","displayShortcut","addSubmenu","labelValue","urlValue","descript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BAAD;AACC,IAAA,SAAS,EAAG;AACXoF,MAAAA,KAAK,EAAE,MACN/E,UAAU,IACVgB,aAAa,CAAE,IAAF;AAHH;AADb,IADD,EAQC,4BAAC,mBAAD;AACC,IAAA,QAAQ,EAAC,YADV;AAEC,IAAA,IAAI,EAAGsD;AAFR,KAIC,qDACC;AACC,kBAAa,cACZ,sBADY;AADd,KAME;AACA;AACA;AACA;AACA;AACC,KAAG,sBACHhE,KADG,CAED,IAAI+D,eAAiB,EAFxB,CAE0BW,IAF1B,EAXF,CADD,EAiBC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACGV,WADH,CAjBD,CAJD,CARD,CA/CF,CAdF,EAmGGvD,UAAU,IACX,4BAAC,cAAD;AACC,IAAA,SAAS,EAAC,6CADX;AAEC,IAAA,QAAQ,EAAGV,QAFZ;AAGC,IAAA,IAAI,EAAGN,UAHR;AAIC,IAAA,OAAO,EAAG,MAAMiB,aAAa,CAAE,KAAF,CAJ9B;AAKC,IAAA,MAAM,EAAGC,aALV;AAMC,IAAA,mBAAmB,EAAGkC,aANvB;AAOC,IAAA,QAAQ,EAAGD,UAPZ;AAQC,IAAA,QAAQ,EAAK+B,YAAF,IAAoB;AAC9B,8CACCA,YADD,EAEChF,aAFD,EAGCF,UAHD;AAKA;AAdF,IApGF,CAFD,EAwHC,mCAAU+D,gBAAV,CAxHD,CAnED,CADD;AAgMA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { unescape } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tPanelBody,\n\tTextControl,\n\tTextareaControl,\n\tToolbarButton,\n\tTooltip,\n\tToolbarGroup,\n\tKeyboardShortcuts,\n} from '@wordpress/components';\nimport { displayShortcut, isKeyboardEvent, ENTER } from '@wordpress/keycodes';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tgetColorClassName,\n\tuseInnerBlocksProps,\n} from '@wordpress/block-editor';\nimport { isURL, prependHTTP } from '@wordpress/url';\nimport { Fragment, useState, useEffect, useRef } from '@wordpress/element';\nimport {\n\tplaceCaretAtHorizontalEdge,\n\t__unstableStripHTML as stripHTML,\n} from '@wordpress/dom';\nimport { link as linkIcon, addSubmenu } from '@wordpress/icons';\nimport {\n\tstore as coreStore,\n\tuseResourcePermissions,\n} from '@wordpress/core-data';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { name } from './block.json';\nimport { LinkUI } from './link-ui';\nimport { updateAttributes } from './update-attributes';\n\n/**\n * A React hook to determine if it's dragging within the target element.\n *\n * @typedef {import('@wordpress/element').RefObject} RefObject\n *\n * @param {RefObject<HTMLElement>} elementRef The target elementRef object.\n *\n * @return {boolean} Is dragging within the target element.\n */\nconst useIsDraggingWithin = ( elementRef ) => {\n\tconst [ isDraggingWithin, setIsDraggingWithin ] = useState( false );\n\n\tuseEffect( () => {\n\t\tconst { ownerDocument } = elementRef.current;\n\n\t\tfunction handleDragStart( event ) {\n\t\t\t// Check the first time when the dragging starts.\n\t\t\thandleDragEnter( event );\n\t\t}\n\n\t\t// Set to false whenever the user cancel the drag event by either releasing the mouse or press Escape.\n\t\tfunction handleDragEnd() {\n\t\t\tsetIsDraggingWithin( false );\n\t\t}\n\n\t\tfunction handleDragEnter( event ) {\n\t\t\t// Check if the current target is inside the item element.\n\t\t\tif ( elementRef.current.contains( event.target ) ) {\n\t\t\t\tsetIsDraggingWithin( true );\n\t\t\t} else {\n\t\t\t\tsetIsDraggingWithin( false );\n\t\t\t}\n\t\t}\n\n\t\t// Bind these events to the document to catch all drag events.\n\t\t// Ideally, we can also use `event.relatedTarget`, but sadly that\n\t\t// doesn't work in Safari.\n\t\townerDocument.addEventListener( 'dragstart', handleDragStart );\n\t\townerDocument.addEventListener( 'dragend', handleDragEnd );\n\t\townerDocument.addEventListener( 'dragenter', handleDragEnter );\n\n\t\treturn () => {\n\t\t\townerDocument.removeEventListener( 'dragstart', handleDragStart );\n\t\t\townerDocument.removeEventListener( 'dragend', handleDragEnd );\n\t\t\townerDocument.removeEventListener( 'dragenter', handleDragEnter );\n\t\t};\n\t}, [] );\n\n\treturn isDraggingWithin;\n};\n\n/**\n * Determine the colors for a menu.\n *\n * Order of priority is:\n * 1: Overlay custom colors (if submenu)\n * 2: Overlay theme colors (if submenu)\n * 3: Custom colors\n * 4: Theme colors\n * 5: Global styles\n *\n * @param {Object} context\n * @param {boolean} isSubMenu\n */\nfunction getColors( context, isSubMenu ) {\n\tconst {\n\t\ttextColor,\n\t\tcustomTextColor,\n\t\tbackgroundColor,\n\t\tcustomBackgroundColor,\n\t\toverlayTextColor,\n\t\tcustomOverlayTextColor,\n\t\toverlayBackgroundColor,\n\t\tcustomOverlayBackgroundColor,\n\t\tstyle,\n\t} = context;\n\n\tconst colors = {};\n\n\tif ( isSubMenu && !! customOverlayTextColor ) {\n\t\tcolors.customTextColor = customOverlayTextColor;\n\t} else if ( isSubMenu && !! overlayTextColor ) {\n\t\tcolors.textColor = overlayTextColor;\n\t} else if ( !! customTextColor ) {\n\t\tcolors.customTextColor = customTextColor;\n\t} else if ( !! textColor ) {\n\t\tcolors.textColor = textColor;\n\t} else if ( !! style?.color?.text ) {\n\t\tcolors.customTextColor = style.color.text;\n\t}\n\n\tif ( isSubMenu && !! customOverlayBackgroundColor ) {\n\t\tcolors.customBackgroundColor = customOverlayBackgroundColor;\n\t} else if ( isSubMenu && !! overlayBackgroundColor ) {\n\t\tcolors.backgroundColor = overlayBackgroundColor;\n\t} else if ( !! customBackgroundColor ) {\n\t\tcolors.customBackgroundColor = customBackgroundColor;\n\t} else if ( !! backgroundColor ) {\n\t\tcolors.backgroundColor = backgroundColor;\n\t} else if ( !! style?.color?.background ) {\n\t\tcolors.customTextColor = style.color.background;\n\t}\n\n\treturn colors;\n}\n\nconst useIsInvalidLink = ( kind, type, id ) => {\n\tconst isPostType =\n\t\tkind === 'post-type' || type === 'post' || type === 'page';\n\tconst hasId = Number.isInteger( id );\n\tconst postStatus = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! isPostType ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\t\t\treturn getEntityRecord( 'postType', type, id )?.status;\n\t\t},\n\t\t[ isPostType, type, id ]\n\t);\n\n\t// Check Navigation Link validity if:\n\t// 1. Link is 'post-type'.\n\t// 2. It has an id.\n\t// 3. It's neither null, nor undefined, as valid items might be either of those while loading.\n\t// If those conditions are met, check if\n\t// 1. The post status is published.\n\t// 2. The Navigation Link item has no label.\n\t// If either of those is true, invalidate.\n\tconst isInvalid =\n\t\tisPostType && hasId && postStatus && 'trash' === postStatus;\n\tconst isDraft = 'draft' === postStatus;\n\n\treturn [ isInvalid, isDraft ];\n};\n\nfunction getMissingText( type ) {\n\tlet missingText = '';\n\n\tswitch ( type ) {\n\t\tcase 'post':\n\t\t\t/* translators: label for missing post in navigation link block */\n\t\t\tmissingText = __( 'Select post' );\n\t\t\tbreak;\n\t\tcase 'page':\n\t\t\t/* translators: label for missing page in navigation link block */\n\t\t\tmissingText = __( 'Select page' );\n\t\t\tbreak;\n\t\tcase 'category':\n\t\t\t/* translators: label for missing category in navigation link block */\n\t\t\tmissingText = __( 'Select category' );\n\t\t\tbreak;\n\t\tcase 'tag':\n\t\t\t/* translators: label for missing tag in navigation link block */\n\t\t\tmissingText = __( 'Select tag' );\n\t\t\tbreak;\n\t\tdefault:\n\t\t\t/* translators: label for missing values in navigation link block */\n\t\t\tmissingText = __( 'Add link' );\n\t}\n\n\treturn missingText;\n}\n\nexport default function NavigationLinkEdit( {\n\tattributes,\n\tisSelected,\n\tsetAttributes,\n\tinsertBlocksAfter,\n\tmergeBlocks,\n\tonReplace,\n\tcontext,\n\tclientId,\n} ) {\n\tconst { id, label, type, url, description, rel, title, kind } = attributes;\n\n\tconst [ isInvalid, isDraft ] = useIsInvalidLink( kind, type, id );\n\tconst { maxNestingLevel } = context;\n\n\tconst { replaceBlock, __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst [ isLinkOpen, setIsLinkOpen ] = useState( false );\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst listItemRef = useRef( null );\n\tconst isDraggingWithin = useIsDraggingWithin( listItemRef );\n\tconst itemLabelPlaceholder = __( 'Add label…' );\n\tconst ref = useRef();\n\n\tconst pagesPermissions = useResourcePermissions( 'pages' );\n\tconst postsPermissions = useResourcePermissions( 'posts' );\n\n\tconst {\n\t\tinnerBlocks,\n\t\tisAtMaxNesting,\n\t\tisTopLevelLink,\n\t\tisParentOfSelectedBlock,\n\t\thasChildren,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlocks,\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tgetBlockParentsByBlockName,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\treturn {\n\t\t\t\tinnerBlocks: getBlocks( clientId ),\n\t\t\t\tisAtMaxNesting:\n\t\t\t\t\tgetBlockParentsByBlockName( clientId, [\n\t\t\t\t\t\tname,\n\t\t\t\t\t\t'core/navigation-submenu',\n\t\t\t\t\t] ).length >= maxNestingLevel,\n\t\t\t\tisTopLevelLink:\n\t\t\t\t\tgetBlockName( getBlockRootClientId( clientId ) ) ===\n\t\t\t\t\t'core/navigation',\n\t\t\t\tisParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\ttrue\n\t\t\t\t),\n\t\t\t\thasChildren: !! getBlockCount( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tuseEffect( () => {\n\t\t// This side-effect should not create an undo level as those should\n\t\t// only be created via user interactions. Mark this change as\n\t\t// not persistent to avoid undo level creation.\n\t\t// See https://github.com/WordPress/gutenberg/issues/34564.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tsetAttributes( { isTopLevelLink } );\n\t}, [ isTopLevelLink ] );\n\n\t/**\n\t * Transform to submenu block.\n\t */\n\tfunction transformToSubmenu() {\n\t\tconst newSubmenu = createBlock(\n\t\t\t'core/navigation-submenu',\n\t\t\tattributes,\n\t\t\tinnerBlocks.length > 0\n\t\t\t\t? innerBlocks\n\t\t\t\t: [ createBlock( 'core/navigation-link' ) ]\n\t\t);\n\t\treplaceBlock( clientId, newSubmenu );\n\t}\n\n\tuseEffect( () => {\n\t\t// Show the LinkControl on mount if the URL is empty\n\t\t// ( When adding a new menu item)\n\t\t// This can't be done in the useState call because it conflicts\n\t\t// with the autofocus behavior of the BlockListBlock component.\n\t\tif ( ! url ) {\n\t\t\tsetIsLinkOpen( true );\n\t\t}\n\t}, [ url ] );\n\n\tuseEffect( () => {\n\t\t// If block has inner blocks, transform to Submenu.\n\t\tif ( hasChildren ) {\n\t\t\ttransformToSubmenu();\n\t\t}\n\t}, [ hasChildren ] );\n\n\t/**\n\t * The hook shouldn't be necessary but due to a focus loss happening\n\t * when selecting a suggestion in the link popover, we force close on block unselection.\n\t */\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetIsLinkOpen( false );\n\t\t}\n\t}, [ isSelected ] );\n\n\t// If the LinkControl popover is open and the URL has changed, close the LinkControl and focus the label text.\n\tuseEffect( () => {\n\t\tif ( isLinkOpen && url ) {\n\t\t\t// Does this look like a URL and have something TLD-ish?\n\t\t\tif (\n\t\t\t\tisURL( prependHTTP( label ) ) &&\n\t\t\t\t/^.+\\.[a-z]+/.test( label )\n\t\t\t) {\n\t\t\t\t// Focus and select the label text.\n\t\t\t\tselectLabelText();\n\t\t\t} else {\n\t\t\t\t// Focus it (but do not select).\n\t\t\t\tplaceCaretAtHorizontalEdge( ref.current, true );\n\t\t\t}\n\t\t}\n\t}, [ url ] );\n\n\t/**\n\t * Focus the Link label text and select it.\n\t */\n\tfunction selectLabelText() {\n\t\tref.current.focus();\n\t\tconst { ownerDocument } = ref.current;\n\t\tconst { defaultView } = ownerDocument;\n\t\tconst selection = defaultView.getSelection();\n\t\tconst range = ownerDocument.createRange();\n\t\t// Get the range of the current ref contents so we can add this range to the selection.\n\t\trange.selectNodeContents( ref.current );\n\t\tselection.removeAllRanges();\n\t\tselection.addRange( range );\n\t}\n\n\t/**\n\t * Removes the current link if set.\n\t */\n\tfunction removeLink() {\n\t\t// Reset all attributes that comprise the link.\n\t\tsetAttributes( {\n\t\t\turl: '',\n\t\t\tlabel: '',\n\t\t\tid: '',\n\t\t\tkind: '',\n\t\t\ttype: '',\n\t\t} );\n\n\t\t// Close the link editing UI.\n\t\tsetIsLinkOpen( false );\n\t}\n\n\tlet userCanCreate = false;\n\tif ( ! type || type === 'page' ) {\n\t\tuserCanCreate = pagesPermissions.canCreate;\n\t} else if ( type === 'post' ) {\n\t\tuserCanCreate = postsPermissions.canCreate;\n\t}\n\n\tconst {\n\t\ttextColor,\n\t\tcustomTextColor,\n\t\tbackgroundColor,\n\t\tcustomBackgroundColor,\n\t} = getColors( context, ! isTopLevelLink );\n\n\tfunction onKeyDown( event ) {\n\t\tif (\n\t\t\tisKeyboardEvent.primary( event, 'k' ) ||\n\t\t\t( ! url && event.keyCode === ENTER )\n\t\t) {\n\t\t\tsetIsLinkOpen( true );\n\t\t}\n\t}\n\n\tconst blockProps = useBlockProps( {\n\t\tref: useMergeRefs( [ setPopoverAnchor, listItemRef ] ),\n\t\tclassName: classnames( 'wp-block-navigation-item', {\n\t\t\t'is-editing': isSelected || isParentOfSelectedBlock,\n\t\t\t'is-dragging-within': isDraggingWithin,\n\t\t\t'has-link': !! url,\n\t\t\t'has-child': hasChildren,\n\t\t\t'has-text-color': !! textColor || !! customTextColor,\n\t\t\t[ getColorClassName( 'color', textColor ) ]: !! textColor,\n\t\t\t'has-background': !! backgroundColor || customBackgroundColor,\n\t\t\t[ getColorClassName( 'background-color', backgroundColor ) ]:\n\t\t\t\t!! backgroundColor,\n\t\t} ),\n\t\tstyle: {\n\t\t\tcolor: ! textColor && customTextColor,\n\t\t\tbackgroundColor: ! backgroundColor && customBackgroundColor,\n\t\t},\n\t\tonKeyDown,\n\t} );\n\n\tconst ALLOWED_BLOCKS = [\n\t\t'core/navigation-link',\n\t\t'core/navigation-submenu',\n\t\t'core/page-list',\n\t];\n\tconst DEFAULT_BLOCK = {\n\t\tname: 'core/navigation-link',\n\t};\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tallowedBlocks: ALLOWED_BLOCKS,\n\t\t__experimentalDefaultBlock: DEFAULT_BLOCK,\n\t\t__experimentalDirectInsert: true,\n\t\trenderAppender: false,\n\t} );\n\n\tif ( ! url || isInvalid || isDraft ) {\n\t\tblockProps.onClick = () => setIsLinkOpen( true );\n\t}\n\n\tconst classes = classnames( 'wp-block-navigation-item__content', {\n\t\t'wp-block-navigation-link__placeholder': ! url || isInvalid || isDraft,\n\t} );\n\n\tconst missingText = getMissingText( type );\n\t/* translators: Whether the navigation link is Invalid or a Draft. */\n\tconst placeholderText = `(${\n\t\tisInvalid ? __( 'Invalid' ) : __( 'Draft' )\n\t})`;\n\tconst tooltipText =\n\t\tisInvalid || isDraft\n\t\t\t? __( 'This item has been deleted, or is a draft' )\n\t\t\t: __( 'This item is missing a link' );\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tname=\"link\"\n\t\t\t\t\t\ticon={ linkIcon }\n\t\t\t\t\t\ttitle={ __( 'Link' ) }\n\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t\tonClick={ () => setIsLinkOpen( true ) }\n\t\t\t\t\t/>\n\t\t\t\t\t{ ! isAtMaxNesting && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tname=\"submenu\"\n\t\t\t\t\t\t\ticon={ addSubmenu }\n\t\t\t\t\t\t\ttitle={ __( 'Add submenu' ) }\n\t\t\t\t\t\t\tonClick={ transformToSubmenu }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t\t{ /* Warning, this duplicated in packages/block-library/src/navigation-submenu/edit.js */ }\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Link settings' ) }>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tvalue={ label ? stripHTML( label ) : '' }\n\t\t\t\t\t\tonChange={ ( labelValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { label: labelValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Label' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tvalue={ url || '' }\n\t\t\t\t\t\tonChange={ ( urlValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { url: urlValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'URL' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\tvalue={ description || '' }\n\t\t\t\t\t\tonChange={ ( descriptionValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { description: descriptionValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Description' ) }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'The description will be displayed in the menu if the current theme supports it.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tvalue={ title || '' }\n\t\t\t\t\t\tonChange={ ( titleValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { title: titleValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Link title' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tvalue={ rel || '' }\n\t\t\t\t\t\tonChange={ ( relValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { rel: relValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Link rel' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ /* eslint-disable jsx-a11y/anchor-is-valid */ }\n\t\t\t\t<a className={ classes }>\n\t\t\t\t\t{ /* eslint-enable */ }\n\t\t\t\t\t{ ! url ? (\n\t\t\t\t\t\t<div className=\"wp-block-navigation-link__placeholder-text\">\n\t\t\t\t\t\t\t<Tooltip position=\"top center\" text={ tooltipText }>\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<span>{ missingText }</span>\n\t\t\t\t\t\t\t\t\t<span className=\"wp-block-navigation-link__missing_text-tooltip\">\n\t\t\t\t\t\t\t\t\t\t{ tooltipText }\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</Tooltip>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ ! isInvalid && ! isDraft && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"wp-block-navigation-item__label\"\n\t\t\t\t\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\t\t\t\t\tonChange={ ( labelValue ) =>\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: labelValue,\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\tonMerge={ mergeBlocks }\n\t\t\t\t\t\t\t\t\t\tonReplace={ onReplace }\n\t\t\t\t\t\t\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\t\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'core/navigation-link'\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)\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t\t\t\t\t\t'Navigation link text'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tplaceholder={ itemLabelPlaceholder }\n\t\t\t\t\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\t\t\t\t\tallowedFormats={ [\n\t\t\t\t\t\t\t\t\t\t\t'core/bold',\n\t\t\t\t\t\t\t\t\t\t\t'core/italic',\n\t\t\t\t\t\t\t\t\t\t\t'core/image',\n\t\t\t\t\t\t\t\t\t\t\t'core/strikethrough',\n\t\t\t\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tif ( ! url ) {\n\t\t\t\t\t\t\t\t\t\t\t\tsetIsLinkOpen( true );\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{ description && (\n\t\t\t\t\t\t\t\t\t\t<span className=\"wp-block-navigation-item__description\">\n\t\t\t\t\t\t\t\t\t\t\t{ description }\n\t\t\t\t\t\t\t\t\t\t</span>\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\t{ ( isInvalid || isDraft ) && (\n\t\t\t\t\t\t\t\t<div className=\"wp-block-navigation-link__placeholder-text wp-block-navigation-link__label\">\n\t\t\t\t\t\t\t\t\t<KeyboardShortcuts\n\t\t\t\t\t\t\t\t\t\tshortcuts={ {\n\t\t\t\t\t\t\t\t\t\t\tenter: () =>\n\t\t\t\t\t\t\t\t\t\t\t\tisSelected &&\n\t\t\t\t\t\t\t\t\t\t\t\tsetIsLinkOpen( true ),\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<Tooltip\n\t\t\t\t\t\t\t\t\t\tposition=\"top center\"\n\t\t\t\t\t\t\t\t\t\ttext={ tooltipText }\n\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\t\t<span\n\t\t\t\t\t\t\t\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Navigation link text'\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>\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\t\t// Some attributes are stored in an escaped form. It's a legacy issue.\n\t\t\t\t\t\t\t\t\t\t\t\t\t// Ideally they would be stored in a raw, unescaped form.\n\t\t\t\t\t\t\t\t\t\t\t\t\t// Unescape is used here to \"recover\" the escaped characters\n\t\t\t\t\t\t\t\t\t\t\t\t\t// so they display without encoding.\n\t\t\t\t\t\t\t\t\t\t\t\t\t// See `updateAttributes` for more details.\n\t\t\t\t\t\t\t\t\t\t\t\t\t`${ unescape(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel\n\t\t\t\t\t\t\t\t\t\t\t\t\t) } ${ placeholderText }`.trim()\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</span>\n\t\t\t\t\t\t\t\t\t\t\t<span className=\"wp-block-navigation-link__missing_text-tooltip\">\n\t\t\t\t\t\t\t\t\t\t\t\t{ tooltipText }\n\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t</Tooltip>\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) }\n\t\t\t\t\t{ isLinkOpen && (\n\t\t\t\t\t\t<LinkUI\n\t\t\t\t\t\t\tclassName=\"wp-block-navigation-link__inline-link-input\"\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tlink={ attributes }\n\t\t\t\t\t\t\tonClose={ () => setIsLinkOpen( false ) }\n\t\t\t\t\t\t\tanchor={ popoverAnchor }\n\t\t\t\t\t\t\thasCreateSuggestion={ userCanCreate }\n\t\t\t\t\t\t\tonRemove={ removeLink }\n\t\t\t\t\t\t\tonChange={ ( updatedValue ) => {\n\t\t\t\t\t\t\t\tupdateAttributes(\n\t\t\t\t\t\t\t\t\tupdatedValue,\n\t\t\t\t\t\t\t\t\tsetAttributes,\n\t\t\t\t\t\t\t\t\tattributes\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</a>\n\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t</div>\n\t\t</Fragment>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/navigation-link/edit.js"],"names":["useIsDraggingWithin","elementRef","isDraggingWithin","setIsDraggingWithin","ownerDocument","current","handleDragStart","event","handleDragEnter","handleDragEnd","contains","target","addEventListener","removeEventListener","useIsInvalidLink","kind","type","id","isPostType","hasId","Number","isInteger","postStatus","select","getEntityRecord","coreStore","status","isInvalid","isDraft","getMissingText","missingText","NavigationLinkEdit","attributes","isSelected","setAttributes","insertBlocksAfter","mergeBlocks","onReplace","context","clientId","label","url","description","rel","title","maxNestingLevel","replaceBlock","__unstableMarkNextChangeAsNotPersistent","blockEditorStore","isLinkOpen","setIsLinkOpen","popoverAnchor","setPopoverAnchor","listItemRef","itemLabelPlaceholder","ref","pagesPermissions","postsPermissions","innerBlocks","isAtMaxNesting","isTopLevelLink","isParentOfSelectedBlock","hasChildren","getBlocks","getBlockCount","getBlockName","getBlockRootClientId","hasSelectedInnerBlock","getBlockParentsByBlockName","name","length","transformToSubmenu","newSubmenu","test","selectLabelText","focus","defaultView","selection","getSelection","range","createRange","selectNodeContents","removeAllRanges","addRange","removeLink","userCanCreate","canCreate","textColor","customTextColor","backgroundColor","customBackgroundColor","onKeyDown","isKeyboardEvent","primary","keyCode","ENTER","blockProps","className","style","color","ALLOWED_BLOCKS","DEFAULT_BLOCK","innerBlocksProps","allowedBlocks","__experimentalDefaultBlock","__experimentalDirectInsert","renderAppender","onClick","classes","placeholderText","tooltipText","linkIcon","displayShortcut","addSubmenu","labelValue","urlValue","descriptionValue","titleValue","relValue","enter","trim","updatedValue"],"mappings":";;;;;;;;;AAgCA;;AA7BA;;AACA;;AAKA;;AACA;;AACA;;AASA;;AACA;;AACA;;AASA;;AAEA;;AAIA;;AACA;;AAIA;;AAMA;;AACA;;AACA;;AAlDA;AACA;AACA;;AAIA;AACA;AACA;;AAoCA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,mBAAmB,GAAKC,UAAF,IAAkB;AAC7C,QAAM,CAAEC,gBAAF,EAAoBC,mBAApB,IAA4C,uBAAU,KAAV,CAAlD;AAEA,0BAAW,MAAM;AAChB,UAAM;AAAEC,MAAAA;AAAF,QAAoBH,UAAU,CAACI,OAArC;;AAEA,aAASC,eAAT,CAA0BC,KAA1B,EAAkC;AACj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JgB,CAxBlB;AA8BC,IAAA,OAAO,EAAG,MAAM;AACf,UAAK,CAAEb,GAAP,EAAa;AACZS,QAAAA,aAAa,CAAE,IAAF,CAAb;AACA;AACD;AAlCF,IADD,EAqCGR,WAAW,IACZ;AAAM,IAAA,SAAS,EAAC;AAAhB,KACGA,WADH,CAtCF,CAFF,EA8CG,CAAEf,SAAS,IAAIC,OAAf,KACD;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,6BAAD;AACC,IAAA,SAAS,EAAG;AACX2F,MAAAA,KAAK,EAAE,MACNtF,UAAU,IACViB,aAAa,CAAE,IAAF;AAHH;AADb,IADD,EAQC,4BAAC,mBAAD;AACC,IAAA,QAAQ,EAAC,YADV;AAEC,IAAA,IAAI,EAAG4D;AAFR,KAIC,qDACC;AACC,kBAAa,cACZ,sBADY;AADd,KAME;AACA;AACA;AACA;AACA;AACC,KAAG,sBACHtE,KADG,CAED,IAAIqE,eAAiB,EAFxB,CAE0BW,IAF1B,EAXF,CADD,EAiBC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACGV,WADH,CAjBD,CAJD,CARD,CA/CF,CAdF,EAmGG7D,UAAU,IACX,4BAAC,cAAD;AACC,IAAA,SAAS,EAAC,6CADX;AAEC,IAAA,QAAQ,EAAGV,QAFZ;AAGC,IAAA,IAAI,EAAGP,UAHR;AAIC,IAAA,OAAO,EAAG,MAAMkB,aAAa,CAAE,KAAF,CAJ9B;AAKC,IAAA,MAAM,EAAGC,aALV;AAMC,IAAA,mBAAmB,EAAGkC,aANvB;AAOC,IAAA,QAAQ,EAAGD,UAPZ;AAQC,IAAA,QAAQ,EAAKqC,YAAF,IAAoB;AAC9B,8CACCA,YADD,EAECvF,aAFD,EAGCF,UAHD;AAKA;AAdF,IApGF,CAFD,EAwHC,mCAAUsE,gBAAV,CAxHD,CApED,CADD;AAiMA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { unescape } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tPanelBody,\n\tTextControl,\n\tTextareaControl,\n\tToolbarButton,\n\tTooltip,\n\tToolbarGroup,\n\tKeyboardShortcuts,\n} from '@wordpress/components';\nimport { displayShortcut, isKeyboardEvent, ENTER } from '@wordpress/keycodes';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tgetColorClassName,\n\tuseInnerBlocksProps,\n} from '@wordpress/block-editor';\nimport { isURL, prependHTTP } from '@wordpress/url';\nimport { useState, useEffect, useRef } from '@wordpress/element';\nimport {\n\tplaceCaretAtHorizontalEdge,\n\t__unstableStripHTML as stripHTML,\n} from '@wordpress/dom';\nimport { link as linkIcon, addSubmenu } from '@wordpress/icons';\nimport {\n\tstore as coreStore,\n\tuseResourcePermissions,\n} from '@wordpress/core-data';\nimport { useMergeRefs } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { name } from './block.json';\nimport { LinkUI } from './link-ui';\nimport { updateAttributes } from './update-attributes';\nimport { getColors } from '../navigation/edit/utils';\n\n/**\n * A React hook to determine if it's dragging within the target element.\n *\n * @typedef {import('@wordpress/element').RefObject} RefObject\n *\n * @param {RefObject<HTMLElement>} elementRef The target elementRef object.\n *\n * @return {boolean} Is dragging within the target element.\n */\nconst useIsDraggingWithin = ( elementRef ) => {\n\tconst [ isDraggingWithin, setIsDraggingWithin ] = useState( false );\n\n\tuseEffect( () => {\n\t\tconst { ownerDocument } = elementRef.current;\n\n\t\tfunction handleDragStart( event ) {\n\t\t\t// Check the first time when the dragging starts.\n\t\t\thandleDragEnter( event );\n\t\t}\n\n\t\t// Set to false whenever the user cancel the drag event by either releasing the mouse or press Escape.\n\t\tfunction handleDragEnd() {\n\t\t\tsetIsDraggingWithin( false );\n\t\t}\n\n\t\tfunction handleDragEnter( event ) {\n\t\t\t// Check if the current target is inside the item element.\n\t\t\tif ( elementRef.current.contains( event.target ) ) {\n\t\t\t\tsetIsDraggingWithin( true );\n\t\t\t} else {\n\t\t\t\tsetIsDraggingWithin( false );\n\t\t\t}\n\t\t}\n\n\t\t// Bind these events to the document to catch all drag events.\n\t\t// Ideally, we can also use `event.relatedTarget`, but sadly that\n\t\t// doesn't work in Safari.\n\t\townerDocument.addEventListener( 'dragstart', handleDragStart );\n\t\townerDocument.addEventListener( 'dragend', handleDragEnd );\n\t\townerDocument.addEventListener( 'dragenter', handleDragEnter );\n\n\t\treturn () => {\n\t\t\townerDocument.removeEventListener( 'dragstart', handleDragStart );\n\t\t\townerDocument.removeEventListener( 'dragend', handleDragEnd );\n\t\t\townerDocument.removeEventListener( 'dragenter', handleDragEnter );\n\t\t};\n\t}, [] );\n\n\treturn isDraggingWithin;\n};\n\nconst useIsInvalidLink = ( kind, type, id ) => {\n\tconst isPostType =\n\t\tkind === 'post-type' || type === 'post' || type === 'page';\n\tconst hasId = Number.isInteger( id );\n\tconst postStatus = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! isPostType ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\t\t\treturn getEntityRecord( 'postType', type, id )?.status;\n\t\t},\n\t\t[ isPostType, type, id ]\n\t);\n\n\t// Check Navigation Link validity if:\n\t// 1. Link is 'post-type'.\n\t// 2. It has an id.\n\t// 3. It's neither null, nor undefined, as valid items might be either of those while loading.\n\t// If those conditions are met, check if\n\t// 1. The post status is published.\n\t// 2. The Navigation Link item has no label.\n\t// If either of those is true, invalidate.\n\tconst isInvalid =\n\t\tisPostType && hasId && postStatus && 'trash' === postStatus;\n\tconst isDraft = 'draft' === postStatus;\n\n\treturn [ isInvalid, isDraft ];\n};\n\nfunction getMissingText( type ) {\n\tlet missingText = '';\n\n\tswitch ( type ) {\n\t\tcase 'post':\n\t\t\t/* translators: label for missing post in navigation link block */\n\t\t\tmissingText = __( 'Select post' );\n\t\t\tbreak;\n\t\tcase 'page':\n\t\t\t/* translators: label for missing page in navigation link block */\n\t\t\tmissingText = __( 'Select page' );\n\t\t\tbreak;\n\t\tcase 'category':\n\t\t\t/* translators: label for missing category in navigation link block */\n\t\t\tmissingText = __( 'Select category' );\n\t\t\tbreak;\n\t\tcase 'tag':\n\t\t\t/* translators: label for missing tag in navigation link block */\n\t\t\tmissingText = __( 'Select tag' );\n\t\t\tbreak;\n\t\tdefault:\n\t\t\t/* translators: label for missing values in navigation link block */\n\t\t\tmissingText = __( 'Add link' );\n\t}\n\n\treturn missingText;\n}\n\nexport default function NavigationLinkEdit( {\n\tattributes,\n\tisSelected,\n\tsetAttributes,\n\tinsertBlocksAfter,\n\tmergeBlocks,\n\tonReplace,\n\tcontext,\n\tclientId,\n} ) {\n\tconst { id, label, type, url, description, rel, title, kind } = attributes;\n\n\tconst [ isInvalid, isDraft ] = useIsInvalidLink( kind, type, id );\n\tconst { maxNestingLevel } = context;\n\n\tconst { replaceBlock, __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst [ isLinkOpen, setIsLinkOpen ] = useState( false );\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\tconst listItemRef = useRef( null );\n\tconst isDraggingWithin = useIsDraggingWithin( listItemRef );\n\tconst itemLabelPlaceholder = __( 'Add label…' );\n\tconst ref = useRef();\n\n\tconst pagesPermissions = useResourcePermissions( 'pages' );\n\tconst postsPermissions = useResourcePermissions( 'posts' );\n\n\tconst {\n\t\tinnerBlocks,\n\t\tisAtMaxNesting,\n\t\tisTopLevelLink,\n\t\tisParentOfSelectedBlock,\n\t\thasChildren,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlocks,\n\t\t\t\tgetBlockCount,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tgetBlockParentsByBlockName,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\treturn {\n\t\t\t\tinnerBlocks: getBlocks( clientId ),\n\t\t\t\tisAtMaxNesting:\n\t\t\t\t\tgetBlockParentsByBlockName( clientId, [\n\t\t\t\t\t\tname,\n\t\t\t\t\t\t'core/navigation-submenu',\n\t\t\t\t\t] ).length >= maxNestingLevel,\n\t\t\t\tisTopLevelLink:\n\t\t\t\t\tgetBlockName( getBlockRootClientId( clientId ) ) ===\n\t\t\t\t\t'core/navigation',\n\t\t\t\tisParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\ttrue\n\t\t\t\t),\n\t\t\t\thasChildren: !! getBlockCount( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tuseEffect( () => {\n\t\t// This side-effect should not create an undo level as those should\n\t\t// only be created via user interactions. Mark this change as\n\t\t// not persistent to avoid undo level creation.\n\t\t// See https://github.com/WordPress/gutenberg/issues/34564.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tsetAttributes( { isTopLevelLink } );\n\t}, [ isTopLevelLink ] );\n\n\t/**\n\t * Transform to submenu block.\n\t */\n\tfunction transformToSubmenu() {\n\t\tconst newSubmenu = createBlock(\n\t\t\t'core/navigation-submenu',\n\t\t\tattributes,\n\t\t\tinnerBlocks.length > 0\n\t\t\t\t? innerBlocks\n\t\t\t\t: [ createBlock( 'core/navigation-link' ) ]\n\t\t);\n\t\treplaceBlock( clientId, newSubmenu );\n\t}\n\n\tuseEffect( () => {\n\t\t// Show the LinkControl on mount if the URL is empty\n\t\t// ( When adding a new menu item)\n\t\t// This can't be done in the useState call because it conflicts\n\t\t// with the autofocus behavior of the BlockListBlock component.\n\t\tif ( ! url ) {\n\t\t\tsetIsLinkOpen( true );\n\t\t}\n\t}, [ url ] );\n\n\tuseEffect( () => {\n\t\t// If block has inner blocks, transform to Submenu.\n\t\tif ( hasChildren ) {\n\t\t\ttransformToSubmenu();\n\t\t}\n\t}, [ hasChildren ] );\n\n\t/**\n\t * The hook shouldn't be necessary but due to a focus loss happening\n\t * when selecting a suggestion in the link popover, we force close on block unselection.\n\t */\n\tuseEffect( () => {\n\t\tif ( ! isSelected ) {\n\t\t\tsetIsLinkOpen( false );\n\t\t}\n\t}, [ isSelected ] );\n\n\t// If the LinkControl popover is open and the URL has changed, close the LinkControl and focus the label text.\n\tuseEffect( () => {\n\t\tif ( isLinkOpen && url ) {\n\t\t\t// Does this look like a URL and have something TLD-ish?\n\t\t\tif (\n\t\t\t\tisURL( prependHTTP( label ) ) &&\n\t\t\t\t/^.+\\.[a-z]+/.test( label )\n\t\t\t) {\n\t\t\t\t// Focus and select the label text.\n\t\t\t\tselectLabelText();\n\t\t\t} else {\n\t\t\t\t// Focus it (but do not select).\n\t\t\t\tplaceCaretAtHorizontalEdge( ref.current, true );\n\t\t\t}\n\t\t}\n\t}, [ url ] );\n\n\t/**\n\t * Focus the Link label text and select it.\n\t */\n\tfunction selectLabelText() {\n\t\tref.current.focus();\n\t\tconst { ownerDocument } = ref.current;\n\t\tconst { defaultView } = ownerDocument;\n\t\tconst selection = defaultView.getSelection();\n\t\tconst range = ownerDocument.createRange();\n\t\t// Get the range of the current ref contents so we can add this range to the selection.\n\t\trange.selectNodeContents( ref.current );\n\t\tselection.removeAllRanges();\n\t\tselection.addRange( range );\n\t}\n\n\t/**\n\t * Removes the current link if set.\n\t */\n\tfunction removeLink() {\n\t\t// Reset all attributes that comprise the link.\n\t\tsetAttributes( {\n\t\t\turl: '',\n\t\t\tlabel: '',\n\t\t\tid: '',\n\t\t\tkind: '',\n\t\t\ttype: '',\n\t\t} );\n\n\t\t// Close the link editing UI.\n\t\tsetIsLinkOpen( false );\n\t}\n\n\tlet userCanCreate = false;\n\tif ( ! type || type === 'page' ) {\n\t\tuserCanCreate = pagesPermissions.canCreate;\n\t} else if ( type === 'post' ) {\n\t\tuserCanCreate = postsPermissions.canCreate;\n\t}\n\n\tconst {\n\t\ttextColor,\n\t\tcustomTextColor,\n\t\tbackgroundColor,\n\t\tcustomBackgroundColor,\n\t} = getColors( context, ! isTopLevelLink );\n\n\tfunction onKeyDown( event ) {\n\t\tif (\n\t\t\tisKeyboardEvent.primary( event, 'k' ) ||\n\t\t\t( ! url && event.keyCode === ENTER )\n\t\t) {\n\t\t\tsetIsLinkOpen( true );\n\t\t}\n\t}\n\n\tconst blockProps = useBlockProps( {\n\t\tref: useMergeRefs( [ setPopoverAnchor, listItemRef ] ),\n\t\tclassName: classnames( 'wp-block-navigation-item', {\n\t\t\t'is-editing': isSelected || isParentOfSelectedBlock,\n\t\t\t'is-dragging-within': isDraggingWithin,\n\t\t\t'has-link': !! url,\n\t\t\t'has-child': hasChildren,\n\t\t\t'has-text-color': !! textColor || !! customTextColor,\n\t\t\t[ getColorClassName( 'color', textColor ) ]: !! textColor,\n\t\t\t'has-background': !! backgroundColor || customBackgroundColor,\n\t\t\t[ getColorClassName( 'background-color', backgroundColor ) ]:\n\t\t\t\t!! backgroundColor,\n\t\t} ),\n\t\tstyle: {\n\t\t\tcolor: ! textColor && customTextColor,\n\t\t\tbackgroundColor: ! backgroundColor && customBackgroundColor,\n\t\t},\n\t\tonKeyDown,\n\t} );\n\n\tconst ALLOWED_BLOCKS = [\n\t\t'core/navigation-link',\n\t\t'core/navigation-submenu',\n\t\t'core/page-list',\n\t];\n\tconst DEFAULT_BLOCK = {\n\t\tname: 'core/navigation-link',\n\t};\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tallowedBlocks: ALLOWED_BLOCKS,\n\t\t__experimentalDefaultBlock: DEFAULT_BLOCK,\n\t\t__experimentalDirectInsert: true,\n\t\trenderAppender: false,\n\t} );\n\n\tif ( ! url || isInvalid || isDraft ) {\n\t\tblockProps.onClick = () => setIsLinkOpen( true );\n\t}\n\n\tconst classes = classnames( 'wp-block-navigation-item__content', {\n\t\t'wp-block-navigation-link__placeholder': ! url || isInvalid || isDraft,\n\t} );\n\n\tconst missingText = getMissingText( type );\n\t/* translators: Whether the navigation link is Invalid or a Draft. */\n\tconst placeholderText = `(${\n\t\tisInvalid ? __( 'Invalid' ) : __( 'Draft' )\n\t})`;\n\tconst tooltipText =\n\t\tisInvalid || isDraft\n\t\t\t? __( 'This item has been deleted, or is a draft' )\n\t\t\t: __( 'This item is missing a link' );\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tname=\"link\"\n\t\t\t\t\t\ticon={ linkIcon }\n\t\t\t\t\t\ttitle={ __( 'Link' ) }\n\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t\tonClick={ () => setIsLinkOpen( true ) }\n\t\t\t\t\t/>\n\t\t\t\t\t{ ! isAtMaxNesting && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tname=\"submenu\"\n\t\t\t\t\t\t\ticon={ addSubmenu }\n\t\t\t\t\t\t\ttitle={ __( 'Add submenu' ) }\n\t\t\t\t\t\t\tonClick={ transformToSubmenu }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ToolbarGroup>\n\t\t\t</BlockControls>\n\t\t\t{ /* Warning, this duplicated in packages/block-library/src/navigation-submenu/edit.js */ }\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Link settings' ) }>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tvalue={ label ? stripHTML( label ) : '' }\n\t\t\t\t\t\tonChange={ ( labelValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { label: labelValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Label' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tvalue={ url || '' }\n\t\t\t\t\t\tonChange={ ( urlValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { url: urlValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'URL' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tvalue={ description || '' }\n\t\t\t\t\t\tonChange={ ( descriptionValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { description: descriptionValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Description' ) }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'The description will be displayed in the menu if the current theme supports it.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tvalue={ title || '' }\n\t\t\t\t\t\tonChange={ ( titleValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { title: titleValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Link title' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tvalue={ rel || '' }\n\t\t\t\t\t\tonChange={ ( relValue ) => {\n\t\t\t\t\t\t\tsetAttributes( { rel: relValue } );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Link rel' ) }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ /* eslint-disable jsx-a11y/anchor-is-valid */ }\n\t\t\t\t<a className={ classes }>\n\t\t\t\t\t{ /* eslint-enable */ }\n\t\t\t\t\t{ ! url ? (\n\t\t\t\t\t\t<div className=\"wp-block-navigation-link__placeholder-text\">\n\t\t\t\t\t\t\t<Tooltip position=\"top center\" text={ tooltipText }>\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<span>{ missingText }</span>\n\t\t\t\t\t\t\t\t\t<span className=\"wp-block-navigation-link__missing_text-tooltip\">\n\t\t\t\t\t\t\t\t\t\t{ tooltipText }\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</Tooltip>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ ! isInvalid && ! isDraft && (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\t\t\t\tidentifier=\"label\"\n\t\t\t\t\t\t\t\t\t\tclassName=\"wp-block-navigation-item__label\"\n\t\t\t\t\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\t\t\t\t\tonChange={ ( labelValue ) =>\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\tlabel: labelValue,\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\tonMerge={ mergeBlocks }\n\t\t\t\t\t\t\t\t\t\tonReplace={ onReplace }\n\t\t\t\t\t\t\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\t\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\t\t\t\t\t\tcreateBlock(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'core/navigation-link'\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)\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t\t\t\t\t\t'Navigation link text'\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tplaceholder={ itemLabelPlaceholder }\n\t\t\t\t\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\t\t\t\t\tallowedFormats={ [\n\t\t\t\t\t\t\t\t\t\t\t'core/bold',\n\t\t\t\t\t\t\t\t\t\t\t'core/italic',\n\t\t\t\t\t\t\t\t\t\t\t'core/image',\n\t\t\t\t\t\t\t\t\t\t\t'core/strikethrough',\n\t\t\t\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tif ( ! url ) {\n\t\t\t\t\t\t\t\t\t\t\t\tsetIsLinkOpen( true );\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{ description && (\n\t\t\t\t\t\t\t\t\t\t<span className=\"wp-block-navigation-item__description\">\n\t\t\t\t\t\t\t\t\t\t\t{ description }\n\t\t\t\t\t\t\t\t\t\t</span>\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\t{ ( isInvalid || isDraft ) && (\n\t\t\t\t\t\t\t\t<div className=\"wp-block-navigation-link__placeholder-text wp-block-navigation-link__label\">\n\t\t\t\t\t\t\t\t\t<KeyboardShortcuts\n\t\t\t\t\t\t\t\t\t\tshortcuts={ {\n\t\t\t\t\t\t\t\t\t\t\tenter: () =>\n\t\t\t\t\t\t\t\t\t\t\t\tisSelected &&\n\t\t\t\t\t\t\t\t\t\t\t\tsetIsLinkOpen( true ),\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<Tooltip\n\t\t\t\t\t\t\t\t\t\tposition=\"top center\"\n\t\t\t\t\t\t\t\t\t\ttext={ tooltipText }\n\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\t\t<span\n\t\t\t\t\t\t\t\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'Navigation link text'\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>\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\t\t// Some attributes are stored in an escaped form. It's a legacy issue.\n\t\t\t\t\t\t\t\t\t\t\t\t\t// Ideally they would be stored in a raw, unescaped form.\n\t\t\t\t\t\t\t\t\t\t\t\t\t// Unescape is used here to \"recover\" the escaped characters\n\t\t\t\t\t\t\t\t\t\t\t\t\t// so they display without encoding.\n\t\t\t\t\t\t\t\t\t\t\t\t\t// See `updateAttributes` for more details.\n\t\t\t\t\t\t\t\t\t\t\t\t\t`${ unescape(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel\n\t\t\t\t\t\t\t\t\t\t\t\t\t) } ${ placeholderText }`.trim()\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</span>\n\t\t\t\t\t\t\t\t\t\t\t<span className=\"wp-block-navigation-link__missing_text-tooltip\">\n\t\t\t\t\t\t\t\t\t\t\t\t{ tooltipText }\n\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t</Tooltip>\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) }\n\t\t\t\t\t{ isLinkOpen && (\n\t\t\t\t\t\t<LinkUI\n\t\t\t\t\t\t\tclassName=\"wp-block-navigation-link__inline-link-input\"\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tlink={ attributes }\n\t\t\t\t\t\t\tonClose={ () => setIsLinkOpen( false ) }\n\t\t\t\t\t\t\tanchor={ popoverAnchor }\n\t\t\t\t\t\t\thasCreateSuggestion={ userCanCreate }\n\t\t\t\t\t\t\tonRemove={ removeLink }\n\t\t\t\t\t\t\tonChange={ ( updatedValue ) => {\n\t\t\t\t\t\t\t\tupdateAttributes(\n\t\t\t\t\t\t\t\t\tupdatedValue,\n\t\t\t\t\t\t\t\t\tsetAttributes,\n\t\t\t\t\t\t\t\t\tattributes\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</a>\n\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"]}
@@ -41,6 +41,8 @@ var _linkUi = require("../navigation-link/link-ui");
41
41
 
42
42
  var _updateAttributes = require("../navigation-link/update-attributes");
43
43
 
44
+ var _utils = require("../navigation/edit/utils");
45
+
44
46
  /**
45
47
  * External dependencies
46
48
  */
@@ -158,63 +160,6 @@ const useIsDraggingWithin = elementRef => {
158
160
  }, []);
159
161
  return isDraggingWithin;
160
162
  };
161
- /**
162
- * Determine the colors for a menu.
163
- *
164
- * Order of priority is:
165
- * 1: Overlay custom colors (if submenu)
166
- * 2: Overlay theme colors (if submenu)
167
- * 3: Custom colors
168
- * 4: Theme colors
169
- * 5: Global styles
170
- *
171
- * @param {Object} context
172
- * @param {boolean} isSubMenu
173
- */
174
-
175
-
176
- function getColors(context, isSubMenu) {
177
- var _style$color, _style$color2;
178
-
179
- const {
180
- textColor,
181
- customTextColor,
182
- backgroundColor,
183
- customBackgroundColor,
184
- overlayTextColor,
185
- customOverlayTextColor,
186
- overlayBackgroundColor,
187
- customOverlayBackgroundColor,
188
- style
189
- } = context;
190
- const colors = {};
191
-
192
- if (isSubMenu && !!customOverlayTextColor) {
193
- colors.customTextColor = customOverlayTextColor;
194
- } else if (isSubMenu && !!overlayTextColor) {
195
- colors.textColor = overlayTextColor;
196
- } else if (!!customTextColor) {
197
- colors.customTextColor = customTextColor;
198
- } else if (!!textColor) {
199
- colors.textColor = textColor;
200
- } else if (!!(style !== null && style !== void 0 && (_style$color = style.color) !== null && _style$color !== void 0 && _style$color.text)) {
201
- colors.customTextColor = style.color.text;
202
- }
203
-
204
- if (isSubMenu && !!customOverlayBackgroundColor) {
205
- colors.customBackgroundColor = customOverlayBackgroundColor;
206
- } else if (isSubMenu && !!overlayBackgroundColor) {
207
- colors.backgroundColor = overlayBackgroundColor;
208
- } else if (!!customBackgroundColor) {
209
- colors.customBackgroundColor = customBackgroundColor;
210
- } else if (!!backgroundColor) {
211
- colors.backgroundColor = backgroundColor;
212
- } else if (!!(style !== null && style !== void 0 && (_style$color2 = style.color) !== null && _style$color2 !== void 0 && _style$color2.background)) {
213
- colors.customTextColor = style.color.background;
214
- }
215
-
216
- return colors;
217
- }
218
163
  /**
219
164
  * @typedef {'post-type'|'custom'|'taxonomy'|'post-type-archive'} WPNavigationLinkKind
220
165
  */
@@ -392,7 +337,7 @@ function NavigationSubmenuEdit(_ref) {
392
337
  customTextColor,
393
338
  backgroundColor,
394
339
  customBackgroundColor
395
- } = getColors(context, !isTopLevelItem);
340
+ } = (0, _utils.getColors)(context, !isTopLevelItem);
396
341
 
397
342
  function onKeyDown(event) {
398
343
  if (_keycodes.isKeyboardEvent.primary(event, 'k')) {
@@ -420,21 +365,10 @@ function NavigationSubmenuEdit(_ref) {
420
365
  onKeyDown
421
366
  }); // Always use overlay colors for submenus.
422
367
 
423
- const innerBlocksColors = getColors(context, true);
368
+ const innerBlocksColors = (0, _utils.getColors)(context, true);
424
369
  const allowedBlocks = isAtMaxNesting ? ALLOWED_BLOCKS.filter(blockName => blockName !== 'core/navigation-submenu') : ALLOWED_BLOCKS;
425
- const innerBlocksProps = (0, _blockEditor.useInnerBlocksProps)({
426
- className: (0, _classnames.default)('wp-block-navigation__submenu-container', {
427
- 'is-parent-of-selected-block': isParentOfSelectedBlock,
428
- 'has-text-color': !!(innerBlocksColors.textColor || innerBlocksColors.customTextColor),
429
- [`has-${innerBlocksColors.textColor}-color`]: !!innerBlocksColors.textColor,
430
- 'has-background': !!(innerBlocksColors.backgroundColor || innerBlocksColors.customBackgroundColor),
431
- [`has-${innerBlocksColors.backgroundColor}-background-color`]: !!innerBlocksColors.backgroundColor
432
- }),
433
- style: {
434
- color: innerBlocksColors.customTextColor,
435
- backgroundColor: innerBlocksColors.customBackgroundColor
436
- }
437
- }, {
370
+ const navigationChildBlockProps = (0, _utils.getNavigationChildBlockProps)(innerBlocksColors);
371
+ const innerBlocksProps = (0, _blockEditor.useInnerBlocksProps)(navigationChildBlockProps, {
438
372
  allowedBlocks,
439
373
  __experimentalDefaultBlock: DEFAULT_BLOCK,
440
374
  __experimentalDirectInsert: true,
@@ -493,6 +427,7 @@ function NavigationSubmenuEdit(_ref) {
493
427
  label: (0, _i18n.__)('URL'),
494
428
  autoComplete: "off"
495
429
  }), (0, _element.createElement)(_components.TextareaControl, {
430
+ __nextHasNoMarginBottom: true,
496
431
  value: description || '',
497
432
  onChange: descriptionValue => {
498
433
  setAttributes({