@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
@@ -102,7 +102,7 @@ function SearchEdit(_ref) {
102
102
  }
103
103
 
104
104
  const colorProps = (0, _blockEditor.__experimentalUseColorProps)(attributes);
105
- const unitControlInstanceId = (0, _compose.useInstanceId)(_blockEditor.__experimentalUnitControl);
105
+ const unitControlInstanceId = (0, _compose.useInstanceId)(_components.__experimentalUnitControl);
106
106
  const unitControlInputId = `wp-block-search__width-${unitControlInstanceId}`;
107
107
  const isButtonPositionInside = 'button-inside' === buttonPosition;
108
108
  const isButtonPositionOutside = 'button-outside' === buttonPosition;
@@ -255,7 +255,7 @@ function SearchEdit(_ref) {
255
255
  }, (0, _element.createElement)(_components.BaseControl, {
256
256
  label: (0, _i18n.__)('Width'),
257
257
  id: unitControlInputId
258
- }, (0, _element.createElement)(_blockEditor.__experimentalUnitControl, {
258
+ }, (0, _element.createElement)(_components.__experimentalUnitControl, {
259
259
  id: unitControlInputId,
260
260
  min: `${_utils.MIN_WIDTH}${_utils.MIN_WIDTH_UNIT}`,
261
261
  onChange: newWidth => {
@@ -274,7 +274,6 @@ function SearchEdit(_ref) {
274
274
  maxWidth: 80
275
275
  },
276
276
  value: `${width}${widthUnit}`,
277
- unit: widthUnit,
278
277
  units: units
279
278
  }), (0, _element.createElement)(_components.ButtonGroup, {
280
279
  className: "wp-block-search__components-button-group",
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/search/edit.js"],"names":["DEFAULT_INNER_PADDING","SearchEdit","className","attributes","setAttributes","toggleSelection","isSelected","clientId","label","showLabel","placeholder","width","widthUnit","align","buttonText","buttonPosition","buttonUseIcon","style","insertedInNavigationBlock","select","getBlockParentsByBlockName","wasBlockJustInserted","blockEditorStore","length","__unstableMarkNextChangeAsNotPersistent","borderRadius","border","radius","borderColor","color","borderWidth","borderProps","colorProps","unitControlInstanceId","UnitControl","unitControlInputId","isButtonPositionInside","isButtonPositionOutside","hasNoButton","hasOnlyButton","units","availableUnits","defaultValues","PC_WIDTH_DEFAULT","px","PX_WIDTH_DEFAULT","getBlockClassNames","undefined","buttonPositionControls","role","title","isActive","icon","buttonOutside","onClick","buttonInside","noButton","getButtonPositionIcon","buttonOnly","getResizableSides","right","left","renderTextField","textFieldClasses","textFieldStyles","event","target","value","renderButton","buttonClasses","buttonStyles","search","html","controls","toggleLabel","buttonWithIcon","MIN_WIDTH","MIN_WIDTH_UNIT","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":";;;;;;;;;AAmBA;;AAhBA;;AAKA;;AAUA;;AAEA;;AAWA;;AACA;;AACA;;AACA;;AAKA;;AAQA;;AA/CA;AACA;AACA;;AAGA;AACA;AACA;;AA6BA;AACA;AACA;AAgBA;AACA;AACA,MAAMA,qBAAqB,GAAG,KAA9B;;AAEe,SAASC,UAAT,OAOX;AAAA;;AAAA,MAPgC;AACnCC,IAAAA,SADmC;AAEnCC,IAAAA,UAFmC;AAGnCC,IAAAA,aAHmC;AAInCC,IAAAA,eAJmC;AAKnCC,IAAAA,UALmC;AAMnCC,IAAAA;AANmC,GAOhC;AACH,QAAM;AACLC,IAAAA,KADK;AAELC,IAAAA,SAFK;AAGLC,IAAAA,WAHK;AAILC,IAAAA,KAJK;AAKLC,IAAAA,SALK;AAMLC,IAAAA,KANK;AAOLC,IAAAA,UAPK;AAQLC,IAAAA,cARK;AASLC,IAAAA,aATK;AAULC,IAAAA;AAVK,MAWFd,UAXJ;AAaA,QAAMe,yBAAyB,GAAG,qBAC/BC,MAAF,IAAc;AAAA;;AACb,UAAM;AAAEC,MAAAA,0BAAF;AAA8BC,MAAAA;AAA9B,QAAuDF,MAAM,CAClEG,kBADkE,CAAnE;AAGA,WACC,CAAC,2BAAEF,0BAA0B,CAAEb,QAAF,EAAY,iBAAZ,CAA5B,kDAAE,sBACAgB,MADF,CAAD,IACaF,oBAAoB,CAAEd,QAAF,CAFlC;AAIA,GATgC,EAUjC,CAAEA,QAAF,CAViC,CAAlC;AAYA,QAAM;AAAEiB,IAAAA;AAAF,MAA8C,uBACnDF,kBADmD,CAApD;AAGA,0BAAW,MAAM;AAChB,QAAK,CAAEJ,yBAAP,EAAmC,OADnB,CAEhB;;AACAM,IAAAA,uCAAuC;;AACvCpB,I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AASC,IAAA,QAAQ,EAAGV,gBATZ;AAUC,IAAA,MAAM,EAAGjB,iBAAiB,EAV3B;AAWC,IAAA,aAAa,EAAG,CAAEM,KAAF,EAASmC,SAAT,EAAoBC,GAApB,KAA6B;AAC5CjG,MAAAA,aAAa,CAAE;AACdO,QAAAA,KAAK,EAAEqE,QAAQ,CAAEqB,GAAG,CAACC,WAAN,EAAmB,EAAnB,CADD;AAEd1F,QAAAA,SAAS,EAAE;AAFG,OAAF,CAAb;AAIAP,MAAAA,eAAe,CAAE,KAAF,CAAf;AACA,KAjBF;AAkBC,IAAA,YAAY,EAAG,CAAE4D,KAAF,EAASmC,SAAT,EAAoBC,GAApB,EAAyBE,KAAzB,KAAoC;AAClDnG,MAAAA,aAAa,CAAE;AACdO,QAAAA,KAAK,EAAEqE,QAAQ,CAAErE,KAAK,GAAG4F,KAAK,CAAC5F,KAAhB,EAAuB,EAAvB;AADD,OAAF,CAAb;AAGAN,MAAAA,eAAe,CAAE,IAAF,CAAf;AACA,KAvBF;AAwBC,IAAA,UAAU,EAAGC;AAxBd,KA0BG,CAAE8B,sBAAsB,IAAIC,uBAA5B,KACD,qDACGyB,eAAe,EADlB,EAEGM,YAAY,EAFf,CA3BF,EAiCG7B,aAAa,IAAI6B,YAAY,EAjChC,EAkCG9B,WAAW,IAAIwB,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__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":["DEFAULT_INNER_PADDING","SearchEdit","className","attributes","setAttributes","toggleSelection","isSelected","clientId","label","showLabel","placeholder","width","widthUnit","align","buttonText","buttonPosition","buttonUseIcon","style","insertedInNavigationBlock","select","getBlockParentsByBlockName","wasBlockJustInserted","blockEditorStore","length","__unstableMarkNextChangeAsNotPersistent","borderRadius","border","radius","borderColor","color","borderWidth","borderProps","colorProps","unitControlInstanceId","UnitControl","unitControlInputId","isButtonPositionInside","isButtonPositionOutside","hasNoButton","hasOnlyButton","units","availableUnits","defaultValues","PC_WIDTH_DEFAULT","px","PX_WIDTH_DEFAULT","getBlockClassNames","undefined","buttonPositionControls","role","title","isActive","icon","buttonOutside","onClick","buttonInside","noButton","getButtonPositionIcon","buttonOnly","getResizableSides","right","left","renderTextField","textFieldClasses","textFieldStyles","event","target","value","renderButton","buttonClasses","buttonStyles","search","html","controls","toggleLabel","buttonWithIcon","MIN_WIDTH","MIN_WIDTH_UNIT","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":";;;;;;;;;AAkBA;;AAfA;;AAKA;;AASA;;AAEA;;AAYA;;AACA;;AACA;;AACA;;AAKA;;AAQA;;AA/CA;AACA;AACA;;AAGA;AACA;AACA;;AA6BA;AACA;AACA;AAgBA;AACA;AACA,MAAMA,qBAAqB,GAAG,KAA9B;;AAEe,SAASC,UAAT,OAOX;AAAA;;AAAA,MAPgC;AACnCC,IAAAA,SADmC;AAEnCC,IAAAA,UAFmC;AAGnCC,IAAAA,aAHmC;AAInCC,IAAAA,eAJmC;AAKnCC,IAAAA,UALmC;AAMnCC,IAAAA;AANmC,GAOhC;AACH,QAAM;AACLC,IAAAA,KADK;AAELC,IAAAA,SAFK;AAGLC,IAAAA,WAHK;AAILC,IAAAA,KAJK;AAKLC,IAAAA,SALK;AAMLC,IAAAA,KANK;AAOLC,IAAAA,UAPK;AAQLC,IAAAA,cARK;AASLC,IAAAA,aATK;AAULC,IAAAA;AAVK,MAWFd,UAXJ;AAaA,QAAMe,yBAAyB,GAAG,qBAC/BC,MAAF,IAAc;AAAA;;AACb,UAAM;AAAEC,MAAAA,0BAAF;AAA8BC,MAAAA;AAA9B,QAAuDF,MAAM,CAClEG,kBADkE,CAAnE;AAGA,WACC,CAAC,2BAAEF,0BAA0B,CAAEb,QAAF,EAAY,iBAAZ,CAA5B,kDAAE,sBACAgB,MADF,CAAD,IACaF,oBA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AAAA,KAAK,EAAG,GAAGA,KAAO,GAAGC,SAAW;AAD1B,KADR;AAIC,IAAA,SAAS,EAAG,yBACX,iCADW,EAEXwB,sBAAsB,GAAGL,WAAW,CAAC7B,SAAf,GAA2B6C,SAFtC,CAJb;AAQC,IAAA,KAAK,EAAGuC,gBAAgB,EARzB;AASC,IAAA,QAAQ,EAAGV,gBATZ;AAUC,IAAA,MAAM,EAAGjB,iBAAiB,EAV3B;AAWC,IAAA,aAAa,EAAG,CAAEM,KAAF,EAASmC,SAAT,EAAoBC,GAApB,KAA6B;AAC5CjG,MAAAA,aAAa,CAAE;AACdO,QAAAA,KAAK,EAAEqE,QAAQ,CAAEqB,GAAG,CAACC,WAAN,EAAmB,EAAnB,CADD;AAEd1F,QAAAA,SAAS,EAAE;AAFG,OAAF,CAAb;AAIAP,MAAAA,eAAe,CAAE,KAAF,CAAf;AACA,KAjBF;AAkBC,IAAA,YAAY,EAAG,CAAE4D,KAAF,EAASmC,SAAT,EAAoBC,GAApB,EAAyBE,KAAzB,KAAoC;AAClDnG,MAAAA,aAAa,CAAE;AACdO,QAAAA,KAAK,EAAEqE,QAAQ,CAAErE,KAAK,GAAG4F,KAAK,CAAC5F,KAAhB,EAAuB,EAAvB;AADD,OAAF,CAAb;AAGAN,MAAAA,eAAe,CAAE,IAAF,CAAf;AACA,KAvBF;AAwBC,IAAA,UAAU,EAAGC;AAxBd,KA0BG,CAAE8B,sBAAsB,IAAIC,uBAA5B,KACD,qDACGyB,eAAe,EADlB,EAEGM,YAAY,EAFf,CA3BF,EAiCG7B,aAAa,IAAI6B,YAAY,EAjChC,EAkCG9B,WAAW,IAAIwB,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,83 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _element = require("@wordpress/element");
11
+
12
+ var _classnames = _interopRequireDefault(require("classnames"));
13
+
14
+ var _lodash = require("lodash");
15
+
16
+ var _blockEditor = require("@wordpress/block-editor");
17
+
18
+ /**
19
+ * External dependencies
20
+ */
21
+
22
+ /**
23
+ * WordPress dependencies
24
+ */
25
+ const v1 = {
26
+ attributes: {
27
+ color: {
28
+ type: 'string'
29
+ },
30
+ customColor: {
31
+ type: 'string'
32
+ }
33
+ },
34
+
35
+ save(_ref) {
36
+ let {
37
+ attributes
38
+ } = _ref;
39
+ const {
40
+ color,
41
+ customColor
42
+ } = attributes; // the hr support changing color using border-color, since border-color
43
+ // is not yet supported in the color palette, we use background-color
44
+
45
+ const backgroundClass = (0, _blockEditor.getColorClassName)('background-color', color); // the dots styles uses text for the dots, to change those dots color is
46
+ // using color, not backgroundColor
47
+
48
+ const colorClass = (0, _blockEditor.getColorClassName)('color', color);
49
+ const className = (0, _classnames.default)({
50
+ 'has-text-color has-background': color || customColor,
51
+ [backgroundClass]: backgroundClass,
52
+ [colorClass]: colorClass
53
+ });
54
+ const style = {
55
+ backgroundColor: backgroundClass ? undefined : customColor,
56
+ color: colorClass ? undefined : customColor
57
+ };
58
+ return (0, _element.createElement)("hr", _blockEditor.useBlockProps.save({
59
+ className,
60
+ style
61
+ }));
62
+ },
63
+
64
+ migrate(attributes) {
65
+ const {
66
+ color,
67
+ customColor
68
+ } = attributes;
69
+ return { ...(0, _lodash.omit)(attributes, ['color', 'customColor']),
70
+ backgroundColor: color ? color : undefined,
71
+ opacity: 'css',
72
+ style: customColor ? {
73
+ color: {
74
+ background: customColor
75
+ }
76
+ } : undefined
77
+ };
78
+ }
79
+
80
+ };
81
+ var _default = [v1];
82
+ exports.default = _default;
83
+ //# sourceMappingURL=deprecated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-library/src/separator/deprecated.js"],"names":["v1","attributes","color","type","customColor","save","backgroundClass","colorClass","className","style","backgroundColor","undefined","useBlockProps","migrate","opacity","background"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGA,MAAMA,EAAE,GAAG;AACVC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U,EAAEX;AAAd;AAAT,OADe,GAEfO;AANG,KAAP;AAQA;;AA1CS,CAAX;eA6Ce,CAAEX,EAAF,C","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"]}
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.default = void 0;
8
+ exports.default = SeparatorEdit;
9
9
 
10
10
  var _element = require("@wordpress/element");
11
11
 
@@ -15,7 +15,7 @@ var _components = require("@wordpress/components");
15
15
 
16
16
  var _blockEditor = require("@wordpress/block-editor");
17
17
 
18
- var _separatorSettings = _interopRequireDefault(require("./separator-settings"));
18
+ var _useDeprecatedOpacity = _interopRequireDefault(require("./use-deprecated-opacity"));
19
19
 
20
20
  /**
21
21
  * External dependencies
@@ -29,29 +29,37 @@ var _separatorSettings = _interopRequireDefault(require("./separator-settings"))
29
29
  * Internal dependencies
30
30
  */
31
31
  function SeparatorEdit(_ref) {
32
+ var _colorProps$style, _style$color;
33
+
32
34
  let {
33
- color,
34
- setColor,
35
- className
35
+ attributes,
36
+ setAttributes
36
37
  } = _ref;
38
+ const {
39
+ backgroundColor,
40
+ opacity,
41
+ style
42
+ } = attributes;
43
+ const colorProps = (0, _blockEditor.__experimentalUseColorProps)(attributes);
44
+ const currentColor = colorProps === null || colorProps === void 0 ? void 0 : (_colorProps$style = colorProps.style) === null || _colorProps$style === void 0 ? void 0 : _colorProps$style.backgroundColor;
45
+ const hasCustomColor = !!(style !== null && style !== void 0 && (_style$color = style.color) !== null && _style$color !== void 0 && _style$color.background);
46
+ (0, _useDeprecatedOpacity.default)(opacity, currentColor, setAttributes); // The dots styles uses text for the dots, to change those dots color is
47
+ // using color, not backgroundColor.
48
+
49
+ const colorClass = (0, _blockEditor.getColorClassName)('color', backgroundColor);
50
+ const className = (0, _classnames.default)({
51
+ 'has-text-color': backgroundColor || currentColor,
52
+ [colorClass]: colorClass,
53
+ 'has-css-opacity': opacity === 'css',
54
+ 'has-alpha-channel-opacity': opacity === 'alpha-channel'
55
+ }, colorProps.classname);
56
+ const styles = {
57
+ color: currentColor,
58
+ backgroundColor: currentColor
59
+ };
37
60
  return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.HorizontalRule, (0, _blockEditor.useBlockProps)({
38
- className: (0, _classnames.default)(className, {
39
- 'has-background': color.color,
40
- [color.class]: color.class
41
- }),
42
- style: {
43
- backgroundColor: color.color,
44
- color: color.color
45
- }
46
- })), (0, _element.createElement)(_separatorSettings.default, {
47
- color: color,
48
- setColor: setColor
49
- }));
61
+ className,
62
+ style: hasCustomColor ? styles : undefined
63
+ })));
50
64
  }
