@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/search/edit.js"],"names":["classnames","useBlockProps","BlockControls","InspectorControls","RichText","__experimentalUseBorderProps","useBorderProps","__experimentalUseColorProps","useColorProps","getTypographyClassesAndStyles","useTypographyProps","store","blockEditorStore","__experimentalGetElementClassName","useSetting","useDispatch","useSelect","useEffect","ToolbarDropdownMenu","ToolbarGroup","Button","ButtonGroup","ToolbarButton","ResizableBox","PanelBody","BaseControl","__experimentalUseCustomUnits","useCustomUnits","__experimentalUnitControl","UnitControl","useInstanceId","Icon","search","__","__unstableStripHTML","stripHTML","buttonOnly","buttonOutside","buttonInside","noButton","buttonWithIcon","toggleLabel","PC_WIDTH_DEFAULT","PX_WIDTH_DEFAULT","MIN_WIDTH","MIN_WIDTH_UNIT","DEFAULT_INNER_PADDING","SearchEdit","className","attributes","setAttributes","toggleSelection","isSelected","clientId","label","showLabel","placeholder","width","widthUnit","align","buttonText","buttonPosition","buttonUseIcon","style","insertedInNavigationBlock","select","getBlockParentsByBlockName","wasBlockJustInserted","length","__unstableMarkNextChangeAsNotPersistent","borderRadius","border","radius","borderProps","colorProps","fluidTypographyEnabled","typographyProps","unitControlInstanceId","unitControlInputId","isButtonPositionInside","isButtonPositionOutside","hasNoButton","hasOnlyButton","units","availableUnits","defaultValues","px","getBlockClassNames","undefined","buttonPositionControls","role","title","isActive","icon","onClick","getButtonPositionIcon","getResizableSides","right","left","renderTextField","textFieldClasses","textFieldStyles","textDecoration","event","target","value","renderButton","buttonClasses","buttonStyles","html","controls","newWidth","filteredWidth","parseInt","newUnit","map","widthValue","padBorderRadius","getWrapperStyles","styles","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","isNonZeroBorderRadius","topLeft","topRight","bottomLeft","bottomRight","Number","isInteger","blockProps","labelClassnames","direction","elt","offsetWidth","delta"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,aADD,EAECC,aAFD,EAGCC,iBAHD,EAICC,QAJD,EAKCC,4BAA4B,IAAIC,cALjC,EAMCC,2BAA2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B,SAAf,GAA2BwC,SAF5B,CAJvB;AAQC,IAAA,KAAK,EAAG8B,gBAAgB,EARzB;AASC,IAAA,QAAQ,EAAG1E,SATZ;AAUC,IAAA,MAAM,EAAGoD,iBAAiB,EAV3B;AAWC,IAAA,aAAa,EAAG,CAAEO,KAAF,EAAS8B,SAAT,EAAoBC,GAApB,KAA6B;AAC5CpF,MAAAA,aAAa,CAAE;AACdO,QAAAA,KAAK,EAAEwD,QAAQ,CAAEqB,GAAG,CAACC,WAAN,EAAmB,EAAnB,CADD;AAEd7E,QAAAA,SAAS,EAAE;AAFG,OAAF,CAAb;AAIAP,MAAAA,eAAe,CAAE,KAAF,CAAf;AACA,KAjBF;AAkBC,IAAA,YAAY,EAAG,CAAEoD,KAAF,EAAS8B,SAAT,EAAoBC,GAApB,EAAyBE,KAAzB,KAAoC;AAClDtF,MAAAA,aAAa,CAAE;AACdO,QAAAA,KAAK,EAAEwD,QAAQ,CAAExD,KAAK,GAAG+E,KAAK,CAAC/E,KAAhB,EAAuB,EAAvB;AADD,OAAF,CAAb;AAGAN,MAAAA,eAAe,CAAE,IAAF,CAAf;AACA,KAvBF;AAwBC,IAAA,UAAU,EAAGC;AAxBd,KA0BG,CAAE2B,sBAAsB,IAAIC,uBAA5B,KACD,8BACGmB,eAAe,EADlB,EAEGO,YAAY,EAFf,CA3BF,EAiCGxB,aAAa,IAAIwB,YAAY,EAjChC,EAkCGzB,WAAW,IAAIkB,eAAe,EAlCjC,CAfD,CADD;AAsDA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseBlockProps,\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalUseColorProps as useColorProps,\n\tgetTypographyClassesAndStyles as useTypographyProps,\n\tstore as blockEditorStore,\n\t__experimentalGetElementClassName,\n\tuseSetting,\n} from '@wordpress/block-editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\nimport {\n\tToolbarDropdownMenu,\n\tToolbarGroup,\n\tButton,\n\tButtonGroup,\n\tToolbarButton,\n\tResizableBox,\n\tPanelBody,\n\tBaseControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalUnitControl as UnitControl,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { Icon, search } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport {\n\tbuttonOnly,\n\tbuttonOutside,\n\tbuttonInside,\n\tnoButton,\n\tbuttonWithIcon,\n\ttoggleLabel,\n} from './icons';\nimport {\n\tPC_WIDTH_DEFAULT,\n\tPX_WIDTH_DEFAULT,\n\tMIN_WIDTH,\n\tMIN_WIDTH_UNIT,\n} from './utils.js';\n\n// Used to calculate border radius adjustment to avoid \"fat\" corners when\n// button is placed inside wrapper.\nconst DEFAULT_INNER_PADDING = '4px';\n\nexport default function SearchEdit( {\n\tclassName,\n\tattributes,\n\tsetAttributes,\n\ttoggleSelection,\n\tisSelected,\n\tclientId,\n} ) {\n\tconst {\n\t\tlabel,\n\t\tshowLabel,\n\t\tplaceholder,\n\t\twidth,\n\t\twidthUnit,\n\t\talign,\n\t\tbuttonText,\n\t\tbuttonPosition,\n\t\tbuttonUseIcon,\n\t\tstyle,\n\t} = attributes;\n\n\tconst insertedInNavigationBlock = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockParentsByBlockName, wasBlockJustInserted } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn (\n\t\t\t\t!! getBlockParentsByBlockName( clientId, 'core/navigation' )\n\t\t\t\t\t?.length && wasBlockJustInserted( clientId )\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tuseEffect( () => {\n\t\tif ( ! insertedInNavigationBlock ) return;\n\t\t// This side-effect should not create an undo level.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tsetAttributes( {\n\t\t\tshowLabel: false,\n\t\t\tbuttonUseIcon: true,\n\t\t\tbuttonPosition: 'button-inside',\n\t\t} );\n\t}, [ insertedInNavigationBlock ] );\n\tconst borderRadius = style?.border?.radius;\n\tconst borderProps = useBorderProps( attributes );\n\n\t// Check for old deprecated numerical border radius. Done as a separate\n\t// check so that a borderRadius style won't overwrite the longhand\n\t// per-corner styles.\n\tif ( typeof borderRadius === 'number' ) {\n\t\tborderProps.style.borderRadius = `${ borderRadius }px`;\n\t}\n\n\tconst colorProps = useColorProps( attributes );\n\tconst fluidTypographyEnabled = useSetting( 'typography.fluid' );\n\tconst typographyProps = useTypographyProps(\n\t\tattributes,\n\t\tfluidTypographyEnabled\n\t);\n\tconst unitControlInstanceId = useInstanceId( UnitControl );\n\tconst unitControlInputId = `wp-block-search__width-${ unitControlInstanceId }`;\n\tconst isButtonPositionInside = 'button-inside' === buttonPosition;\n\tconst isButtonPositionOutside = 'button-outside' === buttonPosition;\n\tconst hasNoButton = 'no-button' === buttonPosition;\n\tconst hasOnlyButton = 'button-only' === buttonPosition;\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: [ '%', 'px' ],\n\t\tdefaultValues: { '%': PC_WIDTH_DEFAULT, px: PX_WIDTH_DEFAULT },\n\t} );\n\n\tconst getBlockClassNames = () => {\n\t\treturn classnames(\n\t\t\tclassName,\n\t\t\tisButtonPositionInside\n\t\t\t\t? 'wp-block-search__button-inside'\n\t\t\t\t: undefined,\n\t\t\tisButtonPositionOutside\n\t\t\t\t? 'wp-block-search__button-outside'\n\t\t\t\t: undefined,\n\t\t\thasNoButton ? 'wp-block-search__no-button' : undefined,\n\t\t\thasOnlyButton ? 'wp-block-search__button-only' : undefined,\n\t\t\t! buttonUseIcon && ! hasNoButton\n\t\t\t\t? 'wp-block-search__text-button'\n\t\t\t\t: undefined,\n\t\t\tbuttonUseIcon && ! hasNoButton\n\t\t\t\t? 'wp-block-search__icon-button'\n\t\t\t\t: undefined\n\t\t);\n\t};\n\n\tconst buttonPositionControls = [\n\t\t{\n\t\t\trole: 'menuitemradio',\n\t\t\ttitle: __( 'Button outside' ),\n\t\t\tisActive: buttonPosition === 'button-outside',\n\t\t\ticon: buttonOutside,\n\t\t\tonClick: () => {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tbuttonPosition: 'button-outside',\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\trole: 'menuitemradio',\n\t\t\ttitle: __( 'Button inside' ),\n\t\t\tisActive: buttonPosition === 'button-inside',\n\t\t\ticon: buttonInside,\n\t\t\tonClick: () => {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tbuttonPosition: 'button-inside',\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\trole: 'menuitemradio',\n\t\t\ttitle: __( 'No button' ),\n\t\t\tisActive: buttonPosition === 'no-button',\n\t\t\ticon: noButton,\n\t\t\tonClick: () => {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tbuttonPosition: 'no-button',\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t];\n\n\tconst getButtonPositionIcon = () => {\n\t\tswitch ( buttonPosition ) {\n\t\t\tcase 'button-inside':\n\t\t\t\treturn buttonInside;\n\t\t\tcase 'button-outside':\n\t\t\t\treturn buttonOutside;\n\t\t\tcase 'no-button':\n\t\t\t\treturn noButton;\n\t\t\tcase 'button-only':\n\t\t\t\treturn buttonOnly;\n\t\t}\n\t};\n\n\tconst getResizableSides = () => {\n\t\tif ( hasOnlyButton ) {\n\t\t\treturn {};\n\t\t}\n\n\t\treturn {\n\t\t\tright: align !== 'right',\n\t\t\tleft: align === 'right',\n\t\t};\n\t};\n\n\tconst renderTextField = () => {\n\t\t// If the input is inside the wrapper, the wrapper gets the border color styles/classes, not the input control.\n\t\tconst textFieldClasses = classnames(\n\t\t\t'wp-block-search__input',\n\t\t\tisButtonPositionInside ? undefined : borderProps.className,\n\t\t\ttypographyProps.className\n\t\t);\n\t\tconst textFieldStyles = {\n\t\t\t...( isButtonPositionInside\n\t\t\t\t? { borderRadius }\n\t\t\t\t: borderProps.style ),\n\t\t\t...typographyProps.style,\n\t\t\ttextDecoration: undefined,\n\t\t};\n\n\t\treturn (\n\t\t\t<input\n\t\t\t\ttype=\"search\"\n\t\t\t\tclassName={ textFieldClasses }\n\t\t\t\tstyle={ textFieldStyles }\n\t\t\t\taria-label={ __( 'Optional placeholder text' ) }\n\t\t\t\t// We hide the placeholder field's placeholder when there is a value. This\n\t\t\t\t// stops screen readers from reading the placeholder field's placeholder\n\t\t\t\t// which is confusing.\n\t\t\t\tplaceholder={\n\t\t\t\t\tplaceholder ? undefined : __( 'Optional placeholder…' )\n\t\t\t\t}\n\t\t\t\tvalue={ placeholder }\n\t\t\t\tonChange={ ( event ) =>\n\t\t\t\t\tsetAttributes( { placeholder: event.target.value } )\n\t\t\t\t}\n\t\t\t/>\n\t\t);\n\t};\n\n\tconst renderButton = () => {\n\t\t// If the button is inside the wrapper, the wrapper gets the border color styles/classes, not the button.\n\t\tconst buttonClasses = classnames(\n\t\t\t'wp-block-search__button',\n\t\t\tcolorProps.className,\n\t\t\ttypographyProps.className,\n\t\t\tisButtonPositionInside ? undefined : borderProps.className,\n\t\t\tbuttonUseIcon ? 'has-icon' : undefined,\n\t\t\t__experimentalGetElementClassName( 'button' )\n\t\t);\n\t\tconst buttonStyles = {\n\t\t\t...colorProps.style,\n\t\t\t...typographyProps.style,\n\t\t\t...( isButtonPositionInside\n\t\t\t\t? { borderRadius }\n\t\t\t\t: borderProps.style ),\n\t\t};\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ buttonUseIcon && (\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tclassName={ buttonClasses }\n\t\t\t\t\t\tstyle={ buttonStyles }\n\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\tbuttonText\n\t\t\t\t\t\t\t\t? stripHTML( buttonText )\n\t\t\t\t\t\t\t\t: __( 'Search' )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<Icon icon={ search } />\n\t\t\t\t\t</button>\n\t\t\t\t) }\n\n\t\t\t\t{ ! buttonUseIcon && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tclassName={ buttonClasses }\n\t\t\t\t\t\tstyle={ buttonStyles }\n\t\t\t\t\t\taria-label={ __( 'Button text' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Add button text…' ) }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\tvalue={ buttonText }\n\t\t\t\t\t\tonChange={ ( html ) =>\n\t\t\t\t\t\t\tsetAttributes( { buttonText: html } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t};\n\n\tconst controls = (\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\ttitle={ __( 'Toggle search label' ) }\n\t\t\t\t\t\ticon={ toggleLabel }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowLabel: ! showLabel,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tclassName={ showLabel ? 'is-pressed' : undefined }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToolbarDropdownMenu\n\t\t\t\t\t\ticon={ getButtonPositionIcon() }\n\t\t\t\t\t\tlabel={ __( 'Change button position' ) }\n\t\t\t\t\t\tcontrols={ buttonPositionControls }\n\t\t\t\t\t/>\n\t\t\t\t\t{ ! hasNoButton && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\ttitle={ __( 'Use button with icon' ) }\n\t\t\t\t\t\t\ticon={ buttonWithIcon }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tbuttonUseIcon: ! buttonUseIcon,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\tbuttonUseIcon ? 'is-pressed' : undefined\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</ToolbarGroup>\n\t\t\t</BlockControls>\n\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Display Settings' ) }>\n\t\t\t\t\t<BaseControl\n\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\tid={ unitControlInputId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\tid={ unitControlInputId }\n\t\t\t\t\t\t\tmin={ `${ MIN_WIDTH }${ MIN_WIDTH_UNIT }` }\n\t\t\t\t\t\t\tonChange={ ( newWidth ) => {\n\t\t\t\t\t\t\t\tconst filteredWidth =\n\t\t\t\t\t\t\t\t\twidthUnit === '%' &&\n\t\t\t\t\t\t\t\t\tparseInt( newWidth, 10 ) > 100\n\t\t\t\t\t\t\t\t\t\t? 100\n\t\t\t\t\t\t\t\t\t\t: newWidth;\n\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\twidth: parseInt( filteredWidth, 10 ),\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonUnitChange={ ( newUnit ) => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\twidth:\n\t\t\t\t\t\t\t\t\t\t'%' === newUnit\n\t\t\t\t\t\t\t\t\t\t\t? PC_WIDTH_DEFAULT\n\t\t\t\t\t\t\t\t\t\t\t: PX_WIDTH_DEFAULT,\n\t\t\t\t\t\t\t\t\twidthUnit: newUnit,\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__unstableInputWidth={ '80px' }\n\t\t\t\t\t\t\tvalue={ `${ width }${ widthUnit }` }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t<ButtonGroup\n\t\t\t\t\t\t\tclassName=\"wp-block-search__components-button-group\"\n\t\t\t\t\t\t\taria-label={ __( 'Percentage Width' ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ [ 25, 50, 75, 100 ].map( ( widthValue ) => {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tkey={ widthValue }\n\t\t\t\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\t\t\t`${ widthValue }%` ===\n\t\t\t\t\t\t\t\t\t\t\t`${ width }${ widthUnit }`\n\t\t\t\t\t\t\t\t\t\t\t\t? 'primary'\n\t\t\t\t\t\t\t\t\t\t\t\t: undefined\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\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\twidth: widthValue,\n\t\t\t\t\t\t\t\t\t\t\t\twidthUnit: '%',\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\t{ widthValue }%\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t</ButtonGroup>\n\t\t\t\t\t</BaseControl>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n\n\tconst padBorderRadius = ( radius ) =>\n\t\tradius ? `calc(${ radius } + ${ DEFAULT_INNER_PADDING })` : undefined;\n\n\tconst getWrapperStyles = () => {\n\t\tconst styles = isButtonPositionInside\n\t\t\t? borderProps.style\n\t\t\t: {\n\t\t\t\t\tborderRadius: borderProps.style?.borderRadius,\n\t\t\t\t\tborderTopLeftRadius: borderProps.style?.borderTopLeftRadius,\n\t\t\t\t\tborderTopRightRadius:\n\t\t\t\t\t\tborderProps.style?.borderTopRightRadius,\n\t\t\t\t\tborderBottomLeftRadius:\n\t\t\t\t\t\tborderProps.style?.borderBottomLeftRadius,\n\t\t\t\t\tborderBottomRightRadius:\n\t\t\t\t\t\tborderProps.style?.borderBottomRightRadius,\n\t\t\t };\n\n\t\tconst isNonZeroBorderRadius =\n\t\t\tborderRadius !== undefined && parseInt( borderRadius, 10 ) !== 0;\n\n\t\tif ( isButtonPositionInside && isNonZeroBorderRadius ) {\n\t\t\t// We have button inside wrapper and a border radius value to apply.\n\t\t\t// Add default padding so we don't get \"fat\" corners.\n\t\t\t//\n\t\t\t// CSS calc() is used here to support non-pixel units. The inline\n\t\t\t// style using calc() will only apply if both values have units.\n\n\t\t\tif ( typeof borderRadius === 'object' ) {\n\t\t\t\t// Individual corner border radii present.\n\t\t\t\tconst { topLeft, topRight, bottomLeft, bottomRight } =\n\t\t\t\t\tborderRadius;\n\n\t\t\t\treturn {\n\t\t\t\t\t...styles,\n\t\t\t\t\tborderTopLeftRadius: padBorderRadius( topLeft ),\n\t\t\t\t\tborderTopRightRadius: padBorderRadius( topRight ),\n\t\t\t\t\tborderBottomLeftRadius: padBorderRadius( bottomLeft ),\n\t\t\t\t\tborderBottomRightRadius: padBorderRadius( bottomRight ),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// The inline style using calc() will only apply if both values\n\t\t\t// supplied to calc() have units. Deprecated block's may have\n\t\t\t// unitless integer.\n\t\t\tconst radius = Number.isInteger( borderRadius )\n\t\t\t\t? `${ borderRadius }px`\n\t\t\t\t: borderRadius;\n\n\t\t\tstyles.borderRadius = `calc(${ radius } + ${ DEFAULT_INNER_PADDING })`;\n\t\t}\n\n\t\treturn styles;\n\t};\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: getBlockClassNames(),\n\t\tstyle: {\n\t\t\t...typographyProps.style,\n\t\t\t// Input opts out of text decoration.\n\t\t\ttextDecoration: undefined,\n\t\t},\n\t} );\n\n\tconst labelClassnames = classnames(\n\t\t'wp-block-search__label',\n\t\ttypographyProps.className\n\t);\n\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t{ controls }\n\n\t\t\t{ showLabel && (\n\t\t\t\t<RichText\n\t\t\t\t\tclassName={ labelClassnames }\n\t\t\t\t\taria-label={ __( 'Label text' ) }\n\t\t\t\t\tplaceholder={ __( 'Add label…' ) }\n\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\tvalue={ label }\n\t\t\t\t\tonChange={ ( html ) => setAttributes( { label: html } ) }\n\t\t\t\t\tstyle={ typographyProps.style }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t<ResizableBox\n\t\t\t\tsize={ {\n\t\t\t\t\twidth: `${ width }${ widthUnit }`,\n\t\t\t\t} }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'wp-block-search__inside-wrapper',\n\t\t\t\t\tisButtonPositionInside ? borderProps.className : undefined\n\t\t\t\t) }\n\t\t\t\tstyle={ getWrapperStyles() }\n\t\t\t\tminWidth={ MIN_WIDTH }\n\t\t\t\tenable={ getResizableSides() }\n\t\t\t\tonResizeStart={ ( event, direction, elt ) => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\twidth: parseInt( elt.offsetWidth, 10 ),\n\t\t\t\t\t\twidthUnit: 'px',\n\t\t\t\t\t} );\n\t\t\t\t\ttoggleSelection( false );\n\t\t\t\t} }\n\t\t\t\tonResizeStop={ ( event, direction, elt, delta ) => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\twidth: parseInt( width + delta.width, 10 ),\n\t\t\t\t\t} );\n\t\t\t\t\ttoggleSelection( true );\n\t\t\t\t} }\n\t\t\t\tshowHandle={ isSelected }\n\t\t\t>\n\t\t\t\t{ ( isButtonPositionInside || isButtonPositionOutside ) && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ renderTextField() }\n\t\t\t\t\t\t{ renderButton() }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\n\t\t\t\t{ hasOnlyButton && renderButton() }\n\t\t\t\t{ hasNoButton && renderTextField() }\n\t\t\t</ResizableBox>\n\t\t</div>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/search/edit.js"],"names":["classnames","useBlockProps","BlockControls","InspectorControls","RichText","__experimentalUseBorderProps","useBorderProps","__experimentalUseColorProps","useColorProps","getTypographyClassesAndStyles","useTypographyProps","store","blockEditorStore","__experimentalGetElementClassName","useSetting","useDispatch","useSelect","useEffect","ToolbarDropdownMenu","ToolbarGroup","Button","ButtonGroup","ToolbarButton","ResizableBox","PanelBody","BaseControl","__experimentalUseCustomUnits","useCustomUnits","__experimentalUnitControl","UnitControl","useInstanceId","Icon","search","__","__unstableStripHTML","stripHTML","buttonOnly","buttonOutside","buttonInside","noButton","buttonWithIcon","toggleLabel","PC_WIDTH_DEFAULT","PX_WIDTH_DEFAULT","MIN_WIDTH","MIN_WIDTH_UNIT","DEFAULT_INNER_PADDING","SearchEdit","className","attributes","setAttributes","toggleSelection","isSelected","clientId","label","showLabel","placeholder","width","widthUnit","align","buttonText","buttonPosition","buttonUseIcon","style","insertedInNavigationBlock","select","getBlockParentsByBlockName","wasBlockJustInserted","length","__unstableMarkNextChangeAsNotPersistent","borderRadius","border","radius","borderProps","colorProps","fluidTypographySettings","typographyProps","unitControlInstanceId","unitControlInputId","isButtonPositionInside","isButtonPositionOutside","hasNoButton","hasOnlyButton","units","availableUnits","defaultValues","px","getBlockClassNames","undefined","buttonPositionControls","role","title","isActive","icon","onClick","getButtonPositionIcon","getResizableSides","right","left","renderTextField","textFieldClasses","textFieldStyles","textDecoration","event","target","value","renderButton","buttonClasses","buttonStyles","html","controls","newWidth","filteredWidth","parseInt","newUnit","map","widthValue","padBorderRadius","getWrapperStyles","styles","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","isNonZeroBorderRadius","topLeft","topRight","bottomLeft","bottomRight","Number","isInteger","blockProps","labelClassnames","direction","elt","offsetWidth","delta"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,aADD,EAECC,aAFD,EAGCC,iBAHD,EAICC,QAJD,EAKCC,4BAA4B,IAAIC,cALjC,EAMCC,2BAA2B,IAAIC,aANhC,EAOCC,6BAA6B,IAAIC,kBAPlC,EAQCC,KAAK,IAAIC,gBARV,EASCC,iCATD,EAUCC,UAVD,QAWO,yBAXP;AAYA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SACCC,mBADD,EAECC,YAFD,EAGCC,MAHD,EAICC,WAJD,EAKCC,aALD,EAMCC,YAND,EAOCC,SAPD,EAQCC,WARD,EASCC,4BAA4B,IAAIC,cATjC,EAUCC,yBAAyB,IAAIC,WAV9B,QAWO,uBAXP;AAYA,SAASC,aAAT,QAA8B,oBAA9B;AACA,SAASC,IAAT,EAAeC,MAAf,QAA6B,kBAA7B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,mBAAmB,IAAIC,SAAhC,QAAiD,gBAAjD;AAEA;AACA;AACA;;AACA,SACCC,UADD,EAECC,aAFD,EAGCC,YAHD,EAICC,QAJD,EAKCC,cALD,EAMCC,WAND,QAOO,SAPP;AAQA,SACCC,gBADD,EAECC,gBAFD,EAGCC,SAHD,EAICC,cAJD,QAKO,YALP,C,CAOA;AACA;;AACA,MAAMC,qBAAqB,GAAG,KAA9B;AAEA,eAAe,SAASC,UAAT,OAOX;AAAA;;AAAA,MAPgC;AACnCC,IAAAA,SADmC;AAEnCC,IAAAA,UAFmC;AAGnCC,IAAAA,aAHm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ChC,EAkCGzB,WAAW,IAAIkB,eAAe,EAlCjC,CAfD,CADD;AAsDA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseBlockProps,\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalUseColorProps as useColorProps,\n\tgetTypographyClassesAndStyles as useTypographyProps,\n\tstore as blockEditorStore,\n\t__experimentalGetElementClassName,\n\tuseSetting,\n} from '@wordpress/block-editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\nimport {\n\tToolbarDropdownMenu,\n\tToolbarGroup,\n\tButton,\n\tButtonGroup,\n\tToolbarButton,\n\tResizableBox,\n\tPanelBody,\n\tBaseControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalUnitControl as UnitControl,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { Icon, search } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport {\n\tbuttonOnly,\n\tbuttonOutside,\n\tbuttonInside,\n\tnoButton,\n\tbuttonWithIcon,\n\ttoggleLabel,\n} from './icons';\nimport {\n\tPC_WIDTH_DEFAULT,\n\tPX_WIDTH_DEFAULT,\n\tMIN_WIDTH,\n\tMIN_WIDTH_UNIT,\n} from './utils.js';\n\n// Used to calculate border radius adjustment to avoid \"fat\" corners when\n// button is placed inside wrapper.\nconst DEFAULT_INNER_PADDING = '4px';\n\nexport default function SearchEdit( {\n\tclassName,\n\tattributes,\n\tsetAttributes,\n\ttoggleSelection,\n\tisSelected,\n\tclientId,\n} ) {\n\tconst {\n\t\tlabel,\n\t\tshowLabel,\n\t\tplaceholder,\n\t\twidth,\n\t\twidthUnit,\n\t\talign,\n\t\tbuttonText,\n\t\tbuttonPosition,\n\t\tbuttonUseIcon,\n\t\tstyle,\n\t} = attributes;\n\n\tconst insertedInNavigationBlock = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockParentsByBlockName, wasBlockJustInserted } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn (\n\t\t\t\t!! getBlockParentsByBlockName( clientId, 'core/navigation' )\n\t\t\t\t\t?.length && wasBlockJustInserted( clientId )\n\t\t\t);\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tuseEffect( () => {\n\t\tif ( ! insertedInNavigationBlock ) return;\n\t\t// This side-effect should not create an undo level.\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tsetAttributes( {\n\t\t\tshowLabel: false,\n\t\t\tbuttonUseIcon: true,\n\t\t\tbuttonPosition: 'button-inside',\n\t\t} );\n\t}, [ insertedInNavigationBlock ] );\n\tconst borderRadius = style?.border?.radius;\n\tconst borderProps = useBorderProps( attributes );\n\n\t// Check for old deprecated numerical border radius. Done as a separate\n\t// check so that a borderRadius style won't overwrite the longhand\n\t// per-corner styles.\n\tif ( typeof borderRadius === 'number' ) {\n\t\tborderProps.style.borderRadius = `${ borderRadius }px`;\n\t}\n\n\tconst colorProps = useColorProps( attributes );\n\tconst fluidTypographySettings = useSetting( 'typography.fluid' );\n\tconst typographyProps = useTypographyProps(\n\t\tattributes,\n\t\tfluidTypographySettings\n\t);\n\tconst unitControlInstanceId = useInstanceId( UnitControl );\n\tconst unitControlInputId = `wp-block-search__width-${ unitControlInstanceId }`;\n\tconst isButtonPositionInside = 'button-inside' === buttonPosition;\n\tconst isButtonPositionOutside = 'button-outside' === buttonPosition;\n\tconst hasNoButton = 'no-button' === buttonPosition;\n\tconst hasOnlyButton = 'button-only' === buttonPosition;\n\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: [ '%', 'px' ],\n\t\tdefaultValues: { '%': PC_WIDTH_DEFAULT, px: PX_WIDTH_DEFAULT },\n\t} );\n\n\tconst getBlockClassNames = () => {\n\t\treturn classnames(\n\t\t\tclassName,\n\t\t\tisButtonPositionInside\n\t\t\t\t? 'wp-block-search__button-inside'\n\t\t\t\t: undefined,\n\t\t\tisButtonPositionOutside\n\t\t\t\t? 'wp-block-search__button-outside'\n\t\t\t\t: undefined,\n\t\t\thasNoButton ? 'wp-block-search__no-button' : undefined,\n\t\t\thasOnlyButton ? 'wp-block-search__button-only' : undefined,\n\t\t\t! buttonUseIcon && ! hasNoButton\n\t\t\t\t? 'wp-block-search__text-button'\n\t\t\t\t: undefined,\n\t\t\tbuttonUseIcon && ! hasNoButton\n\t\t\t\t? 'wp-block-search__icon-button'\n\t\t\t\t: undefined\n\t\t);\n\t};\n\n\tconst buttonPositionControls = [\n\t\t{\n\t\t\trole: 'menuitemradio',\n\t\t\ttitle: __( 'Button outside' ),\n\t\t\tisActive: buttonPosition === 'button-outside',\n\t\t\ticon: buttonOutside,\n\t\t\tonClick: () => {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tbuttonPosition: 'button-outside',\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\trole: 'menuitemradio',\n\t\t\ttitle: __( 'Button inside' ),\n\t\t\tisActive: buttonPosition === 'button-inside',\n\t\t\ticon: buttonInside,\n\t\t\tonClick: () => {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tbuttonPosition: 'button-inside',\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\trole: 'menuitemradio',\n\t\t\ttitle: __( 'No button' ),\n\t\t\tisActive: buttonPosition === 'no-button',\n\t\t\ticon: noButton,\n\t\t\tonClick: () => {\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tbuttonPosition: 'no-button',\n\t\t\t\t} );\n\t\t\t},\n\t\t},\n\t];\n\n\tconst getButtonPositionIcon = () => {\n\t\tswitch ( buttonPosition ) {\n\t\t\tcase 'button-inside':\n\t\t\t\treturn buttonInside;\n\t\t\tcase 'button-outside':\n\t\t\t\treturn buttonOutside;\n\t\t\tcase 'no-button':\n\t\t\t\treturn noButton;\n\t\t\tcase 'button-only':\n\t\t\t\treturn buttonOnly;\n\t\t}\n\t};\n\n\tconst getResizableSides = () => {\n\t\tif ( hasOnlyButton ) {\n\t\t\treturn {};\n\t\t}\n\n\t\treturn {\n\t\t\tright: align !== 'right',\n\t\t\tleft: align === 'right',\n\t\t};\n\t};\n\n\tconst renderTextField = () => {\n\t\t// If the input is inside the wrapper, the wrapper gets the border color styles/classes, not the input control.\n\t\tconst textFieldClasses = classnames(\n\t\t\t'wp-block-search__input',\n\t\t\tisButtonPositionInside ? undefined : borderProps.className,\n\t\t\ttypographyProps.className\n\t\t);\n\t\tconst textFieldStyles = {\n\t\t\t...( isButtonPositionInside\n\t\t\t\t? { borderRadius }\n\t\t\t\t: borderProps.style ),\n\t\t\t...typographyProps.style,\n\t\t\ttextDecoration: undefined,\n\t\t};\n\n\t\treturn (\n\t\t\t<input\n\t\t\t\ttype=\"search\"\n\t\t\t\tclassName={ textFieldClasses }\n\t\t\t\tstyle={ textFieldStyles }\n\t\t\t\taria-label={ __( 'Optional placeholder text' ) }\n\t\t\t\t// We hide the placeholder field's placeholder when there is a value. This\n\t\t\t\t// stops screen readers from reading the placeholder field's placeholder\n\t\t\t\t// which is confusing.\n\t\t\t\tplaceholder={\n\t\t\t\t\tplaceholder ? undefined : __( 'Optional placeholder…' )\n\t\t\t\t}\n\t\t\t\tvalue={ placeholder }\n\t\t\t\tonChange={ ( event ) =>\n\t\t\t\t\tsetAttributes( { placeholder: event.target.value } )\n\t\t\t\t}\n\t\t\t/>\n\t\t);\n\t};\n\n\tconst renderButton = () => {\n\t\t// If the button is inside the wrapper, the wrapper gets the border color styles/classes, not the button.\n\t\tconst buttonClasses = classnames(\n\t\t\t'wp-block-search__button',\n\t\t\tcolorProps.className,\n\t\t\ttypographyProps.className,\n\t\t\tisButtonPositionInside ? undefined : borderProps.className,\n\t\t\tbuttonUseIcon ? 'has-icon' : undefined,\n\t\t\t__experimentalGetElementClassName( 'button' )\n\t\t);\n\t\tconst buttonStyles = {\n\t\t\t...colorProps.style,\n\t\t\t...typographyProps.style,\n\t\t\t...( isButtonPositionInside\n\t\t\t\t? { borderRadius }\n\t\t\t\t: borderProps.style ),\n\t\t};\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ buttonUseIcon && (\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tclassName={ buttonClasses }\n\t\t\t\t\t\tstyle={ buttonStyles }\n\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\tbuttonText\n\t\t\t\t\t\t\t\t? stripHTML( buttonText )\n\t\t\t\t\t\t\t\t: __( 'Search' )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<Icon icon={ search } />\n\t\t\t\t\t</button>\n\t\t\t\t) }\n\n\t\t\t\t{ ! buttonUseIcon && (\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tclassName={ buttonClasses }\n\t\t\t\t\t\tstyle={ buttonStyles }\n\t\t\t\t\t\taria-label={ __( 'Button text' ) }\n\t\t\t\t\t\tplaceholder={ __( 'Add button text…' ) }\n\t\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\t\tvalue={ buttonText }\n\t\t\t\t\t\tonChange={ ( html ) =>\n\t\t\t\t\t\t\tsetAttributes( { buttonText: html } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t};\n\n\tconst controls = (\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\ttitle={ __( 'Toggle search label' ) }\n\t\t\t\t\t\ticon={ toggleLabel }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowLabel: ! showLabel,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tclassName={ showLabel ? 'is-pressed' : undefined }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToolbarDropdownMenu\n\t\t\t\t\t\ticon={ getButtonPositionIcon() }\n\t\t\t\t\t\tlabel={ __( 'Change button position' ) }\n\t\t\t\t\t\tcontrols={ buttonPositionControls }\n\t\t\t\t\t/>\n\t\t\t\t\t{ ! hasNoButton && (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\ttitle={ __( 'Use button with icon' ) }\n\t\t\t\t\t\t\ticon={ buttonWithIcon }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tbuttonUseIcon: ! buttonUseIcon,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\tbuttonUseIcon ? 'is-pressed' : undefined\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</ToolbarGroup>\n\t\t\t</BlockControls>\n\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Display Settings' ) }>\n\t\t\t\t\t<BaseControl\n\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\tid={ unitControlInputId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\tid={ unitControlInputId }\n\t\t\t\t\t\t\tmin={ `${ MIN_WIDTH }${ MIN_WIDTH_UNIT }` }\n\t\t\t\t\t\t\tonChange={ ( newWidth ) => {\n\t\t\t\t\t\t\t\tconst filteredWidth =\n\t\t\t\t\t\t\t\t\twidthUnit === '%' &&\n\t\t\t\t\t\t\t\t\tparseInt( newWidth, 10 ) > 100\n\t\t\t\t\t\t\t\t\t\t? 100\n\t\t\t\t\t\t\t\t\t\t: newWidth;\n\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\twidth: parseInt( filteredWidth, 10 ),\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonUnitChange={ ( newUnit ) => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\twidth:\n\t\t\t\t\t\t\t\t\t\t'%' === newUnit\n\t\t\t\t\t\t\t\t\t\t\t? PC_WIDTH_DEFAULT\n\t\t\t\t\t\t\t\t\t\t\t: PX_WIDTH_DEFAULT,\n\t\t\t\t\t\t\t\t\twidthUnit: newUnit,\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__unstableInputWidth={ '80px' }\n\t\t\t\t\t\t\tvalue={ `${ width }${ widthUnit }` }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t<ButtonGroup\n\t\t\t\t\t\t\tclassName=\"wp-block-search__components-button-group\"\n\t\t\t\t\t\t\taria-label={ __( 'Percentage Width' ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ [ 25, 50, 75, 100 ].map( ( widthValue ) => {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tkey={ widthValue }\n\t\t\t\t\t\t\t\t\t\tisSmall\n\t\t\t\t\t\t\t\t\t\tvariant={\n\t\t\t\t\t\t\t\t\t\t\t`${ widthValue }%` ===\n\t\t\t\t\t\t\t\t\t\t\t`${ width }${ widthUnit }`\n\t\t\t\t\t\t\t\t\t\t\t\t? 'primary'\n\t\t\t\t\t\t\t\t\t\t\t\t: undefined\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\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\twidth: widthValue,\n\t\t\t\t\t\t\t\t\t\t\t\twidthUnit: '%',\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\t{ widthValue }%\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t</ButtonGroup>\n\t\t\t\t\t</BaseControl>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n\n\tconst padBorderRadius = ( radius ) =>\n\t\tradius ? `calc(${ radius } + ${ DEFAULT_INNER_PADDING })` : undefined;\n\n\tconst getWrapperStyles = () => {\n\t\tconst styles = isButtonPositionInside\n\t\t\t? borderProps.style\n\t\t\t: {\n\t\t\t\t\tborderRadius: borderProps.style?.borderRadius,\n\t\t\t\t\tborderTopLeftRadius: borderProps.style?.borderTopLeftRadius,\n\t\t\t\t\tborderTopRightRadius:\n\t\t\t\t\t\tborderProps.style?.borderTopRightRadius,\n\t\t\t\t\tborderBottomLeftRadius:\n\t\t\t\t\t\tborderProps.style?.borderBottomLeftRadius,\n\t\t\t\t\tborderBottomRightRadius:\n\t\t\t\t\t\tborderProps.style?.borderBottomRightRadius,\n\t\t\t };\n\n\t\tconst isNonZeroBorderRadius =\n\t\t\tborderRadius !== undefined && parseInt( borderRadius, 10 ) !== 0;\n\n\t\tif ( isButtonPositionInside && isNonZeroBorderRadius ) {\n\t\t\t// We have button inside wrapper and a border radius value to apply.\n\t\t\t// Add default padding so we don't get \"fat\" corners.\n\t\t\t//\n\t\t\t// CSS calc() is used here to support non-pixel units. The inline\n\t\t\t// style using calc() will only apply if both values have units.\n\n\t\t\tif ( typeof borderRadius === 'object' ) {\n\t\t\t\t// Individual corner border radii present.\n\t\t\t\tconst { topLeft, topRight, bottomLeft, bottomRight } =\n\t\t\t\t\tborderRadius;\n\n\t\t\t\treturn {\n\t\t\t\t\t...styles,\n\t\t\t\t\tborderTopLeftRadius: padBorderRadius( topLeft ),\n\t\t\t\t\tborderTopRightRadius: padBorderRadius( topRight ),\n\t\t\t\t\tborderBottomLeftRadius: padBorderRadius( bottomLeft ),\n\t\t\t\t\tborderBottomRightRadius: padBorderRadius( bottomRight ),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\t// The inline style using calc() will only apply if both values\n\t\t\t// supplied to calc() have units. Deprecated block's may have\n\t\t\t// unitless integer.\n\t\t\tconst radius = Number.isInteger( borderRadius )\n\t\t\t\t? `${ borderRadius }px`\n\t\t\t\t: borderRadius;\n\n\t\t\tstyles.borderRadius = `calc(${ radius } + ${ DEFAULT_INNER_PADDING })`;\n\t\t}\n\n\t\treturn styles;\n\t};\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: getBlockClassNames(),\n\t\tstyle: {\n\t\t\t...typographyProps.style,\n\t\t\t// Input opts out of text decoration.\n\t\t\ttextDecoration: undefined,\n\t\t},\n\t} );\n\n\tconst labelClassnames = classnames(\n\t\t'wp-block-search__label',\n\t\ttypographyProps.className\n\t);\n\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t{ controls }\n\n\t\t\t{ showLabel && (\n\t\t\t\t<RichText\n\t\t\t\t\tclassName={ labelClassnames }\n\t\t\t\t\taria-label={ __( 'Label text' ) }\n\t\t\t\t\tplaceholder={ __( 'Add label…' ) }\n\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\tvalue={ label }\n\t\t\t\t\tonChange={ ( html ) => setAttributes( { label: html } ) }\n\t\t\t\t\tstyle={ typographyProps.style }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t<ResizableBox\n\t\t\t\tsize={ {\n\t\t\t\t\twidth: `${ width }${ widthUnit }`,\n\t\t\t\t} }\n\t\t\t\tclassName={ classnames(\n\t\t\t\t\t'wp-block-search__inside-wrapper',\n\t\t\t\t\tisButtonPositionInside ? borderProps.className : undefined\n\t\t\t\t) }\n\t\t\t\tstyle={ getWrapperStyles() }\n\t\t\t\tminWidth={ MIN_WIDTH }\n\t\t\t\tenable={ getResizableSides() }\n\t\t\t\tonResizeStart={ ( event, direction, elt ) => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\twidth: parseInt( elt.offsetWidth, 10 ),\n\t\t\t\t\t\twidthUnit: 'px',\n\t\t\t\t\t} );\n\t\t\t\t\ttoggleSelection( false );\n\t\t\t\t} }\n\t\t\t\tonResizeStop={ ( event, direction, elt, delta ) => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\twidth: parseInt( width + delta.width, 10 ),\n\t\t\t\t\t} );\n\t\t\t\t\ttoggleSelection( true );\n\t\t\t\t} }\n\t\t\t\tshowHandle={ isSelected }\n\t\t\t>\n\t\t\t\t{ ( isButtonPositionInside || isButtonPositionOutside ) && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ renderTextField() }\n\t\t\t\t\t\t{ renderButton() }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\n\t\t\t\t{ hasOnlyButton && renderButton() }\n\t\t\t\t{ hasNoButton && renderTextField() }\n\t\t\t</ResizableBox>\n\t\t</div>\n\t);\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { createElement } from "@wordpress/element";
1
+ import { createElement, Fragment } from "@wordpress/element";
2
2
 
