@wordpress/block-library 7.1.0 → 7.3.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 (634) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +1 -1
  3. package/build/archives/edit.js +21 -1
  4. package/build/archives/edit.js.map +1 -1
  5. package/build/archives/index.js +5 -1
  6. package/build/archives/index.js.map +1 -1
  7. package/build/audio/edit.native.js +0 -5
  8. package/build/audio/edit.native.js.map +1 -1
  9. package/build/avatar/edit.js +211 -0
  10. package/build/avatar/edit.js.map +1 -0
  11. package/build/avatar/hooks.js +111 -0
  12. package/build/avatar/hooks.js.map +1 -0
  13. package/build/avatar/index.js +83 -0
  14. package/build/avatar/index.js.map +1 -0
  15. package/build/avatar/user-control.js +63 -0
  16. package/build/avatar/user-control.js.map +1 -0
  17. package/build/block/edit.js +2 -1
  18. package/build/block/edit.js.map +1 -1
  19. package/build/column/index.js +3 -1
  20. package/build/column/index.js.map +1 -1
  21. package/build/comment-author-avatar/index.js +4 -3
  22. package/build/comment-author-avatar/index.js.map +1 -1
  23. package/build/comment-author-name/index.js +7 -3
  24. package/build/comment-author-name/index.js.map +1 -1
  25. package/build/comment-content/index.js +1 -1
  26. package/build/comment-date/edit.js +10 -25
  27. package/build/comment-date/edit.js.map +1 -1
  28. package/build/comment-date/index.js +7 -3
  29. package/build/comment-date/index.js.map +1 -1
  30. package/build/comment-edit-link/index.js +5 -1
  31. package/build/comment-edit-link/index.js.map +1 -1
  32. package/build/comment-reply-link/index.js +5 -1
  33. package/build/comment-reply-link/index.js.map +1 -1
  34. package/build/comment-template/edit.js +86 -66
  35. package/build/comment-template/edit.js.map +1 -1
  36. package/build/comment-template/hooks.js +7 -23
  37. package/build/comment-template/hooks.js.map +1 -1
  38. package/build/comment-template/index.js +2 -2
  39. package/build/comments-pagination-next/index.js +2 -2
  40. package/build/comments-pagination-numbers/index.js +1 -1
  41. package/build/comments-pagination-previous/index.js +1 -1
  42. package/build/comments-query-loop/edit/comments-inspector-controls.js +2 -69
  43. package/build/comments-query-loop/edit/comments-inspector-controls.js.map +1 -1
  44. package/build/comments-query-loop/edit.js +22 -1
  45. package/build/comments-query-loop/edit.js.map +1 -1
  46. package/build/comments-query-loop/index.js +1 -23
  47. package/build/comments-query-loop/index.js.map +1 -1
  48. package/build/cover/edit.js +58 -39
  49. package/build/cover/edit.js.map +1 -1
  50. package/build/cover/index.js +5 -0
  51. package/build/cover/index.js.map +1 -1
  52. package/build/cover/save.js +3 -2
  53. package/build/cover/save.js.map +1 -1
  54. package/build/embed/variations.js +2 -2
  55. package/build/embed/variations.js.map +1 -1
  56. package/build/gallery/edit.js +18 -5
  57. package/build/gallery/edit.js.map +1 -1
  58. package/build/gallery/gallery.js +1 -1
  59. package/build/gallery/gallery.js.map +1 -1
  60. package/build/gallery/gap-styles.js +35 -0
  61. package/build/gallery/gap-styles.js.map +1 -0
  62. package/build/gallery/index.js +18 -1
  63. package/build/gallery/index.js.map +1 -1
  64. package/build/group/edit.js +3 -1
  65. package/build/group/edit.js.map +1 -1
  66. package/build/group/index.js +1 -1
  67. package/build/group/variations.js +30 -9
  68. package/build/group/variations.js.map +1 -1
  69. package/build/heading/edit.js +1 -1
  70. package/build/heading/edit.js.map +1 -1
  71. package/build/html/edit.js +3 -2
  72. package/build/html/edit.js.map +1 -1
  73. package/build/image/edit.native.js +8 -10
  74. package/build/image/edit.native.js.map +1 -1
  75. package/build/image/image.js +3 -1
  76. package/build/image/image.js.map +1 -1
  77. package/build/index.js +10 -4
  78. package/build/index.js.map +1 -1
  79. package/build/list/deprecated.js +2 -2
  80. package/build/list/deprecated.js.map +1 -1
  81. package/build/list/index.js +5 -7
  82. package/build/list/index.js.map +1 -1
  83. package/build/list/v2/deprecated.js +117 -0
  84. package/build/list/v2/deprecated.js.map +1 -0
  85. package/build/list/v2/edit.js +188 -0
  86. package/build/list/v2/edit.js.map +1 -0
  87. package/build/list/v2/index.js +36 -0
  88. package/build/list/v2/index.js.map +1 -0
  89. package/build/list/v2/migrate.js +85 -0
  90. package/build/list/v2/migrate.js.map +1 -0
  91. package/build/list/v2/save.js +34 -0
  92. package/build/list/v2/save.js.map +1 -0
  93. package/build/list/v2/transforms.js +121 -0
  94. package/build/list/v2/transforms.js.map +1 -0
  95. package/build/list-item/edit.js +96 -0
  96. package/build/list-item/edit.js.map +1 -0
  97. package/build/list-item/hooks/index.js +32 -0
  98. package/build/list-item/hooks/index.js.map +1 -0
  99. package/build/list-item/hooks/use-enter.js +93 -0
  100. package/build/list-item/hooks/use-enter.js.map +1 -0
  101. package/build/list-item/hooks/use-indent-list-item.js +74 -0
  102. package/build/list-item/hooks/use-indent-list-item.js.map +1 -0
  103. package/build/list-item/hooks/use-outdent-list-item.js +77 -0
  104. package/build/list-item/hooks/use-outdent-list-item.js.map +1 -0
  105. package/build/list-item/index.js +67 -0
  106. package/build/list-item/index.js.map +1 -0
  107. package/build/list-item/save.js +23 -0
  108. package/build/list-item/save.js.map +1 -0
  109. package/build/list-item/utils.js +16 -0
  110. package/build/list-item/utils.js.map +1 -0
  111. package/build/media-text/edit.js +3 -1
  112. package/build/media-text/edit.js.map +1 -1
  113. package/build/media-text/media-container.native.js +1 -16
  114. package/build/media-text/media-container.native.js.map +1 -1
  115. package/build/navigation/edit/index.js +36 -17
  116. package/build/navigation/edit/index.js.map +1 -1
  117. package/build/navigation/edit/navigation-menu-delete-control.js +1 -1
  118. package/build/navigation/edit/navigation-menu-delete-control.js.map +1 -1
  119. package/build/navigation/edit/unsaved-inner-blocks.js +34 -7
  120. package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  121. package/build/navigation/index.js +9 -1
  122. package/build/navigation/index.js.map +1 -1
  123. package/build/navigation/use-navigation-entities.js +26 -54
  124. package/build/navigation/use-navigation-entities.js.map +1 -1
  125. package/build/navigation/use-navigation-menu.js +1 -0
  126. package/build/navigation/use-navigation-menu.js.map +1 -1
  127. package/build/navigation-link/edit.js +95 -37
  128. package/build/navigation-link/edit.js.map +1 -1
  129. package/build/navigation-link/index.js +1 -1
  130. package/build/navigation-submenu/edit.js +5 -9
  131. package/build/navigation-submenu/edit.js.map +1 -1
  132. package/build/navigation-submenu/index.js +1 -1
  133. package/build/post-comment/edit.js +2 -2
  134. package/build/post-comment/edit.js.map +1 -1
  135. package/build/post-comments-form/edit.js +3 -2
  136. package/build/post-comments-form/edit.js.map +1 -1
  137. package/build/post-date/edit.js +31 -37
  138. package/build/post-date/edit.js.map +1 -1
  139. package/build/post-featured-image/edit.js +2 -1
  140. package/build/post-featured-image/edit.js.map +1 -1
  141. package/build/post-featured-image/index.js +1 -1
  142. package/build/post-template/edit.js +7 -2
  143. package/build/post-template/edit.js.map +1 -1
  144. package/build/post-terms/edit.js +3 -1
  145. package/build/post-terms/edit.js.map +1 -1
  146. package/build/post-terms/variations.js +1 -1
  147. package/build/post-terms/variations.js.map +1 -1
  148. package/build/pullquote/edit.js +5 -3
  149. package/build/pullquote/edit.js.map +1 -1
  150. package/build/query/variations.js +4 -4
  151. package/build/query/variations.js.map +1 -1
  152. package/build/query-no-results/edit.js +28 -0
  153. package/build/query-no-results/edit.js.map +1 -0
  154. package/build/query-no-results/index.js +54 -0
  155. package/build/query-no-results/index.js.map +1 -0
  156. package/build/query-no-results/save.js +18 -0
  157. package/build/query-no-results/save.js.map +1 -0
  158. package/build/query-pagination/edit.js +1 -1
  159. package/build/query-pagination/edit.js.map +1 -1
  160. package/build/query-pagination-numbers/index.js +19 -1
  161. package/build/query-pagination-numbers/index.js.map +1 -1
  162. package/build/quote/index.js +15 -8
  163. package/build/quote/index.js.map +1 -1
  164. package/build/quote/v2/deprecated.js +133 -0
  165. package/build/quote/v2/deprecated.js.map +1 -0
  166. package/build/quote/v2/edit.js +131 -0
  167. package/build/quote/v2/edit.js.map +1 -0
  168. package/build/quote/v2/index.js +49 -0
  169. package/build/quote/v2/index.js.map +1 -0
  170. package/build/quote/v2/save.js +43 -0
  171. package/build/quote/v2/save.js.map +1 -0
  172. package/build/quote/v2/transforms.js +156 -0
  173. package/build/quote/v2/transforms.js.map +1 -0
  174. package/build/read-more/index.js +1 -1
  175. package/build/rss/edit.js +6 -1
  176. package/build/rss/edit.js.map +1 -1
  177. package/build/search/edit.js +2 -3
  178. package/build/search/edit.js.map +1 -1
  179. package/build/separator/deprecated.js +83 -0
  180. package/build/separator/deprecated.js.map +1 -0
  181. package/build/separator/edit.js +31 -23
  182. package/build/separator/edit.js.map +1 -1
  183. package/build/separator/index.js +17 -7
  184. package/build/separator/index.js.map +1 -1
  185. package/build/separator/save.js +18 -13
  186. package/build/separator/save.js.map +1 -1
  187. package/build/separator/use-deprecated-opacity.js +39 -0
  188. package/build/separator/use-deprecated-opacity.js.map +1 -0
  189. package/build/site-logo/edit.js +3 -2
  190. package/build/site-logo/edit.js.map +1 -1
  191. package/build/site-logo/index.js +1 -1
  192. package/build/social-links/edit.js +14 -3
  193. package/build/social-links/edit.js.map +1 -1
  194. package/build/social-links/index.js +2 -1
  195. package/build/social-links/index.js.map +1 -1
  196. package/build/spacer/controls.js +6 -16
  197. package/build/spacer/controls.js.map +1 -1
  198. package/build/spacer/controls.native.js +3 -1
  199. package/build/spacer/controls.native.js.map +1 -1
  200. package/build/spacer/edit.js +4 -5
  201. package/build/spacer/edit.js.map +1 -1
  202. package/build/table/deprecated.js +1 -1
  203. package/build/table/deprecated.js.map +1 -1
  204. package/build/tag-cloud/edit.js +58 -2
  205. package/build/tag-cloud/edit.js.map +1 -1
  206. package/build/tag-cloud/index.js +8 -0
  207. package/build/tag-cloud/index.js.map +1 -1
  208. package/build/template-part/edit/utils/hooks.js +5 -2
  209. package/build/template-part/edit/utils/hooks.js.map +1 -1
  210. package/build-module/archives/edit.js +22 -2
  211. package/build-module/archives/edit.js.map +1 -1
  212. package/build-module/archives/index.js +5 -1
  213. package/build-module/archives/index.js.map +1 -1
  214. package/build-module/audio/edit.native.js +0 -5
  215. package/build-module/audio/edit.native.js.map +1 -1
  216. package/build-module/avatar/edit.js +195 -0
  217. package/build-module/avatar/edit.js.map +1 -0
  218. package/build-module/avatar/hooks.js +99 -0
  219. package/build-module/avatar/hooks.js.map +1 -0
  220. package/build-module/avatar/index.js +70 -0
  221. package/build-module/avatar/index.js.map +1 -0
  222. package/build-module/avatar/user-control.js +52 -0
  223. package/build-module/avatar/user-control.js.map +1 -0
  224. package/build-module/block/edit.js +4 -3
  225. package/build-module/block/edit.js.map +1 -1
  226. package/build-module/column/index.js +3 -1
  227. package/build-module/column/index.js.map +1 -1
  228. package/build-module/comment-author-avatar/index.js +4 -3
  229. package/build-module/comment-author-avatar/index.js.map +1 -1
  230. package/build-module/comment-author-name/index.js +7 -3
  231. package/build-module/comment-author-name/index.js.map +1 -1
  232. package/build-module/comment-content/index.js +1 -1
  233. package/build-module/comment-date/edit.js +13 -30
  234. package/build-module/comment-date/edit.js.map +1 -1
  235. package/build-module/comment-date/index.js +7 -3
  236. package/build-module/comment-date/index.js.map +1 -1
  237. package/build-module/comment-edit-link/index.js +5 -1
  238. package/build-module/comment-edit-link/index.js.map +1 -1
  239. package/build-module/comment-reply-link/index.js +5 -1
  240. package/build-module/comment-reply-link/index.js.map +1 -1
  241. package/build-module/comment-template/edit.js +86 -66
  242. package/build-module/comment-template/edit.js.map +1 -1
  243. package/build-module/comment-template/hooks.js +7 -23
  244. package/build-module/comment-template/hooks.js.map +1 -1
  245. package/build-module/comment-template/index.js +2 -2
  246. package/build-module/comments-pagination-next/index.js +2 -2
  247. package/build-module/comments-pagination-numbers/index.js +1 -1
  248. package/build-module/comments-pagination-previous/index.js +1 -1
  249. package/build-module/comments-query-loop/edit/comments-inspector-controls.js +4 -70
  250. package/build-module/comments-query-loop/edit/comments-inspector-controls.js.map +1 -1
  251. package/build-module/comments-query-loop/edit.js +22 -1
  252. package/build-module/comments-query-loop/edit.js.map +1 -1
  253. package/build-module/comments-query-loop/index.js +1 -23
  254. package/build-module/comments-query-loop/index.js.map +1 -1
  255. package/build-module/cover/edit.js +58 -41
  256. package/build-module/cover/edit.js.map +1 -1
  257. package/build-module/cover/index.js +5 -0
  258. package/build-module/cover/index.js.map +1 -1
  259. package/build-module/cover/save.js +3 -2
  260. package/build-module/cover/save.js.map +1 -1
  261. package/build-module/embed/variations.js +2 -2
  262. package/build-module/embed/variations.js.map +1 -1
  263. package/build-module/gallery/edit.js +17 -5
  264. package/build-module/gallery/edit.js.map +1 -1
  265. package/build-module/gallery/gallery.js +1 -1
  266. package/build-module/gallery/gallery.js.map +1 -1
  267. package/build-module/gallery/gap-styles.js +28 -0
  268. package/build-module/gallery/gap-styles.js.map +1 -0
  269. package/build-module/gallery/index.js +18 -1
  270. package/build-module/gallery/index.js.map +1 -1
  271. package/build-module/group/edit.js +3 -1
  272. package/build-module/group/edit.js.map +1 -1
  273. package/build-module/group/index.js +1 -1
  274. package/build-module/group/variations.js +29 -9
  275. package/build-module/group/variations.js.map +1 -1
  276. package/build-module/heading/edit.js +1 -1
  277. package/build-module/heading/edit.js.map +1 -1
  278. package/build-module/html/edit.js +4 -3
  279. package/build-module/html/edit.js.map +1 -1
  280. package/build-module/image/edit.native.js +8 -10
  281. package/build-module/image/edit.native.js.map +1 -1
  282. package/build-module/image/image.js +3 -1
  283. package/build-module/image/image.js.map +1 -1
  284. package/build-module/index.js +7 -4
  285. package/build-module/index.js.map +1 -1
  286. package/build-module/list/deprecated.js +2 -2
  287. package/build-module/list/deprecated.js.map +1 -1
  288. package/build-module/list/index.js +5 -1
  289. package/build-module/list/index.js.map +1 -1
  290. package/build-module/list/v2/deprecated.js +104 -0
  291. package/build-module/list/v2/deprecated.js.map +1 -0
  292. package/build-module/list/v2/edit.js +168 -0
  293. package/build-module/list/v2/edit.js.map +1 -0
  294. package/build-module/list/v2/index.js +21 -0
  295. package/build-module/list/v2/index.js.map +1 -0
  296. package/build-module/list/v2/migrate.js +77 -0
  297. package/build-module/list/v2/migrate.js.map +1 -0
  298. package/build-module/list/v2/save.js +23 -0
  299. package/build-module/list/v2/save.js.map +1 -0
  300. package/build-module/list/v2/transforms.js +111 -0
  301. package/build-module/list/v2/transforms.js.map +1 -0
  302. package/build-module/list-item/edit.js +83 -0
  303. package/build-module/list-item/edit.js.map +1 -0
  304. package/build-module/list-item/hooks/index.js +4 -0
  305. package/build-module/list-item/hooks/index.js.map +1 -0
  306. package/build-module/list-item/hooks/use-enter.js +77 -0
  307. package/build-module/list-item/hooks/use-enter.js.map +1 -0
  308. package/build-module/list-item/hooks/use-indent-list-item.js +62 -0
  309. package/build-module/list-item/hooks/use-indent-list-item.js.map +1 -0
  310. package/build-module/list-item/hooks/use-outdent-list-item.js +66 -0
  311. package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -0
  312. package/build-module/list-item/index.js +53 -0
  313. package/build-module/list-item/index.js.map +1 -0
  314. package/build-module/list-item/save.js +15 -0
  315. package/build-module/list-item/save.js.map +1 -0
  316. package/build-module/list-item/utils.js +8 -0
  317. package/build-module/list-item/utils.js.map +1 -0
  318. package/build-module/media-text/edit.js +3 -1
  319. package/build-module/media-text/edit.js.map +1 -1
  320. package/build-module/media-text/media-container.native.js +1 -14
  321. package/build-module/media-text/media-container.native.js.map +1 -1
  322. package/build-module/navigation/edit/index.js +37 -17
  323. package/build-module/navigation/edit/index.js.map +1 -1
  324. package/build-module/navigation/edit/navigation-menu-delete-control.js +1 -1
  325. package/build-module/navigation/edit/navigation-menu-delete-control.js.map +1 -1
  326. package/build-module/navigation/edit/unsaved-inner-blocks.js +35 -8
  327. package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  328. package/build-module/navigation/index.js +9 -1
  329. package/build-module/navigation/index.js.map +1 -1
  330. package/build-module/navigation/use-navigation-entities.js +27 -54
  331. package/build-module/navigation/use-navigation-entities.js.map +1 -1
  332. package/build-module/navigation/use-navigation-menu.js +1 -0
  333. package/build-module/navigation/use-navigation-menu.js.map +1 -1
  334. package/build-module/navigation-link/edit.js +95 -36
  335. package/build-module/navigation-link/edit.js.map +1 -1
  336. package/build-module/navigation-link/index.js +1 -1
  337. package/build-module/navigation-submenu/edit.js +6 -10
  338. package/build-module/navigation-submenu/edit.js.map +1 -1
  339. package/build-module/navigation-submenu/index.js +1 -1
  340. package/build-module/post-comment/edit.js +2 -2
  341. package/build-module/post-comment/edit.js.map +1 -1
  342. package/build-module/post-comments-form/edit.js +3 -2
  343. package/build-module/post-comments-form/edit.js.map +1 -1
  344. package/build-module/post-date/edit.js +32 -43
  345. package/build-module/post-date/edit.js.map +1 -1
  346. package/build-module/post-featured-image/edit.js +2 -1
  347. package/build-module/post-featured-image/edit.js.map +1 -1
  348. package/build-module/post-featured-image/index.js +1 -1
  349. package/build-module/post-template/edit.js +7 -2
  350. package/build-module/post-template/edit.js.map +1 -1
  351. package/build-module/post-terms/edit.js +4 -2
  352. package/build-module/post-terms/edit.js.map +1 -1
  353. package/build-module/post-terms/variations.js +3 -3
  354. package/build-module/post-terms/variations.js.map +1 -1
  355. package/build-module/pullquote/edit.js +6 -3
  356. package/build-module/pullquote/edit.js.map +1 -1
  357. package/build-module/query/variations.js +4 -4
  358. package/build-module/query/variations.js.map +1 -1
  359. package/build-module/query-no-results/edit.js +18 -0
  360. package/build-module/query-no-results/edit.js.map +1 -0
  361. package/build-module/query-no-results/index.js +40 -0
  362. package/build-module/query-no-results/index.js.map +1 -0
  363. package/build-module/query-no-results/save.js +10 -0
  364. package/build-module/query-no-results/save.js.map +1 -0
  365. package/build-module/query-pagination/edit.js +1 -1
  366. package/build-module/query-pagination/edit.js.map +1 -1
  367. package/build-module/query-pagination-numbers/index.js +19 -1
  368. package/build-module/query-pagination-numbers/index.js.map +1 -1
  369. package/build-module/quote/index.js +13 -1
  370. package/build-module/quote/index.js.map +1 -1
  371. package/build-module/quote/v2/deprecated.js +116 -0
  372. package/build-module/quote/v2/deprecated.js.map +1 -0
  373. package/build-module/quote/v2/edit.js +115 -0
  374. package/build-module/quote/v2/edit.js.map +1 -0
  375. package/build-module/quote/v2/index.js +33 -0
  376. package/build-module/quote/v2/index.js.map +1 -0
  377. package/build-module/quote/v2/save.js +30 -0
  378. package/build-module/quote/v2/save.js.map +1 -0
  379. package/build-module/quote/v2/transforms.js +147 -0
  380. package/build-module/quote/v2/transforms.js.map +1 -0
  381. package/build-module/read-more/index.js +1 -1
  382. package/build-module/rss/edit.js +5 -1
  383. package/build-module/rss/edit.js.map +1 -1
  384. package/build-module/search/edit.js +2 -3
  385. package/build-module/search/edit.js.map +1 -1
  386. package/build-module/separator/deprecated.js +70 -0
  387. package/build-module/separator/deprecated.js.map +1 -0
  388. package/build-module/separator/edit.js +31 -22
  389. package/build-module/separator/edit.js.map +1 -1
  390. package/build-module/separator/index.js +16 -7
  391. package/build-module/separator/index.js.map +1 -1
  392. package/build-module/separator/save.js +19 -14
  393. package/build-module/separator/save.js.map +1 -1
  394. package/build-module/separator/use-deprecated-opacity.js +30 -0
  395. package/build-module/separator/use-deprecated-opacity.js.map +1 -0
  396. package/build-module/site-logo/edit.js +3 -2
  397. package/build-module/site-logo/edit.js.map +1 -1
  398. package/build-module/site-logo/index.js +1 -1
  399. package/build-module/social-links/edit.js +15 -4
  400. package/build-module/social-links/edit.js.map +1 -1
  401. package/build-module/social-links/index.js +2 -1
  402. package/build-module/social-links/index.js.map +1 -1
  403. package/build-module/spacer/controls.js +8 -19
  404. package/build-module/spacer/controls.js.map +1 -1
  405. package/build-module/spacer/controls.native.js +2 -1
  406. package/build-module/spacer/controls.native.js.map +1 -1
  407. package/build-module/spacer/edit.js +3 -3
  408. package/build-module/spacer/edit.js.map +1 -1
  409. package/build-module/table/deprecated.js +1 -1
  410. package/build-module/table/deprecated.js.map +1 -1
  411. package/build-module/tag-cloud/edit.js +60 -4
  412. package/build-module/tag-cloud/edit.js.map +1 -1
  413. package/build-module/tag-cloud/index.js +8 -0
  414. package/build-module/tag-cloud/index.js.map +1 -1
  415. package/build-module/template-part/edit/utils/hooks.js +5 -2
  416. package/build-module/template-part/edit/utils/hooks.js.map +1 -1
  417. package/build-style/avatar/editor-rtl.css +83 -0
  418. package/build-style/avatar/editor.css +83 -0
  419. package/build-style/avatar/style-rtl.css +79 -0
  420. package/build-style/avatar/style.css +79 -0
  421. package/build-style/editor-rtl.css +53 -11
  422. package/build-style/editor.css +53 -11
  423. package/build-style/gallery/editor-rtl.css +0 -1
  424. package/build-style/gallery/editor.css +0 -1
  425. package/build-style/gallery/style-rtl.css +102 -169
  426. package/build-style/gallery/style.css +102 -169
  427. package/build-style/group/editor-rtl.css +26 -0
  428. package/build-style/group/editor.css +26 -0
  429. package/build-style/heading/style-rtl.css +0 -8
  430. package/build-style/heading/style.css +0 -8
  431. package/build-style/image/style-rtl.css +2 -0
  432. package/build-style/image/style.css +2 -0
  433. package/build-style/list/style-rtl.css +1 -1
  434. package/build-style/list/style.css +1 -1
  435. package/build-style/navigation/style-rtl.css +11 -9
  436. package/build-style/navigation/style.css +11 -9
  437. package/build-style/navigation-link/editor-rtl.css +13 -0
  438. package/build-style/navigation-link/editor.css +13 -0
  439. package/build-style/navigation-link/style-rtl.css +3 -0
  440. package/build-style/navigation-link/style.css +3 -0
  441. package/build-style/paragraph/style-rtl.css +0 -4
  442. package/build-style/paragraph/style.css +0 -4
  443. package/build-style/pullquote/style-rtl.css +0 -4
  444. package/build-style/pullquote/style.css +0 -4
  445. package/build-style/quote/style-rtl.css +1 -0
  446. package/build-style/quote/style.css +1 -0
  447. package/build-style/reset-rtl.css +1 -1
  448. package/build-style/reset.css +1 -1
  449. package/build-style/separator/editor-rtl.css +3 -0
  450. package/build-style/separator/editor.css +3 -0
  451. package/build-style/separator/theme-rtl.css +7 -1
  452. package/build-style/separator/theme.css +7 -1
  453. package/build-style/site-logo/editor-rtl.css +3 -1
  454. package/build-style/site-logo/editor.css +3 -1
  455. package/build-style/style-rtl.css +124 -195
  456. package/build-style/style.css +124 -195
  457. package/build-style/template-part/editor-rtl.css +0 -9
  458. package/build-style/template-part/editor.css +0 -9
  459. package/build-style/theme-rtl.css +7 -1
  460. package/build-style/theme.css +7 -1
  461. package/package.json +28 -28
  462. package/src/archives/block.json +5 -1
  463. package/src/archives/edit.js +20 -2
  464. package/src/archives/index.php +4 -4
  465. package/src/audio/edit.native.js +0 -5
  466. package/src/avatar/block.json +53 -0
  467. package/src/avatar/edit.js +230 -0
  468. package/src/avatar/editor.scss +9 -0
  469. package/src/avatar/hooks.js +96 -0
  470. package/src/avatar/index.js +18 -0
  471. package/src/avatar/index.php +146 -0
  472. package/src/avatar/style.scss +5 -0
  473. package/src/avatar/user-control.js +56 -0
  474. package/src/block/edit.js +21 -11
  475. package/src/column/block.json +3 -1
  476. package/src/comment-author-avatar/block.json +4 -3
  477. package/src/comment-author-name/block.json +7 -3
  478. package/src/comment-author-name/index.php +3 -0
  479. package/src/comment-content/block.json +1 -1
  480. package/src/comment-date/block.json +7 -3
  481. package/src/comment-date/edit.js +20 -30
  482. package/src/comment-date/index.php +6 -1
  483. package/src/comment-edit-link/block.json +5 -1
  484. package/src/comment-edit-link/index.php +3 -0
  485. package/src/comment-reply-link/block.json +5 -1
  486. package/src/comment-reply-link/index.php +4 -1
  487. package/src/comment-template/block.json +2 -8
  488. package/src/comment-template/edit.js +77 -64
  489. package/src/comment-template/hooks.js +8 -24
  490. package/src/comment-template/index.php +1 -3
  491. package/src/comments-pagination-next/block.json +2 -9
  492. package/src/comments-pagination-numbers/block.json +2 -8
  493. package/src/comments-pagination-previous/block.json +2 -2
  494. package/src/comments-query-loop/block.json +1 -23
  495. package/src/comments-query-loop/edit/comments-inspector-controls.js +2 -83
  496. package/src/comments-query-loop/edit.js +54 -1
  497. package/src/cover/block.json +5 -0
  498. package/src/cover/edit.js +103 -60
  499. package/src/cover/index.php +85 -0
  500. package/src/cover/save.js +18 -14
  501. package/src/editor.scss +1 -0
  502. package/src/embed/variations.js +2 -2
  503. package/src/gallery/block.json +18 -1
  504. package/src/gallery/deprecated.scss +2 -2
  505. package/src/gallery/edit.js +15 -8
  506. package/src/gallery/editor.scss +0 -1
  507. package/src/gallery/gallery.js +8 -7
  508. package/src/gallery/gap-styles.js +26 -0
  509. package/src/gallery/index.php +43 -1
  510. package/src/gallery/style.scss +11 -44
  511. package/src/group/block.json +1 -1
  512. package/src/group/edit.js +4 -1
  513. package/src/group/editor.scss +31 -0
  514. package/src/group/variations.js +21 -4
  515. package/src/heading/edit.js +1 -1
  516. package/src/heading/style.scss +0 -3
  517. package/src/html/edit.js +22 -30
  518. package/src/image/edit.native.js +7 -11
  519. package/src/image/image.js +4 -1
  520. package/src/image/style.scss +3 -0
  521. package/src/index.js +19 -14
  522. package/src/list/deprecated.js +2 -2
  523. package/src/list/index.js +6 -1
  524. package/src/list/style.scss +1 -2
  525. package/src/list/test/migrate.js +159 -0
  526. package/src/list/v2/deprecated.js +89 -0
  527. package/src/list/v2/edit.js +186 -0
  528. package/src/list/v2/index.js +22 -0
  529. package/src/list/v2/migrate.js +87 -0
  530. package/src/list/v2/save.js +18 -0
  531. package/src/list/v2/transforms.js +116 -0
  532. package/src/list-item/block.json +26 -0
  533. package/src/list-item/edit.js +93 -0
  534. package/src/list-item/hooks/index.js +3 -0
  535. package/src/list-item/hooks/use-enter.js +94 -0
  536. package/src/list-item/hooks/use-indent-list-item.js +89 -0
  537. package/src/list-item/hooks/use-outdent-list-item.js +95 -0
  538. package/src/list-item/index.js +27 -0
  539. package/src/list-item/save.js +13 -0
  540. package/src/list-item/utils.js +14 -0
  541. package/src/media-text/edit.js +1 -1
  542. package/src/media-text/media-container.native.js +1 -14
  543. package/src/navigation/block.json +9 -1
  544. package/src/navigation/edit/index.js +50 -14
  545. package/src/navigation/edit/navigation-menu-delete-control.js +1 -1
  546. package/src/navigation/edit/unsaved-inner-blocks.js +57 -8
  547. package/src/navigation/index.php +28 -3
  548. package/src/navigation/style.scss +15 -13
  549. package/src/navigation/use-navigation-entities.js +37 -73
  550. package/src/navigation/use-navigation-menu.js +4 -0
  551. package/src/navigation-link/block.json +1 -0
  552. package/src/navigation-link/edit.js +156 -64
  553. package/src/navigation-link/editor.scss +11 -0
  554. package/src/navigation-link/index.php +8 -0
  555. package/src/navigation-link/style.scss +6 -0
  556. package/src/navigation-submenu/block.json +1 -0
  557. package/src/navigation-submenu/edit.js +7 -9
  558. package/src/paragraph/style.scss +0 -5
  559. package/src/post-author/index.php +0 -1
  560. package/src/post-comment/edit.js +2 -2
  561. package/src/post-comments-form/edit.js +6 -3
  562. package/src/post-date/edit.js +63 -52
  563. package/src/post-date/index.php +1 -1
  564. package/src/post-date/test/edit.js +17 -0
  565. package/src/post-featured-image/block.json +1 -1
  566. package/src/post-featured-image/edit.js +9 -1
  567. package/src/post-featured-image/index.php +2 -1
  568. package/src/post-template/edit.js +7 -1
  569. package/src/post-terms/edit.js +4 -1
  570. package/src/post-terms/variations.js +3 -3
  571. package/src/pullquote/edit.js +4 -3
  572. package/src/pullquote/style.scss +0 -5
  573. package/src/query/variations.js +4 -0
  574. package/src/query-no-results/block.json +20 -0
  575. package/src/query-no-results/edit.js +28 -0
  576. package/src/query-no-results/index.js +20 -0
  577. package/src/query-no-results/index.php +59 -0
  578. package/src/query-no-results/save.js +8 -0
  579. package/src/query-pagination/edit.js +1 -1
  580. package/src/query-pagination/index.php +9 -2
  581. package/src/query-pagination-numbers/block.json +19 -1
  582. package/src/quote/block.json +8 -0
  583. package/src/quote/index.js +6 -1
  584. package/src/quote/style.scss +1 -0
  585. package/src/quote/v2/deprecated.js +107 -0
  586. package/src/quote/v2/edit.js +136 -0
  587. package/src/quote/v2/index.js +36 -0
  588. package/src/quote/v2/save.js +26 -0
  589. package/src/quote/v2/test/migrate.js +92 -0
  590. package/src/quote/v2/transforms.js +155 -0
  591. package/src/read-more/block.json +1 -1
  592. package/src/reset.scss +1 -1
  593. package/src/rss/edit.js +3 -1
  594. package/src/rss/index.php +14 -1
  595. package/src/search/edit.js +1 -2
  596. package/src/separator/block.json +13 -6
  597. package/src/separator/deprecated.js +57 -0
  598. package/src/separator/deprecated.scss +6 -0
  599. package/src/separator/edit.js +36 -14
  600. package/src/separator/editor.scss +6 -0
  601. package/src/separator/index.js +2 -0
  602. package/src/separator/save.js +22 -14
  603. package/src/separator/test/edit.js +113 -0
  604. package/src/separator/theme.scss +7 -1
  605. package/src/separator/use-deprecated-opacity.js +41 -0
  606. package/src/site-logo/block.json +1 -1
  607. package/src/site-logo/edit.js +2 -1
  608. package/src/site-logo/editor.scss +3 -1
  609. package/src/site-logo/index.php +0 -4
  610. package/src/social-link/index.php +1 -2
  611. package/src/social-links/block.json +2 -1
  612. package/src/social-links/edit.js +15 -5
  613. package/src/spacer/controls.js +12 -18
  614. package/src/spacer/controls.native.js +2 -1
  615. package/src/spacer/edit.js +3 -6
  616. package/src/spacer/test/__snapshots__/index.native.js.snap +31 -0
  617. package/src/spacer/test/index.native.js +180 -0
  618. package/src/style.scss +1 -0
  619. package/src/table/deprecated.js +5 -1
  620. package/src/tag-cloud/block.json +8 -0
  621. package/src/tag-cloud/edit.js +82 -2
  622. package/src/tag-cloud/index.php +6 -0
  623. package/src/template-part/edit/utils/hooks.js +6 -1
  624. package/src/template-part/editor.scss +0 -10
  625. package/build/navigation/edit/use-list-view-modal.js +0 -73
  626. package/build/navigation/edit/use-list-view-modal.js.map +0 -1
  627. package/build/separator/separator-settings.js +0 -36
  628. package/build/separator/separator-settings.js.map +0 -1
  629. package/build-module/navigation/edit/use-list-view-modal.js +0 -63
  630. package/build-module/navigation/edit/use-list-view-modal.js.map +0 -1
  631. package/build-module/separator/separator-settings.js +0 -27
  632. package/build-module/separator/separator-settings.js.map +0 -1
  633. package/src/navigation/edit/use-list-view-modal.js +0 -72
  634. package/src/separator/separator-settings.js +0 -24
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/search/edit.js"],"names":["classnames","useBlockProps","BlockControls","InspectorControls","RichText","__experimentalUseBorderProps","useBorderProps","__experimentalUnitControl","UnitControl","__experimentalUseColorProps","useColorProps","store","blockEditorStore","useDispatch","useSelect","useEffect","ToolbarDropdownMenu","ToolbarGroup","Button","ButtonGroup","ToolbarButton","ResizableBox","PanelBody","BaseControl","__experimentalUseCustomUnits","useCustomUnits","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","borderColor","color","borderWidth","borderProps","colorProps","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","event","target","value","renderButton","buttonClasses","buttonStyles","html","controls","newWidth","filteredWidth","parseInt","newUnit","maxWidth","map","widthValue","padBorderRadius","getWrapperStyles","styles","isNonZeroBorderRadius","topLeft","topRight","bottomLeft","bottomRight","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","Number","isInteger","blockProps","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,yBAAyB,IAAIC,WAN9B,EAOCC,2BAA2B,IAAIC,aAPhC,EAQCC,KAAK,IAAIC,gBARV,QASO,yBATP;AAUA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SACCC,mBADD,EAECC,YAFD,EAGCC,MAHD,EAICC,WAJD,EAKCC,aALD,EAMC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n * WordPress dependencies\n */\nimport {\n\tuseBlockProps,\n\tBlockControls,\n\tInspectorControls,\n\tRichText,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalUseColorProps as useColorProps,\n\tstore as blockEditorStore,\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} 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 } = select(\n\t\t\t\tblockEditorStore\n\t\t\t);\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 } = useDispatch(\n\t\tblockEditorStore\n\t);\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 borderColor = style?.border?.color;\n\tconst borderWidth = style?.border?.width;\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 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);\n\t\tconst textFieldStyles = isButtonPositionInside\n\t\t\t? { borderRadius }\n\t\t\t: borderProps.style;\n\n\t\treturn (\n\t\t\t<input\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\tisButtonPositionInside ? undefined : borderProps.className,\n\t\t\tbuttonUseIcon ? 'has-icon' : undefined\n\t\t);\n\t\tconst buttonStyles = {\n\t\t\t...colorProps.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\tstyle={ { maxWidth: 80 } }\n\t\t\t\t\t\t\tvalue={ `${ width }${ widthUnit }` }\n\t\t\t\t\t\t\tunit={ 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 = {\n\t\t\tborderColor,\n\t\t\tborderWidth: isButtonPositionInside ? borderWidth : undefined,\n\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 {\n\t\t\t\t\ttopLeft,\n\t\t\t\t\ttopRight,\n\t\t\t\t\tbottomLeft,\n\t\t\t\t\tbottomRight,\n\t\t\t\t} = borderRadius;\n\n\t\t\t\treturn {\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\t...styles,\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} );\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=\"wp-block-search__label\"\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/>\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","store","blockEditorStore","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","borderColor","color","borderWidth","borderProps","colorProps","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","event","target","value","renderButton","buttonClasses","buttonStyles","html","controls","newWidth","filteredWidth","parseInt","newUnit","maxWidth","map","widthValue","padBorderRadius","getWrapperStyles","styles","isNonZeroBorderRadius","topLeft","topRight","bottomLeft","bottomRight","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius","Number","isInteger","blockProps","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,KAAK,IAAIC,gBAPV,QAQO,yBARP;AASA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,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EAkCGxB,WAAW,IAAIkB,eAAe,EAlCjC,CAdD,CADD;AAqDA","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\tstore as blockEditorStore,\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 } = select(\n\t\t\t\tblockEditorStore\n\t\t\t);\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 } = useDispatch(\n\t\tblockEditorStore\n\t);\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 borderColor = style?.border?.color;\n\tconst borderWidth = style?.border?.width;\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 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);\n\t\tconst textFieldStyles = isButtonPositionInside\n\t\t\t? { borderRadius }\n\t\t\t: borderProps.style;\n\n\t\treturn (\n\t\t\t<input\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\tisButtonPositionInside ? undefined : borderProps.className,\n\t\t\tbuttonUseIcon ? 'has-icon' : undefined\n\t\t);\n\t\tconst buttonStyles = {\n\t\t\t...colorProps.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\tstyle={ { maxWidth: 80 } }\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 = {\n\t\t\tborderColor,\n\t\t\tborderWidth: isButtonPositionInside ? borderWidth : undefined,\n\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 {\n\t\t\t\t\ttopLeft,\n\t\t\t\t\ttopRight,\n\t\t\t\t\tbottomLeft,\n\t\t\t\t\tbottomRight,\n\t\t\t\t} = borderRadius;\n\n\t\t\t\treturn {\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\t...styles,\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} );\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=\"wp-block-search__label\"\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/>\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"]}
@@ -0,0 +1,70 @@
1
+ import { createElement } from "@wordpress/element";
2
+
3
+ /**
4
+ * External dependencies
5
+ */
6
+ import classnames from 'classnames';
7
+ import { omit } from 'lodash';
8
+ /**
9
+ * WordPress dependencies
10
+ */
11
+
12
+ import { getColorClassName, useBlockProps } from '@wordpress/block-editor';
13
+ const v1 = {
14
+ attributes: {
15
+ color: {
16
+ type: 'string'
17
+ },
18
+ customColor: {
19
+ type: 'string'
20
+ }
21
+ },
22
+
23
+ save(_ref) {
24
+ let {
25
+ attributes
26
+ } = _ref;
27
+ const {
28
+ color,
29
+ customColor
30
+ } = attributes; // the hr support changing color using border-color, since border-color
31
+ // is not yet supported in the color palette, we use background-color
32
+
33
+ const backgroundClass = getColorClassName('background-color', color); // the dots styles uses text for the dots, to change those dots color is
34
+ // using color, not backgroundColor
35
+
36
+ const colorClass = getColorClassName('color', color);
37
+ const className = classnames({
38
+ 'has-text-color has-background': color || customColor,
39
+ [backgroundClass]: backgroundClass,
40
+ [colorClass]: colorClass
41
+ });
42
+ const style = {
43
+ backgroundColor: backgroundClass ? undefined : customColor,
44
+ color: colorClass ? undefined : customColor
45
+ };
46
+ return createElement("hr", useBlockProps.save({
47
+ className,
48
+ style
49
+ }));
50
+ },
51
+
52
+ migrate(attributes) {
53
+ const {
54
+ color,
55
+ customColor
56
+ } = attributes;
57
+ return { ...omit(attributes, ['color', 'customColor']),
58
+ backgroundColor: color ? color : undefined,
59
+ opacity: 'css',
60
+ style: customColor ? {
61
+ color: {
62
+ background: customColor
63
+ }
64
+ } : undefined
65
+ };
66
+ }
67
+
68
+ };
69
+ export default [v1];
70
+ //# sourceMappingURL=deprecated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-library/src/separator/deprecated.js"],"names":["classnames","omit","getColorClassName","useBlockProps","v1","attributes","color","type","customColor","save","backgroundClass","colorClass","className","style","backgroundColor","undefined","migrate","opacity","background"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,IAAT,QAAqB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,SAF3B;AAGNE,MAAAA,OAAO,EAAE,KAHH;AAINJ,MAAAA,KAAK,EAAEL,WAAW,GACf;AAAEF,QAAAA,KAAK,EAAE;AAAEY,UAAAA,UAAU,EAAEV;AAAd;AAAT,OADe,GAEfO;AANG,KAAP;AAQA;;AA1CS,CAAX;AA6CA,eAAe,CAAEX,EAAF,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { omit } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { getColorClassName, useBlockProps } from '@wordpress/block-editor';\n\nconst v1 = {\n\tattributes: {\n\t\tcolor: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tcustomColor: {\n\t\t\ttype: 'string',\n\t\t},\n\t},\n\tsave( { attributes } ) {\n\t\tconst { color, customColor } = attributes;\n\n\t\t// the hr support changing color using border-color, since border-color\n\t\t// is not yet supported in the color palette, we use background-color\n\t\tconst backgroundClass = getColorClassName( 'background-color', color );\n\t\t// the dots styles uses text for the dots, to change those dots color is\n\t\t// using color, not backgroundColor\n\t\tconst colorClass = getColorClassName( 'color', color );\n\n\t\tconst className = classnames( {\n\t\t\t'has-text-color has-background': color || customColor,\n\t\t\t[ backgroundClass ]: backgroundClass,\n\t\t\t[ colorClass ]: colorClass,\n\t\t} );\n\n\t\tconst style = {\n\t\t\tbackgroundColor: backgroundClass ? undefined : customColor,\n\t\t\tcolor: colorClass ? undefined : customColor,\n\t\t};\n\n\t\treturn <hr { ...useBlockProps.save( { className, style } ) } />;\n\t},\n\tmigrate( attributes ) {\n\t\tconst { color, customColor } = attributes;\n\t\treturn {\n\t\t\t...omit( attributes, [ 'color', 'customColor' ] ),\n\t\t\tbackgroundColor: color ? color : undefined,\n\t\t\topacity: 'css',\n\t\t\tstyle: customColor\n\t\t\t\t? { color: { background: customColor } }\n\t\t\t\t: undefined,\n\t\t};\n\t},\n};\n\nexport default [ v1 ];\n"]}
@@ -9,35 +9,44 @@ import classnames from 'classnames';
9
9
  */