51
-
52
- var _default = (0, _blockEditor.withColors)('color', {
53
- textColor: 'color'
54
- })(SeparatorEdit);
55
-
56
- exports.default = _default;
57
65
  //# sourceMappingURL=edit.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/separator/edit.js"],"names":["SeparatorEdit","color","setColor","className","class","style","backgroundColor","textColor"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AAIA;;AAbA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AAGA,SAASA,aAAT,OAAyD;AAAA,MAAjC;AAAEC,IAAAA,KAAF;AAASC,IAAAA,QAAT;AAAmBC,IAAAA;AAAnB,GAAiC;AACxD,SACC,qDACC,4BAAC,0BAAD,EACM,gCAAe;AACnBA,IAAAA,SAAS,EAAE,yBAAYA,SAAZ,EAAuB;AACjC,wBAAkBF,KAAK,CAACA,KADS;AAEjC,OAAEA,KAAK,CAACG,KAAR,GAAiBH,KAAK,CAACG;AAFU,KAAvB,CADQ;AAKnBC,IAAAA,KAAK,EAAE;AACNC,MAAAA,eAAe,EAAEL,KAAK,CAACA,KADjB;AAENA,MAAAA,KAAK,EAAEA,KAAK,CAACA;AAFP;AALY,GAAf,CADN,CADD,EAaC,4BAAC,0BAAD;AAAmB,IAAA,KAAK,EAAGA,KAA3B;AAAmC,IAAA,QAAQ,EAAGC;AAA9C,IAbD,CADD;AAiBA;;eAEc,6BAAY,OAAZ,EAAqB;AAAEK,EAAAA,SAAS,EAAE;AAAb,CAArB,EAA+CP,aAA/C,C","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":["SeparatorEdit","attributes","setAttributes","backgroundColor","opacity","style","colorProps","currentColor","hasCustomColor","color","background","colorClass","className","classname","styles","undefined"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AASA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;AAGe,SAASA,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,GAAG,8CAAeL,UAAf,CAAnB;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;AAEA,qCAAsBN,OAAtB,EAA+BG,YAA/B,EAA6CL,aAA7C,EANsE,CAQtE;AACA;;AACA,QAAMS,UAAU,GAAG,oCAAmB,OAAnB,EAA4BR,eAA5B,CAAnB;AAEA,QAAMS,SAAS,GAAG,yBACjB;AACC,sBAAkBT,eAAe,IAAII,YADtC;AAEC,KAAEI,UAAF,GAAgBA,UAFjB;AAGC,uBAAmBP,OAAO,KAAK,KAHhC;AAIC,iCAA6BA,OAAO,KAAK;AAJ1C,GADiB,EAOjBE,UAAU,CAACO,SAPM,CAAlB;AAUA,QAAMC,MAAM,GAAG;AACdL,IAAAA,KAAK,EAAEF,YADO;AAEdJ,IAAAA,eAAe,EAAEI;AAFH,GAAf;AAKA,SACC,qDACC,4BAAC,0BAAD,EACM,gCAAe;AACnBK,IAAAA,SADmB;AAEnBP,IAAAA,KAAK,EAAEG,cAAc,GAAGM,MAAH,GAAYC;AAFd,GAAf,CADN,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"]}