3
3
  /**
4
4
  * External dependencies
@@ -9,7 +9,7 @@ import classNames from 'classnames';
9
9
  */
10
10
 
11
11
  import { InspectorControls, URLPopover, URLInput, useBlockProps } from '@wordpress/block-editor';
12
- import { Fragment, useState } from '@wordpress/element';
12
+ import { useState } from '@wordpress/element';
13
13
  import { Button, PanelBody, PanelRow, TextControl } from '@wordpress/components';
14
14
  import { __, sprintf } from '@wordpress/i18n';
15
15
  import { keyboardReturn } from '@wordpress/icons';
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/social-link/edit.js"],"names":["classNames","InspectorControls","URLPopover","URLInput","useBlockProps","Fragment","useState","Button","PanelBody","PanelRow","TextControl","__","sprintf","keyboardReturn","getIconBySite","getNameBySite","SocialLinkURLPopover","url","setAttributes","setPopover","popoverAnchor","event","preventDefault","nextURL","SocialLinkEdit","attributes","context","isSelected","service","label","rel","showLabels","iconColorValue","iconBackgroundColorValue","showURLPopover","classes","setPopoverAnchor","IconComponent","socialLinkName","socialLinkLabel","blockProps","className","style","color","backgroundColor","value"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,iBADD,EAECC,UAFD,EAGCC,QAHD,EAICC,aAJD,QAKO,yBALP;AAMA,SAASC,QAAT,EAAmBC,QAAnB,QAAmC,oBAAnC;AACA,SACCC,MADD,EAECC,SAFD,EAGCC,QAHD,EAICC,WAJD,QAKO,uBALP;AAMA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,cAAT,QAA+B,kBAA/B;AAEA;AACA;AACA;;AACA,SAASC,aAAT,EAAwBC,aAAxB,QAA6C,eAA7C;;AAEA,MAAMC,oBAAoB,GAAG;AAAA,MAAE;AAC9BC,IAAAA,GAD8B;AAE9BC,IAAAA,aAF8B;AAG9BC,IAAAA,UAH8B;AAI9BC,IAAAA;AAJ8B,GAAF;AAAA,SAM5B,cAAC,UAAD;AAAY,IAAA,MAAM,EAAGA,aAArB;AAAqC,IAAA,OAAO,EAAG,MAAMD,UAAU,CAAE,KAAF;AAA/D,KACC;AACC,IAAA,SAAS,EAAC,uCADX;AAEC,IAAA,QAAQ,EAAKE,KAAF,IAAa;AACvBA,MAAAA,KAAK,CAACC,cAAN;AACAH,MAAAA,UAAU,CAAE,KAAF,CAAV;AACA;AALF,KAOC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,QAAD;AACC,IAAA,KAAK,EAAGF,GADT;AAEC,IAAA,QAAQ,EAAKM,OAAF,IACVL,aAAa,CAAE;AAAED,MAAAA,GAAG,EAAEM;AAAP,KAAF,CAHf;AAKC,IAAA,WAAW,EAAGZ,EAAE,CAAE,eAAF,CALjB;AAMC,IAAA,kBAAkB,EAAG;AANtB,IADD,CAPD,EA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 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tInspectorControls,\n\tURLPopover,\n\tURLInput,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { Fragment, useState } from '@wordpress/element';\nimport {\n\tButton,\n\tPanelBody,\n\tPanelRow,\n\tTextControl,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { keyboardReturn } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { getIconBySite, getNameBySite } from './social-list';\n\nconst SocialLinkURLPopover = ( {\n\turl,\n\tsetAttributes,\n\tsetPopover,\n\tpopoverAnchor,\n} ) => (\n\t<URLPopover anchor={ popoverAnchor } onClose={ () => setPopover( false ) }>\n\t\t<form\n\t\t\tclassName=\"block-editor-url-popover__link-editor\"\n\t\t\tonSubmit={ ( event ) => {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tsetPopover( false );\n\t\t\t} }\n\t\t>\n\t\t\t<div className=\"block-editor-url-input\">\n\t\t\t\t<URLInput\n\t\t\t\t\tvalue={ url }\n\t\t\t\t\tonChange={ ( nextURL ) =>\n\t\t\t\t\t\tsetAttributes( { url: nextURL } )\n\t\t\t\t\t}\n\t\t\t\t\tplaceholder={ __( 'Enter address' ) }\n\t\t\t\t\tdisableSuggestions={ true }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<Button\n\t\t\t\ticon={ keyboardReturn }\n\t\t\t\tlabel={ __( 'Apply' ) }\n\t\t\t\ttype=\"submit\"\n\t\t\t/>\n\t\t</form>\n\t</URLPopover>\n);\n\nconst SocialLinkEdit = ( {\n\tattributes,\n\tcontext,\n\tisSelected,\n\tsetAttributes,\n} ) => {\n\tconst { url, service, label, rel } = attributes;\n\tconst { showLabels, iconColorValue, iconBackgroundColorValue } = context;\n\tconst [ showURLPopover, setPopover ] = useState( false );\n\tconst classes = classNames( 'wp-social-link', 'wp-social-link-' + service, {\n\t\t'wp-social-link__is-incomplete': ! url,\n\t} );\n\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\n\tconst IconComponent = getIconBySite( service );\n\tconst socialLinkName = getNameBySite( service );\n\tconst socialLinkLabel = label ?? socialLinkName;\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classes,\n\t\tstyle: {\n\t\t\tcolor: iconColorValue,\n\t\t\tbackgroundColor: iconBackgroundColorValue,\n\t\t},\n\t} );\n\n\treturn (\n\t\t<Fragment>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody\n\t\t\t\t\ttitle={ sprintf(\n\t\t\t\t\t\t/* translators: %s: name of the social service. */\n\t\t\t\t\t\t__( '%s label' ),\n\t\t\t\t\t\tsocialLinkName\n\t\t\t\t\t) }\n\t\t\t\t\tinitialOpen={ false }\n\t\t\t\t>\n\t\t\t\t\t<PanelRow>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\tlabel={ __( 'Link label' ) }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Briefly describe the link to help screen reader users.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { label: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls __experimentalGroup=\"advanced\">\n\t\t\t\t<TextControl\n\t\t\t\t\tlabel={ __( 'Link rel' ) }\n\t\t\t\t\tvalue={ rel || '' }\n\t\t\t\t\tonChange={ ( value ) => setAttributes( { rel: value } ) }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<li { ...blockProps }>\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"wp-block-social-link-anchor\"\n\t\t\t\t\tref={ setPopoverAnchor }\n\t\t\t\t\tonClick={ () => setPopover( true ) }\n\t\t\t\t>\n\t\t\t\t\t<IconComponent />\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName={ classNames( 'wp-block-social-link-label', {\n\t\t\t\t\t\t\t'screen-reader-text': ! showLabels,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ socialLinkLabel }\n\t\t\t\t\t</span>\n\t\t\t\t\t{ isSelected && showURLPopover && (\n\t\t\t\t\t\t<SocialLinkURLPopover\n\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\t\tsetPopover={ setPopover }\n\t\t\t\t\t\t\tpopoverAnchor={ popoverAnchor }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</Button>\n\t\t\t</li>\n\t\t</Fragment>\n\t);\n};\n\nexport default SocialLinkEdit;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/social-link/edit.js"],"names":["classNames","InspectorControls","URLPopover","URLInput","useBlockProps","useState","Button","PanelBody","PanelRow","TextControl","__","sprintf","keyboardReturn","getIconBySite","getNameBySite","SocialLinkURLPopover","url","setAttributes","setPopover","popoverAnchor","event","preventDefault","nextURL","SocialLinkEdit","attributes","context","isSelected","service","label","rel","showLabels","iconColorValue","iconBackgroundColorValue","showURLPopover","classes","setPopoverAnchor","IconComponent","socialLinkName","socialLinkLabel","blockProps","className","style","color","backgroundColor","value"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,iBADD,EAECC,UAFD,EAGCC,QAHD,EAICC,aAJD,QAKO,yBALP;AAMA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SACCC,MADD,EAECC,SAFD,EAGCC,QAHD,EAICC,WAJD,QAKO,uBALP;AAMA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,cAAT,QAA+B,kBAA/B;AAEA;AACA;AACA;;AACA,SAASC,aAAT,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,GAAG,IAAI,EAFhB;AAGC,IAAA,QAAQ,EAAKe,KAAF,IAAa3B,aAAa,CAAE;AAAEY,MAAAA,GAAG,EAAEe;AAAP,KAAF;AAHtC,IADD,CAxBD,EA+BC,oBAASL,UAAT,EACC,cAAC,MAAD;AACC,IAAA,SAAS,EAAC,6BADX;AAEC,IAAA,GAAG,EAAGJ,gBAFP;AAGC,IAAA,OAAO,EAAG,MAAMjB,UAAU,CAAE,IAAF;AAH3B,KAKC,cAAC,aAAD,OALD,EAMC;AACC,IAAA,SAAS,EAAGlB,UAAU,CAAE,4BAAF,EAAgC;AACrD,4BAAsB,CAAE8B;AAD6B,KAAhC;AADvB,KAKGQ,eALH,CAND,EAaGZ,UAAU,IAAIO,cAAd,IACD,cAAC,oBAAD;AACC,IAAA,GAAG,EAAGjB,GADP;AAEC,IAAA,aAAa,EAAGC,aAFjB;AAGC,IAAA,UAAU,EAAGC,UAHd;AAIC,IAAA,aAAa,EAAGC;AAJjB,IAdF,CADD,CA/BD,CADD;AA0DA,CAtFD;;AAwFA,eAAeI,cAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tInspectorControls,\n\tURLPopover,\n\tURLInput,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { useState } from '@wordpress/element';\nimport {\n\tButton,\n\tPanelBody,\n\tPanelRow,\n\tTextControl,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { keyboardReturn } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { getIconBySite, getNameBySite } from './social-list';\n\nconst SocialLinkURLPopover = ( {\n\turl,\n\tsetAttributes,\n\tsetPopover,\n\tpopoverAnchor,\n} ) => (\n\t<URLPopover anchor={ popoverAnchor } onClose={ () => setPopover( false ) }>\n\t\t<form\n\t\t\tclassName=\"block-editor-url-popover__link-editor\"\n\t\t\tonSubmit={ ( event ) => {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tsetPopover( false );\n\t\t\t} }\n\t\t>\n\t\t\t<div className=\"block-editor-url-input\">\n\t\t\t\t<URLInput\n\t\t\t\t\tvalue={ url }\n\t\t\t\t\tonChange={ ( nextURL ) =>\n\t\t\t\t\t\tsetAttributes( { url: nextURL } )\n\t\t\t\t\t}\n\t\t\t\t\tplaceholder={ __( 'Enter address' ) }\n\t\t\t\t\tdisableSuggestions={ true }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<Button\n\t\t\t\ticon={ keyboardReturn }\n\t\t\t\tlabel={ __( 'Apply' ) }\n\t\t\t\ttype=\"submit\"\n\t\t\t/>\n\t\t</form>\n\t</URLPopover>\n);\n\nconst SocialLinkEdit = ( {\n\tattributes,\n\tcontext,\n\tisSelected,\n\tsetAttributes,\n} ) => {\n\tconst { url, service, label, rel } = attributes;\n\tconst { showLabels, iconColorValue, iconBackgroundColorValue } = context;\n\tconst [ showURLPopover, setPopover ] = useState( false );\n\tconst classes = classNames( 'wp-social-link', 'wp-social-link-' + service, {\n\t\t'wp-social-link__is-incomplete': ! url,\n\t} );\n\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\n\tconst IconComponent = getIconBySite( service );\n\tconst socialLinkName = getNameBySite( service );\n\tconst socialLinkLabel = label ?? socialLinkName;\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classes,\n\t\tstyle: {\n\t\t\tcolor: iconColorValue,\n\t\t\tbackgroundColor: iconBackgroundColorValue,\n\t\t},\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody\n\t\t\t\t\ttitle={ sprintf(\n\t\t\t\t\t\t/* translators: %s: name of the social service. */\n\t\t\t\t\t\t__( '%s label' ),\n\t\t\t\t\t\tsocialLinkName\n\t\t\t\t\t) }\n\t\t\t\t\tinitialOpen={ false }\n\t\t\t\t>\n\t\t\t\t\t<PanelRow>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\tlabel={ __( 'Link label' ) }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Briefly describe the link to help screen reader users.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tvalue={ label }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { label: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</PanelRow>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls __experimentalGroup=\"advanced\">\n\t\t\t\t<TextControl\n\t\t\t\t\tlabel={ __( 'Link rel' ) }\n\t\t\t\t\tvalue={ rel || '' }\n\t\t\t\t\tonChange={ ( value ) => setAttributes( { rel: value } ) }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<li { ...blockProps }>\n\t\t\t\t<Button\n\t\t\t\t\tclassName=\"wp-block-social-link-anchor\"\n\t\t\t\t\tref={ setPopoverAnchor }\n\t\t\t\t\tonClick={ () => setPopover( true ) }\n\t\t\t\t>\n\t\t\t\t\t<IconComponent />\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName={ classNames( 'wp-block-social-link-label', {\n\t\t\t\t\t\t\t'screen-reader-text': ! showLabels,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ socialLinkLabel }\n\t\t\t\t\t</span>\n\t\t\t\t\t{ isSelected && showURLPopover && (\n\t\t\t\t\t\t<SocialLinkURLPopover\n\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\t\tsetPopover={ setPopover }\n\t\t\t\t\t\t\tpopoverAnchor={ popoverAnchor }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</Button>\n\t\t\t</li>\n\t\t</>\n\t);\n};\n\nexport default SocialLinkEdit;\n"]}
@@ -205,7 +205,6 @@ export function SocialLinksEdit(props) {
205
205
  } = _ref2;
206
206
  return createElement(ColorGradientSettingsDropdown, _extends({
207
207
  key: `social-links-color-${label}`,
208
- __experimentalHasMultipleOrigins: true,
209
208
  __experimentalIsRenderedInSidebar: true,
210
209
  settings: [{
211
210
  colorValue: value,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/social-links/edit.js"],"names":["classNames","getBlockSupport","useEffect","useRef","BlockControls","useInnerBlocksProps","useBlockProps","InspectorControls","ContrastChecker","withColors","__experimentalColorGradientSettingsDropdown","ColorGradientSettingsDropdown","__experimentalUseMultipleOriginColorsAndGradients","useMultipleOriginColorsAndGradients","MenuGroup","MenuItem","PanelBody","ToggleControl","ToolbarDropdownMenu","__","check","ALLOWED_BLOCKS","sizeOptions","name","value","getDefaultBlockLayout","blockTypeOrName","layoutBlockSupportConfig","default","SocialLinksEdit","props","clientId","attributes","iconBackgroundColor","iconColor","isSelected","setAttributes","setIconBackgroundColor","setIconColor","iconBackgroundColorValue","customIconBackgroundColor","iconColorValue","openInNewTab","showLabels","size","layout","usedLayout","logosOnly","className","includes","backgroundBackup","current","undefined","SocialPlaceholder","SelectedSocialPlaceholder","color","blockProps","innerBlocksProps","allowedBlocks","placeholder","templateLock","__experimentalAppenderTagName","__experimentalLayout","POPOVER_PROPS","position","colorSettings","onChange","colorValue","label","resetAllFilter","push","colorGradientSettings","onClose","map","entry","onColorChange","isShownByDefault","enableAlpha","textColor","backgroundColor","iconColorAttributes"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,SAAT,EAAoBC,MAApB,QAAkC,oBAAlC;AACA,SACCC,aADD,EAECC,mBAFD,EAGCC,aAHD,EAICC,iBAJD,EAKCC,eALD,EAMCC,UAND,EAOCC,2CAA2C,IAAIC,6BAPhD,EAQCC,iDAAiD,IAAIC,mCARtD,QASO,yB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BF,CAxDD,EAwFC,oBAASkB,gBAAT,CAxFD,CADD;AA4FA;AAED,MAAMuB,mBAAmB,GAAG;AAC3B9C,EAAAA,SAAS,EAAE,YADgB;AAE3BD,EAAAA,mBAAmB,EAAE;AAFM,CAA5B;AAKA,eAAexB,UAAU,CAAEuE,mBAAF,CAAV,CAAmCnD,eAAnC,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { useEffect, useRef } from '@wordpress/element';\nimport {\n\tBlockControls,\n\tuseInnerBlocksProps,\n\tuseBlockProps,\n\tInspectorControls,\n\tContrastChecker,\n\twithColors,\n\t__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,\n\t__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,\n} from '@wordpress/block-editor';\nimport {\n\tMenuGroup,\n\tMenuItem,\n\tPanelBody,\n\tToggleControl,\n\tToolbarDropdownMenu,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { check } from '@wordpress/icons';\n\nconst ALLOWED_BLOCKS = [ 'core/social-link' ];\n\nconst sizeOptions = [\n\t{ name: __( 'Small' ), value: 'has-small-icon-size' },\n\t{ name: __( 'Normal' ), value: 'has-normal-icon-size' },\n\t{ name: __( 'Large' ), value: 'has-large-icon-size' },\n\t{ name: __( 'Huge' ), value: 'has-huge-icon-size' },\n];\n\nconst getDefaultBlockLayout = ( blockTypeOrName ) => {\n\tconst layoutBlockSupportConfig = getBlockSupport(\n\t\tblockTypeOrName,\n\t\t'__experimentalLayout'\n\t);\n\treturn layoutBlockSupportConfig?.default;\n};\n\nexport function SocialLinksEdit( props ) {\n\tconst {\n\t\tclientId,\n\t\tname,\n\t\tattributes,\n\t\ticonBackgroundColor,\n\t\ticonColor,\n\t\tisSelected,\n\t\tsetAttributes,\n\t\tsetIconBackgroundColor,\n\t\tsetIconColor,\n\t} = props;\n\n\tconst {\n\t\ticonBackgroundColorValue,\n\t\tcustomIconBackgroundColor,\n\t\ticonColorValue,\n\t\topenInNewTab,\n\t\tshowLabels,\n\t\tsize,\n\t\tlayout,\n\t} = attributes;\n\tconst usedLayout = layout || getDefaultBlockLayout( name );\n\n\tconst logosOnly = attributes.className?.includes( 'is-style-logos-only' );\n\n\t// Remove icon background color when logos only style is selected or\n\t// restore it when any other style is selected.\n\tconst backgroundBackup = useRef( {} );\n\tuseEffect( () => {\n\t\tif ( logosOnly ) {\n\t\t\tbackgroundBackup.current = {\n\t\t\t\ticonBackgroundColor,\n\t\t\t\ticonBackgroundColorValue,\n\t\t\t\tcustomIconBackgroundColor,\n\t\t\t};\n\t\t\tsetAttributes( {\n\t\t\t\ticonBackgroundColor: undefined,\n\t\t\t\tcustomIconBackgroundColor: undefined,\n\t\t\t\ticonBackgroundColorValue: undefined,\n\t\t\t} );\n\t\t} else {\n\t\t\tsetAttributes( { ...backgroundBackup.current } );\n\t\t}\n\t}, [ logosOnly ] );\n\n\tconst SocialPlaceholder = (\n\t\t<li className=\"wp-block-social-links__social-placeholder\">\n\t\t\t<div className=\"wp-block-social-links__social-placeholder-icons\">\n\t\t\t\t<div className=\"wp-social-link wp-social-link-twitter\"></div>\n\t\t\t\t<div className=\"wp-social-link wp-social-link-facebook\"></div>\n\t\t\t\t<div className=\"wp-social-link wp-social-link-instagram\"></div>\n\t\t\t</div>\n\t\t</li>\n\t);\n\n\tconst SelectedSocialPlaceholder = (\n\t\t<li className=\"wp-block-social-links__social-prompt\">\n\t\t\t{ __( 'Click plus to add' ) }\n\t\t</li>\n\t);\n\n\t// Fallback color values are used maintain selections in case switching\n\t// themes and named colors in palette do not match.\n\tconst className = classNames( size, {\n\t\t'has-visible-labels': showLabels,\n\t\t'has-icon-color': iconColor.color || iconColorValue,\n\t\t'has-icon-background-color':\n\t\t\ticonBackgroundColor.color || iconBackgroundColorValue,\n\t} );\n\n\tconst blockProps = useBlockProps( { className } );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tallowedBlocks: ALLOWED_BLOCKS,\n\t\tplaceholder: isSelected ? SelectedSocialPlaceholder : SocialPlaceholder,\n\t\ttemplateLock: false,\n\t\t__experimentalAppenderTagName: 'li',\n\t\t__experimentalLayout: usedLayout,\n\t} );\n\n\tconst POPOVER_PROPS = {\n\t\tposition: 'bottom right',\n\t};\n\n\tconst colorSettings = [\n\t\t{\n\t\t\t// Use custom attribute as fallback to prevent loss of named color selection when\n\t\t\t// switching themes to a new theme that does not have a matching named color.\n\t\t\tvalue: iconColor.color || iconColorValue,\n\t\t\tonChange: ( colorValue ) => {\n\t\t\t\tsetIconColor( colorValue );\n\t\t\t\tsetAttributes( { iconColorValue: colorValue } );\n\t\t\t},\n\t\t\tlabel: __( 'Icon color' ),\n\t\t\tresetAllFilter: () => {\n\t\t\t\tsetIconColor( undefined );\n\t\t\t\tsetAttributes( { iconColorValue: undefined } );\n\t\t\t},\n\t\t},\n\t];\n\n\tif ( ! logosOnly ) {\n\t\tcolorSettings.push( {\n\t\t\t// Use custom attribute as fallback to prevent loss of named color selection when\n\t\t\t// switching themes to a new theme that does not have a matching named color.\n\t\t\tvalue: iconBackgroundColor.color || iconBackgroundColorValue,\n\t\t\tonChange: ( colorValue ) => {\n\t\t\t\tsetIconBackgroundColor( colorValue );\n\t\t\t\tsetAttributes( {\n\t\t\t\t\ticonBackgroundColorValue: colorValue,\n\t\t\t\t} );\n\t\t\t},\n\t\t\tlabel: __( 'Icon background' ),\n\t\t\tresetAllFilter: () => {\n\t\t\t\tsetIconBackgroundColor( undefined );\n\t\t\t\tsetAttributes( { iconBackgroundColorValue: undefined } );\n\t\t\t},\n\t\t} );\n\t}\n\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"other\">\n\t\t\t\t<ToolbarDropdownMenu\n\t\t\t\t\tlabel={ __( 'Size' ) }\n\t\t\t\t\ttext={ __( 'Size' ) }\n\t\t\t\t\ticon={ null }\n\t\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t\t>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t{ sizeOptions.map( ( entry ) => {\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\ticon={\n\t\t\t\t\t\t\t\t\t\t\t( size === entry.value ||\n\t\t\t\t\t\t\t\t\t\t\t\t( ! size &&\n\t\t\t\t\t\t\t\t\t\t\t\t\tentry.value ===\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'has-normal-icon-size' ) ) &&\n\t\t\t\t\t\t\t\t\t\t\tcheck\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tisSelected={ size === entry.value }\n\t\t\t\t\t\t\t\t\t\tkey={ entry.value }\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\tsize: entry.value,\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\tonClose={ onClose }\n\t\t\t\t\t\t\t\t\t\trole=\"menuitemradio\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ entry.name }\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\t\t\t\t</ToolbarDropdownMenu>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Link settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Open links in new tab' ) }\n\t\t\t\t\t\tchecked={ openInNewTab }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( { openInNewTab: ! openInNewTab } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Show labels' ) }\n\t\t\t\t\t\tchecked={ showLabels }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( { showLabels: ! showLabels } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls __experimentalGroup=\"color\">\n\t\t\t\t{ colorSettings.map(\n\t\t\t\t\t( { onChange, label, value, resetAllFilter } ) => (\n\t\t\t\t\t\t<ColorGradientSettingsDropdown\n\t\t\t\t\t\t\tkey={ `social-links-color-${ label }` }\n\t\t\t\t\t\t\t__experimentalHasMultipleOrigins\n\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t\tsettings={ [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tcolorValue: value,\n\t\t\t\t\t\t\t\t\tlabel,\n\t\t\t\t\t\t\t\t\tonColorChange: onChange,\n\t\t\t\t\t\t\t\t\tisShownByDefault: true,\n\t\t\t\t\t\t\t\t\tresetAllFilter,\n\t\t\t\t\t\t\t\t\tenableAlpha: true,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t\t\t{ ...colorGradientSettings }\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t) }\n\t\t\t\t{ ! logosOnly && (\n\t\t\t\t\t<ContrastChecker\n\t\t\t\t\t\t{ ...{\n\t\t\t\t\t\t\ttextColor: iconColorValue,\n\t\t\t\t\t\t\tbackgroundColor: iconBackgroundColorValue,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisLargeText={ false }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</InspectorControls>\n\t\t\t<ul { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n\nconst iconColorAttributes = {\n\ticonColor: 'icon-color',\n\ticonBackgroundColor: 'icon-background-color',\n};\n\nexport default withColors( iconColorAttributes )( SocialLinksEdit );\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/social-links/edit.js"],"names":["classNames","getBlockSupport","useEffect","useRef","BlockControls","useInnerBlocksProps","useBlockProps","InspectorControls","ContrastChecker","withColors","__experimentalColorGradientSettingsDropdown","ColorGradientSettingsDropdown","__experimentalUseMultipleOriginColorsAndGradients","useMultipleOriginColorsAndGradients","MenuGroup","MenuItem","PanelBody","ToggleControl","ToolbarDropdownMenu","__","check","ALLOWED_BLOCKS","sizeOptions","name","value","getDefaultBlockLayout","blockTypeOrName","layoutBlockSupportConfig","default","SocialLinksEdit","props","clientId","attributes","iconBackgroundColor","iconColor","isSelected","setAttributes","setIconBackgroundColor","setIconColor","iconBackgroundColorValue","customIconBackgroundColor","iconColorValue","openInNewTab","showLabels","size","layout","usedLayout","logosOnly","className","includes","backgroundBackup","current","undefined","SocialPlaceholder","SelectedSocialPlaceholder","color","blockProps","innerBlocksProps","allowedBlocks","placeholder","templateLock","__experimentalAppenderTagName","__experimentalLayout","POPOVER_PROPS","position","colorSettings","onChange","colorValue","label","resetAllFilter","push","colorGradientSettings","onClose","map","entry","onColorChange","isShownByDefault","enableAlpha","textColor","backgroundColor","iconColorAttributes"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,mBAAhC;AACA,SAASC,SAAT,EAAoBC,MAApB,QAAkC,oBAAlC;AACA,SACCC,aADD,EAECC,mBAFD,EAGCC,aAHD,EAICC,iBAJD,EAKCC,eALD,EAMCC,UAND,EAOCC,2CAA2C,IAAIC,6BAPhD,EAQCC,iDAAiD,IAAIC,mCARtD,QASO,yBATP;AAUA,SACCC,SADD,EAECC,QAFD,EAGCC,SAHD,E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GAAG;AAC3B9C,EAAAA,SAAS,EAAE,YADgB;AAE3BD,EAAAA,mBAAmB,EAAE;AAFM,CAA5B;AAKA,eAAexB,UAAU,CAAEuE,mBAAF,CAAV,CAAmCnD,eAAnC,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { useEffect, useRef } from '@wordpress/element';\nimport {\n\tBlockControls,\n\tuseInnerBlocksProps,\n\tuseBlockProps,\n\tInspectorControls,\n\tContrastChecker,\n\twithColors,\n\t__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,\n\t__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,\n} from '@wordpress/block-editor';\nimport {\n\tMenuGroup,\n\tMenuItem,\n\tPanelBody,\n\tToggleControl,\n\tToolbarDropdownMenu,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { check } from '@wordpress/icons';\n\nconst ALLOWED_BLOCKS = [ 'core/social-link' ];\n\nconst sizeOptions = [\n\t{ name: __( 'Small' ), value: 'has-small-icon-size' },\n\t{ name: __( 'Normal' ), value: 'has-normal-icon-size' },\n\t{ name: __( 'Large' ), value: 'has-large-icon-size' },\n\t{ name: __( 'Huge' ), value: 'has-huge-icon-size' },\n];\n\nconst getDefaultBlockLayout = ( blockTypeOrName ) => {\n\tconst layoutBlockSupportConfig = getBlockSupport(\n\t\tblockTypeOrName,\n\t\t'__experimentalLayout'\n\t);\n\treturn layoutBlockSupportConfig?.default;\n};\n\nexport function SocialLinksEdit( props ) {\n\tconst {\n\t\tclientId,\n\t\tname,\n\t\tattributes,\n\t\ticonBackgroundColor,\n\t\ticonColor,\n\t\tisSelected,\n\t\tsetAttributes,\n\t\tsetIconBackgroundColor,\n\t\tsetIconColor,\n\t} = props;\n\n\tconst {\n\t\ticonBackgroundColorValue,\n\t\tcustomIconBackgroundColor,\n\t\ticonColorValue,\n\t\topenInNewTab,\n\t\tshowLabels,\n\t\tsize,\n\t\tlayout,\n\t} = attributes;\n\tconst usedLayout = layout || getDefaultBlockLayout( name );\n\n\tconst logosOnly = attributes.className?.includes( 'is-style-logos-only' );\n\n\t// Remove icon background color when logos only style is selected or\n\t// restore it when any other style is selected.\n\tconst backgroundBackup = useRef( {} );\n\tuseEffect( () => {\n\t\tif ( logosOnly ) {\n\t\t\tbackgroundBackup.current = {\n\t\t\t\ticonBackgroundColor,\n\t\t\t\ticonBackgroundColorValue,\n\t\t\t\tcustomIconBackgroundColor,\n\t\t\t};\n\t\t\tsetAttributes( {\n\t\t\t\ticonBackgroundColor: undefined,\n\t\t\t\tcustomIconBackgroundColor: undefined,\n\t\t\t\ticonBackgroundColorValue: undefined,\n\t\t\t} );\n\t\t} else {\n\t\t\tsetAttributes( { ...backgroundBackup.current } );\n\t\t}\n\t}, [ logosOnly ] );\n\n\tconst SocialPlaceholder = (\n\t\t<li className=\"wp-block-social-links__social-placeholder\">\n\t\t\t<div className=\"wp-block-social-links__social-placeholder-icons\">\n\t\t\t\t<div className=\"wp-social-link wp-social-link-twitter\"></div>\n\t\t\t\t<div className=\"wp-social-link wp-social-link-facebook\"></div>\n\t\t\t\t<div className=\"wp-social-link wp-social-link-instagram\"></div>\n\t\t\t</div>\n\t\t</li>\n\t);\n\n\tconst SelectedSocialPlaceholder = (\n\t\t<li className=\"wp-block-social-links__social-prompt\">\n\t\t\t{ __( 'Click plus to add' ) }\n\t\t</li>\n\t);\n\n\t// Fallback color values are used maintain selections in case switching\n\t// themes and named colors in palette do not match.\n\tconst className = classNames( size, {\n\t\t'has-visible-labels': showLabels,\n\t\t'has-icon-color': iconColor.color || iconColorValue,\n\t\t'has-icon-background-color':\n\t\t\ticonBackgroundColor.color || iconBackgroundColorValue,\n\t} );\n\n\tconst blockProps = useBlockProps( { className } );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tallowedBlocks: ALLOWED_BLOCKS,\n\t\tplaceholder: isSelected ? SelectedSocialPlaceholder : SocialPlaceholder,\n\t\ttemplateLock: false,\n\t\t__experimentalAppenderTagName: 'li',\n\t\t__experimentalLayout: usedLayout,\n\t} );\n\n\tconst POPOVER_PROPS = {\n\t\tposition: 'bottom right',\n\t};\n\n\tconst colorSettings = [\n\t\t{\n\t\t\t// Use custom attribute as fallback to prevent loss of named color selection when\n\t\t\t// switching themes to a new theme that does not have a matching named color.\n\t\t\tvalue: iconColor.color || iconColorValue,\n\t\t\tonChange: ( colorValue ) => {\n\t\t\t\tsetIconColor( colorValue );\n\t\t\t\tsetAttributes( { iconColorValue: colorValue } );\n\t\t\t},\n\t\t\tlabel: __( 'Icon color' ),\n\t\t\tresetAllFilter: () => {\n\t\t\t\tsetIconColor( undefined );\n\t\t\t\tsetAttributes( { iconColorValue: undefined } );\n\t\t\t},\n\t\t},\n\t];\n\n\tif ( ! logosOnly ) {\n\t\tcolorSettings.push( {\n\t\t\t// Use custom attribute as fallback to prevent loss of named color selection when\n\t\t\t// switching themes to a new theme that does not have a matching named color.\n\t\t\tvalue: iconBackgroundColor.color || iconBackgroundColorValue,\n\t\t\tonChange: ( colorValue ) => {\n\t\t\t\tsetIconBackgroundColor( colorValue );\n\t\t\t\tsetAttributes( {\n\t\t\t\t\ticonBackgroundColorValue: colorValue,\n\t\t\t\t} );\n\t\t\t},\n\t\t\tlabel: __( 'Icon background' ),\n\t\t\tresetAllFilter: () => {\n\t\t\t\tsetIconBackgroundColor( undefined );\n\t\t\t\tsetAttributes( { iconBackgroundColorValue: undefined } );\n\t\t\t},\n\t\t} );\n\t}\n\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"other\">\n\t\t\t\t<ToolbarDropdownMenu\n\t\t\t\t\tlabel={ __( 'Size' ) }\n\t\t\t\t\ttext={ __( 'Size' ) }\n\t\t\t\t\ticon={ null }\n\t\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t\t>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t{ sizeOptions.map( ( entry ) => {\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\ticon={\n\t\t\t\t\t\t\t\t\t\t\t( size === entry.value ||\n\t\t\t\t\t\t\t\t\t\t\t\t( ! size &&\n\t\t\t\t\t\t\t\t\t\t\t\t\tentry.value ===\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'has-normal-icon-size' ) ) &&\n\t\t\t\t\t\t\t\t\t\t\tcheck\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tisSelected={ size === entry.value }\n\t\t\t\t\t\t\t\t\t\tkey={ entry.value }\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\tsize: entry.value,\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\tonClose={ onClose }\n\t\t\t\t\t\t\t\t\t\trole=\"menuitemradio\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ entry.name }\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\t\t\t\t</ToolbarDropdownMenu>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Link settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Open links in new tab' ) }\n\t\t\t\t\t\tchecked={ openInNewTab }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( { openInNewTab: ! openInNewTab } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Show labels' ) }\n\t\t\t\t\t\tchecked={ showLabels }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( { showLabels: ! showLabels } )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls __experimentalGroup=\"color\">\n\t\t\t\t{ colorSettings.map(\n\t\t\t\t\t( { onChange, label, value, resetAllFilter } ) => (\n\t\t\t\t\t\t<ColorGradientSettingsDropdown\n\t\t\t\t\t\t\tkey={ `social-links-color-${ label }` }\n\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t\tsettings={ [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tcolorValue: value,\n\t\t\t\t\t\t\t\t\tlabel,\n\t\t\t\t\t\t\t\t\tonColorChange: onChange,\n\t\t\t\t\t\t\t\t\tisShownByDefault: true,\n\t\t\t\t\t\t\t\t\tresetAllFilter,\n\t\t\t\t\t\t\t\t\tenableAlpha: true,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t] }\n\t\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t\t\t{ ...colorGradientSettings }\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t) }\n\t\t\t\t{ ! logosOnly && (\n\t\t\t\t\t<ContrastChecker\n\t\t\t\t\t\t{ ...{\n\t\t\t\t\t\t\ttextColor: iconColorValue,\n\t\t\t\t\t\t\tbackgroundColor: iconBackgroundColorValue,\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisLargeText={ false }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</InspectorControls>\n\t\t\t<ul { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n\nconst iconColorAttributes = {\n\ticonColor: 'icon-color',\n\ticonBackgroundColor: 'icon-background-color',\n};\n\nexport default withColors( iconColorAttributes )( SocialLinksEdit );\n"]}
@@ -215,7 +215,7 @@ export default function TableOfContentsEdit(_ref) {
215
215
  icon: createElement(BlockIcon, {
216
216
  icon: icon
217
217
  }),
218
- label: "Table of Contents",
218
+ label: __('Table of Contents'),
219
219
  instructions: __('Start adding Heading blocks to create a table of contents. Headings with HTML anchors will be linked here.')
220
220
  })), inspectorControls);
221
221
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/table-of-contents/edit.js"],"names":["fastDeepEqual","BlockControls","BlockIcon","InspectorControls","store","blockEditorStore","useBlockProps","createBlock","PanelBody","Placeholder","ToggleControl","ToolbarButton","ToolbarGroup","useDispatch","useSelect","__unstableStripHTML","stripHTML","renderToString","useEffect","__","addQueryArgs","removeQueryArgs","icon","TableOfContentsList","linearToNestedHeadingList","TableOfContentsEdit","attributes","headings","onlyIncludeCurrentPage","clientId","setAttributes","blockProps","canInsertList","select","getBlockRootClientId","canInsertBlockType","rootClientId","__unstableMarkNextChangeAsNotPersistent","replaceBlocks","latestHeadings","getBlockAttributes","getBlockName","getClientIdsWithDescendants","__experimentalGetGlobalBlocksByName","getGlobalBlocksByName","editorSelectors","pageBreakClientIds","isPaginated","length","allBlockClientIds","tocPage","tocIndex","indexOf","blockIndex","blockClientId","entries","_latestHeadings","headingPage","permalink","getPermalink","headingPageLink","page","blockName","headingAttributes","canBeLinked","anchor","push","content","replace","level","link","headingTree","toolbarControls","ordered","values","inspectorControls","value"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,aAAP,MAA0B,qBAA1B;AAEA;AACA;AACA;;AACA,SACCC,aADD,EAECC,SAFD,EAGCC,iBAHD,EAICC,KAAK,IAAIC,gBAJV,EAKCC,aALD,QAMO,yBANP;AAOA,SAASC,WAAT,QAA4B,mBAA5B;AACA,SACCC,SADD,EAECC,WAFD,EAGCC,aAHD,EAICC,aAJD,EAKCC,YALD,QAMO,uBANP;AAOA,SAASC,WAAT,EAAsBC,SAAt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C,MAAA,IAAI,EAAG,cAAC,SAAD;AAAW,QAAA,IAAI,EAAGT;AAAlB,QADR;AAEC,MAAA,KAAK,EAAC,mBAFP;AAGC,MAAA,YAAY,EAAGH,EAAE,CAChB,4GADgB;AAHlB,MADD,CADD,EAUGwD,iBAVH,CADD;AAcA;;AAED,SACC,8BACC,qBAAU5C,UAAV,EACC;AAAI,IAAA,KAAK,EAAC;AAAV,KACC,cAAC,mBAAD;AAAqB,IAAA,iBAAiB,EAAGwC;AAAzC,IADD,CADD,CADD,EAMGC,eANH,EAOGG,iBAPH,CADD;AAWA","sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tBlockIcon,\n\tInspectorControls,\n\tstore as blockEditorStore,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\nimport {\n\tPanelBody,\n\tPlaceholder,\n\tToggleControl,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { renderToString, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { addQueryArgs, removeQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport icon from './icon';\nimport TableOfContentsList from './list';\nimport { linearToNestedHeadingList } from './utils';\n\n/** @typedef {import('./utils').HeadingData} HeadingData */\n\n/**\n * Table of Contents block edit component.\n *\n * @param {Object} props The props.\n * @param {Object} props.attributes The block attributes.\n * @param {HeadingData[]} props.attributes.headings A list of data for each heading in the post.\n * @param {boolean} props.attributes.onlyIncludeCurrentPage Whether to only include headings from the current page (if the post is paginated).\n * @param {string} props.clientId\n * @param {(attributes: Object) => void} props.setAttributes\n *\n * @return {WPComponent} The component.\n */\nexport default function TableOfContentsEdit( {\n\tattributes: { headings = [], onlyIncludeCurrentPage },\n\tclientId,\n\tsetAttributes,\n} ) {\n\tconst blockProps = useBlockProps();\n\n\tconst canInsertList = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId, canInsertBlockType } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\n\t\t\treturn canInsertBlockType( 'core/list', rootClientId );\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst { __unstableMarkNextChangeAsNotPersistent, replaceBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\n\t/**\n\t * The latest heading data, or null if the new data deeply equals the saved\n\t * headings attribute.\n\t *\n\t * Since useSelect forces a re-render when its return value is shallowly\n\t * inequal to its prior call, we would be re-rendering this block every time\n\t * the stores change, even if the latest headings were deeply equal to the\n\t * ones saved in the block attributes.\n\t *\n\t * By returning null when they're equal, we reduce that to 2 renders: one\n\t * when there are new latest headings (and so it returns them), and one when\n\t * they haven't changed (so it returns null). As long as the latest heading\n\t * data remains the same, further calls of the useSelect callback will\n\t * continue to return null, thus preventing any forced re-renders.\n\t */\n\tconst latestHeadings = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetClientIdsWithDescendants,\n\t\t\t\t__experimentalGetGlobalBlocksByName: getGlobalBlocksByName,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\t// FIXME: @wordpress/block-library should not depend on @wordpress/editor.\n\t\t\t// Blocks can be loaded into a *non-post* block editor, so to avoid\n\t\t\t// declaring @wordpress/editor as a dependency, we must access its\n\t\t\t// store by string. When the store is not available, editorSelectors\n\t\t\t// will be null, and the block's saved markup will lack permalinks.\n\t\t\t// eslint-disable-next-line @wordpress/data-no-store-string-literals\n\t\t\tconst editorSelectors = select( 'core/editor' );\n\n\t\t\tconst pageBreakClientIds = getGlobalBlocksByName( 'core/nextpage' );\n\n\t\t\tconst isPaginated = pageBreakClientIds.length !== 0;\n\n\t\t\t// Get the client ids of all blocks in the editor.\n\t\t\tconst allBlockClientIds = getClientIdsWithDescendants();\n\n\t\t\t// If onlyIncludeCurrentPage is true, calculate the page (of a paginated post) this block is part of, so we know which headings to include; otherwise, skip the calculation.\n\t\t\tlet tocPage = 1;\n\n\t\t\tif ( isPaginated && onlyIncludeCurrentPage ) {\n\t\t\t\t// We can't use getBlockIndex because it only returns the index\n\t\t\t\t// relative to sibling blocks.\n\t\t\t\tconst tocIndex = allBlockClientIds.indexOf( clientId );\n\n\t\t\t\tfor ( const [\n\t\t\t\t\tblockIndex,\n\t\t\t\t\tblockClientId,\n\t\t\t\t] of allBlockClientIds.entries() ) {\n\t\t\t\t\t// If we've reached blocks after the Table of Contents, we've\n\t\t\t\t\t// finished calculating which page the block is on.\n\t\t\t\t\tif ( blockIndex >= tocIndex ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif ( getBlockName( blockClientId ) === 'core/nextpage' ) {\n\t\t\t\t\t\ttocPage++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst _latestHeadings = [];\n\n\t\t\t/** The page (of a paginated post) a heading will be part of. */\n\t\t\tlet headingPage = 1;\n\n\t\t\t/**\n\t\t\t * A permalink to the current post. If the core/editor store is\n\t\t\t * unavailable, this variable will be null.\n\t\t\t */\n\t\t\tconst permalink = editorSelectors?.getPermalink() ?? null;\n\n\t\t\tlet headingPageLink = null;\n\n\t\t\t// If the core/editor store is available, we can add permalinks to the\n\t\t\t// generated table of contents.\n\t\t\tif ( typeof permalink === 'string' ) {\n\t\t\t\theadingPageLink = isPaginated\n\t\t\t\t\t? addQueryArgs( permalink, { page: headingPage } )\n\t\t\t\t\t: permalink;\n\t\t\t}\n\n\t\t\tfor ( const blockClientId of allBlockClientIds ) {\n\t\t\t\tconst blockName = getBlockName( blockClientId );\n\t\t\t\tif ( blockName === 'core/nextpage' ) {\n\t\t\t\t\theadingPage++;\n\n\t\t\t\t\t// If we're only including headings from the current page (of\n\t\t\t\t\t// a paginated post), then exit the loop if we've reached the\n\t\t\t\t\t// pages after the one with the Table of Contents block.\n\t\t\t\t\tif ( onlyIncludeCurrentPage && headingPage > tocPage ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( typeof permalink === 'string' ) {\n\t\t\t\t\t\theadingPageLink = addQueryArgs(\n\t\t\t\t\t\t\tremoveQueryArgs( permalink, [ 'page' ] ),\n\t\t\t\t\t\t\t{ page: headingPage }\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// If we're including all headings or we've reached headings on\n\t\t\t\t// the same page as the Table of Contents block, add them to the\n\t\t\t\t// list.\n\t\t\t\telse if (\n\t\t\t\t\t! onlyIncludeCurrentPage ||\n\t\t\t\t\theadingPage === tocPage\n\t\t\t\t) {\n\t\t\t\t\tif ( blockName === 'core/heading' ) {\n\t\t\t\t\t\tconst headingAttributes =\n\t\t\t\t\t\t\tgetBlockAttributes( blockClientId );\n\n\t\t\t\t\t\tconst canBeLinked =\n\t\t\t\t\t\t\ttypeof headingPageLink === 'string' &&\n\t\t\t\t\t\t\ttypeof headingAttributes.anchor === 'string' &&\n\t\t\t\t\t\t\theadingAttributes.anchor !== '';\n\n\t\t\t\t\t\t_latestHeadings.push( {\n\t\t\t\t\t\t\t// Convert line breaks to spaces, and get rid of HTML tags in the headings.\n\t\t\t\t\t\t\tcontent: stripHTML(\n\t\t\t\t\t\t\t\theadingAttributes.content.replace(\n\t\t\t\t\t\t\t\t\t/(<br *\\/?>)+/g,\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\tlevel: headingAttributes.level,\n\t\t\t\t\t\t\tlink: canBeLinked\n\t\t\t\t\t\t\t\t? `${ headingPageLink }#${ headingAttributes.anchor }`\n\t\t\t\t\t\t\t\t: null,\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( fastDeepEqual( headings, _latestHeadings ) ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn _latestHeadings;\n\t\t},\n\t\t[ clientId, onlyIncludeCurrentPage, headings ]\n\t);\n\n\tuseEffect( () => {\n\t\tif ( latestHeadings !== null ) {\n\t\t\t// This is required to keep undo working and not create 2 undo steps\n\t\t\t// for each heading change.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { headings: latestHeadings } );\n\t\t}\n\t}, [ latestHeadings ] );\n\n\tconst headingTree = linearToNestedHeadingList( headings );\n\n\tconst toolbarControls = canInsertList && (\n\t\t<BlockControls>\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tcreateBlock( 'core/list', {\n\t\t\t\t\t\t\t\tordered: true,\n\t\t\t\t\t\t\t\tvalues: renderToString(\n\t\t\t\t\t\t\t\t\t<TableOfContentsList\n\t\t\t\t\t\t\t\t\t\tnestedHeadingList={ headingTree }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Convert to static list' ) }\n\t\t\t\t</ToolbarButton>\n\t\t\t</ToolbarGroup>\n\t\t</BlockControls>\n\t);\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Only include current page' ) }\n\t\t\t\t\tchecked={ onlyIncludeCurrentPage }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { onlyIncludeCurrentPage: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={\n\t\t\t\t\t\tonlyIncludeCurrentPage\n\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t'Only including headings from the current page (if the post is paginated).'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'Toggle to only include headings from the current page (if the post is paginated).'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n\n\t// If there are no headings or the only heading is empty.\n\t// Note that the toolbar controls are intentionally omitted since the\n\t// \"Convert to static list\" option is useless to the placeholder state.\n\tif ( headings.length === 0 ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<Placeholder\n\t\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\t\tlabel=\"Table of Contents\"\n\t\t\t\t\t\tinstructions={ __(\n\t\t\t\t\t\t\t'Start adding Heading blocks to create a table of contents. Headings with HTML anchors will be linked here.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t{ inspectorControls }\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<nav { ...blockProps }>\n\t\t\t\t<ol inert=\"true\">\n\t\t\t\t\t<TableOfContentsList nestedHeadingList={ headingTree } />\n\t\t\t\t</ol>\n\t\t\t</nav>\n\t\t\t{ toolbarControls }\n\t\t\t{ inspectorControls }\n\t\t</>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/table-of-contents/edit.js"],"names":["fastDeepEqual","BlockControls","BlockIcon","InspectorControls","store","blockEditorStore","useBlockProps","createBlock","PanelBody","Placeholder","ToggleControl","ToolbarButton","ToolbarGroup","useDispatch","useSelect","__unstableStripHTML","stripHTML","renderToString","useEffect","__","addQueryArgs","removeQueryArgs","icon","TableOfContentsList","linearToNestedHeadingList","TableOfContentsEdit","attributes","headings","onlyIncludeCurrentPage","clientId","setAttributes","blockProps","canInsertList","select","getBlockRootClientId","canInsertBlockType","rootClientId","__unstableMarkNextChangeAsNotPersistent","replaceBlocks","latestHeadings","getBlockAttributes","getBlockName","getClientIdsWithDescendants","__experimentalGetGlobalBlocksByName","getGlobalBlocksByName","editorSelectors","pageBreakClientIds","isPaginated","length","allBlockClientIds","tocPage","tocIndex","indexOf","blockIndex","blockClientId","entries","_latestHeadings","headingPage","permalink","getPermalink","headingPageLink","page","blockName","headingAttributes","canBeLinked","anchor","push","content","replace","level","link","headingTree","toolbarControls","ordered","values","inspectorControls","value"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,aAAP,MAA0B,qBAA1B;AAEA;AACA;AACA;;AACA,SACCC,aADD,EAECC,SAFD,EAGCC,iBAHD,EAICC,KAAK,IAAIC,gBAJV,EAKCC,aALD,QAMO,yBANP;AAOA,SAASC,WAAT,QAA4B,mBAA5B;AACA,SACCC,SADD,EAECC,WAFD,EAGCC,aAHD,EAICC,aAJD,EAKCC,YALD,QAMO,uBANP;AAOA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,mBAAmB,IAAIC,SAAhC,QAAiD,gBAAjD;AACA,SAASC,cAAT,EAAyBC,SAAzB,QAA0C,oBAA1C;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,YAAT,EAAuBC,eAAvB,QAA8C,gBAA9C;AAEA;AACA;AACA;;AACA,OAAOC,IAAP,MAAiB,QAAjB;AACA,OAAOC,mBAAP,MAAgC,QAAhC;AACA,SAASC,yBAAT,QAA0C,SAA1C;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,mBAAT,OAIX;AAAA,MAJyC;AAC5CC,IAAAA,UAAU,EAAE;AAAEC,MAAAA,QAAQ,GAAG,EAAb;AAAiBC,MAAAA;AAAjB,KADgC;AAE5CC,IAAAA,QAF4C;AAG5CC,IAAAA;AAH4C,GAIzC;AACH,QAAM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A,iBAAiB,EAAGsD;AADrB,QADqB;AAFG,KAAf,CAFC;AAFf,KAeGpD,EAAE,CAAE,wBAAF,CAfL,CADD,CADD,CADD;AAwBA,QAAMwD,iBAAiB,GACtB,cAAC,iBAAD,QACC,cAAC,SAAD;AAAW,IAAA,KAAK,EAAGxD,EAAE,CAAE,UAAF;AAArB,KACC,cAAC,aAAD;AACC,IAAA,KAAK,EAAGA,EAAE,CAAE,2BAAF,CADX;AAEC,IAAA,OAAO,EAAGS,sBAFX;AAGC,IAAA,QAAQ,EAAKgD,KAAF,IACV9C,aAAa,CAAE;AAAEF,MAAAA,sBAAsB,EAAEgD;AAA1B,KAAF,CAJf;AAMC,IAAA,IAAI,EACHhD,sBAAsB,GACnBT,EAAE,CACF,2EADE,CADiB,GAInBA,EAAE,CACF,mFADE;AAXP,IADD,CADD,CADD,CAnMG,CA0NH;AACA;AACA;;AACA,MAAKQ,QAAQ,CAACqB,MAAT,KAAoB,CAAzB,EAA6B;AAC5B,WACC,8BACC,qBAAUjB,UAAV,EACC,cAAC,WAAD;AACC,MAAA,IAAI,EAAG,cAAC,SAAD;AAAW,QAAA,IAAI,EAAGT;AAAlB,QADR;AAEC,MAAA,KAAK,EAAGH,EAAE,CAAE,mBAAF,CAFX;AAGC,MAAA,YAAY,EAAGA,EAAE,CAChB,4GADgB;AAHlB,MADD,CADD,EAUGwD,iBAVH,CADD;AAcA;;AAED,SACC,8BACC,qBAAU5C,UAAV,EACC;AAAI,IAAA,KAAK,EAAC;AAAV,KACC,cAAC,mBAAD;AAAqB,IAAA,iBAAiB,EAAGwC;AAAzC,IADD,CADD,CADD,EAMGC,eANH,EAOGG,iBAPH,CADD;AAWA","sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tBlockIcon,\n\tInspectorControls,\n\tstore as blockEditorStore,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\nimport {\n\tPanelBody,\n\tPlaceholder,\n\tToggleControl,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { renderToString, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { addQueryArgs, removeQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport icon from './icon';\nimport TableOfContentsList from './list';\nimport { linearToNestedHeadingList } from './utils';\n\n/** @typedef {import('./utils').HeadingData} HeadingData */\n\n/**\n * Table of Contents block edit component.\n *\n * @param {Object} props The props.\n * @param {Object} props.attributes The block attributes.\n * @param {HeadingData[]} props.attributes.headings A list of data for each heading in the post.\n * @param {boolean} props.attributes.onlyIncludeCurrentPage Whether to only include headings from the current page (if the post is paginated).\n * @param {string} props.clientId\n * @param {(attributes: Object) => void} props.setAttributes\n *\n * @return {WPComponent} The component.\n */\nexport default function TableOfContentsEdit( {\n\tattributes: { headings = [], onlyIncludeCurrentPage },\n\tclientId,\n\tsetAttributes,\n} ) {\n\tconst blockProps = useBlockProps();\n\n\tconst canInsertList = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId, canInsertBlockType } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\n\t\t\treturn canInsertBlockType( 'core/list', rootClientId );\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst { __unstableMarkNextChangeAsNotPersistent, replaceBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\n\t/**\n\t * The latest heading data, or null if the new data deeply equals the saved\n\t * headings attribute.\n\t *\n\t * Since useSelect forces a re-render when its return value is shallowly\n\t * inequal to its prior call, we would be re-rendering this block every time\n\t * the stores change, even if the latest headings were deeply equal to the\n\t * ones saved in the block attributes.\n\t *\n\t * By returning null when they're equal, we reduce that to 2 renders: one\n\t * when there are new latest headings (and so it returns them), and one when\n\t * they haven't changed (so it returns null). As long as the latest heading\n\t * data remains the same, further calls of the useSelect callback will\n\t * continue to return null, thus preventing any forced re-renders.\n\t */\n\tconst latestHeadings = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetBlockName,\n\t\t\t\tgetClientIdsWithDescendants,\n\t\t\t\t__experimentalGetGlobalBlocksByName: getGlobalBlocksByName,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\t// FIXME: @wordpress/block-library should not depend on @wordpress/editor.\n\t\t\t// Blocks can be loaded into a *non-post* block editor, so to avoid\n\t\t\t// declaring @wordpress/editor as a dependency, we must access its\n\t\t\t// store by string. When the store is not available, editorSelectors\n\t\t\t// will be null, and the block's saved markup will lack permalinks.\n\t\t\t// eslint-disable-next-line @wordpress/data-no-store-string-literals\n\t\t\tconst editorSelectors = select( 'core/editor' );\n\n\t\t\tconst pageBreakClientIds = getGlobalBlocksByName( 'core/nextpage' );\n\n\t\t\tconst isPaginated = pageBreakClientIds.length !== 0;\n\n\t\t\t// Get the client ids of all blocks in the editor.\n\t\t\tconst allBlockClientIds = getClientIdsWithDescendants();\n\n\t\t\t// If onlyIncludeCurrentPage is true, calculate the page (of a paginated post) this block is part of, so we know which headings to include; otherwise, skip the calculation.\n\t\t\tlet tocPage = 1;\n\n\t\t\tif ( isPaginated && onlyIncludeCurrentPage ) {\n\t\t\t\t// We can't use getBlockIndex because it only returns the index\n\t\t\t\t// relative to sibling blocks.\n\t\t\t\tconst tocIndex = allBlockClientIds.indexOf( clientId );\n\n\t\t\t\tfor ( const [\n\t\t\t\t\tblockIndex,\n\t\t\t\t\tblockClientId,\n\t\t\t\t] of allBlockClientIds.entries() ) {\n\t\t\t\t\t// If we've reached blocks after the Table of Contents, we've\n\t\t\t\t\t// finished calculating which page the block is on.\n\t\t\t\t\tif ( blockIndex >= tocIndex ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif ( getBlockName( blockClientId ) === 'core/nextpage' ) {\n\t\t\t\t\t\ttocPage++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst _latestHeadings = [];\n\n\t\t\t/** The page (of a paginated post) a heading will be part of. */\n\t\t\tlet headingPage = 1;\n\n\t\t\t/**\n\t\t\t * A permalink to the current post. If the core/editor store is\n\t\t\t * unavailable, this variable will be null.\n\t\t\t */\n\t\t\tconst permalink = editorSelectors?.getPermalink() ?? null;\n\n\t\t\tlet headingPageLink = null;\n\n\t\t\t// If the core/editor store is available, we can add permalinks to the\n\t\t\t// generated table of contents.\n\t\t\tif ( typeof permalink === 'string' ) {\n\t\t\t\theadingPageLink = isPaginated\n\t\t\t\t\t? addQueryArgs( permalink, { page: headingPage } )\n\t\t\t\t\t: permalink;\n\t\t\t}\n\n\t\t\tfor ( const blockClientId of allBlockClientIds ) {\n\t\t\t\tconst blockName = getBlockName( blockClientId );\n\t\t\t\tif ( blockName === 'core/nextpage' ) {\n\t\t\t\t\theadingPage++;\n\n\t\t\t\t\t// If we're only including headings from the current page (of\n\t\t\t\t\t// a paginated post), then exit the loop if we've reached the\n\t\t\t\t\t// pages after the one with the Table of Contents block.\n\t\t\t\t\tif ( onlyIncludeCurrentPage && headingPage > tocPage ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( typeof permalink === 'string' ) {\n\t\t\t\t\t\theadingPageLink = addQueryArgs(\n\t\t\t\t\t\t\tremoveQueryArgs( permalink, [ 'page' ] ),\n\t\t\t\t\t\t\t{ page: headingPage }\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// If we're including all headings or we've reached headings on\n\t\t\t\t// the same page as the Table of Contents block, add them to the\n\t\t\t\t// list.\n\t\t\t\telse if (\n\t\t\t\t\t! onlyIncludeCurrentPage ||\n\t\t\t\t\theadingPage === tocPage\n\t\t\t\t) {\n\t\t\t\t\tif ( blockName === 'core/heading' ) {\n\t\t\t\t\t\tconst headingAttributes =\n\t\t\t\t\t\t\tgetBlockAttributes( blockClientId );\n\n\t\t\t\t\t\tconst canBeLinked =\n\t\t\t\t\t\t\ttypeof headingPageLink === 'string' &&\n\t\t\t\t\t\t\ttypeof headingAttributes.anchor === 'string' &&\n\t\t\t\t\t\t\theadingAttributes.anchor !== '';\n\n\t\t\t\t\t\t_latestHeadings.push( {\n\t\t\t\t\t\t\t// Convert line breaks to spaces, and get rid of HTML tags in the headings.\n\t\t\t\t\t\t\tcontent: stripHTML(\n\t\t\t\t\t\t\t\theadingAttributes.content.replace(\n\t\t\t\t\t\t\t\t\t/(<br *\\/?>)+/g,\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\tlevel: headingAttributes.level,\n\t\t\t\t\t\t\tlink: canBeLinked\n\t\t\t\t\t\t\t\t? `${ headingPageLink }#${ headingAttributes.anchor }`\n\t\t\t\t\t\t\t\t: null,\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( fastDeepEqual( headings, _latestHeadings ) ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn _latestHeadings;\n\t\t},\n\t\t[ clientId, onlyIncludeCurrentPage, headings ]\n\t);\n\n\tuseEffect( () => {\n\t\tif ( latestHeadings !== null ) {\n\t\t\t// This is required to keep undo working and not create 2 undo steps\n\t\t\t// for each heading change.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { headings: latestHeadings } );\n\t\t}\n\t}, [ latestHeadings ] );\n\n\tconst headingTree = linearToNestedHeadingList( headings );\n\n\tconst toolbarControls = canInsertList && (\n\t\t<BlockControls>\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tcreateBlock( 'core/list', {\n\t\t\t\t\t\t\t\tordered: true,\n\t\t\t\t\t\t\t\tvalues: renderToString(\n\t\t\t\t\t\t\t\t\t<TableOfContentsList\n\t\t\t\t\t\t\t\t\t\tnestedHeadingList={ headingTree }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Convert to static list' ) }\n\t\t\t\t</ToolbarButton>\n\t\t\t</ToolbarGroup>\n\t\t</BlockControls>\n\t);\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Only include current page' ) }\n\t\t\t\t\tchecked={ onlyIncludeCurrentPage }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { onlyIncludeCurrentPage: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={\n\t\t\t\t\t\tonlyIncludeCurrentPage\n\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t'Only including headings from the current page (if the post is paginated).'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'Toggle to only include headings from the current page (if the post is paginated).'\n\t\t\t\t\t\t\t )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n\n\t// If there are no headings or the only heading is empty.\n\t// Note that the toolbar controls are intentionally omitted since the\n\t// \"Convert to static list\" option is useless to the placeholder state.\n\tif ( headings.length === 0 ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<Placeholder\n\t\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\t\tlabel={ __( 'Table of Contents' ) }\n\t\t\t\t\t\tinstructions={ __(\n\t\t\t\t\t\t\t'Start adding Heading blocks to create a table of contents. Headings with HTML anchors will be linked here.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t{ inspectorControls }\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<nav { ...blockProps }>\n\t\t\t\t<ol inert=\"true\">\n\t\t\t\t\t<TableOfContentsList nestedHeadingList={ headingTree } />\n\t\t\t\t</ol>\n\t\t\t</nav>\n\t\t\t{ toolbarControls }\n\t\t\t{ inspectorControls }\n\t\t</>\n\t);\n}\n"]}
@@ -8,13 +8,19 @@ import { SelectControl, TextControl } from '@wordpress/components';
8
8
  import { sprintf, __ } from '@wordpress/i18n';
9
9
  import { InspectorControls } from '@wordpress/block-editor';
10
10
  import { useSelect } from '@wordpress/data';
11
+ /**
12
+ * Internal dependencies
13
+ */
14
+
15
+ import { TemplatePartImportControls } from './import-controls';
11
16
  export function TemplatePartAdvancedControls(_ref) {
12
17
  let {
13
18
  tagName,
14
19
  setAttributes,
15
20
  isEntityAvailable,
16
21
  templatePartId,
17
- defaultWrapper
22
+ defaultWrapper,
23
+ hasInnerBlocks
18
24
  } = _ref;
19
25
  const [area, setArea] = useEntityProp('postType', 'wp_template_part', 'area', templatePartId);
20
26
  const [title, setTitle] = useEntityProp('postType', 'wp_template_part', 'title', templatePartId);
@@ -90,6 +96,9 @@ export function TemplatePartAdvancedControls(_ref) {
90
96
  onChange: value => setAttributes({
91
97
  tagName: value
92
98
  })
99
+ }), !hasInnerBlocks && createElement(TemplatePartImportControls, {
100
+ area: area,
101
+ setAttributes: setAttributes
93
102
  }));
94
103
  }
95
104
  //# sourceMappingURL=advanced-controls.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/template-part/edit/advanced-controls.js"],"names":["useEntityProp","SelectControl","TextControl","sprintf","__","InspectorControls","useSelect","TemplatePartAdvancedControls","tagName","setAttributes","isEntityAvailable","templatePartId","defaultWrapper","area","setArea","title","setTitle","areaOptions","select","definedAreas","__experimentalGetDefaultTemplatePartAreas","map","label","_area","value","event","target"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,aAAT,QAA8B,sBAA9B;AACA,SAASC,aAAT,EAAwBC,WAAxB,QAA2C,uBAA3C;AACA,SAASC,OAAT,EAAkBC,EAAlB,QAA4B,iBAA5B;AACA,SAASC,iBAAT,QAAkC,yBAAlC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAEA,OAAO,SAASC,4BAAT,OAMH;AAAA,MAN0C;AAC7CC,IAAAA,OAD6C;AAE7CC,IAAAA,aAF6C;AAG7CC,IAAAA,iBAH6C;AAI7CC,IAAAA,cAJ6C;AAK7CC,IAAAA;AAL6C,GAM1C;AACH,QAAM,CAAEC,IAAF,EAAQC,OAAR,IAAoBd,aAAa,CACtC,UADsC,EAEtC,kBAFsC,EAGtC,MAHsC,EAItCW,cAJsC,CAAvC;AAOA,QAAM,CAAEI,KAAF,EAASC,QAAT,IAAsBhB,aAAa,CACxC,UADwC,EAExC,kBAFwC,EAGxC,OAHwC,EAIxCW,cAJwC,CAAzC;AAOA,QAAM;AAAEM,IAAAA;AAAF,MAAkBX,SAAS,CAAIY,MAAF,IAAc;AAChD;AACA;;AACA;AACA,UAAMC,YAAY,GACjBD,MAAM,CAAE,aAAF,CAAN,CAAwBE,yCAAxB,EADD;AAEA;;;AACA,WAAO;AACNH,MAAAA,WAAW,EAAEE,YAAY,CAACE,GAAb,CAAkB;AAAA,YAAE;AAAEC,UAAAA,KAAF;AAAST,UAAAA,IAAI,EAAEU;AAAf,SAAF;AAAA,eAAgC;AAC9DD,UAAAA,KAD8D;AAE9DE,UAAAA,KAAK,EAAED;AAFuD,SAAhC;AAAA,OAAlB;AADP,KAAP;AAMA,GAbgC,EAa9B,EAb8B,CAAjC;AAeA,SACC,cAAC,iBAAD;AAAmB,IAAA,mBAAmB,EAAC;AAAvC,KACGb,iBAAiB,IAClB,8BACC,cAAC,WAAD;AAC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;AAAzB,KAfS,CAFX;AAmBC,IAAA,KAAK,EAAGhB,OAAO,IAAI,EAnBpB;AAoBC,IAAA,QAAQ,EAAKgB,KAAF,IAAaf,aAAa,CAAE;AAAED,MAAAA,OAAO,EAAEgB;AAAX,KAAF;AApBtC,IArBD,CADD;AA8CA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityProp } from '@wordpress/core-data';\nimport { SelectControl, TextControl } from '@wordpress/components';\nimport { sprintf, __ } from '@wordpress/i18n';\nimport { InspectorControls } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\n\nexport function TemplatePartAdvancedControls( {\n\ttagName,\n\tsetAttributes,\n\tisEntityAvailable,\n\ttemplatePartId,\n\tdefaultWrapper,\n} ) {\n\tconst [ area, setArea ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t'area',\n\t\ttemplatePartId\n\t);\n\n\tconst [ title, setTitle ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t'title',\n\t\ttemplatePartId\n\t);\n\n\tconst { areaOptions } = useSelect( ( select ) => {\n\t\t// FIXME: @wordpress/block-library should not depend on @wordpress/editor.\n\t\t// Blocks can be loaded into a *non-post* block editor.\n\t\t/* eslint-disable @wordpress/data-no-store-string-literals */\n\t\tconst definedAreas =\n\t\t\tselect( 'core/editor' ).__experimentalGetDefaultTemplatePartAreas();\n\t\t/* eslint-enable @wordpress/data-no-store-string-literals */\n\t\treturn {\n\t\t\tareaOptions: definedAreas.map( ( { label, area: _area } ) => ( {\n\t\t\t\tlabel,\n\t\t\t\tvalue: _area,\n\t\t\t} ) ),\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<InspectorControls __experimentalGroup=\"advanced\">\n\t\t\t{ isEntityAvailable && (\n\t\t\t\t<>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'Title' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tsetTitle( value );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonFocus={ ( event ) => event.target.select() }\n\t\t\t\t\t/>\n\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\tlabel={ __( 'Area' ) }\n\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\toptions={ areaOptions }\n\t\t\t\t\t\tvalue={ area }\n\t\t\t\t\t\tonChange={ setArea }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t<SelectControl\n\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\toptions={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: sprintf(\n\t\t\t\t\t\t\t/* translators: %s: HTML tag based on area. */\n\t\t\t\t\t\t\t__( 'Default based on area (%s)' ),\n\t\t\t\t\t\t\t`<${ defaultWrapper }>`\n\t\t\t\t\t\t),\n\t\t\t\t\t\tvalue: '',\n\t\t\t\t\t},\n\t\t\t\t\t{ label: '<header>', value: 'header' },\n\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t{ label: '<article>', value: 'article' },\n\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t{ label: '<footer>', value: 'footer' },\n\t\t\t\t\t{ label: '<div>', value: 'div' },\n\t\t\t\t] }\n\t\t\t\tvalue={ tagName || '' }\n\t\t\t\tonChange={ ( value ) => setAttributes( { tagName: value } ) }\n\t\t\t/>\n\t\t</InspectorControls>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/template-part/edit/advanced-controls.js"],"names":["useEntityProp","SelectControl","TextControl","sprintf","__","InspectorControls","useSelect","TemplatePartImportControls","TemplatePartAdvancedControls","tagName","setAttributes","isEntityAvailable","templatePartId","defaultWrapper","hasInnerBlocks","area","setArea","title","setTitle","areaOptions","select","definedAreas","__experimentalGetDefaultTemplatePartAreas","map","label","_area","value","event","target"],"mappings":";;AA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AFX;AAmBC,IAAA,KAAK,EAAGjB,OAAO,IAAI,EAnBpB;AAoBC,IAAA,QAAQ,EAAKiB,KAAF,IAAahB,aAAa,CAAE;AAAED,MAAAA,OAAO,EAAEiB;AAAX,KAAF;AApBtC,IArBD,EA2CG,CAAEZ,cAAF,IACD,cAAC,0BAAD;AACC,IAAA,IAAI,EAAGC,IADR;AAEC,IAAA,aAAa,EAAGL;AAFjB,IA5CF,CADD;AAoDA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityProp } from '@wordpress/core-data';\nimport { SelectControl, TextControl } from '@wordpress/components';\nimport { sprintf, __ } from '@wordpress/i18n';\nimport { InspectorControls } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { TemplatePartImportControls } from './import-controls';\n\nexport function TemplatePartAdvancedControls( {\n\ttagName,\n\tsetAttributes,\n\tisEntityAvailable,\n\ttemplatePartId,\n\tdefaultWrapper,\n\thasInnerBlocks,\n} ) {\n\tconst [ area, setArea ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t'area',\n\t\ttemplatePartId\n\t);\n\n\tconst [ title, setTitle ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t'title',\n\t\ttemplatePartId\n\t);\n\n\tconst { areaOptions } = useSelect( ( select ) => {\n\t\t// FIXME: @wordpress/block-library should not depend on @wordpress/editor.\n\t\t// Blocks can be loaded into a *non-post* block editor.\n\t\t/* eslint-disable @wordpress/data-no-store-string-literals */\n\t\tconst definedAreas =\n\t\t\tselect( 'core/editor' ).__experimentalGetDefaultTemplatePartAreas();\n\t\t/* eslint-enable @wordpress/data-no-store-string-literals */\n\t\treturn {\n\t\t\tareaOptions: definedAreas.map( ( { label, area: _area } ) => ( {\n\t\t\t\tlabel,\n\t\t\t\tvalue: _area,\n\t\t\t} ) ),\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<InspectorControls __experimentalGroup=\"advanced\">\n\t\t\t{ isEntityAvailable && (\n\t\t\t\t<>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'Title' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tsetTitle( value );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonFocus={ ( event ) => event.target.select() }\n\t\t\t\t\t/>\n\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\tlabel={ __( 'Area' ) }\n\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\toptions={ areaOptions }\n\t\t\t\t\t\tvalue={ area }\n\t\t\t\t\t\tonChange={ setArea }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t<SelectControl\n\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\toptions={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: sprintf(\n\t\t\t\t\t\t\t/* translators: %s: HTML tag based on area. */\n\t\t\t\t\t\t\t__( 'Default based on area (%s)' ),\n\t\t\t\t\t\t\t`<${ defaultWrapper }>`\n\t\t\t\t\t\t),\n\t\t\t\t\t\tvalue: '',\n\t\t\t\t\t},\n\t\t\t\t\t{ label: '<header>', value: 'header' },\n\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t{ label: '<article>', value: 'article' },\n\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t{ label: '<footer>', value: 'footer' },\n\t\t\t\t\t{ label: '<div>', value: 'div' },\n\t\t\t\t] }\n\t\t\t\tvalue={ tagName || '' }\n\t\t\t\tonChange={ ( value ) => setAttributes( { tagName: value } ) }\n\t\t\t/>\n\t\t\t{ ! hasInnerBlocks && (\n\t\t\t\t<TemplatePartImportControls\n\t\t\t\t\tarea={ area }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</InspectorControls>\n\t);\n}\n"]}
@@ -0,0 +1,146 @@
1
+ import { createElement } from "@wordpress/element";
2
+
3
+ /**
4
+ * WordPress dependencies
5
+ */
6
+ import { __, sprintf } from '@wordpress/i18n';
7
+ import { useMemo, useState } from '@wordpress/element';
8
+ import { useDispatch, useSelect, useRegistry } from '@wordpress/data';
9
+ import { Button, FlexBlock, FlexItem, SelectControl, __experimentalHStack as HStack, __experimentalSpacer as Spacer } from '@wordpress/components';
10
+ import { switchToBlockType, getPossibleBlockTransformations } from '@wordpress/blocks';
11
+ import { store as coreStore } from '@wordpress/core-data';
12
+ import { store as noticesStore } from '@wordpress/notices';
13
+ /**
14
+ * Internal dependencies
15
+ */
16
+
17
+ import { useCreateTemplatePartFromBlocks } from './utils/hooks';
18
+ import { transformWidgetToBlock } from './utils/transformers';
19
+ export function TemplatePartImportControls(_ref) {
20
+ let {
21
+ area,
22
+ setAttributes
23
+ } = _ref;
24
+ const [selectedSidebar, setSelectedSidebar] = useState('');
25
+ const [isBusy, setIsBusy] = useState(false);
26
+ const registry = useRegistry();
27
+ const sidebars = useSelect(select => {
28
+ return select(coreStore).getSidebars({
29
+ per_page: -1,
30
+ _fields: 'id,name,description,status,widgets'
31
+ });
32
+ }, []);
33
+ const {
34
+ createErrorNotice
35
+ } = useDispatch(noticesStore);
36
+ const createFromBlocks = useCreateTemplatePartFromBlocks(area, setAttributes);
37
+ const options = useMemo(() => {
38
+ const sidebarOptions = (sidebars !== null && sidebars !== void 0 ? sidebars : []).filter(widgetArea => widgetArea.id !== 'wp_inactive_widgets' && widgetArea.widgets.length > 0).map(widgetArea => {
39
+ return {
40
+ value: widgetArea.id,
41
+ label: widgetArea.name
42
+ };
43
+ });
44
+
45
+ if (!sidebarOptions.length) {
46
+ return [];
47
+ }
48
+
49
+ return [{
50
+ value: '',
51
+ label: __('Select widget area')
52
+ }, ...sidebarOptions];
53
+ }, [sidebars]);
54
+
55
+ async function createFromWidgets(event) {
56
+ event.preventDefault();
57
+
58
+ if (isBusy || !selectedSidebar) {
59
+ return;
60
+ }
61
+
62
+ setIsBusy(true);
63
+ const sidebar = options.find(_ref2 => {
64
+ let {
65
+ value
66
+ } = _ref2;
67
+ return value === selectedSidebar;
68
+ });
69
+ const {
70
+ getWidgets
71
+ } = registry.resolveSelect(coreStore); // The widgets API always returns a successful response.
72
+
73
+ const widgets = await getWidgets({
74
+ sidebar: sidebar.value,
75
+ _embed: 'about'
76
+ });
77
+ const skippedWidgets = new Set();
78
+ const blocks = widgets.flatMap(widget => {
79
+ const block = transformWidgetToBlock(widget);
80
+
81
+ if (block.name !== 'core/legacy-widget') {
82
+ return block;
83
+ }
84
+
85
+ const transforms = getPossibleBlockTransformations([block]).filter(item => {
86
+ var _item$transforms, _item$transforms$from, _item$transforms2, _item$transforms2$to;
87
+
88
+ // The block without any transformations can't be a wildcard.
89
+ if (!item.transforms) {
90
+ return true;
91
+ }
92
+
93
+ const hasWildCardFrom = (_item$transforms = item.transforms) === null || _item$transforms === void 0 ? void 0 : (_item$transforms$from = _item$transforms.from) === null || _item$transforms$from === void 0 ? void 0 : _item$transforms$from.find(from => from.blocks && from.blocks.includes('*'));
94
+ const hasWildCardTo = (_item$transforms2 = item.transforms) === null || _item$transforms2 === void 0 ? void 0 : (_item$transforms2$to = _item$transforms2.to) === null || _item$transforms2$to === void 0 ? void 0 : _item$transforms2$to.find(to => to.blocks && to.blocks.includes('*'));
95
+ return !hasWildCardFrom && !hasWildCardTo;
96
+ }); // Skip the block if we have no matching transformations.
97
+
98
+ if (!transforms.length) {
99
+ skippedWidgets.add(widget.id_base);
100
+ return [];
101
+ } // Try transforming the Legacy Widget into a first matching block.
102
+
103
+
104
+ return switchToBlockType(block, transforms[0].name);
105
+ });
106
+ await createFromBlocks(blocks,
107
+ /* translators: %s: name of the widget area */
108
+ sprintf(__('Widget area: %s'), sidebar.label));
109
+
110
+ if (skippedWidgets.size) {
111
+ createErrorNotice(sprintf(
112
+ /* translators: %s: the list of widgets */
113
+ __('Unable to import the following widgets: %s.'), Array.from(skippedWidgets).join(', ')), {
114
+ type: 'snackbar'
115
+ });
116
+ }
117
+
118
+ setIsBusy(false);
119
+ }
120
+
121
+ return createElement(Spacer, {
122
+ marginBottom: "4"
123
+ }, createElement(HStack, {
124
+ as: "form",
125
+ onSubmit: createFromWidgets
126
+ }, createElement(FlexBlock, null, createElement(SelectControl, {
127
+ label: __('Import widget area'),
128
+ value: selectedSidebar,
129
+ options: options,
130
+ onChange: value => setSelectedSidebar(value),
131
+ disabled: !options.length,
132
+ __next36pxDefaultSize: true,
133
+ __nextHasNoMarginBottom: true
134
+ })), createElement(FlexItem, {
135
+ style: {
136
+ marginBottom: '8px',
137
+ marginTop: 'auto'
138
+ }
139
+ }, createElement(Button, {
140
+ variant: "primary",
141
+ type: "submit",
142
+ isBusy: isBusy,
143
+ "aria-disabled": isBusy || !selectedSidebar
144
+ }, __('Import')))));
145
+ }
146
+ //# sourceMappingURL=import-controls.js.map