10
10
 
11
11
  import { HorizontalRule } from '@wordpress/components';
12
- import { withColors, useBlockProps } from '@wordpress/block-editor';
12
+ import { useBlockProps, getColorClassName, __experimentalUseColorProps as useColorProps } from '@wordpress/block-editor';
13
13
  /**
14
14
  * Internal dependencies
15
15
  */
16
16
 
17
- import SeparatorSettings from './separator-settings';
17
+ import useDeprecatedOpacity from './use-deprecated-opacity';
18
+ export default function SeparatorEdit(_ref) {
19
+ var _colorProps$style, _style$color;
18
20
 
19
- function SeparatorEdit(_ref) {
20
21
  let {
21
- color,
22
- setColor,
23
- className
22
+ attributes,
23
+ setAttributes
24
24
  } = _ref;
25
+ const {
26
+ backgroundColor,
27
+ opacity,
28
+ style
29
+ } = attributes;
30
+ const colorProps = useColorProps(attributes);
31
+ const currentColor = colorProps === null || colorProps === void 0 ? void 0 : (_colorProps$style = colorProps.style) === null || _colorProps$style === void 0 ? void 0 : _colorProps$style.backgroundColor;
32
+ const hasCustomColor = !!(style !== null && style !== void 0 && (_style$color = style.color) !== null && _style$color !== void 0 && _style$color.background);
33
+ useDeprecatedOpacity(opacity, currentColor, setAttributes); // The dots styles uses text for the dots, to change those dots color is
34
+ // using color, not backgroundColor.
35
+
36
+ const colorClass = getColorClassName('color', backgroundColor);
37
+ const className = classnames({
38
+ 'has-text-color': backgroundColor || currentColor,
39
+ [colorClass]: colorClass,
40
+ 'has-css-opacity': opacity === 'css',
41
+ 'has-alpha-channel-opacity': opacity === 'alpha-channel'
42
+ }, colorProps.classname);
43
+ const styles = {
44
+ color: currentColor,
45
+ backgroundColor: currentColor
46
+ };
25
47
  return createElement(Fragment, null, createElement(HorizontalRule, useBlockProps({
26
- className: classnames(className, {
27
- 'has-background': color.color,
28
- [color.class]: color.class
29
- }),
30
- style: {
31
- backgroundColor: color.color,
32
- color: color.color
33
- }
34
- })), createElement(SeparatorSettings, {
35
- color: color,
36
- setColor: setColor
37
- }));
48
+ className,
49
+ style: hasCustomColor ? styles : undefined
50
+ })));
38
51
  }