@@ -15,6 +15,8 @@ var _save = _interopRequireDefault(require("./save"));
15
15
 
16
16
  var _transforms = _interopRequireDefault(require("./transforms"));
17
17
 
18
+ var _deprecated = _interopRequireDefault(require("./deprecated"));
19
+
18
20
  /**
19
21
  * WordPress dependencies
20
22
  */
@@ -32,16 +34,23 @@ const metadata = {
32
34
  keywords: ["horizontal-line", "hr", "divider"],
33
35
  textdomain: "default",
34
36
  attributes: {
35
- color: {
36
- type: "string"
37
- },
38
- customColor: {
39
- type: "string"
37
+ opacity: {
38
+ type: "string",
39
+ "default": "alpha-channel"
40
40
  }
41
41
  },
42
42
  supports: {
43
43
  anchor: true,
44
- align: ["center", "wide", "full"]
44
+ align: ["center", "wide", "full"],
45
+ color: {
46
+ __experimentalSkipSerialization: true,
47
+ gradients: true,
48
+ background: true,
49
+ text: false,
50
+ __experimentalDefaultControls: {
51
+ background: true
52
+ }
53
+ }
45
54
  },
46
55
  styles: [{
47
56
  name: "default",
@@ -72,7 +81,8 @@ const settings = {
72
81
  },
73
82
  transforms: _transforms.default,
74
83
  edit: _edit.default,
75
- save: _save.default
84
+ save: _save.default,
85
+ deprecated: _deprecated.default
76
86
  };
77
87
  exports.settings = settings;
78
88
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/separator/index.js"],"names":["name","metadata","settings","icon","example","attributes","customColor","className","transforms","edit","save"],"mappings":";;;;;;;;;AAGA;;AAKA;;AAEA;;AACA;;AAXA;AACA;AACA;;AAGA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAIO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,gBADuB;AAEvBC,EAAAA,OAAO,EAAE;AACRC,IAAAA,UAAU,EAAE;AACXC,MAAAA,WAAW,EAAE,SADF;AAEXC,MAAAA,SAAS,EAAE;AAFA;AADJ,GAFc;AAQvBC,EAAAA,UAAU,EAAVA,mBARuB;AASvBC,EAAAA,IAAI,EAAJA,aATuB;AAUvBC,EAAAA,IAAI,EAAJA;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":["name","metadata","settings","icon","example","attributes","customColor","className","transforms","edit","save","deprecated"],"mappings":";;;;;;;;;AAGA;;AAKA;;AAEA;;AACA;;AACA;;AAZA;AACA;AACA;;AAGA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAIO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,gBADuB;AAEvBC,EAAAA,OAAO,EAAE;AACRC,IAAAA,UAAU,EAAE;AACXC,MAAAA,WAAW,EAAE,SADF;AAEXC,MAAAA,SAAS,EAAE;AAFA;AADJ,GAFc;AAQvBC,EAAAA,UAAU,EAAVA,mBARuB;AASvBC,EAAAA,IAAI,EAAJA,aATuB;AAUvBC,EAAAA,IAAI,EAAJA,aAVuB;AAWvBC,EAAAA,UAAU,EAAVA;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"]}
@@ -21,31 +21,36 @@ var _blockEditor = require("@wordpress/block-editor");
21
21
  * WordPress dependencies
22
22
  */
23
23
  function separatorSave(_ref) {
24
+ var _style$color, _colorProps$style;
25
+
24
26
  let {
25
27
  attributes
26
28
  } = _ref;
27
29
  const {
28
- color,
29
- customColor
30
- } = attributes; // The hr support changing color using border-color, since border-color
30
+ backgroundColor,
31
+ style,
32
+ opacity
33
+ } = attributes;
34
+ const customColor = style === null || style === void 0 ? void 0 : (_style$color = style.color) === null || _style$color === void 0 ? void 0 : _style$color.background;
35
+ const colorProps = (0, _blockEditor.__experimentalGetColorClassesAndStyles)(attributes); // The hr support changing color using border-color, since border-color
31
36
  // is not yet supported in the color palette, we use background-color.
32
-
33
- const backgroundClass = (0, _blockEditor.getColorClassName)('background-color', color); // The dots styles uses text for the dots, to change those dots color is
37
+ // The dots styles uses text for the dots, to change those dots color is
34
38
  // using color, not backgroundColor.
35
39
 
36
- const colorClass = (0, _blockEditor.getColorClassName)('color', color);
40
+ const colorClass = (0, _blockEditor.getColorClassName)('color', backgroundColor);
37
41
  const className = (0, _classnames.default)({
38
- 'has-text-color has-background': color || customColor,
39
- [backgroundClass]: backgroundClass,
40
- [colorClass]: colorClass
41
- });
42
- const style = {
43
- backgroundColor: backgroundClass ? undefined : customColor,
42
+ 'has-text-color': backgroundColor || customColor,
43
+ [colorClass]: colorClass,
44
+ 'has-css-opacity': opacity === 'css',
45
+ 'has-alpha-channel-opacity': opacity === 'alpha-channel'
46
+ }, colorProps.className);
47
+ const styles = {
48
+ backgroundColor: colorProps === null || colorProps === void 0 ? void 0 : (_colorProps$style = colorProps.style) === null || _colorProps$style === void 0 ? void 0 : _colorProps$style.backgroundColor,
44
49
  color: colorClass ? undefined : customColor
45
50
  };
46
51
  return (0, _element.createElement)("hr", _blockEditor.useBlockProps.save({
47
52
  className,
48
- style
53
+ style: styles
49
54
  }));
50
55
  }
51
56
  //# sourceMappingURL=save.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/separator/save.js"],"names":["separatorSave","attributes","color","customColor","backgroundClass","colorClass","className","style","backgroundColor","undefined","useBlockProps","save"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAGe,SAASA,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,GAAG,oCAAmB,kBAAnB,EAAuCF,KAAvC,CAAxB,CALuD,CAMvD;AACA;;AACA,QAAMG,UAAU,GAAG,oCAAmB,OAAnB,EAA4BH,KAA5B,CAAnB;AAEA,QAAMI,SAAS,GAAG,yBAAY;AAC7B,qCAAiCJ,KAAK,IAAIC,WADb;AAE7B,KAAEC,eAAF,GAAqBA,eAFQ;AAG7B,KAAEC,UAAF,GAAgBA;AAHa,GAAZ,CAAlB;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,kCAASO,2BAAcC,IAAd,CAAoB;AAAEL,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":["separatorSave","attributes","backgroundColor","style","opacity","customColor","color","background","colorProps","colorClass","className","styles","undefined","useBlockProps","save"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAOe,SAASA,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,GAAG,yDAA0BP,UAA1B,CAAnB,CAHuD,CAIvD;AACA;AAEA;AACA;;AACA,QAAMQ,UAAU,GAAG,oCAAmB,OAAnB,EAA4BP,eAA5B,CAAnB;AAEA,QAAMQ,SAAS,GAAG,yBACjB;AACC,sBAAkBR,eAAe,IAAIG,WADtC;AAEC,KAAEI,UAAF,GAAgBA,UAFjB;AAGC,uBAAmBL,OAAO,KAAK,KAHhC;AAIC,iCAA6BA,OAAO,KAAK;AAJ1C,GADiB,EAOjBI,UAAU,CAACE,SAPM,CAAlB;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,kCAASQ,2BAAcC,IAAd,CAAoB;AAAEJ,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,39 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = useDeprecatedOpacity;
7
+
8
+ var _element = require("@wordpress/element");
9
+
10
+ var _compose = require("@wordpress/compose");
11
+
12
+ /**
13
+ * WordPress dependencies
14
+ */
15
+ function useDeprecatedOpacity(opacity, currentColor, setAttributes) {
16
+ const [deprecatedOpacityWithNoColor, setDeprecatedOpacityWithNoColor] = (0, _element.useState)(false);
17
+ const previousColor = (0, _compose.usePrevious)(currentColor); // A separator with no color set will always have previousColor set to undefined,
18
+ // and we need to differentiate these from those with color set that will return
19
+ // previousColor as undefined on the first render.
20
+
21
+ (0, _element.useEffect)(() => {
22
+ if (opacity === 'css' && !currentColor && !previousColor) {
23
+ setDeprecatedOpacityWithNoColor(true);
24
+ }
25
+ }, [currentColor, previousColor, opacity]); // For deprecated blocks, that have a default 0.4 css opacity set, we
26
+ // need to remove this if the current color is changed, or a color is added.
27
+ // In these instances the opacity attribute is set back to the default of
28
+ // alpha-channel which allows a new custom opacity to be set via the color picker.
29
+
30
+ (0, _element.useEffect)(() => {
31
+ if (opacity === 'css' && (deprecatedOpacityWithNoColor && currentColor || previousColor && currentColor !== previousColor)) {
32
+ setAttributes({
33
+ opacity: 'alpha-channel'
34
+ });
35
+ setDeprecatedOpacityWithNoColor(false);
36
+ }
37
+ }, [deprecatedOpacityWithNoColor, currentColor, previousColor]);
38
+ }
39
+ //# sourceMappingURL=use-deprecated-opacity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-library/src/separator/use-deprecated-opacity.js"],"names":["useDeprecatedOpacity","opacity","currentColor","setAttributes","deprecatedOpacityWithNoColor","setDeprecatedOpacityWithNoColor","previousColor"],"mappings":";;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIe,SAASA,oBAAT,CACdC,OADc,EAEdC,YAFc,EAGdC,aAHc,EAIb;AACD,QAAM,CACLC,4BADK,EAELC,+BAFK,IAGF,uBAAU,KAAV,CAHJ;AAIA,QAAMC,aAAa,GAAG,0BAAaJ,YAAb,CAAtB,CALC,CAOD;AACA;AACA;;AACA,0BAAW,MAAM;AAChB,QAAKD,OAAO,KAAK,KAAZ,IAAqB,CAAEC,YAAvB,IAAuC,CAAEI,aAA9C,EAA8D;AAC7DD,MAAAA,+BAA+B,CAAE,IAAF,CAA/B;AACA;AACD,GAJD,EAIG,CAAEH,YAAF,EAAgBI,aAAhB,EAA+BL,OAA/B,CAJH,EAVC,CAgBD;AACA;AACA;AACA;;AACA,0BAAW,MAAM;AAChB,QACCA,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,GATD,EASG,CAAED,4BAAF,EAAgCF,YAAhC,EAA8CI,aAA9C,CATH;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"]}
@@ -389,8 +389,9 @@ function LogoEdit(_ref2) {
389
389
  });
390
390
  };
391
391
 
392
- const setIcon = newValue => editEntityRecord('root', 'site', undefined, {
393
- site_icon: newValue
392
+ const setIcon = newValue => // The new value needs to be `null` to reset the Site Icon.
393
+ editEntityRecord('root', 'site', undefined, {
394
+ site_icon: newValue !== null && newValue !== void 0 ? newValue : null
394
395
  });
395
396
 
396
397
  let alt = null;