@wordpress/block-library 8.20.0 → 8.21.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 (277) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +12 -0
  3. package/build/block/index.js +2 -1
  4. package/build/block/index.js.map +1 -1
  5. package/build/code/edit.native.js +8 -2
  6. package/build/code/edit.native.js.map +1 -1
  7. package/build/cover/deprecated.js +110 -1
  8. package/build/cover/deprecated.js.map +1 -1
  9. package/build/cover/edit/index.js +9 -3
  10. package/build/cover/edit/index.js.map +1 -1
  11. package/build/cover/edit/inspector-controls.js +1 -2
  12. package/build/cover/edit/inspector-controls.js.map +1 -1
  13. package/build/cover/index.js +0 -3
  14. package/build/cover/index.js.map +1 -1
  15. package/build/cover/save.js +2 -1
  16. package/build/cover/save.js.map +1 -1
  17. package/build/cover/shared.js +1 -1
  18. package/build/cover/shared.js.map +1 -1
  19. package/build/footnotes/index.js +1 -0
  20. package/build/footnotes/index.js.map +1 -1
  21. package/build/form/edit.js +138 -0
  22. package/build/form/edit.js.map +1 -0
  23. package/build/form/index.js +92 -0
  24. package/build/form/index.js.map +1 -0
  25. package/build/form/init.js +13 -0
  26. package/build/form/init.js.map +1 -0
  27. package/build/form/save.js +28 -0
  28. package/build/form/save.js.map +1 -0
  29. package/build/form/utils.js +24 -0
  30. package/build/form/utils.js.map +1 -0
  31. package/build/form/variations.js +95 -0
  32. package/build/form/variations.js.map +1 -0
  33. package/build/form/view.js +42 -0
  34. package/build/form/view.js.map +1 -0
  35. package/build/form-input/edit.js +124 -0
  36. package/build/form-input/edit.js.map +1 -0
  37. package/build/form-input/index.js +105 -0
  38. package/build/form-input/index.js.map +1 -0
  39. package/build/form-input/init.js +13 -0
  40. package/build/form-input/init.js.map +1 -0
  41. package/build/form-input/save.js +87 -0
  42. package/build/form-input/save.js.map +1 -0
  43. package/build/form-input/variations.js +93 -0
  44. package/build/form-input/variations.js.map +1 -0
  45. package/build/form-submission-notification/edit.js +59 -0
  46. package/build/form-submission-notification/edit.js.map +1 -0
  47. package/build/form-submission-notification/index.js +56 -0
  48. package/build/form-submission-notification/index.js.map +1 -0
  49. package/build/form-submission-notification/init.js +13 -0
  50. package/build/form-submission-notification/init.js.map +1 -0
  51. package/build/form-submission-notification/save.js +33 -0
  52. package/build/form-submission-notification/save.js.map +1 -0
  53. package/build/form-submission-notification/variations.js +63 -0
  54. package/build/form-submission-notification/variations.js.map +1 -0
  55. package/build/form-submit-button/edit.js +32 -0
  56. package/build/form-submit-button/edit.js.map +1 -0
  57. package/build/form-submit-button/index.js +44 -0
  58. package/build/form-submit-button/index.js.map +1 -0
  59. package/build/form-submit-button/init.js +13 -0
  60. package/build/form-submit-button/init.js.map +1 -0
  61. package/build/form-submit-button/save.js +22 -0
  62. package/build/form-submit-button/save.js.map +1 -0
  63. package/build/group/index.js +0 -1
  64. package/build/group/index.js.map +1 -1
  65. package/build/heading/index.js +3 -2
  66. package/build/heading/index.js.map +1 -1
  67. package/build/image/image.js +4 -1
  68. package/build/image/image.js.map +1 -1
  69. package/build/image/view.js +82 -40
  70. package/build/image/view.js.map +1 -1
  71. package/build/index.js +10 -0
  72. package/build/index.js.map +1 -1
  73. package/build/latest-posts/edit.js +6 -2
  74. package/build/latest-posts/edit.js.map +1 -1
  75. package/build/list-item/hooks/use-merge.js +15 -15
  76. package/build/list-item/hooks/use-merge.js.map +1 -1
  77. package/build/lock-unlock.js +1 -1
  78. package/build/lock-unlock.js.map +1 -1
  79. package/build/missing/edit.native.js +14 -62
  80. package/build/missing/edit.native.js.map +1 -1
  81. package/build/navigation/edit/index.js +0 -1
  82. package/build/navigation/edit/index.js.map +1 -1
  83. package/build/navigation/index.js +2 -1
  84. package/build/navigation/index.js.map +1 -1
  85. package/build/navigation/view.js +27 -5
  86. package/build/navigation/view.js.map +1 -1
  87. package/build/page-list-item/edit.js +3 -1
  88. package/build/page-list-item/edit.js.map +1 -1
  89. package/build/paragraph/index.js +7 -0
  90. package/build/paragraph/index.js.map +1 -1
  91. package/build/pattern/index.js +2 -1
  92. package/build/pattern/index.js.map +1 -1
  93. package/build/template-part/index.js +2 -1
  94. package/build/template-part/index.js.map +1 -1
  95. package/build-module/block/index.js +2 -1
  96. package/build-module/block/index.js.map +1 -1
  97. package/build-module/code/edit.native.js +8 -2
  98. package/build-module/code/edit.native.js.map +1 -1
  99. package/build-module/cover/deprecated.js +110 -1
  100. package/build-module/cover/deprecated.js.map +1 -1
  101. package/build-module/cover/edit/index.js +9 -3
  102. package/build-module/cover/edit/index.js.map +1 -1
  103. package/build-module/cover/edit/inspector-controls.js +1 -2
  104. package/build-module/cover/edit/inspector-controls.js.map +1 -1
  105. package/build-module/cover/index.js +0 -3
  106. package/build-module/cover/index.js.map +1 -1
  107. package/build-module/cover/save.js +2 -1
  108. package/build-module/cover/save.js.map +1 -1
  109. package/build-module/cover/shared.js +1 -1
  110. package/build-module/cover/shared.js.map +1 -1
  111. package/build-module/footnotes/index.js +1 -0
  112. package/build-module/footnotes/index.js.map +1 -1
  113. package/build-module/form/edit.js +130 -0
  114. package/build-module/form/edit.js.map +1 -0
  115. package/build-module/form/index.js +82 -0
  116. package/build-module/form/index.js.map +1 -0
  117. package/build-module/form/init.js +6 -0
  118. package/build-module/form/init.js.map +1 -0
  119. package/build-module/form/save.js +20 -0
  120. package/build-module/form/save.js.map +1 -0
  121. package/build-module/form/utils.js +15 -0
  122. package/build-module/form/utils.js.map +1 -0
  123. package/build-module/form/variations.js +86 -0
  124. package/build-module/form/variations.js.map +1 -0
  125. package/build-module/form/view.js +40 -0
  126. package/build-module/form/view.js.map +1 -0
  127. package/build-module/form-input/edit.js +115 -0
  128. package/build-module/form-input/edit.js.map +1 -0
  129. package/build-module/form-input/index.js +95 -0
  130. package/build-module/form-input/index.js.map +1 -0
  131. package/build-module/form-input/init.js +6 -0
  132. package/build-module/form-input/init.js.map +1 -0
  133. package/build-module/form-input/save.js +80 -0
  134. package/build-module/form-input/save.js.map +1 -0
  135. package/build-module/form-input/variations.js +85 -0
  136. package/build-module/form-input/variations.js.map +1 -0
  137. package/build-module/form-submission-notification/edit.js +50 -0
  138. package/build-module/form-submission-notification/edit.js.map +1 -0
  139. package/build-module/form-submission-notification/index.js +47 -0
  140. package/build-module/form-submission-notification/index.js.map +1 -0
  141. package/build-module/form-submission-notification/init.js +6 -0
  142. package/build-module/form-submission-notification/init.js.map +1 -0
  143. package/build-module/form-submission-notification/save.js +25 -0
  144. package/build-module/form-submission-notification/save.js.map +1 -0
  145. package/build-module/form-submission-notification/variations.js +55 -0
  146. package/build-module/form-submission-notification/variations.js.map +1 -0
  147. package/build-module/form-submit-button/edit.js +24 -0
  148. package/build-module/form-submit-button/edit.js.map +1 -0
  149. package/build-module/form-submit-button/index.js +34 -0
  150. package/build-module/form-submit-button/index.js.map +1 -0
  151. package/build-module/form-submit-button/init.js +6 -0
  152. package/build-module/form-submit-button/init.js.map +1 -0
  153. package/build-module/form-submit-button/save.js +14 -0
  154. package/build-module/form-submit-button/save.js.map +1 -0
  155. package/build-module/group/index.js +0 -1
  156. package/build-module/group/index.js.map +1 -1
  157. package/build-module/heading/index.js +3 -2
  158. package/build-module/heading/index.js.map +1 -1
  159. package/build-module/image/image.js +4 -1
  160. package/build-module/image/image.js.map +1 -1
  161. package/build-module/image/view.js +82 -40
  162. package/build-module/image/view.js.map +1 -1
  163. package/build-module/index.js +10 -0
  164. package/build-module/index.js.map +1 -1
  165. package/build-module/latest-posts/edit.js +6 -2
  166. package/build-module/latest-posts/edit.js.map +1 -1
  167. package/build-module/list-item/hooks/use-merge.js +15 -15
  168. package/build-module/list-item/hooks/use-merge.js.map +1 -1
  169. package/build-module/lock-unlock.js +1 -1
  170. package/build-module/lock-unlock.js.map +1 -1
  171. package/build-module/missing/edit.native.js +17 -65
  172. package/build-module/missing/edit.native.js.map +1 -1
  173. package/build-module/navigation/edit/index.js +0 -1
  174. package/build-module/navigation/edit/index.js.map +1 -1
  175. package/build-module/navigation/index.js +2 -1
  176. package/build-module/navigation/index.js.map +1 -1
  177. package/build-module/navigation/view.js +27 -5
  178. package/build-module/navigation/view.js.map +1 -1
  179. package/build-module/page-list-item/edit.js +3 -1
  180. package/build-module/page-list-item/edit.js.map +1 -1
  181. package/build-module/paragraph/index.js +7 -0
  182. package/build-module/paragraph/index.js.map +1 -1
  183. package/build-module/pattern/index.js +2 -1
  184. package/build-module/pattern/index.js.map +1 -1
  185. package/build-module/template-part/index.js +2 -1
  186. package/build-module/template-part/index.js.map +1 -1
  187. package/build-style/editor-rtl.css +50 -0
  188. package/build-style/editor.css +50 -0
  189. package/build-style/form-input/editor-rtl.css +106 -0
  190. package/build-style/form-input/editor.css +106 -0
  191. package/build-style/form-input/style-rtl.css +135 -0
  192. package/build-style/form-input/style.css +135 -0
  193. package/build-style/form-submission-notification/editor-rtl.css +118 -0
  194. package/build-style/form-submission-notification/editor.css +118 -0
  195. package/build-style/form-submit-button/style-rtl.css +91 -0
  196. package/build-style/form-submit-button/style.css +91 -0
  197. package/build-style/image/style-rtl.css +39 -5
  198. package/build-style/image/style.css +39 -5
  199. package/build-style/query/style-rtl.css +0 -10
  200. package/build-style/query/style.css +0 -10
  201. package/build-style/style-rtl.css +87 -5
  202. package/build-style/style.css +87 -5
  203. package/package.json +32 -32
  204. package/src/block/block.json +2 -1
  205. package/src/code/edit.native.js +15 -1
  206. package/src/cover/block.json +0 -3
  207. package/src/cover/deprecated.js +151 -1
  208. package/src/cover/edit/index.js +12 -3
  209. package/src/cover/edit/inspector-controls.js +19 -25
  210. package/src/cover/save.js +2 -1
  211. package/src/cover/shared.js +1 -1
  212. package/src/editor.scss +2 -0
  213. package/src/footnotes/block.json +1 -0
  214. package/src/form/block.json +60 -0
  215. package/src/form/edit.js +179 -0
  216. package/src/form/index.js +20 -0
  217. package/src/form/index.php +214 -0
  218. package/src/form/init.js +6 -0
  219. package/src/form/save.js +20 -0
  220. package/src/form/utils.js +39 -0
  221. package/src/form/variations.js +139 -0
  222. package/src/form/view.js +41 -0
  223. package/src/form-input/block.json +73 -0
  224. package/src/form-input/edit.js +151 -0
  225. package/src/form-input/editor.scss +24 -0
  226. package/src/form-input/index.js +20 -0
  227. package/src/form-input/index.php +45 -0
  228. package/src/form-input/init.js +6 -0
  229. package/src/form-input/save.js +83 -0
  230. package/src/form-input/style.scss +61 -0
  231. package/src/form-input/variations.js +82 -0
  232. package/src/form-submission-notification/block.json +19 -0
  233. package/src/form-submission-notification/edit.js +63 -0
  234. package/src/form-submission-notification/editor.scss +45 -0
  235. package/src/form-submission-notification/index.js +26 -0
  236. package/src/form-submission-notification/index.php +48 -0
  237. package/src/form-submission-notification/init.js +6 -0
  238. package/src/form-submission-notification/save.js +28 -0
  239. package/src/form-submission-notification/variations.js +59 -0
  240. package/src/form-submit-button/block.json +14 -0
  241. package/src/form-submit-button/edit.js +33 -0
  242. package/src/form-submit-button/index.js +18 -0
  243. package/src/form-submit-button/init.js +6 -0
  244. package/src/form-submit-button/save.js +14 -0
  245. package/src/form-submit-button/style.scss +3 -0
  246. package/src/group/block.json +0 -1
  247. package/src/heading/index.js +4 -2
  248. package/src/image/image.js +10 -0
  249. package/src/image/index.php +128 -82
  250. package/src/image/style.scss +49 -5
  251. package/src/image/view.js +100 -52
  252. package/src/index.js +10 -0
  253. package/src/latest-posts/edit.js +11 -2
  254. package/src/latest-posts/index.php +17 -8
  255. package/src/list-item/hooks/use-merge.js +20 -23
  256. package/src/lock-unlock.js +1 -1
  257. package/src/missing/edit.native.js +17 -115
  258. package/src/missing/style.native.scss +0 -67
  259. package/src/missing/test/edit-integration.native.js +135 -49
  260. package/src/missing/test/edit.native.js +0 -41
  261. package/src/navigation/block.json +2 -1
  262. package/src/navigation/edit/index.js +0 -1
  263. package/src/navigation/index.php +28 -8
  264. package/src/navigation/view.js +25 -6
  265. package/src/page-list-item/edit.js +2 -0
  266. package/src/paragraph/index.js +10 -0
  267. package/src/pattern/block.json +2 -1
  268. package/src/pattern/index.php +0 -3
  269. package/src/post-navigation-link/index.php +2 -1
  270. package/src/preformatted/test/edit.native.js +38 -0
  271. package/src/query/index.php +3 -2
  272. package/src/query/style.scss +0 -11
  273. package/src/search/index.php +0 -4
  274. package/src/style.scss +1 -0
  275. package/src/template-part/block.json +2 -1
  276. package/src/template-part/index.php +4 -7
  277. package/src/verse/test/edit.native.js +37 -0
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.formSubmissionNotificationSuccess = exports.formSubmissionNotificationError = void 0;
7
+ var _i18n = require("@wordpress/i18n");
8
+ /**
9
+ * WordPress dependencies
10
+ */
11
+
12
+ const formSubmissionNotificationSuccess = ['core/form-submission-notification', {
13
+ type: 'success'
14
+ }, [['core/paragraph', {
15
+ content: '<mark style="background-color:rgba(0, 0, 0, 0);color:#345C00" class="has-inline-color">' + (0, _i18n.__)('Your form has been submitted successfully') + '</mark>'
16
+ }]]];
17
+ exports.formSubmissionNotificationSuccess = formSubmissionNotificationSuccess;
18
+ const formSubmissionNotificationError = ['core/form-submission-notification', {
19
+ type: 'error'
20
+ }, [['core/paragraph', {
21
+ content: '<mark style="background-color:rgba(0, 0, 0, 0);color:#CF2E2E" class="has-inline-color">' + (0, _i18n.__)('There was an error submitting your form.') + '</mark>'
22
+ }]]];
23
+ exports.formSubmissionNotificationError = formSubmissionNotificationError;
24
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_i18n","require","formSubmissionNotificationSuccess","type","content","__","exports","formSubmissionNotificationError"],"sources":["@wordpress/block-library/src/form/utils.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nexport const formSubmissionNotificationSuccess = [\n\t'core/form-submission-notification',\n\t{\n\t\ttype: 'success',\n\t},\n\t[\n\t\t[\n\t\t\t'core/paragraph',\n\t\t\t{\n\t\t\t\tcontent:\n\t\t\t\t\t'<mark style=\"background-color:rgba(0, 0, 0, 0);color:#345C00\" class=\"has-inline-color\">' +\n\t\t\t\t\t__( 'Your form has been submitted successfully' ) +\n\t\t\t\t\t'</mark>',\n\t\t\t},\n\t\t],\n\t],\n];\nexport const formSubmissionNotificationError = [\n\t'core/form-submission-notification',\n\t{\n\t\ttype: 'error',\n\t},\n\t[\n\t\t[\n\t\t\t'core/paragraph',\n\t\t\t{\n\t\t\t\tcontent:\n\t\t\t\t\t'<mark style=\"background-color:rgba(0, 0, 0, 0);color:#CF2E2E\" class=\"has-inline-color\">' +\n\t\t\t\t\t__( 'There was an error submitting your form.' ) +\n\t\t\t\t\t'</mark>',\n\t\t\t},\n\t\t],\n\t],\n];\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGO,MAAMC,iCAAiC,GAAG,CAChD,mCAAmC,EACnC;EACCC,IAAI,EAAE;AACP,CAAC,EACD,CACC,CACC,gBAAgB,EAChB;EACCC,OAAO,EACN,yFAAyF,GACzF,IAAAC,QAAE,EAAE,2CAA4C,CAAC,GACjD;AACF,CAAC,CACD,CACD,CACD;AAACC,OAAA,CAAAJ,iCAAA,GAAAA,iCAAA;AACK,MAAMK,+BAA+B,GAAG,CAC9C,mCAAmC,EACnC;EACCJ,IAAI,EAAE;AACP,CAAC,EACD,CACC,CACC,gBAAgB,EAChB;EACCC,OAAO,EACN,yFAAyF,GACzF,IAAAC,QAAE,EAAE,0CAA2C,CAAC,GAChD;AACF,CAAC,CACD,CACD,CACD;AAACC,OAAA,CAAAC,+BAAA,GAAAA,+BAAA"}
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _i18n = require("@wordpress/i18n");
8
+ var _utils = require("./utils.js");
9
+ /**
10
+ * WordPress dependencies
11
+ */
12
+
13
+ /**
14
+ * Internal dependencies
15
+ */
16
+
17
+ const variations = [{
18
+ name: 'comment-form',
19
+ title: (0, _i18n.__)('Experimental Comment form'),
20
+ description: (0, _i18n.__)('A comment form for posts and pages.'),
21
+ attributes: {
22
+ submissionMethod: 'custom',
23
+ action: '{SITE_URL}/wp-comments-post.php',
24
+ method: 'post',
25
+ anchor: 'comment-form'
26
+ },
27
+ isDefault: false,
28
+ innerBlocks: [['core/form-input', {
29
+ type: 'text',
30
+ name: 'author',
31
+ label: (0, _i18n.__)('Name'),
32
+ required: true,
33
+ visibilityPermissions: 'logged-out'
34
+ }], ['core/form-input', {
35
+ type: 'email',
36
+ name: 'email',
37
+ label: (0, _i18n.__)('Email'),
38
+ required: true,
39
+ visibilityPermissions: 'logged-out'
40
+ }], ['core/form-input', {
41
+ type: 'textarea',
42
+ name: 'comment',
43
+ label: (0, _i18n.__)('Comment'),
44
+ required: true,
45
+ visibilityPermissions: 'all'
46
+ }], ['core/form-submit-button', {}]],
47
+ scope: ['inserter', 'transform'],
48
+ isActive: blockAttributes => !blockAttributes?.type || blockAttributes?.type === 'text'
49
+ }, {
50
+ name: 'wp-privacy-form',
51
+ title: (0, _i18n.__)('Experimental privacy request form'),
52
+ keywords: ['GDPR'],
53
+ description: (0, _i18n.__)('A form torequest data exports and/or deletion.'),
54
+ attributes: {
55
+ submissionMethod: 'custom',
56
+ action: '',
57
+ method: 'post',
58
+ anchor: 'gdpr-form'
59
+ },
60
+ isDefault: false,
61
+ innerBlocks: [_utils.formSubmissionNotificationSuccess, _utils.formSubmissionNotificationError, ['core/paragraph', {
62
+ content: (0, _i18n.__)('To request an export or deletion of your personal data on this site, please fill-in the form below. You can define the type of request you wish to perform, and your email address. Once the form is submitted, you will receive a confirmation email with instructions on the next steps.')
63
+ }], ['core/form-input', {
64
+ type: 'email',
65
+ name: 'email',
66
+ label: (0, _i18n.__)('Enter your email address.'),
67
+ required: true,
68
+ visibilityPermissions: 'all'
69
+ }], ['core/form-input', {
70
+ type: 'checkbox',
71
+ name: 'export_personal_data',
72
+ label: (0, _i18n.__)('Request data export'),
73
+ required: false,
74
+ visibilityPermissions: 'all'
75
+ }], ['core/form-input', {
76
+ type: 'checkbox',
77
+ name: 'remove_personal_data',
78
+ label: (0, _i18n.__)('Request data deletion'),
79
+ required: false,
80
+ visibilityPermissions: 'all'
81
+ }], ['core/form-submit-button', {}], ['core/form-input', {
82
+ type: 'hidden',
83
+ name: 'wp-action',
84
+ value: 'wp_privacy_send_request'
85
+ }], ['core/form-input', {
86
+ type: 'hidden',
87
+ name: 'wp-privacy-request',
88
+ value: '1'
89
+ }]],
90
+ scope: ['inserter', 'transform'],
91
+ isActive: blockAttributes => !blockAttributes?.type || blockAttributes?.type === 'text'
92
+ }];
93
+ var _default = variations;
94
+ exports.default = _default;
95
+ //# sourceMappingURL=variations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_i18n","require","_utils","variations","name","title","__","description","attributes","submissionMethod","action","method","anchor","isDefault","innerBlocks","type","label","required","visibilityPermissions","scope","isActive","blockAttributes","keywords","formSubmissionNotificationSuccess","formSubmissionNotificationError","content","value","_default","exports","default"],"sources":["@wordpress/block-library/src/form/variations.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n/**\n * Internal dependencies\n */\nimport {\n\tformSubmissionNotificationSuccess,\n\tformSubmissionNotificationError,\n} from './utils.js';\n\nconst variations = [\n\t{\n\t\tname: 'comment-form',\n\t\ttitle: __( 'Experimental Comment form' ),\n\t\tdescription: __( 'A comment form for posts and pages.' ),\n\t\tattributes: {\n\t\t\tsubmissionMethod: 'custom',\n\t\t\taction: '{SITE_URL}/wp-comments-post.php',\n\t\t\tmethod: 'post',\n\t\t\tanchor: 'comment-form',\n\t\t},\n\t\tisDefault: false,\n\t\tinnerBlocks: [\n\t\t\t[\n\t\t\t\t'core/form-input',\n\t\t\t\t{\n\t\t\t\t\ttype: 'text',\n\t\t\t\t\tname: 'author',\n\t\t\t\t\tlabel: __( 'Name' ),\n\t\t\t\t\trequired: true,\n\t\t\t\t\tvisibilityPermissions: 'logged-out',\n\t\t\t\t},\n\t\t\t],\n\t\t\t[\n\t\t\t\t'core/form-input',\n\t\t\t\t{\n\t\t\t\t\ttype: 'email',\n\t\t\t\t\tname: 'email',\n\t\t\t\t\tlabel: __( 'Email' ),\n\t\t\t\t\trequired: true,\n\t\t\t\t\tvisibilityPermissions: 'logged-out',\n\t\t\t\t},\n\t\t\t],\n\t\t\t[\n\t\t\t\t'core/form-input',\n\t\t\t\t{\n\t\t\t\t\ttype: 'textarea',\n\t\t\t\t\tname: 'comment',\n\t\t\t\t\tlabel: __( 'Comment' ),\n\t\t\t\t\trequired: true,\n\t\t\t\t\tvisibilityPermissions: 'all',\n\t\t\t\t},\n\t\t\t],\n\t\t\t[ 'core/form-submit-button', {} ],\n\t\t],\n\t\tscope: [ 'inserter', 'transform' ],\n\t\tisActive: ( blockAttributes ) =>\n\t\t\t! blockAttributes?.type || blockAttributes?.type === 'text',\n\t},\n\t{\n\t\tname: 'wp-privacy-form',\n\t\ttitle: __( 'Experimental privacy request form' ),\n\t\tkeywords: [ 'GDPR' ],\n\t\tdescription: __( 'A form torequest data exports and/or deletion.' ),\n\t\tattributes: {\n\t\t\tsubmissionMethod: 'custom',\n\t\t\taction: '',\n\t\t\tmethod: 'post',\n\t\t\tanchor: 'gdpr-form',\n\t\t},\n\t\tisDefault: false,\n\t\tinnerBlocks: [\n\t\t\tformSubmissionNotificationSuccess,\n\t\t\tformSubmissionNotificationError,\n\t\t\t[\n\t\t\t\t'core/paragraph',\n\t\t\t\t{\n\t\t\t\t\tcontent: __(\n\t\t\t\t\t\t'To request an export or deletion of your personal data on this site, please fill-in the form below. You can define the type of request you wish to perform, and your email address. Once the form is submitted, you will receive a confirmation email with instructions on the next steps.'\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t],\n\t\t\t[\n\t\t\t\t'core/form-input',\n\t\t\t\t{\n\t\t\t\t\ttype: 'email',\n\t\t\t\t\tname: 'email',\n\t\t\t\t\tlabel: __( 'Enter your email address.' ),\n\t\t\t\t\trequired: true,\n\t\t\t\t\tvisibilityPermissions: 'all',\n\t\t\t\t},\n\t\t\t],\n\t\t\t[\n\t\t\t\t'core/form-input',\n\t\t\t\t{\n\t\t\t\t\ttype: 'checkbox',\n\t\t\t\t\tname: 'export_personal_data',\n\t\t\t\t\tlabel: __( 'Request data export' ),\n\t\t\t\t\trequired: false,\n\t\t\t\t\tvisibilityPermissions: 'all',\n\t\t\t\t},\n\t\t\t],\n\t\t\t[\n\t\t\t\t'core/form-input',\n\t\t\t\t{\n\t\t\t\t\ttype: 'checkbox',\n\t\t\t\t\tname: 'remove_personal_data',\n\t\t\t\t\tlabel: __( 'Request data deletion' ),\n\t\t\t\t\trequired: false,\n\t\t\t\t\tvisibilityPermissions: 'all',\n\t\t\t\t},\n\t\t\t],\n\t\t\t[ 'core/form-submit-button', {} ],\n\t\t\t[\n\t\t\t\t'core/form-input',\n\t\t\t\t{\n\t\t\t\t\ttype: 'hidden',\n\t\t\t\t\tname: 'wp-action',\n\t\t\t\t\tvalue: 'wp_privacy_send_request',\n\t\t\t\t},\n\t\t\t],\n\t\t\t[\n\t\t\t\t'core/form-input',\n\t\t\t\t{\n\t\t\t\t\ttype: 'hidden',\n\t\t\t\t\tname: 'wp-privacy-request',\n\t\t\t\t\tvalue: '1',\n\t\t\t\t},\n\t\t\t],\n\t\t],\n\t\tscope: [ 'inserter', 'transform' ],\n\t\tisActive: ( blockAttributes ) =>\n\t\t\t! blockAttributes?.type || blockAttributes?.type === 'text',\n\t},\n];\n\nexport default variations;\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAIA,IAAAC,MAAA,GAAAD,OAAA;AAPA;AACA;AACA;;AAEA;AACA;AACA;;AAMA,MAAME,UAAU,GAAG,CAClB;EACCC,IAAI,EAAE,cAAc;EACpBC,KAAK,EAAE,IAAAC,QAAE,EAAE,2BAA4B,CAAC;EACxCC,WAAW,EAAE,IAAAD,QAAE,EAAE,qCAAsC,CAAC;EACxDE,UAAU,EAAE;IACXC,g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 +1,42 @@
1
+ "use strict";
2
+
3
+ // eslint-disable-next-line eslint-comments/disable-enable-pair
4
+ /* eslint-disable no-undef */
5
+ document.querySelectorAll('form.wp-block-form').forEach(function (form) {
6
+ // Bail If the form is not using the mailto: action.
7
+ if (!form.action || !form.action.startsWith('mailto:')) {
8
+ return;
9
+ }
10
+ const redirectNotification = status => {
11
+ const urlParams = new URLSearchParams(window.location.search);
12
+ urlParams.append('wp-form-result', status);
13
+ window.location.search = urlParams.toString();
14
+ };
15
+
16
+ // Add an event listener for the form submission.
17
+ form.addEventListener('submit', async function (event) {
18
+ event.preventDefault();
19
+ // Get the form data and merge it with the form action and nonce.
20
+ const formData = Object.fromEntries(new FormData(form).entries());
21
+ formData.formAction = form.action;
22
+ formData._ajax_nonce = wpBlockFormSettings.nonce;
23
+ formData.action = wpBlockFormSettings.action;
24
+ try {
25
+ const response = await fetch(wpBlockFormSettings.ajaxUrl, {
26
+ method: 'POST',
27
+ headers: {
28
+ 'Content-Type': 'application/x-www-form-urlencoded'
29
+ },
30
+ body: new URLSearchParams(formData).toString()
31
+ });
32
+ if (response.ok) {
33
+ redirectNotification('success');
34
+ } else {
35
+ redirectNotification('error');
36
+ }
37
+ } catch (error) {
38
+ redirectNotification('error');
39
+ }
40
+ });
41
+ });
42
+ //# sourceMappingURL=view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["document","querySelectorAll","forEach","form","action","startsWith","redirectNotification","status","urlParams","URLSearchParams","window","location","search","append","toString","addEventListener","event","preventDefault","formData","Object","fromEntries","FormData","entries","formAction","_ajax_nonce","wpBlockFormSettings","nonce","response","fetch","ajaxUrl","method","headers","body","ok","error"],"sources":["@wordpress/block-library/src/form/view.js"],"sourcesContent":["// eslint-disable-next-line eslint-comments/disable-enable-pair\n/* eslint-disable no-undef */\ndocument.querySelectorAll( 'form.wp-block-form' ).forEach( function ( form ) {\n\t// Bail If the form is not using the mailto: action.\n\tif ( ! form.action || ! form.action.startsWith( 'mailto:' ) ) {\n\t\treturn;\n\t}\n\n\tconst redirectNotification = ( status ) => {\n\t\tconst urlParams = new URLSearchParams( window.location.search );\n\t\turlParams.append( 'wp-form-result', status );\n\t\twindow.location.search = urlParams.toString();\n\t};\n\n\t// Add an event listener for the form submission.\n\tform.addEventListener( 'submit', async function ( event ) {\n\t\tevent.preventDefault();\n\t\t// Get the form data and merge it with the form action and nonce.\n\t\tconst formData = Object.fromEntries( new FormData( form ).entries() );\n\t\tformData.formAction = form.action;\n\t\tformData._ajax_nonce = wpBlockFormSettings.nonce;\n\t\tformData.action = wpBlockFormSettings.action;\n\n\t\ttry {\n\t\t\tconst response = await fetch( wpBlockFormSettings.ajaxUrl, {\n\t\t\t\tmethod: 'POST',\n\t\t\t\theaders: {\n\t\t\t\t\t'Content-Type': 'application/x-www-form-urlencoded',\n\t\t\t\t},\n\t\t\t\tbody: new URLSearchParams( formData ).toString(),\n\t\t\t} );\n\t\t\tif ( response.ok ) {\n\t\t\t\tredirectNotification( 'success' );\n\t\t\t} else {\n\t\t\t\tredirectNotification( 'error' );\n\t\t\t}\n\t\t} catch ( error ) {\n\t\t\tredirectNotification( 'error' );\n\t\t}\n\t} );\n} );\n"],"mappings":";;AAAA;AACA;AACAA,QAAQ,CAACC,gBAAgB,CAAE,oBAAqB,CAAC,CAACC,OAAO,CAAE,UAAWC,IAAI,EAAG;EAC5E;EACA,IAAK,CAAEA,IAAI,CAACC,MAAM,IAAI,CAAED,IAAI,CAACC,MAAM,CAACC,UAAU,CAAE,SAAU,CAAC,EAAG;IAC7D;EACD;EAEA,MAAMC,oBAAoB,GAAKC,MAAM,IAAM;IAC1C,MAAMC,SAAS,GAAG,IAAIC,eAAe,CAAEC,MAAM,CAACC,QAAQ,CAACC,MAAO,CAAC;IAC/DJ,SAAS,CAACK,MAAM,CAAE,gBAAgB,EAAEN,MAAO,CAAC;IAC5CG,MAAM,CAACC,QAAQ,CAACC,MAAM,GAAGJ,SAAS,CAACM,QAAQ,CAAC,CAAC;EAC9C,CAAC;;EAED;EACAX,IAAI,CAACY,gBAAgB,CAAE,QAAQ,EAAE,gBAAiBC,KAAK,EAAG;IACzDA,KAAK,CAACC,cAAc,CAAC,CAAC;IACtB;IACA,MAAMC,QAAQ,GAAGC,MAAM,CAACC,WAAW,CAAE,IAAIC,QAAQ,CAAElB,IAAK,CAAC,CAACmB,OAAO,CAAC,CAAE,CAAC;IACrEJ,QAAQ,CAACK,UAAU,GAAGpB,IAAI,CAACC,MAAM;IACjCc,QAAQ,CAACM,WAAW,GAAGC,mBAAmB,CAACC,KAAK;IAChDR,QAAQ,CAACd,MAAM,GAAGqB,mBAAmB,CAACrB,MAAM;IAE5C,IAAI;MACH,MAAMuB,QAAQ,GAAG,MAAMC,KAAK,CAAEH,mBAAmB,CAACI,OAAO,EAAE;QAC1DC,MAAM,EAAE,MAAM;QACdC,OAAO,EAAE;UACR,cAAc,EAAE;QACjB,CAAC;QACDC,IAAI,EAAE,IAAIvB,eAAe,CAAES,QAAS,CAAC,CAACJ,QAAQ,CAAC;MAChD,CAAE,CAAC;MACH,IAAKa,QAAQ,CAACM,EAAE,EAAG;QAClB3B,oBAAoB,CAAE,SAAU,CAAC;MAClC,CAAC,MAAM;QACNA,oBAAoB,CAAE,OAAQ,CAAC;MAChC;IACD,CAAC,CAAC,OAAQ4B,KAAK,EAAG;MACjB5B,oBAAoB,CAAE,OAAQ,CAAC;IAChC;EACD,CAAE,CAAC;AACJ,CAAE,CAAC"}
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _react = require("react");
9
+ var _classnames = _interopRequireDefault(require("classnames"));
10
+ var _i18n = require("@wordpress/i18n");
11
+ var _blockEditor = require("@wordpress/block-editor");
12
+ var _components = require("@wordpress/components");
13
+ var _element = require("@wordpress/element");
14
+ /**
15
+ * External dependencies
16
+ */
17
+
18
+ /**
19
+ * WordPress dependencies
20
+ */
21
+
22
+ function InputFieldBlock({
23
+ attributes,
24
+ setAttributes,
25
+ className
26
+ }) {
27
+ const {
28
+ type,
29
+ name,
30
+ label,
31
+ inlineLabel,
32
+ required,
33
+ placeholder,
34
+ value
35
+ } = attributes;
36
+ const blockProps = (0, _blockEditor.useBlockProps)();
37
+ const ref = (0, _element.useRef)();
38
+ const TagName = type === 'textarea' ? 'textarea' : 'input';
39
+ const borderProps = (0, _blockEditor.__experimentalUseBorderProps)(attributes);
40
+ const colorProps = (0, _blockEditor.__experimentalUseColorProps)(attributes);
41
+ if (ref.current) {
42
+ ref.current.focus();
43
+ }
44
+ const controls = (0, _react.createElement)(_react.Fragment, null, 'hidden' !== type && (0, _react.createElement)(_blockEditor.InspectorControls, null, (0, _react.createElement)(_components.PanelBody, {
45
+ title: (0, _i18n.__)('Input settings')
46
+ }, 'checkbox' !== type && (0, _react.createElement)(_components.CheckboxControl, {
47
+ label: (0, _i18n.__)('Inline label'),
48
+ checked: inlineLabel,
49
+ onChange: newVal => {
50
+ setAttributes({
51
+ inlineLabel: newVal
52
+ });
53
+ }
54
+ }), (0, _react.createElement)(_components.CheckboxControl, {
55
+ label: (0, _i18n.__)('Required'),
56
+ checked: required,
57
+ onChange: newVal => {
58
+ setAttributes({
59
+ required: newVal
60
+ });
61
+ }
62
+ }))), (0, _react.createElement)(_blockEditor.InspectorControls, {
63
+ __experimentalGroup: "advanced"
64
+ }, (0, _react.createElement)(_components.TextControl, {
65
+ autoComplete: "off",
66
+ label: (0, _i18n.__)('Name'),
67
+ value: name,
68
+ onChange: newVal => {
69
+ setAttributes({
70
+ name: newVal
71
+ });
72
+ },
73
+ help: (0, _i18n.__)('Affects the "name" atribute of the input element, and is used as a name for the form submission results.')
74
+ })));
75
+ if ('hidden' === type) {
76
+ return (0, _react.createElement)(_react.Fragment, null, controls, (0, _react.createElement)("input", {
77
+ type: "hidden",
78
+ className: (0, _classnames.default)(className, 'wp-block-form-input__input', colorProps.className, borderProps.className),
79
+ "aria-label": (0, _i18n.__)('Value'),
80
+ value: value,
81
+ onChange: event => setAttributes({
82
+ value: event.target.value
83
+ })
84
+ }));
85
+ }
86
+ return (0, _react.createElement)("div", {
87
+ ...blockProps
88
+ }, controls, (0, _react.createElement)("span", {
89
+ className: (0, _classnames.default)('wp-block-form-input__label', {
90
+ 'is-label-inline': inlineLabel || 'checkbox' === type
91
+ })
92
+ }, (0, _react.createElement)(_blockEditor.RichText, {
93
+ tagName: "span",
94
+ className: "wp-block-form-input__label-content",
95
+ value: label,
96
+ onChange: newLabel => setAttributes({
97
+ label: newLabel
98
+ }),
99
+ "aria-label": label ? (0, _i18n.__)('Label') : (0, _i18n.__)('Empty label'),
100
+ "data-empty": label ? false : true,
101
+ placeholder: (0, _i18n.__)('Type the label for this input')
102
+ }), (0, _react.createElement)(TagName, {
103
+ type: 'textarea' === type ? undefined : type,
104
+ className: (0, _classnames.default)(className, 'wp-block-form-input__input', colorProps.className, borderProps.className),
105
+ "aria-label": (0, _i18n.__)('Optional placeholder text')
106
+ // We hide the placeholder field's placeholder when there is a value. This
107
+ // stops screen readers from reading the placeholder field's placeholder
108
+ // which is confusing.
109
+ ,
110
+ placeholder: placeholder ? undefined : (0, _i18n.__)('Optional placeholder…'),
111
+ value: placeholder,
112
+ onChange: event => setAttributes({
113
+ placeholder: event.target.value
114
+ }),
115
+ "aria-required": required,
116
+ style: {
117
+ ...borderProps.style,
118
+ ...colorProps.style
119
+ }
120
+ })));
121
+ }
122
+ var _default = InputFieldBlock;
123
+ exports.default = _default;
124
+ //# sourceMappingURL=edit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_i18n","_blockEditor","_components","_element","InputFieldBlock","attributes","setAttributes","className","type","name","label","inlineLabel","required","placeholder","value","blockProps","useBlockProps","ref","useRef","TagName","borderProps","useBorderProps","colorProps","useColorProps","current","focus","controls","_react","createElement","Fragment","InspectorControls","PanelBody","title","__","CheckboxControl","checked","onChange","newVal","__experimentalGroup","TextControl","autoComplete","help","classNames","event","target","RichText","tagName","newLabel","undefined","style","_default","exports","default"],"sources":["@wordpress/block-library/src/form-input/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tInspectorControls,\n\tRichText,\n\tuseBlockProps,\n\t__experimentalUseBorderProps as useBorderProps,\n\t__experimentalUseColorProps as useColorProps,\n} from '@wordpress/block-editor';\nimport { PanelBody, TextControl, CheckboxControl } from '@wordpress/components';\n\nimport { useRef } from '@wordpress/element';\n\nfunction InputFieldBlock( { attributes, setAttributes, className } ) {\n\tconst { type, name, label, inlineLabel, required, placeholder, value } =\n\t\tattributes;\n\tconst blockProps = useBlockProps();\n\tconst ref = useRef();\n\tconst TagName = type === 'textarea' ? 'textarea' : 'input';\n\n\tconst borderProps = useBorderProps( attributes );\n\tconst colorProps = useColorProps( attributes );\n\tif ( ref.current ) {\n\t\tref.current.focus();\n\t}\n\n\tconst controls = (\n\t\t<>\n\t\t\t{ 'hidden' !== type && (\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<PanelBody title={ __( 'Input settings' ) }>\n\t\t\t\t\t\t{ 'checkbox' !== type && (\n\t\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Inline label' ) }\n\t\t\t\t\t\t\t\tchecked={ inlineLabel }\n\t\t\t\t\t\t\t\tonChange={ ( newVal ) => {\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tinlineLabel: newVal,\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<CheckboxControl\n\t\t\t\t\t\t\tlabel={ __( 'Required' ) }\n\t\t\t\t\t\t\tchecked={ required }\n\t\t\t\t\t\t\tonChange={ ( newVal ) => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\trequired: newVal,\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</PanelBody>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t<InspectorControls __experimentalGroup=\"advanced\">\n\t\t\t\t<TextControl\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\tvalue={ name }\n\t\t\t\t\tonChange={ ( newVal ) => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tname: newVal,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t'Affects the \"name\" atribute of the input element, and is used as a name for the form submission results.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n\n\tif ( 'hidden' === type ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ controls }\n\t\t\t\t<input\n\t\t\t\t\ttype=\"hidden\"\n\t\t\t\t\tclassName={ classNames(\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t'wp-block-form-input__input',\n\t\t\t\t\t\tcolorProps.className,\n\t\t\t\t\t\tborderProps.className\n\t\t\t\t\t) }\n\t\t\t\t\taria-label={ __( 'Value' ) }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ ( event ) =>\n\t\t\t\t\t\tsetAttributes( { value: event.target.value } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t{ controls }\n\t\t\t<span\n\t\t\t\tclassName={ classNames( 'wp-block-form-input__label', {\n\t\t\t\t\t'is-label-inline': inlineLabel || 'checkbox' === type,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t<RichText\n\t\t\t\t\ttagName=\"span\"\n\t\t\t\t\tclassName=\"wp-block-form-input__label-content\"\n\t\t\t\t\tvalue={ label }\n\t\t\t\t\tonChange={ ( newLabel ) =>\n\t\t\t\t\t\tsetAttributes( { label: newLabel } )\n\t\t\t\t\t}\n\t\t\t\t\taria-label={ label ? __( 'Label' ) : __( 'Empty label' ) }\n\t\t\t\t\tdata-empty={ label ? false : true }\n\t\t\t\t\tplaceholder={ __( 'Type the label for this input' ) }\n\t\t\t\t/>\n\t\t\t\t<TagName\n\t\t\t\t\ttype={ 'textarea' === type ? undefined : type }\n\t\t\t\t\tclassName={ classNames(\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t'wp-block-form-input__input',\n\t\t\t\t\t\tcolorProps.className,\n\t\t\t\t\t\tborderProps.className\n\t\t\t\t\t) }\n\t\t\t\t\taria-label={ __( 'Optional placeholder text' ) }\n\t\t\t\t\t// We hide the placeholder field's placeholder when there is a value. This\n\t\t\t\t\t// stops screen readers from reading the placeholder field's placeholder\n\t\t\t\t\t// which is confusing.\n\t\t\t\t\tplaceholder={\n\t\t\t\t\t\tplaceholder ? undefined : __( 'Optional placeholder…' )\n\t\t\t\t\t}\n\t\t\t\t\tvalue={ placeholder }\n\t\t\t\t\tonChange={ ( event ) =>\n\t\t\t\t\t\tsetAttributes( { placeholder: event.target.value } )\n\t\t\t\t\t}\n\t\t\t\t\taria-required={ required }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t...borderProps.style,\n\t\t\t\t\t\t...colorProps.style,\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</span>\n\t\t</div>\n\t);\n}\n\nexport default InputFieldBlock;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAOA,IAAAG,WAAA,GAAAH,OAAA;AAEA,IAAAI,QAAA,GAAAJ,OAAA;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;A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AAe;AAAA+C,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.settings = exports.name = exports.metadata = exports.init = void 0;
8
+ var _initBlock = _interopRequireDefault(require("../utils/init-block"));
9
+ var _edit = _interopRequireDefault(require("./edit"));
10
+ var _save = _interopRequireDefault(require("./save"));
11
+ var _variations = _interopRequireDefault(require("./variations"));
12
+ /**
13
+ * Internal dependencies
14
+ */
15
+ const metadata = {
16
+ $schema: "https://schemas.wp.org/trunk/block.json",
17
+ apiVersion: 3,
18
+ __experimental: true,
19
+ name: "core/form-input",
20
+ title: "Input field",
21
+ category: "common",
22
+ parent: ["core/form"],
23
+ description: "The basic building block for forms.",
24
+ keywords: ["input", "form"],
25
+ textdomain: "default",
26
+ icon: "forms",
27
+ attributes: {
28
+ type: {
29
+ type: "string",
30
+ "default": "text"
31
+ },
32
+ name: {
33
+ type: "string"
34
+ },
35
+ label: {
36
+ type: "string",
37
+ "default": "Label",
38
+ selector: ".wp-block-form-input__label-content",
39
+ source: "html",
40
+ __experimentalRole: "content"
41
+ },
42
+ inlineLabel: {
43
+ type: "boolean",
44
+ "default": false
45
+ },
46
+ required: {
47
+ type: "boolean",
48
+ "default": false,
49
+ selector: ".wp-block-form-input__input",
50
+ source: "attribute",
51
+ attribute: "required"
52
+ },
53
+ placeholder: {
54
+ type: "string",
55
+ selector: ".wp-block-form-input__input",
56
+ source: "attribute",
57
+ attribute: "placeholder",
58
+ __experimentalRole: "content"
59
+ },
60
+ value: {
61
+ type: "string",
62
+ "default": "",
63
+ selector: "input",
64
+ source: "attribute",
65
+ attribute: "value"
66
+ },
67
+ visibilityPermissions: {
68
+ type: "string",
69
+ "default": "all"
70
+ }
71
+ },
72
+ supports: {
73
+ anchor: true,
74
+ reusable: false,
75
+ spacing: {
76
+ margin: ["top", "bottom"]
77
+ },
78
+ __experimentalBorder: {
79
+ radius: true,
80
+ __experimentalSkipSerialization: true,
81
+ __experimentalDefaultControls: {
82
+ radius: true
83
+ }
84
+ }
85
+ },
86
+ style: ["wp-block-form-input"]
87
+ };
88
+ exports.metadata = metadata;
89
+ const {
90
+ name
91
+ } = metadata;
92
+ exports.name = name;
93
+ const settings = {
94
+ edit: _edit.default,
95
+ save: _save.default,
96
+ variations: _variations.default
97
+ };
98
+ exports.settings = settings;
99
+ const init = () => (0, _initBlock.default)({
100
+ name,
101
+ metadata,
102
+ settings
103
+ });
104
+ exports.init = init;
105
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_initBlock","_interopRequireDefault","require","_edit","_save","_variations","metadata","$schema","apiVersion","__experimental","name","title","category","parent","description","keywords","textdomain","icon","attributes","type","label","selector","source","__experimentalRole","inlineLabel","required","attribute","placeholder","value","visibilityPermissions","supports","anchor","reusable","spacing","margin","__experimentalBorder","radius","__experimentalSkipSerialization","__experimentalDefaultControls","style","exports","settings","edit","save","variations","init","initBlock"],"sources":["@wordpress/block-library/src/form-input/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport variations from './variations';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\tedit,\n\tsave,\n\tvariations,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":";;;;;;;AAGA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,KAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,WAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAPA;AACA;AACA;AAFA,MAAAI,QAAA;EAAAC,OAAA;EAAAC,UAAA;EAAAC,cAAA;EAAAC,IAAA;EAAAC,KAAA;E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(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _ = require("./");
8
+ /**
9
+ * Internal dependencies
10
+ */
11
+ var _default = (0, _.init)();
12
+ exports.default = _default;
13
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_","require","_default","init","exports","default"],"sources":["@wordpress/block-library/src/form-input/init.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { init } from './';\n\nexport default init();\n"],"mappings":";;;;;;AAGA,IAAAA,CAAA,GAAAC,OAAA;AAHA;AACA;AACA;AAFA,IAAAC,QAAA,GAKe,IAAAC,MAAI,EAAC,CAAC;AAAAC,OAAA,CAAAC,OAAA,GAAAH,QAAA"}
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = save;
8
+ var _react = require("react");
9
+ var _classnames = _interopRequireDefault(require("classnames"));
10
+ var _removeAccents = _interopRequireDefault(require("remove-accents"));
11
+ var _blockEditor = require("@wordpress/block-editor");
12
+ /**
13
+ * External dependencies
14
+ */
15
+
16
+ /**
17
+ * WordPress dependencies
18
+ */
19
+
20
+ /**
21
+ * Get the name attribute from a content string.
22
+ *
23
+ * @param {string} content The block content.
24
+ *
25
+ * @return {string} Returns the slug.
26
+ */
27
+ const getNameFromLabel = content => {
28
+ const dummyElement = document.createElement('div');
29
+ dummyElement.innerHTML = content;
30
+ // Get the slug.
31
+ return (0, _removeAccents.default)(dummyElement.innerText)
32
+ // Convert anything that's not a letter or number to a hyphen.
33
+ .replace(/[^\p{L}\p{N}]+/gu, '-')
34
+ // Convert to lowercase
35
+ .toLowerCase()
36
+ // Remove any remaining leading or trailing hyphens.
37
+ .replace(/(^-+)|(-+$)/g, '');
38
+ };
39
+ function save({
40
+ attributes
41
+ }) {
42
+ const {
43
+ type,
44
+ name,
45
+ label,
46
+ inlineLabel,
47
+ required,
48
+ placeholder,
49
+ value
50
+ } = attributes;
51
+ const borderProps = (0, _blockEditor.__experimentalGetBorderClassesAndStyles)(attributes);
52
+ const colorProps = (0, _blockEditor.__experimentalGetColorClassesAndStyles)(attributes);
53
+ const inputStyle = {
54
+ ...borderProps.style,
55
+ ...colorProps.style
56
+ };
57
+ const inputClasses = (0, _classnames.default)('wp-block-form-input__input', colorProps.className, borderProps.className);
58
+ const TagName = type === 'textarea' ? 'textarea' : 'input';
59
+ if ('hidden' === type) {
60
+ return (0, _react.createElement)("input", {
61
+ type: type,
62
+ name: name,
63
+ value: value
64
+ });
65
+ }
66
+
67
+ /* eslint-disable jsx-a11y/label-has-associated-control */
68
+ return (0, _react.createElement)("label", {
69
+ className: (0, _classnames.default)('wp-block-form-input__label', {
70
+ 'is-label-inline': inlineLabel
71
+ })
72
+ }, (0, _react.createElement)("span", {
73
+ className: "wp-block-form-input__label-content"
74
+ }, (0, _react.createElement)(_blockEditor.RichText.Content, {
75
+ value: label
76
+ })), (0, _react.createElement)(TagName, {
77
+ className: inputClasses,
78
+ type: 'textarea' === type ? undefined : type,
79
+ name: name || getNameFromLabel(label),
80
+ required: required,
81
+ "aria-required": required,
82
+ placeholder: placeholder || undefined,
83
+ style: inputStyle
84
+ }));
85
+ /* eslint-enable jsx-a11y/label-has-associated-control */
86
+ }
87
+ //# sourceMappingURL=save.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_removeAccents","_blockEditor","getNameFromLabel","content","dummyElement","document","createElement","innerHTML","removeAccents","innerText","replace","toLowerCase","save","attributes","type","name","label","inlineLabel","required","placeholder","value","borderProps","getBorderClassesAndStyles","colorProps","getColorClassesAndStyles","inputStyle","style","inputClasses","classNames","className","TagName","_react","RichText","Content","undefined"],"sources":["@wordpress/block-library/src/form-input/save.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classNames from 'classnames';\nimport removeAccents from 'remove-accents';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tRichText,\n\t__experimentalGetBorderClassesAndStyles as getBorderClassesAndStyles,\n\t__experimentalGetColorClassesAndStyles as getColorClassesAndStyles,\n} from '@wordpress/block-editor';\n\n/**\n * Get the name attribute from a content string.\n *\n * @param {string} content The block content.\n *\n * @return {string} Returns the slug.\n */\nconst getNameFromLabel = ( content ) => {\n\tconst dummyElement = document.createElement( 'div' );\n\tdummyElement.innerHTML = content;\n\t// Get the slug.\n\treturn (\n\t\tremoveAccents( dummyElement.innerText )\n\t\t\t// Convert anything that's not a letter or number to a hyphen.\n\t\t\t.replace( /[^\\p{L}\\p{N}]+/gu, '-' )\n\t\t\t// Convert to lowercase\n\t\t\t.toLowerCase()\n\t\t\t// Remove any remaining leading or trailing hyphens.\n\t\t\t.replace( /(^-+)|(-+$)/g, '' )\n\t);\n};\n\nexport default function save( { attributes } ) {\n\tconst { type, name, label, inlineLabel, required, placeholder, value } =\n\t\tattributes;\n\n\tconst borderProps = getBorderClassesAndStyles( attributes );\n\tconst colorProps = getColorClassesAndStyles( attributes );\n\n\tconst inputStyle = {\n\t\t...borderProps.style,\n\t\t...colorProps.style,\n\t};\n\n\tconst inputClasses = classNames(\n\t\t'wp-block-form-input__input',\n\t\tcolorProps.className,\n\t\tborderProps.className\n\t);\n\tconst TagName = type === 'textarea' ? 'textarea' : 'input';\n\n\tif ( 'hidden' === type ) {\n\t\treturn <input type={ type } name={ name } value={ value } />;\n\t}\n\n\t/* eslint-disable jsx-a11y/label-has-associated-control */\n\treturn (\n\t\t<label\n\t\t\tclassName={ classNames( 'wp-block-form-input__label', {\n\t\t\t\t'is-label-inline': inlineLabel,\n\t\t\t} ) }\n\t\t>\n\t\t\t<span className=\"wp-block-form-input__label-content\">\n\t\t\t\t<RichText.Content value={ label } />\n\t\t\t</span>\n\t\t\t<TagName\n\t\t\t\tclassName={ inputClasses }\n\t\t\t\ttype={ 'textarea' === type ? undefined : type }\n\t\t\t\tname={ name || getNameFromLabel( label ) }\n\t\t\t\trequired={ required }\n\t\t\t\taria-required={ required }\n\t\t\t\tplaceholder={ placeholder || undefined }\n\t\t\t\tstyle={ inputStyle }\n\t\t\t/>\n\t\t</label>\n\t);\n\t/* eslint-enable jsx-a11y/label-has-associated-control */\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAF,sBAAA,CAAAC,OAAA;AAKA,IAAAE,YAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,gBAAgB,GAAKC,OAAO,IAAM;EACvC,MAAMC,YAAY,GAAGC,QAAQ,CAACC,aAAa,CAAE,KAAM,CAAC;EACpDF,YAAY,CAACG,SAAS,GAAGJ,OAAO;EAChC;EACA,OACC,IAAAK,sBAAa,EAAEJ,YAAY,CAACK,SAAU;EACrC;EAAA,CACCC,OAAO,CAAE,kBAAkB,EAAE,GAAI;EAClC;EAAA,CACCC,WAAW,CAAC;EACb;EAAA,CACCD,OAAO,CAAE,cAAc,EAAE,EAAG,CAAC;AAEjC,CAAC;AAEc,SAASE,IAAIA,CAAE;EAAEC;AAAW,CAAC,EAAG;EAC9C,MAAM;IAAEC,IAAI;IAAEC,IAAI;IAAEC,KAAK;IAAEC,WAAW;IAAEC,QAAQ;IAAEC,WAAW;IAAEC;EAAM,CAAC,GACrEP,UAAU;EAEX,MAAMQ,WAAW,GAAG,IAAAC,oDAAyB,EAAET,UAAW,CAAC;EAC3D,MAAMU,UAAU,GAAG,IAAAC,mDAAwB,EAAEX,UAAW,CAAC;EAEzD,MAAMY,UAAU,GAAG;IAClB,GAAGJ,WAAW,CAACK,KAAK;IACpB,GAAGH,UAAU,CAACG;EACf,CAAC;EAED,MAAMC,YAAY,GAAG,IAAAC,mBAAU,EAC9B,4BAA4B,EAC5BL,UAAU,CAACM,SAAS,EACpBR,WAAW,CAACQ,SACb,CAAC;EACD,MAAMC,OAAO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