39
-
40
- export default withColors('color', {
41
- textColor: 'color'
42
- })(SeparatorEdit);
43
52
  //# sourceMappingURL=edit.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/separator/edit.js"],"names":["classnames","HorizontalRule","withColors","useBlockProps","SeparatorSettings","SeparatorEdit","color","setColor","className","class","style","backgroundColor","textColor"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,cAAT,QAA+B,uBAA/B;AACA,SAASC,UAAT,EAAqBC,aAArB,QAA0C,yBAA1C;AACA;AACA;AACA;;AACA,OAAOC,iBAAP,MAA8B,sBAA9B;;AAEA,SAASC,aAAT,OAAyD;AAAA,MAAjC;AAAEC,IAAAA,KAAF;AAASC,IAAAA,QAAT;AAAmBC,IAAAA;AAAnB,GAAiC;AACxD,SACC,8BACC,cAAC,cAAD,EACML,aAAa,CAAE;AACnBK,IAAAA,SAAS,EAAER,UAAU,CAAEQ,SAAF,EAAa;AACjC,wBAAkBF,KAAK,CAACA,KADS;AAEjC,OAAEA,KAAK,CAACG,KAAR,GAAiBH,KAAK,CAACG;AAFU,KAAb,CADF;AAKnBC,IAAAA,KAAK,EAAE;AACNC,MAAAA,eAAe,EAAEL,KAAK,CAACA,KADjB;AAENA,MAAAA,KAAK,EAAEA,KAAK,CAACA;AAFP;AALY,GAAF,CADnB,CADD,EAaC,cAAC,iBAAD;AAAmB,IAAA,KAAK,EAAGA,KAA3B;AAAmC,IAAA,QAAQ,EAAGC;AAA9C,IAbD,CADD;AAiBA;;AAED,eAAeL,UAAU,CAAE,OAAF,EAAW;AAAEU,EAAAA,SAAS,EAAE;AAAb,CAAX,CAAV,CAA+CP,aAA/C,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { HorizontalRule } from '@wordpress/components';\nimport { withColors, useBlockProps } from '@wordpress/block-editor';\n/**\n * Internal dependencies\n */\nimport SeparatorSettings from './separator-settings';\n\nfunction SeparatorEdit( { color, setColor, className } ) {\n\treturn (\n\t\t<>\n\t\t\t<HorizontalRule\n\t\t\t\t{ ...useBlockProps( {\n\t\t\t\t\tclassName: classnames( className, {\n\t\t\t\t\t\t'has-background': color.color,\n\t\t\t\t\t\t[ color.class ]: color.class,\n\t\t\t\t\t} ),\n\t\t\t\t\tstyle: {\n\t\t\t\t\t\tbackgroundColor: color.color,\n\t\t\t\t\t\tcolor: color.color,\n\t\t\t\t\t},\n\t\t\t\t} ) }\n\t\t\t/>\n\t\t\t<SeparatorSettings color={ color } setColor={ setColor } />\n\t\t</>\n\t);\n}\n\nexport default withColors( 'color', { textColor: 'color' } )( SeparatorEdit );\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/separator/edit.js"],"names":["classnames","HorizontalRule","useBlockProps","getColorClassName","__experimentalUseColorProps","useColorProps","useDeprecatedOpacity","SeparatorEdit","attributes","setAttributes","backgroundColor","opacity","style","colorProps","currentColor","hasCustomColor","color","background","colorClass","className","classname","styles","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,cAAT,QAA+B,uBAA/B;AACA,SACCC,aADD,EAECC,iBAFD,EAGCC,2BAA2B,IAAIC,aAHhC,QAIO,yBAJP;AAMA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,0BAAjC;AAEA,eAAe,SAASC,aAAT,OAAwD;AAAA;;AAAA,MAAhC;AAAEC,IAAAA,UAAF;AAAcC,IAAAA;AAAd,GAAgC;AACtE,QAAM;AAAEC,IAAAA,eAAF;AAAmBC,IAAAA,OAAnB;AAA4BC,IAAAA;AAA5B,MAAsCJ,UAA5C;AACA,QAAMK,UAAU,GAAGR,aAAa,CAAEG,UAAF,CAAhC;AACA,QAAMM,YAAY,GAAGD,UAAH,aAAGA,UAAH,4CAAGA,UAAU,CAAED,KAAf,sDAAG,kBAAmBF,eAAxC;AACA,QAAMK,cAAc,GAAG,CAAC,EAAEH,KAAF,aAAEA,KAAF,+BAAEA,KAAK,CAAEI,KAAT,yCAAE,aAAcC,UAAhB,CAAxB;AAEAX,EAAAA,oBAAoB,CAAEK,OAAF,EAAWG,YAAX,EAAyBL,aAAzB,CAApB,CANsE,CAQtE;AACA;;AACA,QAAMS,UAAU,GAAGf,iBAAiB,CAAE,OAAF,EAAWO,eAAX,CAApC;AAEA,QAAMS,SAAS,GAAGnB,UAAU,CAC3B;AACC,sBAAkBU,eAAe,IAAII,YADtC;AAEC,KAAEI,UAAF,GAAgBA,UAFjB;AAGC,uBAAmBP,OAAO,KAAK,KAHhC;AAIC,iCAA6BA,OAAO,KAAK;AAJ1C,GAD2B,EAO3BE,UAAU,CAACO,SAPgB,CAA5B;AAUA,QAAMC,MAAM,GAAG;AACdL,IAAAA,KAAK,EAAEF,YADO;AAEdJ,IAAAA,eAAe,EAAEI;AAFH,GAAf;AAKA,SACC,8BACC,cAAC,cAAD,EACMZ,aAAa,CAAE;AACnBiB,IAAAA,SADmB;AAEnBP,IAAAA,KAAK,EAAEG,cAAc,GAAGM,MAAH,GAAYC;AAFd,GAAF,CADnB,CADD,CADD;AAUA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { HorizontalRule } from '@wordpress/components';\nimport {\n\tuseBlockProps,\n\tgetColorClassName,\n\t__experimentalUseColorProps as useColorProps,\n} from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport useDeprecatedOpacity from './use-deprecated-opacity';\n\nexport default function SeparatorEdit( { attributes, setAttributes } ) {\n\tconst { backgroundColor, opacity, style } = attributes;\n\tconst colorProps = useColorProps( attributes );\n\tconst currentColor = colorProps?.style?.backgroundColor;\n\tconst hasCustomColor = !! style?.color?.background;\n\n\tuseDeprecatedOpacity( opacity, currentColor, setAttributes );\n\n\t// The dots styles uses text for the dots, to change those dots color is\n\t// using color, not backgroundColor.\n\tconst colorClass = getColorClassName( 'color', backgroundColor );\n\n\tconst className = classnames(\n\t\t{\n\t\t\t'has-text-color': backgroundColor || currentColor,\n\t\t\t[ colorClass ]: colorClass,\n\t\t\t'has-css-opacity': opacity === 'css',\n\t\t\t'has-alpha-channel-opacity': opacity === 'alpha-channel',\n\t\t},\n\t\tcolorProps.classname\n\t);\n\n\tconst styles = {\n\t\tcolor: currentColor,\n\t\tbackgroundColor: currentColor,\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<HorizontalRule\n\t\t\t\t{ ...useBlockProps( {\n\t\t\t\t\tclassName,\n\t\t\t\t\tstyle: hasCustomColor ? styles : undefined,\n\t\t\t\t} ) }\n\t\t\t/>\n\t\t</>\n\t);\n}\n"]}
