@wordpress/block-library 7.1.1 → 7.2.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 (304) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/build/avatar/edit.js +205 -0
  3. package/build/avatar/edit.js.map +1 -0
  4. package/build/avatar/hooks.js +111 -0
  5. package/build/avatar/hooks.js.map +1 -0
  6. package/build/avatar/index.js +83 -0
  7. package/build/avatar/index.js.map +1 -0
  8. package/build/avatar/user-control.js +63 -0
  9. package/build/avatar/user-control.js.map +1 -0
  10. package/build/column/index.js +2 -1
  11. package/build/column/index.js.map +1 -1
  12. package/build/comment-author-avatar/index.js +1 -0
  13. package/build/comment-author-avatar/index.js.map +1 -1
  14. package/build/comment-date/edit.js +10 -25
  15. package/build/comment-date/edit.js.map +1 -1
  16. package/build/comment-template/edit.js +79 -52
  17. package/build/comment-template/edit.js.map +1 -1
  18. package/build/cover/edit.js +23 -33
  19. package/build/cover/edit.js.map +1 -1
  20. package/build/embed/variations.js +2 -2
  21. package/build/embed/variations.js.map +1 -1
  22. package/build/gallery/edit.js +18 -5
  23. package/build/gallery/edit.js.map +1 -1
  24. package/build/gallery/gallery.js +1 -1
  25. package/build/gallery/gallery.js.map +1 -1
  26. package/build/gallery/gap-styles.js +29 -0
  27. package/build/gallery/gap-styles.js.map +1 -0
  28. package/build/gallery/index.js +17 -1
  29. package/build/gallery/index.js.map +1 -1
  30. package/build/group/index.js +3 -1
  31. package/build/group/index.js.map +1 -1
  32. package/build/group/variations.js +1 -2
  33. package/build/group/variations.js.map +1 -1
  34. package/build/image/image.js +3 -1
  35. package/build/image/image.js.map +1 -1
  36. package/build/index.js +8 -2
  37. package/build/index.js.map +1 -1
  38. package/build/list/index.js +5 -7
  39. package/build/list/index.js.map +1 -1
  40. package/build/list/v2/edit.js +85 -0
  41. package/build/list/v2/edit.js.map +1 -0
  42. package/build/list/v2/index.js +33 -0
  43. package/build/list/v2/index.js.map +1 -0
  44. package/build/list/v2/save.js +34 -0
  45. package/build/list/v2/save.js.map +1 -0
  46. package/build/list/v2/transforms.js +121 -0
  47. package/build/list/v2/transforms.js.map +1 -0
  48. package/build/list-item/edit.js +47 -0
  49. package/build/list-item/edit.js.map +1 -0
  50. package/build/list-item/index.js +67 -0
  51. package/build/list-item/index.js.map +1 -0
  52. package/build/list-item/save.js +23 -0
  53. package/build/list-item/save.js.map +1 -0
  54. package/build/media-text/edit.js +3 -1
  55. package/build/media-text/edit.js.map +1 -1
  56. package/build/navigation/use-navigation-entities.js +26 -54
  57. package/build/navigation/use-navigation-entities.js.map +1 -1
  58. package/build/navigation-link/edit.js +88 -34
  59. package/build/navigation-link/edit.js.map +1 -1
  60. package/build/post-date/edit.js +31 -37
  61. package/build/post-date/edit.js.map +1 -1
  62. package/build/post-featured-image/edit.js +2 -1
  63. package/build/post-featured-image/edit.js.map +1 -1
  64. package/build/pullquote/edit.js +5 -3
  65. package/build/pullquote/edit.js.map +1 -1
  66. package/build/query/variations.js +4 -4
  67. package/build/query/variations.js.map +1 -1
  68. package/build/query-no-results/edit.js +28 -0
  69. package/build/query-no-results/edit.js.map +1 -0
  70. package/build/query-no-results/index.js +54 -0
  71. package/build/query-no-results/index.js.map +1 -0
  72. package/build/query-no-results/save.js +18 -0
  73. package/build/query-no-results/save.js.map +1 -0
  74. package/build/search/edit.js +2 -3
  75. package/build/search/edit.js.map +1 -1
  76. package/build/separator/deprecated.js +83 -0
  77. package/build/separator/deprecated.js.map +1 -0
  78. package/build/separator/edit.js +31 -23
  79. package/build/separator/edit.js.map +1 -1
  80. package/build/separator/index.js +17 -7
  81. package/build/separator/index.js.map +1 -1
  82. package/build/separator/save.js +18 -13
  83. package/build/separator/save.js.map +1 -1
  84. package/build/separator/use-deprecated-opacity.js +39 -0
  85. package/build/separator/use-deprecated-opacity.js.map +1 -0
  86. package/build/social-links/edit.js +14 -3
  87. package/build/social-links/edit.js.map +1 -1
  88. package/build/social-links/index.js +1 -1
  89. package/build/spacer/controls.js +6 -16
  90. package/build/spacer/controls.js.map +1 -1
  91. package/build/spacer/controls.native.js +3 -1
  92. package/build/spacer/controls.native.js.map +1 -1
  93. package/build/spacer/edit.js +4 -5
  94. package/build/spacer/edit.js.map +1 -1
  95. package/build/table/deprecated.js +1 -1
  96. package/build/table/deprecated.js.map +1 -1
  97. package/build/tag-cloud/edit.js +58 -2
  98. package/build/tag-cloud/edit.js.map +1 -1
  99. package/build/tag-cloud/index.js +8 -0
  100. package/build/tag-cloud/index.js.map +1 -1
  101. package/build-module/avatar/edit.js +190 -0
  102. package/build-module/avatar/edit.js.map +1 -0
  103. package/build-module/avatar/hooks.js +99 -0
  104. package/build-module/avatar/hooks.js.map +1 -0
  105. package/build-module/avatar/index.js +70 -0
  106. package/build-module/avatar/index.js.map +1 -0
  107. package/build-module/avatar/user-control.js +52 -0
  108. package/build-module/avatar/user-control.js.map +1 -0
  109. package/build-module/column/index.js +2 -1
  110. package/build-module/column/index.js.map +1 -1
  111. package/build-module/comment-author-avatar/index.js +1 -0
  112. package/build-module/comment-author-avatar/index.js.map +1 -1
  113. package/build-module/comment-date/edit.js +13 -30
  114. package/build-module/comment-date/edit.js.map +1 -1
  115. package/build-module/comment-template/edit.js +79 -52
  116. package/build-module/comment-template/edit.js.map +1 -1
  117. package/build-module/cover/edit.js +23 -34
  118. package/build-module/cover/edit.js.map +1 -1
  119. package/build-module/embed/variations.js +2 -2
  120. package/build-module/embed/variations.js.map +1 -1
  121. package/build-module/gallery/edit.js +17 -5
  122. package/build-module/gallery/edit.js.map +1 -1
  123. package/build-module/gallery/gallery.js +1 -1
  124. package/build-module/gallery/gallery.js.map +1 -1
  125. package/build-module/gallery/gap-styles.js +22 -0
  126. package/build-module/gallery/gap-styles.js.map +1 -0
  127. package/build-module/gallery/index.js +17 -1
  128. package/build-module/gallery/index.js.map +1 -1
  129. package/build-module/group/index.js +3 -1
  130. package/build-module/group/index.js.map +1 -1
  131. package/build-module/group/variations.js +1 -2
  132. package/build-module/group/variations.js.map +1 -1
  133. package/build-module/image/image.js +3 -1
  134. package/build-module/image/image.js.map +1 -1
  135. package/build-module/index.js +5 -2
  136. package/build-module/index.js.map +1 -1
  137. package/build-module/list/index.js +5 -1
  138. package/build-module/list/index.js.map +1 -1
  139. package/build-module/list/v2/edit.js +69 -0
  140. package/build-module/list/v2/edit.js.map +1 -0
  141. package/build-module/list/v2/index.js +19 -0
  142. package/build-module/list/v2/index.js.map +1 -0
  143. package/build-module/list/v2/save.js +23 -0
  144. package/build-module/list/v2/save.js.map +1 -0
  145. package/build-module/list/v2/transforms.js +111 -0
  146. package/build-module/list/v2/transforms.js.map +1 -0
  147. package/build-module/list-item/edit.js +37 -0
  148. package/build-module/list-item/edit.js.map +1 -0
  149. package/build-module/list-item/index.js +53 -0
  150. package/build-module/list-item/index.js.map +1 -0
  151. package/build-module/list-item/save.js +15 -0
  152. package/build-module/list-item/save.js.map +1 -0
  153. package/build-module/media-text/edit.js +3 -1
  154. package/build-module/media-text/edit.js.map +1 -1
  155. package/build-module/navigation/use-navigation-entities.js +27 -54
  156. package/build-module/navigation/use-navigation-entities.js.map +1 -1
  157. package/build-module/navigation-link/edit.js +88 -33
  158. package/build-module/navigation-link/edit.js.map +1 -1
  159. package/build-module/post-date/edit.js +32 -43
  160. package/build-module/post-date/edit.js.map +1 -1
  161. package/build-module/post-featured-image/edit.js +2 -1
  162. package/build-module/post-featured-image/edit.js.map +1 -1
  163. package/build-module/pullquote/edit.js +6 -3
  164. package/build-module/pullquote/edit.js.map +1 -1
  165. package/build-module/query/variations.js +4 -4
  166. package/build-module/query/variations.js.map +1 -1
  167. package/build-module/query-no-results/edit.js +18 -0
  168. package/build-module/query-no-results/edit.js.map +1 -0
  169. package/build-module/query-no-results/index.js +40 -0
  170. package/build-module/query-no-results/index.js.map +1 -0
  171. package/build-module/query-no-results/save.js +10 -0
  172. package/build-module/query-no-results/save.js.map +1 -0
  173. package/build-module/search/edit.js +2 -3
  174. package/build-module/search/edit.js.map +1 -1
  175. package/build-module/separator/deprecated.js +70 -0
  176. package/build-module/separator/deprecated.js.map +1 -0
  177. package/build-module/separator/edit.js +31 -22
  178. package/build-module/separator/edit.js.map +1 -1
  179. package/build-module/separator/index.js +16 -7
  180. package/build-module/separator/index.js.map +1 -1
  181. package/build-module/separator/save.js +19 -14
  182. package/build-module/separator/save.js.map +1 -1
  183. package/build-module/separator/use-deprecated-opacity.js +30 -0
  184. package/build-module/separator/use-deprecated-opacity.js.map +1 -0
  185. package/build-module/social-links/edit.js +15 -4
  186. package/build-module/social-links/edit.js.map +1 -1
  187. package/build-module/social-links/index.js +1 -1
  188. package/build-module/spacer/controls.js +8 -19
  189. package/build-module/spacer/controls.js.map +1 -1
  190. package/build-module/spacer/controls.native.js +2 -1
  191. package/build-module/spacer/controls.native.js.map +1 -1
  192. package/build-module/spacer/edit.js +3 -3
  193. package/build-module/spacer/edit.js.map +1 -1
  194. package/build-module/table/deprecated.js +1 -1
  195. package/build-module/table/deprecated.js.map +1 -1
  196. package/build-module/tag-cloud/edit.js +60 -4
  197. package/build-module/tag-cloud/edit.js.map +1 -1
  198. package/build-module/tag-cloud/index.js +8 -0
  199. package/build-module/tag-cloud/index.js.map +1 -1
  200. package/build-style/avatar/editor-rtl.css +79 -0
  201. package/build-style/avatar/editor.css +79 -0
  202. package/build-style/editor-rtl.css +23 -2
  203. package/build-style/editor.css +23 -2
  204. package/build-style/gallery/editor-rtl.css +0 -1
  205. package/build-style/gallery/editor.css +0 -1
  206. package/build-style/gallery/style-rtl.css +102 -169
  207. package/build-style/gallery/style.css +102 -169
  208. package/build-style/image/style-rtl.css +2 -0
  209. package/build-style/image/style.css +2 -0
  210. package/build-style/navigation-link/editor-rtl.css +13 -0
  211. package/build-style/navigation-link/editor.css +13 -0
  212. package/build-style/pullquote/style-rtl.css +0 -4
  213. package/build-style/pullquote/style.css +0 -4
  214. package/build-style/separator/editor-rtl.css +3 -0
  215. package/build-style/separator/editor.css +3 -0
  216. package/build-style/separator/theme-rtl.css +7 -1
  217. package/build-style/separator/theme.css +7 -1
  218. package/build-style/site-logo/editor-rtl.css +3 -1
  219. package/build-style/site-logo/editor.css +3 -1
  220. package/build-style/style-rtl.css +104 -173
  221. package/build-style/style.css +104 -173
  222. package/build-style/theme-rtl.css +7 -1
  223. package/build-style/theme.css +7 -1
  224. package/package.json +28 -28
  225. package/src/avatar/block.json +53 -0
  226. package/src/avatar/edit.js +222 -0
  227. package/src/avatar/editor.scss +3 -0
  228. package/src/avatar/hooks.js +96 -0
  229. package/src/avatar/index.js +18 -0
  230. package/src/avatar/index.php +146 -0
  231. package/src/avatar/user-control.js +56 -0
  232. package/src/column/block.json +2 -1
  233. package/src/comment-author-avatar/block.json +1 -0
  234. package/src/comment-date/edit.js +20 -30
  235. package/src/comment-template/edit.js +65 -44
  236. package/src/cover/edit.js +26 -31
  237. package/src/editor.scss +1 -0
  238. package/src/embed/variations.js +2 -2
  239. package/src/gallery/block.json +17 -1
  240. package/src/gallery/deprecated.scss +2 -2
  241. package/src/gallery/edit.js +15 -8
  242. package/src/gallery/editor.scss +0 -1
  243. package/src/gallery/gallery.js +8 -7
  244. package/src/gallery/gap-styles.js +21 -0
  245. package/src/gallery/index.php +42 -1
  246. package/src/gallery/style.scss +11 -44
  247. package/src/group/block.json +3 -1
  248. package/src/group/variations.js +1 -1
  249. package/src/image/image.js +4 -1
  250. package/src/image/style.scss +3 -0
  251. package/src/index.js +6 -1
  252. package/src/list/index.js +6 -1
  253. package/src/list/v2/edit.js +77 -0
  254. package/src/list/v2/index.js +20 -0
  255. package/src/list/v2/save.js +18 -0
  256. package/src/list/v2/transforms.js +116 -0
  257. package/src/list-item/block.json +26 -0
  258. package/src/list-item/edit.js +47 -0
  259. package/src/list-item/index.js +27 -0
  260. package/src/list-item/save.js +13 -0
  261. package/src/media-text/edit.js +1 -1
  262. package/src/navigation/index.php +22 -2
  263. package/src/navigation/use-navigation-entities.js +37 -73
  264. package/src/navigation-link/edit.js +145 -61
  265. package/src/navigation-link/editor.scss +11 -0
  266. package/src/post-date/edit.js +63 -52
  267. package/src/post-date/index.php +1 -1
  268. package/src/post-date/test/edit.js +17 -0
  269. package/src/post-featured-image/edit.js +9 -1
  270. package/src/post-featured-image/index.php +2 -1
  271. package/src/pullquote/edit.js +4 -3
  272. package/src/pullquote/style.scss +0 -5
  273. package/src/query/variations.js +4 -0
  274. package/src/query-no-results/block.json +20 -0
  275. package/src/query-no-results/edit.js +28 -0
  276. package/src/query-no-results/index.js +20 -0
  277. package/src/query-no-results/index.php +59 -0
  278. package/src/query-no-results/save.js +8 -0
  279. package/src/search/edit.js +1 -2
  280. package/src/separator/block.json +13 -6
  281. package/src/separator/deprecated.js +57 -0
  282. package/src/separator/deprecated.scss +6 -0
  283. package/src/separator/edit.js +36 -14
  284. package/src/separator/editor.scss +6 -0
  285. package/src/separator/index.js +2 -0
  286. package/src/separator/save.js +22 -14
  287. package/src/separator/test/edit.js +113 -0
  288. package/src/separator/theme.scss +7 -1
  289. package/src/separator/use-deprecated-opacity.js +41 -0
  290. package/src/site-logo/editor.scss +3 -1
  291. package/src/social-links/block.json +1 -1
  292. package/src/social-links/edit.js +15 -5
  293. package/src/spacer/controls.js +12 -18
  294. package/src/spacer/controls.native.js +2 -1
  295. package/src/spacer/edit.js +3 -6
  296. package/src/table/deprecated.js +5 -1
  297. package/src/tag-cloud/block.json +8 -0
  298. package/src/tag-cloud/edit.js +82 -2
  299. package/src/tag-cloud/index.php +6 -0
  300. package/build/separator/separator-settings.js +0 -36
  301. package/build/separator/separator-settings.js.map +0 -1
  302. package/build-module/separator/separator-settings.js +0 -27
  303. package/build-module/separator/separator-settings.js.map +0 -1
  304. package/src/separator/separator-settings.js +0 -24
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/post-featured-image/edit.js"],"names":["placeholderIllustration","ALLOWED_MEDIA_TYPES","placeholderChip","getMediaSourceUrlBySizeSlug","media","slug","media_details","sizes","source_url","PostFeaturedImageDisplay","clientId","attributes","setAttributes","context","postId","postType","queryId","isDescendentOfQueryLoop","Number","isFinite","isLink","height","width","scale","sizeSlug","featuredImage","setFeaturedImage","select","coreStore","getMedia","mediaUrl","imageSizes","blockEditorStore","getSettings","imageSizeOptions","filter","map","name","value","label","blockProps","style","placeholder","content","onSelectImage","id","createErrorNotice","noticesStore","onUploadError","message","type","controls","image","open","upload","alt_text","objectFit","PostFeaturedImageEdit","props"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAOA;;AAQA;;AACA;;AACA;;AACA;;AAKA;;AA5BA;AACA;AACA;;AAuBA;AACA;AACA;AAGA,MAAMA,uBAAuB,GAC5B,4BAAC,eAAD;AACC,EAAA,SAAS,EAAC,sCADX;AAEC,EAAA,IAAI,EAAC,MAFN;AAGC,EAAA,KAAK,EAAC,4BAHP;AAIC,EAAA,OAAO,EAAC,WAJT;AAKC,EAAA,mBAAmB,EAAC;AALrB,GAOC,4BAAC,gBAAD;AAAM,EAAA,YAAY,EAAC,oBAAnB;AAAwC,EAAA,CAAC,EAAC;AAA1C,EAPD,CADD;AAYA,MAAMC,mBAAmB,GAAG,CAAE,OAAF,CAA5B;AACA,MAAMC,eAAe,GACpB;AAAK,EAAA,SAAS,EAAC;AAAf,GACGF,uBADH,CADD;;AAMA,SAASG,2BAAT,CAAsCC,KAAtC,EAA6CC,IAA7C,EAAoD;AAAA;;AACnD,SACC,CAAAD,KAAK,SAAL,IAAAA,KAAK,WAAL,oCAAAA,KAAK,CAAEE,aAAP,uGAAsBC,KAAtB,0GAA+BF,IAA/B,mFAAuCG,UAAvC,MAAqDJ,KAArD,aAAqDA,KAArD,uBAAqDA,KAAK,CAAEI,UAA5D,CADD;AAGA;;AAED,SAASC,wBAAT,OAKI;AAAA,MAL+B;AAClCC,IAAAA,QADkC;AAElCC,IAAAA,UAFkC;AAGlCC,IAAAA,aAHkC;AAIlCC,IAAAA,OAAO,EAAE;AAAEC,MAAAA,MAAF;AAAUC,MAAAA,QAAV;AAAoBC,MAAAA;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;AAKC,IAAA,QAAQ,EAAG2C,aALZ;AAMC,IAAA,OAAO,EAAGI;AANX,KAQC,4BAAC,oBAAD;AAAU,IAAA,OAAO,EAAG,MAAMtB,gBAAgB,CAAE,CAAF;AAA1C,KACG,cAAI,OAAJ,CADH,CARD,CADD,CAHF,EAkBC,sCAAac,UAAb,EAA4BY,KAA5B,CAlBD,CADD;AAsBA;;AAEc,SAASK,qBAAT,CAAgCC,KAAhC,EAAwC;AAAA;;AACtD,QAAMlB,UAAU,GAAG,iCAAnB;;AACA,MAAK,oBAAEkB,KAAK,CAAC7C,OAAR,2CAAE,eAAeC,MAAjB,CAAL,EAA+B;AAC9B,WAAO,mCAAU0B,UAAV,EAAyBtC,eAAzB,CAAP;AACA;;AACD,SAAO,4BAAC,wBAAD,EAA+BwD,KAA/B,CAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tMenuItem,\n\tToggleControl,\n\tPanelBody,\n\tPlaceholder,\n\tButton,\n} from '@wordpress/components';\nimport {\n\tInspectorControls,\n\tBlockControls,\n\tMediaPlaceholder,\n\tMediaReplaceFlow,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { upload } from '@wordpress/icons';\nimport { SVG, Path } from '@wordpress/primitives';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport DimensionControls from './dimension-controls';\n\nconst placeholderIllustration = (\n\t<SVG\n\t\tclassName=\"components-placeholder__illustration\"\n\t\tfill=\"none\"\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\tviewBox=\"0 0 60 60\"\n\t\tpreserveAspectRatio=\"none\"\n\t>\n\t\t<Path vectorEffect=\"non-scaling-stroke\" d=\"M60 60 0 0\" />\n\t</SVG>\n);\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\nconst placeholderChip = (\n\t<div className=\"wp-block-post-featured-image__placeholder\">\n\t\t{ placeholderIllustration }\n\t</div>\n);\n\nfunction getMediaSourceUrlBySizeSlug( media, slug ) {\n\treturn (\n\t\tmedia?.media_details?.sizes?.[ slug ]?.source_url || media?.source_url\n\t);\n}\n\nfunction PostFeaturedImageDisplay( {\n\tclientId,\n\tattributes,\n\tsetAttributes,\n\tcontext: { postId, postType, queryId },\n} ) {\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst { isLink, height, width, scale, sizeSlug } = attributes;\n\tconst [ featuredImage, setFeaturedImage ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'featured_media',\n\t\tpostId\n\t);\n\n\tconst media = useSelect(\n\t\t( select ) =>\n\t\t\tfeaturedImage &&\n\t\t\tselect( coreStore ).getMedia( featuredImage, { context: 'view' } ),\n\t\t[ featuredImage ]\n\t);\n\tconst mediaUrl = getMediaSourceUrlBySizeSlug( media, sizeSlug );\n\n\tconst imageSizes = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings().imageSizes,\n\t\t[]\n\t);\n\tconst imageSizeOptions = imageSizes\n\t\t.filter( ( { slug } ) => {\n\t\t\treturn media?.media_details?.sizes?.[ slug ]?.source_url;\n\t\t} )\n\t\t.map( ( { name, slug } ) => ( {\n\t\t\tvalue: slug,\n\t\t\tlabel: name,\n\t\t} ) );\n\n\tconst blockProps = useBlockProps( {\n\t\tstyle: { width, height },\n\t} );\n\n\tconst placeholder = ( content ) => {\n\t\treturn (\n\t\t\t<Placeholder className=\"block-editor-media-placeholder\">\n\t\t\t\t{ placeholderIllustration }\n\t\t\t\t{ content }\n\t\t\t</Placeholder>\n\t\t);\n\t};\n\n\tconst onSelectImage = ( value ) => {\n\t\tif ( value?.id ) {\n\t\t\tsetFeaturedImage( value.id );\n\t\t}\n\t};\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst onUploadError = ( message ) => {\n\t\tcreateErrorNotice( message[ 2 ], { type: 'snackbar' } );\n\t};\n\n\tconst controls = (\n\t\t<>\n\t\t\t<DimensionControls\n\t\t\t\tclientId={ clientId }\n\t\t\t\tattributes={ attributes }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\timageSizeOptions={ imageSizeOptions }\n\t\t\t/>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Link settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"post\".\n\t\t\t\t\t\t\t__( 'Link to %s' ),\n\t\t\t\t\t\t\tpostType\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonChange={ () => setAttributes( { isLink: ! isLink } ) }\n\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n\tlet image;\n\tif ( ! featuredImage && isDescendentOfQueryLoop ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ controls }\n\t\t\t\t<div { ...blockProps }>{ placeholderChip }</div>\n\t\t\t</>\n\t\t);\n\t}\n\n\tconst label = __( 'Add a featured image' );\n\n\tif ( ! featuredImage ) {\n\t\timage = (\n\t\t\t<MediaPlaceholder\n\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\taccept=\"image/*\"\n\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\tonError={ onUploadError }\n\t\t\t\tplaceholder={ placeholder }\n\t\t\t\tmediaLibraryButton={ ( { open } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ticon={ upload }\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\ttooltipPosition=\"top center\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\topen();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t/>\n\t\t);\n\t} else {\n\t\t// We have a Featured image so show a Placeholder if is loading.\n\t\timage = ! media ? (\n\t\t\tplaceholderChip\n\t\t) : (\n\t\t\t<img\n\t\t\t\tsrc={ mediaUrl }\n\t\t\t\talt={ media.alt_text || __( 'Featured image' ) }\n\t\t\t\tstyle={ { height, objectFit: height && scale } }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ controls }\n\t\t\t{ !! media && ! isDescendentOfQueryLoop && (\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\t\tmediaId={ featuredImage }\n\t\t\t\t\t\tmediaURL={ mediaUrl }\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\taccept=\"image/*\"\n\t\t\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\t>\n\t\t\t\t\t\t<MenuItem onClick={ () => setFeaturedImage( 0 ) }>\n\t\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t</MediaReplaceFlow>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t<figure { ...blockProps }>{ image }</figure>\n\t\t</>\n\t);\n}\n\nexport default function PostFeaturedImageEdit( props ) {\n\tconst blockProps = useBlockProps();\n\tif ( ! props.context?.postId ) {\n\t\treturn <div { ...blockProps }>{ placeholderChip }</div>;\n\t}\n\treturn <PostFeaturedImageDisplay { ...props } />;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/post-featured-image/edit.js"],"names":["placeholderIllustration","ALLOWED_MEDIA_TYPES","placeholderChip","getMediaSourceUrlBySizeSlug","media","slug","media_details","sizes","source_url","PostFeaturedImageDisplay","clientId","attributes","setAttributes","context","postId","postType","queryId","isDescendentOfQueryLoop","Number","isFinite","isLink","height","width","scale","sizeSlug","featuredImage","setFeaturedImage","select","coreStore","getMedia","mediaUrl","imageSizes","blockEditorStore","getSettings","imageSizeOptions","filter","map","name","value","label","blockProps","style","placeholder","content","onSelectImage","id","createErrorNotice","noticesStore","onUploadError","message","type","controls","image","open","upload","alt_text","objectFit","PostFeaturedImageEdit","props"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAOA;;AAQA;;AACA;;AACA;;AACA;;AAKA;;AA5BA;AACA;AACA;;AAuBA;AACA;AACA;AAGA,MAAMA,uBAAuB,GAC5B,4BAAC,eAAD;AACC,EAAA,SAAS,EAAC,sCADX;AAEC,EAAA,IAAI,EAAC,MAFN;AAGC,EAAA,KAAK,EAAC,4BAHP;AAIC,EAAA,OAAO,EAAC,WAJT;AAKC,EAAA,mBAAmB,EAAC;AALrB,GAOC,4BAAC,gBAAD;AAAM,EAAA,YAAY,EAAC,oBAAnB;AAAwC,EAAA,CAAC,EAAC;AAA1C,EAPD,CADD;AAYA,MAAMC,mBAAmB,GAAG,CAAE,OAAF,CAA5B;AACA,MAAMC,eAAe,GACpB;AAAK,EAAA,SAAS,EAAC;AAAf,GACGF,uBADH,CADD;;AAMA,SAASG,2BAAT,CAAsCC,KAAtC,EAA6CC,IAA7C,EAAoD;AAAA;;AACnD,SACC,CAAAD,KAAK,SAAL,IAAAA,KAAK,WAAL,oCAAAA,KAAK,CAAEE,aAAP,uGAAsBC,KAAtB,0GAA+BF,IAA/B,mFAAuCG,UAAvC,MAAqDJ,KAArD,aAAqDA,KAArD,uBAAqDA,KAAK,CAAEI,UAA5D,CADD;AAGA;;AAED,SAASC,wBAAT,OAKI;AAAA,MAL+B;AAClCC,IAAAA,QADkC;AAElCC,IAAAA,UAFkC;AAGlCC,IAAAA,aAHkC;AAIlCC,IAAAA,OAAO,EAAE;AAAEC,MAAAA,MAAF;AAAUC,MAAAA,QAAV;AAAoBC,MAAAA;AAApB;AAJyB,GAK/B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Y,EAAG7B,mBAHhB;AAIC,IAAA,MAAM,EAAC,SAJR;AAKC,IAAA,QAAQ,EAAG2C,aALZ;AAMC,IAAA,OAAO,EAAGI;AANX,KAQC,4BAAC,oBAAD;AAAU,IAAA,OAAO,EAAG,MAAMtB,gBAAgB,CAAE,CAAF;AAA1C,KACG,cAAI,OAAJ,CADH,CARD,CADD,CAHF,EAkBC,sCAAac,UAAb,EAA4BY,KAA5B,CAlBD,CADD;AAsBA;;AAEc,SAASK,qBAAT,CAAgCC,KAAhC,EAAwC;AAAA;;AACtD,QAAMlB,UAAU,GAAG,iCAAnB;;AACA,MAAK,oBAAEkB,KAAK,CAAC7C,OAAR,2CAAE,eAAeC,MAAjB,CAAL,EAA+B;AAC9B,WAAO,mCAAU0B,UAAV,EAAyBtC,eAAzB,CAAP;AACA;;AACD,SAAO,4BAAC,wBAAD,EAA+BwD,KAA/B,CAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tMenuItem,\n\tToggleControl,\n\tPanelBody,\n\tPlaceholder,\n\tButton,\n} from '@wordpress/components';\nimport {\n\tInspectorControls,\n\tBlockControls,\n\tMediaPlaceholder,\n\tMediaReplaceFlow,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { upload } from '@wordpress/icons';\nimport { SVG, Path } from '@wordpress/primitives';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport DimensionControls from './dimension-controls';\n\nconst placeholderIllustration = (\n\t<SVG\n\t\tclassName=\"components-placeholder__illustration\"\n\t\tfill=\"none\"\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\tviewBox=\"0 0 60 60\"\n\t\tpreserveAspectRatio=\"none\"\n\t>\n\t\t<Path vectorEffect=\"non-scaling-stroke\" d=\"M60 60 0 0\" />\n\t</SVG>\n);\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\nconst placeholderChip = (\n\t<div className=\"wp-block-post-featured-image__placeholder\">\n\t\t{ placeholderIllustration }\n\t</div>\n);\n\nfunction getMediaSourceUrlBySizeSlug( media, slug ) {\n\treturn (\n\t\tmedia?.media_details?.sizes?.[ slug ]?.source_url || media?.source_url\n\t);\n}\n\nfunction PostFeaturedImageDisplay( {\n\tclientId,\n\tattributes,\n\tsetAttributes,\n\tcontext: { postId, postType, queryId },\n} ) {\n\tconst isDescendentOfQueryLoop = Number.isFinite( queryId );\n\tconst { isLink, height, width, scale, sizeSlug } = attributes;\n\tconst [ featuredImage, setFeaturedImage ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'featured_media',\n\t\tpostId\n\t);\n\n\tconst media = useSelect(\n\t\t( select ) =>\n\t\t\tfeaturedImage &&\n\t\t\tselect( coreStore ).getMedia( featuredImage, { context: 'view' } ),\n\t\t[ featuredImage ]\n\t);\n\tconst mediaUrl = getMediaSourceUrlBySizeSlug( media, sizeSlug );\n\n\tconst imageSizes = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings().imageSizes,\n\t\t[]\n\t);\n\tconst imageSizeOptions = imageSizes\n\t\t.filter( ( { slug } ) => {\n\t\t\treturn media?.media_details?.sizes?.[ slug ]?.source_url;\n\t\t} )\n\t\t.map( ( { name, slug } ) => ( {\n\t\t\tvalue: slug,\n\t\t\tlabel: name,\n\t\t} ) );\n\n\tconst blockProps = useBlockProps( {\n\t\tstyle: { width, height },\n\t} );\n\n\tconst placeholder = ( content ) => {\n\t\treturn (\n\t\t\t<Placeholder className=\"block-editor-media-placeholder\">\n\t\t\t\t{ placeholderIllustration }\n\t\t\t\t{ content }\n\t\t\t</Placeholder>\n\t\t);\n\t};\n\n\tconst onSelectImage = ( value ) => {\n\t\tif ( value?.id ) {\n\t\t\tsetFeaturedImage( value.id );\n\t\t}\n\t};\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst onUploadError = ( message ) => {\n\t\tcreateErrorNotice( message[ 2 ], { type: 'snackbar' } );\n\t};\n\n\tconst controls = (\n\t\t<>\n\t\t\t<DimensionControls\n\t\t\t\tclientId={ clientId }\n\t\t\t\tattributes={ attributes }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\timageSizeOptions={ imageSizeOptions }\n\t\t\t/>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Link settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"post\".\n\t\t\t\t\t\t\t__( 'Link to %s' ),\n\t\t\t\t\t\t\tpostType\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonChange={ () => setAttributes( { isLink: ! isLink } ) }\n\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n\tlet image;\n\tif ( ! featuredImage && isDescendentOfQueryLoop ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ controls }\n\t\t\t\t<div { ...blockProps }>{ placeholderChip }</div>\n\t\t\t</>\n\t\t);\n\t}\n\n\tconst label = __( 'Add a featured image' );\n\n\tif ( ! featuredImage ) {\n\t\timage = (\n\t\t\t<MediaPlaceholder\n\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\taccept=\"image/*\"\n\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\tonError={ onUploadError }\n\t\t\t\tplaceholder={ placeholder }\n\t\t\t\tmediaLibraryButton={ ( { open } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ticon={ upload }\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\ttooltipPosition=\"top center\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\topen();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t/>\n\t\t);\n\t} else {\n\t\t// We have a Featured image so show a Placeholder if is loading.\n\t\timage = ! media ? (\n\t\t\tplaceholderChip\n\t\t) : (\n\t\t\t<img\n\t\t\t\tsrc={ mediaUrl }\n\t\t\t\talt={\n\t\t\t\t\tmedia.alt_text\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: The image's alt text.\n\t\t\t\t\t\t\t\t__( 'Featured image: %s' ),\n\t\t\t\t\t\t\t\tmedia.alt_text\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: __( 'Featured image' )\n\t\t\t\t}\n\t\t\t\tstyle={ { height, objectFit: height && scale } }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ controls }\n\t\t\t{ !! media && ! isDescendentOfQueryLoop && (\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\t\tmediaId={ featuredImage }\n\t\t\t\t\t\tmediaURL={ mediaUrl }\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\taccept=\"image/*\"\n\t\t\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\t>\n\t\t\t\t\t\t<MenuItem onClick={ () => setFeaturedImage( 0 ) }>\n\t\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t</MediaReplaceFlow>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t<figure { ...blockProps }>{ image }</figure>\n\t\t</>\n\t);\n}\n\nexport default function PostFeaturedImageEdit( props ) {\n\tconst blockProps = useBlockProps();\n\tif ( ! props.context?.postId ) {\n\t\treturn <div { ...blockProps }>{ placeholderChip }</div>;\n\t}\n\treturn <PostFeaturedImageDisplay { ...props } />;\n}\n"]}
@@ -32,10 +32,8 @@ var _blockquote = require("./blockquote");
32
32
  /**
33
33
  * Internal dependencies
34
34
  */