@@ -17,16 +17,23 @@ const metadata = {
17
17
  keywords: ["horizontal-line", "hr", "divider"],
18
18
  textdomain: "default",
19
19
  attributes: {
20
- color: {
21
- type: "string"
22
- },
23
- customColor: {
24
- type: "string"
20
+ opacity: {
21
+ type: "string",
22
+ "default": "alpha-channel"
25
23
  }
26
24
  },
27
25
  supports: {
28
26
  anchor: true,
29
- align: ["center", "wide", "full"]
27
+ align: ["center", "wide", "full"],
28
+ color: {
29
+ __experimentalSkipSerialization: true,
30
+ gradients: true,
31
+ background: true,
32
+ text: false,
33
+ __experimentalDefaultControls: {
34
+ background: true
35
+ }
36
+ }
30
37
  },
31
38
  styles: [{
32
39
  name: "default",
@@ -44,6 +51,7 @@ const metadata = {
44
51
  };
45
52
  import save from './save';
46
53
  import transforms from './transforms';
54
+ import deprecated from './deprecated';
47
55
  const {
48
56
  name
49
57
  } = metadata;
@@ -58,6 +66,7 @@ export const settings = {
58
66
  },
59
67
  transforms,
60
68
  edit,
61
- save
69
+ save,
70
+ deprecated
62
71
  };
63
72
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/separator/index.js"],"names":["separator","icon","edit","save","transforms","name","metadata","settings","example","attributes","customColor","className"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,IAAIC,IAAtB,QAAkC,kBAAlC;AAEA;AACA;AACA;;AACA,OAAOC,IAAP,MAAiB,QAAjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAOC,IAAP,MAAiB,QAAjB;AACA,OAAOC,UAAP,MAAuB,cAAvB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAWC,QAAjB;AAEA,SAASA,QAAT,EAAmBD,IAAnB;AAEA,OAAO,MAAME,QAAQ,GAAG;AACvBN,EAAAA,IADuB;AAEvBO,EAAAA,OAAO,EAAE;AACRC,IAAAA,UAAU,EAAE;AACXC,MAAAA,WAAW,EAAE,SADF;AAEXC,MAAAA,SAAS,EAAE;AAFA;AADJ,GAFc;AAQvBP,EAAAA,UARuB;AASvBF,EAAAA,IATuB;AAUvBC,EAAAA;AAVuB,CAAjB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { separator as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tcustomColor: '#065174',\n\t\t\tclassName: 'is-style-wide',\n\t\t},\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n};\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/separator/index.js"],"names":["separator","icon","edit","save","transforms","deprecated","name","metadata","settings","example","attributes","customColor","className"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,IAAIC,IAAtB,QAAkC,kBAAlC;AAEA;AACA;AACA;;AACA,OAAOC,IAAP,MAAiB,QAAjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,OAAOC,IAAP,MAAiB,QAAjB;AACA,OAAOC,UAAP,MAAuB,cAAvB;AACA,OAAOC,UAAP,MAAuB,cAAvB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAWC,QAAjB;AAEA,SAASA,QAAT,EAAmBD,IAAnB;AAEA,OAAO,MAAME,QAAQ,GAAG;AACvBP,EAAAA,IADuB;AAEvBQ,EAAAA,OAAO,EAAE;AACRC,IAAAA,UAAU,EAAE;AACXC,MAAAA,WAAW,EAAE,SADF;AAEXC,MAAAA,SAAS,EAAE;AAFA;AADJ,GAFc;AAQvBR,EAAAA,UARuB;AASvBF,EAAAA,IATuB;AAUvBC,EAAAA,IAVuB;AAWvBE,EAAAA;AAXuB,CAAjB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { separator as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport deprecated from './deprecated';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tcustomColor: '#065174',\n\t\t\tclassName: 'is-style-wide',\n\t\t},\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n"]}
@@ -8,33 +8,38 @@ import classnames from 'classnames';
8
8
  * WordPress dependencies
9
9
  */
10
10
 
11
- import { getColorClassName, useBlockProps } from '@wordpress/block-editor';
11
+ import { getColorClassName, useBlockProps, __experimentalGetColorClassesAndStyles as getColorClassesAndStyles } from '@wordpress/block-editor';
12
12
  export default function separatorSave(_ref) {
13
+ var _style$color, _colorProps$style;
14
+
13
15
  let {
14
16
  attributes
15
17
  } = _ref;
16
18
  const {
17
- color,
18
- customColor
19
- } = attributes; // The hr support changing color using border-color, since border-color
19
+ backgroundColor,
20
+ style,
21
+ opacity
22
+ } = attributes;
23
+ const customColor = style === null || style === void 0 ? void 0 : (_style$color = style.color) === null || _style$color === void 0 ? void 0 : _style$color.background;
24
+ const colorProps = getColorClassesAndStyles(attributes); // The hr support changing color using border-color, since border-color
20
25
  // is not yet supported in the color palette, we use background-color.
21
-
22
- const backgroundClass = getColorClassName('background-color', color); // The dots styles uses text for the dots, to change those dots color is
26
+ // The dots styles uses text for the dots, to change those dots color is
23
27
  // using color, not backgroundColor.
24
28
 
25
- const colorClass = getColorClassName('color', color);
29
+ const colorClass = getColorClassName('color', backgroundColor);
26
30
  const className = classnames({
27
- 'has-text-color has-background': color || customColor,
28
- [backgroundClass]: backgroundClass,
29
- [colorClass]: colorClass
30
- });
31
- const style = {
32
- backgroundColor: backgroundClass ? undefined : customColor,
31
+ 'has-text-color': backgroundColor || customColor,
32
+ [colorClass]: colorClass,
33
+ 'has-css-opacity': opacity === 'css',
34
+ 'has-alpha-channel-opacity': opacity === 'alpha-channel'
35
+ }, colorProps.className);
36
+ const styles = {
37
+ backgroundColor: colorProps === null || colorProps === void 0 ? void 0 : (_colorProps$style = colorProps.style) === null || _colorProps$style === void 0 ? void 0 : _colorProps$style.backgroundColor,
33
38
  color: colorClass ? undefined : customColor
34
39
  };
35
40
  return createElement("hr", useBlockProps.save({
36
41
  className,
37
- style
42
+ style: styles
38
43
  }));
39
44
  }
40
45
  //# sourceMappingURL=save.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/separator/save.js"],"names":["classnames","getColorClassName","useBlockProps","separatorSave","attributes","color","customColor","backgroundClass","colorClass","className","style","backgroundColor","undefined","save"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,iBAAT,EAA4BC,aAA5B,QAAiD,yBAAjD;AAEA,eAAe,SAASC,aAAT,OAAyC;AAAA,MAAjB;AAAEC,IAAAA;AAAF,GAAiB;AACvD,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAAyBF,UAA/B,CADuD,CAGvD;AACA;;AACA,QAAMG,eAAe,GAAGN,iBAAiB,CAAE,kBAAF,EAAsBI,KAAtB,CAAzC,CALuD,CAMvD;AACA;;AACA,QAAMG,UAAU,GAAGP,iBAAiB,CAAE,OAAF,EAAWI,KAAX,CAApC;AAEA,QAAMI,SAAS,GAAGT,UAAU,CAAE;AAC7B,qCAAiCK,KAAK,IAAIC,WADb;AAE7B,KAAEC,eAAF,GAAqBA,eAFQ;AAG7B,KAAEC,UAAF,GAAgBA;AAHa,GAAF,CAA5B;AAMA,QAAME,KAAK,GAAG;AACbC,IAAAA,eAAe,EAAEJ,eAAe,GAAGK,SAAH,GAAeN,WADlC;AAEbD,IAAAA,KAAK,EAAEG,UAAU,GAAGI,SAAH,GAAeN;AAFnB,GAAd;AAKA,SAAO,oBAASJ,aAAa,CAACW,IAAd,CAAoB;AAAEJ,IAAAA,SAAF;AAAaC,IAAAA;AAAb,GAApB,CAAT,CAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { getColorClassName, useBlockProps } from '@wordpress/block-editor';\n\nexport default function separatorSave( { attributes } ) {\n\tconst { color, customColor } = attributes;\n\n\t// The hr support changing color using border-color, since border-color\n\t// is not yet supported in the color palette, we use background-color.\n\tconst backgroundClass = getColorClassName( 'background-color', color );\n\t// The dots styles uses text for the dots, to change those dots color is\n\t// using color, not backgroundColor.\n\tconst colorClass = getColorClassName( 'color', color );\n\n\tconst className = classnames( {\n\t\t'has-text-color has-background': color || customColor,\n\t\t[ backgroundClass ]: backgroundClass,\n\t\t[ colorClass ]: colorClass,\n\t} );\n\n\tconst style = {\n\t\tbackgroundColor: backgroundClass ? undefined : customColor,\n\t\tcolor: colorClass ? undefined : customColor,\n\t};\n\n\treturn <hr { ...useBlockProps.save( { className, style } ) } />;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/separator/save.js"],"names":["classnames","getColorClassName","useBlockProps","__experimentalGetColorClassesAndStyles","getColorClassesAndStyles","separatorSave","attributes","backgroundColor","style","opacity","customColor","color","background","colorProps","colorClass","className","styles","undefined","save"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,iBADD,EAECC,aAFD,EAGCC,sCAAsC,IAAIC,wBAH3C,QAIO,yBAJP;AAMA,eAAe,SAASC,aAAT,OAAyC;AAAA;;AAAA,MAAjB;AAAEC,IAAAA;AAAF,GAAiB;AACvD,QAAM;AAAEC,IAAAA,eAAF;AAAmBC,IAAAA,KAAnB;AAA0BC,IAAAA;AAA1B,MAAsCH,UAA5C;AACA,QAAMI,WAAW,GAAGF,KAAH,aAAGA,KAAH,uCAAGA,KAAK,CAAEG,KAAV,iDAAG,aAAcC,UAAlC;AACA,QAAMC,UAAU,GAAGT,wBAAwB,CAAEE,UAAF,CAA3C,CAHuD,CAIvD;AACA;AAEA;AACA;;AACA,QAAMQ,UAAU,GAAGb,iBAAiB,CAAE,OAAF,EAAWM,eAAX,CAApC;AAEA,QAAMQ,SAAS,GAAGf,UAAU,CAC3B;AACC,sBAAkBO,eAAe,IAAIG,WADtC;AAEC,KAAEI,UAAF,GAAgBA,UAFjB;AAGC,uBAAmBL,OAAO,KAAK,KAHhC;AAIC,iCAA6BA,OAAO,KAAK;AAJ1C,GAD2B,EAO3BI,UAAU,CAACE,SAPgB,CAA5B;AAUA,QAAMC,MAAM,GAAG;AACdT,IAAAA,eAAe,EAAEM,UAAF,aAAEA,UAAF,4CAAEA,UAAU,CAAEL,KAAd,sDAAE,kBAAmBD,eADtB;AAEdI,IAAAA,KAAK,EAAEG,UAAU,GAAGG,SAAH,GAAeP;AAFlB,GAAf;AAIA,SAAO,oBAASR,aAAa,CAACgB,IAAd,CAAoB;AAAEH,IAAAA,SAAF;AAAaP,IAAAA,KAAK,EAAEQ;AAApB,GAApB,CAAT,CAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tgetColorClassName,\n\tuseBlockProps,\n\t__experimentalGetColorClassesAndStyles as getColorClassesAndStyles,\n} from '@wordpress/block-editor';\n\nexport default function separatorSave( { attributes } ) {\n\tconst { backgroundColor, style, opacity } = attributes;\n\tconst customColor = style?.color?.background;\n\tconst colorProps = getColorClassesAndStyles( attributes );\n\t// The hr support changing color using border-color, since border-color\n\t// is not yet supported in the color palette, we use background-color.\n\n\t// The dots styles uses text for the dots, to change those dots color is\n\t// using color, not backgroundColor.\n\tconst colorClass = getColorClassName( 'color', backgroundColor );\n\n\tconst className = classnames(\n\t\t{\n\t\t\t'has-text-color': backgroundColor || customColor,\n\t\t\t[ colorClass ]: colorClass,\n\t\t\t'has-css-opacity': opacity === 'css',\n\t\t\t'has-alpha-channel-opacity': opacity === 'alpha-channel',\n\t\t},\n\t\tcolorProps.className\n\t);\n\n\tconst styles = {\n\t\tbackgroundColor: colorProps?.style?.backgroundColor,\n\t\tcolor: colorClass ? undefined : customColor,\n\t};\n\treturn <hr { ...useBlockProps.save( { className, style: styles } ) } />;\n}\n"]}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useEffect, useState } from '@wordpress/element';
5
+ import { usePrevious } from '@wordpress/compose';
6
+ export default function useDeprecatedOpacity(opacity, currentColor, setAttributes) {
7
+ const [deprecatedOpacityWithNoColor, setDeprecatedOpacityWithNoColor] = useState(false);
8
+ const previousColor = usePrevious(currentColor); // A separator with no color set will always have previousColor set to undefined,
9
+ // and we need to differentiate these from those with color set that will return
10
+ // previousColor as undefined on the first render.
11
+
12
+ useEffect(() => {
13
+ if (opacity === 'css' && !currentColor && !previousColor) {
14
+ setDeprecatedOpacityWithNoColor(true);
15
+ }
16
+ }, [currentColor, previousColor, opacity]); // For deprecated blocks, that have a default 0.4 css opacity set, we
17
+ // need to remove this if the current color is changed, or a color is added.
18
+ // In these instances the opacity attribute is set back to the default of
19
+ // alpha-channel which allows a new custom opacity to be set via the color picker.
20
+
21
+ useEffect(() => {
22
+ if (opacity === 'css' && (deprecatedOpacityWithNoColor && currentColor || previousColor && currentColor !== previousColor)) {
23
+ setAttributes({
24
+ opacity: 'alpha-channel'
25
+ });
26
+ setDeprecatedOpacityWithNoColor(false);
27
+ }
28
+ }, [deprecatedOpacityWithNoColor, currentColor, previousColor]);
29
+ }
30
+ //# sourceMappingURL=use-deprecated-opacity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-library/src/separator/use-deprecated-opacity.js"],"names":["useEffect","useState","usePrevious","useDeprecatedOpacity","opacity","currentColor","setAttributes","deprecatedOpacityWithNoColor","setDeprecatedOpacityWithNoColor","previousColor"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,QAApB,QAAoC,oBAApC;AACA,SAASC,WAAT,QAA4B,oBAA5B;AAEA,eAAe,SAASC,oBAAT,CACdC,OADc,EAEdC,YAFc,EAGdC,aAHc,EAIb;AACD,QAAM,CACLC,4BADK,EAELC,+BAFK,IAGFP,QAAQ,CAAE,KAAF,CAHZ;AAIA,QAAMQ,aAAa,GAAGP,WAAW,CAAEG,YAAF,CAAjC,CALC,CAOD;AACA;AACA;;AACAL,EAAAA,SAAS,CAAE,MAAM;AAChB,QAAKI,OAAO,KAAK,KAAZ,IAAqB,CAAEC,YAAvB,IAAuC,CAAEI,aAA9C,EAA8D;AAC7DD,MAAAA,+BAA+B,CAAE,IAAF,CAA/B;AACA;AACD,GAJQ,EAIN,CAAEH,YAAF,EAAgBI,aAAhB,EAA+BL,OAA/B,CAJM,CAAT,CAVC,CAgBD;AACA;AACA;AACA;;AACAJ,EAAAA,SAAS,CAAE,MAAM;AAChB,QACCI,OAAO,KAAK,KAAZ,KACIG,4BAA4B,IAAIF,YAAlC,IACCI,aAAa,IAAIJ,YAAY,KAAKI,aAFrC,CADD,EAIE;AACDH,MAAAA,aAAa,CAAE;AAAEF,QAAAA,OAAO,EAAE;AAAX,OAAF,CAAb;AACAI,MAAAA,+BAA+B,CAAE,KAAF,CAA/B;AACA;AACD,GATQ,EASN,CAAED,4BAAF,EAAgCF,YAAhC,EAA8CI,aAA9C,CATM,CAAT;AAUA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useState } from '@wordpress/element';\nimport { usePrevious } from '@wordpress/compose';\n\nexport default function useDeprecatedOpacity(\n\topacity,\n\tcurrentColor,\n\tsetAttributes\n) {\n\tconst [\n\t\tdeprecatedOpacityWithNoColor,\n\t\tsetDeprecatedOpacityWithNoColor,\n\t] = useState( false );\n\tconst previousColor = usePrevious( currentColor );\n\n\t// A separator with no color set will always have previousColor set to undefined,\n\t// and we need to differentiate these from those with color set that will return\n\t// previousColor as undefined on the first render.\n\tuseEffect( () => {\n\t\tif ( opacity === 'css' && ! currentColor && ! previousColor ) {\n\t\t\tsetDeprecatedOpacityWithNoColor( true );\n\t\t}\n\t}, [ currentColor, previousColor, opacity ] );\n\n\t// For deprecated blocks, that have a default 0.4 css opacity set, we\n\t// need to remove this if the current color is changed, or a color is added.\n\t// In these instances the opacity attribute is set back to the default of\n\t// alpha-channel which allows a new custom opacity to be set via the color picker.\n\tuseEffect( () => {\n\t\tif (\n\t\t\topacity === 'css' &&\n\t\t\t( ( deprecatedOpacityWithNoColor && currentColor ) ||\n\t\t\t\t( previousColor && currentColor !== previousColor ) )\n\t\t) {\n\t\t\tsetAttributes( { opacity: 'alpha-channel' } );\n\t\t\tsetDeprecatedOpacityWithNoColor( false );\n\t\t}\n\t}, [ deprecatedOpacityWithNoColor, currentColor, previousColor ] );\n}\n"]}
@@ -367,8 +367,9 @@ export default function LogoEdit(_ref2) {
367
367
  });
368
368
  };
369
369
 
370
- const setIcon = newValue => editEntityRecord('root', 'site', undefined, {
371
- site_icon: newValue
370
+ const setIcon = newValue => // The new value needs to be `null` to reset the Site Icon.
371
+ editEntityRecord('root', 'site', undefined, {
372
+ site_icon: newValue !== null && newValue !== void 0 ? newValue : null
372
373
  });
373
374
 
374
375
  let alt = null;