35
+ const isWebPlatform = _element.Platform.OS === 'web';
35
36
 
36
- /**
37
- * Internal dependencies
38
- */
39
37
  function PullQuoteEdit(_ref) {
40
38
  let {
41
39
  attributes,
@@ -76,6 +74,10 @@ function PullQuoteEdit(_ref) {
76
74
  textAlign: "center"
77
75
  }), shouldShowCitation && (0, _element.createElement)(_blockEditor.RichText, {
78
76
  identifier: "citation",
77
+ tagName: isWebPlatform ? 'cite' : undefined,
78
+ style: {
79
+ display: 'block'
80
+ },
79
81
  value: citation,
80
82
  "aria-label": (0, _i18n.__)('Pullquote citation text'),
81
83
  placeholder: // translators: placeholder text used for the citation
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/pullquote/edit.js"],"names":["PullQuoteEdit","attributes","setAttributes","isSelected","insertBlocksAfter","textAlign","citation","value","blockProps","className","shouldShowCitation","RichText","isEmpty","nextAlign","nextValue","nextCitation"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AAMA;;AAKA;;AACA;;AArBA;AACA;AACA;;AAGA;AACA;AACA;;AAUA;AACA;AACA;;AAIA;AACA;AACA;AAEA,SAASA,aAAT,OAKI;AAAA,MALoB;AACvBC,IAAAA,UADuB;AAEvBC,IAAAA,aAFuB;AAGvBC,IAAAA,UAHuB;AAIvBC,IAAAA;AAJuB,GAKpB;AACH,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAAAA,QAAb;AAAuBC,IAAAA;AAAvB,MAAiCN,UAAvC;AACA,QAAMO,UAAU,GAAG,gCAAe;AACjCC,IAAAA,SAAS,EAAE,yBAAY;AACtB,OAAG,kBAAkBJ,SAAW,EAAhC,GAAqCA;AADf,KAAZ;AADsB,GAAf,CAAnB;AAKA,QAAMK,kBAAkB,GAAG,CAAEC,sBAASC,OAAT,CAAkBN,QAAlB,CAAF,IAAkCH,UAA7D;AAEA,SACC,qDACC,4BAAC,0BAAD;AAAe,IAAA,KAAK,EAAC;AAArB,KACC,4BAAC,6BAAD;AACC,IAAA,KAAK,EAAGE,SADT;AAEC,IAAA,QAAQ,EAAKQ,SAAF,IAAiB;AAC3BX,MAAAA,aAAa,CAAE;AAAEG,QAAAA,SAAS,EAAEQ;AAAb,OAAF,CAAb;AACA;AAJF,IADD,CADD,EASC,4BAAC,cAAD,EAAaL,UAAb,EACC,4BAAC,sBAAD,QACC,4BAAC,qBAAD;AACC,IAAA,UAAU,EAAC,OADZ;AAEC,IAAA,SAAS,MAFV;AAGC,IAAA,KAAK,EAAGD,KAHT;AAIC,IAAA,QAAQ,EAAKO,SAAF,IACVZ,aAAa,CAAE;AACdK,MAAAA,KAAK,EAAEO;AADO,KAAF,CALf;AASC,kBAAa,cAAI,gBAAJ,CATd;AAUC,IAAA,WAAW,EACV;AACA,kBAAI,WAAJ,CAZF;AAcC,IAAA,SAAS,EAAC;AAdX,IADD,EAiBGJ,kBAAkB,IACnB,4BAAC,qBAAD;AACC,IAAA,UAAU,EAAC,UADZ;AAEC,IAAA,KAAK,EAAGJ,QAFT;AAGC,kBAAa,cAAI,yBAAJ,CAHd;AAIC,IAAA,WAAW,EACV;AACA,kBAAI,cAAJ,CANF;AAQC,IAAA,QAAQ,EAAKS,YAAF,IACVb,aAAa,CAAE;AACdI,MAAAA,QAAQ,EAAES;AADI,KAAF,CATf;AAaC,IAAA,SAAS,EAAC,8BAbX;AAcC,IAAA,8BAA8B,MAd/B;AAeC,IAAA,SAAS,EAAC,QAfX;AAgBC,IAAA,sBAAsB,EAAG,MACxBX,iBAAiB,CAChB,yBAAa,gBAAb,CADgB;AAjBnB,IAlBF,CADD,CATD,CADD;AAwDA;;eAEcJ,a","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tRichText,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { Figure } from './figure';\nimport { BlockQuote } from './blockquote';\n\n/**\n * Internal dependencies\n */\n\nfunction PullQuoteEdit( {\n\tattributes,\n\tsetAttributes,\n\tisSelected,\n\tinsertBlocksAfter,\n} ) {\n\tconst { textAlign, citation, value } = attributes;\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\tconst shouldShowCitation = ! RichText.isEmpty( citation ) || isSelected;\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<AlignmentControl\n\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\tonChange={ ( nextAlign ) => {\n\t\t\t\t\t\tsetAttributes( { textAlign: nextAlign } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<Figure { ...blockProps }>\n\t\t\t\t<BlockQuote>\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"value\"\n\t\t\t\t\t\tmultiline\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tonChange={ ( nextValue ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tvalue: nextValue,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\taria-label={ __( 'Pullquote text' ) }\n\t\t\t\t\t\tplaceholder={\n\t\t\t\t\t\t\t// translators: placeholder text used for the quote\n\t\t\t\t\t\t\t__( 'Add quote' )\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttextAlign=\"center\"\n\t\t\t\t\t/>\n\t\t\t\t\t{ shouldShowCitation && (\n\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\tidentifier=\"citation\"\n\t\t\t\t\t\t\tvalue={ citation }\n\t\t\t\t\t\t\taria-label={ __( 'Pullquote citation text' ) }\n\t\t\t\t\t\t\tplaceholder={\n\t\t\t\t\t\t\t\t// translators: placeholder text used for the citation\n\t\t\t\t\t\t\t\t__( 'Add citation' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonChange={ ( nextCitation ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tcitation: nextCitation,\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=\"wp-block-pullquote__citation\"\n\t\t\t\t\t\t\t__unstableMobileNoFocusOnMount\n\t\t\t\t\t\t\ttextAlign=\"center\"\n\t\t\t\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\t\t\tcreateBlock( 'core/paragraph' )\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</BlockQuote>\n\t\t\t</Figure>\n\t\t</>\n\t);\n}\n\nexport default PullQuoteEdit;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/pullquote/edit.js"],"names":["isWebPlatform","Platform","OS","PullQuoteEdit","attributes","setAttributes","isSelected","insertBlocksAfter","textAlign","citation","value","blockProps","className","shouldShowCitation","RichText","isEmpty","nextAlign","nextValue","undefined","display","nextCitation"],"mappings":";;;;;;;;;AAgBA;;AAbA;;AAKA;;AACA;;AAMA;;AAMA;;AACA;;AAtBA;AACA;AACA;;AAGA;AACA;AACA;;AAWA;AACA;AACA;AAIA,MAAMA,aAAa,GAAGC,kBAASC,EAAT,KAAgB,KAAtC;;AAEA,SAASC,aAAT,OAKI;AAAA,MALoB;AACvBC,IAAAA,UADuB;AAEvBC,IAAAA,aAFuB;AAGvBC,IAAAA,UAHuB;AAIvBC,IAAAA;AAJuB,GAKpB;AACH,QAAM;AAAEC,IAAAA,SAAF;AAAaC,IAA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AACdI,MAAAA,QAAQ,EAAEW;AADI,KAAF,CAXf;AAeC,IAAA,SAAS,EAAC,8BAfX;AAgBC,IAAA,8BAA8B,MAhB/B;AAiBC,IAAA,SAAS,EAAC,QAjBX;AAkBC,IAAA,sBAAsB,EAAG,MACxBb,iBAAiB,CAChB,yBAAa,gBAAb,CADgB;AAnBnB,IAlBF,CADD,CATD,CADD;AA0DA;;eAEcJ,a","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tAlignmentControl,\n\tBlockControls,\n\tRichText,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\nimport { Platform } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { Figure } from './figure';\nimport { BlockQuote } from './blockquote';\n\nconst isWebPlatform = Platform.OS === 'web';\n\nfunction PullQuoteEdit( {\n\tattributes,\n\tsetAttributes,\n\tisSelected,\n\tinsertBlocksAfter,\n} ) {\n\tconst { textAlign, citation, value } = attributes;\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t} ),\n\t} );\n\tconst shouldShowCitation = ! RichText.isEmpty( citation ) || isSelected;\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"block\">\n\t\t\t\t<AlignmentControl\n\t\t\t\t\tvalue={ textAlign }\n\t\t\t\t\tonChange={ ( nextAlign ) => {\n\t\t\t\t\t\tsetAttributes( { textAlign: nextAlign } );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<Figure { ...blockProps }>\n\t\t\t\t<BlockQuote>\n\t\t\t\t\t<RichText\n\t\t\t\t\t\tidentifier=\"value\"\n\t\t\t\t\t\tmultiline\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tonChange={ ( nextValue ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tvalue: nextValue,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\taria-label={ __( 'Pullquote text' ) }\n\t\t\t\t\t\tplaceholder={\n\t\t\t\t\t\t\t// translators: placeholder text used for the quote\n\t\t\t\t\t\t\t__( 'Add quote' )\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttextAlign=\"center\"\n\t\t\t\t\t/>\n\t\t\t\t\t{ shouldShowCitation && (\n\t\t\t\t\t\t<RichText\n\t\t\t\t\t\t\tidentifier=\"citation\"\n\t\t\t\t\t\t\ttagName={ isWebPlatform ? 'cite' : undefined }\n\t\t\t\t\t\t\tstyle={ { display: 'block' } }\n\t\t\t\t\t\t\tvalue={ citation }\n\t\t\t\t\t\t\taria-label={ __( 'Pullquote citation text' ) }\n\t\t\t\t\t\t\tplaceholder={\n\t\t\t\t\t\t\t\t// translators: placeholder text used for the citation\n\t\t\t\t\t\t\t\t__( 'Add citation' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonChange={ ( nextCitation ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tcitation: nextCitation,\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=\"wp-block-pullquote__citation\"\n\t\t\t\t\t\t\t__unstableMobileNoFocusOnMount\n\t\t\t\t\t\t\ttextAlign=\"center\"\n\t\t\t\t\t\t\t__unstableOnSplitAtEnd={ () =>\n\t\t\t\t\t\t\t\tinsertBlocksAfter(\n\t\t\t\t\t\t\t\t\tcreateBlock( 'core/paragraph' )\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</BlockQuote>\n\t\t\t</Figure>\n\t\t</>\n\t);\n}\n\nexport default PullQuoteEdit;\n"]}
@@ -59,7 +59,7 @@ const variations = [{
59
59
  icon: _icons2.titleDate,
60
60
  attributes: { ...QUERY_DEFAULT_ATTRIBUTES
61
61
  },
62
- innerBlocks: [['core/post-template', {}, [['core/post-title'], ['core/post-date']]], ['core/query-pagination']],
62
+ innerBlocks: [['core/post-template', {}, [['core/post-title'], ['core/post-date']]], ['core/query-pagination'], ['core/query-no-results']],
63
63
  scope: ['block']
64
64
  }, {
65
65
  name: 'title-excerpt',
@@ -67,7 +67,7 @@ const variations = [{
67
67
  icon: _icons2.titleExcerpt,
68
68
  attributes: { ...QUERY_DEFAULT_ATTRIBUTES
69
69
  },
70
- innerBlocks: [['core/post-template', {}, [['core/post-title'], ['core/post-excerpt']]], ['core/query-pagination']],
70
+ innerBlocks: [['core/post-template', {}, [['core/post-title'], ['core/post-excerpt']]], ['core/query-pagination'], ['core/query-no-results']],
71
71
  scope: ['block']
72
72
  }, {
73
73
  name: 'title-date-excerpt',
@@ -75,7 +75,7 @@ const variations = [{
75
75
  icon: _icons2.titleDateExcerpt,
76
76
  attributes: { ...QUERY_DEFAULT_ATTRIBUTES
77
77
  },
78
- innerBlocks: [['core/post-template', {}, [['core/post-title'], ['core/post-date'], ['core/post-excerpt']]], ['core/query-pagination']],
78
+ innerBlocks: [['core/post-template', {}, [['core/post-title'], ['core/post-date'], ['core/post-excerpt']]], ['core/query-pagination'], ['core/query-no-results']],
79
79
  scope: ['block']
80
80
  }, {
81
81
  name: 'image-date-title',
@@ -83,7 +83,7 @@ const variations = [{
83
83
  icon: _icons2.imageDateTitle,
84
84
  attributes: { ...QUERY_DEFAULT_ATTRIBUTES
85
85
  },
86
- innerBlocks: [['core/post-template', {}, [['core/post-featured-image'], ['core/post-date'], ['core/post-title']]], ['core/query-pagination']],
86
+ innerBlocks: [['core/post-template', {}, [['core/post-featured-image'], ['core/post-date'], ['core/post-title']]], ['core/query-pagination'], ['core/query-no-results']],
87
87
  scope: ['block']
88
88
  }];
89
89
  var _default = variations;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/query/variations.js"],"names":["QUERY_DEFAULT_ATTRIBUTES","query","perPage","pages","offset","postType","order","orderBy","author","search","exclude","sticky","inherit","variations","name","title","description","icon","postList","attributes","scope","titleDate","innerBlocks","titleExcerpt","titleDateExcerpt","imageDateTitle"],"mappings":";;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAQA,MAAMA,wBAAwB,GAAG;AAChCC,EAAAA,KAAK,EAAE;AACNC,IAAAA,OAAO,EAAE,CADH;AAENC,IAAAA,KAAK,EAAE,CAFD;AAGNC,IAAAA,MAAM,EAAE,CAHF;AAINC,IAAAA,QAAQ,EAAE,MAJJ;AAKNC,IAAAA,KAAK,EAAE,MALD;AAMNC,IAAAA,OAAO,EAAE,MANH;AAONC,IAAAA,MAAM,EAAE,EAPF;AAQNC,IAAAA,MAAM,EAAE,EARF;AASNC,IAAAA,OAAO,EAAE,EATH;AAUNC,IAAAA,MAAM,EAAE,EAVF;AAWNC,IAAAA,OAAO,EAAE;AAXH;AADyB,CAAjC;AAgBA,MAAMC,UAAU,GAAG,CAClB;AACCC,EAAAA,IAAI,EAAE,YADP;AAECC,EAAAA,KAAK,EAAE,cAAI,YAAJ,CAFR;AAGCC,EAAAA,WAAW,EAAE,cACZ,mEADY,CAHd;AAMCC,EAAAA,IAAI,EAAEC,eANP;AAOCC,EAAAA,UAAU,EAAE;AACXlB,IAAAA,KAAK,EAAE;AACNC,MAAAA,OAAO,EAAE,CADH;AAENC,MAAAA,KAAK,EAAE,CAFD;AAGNC,MAAAA,MAAM,EAAE,CAHF;AAINC,MAAAA,QAAQ,EAAE,MAJJ;AAKNC,MAAAA,KAAK,EAAE,MALD;AAMNC,MAAAA,OAAO,EAAE,MANH;AAONC,MAAAA,MAAM,EAAE,EAPF;AAQNC,MAAAA,MAAM,EAAE,EARF;AASNE,MAAAA,MAAM,EAAE,SATF;AAUNC,MAAAA,OAAO,EAAE;AAVH;AADI,GAPb;AAqBCQ,EAAAA,KAAK,EAAE,CAAE,UAAF;A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,EAAE,cAAI,sBAAJ,CAFR;AAGCE,EAAAA,IAAI,EAAEQ,sBAHP;AAICN,EAAAA,UAAU,EAAE,EAAE,GAAGnB;AAAL,GAJb;AAKCsB,EAAAA,WAAW,EAAE,CACZ,CACC,oBADD,EAEC,EAFD,EAGC,CACC,CAAE,0BAAF,CADD,EAEC,CAAE,gBAAF,CAFD,EAGC,CAAE,iBAAF,CAHD,CAHD,CADY,EAUZ,CAAE,uBAAF,CAVY,CALd;AAiBCF,EAAAA,KAAK,EAAE,CAAE,OAAF;AAjBR,CAzEkB,CAAnB;eA8FeP,U","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { postList } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport {\n\ttitleDate,\n\ttitleExcerpt,\n\ttitleDateExcerpt,\n\timageDateTitle,\n} from './icons';\n\nconst QUERY_DEFAULT_ATTRIBUTES = {\n\tquery: {\n\t\tperPage: 3,\n\t\tpages: 0,\n\t\toffset: 0,\n\t\tpostType: 'post',\n\t\torder: 'desc',\n\t\torderBy: 'date',\n\t\tauthor: '',\n\t\tsearch: '',\n\t\texclude: [],\n\t\tsticky: '',\n\t\tinherit: false,\n\t},\n};\n\nconst variations = [\n\t{\n\t\tname: 'posts-list',\n\t\ttitle: __( 'Posts List' ),\n\t\tdescription: __(\n\t\t\t'Display a list of your most recent posts, excluding sticky posts.'\n\t\t),\n\t\ticon: postList,\n\t\tattributes: {\n\t\t\tquery: {\n\t\t\t\tperPage: 4,\n\t\t\t\tpages: 1,\n\t\t\t\toffset: 0,\n\t\t\t\tpostType: 'post',\n\t\t\t\torder: 'desc',\n\t\t\t\torderBy: 'date',\n\t\t\t\tauthor: '',\n\t\t\t\tsearch: '',\n\t\t\t\tsticky: 'exclude',\n\t\t\t\tinherit: false,\n\t\t\t},\n\t\t},\n\t\tscope: [ 'inserter' ],\n\t},\n\t{\n\t\tname: 'title-date',\n\t\ttitle: __( 'Title & Date' ),\n\t\ticon: titleDate,\n\t\tattributes: { ...QUERY_DEFAULT_ATTRIBUTES },\n\t\tinnerBlocks: [\n\t\t\t[\n\t\t\t\t'core/post-template',\n\t\t\t\t{},\n\t\t\t\t[ [ 'core/post-title' ], [ 'core/post-date' ] ],\n\t\t\t],\n\t\t\t[ 'core/query-pagination' ],\n\t\t],\n\t\tscope: [ 'block' ],\n\t},\n\t{\n\t\tname: 'title-excerpt',\n\t\ttitle: __( 'Title & Excerpt' ),\n\t\ticon: titleExcerpt,\n\t\tattributes: { ...QUERY_DEFAULT_ATTRIBUTES },\n\t\tinnerBlocks: [\n\t\t\t[\n\t\t\t\t'core/post-template',\n\t\t\t\t{},\n\t\t\t\t[ [ 'core/post-title' ], [ 'core/post-excerpt' ] ],\n\t\t\t],\n\t\t\t[ 'core/query-pagination' ],\n\t\t],\n\t\tscope: [ 'block' ],\n\t},\n\t{\n\t\tname: 'title-date-excerpt',\n\t\ttitle: __( 'Title, Date, & Excerpt' ),\n\t\ticon: titleDateExcerpt,\n\t\tattributes: { ...QUERY_DEFAULT_ATTRIBUTES },\n\t\tinnerBlocks: [\n\t\t\t[\n\t\t\t\t'core/post-template',\n\t\t\t\t{},\n\t\t\t\t[\n\t\t\t\t\t[ 'core/post-title' ],\n\t\t\t\t\t[ 'core/post-date' ],\n\t\t\t\t\t[ 'core/post-excerpt' ],\n\t\t\t\t],\n\t\t\t],\n\t\t\t[ 'core/query-pagination' ],\n\t\t],\n\t\tscope: [ 'block' ],\n\t},\n\t{\n\t\tname: 'image-date-title',\n\t\ttitle: __( 'Image, Date, & Title' ),\n\t\ticon: imageDateTitle,\n\t\tattributes: { ...QUERY_DEFAULT_ATTRIBUTES },\n\t\tinnerBlocks: [\n\t\t\t[\n\t\t\t\t'core/post-template',\n\t\t\t\t{},\n\t\t\t\t[\n\t\t\t\t\t[ 'core/post-featured-image' ],\n\t\t\t\t\t[ 'core/post-date' ],\n\t\t\t\t\t[ 'core/post-title' ],\n\t\t\t\t],\n\t\t\t],\n\t\t\t[ 'core/query-pagination' ],\n\t\t],\n\t\tscope: [ 'block' ],\n\t},\n];\n\nexport default variations;\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/query/variations.js"],"names":["QUERY_DEFAULT_ATTRIBUTES","query","perPage","pages","offset","postType","order","orderBy","author","search","exclude","sticky","inherit","variations","name","title","description","icon","postList","attributes","scope","titleDate","innerBlocks","titleExcerpt","titleDateExcerpt","imageDateTitle"],"mappings":";;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAQA,MAAMA,wBAAwB,GAAG;AAChCC,EAAAA,KAAK,EAAE;AACNC,IAAAA,OAAO,EAAE,CADH;AAENC,IAAAA,KAAK,EAAE,CAFD;AAGNC,IAAAA,MAAM,EAAE,CAHF;AAINC,IAAAA,QAAQ,EAAE,MAJJ;AAKNC,IAAAA,KAAK,EAAE,MALD;AAMNC,IAAAA,OAAO,EAAE,MANH;AAONC,IAAAA,MAAM,EAAE,EAPF;AAQNC,IAAAA,MAAM,EAAE,EARF;AASNC,IAAAA,OAAO,EAAE,EATH;AAUNC,IAAAA,MAAM,EAAE,EAVF;AAWNC,IAAAA,OAAO,EAAE;AAXH;AADyB,CAAjC;AAgBA,MAAMC,UAAU,GAAG,CAClB;AACCC,EAAAA,IAAI,EAAE,YADP;AAECC,EAAAA,KAAK,EAAE,cAAI,YAAJ,CAFR;AAGCC,EAAAA,WAAW,EAAE,cACZ,mEADY,CAHd;AAMCC,EAAAA,IAAI,EAAEC,eANP;AAOCC,EAAAA,UAAU,EAAE;AACXlB,IAAAA,KAAK,EAAE;AACNC,MAAAA,OAAO,EAAE,CADH;AAENC,MAAAA,KAAK,EAAE,CAFD;AAGNC,MAAAA,MAAM,EAAE,CAHF;AAINC,MAAAA,QAAQ,EAAE,MAJJ;AAKNC,MAAAA,KAAK,EAAE,MALD;AAMNC,MAAAA,OAAO,EAAE,MANH;AAONC,MAAAA,MAAM,EAAE,EAPF;AAQNC,MAAAA,MAA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D,EAGC,CAAE,mBAAF,CAHD,CAHD,CADY,EAUZ,CAAE,uBAAF,CAVY,EAWZ,CAAE,uBAAF,CAXY,CALd;AAkBCF,EAAAA,KAAK,EAAE,CAAE,OAAF;AAlBR,CAxDkB,EA4ElB;AACCN,EAAAA,IAAI,EAAE,kBADP;AAECC,EAAAA,KAAK,EAAE,cAAI,sBAAJ,CAFR;AAGCE,EAAAA,IAAI,EAAEQ,sBAHP;AAICN,EAAAA,UAAU,EAAE,EAAE,GAAGnB;AAAL,GAJb;AAKCsB,EAAAA,WAAW,EAAE,CACZ,CACC,oBADD,EAEC,EAFD,EAGC,CACC,CAAE,0BAAF,CADD,EAEC,CAAE,gBAAF,CAFD,EAGC,CAAE,iBAAF,CAHD,CAHD,CADY,EAUZ,CAAE,uBAAF,CAVY,EAWZ,CAAE,uBAAF,CAXY,CALd;AAkBCF,EAAAA,KAAK,EAAE,CAAE,OAAF;AAlBR,CA5EkB,CAAnB;eAkGeP,U","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { postList } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport {\n\ttitleDate,\n\ttitleExcerpt,\n\ttitleDateExcerpt,\n\timageDateTitle,\n} from './icons';\n\nconst QUERY_DEFAULT_ATTRIBUTES = {\n\tquery: {\n\t\tperPage: 3,\n\t\tpages: 0,\n\t\toffset: 0,\n\t\tpostType: 'post',\n\t\torder: 'desc',\n\t\torderBy: 'date',\n\t\tauthor: '',\n\t\tsearch: '',\n\t\texclude: [],\n\t\tsticky: '',\n\t\tinherit: false,\n\t},\n};\n\nconst variations = [\n\t{\n\t\tname: 'posts-list',\n\t\ttitle: __( 'Posts List' ),\n\t\tdescription: __(\n\t\t\t'Display a list of your most recent posts, excluding sticky posts.'\n\t\t),\n\t\ticon: postList,\n\t\tattributes: {\n\t\t\tquery: {\n\t\t\t\tperPage: 4,\n\t\t\t\tpages: 1,\n\t\t\t\toffset: 0,\n\t\t\t\tpostType: 'post',\n\t\t\t\torder: 'desc',\n\t\t\t\torderBy: 'date',\n\t\t\t\tauthor: '',\n\t\t\t\tsearch: '',\n\t\t\t\tsticky: 'exclude',\n\t\t\t\tinherit: false,\n\t\t\t},\n\t\t},\n\t\tscope: [ 'inserter' ],\n\t},\n\t{\n\t\tname: 'title-date',\n\t\ttitle: __( 'Title & Date' ),\n\t\ticon: titleDate,\n\t\tattributes: { ...QUERY_DEFAULT_ATTRIBUTES },\n\t\tinnerBlocks: [\n\t\t\t[\n\t\t\t\t'core/post-template',\n\t\t\t\t{},\n\t\t\t\t[ [ 'core/post-title' ], [ 'core/post-date' ] ],\n\t\t\t],\n\t\t\t[ 'core/query-pagination' ],\n\t\t\t[ 'core/query-no-results' ],\n\t\t],\n\t\tscope: [ 'block' ],\n\t},\n\t{\n\t\tname: 'title-excerpt',\n\t\ttitle: __( 'Title & Excerpt' ),\n\t\ticon: titleExcerpt,\n\t\tattributes: { ...QUERY_DEFAULT_ATTRIBUTES },\n\t\tinnerBlocks: [\n\t\t\t[\n\t\t\t\t'core/post-template',\n\t\t\t\t{},\n\t\t\t\t[ [ 'core/post-title' ], [ 'core/post-excerpt' ] ],\n\t\t\t],\n\t\t\t[ 'core/query-pagination' ],\n\t\t\t[ 'core/query-no-results' ],\n\t\t],\n\t\tscope: [ 'block' ],\n\t},\n\t{\n\t\tname: 'title-date-excerpt',\n\t\ttitle: __( 'Title, Date, & Excerpt' ),\n\t\ticon: titleDateExcerpt,\n\t\tattributes: { ...QUERY_DEFAULT_ATTRIBUTES },\n\t\tinnerBlocks: [\n\t\t\t[\n\t\t\t\t'core/post-template',\n\t\t\t\t{},\n\t\t\t\t[\n\t\t\t\t\t[ 'core/post-title' ],\n\t\t\t\t\t[ 'core/post-date' ],\n\t\t\t\t\t[ 'core/post-excerpt' ],\n\t\t\t\t],\n\t\t\t],\n\t\t\t[ 'core/query-pagination' ],\n\t\t\t[ 'core/query-no-results' ],\n\t\t],\n\t\tscope: [ 'block' ],\n\t},\n\t{\n\t\tname: 'image-date-title',\n\t\ttitle: __( 'Image, Date, & Title' ),\n\t\ticon: imageDateTitle,\n\t\tattributes: { ...QUERY_DEFAULT_ATTRIBUTES },\n\t\tinnerBlocks: [\n\t\t\t[\n\t\t\t\t'core/post-template',\n\t\t\t\t{},\n\t\t\t\t[\n\t\t\t\t\t[ 'core/post-featured-image' ],\n\t\t\t\t\t[ 'core/post-date' ],\n\t\t\t\t\t[ 'core/post-title' ],\n\t\t\t\t],\n\t\t\t],\n\t\t\t[ 'core/query-pagination' ],\n\t\t\t[ 'core/query-no-results' ],\n\t\t],\n\t\tscope: [ 'block' ],\n\t},\n];\n\nexport default variations;\n"]}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = QueryNoResultsEdit;
7
+
8
+ var _element = require("@wordpress/element");
9
+
10
+ var _blockEditor = require("@wordpress/block-editor");
11
+
12
+ var _i18n = require("@wordpress/i18n");
13
+
14
+ /**
15
+ * WordPress dependencies
16
+ */
17
+ const TEMPLATE = [['core/paragraph', {
18
+ placeholder: (0, _i18n.__)('Add a text or blocks that will display when the query returns no results.')
19
+ }]];
20
+
21
+ function QueryNoResultsEdit() {
22
+ const blockProps = (0, _blockEditor.useBlockProps)();
23
+ const innerBlocksProps = (0, _blockEditor.useInnerBlocksProps)(blockProps, {
24
+ template: TEMPLATE
25
+ });
26
+ return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)("div", innerBlocksProps));
27
+ }
28
+ //# sourceMappingURL=edit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-library/src/query-no-results/edit.js"],"names":["TEMPLATE","placeholder","QueryNoResultsEdit","blockProps","innerBlocksProps","template"],"mappings":";;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIA,MAAMA,QAAQ,GAAG,CAChB,CACC,gBADD,EAEC;AACCC,EAAAA,WAAW,EAAE,cACZ,2EADY;AADd,CAFD,CADgB,CAAjB;;AAWe,SAASC,kBAAT,GAA8B;AAC5C,QAAMC,UAAU,GAAG,iCAAnB;AACA,QAAMC,gBAAgB,GAAG,sCAAqBD,UAArB,EAAiC;AACzDE,IAAAA,QAAQ,EAAEL;AAD+C,GAAjC,CAAzB;AAGA,SACC,qDACC,mCAAUI,gBAAV,CADD,CADD;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n\nconst TEMPLATE = [\n\t[\n\t\t'core/paragraph',\n\t\t{\n\t\t\tplaceholder: __(\n\t\t\t\t'Add a text or blocks that will display when the query returns no results.'\n\t\t\t),\n\t\t},\n\t],\n];\n\nexport default function QueryNoResultsEdit() {\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t} );\n\treturn (\n\t\t<>\n\t\t\t<div { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n"]}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.settings = exports.name = exports.metadata = void 0;
9
+
10
+ var _icons = require("@wordpress/icons");
11
+
12
+ var _edit = _interopRequireDefault(require("./edit"));
13
+
14
+ var _save = _interopRequireDefault(require("./save"));
15
+
16
+ /**
17
+ * WordPress dependencies
18
+ */
19
+
20
+ /**
21
+ * Internal dependencies
22
+ */
23
+ const metadata = {
24
+ $schema: "https://schemas.wp.org/trunk/block.json",
25
+ apiVersion: 2,
26
+ name: "core/query-no-results",
27
+ title: "No results",
28
+ category: "theme",
29
+ description: "Contains the block elements used to render content when no query results are found.",
30
+ parent: ["core/query"],
31
+ textdomain: "default",
32
+ usesContext: ["queryId", "query"],
33
+ supports: {
34
+ align: true,
35
+ reusable: false,
36
+ html: false,
37
+ color: {
38
+ gradients: true,
39
+ link: true
40
+ }
41
+ }
42
+ };
43
+ exports.metadata = metadata;
44
+ const {
45
+ name
46
+ } = metadata;
47
+ exports.name = name;
48
+ const settings = {
49
+ icon: _icons.loop,
50
+ edit: _edit.default,
51
+ save: _save.default
52
+ };
53
+ exports.settings = settings;
54
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-library/src/query-no-results/index.js"],"names":["name","metadata","settings","icon","edit","save"],"mappings":";;;;;;;;;AAGA;;AAMA;;AACA;;AAVA;AACA;AACA;;AAGA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM;AAAEA,EAAAA;AAAF,IAAWC,QAAjB;;AAGO,MAAMC,QAAQ,GAAG;AACvBC,EAAAA,IAAI,EAAJA,WADuB;AAEvBC,EAAAA,IAAI,EAAJA,aAFuB;AAGvBC,EAAAA,IAAI,EAAJA;AAHuB,CAAjB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { loop as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tsave,\n};\n"]}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = QueryNoResultsSave;
7
+
8
+ var _element = require("@wordpress/element");
9
+
10
+ var _blockEditor = require("@wordpress/block-editor");
11
+
12
+ /**
13
+ * WordPress dependencies
14
+ */
15
+ function QueryNoResultsSave() {
16
+ return (0, _element.createElement)(_blockEditor.InnerBlocks.Content, null);
17
+ }
18
+ //# sourceMappingURL=save.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/block-library/src/query-no-results/save.js"],"names":["QueryNoResultsSave"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGe,SAASA,kBAAT,GAA8B;AAC5C,SAAO,4BAAC,wBAAD,CAAa,OAAb,OAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { InnerBlocks } from '@wordpress/block-editor';\n\nexport default function QueryNoResultsSave() {\n\treturn <InnerBlocks.Content />;\n}\n"]}
@@ -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,G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Aa,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,Q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,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,EAAAA,UAAU,EAAE;AACXC,IAAAA,KAAK,EAAE;AACNC,MAAAA,IAAI,EAAE;AADA,KADI;AAIXC,IAAAA,WAAW,EAAE;AACZD,MAAAA,IAAI,EAAE;AADM;AAJF,GADF;;AASVE,EAAAA,IAAI,OAAmB;AAAA,QAAjB;AAAEJ,MAAAA;AAAF,KAAiB;AACtB,UAAM;AAAEC,MAAAA,KAAF;AAASE,MAAAA;AAAT,QAAyBH,UAA/B,CADsB,CAGtB;AACA;;AACA,UAAMK,eAAe,GAAG,oCAAmB,kBAAnB,EAAuCJ,KAAvC,CAAxB,CALsB,CAMtB;AACA;;AACA,UAAMK,UAAU,GAAG,oCAAmB,OAAnB,EAA4BL,KAA5B,CAAnB;AAEA,UAAMM,SAAS,GAAG,yBAAY;AAC7B,uCAAiCN,KAAK,IAAIE,WADb;AAE7B,OAAEE,eAAF,GAAqBA,eAFQ;AAG7B,OAAEC,UAAF,GAAgBA;AAHa,KAAZ,CAAlB;AAMA,UAAME,KAAK,GAAG;AACbC,MAAAA,eAAe,EAAEJ,eAAe,GAAGK,SAAH,GAAeP,WADlC;AAEbF,MAAAA,KAAK,EAAEK,UAAU,GAAGI,SAAH,GAAeP;AAFnB,KAAd;AAKA,WAAO,kCAASQ,2BAAcP,IAAd,CAAoB;AAAEG,MAAAA,SAAF;AAAaC,MAAAA;AAAb,KAApB,CAAT,CAAP;AACA,GA/BS;;AAgCVI,EAAAA,OAAO,CAAEZ,UAAF,EAAe;AACrB,UAAM;AAAEC,MAAAA,KAAF;AAASE,MAAAA;AAAT,QAAyBH,UAA/B;AACA,WAAO,EACN,GAAG,kBAAMA,UAAN,EAAkB,CAAE,OAAF,EAAW,aAAX,CAAlB,CADG;AAENS,MAAAA,eAAe,EAAER,KAAK,GAAGA,KAAH,GAAWS,SAF3B;AAGNG,MAAAA,OAAO,EAAE,KAHH;AAINL,MAAAA,KAAK,EAAEL,WAAW,GACf;AAAEF,QAAAA,KAAK,EAAE;AAAEa,UAAAA,UAAU,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